From 35a96bde514a8897f6f0fcc41c5833bf63df2e2a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:29:01 +0200 Subject: Adding upstream version 1.0.2. Signed-off-by: Daniel Baumann --- share/templates/A4leaflet-3fold-Roll.svg | 1245 +++++++++++++++++++++++++++ share/templates/CD_label_120x120.svg | 90 ++ share/templates/CMakeLists.txt | 44 + share/templates/LaTeX_Beamer.svg | 93 ++ share/templates/README | 26 + share/templates/Typography_Canvas.svg | 87 ++ share/templates/create_default_templates.py | 75 ++ share/templates/default.svg | 38 + share/templates/default_pt.svg | 38 + share/templates/default_px.svg | 38 + share/templates/i18n.py | 20 + share/templates/no_layers.svg | 41 + share/templates/templates.h | 1 + 13 files changed, 1836 insertions(+) create mode 100644 share/templates/A4leaflet-3fold-Roll.svg create mode 100644 share/templates/CD_label_120x120.svg create mode 100644 share/templates/CMakeLists.txt create mode 100644 share/templates/LaTeX_Beamer.svg create mode 100644 share/templates/README create mode 100644 share/templates/Typography_Canvas.svg create mode 100755 share/templates/create_default_templates.py create mode 100644 share/templates/default.svg create mode 100644 share/templates/default_pt.svg create mode 100644 share/templates/default_px.svg create mode 100755 share/templates/i18n.py create mode 100644 share/templates/no_layers.svg create mode 100644 share/templates/templates.h (limited to 'share/templates') diff --git a/share/templates/A4leaflet-3fold-Roll.svg b/share/templates/A4leaflet-3fold-Roll.svg new file mode 100644 index 0000000..6a0425d --- /dev/null +++ b/share/templates/A4leaflet-3fold-Roll.svg @@ -0,0 +1,1245 @@ + + + + + A4 leaflet 3-fold Roll + + + + + + + + + + + + + + image/svg+xml + + A4 leaflet 3-fold Roll + 2018-02-07 + + + Mihaela Jurković + + + + + + + + + English + + + + A4 leaflet 3-fold + + + An A4 page 3-fold Roll template with guides, print marks, and marked leaflet pages. Inner and outer page contents go into their respective Layers. + + + + + + + + + + A4 leaflet 3-fold Roll + Mihaela Jurković + An A4 page 3-fold Roll template with guides, print marks, and marked leaflet pages. Inner and outer page contents go into their respective Layers. + 2018-02-07 + A4 leaflet 3-fold + + + page 1Front cover + page 6Back cover + page 5Flap outer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/templates/CD_label_120x120.svg b/share/templates/CD_label_120x120.svg new file mode 100644 index 0000000..1f1e44b --- /dev/null +++ b/share/templates/CD_label_120x120.svg @@ -0,0 +1,90 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + CD Label 120mmx120mm + Tavmjong Bah, based on tempate by JazzyNico + Simple CD Label template with disc's pattern. + 2014-10-06 + CD label 120x120 disc disk + + + + + + + diff --git a/share/templates/CMakeLists.txt b/share/templates/CMakeLists.txt new file mode 100644 index 0000000..70665de --- /dev/null +++ b/share/templates/CMakeLists.txt @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +file(GLOB _FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.svg") + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/templates.h + COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${_FILES} > ${CMAKE_CURRENT_SOURCE_DIR}/templates.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${_FILES} +) +set_source_files_properties(${CMAKE_SOURCE_DIR}/templates.h PROPERTIES GENERATED TRUE) +add_custom_target(templates_h ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/templates.h) + +install(FILES ${_FILES} "README" DESTINATION ${INKSCAPE_SHARE_INSTALL}/templates) + + +# create localized versions of default.svg +if(ENABLE_NLS) + file(GLOB POFILES ${CMAKE_SOURCE_DIR}/po/*.po) + foreach(pofile ${POFILES}) + string(REGEX REPLACE "(.+(\\\\|/))+" "${CMAKE_BINARY_DIR}/po/" pofile ${pofile}) + string(REGEX REPLACE "\\.po$" ".gmo" pofile ${pofile}) + list(APPEND GMOFILES "${pofile}") + endforeach(pofile) + + add_custom_command( + OUTPUT default_templates.timestamp + COMMAND python3 ./create_default_templates.py ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/default.svg ${CMAKE_CURRENT_SOURCE_DIR}/create_default_templates.py ${GMOFILES} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Generating localized default templates" + ) + add_custom_target(default_templates ALL DEPENDS default_templates.timestamp) + + get_inkscape_languages() + foreach(language_code ${INKSCAPE_LANGUAGE_CODES}) + string(MAKE_C_IDENTIFIER "${language_code}" language_code_escaped) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/default.${language_code}.svg + DESTINATION ${INKSCAPE_SHARE_INSTALL}/templates + COMPONENT translations.${language_code_escaped} + OPTIONAL) + endforeach() +else() + message(STATUS "Generation of localized default templates will be skipped (building without NLS)") +endif() diff --git a/share/templates/LaTeX_Beamer.svg b/share/templates/LaTeX_Beamer.svg new file mode 100644 index 0000000..d712ab6 --- /dev/null +++ b/share/templates/LaTeX_Beamer.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + LaTeX Beamer + jiho-sf + LaTeX beamer template with helping grid. + 2007-05-20 + LaTex LaTeX latex grid beamer + + + diff --git a/share/templates/README b/share/templates/README new file mode 100644 index 0000000..b6eb3c3 --- /dev/null +++ b/share/templates/README @@ -0,0 +1,26 @@ +This folder contains the templates for new documents created in +Inkscape. They're listed in the "File > New From Template..." submenu. +A template may store any document-specific settings (such as initial +zoom and view, paper size, background and borders, metadata, window +geometry, grid and guide settings, export hints) as well as any +objects. To add a new template, simply use "File > Save Template". +Alternatively you can manually save or copy it into this folder or +(preferred option) to the corresponding "templates" directory in your +profile directory. + +Procedural templates are located in the adjacent 'extensions' +directory. By convention, they begin with 'empty_'. + + +## Default template ## + +At startup or when creating a new document, Inkscape will load the +default template, which is named "default.svg". A localized version in +the current locale (default.*.svg) will be preferred over the English +version if available. To customize the default template simply use +"File > Save Template" and make sure to enable "Set as default +template". Alternatively you can manually edit the files in this +folder or (preferred option) save or copy them to the corresponding +"templates" directory in your profile directory. Default templates in +the profile directory will always be preferred over the stock versions +that ship with Inkscape (i.e. the files in this folder). diff --git a/share/templates/Typography_Canvas.svg b/share/templates/Typography_Canvas.svg new file mode 100644 index 0000000..42a2919 --- /dev/null +++ b/share/templates/Typography_Canvas.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + Typography Canvas + Felipe C. da S. Sanc... + Empty typography canvas with helping guidelines. + 2011-05-26 + guidelines typography canvas + + + diff --git a/share/templates/create_default_templates.py b/share/templates/create_default_templates.py new file mode 100755 index 0000000..11017c7 --- /dev/null +++ b/share/templates/create_default_templates.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +# +# Creates localized default templates +# (uses default.svg as base and reads localized strings directly from .po/.gmo files) +# + +from __future__ import print_function +from __future__ import unicode_literals # make all literals unicode strings by default (even in Python 2) + +import gettext +import glob +import os +import shutil +import sys +from io import open # needed for support of encoding parameter in Python 2 + + +LAYER_STRING = 'Layer' + + +if len(sys.argv) != 3: + sys.exit("Usage:\n %s ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}" % sys.argv[0]) + +source_dir = sys.argv[1] +binary_dir = sys.argv[2] + + +# get available languages (should match the already created .gmo files) +gmofiles = glob.glob(binary_dir + '/po/*.gmo') + +languages = gmofiles +languages = [os.path.basename(language) for language in languages] # split filename from path +languages = [os.path.splitext(language)[0] for language in languages] # split extension + + +# process each language sequentially +for language in languages: + # copy .gmo file into a location where gettext can find and use it + source = binary_dir + '/po/' + language + '.gmo' + destination_dir = binary_dir + '/po/locale/' + language + '/LC_MESSAGES/' + destination = destination_dir + 'inkscape.mo' + + if not os.path.isdir(destination_dir): + os.makedirs(destination_dir) + shutil.copy(source, destination) + +# do another loop to ensure we've copied all the translations before using them +for language in languages: + # get translation with help of gettext + translation = gettext.translation('inkscape', localedir=binary_dir + '/po/locale', languages=[language]) + translated_string = translation.gettext(LAYER_STRING) + + if type(translated_string) != type(LAYER_STRING): # python2 compat (make sure translation is a Unicode string) + translated_string = translated_string.decode('utf-8') + + # now create localized version of English template file (if we have a translation) + template_file = source_dir + '/share/templates/default.svg' + output_file = binary_dir + '/share/templates/default.' + language + '.svg' + + if os.path.isfile(output_file): + os.remove(output_file) + if translated_string != LAYER_STRING: + with open(template_file, 'r', encoding='utf-8', newline='\n') as file: + filedata = file.read() + filedata = filedata.replace('Layer', translated_string) + with open(output_file, 'w', encoding='utf-8', newline='\n') as file: + file.write(filedata) + + +# create timestamp file (indicates last successful creation for build system) +timestamp_file = binary_dir + '/share/templates/default_templates.timestamp' +if os.path.exists(timestamp_file): + os.utime(timestamp_file, None) +else: + open(timestamp_file, 'a').close() diff --git a/share/templates/default.svg b/share/templates/default.svg new file mode 100644 index 0000000..71e3f42 --- /dev/null +++ b/share/templates/default.svg @@ -0,0 +1,38 @@ + + + + + + + + + image/svg+xml + + + + + + diff --git a/share/templates/default_pt.svg b/share/templates/default_pt.svg new file mode 100644 index 0000000..79cb11d --- /dev/null +++ b/share/templates/default_pt.svg @@ -0,0 +1,38 @@ + + + + + + + + + image/svg+xml + + + + + + diff --git a/share/templates/default_px.svg b/share/templates/default_px.svg new file mode 100644 index 0000000..26a1ba4 --- /dev/null +++ b/share/templates/default_px.svg @@ -0,0 +1,38 @@ + + + + + + + + + image/svg+xml + + + + + + diff --git a/share/templates/i18n.py b/share/templates/i18n.py new file mode 100755 index 0000000..96593b6 --- /dev/null +++ b/share/templates/i18n.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +from xml.dom import minidom +import sys + +elements = ["inkscape:_name", "inkscape:_shortdesc", "inkscape:_keywords"] + +sys.stdout.write("char * stringlst = [") + +for filename in sys.argv[1:]: + doc = minidom.parse(filename) + templates = doc.getElementsByTagName('inkscape:_templateinfo') + + if templates: + for element in elements: + lines = templates[0].getElementsByTagName(element) + if lines: + sys.stdout.write("N_(\"" + lines[0].firstChild.nodeValue + "\"),") + +sys.stdout.write("];") diff --git a/share/templates/no_layers.svg b/share/templates/no_layers.svg new file mode 100644 index 0000000..a82a392 --- /dev/null +++ b/share/templates/no_layers.svg @@ -0,0 +1,41 @@ + + + + + + + + + image/svg+xml + + + + + + No Layers + Empty sheet with no layers + no layers empty + + diff --git a/share/templates/templates.h b/share/templates/templates.h new file mode 100644 index 0000000..46eb1be --- /dev/null +++ b/share/templates/templates.h @@ -0,0 +1 @@ +char * stringlst = [N_("A4 leaflet 3-fold Roll"),N_("An A4 page 3-fold Roll template with guides, print marks, and marked leaflet pages. Inner and outer page contents go into their respective Layers."),N_("A4 leaflet 3-fold"),N_("CD Label 120mmx120mm "),N_("Simple CD Label template with disc's pattern."),N_("CD label 120x120 disc disk"),N_("LaTeX Beamer"),N_("LaTeX beamer template with helping grid."),N_("LaTex LaTeX latex grid beamer"),N_("Typography Canvas"),N_("Empty typography canvas with helping guidelines."),N_("guidelines typography canvas"),N_("No Layers"),N_("Empty sheet with no layers"),N_("no layers empty"),]; \ No newline at end of file -- cgit v1.2.3