|
Blender
V2.93
|
#include <math.h>#include "MEM_guardedalloc.h"#include "DNA_userdef_types.h"#include "DNA_windowmanager_types.h"#include "BLI_blenlib.h"#include "BLI_math_base.h"#include "BLI_math_vector.h"#include "BLI_utildefines.h"#include "BKE_context.h"#include "RNA_access.h"#include "RNA_define.h"#include "WM_api.h"#include "WM_types.h"#include "ED_screen.h"#include "UI_interface.h"#include "UI_view2d.h"#include "PIL_time.h"Go to the source code of this file.
Classes | |
| struct | v2dViewPanData |
| struct | v2dViewZoomData |
| struct | SmoothView2DStore |
| struct | v2dScrollerMove |
| struct | View2DScrollers |
View Edge Pan Operator (modal) | |
Scroll the region if the mouse is dragged to an edge. "Invisible" operator that always passes through. | |
| #define | EDGE_PAN_REGION_PAD (U.widget_unit) |
| #define | EDGE_PAN_SPEED_PER_PIXEL (25.0f * (float)U.dpi_fac) |
| #define | EDGE_PAN_DELAY 1.0f |
| static int | view_edge_pan_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) |
| static void | edge_pan_manage_delay_timers (v2dViewPanData *vpd, int pan_dir_x, int pan_dir_y, const double current_time) |
| static float | smootherstep (const float domain_max, float x) |
| static float | edge_pan_speed (v2dViewPanData *vpd, int event_loc, bool x_dir, const double current_time) |
| static int | view_edge_pan_modal (bContext *C, wmOperator *op, const wmEvent *event) |
| static void | view_edge_pan_cancel (bContext *UNUSED(C), wmOperator *op) |
| static void | VIEW2D_OT_edge_pan (wmOperatorType *ot) |
Scroll Bar Move Operator | |
| enum | { SCROLLHANDLE_MIN = -1 , SCROLLHANDLE_BAR , SCROLLHANDLE_MAX , SCROLLHANDLE_MIN_OUTSIDE , SCROLLHANDLE_MAX_OUTSIDE } |
| typedef struct v2dScrollerMove | v2dScrollerMove |
| static short | mouse_in_scroller_handle (int mouse, int sc_min, int sc_max, int sh_min, int sh_max) |
| static bool | scroller_activate_poll (bContext *C) |
| static void | scroller_activate_init (bContext *C, wmOperator *op, const wmEvent *event, const char in_scroller) |
| static void | scroller_activate_exit (bContext *C, wmOperator *op) |
| static void | scroller_activate_cancel (bContext *C, wmOperator *op) |
| static void | scroller_activate_apply (bContext *C, wmOperator *op) |
| static int | scroller_activate_modal (bContext *C, wmOperator *op, const wmEvent *event) |
| static int | scroller_activate_invoke (bContext *C, wmOperator *op, const wmEvent *event) |
| static void | VIEW2D_OT_scroller_activate (wmOperatorType *ot) |
View Pan Shared Utilities | |
| typedef struct v2dViewPanData | v2dViewPanData |
| static bool | view_pan_poll (bContext *C) |
| static void | view_pan_init (bContext *C, wmOperator *op) |
| static void | view_pan_apply_ex (bContext *C, v2dViewPanData *vpd, float dx, float dy) |
| static void | view_pan_apply (bContext *C, wmOperator *op) |
| static void | view_pan_exit (wmOperator *op) |
View Zoom Shared Utilities | |
| typedef struct v2dViewZoomData | v2dViewZoomData |
| static void | view_zoom_axis_lock_defaults (bContext *C, bool r_do_zoom_xy[2]) |
| static bool | view_zoom_poll (bContext *C) |
| static void | view_zoomdrag_init (bContext *C, wmOperator *op) |
| static void | view_zoomstep_apply_ex (bContext *C, v2dViewZoomData *vzd, const float facx, const float facy) |
| static void | view_zoomstep_apply (bContext *C, wmOperator *op) |
| #define EDGE_PAN_DELAY 1.0f |
Delay before drag panning in seconds.
Definition at line 349 of file view2d_ops.c.
| #define EDGE_PAN_REGION_PAD (U.widget_unit) |
Distance from the edge of the region within which to start panning.
Definition at line 345 of file view2d_ops.c.
| #define EDGE_PAN_SPEED_PER_PIXEL (25.0f * (float)U.dpi_fac) |
Speed factor in pixels per second per pixel of distance from edge pan zone beginning.
Definition at line 347 of file view2d_ops.c.
| typedef struct v2dScrollerMove v2dScrollerMove |
Scrollers should behave in the following ways, when clicked on with LMB (and dragged):
In order to make sure this works, each operator must define the following RNA-Operator Props:
deltax, deltay - define how much to move view by (relative to zoom-correction factor) | typedef struct v2dViewPanData v2dViewPanData |
This group of operators come in several forms:
In order to make sure this works, each operator must define the following RNA-Operator Props:
deltax, deltay - define how much to move view by (relative to zoom-correction factor) Temporary custom-data for operator. | typedef struct v2dViewZoomData v2dViewZoomData |
This group of operators come in several forms:
In order to make sure this works, each operator must define the following RNA-Operator Props:
| anonymous enum |
| Enumerator | |
|---|---|
| SCROLLHANDLE_MIN | |
| SCROLLHANDLE_BAR | |
| SCROLLHANDLE_MAX | |
| SCROLLHANDLE_MIN_OUTSIDE | |
| SCROLLHANDLE_MAX_OUTSIDE | |
Definition at line 1900 of file view2d_ops.c.
| void ED_keymap_view2d | ( | wmKeyConfig * | keyconf | ) |
Definition at line 2420 of file view2d_ops.c.
References WM_keymap_ensure().
Referenced by ED_spacetypes_keymap().
| void ED_operatortypes_view2d | ( | void | ) |
Definition at line 2393 of file view2d_ops.c.
References VIEW2D_OT_edge_pan(), VIEW2D_OT_pan(), VIEW2D_OT_reset(), VIEW2D_OT_scroll_down(), VIEW2D_OT_scroll_left(), VIEW2D_OT_scroll_right(), VIEW2D_OT_scroll_up(), VIEW2D_OT_scroller_activate(), VIEW2D_OT_smoothview(), VIEW2D_OT_zoom(), VIEW2D_OT_zoom_border(), VIEW2D_OT_zoom_in(), VIEW2D_OT_zoom_out(), and WM_operatortype_append().
Referenced by ED_spacetypes_init().
|
static |
Reset the edge pan timers if the mouse isn't in the scroll zone and start the timers when the mouse enters a scroll zone.
Definition at line 372 of file view2d_ops.c.
References v2dViewPanData::edge_pan_start_time_x, and v2dViewPanData::edge_pan_start_time_y.
Referenced by view_edge_pan_modal().
|
static |
Definition at line 403 of file view2d_ops.c.
References BLI_assert, distance(), EDGE_PAN_DELAY, EDGE_PAN_REGION_PAD, EDGE_PAN_SPEED_PER_PIXEL, v2dViewPanData::edge_pan_start_time_x, v2dViewPanData::edge_pan_start_time_y, max, min, v2dViewPanData::region, smootherstep(), ARegion::winrct, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by view_edge_pan_modal().
|
static |
Check if mouse is within scroller handle.
| mouse | relevant mouse coordinate in region space. |
| sc_min,sc_max | extents of scroller 'groove' (potential available space for scroller). |
| sh_min,sh_max | positions of scrollbar handles. |
Definition at line 1915 of file view2d_ops.c.
References SCROLLHANDLE_BAR, SCROLLHANDLE_MAX, SCROLLHANDLE_MAX_OUTSIDE, SCROLLHANDLE_MIN, SCROLLHANDLE_MIN_OUTSIDE, and V2D_SCROLL_HANDLE_SIZE_HOTSPOT.
Referenced by scroller_activate_init().
|
static |
Definition at line 2320 of file view2d_ops.c.
References View2D::align, blender::compositor::area(), BLI_rcti_size_x(), BLI_rcti_size_y(), C, CTX_wm_area(), CTX_wm_region(), CTX_wm_screen(), View2D::cur, ED_area_tag_redraw(), ED_region_snap_size_apply(), ED_region_snap_size_test(), ED_region_tag_redraw(), float(), View2D::mask, NA_EDITED, NC_SCREEN, NULL, OPERATOR_FINISHED, uiStyle::panelzoom, UI_style_get(), UI_view2d_curRect_changed(), UI_view2d_sync(), UI_view2d_zoom_cache_reset(), ARegion::v2d, V2D_ALIGN_NO_NEG_X, V2D_ALIGN_NO_NEG_Y, V2D_ALIGN_NO_POS_X, V2D_ALIGN_NO_POS_Y, V2D_LOCK_COPY, WM_event_add_notifier(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by VIEW2D_OT_reset().
|
static |
Definition at line 2076 of file view2d_ops.c.
References C, CTX_wm_area(), CTX_wm_screen(), View2D::cur, wmOperator::customdata, v2dScrollerMove::delta, ED_region_tag_redraw_no_rebuild(), v2dScrollerMove::fac, v2dScrollerMove::fac_round, View2D::keepofs, View2D::keepzoom, v2dScrollerMove::region, v2dScrollerMove::scroller, SCROLLHANDLE_BAR, SCROLLHANDLE_MAX, SCROLLHANDLE_MAX_OUTSIDE, SCROLLHANDLE_MIN, SCROLLHANDLE_MIN_OUTSIDE, UI_view2d_curRect_changed(), UI_view2d_sync(), v2dScrollerMove::v2d, V2D_LOCK_COPY, V2D_LOCKOFS_X, V2D_LOCKOFS_Y, V2D_LOCKZOOM_X, V2D_LOCKZOOM_Y, rctf::xmax, rctf::xmin, rctf::ymax, rctf::ymin, and v2dScrollerMove::zone.
Referenced by scroller_activate_invoke(), and scroller_activate_modal().
|
static |
Definition at line 2070 of file view2d_ops.c.
References C, and scroller_activate_exit().
Referenced by VIEW2D_OT_scroller_activate().
|
static |
Definition at line 2056 of file view2d_ops.c.
References C, CTX_wm_region(), wmOperator::customdata, ED_region_tag_redraw_no_rebuild(), MEM_freeN, NULL, View2D::scroll_ui, v2dScrollerMove::v2d, V2D_SCROLL_H_ACTIVE, and V2D_SCROLL_V_ACTIVE.
Referenced by scroller_activate_cancel(), scroller_activate_invoke(), and scroller_activate_modal().
|
static |
Definition at line 1980 of file view2d_ops.c.
References BLI_rctf_size_x(), BLI_rctf_size_y(), BLI_rctf_union(), BLI_rcti_size_x(), BLI_rcti_size_y(), C, CTX_wm_region(), View2D::cur, wmOperator::customdata, ED_region_tag_redraw_no_rebuild(), ELEM, v2dScrollerMove::fac, v2dScrollerMove::fac_round, float(), View2D::hor, View2DScrollers::hor_max, View2DScrollers::hor_min, View2D::keepzoom, v2dScrollerMove::lastx, v2dScrollerMove::lasty, MEM_callocN, mouse_in_scroller_handle(), wmEvent::mval, NULL, v2dScrollerMove::region, v2dScrollerMove::scrollbar_orig, v2dScrollerMove::scrollbarwidth, v2dScrollerMove::scroller, SCROLLHANDLE_BAR, SCROLLHANDLE_MAX, SCROLLHANDLE_MIN, View2D::tot, UI_view2d_scrollers_calc(), v2dScrollerMove::v2d, ARegion::v2d, V2D_LOCKZOOM_X, V2D_LOCKZOOM_Y, View2D::vert, View2DScrollers::vert_max, View2DScrollers::vert_min, ARegion::winrct, rcti::xmax, rcti::xmin, rcti::ymax, rcti::ymin, and v2dScrollerMove::zone.
Referenced by scroller_activate_invoke().
|
static |
Definition at line 2211 of file view2d_ops.c.
References C, CTX_wm_region(), wmOperator::customdata, v2dScrollerMove::delta, ELEM, float(), if(), View2D::keepofs, MIDDLEMOUSE, OPERATOR_PASS_THROUGH, OPERATOR_RUNNING_MODAL, View2D::scroll, View2D::scroll_ui, v2dScrollerMove::scrollbar_orig, v2dScrollerMove::scroller, scroller_activate_apply(), scroller_activate_exit(), scroller_activate_init(), SCROLLHANDLE_BAR, SCROLLHANDLE_MAX, SCROLLHANDLE_MIN, wmEvent::type, UI_view2d_mouse_in_scrollers(), ARegion::v2d, V2D_LOCKOFS_X, V2D_LOCKOFS_Y, V2D_SCROLL_H_ACTIVE, V2D_SCROLL_HORIZONTAL_FULLR, V2D_SCROLL_HORIZONTAL_HANDLES, V2D_SCROLL_V_ACTIVE, V2D_SCROLL_VERTICAL_FULLR, V2D_SCROLL_VERTICAL_HANDLES, WM_event_add_modal_handler(), wmEvent::x, wmEvent::y, and v2dScrollerMove::zone.
Referenced by VIEW2D_OT_scroller_activate().
|
static |
Handle user input for scrollers - calculations of mouse-movement need to be done here, not in the apply callback!
Definition at line 2138 of file view2d_ops.c.
References C, wmOperator::customdata, v2dScrollerMove::delta, ELEM, float(), KM_RELEASE, v2dScrollerMove::lastx, v2dScrollerMove::lasty, LEFTMOUSE, MIDDLEMOUSE, MOUSEMOVE, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, v2dScrollerMove::scrollbarwidth, v2dScrollerMove::scroller, scroller_activate_apply(), scroller_activate_exit(), SCROLLHANDLE_BAR, SCROLLHANDLE_MAX, SCROLLHANDLE_MAX_OUTSIDE, SCROLLHANDLE_MIN, SCROLLHANDLE_MIN_OUTSIDE, wmEvent::type, wmEvent::val, wmEvent::x, wmEvent::y, and v2dScrollerMove::zone.
Referenced by VIEW2D_OT_scroller_activate().
|
static |
Definition at line 1964 of file view2d_ops.c.
References C, CTX_wm_region(), CTX_wm_window(), wmWindow::eventstate, UI_view2d_mouse_in_scrollers(), ARegion::v2d, view2d_poll(), wmEvent::x, and wmEvent::y.
Referenced by VIEW2D_OT_scroller_activate().
function to get a factor out of a rectangle
note: this doesn't always work as well as it might because the target size may not be reached because of clamping the desired rect, we could attempt to clamp the rect before working out the zoom factor but its not really worthwhile for the few cases this happens.
Definition at line 1673 of file view2d_ops.c.
References BLI_rctf_cent_x(), BLI_rctf_cent_y(), BLI_rctf_size_x(), BLI_rctf_size_y(), fabsf, max_ff(), and min_ff().
Referenced by UI_view2d_smooth_view().
Used to calculate a "fade in" factor for edge panning to make the interaction feel smooth and more purposeful.
Definition at line 397 of file view2d_ops.c.
Referenced by edge_pan_speed().
| void UI_view2d_smooth_view | ( | bContext * | C, |
| ARegion * | region, | ||
| const rctf * | cur, | ||
| const int | smooth_viewtx | ||
| ) |
Definition at line 1702 of file view2d_ops.c.
References BLI_rctf_compare(), C, CTX_wm_area(), CTX_wm_manager(), CTX_wm_screen(), CTX_wm_window(), View2D::cur, double(), ED_region_tag_redraw_no_rebuild(), MEM_mallocN, SmoothView2DStore::new_cur, NULL, SmoothView2DStore::orig_cur, View2D::smooth_timer, smooth_view_rect_to_fac(), View2D::sms, SmoothView2DStore::time_allowed, TIMER1, UI_view2d_curRect_changed(), UI_view2d_sync(), ARegion::v2d, V2D_LOCK_COPY, WM_event_add_timer(), and WM_event_remove_timer().
Referenced by view_borderzoom_exec().
|
static |
Definition at line 502 of file view2d_ops.c.
References wmOperatorType::cancel, wmOperatorType::description, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_INTERNAL, ot, wmOperatorType::poll, RNA_def_int(), wmOperatorType::srna, view_edge_pan_cancel(), view_edge_pan_invoke(), view_edge_pan_modal(), and view_pan_poll().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 313 of file view2d_ops.c.
References wmOperatorType::cancel, wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_BLOCKING, OPTYPE_GRAB_CURSOR_XY, ot, wmOperatorType::poll, RNA_def_int(), wmOperatorType::srna, view_pan_cancel(), view_pan_exec(), view_pan_invoke(), view_pan_modal(), and view_pan_poll().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 2375 of file view2d_ops.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, wmOperatorType::poll, reset_exec(), and view2d_poll().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 655 of file view2d_ops.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, wmOperatorType::poll, RNA_def_boolean(), RNA_def_int(), wmOperatorType::srna, view_pan_poll(), and view_scrolldown_exec().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 607 of file view2d_ops.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, wmOperatorType::poll, RNA_def_int(), wmOperatorType::srna, view_pan_poll(), and view_scrollleft_exec().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 565 of file view2d_ops.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, wmOperatorType::poll, RNA_def_int(), wmOperatorType::srna, view_pan_poll(), and view_scrollright_exec().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 704 of file view2d_ops.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, wmOperatorType::poll, RNA_def_boolean(), RNA_def_int(), wmOperatorType::srna, view_pan_poll(), and view_scrollup_exec().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 2296 of file view2d_ops.c.
References wmOperatorType::cancel, wmOperatorType::description, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_BLOCKING, ot, wmOperatorType::poll, scroller_activate_cancel(), scroller_activate_invoke(), scroller_activate_modal(), and scroller_activate_poll().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 1818 of file view2d_ops.c.
References wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, OPTYPE_INTERNAL, ot, wmOperatorType::poll, view2d_poll(), view2d_smoothview_invoke(), and WM_operator_properties_gesture_box().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 1450 of file view2d_ops.c.
References wmOperatorType::cancel, wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_BLOCKING, OPTYPE_GRAB_CURSOR_XY, ot, wmOperatorType::poll, PROP_HIDDEN, RNA_def_float(), RNA_def_property_flag(), wmOperatorType::srna, view_zoom_poll(), view_zoomdrag_cancel(), view_zoomdrag_exec(), view_zoomdrag_invoke(), view_zoomdrag_modal(), and WM_operator_properties_use_cursor_init().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 1558 of file view2d_ops.c.
References wmOperatorType::cancel, wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, ot, wmOperatorType::poll, view_borderzoom_exec(), view_zoom_poll(), WM_gesture_box_cancel(), WM_gesture_box_invoke(), WM_gesture_box_modal(), and WM_operator_properties_gesture_box_zoom().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 994 of file view2d_ops.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, ot, wmOperatorType::poll, PROP_HIDDEN, RNA_def_float(), RNA_def_property_flag(), wmOperatorType::srna, view_zoom_poll(), view_zoomin_exec(), and view_zoomin_invoke().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 1058 of file view2d_ops.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, ot, wmOperatorType::poll, PROP_HIDDEN, RNA_def_float(), RNA_def_property_flag(), wmOperatorType::srna, view_zoom_poll(), view_zoomout_exec(), and view_zoomout_invoke().
Referenced by ED_operatortypes_view2d().
|
static |
Definition at line 55 of file view2d_ops.c.
References C, CTX_wm_region(), View2D::flag, NULL, ARegion::v2d, and V2D_IS_INIT.
Referenced by scroller_activate_poll(), VIEW2D_OT_reset(), and VIEW2D_OT_smoothview().
|
static |
Definition at line 1767 of file view2d_ops.c.
References BLI_rctf_interp(), C, CTX_wm_area(), CTX_wm_manager(), CTX_wm_region(), CTX_wm_screen(), CTX_wm_window(), View2D::cur, wmEvent::customdata, wmTimer::duration, ED_region_tag_redraw_no_rebuild(), float(), MEM_freeN, SmoothView2DStore::new_cur, NULL, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, SmoothView2DStore::orig_cur, View2D::smooth_timer, View2D::sms, SmoothView2DStore::time_allowed, UI_view2d_curRect_changed(), UI_view2d_sync(), UI_view2d_zoom_cache_reset(), ARegion::v2d, V2D_LOCK_COPY, WM_event_add_mousemove(), and WM_event_remove_timer().
Referenced by VIEW2D_OT_smoothview().
|
static |
The user defines a rect using standard box select tools, and we use this rect to define the new zoom-level of the view in the following ways:
Currently, these key mappings are hardcoded, but it shouldn't be too important to have custom keymappings for this...
Definition at line 1495 of file view2d_ops.c.
References BLI_rctf_cent_x(), BLI_rctf_cent_y(), BLI_rctf_size_x(), BLI_rctf_size_y(), C, center, CTX_wm_region(), View2D::cur, View2D::keepzoom, OPERATOR_FINISHED, wmOperator::ptr, RNA_boolean_get(), size(), UI_view2d_region_to_view_rctf(), UI_view2d_smooth_view(), ARegion::v2d, V2D_LOCKZOOM_X, V2D_LOCKZOOM_Y, WM_operator_properties_border_to_rctf(), WM_operator_smooth_viewtx_get(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by VIEW2D_OT_zoom_border().
|
static |
Definition at line 497 of file view2d_ops.c.
References view_pan_exit().
Referenced by VIEW2D_OT_edge_pan().
|
static |
Definition at line 352 of file view2d_ops.c.
References C, wmOperator::customdata, v2dViewPanData::edge_pan_last_time, v2dViewPanData::edge_pan_start_time_x, v2dViewPanData::edge_pan_start_time_y, OPERATOR_PASS_THROUGH, OPERATOR_RUNNING_MODAL, PIL_check_seconds_timer(), view_pan_init(), and WM_event_add_modal_handler().
Referenced by VIEW2D_OT_edge_pan().
|
static |
Definition at line 432 of file view2d_ops.c.
References BLI_rcti_isect_pt(), BLI_rcti_pad(), C, wmOperator::customdata, v2dViewPanData::edge_pan_last_time, edge_pan_manage_delay_timers(), EDGE_PAN_REGION_PAD, edge_pan_speed(), EVT_ESCKEY, float(), KM_RELEASE, MOUSEMOVE, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, PIL_check_seconds_timer(), wmOperator::ptr, v2dViewPanData::region, RNA_int_get(), wmEvent::type, UI_UNIT_X, wmEvent::val, view_pan_apply_ex(), view_pan_exit(), ARegion::winrct, wmEvent::x, rcti::xmax, rcti::xmin, wmEvent::y, rcti::ymax, and rcti::ymin.
Referenced by VIEW2D_OT_edge_pan().
|
static |
Definition at line 183 of file view2d_ops.c.
References C, wmOperator::customdata, wmOperator::ptr, RNA_int_get(), and view_pan_apply_ex().
Referenced by view_pan_exec(), view_pan_invoke(), view_pan_modal(), view_scrolldown_exec(), view_scrollleft_exec(), view_scrollright_exec(), and view_scrollup_exec().
|
static |
Definition at line 153 of file view2d_ops.c.
References v2dViewPanData::area, C, CTX_wm_window(), View2D::cur, ED_region_tag_redraw_no_rebuild(), v2dViewPanData::facx, v2dViewPanData::facy, View2D::keepofs, v2dViewPanData::region, v2dViewPanData::screen, UI_view2d_curRect_changed(), UI_view2d_sync(), v2dViewPanData::v2d, V2D_LOCK_COPY, V2D_LOCKOFS_X, V2D_LOCKOFS_Y, WM_event_add_mousemove(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by view_edge_pan_modal(), and view_pan_apply().
|
static |
Definition at line 308 of file view2d_ops.c.
References view_pan_exit().
Referenced by VIEW2D_OT_pan().
|
static |
Definition at line 203 of file view2d_ops.c.
References C, OPERATOR_FINISHED, view_pan_apply(), view_pan_exit(), and view_pan_init().
Referenced by VIEW2D_OT_pan().
|
static |
Definition at line 191 of file view2d_ops.c.
References wmOperator::customdata, and MEM_SAFE_FREE.
Referenced by view_edge_pan_cancel(), view_edge_pan_modal(), view_pan_cancel(), view_pan_exec(), view_pan_invoke(), view_pan_modal(), view_scrolldown_exec(), view_scrollleft_exec(), view_scrollright_exec(), and view_scrollup_exec().
|
static |
Definition at line 130 of file view2d_ops.c.
References v2dViewPanData::area, BLI_assert, BLI_rctf_size_x(), BLI_rctf_size_y(), BLI_rcti_size_x(), BLI_rcti_size_y(), C, CTX_wm_area(), CTX_wm_region(), CTX_wm_screen(), View2D::cur, wmOperator::customdata, v2dViewPanData::facx, v2dViewPanData::facy, float(), MEM_callocN, v2dViewPanData::region, v2dViewPanData::screen, v2dViewPanData::v2d, ARegion::v2d, view_pan_poll(), and ARegion::winrct.
Referenced by view_edge_pan_invoke(), view_pan_exec(), view_pan_invoke(), view_scrolldown_exec(), view_scrollleft_exec(), view_scrollright_exec(), and view_scrollup_exec().
|
static |
Definition at line 212 of file view2d_ops.c.
References C, CTX_wm_window(), wmOperator::customdata, v2dViewPanData::invoke_event, View2D::keepofs, v2dViewPanData::lastx, v2dViewPanData::lasty, MOUSEPAN, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, wmEvent::prevx, wmEvent::prevy, wmOperator::ptr, RNA_int_set(), v2dViewPanData::startx, v2dViewPanData::starty, wmEvent::type, v2dViewPanData::v2d, V2D_LOCKOFS_X, V2D_LOCKOFS_Y, view_pan_apply(), view_pan_exit(), view_pan_init(), WM_CURSOR_EW_SCROLL, WM_cursor_modal_set(), WM_CURSOR_NS_SCROLL, WM_CURSOR_NSEW_SCROLL, WM_event_add_modal_handler(), wmEvent::x, and wmEvent::y.
Referenced by VIEW2D_OT_pan().
|
static |
Definition at line 257 of file view2d_ops.c.
References C, CTX_wm_window(), wmOperator::customdata, ELEM, EVT_ESCKEY, v2dViewPanData::invoke_event, KM_PRESS, KM_RELEASE, v2dViewPanData::lastx, v2dViewPanData::lasty, LEFTMOUSE, MOUSEMOVE, NULL, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, wmOperator::ptr, RNA_int_set(), v2dViewPanData::startx, v2dViewPanData::starty, wmEvent::type, wmEvent::val, view_pan_apply(), view_pan_exit(), WM_cursor_modal_restore(), WM_OP_INVOKE_DEFAULT, WM_operator_name_call(), wmEvent::x, and wmEvent::y.
Referenced by VIEW2D_OT_pan().
|
static |
Definition at line 109 of file view2d_ops.c.
References C, CTX_wm_region(), View2D::keepofs, NULL, ARegion::v2d, V2D_LOCKOFS_X, and V2D_LOCKOFS_Y.
Referenced by VIEW2D_OT_edge_pan(), VIEW2D_OT_pan(), VIEW2D_OT_scroll_down(), VIEW2D_OT_scroll_left(), VIEW2D_OT_scroll_right(), VIEW2D_OT_scroll_up(), and view_pan_init().
|
static |
Definition at line 624 of file view2d_ops.c.
References C, CTX_wm_region(), wmOperator::customdata, View2D::keepofs, View2D::mask, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, wmOperator::ptr, RNA_int_set(), RNA_property_boolean_get(), RNA_property_is_set(), RNA_struct_find_property(), v2dViewPanData::v2d, ARegion::v2d, V2D_LOCKOFS_Y, view_pan_apply(), view_pan_exit(), view_pan_init(), rcti::ymax, and rcti::ymin.
Referenced by VIEW2D_OT_scroll_down().
|
static |
Definition at line 582 of file view2d_ops.c.
References C, wmOperator::customdata, View2D::keepofs, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, wmOperator::ptr, RNA_int_set(), v2dViewPanData::v2d, V2D_LOCKOFS_X, view_pan_apply(), view_pan_exit(), and view_pan_init().
Referenced by VIEW2D_OT_scroll_left().
|
static |
Definition at line 540 of file view2d_ops.c.
References C, wmOperator::customdata, View2D::keepofs, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, wmOperator::ptr, RNA_int_set(), v2dViewPanData::v2d, V2D_LOCKOFS_X, view_pan_apply(), view_pan_exit(), and view_pan_init().
Referenced by VIEW2D_OT_scroll_right().
|
static |
Definition at line 673 of file view2d_ops.c.
References BLI_rcti_size_y(), C, CTX_wm_region(), wmOperator::customdata, View2D::keepofs, View2D::mask, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, wmOperator::ptr, RNA_int_set(), RNA_property_boolean_get(), RNA_property_is_set(), RNA_struct_find_property(), v2dViewPanData::v2d, ARegion::v2d, V2D_LOCKOFS_Y, view_pan_apply(), view_pan_exit(), and view_pan_init().
Referenced by VIEW2D_OT_scroll_up().
|
static |
Clamp by convention rather then locking flags, for ndof and +/- keys
Definition at line 763 of file view2d_ops.c.
References blender::compositor::area(), C, CTX_wm_area(), CTX_wm_region(), ARegion::regiontype, RGN_TYPE_WINDOW, and SPACE_SEQ.
Referenced by view_zoomin_exec(), and view_zoomout_exec().
|
static |
Definition at line 781 of file view2d_ops.c.
References C, CTX_wm_region(), CTX_wm_region_view3d(), View2D::keepzoom, NULL, ARegion::v2d, V2D_LOCKZOOM_X, and V2D_LOCKZOOM_Y.
Referenced by VIEW2D_OT_zoom(), VIEW2D_OT_zoom_border(), VIEW2D_OT_zoom_in(), VIEW2D_OT_zoom_out(), and view_zoomdrag_init().
|
static |
MMB Drag - allows non-uniform scaling by dragging mouse
In order to make sure this works, each operator must define the following RNA-Operator Props:
deltax, deltay - amounts to add to each side of the 'cur' rect Definition at line 1096 of file view2d_ops.c.
References blender::compositor::area(), BLI_rctf_size_x(), BLI_rctf_size_y(), C, CTX_wm_area(), CTX_wm_screen(), View2D::cur, wmOperator::customdata, ED_area_tag_redraw(), ED_region_snap_size_apply(), ED_region_snap_size_test(), ED_region_tag_redraw_no_rebuild(), float(), View2D::keepofs, View2D::keepzoom, v2dViewZoomData::mx_2d, v2dViewZoomData::my_2d, NA_EDITED, NC_SCREEN, NULL, PIL_check_seconds_timer(), wmOperator::ptr, v2dViewZoomData::region, RNA_boolean_get(), RNA_float_get(), time, v2dViewZoomData::timer, v2dViewZoomData::timer_lastdraw, UI_view2d_curRect_changed(), UI_view2d_sync(), USER_ZOOM_CONTINUE, v2dViewZoomData::v2d, V2D_LOCK_COPY, V2D_LOCKOFS_X, V2D_LOCKOFS_Y, V2D_LOCKZOOM_X, V2D_LOCKZOOM_Y, WM_event_add_notifier(), rctf::xmax, rctf::xmin, rctf::ymax, rctf::ymin, and v2dViewZoomData::zoom_to_mouse_pos.
Referenced by view_zoomdrag_exec(), view_zoomdrag_invoke(), and view_zoomdrag_modal().
|
static |
Definition at line 1192 of file view2d_ops.c.
References C, and view_zoomdrag_exit().
Referenced by VIEW2D_OT_zoom().
|
static |
Definition at line 1198 of file view2d_ops.c.
References C, OPERATOR_FINISHED, view_zoomdrag_apply(), view_zoomdrag_exit(), and view_zoomdrag_init().
Referenced by VIEW2D_OT_zoom().
|
static |
Definition at line 1176 of file view2d_ops.c.
References C, CTX_wm_manager(), CTX_wm_window(), wmOperator::customdata, MEM_freeN, NULL, v2dViewZoomData::timer, UI_view2d_zoom_cache_reset(), and WM_event_remove_timer().
Referenced by view_zoomdrag_cancel(), view_zoomdrag_exec(), view_zoomdrag_invoke(), and view_zoomdrag_modal().
|
static |
Definition at line 807 of file view2d_ops.c.
References BLI_assert, C, CTX_wm_region(), wmOperator::customdata, MEM_callocN, v2dViewZoomData::region, v2dViewZoomData::v2d, ARegion::v2d, view_zoom_poll(), and v2dViewZoomData::zoom_to_mouse_pos.
Referenced by view_zoomdrag_exec(), view_zoomdrag_invoke(), view_zoomin_exec(), view_zoomin_invoke(), view_zoomout_exec(), and view_zoomout_invoke().
|
static |
Definition at line 1207 of file view2d_ops.c.
References BLI_rctf_size_x(), BLI_rctf_size_y(), C, clamp_f(), CTX_wm_manager(), CTX_wm_region(), CTX_wm_window(), View2D::cur, wmOperator::customdata, ELEM, fabsf, v2dViewZoomData::invoke_event, View2D::keepofs, View2D::keepzoom, v2dViewZoomData::lastx, v2dViewZoomData::lasty, View2D::maxzoom, MOUSEPAN, MOUSEZOOM, wmEvent::mval, v2dViewZoomData::mx_2d, v2dViewZoomData::my_2d, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, PIL_check_seconds_timer(), wmOperator::ptr, RNA_float_set(), v2dViewZoomData::timer, TIMER, v2dViewZoomData::timer_lastdraw, wmEvent::type, UI_view2d_region_to_view(), USER_ZOOM_CONTINUE, USER_ZOOM_HORIZ, USER_ZOOM_INVERT, USER_ZOOM_TO_MOUSEPOS, v2dViewZoomData::v2d, ARegion::v2d, V2D_KEEPASPECT, V2D_LOCKOFS_X, V2D_LOCKOFS_Y, V2D_LOCKZOOM_X, V2D_LOCKZOOM_Y, view_zoomdrag_apply(), view_zoomdrag_exit(), view_zoomdrag_init(), WM_CURSOR_EW_SCROLL, WM_cursor_modal_set(), WM_CURSOR_NS_SCROLL, WM_CURSOR_NSEW_SCROLL, WM_event_absolute_delta_x(), WM_event_absolute_delta_y(), WM_event_add_modal_handler(), WM_event_add_timer(), and v2dViewZoomData::zoom_to_mouse_pos.
Referenced by VIEW2D_OT_zoom().
|
static |
Definition at line 1318 of file view2d_ops.c.
References BLI_rctf_size_x(), BLI_rctf_size_y(), BLI_rcti_size_x(), BLI_rcti_size_y(), C, clamp_f(), CTX_wm_window(), View2D::cur, wmOperator::customdata, wmEvent::customdata, v2dViewZoomData::dx, v2dViewZoomData::dy, ELEM, EVT_ESCKEY, fabsf, v2dViewZoomData::invoke_event, View2D::keepzoom, KM_RELEASE, v2dViewZoomData::lastx, v2dViewZoomData::lasty, len_v2(), View2D::mask, View2D::maxzoom, MOUSEMOVE, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, wmOperator::ptr, v2dViewZoomData::region, RNA_float_set(), v2dViewZoomData::timer, TIMER, wmEvent::type, USER_ZOOM_CONTINUE, USER_ZOOM_HORIZ, USER_ZOOM_INVERT, USER_ZOOM_SCALE, v2dViewZoomData::v2d, V2D_KEEPASPECT, V2D_LOCKZOOM_X, V2D_LOCKZOOM_Y, wmEvent::val, view_zoomdrag_apply(), view_zoomdrag_exit(), ARegion::winrct, WM_cursor_modal_restore(), wmEvent::x, rcti::xmin, wmEvent::y, and rcti::ymin.
Referenced by VIEW2D_OT_zoom().
|
static |
Definition at line 955 of file view2d_ops.c.
References C, wmOperator::customdata, NULL, OPERATOR_FINISHED, wmOperator::ptr, RNA_float_set(), view_zoom_axis_lock_defaults(), view_zoomdrag_init(), view_zoomstep_apply(), and view_zoomstep_exit().
Referenced by VIEW2D_OT_zoom_in(), and view_zoomin_invoke().
|
static |
Definition at line 976 of file view2d_ops.c.
References C, CTX_wm_region(), wmOperator::customdata, wmEvent::mval, v2dViewZoomData::mx_2d, v2dViewZoomData::my_2d, UI_view2d_region_to_view(), USER_ZOOM_TO_MOUSEPOS, ARegion::v2d, view_zoomdrag_init(), view_zoomin_exec(), and v2dViewZoomData::zoom_to_mouse_pos.
Referenced by VIEW2D_OT_zoom_in().
|
static |
Definition at line 1018 of file view2d_ops.c.
References C, wmOperator::customdata, NULL, OPERATOR_FINISHED, wmOperator::ptr, RNA_float_set(), view_zoom_axis_lock_defaults(), view_zoomdrag_init(), view_zoomstep_apply(), and view_zoomstep_exit().
Referenced by VIEW2D_OT_zoom_out(), and view_zoomout_invoke().
|
static |
Definition at line 1040 of file view2d_ops.c.
References C, CTX_wm_region(), wmOperator::customdata, wmEvent::mval, v2dViewZoomData::mx_2d, v2dViewZoomData::my_2d, UI_view2d_region_to_view(), USER_ZOOM_TO_MOUSEPOS, ARegion::v2d, view_zoomdrag_init(), view_zoomout_exec(), and v2dViewZoomData::zoom_to_mouse_pos.
Referenced by VIEW2D_OT_zoom_out().
|
static |
Definition at line 933 of file view2d_ops.c.
References C, wmOperator::customdata, wmOperator::ptr, RNA_float_get(), and view_zoomstep_apply_ex().
Referenced by view_zoomin_exec(), and view_zoomout_exec().
|
static |
Definition at line 824 of file view2d_ops.c.
References View2D::align, blender::compositor::area(), BLI_rctf_size_x(), BLI_rctf_size_y(), BLI_rcti_size_x(), BLI_rcti_size_y(), C, CTX_wm_area(), CTX_wm_region(), CTX_wm_screen(), View2D::cur, ED_area_tag_redraw(), ED_region_snap_size_apply(), ED_region_snap_size_test(), ED_region_tag_redraw_no_rebuild(), float(), IN_RANGE_INCL, View2D::keepofs, View2D::keepzoom, View2D::mask, View2D::maxzoom, View2D::minzoom, v2dViewZoomData::mx_2d, v2dViewZoomData::my_2d, NA_EDITED, NC_SCREEN, NULL, v2dViewZoomData::region, UI_view2d_curRect_changed(), UI_view2d_sync(), ARegion::v2d, V2D_ALIGN_NO_POS_X, V2D_ALIGN_NO_POS_Y, V2D_KEEPOFS_X, V2D_KEEPOFS_Y, V2D_LIMITZOOM, V2D_LOCK_COPY, V2D_LOCKOFS_X, V2D_LOCKOFS_Y, V2D_LOCKZOOM_X, V2D_LOCKZOOM_Y, WM_event_add_notifier(), rctf::xmax, rctf::xmin, rctf::ymax, rctf::ymin, and v2dViewZoomData::zoom_to_mouse_pos.
Referenced by view_zoomstep_apply().
|
static |
Definition at line 947 of file view2d_ops.c.
References wmOperator::customdata, MEM_SAFE_FREE, and UI_view2d_zoom_cache_reset().
Referenced by view_zoomin_exec(), and view_zoomout_exec().