summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec332a7)
raw | patch | inline | side by side (parent: ec332a7)
author | nicholasbishop <nicholasbishop@users.sourceforge.net> | |
Wed, 1 Aug 2007 20:33:00 +0000 (20:33 +0000) | ||
committer | nicholasbishop <nicholasbishop@users.sourceforge.net> | |
Wed, 1 Aug 2007 20:33:00 +0000 (20:33 +0000) |
Removed unused header file.
index 755b1fba4973e4b93bf7ad9753089cc97e5f14bc..d848b6b326b1e7772391c333bc0430b1f95abb3a 100644 (file)
#include <gtk/gtktreeview.h>
#include <gtkmm/cellrenderertext.h>
#include <gtkmm/colorbutton.h>
+#include <gtkmm/messagedialog.h>
#include <gtkmm/paned.h>
#include <gtkmm/scale.h>
#include <gtkmm/scrolledwindow.h>
@@ -617,20 +618,9 @@ Glib::RefPtr<Gtk::Menu> create_popup_menu(Gtk::Widget& parent, sigc::slot<void>
return menu;
}
-static void try_id_change(SPObject* ob, const Glib::ustring& text)
-{
- // FIXME: this needs more serious error checking...
- if(ob && !SP_ACTIVE_DOCUMENT->getObjectById(text.c_str())) {
- SPException ex;
- SP_EXCEPTION_INIT(&ex);
- sp_object_setAttribute(ob, "id", text.c_str(), &ex);
- sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_FILTER_EFFECTS, _("Set object ID"));
- }
-}
-
/*** FilterModifier ***/
-FilterEffectsDialog::FilterModifier::FilterModifier()
- : _add(Gtk::Stock::ADD)
+FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d)
+ : _dialog(d), _add(Gtk::Stock::ADD)
{
Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow);
pack_start(*sw);
Gtk::TreeViewColumn* col = _list.get_column(selcol - 1);
if(col)
col->add_attribute(_cell_sel.property_sel(), _columns.sel);
- _list.append_column(_("_Filter"), _columns.id);
+ _list.append_column(_("_Filter"), _columns.label);
sw->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
sw->set_shadow_type(Gtk::SHADOW_IN);
sigc::mem_fun(*this, &FilterModifier::filter_list_button_release));
_menu = create_popup_menu(*this, sigc::mem_fun(*this, &FilterModifier::duplicate_filter),
sigc::mem_fun(*this, &FilterModifier::remove_filter));
+ _menu->items().push_back(Gtk::Menu_Helpers::MenuElem(
+ _("R_ename"), sigc::mem_fun(*this, &FilterModifier::rename_filter)));
+ _menu->accelerate(*this);
g_signal_connect(G_OBJECT(INKSCAPE), "change_selection",
G_CALLBACK(&FilterModifier::on_inkscape_change_selection), this);
SPDocument* doc = sp_desktop_document(SP_ACTIVE_DESKTOP);
SPFilter* filter = new_filter(doc);
+ const int count = _model->children().size();
+ std::ostringstream os;
+ os << "filter" << count;
+ filter->setLabel(os.str().c_str());
+
update_filters();
select_filter(filter);
}
}
-void FilterEffectsDialog::FilterModifier::filter_name_edited(const Glib::ustring& path, const Glib::ustring& text)
+void FilterEffectsDialog::FilterModifier::rename_filter()
{
- Gtk::TreeModel::iterator i = _model->get_iter(path);
-
- if(i)
- try_id_change((SPObject*)(*i)[_columns.filter], text);
+ SPFilter* filter = get_selected_filter();
+ Gtk::Dialog m("", _dialog, true);
+ m.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ m.add_button(_("_Rename"), Gtk::RESPONSE_OK);
+ m.set_default_response(Gtk::RESPONSE_OK);
+ Gtk::Label lbl(_("Filter name:"));
+ Gtk::Entry entry;
+ entry.set_text(filter->label() ? filter->label() : "");
+ Gtk::HBox hb;
+ hb.add(lbl);
+ hb.add(entry);
+ hb.set_spacing(12);
+ hb.show_all();
+ m.get_vbox()->add(hb);
+ const int res = m.run();
+ if(res == Gtk::RESPONSE_OK) {
+ filter->setLabel(entry.get_text().c_str());
+ sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter"));
+ Gtk::TreeIter iter = _list.get_selection()->get_selected();
+ if(iter)
+ (*iter)[_columns.label] = entry.get_text();
+ }
}
FilterEffectsDialog::CellRendererConnection::CellRendererConnection()
FilterEffectsDialog::FilterEffectsDialog()
: Dialog ("dialogs.filtereffects", SP_VERB_DIALOG_FILTER_EFFECTS),
+ _filter_modifier(*this),
_primitive_list(*this),
_add_primitive_type(FPConverter),
_add_primitive(Gtk::Stock::ADD),
index 3d834c4b2cb47f6268b28c2d7dca83d8d1ef803b..2dacd4860e7234ce9d163efc0c6f441480ac1804 100644 (file)
#include <gtkmm/alignment.h>
#include <gtkmm/box.h>
#include <gtkmm/buttonbox.h>
-#include <gtkmm/cellrendererspin.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm/frame.h>
class FilterModifier : public Gtk::VBox, public FilterEffectChooser
{
public:
- FilterModifier();
+ FilterModifier(FilterEffectsDialog&);
virtual SPFilter* get_selected_filter();
virtual void select_filter(const SPFilter*);
void add_filter();
void remove_filter();
void duplicate_filter();
- void filter_name_edited(const Glib::ustring& path, const Glib::ustring& text);
+ void rename_filter();
+ FilterEffectsDialog& _dialog;
Gtk::TreeView _list;
CellRendererSel _cell_sel;
Gtk::Button _add;
index 9cc235895e580733de95cad026a6ee64336e73a4..0820a2f28edf1f0d46ae48b3809995d8fafd5686 100644 (file)
Gtk::TreeModel::Row row = *_model->append();
SPFilter* f = (SPFilter*)l->data;
row[_columns.filter] = f;
+ const gchar* lbl = f->label();
const gchar* id = SP_OBJECT_ID(f);
- row[_columns.id] = id ? id : "";
+ row[_columns.label] = lbl ? lbl : (id ? id : "filter");
}
}
_blend.signal_changed().connect(signal_blend_blur_changed());
_blur.signal_value_changed().connect(signal_blend_blur_changed());
_filter.set_model(_model);
- _filter.pack_start(_columns.id);
+ _filter.pack_start(_columns.label);
_edit_filters.signal_clicked().connect(sigc::mem_fun(*this, &SimpleFilterModifier::show_filter_dialog));
_edit_filters.set_use_underline();
// Set state if no filters exist
Gtk::TreeModel::Row row = *_model->prepend();
row[_columns.filter] = 0;
- row[_columns.id] = "None";
+ row[_columns.label] = "None";
_filter.set_sensitive(false);
_filter.set_active(0);
}
index 9a49f523b3590195ac0862c66e059269e0c31631..5d1d16efda433174cd33b0c8e00ecec5a59e4196 100644 (file)
Columns()
{
add(filter);
- add(id);
+ add(label);
add(sel);
}
Gtk::TreeModelColumn<SPFilter*> filter;
- Gtk::TreeModelColumn<Glib::ustring> id;
+ Gtk::TreeModelColumn<Glib::ustring> label;
Gtk::TreeModelColumn<int> sel;
};