From 1b3f368e84b0fba04c1a6ebf1e4b5d724d3fa8cf Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 16 Nov 2006 04:01:01 +0000 Subject: [PATCH] == Action Editor Makers == * There is now a feature to (de)select all markers. Can be found in menu or via the hotkey Ctrl A * The 'Markers' menu is now not drawn when marker set is 'None' * Some other minor code cleanups Additional Notes: * I'm still trying to track down the cause of a bug which means that you can't select more than one marker (with RMB clicks) at once. For now, just use borderselect --- source/blender/include/BIF_editaction.h | 4 +- source/blender/src/editaction.c | 79 +++++++++++++++++++------ source/blender/src/header_action.c | 31 ++++++++-- 3 files changed, 90 insertions(+), 24 deletions(-) diff --git a/source/blender/include/BIF_editaction.h b/source/blender/include/BIF_editaction.h index 6ccec20181d..e1825416e3f 100644 --- a/source/blender/include/BIF_editaction.h +++ b/source/blender/include/BIF_editaction.h @@ -89,11 +89,10 @@ void duplicate_saction_markers(struct ListBase *markers); void remove_saction_markers(struct ListBase *markers); void rename_saction_markers(struct ListBase *markers); void transform_saction_markers(int mode, int smode); -void deselect_saction_markers(struct ListBase *markers, int test); +void deselect_saction_markers(struct ListBase *markers, int test, int selectmode); void borderselect_saction_markers(struct ListBase *markers, float xmin, float xmax, int selectmode); struct TimeMarker *find_nearest_saction_marker(struct ListBase *markers); - /* channel/strip operations */ void up_sel_action(void); void down_sel_action(void); @@ -112,7 +111,6 @@ void set_extendtype_actionchannels(int extendtype); /* Select */ void borderselect_mesh(struct Key *key); void borderselect_action(void); -void borderselect_markers(struct ListBase *markers); void deselect_actionchannel_keys(struct bAction *act, int test); void deselect_actionchannels (struct bAction *act, int test); void deselect_meshchannel_keys (struct Key *key, int test); diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 81f21211916..03dfdc66e84 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -648,9 +648,13 @@ static void mouse_action(int selectmode) if (selectmode == SELECT_REPLACE) { selectmode = SELECT_ADD; - deselect_saction_markers(markers, 0); + deselect_saction_markers(markers, 0, 0); marker->flag |= SELECT; } + else if (selectmode == SELECT_ADD) + marker->flag |= SELECT; + else if (selectmode == SELECT_SUBTRACT) + marker->flag &= ~SELECT; std_rmouse_transform(transform_saction_markers); @@ -2457,26 +2461,40 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if (mval[0]ACTWIDTH){ - deselect_actionchannel_keys (act, 1); - allqueue (REDRAWACTION, 0); - allqueue(REDRAWNLA, 0); - allqueue (REDRAWIPO, 0); + else if (mval[0]>ACTWIDTH) { + if (G.qual == LR_CTRLKEY) { + deselect_saction_markers(markers, 1, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWTIME, 0); + } + else { + deselect_actionchannel_keys (act, 1); + allqueue (REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue (REDRAWIPO, 0); + } } } break; @@ -2773,7 +2791,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } /* Clicking in the main area of the action window - * selects keys + * selects keys and markers */ else { if (key) { @@ -3085,19 +3103,46 @@ TimeMarker *find_nearest_saction_marker(ListBase *markers) } /* select/deselect all TimeMarkers */ -void deselect_saction_markers(ListBase *markers, int test) +void deselect_saction_markers(ListBase *markers, int test, int sel) { TimeMarker *marker; - for (marker = markers->first; marker; marker= marker->next) { - if (test) { - if ((marker->flag & SELECT)==0) + /* check if need to find out whether to how to select markers */ + if (test) { + /* dependant on existing selection */ + /* determine if select all or deselect all */ + sel = 0; + for (marker= markers->first; marker; marker= marker->next) { + if ((marker->flag & SELECT)==0) { + sel = 1; + break; + } + } + + /* do selection */ + for (marker= markers->first; marker; marker= marker->next) { + if (sel) { + if ((marker->flag & SELECT)==0) marker->flag |= SELECT; } else { if (marker->flag & SELECT) marker->flag &= ~SELECT; } + } + } + else { + /* not dependant on existing selection */ + for (marker= markers->first; marker; marker= marker->next) { + if (sel) { + if ((marker->flag & SELECT)==0) + marker->flag |= SELECT; + } + else { + if (marker->flag & SELECT) + marker->flag &= ~SELECT; + } + } } } diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index 0bb18014b4e..4cb3dc27bd2 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -89,6 +89,7 @@ #define ACTMENU_SEL_ALL_KEYS 1 #define ACTMENU_SEL_ALL_CHAN 2 #define ACTMENU_SEL_COLUMN 3 +#define ACTMENU_SEL_ALL_MARKERS 4 #define ACTMENU_KEY_DUPLICATE 0 #define ACTMENU_KEY_DELETE 1 @@ -335,6 +336,7 @@ static void do_action_selectmenu(void *arg, int event) SpaceAction *saction; bAction *act; Key *key; + ListBase *markers; saction = curarea->spacedata.first; if (!saction) @@ -342,6 +344,7 @@ static void do_action_selectmenu(void *arg, int event) act = saction->action; key = get_action_mesh_key(); + markers = get_saction_markers(saction); switch(event) { @@ -380,6 +383,14 @@ static void do_action_selectmenu(void *arg, int event) case ACTMENU_SEL_COLUMN: addqueue (curarea->win, KKEY, 1); break; + + case ACTMENU_SEL_ALL_MARKERS: /* select/deselect all markers */ + if (markers != NULL) { + deselect_saction_markers(markers, 1, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWTIME, 0); + } + break; } } @@ -396,16 +407,26 @@ static uiBlock *action_selectmenu(void *arg_unused) "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_SEL_BORDER, ""); + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Keys|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_SEL_ALL_KEYS, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Select/Deselect All Markers|Ctrl A", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_SEL_ALL_MARKERS, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Channels", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_SEL_ALL_CHAN, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, + menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Column|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, @@ -1035,10 +1056,12 @@ void action_buttons(void) "Key", xco, -2, xmax-3, 24, ""); xco+= xmax; - xmax= GetButStringLength("Marker"); - uiDefPulldownBut(block, action_markermenu, NULL, - "Marker", xco, -2, xmax-3, 24, ""); - xco+= xmax; + if (G.saction->markert != SACTION_NOMARKERS) { + xmax= GetButStringLength("Marker"); + uiDefPulldownBut(block, action_markermenu, NULL, + "Marker", xco, -2, xmax-3, 24, ""); + xco+= xmax; + } } uiBlockSetEmboss(block, UI_EMBOSS);