X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Fcairocell.cc;h=7ce77355b6e883f665e91d7fbe7563bb87004e4e;hb=3ecd5d6f088ff56de31eb6fbd82379acaa51e5d4;hp=c449cae5920ed1d4dcc07f0221512c0795ea14cb;hpb=d135c4dc3a307d0be606f3afbbc8fd8c3ec56438;p=ardour.git diff --git a/libs/gtkmm2ext/cairocell.cc b/libs/gtkmm2ext/cairocell.cc index c449cae592..7ce77355b6 100644 --- a/libs/gtkmm2ext/cairocell.cc +++ b/libs/gtkmm2ext/cairocell.cc @@ -79,10 +79,14 @@ CairoFontDescription::CairoFontDescription (Pango::FontDescription& fd) _weight = Cairo::FONT_WEIGHT_BOLD; break; + /* to silence warnings when compiling with newer pango versions. */ + default: + _weight = Cairo::FONT_WEIGHT_NORMAL; + break; } face = fd.get_family(); -} +} CairoCell::CairoCell (int32_t id) : _id (id) @@ -147,11 +151,11 @@ CairoTextCell::set_size (Cairo::RefPtr& context) for (int digit = 0; digit < 10; digit++) { for (n = 0; n < lim; ++n) { - buf[n] = '0' + digit; + buf[n] = '0' + digit; } - + context->get_text_extents (&buf[0], ext); - + max_width = max (ext.width + ext.x_bearing, max_width); max_height = max (ext.height, max_height); bsum += ext.x_bearing; @@ -179,7 +183,7 @@ CairoCharCell::set_size (Cairo::RefPtr& context) Cairo::TextExtents ext; _font->apply (context); - + { const char* buf = "8"; context->get_text_extents (buf, ext); @@ -251,7 +255,7 @@ void CairoEditableText::add_cell (CairoCell* cell) { cells.push_back (cell); - + CairoTextCell* tc = dynamic_cast(cell); if (tc) { @@ -306,7 +310,7 @@ CairoEditableText::on_expose_event (GdkEventExpose* ev) Gtk::Allocation alloc = get_allocation (); double width = alloc.get_width(); double height = alloc.get_height (); - + if (_draw_bg) { context->set_source_rgba (bg_r, bg_g, bg_b, bg_a); if (_corner_radius) { @@ -316,14 +320,14 @@ CairoEditableText::on_expose_event (GdkEventExpose* ev) } context->fill (); } - + for (CellMap::iterator i = cells.begin(); i != cells.end(); ++i) { CairoCell* cell = (*i); /* is cell inside the expose area? */ - + if (cell->intersects (ev->area)) { if (cell == editing_cell) { context->set_source_rgba (edit_r, edit_b, edit_g, edit_a); @@ -413,9 +417,9 @@ CairoEditableText::set_cell_sizes () if (!win) { return; } - + Cairo::RefPtr context = win->create_cairo_context(); - + if (!context) { return; } @@ -432,7 +436,7 @@ CairoEditableText::on_size_request (GtkRequisition* req) max_cell_width = 0; max_cell_height = 0; - + for (CellMap::iterator i = cells.begin(); i != cells.end(); ++i) { max_cell_width += (*i)->width(); max_cell_height = std::max ((double) (*i)->height(), max_cell_height);