diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-02 21:43:10 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-02 21:43:10 +0000 |
commit | 11bcfd84296d5c4224e94bbae606180c5b58ef5b (patch) | |
tree | 97fa2121d4ba3330795ee68f4bd5d99e5ec09e41 /libs/gtkmm2ext | |
parent | 811acc5e6ed88a8268791f7a0520d36b350f6414 (diff) |
add extended info fields to clocks; clock tweaks
git-svn-id: svn://localhost/ardour2/branches/3.0@9675 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/cairocell.cc | 35 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/cairocell.h | 15 |
2 files changed, 37 insertions, 13 deletions
diff --git a/libs/gtkmm2ext/cairocell.cc b/libs/gtkmm2ext/cairocell.cc index 6f9a53e314..6de397b1f3 100644 --- a/libs/gtkmm2ext/cairocell.cc +++ b/libs/gtkmm2ext/cairocell.cc @@ -111,9 +111,9 @@ CairoEditableText::CairoEditableText () , width (0) , max_cell_height (0) , height (0) - , corner_radius (18) - , xpad (10) - , ypad (5) + , _corner_radius (9) + , _xpad (5) + , _ypad (5) { add_events (Gdk::POINTER_MOTION_HINT_MASK | Gdk::SCROLL_MASK | Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK); @@ -207,7 +207,11 @@ CairoEditableText::on_expose_event (GdkEventExpose* ev) context->clip (); context->set_source_rgba (bg_r, bg_g, bg_b, bg_a); - rounded_rectangle (context, 0, 0, width, height, corner_radius); + if (_corner_radius) { + rounded_rectangle (context, 0, 0, width, height, _corner_radius); + } else { + context->rectangle (0, 0, width, height); + } context->fill (); for (CellMap::iterator i = cells.begin(); i != cells.end(); ++i) { @@ -324,23 +328,34 @@ CairoEditableText::on_size_request (GtkRequisition* req) max_cell_height = 0; - x = xpad; + x = _xpad; - for (CellMap::iterator i = cells.begin(); i != cells.end(); ++i) { + CellMap::iterator i = cells.begin(); + + while (i != cells.end()) { CairoCell* cell = i->second; if (cell->visible()) { - cell->set_position (x, ypad); + cell->set_position (x, _ypad); } - x += cell->width() + cell->xpad(); + x += cell->width(); max_cell_height = std::max ((double) cell->height(), max_cell_height); + + ++i; + + if (i != cells.end()) { + /* only add cell padding intra-cellularly */ + x += cell->xpad(); + } else { + break; + } } - x += xpad; + x += _xpad; req->width = x; - req->height = max_cell_height + (ypad * 2); + req->height = max_cell_height + (_ypad * 2); } void diff --git a/libs/gtkmm2ext/gtkmm2ext/cairocell.h b/libs/gtkmm2ext/gtkmm2ext/cairocell.h index 336a440c5b..5d99d1fdcc 100644 --- a/libs/gtkmm2ext/gtkmm2ext/cairocell.h +++ b/libs/gtkmm2ext/gtkmm2ext/cairocell.h @@ -154,11 +154,20 @@ public: bg_g = g; bg_b = b; bg_a = a; + queue_draw (); } void set_font (const std::string& str); void set_font (const Pango::FontDescription&); + double xpad() const { return _xpad; } + void set_xpad (double x) { _xpad = x; queue_resize(); } + double ypad() const { return _ypad; } + void set_ypad (double y) { _ypad = y; queue_resize(); } + + double corner_radius() const { return _corner_radius; } + void set_corner_radius (double r) { _corner_radius = r; queue_draw (); } + sigc::signal<bool,GdkEventScroll*,uint32_t> scroll; sigc::signal<bool,GdkEventButton*,uint32_t> button_press; sigc::signal<bool,GdkEventButton*,uint32_t> button_release; @@ -182,9 +191,9 @@ private: double width; double max_cell_height; double height; - double corner_radius; - double xpad; - double ypad; + double _corner_radius; + double _xpad; + double _ypad; double r; double g; double b; |