Ignore:
Timestamp:
Nov 21, 2007, 1:32:50 PM (18 years ago)
Author:
lpino
Message:
  • Fixes some problems loading the splash window. It doesn't load the eclipse platform yet
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/platform-launcher/library/pm/eclipseOs2.c

    r28 r40  
    1 /* $Id: os2_eclipse.c,v 1.1 2002/07/10 04:28:02 phaller Exp $ */
    2 
    3 /*
    4  * Contributed by Mark Hale
    5  */
    61
    72#include "eclipseOS.h"
     
    3530#define SPLASH_WINDOW_ID 100
    3631#define MSG_BOX_ID 11
    37 #define BMP_SPLASH_BITMAP 501
    3832
    3933/* Define local variables for running the JVM and detecting its exit. */
     
    5246static void      splashTimeout(void);
    5347static MRESULT EXPENTRY clientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    54 
    5548
    5649/*
     
    163156    return (ERROR_INVALID_PARAMETER);                /* Fehler signalisieren */
    164157
    165 
    166158        /* Find out how big the file is, allocate that much memory, and read */
    167159                                                    /* in the entire bitmap. */
     
    337329  HPS     hps = WinGetScreenPS( HWND_DESKTOP );
    338330  HBITMAP hbmp;
    339   APIRET  rc = BmpRead(hps,
     331  APIRET  rc = BmpReadFile(hps,
    340332                       featureImage,
    341333                       &hbmp);
     
    349341
    350342
    351 
    352 
    353343/* Display a Message */
    354344void displayMessage( char* message )
    355345{
    356   WinMessageBox(HWND_DESKTOP,
    357                 hwndFrame,
    358                 message,
    359                 NULL,
    360                 MSG_BOX_ID,
    361                 MB_OK | MB_MOVEABLE);
     346   WinMessageBox( HWND_DESKTOP, hwndFrame, message, NULL, MSG_BOX_ID, MB_OK );
    362347}
    363348
     
    436421   DevQueryCaps(hDC, CAPS_COLOR_PLANES, 2, devCaps);
    437422   depth = devCaps[0] * devCaps[1];
     423
    438424    if (featureImage != NULL)
    439425        hBitmap = MMLoadBitmap(hab, featureImage);
    440 
    441426    /* If the bitmap could not be found, try again using the install directory. */
    442427    if (hBitmap == NULLHANDLE)
    443         hBitmap = loadSplashImage( homeDir, depth <= LO_RES_DEPTH ? loResSplash : hiResSplash );
    444 
     428         hBitmap = loadSplashImage( homeDir, depth <= LO_RES_DEPTH ? loResSplash : hiResSplash );
    445429    /* If the bitmap could not be found, return an error. */
    446430    if (hBitmap == NULLHANDLE)
     
    562546static HBITMAP loadSplashImage(char* baseDir, char *fileName)
    563547{
    564   HBITMAP hBitmap = NULLHANDLE;
    565   char *langEnvVar;
    566   char lang[4] = {0};
    567   char country[4] = {0};
    568   char *splashFile;
    569 
    570   langEnvVar = getenv("LANG");
    571   if(langEnvVar != NULL && strlen(langEnvVar) == 5) {
    572     lang[0] = langEnvVar[0];
    573     lang[1] = langEnvVar[1];
    574     lang[2] = '\0';
    575     country[0] = langEnvVar[3];
    576     country[1] = langEnvVar[4];
    577     country[2] = '\0';
    578   }
    579 
    580   splashFile = malloc ( strlen( baseDir ) + 256 );
    581 
    582   sprintf( splashFile, "%s\\splash\\%s_%s\\%s", baseDir, lang, country, fileName );
    583   hBitmap = MMLoadBitmap(hab, splashFile);
    584   if(hBitmap == NULLHANDLE) {
    585     sprintf( splashFile, "%s\\splash\\%s\\%s", baseDir, lang, fileName );
    586     hBitmap = MMLoadBitmap(hab, splashFile);
    587   }
    588 
    589   if(hBitmap == NULLHANDLE) {
    590     sprintf( splashFile, "%s\\splash\\%s", baseDir, fileName );
    591     hBitmap = MMLoadBitmap(hab, splashFile);
    592   }
    593 
    594   // load bitmap from resource table
    595   {
    596     HPS     hps = WinGetScreenPS( HWND_DESKTOP );
    597     hBitmap = GpiLoadBitmap(hps,
    598                             (HMODULE)NULLHANDLE,
    599                             BMP_SPLASH_BITMAP,
    600                             0,
    601                             0);
    602     WinReleasePS( hps );
    603   }
    604 
    605 
    606   free (splashFile);
    607   return hBitmap;
     548        HBITMAP hBitmap = NULLHANDLE;
     549        char *langEnvVar;
     550        char lang[4] = {0};
     551        char country[4] = {0};
     552        char *splashFile;
     553
     554   langEnvVar = getenv("LANG");
     555   if(langEnvVar != NULL && strlen(langEnvVar) == 5) {
     556      lang[0] = langEnvVar[0];
     557      lang[1] = langEnvVar[1];
     558      lang[2] = '\0';
     559      country[0] = langEnvVar[3];
     560      country[1] = langEnvVar[4];
     561      country[2] = '\0';
     562   }
     563
     564   splashFile = malloc ( strlen( baseDir ) + 256 );
     565
     566   sprintf( splashFile, "%s\\splash\\%s_%s\\%s", baseDir, lang, country, fileName );
     567   hBitmap = MMLoadBitmap(hab, splashFile);
     568   if(hBitmap == NULLHANDLE) {
     569      sprintf( splashFile, "%s\\splash\\%s\\%s", baseDir, lang, fileName );
     570      hBitmap = MMLoadBitmap(hab, splashFile);
     571   }
     572
     573   if(hBitmap == NULLHANDLE) {
     574      sprintf( splashFile, "%s\\splash\\%s", baseDir, fileName );
     575      hBitmap = MMLoadBitmap(hab, splashFile);
     576   }
     577
     578   free (splashFile);
     579   return hBitmap;
    608580}
    609581
     
    630602}
    631603
    632 
    633 /*****************************************************************************
    634  * Name      : char* findCommandOS2
    635  * Purpose   : Scan environment and system configuration for a given command
    636  * Parameter : char* pszCommand
    637  * Variables :
    638  * Result    : NULL if not found,
    639  *             fully qualified name otherwise
    640  * Remark    : The method is mainly used to determine which javaw.exe to start,
    641  *             Eclipse expects the following priorisation:
    642  *             1 - %ECLIPSE%\jre\bin\javaw.exe
    643  *             :
    644  *             :
    645  *             2 - HINIUSER\Java131\USER_HOME -> javaw.exe
    646  *             3 - HINIUSER\Java13\USER_HOME -> javaw.exe
    647  *             4 - %PATH% -> javaw.exe
    648  *
    649  * Author    : Patrick Haller 2002-07-10
    650  *****************************************************************************/
    651 
    652 char*  findCommandOS2( char* command )
    653 {
    654   // @@@PH not yet implemented
    655   return NULL;
    656 }
    657 
    658 /*
    659  * $Log: os2_eclipse.c,v $
    660  * Revision 1.1  2002/07/10 04:28:02  phaller
    661  * Added Mark Hale's launcher code
    662  *
    663  */
Note: See TracChangeset for help on using the changeset viewer.