From cdc19e6c61cfbaccc6db78f9b4748c6f8916f54d Mon Sep 17 00:00:00 2001 From: Jerry Date: Thu, 13 Aug 2020 16:06:19 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9SGUI=5FNOTICE=5FBOX?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF=202.?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0SGUI=5FNOTICE=5FPALETTE=E8=B0=83=E8=89=B2?= =?UTF-8?q?=E6=9D=BF=E6=9C=BA=E5=88=B6,=E5=AE=9E=E7=8E=B0=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=A1=86=E7=9A=84=E7=81=B0=E5=BA=A6=E5=8C=96,?= =?UTF-8?q?=E4=BD=86=E6=98=AF=E8=83=8C=E6=99=AF=E4=B8=8D=E4=B8=BA0?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E5=8F=AF=E8=83=BD=E4=BC=9A?= =?UTF-8?q?=E8=A2=AB=E6=96=87=E5=AD=97=E8=83=8C=E6=99=AF=E8=A6=86=E7=9B=96?= =?UTF-8?q?=203.=E6=89=A3=E8=83=8C=E6=99=AF=E8=BF=99=E7=A7=8D=E4=BA=8B?= =?UTF-8?q?=E6=83=85=E4=BB=A5=E5=90=8E=E5=86=8D=E8=AF=B4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DemoProc/src/Notice.c | 6 +++++- DemoProc/src/VariableBox.c | 6 +++++- GUI/inc/SGUI_Notice.h | 11 +++++++++-- GUI/src/SGUI_Notice.c | 11 +++++++++-- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/DemoProc/src/Notice.c b/DemoProc/src/Notice.c index 7b6240a..69053b9 100644 --- a/DemoProc/src/Notice.c +++ b/DemoProc/src/Notice.c @@ -28,7 +28,7 @@ static HMI_ENGINE_RESULT HMI_DemoNotice_PostProcess(SGUI_SCR_DEV* pstDeviceIF, H //=======================================================================// //= Static variable declaration. =// //=======================================================================// -static SGUI_NOTICT_BOX s_stDemoNoticeBox = {0x00}; +static SGUI_NOTICE_BOX s_stDemoNoticeBox = {0x00}; static SGUI_CHAR s_szDemoNoticeText[NOTICE_TEXT_BUFFER_SIZE+1] = {0x00}; HMI_SCREEN_ACTION s_stDemoNoticeActions = { HMI_DemoNotice_Initialize, @@ -54,6 +54,10 @@ HMI_ENGINE_RESULT HMI_DemoNotice_Initialize(SGUI_SCR_DEV* pstDeviceIF) s_stDemoNoticeBox.cszNoticeText = s_szDemoNoticeText; s_stDemoNoticeBox.pstIcon = NULL; SGUI_Notice_FitArea(pstDeviceIF, &(s_stDemoNoticeBox.stLayout)); + + s_stDemoNoticeBox.stPalette.uiDepthBits = 4; + s_stDemoNoticeBox.stPalette.eEdgeColor = 0x0F; + s_stDemoNoticeBox.stPalette.eFillColor = 0x02; return HMI_RET_NORMAL; } diff --git a/DemoProc/src/VariableBox.c b/DemoProc/src/VariableBox.c index 43196d2..976183e 100644 --- a/DemoProc/src/VariableBox.c +++ b/DemoProc/src/VariableBox.c @@ -112,13 +112,17 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_Prepare(SGUI_SCR_DEV* pstDeviceIF, const v /*----------------------------------*/ /* Variable Declaration */ /*----------------------------------*/ - SGUI_NOTICT_BOX stNoticeBox; + SGUI_NOTICE_BOX stNoticeBox; /*----------------------------------*/ /* Initialize */ /*----------------------------------*/ stNoticeBox.pstIcon = &SGUI_RES_ICON_INFORMATION_16; stNoticeBox.cszNoticeText = s_szHelpNoticeText; + + stNoticeBox.stPalette.uiDepthBits = 4; + stNoticeBox.stPalette.eEdgeColor = 0x0F; + stNoticeBox.stPalette.eFillColor = 0x02; /*----------------------------------*/ /* Process */ /*----------------------------------*/ diff --git a/GUI/inc/SGUI_Notice.h b/GUI/inc/SGUI_Notice.h index b0a14fd..7e69593 100644 --- a/GUI/inc/SGUI_Notice.h +++ b/GUI/inc/SGUI_Notice.h @@ -11,16 +11,23 @@ //= Data type definition. =// //=======================================================================// typedef struct +{ + SGUI_UINT8 uiDepthBits; + SGUI_COLOR eEdgeColor; + SGUI_COLOR eFillColor; +}SGUI_NOTICE_PALETTE; +typedef struct { SGUI_CSZSTR cszNoticeText; const SGUI_BMP_RES* pstIcon; SGUI_RECT stLayout; -}SGUI_NOTICT_BOX; + SGUI_NOTICE_PALETTE stPalette; +}SGUI_NOTICE_BOX; //=======================================================================// //= Public function declaration. =// //=======================================================================// -SGUI_SIZE SGUI_Notice_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_NOTICT_BOX* pstObject, const SGUI_FONT_RES* pstFontRes, SGUI_INT uiTextOffset); +SGUI_SIZE SGUI_Notice_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_NOTICE_BOX* pstObject, const SGUI_FONT_RES* pstFontRes, SGUI_INT uiTextOffset); void SGUI_Notice_FitArea(SGUI_SCR_DEV* pstDeviceIF, SGUI_RECT* pstFitArea); #endif // __INCLUDE_GUI_NOTICE_H__ diff --git a/GUI/src/SGUI_Notice.c b/GUI/src/SGUI_Notice.c index fd82f28..41349fa 100644 --- a/GUI/src/SGUI_Notice.c +++ b/GUI/src/SGUI_Notice.c @@ -30,7 +30,7 @@ /** Return: Remaining text height display. **/ /** Notice: None. **/ /*************************************************************************/ -SGUI_SIZE SGUI_Notice_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_NOTICT_BOX* pstObject, const SGUI_FONT_RES* pstFontRes, SGUI_INT uiTextOffset) +SGUI_SIZE SGUI_Notice_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_NOTICE_BOX* pstObject, const SGUI_FONT_RES* pstFontRes, SGUI_INT uiTextOffset) { /*----------------------------------*/ /* Variable Declaration */ @@ -39,14 +39,21 @@ SGUI_SIZE SGUI_Notice_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_NOTICT_BOX* pstObj SGUI_RECT stIconDisplayArea; SGUI_POINT stIconPosition; SGUI_RECT stTextDisplayArea; + SGUI_NOTICE_PALETTE* pstPalette; /*----------------------------------*/ /* Process */ /*----------------------------------*/ if((NULL != pstObject) && (NULL != pstObject->cszNoticeText)) { + pstPalette = &pstObject->stPalette; + if(pstDeviceIF->uiDepthBits != pstPalette->uiDepthBits){ + pstPalette->eEdgeColor = SGUI_Basic_MapColor(pstPalette->uiDepthBits,pstPalette->eEdgeColor,pstDeviceIF->uiDepthBits); + pstPalette->eFillColor = SGUI_Basic_MapColor(pstPalette->uiDepthBits,pstPalette->eFillColor,pstDeviceIF->uiDepthBits); + pstPalette->uiDepthBits= pstDeviceIF->uiDepthBits; + } // Draw edgeNOTICE_BOX_MARGIN - SGUI_Basic_DrawRectangle(pstDeviceIF, pstObject->stLayout.iX, pstObject->stLayout.iY, pstObject->stLayout.iWidth, pstObject->stLayout.iHeight, SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); + SGUI_Basic_DrawRectangle(pstDeviceIF, pstObject->stLayout.iX, pstObject->stLayout.iY, pstObject->stLayout.iWidth, pstObject->stLayout.iHeight, pstPalette->eEdgeColor, pstPalette->eFillColor); stTextDisplayArea.iY = pstObject->stLayout.iY+2; stTextDisplayArea.iHeight = pstObject->stLayout.iHeight-4;