Browse Source

Add "lock modules" to toolbar

tags/v0.6.1
Andrew Belt 6 years ago
parent
commit
8063a2faa0
5 changed files with 73 additions and 3 deletions
  1. +1
    -0
      include/app.hpp
  2. +1
    -0
      res/icons/LICENSE.md
  3. +56
    -0
      res/icons/noun_468341_cc.svg
  4. +5
    -3
      src/app/ModuleWidget.cpp
  5. +10
    -0
      src/app/Toolbar.cpp

+ 1
- 0
include/app.hpp View File

@@ -145,6 +145,7 @@ struct RackWidget : OpaqueWidget {
WireContainer *wireContainer;
std::string lastPath;
Vec lastMousePos;
bool lockModules = false;

RackWidget();
~RackWidget();


+ 1
- 0
res/icons/LICENSE.md View File

@@ -9,3 +9,4 @@ Cat by Nabilauzwa from the Noun Project
Stopwatch by Arthur Shlain from the Noun Project
Sound by Gregor Cresnar from the Noun Project
Refresh by un·delivered from the Noun Project
Lock by Andres Gleixner from the Noun Project

+ 56
- 0
res/icons/noun_468341_cc.svg View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
viewBox="-7074.5 3413.5 16 16"
enable-background="new -7074.5 3413.5 24 24"
xml:space="preserve"
id="svg12"
sodipodi:docname="noun_468341_cc.svg"
width="16"
height="16"
inkscape:version="0.92.2 2405546, 2018-03-11"><metadata
id="metadata18"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs16" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="882"
id="namedview14"
showgrid="false"
inkscape:zoom="7.8666667"
inkscape:cx="-9.7372881"
inkscape:cy="15"
inkscape:window-x="0"
inkscape:window-y="18"
inkscape:window-maximized="0"
inkscape:current-layer="svg12" /><g
id="g6"
transform="matrix(0.49999833,0,0,0.49999833,-3535.2618,1708.7557)"
style="fill:#b4b4b4;fill-opacity:1"><path
d="m -7066.5,3420.5 c 0,-2 1.054,-4.287 4,-4.287 2.973,0 4,2.287 4,4.287 v 3 h 3 v -3.509 c 0,-3.491 -3.196,-6.478 -7,-6.491 -4.063,-0.018 -7.002,2.991 -7,7 -0.01,0.084 0,3 0,3 h 3 z"
id="path2"
inkscape:connector-curvature="0"
style="fill:#b4b4b4;fill-opacity:1" /><rect
x="-7071.5"
y="3424.5"
width="18"
height="13"
id="rect4"
style="fill:#b4b4b4;fill-opacity:1" /></g></svg>

+ 5
- 3
src/app/ModuleWidget.cpp View File

@@ -301,9 +301,11 @@ void ModuleWidget::onDragEnd(EventDragEnd &e) {
}

void ModuleWidget::onDragMove(EventDragMove &e) {
Rect newBox = box;
newBox.pos = gRackWidget->lastMousePos.minus(dragPos);
gRackWidget->requestModuleBoxNearest(this, newBox);
if (!gRackWidget->lockModules) {
Rect newBox = box;
newBox.pos = gRackWidget->lastMousePos.minus(dragPos);
gRackWidget->requestModuleBoxNearest(this, newBox);
}
}




+ 10
- 0
src/app/Toolbar.cpp View File

@@ -140,6 +140,15 @@ struct SampleRateButton : TooltipIconButton {
}
};

struct RackLockButton : TooltipIconButton {
RackLockButton() {
setSVG(SVG::load(assetGlobal("res/icons/noun_468341_cc.svg")));
tooltipText = "Lock modules";
}
void onAction(EventAction &e) override {
gRackWidget->lockModules ^= true;
}
};


Toolbar::Toolbar() {
@@ -176,6 +185,7 @@ Toolbar::Toolbar() {

layout->addChild(new SampleRateButton());
layout->addChild(new PowerMeterButton());
layout->addChild(new RackLockButton());

struct ZoomSlider : Slider {
void onAction(EventAction &e) override {


Loading…
Cancel
Save