Markers: show the area that handles marker events
authorCampbell Barton <ideasman42@gmail.com>
Tue, 28 Oct 2014 17:51:28 +0000 (18:51 +0100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 28 Oct 2014 17:51:28 +0000 (18:51 +0100)
source/blender/editors/animation/anim_markers.c
source/blender/editors/include/ED_markers.h
source/blender/editors/include/UI_view2d.h
source/blender/editors/screen/area.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_sequencer/sequencer_draw.c

index 58db93b45864ca039613cd21a332b9cccf7e55a7..bb959ad06e5d6655ab5fde3cc687a8ecd8821e1e 100644 (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) {
index 76d36623b603b369a0713a546e9fa4a2486cb910..241cd700c2096ddc120c48654d3989dce65113ce 100644 (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);
index 0f190bc0afc662e9fcae50e638804fed97bd5943..4d7446a7a81256ef3ef68f894ea505d05bf31657 100644 (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__ */
index e38f3b5bee63bd717ff4cbe747ff7b0dee0c35d8..ed224b2d5c2ff6e4531de6faacad50c3b2222352 100644 (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);
index 7ca8968a705d0e81bbfc41f0859aeb3de3258886..ba68becaed119c661b522526e92dfee6157afa8d 100644 (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 */
index 6dba706b241d756c2d091ae85faeb1e46848f60e..7ed1c2237dcc4e5d5d88bd188aa2f4c79836833c 100644 (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);
index 134e5dd80a2da5243ebad9d1ba6a96172f961e4f..f36016b612f3e642bc2e15c3a532cb2f5de09e5d 100644 (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);
index f9ca713ad2de5f7ff1ceb43c839a2908e862bc9c..383da74278e2f4868945fb2e37b5175ec1fde8cc 100644 (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);