Inkscape
Vector Graphics Editor
|
#include <input.h>
Classes | |
struct | no_extension_found |
struct | open_cancelled |
struct | open_failed |
Public Member Functions | |
Input (Inkscape::XML::Node *in_repr, ImplementationHolder implementation, std::string *base_directory) | |
Builds an Input object from a XML description. | |
~Input () override | |
Destroys an Input extension. | |
bool | check () override |
Validate this extension. | |
std::unique_ptr< SPDocument > | open (char const *uri, bool is_importing=false) |
This function creates a document from a file. | |
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 | can_open_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 () |
Static Public Member Functions | |
static Extension * | find_by_mime (char const *mime) |
Get an input extension by mime-type matching. | |
static Extension * | find_by_filename (char const *filename) |
Get an input extension by filename matching. | |
![]() | |
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. | |
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. | |
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 | 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::Input::Input | ( | Inkscape::XML::Node * | in_repr, |
ImplementationHolder | implementation, | ||
std::string * | base_directory | ||
) |
Builds an Input object from a XML description.
in_repr | The XML description in a Inkscape::XML::Node tree |
implementation | The module to be initialized. |
Okay, so you want to build an Input object.
This function first takes and does the build of the parent class, which is SPModule. Then, it looks for the <input> section of the XML description. Under there should be several fields which describe the input 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 42 of file input.cpp.
References Inkscape::XML::Node::attributeList(), Inkscape::XML::Node::content(), extension, filetypename, filetypetooltip, Inkscape::XML::Node::firstChild(), mimetype, name, Inkscape::XML::Node::name(), Inkscape::XML::Node::next(), Inkscape::Extension::Extension::repr, and Inkscape::Extension::Extension::set_sort_priority().
|
override |
Destroys an Input extension.
Definition at line 108 of file input.cpp.
References extension, filetypename, filetypetooltip, and mimetype.
bool Inkscape::Extension::Input::can_open_filename | ( | gchar const * | filename | ) | const |
|
overridevirtual |
Validate this extension.
This function checks to make sure that the input 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 126 of file input.cpp.
References Inkscape::Extension::Extension::check(), extension, and mimetype.
|
static |
Get an input extension by filename matching.
Does not look at file contents.
Definition at line 257 of file input.cpp.
References Inkscape::Extension::db, and Inkscape::Extension::DB::get_input_list().
Referenced by file_import(), and Inkscape::Extension::open().
|
static |
Get an input extension by mime-type matching.
Definition at line 237 of file input.cpp.
References Inkscape::Extension::db, and Inkscape::Extension::DB::get_input_list().
gchar const * Inkscape::Extension::Input::get_extension | ( | ) | const |
const char * Inkscape::Extension::Input::get_filetypename | ( | bool | translated = false | ) | const |
Get the name of the filetype supported.
Definition at line 200 of file input.cpp.
References filetypename, Inkscape::Extension::Extension::get_name(), Inkscape::Extension::Extension::get_translation(), and name.
const char * Inkscape::Extension::Input::get_filetypetooltip | ( | bool | translated = false | ) | const |
Get the tooltip for more information on the filetype.
Definition at line 221 of file input.cpp.
References filetypetooltip, and Inkscape::Extension::Extension::get_translation().
gchar const * Inkscape::Extension::Input::get_mimetype | ( | ) | const |
std::unique_ptr< SPDocument > Inkscape::Extension::Input::open | ( | char const * | uri, |
bool | is_importing = false |
||
) |
This function creates a document from a file.
uri | The filename to create the document from |
is_importing | True if the opened file is being imported |
This function acts as the first step in creating a new document from a file. The first thing that this does is make sure that the file actually exists. If it doesn't, a NULL is returned. If the file exits, then it is opened using the implementation of this extension.
Definition at line 147 of file input.cpp.
References Inkscape::Extension::Extension::imp, Inkscape::Extension::Extension::loaded(), Inkscape::Extension::Extension::set_state(), Inkscape::Extension::Extension::STATE_LOADED, and Inkscape::Extension::Extension::timer.
Referenced by Inkscape::Extension::open().
|
private |
The extension of the input files.
Definition at line 26 of file input.h.
Referenced by can_open_filename(), check(), get_extension(), Input(), and ~Input().
|
private |
A userfriendly name for the file type.
Definition at line 27 of file input.h.
Referenced by get_filetypename(), Input(), and ~Input().
|
private |
A more detailed description of the filetype.
Definition at line 28 of file input.h.
Referenced by get_filetypetooltip(), Input(), and ~Input().
|
private |