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

Dropbox 193.4.5594 - Cloud backup and sy...
Dropbox is a file hosting service that provides cloud storage, file synchronization, personal cloud, and client software. It is a modern workspace that allows you to get to all of your files, manage... Read more
Google Chrome 122.0.6261.57 - Modern and...
Google Chrome is a Web browser by Google, created to be a modern platform for Web pages and applications. It utilizes very fast loading of Web pages and has a V8 engine, which is a custom built... Read more
Skype 8.113.0.210 - Voice-over-internet...
Skype is a telecommunications app that provides HD video calls, instant messaging, calling to any phone number or landline, and Skype for Business for productive cooperation on the projects. This... Read more
Tor Browser 13.0.10 - Anonymize Web brow...
Using Tor Browser you can protect yourself against tracking, surveillance, and censorship. Tor was originally designed, implemented, and deployed as a third-generation onion-routing project of the U.... Read more
Deeper 3.0.4 - Enable hidden features in...
Deeper is a personalization utility for macOS which allows you to enable and disable the hidden functions of the Finder, Dock, QuickTime, Safari, iTunes, login window, Spotlight, and many of Apple's... Read more
OnyX 4.5.5 - Maintenance and optimizatio...
OnyX is a multifunction utility that you can use to verify the startup disk and the structure of its system files, to run miscellaneous maintenance and cleaning tasks, to configure parameters in the... Read more
Hopper Disassembler 5.14.1 - Binary disa...
Hopper Disassembler is a binary disassembler, decompiler, and debugger for 32- and 64-bit executables. It will let you disassemble any binary you want, and provide you all the information about its... Read more

Latest Forum Discussions

See All

Zenless Zone Zero opens entries for its...
miHoYo, aka HoYoverse, has become such a big name in mobile gaming that it's hard to believe that arguably their flagship title, Genshin Impact, is only three and a half years old. Now, they continue the road to the next title in their world, with... | Read more »
Live, Playdate, Live! – The TouchArcade...
In this week’s episode of The TouchArcade Show we kick things off by talking about all the games I splurged on during the recent Playdate Catalog one-year anniversary sale, including the new Lucas Pope jam Mars After Midnight. We haven’t played any... | Read more »
TouchArcade Game of the Week: ‘Vroomies’
So here’s a thing: Vroomies from developer Alex Taber aka Unordered Games is the Game of the Week! Except… Vroomies came out an entire month ago. It wasn’t on my radar until this week, which is why I included it in our weekly new games round-up, but... | Read more »
SwitchArcade Round-Up: ‘MLB The Show 24’...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for March 15th, 2024. We’re closing out the week with a bunch of new games, with Sony’s baseball franchise MLB The Show up to bat yet again. There are several other interesting games to... | Read more »
Steam Deck Weekly: WWE 2K24 and Summerho...
Welcome to this week’s edition of the Steam Deck Weekly. The busy season has begun with games we’ve been looking forward to playing including Dragon’s Dogma 2, Horizon Forbidden West Complete Edition, and also console exclusives like Rise of the... | Read more »
Steam Spring Sale 2024 – The 10 Best Ste...
The Steam Spring Sale 2024 began last night, and while it isn’t as big of a deal as say the Steam Winter Sale, you may as well take advantage of it to save money on some games you were planning to buy. I obviously recommend checking out your own... | Read more »
New ‘SaGa Emerald Beyond’ Gameplay Showc...
Last month, Square Enix posted a Let’s Play video featuring SaGa Localization Director Neil Broadley who showcased the worlds, companions, and more from the upcoming and highly-anticipated RPG SaGa Emerald Beyond. | Read more »
Choose Your Side in the Latest ‘Marvel S...
Last month, Marvel Snap (Free) held its very first “imbalance" event in honor of Valentine’s Day. For a limited time, certain well-known couples were given special boosts when conditions were right. It must have gone over well, because we’ve got a... | Read more »
Warframe welcomes the arrival of a new s...
As a Warframe player one of the best things about it launching on iOS, despite it being arguably the best way to play the game if you have a controller, is that I can now be paid to talk about it. To whit, we are gearing up to receive the first... | Read more »
Apple Arcade Weekly Round-Up: Updates an...
Following the new releases earlier in the month and April 2024’s games being revealed by Apple, this week has seen some notable game updates and events go live for Apple Arcade. What The Golf? has an April Fool’s Day celebration event going live “... | Read more »

Price Scanner via MacPrices.net

Apple Education is offering $100 discounts on...
If you’re a student, teacher, or staff member at any educational institution, you can use your .edu email address when ordering at Apple Education to take $100 off the price of a new M3 MacBook Air.... Read more
Apple Watch Ultra 2 with Blood Oxygen feature...
Best Buy is offering Apple Watch Ultra 2 models for $50 off MSRP on their online store this week. Sale prices available for online orders only, in-store prices may vary. Order online, and choose... Read more
New promo at Sams Club: Apple HomePods for $2...
Sams Club has Apple HomePods on sale for $259 through March 31, 2024. Their price is $40 off Apple’s MSRP, and both Space Gray and White colors are available. Sale price is for online orders only, in... Read more
Get Apple’s 2nd generation Apple Pencil for $...
Apple’s Pencil (2nd generation) works with the 12″ iPad Pro (3rd, 4th, 5th, and 6th generation), 11″ iPad Pro (1st, 2nd, 3rd, and 4th generation), iPad Air (4th and 5th generation), and iPad mini (... Read more
10th generation Apple iPads on sale for $100...
Best Buy has Apple’s 10th-generation WiFi iPads back on sale for $100 off MSRP on their online store, starting at only $349. With the discount, Best Buy’s prices are the lowest currently available... Read more
iPad Airs on sale again starting at $449 on B...
Best Buy has 10.9″ M1 WiFi iPad Airs on record-low sale prices again for $150 off Apple’s MSRP, starting at $449. Sale prices for online orders only, in-store price may vary. Order online, and choose... Read more
Best Buy is blowing out clearance 13-inch M1...
Best Buy is blowing out clearance Apple 13″ M1 MacBook Airs this weekend for only $649.99, or $350 off Apple’s original MSRP. Sale prices for online orders only, in-store prices may vary. Order... Read more
Low price alert! You can now get a 13-inch M1...
Walmart has, for the first time, begun offering new Apple MacBooks for sale on their online store, albeit clearance previous-generation models. They now have the 13″ M1 MacBook Air (8GB RAM, 256GB... Read more
Best Apple MacBook deal this weekend: Get the...
Apple has 13″ M2 MacBook Airs available for only $849 today in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty is included,... Read more
New 15-inch M3 MacBook Air (Midnight) on sale...
Amazon has the new 15″ M3 MacBook Air (8GB RAM/256GB SSD/Midnight) in stock and on sale today for $1249.99 including free shipping. Their price is $50 off MSRP, and it’s the lowest price currently... Read more

Jobs Board

Early Preschool Teacher - Glenda Drive/ *Appl...
Early Preschool Teacher - Glenda Drive/ Apple ValleyTeacher Share by Email Share on LinkedIn Share on Twitter Read more
Senior Software Engineer - *Apple* Fundamen...
…center of Microsoft's efforts to empower our users to do more. The Apple Fundamentals team focused on defining and improving the end-to-end developer experience in Read more
Relationship Banker *Apple* Valley Main - W...
…Alcohol Policy to learn more. **Company:** WELLS FARGO BANK **Req Number:** R-350696 **Updated:** Mon Mar 11 00:00:00 UTC 2024 **Location:** APPLE VALLEY,California Read more
Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill WellSpan Medical Group, York, PA | Nursing | Nursing Support | FTE: 1 | Regular | Tracking Code: 200555 Apply Now Read more
Early Preschool Teacher - Glenda Drive/ *Appl...
Early Preschool Teacher - Glenda Drive/ Apple ValleyTeacher Share by Email Share on LinkedIn Share on Twitter Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.