diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2012-12-21 08:35:32 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Cenoz <jtx@jtx.marker.es> | 2012-12-21 08:35:32 +0000 |
| commit | 39309b4a709fad3beed6f02f7ce0289020835efd (patch) | |
| tree | 0ecc19c6309bfa70f30f075a46d87774040cfb8a /src | |
| parent | not working (diff) | |
| parent | fix crasher (diff) | |
| download | inkscape-39309b4a709fad3beed6f02f7ce0289020835efd.tar.gz inkscape-39309b4a709fad3beed6f02f7ce0289020835efd.zip | |
not working, merge from branch
(bzr r11950.1.4)
Diffstat (limited to 'src')
| -rw-r--r-- | src/event-context.cpp | 70 | ||||
| -rw-r--r-- | src/extension/internal/vsd-input.cpp | 43 | ||||
| -rw-r--r-- | src/extension/param/notebook.cpp | 18 | ||||
| -rw-r--r-- | src/extension/prefdialog.cpp | 5 | ||||
| -rw-r--r-- | src/ui/dialog/filter-effects-dialog.cpp | 5 | ||||
| -rw-r--r-- | src/ui/dialog/find.h | 10 | ||||
| -rw-r--r-- | src/ui/dialog/icon-preview.h | 5 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 7 | ||||
| -rw-r--r-- | src/ui/dialog/input.cpp | 21 | ||||
| -rw-r--r-- | src/ui/dialog/object-properties.cpp | 18 | ||||
| -rw-r--r-- | src/ui/dialog/ocaldialogs.cpp | 12 | ||||
| -rw-r--r-- | src/ui/dialog/spellcheck.h | 10 | ||||
| -rw-r--r-- | src/ui/dialog/symbols.cpp | 108 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.h | 12 | ||||
| -rw-r--r-- | src/ui/dialog/xml-tree.cpp | 6 | ||||
| -rw-r--r-- | src/ui/dialog/xml-tree.h | 15 | ||||
| -rw-r--r-- | src/ui/widget/page-sizer.cpp | 52 | ||||
| -rw-r--r-- | src/ui/widget/page-sizer.h | 24 | ||||
| -rw-r--r-- | src/ui/widget/panel.cpp | 6 | ||||
| -rw-r--r-- | src/ui/widget/panel.h | 16 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 5 | ||||
| -rw-r--r-- | src/widgets/text-toolbar.cpp | 9 |
23 files changed, 437 insertions, 50 deletions
diff --git a/src/event-context.cpp b/src/event-context.cpp index e9d0aa935..3c1609d97 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -464,10 +464,23 @@ static gint sp_event_context_private_root_handler( break; case GDK_MOTION_NOTIFY: if (panning) { + if (panning == 4 && !xp && !yp ) { + // <Space> + mouse panning started, save location and grab canvas + xp = event->motion.x; + yp = event->motion.y; + button_w = Geom::Point(event->motion.x, event->motion.y); + + sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), + GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK + | GDK_POINTER_MOTION_MASK + | GDK_POINTER_MOTION_HINT_MASK, NULL, + event->motion.time - 1); + + + } if ((panning == 2 && !(event->motion.state & GDK_BUTTON2_MASK)) - || (panning == 1 && !(event->motion.state - & GDK_BUTTON1_MASK)) || (panning == 3 - && !(event->motion.state & GDK_BUTTON3_MASK))) { + || (panning == 1 && !(event->motion.state & GDK_BUTTON1_MASK)) + || (panning == 3 && !(event->motion.state & GDK_BUTTON3_MASK))) { /* Gdk seems to lose button release for us sometimes :-( */ panning = 0; sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), @@ -570,6 +583,7 @@ static gint sp_event_context_private_root_handler( } ret = TRUE; } + break; case GDK_KEY_PRESS: { double const acceleration = prefs->getDoubleLimited( @@ -672,15 +686,13 @@ static gint sp_event_context_private_root_handler( } break; case GDK_KEY_space: - if (prefs->getBool("/options/spacepans/value")) { - event_context->space_panning = true; - event_context->_message_context->set(Inkscape::INFORMATION_MESSAGE, - _("<b>Space+mouse drag</b> to pan canvas")); - ret = TRUE; - } else { - sp_toggle_selector(desktop); - ret = TRUE; - } + xp = yp = 0; + within_tolerance = true; + panning = 4; + event_context->space_panning = true; + event_context->_message_context->set(Inkscape::INFORMATION_MESSAGE, + _("<b>Space+mouse move</b> to pan canvas")); + ret = TRUE; break; case GDK_KEY_z: case GDK_KEY_Z: @@ -695,18 +707,32 @@ static gint sp_event_context_private_root_handler( } break; case GDK_KEY_RELEASE: + + // Stop panning on any key release + if (event_context->space_panning) { + event_context->space_panning = false; + event_context->_message_context->clear(); + } + + if (panning) { + panning = 0; + xp = yp = 0; + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), + event->key.time); + desktop->updateNow(); + } + + if (panning_cursor == 1) { + panning_cursor = 0; + GtkWidget *w = GTK_WIDGET(sp_desktop_canvas(event_context->desktop)); + gdk_window_set_cursor(gtk_widget_get_window (w), event_context->cursor); + } + switch (get_group0_keyval(&event->key)) { case GDK_KEY_space: - if (event_context->space_panning) { - event_context->space_panning = false; - event_context->_message_context->clear(); - - if (panning == 1) { - panning = 0; - sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), - event->key.time); - desktop->updateNow(); - } + if (within_tolerance == true) { + // Space was pressed, but not panned + sp_toggle_selector(desktop); ret = TRUE; } break; diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index 6d71ce72a..54b570258 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -261,6 +261,7 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u void VsdInput::init(void) { + /* VSD */ Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("VSD Input") "</name>\n" @@ -272,6 +273,48 @@ void VsdInput::init(void) "<filetypetooltip>" N_("File format used by Microsoft Visio 6 and later") "</filetypetooltip>\n" "</input>\n" "</inkscape-extension>", new VsdInput()); + + /* VDX */ + Inkscape::Extension::build_from_mem( + "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" + "<name>" N_("VDX Input") "</name>\n" + "<id>org.inkscape.input.vdx</id>\n" + "<input>\n" + "<extension>.vdx</extension>\n" + "<mimetype>application/vnd.visio</mimetype>\n" + "<filetypename>" N_("Microsoft Visio XML Diagram (*.vdx)") "</filetypename>\n" + "<filetypetooltip>" N_("File format used by Microsoft Visio 2010 and later") "</filetypetooltip>\n" + "</input>\n" + "</inkscape-extension>", new VsdInput()); + + /* VSDM */ + Inkscape::Extension::build_from_mem( + "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" + "<name>" N_("VSDM Input") "</name>\n" + "<id>org.inkscape.input.vsdm</id>\n" + "<input>\n" + "<extension>.vsdm</extension>\n" + "<mimetype>application/vnd.visio</mimetype>\n" + "<filetypename>" N_("Microsoft Visio 2013 drawing (*.vsdm)") "</filetypename>\n" + "<filetypetooltip>" N_("File format used by Microsoft Visio 2013 and later") "</filetypetooltip>\n" + "</input>\n" + "</inkscape-extension>", new VsdInput()); + + /* VSDX */ + Inkscape::Extension::build_from_mem( + "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" + "<name>" N_("VSDX Input") "</name>\n" + "<id>org.inkscape.input.vsdx</id>\n" + "<input>\n" + "<extension>.vsdx</extension>\n" + "<mimetype>application/vnd.visio</mimetype>\n" + "<filetypename>" N_("Microsoft Visio 2013 drawing (*.vsdx)") "</filetypename>\n" + "<filetypetooltip>" N_("File format used by Microsoft Visio 2013 and later") "</filetypetooltip>\n" + "</input>\n" + "</inkscape-extension>", new VsdInput()); + + return; + } // init } } } /* namespace Inkscape, Extension, Implementation */ diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index b4d4cbd16..85cb5d04c 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -206,14 +206,16 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { Parameter * param = reinterpret_cast<Parameter *>(list->data); Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); - gchar const * tip = param->get_tooltip(); -// printf("Tip: '%s'\n", tip); - vbox->pack_start(*widg, false, false, 2); - if (tip) { - widg->set_tooltip_text(tip); - } else { - widg->set_tooltip_text(""); - widg->set_has_tooltip(false); + if (widg) { + gchar const * tip = param->get_tooltip(); + // printf("Tip: '%s'\n", tip); + vbox->pack_start(*widg, false, false, 2); + if (tip) { + widg->set_tooltip_text(tip); + } else { + widg->set_tooltip_text(""); + widg->set_has_tooltip(false); + } } } diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 2d2604c7f..649dc398a 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -88,7 +88,12 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co _param_preview = Parameter::make(doc->root(), _effect); } +#if WITH_GTKMM_3_0 + Gtk::Separator * sep = Gtk::manage(new Gtk::Separator()); +#else Gtk::HSeparator * sep = Gtk::manage(new Gtk::HSeparator()); +#endif + sep->show(); this->get_vbox()->pack_start(*sep, true, true, 4); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index ddafcd481..6769a25ef 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -2380,7 +2380,12 @@ FilterEffectsDialog::FilterEffectsDialog() _add_primitive_type.remove_row(NR_FILTER_COMPONENTTRANSFER); // Initialize widget hierarchy +#if WITH_GTKMM_3_0 + Gtk::Paned* hpaned = Gtk::manage(new Gtk::Paned); +#else Gtk::HPaned* hpaned = Gtk::manage(new Gtk::HPaned); +#endif + Gtk::ScrolledWindow* sw_prims = Gtk::manage(new Gtk::ScrolledWindow); Gtk::HBox* infobox = Gtk::manage(new Gtk::HBox(/*homogeneous:*/false, /*spacing:*/4)); Gtk::HBox* hb_prims = Gtk::manage(new Gtk::HBox); diff --git a/src/ui/dialog/find.h b/src/ui/dialog/find.h index 64fb4cc3d..77a6c9d02 100644 --- a/src/ui/dialog/find.h +++ b/src/ui/dialog/find.h @@ -12,6 +12,10 @@ #ifndef INKSCAPE_UI_DIALOG_FIND_H #define INKSCAPE_UI_DIALOG_FIND_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include "ui/widget/panel.h" #include "ui/widget/button.h" #include "ui/widget/entry.h" @@ -280,7 +284,13 @@ private: Gtk::Label status; UI::Widget::Button button_find; UI::Widget::Button button_replace; + +#if WITH_GTKMM_3_0 + Gtk::ButtonBox box_buttons; +#else Gtk::HButtonBox box_buttons; +#endif + Gtk::HBox hboxbutton_row; /** diff --git a/src/ui/dialog/icon-preview.h b/src/ui/dialog/icon-preview.h index 42f9176b0..8a6e19a25 100644 --- a/src/ui/dialog/icon-preview.h +++ b/src/ui/dialog/icon-preview.h @@ -66,7 +66,12 @@ private: gdouble minDelay; Gtk::VBox iconBox; + +#if WITH_GTKMM_3_0 + Gtk::Paned splitter; +#else Gtk::HPaned splitter; +#endif Glib::ustring targetId; int hot; diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 291059999..20e5d3ca6 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1162,9 +1162,11 @@ void InkscapePreferences::initPageBehavior() _scroll_auto_thres.init ( "/options/autoscrolldistance/value", -600.0, 600.0, 1.0, 1.0, -10.0, true, false); _page_scrolling.add_line( true, _("_Threshold:"), _scroll_auto_thres, _("pixels"), _("How far (in screen pixels) you need to be from the canvas edge to trigger autoscroll; positive is outside the canvas, negative is within the canvas"), false); +/* _scroll_space.init ( _("Left mouse button pans when Space is pressed"), "/options/spacepans/value", false); _page_scrolling.add_line( false, "", _scroll_space, "", _("When on, pressing and holding Space and dragging with left mouse button pans canvas (as in Adobe Illustrator); when off, Space temporarily switches to Selector tool (default)")); +*/ _wheel_zoom.init ( _("Mouse wheel zooms by default"), "/options/wheelzooms/value", false); _page_scrolling.add_line( false, "", _wheel_zoom, "", _("When on, mouse wheel zooms without Ctrl and scrolls canvas with Ctrl; when off, it zooms with Ctrl and scrolls without Ctrl")); @@ -1459,7 +1461,12 @@ void InkscapePreferences::initKeyboardShortcuts(Gtk::TreeModel::iterator iter_ui _page_keyshortcuts.attach(*scroller, 0, 2, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL); row++; +#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); _page_keyshortcuts.attach(*box_buttons, 0, 3, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 4c567a6e3..6aff67f69 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -424,7 +424,12 @@ private: Gtk::CheckButton useExt; Gtk::Button save; +#if WITH_GTKMM_3_0 + Gtk::Paned pane; +#else Gtk::HPaned pane; +#endif + Gtk::VBox detailsBox; Gtk::HBox titleFrame; Gtk::Label titleLabel; @@ -485,8 +490,15 @@ private: Inkscape::UI::Widget::Frame axisFrame; Gtk::ScrolledWindow treeScroller; Gtk::ScrolledWindow detailScroller; + +#if WITH_GTKMM_3_0 + Gtk::Paned splitter; + Gtk::Paned split2; +#else Gtk::HPaned splitter; Gtk::VPaned split2; +#endif + Gtk::Label devName; Gtk::Label devKeyCount; Gtk::Label devAxesCount; @@ -589,7 +601,11 @@ InputDialogImpl::InputDialogImpl() : treeScroller(), detailScroller(), splitter(), +#if WITH_GTKMM_3_0 + split2(Gtk::ORIENTATION_VERTICAL), +#else split2(), +#endif axisTable(11, 2), linkCombo(), topHolder(), @@ -1048,7 +1064,12 @@ InputDialogImpl::ConfPanel::ConfPanel() : useExt.set_active(Preferences::get()->getBool("/options/useextinput/value")); useExt.signal_toggled().connect(sigc::mem_fun(*this, &InputDialogImpl::ConfPanel::useExtToggled)); +#if WITH_GTKMM_3_0 + Gtk::ButtonBox *buttonBox = manage(new Gtk::ButtonBox); +#else Gtk::HButtonBox *buttonBox = manage (new Gtk::HButtonBox); +#endif + buttonBox->set_layout (Gtk::BUTTONBOX_END); //Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_START, 0, 0); buttonBox->add(save); diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index 12ee2f762..f0801734a 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -69,15 +69,15 @@ ObjectProperties::ObjectProperties (void) : subselChangedConn() { //initialize labels for the table at the bottom of the dialog - int_labels.push_back("onclick:"); - int_labels.push_back("onmouseover:"); - int_labels.push_back("onmouseout:"); - int_labels.push_back("onmousedown:"); - int_labels.push_back("onmouseup:"); - int_labels.push_back("onmousemove:"); - int_labels.push_back("onfocusin:"); - int_labels.push_back("onfocusout:"); - int_labels.push_back("onload:"); + int_labels.push_back("onclick"); + int_labels.push_back("onmouseover"); + int_labels.push_back("onmouseout"); + int_labels.push_back("onmousedown"); + int_labels.push_back("onmouseup"); + int_labels.push_back("onmousemove"); + int_labels.push_back("onfocusin"); + int_labels.push_back("onfocusout"); + int_labels.push_back("onload"); desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &ObjectProperties::setTargetDesktop) ); deskTrack.connect(GTK_WIDGET(gobj())); diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index c7bff185c..8f5f2ed22 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -1196,7 +1196,13 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types // Creation Gtk::VBox *vbox = new Gtk::VBox(false, 0); + +#if WITH_GTKMM_3_0 + Gtk::ButtonBox *hbuttonbox_bottom = new Gtk::ButtonBox(); +#else Gtk::HButtonBox *hbuttonbox_bottom = new Gtk::HButtonBox(); +#endif + Gtk::HBox *hbox_bottom = new Gtk::HBox(false, 12); BaseBox *basebox_logo = new BaseBox(); BaseBox *basebox_no_search_results = new BaseBox(); @@ -1204,7 +1210,13 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types label_description = new Gtk::Label(); entry_search = new SearchEntry(); button_search = new Gtk::Button(_("Search")); + +#if WITH_GTKMM_3_0 + Gtk::ButtonBox* hbuttonbox_search = new Gtk::ButtonBox(); +#else Gtk::HButtonBox* hbuttonbox_search = new Gtk::HButtonBox(); +#endif + Gtk::ScrolledWindow* scrolledwindow_preview = new Gtk::ScrolledWindow(); preview_files = new PreviewWidget(); /// Add the buttons in the bottom of the dialog diff --git a/src/ui/dialog/spellcheck.h b/src/ui/dialog/spellcheck.h index 8eb240097..ab75809f3 100644 --- a/src/ui/dialog/spellcheck.h +++ b/src/ui/dialog/spellcheck.h @@ -240,10 +240,20 @@ private: GtkWidget * dictionary_combo; Gtk::HBox dictionary_hbox; +#if WITH_GTKMM_3_0 + Gtk::Separator action_sep; +#else Gtk::HSeparator action_sep; +#endif + Gtk::Button stop_button; Gtk::Button start_button; + +#if WITH_GTKMM_3_0 + Gtk::ButtonBox actionbutton_hbox; +#else Gtk::HButtonBox actionbutton_hbox; +#endif SPDesktop * desktop; DesktopTracker deskTrack; diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 9d4ab5d8a..3188f1681 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -14,6 +14,9 @@ #include <iostream> #include <algorithm> +#include <locale> +#include <functional> +#include <sstream> #include <glibmm/i18n.h> @@ -43,6 +46,11 @@ #include "sp-use.h" #include "sp-symbol.h" +#ifdef WITH_LIBVISIO +#include <libvisio/libvisio.h> +#include <libwpd-stream/libwpd-stream.h> +#endif + #include "verbs.h" #include "xml/repr.h" @@ -289,6 +297,78 @@ void SymbolsDialog::iconChanged() { } } +#ifdef WITH_LIBVISIO +// Read Visio stencil files +SPDocument* read_vss( gchar* fullname, gchar* filename ) { + + WPXFileStream input(fullname); + + if (!libvisio::VisioDocument::isSupported(&input)) { + return NULL; + } + + libvisio::VSDStringVector output; + if (!libvisio::VisioDocument::generateSVGStencils(&input, output)) { + return NULL; + } + + if (output.empty()) { + return NULL; + } + + Glib::ustring tmpSVGOutput; + tmpSVGOutput += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; + tmpSVGOutput += "<svg\n"; + tmpSVGOutput += " xmlns=\"http://www.w3.org/2000/svg\"\n"; + tmpSVGOutput += " xmlns:svg=\"http://www.w3.org/2000/svg\"\n"; + tmpSVGOutput += " xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"; + tmpSVGOutput += " version=\"1.1\"\n"; + tmpSVGOutput += " style=\"fill:none;stroke:#000000;stroke-width:2\">\n"; + tmpSVGOutput += " <title>"; + tmpSVGOutput += filename; + tmpSVGOutput += "</title>\n"; + tmpSVGOutput += " <defs>\n"; + + // Create a string we can use for the symbol id (libvisio doesn't give us a name) + std::string sanitized( filename ); + sanitized.erase( sanitized.find_last_of(".vss")-3 ); + sanitized.erase( std::remove_if( sanitized.begin(), sanitized.end(), ispunct ), sanitized.end() ); + std::replace( sanitized.begin(), sanitized.end(), ' ', '_' ); + // std::cout << filename << " |" << sanitized << "|" << std::endl; + + // Each "symbol" is in it's own SVG file, we wrap with <symbol> and merge into one file. + for (unsigned i=0; i<output.size(); ++i) { + + std::stringstream ss; + ss << i; + + tmpSVGOutput += " <symbol id=\""; + tmpSVGOutput += sanitized; + tmpSVGOutput += "_"; + tmpSVGOutput += ss.str(); + tmpSVGOutput += "\">\n"; + + std::istringstream iss( output[i].cstr() ); + std::string line; + while( std::getline( iss, line ) ) { + // std::cout << line << std::endl; + if( line.find( "svg:svg" ) == std::string::npos ) { + tmpSVGOutput += line; + tmpSVGOutput += "\n"; + } + } + + tmpSVGOutput += " </symbol>\n"; + } + + tmpSVGOutput += " </defs>\n"; + tmpSVGOutput += "</svg>\n"; + + return SPDocument::createNewDocFromMem( tmpSVGOutput.c_str(), strlen( tmpSVGOutput.c_str()), 0 ); + +} +#endif + /* Hunts preference directories for symbol files */ void SymbolsDialog::get_symbols() { @@ -317,11 +397,31 @@ void SymbolsDialog::get_symbols() { if ( !Inkscape::IO::file_test( fullname, G_FILE_TEST_IS_DIR ) ) { - SPDocument* symbol_doc = SPDocument::createNewDoc( fullname, FALSE ); - if( symbol_doc ) { - symbolSets[Glib::ustring(filename)]= symbol_doc; - symbolSet->append(filename); + Glib::ustring fn( filename ); + Glib::ustring tag = fn.substr( fn.find_last_of(".") + 1 ); + + SPDocument* symbol_doc = NULL; + +#ifdef WITH_LIBVISIO + if( tag.compare( "vss" ) == 0 ) { + + symbol_doc = read_vss( fullname, filename ); + if( symbol_doc ) { + symbolSets[Glib::ustring(filename)]= symbol_doc; + symbolSet->append(filename); + } } +#endif + // Try to read all remaining files as SVG + if( !symbol_doc ) { + + symbol_doc = SPDocument::createNewDoc( fullname, FALSE ); + if( symbol_doc ) { + symbolSets[Glib::ustring(filename)]= symbol_doc; + symbolSet->append(filename); + } + } + } g_free( fullname ); } diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 6696db083..97cd28cdd 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -95,11 +95,21 @@ TextEdit::TextEdit() styleButton(&align_center, _("Align center"), GTK_STOCK_JUSTIFY_CENTER, &align_left); styleButton(&align_right, _("Align right"), GTK_STOCK_JUSTIFY_RIGHT, &align_left); styleButton(&align_justify, _("Justify (only flowed text)"), GTK_STOCK_JUSTIFY_FILL, &align_left); + +#if WITH_GTKMM_3_0 + align_sep.set_orientation(Gtk::ORIENTATION_VERTICAL); +#endif + layout_hbox.pack_start(align_sep, false, false, 10); /* Direction buttons */ styleButton(&text_horizontal, _("Horizontal text"), INKSCAPE_ICON("format-text-direction-horizontal"), NULL); styleButton(&text_vertical, _("Vertical text"), INKSCAPE_ICON("format-text-direction-vertical"), &text_horizontal); + +#if WITH_GTKMM_3_0 + text_sep.set_orientation(Gtk::ORIENTATION_VERTICAL); +#endif + layout_hbox.pack_start(text_sep, false, false, 10); /* Line Spacing */ diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h index 9fd9baa30..bca6cee90 100644 --- a/src/ui/dialog/text-edit.h +++ b/src/ui/dialog/text-edit.h @@ -172,10 +172,22 @@ private: Gtk::RadioButton align_center; Gtk::RadioButton align_right; Gtk::RadioButton align_justify; + +#if WITH_GTKMM_3_0 + Gtk::Separator align_sep; +#else Gtk::VSeparator align_sep; +#endif + Gtk::RadioButton text_vertical; Gtk::RadioButton text_horizontal; + +#if WITH_GTKMM_3_0 + Gtk::Separator text_sep; +#else Gtk::VSeparator text_sep; +#endif + GtkWidget *spacing_combo; Gtk::Label preview_label; diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index b21932f99..29dbc4b93 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -79,7 +79,11 @@ XmlTree::XmlTree (void) : xml_attribute_delete_button (_("Delete attribute")), text_container (), attr_container (), - attr_subpaned_container (), +#if WITH_GTKMM_3_0 + attr_subpaned_container(Gtk::ORIENTATION_VERTICAL), +#else + attr_subpaned_container(), +#endif set_attr (_("Set")), new_window(NULL) { diff --git a/src/ui/dialog/xml-tree.h b/src/ui/dialog/xml-tree.h index ee1dadc14..9d2fac71f 100644 --- a/src/ui/dialog/xml-tree.h +++ b/src/ui/dialog/xml-tree.h @@ -13,6 +13,10 @@ #ifndef SEEN_DIALOGS_XML_TREE_H #define SEEN_DIALOGS_XML_TREE_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include "ui/widget/panel.h" #include <gtkmm/entry.h> #include <gtkmm/textview.h> @@ -215,7 +219,12 @@ private: Gtk::Button *create_button; Gtk::Entry *name_entry; +#if WITH_GTKMM_3_0 + Gtk::Paned paned; +#else Gtk::HPaned paned; +#endif + Gtk::VBox left_box; Gtk::VBox right_box; Gtk::HBox status_box; @@ -239,7 +248,13 @@ private: Gtk::ScrolledWindow text_container; Gtk::HBox attr_hbox; Gtk::VBox attr_container; + +#if WITH_GTKMM_3_0 + Gtk::Paned attr_subpaned_container; +#else Gtk::VPaned attr_subpaned_container; +#endif + Gtk::Button set_attr; GtkWidget *new_window; diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 2ab72d6c7..fa3f8e3a1 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -330,14 +330,36 @@ PageSizer::PageSizer(Registry & _wr) pack_start (_customFrame, false, false, 0); _customFrame.add(_customDimTable); - _customDimTable.resize(3, 2); _customDimTable.set_border_width(4); + +#if WITH_GTKMM_3_0 + _customDimTable.set_row_spacing(4); + _customDimTable.set_column_spacing(4); + + _dimensionWidth.set_hexpand(); + _dimensionWidth.set_vexpand(); + _customDimTable.attach(_dimensionWidth, 0, 0, 1, 1); + + _dimensionUnits.set_hexpand(); + _dimensionUnits.set_vexpand(); + _customDimTable.attach(_dimensionUnits, 1, 0, 1, 1); + + _dimensionHeight.set_hexpand(); + _dimensionHeight.set_vexpand(); + _customDimTable.attach(_dimensionHeight, 0, 1, 1, 1); + + _fitPageMarginExpander.set_hexpand(); + _fitPageMarginExpander.set_vexpand(); + _customDimTable.attach(_fitPageMarginExpander, 0, 2, 2, 1); +#else + _customDimTable.resize(3, 2); _customDimTable.set_row_spacings(4); _customDimTable.set_col_spacings(4); _customDimTable.attach(_dimensionWidth, 0,1, 0,1); _customDimTable.attach(_dimensionUnits, 1,2, 0,1); _customDimTable.attach(_dimensionHeight, 0,1, 1,2); _customDimTable.attach(_fitPageMarginExpander, 0,2, 2,3); +#endif _dimTabOrderGList = NULL; _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionWidth.gobj()); @@ -353,7 +375,32 @@ PageSizer::PageSizer(Registry & _wr) _fitPageMarginExpander.add(_marginTable); //## Set up margin settings - _marginTable.resize(4, 2); + _marginTable.set_border_width(4); + +#if WITH_GTKMM_3_0 + _marginTable.set_row_spacing(4); + _marginTable.set_column_spacing(4); + + _marginTopAlign.set_hexpand(); + _marginTopAlign.set_vexpand(); + _marginTable.attach(_marginTopAlign, 0, 0, 2, 1); + + _marginLeftAlign.set_hexpand(); + _marginLeftAlign.set_vexpand(); + _marginTable.attach(_marginLeftAlign, 0, 1, 1, 1); + + _marginRightAlign.set_hexpand(); + _marginRightAlign.set_vexpand(); + _marginTable.attach(_marginRightAlign, 1, 1, 1, 1); + + _marginBottomAlign.set_hexpand(); + _marginBottomAlign.set_vexpand(); + _marginTable.attach(_marginBottomAlign, 0, 2, 2, 1); + + _fitPageButtonAlign.set_hexpand(); + _fitPageButtonAlign.set_vexpand(); + _marginTable.attach(_fitPageButtonAlign, 0, 3, 2, 1); +#else _marginTable.set_border_width(4); _marginTable.set_row_spacings(4); _marginTable.set_col_spacings(4); @@ -362,6 +409,7 @@ PageSizer::PageSizer(Registry & _wr) _marginTable.attach(_marginRightAlign, 1,2, 1,2); _marginTable.attach(_marginBottomAlign, 0,2, 2,3); _marginTable.attach(_fitPageButtonAlign, 0,2, 3,4); +#endif _marginTopAlign.set(0.5, 0.5, 0.0, 1.0); _marginTopAlign.add(_marginTop); diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index 17fd7b1ea..d1fbb56e0 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -10,6 +10,10 @@ #ifndef INKSCAPE_UI_WIDGET_PAGE_SIZER_H #define INKSCAPE_UI_WIDGET_PAGE_SIZER_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <stddef.h> #include "ui/widget/registered-widget.h" #include <sigc++/sigc++.h> @@ -21,7 +25,13 @@ #include <gtkmm/frame.h> #include <gtkmm/liststore.h> #include <gtkmm/scrolledwindow.h> -#include <gtkmm/table.h> + +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + #include <gtkmm/radiobutton.h> namespace Inkscape { @@ -207,7 +217,13 @@ protected: //### Custom size frame Gtk::Frame _customFrame; + +#if WITH_GTKMM_3_0 + Gtk::Grid _customDimTable; +#else Gtk::Table _customDimTable; +#endif + RegisteredUnitMenu _dimensionUnits; RegisteredScalarUnit _dimensionWidth; RegisteredScalarUnit _dimensionHeight; @@ -215,7 +231,13 @@ protected: //### Fit Page options Gtk::Expander _fitPageMarginExpander; + +#if WITH_GTKMM_3_0 + Gtk::Grid _marginTable; +#else Gtk::Table _marginTable; +#endif + Gtk::Alignment _marginTopAlign; Gtk::Alignment _marginLeftAlign; Gtk::Alignment _marginRightAlign; diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index dcf5956bf..48749fda2 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -591,7 +591,13 @@ void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_s { // Create a button box for the response buttons if it's the first button to be added if (!_action_area) { +#if WITH_GTKMM_3_0 + _action_area = new Gtk::ButtonBox(); + _action_area->set_layout(Gtk::BUTTONBOX_END); + _action_area->set_spacing(6); +#else _action_area = new Gtk::HButtonBox(Gtk::BUTTONBOX_END, 6); +#endif _action_area->set_border_width(4); pack_end(*_action_area, Gtk::PACK_SHRINK, 0); } diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index b4cc04809..5bb054577 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -13,6 +13,10 @@ #ifndef SEEN_INKSCAPE_UI_WIDGET_PANEL_H #define SEEN_INKSCAPE_UI_WIDGET_PANEL_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/arrow.h> #include <gtkmm/button.h> @@ -27,7 +31,13 @@ class SPDocument; namespace Gtk { class CheckMenuItem; + +#if WITH_GTKMM_3_0 + class ButtonBox; +#else class HButtonBox; +#endif + class MenuItem; } @@ -157,7 +167,13 @@ private: Gtk::EventBox _menu_popper; Gtk::Button _close_button; Gtk::Menu *_menu; + +#if WITH_GTKMM_3_0 + Gtk::ButtonBox *_action_area; //< stores response buttons +#else Gtk::HButtonBox *_action_area; //< stores response buttons +#endif + std::vector<Gtk::Widget *> _non_horizontal; std::vector<Gtk::Widget *> _non_vertical; PreviewFillable *_fillable; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 3791ec73c..0fd8fd010 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -578,7 +578,12 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) if (create_dock) { dtw->dock = new Inkscape::UI::Widget::Dock(); +#if WITH_GTKMM_3_0 + Gtk::Paned *paned = new Gtk::Paned(); +#else Gtk::HPaned *paned = new Gtk::HPaned(); +#endif + paned->pack1(*Glib::wrap(canvas_tbl)); paned->pack2(dtw->dock->getWidget(), Gtk::FILL); diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index 9e0977d51..6c22c81e3 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -174,6 +174,9 @@ static void sp_text_fontstyle_populate(GObject *tbl, font_instance *font=NULL) Ink_ComboBoxEntry_Action* act = INK_COMBOBOXENTRY_ACTION( g_object_get_data( tbl, "TextFontFamilyAction" ) ); GtkTreeModel *model = ink_comboboxentry_action_get_model( act ); gchar *current_font = ink_comboboxentry_action_get_active_text( act ); + if (!current_font) { + return; + } // Get an iter to the selected font from the model data // We cant get it from the combo, cause it might not have been created yet @@ -183,11 +186,11 @@ static void sp_text_fontstyle_populate(GObject *tbl, font_instance *font=NULL) while ( valid ) { // Get text from list entry - gchar* text = 0; + gchar* text = NULL; gtk_tree_model_get( model, &iter, 0, &text, -1 ); // Column 0 // Check for match - if( strcmp( current_font, text ) == 0 ){ + if ( text && (strcmp( current_font, text ) == 0) ) { found = true; break; } @@ -199,7 +202,7 @@ static void sp_text_fontstyle_populate(GObject *tbl, font_instance *font=NULL) } // Get the list of styles from the selected font - GList *list=0; + GList *list = NULL; gtk_tree_model_get (model, &iter, 1, &list, -1); Ink_ComboBoxEntry_Action* fontStyleAction = INK_COMBOBOXENTRY_ACTION( g_object_get_data( tbl, "TextFontStyleAction" ) ); |
