Difference between revisions of "Files: Save"
(→Save) |
(→MacOS) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 23: | Line 23: | ||
=== Save === | === Save === | ||
New document: | |||
* Opens file dialog (drawing.svg, set to Inkscape SVG). | |||
If opened as: | |||
* SVG: Saves as Inkscape SVG. (If write-protected, opens file dialog.) | * SVG: Saves as Inkscape SVG. (If write-protected, opens file dialog.) | ||
* | * PDF: Saves as PDF after popping open dialog. On quitting, warns about data loss. | ||
* | * EPS: Saves as EPS after popping open dialog. On quitting, warns about data loss. | ||
* EMF: Saves as EMF after popping open dialog. On quitting, warns about data loss. | |||
* DXF: Saves as DXF 12 (even if opened as DXF 14). without popping open dialog. On quitting, warns about data loss. | * DXF: Saves as DXF 12 (even if opened as DXF 14). without popping open dialog. On quitting, warns about data loss. | ||
* PNG: Opens PNG settings then fails silently | * PNG: Opens PNG settings then fails silently | ||
Line 36: | Line 39: | ||
Can save to any vector format in file filter list. | Can save to any vector format in file filter list. | ||
* "Guess from extension" will fail if trying to save bitmap (may or may not be silently). (Will open PNG settings.) | * "Guess from extension" will fail if trying to save bitmap (may or may not be silently). (Will open PNG settings.) | ||
* "Append filename extension automatically" fails. | * "Append filename extension automatically" fails.(Bug) | ||
=== Save a copy === | === Save a copy === | ||
Line 114: | Line 117: | ||
The MacOS dialog will add a file extension if it doesn't already exist based on the File type filter setting (if the filter setting is set to a single file type). | The MacOS dialog will add a file extension if it doesn't already exist based on the File type filter setting (if the filter setting is set to a single file type). | ||
''Gio::FileInfo::get_content_type()'' returns a '''UTI''' (''public.tiff'') rather than a '''mime-type''' (''image/tiff''). | |||
=== Windows === | === Windows === | ||
Line 121: | Line 126: | ||
=== Directories === | === Directories === | ||
We keep track of the last directories for various file dialogues in preferences. A couple dialogs will fallback to the Windows' Document directory if a preference is not set. Is this desired behavior? Should it be that way on all platforms? Should it be that way for all file dialogs? If the Document directory does not exist, should we fallback to the Home directory? Glib makes it easy to find these directories (we don't need the complicated Windows code that is in ''get_start_directory()'' at the moment). | We keep track of the last directories for various file dialogues in preferences. A couple dialogs will fallback to the Windows' Document directory if a preference is not set. Is this desired behavior? Should it be that way on all platforms? Should it be that way for all file dialogs? If the Document directory does not exist, should we fallback to the Home directory? Glib makes it easy to find these directories (we don't need the complicated Windows code that is in ''get_start_directory()'' at the moment). | ||
== Supported Formats == | |||
From src/extension/internal: | |||
{| class="wikitable sortable" | |||
|+ File formats supported by Inkscape | |||
|- | |||
! File Extension !! Format/Software !! Type !! Input !! Output !! Module<sup>*</sup> | |||
|- | |||
| AI || Adobe Illustrator || Vector || ✔ || || pdf-input.cpp | |||
|- | |||
| CDR, CDT, CCX, CMX || CorelDraw || Vector || ✔ || || cdr-input.cpp, libcdr | |||
|- | |||
| DHW || ACECAD DigiMemo || Vector || ✔ || || dhw_input.py | |||
|- | |||
| DXF || AutoCAD || Vector || ✔ (13, 14?) || ✔ (12, 14) || dxf_input.py, dxf12_outlines.py, dxf_outlines.py | |||
|- | |||
| EMF || MS Enhanced Metafile|| Vector || ✔ || ✔ || emf-inout.cpp, emf-print.cpp | |||
|- | |||
| EPS || Encapsulated PS || Vector || ✔ || ✔ || eps_input.py | |||
|- | |||
| FIG || XFig || Vector || ✔ || || fig_input.py | |||
|- | |||
| FXG || Flash || Vector || || ✔ || svg2fxg.py | |||
|- | |||
| GGR || Gimp Gradient || Other || ✔ || || gimpgrad.cpp | |||
|- | |||
| GPL || Gimp Palette || Other || ✔ || ✔ || Swatch dialog | |||
|- | |||
| HPGL || HP Graphics Language|| Vector || ✔ || ✔ || hpgl_input_sm.py, hpgl2_input.py, hpgl_output.py, (plotter.py) | |||
|- | |||
| HTML5 || HTML Canvas || Other || || ✔ || ink2canvas.py | |||
|- | |||
| JPEG || JPEG || Raster || ✔ || ✔ || libpixbuf, raster_output_jpg.py | |||
|- | |||
| SIF || Synfig Annimation || Vector || || ✔ || sinfig_output.py, sinfig_prepare.py | |||
|- | |||
| TAR || SVG (Separate layers)|| Vector|| || ✔ || tar_layers.py | |||
|- | |||
| TEX || Latex-PSTricks || Vector || || ✔ || pdflatex.py?, latex-pstricks.cpp | |||
|- | |||
| TEX || Latex || Vector || || ✔? || latex-text-renderer.cpp | |||
|- | |||
| ODG || OpenDocument Drawing|| Vector || || ✔ || odf.cpp | |||
|- | |||
| PDF || Portable Document Format || Vector || ✔ Internal, Cairo || ✔ Cairo, Scribus || scribus_export_pdf.py, cairo-renderer-pdf-out.cpp, pdfinput/ | |||
|- | |||
| PNG || PNG || Raster || ✔ || ✔ || libpixbuf, raster_output_png.py | |||
|- | |||
| POV || POV-Ray || Vector || || ✔ || pov-out.cpp | |||
|- | |||
| PS || PostScript || Vector || ✔ || ✔ Cairo || ps_input.py, cairo-ps-out.cpp | |||
|- | |||
| SVG || SVG || Vector || ✔ (Inkscape, Adobe) || ✔ (Inkscape, Plain, Optimized) || output_scour.py; svg.cpp, xml/repr-io.cpp, aisvg.inx, doc_ai_convert.py | |||
|- | |||
| SVGZ || SVG Compressed || Vector || ✔ || ✔ (Inkscape, Plain) || svgz.cpp | |||
|- | |||
| TIFF || Tagged Image Format || Raster || ✔ || ✔ || libpixbuf, raster_output_tiff.py | |||
|- | |||
| VSDM, VSDX, VSD, VDX || MS Visio || Vector || ✔ || || vsd-input.cpp | |||
|- | |||
| WEBP || WEBP (Google) || Raster || ✔ || ✔ || libpixbuf, raster_output_webp.py | |||
|- | |||
| WMF || MS Windows Metafile || Vector || ✔ || ✔ || wmf-inout.cpp, wmf-print.cpp | |||
|- | |||
| WPG || WordPerfect Graphics|| Vector || ✔ || || wpg-input.cpp | |||
|- | |||
| XAML || MS XAML || Vector || ✔ || ✔ || other/extension-xaml/inkxaml/ | |||
|- | |||
| XCF || Gimp XCF w/ Layers || Vector || || ✔ || gimp_xcf.py | |||
|- | |||
| ZIP || JessyInk PNG/PDF || Other || || ✔ || jessyink_export.py | |||
|- | |||
| ZIP || SVG Compressed w/ Media || Other || || ✔ || media_zip.py | |||
|} | |||
<sup>*</sup>Python files are mostly in share/extensions, C++ files are mostly in src/extensions/internal. | |||
Input formats supported by GTK (via '''libpixbuf'''): ani, avif, bmp, gif, icns, ico, jpeg, jxl, png, pnm, qtif, svg, tga, tiff, wmf, xbm (SEI/gdkpixbut-input.cpp). (SVG and WMF are imported by our own vector code.) | |||
There are also several export methods available under the '''Extensions''' menu. |
Latest revision as of 10:03, 5 November 2024
Italic text
Introduction
With native file dialogs, we cannot add features such as check boxes for options ("Choices"). We also cannot obtain information about which file filter is selected. We can only use the file extension to determin file type. This breaks are current method for using file dialogs to influence how files are saved. In particular:
- We cannot have a checkbox to "Save as 1.1 SVG".
- We cannot use the file filter setting to distinguish between saving as:
* "Inkscape SVG", "Plain SVG" or "Optimized SVG" (.svg). * "Compressed Inkscape SVG" and "Compressed Plain SVG" (.svgz). * "DXF 12" or "DXF 14" (.dxf). * "Compressed Inkscape with media" or "JessyInk" (.zip).
Native file dialogs are simply useful for choosing file names, nothing more, nothing less.
It's important to recognize that the Gtk::FileDialog class is NOT derived from a widget thus we cannot not change the insides. This is a necessity born from using native dialogs.
Our current (Inkscape 1.4) situation spreads options for how SVG's are saved across several places. Choosing Inkscape or Plain SVG's is done in the File menu, selecting to save to SVG 2 or SVG 1.1 is done in the File dialog, selecting which SVG 2 features are converted to SVG 1.1 fallbacks is done in the Preferences dialog. It would be better to have all of this in one place.
The Export dialog has received a lot of love over the past few years. However, it currently can handle only a subset of the file types that Inkscape can export to.
See also 2018 proposal.
Current Behavior
Save
New document:
- Opens file dialog (drawing.svg, set to Inkscape SVG).
If opened as:
- SVG: Saves as Inkscape SVG. (If write-protected, opens file dialog.)
- PDF: Saves as PDF after popping open dialog. On quitting, warns about data loss.
- EPS: Saves as EPS after popping open dialog. On quitting, warns about data loss.
- EMF: Saves as EMF after popping open dialog. On quitting, warns about data loss.
- DXF: Saves as DXF 12 (even if opened as DXF 14). without popping open dialog. On quitting, warns about data loss.
- PNG: Opens PNG settings then fails silently
- JPG: Opens JPG settings then fails, opening Save dialog.
Save as
Opens file dialog. Preset to last saved file type (can be bitmap!). Can save to any vector format in file filter list.
- "Guess from extension" will fail if trying to save bitmap (may or may not be silently). (Will open PNG settings.)
- "Append filename extension automatically" fails.(Bug)
Save a copy
Same as "Save as" but doesn't update internal file data (e.g. file name).
Proposal
With GTK4 Inkscape, all "Export" is done through the Export dialog, where "Export" is defined as saving a document to any form other than Inkscape SVG.
The File menu will contain these options:
Save
Save a document to Inkscape SVG.
- If a document does not contain a stored filename, open up File dialog to choose a filename.
- Update internal Inkscape version and filename. Clear modified flag.
- Save.
- If save fails, revert internal Inkcape version and filename. Restore modified flag.
Save as...
Save a document as Inkscape SVG with a new different filename.
- Open up File dialog to choose a filename.
- Update internal Inkscape version and filename. Clear modified flag.
- Save.
- If save fails, revert internal Inkcape version and filename. Restore modified flag.
Save a copy...
Save a document as Inkscape SVG with a new different filename, not updating internals.
- Open up File dialog to choose a filename.
- Update internal Inkscape version and filename.
- Save.
- Revert internal Inkcape version and filename. Restore modified flag.
Save Template...
Save a document as an Inkscape template.
Export
Export document to a non Inkscape SVG format.
- Open up Export dialog to choose export file type and options..
Options shown are based on selected file type.
The 1.4.x Export dialog currently handles: PNG, Inkscape SVG (no SVG specific options), Plain SVG, JPEG (with a big warning), TIFF, and WebP. The types the 1.4.x Save dialog handles are shown in the figure.
I'm wondering about which file types we should still support. For example, AutoCAD R12 is from 1992 and R14 is from 1997. Flash is long deprecated, with any kind of support ending in 2020.
Note: Bitmap formats are only available from the Export dialog.
Export Overwrite
New (needs some thought) Export document, overwriting.
- Export to same format as import or to the previously used export filetype.
- No File dialog used.
Unification
We have export from the command line and we have export from the Export dialog. These should be unified. It should be possible to set any values from the command line that you can set within the Export dialog. This can be done either of two ways:
- Adapt the file export class used to track export options to handle more options.
- Rely completely on setting preferences as is done by the Export dialog.
The first means that options are temporary, the second means options are stored in the Preferences file. The second method is probably easier.
Notes on File dialogs
We don't need to check on overwriting files ourselves. The file dialogs on all there platforms already have overwrite protection (verify for Windows).
Linux
MacOS
The MacOS dialog will add a file extension if it doesn't already exist based on the File type filter setting (if the filter setting is set to a single file type).
Gio::FileInfo::get_content_type() returns a UTI (public.tiff) rather than a mime-type (image/tiff).
Windows
Questions
Directories
We keep track of the last directories for various file dialogues in preferences. A couple dialogs will fallback to the Windows' Document directory if a preference is not set. Is this desired behavior? Should it be that way on all platforms? Should it be that way for all file dialogs? If the Document directory does not exist, should we fallback to the Home directory? Glib makes it easy to find these directories (we don't need the complicated Windows code that is in get_start_directory() at the moment).
Supported Formats
From src/extension/internal:
File Extension | Format/Software | Type | Input | Output | Module* |
---|---|---|---|---|---|
AI | Adobe Illustrator | Vector | ✔ | pdf-input.cpp | |
CDR, CDT, CCX, CMX | CorelDraw | Vector | ✔ | cdr-input.cpp, libcdr | |
DHW | ACECAD DigiMemo | Vector | ✔ | dhw_input.py | |
DXF | AutoCAD | Vector | ✔ (13, 14?) | ✔ (12, 14) | dxf_input.py, dxf12_outlines.py, dxf_outlines.py |
EMF | MS Enhanced Metafile | Vector | ✔ | ✔ | emf-inout.cpp, emf-print.cpp |
EPS | Encapsulated PS | Vector | ✔ | ✔ | eps_input.py |
FIG | XFig | Vector | ✔ | fig_input.py | |
FXG | Flash | Vector | ✔ | svg2fxg.py | |
GGR | Gimp Gradient | Other | ✔ | gimpgrad.cpp | |
GPL | Gimp Palette | Other | ✔ | ✔ | Swatch dialog |
HPGL | HP Graphics Language | Vector | ✔ | ✔ | hpgl_input_sm.py, hpgl2_input.py, hpgl_output.py, (plotter.py) |
HTML5 | HTML Canvas | Other | ✔ | ink2canvas.py | |
JPEG | JPEG | Raster | ✔ | ✔ | libpixbuf, raster_output_jpg.py |
SIF | Synfig Annimation | Vector | ✔ | sinfig_output.py, sinfig_prepare.py | |
TAR | SVG (Separate layers) | Vector | ✔ | tar_layers.py | |
TEX | Latex-PSTricks | Vector | ✔ | pdflatex.py?, latex-pstricks.cpp | |
TEX | Latex | Vector | ✔? | latex-text-renderer.cpp | |
ODG | OpenDocument Drawing | Vector | ✔ | odf.cpp | |
Portable Document Format | Vector | ✔ Internal, Cairo | ✔ Cairo, Scribus | scribus_export_pdf.py, cairo-renderer-pdf-out.cpp, pdfinput/ | |
PNG | PNG | Raster | ✔ | ✔ | libpixbuf, raster_output_png.py |
POV | POV-Ray | Vector | ✔ | pov-out.cpp | |
PS | PostScript | Vector | ✔ | ✔ Cairo | ps_input.py, cairo-ps-out.cpp |
SVG | SVG | Vector | ✔ (Inkscape, Adobe) | ✔ (Inkscape, Plain, Optimized) | output_scour.py; svg.cpp, xml/repr-io.cpp, aisvg.inx, doc_ai_convert.py |
SVGZ | SVG Compressed | Vector | ✔ | ✔ (Inkscape, Plain) | svgz.cpp |
TIFF | Tagged Image Format | Raster | ✔ | ✔ | libpixbuf, raster_output_tiff.py |
VSDM, VSDX, VSD, VDX | MS Visio | Vector | ✔ | vsd-input.cpp | |
WEBP | WEBP (Google) | Raster | ✔ | ✔ | libpixbuf, raster_output_webp.py |
WMF | MS Windows Metafile | Vector | ✔ | ✔ | wmf-inout.cpp, wmf-print.cpp |
WPG | WordPerfect Graphics | Vector | ✔ | wpg-input.cpp | |
XAML | MS XAML | Vector | ✔ | ✔ | other/extension-xaml/inkxaml/ |
XCF | Gimp XCF w/ Layers | Vector | ✔ | gimp_xcf.py | |
ZIP | JessyInk PNG/PDF | Other | ✔ | jessyink_export.py | |
ZIP | SVG Compressed w/ Media | Other | ✔ | media_zip.py |
*Python files are mostly in share/extensions, C++ files are mostly in src/extensions/internal.
Input formats supported by GTK (via libpixbuf): ani, avif, bmp, gif, icns, ico, jpeg, jxl, png, pnm, qtif, svg, tga, tiff, wmf, xbm (SEI/gdkpixbut-input.cpp). (SVG and WMF are imported by our own vector code.)
There are also several export methods available under the Extensions menu.