diff --git a/rosapps/devutils/vgafontedit/editglyphdlg.c b/rosapps/devutils/vgafontedit/editglyphdlg.c index 09daa0f24e7..634554efcbd 100644 --- a/rosapps/devutils/vgafontedit/editglyphdlg.c +++ b/rosapps/devutils/vgafontedit/editglyphdlg.c @@ -90,8 +90,26 @@ EditGlyphCommand(IN INT idCommand, IN PEDIT_GLYPH_INFO Info) // Fall through } + // This is the equivalent of WM_DESTROY for dialogs case IDCANCEL: EndDialog(Info->hSelf, 0); + + // Remove the window from the linked list + if(Info->PrevEditGlyphWnd) + Info->PrevEditGlyphWnd->NextEditGlyphWnd = Info->NextEditGlyphWnd; + else + Info->FontWndInfo->FirstEditGlyphWnd = Info->NextEditGlyphWnd; + + if(Info->NextEditGlyphWnd) + Info->NextEditGlyphWnd->PrevEditGlyphWnd = Info->PrevEditGlyphWnd; + else + Info->FontWndInfo->LastEditGlyphWnd = Info->PrevEditGlyphWnd; + + SetWindowLongW(Info->hSelf, GWLP_USERDATA, 0); + SetWindowLongW(Info->hEdit, GWLP_USERDATA, 0); + SetWindowLongW(Info->hPreview, GWLP_USERDATA, 0 ); + + HeapFree(hProcessHeap, 0, Info); return TRUE; } @@ -112,14 +130,6 @@ EditGlyphDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: return EditGlyphCommand( LOWORD(wParam), Info ); - case WM_DESTROY: - SetWindowLongW(hwnd, GWLP_USERDATA, 0); - SetWindowLongW(Info->hEdit, GWLP_USERDATA, 0); - SetWindowLongW(Info->hPreview, GWLP_USERDATA, 0 ); - - HeapFree(hProcessHeap, 0, Info); - return TRUE; - case WM_INITDIALOG: Info = (PEDIT_GLYPH_INFO) lParam; Info->hSelf = hwnd; diff --git a/rosapps/devutils/vgafontedit/fontboxeswnd.c b/rosapps/devutils/vgafontedit/fontboxeswnd.c index 9457ae2cd22..12629530a76 100644 --- a/rosapps/devutils/vgafontedit/fontboxeswnd.c +++ b/rosapps/devutils/vgafontedit/fontboxeswnd.c @@ -189,12 +189,41 @@ EditCurrentGlyph(PFONT_WND_INFO FontWndInfo) { PEDIT_GLYPH_INFO EditGlyphInfo; + // Has the window for this character already been opened? + EditGlyphInfo = FontWndInfo->FirstEditGlyphWnd; + + while(EditGlyphInfo) + { + if(EditGlyphInfo->uCharacter == FontWndInfo->uSelectedCharacter) + { + // Yes, it has. Bring it to the front. + SetFocus(EditGlyphInfo->hSelf); + return; + } + + EditGlyphInfo = EditGlyphInfo->NextEditGlyphWnd; + } + + // No. Then create a new one EditGlyphInfo = (PEDIT_GLYPH_INFO) HeapAlloc( hProcessHeap, 0, sizeof(EDIT_GLYPH_INFO) ); EditGlyphInfo->FontWndInfo = FontWndInfo; EditGlyphInfo->uCharacter = FontWndInfo->uSelectedCharacter; RtlCopyMemory( EditGlyphInfo->CharacterBits, FontWndInfo->Font->Bits + FontWndInfo->uSelectedCharacter * 8, sizeof(EditGlyphInfo->CharacterBits) ); - DialogBoxParamW(hInstance, MAKEINTRESOURCEW(IDD_EDITGLYPH), FontWndInfo->hSelf, EditGlyphDlgProc, (LPARAM)EditGlyphInfo); + // Add the new window to the linked list + EditGlyphInfo->PrevEditGlyphWnd = FontWndInfo->LastEditGlyphWnd; + EditGlyphInfo->NextEditGlyphWnd = NULL; + + if(FontWndInfo->LastEditGlyphWnd) + FontWndInfo->LastEditGlyphWnd->NextEditGlyphWnd = EditGlyphInfo; + else + FontWndInfo->FirstEditGlyphWnd = EditGlyphInfo; + + FontWndInfo->LastEditGlyphWnd = EditGlyphInfo; + + // Open the window as a modeless dialog, so people can edit several characters at the same time. + EditGlyphInfo->hSelf = CreateDialogParamW(hInstance, MAKEINTRESOURCEW(IDD_EDITGLYPH), FontWndInfo->hSelf, EditGlyphDlgProc, (LPARAM)EditGlyphInfo); + ShowWindow(EditGlyphInfo->hSelf, SW_SHOW); } VOID diff --git a/rosapps/devutils/vgafontedit/fontwnd.c b/rosapps/devutils/vgafontedit/fontwnd.c index 2a91fc8df76..87cd3097c3c 100644 --- a/rosapps/devutils/vgafontedit/fontwnd.c +++ b/rosapps/devutils/vgafontedit/fontwnd.c @@ -122,6 +122,19 @@ FontWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_USER_APPCLOSE: case WM_CLOSE: + // The user has to close all open edit dialogs first + if(Info->FirstEditGlyphWnd) + { + PWSTR pszMessage; + + AllocAndLoadString(&pszMessage, IDS_CLOSEEDIT); + MessageBoxW(hwnd, pszMessage, szAppName, MB_OK | MB_ICONEXCLAMATION); + HeapFree(hProcessHeap, 0, pszMessage); + + return 0; + } + + // Prompt if the current file has been modified if(Info->OpenInfo->bModified) { INT nMsgBoxResult; @@ -164,25 +177,15 @@ FontWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_DESTROY: // Remove the window from the linked list - if(Info->MainWndInfo->FirstFontWnd == Info) - { + if(Info->PrevFontWnd) + Info->PrevFontWnd->NextFontWnd = Info->NextFontWnd; + else Info->MainWndInfo->FirstFontWnd = Info->NextFontWnd; - if(Info->NextFontWnd) - Info->NextFontWnd->PrevFontWnd = NULL; - } - else - Info->PrevFontWnd->NextFontWnd = Info->NextFontWnd; - - if(Info->MainWndInfo->LastFontWnd == Info) - { - Info->MainWndInfo->LastFontWnd = Info->PrevFontWnd; - - if(Info->PrevFontWnd) - Info->PrevFontWnd->NextFontWnd = NULL; - } - else + if(Info->NextFontWnd) Info->NextFontWnd->PrevFontWnd = Info->PrevFontWnd; + else + Info->MainWndInfo->LastFontWnd = Info->PrevFontWnd; // Free memory if(Info->Font) @@ -394,17 +397,14 @@ CreateFontWindow(IN PMAIN_WND_INFO MainWndInfo, IN PFONT_OPEN_INFO OpenInfo) if(hFontWnd) { // Add the new window to the linked list + Info->PrevFontWnd = Info->MainWndInfo->LastFontWnd; + if(Info->MainWndInfo->LastFontWnd) - { - Info->PrevFontWnd = Info->MainWndInfo->LastFontWnd; - Info->PrevFontWnd->NextFontWnd = Info; - Info->MainWndInfo->LastFontWnd = Info; - } + Info->MainWndInfo->LastFontWnd->NextFontWnd = Info; else - { Info->MainWndInfo->FirstFontWnd = Info; - Info->MainWndInfo->LastFontWnd = Info; - } + + Info->MainWndInfo->LastFontWnd = Info; return TRUE; } diff --git a/rosapps/devutils/vgafontedit/lang/de-DE.rc b/rosapps/devutils/vgafontedit/lang/de-DE.rc index d55985b1d01..c52619f4e87 100644 --- a/rosapps/devutils/vgafontedit/lang/de-DE.rc +++ b/rosapps/devutils/vgafontedit/lang/de-DE.rc @@ -20,7 +20,7 @@ BEGIN DEFPUSHBUTTON "OK", IDCANCEL, 40, 44, 55, 15 END -IDD_EDITGLYPH DIALOGEX 10, 10, 246, 197 +IDD_EDITGLYPH DIALOGEX 32768, 32768, 246, 197 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Schriftzeichen bearbeiten" FONT 8, "MS Shell Dlg" @@ -75,6 +75,7 @@ BEGIN IDS_DOCNAME, "Font %1!u!" IDS_SAVEPROMPT, "Die Datei ""%1"" wurde geändert.\n\nMöchten Sie die Änderungen speichern?" IDS_APPTITLE, "ReactOS VGA Font Editor" + IDS_CLOSEEDIT, "Bitte schließen Sie zuerst alle offenen Bearbeitungs-Fenster!" IDS_TOOLTIP_NEW, "Neu" IDS_TOOLTIP_OPEN, "Öffnen" diff --git a/rosapps/devutils/vgafontedit/lang/en-US.rc b/rosapps/devutils/vgafontedit/lang/en-US.rc index 831460d273d..804ee7dbfb7 100644 --- a/rosapps/devutils/vgafontedit/lang/en-US.rc +++ b/rosapps/devutils/vgafontedit/lang/en-US.rc @@ -20,7 +20,7 @@ BEGIN DEFPUSHBUTTON "OK", IDCANCEL, 40, 44, 55, 15 END -IDD_EDITGLYPH DIALOGEX 10, 10, 246, 197 +IDD_EDITGLYPH DIALOGEX 32768, 32768, 246, 197 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Edit Glyph" FONT 8, "MS Shell Dlg" @@ -75,6 +75,7 @@ BEGIN IDS_DOCNAME, "Font %1!u!" IDS_SAVEPROMPT, "The file ""%1"" was modified, but not saved.\n\nDo you want to save it?" IDS_APPTITLE, "ReactOS VGA Font Editor" + IDS_CLOSEEDIT, "Please close all open Edit windows first!" IDS_TOOLTIP_NEW, "New" IDS_TOOLTIP_OPEN, "Open" diff --git a/rosapps/devutils/vgafontedit/lang/pl-PL.rc b/rosapps/devutils/vgafontedit/lang/pl-PL.rc index b5a1c50e65e..f99865417dc 100644 --- a/rosapps/devutils/vgafontedit/lang/pl-PL.rc +++ b/rosapps/devutils/vgafontedit/lang/pl-PL.rc @@ -20,7 +20,7 @@ BEGIN DEFPUSHBUTTON "OK", IDCANCEL, 40, 44, 55, 15 END -IDD_EDITGLYPH DIALOGEX 10, 10, 246, 197 +IDD_EDITGLYPH DIALOGEX 32768, 32768, 246, 197 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Edycja Glifów" FONT 8, "MS Shell Dlg" @@ -75,6 +75,7 @@ BEGIN IDS_DOCNAME, "Czcionka %1!u!" IDS_SAVEPROMPT, "Plik ""%1"" zosta³ zmieniony, ale nie zapisany.\n\nCzy chcesz zapisaæ zmiany?" IDS_APPTITLE, "ReactOS VGA Font Editor" + IDS_CLOSEEDIT, "Please close all open Edit windows first!" IDS_TOOLTIP_NEW, "Nowy" IDS_TOOLTIP_OPEN, "Otwórz" diff --git a/rosapps/devutils/vgafontedit/lang/ru-RU.rc b/rosapps/devutils/vgafontedit/lang/ru-RU.rc index 48fe9c32b21..41ab53fdf09 100644 --- a/rosapps/devutils/vgafontedit/lang/ru-RU.rc +++ b/rosapps/devutils/vgafontedit/lang/ru-RU.rc @@ -20,7 +20,7 @@ BEGIN DEFPUSHBUTTON "OK", IDCANCEL, 40, 44, 55, 15 END -IDD_EDITGLYPH DIALOGEX 10, 10, 246, 197 +IDD_EDITGLYPH DIALOGEX 32768, 32768, 246, 197 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Ðåäàêòèðîâàíèå ñèìâîëà" FONT 8, "MS Shell Dlg" @@ -75,6 +75,7 @@ BEGIN IDS_DOCNAME, "Øðèôò %1!u!" IDS_SAVEPROMPT, "Ôàéë ""%1"" áûë èçìåíåí è èçìåíåíèÿ íå áûëè ñîõðàíåíû.\n\nÑîõðàíèòü?" IDS_APPTITLE, "Ðåäàêòîð VGA-øðèôòîâ ReactOS" + IDS_CLOSEEDIT, "Please close all open Edit windows first!" IDS_TOOLTIP_NEW, "Íîâûé" IDS_TOOLTIP_OPEN, "Îòêðûòü" diff --git a/rosapps/devutils/vgafontedit/lang/uk-UA.rc b/rosapps/devutils/vgafontedit/lang/uk-UA.rc index d53f9726467..6a12d8592d8 100644 --- a/rosapps/devutils/vgafontedit/lang/uk-UA.rc +++ b/rosapps/devutils/vgafontedit/lang/uk-UA.rc @@ -20,7 +20,7 @@ BEGIN DEFPUSHBUTTON "OK", IDCANCEL, 40, 44, 55, 15 END -IDD_EDITGLYPH DIALOGEX 10, 10, 246, 197 +IDD_EDITGLYPH DIALOGEX 32768, 32768, 246, 197 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Edit Glyph" FONT 8, "MS Shell Dlg" @@ -75,6 +75,7 @@ BEGIN IDS_DOCNAME, "Øðèôò %1!u!" IDS_SAVEPROMPT, "Ôàéë ""%1"" áóâ çì³íåíèé, àëå íå çáåðåæåíèé.\n\nÇáåðåãòè éîãî?" IDS_APPTITLE, "ReactOS VGA Font Editor" + IDS_CLOSEEDIT, "Please close all open Edit windows first!" IDS_TOOLTIP_NEW, "Ñòâîðèòè" IDS_TOOLTIP_OPEN, "³äêðèòè" diff --git a/rosapps/devutils/vgafontedit/main.rc b/rosapps/devutils/vgafontedit/main.rc index 0e7a01b630d..a93545fca9f 100644 --- a/rosapps/devutils/vgafontedit/main.rc +++ b/rosapps/devutils/vgafontedit/main.rc @@ -29,8 +29,8 @@ IDI_MAIN ICON "res/main.ico" IDI_DOC ICON "res/doc.ico" // Languages -#include "lang/en-US.rc" #include "lang/de-DE.rc" -#include "lang/uk-UA.rc" +#include "lang/en-US.rc" #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/rosapps/devutils/vgafontedit/precomp.h b/rosapps/devutils/vgafontedit/precomp.h index 935be09df56..f4ee5d8bfdb 100644 --- a/rosapps/devutils/vgafontedit/precomp.h +++ b/rosapps/devutils/vgafontedit/precomp.h @@ -17,6 +17,7 @@ // Forward declarations typedef struct _FONT_WND_INFO FONT_WND_INFO, *PFONT_WND_INFO; +typedef struct _EDIT_GLYPH_INFO EDIT_GLYPH_INFO, *PEDIT_GLYPH_INFO; // Structure declarations typedef struct _BITMAP_FONT @@ -60,9 +61,12 @@ struct _FONT_WND_INFO PFONT_WND_INFO PrevFontWnd; PFONT_WND_INFO NextFontWnd; + + PEDIT_GLYPH_INFO FirstEditGlyphWnd; + PEDIT_GLYPH_INFO LastEditGlyphWnd; }; -typedef struct _EDIT_GLYPH_INFO +struct _EDIT_GLYPH_INFO { PFONT_WND_INFO FontWndInfo; @@ -73,7 +77,10 @@ typedef struct _EDIT_GLYPH_INFO HWND hEdit; HWND hPreview; LONG lEditSpacing; -} EDIT_GLYPH_INFO, *PEDIT_GLYPH_INFO; + + PEDIT_GLYPH_INFO PrevEditGlyphWnd; + PEDIT_GLYPH_INFO NextEditGlyphWnd; +}; #define ID_MDI_FIRSTCHILD 50000 diff --git a/rosapps/devutils/vgafontedit/resource.h b/rosapps/devutils/vgafontedit/resource.h index dd9518f8720..189f43957d2 100644 --- a/rosapps/devutils/vgafontedit/resource.h +++ b/rosapps/devutils/vgafontedit/resource.h @@ -65,6 +65,7 @@ #define IDS_DOCNAME 10008 #define IDS_SAVEPROMPT 10009 #define IDS_APPTITLE 10010 +#define IDS_CLOSEEDIT 10011 #define IDS_TOOLTIP_NEW 11001 #define IDS_TOOLTIP_OPEN 11002