1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0024943: Port MFC samples to UNICODE for compatibility with VS2013

Add vc12 project files for MFC samples.

CMake - add Unicode option for MFC samples

CMake - do not set MFC option globally

Update description of Cmake building procedure for MFC sample

Correction of cmake.md and automake.md

0024943: Port MFC sample to UNICODE for compatibility with VS2013
The formatting of developer guides about OCCT building with various build systems has been improved.

automake article clean up
This commit is contained in:
kgv
2014-07-31 13:52:43 +04:00
committed by bugmaster
parent 9d0fc01b3f
commit 576f8b111b
140 changed files with 7640 additions and 1202 deletions

View File

@@ -181,7 +181,7 @@ void COffsetDlg::SetOffsets(Standard_Real theFactor, Standard_Real theUnits)
}
CString aTextInDialog = myDoc -> GetDialogText();
if (strcmp(aTextInDialog, Message.ToCString()))
if (aTextInDialog != Message.ToCString())
myDoc -> UpdateResultMessageDlg("Set offsets", Message);
aAISContext->UpdateCurrentViewer();
}

View File

@@ -58,8 +58,8 @@ TexturesExt_Presentation::TexturesExt_Presentation()
void TexturesExt_Presentation::DoSample()
{
((CViewer3dApp*) AfxGetApp())->SetSampleName("Viewer3d");
((CViewer3dApp*) AfxGetApp())->SetSamplePath ("..\\..\\04_Viewer3d");
((CViewer3dApp*) AfxGetApp())->SetSampleName (L"Viewer3d");
((CViewer3dApp*) AfxGetApp())->SetSamplePath (L"..\\..\\04_Viewer3d");
getAISContext()->EraseAll();
if (myIndex >=0 && myIndex < myNbSamples)
{
@@ -152,7 +152,8 @@ Handle_AIS_TexturedShape TexturesExt_Presentation::Texturize(const TopoDS_Shape&
initfile += aTFileName.ToCString();
}
aTShape->SetTextureFileName((Standard_CString)(LPCTSTR)initfile);
TCollection_ExtendedString aFileName ((Standard_ExtString )(const wchar_t* )initfile);
aTShape->SetTextureFileName (TCollection_AsciiString (aFileName, '?'));
// do other initialization of AIS_TexturedShape
aTShape->SetTextureMapOn();
@@ -178,18 +179,21 @@ Standard_Boolean TexturesExt_Presentation::loadShape(TopoDS_Shape& aShape,
initfile += "\\Data\\";
initfile += aFileName.ToCString();
TCollection_AsciiString Path((Standard_CString)(LPCTSTR)initfile);
std::filebuf aFileBuf;
std::istream aStream (&aFileBuf);
if (!aFileBuf.open (initfile, ios::in))
{
initfile += L" was not found. The sample can not be shown.";
getDocument()->UpdateResultMessageDlg ("Textured Shape", initfile);
return Standard_False;
}
BRep_Builder aBld;
//Standard_Boolean isRead = BRepTools::Read (aShape, aPath.ToCString(), aBld);
//if (!isRead)
// isRead = BRepTools::Read (aShape, bPath.ToCString(), aBld);
Standard_Boolean isRead = BRepTools::Read (aShape, Path.ToCString(), aBld);
if (!isRead)
BRepTools::Read (aShape, aStream, aBld);
if (aShape.IsNull())
{
Path += " was not found. The sample can not be shown.";
getDocument()->UpdateResultMessageDlg("Textured Shape", Path.ToCString());
initfile += " is invalid. The sample can not be shown.";
getDocument()->UpdateResultMessageDlg ("Textured Shape", initfile);
return Standard_False;
}

View File

@@ -134,26 +134,26 @@ BOOL CTrihedronDlg::OnInitDialog()
UpdateData(TRUE);
// Initializing the ComboBox : Position
m_ComboTrihedronPosList.InsertString(-1,"Center");
m_ComboTrihedronPosList.InsertString(-1,"Left Lower");
m_ComboTrihedronPosList.InsertString(-1,"Left Upper");
m_ComboTrihedronPosList.InsertString(-1,"Right Lower");
m_ComboTrihedronPosList.InsertString(-1,"Right Upper");
m_ComboTrihedronPosList.InsertString(-1, L"Center");
m_ComboTrihedronPosList.InsertString(-1, L"Left Lower");
m_ComboTrihedronPosList.InsertString(-1, L"Left Upper");
m_ComboTrihedronPosList.InsertString(-1, L"Right Lower");
m_ComboTrihedronPosList.InsertString(-1, L"Right Upper");
// Initializing the ComboBox : Color
/*
m_ComboTrihedronColorList.InsertString(-1,"BLACK");
m_ComboTrihedronColorList.InsertString(-1,"MATRABLUE");
m_ComboTrihedronColorList.InsertString(-1,"MATRAGRAY");
m_ComboTrihedronColorList.InsertString(-1,"ALICE BLUE");
m_ComboTrihedronColorList.InsertString(-1,"WHITE");
m_ComboTrihedronColorList.InsertString(-1,"BISQUE");
m_ComboTrihedronColorList.InsertString(-1, L"BLACK");
m_ComboTrihedronColorList.InsertString(-1, L"MATRABLUE");
m_ComboTrihedronColorList.InsertString(-1, L"MATRAGRAY");
m_ComboTrihedronColorList.InsertString(-1, L"ALICE BLUE");
m_ComboTrihedronColorList.InsertString(-1, L"WHITE");
m_ComboTrihedronColorList.InsertString(-1, L"BISQUE");
*/
m_ComboTrihedronColorList.InsertString(-1,"Black");
m_ComboTrihedronColorList.InsertString(-1,"Blue");
m_ComboTrihedronColorList.InsertString(-1,"Gray");
m_ComboTrihedronColorList.InsertString(-1,"White");
//m_ComboTrihedronColorList.InsertString(-1,"Bisque");
m_ComboTrihedronColorList.InsertString(-1, L"Black");
m_ComboTrihedronColorList.InsertString(-1, L"Blue");
m_ComboTrihedronColorList.InsertString(-1, L"Gray");
m_ComboTrihedronColorList.InsertString(-1, L"White");
//m_ComboTrihedronColorList.InsertString(-1, L"Bisque");

View File

@@ -29,7 +29,7 @@ END_MESSAGE_MAP()
CViewer3dApp::CViewer3dApp() : OCC_App()
{
SampleName = "Viewer3d"; //for about dialog
SetSamplePath ("..\\..\\03_Viewer3d");
SetSamplePath (L"..\\..\\03_Viewer3d");
}
/////////////////////////////////////////////////////////////////////////////

View File

@@ -131,12 +131,17 @@ void CViewer3dDoc::Dump(CDumpContext& dc) const
/////////////////////////////////////////////////////////////////////////////
// CViewer3dDoc commands
void CViewer3dDoc::UpdateResultMessageDlg(CString Title, TCollection_AsciiString aMessage)
void CViewer3dDoc::UpdateResultMessageDlg (CString theTitle, const TCollection_AsciiString& theMessage)
{
CString text(aMessage.ToCString());
myCResultDialog.SetText(text);
CString aText (theMessage.ToCString());
myCResultDialog.SetText (aText);
myCResultDialog.SetTitle(theTitle);
}
myCResultDialog.SetTitle(Title);
void CViewer3dDoc::UpdateResultMessageDlg(CString theTitle, CString theMessage)
{
myCResultDialog.SetText (theMessage);
myCResultDialog.SetTitle(theTitle);
}
void CViewer3dDoc::OnBox()
@@ -580,7 +585,7 @@ void CViewer3dDoc::InputEvent(const Standard_Integer /*x*/,
" Methods SetPlanarFaceColor and SetCylindricalFaceColor are also \n"
" defined in the User_Cylinder class. \n"
" \n");
SetTitle("Change face color");
SetTitle (L"Change face color");
}
}
@@ -718,7 +723,7 @@ void CViewer3dDoc::OnFaces()
" \n"
" myAISContext->ActivateStandardMode(TopAbs_FACE); \n"
" \n");
SetTitle("Standard mode: TopAbs_FACE");
SetTitle (L"Standard mode: TopAbs_FACE");
}
//Set edges selection mode
@@ -733,7 +738,7 @@ void CViewer3dDoc::OnEdges()
" \n"
" myAISContext->ActivateStandardMode(TopAbs_EDGE); \n"
" \n");
SetTitle("Standard mode: TopAbs_EDGE");
SetTitle (L"Standard mode: TopAbs_EDGE");
}
// Set vertices selection mode
@@ -748,7 +753,7 @@ void CViewer3dDoc::OnVertices()
" \n"
" myAISContext->ActivateStandardMode(TopAbs_VERTEX); \n"
" \n");
SetTitle("Standard mode: TopAbs_VERTEX");
SetTitle (L"Standard mode: TopAbs_VERTEX");
}
//Neutral selection mode
@@ -759,7 +764,7 @@ void CViewer3dDoc::OnNeutral()
myCResultDialog.SetTitle("Standard mode: Neutral");
myCResultDialog.SetText(" myAISContext->CloseAllContexts(); \n"
" \n");
SetTitle("Standard mode: Neutral");
SetTitle (L"Standard mode: Neutral");
}
// Change the color of faces on a user cylinder
@@ -778,8 +783,8 @@ void CViewer3dDoc::OnFillet3d()
{
if (!myAISContext->HasOpenedContext())
{
AfxMessageBox("It is necessary to activate the edges selection mode\n"
"and select edges on an object before \nrunning this function");
AfxMessageBox (L"It is necessary to activate the edges selection mode\n"
L"and select edges on an object before \nrunning this function");
return;
}
@@ -790,8 +795,8 @@ void CViewer3dDoc::OnFillet3d()
if (S.IsNull())
{
AfxMessageBox("It is necessary to activate the edges selection mode\n"
"and select edges on an object before \nrunning this function");
AfxMessageBox (L"It is necessary to activate the edges selection mode\n"
L"and select edges on an object before \nrunning this function");
return;
}
@@ -804,8 +809,8 @@ void CViewer3dDoc::OnFillet3d()
TopoDS_Shape aSelShape = myAISContext->SelectedShape();
if (aSelShape.ShapeType() != TopAbs_EDGE)
{
AfxMessageBox("It is necessary to activate the edges selection mode\n\
and select edges on an object before \nrunning this function");
AfxMessageBox (L"It is necessary to activate the edges selection mode\n"
L"and select edges on an object before \nrunning this function");
return;
}
}
@@ -831,7 +836,7 @@ void CViewer3dDoc::OnFillet3d()
}
catch (Standard_Failure)
{
AfxMessageBox("Error During Fillet computation");
AfxMessageBox (L"Error During Fillet computation");
return;
}
@@ -854,7 +859,7 @@ void CViewer3dDoc::OnFillet3d()
" \n"
" myAISContext->Redisplay(S); \n"
" \n");
SetTitle("Make a fillet");
SetTitle (L"Make a fillet");
}
// Create and display a circle with standard tools
@@ -877,7 +882,7 @@ void CViewer3dDoc::OnCircle()
" \n"
" myAISContext->Display(anAISCirc); \n"
" \n");
SetTitle("Create a circle");
SetTitle (L"Create a circle");
}
void CViewer3dDoc::OnLine()
@@ -897,7 +902,7 @@ void CViewer3dDoc::OnLine()
" \n"
" myAISContext->Display(anAISLine); \n"
" \n");
SetTitle("Create a line");
SetTitle (L"Create a line");
}
void CViewer3dDoc::OnNbisos()
@@ -917,7 +922,7 @@ void CViewer3dDoc::OnNbisos()
" \n"
" myAISContext->DefaultDrawer()->VIsoAspect()->SetNumber(dlg.m_isov); \n"
" \n");
SetTitle("Iso Aspect");
SetTitle (L"Iso Aspect");
}
}
@@ -981,8 +986,7 @@ void CViewer3dDoc::DoSample()
{
Standard_SStream aSStream;
aSStream << "An exception was caught: " << Standard_Failure::Caught() << ends;
Standard_CString aMsg = aSStream.str().c_str();
// aSStream.rdbuf()->freeze(0); // allow deletion of dynamic array
CString aMsg = aSStream.str().c_str();
AfxMessageBox (aMsg);
}
}

View File

@@ -44,7 +44,8 @@ public:
static void Fit();
virtual ~CViewer3dDoc();
void UpdateResultMessageDlg(CString Title, TCollection_AsciiString aMessage);
void UpdateResultMessageDlg (CString theTitle, const TCollection_AsciiString& theMessage);
void UpdateResultMessageDlg (CString theTitle, CString theMessage);
virtual BOOL OnNewDocument();
virtual void Popup (const Standard_Integer x ,
const Standard_Integer y ,

View File

@@ -892,10 +892,9 @@ void CViewer3dView::OnDirectionalLight()
// Checking if the Active lights limit number is not reached
if( NbActiveLights>=myGraphicDriver->InquireLightLimit() )
{
char tmpStr[128];
sprintf_s(tmpStr, "You have reach the limit number of active lights (%d).\n Clear lights to create new ones.",
myGraphicDriver->InquireLightLimit());
MessageBox(tmpStr,"Light creation", MB_OK);
CString aMsg;
aMsg.Format (L"You have reach the limit number of active lights (%d).\n Clear lights to create new ones.", myGraphicDriver->InquireLightLimit());
MessageBox (aMsg, L"Light creation", MB_OK);
return;
}
@@ -921,10 +920,9 @@ void CViewer3dView::OnSpotLight()
// Checking if the Active lights limit number is not reached
if( NbActiveLights>=myGraphicDriver->InquireLightLimit() )
{
char tmpStr[128];
sprintf_s(tmpStr, "You have reach the limit number of active lights (%d).\n Clear lights to create new ones.",
myGraphicDriver->InquireLightLimit());
MessageBox(tmpStr,"Light creation", MB_OK);
CString aMsg;
aMsg.Format(L"You have reach the limit number of active lights (%d).\n Clear lights to create new ones.", myGraphicDriver->InquireLightLimit());
MessageBox (aMsg, L"Light creation", MB_OK);
return;
}
@@ -949,10 +947,9 @@ void CViewer3dView::OnPositionalLight()
// Checking if the Active lights limit number is not reached
if( NbActiveLights>=myGraphicDriver->InquireLightLimit() )
{
char tmpStr[128];
sprintf_s(tmpStr, "You have reach the limit number of active lights (%d).\n Clear lights to create new ones.",
myGraphicDriver->InquireLightLimit());
MessageBox(tmpStr,"Light creation", MB_OK);
CString aMsg;
aMsg.Format(L"You have reach the limit number of active lights (%d).\n Clear lights to create new ones.", myGraphicDriver->InquireLightLimit());
MessageBox(aMsg, L"Light creation", MB_OK);
return;
}
@@ -980,10 +977,9 @@ void CViewer3dView::OnAmbientLight()
// Checking if the Active lights limit number is not reached
if( NbActiveLights>=myGraphicDriver->InquireLightLimit() )
{
char tmpStr[128];
sprintf_s(tmpStr, "You have reach the limit number of active lights (%d).\n Clear lights to create new ones.",
myGraphicDriver->InquireLightLimit());
MessageBox(tmpStr,"Light creation", MB_OK);
CString aMsg;
aMsg.Format(L"You have reach the limit number of active lights (%d).\n Clear lights to create new ones.", myGraphicDriver->InquireLightLimit());
MessageBox(aMsg, L"Light creation", MB_OK);
return;
}

View File

@@ -46,10 +46,10 @@ BOOL ZClippingDlg::OnInitDialog()
CDialog::OnInitDialog();
// Initializing the ComboBox
m_ZClippingTypeList.InsertString(-1,"OFF");
m_ZClippingTypeList.InsertString(-1,"BACK");
m_ZClippingTypeList.InsertString(-1,"FRONT");
m_ZClippingTypeList.InsertString(-1,"SLICE");
m_ZClippingTypeList.InsertString(-1, L"OFF");
m_ZClippingTypeList.InsertString(-1, L"BACK");
m_ZClippingTypeList.InsertString(-1, L"FRONT");
m_ZClippingTypeList.InsertString(-1, L"SLICE");
// Getting the type of ZClipping and select it in the ComboBox
Quantity_Length Depth, Width;