diff --git a/Contrib/Makensisw/Readme.txt b/Contrib/Makensisw/Readme.txt index b367ee3b..3e0e2a5b 100644 --- a/Contrib/Makensisw/Readme.txt +++ b/Contrib/Makensisw/Readme.txt @@ -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 diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index fcf948f9..a339ed75 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -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: diff --git a/Contrib/Makensisw/makensisw.h b/Contrib/Makensisw/makensisw.h index 022604d6..88fadc9d 100644 --- a/Contrib/Makensisw/makensisw.h +++ b/Contrib/Makensisw/makensisw.h @@ -74,4 +74,6 @@ void DisableItems(HWND hwnd); void EnableItems(HWND hwnd); void RestoreWindowPos(HWND hwnd); void SaveWindowPos(HWND hwnd); +void ResetObjects(); + #endif \ No newline at end of file diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index 75dcf766..67be7f2e 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -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; +} \ No newline at end of file diff --git a/Contrib/Makensisw/utils.h b/Contrib/Makensisw/utils.h index 4d1edf08..c29dfb13 100644 --- a/Contrib/Makensisw/utils.h +++ b/Contrib/Makensisw/utils.h @@ -42,5 +42,6 @@ void DisableItems(HWND hwnd); void EnableItems(HWND hwnd); void RestoreWindowPos(HWND hwnd); void SaveWindowPos(HWND hwnd); +void ResetObjects(); #endif \ No newline at end of file