diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2016-10-03 22:53:15 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2016-10-03 22:53:15 +0000 |
| commit | a095610c2c4fda8011b0151d74ef8259fd80c1f3 (patch) | |
| tree | 73227654b9b7aa332e0c07a37c769ccd313e7570 /src/main.cpp | |
| parent | Merge in jabiertxof's hover information for measure tool (diff) | |
| parent | beautify idents (diff) | |
| download | inkscape-a095610c2c4fda8011b0151d74ef8259fd80c1f3.tar.gz inkscape-a095610c2c4fda8011b0151d74ef8259fd80c1f3.zip | |
xverbs branch merge by dmitry-zhulanov
Add somes "xverbs" that are like verbs but can take arguments, and yaml file parsing for batch commandline operations.
(bzr r15147)
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 004d96191..0d5f35797 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -112,6 +112,7 @@ #endif #include "main-cmdlineact.h" +#include "main-cmdlinexact.h" #include "widgets/icon.h" #include <errno.h> @@ -127,6 +128,7 @@ enum { SP_ARG_NOGUI, SP_ARG_GUI, SP_ARG_FILE, + SP_ARG_XVERBS, SP_ARG_PRINT, SP_ARG_EXPORT_PNG, SP_ARG_EXPORT_DPI, @@ -227,6 +229,11 @@ static gchar *sp_export_png_utf8 = NULL; static gchar *sp_export_svg_utf8 = NULL; static gchar *sp_global_printer_utf8 = NULL; +#ifdef WITH_YAML +static gchar *sp_xverbs_yaml_utf8 = NULL; +static gchar *sp_xverbs_yaml = NULL; +#endif // WITH_YAML + /** * Reset variables to default values. @@ -300,7 +307,12 @@ struct poptOption options[] = { POPT_ARG_STRING, NULL, SP_ARG_FILE, N_("Open specified document(s) (option string may be excluded)"), N_("FILENAME")}, - +#ifdef WITH_YAML + {"xverbs", 0, + POPT_ARG_STRING, &sp_xverbs_yaml, SP_ARG_XVERBS, + N_("xverbs command"), + N_("XVERBS_FILENAME")}, +#endif // WITH_YAML {"print", 'p', POPT_ARG_STRING, &sp_global_printer, SP_ARG_PRINT, N_("Print document(s) to specified output file (use '| program' for pipe)"), @@ -881,6 +893,9 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) fixupSingleFilename( &sp_export_png, &sp_export_png_utf8 ); fixupSingleFilename( &sp_export_svg, &sp_export_svg_utf8 ); fixupSingleFilename( &sp_global_printer, &sp_global_printer_utf8 ); +#ifdef WITH_YAML + fixupSingleFilename( &sp_xverbs_yaml, &sp_xverbs_yaml_utf8 ); +#endif // WITH_YAML } else { @@ -890,6 +905,10 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) sp_export_svg_utf8 = g_strdup( sp_export_svg ); if ( sp_global_printer ) sp_global_printer_utf8 = g_strdup( sp_global_printer ); +#ifdef WITH_YAML + if ( sp_xverbs_yaml ) + sp_xverbs_yaml_utf8 = g_strdup( sp_xverbs_yaml ); +#endif // WITH_YAML } #ifdef WITH_DBUS @@ -2131,6 +2150,16 @@ sp_process_args(poptContext ctx) } break; } +#ifdef WITH_YAML + case SP_ARG_XVERBS: { + gchar const *fn = poptGetOptArg(ctx); + if (fn != NULL) { + sp_xverbs_yaml = g_strdup(fn); + Inkscape::CmdLineXAction::createActionsFromYAML((const char *)sp_xverbs_yaml); + } + break; + } +#endif // WITH_YAML case SP_ARG_VERSION: { printf("Inkscape %s (%s)\n", Inkscape::version_string, __DATE__); exit(0); |
