Author: cfinck
Date: Mon Feb 25 21:01:06 2008
New Revision: 32482
URL:
http://svn.reactos.org/svn/reactos?rev=32482&view=rev
Log:
- Add Copy & Paste functions for whole characters
- Add an "Edit" menu now that we have some more menu items belonging to this
category
Modified:
trunk/rosapps/devutils/vgafontedit/fontwnd.c
trunk/rosapps/devutils/vgafontedit/lang/bg-BG.rc
trunk/rosapps/devutils/vgafontedit/lang/de-DE.rc
trunk/rosapps/devutils/vgafontedit/lang/en-US.rc
trunk/rosapps/devutils/vgafontedit/lang/fr-FR.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.c
trunk/rosapps/devutils/vgafontedit/main.rc
trunk/rosapps/devutils/vgafontedit/mainwnd.c
trunk/rosapps/devutils/vgafontedit/precomp.h
trunk/rosapps/devutils/vgafontedit/resource.h
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 Mon Feb 25 21:01:06 2008
@@ -108,6 +108,7 @@
case WM_CHILDACTIVATE:
Info->MainWndInfo->CurrentFontWnd = Info;
SetToolbarFileButtonState(Info->MainWndInfo, TRUE);
+ SetPasteButtonState(Info->MainWndInfo);
break;
case WM_CREATE:
@@ -165,6 +166,7 @@
// Otherwise CurrentFontWnd will stay NULL, so the main window knows that
no more childs are opened.
Info->MainWndInfo->CurrentFontWnd = NULL;
SetToolbarFileButtonState(Info->MainWndInfo, FALSE);
+ SetPasteButtonState(Info->MainWndInfo);
if(uMsg == WM_USER_APPCLOSE)
{
Modified: trunk/rosapps/devutils/vgafontedit/lang/bg-BG.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/lang/…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/lang/bg-BG.rc (original)
+++ trunk/rosapps/devutils/vgafontedit/lang/bg-BG.rc Mon Feb 25 21:01:06 2008
@@ -47,6 +47,14 @@
MENUITEM "Èçõîä êàòî\tAlt+F4", ID_FILE_EXIT
END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY
+ MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE
+ MENUITEM SEPARATOR
+ MENUITEM "Edit Glyph...", ID_EDIT_GLYPH
+ END
+
POPUP "&Ïðîçîðåö"
BEGIN
MENUITEM "&Íàäèïëÿíå", ID_WINDOW_CASCADE
@@ -81,4 +89,6 @@
IDS_TOOLTIP_OPEN, "Îòâàðÿíå"
IDS_TOOLTIP_SAVE, "Çàïèñ"
IDS_TOOLTIP_EDIT_GLYPH, "Îáðàáîòêà íà çíàê"
+ IDS_TOOLTIP_COPY, "Copy"
+ IDS_TOOLTIP_PASTE, "Paste"
END
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 Mon Feb 25 21:01:06 2008
@@ -47,6 +47,14 @@
MENUITEM "Beenden\tAlt+F4", ID_FILE_EXIT
END
+ POPUP "&Bearbeiten"
+ BEGIN
+ MENUITEM "Kopieren\tStrg+C", ID_EDIT_COPY
+ MENUITEM "Einfügen\tStrg+V", ID_EDIT_PASTE
+ MENUITEM SEPARATOR
+ MENUITEM "Schriftzeichen bearbeiten...", ID_EDIT_GLYPH
+ END
+
POPUP "&Fenster"
BEGIN
MENUITEM "&Überlappend", ID_WINDOW_CASCADE
@@ -81,4 +89,6 @@
IDS_TOOLTIP_OPEN, "Öffnen"
IDS_TOOLTIP_SAVE, "Speichern"
IDS_TOOLTIP_EDIT_GLYPH, "Schriftzeichen bearbeiten"
+ IDS_TOOLTIP_COPY, "Kopieren"
+ IDS_TOOLTIP_PASTE, "Einfügen"
END
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 Mon Feb 25 21:01:06 2008
@@ -47,6 +47,14 @@
MENUITEM "Exit\tAlt+F4", ID_FILE_EXIT
END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY
+ MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE
+ MENUITEM SEPARATOR
+ MENUITEM "Edit Glyph...", ID_EDIT_GLYPH
+ END
+
POPUP "&Window"
BEGIN
MENUITEM "&Cascade", ID_WINDOW_CASCADE
@@ -81,4 +89,6 @@
IDS_TOOLTIP_OPEN, "Open"
IDS_TOOLTIP_SAVE, "Save"
IDS_TOOLTIP_EDIT_GLYPH, "Edit Glyph"
+ IDS_TOOLTIP_COPY, "Copy"
+ IDS_TOOLTIP_PASTE, "Paste"
END
Modified: trunk/rosapps/devutils/vgafontedit/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/lang/…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/lang/fr-FR.rc (original)
+++ trunk/rosapps/devutils/vgafontedit/lang/fr-FR.rc Mon Feb 25 21:01:06 2008
@@ -47,6 +47,14 @@
MENUITEM "Quitter\tAlt+F4", ID_FILE_EXIT
END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY
+ MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE
+ MENUITEM SEPARATOR
+ MENUITEM "Edit Glyph...", ID_EDIT_GLYPH
+ END
+
POPUP "Fenêtres"
BEGIN
MENUITEM "En &cascade", ID_WINDOW_CASCADE
@@ -81,4 +89,6 @@
IDS_TOOLTIP_OPEN, "Ouvrir"
IDS_TOOLTIP_SAVE, "Enregistrer"
IDS_TOOLTIP_EDIT_GLYPH, "Éditer le glyphe"
+ IDS_TOOLTIP_COPY, "Copy"
+ IDS_TOOLTIP_PASTE, "Paste"
END
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 Mon Feb 25 21:01:06 2008
@@ -47,6 +47,14 @@
MENUITEM "Wyjd\tAlt+F4", ID_FILE_EXIT
END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY
+ MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE
+ MENUITEM SEPARATOR
+ MENUITEM "Edit Glyph...", ID_EDIT_GLYPH
+ END
+
POPUP "&Okna"
BEGIN
MENUITEM "&Kaskadowo", ID_WINDOW_CASCADE
@@ -81,4 +89,6 @@
IDS_TOOLTIP_OPEN, "Otwórz"
IDS_TOOLTIP_SAVE, "Zapisz"
IDS_TOOLTIP_EDIT_GLYPH, "Edytuj Glify"
+ IDS_TOOLTIP_COPY, "Copy"
+ IDS_TOOLTIP_PASTE, "Paste"
END
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 Mon Feb 25 21:01:06 2008
@@ -47,6 +47,14 @@
MENUITEM "Âûõîä\tAlt+F4", ID_FILE_EXIT
END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY
+ MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE
+ MENUITEM SEPARATOR
+ MENUITEM "Edit Glyph...", ID_EDIT_GLYPH
+ END
+
POPUP "&Îêíà"
BEGIN
MENUITEM "&Êàñêàäîì", ID_WINDOW_CASCADE
@@ -81,4 +89,6 @@
IDS_TOOLTIP_OPEN, "Îòêðûòü"
IDS_TOOLTIP_SAVE, "Ñîõðàíèòü"
IDS_TOOLTIP_EDIT_GLYPH, "Ðåäàêòèðîâàòü ñèìâîë"
+ IDS_TOOLTIP_COPY, "Copy"
+ IDS_TOOLTIP_PASTE, "Paste"
END
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 Mon Feb 25 21:01:06 2008
@@ -47,6 +47,14 @@
MENUITEM "Â&èõ³ä\tAlt+F4", ID_FILE_EXIT
END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY
+ MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE
+ MENUITEM SEPARATOR
+ MENUITEM "Edit Glyph...", ID_EDIT_GLYPH
+ END
+
POPUP "&³êíî"
BEGIN
MENUITEM "&Êàñêàäîì", ID_WINDOW_CASCADE
@@ -81,4 +89,6 @@
IDS_TOOLTIP_OPEN, "³äêðèòè"
IDS_TOOLTIP_SAVE, "Çáåðåãòè"
IDS_TOOLTIP_EDIT_GLYPH, "Ðåäàãóâàòè ñèìâîë"
+ IDS_TOOLTIP_COPY, "Copy"
+ IDS_TOOLTIP_PASTE, "Paste"
END
Modified: trunk/rosapps/devutils/vgafontedit/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/main.…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/main.c (original)
+++ trunk/rosapps/devutils/vgafontedit/main.c Mon Feb 25 21:01:06 2008
@@ -8,9 +8,12 @@
#include "precomp.h"
+static const WCHAR szCharacterClipboardFormat[] = L"RosVgaFontChar";
+
HINSTANCE hInstance;
HANDLE hProcessHeap;
PWSTR szAppName;
+UINT uCharacterClipboardFormat;
INT WINAPI
wWinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
@@ -29,6 +32,10 @@
AllocAndLoadString(&szAppName, IDS_APPTITLE);
hAccel = LoadAcceleratorsW( hInstance, MAKEINTRESOURCEW(IDA_MAINACCELERATORS) );
+
+ uCharacterClipboardFormat = RegisterClipboardFormatW(szCharacterClipboardFormat);
+ if(!uCharacterClipboardFormat)
+ return 1;
if( InitMainWndClass() && InitFontWndClass() &&
InitFontBoxesWndClass() && InitEditGlyphWndClasses() )
{
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 Mon Feb 25 21:01:06 2008
@@ -21,6 +21,8 @@
"N", ID_FILE_NEW, VIRTKEY, CONTROL
"O", ID_FILE_OPEN, VIRTKEY, CONTROL
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
+ "C", ID_EDIT_COPY, VIRTKEY, CONTROL
+ "V", ID_EDIT_PASTE, VIRTKEY, CONTROL
END
IDB_MAIN_TOOLBAR BITMAP "res/toolbar.bmp"
Modified: trunk/rosapps/devutils/vgafontedit/mainwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/vgafontedit/mainw…
==============================================================================
--- trunk/rosapps/devutils/vgafontedit/mainwnd.c (original)
+++ trunk/rosapps/devutils/vgafontedit/mainwnd.c Mon Feb 25 21:01:06 2008
@@ -88,6 +88,7 @@
{
SetToolbarButtonState(Info, ID_FILE_SAVE, bEnabled);
SetToolbarButtonState(Info, ID_EDIT_GLYPH, bEnabled);
+ SetToolbarButtonState(Info, ID_EDIT_COPY, bEnabled);
}
static VOID
@@ -143,11 +144,15 @@
AddToolbarButton(Info, iStandardBitmaps + STD_FILESAVE, ID_FILE_SAVE,
IDS_TOOLTIP_SAVE);
AddToolbarSeparator(Info);
AddToolbarButton(Info, iCustomBitmaps + TOOLBAR_EDIT_GLYPH, ID_EDIT_GLYPH,
IDS_TOOLTIP_EDIT_GLYPH);
+ AddToolbarSeparator(Info);
+ AddToolbarButton(Info, iStandardBitmaps + STD_COPY, ID_EDIT_COPY, IDS_TOOLTIP_COPY);
+ AddToolbarButton(Info, iStandardBitmaps + STD_PASTE, ID_EDIT_PASTE,
IDS_TOOLTIP_PASTE);
SetToolbarFileButtonState(Info, FALSE);
+ SetPasteButtonState(Info);
// Add the MDI client area
- ccs.hWindowMenu = GetSubMenu(Info->hMenu, 1);
+ ccs.hWindowMenu = GetSubMenu(Info->hMenu, 2);
ccs.idFirstChild = ID_MDI_FIRSTCHILD;
Info->hMdiClient = CreateWindowExW(WS_EX_CLIENTEDGE,
@@ -172,11 +177,17 @@
{
UINT uState;
- uState = MF_BYCOMMAND | (Info->CurrentFontWnd == NULL);
+ uState = MF_BYCOMMAND | !(Info->CurrentFontWnd);
EnableMenuItem(Info->hMenu, ID_FILE_CLOSE, uState);
EnableMenuItem(Info->hMenu, ID_FILE_SAVE, uState);
EnableMenuItem(Info->hMenu, ID_FILE_SAVE_AS, uState);
+
+ EnableMenuItem(Info->hMenu, ID_EDIT_COPY, uState);
+ EnableMenuItem(Info->hMenu, ID_EDIT_GLYPH, uState);
+
+ uState = MF_BYCOMMAND | !(Info->CurrentFontWnd &&
IsClipboardFormatAvailable(uCharacterClipboardFormat));
+ EnableMenuItem(Info->hMenu, ID_EDIT_PASTE, uState);
}
static VOID
@@ -248,6 +259,72 @@
CloseHandle(hFile);
}
+static VOID
+CopyCurrentGlyph(IN PFONT_WND_INFO FontWndInfo)
+{
+ HGLOBAL hMem;
+ PUCHAR pCharacterBits;
+
+ if(!OpenClipboard(NULL))
+ return;
+
+ EmptyClipboard();
+
+ hMem = GlobalAlloc(GMEM_MOVEABLE, 8);
+ pCharacterBits = GlobalLock(hMem);
+ RtlCopyMemory(pCharacterBits, FontWndInfo->Font->Bits +
FontWndInfo->uSelectedCharacter * 8, 8);
+ GlobalUnlock(hMem);
+
+ SetClipboardData(uCharacterClipboardFormat, hMem);
+
+ CloseClipboard();
+}
+
+static VOID
+PasteIntoCurrentGlyph(IN PFONT_WND_INFO FontWndInfo)
+{
+ HGLOBAL hMem;
+
+ if(!IsClipboardFormatAvailable(uCharacterClipboardFormat))
+ return;
+
+ if(!OpenClipboard(NULL))
+ return;
+
+ hMem = GetClipboardData(uCharacterClipboardFormat);
+ if(hMem)
+ {
+ PUCHAR pCharacterBits;
+
+ pCharacterBits = GlobalLock(hMem);
+ if(pCharacterBits)
+ {
+ RECT CharacterRect;
+ UINT uFontRow;
+ UINT uFontColumn;
+
+ RtlCopyMemory(FontWndInfo->Font->Bits +
FontWndInfo->uSelectedCharacter * 8, pCharacterBits, 8);
+ GlobalUnlock(hMem);
+
+ FontWndInfo->OpenInfo->bModified = TRUE;
+
+ GetCharacterPosition(FontWndInfo->uSelectedCharacter, &uFontRow,
&uFontColumn);
+ GetCharacterRect(uFontRow, uFontColumn, &CharacterRect);
+ InvalidateRect(FontWndInfo->hFontBoxesWnd, &CharacterRect, FALSE);
+ }
+ }
+
+ CloseClipboard();
+}
+
+VOID
+SetPasteButtonState(IN PMAIN_WND_INFO Info)
+{
+ SetToolbarButtonState(Info,
+ ID_EDIT_PASTE,
+ (Info->CurrentFontWnd &&
IsClipboardFormatAvailable(uCharacterClipboardFormat)));
+}
+
static BOOL
MenuCommand(IN INT nMenuItemID, IN PMAIN_WND_INFO Info)
{
@@ -278,9 +355,17 @@
PostMessage(Info->hMainWnd, WM_CLOSE, 0, 0);
return TRUE;
- // "Edit Glyph" toolbar button
+ // Edit Menu
case ID_EDIT_GLYPH:
EditCurrentGlyph(Info->CurrentFontWnd);
+ return TRUE;
+
+ case ID_EDIT_COPY:
+ CopyCurrentGlyph(Info->CurrentFontWnd);
+ return TRUE;
+
+ case ID_EDIT_PASTE:
+ PasteIntoCurrentGlyph(Info->CurrentFontWnd);
return TRUE;
// Window Menu
@@ -349,6 +434,8 @@
static LRESULT CALLBACK
MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
+ static HWND hNextClipboardViewer;
+
PMAIN_WND_INFO Info;
Info = (PMAIN_WND_INFO) GetWindowLongW(hwnd, GWLP_USERDATA);
@@ -362,6 +449,14 @@
return 0;
break;
+
+ case WM_CHANGECBCHAIN:
+ if((HWND)wParam == hNextClipboardViewer)
+ hNextClipboardViewer = (HWND)lParam;
+ else
+ SendMessage(hNextClipboardViewer, uMsg, wParam, lParam);
+
+ return 0;
case WM_CLOSE:
if(Info->FirstFontWnd)
@@ -392,6 +487,8 @@
Info->hMenu = GetMenu(hwnd);
SetWindowLongW(hwnd, GWLP_USERDATA, (LONG)Info);
+ hNextClipboardViewer = SetClipboardViewer(hwnd);
+
InitMainWnd(Info);
InitResources(Info);
@@ -404,6 +501,13 @@
HeapFree(hProcessHeap, 0, Info);
SetWindowLongW(hwnd, GWLP_USERDATA, 0);
PostQuitMessage(0);
+ return 0;
+
+ case WM_DRAWCLIPBOARD:
+ SetPasteButtonState(Info);
+
+ // Pass the message to the next clipboard window in the chain
+ SendMessage(hNextClipboardViewer, uMsg, wParam, lParam);
return 0;
case WM_INITMENUPOPUP:
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 Mon Feb 25 21:01:06 2008
@@ -147,6 +147,7 @@
extern PWSTR szAppName;
extern HINSTANCE hInstance;
extern HANDLE hProcessHeap;
+extern UINT uCharacterClipboardFormat;
// mainwnd.c
BOOL CreateMainWindow(IN INT nCmdShow, OUT PMAIN_WND_INFO* Info);
@@ -154,6 +155,7 @@
VOID UnInitMainWndClass(VOID);
VOID DoFileSave(IN PMAIN_WND_INFO Info, IN BOOL bSaveAs);
VOID SetToolbarFileButtonState(IN PMAIN_WND_INFO Info, BOOL bEnabled);
+VOID SetPasteButtonState(IN PMAIN_WND_INFO Info);
// misc.c
INT AllocAndLoadString(OUT PWSTR *lpTarget, IN UINT uID);
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 Mon Feb 25 21:01:06 2008
@@ -43,6 +43,8 @@
#define ID_FILE_EXIT 1006
#define ID_EDIT_GLYPH 2001
+#define ID_EDIT_COPY 2002
+#define ID_EDIT_PASTE 2003
#define ID_WINDOW_TILE_HORZ 3001
#define ID_WINDOW_TILE_VERT 3002
@@ -71,5 +73,7 @@
#define IDS_TOOLTIP_OPEN 11002
#define IDS_TOOLTIP_SAVE 11003
#define IDS_TOOLTIP_EDIT_GLYPH 11004
+#define IDS_TOOLTIP_COPY 11005
+#define IDS_TOOLTIP_PASTE 11006
#endif