mirror of
https://github.com/evilneuro/eudora-mac.git
synced 2024-06-06 20:29:29 +00:00
1 line
37 KiB
C
1 line
37 KiB
C
|
/* Copyright (c) 2017, Computer History Museum
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to
the limitations in the disclaimer below) provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. */
#include "petepch.h"
void DrawListBullet(DocumentInfoHandle docInfo, long paraIndex, short leftPosition, short ascent);
/* Draw the document in its window from an outside call */
OSErr UpdateDocument(DocumentInfoHandle docInfo)
{
OSErr errCode;
RgnHandle scratchRgn, tempRgn;
Rect viewRect;
PETEPortInfo savedPortInfo;
if((**docInfo).printData != nil) {
errCode = DrawDocumentWithPicture(docInfo);
} else if((**docInfo).flags.progressLoopCalled || (**docInfo).flags.updating) {
(**docInfo).flags.drawInProgressLoop = true;
errCode = noErr;
goto AddToUpdateRgn;
} else {
(**docInfo).flags.updating = true;
errCode = DrawDocument(docInfo, nil, true);
(**docInfo).flags.updating = false;
if(errCode == cantDoThatInCurrentMode) {
AddToUpdateRgn :
tempRgn = NewRgn();
if(tempRgn != nil) {
scratchRgn = (**(**docInfo).globals).scratchRgn;
SavePortInfo(((**docInfo).printData == nil) ? GetWindowPort((**docInfo).docWindow) : (**(**docInfo).printData).pPort, &savedPortInfo);
GetClip(scratchRgn);
if((**docInfo).printData == nil) {
GetVisibleRgn(tempRgn);
SectRgn(tempRgn, scratchRgn, scratchRgn);
}
ResetPortInfo(&savedPortInfo);
viewRect = (**docInfo).viewRect;
RectRgn(tempRgn, &viewRect);
SectRgn(tempRgn, scratchRgn, scratchRgn);
DisposeRgn(tempRgn);
UnionRgn(scratchRgn, (**docInfo).updateRgn, (**docInfo).updateRgn);
} else {
errCode = memFullErr;
}
}
}
return errCode;
}
/* Draw the entire document in its window */
OSErr DrawDocument(DocumentInfoHandle docInfo, RgnHandle clipRgn, Boolean preserveLine)
{
long paraIndex;
short lineIndex, lineCount, curV;
LSTable lineStarts;
Rect drawRect, lineRect;
LayoutCache lineCache;
PETEPortInfo savedPortInfo;
RgnHandle oldClip, scratchRgn, newClip;
LineInfo lineInfo;
CGrafPtr savedGWorld, newGWorld;
GDHandle savedGDevice;
GWorldPtr offscreenGWorld;
GWorldFlags gFlags;
PixMapHandle pixMap, tempPixMap;
RGBColor backColor /* = {0xffff,0xffff,0xffff} */;
QDErr errCode;
Byte hState;
/* Stupid compiler */
backColor.red = backColor.green = backColor.blue = 0xffff;
scratchRgn = (**(**docInfo).globals).scratchRgn;
/* Create region for old clip region */
oldClip = NewRgn();
if(oldClip == nil) {
return memFullErr;
}
/* Create region for new clip region */
newClip = NewRgn();
if(newClip == nil) {
DisposeRgn(oldClip);
return memFullErr;
}
/* Sa
|