home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 March / CMCD0304.ISO / Software / Freeware / Programare / nullsoft / nsis20.exe / Contrib / Makensisw / makensisw.h < prev    next >
C/C++ Source or Header  |  2004-01-04  |  7KB  |  195 lines

  1. /*
  2.   Copyright (c) 2002 Robert Rainwater
  3.   Contributors: Justin Frankel, Fritz Elfert, Amir Szekely, Sunil Kamath, Joost Verburg
  4.  
  5.   This software is provided 'as-is', without any express or implied
  6.   warranty.  In no event will the authors be held liable for any damages
  7.   arising from the use of this software.
  8.  
  9.   Permission is granted to anyone to use this software for any purpose,
  10.   including commercial applications, and to alter it and redistribute it
  11.   freely, subject to the following restrictions:
  12.  
  13.   1. The origin of this software must not be misrepresented; you must not
  14.      claim that you wrote the original software. If you use this software
  15.      in a product, an acknowledgment in the product documentation would be
  16.      appreciated but is not required.
  17.   2. Altered source versions must be plainly marked as such, and must not be
  18.      misrepresented as being the original software.
  19.   3. This notice may not be removed or altered from any source distribution.
  20.  
  21. */
  22. #ifndef MAKENSIS_H
  23. #define MAKENSIS_H
  24.  
  25. #include <commctrl.h>
  26. #include "utils.h"
  27. #define _RICHEDIT_VER 0x0200
  28. #include <richedit.h>
  29. #undef _RICHEDIT_VER
  30.  
  31. // Defines
  32. #define NSIS_URL     "http://nsis.sourceforge.net/"
  33. #define NSIS_FOR     "http://forums.winamp.com/forumdisplay.php?forumid=65"
  34. #define NSIS_UPDATE  "\\Bin\\NSISUpdate.exe"
  35. #define USAGE        "Usage:\r\n\r\n - File | Load Script...\r\n - Drag the .nsi file into this window\r\n - Right click the .nsi file and choose \"Compile NSIS Script\""
  36. #define COPYRIGHT    "Copyright ⌐ 2002 Robert Rainwater"
  37. #define CONTRIB      "Fritz Elfert, Justin Frankel, Amir Szekely, Sunil Kamath, Joost Verburg"
  38. #define DOCPATH      "http://nsis.sourceforge.net/Docs/"
  39. #define LOCALDOCS    "\\NSIS.chm"
  40. #define NSISERROR    "Unable to intialize MakeNSIS.  Please verify that makensis.exe is in the same directory as makensisw.exe."
  41. #define DLGERROR     "Unable to intialize MakeNSISW."
  42. #define SYMBOLSERROR "Symbol cannot contain whitespace characters"
  43. #define NSISUPDATEPROMPT "Running NSIS Update will close MakeNSISW.\nContinue?"
  44. #define REGSEC       HKEY_LOCAL_MACHINE
  45. #define REGKEY       "Software\\NSIS"
  46. #define REGLOC       "MakeNSISWPlacement"
  47. #define REGCOMPRESSOR "MakeNSISWCompressor"
  48. #define REGSYMSUBKEY "Symbols"
  49. #define REGMRUSUBKEY "MRU"
  50. #define EXENAME      "makensis.exe"
  51. #define MAX_STRING   256
  52. #define TIMEOUT      100
  53. #define MINWIDTH     350
  54. #define MINHEIGHT    180
  55. #define FILE_MENU_INDEX 0
  56. #define EDIT_MENU_INDEX 1
  57. #define SCRIPT_MENU_INDEX 2
  58. #define COMPRESSOR_MENU_INDEX 4
  59. #define TOOLS_MENU_INDEX 3
  60. #define COMPRESSOR_MESSAGE "\n\nThe %s compressor created the smallest installer (%d bytes)."
  61. #define RESTORED_COMPRESSOR_MESSAGE "\n\nThe %s compressor created the smallest installer (%d bytes)."
  62. #define EXE_HEADER_COMPRESSOR_STAT "EXE header size:"
  63. #define TOTAL_SIZE_COMPRESSOR_STAT "Total size:"
  64. #define SYMBOL_SET_NAME_MAXLEN 40
  65. #define LOAD_SYMBOL_SET_DLG_NAME "Load Symbol Definitions Set"
  66. #define SAVE_SYMBOL_SET_DLG_NAME "Save Symbol Definitions Set"
  67. #define LOAD_BUTTON_TEXT "Load"
  68. #define SAVE_BUTTON_TEXT "Save"
  69. #define LOAD_SYMBOL_SET_MESSAGE "Please select a name for the Symbol Definitions Set to load."
  70. #define SAVE_SYMBOL_SET_MESSAGE "Please enter or select a name for the Symbol Definitions Set to save."
  71.  
  72. #define WM_MAKENSIS_PROCESSCOMPLETE (WM_USER+1001)
  73. #define WM_MAKENSIS_LOADSYMBOLSET (WM_USER+1002)
  74. #define WM_MAKENSIS_SAVESYMBOLSET (WM_USER+1003)
  75.  
  76. enum {
  77.   MAKENSIS_NOTIFY_SCRIPT,
  78.   MAKENSIS_NOTIFY_WARNING,
  79.   MAKENSIS_NOTIFY_ERROR,
  80.   MAKENSIS_NOTIFY_OUTPUT
  81. };
  82.  
  83. typedef enum {
  84.   COMPRESSOR_SCRIPT,
  85.   COMPRESSOR_ZLIB,
  86.   COMPRESSOR_BZIP2,
  87.   COMPRESSOR_LZMA,
  88.   COMPRESSOR_BEST,
  89. } NCOMPRESSOR;
  90.  
  91. #ifdef MAKENSISW_CPP
  92. char *compressor_names[] = {"",
  93.                             "zlib",
  94.                             "bzip2",
  95.                             "lzma",
  96.                             "Best"};
  97. char *compressor_display_names[] = {"Defined in Script/Compiler Default",
  98.                             "ZLIB",
  99.                             "BZIP2",
  100.                             "LZMA",
  101.                             "Best Compressor"};
  102. WORD compressor_commands[] = {IDM_SCRIPT,
  103.                               IDM_ZLIB,
  104.                               IDM_BZIP2,
  105.                               IDM_LZMA,
  106.                               IDM_BEST};
  107. #endif
  108.  
  109. #ifdef TOOLBAR_CPP
  110. int compressor_bitmaps[] = {IDB_COMPRESSOR_SCRIPT, 
  111.                             IDB_COMPRESSOR_ZLIB, 
  112.                             IDB_COMPRESSOR_BZIP2, 
  113.                             IDB_COMPRESSOR_LZMA, 
  114.                             IDB_COMPRESSOR_BEST};
  115. int compressor_strings[] = {IDS_SCRIPT, 
  116.                             IDS_ZLIB, 
  117.                             IDS_BZIP2, 
  118.                             IDS_LZMA, 
  119.                             IDS_BEST};
  120. #endif
  121.  
  122. // Extern Variables
  123.  
  124. extern const char* NSISW_VERSION;
  125.  
  126. int WINAPI     WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmdShow);
  127. static BOOL    CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  128. DWORD WINAPI   MakeNSISProc(LPVOID p);
  129. BOOL CALLBACK  DialogResize(HWND hWnd, LPARAM /* unused*/);
  130. BOOL CALLBACK  AboutNSISProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  131. BOOL CALLBACK  AboutProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  132. BOOL CALLBACK  SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  133. BOOL CALLBACK  SymbolSetProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  134. BOOL CALLBACK  CompressorProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  135. void           CompileNSISScript();
  136. char*          BuildSymbols();
  137. void           SetCompressor(NCOMPRESSOR);
  138. void           RestoreSymbols();
  139. void           SaveSymbols();
  140. void           DeleteSymbolSet(char *);
  141. char**         LoadSymbolSet(char *);
  142. void           SaveSymbolSet(char *, char **);
  143. void           RestoreMRUList();
  144. void           SaveMRUList();
  145.  
  146. typedef struct NSISScriptData {
  147.   bool script_alloced;
  148.   char *script;
  149.   char *output_exe;
  150.   char *input_script;
  151.   char *branding;
  152.   char *brandingv;
  153.   char **symbols;
  154.   int retcode;
  155.   DWORD logLength;
  156.   DWORD warnings;
  157.   BOOL appended;
  158.   HINSTANCE hInstance;
  159.   HWND hwnd;
  160.   HMENU menu;
  161.   HMENU fileSubmenu;
  162.   HMENU editSubmenu;
  163.   HMENU toolsSubmenu;
  164.   HANDLE thread;
  165.   HWND focused_hwnd;
  166.   CHARRANGE textrange;
  167.   NCOMPRESSOR default_compressor;
  168.   NCOMPRESSOR compressor;
  169.   char *compressor_name;
  170.   char compressor_stats[512];
  171.   char *best_compressor_name;
  172.   // Added by Darren Owen (DrO) on 1/10/2003
  173.   int recompile_test;
  174. } NSCRIPTDATA;
  175.  
  176. typedef struct ResizeData {
  177.   RECT resizeRect;
  178.   RECT griprect;
  179.   int dx;
  180.   int dy;
  181. } NRESIZEDATA;
  182.  
  183. typedef struct FindReplaceDialog {
  184.   FINDREPLACE fr;
  185.   UINT uFindReplaceMsg;
  186.   HWND hwndFind;
  187. } NFINDREPLACE;
  188.  
  189. typedef struct ToolTipStruct {
  190.   HWND tip;
  191.   HWND tip_p;
  192.   HHOOK hook;
  193. } NTOOLTIP;
  194.  
  195. #endif