summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5ada07f)
raw | patch | inline | side by side (parent: 5ada07f)
author | JucaBlues <JucaBlues@users.sourceforge.net> | |
Mon, 24 Nov 2008 00:20:25 +0000 (00:20 +0000) | ||
committer | JucaBlues <JucaBlues@users.sourceforge.net> | |
Mon, 24 Nov 2008 00:20:25 +0000 (00:20 +0000) |
src/ui/dialog/document-properties.cpp | patch | blob | history | |
src/ui/dialog/document-properties.h | patch | blob | history | |
src/verbs.cpp | patch | blob | history | |
src/verbs.h | patch | blob | history |
index acf4dbb54292f06887193fe9145672f7caca4b1f..e47630615dbaca37e75f1cc6f061aaaf039026be 100644 (file)
# include <config.h>
#endif
-
-
+#include "display/canvas-grid.h"
+#include "document-properties.h"
+#include "document.h"
+#include "desktop-handles.h"
+#include "desktop.h"
#include <gtkmm.h>
-#include "ui/widget/color-picker.h"
-#include "ui/widget/scalar-unit.h"
-
-#include "xml/node-event-vector.h"
-#include "xml/repr.h"
#include "helper/units.h"
-#include "preferences.h"
-
#include "inkscape.h"
#include "io/sys.h"
-#include "verbs.h"
-#include "document.h"
-#include "desktop-handles.h"
-#include "desktop.h"
+#include "preferences.h"
#include "sp-namedview.h"
#include "sp-object-repr.h"
#include "sp-root.h"
+#include "ui/widget/color-picker.h"
+#include "ui/widget/scalar-unit.h"
+#include "verbs.h"
#include "widgets/icon.h"
-#include "document-properties.h"
-
-#include "display/canvas-grid.h"
+#include "xml/node-event-vector.h"
+#include "xml/repr.h"
#if ENABLE_LCMS
#include <lcms.h>
attach_all(_page_snap_dtls.table(), array, G_N_ELEMENTS(array));
}
+// Very simple observer that just emits a signal if anything happens to a node
+DocumentProperties::SignalObserver::SignalObserver()
+ : _oldsel(0)
+{}
+
+// Add this observer to the SPObject and remove it from any previous object
+void
+DocumentProperties::SignalObserver::set(SPObject* o)
+{
+ if(_oldsel && _oldsel->repr)
+ _oldsel->repr->removeObserver(*this);
+ if(o && o->repr)
+ o->repr->addObserver(*this);
+ _oldsel = o;
+}
+
+void DocumentProperties::SignalObserver::notifyChildAdded(XML::Node&, XML::Node&, XML::Node*)
+{ signal_changed()(); }
+
+void DocumentProperties::SignalObserver::notifyChildRemoved(XML::Node&, XML::Node&, XML::Node*)
+{ signal_changed()(); }
+
+void DocumentProperties::SignalObserver::notifyChildOrderChanged(XML::Node&, XML::Node&, XML::Node*, XML::Node*)
+{ signal_changed()(); }
+
+void DocumentProperties::SignalObserver::notifyContentChanged(XML::Node&, Util::ptr_shared<char>, Util::ptr_shared<char>)
+{}
+
+void DocumentProperties::SignalObserver::notifyAttributeChanged(XML::Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>)
+{ signal_changed()(); }
+
+sigc::signal<void>& DocumentProperties::SignalObserver::signal_changed()
+{
+ return _signal_changed;
+}
+
#if ENABLE_LCMS
static void
lcms_profile_get_name (cmsHPROFILE profile, const gchar **name)
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<gchar *> sources;
sources.push_back( profile_path("color/icc") );
//sources.push_back( g_strdup(INKSCAPE_COLORPROFILESDIR) );
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();
}
{
_EmbeddedProfilesListStore->clear();
const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "iccprofile" );
+ if (current) _emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
}
}
+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<void> 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<Inkscape::ColorProfile*>(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()
_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));
+
+ const GSList *current = sp_document_get_resource_list( SP_ACTIVE_DOCUMENT, "defs" );
+ if (current) _emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
+ _emb_profiles_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_embedded_profiles_box));
}
#endif // ENABLE_LCMS
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());
_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 ff4739bfb093f8ca6bece2c887e32717e3fa5511..162618c05445f479fba04df3acde686e18eb11c7 100644 (file)
#include "ui/widget/tolerance-slider.h"
#include "ui/widget/panel.h"
+#include "xml/node-observer.h"
+
using namespace Inkscape::UI::Widget;
namespace Inkscape {
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<void> rem);
void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document);
void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
+ // Very simple observer that just emits a signal if anything happens to a node
+ class SignalObserver : public XML::NodeObserver
+ {
+ public:
+ SignalObserver();
+
+ // Add this observer to the SPObject and remove it from any previous object
+ void set(SPObject* o);
+ void notifyChildAdded(XML::Node&, XML::Node&, XML::Node*);
+ void notifyChildRemoved(XML::Node&, XML::Node&, XML::Node*);
+ void notifyChildOrderChanged(XML::Node&, XML::Node&, XML::Node*, XML::Node*);
+ void notifyContentChanged(XML::Node&, Util::ptr_shared<char>, Util::ptr_shared<char>);
+ void notifyAttributeChanged(XML::Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>);
+ sigc::signal<void>& signal_changed();
+ private:
+ sigc::signal<void> _signal_changed;
+ SPObject* _oldsel;
+ };
+
+ SignalObserver _emb_profiles_observer;
Gtk::Tooltips _tt;
Gtk::Notebook _notebook;
Glib::RefPtr<Gtk::ListStore> _EmbeddedProfilesListStore;
Gtk::TreeView _EmbeddedProfilesList;
Gtk::ScrolledWindow _EmbeddedProfilesListScroller;
+ Gtk::Menu _EmbProfContextMenu;
//---------------------------------------------------------------
Gtk::Notebook _grids_notebook;
Gtk::HBox _grids_hbox_crea;
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 4ddf589572c861d6a39154a5d06efaf57ca058d2..17fd00421e11ba51bb4497c08b8227307db2b419 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
#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"
case SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER:
sp_selection_next_patheffect_param(dt);
break;
+ case SP_VERB_EDIT_EMBED_COLOR_PROFILE:
+ break;
+ case SP_VERB_EDIT_REMOVE_COLOR_PROFILE:
+ break;
default:
break;
}
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)
};
diff --git a/src/verbs.h b/src/verbs.h
index 2bee018c519a4a49d46204f16005a9145747d479..a1f96ab5a345d7b3e0305a6411da92111d404360 100644 (file)
--- a/src/verbs.h
+++ b/src/verbs.h
SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS,
SP_VERB_UNHIDE_ALL,
SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS,
- /* Footer */
- SP_VERB_LAST,
/* Color management */
- SP_VERB_EMBED_COLOR_PROFILE,
+ SP_VERB_EDIT_EMBED_COLOR_PROFILE,
+ SP_VERB_EDIT_REMOVE_COLOR_PROFILE,
+ /* Footer */
+ SP_VERB_LAST
};
gchar *sp_action_get_title (const SPAction *action);