diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-06-10 20:37:22 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-06-10 20:37:22 +0000 |
commit | 730943d73014f34e443afe9f6f783135d896a931 (patch) | |
tree | 515306e68f59b8bf22c79bbfc7cf014df65d4ec1 /gtk2_ardour | |
parent | 776294d09655d9837f11961fec9859fd62ea3d87 (diff) |
(5) debugging with nowhiskey - remove stupid lack of scaling caused by redisplaying all regions for every source file removed; fix for illegal audio device selection in audio setup dialog; stuff related to drawing/dragging regionheights (disabled at present)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3458 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 135 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 11 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/editor_region_list.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/engine_dialog.cc | 50 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 12 |
8 files changed, 222 insertions, 17 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index a5e1f0b46a..8c9a965826 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2247,10 +2247,13 @@ ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be fontconfig_dialog(); if (!backend_audio_is_running) { - if (new_session_dialog->engine_control.setup_engine ()) { - new_session_dialog->hide (); + int ret = new_session_dialog->engine_control.setup_engine (); + if (ret < 0) { return false; - } + } else if (ret > 0) { + response = Gtk::RESPONSE_REJECT; + goto try_again; + } } if (create_engine ()) { @@ -2354,7 +2357,7 @@ ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be } } - } while (response == Gtk::RESPONSE_NONE); + } while (response == Gtk::RESPONSE_NONE || response == Gtk::RESPONSE_REJECT); done: show(); @@ -2745,8 +2748,11 @@ After cleanup, unused audio files will be moved to a \ } if (session->cleanup_sources (rep)) { + editor->finish_cleanup (); return; } + + editor->finish_cleanup (); checker.hide(); display_cleanup_results (rep, @@ -2760,8 +2766,6 @@ release an additional\n\ %4 %5bytes of disk space.\n" )); - - } void diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index b24f0fac5d..2e7a1c2515 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -340,6 +340,10 @@ Editor::Editor () rhythm_ferret = 0; allow_vertical_scroll = false; no_save_visual = false; + need_resize_line = false; + resize_line_y = 0; + old_resize_line_y = -1; + no_region_list_redisplay = false; _scrubbing = false; scrubbing_direction = 0; @@ -3775,6 +3779,15 @@ Editor::prepare_for_cleanup () selection->clear_regions (); selection->clear_playlists (); + + no_region_list_redisplay = true; +} + +void +Editor::finish_cleanup () +{ + no_region_list_redisplay = false; + redisplay_regions (); } Location* @@ -4660,3 +4673,125 @@ Editor::first_idle () _have_idled = true; } + +void +Editor::start_resize_line_ops () +{ + old_resize_line_y = -1; + resize_line_y = -1; + need_resize_line = true; +} + +void +Editor::end_resize_line_ops () +{ + need_resize_line = false; + + if (old_resize_line_y >= 0) { + Gdk::Rectangle r (0, old_resize_line_y, (int) canvas_width, 3); + Glib::RefPtr<Gdk::Window> win = get_window(); + cerr << "Final invalidation at " << old_resize_line_y << endl; + win->invalidate_rect (r, false); + } +} + +void +Editor::queue_draw_resize_line (int at) +{ + Glib::RefPtr<Gdk::Window> win = get_window(); + + resize_line_y = at; + + if (win && canvas_width) { + + int controls_width = controls_layout.get_width(); + + if (old_resize_line_y >= 0) { + + /* redraw where it used to be */ + + int xroot, discard; + + controls_layout.get_window()->get_origin (xroot, discard); + + Gdk::Rectangle r (xroot, old_resize_line_y - 1, controls_width + (int) canvas_width, 3); + win->invalidate_rect (r, true); + cerr << "invalidate " << xroot << ", " << old_resize_line_y - 1 << ' ' + << controls_width + canvas_width << " x 3\n"; + } + + /* draw where it is */ + + Gdk::Rectangle r (0, at - 1, controls_width + (int) canvas_width, 3); + win->invalidate_rect (r, true); + } +} + +bool +Editor::on_expose_event (GdkEventExpose* ev) +{ +#if 0 + cerr << "+++ editor expose " + << ev->area.x << ',' << ev->area.y + << ' ' + << ev->area.width << " x " << ev->area.height + << endl; +#endif + bool ret = Window::on_expose_event (ev); + +#if 0 + if (need_resize_line) { + + int xroot, yroot, discard; + int controls_width; + int scrollbar_offset; + + /* Our root coordinates for drawing the line will be the left edge + of the track controls, and the upper left edge of our own window. + */ + + get_window()->get_origin (discard, yroot); + controls_layout.get_window()->get_origin (xroot, discard); + controls_width = controls_layout.get_width(); + + GdkRectangle lr; + GdkRectangle intersection; + + lr.x = 0; + lr.y = resize_line_y; + lr.width = (int) canvas_width; + lr.height = 3; + + if (gdk_rectangle_intersect (&lr, &ev->area, &intersection)) { + + Glib::RefPtr<Gtk::Style> style (get_style()); + Glib::RefPtr<Gdk::GC> black_gc (style->get_black_gc ()); + Glib::RefPtr<Gdk::GC> gc = wrap (black_gc->gobj_copy(), false); + + /* draw on root window */ + + GdkWindow* win = gdk_get_default_root_window(); + + gc->set_subwindow (Gdk::INCLUDE_INFERIORS); + gc->set_line_attributes (3, Gdk::LINE_SOLID, + Gdk::CAP_NOT_LAST, + Gdk::JOIN_MITER); + + gdk_draw_line (win, gc->gobj(), + xroot, + yroot + resize_line_y, + xroot + (int) canvas_width + controls_width, + yroot + resize_line_y); + cerr << "drew line @ " << xroot << ", " << yroot + resize_line_y + << " to " << xroot + (int) canvas_width + controls_width + << ", " << yroot + resize_line_y + << endl; + old_resize_line_y = yroot + resize_line_y; + cerr << "NEXT EXPOSE SHOULD BE AT " << old_resize_line_y << endl; + } + } + + cerr << "--- editor expose\n"; +#endif + return ret; +} diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 4b4f0fbda6..4b0faa0055 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -355,6 +355,7 @@ class Editor : public PublicEditor bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; } void prepare_for_cleanup (); + void finish_cleanup (); void maximise_editing_space(); void restore_editing_space(); @@ -375,11 +376,16 @@ class Editor : public PublicEditor void goto_visual_state (uint32_t); void save_visual_state (uint32_t); + void queue_draw_resize_line (int at); + void start_resize_line_ops (); + void end_resize_line_ops (); + protected: void map_transport_state (); void map_position_change (nframes64_t); void on_realize(); + bool on_expose_event (GdkEventExpose*); private: @@ -559,6 +565,10 @@ class Editor : public PublicEditor Gtk::VBox global_vpacker; Gtk::VBox vpacker; + bool need_resize_line; + int resize_line_y; + int old_resize_line_y; + Gdk::Cursor* current_canvas_cursor; void set_canvas_cursor (); Gdk::Cursor* which_grabber_cursor (); @@ -977,6 +987,7 @@ class Editor : public PublicEditor void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & ); void region_hidden (boost::shared_ptr<ARDOUR::Region>); void redisplay_regions (); + bool no_region_list_redisplay; void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>); list<boost::shared_ptr<ARDOUR::AudioRegion> > tmp_audio_region_list; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 36029a4213..6a7ec62df2 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1651,6 +1651,12 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item track_canvas->get_pointer (x, y); } + if (event->motion.state & GDK_BUTTON1_MASK) { + queue_draw_resize_line (event->motion.y); + } else { + need_resize_line = false; + } + if (current_stepping_trackview) { /* don't keep the persistent stepped trackview if the mouse moves */ current_stepping_trackview = 0; diff --git a/gtk2_ardour/editor_region_list.cc b/gtk2_ardour/editor_region_list.cc index 7f5d3e5de4..fd874fe51b 100644 --- a/gtk2_ardour/editor_region_list.cc +++ b/gtk2_ardour/editor_region_list.cc @@ -253,6 +253,10 @@ Editor::insert_into_tmp_audio_regionlist(boost::shared_ptr<AudioRegion> region) void Editor::redisplay_regions () { + if (no_region_list_redisplay) { + return; + } + if (session) { region_list_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0)); diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 0c002374ac..65e3b547a3 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -452,11 +452,19 @@ EngineControl::build_command_line (vector<string>& cmd) } else if (str == _("Playback/Recording on 2 Devices")) { + string input_device = get_device_name (driver, input_device_combo.get_active_text()); + string output_device = get_device_name (driver, output_device_combo.get_active_text()); + + if (input_device.empty() || output_device.empty()) { + cmd.clear (); + return; + } + cmd.push_back ("-C"); - cmd.push_back (get_device_name (driver, input_device_combo.get_active_text())); + cmd.push_back (input_device); cmd.push_back ("-P"); - cmd.push_back (get_device_name (driver, output_device_combo.get_active_text())); - + cmd.push_back (output_device); + } else if (str == _("Playback only")) { cmd.push_back ("-P"); } else if (str == _("Recording only")) { @@ -478,8 +486,15 @@ EngineControl::build_command_line (vector<string>& cmd) if (using_alsa) { if (audio_mode_combo.get_active_text() != _("Playback/Recording on 2 Devices")) { + + string device = get_device_name (driver, interface_combo.get_active_text()); + if (device.empty()) { + cmd.clear (); + return; + } + cmd.push_back ("-d"); - cmd.push_back (get_device_name (driver, interface_combo.get_active_text())); + cmd.push_back (device); } if (hw_meter_button.get_active()) { @@ -513,8 +528,15 @@ EngineControl::build_command_line (vector<string>& cmd) #ifdef __APPLE__ // note: older versions of the CoreAudio JACK backend use -n instead of -d here + + string device = get_device_name (driver, interface_combo.get_active_text()); + if (device.empty()) { + cmd.clear (); + return; + } + cmd.push_back ("-d"); - cmd.push_back (get_device_name (driver, interface_combo.get_active_text())); + cmd.push_back (device); #endif } else if (using_oss) { @@ -544,6 +566,10 @@ EngineControl::setup_engine () std::string cwd = "/tmp"; build_command_line (args); + + if (args.empty()) { + return 1; // try again + } Glib::ustring jackdrc_path = Glib::get_home_dir(); jackdrc_path += "/.jackdrc"; @@ -983,6 +1009,15 @@ EngineControl::get_device_name (const string& driver, const string& human_readab vector<string>::iterator n; vector<string>::iterator i; + if (human_readable.empty()) { + /* this can happen if the user's .ardourrc file has a device name from + another computer system in it + */ + MessageDialog msg (_("You need to choose an audio device first.")); + msg.run (); + return string(); + } + if (backend_devs.empty()) { return human_readable; } @@ -994,12 +1029,9 @@ EngineControl::get_device_name (const string& driver, const string& human_readab } if (i == devices[driver].end()) { - fatal << string_compose (_("programming error: %1"), "true hardware name for ID missing") << endmsg; - /*NOTREACHED*/ + warning << string_compose (_("Audio device \"%1\" not known on this computer."), human_readable) << endmsg; } - /* keep gcc happy */ - return string(); } diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 3fc04f80fa..502aa448b7 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -157,6 +157,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual void scroll_tracks_up_line () = 0; virtual bool new_regionviews_display_gain () = 0; virtual void prepare_for_cleanup () = 0; + virtual void finish_cleanup () = 0; virtual void reset_x_origin (nframes64_t frame) = 0; virtual void remove_last_capture () = 0; virtual void maximise_editing_space() = 0; @@ -213,6 +214,10 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0; virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0; + virtual void queue_draw_resize_line (int at) = 0; + virtual void start_resize_line_ops () = 0; + virtual void end_resize_line_ops () = 0; + static const int window_border_width; static const int container_border_width; static const int vertical_spacing; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index c7373f5b2e..325fc6c217 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -1181,6 +1181,7 @@ TimeAxisView::resizer_button_press (GdkEventButton* event) { resize_drag_start = event->y_root; resize_idle_target = current_height(); + editor.start_resize_line_ops (); return true; } @@ -1188,6 +1189,7 @@ bool TimeAxisView::resizer_button_release (GdkEventButton* ev) { resize_drag_start = -1; + editor.end_resize_line_ops (); return true; } @@ -1213,11 +1215,18 @@ TimeAxisView::resizer_motion (GdkEventMotion* ev) } int32_t delta = (int32_t) floor (resize_drag_start - ev->y_root); + int xroot, yroot; + Glib::RefPtr<Gdk::Window> win (resizer.get_window()); + + if (win) { + win->get_origin (xroot, yroot); + editor.queue_draw_resize_line (yroot + ev->y); + } resize_idle_target = std::max (resize_idle_target - delta, (int) hSmall); if (resize_idle_id < 0) { - resize_idle_id = g_idle_add (_idle_resizer, this); + // resize_idle_id = g_idle_add (_idle_resizer, this); } resize_drag_start = ev->y_root; @@ -1225,7 +1234,6 @@ TimeAxisView::resizer_motion (GdkEventMotion* ev) return true; } - bool TimeAxisView::resizer_expose (GdkEventExpose* event) { |