?? vscreen_realtime.c
字號:
case 4: Color = _ColorTemp2; break;
}
_aColorSep[i] = (Color & (0xff << (i * 8))) >> (i * 8);
SLIDER_SetRange(hItem, 0, 255);
SLIDER_SetValue(hItem, _aColorSep[i]);
/* Init EDIT-widgets */
hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0 + i);
EDIT_SetDecMode(hItem, _aColorSep[i], 0, 255, 0, 0);
}
}
break;
case WM_NOTIFICATION_VALUE_CHANGED: /* Value has changed */
{
unsigned Index, v;
WM_HWIN hSlider, hEdit;
if ((Id >= GUI_ID_SLIDER0) && (Id <= GUI_ID_SLIDER2)) {
Index = Id - GUI_ID_SLIDER0;
/* SLIDER-widget has changed, update EDIT-widget */
hSlider = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0 + Index);
hEdit = WM_GetDialogItem(hDlg, GUI_ID_EDIT0 + Index);
v = SLIDER_GetValue(hSlider);
EDIT_SetValue(hEdit, v);
} else if ((Id >= GUI_ID_EDIT0) && (Id <= GUI_ID_EDIT2)) {
Index = Id - GUI_ID_EDIT0;
/* If EDIT-widget has changed, update SLIDER-widget */
hSlider = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0 + Index);
hEdit = WM_GetDialogItem(hDlg, GUI_ID_EDIT0 + Index);
v = EDIT_GetValue(hEdit);
SLIDER_SetValue(hSlider, v);
}
_aColorSep[Index] = v;
/* At last invalidate dialog client window */
WM_InvalidateWindow(WM_GetClientWindow(hDlg));
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
/*********************************************************************
*
* _cbTemperature
*
* Purpose:
* Callback routine of temperature window
*/
static void _cbTemperature(WM_MESSAGE * pMsg) {
WM_HWIN hDlg;
hDlg = pMsg->hWin;
switch (pMsg->MsgId) {
case WM_PAINT:
_LabelGraph();
_DrawGraph();
return;
}
if (_pcbCallbackTemperature) {
_pcbCallbackTemperature(pMsg);
}
}
/*********************************************************************
*
* _cbDialogMain
*
* Purpose:
* Callback routine of DialogMain
*/
static void _cbDialogMain(WM_MESSAGE * pMsg) {
int Id;
WM_HWIN hDlg, hItem;
hDlg = pMsg->hWin;
switch (pMsg->MsgId) {
case WM_PAINT:
break;
case WM_INIT_DIALOG:
/* Init progress bars */
hItem = WM_GetDialogItem(hDlg, GUI_ID_PROGBAR0);
WIDGET_SetEffect(hItem, &WIDGET_Effect_3D);
_SetProgbarValue(GUI_ID_PROGBAR0, _aTemp1[GUI_COUNTOF(_aTemp1) - 1]);
hItem = WM_GetDialogItem(hDlg, GUI_ID_PROGBAR1);
WIDGET_SetEffect(hItem, &WIDGET_Effect_3D);
_SetProgbarValue(GUI_ID_PROGBAR1, _aTemp2[GUI_COUNTOF(_aTemp2) - 1]);
/* Init edit widgets */
hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0);
EDIT_SetDecMode(hItem, _TempMin, 0, 999, 0, 0);
WM_DisableWindow(hItem);
hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT1);
EDIT_SetDecMode(hItem, _TempMax, 0, 999, 0, 0);
WM_DisableWindow(hItem);
/* Init temperature window */
hItem = WM_GetClientWindow(WM_GetDialogItem(hDlg, ID_TEMPERATURE));
_pcbCallbackTemperature = WM_SetCallback(hItem, _cbTemperature);
_UpdateTextColors(hDlg);
break;
case WM_NOTIFY_PARENT:
if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */
switch (Id) {
case GUI_ID_BUTTON0:
WM_SetFocus(_hDialogColor);
GUI_SetOrg(0, 240);
break;
}
}
break;
default:
WM_DefaultProc(pMsg);
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* MainTask
*/
void MainTask(void) {
int Index;
GUI_Init();
#if GUI_SUPPORT_MEMDEV
WM_SetCreateFlags(WM_CF_MEMDEV);
#endif
WM_SetDesktopColor(GUI_BLACK);
/* Initialize the temperature arrays */
_InitRandomData(_aTemp1, GUI_COUNTOF(_aTemp1));
_InitRandomData(_aTemp2, GUI_COUNTOF(_aTemp2));
/* Execute the intro dialog */
GUI_ExecDialogBox(_aDialogIntro, GUI_COUNTOF(_aDialogIntro), _cbDialogIntro, WM_HBKWIN, 0, 0);
/* Execute the color and the temperature dialog */
_hDialogColor = GUI_CreateDialogBox(_aDialogColor, GUI_COUNTOF(_aDialogColor), _cbDialogColor, WM_HBKWIN, 0, 0);
_hDialogMain = GUI_CreateDialogBox(_aDialogMain, GUI_COUNTOF(_aDialogMain), _cbDialogMain, WM_HBKWIN, 0, 0);
/* Add new temperatures... */
Index = GUI_COUNTOF(_aTemp1) - 1;
while (1) {
WM_HWIN hItem;
GUI_Delay(100); /* Wait a while */
/* Shift the color arrays */
memmove(_aTemp1, _aTemp1 + 1, sizeof(_aTemp1) - 2);
memmove(_aTemp2, _aTemp2 + 1, sizeof(_aTemp2) - 2);
/* Add new values */
_aTemp1[Index] = _GetRandomValue(_aTemp1[Index - 1]);
_aTemp2[Index] = _GetRandomValue(_aTemp2[Index - 1]);
/* Update windows */
hItem = WM_GetClientWindow(WM_GetDialogItem(_hDialogMain, ID_TEMPERATURE));
WM_InvalidateWindow(hItem);
_SetProgbarValue(GUI_ID_PROGBAR0, _aTemp1[Index]);
_SetProgbarValue(GUI_ID_PROGBAR1, _aTemp2[Index]);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -