TweetFollow Us on Twitter

Screen I/O
Volume Number:9
Issue Number:2
Column Tag:C Workshop

Related Info: TextEdit Color QuickDraw

Three Subclasses for Screen Input/Output

Using existing TCL classes to solve the input/output problem

By Gerry H. Kenner, Magna, Utah

Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.

About the author

Gerry Kenner is a professional electrical and computer engineering consultant, university researcher and sometimes writer who specializes in image analysis systems for investigative scientists.

INTRODUCTION

While writing and debugging major commercial applications with THINK C 5.0, I have often needed to input test variables into the program or to do data printouts or bitmap dumps. In the DOS world the first two can be done fairly easily using printf and scanf library functions. Likewise, the cin and cout instructions used in C++ provide that language with considerable operational ease.

The third operation is more difficult to perform because it involves dumping the contents of bitmaps which have been drawn offscreen as well as others in which the bitmap has been modified with a CopyBits function call without being drawn anywhere.

My approach to creating these utilities was to make maximum use of existing TCL classes with the result that I was able to create the three classes presented in this article in less than two days. I had to write surprisingly little new code.

Nomenclature

A note about naming of classes. The prefix “C” is reserved for THINK Class Library (TCL) classes, i.e. CApplication, CObject, etc. The prefix “B” is used for user defined library classes. These are non-TCL classes which are used by more than one application. The following user library classes will be developed in this paper, BEditDoc, BEditPane, BBitMapDoc, BBitMapPane, BDisplayOutput, BGetTCLInfo and BUtilities.

Project specific classes are prefixed with two letters. My convention is to use upper case letters for major projects, while lower case and mixed letters are used for the smaller projects. As an example, the project name for this article was Dumps. Because of its limited scope, the project only needed one project specific class which was name duApp.

GENERAL

I decided that the classes would be easier to access if I called them indirectly using regular C function calls rather than directly with method calls from within objects. For this reason I created files named BUtilities.h and BUtilities.c containing the definitions and code for three functions named GetInfo, DumpData and OutputBitMap. These functions set up the objects for requesting input, dumping data and dumping bitmaps respectively.

Each function consisted of code for defining the object, initializing and then running it and then disposing of it when finished. For example, this is the code for GetInfo.

 theGetInfo = new BGetTCLInfo;
 theGetInfo->IBGetTCLInfo(DLOGinfo, gApplication);
 theGetInfo->GetInfo(promptPtr, returnPtr);
 theGetInfo->Dispose();

DLOGinfo was a constant with a value of 601 for identifying the DLOG resource used. Similar code was used for DumpData and OutputBitMap where the classes used were named BDisplayOutput and BBitMapDoc respectively. The exact calls can be determined from the method definitions given later in the paper. Note that required variable declarations and error checking code were omitted for brevity.

The functions are used by including the BUtilities.h file and then calling them wherever desired.

As an example of how to use the utility functions, take a copy of the THINK C Starter project and rename it Dumps. Make the appropriate changes in the file names and text, including changing the names of Starter and CStarterApp to Dumps and duApp respectively. Do whatever you like with CStarterDoc and CStarterPane as they will not be used. Remove all the code from the CreateDocument method. This will prevent unwanted windows from being opened. Increase the project memory allotment from 200 to 512k.

The utilities are accessed by overridding the CApplication Run method. The new Run method calls the three utility functions before calling the inherited Run method. A simplified version of the code is:

 GetInfo((char*)”A prompt string”, returnPtr);
 PtoCstr(returnPtr);
 textHdl = &returnPtr;
 DumpData(textHdl);
 OutputBitMap(&thePort->portBits);
 inherited::Run();

Don’t forget to allocate memory to textHdl and returnPtr. The bitmap for the screen is stored in thePort->portBits. I used it in this example because it is easy to access.

DATA INPUT CLASS

Description

This class is built using the TCL dialog classes to build and manage a diaog box with an OK button, a prompt string and an edit box for taking input.

The class is accessed by passing two parameters to the utility function call GetInfo. These parameters are a prompt string which identifies the information being requested and a char* to a buffer which is to receive the returned information.

GetInfo sets up and accesses an object of class BGetTCLInfo. This class was created as a subclass of CDLOGDirector which in turn is a subclass of CDialogDirector. The CDLOGDirector class provides the code for setting up a dialog box using DLOG/DITL resources created by a resource editor. This is done by creating an object of type CDLOGDialog in the initialization method. CDLOGDialog and its parent class CDialog have code which takes the description of a dialog box and its contained elements given in the DLOG/DITL resources and builds objects based thereon. The result is a regular window containing controls and text items which behaves like a modal dialog box but does not use the Dialog Manager functions of the Toolbox.

Objects of the CDialogDirector class have the code to manage dialog windows. In addition to functionality inherited from its ancester classes (CObject, CCollaborator, CBureaucrat, CDirectorOwner and CDirector), CDialogDirector has the following variable and methods for managing dialog windows.

Variable

long dismissCmd command that dismisses the dialog.

Methods

IDialogDirector Initialization method.

DoCommand Handles menu and control commands.

DoModalDialog Emulates ModalDialog toolbox function.

Validate Verifies window can be closed.

BeginDialog Sets up dialog box.

Close Closes dialog window.

EndDialog Disposes of dialog box.

DisableTheMenus Disables the menu bar.

EnableTheMenus Reenables the menu bar.

The first step for creating BGetTCLInfo was to use ResEdit to create a DLOG resource with its associated DITL resource both of which were designated as #601. The DITL resource consisted of a “OK#100” button (item #1) centered at the bottom, one line of static text at the top (item #3) with a large edit text box in between (item #2). The exact size and layout of the resource were determined by programmer tastes and requirements. The #100 associated with the word OK enables the CDlogDirector object to recognize when the button has been clicked on so that the dialog box can be closed.

The BGetTCLInfo class has one instance variable and three methods.

Instance Variable

Str255 fReturnStr Store input information.

Methods

IBGetTCLInfo Initialization method.

GetInfo Entry method.

DoCommand Response to button click.

The methods are defined as follows:

 void IBGetTCLInfo(short DLOGid, CDirectorOwner
 *aSupervisor);
 virtual void  GetInfo(char *promptPtr, char *returnPtr);
 virtual void  DoCommand(long theCommand);

fReturnStr is used to store the information input by the user. All the initialization method does is call the initialization method of the CDialogDirector class. For this it needs the number of the DLOG resource being used and the name of the objects Director Owner. The GetInfo method contains the code to manipulate the DITL items. The nucleus of this code is as follows.

 strcpy((char*)tempStr, promptPtr);
 CtoPstr((char*)tempStr);
 staticItem = (CDialogText*)itsWindow->FindViewByID(kPrompt);
 staticItem->SetTextString(tempStr);
 BeginDialog();
 theCommand = DoModalDialog(cmdOK);
 strcpy(returnPtr, &fReturnStr);

Character pointers to the prompt string and the return buffer are passed into GetInfo. The prompt string must be converted to a pascal string before it can be used. kPrompt is a constant whose value 3, cmdOK is defined as 100. returnPtr is used to return a copy of the data input to the calling function. The CWindow method FindViewByID locates the static text object which was created from DITL item #3 and assigns it to an instance pointer of type CAbstractText. Once the instance pointer has been identified it is a simple matter to send a SetTextString message to the program to insert the desired prompt string in the dialog box. The message BeginDialog of the CDialogDirector class then sets up the dialog box after which it is activated by calling DoModalDialog. cmdOK tells the program what value to use for breaking out of the DoModalDialog loop. Finally, the requested data is copied into the return buffer from fReturnStr.

The DoCommand method is where the program responds to the user interaction with the dialog box. Its essentials are as follows.

case cmdOK:
 theText = (CDialogText*)itsWindow->FindViewByID(kReturnStr);
 theText->GetTextString(fReturnStr);
 EndDialog(cmdOK, TRUE);
 break;

Once again the CWindow method FindViewByID is used to locate the dialog object created from the DLOG/DITL resources and assigns it to an instance pointer of type CDialogText. A call to the GetTextString method of the CDialogText class returns the input which the user entered via the keyboard. The EndDialog method of the CDialogDirector class is then called to dismiss the window and to clean up.

DATA OUTPUT CLASS

Description

A window is built which displays the contents of a handle pointing to text. Optimally, all editing operations including saving, printing, copying, pasting, etc. could be performed if the necessary menus were provided.

A handle pointing to the text which is to be displayed is passed to the object via the utility function called DumpData. DumpData creates, initializes and calls the operating code of an object of class BDisplayOutput. This handle is made the text handle of the text edit record. After this, almost everything is taken care of by the superclasses and the TextEdit Manager of the Macintosh Toolbox.

The class BDisplayOutput is based on the CEditDoc and CEditPane classes of THINK’s TinyEdit demo program. These two classes contain all the functionality necessary for creating simple edit programs. They have the code for creating or opening text files, saving, printing and performing the standard editing chores of copy, paste, etc. In addition, they can change fonts, sizes, styles alert the user to changes made in the text and permit the use of multiple windows.

Since I insist on reserving the C- prefix for the TCL classes, I took the liberty of changing the names of these classes to BEditDoc and BEditPane. I also changed the value of aLineWidth from 432 in the BEditPane initialization method to 600 to permit text across the full width of the screen. While doing so, I added the line “modified by Gerry Kenner” after the THINK copyright notices on the four files involved. All other changes had to do with changing the prefix CEdit- to BEdit- in the four files.

At this point, nearly all the work required to write a data dump method was complete. BDisplayOutput has the following instance variables and methods.

Instance variable

Boolean fQuitStatus Event management boolean.

Methods

IBDisplayOutput Initialization method.

BuildWindow Builds floating window.

EventManagement Event management loop.

DisplayRun Prepare data for output.

CloseWind Response to click in goaway box.

SetQuitStatus Access fQuitStatus.

GetQuitStatus Access fQuitStatus.

The definitions for these methods are the following.

 void IBDisplayOutput(CApplication *anApplication,
 Boolean printable); 
 virtual void  BuildWindow (Handle theData);
 virtual void  EventManagement(void);
 virtual void  DisplayRun(Handle theText);
 virtual void  CloseWind(CWindow *theWindow);
 virtual void  SetQuitStatus(Boolean status);
 virtual Boolean GetQuitStatus(void);

Once again, all the initialization method does is call the initialization method of its superclass. The BuildWindow method was changed to make the window float. The only change made in the BuildWindow method of the BEditDoc class was in the following line where the boolean aFloating, the second parameter, was set to TRUE to designate the window as floating.

 itsWindow->IWindow(WINDculture, TRUE, gDesktop, this);

This change necessitated that the programs desktop class be of the CFWDesktop type. This was done by overriding the CApplication class method MakeDesktop and changing it to:

 gDesktop = new(CFWDesktop);
 ((CFWDesktop*)gDesktop)->IFWDesktop(this);

The window was made floating to prevent it being completely covered by another window which might be made the active window by an accidental click.

SetQuitStatus and GetQuitStatus were used to manipulate the boolean fQuitStatus. They were used in the EventManagement and DoCommand methods.

The code for the EventManagement method was:

 SetQuitStatus(FALSE);
 do
 {
 gApplication->itsSwitchboard->ProcessEvent();
 } while (GetQuitStatus() == FALSE);

This is a continuous loop as long as the boolean fQuitStatus is set to FALSE.

The CloseWind method contained the code for exiting the EventManagement method. It does this by calling the method SetQuitStatus with the boolean set to TRUE. It does not call the inherited CloseWind method because this disposed of the BEditDisplay object and window before the EventManagement method had been exited resulting in immediate program failure.

The final method was DisplayRun. Here is a simplified version of its code.

BuildWindow(0L);
itsWindow->Select();
tempLong = strlen(*theText);
SetHandleSize(theText, tempLong);
((BEditPane*)itsMainPane)->SetTextHandle(theText);
EventManagement();

These commands build and display the output window, determine the length of the text passed into DisplayRun as a parameter and then made this handle the text handle of the text edit record. Finally, the event manager is called.

BITMAP DUMP CLASS

Description

A window is created into which a bitmap can be drawn and displayed. The document controlling the window contains a pane which is a subclass of CBitMapPane. A pointer to a bitmap is passed to the BBitMapPane object as a parameter of utility function OutputBitMap.

BBitMapDoc is a subclass of BDisplayDoc which was created above for dumping data. While at first glance this appears to be a very ineffective way of doing things since all that will be used are the EventManagement, SetQuitStatus and GetQuitStatus methods, it is actually very efficient. This is because the only memory requirements for objects are the space requirements of the instance variables plus a little bit of overhead. On the other hand, the code files are read in once and then reused whenever required. In this case, using BDisplayDoc as a superclass only requires two bytes (the boolean fQuitStatus) more than using CDocument as a superclass would with no loss for redundant method code.

The class BBitMapDoc has three methods and no instance variables. The methods are:

IBBitMapDoc Initialization method. 
BuildWindow Build window.
OutputMap Entry method.

Here are the definitions of the methods.

 void   IBBitMapDoc(CApplication *aSupervisor,
 Boolean printable);
 virtual void    OutputMap(BitMap *theBitMap);
 virtual void    BuildWindow (Handle theData);

IBBitMapDoc just calls the initialization method of its superclass BDisplayDoc. BuildWindow was overridden to change the type of pane used from a text pane to a bitmap pane. The pertinent changes were as follows.

 tRect = screenBits.bounds;
 SetRect(&bounds, 0, 0, tRect.right, tRect.bottom - 38);
 SetLongRect(&bitMapRect, 0, 0, BITMAPWIDTH, BITMAPHEIGHT);

 theMainPane = new(BBitMapPane);
 itsMainPane = theMainPane;
 itsGopher = theMainPane;

 theMainPane->IBBitMapPane(theScrollPane, this,
 bounds.right - SBARSIZE, bounds.bottom - SBARSIZE,
 0, 0, sizELASTIC, sizELASTIC, &bitMapRect, 0L, TRUE);

The first two instructions establish the size of the bitmap window as the full size of the screen less the width of the menu bar and the drag bar. The third instruction sets the dimensions of the bitmap as 640x480 pixels which is fairly standard for image capture systems.

BBitMapPane is a subclass of the TCL library class CBitMapPane. CBitMapPane provides the code for drawing a bitmap in a pane. It has an instance variable named itsBitMap which is a pointer to an object of the CBitMap class. CBitMap is a class for working with bitmaps. It has methods for copying to and from the current port, setting transfer modes, determining bitmap boundaries and making preparations for drawing and cleaning up afterwards.

The method OutputMap takes care of arranging the bitmap for display on the screen. Its code follows:

 BuildWindow(0L);
 itsWindow->Select();
 ((BBitMapPane*)itsMainPane)->InstallBitMap(theBitMap);
 EventManagement();

This is the same as the DisplayRun method of BDisplayDoc except it passes the address of the bit map to a method of BBitMapPane.

BBitMapPane could have been dispensed with by putting some convoluted code in the OutputMap method and then using CBitMapPane directly. I preferred to create a subclass of CBitMapPane instead.

BBitMapPane has the usual dummy initialization method and a method named InstallBitMap which takes care of assigning the bitmap to the CBitMapPane object pointer itsBitMap. This is done as follows:

 theLongRect.top = theBitMap->bounds.top;
 theLongRect.left = theBitMap->bounds.left;
 theLongRect.bottom = theBitMap->bounds.bottom;
 theLongRect.right = theBitMap->bounds.right;

 CopyBits(theBitMap, itsBitMap->macBitMap,
 &theBitMap->bounds, &theBitMap->bounds, srcCopy, 0L);
 Prepare();
 itsBitMap->CopyFrom(&theLongRect, &theLongRect, 0L);

The first four instructions set up the rectangles. The CopyBits call puts the desired bitmap into the BitMapPanes bitmap. The Prepare call makes certain the dump window is the active window and the CopyFrom call copies the bitmap into the dump window where it is displayed.

FINAL REMARKS

I have been using these classes for some time and find that they work quite well. On occasion, they do crash the program and then I have to resort to other less convenient methods of doing my work.

The functions generally work when embedded within object oriented code. I have not been able to use them from functions (non-object oriented code) where a previous window existed which had not been created with object oriented code.

OutputBitMap appears to work with MacPaint type files even though they are 576 bits deep rather than 480 bits.

The complete code for this article is included as part of the MacTutor disk which can be obtained from MacTutor Mail Order House.

I can be reached on internet at ghkenner@cc.utah.edu.

I wish to thank David Kenner for helping with the development of these classes.

Listing: BUtilities.h

/******************************************************
 * BUtilities.h
 *
 * General utilities for use with THINK C with objects.
 * © copyright 1991, KSS Scientific Consultants
 * © copyright 1989, Symantecs Corporation.  Some parts
 *   of the code used in this section were derived
 *   from their programs.
 *
 *******************************************************/

#define _H_BUtilities

 // Input/output utilities

void  GetInfo(char *promptPtr, char *returnPtr);
void  DumpData(Handle theData);
void  DumpBitMap(BitMap *theBitMap);
Listing: BUtilities.c

/******************************************************
 * BUtilities.c
 *
 * General utilities for use with THINK C with objects.
 * © copyright 1991, KSS Scientific Consultants
 * © copyright 1989, Symantecs Corporation.  Some parts
 *   of the code used in this section were derived
 *   from their programs.
 *
 *******************************************************/

#include <CApplication.h>
#include "BBitMapDoc.h"
#include "BDisplayOutput.h"
#include "BGetTCLInfo.h"
#include "BUtilities.h"
#include <stdio.h>
#include <string.h>

#define DLOGinfo 601 // Resource ID for DLOG template

extern CApplication*gApplication;

/********************************************************
 * GetInfo()
 *
 * Get data input from the user.
 *
 ********************************************************/

void  GetInfo(char *promptPtr, char *returnPtr)
{
 BGetTCLInfo*theGetInfo;
 
 TRY
 {
 theGetInfo = new BGetTCLInfo;
 theGetInfo->IBGetTCLInfo(DLOGinfo, gApplication);
 theGetInfo->GetInfo(promptPtr, returnPtr);
 }
 CATCH
 {
 theGetInfo->Dispose();
 }
 ENDTRY;
 theGetInfo->Dispose();
}
/****************************************************
 * DumpData()
 *
 * Dump the results to an output window.
 *
 ****************************************************/

void DumpData(Handle theData)
{
 BDisplayOutput  *theOutput;
 
 theOutput = new BDisplayOutput;
 theOutput->IBDisplayOutput(gApplication, TRUE);
 theOutput->DisplayRun(theData);
 theOutput->Dispose();
}

/*****************************************************
 * DumpBitMap()
 *
 * Dump a bitmap to an output window.
 *
 *****************************************************/

void DumpBitMap(BitMap *theBitMap)
{
 BBitMapDoc *theBitMapDoc;
 
 TRY
 {
 theBitMapDoc = new BBitMapDoc;
 theBitMapDoc->IBBitMapDoc(gApplication, TRUE);
 theBitMapDoc->OutputMap(theBitMap);
 }
 CATCH
 {
 theBitMapDoc->Dispose();
 }
 ENDTRY;
 theBitMapDoc->Dispose();
}
Listing: BGetTCLInfo.h

/*******************************************************
 * BGetTCLInfo.h
 *
 * Dialog class which prompts user for information and then
 * return his input.
 *  
 * © copyright 1992, KSS Scientific Consultants.
 *
 *******************************************************/

#pragma once

#include <CDLOGDirector.h>

class BGetTCLInfo : public CDLOGDirector
{
private:
 Str255 fReturnStr;

public: 
 void IBGetTCLInfo(short DLOGid, CDirectorOwner 
 *aSupervisor);

 virtual void  GetInfo(char *promptPtr, char *returnPtr);
 
protected:
 virtual void  DoCommand(long theCommand);
};
Listing: BGetTCLInfo.c

/*******************************************************
 * BGetTCLInfo.c
 *
 * SUPERCLASS = CDLOGDirector
 *
 * Dialog class which prompts user for information and then
 * return his input.
 *  
 * © copyright 1991, KSS Scientific Consultants.
 *
 *******************************************************/

#include <CDialogText.h>
#include <CWindow.h>
#include <Commands.h>
#include <string.h>
#include "BGetTCLInfo.h"

enum  // dialog item IDs
{
 kReturnStr = 2,
 kPrompt
};

/*******************************************************
 * IBGetTCLInfo()
 *
 * Initialization method.
 *
 *******************************************************/

void BGetTCLInfo::IBGetTCLInfo(short DLOGid, CDirectorOwner 
 *aSupervisor)
{
 CDLOGDirector::IDLOGDirector(DLOGid, aSupervisor);
}

/******************************************************
 * DoCommand()
 *
 ******************************************************/

void BGetTCLInfo::DoCommand(long theCommand)
{
 CDialogText*theText;
 
 switch (theCommand)
 {
 case cmdOK:
 theText = 
 (CDialogText*)itsWindow->FindViewByID(kReturnStr);
 theText->GetTextString(fReturnStr);
 EndDialog(cmdOK, TRUE);
 break;

 default:
 inherited::DoCommand(theCommand);
 break;
 }
}

/*******************************************************
 * GetInfo()
 *
 * Entry method.
 *
 *******************************************************/

void BGetTCLInfo::GetInfo(char *promptPtr, char *returnPtr)
{
 long   theCommand;
 CDialogText*staticItem;
 Str255 tempStr;
 
 strcpy((char*)tempStr, promptPtr);
 CtoPstr((char*)tempStr);
 staticItem = (CDialogText*)itsWindow->FindViewByID(kPrompt);
 staticItem->SetTextString(tempStr);

 // show the dialog
 BeginDialog();
 
 theCommand = DoModalDialog(cmdOK);
 
 strcpy(returnPtr, (char*)fReturnStr);
}
Listing: BDisplayOutput.h

/*****************************************************
 * BDisplayOutput.h
 *
 * Display the contents of a Handle in a text screen.
 *
 * © copyright 1991, KSS Scientific Consultants.
 *
 ******************************************************/

#define _H_BDisplayOutput

#include "BEditDoc.h"

class BDisplayOutput : public BEditDoc
{
private:
 BooleanfQuitStatus;

public: 
 void IBDisplayOutput(CApplication *anApplication, 
 Boolean printable);
 
 virtual void  BuildWindow (Handle theData);
 virtual void  EventManagement(void);
 virtual void  DisplayRun(Handle theText);
 virtual void  CloseWind(CWindow *theWindow);

private:
 virtual void  SetQuitStatus(Boolean status);
 virtual Boolean GetQuitStatus(void);
};
Listing: BDisplayOutput.c

/******************************************************
 * BDisplayOutput.c
 *
 * SUPERCLASS = BEditDoc
 *
 * Display the contents of a Handle in a text screen.  It
 * requires a floating window desktop.
 * Window resource with id of 500 must be in resource file.
 *
 * © copyright 1991, KSS Scientific Consultants.
 *
 *****************************************************/

#include <CApplication.h>
#include <CBureaucrat.h>
#include <CScrollPane.h>
#include <CSwitchboard.h>
#include <CWindow.h>
#include <string.h>
#include "BDisplayOutput.h"
#include "BEditPane.h"

#define WINDculture500    // Res ID for WIND template

extern CApplication*gApplication;
extern CBureaucrat *gGopher;
extern CDesktop  *gDesktop; // The visible Desktop

/*******************************************************
 * IBDisplayOutput()
 *
 * Initialization method.
 *
 *******************************************************/
 
void BDisplayOutput::IBDisplayOutput(CApplication 
 *anApplication, Boolean printable)
{
 inherited::IEditDoc(anApplication, printable);
}

/********************************************************
 * BuildWindow
 *
 * Override BuildWindow so a floating window is created
 * and it is not positioned by the Decorator.
 *
 ********************************************************/

void BDisplayOutput::BuildWindow (Handle theData)

{
 CScrollPane*theScrollPane;
 BEditPane*theMainPane;
 Rect   margin;
 itsWindow = new(CWindow);
 itsWindow->IWindow(WINDculture, TRUE, gDesktop, this);
 itsWindow->Move(40, 60);
 
 theScrollPane = new(CScrollPane);
 
 theScrollPane->IScrollPane(itsWindow, this, 10, 10, 0, 0,
 sizELASTIC, sizELASTIC, TRUE, TRUE, TRUE);

 theScrollPane->FitToEnclFrame(TRUE, TRUE);

 theMainPane = new(BEditPane);
 itsMainPane = theMainPane;
 itsGopher = theMainPane;

 theMainPane->IEditPane(theScrollPane, this);

 theScrollPane->InstallPanorama(theMainPane);

 if (theData)
 theMainPane->SetTextHandle(theData);
}

/**********************************************************
 * EventManagement()
 *
 * Event control loop
 *
 **********************************************************/

void BDisplayOutput::EventManagement(void)
{
 SetQuitStatus(FALSE);
 do
 {
 gApplication->itsSwitchboard->ProcessEvent();
 } while (GetQuitStatus() == FALSE);
}

/*******************************************************
 * DisplayRun()
 *
 * Entry method.
 *
 *******************************************************/
 
void BDisplayOutput::DisplayRun(Handle theText)
{
 long   tempLong;
 
 BuildWindow(0L);
 itsWindow->Select();

 tempLong = strlen(*theText);
 SetHandleSize(theText, tempLong);
 ((BEditPane*)itsMainPane)->SetTextHandle(theText);
 
 EventManagement();
}

/********************************************************
 * CloseWind()
 *
 * Add code to change QuitStatus to TRUE
 *
 ********************************************************/

void BDisplayOutput::CloseWind(CWindow *theWindow)
{
 SetQuitStatus(TRUE);
 
}

/*******************************************************
 * SetQuitStatus()
 *
 * Set or reset fQuitStatus.
 *
 *******************************************************/

void BDisplayOutput::SetQuitStatus(Boolean status)
{
 fQuitStatus = status;
}

/******************************************************
 * GetQuitStatus()
 *
 * Get the status fQuitStatus.
 *
 ******************************************************/

Boolean BDisplayOutput::GetQuitStatus(void)
{
 return (fQuitStatus);
}
Listing: BBitMapDoc.h

/********************************************************
 * BBitMapDoc.h
 *
 * Class for rapid dumping of a bitmap to a window.
 *
 * © copyright 1992, KSS Scientific Consultants
 *
 ********************************************************/

#pragma once

#include "BDisplayOutput.h"

class BBitMapDoc : public BDisplayOutput
{
public:
 void   IBBitMapDoc(CApplication *aSupervisor,
 Boolean printable);
 virtual void  OutputMap(BitMap *theBitMap);

protected:
 virtual void  BuildWindow (Handle theData);
};
Listing: BBitMapDoc.c

/********************************************************
 * BBitMapDoc.c
 *
 * SUPERCLASS = BDisplayOutput
 *
 * Class for rapid dumping of a bitmap to a window.
 *
 * © copyright 1992, KSS Scientific Consultants
 *
 ********************************************************/

#include <CDecorator.h>
#include <CDesktop.h>
#include <CScrollPane.h>
#include <CWindow.h>
#include <constants.h>
#include "BBitMapDoc.h"
#include "BBitMapPane.h"

#define WINDculture500    // Res ID for WIND template
#define BITMAPWIDTH640
#define BITMAPHEIGHT 480

extern CDecorator*gDecorator;
extern CDesktop  *gDesktop;

/*******************************************************
 * IBBitMapDoc()
 *
 * Initialization method
 *
 *******************************************************/

void BBitMapDoc::IBBitMapDoc(CApplication *aSupervisor, Boolean printable)
{
    inherited::IBDisplayOutput(aSupervisor, printable);
}

/********************************************************
 * BuildWindow
 *
 * Override BuildWindow so a floating window is created
 * and it is not positioned by the Decorator.
 *
 ********************************************************/

void BBitMapDoc::BuildWindow (Handle theData)

{
 CScrollPane*theScrollPane;
 BBitMapPane*theMainPane;
 Rect   bounds, tRect;
 LongRect bitMapRect;

 itsWindow = new(CWindow);
 itsWindow->IWindow(WINDculture, TRUE, gDesktop, this);
 itsWindow->Move(40, 60);
 itsWindow->ChangeSize(screenBits.bounds.right,
 screenBits.bounds.bottom - 38);
 tRect = screenBits.bounds;
 SetRect(&bounds, 0, 0, tRect.right, tRect.bottom - 38);
 SetLongRect(&bitMapRect, 0, 0, BITMAPWIDTH, BITMAPHEIGHT);
 
 theScrollPane = new(CScrollPane);
 
 theScrollPane->IScrollPane(itsWindow, this, 10, 10, 0, 0,
 sizELASTIC, sizELASTIC, TRUE, TRUE, TRUE);
 theScrollPane->FitToEnclFrame(TRUE, TRUE);

 theMainPane = new(BBitMapPane);
 itsMainPane = theMainPane;
 itsGopher = theMainPane;

 theMainPane->IBBitMapPane(theScrollPane, this,
 bounds.right - SBARSIZE, bounds.bottom - SBARSIZE,
 0, 0, sizELASTIC, sizELASTIC, &bitMapRect, 0L, TRUE);

 theScrollPane->InstallPanorama(theMainPane);

 gDecorator->PlaceNewWindow(itsWindow);
}

/********************************************************
 * OutputMap()
 *
 * Initialize bitmap window and output bitmap.
 *
 *******************************************************/

void BBitMapDoc::OutputMap(BitMap *theBitMap)
{
 BuildWindow(0L);
 itsWindow->Select();
 
 ((BBitMapPane*)itsMainPane)->InstallBitMap(theBitMap);

 EventManagement();
}

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »
Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links below... | Read more »
Marvel Future Fight celebrates nine year...
Announced alongside an advertising image I can only assume was aimed squarely at myself with the prominent Deadpool and Odin featured on it, Netmarble has revealed their celebrations for the 9th anniversary of Marvel Future Fight. The Countdown... | Read more »
HoYoFair 2024 prepares to showcase over...
To say Genshin Impact took the world by storm when it was released would be an understatement. However, I think the most surprising part of the launch was just how much further it went than gaming. There have been concerts, art shows, massive... | Read more »

Price Scanner via MacPrices.net

Amazon is offering a $100 discount on every M...
Amazon is offering a $100 instant discount on each configuration of Apple’s new 13″ M3 MacBook Air, in Midnight, this weekend. These are the lowest prices currently available for new 13″ M3 MacBook... Read more
You can save $300-$480 on a 14-inch M3 Pro/Ma...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
24-inch M1 iMacs available at Apple starting...
Apple has clearance M1 iMacs available in their Certified Refurbished store starting at $1049 and ranging up to $300 off original MSRP. Each iMac is in like-new condition and comes with Apple’s... Read more
Walmart continues to offer $699 13-inch M1 Ma...
Walmart continues to offer new Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBook for sale by... Read more
B&H has 13-inch M2 MacBook Airs with 16GB...
B&H Photo has 13″ MacBook Airs with M2 CPUs, 16GB of memory, and 256GB of storage in stock and on sale for $1099, $100 off Apple’s MSRP for this configuration. Free 1-2 day delivery is available... Read more
14-inch M3 MacBook Pro with 16GB of RAM avail...
Apple has the 14″ M3 MacBook Pro with 16GB of RAM and 1TB of storage, Certified Refurbished, available for $300 off MSRP. Each MacBook Pro features a new outer case, shipping is free, and an Apple 1-... Read more
Apple M2 Mac minis on sale for up to $150 off...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for $100-$150 off MSRP, each including free delivery: – Mac mini M2/256GB SSD: $499, save $100 – Mac mini M2/512GB SSD: $699, save $100 –... Read more
Amazon is offering a $200 discount on 14-inch...
Amazon has 14-inch M3 MacBook Pros in stock and on sale for $200 off MSRP. Shipping is free. Note that Amazon’s stock tends to come and go: – 14″ M3 MacBook Pro (8GB RAM/512GB SSD): $1399.99, $200... Read more
Sunday Sale: 13-inch M3 MacBook Air for $999,...
Several Apple retailers have the new 13″ MacBook Air with an M3 CPU in stock and on sale today for only $999 in Midnight. These are the lowest prices currently available for new 13″ M3 MacBook Airs... Read more
Multiple Apple retailers are offering 13-inch...
Several Apple retailers have 13″ MacBook Airs with M2 CPUs in stock and on sale this weekend starting at only $849 in Space Gray, Silver, Starlight, and Midnight colors. These are the lowest prices... Read more

Jobs Board

Relationship Banker - *Apple* Valley Financ...
Relationship Banker - Apple Valley Financial Center APPLE VALLEY, Minnesota **Job Description:** At Bank of America, we are guided by a common purpose to help Read more
IN6728 Optometrist- *Apple* Valley, CA- Tar...
Date: Apr 9, 2024 Brand: Target Optical Location: Apple Valley, CA, US, 92308 **Requisition ID:** 824398 At Target Optical, we help people see and look great - and Read more
Medical Assistant - Orthopedics *Apple* Hil...
Medical Assistant - Orthopedics Apple Hill York Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Now Read more
*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of Read more
Liquor Stock Clerk - S. *Apple* St. - Idaho...
Liquor Stock Clerk - S. Apple St. Boise Posting Begin Date: 2023/10/10 Posting End Date: 2024/10/14 Category: Retail Sub Category: Customer Service Work Type: Part Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.