📄 win_status.c~
字号:
Pthread_mutex_unlock( &nStaCount_Mutex ); printf("messageStatusCount -- %d\n",messageStatusCount); skin_enable_item (&status_skin,MESSAGE_BUTTON4,TRUE); SendMessage (animationInfo,ANM_STARTPLAY,0,0); break; case NO_INFOMATION: //Pthread_mutex_lock( &nStaCount_Mutex ); //Pthread_mutex_lock( &cntOverFlow_Mutex ); messageStatusCount = 0; overFlowStarter = 0; cntOverFlow = 0; //Pthread_mutex_unlock( &cntOverFlow_Mutex ); //Pthread_mutex_unlock( &nStaCount_Mutex ); skin_enable_item (&status_skin,MESSAGE_BUTTON4,FALSE); SendMessage (animationInfo,ANM_STOPPLAY,0,0); break; } UpdateWindow (hWndMainStatus, TRUE);}void ShowIntensity(int one,int two){ if (one>=0 && one<=4 ){ ChangeStateBmp (&status_skin, FALSE,1,-1); //卸载指定的任务栏区皮肤元素位图资源 ChangeStateBmp (&status_skin, TRUE ,1, one); //装载指定的任务栏区皮肤元素位图资源 } if (two>=0 && two<=4 ){ ChangeStateBmp (&status_skin, FALSE,2,-1); //卸载指定的任务栏区皮肤元素位图资源 ChangeStateBmp (&status_skin, TRUE ,2, two); //装载指定的任务栏区皮肤元素位图资源 } UpdateWindow (hWndMainStatus, TRUE);}void ShowCell(int IDcard,int cell , int cellSta)//0充电,{ ChangeStateBmp (&status_skin, FALSE,7,-1); //卸载指定的任务栏区皮肤元素位图资源 ChangeStateBmp (&status_skin, TRUE ,7, IDcard); //装载指定的任务栏区皮肤元素位图资源 if (cellSta != CELL_CHONGDIAN) { skin_enable_item (&status_skin,SIID_BATTERY,TRUE); skin_show_item (&status_skin,SIID_BATTERY,TRUE); ShowWindow ( animationCell, SW_HIDE); //SendMessage (animationCell,ANM_STOPPLAY,0,0); ChangeStateBmp (&status_skin, FALSE,8,-1); //卸载指定的任务栏区皮肤元素位图资源 ChangeStateBmp (&status_skin, TRUE ,8, cell); //装载指定的任务栏区皮肤元素位图资源 UpdateWindow (hWndMainStatus, TRUE); } else { skin_enable_item (&status_skin,SIID_BATTERY,FALSE); skin_show_item (&status_skin,SIID_BATTERY,FALSE); ShowWindow ( animationCell, SW_SHOW); SendMessage (animationCell,ANM_STARTPLAY,0,0); }}void ShowErrs(int err){ switch(err) { case ALARM_OK: ShowWindow ( animationAlarmOK, SW_SHOW); ShowWindow ( animationAlarmCRC, SW_HIDE); ShowWindow ( animationAlarmNav, SW_HIDE); ShowWindow ( animationAlarmLoc, SW_HIDE); SendMessage (animationAlarmCRC,ANM_STOPPLAY,0,0); SendMessage (animationAlarmNav,ANM_STOPPLAY,0,0); SendMessage (animationAlarmLoc,ANM_STOPPLAY,0,0); break; case ALARM_NAV: ShowWindow ( animationAlarmOK, SW_HIDE); ShowWindow ( animationAlarmCRC, SW_SHOW); SendMessage (animationAlarmCRC,ANM_STARTPLAY,0,0); ShowWindow ( animationAlarmNav, SW_HIDE); ShowWindow ( animationAlarmLoc, SW_HIDE); break; case ALARM_CRC: ShowWindow ( animationAlarmOK, SW_HIDE); ShowWindow ( animationAlarmCRC, SW_HIDE); ShowWindow ( animationAlarmNav, SW_SHOW); SendMessage (animationAlarmNav,ANM_STARTPLAY,0,0); ShowWindow ( animationAlarmLoc, SW_HIDE); break; case ALARM_LOC: ShowWindow ( animationAlarmOK, SW_HIDE); ShowWindow ( animationAlarmCRC, SW_HIDE); ShowWindow ( animationAlarmNav, SW_HIDE); ShowWindow ( animationAlarmLoc, SW_SHOW); SendMessage (animationAlarmLoc,ANM_STARTPLAY,0,0); break; }}/* 皮肤事件回调函数 */static int main_event_cb (HWND hwnd, skin_item_t* item, int event, void* data){ char buf[256]; static int click_num = 0; skin_head_t *hostskin = NULL; static int i; int k; if ((event == SIE_GAIN_FOCUS) && (item->id==SIID_TIMER)) { //switch (item->id) { //}end of switch } else if(event == SIE_BUTTON_CLICKED) { switch (item->id) { case SIID_INTENSITY: case SIID_INTENSITY_1: printf("case STATE_PLANNET_BUTTON1:\n"); k=i%7; ShowIntensity(k,k); i++; break; case STATE_PLANNET_BUTTON2: printf("case STATE_PLANNET_BUTTON2:\n"); if(i%2==0){ printf("if(i%2==0) case STATE_PLANNET_BUTTON2:\n"); ShowPlannetState (STATUS_OK); } else { printf(" else case STATE_PLANNET_BUTTON2:\n"); ShowPlannetState (STATUS_NOTWORK); } i++; break; case STATE_ALARM3 : printf("case STATE_PLANNET_BUTTON3:\n"); if (sysLookAlarm_OpenFlag == 1) { SendMessage (hWndMainSysLookAlarm,MSG_CLOSENEWLOOK,0,0); } ShowErrs(ALARM_OK); win_SysLookAlarm(hWndMain,1); ShowWindow ( currShowWindowHwnd, SW_HIDE); break; case MESSAGE_BUTTON4: if ( win_newMesgOpen == WIN_NEWMESGOPEN) { SendMessage (hWndMain_infolook,MSG_CLOSENEWLOOK,0,0); } Pthread_mutex_lock( &nStaCount_Mutex ); Pthread_mutex_lock( &cntOverFlow_Mutex ); if (messageStatusCount>0) { messageStatusCount -- ; if(messageStatusCount==0) { //printf("---------if(messageStatusCount==0)------------\n"); SendMessage (animationInfo,ANM_STOPPLAY,0,0); skin_enable_item (&status_skin,MESSAGE_BUTTON4,FALSE); } //printf("overFlowStarter=%d;cntOverFlow=%d\n",overFlowStarter,cntOverFlow); if (currShowWindowHwnd == hWndMainnoSpace) { printf("!!!!!!!!!!!!!!!!Enter lower!!!!!!!!1\n"); Pthread_mutex_unlock( &cntOverFlow_Mutex ); Pthread_mutex_unlock( &nStaCount_Mutex ); SendMessage (hWndMainnoSpace,MSG_READOVERFLOW,0,0); ShowWindow (currShowWindowHwnd, SW_HIDE); win_noSpaceAlarm(hWndMain,-1); return; } if( ( overFlowStarter==1 ||(cntOverFlow==messageStatusCount+1) ) && cntOverFlow!=0 ) { printf("!!!!!!!!!!!!!!!!Enter Upper!!!!!!!!1\n"); ShowWindow (currShowWindowHwnd, SW_HIDE); win_noSpaceAlarm(hWndMain,-1); } else { ReadNewMesg(GetCount(INBOX, TYPE_OF_TXXX)); ShowWindow (currShowWindowHwnd, SW_HIDE); win_InfoLook (hWndMain, 0, 10); } } Pthread_mutex_unlock( &cntOverFlow_Mutex ); Pthread_mutex_unlock( &nStaCount_Mutex ); printf("MESSAGE_BUTTON4 messageStatusCount -- %d\n",messageStatusCount); break; case SIID_TIMER_BUTTON5: printf("case STATE_PLANNET_BUTTON5:\n"); ShowCell(1,i%6,i%5); i++; break; case SIID_BATTERY: printf("case STATE_PLANNET_BUTTON6:\n"); break; } } return 1;}/* 皮肤窗口消息回调函数 */static int msg_event_cb (HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int* result){ char buf[9]; skin_head_t *hostskin = NULL; ANIMATION* anim; switch (message) { case MSG_CREATE: // anim= CreateAnimationFromGIF89aFile (HDC_SCREEN, "./Pictures/Status.gif"); SetWindowAdditionalData (hwnd ,(DWORD)anim); animationSta = CreateWindow (CTRL_ANIMATION,"",WS_VISIBLE | ANS_AUTOLOOP,1002,ZTL_WIDTH_*1,0,20,16,hwnd,(DWORD)anim); //alarm anim= CreateAnimationFromGIF89aFile (HDC_SCREEN, "./Pictures/Alarm.gif"); SetWindowAdditionalData (hwnd ,(DWORD)anim); animationAlarmOK = CreateWindow (CTRL_ANIMATION,"",WS_VISIBLE | ANS_AUTOLOOP,1003,ZTL_WIDTH_*2,0,20,16,hwnd,(DWORD)anim); anim= CreateAnimationFromGIF89aFile (HDC_SCREEN, "./Pictures/InfoErr.gif"); SetWindowAdditionalData (hwnd ,(DWORD)anim); animationAlarmCRC = CreateWindow (CTRL_ANIMATION,"",WS_VISIBLE | ANS_AUTOLOOP,1013,ZTL_WIDTH_*2,0,20,16,hwnd,(DWORD)anim); anim= CreateAnimationFromGIF89aFile (HDC_SCREEN, "./Pictures/NavErr.gif"); SetWindowAdditionalData (hwnd ,(DWORD)anim); animationAlarmNav = CreateWindow (CTRL_ANIMATION,"",WS_VISIBLE | ANS_AUTOLOOP,1023,ZTL_WIDTH_*2,0,20,16,hwnd,(DWORD)anim); anim= CreateAnimationFromGIF89aFile (HDC_SCREEN, "./Pictures/LocErr.gif"); SetWindowAdditionalData (hwnd ,(DWORD)anim); animationAlarmLoc = CreateWindow (CTRL_ANIMATION,"",WS_VISIBLE | ANS_AUTOLOOP,1033,ZTL_WIDTH_*2,0,20,16,hwnd,(DWORD)anim); ShowErrs(ALARM_OK);//init OK anim= CreateAnimationFromGIF89aFile (HDC_SCREEN, "./Pictures/Cell.gif"); SetWindowAdditionalData (hwnd ,(DWORD)anim); animationCell = CreateWindow (CTRL_ANIMATION,"",WS_VISIBLE | ANS_AUTOLOOP,1003,ZTL_WIDTH_*5,0,20,16,hwnd,(DWORD)anim); ShowCell(1,1,1);//init anim= CreateAnimationFromGIF89aFile (HDC_SCREEN, "./Pictures/d_information.gif"); //SetWindowAdditionalData (hwnd ,(DWORD)anim); animationInfo = CreateWindow (CTRL_ANIMATION,"",WS_VISIBLE | ANS_AUTOLOOP,1001,ZTL_WIDTH_*3,0,20,16,hwnd,(DWORD)anim); //SendMessage (animationInfo,ANM_STARTPLAY,0,0); //初始化装载位图资源时,就应调用一次后台服务函数winServ()去查询判断系统状态从而正确装载对应的资源 //GetSysTime( &initTime ); GetSysTime( &initTime ); currTime=InitDispTime( &initTime ); //靠靠靠靠靠靠靠靠靠靠靠 if(&initTime != NULL) { if((initTime.hour) > 23) currTime.hour=0; else currTime.hour=initTime.hour; if((initTime.min) > 59) currTime.min=0; else currTime.min=initTime.min; if((initTime.sec) >59) currTime.sec=0; else currTime.sec=initTime.sec; } skin_enable_item (&status_skin,MESSAGE_BUTTON4,FALSE); DispTimeNum( hwnd,SIID_TIMER,&currTime); SetTimer (hwnd,ID_TIME,100);//靠靠靠?靠靠靠靠縄D_TIME靠靠靠靠靠靠hWnd break; case MSG_TIMER: if ( (++currTime.sec) > 59) { currTime.sec=0; //秒钟逢60进1 if ( (++currTime.min) > 59) { currTime.min=0;//分钟逢60进1 if ( (++currTime.hour) > 23) currTime.hour=0; } } DispTimeNum( hwnd,SIID_TIMER,&currTime); break; case MSG_DESTROY: KillTimer(hwnd,ID_TIME); DestroyAnimation ((ANIMATION*)GetWindowAdditionalData(hwnd), TRUE); break; } return 1;} void win_statusbar (HWND hwnd ){ MSG msg; InitMiniGUIExt(); LoadSkinBmps (&status_skin, TRUE,currentBmps,(sizeof (currentBmps))/sizeof(char *)); if (status_skin.bmps == NULL) { printf ("Could not load skin bitmaps!\n"); } if ( !skin_init (&status_skin, main_event_cb, msg_event_cb) ){ printf ("skin init fail!\n"); } else{ hWndMainStatus = create_skin_control (&status_skin, hwnd,143, 0, 0, DEF_WIDTH, 18); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -