void CInv3DDoc::OnModelImportAppend() { CFileDialog fileDlg (TRUE, _T(""), _T("*.*"), OFN_HIDEREADONLY, _T("")); OPENFILENAME& ofn = fileDlg.GetOFN(); CString strDlg("Append model"); ofn.lpstrTitle = strDlg; if( fileDlg.DoModal() == IDOK ) { CString strFilePath = fileDlg.GetPathName(); ImportModel(strFilePath, TRUE); } }
void CDlgDefineModel::OnBnClickedBrowseModelName() { CFileDialog fileDlg (FALSE, _T(""), _T("*.*"), OFN_HIDEREADONLY, _T(""), this); OPENFILENAME& ofn = fileDlg.GetOFN(); CString strDlg("Specify model root name"); ofn.lpstrTitle = strDlg; if( fileDlg.DoModal() == IDOK ) { CString strExt = fileDlg.GetFileExt(); CString strName = fileDlg.GetFileName(); m_strFilePathModel = fileDlg.GetPathName(); if( !strExt.IsEmpty()) { m_strFilePathModel.Replace( _T(".")+strExt, _T("")); } if( !strName.IsEmpty()) { m_strFilePathTmp.Replace( _T("\\")+strName, _T("")); } m_pInvFcs->SetFileRoot( m_strFilePathModel ); m_pInvFcs->SetPathTmp( m_strFilePathModel ); SetDlgItemText(IDC_MODEL_NAME, m_strFilePathModel); SetDlgItemText(IDC_TEMP_DIR, m_strFilePathModel); } }
int CSyntaxDlg::Parameterize( CString & str, int nMinLength ) { BOOL bNone = TRUE; int nLen = str.GetLength(); if( ( nLen > 120 ) || ( nLen < nMinLength ) ) // too long, too short return IDNO; if( ! m_bTitles && ( str.FindOneOf( ".!?" ) < nLen - 1 ) ) // intermediate punctuation return IDNO; CString strWork( str ); while( strWork.Replace( " ", " " ) ); strWork.MakeLower(); CString strVanish( strWork ); if( m_bTitles ) strVanish += '.'; // add for parsing CStringArray saPlugs; BOOL bSub = TRUE; while( bSub ) { int nAt = strVanish.FindOneOf( " .!?,:" ); if( nAt == 0 ) strVanish.Delete( 0 ); if( nAt > 0 ) { CString strWord = strVanish.Left( nAt ); strVanish.Delete( 0, nAt + 1 ); strWord.Replace( "'s", "" ); // remove apostrophe 's' strWord.Replace( "\"", "" ); // remove quotation marks int nLen = strWord.GetLength(); if( nLen && ! m_COR.ContainsUS( strWord ) ) { bNone = FALSE; CString strRet; CPOSDlg dlg( FALSE, strRet, strWord, strWork, & saPlugs, this ); switch ( dlg.DoModal() ) { case IDNO: // abort this segment return IDNO; case IDCANCEL: // abort import completely return IDCANCEL; case IDIGNORE: // do not replace break; default: // replace CString strFinalReplace( "<# def=\"*\">" ); // build formula strFinalReplace.Replace( "*", strWord ); strFinalReplace.Replace( "#", strRet ); saPlugs.Add( strFinalReplace ); // keep for later CString strTempReplace( "<#>" ); // create temporary char cLetter = char( BYTE( 'A' ) + saPlugs.GetSize() - 1 ); strTempReplace.Replace( '#', cLetter ); int nFind = strWork.Find( strWord ); strWork.Delete( nFind, strWord.GetLength() ); strWork.Insert( nFind, strTempReplace ); } } } bSub = ( nAt >= 0 ); } CString strDlg( strWork ); strWork.Insert( 0, ' ' ); strWork.Replace( " an ", " <ia> " ); strWork.Replace( " a ", " <ia> " ); strWork.Replace( " i ", " I " ); strWork.Replace( " i'", " I'" ); while( strWork.Replace( " ", " " ) ); strWork.Delete( 0 ); BYTE nSize = saPlugs.GetSize(); for( BYTE i = 0; i < nSize; i++ ) { CString strTempReplace( "<#>" ); // create temporary char cLetter = char( BYTE( 'A' ) + i ); strTempReplace.Replace( '#', cLetter ); strWork.Replace( strTempReplace, saPlugs.GetAt( i ) ); } str = strWork; if( bNone ) { CPOSDlg dlg( TRUE, CString(), CString( "< keine ersetzbaren Wörter >" ), strDlg, NULL, this ); return dlg.DoModal(); } return IDYES; }