0028316: Coding Rules - Elimilate confusing aliases of Standard_Real type in V3d_View
[occt.git] / samples / mfc / standard / 08_HLR / src / SelectionDialog.cpp
CommitLineData
7fd59977 1// SelectionDialog.cpp : implementation file
2//
3
4#include "stdafx.h"
5
6#include "SelectionDialog.h"
7
8#include "HLRApp.h"
9#include "OCC_2dView.h"
10#include <ISession2D/ISession2D_Shape.h>
11#include "Prs3d_Projector.hxx"
12
13#ifdef _DEBUG
14//#define new DEBUG_NEW
15#undef THIS_FILE
16static char THIS_FILE[] = __FILE__;
17#endif
18
19// the key for shortcut ( use to activate dynamic rotation, panning )
20#define CASCADESHORTCUTKEY MK_CONTROL
21
22/////////////////////////////////////////////////////////////////////////////
23// CSelectionDialog dialog
24
b3837d74 25CSelectionDialog::CSelectionDialog (CHLRDoc* aDoc,CWnd* pParent /*=NULL*/)
97319109 26: CDialog(CSelectionDialog::IDD, pParent)
7fd59977 27{
97319109 28 myDoc = aDoc;
b3837d74 29 myIsDisplayed = false;
97319109 30 //{{AFX_DATA_INIT(CSelectionDialog)
31 m_Algo = 0;
32 m_DisplayMode = 0;
33 m_NbIsos = 2;
34 m_DrawHiddenLine = TRUE;
ebd1da3d 35 m_HlrModeIsOn = TRUE;
97319109 36 //}}AFX_DATA_INIT
7fd59977 37}
38
b3837d74 39void CSelectionDialog::DoDataExchange (CDataExchange* pDX)
7fd59977 40{
97319109 41 CDialog::DoDataExchange(pDX);
42 //{{AFX_DATA_MAP(CSelectionDialog)
43 DDX_Radio(pDX, IDC_PolyAlgo, m_Algo);
44 DDX_Radio(pDX, IDC_DisplayDefault, m_DisplayMode);
45 DDX_Text(pDX, IDC_EDIT_NBIsos, m_NbIsos);
46 DDX_Check(pDX, IDC_DrawHiddenLine, m_DrawHiddenLine);
ebd1da3d 47 DDX_Check(pDX, IDC_HlrModeIsOn, m_HlrModeIsOn);
97319109 48 //}}AFX_DATA_MAP
7fd59977 49}
50
51
52BEGIN_MESSAGE_MAP(CSelectionDialog, CDialog)
97319109 53 //{{AFX_MSG_MAP(CSelectionDialog)
b3837d74 54 ON_BN_CLICKED(ID_GetShape, OnGetSelectedShapes)
97319109 55 ON_BN_CLICKED(IDC_DisplayDefault, OnDisplayDefault)
56 ON_BN_CLICKED(IDC_VIsoParametrics, OnVIsoParametrics)
57 ON_BN_CLICKED(IDC_VApparentContour, OnVApparentContour)
58 ON_BN_CLICKED(IDC_VSewingEdges, OnVSewingEdges)
59 ON_BN_CLICKED(IDC_VsharpEdges, OnVsharpEdges)
60 ON_BN_CLICKED(IDC_VsmoothEdges, OnVsmoothEdges)
61 ON_BN_CLICKED(IDC_HsharpEdges, OnHsharpEdges)
62 ON_BN_CLICKED(IDC_HsmoothEdges, OnHsmoothEdges)
63 ON_BN_CLICKED(IDC_HSewingEdges, OnHSewingEdges)
64 ON_BN_CLICKED(IDC_HIsoParametrics, OnHIsoParametrics)
65 ON_BN_CLICKED(IDC_HApparentContour, OnHApparentContour)
66 ON_EN_CHANGE(IDC_EDIT_NBIsos, OnChangeEDITNBIsos)
67 ON_BN_CLICKED(IDC_Algo, OnAlgo)
68 ON_BN_CLICKED(IDC_PolyAlgo, OnPolyAlgo)
69 ON_BN_CLICKED(ID_Update2D, OnUpdate2D)
70 ON_BN_CLICKED(IDC_TopView, OnTopView)
71 ON_BN_CLICKED(IDC_BottomView, OnBottomView)
72 ON_BN_CLICKED(IDC_LeftView, OnLeftView)
73 ON_BN_CLICKED(IDC_RightView, OnRightView)
74 ON_BN_CLICKED(IDC_FrontView, OnFrontView)
75 ON_BN_CLICKED(IDC_BackView, OnBackView)
76 ON_BN_CLICKED(IDC_AxoView, OnAxoView)
77 ON_WM_LBUTTONDOWN()
78 ON_WM_LBUTTONUP()
79 ON_WM_RBUTTONDOWN()
80 ON_WM_RBUTTONUP()
81 ON_WM_MOUSEMOVE()
82 ON_BN_CLICKED(IDC_DrawHiddenLine, OnDrawHiddenLine)
ebd1da3d 83 ON_BN_CLICKED(IDC_HlrModeIsOn, OnHlrMode)
97319109 84 ON_WM_DRAWITEM()
85 ON_WM_PAINT()
86 //}}AFX_MSG_MAP
7fd59977 87END_MESSAGE_MAP()
88
89/////////////////////////////////////////////////////////////////////////////
90// CSelectionDialog message handlers
91
b3837d74 92BOOL CSelectionDialog::OnInitDialog()
7fd59977 93{
97319109 94 CDialog::OnInitDialog();
95
b3837d74 96 VERIFY(TopView.AutoLoad (IDC_TopView, this));
97 VERIFY(BottomView.AutoLoad (IDC_BottomView, this)) ;
98 VERIFY(LeftView .AutoLoad (IDC_LeftView , this)) ;
99 VERIFY(RightView .AutoLoad (IDC_RightView , this)) ;
100 VERIFY(FrontView .AutoLoad (IDC_FrontView , this)) ;
101 VERIFY(BackView .AutoLoad (IDC_BackView , this)) ;
102 VERIFY(AxoView .AutoLoad (IDC_AxoView , this)) ;
97319109 103
104 // get the View Window position to managed mouse move
105 CRect BoxRect,ViewRect;
b3837d74 106 GetWindowRect (BoxRect);
47162471 107 CWnd * TheViewerWindow = GetDlgItem (IDC_HlrDlgView);
b3837d74 108 TheViewerWindow->GetWindowRect (ViewRect);
97319109 109 myPosMinX = ViewRect.TopLeft().x - BoxRect.TopLeft().x;
47162471 110 myPosMaxX = ViewRect.Width() + myPosMinX;
97319109 111 myPosMinY = ViewRect.TopLeft().y - BoxRect.TopLeft().y;
112 myPosMaxY = myPosMinY + ViewRect.Height();
113
b3837d74 114 ShowHideButton (Standard_False);
115 OnDisplay (true);
97319109 116
b3837d74 117 // return TRUE unless you set the focus to a control
97319109 118 // EXCEPTION: OCX Property Pages should return FALSE
b3837d74 119 return TRUE;
7fd59977 120}
121
b3837d74 122void CSelectionDialog::OnDisplay (bool isFit)
7fd59977 123{
47162471 124 // GetDlgItem(IDC_HlrDlgView)->SetRedraw() wrapping of this method makes view blinking,
125 // but displaying of big models may be faster.
126 //GetDlgItem(IDC_HlrDlgView)->SetRedraw(true);
b3837d74 127 if (!myIsDisplayed)
128 {
47162471 129 Handle(Graphic3d_GraphicDriver) aGraphicDriver =
97319109 130 ((CHLRApp*)AfxGetApp())->GetGraphicDriver();
7fd59977 131
6a24c6de 132 myActiveViewer = new V3d_Viewer (aGraphicDriver);
de75ed09 133 myActiveViewer->SetDefaultLights();
134 myActiveViewer->SetLightOn();
135 myActiveView = myActiveViewer->CreateView();
7fd59977 136
47162471 137 Handle(WNT_Window) aWNTWindow = new WNT_Window (GetDlgItem (IDC_HlrDlgView)->GetSafeHwnd(),
de75ed09 138 Quantity_NOC_GRAY);
dde68833 139 myActiveView->SetComputedMode (m_HlrModeIsOn != 0);
de75ed09 140 myActiveView->SetWindow(aWNTWindow);
7fd59977 141
b3837d74 142 myInteractiveContext = new AIS_InteractiveContext (myActiveViewer);
7fd59977 143
de75ed09 144 // TRIHEDRON
b3837d74 145 Handle(Geom_Axis2Placement) aTrihedronAxis = new Geom_Axis2Placement (gp::XOY());
146 myTrihedron = new AIS_Trihedron (aTrihedronAxis);
7fd59977 147
0577ae8c 148 myInteractiveContext->Display (myTrihedron, Standard_False);
47162471 149 myIsDisplayed = Standard_True;
97319109 150 }
b3837d74 151 if(isFit)
152 {
97319109 153 myActiveView->ZFitAll();
154 myActiveView->FitAll();
155 }
b3837d74 156
97319109 157 myActiveView->Redraw();
47162471 158 //GetDlgItem (IDC_HlrDlgView)->SetRedraw (false);
7fd59977 159}
160
161
b3837d74 162void CSelectionDialog::SetTitle (const CString & aTitle)
7fd59977 163{
b3837d74 164 SetWindowText (aTitle);
7fd59977 165}
166
b3837d74 167void CSelectionDialog::UpdateViews()
7fd59977 168{
b3837d74 169 // Clear HLR dialog view
0577ae8c 170 myInteractiveContext->RemoveAll (Standard_False);
171 myInteractiveContext->Display (myTrihedron, Standard_False);
7fd59977 172
b3837d74 173 UpdateProjector();
7fd59977 174
b3837d74 175 // Display chosen shapes in the HLR dialog view.
7fd59977 176 Standard_Boolean OneOrMoreFound = Standard_False;
404c8936 177 for (myDoc->GetAISContext()->InitSelected();
178 myDoc->GetAISContext()->MoreSelected();
179 myDoc->GetAISContext()->NextSelected())
7fd59977 180 {
404c8936 181 Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast (myDoc->GetAISContext()->SelectedInteractive());
7fd59977 182 if (!anAISShape.IsNull())
b3837d74 183 {
184 OneOrMoreFound = Standard_True;
0577ae8c 185 myInteractiveContext->Display (anAISShape, Standard_False);
b3837d74 186 }
97319109 187 }
0577ae8c 188 myInteractiveContext->UpdateCurrentViewer();
b3837d74 189 // Apply HLR to chosen shapes and display result into the 2d view.
190 Apply();
191 // Update viewer
192 myDoc->FitAll2DViews (Standard_False);
193 // Check the selection: if no object : disable all possiblity.
194 ShowHideButton (OneOrMoreFound);
195 OnDisplay (true);
196}
7fd59977 197
b3837d74 198void CSelectionDialog::OnGetSelectedShapes()
199{
200 // Create new displayable shape.
201 myDisplayableShape = new ISession2D_Shape();
202 UpdateProjector();
203 myDisplayableShape->SetNbIsos (m_NbIsos);
7fd59977 204
b3837d74 205 // Clear HLR dialog view
0577ae8c 206 myInteractiveContext->RemoveAll (Standard_False);
207 myInteractiveContext->Display (myTrihedron, Standard_False);
7fd59977 208
b3837d74 209 Standard_Boolean OneOrMoreFound = Standard_False;
404c8936 210 for (myDoc->GetAISContext()->InitSelected();
211 myDoc->GetAISContext()->MoreSelected();
212 myDoc->GetAISContext()->NextSelected())
b3837d74 213 {
404c8936 214 Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast (myDoc->GetAISContext()->SelectedInteractive());
b3837d74 215
216 if (!anAISShape.IsNull())
217 {
218 OneOrMoreFound = Standard_True;
219 TopoDS_Shape aShape = anAISShape->Shape();
220 myDisplayableShape->Add (aShape);
38fd0511 221 Handle(AIS_Shape) aSelectedShape = new AIS_Shape (aShape);
0577ae8c 222 myInteractiveContext->Display (aSelectedShape, Standard_False);
b3837d74 223 }
224 }
0577ae8c 225 myInteractiveContext->UpdateCurrentViewer();
b3837d74 226 // Apply HLR to chosen shapes and display result into the 2d view.
227 Apply();
228 // Update viewer
229 myDoc->FitAll2DViews (Standard_False);
230
231 // Check the selection: if no object : disable all possiblity.
232 ShowHideButton (OneOrMoreFound);
233 OnDisplay (true);
7fd59977 234}
235
b3837d74 236void CSelectionDialog::Apply()
7fd59977 237{
b3837d74 238 SetCursor(AfxGetApp()->LoadStandardCursor (IDC_WAIT));
0577ae8c 239 myDoc->GetInteractiveContext2D()->RemoveAll (Standard_False);
b3837d74 240 UpdateData (true);
7fd59977 241
b3837d74 242 Standard_Integer aDisplayMode = m_DisplayMode;
7fd59977 243
b3837d74 244 if (m_Algo == 1)
245 {
246 aDisplayMode += 100;
247 }
7fd59977 248
b3837d74 249 if (!m_DrawHiddenLine)
250 {
251 aDisplayMode += 1000;
252 }
7fd59977 253
b3837d74 254 myDoc->GetInteractiveContext2D()->Display (myDisplayableShape, // object
255 aDisplayMode,
256 aDisplayMode,
257 Standard_True); // Redraw
258
259 SetCursor(AfxGetApp()->LoadStandardCursor (IDC_ARROW));
7fd59977 260}
261
262void CSelectionDialog::UpdateProjector()
263{
ee2be2a8 264 Standard_Real DX,DY,DZ,XAt,YAt,ZAt, Vx,Vy,Vz ;
97319109 265 myActiveView->Proj(DX,DY,DZ);
266 myActiveView->At(XAt,YAt,ZAt);
267 myActiveView->Up( Vx,Vy,Vz );
268 OnDisplay(false);
269 Standard_Boolean IsPerspective = (myActiveView->Type() == V3d_PERSPECTIVE);
ee2be2a8 270 Standard_Real aFocus = 1;
97319109 271 Prs3d_Projector aPrs3dProjector(IsPerspective,aFocus,DX,DY,DZ,XAt,YAt,ZAt,Vx,Vy,Vz);
272 HLRAlgo_Projector aProjector = aPrs3dProjector.Projector();
273
274 if (myDisplayableShape.IsNull()) return;
275 myDisplayableShape->SetProjector(aProjector);
7fd59977 276}
277
278void CSelectionDialog::ShowHideButton(Standard_Boolean EnableButton)
279{
97319109 280 UpdateData(true);
281
282 GetDlgItem(ID_Update2D )->EnableWindow(EnableButton);
283 GetDlgItem(IDC_DisplayDefault )->EnableWindow(EnableButton);
284 GetDlgItem(IDC_PolyAlgo )->EnableWindow(EnableButton);
285 GetDlgItem(IDC_Algo )->EnableWindow(EnableButton);
286
287 GetDlgItem(IDC_VsharpEdges )->EnableWindow(EnableButton);
288 GetDlgItem(IDC_VsmoothEdges )->EnableWindow(EnableButton);
289 GetDlgItem(IDC_VSewingEdges )->EnableWindow(EnableButton);
290 GetDlgItem(IDC_VApparentContour )->EnableWindow(EnableButton);
291 GetDlgItem(IDC_VIsoParametrics )->EnableWindow(EnableButton);
292
293 GetDlgItem(IDC_DrawHiddenLine )->EnableWindow(EnableButton);
294
295 GetDlgItem(IDC_HsmoothEdges )->EnableWindow(EnableButton && m_DrawHiddenLine);
296 GetDlgItem(IDC_HSewingEdges )->EnableWindow(EnableButton && m_DrawHiddenLine);
297 GetDlgItem(IDC_HApparentContour )->EnableWindow(EnableButton && m_DrawHiddenLine);
298 GetDlgItem(IDC_HsharpEdges )->EnableWindow(EnableButton && m_DrawHiddenLine);
299 GetDlgItem(IDC_HIsoParametrics )->EnableWindow(EnableButton && m_DrawHiddenLine);
300
301 GetDlgItem(IDC_EDIT_NBIsos )->EnableWindow(EnableButton);
302 GetDlgItem(IDC_STATIC_NbIsos )->EnableWindow(EnableButton);
303
304 if(m_Algo == 0)
305 {
b3837d74 306 if (m_DisplayMode == 5 || m_DisplayMode == 10)
307 {
308 m_DisplayMode=0;
309 }
97319109 310
311 GetDlgItem(IDC_VIsoParametrics)->EnableWindow(false);
312 GetDlgItem(IDC_HIsoParametrics)->EnableWindow(false);
313 GetDlgItem(IDC_STATIC_NbIsos) ->EnableWindow(false);
314 GetDlgItem(IDC_EDIT_NBIsos) ->EnableWindow(false);
315 }
316 else
317 {
318 GetDlgItem(IDC_VIsoParametrics)->EnableWindow(true);
319 GetDlgItem(IDC_HIsoParametrics)->EnableWindow(m_DrawHiddenLine);
320 GetDlgItem(IDC_STATIC_NbIsos) ->EnableWindow(true);
321 GetDlgItem(IDC_EDIT_NBIsos) ->EnableWindow(true);
322 }
323 UpdateData(false);
7fd59977 324}
325
326void CSelectionDialog::OnDisplayDefault()
327{ Apply(); }
328void CSelectionDialog::OnVIsoParametrics()
329{ Apply(); }
330void CSelectionDialog::OnVApparentContour()
331{ Apply(); }
332void CSelectionDialog::OnVSewingEdges()
333{ Apply(); }
334void CSelectionDialog::OnVsharpEdges()
335{ Apply(); }
336void CSelectionDialog::OnVsmoothEdges()
337{ Apply(); }
338void CSelectionDialog::OnHsharpEdges()
339{ Apply(); }
340void CSelectionDialog::OnHsmoothEdges()
341{ Apply(); }
342void CSelectionDialog::OnHSewingEdges()
343{ Apply(); }
344void CSelectionDialog::OnHIsoParametrics()
345{ Apply(); }
346void CSelectionDialog::OnHApparentContour()
347{ Apply(); }
348
349void CSelectionDialog::OnChangeEDITNBIsos()
5c1f974e 350{
351 UpdateData(true);
352 myDisplayableShape->SetNbIsos(m_NbIsos);
353 Apply();
7fd59977 354}
355void CSelectionDialog::OnAlgo()
5c1f974e 356{
357 ShowHideButton();
7fd59977 358 Apply();
359}
360
361void CSelectionDialog::OnPolyAlgo()
5c1f974e 362{
363 ShowHideButton();
7fd59977 364 Apply();
365}
366
367void CSelectionDialog::OnDrawHiddenLine()
368{
369 UpdateData(true);
5c1f974e 370 if(m_DisplayMode >=6 )
371 {
372 m_DisplayMode=0;
373 UpdateData(false);
374 }
375 ShowHideButton();
376 Apply();
7fd59977 377}
378
379void CSelectionDialog::OnUpdate2D()
380{
5c1f974e 381 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
382 myDoc->ActivateFrame(RUNTIME_CLASS(OCC_2dView),SW_NORMAL);
383 UpdateProjector();
97319109 384 Apply();
385 myDoc->FitAll2DViews(Standard_False);
5c1f974e 386 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
7fd59977 387}
388
389void CSelectionDialog::OnTopView()
390{
5c1f974e 391 myActiveView->SetProj(V3d_Zpos);
392 OnDisplay(true);
7fd59977 393}
394
395void CSelectionDialog::OnBottomView()
396{
5c1f974e 397 myActiveView->SetProj(V3d_Zneg);
398 OnDisplay(true);
7fd59977 399}
400
401void CSelectionDialog::OnLeftView()
402{
32757c6e 403 myActiveView->SetProj(V3d_Xneg);
5c1f974e 404 OnDisplay(true);
7fd59977 405}
406
407void CSelectionDialog::OnRightView()
408{
32757c6e 409 myActiveView->SetProj(V3d_Xpos);
5c1f974e 410 OnDisplay(true);
7fd59977 411}
412
413void CSelectionDialog::OnFrontView()
414{
32757c6e 415 myActiveView->SetProj(V3d_Yneg);
5c1f974e 416 OnDisplay(true);
7fd59977 417}
418
419void CSelectionDialog::OnBackView()
420{
32757c6e 421 myActiveView->SetProj(V3d_Ypos);
5c1f974e 422 OnDisplay(true);
7fd59977 423}
424
425void CSelectionDialog::OnAxoView()
426{
5c1f974e 427 myActiveView->SetProj(V3d_XposYnegZpos);
428 OnDisplay(true);
7fd59977 429}
430
de75ed09 431void CSelectionDialog::OnHlrMode()
7fd59977 432{
5c1f974e 433 UpdateData(true);
7fd59977 434
de75ed09 435 if (!m_HlrModeIsOn)
5c1f974e 436 {
dde68833 437 myActiveView->SetComputedMode (m_HlrModeIsOn != 0);
5c1f974e 438 }
439 else
440 {
441 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
dde68833 442 myActiveView->SetComputedMode (m_HlrModeIsOn != 0);
5c1f974e 443 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
444 }
445 OnDisplay(false);
7fd59977 446}
447
448void CSelectionDialog::OnLButtonDown(UINT nFlags, CPoint point)
449{
5c1f974e 450 CDialog::OnLButtonDown(nFlags, point);
7fd59977 451
5c1f974e 452 if ((myPosMinX > point.x)||(myPosMaxX < point.x) ||
453 (myPosMinY > point.y) ||(myPosMaxY < point.y))
454 return;
7fd59977 455
456 // save the current mouse coordinate
457 myXmax=point.x; myYmax=point.y;
458}
459
460void CSelectionDialog::OnLButtonUp(UINT nFlags, CPoint point)
461{
5c1f974e 462 CDialog::OnLButtonUp(nFlags, point);
7fd59977 463
5c1f974e 464 if ((myPosMinX > point.x)||(myPosMaxX < point.x) ||
465 (myPosMinY > point.y) ||(myPosMaxY < point.y))
466 return;
7fd59977 467}
468
469void CSelectionDialog::OnRButtonDown(UINT nFlags, CPoint point)
470{
5c1f974e 471 CDialog::OnRButtonDown(nFlags, point);
472
de75ed09 473 if ((myPosMinX > point.x) || (myPosMaxX < point.x) ||
474 (myPosMinY > point.y) || (myPosMaxY < point.y))
475 {
5c1f974e 476 return;
de75ed09 477 }
5c1f974e 478
de75ed09 479 if ( nFlags & CASCADESHORTCUTKEY )
5c1f974e 480 {
de75ed09 481 if (m_HlrModeIsOn)
482 {
483 myActiveView->SetComputedMode (Standard_False);
484 }
485 myActiveView->StartRotation (point.x, point.y);
486 OnDisplay (false);
5c1f974e 487 }
7fd59977 488}
489
490void CSelectionDialog::OnRButtonUp(UINT nFlags, CPoint point)
491{
5c1f974e 492 CDialog::OnRButtonUp(nFlags, point);
7fd59977 493
de75ed09 494 if ((myPosMinX > point.x) || (myPosMaxX < point.x) ||
495 (myPosMinY > point.y) || (myPosMaxY < point.y))
496 {
5c1f974e 497 return;
de75ed09 498 }
7fd59977 499
5c1f974e 500 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
b3837d74 501 // reset the good HLR mode according to the stored one
de75ed09 502 // --> dynamic rotation may have change it
dde68833 503 myActiveView->SetComputedMode (m_HlrModeIsOn != 0);
5c1f974e 504 OnDisplay(false);
505 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
7fd59977 506}
507
508void CSelectionDialog::OnMouseMove(UINT nFlags, CPoint point)
509{
5c1f974e 510 CDialog::OnMouseMove(nFlags, point);
7fd59977 511
5c1f974e 512 if ((myPosMinX > point.x)||(myPosMaxX < point.x) ||
513 (myPosMinY > point.y) ||(myPosMaxY < point.y))
514 return;
7fd59977 515
7fd59977 516 if ( nFlags & MK_LBUTTON)
5c1f974e 517 {//left button
518 if ( nFlags & CASCADESHORTCUTKEY )
7fd59977 519 {
5c1f974e 520 // move with MB1 and Control : on the dynamic zooming
521 // Do the zoom in function of mouse's coordinates
522 myActiveView->Zoom(myXmax,myYmax,point.x,point.y);
523 // save the current mouse coordinate
524 myXmax = point.x; myYmax = point.y;
525 }// if ( nFlags & CASCADESHORTCUTKEY ) else
526 }
527 else if ( nFlags & MK_MBUTTON)
528 {
529 if ( nFlags & CASCADESHORTCUTKEY )
7fd59977 530 {
5c1f974e 531 myActiveView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
532 myXmax = point.x; myYmax = point.y;
533 }
534 }
535 else if ( nFlags & MK_RBUTTON)
536 {//right button
537 if ( nFlags & CASCADESHORTCUTKEY )
7fd59977 538 {
5c1f974e 539 myActiveView->Rotation(point.x,point.y);
540 }
541 }
542 else
543 {// No buttons
544 myXmax = point.x; myYmax = point.y;
545 }
546 OnDisplay(false);
7fd59977 547}
548
549void CSelectionDialog::OnOK()
550{
551 CDialog::OnOK();
552}
553
554void CSelectionDialog::OnPaint()
555{
5c1f974e 556 OnDisplay(false);
7fd59977 557}