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

Whitethorn Games combines two completely...
If you have ever gone fishing then you know that it is a lesson in patience, sitting around waiting for a bite that may never come. Well, that's because you have been doing it wrong, since as Whitehorn Games now demonstrates in new release Skate... | Read more »
Call of Duty Warzone is a Waiting Simula...
It's always fun when a splashy multiplayer game comes to mobile because they are few and far between, so I was excited to see the notification about Call of Duty: Warzone Mobile (finally) launching last week and wanted to try it out. As someone who... | Read more »
Albion Online introduces some massive ne...
Sandbox Interactive has announced an upcoming update to its flagship MMORPG Albion Online, containing massive updates to its existing guild Vs guild systems. Someone clearly rewatched the Helms Deep battle in Lord of the Rings and spent the next... | Read more »
Chucklefish announces launch date of the...
Chucklefish, the indie London-based team we probably all know from developing Terraria or their stint publishing Stardew Valley, has revealed the mobile release date for roguelike deck-builder Wildfrost. Developed by Gaziter and Deadpan Games, the... | Read more »
Netmarble opens pre-registration for act...
It has been close to three years since Netmarble announced they would be adapting the smash series Solo Leveling into a video game, and at last, they have announced the opening of pre-orders for Solo Leveling: Arise. [Read more] | Read more »
PUBG Mobile celebrates sixth anniversary...
For the past six years, PUBG Mobile has been one of the most popular shooters you can play in the palm of your hand, and Krafton is celebrating this milestone and many years of ups by teaming up with hit music man JVKE to create a special song for... | Read more »
ASTRA: Knights of Veda refuse to pump th...
In perhaps the most recent example of being incredibly eager, ASTRA: Knights of Veda has dropped its second collaboration with South Korean boyband Seventeen, named so as it consists of exactly thirteen members and a video collaboration with Lee... | Read more »
Collect all your cats and caterpillars a...
If you are growing tired of trying to build a town with your phone by using it as a tiny, ineffectual shover then fear no longer, as Independent Arts Software has announced the upcoming release of Construction Simulator 4, from the critically... | Read more »
Backbone complete its lineup of 2nd Gene...
With all the ports of big AAA games that have been coming to mobile, it is becoming more convenient than ever to own a good controller, and to help with this Backbone has announced the completion of their 2nd generation product lineup with their... | Read more »
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 »

Price Scanner via MacPrices.net

B&H has Apple’s 13-inch M2 MacBook Airs o...
B&H Photo has 13″ MacBook Airs with M2 CPUs and 256GB of storage in stock and on sale for up to $150 off Apple’s new MSRP, starting at only $849. Free 1-2 day delivery is available to most US... Read more
M2 Mac minis on sale for $100-$200 off MSRP,...
B&H Photo has Apple’s M2-powered Mac minis back in stock and on sale today for $100-$200 off MSRP. Free 1-2 day shipping is available for most US addresses: – Mac mini M2/256GB SSD: $499, save $... Read more
Mac Studios with M2 Max and M2 Ultra CPUs on...
B&H Photo has standard-configuration Mac Studios with Apple’s M2 Max & Ultra CPUs in stock today and on Easter sale for $200 off MSRP. Their prices are the lowest available for these models... Read more
Deal Alert! B&H Photo has Apple’s 14-inch...
B&H Photo has new Gray and Black 14″ M3, M3 Pro, and M3 Max MacBook Pros on sale for $200-$300 off MSRP, starting at only $1399. B&H offers free 1-2 day delivery to most US addresses: – 14″ 8... Read more
Department Of Justice Sets Sights On Apple In...
NEWS – The ball has finally dropped on the big Apple. The ball (metaphorically speaking) — an antitrust lawsuit filed in the U.S. on March 21 by the Department of Justice (DOJ) — came down following... Read more
New 13-inch M3 MacBook Air on sale for $999,...
Amazon has Apple’s new 13″ M3 MacBook Air on sale for $100 off MSRP for the first time, now just $999 shipped. Shipping is free: – 13″ MacBook Air (8GB RAM/256GB SSD/Space Gray): $999 $100 off MSRP... Read more
Amazon has Apple’s 9th-generation WiFi iPads...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Discounted 14-inch M3 MacBook Pros with 16GB...
Apple retailer Expercom has 14″ MacBook Pros with M3 CPUs and 16GB of standard memory discounted by up to $120 off Apple’s MSRP: – 14″ M3 MacBook Pro (16GB RAM/256GB SSD): $1691.06 $108 off MSRP – 14... Read more
Clearance 15-inch M2 MacBook Airs on sale for...
B&H Photo has Apple’s 15″ MacBook Airs with M2 CPUs (8GB RAM/256GB SSD) in stock today and on clearance sale for $999 in all four colors. Free 1-2 delivery is available to most US addresses.... Read more
Clearance 13-inch M1 MacBook Airs drop to onl...
B&H has Apple’s base 13″ M1 MacBook Air (Space Gray, Silver, & Gold) in stock and on clearance sale today for $300 off MSRP, only $699. Free 1-2 day shipping is available to most addresses in... Read more

Jobs Board

Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Business Analyst | *Apple* Pay - Banco Popu...
Business Analyst | Apple PayApply now " Apply now + Apply Now + Start applying with LinkedIn Start + Please wait Date:Mar 19, 2024 Location: San Juan-Cupey, PR Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.