diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-22 16:28:26 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-22 16:28:26 +0000 |
commit | 71a4796dc3dbf8a7fe1df5c5d7acea388b40eae0 (patch) | |
tree | 0fba71173e48e99c010549949e6872d8299d433b | |
parent | 43bcb7f72b8ea64bab7861ff24d488d4d09a7293 (diff) |
forward port of 7539 from 2.x
git-svn-id: svn://localhost/ardour2/branches/3.0@7667 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 52 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/editor_tempodisplay.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/streamview.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/utils.cc | 29 | ||||
-rw-r--r-- | gtk2_ardour/utils.h | 3 |
8 files changed, 59 insertions, 40 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index bc72dcb1f6..2d4a8d453e 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -369,10 +369,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void toggle_measure_visibility (); void toggle_logo_visibility (); - double get_physical_screen_width () const { return physical_screen_width; }; - double physical_screen_width; - double physical_screen_height; - /* fades/xfades */ void toggle_selected_region_fades (int dir); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 7b13f66584..27f9128ce5 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -105,13 +105,8 @@ Editor::initialize_canvas () track_canvas->set_center_scroll_region (false); track_canvas->set_dither (Gdk::RGB_DITHER_NONE); - Glib::RefPtr<Gdk::Screen> screen = get_screen(); - - if (!screen) { - screen = Gdk::Screen::get_default(); - } - physical_screen_width = screen->get_width (); - physical_screen_height = screen->get_height (); + gint phys_width = physical_screen_width (Glib::RefPtr<Gdk::Window>()); + gint phys_height = physical_screen_height (Glib::RefPtr<Gdk::Window>()); /* stuff for the verbose canvas cursor */ @@ -142,14 +137,14 @@ Editor::initialize_canvas () #ifdef GTKOSX /*XXX please don't laugh. this actually improves canvas performance on osx */ - bogus_background_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, max_canvas_coordinate/3, physical_screen_height); + bogus_background_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, max_canvas_coordinate/3, phys_height); bogus_background_rect->property_outline_pixels() = 0; #endif - transport_loop_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, physical_screen_height); + transport_loop_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, phys_height); transport_loop_range_rect->property_outline_pixels() = 1; transport_loop_range_rect->hide(); - transport_punch_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, physical_screen_height); + transport_punch_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, phys_height); transport_punch_range_rect->property_outline_pixels() = 0; transport_punch_range_rect->hide(); @@ -161,60 +156,60 @@ Editor::initialize_canvas () meter_bar_group = new ArdourCanvas::Group (*track_canvas->root ()); if (Profile->get_sae()) { - meter_bar = new ArdourCanvas::SimpleRect (*meter_bar_group, 0.0, 0.0, physical_screen_width, timebar_height - 1); + meter_bar = new ArdourCanvas::SimpleRect (*meter_bar_group, 0.0, 0.0, phys_width, timebar_height - 1); meter_bar->property_outline_pixels() = 1; } else { - meter_bar = new ArdourCanvas::SimpleRect (*meter_bar_group, 0.0, 0.0, physical_screen_width, timebar_height); + meter_bar = new ArdourCanvas::SimpleRect (*meter_bar_group, 0.0, 0.0, phys_width, timebar_height); meter_bar->property_outline_pixels() = 0; } meter_bar->property_outline_what() = (0x1 | 0x8); tempo_bar_group = new ArdourCanvas::Group (*track_canvas->root ()); if (Profile->get_sae()) { - tempo_bar = new ArdourCanvas::SimpleRect (*tempo_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height - 1)); + tempo_bar = new ArdourCanvas::SimpleRect (*tempo_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1)); tempo_bar->property_outline_pixels() = 1; } else { - tempo_bar = new ArdourCanvas::SimpleRect (*tempo_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height)); + tempo_bar = new ArdourCanvas::SimpleRect (*tempo_bar_group, 0.0, 0.0, phys_width, (timebar_height)); tempo_bar->property_outline_pixels() = 0; } tempo_bar->property_outline_what() = (0x1 | 0x8); range_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ()); if (Profile->get_sae()) { - range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height - 1)); + range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1)); range_marker_bar->property_outline_pixels() = 1; } else { - range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height)); + range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_bar_group, 0.0, 0.0, phys_width, (timebar_height)); range_marker_bar->property_outline_pixels() = 0; } range_marker_bar->property_outline_what() = (0x1 | 0x8); transport_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ()); if (Profile->get_sae()) { - transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height - 1)); + transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1)); transport_marker_bar->property_outline_pixels() = 1; } else { - transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height)); + transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, phys_width, (timebar_height)); transport_marker_bar->property_outline_pixels() = 0; } transport_marker_bar->property_outline_what() = (0x1 | 0x8); marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ()); if (Profile->get_sae()) { - marker_bar = new ArdourCanvas::SimpleRect (*marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height - 1)); + marker_bar = new ArdourCanvas::SimpleRect (*marker_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1)); marker_bar->property_outline_pixels() = 1; } else { - marker_bar = new ArdourCanvas::SimpleRect (*marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height)); + marker_bar = new ArdourCanvas::SimpleRect (*marker_bar_group, 0.0, 0.0, phys_width, (timebar_height)); marker_bar->property_outline_pixels() = 0; } marker_bar->property_outline_what() = (0x1 | 0x8); cd_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ()); if (Profile->get_sae()) { - cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height - 1)); + cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1)); cd_marker_bar->property_outline_pixels() = 1; } else { - cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height)); + cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, phys_width, (timebar_height)); cd_marker_bar->property_outline_pixels() = 0; } cd_marker_bar->property_outline_what() = (0x1 | 0x8); @@ -245,14 +240,14 @@ Editor::initialize_canvas () transport_punchin_line->property_x1() = 0.0; transport_punchin_line->property_y1() = 0.0; transport_punchin_line->property_x2() = 0.0; - transport_punchin_line->property_y2() = physical_screen_height; + transport_punchin_line->property_y2() = phys_height; transport_punchin_line->hide (); transport_punchout_line = new ArdourCanvas::SimpleLine (*_master_group); transport_punchout_line->property_x1() = 0.0; transport_punchout_line->property_y1() = 0.0; transport_punchout_line->property_x2() = 0.0; - transport_punchout_line->property_y2() = physical_screen_height; + transport_punchout_line->property_y2() = phys_height; transport_punchout_line->hide(); // used to show zoom mode active zooming @@ -332,14 +327,10 @@ Editor::track_canvas_size_allocated () if (_session) { TrackViewList::iterator i; - double height = 0; for (i = track_views.begin(); i != track_views.end(); ++i) { - height += (*i)->effective_height (); (*i)->clip_to_viewport (); } - - full_canvas_height = height + canvas_timebars_vsize; } if (height_changed) { @@ -377,10 +368,9 @@ Editor::controls_layout_size_request (Requisition* req) double pos = 0; for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { pos += (*i)->effective_height (); - (*i)->clip_to_viewport (); } - gint height = min ((gint) pos, (gint) (physical_screen_height - 600)); + gint height = min ((gint) pos, (gint) (physical_screen_height(get_window()) - 600)); bool changed = false; @@ -393,7 +383,7 @@ Editor::controls_layout_size_request (Requisition* req) /* don't get too big. the fudge factors here are just guesses */ - width = min (width, (gint) (physical_screen_width - 300)); + width = min (width, (gint) (physical_screen_width(get_window()) - 300)); if ((req->width != width) || (req->height != height)) { changed = true; diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 1e3823961e..ba8f807521 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -2398,7 +2398,7 @@ MarkerDrag::MarkerDrag (Editor* e, ArdourCanvas::Item* i) assert (_marker); _points.push_back (Gnome::Art::Point (0, 0)); - _points.push_back (Gnome::Art::Point (0, _editor->physical_screen_height)); + _points.push_back (Gnome::Art::Point (0, physical_screen_height (_editor->get_window()))); _line = new ArdourCanvas::Line (*_editor->timebar_group); _line->property_width_pixels() = 1; @@ -3467,7 +3467,8 @@ RangeMarkerBarDrag::RangeMarkerBarDrag (Editor* e, ArdourCanvas::Item* i, Operat _operation (o), _copy (false) { - _drag_rect = new ArdourCanvas::SimpleRect (*_editor->time_line_group, 0.0, 0.0, 0.0, _editor->physical_screen_height); + _drag_rect = new ArdourCanvas::SimpleRect (*_editor->time_line_group, 0.0, 0.0, 0.0, + physical_screen_height (_editor->get_window())); _drag_rect->hide (); _drag_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragRect.get(); diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index edfaee3694..048c0d2ccb 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -45,6 +45,7 @@ #include "time_axis_view.h" #include "ardour_ui.h" #include "tempo_lines.h" +#include "utils.h" #include "i18n.h" @@ -189,7 +190,7 @@ Editor::draw_measures () } if (tempo_lines == 0) { - tempo_lines = new TempoLines(*track_canvas, time_line_group, physical_screen_height); + tempo_lines = new TempoLines(*track_canvas, time_line_group, physical_screen_height(get_window())); } tempo_lines->draw(*current_bbt_points, frames_per_unit); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 6bf897bcd3..a393b11e4c 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -243,7 +243,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { /** @return true if the playhead is currently being dragged, otherwise false */ virtual bool dragging_playhead () const = 0; - virtual double get_physical_screen_width() const = 0; virtual void ensure_float (Gtk::Window&) = 0; virtual void show_window () = 0; virtual nframes64_t leftmost_position() const = 0; diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 242510b32e..708b3f54f6 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -67,7 +67,7 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* background_g canvas_rect = new ArdourCanvas::SimpleRect (*_background_group); canvas_rect->property_x1() = 0.0; canvas_rect->property_y1() = 0.0; - canvas_rect->property_x2() = _trackview.editor().get_physical_screen_width (); + canvas_rect->property_x2() = physical_screen_width (_trackview.editor().get_window()); canvas_rect->property_y2() = (double) tv.current_height(); canvas_rect->raise(1); // raise above tempo lines diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index f9cc0739c6..8884e762da 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -1054,3 +1054,32 @@ control_link (ScopedConnectionList& scl, boost::shared_ptr<Controllable> c, Gtk: gui_context()); } +int +physical_screen_height (Glib::RefPtr<Gdk::Window> win) +{ + GdkScreen* scr = gdk_screen_get_default(); + + if (win) { + GdkRectangle r; + gint monitor = gdk_screen_get_monitor_at_window (scr, win->gobj()); + gdk_screen_get_monitor_geometry (scr, monitor, &r); + return r.height; + } else { + return gdk_screen_get_height (scr); + } +} + +int +physical_screen_width (Glib::RefPtr<Gdk::Window> win) +{ + GdkScreen* scr = gdk_screen_get_default(); + + if (win) { + GdkRectangle r; + gint monitor = gdk_screen_get_monitor_at_window (scr, win->gobj()); + gdk_screen_get_monitor_geometry (scr, monitor, &r); + return r.width; + } else { + return gdk_screen_get_width (scr); + } +} diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index cac21b4ffa..fe0627cd49 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -104,4 +104,7 @@ std::string escape_underscores (std::string const &); void control_link (PBD::ScopedConnectionList& scl, boost::shared_ptr<PBD::Controllable> c, Gtk::Adjustment& a); +int physical_screen_height (Glib::RefPtr<Gdk::Window>); +int physical_screen_width (Glib::RefPtr<Gdk::Window>); + #endif /* __ardour_gtk_utils_h__ */ |