Index: src/verbs.cpp =================================================================== --- src/verbs.cpp (revis��o 20247) +++ src/verbs.cpp (c��pia de trabalho) @@ -69,6 +69,7 @@ #include "path-chemistry.h" #include "text-chemistry.h" #include "ui/dialog/dialog-manager.h" +#include "ui/dialog/document-properties.h" #include "ui/dialog/inkscape-preferences.h" #include "interface.h" #include "preferences.h" @@ -831,6 +832,7 @@ void EditVerb::perform(SPAction *action, void *data, void */*pdata*/) { +g_warning("EditVerb::perform, %d", data); SPDesktop *dt = static_cast(sp_action_get_view(action)); if (!dt) return; @@ -983,6 +985,14 @@ case SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER: sp_selection_next_patheffect_param(dt); break; + case SP_VERB_EDIT_EMBED_COLOR_PROFILE: + g_warning("SP_VERB_EDIT_EMBED_COLOR_PROFILE"); + ((Inkscape::UI::Dialog::DocumentProperties *) dt->_dlg_mgr->getDialog("DocumentProperties"))->update(); + break; + case SP_VERB_EDIT_REMOVE_COLOR_PROFILE: + g_warning("SP_VERB_EDIT_REMOVE_COLOR_PROFILE"); + ((Inkscape::UI::Dialog::DocumentProperties *) dt->_dlg_mgr->getDialog("DocumentProperties"))->update(); + break; default: break; } @@ -2707,6 +2717,11 @@ N_("Unhide all objects in the current layer"), NULL), new LockAndHideVerb(SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, "UnhideAllInAllLayers", N_("Unhide All in All Layers"), N_("Unhide all objects in all layers"), NULL), + /*Color Management*/ + new EditVerb(SP_VERB_EDIT_EMBED_COLOR_PROFILE, "EmbedColorProfile", N_("Embed Color Profile"), + N_("Embed an ICC color profile"), NULL), + new EditVerb(SP_VERB_EDIT_REMOVE_COLOR_PROFILE, "RemoveColorProfile", N_("Remove Color Profile"), + N_("Remove an embedded ICC color profile"), NULL), /* Footer */ new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL) }; Index: src/verbs.h =================================================================== --- src/verbs.h (revis��o 20247) +++ src/verbs.h (c��pia de trabalho) @@ -271,10 +271,11 @@ SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, SP_VERB_UNHIDE_ALL, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, + /* Color management */ + SP_VERB_EDIT_EMBED_COLOR_PROFILE, + SP_VERB_EDIT_REMOVE_COLOR_PROFILE, /* Footer */ - SP_VERB_LAST, - /* Color management */ - SP_VERB_EMBED_COLOR_PROFILE, + SP_VERB_LAST }; gchar *sp_action_get_title (const SPAction *action); Index: src/ui/dialog/document-properties.cpp =================================================================== --- src/ui/dialog/document-properties.cpp (revis��o 20247) +++ src/ui/dialog/document-properties.cpp (c��pia de trabalho) @@ -414,26 +414,6 @@ void DocumentProperties::populate_available_profiles(){ - // add "None" -/* Gtk::MenuItem *i = new Gtk::MenuItem(); - i->show(); - - i->set_data("filepath", NULL); - i->set_data("name", _("None")); - - Gtk::HBox *hb = new Gtk::HBox(false, 0); - hb->show(); - - Gtk::Label *l = new Gtk::Label( _("None") ); - l->show(); - l->set_alignment(0.0, 0.5); - - hb->pack_start(*l, true, true, 0); - - hb->show(); - i->add(*hb); - _menu.append(*i); -*/ std::list sources; sources.push_back( profile_path("color/icc") ); //sources.push_back( g_strdup(INKSCAPE_COLORPROFILESDIR) ); @@ -519,7 +499,7 @@ Inkscape::GC::release(defsRepr); // inform the document, so we can undo - sp_document_done(desktop->doc(), SP_VERB_EMBED_COLOR_PROFILE, _("Embed Color Profile")); + sp_document_done(desktop->doc(), SP_VERB_EDIT_EMBED_COLOR_PROFILE, _("Embed Color Profile")); populate_embedded_profiles_box(); } @@ -539,7 +519,48 @@ } } +void DocumentProperties::embedded_profiles_list_button_release(GdkEventButton* event) +{ + if((event->type == GDK_BUTTON_RELEASE) && (event->button == 3)) { + _EmbProfContextMenu.popup(event->button, event->time); + } +} +void DocumentProperties::create_popup_menu(Gtk::Widget& parent, sigc::slot rem) +{ + Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + _EmbProfContextMenu.append(*mi); + mi->signal_activate().connect(rem); + mi->show(); + _EmbProfContextMenu.accelerate(parent); +} + +void DocumentProperties::remove_profile(){ + Glib::ustring name; + if(_EmbeddedProfilesList.get_selection()) { + Gtk::TreeModel::iterator i = _EmbeddedProfilesList.get_selection()->get_selected(); + + if(i){ + name = (*i)[_EmbeddedProfilesListColumns.nameColumn]; + } else { + return; + } + } + + const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" ); + while ( current ) { + SPObject* obj = SP_OBJECT(current->data); + Inkscape::ColorProfile* prof = reinterpret_cast(obj); + if (!name.compare(prof->name)){ + sp_repr_unparent(obj->repr); + sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove embedded color profile")); + } + current = g_slist_next(current); + } + + populate_embedded_profiles_box(); +} + void DocumentProperties::build_cms() { @@ -584,6 +605,9 @@ _EmbeddedProfilesListScroller.set_size_request(-1, 90); _embed_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onEmbedProfile)); + + _EmbeddedProfilesList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::embedded_profiles_list_button_release)); + create_popup_menu(_EmbeddedProfilesList, sigc::mem_fun(*this, &DocumentProperties::remove_profile)); } #endif // ENABLE_LCMS @@ -695,12 +719,13 @@ double const doc_h_px = sp_document_height(sp_desktop_document(dt)); _page_sizer.setDim (doc_w_px, doc_h_px); - //-----------------------------------------------------------guide + //-----------------------------------------------------------guide page + _rcb_sgui.setActive (nv->showguides); _rcp_gui.setRgba32 (nv->guidecolor); _rcp_hgui.setRgba32 (nv->guidehicolor); - //-----------------------------------------------------------snap + //-----------------------------------------------------------snap page _rcbsnbb.setActive (nv->snap_manager.snapprefs.getSnapModeBBox()); _rcbsnn.setActive (nv->snap_manager.snapprefs.getSnapModeNode()); @@ -721,10 +746,16 @@ _rsu_gusn.setValue (nv->guidetolerance); _rcbs.setActive (nv->snap_manager.snapprefs.getSnapEnabledGlobally()); + //-----------------------------------------------------------grids page update_gridspage(); + //------------------------------------------------Color Management page + + populate_embedded_profiles_box(); + populate_available_profiles(); + _wr.setUpdating (false); } Index: src/ui/dialog/document-properties.h =================================================================== --- src/ui/dialog/document-properties.h (revis��o 20247) +++ src/ui/dialog/document-properties.h (c��pia de trabalho) @@ -59,6 +59,9 @@ void populate_embedded_profiles_box(); virtual void on_response (int); void onEmbedProfile(); + void remove_profile(); + void embedded_profiles_list_button_release(GdkEventButton* event); + void create_popup_menu(Gtk::Widget& parent, sigc::slot rem); void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document); void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop); @@ -103,6 +106,7 @@ Glib::RefPtr _EmbeddedProfilesListStore; Gtk::TreeView _EmbeddedProfilesList; Gtk::ScrolledWindow _EmbeddedProfilesListScroller; + Gtk::Menu _EmbProfContextMenu; //--------------------------------------------------------------- Gtk::Notebook _grids_notebook; Gtk::HBox _grids_hbox_crea;