Finished exported template deletion feature

This commit is contained in:
Bill Kendrick 2023-06-08 00:08:07 -07:00
parent 2260d66b4e
commit 1f623cbe36
3 changed files with 15 additions and 16 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2023
Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/
2023.June.7 (0.9.31)
2023.June.8 (0.9.31)
* New Magic Tools:
----------------
* Loops - Draw loop-the-loops.
@ -37,7 +37,7 @@ https://tuxpaint.org/
* Other Improvements:
-------------------
* WIP Saved pictures can, from the Open dialog, be copied into
* Saved pictures can, from the Open dialog, be copied into
the user's templates directory, and used as backgrounds
for other drawings by selecting it from the New dialog.
+ If the original image has already been exported as a template,
@ -46,9 +46,7 @@ https://tuxpaint.org/
- identical file sizes (bytes)
- identical image dimensions (pixels)
- identical image data (CRC checksum)
+ TODO Templates created from saved drawings in Tux Paint will
be flagged as such [TBD file sitting alongside it]
+ TODO Templates created from saved drawings in Tux Paint can
+ Templates created from saved drawings in Tux Paint can
be removed via a new "Erase" option that will appear when
such templates are selected from the "New" dialog. [See below]
Closes https://sourceforge.net/p/tuxpaint/feature-requests/236/

View file

@ -1,7 +1,7 @@
/*
get_fname.h
Copyright (c) 2009-2022
Copyright (c) 2009-2023
https://tuxpaint.org/
This program is free software; you can redistribute it and/or modify
@ -19,8 +19,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last modified: December 11, 2022
$Id$
Last modified: June 8, 2023
*/
#ifndef GET_FNAME_H
@ -41,5 +40,8 @@ enum
char *get_fname(const char *const name, int kind);
/* Prefix for templates exported within Tux Paint (via Open dialog),
so we can delete them (via New dialog) */
#define EXPORTED_TEMPLATE_PREFIX "exported"
#endif

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 14, 2002 - June 6, 2023
June 14, 2002 - June 8, 2023
*/
#include "platform.h"
@ -22533,14 +22533,13 @@ static int do_new_dialog(void)
if (which_changed)
{
erasable = 0;
if (!disable_erase)
if (!disable_erase &&
d_places[which] == PLACE_PERSONAL_TEMPLATES_DIR &&
strstr(d_names[which], EXPORTED_TEMPLATE_PREFIX) == d_names[which])
{
if (d_places[which] == PLACE_PERSONAL_TEMPLATES_DIR)
{
/* FIXME: Check for fingerprint that it was one exported from Tux Paint */
erasable = 1;
}
}
which_changed = 0;
}
@ -31699,7 +31698,7 @@ static int export_pict(char *fname, int where, char * orig_fname)
t = time(NULL);
strftime(timestamp, sizeof(timestamp), "%Y%m%d%H%M%S", localtime(&t));
pict_fname = (char *) malloc(sizeof(char) * len);
snprintf(pict_fname, len, "%s/%s-%s.png", dir, orig_fname, timestamp);
snprintf(pict_fname, len, "%s/%s-%s-%s.png", dir, EXPORTED_TEMPLATE_PREFIX, orig_fname, timestamp);
}
free(dir);