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:
authorTon Roosendaal <ton@blender.org>2004-06-19 16:25:28 +0400
committerTon Roosendaal <ton@blender.org>2004-06-19 16:25:28 +0400
commit6fdea0ffe70dd0c0b4e82140316037e57b0b527a (patch)
tree330efe1124b9959ab71aa8d776c8d450a0facb53
parent8617ce51417a671f55d3904f16b42604da7889c7 (diff)
Popular request: the floating panels (NKEY) now close on a 2nd NKEY command.
This for all current NKEY menus by default. Can be standard for each hotkey controlled Panel from now on; use toggle_blockhandler() for it. Another popular request: hotkey enabled Panels now optionally reopen on the previous location, instead of under mouse. This option "Pinned" is a user option now. Optional for later; have it as per-panel option... dunno! The last request, close on mouse-exit, won't be implemented, this intrudes with Panel consistancy, and is pretty OK solved with NKEY-NKEY now.
-rw-r--r--source/blender/include/BIF_space.h1
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h1
-rw-r--r--source/blender/src/editnla.c2
-rw-r--r--source/blender/src/header_seq.c2
-rw-r--r--source/blender/src/interface_panel.c4
-rw-r--r--source/blender/src/space.c39
6 files changed, 38 insertions, 11 deletions
diff --git a/source/blender/include/BIF_space.h b/source/blender/include/BIF_space.h
index c53b15d8774..75719761961 100644
--- a/source/blender/include/BIF_space.h
+++ b/source/blender/include/BIF_space.h
@@ -80,6 +80,7 @@ void scrarea_do_headchange (struct ScrArea *sa);
/* space.c */
extern void add_blockhandler(struct ScrArea *sa, short eventcode, short action);
extern void rem_blockhandler(struct ScrArea *sa, short eventcode);
+extern void toggle_blockhandler(struct ScrArea *sa, short eventcode, short action);
extern void space_set_commmandline_options(void);
extern void allqueue(unsigned short event, short val);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 9696777ed4b..97a944db70d 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -187,6 +187,7 @@ extern UserDef U; /* from usiblender.c !!!! */
#define USER_FLIPFULLSCREEN 128
#define USER_ALLWINCODECS 256
#define USER_MENUOPENAUTO 512
+#define USER_PANELPINNED 1024
/* transopts */
diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c
index 66dc645f4e7..3433d638006 100644
--- a/source/blender/src/editnla.c
+++ b/source/blender/src/editnla.c
@@ -170,7 +170,7 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case NKEY:
if(G.qual==0) {
- add_blockhandler(curarea, NLA_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
+ toggle_blockhandler(curarea, NLA_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
scrarea_queue_winredraw(curarea);
}
break;
diff --git a/source/blender/src/header_seq.c b/source/blender/src/header_seq.c
index 22d54cb4d20..861c2995413 100644
--- a/source/blender/src/header_seq.c
+++ b/source/blender/src/header_seq.c
@@ -306,7 +306,7 @@ static void do_seq_editmenu(void *arg, int event)
un_meta();
break;
case 4: /* Properties... */
- add_blockhandler(curarea, SEQ_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
+ add_blockhandler(curarea, SEQ_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
break;
case 5: /* Duplicate */
add_duplicate_seq();
diff --git a/source/blender/src/interface_panel.c b/source/blender/src/interface_panel.c
index f0834fba869..6ee216c8788 100644
--- a/source/blender/src/interface_panel.c
+++ b/source/blender/src/interface_panel.c
@@ -420,7 +420,9 @@ int uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int
pa->active= 1;
pa->control= pnl_control;
- if(pnl_control & UI_PNL_TO_MOUSE) {
+ /* global control over this feature; UI_PNL_TO_MOUSE only called for hotkey panels */
+ if(U.uiflag & USER_PANELPINNED);
+ else if(pnl_control & UI_PNL_TO_MOUSE) {
short mval[2];
Mat4CpyMat4(UIwinmat, block->winmat); // can be first event here
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 5facc3159c6..ac597264f4a 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -194,6 +194,20 @@ void rem_blockhandler(ScrArea *sa, short eventcode)
}
}
+void toggle_blockhandler(ScrArea *sa, short eventcode, short val)
+{
+ SpaceLink *sl= sa->spacedata.first;
+ short a, addnew=1;
+
+ // find if it exists
+ for(a=0; a<SPACE_MAXHANDLER; a+=2) {
+ if( sl->blockhandler[a]==eventcode ) {
+ sl->blockhandler[a]= 0;
+ addnew= 0;
+ }
+ }
+ if(addnew) add_blockhandler(sa, eventcode, val);
+}
@@ -1179,7 +1193,7 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case NKEY:
if((G.qual==0)) {
- add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
+ toggle_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
allqueue(REDRAWVIEW3D, 0);
}
else if(G.obedit) {
@@ -1695,7 +1709,7 @@ void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
break;
case NKEY:
- add_blockhandler(sa, IPO_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
+ toggle_blockhandler(sa, IPO_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
doredraw= 1;
break;
case RKEY:
@@ -2033,25 +2047,34 @@ void drawinfospace(ScrArea *sa, void *spacedata)
uiDefBut(block, LABEL,0,"Snap to grid:",
- (xpos+edgespace+medprefbut),y3label,medprefbut,buth,
+ (xpos+edgespace+medprefbut),y4label,medprefbut,buth,
0, 0, 0, 0, 0, "");
uiDefButBitS(block, TOG, USER_AUTOGRABGRID, 0, "Grab",
- (xpos+edgespace+medprefbut+midspace),y2,smallprefbut,buth,
+ (xpos+edgespace+medprefbut+midspace),y3,smallprefbut,buth,
&(U.flag), 0, 0, 0, 0,
"Move objects to grid units");
uiDefButBitS(block, TOG, USER_AUTOSIZEGRID, 0, "Size",
- (xpos+edgespace+medprefbut+midspace),y1,smallprefbut,buth,
+ (xpos+edgespace+medprefbut+midspace),y2,smallprefbut,buth,
&(U.flag), 0, 0, 0, 0,
"Scale objects to grid units");
uiDefButBitS(block, TOG, USER_AUTOROTGRID, 0, "Rotate",
- (xpos+edgespace+medprefbut+(2*midspace)+smallprefbut),y2,smallprefbut,buth,
+ (xpos+edgespace+medprefbut+midspace),y1,smallprefbut,buth,
&(U.flag), 0, 0, 0, 0,
"Rotate objects to grid units");
+ uiDefBut(block, LABEL, 0, "Panel",
+ (xpos+edgespace+medprefbut+(2*midspace)+smallprefbut),y4label,smallprefbut,buth,
+ NULL, 0, 0, 0, 0,
+ "");
+ uiDefButBitS(block, TOG, USER_PANELPINNED, 0, "Pinned",
+ (xpos+edgespace+medprefbut+(2*midspace)+smallprefbut),y3,smallprefbut,buth,
+ &(U.uiflag), 0, 0, 0, 0,
+ "Hotkey enabled floating panels (e.g. NKEY) open at old location");
+
uiDefBut(block, LABEL,0,"Menu Buttons:",
(xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y4label,medprefbut,buth,
@@ -3017,7 +3040,7 @@ void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case NKEY:
if(G.qual==0) {
- add_blockhandler(curarea, SEQ_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
+ toggle_blockhandler(curarea, SEQ_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
scrarea_queue_winredraw(curarea);
}
break;
@@ -3470,7 +3493,7 @@ void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case NKEY:
if(G.qual==0) {
- add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
+ toggle_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
scrarea_queue_winredraw(curarea);
}
break;