TODO:

** FIXME:
	+ install location ...

* Un-solved Q's
	+ how are multiple Director.idt files built ?
	+ $basedir must be different, and create_directory_table must
	  be called multiple times [!]


* Why are we installed in a top-level menu of name 'LibreOffice 3.3' ?

* FolderItem gid_Folderitem_Soffice_Desktop
	ComponentCondition = "CREATEDESKTOPLINK=1";
	ComponentIDFile = "gid_Brand_File_Desktophelper_Txt";
	FileID = gid_Brand_File_Bin_Soffice;
	FolderID = PREDEFINED_DESKTOP;
	IconFile = gid_Brand_File_Bin_Soffice;
	IconID = 0;
	ModuleID = gid_Module_Root;
	Name = "%PRODUCTNAME %PRODUCTVERSION";
	Name (pt-BR) = "%PRODUCTNAME_BR %PRODUCTVERSION";

property.pm:
    if ( $installer::globals::desktoplinkexists )
    {
        my $onepropertyline = "DESKTOPLINKEXISTS" . "\t" . "1" . "\n";
        push(@{$propertyfile}, $onepropertyline);

        $onepropertyline = "CREATEDESKTOPLINK" . "\t" . "1" . "\n";	# Setting the default
        push(@{$propertyfile}, $onepropertyline);
    }

directory.pm
	+ 'add_root_directories' [ urgh ! ]
	+ $realproductkey = $productname . " " . $productversion;
		+ ho hum !
	+ this could be -impossibly- nasty ...
		+ can we change this at install time ? almost certainly not.
	+ $directorytableref ... -> !?
		+ what ...

* Director.idt
	./LibreOffice/msi/idt_files/en-US_pt-BR_de/00/Director.idt
	+ Two variables to clobber:
		+ 'OfficeMenuFolder' globals.pm ($officemenufolder)
	directory.pm:
	        $oneline = "$installer::globals::officemenufolder\t$installer::globals::programmenufolder\t$shortproductkey|$realproductkey\n";
        push(@{$directorytableref}, $oneline);

		+ 'INSTALLLOCATION' (?)


	* We run 'msidb.exe' on the directories with all these .idt files.
		( http://msdn.microsoft.com/en-us/library/aa370083%28v=vs.85%29.aspx )

	* Shortcut is localised ...
	* What about Director.idt ?
		+ (http://msdn.microsoft.com/en-us/library/aa368259%28v=vs.85%29.aspx )

	* how are the multiple Director.idt files created ?
		+ we run one make_installer.pl -l en-US_pt-BR_de
		+ eg.

	* bin/modules/installer/windows/admin.pm:
		# Get File.idt, Component.idt and Directory.idt from database
		my $tablelist = "File Directory Component Registry";
	* bin/modules/installer/windows/idtglobal.pm
		+ helps to builds some of the strings ...
		+ cf. prepare_language_idt_directory
		+ Wow (get_rtf_licensetext): convert to rtf !?
		* setbidiattributes
			+ interesting [!]

	* make_installer.pl - idt...
		@translationfiles (?)


... creating idt files ...
create_directory_foo to Q:/build/libreoffice-3.3.0.2/instsetoo_native/wntmsci12.pro/LibreOffice/msi/idt_files/de_en-US_pt-BR/00/Director.idt.de !!!
create_directory_foo to Q:/build/libreoffice-3.3.0.2/instsetoo_native/wntmsci12.pro/LibreOffice/msi/idt_files/de_en-US_pt-BR/00/Director.idt.en-US !!!
create_directory_foo to Q:/build/libreoffice-3.3.0.2/instsetoo_native/wntmsci12.pro/LibreOffice/msi/idt_files/de_en-US_pt-BR/00/Director.idt.pt-BR !!!
... copying idt files ...

We get this during the main build:
	+ from 




--------------------------------------------------------------------------------------------------------------------------------------------

Shortcut.idt-pt_BR [!]

        installer::windows::shortcut::create_shortcut_table($filesinproductlanguageresolvedarrayref, $linksinproductlanguageresolvedarrayref, $folderinproductlanguageresolvedarrayref, $folderitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, $newidtdir, $languagesarrayref, $includepatharrayref, \@iconfilecollector);

Shortcut	Directory_	Name	Component_	Target	Arguments	Description	Hotkey	Icon_	IconIndex	ShowCmd	WkDir
s72	s72	l128	s72	s72	S255	L255	I2	S72	I2	I2	S72
WINDOWSENCODINGTEMPLATE	Shortcut	Shortcut

gid_Folderitem_Sbase	OfficeMenuFolder	LIBREO~1|LibreOffice Base	g_f_exe_sbase__libreoffice3_program	[LibreOffice3_program]\sbase.exe		Gerencie bancos de dados, crie consultas e relatórios para rastrear e gerenciar suas informações por meio do Base.				1	LibreOffice3_Basis_program

	* get_shortcut_name() - passes in '$onelanguage' but simply does not use it [!]
		+ [ then again - get_shortcut_description does not either ]
		=> this is all pre-translated [ somehow ]

            if (! (!(( $onelink->{'ismultilingual'} )) || ( $onelink->{'specificlanguage'} eq $onelanguage )) )  { next; }
		+ $onelink comes from $linksref arg #2 to create_shortcut_table
			+ $linksinproductlanguageresolvedarrayref - from make_installer.pl [!]

        # First the links, defined in scp as ShortCut [!] ... hmm.

        # Second the entries into the start menu, defined in scp as Folder and Folderitem 
        # These shortcuts will fill the icons table.

		* So - we have:in setup_osl.ins:
			+ an un-translated Name [!] ...

FolderItem gid_Folderitem_Soffice_Desktop
	ComponentCondition = "CREATEDESKTOPLINK=1";
	ComponentIDFile = "gid_Brand_File_Desktophelper_Txt";
	FileID = gid_Brand_File_Bin_Soffice;
	FolderID = PREDEFINED_DESKTOP;
	IconFile = gid_Brand_File_Bin_Soffice;
	IconID = 0;
	ModuleID = gid_Module_Root;
	Name = "%PRODUCTNAME %PRODUCTVERSION";
	Parameter = "";
	Styles = (NOWEB,NON_ADVERTISED,USE_HELPER_FILENAME);
	Tooltip (af) = "LibreOffice, the office productivity suite provided by The Document Foundation. See http://www.documentfoundation.org";

scp_Copy_Readme_Txt has a per-language name translation
	+ Name (en-US) - etc....

	+ Can we have a Name and a manual Name (pt-BR) ? - I wonder.
		+ or just a Name (en-US) and a Name (pt-BR)
	* Attempt #1 - leave Name =, and add a Name (pt-BR) = - lets see.


	Registry.idt.pt-BR:
		+ similar issue:
		+ g_r_software_manufacturer_productname_productversion_capabilities_applicationname	-1	Software\LibreOffice\LibreOffice\3.3\Capabilities	ApplicationName	LibreOffice 3.3	g_m_root_registry_libreoffice33
			+ Lots of 'LibreOffice 3.3's in here ...

* code run during MSI install / de-install: [ interesting ]
		+ setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
			+ seems to be run during MSI install time [!] ?

	solenv/bin/modules/installer/globals.pm:    $officemenufolder = "OfficeMenuFolder";
	solenv/bin/modules/installer/worker.pm:    # The OfficeMenuFolder is defined as: $productname . " " . $productversion;

--------------------------------------------------------------------------------------------------------------------------------------------

* BrOffice MSI installer artwork:
	+ Componen.idt (?)
		+ backing_left.png, intro.png (?)
		+ File.idt - has all files mentioned in it.
	+ Binary.idt - ImageBmp -> Image.bmp and BannerBmp -> Banner.bmp
		+ Seems to be -per-language- already [!] - fun :-)
			+ where does Image.bmp come from (?)
				+ not the scp2 ... [!]
			+ How interesting [!]
				+ this is already duplicated in the build
				  tree per-language [!] (most odd).
		* comes from:
			+ instsetoo_native/inc_ooohelppack/windows/msi_templates/Binary.idt
			+ instsetoo_native/inc_ooohelppack/windows/msi_templates/Binary/Banner.bmp
			+ instsetoo_native/inc_ooohelppack/windows/msi_templates/Binary/Image.bmp
				* And for inc_openoffice ...
				+ [ ARGH - these are not in the default_images/brand/ directory ...
				    this should be fixed on master ... ;-]
			+ hack_msitemplates
				+ interesting [!] re-writes the source ...

		* passed into make_installer with -msitemplate=<directory>

solenv/bin/modules/installer/windows/idtglobal.pm:    # Copying all idt-files from the source $installer::globals::idttemplatepath to the destination $destinationdir


--------------------------------------------------------------------------------------------------------------------------------------------

	+ template pre-processing needs to substitute:
		+ 'is broffice' as a define ... - can we use it ?
	+ PRODUCT_PUBLISHER
	+ PRODUCT_WEBSITE
		+ set to Sun and http:// - still [!] wow ...
		+ cf. downloadtemplate.nsi
		+ PUBLISHERPLACEHOLDER
		+ WEBSITEPLACEHOLDER

* fix the install [!]
	+ incremental builds -should- work ...

* Thoughts:
	+ can we set the side-bar icon twice - and thus not have
	  to clobber the template ?

	+ we can clobber the branding after the fact:

!define MUI_CUSTOMFUNCTION_GUIINIT     SetupBranding
!define MUI_CUSTOMFUNCTION_UNGUIINIT   SetupBranding

Function SetupBranding
	File "/oname=$PLUGINSDIR\modern-header.bmp" ${MUI_HEADERIMAGE_BITMAP}
	File "/oname=$PLUGINSDIR\modern-bro-header.bmp" "Q:\build\libreoffice-3.2.99.3\solver\330\wntmsci12.pro\bin\brobanner.bmp"

	; use broffice specific branding if executable name begins BrOffice
	; cf. Sources/Build.cpp for list of built-in variable names
	StrCpy $0 $EXEFILE 8
	StrCmp $0 "BrOffice" BrOfficeSplash DefaultSplash

	DefaultSplash:
	       SetBrandingImage "$PLUGINSDIR\modern-header.bmp"
		GoTo atEnd
	BrOfficeSplash:
	       SetBrandingImage /IMGID=1046 "$PLUGINSDIR\modern-bro-header.bmp"
		GoTo atEnd
	atEnd:
FunctionEnd


# missing a call to: !insertmacro MUI_INSERT [!] ...

cf. http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html

** GetModuleFileName ...
	[ easier to test ? ... ;-]


		MUI_HEADERIMAGE_INIT (UNINSTALLER) as a param ...

	defined as: MUI_GUIINIT_BASIC ? ...


	* we do not want 'RESIZETOFIT' - we want this:

        File "/oname=$PLUGINSDIR\modern-header.bmp" "${MUI_HEADERIMAGE_${UNINSTALLER}
        SetBrandingImage /IMGID=1046 "$PLUGINSDIR\modern-header.bmp"

	System::Call 'kernel32::GetSystemDefaultLangID() i .r0'
	StrCmp $R0 "error" OldFashionedWay Finish
	\b Default $LANGUAGE value is now based on user's UI language instead
	of locale (\W{http://sourceforge.net/support/tracker.php?aid=1324734}{bug #1324734})




	* Do we build one of these per language ?
		perhaps it is pre-processed ?
		+ if so - we only need ~if


Notes on nsis installer - and bitmap foo ...
	+ script.cpp: update_bitmap (IDB_BITMAP1 ...)
		+ CheckBitmap foo ...
CheckBitmap "${NSISDIR}\Contrib\Graphics\Checks\classic-cross.bmp"
		+ this is just images to close the dialog [x] type things
		  ... in a strip.
		+ not the wizard bitmap


dialog:
"Please wait while setup is Loading" ... [ with libreoffice download logo ]

wizard:
"Thank you for downloading LibreOffice 3.3"
	instsetoo_native/inc_openoffice/windows/msi_languages/Nsis.ulf

	+ breaks in InstallOptions.dll ...

	Template built from:

solenv/bin/modules/installer/download.pm:        my $templatefilename = "downloadtemplate.nsi"
;

setup_native/prj/d.lst:..\source\win32\nsis\downloadtemplate.nsi %_DEST%\bin%_EXT%\downloadtemplate.nsi

* code is in setup_native/source/win32/nsis/
	+ fun !



!include "MUI.nsh"

...

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!define MUI_HEADERIMAGE_BITMAP BANNERBMPPLACEHOLDER
!define MUI_WELCOMEFINISHPAGE_BITMAP WELCOMEBMPPLACEHOLDER

solenv/bin/modules/installer/download.pm:    replace_one_variable($templatefile, "BANNERBMPPLACEHOLDER", $$completefilenameref);

inside put_banner_bmp_into_template [!]:
	include the path to the banner.bmp into nsi template [!]


      !insertmacro MUI_DEFAULT MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp"
		+ I guess - only sets the var if not already set [!]

** We already have the capability from MUI.nsh:
	-> Contrib/Modern UI/System.nsh
	+ to have an RTL bitmap instead:

      !ifdef MUI_HEADERIMAGE_BITMAP_RTL
        !ifndef MUI_HEADERIMAGE_UNBITMAP_RTL
          !define MUI_HEADERIMAGE_UNBITMAP_RTL "${MUI_HEADERIMAGE_BITMAP_RTL}"
          !ifdef MUI_HEADERIMAGE_BITMAP_RTL_NOSTRETCH
            !insertmacro MUI_SET MUI_HEADERIMAGE_UNBITMAP_RTL_NOSTRETCH
		** !defines this symbol ...


      !insertmacro MUI_DEFAULT MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp"



    !ifdef MUI_HEADERIMAGE_${UNINSTALLER}BITMAP_RTL

    StrCmp $(^RTL) 0 mui.headerimageinit_nortl

        File "/oname=$PLUGINSDIR\modern-header.bmp" "${MUI_HEADERIMAGE_${UNINSTALLER}BITMAP_RTL}"

        !ifndef MUI_HEADERIMAGE_${UNINSTALLER}BITMAP_RTL_NOSTRETCH
          SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\modern-header.bmp"
        !else
          SetBrandingImage /IMGID=1046 "$PLUGINSDIR\modern-header.bmp"
        !endif

        Goto mui.headerimageinit_done

      mui.headerimageinit_nortl:

	Sections like this seem to do the real donkey work ...
	'SetBrandingImage' ...


Source/tokens.cpp:{TOK_SETBRANDINGIMAGE,"SetBrandingImage",1,2,"[/IMGID=image_item_id_in_dialog] [/RESIZETOFIT] bitmap.bmp",TP_CODE},
	vs. AddBrandingImage ... [!?]




So ... it seems that the command to be using is SetBrandingImage:

!macro BIMAGE IMAGE PARMS
        Push $0
        GetTempFileName $0
        File /oname=$0 "${IMAGE}"
        SetBrandingImage ${PARMS} $0
        Delete $0
        Pop $0
!macroend

and it looks like all of this dynamic goodness is exported to the macro language quite nicely:

Section ""
        ; You can also use the BI_NEXT macro here...
        MessageBox MB_YESNO "We can change the branding image from within a section too!$\nDo you want me to change it?" IDNO done
                !insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Wizard\nsis.bmp" ""
        done:
        WriteUninstaller uninst.exe
SectionEnd

I suggest that we do a certain amount of in-lining of the (URGH!) awful MUI.nsh -> System.nsh logic; and/or if we can clobber this macro:

!macro MUI_HEADERIMAGE_INIT UNINSTALLER

to be a tad more clever.




--------------------------------------------------------------------------------------------------------------------------------------------

--------------- language pieces ---------------

* or how to detect what language we're using ...

const char *CEXEBuild::GetLangNameAndCP(LANGID lang, unsigned int *codepage/*=NULL*/) {
	+ hmm ... related to this ?
	+ win32's osl_getProcessLocale uses: GetUserDefaultLCID()
		+ and GetLocaleInfo with that id ...

    /* call GetLocaleInfo to retrieve the iso codes */
    if( GetLocaleInfo( localeId, LOCALE_SISO639LANGNAME , langCode, 4 )  &&
        GetLocaleInfo( localeId, LOCALE_SISO3166CTRYNAME , ctryCode, 4 ) )

	for pt_BR - first, second.


  {"KERNEL32", "GetUserDefaultUILanguage"},
	+ seems to call a similar function ...

exehead/Ui.c:

FORCE_INLINE int NSISCALL ui_doinstall(void)
{
  header *header = g_header;
  static WNDCLASS wc; // richedit subclassing and bgbg creation

  // detect default language
  // more information at:
  //   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_0xrn.asp

  LANGID (WINAPI *GUDUIL)();

  GUDUIL = myGetProcAddress(MGA_GetUserDefaultUILanguage);
  if (GUDUIL)
  {
    // Windows ME/2000+
    myitoa(state_language, GUDUIL());
	// Prints it as a %d to this string ...

	+ urk - generates a string of that number ... [ most odd ]

  // set default language
  set_language();

  ... which does a: ...

  LANGID lang=myatoi(state_language);

  * Beautiful ! *
	* this sets selected_langtable & cur_langtable - to the right entry ...

http://msdn.microsoft.com/en-us/library/dd318693%28v=VS.85%29.aspx

	* If this lang is 0x416 [ cf. myitoa ... ] == 1046 decimal
		** this is portugese_brazilian ... **


	* how can that be set / fetched from the script !?
		+ hmm [!] ...

--------------------------------------------------------------------------------------------------------------------------------------------

* ULF files are translated with:
	+ 'ulfex' ... from Localize.sdf ...
		+ uses an internal localise.sdf [ sub-setted ? ] ...

		+ comes from:
			+ Q:/build/libreoffice-3.3.0.1/solver/330/wntmsci12.pro/sdf/scp2.zip
			+ wow [!]

	+ localise/source/lngex.cxx
	* -but- the %PRODUCTNAME is still present in the translated output...

	* The substitution is done with download.pm (get_translation_file)'s
	  call to replace_variables ... on all the variables.
		+ ergo we just need to add PRODUCTNAME_BR to the mix.

	* [ ... nice ! ... ]

* .ulf files already have (broken) translation [!] 

* 'ulfconv' is used to create a .mlf file from a .ulf file
	+ setup_native/source/ulfconv/ ...
* this is used by pre2par.pl to translate .ulf -> .par


--------------------------------------------------------------------------------------------------------------------------------------------

* Bug #1
	+ 'LibreOffice_BR Writer' in the msi file installer text.
		+ NASTY ! - where does that get in ?
		+ need another perl fix.
		+ this is in the idt file substitution ... [!]

* Bug #2
	+ We have "LibreOffice 3.3 - Assistante" in the msi installer title [urk] ... 
	+ "Instalando o LibreOffice 3.3"


yeah, the perl is used to create the data-base tables in plain text
and then it is using the msidb.exe from Visual studio to create teh
msi database and makecab.exe to create the cab file from the Files
table

first information is http://en.wikipedia.org/wiki/Windows_Installer
it explains the structure


* NICE !

* inc_openoffice\windows\msi_languages\Control.ulf
	+ we have a [ProductName] substitution there ...

	* instsetoo_native/inc_openiffice/windows/msi_languages/Property.ulf
		+ still has *hard-coded* openoffice.org stuff ...

	* Where does that come from !?
		+ why substitute -so- late ?
		+ interesting.

inc_ooohelppack/windows/msi_templates/Property.idt
	+ we get translations from the .ulf files [ somehow ]
	+ *Looks* like the MSI branding artwork is already keyed from ProductName ;-)

* who localises .idt files !

===== main repo =====
solenv/bin/make_installer.pl:        # Attention: The table "Feature.idt" contains language specific strings -> parameter: $languagesarrayref !
solenv/bin/modules/installer/systemactions.pm:# Example: "Feature.idt.01" -> "Feature.idt"
solenv/bin/modules/installer/windows/feature.pm:# Creating the file Feature.idt dynamically
solenv/bin/modules/installer/windows/feature.pm:        my $featuretablename = $basedir . $installer::globals::separator . "Feature.idt" . "." . $onelanguage;
solenv/bin/modules/installer/windows/idtglobal.pm:    # Example: "Feature.idt.01"
solenv/bin/modules/installer/windows/idtglobal.pm:# CustomAc.idt, InstallU.idt, Feature.idt
solenv/bin/modules/installer/windows/idtglobal.pm:    my $featuretablename = $languageidtdir . $installer::globals::separator . "Feature.idt";
solenv/bin/modules/installer/windows/mergemodule.pm:# Reading the file "Feature.idt". The Feature, that is defined in scp
solenv/bin/modules/installer/windows/mergemodule.pm:    my $idtfilename = "Feature.idt";

solenv/bin/modules/installer/windows/property.pm:        ${$propertyfile}[$i] =~ s/\bPRODUCTNAMETEMPLATE\b/$productname/;


* property.pm/set_important_properties:
	+ fun !


* Properties are listed in the .idt file eg.

ARPHELPLINK     OOO_ARPHELPLINKTEMPLATE

And translated via the .ulf file:
[OOO_ARPHELPLINKTEMPLATE]

en-US = "http://www.openoffice.org"


** Check the ulf translation foo [!] ...

somewhen after: "Creating .idt files" ...

--------------------------------------------------------------------------------------------------------------------------------------------


*** ARGH ! ***
	+ sub replace_all_setupscriptvariables_in_script [!] ...

	+ we have all these built-in things: eg.
	+ they are substituted through: setupscript.pm [!]
		+ -and- we have no clue ...

		WITHOUTDOTUNIXPRODUCTNAME
			+ manufactured internally [!]
		PRODUCTNAME - built in ! ...
			and no PROUCTNAME_BR [ why !? ] ... wassup ?

	+ some variables come from setup_osl.ins' 'Installation' section.

	+ add_lowercase_productname_setupscript_variable .... ? - hmmm.	
		+ looks like it is moving stuff from openoffice.lst -> the variable hash

	+ vars come from: replace_all_setupscriptvariables_in_script ...

* dmake ooohelppack_pt-BR



--------------------------------------------------------------------------------------------------------------------------------------------
----- help packs -----

* why not lang-packs of a product with only help in it ?

* components/.../packinfo_office_help.txt
	+ we need to use this.
	+ So - the module = "..." is substituting for langpacks
	  but not helppacks. [!] ...
	+ as we read the .txt - we don't do that.

* solenv/bin/modules/installer/packagelist.pm
	+ reads the packinfo_...
	+ we're missing a lang specific tweak to module = I think ...
	+ missing a 'LANGUAGEMODULE' tag somewhere ?
		+ on a gid ? ...
