コード例 #1
0
ファイル: device_info.cpp プロジェクト: kjk/noah-palm
static Boolean fIsTreo()
{
    UInt32 rom = 0, hal = 0, company = 0, device = 0, hsFtrVersion;

    UInt32 requiredVersion = sysMakeROMVersion(5,0,0,sysROMStageRelease,0);
    if (FtrGet (hsFtrCreator, hsFtrIDVersion, &hsFtrVersion) != 0)
        return false;

    FtrGet (sysFtrCreator, sysFtrNumOEMHALID, &hal);
    FtrGet (sysFtrCreator, sysFtrNumOEMCompanyID, &company);
    FtrGet (sysFtrCreator, sysFtrNumOEMDeviceID, &device);
    FtrGet (sysFtrCreator, sysFtrNumROMVersion, &rom);
    if (device == hsDeviceIDOs5Device1Sim)
    {
        // doesn't work on simulator
        return false;
    }

    if (    rom       >= requiredVersion
        &&  company   == hwrOEMCompanyIDHandspring     
        &&  device    == hsDeviceIDOs5Device1
        &&  (   hal   == hsHALIDHandspringOs5Rev1
             || hal   == hsHALIDHandspringOs5Rev1Sim) )
    {
        return true;
    }

    return false;
}
コード例 #2
0
ファイル: os.c プロジェクト: TimofonicJunkRoom/plucker-1
/* PalmOS 4.x or higher specific operations */
static void OS4( void )
{
    Err    err;
    UInt32 version;
    UInt32 empty;

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

    if ( ( FtrGet( 'grft', 1110, &empty ) == errNone ) ||
         ( FtrGet( 'grf2', 1110, &empty ) == errNone ) )
        supportGraffiti2 = true;
    else
        supportGraffiti2 = false;

    supportedCompression |= ( 1 << BitmapCompressionTypePackBits );

    err = FtrGet( sysFtrCreator, sysFtrNumWinVersion, &version );

    supportHighDensity = ( err == errNone &&
                             HIGH_DENSITY_FEATURE_SET_VERSION <= version );
}
コード例 #3
0
ファイル: dynamic_input_area.c プロジェクト: kjk/noah-palm
Err DIA_Init(DIA_Settings* diaSettings) 
{
    UInt16      cardNo;
    LocalID     localId;
    UInt32      value;
    Err         error;
    Err         tmpErr;

    Assert(diaSettings);
    MemSet(diaSettings, sizeof(*diaSettings), 0);
    
    error=SonySilkLibInit(diaSettings);
    if (error) 
        goto OnError;

    if (!DIA_HasSonySilkLib(diaSettings))
    {
        if ( 0==FtrGet(pinCreator, pinFtrAPIVersion, &value) )
        {
            if ( 0!=value )
                DIA_SetFlag(diaSettings, diaHasPenInputMgr);
        }
    }
    if (!FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &value) && value)
    {
        error=SysCurAppDatabase(&cardNo, &localId);
        if (error)
            goto OnError;

        if (DIA_HasPenInputMgr(diaSettings)) 
        {
            error=SysNotifyRegister(cardNo, localId, sysNotifyDisplayResizedEvent, NULL, sysNotifyNormalPriority, NULL);
            if (sysNotifyErrDuplicateEntry==error) 
                error=errNone;
            if (error)
                goto OnError;
            DIA_SetFlag(diaSettings, diaRegisteredDisplayResizeNotify);
        }

        if (DIA_HasSonySilkLib(diaSettings))
        {
            error=SysNotifyRegister(cardNo, localId, sysNotifyDisplayChangeEvent, NULL, sysNotifyNormalPriority, NULL);
            if (sysNotifyErrDuplicateEntry==error) 
                error=errNone;
            if (error)
                goto OnError;
            DIA_SetFlag(diaSettings, diaRegisteredDisplayChangeNotify);
        }

    }
Exit:
    return error;
OnError:
    if (DIA_HasSonySilkLib(diaSettings))
    {
        tmpErr=SonySilkLibFree(diaSettings);
        if (tmpErr) error=tmpErr;
    }
    goto Exit;
}
コード例 #4
0
ファイル: dynamic_input_area.c プロジェクト: kjk/noah-palm
/**
 * Performs detection and initialization of Sony CLIE-specific features.
 * @param diaSettings structure used to store detected configuration.
 * @return error code.
 */
static Err SonySilkLibInit(DIA_Settings* diaSettings) 
{
    UInt32  vskVersion=0;
    Err     error=SysLibFind(sonySysLibNameSilk, &diaSettings->sonySilkLibRefNum);

    if (sysErrLibNotFound==error) {
        error=SysLibLoad('libr', sonySysFileCSilkLib, &diaSettings->sonySilkLibRefNum);
        if (!error) DIA_SetFlag(diaSettings, diaLoadedSonySilkLib);
    }
    if (!error) {
        DIA_SetFlag(diaSettings, diaHasSonySilkLib);
        error = FtrGet(sonySysFtrCreator, sonySysFtrNumVskVersion, &vskVersion);
        if (error) {
            error=SilkLibOpen(diaSettings->sonySilkLibRefNum);
            if (error) goto OnError;
            SilkLibEnableResize(diaSettings->sonySilkLibRefNum);
        }
        else if (vskVersionNum2==vskVersion) {
            error=VskOpen(diaSettings->sonySilkLibRefNum);
            if (error) goto OnError;
            VskSetState(diaSettings->sonySilkLibRefNum, vskStateEnable, vskResizeVertically);			
        }
        else {
            error=VskOpen(diaSettings->sonySilkLibRefNum);
            if (error) goto OnError;
            VskSetState(diaSettings->sonySilkLibRefNum, vskStateEnable, vskResizeHorizontally);			
        }
    }
    else error=errNone;
OnError:
    return error;
}
コード例 #5
0
ファイル: dynamic_input_area.c プロジェクト: kjk/noah-palm
/**
 * Performs cleanup of Sony-CLIE specific features.
 */
static Err SonySilkLibFree(DIA_Settings* diaSettings) 
{
    UInt32  vskVersion=0;
    Err     error;

    Assert(diaSettings);
    Assert(DIA_HasSonySilkLib(diaSettings));
    Assert(diaSettings->sonySilkLibRefNum);

    error=FtrGet(sonySysFtrCreator, sonySysFtrNumVskVersion, &vskVersion);
    if (error)
    {
        SilkLibDisableResize(diaSettings->sonySilkLibRefNum);
        error=SilkLibClose(diaSettings->sonySilkLibRefNum);
        if (silkLibErrStillOpen==error) error=errNone;
        if (error) goto OnErrorFreeLib;
    }
    else
    {
        error=VskClose(diaSettings->sonySilkLibRefNum);
        if (vskErrStillOpen==error) error=errNone;
        if (error) goto OnErrorFreeLib;
    }

OnErrorFreeLib:
    if (DIA_TestFlag(diaSettings, diaLoadedSonySilkLib))
    {
        Err tmpErr=SysLibRemove(diaSettings->sonySilkLibRefNum);
        if (tmpErr) error=tmpErr;
    }
    diaSettings->sonySilkLibRefNum=0;
    return error;
}
コード例 #6
0
/***********************************************************************
 *
 * FUNCTION:    RomVersionCompatible
 *
 * DESCRIPTION: This routine checks that a ROM version is meet your
 *              minimum requirement.
 *
 * PARAMETERS:  requiredVersion - minimum rom version required
 *                                (see sysFtrNumROMVersion in SystemMgr.h 
 *                                for format)
 *              launchFlags     - flags that indicate if the application 
 *                                UI is initialized.
 *
 * RETURNED:    error code or zero if rom is compatible
 *
 * REVISION HISTORY:
 *
 *
 ***********************************************************************/
static Err RomVersionCompatible(UInt32 requiredVersion, UInt16 launchFlags)
{
	UInt32 romVersion;

	// See if we're on in minimum required version of the ROM or later.
	FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
	if (romVersion < requiredVersion)
		{
		if ((launchFlags & (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) ==
			(sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp))
			{
			FrmAlert (RomIncompatibleAlert);
		
			// Palm OS 1.0 will continuously relaunch this app unless we switch to 
			// another safe one.
			if (romVersion <= kPalmOS10Version)
				{
				AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
				}
			}
		
		return sysErrRomIncompatible;
		}

	return errNone;
}
コード例 #7
0
ファイル: IntlMgr.c プロジェクト: kernelhcy/hcyprojects
Boolean IntlSetStrictChecks(Boolean iStrictChecks)
{
	Boolean oldSetting;
	UInt32 flags;
	Err result;
	
	// Global flags has precedence over feature value.
	oldSetting = (GIntlData->intlFlags & kStrictChecksFlag) != 0;
	 
	result = FtrGet(sysFtrCreator, sysFtrNumIntlMgr, &flags);
	ErrNonFatalDisplayIf(result != errNone, "Can't get sysFtrNumIntlMgr feature");
	if (iStrictChecks)
	{
		flags |= intlMgrStrict;
		GIntlData->intlFlags |= kStrictChecksFlag;
	}
	else
	{
		flags &= ~intlMgrStrict;
		GIntlData->intlFlags &= ~kStrictChecksFlag;
	}
	
	result = FtrSet(sysFtrCreator, sysFtrNumIntlMgr, flags);
	ErrNonFatalDisplayIf(result != errNone, "Can't set sysFtrNumIntlMgr feature");
	
	return(oldSetting);
} // IntlSetStrictChecks
コード例 #8
0
ファイル: Atlas.c プロジェクト: openmobl/Atlas
static Err RomVersionCompatible(UInt32 requiredVersion, UInt16 launchFlags)
{
    UInt32 romVersion;

    /* See if we're on in minimum required version of the ROM or later. */
    FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
    if (romVersion < requiredVersion) {
        if ((launchFlags & 
            (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) ==
            (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) {
            FrmAlert(kRomIncompatibleAlert);

            /* Palm OS versions before 2.0 will continuously relaunch this
             * app unless we switch to another safe one. */
            /* DCK: We will never be able to run on PalmOS < 2.0, or < 5.0 for
                    that matter... */
            /*if (romVersion < kPalmOS20Version) {
                AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
            }*/
        }

        return sysErrRomIncompatible;
    }

    return errNone;
}
コード例 #9
0
ファイル: flop.c プロジェクト: iPodLinux-Community/Flite
UInt32 PilotMain(UInt16 launchCode, 
		 MemPtr launchParameters, 
		 UInt16 launchFlags)
{
    Err error;
    UInt32 romVersion;

    FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
    if (romVersion < ROM_VERSION_REQUIRED_FOR_FLOP)
    {
	FrmAlert(RomIncompatibleAlert);
	return (sysErrRomIncompatible);
    }

    switch(launchCode)
    {
    case sysAppLaunchCmdNormalLaunch:

	error = AppStart();
	if (error) return error;

	FrmGotoForm(FlopForm);
	AppEventLoop();
	AppStop();
	break;
	
    default:
	break;
    }

    return errNone;
}
コード例 #10
0
ファイル: cd_msa.cpp プロジェクト: havlenapetr/Scummvm
bool MsaCDPlayer::init() {
	SonySysFtrSysInfoP sonySysFtrSysInfoP;
	Err error = errNone;

	if (!(error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) {
		// not found with audio adapter ?!
		//if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrMsa) {
			if ((error = SysLibFind(sonySysLibNameMsa, &_msaRefNum)))
				if (error == sysErrLibNotFound)
					error = SysLibLoad(sonySysFileTMsaLib, sonySysFileCMsaLib, &_msaRefNum);

			// FIXME : still don't understand how this lib works, it seems to be very unstable
			// and with the very bad documentation provided by Sony it's difficult to find out why
			// this doesn't work the same way on build-in MP3 device and external MP3 devices
			if (!error) {
				//MsaLibClose(_msaRefNum, msaLibOpenModeAlbum);	// close the lib if we previously let it open (?) Need to add Notify for sonySysNotifyMsaEnforceOpenEvent just in case ...
				error = MsaLibOpen(_msaRefNum, msaLibOpenModeAlbum);

				//if (error == msaErrAlreadyOpen)
				//	error = MsaLibEnforceOpen(_msaRefNum, msaLibOpenModeAlbum, appFileCreator);

				//error = (error != msaErrStillOpen) ? error : errNone;
			}
		//}
	}

//	if (error)
//		_msaRefNum = sysInvalidRefNum;

	_isInitialized = (_msaRefNum != sysInvalidRefNum);
	initInternal();
	return _isInitialized;
}
コード例 #11
0
struct tm *localtime(const time_t *timer) {
	static struct tm tmDate;
	DateTimeType dt;
	UInt32 secs = *timer;
	
	// get ROM version
	UInt32 romVersion;
	Err e = FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
	
	// form 1/1/1904 12AM to 1/1/1970 12AM
	DateTimeType Epoch = {0, 0, 0, 1, 1, 1970, 0};

	// timer supposed to be based on Epoch
	secs += TimDateTimeToSeconds(&Epoch);

	// DST really supported from OS v4.0
	if (romVersion >= sysMakeROMVersion(4,0,0,sysROMStageRelease,0))
		secs += (PrefGetPreference(prefTimeZone) + PrefGetPreference(prefDaylightSavingAdjustment)) * 60;
	else
		secs += (PrefGetPreference(prefMinutesWestOfGMT) - 720) * 60;	// no sure about this one

	TimSecondsToDateTime (secs, &dt);

	tmDate.tm_sec	= dt.second;
	tmDate.tm_min	= dt.minute;
	tmDate.tm_hour	= dt.hour;
	tmDate.tm_mday	= dt.day;
	tmDate.tm_mon	= dt.month - 1;
	tmDate.tm_year	= dt.year - 1900;
	tmDate.tm_wday	= dt.weekDay;

	return &tmDate;
}
コード例 #12
0
ファイル: Atlas.c プロジェクト: openmobl/Atlas
GlobalsPtr GetGlobals(void)
{
    GlobalsPtr  gP  = NULL;
    
    FtrGet(kAppFileCreator, ftrGlobals, (UInt32 *)&gP);
    
    return gP;
}
コード例 #13
0
static Boolean dynamicInputAvail() {
	UInt32 version;
	Err err=FtrGet(pinCreator,pinFtrAPIVersion,&version);
	if(!err && version) {
		return true;
	} else {
		return false;
	}
}
コード例 #14
0
static Boolean isTheDeviceSupported() {
	UInt32 version = 0;
	Err err;
	Boolean res=false;
	err=FtrGet(sysFileCSoundMgr,sndFtrIDVersion,&version);
	if(!err) {
		if(version) {
			return true;
		}
	}
	return res;
}
コード例 #15
0
ファイル: BiddingForm.cpp プロジェクト: muffinista/palm-pitch
Boolean CBiddingForm::OnChooseBid(EventPtr pEvent, Boolean& bHandled) {

	UInt32 hsStatusVersion;
	
	if (FtrGet (hsFtrCreator, hsFtrIDNavigationSupported, &hsStatusVersion) == 0) {
		FrmGlueNavObjectTakeFocus(FrmGetActiveForm(), SetBidButton );
	}
	
	bHandled = false;
	return false;

}
コード例 #16
0
ファイル: SysZLib.c プロジェクト: BackupTheBerlios/yepos
Err zlib_close(UInt16 ref, UInt16 *numop) {
  UInt32 val = 0;
  *numop = 0;

  FtrGet('ZLib', ref, &val);
  if( val <= 0 )
    return -1;

  FtrSet('ZLib', ref, --val);
  *numop = val;
  return 0;
}
コード例 #17
0
void run(int argc, char *argv[]) {
	// init args
	ArgsExportInit(argv, argc, true);

	// init system
	PalmHRInit(16);
	PalmInit(HWR_GET());
	void *__ptr = StuffsForceVG();

	gVars->screenPitch = StuffsGetPitch(gVars->screenFullWidth);

	// export global struct to ARM
	VARS_EXPORT();
	DO_VARS(_4B, 32, 0);
	DO_VARS(_2B, 16, (gVars->_4B * sizeof(UInt32)));
	FtrSet(appFileCreator, ftrVars , (UInt32)gVars);

	// run the module
#ifdef COMPILE_ZODIAC
	NativeFuncType *entry;
	TwLoadModule(0, 0, 0, 1, twLoadFlagTNA|twLoadFlagQuickRun, &entry);
#else
	UInt32 glue;
	FtrGet(twFtrCreator, twFtrAPIGlue, &glue);

	PnoDescriptor pno;
	PnoLoadFromResources(&pno, 'ARMC', 1, appFileCreator, 1);
	PnoCall(&pno, (void*)glue);
	PnoUnload(&pno);
#endif

	// reset globals
	DO_VARS(_4B, 32, 0);
	DO_VARS(_2B, 16, (gVars->_4B * sizeof(UInt32)));

	// release
	StuffsReleaseVG(__ptr);
	PalmRelease(HWR_GET());
	PalmHRRelease();

	// free args
	ArgsExportRelease(true);
	ArgsFree(argv);

	// release global struct
	FtrUnregister(appFileCreator, ftrVars);
	FtrUnregister(appFileCreator, ftrStack);
	MemPtrFree(gVars);

	// reset the palette if needed
	WinPalette(winPaletteSetToDefault, 0, 256, NULL);
}
コード例 #18
0
ファイル: os.c プロジェクト: TimofonicJunkRoom/plucker-1
/* Initialize OS specific features */
void OS_Init( void )
{
#ifdef HAVE_PALMCUNIT
    /* When we run the test version we might call OS_Init more than
       once during a session, so we have to reset these flags */
    support50 = false;
    support40 = false;
    support35 = false;
    support33 = false;
    support31 = false;
    support30 = false;
    support20 = false;
#endif

    OpenSkins();

    FtrGet( sysFtrCreator, sysFtrNumROMVersion, &romVersion );
    if ( RomVersion20 <= romVersion ) {
        support20 = true;

        OS2();
    }
    if ( RomVersion30 <= romVersion ) {
        support30 = true;

        OS30();
    }
    if ( RomVersion31 <= romVersion ) {
        support31 = true;
    }
    if ( RomVersion33 <= romVersion ) {
        support33 = true;

        OS33();
    }
    if ( RomVersion35 <= romVersion ) {
        support35 = true;

        OS35();
    }
    if ( RomVersion40 <= romVersion ) {
        support40 = true;

        OS4();
    }
    if ( RomVersion50 <= romVersion ) {
        support50 = true;

        OS5();
    }
    InitializeUserFontDBs();
}
コード例 #19
0
ファイル: os.c プロジェクト: TimofonicJunkRoom/plucker-1
/* PalmOS 5.x or higher specific operations */
static void OS5( void )
{
    Err    err;
    UInt32 processorType;
    UInt32 autoBackup;

    err = FtrGet( sysFileCSystem, sysFtrNumProcessorID, &processorType );
    if ( err == errNone )
        have68K = sysFtrNumProcessorIs68K( processorType );
#ifdef BUILD_ARMLETS
    if ( err == errNone && sysFtrNumProcessorIsARM( processorType ) )
        supportArmlets = true;
    else
#endif
        supportArmlets = false;

    supportNVFS = ( errNone == FtrGet( sysFtrCreator, sysFtrNumDmAutoBackup, 
                                   &autoBackup ) && 
                    autoBackup != 0 );

    supportedCompression ^= ( 1 << BitmapCompressionTypePackBits );
}
コード例 #20
0
ファイル: device_info.cpp プロジェクト: kjk/noah-palm
Err GetOEMDeviceId(ExtensibleBuffer* out)
{
    Err     error;
    UInt32  id;
    char *  idAsChar;

    error = FtrGet(sysFtrCreator, sysFtrNumOEMDeviceID, &id);
    if (error)
        return error;
    idAsChar = (char*) &id;
    ebufAddStrN(out, idAsChar, sizeof(UInt32));
    return errNone;
}
コード例 #21
0
ファイル: SMSReply.cpp プロジェクト: oldhu/smstw
static void SetupFeatureNew()
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormReply)) return;

	char* data;
	Err err = FtrGet(appFileCreator, FEATURE_COMPOSE_NEW, (UInt32 *) &data);
	if (err) return;
	char* pszTo = data;
	SetFieldText((FieldPtr) GetObjectPtr(form, FieldTo), pszTo);
	FtrPtrFree(appFileCreator, FEATURE_COMPOSE_NEW);

	FrmSetFocus(form, FrmGetObjectIndex(form, FieldCompose));
}
コード例 #22
0
ファイル: DIA.c プロジェクト: TimofonicJunkRoom/plucker
static DIAHardwareType InitializePalm( void )
{
    UInt32 version;
    Err    err;
    err = FtrGet( pinCreator, pinFtrAPIVersion, &version );
    if ( err != errNone )
        return DIA_HARDWARE_NONE;
    if ( pinAPIVersion1_1 <= version )
        return DIA_HARDWARE_PALM11;
    else if ( pinAPIVersion1_0 <= version )
        return DIA_HARDWARE_PALM10;
    else
        return DIA_HARDWARE_NONE;
}
コード例 #23
0
ファイル: os.c プロジェクト: TimofonicJunkRoom/plucker-1
/* PalmOS 2.x or higher specific operations. */
static void OS2( void )
{
    Err       err;
#if defined( HAVE_SONY_SDK ) || defined( HAVE_PALMONE_SDK )
    UInt32    value;
#endif

    /* Do we support the Notification Manager? */
    err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &notifySupport);
    if (err != errNone)
        notifySupport = 0;

    maxBitDepth             = 1;
    SetScreenMode           = SetScreenModeOS2;
    SetDefaultScreenMode    = SetDefaultScreenModeOS2;
    SetForeColor            = SetForeColor_OS2;
    SaveDrawState           = SaveDrawState_OS2;
    RestoreDrawState        = RestoreDrawState_OS2;
    ScreenLock              = ScreenLockUnlock_None;
    ScreenUnlock            = ScreenLockUnlock_None;
    OptimizeImage           = OptimizeImage_None;

#ifdef HAVE_PALMONE_SDK
    err = FtrGet( navFtrCreator, navFtrVersion, &value );
    if ( err == errNone )
        haveFiveWay = true;
#ifdef sysFtrNumUIHardwareHas5Way
    err = FtrGet( sysFileCSystem, sysFtrNumUIHardwareHas5Way, &value );
    if ( err == errNone ) {
        haveFiveWay = true;
    }
#endif
#ifdef sysFtrNumFiveWayNavVersion
    err = FtrGet( sysFileCSystem, sysFtrNumFiveWayNavVersion, &value );
    if ( err == errNone ) {
        haveFiveWay = true;
    }
#endif
    if ( haveFiveWay ) {
        err = FtrGet( hsFtrCreator, hsFtrIDNavigationSupported, &value );
        if ( err == errNone )
            haveHsNav = true;
    }
#endif /* HAVE_PALMONE_SDK */

#ifdef HAVE_SONY_SDK
    err = FtrGet( sysFtrCreator, sysFtrNumOEMCompanyID, &value );
    if ( err == errNone && value ==  sonyHwrOEMCompanyID_Sony ) {
        isSony = true;
    }
#endif
    if ( IsDoubleByteSingleChar( testDoubleByteBig5GB2312EUCJPKR ) ||
         IsDoubleByteSingleChar( testDoubleByteShiftJIS ) ||
         IsDoubleByteSingleChar( testDoubleByteJISKuten ) ) {
        uses8BitChars              = false;
    }
}
コード例 #24
0
ファイル: ZDicFontImpl.c プロジェクト: jemyzhang/ZDic
/***********************************************************************
 *
 * FUNCTION: ZDicFontInit
 *
 * DESCRIPTION: Initial all font resource
 *
 * PARAMETERS:	nothing
 *
 * RETURN:		errNone if success else fail.
 *
 * REVISION HISTORY:
 *		Name			Date		Description
 *		----			----		-----------
 *		ZhongYuanHuan	14/Aug/04	Initial Revision 
 *				
 ***********************************************************************/
Err ZDicFontInit ( UInt16 refNum, ZDicFontType* fontP, Boolean bUseSysFont )
{
	#pragma unused(refNum)
	
	UInt32  version;	
	Err     err;
	
	MemSet ( fontP, sizeof ( ZDicFontType ), 0 );
	fontP->smallFontID = stdFont;
	fontP->largeFontID = largeFont;
	
	if ( bUseSysFont ) return errNone;
	
	fontP->fontLibP = DmOpenDatabaseByTypeCreator ( ZDicFontTypeID, ZDicFontCreatorID, dmModeReadOnly );
	
	if ( fontP->fontLibP == 0 )
	{
	    err = DmGetLastErr ();
	    return err;
	}
	
	// Load the phonic font resource and assign it a font ID.
	err = FtrGet(sysFtrCreator, sysFtrNumWinVersion, &version);
	if (!err && version >= 4 )
	{
		// the screen is double density so use double density of phonetic font.
		fontP->phonicSmallFontH = DmGetResource('nfnt', PhonicSmallFontHight);
		fontP->phonicLargeFontH = DmGetResource('nfnt', PhonicLargeFontHight);		
	}
		
	if (fontP->phonicSmallFontH == NULL || fontP->phonicLargeFontH == NULL)
	{
		if (fontP->phonicSmallFontH != NULL) DmReleaseResource(fontP->phonicSmallFontH);
		if (fontP->phonicLargeFontH != NULL) DmReleaseResource(fontP->phonicLargeFontH);
		
		// the screen is low desity so use low density of phonetic font.
		fontP->phonicSmallFontH = DmGetResource(fontRscType, PhonicSmallFontLow);
		fontP->phonicLargeFontH = DmGetResource(fontRscType, PhonicLargeFontLow);		
	}
		
	fontP->phonicSmallFontP = (FontType *)MemHandleLock(fontP->phonicSmallFontH);
	fontP->phonicLargeFontP = (FontType *)MemHandleLock(fontP->phonicLargeFontH);
	err = FntDefineFont(kPHONIC_SMALL_FONT_ID, fontP->phonicSmallFontP);
	err = FntDefineFont(kPHONIC_LARGE_FONT_ID, fontP->phonicLargeFontP);
	fontP->smallFontID = kPHONIC_SMALL_FONT_ID;
	fontP->largeFontID = kPHONIC_LARGE_FONT_ID;		

	return errNone;
}
コード例 #25
0
ファイル: sony_support.c プロジェクト: petesh/pocketcity
Boolean
IsSony(void)
{
	static int tested = -1;
	UInt32 val;

	if (tested != -1)
		return (tested == 1);
	tested = 0;
	if (!FtrGet(sysFtrCreator, sysFtrNumOEMCompanyID, &val)) {
		if (val == sonyHwrOEMCompanyID_Sony)
			tested = 1;
	}
	return (tested == 1);
}
コード例 #26
0
ファイル: SMSReply.cpp プロジェクト: oldhu/smstw
static void RestoreReplyForm()
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormReply)) return;

	FasSearchInfoType FasSearchInfo;
	if (FasGetSearchInfo(&FasSearchInfo) == fasNoSearchInfo) return;

	char* data;
	Err err = FtrGet(appFileCreator, FEATURE_FINGER_ADDR, (UInt32 *) &data);
	if (err) return;

	UInt16 mode = *(UInt16*)data;
	data += sizeof(UInt16);
	
	char* pszTo = data;
	data += StrLen(pszTo) + 1;
	
	char* pszCompose = data;
	data += StrLen(pszCompose) + 1;
	
	char* pszReference = data;
	
	FieldPtr fieldTo = (FieldPtr) GetObjectPtr(form, FieldTo);
	FieldPtr fieldCompose = (FieldPtr) GetObjectPtr(form, FieldCompose);
	FieldPtr fieldReference = (FieldPtr) GetObjectPtr(form, FieldReference);

	if (FasSearchInfo.pPhoneNumber) {
		SetFieldText(fieldTo, FasSearchInfo.pPhoneNumber);
	} else {
		SetFieldText(fieldTo, pszTo);
	}

	SetFieldText(fieldCompose, pszCompose);
	SetFieldText(fieldReference, pszReference);
	
	if (mode == COMPOSE_REPLY) {
		SetupReplyForm(form);
	} else {
		SetupNewForm(form);
	}
	FrmSetFocus(form, FrmGetObjectIndex(form, FieldCompose));
	g_ComposeMode = (ComposeMode) mode;
		
	FtrPtrFree(appFileCreator, FEATURE_FINGER_ADDR);
}
コード例 #27
0
ファイル: cwimp.c プロジェクト: docwhat/cwimp
/* Get preferences, open (or create) app database */
static UInt16 StartApplication(void)
{
        UInt32 romversion;
        UInt16 err;

        err = FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romversion);

        /* We *must* be version 2 or greater */
        if( err || (romversion < 0x02003000) ) {
                FrmAlert(alertVersion);
                return(1);
        }

        FrmGotoForm(MainForm);
        LoadPrefs();
        return 0;
}
コード例 #28
0
ファイル: mach.c プロジェクト: hackndev/cocoboot
static void check_mach()
{
	UInt16 i;
	UInt32 palmos_id;
	
	if (mach) return;
	
	FtrGet(sysFtrCreator, sysFtrNumOEMDeviceID, &palmos_id);

	for (i=1; mach_table[i].palmos_id; i++) {
		if (mach_table[i].palmos_id == palmos_id) {
			mach = i;
			return;
		}
	}
	mach = 0; /* unknown */
}
コード例 #29
0
ファイル: sony_support.c プロジェクト: petesh/pocketcity
void
hookHoldSwitch(void (*CallBack)(UInt32))
{
	Err err;
	UInt32 val;

	err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &val);
	if (!err && val) {
		UInt16 CardNo;
		LocalID dbID;
		SysCurAppDatabase(&CardNo, &dbID);
		SysNotifyRegister(CardNo, dbID,
		    sonySysNotifyHoldStatusChangeEvent,
		    PrvHoldNotificationHandler, sysNotifyNormalPriority, NULL);
		holdCB = CallBack;
	}
}
コード例 #30
0
Err myEvtProcessSoftKeyStroke(PointType * start, PointType * end)
{
   // Get the old trap address set by the extensions manager,
   // e.g., HackMaster, X-Master, or TealMaster.
   // See http://www.daggerware.com/hackapi.htm and
   // http://www.linkesoft.com/english/xmaster/developer.html
   // for the system extension ("hack") protocol.
   UInt32 value;
   thisInterface oldTrap = 
      (FtrGet(CREATORID, TRAPID_PROCESSSOFTKEYSTROKE, &value) == errNone)? (thisInterface)value : 0;
   
   if (!handleProcessSoftKeyStroke(start, end)) { goto passthru; }
   return errNone;

passthru:
   return ((oldTrap) ? oldTrap(start, end) : errNone);
}