Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Extension Namespace Reference

Extension support. More...

Namespaces

namespace  Implementation
 
namespace  Internal
 

Classes

class  DB
 
class  Dependency
 A class to represent a dependency for an extension. More...
 
class  Effect
 Effects are extensions that take a document and do something to it in place. More...
 
class  ExecutionEnv
 
class  ExpirationTimer
 
class  Extension
 The object that is the basis for the Extension system. More...
 
class  Input
 
class  InxParameter
 A class to represent the parameter of an extension. More...
 
class  InxWidget
 Base class to represent all widgets of an extension (including parameters) More...
 
class  Loader
 This class contains the mechanism to load c++ plugins dynamically. More...
 
class  Output
 
class  ParamBool
 A boolean parameter. More...
 
class  ParamColor
 
class  ParamFloat
 
class  ParamInt
 
class  ParamNotebook
 A class to represent a notebook parameter of an extension. More...
 
class  ParamOptionGroup
 
class  ParamPath
 
class  ParamString
 
class  PathEffect
 
class  PrefDialog
 A class to represent the preferences for an extension. More...
 
class  Print
 
class  ProcessingAction
 
class  Template
 
class  TemplatePreset
 
class  WidgetBox
 A box widget. More...
 
class  WidgetImage
 A label widget. More...
 
class  WidgetLabel
 A label widget. More...
 
class  WidgetSeparator
 A separator widget. More...
 
class  WidgetSpacer
 A separator widget. More...
 

Typedefs

typedef std::vector< std::shared_ptr< TemplatePreset > > TemplatePresets
 
typedef Implementation::Implementation *(* _getImplementation) ()
 
typedef const gchar *(* _getInkscapeVersion) ()
 
using Mode = ParamPath::Mode
 
using TemplateShow = int
 
typedef std::map< std::string, std::string > TemplatePrefs
 

Enumerations

enum  FileSaveMethod {
  FILE_SAVE_METHOD_SAVE_AS , FILE_SAVE_METHOD_SAVE_COPY , FILE_SAVE_METHOD_EXPORT , FILE_SAVE_METHOD_INKSCAPE_SVG ,
  FILE_SAVE_METHOD_TEMPORARY
}
 Used to distinguish between the various invocations of the save dialogs (and thus to determine the file type and save path offered in the dialog) More...
 
enum  TemplateVisibility : TemplateShow {
  TEMPLATE_ANY = -1 , TEMPLATE_HIDDEN = 0 , TEMPLATE_NEW_FROM = 1 , TEMPLATE_NEW_WELCOME = 2 ,
  TEMPLATE_NEW_ICON = 3 , TEMPLATE_SIZE_LIST = 4 , TEMPLATE_SIZE_SEARCH = 8 , TEMPLATE_ALL = 255
}
 

Functions

static bool _find_filename_recursive (std::string directory, std::string const &filename)
 recursively searches directory for a file named filename; returns true if found
 
static void check_extensions ()
 
static void update_pref (Glib::ustring const &pref_path, gchar const *pref_default)
 Examines the given string preference and checks to see that at least one of the registered extensions matches it. If not, a default is assigned.
 
void init ()
 Invokes the init routines for internal modules.
 
template<typename Range , typename Value >
static bool contains (Range &&range, Value const &value)
 
void load_user_extensions ()
 
void load_shared_extensions ()
 
void refresh_user_extensions ()
 Refresh user extensions.
 
static void check_extensions_internal (Extension *in_plug, gpointer in_data)
 
static std::vector< Glib::RefPtr< Gio::File > > get_files (Glib::RefPtr< Gio::AsyncResult > const &result, Glib::RefPtr< Gtk::FileDialog > const &file_dialog, Mode const mode, bool const select_multiple)
 
std::unique_ptr< SPDocumentopen (Extension *key, char const *filename, bool is_importing)
 This is a generic function to use the open function of a module (including Autodetect)
 
void save (Extension *key, SPDocument *doc, gchar const *filename, bool check_overwrite, bool official, Inkscape::Extension::FileSaveMethod save_method)
 This is a generic function to use the save function of a module (including Autodetect)
 
Printget_print (gchar const *key)
 
bool build_from_reprdoc (Inkscape::XML::Document *doc, std::unique_ptr< Implementation::Implementation > in_imp, std::string *baseDir, std::string *file_name)
 Creates a module from a Inkscape::XML::Document describing the module.
 
void build_from_file (gchar const *filename)
 This function creates a module from a filename of an XML description.
 
void build_from_mem (gchar const *buffer, std::unique_ptr< Implementation::Implementation > in_imp)
 Create a module from a buffer holding an XML description.
 
Glib::ustring get_file_save_extension (FileSaveMethod method)
 Determine the desired default file extension depending on the given file save method.
 
Glib::ustring get_file_save_path (SPDocument *doc, FileSaveMethod method)
 Determine the desired default save path depending on the given FileSaveMethod.
 
void store_file_extension_in_prefs (Glib::ustring extension, FileSaveMethod method)
 Write the given file extension back to prefs so that it can be used later on.
 
void store_save_path_in_prefs (Glib::ustring path, FileSaveMethod method)
 Write the given path back to prefs so that it can be used later on.
 
void save (Extension *key, SPDocument *doc, char const *filename, bool check_overwrite, bool official, Inkscape::Extension::FileSaveMethod save_method)
 
Printget_print (char const *key)
 
void build_from_file (char const *filename)
 
void build_from_mem (char const *buffer, std::unique_ptr< Implementation::Implementation > in_imp)
 

Variables

DB db
 This is the actual database object.
 
static std::vector< std::string > user_extensions
 
static std::vector< std::string > shared_extensions
 

Detailed Description

Extension support.

This namespace contains the extension subsystem and implementations of the internal extensions. This includes input and output filters, bitmap extensions, and printing.

Typedef Documentation

◆ _getImplementation

typedef Implementation::Implementation *(* Inkscape::Extension::_getImplementation) ()

Definition at line 27 of file loader.cpp.

◆ _getInkscapeVersion

typedef const gchar *(* Inkscape::Extension::_getInkscapeVersion) ()

Definition at line 28 of file loader.cpp.

◆ Mode

Definition at line 291 of file parameter-path.cpp.

◆ TemplatePrefs

typedef std::map<std::string, std::string> Inkscape::Extension::TemplatePrefs

Definition at line 45 of file template.h.

◆ TemplatePresets

typedef std::vector< std::shared_ptr< TemplatePreset > > Inkscape::Extension::TemplatePresets

Definition at line 49 of file implementation.h.

◆ TemplateShow

using Inkscape::Extension::TemplateShow = typedef int

Definition at line 31 of file template.h.

Enumeration Type Documentation

◆ FileSaveMethod

Used to distinguish between the various invocations of the save dialogs (and thus to determine the file type and save path offered in the dialog)

Enumerator
FILE_SAVE_METHOD_SAVE_AS 
FILE_SAVE_METHOD_SAVE_COPY 
FILE_SAVE_METHOD_EXPORT 
FILE_SAVE_METHOD_INKSCAPE_SVG 
FILE_SAVE_METHOD_TEMPORARY 

Definition at line 34 of file system.h.

◆ TemplateVisibility

Enumerator
TEMPLATE_ANY 
TEMPLATE_HIDDEN 
TEMPLATE_NEW_FROM 
TEMPLATE_NEW_WELCOME 
TEMPLATE_NEW_ICON 
TEMPLATE_SIZE_LIST 
TEMPLATE_SIZE_SEARCH 
TEMPLATE_ALL 

Definition at line 32 of file template.h.

Function Documentation

◆ _find_filename_recursive()

static bool Inkscape::Extension::_find_filename_recursive ( std::string  directory,
std::string const &  filename 
)
static

recursively searches directory for a file named filename; returns true if found

Definition at line 391 of file extension.cpp.

References _find_filename_recursive(), and name.

Referenced by _find_filename_recursive(), and Inkscape::Extension::Extension::lookup_translation_catalog().

◆ build_from_file() [1/2]

void Inkscape::Extension::build_from_file ( char const *  filename)

◆ build_from_file() [2/2]

void Inkscape::Extension::build_from_file ( gchar const *  filename)

This function creates a module from a filename of an XML description.

Parameters
filenameThe file holding the XML description of the module.

This function calls build_from_reprdoc with using sp_repr_read_file to create the reprdoc.

Definition at line 432 of file system.cpp.

References build_from_reprdoc(), Inkscape::GC::release(), and sp_repr_read_file().

Referenced by init(), load_shared_extensions(), and load_user_extensions().

◆ build_from_mem() [1/2]

void Inkscape::Extension::build_from_mem ( char const *  buffer,
std::unique_ptr< Implementation::Implementation in_imp 
)

◆ build_from_mem() [2/2]

void Inkscape::Extension::build_from_mem ( gchar const *  buffer,
std::unique_ptr< Implementation::Implementation in_imp 
)

Create a module from a buffer holding an XML description.

Parameters
bufferThe buffer holding the XML description of the module.
in_impAn owning pointer to a freshly created implementation.

This function calls build_from_reprdoc with using sp_repr_read_mem to create the reprdoc. It finds the length of the buffer using strlen.

Definition at line 459 of file system.cpp.

References build_from_reprdoc(), Inkscape::GC::release(), and sp_repr_read_mem().

Referenced by Inkscape::Extension::Internal::Filter::Filter::filter_init(), Inkscape::Extension::Internal::Filter::Filter::filters_load_node(), Inkscape::Extension::Internal::Bitmap::AdaptiveThreshold::init(), Inkscape::Extension::Internal::Bitmap::AddNoise::init(), Inkscape::Extension::Internal::Bitmap::Blur::init(), Inkscape::Extension::Internal::Bitmap::Channel::init(), Inkscape::Extension::Internal::Bitmap::Charcoal::init(), Inkscape::Extension::Internal::Bitmap::Colorize::init(), Inkscape::Extension::Internal::Bitmap::Contrast::init(), Inkscape::Extension::Internal::Bitmap::Crop::init(), Inkscape::Extension::Internal::Bitmap::CycleColormap::init(), Inkscape::Extension::Internal::Bitmap::Despeckle::init(), Inkscape::Extension::Internal::Bitmap::Edge::init(), Inkscape::Extension::Internal::Bitmap::Emboss::init(), Inkscape::Extension::Internal::Bitmap::Enhance::init(), Inkscape::Extension::Internal::Bitmap::Equalize::init(), Inkscape::Extension::Internal::Bitmap::GaussianBlur::init(), Inkscape::Extension::Internal::Bitmap::Implode::init(), Inkscape::Extension::Internal::Bitmap::Level::init(), Inkscape::Extension::Internal::Bitmap::LevelChannel::init(), Inkscape::Extension::Internal::Bitmap::MedianFilter::init(), Inkscape::Extension::Internal::Bitmap::Modulate::init(), Inkscape::Extension::Internal::Bitmap::Negate::init(), Inkscape::Extension::Internal::Bitmap::Normalize::init(), Inkscape::Extension::Internal::Bitmap::OilPaint::init(), Inkscape::Extension::Internal::Bitmap::Opacity::init(), Inkscape::Extension::Internal::Bitmap::Raise::init(), Inkscape::Extension::Internal::Bitmap::ReduceNoise::init(), Inkscape::Extension::Internal::Bitmap::Sample::init(), Inkscape::Extension::Internal::Bitmap::Shade::init(), Inkscape::Extension::Internal::Bitmap::Sharpen::init(), Inkscape::Extension::Internal::Bitmap::Solarize::init(), Inkscape::Extension::Internal::Bitmap::Spread::init(), Inkscape::Extension::Internal::Bitmap::Swirl::init(), Inkscape::Extension::Internal::Bitmap::Threshold::init(), Inkscape::Extension::Internal::Bitmap::Unsharpmask::init(), Inkscape::Extension::Internal::Bitmap::Wave::init(), Inkscape::Extension::Internal::BlurEdge::init(), Inkscape::Extension::Internal::CairoPsOutput::init(), Inkscape::Extension::Internal::CairoEpsOutput::init(), Inkscape::Extension::Internal::CairoRendererPdfOutput::init(), Inkscape::Extension::Internal::CdrInput::init(), Inkscape::Extension::Internal::Emf::init(), Inkscape::Extension::Internal::PrintEmf::init(), Inkscape::Extension::Internal::Filter::DiffuseLight::init(), Inkscape::Extension::Internal::Filter::MatteJelly::init(), Inkscape::Extension::Internal::Filter::SpecularLight::init(), Inkscape::Extension::Internal::Filter::Blur::init(), Inkscape::Extension::Internal::Filter::CleanEdges::init(), Inkscape::Extension::Internal::Filter::CrossBlur::init(), Inkscape::Extension::Internal::Filter::Feather::init(), Inkscape::Extension::Internal::Filter::ImageBlur::init(), Inkscape::Extension::Internal::Filter::Bump::init(), Inkscape::Extension::Internal::Filter::WaxBump::init(), Inkscape::Extension::Internal::Filter::Brilliance::init(), Inkscape::Extension::Internal::Filter::ChannelPaint::init(), Inkscape::Extension::Internal::Filter::ColorBlindness::init(), Inkscape::Extension::Internal::Filter::ColorShift::init(), Inkscape::Extension::Internal::Filter::Colorize::init(), Inkscape::Extension::Internal::Filter::ComponentTransfer::init(), Inkscape::Extension::Internal::Filter::Duochrome::init(), Inkscape::Extension::Internal::Filter::ExtractChannel::init(), Inkscape::Extension::Internal::Filter::FadeToBW::init(), Inkscape::Extension::Internal::Filter::Greyscale::init(), Inkscape::Extension::Internal::Filter::Invert::init(), Inkscape::Extension::Internal::Filter::Lighting::init(), Inkscape::Extension::Internal::Filter::LightnessContrast::init(), Inkscape::Extension::Internal::Filter::NudgeRGB::init(), Inkscape::Extension::Internal::Filter::NudgeCMY::init(), Inkscape::Extension::Internal::Filter::Quadritone::init(), Inkscape::Extension::Internal::Filter::SimpleBlend::init(), Inkscape::Extension::Internal::Filter::Solarize::init(), Inkscape::Extension::Internal::Filter::Tritone::init(), Inkscape::Extension::Internal::Filter::FeltFeather::init(), Inkscape::Extension::Internal::Filter::Roughen::init(), Inkscape::Extension::Internal::Filter::EdgeDetect::init(), Inkscape::Extension::Internal::Filter::Crosssmooth::init(), Inkscape::Extension::Internal::Filter::Outline::init(), Inkscape::Extension::Internal::Filter::NoiseFill::init(), Inkscape::Extension::Internal::Filter::Chromolitho::init(), Inkscape::Extension::Internal::Filter::CrossEngraving::init(), Inkscape::Extension::Internal::Filter::Drawing::init(), Inkscape::Extension::Internal::Filter::Electrize::init(), Inkscape::Extension::Internal::Filter::NeonDraw::init(), Inkscape::Extension::Internal::Filter::PointEngraving::init(), Inkscape::Extension::Internal::Filter::Posterize::init(), Inkscape::Extension::Internal::Filter::PosterizeBasic::init(), Inkscape::Extension::Internal::Filter::Snow::init(), Inkscape::Extension::Internal::Filter::ColorizableDropShadow::init(), Inkscape::Extension::Internal::Filter::InkBlot::init(), Inkscape::Extension::Internal::Filter::Blend::init(), Inkscape::Extension::Internal::Filter::ChannelTransparency::init(), Inkscape::Extension::Internal::Filter::LightEraser::init(), Inkscape::Extension::Internal::Filter::Opacity::init(), Inkscape::Extension::Internal::Filter::Silhouette::init(), Inkscape::Extension::Internal::GdkpixbufInput::init(), Inkscape::Extension::Internal::GimpGrad::init(), Inkscape::Extension::Internal::Grid::init(), Inkscape::Extension::Internal::LatexOutput::init(), Inkscape::Extension::Internal::PrintLatex::init(), Inkscape::Extension::Internal::OdfOutput::init(), Inkscape::Extension::Internal::PdfInput::init(), Inkscape::Extension::Internal::PngOutput::init(), Inkscape::Extension::Internal::PovOutput::init(), Inkscape::Extension::Internal::Svg::init(), Inkscape::Extension::Internal::Svgz::init(), Inkscape::Extension::Internal::TemplateFromFile::init(), Inkscape::Extension::Internal::TemplateOther::init(), Inkscape::Extension::Internal::TemplatePaper::init(), Inkscape::Extension::Internal::TemplateScreen::init(), Inkscape::Extension::Internal::TemplateSocial::init(), Inkscape::Extension::Internal::TemplateVideo::init(), Inkscape::Extension::Internal::VsdInput::init(), Inkscape::Extension::Internal::Wmf::init(), Inkscape::Extension::Internal::PrintWmf::init(), and Inkscape::Extension::Internal::WpgInput::init().

◆ build_from_reprdoc()

bool Inkscape::Extension::build_from_reprdoc ( Inkscape::XML::Document doc,
std::unique_ptr< Implementation::Implementation in_imp,
std::string *  baseDir,
std::string *  file_name 
)

Creates a module from a Inkscape::XML::Document describing the module.

Returns
true if extension successfully parsed, false otherwise A true return value does not guarantee an extension was actually registered, but indicates no errors occurred while parsing the extension.
Parameters
docThe XML description of the module

This function basically has two segments. The first is that it goes through the Repr tree provided, and determines what kind of module this is, and what kind of implementation to use. All of these are then stored in two enums that are defined in this function. This makes it easier to add additional types (which will happen in the future, I'm sure).

Second, there is case statements for these enums. The first one is the type of module. This is the one where the module is actually created. After that, then the implementation is applied to get the load and unload functions. If there is no implementation then these are not set. This case could apply to modules that are built in (like the SVG load/save functions).

Definition at line 305 of file system.cpp.

References db, Inkscape::XML::Node::firstChild(), MODULE_EXTENSION, MODULE_FILTER, MODULE_INPUT, MODULE_OUTPUT, MODULE_PATH_EFFECT, MODULE_PLUGIN, MODULE_PRINT, MODULE_TEMPLATE, MODULE_UNKNOWN_FUNC, MODULE_UNKNOWN_IMP, MODULE_XSLT, Inkscape::XML::Node::name(), Inkscape::XML::Node::next(), Inkscape::XML::Node::root(), and Inkscape::Extension::DB::take_ownership().

Referenced by build_from_file(), and build_from_mem().

◆ check_extensions()

static void Inkscape::Extension::check_extensions ( )
static

◆ check_extensions_internal()

static void Inkscape::Extension::check_extensions_internal ( Extension in_plug,
gpointer  in_data 
)
static

Definition at line 326 of file init.cpp.

Referenced by check_extensions().

◆ contains()

template<typename Range , typename Value >
static bool Inkscape::Extension::contains ( Range &&  range,
Value const &  value 
)
static

Definition at line 274 of file init.cpp.

References end.

Referenced by load_shared_extensions(), and load_user_extensions().

◆ get_file_save_extension()

Glib::ustring Inkscape::Extension::get_file_save_extension ( FileSaveMethod  method)

Determine the desired default file extension depending on the given file save method.

The returned string is guaranteed to be non-empty.

Parameters
methodthe file save method of the dialog
Returns
the corresponding default file extension
Todo:
no default extension set for Export? defaults to SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE is ok?

Definition at line 479 of file system.cpp.

References FILE_SAVE_METHOD_EXPORT, FILE_SAVE_METHOD_INKSCAPE_SVG, FILE_SAVE_METHOD_SAVE_AS, FILE_SAVE_METHOD_SAVE_COPY, FILE_SAVE_METHOD_TEMPORARY, Inkscape::Preferences::get(), and Inkscape::Preferences::getString().

Referenced by save(), and sp_file_save_dialog().

◆ get_file_save_path()

Glib::ustring Inkscape::Extension::get_file_save_path ( SPDocument doc,
FileSaveMethod  method 
)

Determine the desired default save path depending on the given FileSaveMethod.

The returned string is guaranteed to be non-empty.

Parameters
methodthe file save method of the dialog
docthe file's document
Returns
the corresponding default save path
Todo:
no default path set for Export?

Definition at line 506 of file system.cpp.

References FILE_SAVE_METHOD_EXPORT, FILE_SAVE_METHOD_INKSCAPE_SVG, FILE_SAVE_METHOD_SAVE_AS, FILE_SAVE_METHOD_SAVE_COPY, FILE_SAVE_METHOD_TEMPORARY, Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), SPDocument::getDocumentFilename(), and Inkscape::Preferences::getString().

Referenced by sp_file_save_dialog().

◆ get_files()

static std::vector< Glib::RefPtr< Gio::File > > Inkscape::Extension::get_files ( Glib::RefPtr< Gio::AsyncResult > const &  result,
Glib::RefPtr< Gtk::FileDialog > const &  file_dialog,
Mode const  mode,
bool const  select_multiple 
)
static

Definition at line 294 of file parameter-path.cpp.

References mode, and result.

Referenced by Inkscape::Extension::ParamPath::on_file_dialog_response().

◆ get_print() [1/2]

Print * Inkscape::Extension::get_print ( char const *  key)

◆ get_print() [2/2]

◆ init()

void Inkscape::Extension::init ( )

Invokes the init routines for internal modules.

This should be a list of all the internal modules that need to initialized. This is just a convenient place to put them.

Definition at line 156 of file init.cpp.

References build_from_file(), check_extensions(), Inkscape::IO::Resource::EXTENSIONS, Inkscape::Extension::Internal::Filter::Filter::filters_all(), Inkscape::IO::Resource::get_filenames(), Inkscape::Extension::Internal::Bitmap::AdaptiveThreshold::init(), Inkscape::Extension::Internal::Bitmap::AddNoise::init(), Inkscape::Extension::Internal::Bitmap::Blur::init(), Inkscape::Extension::Internal::Bitmap::Channel::init(), Inkscape::Extension::Internal::Bitmap::Charcoal::init(), Inkscape::Extension::Internal::Bitmap::Colorize::init(), Inkscape::Extension::Internal::Bitmap::Contrast::init(), Inkscape::Extension::Internal::Bitmap::Crop::init(), Inkscape::Extension::Internal::Bitmap::CycleColormap::init(), Inkscape::Extension::Internal::Bitmap::Despeckle::init(), Inkscape::Extension::Internal::Bitmap::Edge::init(), Inkscape::Extension::Internal::Bitmap::Emboss::init(), Inkscape::Extension::Internal::Bitmap::Enhance::init(), Inkscape::Extension::Internal::Bitmap::Equalize::init(), Inkscape::Extension::Internal::Bitmap::GaussianBlur::init(), Inkscape::Extension::Internal::Bitmap::Implode::init(), Inkscape::Extension::Internal::Bitmap::Level::init(), Inkscape::Extension::Internal::Bitmap::LevelChannel::init(), Inkscape::Extension::Internal::Bitmap::MedianFilter::init(), Inkscape::Extension::Internal::Bitmap::Modulate::init(), Inkscape::Extension::Internal::Bitmap::Negate::init(), Inkscape::Extension::Internal::Bitmap::Normalize::init(), Inkscape::Extension::Internal::Bitmap::OilPaint::init(), Inkscape::Extension::Internal::Bitmap::Opacity::init(), Inkscape::Extension::Internal::Bitmap::Raise::init(), Inkscape::Extension::Internal::Bitmap::ReduceNoise::init(), Inkscape::Extension::Internal::Bitmap::Sample::init(), Inkscape::Extension::Internal::Bitmap::Shade::init(), Inkscape::Extension::Internal::Bitmap::Sharpen::init(), Inkscape::Extension::Internal::Bitmap::Solarize::init(), Inkscape::Extension::Internal::Bitmap::Spread::init(), Inkscape::Extension::Internal::Bitmap::Swirl::init(), Inkscape::Extension::Internal::Bitmap::Unsharpmask::init(), Inkscape::Extension::Internal::Bitmap::Wave::init(), Inkscape::Extension::Internal::BlurEdge::init(), Inkscape::Extension::Internal::CairoPsOutput::init(), Inkscape::Extension::Internal::CairoEpsOutput::init(), Inkscape::Extension::Internal::CairoRendererPdfOutput::init(), Inkscape::Extension::Internal::CdrInput::init(), Inkscape::Extension::Internal::Emf::init(), Inkscape::Extension::Internal::PrintEmf::init(), Inkscape::Extension::Internal::GdkpixbufInput::init(), Inkscape::Extension::Internal::GimpGrad::init(), Inkscape::Extension::Internal::Grid::init(), Inkscape::Extension::Internal::LatexOutput::init(), Inkscape::Extension::Internal::PrintLatex::init(), Inkscape::Extension::Internal::OdfOutput::init(), Inkscape::Extension::Internal::PdfInput::init(), Inkscape::Extension::Internal::PngOutput::init(), Inkscape::Extension::Internal::PovOutput::init(), Inkscape::Extension::Internal::Svg::init(), Inkscape::Extension::Internal::Svgz::init(), Inkscape::Extension::Internal::TemplateFromFile::init(), Inkscape::Extension::Internal::TemplateOther::init(), Inkscape::Extension::Internal::TemplatePaper::init(), Inkscape::Extension::Internal::TemplateScreen::init(), Inkscape::Extension::Internal::TemplateSocial::init(), Inkscape::Extension::Internal::TemplateVideo::init(), Inkscape::Extension::Internal::VsdInput::init(), Inkscape::Extension::Internal::Wmf::init(), Inkscape::Extension::Internal::PrintWmf::init(), Inkscape::Extension::Internal::WpgInput::init(), load_shared_extensions(), load_user_extensions(), Inkscape::IO::Resource::SYSTEM, and update_pref().

Referenced by InkscapeApplication::on_startup().

◆ load_shared_extensions()

void Inkscape::Extension::load_shared_extensions ( )

◆ load_user_extensions()

◆ open()

std::unique_ptr< SPDocument > Inkscape::Extension::open ( Extension key,
char const *  filename,
bool  is_importing 
)

This is a generic function to use the open function of a module (including Autodetect)

Returns
A new document created from the filename passed in
Parameters
keyIdentifier of which module to use
filenameThe file that should be opened
is_importingIs the request an import request, for example drag & drop

First things first, are we looking at an autodetection? Well if that's the case then the module needs to be found, and that is done with a database lookup through the module DB. The foreach function is called, with the parameter being a gpointer array. It contains both the filename (to find its extension) and where to write the module when it is found.

If there is no autodetection, then the module database is queried with the key given.

If everything is cool at this point, the module is loaded, and there is possibility for preferences. If there is a function, then it is executed to get the dialog to be displayed. After it is finished the function continues.

Lastly, the open function is called in the module itself.

Definition at line 66 of file system.cpp.

References db, Inkscape::Extension::Input::find_by_filename(), Inkscape::Preferences::get(), Inkscape::Extension::DB::get(), Inkscape::Extension::Extension::get_id(), Inkscape::Preferences::getBool(), key, Inkscape::Extension::Extension::loaded(), Inkscape::Extension::Input::open(), Inkscape::Extension::Extension::prefs(), Inkscape::Extension::Extension::set_gui(), Inkscape::Extension::Extension::set_state(), sp_ui_error_dialog(), and Inkscape::Extension::Extension::STATE_LOADED.

Referenced by file_import(), ink_file_open(), and Inkscape::Extension::Implementation::Script::open().

◆ refresh_user_extensions()

void Inkscape::Extension::refresh_user_extensions ( )

Refresh user extensions.

Remember to call check_extensions() once completed.

No need to add shared extensions here (extension manager update user ones)

Definition at line 318 of file init.cpp.

References check_extensions(), and load_user_extensions().

◆ save() [1/2]

void Inkscape::Extension::save ( Extension key,
SPDocument doc,
char const *  filename,
bool  check_overwrite,
bool  official,
Inkscape::Extension::FileSaveMethod  save_method 
)

◆ save() [2/2]

void Inkscape::Extension::save ( Extension key,
SPDocument doc,
gchar const *  filename,
bool  check_overwrite,
bool  official,
Inkscape::Extension::FileSaveMethod  save_method 
)

This is a generic function to use the save function of a module (including Autodetect)

Returns
None
Parameters
keyIdentifier of which module to use
docThe document to be saved
filenameThe file that the document should be saved to
official(optional) whether to set :output_module and :modified in the document; is true for normal save, false for temporary saves

First things first, are we looking at an autodetection? Well if that's the case then the module needs to be found, and that is done with a database lookup through the module DB. The foreach function is called, with the parameter being a gpointer array. It contains both the filename (to find its extension) and where to write the module when it is found.

If there is no autodetection the module database is queried with the key given.

If everything is cool at this point, the module is loaded, and there is possibility for preferences. If there is a function, then it is executed to get the dialog to be displayed. After it is finished the function continues.

Lastly, the save function is called in the module itself.

Definition at line 162 of file system.cpp.

References Inkscape::XML::Node::attribute(), Inkscape::Extension::Output::causes_dataloss(), SPDocument::changeFilenameAndHrefs(), db, Inkscape::IO::file_is_writable(), Inkscape::IO::file_test(), Inkscape::Extension::DB::get(), get_file_save_extension(), Inkscape::Extension::Extension::get_id(), Inkscape::Extension::DB::get_output_list(), SPDocument::getDocumentFilename(), SPDocument::getReprRoot(), SPDocument::isModifiedSinceSave(), key, Inkscape::Extension::Extension::loaded(), Inkscape::Extension::Extension::prefs(), Inkscape::XML::Node::removeAttribute(), Inkscape::Extension::Output::save(), Inkscape::Extension::Extension::set_state(), Inkscape::XML::Node::setAttribute(), SPDocument::setModifiedSinceSave(), sp_ui_overwrite_file(), Inkscape::Extension::Extension::STATE_LOADED, and store_file_extension_in_prefs().

Referenced by Inkscape::Extension::Implementation::Script::_change_extension(), InkFileExportCmd::do_export_vector(), Inkscape::Extension::Internal::SvgBuilder::endLayer(), file_save(), and Inkscape::Extension::Implementation::Script::save().

◆ store_file_extension_in_prefs()

void Inkscape::Extension::store_file_extension_in_prefs ( Glib::ustring  extension,
FileSaveMethod  method 
)

Write the given file extension back to prefs so that it can be used later on.

Parameters
extensionthe file extension which should be written to prefs
methodthe file save method of the dialog

Definition at line 558 of file system.cpp.

References FILE_SAVE_METHOD_EXPORT, FILE_SAVE_METHOD_INKSCAPE_SVG, FILE_SAVE_METHOD_SAVE_AS, FILE_SAVE_METHOD_SAVE_COPY, FILE_SAVE_METHOD_TEMPORARY, Inkscape::Preferences::get(), and Inkscape::Preferences::setString().

Referenced by save().

◆ store_save_path_in_prefs()

void Inkscape::Extension::store_save_path_in_prefs ( Glib::ustring  path,
FileSaveMethod  method 
)

Write the given path back to prefs so that it can be used later on.

Parameters
paththe path which should be written to prefs
methodthe file save method of the dialog

Definition at line 576 of file system.cpp.

References FILE_SAVE_METHOD_EXPORT, FILE_SAVE_METHOD_INKSCAPE_SVG, FILE_SAVE_METHOD_SAVE_AS, FILE_SAVE_METHOD_SAVE_COPY, FILE_SAVE_METHOD_TEMPORARY, Inkscape::Preferences::get(), and Inkscape::Preferences::setString().

Referenced by sp_file_save_dialog().

◆ update_pref()

static void Inkscape::Extension::update_pref ( Glib::ustring const &  pref_path,
gchar const *  pref_default 
)
static

Examines the given string preference and checks to see that at least one of the registered extensions matches it. If not, a default is assigned.

Returns
none
Parameters
pref_pathPreference path to update
pref_defaultDefault string to set
extension_familyList of extensions to search

Definition at line 136 of file init.cpp.

References db, Inkscape::Preferences::get(), Inkscape::Preferences::getString(), and Inkscape::Preferences::setString().

Referenced by init().

Variable Documentation

◆ db

DB Inkscape::Extension::db

This is the actual database object.

There is only one of these.

Definition at line 32 of file db.cpp.

Referenced by Inkscape::Extension::Implementation::Script::_change_extension(), add_document_actions_effect(), build_from_reprdoc(), Inkscape::Extension::Dependency::check(), Inkscape::Extension::Implementation::Script::check(), Inkscape::Extension::Internal::CairoPsOutput::check(), Inkscape::Extension::Internal::CairoEpsOutput::check(), Inkscape::Extension::Internal::CairoRendererPdfOutput::check(), Inkscape::Extension::Internal::Emf::check(), Inkscape::Extension::Internal::LatexOutput::check(), Inkscape::Extension::Internal::Wmf::check(), check_extensions(), Inkscape::UI::Dialog::create_export_filters(), Inkscape::UI::Dialog::create_open_filters(), InkFileExportCmd::do_export(), InkFileExportCmd::do_export_ps_pdf(), InkFileExportCmd::do_export_svg(), Inkscape::UI::Dialog::ExtensionsGallery::ExtensionsGallery(), Inkscape::Extension::Input::find_by_filename(), Inkscape::Extension::Input::find_by_mime(), Inkscape::Extension::Template::get_any_preset(), Inkscape::Extension::Template::get_any_preset(), get_print(), Inkscape::UI::Dialog::ExtensionList::getExtension(), Inkscape::UI::Widget::TemplateList::init(), InkscapeApplication::init_extension_action_data(), ink_file_open(), open(), Inkscape::Extension::Implementation::Script::open(), Inkscape::UI::Toolbar::PageToolbar::populate_sizes(), InkscapeApplication::print_input_type_list(), Inkscape::Extension::PathEffect::processPathEffects(), save(), Inkscape::Extension::Internal::Emf::save(), Inkscape::Extension::Internal::Wmf::save(), Inkscape::Extension::Internal::CairoPsOutput::save(), Inkscape::Extension::Internal::CairoRendererPdfOutput::save(), Inkscape::Extension::Internal::CairoEpsOutput::save(), Inkscape::Extension::Implementation::Script::save(), Inkscape::UI::Dialog::ExtensionList::setup(), sp_file_save_dialog(), sp_file_save_document(), sp_file_save_template(), and update_pref().

◆ shared_extensions

std::vector<std::string> Inkscape::Extension::shared_extensions
static

Definition at line 147 of file init.cpp.

Referenced by load_shared_extensions(), and load_user_extensions().

◆ user_extensions

std::vector<std::string> Inkscape::Extension::user_extensions
static

Definition at line 146 of file init.cpp.

Referenced by load_shared_extensions(), and load_user_extensions().