<?xml version="1.0"?>

<?include defines.wxi?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
   <Product Id="*" Name="$(var.PackageName)" 
      Language="1033" Version="$(var.ProductVersion)" Manufacturer="Merkaartor"
      UpgradeCode="4892C085-55A9-413b-9C7B-42E33ED7D7D2">

      <Package 
         Description="A map editor for OpenStreetMap.org" InstallerVersion="100" Compressed="yes" />

      <Upgrade Id="4892C085-55A9-413b-9C7B-42E33ED7D7D2">
       <UpgradeVersion OnlyDetect="yes" Minimum="$(var.ProductVersion)" Property="NEWERVERSIONDETECTED" IncludeMinimum="no" />
       <UpgradeVersion OnlyDetect="no" Maximum="$(var.ProductVersion)" Property="OLDERVERSIONBEINGUPGRADED" IncludeMaximum="yes" />
     </Upgrade>

     <InstallExecuteSequence>
       <RemoveExistingProducts After="InstallInitialize" />
     </InstallExecuteSequence>

      <!--Set the icon for the msi and Add/Remove programs-->
      <Icon Id='Merkaartor.exe' SourceFile='..\Icons\Merkaartor_16x16.ico'/>
      <Icon Id='MainIcon.exe' SourceFile='..\Icons\Merkaartor_48x48.ico'/>
      <Property Id="ARPPRODUCTICON" Value="Merkaartor.exe" />
      <Property Id="ALLUSERS" Value="1"/>

      <Media Id="1" Cabinet="Product.cab" EmbedCab="yes" />
      
      <Directory Id="TARGETDIR" Name="SourceDir">
         <Directory Id="ProgramMenuFolder">
         </Directory>
         <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLLOCATION" Name="Merkaartor $(var.VERSION)$(var.REVISION)">
                <Directory Id="MERKAARTORSHARE" Name="share">
                </Directory>
                <Directory Id="MERKAARTORPLUGINS" Name="plugins">
                   <Directory Id="MPBACKGROUND" Name="background" />
                   <Directory Id="MPSTYLES" Name="styles" />
                </Directory>
                <Directory Id="QTIMAGEPLUGINDIR" Name="imageformats" />
                <Directory Id="QTTRANSLATIONS" Name="translations" />
            </Directory>
         </Directory>
      </Directory>

      <DirectoryRef Id="MERKAARTORSHARE">
         <Component Id="worldbackgroundosb" Guid="12ACB195-D065-49bb-A7A9-CACE30DD8F1B">
            <File Id="world_background.osb" Name="world_background.osb"
               Source="$(var.SharePath)\world_background.osb" DiskId="1">
            </File>
         </Component>
      </DirectoryRef>

      <DirectoryRef Id="MPBACKGROUND">
         <Component Id="background_plug" Guid="A37E552D-FF55-4507-8C8D-3201993F7C48">
            <File Id="MYahooBackgroundPlugin0.dll" Name="MYahooBackgroundPlugin0.dll"
			    Source="$(var.BinPath)\plugins\background\MYahooBackgroundPlugin0.dll" DiskId="1" />
            <File Id="MYahooTiledBackgroundPlugin0.dll" Name="MYahooTiledBackgroundPlugin0.dll"
			    Source="$(var.BinPath)\plugins\background\MYahooTiledBackgroundPlugin0.dll" DiskId="1" />
            <File Id="MGeoTiffBackgroundPlugin0.dll" Name="MGeoTiffBackgroundPlugin0.dll"
                   Source="$(var.BinPath)\plugins\background\MGeoTiffBackgroundPlugin0.dll" DiskId="1" />
            <File Id="MWalkingPapersBackgroundPlugin0.dll" Name="MWalkingPapersBackgroundPlugid0.dll"
		    Source="$(var.BinPath)\plugins\background\MWalkingPapersBackgroundPlugin0.dll" DiskId="1" />
            <File Id="MCadastreFranceBackgroundPlugin0.dll" Name="MCadastreFranceBackgroundPlugin0.dll"
		    Source="$(var.BinPath)\plugins\background\MCadastreFranceBackgroundPlugin0.dll" DiskId="1" />
            <File Id="MSpatialiteBackgroundPlugin0.dll" Name="MSpatialiteBackgroundPlugin0.dll"
		    Source="$(var.BinPath)\plugins\background\MSpatialiteBackgroundPlugin0.dll" DiskId="1" />
            <File Id="MGdalBackgroundPlugin0.dll" Name="MGdalBackgroundPlugin0.dll"
		    Source="$(var.BinPath)\plugins\background\MGdalBackgroundPlugin0.dll" DiskId="1" />
            <File Id="MMsBingMapBackgroundPlugin0.dll" Name="MMsBingMapBackgroundPlugin0.dll"
		    Source="$(var.BinPath)\plugins\background\MMsBingMapBackgroundPlugin0.dll" DiskId="1" />
         </Component>
      </DirectoryRef>
      
      <DirectoryRef Id="MPSTYLES">
         <Component Id="skulpture" Guid="47E06B1A-DBF5-452d-A68A-5F45CE411353">
            <File Id="skulpture0.dll" Name="skulpture0.dll"
               Source="$(var.BinPath)\plugins\styles\skulpture0.dll" DiskId="1">
            </File>
         </Component>
      </DirectoryRef>
      
      <DirectoryRef Id="INSTALLLOCATION">
         <Component Id="Merkaartor" Guid="5FDB24DB-CE92-433c-8AC4-288551C6AF7B">
	          <RegistryValue Root="HKCU" Key="Software\Merkaartor $(var.VERSION)$(var.REVISION)" Name="Installed" Type="integer" Value="1"/>
            <File Id="MerkaartorExe" Name="Merkaartor.exe"
               Source="$(var.BinPath)\Merkaartor.exe" DiskId="1">
               <Shortcut Id="myshort" Directory="ProgramMenuFolder"
                     Name="Merkaartor $(var.VERSION)$(var.REVISION)" WorkingDirectory="INSTALLLOCATION"
					 Icon="MainIcon.exe" />
            </File>         
            <File Id="Qgpsmm" Name="Qgpsmm.dll"
               Source="$(var.DllPath)\Qgpsmm19.dll" DiskId="1">
            </File>
         </Component>
      </DirectoryRef>
 
      <Feature Id="MerkaartorFeature" Title="Merkaartor editor" Level="1"
         Display="expand" ConfigurableDirectory="INSTALLLOCATION">
         <ComponentRef Id="DllCt" />
         <ComponentRef Id="Merkaartor" />
         <ComponentRef Id="background_plug" />
         <ComponentRef Id="skulpture" />
         <ComponentRef Id="proj4_bin" />
         <ComponentRef Id="proj4_shr" />
      </Feature>
      <Feature Id="ftWorld_Shp" Title="World Shape file" Level="1"
         Display="expand" ConfigurableDirectory="MERKAARTORSHARE">
         <ComponentRef Id="worldbackgroundosb" />
      </Feature>
     <Feature Id="QtMainFeature" Title="Main Qt DLLs" Level="1"
        Display="expand" ConfigurableDirectory="INSTALLLOCATION">
       <ComponentRef Id="QtMain" />
     </Feature>
     <Feature Id="QtImagePluginsFeature" Title="Qt Image Plugins DLLs" Level="1"
        Display="expand" ConfigurableDirectory="QTIMAGEPLUGINDIR">
       <ComponentRef Id="QtImagePlugins" />
     </Feature>
     <Feature Id="TranslationsFeature" Title="Translation files" Level="1"
        Display="expand" ConfigurableDirectory="QTTRANSLATIONS">
       <ComponentRef Id="QtTranslations" />
       <ComponentRef Id="MerkaartorTranslationsCt" />
     </Feature>

     <UIRef Id="WixUI_Mondo"/>

   </Product>

   <?include qt.wxi?>
   <?include qttrans.wxi?>
   <?include external.wxi?>
   <?include proj4.wxi?>
   <?include merkaartor_trans.wxi?>

</Wix>
