Example #1
0
void CControlPanel::UpdateDebug()
{
	long total, contig;
	
	LProgressBar *theBar = dynamic_cast<LProgressBar*> (_floatWindow->FindPaneByID(kMemoryIndicator));
	LStaticText *theCaption = dynamic_cast<LStaticText*> (_floatWindow->FindPaneByID(kMemoryField));
	
	::PurgeSpace(&total, &contig);

	if (_totalMem == 0) {
		_totalMem = total;
	}
	
	if (total != _displayedTotalMem) {
		LStr255 purgespace = LStr255(total/1024);
		LStr255 totalspace = LStr255((long)_totalMem/1024);
		LStr255 message;
		message += purgespace;
		message += "K free of ";
		message += totalspace;
		message += "K";
		theCaption->SetDescriptor((StringPtr)message);
		
		theBar->SetMinValue(0);
		theBar->SetMaxValue(_totalMem/1024);
		theBar->SetValue(_totalMem/1024 - total/1024);
		_displayedTotalMem = total;
	}
}
Example #2
0
void
VETypeList::DoNoCPPbSupportDialog(
	ConstStringPtr	inFileName )
{
	StApplicationContext	appContext;
	StDialogHandler			dialog(PPob_NoCPPbSupport, LCommander::GetTopCommander());
	
	// make the error string
	
	LStr255 errorStr(STRx_NoCPPbSupport, NoCPPb_StringFirst);
	if ( inFileName[0] > 0 ) {
		errorStr += inFileName;
	}
	errorStr += LStr255(STRx_NoCPPbSupport, NoCPPb_StringSecond);
	
	LStaticText *theCaption = dynamic_cast<LStaticText *> (dialog.GetDialog()->FindPaneByID(NoCPPb_Caption));
	theCaption->SetDescriptor(errorStr);
			
	dialog.GetDialog()->Show();
	
	MessageT theMessage;
	do {
		theMessage = dialog.DoDialog();
	} while ( (theMessage != msg_OK) && (theMessage != msg_Cancel) );

	LCommander::SetUpdateCommandStatus(true);
}
Example #3
0
void
MEModelMenuBar::GetDisplayableName(
	LStr255&	outTitle) const
{

	// Validate pointers.

	ValidateThis_();

	// Start with object type.
	
	outTitle = LStr255(STR_METitleStrings, str_MenuBar);

}
void
CAPrintingAttachment::DoPrintJob()
{

	// Validate pointers.
	
	ValidateThis_();
	
	// Find the view that will be installed in the printout.
	
	LWindow* ourWindow = (dynamic_cast<LWindow*>(mOwnerHost));
	ValidateObject_(ourWindow);
	
	LPane* printedPane = nil;
	if (mPrintedPaneID != 0)
		printedPane = ourWindow->FindPaneByID(mPrintedPaneID);
	
	LPane* printedTitleBar = nil;
	if (mPrintedTitleBarID != 0)
		printedTitleBar = ourWindow->FindPaneByID(mPrintedTitleBarID);

	LPrintout* thePrintout = nil;

	try {
	
		// Create the printout view.

		{
			StApplicationContext appContext;
			thePrintout = LPrintout::CreatePrintout(mPrintoutPPobID);
			ValidateObject_(thePrintout);
		}
		
		thePrintout->SetPrintSpec(sPrintRecordSpec);

		// Move the printed pane to the printout.

		LPlaceHolder* thePlaceHolder =
				(dynamic_cast<LPlaceHolder*>(thePrintout->FindPaneByID(mPrintoutPlaceholderID)));
		ValidateObject_(thePlaceHolder);
		thePlaceHolder->InstallOccupant(printedPane);
	
		// Move the title bar to the printout (if any).

		if (printedTitleBar != nil) {
			LPlaceHolder* theTBarHolder =
					(dynamic_cast<LPlaceHolder*>(thePrintout->FindPaneByID(mPrintoutTbarPlaceholderID)));
			ValidateObject_(theTBarHolder);
			theTBarHolder->InstallOccupant(printedTitleBar);
		}
	
		// Add document and window titles to printout header.
		
		LCaption* fDocumentName = (LCaption*) thePrintout->FindPaneByID(Pane_DocumentName);
		ValidateObject_(fDocumentName);
		
		LCaption* fResourceID = (LCaption*) thePrintout->FindPaneByID(Pane_ResourceID);
		ValidateObject_(fResourceID);

		LDocument* document = nil;
		LCommander* commander = ourWindow;
		
		while (commander != nil) {
//			ValidateObject_(commander);				// can't validate, since commander might be stack-based (application)
			document = (dynamic_cast<LDocument*>(commander));
			if (document != nil)
				break;
			commander = commander->GetSuperCommander();
		}

		LStr255 windowName;
		ourWindow->GetDescriptor(windowName);
		
		LStr255 docName;
		if (document != nil) {
			ValidateObject_(document);
			document->GetDescriptor(docName);
		}
		
		if (docName.Length() == 0)
			docName = windowName;
		
		if (windowName == docName)
			windowName[(UInt8)0] = 0;
		
		fDocumentName->SetDescriptor(docName);
		fResourceID->SetDescriptor(windowName);
		
		// Add date and time to printout header.
	
		LCaption* fDateField = (LCaption*) thePrintout->FindPaneByID(Pane_DateField);
		ValidateObject_(fDateField);

		LStr255 tempStr;
		LStr255 tempStr2;

		unsigned long dateTime;							// set date & time
		::GetDateTime(&dateTime);
		::DateString(dateTime, abbrevDate, tempStr, nil);
		{
			StApplicationContext appContext;
			tempStr += LStr255(STR_PrintoutStrings, str_DateTimeSeparator);
		}
		::TimeString(dateTime, false, tempStr2, nil);
		tempStr += tempStr2;
		
		fDateField->SetDescriptor(tempStr);
		
		// Print it.

#if PP_Target_Carbon
		StClipRgnState noFlash(nil);
#else
		StVisRgn noFlash(ourWindow->GetMacPort());
#endif
		thePrintout->DoPrintJob();
		delete thePrintout;
		
	}

	catch(...) {
		if (thePrintout)
			delete thePrintout;
	}

	// Make sure printed pane is redrawn properly.

	printedPane->Refresh();
	if (printedTitleBar != nil)
		printedTitleBar->Refresh();

}