Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2008-12-23 14:02:39 +0300
committerJoshua Leung <aligorith@gmail.com>2008-12-23 14:02:39 +0300
commit87c05f7836e5b646e0053bd23f138bc36ab18773 (patch)
tree97bd56f7e3f9a28cf544dc904ba0790697764a5b /source/blender/editors/interface/view2d.c
parent58da63cd3efb8c4a1789f0a49afa144c40c551b0 (diff)
2.5 Action Editor - Big WIP Commit
* Brought back backend for editing keyframes IPO/IPO-Curves. Did some refactoring work here that will still have to be verified when operators using them are added. * Animation channel filtering code now returns the number of channels filtered (for Action Editor to set totrect of channels - TODO still!) * View2D - made function to check if mouse is in View2D scrollers an API function * Renamed keyframe related files. The old names were too clumsy. * Started porting click-select operators for Action Editor. These don't work currently, as the events are being stolen by the markers. This needs to be fixed ASAP.
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r--source/blender/editors/interface/view2d.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index f827d68f697..2398f8e2e35 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1689,3 +1689,32 @@ void UI_view2d_getscale(View2D *v2d, float *x, float *y)
if (y) *y = (v2d->mask.ymax - v2d->mask.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
}
+/* Check if mouse is within scrollers
+ * - Returns appropriate code for match
+ * 'h' = in horizontal scroller
+ * 'v' = in vertical scroller
+ * 0 = not in scroller
+ *
+ * - x,y = mouse coordinates in screen (not region) space
+ */
+short UI_view2d_mouse_in_scrollers (const bContext *C, View2D *v2d, int x, int y)
+{
+ ARegion *ar= CTX_wm_region(C);
+ int co[2];
+
+ /* clamp x,y to region-coordinates first */
+ co[0]= x - ar->winrct.xmin;
+ co[1]= y - ar->winrct.ymin;
+
+ /* check if within scrollbars */
+ if (v2d->scroll & V2D_SCROLL_HORIZONTAL) {
+ if (IN_2D_HORIZ_SCROLL(v2d, co)) return 'h';
+ }
+ if (v2d->scroll & V2D_SCROLL_VERTICAL) {
+ if (IN_2D_VERT_SCROLL(v2d, co)) return 'v';
+ }
+
+ /* not found */
+ return 0;
+}
+