Author: cfinck
Date: Thu Feb 7 22:14:55 2008
New Revision: 32194
URL:
http://svn.reactos.org/svn/reactos?rev=32194&view=rev
Log:
- Open the Edit windows as modeless dialogs, so the user can edit more than one character
at the same time
- Simplify the linked-list functions
Modified:
trunk/rosapps/devutils/vgafontedit/editglyphdlg.c
trunk/rosapps/devutils/vgafontedit/fontboxeswnd.c
trunk/rosapps/devutils/vgafontedit/fontwnd.c
trunk/rosapps/devutils/vgafontedit/lang/de-DE.rc
trunk/rosapps/devutils/vgafontedit/lang/en-US.rc
trunk/rosapps/devutils/vgafontedit/lang/pl-PL.rc
trunk/rosapps/devutils/vgafontedit/lang/ru-RU.rc
trunk/rosapps/devutils/vgafontedit/lang/uk-UA.rc
trunk/rosapps/devutils/vgafontedit/main.rc
trunk/rosapps/devutils/vgafontedit/precomp.h
trunk/rosapps/devutils/vgafontedit/resource.h
Modified: trunk/rosapps/devutils/vgafontedit/editglyphdlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/editg…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/editglyphdlg.c (original)
+++ trunk/rosapps/devutils/vgafontedit/editglyphdlg.c Thu Feb 7 22:14:55 2008
@@ -90,8 +90,26 @@
// 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;
}
@@ -111,14 +129,6 @@
{
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;
Modified: trunk/rosapps/devutils/vgafontedit/fontboxeswnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/fontb…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/fontboxeswnd.c (original)
+++ trunk/rosapps/devutils/vgafontedit/fontboxeswnd.c Thu Feb 7 22:14:55 2008
@@ -189,12 +189,41 @@
{
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
Modified: trunk/rosapps/devutils/vgafontedit/fontwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/fontw…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/fontwnd.c (original)
+++ trunk/rosapps/devutils/vgafontedit/fontwnd.c Thu Feb 7 22:14:55 2008
@@ -122,6 +122,19 @@
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 @@
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)
- {
+ if(Info->NextFontWnd)
+ Info->NextFontWnd->PrevFontWnd = Info->PrevFontWnd;
+ else
Info->MainWndInfo->LastFontWnd = Info->PrevFontWnd;
-
- if(Info->PrevFontWnd)
- Info->PrevFontWnd->NextFontWnd = NULL;
- }
- else
- Info->NextFontWnd->PrevFontWnd = Info->PrevFontWnd;
// Free memory
if(Info->Font)
@@ -394,17 +397,14 @@
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;
- }
- else
- {
+ Info->MainWndInfo->LastFontWnd->NextFontWnd = Info;
+ else
Info->MainWndInfo->FirstFontWnd = Info;
- Info->MainWndInfo->LastFontWnd = Info;
- }
+
+ Info->MainWndInfo->LastFontWnd = Info;
return TRUE;
}
Modified: trunk/rosapps/devutils/vgafontedit/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/lang/…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/lang/de-DE.rc (original)
+++ trunk/rosapps/devutils/vgafontedit/lang/de-DE.rc Thu Feb 7 22:14:55 2008
@@ -20,7 +20,7 @@
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 @@
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"
Modified: trunk/rosapps/devutils/vgafontedit/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/lang/…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/lang/en-US.rc (original)
+++ trunk/rosapps/devutils/vgafontedit/lang/en-US.rc Thu Feb 7 22:14:55 2008
@@ -20,7 +20,7 @@
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 @@
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"
Modified: trunk/rosapps/devutils/vgafontedit/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/lang/…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/lang/pl-PL.rc (original)
+++ trunk/rosapps/devutils/vgafontedit/lang/pl-PL.rc Thu Feb 7 22:14:55 2008
@@ -20,7 +20,7 @@
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 @@
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"
Modified: trunk/rosapps/devutils/vgafontedit/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/lang/…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/lang/ru-RU.rc (original)
+++ trunk/rosapps/devutils/vgafontedit/lang/ru-RU.rc Thu Feb 7 22:14:55 2008
@@ -20,7 +20,7 @@
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 @@
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, "Îòêðûòü"
Modified: trunk/rosapps/devutils/vgafontedit/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/lang/…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/lang/uk-UA.rc (original)
+++ trunk/rosapps/devutils/vgafontedit/lang/uk-UA.rc Thu Feb 7 22:14:55 2008
@@ -20,7 +20,7 @@
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 @@
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, "³äêðèòè"
Modified: trunk/rosapps/devutils/vgafontedit/main.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/main.…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/main.rc (original)
+++ trunk/rosapps/devutils/vgafontedit/main.rc Thu Feb 7 22:14:55 2008
@@ -29,8 +29,8 @@
IDI_DOC ICON "res/doc.ico"
// Languages
+#include "lang/de-DE.rc"
#include "lang/en-US.rc"
-#include "lang/de-DE.rc"
-#include "lang/uk-UA.rc"
#include "lang/pl-PL.rc"
#include "lang/ru-RU.rc"
+#include "lang/uk-UA.rc"
Modified: trunk/rosapps/devutils/vgafontedit/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/preco…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/precomp.h (original)
+++ trunk/rosapps/devutils/vgafontedit/precomp.h Thu Feb 7 22:14:55 2008
@@ -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 @@
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 @@
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
Modified: trunk/rosapps/devutils/vgafontedit/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/resou…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/resource.h (original)
+++ trunk/rosapps/devutils/vgafontedit/resource.h Thu Feb 7 22:14:55 2008
@@ -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