mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-08-29 01:24:51 +02:00
Added a command option "setlabel box" to modify the attachment box
of a label from the command line. Also fixed a long-standing irritation that "setlabel" would change the properties of a label in the edit cell but not in the selection itself, which would cause the label to be drawn both with the original properties in the selection and the new properties in the edit cell. Now both views will track the same changes.
This commit is contained in:
+61
-2
@@ -733,7 +733,7 @@ selEnumCFunc2(scx, arg)
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* SelEnumLabels --
|
||||
* SelEnumLabelsBase --
|
||||
*
|
||||
* Find all selected labels, and call the client's procedure for
|
||||
* each label found. Only consider labels attached to "layers",
|
||||
@@ -771,11 +771,14 @@ selEnumCFunc2(scx, arg)
|
||||
*/
|
||||
|
||||
int
|
||||
SelEnumLabels(layers, editOnly, foundNonEdit, func, clientData)
|
||||
SelEnumLabelsBase(layers, editOnly, doMirror, foundNonEdit, func, clientData)
|
||||
TileTypeBitMask *layers; /* Find labels on these layers. */
|
||||
bool editOnly; /* TRUE means only find labels that are
|
||||
* both selected and in the edit cell.
|
||||
*/
|
||||
bool doMirror; /* If TRUE, apply the function to both the
|
||||
* label in the selection and in the edit cell.
|
||||
*/
|
||||
bool *foundNonEdit; /* If non-NULL, this word is set to TRUE
|
||||
* if there are selected labels that aren't
|
||||
* in the edit cell, FALSE otherwise.
|
||||
@@ -837,11 +840,67 @@ SelEnumLabels(layers, editOnly, foundNonEdit, func, clientData)
|
||||
|
||||
if ((*func)(arg.sea_foundLabel, arg.sea_foundUse,
|
||||
&arg.sea_foundTrans, clientData) != 0) return 1;
|
||||
|
||||
if (doMirror)
|
||||
(*func)(selLabel, SelectUse, &SelectUse->cu_transform, clientData);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* SelEnumLabels --
|
||||
*
|
||||
* Wrapper for SelEnumLabelsBase() with doMirror set to FALSE.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
SelEnumLabels(layers, editOnly, foundNonEdit, func, clientData)
|
||||
TileTypeBitMask *layers; /* Find labels on these layers. */
|
||||
bool editOnly; /* TRUE means only find labels that are
|
||||
* both selected and in the edit cell.
|
||||
*/
|
||||
bool *foundNonEdit; /* If non-NULL, this word is set to TRUE
|
||||
* if there are selected labels that aren't
|
||||
* in the edit cell, FALSE otherwise.
|
||||
*/
|
||||
int (*func)(); /* Function to call for each label found. */
|
||||
ClientData clientData; /* Argument to pass through to func. */
|
||||
{
|
||||
return SelEnumLabelsBase(layers, editOnly, FALSE, foundNonEdit, func, clientData);
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* SelEnumLabelsMirror --
|
||||
*
|
||||
* Wrapper for SelEnumLabelsBase() with doMirror set to TRUE. Function
|
||||
* "func" is applied to both the label in the edit cell and in the
|
||||
* selection. Used when modifying labels so that the selection view
|
||||
* tracks the changes made to each label.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
SelEnumLabelsMirror(layers, editOnly, foundNonEdit, func, clientData)
|
||||
TileTypeBitMask *layers; /* Find labels on these layers. */
|
||||
bool editOnly; /* TRUE means only find labels that are
|
||||
* both selected and in the edit cell.
|
||||
*/
|
||||
bool *foundNonEdit; /* If non-NULL, this word is set to TRUE
|
||||
* if there are selected labels that aren't
|
||||
* in the edit cell, FALSE otherwise.
|
||||
*/
|
||||
int (*func)(); /* Function to call for each label found. */
|
||||
ClientData clientData; /* Argument to pass through to func. */
|
||||
{
|
||||
return SelEnumLabelsBase(layers, editOnly, TRUE, foundNonEdit, func, clientData);
|
||||
}
|
||||
|
||||
/* Search function for label enumeration: make sure that this label
|
||||
* matches the one we're looking for. If it does, then record
|
||||
* information about it and return right away.
|
||||
|
||||
@@ -46,6 +46,7 @@ extern ExtRectList *SelectShort();
|
||||
extern int SelEnumPaint();
|
||||
extern int SelEnumCells();
|
||||
extern int SelEnumLabels();
|
||||
extern int SelEnumLabelsMirror();
|
||||
|
||||
/* Procedures to operate on the selection. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user