Files
FireAlarmCtrlCn/MyCode/Gui/DevCount.h
2026-04-06 19:02:09 +08:00

179 lines
6.1 KiB
C++

#ifndef DEVCOUNT_H_
#define DEVCOUNT_H_
#include "gType.h"
#include "GraphBase.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "my_string.h"
#include "Device.h"
#include "EpDevice.h"
#include "DevProperty.h"
#include "Icon.h"
#define dLISTVIEW_TYPE_DUMP 0
#define dLISTVIEW_TYPE_SYS 1
#define dLISTVIEW_TYPE_EP 2
#define dLISTVIEW_TYPE_PORT 3
#define dLISTVIEW_TYPE_HANDCTL 4
#define dLISTVIEW_TYPE_DIRECTCTL 5
#define dLISTVIEW_STYLE_LIST 0
#define dLISTVIEW_STYLE_ICON 1
#define dLISTVIEW_VSCOLLBAR_WIDTH 20
//For Device View or Edit
class TDevCount{
public:
static constexpr unsigned short hList[12] = {34,34,34,34, 34,34,34,34, 34,34,34,34};
static constexpr unsigned short wList[12] = {800,800,800,800, 800,800,800,800, 800,800,800,800};
static constexpr TLv Lv = {
.Caption.Left = 0,
.Caption.Top = 36,
.Caption.Width = 800,
.Caption.Heigh = 32,
.Caption.Right = 800 -0 -1,
.Caption.Bottom = 36 + 32,
.Grid.Left = {0,0,0,0, 0,0,0,0, 0,0,0,0},
.Grid.Right = {wList[0]-1,wList[1]-1,wList[2]-1,wList[3]-1, wList[4]-1,wList[5]-1,wList[6]-1,wList[7]-1, wList[8]-1,wList[9]-1,wList[10]-1,wList[11]-1},
.Grid.Top[0] = (36 + 32 +2),
.Grid.Top[1] = (36 + 32 +2) + (2 + hList[0]) +4,
.Grid.Top[2] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]),
.Grid.Top[3] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]),
.Grid.Top[4] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]),
.Grid.Top[5] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]),
.Grid.Top[6] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]),
.Grid.Top[7] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]),
.Grid.Top[8] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]),
.Grid.Top[9] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]),
.Grid.Top[10] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + (2 + hList[9]),
.Grid.Top[11] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + (2 + hList[9]) + (2 + hList[10]),
.Grid.Bottom[0] = (36 + 32 +2) + hList[0],
.Grid.Bottom[1] = (36 + 32 +2) + (2 + hList[0]) + hList[1] +4,
.Grid.Bottom[2] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + hList[2],
.Grid.Bottom[3] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + hList[3],
.Grid.Bottom[4] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + hList[4],
.Grid.Bottom[5] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + hList[5],
.Grid.Bottom[6] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + hList[6],
.Grid.Bottom[7] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + hList[7],
.Grid.Bottom[8] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + hList[8],
.Grid.Bottom[9] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + hList[9],
.Grid.Bottom[10] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + (2 + hList[9]) + hList[10],
.Grid.Bottom[11] = (36 + 32 +2) + (2 + hList[0]) + (6 + hList[1]) + (2 + hList[2]) + (2 + hList[3]) + (2 + hList[4]) + (2 + hList[5]) + (2 + hList[6]) + (2 + hList[7]) + (2 + hList[8]) + (2 + hList[9]) + (2 + hList[10]) + hList[11],
.Grid.UsingCount = 10,
.Panel.Active = 0,
.Panel.ItemType = piMemo,
.PanelSmall.Active = 0,
};
public:
unsigned char PortInx;
unsigned char PortInxTop;
unsigned char Line;
unsigned char IsShowingCount;
struct{
unsigned short Smoke;
unsigned short Tempe;
unsigned short HandReport;
unsigned short HydKp;
unsigned short ModuleInput;
unsigned short ModuleInOut;
unsigned short ModuleOutput;
unsigned short Va;
unsigned short FDisplay;
unsigned short SmokeTempe;
unsigned short LinkPwr;
unsigned short cOther;
unsigned int Tt;
void Reset(){
Smoke =0;
Tempe =0;
HandReport =0;
HydKp =0;
ModuleInput =0;
ModuleInOut =0;
ModuleOutput =0;
Va =0;
FDisplay =0;
SmokeTempe =0;
LinkPwr =0;
cOther =0;
Tt =0;
}
}Count;
public:
char Text[80];
unsigned char HasDraw4P0;
int IsShow;
private:
public:
TDevCount(){};
void Init();
void LoadPath0Item();
void RenderBackGround(void);
void RenderBackGround(unsigned int aClr);
void DrawSelf(void);
void DrawShortList(void);
void DrawList(void);
void Show(void);
void ReDraw(void);
void GetOnePortCount(unsigned char aP0);
void RenderContent(void);
void DrawPortDevCount(unsigned char aP0);
void DrawPortDevCount();
void FullRedraw(int Prm);
void DrawFixText();
TGuiMsgReturn KeyIn(unsigned char aKey);
void ClearPath(void);
void GetTypeAndCount();
int FindStartPoint();
void CheckNewLine(int aLen);
void ShowTypeList(unsigned char aP0, unsigned char Type1, unsigned char Type2, int Is2Type, char *p, int tLen);
void FullRePaint(void);
void RePaint(void);
void DevPropertyInit(void);
void ClearSelectedLv0(void);
void Check4SelectedLv0(void);
int ExtRequst(unsigned char Prm){
IsShow = 0;
return 0;
}
};
#endif