summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2012-12-28 11:40:14 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2012-12-28 11:40:14 +0000
commit4aa5153d5626aa6c2fc070a883daae3c88e97779 (patch)
treedb0951691731b6b016c77b684009e3371eb6e5b4 /src
parentImplement GTK+ 3 drawing for zoom correction ruler in preferences dialog (diff)
downloadinkscape-4aa5153d5626aa6c2fc070a883daae3c88e97779.tar.gz
inkscape-4aa5153d5626aa6c2fc070a883daae3c88e97779.zip
Correct sizing in primitives list in filter-effects dialog
(bzr r11996)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp52
-rw-r--r--src/ui/dialog/filter-effects-dialog.h20
2 files changed, 69 insertions, 3 deletions
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 6769a25ef..685781685 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -1454,6 +1454,41 @@ Glib::PropertyProxy<void*> FilterEffectsDialog::CellRendererConnection::property
return _primitive.get_proxy();
}
+#if WITH_GTKMM_3_0
+void FilterEffectsDialog::CellRendererConnection::get_preferred_width_vfunc(Gtk::Widget& widget,
+ int& minimum_width,
+ int& natural_width) const
+{
+ PrimitiveList& primlist = dynamic_cast<PrimitiveList&>(widget);
+ minimum_width = natural_width = size * primlist.primitive_count() + primlist.get_input_type_width() * 6;
+}
+
+void FilterEffectsDialog::CellRendererConnection::get_preferred_width_for_height_vfunc(Gtk::Widget& widget,
+ int /* height */,
+ int& minimum_width,
+ int& natural_width) const
+{
+ get_preferred_width(widget, minimum_width, natural_width);
+}
+
+void FilterEffectsDialog::CellRendererConnection::get_preferred_height_vfunc(Gtk::Widget& widget,
+ int& minimum_height,
+ int& natural_height) const
+{
+ // Scale the height depending on the number of inputs, unless it's
+ // the first primitive, in which case there are no connections
+ SPFilterPrimitive* prim = SP_FILTER_PRIMITIVE(_primitive.get_value());
+ minimum_height = natural_height = size * input_count(prim);
+}
+
+void FilterEffectsDialog::CellRendererConnection::get_preferred_height_for_width_vfunc(Gtk::Widget& widget,
+ int /* width */,
+ int& minimum_height,
+ int& natural_height) const
+{
+ get_preferred_height(widget, minimum_height, natural_height);
+}
+#else
void FilterEffectsDialog::CellRendererConnection::get_size_vfunc(
Gtk::Widget& widget, const Gdk::Rectangle* /*cell_area*/,
int* x_offset, int* y_offset, int* width, int* height) const
@@ -1473,6 +1508,7 @@ void FilterEffectsDialog::CellRendererConnection::get_size_vfunc(
(*height) = size * input_count(prim);
}
}
+#endif
/*** PrimitiveList ***/
FilterEffectsDialog::PrimitiveList::PrimitiveList(FilterEffectsDialog& d)
@@ -1496,6 +1532,7 @@ FilterEffectsDialog::PrimitiveList::PrimitiveList(FilterEffectsDialog& d)
set_model(_model);
append_column(_("_Effect"), _columns.type);
+ set_headers_visible();
_observer->signal_changed().connect(signal_primitive_changed().make_slot());
get_selection()->signal_changed().connect(sigc::mem_fun(*this, &PrimitiveList::on_primitive_selection_changed));
@@ -1648,11 +1685,20 @@ void FilterEffectsDialog::PrimitiveList::remove_selected()
}
#if !WITH_GTKMM_3_0
-bool FilterEffectsDialog::PrimitiveList::on_expose_signal(GdkEventExpose* /*e*/)
+bool FilterEffectsDialog::PrimitiveList::on_expose_signal(GdkEventExpose *e)
{
+ bool result = false;
Glib::RefPtr<Gdk::Window> win = get_bin_window();
- Cairo::RefPtr<Cairo::Context> cr = win->create_cairo_context();
- return on_draw(cr);
+
+ if (get_is_drawable())
+ {
+ Cairo::RefPtr<Cairo::Context> cr = win->create_cairo_context();
+ cr->rectangle(e->area.x, e->area.y, e->area.width, e->area.height);
+ cr->clip();
+ result = on_draw(cr);
+ }
+
+ return result;
}
#endif
diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h
index 1652a314f..82dc6b808 100644
--- a/src/ui/dialog/filter-effects-dialog.h
+++ b/src/ui/dialog/filter-effects-dialog.h
@@ -151,8 +151,28 @@ private:
static const int size = 24;
protected:
+#if WITH_GTKMM_3_0
+ virtual void get_preferred_width_vfunc(Gtk::Widget& widget,
+ int& minimum_width,
+ int& natural_width) const;
+
+ virtual void get_preferred_width_for_height_vfunc(Gtk::Widget& widget,
+ int height,
+ int& minimum_width,
+ int& natural_width) const;
+
+ virtual void get_preferred_height_vfunc(Gtk::Widget& widget,
+ int& minimum_height,
+ int& natural_height) const;
+
+ virtual void get_preferred_height_for_width_vfunc(Gtk::Widget& widget,
+ int width,
+ int& minimum_height,
+ int& natural_height) const;
+#else
virtual void get_size_vfunc(Gtk::Widget& widget, const Gdk::Rectangle* cell_area,
int* x_offset, int* y_offset, int* width, int* height) const;
+#endif
private:
// void* should be SPFilterPrimitive*, some weirdness with properties prevents this
Glib::Property<void*> _primitive;