Makensisw now uses nsis version as branding. Added tooltips, updated icon.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1042 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
debe068a54
commit
2c31e3a8e0
7 changed files with 139 additions and 14 deletions
|
@ -142,13 +142,16 @@ Version History
|
|||
- Text always scrolls to bottom (Kickik)
|
||||
- Updated link to new docs
|
||||
- Makensisw now takes the same parameters as makensis
|
||||
- About Box is closeable
|
||||
- About Box is closeable by clicking X
|
||||
- Fixed some random crashes
|
||||
- Drag and Drop Support into the Makensisw window
|
||||
- Updated icon to Trace's modern NSIS icon
|
||||
- Updated icon to more sexy one
|
||||
- Added Load Script option on File menu
|
||||
- Added Search Dialog (Ctrl+F) (Kickik)
|
||||
- Added Select All (Ctrl+A), Copy (Ctrl+C), Exit (Alt+X) keys
|
||||
- Branding text now reflects NSIS version
|
||||
- Bunch of other stuff not worth mentioning
|
||||
- Added some simple tool tips
|
||||
|
||||
|
||||
Copyright Information
|
||||
|
|
|
@ -47,6 +47,10 @@ 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++;
|
||||
if (!InitBranding()) {
|
||||
MessageBox(0,"Unable to find makensis.exe.","Error",MB_ICONEXCLAMATION|MB_OK);
|
||||
return 1;
|
||||
}
|
||||
ResetObjects();
|
||||
HWND hDialog = CreateDialog(g_hInstance,MAKEINTRESOURCE(DLG_MAIN),0,DialogProc);
|
||||
if (!hDialog) {
|
||||
|
@ -83,6 +87,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
HICON hIcon = LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON));
|
||||
SetClassLong(hwndDlg,GCL_HICON,(long)hIcon);
|
||||
DragAcceptFiles(g_hwnd,FALSE);
|
||||
InitTooltips(g_hwnd);
|
||||
HFONT hFont = CreateFont(14,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH|FF_DONTCARE,"Courier New");
|
||||
SendDlgItemMessage(hwndDlg,IDC_LOGWIN,WM_SETFONT,(WPARAM)hFont,0);
|
||||
SendDlgItemMessage(hwndDlg,IDC_LOGWIN,EM_SETBKGNDCOLOR,0,GetSysColor(COLOR_BTNFACE));
|
||||
|
@ -93,6 +98,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
case WM_DESTROY:
|
||||
{
|
||||
SaveWindowPos(g_hwnd);
|
||||
DestroyTooltips();
|
||||
PostQuitMessage(0);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"WinMain" /subsystem:windows /machine:I386 /nodefaultlib /out:"../../makensisw.exe" /opt:nowin98
|
||||
# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"WinMain" /subsystem:windows /machine:I386 /nodefaultlib /out:"../../makensisw.exe" /opt:nowin98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "makensisw - Win32 Debug"
|
||||
|
@ -80,7 +80,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
@ -129,6 +129,10 @@ SOURCE=.\noclib.h
|
|||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="..\Icons\adni18-installer-C-no48xp.ico"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Source\default1.bin
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
// Defines
|
||||
#define NSIS_URL "http://sourceforge.net/projects/nsis/"
|
||||
#define USAGE "Usage:\r\n\r\n - File | Load Script...\r\n - Drag .nsi file into this window\r\n - Right click .nsi and choose \"Compile NSI\""
|
||||
#define USAGE "Usage:\r\n\r\n - File | Load Script...\r\n - Drag the .nsi file into this window\r\n - Right click the .nsi file and choose \"Compile NSI\""
|
||||
#define COPYRIGHT "Copyright (c) 2002 Robert Rainwater"
|
||||
#define CONTRIBUTOR "Portions Copyright (c) 2002 Justin Frankel, Fritz Elfert, and Amir Szekely"
|
||||
#define DOCPATH "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/nsis/NSIS/docs/index.html?rev=HEAD"
|
||||
|
@ -75,5 +75,8 @@ void EnableItems(HWND hwnd);
|
|||
void RestoreWindowPos(HWND hwnd);
|
||||
void SaveWindowPos(HWND hwnd);
|
||||
void ResetObjects();
|
||||
|
||||
int InitBranding();
|
||||
void InitTooltips(HWND h);
|
||||
void DestroyTooltips();
|
||||
void AddTip(HWND hWnd,LPSTR lpszToolTip);
|
||||
#endif
|
|
@ -54,7 +54,7 @@ END
|
|||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON ICON DISCARDABLE "..\\..\\contrib\\icons\\new_nsis.ico"
|
||||
IDI_ICON ICON DISCARDABLE "..\\..\\contrib\\icons\\adni18-installer-C-no48xp.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -128,8 +128,8 @@ BEGIN
|
|||
WS_VSCROLL,7,4,345,186
|
||||
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,202,346,1
|
||||
LTEXT "",IDC_VERSION,7,212,200,12,WS_DISABLED
|
||||
DEFPUSHBUTTON "Clo&se",IDC_CLOSE,303,209,49,14
|
||||
PUSHBUTTON "&Test",IDC_TEST,247,209,50,14,WS_DISABLED
|
||||
DEFPUSHBUTTON "Clo&se",IDC_CLOSE,303,208,49,15
|
||||
PUSHBUTTON "&Test",IDC_TEST,247,208,50,15,WS_DISABLED
|
||||
END
|
||||
|
||||
DLG_ABOUT DIALOG DISCARDABLE 0, 0, 235, 86
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "makensisw.h"
|
||||
#include "noclib.h"
|
||||
|
||||
char *g_branding;
|
||||
|
||||
void SetTitle(HWND hwnd,char *substr) {
|
||||
char title[64];
|
||||
if (substr==NULL) wsprintf(title,"MakeNSISW");
|
||||
|
@ -32,7 +34,7 @@ void SetTitle(HWND hwnd,char *substr) {
|
|||
}
|
||||
|
||||
void SetBranding(HWND hwnd) {
|
||||
SetDlgItemText(hwnd, IDC_VERSION, NSISW_VERSION);
|
||||
SetDlgItemText(hwnd, IDC_VERSION, g_branding);
|
||||
}
|
||||
|
||||
void CopyToClipboard(HWND hwnd) {
|
||||
|
@ -164,10 +166,10 @@ void CompileNSISScript() {
|
|||
return;
|
||||
}
|
||||
if (!g_appended) {
|
||||
if (s) GlobalFree(s);
|
||||
s = (char *)GlobalAlloc(GPTR, lstrlen(g_script)+lstrlen(EXENAME)+2);
|
||||
if (s) GlobalFree(s);
|
||||
s = (char *)GlobalAlloc(GPTR, lstrlen(g_script)+lstrlen(EXENAME)+2);
|
||||
wsprintf(s,"%s %s",EXENAME,g_script);
|
||||
g_script = s;
|
||||
g_script = s;
|
||||
g_appended = TRUE;
|
||||
}
|
||||
// Disable buttons during compile
|
||||
|
@ -209,4 +211,107 @@ void ResetObjects() {
|
|||
g_warnings = FALSE;
|
||||
g_retcode = -1;
|
||||
g_hThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int InitBranding() {
|
||||
char *s;
|
||||
s = (char *)GlobalAlloc(GPTR,lstrlen(EXENAME)+10);
|
||||
wsprintf(s,"%s /version",EXENAME);
|
||||
{
|
||||
STARTUPINFO si={sizeof(si),};
|
||||
SECURITY_ATTRIBUTES sa={sizeof(sa),};
|
||||
SECURITY_DESCRIPTOR sd={0,};
|
||||
PROCESS_INFORMATION pi={0,};
|
||||
HANDLE newstdout=0,read_stdout=0;
|
||||
|
||||
OSVERSIONINFO osv={sizeof(osv)};
|
||||
GetVersionEx(&osv);
|
||||
if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
||||
InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION);
|
||||
SetSecurityDescriptorDacl(&sd,true,NULL,false);
|
||||
sa.lpSecurityDescriptor = &sd;
|
||||
}
|
||||
else sa.lpSecurityDescriptor = NULL;
|
||||
sa.bInheritHandle = true;
|
||||
if (!CreatePipe(&read_stdout,&newstdout,&sa,0)) {
|
||||
return 0;
|
||||
}
|
||||
GetStartupInfo(&si);
|
||||
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_HIDE;
|
||||
si.hStdOutput = newstdout;
|
||||
si.hStdError = newstdout;
|
||||
if (!CreateProcess(NULL,s,NULL,NULL,TRUE,CREATE_NEW_CONSOLE,NULL,NULL,&si,&pi)) {
|
||||
CloseHandle(newstdout);
|
||||
CloseHandle(read_stdout);
|
||||
return 0;
|
||||
}
|
||||
char szBuf[1024];
|
||||
DWORD dwRead = 1;
|
||||
DWORD dwExit = !STILL_ACTIVE;
|
||||
if (WaitForSingleObject(pi.hProcess,10000)!=WAIT_OBJECT_0) {
|
||||
return 0;
|
||||
}
|
||||
ReadFile(read_stdout, szBuf, sizeof(szBuf)-1, &dwRead, NULL);
|
||||
szBuf[dwRead] = 0;
|
||||
if (lstrlen(szBuf)==0) return 0;
|
||||
g_branding = (char *)GlobalAlloc(GPTR,lstrlen(szBuf)+6);
|
||||
wsprintf(g_branding,"NSIS %s",szBuf);
|
||||
GlobalFree(s);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
HWND g_tip;
|
||||
HWND g_tip_p;
|
||||
HHOOK g_hook;
|
||||
LRESULT CALLBACK TipHookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void InitTooltips(HWND h) {
|
||||
if (h == NULL) return;
|
||||
g_tip_p = h;
|
||||
INITCOMMONCONTROLSEX icx;
|
||||
icx.dwSize = sizeof(icx);
|
||||
icx.dwICC = ICC_BAR_CLASSES;
|
||||
InitCommonControlsEx(&icx);
|
||||
DWORD dwStyle = WS_POPUP | WS_BORDER | TTS_ALWAYSTIP;
|
||||
DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
|
||||
g_tip = CreateWindowEx(dwExStyle,TOOLTIPS_CLASS,
|
||||
NULL,dwStyle,0,0,0,0,
|
||||
h, NULL,
|
||||
GetModuleHandle(NULL),NULL);
|
||||
if (!g_tip) {
|
||||
return;
|
||||
}
|
||||
g_hook = SetWindowsHookEx(WH_GETMESSAGE,TipHookProc,NULL, GetCurrentThreadId());
|
||||
AddTip(GetDlgItem(h,IDC_CLOSE),TEXT("Close MakeNSISW"));
|
||||
AddTip(GetDlgItem(h,IDC_TEST),TEXT("Test the installer generated by MakeNSISW"));
|
||||
}
|
||||
|
||||
void DestroyTooltips() {
|
||||
UnhookWindowsHookEx(g_hook);
|
||||
}
|
||||
|
||||
void AddTip(HWND hWnd,LPSTR lpszToolTip) {
|
||||
TOOLINFO ti;
|
||||
ti.cbSize = sizeof(TOOLINFO);
|
||||
ti.uFlags = TTF_IDISHWND;
|
||||
ti.hwnd = g_tip_p;
|
||||
ti.uId = (UINT) hWnd;
|
||||
ti.lpszText = lpszToolTip;
|
||||
SendMessage(g_tip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK TipHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
|
||||
if (nCode < 0) return CallNextHookEx(g_hook, nCode, wParam, lParam);
|
||||
switch (((MSG*)lParam)->message) {
|
||||
case WM_MOUSEMOVE:
|
||||
if (IsChild(g_tip_p,((MSG*)lParam)->hwnd))
|
||||
SendMessage(g_tip, TTM_RELAYEVENT, 0,lParam);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return CallNextHookEx(g_hook, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,5 +43,9 @@ void EnableItems(HWND hwnd);
|
|||
void RestoreWindowPos(HWND hwnd);
|
||||
void SaveWindowPos(HWND hwnd);
|
||||
void ResetObjects();
|
||||
int InitBranding();
|
||||
void InitTooltips(HWND h);
|
||||
void DestroyTooltips();
|
||||
void AddTip(HWND hWnd,LPSTR lpszToolTip);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue