Пример #1
0
/* Get current selected note and fill out note properties elements.
   If selected == -1, clear and disable this fields. */
static void
UpdateNoteProperties()
{
  FormPtr frm = FrmGetActiveForm ();

  if (notelist.selected == -1) {
    FrmHideObject(frm, FrmGetObjectIndex(frm, ID_EditorDuration));
    FrmHideObject(frm, FrmGetObjectIndex(frm, ID_EditorVelocity));
    FrmHideObject(frm, FrmGetObjectIndex(frm, ID_EditorPause));
  }
  else {
    NotePtr notes = MemHandleLock(notelist.bufH);
    NotePtr note = notes + notelist.selected;

    ErrFatalDisplayIf(notelist.selected > notelist.num, "Invalid note index!");

    SetFieldTextFromNumber(ID_EditorDuration, note->dur);
    SetFieldTextFromNumber(ID_EditorVelocity, note->vel);
    SetFieldTextFromNumber(ID_EditorPause, note->pause);

    FrmShowObject(frm, FrmGetObjectIndex(frm, ID_EditorDuration));
    FrmShowObject(frm, FrmGetObjectIndex(frm, ID_EditorVelocity));
    FrmShowObject(frm, FrmGetObjectIndex(frm, ID_EditorPause));

    MemPtrUnlock(notes);
  }
}
Пример #2
0
/* Indicate that the next tap looks things up in the selected word */
static void ShowSelectWordTapIcon( void )
{
    FormType* mainForm;
    UInt16    prevCoordSys;

    if ( Prefs()->toolbar == TOOLBAR_NONE )
        return;

    mainForm = FrmGetFormPtr( GetMainFormId() );
    prevCoordSys = PalmSetCoordinateSystem( STANDARD );

    if ( Prefs()->toolbar == TOOLBAR_SILK ) {
        /* FIXME: figure this out */
    }
    else {
        FrmHideObject( mainForm, FrmGetObjectIndex( mainForm, bmpWait ) );

        if ( isSelectWordTapMode ) {
            FrmHideObject( mainForm, FrmGetObjectIndex( mainForm, bmpHome ) );
            FrmShowObject( mainForm, FrmGetObjectIndex( mainForm, bmpLookup ) );
        }
        else {
            FrmHideObject( mainForm, FrmGetObjectIndex( mainForm, bmpLookup ) );
            FrmShowObject( mainForm, FrmGetObjectIndex( mainForm, bmpHome ) );
        }
    }
    PalmSetCoordinateSystem( prevCoordSys );
}
Пример #3
0
/* A game of Hide and go Seek er, Show? */
static void HideNShow
    (
    UInt16 hideThis,
    UInt16 andThis,
    UInt16 butShowThis
    )
{
    FrmHideObject( form, FrmGetObjectIndex( form, hideThis ) );
    FrmHideObject( form, FrmGetObjectIndex( form, andThis ) );
    FrmShowObject( form, FrmGetObjectIndex( form, butShowThis ) );
}
Пример #4
0
/* Initialize the details form */
static void DetailsFormInit( void )
{
    FormType*   detailsForm;
    FieldType*  urlField;
    UInt16      reference;

    detailsForm = FrmGetFormPtr( frmDetails );
    urlField    = GetObjectPtr( frmDetailsLink );
    reference   = GetHistoryCurrent();

    if ( AddURLToField( urlField, reference ) )
        FrmShowObject( detailsForm, FrmGetObjectIndex( detailsForm,
                                        frmDetailsCopy ) );
    else
        FrmHideObject( detailsForm, FrmGetObjectIndex( detailsForm,
                                        frmDetailsCopy ) );
    FrmDrawForm( detailsForm );

    AddDocNameTitle( Prefs()->docName );

    CtlSetValue( GetObjectPtr( frmDetailsStatusRead ),
        LinkVisited( reference ) );
    CtlSetValue( GetObjectPtr( frmDetailsStatusUnread ),
        ! LinkVisited( reference ) );
    CtlSetValue( GetObjectPtr( frmDetailsShowImages ),
        ShowImages( reference ) );
}
Пример #5
0
static void DrawBuyEquipmentForm()
{
    FormPtr frmP = FrmGetActiveForm();
	int i;
	RectangularShortcuts( frmP, BuyEquipmentBButton );
	
	for (i=0; i<MAXWEAPONTYPE+MAXSHIELDTYPE+MAXGADGETTYPE; ++i)
	{
		RectangularButton( frmP, BuyEquipmentBuy0Button + i );
		
		if (i < MAXWEAPONTYPE)
		{
			if (BASEWEAPONPRICE( i ) <= 0)
				FrmHideObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) );
			else
				FrmShowObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) );
		}	
		else if (i < MAXWEAPONTYPE + MAXSHIELDTYPE)
		{
			if (BASESHIELDPRICE( i-MAXWEAPONTYPE ) <= 0)
				FrmHideObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) );
			else
				FrmShowObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) );
		}	
		else
		{
			if (BASEGADGETPRICE( i-MAXWEAPONTYPE-MAXSHIELDTYPE ) <= 0)
				FrmHideObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) );
			else
				FrmShowObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) );
		}
	}
	
	FrmDrawForm( frmP );
	
	for (i=0; i<MAXWEAPONTYPE; ++i)
		DrawItem( Weapontype[i].Name, 17+i*13, BASEWEAPONPRICE( i ) );

	for (i=0; i<MAXSHIELDTYPE; ++i)
		DrawItem( Shieldtype[i].Name, 17+(i+MAXWEAPONTYPE)*13, BASESHIELDPRICE( i ) );

	for (i=0; i<MAXGADGETTYPE; ++i)
		DrawItem( Gadgettype[i].Name, 17+(i+MAXWEAPONTYPE+MAXSHIELDTYPE)*13, BASEGADGETPRICE( i ) );

	DisplayTradeCredits();
}
Пример #6
0
static void SetupNewForm(FormPtr frm)
{
	FrmSetTitle(frm , "New");
	FrmHideObject(frm, FrmGetObjectIndex(frm, LabelReference));
	FrmHideObject(frm, FrmGetObjectIndex(frm, FieldReference));
	FrmHideObject(frm, FrmGetObjectIndex(frm, ScrollbarReference));
	
	RectangleType rect;
	rect.topLeft.x = 3;
	rect.topLeft.y = 32;
	FrmSetObjectBounds(frm, FrmGetObjectIndex(frm, LabelCompose), &rect);
	
	rect.topLeft.y = 44;
	rect.extent.x = 155;
	rect.extent.y = 95;
	FrmSetObjectBounds(frm, FrmGetObjectIndex(frm, FieldCompose), &rect); 

	FrmSetFocus(frm, FrmGetObjectIndex(frm, FieldTo));
}
Пример #7
0
// Show a dynamic label on the form.
void show_lab(FormPtr form, UInt16 labelID, Char* tmp_text) {
  UInt16 label_index;

  label_index = FrmGetObjectIndex(form, labelID);
  FrmHideObject(form, label_index);
  FrmCopyLabel(form, labelID, tmp_text);
  FrmShowObject(form, label_index);

  return;
}
Пример #8
0
bool wxControl::Show( bool show )
{
    FormType* form = (FormType*)GetParentForm();
    if(form==NULL)
        return false;
    uint16_t index = FrmGetObjectIndex(form,GetId());
    if(index==frmInvalidObjectId)
        return false;
    if(show)
        FrmShowObject(form,index);
    else
        FrmHideObject(form,index);
    return true;
}
Пример #9
0
static void MainFormHandleConnectionProgress(AppContext* appContext, FormType* form, EventType* event)
{
    Assert(event);
    ConnectionProgressEventData* data=reinterpret_cast<ConnectionProgressEventData*>(&event->data);
    if (connectionProgress==data->flag) 
        FrmUpdateForm(formDictMain, redrawLookupStatusBar);
    else
    {
        UInt16 index=FrmGetObjectIndex(form, buttonAbortLookup);
        Assert(frmInvalidObjectId!=index);
        
        if (connectionFinished==data->flag)
        {
            appContext->lookupStatusBarVisible=false;
            FrmHideObject(form, index);
            index=FrmGetObjectIndex(form, buttonFind);
            Assert(frmInvalidObjectId!=index);
            FrmShowObject(form, index);
            MainFormSelectWholeInputText(form);
        }
        else 
        {
            Assert(connectionStarted==data->flag);
            appContext->lookupStatusBarVisible=true;
            FrmShowObject(form, index);
            index=FrmGetObjectIndex(form, buttonFind);
            Assert(frmInvalidObjectId!=index);
            FrmHideObject(form, index);
        }
        FrmUpdateForm(formDictMain, redrawAll); 
    }        

    if (connectionFinished==data->flag)
    {
        SendEvtWithType(evtConnectionFinished);
    }
}
Пример #10
0
void  CBiddingForm::InitDisplay() {

	UInt16 player_names[] = {BiddingP0NameField, BiddingP1NameField, BiddingP2NameField, BiddingP3NameField };
	UInt16 player_bids[] = {BiddingP0BidField, BiddingP1BidField, BiddingP2BidField, BiddingP3BidField };

	if ( gManager->CutThroat() == true ) {
		player_names[2] = player_names[3];
		player_bids[2] = player_bids[3];

		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingEWScoreField ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingUnnamed1011Label ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingNSScoreField ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingLabel1Label ) );


		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingP2NameField ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingP2BidField ) );
	}

	for ( Int16 i = 0; i < gManager->numPlayers; i++ ) {

		bids[i].Attach(this, player_bids[i]);
		names[i].Attach(this, player_names[i]);
		
		if ( gManager->CutThroat() == true ) {
			CString foo;
			foo.Format("%d", gManager->scores[i]);
			CString tmp = gManager->players[i]->getName() + ": " + foo;
			names[i].Replace( tmp );
		}
		else {
			names[i].Replace( (const char *)gManager->players[i]->getName() );
		}

	}


	if ( gManager->CutThroat() == false ) {
		ns_score.Attach(this, BiddingNSScoreField);
		ew_score.Attach(this, BiddingEWScoreField);

		char score0str[4];
		char score1str[4];

		StrPrintF(score0str, "%d", gManager->scores[0]);
		StrPrintF(score1str, "%d", gManager->scores[1]);

		ns_score.Replace( score0str );
		ew_score.Replace( score1str );
	}

	player_hand.Attach(this, PlayerBidPlayerHandGadget );
	player_hand.CurrentPlayer(gManager->players[gManager->humanIndex]);

	bid_winner.Attach(this, BidWinnerField);
}
Пример #11
0
static void DrawSpecialEventForm()
{
    FormPtr frmP;
	char theText[320];

	frmP = FrmGetActiveForm();
	setCurrentWinTitle( SpecialEvent[CURSYSTEM.Special].Title );
	if (SpecialEvent[CURSYSTEM.Special].JustAMessage)
	{
		FrmHideObject( frmP, FrmGetObjectIndex( frmP, SpecialEventYesButton ) );
		FrmHideObject( frmP, FrmGetObjectIndex( frmP, SpecialEventNoButton ) );
		FrmShowObject( frmP, FrmGetObjectIndex( frmP, SpecialEventOKButton ) );
	}
	else
	{
		FrmShowObject( frmP, FrmGetObjectIndex( frmP, SpecialEventYesButton ) );
		FrmShowObject( frmP, FrmGetObjectIndex( frmP, SpecialEventNoButton ) );
		FrmHideObject( frmP, FrmGetObjectIndex( frmP, SpecialEventOKButton ) );
	}
	FrmDrawForm ( frmP );
	
	SysCopyStringResource(theText, SpecialEvent[CURSYSTEM.Special].QuestStringID);
	DisplayPage(theText, 18);
}
Пример #12
0
/***********************************************************************
 *
 * FUNCTION:    SelectOneTime
 *
 * DESCRIPTION: Display a form showing a time and allow the user
 *              to select a different time. This is the single time
 *					 dialog as seen in general panel
 *
 * PARAMETERS:  hour	- pointer to hour to change
 					 minute - pointer to minute to change
 *				title	- string title for the dialog
 *
 * RETURNED:	 true if the OK button was pressed
 *					 if true the parameters passed are changed
 *
 * REVISION HISTORY:
 *			Name	Date		Description
 *			----	----		-----------
 *			roger	12/2/94		Initial Revision in General Panel
 *			gavin	3/20/98		Extracted into separate system function
 *
 ***********************************************************************/
Boolean SelectOneTime(Int16 *hour,Int16 *minute, const Char * titleP)
{
	FormType * originalForm, * frm;
	EventType event;
	Boolean confirmed = false;
	Boolean handled = false;
	Boolean done = false;
	TimeFormatType timeFormat;			// Format to display time in
	Int16   curHour;
	UInt16	currentTimeButton;
	UInt8	hoursTimeButtonValue;
	Char	hoursTimeButtonString[3];
	UInt8	minuteTensButtonValue;
	Char	minuteTensButtonString[2];
	UInt8	minuteOnesButtonValue;
	Char	minuteOnesButtonString[2];
	Char	separatorString[3];

	timeFormat = (TimeFormatType)PrefGetPreference(prefTimeFormat);

	originalForm = FrmGetActiveForm();
	frm = (FormType *) FrmInitForm (SelectOneTimeDialog); 
	if (titleP)
		FrmSetTitle (frm, (Char *) titleP);

	FrmSetActiveForm (frm);
	
	curHour = *hour;
	
	if (Use24HourFormat(timeFormat))
		{
		// Hide the AM & PM ui
		FrmHideObject (frm, FrmGetObjectIndex (frm, timeAMCheckbox));
		FrmHideObject (frm, FrmGetObjectIndex (frm, timePMCheckbox));
		}
	else 
		{
		if (curHour < 12)
			CtlSetValue(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, timeAMCheckbox)), true);
		else
			{
			CtlSetValue(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, timePMCheckbox)), true);
			curHour -= 12;
			}
		
		if (curHour == 0)
			curHour = 12;
		}

	// Set the time seperator to the system defined one
	separatorString[0] = TimeSeparator(timeFormat);
	separatorString[1] = '\0';
	FrmCopyLabel(frm, timeSeparatorLabel, separatorString);


	// Now set the time displayed in the push buttons.
	hoursTimeButtonValue = curHour;
	StrIToA(hoursTimeButtonString, hoursTimeButtonValue);
	CtlSetLabel(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, timeHourButton)),
		hoursTimeButtonString);
		
	minuteTensButtonValue = *minute / 10;
	StrIToA(minuteTensButtonString, minuteTensButtonValue);
	CtlSetLabel(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, timeMinutesTensButton)),
		minuteTensButtonString);
		
	minuteOnesButtonValue = *minute % 10;
	StrIToA(minuteOnesButtonString, minuteOnesButtonValue);
	CtlSetLabel(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, timeMinutesOnesButton)),
		minuteOnesButtonString);


	// Set the hour time button to be the one set by the arrows
	currentTimeButton = defaultTimeButton;
	CtlSetValue(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, defaultTimeButton)), true);

	
	FrmDrawForm (frm);

	
	while (!done)
		{
		EvtGetEvent (&event, evtWaitForever);

		if (! SysHandleEvent ((EventType *)&event))	
			FrmHandleEvent (frm,&event); 

		if (event.eType == ctlSelectEvent)
			{
			switch (event.data.ctlSelect.controlID)
				{
				case timeOkButton:
					frm = FrmGetActiveForm();

					// Set the new time (seconds are cleared).
					if (Use24HourFormat(timeFormat))
						*hour = hoursTimeButtonValue;
					else
						{
						*hour = hoursTimeButtonValue % 12 + // 12am is 0 hours!
							(CtlGetValue(FrmGetObjectPtr (frm,
																	FrmGetObjectIndex (frm,
																					timePMCheckbox)))
							? 12 : 0);
						}

					*minute = minuteTensButtonValue * 10 + minuteOnesButtonValue;

					done = true;
					confirmed = true;
					break;

				case timeCancelButton:
					done = true;
					break;
					
				case timeDecreaseButton:
				case timeIncreaseButton:
					frm = FrmGetActiveForm();
					switch (currentTimeButton)
						{
						// MemHandle increasing and decreasing the time for each time digit
						case timeHourButton:
							if (event.data.ctlSelect.controlID == timeDecreaseButton)
								{
								if (Use24HourFormat(timeFormat))
									if (hoursTimeButtonValue > 0)
										hoursTimeButtonValue--;
									else
										hoursTimeButtonValue = 23;
								else
									if (hoursTimeButtonValue > 1)
										hoursTimeButtonValue--;
									else
										hoursTimeButtonValue = 12;
								}
							else
								{
								if (Use24HourFormat(timeFormat))
									if (hoursTimeButtonValue < 23)
										hoursTimeButtonValue++;
									else
										hoursTimeButtonValue = 0;
								else
									if (hoursTimeButtonValue < 12)
										hoursTimeButtonValue++;
									else
										hoursTimeButtonValue = 1;
								}
								
							StrIToA(hoursTimeButtonString, hoursTimeButtonValue);
							CtlSetLabel(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, 
								timeHourButton)),	hoursTimeButtonString);
							break;

						case timeMinutesTensButton:
							if (event.data.ctlSelect.controlID == timeDecreaseButton)
								{
								if (minuteTensButtonValue > 0)
									minuteTensButtonValue--;
								else
									minuteTensButtonValue = 5;
								}
							else
								{
								if (minuteTensButtonValue < 5)
									minuteTensButtonValue++;
								else
									minuteTensButtonValue = 0;
								}

							StrIToA(minuteTensButtonString, minuteTensButtonValue);
							CtlSetLabel(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, 
								timeMinutesTensButton)), minuteTensButtonString);
							break;
							
						case timeMinutesOnesButton:
							if (event.data.ctlSelect.controlID == timeDecreaseButton)
								{
								if (minuteOnesButtonValue > 0)
									minuteOnesButtonValue--;
								else
									minuteOnesButtonValue = 9;
								}
							else
								{
								if (minuteOnesButtonValue < 9)
									minuteOnesButtonValue++;
								else
									minuteOnesButtonValue = 0;
								}

							StrIToA(minuteOnesButtonString, minuteOnesButtonValue);
							CtlSetLabel(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, 
								timeMinutesOnesButton)), minuteOnesButtonString);
							break;
						}

					handled = true;
					break;	// timeDecreaseButton & timeIncreaseButton
		
				case timeHourButton:
					currentTimeButton = timeHourButton;
					break;
					
				case timeMinutesTensButton:
					currentTimeButton = timeMinutesTensButton;
					break;
					
				case timeMinutesOnesButton:
					currentTimeButton = timeMinutesOnesButton;
					break;
					
				}
			}

		else if (event.eType == appStopEvent)
			{
			EvtAddEventToQueue (&event);
			done = true;
			break;
			}
			
		}	// end while true
		
	FrmEraseForm (frm);
	FrmDeleteForm (frm);
	
	FrmSetActiveForm(originalForm);
	
	return (confirmed);
}
Пример #13
0
/***********************************************************************
 *
 * FUNCTION:    SelectTimeZone
 *
 * DESCRIPTION: Display a form showing a time zone and allow the user
 *              to select a different time zone. This is the time zone
 *					 dialog as seen in Date & Dime panel
 *
 * PARAMETERS:
 *		ioTimeZoneP				<->	pointer to time zone to change
 *		ioLocaleInTimeZoneP	<->	Ptr to locale found in time zone.
 *		titleP					 ->	String title for the dialog.
 *		showTimes				 -> 	True => show current and new times
 *		anyLocale				 ->	True => ignore ioLocaleInTimeZoneP on entry.
 *
 * RETURNED:
 *		true if the OK button was pressed (in which case *ioTimeZoneP and
 *		*ioCountryInTimeZoneP might be changed).
 *
 * HISTORY:
 *		03/02/00	peter	Created by Peter Epstein.
 *		04/03/00	peter	Allow NULL currentTimeP.
 *		04/12/00	peter API changed to get rid of trigger text
 *		04/14/00	peter Update current & new time as time passes
 *		07/31/00	kwk	Use SysTicksPerSecond() routine vs. sysTicksPerSecond macro.
 *					kwk	Re-wrote to use set of resources (name, offset, country),
 *							scrollbar vs. arrows, etc.
 *		08/01/00	kwk	Support scroll-to-key. Fixed scrollbar/list sync bugs.
 *		08/02/00	kwk	New API w/ioCountryInTimeZoneP and anyCountry parameters.
 *					kwk	Call FrmHandleEvent _after_ our event handling code has
 *							decided that it doesn't want to handle the event, not before.
 *		08/03/00	kwk	Call LstSetListChoices before calling LstGetVisibleItems,
 *							as otherwise accessing the time zone picker from the
 *							Setup app (when <showTimes> is false) gives you a two-
 *							line high display because LstGetVisibleItems returns 0.
 *		08/18/00	kwk	Play error sound if user writes letter that doesn't
 *							match any entries.
 *					kwk	Don't select item if doing scroll-to-view for entry
 *							that matches the letter the user wrote.
 *		08/21/00	kwk	Scroll-to-view with text entry now scrolls to the top
 *							of the list, versus the middle.
 *		10/09/00	peter	Get rid of scroll bar and let list do the scrolling.
 *		11/17/00	CS		Change ioCountryInTimeZoneP to ioLocaleInTimeZoneP,
 *							(and anyCountry to anyLocale, but that doesn't matter),
 *							since CountryType is only a UInt8, and this may
 *							change someday.
 *
 ***********************************************************************/
Boolean SelectTimeZone(Int16 *ioTimeZoneP, LmLocaleType* ioLocaleInTimeZoneP,
				const Char *titleP, Boolean showTimes, Boolean anyLocale)
{
	FormType* originalForm;
	FormType* dialog;
	EventType event;
	Boolean confirmed = false;
	Boolean done = false;
	Boolean adjustTimes = false;
	Boolean foundLocale = false;
	MemHandle currentTimeHandle, newTimeHandle;
	ListPtr listP;
	Int16 oldTimeZone, newTimeZone, testTimeZone;
	LmLocaleType newTimeZoneLocale;
	Int16 delta, closestDelta, timeZoneIndex, closestIndex;
	DateTimeType currentTime, newTime;
	TimeZoneEntryType* tzArrayP;
	UInt16 numTimeZones;
	MemHandle tzNamesH;
	
	if (showTimes)
	{
		TimSecondsToDateTime(TimGetSeconds(), &currentTime);
	}
	
	oldTimeZone = *ioTimeZoneP;
	newTimeZone = oldTimeZone;
	newTimeZoneLocale = *ioLocaleInTimeZoneP;
	
	originalForm = FrmGetActiveForm();
	dialog = (FormType *) FrmInitForm (TimeZoneDialogForm); 
	listP = FrmGetObjectPtr (dialog, FrmGetObjectIndex (dialog, TimeZoneDialogTimeZoneList));
	
	if (titleP)
	{
		FrmSetTitle (dialog, (Char *) titleP);
	}
	
	FrmSetActiveForm (dialog);
	
	// We need to call LstSetListChoices before calling LstSetHeight below, as otherwise
	// LstGetVisibleItems will return 0.
	tzArrayP = PrvCreateTimeZoneArray(&tzNamesH, &numTimeZones);
	LstSetListChoices(listP, (Char**)tzArrayP, numTimeZones);
	
	if (showTimes)
	{
		currentTimeHandle = MemHandleNew(timeStringLength + 1 + dowLongDateStrLength + 1);
		ErrFatalDisplayIf (!currentTimeHandle, "Out of memory");
		newTimeHandle = MemHandleNew(timeStringLength + 1 + dowLongDateStrLength + 1);
		ErrFatalDisplayIf (!newTimeHandle, "Out of memory");

		PrvSetTimeField(dialog, TimeZoneDialogCurrentTimeField, currentTimeHandle, &currentTime, false);
	}
	else
	{
		// Hide the current and new time.
		FrmHideObject(dialog, FrmGetObjectIndex (dialog, TimeZoneDialogCurrentTimeLabel));
		FrmHideObject(dialog, FrmGetObjectIndex (dialog, TimeZoneDialogCurrentTimeField));
		FrmHideObject(dialog, FrmGetObjectIndex (dialog, TimeZoneDialogNewTimeLabel));
		FrmHideObject(dialog, FrmGetObjectIndex (dialog, TimeZoneDialogNewTimeField));
		
		// Make the list show more items to take up extra the space.
		LstSetHeight(listP, LstGetVisibleItems(listP) + extraTimeZonesToShowWhenNoTimes);
	}
	
	// Find the time zone in the list closest to the current time zone, and that
	// matches <*ioLocaleInTimeZoneP> if <anyLocale> is false.
	closestDelta = hoursInMinutes * hoursPerDay;		// so big that all others will be smaller
	for (timeZoneIndex = 0; timeZoneIndex < numTimeZones; timeZoneIndex++)
	{
		Boolean checkDelta = anyLocale;
		testTimeZone = tzArrayP[timeZoneIndex].tzOffset;
		delta = Abs(testTimeZone - oldTimeZone);
		
		if (!anyLocale)
		{
			if (tzArrayP[timeZoneIndex].tzCountry == ioLocaleInTimeZoneP->country)
			{
				// If we haven't previously found a matching locale, reset the
				// delta so that this entry overrides any previous best entry.
				if (!foundLocale)
				{
					foundLocale = true;
					closestDelta = hoursInMinutes * hoursPerDay;
				}
				
				checkDelta = true;
			}
			
			// If we haven't yet found a matching locale, go for the closest delta.
			else
			{
				checkDelta = !foundLocale;
			}
		}
		
		// If we want to check the time zone delta, do it now.
		if (checkDelta && (delta < closestDelta))
		{
			closestIndex = timeZoneIndex;
			closestDelta = delta;
		}
	}
	
	// Scroll so that time zone is in the center of the screen and select it if it's an exact match.
	LstSetTopItem(listP, max(0, closestIndex - (LstGetVisibleItems(listP) / 2)));
	if ((closestDelta == 0) && (anyLocale || foundLocale))
	{
		LstSetSelection(listP, closestIndex);
		if (showTimes)
		{
			newTime = currentTime;
			PrvSetTimeField(dialog, TimeZoneDialogNewTimeField, newTimeHandle, &newTime, false);
		}
	}
	else
	{
		LstSetSelection(listP, noListSelection);
	}
	
	LstSetDrawFunction(listP, PrvTimeZoneListDrawItem);
	
	FrmDrawForm (dialog);
	
	while (!done)
	{
		Boolean handled = false;
		EvtGetEvent(&event, SysTicksPerSecond());		// so we can update the current and new time

		if (SysHandleEvent ((EventType *)&event))
		{
			continue;
		}
		
		if (event.eType == nilEvent)
		{
			if (showTimes)
			{
				PrvUpdateTimeFields(	dialog,
										&currentTime,
										&newTime,
										currentTimeHandle,
										newTimeHandle,
										TimeZoneDialogCurrentTimeField,
										TimeZoneDialogNewTimeField);
			}
		}
		
		else if (event.eType == ctlSelectEvent)
		{
			handled = true;
			
			switch (event.data.ctlSelect.controlID)
			{
				case TimeZoneDialogOKButton:
					// Set the new time zone.
					*ioTimeZoneP = newTimeZone;
					*ioLocaleInTimeZoneP = newTimeZoneLocale;

					done = true;
					confirmed = true;
				break;

				case TimeZoneDialogCancelButton:
					done = true;
				break;
				
				default:
					ErrNonFatalDisplay("Unknown control in form");
				break;
			}
		}
		
		// User tapped on a time zone in the list.
		else if (event.eType == lstSelectEvent)
		{
			UInt16 localeIndex;
			
			ErrNonFatalDisplayIf(event.data.lstSelect.listID != TimeZoneDialogTimeZoneList,
										"Unknown list in form");
			
			newTimeZone = tzArrayP[event.data.lstSelect.selection].tzOffset;
			newTimeZoneLocale.country =
				tzArrayP[event.data.lstSelect.selection].tzCountry;
			newTimeZoneLocale.language = lmAnyLanguage;
			if (LmLocaleToIndex(&newTimeZoneLocale, &localeIndex) == errNone)
			{
				if (LmGetLocaleSetting(	localeIndex,
												lmChoiceLocale,
												&newTimeZoneLocale,
												sizeof(newTimeZoneLocale)))
				{
					ErrNonFatalDisplay("Can\'t get locale");
				}
			}
			adjustTimes = showTimes;
			handled = true;
		}

		else if (event.eType == keyDownEvent)
		{
			if	(!TxtCharIsHardKey(event.data.keyDown.modifiers, event.data.keyDown.chr))
			{
				//	Hard scroll buttons
				if (EvtKeydownIsVirtual(&event))
				{
					if (event.data.keyDown.chr == vchrPageUp)
					{
						handled = true;
						LstScrollList(listP, winUp, LstGetVisibleItems(listP) - 1);
					}
					else if (event.data.keyDown.chr == vchrPageDown)
					{
						handled = true;
						LstScrollList(listP, winDown, LstGetVisibleItems(listP) - 1);
					}
				}
				else if (TxtCharIsPrint(event.data.keyDown.chr))
				{
					Int16 index;
					
					handled = true;
					index = PrvSearchTimeZoneNames(tzArrayP, numTimeZones, event.data.keyDown.chr);
					
					if (index != noListSelection)
					{
						Int16 delta = index - listP->topItem;
						if (delta < 0)
						{
							LstScrollList(listP, winUp, -delta);
						}
						else if (delta > 0)
						{
							LstScrollList(listP, winDown, delta);
						}
					}
					else
					{
						SndPlaySystemSound(sndError);
					}
				}
			}
		}

		else if (event.eType == appStopEvent)
		{
			EvtAddEventToQueue (&event);
			done = true;
			break;
		}
		
		// If we didn't handle the event, give the form code a crack at it.
		// This simulates the "normal" method of installing an event handler
		// for a form, which gets called, and then if it returns false, the
		// FrmHandleEvent routine gets called.
		if (!handled)
		{
			FrmHandleEvent(dialog, &event); 
		}
		
		// If something changed, and we need to update our time display,
		// do it now.
		if (adjustTimes)
		{
			adjustTimes = false;
			newTime = currentTime;
			TimAdjust(&newTime, (Int32)(newTimeZone - oldTimeZone) * minutesInSeconds);
			PrvSetTimeField(dialog, TimeZoneDialogNewTimeField, newTimeHandle, &newTime, true);
		}
	}	// end while true
		
	if (showTimes)
	{
		FldSetTextHandle(FrmGetObjectPtr (dialog, FrmGetObjectIndex (dialog, TimeZoneDialogCurrentTimeField)), NULL);
		FldSetTextHandle(FrmGetObjectPtr (dialog, FrmGetObjectIndex (dialog, TimeZoneDialogNewTimeField)), NULL);
		MemHandleFree(currentTimeHandle);
		MemHandleFree(newTimeHandle);
	}
	
	FrmEraseForm (dialog);
	FrmDeleteForm (dialog);
	FrmSetActiveForm(originalForm);

	PrvDeleteTimeZoneArray(tzArrayP, tzNamesH);

	return confirmed;
} // SelectTimeZone
Пример #14
0
Boolean ReplyFormHandleEvent(EventType * eventP)
{
	Boolean handled = false;
	FormType * frmP;
	static Boolean listShown = false;
	
	frmP = FrmGetActiveForm();

	switch (eventP->eType) 
	{
		case frmOpenEvent:
			switch (g_ComposeMode) {
				case COMPOSE_REPLY:
					ReplyCurrentRecord(g_SmsDb);
					SetupReplyForm(frmP);
					break;
				case COMPOSE_NEW:
					SetupNewForm(frmP);
					break;
				case COMPOSE_FORWARD:
					ForwardCurrentRecord(g_SmsDb);
					SetupNewForm(frmP);
					break;
				case COMPOSE_FEATURE:
					SetupFeatureNew();
					SetupNewForm(frmP);
					break;
				case COMPOSE_RESTORE:
					RestoreReplyForm();
					break;
			}
			FrmDrawForm(frmP);
			ListAllGroups();
			SetTriggerText(0);
			handled = true;
			break;
		case frmCloseEvent:
			ClearPhoneGroups(g_PhoneGroups);
			break;
		case menuEvent:
			switch(eventP->data.menu.itemID) {
				case MenuItemQueue:
					DoQueue();
					break;
				case MenuItemBack:
					DoBack();
					break;
				case MenuItemDraft:
					DoDraft();
					break;
				case MenuItemSend:
					DoSend();
					break;
				case MenuItemSendAndBack:
					DoSendAndBack();
					break;
				case MenuItemSelectTo:
					SelectTo();
					break;
				case MenuItemSelectGroup:
					CtlHitControl((ControlPtr) GetObjectPtr(frmP, TriggerGroup));
					break;
			}
			break;
		case ctlSelectEvent:
			switch(eventP->data.ctlSelect.controlID) {
				case ButtonSendAndBack:
					DoSendAndBack();
					break;
				case ButtonBack:
					DoBack();
					break;
				case ButtonGo:
					DoSend();
					break;
				case ButtonSelectTo:
					SelectTo();
					break;
				case TriggerGroup:
					if (listShown) {
						FrmHideObject(frmP, FrmGetObjectIndex(frmP, ListGroups));
						FrmDrawForm(frmP);
						listShown = false;
					} else {
						FrmShowObject(frmP, FrmGetObjectIndex(frmP, ListGroups));
						listShown = true;
					}
					handled = true;
					break;
			}
			break;
		case penDownEvent:
			if (IsEventInControl(frmP, eventP, TriggerGroup)) break;
			if (IsEventInControl(frmP, eventP, ListGroups)) break;
			FrmHideObject(frmP, FrmGetObjectIndex(frmP, ListGroups));
			FrmDrawForm(frmP);
			listShown = false;
			break;
		case lstSelectEvent:
			if (eventP->data.lstSelect.listID == ListGroups) {
				FrmHideObject(frmP, FrmGetObjectIndex(frmP, ListGroups));
				FrmDrawForm(frmP);
				listShown = false;
				
				ListPtr list = (ListPtr) GetObjectPtr(frmP, ListGroups);
				Int16 sel = LstGetSelection(list);
				if (sel == noListSelection) {
					ShowMsg("Select a group.");
					break;
				}
				SetTriggerText(sel);
			}
			break;
		case keyDownEvent:
			WChar chr = eventP->data.keyDown.chr;
			UInt16 		keyCode		= eventP->data.keyDown.keyCode;
			switch(chr)
			{
				case vchrPageUp:
					if (listShown)
						SelectNextInList(-1);
					else
						ScrollFieldPage(frmP, FieldReference, ScrollbarReference, winUp);
					break;
				case vchrPageDown:
					if (listShown)
						SelectNextInList(1);
					else
						ScrollFieldPage(frmP, FieldReference, ScrollbarReference, winDown);
					break;
				case vchrNavChange:
					if(keyCode & navBitSelect) {
						FrmHideObject(frmP, FrmGetObjectIndex(frmP, ListGroups));
						FrmDrawForm(frmP);
						listShown = false;
						
						ListPtr list = (ListPtr) GetObjectPtr(frmP, ListGroups);
						Int16 sel = LstGetSelection(list);
						if (sel == noListSelection) {
							ShowMsg("Select a group.");
							break;
						}
						SetTriggerText(sel);
					}
					break;
			}
			break;
		case sclRepeatEvent:
			ScrollFieldByEvent(frmP, eventP, FieldReference, ScrollbarReference);
			break;
	}
	return handled;
}
Пример #15
0
static void HideObject (FormPtr frm, UInt16 objectID)
{
	FrmHideObject (frm, FrmGetObjectIndex (frm, objectID));
}
Пример #16
0
void CGameForm::InitScreen() {

	UInt16 player_names[] = {MainP0NameField, 
							MainP1NameField,
							MainP2NameField,
							MainP3NameField};

	if ( gManager->CutThroat() == true ) {
		player_names[2] = player_names[3];
	}


	for ( Int16 i = 0; i < gManager->numPlayers; i++ ) {
		names[i].Attach(this, player_names[i]);
		names[i].Replace((const char *)gManager->players[i]->getName() );		

		if ( gManager->CutThroat() == true ) {

			CString foo;
			foo.Format("%d pts", gManager->scores[i]);

			if ( i == 1 || i == 2 ) {
				CField tmpscore;

				if ( i == 1 ) {
					tmpscore.Attach(this, MainP1ScoreField);
				}
				else {
					tmpscore.Attach(this, MainP3ScoreField);
				}
				
				tmpscore.Replace(foo);
			}
			else {
				CString tmp = gManager->players[i]->getName() + ": " + foo;
				names[i].Replace( tmp );
			}

		}

	}
	
	bidder_name.Attach(this, MainBidderField);
	bidder_name.Replace( (const char *)(*gManager->tbl->winning_bidder)->getName() );

	if ( gManager->CutThroat() == false ) {

		ns_score.Attach(this, MainNSScoreField);
		ew_score.Attach(this, MainEWScoreField);

		char score0str[4];
		char score1str[4];

		StrPrintF(score0str, "%d", gManager->scores[0] );
		StrPrintF(score1str, "%d", gManager->scores[1] );

		ns_score.Replace( score0str );
		ew_score.Replace( score1str );
	}
	else {

		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), NSScoreLabel ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), EWScoreLabel ) );
	}


	played_cards.Attach(this, MainPlayedCardsGadget );
	played_cards.CurrentTrick(gManager->trk);

	player_hand.Attach(this, MainPlayerHandGadget );
	player_hand.CurrentTrick(gManager->trk);
	player_hand.CurrentPlayer(gManager->players[gManager->humanIndex]);

}
Пример #17
0
/*
** TrackXferDone
*/
static void TrackXferDone(DynamicButtonType* btn) {
  RectangleType bounds[5], frame, popFrame, popShadowFrame;
  Boolean penDown, on_button;
  Int16 x, y, clicked_on = 0;
  Int16 state = 1;
  Int16 i = 0;
  WinHandle offscreenH = NULL;
  FormType* frm = FrmGetActiveForm();
  const UInt16 listIdx = FrmGetObjectIndex(frm, XferDoneList);
  ListType* list = FrmGetObjectPtr(frm, listIdx);
  UInt16 width = 0, choices = 0;
  Err err = errNone;
  Char str[48];
  Int16 n = 0;

  /* Save the old drawing context */
  WinPushDrawState();

  /* This should match the XferDoneButton bounds */
  FrmGetObjectBounds(frm, FrmGetObjectIndex(frm, btn->id), &bounds[0]);

  /* Invert the done button */
  SelectAndDrawButton(btn, true);
  SndPlaySystemSound(sndClick);

  /* Set the status of each menu pick */
  for (; i < 4; i++)
    d.xfer.status[i] = 0x00;
  
  if (xferGotoIsAlways)
    d.xfer.status[0] = TRACKXFERDONE_ALWAYS;
  else if (xferGotoIsNever)
    d.xfer.status[0] = TRACKXFERDONE_NEVER;
  else if (p.flags&PFLAGS_XFER_GOTO)
    d.xfer.status[0] = TRACKXFERDONE_CHECKED;

  if (xferCompleteIsAlways)
    d.xfer.status[1] = TRACKXFERDONE_ALWAYS;
  else if (xferCompleteIsNever)
    d.xfer.status[1] = TRACKXFERDONE_NEVER;
  else if (d.xfer.complete)
    d.xfer.status[1] = TRACKXFERDONE_CHECKED;

  if (!d.linker_available)
    d.xfer.status[2] = TRACKXFERDONE_NEVER;
  else if (p.flags&PFLAGS_XFER_BACKLINK)
    d.xfer.status[2] = TRACKXFERDONE_CHECKED;
  if (p.flags&PFLAGS_XFER_DELETE)
    d.xfer.status[3] = TRACKXFERDONE_CHECKED;

  for (i = 0; i < 4; ++i) {
    if (!(d.xfer.status[i] & TRACKXFERDONE_NEVER)) {
      d.xfer.choice_map[choices] = i;
      ++choices;

      /* calculate list width */
      SysCopyStringResource(str, XferMenuOptionsStrings + i);
      n = FntCharsWidth(str, StrLen(str));
      width = Max(width, n);
    }
  }

  LstSetDrawFunction(list, XferDoneListDrawFunc);
  LstSetListChoices(list, 0, choices);
  LstSetHeight(list, Min(choices, 10));
  FrmGetObjectBounds(frm, listIdx, &frame);
  frame.topLeft.y = 144 - frame.extent.y - 1; /* -1 to compensate for white border */
  frame.extent.x = width + 15 + 6;
  FrmSetObjectBounds(frm, listIdx, &frame);
  WinGetFramesRectangle(popupFrame, &frame, &popFrame);
  WinGetFramesRectangle(rectangleFrame, &popFrame, &popShadowFrame);

  for (i = 0; i < choices; ++i)
    RctSetRectangle(&bounds[i+1], frame.topLeft.x, frame.topLeft.y + 10 * i, 
		    frame.extent.x, 10);

  /* Save the bits of the whole menu */
  offscreenH = WinSaveBits(&popShadowFrame, &err);
  if (err) abort();

  /* None selected */
  LstSetSelection(list, -1);

  FrmShowObject(frm, listIdx);
  WinEraseRectangle(&popShadowFrame, 0);
  LstDrawList(list);
  WinEraseRectangleFrame(rectangleFrame, &frame);
  WinDrawRectangleFrame(popupFrame, &frame);

  do {
    EvtGetPen(&x, &y, &penDown);
    if (!state || !RctPtInRectangle(x, y, &bounds[state-1])) {
      on_button = false;
      for (i = 1; i <= choices + 1; i++) {
	if ((state != i) && RctPtInRectangle(x, y, &bounds[i-1])) {
	  /* Invert the new state */
	  LstSetSelection(list, i - 2);
	  LstDrawList(list);
	  WinEraseRectangleFrame(rectangleFrame, &frame);
	  WinDrawRectangleFrame(popupFrame, &frame);
	  
	  SelectAndDrawButton(btn, i == 1);
	  
	  state = i;
	  on_button = true;
	}
      }

      if (state && !on_button) {
	/* Moved off the current button */
	LstSetSelection(list, -1);
	LstDrawList(list);
	WinEraseRectangleFrame(rectangleFrame, &frame);
	WinDrawRectangleFrame(popupFrame, &frame);

	if (state == 1) 
	  SelectAndDrawButton(btn, false);
	state = 0;
      }
    }
  } while (penDown);

  FrmHideObject(frm, listIdx);
  LstEraseList(list);

  /* Restore the framed rect */
  WinRestoreBits(offscreenH, popShadowFrame.topLeft.x, popShadowFrame.topLeft.y);

  /* Unselect the button */
  SelectAndDrawButton(btn, false);

  /* Finish up if we just tapped the button */
  if (RctPtInRectangle(x, y, &bounds[0])) {
    FinishXferMode();
    
    /* Restore the old draw state */
    WinPopDrawState();
    return;
  }

  /* Change the setting for goto or delete */
  for (i = 1; i <= choices; i++) {
    if (RctPtInRectangle(x, y, &bounds[i])) {
      clicked_on = i;
      break;
    }
  }

  if (clicked_on) 
    clicked_on = d.xfer.choice_map[clicked_on-1] + 1;

  switch (clicked_on) {
  case 1: /* Goto */
    if (d.xfer.status[0] & TRACKXFERDONE_CHECKED)
      p.flags &= ~PFLAGS_XFER_GOTO;
    else if (!d.xfer.status[0])
      p.flags |= PFLAGS_XFER_GOTO;
    break;
  case 2: /* Complete */
    if (d.xfer.status[1] & TRACKXFERDONE_CHECKED)
      d.xfer.complete = false;
    else if (!d.xfer.status[1])
      d.xfer.complete = true;
    break;
  case 3: /* BackLink */
    if (d.xfer.status[2] & TRACKXFERDONE_CHECKED)
      p.flags &= ~PFLAGS_XFER_BACKLINK;
    else if (!d.xfer.status[2]) {
      p.flags |= PFLAGS_XFER_BACKLINK;
      p.flags &= ~PFLAGS_XFER_DELETE; /* No delete if backlink */
    }
    break;
  case 4: /* Delete */
    if (d.xfer.status[3] & TRACKXFERDONE_CHECKED)
      p.flags &= ~PFLAGS_XFER_DELETE;
    else if (!d.xfer.status[3]) {
      p.flags |= PFLAGS_XFER_DELETE;
      p.flags &= ~PFLAGS_XFER_BACKLINK; /* No backlink if delete */
    }
    break;
  }

  /* Click and redraw the button */
  if (clicked_on) {
    DrawXferDoneButton(btn);
    DynBtnDraw(btn);
    
    if (d.xfer.status[clicked_on-1] & TRACKXFERDONE_ALWAYS)
      SndPlaySystemSound(sndWarning);
    else
      SndPlaySystemSound(sndClick);
  }

  /* Restore the old draw state */
  WinPopDrawState();
}
Пример #18
0
/*
** ToggleObject
*/
static void ToggleObject(FormType* frm, UInt16 objID, Boolean toggle_on) {
  if (toggle_on)
    FrmShowObject(frm, FrmGetObjectIndex(frm, objID));
  else
    FrmHideObject(frm, FrmGetObjectIndex(frm, objID));
}
Пример #19
0
Boolean MusicFormHandleEvent(EventPtr eventP) {
	FormPtr frmP = FrmGetActiveForm();
	Boolean handled = false;

	switch (eventP->eType) {
		case frmOpenEvent:
			MusicFormInit(GamGetSelected());
			handled = true;
			break;

		case frmCloseEvent:
			MusicFormSave(dmMaxRecordIndex);
			handled = true;
			break;

		case ctlSelectEvent:
			switch (eventP->data.ctlSelect.controlID)
			{
				case (MusicForm + 1) :
				case (MusicForm + 2) :
				case (MusicForm + 3) :
					lastTab = (eventP->data.ctlSelect.controlID - MusicForm - 1);
					TabSetActive(frmP, myTabP, lastTab);
					break;

				case TabMusicDriverPopTrigger:
					FrmList(eventP, TabMusicDriverList);
					FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicDriverList));

					if (!OPTIONS_TST(kOptDeviceZodiac) && !OPTIONS_TST(kOptSonyPa1LibAPI)) {
						ListType *list1P = (ListType *)GetObjectPtr(TabMusicDriverList);

						if (LstGetSelection(list1P) == 4) {
							FrmCustomAlert(FrmInfoAlert, "There is no built-in MIDI support on your device.", 0, 0);
							LstSetSelection(list1P, 0);
							CtlSetLabel((ControlType *)GetObjectPtr(TabMusicDriverPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P)));
						}
					}
					break;

				case TabMusicQualityPopTrigger:
					FrmList(eventP, TabMusicQualityList);
					FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicQualityList));
					break;

				case TabMusicRatePopTrigger:
					FrmList(eventP, TabMusicRateList);
					FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicRateList));

					if (!OPTIONS_TST(kOptPalmSoundAPI)) {
						ListType *list1P = (ListType *)GetObjectPtr(TabMusicRateList);

						if (LstGetSelection(list1P) != 0) {
							FrmCustomAlert(FrmInfoAlert, "You cannot use this rate on your device.", 0, 0);
							LstSetSelection(list1P, 0);
							CtlSetLabel((ControlType *)GetObjectPtr(TabMusicRatePopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P)));
						}
					}
					break;

				case TabAudioCDFormatPopTrigger:
					FrmList(eventP, TabAudioCDFormatList);
					FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabAudioCDFormatList));

					if (LstGetSelection((ListPtr)GetObjectPtr(TabAudioCDDriverList)) == 1) {
						ListType *list1P = (ListType *)GetObjectPtr(TabAudioCDFormatList);
						LstSetSelection(list1P, 0);
						CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDFormatPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P)));
					}
					break;

				case TabAudioCDDriverPopTrigger:
					FrmList(eventP, TabAudioCDDriverList);
					FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabAudioCDDriverList));

					if (LstGetSelection((ListPtr)GetObjectPtr(TabAudioCDDriverList)) == 1) {
						ListType *list1P = (ListType *)GetObjectPtr(TabAudioCDFormatList);
						LstSetSelection(list1P, 0);
						CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDFormatPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P)));
					}
					break;

				case MusicOKButton:
					MusicFormSave(GamGetSelected());
					break;

				case MusicCancelButton:
					MusicFormSave(dmMaxRecordIndex);
					break;
			}
			handled = true;
			break;

		default:
			break;
	}

	return handled;
}
Пример #20
0
/* Toggle Autoscroll */
void DoAutoscrollToggle
    (
    AutoscrollType toggle
    )
{
    FormType* mainForm;
    UInt16    prevCoordSys;

    if ( toggle == AUTOSCROLL_OFF &&
         ! Prefs()->autoscrollEnabled )
        return;

    mainForm = FrmGetFormPtr( GetMainFormId() );
    prevCoordSys = PalmSetCoordinateSystem( STANDARD );

    if ( toggle == AUTOSCROLL_TOGGLE )
        Prefs()->autoscrollEnabled = ! Prefs()->autoscrollEnabled;
    else if ( toggle == AUTOSCROLL_ON )
        Prefs()->autoscrollEnabled = true;
    else
        Prefs()->autoscrollEnabled = false;

    if ( Prefs()->autoscrollEnabled )
        Prefs()->autoscrollLastScrollTime = TimGetTicks();

    if ( Prefs()->autoscrollEnabled &&
         Prefs()->autoscrollDir == AUTOSCROLL_DOWN &&
         Prefs()->autoscrollMode == AUTOSCROLL_PIXELS ) {
        LineCacheActivate();
    }
    else {
        LineCacheRefreshCurrentScreenData();
        LineCacheDeactivate();
    }

    if ( Prefs()->toolbar != TOOLBAR_NONE && IsMainFormWinActive() ) {
        if ( Prefs()->autoscrollEnabled ) {
            if ( Prefs()->toolbar == TOOLBAR_SILK ) {
                /* FIXME: figure this out */
            }
            else {
                FrmHideObject( mainForm,
                    FrmGetObjectIndex( mainForm, bmpAutoscrollStart ) );
                FrmShowObject( mainForm,
                    FrmGetObjectIndex( mainForm, bmpAutoscrollStop ) );
            }
        }
        else {
            if ( Prefs()->toolbar == TOOLBAR_SILK ) {
                /* FIXME: figure this out */
            }
            else {
                FrmHideObject( mainForm,
                    FrmGetObjectIndex( mainForm, bmpAutoscrollStop ) );
                FrmShowObject( mainForm,
                    FrmGetObjectIndex( mainForm, bmpAutoscrollStart ) );
            }
        }
    }

    PalmSetCoordinateSystem( prevCoordSys );
}
Пример #21
0
static Boolean MyMainFormHandleEvent( EventPtr event )
{
	Boolean handled = false;
	Int i;
	FieldPtr fld;
	FormPtr frm;
	Word readerNum;

#ifdef __GCC__
	CALLBACK_PROLOGUE
#endif

	frm = FrmGetActiveForm();

	switch( event->eType ) {
		case frmOpenEvent:
			UpdateScrollbar( dataFieldID, dataSbarID );
			FrmDrawForm( frm );
			break;
		case ctlSelectEvent:
			if( event->data.ctlSelect.controlID==updateButtonID ) {
				handled=true;

				if( readerType==SC_READER_UNKNOWN ) {
					FrmAlert( alert6FormID );
					break;
				}

				FrmHideObject(frm, FrmGetObjectIndex(frm, updateButtonID));

				i=scdir();

				UpdateScrollbar( dataFieldID, dataSbarID );

				if( i==1 ) FrmAlert(alert1FormID);
				else if( i==2 ) FrmAlert(alert2FormID);
				else if( i==3 ) FrmAlert(alert3FormID);
				else if( i==4 ) FrmAlert(alert4FormID);
				else if( i>4 ) FrmAlert(alert5FormID);

				FrmShowObject(frm, FrmGetObjectIndex(frm, updateButtonID));
			}
			break;
		case menuEvent:
			fld = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, dataFieldID)); 
			switch( event->data.menu.itemID ) {
				case selectMenuID:
					handled = true;
					FldSetSelection (fld, 0, FldGetTextLength (fld));
					break;
				case copyMenuID:
					handled = true;
					FldCopy(fld);
					break;
				case readerMenuID:
					handled = true;

					switch(readerType) {
						case SC_READER_DUMBMOUSE:
							readerNum=0;
							break;
						case SC_READER_TOWITOKO:
							readerNum=1;
							break;
						default:
							readerNum=-1;
							break;
					}

					readerNum = ChooseReader( readerNum );

					switch(readerNum) {
						case 0:
							readerType=SC_READER_DUMBMOUSE;
							break;
						case 1:
							readerType=SC_READER_TOWITOKO;
							break;
						default:
							readerType=SC_READER_UNKNOWN;
							break;
					}

					break;
				case aboutMenuID:
					handled = true;
					FrmAlert(aboutFormID);
					break;
				case helpMenuID:
					handled = true;
					FrmAlert(helpFormID);
					break;
				default:
					break;
			}
		case fldChangedEvent:
			if( event->data.fldChanged.fieldID==dataFieldID ) {
				UpdateScrollbar( dataFieldID, dataSbarID );
				handled=true;
			}
			break;
		case sclRepeatEvent:
			if( event->data.sclRepeat.scrollBarID==dataSbarID ) {
				ScrollLines( dataFieldID, dataSbarID,
					event->data.sclRepeat.newValue -
					event->data.sclRepeat.value, false );
			}
			break;
		case keyDownEvent:
			if( event->data.keyDown.chr == pageUpChr ) {
				PageScroll( dataFieldID, dataSbarID, up );
				handled = true;
			} else if( event->data.keyDown.chr == pageDownChr ) {
				PageScroll( dataFieldID, dataSbarID, down );
				handled = true;
			}
            break;
		default:
			break;
	}

#ifdef __GCC__
	CALLBACK_EPILOGUE
#endif

	return handled;
}