2002-08-02 10:01:35 +00:00
|
|
|
/*
|
2004-01-06 21:28:50 +00:00
|
|
|
* Copyright (C) 1999-2004 Nullsoft, Inc.
|
2002-08-02 10:01:35 +00:00
|
|
|
* Portions Copyright (C) 2002 Jeff Doozan
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied warranty.
|
|
|
|
* In no event will the authors be held liable for any damages arising from the
|
|
|
|
* use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any purpose, including
|
|
|
|
* commercial applications, and to alter it and redistribute it freely, subject to
|
|
|
|
* the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you must not claim that
|
|
|
|
* you wrote the original software. If you use this software in a product, an
|
|
|
|
* acknowledgment in the product documentation would be appreciated but is not required.
|
|
|
|
*
|
2002-08-11 18:56:30 +00:00
|
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
2002-08-02 10:01:35 +00:00
|
|
|
* misrepresented as being the original software.
|
|
|
|
*
|
|
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
|
2004-01-30 22:04:10 +00:00
|
|
|
#include "../Platform.h"
|
2002-08-02 10:01:35 +00:00
|
|
|
#include <windowsx.h>
|
|
|
|
#include <shlobj.h>
|
|
|
|
#include <shellapi.h>
|
|
|
|
|
|
|
|
#include "resource.h"
|
|
|
|
|
|
|
|
#include "fileform.h"
|
|
|
|
#include "state.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "ui.h"
|
|
|
|
#include "exec.h"
|
2002-08-03 23:06:10 +00:00
|
|
|
#include "lang.h"
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2003-09-10 16:39:06 +00:00
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
2002-09-25 03:06:36 +00:00
|
|
|
HICON g_hIcon;
|
2003-09-10 16:39:06 +00:00
|
|
|
#endif
|
2002-09-06 18:49:02 +00:00
|
|
|
|
2003-04-21 13:32:34 +00:00
|
|
|
int dlg_offset;
|
2003-11-09 22:45:25 +00:00
|
|
|
int ui_dlg_visible=0; // At start main window is not visible
|
2002-08-02 10:01:35 +00:00
|
|
|
int g_quit_flag; // set when Quit has been called (meaning bail out ASAP)
|
|
|
|
|
2003-05-24 13:50:24 +00:00
|
|
|
#if NSIS_MAX_INST_TYPES > 32 || NSIS_MAX_INST_TYPES < 1
|
2002-08-02 10:01:35 +00:00
|
|
|
#error invalid value for NSIS_MAX_INST_TYPES
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int progress_bar_pos, progress_bar_len;
|
|
|
|
|
|
|
|
static char g_tmp[4096];
|
|
|
|
|
2004-05-15 11:22:48 +00:00
|
|
|
static int m_page=-1,m_retcode,m_delta;
|
2003-09-04 18:25:57 +00:00
|
|
|
static page *g_this_page;
|
2002-11-09 12:50:00 +00:00
|
|
|
|
2002-11-21 16:46:05 +00:00
|
|
|
#define NOTIFY_BYE_BYE 'x'
|
|
|
|
|
2004-05-08 16:07:22 +00:00
|
|
|
static void NSISCALL outernotify(int delta) {
|
|
|
|
if (delta==NOTIFY_BYE_BYE)
|
2003-04-01 18:07:32 +00:00
|
|
|
g_quit_flag++;
|
2004-05-08 16:07:22 +00:00
|
|
|
SendMessage(g_hwnd,WM_NOTIFY_OUTER_NEXT,(WPARAM)delta,0);
|
2002-09-12 11:47:05 +00:00
|
|
|
}
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
2002-09-21 15:17:42 +00:00
|
|
|
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2003-06-05 20:33:33 +00:00
|
|
|
static int CALLBACK WINAPI BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_LICENSEPAGE
|
|
|
|
static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
#endif
|
|
|
|
static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
|
|
|
|
static DWORD WINAPI install_thread(LPVOID p);
|
|
|
|
|
2004-01-29 23:18:32 +00:00
|
|
|
void NSISCALL CleanUp();
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
HWND insthwnd, insthwnd2, insthwndbutton;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
HWND m_curwnd;
|
|
|
|
static HWND m_bgwnd, m_hwndOK, m_hwndCancel;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-10-01 14:13:23 +00:00
|
|
|
static BOOL NSISCALL SetDlgItemTextFromLang_(HWND dlg, int id, int lid) {
|
2003-09-04 18:25:57 +00:00
|
|
|
return my_SetDialogItemText(dlg,id+1000,GetNSISStringTT(lid));
|
2002-08-07 15:14:40 +00:00
|
|
|
}
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
static void NSISCALL SetNextDef()
|
|
|
|
{
|
|
|
|
SendMessage(g_exec_flags.abort ? m_hwndCancel : m_hwndOK, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void NSISCALL EnableNext(BOOL e)
|
|
|
|
{
|
|
|
|
EnableWindow(m_hwndOK, e);
|
|
|
|
}
|
|
|
|
|
2004-03-06 12:31:26 +00:00
|
|
|
static void NSISCALL SetActiveCtl(HWND hCtl)
|
2004-01-04 17:05:03 +00:00
|
|
|
{
|
2004-03-06 12:31:26 +00:00
|
|
|
SendMessage(g_hwnd, WM_NEXTDLGCTL, (WPARAM) hCtl, TRUE);
|
2004-01-04 17:05:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void NSISCALL NotifyCurWnd(UINT uNotifyCode)
|
|
|
|
{
|
|
|
|
if (m_curwnd)
|
|
|
|
SendMessage(m_curwnd, uNotifyCode, 0, 0);
|
|
|
|
}
|
|
|
|
|
2002-09-23 20:56:29 +00:00
|
|
|
#define SetDlgItemTextFromLang(dlg,id,lid) SetDlgItemTextFromLang_(dlg,(id)-1000,lid)
|
|
|
|
|
|
|
|
#define SetUITextFromLang(it,la) SetDlgItemTextFromLang_(hwndDlg,(it)-1000,la)
|
2002-09-23 19:27:42 +00:00
|
|
|
#define SetUITextNT(it,text) my_SetDialogItemText(hwndDlg,it,text)
|
2004-01-04 17:05:03 +00:00
|
|
|
#define GetUIText(it,s) my_GetDialogItemText(it,s)
|
2002-09-23 19:27:42 +00:00
|
|
|
#define GetUIItem(it) GetDlgItem(hwndDlg,it)
|
2002-08-21 19:15:00 +00:00
|
|
|
|
2002-09-18 19:08:53 +00:00
|
|
|
#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
2003-01-24 19:40:20 +00:00
|
|
|
#define HandleStaticBkColor() _HandleStaticBkColor(uMsg, wParam, lParam)
|
2003-12-29 15:12:41 +00:00
|
|
|
static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
if ((uMsg - WM_CTLCOLOREDIT) <= (WM_CTLCOLORSTATIC - WM_CTLCOLOREDIT))
|
|
|
|
{
|
|
|
|
ctlcolors *c = (ctlcolors *)GetWindowLong((HWND)lParam, GWL_USERDATA);
|
2003-12-29 14:27:33 +00:00
|
|
|
|
2003-12-29 15:12:41 +00:00
|
|
|
if (c) {
|
|
|
|
COLORREF text;
|
|
|
|
LOGBRUSH lh;
|
2003-12-29 14:27:33 +00:00
|
|
|
|
2003-12-29 15:12:41 +00:00
|
|
|
text = c->text;
|
|
|
|
if (c->flags & CC_TEXT_SYS)
|
|
|
|
text = GetSysColor(text);
|
|
|
|
if (c->flags & CC_TEXT)
|
|
|
|
SetTextColor((HDC)wParam, text);
|
2003-12-29 14:27:33 +00:00
|
|
|
|
2003-12-29 15:12:41 +00:00
|
|
|
SetBkMode((HDC)wParam, c->bkmode);
|
2003-12-29 14:27:33 +00:00
|
|
|
|
2003-12-29 15:12:41 +00:00
|
|
|
lh.lbColor = c->bkc;
|
|
|
|
if (c->flags & CC_BK_SYS)
|
|
|
|
lh.lbColor = GetSysColor(lh.lbColor);
|
|
|
|
if (c->flags & CC_BK)
|
|
|
|
SetBkColor((HDC)wParam, lh.lbColor);
|
2003-09-04 18:25:57 +00:00
|
|
|
|
2003-12-29 15:12:41 +00:00
|
|
|
if (c->flags & CC_BKB)
|
|
|
|
{
|
|
|
|
lh.lbStyle = c->lbStyle;
|
|
|
|
if (c->bkb)
|
|
|
|
DeleteObject(c->bkb);
|
|
|
|
c->bkb = CreateBrushIndirect(&lh);
|
2003-03-20 20:49:13 +00:00
|
|
|
}
|
2003-12-29 15:12:41 +00:00
|
|
|
|
|
|
|
return (BOOL)c->bkb;
|
2003-01-27 15:05:50 +00:00
|
|
|
}
|
2003-01-24 19:40:20 +00:00
|
|
|
}
|
2002-09-22 19:05:43 +00:00
|
|
|
return 0;
|
2002-08-21 19:15:00 +00:00
|
|
|
}
|
2002-11-30 13:15:49 +00:00
|
|
|
#else
|
2002-09-18 19:08:53 +00:00
|
|
|
#define HandleStaticBkColor() 0
|
|
|
|
#endif//!NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
2002-08-07 15:14:40 +00:00
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_LOG
|
2003-11-24 14:22:50 +00:00
|
|
|
#ifndef NSIS_CONFIG_LOG_ODS
|
2002-08-19 23:18:19 +00:00
|
|
|
void NSISCALL build_g_logfile()
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-09-25 02:13:38 +00:00
|
|
|
lstrcat(addtrailingslash(mystrcpy(g_log_file,state_install_directory)),"install.log");
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif
|
2003-11-24 14:22:50 +00:00
|
|
|
#endif
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
int *cur_langtable;
|
|
|
|
|
2002-08-28 21:13:54 +00:00
|
|
|
static void NSISCALL set_language()
|
2002-08-24 14:44:23 +00:00
|
|
|
{
|
2003-06-08 14:45:56 +00:00
|
|
|
LANGID lang_mask=(LANGID)~0;
|
2003-09-04 18:25:57 +00:00
|
|
|
LANGID lang=state_language[0]?myatoi(state_language):GetUserDefaultLangID();
|
2002-09-29 20:25:15 +00:00
|
|
|
char *language_table=0;
|
2003-09-04 18:25:57 +00:00
|
|
|
int lang_num;
|
2002-08-28 16:57:46 +00:00
|
|
|
|
2002-08-24 14:44:23 +00:00
|
|
|
lang_again:
|
2003-09-04 18:25:57 +00:00
|
|
|
lang_num=g_blocks[NB_LANGTABLES].num;
|
|
|
|
while (lang_num--) {
|
|
|
|
language_table=((char*)g_blocks[NB_LANGTABLES].offset)+lang_num*g_header->langtable_size;
|
2002-09-29 20:25:15 +00:00
|
|
|
if (!((lang ^ *(LANGID*)language_table) & lang_mask)) {
|
2003-04-21 13:32:34 +00:00
|
|
|
dlg_offset=*(int*)(language_table+sizeof(LANGID));
|
2003-12-06 20:45:35 +00:00
|
|
|
g_exec_flags.rtl=*(int*)(language_table+sizeof(LANGID)+sizeof(int));
|
|
|
|
cur_langtable=(int*)(language_table+sizeof(LANGID)+2*sizeof(int));
|
2002-08-24 14:44:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-09-04 18:25:57 +00:00
|
|
|
if (!cur_langtable) {
|
2003-06-08 14:45:56 +00:00
|
|
|
if (lang_mask == (LANGID)~0)
|
2002-09-29 20:25:15 +00:00
|
|
|
lang_mask=0x3ff; // primary lang
|
|
|
|
else // we already tried once and we still don't have a language table
|
|
|
|
lang_mask=0; // first lang
|
2002-08-24 14:44:23 +00:00
|
|
|
goto lang_again;
|
|
|
|
}
|
|
|
|
|
2002-09-29 20:25:15 +00:00
|
|
|
myitoa(state_language, *(LANGID*)language_table);
|
2003-09-04 18:25:57 +00:00
|
|
|
{
|
|
|
|
char *caption = GetNSISString(g_caption,LANG_CAPTION);
|
|
|
|
#ifdef NSIS_SUPPORT_BGBG
|
|
|
|
my_SetWindowText(m_bgwnd, caption);
|
2002-11-01 20:34:55 +00:00
|
|
|
#endif
|
2003-09-04 18:25:57 +00:00
|
|
|
}
|
2002-08-24 14:44:23 +00:00
|
|
|
}
|
|
|
|
|
2004-03-06 18:37:19 +00:00
|
|
|
FORCE_INLINE int NSISCALL ui_doinstall(void)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
header *header = g_header;
|
2003-03-29 17:16:09 +00:00
|
|
|
static WNDCLASS wc; // richedit subclassing and bgbg creation
|
2003-09-04 18:25:57 +00:00
|
|
|
g_exec_flags.autoclose=g_flags&CH_FLAGS_AUTO_CLOSE;
|
|
|
|
|
2003-09-23 19:01:19 +00:00
|
|
|
set_language();
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
if (!is_valid_instpath(state_install_directory))
|
2002-11-01 20:34:55 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
if (header->install_reg_key_ptr)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-11-14 21:08:51 +00:00
|
|
|
myRegGetStr(
|
|
|
|
(HKEY)header->install_reg_rootkey,
|
2003-09-04 18:25:57 +00:00
|
|
|
GetNSISStringNP(header->install_reg_key_ptr),
|
2003-11-14 21:08:51 +00:00
|
|
|
GetNSISStringNP(header->install_reg_value_ptr),
|
|
|
|
ps_tmpbuf
|
|
|
|
);
|
2003-09-04 18:25:57 +00:00
|
|
|
if (ps_tmpbuf[0])
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
char *p=ps_tmpbuf;
|
|
|
|
char *e;
|
|
|
|
if (p[0]=='\"')
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2004-02-20 15:13:13 +00:00
|
|
|
char *p2;
|
|
|
|
p++;
|
|
|
|
p2 = findchar(p, '"');
|
|
|
|
*p2 = 0;
|
2003-09-04 18:25:57 +00:00
|
|
|
}
|
|
|
|
// p is the path now, check for .exe extension
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
e=p+mystrlen(p)-4;
|
|
|
|
if (e > p)
|
|
|
|
{
|
|
|
|
// if filename ends in .exe, and is not a directory, remove the filename
|
2003-10-15 22:53:15 +00:00
|
|
|
if (!lstrcmpi(e, ".exe")) // check extension
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
DWORD d;
|
|
|
|
d=GetFileAttributes(p);
|
2004-01-30 23:51:31 +00:00
|
|
|
if (d == INVALID_FILE_ATTRIBUTES || !(d&FILE_ATTRIBUTE_DIRECTORY))
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-23 19:01:19 +00:00
|
|
|
// if there is no back-slash, the string will become empty, but that's ok because
|
|
|
|
// it would make an invalid instdir anyway
|
|
|
|
trimslashtoend(p);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-20 15:13:13 +00:00
|
|
|
mystrcpy(state_install_directory,addtrailingslash(p));
|
2003-09-04 18:25:57 +00:00
|
|
|
}
|
2002-08-04 20:25:10 +00:00
|
|
|
}
|
|
|
|
}
|
2003-09-04 18:25:57 +00:00
|
|
|
if (!is_valid_instpath(state_install_directory))
|
2002-08-24 14:44:23 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
GetNSISString(state_install_directory,header->install_directory_ptr);
|
|
|
|
}
|
2002-08-24 14:44:23 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
#ifdef NSIS_CONFIG_LOG
|
|
|
|
if (g_flags & CH_FLAGS_SILENT_LOG && !g_is_uninstaller)
|
|
|
|
{
|
2003-11-24 14:22:50 +00:00
|
|
|
#ifndef NSIS_CONFIG_LOG_ODS
|
2003-09-04 18:25:57 +00:00
|
|
|
build_g_logfile();
|
2003-11-24 14:22:50 +00:00
|
|
|
#endif
|
2003-09-04 18:25:57 +00:00
|
|
|
log_dolog=1;
|
2002-08-24 14:44:23 +00:00
|
|
|
}
|
2003-09-04 18:25:57 +00:00
|
|
|
#endif
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
2003-09-04 18:25:57 +00:00
|
|
|
g_hIcon=LoadImage(g_hInstance,MAKEINTRESOURCE(IDI_ICON2),IMAGE_ICON,0,0,LR_DEFAULTSIZE|LR_SHARED);
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_SUPPORT_BGBG
|
2003-09-04 18:25:57 +00:00
|
|
|
if (header->bg_color1 != -1)
|
|
|
|
{
|
2004-03-06 12:31:26 +00:00
|
|
|
DWORD cn = CHAR4_TO_DWORD('_', 'N', 'b', 0);
|
2003-09-04 18:25:57 +00:00
|
|
|
RECT vp;
|
|
|
|
extern LRESULT CALLBACK BG_WndProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
wc.lpfnWndProc = BG_WndProc;
|
|
|
|
wc.hInstance = g_hInstance;
|
|
|
|
wc.hIcon = g_hIcon;
|
|
|
|
//wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
2004-03-06 12:31:26 +00:00
|
|
|
wc.lpszClassName = (LPCSTR)&cn;
|
2002-11-21 16:46:05 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
if (!RegisterClass(&wc)) return 0;
|
2002-11-21 16:46:05 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
SystemParametersInfo(SPI_GETWORKAREA, 0, &vp, 0);
|
|
|
|
|
2004-03-06 12:31:26 +00:00
|
|
|
m_bgwnd = CreateWindowEx(WS_EX_TOOLWINDOW,(LPCSTR)&cn,0,WS_POPUP,
|
2003-09-04 18:25:57 +00:00
|
|
|
vp.left,vp.top,vp.right-vp.left,vp.bottom-vp.top,0,NULL,g_hInstance,NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
g_hwnd=m_bgwnd;
|
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
2002-11-21 16:46:05 +00:00
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_BGBG
|
2003-09-04 18:25:57 +00:00
|
|
|
|
|
|
|
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
// Select language
|
2004-09-25 10:49:08 +00:00
|
|
|
if (ExecuteCallbackFunction(CB_ONINIT)) return 2;
|
2003-09-04 18:25:57 +00:00
|
|
|
set_language();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2003-09-04 18:25:57 +00:00
|
|
|
#ifdef NSIS_SUPPORT_BGBG
|
|
|
|
g_hwnd=NULL;
|
|
|
|
#endif//NSIS_SUPPORT_BGBG
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
2003-09-04 18:25:57 +00:00
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
|
|
|
if (!g_exec_flags.silent)
|
|
|
|
#endif//NSIS_CONFIG_SILENT_SUPPORT
|
|
|
|
{
|
2003-05-09 21:11:14 +00:00
|
|
|
#ifdef NSIS_SUPPORT_BGBG
|
|
|
|
ShowWindow(m_bgwnd, SW_SHOW);
|
|
|
|
#endif//NSIS_SUPPORT_BGBG
|
2002-09-03 18:49:24 +00:00
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_LICENSEPAGE
|
|
|
|
{ // load richedit DLL
|
2002-09-18 23:19:13 +00:00
|
|
|
static char str1[]="RichEd20.dll";
|
|
|
|
static char str2[]="RichEdit20A";
|
|
|
|
if (!LoadLibrary(str1))
|
|
|
|
{
|
2002-09-22 19:05:43 +00:00
|
|
|
*(WORD*)(str1+6) = CHAR2_TO_WORD('3','2');
|
2002-09-18 23:19:13 +00:00
|
|
|
LoadLibrary(str1);
|
|
|
|
}
|
2002-09-03 18:49:24 +00:00
|
|
|
|
|
|
|
// make richedit20a point to RICHEDIT
|
2002-09-18 23:19:13 +00:00
|
|
|
if (!GetClassInfo(NULL,str2,&wc))
|
2002-09-03 18:49:24 +00:00
|
|
|
{
|
2002-09-18 23:19:13 +00:00
|
|
|
str2[8]=0;
|
|
|
|
GetClassInfo(NULL,str2,&wc);
|
|
|
|
wc.lpszClassName = str2;
|
|
|
|
str2[8]='2';
|
2002-09-03 18:49:24 +00:00
|
|
|
RegisterClass(&wc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-05-09 21:11:14 +00:00
|
|
|
{
|
|
|
|
int ret=DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST+dlg_offset),0,DialogProc);
|
|
|
|
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT)
|
2004-08-06 11:05:48 +00:00
|
|
|
ExecuteCallbackFunction(CB_ONGUIEND);
|
2003-05-09 21:11:14 +00:00
|
|
|
#endif
|
|
|
|
return ret;
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
else
|
2003-09-04 18:25:57 +00:00
|
|
|
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
if (install_thread(NULL))
|
|
|
|
{
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2004-08-06 11:05:48 +00:00
|
|
|
if (!g_quit_flag) ExecuteCallbackFunction(CB_ONINSTFAILED);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
2004-09-25 10:49:08 +00:00
|
|
|
return 2;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2004-08-06 11:05:48 +00:00
|
|
|
ExecuteCallbackFunction(CB_ONINSTSUCCESS);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
2002-08-08 15:04:45 +00:00
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif//NSIS_CONFIG_SILENT_SUPPORT
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
2003-09-04 18:25:57 +00:00
|
|
|
static int CALLBACK WINAPI BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
if (uMsg==BFFM_INITIALIZED)
|
|
|
|
{
|
2004-01-04 17:05:03 +00:00
|
|
|
my_GetDialogItemText(IDC_DIR,(char*)lpData);
|
2003-09-15 22:05:06 +00:00
|
|
|
SendMessage(hwnd,BFFM_SETSELECTION,(WPARAM)1,lpData);
|
|
|
|
}
|
|
|
|
if (uMsg==BFFM_SELCHANGED)
|
|
|
|
{
|
2003-09-22 16:06:53 +00:00
|
|
|
SendMessage(
|
|
|
|
hwnd,
|
|
|
|
BFFM_ENABLEOK,
|
|
|
|
0,
|
2003-12-22 14:02:15 +00:00
|
|
|
SHGetPathFromIDList((LPITEMIDLIST)lParam,(char*)lpData)
|
2003-09-22 16:06:53 +00:00
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2004-08-06 11:05:48 +00:00
|
|
|
&& !ExecuteCallbackFunction(CB_ONVERIFYINSTDIR)
|
2003-09-22 16:06:53 +00:00
|
|
|
#endif
|
|
|
|
);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2003-10-30 23:12:25 +00:00
|
|
|
|
2002-09-21 15:17:42 +00:00
|
|
|
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
if (uMsg == WM_INITDIALOG || uMsg == WM_NOTIFY_OUTER_NEXT)
|
|
|
|
{
|
2002-11-09 12:50:00 +00:00
|
|
|
page *this_page;
|
2003-09-04 18:25:57 +00:00
|
|
|
static DLGPROC winprocs[]=
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
#ifdef NSIS_CONFIG_LICENSEPAGE
|
2003-09-04 18:25:57 +00:00
|
|
|
LicenseProc,
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
2003-09-04 18:25:57 +00:00
|
|
|
SelProc,
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
2003-09-04 18:25:57 +00:00
|
|
|
DirProc,
|
|
|
|
InstProc,
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
2003-09-04 18:25:57 +00:00
|
|
|
UninstProc
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2004-05-15 11:22:48 +00:00
|
|
|
m_delta = wParam;
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_INITDIALOG)
|
|
|
|
{
|
|
|
|
g_hwnd=hwndDlg;
|
2002-09-23 20:56:29 +00:00
|
|
|
m_hwndOK=GetDlgItem(hwndDlg,IDOK);
|
|
|
|
m_hwndCancel=GetDlgItem(hwndDlg,IDCANCEL);
|
2002-10-01 14:13:23 +00:00
|
|
|
SetDlgItemTextFromLang(hwndDlg,IDC_VERSTR,LANG_BRANDING);
|
2003-10-30 23:12:25 +00:00
|
|
|
SetClassLong(hwndDlg,GCL_HICON,(long)g_hIcon);
|
2002-11-01 20:34:55 +00:00
|
|
|
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT)
|
2004-08-06 11:05:48 +00:00
|
|
|
g_quit_flag = ExecuteCallbackFunction(CB_ONGUIINIT);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
2003-11-09 22:45:25 +00:00
|
|
|
//ShowWindow(hwndDlg, SW_SHOW);
|
2004-05-15 11:22:48 +00:00
|
|
|
m_delta = 1;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
this_page=g_pages+m_page;
|
2002-11-09 12:50:00 +00:00
|
|
|
|
2003-01-24 19:40:20 +00:00
|
|
|
if (m_page>=0) {
|
2003-04-23 15:40:59 +00:00
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2003-03-18 15:45:25 +00:00
|
|
|
// Call leave function. If Abort used don't move to the next page.
|
2003-07-08 23:18:47 +00:00
|
|
|
// But if quit called we must exit now
|
2004-05-15 11:22:48 +00:00
|
|
|
if (m_delta==1) if (ExecuteCodeSegment(this_page->leavefunc,NULL)) return !g_quit_flag;
|
2003-04-23 15:40:59 +00:00
|
|
|
#endif
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-01-24 19:40:20 +00:00
|
|
|
// if the last page was a custom page, wait for it to finish by itself.
|
|
|
|
// if it doesn't, it's a BAD plugin.
|
|
|
|
// plugins should react to WM_NOTIFY_OUTER_NEXT.
|
2003-09-04 18:25:57 +00:00
|
|
|
if (!this_page->dlg_id) return 0;
|
2003-01-24 19:40:20 +00:00
|
|
|
}
|
2002-11-09 12:50:00 +00:00
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
NotifyCurWnd(WM_NOTIFY_INIGO_MONTOYA);
|
2003-09-04 18:25:57 +00:00
|
|
|
|
2002-11-01 20:34:55 +00:00
|
|
|
nextPage:
|
2004-05-15 11:22:48 +00:00
|
|
|
m_page+=m_delta;
|
|
|
|
this_page+=m_delta;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2004-08-06 11:05:48 +00:00
|
|
|
if (m_page==g_blocks[NB_PAGES].num) ExecuteCallbackFunction(CB_ONINSTSUCCESS);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
if (g_quit_flag || (unsigned int)m_page >= (unsigned int)g_blocks[NB_PAGES].num)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
DestroyWindow(m_curwnd);
|
2003-07-18 14:22:17 +00:00
|
|
|
g_hwnd = 0;
|
2002-11-09 12:50:00 +00:00
|
|
|
EndDialog(hwndDlg,m_retcode);
|
2002-11-01 20:34:55 +00:00
|
|
|
}
|
|
|
|
else
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-10-30 23:12:25 +00:00
|
|
|
HWND hwndtmp;
|
2002-11-01 20:34:55 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
int pflags = this_page->flags;
|
|
|
|
|
|
|
|
GetNSISString(state_click_next, this_page->clicknext);
|
|
|
|
SetDlgItemTextFromLang(hwndDlg, IDOK, this_page->next);
|
|
|
|
SetDlgItemTextFromLang(hwndDlg, IDC_BACK, this_page->back);
|
|
|
|
SetDlgItemTextFromLang(hwndDlg, IDCANCEL, this_page->cancel);
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
hwndtmp = GetDlgItem(hwndDlg, IDC_BACK);
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
if (g_exec_flags.abort)
|
2003-04-04 12:27:58 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
pflags &= ~(PF_BACK_ENABLE | PF_NEXT_ENABLE);
|
|
|
|
pflags |= PF_CANCEL_ENABLE;
|
2003-04-04 12:27:58 +00:00
|
|
|
}
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
ShowWindow(hwndtmp, pflags & PF_BACK_SHOW);// SW_HIDE = 0, PF_BACK_SHOW = SW_SHOWNA = 8
|
|
|
|
EnableWindow(hwndtmp, pflags & PF_BACK_ENABLE);
|
2004-01-04 17:05:03 +00:00
|
|
|
EnableNext(pflags & PF_NEXT_ENABLE);
|
2003-09-04 18:25:57 +00:00
|
|
|
EnableWindow(m_hwndCancel, pflags & PF_CANCEL_ENABLE);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
SendMessage(hwndtmp, BM_SETSTYLE, BS_PUSHBUTTON, TRUE);
|
|
|
|
|
|
|
|
if (g_exec_flags.abort)
|
|
|
|
{
|
|
|
|
SendMessage(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
|
2004-03-06 12:31:26 +00:00
|
|
|
SetActiveCtl(m_hwndCancel);
|
2004-01-04 17:05:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-03-06 12:31:26 +00:00
|
|
|
SetActiveCtl(m_hwndOK);
|
2004-01-04 17:05:03 +00:00
|
|
|
}
|
|
|
|
|
2002-11-30 13:15:49 +00:00
|
|
|
mystrcpy(g_tmp,g_caption);
|
2003-09-04 18:25:57 +00:00
|
|
|
GetNSISString(g_tmp+mystrlen(g_tmp),this_page->caption);
|
2002-12-02 23:08:10 +00:00
|
|
|
my_SetWindowText(hwndDlg,g_tmp);
|
2002-11-30 13:15:49 +00:00
|
|
|
|
2002-12-06 15:43:35 +00:00
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2003-12-29 14:27:33 +00:00
|
|
|
// custom page or user used abort in prefunc
|
2003-09-04 18:25:57 +00:00
|
|
|
if (ExecuteCodeSegment(this_page->prefunc, NULL) || !this_page->dlg_id) {
|
2002-12-06 15:43:35 +00:00
|
|
|
goto nextPage;
|
2003-09-04 18:25:57 +00:00
|
|
|
}
|
2002-12-06 15:43:35 +00:00
|
|
|
#endif //NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
if (this_page->wndproc_id != PWP_COMPLETED)
|
|
|
|
{
|
|
|
|
DestroyWindow(m_curwnd);
|
|
|
|
}
|
2002-11-25 16:50:05 +00:00
|
|
|
else {
|
2004-01-04 17:05:03 +00:00
|
|
|
if (!g_exec_flags.abort && g_exec_flags.autoclose)
|
|
|
|
goto nextPage;
|
|
|
|
// no need to go to skipPage because PWP_COMPLETED always follows PWP_INSTFILES
|
|
|
|
return FALSE;
|
2002-11-25 16:50:05 +00:00
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2003-09-11 20:46:20 +00:00
|
|
|
// update g_this_page for the dialog proc
|
|
|
|
g_this_page=this_page;
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
if (this_page->dlg_id > 0) // NSIS page
|
2002-11-09 12:50:00 +00:00
|
|
|
{
|
2003-10-30 23:12:25 +00:00
|
|
|
m_curwnd=CreateDialogParam(
|
2003-04-21 13:32:34 +00:00
|
|
|
g_hInstance,
|
2003-09-04 18:25:57 +00:00
|
|
|
MAKEINTRESOURCE(this_page->dlg_id+dlg_offset),
|
|
|
|
hwndDlg,winprocs[this_page->wndproc_id],(LPARAM)this_page
|
2003-04-21 13:32:34 +00:00
|
|
|
);
|
2003-10-30 23:12:25 +00:00
|
|
|
if (m_curwnd)
|
2002-11-09 12:50:00 +00:00
|
|
|
{
|
|
|
|
RECT r;
|
2003-09-04 18:25:57 +00:00
|
|
|
|
2003-10-30 23:12:25 +00:00
|
|
|
SetDlgItemTextFromLang(m_curwnd,IDC_INTROTEXT,this_page->parms[0]);
|
2003-09-04 18:25:57 +00:00
|
|
|
|
2002-11-09 12:50:00 +00:00
|
|
|
GetWindowRect(GetDlgItem(hwndDlg,IDC_CHILDRECT),&r);
|
|
|
|
ScreenToClient(hwndDlg,(LPPOINT)&r);
|
2003-10-30 23:12:25 +00:00
|
|
|
SetWindowPos(m_curwnd,0,r.left,r.top,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER);
|
2002-11-11 20:24:26 +00:00
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2003-01-24 19:40:20 +00:00
|
|
|
ExecuteCodeSegment(this_page->showfunc,NULL);
|
2002-11-11 20:24:26 +00:00
|
|
|
#endif //NSIS_SUPPORT_CODECALLBACKS
|
2003-10-30 23:12:25 +00:00
|
|
|
ShowWindow(m_curwnd,SW_SHOWNA);
|
2004-01-04 17:05:03 +00:00
|
|
|
NotifyCurWnd(WM_NOTIFY_START);
|
2002-11-01 20:34:55 +00:00
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-09 22:45:25 +00:00
|
|
|
|
|
|
|
skipPage:
|
|
|
|
|
|
|
|
if (!ui_dlg_visible && m_curwnd)
|
|
|
|
{
|
2004-01-04 17:05:03 +00:00
|
|
|
ShowWindow(hwndDlg, SW_SHOWDEFAULT);
|
2003-11-27 23:21:15 +00:00
|
|
|
ui_dlg_visible = 1;
|
2003-11-09 22:45:25 +00:00
|
|
|
}
|
|
|
|
|
2003-03-29 17:16:09 +00:00
|
|
|
return FALSE;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2003-03-09 19:49:19 +00:00
|
|
|
|
|
|
|
#ifdef NSIS_SUPPORT_BGBG
|
|
|
|
if (uMsg == WM_WINDOWPOSCHANGED)
|
|
|
|
{
|
|
|
|
SetWindowPos(m_bgwnd, hwndDlg, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
|
|
|
|
}
|
|
|
|
if (uMsg == WM_SIZE) {
|
|
|
|
ShowWindow(m_bgwnd, wParam == SIZE_MINIMIZED ? SW_HIDE : SW_SHOW);
|
|
|
|
}
|
|
|
|
#endif //NSIS_SUPPORT_BGBG
|
|
|
|
|
2003-10-30 23:12:25 +00:00
|
|
|
if (uMsg == WM_NOTIFY_CUSTOM_READY) {
|
2002-12-06 15:43:35 +00:00
|
|
|
DestroyWindow(m_curwnd);
|
2003-07-10 00:28:05 +00:00
|
|
|
m_curwnd = (HWND)wParam;
|
2003-11-09 22:45:25 +00:00
|
|
|
goto skipPage;
|
2002-12-06 15:43:35 +00:00
|
|
|
}
|
2004-10-14 13:56:02 +00:00
|
|
|
if (uMsg == WM_QUERYENDSESSION)
|
|
|
|
{
|
|
|
|
SetWindowLong(hwndDlg, DWL_MSGRESULT, FALSE);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (uMsg == WM_CLOSE && m_page == g_blocks[NB_PAGES].num - 1)
|
2002-11-30 13:15:49 +00:00
|
|
|
{
|
2003-12-29 15:12:41 +00:00
|
|
|
if (!IsWindowEnabled(m_hwndCancel))
|
2002-11-30 13:15:49 +00:00
|
|
|
{
|
|
|
|
uMsg = WM_COMMAND;
|
|
|
|
wParam = IDOK;
|
|
|
|
}
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_COMMAND)
|
|
|
|
{
|
2003-12-29 15:12:41 +00:00
|
|
|
int id = LOWORD(wParam);
|
|
|
|
HWND hCtl = GetDlgItem(hwndDlg, id);
|
2004-01-04 17:05:03 +00:00
|
|
|
if (hCtl)
|
|
|
|
{
|
|
|
|
SendMessage(hCtl, BM_SETSTATE, FALSE, 0);
|
|
|
|
if (!IsWindowEnabled(hCtl))
|
|
|
|
return 0;
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-11-01 20:34:55 +00:00
|
|
|
if (id == IDOK)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-09-21 03:21:56 +00:00
|
|
|
outernotify(1);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2004-09-03 12:52:29 +00:00
|
|
|
else if (id == IDC_BACK && m_page>0)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-09-21 03:21:56 +00:00
|
|
|
outernotify(-1);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2004-09-03 12:52:29 +00:00
|
|
|
else if (id == IDCANCEL)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
if (g_exec_flags.abort)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2004-08-06 11:05:48 +00:00
|
|
|
ExecuteCallbackFunction(CB_ONINSTFAILED);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
2002-11-09 12:50:00 +00:00
|
|
|
m_retcode=2;
|
2002-11-21 16:46:05 +00:00
|
|
|
outernotify(NOTIFY_BYE_BYE);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2004-08-06 11:05:48 +00:00
|
|
|
if (!ExecuteCallbackFunction(CB_ONUSERABORT))
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
{
|
2002-11-09 12:50:00 +00:00
|
|
|
m_retcode=1;
|
2002-11-21 16:46:05 +00:00
|
|
|
outernotify(NOTIFY_BYE_BYE);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-07-10 00:28:05 +00:00
|
|
|
else
|
|
|
|
{
|
2003-12-23 16:29:36 +00:00
|
|
|
// Forward WM_COMMANDs to inner dialogs, can be custom ones.
|
|
|
|
// Without this, enter on buttons in inner dialogs won't work.
|
2003-12-29 15:12:41 +00:00
|
|
|
SendMessage(m_curwnd, WM_COMMAND, wParam, lParam);
|
2003-07-10 00:28:05 +00:00
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2002-08-21 19:15:00 +00:00
|
|
|
return HandleStaticBkColor();
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2004-01-29 01:23:24 +00:00
|
|
|
#define this_page ((page*)lParam)
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_LICENSEPAGE
|
2003-03-09 19:49:19 +00:00
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#define _RICHEDIT_VER 0x0200
|
2004-06-11 11:24:09 +00:00
|
|
|
#include <richedit.h>
|
2002-08-02 10:01:35 +00:00
|
|
|
#undef _RICHEDIT_VER
|
2002-08-21 19:15:00 +00:00
|
|
|
static DWORD dwRead;
|
|
|
|
DWORD CALLBACK StreamLicense(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
|
|
|
{
|
|
|
|
lstrcpyn(pbBuff,(char*)dwCookie+dwRead,cb);
|
2002-09-19 21:53:24 +00:00
|
|
|
*pcb=mystrlen(pbBuff);
|
2003-03-04 20:29:56 +00:00
|
|
|
dwRead+=*pcb;
|
2002-08-21 19:15:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
page *m_this_page=g_this_page;
|
2003-03-29 13:39:48 +00:00
|
|
|
HWND hwLicense;
|
2004-01-04 17:05:03 +00:00
|
|
|
static int ignoreWMCommand;
|
2003-09-04 18:25:57 +00:00
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_INITDIALOG)
|
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
char *l = (char *)GetNSISStringNP(GetNSISTab(this_page->parms[1]));
|
|
|
|
int lt = *l;
|
|
|
|
EDITSTREAM es = {
|
|
|
|
(DWORD)(++l),
|
|
|
|
0,
|
|
|
|
StreamLicense
|
|
|
|
};
|
|
|
|
|
|
|
|
int selected = (this_page->flags & PF_LICENSE_SELECTED) | !(this_page->flags & PF_LICENSE_FORCE_SELECTION);
|
2003-03-26 17:47:46 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
SetUITextFromLang(IDC_LICENSEAGREE,this_page->parms[2]);
|
|
|
|
SetUITextFromLang(IDC_LICENSEDISAGREE,this_page->parms[3]);
|
2004-01-04 17:05:03 +00:00
|
|
|
CheckDlgButton(hwndDlg,IDC_LICENSEAGREE+!selected,BST_CHECKED);
|
|
|
|
EnableNext(selected);
|
2003-03-26 17:47:46 +00:00
|
|
|
|
2002-09-23 19:27:42 +00:00
|
|
|
hwLicense=GetUIItem(IDC_EDIT1);
|
2004-03-06 12:31:26 +00:00
|
|
|
SetActiveCtl(hwLicense);
|
2002-08-02 10:01:35 +00:00
|
|
|
SendMessage(hwLicense,EM_AUTOURLDETECT,TRUE,0);
|
2003-09-04 18:25:57 +00:00
|
|
|
#define lbg g_header->license_bg
|
2003-05-25 17:51:20 +00:00
|
|
|
SendMessage(hwLicense,EM_SETBKGNDCOLOR,0,lbg>=0?lbg:GetSysColor(-lbg));
|
|
|
|
#undef lbg
|
2002-09-08 11:02:28 +00:00
|
|
|
SendMessage(hwLicense,EM_SETEVENTMASK,0,ENM_LINK|ENM_KEYEVENTS); //XGE 8th September 2002 Or'd in ENM_KEYEVENTS
|
2002-08-21 19:15:00 +00:00
|
|
|
dwRead=0;
|
2003-09-04 18:25:57 +00:00
|
|
|
SendMessage(hwLicense,EM_EXLIMITTEXT,0,mystrlen(l));
|
|
|
|
SendMessage(hwLicense,EM_STREAMIN,lt,(LPARAM)&es);
|
2004-01-04 17:05:03 +00:00
|
|
|
ignoreWMCommand = 0;
|
2002-09-06 17:29:34 +00:00
|
|
|
return FALSE;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2004-01-04 17:05:03 +00:00
|
|
|
if (uMsg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED && !ignoreWMCommand) {
|
2003-09-04 18:25:57 +00:00
|
|
|
if (m_this_page->flags & PF_LICENSE_FORCE_SELECTION) {
|
|
|
|
int is = SendMessage(GetUIItem(IDC_LICENSEAGREE), BM_GETCHECK, 0, 0) & BST_CHECKED;
|
|
|
|
m_this_page->flags &= ~PF_LICENSE_SELECTED;
|
|
|
|
m_this_page->flags |= is;
|
2004-01-04 17:05:03 +00:00
|
|
|
EnableNext(is);
|
|
|
|
SetNextDef();
|
2003-09-04 18:25:57 +00:00
|
|
|
}
|
2003-03-26 17:47:46 +00:00
|
|
|
}
|
2002-11-30 13:15:49 +00:00
|
|
|
if (uMsg == WM_NOTIFY) {
|
2003-03-29 13:39:48 +00:00
|
|
|
hwLicense=GetUIItem(IDC_EDIT1);
|
2002-09-12 11:47:05 +00:00
|
|
|
#define nmhdr ((NMHDR *)lParam)
|
|
|
|
#define enlink ((ENLINK *)lParam)
|
|
|
|
#define msgfilter ((MSGFILTER *)lParam)
|
|
|
|
if (nmhdr->code==EN_LINK) {
|
2002-08-02 10:01:35 +00:00
|
|
|
if (enlink->msg==WM_LBUTTONDOWN) {
|
2003-03-29 13:39:48 +00:00
|
|
|
TEXTRANGE tr = {
|
2004-03-12 20:43:54 +00:00
|
|
|
{
|
|
|
|
enlink->chrg.cpMin,
|
|
|
|
enlink->chrg.cpMax,
|
|
|
|
},
|
2003-03-29 13:39:48 +00:00
|
|
|
ps_tmpbuf
|
|
|
|
};
|
|
|
|
if (tr.chrg.cpMax-tr.chrg.cpMin < sizeof(ps_tmpbuf)) {
|
|
|
|
SendMessage(hwLicense,EM_GETTEXTRANGE,0,(LPARAM)&tr);
|
|
|
|
SetCursor(LoadCursor(0,IDC_WAIT));
|
2003-04-05 12:56:57 +00:00
|
|
|
ShellExecute(hwndDlg,"open",tr.lpstrText,NULL,NULL,SW_SHOWNORMAL);
|
2003-03-29 13:39:48 +00:00
|
|
|
SetCursor(LoadCursor(0,IDC_ARROW));
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2002-11-30 13:15:49 +00:00
|
|
|
if (enlink->msg==WM_SETCURSOR) {
|
2002-08-02 10:01:35 +00:00
|
|
|
SetCursor(LoadCursor(0,IDC_HAND));
|
|
|
|
}
|
|
|
|
}
|
2002-09-08 11:02:28 +00:00
|
|
|
//Ximon Eighteen 8th September 2002 Capture return key presses in the rich
|
|
|
|
//edit control now that the control gets the focus rather than the default
|
|
|
|
//push button. When the user presses return ask the outer dialog to move
|
|
|
|
//the installer onto the next page. MSDN docs say return non-zero if the
|
|
|
|
//rich edit control should NOT process this message, hence the return 1.
|
2002-11-30 13:15:49 +00:00
|
|
|
if (nmhdr->code==EN_MSGFILTER)
|
2002-09-07 21:33:48 +00:00
|
|
|
{
|
2003-03-29 13:39:48 +00:00
|
|
|
if (msgfilter->msg==WM_KEYDOWN)
|
2002-09-07 21:33:48 +00:00
|
|
|
{
|
2003-12-29 15:12:41 +00:00
|
|
|
if (msgfilter->wParam==VK_RETURN) {
|
|
|
|
SendMessage(g_hwnd, WM_COMMAND, IDOK, 0);
|
2003-03-29 13:39:48 +00:00
|
|
|
}
|
|
|
|
if (msgfilter->wParam==VK_ESCAPE) {
|
|
|
|
SendMessage(g_hwnd, WM_CLOSE, 0, 0);
|
|
|
|
}
|
2002-09-07 21:33:48 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2002-11-30 13:15:49 +00:00
|
|
|
#undef nmhdr
|
|
|
|
#undef enlink
|
|
|
|
#undef msgfilter
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2004-01-04 17:05:03 +00:00
|
|
|
if (uMsg == WM_NOTIFY_INIGO_MONTOYA)
|
|
|
|
{
|
|
|
|
ignoreWMCommand++;
|
|
|
|
}
|
2002-08-21 19:15:00 +00:00
|
|
|
return HandleStaticBkColor();
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
|
|
|
static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
if (uMsg == WM_INITDIALOG)
|
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
SetUITextFromLang(IDC_UNINSTFROM,this_page->parms[1]);
|
|
|
|
SetUITextNT(IDC_EDIT1,g_usrvars[this_page->parms[4]]);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2002-08-21 19:15:00 +00:00
|
|
|
return HandleStaticBkColor();
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-10-05 16:20:13 +00:00
|
|
|
static char * NSISCALL inttosizestr(int kb, char *str)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
char scalestr[32], byte[32];
|
2002-09-18 22:30:59 +00:00
|
|
|
char sh=20;
|
2003-04-21 13:32:34 +00:00
|
|
|
int scale=LANG_GIGA;
|
|
|
|
if (kb < 1024) { sh=0; scale=LANG_KILO; }
|
|
|
|
else if (kb < 1024*1024) { sh=10; scale=LANG_MEGA; }
|
2003-09-04 18:25:57 +00:00
|
|
|
wsprintf(
|
|
|
|
str+mystrlen(str),
|
2004-03-06 12:31:26 +00:00
|
|
|
"%d.%d%s%s",
|
2003-09-04 18:25:57 +00:00
|
|
|
kb>>sh,
|
|
|
|
((kb*10)>>sh)%10,
|
|
|
|
GetNSISString(scalestr,scale),
|
2004-03-06 12:31:26 +00:00
|
|
|
GetNSISString(byte,LANG_BYTE)
|
2003-09-04 18:25:57 +00:00
|
|
|
);
|
2002-10-05 16:20:13 +00:00
|
|
|
return str;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
static int NSISCALL _sumsecsfield(int idx)
|
2003-11-14 21:08:51 +00:00
|
|
|
{
|
|
|
|
int x,total;
|
|
|
|
section *sections = g_sections;
|
|
|
|
for (total = x = 0; x < num_sections; x++)
|
|
|
|
{
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
|
|
|
if (sections[x].flags & SF_SELECTED)
|
|
|
|
#endif
|
2004-03-29 20:21:00 +00:00
|
|
|
total += ((int *)§ions[x])[idx];
|
2003-11-14 21:08:51 +00:00
|
|
|
}
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
#define sumsecsfield(x) _sumsecsfield(SECTION_OFFSET(x))
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2004-01-04 17:05:03 +00:00
|
|
|
static int dontsetdefstyle;
|
2003-11-24 17:05:10 +00:00
|
|
|
page *thispage = g_this_page;
|
|
|
|
char *dir = g_usrvars[thispage->parms[4]];
|
|
|
|
int browse_text = thispage->parms[3];
|
2003-02-07 23:04:25 +00:00
|
|
|
if (uMsg == WM_NOTIFY_INIGO_MONTOYA)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2004-01-04 17:05:03 +00:00
|
|
|
GetUIText(IDC_DIR,dir);
|
2003-09-04 18:25:57 +00:00
|
|
|
validate_filename(dir);
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_LOG
|
2003-11-24 14:22:50 +00:00
|
|
|
#ifndef NSIS_CONFIG_LOG_ODS
|
2002-08-02 10:01:35 +00:00
|
|
|
build_g_logfile();
|
2003-11-24 14:22:50 +00:00
|
|
|
#endif
|
2002-10-05 16:20:13 +00:00
|
|
|
log_dolog = IsDlgButtonChecked(hwndDlg,IDC_CHECK1);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
if (uMsg == WM_INITDIALOG)
|
|
|
|
{
|
|
|
|
#ifdef NSIS_CONFIG_LOG
|
|
|
|
if (GetAsyncKeyState(VK_SHIFT)&0x8000)
|
|
|
|
{
|
2002-09-23 19:27:42 +00:00
|
|
|
HWND h=GetUIItem(IDC_CHECK1);
|
2003-09-04 18:25:57 +00:00
|
|
|
SetUITextFromLang(IDC_CHECK1,LANG_LOG_INSTALL_PROCESS);
|
2002-08-02 10:01:35 +00:00
|
|
|
ShowWindow(h,SW_SHOWNA);
|
|
|
|
}
|
|
|
|
#endif
|
2003-09-26 21:12:43 +00:00
|
|
|
if (validpathspec(dir) && !skip_root(dir))
|
|
|
|
addtrailingslash(dir);
|
|
|
|
SetUITextNT(IDC_DIR,dir);
|
2003-09-04 18:25:57 +00:00
|
|
|
SetUITextFromLang(IDC_BROWSE,this_page->parms[2]);
|
|
|
|
SetUITextFromLang(IDC_SELDIRTEXT,this_page->parms[1]);
|
2004-03-06 12:31:26 +00:00
|
|
|
SetActiveCtl(GetUIItem(IDC_DIR));
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
if (uMsg == WM_COMMAND)
|
|
|
|
{
|
|
|
|
int id=LOWORD(wParam);
|
|
|
|
if (id == IDC_DIR && HIWORD(wParam) == EN_CHANGE)
|
|
|
|
{
|
2002-11-30 13:15:49 +00:00
|
|
|
uMsg = WM_IN_UPDATEMSG;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
if (id == IDC_BROWSE)
|
|
|
|
{
|
2003-09-15 22:05:06 +00:00
|
|
|
BROWSEINFO bi = {0,};
|
2002-08-02 10:01:35 +00:00
|
|
|
ITEMIDLIST *idlist;
|
|
|
|
bi.hwndOwner = hwndDlg;
|
2004-01-04 17:05:03 +00:00
|
|
|
bi.pszDisplayName = g_tmp;
|
2003-09-15 22:05:06 +00:00
|
|
|
bi.lpfn = BrowseCallbackProc;
|
2003-09-22 16:06:53 +00:00
|
|
|
bi.lParam = (LPARAM)dir;
|
2003-09-15 22:05:06 +00:00
|
|
|
bi.lpszTitle = GetNSISStringTT(browse_text);
|
2002-08-02 10:01:35 +00:00
|
|
|
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
|
2003-06-05 20:33:33 +00:00
|
|
|
idlist = SHBrowseForFolder(&bi);
|
2002-08-02 10:01:35 +00:00
|
|
|
if (idlist)
|
|
|
|
{
|
2004-02-06 22:37:46 +00:00
|
|
|
// free idlist
|
|
|
|
FreePIDL(idlist);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
if (g_header->install_directory_auto_append)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2004-02-06 22:37:46 +00:00
|
|
|
const char *post_str = ps_tmpbuf;
|
2003-09-04 18:25:57 +00:00
|
|
|
GetNSISStringTT(g_header->install_directory_auto_append);
|
2004-02-06 22:37:46 +00:00
|
|
|
// display name gives just the folder name
|
|
|
|
if (lstrcmpi(post_str, g_tmp))
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2004-02-06 22:37:46 +00:00
|
|
|
lstrcat(addtrailingslash(dir), post_str);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
dontsetdefstyle++;
|
2003-09-22 16:06:53 +00:00
|
|
|
SetUITextNT(IDC_DIR,dir);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-09-18 14:46:55 +00:00
|
|
|
if (uMsg == WM_IN_UPDATEMSG || uMsg == WM_NOTIFY_START)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
static char s[NSIS_MAX_STRLEN];
|
2003-09-23 19:01:19 +00:00
|
|
|
char *p;
|
2003-11-24 17:05:10 +00:00
|
|
|
int error = 0;
|
2003-11-14 21:08:51 +00:00
|
|
|
int total, available=-1;
|
2004-03-06 12:31:26 +00:00
|
|
|
HMODULE hLib;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
GetUIText(IDC_DIR,dir);
|
2003-11-24 17:05:10 +00:00
|
|
|
if (!is_valid_instpath(dir))
|
|
|
|
error = NSIS_INSTDIR_INVALID;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
mystrcpy(s,dir);
|
2003-09-23 19:01:19 +00:00
|
|
|
p=skip_root(s);
|
|
|
|
if (p)
|
|
|
|
*p=0;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2004-03-06 12:31:26 +00:00
|
|
|
// Test for and use the GetDiskFreeSpaceEx API
|
|
|
|
hLib = GetModuleHandle("KERNEL32.dll");
|
|
|
|
if (hLib)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2004-03-06 12:31:26 +00:00
|
|
|
BOOL (WINAPI *GDFSE)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER) =
|
|
|
|
(void*)GetProcAddress(hLib, "GetDiskFreeSpaceExA");
|
|
|
|
if (GDFSE)
|
|
|
|
{
|
|
|
|
ULARGE_INTEGER available64;
|
2004-04-24 19:16:10 +00:00
|
|
|
ULARGE_INTEGER a, b;
|
|
|
|
if (GDFSE(s, &available64, &a, &b))
|
2004-03-06 12:31:26 +00:00
|
|
|
available = (int)(available64.QuadPart >> 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (available == -1)
|
|
|
|
{
|
|
|
|
// GetDiskFreeSpaceEx is not available
|
|
|
|
DWORD spc, bps, fc, tc;
|
|
|
|
if (GetDiskFreeSpace(s, &spc, &bps, &fc, &tc))
|
|
|
|
available = (int)MulDiv(bps * spc, fc, 1 << 10);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2003-11-14 21:08:51 +00:00
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
total = sumsecsfield(size_kb);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2003-11-24 17:05:10 +00:00
|
|
|
if ((unsigned int)available < (unsigned int)total)
|
|
|
|
error = NSIS_INSTDIR_NOT_ENOUGH_SPACE;
|
|
|
|
|
2002-10-01 14:13:23 +00:00
|
|
|
if (LANG_STR_TAB(LANG_SPACE_REQ)) {
|
2003-09-04 18:25:57 +00:00
|
|
|
SetUITextNT(IDC_SPACEREQUIRED,inttosizestr(total,GetNSISString(s,LANG_SPACE_REQ)));
|
2004-03-06 12:31:26 +00:00
|
|
|
// Did we get a usable value above?
|
|
|
|
if (available >= 0)
|
2003-09-04 18:25:57 +00:00
|
|
|
SetUITextNT(IDC_SPACEAVAILABLE,inttosizestr(available,GetNSISString(s,LANG_SPACE_AVAIL)));
|
2002-08-02 10:01:35 +00:00
|
|
|
else
|
2002-09-23 19:27:42 +00:00
|
|
|
SetUITextNT(IDC_SPACEAVAILABLE,"");
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2003-11-24 17:05:10 +00:00
|
|
|
g_exec_flags.instdir_error = error;
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2003-11-24 17:05:10 +00:00
|
|
|
if (!error)
|
2004-08-06 11:05:48 +00:00
|
|
|
error = ExecuteCallbackFunction(CB_ONVERIFYINSTDIR);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
2003-11-24 17:05:10 +00:00
|
|
|
|
|
|
|
if (thispage->flags & PF_DIR_NO_BTN_DISABLE)
|
|
|
|
error = 0;
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
EnableNext(!error);
|
|
|
|
if (!error && !dontsetdefstyle)
|
|
|
|
SetNextDef();
|
|
|
|
dontsetdefstyle = 0;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2002-08-21 19:15:00 +00:00
|
|
|
return HandleStaticBkColor();
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
|
|
|
|
2003-04-05 12:56:57 +00:00
|
|
|
static int NSISCALL SetChildrenStates(HWND hwTree, HTREEITEM hItem, int iChecked)
|
|
|
|
{
|
|
|
|
int iCheckedChildren = 0, iChildren = 0, *pFlags, iState = 1;
|
|
|
|
HTREEITEM hItrItem;
|
|
|
|
TVITEM tvItem;
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-04-05 12:56:57 +00:00
|
|
|
hItrItem = TreeView_GetChild(hwTree, hItem);
|
|
|
|
while (hItrItem)
|
|
|
|
{
|
|
|
|
iCheckedChildren += SetChildrenStates(hwTree, hItrItem, iChecked);
|
|
|
|
iChildren++;
|
|
|
|
hItrItem = TreeView_GetNextSibling(hwTree, hItrItem);
|
|
|
|
}
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-04-05 12:56:57 +00:00
|
|
|
tvItem.hItem = hItem;
|
|
|
|
tvItem.mask = TVIF_PARAM | TVIF_STATE;
|
|
|
|
tvItem.stateMask = TVIS_STATEIMAGEMASK;
|
|
|
|
TreeView_GetItem(hwTree, &tvItem);
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
pFlags = &(g_sections[tvItem.lParam].flags);
|
2003-04-05 12:56:57 +00:00
|
|
|
|
|
|
|
if (*pFlags & SF_RO)
|
|
|
|
{
|
|
|
|
iState = 4;
|
|
|
|
iChecked = *pFlags & SF_SELECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pFlags &= ~(SF_SELECTED|SF_PSELECTED);
|
|
|
|
|
|
|
|
if (iCheckedChildren || iChecked)
|
|
|
|
{
|
|
|
|
iState++;
|
|
|
|
if (iChildren == iCheckedChildren)
|
|
|
|
{
|
|
|
|
*pFlags |= SF_SELECTED;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iState++;
|
|
|
|
*pFlags |= SF_PSELECTED;
|
|
|
|
}
|
|
|
|
iChecked = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
tvItem.state = INDEXTOSTATEIMAGEMASK(iState);
|
|
|
|
|
|
|
|
TreeView_SetItem(hwTree, &tvItem);
|
|
|
|
|
|
|
|
return iChecked;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void NSISCALL SetParentState(HWND hwTree, HTREEITEM hItem)
|
2002-08-26 13:33:34 +00:00
|
|
|
{
|
2003-04-05 12:56:57 +00:00
|
|
|
TVITEM tvItem;
|
|
|
|
int iState = 0, iItrState, *iFlags;
|
|
|
|
|
|
|
|
HTREEITEM hParent = TreeView_GetParent(hwTree, hItem);
|
|
|
|
if (!hParent)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hItem = TreeView_GetChild(hwTree, hParent);
|
|
|
|
|
|
|
|
tvItem.mask = TVIF_STATE | TVIF_PARAM;
|
|
|
|
tvItem.stateMask = TVIS_STATEIMAGEMASK;
|
|
|
|
|
|
|
|
while (hItem) {
|
|
|
|
tvItem.hItem = hItem;
|
|
|
|
TreeView_GetItem(hwTree, &tvItem);
|
|
|
|
iItrState = tvItem.state >> 12;
|
|
|
|
iState |= iItrState % 3 ? iItrState % 3 : 3;
|
|
|
|
hItem = TreeView_GetNextSibling(hwTree, hItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
tvItem.hItem = hParent;
|
|
|
|
TreeView_GetItem(hwTree, &tvItem);
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
iFlags = &(g_sections[tvItem.lParam].flags);
|
2003-04-05 12:56:57 +00:00
|
|
|
*iFlags &= ~(SF_SELECTED|SF_PSELECTED);
|
|
|
|
|
|
|
|
if (iState == 2)
|
|
|
|
*iFlags |= SF_SELECTED;
|
|
|
|
if (iState == 3)
|
|
|
|
*iFlags |= SF_PSELECTED;
|
|
|
|
|
|
|
|
tvItem.state = INDEXTOSTATEIMAGEMASK(iState);
|
|
|
|
TreeView_SetItem(hwTree, &tvItem);
|
|
|
|
|
|
|
|
SetParentState(hwTree, hParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define CheckTreeItem(h, i, c) { SetChildrenStates(h, i, c); SetParentState(h, i); }
|
|
|
|
|
|
|
|
HTREEITEM NSISCALL TreeHitTest(HWND tree)
|
|
|
|
{
|
|
|
|
TVHITTESTINFO ht;
|
2002-08-26 13:33:34 +00:00
|
|
|
DWORD dwpos = GetMessagePos();
|
|
|
|
|
|
|
|
ht.pt.x = GET_X_LPARAM(dwpos);
|
|
|
|
ht.pt.y = GET_Y_LPARAM(dwpos);
|
2004-01-04 17:05:03 +00:00
|
|
|
ScreenToClient(tree, &ht.pt);
|
2002-08-26 13:33:34 +00:00
|
|
|
|
|
|
|
TreeView_HitTest(tree, &ht);
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2004-09-25 11:22:46 +00:00
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE_ALTERNATIVE
|
|
|
|
if (ht.flags & TVHT_ONITEMSTATEICON)
|
|
|
|
#else
|
2003-04-05 12:56:57 +00:00
|
|
|
if (ht.flags & (TVHT_ONITEMSTATEICON|TVHT_ONITEMLABEL|TVHT_ONITEMRIGHT|TVHT_ONITEM))
|
2004-09-25 11:22:46 +00:00
|
|
|
#endif
|
2003-04-05 12:56:57 +00:00
|
|
|
return ht.hItem;
|
2002-08-26 13:33:34 +00:00
|
|
|
|
2003-04-05 12:56:57 +00:00
|
|
|
return 0;
|
2002-08-26 13:33:34 +00:00
|
|
|
}
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
static LONG oldTreeWndProc;
|
|
|
|
static DWORD WINAPI newTreeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2002-08-26 13:33:34 +00:00
|
|
|
static LPARAM last_item=-1;
|
2004-01-04 19:45:14 +00:00
|
|
|
if (uMsg == WM_CHAR && wParam == (WPARAM)' ')
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2004-01-04 17:05:03 +00:00
|
|
|
NotifyCurWnd(WM_TREEVIEW_KEYHACK);
|
2004-01-04 19:45:14 +00:00
|
|
|
return 0;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2002-11-01 20:34:55 +00:00
|
|
|
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT)
|
2002-08-26 13:33:34 +00:00
|
|
|
if (uMsg == WM_DESTROY) {
|
|
|
|
last_item=-1;
|
|
|
|
}
|
2004-09-25 11:22:46 +00:00
|
|
|
#ifndef NSIS_CONFIG_COMPONENTPAGE_ALTERNATIVE
|
2002-08-25 16:09:17 +00:00
|
|
|
if (uMsg == WM_MOUSEMOVE) {
|
2003-04-05 12:56:57 +00:00
|
|
|
TVITEM tvItem;
|
2002-08-25 16:09:17 +00:00
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
if (IsWindowVisible(hwnd)) {
|
2003-04-20 16:15:03 +00:00
|
|
|
tvItem.hItem = TreeHitTest(hwnd);
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-04-20 16:15:03 +00:00
|
|
|
lParam = -1;
|
|
|
|
|
|
|
|
if (tvItem.hItem)
|
|
|
|
{
|
|
|
|
tvItem.mask = TVIF_PARAM;
|
|
|
|
|
|
|
|
TreeView_GetItem(hwnd, &tvItem);
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-04-20 16:15:03 +00:00
|
|
|
lParam = tvItem.lParam;
|
|
|
|
}
|
2003-05-24 13:50:24 +00:00
|
|
|
uMsg = WM_NOTIFY_SELCHANGE;
|
2002-08-28 14:58:48 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-25 11:22:46 +00:00
|
|
|
#endif
|
2003-05-24 13:50:24 +00:00
|
|
|
if (uMsg == WM_NOTIFY_SELCHANGE) {
|
2002-08-28 14:58:48 +00:00
|
|
|
if (last_item != lParam)
|
|
|
|
{
|
|
|
|
last_item = lParam;
|
|
|
|
|
|
|
|
mystrcpy(g_tmp, g_usrvars[0]);
|
2002-08-25 16:09:17 +00:00
|
|
|
|
2003-04-05 12:56:57 +00:00
|
|
|
myitoa(g_usrvars[0], lParam);
|
2002-11-01 20:34:55 +00:00
|
|
|
|
2004-08-06 11:05:48 +00:00
|
|
|
ExecuteCallbackFunction(CB_ONMOUSEOVERSECTION);
|
2002-09-19 21:53:24 +00:00
|
|
|
|
2002-08-28 14:58:48 +00:00
|
|
|
mystrcpy(g_usrvars[0], g_tmp);
|
2002-08-25 16:09:17 +00:00
|
|
|
}
|
|
|
|
}
|
2002-11-01 20:34:55 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
2002-08-02 10:01:35 +00:00
|
|
|
return CallWindowProc((WNDPROC)oldTreeWndProc,hwnd,uMsg,wParam,lParam);
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
static HTREEITEM *hTreeItems;
|
|
|
|
static HIMAGELIST hImageList;
|
2002-09-23 19:27:42 +00:00
|
|
|
HWND hwndCombo1 = GetUIItem(IDC_COMBO1);
|
|
|
|
HWND hwndTree1 = GetUIItem(IDC_TREE1);
|
2002-09-26 18:41:00 +00:00
|
|
|
extern HWND g_SectionHack;
|
2003-09-04 18:25:57 +00:00
|
|
|
section *sections=g_sections;
|
2004-01-04 17:05:03 +00:00
|
|
|
int *install_types=g_header->install_types;
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_INITDIALOG)
|
|
|
|
{
|
|
|
|
int doLines=0;
|
|
|
|
HTREEITEM Par;
|
|
|
|
HBITMAP hBMcheck1;
|
2003-09-04 18:25:57 +00:00
|
|
|
int x, lastGoodX, i, noCombo=2;
|
2002-09-26 18:41:00 +00:00
|
|
|
|
|
|
|
g_SectionHack=hwndDlg;
|
|
|
|
|
2002-09-07 20:49:18 +00:00
|
|
|
hTreeItems=(HTREEITEM*)my_GlobalAlloc(sizeof(HTREEITEM)*num_sections);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
hBMcheck1=LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
oldTreeWndProc=SetWindowLong(hwndTree1,GWL_WNDPROC,(long)newTreeWndProc);
|
2002-09-20 17:08:34 +00:00
|
|
|
|
|
|
|
hImageList = ImageList_Create(16,16, ILC_COLOR32|ILC_MASK, 6, 0);
|
|
|
|
ImageList_AddMasked(hImageList,hBMcheck1,RGB(255,0,255));
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
TreeView_SetImageList(hwndTree1, hImageList, TVSIL_STATE);
|
|
|
|
|
2003-10-30 00:08:21 +00:00
|
|
|
if (SendMessage(hwndTree1, TVM_GETITEMHEIGHT, 0, 0) < 16)
|
|
|
|
SendMessage(hwndTree1, TVM_SETITEMHEIGHT, 16, 0);
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
DeleteObject(hBMcheck1);
|
|
|
|
|
2003-07-18 17:39:45 +00:00
|
|
|
for (i = 0; i < NSIS_MAX_INST_TYPES+1; i++)
|
2003-05-24 13:50:24 +00:00
|
|
|
{
|
2004-01-04 17:05:03 +00:00
|
|
|
if (install_types[i])
|
2003-05-24 13:50:24 +00:00
|
|
|
{
|
|
|
|
int j;
|
2003-09-04 18:25:57 +00:00
|
|
|
if (i != NSIS_MAX_INST_TYPES) noCombo = 0;
|
2004-01-04 17:05:03 +00:00
|
|
|
GetNSISString(g_tmp,install_types[i]);
|
2003-09-04 18:25:57 +00:00
|
|
|
j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)g_tmp);
|
2003-05-24 13:50:24 +00:00
|
|
|
SendMessage(hwndCombo1,CB_SETITEMDATA,j,i);
|
2003-09-04 18:25:57 +00:00
|
|
|
if (i == g_exec_flags.cur_insttype)
|
2003-07-18 17:39:45 +00:00
|
|
|
SendMessage(hwndCombo1, CB_SETCURSEL, j, 0);
|
2003-05-24 13:50:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
SetUITextFromLang(IDC_TEXT1,this_page->parms[1+noCombo]);
|
|
|
|
SetUITextFromLang(IDC_TEXT2,this_page->parms[2+noCombo]);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
Par=NULL;
|
|
|
|
|
2002-11-05 21:42:22 +00:00
|
|
|
for (lastGoodX = x = 0; x < num_sections; x ++)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
section *sec=sections+x;
|
2002-10-19 12:02:18 +00:00
|
|
|
|
|
|
|
if (sec->name_ptr)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
TVINSERTSTRUCT tv;
|
|
|
|
tv.hParent=Par;
|
|
|
|
tv.hInsertAfter=TVI_LAST;
|
|
|
|
tv.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_STATE;
|
|
|
|
tv.item.lParam=x;
|
2003-09-04 18:25:57 +00:00
|
|
|
tv.item.pszText=GetNSISStringTT(sec->name_ptr);
|
2003-11-28 18:50:51 +00:00
|
|
|
tv.item.stateMask=TVIS_STATEIMAGEMASK|TVIS_EXPANDED|TVIS_BOLD;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
int l=1;
|
2004-09-30 18:50:04 +00:00
|
|
|
// SF_SELECTED == 1
|
2003-11-28 17:57:59 +00:00
|
|
|
l += sec->flags & SF_SELECTED;
|
|
|
|
//if (sec->flags & SF_SELECTED) l++;
|
2002-10-19 12:02:18 +00:00
|
|
|
if (sec->flags & SF_RO) l+=3;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
tv.item.state=INDEXTOSTATEIMAGEMASK(l);
|
|
|
|
}
|
|
|
|
|
2003-11-28 17:57:59 +00:00
|
|
|
//if (sec->flags&SF_BOLD)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-11-28 17:57:59 +00:00
|
|
|
// SF_BOLD << 1 == 16 == TVIS_BOLD
|
|
|
|
tv.item.state|=(sec->flags&SF_BOLD)<<1;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2002-10-19 12:02:18 +00:00
|
|
|
if (sec->flags&SF_SUBSEC)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-10-02 15:01:06 +00:00
|
|
|
tv.item.mask|=TVIF_CHILDREN;
|
|
|
|
tv.item.cChildren=1;
|
2003-11-28 17:57:59 +00:00
|
|
|
//if (sec->flags&SF_EXPAND)
|
|
|
|
// TVIS_EXPANDED == SF_EXPAND
|
|
|
|
tv.item.state|=sec->flags&SF_EXPAND;
|
2002-10-02 15:01:06 +00:00
|
|
|
Par = hTreeItems[x] = TreeView_InsertItem(hwndTree1,&tv);
|
|
|
|
doLines=1;
|
|
|
|
}
|
2002-10-19 12:02:18 +00:00
|
|
|
else if (sec->flags&SF_SUBSECEND)
|
2002-10-02 15:01:06 +00:00
|
|
|
{
|
2003-04-05 12:56:57 +00:00
|
|
|
SetParentState(hwndTree1,hTreeItems[lastGoodX]);
|
2002-10-02 15:01:06 +00:00
|
|
|
Par=TreeView_GetParent(hwndTree1,Par);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-05 21:42:22 +00:00
|
|
|
lastGoodX = x;
|
2002-08-28 14:58:48 +00:00
|
|
|
hTreeItems[x] = TreeView_InsertItem(hwndTree1,&tv);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!doLines)
|
|
|
|
{
|
|
|
|
SetWindowLong(hwndTree1,GWL_STYLE,GetWindowLong(hwndTree1,GWL_STYLE)&~(TVS_LINESATROOT));
|
|
|
|
}
|
|
|
|
SendMessage(hwndTree1,WM_VSCROLL,SB_TOP,0);
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
if (!noCombo)
|
|
|
|
{
|
|
|
|
ShowWindow(hwndCombo1, SW_SHOW);
|
2004-03-06 12:31:26 +00:00
|
|
|
SetActiveCtl(hwndCombo1);
|
2004-01-04 17:05:03 +00:00
|
|
|
}
|
|
|
|
else
|
2004-03-06 12:31:26 +00:00
|
|
|
SetActiveCtl(hwndTree1);
|
2004-01-04 17:05:03 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
uMsg = g_exec_flags.insttype_changed ? WM_NOTIFY_INSTTYPE_CHANGE : WM_IN_UPDATEMSG;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2003-05-24 13:50:24 +00:00
|
|
|
if (uMsg == WM_NOTIFY_SECTEXT) // update text
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
int x=wParam;
|
|
|
|
int ns=lParam;
|
2003-02-26 15:27:39 +00:00
|
|
|
TVITEM tv;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2004-03-12 20:43:54 +00:00
|
|
|
tv.hItem=hTreeItems[x];
|
|
|
|
|
|
|
|
if (tv.hItem)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
tv.mask=TVIF_TEXT;
|
2003-09-04 18:25:57 +00:00
|
|
|
tv.pszText=GetNSISStringTT(ns);
|
2002-08-02 10:01:35 +00:00
|
|
|
TreeView_SetItem(hwndTree1,&tv);
|
|
|
|
}
|
|
|
|
}
|
2003-05-24 13:50:24 +00:00
|
|
|
if (uMsg == WM_NOTIFY_SECFLAGS) // change flags
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
int flags = sections[wParam].flags;
|
2003-04-05 12:56:57 +00:00
|
|
|
TVITEM tvItem;
|
2003-03-29 17:16:09 +00:00
|
|
|
|
2003-04-05 12:56:57 +00:00
|
|
|
if (!(tvItem.hItem = hTreeItems[wParam])) return 0;
|
|
|
|
tvItem.mask = TVIF_STATE;
|
|
|
|
tvItem.stateMask = TVIS_BOLD;
|
|
|
|
tvItem.state = 0;
|
2003-11-28 17:57:59 +00:00
|
|
|
//if (flags&SF_BOLD) tvItem.state |= TVIS_BOLD;
|
|
|
|
// SF_BOLD << 1 == 16 == TVIS_BOLD
|
|
|
|
tvItem.state|=(flags&SF_BOLD)<<1;
|
2003-04-05 12:56:57 +00:00
|
|
|
TreeView_SetItem(hwndTree1, &tvItem);
|
|
|
|
|
|
|
|
TreeView_Expand(hwndTree1, tvItem.hItem, flags & SF_EXPAND ? TVE_EXPAND : TVE_COLLAPSE);
|
|
|
|
|
|
|
|
if ((flags & (SF_PSELECTED | SF_SELECTED)) != SF_PSELECTED)
|
|
|
|
{
|
|
|
|
CheckTreeItem(hwndTree1, tvItem.hItem, flags & SF_SELECTED);
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
if (uMsg == WM_NOTIFY || uMsg == WM_TREEVIEW_KEYHACK)
|
|
|
|
{
|
2002-08-11 18:56:30 +00:00
|
|
|
LPNMHDR lpnmh = (LPNMHDR) lParam;
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_TREEVIEW_KEYHACK || lpnmh->idFrom == IDC_TREE1)
|
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
if (!(g_flags&CH_FLAGS_NO_CUSTOM) && (uMsg == WM_TREEVIEW_KEYHACK || lpnmh->code == NM_CLICK))
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-04-05 12:56:57 +00:00
|
|
|
TVITEM tvItem;
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg != WM_TREEVIEW_KEYHACK)
|
2003-04-05 12:56:57 +00:00
|
|
|
tvItem.hItem=TreeHitTest(hwndTree1);
|
2002-08-02 10:01:35 +00:00
|
|
|
else
|
2003-04-05 12:56:57 +00:00
|
|
|
tvItem.hItem=TreeView_GetSelection(hwndTree1);
|
2002-08-11 18:56:30 +00:00
|
|
|
|
2003-04-05 12:56:57 +00:00
|
|
|
if (tvItem.hItem)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-04-05 12:56:57 +00:00
|
|
|
int iState;
|
|
|
|
|
|
|
|
tvItem.mask = TVIF_STATE|TVIF_PARAM;
|
|
|
|
TreeView_GetItem(hwndTree1, &tvItem);
|
2002-08-11 18:56:30 +00:00
|
|
|
|
2003-04-05 12:56:57 +00:00
|
|
|
iState = tvItem.state >> 12;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2003-04-05 12:56:57 +00:00
|
|
|
if (iState < 4) // not RO
|
2002-09-21 15:17:42 +00:00
|
|
|
{
|
2003-04-05 12:56:57 +00:00
|
|
|
if (iState == 2) // already checked
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
sections[tvItem.lParam].flags&=~SF_SELECTED;
|
2003-04-05 12:56:57 +00:00
|
|
|
CheckTreeItem(hwndTree1,tvItem.hItem,0);
|
2002-09-21 15:17:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
sections[tvItem.lParam].flags|=SF_SELECTED;
|
2003-04-05 12:56:57 +00:00
|
|
|
CheckTreeItem(hwndTree1,tvItem.hItem,1);
|
2002-09-21 15:17:42 +00:00
|
|
|
}
|
2002-12-02 15:51:33 +00:00
|
|
|
lParam = 0;
|
2003-07-17 15:35:57 +00:00
|
|
|
wParam = 1;
|
2002-11-30 13:15:49 +00:00
|
|
|
uMsg = WM_IN_UPDATEMSG;
|
2002-09-21 15:17:42 +00:00
|
|
|
} // not ro
|
2002-08-02 10:01:35 +00:00
|
|
|
} // was valid click
|
|
|
|
} // was click or hack
|
2002-11-01 20:34:55 +00:00
|
|
|
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT)
|
2003-04-05 12:56:57 +00:00
|
|
|
if (lpnmh)
|
|
|
|
{
|
|
|
|
if (lpnmh->code == TVN_SELCHANGED)
|
2003-07-19 12:15:10 +00:00
|
|
|
{
|
2003-05-24 13:50:24 +00:00
|
|
|
SendMessage(hwndTree1, WM_NOTIFY_SELCHANGE, 0, ((LPNMTREEVIEW)lpnmh)->itemNew.lParam);
|
2003-07-19 12:15:10 +00:00
|
|
|
}
|
2003-04-05 12:56:57 +00:00
|
|
|
if (lpnmh->code == TVN_ITEMEXPANDED)
|
|
|
|
{
|
|
|
|
LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lpnmh;
|
|
|
|
if (pnmtv->action == TVE_EXPAND)
|
2003-09-04 18:25:57 +00:00
|
|
|
sections[pnmtv->itemNew.lParam].flags |= SF_EXPAND;
|
2003-04-05 12:56:57 +00:00
|
|
|
else
|
2003-09-04 18:25:57 +00:00
|
|
|
sections[pnmtv->itemNew.lParam].flags &= ~SF_EXPAND;
|
2003-04-05 12:56:57 +00:00
|
|
|
}
|
2002-08-28 14:58:48 +00:00
|
|
|
}
|
2002-11-01 20:34:55 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
2003-04-05 12:56:57 +00:00
|
|
|
if (uMsg == WM_MOUSEMOVE)
|
|
|
|
{
|
|
|
|
SendMessage(hwndTree1, WM_MOUSEMOVE, 0, 0);
|
|
|
|
}
|
2003-05-24 13:50:24 +00:00
|
|
|
if (uMsg == WM_NOTIFY_INSTTYPE_CHANGE ||
|
|
|
|
(uMsg == WM_COMMAND && LOWORD(wParam)==IDC_COMBO1 && HIWORD(wParam)==CBN_SELCHANGE))
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2004-01-04 17:05:03 +00:00
|
|
|
int t=SendMessage(hwndCombo1,CB_GETCURSEL,0,0);
|
2003-05-24 13:50:24 +00:00
|
|
|
if (uMsg == WM_NOTIFY_INSTTYPE_CHANGE || t != CB_ERR)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-05-24 13:50:24 +00:00
|
|
|
int whichcfg=SendMessage(hwndCombo1,CB_GETITEMDATA,t,0);
|
|
|
|
if (uMsg == WM_NOTIFY_INSTTYPE_CHANGE)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
whichcfg = g_exec_flags.cur_insttype;
|
|
|
|
g_exec_flags.insttype_changed = 0;
|
2003-05-24 13:50:24 +00:00
|
|
|
}
|
|
|
|
else lParam = 1;
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
if (whichcfg == CB_ERR || !(install_types[whichcfg]))
|
2003-05-24 13:50:24 +00:00
|
|
|
whichcfg = NSIS_MAX_INST_TYPES;
|
|
|
|
|
|
|
|
if (whichcfg != NSIS_MAX_INST_TYPES) // not custom
|
|
|
|
{
|
|
|
|
int x=num_sections;
|
2003-09-04 18:25:57 +00:00
|
|
|
section *t=sections;
|
2003-05-24 13:50:24 +00:00
|
|
|
HTREEITEM *ht=hTreeItems;
|
|
|
|
while (x--)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-05-24 13:50:24 +00:00
|
|
|
TVITEM tv;
|
|
|
|
int l=1;
|
2003-04-05 12:56:57 +00:00
|
|
|
|
2003-05-24 13:50:24 +00:00
|
|
|
if (t->install_types & (1<<whichcfg))
|
|
|
|
{
|
|
|
|
l++;
|
|
|
|
t->flags|=SF_SELECTED;
|
|
|
|
}
|
|
|
|
else t->flags&=~SF_SELECTED;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2003-05-24 13:50:24 +00:00
|
|
|
if (t->flags&SF_RO) l+=3;
|
2002-09-22 19:05:43 +00:00
|
|
|
|
2004-03-12 20:43:54 +00:00
|
|
|
tv.hItem=*ht;
|
|
|
|
|
|
|
|
if (tv.hItem) {
|
2003-05-24 13:50:24 +00:00
|
|
|
tv.mask=TVIF_STATE;
|
|
|
|
tv.state=INDEXTOSTATEIMAGEMASK(l);
|
|
|
|
tv.stateMask=TVIS_STATEIMAGEMASK;
|
2002-09-21 06:42:20 +00:00
|
|
|
|
2003-05-24 13:50:24 +00:00
|
|
|
TreeView_SetItem(hwndTree1,&tv);
|
|
|
|
SetParentState(hwndTree1,tv.hItem);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2003-05-24 13:50:24 +00:00
|
|
|
t++;
|
|
|
|
ht++;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2003-05-24 13:50:24 +00:00
|
|
|
SendMessage(hwndTree1,WM_VSCROLL,SB_TOP,0);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2003-05-24 13:50:24 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
g_exec_flags.cur_insttype=whichcfg;
|
2003-05-24 13:50:24 +00:00
|
|
|
|
|
|
|
uMsg = WM_IN_UPDATEMSG;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
2003-02-07 23:04:25 +00:00
|
|
|
if (uMsg == WM_NOTIFY_INIGO_MONTOYA)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
if (hImageList) ImageList_Destroy(hImageList);
|
|
|
|
if (hTreeItems) GlobalFree(hTreeItems);
|
2004-01-04 17:05:03 +00:00
|
|
|
hImageList=NULL;
|
|
|
|
hTreeItems=NULL;
|
|
|
|
g_SectionHack=NULL;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
if (uMsg == WM_IN_UPDATEMSG)
|
|
|
|
{
|
2003-07-17 02:00:23 +00:00
|
|
|
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_COMPONENTPAGE)
|
|
|
|
if ( wParam )
|
2004-08-06 11:05:48 +00:00
|
|
|
ExecuteCallbackFunction(CB_ONSELCHANGE);
|
2003-07-17 02:00:23 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_COMPONENTPAGE
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
if (g_flags & CH_FLAGS_COMP_ONLY_ON_CUSTOM)
|
2002-12-02 16:02:03 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
int c = (g_exec_flags.cur_insttype == NSIS_MAX_INST_TYPES) << 3;// SW_SHOWNA=8, SW_HIDE=0
|
2003-07-18 17:39:45 +00:00
|
|
|
ShowWindow(hwndTree1, c);
|
|
|
|
ShowWindow(GetUIItem(IDC_TEXT2), c);
|
2002-12-02 16:02:03 +00:00
|
|
|
}
|
2003-04-05 12:56:57 +00:00
|
|
|
else if (!lParam)
|
2002-12-02 16:02:03 +00:00
|
|
|
{
|
2003-05-24 13:50:24 +00:00
|
|
|
int r,x,cbi;
|
2002-12-02 16:02:03 +00:00
|
|
|
// check to see which install type we are
|
2003-05-24 13:50:24 +00:00
|
|
|
for (r = 0, cbi = 0; r < NSIS_MAX_INST_TYPES; r ++)
|
2002-12-02 15:51:33 +00:00
|
|
|
{
|
2002-12-02 16:02:03 +00:00
|
|
|
HTREEITEM *ht=hTreeItems;
|
2003-09-04 18:25:57 +00:00
|
|
|
section *t=sections;
|
2002-12-02 16:02:03 +00:00
|
|
|
x=num_sections;
|
2003-05-24 13:50:24 +00:00
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
if (!install_types[r]) continue;
|
2003-05-24 13:50:24 +00:00
|
|
|
|
2002-12-02 16:02:03 +00:00
|
|
|
while (x--)
|
2002-12-02 15:51:33 +00:00
|
|
|
{
|
2003-04-05 12:56:57 +00:00
|
|
|
if (*ht && !(t->flags&(SF_SUBSEC|SF_SUBSECEND)))
|
2002-12-02 15:51:33 +00:00
|
|
|
{
|
2003-04-05 12:56:57 +00:00
|
|
|
TVITEM tvItem;
|
|
|
|
tvItem.hItem=*ht;
|
|
|
|
tvItem.mask=TVIF_STATE;
|
|
|
|
TreeView_GetItem(hwndTree1,&tvItem);
|
|
|
|
if (!(t->install_types&(1<<r)) != !((tvItem.state>>12 != 1 && (tvItem.state>>12 != 4)))) break;
|
2002-12-02 15:51:33 +00:00
|
|
|
}
|
2002-12-02 16:02:03 +00:00
|
|
|
t++;
|
|
|
|
ht++;
|
2002-12-02 15:51:33 +00:00
|
|
|
}
|
2002-12-02 16:02:03 +00:00
|
|
|
if (x < 0) break;
|
2003-05-24 13:50:24 +00:00
|
|
|
|
|
|
|
cbi++;
|
2002-12-02 16:02:03 +00:00
|
|
|
}
|
2002-12-02 15:51:33 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
g_exec_flags.cur_insttype=r;
|
2003-05-24 13:50:24 +00:00
|
|
|
SendMessage(hwndCombo1,CB_SETCURSEL,cbi,0);
|
2002-12-02 16:02:03 +00:00
|
|
|
} // end of typecheckshit
|
2002-12-02 15:51:33 +00:00
|
|
|
|
2002-10-01 14:13:23 +00:00
|
|
|
if (LANG_STR_TAB(LANG_SPACE_REQ)) {
|
2004-01-04 17:05:03 +00:00
|
|
|
SetUITextNT(IDC_SPACEREQUIRED,inttosizestr(sumsecsfield(size_kb),GetNSISString(g_tmp,LANG_SPACE_REQ)));
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
2003-07-13 22:31:33 +00:00
|
|
|
|
2002-08-21 19:15:00 +00:00
|
|
|
return HandleStaticBkColor();
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif//NSIS_CONFIG_COMPONENTPAGE
|
|
|
|
|
|
|
|
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
int ui_st_updateflag=0x6;
|
2002-08-08 15:04:45 +00:00
|
|
|
|
2003-11-09 23:10:04 +00:00
|
|
|
void NSISCALL update_status_text(int strtab, const char *text) {
|
2003-09-04 18:25:57 +00:00
|
|
|
static char tmp[NSIS_MAX_STRLEN*2];
|
|
|
|
LVITEM new_item;
|
|
|
|
HWND linsthwnd = insthwnd;
|
|
|
|
if (linsthwnd)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-11-09 23:10:04 +00:00
|
|
|
int updateflag = ui_st_updateflag;
|
|
|
|
int tmplen;
|
2003-09-04 18:25:57 +00:00
|
|
|
|
2003-11-09 23:10:04 +00:00
|
|
|
if (!(updateflag & 1))
|
2003-09-04 18:25:57 +00:00
|
|
|
GetNSISString(tmp, strtab);
|
|
|
|
|
2003-11-09 23:10:04 +00:00
|
|
|
tmplen = mystrlen(tmp);
|
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
if (tmplen + mystrlen(text) >= sizeof(tmp)) return;
|
|
|
|
lstrcat(tmp, text);
|
|
|
|
}
|
|
|
|
|
2003-11-09 23:10:04 +00:00
|
|
|
if ((updateflag & 4)) my_SetWindowText(insthwnd2, tmp);
|
|
|
|
if ((updateflag & 2))
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
new_item.mask = LVIF_TEXT;
|
|
|
|
new_item.pszText = tmp;
|
2003-11-14 21:08:51 +00:00
|
|
|
new_item.iItem = ListView_GetItemCount(linsthwnd) - (updateflag & 1);
|
2003-09-04 18:25:57 +00:00
|
|
|
new_item.iSubItem = 0;
|
2003-11-14 21:08:51 +00:00
|
|
|
SendMessage(linsthwnd, (updateflag & 1) ? LVM_SETITEM : LVM_INSERTITEM, 0, (LPARAM) &new_item);
|
2003-09-04 18:25:57 +00:00
|
|
|
ListView_EnsureVisible(linsthwnd, new_item.iItem, 0);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2003-11-06 00:58:37 +00:00
|
|
|
|
2003-11-09 23:10:04 +00:00
|
|
|
if (updateflag & 1)
|
2003-11-14 21:08:51 +00:00
|
|
|
tmp[tmplen] = 0;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD WINAPI install_thread(LPVOID p)
|
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
int m_inst_sec=0;
|
|
|
|
HWND progresswnd = (HWND)p;
|
|
|
|
|
|
|
|
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
extern HRESULT g_hres;
|
|
|
|
g_hres|=OleInitialize(NULL);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif
|
2003-09-04 18:25:57 +00:00
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
while (m_inst_sec<num_sections)
|
2003-09-04 18:25:57 +00:00
|
|
|
{
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
2003-09-04 18:25:57 +00:00
|
|
|
if (g_sections[m_inst_sec].flags&SF_SELECTED)
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
2003-09-04 18:25:57 +00:00
|
|
|
{
|
|
|
|
log_printf2("Section: \"%s\"",GetNSISStringTT(g_sections[m_inst_sec].name_ptr));
|
2004-01-04 17:05:03 +00:00
|
|
|
if (ExecuteCodeSegment(g_sections[m_inst_sec].code,progresswnd))
|
|
|
|
{
|
|
|
|
g_exec_flags.abort++;
|
|
|
|
break;
|
|
|
|
}
|
2003-09-04 18:25:57 +00:00
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
2003-09-04 18:25:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
log_printf2("Skipping section: \"%s\"",GetNSISStringTT(g_sections[m_inst_sec].name_ptr));
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif
|
2003-09-04 18:25:57 +00:00
|
|
|
m_inst_sec++;
|
|
|
|
}
|
2004-01-04 17:05:03 +00:00
|
|
|
NotifyCurWnd(WM_NOTIFY_INSTPROC_DONE);
|
2003-09-04 18:25:57 +00:00
|
|
|
|
|
|
|
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
|
|
|
|
OleUninitialize();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return g_exec_flags.abort;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
2003-12-08 22:30:27 +00:00
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
HWND linsthwnd=insthwnd;
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_INITDIALOG)
|
|
|
|
{
|
2002-09-14 09:43:15 +00:00
|
|
|
RECT r;
|
2003-12-08 22:30:27 +00:00
|
|
|
LVCOLUMN lvc = {LVCF_WIDTH, 0, -1, 0, 0, -1};
|
2003-09-04 18:25:57 +00:00
|
|
|
int lb_bg=g_header->lb_bg,lb_fg=g_header->lb_fg;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-09-23 19:27:42 +00:00
|
|
|
insthwndbutton=GetUIItem(IDC_SHOWDETAILS);
|
|
|
|
insthwnd2=GetUIItem(IDC_INTROTEXT);
|
2003-09-04 18:25:57 +00:00
|
|
|
linsthwnd=insthwnd=GetUIItem(IDC_LIST1);
|
|
|
|
|
2004-01-04 17:05:03 +00:00
|
|
|
progress_bar_len=sumsecsfield(code_size);
|
2003-09-04 18:25:57 +00:00
|
|
|
progress_bar_pos=0;
|
|
|
|
|
|
|
|
log_printf3("New install of \"%s\" to \"%s\"",GetNSISStringTT(LANG_NAME),state_install_directory);
|
|
|
|
|
2003-12-08 22:30:27 +00:00
|
|
|
GetClientRect(linsthwnd, &r);
|
|
|
|
lvc.cx = r.right - GetSystemMetrics(SM_CXHSCROLL);
|
2003-09-04 18:25:57 +00:00
|
|
|
ListView_InsertColumn(linsthwnd, 0, &lvc);
|
2003-12-08 22:30:27 +00:00
|
|
|
|
2003-09-04 18:25:57 +00:00
|
|
|
ListView_SetExtendedListViewStyleEx(linsthwnd, LVS_EX_LABELTIP, LVS_EX_LABELTIP);
|
2002-08-26 16:09:30 +00:00
|
|
|
if (lb_bg >= 0) {
|
2003-09-04 18:25:57 +00:00
|
|
|
ListView_SetBkColor(linsthwnd, lb_bg);
|
|
|
|
ListView_SetTextBkColor(linsthwnd, lb_bg);
|
2002-08-26 16:09:30 +00:00
|
|
|
}
|
|
|
|
if (lb_fg >= 0) {
|
2003-09-04 18:25:57 +00:00
|
|
|
ListView_SetTextColor(linsthwnd, lb_fg);
|
2002-08-26 16:09:30 +00:00
|
|
|
}
|
2003-09-04 18:25:57 +00:00
|
|
|
SetUITextFromLang(IDC_SHOWDETAILS,this_page->parms[1]);
|
|
|
|
if (g_flags&(CH_FLAGS_DETAILS_SHOWDETAILS|CH_FLAGS_DETAILS_NEVERSHOW))
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
ShowWindow(insthwndbutton,SW_HIDE);
|
2003-09-04 18:25:57 +00:00
|
|
|
if (!(g_flags&CH_FLAGS_DETAILS_NEVERSHOW)) ShowWindow(linsthwnd,SW_SHOWNA);
|
2002-08-02 10:01:35 +00:00
|
|
|
else insthwndbutton=NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
HWND progresswnd=GetUIItem(IDC_PROGRESS);
|
|
|
|
SendMessage(progresswnd,PBM_SETRANGE,0,MAKELPARAM(0,30000));
|
|
|
|
if (g_flags&CH_FLAGS_PROGRESS_COLORED)
|
|
|
|
{
|
|
|
|
SendMessage(progresswnd,PBM_SETBARCOLOR,0,lb_fg);
|
|
|
|
SendMessage(progresswnd,PBM_SETBKCOLOR,0,lb_bg);
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2003-03-29 17:16:09 +00:00
|
|
|
return FALSE;
|
2002-09-18 14:46:55 +00:00
|
|
|
}
|
|
|
|
if (uMsg == WM_NOTIFY_START) {
|
|
|
|
DWORD id;
|
2003-09-04 18:25:57 +00:00
|
|
|
CloseHandle(CreateThread(NULL,0,install_thread,GetUIItem(IDC_PROGRESS),0,&id));
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
if (uMsg == WM_COMMAND && LOWORD(wParam) == IDC_SHOWDETAILS)
|
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
ShowWindow(insthwndbutton,SW_HIDE);
|
|
|
|
ShowWindow(linsthwnd,SW_SHOWNA);
|
2004-01-04 17:05:03 +00:00
|
|
|
SetNextDef();
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
if (uMsg == WM_NOTIFY_INSTPROC_DONE)
|
|
|
|
{
|
2002-09-19 21:53:24 +00:00
|
|
|
if (g_quit_flag)
|
2002-11-09 12:50:00 +00:00
|
|
|
{
|
2004-09-25 10:49:08 +00:00
|
|
|
m_retcode=2;
|
2002-11-21 16:46:05 +00:00
|
|
|
outernotify(NOTIFY_BYE_BYE);
|
2002-11-09 12:50:00 +00:00
|
|
|
}
|
2003-04-04 12:27:58 +00:00
|
|
|
else
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-11-01 20:34:55 +00:00
|
|
|
ShowWindow(g_hwnd,SW_SHOWNA);
|
2003-09-04 18:25:57 +00:00
|
|
|
if (!g_exec_flags.abort)
|
|
|
|
update_status_text(g_this_page->parms[2],0);
|
2002-11-01 20:34:55 +00:00
|
|
|
outernotify(1);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
2002-08-30 19:51:05 +00:00
|
|
|
//>>>Ximon Eighteen aka Sunjammer 30th August 2002
|
2002-08-31 10:25:24 +00:00
|
|
|
//+++Popup "Copy Details To Clipboard" menu when RMB clicked in DetailView
|
2004-01-04 17:05:03 +00:00
|
|
|
if (uMsg == WM_CONTEXTMENU && wParam == (WPARAM) linsthwnd)
|
2002-08-30 19:51:05 +00:00
|
|
|
{
|
2003-09-04 18:25:57 +00:00
|
|
|
int count = ListView_GetItemCount(linsthwnd);
|
2002-08-30 19:51:05 +00:00
|
|
|
if (count > 0)
|
|
|
|
{
|
2002-08-31 10:25:24 +00:00
|
|
|
HMENU menu = CreatePopupMenu();
|
2004-01-04 17:05:03 +00:00
|
|
|
POINT pt;
|
2003-09-04 18:25:57 +00:00
|
|
|
AppendMenu(menu,MF_STRING,1,GetNSISStringTT(LANG_COPYDETAILS));
|
2004-01-04 17:05:03 +00:00
|
|
|
if (lParam == ((UINT)-1))
|
|
|
|
{
|
|
|
|
RECT r;
|
|
|
|
GetWindowRect(linsthwnd, &r);
|
|
|
|
pt.x = r.left;
|
|
|
|
pt.y = r.top;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pt.x = GET_X_LPARAM(lParam);
|
|
|
|
pt.y = GET_Y_LPARAM(lParam);
|
|
|
|
}
|
2003-05-24 13:50:24 +00:00
|
|
|
if (1==TrackPopupMenu(
|
2002-08-31 10:25:24 +00:00
|
|
|
menu,
|
|
|
|
TPM_NONOTIFY|TPM_RETURNCMD,
|
2004-01-04 17:05:03 +00:00
|
|
|
pt.x,
|
|
|
|
pt.y,
|
2003-09-04 18:25:57 +00:00
|
|
|
0,linsthwnd,0))
|
2002-08-30 19:51:05 +00:00
|
|
|
{
|
2002-10-05 16:20:13 +00:00
|
|
|
int i,total = 1; // 1 for the null char
|
2002-08-31 10:25:24 +00:00
|
|
|
LVITEM item;
|
|
|
|
HGLOBAL memory;
|
2002-10-05 16:20:13 +00:00
|
|
|
LPTSTR ptr;//,endPtr;
|
2002-08-31 10:25:24 +00:00
|
|
|
|
|
|
|
// 1st pass - determine clipboard memory required.
|
|
|
|
item.iSubItem = 0;
|
2004-01-04 17:05:03 +00:00
|
|
|
item.pszText = g_tmp;
|
|
|
|
item.cchTextMax = sizeof(g_tmp) - 1;
|
2002-09-30 20:52:00 +00:00
|
|
|
i = count;
|
|
|
|
while (i--)
|
2002-08-31 10:25:24 +00:00
|
|
|
// Add 2 for the CR/LF combination that must follow every line.
|
2003-09-04 18:25:57 +00:00
|
|
|
total += 2+SendMessage(linsthwnd,LVM_GETITEMTEXT,i,(LPARAM)&item);
|
2002-08-30 21:41:54 +00:00
|
|
|
|
2002-08-31 10:25:24 +00:00
|
|
|
// 2nd pass - store detail view strings on the clipboard
|
|
|
|
// Clipboard MSDN docs say mem must be GMEM_MOVEABLE
|
|
|
|
OpenClipboard(0);
|
|
|
|
EmptyClipboard();
|
2002-10-05 16:20:13 +00:00
|
|
|
memory = GlobalAlloc(GHND,total);
|
2002-08-31 10:25:24 +00:00
|
|
|
ptr = GlobalLock(memory);
|
2002-10-05 16:20:13 +00:00
|
|
|
//endPtr = ptr+total-2; // -2 to allow for CR/LF
|
2002-09-30 20:52:00 +00:00
|
|
|
i = 0;
|
|
|
|
do {
|
2003-12-08 22:30:27 +00:00
|
|
|
item.pszText = ptr;
|
|
|
|
item.cchTextMax = total;
|
|
|
|
SendMessage(linsthwnd,LVM_GETITEMTEXT,i,(LPARAM)&item);
|
|
|
|
ptr += mystrlen(ptr);
|
2002-09-22 19:05:43 +00:00
|
|
|
*(WORD*)ptr = CHAR2_TO_WORD('\r','\n');
|
|
|
|
ptr+=2;
|
2002-09-30 20:52:00 +00:00
|
|
|
} while (++i < count);
|
2002-10-05 16:20:13 +00:00
|
|
|
// memory is auto zeroed when allocated with GHND - *ptr = 0;
|
2002-08-31 10:25:24 +00:00
|
|
|
GlobalUnlock(memory);
|
|
|
|
SetClipboardData(CF_TEXT,memory);
|
|
|
|
CloseClipboard();
|
2002-08-30 19:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
2003-03-29 17:16:09 +00:00
|
|
|
return FALSE;
|
2002-08-30 19:51:05 +00:00
|
|
|
}
|
|
|
|
//<<<
|
2002-08-21 19:15:00 +00:00
|
|
|
return HandleStaticBkColor();
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|