file_chooser: save button turns red when current schematic needs a save

This commit is contained in:
stefan schippers 2025-10-10 14:52:56 +02:00
parent 11012480a0
commit eda8dca19f
1 changed files with 6 additions and 1 deletions

View File

@ -5415,7 +5415,7 @@ proc file_chooser {} {
set file_chooser(old_new_file_browser_depth) $new_file_browser_depth set file_chooser(old_new_file_browser_depth) $new_file_browser_depth
set_ne file_chooser(fullpath) 0 set_ne file_chooser(fullpath) 0
set_ne file_chooser(ontop) 0 set_ne file_chooser(ontop) 0
set_ne file_chooser(enter) 0 ;# let file_chooser show current open schematic file name when mouse enters set file_chooser(enter) 1 ;# let file_chooser show current open schematic file name when mouse enters
# xschem set semaphore [expr {[xschem get semaphore] +1}] # xschem set semaphore [expr {[xschem get semaphore] +1}]
if {[winfo exists .ins]} { if {[winfo exists .ins]} {
raise .ins raise .ins
@ -5570,6 +5570,11 @@ proc file_chooser {} {
bind .ins <Enter> { bind .ins <Enter> {
if {{%W} eq {.ins} && $file_chooser(enter) } { if {{%W} eq {.ins} && $file_chooser(enter) } {
file_chooser_select [xschem get schname] file_chooser_select [xschem get schname]
if {[xschem get modified]} {
.ins.top2.save configure -bg red
} else {
.ins.top2.save configure -bg [option get . background {}]
}
set file_chooser(enter) 0 ;# do not reset shown filename to current xschem filename when entering again set file_chooser(enter) 0 ;# do not reset shown filename to current xschem filename when entering again
} }
} }