Implement vertical flip (shift-V) and vertical flip in place (alt-v), change netlisting mode command moved to bindkey ctrl-shift-V; when opening insert component dialog focus the File/Search entry box

This commit is contained in:
stefan schippers 2023-12-23 00:06:01 +01:00
parent fbfbef384c
commit a95e3597bc
6 changed files with 146 additions and 18 deletions

View File

@ -38,7 +38,6 @@ p{padding: 15px 30px 10px;}
This list is available in XSCHEM in the <kbd>Help</kbd> menu
</p>
<pre class="code" style="height: 600px;">
XSCHEM MOUSE BINDINGS
----------------------------------------------------------------------
LeftButton Clear selection and select a graphic object
@ -145,8 +144,8 @@ ctrl 'e' Back to parent schematic
- 'e' Descend to schematic
alt 'e' Edit selected schematic in a new window
'\' Toggle Full screen
shift 'F' Flip
alt 'f' Flip objects around their anchor points
shift 'F' Horizontal flip selected objects
alt 'f' Horizontal flip selected objects around their anchor points
ctrl 'f' Find/select by substring or regexp
- 'f' Full zoom
shift+ctrl 'F' Zoom full selected elements
@ -213,8 +212,10 @@ alt 'u' Align to current grid selected objects
shift 'U' Redo
- 'u' Undo
- 'v' Constrained vertical move/copy of objects
shift 'V' Vertical flip selected objects
alt 'v' Vertical flip selected objects around their anchor point
ctrl 'v' Paste from clipboard
shift 'V' Toggle spice/vhdl/verilog netlist
ctrl+shift 'V' Toggle spice/vhdl/verilog netlist
- 'w' Place wire
ctrl 'w' close current schematic
shift 'W' Place wire, snapping to closest pin or net endpoint
@ -226,7 +227,7 @@ shift 'X' Highlight discrepancies between object ports and attache
shift 'Z' Zoom in
ctrl 'z' Zoom out
- '?' Help
- '&amp; Join / break / collapse wires
- '&amp;' Join / break / collapse wires
shift '*' Postscript/pdf print
ctr+shift '*' Xpm/png print
alt+shift '*' Svg print

View File

@ -545,6 +545,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> abort_operation</kbd></li><pre>
@ -689,6 +690,11 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
if x0, y0 not given use mouse coordinates </pre>
<li><kbd> flip_in_place</kbd></li><pre>
Flip selection horizontally, each object around its center </pre>
<li><kbd> flipv [x0 y0]</kbd></li><pre>
Flip selection vertically around point x0 y0.
if x0, y0 not given use mouse coordinates </pre>
<li><kbd> flipv_in_place</kbd></li><pre>
Flip selection vertically, each object around its center </pre>
<li><kbd> floaters_from_selected_inst</kbd></li><pre>
flatten to current level selected instance texts </pre>
<li><kbd> fullscreen</kbd></li><pre>
@ -1466,6 +1472,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"

View File

@ -1793,7 +1793,7 @@ int rstate; /* (reduced state, without ShiftMask) */
new_rect(PLACE);
break;
}
if(key=='V' && rstate == 0) /* toggle spice/vhdl netlist */
if(key=='V' && rstate == ControlMask) /* toggle spice/vhdl netlist */
{
xctx->netlist_type++; if(xctx->netlist_type==6) xctx->netlist_type=1;
set_tcl_netlist_type();
@ -2311,6 +2311,55 @@ int rstate; /* (reduced state, without ShiftMask) */
}
break;
}
if(key=='V' && rstate == 0) /* vertical flip */
{
if(xctx->ui_state & STARTMOVE) {
move_objects(ROTATE,0,0,0);
move_objects(ROTATE,0,0,0);
move_objects(FLIP,0,0,0);
}
else if(xctx->ui_state & STARTCOPY) {
copy_objects(ROTATE);
copy_objects(ROTATE);
copy_objects(FLIP);
}
else {
rebuild_selected_array();
xctx->mx_double_save=xctx->mousex_snap;
xctx->my_double_save=xctx->mousey_snap;
move_objects(START,0,0,0);
move_objects(ROTATE,0,0,0);
move_objects(ROTATE,0,0,0);
move_objects(FLIP,0,0,0);
move_objects(END,0,0,0);
}
break;
}
if(key=='v' && EQUAL_MODMASK) /* vertical flip objects around their anchor points */
{
if(xctx->ui_state & STARTMOVE) {
move_objects(ROTATE|ROTATELOCAL,0,0,0);
move_objects(ROTATE|ROTATELOCAL,0,0,0);
move_objects(FLIP|ROTATELOCAL,0,0,0);
}
else if(xctx->ui_state & STARTCOPY) {
copy_objects(ROTATE|ROTATELOCAL);
copy_objects(ROTATE|ROTATELOCAL);
copy_objects(FLIP|ROTATELOCAL);
}
else {
rebuild_selected_array();
xctx->mx_double_save=xctx->mousex_snap;
xctx->my_double_save=xctx->mousey_snap;
move_objects(START,0,0,0);
move_objects(ROTATE|ROTATELOCAL,0,0,0);
move_objects(ROTATE|ROTATELOCAL,0,0,0);
move_objects(FLIP|ROTATELOCAL,0,0,0);
move_objects(END,0,0,0);
}
break;
}
if(key=='\\' && state==0) /* fullscreen */
{

View File

@ -104,8 +104,8 @@ ctrl 'e' Back to parent schematic
- 'e' Descend to schematic
alt 'e' Edit selected schematic in a new window
'\' Toggle Full screen
shift 'F' Flip
alt 'f' Flip objects around their anchor points
shift 'F' Horizontal flip selected objects
alt 'f' Horizontal flip selected objects around their anchor points
ctrl 'f' Find/select by substring or regexp
- 'f' Full zoom
shift+ctrl 'F' Zoom full selected elements
@ -172,8 +172,10 @@ alt 'u' Align to current grid selected objects
shift 'U' Redo
- 'u' Undo
- 'v' Constrained vertical move/copy of objects
shift 'V' Vertical flip selected objects
alt 'v' Vertical flip selected objects around their anchor point
ctrl 'v' Paste from clipboard
shift 'V' Toggle spice/vhdl/verilog netlist
ctrl+shift 'V' Toggle spice/vhdl/verilog netlist
- 'w' Place wire
ctrl 'w' close current schematic
shift 'W' Place wire, snapping to closest pin or net endpoint

View File

@ -951,8 +951,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1], "flip_in_place"))
{
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(xctx->ui_state & STARTMOVE) move_objects(ROTATE|ROTATELOCAL,0,0,0);
else if(xctx->ui_state & STARTCOPY) copy_objects(ROTATE|ROTATELOCAL);
if(xctx->ui_state & STARTMOVE) move_objects(FLIP|ROTATELOCAL,0,0,0);
else if(xctx->ui_state & STARTCOPY) copy_objects(FLIP|ROTATELOCAL);
else {
rebuild_selected_array();
move_objects(START,0,0,0);
@ -962,6 +962,67 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
/* flipv [x0 y0]
* Flip selection vertically around point x0 y0.
* if x0, y0 not given use mouse coordinates */
else if(!strcmp(argv[1], "flipv"))
{
double x0 = xctx->mousex_snap;
double y0 = xctx->mousey_snap;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 3) {
x0 = atof(argv[2]);
y0 = atof(argv[3]);
}
if(xctx->ui_state & STARTMOVE) {
move_objects(ROTATE,0,0,0);
move_objects(ROTATE,0,0,0);
move_objects(FLIP,0,0,0);
}
else if(xctx->ui_state & STARTCOPY) {
copy_objects(ROTATE);
copy_objects(ROTATE);
copy_objects(FLIP);
}
else {
rebuild_selected_array();
xctx->mx_double_save = xctx->mousex_snap = x0;
xctx->my_double_save = xctx->mousey_snap = y0;
move_objects(START,0,0,0);
move_objects(ROTATE,0, 0, 0);
move_objects(ROTATE,0, 0, 0);
move_objects(FLIP,0, 0, 0);
move_objects(END,0,0,0);
}
Tcl_ResetResult(interp);
}
/* flipv_in_place
* Flip selection vertically, each object around its center */
else if(!strcmp(argv[1], "flipv_in_place"))
{
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(xctx->ui_state & STARTMOVE) {
move_objects(ROTATE|ROTATELOCAL,0,0,0);
move_objects(ROTATE|ROTATELOCAL,0,0,0);
move_objects(FLIP|ROTATELOCAL,0,0,0);
}
else if(xctx->ui_state & STARTCOPY) {
copy_objects(ROTATE|ROTATELOCAL);
copy_objects(ROTATE|ROTATELOCAL);
copy_objects(FLIP|ROTATELOCAL);
}
else {
rebuild_selected_array();
move_objects(START,0,0,0);
move_objects(ROTATE|ROTATELOCAL,0,0,0);
move_objects(ROTATE|ROTATELOCAL,0,0,0);
move_objects(FLIP|ROTATELOCAL,0,0,0);
move_objects(END,0,0,0);
}
Tcl_ResetResult(interp);
}
/* floaters_from_selected_inst
* flatten to current level selected instance texts */
else if(!strcmp(argv[1], "floaters_from_selected_inst"))

View File

@ -3473,6 +3473,7 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}}
set file_dialog_globfilter *[.load.buttons_bot.entry get]*
if { $file_dialog_globfilter eq {**} } { set file_dialog_globfilter * }
setglob $file_dialog_dir1
.load.l.paneright.list yview moveto 1.0
}
# set to something different to any file to force a new placement in file_dialog_place_symbol
set file_dialog_retval { }
@ -3626,6 +3627,7 @@ proc load_file_dialog {{msg {}} {ext {}} {global_initdir {INITIALINSTDIR}}
if { [info exists file_dialog_yview]} {
.load.l.paneright.list yview moveto [lindex $file_dialog_yview 0]
}
focus .load.buttons_bot.entry
if {$loadfile != 2} {
tkwait window .load
xschem set semaphore [expr {[xschem get semaphore] -1}]
@ -7027,19 +7029,19 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.option.menu.netlist add checkbutton -label "Split netlist" -variable split_files \
-accelerator {}
$topwin.menubar.option.menu.netlist add radiobutton -label "Spice netlist"\
-variable netlist_type -value spice -accelerator {Shift+V} \
-variable netlist_type -value spice -accelerator {Ctrl+Shift+V} \
-command "xschem set netlist_type spice; xschem redraw"
$topwin.menubar.option.menu.netlist add radiobutton -label "VHDL netlist"\
-variable netlist_type -value vhdl -accelerator {Shift+V} \
-variable netlist_type -value vhdl -accelerator {Ctrl+Shift+V} \
-command "xschem set netlist_type vhdl; xschem redraw"
$topwin.menubar.option.menu.netlist add radiobutton -label "Verilog netlist"\
-variable netlist_type -value verilog -accelerator {Shift+V} \
-variable netlist_type -value verilog -accelerator {Ctrl+Shift+V} \
-command "xschem set netlist_type verilog; xschem redraw"
$topwin.menubar.option.menu.netlist add radiobutton -label "tEDAx netlist" \
-variable netlist_type -value tedax -accelerator {Shift+V} \
-variable netlist_type -value tedax -accelerator {Ctrl+Shift+V} \
-command "xschem set netlist_type tedax; xschem redraw"
$topwin.menubar.option.menu.netlist add radiobutton -label "Symbol global attrs" \
-variable netlist_type -value symbol -accelerator {Shift+V} \
-variable netlist_type -value symbol -accelerator {Ctrl+Shift+V} \
-command "xschem set netlist_type symbol; xschem redraw"
@ -7067,11 +7069,15 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.edit.menu add command -label "Move objects adding wires to connected pins" \
-command "xschem move_objects kissing" -accelerator Shift+M
toolbar_add EditMove "xschem move_objects" "Move objects" $topwin
$topwin.menubar.edit.menu add command -label "Flip in place selected objects" -state normal \
$topwin.menubar.edit.menu add command -label "Horizontal Flip in place selected objects" -state normal \
-command {xschem flip_in_place} -accelerator {Alt-F}
$topwin.menubar.edit.menu add command -label "Vertical Flip in place selected objects" -state normal \
-command {xschem flipv_in_place} -accelerator {Alt-V}
$topwin.menubar.edit.menu add command -label "Rotate in place selected objects" -state normal \
-command {xschem rotate_in_place} -accelerator {Alt-R}
$topwin.menubar.edit.menu add command -label "Flip selected objects" -state normal \
$topwin.menubar.edit.menu add command -label "Vertical Flip selected objects" -state normal \
-command {xschem flipv} -accelerator {Shift-V}
$topwin.menubar.edit.menu add command -label "Horizontal Flip selected objects" -state normal \
-command {xschem flip} -accelerator {Shift-F}
$topwin.menubar.edit.menu add command -label "Rotate selected objects" -state normal \
-command {xschem rotate} -accelerator {Shift-R}