📄 locele.mc
字号:
ULong color, weight;
MSElement element;
mdlScan_initScanlist (&scanList);
mdlScan_noRangeCheck (&scanList);
scanList.scantype = ELEMTYPE | ELEMDATA | ONEELEM;
/* if user wants to restrict search to levels then set the scanner */
if (locElemInfoP->levels)
{
scanList.scantype |= LEVELS;
scanList.levmask[0] = locElemInfoP->level[0];
scanList.levmask[1] = locElemInfoP->level[1];
scanList.levmask[2] = locElemInfoP->level[2];
scanList.levmask[3] = locElemInfoP->level[3];
}
elemMask = 1 << (((locElemInfoP->eleType)-1) % 16);
if ((locElemInfoP->eleType) < 17)
scanList.typmask[0] = (UShort)elemMask;
else
scanList.typmask[1] = (UShort)elemMask;
if (locElemInfoP->cellElem)
scanList.typmask[0] |= CELL_HEADER_ELM;
if (locElemInfoP->attribData)
{
scanList.scantype |= PROPCLAS;
scanList.clasmsk = 0xFFFF;
scanList.pcl.propval = 0x0800;
scanList.pch.propmsk = 0x0800;
}
scanList.extendedType = FILEPOS;
scanList.sector = DGN_BLOCK (filePos);
scanList.offset = DGN_OFFSET(filePos);
mdlScan_initialize (0, &scanList);
/* loop through the file until one matching the criteria is found */
while ((status = mdlScan_file (&element, &scanWords, sizeof(element),
&filePos)), (scanWords != 0) )
{
mdlElement_getSymbology (&color, &weight, &style, &element);
if (locElemInfoP->colors)
if (locElemInfoP->color != color) continue;
if (locElemInfoP->weights)
if (locElemInfoP->weight != weight) continue;
if (locElemInfoP->styles)
if (locElemInfoP->style != style) continue;
switch (mdlElement_getType (&element) )
{
case CELL_HEADER_ELM:
case LINE_ELM:
case LINE_STRING_ELM:
case SHAPE_ELM:
case CONIC_ELM:
case CURVE_ELM:
case ELLIPSE_ELM:
case ARC_ELM:
showElement (&element);
return;
case TEXT_ELM :
case TEXT_NODE_ELM :
showTextElement (&element);
return;
default :
continue;
}
}
/* Display an alert and return result to caller */
mdlDialog_openAlert ( "End of File ! ");
return;
}
/*------------------------------------------------------------------------+
| name locele_dialogHook |
+------------------------------------------------------------------------*/
Private void locele_dialogHook
(
DialogMessage *dmP /* => a ptr to a dialog message */
)
{
/* ignore any messages being sent to modal dialog hook */
if (dmP->dialogId != DIALOGID_LocateElem)
return;
dmP->msgUnderstood = TRUE;
switch (dmP->messageType)
{
case DIALOG_MESSAGE_DESTROY:
{
/* unload this MDL task when the Locele Dialog is closed */
mdlDialog_cmdNumberQueue (FALSE, CMD_MDL_UNLOAD,
mdlSystem_getCurrTaskID(), TRUE);
break;
};
default:
dmP->msgUnderstood = FALSE;
break;
}
}
/*------------------------------------------------------------------------+
| name locele_buttonHook |
+------------------------------------------------------------------------*/
Private void locele_buttonHook (DialogItemMessage *dimP)
{
if ((dimP->messageType != DITEM_MESSAGE_BUTTON) ||
(dimP->u.button.buttonTrans != BUTTONTRANS_UP))
{
/* Tell the dialog manager that we didn't handle this message */
dimP->msgUnderstood = FALSE;
return;
}
/* Tell the dialog manager that we are handling this message */
dimP->msgUnderstood = TRUE;
/* Call mdlState_startPrimitive to terminate current command and
identify the current command. */
mdlState_startPrimitive (NULL, NULL, 1, 0);
switch (dimP->dialogItemP->rawItemP->itemHookArg)
{
case 1: /* start button */
filePos = 0L;
locateElemString ();
break;
case 2: /* next button */
locateElemString ();
break;
case 3: /* quit button */
mdlDialog_closeCommandQueue (dimP->db);
break;
}
}
/*------------------------------------------------------------------------+
| name locele_scrollBarHook |
+------------------------------------------------------------------------*/
Private void locele_scrollBarHook (DialogItemMessage *dimP)
{
DialogItem *outFieldDiP;
char str[3];
/* Tell the dialog manager that we are handling this message */
dimP->msgUnderstood = TRUE;
switch (dimP->messageType)
{
case DITEM_MESSAGE_SETVALUE:
{
outFieldDiP = mdlDialog_itemGetByTypeAndId (dimP->db, RTYPE_ScrollBar,
SCROLLBARID_Weight, 0);
mdlDialog_itemSetState (NULL, dimP->db, outFieldDiP->itemIndex);
outFieldDiP = mdlDialog_itemGetByTypeAndId (dimP->db, RTYPE_Text,
TEXTID_LoceleWeight, 0);
sprintf (str, "%d\0", locElemInfoP->weight);
mdlDialog_itemSetValue (NULL, 0, NULL, str,
dimP->db, outFieldDiP->itemIndex);
break;
}
default:
{
/* Tell the dialog manager to handle this message */
dimP->msgUnderstood = FALSE;
break;
}
}
}
/*------------------------------------------------------------------------+
| name locele dummyltemHcok |
+------------------------------------------------------------------------*/
Private void locele_dummyItemHook
(
DialogItemMessage *dimP /* => a ptr to a dialog item message */
)
{
dimP->msgUnderstood = TRUE;
switch (dimP->messageType)
{
default:
dimP->msgUnderstood = FALSE;
break;
}
}
/*------------------------------------------------------------------------+
| name level_openModal |
+------------------------------------------------------------------------*/
Public cmdName void level_openModal
(
char *unparsedP /* => unparsed part of command */
)
cmdNumber CMD_OPENMODAL
{
int lastAction;
/* open child modal dialog box */
if (mdlDialog_openModal (&lastAction, NULL, DIALOGID_LevelModal) )
{
mdlDialog_dmsgsPrint ("Unable to open modal");
return;
}
}
/*------------------------------------------------------------------------+
| name locateElem |
+------------------------------------------------------------------------*/
cmdName void locateElem (void)
cmdNumber CMD_LOCATE_ELEMENT
{
/* Initialize view */
locElemInfoP->view = (tcb->lstvw) + 1;
filePos = 0L; /* start search from begining of file */
dbP = mdlDialog_open (NULL, DIALOGID_LocateElem);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -