Add app icon; reset preview on new/open

This commit is contained in:
No Time To Play 2023-09-15 14:59:00 +00:00
parent 66775e7782
commit d55bfaf1b3
2 changed files with 33 additions and 1 deletions

12
NEWS.md
View File

@ -1,10 +1,20 @@
# Genoa Banner Creator project news
## [unreleased]
### Added
* app icon
### Changed
* Preview is cleared on new and open.
## [0.5 alpha] - 2023-09-15
### Added
* Syntax highlighting and line numbers
* syntax highlighting and line numbers
### Changed

View File

@ -295,6 +295,17 @@ wm title . $window_title
option add *tearOff 0
. configure -padx 4
set icon_data "
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAADFBMVEUAAAAbG29tXkfAox/rVIN+
AAAABHRSTlMA////sy1AiAAAAFNJREFUGNNtj4EOACEIQlX+/58PlNqtYrUSn6URVFox0rWoZSkE
wF3jZAKD6FRckIfG6DBYDBoRYKYRGtXLdZu4jF/J9ej5rRvL3Zhbdz5fwx3jf9s1AZwI7R6CAAAA
b2FsUGh42l3Pyw2AIBBF0bcBewEtVQPRaDF+mgALEVxi8BtlvCvOBEIGAApt19WqHFdZu8Wr0PCT
U3wbj0EXk2oUW+ogdSRVM7Xx1M5RL//7irrMA/lPoEmtAT587NmxAK+fJ0Gze0NZGe9NKc7zDvx4
xwbTZt61AAAAAElFTkSuQmCC
"
image create photo app_icon -data $icon_data
wm iconphoto . app_icon
if {[tk windowingsystem] == "x11"} {
ttk::style theme use "clam"
}
@ -513,6 +524,7 @@ proc do_new {} {
$editor delete "1.0" "end"
$editor edit reset
$editor edit modified 0
clear_drawing
set status [clock format [clock seconds]]
}
@ -544,6 +556,7 @@ proc do_open {} {
-detail "File not found: $choice"
} elseif {[load_file $choice]} {
set file_name $choice
clear_drawing
}
}
@ -745,6 +758,12 @@ proc do_preview {} {
$preview create rectangle $overlay -outline red -dash -
}
proc clear_drawing {} {
global d_list preview
set d_list {}
$preview delete all
}
proc shape2canvas {shape canvas} {
set coords [lmap i [dict get $shape coords] {int $i}]
switch [dict get $shape type] {
@ -787,9 +806,12 @@ proc do_export {} {
{"SVG drawings" ".svg"}
{"All files" ".*"}
}
set fn [file tail $file_name]
set init [file rootname $fn]
set choice [tk_getSaveFile -parent . \
-title "Export file as..." \
-initialdir [file_dir $file_name] \
-initialfile "$init.svg" \
-filetypes $file_types]
if {$choice == ""} {
set status "Export canceled."