1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0025284: Problems with standard MFC samples

- OCAF sample Save Document option: corrected conversion from LPCTSTR to Standard_CString
 - HLR sample: corrected mouse move event handling for HLR 2D view; Corrected CSelectionDialog view displaying and updating
 - Geometry sample: CGeometryDoc correction to avoid code duplication
 - OCC_3dBaseDoc: corrected DragEvent() handler for proper emulation of rectangle selection.
 - Viewer3d sample: moved resource files (resource.h; resource.hm; AISToolbar.bmp) from /src to /res

Code style changes

Fixed "About" dialog error in release.

Corrected dimension dialogs

Workaround for dimensions sample: AIS_LocalContext::SelectedShape() doesn't take into account TopoDS shape local transformation, and operates with selected interactive transformation.
This commit is contained in:
aba
2014-10-09 15:40:14 +04:00
committed by bugmaster
parent 679d38788d
commit 4716247158
51 changed files with 1103 additions and 1989 deletions

View File

@@ -38,8 +38,6 @@ BEGIN_MESSAGE_MAP(OCC_3dBaseDoc, OCC_BaseDoc)
ON_UPDATE_COMMAND_UI(ID_OBJECT_DISPLAYALL, OnUpdateObjectDisplayall)
ON_COMMAND(ID_OBJECT_REMOVE, OnObjectRemove)
ON_UPDATE_COMMAND_UI(ID_OBJECT_REMOVE, OnUpdateObjectRemove)
ON_COMMAND(ID_OBJECT_DIM, OnObjectAddDimensions)
ON_UPDATE_COMMAND_UI(ID_OBJECT_DIM, OnUpdateObjectAddDimensions)
//}}AFX_MSG_MAP
ON_COMMAND_EX_RANGE(ID_OBJECT_MATERIAL_BRASS,ID_OBJECT_MATERIAL_DEFAULT, OnObjectMaterialRange)
@@ -52,20 +50,16 @@ END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////
OCC_3dBaseDoc::OCC_3dBaseDoc()
:myPopupMenuNumber(0),
myDimensionDlg()
:myPopupMenuNumber(0)
{
AfxInitRichEdit();
Handle(Graphic3d_GraphicDriver) aGraphicDriver =
((OCC_App*)AfxGetApp())->GetGraphicDriver();
Handle(Graphic3d_GraphicDriver) aGraphicDriver = ((OCC_App*)AfxGetApp())->GetGraphicDriver();
myViewer = new V3d_Viewer (aGraphicDriver, Standard_ExtString("Visu3D") );
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myAISContext = new AIS_InteractiveContext (myViewer);
myDimensionDlg.SetContext (myAISContext);
myDimensionDlg.Create(CDimensionDlg::IDD, NULL);
}
OCC_3dBaseDoc::~OCC_3dBaseDoc()
@@ -87,20 +81,27 @@ void OCC_3dBaseDoc::DragEvent (const Standard_Integer theMouseX,
static Standard_Integer aStartDragX = 0;
static Standard_Integer aStartDragY = 0;
if (theState == -1)
switch (theState)
{
// button down
aStartDragX = theMouseX;
aStartDragY = theMouseY;
}
if (theState == 1)
{
// button up
myAISContext->Select (aStartDragX, aStartDragY,
theMouseX, theMouseY,
theView);
}
case -1:
{
aStartDragX = theMouseX;
aStartDragY = theMouseY;
break;
}
case 0:
{
myAISContext->UpdateCurrentViewer();
break;
}
case 1:
{
myAISContext->Select (aStartDragX, aStartDragY,
theMouseX, theMouseY,
theView);
break;
}
};
}
//-----------------------------------------------------------------------------------------
@@ -423,18 +424,3 @@ void OCC_3dBaseDoc::SetMaterial(Graphic3d_NameOfMaterial Material)
myAISContext->SetMaterial (myAISContext->Current(),
(Graphic3d_NameOfMaterial)(Material));
}
void OCC_3dBaseDoc::OnObjectAddDimensions()
{
//Add dimentions dialog is opened here
myDimensionDlg.ShowWindow(SW_SHOW);
myDimensionDlg.UpdateStandardMode ();
}
void OCC_3dBaseDoc::OnUpdateObjectAddDimensions(CCmdUI* /*pCmdUI*/)
{
// Check if local context is opened
//pCmdUI->Enable (myAISContext->HasOpenedContext());
}