better file globbing in load_file_dialog
This commit is contained in:
parent
d4b6986e24
commit
472751dfc0
|
|
@ -407,9 +407,9 @@ void saveas(const char *f, int type) /* changed name from ask_save_file to save
|
|||
if( (p = strrchr(filename, '.')) && !strcmp(p, ".sch") ) {
|
||||
my_strncpy(filename, add_ext(filename, ".sym"), S(filename));
|
||||
}
|
||||
my_snprintf(name, S(name), "save_file_dialog {Save file} .sym.sch INITIALLOADDIR {%s}", filename);
|
||||
my_snprintf(name, S(name), "save_file_dialog {Save file} *.\\{sch,sym\\} INITIALLOADDIR {%s}", filename);
|
||||
} else {
|
||||
my_snprintf(name, S(name), "save_file_dialog {Save file} .sch.sym INITIALLOADDIR {%s}", filename);
|
||||
my_snprintf(name, S(name), "save_file_dialog {Save file} *.\\{sch,sym\\} INITIALLOADDIR {%s}", filename);
|
||||
}
|
||||
|
||||
tcleval(name);
|
||||
|
|
@ -437,7 +437,7 @@ void ask_new_file(void)
|
|||
if(xctx->modified) {
|
||||
if(save(1) == -1 ) return; /* user cancels save, so do nothing. */
|
||||
}
|
||||
tcleval("load_file_dialog {Load file} .sch.sym INITIALLOADDIR");
|
||||
tcleval("load_file_dialog {Load file} *.\\{sch,sym\\} INITIALLOADDIR");
|
||||
my_snprintf(f, S(f),"%s", tclresult());
|
||||
if(f[0]) {
|
||||
char win_path[WINDOW_PATH_SIZE];
|
||||
|
|
@ -996,7 +996,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot
|
|||
char *type;
|
||||
int cond;
|
||||
if(symbol_name==NULL) {
|
||||
tcleval("load_file_dialog {Choose symbol} .sym INITIALINSTDIR");
|
||||
tcleval("load_file_dialog {Choose symbol} *.sym INITIALINSTDIR");
|
||||
my_strncpy(name, tclresult(), S(name));
|
||||
} else {
|
||||
my_strncpy(name, symbol_name, S(name));
|
||||
|
|
@ -1243,7 +1243,7 @@ int descend_schematic(int instnumber)
|
|||
char res[PATH_MAX];
|
||||
|
||||
my_strncpy(filename, xctx->sch[xctx->currsch], S(filename));
|
||||
my_snprintf(cmd, S(cmd), "save_file_dialog {Save file} .sch.sym INITIALLOADDIR {%s}", filename);
|
||||
my_snprintf(cmd, S(cmd), "save_file_dialog {Save file} *.\\{sch,sym\\} INITIALLOADDIR {%s}", filename);
|
||||
tcleval(cmd);
|
||||
my_strncpy(res, tclresult(), S(res));
|
||||
if(!res[0]) return 0;
|
||||
|
|
|
|||
|
|
@ -1921,7 +1921,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if((key==XK_Insert && (state & ShiftMask)) || (key == 'i' && state == ControlMask)) /* insert sym */
|
||||
{
|
||||
tcleval("load_file_dialog {Insert symbol} .sym INITIALINSTDIR 2");
|
||||
tcleval("load_file_dialog {Insert symbol} *.sym INITIALINSTDIR 2");
|
||||
break;
|
||||
}
|
||||
if(key==XK_Insert || (key == 'I' && state == ShiftMask) ) /* insert sym */
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ void merge_file(int selection_load, const char ext[])
|
|||
if(selection_load==0)
|
||||
{
|
||||
if(!strcmp(ext,"")) {
|
||||
my_snprintf(tmp, S(tmp), "load_file_dialog {Merge file} {.sch.sym} INITIALLOADDIR");
|
||||
my_snprintf(tmp, S(tmp), "load_file_dialog {Merge file} *.\\{sch,sym\\} INITIALLOADDIR");
|
||||
tcleval(tmp);
|
||||
if(!strcmp(tclresult(),"")) return;
|
||||
my_strncpy(name, (char *)tclresult(), S(name));
|
||||
|
|
|
|||
|
|
@ -3182,7 +3182,7 @@ void make_schematic_symbol_from_sel(void)
|
|||
char filename[PATH_MAX] = "";
|
||||
char name[1024];
|
||||
|
||||
my_snprintf(name, S(name), "save_file_dialog {Save file} .sch.sym INITIALLOADDIR");
|
||||
my_snprintf(name, S(name), "save_file_dialog {Save file} *.\\{sch,sym\\} INITIALLOADDIR");
|
||||
tcleval(name);
|
||||
my_strncpy(filename, tclresult(), S(filename));
|
||||
if (!strcmp(filename, xctx->sch[xctx->currsch])) {
|
||||
|
|
|
|||
|
|
@ -1719,7 +1719,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(argc>=3) {
|
||||
my_snprintf(fullname, S(fullname),"%s", argv[2]);
|
||||
} else {
|
||||
tcleval("load_file_dialog {Load file} .sch.sym INITIALLOADDIR");
|
||||
tcleval("load_file_dialog {Load file} *.\\{sch,sym\\} INITIALLOADDIR");
|
||||
my_snprintf(fullname, S(fullname),"%s", tclresult());
|
||||
}
|
||||
if( fullname[0] ) {
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ int compare_schematics(const char *f)
|
|||
|
||||
/* set filename of schematic to compare */
|
||||
if(f == NULL) {
|
||||
tcleval("load_file_dialog {Schematic to compare with} .sch.sym INITIALLOADDIR");
|
||||
tcleval("load_file_dialog {Schematic to compare with} *.\\{sch,sym\\} INITIALLOADDIR");
|
||||
if(tclresult()[0]) my_strncpy(xctx->sch_to_compare, tclresult(), S(xctx->sch_to_compare));
|
||||
else my_strncpy(xctx->sch_to_compare, "", S(xctx->sch_to_compare));
|
||||
} else if(f[0] != '\0') {
|
||||
|
|
|
|||
|
|
@ -2358,7 +2358,7 @@ proc myload_getresult {loadfile confirm_overwrt} {
|
|||
} else {
|
||||
return "$myload_dir1/$myload_retval"
|
||||
}
|
||||
} elseif { $myload_type ne {SYMBOL} && ($myload_ext eq {.sym}) } {
|
||||
} elseif { $myload_type ne {SYMBOL} && ($myload_ext eq {*.sym}) } {
|
||||
set answer [
|
||||
tk_messageBox -message "$myload_dir1/$myload_retval does not seem to be a SYMBOL file...\nContinue?" \
|
||||
-icon warning -parent [xschem get topwindow] -type yesno]
|
||||
|
|
@ -2409,8 +2409,8 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}}
|
|||
}
|
||||
set myload_loadfile $loadfile
|
||||
set myload_ext $ext
|
||||
set globfilter $ext
|
||||
set save_initialfile $initialf
|
||||
set globfilter *
|
||||
set myload_retval {}
|
||||
upvar #0 $global_initdir initdir
|
||||
if { $loadfile != 2} {xschem set semaphore [expr {[xschem get semaphore] +1}]}
|
||||
|
|
@ -2444,7 +2444,7 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}}
|
|||
if { $myload_sel ne {} } {
|
||||
set myload_dir1 [abs_sym_path [.load.l.paneleft.list get $myload_sel]]
|
||||
set myload_index1 $myload_sel
|
||||
set globfilter *
|
||||
set globfilter $myload_ext
|
||||
if {$save_initialfile eq {}} {.load.buttons_bot.entry delete 0 end}
|
||||
setglob $myload_dir1
|
||||
myload_set_colors2
|
||||
|
|
@ -2635,7 +2635,6 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}}
|
|||
set myload_dir1 $myload_d
|
||||
# .load.buttons_bot.entry delete 0 end
|
||||
} else {
|
||||
set globfilter *
|
||||
.load.buttons_bot.entry delete 0 end
|
||||
.load.buttons_bot.entry insert 0 $myload_dir2
|
||||
myload_display_preview $myload_dir1/$myload_dir2
|
||||
|
|
@ -5179,7 +5178,7 @@ proc build_widgets { {topwin {} } } {
|
|||
}
|
||||
$topwin.menubar.file.menu add command -label "Component browser" -accelerator {Shift-Ins, Ctrl-I} \
|
||||
-command {
|
||||
load_file_dialog {Insert symbol} .sym INITIALINSTDIR 2
|
||||
load_file_dialog {Insert symbol} *.sym INITIALINSTDIR 2
|
||||
}
|
||||
$topwin.menubar.file.menu add command -label "Open" -command "xschem load" -accelerator {Ctrl+O}
|
||||
$topwin.menubar.file.menu add cascade -label "Open recent" -menu $topwin.menubar.file.menu.recent
|
||||
|
|
|
|||
Loading…
Reference in New Issue