diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index b094d84049..a7f5ab2395 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -208,8 +208,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) @@ -399,8 +397,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(); @@ -447,8 +443,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 @@ -467,8 +461,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 @@ -506,7 +498,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(); @@ -514,12 +505,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(); @@ -563,14 +548,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); @@ -892,7 +869,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; @@ -1100,10 +1076,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 (); @@ -1146,142 +1120,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) { @@ -1301,7 +1150,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) { @@ -1311,10 +1159,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; @@ -1335,22 +1181,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 "; @@ -1358,7 +1194,6 @@ ARDOUR_UI::update_disk_space() } } - disk_space_label.set_markup (buf); _hd_remained_time_label->set_text(result); } @@ -1376,51 +1211,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 () { @@ -1878,14 +1668,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(); @@ -4278,8 +4067,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; } @@ -4297,7 +4085,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 40147535fe..57c1148832 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -553,28 +553,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 (); @@ -754,13 +736,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; @@ -782,7 +757,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; @@ -802,8 +776,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 56f76e2c95..3f03e5f704 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -88,27 +88,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()) { @@ -155,49 +135,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 b41acab714..a4f7e3c092 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -300,8 +300,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 3f11f85091..4eeae318b1 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -575,21 +575,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 @@ -607,28 +592,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 @@ -679,8 +646,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); @@ -733,13 +699,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 135d41fe13..1848928475 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -427,16 +427,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/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index fb98d4c5ae..e08713e31b 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -425,12 +425,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 (); @@ -483,7 +483,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); @@ -500,7 +500,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 (); @@ -514,7 +514,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)); @@ -584,7 +584,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; } @@ -669,7 +669,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; } @@ -1126,11 +1126,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; @@ -1230,7 +1226,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 */ @@ -1518,7 +1514,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 (); @@ -1545,7 +1541,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 bc5052c390..7a16e3b044 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" @@ -269,25 +270,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 2da15c17c5..e20bd7b856 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -88,7 +88,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 ()); @@ -118,7 +118,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); @@ -147,7 +147,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 */ @@ -184,7 +184,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.cc b/gtk2_ardour/editor.cc index 14eb15329a..db98d0b4a8 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -279,14 +279,6 @@ Editor::Editor () , edit_packer (get_table ("edit_packer")) , edit_controls_vbox (get_v_box ("edit_controls_vbox")) , controls_layout (get_layout ("controls_layout")) -#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. @@ -4960,8 +4952,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 (); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 01e12a7667..69e5202ee8 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -284,14 +284,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; } @@ -2007,15 +1999,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; ArdourDropdown edit_point_selector; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index a88c8c4a9f..425bcb0dc0 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -2626,12 +2626,7 @@ Editor::update_join_object_range_location (double y) entered_route_view->canvas_display()->canvas_to_item (cx, cy); - double track_height = entered_route_view->view()->child_height(); - if (Config->get_show_name_highlight()) { - track_height -= TimeAxisViewItem::NAME_HIGHLIGHT_SIZE; - } - double const c = cy / track_height; - + double const c = cy / (entered_route_view->view()->child_height() ); if (c <= 0.5) { _join_object_range_state = JOIN_OBJECT_RANGE_RANGE; diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h index 9dbfbae5ea..8a53d83629 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/public_editor.h b/gtk2_ardour/public_editor.h index 1e8102a266..24e3c42bdc 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -367,15 +367,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::Container* get_trackview_group () const = 0; virtual ArdourCanvas::ScrollGroup* get_hscroll_group () const = 0; virtual ArdourCanvas::ScrollGroup* get_vscroll_group () const = 0; diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index d45164ee42..302f358c65 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -675,7 +675,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 (); } } @@ -748,7 +748,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/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 280d51b0a8..ae93aef350 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -2273,7 +2273,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 diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 9eecc80dd7..fb01010ce8 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -418,17 +418,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 cc4f517810..b038db1300 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -60,50 +60,49 @@ using namespace ARDOUR_UI_UTILS; 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 = Pango::FontDescription (ARDOUR_UI::config()->get_canvasvar_SmallFont()); - + 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; - + + 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. Config->get_show_name_highlight) == false: 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; } /** @@ -188,7 +187,7 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co 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()); @@ -196,82 +195,75 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co 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); - name_text->set_ignore_events (true); - } 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 */ if (!_recregion && !_automation) { double top = TimeAxisViewItem::GRAB_HANDLE_TOP; double width = TimeAxisViewItem::GRAB_HANDLE_WIDTH; - frame_handle_start = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height())); + frame_handle_start = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height() - REGION_BOTTOM_OFFSET)); 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::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height())); + frame_handle_end = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height() - REGION_BOTTOM_OFFSET)); + CANVAS_DEBUG_NAME (frame_handle_end, "TAVI frame handle end"); frame_handle_end->set_outline (false); frame_handle_end->set_fill (false); @@ -319,8 +311,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); } } @@ -567,9 +559,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); - } /** @@ -584,23 +575,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 (); } @@ -608,7 +591,7 @@ TimeAxisViewItem::set_height (double height) void TimeAxisViewItem::manage_name_highlight () { - if (!name_highlight) { + if (!name_highlight) { return; } @@ -618,22 +601,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 @@ -670,7 +660,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); } set_name_text_color (); @@ -745,14 +735,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 ((!Config->get_show_name_highlight() || 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 = fill_color; + f = UINT_RGBA_CHANGE_A (f, (ARDOUR_UI::config()->get_canvasvar_FrameBase() & 0x000000ff)); + } } return UINT_RGBA_CHANGE_A (f, o); @@ -768,54 +757,51 @@ TimeAxisViewItem::set_frame_color() return; } - frame->set_fill_color (get_fill_color()); - + uint32_t f = get_fill_color (); + + if (!rect_visible) { + f = UINT_RGBA_CHANGE_A (f, 0); + } + + frame->set_fill_color (f); set_frame_gradient (); - - if (!_recregion) { - uint32_t f; - - if (_selected) { - f = ARDOUR_UI::config()->get_canvasvar_SelectedTimeAxisFrame(); - } else { - f = ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame(); - } - - if (!rect_visible) { - /* make the frame outline be visible but rather transparent */ - f = UINT_RGBA_CHANGE_A (f, 64); - } - - frame->set_outline_color (f); + + //f = ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame(); + + // 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); + + 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); } @@ -962,8 +948,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 e78b9c9488..47b934ff4e 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -104,16 +104,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 @@ -230,10 +237,24 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList /** true if a small vestigial rect should be shown when the item gets very narrow */ bool show_vestigial; - uint32_t fill_color; - virtual uint32_t fill_opacity() const; + uint32_t fill_color; + uint32_t name_highlight_color; + uint32_t frame_color_r; + uint32_t frame_color_g; + uint32_t frame_color_b; + uint32_t selected_frame_color_r; + uint32_t selected_frame_color_g; + uint32_t selected_frame_color_b; + + uint32_t handle_color_r; + uint32_t handle_color_g; + uint32_t handle_color_b; + uint32_t lock_handle_color_r; + uint32_t lock_handle_color_g; + uint32_t lock_handle_color_b; + uint32_t last_item_width; int name_text_width; bool wide_enough_for_name; 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 @@