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>2009-02-20 22:11:35 +0300
committerTon Roosendaal <ton@blender.org>2009-02-20 22:11:35 +0300
commit39c2b438a9490468625bd047fdf7b4c02c5348ef (patch)
tree2f1dcb2a839a115da9b77af518200769950c7f90 /source/blender/editors/space_graph/space_graph.c
parentcdf70e0f847fdb5034d24c46e0ee60be1c24417b (diff)
2.5
Graph Editor: added region for buttons (properties), so we can check drivers again! Works like view3d, press NKEY. No buttons there yet though... no time anymore today, it'll require some RNA magic probably.
Diffstat (limited to 'source/blender/editors/space_graph/space_graph.c')
-rw-r--r--source/blender/editors/space_graph/space_graph.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index da18e4d9726..11922a2b383 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -61,6 +61,36 @@
#include "graph_intern.h" // own include
+/* ******************** manage regions ********************* */
+
+ARegion *graph_has_buttons_region(ScrArea *sa)
+{
+ ARegion *ar, *arnew;
+
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if(ar->regiontype==RGN_TYPE_UI)
+ return ar;
+
+ /* add subdiv level; after channel */
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if(ar->regiontype==RGN_TYPE_CHANNELS)
+ break;
+
+ /* is error! */
+ if(ar==NULL) return NULL;
+
+ arnew= MEM_callocN(sizeof(ARegion), "buttons for view3d");
+
+ BLI_insertlinkafter(&sa->regionbase, ar, arnew);
+ arnew->regiontype= RGN_TYPE_UI;
+ arnew->alignment= RGN_ALIGN_TOP|RGN_SPLIT_PREV;
+
+ arnew->flag = RGN_FLAG_HIDDEN;
+
+ return arnew;
+}
+
+
/* ******************** default callbacks for ipo space ***************** */
static SpaceLink *graph_new(const bContext *C)
@@ -94,6 +124,14 @@ static SpaceLink *graph_new(const bContext *C)
ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+ /* ui buttons */
+ ar= MEM_callocN(sizeof(ARegion), "main area for graphedit");
+
+ BLI_addtail(&sipo->regionbase, ar);
+ ar->regiontype= RGN_TYPE_UI;
+ ar->alignment= RGN_ALIGN_TOP|RGN_SPLIT_PREV;
+ ar->flag = RGN_FLAG_HIDDEN;
+
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for graphedit");
@@ -166,6 +204,8 @@ static void graph_main_area_init(wmWindowManager *wm, ARegion *ar)
/* own keymap */
keymap= WM_keymap_listbase(wm, "GraphEdit Keys", SPACE_IPO, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+ keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
}
static void graph_main_area_draw(const bContext *C, ARegion *ar)
@@ -229,6 +269,8 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar)
/* own keymap */
keymap= WM_keymap_listbase(wm, "Animation_Channels", 0, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+ keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
}
static void graph_channel_area_draw(const bContext *C, ARegion *ar)
@@ -288,6 +330,37 @@ static void graph_header_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
}
+/* add handlers, stuff you only do once or on area/region changes */
+static void graph_buttons_area_init(wmWindowManager *wm, ARegion *ar)
+{
+ ListBase *keymap;
+
+ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST_UI, ar->winx, ar->winy);
+
+ keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
+ WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+}
+
+static void graph_buttons_area_draw(const bContext *C, ARegion *ar)
+{
+ float col[3];
+
+ /* clear */
+ UI_GetThemeColor3fv(TH_HEADER, col);
+
+ glClearColor(col[0], col[1], col[2], 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* set view2d view matrix for scrolling (without scrollers) */
+ UI_view2d_view_ortho(C, &ar->v2d);
+
+ graph_region_buttons(C, ar);
+
+ /* restore view matrix? */
+ UI_view2d_view_restore(C);
+}
+
+
static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
@@ -490,6 +563,16 @@ void ED_spacetype_ipo(void)
BLI_addhead(&st->regiontypes, art);
+ /* regions: UI buttons */
+ art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+ art->regionid = RGN_TYPE_UI;
+ art->minsizey= 160;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+ art->listener= NULL; // graph_region_listener;
+ art->init= graph_buttons_area_init;
+ art->draw= graph_buttons_area_draw;
+
+ BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
}