;----------------------------------------------------------------------------
;
;    MODULE NAME:   UISAMPLE.MMH
;
;        $Author: gao $
;      $Revision: 9888 $
;          $Date: 2004-12-20 14:59:16 -0600 (Mon, 20 Dec 2004) $
;       $Logfile:   C:/DBAREIS/Projects.PVCS/Win32/MakeMsi/uisample.mmh.pvcs  $
;      COPYRIGHT:   (C)opyright Dennis Bareis, Australia, 2003
;                   All rights reserved.
;
; This header file is only used by "COMPANY.MMH", you may include it yourself
; if you use "uisample.msi" as a template but don't use "COMPANY.MMH" etc.
;
; "COMPANY.MMH" includes this header after all YOUR script has executes for
; these main reasons:
;
;   1. If your script fails your time hasn't been wasted by any atandard
;      processing done by this header.
;   2. If you insert dialogs following the UISAMPLE.MSI look and feel they
;      can be adjusted exactly the same as occurs for the "standard" ones.
;
; Note that some "UISAMPLE" code was left in "COMPANY.MMH" where its was more
; appropriate that it remain there. This file should really only hold cosmetic
; type "UISAMPLE" changes.
;----------------------------------------------------------------------------


;----------------------------------------------------------------------------
;--- Define Version number of this install support --------------------------
;----------------------------------------------------------------------------
#ifdef UISAMPLE_VERSION
   ;--- Die, already included -----------------------------------------------
   #error ^You have already included "<?InputComponent>"^
#endif
#NextId
#NextId LOCK "ui_sample.mmh"

;----------------------------------------------------------------------------
;--- OPTIONS ----------------------------------------------------------------
;----------------------------------------------------------------------------
#define? UISAMPLE_LICENCE_SPELLING_C_OR_S   c     ;;Spelling - Licence OR License?






;----------------------------------------------------------------------------
;--- Allow user to insert dialogs etc WITH ORIGINAL Look and feel -----------
;----------------------------------------------------------------------------
#define? UISAMPLE_BEFORE_ANYTHING_DONE
<$UISAMPLE_BEFORE_ANYTHING_DONE>


;----------------------------------------------------------------------------
;--- Remove "Typical" button? -----------------------------------------------
;----------------------------------------------------------------------------
;--- [TIPS.DH-Example-TypicalButton] ----------------------------------------
#( ''
   #define DisableTypicalSetupButtonIfRequired

   ;--- Decide if we need the typical button --------------------------------
   dim DisableTypicalButton : DisableTypicalButton = true
   #if ['<$UISAMPLE_DISABLE_TYPICAL_SETUP>' = 'S']
       ;--- May want to disable it... ---------------------------------------
       <$Table "Feature">
           #(
               <$Row
                   @WHERE=^<$UISAMPLE_DISABLE_TYPICAL_SETUP_IF_LEVEL>^
                   @Code="Y"
               >
           #)
               ;--- At least one feature that is deselected by default ----------
               DisableTypicalButton = false
           <$/Row>
       <$/Table>
   #endif

   ;--- Disable the button? -------------------------------------------------
   if  DisableTypicalButton then<?NewLine>
       ;--- Disable the "Typical" control (its the same as "Complete") ------
       <$Table "Control">
           ;--- Hide the "Typical" controls ---------------------------------
           #(
               <$Row    @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'TypicalLabel'"
                           @OK=^? = 1^
                   *Attributes=^0^
               >
           #)
           #(
               <$Row    @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'TypicalButton'"
                           @OK=^? = 1^
                   *Attributes=^0^
               >
           #)
           #(
               <$Row    @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'TypicalText'"
                           @OK=^? = 1^
                   *Attributes=^0^
               >
           #)

           ;--- Move the "Custom" button up a bit to make it look better ----
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CustomButton'"
                   @OK='=1'
                     Y="70"      ;;Previous value = 118
               >
           #)
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CustomLabel'"
                   @OK='=1'
                     Y="70"      ;;Previous value = 118
               >
           #)
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CustomText'"
                   @OK='=1'
                     Y="83"      ;;Previous value = 131
               >
           #)

           ;--- Tweek the "Complete" button ---------------------------------
           #define? UISAMPLE_TWEEKED_COMPLETE_BUTTON_LABEL &Install
           #define? UISAMPLE_TWEEKED_COMPLETE_BUTTON_TEXT  Install the complete product in the default location.
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CompleteLabel'"
                        @OK='=1'
                       Text="[DlgTitleFont]<$UISAMPLE_TWEEKED_COMPLETE_BUTTON_LABEL>"
               >
           #)
           #(
               <$Row @Where="Dialog_ = 'SetupTypeDlg' AND Control = 'CompleteText'"
                        @OK='=1'
                       Text="<$UISAMPLE_TWEEKED_COMPLETE_BUTTON_TEXT>"
               >
           #)
       <$/Table>
   end if
#)
#define? UISAMPLE_DISABLE_TYPICAL_SETUP   S           ;;User A=Always, S=Sometimes or N=Never
#if    ['<$UISAMPLE_DISABLE_TYPICAL_SETUP>' <> 'N']
   ;--- (either "A" or "S") Disable button if any features have a level > 3 -
   #define? UISAMPLE_DISABLE_TYPICAL_SETUP_IF_LEVEL `Level` > 3  ;;Any matches mean that "Typical" <> "Complete"
   ;#OnExit #51 <$DisableTypicalSetupButtonIfRequired>
   <$DisableTypicalSetupButtonIfRequired>
#endif
;--- [TIPS.DH-Example-TypicalButton] ----------------------------------------




;----------------------------------------------------------------------------
;--- PROGRESS BAR: Add a 2nd text control for more detail in custom actions -
;----------------------------------------------------------------------------
#define? UISAMPLE_ADD_2ND_LINE_TO_PROGRESS_DIALOG Y
#if ['<$UISAMPLE_ADD_2ND_LINE_TO_PROGRESS_DIALOG>' = 'Y']
;--- User did not disable updating of the progress control ------------------
;--- [TIPS.DH-Example-ProgressBar2ndLine] -----------------------------------
<$Table "Control">
#(
   ;--- Add the progress control for the 2nd line ---------------------------
   <$Row
            Dialog_="ProgressDlg"
            Control="ActionData"
               Type="Text"
           Property=""
                  X="35"
                  Y="130"
              Width="300"
             Height="90"
         Attributes="3"
               Text=""
       Control_Next=""
               Help=""
   >
#)
<$/Table>
<$Table "EventMapping">
#(
   ;--- Map the event to the control ----------------------------------------
   <$Row
         Dialog_="ProgressDlg"
        Control_="ActionData"
           Event="ActionData"
       Attribute="Text"
   >
#)
<$/Table>
;--- [TIPS.DH-Example-ProgressBar2ndLine] -----------------------------------
#endif



;----------------------------------------------------------------------------
;--- PROGRESS BAR: Fix the "Installing : blah blah" text control ------------
;----------------------------------------------------------------------------
#define? UISAMPLE_LENGTHEN_TITLE_TEXT_CONTROL Y
#if ['<$UISAMPLE_LENGTHEN_TITLE_TEXT_CONTROL>' = 'Y']
    <$Table "Control">
       #(
           <$Row
               @Where="Dialog_ = 'ProgressDlg' AND Control = 'Title'"
                  @OK='=1'
                Width="300"      ;;Previous value = 200
               Height="30"       ;;Previous value = 15
           >
       #)
   <$/Table>
#endif

;----------------------------------------------------------------------------
;--- PROGRESS BAR: Want "continuous progress bar" (red bar) -----------------
;----------------------------------------------------------------------------
#define? UISAMPLE_PROGRESSBAR_WANT_CONTINUOUS     Y
#if ['<$UISAMPLE_PROGRESSBAR_WANT_CONTINUOUS>' = 'Y']
    <$Table "Control">
       #(
           <$Row
                   @Where="Dialog_ = 'ProgressDlg' AND Control = 'ProgressBar'"
                      @OK='=1'
               Attributes="1"      ;;Previous value = 65537
           >
       #)
    <$/Table>
#endif



;----------------------------------------------------------------------------
;--- Put version number into dialog titles ----------------------------------
;----------------------------------------------------------------------------
#define? UISAMPLE_ADD_VERSION_NUMBER_TO_DIALOG_TITLES Y
#if ['<$UISAMPLE_ADD_VERSION_NUMBER_TO_DIALOG_TITLES>' = 'Y']
;--- [TIPS.DH-Example-VersionNumberInDialogTitles] --------------------------
<$Table "Dialog">
    #(
        ;--- Change all dialogs to include the version number ---------------
        <$Row
              @Where=^`Title` = '[ProductName] [Setup]'^
                 @OK=^? > 0^
               Title="[ProductName] ([ProductVersion]) [Setup]"
        >
    #)
    #ifndef REMOVED_LicenseAgreementDlg
        #(
            ;--- Change all dialogs to include the version number ---------------
            <$Row
                  @Where=^`Title` = '[ProductName] License Agreement'^
                     @OK=^? > 0^
                   Title="[ProductName] ([ProductVersion]) Licen<$UISAMPLE_LICENCE_SPELLING_C_OR_S>e Agreement"
            >
        #)
    #endif
<$/Table>
;--- [TIPS.DH-Example-VersionNumberInDialogTitles] --------------------------
#endif


;----------------------------------------------------------------------------
;--- Fix "licence" spelling -------------------------------------------------
;----------------------------------------------------------------------------
;--- [TIPS.DH-Example-FixLicenceSpelling-GoodRowExample] ---
#if ['<$UISAMPLE_LICENCE_SPELLING_C_OR_S>' = 'c']
    ;--- We are changing spelling from "license" to "licence" ---------------
    #ifndef REMOVED_LicenseAgreementDlg
        <$Table "Control">
        #(
            ;--- Look at licence dialog rows ------------------------------------
            <$Row
                  @Where=^`Dialog_` = 'LicenseAgreementDlg'^
                @SelfRef="{*}"
                   *Text=^replace({*}, "icense", "icence")^
            >
        #)
        <$/Table>
    #endif
    <$Table "RadioButton">
    #(
        ;--- Look at all rows -----------------------------------------------
        <$Row
              @Where=^^
            @SelfRef="{*}"
               *Text=^replace({*}, "icense", "icence")^
        >
    #)
    <$/Table>
#endif
;--- [TIPS.DH-Example-FixLicenceSpelling-GoodRowExample] ---


;----------------------------------------------------------------------------
;--- Put MSI name into title bar of ERROR DIALOG ----------------------------
;----------------------------------------------------------------------------
#define? UISAMPLE_MODIFY_ERROR_DIALOG_TITLE Y
#if ['<$UISAMPLE_MODIFY_ERROR_DIALOG_TITLE>' = 'Y']
   <$Table "Dialog">
       #(
           ;--- Change all dialogs to include the version number ------------
           <$Row
                 @Where=^`Title` = 'Installer Information'^
                    @OK=^? > 0^
                  Title="[ProductName] ([ProductVersion]) - Installer Information"
           >
       #)
   <$/Table>
#endif


;----------------------------------------------------------------------------
;--- Work around to title text overwrite bug (in windows installer + sample) -
;----------------------------------------------------------------------------
#define SpaceToWorkAroundWindowsInstallerBug <?Space>
<$Table "Control">
   #(
        <$Row
              @Where=^`Dialog_` = 'VerifyRepairDlg' and `Control` = 'Title'^
            @SelfRef="{*}"
               *Text=^{*} & "<$SpaceToWorkAroundWindowsInstallerBug>"^
        >
   #)
   #(
        <$Row
              @Where=^`Dialog_` = 'VerifyRemoveDlg' and `Control` = 'Title'^
            @SelfRef="{*}"
               *Text=^{*} & "<$SpaceToWorkAroundWindowsInstallerBug>"^
        >
   #)
<$/Table>


;----------------------------------------------------------------------------
;--- Increase the size of the ERROR DIALOG (workaround Windows Installer 2.0 bug) ---
;----------------------------------------------------------------------------
#define? UISAMPLE_INCREASE_ERROR_DIALOG_SIZE Y
#if ['<$UISAMPLE_INCREASE_ERROR_DIALOG_SIZE>' = 'Y']
;--- [TIPS.DH-Example-ErrorDialogChanges] -----------------------------------
;--- Make how much bigger? User can override size increase ------------------
#define? UISAMPLE_ERRDLG_INCREASE_WIDTH  150
#define? UISAMPLE_ERRDLG_INCREASE_HEIGHT  80
#define? UISAMPLE_ERRDLG_TYPE             Text
;**    [CommentBlockStart     (September 25, 2003 5:41:48 PM EST, Dennis)
;**+----------------------------------------------------------------------
;**|#define? UISAMPLE_ERRDLG_TYPE             ScrollableText    ;;Adds vertical scrollbar if required (lines wrap)
;**+----------------------------------------------------------------------
;**    CommentBlockEnd]       (September 25, 2003 5:41:48 PM EST, Dennis)
#DefineRexx ''
    HalfIncreaseWidth  = <$UISAMPLE_ERRDLG_INCREASE_WIDTH> / 2
#DefineRexx

;--- Normally Width=270, Height=105 -----------------------------------------
<$Table "Dialog">
    #(
       ;--- Adjust height and width as requested ----------------------------
        <$Row
              @Where=^`Dialog` = 'ErrorDlg'^
            @SelfRef="{*}"
                 @OK=^? = 1^
              *Width=^{*} + <$UISAMPLE_ERRDLG_INCREASE_WIDTH>^
             *Height=^{*} + <$UISAMPLE_ERRDLG_INCREASE_HEIGHT>^
        >
    #)
<$/Table>
<$Table "Control">
    #(
        ;--- Move all the buttons down/right --------------------------------
        <$Row
              @Where=^`Dialog_` = 'ErrorDlg' and `Type`='PushButton'^
            @SelfRef="{*}"
                 @OK=^? > 0^
                  *X=^{*} + <??HalfIncreaseWidth>^     ;;Buttons centered
                  *Y=^{*} + <$UISAMPLE_ERRDLG_INCREASE_HEIGHT>^
        >
    #)
    #(
        ;--- Fix up the Text control ----------------------------------------
        <$Row
              @Where=^`Dialog_` = 'ErrorDlg' and `Control`='ErrorText'^
            @SelfRef="{*}"
                 @OK=^? = 1^
                 Type="<$UISAMPLE_ERRDLG_TYPE>"
              *Width=^{*} + <$UISAMPLE_ERRDLG_INCREASE_WIDTH>^
             *Height=^{*} + <$UISAMPLE_ERRDLG_INCREASE_HEIGHT>^
        >
    #)
<$/Table>
;--- [TIPS.DH-Example-ErrorDialogChanges] -----------------------------------
#endif


;----------------------------------------------------------------------------
;--- Better Welcome Dialog message ------------------------------------------
;----------------------------------------------------------------------------
#(
   ;--- Better welcome information ------------------------------------------
   #define? UISAMPLE_WELCOME_VB_EXPRESSION_FIRST_PARA

   "This will install ""[ProductName]"" (version [ProductVersion],
   dated  [<$COMPANY_PROPERTY_BUILDTIME>]) onto your computer."
#)
#define? UISAMPLE_WELCOME_VB_EXPRESSION_BEFORE_CLICK_NEXT_PARA   ;;User can "insert" extra info
#(
   ;--- Want click text in new paragraph ------------------------------------
   #define? UISAMPLE_WELCOME_VB_EXPRESSION_CLICK_NEXT_PARA
   & vbCRLF & vbCRLF
   & "Click ""Next"" to continue."
#)
<$Table "Control">
   #(
       <$Row
             @Where=^`Dialog_` = 'WelcomeDlg' and `Control`='Description'^
                @OK=^? = 1^
             Height="165"          ;;Might as well define all the space to allow for very long messages.
              *Text=^<$UISAMPLE_WELCOME_VB_EXPRESSION_FIRST_PARA><$UISAMPLE_WELCOME_VB_EXPRESSION_BEFORE_CLICK_NEXT_PARA><$UISAMPLE_WELCOME_VB_EXPRESSION_CLICK_NEXT_PARA>^
       >
   #)
<$/Table>


;----------------------------------------------------------------------------
;--- Remove the "MaintenanceWelcomeDlg" -------------------------------------
;----------------------------------------------------------------------------
#define? UISAMPLE_REMOVE_MaintenanceWelcomeDlg Y
#if ['<$UISAMPLE_REMOVE_MaintenanceWelcomeDlg>' = 'Y']
;--- [TIPS.DH-Example-DialogRemoval-MaintenanceWelcomeDlg] ------------------
<$Table "InstallUISequence">
   ;--- "Skip" the welcome dialog -------------------------------------------
   #(
       <$Row
           @Where=^`Action` = 'MaintenanceWelcomeDlg'^
              @OK=^? = 1^
           Action="MaintenanceTypeDlg"
       >
   #)
<$/Table>

;--- There is now no "previous" dialog (could have deleted control as well) -
<$Table "Control">
   #(
       <$Row
              @Where=^`Dialog_` = 'MaintenanceTypeDlg' and `Control`='Back'^
            @SelfRef="{*}"
                 @OK=^? = 1^
         *Attributes=^{*} and not (msidbControlAttributesVisible or msidbControlAttributesEnabled)^  ;;Reset these bits
       >
   #)
<$/Table>
;--- [TIPS.DH-Example-DialogRemoval-MaintenanceWelcomeDlg] ------------------
#endif


;----------------------------------------------------------------------------
;--- Don't need "CD KEY -----------------------------------------------------
;----------------------------------------------------------------------------
#define? UISAMPLE_ASK_FOR_CDKEY     N           ;;Normally I don't want to...
#if    ['<$UISAMPLE_ASK_FOR_CDKEY>' <> 'Y']
   ;--- Remove CD-KEY related stuff -----------------------------------------
   <$Table "Control">
       ;--- Fix "UserRegistrationDlg" & "AdminRegistrationDlg" --------------
       #(
           #define RemoveCdKey

           <$RowsDelete WHERE="Dialog_ = '{$#1}' AND Control = 'CDKeyLabel'">
           <$RowsDelete WHERE="Dialog_ = '{$#1}' AND Control = 'CDKeyEdit'">
           #(
               <$Row @Where="Dialog_ = '{$#1}' AND Control = 'OrganizationEdit'" @OK='=1'
                   Control_Next="Back"      ;;Previous value = CDKeyLabel
               >
           #)
       #)
       #ifndef REMOVED_UserRegistrationDlg
               <$RemoveCdKey "UserRegistrationDlg">
       #endif
       <$RemoveCdKey "AdminRegistrationDlg">
   <$/Table>
#endif



;----------------------------------------------------------------------------
;--- Want ADMIN REGISTRATION DIALOG? ----------------------------------------
;----------------------------------------------------------------------------
#define? UISAMPLE_WANT_ADMIN_REGISTRATION_DIALOG  N
#if    ['<$UISAMPLE_WANT_ADMIN_REGISTRATION_DIALOG>' <> 'Y']
    <$Table "ControlEvent">
       ;--- Correct Next Link -----------------------------------------------
       #(
           <$Row
                @Where=^Dialog_ = 'AdminWelcomeDlg' AND Control_ = 'Next' AND Event = 'NewDialog' AND Argument = 'AdminRegistrationDlg' AND Condition = '1'^
                   @OK=^=1^
                Argument="AdminInstallPointDlg"
           >
       #)

       ;--- Correct "Back Link ----------------------------------------------
       #(
           <$Row
                @Where=^Dialog_ = 'AdminInstallPointDlg' AND Control_ = 'Back' AND Event = 'NewDialog' AND Argument = 'AdminRegistrationDlg' AND Condition = '1'^
                   @OK=^=1^
                Argument="AdminWelcomeDlg"
           >
       #)
   <$/Table>
#endif


;----------------------------------------------------------------------------
;--- Add message to bottom bar (on left) ------------------------------------
;----------------------------------------------------------------------------
#define? UISAMPLE_ADD_MSG_TO_BOTTOM_BAR  Y
#if ['<$UISAMPLE_ADD_MSG_TO_BOTTOM_BAR>' = 'Y']
   ;--- Define some options -------------------------------------------------
   #define?  UISAMPLE_BLINE_TEXT           CAVS
   #define?  UISAMPLE_BLINE_TEXT_INDENT    2          ;;Tiny bit in
   #define?  UISAMPLE_BLINE_TEXT_HEIGHT    10
   #define?  UISAMPLE_BLINE_TEXT_STYLE     0
   #ifdef    UISAMPLE_BLINE_SIMPLE
       #define?  UISAMPLE_BLINE_TEXT_FONT      Arial
       #define?  UISAMPLE_BLINE_TEXT_FONT_SIZE 8
       #define?  UISAMPLE_BLINE_TEXT_COLOR     &H7F7F7F   ;;BGR (only Microsoft... For the last 20 or so years every company on Earth has used RGB including MS...)
       #define?  UISAMPLE_BLINE_TEXT_WIDTH     102        ;;You'll need to do a bit of "Trial and Error" to get this right...
   #elseif
       #define?  UISAMPLE_BLINE_TEXT_FONT      Tahoma     ;;Looks better
       #define?  UISAMPLE_BLINE_TEXT_FONT_SIZE 8
       #define?  UISAMPLE_BLINE_TEXT_WIDTH     20         ;;You'll need to do a bit of "Trial and Error" to get this right...
   #endif
   #(
       #define?  UISAMPLE_BLINE_EXCEPTION_DIALOGS    ;;These have the graphic on the left
       and (`Dialog_` <> 'AdminWelcomeDlg')
       and (`Dialog_` <> 'ExitDialog')
       and (`Dialog_` <> 'FatalError')
       and (`Dialog_` <> 'MaintenanceWelcomeDlg')
       and (`Dialog_` <> 'PrepareDlg')
       and (`Dialog_` <> 'ResumeDlg')
       and (`Dialog_` <> 'UserExit')
       and (`Dialog_` <> 'WelcomeDlg')
   #)

   <$Table "Control">
       ;--- Modify existing bottom line record ------------------------------
       #(
           <$Row
                 @Where=^`Control`='BottomLine' and `Type`='Line' <$UISAMPLE_BLINE_EXCEPTION_DIALOGS>^
               @SelfRef="{*}"
                    @OK=^? >= 1^
                     *X='{*} + <$UISAMPLE_BLINE_TEXT_WIDTH> + <$UISAMPLE_BLINE_TEXT_INDENT>'
                 *Width='{*} - <$UISAMPLE_BLINE_TEXT_WIDTH> - <$UISAMPLE_BLINE_TEXT_INDENT>'
           >
       #)
   <$/Table>

   ;--- Insert the new branding text ----------------------------------------
   #ifdef    UISAMPLE_BLINE_SIMPLE
       ;--- Use the simple format -------------------------------------------
       <$Table "TextStyle">
       #(
           ;--- Set up the font type and color ------------------------------
           <$Row
               TextStyle="BrandingLineText"
               FaceName="<$UISAMPLE_BLINE_TEXT_FONT>"
                   Size="<$UISAMPLE_BLINE_TEXT_FONT_SIZE>"
                   Color="<$UISAMPLE_BLINE_TEXT_COLOR>"
               StyleBits="<$UISAMPLE_BLINE_TEXT_STYLE>"
           >
       #)
       <$/TABLE>
       <$Table "Control">
           ;--- Insert "Bottom Line" Text -----------------------------------
           #(
               <$Row
                   @Where=^`Control`='BottomLine' and `Type`='Line' <$UISAMPLE_BLINE_EXCEPTION_DIALOGS>^
                   @Method="INSERT"
                   @SelfRef="{*}"
                       @OK=^? >= 1^
                   Control="BrandingLineText"
                       Type="Text"
                       X=^<$UISAMPLE_BLINE_TEXT_INDENT>^
                   Height=^<$UISAMPLE_BLINE_TEXT_HEIGHT>^
                       Y=^{*} - (<$UISAMPLE_BLINE_TEXT_HEIGHT>\2)^   ;;Y (line goes in middle)
               Attributes=^{*} or msidbControlAttributesTransparent^
                       Text=^{&BrandingLineText}<$UISAMPLE_BLINE_TEXT>^
               Control_Next=""
                       Help=""
               >
           #)
       <$/Table>
   #elseif
       ;--- Use more complex embossed form ----------------------------------
       <$Table "TextStyle">
           #(
               ;--- Lower right text (applied first) ------------------------
               <$Row
                   TextStyle="BrandingLR"
                    FaceName="<$UISAMPLE_BLINE_TEXT_FONT>"
                        Size="<$UISAMPLE_BLINE_TEXT_FONT_SIZE>"
                       Color="&HFFFFFF"               ;;White
                   StyleBits="<$UISAMPLE_BLINE_TEXT_STYLE>"
               >
           #)
           #(
               ;--- Upper Left (applied second) -----------------------------
               <$Row
                   TextStyle="BrandingUL"
                    FaceName="Tahoma"
                        Size="<$UISAMPLE_BLINE_TEXT_FONT_SIZE>"
                       Color=""
                   StyleBits="<$UISAMPLE_BLINE_TEXT_STYLE>"
               >
           #)
       <$/Table>
       <$Table "Control">
           #(
               ;--- Lower right line (APPLIED FIRST) ------------------------
               <$Row
                     @Where=^`Control`='BottomLine' and `Type`='Line' <$UISAMPLE_BLINE_EXCEPTION_DIALOGS>^
                    @Method="INSERT"
                   @SelfRef="{*}"
                        @OK=^? >= 1^
                    Control="BrandingLR"        ;;Slightly lower and righter
                       Type="Text"
                          X=^<$UISAMPLE_BLINE_TEXT_INDENT> + 1^
                          Y=^{*} - (<$UISAMPLE_BLINE_TEXT_HEIGHT>\2)+1^   ;;Y (line goes in middle)
                     Height=^<$UISAMPLE_BLINE_TEXT_HEIGHT>^
                      Width="<$UISAMPLE_BLINE_TEXT_WIDTH>"
                 Attributes="msidbControlAttributesVisible"
                       Text="{&BrandingLR}<$UISAMPLE_BLINE_TEXT>"
               Control_Next=""
                       Help=""
               >
           #)
           #(
               ;--- Upper Left line (APPLIED SECOND - over "BrandingLR") ----
               <$Row
                     @Where=^`Control`='BottomLine' and `Type`='Line' <$UISAMPLE_BLINE_EXCEPTION_DIALOGS>^
                    @Method="INSERT"
                   @SelfRef="{*}"
                        @OK=^? >= 1^
                    Control="BrandingUL"
                       Type="Text"
                   Property=""
                          X=^<$UISAMPLE_BLINE_TEXT_INDENT>^
                          Y=^{*} - (<$UISAMPLE_BLINE_TEXT_HEIGHT>\2)^   ;;Y (line goes in middle)
                     Height=^<$UISAMPLE_BLINE_TEXT_HEIGHT>^
                      Width="<$UISAMPLE_BLINE_TEXT_WIDTH>"
                 Attributes="msidbControlAttributesVisible or msidbControlAttributesTransparent"
                       Text="{&BrandingUL}<$UISAMPLE_BLINE_TEXT>"
               Control_Next=""
                       Help=""
               >
           #)
       <$/Table>
   #endif
#endif


;----------------------------------------------------------------------------
;--- MS "CustomizeDlg" has problems (things don't fit by default!) ----------
;----------------------------------------------------------------------------
#define? UISAMPLE_ADJUST_CustomizeDlg Y
#if ['<$UISAMPLE_ADJUST_CustomizeDlg>' = 'Y']
   #define? UISAMPLE_FeatureDirFont {&FeatureDirFont}
   <$Table "Control">
       ;--- Make group box etc wider so things fit. Also looks better! ------
       #(
           <$Row
               @Where="Dialog_ = 'CustomizeDlg' AND Control = 'Description'"
               @OK='=1'
                   X="15"       ;;Previous value = 25
               Width="290"      ;;Previous value = 280
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'CustomizeDlg' AND Control = 'Text'"
               @OK='=1'
                   X="15"       ;;Previous value = 25
               Width="330"      ;;Previous value = 320
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'CustomizeDlg' AND Control = 'Tree'"
               @OK='=1'
                   X="10"       ;;Previous value = 25
                   Y="77"       ;;Previous value = 85
               Width="189"      ;;Previous value = 175
               Height="123"      ;;Previous value = 95
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'CustomizeDlg' AND Control = 'Box'"
               @OK='=1'
                   X="207"      ;;Previous value = 210
                   Y="73"       ;;Previous value = 81
               Width="153"      ;;Previous value = 140
               Height="127"      ;;Previous value = 98
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'CustomizeDlg' AND Control = 'LocationLabel'"
               @OK='=1'
                   X="15"       ;;Previous value = 25
                   Y="203"      ;;Previous value = 200
               Width="37"       ;;Previous value = 50
               Height="11"       ;;Previous value = 10
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'CustomizeDlg' AND Control = 'Location'"
               @OK='=1'
                   X="55"       ;;Previous value = 75
                   Y="203"      ;;Previous value = 200
               Width="243"      ;;Previous value = 215
               Height="31"       ;;Previous value = 20
               Text="<$UISAMPLE_FeatureDirFont><The feature's path>"
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'CustomizeDlg' AND Control = 'Browse'"
               @OK='=1'
                   Y="208"      ;;Previous value = 200
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'CustomizeDlg' AND Control = 'ItemDescription'"
               @OK='=1'
                   X="212"      ;;Previous value = 215
                   Y="79"       ;;Previous value = 90
               Width="144"      ;;Previous value = 131
               Height="65"       ;;Previous value = 30
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'CustomizeDlg' AND Control = 'ItemSize'"
               @OK='=1'
                   X="212"      ;;Previous value = 215
                   Y="147"      ;;Previous value = 130
               Width="144"      ;;Previous value = 131
               Height="51"       ;;Previous value = 45
           >
       #)

   <$/Table>
   #ifndef UISAMPLE_FeatureDirFont_DONT_CREATE
       ;--- The user wants this item (not overriding etc) -------------------
       <$Table "TextStyle">
           #(
               <$Row
                   TextStyle="FeatureDirFont"
                   FaceName="Tahoma"
                       Size="8"
                       Color="16711680"
               >
           #)
       <$/Table>
   #endif
#endif



;----------------------------------------------------------------------------
;--- Replace the custom setup icon with a better one ------------------------
;----------------------------------------------------------------------------
#define? UISAMPLE_NEW_custicon  MmCustomSetup.ico
#if ['<$UISAMPLE_NEW_custicon>' <> '']
    <$Binary "<$UISAMPLE_NEW_custicon>" KEY="custicon" DOCO="N" @Validate="FIELD">
#end if



;----------------------------------------------------------------------------
;--- Replace long horizontal white bar (on top) with graphic by 2 new -------
;----------------------------------------------------------------------------
#define? UISAMPLE_CHANGE_bannrbmp  Y
#if ['<$UISAMPLE_CHANGE_bannrbmp>' = 'Y']
;--- [TIPS.DH-Example-WhiteBarWithLogo] -------------------------------------
;--- MAKEMSI MSI smaller, use smaller banner graphic ------------------------
#define? UISAMPLE_BITMAP_WHITE_BANNER        white.bmp                                             ;;Pure white banner (no graphic)
<$Binary "<$UISAMPLE_BITMAP_WHITE_BANNER>"   KEY="bannrbmp"          DOCO="N" @Validate="FIELD">   ;;Very small image gets sized to fill area

;--- If user wants a small graphic on the banner (like original) then add it ---
#define? UISAMPLE_BITMAP_BANNER_GRAPHIC
#if ['<$UISAMPLE_BITMAP_BANNER_GRAPHIC>' <> '']
    ;--- User wants the small right hand side graphic -----------------------
    <$Binary "<$UISAMPLE_BITMAP_BANNER_GRAPHIC>" KEY="BannerGraphic.BMP" DOCO="N">                     ;;Will place fixed size bitmap on right of filled area
    <$Table "Control">
    #(
       ;--- Add new control for fixed size logo on right --------------------
       <$Row
            @Where="`Control` = 'BannerBitmap'"
           @Method="INSERT"
               @OK=^? > 0^
           Control="CompanyLogo"
                 X="330"
                 Y="10"
             Width="26"
            Height="26"
        Attributes="&H00100001"            ;;Fixed size bitmap
              Text="BannerGraphic.BMP"
      Control_Next=""
       >
    #)
    <$/Table>
#end if
;--- [TIPS.DH-Example-WhiteBarWithLogo] -------------------------------------
#endif


;----------------------------------------------------------------------------
;--- Replace Left Side (Whole dialog actually) graphic if wanted ------------
;----------------------------------------------------------------------------
#define? UISAMPLE_DIALOG_FILE_dlgbmp LeftSide.bmp     ;;"" = No change!
#if  ['<$UISAMPLE_DIALOG_FILE_dlgbmp>' <> '']
   ;--- Replace standard bitmap on left side of welcome and other dialogs ---
   <$Binary "<$UISAMPLE_DIALOG_FILE_dlgbmp>" KEY="dlgbmp" DOCO="N" @Validate="FIELD">

   ;--- If you have left the top of the new graphic clear, put text there? ---
   #define? UISAMPLE_LEFTSIDE_TEXT Developed by <$DEPT_NAME> - <$DEPT_ADDRESS>.
   #if ['<$UISAMPLE_LEFTSIDE_TEXT>' <> '']
        ;--- Set some defaults ----------------------------------------------
        #define? UISAMPLE_LEFTSIDE_TEXT_FONT_NAME  Tahoma
        #define? UISAMPLE_LEFTSIDE_TEXT_FONT_SIZE  12
        #define? UISAMPLE_LEFTSIDE_TEXT_FONT_COLOR &H007F00   ;;Black in BGR (believe it or not...)
        #define? UISAMPLE_LEFTSIDE_TEXT_FONT_STYLE 1
        #define? UISAMPLE_LEFTSIDE_TEXT_X          5          ;;Trial and error will be required for all coordinates (don't match pixels either...)
        #define? UISAMPLE_LEFTSIDE_TEXT_Y          5
        #define? UISAMPLE_LEFTSIDE_TEXT_WIDTH      110
        #define? UISAMPLE_LEFTSIDE_TEXT_HEIGHT     185        ;;How much of bitmap is "clear"?

        ;--- Create the font -------------------------------------------------
        <$Table "TextStyle">
            #(
                <$Row
                     TextStyle="UISAMPLE_LEFTSIDE_TEXT"
                      FaceName="<$UISAMPLE_LEFTSIDE_TEXT_FONT_NAME>"
                          Size="<$UISAMPLE_LEFTSIDE_TEXT_FONT_SIZE>"
                         Color="<$UISAMPLE_LEFTSIDE_TEXT_FONT_COLOR>"
                     StyleBits="<$UISAMPLE_LEFTSIDE_TEXT_FONT_STYLE>"
                >
            #)
        <$/Table>

        ;--- Insert "Left Hand GRAPHIC TEXT" control into all relevant dialogs ---
        <$Table "Control">
            #(
                <$Row
                       @Where=^`Text`='[DialogBitmap]'^
                      @Method="INSERT"
                     @SelfRef="{*}"
                          @OK=^? >= 1^
                      Control="BrandingOnLeftSideBitmap"
                         Type="Text"
                            X="<$UISAMPLE_LEFTSIDE_TEXT_X>"
                            Y="<$UISAMPLE_LEFTSIDE_TEXT_Y>"
                        Width="<$UISAMPLE_LEFTSIDE_TEXT_WIDTH>"
                       Height="<$UISAMPLE_LEFTSIDE_TEXT_HEIGHT>"
                   Attributes="&H10003"
                     Property=""
                         Text="{&UISAMPLE_LEFTSIDE_TEXT}<$UISAMPLE_LEFTSIDE_TEXT>"
                 Control_Next=""
                         Help=""
                >
            #)
        <$/Table>
   #endif
#endif




;----------------------------------------------------------------------------
;--- Fix some Microsoft UISAMPLE.MSI formatting/sizing errors ---------------
;----------------------------------------------------------------------------
#define? UISAMPLE_FIX_WELCOME_LIKE_SIZING_PROBLEMS   Y
#if    ['<$UISAMPLE_FIX_WELCOME_LIKE_SIZING_PROBLEMS>' = 'Y']
   <$Table "Control">
       #(
           <$Row
               @Where="Dialog_ = 'AdminWelcomeDlg' AND Control = 'Description'"
               @OK='=1'
                   Y="85"      ;;Previous value = 70
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'ExitDialog' AND Control = 'Description'"
               @OK='=1'
                   Y="85"      ;;Previous value = 70
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'FatalError' AND Control = 'Description1'"
               @OK='=1'
                   Y="85"      ;;Previous value = 70
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'FatalError' AND Control = 'Description2'"
               @OK='=1'
                   Y="130"      ;;Previous value = 115
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'PrepareDlg' AND Control = 'Description'"
               @OK='=1'
                   Y="85"      ;;Previous value = 70
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'PrepareDlg' AND Control = 'ActionText'"
                  @OK='=1'
                    Y="130"      ;;Previous value = 100
                 Text="Initialising... Please wait..."
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'PrepareDlg' AND Control = 'ActionData'"
                  @OK='=1'
                    Y="155"      ;;Previous value = 125
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'UserExit' AND Control = 'Description1'"
               @OK='=1'
                   Y="85"      ;;Previous value = 70
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'UserExit' AND Control = 'Description2'"
               @OK='=1'
                   Y="130"      ;;Previous value = 115
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'MaintenanceWelcomeDlg' AND Control = 'Description'"
               @OK='=1'
                   Y="85"      ;;Previous value = 70
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'ResumeDlg' AND Control = 'Description'"
               @OK='=1'
                   Y="85"      ;;Previous value = 70
           >
       #)
       #(
           <$Row
               @Where="Dialog_ = 'WelcomeDlg' AND Control = 'Description'"
               @OK='=1'
                   Y="85"      ;;Previous value = 70
           >
       #)
   <$/Table>
#endif



;----------------------------------------------------------------------------
;--- Want all dialogs positioned in the CENTRE of the screen ----------------
;----------------------------------------------------------------------------
#define? UISAMPLE_ALL_DIALOGS_IN_CENTER_OF_SCREEN   Y
#if    ['<$UISAMPLE_ALL_DIALOGS_IN_CENTER_OF_SCREEN>' = 'Y']
   <$Table "Dialog">
       #(
           ;--- Change all dialogs to include the version number ---------------
           <$Row
                   @Where=^`HCentering` <> 50 or `VCentering` <> 50^
                      @OK=^? > 0^
               HCentering="50"
               VCentering="50"
           >
       #)
   <$/Table>
#endif


;----------------------------------------------------------------------------
;--- Reduce the UI (a better "basic" UILevel) -------------------------------
;----------------------------------------------------------------------------
#define? UISAMPLE_REDUCED_UI_PROPERTY_NAME MM_REDUCED_UI   ;;Blank to not touch! Upper case = can be set on command line
#define? UISAMPLE_REDUCED_UI_VALUE         0               ;;0 = normal, 1 = reduced UI (on install only)
#if ['<$UISAMPLE_REDUCED_UI_PROPERTY_NAME>' <> '']
   ;--- Create the property as requested ------------------------------------
   <$Property "<$UISAMPLE_REDUCED_UI_PROPERTY_NAME>" Value="<$UISAMPLE_REDUCED_UI_VALUE>">

   ;--- Update the UI information to look at the above property -------------
   <$Table "InstallUISequence">
       #(
           ;--- The condition is normally "" --------------------------------
           <$Row
                  @Where="Action = 'ExitDialog'"
                     @OK='=1'
               Condition="Installed or (<$UISAMPLE_REDUCED_UI_PROPERTY_NAME> = 0)"
           >
       #)
       #(
           ;--- The condition is normally "NOT Installed" -------------------
           <$Row
                  @Where="Action = 'WelcomeDlg'"
                     @OK='=1'
               Condition="NOT Installed and (<$UISAMPLE_REDUCED_UI_PROPERTY_NAME> = 0)"
           >
       #)
   <$/Table>
#endif



;----------------------------------------------------------------------------
;--- Fix Spelling errors ----------------------------------------------------
;----------------------------------------------------------------------------
<$Table "ControlEvent">
   #(
       <$Row
              @WHERE="Dialog_ = 'MaintenanceTypeDlg' AND Control_ = 'RepairButton' AND Event = '[Progress2]' AND Argument = 'repaires' AND Condition = '1'"
                 @OK=^=1^
             @METHOD="Replace"
            Argument="repairs"
       >
   #)
<$/Table>


;----------------------------------------------------------------------------
;--- Remove these unwanted "UISAMPLE.MSI" bits ------------------------------
;----------------------------------------------------------------------------
<$Table "Property">
   <$RowsDelete where=^`Property` = 'ComponentDownload'^>
<$/Table>








;----------------------------------------------------------------------------
;--- No  "UserExit" dialog after "YES" pressed on Cancel Dialog! ------------
;----------------------------------------------------------------------------
#define? UISAMPLE_NO_USEREXIT_DIALOG_AFTER_CANCEL_CONFIRMATION Y
#if ['<$UISAMPLE_NO_USEREXIT_DIALOG_AFTER_CANCEL_CONFIRMATION>' = 'Y']
    <$Table "ControlEvent">
       ;--- Modify existing row to change ordering --------------------------
       #(
           <$Row
                 @Where="Dialog_ = 'CancelDlg' AND Control_ = 'Yes' AND Event = 'EndDialog' AND Argument = 'Exit' AND Condition = '1'"
                    @OK='=1'
               Ordering="2"
           >
       #)

       ;--- Add new row to set property if "YES" selected -------------------
       #(
           <$Row
                 Dialog_="CancelDlg"
                Control_="Yes"
                   Event="[UserPressedYesOnCancelDlg]"
                Argument="YES"
               Condition="1"
                Ordering="1"
           >
       #)

    <$/Table>
    <$Table "InstallUISequence">
       ;--- Change "UserExit" dialog to not appear if "YES" selected on "CancelDlg" ---
       #(
           <$Row
                  @Where="Action = 'UserExit'"
                     @OK='=1'
               Condition="not UserPressedYesOnCancelDlg"
           >
       #)
    <$/Table>
#endif



;----------------------------------------------------------------------------
;--- Add Dialog Identification? MUST BE LAST THING DONE! --------------------
;----------------------------------------------------------------------------
;---[ForDoco.AddDialogNameToDialogTitle]---
#define? UISAMPLE_DIALOGS_ID_IN_TITLE.D  N   ;;In developer mode?
#define? UISAMPLE_DIALOGS_ID_IN_TITLE.P  N   ;;In production mode? - probably not!
#if ['<$UISAMPLE_DIALOGS_ID_IN_TITLE.[MMMODE]>' = 'Y']
    ;--- We wish to add the dialog name to the title ------------------------
    <$Table "Dialog">
        <$Row @Where="" @OK=^? > 0^ *Title=^"[\[]" & <$COLSTR.Dialog.Dialog> & "[\]] - " & <$COLSTR.Dialog.Title>^>
    <$/Table>
#endif
;---[ForDoco.AddDialogNameToDialogTitle]---


#NextId UNLOCK "ui_sample.mmh"

