// 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;
}
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;
{
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
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;
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;
- }
+ if(Info->NextFontWnd)
+ Info->NextFontWnd->PrevFontWnd = Info->PrevFontWnd;
else
- Info->PrevFontWnd->NextFontWnd = Info->NextFontWnd;
-
- if(Info->MainWndInfo->LastFontWnd == Info)
- {
Info->MainWndInfo->LastFontWnd = Info->PrevFontWnd;
- if(Info->PrevFontWnd)
- Info->PrevFontWnd->NextFontWnd = NULL;
- }
- else
- Info->NextFontWnd->PrevFontWnd = Info->PrevFontWnd;
-
// Free memory
if(Info->Font)
HeapFree(hProcessHeap, 0, Info->Font);
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;
}
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"
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"
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"
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"
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"
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"
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"
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, "Îòêðûòü"
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"
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, "³äêðèòè"
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"
// 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
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;
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
#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