From a3347710db56dc8ad4a2e26419aabbd6c8014569 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 29 Apr 2023 01:41:02 +0200 Subject: [PATCH] improve persistent insert symbol dialog (Shift-Insert) by not asking multiple times what to do when selecting a non xschem file --- src/xschem.tcl | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/xschem.tcl b/src/xschem.tcl index 9fed8f92..2a6f491b 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -2668,9 +2668,8 @@ proc myload_getresult {loadfile confirm_overwrt} { return {} } } - # $type == 0 so return empty string - set myload_retval {} - return {} + # $type == 0 but $answer==1 so return selected filename + return "$fname" } # $type == SYMBOL or SCHEMATIC } elseif { $type ne {SYMBOL} && ($myload_ext eq {*.sym}) } { ;# SCHEMATIC @@ -2690,6 +2689,21 @@ proc myload_getresult {loadfile confirm_overwrt} { } } +proc myload_place_symbol {} { + global myload_retval + + set entry [.load.buttons_bot.entry get] + puts "entry=$entry, myload_retval=$myload_retval" + if {$myload_retval == $entry} {return} + set myload_retval $entry + set sym [myload_getresult 2 0] + # puts "sym=$sym myload_dir1=$myload_dir1 myload_dir2=$myload_dir2" + xschem abort_operation + if {$sym ne {}} { + xschem place_symbol "$sym" + } +} + proc myload_display_preview {f} { set type [is_xschem_file $f] if { $type ne {0} && $type ne {GENERATOR} } { @@ -2916,13 +2930,7 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}} if {$myload_loadfile == 2} { bind .load.buttons_bot.entry { - set myload_retval [.load.buttons_bot.entry get] - set r [myload_getresult 2 0] - # puts "r=$r myload_dir1=$myload_dir1 myload_dir2=$myload_dir2" - xschem abort_operation - if {$r ne {}} { - xschem place_symbol "$r" - } + myload_place_symbol } } @@ -2970,13 +2978,7 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}} } } if {$myload_loadfile == 2} { - set myload_retval [.load.buttons_bot.entry get] - set r [myload_getresult 2 0] - # puts "r=$r myload_dir1=$myload_dir1 myload_dir2=$myload_dir2" - xschem abort_operation - if {$r ne {}} { - xschem place_symbol "$r" - } + myload_place_symbol } };# bind .load.l.paneright.list <> if { [ info exists myload_yview]} {