symbols.cpp revision d952ff41b31f89d65e80205020ab8302a517db1c
359a38ce40498397028473d956691915ed3e849atavmjong-free * Symbols dialog.
359a38ce40498397028473d956691915ed3e849atavmjong-free * Copyright (C) 2012 Tavmjong Bah
359a38ce40498397028473d956691915ed3e849atavmjong-free * Released under GNU GPL, read the file 'COPYING' for more information
359a38ce40498397028473d956691915ed3e849atavmjong-free#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free// See: http://developer.gnome.org/gtkmm/stable/classGtk_1_1TreeModelColumnRecord.html
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-freeclass SymbolColumns : public Gtk::TreeModel::ColumnRecord
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free Gtk::TreeModelColumn<Glib::ustring> symbol_id;
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free Gtk::TreeModelColumn<Glib::ustring> symbol_title;
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > symbol_image;
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free * Constructor
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-freeSymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free UI::Widget::Panel("", prefsPath, SP_VERB_DIALOG_SYMBOLS),
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free /******************** Table *************************/
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free Gtk::Table *table = new Gtk::Table(2, 4, false);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free // panel is a cloked Gtk::VBox
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free _getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET);
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free /******************** Symbol Sets *************************/
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free Gtk::Label* labelSet = new Gtk::Label(_("Symbol set: "));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free table->attach(*Gtk::manage(labelSet),0,row,1,1);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free table->attach(*Gtk::manage(labelSet),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free symbolSet = new Gtk::ComboBoxText(); // Fill in later
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free symbolSet->set_active_text(_("Current Document"));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free table->attach(*Gtk::manage(symbolSet),1,row,1,1);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free table->attach(*Gtk::manage(symbolSet),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free sigc::connection connSet = symbolSet->signal_changed().connect(
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free sigc::mem_fun(*this, &SymbolsDialog::rebuild));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free /********************* Icon View **************************/
359a38ce40498397028473d956691915ed3e849atavmjong-free iconView = new Gtk::IconView(static_cast<Glib::RefPtr<Gtk::TreeModel> >(store));
359a38ce40498397028473d956691915ed3e849atavmjong-free //iconView->set_text_column( columns->symbol_id );
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free iconView->set_pixbuf_column( columns->symbol_image );
359a38ce40498397028473d956691915ed3e849atavmjong-free // Giving the iconview a small minimum size will help users understand
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free // What the dialog does.
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free targets.push_back(Gtk::TargetEntry( "application/x-inkscape-paste"));
359a38ce40498397028473d956691915ed3e849atavmjong-free iconView->enable_model_drag_source (targets, Gdk::BUTTON1_MASK, Gdk::ACTION_COPY);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free sigc::mem_fun(*this, &SymbolsDialog::iconDragDataGet));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free connIconChanged = iconView->signal_selection_changed().connect(
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free sigc::mem_fun(*this, &SymbolsDialog::iconChanged));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow();
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free table->attach(*Gtk::manage(scroller),0,row,2,1);
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free table->attach(*Gtk::manage(scroller),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free /******************** Tools *******************************/
359a38ce40498397028473d956691915ed3e849atavmjong-free //tools->set_layout( Gtk::BUTTONBOX_END );
359a38ce40498397028473d956691915ed3e849atavmjong-free table->attach(*Gtk::manage(tools),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::FILL);
359a38ce40498397028473d956691915ed3e849atavmjong-free sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-add")))) );
359a38ce40498397028473d956691915ed3e849atavmjong-free addSymbol->set_tooltip_text(_("Add Symbol from the current document."));
3eb97a45889abb73fa05c413b45785ea682f07c5Jon A. Cruz addSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::insertSymbol));
359a38ce40498397028473d956691915ed3e849atavmjong-free tools->pack_start(* addSymbol, Gtk::PACK_SHRINK);
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White removeSymbol = Gtk::manage(new Gtk::Button());
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-remove")))) );
359a38ce40498397028473d956691915ed3e849atavmjong-free removeSymbol->set_tooltip_text(_("Remove Symbol from the current document."));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free removeSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::revertSymbol));
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free tools->pack_start(* removeSymbol, Gtk::PACK_SHRINK);
acd93b79c034f4bcc8ff02de8aa877f70f081881Marc Jeanmougin Gtk::Label* spacer = Gtk::manage(new Gtk::Label(""));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free // Pack size (controls display area)
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("pack-more")))) );
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free button->set_tooltip_text(_("Display more icons in row."));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::packmore));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free tools->pack_start(* button, Gtk::PACK_SHRINK);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("pack-less")))) );
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free button->set_tooltip_text(_("Display fewer icons in row."));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::packless));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free tools->pack_start(* button, Gtk::PACK_SHRINK);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free // Toggle scale to fit on/off
359a38ce40498397028473d956691915ed3e849atavmjong-free fitSymbol = Gtk::manage(new Gtk::ToggleButton());
359a38ce40498397028473d956691915ed3e849atavmjong-free sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-fit")))) );
359a38ce40498397028473d956691915ed3e849atavmjong-free fitSymbol->set_tooltip_text(_("Toggle 'fit' symbols in icon space."));
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free fitSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild));
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free tools->pack_start(* fitSymbol, Gtk::PACK_SHRINK);
359a38ce40498397028473d956691915ed3e849atavmjong-free // Render size (scales symbols within display area)
359a38ce40498397028473d956691915ed3e849atavmjong-free scale_factor = 0; // Default 1:1 * pack_size/pack_size default
359a38ce40498397028473d956691915ed3e849atavmjong-free sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-smaller")))) );
359a38ce40498397028473d956691915ed3e849atavmjong-free zoomOut->set_tooltip_text(_("Make symbols smaller by zooming out."));
3eb97a45889abb73fa05c413b45785ea682f07c5Jon A. Cruz zoomOut->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomout));
359a38ce40498397028473d956691915ed3e849atavmjong-free tools->pack_start(* zoomOut, Gtk::PACK_SHRINK);
359a38ce40498397028473d956691915ed3e849atavmjong-free sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-bigger")))) );
359a38ce40498397028473d956691915ed3e849atavmjong-free zoomIn->set_tooltip_text(_("Make symbols bigger by zooming in."));
359a38ce40498397028473d956691915ed3e849atavmjong-free zoomIn->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomin));
359a38ce40498397028473d956691915ed3e849atavmjong-free tools->pack_start(* zoomIn, Gtk::PACK_SHRINK);
359a38ce40498397028473d956691915ed3e849atavmjong-free /**********************************************************/
3eb97a45889abb73fa05c413b45785ea682f07c5Jon A. Cruz currentDocument = sp_desktop_document(currentDesktop);
359a38ce40498397028473d956691915ed3e849atavmjong-free previewDocument = symbols_preview_doc(); /* Template to render symbols in */
359a38ce40498397028473d956691915ed3e849atavmjong-free previewDocument->ensureUpToDate(); /* Necessary? */
359a38ce40498397028473d956691915ed3e849atavmjong-free renderDrawing.setRoot(previewDocument->getRoot()->invoke_show(renderDrawing, key, SP_ITEM_SHOW_DISPLAY ));
359a38ce40498397028473d956691915ed3e849atavmjong-free // This might need to be a global variable so setTargetDesktop can modify it
359a38ce40498397028473d956691915ed3e849atavmjong-free sigc::connection defsModifiedConn = (SP_OBJECT(defs))->connectModified(
359a38ce40498397028473d956691915ed3e849atavmjong-free sigc::mem_fun(*this, &SymbolsDialog::defsModified));
359a38ce40498397028473d956691915ed3e849atavmjong-free sigc::connection selectionChangedConn = currentDesktop->selection->connectChanged(
359a38ce40498397028473d956691915ed3e849atavmjong-free sigc::mem_fun(*this, &SymbolsDialog::selectionChanged));
f9110b2951479b0cf4a92c4242825b18bf636e42tavmjong-free instanceConns.push_back(selectionChangedConn);
f9110b2951479b0cf4a92c4242825b18bf636e42tavmjong-free sigc::connection documentReplacedConn = currentDesktop->connectDocumentReplaced(
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free sigc::mem_fun(*this, &SymbolsDialog::documentReplaced));
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free instanceConns.push_back(documentReplacedConn);
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free add_symbols( currentDocument ); /* Defaults to current document */
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &SymbolsDialog::setTargetDesktop) );
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free for (std::vector<sigc::connection>::iterator it = instanceConns.begin(); it != instanceConns.end(); ++it) {
438035e1fbba64c0adf12fc08de1b34afd3c9374tavmjong-free Glib::ustring symbolSetString = symbolSet->get_active_text();
359a38ce40498397028473d956691915ed3e849atavmjong-free SPDocument* symbolDocument = symbolSets[symbolSetString];
359a38ce40498397028473d956691915ed3e849atavmjong-free // Symbol must be from Current Document (this method of
359a38ce40498397028473d956691915ed3e849atavmjong-free // checking should be language independent).
359a38ce40498397028473d956691915ed3e849atavmjong-free Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_EDIT_SYMBOL );
359a38ce40498397028473d956691915ed3e849atavmjong-free SPAction *action = verb->get_action(Inkscape::ActionContext( (Inkscape::UI::View::View *) this->currentDesktop) );
359a38ce40498397028473d956691915ed3e849atavmjong-free Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_EDIT_UNSYMBOL );
359a38ce40498397028473d956691915ed3e849atavmjong-free SPAction *action = verb->get_action(Inkscape::ActionContext( (Inkscape::UI::View::View *) this->currentDesktop ) );
359a38ce40498397028473d956691915ed3e849atavmjong-freevoid SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& /*context*/, Gtk::SelectionData& data, guint /*info*/, guint /*time*/)
359a38ce40498397028473d956691915ed3e849atavmjong-free std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items();
359a38ce40498397028473d956691915ed3e849atavmjong-free Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items();
359a38ce40498397028473d956691915ed3e849atavmjong-free //std::cout << " iconArray empty: huh? " << std::endl;
359a38ce40498397028473d956691915ed3e849atavmjong-free Gtk::TreeModel::Path const & path = *iconArray.begin();
359a38ce40498397028473d956691915ed3e849atavmjong-free Gtk::ListStore::iterator row = store->get_iter(path);
359a38ce40498397028473d956691915ed3e849atavmjong-free Glib::ustring symbol_id = (*row)[getColumns()->symbol_id];
359a38ce40498397028473d956691915ed3e849atavmjong-free GdkAtom dataAtom = gdk_atom_intern( "application/x-inkscape-paste", FALSE );
359a38ce40498397028473d956691915ed3e849atavmjong-free gtk_selection_data_set( data.gobj(), dataAtom, 9, (guchar*)symbol_id.c_str(), symbol_id.length() );
359a38ce40498397028473d956691915ed3e849atavmjong-freevoid SymbolsDialog::defsModified(SPObject * /*object*/, guint /*flags*/)
359a38ce40498397028473d956691915ed3e849atavmjong-free if ( !symbolSets[symbolSet->get_active_text()] ) {
359a38ce40498397028473d956691915ed3e849atavmjong-freevoid SymbolsDialog::selectionChanged(Inkscape::Selection *selection) {
359a38ce40498397028473d956691915ed3e849atavmjong-free SPDocument* symbolDocument = selectedSymbols();
359a38ce40498397028473d956691915ed3e849atavmjong-free SPObject* symbol = symbolDocument->getObjectById(symbol_id);
359a38ce40498397028473d956691915ed3e849atavmjong-freevoid SymbolsDialog::documentReplaced(SPDesktop *desktop, SPDocument *document)
359a38ce40498397028473d956691915ed3e849atavmjong-free /* OK, we know symbol name... now we need to copy it to clipboard, bon chance! */
359a38ce40498397028473d956691915ed3e849atavmjong-free Glib::ustring symbolSetString = symbolSet->get_active_text();
bf9ec3e969ba6b11cbbc613545aedc63cc886973Matthew Petroff SPDocument* symbolDocument = symbolSets[symbolSetString];
359a38ce40498397028473d956691915ed3e849atavmjong-free // Symbol must be from Current Document (this method of checking should be language independent).
359a38ce40498397028473d956691915ed3e849atavmjong-freeGlib::ustring SymbolsDialog::selectedSymbolId() {
359a38ce40498397028473d956691915ed3e849atavmjong-free std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items();
359a38ce40498397028473d956691915ed3e849atavmjong-free Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items();
359a38ce40498397028473d956691915ed3e849atavmjong-free Gtk::TreeModel::Path const & path = *iconArray.begin();
359a38ce40498397028473d956691915ed3e849atavmjong-free Gtk::ListStore::iterator row = store->get_iter(path);
359a38ce40498397028473d956691915ed3e849atavmjong-free SPDocument* symbolDocument = selectedSymbols();
359a38ce40498397028473d956691915ed3e849atavmjong-free SPObject* symbol = symbolDocument->getObjectById(symbol_id);
359a38ce40498397028473d956691915ed3e849atavmjong-free // Select the symbol on the canvas so it can be manipulated
359a38ce40498397028473d956691915ed3e849atavmjong-free currentDesktop->selection->set( symbol, false );
359a38ce40498397028473d956691915ed3e849atavmjong-free // Find style for use in <use>
359a38ce40498397028473d956691915ed3e849atavmjong-free // First look for default style stored in <symbol>
359a38ce40498397028473d956691915ed3e849atavmjong-free gchar const* style = symbol->getAttribute("inkscape:symbol-style");
359a38ce40498397028473d956691915ed3e849atavmjong-free // If no default style in <symbol>, look in documents.
359a38ce40498397028473d956691915ed3e849atavmjong-free style = style_from_use( symbol_id.c_str(), currentDocument );
359a38ce40498397028473d956691915ed3e849atavmjong-free style = symbolDocument->getReprRoot()->attribute("style");
359a38ce40498397028473d956691915ed3e849atavmjong-free ClipboardManager *cm = ClipboardManager::get();
359a38ce40498397028473d956691915ed3e849atavmjong-free// Read Visio stencil files
359a38ce40498397028473d956691915ed3e849atavmjong-freeSPDocument* read_vss( gchar* fullname, gchar* filename ) {
359a38ce40498397028473d956691915ed3e849atavmjong-free if (!libvisio::VisioDocument::isSupported(&input)) {
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free if (!libvisio::VisioDocument::generateSVGStencils(&input, output)) {
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free tmpSVGOutput += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free tmpSVGOutput += " xmlns=\"http://www.w3.org/2000/svg\"\n";
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free tmpSVGOutput += " xmlns:svg=\"http://www.w3.org/2000/svg\"\n";
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free tmpSVGOutput += " xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n";
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free tmpSVGOutput += " style=\"fill:none;stroke:#000000;stroke-width:2\">\n";
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free // Create a string we can use for the symbol id (libvisio doesn't give us a name)
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free sanitized.erase( sanitized.find_last_of(".vss")-3 );
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free sanitized.erase( std::remove_if( sanitized.begin(), sanitized.end(), ispunct ), sanitized.end() );
a3c27728560e19f7c710399f838dadeedac39249tavmjong-free std::replace( sanitized.begin(), sanitized.end(), ' ', '_' );
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free // std::cout << filename << " |" << sanitized << "|" << std::endl;
214a2dca4418a9937d7142e42ed91fdfdb86ae16tavmjong-free // Each "symbol" is in it's own SVG file, we wrap with <symbol> and merge into one file.
438035e1fbba64c0adf12fc08de1b34afd3c9374tavmjong-free // std::cout << line << std::endl;
438035e1fbba64c0adf12fc08de1b34afd3c9374tavmjong-free if( line.find( "svg:svg" ) == std::string::npos ) {
438035e1fbba64c0adf12fc08de1b34afd3c9374tavmjong-free return SPDocument::createNewDocFromMem( tmpSVGOutput.c_str(), strlen( tmpSVGOutput.c_str()), 0 );
438035e1fbba64c0adf12fc08de1b34afd3c9374tavmjong-free/* Hunts preference directories for symbol files */
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White if( Inkscape::IO::file_test( INKSCAPE_SYMBOLSDIR, G_FILE_TEST_EXISTS ) &&
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White Inkscape::IO::file_test( INKSCAPE_SYMBOLSDIR, G_FILE_TEST_IS_DIR ) ) {
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White if( Inkscape::IO::file_test( profile_path("symbols"), G_FILE_TEST_EXISTS ) &&
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White Inkscape::IO::file_test( profile_path("symbols"), G_FILE_TEST_IS_DIR ) ) {
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White directories.push_back( profile_path("symbols") );
769a6887551cf7ff7bce4b48d3ac303cbea69507Liam P. White for( it = directories.begin(); it != directories.end(); ++it ) {
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White GDir *dir = g_dir_open( (*it).c_str(), 0, &err );
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White while( (filename = (gchar *)g_dir_read_name( dir ) ) != NULL) {
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White gchar *fullname = g_build_filename((*it).c_str(), filename, NULL);
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White if ( !Inkscape::IO::file_test( fullname, G_FILE_TEST_IS_DIR )
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White && ( Glib::str_has_suffix(fullname, ".svg") || Glib::str_has_suffix(fullname, ".vss") ) ) {
652485ad88d2a42f827c7e355220efeb3b2e37afLiam P. White Glib::ustring tag = fn.substr( fn.find_last_of(".") + 1 );
359a38ce40498397028473d956691915ed3e849atavmjong-free symbolSets[Glib::ustring(filename)]= symbol_doc;
359a38ce40498397028473d956691915ed3e849atavmjong-free // Try to read all remaining files as SVG
359a38ce40498397028473d956691915ed3e849atavmjong-free symbol_doc = SPDocument::createNewDoc( fullname, FALSE );
if( SP_IS_USE(r) ) {
if( SP_IS_SYMBOL(r) ) {
l = g_slist_prepend (l, r);
l = g_slist_reverse( l );
if( SP_IS_USE(r) ) {
l = g_slist_prepend (l, r);
if( href ) {
return style;
if( !title ) {
if( pixbuf ) {
(*row)[columns->symbol_title] = Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "Symbol", title) ));
delete columns;
if (symbol_old) {
if( !style ) {
if (dbox) {
return pixbuf;
"<svg xmlns=\"http://www.w3.org/2000/svg\""
" xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\""
" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\""
" xmlns:xlink=\"http://www.w3.org/1999/xlink\">"
rebuild();