void InitAsset() { #ifdef GNAV #ifdef FORCEPORTRAIT // JMW testing only for portrait mode of Altair RotateScreen(); #endif #endif // VENTA2- delete registries at startup, but not on PC! #if defined(FIVV) && ( !defined(WINDOWSPC) || WINDOWSPC==0 ) #ifndef PNA RegDeleteKey(HKEY_CURRENT_USER, _T(REGKEYNAME)); #endif #endif #ifdef PNA // VENTA2-ADDON MODEL TYPE /* LocalPath is called for the very first time by CreateDirectoryIfAbsent. In order to be able in the future to behave differently for each PNA device and maybe also for common PDAs, we need to know the PNA/PDA Model Type BEFORE calling LocalPath. This was critical. */ SmartGlobalModelType(); // First we check the exec filename, which // has priority over registry values if (!_tcscmp(GlobalModelName, _T("UNKNOWN"))) // Then if there is no smart name... SetModelType(); // get the modeltype from // the registry as usual #endif // VENTA2- TODO fix these directories are not used always! CreateDirectoryIfAbsent(TEXT("")); // RLD make sure the LocalPath folder actually exists CreateDirectoryIfAbsent(TEXT("persist")); CreateDirectoryIfAbsent(TEXT("logs")); CreateDirectoryIfAbsent(TEXT("config")); // VENTA2-ADDON install fonts on PDAs and check XCSoarData existance #if defined(FIVV) && ( !defined(WINDOWSPC) || WINDOWSPC==0 ) //#ifndef PNA bool datadir=CheckDataDir(); if (datadir) StartupStore(TEXT("XCSoarData directory found.\n")); else StartupStore(TEXT("ERROR: NO XCSOARDATA DIRECTORY FOUND!\n")); StartupStore(TEXT("Check for installing fonts\n")); short didfonts=InstallFonts(); // check if really did it, and maybe restart TCHAR nTmp[100]; _stprintf(nTmp,TEXT("InstallFonts() result=%d (0=installed >0 not installed)\n"), didfonts); StartupStore(nTmp); //#endif #endif StartupLogFreeRamAndStorage(); }
/* EXPORT-> MakeXGraf: Connect to the X-server and init globals */ void MakeXGraf(char *wname, int x, int y, int w, int h, int bw) { char sbuf[MAXSTRLEN], *hgraf = "HGraf"; Window window, parent; XSetWindowAttributes setwinattr; unsigned long vmask; if (winCreated) HError(6870, "MakeXGraf: Attempt to recreate the graphics window"); if ((theDisp = XOpenDisplay(NULL)) == NULL) HError(6870, "MakeXGraf: cannot connect to X server %s", XDisplayName(NULL)); InitGlobals(); InstallFonts(); InstallColours(); parent = RootWindow(theDisp, theScreen); window = XCreateSimpleWindow(theDisp, parent, x, y, w, h, bw, black, white ); /* allow for backing up the contents of the window */ vmask = CWBackingStore; setwinattr.backing_store = WhenMapped; XChangeWindowAttributes(theDisp, window, vmask, &setwinattr); /* set the size hints for the window manager */ hints.flags = PPosition | PSize | PMaxSize | PMinSize; hints.y = y; hints.x = x; hints.width = w; hints.height = h; hints.min_width = w; hints.min_height = h; hints.max_width = w; hints.max_height = h; /* compose the name of the window */ strcpy(sbuf, hgraf); strcat(sbuf, ": "); strcat(sbuf, wname); XSetStandardProperties(theDisp, window, sbuf, hgraf, None, NULL, 0, &hints); /* select events to receive */ XSelectInput(theDisp, window, ExposureMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask | PointerMotionHintMask | PointerMotionMask); XMapWindow(theDisp, theWindow = window); InitGCs(); HSetXMode(GCOPY); HSetFontSize(0); HSetLineWidth(0); HSetColour(BLACK); /* wait for the first expose event - cannot draw before it has arrived */ do XNextEvent(theDisp, &report); while (report.type != Expose); XSendEvent(theDisp,window,False,ExposureMask,&report); /* Create heap for buttons */ CreateHeap(&btnHeap, "Button heap", MHEAP, sizeof(HButton), 1.0, 100, 100); winCreated = TRUE; }