diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-24 02:28:25 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-24 02:28:25 +0000 |
commit | 6299560116cb1e024f214f4928aa88605a5cddff (patch) | |
tree | 9c650845530407546859816d567212fc2f53a34f | |
parent | 7e531020180affdae2d98ddd93594e7a1e9b4721 (diff) |
make canvas text scale with font scaler; prevent bogus values from putting NaN's into automation lines
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3118 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | SConstruct | 3 | ||||
-rw-r--r-- | gtk2_ardour/SConscript | 1 | ||||
-rw-r--r-- | gtk2_ardour/audio_region_view.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/audio_region_view.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/audio_time_axis.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/automation_gain_line.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_line.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/option_editor.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/region_gain_line.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 3 | ||||
-rw-r--r-- | libs/ardour/source_factory.cc | 1 | ||||
-rw-r--r-- | libs/libgnomecanvasmm/libgnomecanvasmm/text.cc | 22 |
13 files changed, 61 insertions, 11 deletions
diff --git a/SConstruct b/SConstruct index 2b311e93e1..520bcdd058 100644 --- a/SConstruct +++ b/SConstruct @@ -562,6 +562,9 @@ libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gobject-2.0') libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gmodule-2.0') libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gthread-2.0') +libraries['freetype2'] = LibraryInfo() +libraries['freetype2'].ParseConfig ('pkg-config --cflags --libs freetype2') + libraries['gtk2'] = LibraryInfo() libraries['gtk2'].ParseConfig ('pkg-config --cflags --libs gtk+-2.0') diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 53eb217062..56a9633683 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -34,6 +34,7 @@ gtkardour.Merge ([ libraries['fftw3'], libraries['fftw3f'], libraries['flac'], + libraries['freetype2'], libraries['gdkmm2'], libraries['glib2'], libraries['glibmm2'], diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 7d014bfa1d..a5b767c8cd 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -142,7 +142,7 @@ AudioRegionView::init (Gdk::Color& basic_color, bool wfd) } compute_colors (basic_color); - + create_waves (); fade_in_shape = new ArdourCanvas::Polygon (*group); @@ -763,7 +763,7 @@ AudioRegionView::set_envelope_visible (bool yn) void AudioRegionView::create_waves () { - //cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG + // cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick if (!atv.get_diskstream()) { diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index d6c1d266c7..63e7647591 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -62,6 +62,8 @@ class AudioRegionView : public RegionView boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const; + void create_waves (); + void set_height (double); void set_samples_per_unit (double); @@ -132,7 +134,6 @@ class AudioRegionView : public RegionView void region_muted (); void region_scale_amplitude_changed (); - void create_waves (); void create_one_wave (uint32_t, bool); void manage_zero_line (); void peaks_ready_handler (uint32_t); diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index abfecce046..475a4a1183 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -434,8 +434,9 @@ AudioStreamView::set_show_waveforms (bool yn) { for (list<RegionView *>::iterator i = region_views.begin(); i != region_views.end(); ++i) { AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i); - if (arv) + if (arv) { arv->set_waveform_visible (yn); + } } } diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index e537165508..01f60cb1c2 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -115,10 +115,10 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh _view->RegionViewAdded.connect (mem_fun(*this, &AudioTimeAxisView::region_view_added)); if (!editor.have_idled()) { - /* first idle will do the rest */ + /* first idle will do what we need */ } else { first_idle (); - } + } } else { post_construct (); diff --git a/gtk2_ardour/automation_gain_line.cc b/gtk2_ardour/automation_gain_line.cc index 006543df18..a67284f39e 100644 --- a/gtk2_ardour/automation_gain_line.cc +++ b/gtk2_ardour/automation_gain_line.cc @@ -51,6 +51,8 @@ AutomationGainLine::view_to_model_y (double& y) void AutomationGainLine::model_to_view_y (double& y) { + if (y < 0) y = 0; + y = gain_to_slider_position (y); } diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 83d77490ae..64eeee9d87 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -605,6 +605,12 @@ AutomationLine::determine_visible_control_points (ALPoints& points) double tx = points[pi].x; double ty = points[pi].y; + + if (isnan (tx) || isnan (ty)) { + warning << string_compose (_("Ignoring illegal points on AutomationLine \"%1\""), + _name) << endmsg; + continue; + } /* now ensure that the control_points vector reflects the current curve state, but don't plot control points too close together. also, don't @@ -1198,7 +1204,7 @@ AutomationLine::reset_callback (const AutomationList& events) AutomationList::const_iterator ai; for (ai = events.const_begin(); ai != events.const_end(); ++ai) { - + double translated_y = (*ai)->value; model_to_view_y (translated_y); diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index abdbc88e8e..bf57797fe1 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -16,6 +16,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <pango/pangoft2.h> // for fontmap resolution control for GnomeCanvas +#include <pango/pangocairo.h> // for fontmap resolution control for GnomeCanvas #include <pbd/whitespace.h> @@ -253,8 +255,20 @@ OptionEditor::add_session_paths () static void reset_dpi () { + long val = Config->get_font_scale(); + + /* FT2 rendering */ + + pango_ft2_font_map_set_resolution ((PangoFT2FontMap*) pango_ft2_font_map_for_display(), val/1024, val/1024); + + /* Cairo rendering, in case there is any */ + + pango_cairo_font_map_set_resolution ((PangoCairoFontMap*) pango_cairo_font_map_get_default(), val/1024); + + /* Xft rendering */ + gtk_settings_set_long_property (gtk_settings_get_default(), - "gtk-xft-dpi", Config->get_font_scale(), "ardour"); + "gtk-xft-dpi", val, "ardour"); } static void diff --git a/gtk2_ardour/region_gain_line.cc b/gtk2_ardour/region_gain_line.cc index 0d72afefe9..6f03c1b17b 100644 --- a/gtk2_ardour/region_gain_line.cc +++ b/gtk2_ardour/region_gain_line.cc @@ -59,6 +59,8 @@ AudioRegionGainLine::view_to_model_y (double& y) void AudioRegionGainLine::model_to_view_y (double& y) { + if (y < 0) y == 0; + y = gain_to_slider_position (y); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 669145b8c4..770af1ba11 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1638,7 +1638,8 @@ Session::XMLSourceFactory (const XMLNode& node) } try { - return SourceFactory::create (*this, node); + /* note: do peak building in another thread when loading session state */ + return SourceFactory::create (*this, node, true); } catch (failed_constructor& err) { diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 23a9c29c96..deb7e8b8e2 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -23,6 +23,7 @@ #include <pbd/error.h> #include <pbd/convert.h> #include <pbd/pthread_utils.h> +#include <pbd/stacktrace.h> #include <ardour/source_factory.h> #include <ardour/sndfilesource.h> diff --git a/libs/libgnomecanvasmm/libgnomecanvasmm/text.cc b/libs/libgnomecanvasmm/libgnomecanvasmm/text.cc index 62ccc4b981..c18c9e202c 100644 --- a/libs/libgnomecanvasmm/libgnomecanvasmm/text.cc +++ b/libs/libgnomecanvasmm/libgnomecanvasmm/text.cc @@ -25,6 +25,22 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <gtk/gtksettings.h> +#include <glib-object.h> + +static void +_catch_xft_dpi (GObject* thing, gpointer val, gpointer arg) +{ + GnomeCanvasText* text = (GnomeCanvasText*) arg; + gchar *txt; + + g_object_get (G_OBJECT(text), "text", &txt, NULL); + + if (txt && txt[0] != '\0') { + g_object_set (G_OBJECT(text), "text", txt, NULL); + } +} + namespace Gnome { @@ -36,12 +52,14 @@ Text::Text(Group& parentx, double x, double y, const Glib::ustring& text) { item_construct(parentx); set("x", x, "y", y, "text", text.c_str(), 0); + g_signal_connect (gtk_settings_get_default(), "notify::gtk-xft-dpi", (GCallback) _catch_xft_dpi, gobj()); } Text::Text(Group& parentx) : Item(GNOME_CANVAS_ITEM(g_object_new(get_type(), 0))) { item_construct(parentx); + g_signal_connect (gtk_settings_get_default(), "notify::gtk-xft-dpi", (GCallback) _catch_xft_dpi, gobj()); } } /* namespace Canvas */ @@ -113,13 +131,13 @@ Text::Text(const Glib::ConstructParams& construct_params) : Item(construct_params) { - } +} Text::Text(GnomeCanvasText* castitem) : Item((GnomeCanvasItem*)(castitem)) { - } +} Text::~Text() { |