View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004621 | ardour | other | public | 2012-01-09 03:17 | 2012-10-24 20:48 |
Reporter | oofus | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | feedback | Resolution | open | ||
Platform | Dell D830 core2duo T9300 2.5GHz | OS | Kubuntu | OS Version | 11.10 |
Target Version | 3.X | ||||
Summary | 0004621: Suggestion to change the look of marker 'flags' in the editor rulers. | ||||
Description | Suggestion to change the look of marker 'flags' in the editor rulers. See attached mock up. Remove the 'shape' from the left hand end of all markers, the very left hand edge becomes the indication of position in time. See start and end marks in the mockup as an example of the 'shape'. Instead all markers will be a rectangular in shape, using the same fill colour that they currently have, but with a black border. Meter and Tempo are examples in the mock up. When the option to view marker lines is enabled, the lines will only descend from the marker downwards, not upwards as well. The line should also be black. Mark 1 is an example. When a marker becomes selected its border changes colour to blue and a line is drawn from the time rulers down to the bottom of the editor. Mark 2 shows this in the mock up. I think this will look cleaner and remove some of the unnecessary colour in the editor. | ||||
Tags | No tags attached. | ||||
2012-01-09 03:17
|
|
2012-01-09 19:04
|
4621.patch (20,850 bytes)
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 7d088d0..069615e 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -2620,25 +2620,10 @@ MarkerDrag::motion (GdkEvent* event, bool) if (real_location->is_mark()) { f_delta = newframe - copy_location->start(); } else { - - - switch (marker->type()) { - case Marker::SessionStart: - case Marker::RangeStart: - case Marker::LoopStart: - case Marker::PunchIn: + if (marker->is_start ()) { f_delta = newframe - copy_location->start(); - break; - - case Marker::SessionEnd: - case Marker::RangeEnd: - case Marker::LoopEnd: - case Marker::PunchOut: + } else { f_delta = newframe - copy_location->end(); - break; - default: - /* what kind of marker is this ? */ - return; } } break; diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index f66b7d0..0fdbe76 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -97,10 +97,10 @@ Editor::add_new_location_internal (Location* location) if (location->is_mark()) { if (location->is_cd_marker() && ruler_cd_marker_action->get_active()) { - lam->start = new Marker (*this, *cd_marker_group, color, location->name(), Marker::Mark, location->start()); + lam->start = new Marker (*this, *cd_marker_group, color, location->name(), true, location->start()); group = cd_marker_group; } else { - lam->start = new Marker (*this, *marker_group, color, location->name(), Marker::Mark, location->start()); + lam->start = new Marker (*this, *marker_group, color, location->name(), true, location->start()); group = marker_group; } @@ -110,40 +110,42 @@ Editor::add_new_location_internal (Location* location) // transport marker lam->start = new Marker (*this, *transport_marker_group, color, - location->name(), Marker::LoopStart, location->start()); + location->name(), true, location->start()); lam->end = new Marker (*this, *transport_marker_group, color, - location->name(), Marker::LoopEnd, location->end()); + location->name(), false, location->end()); group = transport_marker_group; } else if (location->is_auto_punch()) { // transport marker lam->start = new Marker (*this, *transport_marker_group, color, - location->name(), Marker::PunchIn, location->start()); + location->name(), true, location->start()); lam->end = new Marker (*this, *transport_marker_group, color, - location->name(), Marker::PunchOut, location->end()); + location->name(), false, location->end()); group = transport_marker_group; } else if (location->is_session_range()) { // session range - lam->start = new Marker (*this, *marker_group, color, _("start"), Marker::SessionStart, location->start()); - lam->end = new Marker (*this, *marker_group, color, _("end"), Marker::SessionEnd, location->end()); + lam->start = new Marker (*this, *marker_group, color, _("start"), true, location->start()); + lam->start->set_name_immutable (true); + lam->end = new Marker (*this, *marker_group, color, _("end"), false, location->end()); + lam->end->set_name_immutable (true); group = marker_group; } else { // range marker if (location->is_cd_marker() && ruler_cd_marker_action->get_active()) { lam->start = new Marker (*this, *cd_marker_group, color, - location->name(), Marker::RangeStart, location->start()); + location->name(), true, location->start()); lam->end = new Marker (*this, *cd_marker_group, color, - location->name(), Marker::RangeEnd, location->end()); + location->name(), false, location->end()); group = cd_marker_group; } else { lam->start = new Marker (*this, *range_marker_group, color, - location->name(), Marker::RangeStart, location->start()); + location->name(), true, location->start()); lam->end = new Marker (*this, *range_marker_group, color, - location->name(), Marker::RangeEnd, location->end()); + location->name(), false, location->end()); group = range_marker_group; } } @@ -259,17 +261,8 @@ Editor::check_marker_label (Marker* m) double const p = frame_to_pixel (m->position() - (*prev)->position()); - if (m->label_on_left()) { - (*prev)->set_right_label_limit (p / 2); - } else { - (*prev)->set_right_label_limit (p); - } - - if ((*prev)->label_on_left ()) { - m->set_left_label_limit (p); - } else { - m->set_left_label_limit (p / 2); - } + (*prev)->set_label_limit (p); + m->set_label_limit (p / 2); } if (next != sorted.end()) { @@ -278,17 +271,8 @@ Editor::check_marker_label (Marker* m) double const p = frame_to_pixel ((*next)->position() - m->position()); - if ((*next)->label_on_left()) { - m->set_right_label_limit (p / 2); - } else { - m->set_right_label_limit (p); - } - - if (m->label_on_left()) { - (*next)->set_left_label_limit (p); - } else { - (*next)->set_left_label_limit (p / 2); - } + m->set_label_limit (p); + (*next)->set_label_limit (p / 2); } } @@ -331,23 +315,12 @@ Editor::update_marker_labels (ArdourCanvas::Group* group) if (prev != sorted.end()) { double const p = frame_to_pixel ((*i)->position() - (*prev)->position()); - - if ((*prev)->label_on_left()) { - (*i)->set_left_label_limit (p); - } else { - (*i)->set_left_label_limit (p / 2); - } - + (*i)->set_label_limit (p / 2); } if (next != sorted.end()) { double const p = frame_to_pixel ((*next)->position() - (*i)->position()); - - if ((*next)->label_on_left()) { - (*i)->set_right_label_limit (p / 2); - } else { - (*i)->set_right_label_limit (p); - } + (*i)->set_label_limit (p); } prev = i; @@ -568,13 +541,8 @@ Editor::LocationMarkers::canvas_height_set (double h) void Editor::LocationMarkers::set_name (const string& str) { - /* XXX: hack: don't change names of session start/end markers */ - - if (start->type() != Marker::SessionStart) { - start->set_name (str); - } - - if (end && end->type() != Marker::SessionEnd) { + start->set_name (str); + if (end) { end->set_name (str); } } diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 351267a..1afec29 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -46,206 +46,33 @@ using namespace Gtkmm2ext; PBD::Signal1<void,Marker*> Marker::CatchDeletion; Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, const string& annotation, - Type type, framepos_t frame, bool handle_events) + bool start, framepos_t frame, bool handle_events) : editor (ed) , _parent (&parent) , _line (0) - , _type (type) + , _start (start) + , _name_immutable (false) , _selected (false) , _shown (false) , _line_shown (false) , _canvas_height (0) , _color (rgba) - , _left_label_limit (DBL_MAX) - , _right_label_limit (DBL_MAX) - , _label_offset (0) + , _label_limit (DBL_MAX) { - /* Shapes we use: - - Mark: - - (0,0) -> (6,0) - ^ | - | V - (0,5) (6,5) - \ / - (3,13) - - - TempoMark: - MeterMark: - - (3,0) - / \ - (0,5) -> (6,5) - ^ | - | V - (0,10)<-(6,10) - - - Start: - - 0,0\ - | \ - | \ 6,6 - | / - | / - 0,12 - - End: - - /12,0 - / | - / | - 6,6 | - \ | - \ | - \ | - 12,12 - - PunchIn: - - 0,0 ------> 13,0 - | / - | / - | / - | / - | / - | / - 0,13 - - PunchOut - - 0,0 -->-13,0 - \ | - \ | - \ | - \ | - \ | - \ | - 13,13 - - - */ - - switch (type) { - case Mark: - points = new ArdourCanvas::Points (); - - points->push_back (Gnome::Art::Point (0.0, 0.0)); - points->push_back (Gnome::Art::Point (6.0, 0.0)); - points->push_back (Gnome::Art::Point (6.0, 5.0)); - points->push_back (Gnome::Art::Point (3.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 5.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - - _shift = 3; - _label_offset = 8.0; - break; - - case Tempo: - case Meter: - - points = new ArdourCanvas::Points (); - points->push_back (Gnome::Art::Point (3.0, 0.0)); - points->push_back (Gnome::Art::Point (6.0, 5.0)); - points->push_back (Gnome::Art::Point (6.0, 10.0)); - points->push_back (Gnome::Art::Point (0.0, 10.0)); - points->push_back (Gnome::Art::Point (0.0, 5.0)); - points->push_back (Gnome::Art::Point (3.0, 0.0)); - - _shift = 3; - _label_offset = 8.0; - break; - - case SessionStart: - case RangeStart: - - points = new ArdourCanvas::Points (); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - points->push_back (Gnome::Art::Point (6.5, 6.5)); - points->push_back (Gnome::Art::Point (0.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - - _shift = 0; - _label_offset = 13.0; - break; - - case SessionEnd: - case RangeEnd: - points = new ArdourCanvas::Points (); - points->push_back (Gnome::Art::Point (6.5, 6.5)); - points->push_back (Gnome::Art::Point (13.0, 0.0)); - points->push_back (Gnome::Art::Point (13.0, 13.0)); - points->push_back (Gnome::Art::Point (6.5, 6.5)); - - _shift = 13; - _label_offset = 6.0; - break; - - case LoopStart: - points = new ArdourCanvas::Points (); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - points->push_back (Gnome::Art::Point (13.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - - _shift = 0; - _label_offset = 12.0; - break; - - case LoopEnd: - points = new ArdourCanvas::Points (); - points->push_back (Gnome::Art::Point (13.0, 0.0)); - points->push_back (Gnome::Art::Point (13.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 13.0)); - points->push_back (Gnome::Art::Point (13.0, 0.0)); - - _shift = 13; - _label_offset = 0.0; - break; - - case PunchIn: - points = new ArdourCanvas::Points (); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - points->push_back (Gnome::Art::Point (13.0, 0.0)); - points->push_back (Gnome::Art::Point (0.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - - _shift = 0; - _label_offset = 13.0; - break; - - case PunchOut: - points = new ArdourCanvas::Points (); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - points->push_back (Gnome::Art::Point (12.0, 0.0)); - points->push_back (Gnome::Art::Point (12.0, 12.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - - _shift = 13; - _label_offset = 0.0; - break; - - } - frame_position = frame; unit_position = editor.frame_to_unit (frame); - unit_position -= _shift; - group = new Group (parent, unit_position, 1.0); + group = new Group (parent, unit_position, 0); - _name_background = new ArdourCanvas::SimpleRect (*group); - _name_background->property_outline_pixels() = 1; + _background = new ArdourCanvas::SimpleRect (*group); + _background->property_outline_pixels() = 1; + _background->property_outline_color_rgba() = RGBA_BLACK; /* adjust to properly locate the tip */ - mark = new Polygon (*group); - mark->property_points() = *points; set_color_rgba (rgba); - mark->property_width_pixels() = 1; /* setup name pixbuf sizes */ name_font = get_font_for_style (N_("MarkerText")); @@ -258,19 +85,18 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con layout->set_font_description (name_font); Gtkmm2ext::get_ink_pixel_size (layout, width, name_height); - name_pixbuf = new ArdourCanvas::Pixbuf(*group); - name_pixbuf->property_x() = _label_offset; - name_pixbuf->property_y() = (13/2) - (name_height/2); + name_pixbuf = new ArdourCanvas::Pixbuf (*group); + name_pixbuf->property_x() = 2; + name_pixbuf->property_y() = (13/2) - (name_height / 2); set_name (annotation.c_str()); editor.ZoomChanged.connect (sigc::mem_fun (*this, &Marker::reposition)); - mark->set_data ("marker", this); - _name_background->set_data ("marker", this); + _background->set_data ("marker", this); if (handle_events) { - group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this)); + group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), _background, this)); } } @@ -315,7 +141,7 @@ Marker::setup_line () _line = new ArdourCanvas::SimpleLine (*group); _line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get(); - _line->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this)); + _line->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), _background, this)); } /* work out where to start the line from so that it extends from the top of the canvas */ @@ -324,8 +150,8 @@ Marker::setup_line () _line->i2w (xo, yo); - _line->property_x1() = _shift; - _line->property_x2() = _shift; + _line->property_x1() = 0; + _line->property_x2() = 0; _line->property_y1() = -yo; // zero in world coordinates, negative in item/parent coordinate space _line->property_y2() = -yo + _canvas_height; @@ -350,64 +176,46 @@ Marker::canvas_height_set (double h) ArdourCanvas::Item& Marker::the_item() const { - return *mark; + return *_background; } +/** Set a new name for this marker, unless _name_immutable is true, + * in which case the request is ignored. + * @param new_name New name. + */ void Marker::set_name (const string& new_name) { + if (_name_immutable) { + return; + } + _name = new_name; - setup_name_display (); } -/** @return true if our label is on the left of the mark, otherwise false */ -bool -Marker::label_on_left () const -{ - return (_type == SessionEnd || _type == RangeEnd || _type == LoopEnd || _type == PunchOut); -} - void Marker::setup_name_display () { - double limit = DBL_MAX; - - if (label_on_left ()) { - limit = _left_label_limit; - } else { - limit = _right_label_limit; - } - /* Work out how wide the name can be */ - int name_width = min ((double) pixel_width (_name, name_font) + 2, limit); + int name_width = min ((double) pixel_width (_name, name_font) + 2, _label_limit); if (name_width == 0) { name_width = 1; } - if (label_on_left ()) { - name_pixbuf->property_x() = -name_width; - } - name_pixbuf->property_pixbuf() = pixbuf_from_string (_name, name_font, name_width, name_height, Gdk::Color ("#000000")); - if (label_on_left ()) { - _name_background->property_x1() = name_pixbuf->property_x() - 2; - _name_background->property_x2() = name_pixbuf->property_x() + name_width + _shift; - } else { - _name_background->property_x1() = name_pixbuf->property_x() - _label_offset + 2; - _name_background->property_x2() = name_pixbuf->property_x() + name_width; - } + _background->property_x1() = 0; + _background->property_x2() = name_width + 2; - _name_background->property_y1() = 0; - _name_background->property_y2() = 13; + _background->property_y1() = 0; + _background->property_y2() = 13; } void Marker::set_position (framepos_t frame) { double new_unit_position = editor.frame_to_unit (frame); - new_unit_position -= _shift; group->move (new_unit_position - unit_position, 0.0); frame_position = frame; unit_position = new_unit_position; @@ -441,57 +249,37 @@ void Marker::set_color_rgba (uint32_t c) { _color = c; - mark->property_fill_color_rgba() = _color; - mark->property_outline_color_rgba() = _color; if (_line && !_selected) { _line->property_color_rgba() = _color; } - _name_background->property_fill() = true; - _name_background->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (_color, 0x70); - _name_background->property_outline_color_rgba() = _color; -} - -/** Set the number of pixels that are available for a label to the left of the centre of this marker */ -void -Marker::set_left_label_limit (double p) -{ - /* Account for the size of the marker */ - _left_label_limit = p - 13; - if (_left_label_limit < 0) { - _left_label_limit = 0; - } - - if (label_on_left ()) { - setup_name_display (); - } + _background->property_fill() = true; + _background->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (_color, 0x70); } /** Set the number of pixels that are available for a label to the right of the centre of this marker */ void -Marker::set_right_label_limit (double p) +Marker::set_label_limit (double p) { /* Account for the size of the marker */ - _right_label_limit = p - 13; - if (_right_label_limit < 0) { - _right_label_limit = 0; + _label_limit = p - 13; + if (_label_limit < 0) { + _label_limit = 0; } - if (!label_on_left ()) { - setup_name_display (); - } + setup_name_display (); } /***********************************************************************/ TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, ARDOUR::TempoSection& temp) - : Marker (editor, parent, rgba, text, Tempo, 0, false), + : Marker (editor, parent, rgba, text, true, 0, false), _tempo (temp) { set_position (_tempo.frame()); - group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_tempo_marker_event), mark, this)); + group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_tempo_marker_event), _background, this)); } TempoMarker::~TempoMarker () @@ -502,11 +290,11 @@ TempoMarker::~TempoMarker () MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, ARDOUR::MeterSection& m) - : Marker (editor, parent, rgba, text, Meter, 0, false), + : Marker (editor, parent, rgba, text, true, 0, false), _meter (m) { set_position (_meter.frame()); - group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_meter_marker_event), mark, this)); + group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_meter_marker_event), _background, this)); } MeterMarker::~MeterMarker () diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h index 6bf6d08..7f0d323 100644 --- a/gtk2_ardour/marker.h +++ b/gtk2_ardour/marker.h @@ -41,22 +41,7 @@ class PublicEditor; class Marker : public sigc::trackable { public: - enum Type { - Mark, - Tempo, - Meter, - SessionStart, ///< session start - SessionEnd, ///< session end - RangeStart, - RangeEnd, - LoopStart, - LoopEnd, - PunchIn, - PunchOut - }; - - - Marker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, Type, + Marker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, bool, framepos_t frame = 0, bool handle_events = true); virtual ~Marker (); @@ -82,17 +67,19 @@ class Marker : public sigc::trackable void hide (); void show (); - Type type () { return _type; } + /** @return true if this marker is for the start of a range, or is a + single-event marker. + */ + bool is_start () const { return _start; } - void set_left_label_limit (double); - void set_right_label_limit (double); + void set_name_immutable (bool n) { _name_immutable = n; } + + void set_label_limit (double); std::string name () const { return _name; } - bool label_on_left () const; - protected: PublicEditor& editor; @@ -100,27 +87,22 @@ class Marker : public sigc::trackable ArdourCanvas::Group* _parent; ArdourCanvas::Group *group; - ArdourCanvas::Polygon *mark; ArdourCanvas::Pixbuf *name_pixbuf; - ArdourCanvas::Points *points; ArdourCanvas::SimpleLine* _line; - ArdourCanvas::Points *line_points; - ArdourCanvas::SimpleRect* _name_background; + ArdourCanvas::SimpleRect* _background; std::string _name; double unit_position; framepos_t frame_position; - double _shift; - Type _type; + bool _start; + bool _name_immutable; int name_height; bool _selected; bool _shown; bool _line_shown; double _canvas_height; uint32_t _color; - double _left_label_limit; ///< the number of pixels available to the left of this marker for a label - double _right_label_limit; ///< the number of pixels available to the right of this marker for a label - double _label_offset; + double _label_limit; ///< the number of pixels available to the right of this marker for a label void reposition (); void setup_line_x (); |
|
Uploaded a patch; comments welcome. |
|
did this work get done via a different route? the markers look somewhat similar to the suggest these days. |
|
Several things were tried at the time, which didn't all work. I forget the details. The markers as they are now don't contain any of the suggestions. The patch implements some of it, but it was never applied. |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-01-09 03:17 | oofus | New Issue | |
2012-01-09 03:17 | oofus | File Added: mark_ideas_1.png | |
2012-01-09 03:17 | oofus | cost | => 0.00 |
2012-01-09 15:43 | cth103 | Target Version | => 3.X |
2012-01-09 19:04 | cth103 | File Added: 4621.patch | |
2012-01-09 19:04 | cth103 | Note Added: 0012527 | |
2012-01-09 19:04 | cth103 | Status | new => feedback |
2012-10-24 20:42 | paul | Note Added: 0014154 | |
2012-10-24 20:48 | oofus | Note Added: 0014155 |