libAlgAudio
v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
|
#include <CanvasView.hpp>
Public Member Functions | |
LateReturn | AddModule (std::string id, Point2D position) |
void | CenterView () |
virtual void | Clear () override |
virtual void | CustomDraw (DrawContext &c) |
virtual void | CustomMouseEnter (Point2D) |
virtual void | CustomMouseLeave (Point2D) |
virtual void | CustomMouseMotion (Point2D from_abs, Point2D to_abs) override |
virtual bool | CustomMousePress (bool, MouseButton, Point2D) |
void | EnterCanvas (std::shared_ptr< Canvas > canvas, std::string name="") |
void | ExitCanvas () |
std::vector< std::string > | GetCanvasStackPath () |
virtual Point2D | GetChildPos (std::shared_ptr< UIWidget >) const override |
std::shared_ptr< Canvas > | GetCurrentCanvas () |
std::shared_ptr< Canvas > | GetTopCanvas () |
void | MouseMotionOverCanvasPlane (Point2D from_rel, Point2D to_rel) |
virtual void | OnKeyboard (KeyData) |
void | RemoveSelected () |
void | SwitchTopLevelCanvas (std::shared_ptr< Canvas > canvas, std::string name) |
void | IncreaseZoom () |
void | DecreaseZoom () |
void | SetZoom (float level) |
Public Member Functions inherited from AlgAudio::UIContainerMultiple | |
virtual void | OnChildFocusRequested (std::shared_ptr< UIWidget > w) override |
virtual bool | OnChildFocusTested (std::shared_ptr< const UIWidget > w) override |
virtual void | OnFocusChanged (bool has_focus) override |
virtual void | RequestFocus () override |
Public Member Functions inherited from AlgAudio::UIWidget | |
virtual std::shared_ptr< UIWidget > | CustomFindChild (ID) const |
virtual void | CustomResize (Size2D) |
void | Draw (DrawContext &c) |
std::shared_ptr< UIWidget > | FindChild (ID search_id) |
Size2D | GetCurrentSize () const |
Point2D | GetPosInParent (std::shared_ptr< UIWidget > ancestor) |
Size2D | GetRequestedSize () const |
std::shared_ptr< Window > | GetWindow () |
bool | HasParent () |
bool | HasZeroArea () const |
void | Resize (Size2D s) |
void | SetBackColor (const Color &c) |
void | SetCustomSize (Size2D size) |
void | SetFrontColor (const Color &c) |
void | TriggerFakeResize () |
virtual | ~UIWidget () |
Public Member Functions inherited from AlgAudio::UIMouseEventsBase | |
void | OnMouseEnter (Point2D) |
void | OnMouseLeave (Point2D) |
void | OnMouseMotion (Point2D, Point2D) |
bool | OnMousePress (bool, MouseButton, Point2D) |
void | SetFocusable (bool f) |
Public Member Functions inherited from AlgAudio::UIVisibilityBase | |
bool | IsDrawn () const |
bool | IsInvisible () const |
void | SetDisplayMode (DisplayMode m) |
Static Public Member Functions | |
static std::shared_ptr < CanvasView > | CreateEmpty (std::shared_ptr< Window > parent) |
Public Attributes | |
Signal | on_canvas_stack_path_changed |
Public Attributes inherited from AlgAudio::UIWidget | |
bool | debug_this_widget = false |
std::weak_ptr< UIWidget > | parent |
ID | widget_id |
Public Attributes inherited from AlgAudio::UIMouseEventsBase | |
Point2D | last_mouse_pos |
Signal | on_clicked |
Signal< Point2D > | on_motion |
Signal< bool > | on_pointed |
Signal< bool > | on_pressed |
Public Attributes inherited from AlgAudio::UIVisibilityBase | |
Signal | on_display_mode_changed |
Public Attributes inherited from AlgAudio::SubscriptionsManager | |
SubscriptionList | subscriptions |
Additional Inherited Members | |
Public Types inherited from AlgAudio::UIVisibilityBase | |
enum | DisplayMode { DisplayMode::Visible, DisplayMode::EmptySpace, DisplayMode::Invisible } |
Protected Member Functions inherited from AlgAudio::UIContainerMultiple | |
UIContainerMultiple (std::weak_ptr< Window > parent_window) | |
Protected Member Functions inherited from AlgAudio::UIWidget | |
bool | IsFocused () const |
bool | IsRoot () const |
virtual void | OnChildRequestedSizeChanged () |
virtual void | OnChildVisibilityChanged () |
void | SetMinimalSize (Size2D) |
void | SetNeedsRedrawing () |
UIWidget (std::weak_ptr< Window > parent_window) | |
Protected Member Functions inherited from AlgAudio::UIMouseEventsBase | |
UIMouseEventsBase () | |
Protected Member Functions inherited from AlgAudio::UIVisibilityBase | |
UIVisibilityBase () | |
Protected Attributes inherited from AlgAudio::UIContainerMultiple | |
std::shared_ptr< UIWidget > | focused_child = nullptr |
Protected Attributes inherited from AlgAudio::UIWidget | |
Size2D | current_size = Size2D(0,0) |
std::weak_ptr< Window > | window |
Protected Attributes inherited from AlgAudio::UIMouseEventsBase | |
bool | focusable = true |
bool | pointed = false |
bool | pressed = false |
Protected Attributes inherited from AlgAudio::UIVisibilityBase | |
DisplayMode | display_mode = DisplayMode::Visible |
This class is a graphical representation of a Canvas. A CanvasView can draw an instance of Canvas. The instance can be switched, for example when the user enters a subpatch, or loads a save file. CanvasView will draw the ModuleGUIs and connections between them. It will also process mouse events, clicks and drags. By reacting on user input it asks the underlying Canvas instance to connect/disconnect modules, etc.
LateReturn AlgAudio::CanvasView::AddModule | ( | std::string | id, |
Point2D | position | ||
) |
void AlgAudio::CanvasView::CenterView | ( | ) |
Resets a view position to the one at the center of the bounding box that has al module guis inside.
|
inlineoverridevirtual |
Implements AlgAudio::UIContainerMultiple.
|
static |
Creates a new empty instance of this widget.
|
virtual |
Implements AlgAudio::UIWidget.
|
virtual |
Reimplemented from AlgAudio::UIMouseEventsBase.
|
virtual |
Reimplemented from AlgAudio::UIMouseEventsBase.
|
overridevirtual |
This routine is called on mouse movement over the widget. See also MouseMotionOverCanvasPlane.
Reimplemented from AlgAudio::UIMouseEventsBase.
|
virtual |
This call is supposed to return TRUE iff it's the end of the click chain, i.e. the event was NOT passed to another widget. It must return FALSE if the event was passed to any child widget.
Reimplemented from AlgAudio::UIMouseEventsBase.
void AlgAudio::CanvasView::DecreaseZoom | ( | ) |
This is what happens on mouse scroll or ctrl+plus/minus. Can be also invoked manually.
void AlgAudio::CanvasView::EnterCanvas | ( | std::shared_ptr< Canvas > | canvas, |
std::string | name = "" |
||
) |
This method switches display to a canvas that is inside the current one, e.g. to a subpatch canvas.
void AlgAudio::CanvasView::ExitCanvas | ( | ) |
This method switches display back to a parent one, reverting the effect of EnterCanvas()
std::vector<std::string> AlgAudio::CanvasView::GetCanvasStackPath | ( | ) |
Returns the list of all canvas currently on the stack (e.g. "Unnamed File", "Subpatch", "Poly").
|
overridevirtual |
Implements AlgAudio::UIContainerMultiple.
|
inline |
Returns the top-level canvas. It is not necessarily the currently displayed canvas, for example if currently displayed canvas is a subpatch.
|
inline |
Returns the currently displayed canvas. It is not necessarily the top-level canvas, for example if currently displayed canvas is a subpatch.
void AlgAudio::CanvasView::IncreaseZoom | ( | ) |
This is what happens on mouse scroll or ctrl+plus/minus. Can be also invoked manually.
This routine is called when mouse pointer is moved over the canvas. This is slightly different from CustomMouseMotion, because there are cases when the pointer IS moved over canvas, but not over widget (e.g. when scrolling mouse wheel, the absolute pointer position is the same, but the relative position slightly changes, as the canvas slightly moves when zoomed).
|
virtual |
Reimplemented from AlgAudio::UIContainerMultiple.
void AlgAudio::CanvasView::RemoveSelected | ( | ) |
This method removes the currencly selected modules from both the CanvasView and the underlying Canvas.
void AlgAudio::CanvasView::SetZoom | ( | float | level | ) |
This is what happens on mouse scroll or ctrl+plus/minus. Can be also invoked manually.
void AlgAudio::CanvasView::SwitchTopLevelCanvas | ( | std::shared_ptr< Canvas > | canvas, |
std::string | name | ||
) |
Switches the canvas this CV displays. If the second argument is true, all ModuleGUIs will be build - so when switching the view context you can ignore that argument, but when loading a file you should set it to true.
Signal AlgAudio::CanvasView::on_canvas_stack_path_changed |
Happens when the GetCanvasStackPath() is going to return a different result than previously.