Browse Source

Merge branch 'master' of https://github.com/VCVRack/Rack into 2017-10-bontric-midiCC-fix

tags/v0.5.0
ben 7 years ago
parent
commit
b4ed732e43
6 changed files with 17 additions and 8 deletions
  1. +4
    -1
      .gitignore
  2. +2
    -0
      include/app.hpp
  3. +2
    -2
      src/app/ModuleWidget.cpp
  4. +6
    -2
      src/app/RackWidget.cpp
  5. +1
    -1
      src/app/Toolbar.cpp
  6. +2
    -2
      src/app/WireWidget.cpp

+ 4
- 1
.gitignore View File

@@ -4,4 +4,7 @@
/settings.json
/plugins
/build
/dep
/dep
*.vcv
/patches
/design

+ 2
- 0
include/app.hpp View File

@@ -111,6 +111,7 @@ struct RackWidget : OpaqueWidget {
// Only put WireWidgets in here
WireContainer *wireContainer;
std::string lastPath;
Vec lastMousePos;

RackWidget();
~RackWidget();
@@ -138,6 +139,7 @@ struct RackWidget : OpaqueWidget {
void step() override;
void draw(NVGcontext *vg) override;

Widget *onMouseMove(Vec pos, Vec mouseRel) override;
void onMouseDownOpaque(int button) override;
};



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

@@ -192,12 +192,12 @@ Widget *ModuleWidget::onHoverKey(Vec pos, int key) {
}

void ModuleWidget::onDragStart() {
dragPos = gMousePos.minus(getAbsolutePos());
dragPos = gRackWidget->lastMousePos.minus(box.pos);
}

void ModuleWidget::onDragMove(Vec mouseRel) {
Rect newBox = box;
newBox.pos = gMousePos.minus(parent->getAbsolutePos()).minus(dragPos);
newBox.pos = gRackWidget->lastMousePos.minus(dragPos);
gRackWidget->requestModuleBoxNearest(this, newBox);
}



+ 6
- 2
src/app/RackWidget.cpp View File

@@ -475,9 +475,13 @@ struct SearchModuleField : TextField {
}
};

Widget *RackWidget::onMouseMove(Vec pos, Vec mouseRel) {
lastMousePos = pos;
return OpaqueWidget::onMouseMove(pos, mouseRel);
}

void RackWidget::onMouseDownOpaque(int button) {
if (button == 1) {
Vec modulePos = gMousePos.minus(getAbsolutePos());
Menu *menu = gScene->createMenu();

menu->pushChild(construct<MenuLabel>(&MenuLabel::text, "Add module"));
@@ -503,7 +507,7 @@ void RackWidget::onMouseDownOpaque(int button) {
AddManufacturerMenuItem *item = new AddManufacturerMenuItem();
item->text = manufacturerName;
item->manufacturerName = manufacturerName;
item->modulePos = modulePos;
item->modulePos = lastMousePos;
menu->pushChild(item);
}
}


+ 1
- 1
src/app/Toolbar.cpp View File

@@ -153,7 +153,7 @@ Toolbar::Toolbar() {
zoomSlider->box.size.x = 150;
zoomSlider->label = "Zoom";
zoomSlider->unit = "%";
zoomSlider->setLimits(50.0, 200.0);
zoomSlider->setLimits(25.0, 200.0);
zoomSlider->setDefaultValue(100.0);
addChild(zoomSlider);
xPos += zoomSlider->box.size.x;


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

@@ -132,7 +132,7 @@ Vec WireWidget::getOutputPos() {
pos = Rect(hoveredOutputPort->getAbsolutePos(), hoveredOutputPort->box.size).getCenter();
}
else {
pos = gMousePos;
return gRackWidget->lastMousePos;
}
return pos.minus(getAbsolutePos().minus(box.pos));
}
@@ -146,7 +146,7 @@ Vec WireWidget::getInputPos() {
pos = Rect(hoveredInputPort->getAbsolutePos(), hoveredInputPort->box.size).getCenter();
}
else {
pos = gMousePos;
return gRackWidget->lastMousePos;
}
return pos.minus(getAbsolutePos().minus(box.pos));
}


Loading…
Cancel
Save