int show_mask3(PARAM *p) { DATA d; char event[MAX_EVENT_LENGTH]; char text[MAX_EVENT_LENGTH]; int i; pvDownloadFile(p,"homer.bmp.orig"); pvDownloadFile(p,"homer.bmp.transp"); pvDownloadFile(p,"homer2.bmp"); defineMask(p); pvResize(p,ID_MAIN_WIDGET,1280,1024); memset(&d,0,sizeof(DATA)); readData(&d); // from shared memory or out of database showData(p,&d); while(1) { pvPollEvent(p,event); switch(pvParseEvent(event, &i, text)) { case NULL_EVENT: readData(&d); // from shared memory or out of database showData(p,&d); break; case BUTTON_EVENT: printf("BUTTON_EVENT id=%d\n",i); if(i == ID_BUTTON_MASK1) return 1; if(i == ID_BUTTON_MASK2) return 2; if(i == ID_BUTTON_MASK3) pvDownloadFile(p,"homer.bmp.orig"); if(i == ID_PRINT) pvPrint(p,ID_GRAPHIC); printf("BUTTON_EVENT done\n"); break; case BUTTON_PRESSED_EVENT: printf("BUTTON_PRESSED_EVENT id=%d\n",i); break; case BUTTON_RELEASED_EVENT: printf("BUTTON_RELEASED_EVENT id=%d\n",i); break; case TEXT_EVENT: printf("TEXT_EVENT id=%d %s\n",i,text); break; default: printf("UNKNOWN_EVENT id=%d %s\n",i,text); break; } } }
int show_mask2(PARAM *p) { DATA d; char event[MAX_EVENT_LENGTH]; char text[MAX_EVENT_LENGTH]; int i; defineMask(p); pvDownloadFile(p,"k3b_success1.wav"); pvPlaySound(p,"k3b_success1.wav"); memset(&d,0,sizeof(DATA)); readData(&d); // from shared memory or out of database showData(p,&d); while(1) { pvPollEvent(p,event); switch(pvParseEvent(event, &i, text)) { case NULL_EVENT: readData(&d); // from shared memory or out of database showData(p,&d); break; case BUTTON_EVENT: printf("BUTTON_EVENT id=%d\n",i); if(i == ID_BUTTON_MASK1) return 1; if(i == ID_BUTTON_MASK2) return 2; if(i == ID_BUTTON_MASK3) return 3; break; case BUTTON_PRESSED_EVENT: printf("BUTTON_PRESSED_EVENT id=%d\n",i); break; case BUTTON_RELEASED_EVENT: printf("BUTTON_RELEASED_EVENT id=%d\n",i); break; case TEXT_EVENT: printf("TEXT_EVENT id=%d %s\n",i,text); break; default: printf("UNKNOWN_EVENT id=%d %s\n",i,text); break; } } }
int show_mask1(PARAM *p) { DATA d; char event[MAX_EVENT_LENGTH]; char text[MAX_EVENT_LENGTH]; char str1[MAX_EVENT_LENGTH]; int i,w,h,val,x,y,button,ret; float xval, yval; defineMask(p); //rlSetDebugPrintf(1); if((ret=slotInit(p,&d)) != 0) return ret; readData(&d); // from shared memory, database or something else showData(p,&d); pvClearMessageQueue(p); while(1) { pvPollEvent(p,event); switch(pvParseEvent(event, &i, text)) { case NULL_EVENT: readData(&d); // from shared memory, database or something else showData(p,&d); if((ret=slotNullEvent(p,&d)) != 0) return ret; break; case BUTTON_EVENT: if(trace) printf("BUTTON_EVENT id=%d\n",i); if((ret=slotButtonEvent(p,i,&d)) != 0) return ret; break; case BUTTON_PRESSED_EVENT: if(trace) printf("BUTTON_PRESSED_EVENT id=%d\n",i); if((ret=slotButtonPressedEvent(p,i,&d)) != 0) return ret; break; case BUTTON_RELEASED_EVENT: if(trace) printf("BUTTON_RELEASED_EVENT id=%d\n",i); if((ret=slotButtonReleasedEvent(p,i,&d)) != 0) return ret; break; case TEXT_EVENT: if(trace) printf("TEXT_EVENT id=%d %s\n",i,text); if((ret=slotTextEvent(p,i,&d,text)) != 0) return ret; break; case SLIDER_EVENT: sscanf(text,"(%d)",&val); if(trace) printf("SLIDER_EVENT val=%d\n",val); if((ret=slotSliderEvent(p,i,&d,val)) != 0) return ret; break; case CHECKBOX_EVENT: if(trace) printf("CHECKBOX_EVENT id=%d %s\n",i,text); if((ret=slotCheckboxEvent(p,i,&d,text)) != 0) return ret; break; case RADIOBUTTON_EVENT: if(trace) printf("RADIOBUTTON_EVENT id=%d %s\n",i,text); if((ret=slotRadioButtonEvent(p,i,&d,text)) != 0) return ret; break; case GL_INITIALIZE_EVENT: if(trace) printf("you have to call initializeGL()\n"); if((ret=slotGlInitializeEvent(p,i,&d)) != 0) return ret; break; case GL_PAINT_EVENT: if(trace) printf("you have to call paintGL()\n"); if((ret=slotGlPaintEvent(p,i,&d)) != 0) return ret; break; case GL_RESIZE_EVENT: sscanf(text,"(%d,%d)",&w,&h); if(trace) printf("you have to call resizeGL(w,h)\n"); if((ret=slotGlResizeEvent(p,i,&d,w,h)) != 0) return ret; break; case GL_IDLE_EVENT: if((ret=slotGlIdleEvent(p,i,&d)) != 0) return ret; break; case TAB_EVENT: sscanf(text,"(%d)",&val); if(trace) printf("TAB_EVENT(%d,page=%d)\n",i,val); if((ret=slotTabEvent(p,i,&d,val)) != 0) return ret; break; case TABLE_TEXT_EVENT: sscanf(text,"(%d,%d,",&x,&y); pvGetText(text,str1); if(trace) printf("TABLE_TEXT_EVENT(%d,%d,\"%s\")\n",x,y,str1); if((ret=slotTableTextEvent(p,i,&d,x,y,str1)) != 0) return ret; break; case TABLE_CLICKED_EVENT: sscanf(text,"(%d,%d,%d)",&x,&y,&button); if(trace) printf("TABLE_CLICKED_EVENT(%d,%d,button=%d)\n",x,y,button); if((ret=slotTableClickedEvent(p,i,&d,x,y,button)) != 0) return ret; break; case SELECTION_EVENT: sscanf(text,"(%d,",&val); pvGetText(text,str1); if(trace) printf("SELECTION_EVENT(column=%d,\"%s\")\n",val,str1); if((ret=slotSelectionEvent(p,i,&d,val,str1)) != 0) return ret; break; case CLIPBOARD_EVENT: sscanf(text,"(%d",&val); if(trace) printf("CLIPBOARD_EVENT(id=%d)\n",val); if(trace) printf("clipboard = \n%s\n",p->clipboard); if((ret=slotClipboardEvent(p,i,&d,val)) != 0) return ret; break; case RIGHT_MOUSE_EVENT: if(trace) printf("RIGHT_MOUSE_EVENT id=%d text=%s\n",i,text); if((ret=slotRightMouseEvent(p,i,&d,text)) != 0) return ret; break; case KEYBOARD_EVENT: sscanf(text,"(%d",&val); if(trace) printf("KEYBOARD_EVENT modifier=%d key=%d\n",i,val); if((ret=slotKeyboardEvent(p,i,&d,val,i)) != 0) return ret; break; case PLOT_MOUSE_MOVED_EVENT: sscanf(text,"(%f,%f)",&xval,&yval); if(trace) printf("PLOT_MOUSE_MOVE %f %f\n",xval,yval); if((ret=slotMouseMovedEvent(p,i,&d,xval,yval)) != 0) return ret; break; case PLOT_MOUSE_PRESSED_EVENT: sscanf(text,"(%f,%f)",&xval,&yval); if(trace) printf("PLOT_MOUSE_PRESSED %f %f\n",xval,yval); if((ret=slotMousePressedEvent(p,i,&d,xval,yval)) != 0) return ret; break; case PLOT_MOUSE_RELEASED_EVENT: sscanf(text,"(%f,%f)",&xval,&yval); if(trace) printf("PLOT_MOUSE_RELEASED %f %f\n",xval,yval); if((ret=slotMouseReleasedEvent(p,i,&d,xval,yval)) != 0) return ret; break; case MOUSE_OVER_EVENT: sscanf(text,"%d",&val); if(trace) printf("MOUSE_OVER_EVENT %d\n",val); if((ret=slotMouseOverEvent(p,i,&d,val)) != 0) return ret; break; case USER_EVENT: if(trace) printf("USER_EVENT id=%d %s\n",i,text); if((ret=slotUserEvent(p,i,&d,text)) != 0) return ret; break; default: if(trace) printf("UNKNOWN_EVENT id=%d %s\n",i,text); break; } } }
int show_mask1(PARAM *p) { DATA d; char event[MAX_EVENT_LENGTH]; int i,val; char text[MAX_EVENT_LENGTH]; defineMask(p); memset(&d,0,sizeof(DATA)); readData(&d); // from shared memory or out of database showData(p,&d); while(1) { pvPollEvent(p,event); switch(pvParseEvent(event, &i, text)) { case NULL_EVENT: readData(&d); // from shared memory or out of database showData(p,&d); break; case BUTTON_EVENT: printf("BUTTON_EVENT id=%d text=%s\n",i,text); if(i == ID_BUTTON_MASK1) return 1; if(i == ID_BUTTON_MASK2) return 2; if(i == ID_BUTTON_MASK3) return 3; if(i == ID_BUTTON_MASK4) return 4; if(i == ID_BUTTON_PERIODIC) return 5; if(i == ID_BUTTON_MASKVTK) return 6; if(i == ID_BUTTON_MASKQWT) return 7; if(i == ID_BUTTON_REQUEST) { pvText(p,ID_BUTTON_MASK1); pvText(p,ID_LINE_EDIT); //pvHyperlink(p,"pv://nblehrig"); } if(i == ID_TAB_BUTTON1) pvSendUserEvent(p,1,"hallo welt"); break; case BUTTON_PRESSED_EVENT: printf("BUTTON_PRESSED_EVENT id=%d\n",i); break; case BUTTON_RELEASED_EVENT: printf("BUTTON_RELEASED_EVENT id=%d\n",i); break; case TEXT_EVENT: printf("TEXT_EVENT id=%d %s\n",i,text); if(i < 0 && text[0] != '\0') { val = pvRunModalDialog(p,300,200,show_modal1,NULL, (readDataCast) readData, (showDataCast) showData, &d); printf("ModalDialog return = %d\n",val); } break; case TAB_EVENT: sscanf(text,"(%d)",&val); printf("TAB_EVENT(%d,page=%d)\n",i,val); break; case RIGHT_MOUSE_EVENT: printf("RIGHT_MOUSE_EVENT id=%d\n",i); pvPopupMenu(p,-1,"Menu1,Menu2,,Menu3"); break; case KEYBOARD_EVENT: sscanf(text,"(%d",&val); printf("KEYBOARD_EVENT modifier=%d key=%d\n",i,val); if(i == NormalKey && val == Key_F1) { printf("F1 pressed\n"); } break; case USER_EVENT: printf("USER_EVENT id=%d %s\n",i,text); break; default: printf("UNKNOWN_EVENT id=%d %s\n",i,text); break; } } }