48 virtual void Clear()
override {}
91 std::shared_ptr<Canvas>
GetCurrentCanvas() {
if(canvas_stack.size() == 0)
return nullptr;
else return canvas_stack.back().first; }
94 std::shared_ptr<Canvas>
GetTopCanvas() {
if(canvas_stack.size() == 0)
return nullptr;
else return canvas_stack.front().first; }
98 void EnterCanvas(std::shared_ptr<Canvas> canvas, std::string name=
"");
114 std::deque<std::pair<std::shared_ptr<Canvas>, std::string>> canvas_stack;
117 std::vector<std::shared_ptr<ModuleGUI>> module_guis;
119 void CreateModuleGUIs();
123 int InWhich(
Point2D relative_pos);
127 bool lmb_down =
false;
128 bool mmb_down =
false;
140 ModeSliderRelativeOutlet,
141 ModeSliderAbsoluteOutlet,
143 MouseDownMode mouse_down_mode;
147 std::string mouse_down_elem_paramid;
149 Point2D mouse_down_position, drag_position;
152 int mouse_down_id = -1;
157 std::list<std::pair<std::shared_ptr<ModuleGUI>,
Point2D>> selection;
158 void ClearSelection();
159 void SelectSingle(std::shared_ptr<ModuleGUI>);
160 void AddToSelection(std::shared_ptr<ModuleGUI>);
172 inline Point2D_<float> PositionAbsToRel(Point2D_<float> abs){
return view_position + (abs -
current_size/2)/view_zoom; }
175 bool drag_in_progress =
false;
176 bool view_move_in_progress =
false;
180 DragModeConnectAudioFromInlet,
181 DragModeConnectAudioFromOutlet,
182 DragModeConnectDataFromInlet,
183 DragModeConnectDataFromRelativeOutlet,
184 DragModeConnectDataFromAbsoluteOutlet,
191 void FinalizeAudioConnectingDrag(
int inlet_module_id, UIWidget::ID inlet_id,
int outlet_module_id, UIWidget::ID outlet_id);
192 void FinalizeDataConnectingDrag(
int inlet_module_id, UIWidget::ID inlet_slider_id,
int outlet_module_id, UIWidget::ID outlet_slider_id,
Canvas::DataConnectionMode);
198 Point2D view_move_start_view_position;
205 enum class PotentialWireMode{
210 enum class PotentialWireType{
218 PotentialWireType potential_wire_type;
219 std::pair<std::pair<int,std::string>, std::pair<int,std::string>> potential_wire_connection;
221 Subscription fadeout_anim;
223 PotentialWireType fadeout_wire_type;
224 std::pair<std::pair<std::weak_ptr<ModuleGUI>,std::string>, std::pair<std::weak_ptr<ModuleGUI>,std::string>> fadeout_wire_connection;
225 void FadeoutWireStart(PotentialWireMode m);
226 void FadeoutWireStep(
float delta);
230 bool shift_held =
false, ctrl_held =
false, alt_held =
false;
234 float view_zoom = 1.0;
239 #endif //CANVASVIEW_HPP
void MouseMotionOverCanvasPlane(Point2D from_rel, Point2D to_rel)
Definition: DrawContext.hpp:65
Signal on_canvas_stack_path_changed
Definition: CanvasView.hpp:107
virtual void CustomMouseMotion(Point2D from_abs, Point2D to_abs) override
Point2D_< int > Point2D
Definition: Utilities.hpp:35
virtual void Clear() override
Definition: CanvasView.hpp:48
virtual Point2D GetChildPos(std::shared_ptr< UIWidget >) const override
MouseButton
Definition: Utilities.hpp:190
std::vector< std::string > GetCanvasStackPath()
void SwitchTopLevelCanvas(std::shared_ptr< Canvas > canvas, std::string name)
void SetZoom(float level)
DataConnectionMode
Definition: Canvas.hpp:129
void EnterCanvas(std::shared_ptr< Canvas > canvas, std::string name="")
virtual void CustomDraw(DrawContext &c)
Definition: CanvasView.hpp:37
virtual void OnKeyboard(KeyData)
Definition: UIContainer.hpp:60
Definition: Alertable.hpp:26
virtual bool CustomMousePress(bool, MouseButton, Point2D)
std::shared_ptr< Canvas > GetCurrentCanvas()
Definition: CanvasView.hpp:91
virtual void CustomMouseEnter(Point2D)
virtual void CustomMouseLeave(Point2D)
std::shared_ptr< Canvas > GetTopCanvas()
Definition: CanvasView.hpp:94
static std::shared_ptr< CanvasView > CreateEmpty(std::shared_ptr< Window > parent)
Definition: Signal.hpp:145
LateReturn AddModule(std::string id, Point2D position)
Definition: LateReturn.hpp:35
Definition: Utilities.hpp:157