Modified the way that ToolGetEditBox() works so that it does not

require that an edit cell be defined.  This stops a lot of commands
from failing on non-writeable cells.  There really should not be a
concept of "non-editable" cells at all, just non-writeable ones.
This commit is contained in:
Tim Edwards 2021-08-04 12:05:21 -04:00
parent c776c82445
commit e50dab7e52
3 changed files with 28 additions and 5 deletions

View File

@ -1 +1 @@
8.3.195
8.3.196

View File

@ -1372,7 +1372,7 @@ CmdPort(w, cmd)
bool nonEdit = FALSE, doQuiet = FALSE;
Label *lab, *sl;
Rect editBox, tmpArea;
CellDef *editDef = EditCellUse->cu_def;
CellDef *editDef;
static char *cmdPortOption[] =
{
@ -1462,6 +1462,12 @@ CmdPort(w, cmd)
PORT_SHAPE_THRU
};
windCheckOnlyWindow(&w, DBWclientID);
if (w == (MagWindow *) NULL)
editDef = EditCellUse->cu_def;
else
editDef = ((CellUse *) w->w_surfaceID)->cu_def;
argstart = 1;
argc = cmd->tx_argc;
@ -2239,9 +2245,7 @@ CmdProperty(w, cmd)
windCheckOnlyWindow(&w, DBWclientID);
if (w == (MagWindow *) NULL)
{
def = EditCellUse->cu_def;
}
else
def = ((CellUse *) w->w_surfaceID)->cu_def;

View File

@ -304,12 +304,31 @@ bool
ToolGetEditBox(rect)
Rect *rect;
{
CellDef *editDef;
if (boxRootDef == NULL)
{
TxError("Box must be present\n");
return FALSE;
}
if (EditRootDef != boxRootDef)
/* Added 8/4/2021---Don't require that EditRootDef be non-NULL. */
if (EditRootDef == NULL)
{
MagWindow *w;
w = ToolGetBoxWindow(rect, NULL);
windCheckOnlyWindow(&w, DBWclientID);
if (w == (MagWindow *) NULL)
editDef = EditCellUse->cu_def;
else
editDef = ((CellUse *) w->w_surfaceID)->cu_def;
}
else
editDef = EditRootDef;
if (editDef != boxRootDef)
{
TxError("The box isn't in a window on the edit cell.\n");
return FALSE;