Add Apple /// Business BASIC file support

This commit is contained in:
David Schmidt 2008-12-16 03:35:37 +00:00
parent f94d519657
commit a4524898f9
9 changed files with 6191 additions and 5924 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,298 +1,299 @@
/* /*
* CiderPress * CiderPress
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved. * Copyright (C) 2007, 2008 by faddenSoft, LLC. All Rights Reserved.
* See the file LICENSE for distribution terms. * See the file LICENSE for distribution terms.
*/ */
/* /*
* Keep track of user preferences. * Keep track of user preferences.
* *
* How to add a new preference item: * How to add a new preference item:
* - Add an entry to the PrefNum enum, below. * - Add an entry to the PrefNum enum, below.
* - Add a corresponding entry to Preferences::fPrefMaps, adding a new * - Add a corresponding entry to Preferences::fPrefMaps, adding a new
* section to the registry if appropriate. * section to the registry if appropriate.
* - Add a default value to Preferences::Preferences. If not specified, * - Add a default value to Preferences::Preferences. If not specified,
* strings will be nil and numeric values will be zero. * strings will be nil and numeric values will be zero.
*/ */
#ifndef __PREFERENCES__ #ifndef __PREFERENCES__
#define __PREFERENCES__ #define __PREFERENCES__
#include "MyApp.h" #include "MyApp.h"
class ContentList; class ContentList;
/* /*
* Number of visible columns. (We no longer have "invisible" columns, so the * Number of visible columns. (We no longer have "invisible" columns, so the
* name is somewhat misleading.) * name is somewhat misleading.)
* *
* This is used widely. Update with care. * This is used widely. Update with care.
*/ */
const int kNumVisibleColumns = 9; const int kNumVisibleColumns = 9;
/* /*
* Used to save & restore column layout and sorting preferences for * Used to save & restore column layout and sorting preferences for
* the ContentList class. * the ContentList class.
*/ */
class ColumnLayout { class ColumnLayout {
public: public:
ColumnLayout(void) { ColumnLayout(void) {
for (int i = 0; i < kNumVisibleColumns; i++) for (int i = 0; i < kNumVisibleColumns; i++)
fColumnWidth[i] = kWidthDefaulted; fColumnWidth[i] = kWidthDefaulted;
fSortColumn = kNumVisibleColumns; // means "use original order" fSortColumn = kNumVisibleColumns; // means "use original order"
fAscending = true; fAscending = true;
} }
~ColumnLayout(void) {} ~ColumnLayout(void) {}
void LoadFromRegistry(const char* section); void LoadFromRegistry(const char* section);
void SaveToRegistry(const char* section); void SaveToRegistry(const char* section);
int GetColumnWidth(int col) const { int GetColumnWidth(int col) const {
ASSERT(col >= 0 && col < kNumVisibleColumns); ASSERT(col >= 0 && col < kNumVisibleColumns);
return fColumnWidth[col]; return fColumnWidth[col];
} }
void SetColumnWidth(int col, int width) { void SetColumnWidth(int col, int width) {
ASSERT(col >= 0 && col < kNumVisibleColumns); ASSERT(col >= 0 && col < kNumVisibleColumns);
ASSERT(width >= 0 || width == kWidthDefaulted); ASSERT(width >= 0 || width == kWidthDefaulted);
fColumnWidth[col] = width; fColumnWidth[col] = width;
} }
int GetSortColumn(void) const { return fSortColumn; } int GetSortColumn(void) const { return fSortColumn; }
void SetSortColumn(int col) { void SetSortColumn(int col) {
ASSERT(col >= 0 && col <= kNumVisibleColumns); ASSERT(col >= 0 && col <= kNumVisibleColumns);
fSortColumn = col; fSortColumn = col;
} }
bool GetAscending(void) const { return fAscending; } bool GetAscending(void) const { return fAscending; }
void SetAscending(bool val) { fAscending = val; } void SetAscending(bool val) { fAscending = val; }
/* column width value used to flag "defaulted" status */ /* column width value used to flag "defaulted" status */
enum { kWidthDefaulted = -1 }; enum { kWidthDefaulted = -1 };
/* minimium width of column 0 (pathname) */ /* minimium width of column 0 (pathname) */
enum { kMinCol0Width = 50 }; enum { kMinCol0Width = 50 };
private: private:
// Create a dummy list control to get default column widths. // Create a dummy list control to get default column widths.
void DetermineDefaultWidths(ContentList* pList); void DetermineDefaultWidths(ContentList* pList);
int fColumnWidth[kNumVisibleColumns]; int fColumnWidth[kNumVisibleColumns];
int fSortColumn; int fSortColumn;
bool fAscending; bool fAscending;
}; };
/* /*
* Preferences type enumeration. * Preferences type enumeration.
* *
* This is logically part of the Preferences object, but it's annoying to * This is logically part of the Preferences object, but it's annoying to
* have to specify the scope resolution operator everywhere. * have to specify the scope resolution operator everywhere.
*/ */
typedef enum { typedef enum {
/**/ kPrefNumUnknown = 0, /**/ kPrefNumUnknown = 0,
/* these are saved in the registry */ /* these are saved in the registry */
// sticky settings for add file options // sticky settings for add file options
kPrAddIncludeSubFolders, // bool kPrAddIncludeSubFolders, // bool
kPrAddStripFolderNames, // bool kPrAddStripFolderNames, // bool
kPrAddOverwriteExisting, // bool kPrAddOverwriteExisting, // bool
kPrAddTypePreservation, // long kPrAddTypePreservation, // long
kPrAddConvEOL, // long kPrAddConvEOL, // long
// sticky settings for file extraction // sticky settings for file extraction
//kPrExtractPath, // string //kPrExtractPath, // string
kPrExtractConvEOL, // long kPrExtractConvEOL, // long
kPrExtractConvHighASCII, // bool kPrExtractConvHighASCII, // bool
kPrExtractIncludeData, // bool kPrExtractIncludeData, // bool
kPrExtractIncludeRsrc, // bool kPrExtractIncludeRsrc, // bool
kPrExtractIncludeDisk, // bool kPrExtractIncludeDisk, // bool
kPrExtractEnableReformat, // bool kPrExtractEnableReformat, // bool
kPrExtractDiskTo2MG, // bool kPrExtractDiskTo2MG, // bool
kPrExtractAddTypePreservation, // bool kPrExtractAddTypePreservation, // bool
kPrExtractAddExtension, // bool kPrExtractAddExtension, // bool
kPrExtractStripFolderNames, // bool kPrExtractStripFolderNames, // bool
kPrExtractOverwriteExisting, // bool kPrExtractOverwriteExisting, // bool
// // view file options // // view file options
// kPrViewIncludeDataForks, // bool // kPrViewIncludeDataForks, // bool
// kPrViewIncludeRsrcForks, // bool // kPrViewIncludeRsrcForks, // bool
// kPrViewIncludeDiskImages, // bool // kPrViewIncludeDiskImages, // bool
// kPrViewIncludeComments, // bool // kPrViewIncludeComments, // bool
// convert disk image to file archive // convert disk image to file archive
//kPrConvFileConvDOSText, // bool //kPrConvFileConvDOSText, // bool
//kPrConvFileConvPascalText, // bool //kPrConvFileConvPascalText, // bool
kPrConvFileEmptyFolders, // bool kPrConvFileEmptyFolders, // bool
// folders for CFileDialog initialization // folders for CFileDialog initialization
kPrOpenArchiveFolder, // string kPrOpenArchiveFolder, // string
kPrConvertArchiveFolder, // string kPrConvertArchiveFolder, // string
kPrAddFileFolder, // string kPrAddFileFolder, // string
kPrExtractFileFolder, // string kPrExtractFileFolder, // string
// logical/physical volume prefs // logical/physical volume prefs
kPrVolumeFilter, // long kPrVolumeFilter, // long
//kPrVolumeReadOnly, // bool //kPrVolumeReadOnly, // bool
// cassette import/export prefs // cassette import/export prefs
kPrCassetteAlgorithm, // long kPrCassetteAlgorithm, // long
kPrOpenWAVFolder, // string kPrOpenWAVFolder, // string
// items from the Preferences propertypages (must be saved/restored) // items from the Preferences propertypages (must be saved/restored)
kPrMimicShrinkIt, // bool kPrMimicShrinkIt, // bool
kPrBadMacSHK, // bool kPrBadMacSHK, // bool
kPrReduceSHKErrorChecks, // bool kPrReduceSHKErrorChecks, // bool
kPrCoerceDOSFilenames, // bool kPrCoerceDOSFilenames, // bool
kPrSpacesToUnder, // bool kPrSpacesToUnder, // bool
kPrPasteJunkPaths, // bool kPrPasteJunkPaths, // bool
kPrBeepOnSuccess, // bool kPrBeepOnSuccess, // bool
kPrQueryImageFormat, // bool kPrQueryImageFormat, // bool
kPrOpenVolumeRO, // bool kPrOpenVolumeRO, // bool
kPrOpenVolumePhys0, // bool kPrOpenVolumePhys0, // bool
kPrProDOSAllowLower, // bool kPrProDOSAllowLower, // bool
kPrProDOSUseSparse, // bool kPrProDOSUseSparse, // bool
kPrCompressionType, // long kPrCompressionType, // long
kPrMaxViewFileSize, // long kPrMaxViewFileSize, // long
kPrNoWrapText, // bool kPrNoWrapText, // bool
kPrHighlightHexDump, // bool kPrHighlightHexDump, // bool
kPrHighlightBASIC, // bool kPrHighlightBASIC, // bool
kPrConvHiResBlackWhite, // bool kPrConvHiResBlackWhite, // bool
kPrConvDHRAlgorithm, // long kPrConvDHRAlgorithm, // long
kPrRelaxGfxTypeCheck, // bool kPrRelaxGfxTypeCheck, // bool
kPrDisasmOneByteBrkCop, // bool kPrDisasmOneByteBrkCop, // bool
//kPrEOLConvRaw, // bool //kPrEOLConvRaw, // bool
kPrConvTextEOL_HA, // bool kPrConvTextEOL_HA, // bool
kPrConvPascalText, // bool kPrConvPascalText, // bool
kPrConvPascalCode, // bool kPrConvPascalCode, // bool
kPrConvCPMText, // bool kPrConvCPMText, // bool
kPrConvApplesoft, // bool kPrConvApplesoft, // bool
kPrConvInteger, // bool kPrConvInteger, // bool
kPrConvGWP, // bool kPrConvBusiness, // bool
kPrConvText8, // bool kPrConvGWP, // bool
kPrConvAWP, // bool kPrConvText8, // bool
kPrConvADB, // bool kPrConvAWP, // bool
kPrConvASP, // bool kPrConvADB, // bool
kPrConvSCAssem, // bool kPrConvASP, // bool
kPrConvDisasm, // bool kPrConvSCAssem, // bool
kPrConvHiRes, // bool kPrConvDisasm, // bool
kPrConvDHR, // bool kPrConvHiRes, // bool
kPrConvSHR, // bool kPrConvDHR, // bool
kPrConvPrintShop, // bool kPrConvSHR, // bool
kPrConvMacPaint, // bool kPrConvPrintShop, // bool
kPrConvProDOSFolder, // bool kPrConvMacPaint, // bool
kPrConvResources, // bool kPrConvProDOSFolder, // bool
kPrConvResources, // bool
kPrTempPath, // string
kPrExtViewerExts, // string kPrTempPath, // string
kPrExtViewerExts, // string
// open file dialog
kPrLastOpenFilterIndex, // long // open file dialog
kPrLastOpenFilterIndex, // long
/**/ kPrefNumLastRegistry,
/* these are temporary settings, not saved in the registry */ /**/ kPrefNumLastRegistry,
/* these are temporary settings, not saved in the registry */
// sticky settings for internal file viewer (ViewFilesDialog)
kPrViewTextTypeFace, // string // sticky settings for internal file viewer (ViewFilesDialog)
kPrViewTextPointSize, // long kPrViewTextTypeFace, // string
kPrFileViewerWidth, // long kPrViewTextPointSize, // long
kPrFileViewerHeight, // long kPrFileViewerWidth, // long
kPrFileViewerHeight, // long
// sticky setting for disk image creator
kPrDiskImageCreateFormat, // long // sticky setting for disk image creator
kPrDiskImageCreateFormat, // long
/**/ kPrefNumLastEntry
} PrefNum; /**/ kPrefNumLastEntry
} PrefNum;
/*
* Container for preferences. /*
*/ * Container for preferences.
class Preferences { */
public: class Preferences {
Preferences(void); public:
~Preferences(void) { Preferences(void);
FreeStringValues(); ~Preferences(void) {
} FreeStringValues();
}
// Load/save preferences from/to registry.
int LoadFromRegistry(void); // Load/save preferences from/to registry.
int SaveToRegistry(void); int LoadFromRegistry(void);
int SaveToRegistry(void);
ColumnLayout* GetColumnLayout(void) { return &fColumnLayout; }
//bool GetShowToolbarText(void) const { return fShowToolbarText; } ColumnLayout* GetColumnLayout(void) { return &fColumnLayout; }
//void SetShowToolbarText(bool val) { fShowToolbarText = val; } //bool GetShowToolbarText(void) const { return fShowToolbarText; }
//void SetShowToolbarText(bool val) { fShowToolbarText = val; }
bool GetPrefBool(PrefNum num) const;
void SetPrefBool(PrefNum num, bool val); bool GetPrefBool(PrefNum num) const;
long GetPrefLong(PrefNum num) const; void SetPrefBool(PrefNum num, bool val);
void SetPrefLong(PrefNum num, long val); long GetPrefLong(PrefNum num) const;
const char* GetPrefString(PrefNum num) const; void SetPrefLong(PrefNum num, long val);
void SetPrefString(PrefNum num, const char* str); const char* GetPrefString(PrefNum num) const;
void SetPrefString(PrefNum num, const char* str);
private:
void InitTempPath(void); private:
void InitFolders(void); void InitTempPath(void);
bool GetMyDocuments(CString* pPath); void InitFolders(void);
int DefaultCompressionType(void); bool GetMyDocuments(CString* pPath);
void FreeStringValues(void); int DefaultCompressionType(void);
void FreeStringValues(void);
/*
* Internal data structure used to manage preferences. /*
*/ * Internal data structure used to manage preferences.
typedef enum { kPTNone, kBool, kLong, kString } PrefType; */
typedef struct PrefMap { typedef enum { kPTNone, kBool, kLong, kString } PrefType;
PrefNum num; typedef struct PrefMap {
PrefType type; PrefNum num;
const char* registrySection; PrefType type;
const char* registryKey; const char* registrySection;
} PrefMap; const char* registryKey;
static const PrefMap fPrefMaps[kPrefNumLastEntry]; } PrefMap;
void ScanPrefMaps(void); static const PrefMap fPrefMaps[kPrefNumLastEntry];
void ScanPrefMaps(void);
// this holds the actual values
void* fValues[kPrefNumLastEntry]; // this holds the actual values
void* fValues[kPrefNumLastEntry];
// verify that the entry exists and has the expected type
bool ValidateEntry(PrefNum num, PrefType type) const { // verify that the entry exists and has the expected type
if (num <= kPrefNumUnknown || num >= kPrefNumLastEntry) { bool ValidateEntry(PrefNum num, PrefType type) const {
ASSERT(false); if (num <= kPrefNumUnknown || num >= kPrefNumLastEntry) {
return false; ASSERT(false);
} return false;
if (fPrefMaps[num].type != type) { }
ASSERT(false); if (fPrefMaps[num].type != type) {
return false; ASSERT(false);
} return false;
return true; }
} return true;
}
// column widths for ContentList
ColumnLayout fColumnLayout; // column widths for ContentList
ColumnLayout fColumnLayout;
/*
* Registry helpers. /*
*/ * Registry helpers.
UINT GetInt(const char* section, const char* key, int dflt) { */
return gMyApp.GetProfileInt(section, key, dflt); UINT GetInt(const char* section, const char* key, int dflt) {
} return gMyApp.GetProfileInt(section, key, dflt);
bool GetBool(const char* section, const char* key, bool dflt) { }
return (gMyApp.GetProfileInt(section, key, dflt) != 0); bool GetBool(const char* section, const char* key, bool dflt) {
} return (gMyApp.GetProfileInt(section, key, dflt) != 0);
CString GetString(const char* section, const char* key, }
const char* dflt) CString GetString(const char* section, const char* key,
{ const char* dflt)
return gMyApp.GetProfileString(section, key, dflt); {
} return gMyApp.GetProfileString(section, key, dflt);
BOOL WriteInt(const char* section, const char* key, int value) { }
return gMyApp.WriteProfileInt(section, key, value); BOOL WriteInt(const char* section, const char* key, int value) {
} return gMyApp.WriteProfileInt(section, key, value);
BOOL WriteBool(const char* section, const char* key, bool value) { }
return gMyApp.WriteProfileInt(section, key, value); BOOL WriteBool(const char* section, const char* key, bool value) {
} return gMyApp.WriteProfileInt(section, key, value);
BOOL WriteString(const char* section, const char* key, const char* value) { }
return gMyApp.WriteProfileString(section, key, value); BOOL WriteString(const char* section, const char* key, const char* value) {
} return gMyApp.WriteProfileString(section, key, value);
}; }
};
#endif /*__PREFERENCES__*/ #endif /*__PREFERENCES__*/

View File

@ -1,241 +1,242 @@
/* /*
* CiderPress * CiderPress
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved. * Copyright (C) 2007, 2008 by faddenSoft, LLC. All Rights Reserved.
* See the file LICENSE for distribution terms. * See the file LICENSE for distribution terms.
*/ */
/* /*
* Classes to support the Preferences property pages. * Classes to support the Preferences property pages.
*/ */
#ifndef __PREFSDIALOG__ #ifndef __PREFSDIALOG__
#define __PREFSDIALOG__ #define __PREFSDIALOG__
#include "Preferences.h" #include "Preferences.h"
#include "../util/UtilLib.h" #include "../util/UtilLib.h"
#include "resource.h" #include "resource.h"
/* /*
* The "general" page, which controls how we display information to the user. * The "general" page, which controls how we display information to the user.
*/ */
class PrefsGeneralPage : public CPropertyPage class PrefsGeneralPage : public CPropertyPage
{ {
public: public:
PrefsGeneralPage(void) : PrefsGeneralPage(void) :
CPropertyPage(IDD_PREF_GENERAL), CPropertyPage(IDD_PREF_GENERAL),
fReady(false), fReady(false),
fMimicShrinkIt(FALSE), fMimicShrinkIt(FALSE),
fBadMacSHK(FALSE), fBadMacSHK(FALSE),
fReduceSHKErrorChecks(FALSE), fReduceSHKErrorChecks(FALSE),
fCoerceDOSFilenames(FALSE), fCoerceDOSFilenames(FALSE),
fSpacesToUnder(FALSE), fSpacesToUnder(FALSE),
fDefaultsPushed(FALSE), fDefaultsPushed(FALSE),
fOurAssociations(nil) fOurAssociations(nil)
{} {}
virtual ~PrefsGeneralPage(void) { virtual ~PrefsGeneralPage(void) {
delete[] fOurAssociations; delete[] fOurAssociations;
} }
bool fReady; bool fReady;
// fields on this page // fields on this page
BOOL fColumn[kNumVisibleColumns]; BOOL fColumn[kNumVisibleColumns];
BOOL fMimicShrinkIt; BOOL fMimicShrinkIt;
BOOL fBadMacSHK; BOOL fBadMacSHK;
BOOL fReduceSHKErrorChecks; BOOL fReduceSHKErrorChecks;
BOOL fCoerceDOSFilenames; BOOL fCoerceDOSFilenames;
BOOL fSpacesToUnder; BOOL fSpacesToUnder;
BOOL fPasteJunkPaths; BOOL fPasteJunkPaths;
BOOL fBeepOnSuccess; BOOL fBeepOnSuccess;
BOOL fDefaultsPushed; BOOL fDefaultsPushed;
// initialized if we opened the file associations edit page // initialized if we opened the file associations edit page
bool* fOurAssociations; bool* fOurAssociations;
protected: protected:
virtual void DoDataExchange(CDataExchange* pDX); virtual void DoDataExchange(CDataExchange* pDX);
afx_msg void OnChange(void); afx_msg void OnChange(void);
afx_msg void OnChangeRange(UINT); afx_msg void OnChangeRange(UINT);
afx_msg void OnDefaults(void); afx_msg void OnDefaults(void);
afx_msg void OnAssociations(void); afx_msg void OnAssociations(void);
afx_msg LONG OnHelp(UINT wParam, LONG lParam); afx_msg LONG OnHelp(UINT wParam, LONG lParam);
afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam); afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam);
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };
/* /*
* The "disk image" page, for selecting disk image preferences. * The "disk image" page, for selecting disk image preferences.
*/ */
class PrefsDiskImagePage : public CPropertyPage class PrefsDiskImagePage : public CPropertyPage
{ {
public: public:
PrefsDiskImagePage(void) : PrefsDiskImagePage(void) :
CPropertyPage(IDD_PREF_DISKIMAGE), CPropertyPage(IDD_PREF_DISKIMAGE),
fReady(false), fReady(false),
fQueryImageFormat(FALSE), fQueryImageFormat(FALSE),
fOpenVolumeRO(FALSE), fOpenVolumeRO(FALSE),
fProDOSAllowLower(FALSE), fProDOSAllowLower(FALSE),
fProDOSUseSparse(FALSE) fProDOSUseSparse(FALSE)
{} {}
bool fReady; bool fReady;
BOOL fQueryImageFormat; BOOL fQueryImageFormat;
BOOL fOpenVolumeRO; BOOL fOpenVolumeRO;
BOOL fOpenVolumePhys0; BOOL fOpenVolumePhys0;
BOOL fProDOSAllowLower; BOOL fProDOSAllowLower;
BOOL fProDOSUseSparse; BOOL fProDOSUseSparse;
protected: protected:
virtual BOOL OnInitDialog(void); virtual BOOL OnInitDialog(void);
virtual void DoDataExchange(CDataExchange* pDX); virtual void DoDataExchange(CDataExchange* pDX);
afx_msg void OnChange(void); afx_msg void OnChange(void);
//afx_msg void OnChangeRange(UINT); //afx_msg void OnChangeRange(UINT);
afx_msg LONG OnHelp(UINT wParam, LONG lParam); afx_msg LONG OnHelp(UINT wParam, LONG lParam);
afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam); afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam);
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };
/* /*
* The "compression" page, which lets the user choose a default compression * The "compression" page, which lets the user choose a default compression
* method. * method.
*/ */
class PrefsCompressionPage : public CPropertyPage class PrefsCompressionPage : public CPropertyPage
{ {
public: public:
PrefsCompressionPage(void) : PrefsCompressionPage(void) :
CPropertyPage(IDD_PREF_COMPRESSION), fReady(false) CPropertyPage(IDD_PREF_COMPRESSION), fReady(false)
{} {}
bool fReady; bool fReady;
int fCompressType; // radio button index int fCompressType; // radio button index
protected: protected:
virtual BOOL OnInitDialog(void); virtual BOOL OnInitDialog(void);
virtual void DoDataExchange(CDataExchange* pDX); virtual void DoDataExchange(CDataExchange* pDX);
afx_msg void OnChangeRange(UINT); afx_msg void OnChangeRange(UINT);
afx_msg LONG OnHelp(UINT wParam, LONG lParam); afx_msg LONG OnHelp(UINT wParam, LONG lParam);
afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam); afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam);
private: private:
void DisableWnd(int id); void DisableWnd(int id);
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };
/* /*
* The "fview" page, for selecting preferences for the internal file viewer. * The "fview" page, for selecting preferences for the internal file viewer.
*/ */
class PrefsFviewPage : public CPropertyPage class PrefsFviewPage : public CPropertyPage
{ {
public: public:
PrefsFviewPage(void) : PrefsFviewPage(void) :
CPropertyPage(IDD_PREF_FVIEW), fReady(false) CPropertyPage(IDD_PREF_FVIEW), fReady(false)
{} {}
bool fReady; bool fReady;
BOOL fEOLConvRaw; BOOL fEOLConvRaw;
BOOL fNoWrapText; BOOL fNoWrapText;
BOOL fHighlightHexDump; BOOL fHighlightHexDump;
BOOL fHighlightBASIC; BOOL fHighlightBASIC;
BOOL fConvDisasmOneByteBrkCop; BOOL fConvDisasmOneByteBrkCop;
BOOL fConvHiResBlackWhite; BOOL fConvHiResBlackWhite;
int fConvDHRAlgorithm; // drop list int fConvDHRAlgorithm; // drop list
BOOL fConvTextEOL_HA; BOOL fConvTextEOL_HA;
BOOL fConvCPMText; BOOL fConvCPMText;
BOOL fConvPascalText; BOOL fConvPascalText;
BOOL fConvPascalCode; BOOL fConvPascalCode;
BOOL fConvApplesoft; BOOL fConvApplesoft;
BOOL fConvInteger; BOOL fConvInteger;
BOOL fConvGWP; BOOL fConvBusiness;
BOOL fConvText8; BOOL fConvGWP;
BOOL fConvAWP; BOOL fConvText8;
BOOL fConvADB; BOOL fConvAWP;
BOOL fConvASP; BOOL fConvADB;
BOOL fConvSCAssem; BOOL fConvASP;
BOOL fConvDisasm; BOOL fConvSCAssem;
BOOL fConvDisasm;
BOOL fConvHiRes;
BOOL fConvDHR; BOOL fConvHiRes;
BOOL fConvSHR; BOOL fConvDHR;
BOOL fConvPrintShop; BOOL fConvSHR;
BOOL fConvMacPaint; BOOL fConvPrintShop;
BOOL fConvProDOSFolder; BOOL fConvMacPaint;
BOOL fConvResources; BOOL fConvProDOSFolder;
BOOL fRelaxGfxTypeCheck; BOOL fConvResources;
BOOL fRelaxGfxTypeCheck;
UINT fMaxViewFileSizeKB;
UINT fMaxViewFileSizeKB;
protected:
virtual BOOL OnInitDialog(void); protected:
virtual void DoDataExchange(CDataExchange* pDX); virtual BOOL OnInitDialog(void);
virtual void DoDataExchange(CDataExchange* pDX);
afx_msg void OnChange(void);
afx_msg void OnChangeRange(UINT); afx_msg void OnChange(void);
afx_msg LONG OnHelp(UINT wParam, LONG lParam); afx_msg void OnChangeRange(UINT);
afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam); afx_msg LONG OnHelp(UINT wParam, LONG lParam);
afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam);
DECLARE_MESSAGE_MAP()
}; DECLARE_MESSAGE_MAP()
};
/*
* The "compression" page, which lets the user choose a default compression /*
* method for NuFX archives. * The "compression" page, which lets the user choose a default compression
*/ * method for NuFX archives.
class PrefsFilesPage : public CPropertyPage */
{ class PrefsFilesPage : public CPropertyPage
public: {
PrefsFilesPage(void) : public:
CPropertyPage(IDD_PREF_FILES), fReady(false) PrefsFilesPage(void) :
{} CPropertyPage(IDD_PREF_FILES), fReady(false)
{}
bool fReady;
bool fReady;
CString fTempPath;
CString fExtViewerExts; CString fTempPath;
CString fExtViewerExts;
protected:
virtual BOOL OnInitDialog(void); protected:
virtual void DoDataExchange(CDataExchange* pDX); virtual BOOL OnInitDialog(void);
virtual void DoDataExchange(CDataExchange* pDX);
afx_msg void OnChange(void);
afx_msg void OnChooseFolder(void); afx_msg void OnChange(void);
afx_msg LONG OnHelp(UINT wParam, LONG lParam); afx_msg void OnChooseFolder(void);
afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam); afx_msg LONG OnHelp(UINT wParam, LONG lParam);
afx_msg LONG OnCommandHelp(UINT wParam, LONG lParam);
MyBitmapButton fChooseFolderButton;
MyBitmapButton fChooseFolderButton;
DECLARE_MESSAGE_MAP()
}; DECLARE_MESSAGE_MAP()
};
/*
* Property sheet that wraps around the preferences pages. /*
*/ * Property sheet that wraps around the preferences pages.
class PrefsSheet : public CPropertySheet */
{ class PrefsSheet : public CPropertySheet
public: {
PrefsSheet(CWnd* pParentWnd = NULL); public:
PrefsSheet(CWnd* pParentWnd = NULL);
PrefsGeneralPage fGeneralPage;
PrefsDiskImagePage fDiskImagePage; PrefsGeneralPage fGeneralPage;
PrefsCompressionPage fCompressionPage; PrefsDiskImagePage fDiskImagePage;
PrefsFviewPage fFviewPage; PrefsCompressionPage fCompressionPage;
PrefsFilesPage fFilesPage; PrefsFviewPage fFviewPage;
PrefsFilesPage fFilesPage;
protected:
BOOL OnNcCreate(LPCREATESTRUCT cs); protected:
BOOL OnNcCreate(LPCREATESTRUCT cs);
afx_msg void OnApplyNow();
LONG OnHelp(UINT wParam, LONG lParam); afx_msg void OnApplyNow();
void OnIDHelp(void); LONG OnHelp(UINT wParam, LONG lParam);
void OnIDHelp(void);
DECLARE_MESSAGE_MAP()
}; DECLARE_MESSAGE_MAP()
};
#endif /*__PREFSDIALOG__*/ #endif /*__PREFSDIALOG__*/

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +1,64 @@
/* /*
* CiderPress * CiderPress
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved. * Copyright (C) 2007, 2008 by faddenSoft, LLC. All Rights Reserved.
* See the file LICENSE for distribution terms. * See the file LICENSE for distribution terms.
*/ */
/* /*
* Reformat BASIC programs. * Reformat BASIC programs.
*/ */
#ifndef __LR_BASIC__ #ifndef __LR_BASIC__
#define __LR_BASIC__ #define __LR_BASIC__
#include "ReformatBase.h" #include "ReformatBase.h"
/* /*
* Reformat an Applesoft BASIC program into readable text. * Reformat an Applesoft BASIC program into readable text.
*/ */
class ReformatApplesoft : public ReformatText { class ReformatApplesoft : public ReformatText {
public: public:
ReformatApplesoft(void) {} ReformatApplesoft(void) {}
virtual ~ReformatApplesoft(void) {} virtual ~ReformatApplesoft(void) {}
virtual void Examine(ReformatHolder* pHolder); virtual void Examine(ReformatHolder* pHolder);
virtual int Process(const ReformatHolder* pHolder, virtual int Process(const ReformatHolder* pHolder,
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part, ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
ReformatOutput* pOutput); ReformatOutput* pOutput);
/* share our token list with others */ /* share our token list with others */
enum { kTokenLen = 8, kTokenCount = 107 }; enum { kTokenLen = 8, kTokenCount = 107 };
static const char* GetApplesoftTokens(void); static const char* GetApplesoftTokens(void);
}; };
/* /*
* Reformat an Integer BASIC program into readable text. * Reformat an Integer BASIC program into readable text.
*/ */
class ReformatInteger : public ReformatText { class ReformatInteger : public ReformatText {
public: public:
ReformatInteger(void) {} ReformatInteger(void) {}
virtual ~ReformatInteger(void) {} virtual ~ReformatInteger(void) {}
virtual void Examine(ReformatHolder* pHolder); virtual void Examine(ReformatHolder* pHolder);
virtual int Process(const ReformatHolder* pHolder, virtual int Process(const ReformatHolder* pHolder,
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part, ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
ReformatOutput* pOutput); ReformatOutput* pOutput);
}; };
/*
* Reformat an Apple /// Business BASIC program into readable text.
*/
class ReformatBusiness : public ReformatText {
public:
ReformatBusiness(void) {}
virtual ~ReformatBusiness(void) {}
virtual void Examine(ReformatHolder* pHolder);
virtual int Process(const ReformatHolder* pHolder,
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
ReformatOutput* pOutput);
/* share our token list with others - but this won't really work in its current form... */
enum { kTokenLen = 10, kTokenCount = 107 };
static const char* GetBusinessTokens(void);
};
#endif /*__LR_BASIC__*/ #endif /*__LR_BASIC__*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,387 +1,388 @@
/* /*
* CiderPress * CiderPress
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved. * Copyright (C) 2007, 2008 by faddenSoft, LLC. All Rights Reserved.
* See the file LICENSE for distribution terms. * See the file LICENSE for distribution terms.
*/ */
/* /*
* Reformatter base classes. The main app does not need this header file. * Reformatter base classes. The main app does not need this header file.
* *
* Every converter turns the source into text or graphics. Currently it's * Every converter turns the source into text or graphics. Currently it's
* not possible to convert something into a mix of both. We could change * not possible to convert something into a mix of both. We could change
* that, but we'd have to figure out what that means when extracting a file * that, but we'd have to figure out what that means when extracting a file
* (i.e. figure out the RTF embedded bitmap format). * (i.e. figure out the RTF embedded bitmap format).
*/ */
#ifndef __LR_REFORMAT_BASE__ #ifndef __LR_REFORMAT_BASE__
#define __LR_REFORMAT_BASE__ #define __LR_REFORMAT_BASE__
#include "Reformat.h" #include "Reformat.h"
#define BufPrintf fExpBuf.Printf #define BufPrintf fExpBuf.Printf
/* /*
* Abstract base class for reformatting a file into readable text. * Abstract base class for reformatting a file into readable text.
* *
* The transmuted version is written on top of the original, or is allocated * The transmuted version is written on top of the original, or is allocated
* in new[]ed storage and replaces the original (which is delete[]d). * in new[]ed storage and replaces the original (which is delete[]d).
*/ */
class Reformat { class Reformat {
public: public:
Reformat(void) {} Reformat(void) {}
virtual ~Reformat(void) {} virtual ~Reformat(void) {}
enum { enum {
kTypePCD = 0x02, kTypePCD = 0x02,
kTypePTX = 0x03, kTypePTX = 0x03,
kTypeTXT = 0x04, kTypeTXT = 0x04,
kTypeBIN = 0x06, kTypeBIN = 0x06,
kTypeFOT = 0x08, kTypeFOT = 0x08,
kTypeDIR = 0x0f, kTypeBA3 = 0x09,
kTypeADB = 0x19, kTypeDIR = 0x0f,
kTypeAWP = 0x1a, kTypeADB = 0x19,
kTypeASP = 0x1b, kTypeAWP = 0x1a,
kType8OB = 0x2b, kTypeASP = 0x1b,
kTypeP8C = 0x2e, kType8OB = 0x2b,
kTypeGWP = 0x50, kTypeP8C = 0x2e,
kTypeOBJ = 0xb1, kTypeGWP = 0x50,
kTypeLIB = 0xb2, kTypeOBJ = 0xb1,
kTypeFST = 0xbd, kTypeLIB = 0xb2,
kTypePNT = 0xc0, kTypeFST = 0xbd,
kTypePIC = 0xc1, kTypePNT = 0xc0,
kTypeCMD = 0xf0, kTypePIC = 0xc1,
kTypeDOS_B = 0xf4, // alternate 'B' kTypeCMD = 0xf0,
kTypeOS = 0xf9, kTypeDOS_B = 0xf4, // alternate 'B'
kTypeINT = 0xfa, kTypeOS = 0xf9,
kTypeBAS = 0xfc, kTypeINT = 0xfa,
kTypeSYS = 0xff, kTypeBAS = 0xfc,
}; kTypeSYS = 0xff,
};
/* test applicability of all file parts */
virtual void Examine(ReformatHolder* pHolder) = 0; /* test applicability of all file parts */
virtual void Examine(ReformatHolder* pHolder) = 0;
/* reformat appropriately; returns 0 on success, -1 on error */
virtual int Process(const ReformatHolder* pHolder, /* reformat appropriately; returns 0 on success, -1 on error */
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part, virtual int Process(const ReformatHolder* pHolder,
ReformatOutput* pOutput) = 0; ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
ReformatOutput* pOutput) = 0;
// grab the next 8 bits
static inline unsigned char Read8(const unsigned char** pBuf, long* pLength) { // grab the next 8 bits
if (*pLength > 0) { static inline unsigned char Read8(const unsigned char** pBuf, long* pLength) {
(*pLength)--; if (*pLength > 0) {
return *(*pBuf)++; (*pLength)--;
} else { return *(*pBuf)++;
// ought to throw an exception here } else {
ASSERT(false); // ought to throw an exception here
return (unsigned char) -1; ASSERT(false);
} return (unsigned char) -1;
} }
// grab a 16-bit little-endian value }
static inline unsigned short Read16(const unsigned char** pBuf, long* pLength) { // grab a 16-bit little-endian value
unsigned short val; static inline unsigned short Read16(const unsigned char** pBuf, long* pLength) {
if (*pLength >= 2) { unsigned short val;
val = *(*pBuf)++; if (*pLength >= 2) {
val |= *(*pBuf)++ << 8; val = *(*pBuf)++;
*pLength -= 2; val |= *(*pBuf)++ << 8;
} else { *pLength -= 2;
// ought to throw an exception here } else {
ASSERT(false); // ought to throw an exception here
val = (unsigned short) -1; ASSERT(false);
} val = (unsigned short) -1;
return val; }
} return val;
// grab a 16-bit little-endian value }
static inline unsigned long Read32(const unsigned char** pBuf, long* pLength) { // grab a 16-bit little-endian value
unsigned long val; static inline unsigned long Read32(const unsigned char** pBuf, long* pLength) {
if (*pLength >= 4) { unsigned long val;
val = *(*pBuf)++; if (*pLength >= 4) {
val |= *(*pBuf)++ << 8; val = *(*pBuf)++;
val |= *(*pBuf)++ << 16; val |= *(*pBuf)++ << 8;
val |= *(*pBuf)++ << 24; val |= *(*pBuf)++ << 16;
*pLength -= 4; val |= *(*pBuf)++ << 24;
} else { *pLength -= 4;
// ought to throw an exception here } else {
ASSERT(false); // ought to throw an exception here
val = (unsigned long) -1; ASSERT(false);
} val = (unsigned long) -1;
return val; }
} return val;
}
static inline unsigned short Get16LE(const unsigned char* buf) {
return *buf | *(buf+1) << 8; static inline unsigned short Get16LE(const unsigned char* buf) {
} return *buf | *(buf+1) << 8;
static inline unsigned long Get32LE(const unsigned char* buf) { }
return *buf | *(buf+1) << 8 | *(buf+2) << 16 | *(buf+3) << 24; static inline unsigned long Get32LE(const unsigned char* buf) {
} return *buf | *(buf+1) << 8 | *(buf+2) << 16 | *(buf+3) << 24;
static inline unsigned short Get16BE(const unsigned char* buf) { }
return *buf << 8 | *(buf+1); static inline unsigned short Get16BE(const unsigned char* buf) {
} return *buf << 8 | *(buf+1);
static inline unsigned long Get32BE(const unsigned char* buf) { }
return *buf << 24 | *(buf+1) << 16 | *(buf+2) << 8 | *(buf+3); static inline unsigned long Get32BE(const unsigned char* buf) {
} return *buf << 24 | *(buf+1) << 16 | *(buf+2) << 8 | *(buf+3);
static inline unsigned short Get16(const unsigned char* buf, bool littleEndian) { }
if (littleEndian) static inline unsigned short Get16(const unsigned char* buf, bool littleEndian) {
return Get16LE(buf); if (littleEndian)
else return Get16LE(buf);
return Get16BE(buf); else
} return Get16BE(buf);
static inline unsigned long Get32(const unsigned char* buf, bool littleEndian) { }
if (littleEndian) static inline unsigned long Get32(const unsigned char* buf, bool littleEndian) {
return Get32LE(buf); if (littleEndian)
else return Get32LE(buf);
return Get32BE(buf); else
} return Get32BE(buf);
}; }
};
/*
* Abstract base class for reformatting a graphics file into a /*
* device-independent bitmap.. * Abstract base class for reformatting a graphics file into a
*/ * device-independent bitmap..
class ReformatGraphics: public Reformat { */
public: class ReformatGraphics: public Reformat {
ReformatGraphics() { public:
InitPalette(); ReformatGraphics() {
} InitPalette();
}
protected:
void SetResultBuffer(ReformatOutput* pOutput, MyDIBitmap* pDib); protected:
void SetResultBuffer(ReformatOutput* pOutput, MyDIBitmap* pDib);
/*
* Color palette to use for color conversions. We store it here /*
* so it can be configured to suit the user's tastes. * Color palette to use for color conversions. We store it here
*/ * so it can be configured to suit the user's tastes.
enum { kPaletteBlack, kPaletteRed, kPaletteDarkBlue, */
kPalettePurple, kPaletteDarkGreen, kPaletteDarkGrey, enum { kPaletteBlack, kPaletteRed, kPaletteDarkBlue,
kPaletteMediumBlue, kPaletteLightBlue, kPaletteBrown, kPalettePurple, kPaletteDarkGreen, kPaletteDarkGrey,
kPaletteOrange, kPaletteLightGrey, kPalettePink, kPaletteMediumBlue, kPaletteLightBlue, kPaletteBrown,
kPaletteGreen, kPaletteYellow, kPaletteAqua, kPaletteOrange, kPaletteLightGrey, kPalettePink,
kPaletteWhite, kPaletteSize }; kPaletteGreen, kPaletteYellow, kPaletteAqua,
RGBQUAD fPalette[kPaletteSize]; kPaletteWhite, kPaletteSize };
RGBQUAD fPalette[kPaletteSize];
int UnpackBytes(unsigned char* dst, const unsigned char* src,
long dstRem, long srcLen); int UnpackBytes(unsigned char* dst, const unsigned char* src,
void UnPackBits(const unsigned char** pSrcBuf, long* pSrcLen, long dstRem, long srcLen);
unsigned char** pOutPtr, long dstLen, unsigned char xorVal); void UnPackBits(const unsigned char** pSrcBuf, long* pSrcLen,
unsigned char** pOutPtr, long dstLen, unsigned char xorVal);
private:
void InitPalette(); private:
}; void InitPalette();
};
/*
* Abstract base class for reformatting a file into readable text. /*
* * Abstract base class for reformatting a file into readable text.
* Includes an expanding buffer that can be appended to, and a set of RTF *
* primitives for adding structure. * Includes an expanding buffer that can be appended to, and a set of RTF
*/ * primitives for adding structure.
class ReformatText : public Reformat { */
public: class ReformatText : public Reformat {
typedef enum ParagraphJustify { public:
kJustifyLeft, typedef enum ParagraphJustify {
kJustifyRight, kJustifyLeft,
kJustifyCenter, kJustifyRight,
kJustifyFull, kJustifyCenter,
} ParagraphJustify; kJustifyFull,
} ParagraphJustify;
ReformatText(void) {
fUseRTF = true; ReformatText(void) {
fLeftMargin = fRightMargin = 0; fUseRTF = true;
fPointSize = fPreMultPointSize = 8; fLeftMargin = fRightMargin = 0;
fGSFontSizeMult = 1.0; fPointSize = fPreMultPointSize = 8;
fJustified = kJustifyLeft; fGSFontSizeMult = 1.0;
fBoldEnabled = fItalicEnabled = fUnderlineEnabled = fJustified = kJustifyLeft;
fSuperscriptEnabled = fSubscriptEnabled = false; fBoldEnabled = fItalicEnabled = fUnderlineEnabled =
fTextColor = kColorNone; fSuperscriptEnabled = fSubscriptEnabled = false;
}; fTextColor = kColorNone;
virtual ~ReformatText(void) {} };
virtual ~ReformatText(void) {}
/*
* The numeric values are determined by the RTF header that we output. /*
* If the header in RTFBegin() changes, update these values. * The numeric values are determined by the RTF header that we output.
*/ * If the header in RTFBegin() changes, update these values.
typedef enum RTFFont { */
// basic fonts (one monospace, one proportional, Courier New default) typedef enum RTFFont {
kFontCourierNew = 0, // basic fonts (one monospace, one proportional, Courier New default)
kFontTimesRoman = 1, kFontCourierNew = 0,
kFontArial = 2, kFontTimesRoman = 1,
kFontSymbol = 3, kFontArial = 2,
} RTFFont; kFontSymbol = 3,
typedef enum { } RTFFont;
kColorNone = 0, typedef enum {
// full colors (RGB 0 or 255) kColorNone = 0,
kColorBlack = 1, // full colors (RGB 0 or 255)
kColorBlue = 2, kColorBlack = 1,
kColorCyan = 3, kColorBlue = 2,
kColorGreen = 4, // a little bright for white bkgnd kColorCyan = 3,
kColorPink = 5, kColorGreen = 4, // a little bright for white bkgnd
kColorRed = 6, kColorPink = 5,
kColorYellow = 7, kColorRed = 6,
kColorWhite = 8, kColorYellow = 7,
// mixed colors kColorWhite = 8,
kColorMediumBlue = 9, // mixed colors
kColorMediumAqua = 10, kColorMediumBlue = 9,
kColorMediumGreen = 11, kColorMediumAqua = 10,
kColorMagena = 12, kColorMediumGreen = 11,
kColorMediumRed = 13, kColorMagena = 12,
kColorOlive = 14, kColorMediumRed = 13,
kColorMediumGrey = 15, kColorOlive = 14,
kColorLightGrey = 16, kColorMediumGrey = 15,
kColorDarkGrey = 17, kColorLightGrey = 16,
kColorOrange = 18, kColorDarkGrey = 17,
} TextColor; kColorOrange = 18,
} TextColor;
/* Apple IIgs families */
typedef enum GSFontFamily { /* Apple IIgs families */
// standard fonts, defined in toolbox ref typedef enum GSFontFamily {
kGSFontNewYork = 0x0002, // standard fonts, defined in toolbox ref
kGSFontGeneva = 0x0003, // sans-sarif, like Arial kGSFontNewYork = 0x0002,
kGSFontMonaco = 0x0004, // monospace kGSFontGeneva = 0x0003, // sans-sarif, like Arial
kGSFontVenice = 0x0005, // script font kGSFontMonaco = 0x0004, // monospace
kGSFontLondon = 0x0006, kGSFontVenice = 0x0005, // script font
kGSFontAthens = 0x0007, kGSFontLondon = 0x0006,
kGSFontSanFran = 0x0008, kGSFontAthens = 0x0007,
kGSFontToronto = 0x0009, kGSFontSanFran = 0x0008,
kGSFontCairo = 0x000b, kGSFontToronto = 0x0009,
kGSFontLosAngeles = 0x000c, kGSFontCairo = 0x000b,
kGSFontTimes = 0x0014, // sarif, equal to Times New Roman kGSFontLosAngeles = 0x000c,
kGSFontHelvetica = 0x0015, // sans-sarif, equal to Arial kGSFontTimes = 0x0014, // sarif, equal to Times New Roman
kGSFontCourier = 0x0016, // monospace, sarif, Courier kGSFontHelvetica = 0x0015, // sans-sarif, equal to Arial
kGSFontSymbol = 0x0017, kGSFontCourier = 0x0016, // monospace, sarif, Courier
kGSFontTaliesin = 0x0018, kGSFontSymbol = 0x0017,
// I had these installed, by apps or by Pointless kGSFontTaliesin = 0x0018,
kGSFontStarfleet = 0x078d, // I had these installed, by apps or by Pointless
kGSFontWestern = 0x088e, kGSFontStarfleet = 0x078d,
kGSFontGenoa = 0x0bcb, kGSFontWestern = 0x088e,
kGSFontClassical = 0x2baa, kGSFontGenoa = 0x0bcb,
kGSFontChicago = 0x3fff, kGSFontClassical = 0x2baa,
kGSFontGenesys = 0x7530, kGSFontChicago = 0x3fff,
kGSFontPCMonospace = 0x7fdc, // monospace, sans-sarif kGSFontGenesys = 0x7530,
kGSFontAppleM = 0x7f58, // looks like classic Apple II font kGSFontPCMonospace = 0x7fdc, // monospace, sans-sarif
kGSFontUnknown1 = 0x9c50, // found in French AWGS doc "CONVSEC" kGSFontAppleM = 0x7f58, // looks like classic Apple II font
kGSFontUnknown2 = 0x9c54, // found in French AWGS doc "CONVSEC" kGSFontUnknown1 = 0x9c50, // found in French AWGS doc "CONVSEC"
// ROM font kGSFontUnknown2 = 0x9c54, // found in French AWGS doc "CONVSEC"
kGSFontShaston = 0xfffe, // rounded sans-sarif // ROM font
} GSFontFamily; kGSFontShaston = 0xfffe, // rounded sans-sarif
} GSFontFamily;
/* QuickDraw II font styles; this is a bit mask */
typedef enum QDFontStyle { /* QuickDraw II font styles; this is a bit mask */
kQDStyleBold = 0x01, typedef enum QDFontStyle {
kQDStyleItalic = 0x02, kQDStyleBold = 0x01,
kQDStyleUnderline = 0x04, kQDStyleItalic = 0x02,
kQDStyleOutline = 0x08, kQDStyleUnderline = 0x04,
kQDStyleShadow = 0x10, kQDStyleOutline = 0x08,
kQDStyleReserved = 0x20, kQDStyleShadow = 0x10,
kQDStyleSuperscript = 0x40, // not in QDII -- AWGS only kQDStyleReserved = 0x20,
kQDStyleSubscript = 0x80, // not in QDII -- AWGS only kQDStyleSuperscript = 0x40, // not in QDII -- AWGS only
} QDFontStyle; kQDStyleSubscript = 0x80, // not in QDII -- AWGS only
} QDFontStyle;
/* flags for RTFBegin */
enum { /* flags for RTFBegin */
kRTFFlagColorTable = 1, // include color table enum {
}; kRTFFlagColorTable = 1, // include color table
};
protected:
void RTFBegin(int flags = 0); protected:
void RTFEnd(void); void RTFBegin(int flags = 0);
void RTFSetPara(void); void RTFEnd(void);
void RTFNewPara(void); void RTFSetPara(void);
void RTFPageBreak(void); void RTFNewPara(void);
void RTFTab(void); void RTFPageBreak(void);
void RTFBoldOn(void); void RTFTab(void);
void RTFBoldOff(void); void RTFBoldOn(void);
void RTFItalicOn(void); void RTFBoldOff(void);
void RTFItalicOff(void); void RTFItalicOn(void);
void RTFUnderlineOn(void); void RTFItalicOff(void);
void RTFUnderlineOff(void); void RTFUnderlineOn(void);
void RTFParaLeft(void); void RTFUnderlineOff(void);
void RTFParaRight(void); void RTFParaLeft(void);
void RTFParaCenter(void); void RTFParaRight(void);
void RTFParaJustify(void); void RTFParaCenter(void);
void RTFLeftMargin(int margin); void RTFParaJustify(void);
void RTFRightMargin(int margin); void RTFLeftMargin(int margin);
//void RTFSetMargins(void); void RTFRightMargin(int margin);
void RTFSubscriptOn(void); //void RTFSetMargins(void);
void RTFSubscriptOff(void); void RTFSubscriptOn(void);
void RTFSuperscriptOn(void); void RTFSubscriptOff(void);
void RTFSuperscriptOff(void); void RTFSuperscriptOn(void);
void RTFSetColor(TextColor color); void RTFSuperscriptOff(void);
void RTFSetFont(RTFFont font); void RTFSetColor(TextColor color);
void RTFSetFontSize(int points); void RTFSetFont(RTFFont font);
void RTFSetGSFont(unsigned short family); void RTFSetFontSize(int points);
void RTFSetGSFontSize(int points); void RTFSetGSFont(unsigned short family);
void RTFSetGSFontStyle(unsigned char qdStyle); void RTFSetGSFontSize(int points);
// void RTFProportionalOn(void); void RTFSetGSFontStyle(unsigned char qdStyle);
// void RTFProportionalOff(void); // void RTFProportionalOn(void);
// void RTFProportionalOff(void);
void ConvertEOL(const unsigned char* srcBuf, long srcLen,
bool stripHiBits); void ConvertEOL(const unsigned char* srcBuf, long srcLen,
void BufHexDump(const unsigned char* srcBuf, long srcLen); bool stripHiBits);
void SetResultBuffer(ReformatOutput* pOutput, bool multiFont = false); void BufHexDump(const unsigned char* srcBuf, long srcLen);
void SetResultBuffer(ReformatOutput* pOutput, bool multiFont = false);
ExpandBuffer fExpBuf;
bool fUseRTF; ExpandBuffer fExpBuf;
bool fUseRTF;
// return a low-ASCII character so we can read high-ASCII files
inline char PrintableChar(unsigned char ch) { // return a low-ASCII character so we can read high-ASCII files
if (ch < 0x20) inline char PrintableChar(unsigned char ch) {
return '.'; if (ch < 0x20)
else if (ch < 0x7f) return '.';
return ch; else if (ch < 0x7f)
else if (ch < 0xa0 || ch == 0xff) // 0xff becomes 0x7f return ch;
return '.'; else if (ch < 0xa0 || ch == 0xff) // 0xff becomes 0x7f
else return '.';
return ch & 0x7f; else
} return ch & 0x7f;
// output an RTF-escaped char (do we want to trap Ctrl-Z?) }
// (only use this if we're in RTF mode) // output an RTF-escaped char (do we want to trap Ctrl-Z?)
inline void RTFPrintChar(unsigned char ch) { // (only use this if we're in RTF mode)
ch = PrintableChar(ch); inline void RTFPrintChar(unsigned char ch) {
RTFPrintExtChar(ch); ch = PrintableChar(ch);
} RTFPrintExtChar(ch);
// output an RTF-escaped char, allowing high ASCII }
// (only use this if we're in RTF mode) // output an RTF-escaped char, allowing high ASCII
inline void RTFPrintExtChar(unsigned char ch) { // (only use this if we're in RTF mode)
if (ch == '\\') inline void RTFPrintExtChar(unsigned char ch) {
fExpBuf.Printf("\\\\"); if (ch == '\\')
else if (ch == '{') fExpBuf.Printf("\\\\");
fExpBuf.Printf("\\{"); else if (ch == '{')
else if (ch == '}') fExpBuf.Printf("\\{");
fExpBuf.Printf("\\}"); else if (ch == '}')
else fExpBuf.Printf("\\}");
fExpBuf.Printf("%c", ch); else
} fExpBuf.Printf("%c", ch);
// output a char, doubling up double quotes (for .CSV) }
inline void BufPrintQChar(unsigned char ch) { // output a char, doubling up double quotes (for .CSV)
if (ch == '"') inline void BufPrintQChar(unsigned char ch) {
fExpBuf.Printf("\"\""); if (ch == '"')
else fExpBuf.Printf("\"\"");
fExpBuf.Printf("%c", ch); else
} fExpBuf.Printf("%c", ch);
}
// convert IIgs documents
unsigned char ConvertGSChar(unsigned char ch) { // convert IIgs documents
if (ch < 128) unsigned char ConvertGSChar(unsigned char ch) {
return ch; if (ch < 128)
else return ch;
return kGSCharConv[ch-128]; else
} return kGSCharConv[ch-128];
void CheckGSCharConv(void); }
void CheckGSCharConv(void);
private:
int CreateWorkBuf(void); private:
enum { kRTFUnitsPerInch = 1440 }; // TWIPS int CreateWorkBuf(void);
enum { kRTFUnitsPerInch = 1440 }; // TWIPS
static const unsigned char kGSCharConv[];
static const unsigned char kGSCharConv[];
int fLeftMargin, fRightMargin; // for documents, in 1/10th inch
int fPointSize; int fLeftMargin, fRightMargin; // for documents, in 1/10th inch
int fPreMultPointSize; int fPointSize;
float fGSFontSizeMult; int fPreMultPointSize;
bool fBoldEnabled; float fGSFontSizeMult;
bool fItalicEnabled; bool fBoldEnabled;
bool fUnderlineEnabled; bool fItalicEnabled;
bool fSuperscriptEnabled; bool fUnderlineEnabled;
bool fSubscriptEnabled; bool fSuperscriptEnabled;
ParagraphJustify fJustified; bool fSubscriptEnabled;
TextColor fTextColor; ParagraphJustify fJustified;
}; TextColor fTextColor;
};
#endif /*__LR_REFORMAT_BASE__*/
#endif /*__LR_REFORMAT_BASE__*/