diff --git a/DemoProc/inc/DemoProc.h b/DemoProc/inc/DemoProc.h index 57441b7..7731798 100644 --- a/DemoProc/inc/DemoProc.h +++ b/DemoProc/inc/DemoProc.h @@ -3,7 +3,8 @@ //=======================================================================// //= Include files. =// //=======================================================================// -#include "SGUI_Typedef.h" +#include "SGUI_Typedef.h" +#include "SGUI_Common.h" #include "HMI_Engine.h" #if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) #include "DemoResource_UTF8.h" diff --git a/DemoProc/src/DemoProc.c b/DemoProc/src/DemoProc.c index fbd4a8f..c99f6f1 100644 --- a/DemoProc/src/DemoProc.c +++ b/DemoProc/src/DemoProc.c @@ -1,149 +1,176 @@ -/*************************************************************************/ -/** Copyright. **/ -/** FileName: DemoProc.c **/ -/** Author: Polarix **/ -/** Version: 1.0.0.0 **/ -/** Description: User operation interface. **/ -/*************************************************************************/ -//=======================================================================// -//= Include files. =// -//=======================================================================// -#include "DemoProc.h" - -//=======================================================================// -//= User Macro definition. =// -//=======================================================================// - -//=======================================================================// -//= Static function declare =// -//=======================================================================// -static HMI_ENGINE_RESULT InitializeEngine_Internal(HMI_ENGINE_OBJECT* pstHMIEngineObject); - -//=======================================================================// -//= Static variable declaration. =// -//=======================================================================// -HMI_ENGINE_OBJECT g_stDemoEngine; -//=======================================================================// -//= Function define. =// -//=======================================================================// - -/*****************************************************************************/ -/** Function Name: SimpleGUI_DemoProcess **/ -/** Purpose: Simple GUI HMI engine and interface demo process. **/ -/** Parameters: None. **/ -/** Return: None. **/ -/** Notice: This function demonstrates how to use the interface and **/ -/** HMI engine of Simple GUI. **/ -/*****************************************************************************/ -void InitializeEngine(void) -{ - InitializeEngine_Internal(&g_stDemoEngine); -} - -/*****************************************************************************/ -/** Function Name: InitializeEngine **/ -/** Purpose: Initialize HMI demo engine. **/ -/** Parameters: **/ -/** @ pstHMIEngineObject[in]: HMI engine object pointer. **/ -/** Return: HMI_ENGINE_RESULT. **/ -/** Notice: This function must be called when initialize. **/ -/*****************************************************************************/ -HMI_ENGINE_RESULT InitializeEngine_Internal(HMI_ENGINE_OBJECT* pstHMIEngineObject) -{ - /*----------------------------------*/ - /* Variable Declaration */ - /*----------------------------------*/ - HMI_ENGINE_RESULT eProcessResult; - - /*----------------------------------*/ - /* Initialize */ - /*----------------------------------*/ - eProcessResult = HMI_RET_NORMAL; - - /*----------------------------------*/ - /* Process */ - /*----------------------------------*/ - if(NULL != pstHMIEngineObject) - { - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - eProcessResult = HMI_PrepareEngine(pstHMIEngineObject); - } - - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_ScrollingText, SGUI_TRUE); - } - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_List, SGUI_TRUE); - } - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_TextNotice, SGUI_TRUE); - } - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_RTCNotice, SGUI_TRUE); - } - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_VariableBox, SGUI_TRUE); - } - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMI_DemoRealtimeGraph, SGUI_TRUE); - } - - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - eProcessResult = HMI_ActiveEngine(pstHMIEngineObject, HMI_SCREEN_ID_DEMO_SCROLLING_TEXT); - } - - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - eProcessResult = HMI_StartEngine(NULL); - } - } - else - { - // No activated HMI engine object. - eProcessResult = HMI_RET_INVALID_DATA; - } - - return eProcessResult; -} - -/*****************************************************************************/ -/** Function Name: EventProcess **/ -/** Purpose: Process posted event. **/ -/** Parameters: **/ +/*************************************************************************/ +/** Copyright. **/ +/** FileName: DemoProc.c **/ +/** Author: Polarix **/ +/** Version: 1.0.0.0 **/ +/** Description: User operation interface. **/ +/*************************************************************************/ +//=======================================================================// +//= Include files. =// +//=======================================================================// +#include "DemoProc.h" + +#if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) +#include "VirtualDeviceInterface.h" +#else +#include "OLED.h" +#include "DemoActions.h" +#endif + +//=======================================================================// +//= User Macro definition. =// +//=======================================================================// + +//=======================================================================// +//= Static function declare =// +//=======================================================================// +static HMI_ENGINE_RESULT InitializeEngine_Internal(HMI_ENGINE_OBJECT* pstHMIEngineObject); + +//=======================================================================// +//= Static variable declaration. =// +//=======================================================================// +HMI_ENGINE_OBJECT g_stDemoEngine; +SGUI_IF_OBJ g_stDeviceInterface; + +//=======================================================================// +//= Function define. =// +//=======================================================================// + +/*****************************************************************************/ +/** Function Name: SimpleGUI_DemoProcess **/ +/** Purpose: Simple GUI HMI engine and interface demo process. **/ +/** Parameters: None. **/ +/** Return: None. **/ +/** Notice: This function demonstrates how to use the interface and **/ +/** HMI engine of Simple GUI. **/ +/*****************************************************************************/ +void InitializeEngine(void) +{ + /* Clear structure. */ + SGUI_Common_MemorySet(&g_stDeviceInterface, 0x00, sizeof(SGUI_IF_OBJ)); + SGUI_Common_MemorySet(&g_stDemoEngine, 0x00, sizeof(HMI_ENGINE_OBJECT)); +#if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) + /* Initialize interface object. */ + g_stDeviceInterface.stActions.fnSetPixel = VDIF_SetPixel; + g_stDeviceInterface.stActions.fnGetPixel = VDIF_GetPixel; + g_stDeviceInterface.stActions.fnClearScreen = VDIF_ClearDisplay; + g_stDeviceInterface.stActions.fnRefreshScreen = VDIF_RefreshDisplay; +#else + g_stDeviceInterface.stActions.fnSetPixel = OLED_SetPixel; + g_stDeviceInterface.stActions.fnGetPixel = OLED_GetPixel; + g_stDeviceInterface.stActions.fnClearScreen = OLED_ClearDisplay; + g_stDeviceInterface.stActions.fnRefreshScreen = OLED_RefreshScreen; +#endif + g_stDemoEngine.Interface = &g_stDeviceInterface; + + /* Configure HMI engine. */ + InitializeEngine_Internal(&g_stDemoEngine); +} + +/*****************************************************************************/ +/** Function Name: InitializeEngine **/ +/** Purpose: Initialize HMI demo engine. **/ +/** Parameters: **/ +/** @ pstHMIEngineObject[in]: HMI engine object pointer. **/ +/** Return: HMI_ENGINE_RESULT. **/ +/** Notice: This function must be called when initialize. **/ +/*****************************************************************************/ +HMI_ENGINE_RESULT InitializeEngine_Internal(HMI_ENGINE_OBJECT* pstHMIEngineObject) +{ + /*----------------------------------*/ + /* Variable Declaration */ + /*----------------------------------*/ + HMI_ENGINE_RESULT eProcessResult; + + /*----------------------------------*/ + /* Initialize */ + /*----------------------------------*/ + eProcessResult = HMI_RET_NORMAL; + + /*----------------------------------*/ + /* Process */ + /*----------------------------------*/ + if(NULL != pstHMIEngineObject) + { + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + eProcessResult = HMI_PrepareEngine(pstHMIEngineObject); + } + + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_ScrollingText, SGUI_TRUE); + } + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_List, SGUI_TRUE); + } + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_TextNotice, SGUI_TRUE); + } + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_RTCNotice, SGUI_TRUE); + } + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMIDemo_VariableBox, SGUI_TRUE); + } + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + eProcessResult = HMI_AddScreen(pstHMIEngineObject, &g_stHMI_DemoRealtimeGraph, SGUI_TRUE); + } + + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + eProcessResult = HMI_ActiveEngine(pstHMIEngineObject, HMI_SCREEN_ID_DEMO_SCROLLING_TEXT); + } + + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + eProcessResult = HMI_StartEngine(NULL); + } + } + else + { + // No activated HMI engine object. + eProcessResult = HMI_RET_INVALID_DATA; + } + + return eProcessResult; +} + +/*****************************************************************************/ +/** Function Name: EventProcess **/ +/** Purpose: Process posted event. **/ +/** Parameters: **/ /** @ eEventType[in]: HMI event type. **/ -/** @ pstEvent[in]: HMI event data. **/ -/** Return: HMI_ENGINE_RESULT. **/ -/** Notice: This function must be called when initialize. **/ -/*****************************************************************************/ -HMI_ENGINE_RESULT EventProcess(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) -{ - /*----------------------------------*/ - /* Variable Declaration */ - /*----------------------------------*/ - HMI_ENGINE_RESULT eProcessResult; - - /*----------------------------------*/ - /* Initialize */ - /*----------------------------------*/ - eProcessResult = HMI_RET_NORMAL; - - /*----------------------------------*/ - /* Process */ - /*----------------------------------*/ - - eProcessResult = HMI_ProcessEvent(eEventType, pstEvent); - if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) - { - HMI_PostProcess(eProcessResult); - } - - return eProcessResult; -} +/** @ pstEvent[in]: HMI event data. **/ +/** Return: HMI_ENGINE_RESULT. **/ +/** Notice: This function must be called when initialize. **/ +/*****************************************************************************/ +HMI_ENGINE_RESULT EventProcess(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) +{ + /*----------------------------------*/ + /* Variable Declaration */ + /*----------------------------------*/ + HMI_ENGINE_RESULT eProcessResult; + + /*----------------------------------*/ + /* Initialize */ + /*----------------------------------*/ + eProcessResult = HMI_RET_NORMAL; + + /*----------------------------------*/ + /* Process */ + /*----------------------------------*/ + + eProcessResult = HMI_ProcessEvent(eEventType, pstEvent); + if(HMI_PROCESS_SUCCESSFUL(eProcessResult)) + { + HMI_PostProcess(eProcessResult); + } + + return eProcessResult; +} diff --git a/DemoProc/src/List.c b/DemoProc/src/List.c index eab8d6b..912d62e 100644 --- a/DemoProc/src/List.c +++ b/DemoProc/src/List.c @@ -21,11 +21,11 @@ //=======================================================================// //= Static function declaration. =// //=======================================================================// -static HMI_ENGINE_RESULT HMI_DemoList_Initialize(void); -static HMI_ENGINE_RESULT HMI_DemoList_Prepare(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoList_RefreshScreen(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoList_ProcessEvent(HMI_EVENT_TYPE eEvent, const HMI_EVENT* pstEvent); -static HMI_ENGINE_RESULT HMI_DemoList_PostProcess(SGUI_INT iActionResult); +static HMI_ENGINE_RESULT HMI_DemoList_Initialize(SGUI_IF_OBJ* pstIFObj); +static HMI_ENGINE_RESULT HMI_DemoList_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoList_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoList_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEvent, const HMI_EVENT* pstEvent); +static HMI_ENGINE_RESULT HMI_DemoList_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult); //=======================================================================// //= Static variable declaration. =// @@ -70,7 +70,7 @@ HMI_SCREEN_OBJECT g_stHMIDemo_List = { HMI_SCREEN_ID_DEMO_LIST, //=======================================================================// //= Function define. =// //=======================================================================// -HMI_ENGINE_RESULT HMI_DemoList_Initialize(void) +HMI_ENGINE_RESULT HMI_DemoList_Initialize(SGUI_IF_OBJ* pstIFObj) { #if (_SIMPLE_GUI_ENABLE_DYNAMIC_MEMORY_ > 0) /*----------------------------------*/ @@ -108,25 +108,25 @@ HMI_ENGINE_RESULT HMI_DemoList_Initialize(void) return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoList_Prepare (const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoList_Prepare (SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { /*----------------------------------*/ /* Process */ /*----------------------------------*/ - SGUI_List_Refresh(&s_stDemoListObject); + SGUI_List_Refresh(pstIFObj, &s_stDemoListObject); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoList_RefreshScreen(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoList_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { /*----------------------------------*/ /* Process */ /*----------------------------------*/ - SGUI_List_Refresh(&s_stDemoListObject); + SGUI_List_Refresh(pstIFObj, &s_stDemoListObject); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoList_ProcessEvent(HMI_EVENT_TYPE eEvent, const HMI_EVENT* pstEvent) +HMI_ENGINE_RESULT HMI_DemoList_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEvent, const HMI_EVENT* pstEvent) { /*----------------------------------*/ /* Variable Declaration */ @@ -163,23 +163,23 @@ HMI_ENGINE_RESULT HMI_DemoList_ProcessEvent(HMI_EVENT_TYPE eEvent, const HMI_EVE } case KEY_VALUE_UP: { - SGUI_List_SelectUpItem(&s_stDemoListObject); + SGUI_List_SelectUpItem(pstIFObj, &s_stDemoListObject); break; } case KEY_VALUE_DOWN: { - SGUI_List_SelectDownItem(&s_stDemoListObject); + SGUI_List_SelectDownItem(pstIFObj, &s_stDemoListObject); break; } case KEY_VALUE_RIGHT: { if((*(parrKeyValue+0) & KEY_OPTION_SHIFT) != 0) { - SGUI_List_SetListItemValue(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Valid.Value, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Decimal.Value-1); + SGUI_List_SetListItemValue(pstIFObj, &s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Valid.Value, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Decimal.Value-1); } else { - SGUI_List_SetListItemValue(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Valid.Value+1, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Decimal.Value); + SGUI_List_SetListItemValue(pstIFObj, &s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Valid.Value+1, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Decimal.Value); } break; } @@ -187,11 +187,11 @@ HMI_ENGINE_RESULT HMI_DemoList_ProcessEvent(HMI_EVENT_TYPE eEvent, const HMI_EVE { if((*(parrKeyValue+0) & KEY_OPTION_SHIFT) != 0) { - SGUI_List_SetListItemValue(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Valid.Value, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Decimal.Value+1); + SGUI_List_SetListItemValue(pstIFObj, &s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Valid.Value, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Decimal.Value+1); } else { - SGUI_List_SetListItemValue(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Valid.Value-1, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Decimal.Value); + SGUI_List_SetListItemValue(pstIFObj, &s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Valid.Value-1, SGUI_List_GetListItemPtr(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex)->Decimal.Value); } break; } @@ -199,25 +199,25 @@ HMI_ENGINE_RESULT HMI_DemoList_ProcessEvent(HMI_EVENT_TYPE eEvent, const HMI_EVE case KEY_VALUE_F8: { SGUI_List_RemoveItem(&s_stDemoListObject, s_stDemoListObject.ControlVariable.SelectIndex); - SGUI_List_Refresh(&s_stDemoListObject); + SGUI_List_Refresh(pstIFObj, &s_stDemoListObject); break; } case KEY_VALUE_F9: // Insert to head. { SGUI_List_InsertItem(&s_stDemoListObject, &s_arrstAppendListItems[0], 0); - SGUI_List_Refresh(&s_stDemoListObject); + SGUI_List_Refresh(pstIFObj, &s_stDemoListObject); break; } case KEY_VALUE_F10: // Insert to intermediate. { SGUI_List_InsertItem(&s_stDemoListObject, &s_arrstAppendListItems[1], 5); - SGUI_List_Refresh(&s_stDemoListObject); + SGUI_List_Refresh(pstIFObj, &s_stDemoListObject); break; } case KEY_VALUE_F11: // Insert to end. { SGUI_List_InsertItem(&s_stDemoListObject, &s_arrstAppendListItems[2], s_stDemoListObject.Data.Count); - SGUI_List_Refresh(&s_stDemoListObject); + SGUI_List_Refresh(pstIFObj, &s_stDemoListObject); break; } #endif @@ -232,7 +232,7 @@ HMI_ENGINE_RESULT HMI_DemoList_ProcessEvent(HMI_EVENT_TYPE eEvent, const HMI_EVE return eProcessResult; } -HMI_ENGINE_RESULT HMI_DemoList_PostProcess(SGUI_INT iActionResult) +HMI_ENGINE_RESULT HMI_DemoList_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult) { uint32_t uiSelectListIndex; SGUI_List_ITEM* pstSelectedItem; diff --git a/DemoProc/src/RTCNotice.c b/DemoProc/src/RTCNotice.c index 7634969..9e26788 100644 --- a/DemoProc/src/RTCNotice.c +++ b/DemoProc/src/RTCNotice.c @@ -21,11 +21,11 @@ //=======================================================================// //= Static function declaration. =// //=======================================================================// -static HMI_ENGINE_RESULT HMI_DemoRTCNotice_Initialize(void); -static HMI_ENGINE_RESULT HMI_DemoRTCNotice_Prepare(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoRTCNotice_RefreshScreen(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoRTCNotice_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); -static HMI_ENGINE_RESULT HMI_DemoRTCNotice_PostProcess(SGUI_INT iActionResult); +static HMI_ENGINE_RESULT HMI_DemoRTCNotice_Initialize(SGUI_IF_OBJ* pstIFObj); +static HMI_ENGINE_RESULT HMI_DemoRTCNotice_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoRTCNotice_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoRTCNotice_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); +static HMI_ENGINE_RESULT HMI_DemoRTCNotice_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult); //=======================================================================// //= Static variable declaration. =// @@ -47,19 +47,19 @@ HMI_SCREEN_OBJECT g_stHMIDemo_RTCNotice = { HMI_SCREEN_ID_DEMO_RTC_NOTIC //=======================================================================// //= Function define. =// //=======================================================================// -HMI_ENGINE_RESULT HMI_DemoRTCNotice_Initialize(void) +HMI_ENGINE_RESULT HMI_DemoRTCNotice_Initialize(SGUI_IF_OBJ* pstIFObj) { SGUI_Common_MemorySet(s_szRTCNoticeText, 0x00, sizeof(SGUI_CHAR)*(NOTICE_RTC_BUFFER_SIZE+1)); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoRTCNotice_Prepare(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoRTCNotice_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { - HMI_DemoRTCNotice_RefreshScreen(NULL); + HMI_DemoRTCNotice_RefreshScreen(pstIFObj, NULL); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoRTCNotice_RefreshScreen(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoRTCNotice_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { /*----------------------------------*/ /* Variable Declaration */ @@ -73,11 +73,11 @@ HMI_ENGINE_RESULT HMI_DemoRTCNotice_RefreshScreen(const void* pstParameters) sprintf(s_szRTCNoticeText, DEMO_RTC_NOTICE_TEXT_FMT, stRTCTime.Year, stRTCTime.Month, stRTCTime.Day, stRTCTime.Hour, stRTCTime.Minute, stRTCTime.Second); - SGUI_Notice_Refresh(s_szRTCNoticeText, 0, SGUI_ICON_INFORMATION); + SGUI_Notice_Refresh(pstIFObj, s_szRTCNoticeText, 0, SGUI_ICON_INFORMATION); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoRTCNotice_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) +HMI_ENGINE_RESULT HMI_DemoRTCNotice_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) { /*----------------------------------*/ /* Variable Declaration */ @@ -122,7 +122,7 @@ HMI_ENGINE_RESULT HMI_DemoRTCNotice_ProcessEvent(HMI_EVENT_TYPE eEventType, cons sprintf(s_szRTCNoticeText, DEMO_RTC_NOTICE_TEXT_FMT, pstRTCTime->Year, pstRTCTime->Month, pstRTCTime->Day, pstRTCTime->Hour, pstRTCTime->Minute, pstRTCTime->Second); - SGUI_Notice_Refresh(s_szRTCNoticeText, 0, SGUI_ICON_INFORMATION); + SGUI_Notice_Refresh(pstIFObj, s_szRTCNoticeText, 0, SGUI_ICON_INFORMATION); eProcessResult = HMI_RET_NOACTION; } } @@ -136,7 +136,7 @@ HMI_ENGINE_RESULT HMI_DemoRTCNotice_ProcessEvent(HMI_EVENT_TYPE eEventType, cons return eProcessResult; } -HMI_ENGINE_RESULT HMI_DemoRTCNotice_PostProcess(SGUI_INT iActionResult) +HMI_ENGINE_RESULT HMI_DemoRTCNotice_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult) { if(HMI_RET_CANCEL == iActionResult) { diff --git a/DemoProc/src/RealtimeGraph.c b/DemoProc/src/RealtimeGraph.c index 77997cc..f4bafa1 100644 --- a/DemoProc/src/RealtimeGraph.c +++ b/DemoProc/src/RealtimeGraph.c @@ -14,11 +14,11 @@ //=======================================================================// //= Static function declaration. =// //=======================================================================// -static HMI_ENGINE_RESULT HMI_DemoRealGraph_Initialize(void); -static HMI_ENGINE_RESULT HMI_DemoRealGraph_Prepare(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoRealGraph_RefreshScreen(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoRealGraph_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); -static HMI_ENGINE_RESULT HMI_DemoRealGraph_PostProcess(SGUI_INT iActionResult); +static HMI_ENGINE_RESULT HMI_DemoRealGraph_Initialize(SGUI_IF_OBJ* pstIFObj); +static HMI_ENGINE_RESULT HMI_DemoRealGraph_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoRealGraph_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoRealGraph_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); +static HMI_ENGINE_RESULT HMI_DemoRealGraph_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult); //=======================================================================// //= Static variable declaration. =// @@ -42,27 +42,27 @@ HMI_SCREEN_OBJECT g_stHMI_DemoRealtimeGraph = { HMI_SCREEN_ID_DEMO_REAL_TIME //=======================================================================// //= Function define. =// //=======================================================================// -HMI_ENGINE_RESULT HMI_DemoRealGraph_Initialize(void) +HMI_ENGINE_RESULT HMI_DemoRealGraph_Initialize(SGUI_IF_OBJ* pstIFObj) { //SGUI_RealtimeGraph_Initialize(&s_stRealtimeGraph); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoRealGraph_Prepare(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoRealGraph_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { SGUI_RealtimeGraph_Initialize(&s_stRealtimeGraph); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoRealGraph_RefreshScreen(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoRealGraph_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { SGUI_CHAR szTextBuffer[16]; SGUI_Common_IntegerToString(s_stRealtimeGraph.Data->ValueArray[s_stRealtimeGraph.Data->ValueCount-1], szTextBuffer, 10, -15, ' '); - SGUI_RealtimeGraph_Refresh(&s_stRealtimeGraph, szTextBuffer, "Real-time graph."); + SGUI_RealtimeGraph_Refresh(pstIFObj, &s_stRealtimeGraph, szTextBuffer, "Real-time graph."); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoRealGraph_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) +HMI_ENGINE_RESULT HMI_DemoRealGraph_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) { /*----------------------------------*/ /* Variable Declaration */ @@ -102,7 +102,7 @@ HMI_ENGINE_RESULT HMI_DemoRealGraph_ProcessEvent(HMI_EVENT_TYPE eEventType, cons { iNewValue = *((SGUI_INT*)pstEvent->Data); SGUI_RealtimeGraph_AppendValue(&s_stRealtimeGraph, iNewValue); - HMI_DemoRealGraph_RefreshScreen(NULL); + HMI_DemoRealGraph_RefreshScreen(pstIFObj, NULL); break; } default: @@ -116,7 +116,7 @@ HMI_ENGINE_RESULT HMI_DemoRealGraph_ProcessEvent(HMI_EVENT_TYPE eEventType, cons return eProcessResult; } -HMI_ENGINE_RESULT HMI_DemoRealGraph_PostProcess(SGUI_INT iActionResult) +HMI_ENGINE_RESULT HMI_DemoRealGraph_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult) { /*----------------------------------*/ /* Process */ diff --git a/DemoProc/src/ScrollingText.c b/DemoProc/src/ScrollingText.c index 439ef6b..fd1659c 100644 --- a/DemoProc/src/ScrollingText.c +++ b/DemoProc/src/ScrollingText.c @@ -31,11 +31,11 @@ //=======================================================================// //= Static function declaration. =// //=======================================================================// -static HMI_ENGINE_RESULT HMI_DemoScrollingText_Initialize(void); -static HMI_ENGINE_RESULT HMI_DemoScrollingText_Prepare(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoScrollingText_RefreshScreen(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoScrollingText_ProcessEvent(HMI_EVENT_TYPE eEvent, const HMI_EVENT* pstEvent); -static HMI_ENGINE_RESULT HMI_DemoScrollingText_PostProcess(SGUI_INT iActionResult); +static HMI_ENGINE_RESULT HMI_DemoScrollingText_Initialize(SGUI_IF_OBJ* Interface); +static HMI_ENGINE_RESULT HMI_DemoScrollingText_Prepare(SGUI_IF_OBJ* Interface, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoScrollingText_RefreshScreen(SGUI_IF_OBJ* Interface, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoScrollingText_ProcessEvent(SGUI_IF_OBJ* Interface, HMI_EVENT_TYPE eEvent, const HMI_EVENT* pstEvent); +static HMI_ENGINE_RESULT HMI_DemoScrollingText_PostProcess(SGUI_IF_OBJ* Interface, SGUI_INT iActionResult); //=======================================================================// //= Static variable declaration. =// @@ -76,7 +76,7 @@ HMI_SCREEN_OBJECT g_stHMIDemo_ScrollingText = { /** Return: Initialize process result. **/ /** Limitation: None. **/ /*****************************************************************************/ -HMI_ENGINE_RESULT HMI_DemoScrollingText_Initialize(void) +HMI_ENGINE_RESULT HMI_DemoScrollingText_Initialize(SGUI_IF_OBJ* Interface) { s_iTextOffset = HMI_TEXT_DEMO_FRAME_TEXT_HEIGHT; s_iTextHeight = SGUI_Text_GetMultiLineTextLines(s_szDemoText, (HMI_TEXT_DEMO_FRAME_TEXT_WIDTH/g_stFontSize[SGUI_FONT_SIZE_H12].Width))*g_stFontSize[SGUI_FONT_SIZE_H12].Height; @@ -95,9 +95,9 @@ HMI_ENGINE_RESULT HMI_DemoScrollingText_Initialize(void) /** Return: Preprocess result. **/ /** Limitation: None. **/ /*****************************************************************************/ -HMI_ENGINE_RESULT HMI_DemoScrollingText_Prepare(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoScrollingText_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { - SGUI_Frame_DrawFullScreenFrame(&s_stTextFrame); + SGUI_Frame_DrawFullScreenFrame(pstIFObj, &s_stTextFrame); return HMI_RET_NORMAL; } @@ -109,10 +109,10 @@ HMI_ENGINE_RESULT HMI_DemoScrollingText_Prepare(const void* pstParameters) /** Return: Refresh process result. **/ /** Limitation: None. **/ /*****************************************************************************/ -HMI_ENGINE_RESULT HMI_DemoScrollingText_RefreshScreen(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoScrollingText_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { - SGUI_Frame_DrawFullScreenFrame(&s_stTextFrame); - SGUI_Text_DrawMultipleLinesText(s_szDemoText, SGUI_FONT_SIZE_H12, &s_stTextDisplayArea, s_iTextOffset, SGUI_DRAW_NORMAL); + SGUI_Frame_DrawFullScreenFrame(pstIFObj, &s_stTextFrame); + SGUI_Text_DrawMultipleLinesText(pstIFObj, s_szDemoText, SGUI_FONT_SIZE_H12, &s_stTextDisplayArea, s_iTextOffset, SGUI_DRAW_NORMAL); return HMI_RET_NORMAL; } @@ -127,7 +127,7 @@ HMI_ENGINE_RESULT HMI_DemoScrollingText_RefreshScreen(const void* pstParameters) /** Limitation: Parameter pointer is a void type, convert to the **/ /** appropriate type before use. **/ /*****************************************************************************/ -HMI_ENGINE_RESULT HMI_DemoScrollingText_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) +HMI_ENGINE_RESULT HMI_DemoScrollingText_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) { /*----------------------------------*/ /* Variable Declaration */ @@ -165,7 +165,7 @@ HMI_ENGINE_RESULT HMI_DemoScrollingText_ProcessEvent(HMI_EVENT_TYPE eEventType, case HMI_ENGINE_ACTION_ON_TIMER: { //SGUI_Frame_DrawFullScreenFrame(&s_stTextFrame); - SGUI_Text_DrawMultipleLinesText(s_szDemoText, SGUI_FONT_SIZE_H12, &s_stTextDisplayArea, s_iTextOffset, SGUI_DRAW_NORMAL); + SGUI_Text_DrawMultipleLinesText(pstIFObj, s_szDemoText, SGUI_FONT_SIZE_H12, &s_stTextDisplayArea, s_iTextOffset, SGUI_DRAW_NORMAL); if(s_iTextOffset + s_iTextHeight == 0) { s_iTextOffset = HMI_TEXT_DEMO_FRAME_TEXT_HEIGHT; @@ -197,7 +197,7 @@ HMI_ENGINE_RESULT HMI_DemoScrollingText_ProcessEvent(HMI_EVENT_TYPE eEventType, /** Return: Post process result. **/ /** Limitation: None. **/ /*****************************************************************************/ -HMI_ENGINE_RESULT HMI_DemoScrollingText_PostProcess(SGUI_INT iActionResult) +HMI_ENGINE_RESULT HMI_DemoScrollingText_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult) { if(HMI_RET_FOLLOWUP == iActionResult) { diff --git a/DemoProc/src/TextNotice.c b/DemoProc/src/TextNotice.c index f8ef838..9338183 100644 --- a/DemoProc/src/TextNotice.c +++ b/DemoProc/src/TextNotice.c @@ -20,11 +20,11 @@ //=======================================================================// //= Static function declaration. =// //=======================================================================// -static HMI_ENGINE_RESULT HMI_DemoTextNotice_Initialize(void); -static HMI_ENGINE_RESULT HMI_DemoTextNotice_Prepare(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoTextNotice_RefreshScreen(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoTextNotice_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); -static HMI_ENGINE_RESULT HMI_DemoTextNotice_PostProcess(SGUI_INT iActionResult); +static HMI_ENGINE_RESULT HMI_DemoTextNotice_Initialize(SGUI_IF_OBJ* pstIFObj); +static HMI_ENGINE_RESULT HMI_DemoTextNotice_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoTextNotice_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoTextNotice_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); +static HMI_ENGINE_RESULT HMI_DemoTextNotice_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult); //=======================================================================// //= Static variable declaration. =// @@ -48,13 +48,13 @@ HMI_SCREEN_OBJECT g_stHMIDemo_TextNotice = { HMI_SCREEN_ID_DEMO_TEXT_NOTI //=======================================================================// //= Function define. =// //=======================================================================// -HMI_ENGINE_RESULT HMI_DemoTextNotice_Initialize(void) +HMI_ENGINE_RESULT HMI_DemoTextNotice_Initialize(SGUI_IF_OBJ* pstIFObj) { SGUI_Common_MemorySet(s_szDemoNoticeText, 0x00, sizeof(SGUI_CHAR)*(NOTICE_TEXT_BUFFER_SIZE+1)); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoTextNotice_Prepare(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoTextNotice_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { /*----------------------------------*/ /* Process */ @@ -68,17 +68,17 @@ HMI_ENGINE_RESULT HMI_DemoTextNotice_Prepare(const void* pstParameters) SGUI_Common_StringLengthCopy(s_szDemoNoticeText, (SGUI_PSZSTR)pstParameters, NOTICE_TEXT_BUFFER_SIZE); s_szDemoNoticeText[NOTICE_TEXT_BUFFER_SIZE] = '\0'; } - SGUI_Notice_Refresh(s_szDemoNoticeText, 0, SGUI_ICON_INFORMATION); + SGUI_Notice_Refresh(pstIFObj, s_szDemoNoticeText, 0, SGUI_ICON_INFORMATION); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoTextNotice_RefreshScreen(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoTextNotice_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { - SGUI_Notice_Refresh(s_szDemoNoticeText, 0, SGUI_ICON_INFORMATION); + SGUI_Notice_Refresh(pstIFObj, s_szDemoNoticeText, 0, SGUI_ICON_INFORMATION); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoTextNotice_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) +HMI_ENGINE_RESULT HMI_DemoTextNotice_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) { /*----------------------------------*/ /* Variable Declaration */ @@ -117,7 +117,7 @@ HMI_ENGINE_RESULT HMI_DemoTextNotice_ProcessEvent(HMI_EVENT_TYPE eEventType, con return eProcessResult; } -HMI_ENGINE_RESULT HMI_DemoTextNotice_PostProcess(SGUI_INT iActionResult) +HMI_ENGINE_RESULT HMI_DemoTextNotice_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult) { /*----------------------------------*/ /* Process */ diff --git a/DemoProc/src/VariableBox.c b/DemoProc/src/VariableBox.c index 5bd3490..afdf0b6 100644 --- a/DemoProc/src/VariableBox.c +++ b/DemoProc/src/VariableBox.c @@ -25,12 +25,12 @@ //=======================================================================// //= Static function declaration. =// //=======================================================================// -static HMI_ENGINE_RESULT HMI_DemoVariableBox_Initialize(void); -static HMI_ENGINE_RESULT HMI_DemoVariableBox_Prepare(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoVariableBox_RefreshScreen(const void* pstParameters); -static HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); -static HMI_ENGINE_RESULT HMI_DemoVariableBox_PostProcess(SGUI_INT iActionResult); -static void HMI_DemoVariableBox_DrawFrame(SGUI_PSZSTR szTitle); +static HMI_ENGINE_RESULT HMI_DemoVariableBox_Initialize(SGUI_IF_OBJ* pstIFObj); +static HMI_ENGINE_RESULT HMI_DemoVariableBox_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoVariableBox_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters); +static HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); +static HMI_ENGINE_RESULT HMI_DemoVariableBox_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult); +static void HMI_DemoVariableBox_DrawFrame(SGUI_IF_OBJ* pstIFObj, SGUI_PSZSTR szTitle); //=======================================================================// //= Static variable declaration. =// @@ -75,43 +75,43 @@ HMI_SCREEN_OBJECT g_stHMIDemo_VariableBox = { HMI_SCREEN_ID_DEMO_VARIABL //=======================================================================// //= Function define. =// //=======================================================================// -HMI_ENGINE_RESULT HMI_DemoVariableBox_Initialize(void) +HMI_ENGINE_RESULT HMI_DemoVariableBox_Initialize(SGUI_IF_OBJ* pstIFObj) { s_uiFocusedFlag = 0; return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoVariableBox_Prepare(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoVariableBox_Prepare(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { /*----------------------------------*/ /* Process */ /*----------------------------------*/ // Draw frame s_szFrameTitle = s_szDefaultFrameTitle; - HMI_DemoVariableBox_DrawFrame((SGUI_PSZSTR)s_szFrameTitle); + HMI_DemoVariableBox_DrawFrame(pstIFObj, (SGUI_PSZSTR)s_szFrameTitle); // Show notice - SGUI_Notice_Refresh(s_szHelpNoticeText, 0, SGUI_ICON_INFORMATION); + SGUI_Notice_Refresh(pstIFObj, s_szHelpNoticeText, 0, SGUI_ICON_INFORMATION); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoVariableBox_RefreshScreen(const void* pstParameters) +HMI_ENGINE_RESULT HMI_DemoVariableBox_RefreshScreen(SGUI_IF_OBJ* pstIFObj, const void* pstParameters) { /*----------------------------------*/ /* Process */ /*----------------------------------*/ // Draw frame - HMI_DemoVariableBox_DrawFrame((SGUI_PSZSTR)s_szFrameTitle); + HMI_DemoVariableBox_DrawFrame(pstIFObj, (SGUI_PSZSTR)s_szFrameTitle); // Draw number box - SGUI_Basic_DrawRectangle(VARIABLE_BOX_POSX, VARIABLE_BOX_NUMBER_POSY, VARIABLE_BOX_WIDTH+4, g_stFontSize[s_stNumberVariableBox.FontSize].Height+6, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); - SGUI_IntegerVariableBox_Refresh(&s_stNumberVariableBox, SGUI_CENTER, (0 == s_uiFocusedFlag)?SGUI_DRAW_REVERSE:SGUI_DRAW_NORMAL); + SGUI_Basic_DrawRectangle(pstIFObj, VARIABLE_BOX_POSX, VARIABLE_BOX_NUMBER_POSY, VARIABLE_BOX_WIDTH+4, g_stFontSize[s_stNumberVariableBox.FontSize].Height+6, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); + SGUI_IntegerVariableBox_Refresh(pstIFObj, &s_stNumberVariableBox, SGUI_CENTER, (0 == s_uiFocusedFlag)?SGUI_DRAW_REVERSE:SGUI_DRAW_NORMAL); // Draw text box - SGUI_Basic_DrawRectangle(VARIABLE_BOX_POSX, VARIABLE_BOX_TEXT_POSY, VARIABLE_BOX_WIDTH+4, g_stFontSize[s_stTextVariableBox.FontSize].Height+6, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); - SGUI_TextVariableBox_Refresh(&s_stTextVariableBox, (0 == s_uiFocusedFlag)?SGUI_DRAW_NORMAL:SGUI_DRAW_REVERSE); + SGUI_Basic_DrawRectangle(pstIFObj, VARIABLE_BOX_POSX, VARIABLE_BOX_TEXT_POSY, VARIABLE_BOX_WIDTH+4, g_stFontSize[s_stTextVariableBox.FontSize].Height+6, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); + SGUI_TextVariableBox_Refresh(pstIFObj, &s_stTextVariableBox, (0 == s_uiFocusedFlag)?SGUI_DRAW_NORMAL:SGUI_DRAW_REVERSE); return HMI_RET_NORMAL; } -HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) +HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(SGUI_IF_OBJ* pstIFObj, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent) { /*----------------------------------*/ /* Variable Declaration */ @@ -160,7 +160,7 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, co // Redraw screen if time out. if(0 == s_uiAutoConfirmTimer) { - eProcessResult = HMI_DemoVariableBox_RefreshScreen(NULL); + eProcessResult = HMI_DemoVariableBox_RefreshScreen(pstIFObj, NULL); } eProcessResult = HMI_RET_NOACTION; @@ -179,13 +179,13 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, co s_uiFocusedFlag = ((s_uiFocusedFlag+1)%2); if(0 == s_uiFocusedFlag) { - SGUI_IntegerVariableBox_Refresh(&s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_REVERSE); - SGUI_TextVariableBox_Refresh(&s_stTextVariableBox, SGUI_DRAW_NORMAL); + SGUI_IntegerVariableBox_Refresh(pstIFObj, &s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_REVERSE); + SGUI_TextVariableBox_Refresh(pstIFObj, &s_stTextVariableBox, SGUI_DRAW_NORMAL); } else { - SGUI_IntegerVariableBox_Refresh(&s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_NORMAL); - SGUI_TextVariableBox_Refresh(&s_stTextVariableBox, SGUI_DRAW_REVERSE); + SGUI_IntegerVariableBox_Refresh(pstIFObj, &s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_NORMAL); + SGUI_TextVariableBox_Refresh(pstIFObj, &s_stTextVariableBox, SGUI_DRAW_REVERSE); } eProcessResult = HMI_RET_NOACTION; break; @@ -202,7 +202,7 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, co if(s_stTextVariableBox.FocusIndex > 0) { s_stTextVariableBox.FocusIndex--; - SGUI_TextVariableBox_ChangeCharacter(&s_stTextVariableBox, SGUI_DRAW_REVERSE, GUI_TEXT_ASCII, SGUI_TXT_VARBOX_OPT_NONE); + SGUI_TextVariableBox_ChangeCharacter(pstIFObj, &s_stTextVariableBox, SGUI_DRAW_REVERSE, GUI_TEXT_ASCII, SGUI_TXT_VARBOX_OPT_NONE); } } eProcessResult = HMI_RET_NOACTION; @@ -212,12 +212,12 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, co { if(1 == s_uiFocusedFlag) { - SGUI_TextVariableBox_ChangeCharacter(&s_stTextVariableBox, SGUI_DRAW_REVERSE, GUI_TEXT_ASCII, SGUI_TXT_VARBOX_OPT_PREV); + SGUI_TextVariableBox_ChangeCharacter(pstIFObj, &s_stTextVariableBox, SGUI_DRAW_REVERSE, GUI_TEXT_ASCII, SGUI_TXT_VARBOX_OPT_PREV); } else { s_stNumberVariableBox.Value++; - SGUI_IntegerVariableBox_Refresh(&s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_REVERSE); + SGUI_IntegerVariableBox_Refresh(pstIFObj, &s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_REVERSE); } eProcessResult = HMI_RET_NOACTION; break; @@ -229,7 +229,7 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, co if(s_stTextVariableBox.FocusIndex < (s_stTextVariableBox.MaxTextLength-1)) { s_stTextVariableBox.FocusIndex++; - SGUI_TextVariableBox_ChangeCharacter(&s_stTextVariableBox, SGUI_DRAW_REVERSE, GUI_TEXT_ASCII, SGUI_TXT_VARBOX_OPT_NONE); + SGUI_TextVariableBox_ChangeCharacter(pstIFObj, &s_stTextVariableBox, SGUI_DRAW_REVERSE, GUI_TEXT_ASCII, SGUI_TXT_VARBOX_OPT_NONE); } } eProcessResult = HMI_RET_NOACTION; @@ -239,12 +239,12 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, co { if(1 == s_uiFocusedFlag) { - SGUI_TextVariableBox_ChangeCharacter(&s_stTextVariableBox, SGUI_DRAW_REVERSE, GUI_TEXT_ASCII, SGUI_TXT_VARBOX_OPT_NEXT); + SGUI_TextVariableBox_ChangeCharacter(pstIFObj, &s_stTextVariableBox, SGUI_DRAW_REVERSE, GUI_TEXT_ASCII, SGUI_TXT_VARBOX_OPT_NEXT); } else { s_stNumberVariableBox.Value--; - SGUI_IntegerVariableBox_Refresh(&s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_REVERSE); + SGUI_IntegerVariableBox_Refresh(pstIFObj, &s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_REVERSE); } eProcessResult = HMI_RET_NOACTION; break; @@ -254,13 +254,13 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, co if(1 == s_uiFocusedFlag) { s_szFrameTitle = s_stTextVariableBox.Value; - HMI_DemoVariableBox_DrawFrame((SGUI_PSZSTR)s_szFrameTitle); + HMI_DemoVariableBox_DrawFrame(pstIFObj, (SGUI_PSZSTR)s_szFrameTitle); // Draw number box - SGUI_Basic_DrawRectangle(VARIABLE_BOX_POSX, VARIABLE_BOX_NUMBER_POSY, VARIABLE_BOX_WIDTH+4, g_stFontSize[s_stNumberVariableBox.FontSize].Height+6, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); - SGUI_IntegerVariableBox_Refresh(&s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_NORMAL); + SGUI_Basic_DrawRectangle(pstIFObj, VARIABLE_BOX_POSX, VARIABLE_BOX_NUMBER_POSY, VARIABLE_BOX_WIDTH+4, g_stFontSize[s_stNumberVariableBox.FontSize].Height+6, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); + SGUI_IntegerVariableBox_Refresh(pstIFObj, &s_stNumberVariableBox, SGUI_CENTER, SGUI_DRAW_NORMAL); // Draw text box - SGUI_Basic_DrawRectangle(VARIABLE_BOX_POSX, VARIABLE_BOX_TEXT_POSY, VARIABLE_BOX_WIDTH+4, g_stFontSize[s_stTextVariableBox.FontSize].Height+6, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); - SGUI_TextVariableBox_Refresh(&s_stTextVariableBox, SGUI_DRAW_REVERSE); + SGUI_Basic_DrawRectangle(pstIFObj, VARIABLE_BOX_POSX, VARIABLE_BOX_TEXT_POSY, VARIABLE_BOX_WIDTH+4, g_stFontSize[s_stTextVariableBox.FontSize].Height+6, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); + SGUI_TextVariableBox_Refresh(pstIFObj, &s_stTextVariableBox, SGUI_DRAW_REVERSE); } break; } @@ -277,7 +277,7 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_ProcessEvent(HMI_EVENT_TYPE eEventType, co return eProcessResult; } -HMI_ENGINE_RESULT HMI_DemoVariableBox_PostProcess(SGUI_INT iActionResult) +HMI_ENGINE_RESULT HMI_DemoVariableBox_PostProcess(SGUI_IF_OBJ* pstIFObj, SGUI_INT iActionResult) { if(HMI_RET_CANCEL == iActionResult) { @@ -287,7 +287,7 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_PostProcess(SGUI_INT iActionResult) return HMI_RET_NORMAL; } -void HMI_DemoVariableBox_DrawFrame(SGUI_PSZSTR szTitle) +void HMI_DemoVariableBox_DrawFrame(SGUI_IF_OBJ* pstIFObj, SGUI_PSZSTR szTitle) { /*----------------------------------*/ /* Variable Declaration */ @@ -305,5 +305,5 @@ void HMI_DemoVariableBox_DrawFrame(SGUI_PSZSTR szTitle) /* Process */ /*----------------------------------*/ // Draw frame - SGUI_Frame_DrawFullScreenFrame(&stFrameData); + SGUI_Frame_DrawFullScreenFrame(pstIFObj, &stFrameData); } diff --git a/DemoProject/STM32F1/Demo/src/DemoActions.c b/DemoProject/STM32F1/Demo/src/DemoActions.c index fd4e456..07d76c5 100644 --- a/DemoProject/STM32F1/Demo/src/DemoActions.c +++ b/DemoProject/STM32F1/Demo/src/DemoActions.c @@ -71,7 +71,7 @@ void DemoAction_TimerEvent(void) iDemoGraphDataIndex = iDemoGraphDataIndex % 72; // Post timer event. EventProcess(HMI_ENGINE_EVENT_ACTION, &stEvent); - SGUI_Basic_RefreshDisplay(); + // SGUI_Basic_RefreshDisplay(); } void DemoAction_UsartReceiveEvent(uint8_t cbReceiveByte) @@ -95,7 +95,7 @@ void DemoAction_UsartReceiveEvent(uint8_t cbReceiveByte) /*----------------------------------*/ // Call demo process. EventProcess(HMI_ENGINE_EVENT_ACTION, &stEvent); - SGUI_Basic_RefreshDisplay(); + // SGUI_Basic_RefreshDisplay(); } void DemoAction_RTCUpdateEventProcess(void) @@ -123,6 +123,6 @@ void DemoAction_RTCUpdateEventProcess(void) /*----------------------------------*/ // Post RTC update message to a screen. EventProcess(HMI_ENGINE_EVENT_DATA, &stEvent); - SGUI_Basic_RefreshDisplay(); + // SGUI_Basic_RefreshDisplay(); } diff --git a/DemoProject/STM32F1/Device/inc/OLED.h b/DemoProject/STM32F1/Device/inc/OLED.h index b2dfccf..1b7cf98 100644 --- a/DemoProject/STM32F1/Device/inc/OLED.h +++ b/DemoProject/STM32F1/Device/inc/OLED.h @@ -14,13 +14,13 @@ typedef enum OLED_COLOR_TRS = 2, }OLED_COLOR; -//Common operation -#define SET_PAGE_BIT(PAGE, Bit) ((PAGE) = (PAGE) | (0x01 << (Bit))) -#define CLR_PAGE_BIT(PAGE, Bit) ((PAGE) = (PAGE) & (~(0x01 << (Bit)))) +//Common operation +#define SET_PAGE_BIT(PAGE, Bit) ((PAGE) = (PAGE) | (0x01 << (Bit))) +#define CLR_PAGE_BIT(PAGE, Bit) ((PAGE) = (PAGE) & (~(0x01 << (Bit)))) #define GET_PAGE_BIT(PAGE, Bit) ((((PAGE) & (0x01 << (Bit)))>0)?1:0) -void OLED_SetPixel(uint16_t uiPosX, uint16_t uiPosY, OLED_COLOR eColor); -uint16_t OLED_GetPixel(uint16_t uiPosX, uint16_t uiPosY); +void OLED_SetPixel(int iPosX, int iPosY, int iColor); +int OLED_GetPixel(int iPosX, int iPosY); void OLED_Initialize(void); void OLED_ClearDisplay(void); void OLED_RefreshScreen(void); diff --git a/DemoProject/STM32F1/Device/src/OLED.c b/DemoProject/STM32F1/Device/src/OLED.c index 9744f8f..ddd252f 100644 --- a/DemoProject/STM32F1/Device/src/OLED.c +++ b/DemoProject/STM32F1/Device/src/OLED.c @@ -97,26 +97,26 @@ void OLED_ClearDisplayBuffer(void) /** Resources: None. **/ /** Params: **/ /** @ ui_PosX: X location of point by pixels. **/ -/** @ ui_PosY: Y location of point by pixels. **/ -/** @ ui_Color: Point color, 0 is white, Nonzero is Black. **/ +/** @ iPosY: Y location of point by pixels. **/ +/** @ iColor: Point color, 0 is white, Nonzero is Black. **/ /** Return: None. **/ /** Limitation: None. **/ /*************************************************************************/ -void OLED_SetPixel(uint16_t uiPosX, uint16_t uiPosY, OLED_COLOR eColor) +void OLED_SetPixel(int iPosX, int iPosY, int iColor) { // Operating position check. - if((uiPosX < LCD_SIZE_WIDTH) && (uiPosY < LCD_SIZE_HEIGHT)) + if((iPosX < LCD_SIZE_WIDTH) && (iPosY < LCD_SIZE_HEIGHT)) { // Check and set page and column index. - OLED_UpdateChangedBufferAreaRecord(uiPosX, uiPosX); + OLED_UpdateChangedBufferAreaRecord(iPosX, iPosX); // Set point data. - if(OLED_COLOR_FRG == eColor) + if(OLED_COLOR_FRG == iColor) { - SET_PAGE_BIT(s_stLCDBuffer.auiDisplayCache[uiPosY/8][uiPosX], uiPosY%8); + SET_PAGE_BIT(s_stLCDBuffer.auiDisplayCache[iPosY/8][iPosX], iPosY%8); } else { - CLR_PAGE_BIT(s_stLCDBuffer.auiDisplayCache[uiPosY/8][uiPosX], uiPosY%8); + CLR_PAGE_BIT(s_stLCDBuffer.auiDisplayCache[iPosY/8][iPosX], iPosY%8); } } } @@ -131,12 +131,12 @@ void OLED_SetPixel(uint16_t uiPosX, uint16_t uiPosY, OLED_COLOR eColor) /** Return: None. **/ /** Limitation: None. **/ /*************************************************************************/ -uint16_t OLED_GetPixel(uint16_t uiPosX, uint16_t uiPosY) +int OLED_GetPixel(int iPosX, int iPosY) { // Operating position check. - if((uiPosX < LCD_SIZE_WIDTH) && (uiPosY < LCD_SIZE_HEIGHT)) + if((iPosX < LCD_SIZE_WIDTH) && (iPosY < LCD_SIZE_HEIGHT)) { - return GET_PAGE_BIT(s_stLCDBuffer.auiDisplayCache[uiPosY/8][uiPosX], uiPosY%8); + return GET_PAGE_BIT(s_stLCDBuffer.auiDisplayCache[iPosY/8][iPosX], iPosY%8); } else { diff --git a/DemoProject/STM32F1/Projects/EmBitz/SimpleGUI_Demo.ebp b/DemoProject/STM32F1/Projects/EmBitz/SimpleGUI_Demo.ebp index e7dbf92..508114b 100644 --- a/DemoProject/STM32F1/Projects/EmBitz/SimpleGUI_Demo.ebp +++ b/DemoProject/STM32F1/Projects/EmBitz/SimpleGUI_Demo.ebp @@ -291,6 +291,7 @@ + diff --git a/GUI/inc/SGUI_Basic.h b/GUI/inc/SGUI_Basic.h index 963fda9..2ccb912 100644 --- a/GUI/inc/SGUI_Basic.h +++ b/GUI/inc/SGUI_Basic.h @@ -15,25 +15,7 @@ //=======================================================================// //= Data type definition. =// //=======================================================================// -typedef enum -{ - SGUI_COLOR_BKGCLR = 0, - SGUI_COLOR_FRGCLR = 1, - SGUI_COLOR_TRANS = 2, -}SGUI_COLOR; -typedef enum -{ - SGUI_DRAW_NORMAL = 0, - SGUI_DRAW_REVERSE = 1, -}SGUI_DRAW_MODE; - -typedef struct -{ - SGUI_FLASH_DATA_SOURCE Source; - SGUI_ROM_ADDRESS StartAddr; - SGUI_SIZE Length; -}SGUI_BMP_DATA; //=======================================================================// //= User Macro definition. =// @@ -57,14 +39,13 @@ extern SGUI_CBYTE SGUI_BASIC_FONT_H6[]; //=======================================================================// //= Public function declaration. =// //=======================================================================// -void SGUI_Basic_ClearScreen(void); -void SGUI_Basic_DrawPoint(SGUI_UINT uiPosX, SGUI_UINT uiPosY, SGUI_COLOR eColor); -void SGUI_Basic_DrawLine(SGUI_INT uiStartX, SGUI_INT uiStartY, SGUI_INT uiEndX, SGUI_INT uiEndY, SGUI_COLOR eColor); -void SGUI_Basic_DrawRectangle(SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor); -void SGUI_Basic_DrawCircle(SGUI_UINT uiCx, SGUI_UINT uiCy, SGUI_UINT uiRadius, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor); -void SGUI_Basic_ReverseBlockColor(SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight); -//void SGUI_Basic_DrawBitMap(SGUI_RECT_AREA* pstDisplayArea, SGUI_RECT_AREA* pstDataArea, SGUI_BYTE* pDataBuffer, SGUI_DRAW_MODE eDrawMode); -void SGUI_Basic_DrawBitMap(SGUI_RECT_AREA* pstDisplayArea, SGUI_RECT_AREA* pstDataArea, SGUI_FLASH_DATA_SOURCE eDataSource, SGUI_ROM_ADDRESS adDataStartAddr, SGUI_DRAW_MODE eDrawMode); -void SGUI_Basic_RefreshDisplay(void); +void SGUI_Basic_ClearScreen(SGUI_IF_OBJ* pstIFObj); +void SGUI_Basic_DrawPoint(SGUI_IF_OBJ* pstIFObj, SGUI_UINT uiPosX, SGUI_UINT uiPosY, SGUI_COLOR eColor); +void SGUI_Basic_DrawLine(SGUI_IF_OBJ* pstIFObj, SGUI_INT uiStartX, SGUI_INT uiStartY, SGUI_INT uiEndX, SGUI_INT uiEndY, SGUI_COLOR eColor); +void SGUI_Basic_DrawRectangle(SGUI_IF_OBJ* pstIFObj, SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor); +void SGUI_Basic_DrawCircle(SGUI_IF_OBJ* pstIFObj, SGUI_UINT uiCx, SGUI_UINT uiCy, SGUI_UINT uiRadius, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor); +void SGUI_Basic_ReverseBlockColor(SGUI_IF_OBJ* pstIFObj, SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight); +void SGUI_Basic_DrawBitMap(SGUI_IF_OBJ* pstIFObj, SGUI_RECT_AREA* pstDisplayArea, SGUI_RECT_AREA* pstDataArea, SGUI_FLASH_DATA_SOURCE eDataSource, SGUI_ROM_ADDRESS adDataStartAddr, SGUI_DRAW_MODE eDrawMode); +void SGUI_Basic_RefreshDisplay(SGUI_IF_OBJ* pstIFObj); #endif diff --git a/GUI/inc/SGUI_Common.h b/GUI/inc/SGUI_Common.h index 7a451f0..5ba2389 100644 --- a/GUI/inc/SGUI_Common.h +++ b/GUI/inc/SGUI_Common.h @@ -3,7 +3,6 @@ //=======================================================================// //= Include files. =// //=======================================================================// -#include #include "SGUI_Typedef.h" #if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) #include "VirtualDeviceInterface.h" @@ -41,32 +40,6 @@ #define SGUI_INLINE inline // inline keyword for TASKING Compiler. #endif -//=======================================================================// -//= Public variable declaration. =// -//=======================================================================// -//#if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) -extern SGUI_CBYTE SGUI_FONT_H8[]; -extern SGUI_CBYTE SGUI_FONT_H12[]; -extern SGUI_CBYTE SGUI_FONT_H16[]; -extern SGUI_CBYTE SGUI_FONT_H32[]; -//#endif - -// Declare data source flag here. -typedef enum -{ - SGUI_FONT_SRC_NONE = 0, - SGUI_FONT_SRC_H6, - SGUI_FONT_SRC_H8, - SGUI_FONT_SRC_H12, - SGUI_FONT_SRC_H16, - //SGUI_FONT_SRC_H24, - SGUI_FONT_SRC_H32, - - SGUI_NOTICE_ICON_16PIX, - SGUI_NOTICE_ICON_24PIX, - SGUI_FONT_SRC_UNKNOWN, -}SGUI_FLASH_DATA_SOURCE; - //=======================================================================// //= Public function declaration. =// //=======================================================================// @@ -100,7 +73,4 @@ void SGUI_Common_RefreshScreen(void); void SGUI_Common_ReadFlashROM(SGUI_ROM_ADDRESS uiAddressHead, SGUI_SIZE uiDataLength, SGUI_BYTE* pBuffer); void SGUI_Common_Delay(SGUI_UINT32 uiTimeMs); - -SGUI_SIZE SGUI_FlashData_GetFilash(SGUI_FLASH_DATA_SOURCE eDataSource, SGUI_ROM_ADDRESS adStartAddr, SGUI_SIZE sReadSize, SGUI_BYTE* pOutputBuffer); - #endif // __INCLUDE_GUI_COMMON_H__ diff --git a/GUI/inc/SGUI_FlashData.h b/GUI/inc/SGUI_FlashData.h new file mode 100644 index 0000000..bcbf127 --- /dev/null +++ b/GUI/inc/SGUI_FlashData.h @@ -0,0 +1,23 @@ +#ifndef _INCLUDED_SGUI_FLASHDATA_H_ +#define _INCLUDED_SGUI_FLASHDATA_H_ +//=======================================================================// +//= Include files. =// +//=======================================================================// +#include "SGUI_Typedef.h" + +//=======================================================================// +//= Public function declaration. =// +//=======================================================================// +SGUI_SIZE SGUI_FlashData_GetFilash(SGUI_IF_OBJ* pstIFObj, SGUI_FLASH_DATA_SOURCE eDataSource, SGUI_ROM_ADDRESS adStartAddr, SGUI_SIZE sReadSize, SGUI_BYTE* pOutputBuffer); + +//=======================================================================// +//= Public variable declaration. =// +//=======================================================================// +//#if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) +extern SGUI_CBYTE SGUI_FONT_H8[]; +extern SGUI_CBYTE SGUI_FONT_H12[]; +extern SGUI_CBYTE SGUI_FONT_H16[]; +extern SGUI_CBYTE SGUI_FONT_H32[]; +//#endif + +#endif // _INCLUDED_SGUI_FLASHDATA_H_ diff --git a/GUI/inc/SGUI_Frame.h b/GUI/inc/SGUI_Frame.h index 5ff3102..e5f4484 100644 --- a/GUI/inc/SGUI_Frame.h +++ b/GUI/inc/SGUI_Frame.h @@ -30,6 +30,6 @@ typedef struct //=======================================================================// //= Public function declaration. =// //=======================================================================// -void SGUI_Frame_DrawFullScreenFrame(SGUI_BOX_FRAME_STRUCT* pstFrameStyleData); +void SGUI_Frame_DrawFullScreenFrame(SGUI_IF_OBJ* pstIFObj, SGUI_BOX_FRAME_STRUCT* pstFrameStyleData); #endif // __INCLUDE_GUI_FRAME_H__ diff --git a/GUI/inc/SGUI_Graph.h b/GUI/inc/SGUI_Graph.h index 1cc5cbb..39da618 100644 --- a/GUI/inc/SGUI_Graph.h +++ b/GUI/inc/SGUI_Graph.h @@ -62,5 +62,5 @@ typedef struct //= Public function declaration. =// //=======================================================================// void SGUI_Graph_InitializeGraphData(SGUI_GRAPH* pstGraph, SGUI_GRAPH_INIT_DATA* pstInitializeData); -void SGUI_Graph_Refresh(SGUI_GRAPH* pstGraph); +void SGUI_Graph_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_GRAPH* pstGraph); #endif // __INCLUDE_GUI_GRAPH_H__ diff --git a/GUI/inc/SGUI_List.h b/GUI/inc/SGUI_List.h index f30bc94..e72361b 100644 --- a/GUI/inc/SGUI_List.h +++ b/GUI/inc/SGUI_List.h @@ -80,10 +80,10 @@ typedef struct //= Public function declaration. =// //=======================================================================// void SGUI_List_InitializeListData(SGUI_List_STRUCT* pstList); -void SGUI_List_Refresh(SGUI_List_STRUCT* pstList); -void SGUI_List_SelectUpItem(SGUI_List_STRUCT* pstList); -void SGUI_List_SelectDownItem(SGUI_List_STRUCT* pstList); -void SGUI_List_SetListItemValue(SGUI_List_STRUCT* pstList, SGUI_INDEX iItemIndex, SGUI_INT32 iSetValid, SGUI_INT32 iSetDecimal); +void SGUI_List_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList); +void SGUI_List_SelectUpItem(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList); +void SGUI_List_SelectDownItem(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList); +void SGUI_List_SetListItemValue(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList, SGUI_INDEX iItemIndex, SGUI_INT32 iSetValid, SGUI_INT32 iSetDecimal); void SGUI_List_GetListItemValue(SGUI_List_STRUCT* pstList, SGUI_INDEX iItemIndex, SGUI_INT32 *piValid, SGUI_INT32 *piDecimal); SGUI_List_ITEM* SGUI_List_GetListItemPtr(SGUI_List_STRUCT* pstList, SGUI_INDEX iItemIndex); void SGUI_List_BindData(SGUI_List_STRUCT* pstList, SGUI_INDEX iItemIndex, SGUI_INT32* piValid, SGUI_INT32* piDecimal); diff --git a/GUI/inc/SGUI_Notice.h b/GUI/inc/SGUI_Notice.h index 4377957..9cc11e2 100644 --- a/GUI/inc/SGUI_Notice.h +++ b/GUI/inc/SGUI_Notice.h @@ -6,6 +6,11 @@ #include "SGUI_Common.h" #include "SGUI_Basic.h" +//=======================================================================// +//= User Macro definition. =// +//=======================================================================// +//#define NOTICE_ICON_SIZE (24) + //=======================================================================// //= Data type definition. =// //=======================================================================// @@ -21,6 +26,6 @@ typedef enum //=======================================================================// //= Public function declaration. =// //=======================================================================// -SGUI_SIZE SGUI_Notice_Refresh(SGUI_PCSZSTR szNoticeText, SGUI_INT uiTextOffset, SGUI_NOTICE_ICON eIcon); +SGUI_SIZE SGUI_Notice_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_PCSZSTR szNoticeText, SGUI_INT uiTextOffset, SGUI_NOTICE_ICON eIcon); #endif // __INCLUDE_GUI_NOTICE_H__ diff --git a/GUI/inc/SGUI_ProcessBar.h b/GUI/inc/SGUI_ProcessBar.h index 858c1a4..8bb1904 100644 --- a/GUI/inc/SGUI_ProcessBar.h +++ b/GUI/inc/SGUI_ProcessBar.h @@ -41,6 +41,6 @@ typedef struct //=======================================================================// //= Public function declaration. =// //=======================================================================// -void SGUI_ProcessBar_Refresh(SGUI_PROCBAR_STRUCT *pProcessBarData); +void SGUI_ProcessBar_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_PROCBAR_STRUCT *pProcessBarData); #endif // __INCLUDE_GUI_PROCESSBAR_H__ diff --git a/GUI/inc/SGUI_RealtimeGraph.h b/GUI/inc/SGUI_RealtimeGraph.h index c1e19df..f0c18cc 100644 --- a/GUI/inc/SGUI_RealtimeGraph.h +++ b/GUI/inc/SGUI_RealtimeGraph.h @@ -37,6 +37,6 @@ typedef struct //= Public function declaration. =// //=======================================================================// void SGUI_RealtimeGraph_Initialize(SGUI_RTGRAPH* pstRTGraph); -void SGUI_RealtimeGraph_Refresh(SGUI_RTGRAPH* pstRTGraph, SGUI_PCSZSTR szTopText, SGUI_PCSZSTR szBottomText); +void SGUI_RealtimeGraph_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_RTGRAPH* pstRTGraph, SGUI_PCSZSTR szTopText, SGUI_PCSZSTR szBottomText); void SGUI_RealtimeGraph_AppendValue(SGUI_RTGRAPH* pstRTGraph, SGUI_INT iNewValue); #endif // __INCLUDE_GUI_REAL_GRAPH_H__ diff --git a/GUI/inc/SGUI_ScrollBar.h b/GUI/inc/SGUI_ScrollBar.h index e91cab9..ce749d4 100644 --- a/GUI/inc/SGUI_ScrollBar.h +++ b/GUI/inc/SGUI_ScrollBar.h @@ -38,6 +38,6 @@ typedef struct //=======================================================================// //= Public function declaration. =// //=======================================================================// -- -void SGUI_ScrollBar_Refresh(SGUI_SCROLLBAR_STRUCT* pstScrollBar); +void SGUI_ScrollBar_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_SCROLLBAR_STRUCT* pstScrollBar); #endif // __INCLUDE_GUI_SCROLLBAR_STRUCT__ diff --git a/GUI/inc/SGUI_Text.h b/GUI/inc/SGUI_Text.h index b06ea4c..939177f 100644 --- a/GUI/inc/SGUI_Text.h +++ b/GUI/inc/SGUI_Text.h @@ -54,8 +54,8 @@ extern const SGUI_FONT_SIZE_STRUCT g_stFontSize[]; //=======================================================================// //= Public function declaration. =// //=======================================================================// -void SGUI_Text_DrawSingleLineText(SGUI_PCSZSTR szTextBuffer, SGUI_FONT_SIZE eFontSize, SGUI_RECT_AREA* pstDisplayArea, SGUI_RECT_AREA* pstStringDataArea, SGUI_DRAW_MODE eFontMode); -SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_PCSZSTR szTextBuffer, SGUI_FONT_SIZE eFontSize, SGUI_RECT_AREA* pstDisplayArea, SGUI_INT iTopOffset, SGUI_DRAW_MODE eFontMode); +void SGUI_Text_DrawSingleLineText(SGUI_IF_OBJ* pstIFObj, SGUI_PCSZSTR szTextBuffer, SGUI_FONT_SIZE eFontSize, SGUI_RECT_AREA* pstDisplayArea, SGUI_RECT_AREA* pstStringDataArea, SGUI_DRAW_MODE eFontMode); +SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_IF_OBJ* pstIFObj, SGUI_PCSZSTR szTextBuffer, SGUI_FONT_SIZE eFontSize, SGUI_RECT_AREA* pstDisplayArea, SGUI_INT iTopOffset, SGUI_DRAW_MODE eFontMode); SGUI_SIZE SGUI_Text_GetTextGraphicsWidth(SGUI_PCSZSTR szText, SGUI_FONT_SIZE eFontSize); SGUI_SIZE SGUI_Text_GetMultiLineTextLines(SGUI_PCSZSTR szNoticeText, SGUI_SIZE uiHalfWidthCharInLine); diff --git a/GUI/inc/SGUI_Typedef.h b/GUI/inc/SGUI_Typedef.h index 18c87cc..68fdadf 100644 --- a/GUI/inc/SGUI_Typedef.h +++ b/GUI/inc/SGUI_Typedef.h @@ -5,6 +5,21 @@ //=======================================================================// #include "stdint.h" #include "stddef.h" +#include + +//=======================================================================// +//= User Macro definition. =// +//=======================================================================// +#define RECTANGLE_X_START(ST) ((ST).PosX) +#define RECTANGLE_X_END(ST) (((ST).PosX + (ST).Width - 1)) +#define RECTANGLE_Y_START(ST) ((ST).PosY) +#define RECTANGLE_Y_END(ST) (((ST).PosY + (ST).Height - 1)) +#define RECTANGLE_WIDTH(ST) ((ST).Width) +#define RECTANGLE_HEIGHT(ST) ((ST).Height) +#define RECTANGLE_VALID_WIDTH(ST) ((RECTANGLE_X_START(ST)>0)?RECTANGLE_WIDTH(ST):(RECTANGLE_WIDTH(ST)+RECTANGLE_X_START(ST))) +#define RECTANGLE_VALID_HEIGHT(ST) ((RECTANGLE_Y_START(ST)>0)?RECTANGLE_HEIGHT(ST):(RECTANGLE_HEIGHT(ST)+RECTANGLE_Y_START(ST))) + +#define SGUI_ENGINE_ACTION_DEF(R, FN, PARAM) typedef R(*FN)PARAM //=======================================================================// //= Data type definition. =// @@ -37,29 +52,93 @@ typedef SGUI_UINT32 SGUI_ROM_ADDRESS; typedef struct _st_rectangle_ { - SGUI_INT PosX; - SGUI_INT PosY; - SGUI_INT Width; - SGUI_INT Height; + SGUI_INT PosX; + SGUI_INT PosY; + SGUI_INT Width; + SGUI_INT Height; }SGUI_RECT_AREA; typedef struct { - SGUI_UINT16 Year; - SGUI_UINT16 Month; - SGUI_UINT16 Day; - SGUI_UINT16 Hour; - SGUI_UINT16 Minute; - SGUI_UINT16 Second; + SGUI_UINT16 Year; + SGUI_UINT16 Month; + SGUI_UINT16 Day; + SGUI_UINT16 Hour; + SGUI_UINT16 Minute; + SGUI_UINT16 Second; }SGUI_TIME; -#define RECTANGLE_X_START(ST) ((ST).PosX) -#define RECTANGLE_X_END(ST) (((ST).PosX + (ST).Width - 1)) -#define RECTANGLE_Y_START(ST) ((ST).PosY) -#define RECTANGLE_Y_END(ST) (((ST).PosY + (ST).Height - 1)) -#define RECTANGLE_WIDTH(ST) ((ST).Width) -#define RECTANGLE_HEIGHT(ST) ((ST).Height) -#define RECTANGLE_VALID_WIDTH(ST) ((RECTANGLE_X_START(ST)>0)?RECTANGLE_WIDTH(ST):(RECTANGLE_WIDTH(ST)+RECTANGLE_X_START(ST))) -#define RECTANGLE_VALID_HEIGHT(ST) ((RECTANGLE_Y_START(ST)>0)?RECTANGLE_HEIGHT(ST):(RECTANGLE_HEIGHT(ST)+RECTANGLE_Y_START(ST))) +typedef enum +{ + SGUI_COLOR_BKGCLR = 0, + SGUI_COLOR_FRGCLR = 1, + SGUI_COLOR_TRANS = 2, +}SGUI_COLOR; + +typedef enum +{ + SGUI_DRAW_NORMAL = 0, + SGUI_DRAW_REVERSE = 1, +}SGUI_DRAW_MODE; + +// Declare data source flag here. +typedef enum +{ + SGUI_FONT_SRC_NONE = 0, + SGUI_FONT_SRC_H6, + SGUI_FONT_SRC_H8, + SGUI_FONT_SRC_H12, + SGUI_FONT_SRC_H16, + //SGUI_FONT_SRC_H24, + SGUI_FONT_SRC_H32, + + SGUI_NOTICE_ICON_16PIX, + SGUI_NOTICE_ICON_24PIX, + SGUI_FONT_SRC_UNKNOWN, +}SGUI_FLASH_DATA_SOURCE; + +typedef struct +{ + SGUI_FLASH_DATA_SOURCE Source; + SGUI_ROM_ADDRESS StartAddr; + SGUI_SIZE Length; +}SGUI_BMP_DATA; + + +// Declare SimpleGUI Object type +typedef struct +{ + SGUI_BOOL bFullACSII; +}SGUI_ENGINE_PARRAM; + +SGUI_ENGINE_ACTION_DEF(SGUI_INT, SGUI_ENGINE_ACTION_FN_INITIALIZE, (void)); +SGUI_ENGINE_ACTION_DEF(void, SGUI_ENGINE_ACTION_FN_CLEAR, (void)); +SGUI_ENGINE_ACTION_DEF(void, SGUI_ENGINE_ACTION_FN_SET_POINT, (SGUI_INT iX, SGUI_INT iY, SGUI_INT iColor)); +SGUI_ENGINE_ACTION_DEF(SGUI_INT, SGUI_ENGINE_ACTION_FN_GET_POINT, (SGUI_INT iX, SGUI_INT iY)); +SGUI_ENGINE_ACTION_DEF(SGUI_INT, SGUI_ENGINE_ACTION_FN_SET_BYTE, (SGUI_INT iPage, SGUI_INT iColumn)); +SGUI_ENGINE_ACTION_DEF(SGUI_INT, SGUI_ENGINE_ACTION_FN_GET_BYTE, (SGUI_INT iPage, SGUI_INT iColumn)); +SGUI_ENGINE_ACTION_DEF(void, SGUI_ENGINE_ACTION_FN_REFRESH, (void)); + +typedef struct +{ + //Engine & device initialize function. + SGUI_ENGINE_ACTION_FN_INITIALIZE fnInitialize; + //Clear screen function. + SGUI_ENGINE_ACTION_FN_CLEAR fnClearScreen; + //Set pixel value function. + SGUI_ENGINE_ACTION_FN_SET_POINT fnSetPixel; + //Get pixel value function. + SGUI_ENGINE_ACTION_FN_GET_POINT fnGetPixel; + // Refresh screen display. + SGUI_ENGINE_ACTION_FN_REFRESH fnRefreshScreen; +}SGUI_ENGINE_ACTIONS; + +typedef struct +{ + //Simple GUI engine parameter. + SGUI_ENGINE_PARRAM stParam; + //Simple GUI extern functions. + SGUI_ENGINE_ACTIONS stActions; +}SGUI_IF_OBJ; #endif // __INCLUDE_GUI_TYPEDEF_H__ diff --git a/GUI/inc/SGUI_VariableBox.h b/GUI/inc/SGUI_VariableBox.h index e8dc96a..8bd2a96 100644 --- a/GUI/inc/SGUI_VariableBox.h +++ b/GUI/inc/SGUI_VariableBox.h @@ -78,9 +78,9 @@ typedef enum //=======================================================================// //= Public function declaration. =// //=======================================================================// -void SGUI_IntegerVariableBox_Refresh(SGUI_INT_VARBOX_STRUCT* pstValue, SGUI_VARBOX_ALIG eAlignment, SGUI_DRAW_MODE eMode); -void SGUI_TextVariableBox_Refresh(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DRAW_MODE eMode); -void SGUI_TextVariableBox_ChangeCharacter(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DRAW_MODE eMode, SGUI_UINT uiCharacterSet, SGUI_TEXT_VARBOX_OPT eOpt); +void SGUI_IntegerVariableBox_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_INT_VARBOX_STRUCT* pstValue, SGUI_VARBOX_ALIG eAlignment, SGUI_DRAW_MODE eMode); +void SGUI_TextVariableBox_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DRAW_MODE eMode); +void SGUI_TextVariableBox_ChangeCharacter(SGUI_IF_OBJ* pstIFObj, SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DRAW_MODE eMode, SGUI_UINT uiCharacterSet, SGUI_TEXT_VARBOX_OPT eOpt); diff --git a/GUI/src/SGUI_Basic.c b/GUI/src/SGUI_Basic.c index eb2abab..0d22640 100644 --- a/GUI/src/SGUI_Basic.c +++ b/GUI/src/SGUI_Basic.c @@ -10,6 +10,7 @@ //= Include files. =// //=======================================================================// #include "SGUI_Basic.h" +#include "SGUI_FlashData.h" //=======================================================================// //= User Macro definition. =// @@ -18,7 +19,6 @@ #define SGUI_MIN_VAL(A, B) (((A)>(B)?(B):(A))) #define SGUI_MAX_VAL(A, B) (((A)<(B)?(B):(A))) - //=======================================================================// //= Static variable declaration. =// //=======================================================================// @@ -158,37 +158,32 @@ static SGUI_BYTE auiBitmapDataBuffer[BMP_DATA_BUFFER_SIZE] = {0x00}; /** Function Name: SGUI_Basic_DrawPoint **/ /** Purpose: Set a pixel color or draw a point. **/ /** Params: **/ -/** @uiCoordinateX[in]: X coordinate of point by pixels. **/ -/** @uiCoordinateY[in]: Y coordinate of point by pixels. **/ -/** @eColor[in]: Point color, GUI_COLOR_BKGCLR means clear pix, **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ uiCoordinateX[in]: X coordinate of point by pixels. **/ +/** @ uiCoordinateY[in]: Y coordinate of point by pixels. **/ +/** @ eColor[in]: Point color, GUI_COLOR_BKGCLR means clear pix, **/ /** GUI_COLOR_FRGCLR means set pix. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_Basic_DrawPoint(SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY, SGUI_COLOR eColor) +void SGUI_Basic_DrawPoint(SGUI_IF_OBJ* pstIFObj, SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY, SGUI_COLOR eColor) { /*----------------------------------*/ /* Process */ /*----------------------------------*/ - if((uiCoordinateX < LCD_SIZE_WIDTH) && (uiCoordinateY < LCD_SIZE_HEIGHT)) + if((uiCoordinateX < LCD_SIZE_WIDTH) && (uiCoordinateY < LCD_SIZE_HEIGHT) && (NULL != pstIFObj)) { - if(SGUI_COLOR_FRGCLR == eColor) + if(NULL == pstIFObj->stActions.fnSetPixel) + { + /* Action function is unspecified, no actions. */ + } + else if(SGUI_COLOR_FRGCLR == eColor) { -#if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) - VDIF_SetPixel(uiCoordinateX, uiCoordinateY, 1); -#else - // Call draw pix interface here. - OLED_SetPixel(uiCoordinateX, uiCoordinateY, OLED_COLOR_FRG); -#endif //_SIMPLE_GUI_ENABLE_SIMULATOR_ + pstIFObj->stActions.fnSetPixel(uiCoordinateX, uiCoordinateY, 1); } else if(SGUI_COLOR_BKGCLR == eColor) { -#if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) - VDIF_SetPixel(uiCoordinateX, uiCoordinateY, 0); -#else - // Call draw pix interface here. - OLED_SetPixel(uiCoordinateX, uiCoordinateY, OLED_COLOR_BKG); -#endif //_SIMPLE_GUI_ENABLE_SIMULATOR_ + pstIFObj->stActions.fnSetPixel(uiCoordinateX, uiCoordinateY, 0); } } } @@ -197,12 +192,13 @@ void SGUI_Basic_DrawPoint(SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY, SGUI /** Function Name: SGUI_Basic_GetPoint **/ /** Purpose: Get a pixel color . **/ /** Params: **/ -/** @uiCoordinateX[in]: X coordinate of point by pixels. **/ -/** @uiCoordinateY[in]: Y coordinate of point by pixels. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ uiCoordinateX[in]: X coordinate of point by pixels. **/ +/** @ uiCoordinateY[in]: Y coordinate of point by pixels. **/ /** Return: SGUI_COLOR type enumerated for point color. **/ /** Notice: None. **/ /*************************************************************************/ -SGUI_COLOR SGUI_Basic_GetPoint(SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY) +SGUI_COLOR SGUI_Basic_GetPoint(SGUI_IF_OBJ* pstIFObj, SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY) { /*----------------------------------*/ /* Variable Declaration */ @@ -219,22 +215,24 @@ SGUI_COLOR SGUI_Basic_GetPoint(SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY) /*----------------------------------*/ /* Process */ /*----------------------------------*/ - if((uiCoordinateX < LCD_SIZE_WIDTH) && (uiCoordinateY < LCD_SIZE_HEIGHT)) + if((uiCoordinateX < LCD_SIZE_WIDTH) && (uiCoordinateY < LCD_SIZE_HEIGHT)&& (NULL != pstIFObj)) { -#if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) - uiPixValue = VDIF_GetPixel(uiCoordinateX, uiCoordinateY); -#else - // Call read pix interface here. - uiPixValue = OLED_GetPixel(uiCoordinateX, uiCoordinateY); -#endif //_SIMPLE_GUI_ENABLE_SIMULATOR_ - if(0 == uiPixValue) - { - eColor = SGUI_COLOR_BKGCLR; - } - else - { - eColor = SGUI_COLOR_FRGCLR; - } + if(NULL == pstIFObj->stActions.fnSetPixel) + { + /* Action function is unspecified, no actions. */ + } + else + { + uiPixValue = pstIFObj->stActions.fnGetPixel(uiCoordinateX, uiCoordinateY); + if(0 == uiPixValue) + { + eColor = SGUI_COLOR_BKGCLR; + } + else + { + eColor = SGUI_COLOR_FRGCLR; + } + } } return eColor; @@ -243,36 +241,46 @@ SGUI_COLOR SGUI_Basic_GetPoint(SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY) /*************************************************************************/ /** Function Name: SGUI_Basic_ClearScreen **/ /** Purpose: Clean LCD screen display. **/ -/** Params: None. **/ +/** Params: **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_Basic_ClearScreen(void) +void SGUI_Basic_ClearScreen(SGUI_IF_OBJ* pstIFObj) { /*----------------------------------*/ /* Process */ /*----------------------------------*/ -#if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) - VDIF_ClearDisplay(); -#else - // Call clear screen function here; - OLED_ClearDisplay(); -#endif //_SIMPLE_GUI_ENABLE_SIMULATOR_ + if(NULL != pstIFObj) + { + /* Clear screen. */ + if((NULL != pstIFObj->stActions.fnClearScreen) && (NULL != pstIFObj->stActions.fnRefreshScreen)) + { + pstIFObj->stActions.fnClearScreen(); + pstIFObj->stActions.fnRefreshScreen(); + } + else + { + SGUI_Basic_DrawRectangle(pstIFObj, 0, 0, LCD_SIZE_HEIGHT, LCD_SIZE_HEIGHT, SGUI_COLOR_BKGCLR, SGUI_COLOR_BKGCLR); + SGUI_Basic_RefreshDisplay(pstIFObj); + } + } } /*************************************************************************/ /** Function Name: SGUI_Basic_DrawLine **/ /** Purpose: Draw a line by the Bresenham algorithm. **/ /** Params: **/ -/** @uiStartX[in]: X coordinate of start point of line. **/ -/** @uiStartY[in]: Y coordinate of start point of line. **/ -/** @uiEndX[in]: X coordinate of end point of line. **/ -/** @uiEndY[in]: Y coordinate of end point of line. **/ -/** @eColor[in]: Line color. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ uiStartX[in]: X coordinate of start point of line. **/ +/** @ uiStartY[in]: Y coordinate of start point of line. **/ +/** @ uiEndX[in]: X coordinate of end point of line. **/ +/** @ uiEndY[in]: Y coordinate of end point of line. **/ +/** @ eColor[in]: Line color. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_Basic_DrawLine(SGUI_INT uiStartX, SGUI_INT uiStartY, SGUI_INT uiEndX, SGUI_INT uiEndY, SGUI_COLOR eColor) +void SGUI_Basic_DrawLine(SGUI_IF_OBJ* pstIFObj, SGUI_INT uiStartX, SGUI_INT uiStartY, SGUI_INT uiEndX, SGUI_INT uiEndY, SGUI_COLOR eColor) { /*----------------------------------*/ /* Variable Declaration */ @@ -341,7 +349,7 @@ void SGUI_Basic_DrawLine(SGUI_INT uiStartX, SGUI_INT uiStartY, SGUI_INT uiEndX, /*----------------------------------*/ for(i = 0; i <= uiDs+1; i++) { - SGUI_Basic_DrawPoint(uiCurrentPosX,uiCurrentPosY, eColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCurrentPosX,uiCurrentPosY, eColor); iErrX += iDx; if(iErrX > uiDs) { @@ -361,16 +369,17 @@ void SGUI_Basic_DrawLine(SGUI_INT uiStartX, SGUI_INT uiStartY, SGUI_INT uiEndX, /** Function Name: SGUI_Basic_DrawRectangle **/ /** Purpose: Draw a rectangle on screen. **/ /** Params: **/ -/** @uiStartX[in]: X coordinate of the upper-left corner. **/ -/** @uiStartY[in]: Y coordinate of the upper-left corner. **/ -/** @uiWidth[in]: . Width of rectangle. **/ -/** @uiHeight[in]: Height of rectangle. **/ -/** @eEdgeColor[in]: Edge color. **/ -/** @eFillColor[in]: Fill color. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ uiStartX[in]: X coordinate of the upper-left corner. **/ +/** @ uiStartY[in]: Y coordinate of the upper-left corner. **/ +/** @ uiWidth[in]: . Width of rectangle. **/ +/** @ uiHeight[in]: Height of rectangle. **/ +/** @ eEdgeColor[in]: Edge color. **/ +/** @ eFillColor[in]: Fill color. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_Basic_DrawRectangle(SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor) +void SGUI_Basic_DrawRectangle(SGUI_IF_OBJ* pstIFObj, SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor) { /*----------------------------------*/ /* Variable Declaration */ @@ -384,30 +393,30 @@ void SGUI_Basic_DrawRectangle(SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT { if((uiWidth == 1) && (uiHeight == 1)) { - SGUI_Basic_DrawPoint(uiStartX, uiStartY, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiStartX, uiStartY, eEdgeColor); } else if(uiWidth == 1) { - SGUI_Basic_DrawLine(uiStartX, uiStartY, uiStartX, uiStartY+uiHeight-1, eEdgeColor); + SGUI_Basic_DrawLine(pstIFObj, uiStartX, uiStartY, uiStartX, uiStartY+uiHeight-1, eEdgeColor); } else if(uiHeight == 1) { - SGUI_Basic_DrawLine(uiStartX, uiStartY, uiStartX+uiWidth-1, uiStartY, eEdgeColor); + SGUI_Basic_DrawLine(pstIFObj, uiStartX, uiStartY, uiStartX+uiWidth-1, uiStartY, eEdgeColor); } else { // Draw edge. // Check and set changed page and column index is in edge display action. - SGUI_Basic_DrawLine(uiStartX, uiStartY, uiStartX, uiStartY+uiHeight-1, eEdgeColor); - SGUI_Basic_DrawLine(uiStartX+uiWidth-1, uiStartY, uiStartX+uiWidth-1, uiStartY+uiHeight-1, eEdgeColor); - SGUI_Basic_DrawLine(uiStartX, uiStartY, uiStartX+uiWidth-1, uiStartY, eEdgeColor); - SGUI_Basic_DrawLine(uiStartX, uiStartY+uiHeight-1, uiStartX+uiWidth-1, uiStartY+uiHeight-1, eEdgeColor); + SGUI_Basic_DrawLine(pstIFObj, uiStartX, uiStartY, uiStartX, uiStartY+uiHeight-1, eEdgeColor); + SGUI_Basic_DrawLine(pstIFObj, uiStartX+uiWidth-1, uiStartY, uiStartX+uiWidth-1, uiStartY+uiHeight-1, eEdgeColor); + SGUI_Basic_DrawLine(pstIFObj, uiStartX, uiStartY, uiStartX+uiWidth-1, uiStartY, eEdgeColor); + SGUI_Basic_DrawLine(pstIFObj, uiStartX, uiStartY+uiHeight-1, uiStartX+uiWidth-1, uiStartY+uiHeight-1, eEdgeColor); // Fill area. if((eFillColor != SGUI_COLOR_TRANS) && (uiWidth > 2) && (uiHeight > 2)) { for(uiColumnIndex=(uiStartX+1); uiColumnIndex<(uiStartX+uiWidth-1); uiColumnIndex++) { - SGUI_Basic_DrawLine(uiColumnIndex, uiStartY+1, uiColumnIndex, uiStartY+uiHeight-2, eFillColor); + SGUI_Basic_DrawLine(pstIFObj, uiColumnIndex, uiStartY+1, uiColumnIndex, uiStartY+uiHeight-2, eFillColor); } } } @@ -418,15 +427,16 @@ void SGUI_Basic_DrawRectangle(SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT /** Function Name: SGUI_Basic_DrawCircle **/ /** Purpose: Draw a circle by center coordinate and radius. **/ /** Params: **/ -/** @uiCx[in]: Circle center X coordinate. **/ -/** @uiCy[in]: Circle center Y coordinate. **/ -/** @uiRadius[in]: Circle radius. **/ -/** @eEdgeColor[in]: Edge color. **/ -/** @eFillColor[in]: Fill color. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ uiCx[in]: Circle center X coordinate. **/ +/** @ uiCy[in]: Circle center Y coordinate. **/ +/** @ uiRadius[in]: Circle radius. **/ +/** @ eEdgeColor[in]: Edge color. **/ +/** @ eFillColor[in]: Fill color. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_Basic_DrawCircle(SGUI_UINT uiCx, SGUI_UINT uiCy, SGUI_UINT uiRadius, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor) +void SGUI_Basic_DrawCircle(SGUI_IF_OBJ* pstIFObj, SGUI_UINT uiCx, SGUI_UINT uiCy, SGUI_UINT uiRadius, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor) { /*----------------------------------*/ /* Variable Declaration */ @@ -451,7 +461,7 @@ void SGUI_Basic_DrawCircle(SGUI_UINT uiCx, SGUI_UINT uiCy, SGUI_UINT uiRadius, S /*----------------------------------*/ if(uiRadius < 1) { - SGUI_Basic_DrawPoint(uiCx, uiCy, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCx, uiCy, eEdgeColor); } else { @@ -463,23 +473,23 @@ void SGUI_Basic_DrawCircle(SGUI_UINT uiCx, SGUI_UINT uiCy, SGUI_UINT uiRadius, S if((uiRadius > 1) && (eFillColor != SGUI_COLOR_TRANS) && (uiPosXOffset_Old != uiPosXOffset)) { - SGUI_Basic_DrawLine(uiCx-uiPosXOffset, uiCy-uiPosYOffset+1, uiCx-uiPosXOffset, uiCy+uiPosYOffset-1, eFillColor); - SGUI_Basic_DrawLine(uiCx+uiPosXOffset, uiCy-uiPosYOffset+1, uiCx+uiPosXOffset, uiCy+uiPosYOffset-1, eFillColor); + SGUI_Basic_DrawLine(pstIFObj, uiCx-uiPosXOffset, uiCy-uiPosYOffset+1, uiCx-uiPosXOffset, uiCy+uiPosYOffset-1, eFillColor); + SGUI_Basic_DrawLine(pstIFObj, uiCx+uiPosXOffset, uiCy-uiPosYOffset+1, uiCx+uiPosXOffset, uiCy+uiPosYOffset-1, eFillColor); uiPosXOffset_Old = uiPosXOffset; } - SGUI_Basic_DrawLine(uiCx-uiPosYOffset, uiCy-uiPosXOffset+1, uiCx-uiPosYOffset, uiCy+uiPosXOffset-1, eFillColor); - SGUI_Basic_DrawLine(uiCx+uiPosYOffset, uiCy-uiPosXOffset+1, uiCx+uiPosYOffset, uiCy+uiPosXOffset-1, eFillColor); + SGUI_Basic_DrawLine(pstIFObj, uiCx-uiPosYOffset, uiCy-uiPosXOffset+1, uiCx-uiPosYOffset, uiCy+uiPosXOffset-1, eFillColor); + SGUI_Basic_DrawLine(pstIFObj, uiCx+uiPosYOffset, uiCy-uiPosXOffset+1, uiCx+uiPosYOffset, uiCy+uiPosXOffset-1, eFillColor); uiPosYOffset_Old = uiPosYOffset; // Draw edge. - SGUI_Basic_DrawPoint(uiCx+uiPosXOffset, uiCy+uiPosYOffset, eEdgeColor); - SGUI_Basic_DrawPoint(uiCx-uiPosXOffset, uiCy+uiPosYOffset, eEdgeColor); - SGUI_Basic_DrawPoint(uiCx-uiPosXOffset, uiCy-uiPosYOffset, eEdgeColor); - SGUI_Basic_DrawPoint(uiCx+uiPosXOffset, uiCy-uiPosYOffset, eEdgeColor); - SGUI_Basic_DrawPoint(uiCx+uiPosYOffset, uiCy+uiPosXOffset, eEdgeColor); - SGUI_Basic_DrawPoint(uiCx-uiPosYOffset, uiCy+uiPosXOffset, eEdgeColor); - SGUI_Basic_DrawPoint(uiCx-uiPosYOffset, uiCy-uiPosXOffset, eEdgeColor); - SGUI_Basic_DrawPoint(uiCx+uiPosYOffset, uiCy-uiPosXOffset, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCx+uiPosXOffset, uiCy+uiPosYOffset, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCx-uiPosXOffset, uiCy+uiPosYOffset, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCx-uiPosXOffset, uiCy-uiPosYOffset, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCx+uiPosXOffset, uiCy-uiPosYOffset, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCx+uiPosYOffset, uiCy+uiPosXOffset, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCx-uiPosYOffset, uiCy+uiPosXOffset, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCx-uiPosYOffset, uiCy-uiPosXOffset, eEdgeColor); + SGUI_Basic_DrawPoint(pstIFObj, uiCx+uiPosYOffset, uiCy-uiPosXOffset, eEdgeColor); } uiPosYOffset++; iRadiusError += iYChange; @@ -498,14 +508,15 @@ void SGUI_Basic_DrawCircle(SGUI_UINT uiCx, SGUI_UINT uiCy, SGUI_UINT uiRadius, S /** Function Name: SGUI_Basic_ReverseBlockColor **/ /** Purpose: Reverse all pixel color in a rectangle area. **/ /** Params: **/ -/** @uiStartX[in]: X coordinate of the upper-left corner. **/ -/** @uiStartY[in]: Y coordinate of the upper-left corner. **/ -/** @uiWidth[in]: . Width of rectangle. **/ -/** @uiHeight[in]: Height of rectangle. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ uiStartX[in]: X coordinate of the upper-left corner. **/ +/** @ uiStartY[in]: Y coordinate of the upper-left corner. **/ +/** @ uiWidth[in]: . Width of rectangle. **/ +/** @ uiHeight[in]: Height of rectangle. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_Basic_ReverseBlockColor(SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight) +void SGUI_Basic_ReverseBlockColor(SGUI_IF_OBJ* pstIFObj, SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight) { /*----------------------------------*/ /* Variable Declaration */ @@ -519,13 +530,13 @@ void SGUI_Basic_ReverseBlockColor(SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_U { for(i_H=0; i_HWidth * ((pstDataArea->Height-1)/8+1); // Read flash data. - SGUI_FlashData_GetFilash(eDataSource, adDataStartAddr, sBitmapDataSize, auiBitmapDataBuffer); + SGUI_FlashData_GetFilash(pstIFObj, eDataSource, adDataStartAddr, sBitmapDataSize, auiBitmapDataBuffer); // Set loop start parameter of x coordinate iDrawPixX = RECTANGLE_X_START(*pstDisplayArea); iBmpPixX = 0; @@ -628,11 +640,11 @@ void SGUI_Basic_DrawBitMap(SGUI_RECT_AREA* pstDisplayArea, SGUI_RECT_AREA* pstDa } if(SGUI_GET_PAGE_BIT(*pData, uiPixIndex) != eDrawMode) { - SGUI_Basic_DrawPoint(iDrawPixX, iDrawPixY, SGUI_COLOR_FRGCLR); + SGUI_Basic_DrawPoint(pstIFObj, iDrawPixX, iDrawPixY, SGUI_COLOR_FRGCLR); } else { - SGUI_Basic_DrawPoint(iDrawPixX, iDrawPixY, SGUI_COLOR_BKGCLR); + SGUI_Basic_DrawPoint(pstIFObj, iDrawPixX, iDrawPixY, SGUI_COLOR_BKGCLR); } uiDrawnHeightIndex ++; uiPixIndex ++; @@ -650,19 +662,18 @@ void SGUI_Basic_DrawBitMap(SGUI_RECT_AREA* pstDisplayArea, SGUI_RECT_AREA* pstDa /*************************************************************************/ /** Function Name: SGUI_Basic_RefreshDisplay **/ /** Purpose: Sync display buffer to screen. **/ -/** Params: None. **/ +/** Params: **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_Basic_RefreshDisplay(void) +void SGUI_Basic_RefreshDisplay(SGUI_IF_OBJ* pstIFObj) { /*----------------------------------*/ /* Process */ /*----------------------------------*/ -#if (_SIMPLE_GUI_VIRTUAL_ENVIRONMENT_SIMULATOR_ > 0) - VDIF_RefreshDisplay(); -#else - // Call clear screen function here; - OLED_RefreshScreen(); -#endif //_SIMPLE_GUI_ENABLE_SIMULATOR_ + if(NULL != pstIFObj) + { + pstIFObj->stActions.fnRefreshScreen(); + } } diff --git a/GUI/src/SGUI_FlashData.c b/GUI/src/SGUI_FlashData.c index d62e091..42ad984 100644 --- a/GUI/src/SGUI_FlashData.c +++ b/GUI/src/SGUI_FlashData.c @@ -9,6 +9,7 @@ //= Include files. =// //=======================================================================// #include "SGUI_Common.h" +#include "SGUI_FlashData.h" //======================================================================// //= 8 Pix font library. // @@ -16607,6 +16608,7 @@ static const uint8_t SGUI_NOTICE_ICON_DATA[] = { /** Function Name: SGUI_FlashData_GetFilash **/ /** Purpose: Read a byte array form ROM(ex. flash). **/ /** Params: **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ /** @ eDataSource[in]: Data source. **/ /** @ adStartAddr[in]: Read data array start address in source. **/ /** @ sReadSize[in]: Number of data want to read. **/ @@ -16622,7 +16624,7 @@ static const uint8_t SGUI_NOTICE_ICON_DATA[] = { /** This function will be re-write when use in different **/ /** hardware PF. **/ /*****************************************************************************/ -SGUI_SIZE SGUI_FlashData_GetFilash(SGUI_FLASH_DATA_SOURCE eDataSource, SGUI_ROM_ADDRESS adStartAddr, SGUI_SIZE sReadSize, SGUI_BYTE* pOutputBuffer) +SGUI_SIZE SGUI_FlashData_GetFilash(SGUI_IF_OBJ* pstIFObj, SGUI_FLASH_DATA_SOURCE eDataSource, SGUI_ROM_ADDRESS adStartAddr, SGUI_SIZE sReadSize, SGUI_BYTE* pOutputBuffer) { /*----------------------------------*/ /* Variable Declaration */ @@ -16638,6 +16640,7 @@ SGUI_SIZE SGUI_FlashData_GetFilash(SGUI_FLASH_DATA_SOURCE eDataSource, SGUI_ROM_ adBaseAddr = adStartAddr; pOutPutDataPtr = pOutputBuffer; sReadBytes = 0; + pDataSource = NULL; /*----------------------------------*/ /* Process */ diff --git a/GUI/src/SGUI_Frame.c b/GUI/src/SGUI_Frame.c index 849a895..61cd981 100644 --- a/GUI/src/SGUI_Frame.c +++ b/GUI/src/SGUI_Frame.c @@ -22,7 +22,7 @@ /** Return: None. **/ /** Notice: none. **/ /*************************************************************************/ -void SGUI_Frame_DrawFullScreenFrame(SGUI_BOX_FRAME_STRUCT* pstFrameData) +void SGUI_Frame_DrawFullScreenFrame(SGUI_IF_OBJ* pstIFObj, SGUI_BOX_FRAME_STRUCT* pstFrameData) { /*----------------------------------*/ /* Variable Declaration */ @@ -54,7 +54,8 @@ void SGUI_Frame_DrawFullScreenFrame(SGUI_BOX_FRAME_STRUCT* pstFrameData) // Draw frame edge for(uiEdgeLayerIndex = 0; uiEdgeLayerIndexParameter.EdgeLayers; uiEdgeLayerIndex++) { - SGUI_Basic_DrawRectangle( uiEdgeRectanglePosX, uiEdgeRectanglePosY, + SGUI_Basic_DrawRectangle( pstIFObj, + uiEdgeRectanglePosX, uiEdgeRectanglePosY, uiEdgeRectangleWidth, uiEdgeRectangleHeight, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); uiEdgeRectanglePosX += 2; @@ -68,7 +69,7 @@ void SGUI_Frame_DrawFullScreenFrame(SGUI_BOX_FRAME_STRUCT* pstFrameData) { if(pstFrameData->Parameter.EdgeLayers > 0) { - SGUI_Basic_DrawLine((pstFrameData->Parameter.EdgeLayers*2-1), (pstFrameData->Parameter.EdgeLayers*2-1+uiTitleLineWidth), + SGUI_Basic_DrawLine(pstIFObj, (pstFrameData->Parameter.EdgeLayers*2-1), (pstFrameData->Parameter.EdgeLayers*2-1+uiTitleLineWidth), LCD_SIZE_WIDTH-pstFrameData->Parameter.EdgeLayers*2, (pstFrameData->Parameter.EdgeLayers*2-1+uiTitleLineWidth), SGUI_COLOR_FRGCLR); stTitleTextDisplayArea.PosX = pstFrameData->Parameter.EdgeLayers*2; @@ -78,7 +79,7 @@ void SGUI_Frame_DrawFullScreenFrame(SGUI_BOX_FRAME_STRUCT* pstFrameData) } else { - SGUI_Basic_DrawLine( 0, (pstFrameData->Parameter.EdgeLayers*2+uiTitleLineWidth), + SGUI_Basic_DrawLine( pstIFObj, 0, (pstFrameData->Parameter.EdgeLayers*2+uiTitleLineWidth), LCD_SIZE_WIDTH-1, (pstFrameData->Parameter.EdgeLayers*2+uiTitleLineWidth), SGUI_COLOR_FRGCLR); stTitleTextDisplayArea.PosX = 1; @@ -86,7 +87,7 @@ void SGUI_Frame_DrawFullScreenFrame(SGUI_BOX_FRAME_STRUCT* pstFrameData) stTitleTextDisplayArea.Width = LCD_SIZE_WIDTH-2; stTitleTextDisplayArea.Height = g_stFontSize[pstFrameData->Parameter.FontSize].Height; } - SGUI_Text_DrawSingleLineText( pstFrameData->Data.Title, pstFrameData->Parameter.FontSize, + SGUI_Text_DrawSingleLineText(pstIFObj, pstFrameData->Data.Title, pstFrameData->Parameter.FontSize, &stTitleTextDisplayArea, &stTitleTextDataArea, SGUI_DRAW_NORMAL); } } diff --git a/GUI/src/SGUI_Graph.c b/GUI/src/SGUI_Graph.c index b438fbe..0d7131e 100644 --- a/GUI/src/SGUI_Graph.c +++ b/GUI/src/SGUI_Graph.c @@ -22,7 +22,7 @@ //=======================================================================// //= Static function declaration. =// //=======================================================================// -static void SGUI_Graph_DrawLine(SGUI_GRAPH* pstGraph, SGUI_UINT32 uiStartPointIndex, SGUI_UINT32 uiEndPointIndex); +static void SGUI_Graph_DrawLine(SGUI_IF_OBJ* pstIFObj, SGUI_GRAPH* pstGraph, SGUI_UINT32 uiStartPointIndex, SGUI_UINT32 uiEndPointIndex); static void SGUI_Praph_GetPointDrawingCoordinate(SGUI_GRAPH_POINT* pstDataPoint, SGUI_GRAPH_CONTROL* pstControlData, SGUI_GRAPH_POINT* pstDrawingPoint); //=======================================================================// @@ -96,7 +96,7 @@ void SGUI_Graph_InitializeGraphData(SGUI_GRAPH* pstGraph, SGUI_GRAPH_INIT_DATA* /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_Graph_Refresh(SGUI_GRAPH* pstGraph) +void SGUI_Graph_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_GRAPH* pstGraph) { /*----------------------------------*/ /* Variable Declaration */ @@ -114,16 +114,16 @@ void SGUI_Graph_Refresh(SGUI_GRAPH* pstGraph) /*----------------------------------*/ /* Process */ /*----------------------------------*/ - SGUI_Frame_DrawFullScreenFrame(&stFrameData); + SGUI_Frame_DrawFullScreenFrame(pstIFObj, &stFrameData); //SGUI_Basic_DrawRectangle(0, 0, LCD_SIZE_WIDTH, LCD_SIZE_HEIGHT, GUI_COLOR_BKGCLR, GUI_COLOR_BKGCLR); - SGUI_ScrollBar_Refresh(&(pstGraph->SubElement.xScrollBar)); - SGUI_ScrollBar_Refresh(&(pstGraph->SubElement.yScrollBar)); + SGUI_ScrollBar_Refresh(pstIFObj, &(pstGraph->SubElement.xScrollBar)); + SGUI_ScrollBar_Refresh(pstIFObj, &(pstGraph->SubElement.yScrollBar)); if(pstGraph->Data->Count > 1) { for(uiPointIndex=0; uiPointIndex<(pstGraph->Data->Count-1); uiPointIndex++) { - SGUI_Graph_DrawLine(pstGraph, uiPointIndex, uiPointIndex+1); + SGUI_Graph_DrawLine(pstIFObj, pstGraph, uiPointIndex, uiPointIndex+1); } } } @@ -139,7 +139,7 @@ void SGUI_Graph_Refresh(SGUI_GRAPH* pstGraph) /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_Graph_DrawLine(SGUI_GRAPH* pstGraph, SGUI_UINT32 uiStartPointIndex, SGUI_UINT32 uiEndPointIndex) +void SGUI_Graph_DrawLine(SGUI_IF_OBJ* pstIFObj, SGUI_GRAPH* pstGraph, SGUI_UINT32 uiStartPointIndex, SGUI_UINT32 uiEndPointIndex) { /*----------------------------------*/ /* Variable Declaration */ @@ -163,7 +163,7 @@ void SGUI_Graph_DrawLine(SGUI_GRAPH* pstGraph, SGUI_UINT32 uiStartPointIndex, SG SGUI_Praph_GetPointDrawingCoordinate(pstEndPoint, pstGraph->Control, &stGEndPoint); // End point. - SGUI_Basic_DrawLine(stGStartPoint.x, stGStartPoint.y, stGEndPoint.x, stGEndPoint.y, SGUI_COLOR_FRGCLR); + SGUI_Basic_DrawLine(pstIFObj, stGStartPoint.x, stGStartPoint.y, stGEndPoint.x, stGEndPoint.y, SGUI_COLOR_FRGCLR); } } diff --git a/GUI/src/SGUI_List.c b/GUI/src/SGUI_List.c index a56e10b..d742b7d 100644 --- a/GUI/src/SGUI_List.c +++ b/GUI/src/SGUI_List.c @@ -42,8 +42,8 @@ //=======================================================================// //= Static function declaration. =// //=======================================================================// -static SGUI_INLINE void SGUI_List_RefreshListItems(SGUI_List_STRUCT* pstList); -static SGUI_INLINE void SGUI_List_DrawItem(SGUI_List_STRUCT* pstList, SGUI_SIZE uiIndex); +static SGUI_INLINE void SGUI_List_RefreshListItems(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList); +static SGUI_INLINE void SGUI_List_DrawItem(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList, SGUI_SIZE uiIndex); //=======================================================================// //= Function define. =// @@ -109,11 +109,12 @@ void SGUI_List_InitializeListData(SGUI_List_STRUCT* pstList) /** Function Name: SGUI_List_RefreshListItems **/ /** Purpose: Refresh all visible list item display. **/ /** Params: **/ -/** @pstList[in]: Pointer of list data will be refreshed. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ pstList[in]: Pointer of list data will be refreshed. **/ /** Return: None. **/ /** Notice: This only refresh visible items and scrollbar. **/ /*************************************************************************/ -void SGUI_List_RefreshListItems(SGUI_List_STRUCT* pstList) +void SGUI_List_RefreshListItems(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList) { /*----------------------------------*/ /* Variable Declaration */ @@ -152,17 +153,17 @@ void SGUI_List_RefreshListItems(SGUI_List_STRUCT* pstList) pstSubElement->ScrollBar.Parameter.MaxIndex = (pstListData->Count>pstListControl->VisibleIntegralItemsNum)?(pstListData->Count-pstListControl->VisibleIntegralItemsNum-1):0; #endif // Clear list item display area. - SGUI_Basic_DrawRectangle(LIST_ITEM_RECT_POSX, pstListControl->FirstVisibleItemPosY, LIST_ITEM_RECT_WIDTH, pstListControl->VisibleItemsAreaHeight, SGUI_COLOR_BKGCLR, SGUI_COLOR_BKGCLR); + SGUI_Basic_DrawRectangle(pstIFObj, LIST_ITEM_RECT_POSX, pstListControl->FirstVisibleItemPosY, LIST_ITEM_RECT_WIDTH, pstListControl->VisibleItemsAreaHeight, SGUI_COLOR_BKGCLR, SGUI_COLOR_BKGCLR); // Refresh scroll bar pstSubElement->ScrollBar.Data.Index = pstListControl->PageStartIndex; - SGUI_ScrollBar_Refresh(&(pstSubElement->ScrollBar)); + SGUI_ScrollBar_Refresh(pstIFObj, &(pstSubElement->ScrollBar)); // Draw all visible items. while((uiCurrentItemIndex < pstListControl->PageStartIndex+pstListControl->VisibleItemsNum) && (uiCurrentItemIndex < pstListData->Count)) { - SGUI_List_DrawItem(pstList, uiCurrentItemIndex++); + SGUI_List_DrawItem(pstIFObj, pstList, uiCurrentItemIndex++); } // High light focused items. - SGUI_Basic_ReverseBlockColor(LIST_ITEM_RECT_POSX, pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet, + SGUI_Basic_ReverseBlockColor(pstIFObj, LIST_ITEM_RECT_POSX, pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); } } @@ -172,12 +173,13 @@ void SGUI_List_RefreshListItems(SGUI_List_STRUCT* pstList) /** Function Name: SGUI_List_RefreshList **/ /** Purpose: Refresh list display. **/ /** Params: **/ -/** @pstList[in]: Pointer of list data will be refreshed. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ pstList[in]: Pointer of list data will be refreshed. **/ /** Return: None. **/ /** Notice: This function will refresh all list display on **/ /** screen, include edge, items, title and scrollbar. **/ /*************************************************************************/ -void SGUI_List_Refresh(SGUI_List_STRUCT* pstList) +void SGUI_List_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList) { /*----------------------------------*/ /* Variable Declaration */ @@ -195,9 +197,9 @@ void SGUI_List_Refresh(SGUI_List_STRUCT* pstList) stFrameData.Parameter.EdgeLayers = LIST_EDGE_MULTIPLE; stFrameData.Parameter.FontSize = pstList->FontSize; stFrameData.Data.Title = pstListData->Title; - SGUI_Frame_DrawFullScreenFrame(&stFrameData); + SGUI_Frame_DrawFullScreenFrame(pstIFObj, &stFrameData); // Draw list items - SGUI_List_RefreshListItems(pstList); + SGUI_List_RefreshListItems(pstIFObj, pstList); } } @@ -205,11 +207,12 @@ void SGUI_List_Refresh(SGUI_List_STRUCT* pstList) /** Function Name: SGUI_List_SelectUpItem **/ /** Purpose: Select previous list item if existed. **/ /** Params: **/ -/** @pstList[in]: Pointer of list will be selected. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ pstList[in]: Pointer of list will be selected. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_List_SelectUpItem(SGUI_List_STRUCT* pstList) +void SGUI_List_SelectUpItem(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList) { /*----------------------------------*/ /* Variable Declaration */ @@ -232,11 +235,11 @@ void SGUI_List_SelectUpItem(SGUI_List_STRUCT* pstList) { // Unfocused current item. uiReverseBlockPosY = pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet; - SGUI_Basic_ReverseBlockColor(LIST_ITEM_RECT_POSX, uiReverseBlockPosY, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); + SGUI_Basic_ReverseBlockColor(pstIFObj, LIST_ITEM_RECT_POSX, uiReverseBlockPosY, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); pstListControl->SelectIndex--; // Focused previous item. uiReverseBlockPosY = pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet; - SGUI_Basic_ReverseBlockColor(LIST_ITEM_RECT_POSX, uiReverseBlockPosY, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); + SGUI_Basic_ReverseBlockColor(pstIFObj, LIST_ITEM_RECT_POSX, uiReverseBlockPosY, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); } else { @@ -249,7 +252,7 @@ void SGUI_List_SelectUpItem(SGUI_List_STRUCT* pstList) { pstListControl->PageStartIndex--; } - SGUI_List_RefreshListItems(pstList); + SGUI_List_RefreshListItems(pstIFObj, pstList); } } } @@ -263,7 +266,7 @@ void SGUI_List_SelectUpItem(SGUI_List_STRUCT* pstList) /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_List_SelectDownItem(SGUI_List_STRUCT* pstList) +void SGUI_List_SelectDownItem(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList) { /*----------------------------------*/ /* Variable Declaration */ @@ -286,11 +289,11 @@ void SGUI_List_SelectDownItem(SGUI_List_STRUCT* pstList) { // Unfocused current item. uiReverseBlockPosY = pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet; - SGUI_Basic_ReverseBlockColor(LIST_ITEM_RECT_POSX, uiReverseBlockPosY, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); + SGUI_Basic_ReverseBlockColor(pstIFObj, LIST_ITEM_RECT_POSX, uiReverseBlockPosY, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); pstListControl->SelectIndex++; // Focused previous item. uiReverseBlockPosY = pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet; - SGUI_Basic_ReverseBlockColor(LIST_ITEM_RECT_POSX, uiReverseBlockPosY, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); + SGUI_Basic_ReverseBlockColor(pstIFObj, LIST_ITEM_RECT_POSX, uiReverseBlockPosY, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); } else { @@ -303,7 +306,7 @@ void SGUI_List_SelectDownItem(SGUI_List_STRUCT* pstList) { pstListControl->PageStartIndex++; } - SGUI_List_RefreshListItems(pstList); + SGUI_List_RefreshListItems(pstIFObj, pstList); } } } @@ -313,14 +316,15 @@ void SGUI_List_SelectDownItem(SGUI_List_STRUCT* pstList) /** Function Name: SGUI_List_DrawItem **/ /** Purpose: Draw a visible list item. **/ /** Params: **/ -/** @pstList[in]: Pointer of list will be selected. **/ -/** @uiIndex[in]: List item index will be draw. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ pstList[in]: Pointer of list will be selected. **/ +/** @ uiIndex[in]: List item index will be draw. **/ /** Return: None. **/ /** Notice: This function only draw visible items, it's **/ /** depending on the first visible item index and count **/ /** of visible items. **/ /*************************************************************************/ -void SGUI_List_DrawItem(SGUI_List_STRUCT* pstList, SGUI_SIZE uiIndex) +void SGUI_List_DrawItem(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList, SGUI_SIZE uiIndex) { /*----------------------------------*/ /* Variable Declaration */ @@ -382,7 +386,8 @@ void SGUI_List_DrawItem(SGUI_List_STRUCT* pstList, SGUI_SIZE uiIndex) } // Draw list item text. - SGUI_Text_DrawSingleLineText( pstListItemPointer->Text, pstList->FontSize, + SGUI_Text_DrawSingleLineText( pstIFObj, + pstListItemPointer->Text, pstList->FontSize, &stItemTextDisplayArea, &stItemTextDataArea, SGUI_DRAW_NORMAL); // Prepare draw parameter text. @@ -438,7 +443,7 @@ void SGUI_List_DrawItem(SGUI_List_STRUCT* pstList, SGUI_SIZE uiIndex) } } // Draw parameter text. - SGUI_Text_DrawSingleLineText(szParameterStringBuffer, pstList->FontSize, &stItemTextDisplayArea, &stItemTextDataArea, SGUI_DRAW_NORMAL); + SGUI_Text_DrawSingleLineText(pstIFObj, szParameterStringBuffer, pstList->FontSize, &stItemTextDisplayArea, &stItemTextDataArea, SGUI_DRAW_NORMAL); } } } @@ -448,14 +453,15 @@ void SGUI_List_DrawItem(SGUI_List_STRUCT* pstList, SGUI_SIZE uiIndex) /** Function Name: SGUI_List_SetListItemValue **/ /** Purpose: Set list parameter value if supported. **/ /** Params: **/ -/** @pstList[in]: Pointer of list will be selected. **/ -/** @iItemIndex[in]: Index of list item index will be changed. **/ -/** @iSetValid[in]: Valid value will be set. **/ -/** @iSetDecimal[in]: Decimal value will be set. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ pstList[in]: Pointer of list will be selected. **/ +/** @ iItemIndex[in]: Index of list item index will be changed. **/ +/** @ iSetValid[in]: Valid value will be set. **/ +/** @ iSetDecimal[in]: Decimal value will be set. **/ /** Return: None. **/ /** Notice: The bind value will update if existed. **/ /*************************************************************************/ -void SGUI_List_SetListItemValue(SGUI_List_STRUCT* pstList, SGUI_INDEX iItemIndex, int32_t iSetValid, int32_t iSetDecimal) +void SGUI_List_SetListItemValue(SGUI_IF_OBJ* pstIFObj, SGUI_List_STRUCT* pstList, SGUI_INDEX iItemIndex, int32_t iSetValid, int32_t iSetDecimal) { /*----------------------------------*/ /* Variable Declaration */ @@ -518,12 +524,12 @@ void SGUI_List_SetListItemValue(SGUI_List_STRUCT* pstList, SGUI_INDEX iItemIndex *(pstSelectedListItem->Decimal.Bind) = pstSelectedListItem->Decimal.Value; } // Clear list item area. - SGUI_Basic_DrawRectangle(LIST_ITEM_RECT_POSX, pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet, + SGUI_Basic_DrawRectangle(pstIFObj, LIST_ITEM_RECT_POSX, pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight, SGUI_COLOR_BKGCLR, SGUI_COLOR_BKGCLR); // refresh list item - SGUI_List_DrawItem(pstList, iItemIndex); + SGUI_List_DrawItem(pstIFObj, pstList, iItemIndex); // High light selected item. - SGUI_Basic_ReverseBlockColor(LIST_ITEM_RECT_POSX, pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet, + SGUI_Basic_ReverseBlockColor(pstIFObj, LIST_ITEM_RECT_POSX, pstListControl->FirstVisibleItemPosY+(pstListControl->SelectIndex-pstListControl->PageStartIndex)*pstListControl->ListItemHeight-pstListControl->ItemPosYOffSet, LIST_ITEM_RECT_WIDTH, pstListControl->ListItemHeight); } } diff --git a/GUI/src/SGUI_Notice.c b/GUI/src/SGUI_Notice.c index b689e0f..079d6b0 100644 --- a/GUI/src/SGUI_Notice.c +++ b/GUI/src/SGUI_Notice.c @@ -47,13 +47,15 @@ /** Function Name: SGUI_Notice_RefreshNotice **/ /** Purpose: Show a notice box. **/ /** Params: **/ -/** @szNoticeText[in]: Notice text. **/ -/** @uiTextOffset[in]: Text top offset. **/ -/** @eIcon[in]: Notice icon index. **/ +/** Params: **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ szNoticeText[in]: Notice text. **/ +/** @ uiTextOffset[in]: Text top offset. **/ +/** @ eIcon[in]: Notice icon index. **/ /** Return: Remaining text height display. **/ /** Notice: None. **/ /*************************************************************************/ -SGUI_SIZE SGUI_Notice_Refresh(SGUI_PCSZSTR szNoticeText, SGUI_INT uiTextOffset, SGUI_NOTICE_ICON eIcon) +SGUI_SIZE SGUI_Notice_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_PCSZSTR szNoticeText, SGUI_INT uiTextOffset, SGUI_NOTICE_ICON eIcon) { /*----------------------------------*/ /* Variable Declaration */ @@ -89,7 +91,7 @@ SGUI_SIZE SGUI_Notice_Refresh(SGUI_PCSZSTR szNoticeText, SGUI_INT uiTextOffset, uiNoticeBoxHeight = NOTICE_BOX_HEIGHT_MAX; } // Draw edge - SGUI_Basic_DrawRectangle(NOTICE_BOX_POSX, NOTICE_BOX_POSY(uiNoticeBoxHeight), NOTICE_BOX_WIDTH, uiNoticeBoxHeight, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); + SGUI_Basic_DrawRectangle(pstIFObj, NOTICE_BOX_POSX, NOTICE_BOX_POSY(uiNoticeBoxHeight), NOTICE_BOX_WIDTH, uiNoticeBoxHeight, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); // Draw icon if exists. if(SGUI_ICON_NONE != eIcon) { @@ -102,7 +104,7 @@ SGUI_SIZE SGUI_Notice_Refresh(SGUI_PCSZSTR szNoticeText, SGUI_INT uiTextOffset, stIconDataArea.Width = NOTICE_ICON_SIZE; stIconDataArea.Height = NOTICE_ICON_SIZE; #if NOTICE_ICON_SIZE == 16 - SGUI_Basic_DrawBitMap(&stIconDisplayArea, &stIconDataArea, SGUI_NOTICE_ICON_16PIX, eIcon*(NOTICE_ICON_SIZE*(NOTICE_ICON_SIZE/8)), SGUI_DRAW_NORMAL); + SGUI_Basic_DrawBitMap(pstIFObj, &stIconDisplayArea, &stIconDataArea, SGUI_NOTICE_ICON_16PIX, eIcon*(NOTICE_ICON_SIZE*(NOTICE_ICON_SIZE/8)), SGUI_DRAW_NORMAL); #elif NOTICE_ICON_SIZE == 24 SGUI_Basic_DrawBitMap(&stIconDisplayArea, &stIconDataArea, SGUI_NOTICE_ICON_24PIX, eIcon*(NOTICE_ICON_SIZE*(NOTICE_ICON_SIZE/8)), SGUI_DRAW_NORMAL); #endif @@ -125,7 +127,7 @@ SGUI_SIZE SGUI_Notice_Refresh(SGUI_PCSZSTR szNoticeText, SGUI_INT uiTextOffset, stTextDisplayArea.Height = NOTICE_TEXT_AREA_HEIGHT_MAX; } - uiTextLines = SGUI_Text_DrawMultipleLinesText(pszNoticeTextPtr, NOTICE_FONT_SIZE, &stTextDisplayArea, uiTextOffset, SGUI_DRAW_NORMAL); + uiTextLines = SGUI_Text_DrawMultipleLinesText(pstIFObj, pszNoticeTextPtr, NOTICE_FONT_SIZE, &stTextDisplayArea, uiTextOffset, SGUI_DRAW_NORMAL); return uiTextLines; } diff --git a/GUI/src/SGUI_ProcessBar.c b/GUI/src/SGUI_ProcessBar.c index 3b4bf78..7d7cf8e 100644 --- a/GUI/src/SGUI_ProcessBar.c +++ b/GUI/src/SGUI_ProcessBar.c @@ -20,11 +20,13 @@ /** Purpose: Display or update a process bar. **/ /** Resources: Process bar data structure. **/ /** Params: **/ -/** @pstProcessBarData[in]: Process bar data whitch will update on screen. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ pstProcessBarData[in]: Process bar data whitch will update on **/ +/** screen. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_ProcessBar_Refresh(SGUI_PROCBAR_STRUCT *pstProcessBarData) +void SGUI_ProcessBar_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_PROCBAR_STRUCT *pstProcessBarData) { /*----------------------------------*/ /* Variable Declaration */ @@ -90,9 +92,9 @@ void SGUI_ProcessBar_Refresh(SGUI_PROCBAR_STRUCT *pstProcessBarData) } } // Redraw edge and clean up area. - SGUI_Basic_DrawRectangle(pstProcessBarData->Parameter.PosX, pstProcessBarData->Parameter.PosY, pstProcessBarData->Parameter.Width, pstProcessBarData->Parameter.Height, SGUI_COLOR_FRGCLR, eBackColor); + SGUI_Basic_DrawRectangle(pstIFObj, pstProcessBarData->Parameter.PosX, pstProcessBarData->Parameter.PosY, pstProcessBarData->Parameter.Width, pstProcessBarData->Parameter.Height, SGUI_COLOR_FRGCLR, eBackColor); // Draw process block. - SGUI_Basic_DrawRectangle(uiProcessBlockStartX, uiProcessBlockStartY, uiProcessBlockWidth, uiProcessBlockHeight, eFillColor, eFillColor); + SGUI_Basic_DrawRectangle(pstIFObj, uiProcessBlockStartX, uiProcessBlockStartY, uiProcessBlockWidth, uiProcessBlockHeight, eFillColor, eFillColor); } } } diff --git a/GUI/src/SGUI_RealtimeGraph.c b/GUI/src/SGUI_RealtimeGraph.c index 33ab155..ceb5225 100644 --- a/GUI/src/SGUI_RealtimeGraph.c +++ b/GUI/src/SGUI_RealtimeGraph.c @@ -96,11 +96,12 @@ void SGUI_RealtimeGraph_Initialize(SGUI_RTGRAPH* pstRTGraph) /** Purpose: Refresh graph map display. **/ /** Resources: Graph data. **/ /** Params: **/ -/** @pstRTGraph[in]: Graph map data used refreshed. **/ +/** @ pstIFObj[in]: SimpleGUI object pointer. **/ +/** @ pstRTGraph[in]: Graph map data used refreshed. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_RealtimeGraph_Refresh(SGUI_RTGRAPH* pstRTGraph, SGUI_PCSZSTR szTopText, SGUI_PCSZSTR szBottomText) +void SGUI_RealtimeGraph_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_RTGRAPH* pstRTGraph, SGUI_PCSZSTR szTopText, SGUI_PCSZSTR szBottomText) { /*----------------------------------*/ /* Variable Declaration */ @@ -116,9 +117,9 @@ void SGUI_RealtimeGraph_Refresh(SGUI_RTGRAPH* pstRTGraph, SGUI_PCSZSTR szTopText /* Process */ /*----------------------------------*/ // Draw frame - SGUI_Basic_DrawRectangle(0, 0, LCD_SIZE_WIDTH, LCD_SIZE_HEIGHT, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); - SGUI_Basic_DrawLine(1, 9, LCD_SIZE_WIDTH-2, 9, SGUI_COLOR_FRGCLR); - SGUI_Basic_DrawLine(1, LCD_SIZE_HEIGHT-9, LCD_SIZE_WIDTH-2, LCD_SIZE_HEIGHT-9, SGUI_COLOR_FRGCLR); + SGUI_Basic_DrawRectangle(pstIFObj, 0, 0, LCD_SIZE_WIDTH, LCD_SIZE_HEIGHT, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); + SGUI_Basic_DrawLine(pstIFObj, 1, 9, LCD_SIZE_WIDTH-2, 9, SGUI_COLOR_FRGCLR); + SGUI_Basic_DrawLine(pstIFObj, 1, LCD_SIZE_HEIGHT-9, LCD_SIZE_WIDTH-2, LCD_SIZE_HEIGHT-9, SGUI_COLOR_FRGCLR); if(NULL != pstRTGraph) { @@ -129,7 +130,7 @@ void SGUI_RealtimeGraph_Refresh(SGUI_RTGRAPH* pstRTGraph, SGUI_PCSZSTR szTopText if(SGUI_TRUE == pstControl->EnableBaseline) { iBaseLineCoordinateY = SGUI_RealtimeGraph_GetValuePointYCoordinate(pstRTGraph, pstData->ZeroPointValue); - SGUI_Basic_DrawLine(1, iBaseLineCoordinateY, LCD_SIZE_WIDTH-2, iBaseLineCoordinateY, SGUI_COLOR_FRGCLR); + SGUI_Basic_DrawLine(pstIFObj, 1, iBaseLineCoordinateY, LCD_SIZE_WIDTH-2, iBaseLineCoordinateY, SGUI_COLOR_FRGCLR); } if(pstData->ValueCount > 1) @@ -138,7 +139,7 @@ void SGUI_RealtimeGraph_Refresh(SGUI_RTGRAPH* pstRTGraph, SGUI_PCSZSTR szTopText { iPixelCoordinateStartX = 1 + (iValueIndex-1) * pstControl->xAxisStepPixel; iPixelCoordinateEndX = 1 + iValueIndex * pstControl->xAxisStepPixel; - SGUI_Basic_DrawLine(iPixelCoordinateStartX, pstData->PointYCoordinateArray[iValueIndex-1], + SGUI_Basic_DrawLine(pstIFObj, iPixelCoordinateStartX, pstData->PointYCoordinateArray[iValueIndex-1], iPixelCoordinateEndX, pstData->PointYCoordinateArray[iValueIndex], SGUI_COLOR_FRGCLR); } } @@ -146,9 +147,9 @@ void SGUI_RealtimeGraph_Refresh(SGUI_RTGRAPH* pstRTGraph, SGUI_PCSZSTR szTopText stTextDataArea.PosX = 0; stTextDataArea.PosY = 0; stTextDispArea.PosX = 1; stTextDispArea.PosY = 1; stTextDispArea.Width = LCD_SIZE_WIDTH-2, stTextDispArea.Height = 7; - SGUI_Text_DrawSingleLineText(szTopText, SGUI_FONT_SIZE_H8, &stTextDispArea, &stTextDataArea, SGUI_DRAW_NORMAL); + SGUI_Text_DrawSingleLineText(pstIFObj, szTopText, SGUI_FONT_SIZE_H8, &stTextDispArea, &stTextDataArea, SGUI_DRAW_NORMAL); stTextDispArea.PosY = LCD_SIZE_HEIGHT-8; - SGUI_Text_DrawSingleLineText(szBottomText, SGUI_FONT_SIZE_H8, &stTextDispArea, &stTextDataArea, SGUI_DRAW_NORMAL); + SGUI_Text_DrawSingleLineText(pstIFObj, szBottomText, SGUI_FONT_SIZE_H8, &stTextDispArea, &stTextDataArea, SGUI_DRAW_NORMAL); } } } diff --git a/GUI/src/SGUI_ScrollBar.c b/GUI/src/SGUI_ScrollBar.c index 7f34d88..0c51174 100644 --- a/GUI/src/SGUI_ScrollBar.c +++ b/GUI/src/SGUI_ScrollBar.c @@ -24,7 +24,7 @@ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_ScrollBar_Refresh(SGUI_SCROLLBAR_STRUCT* pstScrollBar) +void SGUI_ScrollBar_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_SCROLLBAR_STRUCT* pstScrollBar) { /*----------------------------------*/ /* Variable Declaration */ @@ -58,7 +58,7 @@ void SGUI_ScrollBar_Refresh(SGUI_SCROLLBAR_STRUCT* pstScrollBar) if(SGUI_SCROLLBAR_VERTICAL == pstScrollBar->Parameter.eDirection) { // Draw scroll bar edge. - SGUI_Basic_DrawRectangle(pstScrollBar->Parameter.PosX, pstScrollBar->Parameter.PosY, + SGUI_Basic_DrawRectangle(pstIFObj, pstScrollBar->Parameter.PosX, pstScrollBar->Parameter.PosY, pstScrollBar->Parameter.Width, pstScrollBar->Parameter.Height, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); // Value lower limit is 0, scroll blocks must be greater then 0. @@ -66,19 +66,19 @@ void SGUI_ScrollBar_Refresh(SGUI_SCROLLBAR_STRUCT* pstScrollBar) { uiScrollBlockPos = pstScrollBar->Parameter.PosY+1+((pstScrollBar->Parameter.Height-uiScrollBlockSize-2)*pstScrollBar->Data.Index/pstScrollBar->Parameter.MaxIndex); // Redraw process block - SGUI_Basic_DrawRectangle(pstScrollBar->Parameter.PosX+1, uiScrollBlockPos, + SGUI_Basic_DrawRectangle(pstIFObj, pstScrollBar->Parameter.PosX+1, uiScrollBlockPos, uiScrollBlockSize, uiScrollBlockSize, SGUI_COLOR_FRGCLR, SGUI_COLOR_FRGCLR); } else { - SGUI_Basic_DrawRectangle(pstScrollBar->Parameter.PosX+1, pstScrollBar->Parameter.PosY+1, + SGUI_Basic_DrawRectangle(pstIFObj, pstScrollBar->Parameter.PosX+1, pstScrollBar->Parameter.PosY+1, uiScrollBlockSize, uiScrollBlockSize, SGUI_COLOR_FRGCLR, SGUI_COLOR_FRGCLR); } } else // Horizontal { // Draw scroll bar edge. - SGUI_Basic_DrawRectangle(pstScrollBar->Parameter.PosX, pstScrollBar->Parameter.PosY, + SGUI_Basic_DrawRectangle(pstIFObj, pstScrollBar->Parameter.PosX, pstScrollBar->Parameter.PosY, pstScrollBar->Parameter.Width, pstScrollBar->Parameter.Height, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); // Value lower limit is 0, scroll blocks must be greater then 0. @@ -86,12 +86,12 @@ void SGUI_ScrollBar_Refresh(SGUI_SCROLLBAR_STRUCT* pstScrollBar) { uiScrollBlockPos = pstScrollBar->Parameter.PosX+1+((pstScrollBar->Parameter.Width-uiScrollBlockSize-2)*pstScrollBar->Data.Index/pstScrollBar->Parameter.MaxIndex); // Redraw process block - SGUI_Basic_DrawRectangle(uiScrollBlockPos, pstScrollBar->Parameter.PosY+1, + SGUI_Basic_DrawRectangle(pstIFObj, uiScrollBlockPos, pstScrollBar->Parameter.PosY+1, uiScrollBlockSize, uiScrollBlockSize, SGUI_COLOR_FRGCLR, SGUI_COLOR_FRGCLR); } else { - SGUI_Basic_DrawRectangle(pstScrollBar->Parameter.PosX+1, pstScrollBar->Parameter.PosY+1, + SGUI_Basic_DrawRectangle(pstIFObj, pstScrollBar->Parameter.PosX+1, pstScrollBar->Parameter.PosY+1, uiScrollBlockSize, uiScrollBlockSize, SGUI_COLOR_FRGCLR, SGUI_COLOR_FRGCLR); } } diff --git a/GUI/src/SGUI_Text.c b/GUI/src/SGUI_Text.c index 5c827a3..cf7b9cd 100644 --- a/GUI/src/SGUI_Text.c +++ b/GUI/src/SGUI_Text.c @@ -48,7 +48,7 @@ static SGUI_FLASH_DATA_SOURCE SGUI_Text_GetFontResource(SGUI_FONT_SIZE eFontSize /** Return: Next character X coordinate in current line. **/ /** Limitation: None. **/ /*************************************************************************/ -void SGUI_Text_DrawSingleLineText(SGUI_PCSZSTR szText, SGUI_FONT_SIZE eFontSize, SGUI_RECT_AREA* pstDisplayArea, SGUI_RECT_AREA* pstTextDataArea, SGUI_DRAW_MODE eFontMode) +void SGUI_Text_DrawSingleLineText(SGUI_IF_OBJ* pstIFObj, SGUI_PCSZSTR szText, SGUI_FONT_SIZE eFontSize, SGUI_RECT_AREA* pstDisplayArea, SGUI_RECT_AREA* pstTextDataArea, SGUI_DRAW_MODE eFontMode) { /*----------------------------------*/ /* Variable Declaration */ @@ -94,7 +94,7 @@ void SGUI_Text_DrawSingleLineText(SGUI_PCSZSTR szText, SGUI_FONT_SIZE eFontSize, RECTANGLE_Y_START(*pstDisplayArea) = 0; } // Clear text area. - SGUI_Basic_DrawRectangle(RECTANGLE_X_START(*pstDisplayArea), RECTANGLE_Y_START(*pstDisplayArea), + SGUI_Basic_DrawRectangle(pstIFObj, RECTANGLE_X_START(*pstDisplayArea), RECTANGLE_Y_START(*pstDisplayArea), RECTANGLE_WIDTH(*pstDisplayArea), RECTANGLE_HEIGHT(*pstDisplayArea), eBackColor, eBackColor); // Initialize drawing area data. @@ -138,7 +138,7 @@ void SGUI_Text_DrawSingleLineText(SGUI_PCSZSTR szText, SGUI_FONT_SIZE eFontSize, { iFontDataIndex = SGUI_Text_GetCharacterTableIndex(uiCharacterCode); adFontDataAddr = iFontDataIndex * uiCharacterDataSize; - SGUI_Basic_DrawBitMap(pstDisplayArea, &stCharacterDataArea, eFontResource, adFontDataAddr, eFontMode); + SGUI_Basic_DrawBitMap(pstIFObj, pstDisplayArea, &stCharacterDataArea, eFontResource, adFontDataAddr, eFontMode); } RECTANGLE_X_START(stCharacterDataArea) += uiCharacterWidth; } @@ -157,7 +157,7 @@ void SGUI_Text_DrawSingleLineText(SGUI_PCSZSTR szText, SGUI_FONT_SIZE eFontSize, /** Return: Next character X coordinate in current line. **/ /** Notice: None. **/ /*****************************************************************************/ -SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_PCSZSTR szText, SGUI_FONT_SIZE eFontSize, SGUI_RECT_AREA* pstDisplayArea, SGUI_INT iTopOffset, SGUI_DRAW_MODE eFontMode) +SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_IF_OBJ* pstIFObj, SGUI_PCSZSTR szText, SGUI_FONT_SIZE eFontSize, SGUI_RECT_AREA* pstDisplayArea, SGUI_INT iTopOffset, SGUI_DRAW_MODE eFontMode) { /*----------------------------------*/ /* Variable Declaration */ @@ -205,7 +205,8 @@ SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_PCSZSTR szText, SGUI_FONT_SIZE eF RECTANGLE_Y_START(*pstDisplayArea) = 0; } // Clear text area. - SGUI_Basic_DrawRectangle(RECTANGLE_X_START(*pstDisplayArea), RECTANGLE_Y_START(*pstDisplayArea), + SGUI_Basic_DrawRectangle(pstIFObj, + RECTANGLE_X_START(*pstDisplayArea), RECTANGLE_Y_START(*pstDisplayArea), RECTANGLE_WIDTH(*pstDisplayArea), RECTANGLE_HEIGHT(*pstDisplayArea), eBackColor, eBackColor); // Initialize drawing area data. @@ -276,7 +277,7 @@ SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_PCSZSTR szText, SGUI_FONT_SIZE eF // Draw character. iFontDataIndex = SGUI_Text_GetCharacterTableIndex(uiCharacterCode); adFontDataAddr = iFontDataIndex * uiCharacterDataSize; - SGUI_Basic_DrawBitMap(pstDisplayArea, &stCharacterDataArea, eFontResource, adFontDataAddr, eFontMode); + SGUI_Basic_DrawBitMap(pstIFObj, pstDisplayArea, &stCharacterDataArea, eFontResource, adFontDataAddr, eFontMode); } else diff --git a/GUI/src/SGUI_VariableBox.c b/GUI/src/SGUI_VariableBox.c index 9721177..0fc222e 100644 --- a/GUI/src/SGUI_VariableBox.c +++ b/GUI/src/SGUI_VariableBox.c @@ -22,7 +22,7 @@ static char arrTextBuffer[VARBOX_TEXT_BUFFER_SIZE] = {0x00}; //Used when conv //=======================================================================// //= Static function declaration. =// //=======================================================================// -void SGUI_TextVariableBox_UpdateCharacter(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, char cNewCharacters, SGUI_DRAW_MODE eMode); +static void SGUI_TextVariableBox_UpdateCharacter(SGUI_IF_OBJ* pstIFObj, SGUI_TEXT_VARBOX_STRUCT* pstTextValue, char cNewCharacters, SGUI_DRAW_MODE eMode); //=======================================================================// //= Function define. =// @@ -38,7 +38,7 @@ void SGUI_TextVariableBox_UpdateCharacter(SGUI_TEXT_VARBOX_STRUCT* pstTextVa /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_IntegerVariableBox_Refresh(SGUI_INT_VARBOX_STRUCT* pstValue, SGUI_VARBOX_ALIG eAlignment, SGUI_DRAW_MODE eMode) +void SGUI_IntegerVariableBox_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_INT_VARBOX_STRUCT* pstValue, SGUI_VARBOX_ALIG eAlignment, SGUI_DRAW_MODE eMode) { /*----------------------------------*/ /* Variable Declaration */ @@ -54,7 +54,7 @@ void SGUI_IntegerVariableBox_Refresh(SGUI_INT_VARBOX_STRUCT* pstValue, SGUI_VARB /*----------------------------------*/ eBackColor = ((eMode==SGUI_DRAW_NORMAL)?SGUI_COLOR_BKGCLR:SGUI_COLOR_FRGCLR); // Draw edge - SGUI_Basic_DrawRectangle(pstValue->PosX, pstValue->PosY, pstValue->Width, VARBOX_HEIGHT(pstValue->FontSize), eBackColor, eBackColor); + SGUI_Basic_DrawRectangle(pstIFObj, pstValue->PosX, pstValue->PosY, pstValue->Width, VARBOX_HEIGHT(pstValue->FontSize), eBackColor, eBackColor); /*----------------------------------*/ /* Process */ @@ -96,7 +96,7 @@ void SGUI_IntegerVariableBox_Refresh(SGUI_INT_VARBOX_STRUCT* pstValue, SGUI_VARB } } stTextDataArea.PosY = 0; - SGUI_Text_DrawSingleLineText(arrTextBuffer, pstValue->FontSize, &stTextDisplayArea, &stTextDataArea, eMode); + SGUI_Text_DrawSingleLineText(pstIFObj, arrTextBuffer, pstValue->FontSize, &stTextDisplayArea, &stTextDataArea, eMode); } } @@ -110,7 +110,7 @@ void SGUI_IntegerVariableBox_Refresh(SGUI_INT_VARBOX_STRUCT* pstValue, SGUI_VARB /** Return: None. **/ /** Notice: Static function, call by others interface. **/ /*************************************************************************/ -void SGUI_TextVariableBox_UpdateCharacter(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, char cNewCharacters, SGUI_DRAW_MODE eMode) +void SGUI_TextVariableBox_UpdateCharacter(SGUI_IF_OBJ* pstIFObj, SGUI_TEXT_VARBOX_STRUCT* pstTextValue, char cNewCharacters, SGUI_DRAW_MODE eMode) { /*----------------------------------*/ /* Variable Declaration */ @@ -129,7 +129,7 @@ void SGUI_TextVariableBox_UpdateCharacter(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, // Clear background. if(NULL != pstTextValue->Value) { - SGUI_Basic_DrawRectangle(pstTextValue->PosX, pstTextValue->PosY, pstTextValue->Width, VARBOX_HEIGHT(pstTextValue->FontSize), eBackColor, eBackColor); + SGUI_Basic_DrawRectangle(pstIFObj, pstTextValue->PosX, pstTextValue->PosY, pstTextValue->Width, VARBOX_HEIGHT(pstTextValue->FontSize), eBackColor, eBackColor); } // Get font graphics size. uiFontWidth = g_stFontSize[pstTextValue->FontSize].Width; @@ -197,9 +197,9 @@ void SGUI_TextVariableBox_UpdateCharacter(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, stFocusArea.PosX = stFocusArea.PosX + stTextDataArea.PosX; } // Display text. - SGUI_Text_DrawSingleLineText(pstTextValue->Value, pstTextValue->FontSize, &stTextDisplayArea, &stTextDataArea, eMode); + SGUI_Text_DrawSingleLineText(pstIFObj, pstTextValue->Value, pstTextValue->FontSize, &stTextDisplayArea, &stTextDataArea, eMode); // Focus first character. - SGUI_Basic_ReverseBlockColor(stFocusArea.PosX, stFocusArea.PosY, stFocusArea.Width, stFocusArea.Height); + SGUI_Basic_ReverseBlockColor(pstIFObj, stFocusArea.PosX, stFocusArea.PosY, stFocusArea.Width, stFocusArea.Height); } } @@ -212,7 +212,7 @@ void SGUI_TextVariableBox_UpdateCharacter(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_TextVariableBox_Refresh(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DRAW_MODE eMode) +void SGUI_TextVariableBox_Refresh(SGUI_IF_OBJ* pstIFObj, SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DRAW_MODE eMode) { /*----------------------------------*/ @@ -226,7 +226,7 @@ void SGUI_TextVariableBox_Refresh(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DR { pstTextValue->FocusIndex = pstTextValue->MaxTextLength-1; } - SGUI_TextVariableBox_UpdateCharacter(pstTextValue, '\0', eMode); + SGUI_TextVariableBox_UpdateCharacter(pstIFObj, pstTextValue, '\0', eMode); } } } @@ -242,7 +242,7 @@ void SGUI_TextVariableBox_Refresh(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DR /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void SGUI_TextVariableBox_ChangeCharacter(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DRAW_MODE eMode, SGUI_UINT uiCharacterSet, SGUI_TEXT_VARBOX_OPT eOpt) +void SGUI_TextVariableBox_ChangeCharacter(SGUI_IF_OBJ* pstIFObj, SGUI_TEXT_VARBOX_STRUCT* pstTextValue, SGUI_DRAW_MODE eMode, SGUI_UINT uiCharacterSet, SGUI_TEXT_VARBOX_OPT eOpt) { /*----------------------------------*/ /* Variable Declaration */ @@ -296,7 +296,7 @@ void SGUI_TextVariableBox_ChangeCharacter(SGUI_TEXT_VARBOX_STRUCT* pstTextValue, } } } - SGUI_TextVariableBox_UpdateCharacter(pstTextValue, cCurChar, eMode); + SGUI_TextVariableBox_UpdateCharacter(pstIFObj, pstTextValue, cCurChar, eMode); } } } diff --git a/HMI/inc/HMI_Engine.h b/HMI/inc/HMI_Engine.h index f524513..3bcfc98 100644 --- a/HMI/inc/HMI_Engine.h +++ b/HMI/inc/HMI_Engine.h @@ -87,11 +87,11 @@ typedef struct // Screen action interface function pointer structure. typedef struct { - HMI_ENGINE_RESULT (*Initialize)(void); // Initialize screen data and parameter. - HMI_ENGINE_RESULT (*Prepare)(const void* pstParameters); // Do some thing before current screen display. - HMI_ENGINE_RESULT (*Repaint)(const void* pstParameters); // Repaint screen if needed. - HMI_ENGINE_RESULT (*ProcessEvent)(HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); // Process event. - HMI_ENGINE_RESULT (*PostProcess)(SGUI_INT iActionResult); + HMI_ENGINE_RESULT (*Initialize)(SGUI_IF_OBJ* Interface); // Initialize screen data and parameter. + HMI_ENGINE_RESULT (*Prepare)(SGUI_IF_OBJ* Interface, const void* pstParameters); // Do some thing before current screen display. + HMI_ENGINE_RESULT (*Repaint)(SGUI_IF_OBJ* Interface, const void* pstParameters); // Repaint screen if needed. + HMI_ENGINE_RESULT (*ProcessEvent)(SGUI_IF_OBJ* Interface, HMI_EVENT_TYPE eEventType, const HMI_EVENT* pstEvent); // Process event. + HMI_ENGINE_RESULT (*PostProcess)(SGUI_IF_OBJ* Interface, SGUI_INT iActionResult); //void* (*InstanceData)(void); // Get current screen instance data pointer. }HMI_SCREEN_ACTION; // Screen data structure. @@ -114,6 +114,7 @@ typedef struct HMI_SCREEN_OBJECT* CurrentScreenObject; HMI_HISTORY_STACK History; HMI_ENGINE_STATE State; + SGUI_IF_OBJ* Interface; }HMI_ENGINE_OBJECT; //=======================================================================// diff --git a/HMI/src/HMI_Engine.c b/HMI/src/HMI_Engine.c index d40e371..bb835c9 100644 --- a/HMI/src/HMI_Engine.c +++ b/HMI/src/HMI_Engine.c @@ -11,6 +11,7 @@ //=======================================================================// #include "HMI_Engine.h" #include "SGUI_Common.h" +#include "SGUI_Basic.h" //=======================================================================// //= Static variable declaration. =// @@ -54,7 +55,7 @@ HMI_ENGINE_RESULT HMI_PrepareEngine(HMI_ENGINE_OBJECT* pstHMIEngineObject) if(NULL != pstHMIEngineObject) { // Clean HMI engine object memory area. - SGUI_Common_MemorySet(pstHMIEngineObject, 0x00, sizeof(HMI_ENGINE_OBJECT)); + // SGUI_Common_MemorySet(pstHMIEngineObject, 0x00, sizeof(HMI_ENGINE_OBJECT)); // Initialize engine object data, pstHMIEngineObject->ScreenCount = 0; @@ -112,7 +113,7 @@ HMI_ENGINE_RESULT HMI_AddScreen(HMI_ENGINE_OBJECT* pstHMIEngineObject, HMI_SCREE { if(SGUI_TRUE == bInitializeScreenObject) { - pstScreenObject->Actions->Initialize(); + pstScreenObject->Actions->Initialize(pstHMIEngineObject->Interface); } // Add screen object pointer to engine. pstHMIEngineObject->Screen[iIndex] = pstScreenObject; @@ -243,7 +244,8 @@ HMI_ENGINE_RESULT HMI_StartEngine(const void* pstParameters) { if(NULL != pstStartScreen->Actions->Prepare) { - pstStartScreen->Actions->Prepare(pstParameters); + pstStartScreen->Actions->Prepare(g_pstActivedEngineObject->Interface, pstParameters); + SGUI_Basic_RefreshDisplay(g_pstActivedEngineObject->Interface); } } } @@ -307,7 +309,8 @@ HMI_ENGINE_RESULT HMI_ProcessEvent(HMI_EVENT_TYPE eEventType, const HMI_EVENT* p { if(NULL != pstCurrentScreen->Actions->ProcessEvent) { - eProcessResult = pstCurrentScreen->Actions->ProcessEvent(eEventType, pstEvent); + eProcessResult = pstCurrentScreen->Actions->ProcessEvent(g_pstActivedEngineObject->Interface, eEventType, pstEvent); + SGUI_Basic_RefreshDisplay(g_pstActivedEngineObject->Interface); } } } @@ -356,7 +359,8 @@ HMI_ENGINE_RESULT HMI_PostProcess(SGUI_INT iActionResult) (NULL != g_pstActivedEngineObject->CurrentScreenObject->Actions) && (NULL != g_pstActivedEngineObject->CurrentScreenObject->Actions->PostProcess)) { - eProcessResult = g_pstActivedEngineObject->CurrentScreenObject->Actions->PostProcess(iActionResult); + eProcessResult = g_pstActivedEngineObject->CurrentScreenObject->Actions->PostProcess(g_pstActivedEngineObject->Interface, iActionResult); + SGUI_Basic_RefreshDisplay(g_pstActivedEngineObject->Interface); } else { @@ -418,7 +422,7 @@ HMI_ENGINE_RESULT HMI_Goto(SGUI_INT iDestScreenID, const void* pstParameters) { if(NULL != pstCurrentScreen->Actions->Prepare) { - eProcessResult = pstCurrentScreen->Actions->Prepare(pstParameters); + eProcessResult = pstCurrentScreen->Actions->Prepare(g_pstActivedEngineObject->Interface, pstParameters); } } } @@ -485,7 +489,7 @@ HMI_ENGINE_RESULT HMI_GoBack(const void* pstParameters) { if(NULL != pstCurrentScreen->Actions->Prepare) { - eProcessResult = pstCurrentScreen->Actions->Prepare(pstParameters); + eProcessResult = pstCurrentScreen->Actions->Prepare(g_pstActivedEngineObject->Interface, pstParameters); } } } diff --git a/README.md b/README.md index b6cfec1..83d5630 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# SimpleGUI +# SimpleGUI --- @@ -36,6 +36,18 @@ SimpleGUI发布已经有很长时间了,在发布后很多人都来询问一 另外,我正在致力于开发一款文字取模的工具,类似PCtoLCD2002那种,以方便开发者可以定制最符合自身需求的字库。 +#### 改进计划 + +在此感谢所有对SimpleGUI提出宝贵意见和建议的朋友。 + + +|功能划分|进行状态|描述| +|:- |:- |:- | +|模拟器|进行中|修改模拟器的处理方式,使更贴近单片机的程序结构。| +|本体/位图绘制部分|进行中|修改位图绘制方式,减小内存开销。| +|本体/接口部分|计划中|修改驱动接口函数的调用模式为注册式。| +|本体/接口部分|计划中|完善外部Flash读取操作的接口。| + #### 参与讨论 如果您有意参与SimpleGUI的讨论与改进,可以在以下地方留言: diff --git a/SimulatorEnv/Interface/inc/VirtualDeviceInterface.h b/SimulatorEnv/Interface/inc/VirtualDeviceInterface.h index 8d54d68..c413369 100644 --- a/SimulatorEnv/Interface/inc/VirtualDeviceInterface.h +++ b/SimulatorEnv/Interface/inc/VirtualDeviceInterface.h @@ -57,8 +57,8 @@ extern "C" { #endif /* __cplusplus */ -void VDIF_SetPixel(uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelValue); -uint32_t VDIF_GetPixel(uint32_t uiPosX, uint32_t uiPosY); +void VDIF_SetPixel(int uiPosX, int uiPosY, int uiPixelValue); +int VDIF_GetPixel(int uiPosX, int uiPosY); void VDIF_RefreshDisplay(void); void VDIF_ClearDisplay(void); diff --git a/SimulatorEnv/Interface/src/VirtualDeviceInterface.cpp b/SimulatorEnv/Interface/src/VirtualDeviceInterface.cpp index e8f1ed3..c906ce6 100644 --- a/SimulatorEnv/Interface/src/VirtualDeviceInterface.cpp +++ b/SimulatorEnv/Interface/src/VirtualDeviceInterface.cpp @@ -18,13 +18,13 @@ /** Function Name: VDIF_SetPixel **/ /** Purpose: Set virtual device pixel register data. **/ /** Params: **/ -/** @ uiPosX[in]: Pixel x-coordinate on display panel. **/ -/** @ uiPosY[in]: Pixel y-coordinate on display panel. **/ -/** @ uiPixelValue[out]: Pixel value, 0 for clear, 1 for set. **/ +/** @ iPosX[in]: Pixel x-coordinate on display panel. **/ +/** @ iPosY[in]: Pixel y-coordinate on display panel. **/ +/** @ iPixelValue[out]: Pixel value, 0 for clear, 1 for set. **/ /** Return: None. **/ /** Notice: None. **/ /*************************************************************************/ -void VDIF_SetPixel(uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelValue) +void VDIF_SetPixel(int iPosX, int iPosY, int iPixelValue) { /*----------------------------------*/ /* Variable Declaration */ @@ -41,7 +41,7 @@ void VDIF_SetPixel(uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelValue) /*----------------------------------*/ if(NULL != pclsMainFrameObjectPtr) { - pclsMainFrameObjectPtr->SetLCDPixel(uiPosX, uiPosY, uiPixelValue); + pclsMainFrameObjectPtr->SetLCDPixel(iPosX, iPosY, iPixelValue); } } @@ -49,18 +49,18 @@ void VDIF_SetPixel(uint32_t uiPosX, uint32_t uiPosY, uint32_t uiPixelValue) /** Function Name: VDIF_GetPixel **/ /** Purpose: Get a pixel value form virtual device register. **/ /** Params: **/ -/** @ uiPosX[in]: Pixel x-coordinate on display panel. **/ -/** @ uiPosY[in]: Pixel y-coordinate on display panel. **/ +/** @ iPosX[in]: Pixel x-coordinate on display panel. **/ +/** @ iPosY[in]: Pixel y-coordinate on display panel. **/ /** Return: Pixel state, 0 for cleared, 1 for set. **/ /** Notice: None. **/ /*************************************************************************/ -uint32_t VDIF_GetPixel(uint32_t uiPosX, uint32_t uiPosY) +int VDIF_GetPixel(int iPosX, int iPosY) { /*----------------------------------*/ /* Variable Declaration */ /*----------------------------------*/ LCDFrame* pclsMainFrameObjectPtr; - uint32_t uiPixelValue; + int iPixelValue; /*----------------------------------*/ /* Initialize */ @@ -72,14 +72,14 @@ uint32_t VDIF_GetPixel(uint32_t uiPosX, uint32_t uiPosY) /*----------------------------------*/ if(NULL != pclsMainFrameObjectPtr) { - uiPixelValue = pclsMainFrameObjectPtr->GetLCDPixel(uiPosX, uiPosY); + iPixelValue = pclsMainFrameObjectPtr->GetLCDPixel(iPosX, iPosY); } else { - uiPixelValue = 0; + iPixelValue = 0; } - return uiPixelValue; + return iPixelValue; } /*************************************************************************/ diff --git a/SimulatorEnv/Library/lib/libiconv.a b/SimulatorEnv/Library/lib32/libiconv.a similarity index 100% rename from SimulatorEnv/Library/lib/libiconv.a rename to SimulatorEnv/Library/lib32/libiconv.a diff --git a/SimulatorEnv/Library/lib/libiconv64.a b/SimulatorEnv/Library/lib64/libiconv64.a similarity index 100% rename from SimulatorEnv/Library/lib/libiconv64.a rename to SimulatorEnv/Library/lib64/libiconv64.a diff --git a/SimulatorEnv/Project/CodeBlocks/SimpleGUI.cbp b/SimulatorEnv/Project/CodeBlocks/SimpleGUI.cbp index a2ff6eb..526ee06 100644 --- a/SimulatorEnv/Project/CodeBlocks/SimpleGUI.cbp +++ b/SimulatorEnv/Project/CodeBlocks/SimpleGUI.cbp @@ -6,7 +6,7 @@