Accounting Software
Small Business Software Estimating Software
Project Management SoftwareProject Estimating SoftwareProject Tracking SoftwareInventory Tracking SoftwareCustomer Tracking SoftwareCustomer Management SoftwareBusiness Management Software

Attachments (Source Code)

Link to: header | other interface directory

Copyright Turtle Creek Software 1996-2006. All Rights Reserved.

Comments

These classes manage attachments for the Goldenseal accounting software,
project management software, construction accounting software
and construction project estimating software.

CBorderAttachment

An attachment that adds a border to a pane.

CPrintAttachment

An attachment that makes a pane print

Constructor

/******************************************************************************
CBorderAttachment Param constructor v1.0, 09-06-96
******************************************************************************/
CBorderAttachment::CBorderAttachment(const TCS_PenState &inPenState,
const SBooleanRect & inFlags,
const TCS_RGBColor *inForeColor,
const TCS_RGBColor *inBackColor,
const Boolean inExecuteHost)
: LBorderAttachment(&inPenState, inForeColor, inBackColor, inExecuteHost)
{
mHasLeftBorder = inFlags.left,
mHasTopBorder = inFlags.top,
mHasRightBorder = inFlags.right,
mHasBottomBorder = inFlags.bottom;
/*if (inForeColor == nil)
{
// Default to black foreground
#if TCS_FOR_MAC
mForeColor.red = 0;
mForeColor.green = 0;
mForeColor.blue = 0;
#else
mForeColor.rgbRed = 0;
mForeColor.rgbGreen = 0;
mForeColor.rgbBlue = 0;
#endif
}
else
{
mForeColor = *inForeColor;
}

if (inBackColor == nil)
{
// Default to white background
#if TCS_FOR_MAC
mBackColor.red = 65535;
mBackColor.green = 65535;
mBackColor.blue = 65535;
#else
mBackColor.rgbRed = 65535;
mBackColor.rgbGreen = 65535;
mBackColor.rgbBlue = 65535;
#endif
}
else
{
mBackColor = *inBackColor;
}*/
}

Source Code

/******************************************************************************

ExecuteSelf

Draws a border within the Frame of a Pane
Caller may specify which parts are drawn(top, left, bottom, and/or right)
For use only with msg_DrawOrPrint

******************************************************************************/
void CBorderAttachment::ExecuteSelf(MessageT /*inMessage*/, void *ioParam)
{
TStColorPenState penState; // Will save and restore pen state
TCS_Rect frame = *((TCS_Rect *) ioParam);
// Set up for drawing
TCS_SetPenState(&mPenState);
TCS_SetRGBForeColor(&mForeColor);
TCS_SetRGBBackColor(&mBackColor);
// Draw the appropriate sides of the border
if (mHasTopBorder)
{
TCS_MoveTo(frame.left, frame.top);
TCS_LineTo(frame.right, frame.top);
}
if (mHasLeftBorder)
{
TCS_MoveTo(frame.left, frame.top);
TCS_LineTo(frame.left, frame.bottom);
}
if (mHasRightBorder)
{
TCS_MoveTo(frame.right, frame.top);
TCS_LineTo(frame.right, frame.bottom);
}
if (mHasBottomBorder)
{
TCS_MoveTo(frame.left, frame.bottom);
TCS_LineTo(frame.right, frame.bottom);
}
}

 

/******************************************************************************

ExecuteSelf

Executes the print command and prints a view. For use only with cmd_Print

******************************************************************************/
void CPrintAttachment::ExecuteSelf(MessageT inMessage, void */*ioParam*/)
{
CTCS_Printout *printout;
LPlaceHolder *placeHolder;
LPane *owner,
*paneToPrint;
// We only respond to cmd_Print!!
if (inMessage != cmd_Print)
return;
TCS_TRY
{
// Cast our owner as an LPane. There is no good reason for this to fail!
owner = TCS_SAFE_CAST(mOwnerHost, LPane);
TCS_FailNILMsg(owner, TCS_GetErrString(errID_BadPane));
// Find the pane to print
paneToPrint = owner->FindPaneByID(mPaneToPrint);
TCS_FailNILMsg(paneToPrint, TCS_GetErrString(errID_BadPane));
// Get the printout view
printout = TCS_SAFE_CAST(LPrintout::CreatePrintout(VIEW_PortraitPrint), CTCS_Printout);
TCS_FailNILMsg(printout, TCS_GetErrString(errID_BadPane));
// Find the placeholder & install our view into it
placeHolder = TCS_SAFE_CAST(printout->FindPaneByID('PLAC'), LPlaceHolder);
TCS_FailNILMsg(placeHolder, TCS_GetErrString(errID_BadPane));
placeHolder->InstallOccupant(paneToPrint);
// Show Print dialog
TCS_FailNILMsg(gDocument, TCS_GetErrString(errID_BadDocument));

#if TCS_FOR_OSX
LPrintSpec *printSpec = gDocument->GetPrintSpec(); // TCS 1/30/04
TCS_FailNILMsg(printSpec, TCS_GetErrString(errID_BadPrinting));

StPrintSession session(printSpec);

if (UPrinting::AskPrintJob(printSpec))
{
printout->SetPrintSpec(printSpec);
printout->AdjustToPaperSize(); // TCS 2/17/04
printout->DoPrintJob();
}
#else
TCS_PrintHandle printRecordH = UPrintingMgr::GetDefaultPrintRecord();
if (!printRecordH)
{
TCS_ErrorAlert(errID_NoPageSetup); // TCS 3/10/01
return;
}

if (UPrintingMgr::AskPrintJob(printRecordH))
{
printout->SetPrintRecord(printRecordH);
printout->AdjustToPaperSize(); // TCS 2/17/04
printout->DoPrintJob();
}
#endif
}
TCS_CATCH
{
}

// delete the printout. This will also delete the placeholder,
// which will return the printed pane to its original place
TCS_Forget(printout); // moved TCS 10/26/00
}