Browse Source

Switch around ParamWidget key commands. Fix text field inner color.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
2338ccb0ae
5 changed files with 30 additions and 12 deletions
  1. +3
    -0
      include/widgets/GLWidget.hpp
  2. +2
    -2
      src/app/Knob.cpp
  3. +20
    -6
      src/app/ParamWidget.cpp
  4. +1
    -0
      src/ui.cpp
  5. +4
    -4
      src/window.cpp

+ 3
- 0
include/widgets/GLWidget.hpp View File

@@ -6,6 +6,9 @@ namespace rack {


struct GLWidget : FramebufferWidget {
/** Draws every frame by default
Override this to restore the default behavior of FramebufferWidget.
*/
void step() override;
void drawFramebuffer() override;
};


+ 2
- 2
src/app/Knob.cpp View File

@@ -66,8 +66,8 @@ void Knob::onDragMove(const event::DragMove &e) {
}
float delta = KNOB_SENSITIVITY * -e.mouseDelta.y * speed * range;

// Drag slower if Mod is held
if ((app()->window->getMods() & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL)
// Drag slower if shift is held
if ((app()->window->getMods() & WINDOW_MOD_MASK) == GLFW_MOD_SHIFT)
delta /= 16.f;

if (snap) {


+ 20
- 6
src/app/ParamWidget.cpp View File

@@ -95,7 +95,7 @@ struct ParamResetItem : MenuItem {
ParamWidget *paramWidget;
ParamResetItem() {
text = "Initialize";
rightText = WINDOW_MOD_ALT_NAME "+Click";
rightText = WINDOW_MOD_CTRL_NAME "+Click";
}
void onAction(const event::Action &e) override {
paramWidget->resetAction();
@@ -107,7 +107,7 @@ struct ParamFieldItem : MenuItem {
ParamWidget *paramWidget;
ParamFieldItem() {
text = "Enter value";
rightText = WINDOW_MOD_SHIFT_NAME "+Click";
rightText = WINDOW_MOD_ALT_NAME "+Click";
}
void onAction(const event::Action &e) override {
paramWidget->createParamField();
@@ -115,6 +115,15 @@ struct ParamFieldItem : MenuItem {
};


struct ParamFineItem : MenuItem {
ParamFineItem() {
text = "Fine adjust";
rightText = WINDOW_MOD_SHIFT_NAME "+Drag";
disabled = true;
}
};


ParamWidget::~ParamWidget() {
if (paramQuantity)
delete paramQuantity;
@@ -157,14 +166,16 @@ void ParamWidget::onButton(const event::Button &e) {
e.consume(this);
}

// Alt-click to reset
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT && (e.mods & WINDOW_MOD_MASK) == GLFW_MOD_ALT) {
// Mod-click to reset
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT && (e.mods & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) {
resetAction();
e.consume(this);
// HACK so that dragging won't occur
e.consume(NULL);
return;
}

// Shift-click to open value entry
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT && (e.mods & WINDOW_MOD_MASK) == GLFW_MOD_SHIFT) {
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT && (e.mods & WINDOW_MOD_MASK) == GLFW_MOD_ALT) {
createParamField();
e.consume(this);
}
@@ -224,6 +235,9 @@ void ParamWidget::createContextMenu() {
ParamFieldItem *fieldItem = new ParamFieldItem;
fieldItem->paramWidget = this;
menu->addChild(fieldItem);

// ParamFineItem *fineItem = new ParamFineItem;
// menu->addChild(fineItem);
}

void ParamWidget::resetAction() {


+ 1
- 0
src/ui.cpp View File

@@ -47,6 +47,7 @@ void setTheme(NVGcolor bg, NVGcolor fg) {
t.textFieldTheme = t.sliderTheme;
t.textFieldTheme.textColor = color::minus(bg, nvgRGB(0x20, 0x20, 0x20));
t.textFieldTheme.textSelectedColor = t.textFieldTheme.textColor;
t.textFieldTheme.itemColor = color::plus(bg, nvgRGB(0x30, 0x30, 0x30));

t.scrollBarTheme.itemColor = color::plus(bg, nvgRGB(0x50, 0x50, 0x50));
t.scrollBarTheme.innerColor = bg;


+ 4
- 4
src/window.cpp View File

@@ -208,9 +208,9 @@ Window::Window() {
#endif
glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE);
glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE);

internal->lastWindowTitle = "";
win = glfwCreateWindow(800, 600, internal->lastWindowTitle.c_str(), NULL, NULL);

if (!win) {
osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Cannot open window with OpenGL 2.0 renderer. Does your graphics card support OpenGL 2.0 or greater? If so, make sure you have the latest graphics drivers installed.");
exit(1);
@@ -240,14 +240,14 @@ Window::Window() {
exit(1);
}

// GLEW generates GL error because it calls glGetString(GL_EXTENSIONS), we'll consume it here.
glGetError();

const GLubyte *renderer = glGetString(GL_RENDERER);
const GLubyte *version = glGetString(GL_VERSION);
INFO("Renderer: %s", renderer);
INFO("OpenGL: %s", version);

// GLEW generates GL error because it calls glGetString(GL_EXTENSIONS), we'll consume it here.
glGetError();

glfwSetWindowSizeLimits(win, 800, 600, GLFW_DONT_CARE, GLFW_DONT_CARE);

// Set up NanoVG


Loading…
Cancel
Save