Merge branch 'master' into magic-8.2
This commit is contained in:
commit
8e471022db
|
|
@ -655,11 +655,11 @@ proc magic::tool {{type next}} {
|
||||||
macro Button1 "magic::trackwire %W pick"
|
macro Button1 "magic::trackwire %W pick"
|
||||||
macro Button2 "magic::trackwire %W done"
|
macro Button2 "magic::trackwire %W done"
|
||||||
macro Button3 "magic::trackwire %W cancel"
|
macro Button3 "magic::trackwire %W cancel"
|
||||||
macro Shift_Button1 "wire incr type"
|
macro Shift_Button1 "wire incr type ; wire show"
|
||||||
macro Shift_Button2 "wire switch"
|
macro Shift_Button2 "wire switch"
|
||||||
macro Shift_Button3 "wire decr type"
|
macro Shift_Button3 "wire decr type ; wire show"
|
||||||
macro Button4 "wire incr width"
|
macro Button4 "wire incr width ; wire show"
|
||||||
macro Button5 "wire decr width"
|
macro Button5 "wire decr width ; wire show"
|
||||||
|
|
||||||
}
|
}
|
||||||
netlist {
|
netlist {
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,7 @@ WireAddLeg(rect, point, direction)
|
||||||
SearchContext scx;
|
SearchContext scx;
|
||||||
Point cursorPos;
|
Point cursorPos;
|
||||||
TileTypeBitMask mask;
|
TileTypeBitMask mask;
|
||||||
|
int hwidth = WireWidth / 2;
|
||||||
|
|
||||||
if (WireType == 0)
|
if (WireType == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -372,20 +373,34 @@ WireAddLeg(rect, point, direction)
|
||||||
|
|
||||||
if (direction == WIRE_HORIZONTAL)
|
if (direction == WIRE_HORIZONTAL)
|
||||||
{
|
{
|
||||||
|
/* If the rect height is not the same as WireWidth, then center */
|
||||||
|
/* the new wire segment on the rect. */
|
||||||
|
|
||||||
|
if (rect->r_ytop - rect->r_ybot != WireWidth)
|
||||||
|
{
|
||||||
|
int rmid = (rect->r_ytop + rect->r_ybot) / 2;
|
||||||
|
rect->r_ybot = rmid - hwidth;
|
||||||
|
rect->r_ytop = rect->r_ybot + WireWidth;
|
||||||
|
|
||||||
|
rmid = (rect->r_xtop + rect->r_xbot) / 2;
|
||||||
|
rect->r_xbot = rmid - hwidth;
|
||||||
|
rect->r_xtop = rect->r_xbot + WireWidth;
|
||||||
|
}
|
||||||
|
|
||||||
/* The new leg will be horizontal. First compute its span in
|
/* The new leg will be horizontal. First compute its span in
|
||||||
* x, then its span in y.
|
* x, then its span in y.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (point->p_x > rect->r_xtop)
|
if (point->p_x > rect->r_xtop)
|
||||||
{
|
{
|
||||||
new.r_xbot = rect->r_xtop;
|
new.r_xbot = rect->r_xbot;
|
||||||
new.r_xtop = point->p_x;
|
new.r_xtop = point->p_x + hwidth;
|
||||||
WireLastDir = GEO_EAST;
|
WireLastDir = GEO_EAST;
|
||||||
}
|
}
|
||||||
else if (point->p_x < rect->r_xbot)
|
else if (point->p_x < rect->r_xbot)
|
||||||
{
|
{
|
||||||
new.r_xtop = rect->r_xbot;
|
new.r_xtop = rect->r_xtop;
|
||||||
new.r_xbot = point->p_x;
|
new.r_xbot = point->p_x - hwidth;
|
||||||
WireLastDir = GEO_WEST;
|
WireLastDir = GEO_WEST;
|
||||||
}
|
}
|
||||||
else return; /* Nothing to paint! */
|
else return; /* Nothing to paint! */
|
||||||
|
|
@ -395,7 +410,7 @@ WireAddLeg(rect, point, direction)
|
||||||
* the wires so there's no real choice.
|
* the wires so there's no real choice.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
new.r_ybot = point->p_y - WireWidth/2;
|
new.r_ybot = point->p_y - hwidth;
|
||||||
if (new.r_ybot < rect->r_ybot)
|
if (new.r_ybot < rect->r_ybot)
|
||||||
new.r_ybot = rect->r_ybot;
|
new.r_ybot = rect->r_ybot;
|
||||||
else if (new.r_ybot > rect->r_ytop - WireWidth)
|
else if (new.r_ybot > rect->r_ytop - WireWidth)
|
||||||
|
|
@ -404,20 +419,34 @@ WireAddLeg(rect, point, direction)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* If the rect width is not the same as WireWidth, then center */
|
||||||
|
/* the new wire segment on the rect. */
|
||||||
|
|
||||||
|
if (rect->r_xtop - rect->r_xbot != WireWidth)
|
||||||
|
{
|
||||||
|
int rmid = (rect->r_xtop + rect->r_xbot) / 2;
|
||||||
|
rect->r_xbot = rmid - hwidth;
|
||||||
|
rect->r_xtop = rect->r_xbot + WireWidth;
|
||||||
|
|
||||||
|
rmid = (rect->r_ytop + rect->r_ybot) / 2;
|
||||||
|
rect->r_ybot = rmid - hwidth;
|
||||||
|
rect->r_ytop = rect->r_ybot + WireWidth;
|
||||||
|
}
|
||||||
|
|
||||||
/* The new wire segment is vertical. See comments above (this
|
/* The new wire segment is vertical. See comments above (this
|
||||||
* code is just like what's up there).
|
* code is just like what's up there).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (point->p_y > rect->r_ytop)
|
if (point->p_y > rect->r_ytop)
|
||||||
{
|
{
|
||||||
new.r_ybot = rect->r_ytop;
|
new.r_ybot = rect->r_ybot;
|
||||||
new.r_ytop = point->p_y;
|
new.r_ytop = point->p_y + hwidth;
|
||||||
WireLastDir = GEO_NORTH;
|
WireLastDir = GEO_NORTH;
|
||||||
}
|
}
|
||||||
else if (point->p_y < rect->r_ybot)
|
else if (point->p_y < rect->r_ybot)
|
||||||
{
|
{
|
||||||
new.r_ytop = rect->r_ybot;
|
new.r_ytop = rect->r_ytop;
|
||||||
new.r_ybot = point->p_y;
|
new.r_ybot = point->p_y - hwidth;
|
||||||
WireLastDir = GEO_SOUTH;
|
WireLastDir = GEO_SOUTH;
|
||||||
}
|
}
|
||||||
else return; /* Nothing to paint! */
|
else return; /* Nothing to paint! */
|
||||||
|
|
@ -453,7 +482,7 @@ WireAddLeg(rect, point, direction)
|
||||||
SelectChunk(&scx, WireType, 0, &leg, FALSE);
|
SelectChunk(&scx, WireType, 0, &leg, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make the box a square at the tip of the new are just painted. */
|
/* Make the box a square at the tip of the new area just painted. */
|
||||||
|
|
||||||
switch (WireLastDir)
|
switch (WireLastDir)
|
||||||
{
|
{
|
||||||
|
|
@ -517,6 +546,7 @@ WireShowLeg()
|
||||||
int direction = WIRE_CHOOSE;
|
int direction = WIRE_CHOOSE;
|
||||||
int delx, dely;
|
int delx, dely;
|
||||||
MagWindow *w;
|
MagWindow *w;
|
||||||
|
int hwidth = WireWidth / 2;
|
||||||
|
|
||||||
if (WireType == 0) return;
|
if (WireType == 0) return;
|
||||||
|
|
||||||
|
|
@ -557,20 +587,32 @@ WireShowLeg()
|
||||||
|
|
||||||
if (direction == WIRE_HORIZONTAL)
|
if (direction == WIRE_HORIZONTAL)
|
||||||
{
|
{
|
||||||
|
/* Correct for different width between wire and rect. */
|
||||||
|
if (rect->r_ytop - rect->r_ybot != WireWidth)
|
||||||
|
{
|
||||||
|
int rmid = (rect->r_ytop + rect->r_ybot) / 2;
|
||||||
|
rect->r_ybot = rmid - hwidth;
|
||||||
|
rect->r_ytop = rect->r_ybot + WireWidth;
|
||||||
|
|
||||||
|
rmid = (rect->r_xtop + rect->r_xbot) / 2;
|
||||||
|
rect->r_xbot = rmid - hwidth;
|
||||||
|
rect->r_xtop = rect->r_xbot + WireWidth;
|
||||||
|
}
|
||||||
|
|
||||||
/* The new leg will be horizontal. First compute its span in
|
/* The new leg will be horizontal. First compute its span in
|
||||||
* x, then its span in y.
|
* x, then its span in y.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (point->p_x > rect->r_xtop)
|
if (point->p_x > rect->r_xtop)
|
||||||
{
|
{
|
||||||
new.r_xbot = rect->r_xtop;
|
new.r_xbot = rect->r_xbot;
|
||||||
new.r_xtop = point->p_x;
|
new.r_xtop = point->p_x + hwidth;
|
||||||
WireLastDir = GEO_EAST;
|
WireLastDir = GEO_EAST;
|
||||||
}
|
}
|
||||||
else if (point->p_x < rect->r_xbot)
|
else if (point->p_x < rect->r_xbot)
|
||||||
{
|
{
|
||||||
new.r_xtop = rect->r_xbot;
|
new.r_xtop = rect->r_xtop;
|
||||||
new.r_xbot = point->p_x;
|
new.r_xbot = point->p_x - hwidth;
|
||||||
WireLastDir = GEO_WEST;
|
WireLastDir = GEO_WEST;
|
||||||
}
|
}
|
||||||
else return; /* Nothing to paint! */
|
else return; /* Nothing to paint! */
|
||||||
|
|
@ -580,7 +622,7 @@ WireShowLeg()
|
||||||
* the wires so there's no real choice.
|
* the wires so there's no real choice.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
new.r_ybot = point->p_y - WireWidth/2;
|
new.r_ybot = point->p_y - hwidth;
|
||||||
if (new.r_ybot < rect->r_ybot)
|
if (new.r_ybot < rect->r_ybot)
|
||||||
new.r_ybot = rect->r_ybot;
|
new.r_ybot = rect->r_ybot;
|
||||||
else if (new.r_ybot > rect->r_ytop - WireWidth)
|
else if (new.r_ybot > rect->r_ytop - WireWidth)
|
||||||
|
|
@ -589,25 +631,37 @@ WireShowLeg()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Correct for different width between wire and rect. */
|
||||||
|
if (rect->r_xtop - rect->r_xbot != WireWidth)
|
||||||
|
{
|
||||||
|
int rmid = (rect->r_xtop + rect->r_xbot) / 2;
|
||||||
|
rect->r_xbot = rmid - hwidth;
|
||||||
|
rect->r_xtop = rect->r_xbot + WireWidth;
|
||||||
|
|
||||||
|
rmid = (rect->r_ytop + rect->r_ybot) / 2;
|
||||||
|
rect->r_ybot = rmid - hwidth;
|
||||||
|
rect->r_ytop = rect->r_ybot + WireWidth;
|
||||||
|
}
|
||||||
|
|
||||||
/* The new wire segment is vertical. See comments above (this
|
/* The new wire segment is vertical. See comments above (this
|
||||||
* code is just like what's up there).
|
* code is just like what's up there).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (point->p_y > rect->r_ytop)
|
if (point->p_y > rect->r_ytop)
|
||||||
{
|
{
|
||||||
new.r_ybot = rect->r_ytop;
|
new.r_ybot = rect->r_ybot;
|
||||||
new.r_ytop = point->p_y;
|
new.r_ytop = point->p_y + hwidth;
|
||||||
WireLastDir = GEO_NORTH;
|
WireLastDir = GEO_NORTH;
|
||||||
}
|
}
|
||||||
else if (point->p_y < rect->r_ybot)
|
else if (point->p_y < rect->r_ybot)
|
||||||
{
|
{
|
||||||
new.r_ytop = rect->r_ybot;
|
new.r_ytop = rect->r_ytop;
|
||||||
new.r_ybot = point->p_y;
|
new.r_ybot = point->p_y - hwidth;
|
||||||
WireLastDir = GEO_SOUTH;
|
WireLastDir = GEO_SOUTH;
|
||||||
}
|
}
|
||||||
else return; /* Nothing to paint! */
|
else return; /* Nothing to paint! */
|
||||||
|
|
||||||
new.r_xbot = point->p_x - WireWidth/2;
|
new.r_xbot = point->p_x - hwidth;
|
||||||
if (new.r_xbot < rect->r_xbot)
|
if (new.r_xbot < rect->r_xbot)
|
||||||
new.r_xbot = rect->r_xbot;
|
new.r_xbot = rect->r_xbot;
|
||||||
if (new.r_xbot > rect->r_xtop - WireWidth)
|
if (new.r_xbot > rect->r_xtop - WireWidth)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue