https://git.reactos.org/?p=reactos.git;a=commitdiff;h=99dd292553132adacd7095...
commit 99dd292553132adacd7095c4d03f2c2a9fbbf2ab Author: Charles Ambrye giawa@hotmail.com AuthorDate: Sun Jun 7 10:34:45 2020 -0700 Commit: GitHub noreply@github.com CommitDate: Sun Jun 7 19:34:45 2020 +0200
[CHARMAP] Functionality Improvements and Bug Fixes (#2560)
- Resize the window slightly when compiled with REMOVE_ADVANCED to avoid deadspace at the bottom of the window.
- Skip over the non-printable characters by starting with character ' ' + 1.
- Instead of iterating over every cell, simply compute the cell x and y using the CellSize.
- Modify behaviour of charmap to allow large character render on mouse move, only hiding the larger character on double click.
- Simplify math for moving window to be on desktop. Added FIXME to highlight this doesn't work well on multi-monitor setups. Changed xPos and yPos to LONG since negative numbers are valid on multi-monitor setups.
- Do not draw invalid glyphs on the map (can happen when switching fonts or filtering existing font). - Do not allow mouse-over of invalid glyphs.
- Fix bug that caused the Help button to remain enabled as it was being modified before it was even created. - Do a better job at finding the correct glyph under the mouse.
- Ensure the active cell is cleared correctly.
- Invalidate the rect around the previously active cell to ensure it gets redrawn as inactive.
- Fix bug from CORE-10518 (initial active cell was not being invalidated on scroll).
- Do not try to copy a character to the output if there is no active cell selected.
- Populate the advanced portion of the screen with several built-in code pages (the list is hardcoded so that we don't enumerate everything).
- Add functionality to filter the character map by a code page (called a character set in this program).
- Some fonts list 0x0000 as drawable, even when it isn't, so ignore any valid glyphs that contain it. --- base/applications/charmap/charmap.c | 90 ++++++++++++++++++++++++++++-- base/applications/charmap/lang/bg-BG.rc | 2 + base/applications/charmap/lang/ca-ES.rc | 2 + base/applications/charmap/lang/cs-CZ.rc | 2 + base/applications/charmap/lang/de-DE.rc | 2 + base/applications/charmap/lang/el-GR.rc | 2 + base/applications/charmap/lang/en-US.rc | 2 + base/applications/charmap/lang/es-ES.rc | 2 + base/applications/charmap/lang/et-EE.rc | 2 + base/applications/charmap/lang/fr-FR.rc | 2 + base/applications/charmap/lang/he-IL.rc | 2 + base/applications/charmap/lang/id-ID.rc | 2 + base/applications/charmap/lang/it-IT.rc | 2 + base/applications/charmap/lang/ja-JP.rc | 2 + base/applications/charmap/lang/ko-KR.rc | 2 + base/applications/charmap/lang/lt-LT.rc | 2 + base/applications/charmap/lang/nl-NL.rc | 2 + base/applications/charmap/lang/no-NO.rc | 2 + base/applications/charmap/lang/pl-PL.rc | 2 + base/applications/charmap/lang/pt-BR.rc | 2 + base/applications/charmap/lang/ro-RO.rc | 2 + base/applications/charmap/lang/ru-RU.rc | 2 + base/applications/charmap/lang/sk-SK.rc | 2 + base/applications/charmap/lang/sq-AL.rc | 2 + base/applications/charmap/lang/sv-SE.rc | 2 + base/applications/charmap/lang/tr-TR.rc | 2 + base/applications/charmap/lang/uk-UA.rc | 2 + base/applications/charmap/lang/zh-CN.rc | 2 + base/applications/charmap/lang/zh-TW.rc | 2 + base/applications/charmap/map.c | 99 +++++++++++++++++++++++++++++---- base/applications/charmap/precomp.h | 16 ++++-- base/applications/charmap/resource.h | 2 + 32 files changed, 242 insertions(+), 21 deletions(-)
diff --git a/base/applications/charmap/charmap.c b/base/applications/charmap/charmap.c index 1ed517b390f..90008a812a1 100644 --- a/base/applications/charmap/charmap.c +++ b/base/applications/charmap/charmap.c @@ -13,7 +13,7 @@ #include <richedit.h> #include <winnls.h>
-#define REMOVE_ADVANCED +//#define REMOVE_ADVANCED
#define ID_ABOUT 0x1
@@ -25,6 +25,55 @@ HICON hSmIcon; HICON hBgIcon; SETTINGS Settings;
+static +VOID +FillCharacterSetComboList(HWND hwndCombo) +{ + WCHAR szCharSetText[256]; + LPWSTR trimmedName; + CPINFOEXW cpInfo; + INT i; + + if (LoadStringW(hInstance, IDS_UNICODE, szCharSetText, SIZEOF(szCharSetText))) + { + SendMessageW(hwndCombo, + CB_ADDSTRING, + 0, + (LPARAM)szCharSetText); + } + + for (i = 0; i < SIZEOF(codePages); i++) + { + if (GetCPInfoExW(codePages[i], 0, &cpInfo)) + { + trimmedName = wcschr(cpInfo.CodePageName, L'('); + if (!trimmedName) + trimmedName = cpInfo.CodePageName; + + SendMessageW(hwndCombo, + CB_ADDSTRING, + 0, + (LPARAM)trimmedName); + } + } + + SendMessageW(hwndCombo, CB_SETCURSEL, 0, 0); +} + +static +VOID +FillGroupByComboList(HWND hwndCombo) +{ + WCHAR szAllText[256]; + + if (LoadStringW(hInstance, IDS_ALL, szAllText, SIZEOF(szAllText))) + { + SendMessageW(hwndCombo, CB_ADDSTRING, 0, (LPARAM)szAllText); + } + + SendMessageW(hwndCombo, CB_SETCURSEL, 0, 0); +} + /* Font-enumeration callback */ static int @@ -283,7 +332,7 @@ ChangeView(HWND hWnd) RECT rcPanelInt; RECT rcStatus; UINT DeX, DeY; - UINT xPos, yPos; + LONG xPos, yPos; UINT Width, Height; UINT DeskTopWidth, DeskTopHeight; #ifdef REMOVE_ADVANCED @@ -325,11 +374,12 @@ ChangeView(HWND hWnd) Shrink the window height a bit here to accomodate for that lost control. */ Height = rcCharmap.bottom + rcCopy.bottom + 10; #endif + // FIXME: This fails on multi monitor setups if ((xPos + Width) > DeskTopWidth) - xPos += DeskTopWidth - (xPos + Width); + xPos = DeskTopWidth - Width;
if ((yPos + Height) > DeskTopHeight) - yPos += DeskTopHeight - (yPos + Height); + yPos = DeskTopHeight - Height;
MoveWindow(hWnd, xPos, yPos, @@ -438,6 +488,26 @@ AdvancedDlgProc(HWND hDlg, case WM_INITDIALOG: return TRUE;
+ case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_COMBO_CHARSET: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + INT idx = (INT)SendMessageW((HWND)lParam, + CB_GETCURSEL, + 0, 0); + SendMessageW(GetDlgItem(hCharmapDlg, IDC_FONTMAP), + FM_SETCHARMAP, + idx, 0); + + EnableWindow(GetDlgItem(hAdvancedDlg, IDC_EDIT_UNICODE), idx == 0); + } + break; + } + } + default: return FALSE; } @@ -456,11 +526,21 @@ PanelOnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam) MAKEINTRESOURCE(IDD_CHARMAP), hWnd, CharMapDlgProc); + + // For now, the Help push button is disabled because of lacking of HTML Help support + EnableWindow(GetDlgItem(hCharmapDlg, IDC_CMHELP), FALSE); + #ifndef REMOVE_ADVANCED hAdvancedDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_ADVANCED), hWnd, AdvancedDlgProc); + + FillCharacterSetComboList(GetDlgItem(hAdvancedDlg, IDC_COMBO_CHARSET)); + + FillGroupByComboList(GetDlgItem(hAdvancedDlg, IDC_COMBO_GROUPBY)); + EnableWindow(GetDlgItem(hAdvancedDlg, IDC_COMBO_GROUPBY), FALSE); // FIXME: Implement + EnableWindow(GetDlgItem(hAdvancedDlg, IDC_BUTTON_SEARCH), FALSE); // FIXME: Implement #endif hStatusWnd = CreateWindow(STATUSCLASSNAME, NULL, @@ -495,8 +575,6 @@ PanelWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_CREATE: - // For now, the Help push button is disabled because of lacking of HTML Help support - EnableWindow(GetDlgItem(hWnd, IDC_CMHELP), FALSE); return PanelOnCreate(hWnd, wParam, lParam);
case WM_CLOSE: diff --git a/base/applications/charmap/lang/bg-BG.rc b/base/applications/charmap/lang/bg-BG.rc index 6dda6e4002c..fb1f1ff75ac 100644 --- a/base/applications/charmap/lang/bg-BG.rc +++ b/base/applications/charmap/lang/bg-BG.rc @@ -54,4 +54,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "&За..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/ca-ES.rc b/base/applications/charmap/lang/ca-ES.rc index aa01fa2d198..c80905b9ef6 100644 --- a/base/applications/charmap/lang/ca-ES.rc +++ b/base/applications/charmap/lang/ca-ES.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "&En quant a..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/cs-CZ.rc b/base/applications/charmap/lang/cs-CZ.rc index 4a58d3ecda7..c30c75c0537 100644 --- a/base/applications/charmap/lang/cs-CZ.rc +++ b/base/applications/charmap/lang/cs-CZ.rc @@ -56,4 +56,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "&O programu..." IDS_TITLE "Mapa znaků" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/de-DE.rc b/base/applications/charmap/lang/de-DE.rc index e14c0942ca6..e29798fd949 100644 --- a/base/applications/charmap/lang/de-DE.rc +++ b/base/applications/charmap/lang/de-DE.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "Dieses Programm ist kostenlos; Sie können es frei verteilen mit od. ohne Änderungen unter der GNU Lesser General Public License wie es von der Free Software Foundation veröffentlicht wurde; entweder Version 2.1 der Lizenz, oder eine spätere Version (ihrer Wahl).\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Publ [...] IDS_ABOUT "Ü&ber..." IDS_TITLE "Zeichentabelle" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/el-GR.rc b/base/applications/charmap/lang/el-GR.rc index 8dab3c78ec7..8f8c416b5b2 100644 --- a/base/applications/charmap/lang/el-GR.rc +++ b/base/applications/charmap/lang/el-GR.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "&Πληροφορίες..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/en-US.rc b/base/applications/charmap/lang/en-US.rc index eacc22072bf..afb222b68bf 100644 --- a/base/applications/charmap/lang/en-US.rc +++ b/base/applications/charmap/lang/en-US.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "A&bout..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/es-ES.rc b/base/applications/charmap/lang/es-ES.rc index fd439f4d354..f1d912f8a8b 100644 --- a/base/applications/charmap/lang/es-ES.rc +++ b/base/applications/charmap/lang/es-ES.rc @@ -54,4 +54,6 @@ BEGIN IDS_LICENSE "Este programa es software libre; puedes redistribuirlo y/o modificarlo bajo los términos de la GNU General Public License tal y como se publica por la Free Software Foundation; ya sea la versión 2 de la Licencia, o (bajo tu discreción) cualquier versión posterior.\r\n\r\nEste programa se distribuye con el fin de ser útil, pero viene SIN NINGUNA GARANTÍA; sin tan siquiera la garantía implícita de COMERCIALIZACIÓN o la de IDONEIDAD PARA UN PROPÓSITO CONCRETO. Para más info [...] IDS_ABOUT "&Acerca de ..." IDS_TITLE "Mapa de caracteres" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/et-EE.rc b/base/applications/charmap/lang/et-EE.rc index a6d49e08529..e914a7977a4 100644 --- a/base/applications/charmap/lang/et-EE.rc +++ b/base/applications/charmap/lang/et-EE.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "T&eave..." IDS_TITLE "Märgistik" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/fr-FR.rc b/base/applications/charmap/lang/fr-FR.rc index abfd238cb28..44046fa4f0a 100644 --- a/base/applications/charmap/lang/fr-FR.rc +++ b/base/applications/charmap/lang/fr-FR.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier tout en respectant les termes de la ""GNU General Public License"" publiée par la Free Software Foundation; dans sa version 2 (ou selon votre préférence) toute version ultérieure.\r\n\r\nCe programme est distribué dans l'espoir qu'il sera utile, cependant SANS GARANTIE D'AUCUNE SORTE ; sans même une garantie implicite de COMMERCIABILITÉ ou DE CONFORMITÉ À UNE UTILISATION PARTICULIÈRE. \r\n [...] IDS_ABOUT "À propos..." IDS_TITLE "Table des Caractères" + IDS_UNICODE "Unicode" + IDS_ALL "Tous" END diff --git a/base/applications/charmap/lang/he-IL.rc b/base/applications/charmap/lang/he-IL.rc index 47c94fbc629..e1840774a19 100644 --- a/base/applications/charmap/lang/he-IL.rc +++ b/base/applications/charmap/lang/he-IL.rc @@ -55,4 +55,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "&אודות..." IDS_TITLE "מפת תווים" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/id-ID.rc b/base/applications/charmap/lang/id-ID.rc index b5cd57edbc5..03b6a3d0a81 100644 --- a/base/applications/charmap/lang/id-ID.rc +++ b/base/applications/charmap/lang/id-ID.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "Program ini adalah software bebas; anda dapat mendistribusikan dan/atau mengubahnya di bawah term GNU General Public License seperti dipublikasikan oleh Free Software Foundation; baik Lisensi versi 2, atau (menurut opini anda) setiap versi berikutnya.\r\n\r\nProgram ini didistribusikan dengan harapan ia akan berguna, tetapi TANPA JAMINAN APAPUN; bahkan tanpa jaminan berarti dari MERCANTABILITAS atau KECUKUPAN UNTUK KEPERLUAN TERTENTU. Lihat GNU General Public License un [...] IDS_ABOUT "Te&ntang..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/it-IT.rc b/base/applications/charmap/lang/it-IT.rc index 076edf08832..fb663df9039 100644 --- a/base/applications/charmap/lang/it-IT.rc +++ b/base/applications/charmap/lang/it-IT.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "Questo programma è software libero; può redistribuirlo e/o modificarlo sotto\ni termini della licenza pubblica GNU come pubblicata dalla Free Software Foundation; sia la versione 2 sia una versione successiva (a sua scelta).\r\n\r\nQuesto programma è distribuito\nnella speranza che sia utile, ma SENZA ALCUNA GARANZIA; senza neanche la garanzia implicita\ndi NEGOZIABILITA' o APPLICABILITA' per un particolare scopo. Si veda la licenza generale pubblica GNU per maggiori de [...] IDS_ABOUT "&Informazioni su..." IDS_TITLE "Mappa caratteri" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/ja-JP.rc b/base/applications/charmap/lang/ja-JP.rc index 3c671d6d71f..1a00e46f0bf 100644 --- a/base/applications/charmap/lang/ja-JP.rc +++ b/base/applications/charmap/lang/ja-JP.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "バージョン情報(&B)..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/ko-KR.rc b/base/applications/charmap/lang/ko-KR.rc index 35e36dcd0d8..dedc3d69335 100644 --- a/base/applications/charmap/lang/ko-KR.rc +++ b/base/applications/charmap/lang/ko-KR.rc @@ -55,4 +55,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "정보(&A)" IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/lt-LT.rc b/base/applications/charmap/lang/lt-LT.rc index 6dacfb06eba..d6f62feaae1 100644 --- a/base/applications/charmap/lang/lt-LT.rc +++ b/base/applications/charmap/lang/lt-LT.rc @@ -60,4 +60,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "&Apie..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/nl-NL.rc b/base/applications/charmap/lang/nl-NL.rc index 706fa9683db..b370b17cc03 100644 --- a/base/applications/charmap/lang/nl-NL.rc +++ b/base/applications/charmap/lang/nl-NL.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "Over..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/no-NO.rc b/base/applications/charmap/lang/no-NO.rc index c59575a32e6..1d41bb4bf28 100644 --- a/base/applications/charmap/lang/no-NO.rc +++ b/base/applications/charmap/lang/no-NO.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "Dette programmet er gratis programvare; du kan distribuere det og/eller endre det under betingelsene av GNU General Public License som er utgitt av Free Software Foundation; version 2 av lisensen, eller (etter din mening) alle senere versjoner.\r\n\r\nDette programmet er utgitt i håp for at det skal kunne brukes, men DET ER INGEN GARANTIER; uten heller forutsatt garantier av SALGBARHET eller SIKKETHET FOR EN ENKELTHET FORMÅL. Se på GNU General Public Lisensen for mere [...] IDS_ABOUT "O&m..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/pl-PL.rc b/base/applications/charmap/lang/pl-PL.rc index cba1a4abad9..50dbdc1f9d6 100644 --- a/base/applications/charmap/lang/pl-PL.rc +++ b/base/applications/charmap/lang/pl-PL.rc @@ -60,4 +60,6 @@ BEGIN IDS_LICENSE "Niniejszy program jest wolnym oprogramowaniem; możesz go rozprowadzać dalej i/lub modyfikować na warunkach Powszechnej Licencji Publicznej GNU, wydanej przez Fundację Wolnego Oprogramowania - według wersji 2 tej Licencji lub (według twojego wyboru) którejś z późniejszych wersji.\r\n\r\nNiniejszy program rozpowszechniany jest z nadzieją, iż będzie on użyteczny - jednak BEZ JAKIEJKOLWIEK GWARANCJI, nawet domyślnej gwarancji PRZYDATNOŚCI HANDLOWEJ albo PRZYDATNOŚCI DO OKRES [...] IDS_ABOUT "&O programie..." IDS_TITLE "Tablica znaków" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/pt-BR.rc b/base/applications/charmap/lang/pt-BR.rc index 347f0612db5..a58d9f4e629 100644 --- a/base/applications/charmap/lang/pt-BR.rc +++ b/base/applications/charmap/lang/pt-BR.rc @@ -51,4 +51,6 @@ BEGIN IDS_LICENSE "Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo sob os termos da GNU General Public License conforme publicada pela Free Software Foundation; quer a versão 2 da licença, ou (conforme você escolha) qualquer versão posterior.\r\n\r\nEste programa é distribuído com a esperança de que seja útil, mas SEM QUALQUER GARANTIA; mesmo sem a garantia implícita de MERCANTIBILIDADE OU ADEQUAÇÃO A UM DETERMINADO PROPÓSITO. Para mais detalhes, veja a GNU Gen [...] IDS_ABOUT "So&bre..." IDS_TITLE "Mapa de Caracteres" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/ro-RO.rc b/base/applications/charmap/lang/ro-RO.rc index af66aaeaa82..d59f6299825 100644 --- a/base/applications/charmap/lang/ro-RO.rc +++ b/base/applications/charmap/lang/ro-RO.rc @@ -57,4 +57,6 @@ BEGIN IDS_LICENSE "Această aplicație este publică; fiind permisă modificarea și/sau (re)distribuția sa în termenii Licenței Publice Generale GNU publicată de Free Software Foundation; sau versiunea 2 a Licenței, sau (la alegere) a oricărei versiuni ulterioare.\r\n\r\nAceastă aplicație este distribuită doar în speranța de a fi utilă, FĂRĂ însă NICI O GARANȚIE; nici măcar cu garanția implicită a VANDABILITĂȚII sau a UTILITĂȚII ÎNTR-UN SCOP ANUME. Pentru mai multe detalii consultați Licența P [...] IDS_ABOUT "&Despre…" IDS_TITLE "Hartă de caractere" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/ru-RU.rc b/base/applications/charmap/lang/ru-RU.rc index b3715194b33..e4b3872de5d 100644 --- a/base/applications/charmap/lang/ru-RU.rc +++ b/base/applications/charmap/lang/ru-RU.rc @@ -53,4 +53,6 @@ BEGIN IDS_LICENSE "Эта программа является свободно распространяемой; Вы можете распространять ее повторно и (или) изменять, соблюдая условия Открытого лицензионного соглашения GNU, опубликованного Фондом свободно распространяемого программного обеспечения; либо редакции 2 Соглашения, либо (на ваше усмотрение) любой редакции, выпущенной позже.\r\n\r\nЭта программа распространяется в надежде на то, что она окажется полезной, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, включая подразумеваемую гарантию КАЧЕСТ [...] IDS_ABOUT "&О программе..." IDS_TITLE "Таблица символов" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/sk-SK.rc b/base/applications/charmap/lang/sk-SK.rc index 96083960913..e61403e7d9c 100644 --- a/base/applications/charmap/lang/sk-SK.rc +++ b/base/applications/charmap/lang/sk-SK.rc @@ -60,4 +60,6 @@ BEGIN IDS_LICENSE "Tento program je voľný softvér; môžete ho šíriť a/alebo modifikovať podľa podmienok GNU Všeobecnej verejnej licencie (GNU General Public License) ako bola zverejnená nadáciou Free Software Foundation; buď verzie 2 tejto licencie, alebo (podľa Vášho uváženia) niektorej neskoršej verzie.\r\n\r\nTento program je distribuovaný v nádeji, že bude užitočný, avšak BEZ AKEJKOĽVEK ZÁRUKY; rovnako bez záruky PREDAJNOSTI alebo VHODNOSTI PRE URČITÝ ÚČEL. Pre viac detailov si pozrite [...] IDS_ABOUT "Č&o je Mapa znakov" IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/sq-AL.rc b/base/applications/charmap/lang/sq-AL.rc index 9829abf1f06..5ce97b3482c 100644 --- a/base/applications/charmap/lang/sq-AL.rc +++ b/base/applications/charmap/lang/sq-AL.rc @@ -55,4 +55,6 @@ BEGIN IDS_LICENSE "Ky program eshte falas; ju mund ta shperndani ose modifikoni nen termat e liçenses publike te GNU nga Free Software Foundation; ose versionin 2 te Liçenses, ose (opsionet tend) versionet me te reja.\r\n\r\nKy program shperndahet me shpresen qe do te jete i nevojshem, POR PA ASNJE GARANCI; madje dhe pa nënkuptimin e garancisë së tregtimit apo përshtatshmerise për qëllim të veçantë. Shiko liçensen publike te GNU per me shume detaje.\r\n\r\nJu duhet te jeni paisur me nje ko [...] IDS_ABOUT "R&reth..." IDS_TITLE "Karakter Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/sv-SE.rc b/base/applications/charmap/lang/sv-SE.rc index 6ea641fef05..c99c309c4d2 100644 --- a/base/applications/charmap/lang/sv-SE.rc +++ b/base/applications/charmap/lang/sv-SE.rc @@ -58,4 +58,6 @@ BEGIN IDS_LICENSE "Detta programmet är fri programvara; du kan distribuera det och/eller ändra det under villkoren enligt GNU General Public License som är utgivet av Free Software Foundation; version 2, eller (om du så önskar) alla senare versioner.\r\n\r\nDette programmet er utgivet i hopp om att det skall kunne användas, men DET FINNS INGA GARANTIER; även utan underförstådd garanti om SÄLJBARHET eller LÄMPLIGHET FÖR ETT VISST ÄNDAMÅL. Se på GNU General Public Licensen för mer detaljer [...] IDS_ABOUT "O&m..." IDS_TITLE "Character Map" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/tr-TR.rc b/base/applications/charmap/lang/tr-TR.rc index 43bbb83a998..27170f2c52c 100644 --- a/base/applications/charmap/lang/tr-TR.rc +++ b/base/applications/charmap/lang/tr-TR.rc @@ -53,4 +53,6 @@ BEGIN IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu izlence özgür yazılımdır; bunu, Özgür Yazılım Vakfı'nın yayımladığı GNU Umûmî Kamu Ruhsatı'nın, 2. sürümünün ya da daha sonraki bir sürümünün (Orası size bağlı.) şartları altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu izlence, kullanışlı olabileceği beklentisiyle dağıtılmıştır [...] IDS_ABOUT "&Üzerine..." IDS_TITLE "Damga Eşlemi" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/uk-UA.rc b/base/applications/charmap/lang/uk-UA.rc index 8bf08b489eb..a373a30d3d6 100644 --- a/base/applications/charmap/lang/uk-UA.rc +++ b/base/applications/charmap/lang/uk-UA.rc @@ -59,4 +59,6 @@ BEGIN IDS_LICENSE "Таблиця символів - вільне програмне забезпечення; Ви можете розповсюджувати її та змінювати, дотримуючись умови Відкритої ліцензійної угоди GNU, опублікованої Фондом вільного програмного забезпечення; або редакції 2 Угоди, або будь-якої редакції, випущеної пізніше.\r\n\r\nЦя програма розповсюджується в надії на те, що вона виявиться корисною, але БЕЗ БУДЬ-ЯКИХ ГАРАНТІЙ, включаючи УЯВНОЮ ГАРАНТІЄЮ ЯКОСТІ або ПРИДАТНОСТІ для певних цілей. Подробиці містяться у Відкритій лі [...] IDS_ABOUT "&Про програму..." IDS_TITLE "Таблиця Cимволів" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/zh-CN.rc b/base/applications/charmap/lang/zh-CN.rc index f8724175cdc..a7456d3dd1c 100644 --- a/base/applications/charmap/lang/zh-CN.rc +++ b/base/applications/charmap/lang/zh-CN.rc @@ -59,4 +59,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "关于(&A)..." IDS_TITLE "字符映射表" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/lang/zh-TW.rc b/base/applications/charmap/lang/zh-TW.rc index 15f0e8a1ec8..f227133710d 100644 --- a/base/applications/charmap/lang/zh-TW.rc +++ b/base/applications/charmap/lang/zh-TW.rc @@ -59,4 +59,6 @@ BEGIN IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more det [...] IDS_ABOUT "關於(&A)..." IDS_TITLE "字元對應表" + IDS_UNICODE "Unicode" + IDS_ALL "All" END diff --git a/base/applications/charmap/map.c b/base/applications/charmap/map.c index 7b2d7838ef8..334980b3f61 100644 --- a/base/applications/charmap/map.c +++ b/base/applications/charmap/map.c @@ -10,6 +10,7 @@ #include "precomp.h"
#include <stdlib.h> +#include <winnls.h>
static const WCHAR szMapWndClass[] = L"FontMapWnd"; static const WCHAR szLrgCellWndClass[] = L"LrgCellWnd"; @@ -40,6 +41,7 @@ SetGrid(PMAP infoPtr) } }
+ static VOID DrawActiveCell(PMAP infoPtr, @@ -111,6 +113,8 @@ FillGrid(PMAP infoPtr, for (y = 0; y < YCELLS; y++) for (x = 0; x < XCELLS; x++) { + if (i >= infoPtr->NumValidGlyphs) break; + ch = (WCHAR)infoPtr->ValidGlyphs[i];
Cell = &infoPtr->Cells[y][x]; @@ -206,6 +210,38 @@ MoveLargeCell(PMAP infoPtr) }
+static +VOID +GetPossibleCharacters(WCHAR* ch, INT chLen, INT codePageIdx) +{ + INT i, j; + + memset(ch, 0, sizeof(ch[0]) * chLen); + + if (codePageIdx <= 0 || codePageIdx > SIZEOF(codePages)) + { + /* this is unicode, so just load up the first MAX_GLYPHS characters + start at 0x21 to bypass whitespace characters */ + INT len = min(MAX_GLYPHS, chLen); + for (i = 0x21, j = 0; i < len; i++) + ch[j++] = (WCHAR)i; + } + else + { + /* This is a codepage, so use NLS to translate the first 256 characters */ + CHAR multiByteString[256] = { 0 }; + for (i = 0x21; i < SIZEOF(multiByteString); i++) + multiByteString[i] = (CHAR)i; + + if (!MultiByteToWideChar(codePages[codePageIdx - 1], 0, multiByteString, sizeof(multiByteString), ch, chLen)) + { + /* Failed for some reason, so clear the array */ + memset(ch, 0, sizeof(ch[0]) * chLen); + } + } +} + + static VOID SetFont(PMAP infoPtr, @@ -230,9 +266,9 @@ SetFont(PMAP infoPtr, infoPtr->CurrentFont.lfHeight = GetDeviceCaps(hdc, LOGPIXELSY) / 5;
infoPtr->CurrentFont.lfCharSet = DEFAULT_CHARSET; - wcsncpy(infoPtr->CurrentFont.lfFaceName, - lpFontName, - sizeof(infoPtr->CurrentFont.lfFaceName) / sizeof(infoPtr->CurrentFont.lfFaceName[0])); + lstrcpynW(infoPtr->CurrentFont.lfFaceName, + lpFontName, + SIZEOF(infoPtr->CurrentFont.lfFaceName));
infoPtr->hFont = CreateFontIndirectW(&infoPtr->CurrentFont);
@@ -240,14 +276,17 @@ SetFont(PMAP infoPtr, NULL, TRUE);
+ if (infoPtr->pActiveCell) + infoPtr->pActiveCell->bActive = FALSE; infoPtr->pActiveCell = &infoPtr->Cells[0][0]; + infoPtr->pActiveCell->bActive = TRUE;
// Get all the valid glyphs in this font
SelectObject(hdc, infoPtr->hFont);
- for (i = 0; i < MAX_GLYPHS; i++) - ch[i] = (WCHAR)i; + // Get the code page associated with the selected 'character set' + GetPossibleCharacters(ch, MAX_GLYPHS, infoPtr->CharMap);
if (GetGlyphIndicesW(hdc, ch, @@ -256,9 +295,9 @@ SetFont(PMAP infoPtr, GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR) { j = 0; - for (i = ' ' + 1; i < MAX_GLYPHS; i++) + for (i = 0; i < MAX_GLYPHS; i++) { - if (out[i] != 0xffff) + if (out[i] != 0xffff && out[i] != 0x0000 && ch[i] != 0x0000) { infoPtr->ValidGlyphs[j] = ch[i]; j++; @@ -312,10 +351,27 @@ OnClick(PMAP infoPtr, WORD ptx, WORD pty) { - INT x, y; - - x = ptx / max(1, infoPtr->CellSize.cx); - y = pty / max(1, infoPtr->CellSize.cy); + INT x, y, i; + + /* + * Find the cell the mouse pointer is over. + * Since each cell is the same size, this can be done quickly using CellSize. + * Clamp to XCELLS - 1 and YCELLS - 1 because the map can sometimes be slightly + * larger than infoPtr.CellSize * XCELLS , due to the map size being a non integer + * multiple of infoPtr.CellSize . + */ + x = min(XCELLS - 1, ptx / max(1, infoPtr->CellSize.cx)); + y = min(YCELLS - 1, pty / max(1, infoPtr->CellSize.cy)); + + /* Make sure the mouse is within a valid glyph */ + i = XCELLS * infoPtr->iYStart + y * XCELLS + x; + if (i >= infoPtr->NumValidGlyphs) + { + if (infoPtr->pActiveCell) + infoPtr->pActiveCell->bActive = FALSE; + infoPtr->pActiveCell = NULL; + return; + }
/* if the cell is not already active */ if (!infoPtr->Cells[y][x].bActive) @@ -447,6 +503,15 @@ OnVScroll(PMAP infoPtr, if (abs(iYDiff) < YCELLS) { RECT rect; + + /* Invalidate the rect around the active cell since a new cell will become active */ + if (infoPtr->pActiveCell && infoPtr->pActiveCell->bActive) + { + InvalidateRect(infoPtr->hMapWnd, + &infoPtr->pActiveCell->CellExt, + TRUE); + } + GetClientRect(infoPtr->hMapWnd, &rect); rect.top += 2; rect.bottom -= 2; @@ -524,6 +589,7 @@ MapWndProc(HWND hwnd, { PMAP infoPtr; LRESULT Ret = 0; + WCHAR lfFaceName[LF_FACESIZE];
infoPtr = (PMAP)GetWindowLongPtrW(hwnd, 0); @@ -564,6 +630,9 @@ MapWndProc(HWND hwnd,
case WM_LBUTTONDBLCLK: { + if (!infoPtr->pActiveCell) + break; + NotifyParentOfSelection(infoPtr, FM_SETCHAR, infoPtr->pActiveCell->ch); @@ -588,6 +657,14 @@ MapWndProc(HWND hwnd, break; }
+ case FM_SETCHARMAP: + infoPtr->CharMap = LOWORD(wParam); + wcsncpy(lfFaceName, + infoPtr->CurrentFont.lfFaceName, + SIZEOF(lfFaceName)); + SetFont(infoPtr, lfFaceName); + break; + case FM_SETFONT: SetFont(infoPtr, (LPWSTR)lParam); break; diff --git a/base/applications/charmap/precomp.h b/base/applications/charmap/precomp.h index 132f275d4eb..5899180bb43 100644 --- a/base/applications/charmap/precomp.h +++ b/base/applications/charmap/precomp.h @@ -19,10 +19,17 @@ #define XLARGE 45 #define YLARGE 25
-#define FM_SETFONT (WM_USER + 1) -#define FM_GETCHAR (WM_USER + 2) -#define FM_SETCHAR (WM_USER + 3) -#define FM_GETHFONT (WM_USER + 4) +#define FM_SETFONT (WM_USER + 1) +#define FM_GETCHAR (WM_USER + 2) +#define FM_SETCHAR (WM_USER + 3) +#define FM_GETHFONT (WM_USER + 4) +#define FM_SETCHARMAP (WM_USER + 5) + +// the code pages to display in the advanced 'character set' combobox +static const UINT codePages[] = { + 864, 775, 863, 855, 737, 856, 862, 861, 852, 869, 850, 858, 865, 860, 866, 857, 437, // OEM code pages + 1256, 1257, 1250, 1251, 1253, 1255, 932, 949, 1252, 936, 874, 950, 1254, 1258 // ANSI code pages +};
extern HINSTANCE hInstance;
@@ -48,6 +55,7 @@ typedef struct _MAP LOGFONTW CurrentFont; INT iYStart; INT NumRows; + INT CharMap;
USHORT ValidGlyphs[MAX_GLYPHS]; USHORT NumValidGlyphs; diff --git a/base/applications/charmap/resource.h b/base/applications/charmap/resource.h index 06f5aab0d66..6cee866981e 100644 --- a/base/applications/charmap/resource.h +++ b/base/applications/charmap/resource.h @@ -28,3 +28,5 @@ #define IDS_LICENSE 1010 #define IDS_ABOUT 1011 #define IDS_TITLE 1012 +#define IDS_UNICODE 1013 +#define IDS_ALL 1014