add "xschem rotate_in_place" command

This commit is contained in:
stefan schippers 2023-09-17 09:05:21 +02:00
parent 978d575e22
commit 159f07e703
2 changed files with 26 additions and 5 deletions

View File

@ -507,6 +507,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> abort_operation</kbd></li><pre>
@ -931,7 +932,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> only_probes</kbd></li><pre>
dim schematic to better show highlights </pre>
<li><kbd> origin x y [zoom]</kbd></li><pre>
Move origin to 'x, y', optionally changing zoom level to 'zoom' </pre>
Move origin to 'x, y', optionally changing zoom level to 'zoom'
A dash ('-') given for x or y will keep existing value </pre>
<li><kbd> parse_cmd</kbd></li><pre>
debug command to test parse_cmd_string()
splits a command string into argv-like arguments
@ -1053,6 +1055,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> rotate [x0 y0]</kbd></li><pre>
Rotate selection around point x0 y0.
if x0, y0 not given use mouse coordinates </pre>
<li><kbd> rotate_in_place</kbd></li><pre>
Rotate selected objects around their 0,0 coordinate point </pre>
<li><kbd> save</kbd></li><pre>
Save schematic if modified. Does not ask confirmation! </pre>
<li><kbd> saveas [file] [type]</kbd></li><pre>
@ -1308,6 +1312,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul>

View File

@ -2471,18 +2471,20 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
/* origin x y [zoom]
* Move origin to 'x, y', optionally changing zoom level to 'zoom' */
* Move origin to 'x, y', optionally changing zoom level to 'zoom'
* A dash ('-') given for x or y will keep existing value */
else if(!strcmp(argv[1], "origin"))
{
if(argc > 3) {
xctx->xorigin = atof(argv[2]);
xctx->yorigin = atof(argv[3]);
if(argc == 5) {
if(strcmp(argv[2], "-")) xctx->xorigin = atof(argv[2]);
if(strcmp(argv[3], "-")) xctx->yorigin = atof(argv[3]);
if(argc > 4) {
xctx->zoom = atof(argv[4]);
xctx->mooz=1/xctx->zoom;
}
draw();
}
Tcl_ResetResult(interp);
}
else { cmd_found = 0;}
break;
@ -3195,6 +3197,20 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
Tcl_ResetResult(interp);
}
/* rotate_in_place
* Rotate selected objects around their 0,0 coordinate point */
else if(!strcmp(argv[1], "rotate_in_place"))
{
if(! (xctx->ui_state & (STARTMOVE | STARTCOPY) ) ) {
rebuild_selected_array();
move_objects(START,0,0,0);
move_objects(ROTATE|ROTATELOCAL,0,0,0);
move_objects(END,0,0,0);
}
Tcl_ResetResult(interp);
}
else { cmd_found = 0;}
break;
case 's': /*----------------------------------------------*/