2.5 - Assorted View2D-Related Cleanups

* Removed Sequencer's own 'border zoom' tool. There is a generic one in View2D that should be used instead.

* Changed the hotkey for View2D's version of borderzoom to Shift-B

* Fixed a few hotkey mentions entries in old menus

* Added set start/end frame operators for TimeLine. (SKEY and EKEY)

* Fixed various issues in Graph Editor 
- channels area is now drawn wide enough to show the 'protect' toggles without needing to scroll
- new Graph Editors have 'auto-snap' enabled by default
This commit is contained in:
2009-02-09 04:39:25 +00:00
parent 52e1121669
commit eb848445fb
11 changed files with 106 additions and 88 deletions

View File

@@ -69,7 +69,7 @@ static int view2d_scroll_mapped(int scroll)
}
/* called each time cur changes, to dynamically update masks */
static void view2_masks(View2D *v2d)
static void view2d_masks(View2D *v2d)
{
int scroll;
@@ -93,9 +93,9 @@ static void view2_masks(View2D *v2d)
scroll= view2d_scroll_mapped(v2d->scroll);
/* scrollers shrink mask area, but should be based off regionsize
* - they can only be on one to two edges of the region they define
* - if they overlap, they must not occupy the corners (which are reserved for other widgets)
*/
* - they can only be on one to two edges of the region they define
* - if they overlap, they must not occupy the corners (which are reserved for other widgets)
*/
if (scroll) {
/* vertical scroller */
if (scroll & V2D_SCROLL_LEFT) {
@@ -107,7 +107,7 @@ static void view2_masks(View2D *v2d)
else if (scroll & V2D_SCROLL_RIGHT) {
/* on right-hand edge of region */
v2d->vert= v2d->mask;
v2d->vert.xmax++; /* one pixel extra... was having leaving a minor gap... */
v2d->vert.xmax++; /* one pixel extra... was leaving a minor gap... */
v2d->vert.xmin= v2d->vert.xmax - V2D_SCROLL_WIDTH;
v2d->mask.xmax= v2d->vert.xmin - 1;
}
@@ -243,7 +243,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
v2d->winy= winy;
/* set masks */
view2_masks(v2d);
view2d_masks(v2d);
/* set 'tot' rect before setting cur? */
if (tot_changed)
@@ -586,7 +586,7 @@ void UI_view2d_curRect_validate(View2D *v2d)
}
/* set masks */
view2_masks(v2d);
view2d_masks(v2d);
}
/* ------------------ */

View File

@@ -1295,7 +1295,7 @@ void UI_view2d_keymap(wmWindowManager *wm)
WM_keymap_add_item(keymap, "View2D_OT_view_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
/* borderzoom - drag */
WM_keymap_add_item(keymap, "View2D_OT_view_borderzoom", ZKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "View2D_OT_view_borderzoom", BKEY, KM_PRESS, KM_SHIFT, 0);
/* scrollers */
WM_keymap_add_item(keymap, "View2D_OT_scroller_activate", LEFTMOUSE, KM_PRESS, 0, 0);

View File

@@ -74,8 +74,9 @@ static SpaceLink *action_new(const bContext *C)
saction= MEM_callocN(sizeof(SpaceAction), "initaction");
saction->spacetype= SPACE_ACTION;
saction->autosnap = SACTSNAP_FRAME;
saction->autosnap = SACTSNAP_FRAME;
saction->mode= SACTCONT_DOPESHEET;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for action");

View File

@@ -68,9 +68,12 @@ static SpaceLink *graph_new(const bContext *C)
ARegion *ar;
SpaceIpo *sipo;
/* Graph Editor - general stuff */
sipo= MEM_callocN(sizeof(SpaceIpo), "init graphedit");
sipo->spacetype= SPACE_IPO;
sipo->autosnap= SACTSNAP_FRAME;
/* allocate DopeSheet data for Graph Editor */
sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
@@ -404,7 +407,7 @@ void ED_spacetype_ipo(void)
/* regions: channels */
art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_CHANNELS;
art->minsizex= 200;
art->minsizex= 214; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
art->listener= graph_region_listener;
art->init= graph_channel_area_init;

View File

@@ -590,8 +590,8 @@ static void reload_sound_strip(Scene *scene, char *name)
static void reload_image_strip(Scene *scene, char *name)
{
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *seqact;
SpaceFile *sfile;
Sequence *seq=NULL, *seqact;
SpaceFile *sfile=NULL;
Sequence *last_seq= get_last_seq(scene);
@@ -2392,65 +2392,3 @@ void SEQUENCER_OT_view_selected(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER;
}
/* borderselect operator */
static int sequencer_view_zoom_exec(bContext *C, wmOperator *op)
{
bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
View2D *v2d= UI_view2d_fromcontext(C);
rcti rect;
rctf rectf;
int val;
short mval[2];
val= RNA_int_get(op->ptr, "event_type");
rect.xmin= RNA_int_get(op->ptr, "xmin");
rect.ymin= RNA_int_get(op->ptr, "ymin");
rect.xmax= RNA_int_get(op->ptr, "xmax");
rect.ymax= RNA_int_get(op->ptr, "ymax");
mval[0]= rect.xmin;
mval[1]= rect.ymin;
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmin, &rectf.ymin);
mval[0]= rect.xmax;
mval[1]= rect.ymax;
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
v2d->cur= rectf;
UI_view2d_curRect_validate(v2d);
UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
return OPERATOR_FINISHED;
}
/* ****** Border Select ****** */
void SEQUENCER_OT_view_zoom(wmOperatorType *ot)
{
/* identifiers */
ot->name= "View Zoom";
ot->idname= "SEQUENCER_OT_view_zoom";
/* api callbacks */
ot->invoke= WM_border_select_invoke;
ot->exec= sequencer_view_zoom_exec;
ot->modal= WM_border_select_modal;
ot->poll= ED_operator_sequencer_active;
/* flags */
ot->flag= OPTYPE_REGISTER;
/* rna */
RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
}

View File

@@ -113,9 +113,7 @@ static uiBlock *seq_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
uiDefMenuSep(block);
/* Lock Time */
#define V2D_VIEWLOCK 0 // XXX add back
uiDefIconTextBut(block, BUTM, 1, (v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
uiDefIconTextBut(block, BUTM, 1, (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
"Lock Time to Other Windows|", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
@@ -123,9 +121,9 @@ static uiBlock *seq_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
uiDefMenuSep(block);
if(sseq->flag & SEQ_DRAWFRAMES)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
else
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
if(!sa->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,0, "");
@@ -501,7 +499,7 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
0, 0, 0, 0,
"Zooms view in and out (Ctrl MiddleMouse)");
xco += XIC;
uiDefIconButO(block, BUT, "SEQUENCER_OT_view_zoom", WM_OP_INVOKE_REGION_WIN, ICON_BORDERMOVE, xco,yco,XIC,YIC, "Zooms view to fit area");
uiDefIconButO(block, BUT, "View2D_OT_view_borderzoom", WM_OP_INVOKE_REGION_WIN, ICON_BORDERMOVE, xco,yco,XIC,YIC, "Zooms view to fit area");
uiBlockEndAlign(block);
xco += 8 + XIC;

View File

@@ -87,7 +87,6 @@ void SEQUENCER_OT_meta_separate(struct wmOperatorType *ot);
void SEQUENCER_OT_view_all(struct wmOperatorType *ot);
void SEQUENCER_OT_view_selected(struct wmOperatorType *ot);
void SEQUENCER_OT_view_zoom(struct wmOperatorType *ot);
/* sequencer_select.c */
void SEQUENCER_OT_deselect_all(struct wmOperatorType *ot);

View File

@@ -80,7 +80,6 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_view_all);
WM_operatortype_append(SEQUENCER_OT_view_selected);
WM_operatortype_append(SEQUENCER_OT_view_zoom);
/* sequencer_select.c */
WM_operatortype_append(SEQUENCER_OT_deselect_all);
@@ -137,7 +136,6 @@ void sequencer_keymap(wmWindowManager *wm)
WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_view_zoom", BKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);

View File

@@ -314,7 +314,7 @@ void ED_spacetype_time(void)
art->init= time_main_area_init;
art->draw= time_main_area_draw;
art->listener= time_main_area_listener;
//art->keymap= time_keymap;
art->keymap= time_keymap;
BLI_addhead(&st->regiontypes, art);
/* regions: header */

View File

@@ -222,9 +222,9 @@ static uiBlock *time_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if(stime->flag & TIME_DRAWFRAMES)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
else
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, (stime->flag & TIME_ONLYACTSEL)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
"Only Selected Data Keys|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");

View File

@@ -44,6 +44,8 @@
#include "UI_interface.h"
#include "UI_view2d.h"
#include "ED_screen.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -51,17 +53,96 @@
#include "WM_types.h"
/* *************************************************/
/* ****************** Start/End Frame Operators *******************************/
static int time_set_sfra_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
int frame= CFRA;
if (scene == NULL)
return OPERATOR_CANCELLED;
/* if 'end frame' (Preview Range or Actual) is less than 'frame',
* clamp 'frame' to 'end frame'
*/
if (PEFRA < frame) frame= PEFRA;
/* if Preview Range is defined, set the 'start' frame for that */
if (scene->r.psfra)
scene->r.psfra= frame;
else
scene->r.sfra= frame;
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
return OPERATOR_FINISHED;
}
void TIME_OT_start_frame_set (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Set Start Frame";
ot->idname= "TIME_OT_start_frame_set";
/* api callbacks */
ot->exec= time_set_sfra_exec;
ot->poll= ED_operator_timeline_active;
// XXX properties???
}
static int time_set_efra_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
int frame= CFRA;
if (scene == NULL)
return OPERATOR_CANCELLED;
/* if 'start frame' (Preview Range or Actual) is greater than 'frame',
* clamp 'frame' to 'end frame'
*/
if (PSFRA > frame) frame= PSFRA;
/* if Preview Range is defined, set the 'end' frame for that */
if (scene->r.pefra)
scene->r.pefra= frame;
else
scene->r.efra= frame;
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
return OPERATOR_FINISHED;
}
void TIME_OT_end_frame_set (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Set End Frame";
ot->idname= "TIME_OT_end_frame_set";
/* api callbacks */
ot->exec= time_set_efra_exec;
ot->poll= ED_operator_timeline_active;
// XXX properties???
}
/* ************************** registration **********************************/
void time_operatortypes(void)
{
WM_operatortype_append(TIME_OT_start_frame_set);
WM_operatortype_append(TIME_OT_end_frame_set);
}
void time_keymap(wmWindowManager *wm)
{
ListBase *keymap= WM_keymap_listbase(wm, "TimeLine", SPACE_TIME, 0);
WM_keymap_add_item(keymap, "TIME_OT_start_frame_set", SKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "TIME_OT_end_frame_set", EKEY, KM_PRESS, 0, 0);
}