summaryrefslogtreecommitdiffstats
path: root/src/extension/extension.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-10-19Extensions: catch parameters and translatable values with empty namePatrick Storz1-0/+5
A parameter with empty name (or name consisting of whitespace only) can cause undefined behavior and should be avoided at all cost. Empty translatable values like "gui-text"/"gui-description", while not encouraged, might be acceptable. However they must not be translated as gettext would return the full metadata of the .po file in this case.
2019-10-19Extensions: Implement translationdomain functionalityPatrick Storz1-7/+122
Inkscape will read the "translationdomain" attribute from the <inkscape-extension> root element in the .inx file. It will then attempt to lookup a message catalog that matches this domain, register it with gettext, and use it for translations. Message catalogs may be located in either - the .inx file's location - the root of the "extensions" directory containing the .inx - the system location Inkscape's own catalog is loaded from To make this functionality available to script extensions, Inkscape will set the environment variables INKEX_GETTEXT_DOMAIN and INKEX_GETTEXT_DIRECTORY so extension scripts can then use something like bindtextdomain(INKEX_GETTEXT_DOMAIN, INKEX_GETTEXT_DIRECTORY) textdomain(INKEX_GETTEXT_DOMAIN) to enable the feature. See also https://gitlab.com/inkscape/inkscape/issues/333 https://gitlab.com/inkscape/extensions/issues/117
2019-10-15Extensions: Disable effects that failed to loadPatrick Storz1-7/+6
Instead of removing them from the menu, they're now shown as inactive (greyed out), so users have a chance to know they even exists, without having to know about extension-errors.log Unfortunately tooltips seem to be hidden for insensitive menuitems as well, so we currently have no way of informing the user directly in the UI about the problem. Fixes https://gitlab.com/inkscape/inkscape/issues/470
2019-10-15Extensions: Do not even attempt to register incompatible extensionsPatrick Storz1-12/+10
This improves the fix for https://bugs.launchpad.net/inkscape/+bug/1307554 Also fixes a potential crashing issue when an .inx includes invalid XML.
2019-10-15Extensions: Fix file test when checking dependencies by typePatrick Storz1-2/+4
For "executable" files only existence was checked. (Glib::file_test needs a single FileTest) Apply this properly when checking script <command>s and xslt <file>s - interpreted scripts and xslt files -> only check existence - un-interpreted scripts -> check for executable file For Windows workarounds are implemented to yield desirable behavior: - as there is no executable bit, only check existence - as executables usually come with an extensions, scan for those as well.
2019-10-14Extensions: Switch .xslt file look-up to dependency logic as wellPatrick Storz1-1/+8
2019-10-14Extensions: Improve logic to lookup script extensionsPatrick Storz1-7/+31
- Use identical logic for looking up <dependency>s and <command>s. - Remove duplicate (but inconsistent and incomplete) logic from script.cpp that was used to search for the <command> again - Remove <check> element from .inx format It seems unused (at the very least by core extensions) and redundant to <dependency> checking - Deprecate the <command>-specific "reldir" attribute. Consistently use the functionally identical "location" attribute that was only used for <dependency>s before - Introduce the new relative location value location="inx", which looks up <dependencies> and <command>s relative to the .inx file's location.
2019-09-26Extensions: Fix filename encoding issues in error loggingPatrick Storz1-16/+24
(std::ostream is not properly portable unfortunately)
2019-09-01Add appearance="multiline" to parameters of type stringPatrick Storz1-1/+2
Renders a Gtk::TextView that automatically fills the available space in the extension's preferences dialog and can be used to accept longer multi-line strings. Newlines in the string value will be passed as "\\n" to the extension script (i.e. literal '\n' with the backspace escaped).
2019-08-31Add base_directory for extensions loaded from a file.Patrick Storz1-2/+7
2019-08-31Remove completely unused "doc" and "node" parametersPatrick Storz1-53/+27
2019-08-31Re-implement get_param() locally using get_widgets()Patrick Storz1-48/+45
2019-08-31Make parameter string generation a job of Inkscape::ExtensionPatrick Storz1-2/+19
For this take a first step towards properly tracking children of each parameter and provide functions to look up all widgets.
2019-08-31Optimize parameter string generationPatrick Storz1-1/+1
Also rename overloaded string() functions, so it's clear what they actually do, as it's not the same thing at all...
2019-08-31cleanup includes a bitPatrick Storz1-0/+2
2019-08-31Switch Inkscape::Extension to use InxWidgets instead of InxParametersPatrick Storz1-39/+54
2019-08-31Rename Parameter -> InxParameter for consistencyPatrick Storz1-20/+20
2019-08-31Implement "translationdomain" attribute for extensionsPatrick Storz1-3/+36
Will allow extensions to ship their own message catalog used for translation of the extension#s strings. Needs to be set on the root <inkscape-extension> element of the .inx Currently supported values: - unset: use default textdomain (which happens to be 'inkscape') - 'inkscape': use Inkscape's message catalog - 'none': disable translation for the extension's strings
2019-08-31Properly handle extensions without id or namePatrick Storz1-59/+58
We used to fail silently, crashing later-on.
2019-08-31Refactor a lot of the parameter handling codePatrick Storz1-152/+155
Many fixes, improvements and simplifications to existing code. Implements the first part of the changes discussed in https://gitlab.com/inkscape/inkscape/issues/333
2019-08-31Remove effectively unused "silent" option from extensions.Patrick Storz1-15/+1
See also https://gitlab.com/inkscape/inkscape/merge_requests/698
2019-08-31Remove unused and disabled "help" feature for extensionsPatrick Storz1-28/+1
2019-08-31Rename parameter source files to avoid name conflictsPatrick Storz1-1/+1
2019-08-31Move prefdialog to own directoryPatrick Storz1-1/+1
2019-06-16Replace deprecated Gtk::Misc functionsKarl Cheng1-1/+2
2019-05-26Rm unused code now Gtk+ >= 3.22 dependency is setAlexander Valavanis1-4/+0
2019-04-02Tidy various dialog UIsNathan Lee1-6/+10
2019-01-02modernize loopsMarc Jeanmougin1-5/+5
2018-11-08Clarify licensesMax Gaukler1-1/+2
- add license headers to everything - convert a few files from public domain or LGPL2.1+ to GPL2+ - some archaeology to clarify which files are from which library
2018-10-01Remove #include "config.h" wherever possibleEduard Braun1-4/+0
2018-10-01Use _WIN32 instead of WIN32Eduard Braun1-1/+1
The former is guaranteed to be set for any compiler targeting win32, the latter is implementation dependent (but works for gcc) See also http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
2018-06-19Run clang-tidy’s modernize-redundant-void-arg pass.Emmanuel Gil Peyrot1-16/+16
2018-06-18Run clang-tidy’s modernize-use-nullptr pass.Emmanuel Gil Peyrot1-24/+24
This replaces all NULL or 0 with nullptr when assigned to or returned as a pointer.
2018-05-04Revert "Fix include order with clang-tidy check llvm-include-order"Marc Jeanmougin1-6/+6
This reverts commit bba4ff6672494fab59286b50f6c645ad62a47e60.
2018-04-29Fix include order with clang-tidy check llvm-include-orderMarc Jeanmougin1-6/+6
2018-01-08Misc. typosluz.paz1-2/+2
Found via `codespell`
2017-12-20Make script warnings transient for "Working..." dialogEduard Braun1-0/+1
This turned out to be a bit of a mess due to the interplay between the classes Script / ExecutionEnv / Effect / PrefDialog. (Basically they don't talk to each other much but all want to contribute to the GUI) Likely "Script" (and possibly "ExecutionEnv") should be refactored to let the other classes handle UI exclusively and throw errors where suitable.
2017-11-07Misc. typosUnknown1-1/+1
Found using `codespell -q 3 -w --skip="*.svg,*.po,*.ts,./share/tutorials,./src/libavoid,./packaging/win32/languages,./man,./src/2geom" -I ../inkscape-whitelist.txt` whereby whitelist file contained: ``` dum iff glight substract te upto ```
2017-10-01Removed all GSList occurences in .h filesMarc Jeanmougin1-17/+7
2017-07-02Move directory scanners to new get_filenames(...) callsMartin Owens1-1/+0
2017-06-28Refactor profile directory use and promote IO::Resource get_path and ↵Martin Owens1-1/+2
get_filename methods
2017-04-24Extensions: Fixes and improvements for "gui-description" parameter attribute ↵Eduard Braun1-1/+1
along the lines of r14955 - "gui-description" was always translated (as opposed to only "_gui-description") - Added possibility to specify "msgctxt" for "_gui-description" (bzr r15635)
2017-04-09Some code refactoring for consistencyEduard Braun1-3/+3
(notably "gui_hidden" -> hidden", "guitext" -> "text", "desc" -> "description") (bzr r15633.1.3)
2017-02-26Gtk+ 3 deprecation fixesAlex Valavanis1-0/+4
(bzr r15547)
2017-02-12Extensions: Harmonize appearance and try to simplify layouting a bitEduard Braun1-2/+4
(bzr r15509)
2017-02-12Extensions: Make "indent" attribute a common attribute for all parameters ↵Eduard Braun1-15/+17
that behaves more consistent and predictable than before. - Every "Parameter" now has an "_indent" member variable (specifying the indentation level; set in "Parameter::make()", see parameter.cpp) - Indentation is achieved by using "set_margin_left()" on the parameter's widget. This fixes bug #1662035 (comment #4 contains some more details about this patch). - Specifying "indent" on a parameter will now work consistently for all parameters. Previously the "indent" attribute often had no effect at all, e.g. for notebooks but also for parameters with 'appearance="full"' which was reasonable in most cases but made the outcome of using this attribute often unpredictable and is unnecessarily restrictive. - Most visible change: "description"s always used an indentation level of at least one (even if no indentation was specified). For the sake of consistency this discrepancy was dropped. Previous appearance can easily be restored by setting 'indent="1"'. Fixed bugs: - https://launchpad.net/bugs/1662035 (bzr r15508)
2016-08-03Removed unused includes, decreased compilation time. Once againAdrian Boguszewski1-1/+1
(bzr r15034)
2016-07-28Reverted changes to r15024 after many building problemsAdrian Boguszewski1-1/+1
(bzr r15027)
2016-07-28extensions: Drop GTKMM2 fallbacksAlex Valavanis1-20/+2
(bzr r15023.2.5)
2016-07-28Removed unused includes, decrease compilation timeAdrian Boguszewski1-1/+1
(bzr r15025)