diff options
author | David Robillard <d@drobilla.net> | 2006-08-31 02:28:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-08-31 02:28:42 +0000 |
commit | 5169a66f35508dfeee8e5f9486788843d229295a (patch) | |
tree | 626276bd0ef3336664f8133ef2d0e3b0a92e7e9e /gtk2_ardour | |
parent | 5a401620266dd832b120235c8e956a86d1f800cd (diff) |
Merged with trunk R874.
Commented out some overly verbose debug prints
git-svn-id: svn://localhost/ardour2/branches/midi@875 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 179 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/audio_clock.h | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 48 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 6 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/editor_hscroller.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/editor_tempodisplay.cc | 50 | ||||
-rw-r--r-- | gtk2_ardour/gain_meter.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/main.cc | 38 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 31 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/new_session_dialog.cc | 28 | ||||
-rw-r--r-- | gtk2_ardour/new_session_dialog.h | 6 |
15 files changed, 226 insertions, 200 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index d0b9136bcb..dae6c9f751 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -137,8 +137,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile) theArdourUI = this; } - ActionManager::init (); - /* load colors */ color_manager = new ColorManager(); @@ -147,7 +145,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile) color_manager->load (color_file); - m_new_session_dialog = new NewSessionDialog(); editor = 0; mixer = 0; session = 0; @@ -206,6 +203,9 @@ ARDOUR_UI::set_engine (AudioEngine& e) engine->Halted.connect (mem_fun(*this, &ARDOUR_UI::engine_halted)); engine->SampleRateChanged.connect (mem_fun(*this, &ARDOUR_UI::update_sample_rate)); + ActionManager::init (); + new_session_dialog = new NewSessionDialog(); + _tooltips.enable(); keyboard = new Keyboard; @@ -1410,7 +1410,7 @@ ARDOUR_UI::start_blinking () if (blink_timeout_tag < 0) { blink_on = false; - blink_timeout_tag = gtk_timeout_add (240, _blink, this); + blink_timeout_tag = g_timeout_add (240, _blink, this); } } @@ -1418,7 +1418,7 @@ void ARDOUR_UI::stop_blinking () { if (blink_timeout_tag >= 0) { - gtk_timeout_remove (blink_timeout_tag); + g_source_remove (blink_timeout_tag); blink_timeout_tag = -1; } } @@ -1651,100 +1651,105 @@ ARDOUR_UI::save_template () void ARDOUR_UI::new_session (bool startup, std::string predetermined_path) { - m_new_session_dialog->show(); - m_new_session_dialog->set_modal(true); - m_new_session_dialog->set_name(predetermined_path); - m_new_session_dialog->reset_recent(); + int response = Gtk::RESPONSE_NONE; - int response = Gtk::RESPONSE_CANCEL; + new_session_dialog->set_modal(true); + new_session_dialog->set_name(predetermined_path); + new_session_dialog->reset_recent(); + new_session_dialog->show(); + + //Glib::RefPtr<Gdk::Window> nsd_window = new_session_dialog->get_window(); do { - response = m_new_session_dialog->run (); + response = new_session_dialog->run (); + //nsd_window ->set_cursor(Gdk::Cursor(Gdk::WATCH)); if(response == Gtk::RESPONSE_CANCEL || response == Gtk::RESPONSE_DELETE_EVENT) { - quit(); - return; + quit(); + return; } else if (response == Gtk::RESPONSE_NONE) { - /* Clear was pressed */ - m_new_session_dialog->reset(); + /* Clear was pressed */ + new_session_dialog->reset(); } else if (response == Gtk::RESPONSE_YES) { - /* YES == OPEN, but there's no enum for that */ - std::string session_name = m_new_session_dialog->session_name(); - std::string session_path = m_new_session_dialog->session_folder(); - load_session (session_path, session_name); + /* YES == OPEN, but there's no enum for that */ - - } else if (response == Gtk::RESPONSE_OK) { - if (m_new_session_dialog->get_current_page() == 1) { - - /* XXX this is a bit of a hack.. - i really want the new sesion dialog to return RESPONSE_YES - if we're on page 1 (the load page) - Unfortunately i can't see how atm.. - */ - std::string session_name = m_new_session_dialog->session_name(); - std::string session_path = m_new_session_dialog->session_folder(); + std::string session_name = new_session_dialog->session_name(); + std::string session_path = new_session_dialog->session_folder(); load_session (session_path, session_name); - } else { + + } else if (response == Gtk::RESPONSE_OK) { + if (new_session_dialog->get_current_page() == 1) { + + /* XXX this is a bit of a hack.. + i really want the new sesion dialog to return RESPONSE_YES + if we're on page 1 (the load page) + Unfortunately i can't see how atm.. + */ + + std::string session_name = new_session_dialog->session_name(); + std::string session_path = new_session_dialog->session_folder(); + load_session (session_path, session_name); + + } else { - _session_is_new = true; + _session_is_new = true; + + std::string session_name = new_session_dialog->session_name(); + std::string session_path = new_session_dialog->session_folder(); - std::string session_name = m_new_session_dialog->session_name(); - std::string session_path = m_new_session_dialog->session_folder(); - - //XXX This is needed because session constructor wants a - //non-existant path. hopefully this will be fixed at some point. + //XXX This is needed because session constructor wants a + //non-existant path. hopefully this will be fixed at some point. - session_path = Glib::build_filename(session_path, session_name); + session_path = Glib::build_filename(session_path, session_name); - std::string template_name = m_new_session_dialog->session_template_name(); + std::string template_name = new_session_dialog->session_template_name(); - if (m_new_session_dialog->use_session_template()) { - - load_session (session_path, session_name, &template_name); - - } else { - - uint32_t cchns; - uint32_t mchns; - Session::AutoConnectOption iconnect; - Session::AutoConnectOption oconnect; - - if (m_new_session_dialog->create_control_bus()) { - cchns = (uint32_t) m_new_session_dialog->control_channel_count(); + if (new_session_dialog->use_session_template()) { + + load_session (session_path, session_name, &template_name); + } else { - cchns = 0; - } - if (m_new_session_dialog->create_master_bus()) { - mchns = (uint32_t) m_new_session_dialog->master_channel_count(); - } else { - mchns = 0; - } + uint32_t cchns; + uint32_t mchns; + Session::AutoConnectOption iconnect; + Session::AutoConnectOption oconnect; - if (m_new_session_dialog->connect_inputs()) { - iconnect = Session::AutoConnectPhysical; - } else { - iconnect = Session::AutoConnectOption (0); - } + if (new_session_dialog->create_control_bus()) { + cchns = (uint32_t) new_session_dialog->control_channel_count(); + } else { + cchns = 0; + } - /// @todo some minor tweaks. - - if (m_new_session_dialog->connect_outs_to_master()) { - oconnect = Session::AutoConnectMaster; - } else if (m_new_session_dialog->connect_outs_to_physical()) { - oconnect = Session::AutoConnectPhysical; - } else { - oconnect = Session::AutoConnectOption (0); - } + if (new_session_dialog->create_master_bus()) { + mchns = (uint32_t) new_session_dialog->master_channel_count(); + } else { + mchns = 0; + } + + if (new_session_dialog->connect_inputs()) { + iconnect = Session::AutoConnectPhysical; + } else { + iconnect = Session::AutoConnectOption (0); + } + + /// @todo some minor tweaks. - uint32_t nphysin = (uint32_t) m_new_session_dialog->input_limit_count(); - uint32_t nphysout = (uint32_t) m_new_session_dialog->output_limit_count(); + if (new_session_dialog->connect_outs_to_master()) { + oconnect = Session::AutoConnectMaster; + } else if (new_session_dialog->connect_outs_to_physical()) { + oconnect = Session::AutoConnectPhysical; + } else { + oconnect = Session::AutoConnectOption (0); + } - build_session (session_path, + uint32_t nphysin = (uint32_t) new_session_dialog->input_limit_count(); + uint32_t nphysout = (uint32_t) new_session_dialog->output_limit_count(); + + build_session (session_path, session_name, cchns, mchns, @@ -1753,14 +1758,15 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path) nphysin, nphysout, engine->frame_rate() * 60 * 5); - } - } + } + } } } while (response == Gtk::RESPONSE_NONE); - m_new_session_dialog->hide(); show(); - + new_session_dialog->get_window()->set_cursor(); + + new_session_dialog->hide(); } void @@ -1806,9 +1812,6 @@ This prevents the session from being loaded.")); connect_to_session (new_session); - //if (engine->running()) { - //mixer->show_window(); - //} session_loaded = true; return 0; } @@ -1861,9 +1864,6 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name, connect_to_session (new_session); - //if (engine->running()) { - //mixer->show_window(); - //} session_loaded = true; return 0; } @@ -1875,10 +1875,6 @@ ARDOUR_UI::show () editor->show_window (); shown_flag = true; } - - if (session && mixer) { - // mixer->show_window (); - } if (about) { about->present (); @@ -1898,7 +1894,8 @@ void ARDOUR_UI::hide_splash () { if (about) { - // about->hide(); + about->get_window()->set_cursor (); + about->hide(); } } diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 821899c3af..d0e90c42be 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -530,7 +530,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI bool _will_create_new_session_automatically; - NewSessionDialog* m_new_session_dialog; + NewSessionDialog* new_session_dialog; void open_session (); void open_recent_session (); diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h index 9ff5f45ddf..4bcf13e1de 100644 --- a/gtk2_ardour/audio_clock.h +++ b/gtk2_ardour/audio_clock.h @@ -133,10 +133,10 @@ class AudioClock : public Gtk::HBox jack_nframes_t last_when; - long last_hrs; - long last_mins; - long last_secs; - long last_frames; + uint32_t last_hrs; + uint32_t last_mins; + uint32_t last_secs; + uint32_t last_frames; bool last_negative; long ms_last_hrs; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index da248c828c..933db72bab 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -271,7 +271,6 @@ Editor::Editor (AudioEngine& eng) first_action_message = 0; export_dialog = 0; show_gain_after_trim = false; - no_zoom_repos_update = false; ignore_route_list_reorder = false; no_route_list_redisplay = false; verbose_cursor_on = true; @@ -284,7 +283,6 @@ Editor::Editor (AudioEngine& eng) _xfade_visibility = true; editor_ruler_menu = 0; no_ruler_shown_update = false; - edit_hscroll_dragging = false; edit_group_list_menu = 0; route_list_menu = 0; region_list_menu = 0; @@ -832,16 +830,6 @@ Editor::set_frames_per_unit (double fpu) zoom_range_clock.set (frames); } - /* only update these if we not about to call reposition_x_origin, - which will do the same updates. - */ - - if (!no_zoom_repos_update) { - horizontal_adjustment.set_value (leftmost_frame/frames_per_unit); - update_fixed_rulers (); - tempo_map_changed (Change (0)); - } - if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) { if (!selection->tracks.empty()) { for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { @@ -909,7 +897,7 @@ Editor::edit_cursor_clock_changed() void Editor::zoom_adjustment_changed () { - if (session == 0 || no_zoom_repos_update) { + if (session == 0) { return; } @@ -976,40 +964,39 @@ Editor::deferred_control_scroll (jack_nframes_t target) void Editor::canvas_horizontally_scrolled () { + + Glib::signal_idle().connect (mem_fun(*this, &Editor::lazy_canvas_horizontally_scrolled)); + +} + +bool +Editor::lazy_canvas_horizontally_scrolled () +{ + leftmost_frame = (jack_nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit); update_fixed_rulers (); - - if (!edit_hscroll_dragging) { - tempo_map_changed (Change (0)); - } else { - update_tempo_based_rulers(); - } + tempo_map_changed (Change (0)); + + return false; } void Editor::reposition_and_zoom (jack_nframes_t frame, double nfpu) { if (!repos_zoom_queued) { - Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::deferred_reposition_and_zoom), frame, nfpu)); repos_zoom_queued = true; + Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::deferred_reposition_and_zoom), frame, nfpu)); } } gint Editor::deferred_reposition_and_zoom (jack_nframes_t frame, double nfpu) { - /* if we need to force an update to the hscroller stuff, - don't set no_zoom_repos_update. - */ - no_zoom_repos_update = (frame != leftmost_frame); - set_frames_per_unit (nfpu); - if (no_zoom_repos_update) { - reposition_x_origin (frame); - } - no_zoom_repos_update = false; + reposition_x_origin (frame); + repos_zoom_queued = false; return FALSE; @@ -1062,7 +1049,6 @@ void Editor::stop_scrolling () { scroll_connection.disconnect (); - slower_update_connection.disconnect (); } void @@ -1307,6 +1293,7 @@ Editor::connect_to_session (Session *t) restore_ruler_visibility (); tempo_map_changed (Change (0)); + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); edit_cursor->set_position (0); playhead_cursor->set_position (0); @@ -2244,6 +2231,7 @@ Editor::set_state (const XMLNode& node) } } + return 0; } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 34b3462228..239bd6307d 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -651,7 +651,6 @@ class Editor : public PublicEditor void controls_layout_size_request (Gtk::Requisition*); Gtk::HScrollbar edit_hscrollbar; - bool edit_hscroll_dragging; void reset_hscrollbar_stepping (); @@ -684,12 +683,11 @@ class Editor : public PublicEditor void tie_vertical_scrolling (); void canvas_horizontally_scrolled (); + bool lazy_canvas_horizontally_scrolled (); void reposition_and_zoom (jack_nframes_t sample, double fpu); gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu); void end_location_changed (ARDOUR::Location*); bool repos_zoom_queued; - bool no_zoom_repos_update; - bool no_tempo_map_update; struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { RegionListDisplayModelColumns() { @@ -808,8 +806,6 @@ class Editor : public PublicEditor void center_screen_internal (jack_nframes_t, float); void update_current_screen (); - sigc::connection slower_update_connection; - void update_slower (); gint show_track_context_menu (GdkEventButton *); void hide_track_context_menu (); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 34ea808821..d8eebf1c4b 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -92,6 +92,7 @@ Editor::initialize_canvas () /* don't try to center the canvas */ track_canvas.set_center_scroll_region (false); + track_canvas.set_dither (Gdk::RGB_DITHER_NONE); track_canvas.signal_event().connect (bind (mem_fun (*this, &Editor::track_canvas_event), (ArdourCanvas::Item*) 0)); track_canvas.set_name ("EditorMainCanvas"); @@ -133,6 +134,7 @@ Editor::initialize_canvas () time_canvas.add_events (Gdk::POINTER_MOTION_HINT_MASK); time_canvas.set_flags (CAN_FOCUS); time_canvas.set_center_scroll_region (false); + time_canvas.set_dither (Gdk::RGB_DITHER_NONE); meter_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, 0.0); tempo_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, timebar_height); @@ -591,7 +593,7 @@ Editor::autoscroll_canvas () /* connect the timeout so that we get called repeatedly */ - autoscroll_timeout_tag = gtk_timeout_add (20, _autoscroll_canvas, this); + autoscroll_timeout_tag = g_timeout_add (20, _autoscroll_canvas, this); keep_calling = false; } else if (autoscroll_cnt == 50) { /* 0.5 seconds */ @@ -637,7 +639,7 @@ void Editor::stop_canvas_autoscroll () { if (autoscroll_timeout_tag >= 0) { - gtk_timeout_remove (autoscroll_timeout_tag); + g_source_remove (autoscroll_timeout_tag); autoscroll_timeout_tag = -1; } } diff --git a/gtk2_ardour/editor_hscroller.cc b/gtk2_ardour/editor_hscroller.cc index 8504667daa..c95d923092 100644 --- a/gtk2_ardour/editor_hscroller.cc +++ b/gtk2_ardour/editor_hscroller.cc @@ -34,7 +34,6 @@ Editor::hscrollbar_allocate (Gtk::Allocation &alloc) bool Editor::hscrollbar_button_press (GdkEventButton *ev) { - edit_hscroll_dragging = true; return true; } @@ -42,11 +41,7 @@ bool Editor::hscrollbar_button_release (GdkEventButton *ev) { if (session) { - if (edit_hscroll_dragging) { - // lets do a tempo redisplay only on button release, because it is dog slow - tempo_map_changed (Change (0)); - edit_hscroll_dragging = false; - } + } return true; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 22eefabea8..7d262503f8 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -140,27 +140,27 @@ Editor::set_meter_falloff (int intval) Config->set_meter_falloff_off(true); break; case 1: - val = 0.266f; + val = 0.125f; Config->set_meter_falloff_slowest(true); break; case 2: - val = 0.342f; + val = 0.250f; Config->set_meter_falloff_slow(true); break; case 3: - val = 0.7f; + val = 0.375f; Config->set_meter_falloff_medium(true); break; case 4: - val = 1.1f; + val = 0.500f; Config->set_meter_falloff_fast(true); break; case 5: - val = 1.5f; + val = 0.750f; Config->set_meter_falloff_faster(true); break; case 6: - val = 2.5f; + val = 0.875f; Config->set_meter_falloff_fastest(true); break; } diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index e5b1a67cf3..55e406c4fc 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -69,10 +69,14 @@ Editor::remove_metric_marks () void Editor::draw_metric_marks (const Metrics& metrics) { + + const MeterSection *ms; + const TempoSection *ts; + char buf[64]; + + remove_metric_marks (); + for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) { - const MeterSection *ms; - const TempoSection *ts; - char buf[64]; if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) { snprintf (buf, sizeof(buf), "%g/%g", ms->beats_per_bar(), ms->note_divisor ()); @@ -85,12 +89,13 @@ Editor::draw_metric_marks (const Metrics& metrics) } } + } void Editor::tempo_map_changed (Change ignored) { - ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored)); + ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored)); if (current_bbt_points) { delete current_bbt_points; @@ -108,17 +113,13 @@ Editor::tempo_map_changed (Change ignored) void Editor::redisplay_tempo () -{ - update_tempo_based_rulers (); - - remove_metric_marks (); +{ hide_measures (); if (session && current_bbt_points) { - session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); draw_measures (); + update_tempo_based_rulers (); } - } void @@ -155,8 +156,8 @@ Editor::draw_measures () return; } - TempoMap::BBTPointList::iterator i; - TempoMap::BBTPointList *all_bbt_points; + TempoMap::BBTPointList::iterator i = current_bbt_points->begin(); + TempoMap::BBTPoint& p = (*i); ArdourCanvas::SimpleLine *line; gdouble xpos, last_xpos; uint32_t cnt; @@ -166,8 +167,6 @@ Editor::draw_measures () return; } - all_bbt_points = session->tempo_map().get_points (leftmost_frame, leftmost_frame + current_page_frames()); - cnt = 0; last_xpos = 0; @@ -176,7 +175,7 @@ Editor::draw_measures () gdouble last_beat = DBL_MAX; gdouble beat_spacing = 0; - for (i = all_bbt_points->begin(); i != all_bbt_points->end() && beat_spacing == 0; ++i) { + for (i = current_bbt_points->begin(); i != current_bbt_points->end() && beat_spacing == 0; ++i) { TempoMap::BBTPoint& p = (*i); switch (p.type) { @@ -194,11 +193,11 @@ Editor::draw_measures () double x1, x2, y1, y2; track_canvas.get_scroll_region (x1, y1, x2, y2); - y2 = 1000000000.0f; + //y2 = 1000000000.0f; - for (i = all_bbt_points->begin(); i != all_bbt_points->end(); ++i) { + for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) { - TempoMap::BBTPoint& p = (*i); + p = (*i); switch (p.type) { case TempoMap::Bar: @@ -236,8 +235,6 @@ Editor::draw_measures () } } - delete all_bbt_points; - /* the cursors are always on top of everything */ cursor_group->raise_to_top(); @@ -282,6 +279,8 @@ Editor::mouse_add_new_tempo_event (jack_nframes_t frame) commit_reversible_command (); map.dump (cerr); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); } void @@ -322,6 +321,8 @@ Editor::mouse_add_new_meter_event (jack_nframes_t frame) commit_reversible_command (); map.dump (cerr); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); } void @@ -372,6 +373,8 @@ Editor::edit_meter_section (MeterSection* section) XMLNode &after = session->tempo_map().get_state(); session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after)); commit_reversible_command (); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); } void @@ -402,6 +405,8 @@ Editor::edit_tempo_section (TempoSection* section) XMLNode &after = session->tempo_map().get_state(); session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after)); commit_reversible_command (); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); } void @@ -452,6 +457,8 @@ Editor::real_remove_tempo_marker (TempoSection *section) session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after)); commit_reversible_command (); + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); + return FALSE; } @@ -485,5 +492,8 @@ Editor::real_remove_meter_marker (MeterSection *section) XMLNode &after = session->tempo_map().get_state(); session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after)); commit_reversible_command (); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); + return FALSE; } diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 695a5d2be3..c0d7acc118 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -469,7 +469,7 @@ GainMeter::reset_peak_display () { max_peak = minus_infinity(); peak_display_label.set_text (_("-Inf")); - peak_display.set_name ("Mixerstrippeakdisplay"); + peak_display.set_name ("MixerStripPeakDisplay"); } void diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 27dc573706..4beb771494 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -267,7 +267,7 @@ show_ui_callback (void *arg) void gui_jack_error () { - MessageDialog win (_("Ardour could not connect to JACK."), + MessageDialog win (_("Ardour could not connect to JACK."), false, Gtk::MESSAGE_INFO, (Gtk::ButtonsType)(Gtk::BUTTONS_NONE)); @@ -285,7 +285,11 @@ Please consider the possibilities, and perhaps (re)start JACK.")); win.show_all (); win.set_position (Gtk::WIN_POS_CENTER); - /* we just don't care about the result */ + if (!no_splash) { + ui->hide_splash (); + } + + /* we just don't care about the result, but we want to block */ win.run (); } @@ -325,7 +329,7 @@ To create it from the command line, start ardour as \"ardour --new %1"), path) < ui->load_session (path, name); } else { - /* TODO: This bit of code doesn't work properly yet + /* TODO: This bit of code doesn't work properly yet Glib::signal_idle().connect (bind (mem_fun (*ui, &ARDOUR_UI::cmdline_new_session), path)); ui->set_will_create_new_session_automatically (true); */ @@ -354,9 +358,6 @@ int main (int argc, char *argv[]) ARDOUR::AudioEngine *engine; vector<Glib::ustring> null_file_list; - // needs a better home. - Glib::thread_init(); - gtk_set_locale (); (void) bindtextdomain (PACKAGE, LOCALEDIR); @@ -410,11 +411,12 @@ int main (int argc, char *argv[]) << endl; } - try { - ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile()); - } + // needs a better home. + Glib::thread_init(); - catch (failed_constructor& err) { + try { + ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile()); + } catch (failed_constructor& err) { error << _("could not create ARDOUR GUI") << endmsg; exit (1); } @@ -423,23 +425,29 @@ int main (int argc, char *argv[]) if (!no_splash) { ui->show_splash (); if (session_name.length()) { - gtk_timeout_add (4000, show_ui_callback, ui); + g_timeout_add (4000, show_ui_callback, ui); } } - - try { + + + try { engine = new ARDOUR::AudioEngine (jack_client_name); - ARDOUR::init (*engine, use_vst, try_hw_optimization); - ui->set_engine (*engine); } catch (AudioEngine::NoBackendAvailable& err) { gui_jack_error (); error << string_compose (_("Could not connect to JACK server as \"%1\""), jack_client_name) << endmsg; return -1; + } + + + try { + ARDOUR::init (*engine, use_vst, try_hw_optimization); + ui->set_engine (*engine); } catch (failed_constructor& err) { error << _("could not initialize Ardour.") << endmsg; return -1; } + if (maybe_load_session ()) { ui->run (text_receiver); ui = 0; diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 9bc5f3d1a0..1ba1be445e 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -67,9 +67,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) mix_group_context_menu = 0; no_track_list_redisplay = false; in_group_row_change = false; - - XMLNode* node = ARDOUR_UI::instance()->mixer_settings(); - set_state (*node); + _visible = false; scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); scroller_base.set_name ("MixerWindow"); @@ -213,7 +211,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) add_accel_group (ActionManager::ui_manager->get_accel_group()); - signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), static_cast<Gtk::Window *>(this))); + signal_delete_event().connect (mem_fun (*this, &Mixer_UI::hide_window)); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK); _plugin_selector = new PluginSelector (PluginManager::the_manager()); @@ -248,8 +246,17 @@ Mixer_UI::show_window () ms = (*ri)[track_columns.strip]; ms->set_width (ms->get_width()); } + _visible = true; +} + +bool +Mixer_UI::hide_window (GdkEventAny *ev) +{ + _visible = false; + return just_hide_it(ev, static_cast<Gtk::Window *>(this)); } + void Mixer_UI::add_strip (Session::RouteList& routes) { @@ -345,8 +352,12 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) void Mixer_UI::connect_to_session (Session* sess) { + session = sess; + XMLNode* node = ARDOUR_UI::instance()->mixer_settings(); + set_state (*node); + string wintitle = _("ardour: mixer: "); wintitle += session->name(); set_title (wintitle); @@ -362,6 +373,10 @@ Mixer_UI::connect_to_session (Session* sess) _plugin_selector->set_session (session); + if (_visible) { + show_window(); + } + start_updating (); } @@ -1048,6 +1063,12 @@ Mixer_UI::set_state (const XMLNode& node) } } + if ((prop = node.property ("show-mixer"))) { + if (prop->value() == "yes") { + _visible = true; + } + } + return 0; } @@ -1089,6 +1110,8 @@ Mixer_UI::get_state (void) node->add_property ("narrow-strips", _strip_width == Narrow ? "yes" : "no"); + node->add_property ("show-mixer", _visible ? "yes" : "no"); + return *node; } diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 77021dc8fe..2a5b416ae0 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -73,6 +73,7 @@ class Mixer_UI : public Gtk::Window int set_state (const XMLNode& ); void show_window (); + bool hide_window (GdkEventAny *ev); void show_strip (MixerStrip *); void hide_strip (MixerStrip *); @@ -83,6 +84,8 @@ class Mixer_UI : public Gtk::Window private: ARDOUR::AudioEngine& engine; ARDOUR::Session *session; + + bool _visible; Gtk::HBox global_hpacker; Gtk::VBox global_vpacker; diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc index 993db62d59..462fb57711 100644 --- a/gtk2_ardour/new_session_dialog.cc +++ b/gtk2_ardour/new_session_dialog.cc @@ -31,6 +31,7 @@ #include <gtkmm/radiobutton.h> #include <gtkmm/filefilter.h> #include <gtkmm/stock.h> +#include <gdkmm/cursor.h> #include "opts.h" @@ -63,7 +64,7 @@ NewSessionDialog::NewSessionDialog() input_port_limit_hbox = Gtk::manage(new class Gtk::HBox(false, 0)); input_port_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); input_table = Gtk::manage(new class Gtk::Table(2, 2, false)); - input_port_alignment = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1)); + input_label = Gtk::manage(new class Gtk::Label(_("<b>Track/Bus Inputs</b>"))); input_frame = Gtk::manage(new class Gtk::Frame()); m_connect_outputs = Gtk::manage(new class Gtk::CheckButton(_("Automatically Connect Outputs"))); @@ -79,7 +80,7 @@ NewSessionDialog::NewSessionDialog() m_connect_outputs_to_physical = Gtk::manage(new class Gtk::RadioButton(_RadioBGroup_m_connect_outputs_to_master, _("Connect to Physical Outputs"))); output_conn_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); output_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); - output_port_alignment = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1)); + output_label = Gtk::manage(new class Gtk::Label(_("<b>Track/Bus Outputs</b>"))); output_frame = Gtk::manage(new class Gtk::Frame()); advanced_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); @@ -90,7 +91,7 @@ NewSessionDialog::NewSessionDialog() open_session_hbox = Gtk::manage(new class Gtk::HBox(false, 0)); m_treeview = Gtk::manage(new class Gtk::TreeView()); recent_scrolledwindow = Gtk::manage(new class Gtk::ScrolledWindow()); - recent_alignment = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1)); + recent_sesion_label = Gtk::manage(new class Gtk::Label(_("Open Recent Session"))); recent_frame = Gtk::manage(new class Gtk::Frame()); open_session_vbox = Gtk::manage(new class Gtk::VBox(false, 0)); @@ -167,7 +168,7 @@ NewSessionDialog::NewSessionDialog() input_table->set_row_spacings(0); input_table->set_col_spacings(0); input_table->attach(*input_port_vbox, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 6); - input_port_alignment->add(*input_table); + input_label->set_alignment(0, 0.5); input_label->set_padding(0,0); input_label->set_line_wrap(false); @@ -175,7 +176,7 @@ NewSessionDialog::NewSessionDialog() input_label->set_use_markup(true); input_frame->set_shadow_type(Gtk::SHADOW_NONE); input_frame->set_label_align(0,0.5); - input_frame->add(*input_port_alignment); + input_frame->add(*input_table); input_frame->set_label_widget(*input_label); m_connect_outputs->set_flags(Gtk::CAN_FOCUS); m_connect_outputs->set_relief(Gtk::RELIEF_NORMAL); @@ -212,7 +213,7 @@ NewSessionDialog::NewSessionDialog() output_vbox->set_border_width(6); output_vbox->pack_start(*output_port_vbox); output_vbox->pack_start(*output_conn_vbox); - output_port_alignment->add(*output_vbox); + output_label->set_alignment(0, 0.5); output_label->set_padding(0,0); output_label->set_line_wrap(false); @@ -220,7 +221,7 @@ NewSessionDialog::NewSessionDialog() output_label->set_use_markup(true); output_frame->set_shadow_type(Gtk::SHADOW_NONE); output_frame->set_label_align(0,0.5); - output_frame->add(*output_port_alignment); + output_frame->add(*output_vbox); output_frame->set_label_widget(*output_label); advanced_vbox->pack_start(*advanced_table, Gtk::PACK_SHRINK, 0); advanced_vbox->pack_start(*input_frame, Gtk::PACK_SHRINK, 12); @@ -265,13 +266,13 @@ NewSessionDialog::NewSessionDialog() recent_scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); recent_scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT); recent_scrolledwindow->add(*m_treeview); - recent_alignment->add(*recent_scrolledwindow); + recent_sesion_label->set_padding(0,0); recent_sesion_label->set_line_wrap(false); recent_sesion_label->set_selectable(false); recent_frame->set_border_width(12); recent_frame->set_shadow_type(Gtk::SHADOW_IN); - recent_frame->add(*recent_alignment); + recent_frame->add(*recent_scrolledwindow); recent_frame->set_label_widget(*recent_sesion_label); open_session_vbox->pack_start(*open_session_hbox, Gtk::PACK_SHRINK, 12); open_session_vbox->pack_start(*recent_frame, Gtk::PACK_EXPAND_WIDGET, 0); @@ -573,10 +574,13 @@ NewSessionDialog::file_chosen () m_treeview->get_selection()->unselect_all(); + get_window()->set_cursor(Gdk::Cursor(Gdk::WATCH)); + if (!m_open_filechooser->get_filename().empty()) { - set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_OK, true); + response (Gtk::RESPONSE_OK); } else { - set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_OK, false); } } @@ -659,7 +663,7 @@ NewSessionDialog::reset_recent() RecentSessionsSorter cmp; recent_model->clear (); - + ARDOUR::RecentSessions rs; ARDOUR::read_recent_sessions (rs); diff --git a/gtk2_ardour/new_session_dialog.h b/gtk2_ardour/new_session_dialog.h index 5d652fd122..b175c1b79d 100644 --- a/gtk2_ardour/new_session_dialog.h +++ b/gtk2_ardour/new_session_dialog.h @@ -101,14 +101,14 @@ protected: Gtk::HBox * input_port_limit_hbox; Gtk::VBox * input_port_vbox; Gtk::Table * input_table; - Gtk::Alignment * input_port_alignment; + Gtk::Label * input_label; Gtk::Frame * input_frame; Gtk::HBox * output_port_limit_hbox; Gtk::VBox * output_port_vbox; Gtk::VBox * output_conn_vbox; Gtk::VBox * output_vbox; - Gtk::Alignment * output_port_alignment; + Gtk::Label * output_label; Gtk::Frame * output_frame; Gtk::VBox * advanced_vbox; @@ -117,7 +117,7 @@ protected: Gtk::Table * new_session_table; Gtk::HBox * open_session_hbox; Gtk::ScrolledWindow * recent_scrolledwindow; - Gtk::Alignment * recent_alignment; + Gtk::Label * recent_sesion_label; Gtk::Frame * recent_frame; Gtk::VBox * open_session_vbox; |