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