Drag and Drop Support into the Makensisw window
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@960 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
5408e3ca6d
commit
f4f4681851
5 changed files with 40 additions and 9 deletions
|
@ -144,6 +144,7 @@ Version History
|
|||
- Makensisw now takes the same parameters as makensis
|
||||
- About Box is closeable
|
||||
- Fixed some random crashes
|
||||
- Drag and Drop Support into the Makensisw window
|
||||
|
||||
|
||||
Copyright Information
|
||||
|
|
|
@ -43,8 +43,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmd
|
|||
if (*g_script++=='"') while (*g_script++!='"');
|
||||
else while (*g_script++!=' ');
|
||||
while (*g_script==' ') g_script++;
|
||||
g_retcode = -1; // return code is always false unless set to true by GetExitCodeProcess
|
||||
g_warnings = FALSE;
|
||||
ResetObjects();
|
||||
HWND hDialog = CreateDialog(g_hInstance,MAKEINTRESOURCE(DLG_MAIN),0,DialogProc);
|
||||
if (!hDialog) {
|
||||
char buf [MAX_STRING];
|
||||
|
@ -93,11 +92,27 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
case WM_CLOSE:
|
||||
{
|
||||
if (!g_hThread) {
|
||||
DragAcceptFiles(g_hwnd,FALSE);
|
||||
DestroyWindow(hwndDlg);
|
||||
FreeLibrary(hRichEditDLL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case WM_DROPFILES: {
|
||||
int num;
|
||||
char szTmp[MAX_PATH];
|
||||
num = DragQueryFile((HDROP)wParam,-1,NULL,0);
|
||||
if (num==1) {
|
||||
DragQueryFile((HDROP)wParam,0,szTmp,MAX_PATH);
|
||||
if (lstrlen(szTmp)>0) {
|
||||
g_script = (char *)GlobalAlloc(GPTR,sizeof(szTmp)+7);
|
||||
wsprintf(g_script,"/CD \"%s\"",szTmp);
|
||||
ResetObjects();
|
||||
CompileNSISScript();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
((MINMAXINFO*)lParam)->ptMinTrackSize.x=MINWIDTH;
|
||||
|
@ -133,16 +148,17 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
CloseHandle(g_hThread);
|
||||
g_hThread=0;
|
||||
}
|
||||
EnableItems(g_hwnd);
|
||||
EnableItems(g_hwnd);
|
||||
if (g_retcode==0) {
|
||||
MessageBeep(MB_ICONASTERISK);
|
||||
if (g_warnings) SetTitle(g_hwnd,"Finished with Warnings");
|
||||
else SetTitle(g_hwnd,"Finished Sucessfully");
|
||||
}
|
||||
else {
|
||||
MessageBeep(MB_ICONEXCLAMATION);
|
||||
SetTitle(g_hwnd,"Compile Error: See Log for Details");
|
||||
}
|
||||
MessageBeep(MB_ICONEXCLAMATION);
|
||||
SetTitle(g_hwnd,"Compile Error: See Log for Details");
|
||||
}
|
||||
DragAcceptFiles(g_hwnd,TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
|
|
|
@ -74,4 +74,6 @@ void DisableItems(HWND hwnd);
|
|||
void EnableItems(HWND hwnd);
|
||||
void RestoreWindowPos(HWND hwnd);
|
||||
void SaveWindowPos(HWND hwnd);
|
||||
void ResetObjects();
|
||||
|
||||
#endif
|
|
@ -37,13 +37,13 @@ void SetBranding(HWND hwnd) {
|
|||
|
||||
void CopyToClipboard(HWND hwnd) {
|
||||
int len=SendDlgItemMessage(hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0);
|
||||
HGLOBAL mem = GlobalAlloc(GHND,len);
|
||||
HGLOBAL mem = GlobalAlloc(GHND,len);
|
||||
char *existing_text = (char *)GlobalLock(mem);
|
||||
if (!hwnd||!OpenClipboard(hwnd)||!existing_text) return;
|
||||
EmptyClipboard();
|
||||
existing_text[0]=0;
|
||||
GetDlgItemText(hwnd, IDC_LOGWIN, existing_text, len);
|
||||
GlobalUnlock(mem);
|
||||
GlobalUnlock(mem);
|
||||
SetClipboardData(CF_TEXT,existing_text);
|
||||
CloseClipboard();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ char *g_input_script;
|
|||
extern BOOL g_warnings;
|
||||
|
||||
void LogMessage(HWND hwnd,const char *str) {
|
||||
SendDlgItemMessage(hwnd, IDC_LOGWIN, EM_SETSEL, -1, 0);
|
||||
SendDlgItemMessage(hwnd, IDC_LOGWIN, EM_SETSEL, -1, 0);
|
||||
SendDlgItemMessage(hwnd, IDC_LOGWIN, EM_REPLACESEL, 0, (WPARAM)str);
|
||||
SendDlgItemMessage(hwnd, IDC_LOGWIN, WM_VSCROLL, SB_BOTTOM, 0);
|
||||
}
|
||||
|
@ -154,6 +154,7 @@ void CompileNSISScript() {
|
|||
EnableMenuItem(m,IDM_EDITSCRIPT,MF_GRAYED);
|
||||
EnableMenuItem(m,IDM_TEST,MF_GRAYED);
|
||||
EnableWindow(GetDlgItem(g_hwnd,IDC_TEST),0);
|
||||
DragAcceptFiles(g_hwnd,TRUE);
|
||||
return;
|
||||
}
|
||||
if (!g_appended) {
|
||||
|
@ -193,3 +194,13 @@ void SaveWindowPos(HWND hwnd) {
|
|||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
|
||||
extern HANDLE g_hThread;
|
||||
extern int g_retcode;
|
||||
|
||||
void ResetObjects() {
|
||||
g_appended = FALSE;
|
||||
g_warnings = FALSE;
|
||||
g_retcode = -1;
|
||||
g_hThread = NULL;
|
||||
}
|
|
@ -42,5 +42,6 @@ void DisableItems(HWND hwnd);
|
|||
void EnableItems(HWND hwnd);
|
||||
void RestoreWindowPos(HWND hwnd);
|
||||
void SaveWindowPos(HWND hwnd);
|
||||
void ResetObjects();
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue