change the way we use "physical screen height" to better account for multi-monitor setups

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@7539 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-08-04 18:11:28 +00:00
parent 2776558801
commit 64e9b0ccc6
7 changed files with 59 additions and 35 deletions

View File

@ -330,10 +330,6 @@ class Editor : public PublicEditor
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;
/* SMPTE timecode & video sync */
void smpte_fps_chosen (ARDOUR::SmpteFormat format);

View File

@ -107,13 +107,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 */
@ -144,21 +139,21 @@ 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();
_background_group = new ArdourCanvas::Group (*track_canvas->root());
_master_group = new ArdourCanvas::Group (*track_canvas->root());
range_marker_drag_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, physical_screen_height);
range_marker_drag_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, phys_height);
range_marker_drag_rect->hide ();
_trackview_group = new ArdourCanvas::Group (*_master_group);
@ -166,60 +161,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);
@ -235,7 +230,7 @@ Editor::initialize_canvas ()
cd_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, 0.0);
marker_drag_line_points.push_back(Gnome::Art::Point(0.0, 0.0));
marker_drag_line_points.push_back(Gnome::Art::Point(0.0, physical_screen_height));
marker_drag_line_points.push_back(Gnome::Art::Point(0.0, phys_height));
marker_drag_line = new ArdourCanvas::Line (*timebar_group);
marker_drag_line->property_width_pixels() = 1;
@ -258,14 +253,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
@ -394,12 +389,12 @@ Editor::controls_layout_size_request (Requisition* req)
}
}
gint height = min ((gint) pos, (gint) (physical_screen_height - 600));
gint height = min ((gint) pos, (gint) (physical_screen_height (get_window()) - 600));
gint width = max (edit_controls_vbox.get_width(), controls_layout.get_width());
/* 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;

View File

@ -45,6 +45,7 @@
#include "ardour_ui.h"
#include "time_axis_view.h"
#include "tempo_lines.h"
#include "utils.h"
#include "i18n.h"
@ -196,7 +197,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);

View File

@ -152,7 +152,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
virtual void toggle_follow_playhead () = 0;
virtual bool follow_playhead() const = 0;
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 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0) = 0;

View File

@ -61,7 +61,7 @@ StreamView::StreamView (RouteTimeAxisView& tv)
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->property_outline_what() = (guint32) (0x1|0x2|0x8); // outline ends and bottom

View File

@ -917,3 +917,33 @@ pixbuf_from_ustring(const ustring& name, Pango::FontDescription* font, uint32_t
return buf;
}
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);
}
}

View File

@ -100,4 +100,7 @@ Glib::RefPtr<Gdk::Pixbuf> pixbuf_from_ustring (const Glib::ustring& name,
int clip_width,
int clip_height);
int physical_screen_height (Glib::RefPtr<Gdk::Window>);
int physical_screen_width (Glib::RefPtr<Gdk::Window>);
#endif /* __ardour_gtk_utils_h__ */