mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[ROSAPPS][VGAFONTEDIT] Allow file drop (#1165)
- Allow file drop on EXE file. - Allow file drop on the main window.
This commit is contained in:
parent
bba8262bc1
commit
6d47eab526
2 changed files with 41 additions and 2 deletions
|
@ -13,5 +13,5 @@ list(APPEND SOURCE
|
|||
add_executable(vgafontedit ${SOURCE} vgafontedit.rc)
|
||||
add_pch(vgafontedit precomp.h SOURCE)
|
||||
set_module_type(vgafontedit win32gui UNICODE)
|
||||
add_importlibs(vgafontedit user32 gdi32 comdlg32 msvcrt kernel32)
|
||||
add_importlibs(vgafontedit shell32 user32 gdi32 comdlg32 msvcrt kernel32)
|
||||
add_cd_file(TARGET vgafontedit DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Implements the main window of the application
|
||||
* COPYRIGHT: Copyright 2008 Colin Finck (colin@reactos.org)
|
||||
* Copyright 2018 Katayama Hirofui MZ (katayama.hirofumi.mz@gmail.com)
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
@ -221,6 +222,34 @@ DoFileOpen(IN PMAIN_WND_INFO Info)
|
|||
}
|
||||
}
|
||||
|
||||
static VOID
|
||||
MainWndOpenFile(IN PMAIN_WND_INFO Info, LPCWSTR File)
|
||||
{
|
||||
PFONT_OPEN_INFO OpenInfo;
|
||||
|
||||
OpenInfo = HeapAlloc(hProcessHeap, HEAP_ZERO_MEMORY, sizeof(FONT_OPEN_INFO));
|
||||
OpenInfo->pszFileName = HeapAlloc(hProcessHeap, 0, MAX_PATH);
|
||||
lstrcpynW(OpenInfo->pszFileName, File, MAX_PATH);
|
||||
|
||||
OpenInfo->bCreateNew = FALSE;
|
||||
CreateFontWindow(Info, OpenInfo);
|
||||
}
|
||||
|
||||
static VOID
|
||||
MainWndDropFiles(IN PMAIN_WND_INFO Info, HDROP hDrop)
|
||||
{
|
||||
WCHAR Path[MAX_PATH];
|
||||
INT i, Count = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
|
||||
|
||||
for (i = 0; i < Count; ++i)
|
||||
{
|
||||
DragQueryFileW(hDrop, i, Path, MAX_PATH);
|
||||
MainWndOpenFile(Info, Path);
|
||||
}
|
||||
|
||||
DragFinish(hDrop);
|
||||
}
|
||||
|
||||
VOID
|
||||
DoFileSave(IN PMAIN_WND_INFO Info, IN BOOL bSaveAs)
|
||||
{
|
||||
|
@ -439,7 +468,7 @@ static LRESULT CALLBACK
|
|||
MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static HWND hNextClipboardViewer;
|
||||
|
||||
INT i;
|
||||
PMAIN_WND_INFO Info;
|
||||
|
||||
Info = (PMAIN_WND_INFO) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
||||
|
@ -497,6 +526,12 @@ MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
InitResources(Info);
|
||||
|
||||
ShowWindow(hwnd, Info->nCmdShow);
|
||||
|
||||
for (i = 1; i < __argc; ++i)
|
||||
{
|
||||
MainWndOpenFile(Info, __wargv[i]);
|
||||
}
|
||||
DragAcceptFiles(hwnd, TRUE);
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
|
@ -521,6 +556,10 @@ MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_SIZE:
|
||||
MainWndSize( Info, LOWORD(lParam), HIWORD(lParam) );
|
||||
return 0;
|
||||
|
||||
case WM_DROPFILES:
|
||||
MainWndDropFiles(Info, (HDROP)wParam);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue