[Bf-blender-cvs] [36da579] master: Markers: show the area that handles marker events

Campbell Barton noreply at git.blender.org
Tue Oct 28 19:00:47 CET 2014


Commit: 36da579d122fe49f3db8759e38d6ff1921939ad4
Author: Campbell Barton
Date:   Tue Oct 28 18:51:28 2014 +0100
Branches: master
https://developer.blender.org/rB36da579d122fe49f3db8759e38d6ff1921939ad4

Markers: show the area that handles marker events

===================================================================

M	source/blender/editors/animation/anim_markers.c
M	source/blender/editors/include/ED_markers.h
M	source/blender/editors/include/UI_view2d.h
M	source/blender/editors/screen/area.c
M	source/blender/editors/space_action/space_action.c
M	source/blender/editors/space_graph/space_graph.c
M	source/blender/editors/space_nla/space_nla.c
M	source/blender/editors/space_sequencer/sequencer_draw.c

===================================================================

diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 58db93b..bb959ad 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -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) {
diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h
index 76d3662..241cd70 100644
--- a/source/blender/editors/include/ED_markers.h
+++ b/source/blender/editors/include/ED_markers.h
@@ -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);
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 0f190bc..4d7446a 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -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__ */
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index e38f3b5..ed224b2 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -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);
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 7ca8968..ba68bec 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -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 */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 6dba706..7ed1c22 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -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);
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 134e5dd..f36016b 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -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);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index f9ca713..383da74 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -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);




More information about the Bf-blender-cvs mailing list