"Delete files" menu command added

This commit is contained in:
Stefan Schippers 2020-10-24 23:46:19 +02:00
parent 8602fa7bb6
commit 679348b7f8
7 changed files with 25 additions and 15 deletions

View File

@ -113,6 +113,7 @@ shift 'C' Start arc placement
shift+ctrl 'C' Start circle placement
alt 'C' Toggle dim/brite background with rest of layers
ctrl 'e' Back to parent schematic
shift 'D' Delete files
- 'e' Descend to schematic
alt 'e' Edit selected schematic in a new window
'\' Toggle Full screen

View File

@ -895,6 +895,19 @@ void attach_labels_to_inst() /* offloaded from callback.c 20171005 */
draw();
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
}
void delete_files(void)
{
char str[PATH_MAX + 100];
rebuild_selected_array();
if(lastselected && selectedgroup[0].type==ELEMENT) {
my_snprintf(str, S(str), "delete_files {%s}",
abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""));
} else {
my_snprintf(str, S(str), "delete_files {%s}",
abs_sym_path(xctx->sch[xctx->currsch], ""));
}
tcleval(str);
}
void place_net_label(int type)
{

View File

@ -73,7 +73,7 @@ void start_wire(double mx, double my)
int callback(int event, int mx, int my, KeySym key,
int button, int aux, int state)
{
char str[PATH_MAX];/* overflow safe 20161122 */
char str[PATH_MAX + 100]; /* overflow safe 20161122 */
static char sel_or_clip[PATH_MAX] = "";/* overflow safe 20161122 */
struct stat buf;
unsigned short sel;
@ -1286,25 +1286,15 @@ int callback(int event, int mx, int my, KeySym key,
{
if(semaphore >= 2) break;
hide_symbols++;
if(hide_symbols == 3) hide_symbols = 0;
if(hide_symbols >= 3) hide_symbols = 0;
tclsetvar("hide_symbols", hide_symbols == 2 ? "2" : hide_symbols == 1 ? "1" : "0");
draw();
break;
}
if(key=='B' && state==ShiftMask) /* delete files */
if(key=='D' && state==ShiftMask) /* delete files */
{
if(semaphore >= 2) break;
rebuild_selected_array();
if(lastselected && selectedgroup[0].type==ELEMENT) {
my_snprintf(str, S(str), "delete_files {%s}",
abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""));
} else {
my_snprintf(str, S(str), "delete_files {%s}",
abs_sym_path(xctx->sch[xctx->currsch], ""));
}
tcleval(str);
delete_files();
break;
}
if(key=='x' && state == 0 ) /* new cad session */

View File

@ -66,12 +66,12 @@ shift 'A' Toggle show netlist
- 'b' Merge file
ctrl 'b' Toggle show text in symbol
alt 'b' Toggle show symbol details / only bounding boxes
shift 'B' Delete files
- 'c' Copy selected obj.
ctrl 'c' Save to clipboard
shift 'C' Start arc placement
shift+ctrl 'C' Start circle placement
alt 'C' Toggle dim/brite background with rest of layers
shift 'D' Delete files
ctrl 'e' Back to parent schematic
- 'e' Descend to schematic
alt 'e' Edit selected schematic in a new window

View File

@ -1477,6 +1477,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
Tcl_ResetResult(interp);
}
else if(!strcmp(argv[1],"delete_files"))
{
delete_files();
}
else if(!strcmp(argv[1],"rotate"))
{

View File

@ -904,6 +904,7 @@ extern int place_symbol(int pos, const char *symbol_name, double x, double y, in
const char *inst_props, int draw_sym, int first_call);
extern void place_net_label(int type);
extern void attach_labels_to_inst(void);
extern void delete_files(void);
extern int sym_vs_sch_pins(void);
extern int match_symbol(const char name[]);
extern int save_schematic(const char *); /* 20171020 added return value */

View File

@ -3442,6 +3442,7 @@ font configure Underline-Font -underline true -size 24
toolbar_create FileNewSym {xschem clear SYMBOL} "New Symbol"
.menubar.file.menu add command -label "Open" -command "xschem load" -accelerator {Ctrl+O}
toolbar_create FileOpen "xschem load" "Open File"
.menubar.file.menu add command -label "Delete files" -command "xschem delete_files" -accelerator {Shift-D}
menu .menubar.file.menu.recent -tearoff 0
setup_recent_menu