Markers: show the area that handles marker events

This commit is contained in:
Campbell Barton 2014-10-28 18:51:28 +01:00
parent b2b1d8e290
commit 36da579d12
Notes: blender-bot 2023-02-14 10:21:15 +01:00
Referenced by issue #41041, 'Delete keyframe' active in markers' area too
8 changed files with 23 additions and 8 deletions

View File

@ -418,12 +418,25 @@ void draw_markers_time(const bContext *C, int flag)
TimeMarker *marker;
Scene *scene;
if (markers == NULL)
if (markers == NULL || BLI_listbase_is_empty(markers)) {
return;
}
scene = CTX_data_scene(C);
v2d = UI_view2d_fromcontext(C);
if (flag & DRAW_MARKERS_MARGIN) {
const unsigned char shade[4] = {0, 0, 0, 16};
glColor4ubv(shade);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glRectf(v2d->cur.xmin, 0, v2d->cur.xmax, UI_MARKER_MARGIN_Y);
glDisable(GL_BLEND);
}
/* unselected markers are drawn at the first time */
for (marker = markers->first; marker; marker = marker->next) {
if ((marker->flag & SELECT) == 0) {

View File

@ -43,7 +43,8 @@ struct TimeMarker;
/* flags for drawing markers */
enum {
DRAW_MARKERS_LINES = (1 << 0),
DRAW_MARKERS_LOCAL = (1 << 1)
DRAW_MARKERS_LOCAL = (1 << 1),
DRAW_MARKERS_MARGIN = (1 << 2),
};
void draw_markers_time(const struct bContext *C, int flag);

View File

@ -234,5 +234,6 @@ void ED_keymap_view2d(struct wmKeyConfig *keyconf);
void UI_view2d_smooth_view(struct bContext *C, struct ARegion *ar,
const struct rctf *cur, const int smooth_viewtx);
#endif /* __UI_VIEW2D_H__ */
#define UI_MARKER_MARGIN_Y (42 * UI_DPI_FAC)
#endif /* __UI_VIEW2D_H__ */

View File

@ -1331,7 +1331,7 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand
ARegion *ar;
/* same local check for all areas */
static rcti rect = {0, 10000, 0, -1};
rect.ymax = (30 * UI_DPI_FAC);
rect.ymax = UI_MARKER_MARGIN_Y;
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
if (ar) {
WM_event_add_keymap_handler_bb(handlers, keymap, &rect, &ar->winrct);

View File

@ -197,7 +197,7 @@ static void action_main_area_draw(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
flag = (ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0;
flag = ((ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0) | DRAW_MARKERS_MARGIN;
draw_markers_time(C, flag);
/* preview range */

View File

@ -293,7 +293,7 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
draw_markers_time(C, 0);
draw_markers_time(C, DRAW_MARKERS_MARGIN);
/* preview range */
UI_view2d_view_ortho(v2d);

View File

@ -305,7 +305,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
draw_markers_time(C, 0);
draw_markers_time(C, DRAW_MARKERS_MARGIN);
/* preview range */
UI_view2d_view_ortho(v2d);

View File

@ -1487,7 +1487,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
draw_markers_time(C, DRAW_MARKERS_LINES);
draw_markers_time(C, DRAW_MARKERS_LINES | DRAW_MARKERS_MARGIN);
/* preview range */
UI_view2d_view_ortho(v2d);