mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 04:35:53 +00:00
- 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 svn path=/trunk/; revision=32194
This commit is contained in:
parent
21ab956cf9
commit
3a86c280a8
11 changed files with 94 additions and 42 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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, "Îòêðûòü"
|
||||
|
|
|
@ -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, "³äêðèòè"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue