diff --git a/source/blender/include/BIF_editaction.h b/source/blender/include/BIF_editaction.h index 29985a06a7e..930a7263ce4 100644 --- a/source/blender/include/BIF_editaction.h +++ b/source/blender/include/BIF_editaction.h @@ -153,6 +153,7 @@ void rearrange_action_channels(short mode); void expand_all_action(void); void openclose_level_action(short mode); +void setflag_action_channels(short mode); /* IPO/Handle Types */ void sethandles_action_keys(int code); diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index fb8ac5664d1..8b490051fe4 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -398,8 +398,11 @@ static void actdata_filter_action (ListBase *act_data, bAction *act, int filter_ for (agrp= act->groups.first; agrp; agrp= agrp->next) { /* add this group as a channel first */ if (!(filter_mode & ACTFILTER_ONLYICU) && !(filter_mode & ACTFILTER_IPOKEYS)) { - ale= make_new_actlistelem(agrp, ACTTYPE_GROUP, NULL, ACTTYPE_NONE); - if (ale) BLI_addtail(act_data, ale); + /* check if filtering by selection */ + if ( !(filter_mode & ACTFILTER_SEL) || SEL_AGRP(agrp) ) { + ale= make_new_actlistelem(agrp, ACTTYPE_GROUP, NULL, ACTTYPE_NONE); + if (ale) BLI_addtail(act_data, ale); + } } /* store reference to last channel of group */ @@ -1239,7 +1242,7 @@ void snap_action_keys(short mode) void *data; short datatype; char str[32]; - + /* get data */ data= get_action_context(&datatype); if (data == NULL) return; @@ -2254,7 +2257,139 @@ static void numbuts_action () } } - +/* Set/clear a particular flag (setting) for all selected + visible channels + * mode: 0 = toggle, 1 = turn on, 2 = turn off + */ +void setflag_action_channels (short mode) +{ + ListBase act_data = {NULL, NULL}; + bActListElem *ale; + int filter; + void *data; + short datatype; + char str[32]; + short val; + + /* get data */ + data= get_action_context(&datatype); + if (data == NULL) return; + + /* get setting to affect */ + if (mode == 2) { + val= pupmenu("Disable Setting%t|Protect %x1|Mute%x2"); + sprintf(str, "Disable Action Setting"); + } + else if (mode == 1) { + val= pupmenu("Enable Setting%t|Protect %x1|Mute%x2"); + sprintf(str, "Enable Action Setting"); + } + else { + val= pupmenu("Toggle Setting%t|Protect %x1|Mute%x2"); + sprintf(str, "Toggle Action Setting"); + } + if (val <= 0) return; + + /* filter data */ + filter= (ACTFILTER_VISIBLE | ACTFILTER_CHANNELS | ACTFILTER_SEL); + actdata_filter(&act_data, filter, data, datatype); + + /* affect selected channels */ + for (ale= act_data.first; ale; ale= ale->next) { + switch (ale->type) { + case ACTTYPE_GROUP: + { + bActionGroup *agrp= (bActionGroup *)ale->data; + + /* only 'protect' is available */ + if (val == 1) { + if (mode == 2) + agrp->flag &= ~AGRP_PROTECTED; + else if (mode == 1) + agrp->flag |= AGRP_PROTECTED; + else + agrp->flag ^= AGRP_PROTECTED; + } + } + break; + case ACTTYPE_ACHAN: + { + bActionChannel *achan= (bActionChannel *)ale->data; + + /* 'protect' and 'mute' */ + if ((val == 2) && (achan->ipo)) { + Ipo *ipo= achan->ipo; + + /* mute */ + if (mode == 2) + ipo->muteipo= 0; + else if (mode == 1) + ipo->muteipo= 1; + else + ipo->muteipo= (ipo->muteipo) ? 0 : 1; + } + else if (val == 1) { + /* protected */ + if (mode == 2) + achan->flag &= ~ACHAN_PROTECTED; + else if (mode == 1) + achan->flag |= ACHAN_PROTECTED; + else + achan->flag ^= ACHAN_PROTECTED; + } + } + break; + case ACTTYPE_CONCHAN: + { + bConstraintChannel *conchan= (bConstraintChannel *)ale->data; + + /* 'protect' and 'mute' */ + if ((val == 2) && (conchan->ipo)) { + Ipo *ipo= conchan->ipo; + + /* mute */ + if (mode == 2) + ipo->muteipo= 0; + else if (mode == 1) + ipo->muteipo= 1; + else + ipo->muteipo= (ipo->muteipo) ? 0 : 1; + } + else if (val == 1) { + /* protect */ + if (mode == 2) + conchan->flag &= ~CONSTRAINT_CHANNEL_PROTECTED; + else if (mode == 1) + conchan->flag |= CONSTRAINT_CHANNEL_PROTECTED; + else + conchan->flag ^= CONSTRAINT_CHANNEL_PROTECTED; + } + } + break; + case ACTTYPE_ICU: + { + IpoCurve *icu= (IpoCurve *)ale->data; + + /* mute */ + if (val == 2) { + if (mode == 2) + icu->flag &= ~IPO_MUTE; + else if (mode == 1) + icu->flag |= IPO_MUTE; + else + icu->flag ^= IPO_MUTE; + } + } + break; + } + } + BLI_freelistN(&act_data); + + BIF_undo_push(str); + allspace(REMAKEIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWNLA, 0); +} /* **************************************************** */ /* CHANNEL SELECTION */ @@ -3986,7 +4121,8 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if (event == LEFTMOUSE) { event = RIGHTMOUSE; mousebut = L_MOUSE; - } else if (event == RIGHTMOUSE) { + } + else if (event == RIGHTMOUSE) { event = LEFTMOUSE; mousebut = R_MOUSE; } @@ -4071,25 +4207,6 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) action_groups_group(1); else if (G.qual == LR_ALTKEY) action_groups_ungroup(); - - else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY|LR_ALTKEY)) { - /* WARNING: this is a debug tool which should be removed once everything is stable... */ - bAction *act= G.saction->action; - bActionGroup *agrp; - bActionChannel *achan; - - printf("Debug Action Grouping: \n"); - - printf("\tGroups: \n"); - for (agrp= act->groups.first; agrp; agrp= agrp->next) { - printf("\t\tGroup \"%s\" : %p... start={%p} end={%p} \n", agrp->name, agrp, agrp->channels.first, agrp->channels.last); - } - - printf("\tAction Channels: \n"); - for (achan= act->chanbase.first; achan; achan= achan->next) { - printf("\t\tAchan \"%s\" : %p... group={%p} \n", achan->name, achan, achan->grp); - } - } /* Transforms */ else { @@ -4258,6 +4375,20 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if (okee("Set Keys to Vector Handle")) sethandles_action_keys(HD_VECT); break; + + case WKEY: + /* toggle/turn-on\off-based-on-setting */ + if (G.qual) { + if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) + val= 1; + else if (G.qual == LR_ALTKEY) + val= 2; + else + val= 0; + + setflag_action_channels(val); + } + break; case PAGEUPKEY: if (datatype == ACTCONT_ACTION) { diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index 5c26e7ba0bc..1f2826d851b 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -96,9 +96,6 @@ enum { ACTMENU_VIEW_PREVKEYFRAME, ACTMENU_VIEW_TIME, ACTMENU_VIEW_NOHIDE, - ACTMENU_VIEW_OPENLEVELS, - ACTMENU_VIEW_CLOSELEVELS, - ACTMENU_VIEW_EXPANDALL, ACTMENU_VIEW_TRANSDELDUPS, ACTMENU_VIEW_HORIZOPTIMISE }; @@ -123,6 +120,32 @@ enum { ACTMENU_SEL_COLUMN_MARKERSBETWEEN }; +enum { + ACTMENU_CHANNELS_OPENLEVELS = 0, + ACTMENU_CHANNELS_CLOSELEVELS, + ACTMENU_CHANNELS_EXPANDALL, + ACTMENU_CHANNELS_DELETE +}; + +enum { + ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_UP = 0, + ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_DOWN, + ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_TOP, + ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_BOTTOM +}; + +enum { + ACTMENU_CHANNELS_GROUP_ADD_TOACTIVE = 0, + ACTMENU_CHANNELS_GROUP_ADD_TONEW, + ACTMENU_CHANNELS_GROUP_REMOVE +}; + +enum { + ACTMENU_CHANNELS_SETTINGS_TOGGLE = 0, + ACTMENU_CHANNELS_SETTINGS_ENABLE, + ACTMENU_CHANNELS_SETTINGS_DISABLE, +}; + enum { ACTMENU_KEY_DUPLICATE = 0, ACTMENU_KEY_DELETE, @@ -130,19 +153,6 @@ enum { ACTMENU_KEY_SAMPLEKEYS }; -enum { - ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_UP = 0, - ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_DOWN, - ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_TOP, - ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_BOTTOM -}; - -enum { - ACTMENU_KEY_CHANGROUP_ADD_TOACTIVE = 0, - ACTMENU_KEY_CHANGROUP_ADD_TONEW, - ACTMENU_KEY_CHANGROUP_REMOVE -}; - enum { ACTMENU_KEY_TRANSFORM_MOVE = 0, ACTMENU_KEY_TRANSFORM_SCALE, @@ -328,15 +338,6 @@ static void do_action_viewmenu(void *arg, int event) case ACTMENU_VIEW_PREVKEYFRAME: /* Jump to previous keyframe */ nextprev_action_keyframe(-1); break; - case ACTMENU_VIEW_OPENLEVELS: /* Unfold channels one step */ - openclose_level_action(1); - break; - case ACTMENU_VIEW_CLOSELEVELS: /* Fold channels one step */ - openclose_level_action(-1); - break; - case ACTMENU_VIEW_EXPANDALL: /* Expands all channels */ - expand_all_action(); - break; case ACTMENU_VIEW_TRANSDELDUPS: /* Don't delete duplicate/overlapping keyframes after transform */ G.saction->flag ^= SACTION_NOTRANSKEYCULL; break; @@ -414,27 +415,7 @@ static uiBlock *action_viewmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - /* only if editing action... */ - // TODO: improve this code! - - if (G.saction->action) { - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Toggle Show Hierachy|~", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_VIEW_EXPANDALL, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Expand One Level|Ctrl NumPad+", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_VIEW_OPENLEVELS, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Collapse One Level|Ctrl NumPad-", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_VIEW_CLOSELEVELS, ""); - } - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, - menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Marker|PageUp", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_VIEW_NEXTMARKER, ""); @@ -549,7 +530,7 @@ static void do_action_selectmenu(void *arg, int event) Key *key; saction = curarea->spacedata.first; - if (!saction) return; + if (saction == NULL) return; act = saction->action; key = get_action_mesh_key(); @@ -689,7 +670,228 @@ static uiBlock *action_selectmenu(void *arg_unused) uiDefIconTextBlockBut(block, action_selectmenu_columnmenu, NULL, ICON_RIGHTARROW_THIN, "Column Select Keys", 0, yco-=20, 120, 20, ""); - if(curarea->headertype==HEADERTOP) { + if (curarea->headertype==HEADERTOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + + return block; +} + + +static void do_action_channelmenu_posmenu(void *arg, int event) +{ + switch(event) + { + case ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_DOWN: + rearrange_action_channels(REARRANGE_ACTCHAN_DOWN); + break; + case ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_UP: + rearrange_action_channels(REARRANGE_ACTCHAN_UP); + break; + case ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_TOP: + rearrange_action_channels(REARRANGE_ACTCHAN_TOP); + break; + case ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_BOTTOM: + rearrange_action_channels(REARRANGE_ACTCHAN_BOTTOM); + break; + } + + scrarea_queue_winredraw(curarea); +} + +static uiBlock *action_channelmenu_posmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "action_channelmenu_posmenu", + UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); + uiBlockSetButmFunc(block, do_action_channelmenu_posmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Move Up|Shift Page Up", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_UP, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Move Down|Shift Page Down", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_DOWN, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, + menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Move to Top|Ctrl Shift Page Up", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_TOP, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Move to Bottom|Ctrl Shift Page Down", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_CHANPOS_MOVE_CHANNEL_BOTTOM, ""); + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 60); + + return block; +} + +static void do_action_channelmenu_groupmenu(void *arg, int event) +{ + switch(event) + { + case ACTMENU_CHANNELS_GROUP_ADD_TOACTIVE: + action_groups_group(0); + break; + case ACTMENU_CHANNELS_GROUP_ADD_TONEW: + action_groups_group(1); + break; + case ACTMENU_CHANNELS_GROUP_REMOVE: + action_groups_ungroup(); + break; + } +} + +static uiBlock *action_channelmenu_groupmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "action_channelmenu_groupmenu", + UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); + uiBlockSetButmFunc(block, do_action_channelmenu_groupmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Add to Active Group|Shift G", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_GROUP_ADD_TOACTIVE, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Add to New Group|Ctrl Shift G", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_GROUP_ADD_TONEW, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, + menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Remove From Group|Alt G", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_GROUP_REMOVE, ""); + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 60); + + return block; +} + +static void do_action_channelmenu_settingsmenu(void *arg, int event) +{ + setflag_action_channels(event); +} + +static uiBlock *action_channelmenu_settingsmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "action_channelmenu_settingsmenu", + UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); + uiBlockSetButmFunc(block, do_action_channelmenu_settingsmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Toggle a Setting|Shift W", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_SETTINGS_TOGGLE, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Enable a Setting|Ctrl Shift W", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_SETTINGS_ENABLE, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Disable a Setting|Alt W", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_CHANNELS_SETTINGS_DISABLE, ""); + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 60); + + return block; +} + +static void do_action_channelmenu(void *arg, int event) +{ + SpaceAction *saction; + + saction = curarea->spacedata.first; + if (saction == NULL) return; + + switch(event) + { + case ACTMENU_CHANNELS_OPENLEVELS: /* Unfold selected channels one step */ + openclose_level_action(1); + break; + case ACTMENU_CHANNELS_CLOSELEVELS: /* Fold selected channels one step */ + openclose_level_action(-1); + break; + case ACTMENU_CHANNELS_EXPANDALL: /* Expands all channels */ + expand_all_action(); + break; + case ACTMENU_CHANNELS_DELETE: /* Deletes selected channels */ + delete_action_channels(); + break; + } +} + +static uiBlock *action_channelmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "action_channelmenu", + UI_EMBOSSP, UI_HELV, curarea->headwin); + uiBlockSetButmFunc(block, do_action_channelmenu, NULL); + + uiDefIconTextBlockBut(block, action_channelmenu_groupmenu, + NULL, ICON_RIGHTARROW_THIN, + "Grouping", 0, yco-=20, 120, 20, ""); + + uiDefIconTextBlockBut(block, action_channelmenu_posmenu, + NULL, ICON_RIGHTARROW_THIN, + "Ordering", 0, yco-=20, 120, 20, ""); + + uiDefIconTextBlockBut(block, action_channelmenu_settingsmenu, + NULL, ICON_RIGHTARROW_THIN, + "Settings", 0, yco-=20, 120, 20, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, + menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Delete|X", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_DELETE, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, + menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Toggle Show Hierachy|~", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_EXPANDALL, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Expand One Level|Ctrl NumPad+", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_OPENLEVELS, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Collapse One Level|Ctrl NumPad-", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_CHANNELS_CLOSELEVELS, ""); + + if (curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); } else { @@ -903,111 +1105,6 @@ static uiBlock *action_keymenu_extendmenu(void *arg_unused) return block; } -static void do_action_keymenu_chanposmenu(void *arg, int event) -{ - switch(event) - { - case ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_DOWN: - rearrange_action_channels(REARRANGE_ACTCHAN_DOWN); - break; - case ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_UP: - rearrange_action_channels(REARRANGE_ACTCHAN_UP); - break; - case ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_TOP: - rearrange_action_channels(REARRANGE_ACTCHAN_TOP); - break; - case ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_BOTTOM: - rearrange_action_channels(REARRANGE_ACTCHAN_BOTTOM); - break; - } - - scrarea_queue_winredraw(curarea); -} - -static uiBlock *action_keymenu_chanposmenu(void *arg_unused) -{ - uiBlock *block; - short yco= 0, menuwidth=120; - - block= uiNewBlock(&curarea->uiblocks, "action_keymenu_chanposmenu", - UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); - uiBlockSetButmFunc(block, do_action_keymenu_chanposmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Move Up|Shift Page Up", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, - ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_UP, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Move Down|Shift Page Down", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, - ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_DOWN, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, - menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Move to Top|Ctrl Shift Page Up", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, - ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_TOP, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Move to Bottom|Ctrl Shift Page Down", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, - ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_BOTTOM, ""); - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - - return block; -} - -static void do_action_keymenu_changroupmenu(void *arg, int event) -{ - switch(event) - { - case ACTMENU_KEY_CHANGROUP_ADD_TOACTIVE: - action_groups_group(0); - break; - case ACTMENU_KEY_CHANGROUP_ADD_TONEW: - action_groups_group(1); - break; - case ACTMENU_KEY_CHANGROUP_REMOVE: - action_groups_ungroup(); - break; - } -} - -static uiBlock *action_keymenu_changroupmenu(void *arg_unused) -{ - uiBlock *block; - short yco= 0, menuwidth=120; - - block= uiNewBlock(&curarea->uiblocks, "action_keymenu_changroupmenu", - UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); - uiBlockSetButmFunc(block, do_action_keymenu_changroupmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Add to Active Group|Shift G", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, - ACTMENU_KEY_CHANGROUP_ADD_TOACTIVE, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Add To New Group|Ctrl Shift G", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, - ACTMENU_KEY_CHANGROUP_ADD_TONEW, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, - menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Remove From Group|Alt G", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, - ACTMENU_KEY_CHANGROUP_REMOVE, ""); - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - - return block; -} - static void do_action_keymenu_snapmenu(void *arg, int event) { switch(event) @@ -1210,17 +1307,6 @@ static uiBlock *action_keymenu(void *arg_unused) uiDefIconTextBlockBut(block, action_keymenu_intpolmenu, NULL, ICON_RIGHTARROW_THIN, "Interpolation Mode", 0, yco-=20, 120, 20, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, - menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBlockBut(block, action_keymenu_changroupmenu, - NULL, ICON_RIGHTARROW_THIN, - "Channel Grouping", 0, yco-=20, 120, 20, ""); - - uiDefIconTextBlockBut(block, action_keymenu_chanposmenu, - NULL, ICON_RIGHTARROW_THIN, - "Channel Ordering", 0, yco-=20, 120, 20, ""); if(curarea->headertype==HEADERTOP) { @@ -1387,6 +1473,13 @@ void action_buttons(void) "Select", xco, -2, xmax-3, 24, ""); xco+= xmax; + if (G.saction->action) { + xmax= GetButStringLength("Channel"); + uiDefPulldownBut(block, action_channelmenu, NULL, + "Channel", xco, -2, xmax-3, 24, ""); + xco+= xmax; + } + xmax= GetButStringLength("Marker"); uiDefPulldownBut(block, action_markermenu, NULL, "Marker", xco, -2, xmax-3, 24, "");