Inkscape
Vector Graphics Editor
|
#include <output.h>
Classes | |
class | export_id_not_found |
class | file_read_only |
The existing file can not be opened for writing. More... | |
struct | lost_document |
Document was closed during execution of async extension. More... | |
class | no_extension_found |
Failed because we couldn't find an extension to match the filename. More... | |
class | save_cancelled |
Saving was cancelled. More... | |
class | save_failed |
Generic failure for an undescribed reason. More... | |
Public Member Functions | |
Output (Inkscape::XML::Node *in_repr, ImplementationHolder implementation, std::string *base_directory) | |
Builds an Output object from a XML description. | |
~Output () override | |
Destroy an output extension. | |
bool | check () override |
Validate this extension. | |
void | save (SPDocument *doc, gchar const *filename, bool detachbase=false) |
Save a document as a file. | |
void | export_raster (const SPDocument *doc, std::string png_filename, gchar const *filename, bool detachbase) |
Save a rendered png as a raster output. | |
gchar const * | get_mimetype () const |
Get the mime-type that describes this extension. | |
gchar const * | get_extension () const |
Get the filename extension for this extension. | |
const char * | get_filetypename (bool translated=false) const |
Get the name of the filetype supported. | |
const char * | get_filetypetooltip (bool translated=false) const |
Get the tooltip for more information on the filetype. | |
bool | causes_dataloss () const |
bool | savecopy_only () const |
bool | is_raster () const |
bool | is_exported () const |
void | add_extension (std::string &filename) |
Adds a valid extension to the filename if it's missing. | |
bool | can_save_filename (gchar const *filename) const |
Match filename to extension that can open it. | |
![]() | |
Extension (Inkscape::XML::Node *in_repr, ImplementationHolder implementation, std::string *base_directory) | |
Constructs an Extension from a Inkscape::XML::Node. | |
virtual | ~Extension () |
void | set_state (state_t in_state) |
A function to set whether the extension should be loaded or unloaded. | |
state_t | get_state () |
A getter for the state variable. | |
bool | loaded () |
A quick function to test the state of the extension. | |
virtual bool | prefs () |
Create a dialog for preference for this extension. | |
Inkscape::XML::Node * | get_repr () |
A getter for the internal Repr, does not add a reference. | |
char const * | get_id () const |
Get the ID of this extension - not a copy don't delete! | |
char const * | get_name () const |
Get the name of this extension - not a copy don't delete! | |
virtual void | deactivate () |
This function diactivates the extension (which makes it unusable, but not deleted) | |
bool | deactivated () |
Find out the status of the extension. | |
void | printFailure (Glib::ustring const &reason) |
A quick function to print out a standard start of extension errors in the log. | |
std::string const & | getErrorReason () |
Implementation::Implementation * | get_imp () |
auto const & | get_base_directory () const |
void | set_base_directory (std::string const &base_directory) |
std::string | get_dependency_location (char const *name) |
Gets the location of the dependency file as an absolute path. | |
char const * | get_translation (char const *msgid, char const *msgctxt=nullptr) const |
Gets a translation within the context of the current extension. | |
void | set_environment (SPDocument const *doc=nullptr) |
Sets environment suitable for executing this Extension. | |
ModuleImpType | get_implementation_type () |
Uses the object's type to figure out what the type is. | |
int | get_sort_priority () const |
void | set_sort_priority (int priority) |
virtual void | run_processing_actions (SPDocument *doc) |
Runs any pre-processing actions and modifies the document. | |
unsigned int | widget_visible_count () const |
A function to get the number of visible parameters of the extension. | |
bool | get_param_bool (char const *name) const |
Gets a parameter identified by name with the bool placed in value. | |
bool | get_param_bool (char const *name, bool alt) const |
Like get_param_bool but with a default on param_not_exist error. | |
int | get_param_int (char const *name) const |
Gets a parameter identified by name with the integer placed in value. | |
int | get_param_int (char const *name, int alt) const |
Like get_param_int but with a default on param_not_exist error. | |
double | get_param_float (char const *name) const |
Gets a float parameter identified by name with the double placed in value. | |
double | get_param_float (char const *name, double alt) const |
Like get_param_float but with a default on param_not_exist error. | |
char const * | get_param_string (char const *name, char const *alt) const |
Like get_param_string but with a default on param_not_exist error. | |
char const * | get_param_string (char const *name) const |
Gets a parameter identified by name with the string placed in value. | |
char const * | get_param_optiongroup (char const *name, char const *alt) const |
Like get_param_optiongroup but with a default on param_not_exist error. | |
char const * | get_param_optiongroup (char const *name) const |
Gets a parameter identified by name with the string placed in value. | |
Colors::Color | get_param_color (char const *name) const |
Gets a parameter identified by name with the unsigned int placed in value. | |
bool | get_param_optiongroup_contains (char const *name, char const *value) const |
This is useful to find out, if a given string value is selectable in a optiongroup named \cname. | |
bool | set_param_bool (char const *name, bool value) |
Sets a parameter identified by name with the boolean in the parameter value. | |
int | set_param_int (char const *name, int value) |
Sets a parameter identified by name with the integer in the parameter value. | |
double | set_param_float (char const *name, double value) |
Sets a parameter identified by name with the double in the parameter value. | |
char const * | set_param_string (char const *name, char const *value) |
Sets a parameter identified by name with the string in the parameter value. | |
char const * | set_param_optiongroup (char const *name, char const *value) |
Sets a parameter identified by name with the string in the parameter value. | |
void | set_param_color (char const *name, Colors::Color const &color) |
void | set_param_any (char const *name, std::string const &value) |
Parses the given string value and sets a parameter identified by name. | |
void | set_param_hidden (char const *name, bool hidden) |
Gtk::Widget * | autogui (SPDocument *doc, Inkscape::XML::Node *node, sigc::signal< void()> *changeSignal=nullptr) |
A function to automatically generate a GUI from the extensions' widgets. | |
void | paramListString (std::list< std::string > &retlist) const |
A function to get the parameters in a string form. | |
void | set_gui (bool s) |
bool | get_gui () const |
Gtk::Box * | get_info_widget () |
Gtk::Box * | get_params_widget () |
Private Attributes | |
gchar * | mimetype |
What is the mime type this inputs? | |
gchar * | extension |
The extension of the input files. | |
gchar * | filetypename |
A userfriendly name for the file type. | |
gchar * | filetypetooltip |
A more detailed description of the filetype. | |
bool | dataloss |
The extension causes data loss on save. | |
bool | savecopyonly |
Limit output option to Save a Copy. | |
bool | raster = false |
Is the extension expecting a png file. | |
bool | exported = false |
Is the extension available in the export dialog. | |
Additional Inherited Members | |
![]() | |
enum | state_t { STATE_LOADED , STATE_UNLOADED , STATE_DEACTIVATED } |
An enumeration to identify if the Extension has been loaded or not. More... | |
using | ImplementationHolder = Util::HybridPointer< Implementation::Implementation > |
![]() | |
static void | error_file_open () |
A function to open the error log file. | |
static void | error_file_close () |
A function to close the error log file. | |
static void | error_file_write (Glib::ustring const &text) |
A function to write to the error log file. | |
![]() | |
static void | add_val (Glib::ustring const &labelstr, Glib::ustring const &valuestr, Gtk::Grid *table, int *row) |
![]() | |
Inkscape::XML::Node * | repr |
The XML description of the Extension. | |
ImplementationHolder | imp |
An Implementation object provides the actual implementation of the Extension. | |
std::string | _base_directory |
Directory containing the .inx file, relative paths in the extension should usually be relative to it. | |
std::unique_ptr< ExpirationTimer > | timer |
Timeout to unload after a given time. | |
bool | _translation_enabled = true |
Attempt translation of strings provided by the extension? | |
Inkscape::Extension::Output::Output | ( | Inkscape::XML::Node * | in_repr, |
ImplementationHolder | implementation, | ||
std::string * | base_directory | ||
) |
Builds an Output object from a XML description.
in_repr | The XML description in a Inkscape::XML::Node tree |
implementation | The implementation of the extension |
Okay, so you want to build an Output object.
This function looks for the <output> section of the XML description. Under there should be several fields which describe the output module to excruciating detail. Those are parsed, copied, and put into the structure that is passed in as module. Overall, there are many levels of indentation, just to handle the levels of indentation in the XML file.
Definition at line 41 of file output.cpp.
References Inkscape::XML::Node::attributeList(), Inkscape::XML::Node::content(), dataloss, exported, extension, filetypename, filetypetooltip, Inkscape::XML::Node::firstChild(), mimetype, name, Inkscape::XML::Node::name(), Inkscape::XML::Node::next(), raster, Inkscape::Extension::Extension::repr, savecopyonly, and Inkscape::Extension::Extension::set_sort_priority().
|
override |
Destroy an output extension.
Definition at line 116 of file output.cpp.
References extension, filetypename, filetypetooltip, and mimetype.
void Inkscape::Extension::Output::add_extension | ( | std::string & | filename | ) |
Adds a valid extension to the filename if it's missing.
Only used by export-single.cpp.
Definition at line 252 of file output.cpp.
References extension, and Inkscape::IO::get_file_extension().
bool Inkscape::Extension::Output::can_save_filename | ( | gchar const * | filename | ) | const |
Match filename to extension that can open it.
Definition at line 265 of file output.cpp.
|
inline |
Definition at line 61 of file output.h.
References dataloss.
Referenced by Inkscape::Extension::save().
|
overridevirtual |
Validate this extension.
This function checks to make sure that the output extension has a filename extension and a MIME type. Then it calls the parent class' check function which also checks out the implementation.
Reimplemented from Inkscape::Extension::Extension.
Definition at line 134 of file output.cpp.
References Inkscape::Extension::Extension::check(), extension, and mimetype.
void Inkscape::Extension::Output::export_raster | ( | const SPDocument * | doc, |
std::string | png_filename, | ||
gchar const * | filename, | ||
bool | detachbase | ||
) |
Save a rendered png as a raster output.
png_filename | source png file. |
filename | File to save the raster as |
Definition at line 237 of file output.cpp.
References Inkscape::Extension::Extension::imp, Inkscape::Extension::Extension::loaded(), Inkscape::Extension::Extension::set_state(), and Inkscape::Extension::Extension::STATE_LOADED.
Referenced by Inkscape::UI::Dialog::Export::exportRaster().
gchar const * Inkscape::Extension::Output::get_extension | ( | ) | const |
Get the filename extension for this extension.
Definition at line 159 of file output.cpp.
References extension.
Referenced by Inkscape::UI::Dialog::FileSaveDialog::appendExtension(), and sp_file_save_dialog().
const char * Inkscape::Extension::Output::get_filetypename | ( | bool | translated = false | ) | const |
Get the name of the filetype supported.
Definition at line 169 of file output.cpp.
References filetypename, Inkscape::Extension::Extension::get_name(), Inkscape::Extension::Extension::get_translation(), and name.
const char * Inkscape::Extension::Output::get_filetypetooltip | ( | bool | translated = false | ) | const |
Get the tooltip for more information on the filetype.
Definition at line 190 of file output.cpp.
References filetypetooltip, and Inkscape::Extension::Extension::get_translation().
gchar const * Inkscape::Extension::Output::get_mimetype | ( | ) | const |
Get the mime-type that describes this extension.
Definition at line 149 of file output.cpp.
References mimetype.
Referenced by InkFileExportCmd::do_export_ps_pdf().
|
inline |
|
inline |
Definition at line 63 of file output.h.
References raster.
Referenced by Inkscape::Extension::Implementation::Script::export_raster(), Inkscape::UI::Dialog::Export::exportRaster(), and Inkscape::UI::Dialog::Export::exportVector().
void Inkscape::Extension::Output::save | ( | SPDocument * | doc, |
gchar const * | filename, | ||
bool | detachbase = false |
||
) |
Save a document as a file.
doc | Document to save |
filename | File to save the document as |
This function does a little of the dirty work involved in saving a document so that the implementation only has to worry about getting bits on the disk.
The big thing that it does is remove and read the fields that are only used at runtime and shouldn't be saved. One that may surprise people is the output extension. This is not saved so that the IDs could be changed, and old files will still work properly.
Definition at line 215 of file output.cpp.
References SPDocument::copy(), Inkscape::Extension::Extension::imp, Inkscape::Extension::Extension::loaded(), Inkscape::Extension::Extension::run_processing_actions(), Inkscape::Extension::Extension::set_state(), and Inkscape::Extension::Extension::STATE_LOADED.
Referenced by InkFileExportCmd::do_export_extension(), Inkscape::UI::Dialog::Export::exportVector(), and Inkscape::Extension::save().
|
inline |
Definition at line 62 of file output.h.
References savecopyonly.
|
private |
The extension causes data loss on save.
Definition at line 28 of file output.h.
Referenced by causes_dataloss(), and Output().
|
private |
Is the extension available in the export dialog.
Definition at line 31 of file output.h.
Referenced by is_exported(), and Output().
|
private |
The extension of the input files.
Definition at line 25 of file output.h.
Referenced by add_extension(), can_save_filename(), check(), get_extension(), Output(), and ~Output().
|
private |
A userfriendly name for the file type.
Definition at line 26 of file output.h.
Referenced by get_filetypename(), Output(), and ~Output().
|
private |
A more detailed description of the filetype.
Definition at line 27 of file output.h.
Referenced by get_filetypetooltip(), Output(), and ~Output().
|
private |
|
private |
Is the extension expecting a png file.
Definition at line 30 of file output.h.
Referenced by is_raster(), and Output().
|
private |
Limit output option to Save a Copy.
Definition at line 29 of file output.h.
Referenced by Output(), and savecopy_only().