- sequencer select handle menu functions back

- sequencer border zoom (Shift+B) or from the header.
- added includes for blender.c and outliner.c
- editfont.c got rid of warning
This commit is contained in:
Campbell Barton
2009-01-31 09:58:38 +00:00
parent a60413abd1
commit b5230890ec
8 changed files with 149 additions and 34 deletions

View File

@@ -81,6 +81,7 @@
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_sequence.h"
#include "BKE_sound.h"
#include "BLI_editVert.h"

View File

@@ -622,7 +622,7 @@ static int do_textedit(bContext *C, wmOperator *op, wmEvent *evt)
/* tab should exit editmode, but we allow it to be typed using modifier keys */
if(event==TABKEY) {
if(alt==ctrl==shift==0)
if((alt||ctrl||shift) == 0)
return OPERATOR_PASS_THROUGH;
else
ascii= 9;

View File

@@ -77,6 +77,7 @@
#include "BKE_object.h"
#include "BKE_screen.h"
#include "BKE_scene.h"
#include "BKE_sequence.h"
#include "BKE_utildefines.h"
#include "ED_screen.h"

View File

@@ -130,6 +130,12 @@ EnumPropertyItem sequencer_prop_operate_types[] = { /* better name? */
{0, NULL, NULL, NULL}
};
EnumPropertyItem prop_side_types[] = {
{SEQ_SIDE_LEFT, "LEFT", "Left", ""},
{SEQ_SIDE_RIGHT, "RIGHT", "Right", ""},
{SEQ_SIDE_BOTH, "BOTH", "Both", ""},
{0, NULL, NULL, NULL}
};
typedef struct TransSeq {
int start, machine;
@@ -1681,12 +1687,6 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
}
/* cut operator */
static EnumPropertyItem prop_cut_side_types[] = {
{SEQ_LEFT, "LEFT", "Left", ""},
{SEQ_RIGHT, "RIGHT", "Right", ""},
{0, NULL, NULL, NULL}
};
static EnumPropertyItem prop_cut_types[] = {
{SEQ_CUT_SOFT, "SOFT", "Soft", ""},
{SEQ_CUT_HARD, "HARD", "Hard", ""},
@@ -1722,20 +1722,21 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
if (newlist.first) { /* got new strips ? */
Sequence *seq;
addlisttolist(ed->seqbasep, &newlist);
SEQP_BEGIN(ed, seq) {
if (cut_side==SEQ_LEFT) {
if ( seq->startdisp >= cut_frame ) {
seq->flag &= SEQ_DESEL;
}
} else {
if ( seq->enddisp <= cut_frame ) {
seq->flag &= SEQ_DESEL;
if (cut_side != SEQ_SIDE_BOTH) {
SEQP_BEGIN(ed, seq) {
if (cut_side==SEQ_SIDE_LEFT) {
if ( seq->startdisp >= cut_frame ) {
seq->flag &= SEQ_DESEL;
}
} else {
if ( seq->enddisp <= cut_frame ) {
seq->flag &= SEQ_DESEL;
}
}
}
SEQ_END;
}
SEQ_END;
/* as last: */
sort_seq(scene);
}
@@ -1783,7 +1784,7 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot)
RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be cut", INT_MIN, INT_MAX);
RNA_def_enum(ot->srna, "type", prop_cut_types, SEQ_CUT_SOFT, "Type", "the type of cut operation to perform on strips");
RNA_def_enum(ot->srna, "side", prop_cut_side_types, SEQ_LEFT, "Side", "The side that remains selected after cutting");
RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side that remains selected after cutting");
}
/* duplicate operator */
@@ -2383,3 +2384,61 @@ void SEQUENCER_OT_view_selected(wmOperatorType *ot)
}
/* 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);
ED_undo_push(C,"Zoom View, Sequencer");
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;
/* 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

@@ -159,11 +159,11 @@ static uiBlock *seq_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'r');
uiDefMenuSep(block);
but= uiDefMenuButO(block, "SEQUENCER_OT_select_handles", "Surrounding Handles");
RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'b');
RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", SEQ_SIDE_BOTH);
but= uiDefMenuButO(block, "SEQUENCER_OT_select_handles", "Left Handles");
RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'l');
RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", SEQ_SIDE_LEFT);
but= uiDefMenuButO(block, "SEQUENCER_OT_select_handles", "Right Handles");
RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", 'r');
RNA_enum_set(uiButGetOperatorPtrRNA(but), "side", SEQ_SIDE_RIGHT);
uiDefMenuSep(block);
uiDefMenuButO(block, "SEQUENCER_OT_borderselect", NULL);
uiDefMenuSep(block);
@@ -501,11 +501,8 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar)
0, 0, 0, 0,
"Zooms view in and out (Ctrl MiddleMouse)");
xco += XIC;
uiDefIconBut(block, BUT, B_IPOBORDER,
ICON_BORDERMOVE,
xco,yco,XIC,YIC, 0,
0, 0, 0, 0,
"Zooms view to fit area");
uiDefIconButO(block, BUT, "SEQUENCER_OT_view_zoom", WM_OP_INVOKE_REGION_WIN, ICON_BORDERMOVE, xco,yco,XIC,YIC, "Zooms view to fit area");
uiBlockEndAlign(block);
xco += 8 + XIC;
}

View File

@@ -66,6 +66,7 @@ struct Sequence *alloc_sequence(struct ListBase *lb, int cfra, int machine);
/* externs */
extern EnumPropertyItem sequencer_prop_effect_types[];
extern EnumPropertyItem prop_side_types[];
/* operators */
struct wmOperatorType;
@@ -86,6 +87,7 @@ 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);
@@ -94,6 +96,7 @@ void SEQUENCER_OT_select_more(struct wmOperatorType *ot);
void SEQUENCER_OT_select_less(struct wmOperatorType *ot);
void SEQUENCER_OT_select_linked(struct wmOperatorType *ot);
void SEQUENCER_OT_select_pick_linked(struct wmOperatorType *ot);
void SEQUENCER_OT_select_handles(struct wmOperatorType *ot);
void SEQUENCER_OT_borderselect(struct wmOperatorType *ot);
void SEQUENCER_OT_select_invert(struct wmOperatorType *ot);
@@ -107,8 +110,9 @@ void SEQUENCER_OT_add_effect_strip(struct wmOperatorType *ot);
/* RNA enums, just to be more readable */
enum {
SEQ_LEFT,
SEQ_RIGHT,
SEQ_SIDE_LEFT,
SEQ_SIDE_RIGHT,
SEQ_SIDE_BOTH,
};
enum {
SEQ_CUT_SOFT,

View File

@@ -80,6 +80,7 @@ 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);
@@ -89,6 +90,7 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_select_less);
WM_operatortype_append(SEQUENCER_OT_select_pick_linked);
WM_operatortype_append(SEQUENCER_OT_select_linked);
WM_operatortype_append(SEQUENCER_OT_select_handles);
WM_operatortype_append(SEQUENCER_OT_borderselect);
/* sequencer_add.c */
@@ -135,6 +137,8 @@ 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);
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1);

View File

@@ -631,21 +631,20 @@ void SEQUENCER_OT_select_pick_linked(wmOperatorType *ot)
}
/* select linked operator */
static int sequencer_select_linked_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
int selected;
selected = 1;
while (selected) {
selected = select_more_less_seq__internal(scene, 1, 1);
}
ED_undo_push(C, "Select linked, Sequencer");
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
@@ -654,7 +653,7 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
/* identifiers */
ot->name= "Select linked";
ot->idname= "SEQUENCER_OT_select_linked";
/* api callbacks */
ot->exec= sequencer_select_linked_exec;
ot->poll= ED_operator_sequencer_active;
@@ -663,6 +662,56 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
}
/* select linked operator */
static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, 0);
Sequence *seq;
int sel_side= RNA_enum_get(op->ptr, "side");
if (ed==NULL)
return OPERATOR_CANCELLED;
for(seq= ed->seqbasep->first; seq; seq=seq->next) {
if (seq->flag & SELECT) {
switch(sel_side) {
case SEQ_SIDE_LEFT:
seq->flag &= ~SEQ_RIGHTSEL;
seq->flag |= SEQ_LEFTSEL;
break;
case SEQ_SIDE_RIGHT:
seq->flag &= ~SEQ_LEFTSEL;
seq->flag |= SEQ_RIGHTSEL;
break;
case SEQ_SIDE_BOTH:
seq->flag |= SEQ_LEFTSEL+SEQ_RIGHTSEL;
break;
}
}
}
ED_undo_push(C, "Select Handles, Sequencer");
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
void SEQUENCER_OT_select_handles(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select Handles";
ot->idname= "SEQUENCER_OT_select_handles";
/* api callbacks */
ot->exec= sequencer_select_handles_exec;
ot->poll= ED_operator_sequencer_active;
/* properties */
RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side of the handle that is selected");
}
/* borderselect operator */
static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
{