Added RMB-menu to Headers:
authorJoshua Leung <aligorith@gmail.com>
Fri, 27 Nov 2009 06:24:09 +0000 (06:24 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 27 Nov 2009 06:24:09 +0000 (06:24 +0000)
This contains two entries - one which calls the region flip operator, and one which calls the maxmize area operator.

Unfortunately, there seem to be some context issues which are causing the wrong region to get activated for use by the region flipping, meaning that nothing happens.

Also, fixed own typo in 3d-view header/menu code...

23 files changed:
release/scripts/ui/space_view3d.py
source/blender/editors/include/ED_screen.h
source/blender/editors/include/ED_screen_types.h
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_info/space_info.c
source/blender/editors/space_logic/space_logic.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_node/space_node.c
source/blender/editors/space_outliner/space_outliner.c
source/blender/editors/space_script/space_script.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_sound/space_sound.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_time/space_time.c
source/blender/editors/space_userpref/space_userpref.c
source/blender/editors/space_view3d/space_view3d.c

index d0b80ddcbfd26c06438d4adb612330be92d1a7fd..fa7cbe152dec6e8a4387c629f56c09b7e0cd26d8 100644 (file)
@@ -191,7 +191,7 @@ class VIEW3D_MT_view(bpy.types.Menu):
         layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
         layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
         layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
-        layout.operator("view3d.viewnumpad", text+"Right").type = 'RIGHT'
+        layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
 
         layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
 
index 18c86306e445064ee5f800e96ce95d5691fc5fde..fb708e4d1c7c91a6fede20be064e8fbc36dc58f9 100644 (file)
@@ -152,6 +152,7 @@ int         ED_operator_posemode(struct bContext *C);
 #define ED_KEYMAP_ANIMATION    8
 #define ED_KEYMAP_FRAMES       16
 #define ED_KEYMAP_GPENCIL      32
+#define ED_KEYMAP_HEADER       64
 
 #endif /* ED_SCREEN_H */
 
index d933e2cfdaabb4099b5a3cbd285680d493cdd2d7..0deda5a2a842cc877d250f657c63999816cdcb22 100644 (file)
@@ -50,7 +50,7 @@ enum {
 };
 
 
-
+/* for editing areas/regions */
 typedef struct AZone {
        struct AZone *next, *prev;
        ARegion *ar;
index 08a05f4646adbfa4cca83e5d4eff6851661779b9..f663e5f0a21d787a517738718a63b7def8fd3b6f 100644 (file)
@@ -828,29 +828,40 @@ static void ed_default_handlers(wmWindowManager *wm, ListBase *handlers, int fla
        
        // XXX it would be good to have boundbox checks for some of these...
        if(flag & ED_KEYMAP_UI) {
+               /* user interface widgets */
                UI_add_region_handlers(handlers);
        }
        if(flag & ED_KEYMAP_VIEW2D) {
+               /* 2d-viewport handling+manipulation */
                wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
        }
        if(flag & ED_KEYMAP_MARKERS) {
+               /* time-markers */
                wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
                // XXX need boundbox check urgently!!!
        }
        if(flag & ED_KEYMAP_ANIMATION) {
+               /* frame changing and timeline operators (for time spaces) */
                wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
        }
        if(flag & ED_KEYMAP_FRAMES) {
+               /* frame changing/jumping (for all spaces) */
                wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
        }
        if(flag & ED_KEYMAP_GPENCIL) {
+               /* grease pencil */
                wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
        }
+       if(flag & ED_KEYMAP_HEADER) {
+               /* standard keymap for headers regions */
+               wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Header", 0, 0);
+               WM_event_add_keymap_handler(handlers, keymap);
+       }
 }
 
 
index 73ad07453c5076e809d8f05e112891a53c1eb7cd..9f2b8113119f6e2074427571916e79c1519318d4 100644 (file)
@@ -2119,7 +2119,51 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot)
        
        ot->poll= ED_operator_areaactive;
        ot->flag= 0;
+}
+
+/* ************** header tools operator ***************************** */
+
+static int header_toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       ScrArea *sa= CTX_wm_area(C);
+       ARegion *ar= CTX_wm_region(C);
+       uiPopupMenu *pup;
+       uiLayout *layout;
+
+       pup= uiPupMenuBegin(C, "Header", 0);
+       layout= uiPupMenuLayout(pup);
+       
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN); // XXX still can't manage to get the right region flipped
+       if (ar->alignment == RGN_ALIGN_TOP)
+               uiItemO(layout, "Flip to Bottom", 0, "SCREEN_OT_region_flip");
+       else
+               uiItemO(layout, "Flip to Top", 0, "SCREEN_OT_region_flip");
+       
+       uiItemS(layout);
+       
+       /* file browser should be fullscreen all the time, but other regions can be maximised/restored... */
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
+       if (sa->spacetype != SPACE_FILE) {
+               if (sa->full) 
+                       uiItemO(layout, "Tile Window", 0, "SCREEN_OT_screen_full_area");
+               else
+                       uiItemO(layout, "Maximize Window", 0, "SCREEN_OT_screen_full_area");
+       }
+       
+       uiPupMenuEnd(C, pup);
+
+       return OPERATOR_CANCELLED;
+}
 
+void SCREEN_OT_header_toolbox(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Header Toolbox";
+       ot->description="Display header region toolbox";
+       ot->idname= "SCREEN_OT_header_toolbox";
+       
+       /* api callbacks */
+       ot->invoke= header_toolbox_invoke;
 }
 
 /* ****************** anim player, with timer ***************** */
@@ -3559,6 +3603,7 @@ void ED_operatortypes_screen(void)
        WM_operatortype_append(SCREEN_OT_region_foursplit);
        WM_operatortype_append(SCREEN_OT_region_flip);
        WM_operatortype_append(SCREEN_OT_region_scale);
+       WM_operatortype_append(SCREEN_OT_header_toolbox);
        WM_operatortype_append(SCREEN_OT_screen_set);
        WM_operatortype_append(SCREEN_OT_screen_full_area);
        WM_operatortype_append(SCREEN_OT_screenshot);
@@ -3638,7 +3683,11 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
                        /* area move after action zones */
        WM_keymap_verify_item(keymap, "SCREEN_OT_area_move", LEFTMOUSE, KM_PRESS, 0, 0);
 
-
+       /* Header Editing ------------------------------------------------ */
+       keymap= WM_keymap_find(keyconf, "Header", 0, 0);
+       
+       WM_keymap_add_item(keymap, "SCREEN_OT_header_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
+       
        /* Screen General ------------------------------------------------ */
        keymap= WM_keymap_find(keyconf, "Screen", 0, 0);
        
@@ -3658,7 +3707,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "SCREEN_OT_region_foursplit", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
        WM_keymap_verify_item(keymap, "SCREEN_OT_repeat_history", F3KEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "SCREEN_OT_repeat_last", RKEY, KM_PRESS, KM_SHIFT, 0);
-       WM_keymap_add_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 0);
+       WM_keymap_verify_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "SCREEN_OT_redo_last", F6KEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "WM_OT_reload_scripts", F8KEY, KM_PRESS, 0, 0);
 
index 59b690002d283421ef5a37bba1519d00629a977c..d4f8fcfb449d2cb80d4966333d6288ba953f3e6c 100644 (file)
@@ -444,7 +444,7 @@ void ED_spacetype_action(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype action region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        
        art->init= action_header_area_init;
        art->draw= action_header_area_draw;
index de8a1616496d06530f695924c26ac7b4d7293385..9fc24516d2d8581bc89cb4dde2874098dfac5693 100644 (file)
@@ -349,7 +349,7 @@ void ED_spacetype_buttons(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= BUTS_HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        
        art->init= buttons_header_area_init;
        art->draw= buttons_header_area_draw;
index 3dca5a4db4b52060b5fa96ebb4f508fcb0691c3f..4d2f816ba6b7af792cbe8bfc2676e646211137f2 100644 (file)
@@ -356,7 +356,7 @@ void ED_spacetype_console(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype console region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
        
        art->init= console_header_area_init;
        art->draw= console_header_area_draw;
index 08ac9194fcb67d0e8aa448bb3f0b1665a07edcd5..cadb5767508cf18e388ef81c174d4e9c5ae2d7cd 100644 (file)
@@ -531,7 +531,7 @@ void ED_spacetype_file(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
        art->init= file_header_area_init;
        art->draw= file_header_area_draw;
        // art->listener= file_header_area_listener;
index 157202190bbfa248d8b6e87a3cd19b5132ee741d..24f87906391bc07802b6da468aef8b805fff7834 100644 (file)
@@ -593,7 +593,7 @@ void ED_spacetype_ipo(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        art->listener= graph_region_listener;
        art->init= graph_header_area_init;
        art->draw= graph_header_area_draw;
index 8478b40092f7bfc3fab11737617702eabe9d4714..3bb697ba1f484a2585f59e7b5af719320748b578 100644 (file)
@@ -569,7 +569,7 @@ void ED_spacetype_image(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype image region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        art->init= image_header_area_init;
        art->draw= image_header_area_draw;
        
index c28e86a6fa6ae0f89e0f9e53dba9c878ea25a08f..ab10e05b2042eeca50f3afddb1a5add78340faed 100644 (file)
@@ -204,7 +204,7 @@ void ED_spacetype_info(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype info region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        art->listener= info_header_listener;
        art->init= info_header_area_init;
        art->draw= info_header_area_draw;
index 62ed6a0a7694b1391be7e864f5f8a6ae9b7d624b..f9fdbb92db9e9c23f57742b1fff6e5e4041db34c 100644 (file)
@@ -364,7 +364,7 @@ void ED_spacetype_logic(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        art->init= logic_header_area_init;
        art->draw= logic_header_area_draw;
        
index 1e35e9122e60b9a31c181e3e9ca97b2a3fd43be6..a019e684239d7813490b77aedfca633493a2dff9 100644 (file)
@@ -538,7 +538,7 @@ void ED_spacetype_nla(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype nla region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        
        art->init= nla_header_area_init;
        art->draw= nla_header_area_draw;
index e5fb0b8dfcf316a7f4cbea752e77b6ad2e35cc5f..f5c6efa2fb8c9f5cc510fa9463faf48f25a18153 100644 (file)
@@ -370,7 +370,7 @@ void ED_spacetype_node(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        art->listener= node_region_listener;
        art->init= node_header_area_init;
        art->draw= node_header_area_draw;
index e3fbb13ed7d24e356ea3dda2096321ba7abf614a..31de6839468ce54fb1b5bd975b55a293e7b3aa6f 100644 (file)
@@ -281,7 +281,7 @@ void ED_spacetype_outliner(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype time region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        
        art->init= outliner_header_area_init;
        art->draw= outliner_header_area_draw;
index fc2f10670df0a0cf882d36ec6cc2bfa1497695be..e6edb71c1b1c20837fbc7f6b734f7bce02acde16 100644 (file)
@@ -219,7 +219,7 @@ void ED_spacetype_script(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype script region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
        
        art->init= script_header_area_init;
        art->draw= script_header_area_draw;
index f0fe3b4749234555909d8cf88e23a7da3d5f3bea..b8adaf23f73c3331670cae0be2a0d81692050c8d 100644 (file)
@@ -322,7 +322,7 @@ void ED_spacetype_sequencer(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        
        art->init= sequencer_header_area_init;
        art->draw= sequencer_header_area_draw;
index 314e711234a5d3750425ed1fe89cdc0c2eefb199..f2c449ffc1f549c2b7dcad1209a198eacd84a04a 100644 (file)
@@ -246,7 +246,7 @@ void ED_spacetype_sound(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
        
        art->init= sound_header_area_init;
        art->draw= sound_header_area_draw;
index 0b30587c5216e7446866e1bb675f1a334be36f42..a8d146bb7a883c818563ee1a4659d39f19678331 100644 (file)
@@ -438,7 +438,7 @@ void ED_spacetype_text(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype text region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
        
        art->init= text_header_area_init;
        art->draw= text_header_area_draw;
index 501ac1c0cbae787d307c2d5f4456a833e38cb5e4..59314fba48ea606e80d37eb77e9e909626dcbb39 100644 (file)
@@ -418,7 +418,7 @@ void ED_spacetype_time(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype time region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        
        art->init= time_header_area_init;
        art->draw= time_header_area_draw;
index 39fc2fd2bd1628755802999d313cc040934ba527..da475ff4c5ba120527d6aff6f8f201dc2ec9640b 100644 (file)
@@ -175,7 +175,7 @@ void ED_spacetype_userpref(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
        art->listener= userpref_header_listener;
        art->init= userpref_header_area_init;
        art->draw= userpref_header_area_draw;
index 787df5150f48c622975c3ad4b82a6b1b08d1b5ee..db617473291e07e3d42f133291fd9a4565933896 100644 (file)
@@ -839,7 +839,7 @@ void ED_spacetype_view3d(void)
        art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region");
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
        art->listener= view3d_header_area_listener;
        art->init= view3d_header_area_init;
        art->draw= view3d_header_area_draw;