2002-08-02 10:01:35 +00:00
|
|
|
/*
|
2003-02-09 15:56:29 +00:00
|
|
|
* Copyright (C) 1999-2003 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <windowsx.h>
|
|
|
|
#include <shlobj.h>
|
|
|
|
#include <stdlib.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
|
|
|
|
|
|
|
#define LB_ICONWIDTH 20
|
|
|
|
#define LB_ICONHEIGHT 20
|
|
|
|
|
2002-09-25 03:06:36 +00:00
|
|
|
HICON g_hIcon;
|
2002-09-06 18:49:02 +00:00
|
|
|
|
2002-08-03 23:06:10 +00:00
|
|
|
// Added by Amir Szekely 3rd August 2002
|
2002-09-29 20:25:15 +00:00
|
|
|
char *language_tables;
|
2002-10-01 14:13:23 +00:00
|
|
|
int *cur_language_table;
|
2002-08-03 23:06:10 +00:00
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
int g_quit_flag; // set when Quit has been called (meaning bail out ASAP)
|
|
|
|
|
|
|
|
#if NSIS_MAX_INST_TYPES >= 31 || NSIS_MAX_INST_TYPES < 1
|
|
|
|
#error invalid value for NSIS_MAX_INST_TYPES
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int progress_bar_pos, progress_bar_len;
|
2002-11-01 20:34:55 +00:00
|
|
|
int g_is_uninstaller;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
HWND g_progresswnd;
|
|
|
|
|
|
|
|
static char g_tmp[4096];
|
|
|
|
|
2003-03-07 21:10:48 +00:00
|
|
|
int num_sections;
|
2002-08-29 12:25:19 +00:00
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
// sent to the last child window to tell it that the install thread is done
|
|
|
|
#define WM_NOTIFY_INSTPROC_DONE (WM_USER+0x4)
|
|
|
|
|
2002-09-18 14:46:55 +00:00
|
|
|
// sent to every child window to tell it it can start executing NSIS code
|
|
|
|
#define WM_NOTIFY_START (WM_USER+0x5)
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
// sent to the outer window to tell it to go to the next inner window
|
|
|
|
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
|
|
|
|
|
2003-02-07 23:04:25 +00:00
|
|
|
// sent to every child window to tell it it is closing soon
|
|
|
|
#define WM_NOTIFY_INIGO_MONTOYA (WM_USER+0xb)
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
// update message used by DirProc and SelProc for space display
|
|
|
|
#define WM_IN_UPDATEMSG (WM_USER+0xf)
|
|
|
|
|
2002-12-06 15:43:35 +00:00
|
|
|
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#define WM_TREEVIEW_KEYHACK (WM_USER+0x13)
|
|
|
|
|
2003-04-02 19:54:53 +00:00
|
|
|
static int m_page=-1,m_retcode,m_delta=1;
|
2002-11-09 12:50:00 +00:00
|
|
|
|
2002-11-21 16:46:05 +00:00
|
|
|
#define NOTIFY_BYE_BYE 'x'
|
|
|
|
|
|
|
|
static void NSISCALL outernotify(char num) {
|
|
|
|
if (num==NOTIFY_BYE_BYE)
|
2003-04-01 18:07:32 +00:00
|
|
|
g_quit_flag++;
|
2002-11-09 12:50:00 +00:00
|
|
|
m_delta=num;
|
|
|
|
SendMessage(g_hwnd,WM_NOTIFY_OUTER_NEXT,(WPARAM)num,0); // it sends num again for plugins - DON'T REMOVE!
|
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);
|
2002-08-02 10:01:35 +00:00
|
|
|
static int CALLBACK WINAPI BrowseCallbackProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
|
|
|
|
#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);
|
|
|
|
|
|
|
|
HWND insthwnd, insthwnd2,insthwndbutton;
|
|
|
|
|
|
|
|
void *g_inst_combinedheader;
|
2002-11-01 20:34:55 +00:00
|
|
|
page *g_inst_page;
|
2002-08-02 10:01:35 +00:00
|
|
|
section *g_inst_section;
|
|
|
|
entry *g_inst_entry;
|
|
|
|
|
2002-09-23 20:56:29 +00:00
|
|
|
static HWND m_curwnd, m_bgwnd, m_hwndOK, m_hwndCancel;
|
2002-08-02 10:01:35 +00:00
|
|
|
static int m_whichcfg;
|
|
|
|
|
2002-10-01 14:13:23 +00:00
|
|
|
static BOOL NSISCALL SetDlgItemTextFromLang_(HWND dlg, int id, int lid) {
|
|
|
|
return my_SetDialogItemText(dlg,id+1000,LANG_STR(lid));
|
2002-08-07 15:14:40 +00:00
|
|
|
}
|
|
|
|
|
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)
|
2002-12-02 23:08:10 +00:00
|
|
|
#define GetUIText(it,s,ss) my_GetDialogItemText(hwndDlg,it,s,ss)
|
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)
|
|
|
|
static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
2003-03-20 20:49:13 +00:00
|
|
|
switch (uMsg) {
|
|
|
|
case WM_CTLCOLORSTATIC:
|
|
|
|
case WM_CTLCOLOREDIT:
|
|
|
|
case WM_CTLCOLORDLG:
|
|
|
|
case WM_CTLCOLORBTN:
|
|
|
|
{
|
|
|
|
BOOL brush = (BOOL)GetWindowLong((HWND)lParam, GWL_USERDATA);
|
|
|
|
if (brush == -1) {
|
|
|
|
COLORREF dlgColor = GetSysColor(COLOR_BTNFACE);
|
|
|
|
SetBkColor((HDC)wParam, dlgColor);
|
|
|
|
SetTextColor((HDC)wParam, dlgColor);
|
|
|
|
return (BOOL)GetStockObject(NULL_BRUSH);
|
|
|
|
}
|
|
|
|
SetBkMode((HDC)wParam, TRANSPARENT);
|
|
|
|
return brush;
|
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
|
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
|
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
2002-11-05 21:42:22 +00:00
|
|
|
static int NSISCALL SetChildrenStates(HWND hWnd, TV_ITEM *pItem, int iState) {
|
2002-08-02 10:01:35 +00:00
|
|
|
HTREEITEM hItem;
|
2002-11-05 21:42:22 +00:00
|
|
|
TV_ITEM thisItem;
|
|
|
|
int ro_down_below = 0, items = 0;
|
2002-10-02 15:01:06 +00:00
|
|
|
int *flags;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
pItem->mask|=TVIF_PARAM;
|
|
|
|
|
2002-08-09 14:21:45 +00:00
|
|
|
TreeView_GetItem(hWnd, pItem);
|
2002-08-11 18:56:30 +00:00
|
|
|
if (pItem->state >> 12 == 0)
|
2002-11-05 21:42:22 +00:00
|
|
|
return 0;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-11-05 21:42:22 +00:00
|
|
|
pItem->mask&=~TVIF_PARAM;
|
2002-08-29 11:34:34 +00:00
|
|
|
|
2002-11-05 21:42:22 +00:00
|
|
|
thisItem = *pItem;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-11-05 21:42:22 +00:00
|
|
|
pItem->state = INDEXTOSTATEIMAGEMASK(iState);
|
|
|
|
thisItem.stateMask = pItem->stateMask = TVIS_STATEIMAGEMASK;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-11-05 21:42:22 +00:00
|
|
|
hItem = TreeView_GetChild(hWnd, pItem->hItem);
|
|
|
|
while (hItem)
|
|
|
|
{
|
|
|
|
pItem->hItem = hItem;
|
|
|
|
ro_down_below += SetChildrenStates(hWnd, pItem, iState);
|
|
|
|
items++;
|
|
|
|
hItem = TreeView_GetNextSibling(hWnd, hItem);
|
|
|
|
}
|
|
|
|
flags=&g_inst_section[thisItem.lParam].flags;
|
2002-10-02 15:01:06 +00:00
|
|
|
if (!(*flags & SF_RO))
|
2002-08-09 14:21:45 +00:00
|
|
|
{
|
2002-11-05 21:42:22 +00:00
|
|
|
if (ro_down_below)
|
|
|
|
{
|
|
|
|
if (ro_down_below==items) iState = 2;
|
|
|
|
else iState |= 2;
|
|
|
|
}
|
|
|
|
thisItem.state = INDEXTOSTATEIMAGEMASK(iState);
|
2002-10-02 15:01:06 +00:00
|
|
|
if (iState == 2) *flags |= SF_SELECTED;
|
|
|
|
else *flags &= ~SF_SELECTED;
|
2002-11-05 21:42:22 +00:00
|
|
|
TreeView_SetItem(hWnd, &thisItem);
|
|
|
|
return 0;
|
2002-08-09 14:21:45 +00:00
|
|
|
}
|
2002-11-05 21:42:22 +00:00
|
|
|
return 1;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2002-08-19 23:18:19 +00:00
|
|
|
static void NSISCALL SetParentState(HWND hWnd, TV_ITEM *pItem) {
|
2002-08-02 10:01:35 +00:00
|
|
|
HTREEITEM hItem;
|
|
|
|
int iState = 0, iStatePrev = 0;
|
|
|
|
|
2002-08-09 14:21:45 +00:00
|
|
|
HTREEITEM hParent = TreeView_GetParent(hWnd, pItem->hItem);
|
|
|
|
if (!hParent)
|
|
|
|
return;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-08-09 14:21:45 +00:00
|
|
|
hItem = TreeView_GetChild(hWnd, hParent);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-08-09 14:21:45 +00:00
|
|
|
while (hItem) {
|
|
|
|
pItem->hItem = hItem;
|
|
|
|
TreeView_GetItem(hWnd, pItem);
|
2002-08-11 18:56:30 +00:00
|
|
|
iState = pItem->state >> 12;
|
2002-11-05 21:42:22 +00:00
|
|
|
if (iState)
|
2002-08-09 14:21:45 +00:00
|
|
|
{
|
|
|
|
if (iState==5) iState=2;
|
2002-11-30 13:15:49 +00:00
|
|
|
if (iState==4) iState=1;
|
2002-08-09 14:21:45 +00:00
|
|
|
if (iStatePrev && (iStatePrev != iState)) {
|
|
|
|
iState = 3;
|
|
|
|
break;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2002-08-09 14:21:45 +00:00
|
|
|
iStatePrev = iState;
|
|
|
|
}
|
|
|
|
hItem = TreeView_GetNextSibling(hWnd, hItem);
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-08-09 14:21:45 +00:00
|
|
|
pItem->hItem = hParent;
|
|
|
|
if (iState) {
|
|
|
|
pItem->state = INDEXTOSTATEIMAGEMASK(iState);
|
|
|
|
TreeView_SetItem(hWnd, pItem);
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-08-09 14:21:45 +00:00
|
|
|
SetParentState(hWnd, pItem);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2002-08-19 23:18:19 +00:00
|
|
|
static void NSISCALL CheckTreeItem(HWND hWnd, TV_ITEM *pItem, int checked) {
|
2002-08-09 14:21:45 +00:00
|
|
|
HTREEITEM hItem = pItem->hItem;
|
|
|
|
int l=0;
|
2002-10-04 20:41:43 +00:00
|
|
|
int flags;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-08-09 14:21:45 +00:00
|
|
|
pItem->mask = TVIF_STATE|TVIF_PARAM;
|
|
|
|
TreeView_GetItem(hWnd, pItem);
|
2002-08-11 18:56:30 +00:00
|
|
|
if (pItem->state >> 12 == 0)
|
2002-08-09 14:21:45 +00:00
|
|
|
return;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-10-04 20:41:43 +00:00
|
|
|
flags = g_inst_section[pItem->lParam].flags;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-10-04 20:41:43 +00:00
|
|
|
if (flags & SF_RO) l=3;
|
|
|
|
|
|
|
|
pItem->state = INDEXTOSTATEIMAGEMASK(checked?2:1+l) | (flags & SF_BOLD ? TVIS_BOLD : 0);
|
|
|
|
pItem->stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-08-09 14:21:45 +00:00
|
|
|
TreeView_SetItem(hWnd, pItem);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-08-09 14:21:45 +00:00
|
|
|
SetChildrenStates(hWnd, pItem, checked?2:1);
|
|
|
|
pItem->hItem = hItem;
|
|
|
|
SetParentState(hWnd, pItem);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif//NSIS_CONFIG_COMPONENTPAGE
|
|
|
|
|
2002-08-28 21:13:54 +00:00
|
|
|
static void NSISCALL set_language()
|
2002-08-24 14:44:23 +00:00
|
|
|
{
|
|
|
|
int i;
|
2002-08-25 16:09:17 +00:00
|
|
|
LANGID lang_mask=~(LANGID)0;
|
2002-08-28 21:13:54 +00:00
|
|
|
LANGID lang=myatoi(state_language);
|
2002-09-29 20:25:15 +00:00
|
|
|
char *language_table=0;
|
2003-03-29 17:16:09 +00:00
|
|
|
int lang_num=g_inst_cmnheader->language_tables_num;
|
2002-08-28 16:57:46 +00:00
|
|
|
|
2002-08-24 14:44:23 +00:00
|
|
|
lang_again:
|
|
|
|
for (i = 0; i < lang_num; i++) {
|
2002-09-29 20:25:15 +00:00
|
|
|
language_table=language_tables+i*g_inst_cmnheader->language_table_size;
|
|
|
|
if (!((lang ^ *(LANGID*)language_table) & lang_mask)) {
|
2002-10-01 14:13:23 +00:00
|
|
|
cur_language_table=(int*)(language_table+sizeof(LANGID));
|
2002-08-24 14:44:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-09-29 20:25:15 +00:00
|
|
|
if (i == lang_num) {
|
|
|
|
if (lang_mask == ~(LANGID)0)
|
|
|
|
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);
|
2002-11-01 20:34:55 +00:00
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
2002-12-02 23:08:10 +00:00
|
|
|
my_SetWindowText(m_bgwnd,process_string_fromtab(g_caption,LANG_CAPTION));
|
2002-11-01 20:34:55 +00:00
|
|
|
#endif
|
2002-08-24 14:44:23 +00:00
|
|
|
}
|
|
|
|
|
2002-08-19 23:18:19 +00:00
|
|
|
int NSISCALL ui_doinstall(void)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-04-01 18:07:32 +00:00
|
|
|
common_header *inst_cmnheader=g_inst_cmnheader;
|
2003-03-29 17:16:09 +00:00
|
|
|
static WNDCLASS wc; // richedit subclassing and bgbg creation
|
2003-03-18 20:36:52 +00:00
|
|
|
g_flags.autoclose=inst_flags&CH_FLAGS_AUTO_CLOSE;
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
|
|
|
if (!g_is_uninstaller)
|
|
|
|
#endif
|
2002-11-01 20:34:55 +00:00
|
|
|
{
|
2002-08-02 10:01:35 +00:00
|
|
|
if (!is_valid_instpath(state_install_directory))
|
|
|
|
{
|
2002-09-29 20:25:15 +00:00
|
|
|
if (g_inst_header->install_reg_key_ptr)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
myRegGetStr((HKEY)g_inst_header->install_reg_rootkey,
|
|
|
|
GetStringFromStringTab(g_inst_header->install_reg_key_ptr),
|
|
|
|
GetStringFromStringTab(g_inst_header->install_reg_value_ptr),ps_tmpbuf);
|
|
|
|
if (ps_tmpbuf[0])
|
|
|
|
{
|
|
|
|
char *p=ps_tmpbuf;
|
|
|
|
char *e;
|
|
|
|
if (p[0]=='\"')
|
|
|
|
{
|
2002-08-04 20:25:10 +00:00
|
|
|
char *p2=CharNext(p);
|
2002-08-02 10:01:35 +00:00
|
|
|
p=p2;
|
2002-08-04 20:25:10 +00:00
|
|
|
while (*p2 && *p2 != '\"') p2=CharNext(p2);
|
2002-08-02 10:01:35 +00:00
|
|
|
*p2=0;
|
|
|
|
}
|
|
|
|
// p is the path now, check for .exe extension
|
|
|
|
|
2002-08-19 21:24:44 +00:00
|
|
|
e=p+mystrlen(p)-4;
|
2002-08-02 10:01:35 +00:00
|
|
|
if (e > p)
|
|
|
|
{
|
|
|
|
// if filename ends in .exe, and is not a directory, remove the filename
|
|
|
|
if (!lstrcmpi(e,".exe")) // check extension
|
|
|
|
{
|
|
|
|
DWORD d;
|
|
|
|
d=GetFileAttributes(p);
|
|
|
|
if (d == (DWORD)-1 || !(d&FILE_ATTRIBUTE_DIRECTORY))
|
|
|
|
{
|
|
|
|
e=scanendslash(p);
|
|
|
|
if (e>=p) *e=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-19 21:24:44 +00:00
|
|
|
mystrcpy(state_install_directory,p);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!is_valid_instpath(state_install_directory))
|
|
|
|
{
|
|
|
|
process_string_fromtab(state_install_directory,g_inst_header->install_directory_ptr);
|
|
|
|
}
|
|
|
|
|
2002-08-04 20:25:10 +00:00
|
|
|
#ifdef NSIS_CONFIG_LOG
|
2003-03-18 20:36:52 +00:00
|
|
|
if (inst_flags&CH_FLAGS_SILENT_LOG)
|
2002-08-04 20:25:10 +00:00
|
|
|
{
|
|
|
|
build_g_logfile();
|
|
|
|
log_dolog=1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2002-08-24 14:44:23 +00:00
|
|
|
// Added by Amir Szekely 3rd August 2002
|
|
|
|
// Multilingual support
|
|
|
|
{
|
2002-09-20 23:22:11 +00:00
|
|
|
extern char *g_db_strtab;
|
2003-04-01 18:07:32 +00:00
|
|
|
language_tables=(void*)(g_db_strtab+inst_cmnheader->num_string_bytes);
|
2002-08-24 14:44:23 +00:00
|
|
|
|
2002-08-28 21:13:54 +00:00
|
|
|
myitoa(state_language, GetUserDefaultLangID());
|
|
|
|
set_language();
|
2002-08-24 14:44:23 +00:00
|
|
|
}
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
2003-03-18 20:36:52 +00:00
|
|
|
if (!(inst_flags&(CH_FLAGS_SILENT|CH_FLAGS_SILENT_LOG)))
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_CONFIG_SILENT_SUPPORT
|
|
|
|
{
|
2002-11-30 13:15:49 +00:00
|
|
|
g_hIcon=LoadImage(g_hInstance,MAKEINTRESOURCE(IDI_ICON2),IMAGE_ICON,0,0,LR_DEFAULTSIZE|LR_SHARED);
|
2003-03-09 19:49:19 +00:00
|
|
|
m_bgwnd=0;
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_SUPPORT_BGBG
|
2003-04-01 18:07:32 +00:00
|
|
|
if (inst_cmnheader->bg_color1 != -1)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-11-21 16:46:05 +00:00
|
|
|
RECT vp;
|
|
|
|
extern int bg_color1, bg_color2, bg_textcolor;
|
|
|
|
extern LRESULT CALLBACK BG_WndProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
wc.lpfnWndProc = BG_WndProc;
|
|
|
|
wc.hInstance = g_hInstance;
|
|
|
|
wc.hIcon = g_hIcon;
|
2002-11-30 13:15:49 +00:00
|
|
|
//wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
2002-11-21 16:46:05 +00:00
|
|
|
wc.lpszClassName = "_Nb";
|
|
|
|
|
|
|
|
if (!RegisterClass(&wc)) return 0;
|
|
|
|
|
2003-04-01 18:07:32 +00:00
|
|
|
bg_color1=inst_cmnheader->bg_color1;
|
|
|
|
bg_color2=inst_cmnheader->bg_color2;
|
|
|
|
bg_textcolor=inst_cmnheader->bg_textcolor;
|
2002-11-21 16:46:05 +00:00
|
|
|
|
|
|
|
SystemParametersInfo(SPI_GETWORKAREA, 0, &vp, 0);
|
|
|
|
|
2003-03-09 19:49:19 +00:00
|
|
|
m_bgwnd = CreateWindowEx(WS_EX_TOOLWINDOW,"_Nb",0,WS_POPUP,
|
|
|
|
vp.left,vp.top,vp.right-vp.left,vp.bottom-vp.top,0,NULL,g_hInstance,NULL);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif//NSIS_SUPPORT_BGBG
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2002-08-28 14:58:48 +00:00
|
|
|
g_hwnd=m_bgwnd;
|
2002-08-24 14:44:23 +00:00
|
|
|
// Select language
|
2003-04-01 18:07:32 +00:00
|
|
|
if (ExecuteCodeSegment(inst_cmnheader->code_onInit,NULL)) return 1;
|
2002-08-28 21:13:54 +00:00
|
|
|
set_language();
|
2002-08-24 14:44:23 +00:00
|
|
|
g_hwnd=NULL;
|
2002-08-28 14:58:48 +00:00
|
|
|
ShowWindow(m_bgwnd, SW_SHOW);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
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-03-09 19:49:19 +00:00
|
|
|
return DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST),0,DialogProc);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2003-04-01 18:07:32 +00:00
|
|
|
if (ExecuteCodeSegment(inst_cmnheader->code_onInit,NULL)) return 1;
|
2002-08-28 21:13:54 +00:00
|
|
|
set_language();
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
if (install_thread(NULL))
|
|
|
|
{
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2003-04-01 18:07:32 +00:00
|
|
|
if (!g_quit_flag) ExecuteCodeSegment(inst_cmnheader->code_onInstFailed,NULL);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2003-04-01 18:07:32 +00:00
|
|
|
ExecuteCodeSegment(inst_cmnheader->code_onInstSuccess,NULL);
|
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
|
|
|
|
static int CALLBACK WINAPI BrowseCallbackProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
|
|
|
{
|
|
|
|
if (uMsg==BFFM_INITIALIZED)
|
|
|
|
{
|
2002-12-02 23:08:10 +00:00
|
|
|
my_GetDialogItemText((HWND)lpData,IDC_DIR,g_tmp,sizeof(g_tmp));
|
2002-08-02 10:01:35 +00:00
|
|
|
SendMessage(hwnd,BFFM_SETSELECTION,(WPARAM)1,(LPARAM)g_tmp);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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;
|
2002-08-02 10:01:35 +00:00
|
|
|
static struct
|
|
|
|
{
|
|
|
|
char *id;
|
|
|
|
DLGPROC proc;
|
|
|
|
}
|
|
|
|
windows[]=
|
|
|
|
{
|
|
|
|
#ifdef NSIS_CONFIG_LICENSEPAGE
|
|
|
|
{MAKEINTRESOURCE(IDD_LICENSE),LicenseProc},
|
|
|
|
#endif
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
|
|
|
{MAKEINTRESOURCE(IDD_SELCOM),SelProc},
|
|
|
|
#endif
|
|
|
|
{MAKEINTRESOURCE(IDD_DIR),DirProc},
|
|
|
|
{MAKEINTRESOURCE(IDD_INSTFILES),InstProc},
|
2002-11-01 20:34:55 +00:00
|
|
|
{NULL,NULL}, // imaginary completed page
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
2002-11-01 20:34:55 +00:00
|
|
|
{MAKEINTRESOURCE(IDD_UNINST),UninstProc}
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
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);
|
2002-09-25 03:06:36 +00:00
|
|
|
SetClassLong(hwndDlg,GCL_HICON,(long)g_hIcon);
|
2002-10-01 14:13:23 +00:00
|
|
|
SetDlgItemTextFromLang(hwndDlg,IDCANCEL,LANG_BTN_CANCEL);
|
2002-11-01 20:34:55 +00:00
|
|
|
SetDlgItemTextFromLang(hwndDlg,IDC_BACK,LANG_BTN_BACK);
|
|
|
|
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT)
|
2002-12-30 15:33:53 +00:00
|
|
|
if (!(g_quit_flag = ExecuteCodeSegment(g_inst_cmnheader->code_onGUIInit,NULL)))
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
2002-12-12 16:54:20 +00:00
|
|
|
ShowWindow(hwndDlg,SW_SHOW);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2002-11-09 12:50:00 +00:00
|
|
|
this_page=g_inst_page+m_page;
|
|
|
|
|
2003-01-24 19:40:20 +00:00
|
|
|
if (m_page>=0) {
|
2003-03-18 15:45:25 +00:00
|
|
|
// Call leave function. If Abort used don't move to the next page.
|
|
|
|
if (m_delta==1) if (ExecuteCodeSegment(this_page->leavefunc,NULL)) return 1;
|
|
|
|
|
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.
|
|
|
|
if (this_page->id<0) return 0;
|
|
|
|
}
|
2002-11-09 12:50:00 +00:00
|
|
|
|
2002-11-01 20:34:55 +00:00
|
|
|
nextPage:
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-11-09 12:50:00 +00:00
|
|
|
m_page+=m_delta;
|
|
|
|
this_page+=m_delta;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2002-11-01 20:34:55 +00:00
|
|
|
if (m_page==g_inst_cmnheader->num_pages) ExecuteCodeSegment(g_inst_cmnheader->code_onInstSuccess,NULL);
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
|
2002-11-01 20:34:55 +00:00
|
|
|
if (g_quit_flag || m_page < 0 || m_page == g_inst_cmnheader->num_pages)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
DestroyWindow(m_curwnd);
|
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
|
|
|
{
|
|
|
|
HWND hwndtmp;
|
2002-11-01 20:34:55 +00:00
|
|
|
|
2002-11-09 12:50:00 +00:00
|
|
|
SetDlgItemTextFromLang(hwndDlg,IDOK,this_page->next);
|
2002-11-01 20:34:55 +00:00
|
|
|
|
|
|
|
hwndtmp=GetDlgItem(hwndDlg,IDC_BACK);
|
2003-04-04 12:27:58 +00:00
|
|
|
if (g_flags.abort)
|
|
|
|
{
|
|
|
|
this_page->button_states|=16|4;
|
|
|
|
SendMessage(g_hwnd,DM_SETDEFID,IDCANCEL,0);
|
|
|
|
}
|
|
|
|
else SendMessage(g_hwnd,DM_SETDEFID,IDOK,0);
|
2003-01-04 14:45:49 +00:00
|
|
|
SetWindowLong(hwndtmp,GWL_STYLE,GetWindowLong(hwndtmp,GWL_STYLE)&~BS_DEFPUSHBUTTON);
|
2003-03-06 21:24:19 +00:00
|
|
|
ShowWindow(hwndtmp,this_page->button_states&SW_SHOWNA);// SW_HIDE = 0, SW_SHOWNA = 8
|
|
|
|
EnableWindow(hwndtmp,this_page->button_states&2);
|
2003-03-26 17:47:46 +00:00
|
|
|
EnableWindow(m_hwndOK,!(this_page->button_states&16));
|
2003-03-06 21:24:19 +00:00
|
|
|
EnableWindow(m_hwndCancel,this_page->button_states&4);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-11-30 13:15:49 +00:00
|
|
|
mystrcpy(g_tmp,g_caption);
|
|
|
|
process_string_fromtab(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
|
|
|
|
2003-02-07 23:04:25 +00:00
|
|
|
SendMessage(m_curwnd, WM_NOTIFY_INIGO_MONTOYA, 0, 0);
|
|
|
|
|
2002-12-06 15:43:35 +00:00
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
if (ExecuteCodeSegment(this_page->prefunc,NULL) || this_page->id<0)
|
|
|
|
goto nextPage;
|
|
|
|
#endif //NSIS_SUPPORT_CODECALLBACKS
|
|
|
|
|
2002-11-09 12:50:00 +00:00
|
|
|
if (this_page->id!=NSIS_PAGE_COMPLETED) DestroyWindow(m_curwnd);
|
2002-11-25 16:50:05 +00:00
|
|
|
else {
|
2003-04-04 12:27:58 +00:00
|
|
|
if (g_flags.abort) SetFocus(m_hwndCancel);
|
|
|
|
else if (g_flags.autoclose) goto nextPage;
|
2002-11-25 16:50:05 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-11-09 12:50:00 +00:00
|
|
|
if (this_page->id>=0) // NSIS page
|
|
|
|
{
|
|
|
|
m_curwnd=CreateDialog(g_hInstance,windows[this_page->id].id,hwndDlg,windows[this_page->id].proc);
|
|
|
|
if (m_curwnd)
|
|
|
|
{
|
|
|
|
RECT r;
|
|
|
|
GetWindowRect(GetDlgItem(hwndDlg,IDC_CHILDRECT),&r);
|
|
|
|
ScreenToClient(hwndDlg,(LPPOINT)&r);
|
|
|
|
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
|
2002-11-09 12:50:00 +00:00
|
|
|
ShowWindow(m_curwnd,SW_SHOWNA);
|
2002-11-30 13:15:49 +00:00
|
|
|
SendMessage(m_curwnd, WM_NOTIFY_START, 0, 0);
|
2002-11-01 20:34:55 +00:00
|
|
|
}
|
2002-11-09 12:50:00 +00:00
|
|
|
|
|
|
|
//XGE 5th September 2002 - Do *not* move the focus to the OK button if we are
|
|
|
|
//on the license page, instead we want the focus left alone because in
|
|
|
|
//WM_INITDIALOG it is given to the richedit control.
|
2003-03-29 17:16:09 +00:00
|
|
|
if (this_page->id != NSIS_PAGE_LICENSE)
|
2002-11-21 16:46:05 +00:00
|
|
|
SetFocus(m_hwndOK);
|
2002-11-09 12:50:00 +00:00
|
|
|
//XGE End
|
2002-08-02 10:01:35 +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
|
|
|
|
|
2002-12-06 15:43:35 +00:00
|
|
|
if (uMsg == WM_NOTIFY_CUSTOM_READY) {
|
|
|
|
DestroyWindow(m_curwnd);
|
|
|
|
}
|
2002-11-30 13:15:49 +00:00
|
|
|
if (uMsg == WM_CLOSE)
|
|
|
|
{
|
|
|
|
if (!IsWindowEnabled(m_hwndCancel) && IsWindowEnabled(m_hwndOK))
|
|
|
|
{
|
|
|
|
uMsg = WM_COMMAND;
|
|
|
|
wParam = IDOK;
|
|
|
|
}
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_COMMAND)
|
|
|
|
{
|
|
|
|
int id=LOWORD(wParam);
|
|
|
|
|
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
|
|
|
}
|
2002-11-21 22:59:11 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
if (id == IDCANCEL)
|
|
|
|
{
|
2003-04-02 19:54:53 +00:00
|
|
|
if (g_flags.abort)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2002-09-19 22:25:15 +00:00
|
|
|
ExecuteCodeSegment(g_inst_cmnheader->code_onInstFailed,NULL);
|
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
|
2002-09-19 22:25:15 +00:00
|
|
|
if (!ExecuteCodeSegment(g_inst_cmnheader->code_onUserAbort,NULL))
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-08-21 19:15:00 +00:00
|
|
|
return HandleStaticBkColor();
|
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
|
|
|
|
#include <RichEdit.h>
|
|
|
|
#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-03-29 13:39:48 +00:00
|
|
|
HWND hwLicense;
|
2003-03-26 20:51:16 +00:00
|
|
|
static unsigned int uLastAcceptState;
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_INITDIALOG)
|
|
|
|
{
|
2002-10-01 14:13:23 +00:00
|
|
|
EDITSTREAM es={(DWORD)LANG_STR(LANG_LICENSE_DATA),0,StreamLicense};
|
2003-03-26 17:47:46 +00:00
|
|
|
|
|
|
|
SetUITextFromLang(IDC_LICENSEAGREE,LANG_BTN_LICENSE_AGREE);
|
|
|
|
SetUITextFromLang(IDC_LICENSEDISAGREE,LANG_BTN_LICENSE_DISAGREE);
|
2003-03-26 20:51:16 +00:00
|
|
|
SendMessage(GetUIItem(IDC_LICENSEAGREE+!uLastAcceptState), BM_SETCHECK, BST_CHECKED, 0);
|
|
|
|
EnableWindow(m_hwndOK, uLastAcceptState | !(inst_flags&CH_FLAGS_LICENSE_FORCE_SELECTION));
|
2003-03-26 17:47:46 +00:00
|
|
|
|
2002-09-23 19:27:42 +00:00
|
|
|
hwLicense=GetUIItem(IDC_EDIT1);
|
2002-08-02 10:01:35 +00:00
|
|
|
SendMessage(hwLicense,EM_AUTOURLDETECT,TRUE,0);
|
2002-08-22 21:06:26 +00:00
|
|
|
SendMessage(hwLicense,EM_SETBKGNDCOLOR,0,g_inst_header->license_bg>=0?g_inst_header->license_bg:GetSysColor(COLOR_BTNFACE));
|
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-03-04 20:29:56 +00:00
|
|
|
SendMessage(hwLicense,EM_EXLIMITTEXT,0,mystrlen((char*)es.dwCookie));
|
2002-08-21 19:15:00 +00:00
|
|
|
SendMessage(hwLicense,EM_STREAMIN,(((char*)es.dwCookie)[0]=='{')?SF_RTF:SF_TEXT,(LPARAM)&es);
|
2002-10-01 14:13:23 +00:00
|
|
|
SetUITextFromLang(IDC_INTROTEXT,LANG_LICENSE_TEXT);
|
2002-09-06 17:29:34 +00:00
|
|
|
//XGE 5th September 2002 - place the initial focus in the richedit control
|
|
|
|
SetFocus(hwLicense);
|
|
|
|
return FALSE;
|
|
|
|
//End Xge
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2003-03-26 17:47:46 +00:00
|
|
|
if (uMsg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED) {
|
|
|
|
if (inst_flags&CH_FLAGS_LICENSE_FORCE_SELECTION)
|
2003-03-29 13:39:48 +00:00
|
|
|
EnableWindow(
|
|
|
|
m_hwndOK,
|
|
|
|
uLastAcceptState = SendMessage(GetUIItem(IDC_LICENSEAGREE), BM_GETCHECK, 0, 0) & BST_CHECKED
|
|
|
|
);
|
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 = {
|
|
|
|
enlink->chrg.cpMin,
|
|
|
|
enlink->chrg.cpMax,
|
|
|
|
ps_tmpbuf
|
|
|
|
};
|
|
|
|
if (tr.chrg.cpMax-tr.chrg.cpMin < sizeof(ps_tmpbuf)) {
|
|
|
|
SendMessage(hwLicense,EM_GETTEXTRANGE,0,(LPARAM)&tr);
|
|
|
|
SetCursor(LoadCursor(0,IDC_WAIT));
|
|
|
|
ShellExecute(hwndDlg,"open",ps_tmpbuf,NULL,NULL,SW_SHOWNORMAL);
|
|
|
|
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-03 17:47:38 +00:00
|
|
|
#ifndef IDC_HAND
|
|
|
|
#define IDC_HAND MAKEINTRESOURCE(32649)
|
|
|
|
#endif
|
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-03-29 13:39:48 +00:00
|
|
|
if (msgfilter->wParam==VK_RETURN && IsWindowEnabled(m_hwndOK)) {
|
|
|
|
outernotify(1);
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
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)
|
|
|
|
{
|
2002-10-01 14:13:23 +00:00
|
|
|
SetUITextFromLang(IDC_INTROTEXT,LANG_UNINST_TEXT);
|
|
|
|
SetUITextFromLang(IDC_UNINSTFROM,LANG_UNINST_SUBTEXT);
|
2002-09-23 19:27:42 +00:00
|
|
|
SetUITextNT(IDC_EDIT1,state_install_directory);
|
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
|
|
|
{
|
2002-09-18 22:30:59 +00:00
|
|
|
char sh=20;
|
|
|
|
char c='G';
|
2002-10-06 18:33:35 +00:00
|
|
|
char s=0;;
|
2002-09-18 22:30:59 +00:00
|
|
|
if (kb < 1024) { sh=0; c='K'; }
|
|
|
|
else if (kb < 1024*1024) { sh=10; c='M'; }
|
2002-10-06 18:33:35 +00:00
|
|
|
else if (GetVersion()&0x80000000) s='+';//only display the + on GB shown on win9x.
|
|
|
|
wsprintf(str+mystrlen(str),"%d.%d%cB%c",kb>>sh,((kb*10)>>sh)%10,c,s);
|
2002-10-05 16:20:13 +00:00
|
|
|
return str;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2003-02-07 23:04:25 +00:00
|
|
|
if (uMsg == WM_NOTIFY_INIGO_MONTOYA)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-09-23 19:27:42 +00:00
|
|
|
GetUIText(IDC_DIR,state_install_directory,NSIS_MAX_STRLEN);
|
2003-02-07 23:04:25 +00:00
|
|
|
validate_filename(state_install_directory);
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_LOG
|
|
|
|
build_g_logfile();
|
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);
|
2002-12-02 23:08:10 +00:00
|
|
|
my_SetWindowText(h,"Log install process");
|
2002-08-02 10:01:35 +00:00
|
|
|
ShowWindow(h,SW_SHOWNA);
|
|
|
|
}
|
|
|
|
#endif
|
2002-09-23 19:27:42 +00:00
|
|
|
SetUITextNT(IDC_DIR,state_install_directory);
|
2002-10-01 14:13:23 +00:00
|
|
|
SetUITextFromLang(IDC_INTROTEXT,LANG_DIR_TEXT);
|
|
|
|
SetUITextFromLang(IDC_BROWSE,LANG_BTN_BROWSE);
|
|
|
|
SetUITextFromLang(IDC_SELDIRTEXT,LANG_DIR_SUBTEXT);
|
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)
|
|
|
|
{
|
|
|
|
char name[256];
|
|
|
|
char str[256];
|
|
|
|
BROWSEINFO bi={0,};
|
|
|
|
ITEMIDLIST *idlist;
|
2002-09-23 19:27:42 +00:00
|
|
|
GetUIText(IDC_DIR,name,256);
|
|
|
|
GetUIText(IDC_SELDIRTEXT,str,256);
|
2002-08-02 10:01:35 +00:00
|
|
|
bi.hwndOwner = hwndDlg;
|
|
|
|
bi.pszDisplayName = name;
|
|
|
|
bi.lpfn=BrowseCallbackProc;
|
|
|
|
bi.lParam=(LPARAM)hwndDlg;
|
2002-08-26 13:33:34 +00:00
|
|
|
bi.lpszTitle=str;
|
2002-08-03 17:47:38 +00:00
|
|
|
#ifndef BIF_NEWDIALOGSTYLE
|
|
|
|
#define BIF_NEWDIALOGSTYLE 0x0040
|
|
|
|
#endif
|
2002-08-02 10:01:35 +00:00
|
|
|
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
|
|
|
|
idlist = SHBrowseForFolder( &bi );
|
|
|
|
if (idlist)
|
|
|
|
{
|
|
|
|
const char *post_str;
|
|
|
|
const char *p;
|
|
|
|
IMalloc *m;
|
|
|
|
SHGetPathFromIDList( idlist, name );
|
|
|
|
SHGetMalloc(&m);
|
|
|
|
if (m)
|
|
|
|
{
|
|
|
|
m->lpVtbl->Free(m,idlist);
|
|
|
|
m->lpVtbl->Release(m);
|
|
|
|
}
|
|
|
|
post_str=GetStringFromStringTab(g_inst_header->install_directory_ptr);
|
|
|
|
|
|
|
|
p=scanendslash(post_str);
|
|
|
|
if (p >= post_str && *++p)
|
|
|
|
{
|
2003-02-07 23:04:25 +00:00
|
|
|
post_str=process_string(p);
|
2002-08-19 21:24:44 +00:00
|
|
|
p=name+mystrlen(name)-mystrlen(post_str);
|
2002-08-02 10:01:35 +00:00
|
|
|
if (p <= name || *CharPrev(name,p)!='\\' || lstrcmpi(p,post_str))
|
|
|
|
{
|
2002-09-25 02:13:38 +00:00
|
|
|
lstrcat(addtrailingslash(name),post_str);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-23 19:27:42 +00:00
|
|
|
SetUITextNT(IDC_DIR,name);
|
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];
|
|
|
|
int is_valid_path;
|
|
|
|
int x;
|
|
|
|
int total=0, available=-1;
|
|
|
|
DWORD spc,bps,fc,tc;
|
|
|
|
|
2002-09-23 19:27:42 +00:00
|
|
|
GetUIText(IDC_DIR,state_install_directory,NSIS_MAX_STRLEN);
|
2002-08-02 10:01:35 +00:00
|
|
|
is_valid_path=is_valid_instpath(state_install_directory);
|
|
|
|
|
2003-02-08 14:24:27 +00:00
|
|
|
mystrcpy(s,state_install_directory);
|
2002-08-02 10:01:35 +00:00
|
|
|
if (s[1] == ':') s[3]=0;
|
2002-09-22 19:05:43 +00:00
|
|
|
else if (*(WORD*)s == CHAR2_TO_WORD('\\','\\')) // \\ path
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2003-02-08 14:24:27 +00:00
|
|
|
char *p = mystrstr(s+2,"\\");
|
|
|
|
if (p) {
|
|
|
|
p = mystrstr(p+1,"\\");
|
|
|
|
if (p) *p = 0;
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
addtrailingslash(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GetDiskFreeSpace(s,&spc,&bps,&fc,&tc))
|
|
|
|
{
|
2002-09-21 06:42:20 +00:00
|
|
|
DWORD r=MulDiv(bps*spc,fc,1<<10);
|
|
|
|
if (r > 0x7fffffff) r=0x7fffffff;
|
2002-08-02 10:01:35 +00:00
|
|
|
available=(int)r;
|
|
|
|
}
|
2002-08-29 12:25:19 +00:00
|
|
|
for (x = 0; x < num_sections; x ++)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
2002-10-02 15:01:06 +00:00
|
|
|
if (g_inst_section[x].flags&SF_SELECTED)
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
|
|
|
total+=g_inst_section[x].size_kb;
|
|
|
|
}
|
|
|
|
|
2002-10-01 14:13:23 +00:00
|
|
|
if (LANG_STR_TAB(LANG_SPACE_REQ)) {
|
2002-10-05 16:20:13 +00:00
|
|
|
SetUITextNT(IDC_SPACEREQUIRED,inttosizestr(total,mystrcpy(s,LANG_STR(LANG_SPACE_REQ))));
|
2002-08-02 10:01:35 +00:00
|
|
|
if (available != -1)
|
2002-10-05 16:20:13 +00:00
|
|
|
SetUITextNT(IDC_SPACEAVAILABLE,inttosizestr(available,mystrcpy(s,LANG_STR(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
|
|
|
}
|
|
|
|
|
2002-09-23 20:56:29 +00:00
|
|
|
EnableWindow(m_hwndOK,
|
2002-08-02 10:01:35 +00:00
|
|
|
is_valid_path && (available >= total || available == -1)
|
|
|
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
2002-09-19 22:25:15 +00:00
|
|
|
&& !ExecuteCodeSegment(g_inst_header->code_onVerifyInstDir,NULL)
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
2002-08-21 19:15:00 +00:00
|
|
|
return HandleStaticBkColor();
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
|
|
|
|
2002-08-26 13:33:34 +00:00
|
|
|
TVHITTESTINFO NSISCALL hit_test(HWND tree)
|
|
|
|
{
|
2002-09-21 06:13:15 +00:00
|
|
|
static 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);
|
|
|
|
MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1);
|
|
|
|
|
|
|
|
TreeView_HitTest(tree, &ht);
|
|
|
|
|
|
|
|
return ht;
|
|
|
|
}
|
|
|
|
|
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;
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_KEYDOWN && wParam == VK_SPACE)
|
|
|
|
{
|
2002-09-23 20:56:29 +00:00
|
|
|
SendMessage(m_curwnd,WM_TREEVIEW_KEYHACK,0,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;
|
|
|
|
}
|
2002-08-25 16:09:17 +00:00
|
|
|
if (uMsg == WM_MOUSEMOVE) {
|
2002-08-26 13:33:34 +00:00
|
|
|
TVHITTESTINFO ht = hit_test(hwnd);
|
2002-08-25 16:09:17 +00:00
|
|
|
if (ht.flags & (TVHT_ONITEMSTATEICON|TVHT_ONITEMLABEL|TVHT_ONITEMRIGHT|TVHT_ONITEM))
|
|
|
|
{
|
|
|
|
TVITEM hItem;
|
|
|
|
|
|
|
|
hItem.hItem = ht.hItem;
|
|
|
|
hItem.mask = TVIF_PARAM;
|
2002-09-19 21:53:24 +00:00
|
|
|
|
2002-08-25 16:09:17 +00:00
|
|
|
TreeView_GetItem(hwnd, &hItem);
|
|
|
|
|
2002-08-28 14:58:48 +00:00
|
|
|
lParam = hItem.lParam;
|
|
|
|
uMsg = WM_USER+0x19;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uMsg == WM_USER+0x19) {
|
|
|
|
if (last_item != lParam)
|
|
|
|
{
|
|
|
|
last_item = lParam;
|
|
|
|
|
|
|
|
mystrcpy(g_tmp, g_usrvars[0]);
|
2002-08-25 16:09:17 +00:00
|
|
|
|
2002-08-28 14:58:48 +00:00
|
|
|
myitoa(g_usrvars[0], last_item);
|
2002-11-01 20:34:55 +00:00
|
|
|
|
2002-09-19 22:25:15 +00:00
|
|
|
ExecuteCodeSegment(g_inst_header->code_onMouseOverSection,NULL);
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
int m_num_insttypes;
|
|
|
|
|
|
|
|
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;
|
2002-08-02 10:01:35 +00:00
|
|
|
if (uMsg == WM_INITDIALOG)
|
|
|
|
{
|
|
|
|
int doLines=0;
|
|
|
|
HTREEITEM Par;
|
|
|
|
HBITMAP hBMcheck1;
|
2002-11-05 21:42:22 +00:00
|
|
|
int x, lastGoodX;
|
2002-09-26 18:41:00 +00:00
|
|
|
|
|
|
|
g_SectionHack=hwndDlg;
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
if (hTreeItems) GlobalFree(hTreeItems);
|
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));
|
2002-10-01 14:13:23 +00:00
|
|
|
SetUITextFromLang(IDC_INTROTEXT,LANG_COMP_TEXT);
|
|
|
|
SetUITextFromLang(IDC_TEXT1,LANG_COMP_SUBTEXT(0));
|
|
|
|
SetUITextFromLang(IDC_TEXT2,LANG_COMP_SUBTEXT(1));
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-09-25 02:55:24 +00:00
|
|
|
oldTreeWndProc=SetWindowLong(hwndTree1,GWL_WNDPROC,(DWORD)newTreeWndProc);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
if (hImageList) ImageList_Destroy(hImageList);
|
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);
|
|
|
|
|
|
|
|
DeleteObject(hBMcheck1);
|
|
|
|
|
2002-09-29 20:25:15 +00:00
|
|
|
if (!g_inst_header->install_types_ptr[0])
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
ShowWindow(hwndCombo1,SW_HIDE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-08-11 18:56:30 +00:00
|
|
|
for (m_num_insttypes = 0; m_num_insttypes < NSIS_MAX_INST_TYPES &&
|
2002-09-29 20:25:15 +00:00
|
|
|
g_inst_header->install_types_ptr[m_num_insttypes]; m_num_insttypes ++)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)GetStringFromStringTab(g_inst_header->install_types_ptr[m_num_insttypes]));
|
|
|
|
}
|
2003-03-18 20:36:52 +00:00
|
|
|
if (!(inst_flags&CH_FLAGS_NO_CUSTOM))
|
|
|
|
SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)LANG_STR(LANG_COMP_CUSTOM));
|
2002-08-02 10:01:35 +00:00
|
|
|
SendMessage(hwndCombo1,CB_SETCURSEL,m_whichcfg,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2002-10-19 12:02:18 +00:00
|
|
|
section *sec=g_inst_section+x;
|
|
|
|
|
|
|
|
if (m_num_insttypes && m_whichcfg != m_num_insttypes && !(sec->flags&SF_RO))
|
|
|
|
{
|
|
|
|
if ((sec->install_types>>m_whichcfg) & 1)
|
|
|
|
sec->flags|=SF_SELECTED;
|
|
|
|
else
|
|
|
|
sec->flags&=~SF_SELECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
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-02-07 23:04:25 +00:00
|
|
|
process_string_fromtab(0,sec->name_ptr);
|
|
|
|
tv.item.pszText=ps_tmpbuf;
|
2002-09-26 19:42:10 +00:00
|
|
|
tv.item.stateMask=TVIS_STATEIMAGEMASK|TVIS_EXPANDED;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
int l=1;
|
2002-10-19 12:02:18 +00:00
|
|
|
if (sec->flags & SF_SELECTED) l++;
|
|
|
|
if (sec->flags & SF_RO) l+=3;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
tv.item.state=INDEXTOSTATEIMAGEMASK(l);
|
|
|
|
}
|
|
|
|
|
2002-10-19 12:02:18 +00:00
|
|
|
if (sec->flags&SF_BOLD)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
tv.item.stateMask|=TVIS_BOLD;
|
|
|
|
tv.item.state|=TVIS_BOLD;
|
|
|
|
}
|
|
|
|
|
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;
|
2002-10-19 12:02:18 +00:00
|
|
|
if (sec->flags&SF_EXPAND)
|
2002-10-02 15:01:06 +00:00
|
|
|
tv.item.state|=TVIS_EXPANDED;
|
|
|
|
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
|
|
|
{
|
|
|
|
TV_ITEM it;
|
2002-11-05 21:42:22 +00:00
|
|
|
it.hItem = hTreeItems[lastGoodX];
|
2002-10-02 15:01:06 +00:00
|
|
|
it.mask = TVIF_STATE;
|
2002-11-05 21:42:22 +00:00
|
|
|
it.stateMask = TVIS_STATEIMAGEMASK;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-10-02 15:01:06 +00:00
|
|
|
SetParentState(hwndTree1,&it);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
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);
|
|
|
|
|
2002-08-29 11:34:34 +00:00
|
|
|
uMsg=WM_IN_UPDATEMSG;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2003-03-07 21:10:48 +00:00
|
|
|
if (uMsg == WM_USER+0x17) // 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
|
|
|
|
2003-02-26 15:27:39 +00:00
|
|
|
if (tv.hItem=hTreeItems[x])
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
tv.mask=TVIF_TEXT;
|
2003-02-07 23:04:25 +00:00
|
|
|
process_string_fromtab(0,ns);
|
|
|
|
tv.pszText=ps_tmpbuf;
|
2002-08-02 10:01:35 +00:00
|
|
|
TreeView_SetItem(hwndTree1,&tv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uMsg == WM_USER+0x18) // select
|
|
|
|
{
|
|
|
|
TVITEM hItem;
|
|
|
|
hItem.mask = TVIF_STATE;
|
|
|
|
hItem.hItem=hTreeItems[wParam];
|
|
|
|
if (hItem.hItem) CheckTreeItem(hwndTree1, &hItem,lParam);
|
2003-03-29 17:16:09 +00:00
|
|
|
|
|
|
|
return FALSE;
|
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)
|
|
|
|
{
|
2002-08-11 18:56:30 +00:00
|
|
|
if (uMsg == WM_TREEVIEW_KEYHACK || lpnmh->code == NM_CLICK)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
TVHITTESTINFO ht = {0};
|
|
|
|
if (uMsg != WM_TREEVIEW_KEYHACK)
|
|
|
|
{
|
2002-08-26 13:33:34 +00:00
|
|
|
ht=hit_test(hwndTree1);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ht.hItem=TreeView_GetSelection(hwndTree1);
|
|
|
|
if (ht.hItem) ht.flags=TVHT_ONITEMSTATEICON;
|
|
|
|
}
|
2002-08-11 18:56:30 +00:00
|
|
|
|
|
|
|
if ((TVHT_ONITEMSTATEICON|TVHT_ONITEMLABEL|TVHT_ONITEMRIGHT|TVHT_ONITEM) & ht.flags)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-09-21 15:17:42 +00:00
|
|
|
TVITEM hItem;
|
|
|
|
hItem.hItem = ht.hItem;
|
2002-08-11 18:56:30 +00:00
|
|
|
|
2002-09-21 15:17:42 +00:00
|
|
|
hItem.mask = TVIF_STATE|TVIF_PARAM;
|
|
|
|
TreeView_GetItem(hwndTree1, &hItem);
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-10-02 15:01:06 +00:00
|
|
|
if (!(g_inst_section[hItem.lParam].flags&SF_RO))
|
2002-09-21 15:17:42 +00:00
|
|
|
{
|
|
|
|
if ((hItem.state >> 12) == 2) // already checked
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-10-02 15:01:06 +00:00
|
|
|
g_inst_section[hItem.lParam].flags&=~SF_SELECTED;
|
2002-09-21 15:17:42 +00:00
|
|
|
CheckTreeItem(hwndTree1,&hItem,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-02 15:01:06 +00:00
|
|
|
g_inst_section[hItem.lParam].flags|=SF_SELECTED;
|
2002-09-21 15:17:42 +00:00
|
|
|
CheckTreeItem(hwndTree1,&hItem,1);
|
|
|
|
}
|
2002-12-02 15:51:33 +00:00
|
|
|
lParam = 0;
|
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)
|
2002-12-02 15:51:33 +00:00
|
|
|
if (lpnmh && lpnmh->code == TVN_SELCHANGED) {
|
2002-08-28 14:58:48 +00:00
|
|
|
SendMessage(hwndTree1, WM_USER+0x19, 0, ((LPNMTREEVIEW)lpnmh)->itemNew.lParam);
|
|
|
|
}
|
2002-11-01 20:34:55 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_ENHANCEDUI_SUPPORT
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uMsg == WM_COMMAND)
|
|
|
|
{
|
|
|
|
int id=LOWORD(wParam),code=HIWORD(wParam);
|
|
|
|
if (id == IDC_COMBO1 && code==CBN_SELCHANGE)
|
|
|
|
{
|
|
|
|
int t=SendMessage(hwndCombo1,CB_GETCURSEL,0,0);
|
|
|
|
if (t != CB_ERR)
|
|
|
|
{
|
|
|
|
m_whichcfg=t;
|
|
|
|
if (m_whichcfg != m_num_insttypes)
|
|
|
|
{
|
2002-09-21 06:42:20 +00:00
|
|
|
int x=num_sections;
|
|
|
|
section *t=g_inst_section;
|
|
|
|
HTREEITEM *ht=hTreeItems;
|
|
|
|
while (x--)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-10-19 12:02:18 +00:00
|
|
|
if (!(t->flags & SF_RO))
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-09-21 06:42:20 +00:00
|
|
|
TVITEM tv;
|
|
|
|
int l=1;
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2002-10-02 15:01:06 +00:00
|
|
|
if (t->install_types & (1<<m_whichcfg))
|
2002-09-21 06:42:20 +00:00
|
|
|
{
|
|
|
|
l++;
|
2002-10-02 15:01:06 +00:00
|
|
|
t->flags|=SF_SELECTED;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2002-10-02 15:01:06 +00:00
|
|
|
else t->flags&=~SF_SELECTED;
|
2002-09-22 19:05:43 +00:00
|
|
|
|
2002-10-19 12:02:18 +00:00
|
|
|
if (t->name_ptr) {
|
|
|
|
tv.hItem=*ht;
|
|
|
|
tv.mask=TVIF_STATE;
|
|
|
|
tv.state=INDEXTOSTATEIMAGEMASK(l);
|
|
|
|
tv.stateMask = TVIS_STATEIMAGEMASK;
|
2002-09-21 06:42:20 +00:00
|
|
|
|
2002-10-19 12:02:18 +00:00
|
|
|
TreeView_SetItem(hwndTree1,&tv);
|
|
|
|
SetParentState(hwndTree1,&tv);
|
|
|
|
}
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
2002-09-21 06:42:20 +00:00
|
|
|
t++;
|
|
|
|
ht++;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
SendMessage(hwndTree1,WM_VSCROLL,SB_TOP,0);
|
|
|
|
}
|
2002-12-02 16:02:03 +00:00
|
|
|
lParam = 1;
|
2002-11-30 13:15:49 +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);
|
|
|
|
hTreeItems=0;
|
2002-09-26 18:41:00 +00:00
|
|
|
g_SectionHack=0;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
if (uMsg == WM_IN_UPDATEMSG)
|
|
|
|
{
|
2002-12-02 15:51:33 +00:00
|
|
|
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_COMPONENTPAGE)
|
2002-12-02 16:02:03 +00:00
|
|
|
{
|
|
|
|
ExecuteCodeSegment(g_inst_header->code_onSelChange,NULL);
|
|
|
|
}
|
2002-12-02 15:51:33 +00:00
|
|
|
#endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_COMPONENTPAGE
|
2002-12-02 16:02:03 +00:00
|
|
|
if (!lParam)
|
|
|
|
{
|
|
|
|
int r,x;
|
|
|
|
// check to see which install type we are
|
|
|
|
for (r = 0; r < m_num_insttypes; r ++)
|
2002-12-02 15:51:33 +00:00
|
|
|
{
|
2002-12-02 16:02:03 +00:00
|
|
|
HTREEITEM *ht=hTreeItems;
|
|
|
|
section *t=g_inst_section;
|
|
|
|
x=num_sections;
|
|
|
|
while (x--)
|
2002-12-02 15:51:33 +00:00
|
|
|
{
|
2002-12-02 16:02:03 +00:00
|
|
|
if (t->name_ptr && !(t->flags&(SF_SUBSEC|SF_SUBSECEND)))
|
2002-12-02 15:51:33 +00:00
|
|
|
{
|
2002-12-02 16:02:03 +00:00
|
|
|
TV_ITEM hItem;
|
|
|
|
hItem.hItem=*ht;
|
2003-03-18 20:36:52 +00:00
|
|
|
if (inst_flags&CH_FLAGS_NO_CUSTOM)
|
2002-12-02 15:51:33 +00:00
|
|
|
{
|
2002-12-02 16:02:03 +00:00
|
|
|
CheckTreeItem(hwndTree1,&hItem,(t->install_types>>m_whichcfg)&1);
|
|
|
|
}
|
|
|
|
else if (!(t->flags&SF_RO))
|
|
|
|
{
|
|
|
|
hItem.mask=TVIF_STATE;
|
|
|
|
TreeView_GetItem(hwndTree1,&hItem);
|
|
|
|
if (!(t->install_types&(1<<r)) != !((hItem.state>>12)>1 )) 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;
|
|
|
|
}
|
2002-12-02 15:51:33 +00:00
|
|
|
|
2003-03-18 20:36:52 +00:00
|
|
|
if (!(inst_flags&(CH_FLAGS_COMP_ONLY_ON_CUSTOM|CH_FLAGS_NO_CUSTOM)))
|
2002-12-02 16:02:03 +00:00
|
|
|
{
|
|
|
|
SendMessage(hwndCombo1,CB_SETCURSEL,r,0);
|
|
|
|
m_whichcfg=r;
|
|
|
|
}
|
|
|
|
} // end of typecheckshit
|
2002-12-02 15:51:33 +00:00
|
|
|
|
2003-03-18 20:36:52 +00:00
|
|
|
if (inst_flags&CH_FLAGS_COMP_ONLY_ON_CUSTOM)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
int c=(m_whichcfg == m_num_insttypes && m_num_insttypes)<<3;// SW_SHOWNA=8, SW_HIDE=0
|
|
|
|
ShowWindow(hwndTree1,c);
|
2002-09-23 19:27:42 +00:00
|
|
|
ShowWindow(GetUIItem(IDC_TEXT2),c);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2002-10-01 14:13:23 +00:00
|
|
|
if (LANG_STR_TAB(LANG_SPACE_REQ)) {
|
2002-08-02 10:01:35 +00:00
|
|
|
int x,total;
|
|
|
|
char s[128];
|
2002-08-29 12:25:19 +00:00
|
|
|
for (total=x=0; x < num_sections; x ++)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-10-02 15:01:06 +00:00
|
|
|
if (g_inst_section[x].flags&SF_SELECTED)
|
2002-08-02 10:01:35 +00:00
|
|
|
total+=g_inst_section[x].size_kb;
|
|
|
|
}
|
2002-10-05 16:20:13 +00:00
|
|
|
SetUITextNT(IDC_SPACEREQUIRED,inttosizestr(total,mystrcpy(s,LANG_STR(LANG_SPACE_REQ))));
|
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//NSIS_CONFIG_COMPONENTPAGE
|
|
|
|
|
|
|
|
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
|
|
|
|
int ui_st_updateflag=0x3;
|
|
|
|
|
2002-10-01 14:13:23 +00:00
|
|
|
void NSISCALL update_status_text_from_lang(int id, const char *text2)
|
2002-08-08 15:04:45 +00:00
|
|
|
{
|
2002-10-01 14:13:23 +00:00
|
|
|
update_status_text(LANG_STR(id), text2);
|
2002-08-08 15:04:45 +00:00
|
|
|
}
|
|
|
|
|
2002-08-19 23:18:19 +00:00
|
|
|
void NSISCALL update_status_text(const char *text1, const char *text2)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-08-25 11:26:15 +00:00
|
|
|
static char tmp[NSIS_MAX_STRLEN];
|
|
|
|
static LVITEM new_item = {LVIF_TEXT,0,0,0,0,tmp};
|
2002-08-02 10:01:35 +00:00
|
|
|
if (insthwnd)
|
|
|
|
{
|
2002-08-25 11:26:15 +00:00
|
|
|
if (mystrlen(text1)+mystrlen(text2) >= sizeof(tmp)) return;
|
|
|
|
wsprintf(tmp,"%s%s",text1,text2);
|
2002-08-02 10:01:35 +00:00
|
|
|
if ((ui_st_updateflag&1))
|
|
|
|
{
|
|
|
|
// Changed by Amir Szekely 26th July 2002
|
2002-08-05 21:09:23 +00:00
|
|
|
new_item.iItem=ListView_GetItemCount(insthwnd);
|
2002-08-02 10:01:35 +00:00
|
|
|
ListView_InsertItem(insthwnd, &new_item);
|
|
|
|
ListView_EnsureVisible(insthwnd, new_item.iItem, 0);
|
|
|
|
}
|
2002-12-02 23:08:10 +00:00
|
|
|
if ((ui_st_updateflag&2)) my_SetWindowText(insthwnd2,tmp);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static DWORD WINAPI install_thread(LPVOID p)
|
|
|
|
{
|
|
|
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
|
|
|
if (g_is_uninstaller)
|
|
|
|
{
|
2003-04-02 19:54:53 +00:00
|
|
|
if (ExecuteCodeSegment(g_inst_uninstheader->code,g_progresswnd)) g_flags.abort++;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
int m_inst_sec=0;
|
2003-04-02 19:54:53 +00:00
|
|
|
while (m_inst_sec<num_sections && !g_flags.abort)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
2002-11-30 13:15:49 +00:00
|
|
|
if (g_inst_section[m_inst_sec].flags&SF_SELECTED)
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
log_printf2("Section: \"%s\"",GetStringFromStringTab(g_inst_section[m_inst_sec].name_ptr));
|
2003-04-02 19:54:53 +00:00
|
|
|
if (ExecuteCodeSegment(g_inst_section[m_inst_sec].code,g_progresswnd)) g_flags.abort++;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
|
|
|
else
|
|
|
|
{
|
|
|
|
log_printf2("Skipping section: \"%s\"",GetStringFromStringTab(g_inst_section[m_inst_sec].name_ptr));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
m_inst_sec++;
|
|
|
|
}
|
|
|
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
|
|
|
}
|
|
|
|
#endif
|
2003-04-04 12:27:58 +00:00
|
|
|
if (m_curwnd) SendMessage(m_curwnd,WM_NOTIFY_INSTPROC_DONE,0,0);
|
2003-04-02 19:54:53 +00:00
|
|
|
return g_flags.abort;
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
|
|
|
static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
if (uMsg == WM_INITDIALOG)
|
|
|
|
{
|
2002-09-14 09:43:15 +00:00
|
|
|
RECT r;
|
2002-08-02 10:01:35 +00:00
|
|
|
int num=0;
|
|
|
|
LVCOLUMN lvc = {0, 0, -1, 0, 0, -1};
|
2002-08-09 14:21:45 +00:00
|
|
|
int lb_bg=g_inst_cmnheader->lb_bg,lb_fg=g_inst_cmnheader->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);
|
|
|
|
insthwnd=GetUIItem(IDC_LIST1);
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
|
|
|
if (g_is_uninstaller)
|
|
|
|
{
|
|
|
|
num=g_inst_uninstheader->code_size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2002-09-30 20:52:00 +00:00
|
|
|
int x;
|
2002-10-01 14:13:23 +00:00
|
|
|
log_printf3("New install of \"%s\" to \"%s\"",LANG_STR(LANG_NAME),state_install_directory);
|
2002-09-30 20:52:00 +00:00
|
|
|
for (x=0; x < num_sections; x ++)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
2002-10-02 15:01:06 +00:00
|
|
|
if (g_inst_section[x].flags&SF_SELECTED)
|
2002-08-02 10:01:35 +00:00
|
|
|
#endif
|
|
|
|
num+=g_inst_section[x].code_size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Changed by Amir Szekely 26th July 2002
|
|
|
|
ListView_InsertColumn(insthwnd, 0, &lvc);
|
2002-09-14 09:43:15 +00:00
|
|
|
GetClientRect(insthwnd,&r);
|
2002-09-20 16:22:18 +00:00
|
|
|
ListView_SetColumnWidth(insthwnd, 0, r.right-r.left-GetSystemMetrics(SM_CXHSCROLL));
|
2002-08-02 10:01:35 +00:00
|
|
|
#define LVS_EX_LABELTIP 0x00004000 // listview unfolds partly hidden labels if it does not have infotip text
|
|
|
|
ListView_SetExtendedListViewStyleEx(insthwnd, LVS_EX_LABELTIP, LVS_EX_LABELTIP);
|
2002-08-26 16:09:30 +00:00
|
|
|
if (lb_bg >= 0) {
|
|
|
|
ListView_SetBkColor(insthwnd, lb_bg);
|
|
|
|
ListView_SetTextBkColor(insthwnd, lb_bg);
|
|
|
|
}
|
|
|
|
if (lb_fg >= 0) {
|
|
|
|
ListView_SetTextColor(insthwnd, lb_fg);
|
|
|
|
}
|
2002-12-02 23:08:10 +00:00
|
|
|
my_SetWindowText(insthwndbutton,LANG_STR(LANG_BTN_DETAILS));
|
2003-03-18 20:36:52 +00:00
|
|
|
if (inst_flags&(CH_FLAGS_DETAILS_SHOWDETAILS|CH_FLAGS_DETAILS_NEVERSHOW))
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
|
|
|
ShowWindow(insthwndbutton,SW_HIDE);
|
2003-03-18 20:36:52 +00:00
|
|
|
if (!(inst_flags&CH_FLAGS_DETAILS_NEVERSHOW)) ShowWindow(insthwnd,SW_SHOWNA);
|
2002-08-02 10:01:35 +00:00
|
|
|
else insthwndbutton=NULL;
|
|
|
|
}
|
|
|
|
progress_bar_len=num;
|
|
|
|
|
2003-03-18 20:36:52 +00:00
|
|
|
g_progresswnd=GetUIItem(IDC_PROGRESS);
|
2002-08-02 10:01:35 +00:00
|
|
|
SendMessage(g_progresswnd,PBM_SETRANGE,0,MAKELPARAM(0,30000));
|
2003-03-18 20:36:52 +00:00
|
|
|
if (inst_flags&CH_FLAGS_PROGRESS_COLORED)
|
2002-08-02 10:01:35 +00:00
|
|
|
{
|
2002-08-09 14:21:45 +00:00
|
|
|
SendMessage(g_progresswnd,PBM_SETBARCOLOR,0,lb_fg);
|
|
|
|
SendMessage(g_progresswnd,PBM_SETBKCOLOR,0,lb_bg);
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
|
2002-09-23 20:56:29 +00:00
|
|
|
EnableWindow(m_hwndOK,0);
|
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;
|
2002-11-30 13:15:49 +00:00
|
|
|
CloseHandle(CreateThread(NULL,0,install_thread,0,0,&id));
|
2002-08-02 10:01:35 +00:00
|
|
|
}
|
|
|
|
if (uMsg == WM_COMMAND && LOWORD(wParam) == IDC_SHOWDETAILS)
|
|
|
|
{
|
2002-09-23 19:27:42 +00:00
|
|
|
ShowWindow(GetUIItem(IDC_SHOWDETAILS),SW_HIDE);
|
2002-08-02 10:01:35 +00:00
|
|
|
SendMessage(insthwnd,WM_VSCROLL,SB_BOTTOM,0);
|
|
|
|
ShowWindow(insthwnd,SW_SHOWNA);
|
|
|
|
}
|
|
|
|
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
|
|
|
{
|
|
|
|
m_retcode=1;
|
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-04-04 12:27:58 +00:00
|
|
|
if (!g_flags.abort)
|
|
|
|
update_status_text_from_lang(LANG_COMPLETED,"");
|
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
|
|
|
|
//+++Currently this has no language support for the popup menu tex
|
|
|
|
if (uMsg == WM_NOTIFY && ((NMHDR*)lParam)->code == NM_RCLICK)
|
2002-08-30 19:51:05 +00:00
|
|
|
{
|
|
|
|
int count = ListView_GetItemCount(insthwnd);
|
|
|
|
if (count > 0)
|
|
|
|
{
|
2002-08-31 10:25:24 +00:00
|
|
|
DWORD pos = GetMessagePos();
|
|
|
|
HMENU menu = CreatePopupMenu();
|
2002-10-01 14:13:23 +00:00
|
|
|
AppendMenu(menu,MF_STRING,1,LANG_STR(LANG_COPYDETAILS));
|
2002-08-31 10:25:24 +00:00
|
|
|
if (1==TrackPopupMenu(
|
|
|
|
menu,
|
|
|
|
TPM_NONOTIFY|TPM_RETURNCMD,
|
|
|
|
GET_X_LPARAM(pos),
|
|
|
|
GET_Y_LPARAM(pos),
|
|
|
|
0,insthwnd,0))
|
2002-08-30 19:51:05 +00:00
|
|
|
{
|
2002-08-31 10:25:24 +00:00
|
|
|
char textBuf[1024];
|
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;
|
|
|
|
item.pszText = textBuf;
|
|
|
|
item.cchTextMax = 1023;
|
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.
|
|
|
|
total += 2+SendMessage(insthwnd,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 {
|
2002-10-05 16:20:13 +00:00
|
|
|
ListView_GetItemText(insthwnd,i,0,ptr,total);
|
2002-08-31 10:25:24 +00:00
|
|
|
while (*ptr) 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
|