diff --git a/Contrib/Makensisw/Readme.txt b/Contrib/Makensisw/Readme.txt index 7193292c..25654308 100644 --- a/Contrib/Makensisw/Readme.txt +++ b/Contrib/Makensisw/Readme.txt @@ -204,6 +204,10 @@ Version History - System DPI aware - New toolbar images +2.3.5 +- Added log window colors +- Basic AppEvents custom sound support for BuildComplete, BuildWarning and BuildError + Copyright Information --------------------- diff --git a/Contrib/Makensisw/SConscript b/Contrib/Makensisw/SConscript index 5bb1d0e7..f6046dbb 100644 --- a/Contrib/Makensisw/SConscript +++ b/Contrib/Makensisw/SConscript @@ -41,6 +41,7 @@ libs = Split(""" comdlg32 comctl32 wininet + winmm """) docs = Split(""" @@ -57,7 +58,7 @@ BuildUtil( res = res, resources = resources, entry = None, - defines = ['RELEASE=2.3.4'], + defines = ['RELEASE=2.3.5'], docs = docs, root_util = True ) diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index ef57cdf9..4b2413cd 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -468,18 +468,24 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam } EnableItems(g_sdata.hwnd); if (!g_sdata.retcode) { - MessageBeep(MB_ICONASTERISK); - if (g_sdata.warnings) + if (g_sdata.warnings) { SetTitle(g_sdata.hwnd,_T("Finished with Warnings")); - else + PlayAppSoundAsync(("BuildWarning"), MB_ICONWARNING); + SetLogColor(LC_WARNING); + } + else { SetTitle(g_sdata.hwnd,_T("Finished Sucessfully")); + PlayAppSoundAsync(("BuildComplete"), MB_ICONASTERISK); + SetLogColor(LC_SUCCESS); + } // Added by Darren Owen (DrO) on 1/10/2003 if(g_sdata.recompile_test) PostMessage(g_sdata.hwnd, WM_COMMAND, LOWORD(IDC_TEST), 0); } else { - MessageBeep(MB_ICONEXCLAMATION); SetTitle(g_sdata.hwnd,_T("Compile Error: See Log for Details")); + PlayAppSoundAsync(("BuildError"), MB_ICONEXCLAMATION); + SetLogColor(LC_ERROR); } // Added by Darren Owen (DrO) on 1/10/2003 diff --git a/Contrib/Makensisw/makensisw.h b/Contrib/Makensisw/makensisw.h index 48be78a2..53acdc41 100644 --- a/Contrib/Makensisw/makensisw.h +++ b/Contrib/Makensisw/makensisw.h @@ -62,6 +62,7 @@ #define REGLOC _T("MakeNSISWPlacement") #define REGVERBOSITY _T("MakeNSISWVerbosity") #define REGCOMPRESSOR _T("MakeNSISWCompressor") +#define REGCOLORIZE _T("MakeNSISWColorize") #define REGSYMSUBKEY _T("Symbols") #define REGMRUSUBKEY _T("MRU") #define EXENAME _T("makensis.exe") diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index f7801a06..90d38d91 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -166,6 +166,25 @@ void SetTitle(HWND hwnd,const TCHAR *substr) { SetWindowText(hwnd,title); } +typedef struct { LPCSTR SoundName; int MBFallback; } PLAYAPPSOUNDDATA; +static DWORD CALLBACK PlayAppSoundProc(LPVOID ThreadParam) { + PLAYAPPSOUNDDATA *p = (PLAYAPPSOUNDDATA*) ThreadParam; + BOOL succ = PlaySoundA(p->SoundName, NULL, (SND_APPLICATION|SND_ALIAS|SND_NODEFAULT) & ~SND_ASYNC); // Cannot use SND_ASYNC because we need to detect if the sound played + if (!succ && p->MBFallback >= 0) succ = MessageBeep(p->MBFallback); + MemFree(p); + return succ; +} + +void PlayAppSoundAsync(LPCSTR SoundName, int MBFallback) { + DWORD tid; + PLAYAPPSOUNDDATA *p = (PLAYAPPSOUNDDATA*) MemAlloc(sizeof(PLAYAPPSOUNDDATA)); + if (p) { + p->SoundName = SoundName, p->MBFallback = MBFallback; // Note: The string must be valid until the sound has started because we don't copy it + HANDLE hThread = CreateThread(NULL, 0, PlayAppSoundProc, p, 0, &tid); + if (hThread) CloseHandle(hThread); else PlayAppSoundProc(p); + } +} + void CopyToClipboard(HWND hwnd) { if (!hwnd || !OpenClipboard(hwnd)) return; LRESULT len = SendDlgItemMessage(hwnd, IDC_LOGWIN, WM_GETTEXTLENGTH, 0, 0); @@ -185,8 +204,24 @@ void CopyToClipboard(HWND hwnd) { CloseClipboard(); } +void SetLogColor(enum LOGCOLOR lc) +{ + enum { em_seteditstyle = (WM_USER + 204), ses_extendbackcolor = 4 }; + HWND hEd = GetDlgItem(g_sdata.hwnd, IDC_LOGWIN); + bool sysclr = lc >= LC_SYSCOLOR || !ReadRegSettingDW(REGCOLORIZE, true); + COLORREF clrs[] = { RGB(0, 50, 0), RGB(210, 255, 210), RGB(50, 30, 0), RGB(255, 220, 190), RGB(50, 0, 0), RGB(255, 210, 210) }; + CHARFORMAT cf; + cf.cbSize = sizeof(cf), cf.dwMask = CFM_COLOR; + cf.dwEffects = sysclr ? CFE_AUTOCOLOR : 0; + cf.crTextColor = sysclr ? RGB(0, 0, 0) : clrs[(lc * 2) + 0]; + SendMessage(hEd, em_seteditstyle, sysclr ? 0 : ses_extendbackcolor, ses_extendbackcolor); + SendMessage(hEd, EM_SETCHARFORMAT, 0, (LPARAM) &cf); + SendMessage(hEd, EM_SETBKGNDCOLOR, sysclr, sysclr ? sysclr /*Irrelevant*/ : clrs[(lc * 2) + 1]); +} + void ClearLog(HWND hwnd) { SetDlgItemText(hwnd, IDC_LOGWIN, _T("")); + SetLogColor(LC_SYSCOLOR); SendMessage(g_sdata.hwnd, WM_MAKENSIS_UPDATEUISTATE, 0, 0); } diff --git a/Contrib/Makensisw/utils.h b/Contrib/Makensisw/utils.h index 5f6daddb..f0a08553 100644 --- a/Contrib/Makensisw/utils.h +++ b/Contrib/Makensisw/utils.h @@ -55,7 +55,10 @@ typedef BYTE PACKEDCMDID_T; int SetArgv(const TCHAR *cmdLine, TCHAR ***argv); void SetTitle(HWND hwnd,const TCHAR *substr); +void PlayAppSoundAsync(LPCSTR SoundName, int MBFallback = -1); void CopyToClipboard(HWND hwnd); +enum LOGCOLOR { LC_SUCCESS, LC_WARNING, LC_ERROR, LC_SYSCOLOR }; +void SetLogColor(enum LOGCOLOR lc); void ClearLog(HWND hwnd); void LogMessage(HWND hwnd,const TCHAR *str); void ErrorMessage(HWND hwnd,const TCHAR *str);