inkscape.h File Reference

Go to the source code of this file.

Namespaces

namespace  Inkscape
 

Note: We must limit Java or JVM-specific code to this file and to dobinding.cpp.


namespace  Inkscape::XML
 

Inkscape XML tree


Defines

#define INKSCAPE   inkscape_get_instance()
#define SP_ACTIVE_EVENTCONTEXT   inkscape_active_event_context ()
#define SP_ACTIVE_DOCUMENT   inkscape_active_document ()
#define SP_ACTIVE_DESKTOP   inkscape_active_desktop ()

Functions

void inkscape_autosave_init ()
void inkscape_application_init (const gchar *argv0, gboolean use_gui)
bool inkscape_load_config (const gchar *filename, Inkscape::XML::Document *config, const gchar *skeleton, unsigned int skel_size, const gchar *e_notreg, const gchar *e_notxml, const gchar *e_notsp, const gchar *warn)
bool inkscape_load_menus (Inkscape::Application *inkscape)
 Menus management.
bool inkscape_save_menus (Inkscape::Application *inkscape)
Inkscape::XML::Nodeinkscape_get_menus (Inkscape::Application *inkscape)
Inkscape::Applicationinkscape_get_instance ()
 Returns the current Inkscape::Application global object.
SPEventContextinkscape_active_event_context (void)
SPDocumentinkscape_active_document (void)
SPDesktopinkscape_active_desktop (void)
bool inkscape_is_sole_desktop_for_document (SPDesktop const &desktop)
gchar * homedir_path (const char *filename)
gchar * profile_path (const char *filename)
 Get, or guess, or decide the location where the preferences.xml file should be located.
void inkscape_switch_desktops_next ()
void inkscape_switch_desktops_prev ()
void inkscape_get_all_desktops (std::list< SPDesktop * > &listbuf)
void inkscape_dialogs_hide ()
void inkscape_dialogs_unhide ()
void inkscape_dialogs_toggle ()
void inkscape_external_change ()
void inkscape_subselection_changed (SPDesktop *desktop)
void inkscape_refresh_display (Inkscape::Application *inkscape)
void inkscape_exit (Inkscape::Application *inkscape)
 Handler for Inkscape's Exit verb.

Define Documentation

#define INKSCAPE   inkscape_get_instance()

Definition at line 30 of file inkscape.h.

Referenced by Inkscape::UI::Dialog::AlignAndDistribute::AlignAndDistribute(), clonetiler_dialog(), clonetiler_dialog_destroy(), Inkscape::UI::Dialog::PanelDialog< Behavior::FloatingBehavior >::create(), Inkscape::UI::Dialog::Dialog::Dialog(), Inkscape::UI::Widget::Dock::Dock(), Inkscape::Extension::Effect::Effect(), Inkscape::UI::Dialog::FilterEffectsDialog::FilterModifier::FilterModifier(), homedir_path(), Inkscape::UI::Widget::ImageIcon::init(), SPDesktop::init(), inkscape_exit(), inkscape_load_menus(), Inkscape::UI::Dialogs::LayersPanel::LayersPanel(), Inkscape::UI::Widget::ObjectCompositeSettings::ObjectCompositeSettings(), on_destroy(), Inkscape::UI::Dialog::PanelDialog< Behavior::FloatingBehavior >::PanelDialog(), Inkscape::UI::Dialog::PanelDialog< Behavior >::PanelDialog(), sp_document_create(), sp_export_dialog(), sp_export_dialog_area_box(), sp_export_dialog_destroy(), sp_fill_style_widget_new(), sp_find_dialog_destroy(), sp_find_dialog_old(), sp_gradient_vector_dialog_destroy(), sp_gradient_vector_editor_new(), sp_input_dialog(), sp_input_dialog_destroy(), sp_item_dialog(), sp_item_dialog_destroy(), sp_item_widget_new(), sp_select_toolbox_prep(), sp_stroke_style_line_widget_new(), sp_stroke_style_paint_widget_new(), sp_text_edit_dialog(), sp_text_edit_dialog_destroy(), sp_ui_main_menubar(), sp_xml_tree_dialog(), Inkscape::UI::Dialog::SVGPreview::SVGPreview(), Inkscape::UI::Dialog::TileDialog::TileDialog(), Inkscape::UI::Dialog::Transformation::Transformation(), Inkscape::UI::Dialog::AlignAndDistribute::~AlignAndDistribute(), Inkscape::UI::Widget::ObjectCompositeSettings::~ObjectCompositeSettings(), SPDocument::~SPDocument(), and Inkscape::UI::Dialog::Transformation::~Transformation().

#define SP_ACTIVE_DESKTOP   inkscape_active_desktop ()

Definition at line 51 of file inkscape.h.

Referenced by Inkscape::UI::Dialogs::LayerPropertiesDialog::_apply(), Inkscape::UI::Dialog::Dialog::_defocus(), Inkscape::UI::ClipboardManagerImpl::_getScale(), Inkscape::UI::Dialog::Dialog::_getSelection(), Inkscape::UI::Dialog::Dialog::_onKeyPress(), Inkscape::UI::ClipboardManagerImpl::_pasteDefs(), Inkscape::UI::ClipboardManagerImpl::_pasteDocument(), Inkscape::UI::ClipboardManagerImpl::_pasteText(), Inkscape::UI::Dialogs::ColorItem::_updatePreviews(), Inkscape::UI::Dialog::TraceDialogImpl::abort(), Inkscape::UI::Dialog::DocumentProperties::addExternalScript(), all_items(), all_selection_items(), Inkscape::UI::Dialogs::ColorItem::buttonClicked(), clonetiler_apply(), clonetiler_dialog(), clonetiler_external_change(), clonetiler_remove(), clonetiler_unclump(), Inkscape::UI::ClipboardManagerImpl::copy(), file_import(), file_save(), Inkscape::UI::Widget::PageSizer::fire_fit_canvas_to_selection_or_drawing(), flowtext_to_text(), get_node_tool(), Inkscape::UI::ClipboardManagerImpl::getPathParameter(), Inkscape::Trace::Tracer::getSelectedSPImage(), Inkscape::UI::ClipboardManagerImpl::getShapeOrTextObjectId(), Inkscape::UI::Dialogs::handleEnterNotify(), Inkscape::UI::Dialogs::handleLeaveNotify(), inkscape_active_document(), inkscape_active_event_context(), inkscape_autosave(), item_type_match(), Inkscape::UI::Widget::RegisteredColorPicker::on_changed(), Inkscape::LivePathEffect::PathParam::on_edit_button_click(), on_picker_color_changed(), Inkscape::Extension::PrefDialog::on_response(), Inkscape::UI::Dialog::on_tool_changed(), on_window_key_press(), Inkscape::UI::Dialog::PanelDialog< Behavior::FloatingBehavior >::PanelDialog(), Inkscape::UI::Dialog::PanelDialog< Behavior >::PanelDialog(), Inkscape::LivePathEffect::PointParam::param_newWidget(), Inkscape::UI::ClipboardManagerImpl::paste(), Inkscape::UI::ClipboardManagerImpl::pastePathEffect(), Inkscape::UI::ClipboardManagerImpl::pasteSize(), Inkscape::UI::ClipboardManagerImpl::pasteStyle(), Inkscape::UI::Dialog::TraceDialogImpl::potraceProcess(), Inkscape::Extension::PrefDialog::PrefDialog(), Inkscape::Extension::PrefDialog::preview_toggle(), Inkscape::UI::Widget::PageSizer::setDim(), Inkscape::UI::Widget::ObjectCompositeSettings::setSubject(), Inkscape::Trace::Tracer::sioxProcessImage(), Inkscape::UI::Widget::sp_color_picker_color_mod(), sp_connector_graph_layout(), sp_create_window(), sp_export_area_toggled(), sp_export_detect_size(), sp_export_dialog_area_box(), sp_export_export_clicked(), sp_export_find_default_selection(), sp_export_selection_changed(), sp_export_selection_modified(), sp_export_update_checkbuttons(), sp_file_open(), sp_file_revert_dialog(), sp_file_save(), sp_file_save_a_copy(), sp_file_save_as(), sp_file_save_document(), sp_file_vacuum(), sp_fill_style_widget_fillrule_changed(), sp_fill_style_widget_paint_changed(), sp_fill_style_widget_paint_dragged(), sp_fill_style_widget_update(), sp_find_dialog_find(), sp_guide_description(), sp_item_widget_hidden_toggled(), sp_item_widget_label_changed(), sp_item_widget_new(), sp_item_widget_sensitivity_toggled(), sp_lpe_item_perform_path_effect(), sp_object_layout_any_value_changed(), sp_select_toolbox_prep(), sp_stroke_style_any_toggled(), sp_stroke_style_line_update(), sp_stroke_style_line_widget_new(), sp_stroke_style_paint_changed(), sp_stroke_style_paint_dragged(), sp_stroke_style_paint_update(), sp_stroke_style_scale_line(), sp_te_delete(), sp_te_insert(), sp_te_insert_line(), sp_ted_get_selected_text_count(), sp_ted_get_selected_text_item(), sp_text_description(), sp_text_edit_dialog_apply(), sp_text_edit_dialog_read_selection(), sp_transientize(), sp_ui_close_all(), sp_ui_close_view(), sp_ui_drag_data_received(), sp_ui_overwrite_file(), sp_xml_tree_dialog(), sp_xmlview_content_changed(), stroke_width_set_unit(), Inkscape::UI::Dialog::StyleFromSelectionToTool(), text_flow_into_shape(), text_put_on_path(), text_remove_all_kerns(), text_remove_from_path(), text_unflow(), Inkscape::Trace::Potrace::PotraceTracingEngine::traceBrightnessMulti(), Inkscape::Trace::Potrace::PotraceTracingEngine::traceQuant(), Inkscape::Trace::Tracer::traceThread(), Inkscape::UI::Widget::ToleranceSlider::update(), and Inkscape::UI::Widget::RegisteredWidget< Random >::write_to_xml().

#define SP_ACTIVE_DOCUMENT   inkscape_active_document ()

Definition at line 48 of file inkscape.h.

Referenced by Inkscape::UI::ClipboardManagerImpl::_pasteImage(), ColorICCSelector::_profilesChanged(), ColorNotebook::_updateRgbaEntry(), Inkscape::UI::Dialog::DocumentProperties::build_scripting(), create_filepath_from_id(), Inkscape::Bind::documentGet(), Inkscape::Extension::Internal::getODFBoundingBox(), Inkscape::Extension::Internal::getODFTransform(), ink_pattern_menu(), Inkscape::UI::Widget::EntityMultiLineEntry::on_changed(), Inkscape::UI::Widget::EntityLineEntry::on_changed(), Inkscape::UI::Widget::LicenseItem::on_toggled(), persp3d_get_from_repr(), Inkscape::UI::Dialog::DocumentProperties::populate_external_scripts_box(), Inkscape::Extension::Internal::OdfOutput::preprocess(), rdf_set_repr_text(), Inkscape::UI::Dialog::DocumentProperties::removeExternalScript(), Inkscape::ColorProfile::set(), Inkscape::UI::Widget::StyleSwatch::setStyle(), sp_desktop_get_font_size_tool(), sp_export_area_toggled(), sp_export_dialog(), sp_export_export_clicked(), sp_file_import(), sp_file_import_from_ocal(), sp_file_print(), sp_file_print_preview(), sp_file_save(), sp_file_save_a_copy(), sp_file_save_as(), sp_file_vacuum(), sp_fill_style_widget_fillrule_changed(), sp_fill_style_widget_paint_changed(), sp_fill_style_widget_update(), sp_item_widget_hidden_toggled(), sp_item_widget_label_changed(), sp_item_widget_sensitivity_toggled(), sp_stroke_style_line_update(), sp_stroke_style_paint_changed(), sp_stroke_style_paint_update(), sp_text_edit_dialog_read_selection(), sp_ui_drag_data_received(), sp_ui_import_one_file(), sp_ui_new_view(), sp_ui_new_view_preview(), spdc_create_single_dot(), Inkscape::Trace::Tracer::traceThread(), Inkscape::UI::Dialog::DocumentMetadata::update(), and Inkscape::Extension::Internal::OdfOutput::writeTree().

#define SP_ACTIVE_EVENTCONTEXT   inkscape_active_event_context ()

Definition at line 45 of file inkscape.h.


Function Documentation

gchar* homedir_path ( const char *  filename  ) 

Definition at line 1371 of file inkscape.cpp.

References INKSCAPE, and NULL.

Referenced by create_filepath_from_id(), inkscape_crash_handler(), profile_path(), and sp_selection_create_bitmap_copy().

01372 {
01373     static const gchar *homedir = NULL;
01374     if (!homedir) {
01375         homedir = g_get_home_dir();
01376     }
01377     if (!homedir) {
01378         homedir = g_path_get_dirname(INKSCAPE->argv0);
01379     }
01380     return g_build_filename(homedir, filename, NULL);
01381 }

SPEventContext* inkscape_active_event_context ( void   ) 

Definition at line 1330 of file inkscape.cpp.

References NULL, SP_ACTIVE_DESKTOP, and sp_desktop_event_context().

Referenced by persp3d_set(), and Box3D::VPDrag::updateBoxHandles().

01331 {
01332     if (SP_ACTIVE_DESKTOP) {
01333         return sp_desktop_event_context (SP_ACTIVE_DESKTOP);
01334     }
01335 
01336     return NULL;
01337 }

void inkscape_application_init ( const gchar *  argv0,
gboolean  use_gui 
)

Definition at line 780 of file inkscape.cpp.

References abrt_handler, Inkscape::Application::argv0, bus_handler, DEFAULT_LOG_REDIRECT, fpe_handler, Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), Inkscape::UI::Dialog::DebugDialog::getInstance(), Inkscape::Preferences::getInt(), Inkscape::Preferences::getLastError(), Inkscape::Preferences::getString(), InkErrorHandler::handleError(), ill_handler, Inkscape::Extension::init(), inkscape_autosave_init(), inkscape_crash_handler(), inkscape_load_menus(), inkscape_mapalt(), inkscape_trackalt(), Inkscape::Bind::msg(), NULL, segv_handler, Inkscape::Preferences::setErrorHandler(), sp_input_load_from_preferences(), SP_TYPE_INKSCAPE, TRUE, and Inkscape::Application::use_gui.

Referenced by Inkscape::UI::Widget::ImageIcon::init(), sp_main_console(), sp_main_gui(), and Inkscape::UI::Dialog::SVGPreview::SVGPreview().

00781 {
00782     inkscape = (Inkscape::Application *)g_object_new (SP_TYPE_INKSCAPE, NULL);
00783     /* fixme: load application defaults */
00784 
00785     segv_handler = signal (SIGSEGV, inkscape_crash_handler);
00786     abrt_handler = signal (SIGABRT, inkscape_crash_handler);
00787     fpe_handler  = signal (SIGFPE,  inkscape_crash_handler);
00788     ill_handler  = signal (SIGILL,  inkscape_crash_handler);
00789 #ifndef WIN32
00790     bus_handler  = signal (SIGBUS,  inkscape_crash_handler);
00791 #endif
00792 
00793     inkscape->use_gui = use_gui;
00794     inkscape->argv0 = g_strdup(argv0);
00795 
00796     /* Load the preferences and menus */
00797     Inkscape::Preferences *prefs = Inkscape::Preferences::get();
00798     InkErrorHandler* handler = new InkErrorHandler(use_gui);
00799     prefs->setErrorHandler(handler);
00800     {
00801         Glib::ustring msg;
00802         Glib::ustring secondary;
00803         if (prefs->getLastError( msg, secondary )) {
00804             handler->handleError(msg, secondary);
00805         }
00806     }
00807 
00808     if (use_gui) {
00809         inkscape_load_menus(inkscape);
00810         sp_input_load_from_preferences();
00811     }
00812 
00813     /* set language for user interface according setting in preferences */
00814     Glib::ustring ui_language = prefs->getString("/ui/language");
00815     if(!ui_language.empty())
00816     {
00817         setenv("LANGUAGE", ui_language, 1);
00818     }
00819 
00820     /* DebugDialog redirection.  On Linux, default to OFF, on Win32, default to ON.
00821      * Use only if use_gui is enabled
00822      */
00823 #ifdef WIN32
00824 #define DEFAULT_LOG_REDIRECT true
00825 #else
00826 #define DEFAULT_LOG_REDIRECT false
00827 #endif
00828 
00829     if (use_gui == TRUE && prefs->getBool("/dialogs/debug/redirect", DEFAULT_LOG_REDIRECT))
00830     {
00831         Inkscape::UI::Dialog::DebugDialog::getInstance()->captureLogMessages();
00832     }
00833 
00834     /* Check for global remapping of Alt key */
00835     if (use_gui)
00836     {
00837         inkscape_mapalt(guint(prefs->getInt("/options/mapalt/value", 0)));
00838         inkscape_trackalt(guint(prefs->getInt("/options/trackalt/value", 0)));
00839     }
00840 
00841     /* Initialize the extensions */
00842     Inkscape::Extension::init();
00843 
00844     inkscape_autosave_init();
00845 
00846     return;
00847 }

void inkscape_autosave_init (  ) 

Definition at line 429 of file inkscape.cpp.

References Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), Inkscape::Preferences::getInt(), inkscape_autosave(), and NULL.

Referenced by inkscape_application_init().

00430 {
00431     static guint32 autosave_timeout_id = 0;
00432     Inkscape::Preferences *prefs = Inkscape::Preferences::get();
00433 
00434     // Turn off any previously initiated timeouts
00435     if ( autosave_timeout_id ) {
00436         g_source_remove(autosave_timeout_id);
00437         autosave_timeout_id = 0;
00438     }
00439 
00440     // g_debug("options.autosave.enable = %d", prefs->getBool("/options/autosave/enable", true));
00441     // Is autosave enabled?
00442     if (!prefs->getBool("/options/autosave/enable", true)){
00443         autosave_timeout_id = 0;
00444     } else {
00445         // Turn on autosave
00446         guint32 timeout = prefs->getInt("/options/autosave/interval", 10) * 60;
00447         // g_debug("options.autosave.interval = %d", prefs->getInt("/options/autosave/interval", 10));
00448 #if GLIB_CHECK_VERSION(2,14,0)
00449         autosave_timeout_id = g_timeout_add_seconds(timeout, inkscape_autosave, NULL);
00450 #else
00451         autosave_timeout_id = g_timeout_add(timeout * 1000, inkscape_autosave, NULL);
00452 #endif
00453     }
00454 }

void inkscape_dialogs_toggle (  ) 

Definition at line 1209 of file inkscape.cpp.

References Inkscape::Application::dialogs_toggle, inkscape_dialogs_hide(), and inkscape_dialogs_unhide().

Referenced by Inkscape::DialogVerb::perform().

01210 {
01211     if (inkscape->dialogs_toggle) {
01212         inkscape_dialogs_hide ();
01213     } else {
01214         inkscape_dialogs_unhide ();
01215     }
01216 }

void inkscape_exit ( Inkscape::Application  ) 

Handler for Inkscape's Exit verb.

This emits the shutdown signal, saves the preferences if appropriate, and quits.

Definition at line 1359 of file inkscape.cpp.

References INKSCAPE, inkscape_signals, SHUTDOWN_SIGNAL, and Inkscape::Preferences::unload().

Referenced by inkscape_remove_desktop().

01360 {
01361     g_assert (INKSCAPE);
01362 
01363     //emit shutdown signal so that dialogs could remember layout
01364     g_signal_emit (G_OBJECT (INKSCAPE), inkscape_signals[SHUTDOWN_SIGNAL], 0);
01365 
01366     Inkscape::Preferences::unload();
01367     gtk_main_quit ();
01368 }

void inkscape_external_change (  ) 

Definition at line 1219 of file inkscape.cpp.

References EXTERNAL_CHANGE, inkscape_signals, and NULL.

Referenced by sp_document_redo(), and sp_document_undo().

01220 {
01221     g_return_if_fail (inkscape != NULL);
01222 
01223     g_signal_emit (G_OBJECT (inkscape), inkscape_signals[EXTERNAL_CHANGE], 0);
01224 }

void inkscape_get_all_desktops ( std::list< SPDesktop * > &  listbuf  ) 

Definition at line 1508 of file inkscape.cpp.

References Inkscape::Application::desktops, and NULL.

Referenced by Inkscape::Whiteboard::ChooseDesktop::doSetup(), and Inkscape::CmdLineAction::idle().

01509 {
01510     for(GSList* l = inkscape->desktops; l != NULL; l = l->next) {
01511         listbuf.push_back(static_cast< SPDesktop* >(l->data));
01512     }
01513 }

Inkscape::Application* inkscape_get_instance (  ) 

Returns the current Inkscape::Application global object.

Definition at line 853 of file inkscape.cpp.

Referenced by Inkscape::createSuiteAndDocument(), and inkscape_crash_handler().

00854 {
00855         return inkscape;
00856 }

Inkscape::XML::Node* inkscape_get_menus ( Inkscape::Application inkscape  ) 

Definition at line 1500 of file inkscape.cpp.

References Inkscape::XML::Node::firstChild(), Inkscape::Application::menus, Inkscape::XML::Node::name(), and Inkscape::XML::Node::root().

Referenced by Inkscape::Extension::Effect::Effect(), and sp_ui_main_menubar().

01501 {
01502     Inkscape::XML::Node *repr = inkscape->menus->root();
01503     g_assert (!(strcmp (repr->name(), "inkscape")));
01504     return repr->firstChild();
01505 }

bool inkscape_is_sole_desktop_for_document ( SPDesktop const &  desktop  ) 

Definition at line 1314 of file inkscape.cpp.

References Inkscape::Application::desktops, and Inkscape::UI::View::View::doc().

Referenced by SPDesktopWidget::shutdown().

01314                                                                      {
01315     SPDocument const* document = desktop.doc();
01316     if (!document) {
01317         return false;
01318     }
01319     for ( GSList *iter = inkscape->desktops ; iter ; iter = iter->next ) {
01320         SPDesktop *other_desktop=(SPDesktop *)iter->data;
01321         SPDocument *other_document=other_desktop->doc();
01322         if ( other_document == document && other_desktop != &desktop ) {
01323             return false;
01324         }
01325     }
01326     return true;
01327 }

bool inkscape_load_config ( const gchar *  filename,
Inkscape::XML::Document config,
const gchar *  skeleton,
unsigned int  skel_size,
const gchar *  e_notreg,
const gchar *  e_notxml,
const gchar *  e_notsp,
const gchar *  warn 
)
bool inkscape_load_menus ( Inkscape::Application  ) 

Menus management.

Definition at line 867 of file inkscape.cpp.

References INKSCAPE, MENUS_FILE, menus_skeleton, MENUS_SKELETON_SIZE, NULL, profile_path(), and sp_repr_read_mem().

Referenced by inkscape_application_init().

00868 {
00869     // TODO fix that fn is being leaked
00870     gchar *fn = profile_path(MENUS_FILE);
00871     gchar *menus_xml = NULL;
00872     gsize len = 0;
00873 
00874     if (g_file_get_contents(fn, &menus_xml, &len, NULL)) {
00875         // load the menus_xml file
00876         INKSCAPE->menus = sp_repr_read_mem(menus_xml, len, NULL);
00877         g_free(menus_xml);
00878         if (INKSCAPE->menus) {
00879             return true;
00880         }
00881     }
00882     INKSCAPE->menus = sp_repr_read_mem(menus_skeleton, MENUS_SKELETON_SIZE, NULL);
00883     return (INKSCAPE->menus != 0);
00884 }

void inkscape_refresh_display ( Inkscape::Application inkscape  ) 

Definition at line 1346 of file inkscape.cpp.

References Inkscape::Application::desktops, and NULL.

01347 {
01348     for (GSList *l = inkscape->desktops; l != NULL; l = l->next) {
01349         (static_cast<Inkscape::UI::View::View*>(l->data))->requestRedraw();
01350     }
01351 }

bool inkscape_save_menus ( Inkscape::Application inkscape  ) 
void inkscape_subselection_changed ( SPDesktop desktop  ) 

Definition at line 917 of file inkscape.cpp.

References CHANGE_SUBSELECTION, DESKTOP_IS_ACTIVE, Inkscape::NSApplication::Application::getNewGui(), inkscape_signals, NULL, and Inkscape::NSApplication::Editor::subSelectionChanged().

Referenced by SPDesktop::emitToolSubselectionChanged().

00918 {
00919     if (Inkscape::NSApplication::Application::getNewGui()) {
00920         Inkscape::NSApplication::Editor::subSelectionChanged (desktop);
00921         return;
00922     }
00923     g_return_if_fail (desktop != NULL);
00924 
00925     if (DESKTOP_IS_ACTIVE (desktop)) {
00926         g_signal_emit (G_OBJECT (inkscape), inkscape_signals[CHANGE_SUBSELECTION], 0, desktop);
00927     }
00928 }

void inkscape_switch_desktops_next (  ) 

Definition at line 1165 of file inkscape.cpp.

References inkscape_next_desktop(), and SPDesktop::presentWindow().

Referenced by Inkscape::FileVerb::perform().

01166 {
01167     inkscape_next_desktop()->presentWindow();
01168 }

void inkscape_switch_desktops_prev (  ) 

Definition at line 1173 of file inkscape.cpp.

References inkscape_prev_desktop(), and SPDesktop::presentWindow().

Referenced by Inkscape::FileVerb::perform().

01174 {
01175     inkscape_prev_desktop()->presentWindow();
01176 }

gchar* profile_path ( const char *  filename  ) 

Get, or guess, or decide the location where the preferences.xml file should be located.

Definition at line 1389 of file inkscape.cpp.

References Inkscape::IO::file_test(), homedir_path(), INKSCAPE_LEGACY_PROFILE_DIR, INKSCAPE_PROFILE_DIR, INKSCAPE_PROFILE_DIR_047DEV, Inkscape::Preferences::migrate(), polyhedron_3d::name, NULL, and dxf_input::val.

Referenced by Inkscape::Preferences::_load(), Inkscape::Extension::Extension::error_file_open(), Inkscape::Extension::ErrorFileNotice::ErrorFileNotice(), Inkscape::UI::Dialog::FileSaveDialogImplGtk::FileSaveDialogImplGtk(), Inkscape::Extension::Internal::Filter::Filter::filters_all_files(), Inkscape::ColorProfile::getProfileDirs(), icons_svg_paths(), inkscape_load_menus(), Inkscape::UI::Dialogs::loadEmUp(), Inkscape::Preferences::Preferences(), sp_file_new_default(), sp_main_gui(), and sp_menu_append_new_templates().

01390 {
01391     static const gchar *prefdir = NULL;
01392 
01393 
01394     if (!prefdir) {
01395         // First check for a custom environment variable for a "portable app"
01396         gchar const *val = g_getenv("INKSCAPE_PORTABLE_PROFILE_DIR");
01397         if (val) {
01398             prefdir = g_strdup(val);
01399         }
01400 
01401 #ifdef HAS_SHGetSpecialFolderLocation
01402         // prefer c:\Documents and Settings\UserName\Application Data\ to
01403         // c:\Documents and Settings\userName\;
01404         if (!prefdir) {
01405             ITEMIDLIST *pidl = 0;
01406             if ( SHGetSpecialFolderLocation( NULL, CSIDL_APPDATA, &pidl ) == NOERROR ) {
01407                 gchar * utf8Path = NULL;
01408 
01409                 if ( PrintWin32::is_os_wide() ) {
01410                     wchar_t pathBuf[MAX_PATH+1];
01411                     g_assert(sizeof(wchar_t) == sizeof(gunichar2));
01412 
01413                     if ( SHGetPathFromIDListW( pidl, pathBuf ) ) {
01414                         utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL );
01415                     }
01416                 } else {
01417                     char pathBuf[MAX_PATH+1];
01418 
01419                     if ( SHGetPathFromIDListA( pidl, pathBuf ) ) {
01420                         utf8Path = g_filename_to_utf8( pathBuf, -1, NULL, NULL, NULL );
01421                     }
01422                 }
01423 
01424                 if ( utf8Path ) {
01425                     if (!g_utf8_validate(utf8Path, -1, NULL)) {
01426                         g_warning( "SHGetPathFromIDList%c() resulted in invalid UTF-8", (PrintWin32::is_os_wide() ? 'W' : 'A') );
01427                         g_free( utf8Path );
01428                         utf8Path = 0;
01429                     } else {
01430                         prefdir = utf8Path;
01431                     }
01432                 }
01433 
01434 
01435                 /* not compiling yet...
01436 
01437                 // Remember to free the list pointer
01438                 IMalloc * imalloc = 0;
01439                 if ( SHGetMalloc(&imalloc) == NOERROR) {
01440                     imalloc->lpVtbl->Free( imalloc, pidl );
01441                     imalloc->lpVtbl->Release( imalloc );
01442                 }
01443                 */
01444             }
01445 
01446             if (prefdir) {
01447                 prefdir = g_build_filename(prefdir, INKSCAPE_PROFILE_DIR, NULL);
01448             }
01449         }
01450 #endif
01451         if (!prefdir) {
01452             prefdir = g_build_filename(g_get_user_config_dir(), INKSCAPE_PROFILE_DIR, NULL);
01453             gchar * legacyDir = homedir_path(INKSCAPE_LEGACY_PROFILE_DIR);
01454             gchar * dev47Dir = g_build_filename(g_get_user_config_dir(), INKSCAPE_PROFILE_DIR_047DEV, NULL);
01455 
01456             bool needsMigration = ( !Inkscape::IO::file_test( prefdir, G_FILE_TEST_EXISTS ) && Inkscape::IO::file_test( legacyDir, G_FILE_TEST_EXISTS ) );
01457             if (needsMigration) {
01458                 // TODO here is a point to hook in preference migration
01459                 g_warning("Preferences need to be migrated from 0.46 or older %s to %s", legacyDir, prefdir);
01460                 Inkscape::Preferences::migrate( legacyDir, prefdir );
01461             }
01462 
01463             bool needsRenameWarning = ( !Inkscape::IO::file_test( prefdir, G_FILE_TEST_EXISTS ) && Inkscape::IO::file_test( dev47Dir, G_FILE_TEST_EXISTS ) );
01464             if (needsRenameWarning) {
01465                 g_warning("Preferences need to be copied from  %s to %s", legacyDir, prefdir);
01466             }
01467 
01468             g_free(legacyDir);
01469             legacyDir = 0;
01470             g_free(dev47Dir);
01471             dev47Dir = 0;
01472             // In case the XDG user config dir of the moment does not yet exist...
01473             int mode = S_IRWXU;
01474 #ifdef S_IRGRP
01475             mode |= S_IRGRP;
01476 #endif
01477 #ifdef S_IXGRP
01478             mode |= S_IXGRP;
01479 #endif
01480 #ifdef S_IXOTH
01481             mode |= S_IXOTH;
01482 #endif
01483             if ( g_mkdir_with_parents(prefdir, mode) == -1 ) {
01484                 int problem = errno;
01485                 g_warning("Unable to create profile directory (%s) (%d)", g_strerror(problem), problem);
01486             } else {
01487                 gchar const *userDirs[] = {"keys", "templates", "icons", "extensions", "palettes", NULL};
01488                 for (gchar const** name = userDirs; *name; ++name) {
01489                     gchar *dir = g_build_filename(prefdir, *name, NULL);
01490                     g_mkdir_with_parents(dir, mode);
01491                     g_free(dir);
01492                 }
01493             }
01494         }
01495     }
01496     return g_build_filename(prefdir, filename, NULL);
01497 }