|

楼主 |
发表于 2024-10-31 08:50:18
|
显示全部楼层
/*********************************************************************
* *
* SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
* *
**********************************************************************
* *
* C-file generated by: *
* *
* GUI_Builder for emWin version 5.44 *
* Compiled Nov 10 2017, 08:53:57 *
* (c) 2017 Segger Microcontroller GmbH & Co. KG *
* *
**********************************************************************
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
*/
// USER START (Optionally insert additional includes)
// USER END
#include "DIALOG.h"
#include <stdio.h>
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#define ID_WINDOW_0 (GUI_ID_USER + 0x00)
#define ID_MULTIEDIT_0 (GUI_ID_USER + 0x0A)
#define ID_MULTIEDIT_1 (GUI_ID_USER + 0x0F)
#define ID_MULTIEDIT_2 (GUI_ID_USER + 0x10)
#define ID_MULTIEDIT_3 (GUI_ID_USER + 0x11)
#define ID_MULTIEDIT_4 (GUI_ID_USER + 0x12)
#define ID_MULTIEDIT_5 (GUI_ID_USER + 0x13)
#define ID_MULTIEDIT_6 (GUI_ID_USER + 0x14)
#define ID_MULTIEDIT_7 (GUI_ID_USER + 0x15)
#define ID_TEXT_0 (GUI_ID_USER + 0x20)
// USER START (Optionally insert additional defines)
#define GUI_BkColor 0x00264D
#define GUI_TxBkColor_Blue 0X0080C0
#define GUI_TxBkColor_Green 0X64964B
#define RULER_NUM 16
#define LowBlockInput 1
#define MiddleBlockInput 2
#define HighBlockInput 3
// USER END
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
// USER START (Optionally insert additional static data)
GUI_MEMDEV_Handle hMem;
extern WM_HWIN MainUI;
extern WM_HWIN UI_VERSION;
U8 flag_input = 0;
extern U8 value_select;
extern U8 value_dropdown;
extern const char* Ruler[];
extern const char* dropdown[];
// USER END
/*********************************************************************
*
* _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialog_Window_Transparen[] = {
{ WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 35, 70, 700, 220, 0, 0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_0, 500, 100, 170, 75, 0, 0x0, 0 },
// USER START (Optionally insert additional widgets)
// USER END
};
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 1024, 600, 0, 0x0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_0, 15, 45, 740, 430, 0, 0x0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_1, 500, 125, 170, 75, 0, 0x0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_2, 770, 45, 240, 310, 0, 0x0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_3, 770, 375, 240, 100, 0, 0x0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_4, 770, 490, 240, 100, 0, 0x0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_5, 516, 490, 240, 100, 0, 0x0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_6, 267, 490, 240, 100, 0, 0x0, 0 },
{ MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_7, 15, 490, 240, 100, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text", ID_TEXT_0, 15, 12, 259, 29, 0, 0x64, 0 },
// USER START (Optionally insert additional widgets)
// USER END
};
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
// USER START (Optionally insert additional static code)
// USER END
/*********************************************************************
*
* _cbDialog
*/
static void _cbDialog_Window_Transparent(WM_MESSAGE* pMsg) {
WM_HWIN hItem;
int NCode;
int Id;
// USER START (Optionally insert additional variables)
// USER END
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
hItem = pMsg->hWin;
WINDOW_SetBkColor(hItem,GUI_WHITE);
//WINDOW_SetBkColor(hItem, GUI_RED);
//
// Initialization of 'Multiedit'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_0);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_GREEN);
MULTIEDIT_SetFont(hItem, GUI_FONT_24_ASCII);
MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_EDIT, GUI_WHITE);
MULTIEDIT_ShowCursor(hItem,0);
if (value_select > RULER_NUM)
{
value_select = 2;
}
MULTIEDIT_SetText(hItem, Ruler[value_select]);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (Id) {
case ID_MULTIEDIT_0: // Notifications sent by 'Multiedit'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
WM_HideWindow(MainUI);
CreateSelect();
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
// USER END
}
break;
// USER START (Optionally insert additional message handling)
case WM_PAINT:
GUI_SetColor(GUI_BLACK);
GUI_SetPenSize(2);
GUI_DrawRect(0, 0, 699, 219); //数值显示框
GUI_GotoXY(80,80);
GUI_SetFont(GUI_FONT_D60X80);
GUI_SetColor(GUI_BLACK);
GUI_DispDecShift(5000,5,2);
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
static void _cbDialog(WM_MESSAGE* pMsg) {
WM_HWIN hItem;
int NCode;
int Id;
// USER START (Optionally insert additional variables)
static char TXT_Statistics[99];
// USER END
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
MainUI = pMsg->hWin;
hItem = pMsg->hWin;
WINDOW_SetBkColor(hItem, GUI_BkColor);
//
// Initialization of 'Multiedit'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_0);
MULTIEDIT_SetFont(hItem, GUI_FONT_24_ASCII);
MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLACK);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_WHITE);
MULTIEDIT_ShowCursor(hItem, 0);
MULTIEDIT_SetText(hItem, "\n\n\n\n\n\n\n\n\n\n\n\r\n\
Pressure head parameters:\n\
\
Force:\n\
Hold Time: \n\
Shape correction: ");
/*hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_1);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLACK);
MULTIEDIT_SetFont(hItem, GUI_FONT_24_ASCII);
MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_EDIT, GUI_TxBkColor_Green);
if (value_select > RULER_NUM)
{
value_select = 2;
}
MULTIEDIT_SetText(hItem, Ruler[value_select]);*/
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_2);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, 0X00E040);
MULTIEDIT_SetFont(hItem, GUI_FONT_24B_ASCII);
MULTIEDIT_ShowCursor(hItem, 0);
sprintf(TXT_Statistics, "\n\n 356.56um:\n\n\n coil:14338" );
MULTIEDIT_SetText(hItem, TXT_Statistics);
MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLACK);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_3);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_WHITE);
MULTIEDIT_SetFont(hItem, GUI_FONT_32_ASCII);
MULTIEDIT_ShowCursor(hItem, 0);
MULTIEDIT_SetText(hItem, "\n Confirm");
MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLACK);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_4);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_WHITE);
MULTIEDIT_SetFont(hItem, GUI_FONT_32_ASCII);
MULTIEDIT_ShowCursor(hItem, 0);
MULTIEDIT_SetText(hItem, "\n Exit");
MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLACK);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_5);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_WHITE);
MULTIEDIT_SetFont(hItem, GUI_FONT_32_ASCII);
MULTIEDIT_ShowCursor(hItem, 0);
MULTIEDIT_SetText(hItem, "\n Low block");
MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLACK);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_6);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_WHITE);
MULTIEDIT_SetFont(hItem, GUI_FONT_32_ASCII);
MULTIEDIT_ShowCursor(hItem, 0);
MULTIEDIT_SetText(hItem, "\n Middle block");
MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLACK);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_7);
MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_EDIT, GUI_WHITE);
MULTIEDIT_SetFont(hItem, GUI_FONT_32_ASCII);
MULTIEDIT_ShowCursor(hItem, 0);
MULTIEDIT_SetText(hItem, "\n High block");
MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_EDIT, GUI_BLACK);
// Initialization of 'Text'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
TEXT_SetTextColor(hItem, GUI_WHITE);
TEXT_SetFont(hItem, GUI_FONT_20_ASCII);
TEXT_SetText(hItem, "2024.10.21 15:00");
// USER START (Optionally insert additional code for further widget initialization)
// USER END
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (Id) {
case ID_MULTIEDIT_0: // Notifications sent by 'Multiedit'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_MULTIEDIT_1: // Notifications sent by 'Multiedit'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
// USER START (Optionally insert additional code for further Ids)
case ID_MULTIEDIT_2: // Notifications sent by 'Multiedit'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_MULTIEDIT_3: // Notifications sent by 'Multiedit'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_MULTIEDIT_4: // Notifications sent by 'Multiedit'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
WM_DeleteWindow(pMsg->hWin); //此处有问题
//CreateWindow();
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_MULTIEDIT_5: // Notifications sent by 'Multiedit'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
flag_input = LowBlockInput;
CreateCalibrationInput();
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_MULTIEDIT_6: // Notifications sent by 'Multiedit'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
flag_input = MiddleBlockInput;
CreateCalibrationInput();
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_MULTIEDIT_7: // Notifications sent by 'Multiedit'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
flag_input = HighBlockInput;
CreateCalibrationInput();
// USER END
break;
case WM_NOTIFICATION_VALUE_CHANGED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
// USER END
}
break;
// USER START (Optionally insert additional message handling)
case WM_PAINT:
GUI_SetColor(0X22B14C);
GUI_SetPenSize(3);
GUI_DrawRect(15, 45, 755 , 475); //显示框矩形
break;
case WM_TIMER:
WM_RestartTimer(pMsg->Data.v, 100);
break;
// USER END
default:
WM_DefaultProc(pMsg);
break;
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* CreateWindow
*/
WM_HWIN CreateTransparentWindow_1(WM_HWIN hWin_father);
WM_HWIN CreateTransparentWindow_1(WM_HWIN hWin_father) {
WM_HWIN hWin;
hWin = GUI_CreateDialogBox(_aDialog_Window_Transparen, GUI_COUNTOF(_aDialog_Window_Transparen), _cbDialog_Window_Transparent, hWin_father, 0, 0);
return hWin;
}
WM_HWIN CreateCalibration(void);
WM_HWIN CreateCalibration(void) {
WM_HWIN hWin;
hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
CreateTransparentWindow_1(hWin);
return hWin;
}
// USER START (Optionally insert additional public code)
// USER END
/*************************** End of file ****************************/ |
|