diff --git a/include/app.hpp b/include/app.hpp index 64e70c9f..039d4260 100644 --- a/include/app.hpp +++ b/include/app.hpp @@ -61,7 +61,7 @@ struct ModuleWidget : OpaqueWidget { void onDragStart(); void onDragMove(Vec mouseRel); void onDragEnd(); - void onMouseDown(int button); + void onMouseDownOpaque(int button); }; struct WireWidget : OpaqueWidget { @@ -107,7 +107,7 @@ struct RackWidget : OpaqueWidget { void step(); void draw(NVGcontext *vg); - void onMouseDown(int button); + void onMouseDownOpaque(int button); }; struct RackRail : TransparentWidget { @@ -145,7 +145,7 @@ struct ParamWidget : OpaqueWidget, QuantityWidget { json_t *toJson(); void fromJson(json_t *root); - void onMouseDown(int button); + void onMouseDownOpaque(int button); void onChange(); }; @@ -255,7 +255,7 @@ struct Port : OpaqueWidget { void disconnect(); void draw(NVGcontext *vg); - void onMouseDown(int button); + void onMouseDownOpaque(int button); void onDragEnd(); void onDragStart(); void onDragDrop(Widget *origin); diff --git a/include/widgets.hpp b/include/widgets.hpp index 23200680..a4ff0a31 100644 --- a/include/widgets.hpp +++ b/include/widgets.hpp @@ -150,28 +150,28 @@ struct OpaqueWidget : virtual Widget { Widget *onMouseDown(Vec pos, int button) { Widget *w = Widget::onMouseDown(pos, button); if (w) return w; - onMouseDown(button); + onMouseDownOpaque(button); return this; } Widget *onMouseUp(Vec pos, int button) { Widget *w = Widget::onMouseUp(pos, button); if (w) return w; - onMouseUp(button); + onMouseUpOpaque(button); return this; } Widget *onMouseMove(Vec pos, Vec mouseRel) { Widget *w = Widget::onMouseMove(pos, mouseRel); if (w) return w; - onMouseMove(mouseRel); + onMouseMoveOpaque(mouseRel); return this; } /** "High level" events called by the above lower level events. Use these if you don't care about the clicked position. */ - virtual void onMouseDown(int button) {} - virtual void onMouseUp(int button) {} - virtual void onMouseMove(Vec mouseRel) {} + virtual void onMouseDownOpaque(int button) {} + virtual void onMouseUpOpaque(int button) {} + virtual void onMouseMoveOpaque(Vec mouseRel) {} }; struct SpriteWidget : virtual Widget { diff --git a/src/app/ModuleWidget.cpp b/src/app/ModuleWidget.cpp index 31dc372d..4cf459a5 100644 --- a/src/app/ModuleWidget.cpp +++ b/src/app/ModuleWidget.cpp @@ -82,7 +82,7 @@ void ModuleWidget::fromJson(json_t *rootJ) { size_t paramId; json_t *paramJ; json_array_foreach(paramsJ, paramId, paramJ) { - if (0 <= paramId && paramId < params.size()) { + if (paramId < params.size()) { params[paramId]->fromJson(paramJ); } } @@ -223,7 +223,7 @@ struct DeleteMenuItem : MenuItem { } }; -void ModuleWidget::onMouseDown(int button) { +void ModuleWidget::onMouseDownOpaque(int button) { if (button == 1) { Menu *menu = gScene->createMenu(); diff --git a/src/app/ParamWidget.cpp b/src/app/ParamWidget.cpp index 6f83574d..50e11f09 100644 --- a/src/app/ParamWidget.cpp +++ b/src/app/ParamWidget.cpp @@ -13,7 +13,7 @@ void ParamWidget::fromJson(json_t *rootJ) { setValue(json_number_value(rootJ)); } -void ParamWidget::onMouseDown(int button) { +void ParamWidget::onMouseDownOpaque(int button) { if (button == 1) { setValue(defaultValue); } diff --git a/src/app/Port.cpp b/src/app/Port.cpp index 3830a9a2..bc6f4c1a 100644 --- a/src/app/Port.cpp +++ b/src/app/Port.cpp @@ -34,7 +34,7 @@ void Port::draw(NVGcontext *vg) { } } -void Port::onMouseDown(int button) { +void Port::onMouseDownOpaque(int button) { if (button == 1) { disconnect(); } diff --git a/src/app/RackScene.cpp b/src/app/RackScene.cpp index 5717622a..e6fc8141 100644 --- a/src/app/RackScene.cpp +++ b/src/app/RackScene.cpp @@ -40,7 +40,7 @@ RackScene::RackScene() { scrollWidget->box.pos.y = toolbar->box.size.y; // Check for new version - if (gApplicationVersion != "dev" || true) { + if (gApplicationVersion != "dev") { std::thread versionThread(checkVersion); versionThread.detach(); } diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index d054ba8c..995e9aee 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -326,7 +326,7 @@ struct AddModuleMenuItem : MenuItem { } }; -void RackWidget::onMouseDown(int button) { +void RackWidget::onMouseDownOpaque(int button) { if (button == 1) { Vec modulePos = gMousePos.minus(getAbsolutePos()); Menu *menu = gScene->createMenu(); diff --git a/src/util/request.cpp b/src/util/request.cpp index af9a3a62..001eabf3 100644 --- a/src/util/request.cpp +++ b/src/util/request.cpp @@ -23,7 +23,7 @@ json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ) { // Process data if (dataJ) { - if (method == GET_METHOD) { + if (method == METHOD_GET) { // Append ?key=value&... to url url += "?"; bool isFirst = true; @@ -53,16 +53,16 @@ json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ) { // Set HTTP method switch (method) { - case GET_METHOD: - // This is default + case METHOD_GET: + // This is CURL's default break; - case POST_METHOD: + case METHOD_POST: curl_easy_setopt(curl, CURLOPT_POST, true); break; - case PUT_METHOD: + case METHOD_PUT: curl_easy_setopt(curl, CURLOPT_PUT, true); break; - case DELETE_METHOD: + case METHOD_DELETE: curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE"); break; }