Code cleanup

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1058 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
rainwater 2002-09-19 22:38:46 +00:00
parent 0910f0dd75
commit 19e6cde283
7 changed files with 49 additions and 95 deletions

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2002 Robert Rainwater
Portions Copyright (c) 2002 Justin Frankel and Fritz Elfert
Contributors: Justin Frankel, Fritz Elfert, and Amir Szekely
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -25,6 +25,18 @@
#include "noclib.h"
char *g_branding;
char *g_output_exe;
char *g_input_script;
HWND g_tip;
HWND g_tip_p;
HHOOK g_hook;
LRESULT CALLBACK TipHookProc(int nCode, WPARAM wParam, LPARAM lParam);
extern BOOL g_warnings;
extern HANDLE g_hThread;
extern int g_retcode;
static BOOL g_appended = FALSE;
void SetTitle(HWND hwnd,char *substr) {
char title[64];
@ -52,15 +64,10 @@ void CopyToClipboard(HWND hwnd) {
CloseClipboard();
}
void ClearLog(HWND hwnd) {
SetDlgItemText(hwnd, IDC_LOGWIN, "");
}
char *g_output_exe;
char *g_input_script;
extern BOOL g_warnings;
void LogMessage(HWND hwnd,const char *str) {
DWORD dwLength = SendDlgItemMessage(hwnd, IDC_LOGWIN, WM_GETTEXTLENGTH, 0, 0);
SendDlgItemMessage(hwnd, IDC_LOGWIN, EM_SETSEL, dwLength, dwLength);
@ -93,7 +100,6 @@ void EnableItems(HWND hwnd) {
#define MSG(a) SendDlgItemMessage(hwnd,IDC_LOGWIN,a,0,0)
#define MSG1(a,b) SendDlgItemMessage(hwnd,IDC_LOGWIN,a,b,0)
#define MSG2(a,b,c) SendDlgItemMessage(hwnd,IDC_LOGWIN,a,b,c)
if (g_input_script) {
GlobalFree(g_input_script);
g_input_script = 0;
@ -102,7 +108,6 @@ void EnableItems(HWND hwnd) {
GlobalFree(g_output_exe);
g_output_exe = 0;
}
TEXTRANGE tr;
FINDTEXT ft;
@ -148,7 +153,6 @@ void EnableItems(HWND hwnd) {
EnableMenuItem(m,IDM_EDITSCRIPT,MF_ENABLED);
}
static BOOL g_appended = FALSE;
void CompileNSISScript() {
static char *s;
DragAcceptFiles(g_hwnd,FALSE);
@ -203,9 +207,6 @@ void SaveWindowPos(HWND hwnd) {
}
}
extern HANDLE g_hThread;
extern int g_retcode;
void ResetObjects() {
g_appended = FALSE;
g_warnings = FALSE;
@ -262,11 +263,6 @@ int InitBranding() {
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;
@ -274,15 +270,10 @@ void InitTooltips(HWND h) {
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;
}
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"));
@ -313,5 +304,4 @@ LRESULT CALLBACK TipHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
break;
}
return CallNextHookEx(g_hook, nCode, wParam, lParam);
}
}