Added support for LZMA compressor + fixed command line compressor support
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3195 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
ac025c139c
commit
80eac750fc
11 changed files with 184 additions and 121 deletions
|
@ -175,6 +175,7 @@ Version History
|
|||
- Made the Toolbar style flat
|
||||
- Added option for compile & run
|
||||
- Added compressor setting option
|
||||
- Added support for lzma compression
|
||||
|
||||
Copyright Information
|
||||
---------------------
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#define MAKENSISW_CPP
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "makensisw.h"
|
||||
|
@ -87,7 +89,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
{
|
||||
int argc;
|
||||
char **argv;
|
||||
int i;
|
||||
int i, j;
|
||||
int argSpaceSize;
|
||||
|
||||
g_sdata.hwnd=hwndDlg;
|
||||
|
@ -125,11 +127,13 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
p += lstrlen("/FINAL ");
|
||||
}
|
||||
while(*p == ' ') p++;
|
||||
if(!lstrcmpi(p,"zlib")) {
|
||||
SetCompressor(COMPRESSOR_ZLIB);
|
||||
}
|
||||
else if(!lstrcmpi(p,"bzip2")) {
|
||||
SetCompressor(COMPRESSOR_BZIP2);
|
||||
if(p && lstrlen(p)) {
|
||||
for(j=(int)COMPRESSOR_DEFAULT+1; j < (int)COMPRESSOR_BEST; j++) {
|
||||
if(!lstrcmpi(p,compressor_names[j])) {
|
||||
g_sdata.command_line_compressor = true;
|
||||
SetCompressor((NCOMPRESSOR)j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -239,11 +243,13 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
}
|
||||
if(g_sdata.compressor == COMPRESSOR_BEST) {
|
||||
if (g_sdata.retcode==0 && FileExists(g_sdata.output_exe)) {
|
||||
char zlib_file_name[MAX_PATH];
|
||||
wsprintf(zlib_file_name,"%s_makensisw_zlib",g_sdata.output_exe);
|
||||
if(!lstrcmpi(g_sdata.compressor_name,ZLIB_COMPRESSOR_NAME)) {
|
||||
CopyFile(g_sdata.output_exe,zlib_file_name,false);
|
||||
g_sdata.compressor_name = BZIP2_COMPRESSOR_NAME;
|
||||
char temp_file_name[MAX_PATH];
|
||||
wsprintf(temp_file_name,"%s_makensisw_temp",g_sdata.output_exe);
|
||||
if(!lstrcmpi(g_sdata.compressor_name,compressor_names[(int)COMPRESSOR_DEFAULT+1])) {
|
||||
SetCompressorStats();
|
||||
CopyFile(g_sdata.output_exe,temp_file_name,false);
|
||||
g_sdata.best_compressor_name = g_sdata.compressor_name;
|
||||
g_sdata.compressor_name = compressor_names[(int)COMPRESSOR_DEFAULT+2];
|
||||
ResetObjects();
|
||||
ResetInputScript();
|
||||
|
||||
|
@ -251,48 +257,76 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
return TRUE;
|
||||
}
|
||||
else {
|
||||
g_sdata.compressor_name = ZLIB_COMPRESSOR_NAME;
|
||||
g_sdata.appended = false;
|
||||
ResetInputScript();
|
||||
int this_compressor;
|
||||
int last_compressor;
|
||||
int i;
|
||||
HANDLE hPrev, hThis;
|
||||
DWORD prevSize, thisSize;
|
||||
|
||||
if(FileExists(zlib_file_name)) {
|
||||
HANDLE hZlib, hBzip2;
|
||||
DWORD zlibSize, bzip2Size;
|
||||
|
||||
hZlib = CreateFile(zlib_file_name,GENERIC_READ, FILE_SHARE_READ,
|
||||
for(i=(int)COMPRESSOR_DEFAULT+2; i<(int)COMPRESSOR_BEST; i++) {
|
||||
if(!lstrcmpi(g_sdata.compressor_name,compressor_names[i])) {
|
||||
this_compressor = i;
|
||||
last_compressor = i-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(FileExists(temp_file_name)) {
|
||||
hPrev = CreateFile(temp_file_name,GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, NULL, NULL);
|
||||
if(hZlib != INVALID_HANDLE_VALUE) {
|
||||
zlibSize = GetFileSize(hZlib, 0);
|
||||
CloseHandle(hZlib);
|
||||
if(hPrev != INVALID_HANDLE_VALUE) {
|
||||
prevSize = GetFileSize(hPrev, 0);
|
||||
CloseHandle(hPrev);
|
||||
|
||||
if(zlibSize != INVALID_FILE_SIZE) {
|
||||
hBzip2 = CreateFile(g_sdata.output_exe,GENERIC_READ, FILE_SHARE_READ,
|
||||
if(prevSize != INVALID_FILE_SIZE) {
|
||||
hThis = CreateFile(g_sdata.output_exe,GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, NULL, NULL);
|
||||
if(hBzip2 != INVALID_HANDLE_VALUE) {
|
||||
bzip2Size = GetFileSize(hBzip2, 0);
|
||||
CloseHandle(hBzip2);
|
||||
if(hThis != INVALID_HANDLE_VALUE) {
|
||||
thisSize = GetFileSize(hThis, 0);
|
||||
CloseHandle(hThis);
|
||||
|
||||
char buf[1024];
|
||||
|
||||
if(bzip2Size != INVALID_FILE_SIZE) {
|
||||
if(zlibSize < bzip2Size) {
|
||||
CopyFile(zlib_file_name,g_sdata.output_exe,false);
|
||||
wsprintf(buf,COMPRESSOR_MESSAGE,ZLIB_COMPRESSOR_NAME,zlibSize,
|
||||
BZIP2_COMPRESSOR_NAME,bzip2Size);
|
||||
LogMessage(g_sdata.hwnd,buf);
|
||||
LogMessage(g_sdata.hwnd,ZLIB_COMPRESSOR_MESSAGE);
|
||||
LogMessage(g_sdata.hwnd, g_sdata.compressor_stats);
|
||||
}
|
||||
else {
|
||||
wsprintf(buf,COMPRESSOR_MESSAGE,BZIP2_COMPRESSOR_NAME,bzip2Size,
|
||||
ZLIB_COMPRESSOR_NAME,zlibSize);
|
||||
LogMessage(g_sdata.hwnd,buf);
|
||||
if(thisSize != INVALID_FILE_SIZE) {
|
||||
if(prevSize > thisSize) {
|
||||
CopyFile(temp_file_name,g_sdata.output_exe,false);
|
||||
SetCompressorStats();
|
||||
g_sdata.best_compressor_name = g_sdata.compressor_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DeleteFile(zlib_file_name);
|
||||
}
|
||||
|
||||
if(this_compressor == ((int)COMPRESSOR_BEST - 1)) {
|
||||
char buf[1024];
|
||||
|
||||
g_sdata.compressor_name = compressor_names[(int)COMPRESSOR_DEFAULT+1];
|
||||
g_sdata.appended = false;
|
||||
ResetInputScript();
|
||||
|
||||
if(!lstrcmpi(g_sdata.best_compressor_name,compressor_names[this_compressor])) {
|
||||
wsprintf(buf,COMPRESSOR_MESSAGE,g_sdata.best_compressor_name,thisSize);
|
||||
LogMessage(g_sdata.hwnd,buf);
|
||||
}
|
||||
else {
|
||||
CopyFile(temp_file_name,g_sdata.output_exe,false);
|
||||
wsprintf(buf,RESTORED_COMPRESSOR_MESSAGE,g_sdata.best_compressor_name,prevSize);
|
||||
LogMessage(g_sdata.hwnd,buf);
|
||||
LogMessage(g_sdata.hwnd, g_sdata.compressor_stats);
|
||||
}
|
||||
DeleteFile(temp_file_name);
|
||||
ResetObjects();
|
||||
ResetInputScript();
|
||||
lstrcpy(g_sdata.compressor_stats,"");
|
||||
}
|
||||
else {
|
||||
g_sdata.compressor_name = compressor_names[this_compressor+1];
|
||||
ResetObjects();
|
||||
ResetInputScript();
|
||||
|
||||
CompileNSISScript();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -477,6 +511,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
return TRUE;
|
||||
case IDM_COMPRESSOR:
|
||||
{
|
||||
g_sdata.command_line_compressor = false;
|
||||
SetCompressor((NCOMPRESSOR)(g_sdata.compressor+1));
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -585,18 +620,18 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
g_find.hwndFind = FindText(&g_find.fr);
|
||||
return TRUE;
|
||||
}
|
||||
case IDM_DEFAULT:
|
||||
SetCompressor(COMPRESSOR_DEFAULT);
|
||||
return TRUE;
|
||||
case IDM_ZLIB:
|
||||
SetCompressor(COMPRESSOR_ZLIB);
|
||||
return TRUE;
|
||||
case IDM_BZIP2:
|
||||
SetCompressor(COMPRESSOR_BZIP2);
|
||||
return TRUE;
|
||||
case IDM_BEST:
|
||||
SetCompressor(COMPRESSOR_BEST);
|
||||
return TRUE;
|
||||
default:
|
||||
{
|
||||
int i;
|
||||
DWORD command = LOWORD(wParam);
|
||||
for(i=(int)COMPRESSOR_DEFAULT; i<=(int)COMPRESSOR_BEST; i++) {
|
||||
if(command == compressor_commands[i]) {
|
||||
g_sdata.command_line_compressor = false;
|
||||
SetCompressor((NCOMPRESSOR)i);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -878,35 +913,31 @@ BOOL CALLBACK DefinesProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
void SetCompressor(NCOMPRESSOR compressor)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(g_sdata.compressor != compressor) {
|
||||
WORD command;
|
||||
char *compressor_name;
|
||||
|
||||
switch(compressor) {
|
||||
case COMPRESSOR_ZLIB:
|
||||
command = IDM_ZLIB;
|
||||
compressor_name = ZLIB_COMPRESSOR_NAME;
|
||||
break;
|
||||
case COMPRESSOR_BZIP2:
|
||||
command = IDM_BZIP2;
|
||||
compressor_name = BZIP2_COMPRESSOR_NAME;
|
||||
break;
|
||||
case COMPRESSOR_BEST:
|
||||
command = IDM_BEST;
|
||||
compressor_name = ZLIB_COMPRESSOR_NAME;
|
||||
break;
|
||||
default:
|
||||
compressor = COMPRESSOR_DEFAULT;
|
||||
command = IDM_DEFAULT;
|
||||
compressor_name = "";
|
||||
if(compressor > COMPRESSOR_DEFAULT && compressor < COMPRESSOR_BEST) {
|
||||
command = compressor_commands[(int)compressor];
|
||||
compressor_name = compressor_names[(int)compressor];
|
||||
}
|
||||
else if(compressor == COMPRESSOR_BEST) {
|
||||
command = compressor_commands[(int)compressor];
|
||||
compressor_name = compressor_names[(int)COMPRESSOR_DEFAULT+1];
|
||||
}
|
||||
else {
|
||||
compressor = COMPRESSOR_DEFAULT;
|
||||
command = IDM_DEFAULT;
|
||||
compressor_name = "";
|
||||
}
|
||||
g_sdata.compressor = compressor;
|
||||
g_sdata.compressor_name = compressor_name;
|
||||
UpdateToolBarCompressorButton();
|
||||
CheckMenuItem(g_sdata.menu, IDM_DEFAULT, MF_BYCOMMAND | MF_UNCHECKED);
|
||||
CheckMenuItem(g_sdata.menu, IDM_ZLIB, MF_BYCOMMAND | MF_UNCHECKED);
|
||||
CheckMenuItem(g_sdata.menu, IDM_BZIP2, MF_BYCOMMAND | MF_UNCHECKED);
|
||||
CheckMenuItem(g_sdata.menu, IDM_BEST, MF_BYCOMMAND | MF_UNCHECKED);
|
||||
for(i=(int)COMPRESSOR_DEFAULT; i<= (int)COMPRESSOR_BEST; i++) {
|
||||
CheckMenuItem(g_sdata.menu, compressor_commands[i], MF_BYCOMMAND | MF_UNCHECKED);
|
||||
}
|
||||
CheckMenuItem(g_sdata.menu, command, MF_BYCOMMAND | MF_CHECKED);
|
||||
ResetObjects();
|
||||
ResetInputScript();
|
||||
|
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32_MEAN_AND_LEAN" /D RELEASE=2.0 /FD /c
|
||||
# ADD CPP /nologo /W3 /O1 /D "NDEBUG" /D "WIN32_MEAN_AND_LEAN" /D RELEASE=2.0 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
|
@ -70,7 +70,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
|
|
|
@ -57,10 +57,8 @@
|
|||
#define EDIT_MENU_INDEX 1
|
||||
#define TOOLS_MENU_INDEX 2
|
||||
#define COMPRESSOR_MENU_INDEX 4
|
||||
#define BZIP2_COMPRESSOR_NAME "bzip2"
|
||||
#define ZLIB_COMPRESSOR_NAME "zlib"
|
||||
#define COMPRESSOR_MESSAGE "\n\nThe %s compressor (%d bytes) created a smaller file than the %s compressor (%d bytes)."
|
||||
#define ZLIB_COMPRESSOR_MESSAGE "\nThe bzip2 compressed version was replaced with zlib compressed version."
|
||||
#define COMPRESSOR_MESSAGE "\n\nThe %s compressor (%d bytes) created the smallest installer."
|
||||
#define RESTORED_COMPRESSOR_MESSAGE "\n\nThe %s compressor (%d bytes) created the smallest installer which was restored."
|
||||
#define EXE_HEADER_COMPRESSOR_STAT "EXE header size:"
|
||||
#define TOTAL_SIZE_COMPRESSOR_STAT "Total size:"
|
||||
|
||||
|
@ -77,9 +75,46 @@ typedef enum {
|
|||
COMPRESSOR_DEFAULT,
|
||||
COMPRESSOR_ZLIB,
|
||||
COMPRESSOR_BZIP2,
|
||||
#ifdef LZMA_COMPRESSOR_SUPPORT
|
||||
COMPRESSOR_LZMA,
|
||||
#endif
|
||||
COMPRESSOR_BEST,
|
||||
} NCOMPRESSOR;
|
||||
|
||||
#ifdef MAKENSISW_CPP
|
||||
char *compressor_names[] = {"",
|
||||
"zlib",
|
||||
"bzip2",
|
||||
#ifdef LZMA_COMPRESSOR_SUPPORT
|
||||
"lzma",
|
||||
#endif
|
||||
"Best"};
|
||||
WORD compressor_commands[] = {IDM_DEFAULT,
|
||||
IDM_ZLIB,
|
||||
IDM_BZIP2,
|
||||
#ifdef LZMA_COMPRESSOR_SUPPORT
|
||||
IDM_LZMA,
|
||||
#endif
|
||||
IDM_BEST};
|
||||
#endif
|
||||
|
||||
#ifdef TOOLBAR_CPP
|
||||
int compressor_bitmaps[] = {IDB_COMPRESSOR_DEFAULT,
|
||||
IDB_COMPRESSOR_ZLIB,
|
||||
IDB_COMPRESSOR_BZIP2,
|
||||
#ifdef LZMA_COMPRESSOR_SUPPORT
|
||||
IDB_COMPRESSOR_LZMA,
|
||||
#endif
|
||||
IDB_COMPRESSOR_BEST};
|
||||
int compressor_strings[] = {IDS_DEFAULT,
|
||||
IDS_ZLIB,
|
||||
IDS_BZIP2,
|
||||
#ifdef LZMA_COMPRESSOR_SUPPORT
|
||||
IDS_LZMA,
|
||||
#endif
|
||||
IDS_BEST};
|
||||
#endif
|
||||
|
||||
// Extern Variables
|
||||
extern const char* NSISW_VERSION;
|
||||
|
||||
|
@ -122,6 +157,8 @@ typedef struct NSISScriptData {
|
|||
NCOMPRESSOR compressor;
|
||||
char *compressor_name;
|
||||
char compressor_stats[512];
|
||||
char *best_compressor_name;
|
||||
BOOL command_line_compressor;
|
||||
// Added by Darren Owen (DrO) on 1/10/2003
|
||||
int recompile_test;
|
||||
} NSCRIPTDATA;
|
||||
|
|
|
@ -21,10 +21,9 @@
|
|||
#define IDS_DEFAULT 18
|
||||
#define IDS_ZLIB 19
|
||||
#define IDS_BZIP2 20
|
||||
// Added by Darren Owen (DrO) on 1/10/2003
|
||||
#define IDS_RECOMPILE_TEST 21
|
||||
#define IDS_BEST 22
|
||||
|
||||
#define IDS_LZMA 23
|
||||
#define DLG_MAIN 101
|
||||
#define IDI_ICON 102
|
||||
#define DLG_ABOUT 103
|
||||
|
@ -57,9 +56,7 @@
|
|||
#define IDRIGHT 1019
|
||||
#define IDLEFT 1020
|
||||
#define IDC_DEFINES 1021
|
||||
// Added by Darren Owen (DrO) on 1/10/2003
|
||||
#define IDC_RECOMPILE_TEST 1022
|
||||
|
||||
#define IDM_COMPRESSOR 40001
|
||||
#define IDM_TEST 40002
|
||||
#define IDM_EDITSCRIPT 40003
|
||||
|
@ -77,16 +74,18 @@
|
|||
#define IDM_BZIP2 40022
|
||||
#define IDM_MRU_FILE 40023
|
||||
#define IDM_CLEAR_MRU_LIST 40029
|
||||
// Added by Darren Owen (DrO) on 1/10/2003
|
||||
#define IDM_RECOMPILE_TEST 40030
|
||||
#define IDM_BEST 40031
|
||||
#ifdef LZMA_COMPRESSOR_SUPPORT
|
||||
#define IDM_LZMA 40032
|
||||
#endif
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 124
|
||||
#define _APS_NEXT_COMMAND_VALUE 40031
|
||||
#define _APS_NEXT_COMMAND_VALUE 40033
|
||||
#define _APS_NEXT_CONTROL_VALUE 1023
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
|
@ -93,6 +93,9 @@ BEGIN
|
|||
MENUITEM "Defa&ult", IDM_DEFAULT
|
||||
MENUITEM "&zlib", IDM_ZLIB
|
||||
MENUITEM "bzi&p2", IDM_BZIP2
|
||||
#ifdef LZMA_COMPRESSOR_SUPPORT
|
||||
MENUITEM "&lzma", IDM_LZMA
|
||||
#endif
|
||||
MENUITEM "&Best", IDM_BEST
|
||||
END
|
||||
MENUITEM "Edit Script\tCtrl+E", IDM_EDITSCRIPT
|
||||
|
@ -128,14 +131,11 @@ BEGIN
|
|||
"F", IDM_FIND, VIRTKEY, CONTROL, NOINVERT
|
||||
"L", IDM_LOADSCRIPT, VIRTKEY, CONTROL, NOINVERT
|
||||
"M", IDM_RECOMPILE_TEST, VIRTKEY, CONTROL, NOINVERT
|
||||
"P", IDM_BZIP2, VIRTKEY, CONTROL, NOINVERT
|
||||
"R", IDM_RECOMPILE, VIRTKEY, CONTROL, NOINVERT
|
||||
"T", IDM_TEST, VIRTKEY, CONTROL, NOINVERT
|
||||
"U", IDM_DEFAULT, VIRTKEY, CONTROL, NOINVERT
|
||||
VK_F1, IDM_DOCS, VIRTKEY, NOINVERT
|
||||
"W", IDM_CLEARLOG, VIRTKEY, CONTROL, NOINVERT
|
||||
"X", IDM_EXIT, VIRTKEY, ALT, NOINVERT
|
||||
"Z", IDM_ZLIB, VIRTKEY, CONTROL, NOINVERT
|
||||
END
|
||||
|
||||
|
||||
|
@ -273,6 +273,9 @@ BEGIN
|
|||
IDS_BZIP2 "bzip2"
|
||||
IDS_RECOMPILE_TEST "Recompile and run"
|
||||
IDS_BEST "Best"
|
||||
#ifdef LZMA_COMPRESSOR_SUPPORT
|
||||
IDS_LZMA "lzma"
|
||||
#endif
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.9 KiB |
|
@ -18,6 +18,8 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
*/
|
||||
#define TOOLBAR_CPP
|
||||
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "makensisw.h"
|
||||
|
@ -99,25 +101,12 @@ void UpdateToolBarCompressorButton()
|
|||
|
||||
my_memset(&ti, 0, sizeof(TOOLINFO));
|
||||
|
||||
switch(g_sdata.compressor) {
|
||||
case COMPRESSOR_DEFAULT:
|
||||
iBitmap = IDB_COMPRESSOR;
|
||||
iString = IDS_DEFAULT;
|
||||
break;
|
||||
case COMPRESSOR_ZLIB:
|
||||
iBitmap = IDB_COMPRESSOR_ZLIB;
|
||||
iString = IDS_ZLIB;
|
||||
break;
|
||||
case COMPRESSOR_BZIP2:
|
||||
iBitmap = IDB_COMPRESSOR_BZIP2;
|
||||
iString = IDS_BZIP2;
|
||||
break;
|
||||
case COMPRESSOR_BEST:
|
||||
iBitmap = IDB_COMPRESSOR_BEST;
|
||||
iString = IDS_BEST;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
if(g_sdata.compressor >= COMPRESSOR_DEFAULT && g_sdata.compressor <= COMPRESSOR_BEST) {
|
||||
iBitmap = compressor_bitmaps[(int)g_sdata.compressor];
|
||||
iString = compressor_strings[(int)g_sdata.compressor];
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
LoadString(g_sdata.hInstance,
|
||||
IDS_COMPRESSOR,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#define TOOLBAR_ID 10001
|
||||
|
||||
#define NUMIMAGES 21
|
||||
#define NUMIMAGES 22
|
||||
#define IMAGEWIDTH 16
|
||||
#define IMAGEHEIGHT 16
|
||||
#define BUTTONWIDTH 0
|
||||
|
@ -64,6 +64,7 @@
|
|||
#define IDB_RECOMPILE 5
|
||||
#define IDB_DEFINES 6
|
||||
#define IDB_COMPRESSOR 7
|
||||
#define IDB_COMPRESSOR_DEFAULT 7
|
||||
#define IDB_TEST 8
|
||||
#define IDB_EDITSCRIPT 9
|
||||
#define IDB_BROWSESCR 10
|
||||
|
@ -77,6 +78,7 @@
|
|||
// Added by Darren Owen (DrO) on 1/10/2003
|
||||
#define IDB_RECOMPILE_TEST 19
|
||||
#define IDB_COMPRESSOR_BEST 20
|
||||
#define IDB_COMPRESSOR_LZMA 21
|
||||
|
||||
typedef struct ToolBarStruct {
|
||||
HWND hwnd;
|
||||
|
|
|
@ -240,10 +240,6 @@ void SetCompressorStats()
|
|||
void CompileNSISScript() {
|
||||
static char *s;
|
||||
DragAcceptFiles(g_sdata.hwnd,FALSE);
|
||||
if(((g_sdata.compressor == COMPRESSOR_BEST) &&
|
||||
(!lstrcmpi(g_sdata.compressor_name,BZIP2_COMPRESSOR_NAME)))) {
|
||||
SetCompressorStats();
|
||||
}
|
||||
ClearLog(g_sdata.hwnd);
|
||||
SetTitle(g_sdata.hwnd,NULL);
|
||||
if (lstrlen(g_sdata.script)==0) {
|
||||
|
@ -381,7 +377,6 @@ void ResetObjects() {
|
|||
g_sdata.warnings = FALSE;
|
||||
g_sdata.retcode = -1;
|
||||
g_sdata.thread = NULL;
|
||||
lstrcpy(g_sdata.compressor_stats,"");
|
||||
}
|
||||
|
||||
void ResetDefines() {
|
||||
|
@ -766,16 +761,19 @@ void RestoreCompressor()
|
|||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
g_sdata.command_line_compressor = false;
|
||||
SetCompressor(v);
|
||||
}
|
||||
|
||||
void SaveCompressor()
|
||||
{
|
||||
HKEY hKey;
|
||||
NCOMPRESSOR v = g_sdata.compressor;
|
||||
if (RegCreateKey(REGSEC,REGKEY,&hKey) == ERROR_SUCCESS) {
|
||||
RegSetValueEx(hKey,REGCOMPRESSOR,0,REG_DWORD,(unsigned char*)&v,sizeof(v));
|
||||
RegCloseKey(hKey);
|
||||
if(!g_sdata.command_line_compressor) {
|
||||
HKEY hKey;
|
||||
NCOMPRESSOR v = g_sdata.compressor;
|
||||
if (RegCreateKey(REGSEC,REGKEY,&hKey) == ERROR_SUCCESS) {
|
||||
RegSetValueEx(hKey,REGCOMPRESSOR,0,REG_DWORD,(unsigned char*)&v,sizeof(v));
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
*/
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
#include "resource.h"
|
||||
#include "toolbar.h"
|
||||
|
||||
#define MRU_LIST_SIZE 5
|
||||
#define MRU_DISPLAY_LENGTH 40
|
||||
|
@ -49,6 +51,7 @@ void AddTip(HWND hWnd,LPSTR lpszToolTip);
|
|||
void ShowDocs();
|
||||
void RestoreCompressor();
|
||||
void SaveCompressor();
|
||||
void SetCompressorStats();
|
||||
|
||||
BOOL PopMRUFile(char* fname);
|
||||
void PushMRUFile(char* fname);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue