Clip editor: cleanup of View menu - do not show operators which doesn't make sense in dopesheet/curve view

This commit is contained in:
Sergey Sharybin 2012-05-02 17:33:48 +00:00
parent d64661b507
commit 6f3400ca52
5 changed files with 39 additions and 28 deletions

@ -776,27 +776,28 @@ class CLIP_MT_view(Menu):
layout = self.layout
sc = context.space_data
layout.prop(sc, "show_seconds")
layout.separator()
if sc.view == 'CLIP':
layout.operator("clip.properties", icon='MENU_PANEL')
layout.operator("clip.tools", icon='MENU_PANEL')
layout.separator()
layout.operator("clip.properties", icon='MENU_PANEL')
layout.operator("clip.tools", icon='MENU_PANEL')
layout.separator()
layout.operator("clip.view_selected")
layout.operator("clip.view_all")
layout.operator("clip.view_selected")
layout.operator("clip.view_all")
layout.separator()
layout.operator("clip.view_zoom_in")
layout.operator("clip.view_zoom_out")
layout.separator()
layout.operator("clip.view_zoom_in")
layout.operator("clip.view_zoom_out")
layout.separator()
layout.separator()
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
for a, b in ratios:
text = "Zoom %d:%d" % (a, b)
layout.operator("clip.view_zoom_ratio", text=text).ratio = a / b
for a, b in ratios:
text = "Zoom %d:%d" % (a, b)
layout.operator("clip.view_zoom_ratio", text=text).ratio = a / b
else:
layout.prop(sc, "show_seconds")
layout.separator()
layout.separator()
layout.operator("screen.area_dupli")

@ -42,6 +42,9 @@ struct wmEvent;
/* clip_editor.c */
int ED_space_clip_poll(struct bContext *C);
int ED_space_clip_view_clip_poll(struct bContext *C);
int ED_space_clip_tracking_poll(struct bContext *C);
int ED_space_clip_tracking_size_poll(struct bContext *C);
int ED_space_clip_tracking_frame_poll(struct bContext *C);

@ -73,6 +73,17 @@ int ED_space_clip_poll(bContext *C)
return FALSE;
}
int ED_space_clip_view_clip_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc && sc->clip) {
return sc->view == SC_VIEW_CLIP;
}
return FALSE;
}
int ED_space_clip_tracking_poll(bContext *C)
{
SpaceClip *sc= CTX_wm_space_clip(C);

@ -66,11 +66,7 @@ static int ED_space_clip_graph_poll(bContext *C)
if (ED_space_clip_tracking_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc->view == SC_VIEW_GRAPH) {
ARegion *ar = CTX_wm_region(C);
return ar->regiontype == RGN_TYPE_PREVIEW;
}
return sc->view == SC_VIEW_GRAPH;
}
return FALSE;

@ -408,7 +408,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot)
ot->invoke = view_pan_invoke;
ot->modal = view_pan_modal;
ot->cancel = view_pan_cancel;
ot->poll = ED_space_clip_poll;
ot->poll = ED_space_clip_view_clip_poll;
/* flags */
ot->flag = OPTYPE_BLOCKING;
@ -534,7 +534,7 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
ot->invoke = view_zoom_invoke;
ot->modal = view_zoom_modal;
ot->cancel = view_zoom_cancel;
ot->poll = ED_space_clip_poll;
ot->poll = ED_space_clip_view_clip_poll;
/* flags */
ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
@ -580,7 +580,7 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot)
/* api callbacks */
ot->exec = view_zoom_in_exec;
ot->invoke = view_zoom_in_invoke;
ot->poll = ED_space_clip_poll;
ot->poll = ED_space_clip_view_clip_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
@ -620,7 +620,7 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot)
/* api callbacks */
ot->exec = view_zoom_out_exec;
ot->invoke = view_zoom_out_invoke;
ot->poll = ED_space_clip_poll;
ot->poll = ED_space_clip_view_clip_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
@ -652,7 +652,7 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
/* api callbacks */
ot->exec = view_zoom_ratio_exec;
ot->poll = ED_space_clip_poll;
ot->poll = ED_space_clip_view_clip_poll;
/* properties */
RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX,
@ -719,7 +719,7 @@ void CLIP_OT_view_all(wmOperatorType *ot)
/* api callbacks */
ot->exec = view_all_exec;
ot->poll = ED_space_clip_poll;
ot->poll = ED_space_clip_view_clip_poll;
/* properties */
RNA_def_boolean(ot->srna, "fit_view", 0, "Fit View", "Fit frame to the viewport");
@ -749,7 +749,7 @@ void CLIP_OT_view_selected(wmOperatorType *ot)
/* api callbacks */
ot->exec = view_selected_exec;
ot->poll = ED_space_clip_poll;
ot->poll = ED_space_clip_view_clip_poll;
}
/********************** change frame operator *********************/