summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-07-03 20:56:33 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-07-03 20:56:33 +0000
commit3e70b965971ca2b08dad5f76c58f5d13ebc20a2c (patch)
treec9775d3ca39acadb28daaa39156a3b15c2230591
parent3239d42bdfa5278bce3b9eeab3cb3f20426cd685 (diff)
remove static Pango::FontDescriptions, they cause glib errors because of initialization before Glib::thread_init() has been called
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2099 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/automation_time_axis.cc6
-rw-r--r--gtk2_ardour/automation_time_axis.h2
-rw-r--r--gtk2_ardour/editor_canvas.cc6
-rw-r--r--gtk2_ardour/marker.cc7
-rw-r--r--gtk2_ardour/time_axis_view_item.cc12
-rw-r--r--gtk2_ardour/time_axis_view_item.h2
-rw-r--r--gtk2_ardour/utils.cc6
-rw-r--r--gtk2_ardour/utils.h2
8 files changed, 24 insertions, 19 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 12998ee7d6..356d4d8987 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -40,7 +40,7 @@ using namespace PBD;
using namespace Gtk;
using namespace Editing;
-Pango::FontDescription AutomationTimeAxisView::name_font;
+Pango::FontDescription* AutomationTimeAxisView::name_font = 0;
bool AutomationTimeAxisView::have_name_font = false;
AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, PublicEditor& e, TimeAxisView& rent,
@@ -113,7 +113,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
bool shortened = false;
int ignore_width;
- shortpname = fit_to_pixels (_name, 60, name_font, ignore_width, true);
+ shortpname = fit_to_pixels (_name, 60, *name_font, ignore_width, true);
if (shortpname != _name ){
shortened = true;
@@ -126,7 +126,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
/* limit the plug name string */
- string pname = fit_to_pixels (nomparent, 60, name_font, ignore_width, true);
+ string pname = fit_to_pixels (nomparent, 60, *name_font, ignore_width, true);
if (pname != nomparent) {
shortened = true;
}
diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h
index 7b62e6eee2..d50412c4e6 100644
--- a/gtk2_ardour/automation_time_axis.h
+++ b/gtk2_ardour/automation_time_axis.h
@@ -144,7 +144,7 @@ class AutomationTimeAxisView : public TimeAxisView {
void set_colors ();
void color_handler (ColorID, uint32_t);
- static Pango::FontDescription name_font;
+ static Pango::FontDescription* name_font;
static bool have_name_font;
};
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index ac14d72a55..e175cb9c6b 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -121,12 +121,14 @@ Editor::initialize_canvas ()
/* stuff for the verbose canvas cursor */
- Pango::FontDescription font = get_font_for_style (N_("VerboseCanvasCursor"));
+ Pango::FontDescription* font = get_font_for_style (N_("VerboseCanvasCursor"));
verbose_canvas_cursor = new ArdourCanvas::Text (*track_canvas.root());
- verbose_canvas_cursor->property_font_desc() = font;
+ verbose_canvas_cursor->property_font_desc() = *font;
verbose_canvas_cursor->property_anchor() = ANCHOR_NW;
verbose_canvas_cursor->property_fill_color_rgba() = color_map[cVerboseCanvasCursor];
+
+ delete font;
verbose_cursor_visible = false;
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index 918a2786c9..6bc34322f5 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -240,11 +240,14 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
mark->property_fill_color_rgba() = rgba;
mark->property_outline_color_rgba() = rgba;
mark->property_width_pixels() = 1;
- Pango::FontDescription font = get_font_for_style (N_("MarkerText"));
+ Pango::FontDescription* font = get_font_for_style (N_("MarkerText"));
text = new Text (*group);
text->property_text() = annotation.c_str();
- text->property_font_desc() = font;
+ text->property_font_desc() = *font;
+
+ delete font;
+
if (annotate_left) {
text->property_x() = -(text->property_text_width());
} else {
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 7830e8f437..b178d1c0f4 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -43,7 +43,7 @@ using namespace PBD;
//------------------------------------------------------------------------------
/** Initialize const static memeber data */
-Pango::FontDescription TimeAxisViewItem::NAME_FONT;
+Pango::FontDescription* TimeAxisViewItem::NAME_FONT = 0;
bool TimeAxisViewItem::have_name_font = false;
const double TimeAxisViewItem::NAME_X_OFFSET = 15.0;
const double TimeAxisViewItem::GRAB_HANDLE_LENGTH = 6 ;
@@ -86,7 +86,7 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
int width;
int height;
- layout->set_font_description (NAME_FONT);
+ layout->set_font_description (*NAME_FONT);
Gtkmm2ext::get_ink_pixel_size (layout, width, height);
NAME_Y_OFFSET = height + 6;
@@ -126,7 +126,7 @@ void
TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_color, nframes_t start, nframes_t duration, Visibility vis)
{
item_name = it_name ;
- name_text_width = ::pixel_width (it_name, NAME_FONT);
+ name_text_width = ::pixel_width (it_name, *NAME_FONT);
last_name_text_width = 0;
samples_per_unit = spu ;
should_show_selection = true;
@@ -212,7 +212,7 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
then NAME_Y_OFFSET to position the text in the vertical center of the highlight
*/
name_text->property_y() = (double) trackview.height - 1.0 - TimeAxisViewItem::NAME_Y_OFFSET;
- name_text->property_font_desc() = NAME_FONT;
+ name_text->property_font_desc() = *NAME_FONT;
name_text->property_anchor() = Gtk::ANCHOR_NW;
name_text->set_data ("timeaxisviewitem", this);
@@ -491,7 +491,7 @@ TimeAxisViewItem::set_item_name(std::string new_name, void* src)
if (new_name != item_name) {
std::string temp_name = item_name ;
item_name = new_name ;
- name_text_width = ::pixel_width (new_name, NAME_FONT);
+ name_text_width = ::pixel_width (new_name, *NAME_FONT);
NameChanged (item_name, temp_name, src) ; /* EMIT_SIGNAL */
}
}
@@ -561,7 +561,7 @@ TimeAxisViewItem::set_name_text(const ustring& new_name)
{
if (name_text) {
name_text->property_text() = new_name;
- name_text_width = pixel_width (new_name, NAME_FONT);
+ name_text_width = pixel_width (new_name, *NAME_FONT);
name_text_size_cache.clear ();
}
}
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index aeeebe1c79..dd78eaa78e 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -266,7 +266,7 @@ class TimeAxisViewItem : public Selectable
bool name_active() const { return name_connected; }
// Default sizes, font and spacing
- static Pango::FontDescription NAME_FONT ;
+ static Pango::FontDescription* NAME_FONT ;
static bool have_name_font;
static const double NAME_X_OFFSET ;
static const double GRAB_HANDLE_LENGTH ;
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index d574ece427..51d60bc998 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -234,7 +234,7 @@ get_canvas_points (string who, uint32_t npoints)
return new ArdourCanvas::Points (npoints);
}
-Pango::FontDescription
+Pango::FontDescription*
get_font_for_style (string widgetname)
{
Gtk::Window window (WINDOW_TOPLEVEL);
@@ -257,10 +257,10 @@ get_font_for_style (string widgetname)
PangoContext* ctxt = (PangoContext*) pango_layout_get_context ((PangoLayout*) layout->gobj());
pfd = pango_context_get_font_description (ctxt);
- return Pango::FontDescription (pfd, true); /* make a copy */
+ return new Pango::FontDescription (pfd, true); /* make a copy */
}
- return Pango::FontDescription (pfd, true); /* make a copy */
+ return new Pango::FontDescription (pfd, true); /* make a copy */
}
uint32_t
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index 7e26ba066c..cae78f3d0a 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -63,7 +63,7 @@ unsigned char* xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h);
ArdourCanvas::Points* get_canvas_points (std::string who, uint32_t npoints);
-Pango::FontDescription get_font_for_style (std::string widgetname);
+Pango::FontDescription* get_font_for_style (std::string widgetname);
uint32_t rgba_from_style (std::string, uint32_t, uint32_t, uint32_t, uint32_t, std::string = "fg", int = Gtk::STATE_NORMAL, bool = true);