mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0027880: Samples - fix handling of Unicode paths within MFC import/export sample
This commit is contained in:
parent
b357dcc225
commit
e620e2857f
@ -4388,7 +4388,7 @@ Standard_Real Length = System.Mass();\n\
|
||||
gp_Mat I = System.MatrixOfInertia();\n\
|
||||
\n");
|
||||
PocessTextInDialog("Linear Properties", Message);
|
||||
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, (const wchar_t* )string.ToExtString(), L"Linear Properties", MB_OK);
|
||||
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, string.ToWideString(), L"Linear Properties", MB_OK);
|
||||
}
|
||||
|
||||
void CModelingDoc::OnSurface()
|
||||
@ -4503,7 +4503,7 @@ Standard_Real Area = System.Mass();\n\
|
||||
gp_Mat I = System.MatrixOfInertia();\n\
|
||||
\n");
|
||||
PocessTextInDialog("Surface Properties", Message);
|
||||
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, (const wchar_t* )string.ToExtString(), L"Surface Properties", MB_OK);
|
||||
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, string.ToWideString(), L"Surface Properties", MB_OK);
|
||||
|
||||
}
|
||||
|
||||
@ -4585,7 +4585,7 @@ Standard_Real Volume = System.Mass();\n\
|
||||
gp_Mat I = System.MatrixOfInertia();\n\
|
||||
\n");
|
||||
PocessTextInDialog("Volume Properties", Message);
|
||||
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, (const wchar_t* )string.ToExtString(), L"Volume Properties", MB_OK);
|
||||
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, string.ToWideString(), L"Volume Properties", MB_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -321,7 +321,7 @@ void CViewer2dDoc::OnBUTTONTestImage()
|
||||
NULL,
|
||||
NULL,
|
||||
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
|
||||
SupportedImageFormats() + "| all files (*.*)|*.*;||",
|
||||
SupportedImageFormats() + L"| all files (*.*)|*.*;||",
|
||||
NULL);
|
||||
|
||||
CString anInitDir (((OCC_App*) AfxGetApp())->GetInitDataDir());
|
||||
@ -332,8 +332,7 @@ void CViewer2dDoc::OnBUTTONTestImage()
|
||||
{
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor (IDC_WAIT));
|
||||
CString aFilePath = anOpenImageDlg.GetPathName();
|
||||
TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )aFilePath);
|
||||
TCollection_AsciiString aFileName (aFileNameW, '?');
|
||||
TCollection_AsciiString aFileName ((const wchar_t* )aFilePath);
|
||||
|
||||
//erase viewer
|
||||
if(myAISContext->HasOpenedContext())
|
||||
@ -355,7 +354,7 @@ void CViewer2dDoc::OnBUTTONMultipleImage()
|
||||
NULL,
|
||||
NULL,
|
||||
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
|
||||
SupportedImageFormats() + "| all files (*.*)|*.*;||",
|
||||
SupportedImageFormats() + L"| all files (*.*)|*.*;||",
|
||||
NULL);
|
||||
|
||||
CString anInitDir (((OCC_App*) AfxGetApp())->GetInitDataDir());
|
||||
@ -367,8 +366,7 @@ void CViewer2dDoc::OnBUTTONMultipleImage()
|
||||
{
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor (IDC_WAIT));
|
||||
CString aFilePath = anOpenImageDlg.GetPathName();
|
||||
TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )aFilePath);
|
||||
TCollection_AsciiString aFileName (aFileNameW, '?');
|
||||
TCollection_AsciiString aFileName ((const wchar_t* )aFilePath);
|
||||
|
||||
//erase viewer
|
||||
if(myAISContext->HasOpenedContext())
|
||||
|
@ -143,8 +143,7 @@ Handle(AIS_TexturedShape) TexturesExt_Presentation::Texturize(const TopoDS_Shape
|
||||
initfile += aTFileName.ToCString();
|
||||
}
|
||||
|
||||
TCollection_ExtendedString aFileName ((Standard_ExtString )(const wchar_t* )initfile);
|
||||
aTShape->SetTextureFileName (TCollection_AsciiString (aFileName, '?'));
|
||||
aTShape->SetTextureFileName (TCollection_AsciiString ((const wchar_t* )initfile));
|
||||
|
||||
// do other initialization of AIS_TexturedShape
|
||||
aTShape->SetTextureMapOn();
|
||||
|
@ -134,19 +134,19 @@ void CImportExportApp::OnFileOpen()
|
||||
// add to filter
|
||||
strFilter += strFilterName;
|
||||
ASSERT(!strFilter.IsEmpty()); // must have a file type name
|
||||
strFilter += (TCHAR)'\0'; // next string please
|
||||
strFilter += (TCHAR)'*';
|
||||
strFilter += L'\0'; // next string please
|
||||
strFilter += L'*';
|
||||
strFilter += strFilterExt;
|
||||
strFilter += (TCHAR)'\0'; // next string please
|
||||
strFilter += L'\0'; // next string please
|
||||
dlg.m_ofn.nMaxCustFilter++;
|
||||
}
|
||||
// append the "*.*" all files filter
|
||||
CString allFilter;
|
||||
VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));
|
||||
strFilter += allFilter;
|
||||
strFilter += (TCHAR)'\0'; // next string please
|
||||
strFilter += _T("*.*");
|
||||
strFilter += (TCHAR)'\0'; // last string
|
||||
strFilter += L'\0'; // next string please
|
||||
strFilter += L"*.*";
|
||||
strFilter += L'\0'; // last string
|
||||
dlg.m_ofn.nMaxCustFilter++;
|
||||
dlg.m_ofn.lpstrFilter = strFilter;
|
||||
|
||||
|
@ -213,7 +213,7 @@ void COcafDoc::OnCreatebox()
|
||||
|
||||
// Create a new box using the CNewBoxDlg Dialog parameters as attributes
|
||||
TDF_Label L = TSC.CreateBox (Dlg.m_x, Dlg.m_y, Dlg.m_z, Dlg.m_w, Dlg.m_l, Dlg.m_h,
|
||||
TCollection_ExtendedString ((Standard_ExtString )(const wchar_t* )Dlg.m_Name));
|
||||
TCollection_ExtendedString ((const wchar_t* )Dlg.m_Name));
|
||||
|
||||
// Get the TPrsStd_AISPresentation of the new box TNaming_NamedShape
|
||||
Handle(TPrsStd_AISPresentation) prs= TPrsStd_AISPresentation::Set(L, TNaming_NamedShape::GetID());
|
||||
@ -270,7 +270,7 @@ void COcafDoc::OnCreatecyl()
|
||||
|
||||
// Create a new box using the CNewCylDlg Dialog parameters as attributes
|
||||
TDF_Label L = TSC.CreateCyl (Dlg.m_x, Dlg.m_y, Dlg.m_z, Dlg.m_r, Dlg.m_h,
|
||||
TCollection_ExtendedString ((Standard_ExtString )(const wchar_t* )Dlg.m_Name));
|
||||
TCollection_ExtendedString ((const wchar_t* )Dlg.m_Name));
|
||||
|
||||
// Get the TPrsStd_AISPresentation of the new cylinder TNaming_NamedShape
|
||||
Handle(TPrsStd_AISPresentation) prs= TPrsStd_AISPresentation::Set(L, TNaming_NamedShape::GetID());
|
||||
@ -389,7 +389,7 @@ Handle(TFunction_Function) TFF; \n\
|
||||
// Modify the box
|
||||
TOcaf_Commands TSC(LabObject);
|
||||
TSC.ModifyBox (Dlg.m_x, Dlg.m_y, Dlg.m_z, Dlg.m_w, Dlg.m_l, Dlg.m_h,
|
||||
TCollection_ExtendedString ((Standard_ExtString )(const wchar_t* )Dlg.m_Name), log);
|
||||
TCollection_ExtendedString ((const wchar_t* )Dlg.m_Name), log);
|
||||
|
||||
// Get the presentation of the box, display it and set it selected
|
||||
Handle(TPrsStd_AISPresentation) prs= TPrsStd_AISPresentation::Set(LabObject, TNaming_NamedShape::GetID());
|
||||
@ -474,7 +474,7 @@ D->CommitCommand(); \n\
|
||||
// Modify the cylinder
|
||||
TOcaf_Commands TSC(LabObject);
|
||||
TSC.ModifyCyl (Dlg.m_x, Dlg.m_y, Dlg.m_z, Dlg.m_r, Dlg.m_h,
|
||||
TCollection_ExtendedString ((Standard_ExtString )(const wchar_t* )Dlg.m_Name), log);
|
||||
TCollection_ExtendedString ((const wchar_t* )Dlg.m_Name), log);
|
||||
|
||||
// Get the presentation of the cylinder, display it and set it selected
|
||||
Handle(TPrsStd_AISPresentation) prs= TPrsStd_AISPresentation::Set(LabObject, TNaming_NamedShape::GetID());
|
||||
@ -591,7 +591,7 @@ D->CommitCommand(); \n\
|
||||
// Modify the cylinder
|
||||
TOcaf_Commands ToolTSC(ToolLab);
|
||||
ToolTSC.ModifyCyl (Dlg.m_x, Dlg.m_y, Dlg.m_z, Dlg.m_r, Dlg.m_h,
|
||||
TCollection_ExtendedString ((Standard_ExtString )(const wchar_t* )Dlg.m_Name), log);
|
||||
TCollection_ExtendedString ((const wchar_t* )Dlg.m_Name), log);
|
||||
|
||||
// Redisplay the modified Tool object
|
||||
TDataStd_Integer::Set(ToolLab, 1);
|
||||
@ -899,7 +899,7 @@ void COcafDoc::OnCloseDocument()
|
||||
void COcafDoc::OnFileSaveAs()
|
||||
{
|
||||
const wchar_t* SPathName = PathName;
|
||||
TCollection_ExtendedString TPathName ((Standard_ExtString )SPathName);
|
||||
TCollection_ExtendedString TPathName (SPathName);
|
||||
|
||||
CString Filter;
|
||||
|
||||
@ -928,7 +928,7 @@ void COcafDoc::OnFileSaveAs()
|
||||
cout << "Save As " << CSPath << endl;
|
||||
PathName=CSPath;
|
||||
const wchar_t* SPath = CSPath;
|
||||
TCollection_ExtendedString TPath ((Standard_ExtString )SPath);
|
||||
TCollection_ExtendedString TPath (SPath);
|
||||
|
||||
if (TPath.SearchFromEnd(".xml") > 0)
|
||||
{
|
||||
@ -984,7 +984,7 @@ void COcafDoc::OnFileSave()
|
||||
if(PathName!="")
|
||||
{
|
||||
const wchar_t* SPath = PathName;
|
||||
TCollection_ExtendedString TPath ((Standard_ExtString )SPath);
|
||||
TCollection_ExtendedString TPath (SPath);
|
||||
|
||||
if (TPath.SearchFromEnd(".xml") > 0)
|
||||
{
|
||||
@ -1038,7 +1038,7 @@ m_App->SaveAs(myOcafDoc,(TCollection_ExtendedString) TPath); \n\
|
||||
CString CSPath = dlg.GetPathName();
|
||||
|
||||
const wchar_t* SPath = CSPath;
|
||||
TCollection_ExtendedString TPath ((Standard_ExtString )SPath);
|
||||
TCollection_ExtendedString TPath (SPath);
|
||||
|
||||
// Choose storage format
|
||||
if (TPath.SearchFromEnd(".xml") > 0)
|
||||
@ -1094,7 +1094,7 @@ BOOL COcafDoc::OnOpenDocument(LPCTSTR lpszPathName)
|
||||
PathName = lpszPathName;
|
||||
|
||||
const wchar_t* aPathName = lpszPathName;
|
||||
TCollection_ExtendedString anOccPathName ((Standard_ExtString)aPathName);
|
||||
TCollection_ExtendedString anOccPathName (aPathName);
|
||||
|
||||
// Open the document in the current application
|
||||
//PCDM_ReaderStatus RS = m_App->Open(TPath,myOcafDoc);
|
||||
|
@ -715,8 +715,7 @@ const TCollection_AsciiString CDimensionDlg::GetUnits() const
|
||||
return TCollection_AsciiString();
|
||||
CString aStr;
|
||||
GetDlgItem (IDC_DisplayUnits)->GetWindowText (aStr);
|
||||
TCollection_ExtendedString aCharsW ((Standard_ExtString )(const wchar_t* )aStr);
|
||||
return TCollection_AsciiString (aCharsW, '?');
|
||||
return TCollection_AsciiString ((const wchar_t* )aStr);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -273,8 +273,7 @@ dlg.m_ofn.lpstrInitialDir = initdir;
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )dlg.GetPathName());
|
||||
TCollection_AsciiString aFileName (aFileNameW, '?');
|
||||
TCollection_AsciiString aFileName ((const wchar_t* )dlg.GetPathName());
|
||||
Standard_Integer status = ReadIGES (aFileName.ToCString(), aSequence);
|
||||
if (status != IFSelect_RetDone)
|
||||
{
|
||||
@ -338,8 +337,7 @@ dlg.m_ofn.lpstrInitialDir = initdir;
|
||||
{
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
|
||||
TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )dlg.GetPathName());
|
||||
TCollection_AsciiString aFileName (aFileNameW, '?');
|
||||
TCollection_AsciiString aFileName ((const wchar_t* )dlg.GetPathName());
|
||||
|
||||
result = SaveIGES (aFileName.ToCString(), aHSequenceOfShape);
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
|
||||
@ -400,8 +398,7 @@ dlg.m_ofn.lpstrInitialDir = initdir;
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )dlg.GetPathName());
|
||||
TCollection_AsciiString aFileName (aFileNameW, '?');
|
||||
TCollection_AsciiString aFileName ((const wchar_t* )dlg.GetPathName());
|
||||
IFSelect_ReturnStatus ReturnStatus = ReadSTEP (aFileName.ToCString(), aSequence);
|
||||
switch (ReturnStatus)
|
||||
{
|
||||
@ -518,8 +515,7 @@ IFSelect_ReturnStatus CImportExport::SaveSTEP(const Handle(TopTools_HSequenceOfS
|
||||
|
||||
if (aDlg.DoModal() == IDOK) {
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )aDlg.GetPathName());
|
||||
TCollection_AsciiString aFileName (aFileNameW, '?');
|
||||
TCollection_AsciiString aFileName ((const wchar_t* )aDlg.GetPathName());
|
||||
|
||||
STEPControl_StepModelType selection = aDlg.m_Cc1ModelType;
|
||||
|
||||
@ -605,11 +601,10 @@ dlg.m_ofn.lpstrInitialDir = initdir;
|
||||
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )dlg.GetPathName());
|
||||
TCollection_AsciiString aFileName (aFileNameW, '?');
|
||||
TCollection_AsciiString aFileName ((const wchar_t* )dlg.GetPathName());
|
||||
TCollection_AsciiString Message;
|
||||
result = SaveSTL (aFileName.ToCString(), aHSequenceOfShape, Message);
|
||||
CString aMsg (Message.ToCString());
|
||||
CString aMsg (TCollection_ExtendedString (Message).ToWideString());
|
||||
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, aMsg, result ? L"CasCade" : L"CasCade Error", result ? MB_OK : MB_ICONERROR);
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
|
||||
}
|
||||
@ -696,11 +691,10 @@ dlg.m_ofn.lpstrInitialDir = initdir;
|
||||
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )dlg.GetPathName());
|
||||
TCollection_AsciiString aFileName (aFileNameW, '?');
|
||||
TCollection_AsciiString aFileName ((const wchar_t* )dlg.GetPathName());
|
||||
TCollection_AsciiString Message;
|
||||
result = SaveVRML (aFileName.ToCString(), aHSequenceOfShape, anArrayOfColors, anArrayOfTransparencies, Message);
|
||||
CString aMsg (Message.ToCString());
|
||||
CString aMsg (TCollection_ExtendedString(Message).ToWideString());
|
||||
MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, aMsg, result ? L"CasCade" : L"CasCade Error", result ? MB_OK : MB_ICONERROR);
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
|
||||
}
|
||||
|
@ -25,8 +25,7 @@ void OCC_BaseDoc::ExportView (const Handle(V3d_View)& theView) const
|
||||
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
|
||||
|
||||
CString aFileExt = anExportDlg.GetFileExt();
|
||||
TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )anExportDlg.GetPathName());
|
||||
TCollection_AsciiString aFileName (aFileNameW, '?');
|
||||
TCollection_AsciiString aFileName ((const wchar_t* )anExportDlg.GetPathName());
|
||||
|
||||
// For vector formats use V3d_View::Export() method
|
||||
if (!(aFileExt.CompareNoCase (L"ps")) || !(aFileExt.CompareNoCase (L"pdf"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user