Skip to content

Commit

Permalink
MFrame
Browse files Browse the repository at this point in the history
First archived complete snapshot of the homegrown framework
that was developed for Iconographer, Meshroom and other
projects of that era.
  • Loading branch information
mihaip committed Sep 14, 2001
1 parent faa5341 commit dbdf37b
Show file tree
Hide file tree
Showing 96 changed files with 8,509 additions and 289 deletions.
626 changes: 626 additions & 0 deletions software/MFrame/MList/MList.cpp

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions software/MFrame/MList/MList.cpp.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* Resource fork of software/MFrame/MList/MList.cpp */
data 'MPSR' (1005) {
$"0009 4D6F 6E61 636F 0000 0000 0000 0000" /* ..Monaco........ */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"0000 0002 0004 004E 00B4 02D4 03C2 004E" /* .......N.´.Ô.Â.N */
$"00B4 02D4 03C2 B6DF B3E3 0000 0DD0 0000" /* .´.Ô.¶߳ã...Ð.. */
$"0DD0 0000 0B49 0100" /* .Ð...I.. */
};

data 'MWBB' (1008) {
$"0001 0001" /* .... */
};

95 changes: 95 additions & 0 deletions software/MFrame/MList/MList.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#pragma once

#include "MString.h"

#include "commonfunctions.h"

enum listConstants
{
kListIndent = 5
};

typedef bool (*CellFilterFunc)(MStringPtr cellString, void *clientData);
typedef int (*CellHitTestFunc)(Rect targetRect, Point theMouse, void *clientData);
typedef void (*CellDrawFunc)(Rect targetRect, MStringPtr cellString, bool selected, int part, void *clientData);
typedef long (*StringCompareFn)(MStringPtr string1, MStringPtr string2, void *clientData1, void* clientData2);
typedef void (*CellUpdateFunc)(MStringPtr cellString, int* height, void* clientData);

class MList
{
public:
MList(StringCompareFn compareFn,
CellDrawFunc drawFunc,
CellHitTestFunc hitTestFunc,
CellFilterFunc filerFunc,
CellUpdateFunc updateFunc);
~MList(void);

void AddRow(int insertionPoint, int height);
//void AddCol(int insertionPoint, int width);
void RemoveRow(int row);

void InsertSorted(MStringPtr data, int height, void* clientData);

OSErr GetCellClientData(int row, int col, void** clientData);
OSErr SetCellClientData(int row, int col, void* clientData);

OSErr SetValue(int row, int col, MStringPtr string);
OSErr GetValue(int row, int col, MStringPtr* string);
OSErr FindValue(MStringPtr string, void *clientData, int* row, int* col);

OSErr Remove(int row, int col);

int Select(Point thePoint, int vOffset, int* part);
int GetSelection();

void Filter();

bool HandleEvent(EventRecord* eventPtr);

void Display(Rect targetRect, int voffset);

void SetDisplayFont(int fontNo, int size);
void SetCustomAreaWidth(int width);

int GetHeight();
int GetVOffset();
//int GetWidth;

int GetAverageHeight();

int CountVisible();
int CountTotal();

private:
void Update(int width, int height, int vOffset, int cellToDraw);

Rect listRect;

int customAreaWidth;

int vOffset;

int numCols, numRows;
int* colWidths;
int* rowHeights;

StringCompareFn CellStringCompare;
CellHitTestFunc CellHitTest;
CellDrawFunc CellDraw;
CellFilterFunc CellFilter;
CellUpdateFunc CellUpdate;

void** cellClientData;

short fontNo;
short fontSize;

PixMapHandle listPix;
GWorldPtr listGW;

MStringPtr* data;

int selection;
int part;
};
13 changes: 13 additions & 0 deletions software/MFrame/MList/MList.h.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* Resource fork of software/MFrame/MList/MList.h */
data 'MPSR' (1005) {
$"0009 4D6F 6E61 636F 0000 0000 0000 0000" /* ..Monaco........ */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"0000 0002 0004 0048 0129 02DF 03B3 0048" /* .......H.).ß.³.H */
$"0129 02DF 03B3 B5BC 8448 0000 05A6 0000" /* .).ß.³µ¼„H...¦.. */
$"05AC 0000 0000 0100" /* .¬...... */
};

data 'MWBB' (1008) {
$"0001 0001" /* .... */
};

Empty file.
105 changes: 105 additions & 0 deletions software/MFrame/MStandard/MApplication/MAppleEvents.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// __________________________________________________________________________________________
// Program : Meshroom
// Filename : MAppleEvents.cpp
// Author : Mihai Parparita (St. Mary's International School)
// Last modified: April 1, 2000
// Description : implementation of AppleEvent support

#include "MAppleEvents.h"
#include "MApplication.h"

MApplication* MAppleEvents::parentAppPtr = NULL;

void MAppleEvents::Install(MApplication* parent)
{
OSErr err = noErr;
AEEventHandlerUPP openAppUPP, openDocUPP, printDocUPP, quitAppUPP;

parentAppPtr = parent;

openAppUPP = NewAEEventHandlerUPP(OpenApplication);
openDocUPP = NewAEEventHandlerUPP(OpenDocument);
printDocUPP = NewAEEventHandlerUPP(PrintDocument);
quitAppUPP = NewAEEventHandlerUPP(QuitApplication);

err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, openAppUPP, 0L, false);
if (err == noErr)
err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, openDocUPP, 0L, false);
if (err == noErr)
err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, printDocUPP, 0L, false);
if (err == noErr)
err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, quitAppUPP, 0L, false);

if (err != noErr) MThrow(err);
}

OSErr MAppleEvents::GotRequiredParams(const AppleEvent *theAppleEvent)
{
DescType returnedType;
Size actualSize;

if (AEGetAttributePtr(theAppleEvent,
keyMissedKeywordAttr,
typeWildCard,
&returnedType,
nil,
0,
&actualSize) == errAEDescNotFound)
return noErr;
else
return errAEParamMissed;
}

pascal OSErr MAppleEvents::OpenApplication(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon)
{
#pragma unused (reply, refCon)

parentAppPtr->HandleEvent(ehOpenApp);

return GotRequiredParams(theAppleEvent);
}

pascal OSErr MAppleEvents::OpenDocument(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon)
{
OSErr err;
AEDescList fileSpecList;
short i;
long count;
Size actual;
FSSpec desc;
AEKeyword keyword;
DescType type;

reply;
refCon;

err = AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &fileSpecList);

err = AECountItems(&fileSpecList, &count);
for (i = 1; i <= count; i++)
{
err = AEGetNthPtr(&fileSpecList, i, typeFSS, &keyword, &type, (Ptr)&desc, sizeof(FSSpec), &actual);
if (err == noErr)
parentAppPtr->HandleEvent(ehOpen);
}

return GotRequiredParams(theAppleEvent);
}

pascal OSErr MAppleEvents::PrintDocument(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon)
{
#pragma unused (theAppleEvent, reply, refCon)

parentAppPtr->HandleEvent(ehPrint);

return GotRequiredParams(theAppleEvent);
}

pascal OSErr MAppleEvents::QuitApplication(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon)
{
#pragma unused (reply, refCon)

parentAppPtr->HandleEvent(ehQuit);

return GotRequiredParams(theAppleEvent);
}
13 changes: 13 additions & 0 deletions software/MFrame/MStandard/MApplication/MAppleEvents.cpp.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* Resource fork of software/MFrame/MStandard/MApplication/MAppleEvents.cpp */
data 'MPSR' (1005) {
$"0009 4D6F 6E61 636F 0000 0000 0000 0000" /* ..Monaco........ */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"0000 0002 0004 003E 0026 02EB 027C 003E" /* .......>.&.ë.|.> */
$"0026 02EB 027C B6A0 FCFE 0000 02F7 0000" /* .&.ë.|¶ üþ...÷.. */
$"02F7 0000 0000 0100" /* .÷...... */
};

data 'MWBB' (1008) {
$"0001 0001" /* .... */
};

26 changes: 26 additions & 0 deletions software/MFrame/MStandard/MApplication/MAppleEvents.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// __________________________________________________________________________________________
// Program : Meshroom
// Filename : MAppleEvents.h
// Author : Mihai Parparita (St. Mary's International School)
// Last modified: April 1, 2000
// Description : type definitions and constants of AppleEvent support

#pragma once
#include "MException.h"

class MApplication;

class MAppleEvents {
private:
static MApplication* parentAppPtr;

public:

void Install(MApplication* parent);
static OSErr GotRequiredParams(const AppleEvent *theAppleEvent);

static pascal OSErr OpenApplication(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon);
static pascal OSErr OpenDocument(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon);
static pascal OSErr PrintDocument(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon);
static pascal OSErr QuitApplication(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon);
};
13 changes: 13 additions & 0 deletions software/MFrame/MStandard/MApplication/MAppleEvents.h.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* Resource fork of software/MFrame/MStandard/MApplication/MAppleEvents.h */
data 'MPSR' (1005) {
$"0009 4D6F 6E61 636F 0000 0000 0000 0000" /* ..Monaco........ */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"0000 0002 0004 0042 000F 02E9 0261 0042" /* .......B...é.a.B */
$"000F 02E9 0261 B6A1 2867 0000 0234 0000" /* ...é.a¶¡(g...4.. */
$"03CF 0000 0000 0100" /* .Ï...... */
};

data 'MWBB' (1008) {
$"0001 0001" /* .... */
};

Loading

0 comments on commit dbdf37b

Please sign in to comment.