home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 March
/
Chip_1998-03_cd.bin
/
tema
/
MINICAD
/
MC7DEMO
/
MINICAD.1
/
UPDATWKS.MPC
< prev
next >
Wrap
Text File
|
1997-04-30
|
3KB
|
115 lines
PROCEDURE UpDateWorksheet;
{
⌐1997, Diehl Graphsoft, Inc.
Developed by Frank Brault
Last modified: 04/18/97
}
LABEL 1;
CONST
kSpaceSymName = 'Space Name Box';
kRelationSymName = 'Relationship Box';
kWorksheetName='Area Worksheet';
kWorksheetTextSize = 10;
kWorksheetFont = 3;
kSpaceRec = 'Space';
kSpaceFld = 'Name';
kAdjacentRec = 'Adjacency';
kAdjacentFld = 'Code';
VAR
WSH : HANDLE;
startRow,numRows,numCols,numNames,r1,r2,i,c : INTEGER;
str,worksheetName,spaceName : STRING;
doAlert1,doAlert2 : BOOLEAN;
PROCEDURE ProcessNames(han : HANDLE);
LABEL 2;
VAR
emptyRow: BOOLEAN;
str1,str2,str3: STRING;
a1:REAL;
BEGIN
{** Reject if not a named object}
str1:= GetName(han);
IF (str1 = 'none') THEN GoTo 2;
a1:= HArea(han);
{** Reject if area is 0}
IF (a1 = 0) THEN GoTo 2;
str3:= Num2Str(2,a1);
{** Find valid named object in worksheet}
{** If match found then load actual area}
FOR r1:= startRow TO numRows DO
BEGIN
str2:= GetCellStr(WSH,r1,1);
IF (str1 = str2) THEN
BEGIN
LoadCell(r1,3,str3);
GOTO 2;
END;
END;
{** If we got here then there is a space on drawing not listed in worksheet}
{** Find an empty row}
{** If empty row found then load name and actual area}
{** If no empty rows found then set alert flag for end of procedure}
FOR r2:= startRow TO numRows DO
BEGIN
emptyRow:= TRUE;
FOR c:= 1 TO numCols DO IF CellHasStr(WSH,r2,c) THEN emptyRow:= FALSE;
IF emptyRow THEN
BEGIN
LoadCell(r2,3,str3);
LoadCell(r2,1,str1);
GoTo 2;
END;
IF r2 = numRows THEN
BEGIN
doAlert1:= TRUE;
GoTo 2;
END;
END;
2:END;
BEGIN
PUSHATTRS;
TextFont(kWorksheetFont);
TextSize(kWorksheetTextSize);
doAlert1:= FALSE;
{** Try named worksheet CONST}
WSH:=GETOBJECT(kWorksheetName);
{** Try active worksheet}
IF (WSH=NIL) THEN WSH:=ActSSheet;
{** Try getting worksheet name from user}
IF (WSH=NIL) THEN BEGIN
worksheetName:=STRDIALOG('Enter the name of the worksheet to be sorted.','Worksheet 1');
WSH:=GETOBJECT(worksheetName);
END;
{** If no worksheet then punch out with dialog╔}
IF ((WSH=NIL)|(GetType(WSH)<>18)) THEN BEGIN
SYSBEEP;
ALRTDIALOG('I can╒t find a worksheet by that name.');
GOTO 1;
END;
SelectSS(WSH);
SprdSize(WSH,numRows,numCols);
IF GETCELLSTR(WSH,1,1) = 'Name' THEN startRow:= 2
ELSE startRow:= 1;
IF GETCELLSTR(WSH,1,1) = '' THEN startRow:= 2;
FOREACHOBJECT(ProcessNames,V);
IF doAlert1 THEN
BEGIN
ALRTDIALOG('Some new spaces were skipped. Insert blank row(s) and run the ╘Update Worksheet╒ command again.');
END;
{CLRMESSAGE;}
1:POPATTRS;
END;
RUN(UpDateWorksheet);