From 9e2a21da898684d22362206ff422094ccac7cc51 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 17 May 2012 13:34:35 +0900 Subject: Fix for 997888 : Merge into Document Properties (bzr r11374) --- src/ui/dialog/document-properties.cpp | 61 ++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index f45b52f5b..2b322e065 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -42,6 +42,9 @@ #include "xml/node-event-vector.h" #include "xml/repr.h" +#include "rdf.h" +#include "ui/widget/entity-entry.h" + #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #include "color-profile.h" #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -92,6 +95,8 @@ DocumentProperties::DocumentProperties() _page_scripting(1, 1), _page_external_scripts(1, 1), _page_embedded_scripts(1, 1), + _page_metadata1(1, 1), + _page_metadata2(1, 1), //--------------------------------------------------------------- _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), @@ -146,8 +151,10 @@ DocumentProperties::DocumentProperties() _notebook.append_page(_page_guides, _("Guides")); _notebook.append_page(_grids_vbox, _("Grids")); _notebook.append_page(_page_snap, _("Snap")); - _notebook.append_page(_page_cms, _("Color Management")); + _notebook.append_page(_page_cms, _("Color")); _notebook.append_page(_page_scripting, _("Scripting")); + _notebook.append_page(_page_metadata1, _("Metadata")); + _notebook.append_page(_page_metadata2, _("License")); build_page(); build_guides(); @@ -157,6 +164,7 @@ DocumentProperties::DocumentProperties() build_cms(); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) build_scripting(); + build_metadata(); _grids_button_new.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onNewGrid)); _grids_button_remove.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onRemoveGrid)); @@ -185,6 +193,9 @@ DocumentProperties::~DocumentProperties() repr->removeListenerByData (this); Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr(); root->removeListenerByData (this); + + for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it) + delete (*it); } //======================================================================== @@ -726,6 +737,46 @@ void DocumentProperties::build_scripting() _scripts_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_script_lists)); } +void DocumentProperties::build_metadata() +{ + using Inkscape::UI::Widget::EntityEntry; + + _page_metadata1.show(); + + Gtk::Label *label = manage (new Gtk::Label); + label->set_markup (_("Dublin Core Entities")); + label->set_alignment (0.0); + _page_metadata1.table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + /* add generic metadata entry areas */ + struct rdf_work_entity_t * entity; + int row = 1; + for (entity = rdf_work_entities; entity && entity->name; entity++, row++) { + if ( entity->editable == RDF_EDIT_GENERIC ) { + EntityEntry *w = EntityEntry::create (entity, _wr); + _rdflist.push_back (w); + Gtk::HBox *space = manage (new Gtk::HBox); + space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); + _page_metadata1.table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata1.table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata1.table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); + } + } + + _page_metadata2.show(); + + row = 0; + Gtk::Label *llabel = manage (new Gtk::Label); + llabel->set_markup (_("License")); + llabel->set_alignment (0.0); + _page_metadata2.table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + /* add license selector pull-down and URI */ + ++row; + _licensor.init (_wr); + Gtk::HBox *space = manage (new Gtk::HBox); + space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); + _page_metadata2.table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata2.table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); +} void DocumentProperties::addExternalScript(){ SPDesktop *desktop = SP_ACTIVE_DESKTOP; @@ -1069,6 +1120,14 @@ void DocumentProperties::update() populate_available_profiles(); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + //-----------------------------------------------------------meta pages + /* update the RDF entities */ + for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it) + (*it)->update (SP_ACTIVE_DOCUMENT); + + _licensor.update (SP_ACTIVE_DOCUMENT); + + _wr.setUpdating (false); } -- cgit v1.2.3 From 4a942aed31396525e73758b96ed98052eb003557 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 27 May 2012 13:07:47 +0100 Subject: Fix missing gtkmm header in document properties dialog (bzr r11424) --- src/ui/dialog/document-properties.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 2b322e065..f1c01954e 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -50,6 +50,7 @@ #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #include +#include using std::pair; -- cgit v1.2.3 From 9abd33133650d77714fccf09d0c9ff27c9b75a78 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 5 Jul 2012 22:39:08 +0100 Subject: Drop GTK+ 2.20 support. Fixed bugs: - https://launchpad.net/bugs/1020494 (bzr r11529) --- src/ui/dialog/document-properties.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index f1c01954e..0768ec3d9 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -132,18 +132,10 @@ DocumentProperties::DocumentProperties() _rcb_perp(_("Snap perpendicularly"), _("When snapping to paths or guides, then also try snapping perpendicularly"), "inkscape:snap-perpendicular", _wr), _rcb_tang(_("Snap tangentially"), _("When snapping to paths or guides, then also try snapping tangentially"), "inkscape:snap-tangential", _wr), //--------------------------------------------------------------- -#if WITH_GTKMM_2_22 _grids_label_crea("", Gtk::ALIGN_START), -#else - _grids_label_crea("", Gtk::ALIGN_LEFT), -#endif _grids_button_new(C_("Grid", "_New"), _("Create new grid.")), _grids_button_remove(C_("Grid", "_Remove"), _("Remove selected grid.")), -#if WITH_GTKMM_2_22 _grids_label_def("", Gtk::ALIGN_START) -#else - _grids_label_def("", Gtk::ALIGN_LEFT) -#endif { _getContents()->set_spacing (4); _getContents()->pack_start(_notebook, true, true); @@ -533,18 +525,9 @@ void DocumentProperties::removeSelectedProfile(){ void DocumentProperties::build_cms() { _page_cms.show(); - -#if WITH_GTKMM_2_22 Gtk::Label *label_link= manage (new Gtk::Label("", Gtk::ALIGN_START)); -#else - Gtk::Label *label_link= manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); -#endif label_link->set_markup (_("Linked Color Profiles:")); -#if WITH_GTKMM_2_22 Gtk::Label *label_avail = manage (new Gtk::Label("", Gtk::ALIGN_START)); -#else - Gtk::Label *label_avail = manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); -#endif label_avail->set_markup (_("Available Color Profiles:")); _link_btn.set_label(_("Link Profile")); @@ -611,12 +594,7 @@ void DocumentProperties::build_scripting() //# External scripts tab _page_external_scripts.show(); - -#if WITH_GTKMM_2_22 Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_START)); -#else - Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); -#endif label_external->set_markup (_("External script files:")); _add_btn.set_label(_("Add")); @@ -649,12 +627,7 @@ void DocumentProperties::build_scripting() //# Embedded scripts tab _page_embedded_scripts.show(); - -#if WITH_GTKMM_2_22 Gtk::Label *label_embedded= manage (new Gtk::Label("", Gtk::ALIGN_START)); -#else - Gtk::Label *label_embedded= manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); -#endif label_embedded->set_markup (_("Embedded script files:")); _new_btn.set_label(_("New")); @@ -684,11 +657,7 @@ void DocumentProperties::build_scripting() // TODO restore? _EmbeddedScriptsList.set_fixed_height_mode(true); //# Set up the Embedded Scripts content box -#if WITH_GTKMM_2_22 Gtk::Label *label_embedded_content= manage (new Gtk::Label("", Gtk::ALIGN_START)); -#else - Gtk::Label *label_embedded_content= manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); -#endif label_embedded_content->set_markup (_("Content:")); label_embedded_content->set_alignment(0.0); -- cgit v1.2.3 From d3451012446c8039aedd15c57cd6029aad7a6f45 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 12 Jul 2012 11:54:42 +0900 Subject: Fix for 1023656 : Color profile Link/Unlink in Document Properties (bzr r11542) --- src/ui/dialog/document-properties.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 0768ec3d9..25339294d 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -494,6 +494,15 @@ void DocumentProperties::embedded_create_popup_menu(Gtk::Widget& parent, sigc::s _EmbeddedScriptsContextMenu.accelerate(parent); } +void DocumentProperties::onSelectRow() +{ + Glib::RefPtr sel = _LinkedProfilesList.get_selection(); + if (sel) { + _unlink_btn.set_sensitive(sel->count_selected_rows () > 0); + } +} + + void DocumentProperties::removeSelectedProfile(){ Glib::ustring name; if(_LinkedProfilesList.get_selection()) { @@ -520,6 +529,7 @@ void DocumentProperties::removeSelectedProfile(){ } populate_linked_profiles_box(); + onSelectRow(); } void DocumentProperties::build_cms() @@ -530,7 +540,11 @@ void DocumentProperties::build_cms() Gtk::Label *label_avail = manage (new Gtk::Label("", Gtk::ALIGN_START)); label_avail->set_markup (_("Available Color Profiles:")); - _link_btn.set_label(_("Link Profile")); + _link_btn.set_tooltip_text(_("Link Profile")); + _link_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); + + _unlink_btn.set_tooltip_text(_("Unlink Profile")); + _unlink_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); _page_cms.set_spacing(4); gint row = 0; @@ -549,8 +563,9 @@ void DocumentProperties::build_cms() label_avail->set_alignment(0.0); _page_cms.table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_cms.table().attach(_combo_avail, 0, 2, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_cms.table().attach(_link_btn, 2, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_cms.table().attach(_combo_avail, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_cms.table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); + _page_cms.table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); populate_available_profiles(); @@ -570,6 +585,9 @@ void DocumentProperties::build_cms() _LinkedProfilesListScroller.set_size_request(-1, 90); _link_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::linkSelectedProfile)); + _unlink_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::removeSelectedProfile)); + + _LinkedProfilesList.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &DocumentProperties::onSelectRow) ); _LinkedProfilesList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::linked_profiles_list_button_release)); cms_create_popup_menu(_LinkedProfilesList, sigc::mem_fun(*this, &DocumentProperties::removeSelectedProfile)); @@ -579,6 +597,7 @@ void DocumentProperties::build_cms() _emb_profiles_observer.set(SP_OBJECT(current->data)->parent); } _emb_profiles_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_linked_profiles_box)); + onSelectRow(); } #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -- cgit v1.2.3 From 31d213c8d5d01c92b057f656027ba89b0c0155cc Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 12 Jul 2012 16:52:08 +0900 Subject: Fix for 1023655 : IMprovments to Embedded script UI (bzr r11543) --- src/ui/dialog/document-properties.cpp | 139 +++++++++++++++++++++++++++++----- 1 file changed, 122 insertions(+), 17 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 25339294d..0202360d5 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -37,6 +37,7 @@ #include "sp-script.h" #include "ui/widget/color-picker.h" #include "ui/widget/scalar-unit.h" +#include "ui/dialog/filedialog.h" #include "verbs.h" #include "widgets/icon.h" #include "xml/node-event-vector.h" @@ -494,7 +495,7 @@ void DocumentProperties::embedded_create_popup_menu(Gtk::Widget& parent, sigc::s _EmbeddedScriptsContextMenu.accelerate(parent); } -void DocumentProperties::onSelectRow() +void DocumentProperties::onColorProfileSelectRow() { Glib::RefPtr sel = _LinkedProfilesList.get_selection(); if (sel) { @@ -529,7 +530,7 @@ void DocumentProperties::removeSelectedProfile(){ } populate_linked_profiles_box(); - onSelectRow(); + onColorProfileSelectRow(); } void DocumentProperties::build_cms() @@ -587,7 +588,7 @@ void DocumentProperties::build_cms() _link_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::linkSelectedProfile)); _unlink_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::removeSelectedProfile)); - _LinkedProfilesList.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &DocumentProperties::onSelectRow) ); + _LinkedProfilesList.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &DocumentProperties::onColorProfileSelectRow) ); _LinkedProfilesList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::linked_profiles_list_button_release)); cms_create_popup_menu(_LinkedProfilesList, sigc::mem_fun(*this, &DocumentProperties::removeSelectedProfile)); @@ -597,7 +598,7 @@ void DocumentProperties::build_cms() _emb_profiles_observer.set(SP_OBJECT(current->data)->parent); } _emb_profiles_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_linked_profiles_box)); - onSelectRow(); + onColorProfileSelectRow(); } #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -616,7 +617,12 @@ void DocumentProperties::build_scripting() Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_external->set_markup (_("External script files:")); - _add_btn.set_label(_("Add")); + _external_add_btn.set_tooltip_text(_("Link")); + _external_add_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); + + _external_remove_btn.set_tooltip_text(_("Remove")); + _external_remove_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); + _page_external_scripts.set_spacing(4); gint row = 0; @@ -632,8 +638,9 @@ void DocumentProperties::build_scripting() _page_external_scripts.table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_external_scripts.table().attach(_script_entry, 0, 2, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_external_scripts.table().attach(_add_btn, 2, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts.table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts.table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); + _page_external_scripts.table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); row++; //# Set up the External Scripts box @@ -649,7 +656,21 @@ void DocumentProperties::build_scripting() Gtk::Label *label_embedded= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_embedded->set_markup (_("Embedded script files:")); - _new_btn.set_label(_("New")); + _embed_new_btn.set_tooltip_text(_("New")); + _embed_new_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); + + _embed_remove_btn.set_tooltip_text(_("Remove")); + _embed_remove_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); + +#if !WITH_GTKMM_3_0 + // TODO: This has been removed from Gtkmm 3.0. Check that + // everything still looks OK! + _embed_button_box.set_child_min_width( 16 ); + _embed_button_box.set_spacing( 4 ); +#endif + _embed_button_box.set_layout (Gtk::BUTTONBOX_START); + _embed_button_box.add(_embed_new_btn); + _embed_button_box.add(_embed_remove_btn); _page_embedded_scripts.set_spacing(4); row = 0; @@ -660,14 +681,14 @@ void DocumentProperties::build_scripting() _page_embedded_scripts.table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; + _page_embedded_scripts.table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + row++; + Gtk::HBox* spacer_embedded = Gtk::manage(new Gtk::HBox()); spacer_embedded->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); _page_embedded_scripts.table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_embedded_scripts.table().attach(_new_btn, 2, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - row++; - //# Set up the Embedded Scripts box _EmbeddedScriptsListStore = Gtk::ListStore::create(_EmbeddedScriptsListColumns); _EmbeddedScriptsList.set_model(_EmbeddedScriptsListStore); @@ -688,9 +709,13 @@ void DocumentProperties::build_scripting() _EmbeddedContentScroller.add(_EmbeddedContent); _EmbeddedContentScroller.set_shadow_type(Gtk::SHADOW_IN); _EmbeddedContentScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - _EmbeddedContentScroller.set_size_request(-1, -1); + _EmbeddedContentScroller.set_size_request(-1, 140); _EmbeddedScriptsList.signal_cursor_changed().connect(sigc::mem_fun(*this, &DocumentProperties::changeEmbeddedScript)); + _EmbeddedScriptsList.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &DocumentProperties::onEmbeddedScriptSelectRow) ); + + _ExternalScriptsList.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &DocumentProperties::onExternalScriptSelectRow) ); + _EmbeddedContent.get_buffer()->signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::editEmbeddedScript)); populate_script_lists(); @@ -700,17 +725,20 @@ void DocumentProperties::build_scripting() _ExternalScriptsListScroller.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS); _ExternalScriptsListScroller.set_size_request(-1, 90); - _add_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::addExternalScript)); + _external_add_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::addExternalScript)); _EmbeddedScriptsListScroller.add(_EmbeddedScriptsList); _EmbeddedScriptsListScroller.set_shadow_type(Gtk::SHADOW_IN); _EmbeddedScriptsListScroller.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS); _EmbeddedScriptsListScroller.set_size_request(-1, 90); - _new_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::addEmbeddedScript)); - + _embed_new_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::addEmbeddedScript)); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + + _external_remove_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::removeExternalScript)); + _embed_remove_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::removeEmbeddedScript)); + _ExternalScriptsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::external_scripts_list_button_release)); external_create_popup_menu(_ExternalScriptsList, sigc::mem_fun(*this, &DocumentProperties::removeExternalScript)); @@ -724,6 +752,8 @@ void DocumentProperties::build_scripting() _scripts_observer.set(SP_OBJECT(current->data)->parent); } _scripts_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_script_lists)); + onEmbeddedScriptSelectRow(); + onExternalScriptSelectRow(); } void DocumentProperties::build_metadata() @@ -768,10 +798,20 @@ void DocumentProperties::build_metadata() } void DocumentProperties::addExternalScript(){ + SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (!desktop){ + if (!desktop) { g_warning("No active desktop"); - } else { + return; + } + + if (_script_entry.get_text().empty() ) { + // Click Add button with no filename, show a Browse dialog + browseExternalScript(); + } + + if (!_script_entry.get_text().empty()) { + Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); Inkscape::XML::Node *scriptRepr = xml_doc->createElement("svg:script"); scriptRepr->setAttribute("xlink:href", (gchar*) _script_entry.get_text().c_str()); @@ -784,6 +824,55 @@ void DocumentProperties::addExternalScript(){ populate_script_lists(); } + +} + +static Inkscape::UI::Dialog::FileOpenDialog * selectPrefsFileInstance = NULL; + +void DocumentProperties::browseExternalScript() { + + //# Get the current directory for finding files + static Glib::ustring open_path; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + + Glib::ustring attr = prefs->getString(_prefs_path); + if (!attr.empty()) open_path = attr; + + //# Test if the open_path directory exists + if (!Inkscape::IO::file_test(open_path.c_str(), + (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) + open_path = ""; + + //# If no open path, default to our home directory + if (open_path.empty()) + { + open_path = g_get_home_dir(); + open_path.append(G_DIR_SEPARATOR_S); + } + + //# Create a dialog + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + if (!selectPrefsFileInstance) { + selectPrefsFileInstance = + Inkscape::UI::Dialog::FileOpenDialog::create( + *desktop->getToplevel(), + open_path, + Inkscape::UI::Dialog::SVG_TYPES, + _("Select a script to load")); + } + + //# Show the dialog + bool const success = selectPrefsFileInstance->show(); + + if (!success) { + return; + } + + //# User selected something. Get name and type + Glib::ustring fileName = selectPrefsFileInstance->getFilename(); + + _script_entry.set_text(fileName); } void DocumentProperties::addEmbeddedScript(){ @@ -868,6 +957,22 @@ void DocumentProperties::removeEmbeddedScript(){ populate_script_lists(); } +void DocumentProperties::onExternalScriptSelectRow() +{ + Glib::RefPtr sel = _ExternalScriptsList.get_selection(); + if (sel) { + _external_remove_btn.set_sensitive(sel->count_selected_rows () > 0); + } +} + +void DocumentProperties::onEmbeddedScriptSelectRow() +{ + Glib::RefPtr sel = _EmbeddedScriptsList.get_selection(); + if (sel) { + _embed_remove_btn.set_sensitive(sel->count_selected_rows () > 0); + } +} + void DocumentProperties::changeEmbeddedScript(){ Glib::ustring id; if(_EmbeddedScriptsList.get_selection()) { -- cgit v1.2.3 From d9da2a4f178e71f5b33ea158c0631e86220f2e5d Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 12 Jul 2012 17:19:58 +0900 Subject: Fix for 612221 : Add metadata default configuration in the preferences (bzr r11544) --- src/ui/dialog/document-properties.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 0202360d5..71fc3ac1f 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -781,6 +781,20 @@ void DocumentProperties::build_metadata() } } + Gtk::Button *button_save = manage (new Gtk::Button(_("_Save as default"),1)); + button_save->set_tooltip_text(_("Save this metadata as the default metadata")); + Gtk::Button *button_load = manage (new Gtk::Button(_("Use _default"),1)); + button_load->set_tooltip_text(_("Use the previously saved default metadata here")); + Gtk::HButtonBox *box_buttons = manage (new Gtk::HButtonBox); + box_buttons->set_layout(Gtk::BUTTONBOX_END); + box_buttons->set_spacing(4); + box_buttons->pack_start(*button_save, true, true, 6); + box_buttons->pack_start(*button_load, true, true, 6); + _page_metadata1.pack_end(*box_buttons, false, false, 0); + + button_save->signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::save_default_metadata)); + button_load->signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::load_default_metadata)); + _page_metadata2.show(); row = 0; @@ -1257,6 +1271,23 @@ void DocumentProperties::on_response (int id) hide(); } +void DocumentProperties::load_default_metadata() +{ + /* Get the data RDF entities data from preferences*/ + for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it) { + (*it)->load_from_preferences (); + } +} + +void DocumentProperties::save_default_metadata() +{ + /* Save these RDF entities to preferences*/ + for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it) { + (*it)->save_to_preferences (SP_ACTIVE_DOCUMENT); + } +} + + void DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *document) { Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); -- cgit v1.2.3 From 24194964c2c833cf325c5c75dd39f2934fc5ab0e Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 15 Jul 2012 14:51:35 +0900 Subject: Fix for 1023655 : Improvments to Embedded script UI (bzr r11549) --- src/ui/dialog/document-properties.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 71fc3ac1f..2d79c6dd7 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -617,7 +617,7 @@ void DocumentProperties::build_scripting() Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_external->set_markup (_("External script files:")); - _external_add_btn.set_tooltip_text(_("Link")); + _external_add_btn.set_tooltip_text(_("Add the current file name or browse for a file")); _external_add_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); _external_remove_btn.set_tooltip_text(_("Remove")); @@ -872,8 +872,9 @@ void DocumentProperties::browseExternalScript() { Inkscape::UI::Dialog::FileOpenDialog::create( *desktop->getToplevel(), open_path, - Inkscape::UI::Dialog::SVG_TYPES, + Inkscape::UI::Dialog::CUSTOM_TYPE, _("Select a script to load")); + selectPrefsFileInstance->addFilterMenu("Javascript Files", "*.js"); } //# Show the dialog @@ -920,17 +921,19 @@ void DocumentProperties::removeExternalScript(){ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); while ( current ) { - SPObject* obj = SP_OBJECT(current->data); - SPScript* script = (SPScript*) obj; - if (name == script->xlinkhref){ - - //XML Tree being used directly here while it shouldn't be. - Inkscape::XML::Node *repr = obj->getRepr(); - if (repr){ - sp_repr_unparent(repr); - - // inform the document, so we can undo - DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); + if (current->data && SP_IS_OBJECT(current->data)) { + SPObject* obj = SP_OBJECT(current->data); + SPScript* script = (SPScript*) obj; + if (name == script->xlinkhref){ + + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node *repr = obj->getRepr(); + if (repr){ + sp_repr_unparent(repr); + + // inform the document, so we can undo + DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); + } } } current = g_slist_next(current); -- cgit v1.2.3 From 4d7abea0a36f43e1015dd79a9408d3f5ef571b1c Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 1 Sep 2012 17:49:52 +0900 Subject: Fix for 445297 : Page background color label unclear for new users (bzr r11634) --- src/ui/dialog/document-properties.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 2d79c6dd7..c7be0877d 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -103,7 +103,7 @@ DocumentProperties::DocumentProperties() _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), _rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false), - _rcp_bg(_("Back_ground:"), _("Background color"), _("Color and transparency of the page background (also used for bitmap export)"), "pagecolor", "inkscape:pageopacity", _wr), + _rcp_bg(_("Back_ground color:"), _("Background color"), _("Color and transparency of the page background (also used for bitmap export)"), "pagecolor", "inkscape:pageopacity", _wr), _rcp_bord(_("Border _color:"), _("Page border color"), _("Color of the page border"), "bordercolor", "borderopacity", _wr), _rum_deflt(_("Default _units:"), "inkscape:document-units", _wr), _page_sizer(_wr), @@ -248,6 +248,8 @@ void DocumentProperties::build_page() Gtk::Label* label_gen = manage (new Gtk::Label); label_gen->set_markup (_("General")); + Gtk::Label* label_col = manage (new Gtk::Label); + label_col->set_markup (_("Color")); Gtk::Label* label_bor = manage (new Gtk::Label); label_bor->set_markup (_("Border")); Gtk::Label *label_for = manage (new Gtk::Label); @@ -258,6 +260,7 @@ void DocumentProperties::build_page() { label_gen, 0, 0, &_rum_deflt, + label_col, 0, _rcp_bg._label, &_rcp_bg, 0, 0, label_for, 0, -- cgit v1.2.3 From 7c0506c103c881790a2e347e2a68aecdf8935d5c Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 22 Sep 2012 12:27:14 +0900 Subject: Fix for 1014988 : Converts slide widgets to new spin-scale widget (bzr r11691) --- src/ui/dialog/document-properties.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index c7be0877d..7bd1b81c0 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -959,16 +959,18 @@ void DocumentProperties::removeEmbeddedScript(){ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); while ( current ) { - SPObject* obj = SP_OBJECT(current->data); - if (id == obj->getId()){ + if (current->data && SP_IS_OBJECT(current->data)) { + SPObject* obj = SP_OBJECT(current->data); + if (id == obj->getId()){ - //XML Tree being used directly here while it shouldn't be. - Inkscape::XML::Node *repr = obj->getRepr(); - if (repr){ - sp_repr_unparent(repr); + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node *repr = obj->getRepr(); + if (repr){ + sp_repr_unparent(repr); - // inform the document, so we can undo - DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script")); + // inform the document, so we can undo + DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script")); + } } } current = g_slist_next(current); -- cgit v1.2.3 From 3c76aba3f2e1dfe8c0568a7d38a732cd2cf3dd8b Mon Sep 17 00:00:00 2001 From: John Smith Date: Wed, 31 Oct 2012 09:25:06 +0900 Subject: Fix for 1068763 : Opening 'File > Document Properties' dirties current document (bzr r11855) --- src/ui/dialog/document-properties.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 7bd1b81c0..4a6429fc5 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -150,6 +150,7 @@ DocumentProperties::DocumentProperties() _notebook.append_page(_page_metadata1, _("Metadata")); _notebook.append_page(_page_metadata2, _("License")); + _wr.setUpdating (true); build_page(); build_guides(); build_gridspage(); @@ -159,6 +160,7 @@ DocumentProperties::DocumentProperties() #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) build_scripting(); build_metadata(); + _wr.setUpdating (false); _grids_button_new.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onNewGrid)); _grids_button_remove.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onRemoveGrid)); -- cgit v1.2.3 From 03e0575add1aa2830e25176db3fdd950450d8c49 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 7 Nov 2012 21:30:45 +0100 Subject: Fix for Bug #773288 (border options) by demicoder. (bzr r11863) --- src/ui/dialog/document-properties.cpp | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 4a6429fc5..693268b35 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -203,41 +203,36 @@ DocumentProperties::~DocumentProperties() * widget in columns 2-3; (non-0, 0) means label in columns 1-3; and * (non-0, non-0) means two widgets in columns 2 and 3. */ -inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0) +inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) { - for (unsigned i = 0, r = start; i < n; i += 2) - { - if (arr[i] && arr[i+1]) - { - table.attach(*arr[i], 1, 2, r, r+1, - Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); - table.attach(*arr[i+1], 2, 3, r, r+1, - Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); - } - else - { + for (unsigned i = 0, r = start; i < n; i += 2) { + if (arr[i] && arr[i+1]) { + table.attach(*arr[i], 1, 2, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); + table.attach(*arr[i+1], 2, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); + } else { if (arr[i+1]) { Gtk::AttachOptions yoptions = (Gtk::AttachOptions)0; if (dynamic_cast(arr[i+1])) { // only the PageSizer in Document Properties|Page should be stretched vertically yoptions = Gtk::FILL|Gtk::EXPAND; } - table.attach(*arr[i+1], 1, 3, r, r+1, - Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); - } - else if (arr[i]) - { + if (docum_prop_flag) { + if( i==(n-4) || i==(n-6) ) { + table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 20,0); + } else { + table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); + } + } else { + table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); + } + } else if (arr[i]) { Gtk::Label& label = reinterpret_cast(*arr[i]); label.set_alignment (0.0); - table.attach (label, 0, 3, r, r+1, - Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); - } - else - { + table.attach (label, 0, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); + } else { Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - table.attach (*space, 0, 1, r, r+1, - (Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0); + table.attach (*space, 0, 1, r, r+1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0); } } ++r; @@ -275,7 +270,12 @@ void DocumentProperties::build_page() _rcp_bord._label, &_rcp_bord, }; - attach_all(_page_page.table(), widget_array, G_N_ELEMENTS(widget_array)); + std::list _slaveList; + _slaveList.push_back(&_rcb_bord); + _slaveList.push_back(&_rcb_shad); + _rcb_canb.setSlaveWidgets(_slaveList); + + attach_all(_page_page.table(), widget_array, G_N_ELEMENTS(widget_array),0,1); } void DocumentProperties::build_guides() -- cgit v1.2.3 From 15f08c37a261583b138f9cbecd6c271921f4e514 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 15 Nov 2012 11:42:04 +0000 Subject: cppcheck: Simple fixes for src/ui/dialog (bzr r11874) --- src/ui/dialog/document-properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 693268b35..e681147aa 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -928,7 +928,7 @@ void DocumentProperties::removeExternalScript(){ while ( current ) { if (current->data && SP_IS_OBJECT(current->data)) { SPObject* obj = SP_OBJECT(current->data); - SPScript* script = (SPScript*) obj; + SPScript* script = SP_SCRIPT(obj); if (name == script->xlinkhref){ //XML Tree being used directly here while it shouldn't be. @@ -1085,7 +1085,7 @@ void DocumentProperties::populate_script_lists(){ if (current) _scripts_observer.set(SP_OBJECT(current->data)->parent); while ( current ) { SPObject* obj = SP_OBJECT(current->data); - SPScript* script = (SPScript*) obj; + SPScript* script = SP_SCRIPT(obj); if (script->xlinkhref) { Gtk::TreeModel::Row row = *(_ExternalScriptsListStore->append()); -- cgit v1.2.3 From 4af19c56cf90e31a0d800821e8daf7fb08108e94 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Nov 2012 10:33:19 +0000 Subject: Drop support for GTK+ < 2.24 Fixed bugs: - https://launchpad.net/bugs/1069024 (bzr r11907) --- src/ui/dialog/document-properties.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index e681147aa..ab1e8fbd8 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -333,21 +333,13 @@ void DocumentProperties::build_snap() #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /// Populates the available color profiles combo box void DocumentProperties::populate_available_profiles(){ -#if WITH_GTKMM_2_24 _combo_avail.remove_all(); // Clear any existing items in the combo box -#else - _combo_avail.clear_items(); // Clear any existing items in the combo box -#endif // Iterate through the list of profiles and add the name to the combo box. std::vector > pairs = ColorProfile::getProfileFilesWithNames(); for ( std::vector >::const_iterator it = pairs.begin(); it != pairs.end(); ++it ) { Glib::ustring name = it->second; -#if WITH_GTKMM_2_24 _combo_avail.append(name); -#else - _combo_avail.append_text(name); -#endif } } @@ -1160,11 +1152,7 @@ void DocumentProperties::build_gridspage() _grids_hbox_crea.pack_start(_grids_button_new, true, true); for (gint t = 0; t <= GRID_MAXTYPENR; t++) { -#if WITH_GTKMM_2_24 _grids_combo_gridtype.append( CanvasGrid::getName( (GridType) t ) ); -#else - _grids_combo_gridtype.append_text( CanvasGrid::getName( (GridType) t ) ); -#endif } _grids_combo_gridtype.set_active_text( CanvasGrid::getName(GRID_RECTANGULAR) ); -- cgit v1.2.3 From 14463ea4d68a4c70e4b1444843428f8468544106 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 26 Dec 2012 18:41:33 +0100 Subject: Change tooltip to clarify behavior after commit r10784. (bzr r11990) --- src/ui/dialog/document-properties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index ab1e8fbd8..460e223a3 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -103,7 +103,7 @@ DocumentProperties::DocumentProperties() _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), _rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false), - _rcp_bg(_("Back_ground color:"), _("Background color"), _("Color and transparency of the page background (also used for bitmap export)"), "pagecolor", "inkscape:pageopacity", _wr), + _rcp_bg(_("Back_ground color:"), _("Background color"), _("Color of the page background. Note: transparency setting ignored while editing but used when exporting to bitmap."), "pagecolor", "inkscape:pageopacity", _wr), _rcp_bord(_("Border _color:"), _("Page border color"), _("Color of the page border"), "bordercolor", "borderopacity", _wr), _rum_deflt(_("Default _units:"), "inkscape:document-units", _wr), _page_sizer(_wr), -- cgit v1.2.3 From aade0f7b5d272eb8a95b5f5ea6f8978ce24b8a72 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 12 Mar 2013 12:20:04 +0000 Subject: Further migration to Gtk::Grid (bzr r12196) --- src/ui/dialog/document-properties.cpp | 125 +++++++++++++++++----------------- 1 file changed, 63 insertions(+), 62 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 460e223a3..939538d3d 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -22,6 +22,7 @@ # include #endif +#include "ui/widget/notebook-page.h" #include "document-properties.h" #include "display/canvas-grid.h" #include "document.h" @@ -90,15 +91,15 @@ DocumentProperties& DocumentProperties::getInstance() DocumentProperties::DocumentProperties() : UI::Widget::Panel ("", "/dialogs/documentoptions", SP_VERB_DIALOG_NAMEDVIEW), - _page_page(1, 1, true, true), - _page_guides(1, 1), - _page_snap(1, 1), - _page_cms(1, 1), - _page_scripting(1, 1), - _page_external_scripts(1, 1), - _page_embedded_scripts(1, 1), - _page_metadata1(1, 1), - _page_metadata2(1, 1), + _page_page(Gtk::manage(new UI::Widget::NotebookPage(1, 1, true, true))), + _page_guides(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_snap(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_cms(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_scripting(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_external_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_embedded_scripts(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), + _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), //--------------------------------------------------------------- _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), @@ -141,14 +142,14 @@ DocumentProperties::DocumentProperties() _getContents()->set_spacing (4); _getContents()->pack_start(_notebook, true, true); - _notebook.append_page(_page_page, _("Page")); - _notebook.append_page(_page_guides, _("Guides")); + _notebook.append_page(*_page_page, _("Page")); + _notebook.append_page(*_page_guides, _("Guides")); _notebook.append_page(_grids_vbox, _("Grids")); - _notebook.append_page(_page_snap, _("Snap")); - _notebook.append_page(_page_cms, _("Color")); - _notebook.append_page(_page_scripting, _("Scripting")); - _notebook.append_page(_page_metadata1, _("Metadata")); - _notebook.append_page(_page_metadata2, _("License")); + _notebook.append_page(*_page_snap, _("Snap")); + _notebook.append_page(*_page_cms, _("Color")); + _notebook.append_page(*_page_scripting, _("Scripting")); + _notebook.append_page(*_page_metadata1, _("Metadata")); + _notebook.append_page(*_page_metadata2, _("License")); _wr.setUpdating (true); build_page(); @@ -241,7 +242,7 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con void DocumentProperties::build_page() { - _page_page.show(); + _page_page->show(); Gtk::Label* label_gen = manage (new Gtk::Label); label_gen->set_markup (_("General")); @@ -275,12 +276,12 @@ void DocumentProperties::build_page() _slaveList.push_back(&_rcb_shad); _rcb_canb.setSlaveWidgets(_slaveList); - attach_all(_page_page.table(), widget_array, G_N_ELEMENTS(widget_array),0,1); + attach_all(_page_page->table(), widget_array, G_N_ELEMENTS(widget_array),0,1); } void DocumentProperties::build_guides() { - _page_guides.show(); + _page_guides->show(); Gtk::Label *label_gui = manage (new Gtk::Label); label_gui->set_markup (_("Guides")); @@ -293,12 +294,12 @@ void DocumentProperties::build_guides() _rcp_hgui._label, &_rcp_hgui }; - attach_all(_page_guides.table(), widget_array, G_N_ELEMENTS(widget_array)); + attach_all(_page_guides->table(), widget_array, G_N_ELEMENTS(widget_array)); } void DocumentProperties::build_snap() { - _page_snap.show(); + _page_snap->show(); Gtk::Label *label_o = manage (new Gtk::Label); label_o->set_markup (_("Snap to objects")); @@ -327,7 +328,7 @@ void DocumentProperties::build_snap() 0, &_rcb_tang }; - attach_all(_page_snap.table(), array, G_N_ELEMENTS(array)); + attach_all(_page_snap->table(), array, G_N_ELEMENTS(array)); } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -532,7 +533,7 @@ void DocumentProperties::removeSelectedProfile(){ void DocumentProperties::build_cms() { - _page_cms.show(); + _page_cms->show(); Gtk::Label *label_link= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_link->set_markup (_("Linked Color Profiles:")); Gtk::Label *label_avail = manage (new Gtk::Label("", Gtk::ALIGN_START)); @@ -544,26 +545,26 @@ void DocumentProperties::build_cms() _unlink_btn.set_tooltip_text(_("Unlink Profile")); _unlink_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); - _page_cms.set_spacing(4); + _page_cms->set_spacing(4); gint row = 0; label_link->set_alignment(0.0); - _page_cms.table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_cms->table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_cms.table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_cms->table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; Gtk::HBox* spacer = Gtk::manage(new Gtk::HBox()); spacer->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_cms.table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_cms->table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; label_avail->set_alignment(0.0); - _page_cms.table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_cms->table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_cms.table().attach(_combo_avail, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_cms.table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_cms.table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); + _page_cms->table().attach(_combo_avail, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_cms->table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); + _page_cms->table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); populate_available_profiles(); @@ -601,16 +602,16 @@ void DocumentProperties::build_cms() void DocumentProperties::build_scripting() { - _page_scripting.show(); + _page_scripting->show(); - _page_scripting.set_spacing (4); - _page_scripting.pack_start(_scripting_notebook, true, true); + _page_scripting->set_spacing (4); + _page_scripting->pack_start(_scripting_notebook, true, true); - _scripting_notebook.append_page(_page_external_scripts, _("External scripts")); - _scripting_notebook.append_page(_page_embedded_scripts, _("Embedded scripts")); + _scripting_notebook.append_page(*_page_external_scripts, _("External scripts")); + _scripting_notebook.append_page(*_page_embedded_scripts, _("Embedded scripts")); //# External scripts tab - _page_external_scripts.show(); + _page_external_scripts->show(); Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_external->set_markup (_("External script files:")); @@ -621,23 +622,23 @@ void DocumentProperties::build_scripting() _external_remove_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); - _page_external_scripts.set_spacing(4); + _page_external_scripts->set_spacing(4); gint row = 0; label_external->set_alignment(0.0); - _page_external_scripts.table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts->table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_external_scripts.table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; Gtk::HBox* spacer_external = Gtk::manage(new Gtk::HBox()); spacer_external->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_external_scripts.table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts->table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_external_scripts.table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_external_scripts.table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_external_scripts.table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts->table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts->table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); + _page_external_scripts->table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); row++; //# Set up the External Scripts box @@ -649,7 +650,7 @@ void DocumentProperties::build_scripting() //# Embedded scripts tab - _page_embedded_scripts.show(); + _page_embedded_scripts->show(); Gtk::Label *label_embedded= manage (new Gtk::Label("", Gtk::ALIGN_START)); label_embedded->set_markup (_("Embedded script files:")); @@ -669,21 +670,21 @@ void DocumentProperties::build_scripting() _embed_button_box.add(_embed_new_btn); _embed_button_box.add(_embed_remove_btn); - _page_embedded_scripts.set_spacing(4); + _page_embedded_scripts->set_spacing(4); row = 0; label_embedded->set_alignment(0.0); - _page_embedded_scripts.table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_embedded_scripts->table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_embedded_scripts.table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_embedded_scripts.table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_embedded_scripts->table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; Gtk::HBox* spacer_embedded = Gtk::manage(new Gtk::HBox()); spacer_embedded->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_embedded_scripts.table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_embedded_scripts->table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; //# Set up the Embedded Scripts box @@ -698,10 +699,10 @@ void DocumentProperties::build_scripting() label_embedded_content->set_markup (_("Content:")); label_embedded_content->set_alignment(0.0); - _page_embedded_scripts.table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_embedded_scripts->table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_embedded_scripts.table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); _EmbeddedContentScroller.add(_EmbeddedContent); _EmbeddedContentScroller.set_shadow_type(Gtk::SHADOW_IN); @@ -757,12 +758,12 @@ void DocumentProperties::build_metadata() { using Inkscape::UI::Widget::EntityEntry; - _page_metadata1.show(); + _page_metadata1->show(); Gtk::Label *label = manage (new Gtk::Label); label->set_markup (_("Dublin Core Entities")); label->set_alignment (0.0); - _page_metadata1.table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata1->table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); /* add generic metadata entry areas */ struct rdf_work_entity_t * entity; int row = 1; @@ -772,9 +773,9 @@ void DocumentProperties::build_metadata() _rdflist.push_back (w); Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - _page_metadata1.table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); + _page_metadata1->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata1->table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata1->table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); } } @@ -787,25 +788,25 @@ void DocumentProperties::build_metadata() box_buttons->set_spacing(4); box_buttons->pack_start(*button_save, true, true, 6); box_buttons->pack_start(*button_load, true, true, 6); - _page_metadata1.pack_end(*box_buttons, false, false, 0); + _page_metadata1->pack_end(*box_buttons, false, false, 0); button_save->signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::save_default_metadata)); button_load->signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::load_default_metadata)); - _page_metadata2.show(); + _page_metadata2->show(); row = 0; Gtk::Label *llabel = manage (new Gtk::Label); llabel->set_markup (_("License")); llabel->set_alignment (0.0); - _page_metadata2.table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata2->table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); /* add license selector pull-down and URI */ ++row; _licensor.init (_wr); Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - _page_metadata2.table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata2.table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata2->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); + _page_metadata2->table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); } void DocumentProperties::addExternalScript(){ -- cgit v1.2.3 From 14f0801859efb75f61459ab19eb6652afde160a8 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Wed, 13 Mar 2013 11:21:19 +0000 Subject: Migrate remaining dialogs to Gtk::Grid (bzr r12199) --- src/ui/dialog/document-properties.cpp | 243 +++++++++++++++++++++++++++++++++- 1 file changed, 242 insertions(+), 1 deletion(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 939538d3d..045b34814 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -51,8 +51,9 @@ #include "color-profile.h" #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#include #include +#include +#include using std::pair; @@ -204,12 +205,25 @@ DocumentProperties::~DocumentProperties() * widget in columns 2-3; (non-0, 0) means label in columns 1-3; and * (non-0, non-0) means two widgets in columns 2 and 3. */ +#if WITH_GTKMM_3_0 +inline void attach_all(Gtk::Grid &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) +#else inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) +#endif { for (unsigned i = 0, r = start; i < n; i += 2) { if (arr[i] && arr[i+1]) { +#if WITH_GTKMM_3_0 + arr[i]->set_hexpand(); + arr[i+1]->set_hexpand(); + arr[i]->set_valign(Gtk::ALIGN_CENTER); + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + table.attach(*arr[i], 1, r, 1, 1); + table.attach(*arr[i+1], 2, r, 1, 1); +#else table.attach(*arr[i], 1, 2, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); table.attach(*arr[i+1], 2, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } else { if (arr[i+1]) { Gtk::AttachOptions yoptions = (Gtk::AttachOptions)0; @@ -219,21 +233,70 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con } if (docum_prop_flag) { if( i==(n-4) || i==(n-6) ) { +#if WITH_GTKMM_3_0 + arr[i+1]->set_hexpand(); + arr[i+1]->set_margin_left(20); + arr[i+1]->set_margin_right(20); + + if (yoptions & Gtk::EXPAND) + arr[i+1]->set_vexpand(); + else + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + + table.attach(*arr[i+1], 1, r, 2, 1); +#else table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 20,0); +#endif } else { +#if WITH_GTKMM_3_0 + arr[i+1]->set_hexpand(); + + if (yoptions & Gtk::EXPAND) + arr[i+1]->set_vexpand(); + else + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + + table.attach(*arr[i+1], 1, r, 2, 1); +#else table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); +#endif } } else { +#if WITH_GTKMM_3_0 + arr[i+1]->set_hexpand(); + + if (yoptions & Gtk::EXPAND) + arr[i+1]->set_vexpand(); + else + arr[i+1]->set_valign(Gtk::ALIGN_CENTER); + + table.attach(*arr[i+1], 1, r, 2, 1); +#else table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); +#endif } } else if (arr[i]) { Gtk::Label& label = reinterpret_cast(*arr[i]); label.set_alignment (0.0); + +#if WITH_GTKMM_3_0 + label.set_hexpand(); + label.set_valign(Gtk::ALIGN_CENTER); + table.attach(label, 0, r, 3, 1); +#else table.attach (label, 0, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } else { Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); + +#if WITH_GTKMM_3_0 + space->set_halign(Gtk::ALIGN_CENTER); + space->set_valign(Gtk::ALIGN_CENTER); + table.attach(*space, 0, r, 1, 1); +#else table.attach (*space, 0, 1, r, r+1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0); +#endif } } ++r; @@ -549,22 +612,71 @@ void DocumentProperties::build_cms() gint row = 0; label_link->set_alignment(0.0); + +#if WITH_GTKMM_3_0 + label_link->set_hexpand(); + label_link->set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(*label_link, 0, row, 3, 1); +#else _page_cms->table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; + +#if WITH_GTKMM_3_0 + _LinkedProfilesListScroller.set_hexpand(); + _LinkedProfilesListScroller.set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(_LinkedProfilesListScroller, 0, row, 3, 1); +#else _page_cms->table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; Gtk::HBox* spacer = Gtk::manage(new Gtk::HBox()); spacer->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); + +#if WITH_GTKMM_3_0 + spacer->set_hexpand(); + spacer->set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(*spacer, 0, row, 3, 1); +#else _page_cms->table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; label_avail->set_alignment(0.0); + +#if WITH_GTKMM_3_0 + label_avail->set_hexpand(); + label_avail->set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(*label_avail, 0, row, 3, 1); +#else _page_cms->table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; + +#if WITH_GTKMM_3_0 + _combo_avail.set_hexpand(); + _combo_avail.set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(_combo_avail, 0, row, 1, 1); + + _link_btn.set_halign(Gtk::ALIGN_CENTER); + _link_btn.set_valign(Gtk::ALIGN_CENTER); + _link_btn.set_margin_left(2); + _link_btn.set_margin_right(2); + _page_cms->table().attach(_link_btn, 1, row, 1, 1); + + _unlink_btn.set_halign(Gtk::ALIGN_CENTER); + _unlink_btn.set_valign(Gtk::ALIGN_CENTER); + _page_cms->table().attach(_unlink_btn, 2, row, 1, 1); +#else _page_cms->table().attach(_combo_avail, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); _page_cms->table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); _page_cms->table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); +#endif populate_available_profiles(); @@ -626,19 +738,60 @@ void DocumentProperties::build_scripting() gint row = 0; label_external->set_alignment(0.0); + +#if WITH_GTKMM_3_0 + label_external->set_hexpand(); + label_external->set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(*label_external, 0, row, 3, 1); +#else _page_external_scripts->table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; + +#if WITH_GTKMM_3_0 + _ExternalScriptsListScroller.set_hexpand(); + _ExternalScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, row, 3, 1); +#else _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; Gtk::HBox* spacer_external = Gtk::manage(new Gtk::HBox()); spacer_external->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); + +#if WITH_GTKMM_3_0 + spacer_external->set_hexpand(); + spacer_external->set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(*spacer_external, 0, row, 3, 1); +#else _page_external_scripts->table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; +#if WITH_GTKMM_3_0 + _script_entry.set_hexpand(); + _script_entry.set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(_script_entry, 0, row, 1, 1); + + _external_add_btn.set_halign(Gtk::ALIGN_CENTER); + _external_add_btn.set_valign(Gtk::ALIGN_CENTER); + _external_add_btn.set_margin_left(2); + _external_add_btn.set_margin_right(2); + _page_external_scripts->table().attach(_external_add_btn, 1, row, 1, 1); + + _external_remove_btn.set_halign(Gtk::ALIGN_CENTER); + _external_remove_btn.set_valign(Gtk::ALIGN_CENTER); + _page_external_scripts->table().attach(_external_remove_btn, 2, row, 1, 1); +#else _page_external_scripts->table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); _page_external_scripts->table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); _page_external_scripts->table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; //# Set up the External Scripts box @@ -674,17 +827,48 @@ void DocumentProperties::build_scripting() row = 0; label_embedded->set_alignment(0.0); + +#if WITH_GTKMM_3_0 + label_embedded->set_hexpand(); + label_embedded->set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(*label_embedded, 0, row, 3, 1); +#else _page_embedded_scripts->table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; + +#if WITH_GTKMM_3_0 + _EmbeddedScriptsListScroller.set_hexpand(); + _EmbeddedScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, row, 3, 1); +#else _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; +#if WITH_GTKMM_3_0 + _embed_button_box.set_hexpand(); + _embed_button_box.set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(_embed_button_box, 0, row, 1, 1); +#else _page_embedded_scripts->table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; Gtk::HBox* spacer_embedded = Gtk::manage(new Gtk::HBox()); spacer_embedded->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); + +#if WITH_GTKMM_3_0 + spacer_embedded->set_hexpand(); + spacer_embedded->set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(*spacer_embedded, 0, row, 3, 1); +#else _page_embedded_scripts->table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; //# Set up the Embedded Scripts box @@ -699,10 +883,24 @@ void DocumentProperties::build_scripting() label_embedded_content->set_markup (_("Content:")); label_embedded_content->set_alignment(0.0); + +#if WITH_GTKMM_3_0 + label_embedded_content->set_hexpand(); + label_embedded_content->set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(*label_embedded_content, 0, row, 3, 1); +#else _page_embedded_scripts->table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif + row++; +#if WITH_GTKMM_3_0 + _EmbeddedContentScroller.set_hexpand(); + _EmbeddedContentScroller.set_valign(Gtk::ALIGN_CENTER); + _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, row, 3, 1); +#else _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); +#endif _EmbeddedContentScroller.add(_EmbeddedContent); _EmbeddedContentScroller.set_shadow_type(Gtk::SHADOW_IN); @@ -763,7 +961,14 @@ void DocumentProperties::build_metadata() Gtk::Label *label = manage (new Gtk::Label); label->set_markup (_("Dublin Core Entities")); label->set_alignment (0.0); + +#if WITH_GTKMM_3_0 + label->set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach (*label, 0,0,3,1); +#else _page_metadata1->table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); +#endif + /* add generic metadata entry areas */ struct rdf_work_entity_t * entity; int row = 1; @@ -773,9 +978,22 @@ void DocumentProperties::build_metadata() _rdflist.push_back (w); Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); + +#if WITH_GTKMM_3_0 + space->set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach(*space, 0, row, 1, 1); + + w->_label.set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach(w->_label, 1, row, 1, 1); + + w->_packable->set_hexpand(); + w->_packable->set_valign(Gtk::ALIGN_CENTER); + _page_metadata1->table().attach(*w->_packable, 2, row, 1, 1); +#else _page_metadata1->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); _page_metadata1->table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); _page_metadata1->table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } } @@ -783,7 +1001,13 @@ void DocumentProperties::build_metadata() button_save->set_tooltip_text(_("Save this metadata as the default metadata")); Gtk::Button *button_load = manage (new Gtk::Button(_("Use _default"),1)); button_load->set_tooltip_text(_("Use the previously saved default metadata here")); + +#if WITH_GTKMM_3_0 + Gtk::ButtonBox *box_buttons = manage (new Gtk::ButtonBox); +#else Gtk::HButtonBox *box_buttons = manage (new Gtk::HButtonBox); +#endif + box_buttons->set_layout(Gtk::BUTTONBOX_END); box_buttons->set_spacing(4); box_buttons->pack_start(*button_save, true, true, 6); @@ -799,14 +1023,31 @@ void DocumentProperties::build_metadata() Gtk::Label *llabel = manage (new Gtk::Label); llabel->set_markup (_("License")); llabel->set_alignment (0.0); + +#if WITH_GTKMM_3_0 + llabel->set_valign(Gtk::ALIGN_CENTER); + _page_metadata2->table().attach(*llabel, 0, row, 3, 1); +#else _page_metadata2->table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); +#endif + /* add license selector pull-down and URI */ ++row; _licensor.init (_wr); Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); + +#if WITH_GTKMM_3_0 + space->set_valign(Gtk::ALIGN_CENTER); + _page_metadata2->table().attach(*space, 0, row, 1, 1); + + _licensor.set_hexpand(); + _licensor.set_valign(Gtk::ALIGN_CENTER); + _page_metadata2->table().attach(_licensor, 1, row, 3, 1); +#else _page_metadata2->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); _page_metadata2->table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); +#endif } void DocumentProperties::addExternalScript(){ -- cgit v1.2.3 From f6c82a02188953dcb6d2119123ffc0aaa8d35010 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sat, 16 Mar 2013 20:42:47 +0100 Subject: cppcheck (bzr r12217) --- src/ui/dialog/document-properties.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 045b34814..d335fb303 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -792,8 +792,6 @@ void DocumentProperties::build_scripting() _page_external_scripts->table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); #endif - row++; - //# Set up the External Scripts box _ExternalScriptsListStore = Gtk::ListStore::create(_ExternalScriptsListColumns); _ExternalScriptsList.set_model(_ExternalScriptsListStore); -- cgit v1.2.3 From 8de8047c5e30af8598646d7a66c62dbf290f7c51 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Wed, 10 Apr 2013 16:10:04 +0200 Subject: Removed old SPObject factory. (bzr r11608.1.91) --- src/ui/dialog/document-properties.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index d335fb303..043100488 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -33,7 +33,6 @@ #include "io/sys.h" #include "preferences.h" #include "sp-namedview.h" -#include "sp-object-repr.h" #include "sp-root.h" #include "sp-script.h" #include "ui/widget/color-picker.h" -- cgit v1.2.3 From 9dc7b786c9ef31060012ea4ae13a8188548b4f62 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 9 Jul 2013 16:42:04 -0400 Subject: Ported sp-namedview.cpp (todo: fix a bunch of things). (bzr r12380.1.8) --- src/ui/dialog/document-properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index d335fb303..af462a1df 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1431,8 +1431,8 @@ void DocumentProperties::update() _rcp_bord.setRgba32 (nv->bordercolor); _rcb_shad.setActive (nv->showpageshadow); - if (nv->doc_units) - _rum_deflt.setUnit (nv->doc_units); + //if (nv->doc_units) + // _rum_deflt.setUnit (nv->doc_units); double const doc_w_px = sp_desktop_document(dt)->getWidth(); double const doc_h_px = sp_desktop_document(dt)->getHeight(); -- cgit v1.2.3 From 231a793d4d28f83b55fe9104a6593d72bca75219 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Fri, 19 Jul 2013 14:32:09 -0400 Subject: Removed "helper/units.h" from "ui/dialog/document-properties.cpp". (bzr r12380.1.33) --- src/ui/dialog/document-properties.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index af462a1df..77fb182e5 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -28,7 +28,6 @@ #include "document.h" #include "desktop-handles.h" #include "desktop.h" -#include "helper/units.h" #include "inkscape.h" #include "io/sys.h" #include "preferences.h" @@ -1431,8 +1430,8 @@ void DocumentProperties::update() _rcp_bord.setRgba32 (nv->bordercolor); _rcb_shad.setActive (nv->showpageshadow); - //if (nv->doc_units) - // _rum_deflt.setUnit (nv->doc_units); + if (nv->doc_units) + _rum_deflt.setUnit (nv->doc_units->abbr); double const doc_w_px = sp_desktop_document(dt)->getWidth(); double const doc_h_px = sp_desktop_document(dt)->getHeight(); -- cgit v1.2.3 From 77f61343ff18f29f05331131c2fe2bd810a64498 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sun, 25 Aug 2013 19:42:22 -0400 Subject: Use real world units for page sizes. (bzr r12475.1.1) --- src/ui/dialog/document-properties.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 77fb182e5..430f28474 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1433,9 +1433,33 @@ void DocumentProperties::update() if (nv->doc_units) _rum_deflt.setUnit (nv->doc_units->abbr); - double const doc_w_px = sp_desktop_document(dt)->getWidth(); - double const doc_h_px = sp_desktop_document(dt)->getHeight(); - _page_sizer.setDim (doc_w_px, doc_h_px); + double const doc_w = sp_desktop_document(dt)->getRoot()->width.value; + Glib::ustring doc_w_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->width.unit).abbr; + if (doc_w_unit == "") { + if (nv->units) { + doc_w_unit = nv->units->abbr; + } else { + if (nv->doc_units) { + doc_w_unit = nv->doc_units->abbr; + } else { + doc_w_unit = "px"; + } + } + } + double const doc_h = sp_desktop_document(dt)->getRoot()->height.value; + Glib::ustring doc_h_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->height.unit).abbr; + if (doc_h_unit == "") { + if (nv->units) { + doc_h_unit = nv->units->abbr; + } else { + if (nv->doc_units) { + doc_h_unit = nv->doc_units->abbr; + } else { + doc_h_unit = "px"; + } + } + } + _page_sizer.setDim(Inkscape::Util::Quantity(doc_w, doc_w_unit), Inkscape::Util::Quantity(doc_h, doc_h_unit)); _page_sizer.updateFitMarginsUI(nv->getRepr()); //-----------------------------------------------------------guide page -- cgit v1.2.3 From f10048be170a45921ae8fc65ccd2588a9ad2897d Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 27 Aug 2013 12:32:55 -0400 Subject: Added viewBox implement document unit support. (bzr r12475.1.2) --- src/ui/dialog/document-properties.cpp | 43 ++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 430f28474..272b85d2a 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -54,6 +54,8 @@ #include #include +#include <2geom/transforms.h> + using std::pair; namespace Inkscape { @@ -169,6 +171,9 @@ DocumentProperties::DocumentProperties() signalDocumentReplaced().connect(sigc::mem_fun(*this, &DocumentProperties::_handleDocumentReplaced)); signalActivateDesktop().connect(sigc::mem_fun(*this, &DocumentProperties::_handleActivateDesktop)); signalDeactiveDesktop().connect(sigc::mem_fun(*this, &DocumentProperties::_handleDeactivateDesktop)); + + _rum_deflt.getUnitMenu()->signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::onDocUnitChange)); + _old_doc_unit = _rum_deflt.getUnit(); } void DocumentProperties::init() @@ -1436,28 +1441,12 @@ void DocumentProperties::update() double const doc_w = sp_desktop_document(dt)->getRoot()->width.value; Glib::ustring doc_w_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->width.unit).abbr; if (doc_w_unit == "") { - if (nv->units) { - doc_w_unit = nv->units->abbr; - } else { - if (nv->doc_units) { - doc_w_unit = nv->doc_units->abbr; - } else { - doc_w_unit = "px"; - } - } + doc_w_unit = "px"; } double const doc_h = sp_desktop_document(dt)->getRoot()->height.value; Glib::ustring doc_h_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->height.unit).abbr; if (doc_h_unit == "") { - if (nv->units) { - doc_h_unit = nv->units->abbr; - } else { - if (nv->doc_units) { - doc_h_unit = nv->doc_units->abbr; - } else { - doc_h_unit = "px"; - } - } + doc_h_unit = "px"; } _page_sizer.setDim(Inkscape::Util::Quantity(doc_w, doc_w_unit), Inkscape::Util::Quantity(doc_h, doc_h_unit)); _page_sizer.updateFitMarginsUI(nv->getRepr()); @@ -1642,6 +1631,24 @@ void DocumentProperties::onRemoveGrid() } } +/** Callback for document unit change. */ +void DocumentProperties::onDocUnitChange() +{ + SPDocument *doc = SP_ACTIVE_DOCUMENT; + Inkscape::Util::Unit doc_unit = _rum_deflt.getUnit(); + + // Set viewBox + Inkscape::Util::Quantity width = doc->getWidth(); + Inkscape::Util::Quantity height = doc->getHeight(); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, width.value(doc_unit), height.value(doc_unit))); + + // Scale and translate objects + gdouble scale = Inkscape::Util::Quantity::convert(1, _old_doc_unit, doc_unit); + doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); + + _old_doc_unit = doc_unit; + DocumentUndo::done(doc, SP_VERB_NONE, _("Changed document unit")); +} } // namespace Dialog } // namespace UI -- cgit v1.2.3 From 0661bbe927d7847e2d88c3f4ec51e59a549f8c78 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Wed, 11 Sep 2013 18:47:47 -0400 Subject: Fix document unit change undo bug. (bzr r12475.1.14) --- src/ui/dialog/document-properties.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 272b85d2a..a2712bf68 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -35,6 +35,7 @@ #include "sp-object-repr.h" #include "sp-root.h" #include "sp-script.h" +#include "svg/stringstream.h" #include "ui/widget/color-picker.h" #include "ui/widget/scalar-unit.h" #include "ui/dialog/filedialog.h" @@ -172,6 +173,7 @@ DocumentProperties::DocumentProperties() signalActivateDesktop().connect(sigc::mem_fun(*this, &DocumentProperties::_handleActivateDesktop)); signalDeactiveDesktop().connect(sigc::mem_fun(*this, &DocumentProperties::_handleDeactivateDesktop)); + _rum_deflt._changed_connection.block(); _rum_deflt.getUnitMenu()->signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::onDocUnitChange)); _old_doc_unit = _rum_deflt.getUnit(); } @@ -1637,6 +1639,17 @@ void DocumentProperties::onDocUnitChange() SPDocument *doc = SP_ACTIVE_DOCUMENT; Inkscape::Util::Unit doc_unit = _rum_deflt.getUnit(); + // Don't execute when change is being undone + if (!DocumentUndo::getUndoSensitive(doc)) { + return; + } + + // Set document unit + Inkscape::SVGOStringStream os; + os << doc_unit.abbr; + Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); + repr->setAttribute("inkscape:document-units", os.str().c_str()); + // Set viewBox Inkscape::Util::Quantity width = doc->getWidth(); Inkscape::Util::Quantity height = doc->getHeight(); @@ -1646,6 +1659,8 @@ void DocumentProperties::onDocUnitChange() gdouble scale = Inkscape::Util::Quantity::convert(1, _old_doc_unit, doc_unit); doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); + doc->setModifiedSinceSave(); + _old_doc_unit = doc_unit; DocumentUndo::done(doc, SP_VERB_NONE, _("Changed document unit")); } -- cgit v1.2.3 From 93167c446a8a8e5574e94cda37dc91c17072513b Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Wed, 11 Sep 2013 19:35:54 -0400 Subject: Finish fixing document unit change undo bug. (bzr r12475.1.15) --- src/ui/dialog/document-properties.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index a2712bf68..1b2761b13 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -175,7 +175,6 @@ DocumentProperties::DocumentProperties() _rum_deflt._changed_connection.block(); _rum_deflt.getUnitMenu()->signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::onDocUnitChange)); - _old_doc_unit = _rum_deflt.getUnit(); } void DocumentProperties::init() @@ -1637,6 +1636,11 @@ void DocumentProperties::onRemoveGrid() void DocumentProperties::onDocUnitChange() { SPDocument *doc = SP_ACTIVE_DOCUMENT; + Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); + Inkscape::Util::Unit old_doc_unit = unit_table.getUnit("px"); + if(repr->attribute("inkscape:document-units")) { + old_doc_unit = unit_table.getUnit(repr->attribute("inkscape:document-units")); + } Inkscape::Util::Unit doc_unit = _rum_deflt.getUnit(); // Don't execute when change is being undone @@ -1647,7 +1651,6 @@ void DocumentProperties::onDocUnitChange() // Set document unit Inkscape::SVGOStringStream os; os << doc_unit.abbr; - Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); repr->setAttribute("inkscape:document-units", os.str().c_str()); // Set viewBox @@ -1656,12 +1659,11 @@ void DocumentProperties::onDocUnitChange() doc->setViewBox(Geom::Rect::from_xywh(0, 0, width.value(doc_unit), height.value(doc_unit))); // Scale and translate objects - gdouble scale = Inkscape::Util::Quantity::convert(1, _old_doc_unit, doc_unit); + gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit); doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); doc->setModifiedSinceSave(); - _old_doc_unit = doc_unit; DocumentUndo::done(doc, SP_VERB_NONE, _("Changed document unit")); } -- cgit v1.2.3 From 09c1fee60bcd713fe66178021053d59e3f649660 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sat, 14 Sep 2013 16:37:55 -0400 Subject: Fix bug with tool handles during document unit change. (bzr r12475.1.17) --- src/ui/dialog/document-properties.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 1b2761b13..0c39876ea 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -31,11 +31,13 @@ #include "inkscape.h" #include "io/sys.h" #include "preferences.h" +#include "shape-editor.h" #include "sp-namedview.h" #include "sp-object-repr.h" #include "sp-root.h" #include "sp-script.h" #include "svg/stringstream.h" +#include "tools-switch.h" #include "ui/widget/color-picker.h" #include "ui/widget/scalar-unit.h" #include "ui/dialog/filedialog.h" @@ -1658,9 +1660,16 @@ void DocumentProperties::onDocUnitChange() Inkscape::Util::Quantity height = doc->getHeight(); doc->setViewBox(Geom::Rect::from_xywh(0, 0, width.value(doc_unit), height.value(doc_unit))); + // TODO: Fix bug in nodes tool instead of switching away from it + if (tools_active(getDesktop()) == TOOLS_NODES) { + tools_switch(getDesktop(), TOOLS_SELECT); + } + // Scale and translate objects gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit); + ShapeEditor::blockSetItem(true); doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); + ShapeEditor::blockSetItem(false); doc->setModifiedSinceSave(); -- cgit v1.2.3 From 37b7de3efa31c7aa3094aed7c849a08e7f7bedfd Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sun, 22 Sep 2013 20:26:44 -0400 Subject: Fix percentage document size handling. Fixed bugs: - https://launchpad.net/bugs/1228852 (bzr r12577) --- src/ui/dialog/document-properties.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index ec04f6d98..37d0ce213 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1440,15 +1440,21 @@ void DocumentProperties::update() if (nv->doc_units) _rum_deflt.setUnit (nv->doc_units->abbr); - double const doc_w = sp_desktop_document(dt)->getRoot()->width.value; + double doc_w = sp_desktop_document(dt)->getRoot()->width.value; Glib::ustring doc_w_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->width.unit).abbr; if (doc_w_unit == "") { doc_w_unit = "px"; + } else if (doc_w_unit == "%" && sp_desktop_document(dt)->getRoot()->viewBox_set) { + doc_w_unit = "px"; + doc_w = sp_desktop_document(dt)->getRoot()->viewBox.width(); } - double const doc_h = sp_desktop_document(dt)->getRoot()->height.value; + double doc_h = sp_desktop_document(dt)->getRoot()->height.value; Glib::ustring doc_h_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->height.unit).abbr; if (doc_h_unit == "") { doc_h_unit = "px"; + } else if (doc_h_unit == "%" && sp_desktop_document(dt)->getRoot()->viewBox_set) { + doc_h_unit = "px"; + doc_h = sp_desktop_document(dt)->getRoot()->viewBox.height(); } _page_sizer.setDim(Inkscape::Util::Quantity(doc_w, doc_w_unit), Inkscape::Util::Quantity(doc_h, doc_h_unit)); _page_sizer.updateFitMarginsUI(nv->getRepr()); -- cgit v1.2.3 From a970dc423d59ea844bdb1af48d5d9419a5e2a287 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 13 Oct 2013 00:24:05 +0200 Subject: Units: stop newing Unit objects. pass around pointers to "undeletable" Unit objects in the UnitTable. I think we should move to using indexed units, and pass around the index of the unit in the unittable, or smth like that... ? (bzr r12679) --- src/ui/dialog/document-properties.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 37d0ce213..a6019c55c 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1441,7 +1441,7 @@ void DocumentProperties::update() _rum_deflt.setUnit (nv->doc_units->abbr); double doc_w = sp_desktop_document(dt)->getRoot()->width.value; - Glib::ustring doc_w_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->width.unit).abbr; + Glib::ustring doc_w_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->width.unit)->abbr; if (doc_w_unit == "") { doc_w_unit = "px"; } else if (doc_w_unit == "%" && sp_desktop_document(dt)->getRoot()->viewBox_set) { @@ -1449,7 +1449,7 @@ void DocumentProperties::update() doc_w = sp_desktop_document(dt)->getRoot()->viewBox.width(); } double doc_h = sp_desktop_document(dt)->getRoot()->height.value; - Glib::ustring doc_h_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->height.unit).abbr; + Glib::ustring doc_h_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->height.unit)->abbr; if (doc_h_unit == "") { doc_h_unit = "px"; } else if (doc_h_unit == "%" && sp_desktop_document(dt)->getRoot()->viewBox_set) { @@ -1644,11 +1644,11 @@ void DocumentProperties::onDocUnitChange() { SPDocument *doc = SP_ACTIVE_DOCUMENT; Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); - Inkscape::Util::Unit old_doc_unit = unit_table.getUnit("px"); + Inkscape::Util::Unit const *old_doc_unit = unit_table.getUnit("px"); if(repr->attribute("inkscape:document-units")) { old_doc_unit = unit_table.getUnit(repr->attribute("inkscape:document-units")); } - Inkscape::Util::Unit doc_unit = _rum_deflt.getUnit(); + Inkscape::Util::Unit const *doc_unit = _rum_deflt.getUnit(); // Don't execute when change is being undone if (!DocumentUndo::getUndoSensitive(doc)) { @@ -1657,7 +1657,7 @@ void DocumentProperties::onDocUnitChange() // Set document unit Inkscape::SVGOStringStream os; - os << doc_unit.abbr; + os << doc_unit->abbr; repr->setAttribute("inkscape:document-units", os.str().c_str()); // Set viewBox -- cgit v1.2.3 From 9d9ccc30701f097976549dd44b36a4b711c46091 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 25 Oct 2013 16:51:35 +0200 Subject: don't update doc unit stuff when initializing DocumentProperties dialog widgets (bzr r12724) --- src/ui/dialog/document-properties.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index a6019c55c..79fb953ac 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -173,7 +173,7 @@ DocumentProperties::DocumentProperties() signalDocumentReplaced().connect(sigc::mem_fun(*this, &DocumentProperties::_handleDocumentReplaced)); signalActivateDesktop().connect(sigc::mem_fun(*this, &DocumentProperties::_handleActivateDesktop)); signalDeactiveDesktop().connect(sigc::mem_fun(*this, &DocumentProperties::_handleDeactivateDesktop)); - + _rum_deflt._changed_connection.block(); _rum_deflt.getUnitMenu()->signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::onDocUnitChange)); } @@ -1437,8 +1437,9 @@ void DocumentProperties::update() _rcp_bord.setRgba32 (nv->bordercolor); _rcb_shad.setActive (nv->showpageshadow); - if (nv->doc_units) + if (nv->doc_units) { _rum_deflt.setUnit (nv->doc_units->abbr); + } double doc_w = sp_desktop_document(dt)->getRoot()->width.value; Glib::ustring doc_w_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->width.unit)->abbr; @@ -1643,18 +1644,23 @@ void DocumentProperties::onRemoveGrid() void DocumentProperties::onDocUnitChange() { SPDocument *doc = SP_ACTIVE_DOCUMENT; + // Don't execute when change is being undone + if (!DocumentUndo::getUndoSensitive(doc)) { + return; + } + // Don't execute when initializing widgets + if (_wr.isUpdating()) { + return; + } + + Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); Inkscape::Util::Unit const *old_doc_unit = unit_table.getUnit("px"); if(repr->attribute("inkscape:document-units")) { old_doc_unit = unit_table.getUnit(repr->attribute("inkscape:document-units")); } Inkscape::Util::Unit const *doc_unit = _rum_deflt.getUnit(); - - // Don't execute when change is being undone - if (!DocumentUndo::getUndoSensitive(doc)) { - return; - } - + // Set document unit Inkscape::SVGOStringStream os; os << doc_unit->abbr; -- cgit v1.2.3 From 138860b79be002985106f1d2c9499ab763c6858e Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Tue, 29 Oct 2013 22:28:45 +0100 Subject: units: fix stroke/gradient/whatever scaling when changing document unit in the document properties dialog (bzr r12749) --- src/ui/dialog/document-properties.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 79fb953ac..32f23d55f 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1677,11 +1677,31 @@ void DocumentProperties::onDocUnitChange() } // Scale and translate objects - gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit); - ShapeEditor::blockSetItem(true); - doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); - ShapeEditor::blockSetItem(false); - + // set transform options to scale all things with the transform, so all things scale properly after the viewbox change. + /// \todo this "low-level" code of changing viewbox/unit should be moved somewhere else + + // save prefs + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool transform_stroke = prefs->getBool("/options/transform/stroke", true); + bool transform_rectcorners = prefs->getBool("/options/transform/rectcorners", true); + bool transform_pattern = prefs->getBool("/options/transform/pattern", true); + bool transform_gradient = prefs->getBool("/options/transform/gradient", true); + + prefs->setBool("/options/transform/stroke", true); + prefs->setBool("/options/transform/rectcorners", true); + prefs->setBool("/options/transform/pattern", true); + prefs->setBool("/options/transform/gradient", true); + { + ShapeEditor::blockSetItem(true); + gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit); + doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); + ShapeEditor::blockSetItem(false); + } + prefs->setBool("/options/transform/stroke", transform_stroke); + prefs->setBool("/options/transform/rectcorners", transform_rectcorners); + prefs->setBool("/options/transform/pattern", transform_pattern); + prefs->setBool("/options/transform/gradient", transform_gradient); + doc->setModifiedSinceSave(); DocumentUndo::done(doc, SP_VERB_NONE, _("Changed document unit")); -- cgit v1.2.3 From c862d2996b29dcace346d6c2e746672fd9d1949d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 2 Jan 2014 17:34:58 +0000 Subject: Fix Gtk+ 3.10 warnings: GtkStockItem is deprecated (bzr r12868) --- src/ui/dialog/document-properties.cpp | 50 ++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 32f23d55f..d324d2d1b 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -57,6 +57,7 @@ #include #include <2geom/transforms.h> +#include "ui/icon-names.h" using std::pair; @@ -609,10 +610,22 @@ void DocumentProperties::build_cms() label_avail->set_markup (_("Available Color Profiles:")); _link_btn.set_tooltip_text(_("Link Profile")); - _link_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _link_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_link = Gtk::manage(new Gtk::Image()); + image_link->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _link_btn.set_image(*image_link); +#endif _unlink_btn.set_tooltip_text(_("Unlink Profile")); - _unlink_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _unlink_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_unlink = Gtk::manage(new Gtk::Image()); + image_unlink->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _unlink_btn.set_image(*image_unlink); +#endif _page_cms->set_spacing(4); gint row = 0; @@ -734,11 +747,22 @@ void DocumentProperties::build_scripting() label_external->set_markup (_("External script files:")); _external_add_btn.set_tooltip_text(_("Add the current file name or browse for a file")); - _external_add_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _external_add_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_ext_add = Gtk::manage(new Gtk::Image()); + image_ext_add->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _external_add_btn.set_image(*image_ext_add); +#endif _external_remove_btn.set_tooltip_text(_("Remove")); - _external_remove_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); - +#if GTK_CHECK_VERSION(3,10,0) + _external_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_ext_rm = Gtk::manage(new Gtk::Image()); + image_ext_rm->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _external_remove_btn.set_image(*image_ext_rm); +#endif _page_external_scripts->set_spacing(4); gint row = 0; @@ -812,10 +836,22 @@ void DocumentProperties::build_scripting() label_embedded->set_markup (_("Embedded script files:")); _embed_new_btn.set_tooltip_text(_("New")); - _embed_new_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _embed_new_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_embed_new = Gtk::manage(new Gtk::Image()); + image_embed_new->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _embed_new_btn.set_image(*image_embed_new); +#endif _embed_remove_btn.set_tooltip_text(_("Remove")); - _embed_remove_btn.set_image(*manage(Glib::wrap(gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) ))); +#if GTK_CHECK_VERSION(3,10,0) + _embed_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); +#else + Gtk::Image *image_embed_rm = Gtk::manage(new Gtk::Image()); + image_embed_rm->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); + _embed_remove_btn.set_image(*image_embed_rm); +#endif #if !WITH_GTKMM_3_0 // TODO: This has been removed from Gtkmm 3.0. Check that -- cgit v1.2.3 From ae57812b967d6d67ecb223537216e98d055c170e Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Mon, 17 Feb 2014 13:53:01 -0500 Subject: scaling of viewBox on document unit change (Bug 1236257) Fixed bugs: - https://launchpad.net/bugs/1236257 (bzr r13034) --- src/ui/dialog/document-properties.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index d324d2d1b..d344fb1d6 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1703,9 +1703,14 @@ void DocumentProperties::onDocUnitChange() repr->setAttribute("inkscape:document-units", os.str().c_str()); // Set viewBox - Inkscape::Util::Quantity width = doc->getWidth(); - Inkscape::Util::Quantity height = doc->getHeight(); - doc->setViewBox(Geom::Rect::from_xywh(0, 0, width.value(doc_unit), height.value(doc_unit))); + if (doc->getRoot()->viewBox_set) { + gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit); + doc->setViewBox(doc->getRoot()->viewBox*Geom::Scale(scale)); + } else { + Inkscape::Util::Quantity width = doc->getWidth(); + Inkscape::Util::Quantity height = doc->getHeight(); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, width.value(doc_unit), height.value(doc_unit))); + } // TODO: Fix bug in nodes tool instead of switching away from it if (tools_active(getDesktop()) == TOOLS_NODES) { -- cgit v1.2.3 From b3dad97ff32d34dc38ce51ebbdc0e9555a9ce5e6 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sat, 22 Feb 2014 16:37:43 -0500 Subject: offset of viewBox on document unit change (Bug 1280684) Fixed bugs: - https://launchpad.net/bugs/1280684 (bzr r13050) --- src/ui/dialog/document-properties.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index d344fb1d6..0411c789c 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1734,8 +1734,14 @@ void DocumentProperties::onDocUnitChange() prefs->setBool("/options/transform/gradient", true); { ShapeEditor::blockSetItem(true); + gdouble viewscale = doc->getWidth().value("px")/doc->getRoot()->viewBox.width(); + if (doc->getHeight().value("px")/doc->getRoot()->viewBox.height() < viewscale) + viewscale = doc->getHeight().value("px")/doc->getRoot()->viewBox.height(); gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit); - doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); + doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(-viewscale*doc->getRoot()->viewBox.min()[Geom::X] + + (doc->getWidth().value("px") - viewscale*doc->getRoot()->viewBox.width())/2, + viewscale*doc->getRoot()->viewBox.min()[Geom::Y] + + (doc->getHeight().value("px") + viewscale*doc->getRoot()->viewBox.height())/2)); ShapeEditor::blockSetItem(false); } prefs->setBool("/options/transform/stroke", transform_stroke); -- cgit v1.2.3 From e7a3f5b74d1f5a95390ee95b06371d184c1812f7 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 13 Mar 2014 05:45:38 +0100 Subject: Provide a toggle in the document properties to optionally turn off antialiasing for display and export. Fixes a nearly 10 year old bug #170356 Fixed bugs: - https://launchpad.net/bugs/170356 (bzr r13144) --- src/ui/dialog/document-properties.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 0411c789c..ef7c9ee1d 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -106,6 +106,7 @@ DocumentProperties::DocumentProperties() _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), //--------------------------------------------------------------- + _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "inkscape:antialiasing", _wr, false), _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), _rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false), @@ -239,7 +240,8 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con yoptions = Gtk::FILL|Gtk::EXPAND; } if (docum_prop_flag) { - if( i==(n-4) || i==(n-6) ) { + // this sets the padding for subordinate widgets on the "Page" page + if( i==(n-8) || i==(n-10) ) { #if WITH_GTKMM_3_0 arr[i+1]->set_hexpand(); arr[i+1]->set_margin_left(20); @@ -316,28 +318,28 @@ void DocumentProperties::build_page() Gtk::Label* label_gen = manage (new Gtk::Label); label_gen->set_markup (_("General")); - Gtk::Label* label_col = manage (new Gtk::Label); - label_col->set_markup (_("Color")); - Gtk::Label* label_bor = manage (new Gtk::Label); - label_bor->set_markup (_("Border")); Gtk::Label *label_for = manage (new Gtk::Label); label_for->set_markup (_("Page Size")); + Gtk::Label* label_dsp = manage (new Gtk::Label); + label_dsp->set_markup (_("Display")); _page_sizer.init(); Gtk::Widget *const widget_array[] = { label_gen, 0, 0, &_rum_deflt, - label_col, 0, - _rcp_bg._label, &_rcp_bg, + //label_col, 0, + //_rcp_bg._label, &_rcp_bg, 0, 0, label_for, 0, 0, &_page_sizer, 0, 0, - label_bor, 0, + label_dsp, 0, 0, &_rcb_canb, 0, &_rcb_bord, 0, &_rcb_shad, + 0, &_rcb_antialias, + _rcp_bg._label, &_rcp_bg, _rcp_bord._label, &_rcp_bord, }; @@ -1472,6 +1474,7 @@ void DocumentProperties::update() _rcb_bord.setActive (nv->borderlayer == SP_BORDER_LAYER_TOP); _rcp_bord.setRgba32 (nv->bordercolor); _rcb_shad.setActive (nv->showpageshadow); + _rcb_antialias.setActive(nv->antialiasing); if (nv->doc_units) { _rum_deflt.setUnit (nv->doc_units->abbr); -- cgit v1.2.3 From 32ef25632164e5af8766a5364400b579edde4ebf Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 13 Mar 2014 23:37:07 +0100 Subject: Reimplement global aliasing toggle as a 'shape-rendering' property on the root element. (bzr r13146) --- src/ui/dialog/document-properties.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/ui/dialog/document-properties.cpp') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index ef7c9ee1d..a31ab1a09 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -35,6 +35,7 @@ #include "sp-namedview.h" #include "sp-root.h" #include "sp-script.h" +#include "style.h" #include "svg/stringstream.h" #include "tools-switch.h" #include "ui/widget/color-picker.h" @@ -106,7 +107,7 @@ DocumentProperties::DocumentProperties() _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), //--------------------------------------------------------------- - _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "inkscape:antialiasing", _wr, false), + _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "shape-rendering", _wr, false, NULL, NULL, NULL, "crispEdges"), _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), _rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false), @@ -1474,7 +1475,10 @@ void DocumentProperties::update() _rcb_bord.setActive (nv->borderlayer == SP_BORDER_LAYER_TOP); _rcp_bord.setRgba32 (nv->bordercolor); _rcb_shad.setActive (nv->showpageshadow); - _rcb_antialias.setActive(nv->antialiasing); + + SPRoot *root = dt->getDocument()->getRoot(); + _rcb_antialias.set_xml_target(root->getRepr(), dt->getDocument()); + _rcb_antialias.setActive(root->style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES); if (nv->doc_units) { _rum_deflt.setUnit (nv->doc_units->abbr); -- cgit v1.2.3