diff options
Diffstat (limited to 'Src/installer/shared/scripts')
-rw-r--r-- | Src/installer/shared/scripts/log.nsh | 18 | ||||
-rw-r--r-- | Src/installer/shared/scripts/nx.nsh | 11 | ||||
-rw-r--r-- | Src/installer/shared/scripts/syslink.nsh | 55 | ||||
-rw-r--r-- | Src/installer/shared/scripts/system.nsh | 431 | ||||
-rw-r--r-- | Src/installer/shared/scripts/textRect.nsh | 186 | ||||
-rw-r--r-- | Src/installer/shared/scripts/windowRect.nsh | 401 | ||||
-rw-r--r-- | Src/installer/shared/scripts/windowText.nsh | 37 |
7 files changed, 1139 insertions, 0 deletions
diff --git a/Src/installer/shared/scripts/log.nsh b/Src/installer/shared/scripts/log.nsh new file mode 100644 index 00000000..3767ba72 --- /dev/null +++ b/Src/installer/shared/scripts/log.nsh @@ -0,0 +1,18 @@ +!ifndef NULLSOFT_NX_LOG_NSIS_HEADER +!define NULLSOFT_NX_LOG_NSIS_HEADER + +!macro NX_Log __string + System::Call "Kernel32::OutputDebugStringW(t s)" `${__string}` +!macroend + +!define NX_Log "!insertmacro NX_Log" + +!macro NX_DLog __string + !ifdef _DEBUG + ${NX_Log} `${__string}` + !endif +!macroend + +!define NX_DLog "!insertmacro NX_DLog" + +!endif ;NULLSOFT_NX_LOG_NSIS_HEADER
\ No newline at end of file diff --git a/Src/installer/shared/scripts/nx.nsh b/Src/installer/shared/scripts/nx.nsh new file mode 100644 index 00000000..64b4e1d5 --- /dev/null +++ b/Src/installer/shared/scripts/nx.nsh @@ -0,0 +1,11 @@ +!ifndef NULLSOFT_NX_NSIS_HEADER +!define NULLSOFT_NX_NSIS_HEADER + +!include "log.nsh" +!include "syslink.nsh" +!include "system.nsh" +!include "textRect.nsh" +!include "windowRect.nsh" +!include "windowText.nsh" + +!endif ;NULLSOFT_NX_NSIS_HEADER
\ No newline at end of file diff --git a/Src/installer/shared/scripts/syslink.nsh b/Src/installer/shared/scripts/syslink.nsh new file mode 100644 index 00000000..cd38120d --- /dev/null +++ b/Src/installer/shared/scripts/syslink.nsh @@ -0,0 +1,55 @@ +!ifndef NULLSOFT_NX_SYSLINK_NSIS_HEADER +!define NULLSOFT_NX_SYSLINK_NSIS_HEADER + +!define WC_LINK "SysLink" + +!define INVALID_LINK_INDEX -1 +!define MAX_LINKID_TEXT 48 +!define L_MAX_URL_LENGTH 2083 + +!define LWS_TRANSPARENT 0x0001 +!define LWS_IGNORERETURN 0x0002 +!define LWS_NOPREFIX 0x0004 +!define LWS_USEVISUALSTYLE 0x0008 +!define LWS_USECUSTOMTEXT 0x0010 +!define LWS_RIGHT 0x0020 + +!define LIF_ITEMINDEX 0x00000001 +!define LIF_STATE 0x00000002 +!define LIF_ITEMID 0x00000004 +!define LIF_URL 0x00000008 + +!define LIS_FOCUSED 0x00000001 +!define LIS_ENABLED 0x00000002 +!define LIS_VISITED 0x00000004 +!define LIS_HOTTRACK 0x00000008 +!define LIS_DEFAULTCOLORS 0x00000010 + +;typedef struct tagLITEM { +; UINT mask; +; int iLink; +; UINT state; +; UINT stateMask; +; WCHAR szID[MAX_LINKID_TEXT]; +; WCHAR szUrl[L_MAX_URL_LENGTH]; +;} LITEM, *PLITEM; +!define stLITEM '(i, i, i, i, &w${MAX_LINKID_TEXT}, &w${L_MAX_URL_LENGTH}) i' + +;typedef struct tagNMLINK +;{ +; NMHDR hdr; +; LITEM item ; +;} NMLINK, *PNMLINK; +!define stNMLINK '(i, i, i, i, i, i, i, &w${MAX_LINKID_TEXT}, &w${L_MAX_URL_LENGTH}) i' + +; SysLink notifications +; NM_CLICK ;wParam: control ID, lParam: PNMLINK, ret: ignored. + +; LinkWindow messages +!define /math LM_HITTEST ${WM_USER} + 0x300 ;wParam: n/a, lparam: PLHITTESTINFO, ret: BOOL +!define /math LM_GETIDEALHEIGHT ${WM_USER} + 0x301 ;wParam: cxMaxWidth, lparam: n/a, ret: cy +!define /math LM_SETITEM ${WM_USER} + 0x302 ;wParam: n/a, lparam: LITEM*, ret: BOOL +!define /math LM_GETITEM ${WM_USER} + 0x303 ;wParam: n/a, lparam: LITEM*, ret: BOOL +!define LM_GETIDEALSIZE ${LM_GETIDEALHEIGHT} ;wParam: cxMaxWidth, lparam: SIZE*, ret: cy + +!endif ; defined(NULLSOFT_NX_SYSLINK_NSIS_HEADER)
\ No newline at end of file diff --git a/Src/installer/shared/scripts/system.nsh b/Src/installer/shared/scripts/system.nsh new file mode 100644 index 00000000..763e6419 --- /dev/null +++ b/Src/installer/shared/scripts/system.nsh @@ -0,0 +1,431 @@ +!ifndef NULLSOFT_NX_SYSTEM_NSIS_HEADER +!define NULLSOFT_NX_SYSTEM_NSIS_HEADER + +; LONG left; +; LONG top; +; LONG right; +; LONG bottom; +; } RECT, *PRECT; +!ifndef stRECT +!define stRECT '(i, i, i, i) i' +!endif + +;typedef struct tagSIZE +;{ +; LONG cx; +; LONG cy; +;} SIZE, *PSIZE, *LPSIZE; +!ifndef stSIZE +!define stSIZE '(i, i) i' +!endif + +; typedef struct tagBITMAP { +; LONG bmType; +; LONG bmWidth; +; LONG bmHeight; +; LONG bmWidthBytes; +; WORD bmPlanes; +; WORD bmBitsPixel; +; LPVOID bmBits; +; } BITMAP, *PBITMAP; +!ifndef stBITMAP +!define stBITMAP '(i, i, i, i, &i2, &i2, i) i' +!endif + +;typedef struct _ICONINFO { +; BOOL fIcon; +; DWORD xHotspot; +; DWORD yHotspot; +; HBITMAP hbmMask; +; HBITMAP hbmColor; +;} ICONINFO, *PICONINFO; +!ifndef stICONINFO +!define stICONINFO '(i, i, i, i, i) i' +!endif + +;typedef struct tagTEXTMETRICW +;{ +; LONG tmHeight; +; LONG tmAscent; +; LONG tmDescent; +; LONG tmInternalLeading; +; LONG tmExternalLeading; +; LONG tmAveCharWidth; +; LONG tmMaxCharWidth; +; LONG tmWeight; +; LONG tmOverhang; +; LONG tmDigitizedAspectX; +; LONG tmDigitizedAspectY; +; WCHAR tmFirstChar; +; WCHAR tmLastChar; +; WCHAR tmDefaultChar; +; WCHAR tmBreakChar; +; BYTE tmItalic; +; BYTE tmUnderlined; +; BYTE tmStruckOut; +; BYTE tmPitchAndFamily; +; BYTE tmCharSet; +;} TEXTMETRICW +!ifndef stTEXTMETRIC +!define stTEXTMETRIC '(i, i, i, i, i, i, i, i, i, i, i, &i2, &i2, &i2, &i2, &i1, &i1, &i1, &i1, &i1) i' +!endif + +;typedef struct tagLOGFONTW +;{ +; LONG lfHeight; +; LONG lfWidth; +; LONG lfEscapement; +; LONG lfOrientation; +; LONG lfWeight; +; BYTE lfItalic; +; BYTE lfUnderline; +; BYTE lfStrikeOut; +; BYTE lfCharSet; +; BYTE lfOutPrecision; +; BYTE lfClipPrecision; +; BYTE lfQuality; +; BYTE lfPitchAndFamily; +; WCHAR lfFaceName[LF_FACESIZE]; +;} LOGFONTW +!ifndef stLOGFONT +!define stLOGFONT '(i, i, i, i, i, &i1, &i1, &i1, &i1, &i1, &i1, &i1, &i1, &w32) i' +!endif + +;typedef struct tagNMHDR { +; HWND hwndFrom; +; UINT_PTR idFrom; +; UINT code; +;} NMHDR; +!ifndef stNMHDR +!define stNMHDR '(i, i, i) i' +!endif + +!ifndef NM_FIRST +!define NM_FIRST 0 +!endif + +!ifndef NM_CLICK +!define /math NM_CLICK ${NM_FIRST} - 2 +!endif + +!ifndef NM_RETURN +!define /math NM_RETURN ${NM_FIRST} - 4 +!endif + +; BOOL GetWindowRect(HWND hWnd, +; LPRECT lpRect) +!define fnGetWindowRect \ + 'User32::GetWindowRect(i, i) i' + +; int MapWindowPoints(HWND hWndFrom, +; HWND hWndTo, +; LPPOINT lpPoints, +; UINT cPoints) +!define fnMapWindowPoints \ + 'User32::MapWindowPoints(i, i, i, i) i' + + +; SetWindowPos() uFlags +!define SWP_NOSIZE 0x0001 +!define SWP_NOMOVE 0x0002 +!define SWP_NOZORDER 0x0004 +!define SWP_NOREDRAW 0x0008 +!define SWP_NOACTIVATE 0x0010 +!define SWP_FRAMECHANGED 0x0020 +!define SWP_SHOWWINDOW 0x0040 +!define SWP_HIDEWINDOW 0x0080 +!define SWP_NOCOPYBITS 0x0100 +!define SWP_NOOWNERZORDER 0x0200 +!define SWP_NOSENDCHANGING 0x0400 +!define SWP_DRAWFRAME ${SWP_FRAMECHANGED} +!define SWP_NOREPOSITION ${SWP_NOOWNERZORDER} +!define SWP_DEFERERASE 0x2000 +!define SWP_ASYNCWINDOWPOS 0x4000 + +; BOOL SetWindowPos(HWND hWnd, +; HWND hWndInsertAfter, +; int X, +; int Y, +; int cx, +; int cy, +; UINT uFlags) +!define fnSetWindowPos \ + 'User32::SetWindowPos(i, i, i, i, i, i, i) i' + + +; GetAncestor() gaFlags +!define GA_PARENT 1 + +; HWND GetAncestor(HWND hwnd, +; UINT gaFlags) +!define fnGetAncestor \ + 'User32::GetAncestor(i, i) i' + +; BOOL MapDialogRect(HWND hDlg, +; LPRECT lpRect) +!define fnMapDialogRect \ + 'User32::MapDialogRect(i, i) i' + +; GetDCEx() flags +!define DCX_WINDOW 0x00000001 +!define DCX_CACHE 0x00000002 +!define DCX_NORESETATTRS 0x00000004 + +; HDC GetDCEx(HWND hWnd, +; HRGN hrgnClip, +; DWORD flags) +!define fnGetDCEx \ + 'User32::GetDCEx(i, i, i ) i' + +; DrawText uFormat +!define DT_CALCRECT 0x00000400 +!define DT_LEFT 0x00000000 +!define DT_TOP 0x00000000 +!define DT_EDITCONTROL 0x00002000 +!define DT_NOPREFIX 0x00000800 +!define DT_SINGLELINE 0x00000020 +!define DT_WORDBREAK 0x00000010 + +; int DrawText(HDC hDC, +; LPCTSTR lpchText, +; int nCount, +; LPRECT lpRect, +; UINT uFormat) +!define fnDrawText \ + 'User32::DrawText(i, t, i, i, i) i' + +; int ReleaseDC(HWND hWnd, +; HDC hDC) +!define fnReleaseDC \ + 'User32::ReleaseDC(i, i) i' + +; GetWindowLong()/SetWindowLong() nIndex +!define GWL_WNDPROC -4 +!define GWL_HINSTANCE -6 +!define GWL_HWNDPARENT -8 +!ifndef GWL_STYLE ; defined in nsDialogs +!define GWL_STYLE -16 +!endif +!ifndef GWL_EXSTYLE ; defined in nsDialogs +!define GWL_EXSTYLE -16 +!endif +!define GWL_USERDATA -21 +!define GWL_ID -12 + +; LONG GetWindowLong(HWND hWnd, +; int nIndex) +!define fnGetWindowLong \ + 'User32::GetWindowLong(i, i) i' + +; LONG SetWindowLong(HWND hWnd, +; int nIndex +; LONG dwNewLong) +!define fnSetWindowLong \ + 'User32::SetWindowLong(i, i, i) i' + +; int GetWindowText(HWND hWnd, +; LPTSTR lpString, +; int nMaxCount) +!define fnGetWindowText \ + 'User32::GetWindowText(i, t, i) i' + +; BOOL SetWindowText(HWND hWnd, +; LPCTSTR lpString) +!define fnSetWindowText \ + 'User32::SetWindowText(i, t) i' + +;HGDIOBJ SelectObject(HDC hdc, +; HGDIOBJ hgdiobj) +!define fnSelectObject \ + 'GDI32::SelectObject(i, i) i' + +;BOOL GetTextMetrics(HDC hdc, +; LPTEXTMETRIC lptm) +!define fnGetTextMetrics \ + 'GDI32::GetTextMetricsW(i, i) i' + +; GetSystemMetrics() +!define SM_CXSCREEN 0 +!define SM_CYSCREEN 1 +!define SM_CXVSCROLL 2 +!define SM_CYHSCROLL 3 +!define SM_CYCAPTION 4 +!define SM_CXBORDER 5 +!define SM_CYBORDER 6 +!define SM_CXDLGFRAME 7 +!define SM_CYDLGFRAME 8 +!define SM_CYVTHUMB 9 +!define SM_CXHTHUMB 10 +!define SM_CXICON 11 +!define SM_CYICON 12 +!define SM_CXCURSOR 13 +!define SM_CYCURSOR 14 +!define SM_CYMENU 15 +!define SM_CXFULLSCREEN 16 +!define SM_CYFULLSCREEN 17 +!define SM_CYKANJIWINDOW 18 +!define SM_MOUSEPRESENT 19 +!define SM_CYVSCROLL 20 +!define SM_CXHSCROLL 21 +!define SM_DEBUG 22 +!define SM_SWAPBUTTON 23 +!define SM_RESERVED1 24 +!define SM_RESERVED2 25 +!define SM_RESERVED3 26 +!define SM_RESERVED4 27 +!define SM_CXMIN 28 +!define SM_CYMIN 29 +!define SM_CXSIZE 30 +!define SM_CYSIZE 31 +!define SM_CXFRAME 32 +!define SM_CYFRAME 33 +!define SM_CXMINTRACK 34 +!define SM_CYMINTRACK 35 +!define SM_CXDOUBLECLK 36 +!define SM_CYDOUBLECLK 37 +!define SM_CXICONSPACING 38 +!define SM_CYICONSPACING 39 +!define SM_MENUDROPALIGNMENT 40 +!define SM_PENWINDOWS 41 +!define SM_DBCSENABLED 42 +!define SM_CMOUSEBUTTONS 43 +!define SM_CXFIXEDFRAME ${SM_CXDLGFRAME} +!define SM_CYFIXEDFRAME ${SM_CYDLGFRAME} +!define SM_CXSIZEFRAME ${SM_CXFRAME} +!define SM_CYSIZEFRAME ${SM_CYFRAME} +!define SM_SECURE 44 +!define SM_CXEDGE 45 +!define SM_CYEDGE 46 +!define SM_CXMINSPACING 47 +!define SM_CYMINSPACING 48 +!define SM_CXSMICON 49 +!define SM_CYSMICON 50 +!define SM_CYSMCAPTION 51 +!define SM_CXSMSIZE 52 +!define SM_CYSMSIZE 53 +!define SM_CXMENUSIZE 54 +!define SM_CYMENUSIZE 55 +!define SM_ARRANGE 56 +!define SM_CXMINIMIZED 57 +!define SM_CYMINIMIZED 58 +!define SM_CXMAXTRACK 59 +!define SM_CYMAXTRACK 60 +!define SM_CXMAXIMIZED 61 +!define SM_CYMAXIMIZED 62 +!define SM_NETWORK 63 +!define SM_CLEANBOOT 67 +!define SM_CXDRAG 68 +!define SM_CYDRAG 69 +!define SM_SHOWSOUNDS 70 +!define SM_CXMENUCHECK 71 +!define SM_CYMENUCHECK 72 +!define SM_SLOWMACHINE 73 +!define SM_MIDEASTENABLED 74 +!define SM_MOUSEWHEELPRESENT 75 +!define SM_XVIRTUALSCREEN 76 +!define SM_YVIRTUALSCREEN 77 +!define SM_CXVIRTUALSCREEN 78 +!define SM_CYVIRTUALSCREEN 79 +!define SM_CMONITORS 80 +!define SM_SAMEDISPLAYFORMAT 81 +!define SM_IMMENABLED 82 +!define SM_CXFOCUSBORDER 83 +;!define SM_TABLETPC 86 +;!define SM_MEDIACENTER 87 +;!define SM_STARTER 88 +;!define SM_SERVERR2 89 +!define SM_MOUSEHORIZONTALWHEELPRESENT 91 +!define SM_CXPADDEDBORDER 92 +!define SM_DIGITIZER 94 +!define SM_MAXIMUMTOUCHES 95 +!define SM_REMOTESESSION 0x1000 +!define SM_SHUTTINGDOWN 0x2000 +!define SM_REMOTECONTROL 0x2001 +!define SM_CARETBLINKINGENABLED 0x2002 +!define SM_CONVERTIBLESLATEMODE 0x2003 +!define SM_SYSTEMDOCKED 0x2004 + +;int GetSystemMetrics(int nIndex) +!define fnGetSystemMetrics \ + 'User32::GetSystemMetrics(i) i' + +; Image types +!ifndef IMAGE_BITMAP +!define IMAGE_BITMAP 0 +!endif +!ifndef IMAGE_ICON +!define IMAGE_ICON 1 +!endif +!ifndef IMAGE_CURSOR +!define IMAGE_CURSOR 2 +!endif +!ifndef IMAGE_ENHMETAFILE +!define IMAGE_ENHMETAFILE 3 +!endif + +; Load Image Flags +!ifndef LR_DEFAULTCOLOR +!define LR_DEFAULTCOLOR 0x00000000 +!define LR_MONOCHROME 0x00000001 +!define LR_COLOR 0x00000002 +!define LR_COPYRETURNORG 0x00000004 +!define LR_COPYDELETEORG 0x00000008 +!define LR_LOADFROMFILE 0x00000010 +!define LR_LOADTRANSPARENT 0x00000020 +!define LR_DEFAULTSIZE 0x00000040 +!define LR_VGACOLOR 0x00000080 +!define LR_LOADMAP3DCOLORS 0x00001000 +!define LR_CREATEDIBSECTION 0x00002000 +!define LR_COPYFROMRESOURCE 0x00004000 +!define LR_SHARED 0x00008000 +!endif ; defined (LR_DEFAULTCOLOR) + +; HANDLE LoadImage(HINSTANCE hinst, +; LPCTSTR lpszName, +; UINT uType, +; int cxDesired, +; int cyDesired, +; UINT fuLoad) +!define fnLoadImage \ + 'User32::LoadImage(i, t, i, i, i, i) i' + +;BOOL DeleteObject(HGDIOBJ hObject); +!define fnDeleteObject \ + 'GDI32::DeleteObject(i) i' + +;int GetObject(HGDIOBJ hgdiobj, +; int cbBuffer, +; LPVOID lpvObject); +!define fnGetObject \ + 'GDI32::GetObject(i, i, i) i' + +;BOOL GetIconInfo(HICON hIcon, +; PICONINFO piconinfo) +!define fnGetIconInfo \ + 'User32::GetIconInfo(i, i) i' + +;BOOL DestroyIcon(HICON hIcon) +!define fnDestroyIcon \ + 'User32::DestroyIcon(i) i' + +;BOOL DestroyWindow(HWND hWnd) +!define fnDestroyWindow \ + 'User32::DestroyWindow(i) i' + +;HWND WINAPI CreateWindowEx(DWORD dwExStyle, +; LPCTSTR lpClassName, +; LPCTSTR lpWindowName, +; DWORD dwStyle, +; int x, +; int y, +; int nWidth, +; int nHeight, +; HWND hWndParent, +; HMENU hMenu, +; HINSTANCE hInstance, +; LPVOID lpParam) +!define fnCreateWindowEx \ + 'User32::CreateWindowEx(i, t, t, i, i, i, i, i, i, i, i, i) i' + +!endif ; defined(NULLSOFT_NX_SYSTEM_NSIS_HEADER) + diff --git a/Src/installer/shared/scripts/textRect.nsh b/Src/installer/shared/scripts/textRect.nsh new file mode 100644 index 00000000..fd23eb84 --- /dev/null +++ b/Src/installer/shared/scripts/textRect.nsh @@ -0,0 +1,186 @@ +!ifndef NULLSOFT_NX_TEXT_RECT_NSIS_HEADER +!define NULLSOFT_NX_TEXT_RECT_NSIS_HEADER + +!include "util.nsh" +!include "logicLib.nsh" +!include "system.nsh" + +!macro NX_CalculateTextRectInternal + !define hwnd_ $R0 + !define text_ $R1 + !define style_ $R2 + !define maxWidth_ $R3 + !define hdc_ $R4 + !define font_ $R5 + !define previousFont_ $R6 + !define width_ $R7 + !define height_ $R8 + !define averageCharWidth_ $R9 + + Exch ${hwnd_} + Exch 1 + Exch ${text_} + Exch 2 + Exch ${style_} + Exch 3 + Exch ${maxWidth_} + + Push ${hdc_} + Push ${font_} + Push ${previousFont_} + Push ${width_} + Push ${height_} + Push ${averageCharWidth_} + + StrCpy ${width_} 0 + StrCpy ${height_} 0 + StrCpy ${averageCharWidth_} 0 + + System::Call "${fnGetDCEx}(${hwnd_}, 0, ${DCX_CACHE}|${DCX_NORESETATTRS}).s" + Pop ${hdc_} + + SendMessage ${hwnd_} ${WM_GETFONT} 0 0 ${font_} + System::Call "${fnSelectObject}(${hdc_}, ${font_}).s" + Pop ${previousFont_} + + ; Get Text Metrics (in case of empty line) + Push $0 + Push $1 + System::Call "*${stTEXTMETRIC} .r1" + System::Call "${fnGetTextMetrics}(${hdc_}, $1).r0" + ${If} $0 != 0 + Push $2 + System::Call "*$1${stTEXTMETRIC}(.r0, ., ., ., ., .r2, _)" + StrCpy ${height_} $0 + StrCpy ${averageCharWidth_} $2 + Pop $2 + ${EndIf} + + System::Free $1 + Pop $1 + Pop $0 + + ; Calculate Text Rect + Push $0 + StrLen $0 ${text_} + ${If} $0 != 0 + Push $1 ; rect + Push $2 ; text flags + + ; build text flags + StrCpy $2 ${DT_CALCRECT}|${DT_LEFT}|${DT_TOP} + IntOp $2 $2 | ${style_} + + System::Call "*${stRECT}(0, 0, ${maxWidth_}, $0) .r1" + System::Call "${fnDrawText}(${hdc_}, '${text_}', -1, $1, $2).r0" + ${if} $0 != 0 + Push $3 + Push $4 + Push $5 + + System::Call "*$1${stRECT}(.r2, .r3, .r4, .r5)" + IntOp ${width_} $4 - $2 + IntOp $3 $5 - $3 + ${if} $3 > ${height_} + StrCpy ${height_} $3 + ${EndIf} + + IntOp $4 ${averageCharWidth_} / 2 + IntOp ${width_} ${width_} + $4 + + Pop $5 + Pop $4 + Pop $3 + ${EndIf} + + System::Free $1 + Pop $2 ; text flags + Pop $1 ; rect + ${EndIf} + Pop $0 + + ${If} ${previousFont_} != 0 + System::Call "${fnSelectObject}(${hdc_}, ${previousFont_})" + ${EndIf} + + System::Call "${fnReleaseDC}(${hwnd_}, ${hdc_})" + + StrCpy ${style_} ${width_} + StrCpy ${text_} ${height_} + + Pop ${averageCharWidth_} + Pop ${height_} + Pop ${width_} + Pop ${previousFont_} + Pop ${font_} + Pop ${hdc_} + Pop ${maxWidth_} + Pop ${hwnd_} + Exch ${text_} + Exch + Exch ${style_} + + !undef hwnd_ + !undef text_ + !undef style_ + !undef maxWidth_ + !undef hdc_ + !undef font_ + !undef previousFont_ + !undef width_ + !undef height_ + !undef averageCharWidth_ +!macroend + +!macro NX_CalculateTextRect __hwnd __text __style __maxWidth __width __height + Push "${__maxWidth}" + Push "${__style}" + Push "${__text}" + Push "${__hwnd}" + ${CallArtificialFunction} NX_CalculateTextRectInternal + Pop "${__width}" + Pop "${__height}" +!macroend + +!define NX_CalculateTextRect `!insertmacro NX_CalculateTextRect` + +!macro NX_GetLabelIdealSize __hwnd __maxWidth __width __height + Push "${__maxWidth}" + + System::Call "${fnGetWindowLong}(${__hwnd}, ${GWL_STYLE}).s" + Exch $0 + Push $1 + Push $2 + + StrCpy $2 0 + IntOp $1 $0 & ${SS_EDITCONTROL} + ${If} $1 != 0 + IntOp $2 $2 | ${DT_EDITCONTROL} + ${EndIf} + + IntOp $1 $0 & ${SS_NOPREFIX} + ${If} $1 != 0 + IntOp $2 $2 | ${DT_NOPREFIX} + ${EndIf} + + IntOp $1 $0 & ${SS_SIMPLE} + ${If} $1 != 0 + IntOp $2 $2 | ${DT_SINGLELINE} + ${Else} + IntOp $2 $2 | ${DT_WORDBREAK} + ${EndIf} + + StrCpy $0 $2 + Pop $2 + Pop $1 + Exch $0 + + System::Call "${fnGetWindowText}(${__hwnd}, .s, ${NSIS_MAX_STRLEN})" + Push "${__hwnd}" + ${CallArtificialFunction} NX_CalculateTextRectInternal + Pop "${__width}" + Pop "${__height}" +!macroend +!define NX_GetLabelIdealSize `!insertmacro NX_GetLabelIdealSize` + +!endif ; defined(NULLSOFT_NX_TEXT_RECT_NSIS_HEADER)
\ No newline at end of file diff --git a/Src/installer/shared/scripts/windowRect.nsh b/Src/installer/shared/scripts/windowRect.nsh new file mode 100644 index 00000000..58e1f067 --- /dev/null +++ b/Src/installer/shared/scripts/windowRect.nsh @@ -0,0 +1,401 @@ +!ifndef NULLSOFT_NX_WINDOW_RECT_NSIS_HEADER +!define NULLSOFT_NX_WINDOW_RECT_NSIS_HEADER + +!include "util.nsh" +!include "logicLib.nsh" +!include "system.nsh" + +!macro NX_GetWindowRectInternal + Exch $0 + + Push $2 + Push $3 + Push $4 + Push $5 + + Push $1 + System::Call "*${stRECT} .r1" + + System::Call "${fnGetWindowRect}($0, $1)" + System::Call "*$1${stRECT} (.r2, .r3, .r4, .r5)" + System::Free $1 + Pop $1 + + Exch 4 + Pop $0 + + Exch $5 + Exch 3 + Exch $2 + Exch + Exch $4 + Exch 2 + Exch $3 + Exch +!macroend + +!macro NX_GetWindowRect __hwnd __left __top __right __bottom + Push "${__hwnd}" + ${CallArtificialFunction} NX_GetWindowRectInternal + Pop "${__left}" + Pop "${__top}" + Pop "${__right}" + Pop "${__bottom}" +!macroend + +!define NX_GetWindowRect `!insertmacro NX_GetWindowRect` + +!macro NX_GetMappedWindowRectInternal + Exch $0 + Exch + Exch $2 + + Push $3 + Push $4 + Push $5 + + Push $1 + System::Call "*${stRECT} .r1" + + System::Call "${fnGetWindowRect}(r0, r1)" + System::Call '${fnMapWindowPoints}(0, r2, r1, 2)' + System::Call "*$1${stRECT} (.r5, .r2, .r3, .r4)" + System::Free $1 + Pop $1 + + Exch 4 + Pop $0 + + Exch $4 + Exch 3 + Exch $5 + Exch + Exch $3 + Exch 2 + Exch $2 + Exch +!macroend + +!macro NX_GetMappedWindowRect __hwnd __hwndParent __left __top __right __bottom + Push "${__hwndParent}" + Push "${__hwnd}" + ${CallArtificialFunction} NX_GetMappedWindowRectInternal + Pop "${__left}" + Pop "${__top}" + Pop "${__right}" + Pop "${__bottom}" +!macroend + +!define NX_GetMappedWindowRect `!insertmacro NX_GetMappedWindowRect` + +!macro NX_GetWindowSizeInternal + Exch $0 + + Push $2 + Push $3 + Push $4 + Push $5 + + Push $1 + System::Call "*${stRECT} .r1" + + System::Call "${fnGetWindowRect} ($0, $1)" + System::Call "*$1${stRECT} (.r2, .r3, .r4, .r5)" + System::Free $1 + Pop $1 + + IntOp $0 $4 - $2 + IntOp $2 $5 - $3 + + Pop $5 + Pop $4 + Pop $3 + Exch $2 + Exch + Exch $0 +!macroend + +!macro NX_GetWindowSize __hwnd __width __height + Push "${__hwnd}" + ${CallArtificialFunction} NX_GetWindowSizeInternal + Pop "${__width}" + Pop "${__height}" +!macroend + +!define NX_GetWindowSize `!insertmacro NX_GetWindowSize` + +!macro NX_GetWindowPosInternal + Exch $0 + + Push $2 + Push $3 + Push $4 + Push $5 + + Push $1 + System::Call "*${stRECT} .r1" + + System::Call "${fnGetWindowRect}($0, $1)" + System::Call "*$1${stRECT} (.r2, .r3, .r4, .r5)" + System::Free $1 + Pop $1 + + StrCpy $0 $3 + + Pop $5 + Pop $4 + Pop $3 + Exch $2 + Exch + Exch $0 + Exch +!macroend + +!macro NX_GetWindowPos __hwnd __left __top + Push "${__hwnd}" + ${CallArtificialFunction} NX_GetWindowPosInternal + Pop "${__left}" + Pop "${__top}" +!macroend +!define NX_GetWindowPos `!insertmacro NX_GetWindowPos` + +!macro NX_GetMappedWindowPosInternal + Exch $0 + Exch + Exch $2 + + Push $3 + Push $4 + Push $5 + + Push $1 + System::Call "*${stRECT} .r1" + + System::Call "${fnGetWindowRect}($0, $1)" + System::Call "${fnMapWindowPoints}(0, $2, r1, 1)" + System::Call "*$1${stRECT} (.r2, .r3, .r4, .r5)" + System::Free $1 + Pop $1 + + StrCpy $0 $3 + + Pop $5 + Pop $4 + Pop $3 + Exch $2 + Exch + Exch $0 + Exch +!macroend + +!macro NX_GetMappedWindowPos __hwnd __hwndParent __left __top + Push "${__hwndParent}" + Push "${__hwnd}" + ${CallArtificialFunction} NX_GetMappedWindowPosInternal + Pop "${__left}" + Pop "${__top}" +!macroend + +!define NX_GetMappedWindowPos `!insertmacro NX_GetMappedWindowPos` + +!macro NX_SetWindowPos __hwnd __left __top + System::Call "${fnSetWindowPos} \ + (${__hwnd}, 0, ${__left}, ${__top}, 0, 0, \ + ${SWP_NOACTIVATE}|${SWP_NOZORDER}|${SWP_NOSIZE})" +!macroend + +!define NX_SetWindowPos `!insertmacro NX_SetWindowPos` + +!macro NX_SetWindowSize __hwnd __width __height + System::Call "${fnSetWindowPos} \ + (${__hwnd}, 0, 0, 0, ${__width}, ${__height}, \ + ${SWP_NOACTIVATE}|${SWP_NOZORDER}|${SWP_NOMOVE})" +!macroend + +!define NX_SetWindowSize `!insertmacro NX_SetWindowSize` + +!macro NX_SetWindowPosAndSize __hwnd __left __top __width __height + System::Call "User32::SetWindowPos(i, i, i, i, i, i, i) b \ + (${__hwnd}, 0, ${__left}, ${__top}, ${__width}, ${__height},\ + ${SWP_NOACTIVATE}|${SWP_NOZORDER})" +!macroend + +!define NX_SetWindowPosAndSize `!insertmacro NX_SetWindowPosAndSize` + +!macro NX_SetWindowOrder __hwnd __insertAfterWindow + System::Call "${fnSetWindowPos} \ + (${__hwnd}, ${__insertAfterWindow}, 0, 0, 0, 0, \ + ${SWP_NOACTIVATE}|${SWP_NOSIZE}|${SWP_NOMOVE})" +!macroend + +!define NX_SetWindowOrder `!insertmacro NX_SetWindowOrder` + +!macro NX_OffsetWindowPosInternal + !define hwnd_ $R0 + !define offsetX_ $R1 + !define offsetY_ $R2 + + Exch ${offsetY_} + Exch + Exch ${offsetX_} + Exch 2 + Exch ${hwnd_} + + Push $0 + Push $1 + Push $2 + Push $3 + Push $4 + + System::Call "*${stRECT} .r4" + System::Call "${fnGetWindowRect} (${hwnd_}, r4)" + System::Call "${fnGetAncestor} (${hwnd_}, ${GA_PARENT}).r0" + ${If} $R0 != 0 + System::Call "${fnMapWindowPoints} (0, r0, r4, 2)" + ${EndIf} + System::Call "*$4${stRECT} (.r0, .r1, .r2, .r3)" + System::Free $4 + + IntOp $0 $0 + ${offsetX_} + IntOp $1 $1 + ${offsetY_} + + System::Call "${fnSetWindowPos} \ + (${hwnd_}, 0, $0, $1, 0, 0, \ + ${SWP_NOACTIVATE}|${SWP_NOZORDER}|${SWP_NOSIZE})" + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 + + Pop ${hwnd_} + Pop ${offsetY_} + Pop ${offsetX_} + + !undef hwnd_ + !undef offsetX_ + !undef offsetY_ +!macroend + +!macro NX_OffsetWindowPos __hwnd __offset_x __offset_y + Push "${__hwnd}" + Push "${__offset_x}" + Push "${__offset_y}" + ${CallArtificialFunction} NX_OffsetWindowPosInternal +!macroend + +!define NX_OffsetWindowPos "!insertmacro 'NX_OffsetWindowPos'" + +!macro NX_IncreaseWindowSizeInternal + !define hwnd_ $R0 + !define deltaCX_ $R1 + !define deltaCY_ $R2 + + Exch ${deltaCY_} + Exch + Exch ${deltaCX_} + Exch 2 + Exch ${hwnd_} + + Push $0 + Push $1 + Push $2 + Push $3 + Push $4 + + System::Call "*${stRECT} .r4" + System::Call "${fnGetWindowRect}(${hwnd_}, r4)" + System::Call "*$4${stRECT} (.r0, .r1, .r2, .r3)" + System::Free $4 + + IntOp $0 $2 - $0 + IntOp $1 $3 - $1 + IntOp $0 $0 + ${deltaCX_} + IntOp $1 $1 + ${deltaCY_} + + System::Call "${fnSetWindowPos}\ + (${__hwnd}, 0, 0, 0, $0, $1, \ + ${SWP_NOACTIVATE}|${SWP_NOZORDER}|${SWP_NOMOVE})" + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 + + Pop ${hwnd_} + Pop ${deltaCY_} + Pop ${deltaCX_} + + !undef hwnd_ + !undef deltaCX_ + !undef deltaCY_ +!macroend + +!macro NX_IncreaseWindowSize __hwnd __delta_cx __delta_cy + Push "${__hwnd}" + Push "${__delta_cx}" + Push "${__delta_cy}" + ${CallArtificialFunction} NX_IncreaseWindowSizeInternal +!macroend + +!define NX_IncreaseWindowSize "!insertmacro 'NX_IncreaseWindowSize'" + +!macro NX_ConvertHorzDLUInternal + Exch $1 ; dlu + Exch + Exch $0 ; hwnd + Push $2 + + System::Call "*${stRECT}($1, 0, 0, 0) .r2" + System::Call "${fnMapDialogRect}($0, $2).s" + Pop $1 + ${If} $1 != 0 + System::Call "*$2${stRECT} (.r1, _)" + ${EndIf} + + System::Free $2 + + Pop $2 + Pop $0 + Exch $1 +!macroend + +!macro NX_ConvertHorzDLU __hwnd __dlu __px + Push "${__hwnd}" + Push "${__dlu}" + ${CallArtificialFunction} NX_ConvertHorzDLUInternal + Pop "${__px}" +!macroend + +!define NX_ConvertHorzDLU `!insertmacro NX_ConvertHorzDLU` + +!macro NX_ConvertVertDLUInternal + Exch $1 ; dlu + Exch + Exch $0 ; hwnd + Push $2 + + System::Call "*${stRECT}(0, $1, 0, 0) .r2" + System::Call "${fnMapDialogRect}($0, $2).s" + Pop $1 + ${If} $1 != 0 + System::Call "*$2${stRECT} (., .r1, _)" + ${EndIf} + + System::Free $2 + + Pop $2 + Pop $0 + Exch $1 +!macroend + +!macro NX_ConvertVertDLU __hwnd __dlu __px + Push "${__hwnd}" + Push "${__dlu}" + ${CallArtificialFunction} NX_ConvertVertDLUInternal + Pop "${__px}" +!macroend + +!define NX_ConvertVertDLU `!insertmacro NX_ConvertVertDLU` + +!endif ; defined(NULLSOFT_NX_WINDOW_RECT_NSIS_HEADER)
\ No newline at end of file diff --git a/Src/installer/shared/scripts/windowText.nsh b/Src/installer/shared/scripts/windowText.nsh new file mode 100644 index 00000000..aa9f3128 --- /dev/null +++ b/Src/installer/shared/scripts/windowText.nsh @@ -0,0 +1,37 @@ +!ifndef NULLSOFT_NX_WINDOW_TEXT_NSIS_HEADER +!define NULLSOFT_NX_WINDOW_TEXT_NSIS_HEADER + +!include "system.nsh" + +!macro NX_SetWindowText __hwnd __text + System::Call "${fnSetWindowText}(${__hwnd}, '${__text}')" +!macroend + +!define NX_SetWindowText "!insertmacro 'NX_SetWindowText'" + +!macro NX_GetWindowText __hwnd __textOut + System::Call "${fnGetWindowText}(${__hwnd}, ${__textOut}, ${NSIS_MAX_STRLEN})" +!macroend + +!define NX_GetWindowText "!insertmacro 'NX_GetWindowText'" + +!macro NX_AppendWindowText __hwnd __text + Push ${__hwnd} + Push ${__text} + Exch $R0 ; text + Exch + Exch $R1 ; hwnd + + Push $0 + StrCpy $0 "" + ${NX_GetWindowText} $R1 $0 + StrCpy $0 "$0$R0" + ${NX_SetWindowText} $R1 $0 + Pop $0 + Pop $R1 + Pop $R0 +!macroend + +!define NX_AppendWindowText "!insertmacro 'NX_AppendWindowText'" + +!endif ;NULLSOFT_NX_WINDOW_TEXT_NSIS_HEADER
\ No newline at end of file |