Code

family name field on svgfonts dialog now properly saves attribute. Should do the...
[inkscape.git] / src / ui / dialog / filter-effects-dialog.cpp
index c7694ef09ea696d774db4b2a7159f9ee0c560407..d577a6cc427b787a64b8d24b114adf255f99f6d9 100644 (file)
@@ -209,17 +209,19 @@ template< typename T> class ComboWithTooltip : public Gtk::EventBox
 public:
     ComboWithTooltip<T>(T default_value, const Util::EnumDataConverter<T>& c, const SPAttributeEnum a = SP_ATTR_INVALID, char* tip_text = NULL)
     {
-        if (tip_text) _tt.set_tip(*this, tip_text);
+        if (tip_text) {
+            _tt.set_tip(*this, tip_text);
+        }
         combo = new ComboBoxEnum<T>(default_value, c, a);
         add(*combo);
         show_all();
     }
-    
+
     ~ComboWithTooltip()
     {
         delete combo;
     }
-    
+
     ComboBoxEnum<T>* get_attrwidget()
     {
         return combo;
@@ -315,7 +317,7 @@ public:
         }
         _s1.set_value(n.getNumber());
         _s2.set_value(n.getOptNumber());
-        
+
     }
 private:
     Gtk::SpinButton _s1, _s2;
@@ -869,7 +871,7 @@ public:
         std::vector<double> default_values;
         default_values.push_back(def1);
         default_values.push_back(def2);
-        
+
         std::vector<char*> tips;
         tips.push_back(tip1);
         tips.push_back(tip2);
@@ -1467,7 +1469,7 @@ int FilterEffectsDialog::PrimitiveList::init_text()
     _vertical_layout = Pango::Layout::create(context);
 
     int maxfont = 0;
-    for(int i = 0; i < FPInputConverter.end; ++i) {
+    for(unsigned int i = 0; i < FPInputConverter._length; ++i) {
         _vertical_layout->set_text(_(FPInputConverter.get_label((FilterPrimitiveInput)i).c_str()));
         int fontw, fonth;
         _vertical_layout->get_pixel_size(fontw, fonth);
@@ -1591,8 +1593,8 @@ bool FilterEffectsDialog::PrimitiveList::on_expose_signal(GdkEventExpose* e)
         int vis_x, vis_y;
         tree_to_widget_coords(vis.get_x(), vis.get_y(), vis_x, vis_y);
 
-        text_start_x = rct.get_x() + rct.get_width() - _connection_cell.get_text_width() * (FPInputConverter.end + 1) + 1;
-        for(int i = 0; i < FPInputConverter.end; ++i) {
+        text_start_x = rct.get_x() + rct.get_width() - _connection_cell.get_text_width() * (FPInputConverter._length + 1) + 1;
+        for(unsigned int i = 0; i < FPInputConverter._length; ++i) {
             _vertical_layout->set_text(_(FPInputConverter.get_label((FilterPrimitiveInput)i).c_str()));
             const int x = text_start_x + _connection_cell.get_text_width() * (i + 1);
             get_bin_window()->draw_rectangle(get_style()->get_bg_gc(Gtk::STATE_NORMAL), true, x, vis_y, _connection_cell.get_text_width(), vis.get_height());
@@ -1898,13 +1900,14 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton*
             Gdk::Rectangle rct;
             get_cell_area(path, *col, rct);
             const int twidth = _connection_cell.get_text_width();
-            const int sources_x = rct.get_width() - twidth * FPInputConverter.end;
+            const int sources_x = rct.get_width() - twidth * FPInputConverter._length;
             if(cx > sources_x) {
                 int src = (cx - sources_x) / twidth;
-                if(src < 0)
+                if (src < 0) {
                     src = 0;
-                else if(src >= FPInputConverter.end)
-                    src = FPInputConverter.end - 1;
+                } else if(src >= static_cast<int>(FPInputConverter._length)) {
+                    src = FPInputConverter._length - 1;
+                }
                 result = FPInputConverter.get_key((FilterPrimitiveInput)src);
                 in_val = result.c_str();
             }
@@ -1917,7 +1920,7 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton*
                         // Make sure the target has a result
                         const gchar *gres = repr->attribute("result");
                         if(!gres) {
-                            result = "result" + Glib::Ascii::dtostr(SP_FILTER(prim->parent)->_image_number_next);
+                            result = sp_filter_get_new_result_name(SP_FILTER(prim->parent));
                             repr->setAttribute("result", result.c_str());
                             in_val = result.c_str();
                         }
@@ -2086,15 +2089,15 @@ int FilterEffectsDialog::PrimitiveList::primitive_count() const
 
 FilterEffectsDialog::FilterEffectsDialog()
     : UI::Widget::Panel("", "dialogs.filtereffects", SP_VERB_DIALOG_FILTER_EFFECTS),
-      _filter_modifier(*this),
-      _primitive_list(*this),
       _add_primitive_type(FPConverter),
       _add_primitive(_("Add Effect:")),
       _empty_settings(_("No effect selected"), Gtk::ALIGN_LEFT),
       _no_filter_selected(_("No filter selected"), Gtk::ALIGN_LEFT),
       _settings_initialized(false),
       _locked(false),
-      _attr_lock(false)
+      _attr_lock(false),
+      _filter_modifier(*this),
+      _primitive_list(*this)
 {
     _settings = new Settings(*this, _settings_tab1, sigc::mem_fun(*this, &FilterEffectsDialog::set_attr_direct),
                              NR_FILTER_ENDPRIMITIVETYPE);
@@ -2178,7 +2181,7 @@ void FilterEffectsDialog::init_settings_widgets()
 
     _empty_settings.set_sensitive(false);
     _settings_tab1.pack_start(_empty_settings);
-    
+
     _no_filter_selected.set_sensitive(false);
     _settings_tab2.pack_start(_no_filter_selected);
     _settings_initialized = true;
@@ -2213,7 +2216,7 @@ void FilterEffectsDialog::init_settings_widgets()
     _k4 = _settings->add_spinslider(0, SP_ATTR_K4, _("K4"), -10, 10, 0.1, 0.01, 2, _("If the arithmetic operation is chosen, each result pixel is computed using the formula k1*i1*i2 + k2*i1 + k3*i2 + k4 where i1 and i2 are the pixel values of the first and second inputs respectively."));
 
     _settings->type(NR_FILTER_CONVOLVEMATRIX);
-    _convolve_order = _settings->add_dualspinbutton("3", SP_ATTR_ORDER, _("Size"), 1, 5, 1, 1, 0, _("width of the convolve matrix"), _("height of the convolve matrix"));
+    _convolve_order = _settings->add_dualspinbutton((char*)"3", SP_ATTR_ORDER, _("Size"), 1, 5, 1, 1, 0, _("width of the convolve matrix"), _("height of the convolve matrix"));
     _convolve_target = _settings->add_multispinbutton(/*default x:*/ (double) 0, /*default y:*/ (double) 0, SP_ATTR_TARGETX, SP_ATTR_TARGETY, _("Target"), 0, 4, 1, 1, 0, _("X coordinate of the target point in the convolve matrix. The convolution is applied to pixels around this point."), _("Y coordinate of the target point in the convolve matrix. The convolution is applied to pixels around this point."));
     //TRANSLATORS: for info on "Kernel", see http://en.wikipedia.org/wiki/Kernel_(matrix)
     _convolve_matrix = _settings->add_matrix(SP_ATTR_KERNELMATRIX, _("Kernel"), _("This matrix describes the convolve operation that is applied to the input image in order to calculate the pixel colors at the output. Different arrangements of values in this matrix result in various possible visual effects. An identity matrix would lead to a motion blur effect (parallel to the matrix diagonal) while a matrix filled with a constant non-zero value would lead to a common blur effect."));
@@ -2482,7 +2485,7 @@ void FilterEffectsDialog::update_settings_view()
         _infobox_icon.hide();
         _infobox_desc.hide();
     }
-    
+
     SPFilterPrimitive* prim = _primitive_list.get_selected();
 
     if(prim) {