WORD ProcessMessageMain( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg )
{
    WORD    controlID;

//    BtnMsgDefault( translatedMsg, (BUTTON*)pObj, pMsg );
    if (translatedMsg == BTN_MSG_PRESSED)
    {
        controlID = GetObjID(pObj);

        switch (controlID)
        {
            case ID_MAIN_FLASH:
                screenState = SCREEN_DISPLAY_FLASH;
                break;

            case ID_MAIN_GAMES:
                screenState = SCREEN_DISPLAY_GAMES;
                break;

            case ID_MAIN_DEMOS:
                screenState = SCREEN_DISPLAY_DEMOS;
                break;

            case ID_MAIN_UTILITIES:
                screenState = SCREEN_DISPLAY_UTILITIES;
                break;
        }
    }
    return 0;   // We already called the default handler.
}
/*******************************************************************************
 * FUNCTION: usMsgNumericKeypadPage
 *
 * PARAMETERS:
 * ~ objMsg     - Translated message for the object.
 * ~ pObj       - Pointer to the object.
 * ~ pMsg       - Pointer to the non-translated, raw GOL message.
 *
 * RETURN:
 * ~ If the function returns non-zero, the message will be processed by default.
 *
 * DESCRIPTIONS:
 * Handle the touchscreen event of the Set ID page.
 *
 *******************************************************************************/
WORD usMsgNumericKeypadPage(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    unsigned short usObjectId = GetObjID(pObj);
    EDITBOX *pxEditbox1 = (EDITBOX*)GOLFindObject(GID_KEYPAD_EB_VALUE1);
    EDITBOX *pxEditbox2 = (EDITBOX*)GOLFindObject(GID_KEYPAD_EB_VALUE2);
    
    // Make sure button is released.
    if (objMsg == BTN_MSG_RELEASED) {
        // Clear message on editbox 1.
        vEditBoxUpdateText(pxEditbox1, "");

        // If key 0 - 9 is pressed...
        if ((usObjectId >= GID_KEYPAD_0) && (usObjectId <= GID_KEYPAD_9)) {
            // Add the pressed key to editbox 2.
            if (pxEditbox2 != NULL) {
                EbAddChar(pxEditbox2, '0' + (usObjectId - GID_KEYPAD_0));
                SetState(pxEditbox2, EB_DRAW);
            }
        }

        // DEL button.
        else if (usObjectId == GID_KEYPAD_DEL) {
            // Remove 1 character from editbox 2.
            if (pxEditbox2 != NULL) {
                EbDeleteChar(pxEditbox2);
                SetState(pxEditbox2, EB_DRAW);
            }
        }

    }
    
    
    return 1;
}
Exemple #3
0
WORD msgSetprog(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg)
{
//	OBJ_HEADER* pSetPoint;
//	SHORT dialVal;
	if(pObj == NULL)
	{

		switch(pMsg->param1)
		{
			case INP_TIMER1_ID:			
				//Timer expired
//				xTimerStart( xTimers[ 1 ], 0 );
//				UpdateConfirm();
				break;
			default:
				break;
		}
		return 1;	
	}
	
	switch (GetObjID(pObj)) {
		
		case Setprog_OBJ_BUTTON_0:
		case Setprog_OBJ_BUTTON_1:
		case Setprog_OBJ_BUTTON_2:
		case Setprog_OBJ_BUTTON_3:
		case Setprog_OBJ_BUTTON_4:
		case Setprog_OBJ_BUTTON_5:
			if (objMsg == BTN_MSG_RELEASED) {
				prog_num = GetObjID(pObj);
				GDDPrevScreen();
			}	
			return 1;
		case Setprog_OBJ_BUTTON_7:
			if (objMsg == BTN_MSG_RELEASED) {
				GDDPrevScreen();
			}	
			return 1;
		
		default:
			break;
	}	

	return 1;	
} 
Exemple #4
0
/************************************************************************
 Function: WORD MultiFontDemoMsgCallback(WORD objMsg, OBJ_HEADER* pObj, 
 										GOL_MSG* pMsg)

 Overview: This function is called by GOLMsg() function when in this 
 		   particular demo each time the valid message is received for the 
  		   objects in the demo.
           
 Input: objMsg - translated message for the object,
        pObj - pointer to the object,
        pMsg - pointer to the non-translated, raw GOL message 

 Output: If the function returns non-zero the message will 
 		 be processed by the object directly affected by the message.
 		 Default action on the object based on the message will be 
 		 performed.
************************************************************************/
WORD MultiFontDemoMsgCallback(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    WORD        objectID;
    STATICTEXT  *pSt;

    objectID = GetObjID(pObj);
    switch(objectID)
    {
        case ID_BUTTON_A:
            if(objMsg == BTN_MSG_RELEASED)
            {   // check if button is pressed
                // do not process if user moved the touch away from the button
                // returning 1 wil update the button
                if(pMsg->uiEvent == EVENT_MOVE)
                    return (1);
                free(FontScheme2);
                screenState = CREATE_DEMOSELECTION;
                return (1);
            }

        case ID_BUTTON_B:
            if(objMsg == BTN_MSG_RELEASED)
            {   // check if button is pressed
                // do not process if user moved the touch away from the button
                // returning 1 wil update the button
                if(pMsg->uiEvent == EVENT_MOVE)
                    return (1);

                pHWData = pHWData->pHWPrev;
                pSt = (STATICTEXT *)GOLFindObject(ID_STXT); // get pointer to static text
                SetState(pSt, ST_DRAW);                     // set redraw state
            }

            break;

        case ID_BUTTON_D:
            if(objMsg == BTN_MSG_RELEASED)
            {

                // do not process if user moved the touch away from the button
                // returning 1 wil update the button
                if(pMsg->uiEvent == EVENT_MOVE)
                    return (1);

                pHWData = pHWData->pHWNext;
                pSt = (STATICTEXT *)GOLFindObject(ID_STXT); // get pointer to static text
                SetState(pSt, ST_DRAW);                     // set redraw state
            }

            break;

        default:
            break;
    }

    return (1);
}
Exemple #5
0
WORD DemoMsgCallback(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
	if (GetObjID(pObj) == ID_BUTTON) {
		if (objMsg == BTN_MSG_PRESSED) {
			showDecoration = TRUE;
		} else if (objMsg == BTN_MSG_RELEASED || objMsg == BTN_MSG_CANCELPRESS) {
			showDecoration = FALSE;
		}
	}

	return 1;
}
Exemple #6
0
//           time the valid message for the object received
/////////////////////////////////////////////////////////////////////////////
WORD GOLMsgCallback(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    WORD    objectID;

    objectID = GetObjID(pObj);

    GDDDemoGOLMsgCallback(objMsg, pObj, pMsg);
    
    // Add additional code here...

    return (1);
}
Exemple #7
0
/*****************************************************************************
 * WORD MsgSecurityScreen(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
 *****************************************************************************/
WORD MsgSecurityScreen(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    EDITBOX     *pEb;
    SHORT       id;
    XCHAR       temp;
    static char status = 0; // status to check if calling, holding or not
    id = GetObjID(pObj);

    MsgPanelScreen(objMsg, pObj);  //get messages from the panel also

    // If number key is pressed
    if(objMsg == BTN_MSG_PRESSED)
    {
        if(id >= SERCURITY_SCREEN_ID_KEYPAD_0_BUT)
        {
            if(id <= SERCURITY_SCREEN_ID_KEYPAD_9_BUT)
            {
                if(!status)
                {
                    pEb = (EDITBOX *)GOLFindObject(SERCURITY_SCREEN_ID_CODE_EDIT_BOX);
                    EbAddChar(pEb, '*');
                    SetState(pEb, EB_DRAW);
                }

                return (1);
            }
        }
    }

    switch(id)
    {

    case SERCURITY_SCREEN_ID_CLEAR_BUT:
    case SERCURITY_SCREEN_ID_ENTER_BUT:
        if(!status)
        {
            if(objMsg == BTN_MSG_PRESSED)
            {
                pEb = (EDITBOX *)GOLFindObject(SERCURITY_SCREEN_ID_CODE_EDIT_BOX);
                temp = 0x0000;
                EbSetText(pEb, &temp);
                SetState(pEb, EB_DRAW);
                status = 0;
            }
        }

        return (1);

    default:
        return (0);                         // process by default
    }
}
Exemple #8
0
/////////////////////////////////////////////////////////////////////////////
// Function: WORD MsgAN1227Callback(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg)
// Input: objMsg - translated message for the object,
//        pObj - pointer to the object,
//        pMsg - pointer to the non-translated, raw GOL message
// Output: if the function returns non-zero the message will be processed 
//         by default
// Overview: This is called by GOLMsgCallback() to determine if 
//           a valid message for objects in this demo needs to be processed.
/////////////////////////////////////////////////////////////////////////////
WORD MsgAN1227Callback(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    // Application should process messages here
    if(GetObjID(pObj) == BUTTON1_ID)                // if the button with BUTTON_ID is receiving the message
    {
        if(objMsg == BTN_MSG_PRESSED)
        {
            BtnSetText((BUTTON *)pObj, (XCHAR*)PressStr);  // set text for pressed state
        }

        if(objMsg == BTN_MSG_RELEASED)
        {
            BtnSetText((BUTTON *)pObj, (XCHAR*)ReleaseStr); // set text for released state
        }
    }

    return (1); // process the message by default
}               // end of GOLMessageCallback
Exemple #9
0
WORD ProcessMessageUtilities( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg )
{
    WORD    buttonID;

    buttonID = GetObjID(pObj);

    switch (buttonID)
    {
        case ID_UTILITIES_RTCC:
            if (translatedMsg == BTN_MSG_RELEASED)
            {
                screenState = SCREEN_DISPLAY_TIME;
            }
            break;

        case ID_UTILITIES_CTMU:
            if (translatedMsg == BTN_MSG_RELEASED)
            {
                screenState = SCREEN_DISPLAY_CTMU;
            }
            break;

        case ID_UTILITIES_BOARD_TEST:
            if (translatedMsg == BTN_MSG_RELEASED)
            {
                screenState = SCREEN_BOARD_TEST;;
            }
            break;

        case ID_UTILITIES_HOME:
            if (translatedMsg == BTN_MSG_RELEASED)
            {
                screenState = SCREEN_DISPLAY_MAIN;
            }
            break;

    }

    // Keep the current unimplemented button "pressed"
    SetState( (BUTTON*)pObj, BTN_PRESSED | BTN_DRAW );

    return 0;   // We do not need to call the default handler.
}
Exemple #10
0
/****************************************************************************
  Function:
    WORD ProcessMessageMain( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg )
  Description:
    This function processes the messages for the main introduction screen.
    It allows the user to select Accelerometer Graph, External Sensor Graph, 
    Orientation Display or Games.
  Precondition:
    Call ShowScreenMain() prior to using this function to display the correct
    screen.
  Parameters:
    WORD translatedMsg  - The translated control-level message
    OBJ_HEADER* pObj    - Object to which the message applies
    GOL_MSG* pMsg       - The original system message information
  Return Values:
    0   - Do not call the default message handler.
    1   - Call the default message handler.
  Remarks:
    The global screenState is updated to proceed to the user's selection.
  ***************************************************************************/
WORD ProcessMessageMain( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg )
{
    WORD    controlID;

    if (translatedMsg == BTN_MSG_PRESSED)
    {
        if(enableSoundFlag)
        {
			if(!speakerBusy())
				speakerActivate(SPEECH_ADDR_SELECT, SPEECH_SIZE_SELECT);  
		} 
								
        controlID = GetObjID(pObj);

        switch (controlID)
        {
            case ID_MAIN_GRAPH:
	            screenState = SCREEN_DISPLAY_GRAPH;
	            break;
                
            case ID_MAIN_GAMES:
                screenState = SCREEN_DISPLAY_GAMES;
                break;

            case ID_MAIN_ORIENTATION:
	            screenState = SCREEN_DISPLAY_ORIENTATION;
                break;

            case ID_MAIN_EXTSENSOR:
	            screenState = SCREEN_DISPLAY_ES_INFO;
                break;
        }
    }
    return 0;  
    
}
Exemple #11
0
void AN1227ProcessKeyBoard(void)
{
            
    // Keyboard driver
    if(GOLGetFocus() != NULL)   // if there’s a widget in focus send a message
    {

        // check if the button has changed its state
        if(GetHWButtonCR() != previousKey1State)
        {
            if(previousKey1State)
            {

                // if GetHWButtonCR equals zero it means the button is pressed
                AN1227msg.type = TYPE_KEYBOARD;
                AN1227msg.uiEvent = EVENT_KEYSCAN;

                // the focused button will receive the message
                AN1227msg.param1 = GetObjID(GOLGetFocus());
                AN1227msg.param2 = SCAN_CR_PRESSED;

            }
            else
            {

                // if GetHWButtonCR equals one it means the button is released
                AN1227msg.type = TYPE_KEYBOARD;
                AN1227msg.uiEvent = EVENT_KEYSCAN;

                // the focused button will receive the message
                AN1227msg.param1 = GetObjID(GOLGetFocus());
                AN1227msg.param2 = SCAN_CR_RELEASED;
            }                   // end of else

            // state of the button was changed
            previousKey1State = !previousKey1State;

            // pass the message to the graphics library
            GOLMsg(&AN1227msg);
        }                       // end of if
    }                           // end of if

    // check if the button has changed its state
    if(GetHWButtonFocus() != previousKey2State)
    {
        if(previousKey2State)
        {

            // if GetHWButtonFocus() equals zero it means the button is pressed
            // get the object can be focused next
            pFocusedObj = GOLGetFocusNext();

            // move focus
            GOLSetFocus(pFocusedObj);
        }
        else
        {

            // if GetHWButtonFocus()equals one it means the button is released
        }   // end of else

        // state of the button was changed
        previousKey2State = !previousKey2State;

        // pass the message to the graphics library
        GOLMsg(&AN1227msg);
    } // end of if
}         
Exemple #12
0
/************************************************************************
 Function: WORD MsgAnimation(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg)

 Overview: This function is called by GOLMsg() function when in this
 		   particular demo each time the valid message is received for the
  		   objects in the demo.

 Input: objMsg - translated message for the object,
        pObj - pointer to the object,
        pMsg - pointer to the original GOL message.

 Output: If the function returns non-zero the message will
 		 be processed by the object directly affected by the message.
 		 Default action on the object based on the message will be
 		 performed.
************************************************************************/
WORD MsgAnimation(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    static BYTE scale = 2;
    WORD        value;

    if(objMsg == BTN_MSG_RELEASED)
    {
        switch(GetObjID(pObj))
        {
        case ID_BUTTON_A:
            if(objMsg == BTN_MSG_RELEASED)
            {

                // do not process if user moved the touch away from the button
                // returning 1 wil update the button
                if(pMsg->uiEvent == EVENT_MOVE)
                    return (1);

                // implements some form of debounce
                // add code here.
                screenState = CREATE_DEMOSELECTION;
                return (0);
            }

        case ID_BUTTON_B:
            if(objMsg == BTN_MSG_RELEASED)
            {

                // do not process if user moved the touch away from the button
                // returning 1 wil update the button
                if(pMsg->uiEvent == EVENT_MOVE)
                    return (1);
            }

            if(scale == 1)
            {
                PictSetScale(pPicture, 2);      // x2
                scale = 2;
                ClrState(pPicture, PICT_FRAME); // set redraw state
            }
            else
            {
                PictSetScale(pPicture, 1);      // x1
                scale = 1;
                SetState(pPicture, PICT_FRAME); // set redraw state
            }

            SetState(pPicture, PICT_DRAW);      // set redraw state
            return (1);                         // process by default

        case ID_BUTTON_C:
            if(GetState((BUTTON *)GOLFindObject(ID_BUTTON_C), BTN_PRESSED))
            {
                value = MtrGetVal(pMeter);      // get current value
                MtrDecVal(pMeter, 1);
                SetState(pMeter, MTR_DRAW_UPDATE);
            }

            return (1);

        case ID_BUTTON_D:
            if(GetState((BUTTON *)GOLFindObject(ID_BUTTON_D), BTN_PRESSED))
            {
                value = MtrGetVal(pMeter);      // get current value
                MtrIncVal(pMeter, 1);
                SetState(pMeter, MTR_DRAW_UPDATE);
            }

            return (1);                         // process by default

        default:
            return (1);                         // process by default
        }
    }

    return (1); // process by default
}
Exemple #13
0
/************************************************************************
 Function: WORD JPEGMsgCallback(WORD objMsg, OBJ_HEADER* pObj, 
 								GOL_MSG* pMsg)

 Overview: This function is called by GOLMsg() function when in this 
 		   particular demo each time the valid message is received for the 
  		   objects in the demo.
           
 Input: objMsg - translated message for the object,
        pObj - pointer to the object,
        pMsg - pointer to the non-translated, raw GOL message 

 Output: If the function returns non-zero the message will 
 		 be processed by the object directly affected by the message.
 		 Default action on the object based on the message will be 
 		 performed.
************************************************************************/
WORD JPEGMsgCallback(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    LISTITEM    *pItemSel;

    // check if an image is being shown
    if((blImageOnScreen == 1) || (blSlideShowOn == 1))
    {

        // this is the routine to go back and show the list when an
        // image is being shown on the screen or the slide show is
        // currently ongoing
        if(pMsg->uiEvent == EVENT_RELEASE)
        {
            blImageOnScreen = 0;
            blSlideShowOn = 0;
            GOLRedrawRec(0, 0, GetMaxX(), GetMaxY());
        }

        return (0);
    }

    switch(GetObjID(pObj))
    {
        case ID_BUTTON_A:
            if(objMsg == BTN_MSG_RELEASED)
            {   // check if button is pressed
                // do not process if user moved the touch away from the button
                // returning 1 wil update the button
                if(pMsg->uiEvent == EVENT_MOVE)
                    return (1);
                screenState = CREATE_DEMOSELECTION;
            }

            return (1);

        case ID_BUTTON_D:
            if(objMsg == BTN_MSG_RELEASED)
            {   // check if button is pressed
                // do not process if user moved the touch away from the button
                // returning 1 wil update the button
                if(pMsg->uiEvent == EVENT_MOVE)
                    return (1);

                // enable the slide show
                blSlideShowOn = 1;
				// initialize the screen	
				SetColor(BLACK);
    			ClearDevice();

                ClrState(pObj, BTN_PRESSED);            // clear the pressed state, will be shown only when redrawn
                blSlideShowDelay = 0;                   // force slide show to immediately start
                return (0);
            }

            return (1);

        case ID_JPGLISTBOX:
            if(pMsg->uiEvent == EVENT_MOVE)
            {
                pMsg->uiEvent = EVENT_PRESS;            // change event for listbox

                // Process message by default
                LbMsgDefault(objMsg, (LISTBOX *)pObj, pMsg);

                // Set new list box position
                SldSetPos(pSlider, LbGetCount(pListBox) - LbGetFocusedItem(pListBox) - 1);
                SetState(pSlider, SLD_DRAW_THUMB);
                pMsg->uiEvent = EVENT_MOVE;             // restore event for listbox
            }
            else if(pMsg->uiEvent == EVENT_PRESS)
            {

                // call the message default processing of the list box to select the item
                LbMsgDefault(objMsg, (LISTBOX *)pObj, pMsg);
            }
            else if(pMsg->uiEvent == EVENT_RELEASE)
            {

                // check which item was selected and display appropriate screen
                pItemSel = LbGetSel(pListBox, NULL);    // get the selected item
                if(aFolderElement[pItemSel->data].blFolder == 1)
                {
                    if(FSchdir(aFolderElement[pItemSel->data].Name) == 0)
                    {
                        FillNewElements();
                        return (1);
                    }
                }
                else if(aFolderElement[pItemSel->data].blText == 0)
                {
                    IMG_FILE    *pImgFile = IMG_FOPEN(aFolderElement[pItemSel->data].Name, "rb");
                    if(pImgFile != NULL)
                    {
                        blImageOnScreen = 1;
                        // initialize the screen	
					    SetColor(BLACK);
    					ClearDevice();

                        if
                        (
                            ImageDecode
                                (
                                    pImgFile,
                                    aFolderElement[pItemSel->data].ImgType,
                                    0,
                                    0,
                                    IMG_SCREEN_WIDTH,
                                    IMG_SCREEN_HEIGHT,
                                    (IMG_DOWN_SCALE | IMG_ALIGN_CENTER),
                                    NULL,
                                    NULL
                                )
                        )
                        {
                            DisplayErrorInfo();
                        }

                        IMG_FCLOSE(pImgFile);
                    }
                }
            }

            // The message was processed. To avoid other objects processing the 
            // processed message reset the message.
            pMsg->uiEvent = EVENT_INVALID;
            return (0);

        case ID_SLD4LB:
        	
        	if((objMsg == SLD_MSG_INC) || (objMsg == SLD_MSG_DEC)) 
            {   // check slider was touched.

	            // Process message by default
	            SldMsgDefault(objMsg, (SLIDER *)pObj, pMsg);
	
	            // Set new list box position
	            if(LbGetFocusedItem(pListBox) != LbGetCount(pListBox) - SldGetPos(pSlider))
	            {
	                LbSetFocusedItem(pListBox, LbGetCount(pListBox) - SldGetPos(pSlider));
	                SetState(pListBox, LB_DRAW_ITEMS);
	            }
	            
	        }

            // The message was processed
            return (0);

        case ID_BTNUP4LB:                               // slider up button was pressed
            if(objMsg == BTN_MSG_RELEASED)
            {
				// check if we have reached the very first then stay there.
	            if (LbGetFocusedItem(pListBox) == 0)
	                LbSetFocusedItem(pListBox,0);
	            else    
                	LbSetFocusedItem(pListBox,LbGetFocusedItem(pListBox)-1);                
                SetState(pListBox, LB_DRAW_ITEMS);
                SldSetPos(pSlider, SldGetPos(pSlider) + 1);
                SetState(pSlider, SLD_DRAW_THUMB);
            }

            return (1);

        case ID_BTNDN4LB:                               // slider down button was pressed
            if(objMsg == BTN_MSG_RELEASED)
            {
	            // set all items to be not displayed
                pItemSel = pListBox->pItemList;
                while(pItemSel != NULL) {
                	pItemSel->status = 0;
                	pItemSel = pItemSel->pNextItem;
                }	
                LbSetFocusedItem(pListBox, LbGetFocusedItem(pListBox) + 1);
                SetState(pListBox, LB_DRAW_ITEMS);
                SldSetPos(pSlider, SldGetPos(pSlider) - 1);
                SetState(pSlider, SLD_DRAW_THUMB);
            }

            return (1);
    }

    return (1);
}
Exemple #14
0
WORD ProcessMessageTime( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg )
{
    signed char change;
    WORD        controlID;
    signed char day;
    signed char dayMax;
    signed char hour;
    signed char minute;
    signed char month;
    signed char year;


    controlID = GetObjID(pObj);
    switch (controlID)
    {
       case ID_RTCC_BUTTON_NEXT:
            // Show the old control set as unselected.
            IndicateFocus( BLACK );

            // Set the next control as active.
            currentControlSet ++;
            if (currentControlSet > CONTROL_SET_MAX)
            {
                currentControlSet = 0;
            }

            // Show the new control set as selected.
            IndicateFocus( WHITE );

            return 0;   // Hidden button
            break;

       case ID_RTCC_BUTTON_PREVIOUS:
            // Show the old control set as unselected.
            IndicateFocus( BLACK );

            // Set the next control as active.
            currentControlSet --;
            if (currentControlSet < 0 )
            {
                currentControlSet = CONTROL_SET_MAX;
            }

            // Show the new control set as selected.
            IndicateFocus( WHITE );

            return 0;   // Hidden button
            break;

        case ID_RTCC_BUTTON_HOME:
            screenState = SCREEN_DISPLAY_MAIN;
            return 0;   // Hidden button
            break;

        case ID_DAY_PLUS:
        case ID_MONTH_PLUS:
        case ID_YEAR_PLUS:
        case ID_HOUR_PLUS:
        case ID_MINUTE_PLUS:
            if (translatedMsg == BTN_MSG_PRESSED)
            {
                change = +1;
            }
            else
            {
                return 1;
            }
            break;

        case ID_DAY_MINUS:
        case ID_MONTH_MINUS:
        case ID_YEAR_MINUS:
        case ID_HOUR_MINUS:
        case ID_MINUTE_MINUS:
            if (translatedMsg == BTN_MSG_PRESSED)
            {
                change = -1;
            }
            else
            {
                return 1;
            }
            break;

        default:
            return 0;
    }

    // Update the selected field.

    RTCCProcessEvents();
    hour    = RTCCGetBinHour();
    minute  = RTCCGetBinMin();
    day     = RTCCGetBinDay();
    month   = RTCCGetBinMonth();
    year    = RTCCGetBinYear();

    dayMax  = daysPerMonth[month-1];

    // February has one day more for a leap year, unless it is on the thousands
    if ((month == 2) && ((year % 4) == 0) && (year != 0))
    {
        dayMax ++;
    }

    // Change the appropriate setting.  Allow the controls to roll over.
    switch (currentControlSet)
    {
        case CONTROL_SET_DAY:
            day += change;
            if (day < 1)
            {
                day = dayMax;
            }
            if (day > dayMax)
            {
                day = 1;
            }
            break;

        case CONTROL_SET_MONTH:
            month += change;
            if (month < 1)
            {
                month = 12;
            }
            if (month > 12)
            {
                month = 1;
            }
            break;

        case CONTROL_SET_YEAR:
            year += change;
            if (year < 0)
            {
                year = 99;
            }
            if (year > 99)
            {
                year = 0;
            }
            break;

        case CONTROL_SET_HOUR:
            hour += change;
            if (hour < 0)
            {
                hour = 23;
            }
            if (hour > 23)
            {
                hour = 0;
            }
            break;

        case CONTROL_SET_MINUTE:
            minute += change;
            if (minute < 0)
            {
                minute = 59;
            }
            if (minute > 59)
            {
                minute = 0;
            }
            break;

        default:
            return 0;
    }

    RTCCOff();
    RTCCSetBinHour( hour );
    RTCCSetBinMin( minute );
    RTCCSetBinSec( 0 );
    RTCCSetBinMonth( month );
    RTCCSetBinYear( year );
    RTCCSetBinDay( day );
    RTCCCalculateWeekDay();
    RTCCSet();                      // Copy the new values to the RTCC registers
    UpdateDateTime();               // Update the display.

    return 1;   // Call the default handler to show the button state.
}
/************************************************************************
 Function: WORD MsgHomeSelectionCallback(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg)

 Overview: Message callback for the demo selection. Based on user selection
 		   A demo is enabled by switching the screen state. Icons used
 		   changes from colored version to monochrome version when pressed.

 Input: objMsg - translated message for the object,
        pObj - pointer to the object,
        pMsg - pointer to the non-translated, raw GOL message

 Output: none
************************************************************************/
WORD MsgHomeSelectionCallback(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    switch(GetObjID(pObj))
    {
    case ID_TVICON:
        if(objMsg == BTN_MSG_PRESSED)
        {   // change face picture
            BtnSetBitmap(pObj, (void *) &TVICONPRESS);
        }
        else if(objMsg == BTN_MSG_CANCELPRESS)
        {
            BtnSetBitmap(pObj, (void *) &TVICON);
        }
        else if(objMsg == BTN_MSG_RELEASED)
        {
            BtnSetBitmap(pObj, (void *) &TVICON);
            screenState = CREATE_WATCHTV;
        }
        break;

    case ID_FAVICON:
        if(objMsg == BTN_MSG_PRESSED)
        {   // change face picture
            BtnSetBitmap(pObj, (void *) &FAVICONPRESS);
        }
        else if(objMsg == BTN_MSG_CANCELPRESS)
        {
            BtnSetBitmap(pObj, (void *) &FAVICON);
        }
        else if(objMsg == BTN_MSG_RELEASED)
        {
            BtnSetBitmap(pObj, (void *) &FAVICON);
            screenState = CREATE_FAVORITES;
        }
        break;

    case ID_INTICON:
        if(objMsg == BTN_MSG_PRESSED)
        {   // change face picture
            BtnSetBitmap(pObj, (void *) &INTERICONPRESS);
        }
        else if(objMsg == BTN_MSG_CANCELPRESS)
        {
            BtnSetBitmap(pObj, (void *) &INTERICON);
        }
        else if(objMsg == BTN_MSG_RELEASED)
        {
            BtnSetBitmap(pObj, (void *) &INTERICON);
            screenState = CREATE_INTERNET;
        }
        break;

    case ID_PDICON:
        if(objMsg == BTN_MSG_PRESSED)
        {   // change face picture
            BtnSetBitmap(pObj, (void *) &PDICONPRESS);
        }
        else if(objMsg == BTN_MSG_CANCELPRESS)
        {
            BtnSetBitmap(pObj, (void *) &PDICON);
        }
        else if(objMsg == BTN_MSG_RELEASED)
        {
            BtnSetBitmap(pObj, (void *) &PDICON);
            screenState = CREATE_PLAYDISC;
        }
        break;

    case ID_SETICON:
        if(objMsg == BTN_MSG_PRESSED)
        {   // change face picture
            BtnSetBitmap(pObj, (void *) &SETICONPRESS);
        }
        else if(objMsg == BTN_MSG_CANCELPRESS)
        {
            BtnSetBitmap(pObj, (void *) &SETICON);
        }
        else if(objMsg == BTN_MSG_RELEASED)
        {
            BtnSetBitmap(pObj, (void *) &SETICON);
            screenState = CREATE_RF_SETTINGS;
        }
        break;

    case ID_REMOTEMODE:
        if(objMsg == BTN_MSG_PRESSED)
        {
            BtnSetText((BUTTON*)pObj, UnivRemoteVersionStr);
        }
        else if((objMsg == BTN_MSG_CANCELPRESS) || (objMsg == BTN_MSG_RELEASED))
        {
            BtnSetText((BUTTON*)pObj, UnivRemoteStr);
        }
        SetState(pObj, BTN_PRESSED);
        break;

    default:
        break;
    }

    return (1);
}