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-11-30 09:15:33 +0300
committerJoshua Leung <aligorith@gmail.com>2008-11-30 09:15:33 +0300
commit43b26b72ab0df5ff8bbdb7e30c761099b95385a6 (patch)
tree07457dfbcfb633975e36c67482c5743b9836025a /source/blender/editors/space_outliner
parent970fa83fab52387aa3f9aa0f3e90d73b5af52bfd (diff)
View2D - Initial commit of Pan-View Operator
* Moved View2D data from space-data to ARegion (aka regions). This has been done because drawing occurs in regions not areas anymore. The View2D struct is currently stored in the ARegion struct (not as pointer), given that most of the regions in use will be 2D anyway (only the 3d-view's "window" region is the exception). Added version patch code for outliner and timeline only for now. Headers are also likely to need this. * Added separate keymap for View2D operators. All regions that use View2D will need this added. This includes headers too. * Pan view operator (ED_View2D_OT_view_pan), currently works for Outliner and Timeline. Use MMB-drag as before. - It currently doesn't exposed any parameters for redo (via RNA-ID-Props), but only uses some customdata. Suggestions on what these parameters could be are welcomed. - I've yet to implement the necessary axis-locking features for this panning (which is required in Timeline for example to prevent vertical panning, which moves the markers out of view).
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 2445e02fbee..8903f26cf3e 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -107,17 +107,19 @@ void UI_table_free(uiTable *table)
void UI_table_draw(wmWindow *window, ARegion *region, uiTable *table)
{
uiBlock *block;
+ View2D *v2d;
rcti *rct, cellrct;
int y, row, col;
-
+
+ v2d= &region->v2d;
rct= &table->rct;
-
+
block= uiBeginBlock(window, region, "table outliner", UI_EMBOSST, UI_HELV);
-
+
for(y=rct->ymax, row=0; y>rct->ymin; y-=ROW_HEIGHT, row++) {
if(row%2 == 0) {
UI_ThemeColorShade(TH_BACK, 6);
- glRecti(rct->xmin, y-ROW_HEIGHT, rct->xmax, y);
+ glRecti(v2d->cur.xmin, y-ROW_HEIGHT, v2d->cur.xmax, y);
}
if(row >= table->rows)
@@ -335,23 +337,20 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
PropertyRNA *prop, *iterprop;
PointerRNA newptr;
float col[3];
- int rows, cols, width, height;
+ int rows, cols, awidth, aheight, width, height;
SpaceOops *soutliner= C->area->spacedata.first;
+ View2D *v2d= &ar->v2d;
/* clear */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
- width= ar->winrct.xmax - ar->winrct.xmin;
- height= ar->winrct.ymax - ar->winrct.ymin;
+ // XXX width should be depend on max length of items (like height)...
+ awidth= width= ar->winrct.xmax - ar->winrct.xmin;
+ aheight= height= ar->winrct.ymax - ar->winrct.ymin;
/* create table */
- rct.xmin= 0;
- rct.ymin= 0;
- rct.xmax= width;
- rct.ymax= height;
-
cell.space= soutliner;
cell.lastrow= -1;
RNA_main_pointer_create(G.main, &cell.ptr);
@@ -390,6 +389,24 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
RNA_property_collection_end(&cell.iter);
+ if ((rows*ROW_HEIGHT) > height)
+ height= rows * ROW_HEIGHT;
+
+ /* need to validate view2d after updating size of tot */
+ v2d->tot.xmin= 0;
+ v2d->tot.xmax= width;
+ v2d->tot.ymax= 0;
+ v2d->tot.ymin= -height;
+ UI_view2d_enforce_status(v2d, awidth, aheight);
+
+ rct.xmin= 0;
+ rct.ymin= -height;
+ rct.xmax= width;
+ rct.ymax= 0;
+
+ /* set matrix for 2d-view controls */
+ UI_view2d_ortho(C, v2d);
+
/* create and draw table */
table= UI_table_create(rows, 2, &rct, rna_table_cell_func, &cell);
@@ -482,6 +499,7 @@ static void outliner_init(wmWindowManager *wm, ScrArea *sa)
ar->type= &mainart;
WM_event_add_keymap_handler(&ar->handlers, &wm->uikeymap);
+ WM_event_add_keymap_handler(&ar->handlers, &wm->view2dkeymap);
}
else if(ar->regiontype == RGN_TYPE_HEADER) {
static ARegionType headerart={NULL, NULL, NULL, NULL, NULL};
@@ -492,6 +510,7 @@ static void outliner_init(wmWindowManager *wm, ScrArea *sa)
ar->type= &headerart;
WM_event_add_keymap_handler(&ar->handlers, &wm->uikeymap);
+ WM_event_add_keymap_handler(&ar->handlers, &wm->view2dkeymap);
}
else {
static ARegionType headerart={NULL, NULL, NULL, NULL, NULL};