X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Fdialog%2Ffilter-effects-dialog.cpp;h=ed7103be3c801a91fc4628d271e403d0e13c38b1;hb=9dc68827cbd515262ecb8d5ae8547d9e82c72e00;hp=07b8a4159459f7f369b4e692cc4f191ab8601215;hpb=072de79e6270f4137fa48a8a73491e8a0904d8f8;p=inkscape.git diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 07b8a4159..ed7103be3 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -5,6 +5,8 @@ * Nicholas Bishop * Rodrigo Kumpera * Felipe C. da S. Sanches + * Jon A. Cruz + * Abhishek Sharma * * Copyright (C) 2007 Authors * @@ -27,8 +29,6 @@ #include #include -#include "application/application.h" -#include "application/editor.h" #include "desktop.h" #include "desktop-handles.h" #include "dialog-manager.h" @@ -176,7 +176,7 @@ public: if (tip_text) { _tt.set_tip(*this, tip_text); } - combo = new ComboBoxEnum(default_value, c, a); + combo = new ComboBoxEnum(default_value, c, a, false); add(*combo); show_all(); } @@ -1023,18 +1023,18 @@ private: !(ls == 1 && SP_IS_FEPOINTLIGHT(child)) && !(ls == 2 && SP_IS_FESPOTLIGHT(child))) { if(child) - //XML Tree being used directly here while it shouldn't be. + //XML Tree being used directly here while it shouldn't be. sp_repr_unparent(child->getRepr()); if(ls != -1) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(prim->document); - Inkscape::XML::Node *repr = xml_doc->createElement(_light_source.get_active_data()->key.c_str()); + Inkscape::XML::Document *xml_doc = prim->document->getReprDoc(); + Inkscape::XML::Node *repr = xml_doc->createElement(_light_source.get_active_data()->key.c_str()); //XML Tree being used directly here while it shouldn't be. prim->getRepr()->appendChild(repr); Inkscape::GC::release(repr); } - SPDocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source")); + DocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source")); update(); } @@ -1146,7 +1146,7 @@ void FilterEffectsDialog::FilterModifier::on_activate_desktop(Application*, SPDe me->_resource_changed.disconnect(); me->_resource_changed = - sp_desktop_document(desktop)->resources_changed_connect("filter",sigc::mem_fun(me, &FilterModifier::update_filters)); + sp_desktop_document(desktop)->connectResourcesChanged("filter",sigc::mem_fun(me, &FilterModifier::update_filters)); me->_dialog.setDesktop(desktop); @@ -1217,7 +1217,7 @@ void FilterEffectsDialog::FilterModifier::on_name_edited(const Glib::ustring& pa if(iter) { SPFilter* filter = (*iter)[_columns.filter]; filter->setLabel(text.c_str()); - SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter")); + DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter")); if(iter) (*iter)[_columns.label] = text; } @@ -1253,7 +1253,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri } update_selection(sel); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Apply filter")); + DocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Apply filter")); } } @@ -1263,7 +1263,7 @@ void FilterEffectsDialog::FilterModifier::update_filters() { SPDesktop* desktop = _dialog.getDesktop(); SPDocument* document = sp_desktop_document(desktop); - const GSList* filters = document->get_resource_list("filter"); + const GSList* filters = document->getResourceList("filter"); _model->clear(); @@ -1329,7 +1329,7 @@ void FilterEffectsDialog::FilterModifier::add_filter() select_filter(filter); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter")); + DocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter")); } void FilterEffectsDialog::FilterModifier::remove_filter() @@ -1339,10 +1339,10 @@ void FilterEffectsDialog::FilterModifier::remove_filter() if(filter) { SPDocument* doc = filter->document; - //XML Tree being used directly here while it shouldn't be. + //XML Tree being used directly here while it shouldn't be. sp_repr_unparent(filter->getRepr()); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter")); + DocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter")); update_filters(); } @@ -1357,7 +1357,7 @@ void FilterEffectsDialog::FilterModifier::duplicate_filter() repr = repr->duplicate(repr->document()); parent->appendChild(repr); - SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter")); + DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter")); update_filters(); } @@ -1493,7 +1493,7 @@ void FilterEffectsDialog::PrimitiveList::update() Gtk::TreeModel::Row row = *_model->append(); row[_columns.primitive] = prim; - //XML Tree being used directly here while it shouldn't be. + //XML Tree being used directly here while it shouldn't be. row[_columns.type_id] = FPConverter.get_id_from_key(prim->getRepr()->name()); row[_columns.type] = _(FPConverter.get_label(row[_columns.type_id]).c_str()); row[_columns.id] = prim->getId(); @@ -1548,10 +1548,10 @@ void FilterEffectsDialog::PrimitiveList::remove_selected() _observer->set(0); //XML Tree being used directly here while it shouldn't be. - sp_repr_unparent(prim->getRepr()); + sp_repr_unparent(prim->getRepr()); - SPDocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS, - _("Remove filter primitive")); + DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS, + _("Remove filter primitive")); update(); } @@ -1922,10 +1922,10 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* // If input is null, delete it if(!in_val) { - //XML Tree being used directly here while it shouldn't be. + //XML Tree being used directly here while it shouldn't be. sp_repr_unparent(o->getRepr()); - SPDocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, - _("Remove merge node")); + DocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, + _("Remove merge node")); (*get_selection()->get_selected())[_columns.primitive] = prim; } else @@ -1935,11 +1935,11 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* } // Add new input? if(!handled && c == _in_drag && in_val) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(prim->document); + Inkscape::XML::Document *xml_doc = prim->document->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:feMergeNode"); repr->setAttribute("inkscape:collect", "always"); - //XML Tree being used directly here while it shouldn't be. + //XML Tree being used directly here while it shouldn't be. prim->getRepr()->appendChild(repr); SPFeMergeNode *node = SP_FEMERGENODE(prim->document->getObjectByRepr(repr)); Inkscape::GC::release(repr); @@ -2043,7 +2043,7 @@ void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtrrequestModified(SP_OBJECT_MODIFIED_FLAG); - SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Reorder filter primitive")); + DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Reorder filter primitive")); } // If a connection is dragged towards the top or bottom of the list, the list should scroll to follow. @@ -2187,13 +2187,14 @@ void FilterEffectsDialog::init_settings_widgets() _settings->type(NR_FILTER_COMPONENTTRANSFER); _settings->add_notimplemented(); + /* //TRANSLATORS: for info on "Slope" and "Intercept", see http://id.mind.net/~zona/mmts/functionInstitute/linearFunctions/lsif.html - /*_settings->add_combo(COMPONENTTRANSFER_TYPE_IDENTITY, SP_ATTR_TYPE, _("Type"), ComponentTransferTypeConverter); - _ct_slope = _settings->add_spinslider(SP_ATTR_SLOPE, _("Slope"), -100, 100, 1, 0.01, 1); - _ct_intercept = _settings->add_spinslider(SP_ATTR_INTERCEPT, _("Intercept"), -100, 100, 1, 0.01, 1); - _ct_amplitude = _settings->add_spinslider(SP_ATTR_AMPLITUDE, _("Amplitude"), 0, 100, 1, 0.01, 1); - _ct_exponent = _settings->add_spinslider(SP_ATTR_EXPONENT, _("Exponent"), 0, 100, 1, 0.01, 1); - _ct_offset = _settings->add_spinslider(SP_ATTR_OFFSET, _("Offset"), -100, 100, 1, 0.01, 1);*/ + _settings->add_combo(COMPONENTTRANSFER_TYPE_IDENTITY, SP_ATTR_TYPE, _("Type"), ComponentTransferTypeConverter); + _ct_slope = _settings->add_spinslider(1, SP_ATTR_SLOPE, _("Slope"), -10, 10, 0.1, 0.01, 2); + _ct_intercept = _settings->add_spinslider(0, SP_ATTR_INTERCEPT, _("Intercept"), -10, 10, 0.1, 0.01, 2); + _ct_amplitude = _settings->add_spinslider(1, SP_ATTR_AMPLITUDE, _("Amplitude"), 0, 10, 0.1, 0.01, 2); + _ct_exponent = _settings->add_spinslider(1, SP_ATTR_EXPONENT, _("Exponent"), 0, 10, 0.1, 0.01, 2); + _ct_offset = _settings->add_spinslider(0, SP_ATTR_OFFSET, _("Offset"), -10, 10, 0.1, 0.01, 2);*/ _settings->type(NR_FILTER_COMPOSITE); _settings->add_combo(COMPOSITE_OVER, SP_ATTR_OPERATOR, _("Operator:"), CompositeOperatorConverter); @@ -2215,8 +2216,8 @@ void FilterEffectsDialog::init_settings_widgets() _settings->type(NR_FILTER_DIFFUSELIGHTING); _settings->add_color(/*default: white*/ 0xffffffff, SP_PROP_LIGHTING_COLOR, _("Diffuse Color:"), _("Defines the color of the light source")); - _settings->add_spinslider(1, SP_ATTR_SURFACESCALE, _("Surface Scale:"), -1000, 1000, 1, 0.01, 1, _("This value amplifies the heights of the bump map defined by the input alpha channel")); - _settings->add_spinslider(1, SP_ATTR_DIFFUSECONSTANT, _("Constant:"), 0, 100, 0.1, 0.01, 2, _("This constant affects the Phong lighting model.")); + _settings->add_spinslider(1, SP_ATTR_SURFACESCALE, _("Surface Scale:"), -5, 5, 0.01, 0.001, 3, _("This value amplifies the heights of the bump map defined by the input alpha channel")); + _settings->add_spinslider(1, SP_ATTR_DIFFUSECONSTANT, _("Constant:"), 0, 5, 0.1, 0.01, 2, _("This constant affects the Phong lighting model.")); _settings->add_dualspinslider(SP_ATTR_KERNELUNITLENGTH, _("Kernel Unit Length:"), 0.01, 10, 1, 0.01, 1); _settings->add_lightsource(); @@ -2248,9 +2249,9 @@ void FilterEffectsDialog::init_settings_widgets() _settings->type(NR_FILTER_SPECULARLIGHTING); _settings->add_color(/*default: white*/ 0xffffffff, SP_PROP_LIGHTING_COLOR, _("Specular Color:"), _("Defines the color of the light source")); - _settings->add_spinslider(1, SP_ATTR_SURFACESCALE, _("Surface Scale:"), -1000, 1000, 1, 0.01, 1, _("This value amplifies the heights of the bump map defined by the input alpha channel")); - _settings->add_spinslider(1, SP_ATTR_SPECULARCONSTANT, _("Constant:"), 0, 100, 0.1, 0.01, 2, _("This constant affects the Phong lighting model.")); - _settings->add_spinslider(1, SP_ATTR_SPECULAREXPONENT, _("Exponent:"), 1, 128, 1, 0.01, 1, _("Exponent for specular term, larger is more \"shiny\".")); + _settings->add_spinslider(1, SP_ATTR_SURFACESCALE, _("Surface Scale:"), -5, 5, 0.1, 0.01, 2, _("This value amplifies the heights of the bump map defined by the input alpha channel")); + _settings->add_spinslider(1, SP_ATTR_SPECULARCONSTANT, _("Constant:"), 0, 5, 0.1, 0.01, 2, _("This constant affects the Phong lighting model.")); + _settings->add_spinslider(1, SP_ATTR_SPECULAREXPONENT, _("Exponent:"), 1, 50, 1, 0.01, 1, _("Exponent for specular term, larger is more \"shiny\".")); _settings->add_dualspinslider(SP_ATTR_KERNELUNITLENGTH, _("Kernel Unit Length:"), 0.01, 10, 1, 0.01, 1); _settings->add_lightsource(); @@ -2274,7 +2275,7 @@ void FilterEffectsDialog::add_primitive() _primitive_list.select(prim); - SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter primitive")); + DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter primitive")); } } @@ -2370,7 +2371,7 @@ void FilterEffectsDialog::duplicate_primitive() repr = SP_OBJECT_REPR(origprim)->duplicate(SP_OBJECT_REPR(origprim)->document()); SP_OBJECT_REPR(filter)->appendChild(repr); - SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter primitive")); + DocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter primitive")); _primitive_list.update(); } @@ -2422,8 +2423,8 @@ void FilterEffectsDialog::set_attr(SPObject* o, const SPAttributeEnum attr, cons Glib::ustring undokey = "filtereffects:"; undokey += name; - SPDocumentUndo::maybe_done(filter->document, undokey.c_str(), SP_VERB_DIALOG_FILTER_EFFECTS, - _("Set filter primitive attribute")); + DocumentUndo::maybeDone(filter->document, undokey.c_str(), SP_VERB_DIALOG_FILTER_EFFECTS, + _("Set filter primitive attribute")); } _attr_lock = false; @@ -2479,7 +2480,7 @@ void FilterEffectsDialog::update_settings_view() if(prim) { - //XML Tree being used directly here while it shouldn't be. + //XML Tree being used directly here while it shouldn't be. _settings->show_and_update(FPConverter.get_id_from_key(prim->getRepr()->name()), prim); _empty_settings.hide(); } @@ -2543,4 +2544,4 @@ void FilterEffectsDialog::update_color_matrix() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :