home *** CD-ROM | disk | FTP | other *** search
/ PhotoFinish 4.0 (French) / Photofinish-v4-FrenchVersion-Win31.iso / init.rul < prev    next >
Text File  |  1996-11-28  |  9KB  |  314 lines

  1. /*---------------------------------------------------------------------------*\
  2.  *
  3.  * Function:  Init
  4.  *
  5.  *  Purpose:  This function initializes global settings then initializes 
  6.  *              the screen.
  7.  *
  8.  *
  9.  *    Input:
  10.  *
  11.  *  Returns:
  12.  *
  13.  * Comments:
  14. \*---------------------------------------------------------------------------*/
  15. function Init()
  16.     STRING szBitmapFileName, svBitmapFileName;
  17. begin
  18.     
  19.     GetGlobalSystemInfo(); //Gets Platform etc.
  20.     SetupScreen();
  21.     
  22.     AppStrFromProfile( "SplashBitmapName", svBitmapFileName );
  23.     szBitmapFileName = SUPPORTDIR ^ svBitmapFileName;
  24.  
  25.     PlaceBitmap( szBitmapFileName, 12, CENTERED, CENTERED, CENTERED );
  26.     
  27.     ReplaceAutoExec(); //only does anything if we restarted after adding SHARE
  28.     
  29.     InitAppStrings();
  30.     CheckRequirements(); //Checks system req. for Product and/or 32s
  31.     Delay( 1 );
  32.  
  33.     PlaceBitmap( szBitmapFileName, 12, CENTERED, CENTERED, REMOVE );
  34.  
  35.  
  36.     Disable( BITMAPFADE );
  37.     //Disable logging here until after Win32s setup.
  38.     Disable( LOGGING );
  39.  
  40.     Enable( DIALOGCACHE );
  41.     
  42.  
  43. end;
  44.  
  45.  
  46.  
  47. /*---------------------------------------------------------------------------*\
  48.  *
  49.  * Function:  SetupScreen
  50.  *
  51.  *  Purpose:  This function will set up the screen look.  This includes
  52.  *              colors, fonts, text to be displayed, etc.
  53.  *              Displays Splash Screen, and calls Init, Then Gets System Info
  54.  *             and checks requirements.
  55.  *    Input:
  56.  *
  57.  *  Returns:
  58.  *
  59.  * Comments: Gets BackGround Title and Caption
  60. \*---------------------------------------------------------------------------*/
  61. function SetupScreen()
  62.     STRING szBitmapFileName;
  63. begin
  64.     
  65.     Enable( BITMAP256COLORS );
  66.     Enable( BITMAPFADE );
  67.     AppStrFromProfile( "BackgroundCaption", BACKGROUND_CAPTION );
  68.     AppStrFromProfile( "BackgroundTitle", BACKGROUND_TITLE );
  69.     SetTitle( BACKGROUND_CAPTION, 24, WHITE );
  70.     //SetColor( BACKGROUND, BK_BLUE ); // Dark blue.
  71.                                        // Default
  72.     SetTitle( BACKGROUND_TITLE, 0, BACKGROUNDCAPTION ); // Caption bar text.
  73.     
  74. end;
  75.  
  76. /*---------------------------------------------------------------------------*\
  77.  *
  78.  * Function:  GetGlobalSystemInfo
  79.  *
  80.  *  Purpose:  Gets system OS and Versions and sets Global variables:
  81.  *              nPlatform, bExplorer, nWin32sBuild
  82.  *            ISVersion, bNeed32s,  
  83.  *
  84.  *    Input:
  85.  *
  86.  *  Returns:
  87.  *
  88.  * Comments: Global vatiables used in Setup.rul and Instw32s.rul
  89.  *           _MyGetWin32sInfo in Inst32w32s.rul
  90. \*---------------------------------------------------------------------------*/
  91. function GetGlobalSystemInfo()
  92.     LIST VerInfo;
  93.     STRING sDLLName, sBuild, svPath, svVerInfo;
  94.     NUMBER nFileFound;
  95. begin
  96.     bExplorer = FALSE;
  97.     bNeed32s = FALSE;
  98.     bNo32s = FALSE;
  99.     nPlatform = 0;
  100.     nWin32sBuild = 0;
  101.     ISVersion = 0;
  102.     //Setup.ini should have 16on16=Y meaning ISVersion = 16 if we are in win3.1x
  103.     //with or without 32s.
  104.     GetSystemInfo( ISTYPE, ISVersion, svResult );
  105.     GetSystemInfo( OS, nPlatform, svResult );
  106.  
  107.     //Do this stuff for Win3.1 and Win32s
  108.     if( ISVersion = 16 || //but put in check here for after its installed.
  109.       (( nPlatform != IS_WINDOWSNT ) && ( nPlatform != IS_WINDOWS95 ))) then
  110.         if( ISVersion = 16 ) then
  111.         //Message in case we have to start over in 32-bit.
  112.             SdShowMsg( "", TRUE );
  113.         endif;
  114.         sDLLName = "W32SYS.DLL"; //Contains Win32s version info.
  115.         GetSystemInfo( WIN32SINSTALLED, nvResult, svResult );
  116.         if( nvResult = TRUE ) then //nPlatform = IS_WIN32S
  117.             nFileFound = VerFindFileVersion( sDLLName, svPath, svVerInfo );
  118.             if( nFileFound = FILE_NO_VERSION ) then
  119.                 bNeed32s = TRUE; //can't get version, must be old.
  120.             elseif( nFileFound = FILE_NOT_FOUND ) then
  121.                 bNeed32s = TRUE; //if this file isn't there
  122.                 bNo32s = TRUE; //WIN32SINSTALLED lied.
  123.             else
  124.                 VerInfo = ListCreate( STRINGLIST );
  125.                 StrGetTokens( VerInfo, svVerInfo, "." );
  126.                 if ( ListSetIndex( VerInfo, 2 ) = 0 ) then // O indicates it worked
  127.                     ListCurrentString( VerInfo, sBuild );
  128.                     StrToNum( nWin32sBuild, sBuild );
  129.                     if( nWin32sBuild < CURRENT_WIN32S_BUILD  ) then
  130.                         bNeed32s = TRUE;
  131.                     endif;
  132.                 else
  133.                     bNeed32s = TRUE;
  134.                 endif;
  135.             endif;
  136.         else
  137.             bNo32s = TRUE;
  138.             bNeed32s = TRUE;
  139.         endif;
  140.         if( ISVersion = 16 ) then
  141.         //Message in case we have to start over in 32-bit.
  142.             Delay(2);
  143.             SdShowMsg( "", FALSE );
  144.         endif;
  145.     else
  146.     //Do this stuff for Win95 and NT
  147.         GetSystemInfo( WINMAJOR, nvResult, svResult );
  148.         if( nvResult > 3 ) then
  149.             bExplorer = TRUE;
  150.         endif;
  151.     endif;
  152.     //Force 32 bit installer.
  153.     if( ISVersion = 16 && bNeed32s = FALSE ) then
  154. //        LaunchApp( SRCDIR ^ "Setup.exe", "-f32s" );
  155. //        exit;
  156.     else
  157.         Enable( BACKGROUND );
  158.     endif;
  159. end;
  160.  
  161. /*---------------------------------------------------------------------------*\
  162.  *
  163.  * Function:  InitAppStrings
  164.  *
  165.  *  Purpose:  This function initializes global settings. 
  166.  *
  167.  *
  168.  *    Input:
  169.  *
  170.  *  Returns:
  171.  *
  172.  * Comments: Calls InstallationInfo, and SdProductName
  173. \*---------------------------------------------------------------------------*/
  174. function InitAppStrings()
  175.  
  176. begin
  177.     if( ( nPlatform = IS_WINDOWS95 ) || ( nPlatform = IS_WINDOWSNT ) ) then
  178.         AppStrFromProfile( "DefaultPath", DEFAULT_PATH);
  179.     else
  180.         AppStrFromProfile( "DefaultPath16", DEFAULT_PATH);
  181.     endif;
  182.     AppStrFromProfile( "CompanyName", COMPANY_NAME );
  183.     AppStrFromProfile( "ProductName", PRODUCT_NAME );
  184.     AppStrFromProfile( "ProductVersion", PRODUCT_VERSION );
  185.     AppStrFromProfile( "ProductKey", PRODUCT_KEY );
  186.     
  187.     AppStrFromProfile( "DefaultFolder", DEFAULT_FOLDER );
  188.     AppStrFromProfile( "UninstallName", UNINSTALL_NAME );
  189.     AppStrFromProfile( "UninstallKey", UNINSTALL_KEY );
  190.     
  191.     InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
  192.     SdProductName( PRODUCT_NAME );
  193.     TARGETDIR = TARGETDISK ^ DEFAULT_PATH;
  194. end;
  195.  
  196. /*---------------------------------------------------------------------------*\
  197.  *
  198.  * Function:  CheckRequirements
  199.  *
  200.  *  Purpose:  Checks Requirements for installation 
  201.  *              including Win32s if necessary.
  202.  *
  203.  *    Input:
  204.  *
  205.  *  Returns: Exits through _ErrMsg() if fails
  206.  *
  207.  * Comments: calls _CheckSysRequirements() from Instw32s.rul for win32s, q.v.
  208.  *           Uses AppStr's REQ_RAM, REQ_PROCESSOR, REQ_DISPLAY
  209. \*---------------------------------------------------------------------------*/
  210. function CheckRequirements()
  211.     STRING svRequired, sSysMem;
  212.     NUMBER nvRequired, nSysMem;
  213. begin
  214.     if( bNeed32s ) then 
  215.         _CheckSysRequirements(); //for Win32s
  216.                                 //Deals with SHARE
  217.     endif;
  218.  
  219.     //Check Ram This don't werk rite
  220.     /*AppStrFromProfile( "REQ_RAM", svRequired );
  221.     StrToNum( nvRequired, svRequired );
  222.     GetSystemInfo( BASEMEMORY, nvResult, svResult );
  223.     nSysMem = nvResult;
  224.     GetSystemInfo( EXTENDEDMEMORY, nvResult, svResult );
  225.     nSysMem = nSysMem + nvResult;
  226.     if( nSysMem < ( nvRequired * 1000 ) ) then
  227.         _ErrYesNoMsg( "NotEnoughRam", svRequired );
  228.     endif;*/
  229.  
  230.     //Check Processor
  231.     AppStrFromProfile( "REQ_PROCESSOR", svRequired );
  232.     StrToNum( nvRequired, svRequired );
  233.     GetSystemInfo( CPU, nvResult, svResult );
  234.     //make sure its INTEL
  235.     if( ( nvResult = IS_ALPHA ) || ( nvResult = IS_MIPS ) || ( nvResult = IS_POWERPC ) ) then
  236.         _ErrMsg( "NotIntel", TRUE );
  237.     endif;
  238.     //Switch on Required processor.
  239.     switch( nvRequired )
  240.     case 286:
  241.         if( nvResult < IS_286 ) then
  242.             _ErrYesNoMsg( "NotProcessor", svRequired );
  243.         endif;
  244.     case 386:
  245.         if( nvResult < IS_386 ) then
  246.             _ErrYesNoMsg( "NotProcessor", svRequired );
  247.         endif;
  248.     case 486:
  249.         if( nvResult < IS_486 ) then
  250.             _ErrYesNoMsg( "NotProcessor", svRequired );
  251.         endif;
  252.     case 586:
  253.         if( nvResult < IS_PENTIUM ) then
  254.             _ErrYesNoMsg( "NotProcessor", svRequired );
  255.         endif;
  256.     default:
  257.         _ErrMsg( "CantTellProcessor", FALSE );
  258.     endswitch; 
  259.     
  260.  
  261.     //Check Display
  262.     AppStrFromProfile( "REQ_DISPLAY", svRequired );
  263.     StrToUpper( svRequired, svRequired );
  264.     if( svRequired = "EGA" ) then
  265.         nvRequired = IS_EGA;
  266.     elseif( svRequired = "VGA" ) then
  267.         nvRequired = IS_VGA;
  268.     elseif( svRequired = "SVGA" ) then
  269.         nvRequired = IS_SVGA;
  270.     elseif( svRequired = "XVGA" ) then
  271.         nvRequired = IS_XVGA;
  272.     elseif( svRequired = "UVGA" ) then
  273.         nvRequired = IS_UVGA;
  274.     endif;
  275.     GetSystemInfo( VIDEO, nvResult, svResult );
  276.     if( nvResult < nvRequired ) then
  277.         _ErrYesNoMsg( "NotDisplay", svRequired );
  278.     endif;
  279. end;
  280.  
  281.  
  282. /*---------------------------------------------------------------------------*\
  283.  *
  284.  * Function:  ReplaceAutoExec
  285.  *
  286.  *  Purpose:  Replaces the Autoexec file if we restarted after adding share.
  287.  *
  288.  *    Input:
  289.  *
  290.  *  Returns: 
  291.  *
  292.  * Comments: if we restarted after adding share, there will be a file called
  293.  *           teakles.glb. replace autoexec with that. see SetupShare()
  294. \*---------------------------------------------------------------------------*/
  295. function ReplaceAutoExec()
  296.     STRING svFileName, svPath, szFileName, svReturn;
  297.     LIST listAutoExec;
  298. begin
  299.     BatchGetFileName( svFileName );
  300.     ParsePath( svPath, svFileName, PATH );
  301.     szFileName = "teakles.glb";
  302.     if( FindFile( svPath, szFileName, svResult ) = 0 ) then
  303.         listAutoExec = ListCreate( STRINGLIST );
  304.         szFileName = svPath ^ szFileName;
  305.         ListReadFromFile( listAutoExec, szFileName );
  306.         ListWriteToFile( listAutoExec, svFileName );
  307.         VarSave( SRCTARGETDIR );
  308.         TARGETDIR = svPath;
  309.         DeleteFile( "teakles.glb" );
  310.         VarRestore( SRCTARGETDIR );
  311.     endif;
  312. end;
  313.  
  314.