From b061a56c215a8d8b36ab79075d0cb4a7f04dd825 Mon Sep 17 00:00:00 2001 From: GZharun Date: Wed, 27 Aug 2014 18:56:34 +0300 Subject: [PATCH 1/7] [Summary] Made master added to the beginning of older session which do not have this track --- gtk2_ardour/editor.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 4649aa58d3..98d94afbee 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -5135,8 +5135,13 @@ Editor::add_routes (RouteList& routes) throw unknown_type(); } - new_views.push_back (rtv); - track_views.push_back (rtv); + if (rtv->is_master_track() ) { + new_views.push_front (rtv); + track_views.push_front (rtv); + } else { + new_views.push_back (rtv); + track_views.push_back (rtv); + } rtv->effective_gain_display (); From c9c7a0961a56d64082d0413fa8a719ff84541623 Mon Sep 17 00:00:00 2001 From: GZharun Date: Thu, 28 Aug 2014 10:20:21 +0300 Subject: [PATCH 2/7] [Summary] Reworked region view according to the PRD [Details] Note: the code is promoted ahead without some cosmetic stuff What is not finished: 1. Move rec color and name highlight color to the config. 2. Make region name displayed above the wave. --- gtk2_ardour/audio_region_view.cc | 26 ++- gtk2_ardour/audio_streamview.cc | 18 +- gtk2_ardour/automation_region_view.cc | 8 +- gtk2_ardour/automation_streamview.h | 2 +- gtk2_ardour/editor_mouse.cc | 2 +- gtk2_ardour/midi_streamview.h | 2 +- gtk2_ardour/region_view.cc | 4 +- gtk2_ardour/streamview.cc | 15 +- gtk2_ardour/time_axis_view_item.cc | 264 ++++++++++++-------------- gtk2_ardour/time_axis_view_item.h | 12 +- gtk2_ardour/ui_config_vars.h | 2 +- 11 files changed, 164 insertions(+), 191 deletions(-) diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index fbfc1d513f..5a9147966b 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -409,12 +409,12 @@ AudioRegionView::reset_width_dependent_items (double pixel_width) float x_pos = trackview.editor().sample_to_pixel (*i); (*l).second->set (ArdourCanvas::Duple (x_pos, 2.0), - ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)); + ArdourCanvas::Duple (x_pos, _height - 1)); (*l).first = *i; (*l).second->set (ArdourCanvas::Duple (x_pos, 2.0), - ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)); + ArdourCanvas::Duple (x_pos, _height - 1)); } reset_fade_shapes (); @@ -457,7 +457,7 @@ AudioRegionView::set_height (gdouble height) if (height < NAME_HIGHLIGHT_THRESH) { ht = ((height - 2 * wcnt) / (double) wcnt); } else { - ht = (((height - 2 * wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt); + ht = (((height - 2 * wcnt) ) / (double) wcnt); } gdouble yoff = n * (ht + 1); @@ -474,7 +474,7 @@ AudioRegionView::set_height (gdouble height) update_envelope_visibility (); } - gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE) - 2); + gain_line->set_height ((uint32_t) rint (height) - 2); } reset_fade_shapes (); @@ -488,7 +488,7 @@ AudioRegionView::set_height (gdouble height) if (height >= NAME_HIGHLIGHT_THRESH) { (*l).second->set (ArdourCanvas::Duple (pos_x, 2.0), - ArdourCanvas::Duple (pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)); + ArdourCanvas::Duple (pos_x, _height - 1)); } else { (*l).second->set (ArdourCanvas::Duple (pos_x, 2.0), ArdourCanvas::Duple (pos_x, _height - 1)); @@ -545,7 +545,7 @@ AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr ar, f double effective_height; if (_height >= NAME_HIGHLIGHT_THRESH) { - effective_height = _height - NAME_HIGHLIGHT_SIZE; + effective_height = _height; } else { effective_height = _height; } @@ -622,7 +622,7 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr ar, double effective_height; if (_height >= NAME_HIGHLIGHT_THRESH) { - effective_height = _height - NAME_HIGHLIGHT_SIZE; + effective_height = _height; } else { effective_height = _height; } @@ -1128,11 +1128,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/) uint32_t nwaves = std::min (nchans, audio_region()->n_channels()); gdouble ht; - if (trackview.current_height() < NAME_HIGHLIGHT_THRESH) { - ht = ((trackview.current_height()) / (double) nchans); - } else { - ht = ((trackview.current_height() - NAME_HIGHLIGHT_SIZE) / (double) nchans); - } + ht = ((trackview.current_height()) / (double) nchans); gdouble yoff = which * ht; @@ -1225,7 +1221,7 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev, b /* compute vertical fractional position */ - y = 1.0 - (y / (_height - NAME_HIGHLIGHT_SIZE)); + y = 1.0 - (y / (_height)); /* map using gain line */ @@ -1520,7 +1516,7 @@ AudioRegionView::transients_changed () CANVAS_DEBUG_NAME (canvas_item, string_compose ("transient group for %1", region()->name())); canvas_item->set (ArdourCanvas::Duple (-1.0, 2.0), - ArdourCanvas::Duple (1.0, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)); + ArdourCanvas::Duple (1.0, _height - 1)); canvas_item->raise_to_top (); canvas_item->show (); @@ -1547,7 +1543,7 @@ AudioRegionView::transients_changed () (*l).second->set ( ArdourCanvas::Duple (*pos, 2.0), - ArdourCanvas::Duple (*pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1) + ArdourCanvas::Duple (*pos, _height - 1) ); (*l).second->set_data ("position", pos); diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 6880c8be5b..c8c671ff1e 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -35,6 +35,7 @@ #include "ardour/session.h" #include "canvas/rectangle.h" +#include "canvas/utils.h" #include "audio_streamview.h" #include "audio_region_view.h" @@ -270,25 +271,22 @@ AudioStreamView::setup_rec_box () switch (_trackview.audio_track()->mode()) { case Normal: case NonLayered: - xend = xstart; - fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect(); - break; - case Destructive: - xend = xstart + 2; - fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect(); + xend = xstart; + //fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect(); + // GZ FIXME:change in config instead of following + fill_color = ArdourCanvas::rgba_to_color (251.0/255.0, 35.0/255.0, 52.0/255.0, 1.0); /* make the recording rect translucent to allow the user to see the peak data coming in, etc. */ - fill_color = UINT_RGBA_CHANGE_A (fill_color, 120); - break; + break; } ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::Rectangle (_canvas_group); rec_rect->set_x0 (xstart); - rec_rect->set_y0 (1); + rec_rect->set_y0 (2); rec_rect->set_x1 (xend); - rec_rect->set_y1 (child_height ()); + rec_rect->set_y1 (child_height () - 3); rec_rect->set_outline_what (ArdourCanvas::Rectangle::What (0)); rec_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame()); rec_rect->set_fill_color (fill_color); diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 86e7121677..e853ccbd95 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -90,7 +90,7 @@ AutomationRegionView::create_line (boost::shared_ptr lis _parameter, &_source_relative_time_converter)); _line->set_colors(); - _line->set_height ((uint32_t)rint(trackview.current_height() - NAME_HIGHLIGHT_SIZE)); + _line->set_height ((uint32_t)rint(trackview.current_height())); _line->set_visibility (AutomationLine::VisibleAspects (AutomationLine::Line|AutomationLine::ControlPoints)); _line->set_maximum_time (_region->length()); _line->set_offset (_region->start ()); @@ -120,7 +120,7 @@ AutomationRegionView::canvas_event (GdkEvent* ev) /* clamp y */ y = std::max (y, 0.0); - y = std::min (y, _height - NAME_HIGHLIGHT_SIZE); + y = std::min (y, _height); /* guard points only if primary modifier is used */ bool with_guard_points = Gtkmm2ext::Keyboard::modifier_state_equals (ev->button.state, Gtkmm2ext::Keyboard::PrimaryModifier); @@ -149,7 +149,7 @@ AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double /* compute vertical fractional position */ - const double h = trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2; + const double h = trackview.current_height() - 2; y = 1.0 - (y / h); /* snap frame */ @@ -186,7 +186,7 @@ AutomationRegionView::set_height (double h) RegionView::set_height(h); if (_line) { - _line->set_height ((uint32_t)rint(h - NAME_HIGHLIGHT_SIZE)); + _line->set_height ((uint32_t)rint(h)); } } diff --git a/gtk2_ardour/automation_streamview.h b/gtk2_ardour/automation_streamview.h index d058f02434..188e3f9f6f 100644 --- a/gtk2_ardour/automation_streamview.h +++ b/gtk2_ardour/automation_streamview.h @@ -50,7 +50,7 @@ class AutomationStreamView : public StreamView void redisplay_track (); inline double contents_height() const { - return (_trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); + return (_trackview.current_height() - 2); } bool has_automation () const; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 928801d0b2..7c167b493b 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -2878,7 +2878,7 @@ Editor::update_join_object_range_location (double /*x*/, double y) double cy = y; rtv->canvas_display()->canvas_to_item (cx, cy); - double const c = cy / (rtv->view()->child_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE); + double const c = cy / (rtv->view()->child_height() ); _join_object_range_state = c <= 0.5 ? JOIN_OBJECT_RANGE_RANGE : JOIN_OBJECT_RANGE_OBJECT; } diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h index b3506d4224..59a26c0c6e 100644 --- a/gtk2_ardour/midi_streamview.h +++ b/gtk2_ardour/midi_streamview.h @@ -82,7 +82,7 @@ class MidiStreamView : public StreamView void leave_internal_edit_mode (); inline double contents_height() const - { return (child_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); } + { return (child_height() - 2); } inline double note_to_y(uint8_t note) const { return contents_height() diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index 127ce79b84..cfc8525a9e 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -681,7 +681,7 @@ RegionView::region_sync_changed () sync_mark->set (points); sync_mark->show (); - sync_line->set (ArdourCanvas::Duple (offset, 0), ArdourCanvas::Duple (offset, trackview.current_height() - NAME_HIGHLIGHT_SIZE)); + sync_line->set (ArdourCanvas::Duple (offset, 0), ArdourCanvas::Duple (offset, trackview.current_height() )); sync_line->show (); } } @@ -749,7 +749,7 @@ RegionView::set_height (double h) sync_line->set ( ArdourCanvas::Duple (offset, 0), - ArdourCanvas::Duple (offset, h - NAME_HIGHLIGHT_SIZE) + ArdourCanvas::Duple (offset, h ) ); } diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 404b934562..fb05004499 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -411,17 +411,12 @@ StreamView::update_rec_box () case NonLayered: case Normal: - rect.length = at - rect.start; - xstart = _trackview.editor().sample_to_pixel (rect.start); - xend = _trackview.editor().sample_to_pixel (at); - break; - case Destructive: - rect.length = 2; - xstart = _trackview.editor().sample_to_pixel (_trackview.track()->current_capture_start()); - xend = _trackview.editor().sample_to_pixel (at); - break; - + rect.length = at - rect.start; + xstart = _trackview.editor().sample_to_pixel (rect.start); + xend = _trackview.editor().sample_to_pixel (at); + break; + default: fatal << string_compose (_("programming error: %1"), "illegal track mode") << endmsg; /*NOTREACHED*/ diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 33a517ca17..9661d19431 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -60,35 +60,40 @@ using namespace ARDOUR; using namespace Gtkmm2ext; Pango::FontDescription TimeAxisViewItem::NAME_FONT; -const double TimeAxisViewItem::NAME_X_OFFSET = 15.0; -const double TimeAxisViewItem::GRAB_HANDLE_TOP = 0.0; +const double TimeAxisViewItem::NAME_HIGHLIGHT_Y_IDENT = 3.0; +const double TimeAxisViewItem::NAME_HIGHLIGHT_X_OFFSET = 10.0; +const double TimeAxisViewItem::NAME_HIGHLIGHT_Y_OFFSET = 5.0; +const double TimeAxisViewItem::GRAB_HANDLE_TOP = 2.0; const double TimeAxisViewItem::GRAB_HANDLE_WIDTH = 10.0; const double TimeAxisViewItem::RIGHT_EDGE_SHIFT = 1.0; +const double TimeAxisViewItem::REGION_TOP_OFFSET = 2.0; +const double TimeAxisViewItem::REGION_BOTTOM_OFFSET = 3.0; + int TimeAxisViewItem::NAME_HEIGHT; +double TimeAxisViewItem::NAME_HIGHLIGHT_X_IDENT; double TimeAxisViewItem::NAME_Y_OFFSET; -double TimeAxisViewItem::NAME_HIGHLIGHT_SIZE; +double TimeAxisViewItem::NAME_HIGHLIGHT_HEIGHT; double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH; void TimeAxisViewItem::set_constant_heights () { - NAME_FONT = get_font_for_style (X_("TimeAxisViewItemName")); + NAME_FONT = get_font_for_style (X_("TimeAxisViewItemName")); - Gtk::Window win; - Gtk::Label foo; - win.add (foo); + Gtk::Window win; + Gtk::Label foo; + win.add (foo); - Glib::RefPtr layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */ - int width = 0; - int height = 0; + int width = 0; + int height = 0; - layout->set_font_description (NAME_FONT); - get_pixel_size (layout, width, height); + Glib::RefPtr layout = foo.create_pango_layout (X_("H")); /* just the ascender */ + layout->set_font_description (NAME_FONT); + get_pixel_size (layout, width, height); - layout = foo.create_pango_layout (X_("H")); /* just the ascender */ - - NAME_HEIGHT = height; + NAME_HEIGHT = height + 2; + NAME_HIGHLIGHT_X_IDENT = width + 2; /* Config->get_show_name_highlight) == true: Y_OFFSET is measured from bottom of the time axis view item. @@ -96,14 +101,8 @@ TimeAxisViewItem::set_constant_heights () Y_OFFSET is measured from the top of the time axis view item. */ - if (Config->get_show_name_highlight()) { - NAME_Y_OFFSET = height + 1; - NAME_HIGHLIGHT_SIZE = height + 2; - } else { - NAME_Y_OFFSET = 3; - NAME_HIGHLIGHT_SIZE = 0; - } - NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3; + NAME_HIGHLIGHT_HEIGHT = NAME_HEIGHT + NAME_HIGHLIGHT_Y_IDENT*2; + NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_HEIGHT * 1.5; } /** @@ -178,7 +177,6 @@ TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, Gdk::Color cons frame_position = start; item_duration = duration; name_connected = false; - fill_opacity = 60; position_locked = false; max_item_duration = ARDOUR::max_framepos; min_item_duration = 0; @@ -195,7 +193,7 @@ TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, Gdk::Color cons warning << "Time Axis Item Duration == 0" << endl; } - vestigial_frame = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, 1.0, 2.0, trackview.current_height())); + vestigial_frame = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, 2.0, 2.0 + REGION_TOP_OFFSET, trackview.current_height() - REGION_BOTTOM_OFFSET)); CANVAS_DEBUG_NAME (vestigial_frame, string_compose ("vestigial frame for %1", get_item_name())); vestigial_frame->hide (); vestigial_frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_VestigialFrame()); @@ -203,67 +201,60 @@ TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, Gdk::Color cons if (visibility & ShowFrame) { frame = new ArdourCanvas::Rectangle (group, - ArdourCanvas::Rect (0.0, 0.0, + ArdourCanvas::Rect (0.0, REGION_TOP_OFFSET, trackview.editor().sample_to_pixel(duration) + RIGHT_EDGE_SHIFT, - trackview.current_height() - 1.0)); + trackview.current_height() - REGION_BOTTOM_OFFSET)); CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name())); - if (Config->get_show_name_highlight()) { - frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT)); - } else { - frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM)); - } + if (_recregion) { + frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT| + ArdourCanvas::Rectangle::BOTTOM| + ArdourCanvas::Rectangle::TOP)); + } else { + frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT| + ArdourCanvas::Rectangle::RIGHT| + ArdourCanvas::Rectangle::BOTTOM| + ArdourCanvas::Rectangle::TOP)); + } - if (_recregion) { - frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RecordingRect()); - } else { - frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame()); - } + //ArdourCanvas::Color ouline_color = ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame(); + + // GZ FIXME:change in config instead of following + ArdourCanvas::Color outline_color = ArdourCanvas::rgba_to_color (104, 104, 104, 0.6); + frame->set_outline_color (outline_color ); } else { frame = 0; } - if (Config->get_show_name_highlight() && (visibility & ShowNameHighlight)) { - + { // always show name highlight double width; - double start; - if (visibility & FullWidthNameHighlight) { - start = 0.0; - width = trackview.editor().sample_to_pixel(item_duration) + RIGHT_EDGE_SHIFT; - } else { - start = 1.0; - width = trackview.editor().sample_to_pixel(item_duration) - 2.0 + RIGHT_EDGE_SHIFT; - } + width = trackview.editor().sample_to_pixel(item_duration) - 2.0 + RIGHT_EDGE_SHIFT; name_highlight = new ArdourCanvas::Rectangle (group, - ArdourCanvas::Rect (start, - trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, - width - 2.0 + RIGHT_EDGE_SHIFT, - trackview.current_height())); + ArdourCanvas::Rect (NAME_HIGHLIGHT_X_OFFSET, + NAME_HIGHLIGHT_Y_OFFSET, + NAME_HIGHLIGHT_X_OFFSET + 2*NAME_HIGHLIGHT_X_IDENT, + NAME_HIGHLIGHT_HEIGHT) ); CANVAS_DEBUG_NAME (name_highlight, string_compose ("name highlight for %1", get_item_name())); name_highlight->set_data ("timeaxisviewitem", this); - name_highlight->set_outline_what (ArdourCanvas::Rectangle::TOP); + name_highlight->set_outline_what (ArdourCanvas::Rectangle::What (0) ); name_highlight->set_outline_color (RGBA_TO_UINT (0,0,0,255)); - - } else { - name_highlight = 0; } - - if (visibility & ShowNameText) { + + { name_text = new ArdourCanvas::Text (group); CANVAS_DEBUG_NAME (name_text, string_compose ("name text for %1", get_item_name())); - if (Config->get_show_name_highlight()) { - name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, trackview.current_height() - NAME_Y_OFFSET)); - } else { - name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, NAME_Y_OFFSET)); - } - name_text->set_font_description (NAME_FONT); - } else { - name_text = 0; + name_text->set_position (ArdourCanvas::Duple (NAME_HIGHLIGHT_X_OFFSET + NAME_HIGHLIGHT_X_IDENT, NAME_HIGHLIGHT_Y_OFFSET + NAME_HIGHLIGHT_Y_IDENT) ); + name_text->set(""); + name_text->set_font_description (NAME_FONT); + + if (name_text->text().empty() ) { + name_highlight->hide(); + } } /* create our grab handles used for trimming/duration etc */ @@ -271,13 +262,13 @@ TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, Gdk::Color cons double top = TimeAxisViewItem::GRAB_HANDLE_TOP; double width = TimeAxisViewItem::GRAB_HANDLE_WIDTH; - frame_handle_start = new ArdourCanvas::DragHandle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()), true); + frame_handle_start = new ArdourCanvas::DragHandle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height() - REGION_BOTTOM_OFFSET), true); CANVAS_DEBUG_NAME (frame_handle_start, "TAVI frame handle start"); frame_handle_start->set_outline (false); frame_handle_start->set_fill (false); frame_handle_start->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_start)); - frame_handle_end = new ArdourCanvas::DragHandle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()), false); + frame_handle_end = new ArdourCanvas::DragHandle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height() - REGION_BOTTOM_OFFSET), false); CANVAS_DEBUG_NAME (frame_handle_end, "TAVI frame handle end"); frame_handle_end->set_outline (false); frame_handle_end->set_fill (false); @@ -325,8 +316,8 @@ TimeAxisViewItem::show_rect () set_frame_color (); if (name_highlight) { - name_highlight->set_outline_what (ArdourCanvas::Rectangle::TOP); - name_highlight->set_fill_color (fill_color); + name_highlight->set_outline_what (ArdourCanvas::Rectangle::What (0)); + name_highlight->set_fill_color (name_highlight_color); } } @@ -572,9 +563,8 @@ TimeAxisViewItem::set_name_text(const string& new_name) return; } - name_text_width = pixel_width (new_name, NAME_FONT) + 2; + name_text_width = pixel_width (new_name, NAME_FONT); name_text->set (new_name); - } /** @@ -589,23 +579,15 @@ TimeAxisViewItem::set_height (double height) manage_name_highlight (); - if (visibility & ShowNameText) { - if (Config->get_show_name_highlight()) { - name_text->set_y_position (height - NAME_Y_OFFSET); - } else { - name_text->set_y_position (NAME_Y_OFFSET); - } - } - if (frame) { - frame->set_y1 (height); + frame->set_y1 (height - REGION_BOTTOM_OFFSET); if (frame_handle_start) { - frame_handle_start->set_y1 (height); - frame_handle_end->set_y1 (height); + frame_handle_start->set_y1 (height - REGION_BOTTOM_OFFSET); + frame_handle_end->set_y1 (height - REGION_BOTTOM_OFFSET); } } - vestigial_frame->set_y1 (height - 1.0); + vestigial_frame->set_y1 (height - REGION_BOTTOM_OFFSET - 1.0); set_colors (); } @@ -613,7 +595,7 @@ TimeAxisViewItem::set_height (double height) void TimeAxisViewItem::manage_name_highlight () { - if (!name_highlight) { + if (!name_highlight) { return; } @@ -623,22 +605,29 @@ TimeAxisViewItem::manage_name_highlight () high_enough_for_name = true; } - if (_width < 2.0) { - wide_enough_for_name = false; + double highlite_y1 = name_text_width + 2*NAME_HIGHLIGHT_X_IDENT + NAME_HIGHLIGHT_X_OFFSET; + if (_width < highlite_y1) { + highlite_y1 = _width; + } + + if (highlite_y1 < NAME_HIGHLIGHT_X_OFFSET) { + wide_enough_for_name = false; } else { wide_enough_for_name = true; } - - if (name_highlight && wide_enough_for_name && high_enough_for_name) { - - name_highlight->show(); - name_highlight->set (ArdourCanvas::Rect (0.0, (double) _height - NAME_HIGHLIGHT_SIZE, _width+RIGHT_EDGE_SHIFT, (double) _height - 1.0)); + + if (wide_enough_for_name && high_enough_for_name && !name_text->text().empty() ) { + name_highlight->set (ArdourCanvas::Rect (NAME_HIGHLIGHT_X_OFFSET, + NAME_HIGHLIGHT_Y_OFFSET, + highlite_y1, + NAME_HIGHLIGHT_HEIGHT) ); + name_highlight->show(); } else { name_highlight->hide(); } - - manage_name_text (); + + manage_name_text (); } void @@ -684,6 +673,10 @@ TimeAxisViewItem::compute_colors (Gdk::Color const & base_color) g = base_color.get_green()/256; b = base_color.get_blue()/256; fill_color = RGBA_TO_UINT(r,g,b,160); + + // place to config + uint32_t opacity = 255*0.5; //50% + name_highlight_color = RGBA_TO_UINT(0, 0, 0, opacity); } /** @@ -695,7 +688,7 @@ TimeAxisViewItem::set_colors() set_frame_color(); if (name_highlight) { - name_highlight->set_fill_color (fill_color); + name_highlight->set_fill_color (name_highlight_color); } if (name_text) { @@ -721,13 +714,7 @@ TimeAxisViewItem::set_colors() (max (g, black_g) - min (g, black_g)) + (max (b, black_b) - min (b, black_b)); - if (white_contrast > black_contrast) { - /* use white */ - name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0)); - } else { - /* use black */ - name_text->set_color (ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0)); - } + name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0)); #if 0 double h, s, v; @@ -767,15 +754,13 @@ TimeAxisViewItem::get_fill_color () const } else { if (_recregion) { - f = ARDOUR_UI::config()->get_canvasvar_RecordingRect(); + //f = ARDOUR_UI::config()->get_canvasvar_RecordingRect(); + // GZ FIXME:change in config instead of following + f = ArdourCanvas::rgba_to_color (251.0/255.0, 35.0/255.0, 52.0/255.0, 1.0); } else { - if (high_enough_for_name && !ARDOUR_UI::config()->get_color_regions_using_track_color()) { - f = ARDOUR_UI::config()->get_canvasvar_FrameBase(); - } else { - f = fill_color; - f = UINT_RGBA_CHANGE_A (f, (ARDOUR_UI::config()->get_canvasvar_FrameBase() & 0x000000ff)); - } + f = fill_color; + f = UINT_RGBA_CHANGE_A (f, (ARDOUR_UI::config()->get_canvasvar_FrameBase() & 0x000000ff)); } } @@ -795,59 +780,50 @@ TimeAxisViewItem::set_frame_color() } f = get_fill_color (); - - if (fill_opacity) { - f = UINT_RGBA_CHANGE_A (f, (ARDOUR_UI::config()->get_canvasvar_FrameBase() & 0x000000ff)); - } if (!rect_visible) { f = UINT_RGBA_CHANGE_A (f, 0); } - frame->set_fill_color (f); + frame->set_fill_color (f); set_frame_gradient (); - if (!_recregion) { - if (_selected) { - f = ARDOUR_UI::config()->get_canvasvar_SelectedTimeAxisFrame(); - } else { - f = ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame(); - } + //f = ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame(); - if (!rect_visible) { - f = UINT_RGBA_CHANGE_A (f, 64); - } + // GZ FIXME:change in config instead of following + f = ArdourCanvas::rgba_to_color (104.0/255.0, 104.0/255.0, 104.0/255.0, 1.0); - frame->set_outline_color (f); - } + if (!rect_visible) { + f = UINT_RGBA_CHANGE_A (f, 64); + } + + frame->set_outline_color (f); } void TimeAxisViewItem::set_frame_gradient () { - if (ARDOUR_UI::config()->get_timeline_item_gradient_depth() == 0.0) { - frame->set_gradient (ArdourCanvas::Fill::StopList (), 0); - return; - } - ArdourCanvas::Fill::StopList stops; double r, g, b, a; double h, s, v; - ArdourCanvas::Color f (get_fill_color()); - + ArdourCanvas::Color fill_color (get_fill_color() ); + /* need to get alpha value */ - ArdourCanvas::color_to_rgba (f, r, g, b, a); - - /* now a darker version */ + ArdourCanvas::color_to_rgba (fill_color, r, g, b, a); + + /* set base apacity 90% */ + ArdourCanvas::Color base = ArdourCanvas::rgba_to_color (r, g, b, 0.95); + /* set middle apacity 80%*/ + ArdourCanvas::Color middle = ArdourCanvas::rgba_to_color (r, g, b, 0.8); + /* set top color as white with 75% apacity*/ + ArdourCanvas::Color top = ArdourCanvas::rgba_to_color (r, g, b, 0.65); - ArdourCanvas::color_to_hsv (f, h, s, v); - - v = min (1.0, v * (1.0 + ARDOUR_UI::config()->get_timeline_item_gradient_depth())); - - ArdourCanvas::Color lighter = ArdourCanvas::hsv_to_color (h, s, v, a); - stops.push_back (std::make_pair (0.0, lighter)); - stops.push_back (std::make_pair (0.37, f)); - stops.push_back (std::make_pair (1.0, f)); + /*set base color starting from the beginning*/ + stops.push_back (std::make_pair (0.0, top)); + /*set middle color starting from 70% of height*/ + stops.push_back (std::make_pair (0.7, middle)); + /*set middle color starting from on top*/ + stops.push_back (std::make_pair (1.0, base)); frame->set_gradient (stops, true); } @@ -993,8 +969,8 @@ TimeAxisViewItem::manage_name_text () visible_name_width = name_text_width; - if (visible_name_width > _width - NAME_X_OFFSET) { - visible_name_width = _width - NAME_X_OFFSET; + if (visible_name_width > _width - NAME_HIGHLIGHT_X_OFFSET - NAME_HIGHLIGHT_X_IDENT) { + visible_name_width = _width - NAME_HIGHLIGHT_X_OFFSET - NAME_HIGHLIGHT_X_IDENT; } if (visible_name_width < 1) { diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index 0345cb1a30..0740cc2cec 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -102,16 +102,23 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList // Default sizes, font and spacing static Pango::FontDescription NAME_FONT; static void set_constant_heights (); - static const double NAME_X_OFFSET; + static const double NAME_HIGHLIGHT_Y_IDENT; + static const double NAME_HIGHLIGHT_X_OFFSET; + static const double NAME_HIGHLIGHT_Y_OFFSET; static const double GRAB_HANDLE_TOP; static const double GRAB_HANDLE_WIDTH; + static const double REGION_TOP_OFFSET; + static const double REGION_BOTTOM_OFFSET; + /* these are not constant, but vary with the pixel size of the font used to display the item name. */ static int NAME_HEIGHT; + static double NAME_HIGHLIGHT_X_IDENT; + static double NAME_X_OFFSET; static double NAME_Y_OFFSET; - static double NAME_HIGHLIGHT_SIZE; + static double NAME_HIGHLIGHT_HEIGHT; static double NAME_HIGHLIGHT_THRESH; /* if this is 1.0, we move the right boundary @@ -231,6 +238,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList uint32_t fill_opacity; uint32_t fill_color; + uint32_t name_highlight_color; uint32_t frame_color_r; uint32_t frame_color_g; uint32_t frame_color_b; diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index aaf73edad6..821942e99a 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -22,7 +22,7 @@ UI_CONFIG_VARIABLE(bool, flat_buttons, "flat-buttons", false) UI_CONFIG_VARIABLE(float, waveform_gradient_depth, "waveform-gradient-depth", 0.6) UI_CONFIG_VARIABLE(float, timeline_item_gradient_depth, "timeline-item-gradient-depth", 1.3) UI_CONFIG_VARIABLE(bool, all_floating_windows_are_dialogs, "all-floating-windows-are-dialogs", false) -UI_CONFIG_VARIABLE (bool, color_regions_using_track_color, "color-regions-using-track-color", false) +UI_CONFIG_VARIABLE (bool, color_regions_using_track_color, "color-regions-using-track-color", true) UI_CONFIG_VARIABLE (bool, show_waveform_clipping, "show-waveform-clipping", true) UI_CONFIG_VARIABLE (int, auto_lock_timer, "auto-lock-timer", 0) UI_CONFIG_VARIABLE (int, auto_save_timer, "auto-save-timer", 0) From 6009b609f6495917903eec726afc29eb9c47af2e Mon Sep 17 00:00:00 2001 From: GZharun Date: Thu, 28 Aug 2014 10:47:01 +0300 Subject: [PATCH 3/7] [Summary] Simplified device information retrieving. Previous complicity was related to previous workflow which has nothing to do with current workflow. --- .../devicemanager/WCMRCoreAudioDeviceManager.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp index b0266d78a2..50e9839e3b 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp @@ -2562,7 +2562,7 @@ WTErr WCMRCoreAudioDeviceManager::getDeviceMaxInputChannels(DeviceID deviceId, u OSStatus err = kAudioHardwareNoError; UInt32 propSize = 0; inputChannels = 0; - + // 1. Get property cannels input size. err = AudioDeviceGetPropertyInfo (deviceId, 0, 1/* Input */, kAudioDevicePropertyStreamConfiguration, &propSize, NULL); if (err == kAudioHardwareNoError) @@ -2618,7 +2618,7 @@ WTErr WCMRCoreAudioDeviceManager::getDeviceMaxOutputChannels(DeviceID deviceId, OSStatus err = kAudioHardwareNoError; UInt32 propSize = 0; outputChannels = 0; - + //! 1. Get property cannels output size. err = AudioDeviceGetPropertyInfo (deviceId, 0, 0/* Output */, kAudioDevicePropertyStreamConfiguration, &propSize, NULL); if (err == kAudioHardwareNoError) @@ -2900,6 +2900,11 @@ WTErr WCMRCoreAudioDeviceManager::getDeviceSampleRatesImpl(const std::string & d return retVal; } + if (m_CurrentDevice && m_CurrentDevice->DeviceName () == deviceName) { + sampleRates.assign(m_CurrentDevice->SamplingRates().begin(), m_CurrentDevice->SamplingRates().end() ); + return retVal; + } + DeviceInfo devInfo; retVal = GetDeviceInfoByName(deviceName, devInfo); @@ -2973,6 +2978,11 @@ WTErr WCMRCoreAudioDeviceManager::getDeviceBufferSizesImpl(const std::string & d return retVal; } + if (m_CurrentDevice && m_CurrentDevice->DeviceName () == deviceName) { + bufferSizes.assign(m_CurrentDevice->BufferSizes().begin(), m_CurrentDevice->BufferSizes().end() ); + return retVal; + } + DeviceInfo devInfo; retVal = GetDeviceInfoByName(deviceName, devInfo); From 97cadeae33f21d6ca34f02d44a589e531dba961a Mon Sep 17 00:00:00 2001 From: nikolay Date: Thu, 28 Aug 2014 16:43:12 +0300 Subject: [PATCH 4/7] [Summary] Start recording on record button press [Reviewed] GZharun --- gtk2_ardour/ardour_ui.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index decbe8dc9d..1f36954922 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1870,14 +1870,13 @@ ARDOUR_UI::transport_record (bool roll) msg.run (); return; } - if (Profile->get_trx()) { - roll = trx_record_enable_all_tracks (); - } + + if ( Profile->get_trx() ) + roll = trx_record_enable_all_tracks (); + + transport_roll (); _session->maybe_enable_record (); - if (roll) { - transport_roll (); - } - break; + break; case Session::Recording: if (roll) { _session->request_stop(); From 267a628b9619d0482384730deae850ee377ae87d Mon Sep 17 00:00:00 2001 From: nikolay Date: Thu, 28 Aug 2014 16:45:54 +0300 Subject: [PATCH 5/7] [Summary] Delete old INFO panel upon the TOP BAR [Reviewed] GZharun --- gtk2_ardour/ardour_ui.cc | 218 +------------------------------ gtk2_ardour/ardour_ui.h | 28 ---- gtk2_ardour/ardour_ui2.cc | 65 +-------- gtk2_ardour/ardour_ui_dialogs.cc | 2 - gtk2_ardour/ardour_ui_ed.cc | 43 +----- gtk2_ardour/ardour_ui_options.cc | 6 - gtk2_ardour/editor.cc | 9 -- gtk2_ardour/editor.h | 17 --- gtk2_ardour/public_editor.h | 9 -- 9 files changed, 5 insertions(+), 392 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 1f36954922..27a18227a2 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -205,8 +205,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) , big_clock_window (X_("big-clock"), _("Big Clock"), boost::bind (&ARDOUR_UI::create_big_clock_window, this)) , audio_port_matrix (X_("audio-connection-manager"), _("Audio Connections"), boost::bind (&ARDOUR_UI::create_global_port_matrix, this, ARDOUR::DataType::AUDIO)) , midi_port_matrix (X_("midi-connection-manager"), _("MIDI Connections"), boost::bind (&ARDOUR_UI::create_global_port_matrix, this, ARDOUR::DataType::MIDI)) - , error_log_button (_("Errors")) - , _status_bar_visibility (X_("status-bar")) , _feedback_exists (false) , _dsp_load_adjustment (0) , _hd_load_adjustment (0) @@ -394,8 +392,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) _process_thread = new ProcessThread (); _process_thread->init (); - DPIReset.connect (sigc::mem_fun (*this, &ARDOUR_UI::resize_text_widgets)); - // start the engine: // initialize engin state controller EngineStateController::instance(); @@ -442,8 +438,6 @@ ARDOUR_UI::engine_running () update_disk_space (); update_disk_usage (); update_cpu_load (); - update_sample_rate (EngineStateController::instance()->get_current_sample_rate() ); - update_timecode_format (); } void @@ -462,8 +456,6 @@ ARDOUR_UI::engine_halted (const char* reason, bool free_reason) ActionManager::set_sensitive (ActionManager::engine_sensitive_actions, false); ActionManager::set_sensitive (ActionManager::engine_opposite_sensitive_actions, true); - update_sample_rate (0); - string msgstr; /* if the reason is a non-empty string, it means that the backend was shutdown @@ -501,7 +493,6 @@ ARDOUR_UI::post_engine () /* connect to important signals */ AudioEngine::instance()->Stopped.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::engine_stopped, this), gui_context()); - AudioEngine::instance()->SampleRateChanged.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::update_sample_rate, this, _1), gui_context()); AudioEngine::instance()->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false)); _tooltips.enable(); @@ -509,12 +500,6 @@ ARDOUR_UI::post_engine () if (setup_windows ()) { throw failed_constructor (); } - - /* Do this after setup_windows (), as that's when the _status_bar_visibility is created */ - XMLNode* n = Config->extra_xml (X_("UI")); - if (n) { - _status_bar_visibility.set_state (*n); - } check_memory_locking(); @@ -558,14 +543,6 @@ ARDOUR_UI::post_engine () secondary_clock->set_mode (AudioClock::BBT); } - /* start the time-of-day-clock */ - -#ifndef GTKOSX - /* OS X provides a nearly-always visible wallclock, so don't be stupid */ - update_wall_clock (); - Glib::signal_timeout().connect_seconds (sigc::mem_fun(*this, &ARDOUR_UI::update_wall_clock), 1); -#endif - Config->ParameterChanged.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::parameter_changed, this, _1), gui_context()); boost::function pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1)); Config->map_parameters (pc); @@ -885,7 +862,6 @@ ARDOUR_UI::starting () /* We have to do this here since goto_editor_window() ends up calling show_all() on the * editor window, and we may want stuff to be hidden. */ - _status_bar_visibility.update (); BootMessage (string_compose (_("%1 is ready for use"), PROGRAM_NAME)); return 0; @@ -1093,10 +1069,8 @@ gint ARDOUR_UI::every_second () { update_cpu_load (); - update_buffer_load (); update_disk_space (); update_disk_usage (); - update_timecode_format (); if (nsm && nsm->is_active ()) { nsm->check (); @@ -1139,142 +1113,17 @@ ARDOUR_UI::every_point_zero_something_seconds () return TRUE; } -void -ARDOUR_UI::update_sample_rate (framecnt_t) -{ - char buf[64]; - - ENSURE_GUI_THREAD (*this, &ARDOUR_UI::update_sample_rate, ignored) - - if (!AudioEngine::instance()->connected()) { - - snprintf (buf, sizeof (buf), _("Audio: none")); - - } else { - - framecnt_t rate = EngineStateController::instance()->get_current_sample_rate(); - - if (rate == 0) { - /* no sample rate available */ - snprintf (buf, sizeof (buf), _("Audio: none")); - } else { - - if (fmod (rate, 1000.0) != 0.0) { - snprintf (buf, sizeof (buf), _("Audio: %.1f kHz / %4.1f ms"), - (float) rate / 1000.0f, - (AudioEngine::instance()->usecs_per_cycle() / 1000.0f)); - } else { - snprintf (buf, sizeof (buf), _("Audio: %" PRId64 " kHz / %4.1f ms"), - rate/1000, - (AudioEngine::instance()->usecs_per_cycle() / 1000.0f)); - } - } - } - sample_rate_label.set_markup (buf); -} - -void -ARDOUR_UI::update_format () -{ - if (!_session) { - format_label.set_text (""); - return; - } - - stringstream s; - s << _("File:") << X_(" "); - - switch (_session->config.get_native_file_header_format ()) { - case BWF: - s << _("BWF"); - break; - case WAVE: - s << _("WAV"); - break; - case WAVE64: - s << _("WAV64"); - break; - case CAF: - s << _("CAF"); - break; - case AIFF: - s << _("AIFF"); - break; - case iXML: - s << _("iXML"); - break; - case RF64: - s << _("RF64"); - break; - } - - s << " "; - - switch (_session->config.get_native_file_data_format ()) { - case FormatFloat: - s << _("32-float"); - break; - case FormatInt24: - s << _("24-int"); - break; - case FormatInt16: - s << _("16-int"); - break; - } - - s << X_(""); - - format_label.set_markup (s.str ()); -} - void ARDOUR_UI::update_cpu_load () { - char buf[64]; - - /* If this text is changed, the set_size_request_to_display_given_text call in ARDOUR_UI::resize_text_widgets - should also be changed. - */ - float const c = AudioEngine::instance()->get_dsp_load (); - snprintf (buf, sizeof (buf), _("DSP: %5.1f%%"), c >= 90 ? X_("red") : X_("green"), c); - cpu_load_label.set_markup (buf); - _dsp_load_adjustment->set_value (c); - + _dsp_load_adjustment->set_value (c); + stringstream ss; ss << (int)c; _dsp_load_label->set_text ( ss.str() + "%" ); } -void -ARDOUR_UI::update_buffer_load () -{ - char buf[256]; - - uint32_t const playback = _session ? _session->playback_load () : 100; - uint32_t const capture = _session ? _session->capture_load () : 100; - - /* If this text is changed, the set_size_request_to_display_given_text call in ARDOUR_UI::resize_text_widgets - should also be changed. - */ - - if (_session) { - snprintf ( - buf, sizeof (buf), - _("Buffers: p:%" PRIu32 "%% " - "c:%" PRIu32 "%%"), - playback <= 5 ? X_("red") : X_("green"), - playback, - capture <= 5 ? X_("red") : X_("green"), - capture - ); - - buffer_load_label.set_markup (buf); - } else { - buffer_load_label.set_text (""); - } -} - void ARDOUR_UI::count_recenabled_streams (Route& route) { @@ -1294,7 +1143,6 @@ ARDOUR_UI::update_disk_space() } boost::optional opt_frames = _session->available_capture_duration(); - char buf[64]; framecnt_t fr = _session->frame_rate(); if (fr == 0) { @@ -1304,10 +1152,8 @@ ARDOUR_UI::update_disk_space() if (!opt_frames) { /* Available space is unknown */ - snprintf (buf, sizeof (buf), "%s", _("Disk: Unknown")); result = "Unknown"; } else if (opt_frames.get_value_or (0) == max_framecnt) { - snprintf (buf, sizeof (buf), "%s", _("Disk: 24hrs+")); result = "24hrs+"; } else { rec_enabled_streams = 0; @@ -1328,22 +1174,12 @@ ARDOUR_UI::update_disk_space() hrs = frames / (fr * 3600); if (hrs > 24) { - snprintf (buf, sizeof (buf), "%s", _("Disk: >24 hrs")); result =">24hrs"; } else { frames -= hrs * fr * 3600; mins = frames / (fr * 60); frames -= mins * fr * 60; secs = frames / fr; - - bool const low = (hrs == 0 && mins <= 30); - - snprintf ( - buf, sizeof(buf), - _("Disk: %02dh:%02dm:%02ds"), - low ? X_("red") : X_("green"), - hrs, mins, secs - ); stringstream ss; ss << hrs << "h " << mins << "m "; @@ -1351,7 +1187,6 @@ ARDOUR_UI::update_disk_space() } } - disk_space_label.set_markup (buf); _hd_remained_time_label->set_text(result); } @@ -1369,51 +1204,6 @@ ARDOUR_UI::update_disk_usage () _hd_load_label->set_text ( ss.str() + "%" ); } -void -ARDOUR_UI::update_timecode_format () -{ - char buf[64]; - - if (_session) { - bool matching; - TimecodeSlave* tcslave; - SyncSource sync_src = Config->get_sync_source(); - - if ((sync_src == LTC || sync_src == MTC) && (tcslave = dynamic_cast(_session->slave())) != 0) { - matching = (tcslave->apparent_timecode_format() == _session->config.get_timecode_format()); - } else { - matching = true; - } - - snprintf (buf, sizeof (buf), S_("Timecode|TC: %s"), - matching ? X_("green") : X_("red"), - Timecode::timecode_format_name (_session->config.get_timecode_format()).c_str()); - } else { - snprintf (buf, sizeof (buf), "TC: n/a"); - } - - timecode_format_label.set_markup (buf); -} - -gint -ARDOUR_UI::update_wall_clock () -{ - time_t now; - struct tm *tm_now; - static int last_min = -1; - - time (&now); - tm_now = localtime (&now); - if (last_min != tm_now->tm_min) { - char buf[16]; - sprintf (buf, "%02d:%02d", tm_now->tm_hour, tm_now->tm_min); - wall_clock_label.set_text (buf); - last_min = tm_now->tm_min; - } - - return TRUE; -} - void ARDOUR_UI::redisplay_recent_sessions () { @@ -4266,8 +4056,7 @@ ARDOUR_UI::disconnect_from_engine () } else { AudioEngine::instance()->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false)); } - - update_sample_rate (0); + return 0; } @@ -4285,7 +4074,6 @@ ARDOUR_UI::reconnect_to_engine () return -1; } - update_sample_rate (0); return 0; } diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 3c2233b025..067ec08038 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -551,28 +551,10 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void use_menubar_as_top_menubar (); void build_menu_bar (); - Gtk::Label wall_clock_label; - gint update_wall_clock (); - - Gtk::Label disk_space_label; void update_disk_space (); void update_disk_usage (); - Gtk::Label timecode_format_label; - - Gtk::Label cpu_load_label; void update_cpu_load (); - - Gtk::Label buffer_load_label; - void update_buffer_load (); - - Gtk::Label sample_rate_label; - void update_sample_rate (ARDOUR::framecnt_t); - - Gtk::Label format_label; - void update_format (); - - void update_timecode_format (); gint every_second (); gint every_point_one_seconds (); @@ -743,13 +725,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr bool check_audioengine(); void audioengine_setup (); - void display_message (const char *prefix, gint prefix_len, - Glib::RefPtr ptag, Glib::RefPtr mtag, - const char *msg); - Gtk::Label status_bar_label; - bool status_bar_button_press (GdkEventButton*); - Gtk::ToggleButton error_log_button; - void loading_message (const std::string& msg); PBD::ScopedConnectionList forever_connections; @@ -771,7 +746,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr bool click_button_clicked (GdkEventButton *); - VisibilityGroup _status_bar_visibility; Gtk::Adjustment* _dsp_load_adjustment; Gtk::Adjustment* _hd_load_adjustment; Gtk::Label* _dsp_load_label; @@ -791,8 +765,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void successful_graph_sort (); bool _feedback_exists; - void resize_text_widgets (); - std::string _announce_string; void check_announcements (); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index fe755c524d..e7cd9ae9f9 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -87,27 +87,7 @@ ARDOUR_UI::setup_windows () we_have_dependents (); -#ifdef TOP_MENUBAR - HBox* status_bar_packer = manage (new HBox); - EventBox* status_bar_event_box = manage (new EventBox); - - status_bar_event_box->add (status_bar_label); - status_bar_event_box->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); - status_bar_label.set_size_request (300, -1); - status_bar_packer->pack_start (*status_bar_event_box, true, true, 6); - status_bar_packer->pack_start (error_log_button, false, false); - - status_bar_label.show (); - status_bar_event_box->show (); - status_bar_packer->show (); - error_log_button.show (); - - error_log_button.signal_clicked().connect (mem_fun (*this, &UI::toggle_errors)); - status_bar_event_box->signal_button_press_event().connect (mem_fun (*this, &ARDOUR_UI::status_bar_button_press)); - - editor->get_status_bar_packer().pack_start (*status_bar_packer, true, true); - editor->get_status_bar_packer().pack_start (menu_bar_base, false, false, 6); -#else +#ifndef TOP_MENUBAR editor->get_h_box ("menu_bar_base").pack_start (menu_bar_base, false, false); #endif if (ARDOUR::Profile->get_trx()) { @@ -154,49 +134,6 @@ ARDOUR_UI::setup_tooltips () editor->setup_tooltips (); } -bool -ARDOUR_UI::status_bar_button_press (GdkEventButton* ev) -{ - bool handled = false; - - switch (ev->button) { - case 1: - status_bar_label.set_text (""); - handled = true; - break; - default: - break; - } - - return handled; -} - -void -ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr ptag, RefPtr mtag, const char *msg) -{ - string text; - - UI::display_message (prefix, prefix_len, ptag, mtag, msg); -#ifdef TOP_MENUBAR - - if (strcmp (prefix, _("[ERROR]: ")) == 0) { - text = ""; - } else if (strcmp (prefix, _("[WARNING]: ")) == 0) { - text = ""; - } else if (strcmp (prefix, _("[INFO]: ")) == 0) { - text = ""; - } else { - text = "???"; - } - - text += prefix; - text += ""; - text += msg; - - status_bar_label.set_markup (text); -#endif -} - XMLNode* ARDOUR_UI::tearoff_settings (const char* name) const { diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 2564639a25..bcba4994b4 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -304,8 +304,6 @@ ARDOUR_UI::unload_session (bool hide_stuff) session_loaded = false; - update_buffer_load (); - return 0; } diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 36208c2c19..429f42c2c5 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -529,21 +529,6 @@ ARDOUR_UI::build_menu_bar () ev->add (*vbox); - wall_clock_label.set_name ("WallClock"); - wall_clock_label.set_use_markup (); - disk_space_label.set_name ("WallClock"); - disk_space_label.set_use_markup (); - timecode_format_label.set_name ("WallClock"); - timecode_format_label.set_use_markup (); - cpu_load_label.set_name ("CPULoad"); - cpu_load_label.set_use_markup (); - buffer_load_label.set_name ("BufferLoad"); - buffer_load_label.set_use_markup (); - sample_rate_label.set_name ("SampleRate"); - sample_rate_label.set_use_markup (); - format_label.set_name ("Format"); - format_label.set_use_markup (); - #ifndef TOP_MENUBAR menu_hbox.pack_start (*menu_bar, false, false); #else @@ -561,28 +546,10 @@ ARDOUR_UI::build_menu_bar () disk_space = true; } - hbox->pack_end (wall_clock_label, false, false, 2); - hbox->pack_end (disk_space_label, false, false, 4); - hbox->pack_end (cpu_load_label, false, false, 4); - hbox->pack_end (buffer_load_label, false, false, 4); - hbox->pack_end (sample_rate_label, false, false, 4); - hbox->pack_end (timecode_format_label, false, false, 4); - hbox->pack_end (format_label, false, false, 4); - menu_hbox.pack_end (*ev, false, false, 6); menu_bar_base.set_name ("MainMenuBar"); menu_bar_base.add (menu_hbox); - - _status_bar_visibility.add (&wall_clock_label, X_("WallClock"), _("Wall Clock"), wall_clock); - _status_bar_visibility.add (&disk_space_label, X_("Disk"), _("Disk Space"), disk_space); - _status_bar_visibility.add (&cpu_load_label, X_("DSP"), _("DSP"), true); - _status_bar_visibility.add (&buffer_load_label, X_("Buffers"), _("Buffers"), true); - _status_bar_visibility.add (&sample_rate_label, X_("Audio"), _("Audio"), true); - _status_bar_visibility.add (&timecode_format_label, X_("TCFormat"), _("Timecode Format"), true); - _status_bar_visibility.add (&format_label, X_("Format"), _("File Format"), true); - - ev->signal_button_press_event().connect (sigc::mem_fun (_status_bar_visibility, &VisibilityGroup::button_press_event)); } void @@ -633,8 +600,7 @@ ARDOUR_UI::save_ardour_state () Config->add_extra_xml (get_transport_controllable_state()); XMLNode* window_node = new XMLNode (X_("UI")); - window_node->add_property (_status_bar_visibility.get_state_name().c_str(), _status_bar_visibility.get_state_value ()); - + /* Windows */ WM::Manager::instance().add_state (*window_node); @@ -687,13 +653,6 @@ ARDOUR_UI::save_ardour_state () Keyboard::save_keybindings (); } -void -ARDOUR_UI::resize_text_widgets () -{ - set_size_request_to_display_given_text (cpu_load_label, "DSP: 100.0%", 2, 2); - set_size_request_to_display_given_text (buffer_load_label, "Buffers: p:100% c:100%", 2, 2); -} - void ARDOUR_UI::focus_on_clock () { diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 160dc360c9..8324f58d9c 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -420,16 +420,10 @@ ARDOUR_UI::session_parameter_changed (const std::string& param) { if ( param == "native-file-data-format" ) { - update_format(); update_bit_depth_button (); } - else if (param == "native-file-header-format") - { - update_format(); - } else if ( param == "timecode-format" ) { - update_timecode_format(); update_frame_rate_button (); } } diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 98d94afbee..b359e8bb88 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -272,15 +272,6 @@ Editor::Editor () , edit_controls_vbox (get_v_box ("edit_controls_vbox")) , controls_layout (get_layout ("controls_layout")) , time_bars_vbox (get_v_box ("time_bars_vbox")) -#ifdef TOP_MENUBAR - /* - * This is needed for OS X primarily - * but also any other OS that uses a single - * top menubar instead of per window menus - */ - , _status_bar_hpacker (get_h_box ("menu_bar_base")) -#endif - /* the values here don't matter: layout widgets reset them as needed. */ diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 861dcaf74d..435dbb520b 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -281,14 +281,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void export_region (); void add_toplevel_controls (Gtk::Container&); -#ifdef TOP_MENUBAR - /* - * This is needed for OS X primarily - * but also any other OS that uses a single - * top menubar instead of per window menus - */ - Gtk::HBox& get_status_bar_packer() { return _status_bar_hpacker; } -#endif void set_zoom_focus (Editing::ZoomFocus); Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; } @@ -1989,15 +1981,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void history_changed (); -#ifdef TOP_MENUBAR - /* - * This is needed for OS X primarily - * but also any other OS that uses a single - * top menubar instead of per window menus - */ - Gtk::HBox& _status_bar_hpacker; -#endif - Editing::EditPoint _edit_point; Gtk::ComboBoxText edit_point_selector; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 3792e42021..4d32beb4af 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -356,15 +356,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi static const int vertical_spacing; static const int horizontal_spacing; -#ifdef TOP_MENUBAR - /* - * This is needed for OS X primarily - * but also any other OS that uses a single - * top menubar instead of per window menus - */ - virtual Gtk::HBox& get_status_bar_packer() = 0; -#endif - virtual ArdourCanvas::Group* get_trackview_group () const = 0; virtual ArdourCanvas::Group* get_time_bars_group () const = 0; virtual ArdourCanvas::Group* get_track_canvas_group () const = 0; From 055a8417874346ed344dce59cd6bbbdaabfb04a7 Mon Sep 17 00:00:00 2001 From: nikolay Date: Thu, 28 Aug 2014 16:46:59 +0300 Subject: [PATCH 6/7] [Summary] Enable change track name when track is not recording [Reviewed] GZharun --- gtk2_ardour/route_time_axis.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 6ff4c21be1..f3ffbd7485 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1925,7 +1925,7 @@ RouteTimeAxisView::can_edit_name () const { /* we do not allow track name changes if it is record enabled */ - return !_route->record_enabled(); + return !( (ARDOUR_UI::instance()->the_session()->record_status()==Session::Recording) && (_route->record_enabled()) ); } void From b40a491a9aed81db99996241d38e840714b87a14 Mon Sep 17 00:00:00 2001 From: nikolay Date: Thu, 28 Aug 2014 16:47:34 +0300 Subject: [PATCH 7/7] [Summary] Change text color in Mixer Strip [Reviewed] GZharun --- gtk2_ardour/ui/mixer_strip.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gtk2_ardour/ui/mixer_strip.xml b/gtk2_ardour/ui/mixer_strip.xml index d24eee28fb..e1b9982af6 100644 --- a/gtk2_ardour/ui/mixer_strip.xml +++ b/gtk2_ardour/ui/mixer_strip.xml @@ -58,6 +58,8 @@