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
This commit is contained in:
Paul Davis 2008-02-24 02:28:25 +00:00
parent 7e53102018
commit 6299560116
13 changed files with 61 additions and 11 deletions

View File

@ -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')

View File

@ -34,6 +34,7 @@ gtkardour.Merge ([
libraries['fftw3'],
libraries['fftw3f'],
libraries['flac'],
libraries['freetype2'],
libraries['gdkmm2'],
libraries['glib2'],
libraries['glibmm2'],

View File

@ -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()) {

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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 ();

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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);
}

View File

@ -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) {

View File

@ -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>

View File

@ -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()
{