Contrib/ExperienceUI/Langpage.nsi
changeset 0 d5ce4c64ef88
child 11 2cb95c9bb633
equal deleted inserted replaced
-1:000000000000 0:d5ce4c64ef88
       
     1 !VERBOSE 1
       
     2 !define XPUI_VERBOSE 1
       
     3 !define XPUI_SILENT
       
     4 !define XPUI_INSTALLOPTIONS_MAXFIELD 4
       
     5 !ifndef XPUI_LANGINI_LIST_B
       
     6   !error "This script should only be compiled through the ExperienceUI's internal multi-language support system!"
       
     7 !endif
       
     8 
       
     9 SetCompress off
       
    10 
       
    11 Name "Select Language"
       
    12 Caption " "
       
    13 OutFile "${NSISDIR}\Contrib\ExperienceUI\LangDialog.exe"
       
    14 
       
    15 MiscButtonText "" "" "" OK
       
    16 !define XPUI_DISABLEBG
       
    17 !define XPUI_ABORTPAGE_TEXT "The wizard was interrupted before the program could be installed.\r\n\r\nYour system has not been modified.  To install the program at a later time, please run this setup wizard again.\r\n\r\n\r\n\r\n\r\nPlease click $\"$(XPUI_BUTTONTEXT_CLOSE)$\" to exit the NSIS installation wizard."
       
    18 !define XPUI_ABORTPAGE_SUBTITLE "Setup did not complete successfully."
       
    19 !define XPUI_ABORTPAGE_CAPTION " "
       
    20 !include XPUI.nsh
       
    21 !VERBOSE 1
       
    22 
       
    23 Page custom LangSelect LangSelectFin ""
       
    24 ;Page custom CancelConfirm CancelConfirmFin ""
       
    25 !insertmacro XPUI_PAGE_ABORT
       
    26 
       
    27 Function LangSelect
       
    28 Call GetParameters
       
    29 Pop $0
       
    30 StrCmp $0 "/CancelDialog" 0 +2
       
    31 Abort
       
    32 SetOutPath $PLUGINSDIR
       
    33 File "${NSISDIR}\Contrib\ExperienceUI\INI\LangDlg.ini"
       
    34 WriteINIStr "$PLUGINSDIR\LangDlg.ini" "Field 1" ListItems "${XPUI_LANGINI_LIST_B}"
       
    35 StrCpy $XPUI_TEMP1 "${XPUI_LANGINI_LIST_B}"
       
    36 StrCpy $XPUI_HWND 0
       
    37 PipeLoop:
       
    38 StrCpy $XPUI_TEMP2 $XPUI_TEMP1 1 $XPUI_HWND
       
    39 StrCmp $XPUI_TEMP2 | foundPipe
       
    40 IntOp $XPUI_HWND $XPUI_HWND + 1
       
    41 Goto PipeLoop
       
    42 FoundPipe:
       
    43 StrCpy $XPUI_TEMP1 $XPUI_TEMP1 $XPUI_HWND
       
    44 WriteINIStr "$PLUGINSDIR\LangDlg.ini" "Field 1" State "$XPUI_TEMP1"
       
    45 InstallOptions::initDialog /NOUNLOAD $PLUGINSDIR\LangDlg.ini
       
    46 Pop $XPUI_HWND
       
    47 !insertmacro XPUI_CONTROL_SKIN $XPUI_HWND
       
    48 GetDlgItem $XPUI_TEMP1 $XPUI_HWND 1200
       
    49 !insertmacro XPUI_CONTROL_SKIN $XPUI_TEMP1
       
    50 GetDlgItem $XPUI_TEMP1 $XPUI_HWND 1201
       
    51 !insertmacro XPUI_CONTROL_SKIN $XPUI_TEMP1
       
    52 CreateFont $XPUI_TEMP2 "Tahoma" 8 700
       
    53 SendMessage $XPUI_TEMP1 0x30 $XPUI_TEMP2 0
       
    54 GetDlgItem $XPUI_TEMP1 $XPUI_HWND 1202
       
    55 !insertmacro XPUI_CONTROL_SKIN $XPUI_TEMP1
       
    56 CreateFont $XPUI_TEMP2 "Tahoma" 8 350
       
    57 SendMessage $XPUI_TEMP1 0x30 $XPUI_TEMP2 0
       
    58 !insertmacro XPUI_HEADER_TEXT "Select Language" "Please select which language to use in the installer."
       
    59 InstallOptions::show
       
    60 FunctionEnd
       
    61 
       
    62 Function LangSelectFin
       
    63 
       
    64 Call GetParameters
       
    65 Pop $0
       
    66 StrCmp $0 "/CancelDialog" 0 +2
       
    67 Return
       
    68 
       
    69 ; Reset everything
       
    70 StrCpy $XPUI_HWND 0
       
    71 StrCpy $XPUI_TEMP1 0
       
    72 StrCpy $XPUI_TEMP2 0
       
    73 
       
    74 ReadINIStr $XPUI_NOABORTWARNING $PLUGINSDIR\LangDlg.ini "Field 1" State
       
    75 !include `${CHECKLIST}`
       
    76 /*
       
    77 
       
    78 ; First, find out if user selected first language...
       
    79 StrCpy $XPUI_TEMP1 "${XPUI_LANGINI_LIST_B}"
       
    80 StrCpy $XPUI_HWND 0
       
    81 PipeLoop1:
       
    82 StrCpy $XPUI_TEMP2 $XPUI_TEMP1 1 $XPUI_HWND
       
    83 StrCmp $XPUI_TEMP2 | foundPipe1
       
    84 IntOp $XPUI_HWND $XPUI_HWND + 1
       
    85 Goto PipeLoop1
       
    86 FoundPipe1:
       
    87 StrCpy $XPUI_TEMP1 $XPUI_TEMP1 $XPUI_HWND
       
    88 ReadINIStr $XPUI_NOABORTWARNING $PLUGINSDIR\LangDlg.ini "Field 1" State
       
    89 StrCmp $XPUI_TEMP1 $NOABORTWARNING "" PipeLoop2
       
    90 StrCpy $XPUI_TEMP1 0
       
    91 Goto Done
       
    92 
       
    93 PipeLoop2:
       
    94 
       
    95 ; Reset everything
       
    96 StrCpy $XPUI_HWND 0
       
    97 StrCpy $XPUI_TEMP1 0
       
    98 StrCpy $XPUI_TEMP2 0
       
    99 
       
   100 PipeLoop:
       
   101 StrCpy $XPUI_TEMP2 "${XPUI_LANGINI_LIST_B}" 1 $XPUI_HWND
       
   102 StrCmp $XPUI_TEMP2 "" Done
       
   103 StrCmp $XPUI_TEMP2 | foundPipe
       
   104 IntOp $XPUI_HWND $XPUI_HWND + 1
       
   105 Goto PipeLoop
       
   106 FoundPipe:
       
   107 IntOp $XPUI_TEMP1 $XPUI_TEMP1 + 1
       
   108 IntOp $XPUI_HWND $XPUI_HWND + 1
       
   109 ReadINIStr $XPUI_NOABORTWARNING $PLUGINSDIR\LangDlg.ini "Field 1" State
       
   110 StrLen $XPUI_TEMP2 "$NOABORTWARNING"
       
   111 StrCpy $XPUI_TEMP2 "${XPUI_LANGINI_LIST_B}" $XPUI_TEMP2 $XPUI_HWND
       
   112 StrCmp $XPUI_TEMP2 $NOABORTWARNING Done PipeLoop
       
   113 Goto PipeLoop
       
   114 Done:
       
   115 IntOp $XPUI_TEMP1 $XPUI_TEMP1 * 4
       
   116 StrCpy $0 "${XPUI_LANGIDLIST_LIST_B}" 4 $XPUI_TEMP1
       
   117 SetErrorLevel $0       */
       
   118 MessageBox MB_OK|MB_ICONEXCLAMATION "The language page system could not detect the language ID.  The installer will use the first language inserted in the script file."
       
   119 SetErrorLevel 0
       
   120 FunctionEnd
       
   121 
       
   122 /*
       
   123 Function CancelConfirm
       
   124 Call GetParameters
       
   125 Pop $0
       
   126 StrCmp $0 "/CancelDialog" +2
       
   127 Abort
       
   128 SetOutPath $PLUGINSDIR
       
   129 File "${NSISDIR}\Contrib\ExperienceUI\Ini\CancelConfirm.ini"
       
   130 !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "CancelConfirm.ini"
       
   131 FunctionEnd
       
   132 
       
   133 Function CancelConfirmFin
       
   134   ReadINIStr $0 $PLUGINSDIR\CancelConfirm.ini "Field 2" State
       
   135   StrCmp $0 1 "" ResumeOnLogin
       
   136   SetErrorLevel 5
       
   137   Return
       
   138   ResumeOnLogin:
       
   139   ReadINIStr $0 $PLUGINSDIR\CancelConfirm.ini "Field 3" State
       
   140   StrCmp $0 1 "" Resume
       
   141   SetErrorLevel 6
       
   142   Return
       
   143   Resume:
       
   144   SetErrorLevel 7
       
   145 FunctionEnd */
       
   146 
       
   147 Function .onUserAbort
       
   148 StrCmp $XPUI_ABORTED 1 Done
       
   149 MessageBox MB_YESNO|MB_ICONQUESTION "You are about to quit setup.$\n$\nIf you quit now, the program will not be installed.$\n$\nDo you want to continue?" IDNO CancelQuit
       
   150 !insertmacro XPUI_USERABORT
       
   151 CancelQuit:
       
   152 Abort
       
   153 Done:
       
   154 SetErrorLevel 1
       
   155 FunctionEnd
       
   156 
       
   157 Section
       
   158 SectionEnd
       
   159 
       
   160  Function GetParameters
       
   161 
       
   162    Push $R0
       
   163    Push $R1
       
   164    Push $R2
       
   165    Push $R3
       
   166 
       
   167    StrCpy $R2 1
       
   168    StrLen $R3 $CMDLINE
       
   169 
       
   170    ;Check for quote or space
       
   171    StrCpy $R0 $CMDLINE $R2
       
   172    StrCmp $R0 '"' 0 +3
       
   173      StrCpy $R1 '"'
       
   174      Goto loop
       
   175    StrCpy $R1 " "
       
   176 
       
   177    loop:
       
   178      IntOp $R2 $R2 + 1
       
   179      StrCpy $R0 $CMDLINE 1 $R2
       
   180      StrCmp $R0 $R1 get
       
   181      StrCmp $R2 $R3 get
       
   182      Goto loop
       
   183 
       
   184    get:
       
   185      IntOp $R2 $R2 + 1
       
   186      StrCpy $R0 $CMDLINE 1 $R2
       
   187      StrCmp $R0 " " get
       
   188      StrCpy $R0 $CMDLINE "" $R2
       
   189 
       
   190    Pop $R3
       
   191    Pop $R2
       
   192    Pop $R1
       
   193    Exch $R0
       
   194 
       
   195  FunctionEnd
       
   196 
       
   197  !insertmacro XPUI_LANGUAGE English
       
   198 
       
   199 !VERBOSE 1