📄 syssrcinfo.c
字号:
/*sysSrclnfo.c*/#include "sysSrcInfo.h"int hidePageCount=0;//for return 主界面//int hidePageCount=2;//for return 主界面int returnMainPageFlag=0;//点击返回主界面为1,否则为0int returnflag=0;//点击返回为1,否则为0//create menu control (iconview)static void myDrawItemMenu (HWND hWnd, GHANDLE hsvi, HDC hdc, RECT *rcDraw){ const PBITMAP pbmp = (PBITMAP)iconview_get_item_bitmap (hsvi); const char *label = (const char*)iconview_get_item_label (hsvi); SetBkMode (hdc, BM_TRANSPARENT); SetTextColor (hdc, PIXEL_black); //SetTextColor (hdc, PIXEL_lightwhite); if (iconview_is_item_hilight(hWnd, hsvi)) { SetBrushColor (hdc, PIXEL_lightgray); } else { SetBrushColor (hdc, PIXEL_lightwhite);//lightgray } FillBox (hdc, rcDraw->left, rcDraw->top, RECTWP(rcDraw), RECTHP(rcDraw));//select state SetBkColor (hdc, PIXEL_lightgray); //SetBkMode (hdc, BM_TRANSPARENT); if (label) { RECT rcTxt = *rcDraw;// rcTxt.top = rcTxt.bottom - GetWindowFont (hWnd)->size * 2; rcTxt.top = rcTxt.bottom - (GetWindowFont (hWnd)->size) *1.1; rcTxt.left = rcTxt.left - (GetWindowFont (hWnd)->size) +18; DrawText (hdc, label, -1, &rcTxt, DT_SINGLELINE | DT_LEFT);//DT_CENTER | DT_VCENTER); } FillBoxWithBitmap (hdc, rcDraw->left, rcDraw->top, 0, 0, pbmp);//fill pic}/*static void myDrawItemMenu (HWND hWnd, GHANDLE hsvi, HDC hdc, RECT *rcDraw){ const PBITMAP pbmp = (PBITMAP)iconview_get_item_bitmap (hsvi); const char *label = (const char*)iconview_get_item_label (hsvi); SetBkMode (hdc, BM_TRANSPARENT); SetTextColor (hdc, PIXEL_black); if (iconview_is_item_hilight(hWnd, hsvi)) { SetBrushColor (hdc, PIXEL_blue); } else { SetBrushColor (hdc, PIXEL_lightwhite); } FillBox (hdc, rcDraw->left, rcDraw->top, RECTWP(rcDraw), RECTHP(rcDraw));//select state SetBkColor (hdc, PIXEL_red); if (label) { RECT rcTxt = *rcDraw;// rcTxt.top = rcTxt.bottom - GetWindowFont (hWnd)->size * 2; rcTxt.top = rcTxt.bottom - (GetWindowFont (hWnd)->size) *1.1; rcTxt.left = rcTxt.left - (GetWindowFont (hWnd)->size); DrawText (hdc, label, -1, &rcTxt, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } FillBoxWithBitmap (hdc, rcDraw->left, rcDraw->top, 0, 0, pbmp);//fill pic}*/HWND CreateMenuWindow(HWND hwnd , int width, int rowcount, int NO)//CreateMenuWindow(hwnd ,38,MENU_Y, 85, 75,17,7 ,1185);{ HWND hwnd1; int x,y,y1 ,high,item_width ,item_high ; item_width = width-10; item_high = 16; x = (160-width)/2; //high = item_high * rowcount+7; high = item_high * rowcount; y = MENU_Y - high; hwnd1 = CreateWindow (CTRL_ICONVIEW,"myiconview",WS_CHILD // |WS_DISABLED ,757,25,1,100,173,hwnd,1); |WS_DISABLED ,NO, x, y,width,high,hwnd,1); // |WS_VSCROLL | WS_HSCROLL |WS_DISABLED ,757,25,1,100,173,hwnd,1); SendMessage (hwnd1, IVM_SETITEMSIZE, item_width, item_high); SendMessage (hwnd1, IVM_SETITEMDRAW, 0, (LPARAM)myDrawItemMenu); RECT rcMargin; rcMargin.left=10; rcMargin.right = 0; rcMargin.top =0; rcMargin.bottom =0; SendMessage (hwnd1, IVM_SETMARGINS, 0, (LPARAM)&rcMargin); //SetBkColor (hwnd1, PIXEL_lightgray); //SetWindowBkColor (hwnd1, PIXEL_lightgray); SetWindowBkColor (hwnd1, PIXEL_cyan); return hwnd1;}/*HWND CreateMenuWindow(HWND hwnd , int width, int rowcount, int NO)//CreateMenuWindow(hwnd ,38,MENU_Y, 85, 75,17,7 ,1185);{ HWND hwnd1; int x,y,y1 ,high,item_width ,item_high ; item_width = width-10; item_high = 16; x = (160-width)/2; high = item_high * rowcount+7; y = MENU_Y - high; hwnd1 = CreateWindow (CTRL_ICONVIEW,"myiconview",WS_CHILD // |WS_DISABLED ,757,25,1,100,173,hwnd,1); |WS_DISABLED ,NO, x, y,width,high,hwnd,1); // |WS_VSCROLL | WS_HSCROLL |WS_DISABLED ,757,25,1,100,173,hwnd,1); SendMessage (hwnd1, IVM_SETITEMSIZE, item_width, item_high); SendMessage (hwnd1, IVM_SETITEMDRAW, 0, (LPARAM)myDrawItemMenu); RECT rcMargin; rcMargin.left=10; rcMargin.top =0; SendMessage (hwnd1, IVM_SETMARGINS, 0, (LPARAM)&rcMargin); //SetBkColor (hwnd1, PIXEL_lightwhite); //SetWindowBkColor (hwnd1, PIXEL_black); return hwnd1;}*/static void myDrawItemChild (HWND hWnd, GHANDLE hsvi, HDC hdc, RECT *rcDraw){ const PBITMAP pbmp = (PBITMAP)iconview_get_item_bitmap (hsvi); const char *label = (const char*)iconview_get_item_label (hsvi); SetBkMode (hdc, BM_TRANSPARENT); SetTextColor (hdc, PIXEL_black); gal_pixel pixel = RGB2Pixel (HDC_SCREEN, 99, 189, 231); if (iconview_is_item_hilight(hWnd, hsvi)) { SetBrushColor (hdc, PIXEL_lightgray); } else { //SetBrushColor (hdc, PIXEL_lightwhite);//lightgray //SetBrushColor (hdc, PIXEL_darkyellow);//lightgray] SetBrushColor (hdc, pixel); //SetBkColor (hdc, PIXEL_lightwhite); } FillBox (hdc, rcDraw->left, rcDraw->top, RECTWP(rcDraw), RECTHP(rcDraw));//select state SetBkColor (hdc, PIXEL_lightwhite); SetBkMode (hdc, BM_TRANSPARENT); if (label) { RECT rcTxt = *rcDraw;// rcTxt.top = rcTxt.bottom - GetWindowFont (hWnd)->size * 2; rcTxt.top = rcTxt.bottom - (GetWindowFont (hWnd)->size) *1.1; rcTxt.left = rcTxt.left - (GetWindowFont (hWnd)->size) + 45; DrawText (hdc, label, -1, &rcTxt, DT_SINGLELINE | DT_LEFT);//DT_CENTER | DT_VCENTER); } FillBoxWithBitmap (hdc, rcDraw->left, rcDraw->top, 0, 0, pbmp);//fill pic}HWND CreateChildWindow(HWND hwnd ,int x,int y, int width, int high,int NO){ HWND hwnd1; hwnd1 = CreateWindow (CTRL_ICONVIEW,"myiconview",WS_CHILD | WS_VISIBLE |WS_VSCROLL |WS_HSCROLL ,NO,0,20,160,152,hwnd,1); SendMessage (hwnd1, IVM_SETITEMDRAW, 0, (LPARAM)myDrawItemChild); //SetWindowBkColor (hwnd1,PIXEL_lightwhite); //SetWindowBkColor (hwnd1,PIXEL_lightwhite); SendMessage (hwnd1, IVM_SETITEMSIZE,width-10, 20); // SetBkColor (hwnd1, PIXEL_lightgray); //SetWindowBkColor (hwnd1, PIXEL_darkyellow); //SetWindowBkColor (hwnd1, PIXEL_darkblue); gal_pixel pixel = RGB2Pixel (HDC_SCREEN, 99, 189, 231); SetWindowBkColor (hwnd1, pixel); return hwnd1;}static void myDrawItemChild_INFO (HWND hWnd, GHANDLE hsvi, HDC hdc, RECT *rcDraw){ const PBITMAP pbmp = (PBITMAP)iconview_get_item_bitmap (hsvi); const char *label = (const char*)iconview_get_item_label (hsvi); SetBkMode (hdc, BM_TRANSPARENT); SetTextColor (hdc, PIXEL_black); if (iconview_is_item_hilight(hWnd, hsvi)) { SetBrushColor (hdc, PIXEL_green); } else { SetBrushColor (hdc, PIXEL_lightwhite); } FillBox (hdc, rcDraw->left, rcDraw->top, RECTWP(rcDraw), RECTHP(rcDraw));//select state SetBkColor (hdc, PIXEL_lightwhite); if (label) { RECT rcTxt = *rcDraw;// rcTxt.top = rcTxt.bottom - GetWindowFont (hWnd)->size * 2; rcTxt.top = rcTxt.bottom - (GetWindowFont (hWnd)->size) *1.1; rcTxt.left = rcTxt.left - (GetWindowFont (hWnd)->size) + 35; DrawText (hdc, label, -1, &rcTxt, DT_SINGLELINE | DT_LEFT); } FillBoxWithBitmap (hdc, rcDraw->left, rcDraw->top, 0, 0, pbmp);//fill pic}HWND CreateChildWindow_INFO(HWND hwnd,int x,int y,int width ,int high,int NO){ HWND hwnd1; hwnd1= CreateWindow (CTRL_ICONVIEW,"myiconview",WS_CHILD | WS_VISIBLE | WS_BORDER |WS_VSCROLL |WS_HSCROLL ,NO,0,y,160,high,hwnd,1); SetWindowBkColor (hwnd1,PIXEL_lightwhite); SendMessage (hwnd1, IVM_SETITEMDRAW, 0, (LPARAM)myDrawItemChild_INFO);/// //SetNotificationCallback ( hIV_child_InfoInbox ,FU_notif_proc_child_Inbox );//回调 //SendMessage (hIV_child_InfoInbox, IVM_SETITEMSIZE, 138.5, 20); SendMessage (hwnd1, IVM_SETITEMSIZE, 130, 15); return hwnd1;} Time InitDispTime( Time *time ){ Time currTime; if(time != NULL) { if((time->hour) > 23) currTime.hour=0; else currTime.hour=time->hour; if((time->min) > 59) currTime.min=0; else currTime.min=time->min; if((time->sec) >59) currTime.sec=0; else currTime.sec=time->sec; if((time->mon) >11) currTime.mon=0; else currTime.mon=time->mon +1; if((time->mday) >31) currTime.mday=1; else currTime.mday=time->mday; currTime.year=time->year+1900; } return currTime;}int DispSetTime(HWND hwnd,int control_id,int detailTime,BOOL isYear){ char buff[5]; if(isYear ) sprintf (buff, "%04d ", detailTime); else sprintf (buff, "%02d ", detailTime); SetWindowText (GetDlgItem (hwnd, control_id), buff); return 0; }int GetSysTime(Time *stime)//ok{ time_t now; struct tm *currtime; time(&now); currtime=localtime(&now); stime->hour=currtime->tm_hour; stime->min=currtime->tm_min; stime->sec=currtime->tm_sec;///////////////////////////// stime->mday=currtime->tm_mday; stime->mon=currtime->tm_mon; stime->year=currtime->tm_year; return 0;}int SetSysTime(Time *settime){ time_t now; struct tm *currtime; time(&now); currtime=localtime(&now); currtime->tm_hour=settime->hour; currtime->tm_min=settime->min; currtime->tm_sec=settime->sec;//////////////////////////////currtime->tm_mday=stime->mday;//currtime->tm_mon=stime->mon;//currtime->tm_year=stime->year; now=mktime(currtime); stime(&now); return 0;}int DispTimeNum( HWND hwnd,int skin_id,Time *disTime){ char buf[10]; skin_head_t *hostskin=NULL; sprintf (buf, "%02d:%02d", disTime->hour, disTime->sec); hostskin = get_window_skin (hwnd); skin_set_item_label (hostskin, skin_id, buf); return 0; }void LoadSkinBmps (skin_head_t *skin, BOOL load ,const char *bmpsPath[],int bmp_num ){ int i; //int bmp_num = sizeof ( bmpsPath )/ sizeof(char *); //sizeof如用于数组,只能测出静态数组的大小,无法检测动态分配的或外部数组大小 /* 如果load为真,则将位图装载到skin的bmps数组,否则卸载bmps数组中的位图 */ if (load) skin->bmps = (BITMAP* ) calloc (bmp_num, sizeof(BITMAP)); for (i = 0 ; i < bmp_num ; i++ ) { if( load ) { if(LoadBitmapFromFile (HDC_SCREEN, (PBITMAP)&(skin->bmps[i]), bmpsPath[i] )) { free ((void*)skin->bmps); skin->bmps = NULL; } } else UnloadBitmap ((PBITMAP)&( skin->bmps[i] )); } if (!load) free ((void*)skin->bmps); }/*void SetTextStringType( HDC *pHdc ){ SetBkMode (*pHdc, BM_TRANSPARENT); //SetBrushColor (*pHdc, PIXEL_black); SetTextColor (*pHdc,PIXEL_blue); // SetBkColor (*pHdc,PIXEL_black);}HWND CreateAlarmWindow (HWND hwnd ,char * Pstring,int x,int y,int w,int h)//in zhuang tai lan{ HWND hwnd1; hwnd1= CreateWindow ( "static", Pstring, WS_VISIBLE | SS_SIMPLE, IDC_STATIC, x, y, w, h, hwnd, 0); return hwnd1;}HWND CreateCoordinateWindow (HWND hwnd)//坐标系类型{ int i; HWND hwndCoor; const char *coordiLabels_loclocate[] = { "北京54-大地坐标",// "北京54-高斯坐标",// "北京54-麦卡托",// "北京54-空间直角",// "北京54-WGS84",// }; gal_pixel pixel = RGB2Pixel (HDC_SCREEN, 0xFF, 0xFF, 0xFF);//set the color hwndCoor = CreateWindow( CTRL_COMBOBOX, "", WS_CHILD | WS_VISIBLE | CBS_EDITNOBORDER|//WS_BORDER|// CBS_READONLY|CBS_SPINARROW_LEFTRIGHT |CBS_SORT|CBS_SPINLIST, 2343, RJ_X, 144 , 90, 25, hwnd, 0); SetWindowBkColor (hwndCoor, pixel); for(i=0;i<5;i++) { SendMessage (hwndCoor, CB_ADDSTRING, 0, (LPARAM)coordiLabels_loclocate[i]);//(LPARAM) } SendMessage (hwndCoor, CB_SETCURSEL, GetCurrCoordinate (), 0 );//默认为系统设置的 return hwndCoor;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -