void CMainWindow::on_actionShow_Grid_triggered(bool checked) { m_rw3->ToggleGrid(checked); UpdateView(); }
void CQueueView::OnSize(UINT nType, int cx, int cy) { CreateBackBuffer(cx, cy); // order matters, else bars are erratic UpdateView(); CScrollView::OnSize(nType, cx, cy); }
void WorkspaceBrowserF::OnRefreshTree(wxCommandEvent& event) { UpdateView(); }
void __fastcall TfrmEditLightAnim::ebSaveClick(TObject *Sender) { ebSave->Enabled = false; LALib.Save (); UpdateView (); }
void __fastcall TfrmEditLightAnim::OnModified() { ebSave->Enabled = true; UpdateView(); }
int InitWindowAndLoop(int argc, char** argv) { char* ClassName = "BOOTEDWIN"; WNDCLASSEX ClassStruct; memset(&ClassStruct, 0, sizeof(ClassStruct)); ClassStruct.cbSize = sizeof(ClassStruct); ClassStruct.style = CS_OWNDC; ClassStruct.lpfnWndProc = WndProc; ClassStruct.hInstance = WinSys_hInstance; ClassStruct.lpszClassName = ClassName; RegisterClassEx(&ClassStruct); HWND hWnd = CreateWindow(ClassName, "BootEd Window.", WS_TILEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 768, NULL, NULL, WinSys_hInstance, NULL); ShowWindow(hWnd, SW_SHOW); HDC dc = GetDC(hWnd); PIXELFORMATDESCRIPTOR pfd; memset(&pfd, 0, sizeof(pfd)); pfd.nSize = sizeof(pfd); pfd.nVersion = 1; pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 32; pfd.cDepthBits = 32; pfd.iLayerType = PFD_MAIN_PLANE; int pixel_format = ChoosePixelFormat(dc, &pfd); if(pixel_format == 0) return 1; if(!SetPixelFormat(dc, pixel_format, &pfd)) return 1; HGLRC glRc = wglCreateContext(dc); wglMakeCurrent(dc, glRc); void InitGLExt(); InitGLExt(); WinSys_View = InitView(); ResizeView(WinSys_View, WinSys_Width, WinSys_Height); // This message loop is meant to consume all system resources, needs // to be changed for apps that are meant to idle, I.E. editors. bool continue_loop = true; while(continue_loop) { MSG msg; while(PeekMessage(&msg, NULL, 0, 0, 0)) { if(!GetMessage(&msg, NULL, 0, 0)) continue_loop = false; TranslateMessage(&msg); DispatchMessage(&msg); } UpdateView(WinSys_View); SwapBuffers(dc); } FinishView(WinSys_View); wglMakeCurrent(NULL, NULL); wglDeleteContext(glRc); return 0; }
XSilChessWindow::XSilChessWindow(XtAppContext app, Widget toplevel, Visual * vsl, int vsldepth, Colormap cmap) { char tmp[512]; Arg al[10]; int i; XmString xms; // Initialize member variables App=app; TopLevel=toplevel; Disp=XtDisplay(TopLevel); Vsl=vsl; VslDepth=vsldepth; CMap=cmap; DlgVsl=DefaultVisual(Disp,XScreenNumberOfScreen(XtScreen(TopLevel))); DlgVslDepth=DefaultDepth(Disp,XScreenNumberOfScreen(XtScreen(TopLevel))); DlgCMap=DefaultColormap(Disp,XScreenNumberOfScreen(XtScreen(TopLevel))); PixelSize=(VslDepth<=8 ? 1 : (VslDepth<=16 ? 2 : 4)); RedMask=Vsl->red_mask; GreenMask=Vsl->green_mask; BlueMask=Vsl->blue_mask; SelX=SelY-1; IsSearching=false; AbortSearching=false; NeedPainting=false; IsPainting=false; HintWanted=false; HintValid=false; // Create main window MainWin=XtVaCreateManagedWidget( "mainWin",xmMainWindowWidgetClass,TopLevel, (char*)NULL ); // Create main menu bar MainMenu=XmCreateMenuBar(MainWin,(char*)"mainMenu",NULL,0); XtManageChild(MainMenu); // Create menu item: file XtSetArg(al[0],XmNvisual,Vsl); XtSetArg(al[1],XmNdepth,VslDepth); XtSetArg(al[2],XmNcolormap,CMap); FileMenu=XmCreatePulldownMenu(MainMenu,(char*)"fileMenu",al,3); BFile=XtVaCreateManagedWidget( "file",xmCascadeButtonWidgetClass,MainMenu, XmNsubMenuId,FileMenu, (char*)NULL ); // Create menu item: file/load BFileLoad=XtVaCreateManagedWidget( "load",xmPushButtonWidgetClass,FileMenu, (char*)NULL ); XtAddCallback(BFileLoad,XmNactivateCallback,HandleCallback,this); // Create menu item: file/save BFileSave=XtVaCreateManagedWidget( "save",xmPushButtonWidgetClass,FileMenu, (char*)NULL ); XtAddCallback(BFileSave,XmNactivateCallback,HandleCallback,this); // Create menu item: file/exit XtVaCreateManagedWidget( "separator",xmSeparatorWidgetClass,FileMenu, (char*)NULL ); BFileExit=XtVaCreateManagedWidget( "exit",xmPushButtonWidgetClass,FileMenu, (char*)NULL ); XtAddCallback(BFileExit,XmNactivateCallback,HandleCallback,this); // Create menu item: game XtSetArg(al[0],XmNvisual,Vsl); XtSetArg(al[1],XmNdepth,VslDepth); XtSetArg(al[2],XmNcolormap,CMap); GameMenu=XmCreatePulldownMenu(MainMenu,(char*)"gameMenu",al,3); BGame=XtVaCreateManagedWidget( "game",xmCascadeButtonWidgetClass,MainMenu, XmNsubMenuId,GameMenu, (char*)NULL ); // Create menu item: game/new BGameNew=XtVaCreateManagedWidget( "new",xmPushButtonWidgetClass,GameMenu, (char*)NULL ); XtAddCallback(BGameNew,XmNactivateCallback,HandleCallback,this); // Create menu item: game/flip BGameFlip=XtVaCreateManagedWidget( "flip",xmPushButtonWidgetClass,GameMenu, (char*)NULL ); XtAddCallback(BGameFlip,XmNactivateCallback,HandleCallback,this); // Create menu item: game/undo BGameUndo=XtVaCreateManagedWidget( "undo",xmPushButtonWidgetClass,GameMenu, (char*)NULL ); XtAddCallback(BGameUndo,XmNactivateCallback,HandleCallback,this); // Create menu item: game/list BGameList=XtVaCreateManagedWidget( "list",xmPushButtonWidgetClass,GameMenu, (char*)NULL ); XtAddCallback(BGameList,XmNactivateCallback,HandleCallback,this); // Create menu item: computer XtSetArg(al[0],XmNvisual,Vsl); XtSetArg(al[1],XmNdepth,VslDepth); XtSetArg(al[2],XmNcolormap,CMap); CompMenu=XmCreatePulldownMenu(MainMenu,(char*)"compMenu",al,3); BComp=XtVaCreateManagedWidget( "comp",xmCascadeButtonWidgetClass,MainMenu, XmNsubMenuId,CompMenu, (char*)NULL ); // Create menu item: computer/hint BCompHint=XtVaCreateManagedWidget( "hint",xmPushButtonWidgetClass,CompMenu, (char*)NULL ); XtAddCallback(BCompHint,XmNactivateCallback,HandleCallback,this); // Create menu item: computer/depth XtSetArg(al[0],XmNvisual,Vsl); XtSetArg(al[1],XmNdepth,VslDepth); XtSetArg(al[2],XmNcolormap,CMap); XtSetArg(al[3],XmNradioBehavior,True); DepthMenu=XmCreatePulldownMenu(CompMenu,(char*)"depthMenu",al,4); BCompDepth=XtVaCreateManagedWidget( "depth",xmCascadeButtonWidgetClass,CompMenu, XmNsubMenuId,DepthMenu, (char*)NULL ); // Create menu items: computer/depth/1... for (i=0; i<=SilChessMachine::MAX_SEARCH_DEPTH; i++) { sprintf(tmp,"%d",i); BDepth[i]=XtVaCreateManagedWidget( tmp,xmToggleButtonWidgetClass,DepthMenu, (char*)NULL ); XtAddCallback(BDepth[i],XmNvalueChangedCallback,HandleCallback,this); } // Create menu item: help XtSetArg(al[0],XmNvisual,Vsl); XtSetArg(al[1],XmNdepth,VslDepth); XtSetArg(al[2],XmNcolormap,CMap); HelpMenu=XmCreatePulldownMenu(MainMenu,(char*)"helpMenu",al,3); BHelp=XtVaCreateManagedWidget( "help",xmCascadeButtonWidgetClass,MainMenu, XmNsubMenuId,HelpMenu, (char*)NULL ); XtVaSetValues(MainMenu,XmNmenuHelpWidget,BHelp,(char*)NULL); // Create menu item: help/about BHelpAbout=XtVaCreateManagedWidget( "about",xmPushButtonWidgetClass,HelpMenu, (char*)NULL ); XtAddCallback(BHelpAbout,XmNactivateCallback,HandleCallback,this); // Create a parent for status bar and view MainForm=XtVaCreateManagedWidget( "mainForm",xmFormWidgetClass,MainWin, (char*)NULL ); // Create status line StatusFrame=XtVaCreateManagedWidget( "statusFrame",xmFrameWidgetClass,MainForm, XmNleftAttachment,XmATTACH_FORM, XmNrightAttachment,XmATTACH_FORM, XmNtopAttachment,XmATTACH_FORM, (char*)NULL ); StatusLabel=XtVaCreateManagedWidget( "statusLabel",xmLabelWidgetClass,StatusFrame, XmNalignment, XmALIGNMENT_BEGINNING, (char*)NULL ); // Create the chess board view ViewFrame=XtVaCreateManagedWidget( "viewFrame",xmFrameWidgetClass,MainForm, XmNtopAttachment,XmATTACH_WIDGET, XmNtopWidget,StatusFrame, XmNleftAttachment,XmATTACH_FORM, XmNrightAttachment,XmATTACH_FORM, XmNbottomAttachment,XmATTACH_FORM, (char*)NULL ); ViewArea=XtVaCreateManagedWidget( "viewArea",xmDrawingAreaWidgetClass,ViewFrame, XmNtopAttachment,XmATTACH_FORM, XmNleftAttachment,XmATTACH_FORM, XmNrightAttachment,XmATTACH_FORM, XmNbottomAttachment,XmATTACH_FORM, (char*)NULL ); XtAddCallback(ViewArea,XmNexposeCallback,HandleCallback,this); XtAddCallback(ViewArea,XmNresizeCallback,HandleCallback,this); XtAddEventHandler( ViewArea,ButtonPressMask|ButtonMotionMask|ButtonReleaseMask| StructureNotifyMask,False,HandleEvent,this ); XtVaGetValues(ViewArea,XmNwidth,&ViewWidth,(char*)NULL); XtVaGetValues(ViewArea,XmNheight,&ViewHeight,(char*)NULL); ViewWin=0; ViewGC=NULL; // Create dialog: load game XtSetArg(al[0],XmNvisual,DlgVsl); XtSetArg(al[1],XmNdepth,DlgVslDepth); XtSetArg(al[2],XmNcolormap,DlgCMap); XtSetArg(al[3],XmNautoUnmanage,True); LoadDialog=XmCreateFileSelectionDialog(TopLevel,(char*)"loadDialog",al,4); XtAddCallback(LoadDialog,XmNokCallback,HandleCallback,this); XtUnmanageChild(XmFileSelectionBoxGetChild(LoadDialog,XmDIALOG_HELP_BUTTON)); // Create dialog: save game XtSetArg(al[0],XmNvisual,DlgVsl); XtSetArg(al[1],XmNdepth,DlgVslDepth); XtSetArg(al[2],XmNcolormap,DlgCMap); XtSetArg(al[3],XmNautoUnmanage, True); SaveDialog=XmCreateFileSelectionDialog(TopLevel,(char*)"saveDialog",al,4); XtAddCallback(SaveDialog,XmNokCallback,HandleCallback,this); XtUnmanageChild(XmFileSelectionBoxGetChild(SaveDialog,XmDIALOG_HELP_BUTTON)); // Create dialog: file exists, overwrite? XtSetArg(al[0],XmNvisual,DlgVsl); XtSetArg(al[1],XmNdepth,DlgVslDepth); XtSetArg(al[2],XmNcolormap,DlgCMap); XtSetArg(al[3],XmNautoUnmanage, True); OverwriteDialog=XmCreateWarningDialog(TopLevel,(char*)"overwriteDialog",al,4); XtUnmanageChild(XmMessageBoxGetChild(OverwriteDialog,XmDIALOG_HELP_BUTTON)); XtAddCallback(OverwriteDialog,XmNokCallback,HandleCallback,this); // Create dialog: error message XtSetArg(al[0],XmNvisual,DlgVsl); XtSetArg(al[1],XmNdepth,DlgVslDepth); XtSetArg(al[2],XmNcolormap,DlgCMap); XtSetArg(al[3],XmNautoUnmanage, True); ErrorBox=XmCreateWarningDialog(TopLevel,(char*)"errorBox",al,4); XtUnmanageChild(XmMessageBoxGetChild(ErrorBox,XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(ErrorBox,XmDIALOG_HELP_BUTTON)); // Create dialog: list of moves ListDialogPopup=XtVaCreateWidget( "listDialog_popup",xmDialogShellWidgetClass,TopLevel, XmNvisual,DlgVsl, XmNdepth,DlgVslDepth, XmNcolormap,DlgCMap, (char*)NULL ); ListDialog=XtVaCreateWidget( "listDialog",xmFormWidgetClass,ListDialogPopup, (char*)NULL ); LDClose=XtVaCreateManagedWidget( "close",xmPushButtonWidgetClass,ListDialog, XmNleftAttachment,XmATTACH_FORM, XmNrightAttachment,XmATTACH_FORM, XmNbottomAttachment,XmATTACH_FORM, (char*)NULL ); XtAddCallback(LDClose,XmNactivateCallback,HandleCallback,this); LDScroll=XtVaCreateManagedWidget( "scroll",xmScrolledWindowWidgetClass,ListDialog, XmNscrollingPolicy,XmAUTOMATIC, XmNscrollBarDisplayPolicy,XmAS_NEEDED, XmNleftAttachment,XmATTACH_FORM, XmNrightAttachment,XmATTACH_FORM, XmNtopAttachment,XmATTACH_FORM, XmNbottomAttachment,XmATTACH_WIDGET, XmNbottomWidget,LDClose, (char*)NULL ); LDList=XtVaCreateManagedWidget( "list",xmLabelGadgetClass,LDScroll, XmNalignment,XmALIGNMENT_BEGINNING, (char*)NULL ); // Create dialog: about xms=XmStringCreateLtoR((char*)AboutText,XmFONTLIST_DEFAULT_TAG); XtSetArg(al[0],XmNvisual,DlgVsl); XtSetArg(al[1],XmNdepth,DlgVslDepth); XtSetArg(al[2],XmNcolormap,DlgCMap); XtSetArg(al[3],XmNautoUnmanage,True); XtSetArg(al[4],XmNmessageString,xms); XtSetArg(al[5],XmNmessageAlignment,XmALIGNMENT_CENTER); AboutDialog=XmCreateMessageDialog(TopLevel,(char*)"aboutDialog",al,6); XmStringFree(xms); XtUnmanageChild(XmMessageBoxGetChild(AboutDialog,XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(AboutDialog,XmDIALOG_HELP_BUTTON)); // Set main window areas XmMainWindowSetAreas(MainWin,MainMenu,NULL,NULL,NULL,MainForm); // Create chess machine Machine = new SilChessMachine(); // Setup ray tracer RT.SetViewSize(ViewWidth,ViewHeight); RT.SetWorld(Machine); // Update all UpdateStatusBar(); UpdateMovesList(); UpdateView(); UpdateDepthMenu(); }
//@cmember Send a WM_PAINT to the window void tomEdit::TxViewChange(BOOL fUpdate) { UpdateView(NULL) ; }
void Plotter::Render() { // Animate scroll / zooming UpdateView(); #ifndef HAVE_GLES glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_LINE_BIT); #endif glClearColor(colour_bg.r, colour_bg.g, colour_bg.b, colour_bg.a); ActivateScissorAndClear(); // Try to create smooth lines glDisable(GL_MULTISAMPLE); glLineWidth(1.5); glEnable(GL_LINE_SMOOTH); glHint( GL_LINE_SMOOTH_HINT, GL_NICEST ); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_LIGHTING); glDisable( GL_DEPTH_TEST ); const float w = rview.x.Size(); const float h = rview.y.Size(); const float ox = -rview.x.Mid(); const float oy = -rview.y.Mid(); const float sx = 2.0f / w; const float sy = 2.0f / h; ////////////////////////////////////////////////////////////////////////// // Draw ticks prog_lines.SaveBind(); prog_lines.SetUniform("u_scale", sx, sy); prog_lines.SetUniform("u_offset", ox, oy); prog_lines.SetUniform("u_color", colour_tk ); const float min_space = 80.0; int ta[2] = {1,1}; while(v.w * ta[0] *tick[0].val / w < min_space) ta[0] *=2; while(v.h * ta[1] *tick[1].val / h < min_space) ta[1] *=2; const float tdelta[2] = { tick[0].val * ta[0], tick[1].val * ta[1] }; const int tx[2] = { (int)ceil(rview.x.min / tdelta[0]), (int)ceil(rview.x.max / tdelta[0]) }; const int ty[2] = { (int)ceil(rview.y.min / tdelta[1]), (int)ceil(rview.y.max / tdelta[1]) }; for( int i=tx[0]; i<tx[1]; ++i ) { glDrawLine((i)*tdelta[0], rview.y.min, (i)*tdelta[0], rview.y.max); } for( int i=ty[0]; i<ty[1]; ++i ) { glDrawLine(rview.x.min, (i)*tdelta[1], rview.x.max, (i)*tdelta[1]); } prog_lines.Unbind(); ////////////////////////////////////////////////////////////////////////// // Draw axis prog_lines.SaveBind(); prog_lines.SetUniform("u_color", colour_ax ); glDrawLine(0, rview.y.min, 0, rview.y.max ); glDrawLine(rview.x.min,0, rview.x.max,0 ); prog_lines.Unbind(); ////////////////////////////////////////////////////////////////////////// // Draw Implicits for(size_t i=0; i < plotimplicits.size(); ++i) { PlotImplicit& im = plotimplicits[i]; im.prog.SaveBind(); im.prog.SetUniform("u_scale", sx, sy); im.prog.SetUniform("u_offset", ox, oy); glDrawRect(rview.x.min,rview.y.min,rview.x.max,rview.y.max); im.prog.Unbind(); } ////////////////////////////////////////////////////////////////////////// // Draw series static size_t id_size = 0; static float* id_array = 0; for(size_t i=0; i < plotseries.size(); ++i) { PlotSeries& ps = plotseries[i]; GlSlProgram& prog = ps.prog; ps.used = false; prog.SaveBind(); prog.SetUniform("u_scale", sx, sy); prog.SetUniform("u_offset", ox, oy); prog.SetUniform("u_color", ps.colour ); // TODO: Try to skip drawing of blocks which aren't in view. const DataLogBlock* block = ps.log ? ps.log->FirstBlock() : default_log->FirstBlock(); while(block) { if(ps.contains_id ) { if(id_size < block->Samples() ) { // Create index array that we can bind delete[] id_array; id_size = block->MaxSamples(); id_array = new float[id_size]; for(size_t k=0; k < id_size; ++k) { id_array[k] = (float)k; } } prog.SetUniform("u_id_offset", (float)block->StartId() ); } // Enable appropriate attributes bool shouldRender = true; for(size_t i=0; i< ps.attribs.size(); ++i) { if(0 <= ps.attribs[i].plot_id && ps.attribs[i].plot_id < (int)block->Dimensions() ) { glVertexAttribPointer(ps.attribs[i].location, 1, GL_FLOAT, GL_FALSE, (GLsizei)(block->Dimensions()*sizeof(float)), block->DimData(ps.attribs[i].plot_id) ); glEnableVertexAttribArray(ps.attribs[i].location); }else if( ps.attribs[i].plot_id == -1 ){ glVertexAttribPointer(ps.attribs[i].location, 1, GL_FLOAT, GL_FALSE, 0, id_array ); glEnableVertexAttribArray(ps.attribs[i].location); }else{ // bad id: don't render shouldRender = false; break; } } if(shouldRender) { // Draw geometry glDrawArrays(ps.drawing_mode, 0, (GLsizei)block->Samples()); ps.used = true; } // Disable enabled attributes for(size_t i=0; i< ps.attribs.size(); ++i) { glDisableVertexAttribArray(ps.attribs[i].location); } block = block->NextBlock(); } prog.Unbind(); } prog_lines.SaveBind(); ////////////////////////////////////////////////////////////////////////// // Draw markers glLineWidth(2.5f); for( size_t i=0; i < plotmarkers.size(); ++i) { const Marker& m = plotmarkers[i]; XYRangef draw_range = m.range; draw_range.Clamp(rview); prog_lines.SetUniform("u_color", m.colour ); if(draw_range.x.Size() == 0.0 || draw_range.y.Size() == 0.0) { // Horizontal or Vertical line glDrawLine(draw_range.x.min, draw_range.y.min, draw_range.x.max, draw_range.y.max ); }else{ // Region glDrawRect(draw_range.x.min, draw_range.y.min, draw_range.x.max, draw_range.y.max ); } } ////////////////////////////////////////////////////////////////////////// // Draw hover / selection glLineWidth(1.5f); // hover over prog_lines.SetUniform("u_color", colour_ax.WithAlpha(0.3f) ); glDrawLine(hover[0], rview.y.min, hover[0], rview.y.max ); glDrawLine(rview.x.min, hover[1], rview.x.max, hover[1] ); // range prog_lines.SetUniform("u_color", colour_ax.WithAlpha(0.5) ); glDrawLine(selection.x.min, rview.y.min, selection.x.min, rview.y.max ); glDrawLine(selection.x.max, rview.y.min, selection.x.max, rview.y.max ); glDrawLine(rview.x.min, selection.y.min, rview.x.max, selection.y.min ); glDrawLine(rview.x.min, selection.y.max, rview.x.max, selection.y.max ); glDrawRect(selection.x.min, selection.y.min, selection.x.max, selection.y.max); prog_lines.Unbind(); prog_text.SaveBind(); ////////////////////////////////////////////////////////////////////////// // Draw Key prog_text.SetUniform("u_scale", 2.0f / v.w, 2.0f / v.h); int keyid = 0; for(size_t i=0; i < plotseries.size(); ++i) { PlotSeries& ps = plotseries[i]; if(ps.used) { prog_text.SetUniform("u_color", ps.colour ); prog_text.SetUniform("u_offset", v.w-5-ps.title.Width() -(v.w/2.0f), v.h-15*(++keyid) -(v.h/2.0f) ); ps.title.DrawGlSl(); } } ////////////////////////////////////////////////////////////////////////// // Draw axis text prog_text.SetUniform("u_scale", 2.0f / v.w, 2.0f / v.h); prog_text.SetUniform("u_color", colour_ax ); for( int i=tx[0]; i<tx[1]; ++i ) { std::ostringstream oss; oss << i*tdelta[0]*tick[0].factor << tick[0].symbol; GlText txt = GlFont::I().Text(oss.str().c_str()); float sx = v.w*((i)*tdelta[0]-rview.x.Mid())/w - txt.Width()/2.0f; prog_text.SetUniform("u_offset", sx, 15 -v.h/2.0f ); txt.DrawGlSl(); } for( int i=ty[0]; i<ty[1]; ++i ) { std::ostringstream oss; oss << i*tdelta[1]*tick[1].factor << tick[1].symbol; GlText txt = GlFont::I().Text(oss.str().c_str()); float sy = v.h*((i)*tdelta[1]-rview.y.Mid())/h - txt.Height()/2.0f; prog_text.SetUniform("u_offset", 15 -v.w/2.0f, sy ); txt.DrawGlSl(); } prog_text.Unbind(); glLineWidth(1.0f); #ifndef HAVE_GLES glPopAttrib(); #endif }
void ezQtFileserveActivityModel::UpdateViewSlot() { m_bTimerRunning = false; UpdateView(); }
//@cmember InvalidateRect void tomEdit::TxInvalidateRect(LPCRECT prc, BOOL fMode) { UpdateView(prc) ; }
/** * get scrollbar notification */ void iwAddons::Msg_ScrollChange(const unsigned /*ctrl_id*/, const unsigned short /*position*/) { auto* optiongroup = GetCtrl<ctrlOptionGroup>(5); UpdateView(optiongroup->GetSelection()); }
/** * get scrollbar notification * * @author FloSoft */ void iwAddons::Msg_ScrollChange(const unsigned int ctrl_id, const unsigned short position) { ctrlOptionGroup* optiongroup = GetCtrl<ctrlOptionGroup>(5); UpdateView(optiongroup->GetSelection()); }
void CMainWindow::on_actionToggle_Lighting_triggered(bool checked) { m_rw3->ToggleLighting(checked); UpdateView(); }
void BaseCamera::SetWorld(const Matrix4& world) { m_world = world; m_position = m_world.GetTranslation(); UpdateView(); }
void GLCamera::Strafe(float delta) { m_position += delta * m_right; UpdateView(); }
void GInstructionView::SetInstruction( G_old_Instruction* pInstruction ) { m_pInstruction = pInstruction; UpdateView(); }
void SectionViewWidget::OnResetYScale() { m_ScaleY = 1.0; UpdateView(); }
/** * _ConstructGUI() * * Creates the GUI for the View. MUST be called AFTER the View is attached to * the Window, or will crash and/or create strange behaviour * * @param none * @return void */ void MarginView::_ConstructGUI() { fPage = new PageView(); fPage->SetViewColor(ViewColor()); fPageSize = new BStringView("pageSize", "?x?"); BString str; // Create text fields // top str << fMargins.top/fUnitValue; fTop = new BTextControl("top", "Top:", str.String(), NULL); fTop->SetModificationMessage(new BMessage(TOP_MARGIN_CHANGED)); fTop->SetTarget(this); _AllowOnlyNumbers(fTop, kNumCount); //left str = ""; str << fMargins.left/fUnitValue; fLeft = new BTextControl("left", "Left:", str.String(), NULL); fLeft->SetModificationMessage(new BMessage(LEFT_MARGIN_CHANGED)); fLeft->SetTarget(this); _AllowOnlyNumbers(fLeft, kNumCount); //bottom str = ""; str << fMargins.bottom/fUnitValue; fBottom = new BTextControl("bottom", "Bottom:", str.String(), NULL); fBottom->SetModificationMessage(new BMessage(BOTTOM_MARGIN_CHANGED)); fBottom->SetTarget(this); _AllowOnlyNumbers(fBottom, kNumCount); //right str = ""; str << fMargins.right/fUnitValue; fRight = new BTextControl("right", "Right:", str.String(), NULL); fRight->SetModificationMessage(new BMessage(RIGHT_MARGIN_CHANGED)); fRight->SetTarget(this); _AllowOnlyNumbers(fRight, kNumCount); // Create Units popup BPopUpMenu *menu = new BPopUpMenu("units"); BMenuField *units = new BMenuField("units", "Units:", menu); BMenuItem *item; // Construct menu items for (int32 i = 0; kUnitNames[i] != NULL; i++) { BMessage *msg = new BMessage(MARGIN_UNIT_CHANGED); msg->AddInt32("marginUnit", kUnitMsg[i]); menu->AddItem(item = new BMenuItem(kUnitNames[i], msg)); item->SetTarget(this); if (fMarginUnit == kUnitMsg[i]) item->SetMarked(true); } BGridView* settings = new BGridView(); BGridLayout* settingsLayout = settings->GridLayout(); settingsLayout->AddItem(fTop->CreateLabelLayoutItem(), 0, 0); settingsLayout->AddItem(fTop->CreateTextViewLayoutItem(), 1, 0); settingsLayout->AddItem(fLeft->CreateLabelLayoutItem(), 0, 1); settingsLayout->AddItem(fLeft->CreateTextViewLayoutItem(), 1, 1); settingsLayout->AddItem(fBottom->CreateLabelLayoutItem(), 0, 2); settingsLayout->AddItem(fBottom->CreateTextViewLayoutItem(), 1, 2); settingsLayout->AddItem(fRight->CreateLabelLayoutItem(), 0, 3); settingsLayout->AddItem(fRight->CreateTextViewLayoutItem(), 1, 3); settingsLayout->AddItem(units->CreateLabelLayoutItem(), 0, 4); settingsLayout->AddItem(units->CreateMenuBarLayoutItem(), 1, 4); settingsLayout->SetSpacing(0, 0); BGroupView* groupView = new BGroupView(B_HORIZONTAL, 10); BGroupLayout* groupLayout = groupView->GroupLayout(); groupLayout->AddView(BGroupLayoutBuilder(B_VERTICAL, 0) .Add(fPage) .Add(fPageSize) .SetInsets(0, 0, 0, 0) .TopView() ); groupLayout->AddView(settings); groupLayout->SetInsets(5, 5, 5, 5); AddChild(groupView); UpdateView(MARGIN_CHANGED); }
void SectionViewWidget::mousePressEvent(QMouseEvent *event) { if(!m_pSailSection) return; SailDlg *pSailDlg = (SailDlg*)m_pSailDlg; QPoint point = event->pos(); CVector Real = MousetoReal(point); // Real.z = m_pSailSection->m_Position.z; // get a reference for mouse movements m_PointDown.rx() = point.x(); m_PointDown.ry() = point.y(); if(m_bZoomIn && rect().contains(point)) { m_ZoomRect.setTopLeft(point); m_ZoomRect.setBottomRight(point); } else if(!m_bZoomIn && (event->buttons() & Qt::LeftButton)) { if (event->modifiers() & Qt::ShiftModifier) { //shift --> inserts a point OnInsertCtrlPt(); } else if (event->modifiers() & Qt::ControlModifier) { //Ctrl --> removes the point OnRemoveCtrlPt(); } else if(m_pSailSection && m_pSail->IsNURBSSail()) { //Selects the point m_pSailSection->m_iSelect = m_pSailSection->IsPoint(Real, m_Scale/m_RefScale); pSailDlg->m_pctrlPointTable->selectRow(m_pSailSection->m_iSelect); NURBSSail *pNSail = (NURBSSail*)m_pSail; if(pNSail->m_bAlignedLE) { if(m_pSailSection==pNSail->m_oaSection[1] && m_pSailSection->m_iSelect==0) m_pSailSection->m_iSelect = -1; } if (m_pSailSection->m_iSelect>=0) { // TakePicture(); } if(m_pSailSection->m_iSelect ==-10) { setCursor(m_hcMove); m_bTrans = true; } } else { setCursor(m_hcMove); m_bTrans = true; } } UpdateView(); }
void XSilChessWindow::HandleCallbackOrEvent(Widget widget, XmAnyCallbackStruct * cbs, XEvent * event) { XGCValues gcval; const char * file_name; XmString xms; char tmp[512]; int i; if (widget==BFileLoad) { XtUnmanageChild(LoadDialog); XmFileSelectionDoSearch(LoadDialog,NULL); XtManageChild(LoadDialog); } else if (widget==BFileSave) { XtUnmanageChild(SaveDialog); XmFileSelectionDoSearch(SaveDialog,NULL); XtManageChild(SaveDialog); } else if (widget==BFileExit) { exit(0); } else if (widget==BGameNew) { AbortSearching=true; HintWanted=false; HintValid=false; Machine->StartNewGame(); RT.SetWorld(Machine); UpdateStatusBar(); UpdateMovesList(); UpdateView(); } else if (widget==BGameFlip) { AbortSearching=true; HintWanted=false; HintValid=false; Machine->SetHumanWhite(!Machine->IsHumanWhite()); RT.SetWorld(Machine); UpdateStatusBar(); UpdateView(); } else if (widget==BGameUndo) { AbortSearching=true; HintWanted=false; HintValid=false; Machine->UndoMove(); if (!Machine->IsHumanOn()) Machine->UndoMove(); RT.SetWorld(Machine); UpdateStatusBar(); UpdateMovesList(); UpdateView(); } else if (widget==BGameList) { XtUnmanageChild(ListDialog); XtManageChild(ListDialog); } else if (widget==LoadDialog) { AbortSearching=true; HintWanted=false; HintValid=false; file_name=XmTextGetString( XmFileSelectionBoxGetChild(widget,XmDIALOG_TEXT) ); if (!Machine->Load(file_name)) { XtUnmanageChild(ErrorBox); sprintf(tmp,"Failed to load '%s'",file_name); xms=XmStringCreateSimple(tmp); XtVaSetValues(ErrorBox,XmNmessageString,xms,(char*)NULL); XmStringFree(xms); XtManageChild(ErrorBox); } RT.SetWorld(Machine); UpdateStatusBar(); UpdateMovesList(); UpdateView(); UpdateDepthMenu(); } else if (widget==SaveDialog) { file_name=XmTextGetString( XmFileSelectionBoxGetChild(widget,XmDIALOG_TEXT) ); if (access(file_name,F_OK)!=-1) { XtUnmanageChild(OverwriteDialog); sprintf(tmp,"OK to overwrite '%s'?",file_name); xms=XmStringCreateSimple(tmp); XtVaSetValues(OverwriteDialog,XmNmessageString,xms,(char*)NULL); XmStringFree(xms); XtManageChild(OverwriteDialog); strcpy(OverwriteFile,file_name); } else if (!Machine->Save(file_name)) { XtUnmanageChild(ErrorBox); sprintf(tmp,"Failed to save '%s'",file_name); xms=XmStringCreateSimple(tmp); XtVaSetValues(ErrorBox,XmNmessageString,xms,(char*)NULL); XmStringFree(xms); XtManageChild(ErrorBox); } } else if (widget==OverwriteDialog) { file_name=OverwriteFile; if (!Machine->Save(file_name)) { XtUnmanageChild(ErrorBox); sprintf(tmp,"Failed to save '%s'",file_name); xms=XmStringCreateSimple(tmp); XtVaSetValues(ErrorBox,XmNmessageString,xms,(char*)NULL); XmStringFree(xms); XtManageChild(ErrorBox); } } else if (widget==ViewArea) { if (cbs!=NULL && cbs->reason==XmCR_EXPOSE && cbs->event && cbs->event->xexpose.count==0) { UpdateView(); } else if (cbs!=NULL && cbs->reason==XmCR_RESIZE) { XtVaGetValues(ViewArea,XmNwidth,&ViewWidth,(char*)NULL); XtVaGetValues(ViewArea,XmNheight,&ViewHeight,(char*)NULL); RT.SetViewSize(ViewWidth,ViewHeight); UpdateView(); } else if (event!=NULL && event->type==ButtonPress) { MousePress(event->xbutton.x,event->xbutton.y); } else if (event!=NULL && event->type==MapNotify && !ViewWin) { ViewWin=XtWindow(ViewArea); ViewGC=XtGetGC(ViewArea,0,&gcval); } } else if (widget==BCompHint) { AbortSearching=true; HintWanted=true; HintValid=false; UpdateStatusBar(); } else if (widget==BHelpAbout) { XtUnmanageChild(AboutDialog); XtManageChild(AboutDialog); } else if (widget==LDClose) { XtUnmanageChild(ListDialog); } else { for (i=0; i<=SilChessMachine::MAX_SEARCH_DEPTH; i++) { if (widget==BDepth[i] && cbs!=NULL) { if (((XmToggleButtonCallbackStruct*)cbs)->set) { AbortSearching=true; Machine->SetSearchDepth(i); UpdateStatusBar(); } } } } do { DoPainting(); DoSearching(); } while(NeedPainting && !IsPainting && ViewWin); }
void SectionViewWidget::mouseMoveEvent(QMouseEvent *event) { if(!m_pSailSection) return; if(!hasFocus()) setFocus(); QPoint point = event->pos(); m_MousePos = MousetoReal(point); // m_MousePos.z = m_pSailSection->m_Position.z; QRect CltRect = rect(); // bool bCtrl = (event->modifiers() & Qt::ControlModifier) ; if(m_bZoomIn && (event->buttons() & Qt::LeftButton)) { // we're zooming in using the rectangle method m_ZoomRect.setBottomRight(point); UpdateView(); return; } else if(CltRect.contains(point) && (event->buttons() & Qt::LeftButton) && m_bTrans) { //translate m_ptOffset.rx() += point.x() - m_PointDown.x(); m_ptOffset.ry() += point.y() - m_PointDown.y(); m_ViewportTrans.rx() += point.x() - m_PointDown.x(); m_ViewportTrans.ry() += point.y() - m_PointDown.y(); m_PointDown.rx() = point.x(); m_PointDown.ry() = point.y(); // m_MousePos = Real; UpdateView(); return; } if (event->buttons() & Qt::LeftButton && !m_bZoomIn) { // user is dragging the point if(CltRect.contains(point) && m_pSail->IsNURBSSail()) { int n = m_pSailSection->m_iSelect; if (n>=0 && n<m_pSailSection->m_CtrlPoint.size()) { // if(n==1) m_MousePos.x = 0.0;// we can't move point 1 for vertical slope m_pSailSection->m_CtrlPoint[n].x = m_MousePos.x; m_pSailSection->m_CtrlPoint[n].y = qMax(m_MousePos.y, 0.0); m_pSailSection->m_CtrlPoint[n].z = m_MousePos.z; NURBSSail *pNSail = (NURBSSail*)m_pSail; if(pNSail->m_bAlignedLE && n==0) { // keep middle point aligned pNSail->m_oaSection[1]->m_CtrlPoint[0].x = (pNSail->m_oaSection[0]->m_CtrlPoint[0].x + pNSail->m_oaSection[2]->m_CtrlPoint[0].x)/2.0; pNSail->m_oaSection[1]->m_CtrlPoint[0].y = (pNSail->m_oaSection[0]->m_CtrlPoint[0].y + pNSail->m_oaSection[2]->m_CtrlPoint[0].y)/2.0; } Spline::s_bChanged = true; } } } else if ((event->buttons() & Qt::MidButton)) { // user is zooming with mouse button down rather than with wheel if(CltRect.contains(point)) { double scale = m_Scale; if(!m_bZoomYOnly) { if (m_bXDown) { if(point.y()-m_PointDown.y()>0) { m_Scale *= 1.02; m_ScaleY /= 1.02; } else { m_Scale /= 1.02; m_ScaleY *= 1.02; } } else if (m_bYDown) { if(point.y()-m_PointDown.y()>0) m_ScaleY *= 1.02; else m_ScaleY /= 1.02; } else { if(point.y()-m_PointDown.y()>0) m_Scale *= 1.02; else m_Scale /= 1.02; } } else { if(point.y()-m_PointDown.y()>0) m_ScaleY *= 1.02; else m_ScaleY /= 1.02; } m_PointDown = point; int a = (int)((CltRect.right()+CltRect.left())/2); m_ptOffset.rx() = a + (int)((m_ptOffset.x()-a)*m_Scale/scale); } } else if(!m_bZoomIn) { //not zooming, check if mouse passes over control point and highlight int n = m_pSailSection->IsPoint(m_MousePos, m_Scale/m_RefScale); if (n>=0 && n<m_pSailSection->m_CtrlPoint.size()) { m_pSailSection->m_iHighlight = n; } else if(m_pSailSection->m_iHighlight>=0) { m_pSailSection->m_iHighlight = -10; } } UpdateView(); }
void __fastcall TfrmEditLightAnim::ebDeleteKeyClick(TObject *Sender) { m_CurrentItem->DeleteKey(sePointer->Value); UpdateView(); OnModified(); }
void SectionViewWidget::mouseReleaseEvent(QMouseEvent *event) { m_bTrans = false; QPoint point = event->pos(); QRect CltRect = rect(); if(m_bZoomIn && CltRect.contains(point)) { m_ZoomRect.setBottomRight(point); QRect ZRect = m_ZoomRect.normalized(); if(!ZRect.isEmpty()) { m_ZoomRect = ZRect; double ZoomFactor = qMin((double)CltRect.width() / (double)m_ZoomRect.width() , (double)CltRect.height() / (double)m_ZoomRect.height()); double newScale = qMin(ZoomFactor*m_Scale, 32.0*m_RefScale); ZoomFactor = qMin(ZoomFactor, newScale/m_Scale); m_Scale = ZoomFactor*m_Scale; int a = (int)((CltRect.right() + CltRect.left())/2); int b = (int)((CltRect.top() + CltRect.bottom())/2); int aZoom = (int)((m_ZoomRect.right() + m_ZoomRect.left())/2); int bZoom = (int)((m_ZoomRect.top() + m_ZoomRect.bottom())/2); //translate view m_ptOffset.rx() += (a - aZoom); m_ptOffset.ry() += (b - bZoom); //scale view m_ptOffset.rx() = (int)(ZoomFactor * (m_ptOffset.x()-a)+a); m_ptOffset.ry() = (int)(ZoomFactor * (m_ptOffset.y()-b)+b); // m_ZoomRect.setBottomRight(m_ZoomRect.topLeft()); m_ZoomRect.setRight(m_ZoomRect.left()-1); } else { m_ZoomRect.setBottomRight(m_ZoomRect.topLeft()); ReleaseZoom(); } } else if(m_bZoomIn && !CltRect.contains(point)) { ReleaseZoom(); } else { //The user has finished dragging something if (m_pSailSection->m_iSelect>=0) TakePicture(); SailDlg *pSailDlg = (SailDlg*)m_pSailDlg; pSailDlg->FillPointTable(); m_pSail->SplineSurface(); pSailDlg->UpdateSailView(); } setCursor(m_hcCross); UpdateView(); }
void cCamera::UpdateCamera() { UpdateView(); UpdateProjection(); }
void SectionViewWidget::OnCurrentSectionOnly() { s_bCurrentOnly = !s_bCurrentOnly; m_pCurrentOnly->setChecked(s_bCurrentOnly); UpdateView(); }
void CTranVideoTitleBar::OnPaint() { CPaintDC dc(this); // device context for painting CVideoPane* pVideoPane = dynamic_cast<CVideoPane*>(m_pVideoPane); CHECK_POINTER_VOID(pVideoPane); CRect rect; pVideoPane->GetClientRect(&rect); const long ICON_WIDTH = 23; long lWidth = ICON_WIDTH; long lRight = rect.right; m_StaticDevName.MoveWindow(1,1,lRight - 70, 22); m_StaticDevName.ShowWindow(SW_SHOW); m_btnOFF.MoveWindow(lRight - lWidth, 1, 22, 22); m_btnOFF.ShowWindow(SW_SHOW); lWidth += ICON_WIDTH; m_btnInf.MoveWindow(lRight - lWidth, 1, 22, 22); m_btnInf.ShowWindow(SW_SHOW); if(TVWALL_STATUS_START==m_ulTVWallStatus) { lWidth += ICON_WIDTH; m_btnTVWallHandling.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnTVWallHandling.ShowWindow(SW_SHOW); m_btnTVWallOK.ShowWindow(SW_HIDE); m_btnTVWallVideoBroken.ShowWindow(SW_HIDE); m_btnTvWallReconnect.ShowWindow(SW_HIDE); } if(TVWALL_STATUS_DEC_DISCONN==m_ulTVWallStatus) { lWidth += ICON_WIDTH; m_btnTvWallReconnect.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnTvWallReconnect.ShowWindow(SW_SHOW); m_btnTVWallOK.ShowWindow(SW_HIDE); m_btnTVWallVideoBroken.ShowWindow(SW_HIDE); } else if(TVWALL_STATUS_PLAY==m_ulTVWallStatus) { lWidth += ICON_WIDTH; m_btnTVWallOK.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnTVWallOK.ShowWindow(SW_SHOW); m_btnTVWallHandling.ShowWindow(SW_HIDE); m_btnTVWallVideoBroken.ShowWindow(SW_HIDE); m_btnTvWallReconnect.ShowWindow(SW_HIDE); } else if(TVWALL_STATUS_VIDEO_BROKEN==m_ulTVWallStatus) { lWidth += ICON_WIDTH; m_btnTVWallVideoBroken.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnTVWallVideoBroken.ShowWindow(SW_SHOW); m_btnTVWallOK.ShowWindow(SW_HIDE); m_btnTVWallHandling.ShowWindow(SW_HIDE); } else { m_btnTVWallOK.ShowWindow(SW_HIDE); m_btnTVWallHandling.ShowWindow(SW_HIDE); m_btnTVWallVideoBroken.ShowWindow(SW_HIDE); m_btnTvWallReconnect.ShowWindow(SW_HIDE); } if (1 == m_ulTurnCruiseStatus) { lWidth += ICON_WIDTH; m_btnTurnCruiseStatus.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnTurnCruiseStatus.ShowWindow(SW_SHOW); } else { m_btnTurnCruiseStatus.ShowWindow(SW_HIDE); } if (1 == m_ulSingleFrameStatus) { lWidth += ICON_WIDTH; m_btnSingleFrameStatus.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnSingleFrameStatus.ShowWindow(SW_SHOW); } else { m_btnSingleFrameStatus.ShowWindow(SW_HIDE); } if (1 == m_ulAlarmStatus) { lWidth += ICON_WIDTH; m_btnAlarmStatus.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnAlarmStatus.ShowWindow(SW_SHOW); } else { m_btnAlarmStatus.ShowWindow(SW_HIDE); } if (1 == m_ulRecordStatus) { lWidth += ICON_WIDTH; m_btnRecordStatus.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnRecordStatus.ShowWindow(SW_SHOW); } else { m_btnRecordStatus.ShowWindow(SW_HIDE); } if (1 == m_ulCruiseTrackStatus) { lWidth += ICON_WIDTH; m_btnCruiseTrackStatus.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnCruiseTrackStatus.ShowWindow(SW_SHOW); } else { m_btnCruiseTrackStatus.ShowWindow(SW_HIDE); } if (-1 == m_ulWatermarkStutus) { m_btnWaterMakr.ShowWindow(SW_HIDE); } else { lWidth += ICON_WIDTH; m_btnWaterMakr.MoveWindow(lRight - lWidth, 3, 16, 16); m_btnWaterMakr.ShowWindow(SW_SHOW); } UpdateView(); }
void BaseCamera::SetPosition(const Vector3& pos) { m_position = pos; m_world.SetTranslation(m_position); UpdateView(); }
void WorkspaceBrowserF::OnViewScope(wxCommandEvent& event) { m_BrowserOptions.displayFilter = (BrowserDisplayFilter)event.GetSelection(); UpdateView(); }
void ThreeDWidget::slotFloorCalibrationSuccess() { emit signalFloorCalibrationSuccess(); UpdateView(); }