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