@@ -39,11 +39,7 @@ public class ExportEditable : Export {
3939 var fname = repair_filename( filename );
4040
4141 /* Figure out if the user wants to include the images or not */
42- if ( get_bool( " include-images" ) ) {
43- save_with_images( fname );
44- } else {
45- save_without_images( fname );
46- }
42+ save( fname );
4743
4844 return ( true );
4945
@@ -54,7 +50,7 @@ public class ExportEditable : Export {
5450 // images used within the annotation are saved into the directory
5551 // and the directory is zipped and archived as the final *.annotator
5652 // file.
57- private void save_with_images ( string fname ) {
53+ private void save ( string fname ) {
5854
5955 string temp_dir;
6056
@@ -142,25 +138,16 @@ public class ExportEditable : Export {
142138
143139 }
144140
145- // -------------------------------------------------------------
146- // Saves the *.annotator file as an XML file, leaving the image
147- // paths to point to the local filesystem.
148- private void save_without_images ( string fname ) {
149-
150- save_xml( fname, null );
151-
152- }
153-
154141 // -------------------------------------------------------------
155142 // Saves the XML information from the annotation. Copies the stored
156143 // images in the given image directory, if specified.
157- private void save_xml ( string fname , string ? image_dir ) {
144+ private void save_xml ( string fname , string image_dir ) {
158145
159146 Xml . Doc * doc = new Xml .Doc ( " 1.0" );
160147 Xml . Node * root = new Xml .Node ( null , " exports" );
161148
162149 root- > set_prop( " version" , Annotator . version );
163- root- > add_child( canvas. save( image_dir ) );
150+ root- > add_child( canvas. save( image_dir, get_scale( " image-compression " ) ) );
164151
165152 doc- > set_root_element( root );
166153 doc- > save_format_file( fname, 1 );
@@ -218,7 +205,7 @@ public class ExportEditable : Export {
218205
219206 /* Open the portable Minder file for reading */
220207 if ( archive. open_filename( filename, 16384 ) != Archive . Result . OK ) {
221- return ( load_xml( filename ) );
208+ return ( false );
222209 }
223210
224211 unowned Archive . Entry entry;
@@ -265,21 +252,21 @@ public class ExportEditable : Export {
265252 // Add the setting to enable/disable including the images included
266253 // in the annotation.
267254 public override void add_settings ( Grid grid ) {
268- add_setting_bool ( " include-images " , grid, _( " Include images " ), _( " Including images will allow the saved file to be used on a different machine, but will make the file size much larger " ), false );
255+ add_setting_scale ( " image-compression " , grid, _( " Image Compression " ), null , 0 , 9 , 1 , 0 );
269256 }
270257
271258 // -------------------------------------------------------------
272259 // Save the settings.
273260 public override void save_settings ( Xml .Node * node ) {
274- node- > set_prop( " include-images " , get_bool ( " include-images " ). to_string() );
261+ node- > set_prop( " compression " , get_scale ( " image-compression " ). to_string() );
275262 }
276263
277264 // -------------------------------------------------------------
278265 // Load the settings.
279266 public override void load_settings ( Xml .Node * node ) {
280- var ii = node- > get_prop( " include-images " );
281- if ( ii != null ) {
282- set_bool ( " include-images " , bool . parse( ii ) );
267+ var c = node- > get_prop( " compression " );
268+ if ( c != null ) {
269+ set_scale ( " image-compression " , int . parse( c ) );
283270 }
284271 }
285272
0 commit comments