diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2005-12-07 17:15:37 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2005-12-07 17:15:37 +0000 |
commit | 6d33b9a2d681e00681236c3f61bc231b46c1db27 (patch) | |
tree | a2639220d6a74d956e5d68e02c197b31e7371afe /gtk2_ardour/editor_canvas.cc | |
parent | e21dc7dede5ee5494925e2ae641b7a69b41dc2d7 (diff) |
black bg for meters, font fixups for startup message, new notebook widget (incomplete)
git-svn-id: svn://localhost/trunk/ardour2@178 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_canvas.cc')
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 122 |
1 files changed, 21 insertions, 101 deletions
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 32fefe664d..3de31f0317 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -269,74 +269,46 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc) if (session == 0 && !ARDOUR_UI::instance()->will_create_new_session_automatically()) { - Pango::FontDescription font = get_font_for_style (N_("FirstActionMessage")); - - cerr << "font for style = " - << font.get_family() << ' ' - << font.get_size() << ' ' - << font.get_weight() << ' ' - << font.get_variant() << ' ' - << endmsg; - - const char *txt1 = _("Start a new session\n"); - const char *txt2 = _("via Session menu"); - /* this mess of code is here to find out how wide this text is and - position the message in the center of the editor window. there - are two lines, so we use the longer of the the lines to - compute width, and multiply the height by 2. + position the message in the center of the editor window. */ int pixel_height; int pixel_width; - /* this is a dummy widget that exists so that we can get the - style from the RC file. - */ - - Label foo (_(txt2)); - Glib::RefPtr<Pango::Layout> layout; + ustring msg = string_compose ("<span face=\"sans\" style=\"normal\" weight=\"bold\" size=\"x-large\">%1%2</span>", + _("Start a new session\n"), _("via Session menu")); - top_hbox.pack_start (foo); - foo.set_name ("FirstActionMessage"); - foo.ensure_style (); - - layout = foo.create_pango_layout (_(txt2)); - layout->set_font_description (font); - layout->set_font_description (font); + RefPtr<Pango::Layout> layout = create_pango_layout (msg); + Pango::FontDescription font = get_font_for_style (N_("FirstActionMessage")); layout->get_pixel_size (pixel_width, pixel_height); - top_hbox.remove (foo); - if (first_action_message == 0) { - char txt[strlen(txt1)+strlen(txt2)+1]; - - /* merge both lines */ - - strcpy (txt, _(txt1)); - strcat (txt, _(txt2)); - first_action_message = new ArdourCanvas::Text (*track_canvas.root()); first_action_message->property_font_desc() = font; first_action_message->property_fill_color_rgba() = color_map[cFirstActionMessage]; - first_action_message->property_x() = (gdouble) (canvas_width - pixel_width) / 2.0; - first_action_message->property_y() = (gdouble) (canvas_height/2.0) - (2.0 * (pixel_height)); + first_action_message->property_x() = (canvas_width - pixel_width) / 2.0; + first_action_message->property_y() = (canvas_height/2.0) - pixel_height; first_action_message->property_anchor() = ANCHOR_NORTH_WEST; - first_action_message->property_text() = ustring (txt); + first_action_message->property_markup() = msg; } else { /* center it */ - first_action_message->property_x() = (gdouble) (canvas_width - pixel_width) / 2.0; - first_action_message->property_y() = (gdouble) (canvas_height/2.0) - (2.0 * (pixel_height)); + first_action_message->property_x() = (canvas_width - pixel_width) / 2.0; + first_action_message->property_y() = (canvas_height/2.0) - pixel_height; } } - zoom_range_clock.set ((jack_nframes_t) (canvas_width * frames_per_unit)); + zoom_range_clock.set ((jack_nframes_t) floor ((canvas_width * frames_per_unit))); edit_cursor->set_position (edit_cursor->current_frame); playhead_cursor->set_position (playhead_cursor->current_frame); - reset_scrolling_region (&alloc); + + double last_canvas_unit = ceil ((double) max_frames / frames_per_unit); + + track_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_width), canvas_height); + time_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_width), canvas_height); if (edit_cursor) edit_cursor->set_length (canvas_height); if (playhead_cursor) playhead_cursor->set_length (canvas_height); @@ -348,27 +320,27 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc) if (range_marker_drag_rect) { range_marker_drag_rect->property_y1() = 0.0; - range_marker_drag_rect->property_y2() = (double) canvas_height; + range_marker_drag_rect->property_y2() = canvas_height; } if (transport_loop_range_rect) { transport_loop_range_rect->property_y1() = 0.0; - transport_loop_range_rect->property_y2() = (double) canvas_height; + transport_loop_range_rect->property_y2() = canvas_height; } if (transport_punch_range_rect) { transport_punch_range_rect->property_y1() = 0.0; - transport_punch_range_rect->property_y2() = (double) canvas_height; + transport_punch_range_rect->property_y2() = canvas_height; } if (transport_punchin_line) { transport_punchin_line->property_y1() = 0.0; - transport_punchin_line->property_y2() = (double) canvas_height; + transport_punchin_line->property_y2() = canvas_height; } if (transport_punchout_line) { transport_punchout_line->property_y1() = 0.0; - transport_punchout_line->property_y2() = (double) canvas_height; + transport_punchout_line->property_y2() = canvas_height; } update_fixed_rulers (); @@ -386,58 +358,6 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc) void Editor::reset_scrolling_region (Gtk::Allocation* alloc) { - guint32 last_canvas_unit; - double height; - guint32 canvas_alloc_height, canvas_alloc_width; - TrackViewList::iterator i; - - /* We need to make sure that the canvas always has its - scrolling region set to larger of: - - - the size allocated for it (within the container its packed in) - - the size required to see the entire session - - If we don't ensure at least the first of these, the canvas - does some wierd and in my view unnecessary stuff to center - itself within the allocated area, which causes bad, bad - results. - - XXX GnomeCanvas has fixed this, and has an option to - control the centering behaviour. - */ - -#if 0 - last_canvas_unit = (guint32) ceil ((float) max_frames / frames_per_unit); - - height = 0; - - if (session) { - for (i = track_views.begin(); i != track_views.end(); ++i) { - if ((*i)->control_parent) { - height += (*i)->effective_height; - height += track_spacing; - } - } - - if (height) { - height -= track_spacing; - } - } - - canvas_height = (guint32) height; -#endif - - if (alloc) { - canvas_alloc_height = alloc->get_height(); - canvas_alloc_width = alloc->get_width(); - } else { - canvas_alloc_height = track_canvas.get_height(); - canvas_alloc_width = track_canvas.get_width(); - } - - canvas_height = 0; - canvas_height = max (canvas_height, canvas_alloc_height); - track_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_alloc_width), canvas_height); } bool |