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:
authorJuho Vepsalainen <bebraw@gmail.com>2008-02-23 13:33:36 +0300
committerJuho Vepsalainen <bebraw@gmail.com>2008-02-23 13:33:36 +0300
commit206021113da61f352d96805af7e82e9d41dd70b9 (patch)
treef40167e81d4cf9d4b29a3b3fa539d73e372f222c /source/blender/src/toolbox.c
parent14fafab60a5c5ecfdbbf8e532b4980207a191a45 (diff)
Nodes to be created at the location in which the mouse cursor was initially
This commit changes the way new nodes are created. Previously nodes were created at the last location of the mouse cursor before creating a new node. After this commit the nodes are created at the initial location in which the cursor was before the menu used to add the node was opened. This makes it possible for the user to predict where the new node appears without having to move it to desired location like before. There is no option for this as this behaviour is clearly superior to previous. Codewise it uses static variables. This is something to fix during 2.50 rewrite. Thanks to paprmh for contribution!
Diffstat (limited to 'source/blender/src/toolbox.c')
-rw-r--r--source/blender/src/toolbox.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index c2773611bb2..e02066f3a3b 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -1977,6 +1977,9 @@ void toolbox_n(void)
}
}
+ /* save present mouse position */
+ toolbox_mousepos(mval, 1);
+
mywinset(G.curscreen->mainwin); // we go to screenspace
block= uiNewBlock(&tb_listb, "toolbox", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
@@ -2307,3 +2310,25 @@ void toolbox_generic( TBitem *generic_menu )
mywinset(curarea->win);
}
+
+/* save or restore mouse position when entering/exiting menus */
+void toolbox_mousepos( short *mpos, int save )
+{
+ static short initpos[2];
+ static int tog;
+
+ if (save) {
+ getmouseco_areawin(mpos);
+ initpos[0]= mpos[0];
+ initpos[1]= mpos[1];
+ tog=1;
+ } else {
+ if (tog) {
+ mpos[0]= initpos[0];
+ mpos[1]= initpos[1];
+ } else {
+ getmouseco_areawin(mpos);
+ }
+ tog= 0;
+ }
+}