コード例 #1
0
ファイル: screen.c プロジェクト: TimofonicJunkRoom/plucker
/* Restore screen mode ( PalmOS 3.x ) */
void SetDefaultScreenModeOS3
    (
    Boolean save    /* store screen depth */
    )
{
    WinScreenMode( winScreenModeGetDefaults, &screenWidth, &screenHeight,
        &screenDepth, NULL );
    WinScreenMode( winScreenModeSetToDefaults, NULL, NULL, NULL, NULL );
    if ( save )
        Prefs()->screenDepth = screenDepth;
}
コード例 #2
0
ファイル: Atlas.c プロジェクト: openmobl/Atlas
static void DisplayInitDepth(Boolean start) // set start to false on AppStop, true on AppStart
{
	Err 		error;
	UInt32 		depthP;

	if (start) {   // AppStart
		error = WinScreenMode(winScreenModeGetSupportedDepths, NULL, NULL, &depthP, NULL);
		if ((error == errNone) && (depthP & 0x8000)) {
			depthP = 16;
			WinScreenMode(winScreenModeSet, NULL, NULL, &depthP, NULL);
		}
	} else {        // AppStop
		WinScreenMode(winScreenModeSetToDefaults, NULL, NULL, NULL, NULL);
	}

	return;
}
コード例 #3
0
ファイル: sony_support.c プロジェクト: petesh/pocketcity
Err
_WinScreenMode(WinScreenModeOperation op, UInt32 *width, UInt32 *height,
    UInt32 *depth, Boolean *enableColor)
{
	if (hires)
		return (HRWinScreenMode(hires, op, width, height, depth,
		    enableColor));
	else
		return (WinScreenMode(op, width, height, depth, enableColor));
}
コード例 #4
0
ファイル: os.c プロジェクト: TimofonicJunkRoom/plucker-1
/* PalmOS 3.0 or higher specific operations */
static void OS30( void )
{
    Err     err;
    UInt32  vfsMgrVersion;
    UInt32  supportedDepths;
    UInt16  i;

    WinScreenMode( winScreenModeGetSupportedDepths, NULL, NULL,
        &supportedDepths, NULL );

    for ( i = 1; supportedDepths != 0; i++ ) {
        if (( supportedDepths & 0x01 ) == 0x01 ) {
            maxBitDepth = i;
        }
        supportedDepths >>= 1;
    }

    /* Palm OS is smart enough to format an image for a higher bitdepth
       than the device might support */
    if ( maxBitDepth < 2 )
    {
        maxBitDepth = 2;
    }

    SetForeColor        = SetForeColor_OS3;
    SaveDrawState       = SaveDrawState_OS3;
    RestoreDrawState    = RestoreDrawState_OS3;

    SetScreenMode           = SetScreenModeOS3;
    SetDefaultScreenMode    = SetDefaultScreenModeOS3;

    supportBeam = true; /* TODO: Add check for beam support since it
                           could be missing on an OS3+ device */

   err = ZLSetup;
   if ( err == errNone ) {
        supportZLib = true;
    }
    else {
        supportZLib = false;
    }

#ifdef HAVE_AXXPAC
    err = InitializeAxxPac();
    if ( err != errNone )
#endif
    err = FtrGet( sysFileCVFSMgr, vfsFtrIDVersion, &vfsMgrVersion );
    if ( err == errNone ) {
        supportVFS = true;
    }
    else {
        supportVFS = false;
    }

    LoadCustomFonts( STANDARD_FONTS );

    /* confirm that we are using 8 bit chars */
    if ( uses8BitChars ) {
        err = FtrGet( sysFtrCreator, sysFtrNumEncoding, &charEncoding );
        if ( err != errNone )
            charEncoding = charEncodingPalmLatin;  /* default encoding */
        else if ( charEncodingPalmLatin < charEncoding )
            uses8BitChars = false;
    }
}
コード例 #5
0
ファイル: xfer.c プロジェクト: jemyzhang/DiddleBug
/*
** DrawPlugButton
*/
void DrawPlugButton(DynamicButtonType* btn) {
  Char str[48], str2[48];
  Int16 i = -1;
  WinHandle oldH = WinSetDrawWindow(btn->content.bmpW);

  /* Set up draw state */
  WinPushDrawState();
  WinSetBackColor(0); /* otherwise the pixels will not count as "off" */

  if (d.xfer.pluglistH && ((i = GetCurrentXferAppListIndex()) != -1)) {
    BitmapType* bmp = NULL;
    BitmapTypeV3* bmpV3 = NULL;
    WinHandle tmpH = NULL;
    Coord x, y;
    UInt32 depth;
    Err err = errNone;

    /* Hi-res 1-bpp-bug-workaround, part 1 */
    if (d.hires && !d.sonyClie) {
      /* Create a new temporary bitmap with screen depth */
      BmpGetDimensions(btn->bmp, &x, &y, NULL);
      WinScreenMode(winScreenModeGet, NULL, NULL, &depth, NULL);
      bmp = BmpCreate(x, y, depth, NULL, &err);
      if (err) abort();

      /* ...make it a double density bitmap */
      bmpV3 = BmpCreateBitmapV3(bmp, kDensityDouble, BmpGetBits(bmp), NULL);

      /* ...and create a temporary window */
      tmpH = WinCreateBitmapWindow((BitmapType*) bmpV3, &err);
      if (err) abort();

      /* Draw to temporary window for the time being... */
      WinSetDrawWindow(tmpH);

      /* ...and set the right foreground color */
      WinSetForeColor(WinRGBToIndex(&black));
    }

    /* Get the plugin icon and draw it */
    DrawPlugBitmap(i, boogerID_button, 0, 0);

    /* Hi-res 1-bpp-bug-workaround, part 2 */
    if (d.hires && !d.sonyClie) {
      /* Copy the icon to the actual button */
      WinSetDrawWindow(btn->content.bmpW);
      WinPaintBitmap(WinGetBitmap(tmpH), 0, 0);

      /* Clean up */
      if (tmpH) WinDeleteWindow(tmpH, false);
      if (bmpV3) BmpDelete((BitmapType*) bmpV3);
      if (bmp) BmpDelete(bmp);
    }

    /* Load "goto" behavior */
    GetPlugString(i, boogerID_gotobehavior, str);
    if (StrChr(str, 'n')) 
      xferGotoSetNever();
    else if (StrChr(str, 'a')) 
      xferGotoSetAlways();
    else
      xferGotoClear();

    /* Load "completion" behaviour ("completion" is never on by default (yet)) */
    GetPlugString(i, boogerID_completebehavior, str2);
    if (StrChr(str2, 'a')) 
      xferCompleteSetAlways();
    else if (StrChr(str2, 'o')) 
      xferCompleteClear();
    else
      xferCompleteSetNever();
  } else {
    DrawBitmap(XferNoAppBitmap, 0, 0);
    xferGotoClear();
    xferCompleteClear();
  }

  /* Restore old draw window & state */
  WinPopDrawState();
  WinSetDrawWindow(oldH);
}
コード例 #6
0
ファイル: screen.c プロジェクト: TimofonicJunkRoom/plucker
/* Set screen bit depth for PalmOS3 */
void SetScreenModeOS3( void )
{
    Err     err;
    UInt16  activeFormID;
    Boolean resolutionChanged;
    Boolean depthChanged;

    if ( screenDepth == Prefs()->screenDepth &&
         screenHiRes == HiResType() )
        return;

    resolutionChanged = false;
    depthChanged      = false;

    /* Since HiResType() is set to unknownHiRes by default, the following two
       if statements will both return true to at least give HiResInitialize()
       the benifit of the doubt and the chance to initialize itself. If it
       cannot, then HiResType() is set to noHiRes, and no further attempts
       are made during the course of this session of the viewer */
    if ( ! IsHiResTypeNone( HiResType() ) ) {
        if ( IsHiResTypeNone( screenHiRes ) ) {
            err = HiResInitialize();
            if ( err == errNone )
                resolutionChanged = true;
            else if ( HiResStop != NULL )
                HiResStop();
        }
    }

    /* By default screenDepth is set to 0 when there aren't any preferences.
       Find the true default at this point instead of later on after falsly
       causing a display error */
    if ( Prefs()->screenDepth == 0 )
        SetDefaultScreenMode( true );

    /* Figure out the best resolution for this device */
    if ( ! forceDefaultScreen ) {
        HiRes hiResType;

        hiResType = HiResType();

        if ( IsHiResTypePalm( hiResType ) ) {
            err = WinScreenGetAttribute( winScreenHeight, &screenHeight );
            if ( err != errNone )
                screenHeight = PALM_SCREEN_HEIGHT;
            err = WinScreenGetAttribute( winScreenWidth, &screenWidth );
            if ( err != errNone )
                screenWidth  = PALM_SCREEN_WIDTH;
        }
        else if ( IsHiResTypeSony( hiResType ) ) {
            screenHeight = SONY_SCREEN_HEIGHT;
            screenWidth  = SONY_SCREEN_WIDTH;
        }
        else if ( IsHiResTypeHandera( hiResType ) ) {
            screenHeight = HANDERA_SCREEN_HEIGHT;
            screenWidth  = HANDERA_SCREEN_WIDTH;
        }
        else {
            screenHeight = NORMAL_SCREEN_HEIGHT;
            screenWidth  = NORMAL_SCREEN_WIDTH;
        }
    }

    /* If we no longer want hires... */
    if ( IsHiResTypeNone( HiResType() ) ) {
        /* ... and are currently in a hires mode, hires needs to be disabled */
        if ( ! IsHiResTypeNone( screenHiRes ) ) {
            if ( HiResStop != NULL )
                HiResStop();
            resolutionChanged = true;
        }
    }

    if ( screenDepth != Prefs()->screenDepth )
        depthChanged = true;

    screenDepth = Prefs()->screenDepth;
    screenHiRes = HiResType();

    MSG( _( "Setting screen to %ldx%ldx%ld\n", screenWidth, screenHeight,
        screenDepth ) );

    /* Handera dislikes being told what to set the values for
       screenWidth and screenHeight, so let it think what it wants */
    if ( IsHiResTypeHandera( HiResType() ) ) {
        err = WinScreenMode( winScreenModeSet, NULL, NULL,
            &screenDepth, NULL );
    }
    else {
        UInt16  prevCoordSys;

        prevCoordSys   = PalmSetCoordinateSystem( NATIVE );
        err = WinScreenMode( winScreenModeSet, &screenWidth, &screenHeight,
                  &screenDepth, NULL );
        if ( err != errNone ) {
            WinScreenMode( winScreenModeGetDefaults, &screenWidth, &screenHeight,
                NULL, NULL );
            err = WinScreenMode( winScreenModeSet, &screenWidth, &screenHeight,
                      &screenDepth, NULL );
        }
        PalmSetCoordinateSystem( prevCoordSys );
    }

    /* If we're having problems, set to hardware's default resolution */
    if ( err != errNone ) {
        MSG( _( "Unsuccessful. Trying 'safe' default values.\n" ) );
        if ( HiResStop != NULL )
            HiResStop();
        screenHiRes = noHiRes;

        SetDefaultScreenMode( true );
        resolutionChanged = true; /* assume it has */
        forceDefaultScreen = true;

        MSG( _( "Setting screen to %ldx%ldx%ld\n", screenWidth, screenHeight,
            screenDepth ) );
    }
    activeFormID = FrmGetActiveFormID();
    if ( IsVisibleToolbar( activeFormID ) ) {
        FrmEraseForm( FrmGetFormPtr( activeFormID ) );
        MainFormInit();
    }

    if ( resolutionChanged ) {
        SetHiResFunctions();
        InitializeViewportBoundaries();
    }

    if ( depthChanged ) {
        HanderaResetSilkScreen();
        ResetCache();
    }
    SetFontFunctions();
}
コード例 #7
0
ファイル: gmi.c プロジェクト: miellaby/v4p
// Definition of Function : SetScreenMode
void SetScreenMode(int bpp)
{
   UInt32 requestedDepth=bpp;
   WinScreenMode(winScreenModeSet,NULL,NULL,&requestedDepth,NULL);
}
コード例 #8
0
ファイル: gmi.c プロジェクト: miellaby/v4p
EVENT GM_OnTerminate(EventPtr event)
{
  WinScreenMode(winScreenModeSetToDefaults,NULL,NULL,NULL,NULL);
   return false;
}