diff --git a/app/CiderPress.rc b/app/CiderPress.rc index ccf619f..128e14d 100644 --- a/app/CiderPress.rc +++ b/app/CiderPress.rc @@ -320,12 +320,12 @@ BEGIN PUSHBUTTON "Help",IDHELP,376,242,50,14 END -IDD_PREF_FVIEW DIALOGEX 0, 0, 216, 263 +IDD_PREF_FVIEW DIALOGEX 0, 0, 217, 274 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTEXTHELP | WS_CHILD | WS_CAPTION CAPTION "File Viewer" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Converters",IDC_STATIC,4,7,208,139 + GROUPBOX "Converters",IDC_STATIC,4,7,209,139 CONTROL "High-ASCII &text",IDC_PVIEW_HITEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,19,88,10 CONTROL "&CP/M text",IDC_PVIEW_CPMTEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,92,10 CONTROL "&Pascal text",IDC_PVIEW_PASCALTEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,41,87,10 @@ -348,7 +348,7 @@ BEGIN CONTROL "MacPaint images",IDC_PVIEW_MACPAINT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,118,93,10 CONTROL "&Relax type-checking on graphics",IDC_PVIEW_RELAX_GFX, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,131,116,10 - GROUPBOX "Conversion options",IDC_STATIC,4,150,208,90 + GROUPBOX "Conversion options",IDC_STATIC,4,150,209,101 CONTROL "&Scroll horizontally instead of wrapping words",IDC_PVIEW_NOWRAP_TEXT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,162,192,10 CONTROL "Highlight &hex dump columns (small files)",IDC_PVIEW_BOLD_HEXDUMP, @@ -359,12 +359,14 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,195,189,10 CONTROL "Prefer &B&&W for hi-res images",IDC_PVIEW_HIRES_BW, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,206,148,10 - LTEXT "Preferred DHR mode:",IDC_STATIC,12,223,69,8 - COMBOBOX IDC_PVIEW_DHR_CONV_COMBO,84,220,118,48,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Viewer file size &limit:",IDC_STATIC,4,247,62,8 - EDITTEXT IDC_PVIEW_SIZE_EDIT,69,245,40,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin2",IDC_PVIEW_SIZE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,112,247,11,14 - LTEXT "KBytes",IDC_STATIC,110,247,36,8 + CONTROL "Convert MouseText to ASCII",IDC_PVIEW_MOUSETEXT_TO_ASCII, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,217,194,10 + LTEXT "Preferred DHR mode:",IDC_STATIC,12,234,69,8 + COMBOBOX IDC_PVIEW_DHR_CONV_COMBO,84,231,118,48,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "Viewer file size &limit:",IDC_STATIC,4,258,62,8 + EDITTEXT IDC_PVIEW_SIZE_EDIT,69,256,40,14,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Spin2",IDC_PVIEW_SIZE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,112,258,11,14 + LTEXT "KBytes",IDC_STATIC,110,258,36,8 END IDD_DISKEDIT DIALOGEX 0, 0, 458, 197 @@ -1362,12 +1364,12 @@ BEGIN IDD_PREF_FVIEW, DIALOG BEGIN LEFTMARGIN, 4 - RIGHTMARGIN, 212 + RIGHTMARGIN, 213 VERTGUIDE, 12 VERTGUIDE, 50 VERTGUIDE, 112 TOPMARGIN, 7 - BOTTOMMARGIN, 261 + BOTTOMMARGIN, 272 END IDD_DISKEDIT, DIALOG @@ -1863,6 +1865,11 @@ BEGIN 0 END +IDD_PREF_FVIEW AFX_DIALOG_LAYOUT +BEGIN + 0 +END + ///////////////////////////////////////////////////////////////////////////// // diff --git a/app/Help/CiderPress.chm b/app/Help/CiderPress.chm index d291752..a37d8c1 100644 Binary files a/app/Help/CiderPress.chm and b/app/Help/CiderPress.chm differ diff --git a/app/Help/PopUp.txt b/app/Help/PopUp.txt index c47bae5..185edea 100644 --- a/app/Help/PopUp.txt +++ b/app/Help/PopUp.txt @@ -82,6 +82,9 @@ If enabled, hi-res graphics are converted to black & white images by default. .topic IDH_PVIEW_DHR_CONV_COMBO Selects the preferred conversion algorithm for double-hi-res graphics. +.topic IDH_PVIEW_MOUSETEXT_TO_ASCII +Converts MouseText to ASCII instead of Unicode symbols. + .topic IDH_PVIEW_HITEXT Enables the text converter, which strips "high ASCII" text and converts end-of-line characters. diff --git a/app/Help/PopUpIds.h b/app/Help/PopUpIds.h index 1b76a7b..2219b7c 100644 --- a/app/Help/PopUpIds.h +++ b/app/Help/PopUpIds.h @@ -28,6 +28,7 @@ #define IDH_PVIEW_DISASM_ONEBYTEBRKCOP 1028 #define IDH_PVIEW_HIRES_BW 1029 #define IDH_PVIEW_DHR_CONV_COMBO 1030 +#define IDH_PVIEW_MOUSETEXT_TO_ASCII 1031 #define IDH_PVIEW_HITEXT 1036 #define IDH_PVIEW_PASCALTEXT 1037 #define IDH_PVIEW_APPLESOFT 1038 diff --git a/app/Help/README.txt b/app/Help/README.txt index 1e2baa7..5e3b454 100644 --- a/app/Help/README.txt +++ b/app/Help/README.txt @@ -11,3 +11,5 @@ This should update the CiderPress.chm in the app/Help directory. You can copy it into the CiderPress directory, or just rebuild CiderPress to have it copied automatically. +NOTE: pop-up text must be added to PopUp.txt, PopUpIds.h, and the +PopUpHelpIds table in MyApp.cpp. diff --git a/app/Main.cpp b/app/Main.cpp index 581c262..b74b9a6 100644 --- a/app/Main.cpp +++ b/app/Main.cpp @@ -827,6 +827,7 @@ void MainWindow::OnEditPreferences(void) ps.fFviewPage.fHighlightHexDump = fPreferences.GetPrefBool(kPrHighlightHexDump); ps.fFviewPage.fHighlightBASIC = fPreferences.GetPrefBool(kPrHighlightBASIC); ps.fFviewPage.fConvDisasmOneByteBrkCop = fPreferences.GetPrefBool(kPrDisasmOneByteBrkCop); + ps.fFviewPage.fConvMouseTextToASCII = fPreferences.GetPrefBool(kPrConvMouseTextToASCII); ps.fFviewPage.fConvHiResBlackWhite = fPreferences.GetPrefBool(kPrConvHiResBlackWhite); ps.fFviewPage.fConvDHRAlgorithm = fPreferences.GetPrefLong(kPrConvDHRAlgorithm); ps.fFviewPage.fRelaxGfxTypeCheck = fPreferences.GetPrefBool(kPrRelaxGfxTypeCheck); @@ -955,6 +956,7 @@ void MainWindow::ApplyNow(PrefsSheet* pPS) fPreferences.SetPrefBool(kPrHighlightHexDump, pPS->fFviewPage.fHighlightHexDump != 0); fPreferences.SetPrefBool(kPrHighlightBASIC, pPS->fFviewPage.fHighlightBASIC != 0); fPreferences.SetPrefBool(kPrDisasmOneByteBrkCop, pPS->fFviewPage.fConvDisasmOneByteBrkCop != 0); + fPreferences.SetPrefBool(kPrConvMouseTextToASCII, pPS->fFviewPage.fConvMouseTextToASCII != 0); fPreferences.SetPrefBool(kPrConvHiResBlackWhite, pPS->fFviewPage.fConvHiResBlackWhite != 0); fPreferences.SetPrefLong(kPrConvDHRAlgorithm, pPS->fFviewPage.fConvDHRAlgorithm); fPreferences.SetPrefBool(kPrRelaxGfxTypeCheck, pPS->fFviewPage.fRelaxGfxTypeCheck != 0); @@ -2465,6 +2467,8 @@ CString MainWindow::RemoveFile(const WCHAR* fileName) pPreferences->GetPrefBool(kPrRelaxGfxTypeCheck)); pReformat->SetOption(ReformatHolder::kOptOneByteBrkCop, pPreferences->GetPrefBool(kPrDisasmOneByteBrkCop)); + pReformat->SetOption(ReformatHolder::kOptMouseTextToASCII, + pPreferences->GetPrefBool(kPrConvMouseTextToASCII)); } /*static*/ ReformatHolder::SourceFormat MainWindow::ReformatterSourceFormat( diff --git a/app/MyApp.cpp b/app/MyApp.cpp index 604a4e7..87dac70 100644 --- a/app/MyApp.cpp +++ b/app/MyApp.cpp @@ -201,6 +201,7 @@ BOOL MyApp::OnIdle(LONG lCount) IDC_PVIEW_DISASM_ONEBYTEBRKCOP, IDH_PVIEW_DISASM_ONEBYTEBRKCOP, IDC_PVIEW_HIRES_BW, IDH_PVIEW_HIRES_BW, IDC_PVIEW_DHR_CONV_COMBO, IDH_PVIEW_DHR_CONV_COMBO, + IDC_PVIEW_MOUSETEXT_TO_ASCII, IDH_PVIEW_MOUSETEXT_TO_ASCII, IDC_PVIEW_HITEXT, IDH_PVIEW_HITEXT, IDC_PVIEW_PASCALTEXT, IDH_PVIEW_PASCALTEXT, IDC_PVIEW_APPLESOFT, IDH_PVIEW_APPLESOFT, diff --git a/app/Preferences.cpp b/app/Preferences.cpp index af8f719..e64263f 100644 --- a/app/Preferences.cpp +++ b/app/Preferences.cpp @@ -108,6 +108,7 @@ const Preferences::PrefMap Preferences::fPrefMaps[kPrefNumLastEntry] = { { kPrConvDHRAlgorithm, kLong, kPrefsSect, L"dhr-algorithm" }, { kPrRelaxGfxTypeCheck, kBool, kPrefsSect, L"relax-gfx-type-check" }, { kPrDisasmOneByteBrkCop, kBool, kPrefsSect, L"disasm-onebytebrkcop" }, + { kPrConvMouseTextToASCII, kBool, kPrefsSect, L"conv-mouse-text-to-ascii" }, //{ kPrEOLConvRaw, kBool, kPrefsSect, L"eol-conv-raw" }, { kPrConvTextEOL_HA, kBool, kPrefsSect, L"conv-eol-ha" }, { kPrConvPascalText, kBool, kPrefsSect, L"conv-pascal-text" }, @@ -214,6 +215,7 @@ Preferences::Preferences(void) SetPrefLong(kPrConvDHRAlgorithm, 1); // latched SetPrefBool(kPrRelaxGfxTypeCheck, true); SetPrefBool(kPrDisasmOneByteBrkCop, false); + SetPrefBool(kPrConvMouseTextToASCII, false); //SetPrefBool(kPrEOLConvRaw, true); SetPrefBool(kPrConvTextEOL_HA, true); SetPrefBool(kPrConvPascalText, true); diff --git a/app/Preferences.h b/app/Preferences.h index c464181..75a96b4 100644 --- a/app/Preferences.h +++ b/app/Preferences.h @@ -12,6 +12,13 @@ * section to the registry if appropriate. * - Add a default value to Preferences::Preferences. If not specified, * strings will be NULL and numeric values will be zero. + * + * For user-settable preferencers, you must also: + * - Add a UI element to the appropriate preference page. + * - Add the appropriate code for that item. Note in particular the data + * exchange and ON_CONTROL_RANGE values. + * - In Main.cpp, update OnEditPreferences() to init the page. + * - Add a tooltip to the help file. */ #ifndef APP_PREFERENCES_H #define APP_PREFERENCES_H @@ -168,6 +175,7 @@ typedef enum { kPrConvDHRAlgorithm, // long kPrRelaxGfxTypeCheck, // bool kPrDisasmOneByteBrkCop, // bool + kPrConvMouseTextToASCII, // bool //kPrEOLConvRaw, // bool kPrConvTextEOL_HA, // bool kPrConvPascalText, // bool diff --git a/app/PrefsDialog.cpp b/app/PrefsDialog.cpp index 0bc23fa..3171129 100644 --- a/app/PrefsDialog.cpp +++ b/app/PrefsDialog.cpp @@ -316,6 +316,7 @@ void PrefsFviewPage::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_PVIEW_BOLD_HEXDUMP, fHighlightHexDump); DDX_Check(pDX, IDC_PVIEW_BOLD_BASIC, fHighlightBASIC); DDX_Check(pDX, IDC_PVIEW_DISASM_ONEBYTEBRKCOP, fConvDisasmOneByteBrkCop); + DDX_Check(pDX, IDC_PVIEW_MOUSETEXT_TO_ASCII, fConvMouseTextToASCII); DDX_Check(pDX, IDC_PVIEW_HIRES_BW, fConvHiResBlackWhite); DDX_CBIndex(pDX, IDC_PVIEW_DHR_CONV_COMBO, fConvDHRAlgorithm); diff --git a/app/PrefsDialog.h b/app/PrefsDialog.h index d0e0c13..8917780 100644 --- a/app/PrefsDialog.h +++ b/app/PrefsDialog.h @@ -168,6 +168,7 @@ public: BOOL fHighlightHexDump; BOOL fHighlightBASIC; BOOL fConvDisasmOneByteBrkCop; + BOOL fConvMouseTextToASCII; BOOL fConvHiResBlackWhite; int fConvDHRAlgorithm; // drop list diff --git a/app/resource.h b/app/resource.h index 84c7f30..952ac54 100644 --- a/app/resource.h +++ b/app/resource.h @@ -93,6 +93,7 @@ #define IDC_PVIEW_DISASM_ONEBYTEBRKCOP 1028 #define IDC_PVIEW_HIRES_BW 1029 #define IDC_PVIEW_DHR_CONV_COMBO 1030 +#define IDC_PVIEW_MOUSETEXT_TO_ASCII 1031 #define IDC_PVIEW_HITEXT 1036 #define IDC_PVIEW_PASCALTEXT 1037 #define IDC_PVIEW_APPLESOFT 1038 @@ -559,9 +560,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 193 +#define _APS_NEXT_RESOURCE_VALUE 196 #define _APS_NEXT_COMMAND_VALUE 40102 -#define _APS_NEXT_CONTROL_VALUE 1454 +#define _APS_NEXT_CONTROL_VALUE 1455 #define _APS_NEXT_SYMED_VALUE 102 #endif #endif diff --git a/reformat/AppleWorks.cpp b/reformat/AppleWorks.cpp index b45fdde..7c725e1 100644 --- a/reformat/AppleWorks.cpp +++ b/reformat/AppleWorks.cpp @@ -69,6 +69,8 @@ int ReformatAWP::Process(const ReformatHolder* pHolder, bool skipRecord; uint8_t lineRecCode, lineRecData; + fMouseTextToASCII = pHolder->GetOption(ReformatHolder::kOptMouseTextToASCII) != 0; + if (srcLen > 65536) fUseRTF = false; @@ -457,8 +459,12 @@ int ReformatAWP::HandleTextRecord(uint8_t lineRecData, wantInverse = true; } else if (ic >= 0xc0 && ic <= 0xdf) { // MouseText characters - MouseTextToUTF16(ic & 0x1f, &mtLow, &mtHigh); - ic = '?'; + if (fMouseTextToASCII) { + ic = MouseTextToASCII(ic & 0x1f); + } else { + MouseTextToUTF16(ic & 0x1f, &mtLow, &mtHigh); + ic = '?'; + } } else { // plain ASCII } diff --git a/reformat/AppleWorks.h b/reformat/AppleWorks.h index a596e6e..f5076e2 100644 --- a/reformat/AppleWorks.h +++ b/reformat/AppleWorks.h @@ -16,7 +16,10 @@ */ class ReformatAWP : public ReformatText { public: - ReformatAWP(void) { fShowEmbeds = true; } + ReformatAWP(void) + : fShowEmbeds(true), + fMouseTextToASCII(false) + {} virtual ~ReformatAWP(void) {} virtual void Examine(ReformatHolder* pHolder) override; @@ -146,6 +149,7 @@ private: FileHeader fFileHeader; DocState fDocState; bool fShowEmbeds; + bool fMouseTextToASCII; }; /* diff --git a/reformat/Reformat.h b/reformat/Reformat.h index 759b6f7..b90733e 100644 --- a/reformat/Reformat.h +++ b/reformat/Reformat.h @@ -143,6 +143,7 @@ public: kOptDHRAlgorithm, kOptRelaxGfxTypeCheck, kOptOneByteBrkCop, + kOptMouseTextToASCII, kOptMAX // must be last } OptionID; @@ -186,7 +187,7 @@ public: * We want to know if it's DOS so we can relax some file-type checking, * and we want to know if it's CP/M so we can adjust the way we think * about text files. We want to know if it's Gutenberg because they only - * have one type of file, and it's indistingusihable from any other text file! + * have one type of file, and it's indistinguishable from any other text file! */ typedef enum SourceFormat { kSourceFormatGeneric = 0, diff --git a/reformat/ReformatBase.cpp b/reformat/ReformatBase.cpp index 0208661..2e34dca 100644 --- a/reformat/ReformatBase.cpp +++ b/reformat/ReformatBase.cpp @@ -608,7 +608,7 @@ void ReformatText::ConvertEOL(const uint8_t* srcBuf, long srcLen, * * If "stripHiBits" is set, the high bit of each character is cleared before * the value is considered. - *2 + * * If "stripNulls" is true, no null values will make it through. */ void ReformatText::ConvertEOL(const uint8_t* srcBuf, long srcLen, @@ -743,51 +743,59 @@ void ReformatText::BufHexDump(const uint8_t* srcBuf, long srcLen) } } -// Thanks to: http://hoop-la.ca/apple2/docs/mousetext/unicode.html -static const uint32_t gMouseTextConv[32] = { - 0xd83cdf4e, // 00 U+1f34e RED APPLE - 0xd83cdf4f, // 01 U+1f34f GREEN APPLE - //0x00002316, // 02 U+2316 POSITION INDICATOR - 0x000025c4, // 02 U+25c4 BLACK LEFT-POINTING POINTER - 0x000023f3, // 03 U+23f3 HOURGLASS WITH FLOWING SAND - 0x00002713, // 04 U+2713 CHECK MARK - 0x00002705, // 05 U+2705 WHITE HEAVY CHECK MARK - 0x000023ce, // 06 U+23ce RETURN SYMBOL - //0xd83cdf54, // 07 U+1f354 HAMBURGER - 0x00002630, // 07 U+2630 TRIGRAM FOR HEAVEN (actually want 4 lines, not 3) - 0x00002190, // 08 U+2190 LEFTWARDS ARROW - 0x00002026, // 09 U+2026 HORIZONTAL ELLIPSIS - 0x00002193, // 0a U+2193 DOWNWARDS ARROW - 0x00002191, // 0b U+2191 UPWARDS ARROW - 0x00002594, // 0c U+2594 UPPER ONE EIGHTH BLOCK - 0x000021b5, // 0d U+21b5 DOWNWARDS ARROW WITH CORNER LEFTWARDS - 0x00002589, // 0e U+2589 LEFT SEVEN EIGHTHS BLOCK - 0x000021e4, // 0f U+21e4 LEFTWARDS ARROW TO BAR - 0x000021e5, // 10 U+21e5 RIGHTWARDS ARROW TO BAR - 0x00002913, // 11 U+2913 DOWNWARDS ARROW TO BAR - 0x00002912, // 12 U+2912 UPWARDS ARROW TO BAR - 0x00002500, // 13 U+2500 BOX DRAWINGS LIGHT HORIZONTAL - 0x0000231e, // 14 U+231e BOTTOM LEFT CORNER - 0x00002192, // 15 U+2192 UPWARDS ARROW TO BAR - //0xd83dde7e, // 16 U+1f67e CHECKER BOARD - 0x00002591, // 16 U+2591 LIGHT SHADE - //0xd83dde7f, // 17 U+1f67f REVERSE CHECKER BOARD - 0x00002592, // 17 U+2592 MEDIUM SHADE - 0xd83ddcc1, // 18 U+1f4c1 FILE FOLDER - 0xd83ddcc2, // 19 U+1f4c2 OPEN FILE FOLDER - 0x00002595, // 1a U+2595 RIGHT ONE EIGHTH BLOCK - 0x00002666, // 1b U+2666 BLACK DIAMOND SUIT - 0x0000203e, // 1c U+203e OVERLINE -- wrong, want top/bottom - 0x0000256c, // 1d U+256c BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - //0xd83ddcbe, // 1e U+1f4be FLOPPY DISK - 0x000022a1, // 1e U+22a1 SQUARED DOT OPERATOR (seems better than 25a3) - 0x0000258f, // 1f U+258f LEFT ONE EIGHTH BLOCK +// Thanks to http://hoop-la.ca/apple2/docs/mousetext/unicode.html for Unicode. +// Thanks to Hugh Hood for extracting the ASCII conversions from SEG.WP. +static const struct { + uint32_t unicode; // UTF-16 single code point or surrogate pair + int8_t ascii; // 7-bit ASCII +} gMouseTextConv[32] = { + { 0xd83cdf4e, '@' }, // 00 U+1f34e RED APPLE + { 0xd83cdf4f, '@' }, // 01 U+1f34f GREEN APPLE + //{ 0x00002316, '^' }, // 02 U+2316 POSITION INDICATOR + { 0x000025c4, '^' }, // 02 U+25c4 BLACK LEFT-POINTING POINTER + { 0x000023f3, '&' }, // 03 U+23f3 HOURGLASS WITH FLOWING SAND + { 0x00002713, '\'' }, // 04 U+2713 CHECK MARK + { 0x00002705, '\'' }, // 05 U+2705 WHITE HEAVY CHECK MARK + { 0x000023ce, '/' }, // 06 U+23ce RETURN SYMBOL + //{ 0xd83cdf54, ':' }, // 07 U+1f354 HAMBURGER + { 0x00002630, ':' }, // 07 U+2630 TRIGRAM FOR HEAVEN (actually want 4 lines, not 3) + { 0x00002190, '<' }, // 08 U+2190 LEFTWARDS ARROW + { 0x00002026, '_' }, // 09 U+2026 HORIZONTAL ELLIPSIS + { 0x00002193, 'v' }, // 0a U+2193 DOWNWARDS ARROW + { 0x00002191, '^' }, // 0b U+2191 UPWARDS ARROW + { 0x00002594, '-' }, // 0c U+2594 UPPER ONE EIGHTH BLOCK + { 0x000021b5, '/' }, // 0d U+21b5 DOWNWARDS ARROW WITH CORNER LEFTWARDS + { 0x00002589, '$' }, // 0e U+2589 LEFT SEVEN EIGHTHS BLOCK + { 0x000021e4, '{' }, // 0f U+21e4 LEFTWARDS ARROW TO BAR + { 0x000021e5, '}' }, // 10 U+21e5 RIGHTWARDS ARROW TO BAR + { 0x00002913, 'v' }, // 11 U+2913 DOWNWARDS ARROW TO BAR + { 0x00002912, '^' }, // 12 U+2912 UPWARDS ARROW TO BAR + { 0x00002500, '-' }, // 13 U+2500 BOX DRAWINGS LIGHT HORIZONTAL + { 0x0000231e, 'L' }, // 14 U+231e BOTTOM LEFT CORNER + { 0x00002192, '>' }, // 15 U+2192 UPWARDS ARROW TO BAR + //{ 0xd83dde7e, '*' }, // 16 U+1f67e CHECKER BOARD + { 0x00002591, '*' }, // 16 U+2591 LIGHT SHADE + //{ 0xd83dde7f, '*' }, // 17 U+1f67f REVERSE CHECKER BOARD + { 0x00002592, '*' }, // 17 U+2592 MEDIUM SHADE + { 0xd83ddcc1, '[' }, // 18 U+1f4c1 FILE FOLDER + { 0xd83ddcc2, ']' }, // 19 U+1f4c2 OPEN FILE FOLDER + { 0x00002595, '|' }, // 1a U+2595 RIGHT ONE EIGHTH BLOCK + { 0x00002666, '#' }, // 1b U+2666 BLACK DIAMOND SUIT + { 0x0000203e, '=' }, // 1c U+203e OVERLINE -- wrong, want top/bottom + { 0x0000256c, '#' }, // 1d U+256c BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + //{ 0xd83ddcbe, 'O' }, // 1e U+1f4be FLOPPY DISK + { 0x000022a1, 'O' }, // 1e U+22a1 SQUARED DOT OPERATOR (seems better than 25a3) + { 0x0000258f, '|' }, // 1f U+258f LEFT ONE EIGHTH BLOCK }; void ReformatText::MouseTextToUTF16(uint8_t mtVal, uint16_t* pLow, uint16_t* pHigh) { ASSERT(mtVal < 32); - *pLow = gMouseTextConv[mtVal] & 0xffff; - *pHigh = gMouseTextConv[mtVal] >> 16; + *pLow = gMouseTextConv[mtVal].unicode & 0xffff; + *pHigh = gMouseTextConv[mtVal].unicode >> 16; +} +int8_t ReformatText::MouseTextToASCII(uint8_t mtVal) { + ASSERT(mtVal < 32); + return gMouseTextConv[mtVal].ascii; } diff --git a/reformat/ReformatBase.h b/reformat/ReformatBase.h index c7a4e4d..4b92176 100644 --- a/reformat/ReformatBase.h +++ b/reformat/ReformatBase.h @@ -390,9 +390,14 @@ protected: // encoding as a surrogate pair, high will be nonzero. void MouseTextToUTF16(uint8_t mtVal, uint16_t* pLow, uint16_t* pHigh); + // Converts a MouseText value (0-31) to an ASCII equivalent. This is not + // a 1:1 conversion, so it's not reversible. + int8_t MouseTextToASCII(uint8_t mtVal); + private: DECLARE_COPY_AND_OPEQ(ReformatText) int CreateWorkBuf(void); + enum { kRTFUnitsPerInch = 1440 }; // TWIPS int fLeftMargin, fRightMargin; // for documents, in 1/10th inch