View Issue Details

IDProjectCategoryView StatusLast Update
0001933SkyChart1-Softwarepublic18-05-27 17:06
ReporterSasa Assigned ToPatrick Chevalley  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinux 64-bitOSLubuntuOS Version17.04
Product Version4.1 SVN 
Target Version4.2Fixed in Version4.1 SVN 
Summary0001933: Save chart image - extension issues
DescriptionOn attempt to save image, application will form full name (including path) to the user directory, however with extension Chart_1.cdc3 instead Chart_1.PNG which will be the name to save with on pressing enter (without changing extension manually).

This is a bit confusing if user before image actually save chart in Chart_1.cdc3. when after that try to save image - Info window that Chart_1.cdc3 stil exists will be displayed and after "Replace" button click, the chart image will be saved correctly, in Chart_1.PNG.

TagsNo tags attached.

Activities

Sasa

18-04-11 13:33

reporter   ~0004683

Furthermore, if within saving dialog is changed format to JPG or BMP, image will be saved with PNG extension and the PNG format, regardless the choice.

Another issue is that if the chart is not saved (with .cdc3 extension), the full name will be blank on attempt to save chart image.

Patrick Chevalley

18-04-11 16:33

administrator   ~0004688

Yes both use the same SaveDialog but the file name was not set for the image.
This is fixed by:
https://github.com/pchev/skychart/commit/fb3f957165784dacc002b6b27c31d659aedc6e89

The file is saved with the type corresponding to the extension typed in the file name line at the top of the dialog.
From my understanding the save dialog filter is only to filter the existing files list, it not change the file extension.
There is a OnTypeChange event raised when you change the filter but changing SaveDialog.Filename at this time as no effect to the open dialog.
Do you know a way to do that?

Sure I can save as jpg if jpg is selected in the filter without taking account for what the user type in the top line but this is also not very good.

Sasa

18-04-11 21:29

reporter   ~0004695

Changing filename inside system dialog in Windows would be possible, however I do not know it would work in Linux (dialog handle, save dialog wrapper and proper SendMessage). Writing an extend dialog (as in GIMP, for instance) can also be quite big problem...

As there is no point not to use filter to set proper extension (and as we do not have all supported graphic formats in the first field of the filter, as usually used), avoiding all that complexity, the simplest approach would be following:

1. Ensure filename without extension and set properly DefaultExt property
2. Proper handling in OnTypeChange event
3. If there is unhandled extension wrote by user inside dialog filename field, show an appropriate error in OnCanClose

I have attached simple example.

Patrick Chevalley

18-05-27 17:06

administrator   ~0004770

Thank you Sasa, your method work fine.

This is in:
https://github.com/pchev/skychart/commit/adb45c14ab70ac76cfc01d77baec5cf9b3d65f90

Issue History

Date Modified Username Field Change
18-04-11 13:05 Sasa New Issue
18-04-11 13:33 Sasa Note Added: 0004683
18-04-11 16:33 Patrick Chevalley Note Added: 0004688
18-04-11 21:29 Sasa File Added: SaveDialog_OnTypeChange.zip
18-04-11 21:29 Sasa Note Added: 0004695
18-05-27 17:06 Patrick Chevalley Assigned To => Patrick Chevalley
18-05-27 17:06 Patrick Chevalley Status new => resolved
18-05-27 17:06 Patrick Chevalley Resolution open => fixed
18-05-27 17:06 Patrick Chevalley Fixed in Version => 4.1 SVN
18-05-27 17:06 Patrick Chevalley Target Version => 4.2
18-05-27 17:06 Patrick Chevalley Note Added: 0004770