Example #1
0
/********************************************************************************
 * Function: StartApplication
 * Description: This is the first function that gets called and it is 
 * responsible for initializing databases and other global variables, checking
 * to see whether private records will be shown and calculating the auto-off time
 * for the current system.
 * ******************************************************************************/ 
static Err 
StartApplication (void) 
{
	UInt16 mode = dmModeReadWrite;
	Err errors = 0;
	Boolean created;
	StripPrefType prefs;	
	UInt16 prefsSize, prefsVersion;

		// set current form to be the password opener
		currentForm = PasswordForm;
	
		// check about private records
		hideSecretRecords = PrefGetPreference (prefHidePrivateRecordsV33);
	if (!hideSecretRecords)
		mode |= dmModeShowSecret;

	/*  handle program prefrences */
	prefsSize = sizeof (StripPrefType);
	prefsVersion = PrefGetAppPreferences (StripCreator, StripPrefID, &prefs, &prefsSize, true);
	if (prefsVersion == noPreferenceFound) { 
        FrmCustomAlert (GenericError, "This version of StripCS is only able to convert 0.5 databases. If you're using an earlier version you must run the StripCS_0.5.prc file that came with this distro first. If you aren't upgrading, just run Strip.prc!", NULL, NULL);
		return -1;
	} else if (prefsVersion == StripVersionNumber) {
        FrmCustomAlert (GenericError, "It looks like you have already converted your databases with StripCS. You may now use the latest version of Strip.", NULL, NULL);
		return -1;
	}
	
		// open or create databases.
		errors =
		getDatabase (&SystemDB, systemDBTypeOld, StripCreator, mode, 0,
					  systemDBName, &created);

		errors =
		getDatabase (&AccountDB, accountDBTypeOld, StripCreator, mode, 0,
					  accountDBName, &created);

		errors =
		getDatabase (&PasswordDB, passwordDBTypeOld, StripCreator, mode, 0,
					  passwordDBName, &created);

	
		// if the password database does not exist, or there are no records in it note that 
		// this is the first run, so the user will be prompted to enter a new password.
		if (created 
			||(DmNumRecordsInCategory (PasswordDB, dmAllCategories) == 0))
		
	{
		firstRun = true;
	}
	
		// set up the timer stuff.  start by setting auto off time to 0. the function returns the old 
		// auto off time. If the oldAutoOffTime is 0 then the system will never shut down. this is not
		// the behavior that we want, so we reset the autoOffTime to 300. if the oldAutoOffTime is not 
		// 0 then we set it back immediatly.  Note that in the StopApplication function we 
		// set the autoOffTime back to what it was before this program started no matter what.
		return 0;
}
Example #2
0
File: game.c Project: docwhat/cwimp
void NextPlayer() {
  Int x;
#ifdef DEBUG
  Int dd = 0;
#endif

  x = stor.currplayer;

  while(1) {
	stor.currplayer = (stor.currplayer + 1) % stor.numplayers;
	if ( x == stor.currplayer ) {
	  if ( stor.numplayers > 1 ) {
		// Only one guy hasn't lost
		//HaveWinner();
		FrmCustomAlert( calertDEBUG,
						"We have a weiner, I mean a winner!",
						"No, I'm not telling you who.",
						"ToDo: Do this correctly." );
	  }
	  break;
	}
	if ( ! stor.player[stor.currplayer].lost ) {
	  break;
	}
#ifdef DEBUG
	ErrNonFatalDisplayIf( ++dd > (MaxPlayers + 4), "NextPlayer: Had to rely on dd loop check!" );
#endif
  }
  
	DrawPlayerScore( x );
	DrawPlayerScore( stor.currplayer );

  // Clear scores
  stor.scorethisroll = stor.scorethisturn = 0;
  StayBit = false;

  // Clear cubes
  for( x = 0 ; x < NumCubes ; x++ ) {
	stor.cube[x].keep = false;
	stor.cube[x].value = 0;
  }

  stor.status = DS_NextPlayer; // Bypass StatusLine();

  if ( stor.flags & flag_NextPlayerPopUp ) {
	FrmCustomAlert( calertNEXTPLAYER,
					stor.player[stor.currplayer].name,
					" ", " ");
	DrawState();
  } else {
	DrawStatus();
  }

}
Example #3
0
void panicN(Char* errorStr, UInt32 n) { 
  char tmp_text[100];
  StrPrintF(tmp_text, "[%lu] ", n);
  StrCat(tmp_text,errorStr);
  FrmCustomAlert(alertID_panic,tmp_text,"","");
  //exit(-1); //How do we exit the application, NH
}
// Audio CD
static Boolean AudioCDTabSave() {
	ControlType *cck3P;
	FieldType *fld2P, *fld3P;
	ListType *list1P, *list2P;
	UInt16 firstTrack;
	FormPtr frmP;

	frmP = FrmGetActiveForm();

	cck3P = (ControlType *)GetObjectPtr(TabAudioCDMP3Checkbox);
	fld2P = (FieldType *)GetObjectPtr(TabAudioCDLengthSecsField);
	fld3P = (FieldType *)GetObjectPtr(TabAudioCDFirstTrackField);
	list1P = (ListType *)GetObjectPtr(TabAudioCDDriverList);
	list2P = (ListType *)GetObjectPtr(TabAudioCDFormatList);

	firstTrack = StrAToI(FldGetTextPtr(fld3P));
	if (firstTrack < 1 || firstTrack > 999) {
		TabSetActive(frmP, myTabP, 2);
		FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabAudioCDFirstTrackField));
		FrmCustomAlert(FrmErrorAlert, "Invalid track value (1...999)", 0, 0);
		return false;
	}

	gameInfoP->musicInfo.sound.CD = CtlGetValue(cck3P);

	gameInfoP->musicInfo.sound.drvCD = LstGetSelection(list1P);
	gameInfoP->musicInfo.sound.frtCD = LstGetSelection(list2P);

	gameInfoP->musicInfo.sound.defaultTrackLength = StrAToI(FldGetTextPtr(fld2P));
	gameInfoP->musicInfo.sound.firstTrack = firstTrack;

	return true;
}
Example #5
0
static Err AppStartCheckMathLib() {
	Err e = MathlibInit();
	
	switch (e) {
		case errNone:
			break;
		case sysErrLibNotFound:
			FrmCustomAlert(FrmErrorAlert,"Can't find MathLib !",0,0);
			break;
		default:
			FrmCustomAlert(FrmErrorAlert,"Can't open MathLib !",0,0);
			break;
	}
	
	return e;
}
Example #6
0
void DEBUGBOX(char *ARGSTR1, char *ARGSTR2) {
  char buf[1000];
  int l=0;
  l+=StrPrintF(buf+l, "debugbox - %s %s:%d\n", 
     __FUNCTION__, __FILE__, __LINE__);
  FrmCustomAlert(alertInfo, buf, ARGSTR1, ARGSTR2);
}
Example #7
0
ASSERT_DLL void _Assert(const char* Exp, const char* File, int Line)
{
	char Msg[MAXPATH];
    size_t i;
	int n=1000000;

	Msg[0] = '\n';

    for (i=1;i<MAXPATH-1 && File[i];++i)
        Msg[i] = File[i];

	if (i<MAXPATH-1)
		Msg[i++] = ':';

	while (n>1 && Line<n)
		n/=10;

    for (;n && i<MAXPATH-1;++i)
	{
	    Msg[i] = (char)('0'+(Line/n));
		Line %= n;
		n /= 10;
	}

    Msg[i] = 0;

	FrmCustomAlert(WarningOKAlert,Exp,Msg," ");
}
Example #8
0
static Err SaveMessageIn(DmOpenRef db, Int16 category)
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormReply)) return frmErrNotTheForm;
	
	FieldPtr fieldTo = (FieldPtr) GetObjectPtr(form, FieldTo);
	FieldPtr fieldCompose = (FieldPtr) GetObjectPtr(form, FieldCompose);
	
	char* pszTo = FldGetTextPtr(fieldTo);
	char* pszCompose = FldGetTextPtr(fieldCompose);
	
	if ((pszTo == NULL) || (StrLen(pszTo) == 0)) {
		ShowMsg("No phone number set.");
		return -1;
	}
	
	if ((pszCompose == NULL) || (StrLen(pszCompose) == 0)) {
		FrmCustomAlert(AlertCustom, "Alert", "No message composed.", "");
		return -1;
	}

	UInt8 state = 0;
	
	if (category == CAT_OUTBOX) {
		SendPref spref;
		ReadSendPreference(spref);
		if (spref.requestReport) RequestReport(state);
	}
	
	NewRecordInCategory(db, pszTo, pszCompose, category, state);
	return errNone;
}
Example #9
0
static void displayWinDialog(void)
{
  FrmCustomAlert(alertInfo, 
                   "You win!\n"
                   "Congratulations!\n",
                   "", "");
}
Example #10
0
static void
ExamDelete(void)
{
  MemHandle mex, m;
  ExamDBRecord *ex;
  UInt16 index=0, pressedButton=0;
  Char *courseName, timeTemp[timeStringLength], dateTemp[longDateStrLength];

  DmFindRecordByID(DatabaseGetRefN(DB_MAIN), gExamsLastSelRowUID, &index);
  mex = DmQueryRecord(DatabaseGetRefN(DB_MAIN), index);
  ex = (ExamDBRecord *)MemHandleLock(mex);

  m=MemHandleNew(1);
  CourseGetName(ex->course, &m, true);
  courseName = MemHandleLock(m);

  DateToAscii(ex->date.month, ex->date.day, ex->date.year+MAC_SHIT_YEAR_CONSTANT, PrefGetPreference(prefLongDateFormat), dateTemp);
  TimeToAscii(ex->begin.hours, ex->begin.minutes, PrefGetPreference(prefTimeFormat), timeTemp);

  pressedButton = FrmCustomAlert(ALERT_ex_dodel, courseName, dateTemp, timeTemp);

  MemHandleUnlock(m);
  MemHandleFree(m);
  MemHandleUnlock(mex);

  if (pressedButton == 0) {
    // OK, the user really wants us to delete the record
    NoteDelete(&index);
    DmRemoveRecord(DatabaseGetRefN(DB_MAIN), index);
    gExamsSelRow=0;
    FrmUpdateForm(FORM_exams, frmRedrawUpdateCode);
  }
}
Example #11
0
// Increase speed
void increase_speed(void) {
  hd.ticks_wait--;
  if (hd.ticks_wait <= TICKS_SPEED_MAX) {
    hd.ticks_wait = TICKS_SPEED_MAX;
    if (hd.min_warning)
      FrmCustomAlert(Info, "Maximum speed reached", 0, 0);
  }
}
Example #12
0
// call function at given index
void call_at(UInt32 idx) {
  HARDKEYSTUB stub = NULL;

  if (idx < 1 || idx > 6) {
    FrmCustomAlert(ErrorMessageForm, "Stub index out of range", 0, 0);
    return;
  }

  stub = hardkeymap[idx];

  if (stub != NULL) {
    (*stub)();
  }
  else
    FrmCustomAlert(Info, "No functionality", 0, 0);

}
Example #13
0
// Decrease speed
void decrease_speed(void) {
  hd.ticks_wait++;
  if (hd.ticks_wait >= TICKS_SPEED_MIN) {
    hd.ticks_wait = TICKS_SPEED_MIN;
    if (hd.min_warning)
      FrmCustomAlert(Info, "Minimum speed reached", 0, 0);
  }
}
Example #14
0
void ProcessIconSelect()
{
    if (IconDB) {
        DisplayDialog(IconSelectForm, IconSelectHandleEvent) ;
    }
    else {
        FrmCustomAlert(ErrorAlert,  "IconDB is not installed", "", "");
    }
}
Example #15
0
bool CLoadForm::checkSelectedDBRecord()
{
   UInt16 row = m_grid.GetCurrentIndex();
   if (row == (UInt16)-1) {
      FrmCustomAlert(InformationAlert, "Please first select a script.", 0, 0);
      return false;
   }
   return true;
}
Example #16
0
// Read the header data
UInt16 ReadHeader(void) {
  UInt16 err;
  MemHandle headerMH = NULL;
  MemPtr    headerMP = NULL;
  headerdata* foo;

  err = false;

  headerMH = DmGetRecord(JMPalmPrefs, 0);
  
  if (headerMH != NULL)
    headerMP = MemHandleLock(headerMH);

  foo = (headerdata*)headerMP;

  // copy the object
  if (foo != NULL) {
    memcpy(&hd, foo, sizeof(headerdata));

    // Header version incompatible?
    if (hd.version <= INCOMPATIBILITY_LEVEL) { 
      FrmCustomAlert(ErrorMessageForm, "Installation error: You must"\
		     " delete old JMPalm versions before installing"\
		     " this version. Please delete and reinstall.",
		     0, 0);
      err = true;
    }
    else if (hd.version < CURRENT_SETTINGS_VERSION) {
      FrmCustomAlert(ErrorMessageForm, "New (incompatible) version of "\
		     "JMPalm installed, "\
		     "your settings are lost!", 0, 0);
      drawSplash();
      ResetHeader();
    }
  }

  if (headerMH != NULL) {
    MemHandleUnlock(headerMH);
    DmReleaseRecord(JMPalmPrefs, 0, true);
  }

  return err;
}
Example #17
0
static Err ModImport(UInt16 volRefNum, UInt8 engine, Boolean *armP) {
#ifndef _DEBUG_ENGINE
	char filename[256];
	UInt16 cardNo;
	LocalID dbID;
	UInt32 result;
	FileRef file;
#endif
	char msg[256];
	FormPtr ofmP, frmP;
	Err e = errNone;

	ofmP = FrmGetActiveForm();
	frmP = FrmInitForm(ImportForm);
	FrmSetActiveForm(frmP);
	FrmDrawForm(frmP);

	// In debug mode, the engine files are directly uploaded to the simulator
#ifndef _DEBUG_ENGINE
	// engine file ?
	BUILD_FILE(engines[engine].fileP, ".engine");
	CHECK_FILE("ScummVM engine file was not found !");
	IMPRT_FILE("Cannot import engine file !");

	// need more files ?
	dbID = DmFindDatabase(0, "ScummVM-Engine");	// be sure to have the correct dbID
	e = SysAppLaunch(cardNo, dbID, 0, sysAppLaunchCustomEngineGetInfo, 0, &result);
	*armP = ((result & GET_MODEARM) == GET_MODEARM);

	// common file ?
	if (!e && (result & GET_DATACOMMON)) {
		BUILD_FILE("common", ".data");
		CHECK_FILE("Common data file was not found !");
		IMPRT_FILE("Cannot import common data file !");
	}
	// data file ?
	if (!e && (result & GET_DATAENGINE)) {
		BUILD_FILE(engines[engine].fileP, ".data");
		CHECK_FILE("Engine data file was not found !");
		IMPRT_FILE("Cannot import engine data file !");
	}
#endif
	// if error, cleanup
	if (e) ModDelete();

onError:
	FrmEraseForm(frmP);
	FrmDeleteForm(frmP);
	if (e) {
		if (ofmP) FrmSetActiveForm(ofmP);
		FrmCustomAlert(FrmErrorAlert, msg, 0, 0);
	}

	return e;
}
Example #18
0
Boolean PostListFormEventHandler(EventPtr event)
{
    static FormPtr gpForm;
    UInt16 postCount;

    switch (event->eType) {
    case frmOpenEvent: {
        postCount = 10; // If you exceed 10 you pop a warning and it gets trimmed.
        setup_database();
        FrmDrawForm(gpForm = FrmGetActiveForm());
        UpdatePostsTable(gpForm, postCount);

        return true;
    }
    case frmCloseEvent: {
        FrmEraseForm(gpForm);
        FrmDeleteForm(gpForm);
        return true;
    }
    case ctlSelectEvent: {
        switch (event->data.ctlSelect.controlID) {
        case HelpButton: {
            FrmCustomAlert(TheError,
                "Oops, looks like our connection goofed here, try again?",
                NULL, NULL);
            return true;
        }
        case PalmrMainMenuAbout: {
            FrmAlert(AboutAlert);
            return true;
        }
        }
    }
    case tblSelectEvent: {
        int row = event->data.tblSelect.row;
        int column = event->data.tblSelect.column;
        // char strRow[15];
        // char strColumn[15];
        //
        // sprintf(strRow, "%i", row);
        // sprintf(strColumn, "%i", column);

        // AlertPrintf3(
        //     "You selected:",
        //     strRow, strColumn);

        FrmGotoForm(PostViewForm);

        return true;
    }
    default: {
        return false;
    }
    }
}
Example #19
0
Boolean CRegDialog::OnOK(EventPtr pEvent, Boolean& bHandled) {

	if ( m_RegCode.GetTextPtr() ) {
		tmpCode = m_RegCode.GetTextPtr();
	}
	else {
		tmpCode = "";
	}

	SaveCode( (const char *)tmpCode );
		
	if ( IsRegistered() ) {
		FrmCustomAlert(RegThanks, "", "", "");
		CloseForm(false);
	}
	else {
		FrmCustomAlert(RegProblem, "", "", "");
	}

	return true;
}
static void MusicFormInit(UInt16 index) {
	TabType *tabP;
	FormType *frmP = FrmGetActiveForm();

	if (index != dmMaxRecordIndex) {
		MemHandle recordH = NULL;
		GameInfoType *ogameInfoP;

		recordH = DmQueryRecord(gameDB, index);
		ogameInfoP = (GameInfoType *)MemHandleLock(recordH);
		
		if (!ogameInfoP) {
			FrmCustomAlert(FrmErrorAlert, "An error occured.",0,0);
			return;
		}

		gameInfoP = (GameInfoType *)MemPtrNew(sizeof(GameInfoType));
		MemMove(gameInfoP, ogameInfoP, sizeof(GameInfoType));
		MemHandleUnlock(recordH);

	} else {
		FrmCustomAlert(FrmWarnAlert, "Select an entry first.",0,0);
		FrmReturnToMain();
		return;
	}

	tabP = TabNewTabs(3);
	TabAddContent(&frmP, tabP, "Sound", TabMusicForm);
	TabAddContent(&frmP, tabP, "Volume", TabVolumeForm);
	TabAddContent(&frmP, tabP, "Audio CD", TabAudioCDForm);

	MusicTabInit();
	AudioCDTabInit();
	VolumeTabInit();

	FrmDrawForm(frmP);
	TabSetActive(frmP, tabP, lastTab);

	myTabP = tabP;
}
Example #21
0
void buildAll() {
	Err err;
	LocalID olddb;	

	olddb = DmFindDatabase(0, "Glbs::" BUILD_NAME);
	if (olddb) {
		DmDeleteDatabase(0,olddb);
		FrmCustomAlert(1000,"delete old " BUILD_NAME " DB",0,0);
	}
	err = DmCreateDatabase (0, "Glbs::" BUILD_NAME, 'ScVM', 'GLBS', false);
	olddb = DmFindDatabase(0, "Glbs::" BUILD_NAME);
	dbP[BUILD_RES] = DmOpenDatabase(0, olddb, dmModeReadWrite);

#if defined(BUILD_COMMON)
	addNewGui();

#elif defined(BUILD_SCUMM)
	addDimuseTables();
	// temp removed
	// TODO ::scummvm use sizeof(OLD256_MIDI_HACK) so i need to fix it
	// directly in the code or call MemHandleSize but it may slow down
	// code execution
	addAkos();
	addDimuseCodecs();
	addCodec47();
	addGfx();
	addDialogs();
	addCharset();
	addCostume();
	addPlayerV2();
	addScummTables();

#elif defined(BUILD_SIMON)
	addSimon();
	Simon_addCharset();

#elif defined(BUILD_SKY)
	Sky_addHufftext();

#elif defined(BUILD_QUEEN)
	Queen_addTalk();
	Queen_addRestables();
	Queen_addGraphics();
	Queen_addDisplay();
	Queen_addMusicdata();

#elif defined(BUILD_SWORD1)
	Sword1_addStaticres();
#endif

	DmCloseDatabase(dbP[BUILD_RES]);
}
Example #22
0
Err SendReply(DmOpenRef db, gb2312_table& table)
{
	MethodLogger log("SendReply");
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormReply)) return frmErrNotTheForm;
	
	FieldPtr fieldTo = (FieldPtr) GetObjectPtr(form, FieldTo);
	FieldPtr fieldCompose = (FieldPtr) GetObjectPtr(form, FieldCompose);
	ListPtr list = (ListPtr) GetObjectPtr(form, ListGroups);
	Int16 sel = LstGetSelection(list);
	
	char* pszTo = FldGetTextPtr(fieldTo);
	char* pszCompose = FldGetTextPtr(fieldCompose);
	
	Err err = -1;

	Boolean emptyTo = false;	
	if ((pszTo == NULL) || (StrLen(pszTo) == 0)) {
		emptyTo = true;
	}
	
	Boolean emptyGroup = false;
	if ((sel == noListSelection) || (sel == 0)) {
		emptyGroup = true;
	}
	
	if (emptyTo && emptyGroup) {
		ShowMsg("Please set To or Group.");
		goto exit;
	}
	
	if ((pszCompose == NULL) || (StrLen(pszCompose) == 0)) {
		FrmCustomAlert(AlertCustom, "Alert", "No message composed.", "");
		goto exit;
	}
	
	if (emptyGroup)
		SendTheSMS(db, table, pszTo, pszCompose);
	else {
		PhoneGroupPtr group = LoadPhoneGroupByUniqId(g_PhoneGroups[sel - 1]->GetUniqId());
		UInt32 count = group->GetPhoneGroupItemCount();
		for (UInt32 i = 0; i < count; ++i) {
			PhoneGroupItemPtr item = group->GetPhoneGroupItem(i);
			SendTheSMS(db, table, item->GetPhone(), pszCompose);
		}
		delete group;
	}
	
exit:
	return err;
}
Example #23
0
static void SendTheSMS(DmOpenRef db, gb2312_table& table, const char* pszTo, const char* pszCompose)
{
	Err err = SendSMS(table, "+8613800100500", pszTo, pszCompose);
//	err = SendSMS(table, "+8613800100500", pszTo, testStr);
	if (!err) {
		UInt8 state = 0;
		SendPref spref;
		ReadSendPreference(spref);
		if (spref.requestReport) RequestReport(state);
		NewRecordInCategory(db, pszTo, pszCompose, CAT_SENT, state);
		SortSMS(db);
	} else {
		FrmCustomAlert(AlertCustom, "Alert", "Message send failed.", "");
	}
}
Example #24
0
/***********************************************************************
 *
 * FUNCTION:     AppStart
 *
 * DESCRIPTION:  Get the current application's preferences.
 *
 * PARAMETERS:   nothing
 *
 * RETURNED:     Err value 0 if nothing went wrong
 *
 * REVISION HISTORY:
 *
 *
 ***********************************************************************/
static Err AppStartCheckHRmode()
{
	Err e = errNone;
	UInt32 depth = (OPTIONS_TST(kOptMode16Bit) && OPTIONS_TST(kOptDeviceOS5)) ? 16 : 8;

	// try to init Sony HR mode then Palm HR mode
	gVars->HRrefNum = SonyHRInit(depth);

	if (gVars->HRrefNum == sysInvalidRefNum) {
		if (e = PalmHRInit(depth))
			FrmCustomAlert(FrmErrorAlert,"Your device doesn't seem to support Hi-Res or 256color mode.",0,0);
	} else {
		OPTIONS_SET(kOptDeviceClie);
	}

	return e;
}
Example #25
0
Boolean load_reg_form() {

	if ( IsRegistered() ) {
		FrmCustomAlert(RegThanks, "", "", "");	
		return false;
	}


	CRegDialog frmPrefs;
	
	Boolean try_again = false;

	try_again = frmPrefs.DoModal();

	return try_again;

} // load_reg_form
Example #26
0
static void HandleButton
    (
    ButtonType* button
    )
{
    Err err;

    err = ClearData( button->creator, button->type );
    if ( err == errNone ) {
        HideNShow( button->recordIndex, button->sizeIndex,
            button->clearedIndex );
        button->status = CLEARED;
    } else {
        Char errCode[ 10 ];

        StrPrintF( errCode, "%d", err );
        FrmCustomAlert( errCannotDelete, errCode, NULL, NULL );
    }
}
Example #27
0
static void displayLoseDialog(int usershape)
{
  char buf[1000];
  int l=0; int i;

  l+=StrPrintF(buf+l, "Shape number: %d\n", keepEupEShapeListLast);
  
  l+=StrPrintF(buf+l, "Shapes: ");
  for(i=0;i<keepEupEShapeListLast;i++)
     l+=StrPrintF(buf+l, "%d,", keepEupEShapeList[i]);
  l+=StrPrintF(buf+l, "\n");
  
  buf[l]=0;

  FrmCustomAlert(alertInfo, 
                   "You lose!\n"
                   "Bummer!\n",
                   buf, "");
}
Example #28
0
static void RemoveCurrentSelection()
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormGroupManagement)) return;
	ListPtr list = (ListPtr) GetObjectPtr(form, ListGroups);
	Int16 sel = LstGetSelection(list);
	if (sel == noListSelection) {
		ShowMsg("Select a group first.");
		return;
	}

	if (FrmCustomAlert(AlertQuestion, "Do you really wanna remove current selection ?", "", "") == 1) return;
	
	RemovePhoneGroup(g_PhoneGroups[sel]);
	PhoneGroupPtr group = *(g_PhoneGroups.begin() + sel);
	g_PhoneGroups.erase(g_PhoneGroups.begin() + sel);
	delete group;
	DrawList();
}
Example #29
0
void debugDumpFern(double scale, 
   double xmin, double xmax, double dx, double xmid,
   double ymin, double ymax, double dy, double ymid,
   double xminy, double xmaxy, double yminx, double ymaxx
   )
{
  char buf[1000];
  int l=0;

  l+=StrPrintF(buf+l, "IFS Fern Info\n");
  l+=StrPrintF(buf+l, "Scale: %g\n", scale );
  l+=StrPrintF(buf+l, "X min max dx mid: %ld %ld %ld %ld\n", xmin, xmax, dx, xmid );
  l+=StrPrintF(buf+l, "Y min max dy mid: %lx %lx %lx %lx\n", ymin, ymax, dy, ymid );

  l+=StrPrintF(buf+l, "x max.min points %f,%f %f,%f\n", xmax, xmaxy, xmin, xminy );
  l+=StrPrintF(buf+l, "y max.min points %f,%f %f,%f\n", ymax, ymaxx, ymin, yminx );
  
  buf[l]=0;

  FrmCustomAlert(alertInfo, buf, "", "");
}
static Err RomVersionCheck(UInt16 launchFlags)
{
	UInt32 Version;
	FtrGet(sysFtrCreator, sysFtrNumROMVersion, &Version);

	if (Version < sysMakeROMVersion(5,0,0,sysROMStageDevelopment,0))
	{
		if ((launchFlags & sysAppLaunchFlagNewGlobals) != 0 &&
			(launchFlags & sysAppLaunchFlagUIApp) != 0)
		{
			FrmCustomAlert(WarningOKAlert, "System version 5.0 or greater is required to run this application!", " ", " ");

			// Palm OS 1.0 requires you to explicitly launch another app
			if (Version < sysMakeROMVersion(1,0,0,sysROMStageRelease,0))
			{
				AppLaunchWithCommand(sysFileCDefaultApp,
						sysAppLaunchCmdNormalLaunch, NULL);
			}
		}

		return sysErrRomIncompatible;
	}
	return errNone;
}