当前位置: 首页>>代码示例>>C++>>正文


C++ CTFileName::RemoveApplicationPath_t方法代码示例

本文整理汇总了C++中CTFileName::RemoveApplicationPath_t方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFileName::RemoveApplicationPath_t方法的具体用法?C++ CTFileName::RemoveApplicationPath_t怎么用?C++ CTFileName::RemoveApplicationPath_t使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTFileName的用法示例。


在下文中一共展示了CTFileName::RemoveApplicationPath_t方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SaveAnimSetFile

// save anim set file
BOOL CSeriousSkaStudioApp::SaveAnimSetFile(CAnimSet &as, BOOL bConvert)
{
  DisableRendering();
  CTFileName fnAnimSet = as.GetName();
  fnAnimSet = fnAnimSet.NoExt() + ".aal";
  try {
    fnAnimSet.RemoveApplicationPath_t();
  } catch(char *){}

  // back up current skeleton list file
  CTString strBackUp;
  try {
    strBackUp.Load_t(fnAnimSet); 
  } catch(char*){}

  CTFileStream ostrFile;
  try {
    ostrFile.Create_t(fnAnimSet,CTStream::CM_TEXT);
    SaveAnimSet_t(as,ostrFile);
    ostrFile.Close();
  } catch(char *strError) {
    ErrorMessage(strError);
    EnableRendering();
    return FALSE;
  }

  if(bConvert) {
    ConvertAnimSet(fnAnimSet);
  }

  EnableRendering();
  return TRUE;
}
开发者ID:AdamFlores,项目名称:Serious-Engine,代码行数:34,代码来源:SeriousSkaStudio.cpp

示例2: SaveSmcFile

// Save smc file
void CSeriousSkaStudioApp::SaveSmcFile(CModelInstance &mi,BOOL bSaveChildren)
{
	CSeriousSkaStudioDoc *pDoc = GetDocument();

  // first get first model instance that has its file
  CModelInstance *pmiParent=NULL;
  CModelInstance *pmiFirst=&mi;
  CTFileName fnSmc = mi.mi_fnSourceFile;
  CModelInstance *pfmi = mi.GetFirstNonReferencedParent(GetDocument()->m_ModelInstance);
  if(pfmi!=NULL) {
    pmiParent = pfmi->GetParent(pDoc->m_ModelInstance);
    pmiFirst = pfmi;
    fnSmc = pfmi->mi_fnSourceFile;
  }

  DisableRendering();
  try
  {
    fnSmc.RemoveApplicationPath_t();
  }
  catch(char *){}

  CTFileStream ostrFile;
  // try to save model instance
  try {
    ostrFile.Create_t(fnSmc,CTStream::CM_TEXT);
    SaveModelInstance_t(pmiFirst,pmiParent,ostrFile,bSaveChildren);
    ostrFile.Close();
    NotificationMessage("Smc '%s' saved.",pmiFirst->mi_fnSourceFile); 
  } catch(char *strError) {
    ErrorMessage(strError);
  }
  EnableRendering();
}
开发者ID:AdamFlores,项目名称:Serious-Engine,代码行数:35,代码来源:SeriousSkaStudio.cpp

示例3: WriteFont_t

extern void WriteFont_t(CFontData &fdFont, const CImageInfo &iiFont, const CImageInfo &iiGrid, const CTFileName &fnFont)
{
  MEX inMex = Max(iiFont.ii_Height,iiFont.ii_Width);
  INDEX ctMipmaps = 0;// GetNoOfMipmaps(iiFont.ii_Width,iiFont.ii_Height);

  CTFileName fnName = fnFont.NoExt();
  try {
    fnName.RemoveApplicationPath_t();
  } catch(char *) {
  }
  // save font tga file
  iiFont.SaveTGA_t(fnName + ".tga");
  iiGrid.SaveTGA_t(fnName + "G.tga");
  // create tex file from saved targa
  CreateTexture_t( fnName+".tga",  fnName+".tex",  inMex, ctMipmaps, TEX_CONSTANT);
  CreateTexture_t( fnName+"G.tga", fnName+"G.tex", inMex, ctMipmaps);
  
  // set texture source to saved font
  fdFont.fd_ptdTextureData = _pTextureStock->Obtain_t(fnName+".tex");
  fdFont.fd_ptdTextureData->Reload();
  fdFont.fd_ptdTextureData->Force(TEX_CONSTANT); // don't mess with created textures
  fdFont.fd_fnTexture = fnName+".tex";

  _ptdGrid = _pTextureStock->Obtain_t(fnName + "G.tex");
  if(_ptdGrid!=NULL) {
    _ptdGrid->Reload();
    _ptdGrid->Force(TEX_CONSTANT); // don't mess with created textures
  }

  // finaly save fnt file
  CTFileStream ostr;
  ostr.Create_t(fnName + ".fnt");
  fdFont.Write_t(&ostr);
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:34,代码来源:FontGen.cpp

示例4: OnOpenDocument

BOOL CModelerDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	m_bDocLoadedOk = FALSE;
  CTFileName fnModelFile = CTString(lpszPathName);

  try
  {
    fnModelFile.RemoveApplicationPath_t();
  }
  catch( char *err_str)
  {
    AfxMessageBox( err_str);
    return FALSE;
  }

  try
  {
    m_emEditModel.Load_t( fnModelFile);
  }
  catch( char *err_str)
  {
    CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
    MessageBoxA(pMainFrame->m_hWnd, err_str, "Warning! Model load failed.", MB_OK|MB_ICONHAND|MB_SYSTEMMODAL);
    return FALSE;
  }

  INDEX ctLoadedModels=m_emEditModel.edm_aamAttachedModels.Count();
  INDEX ctAttachmentPositions=m_emEditModel.edm_md.md_aampAttachedPosition.Count();
  
  if(ctLoadedModels<ctAttachmentPositions)
  {
    for( INDEX iPos=ctLoadedModels; iPos<ctAttachmentPositions; iPos++)
    {
      m_emEditModel.edm_aamAttachedModels.New();
      m_emEditModel.edm_aamAttachedModels.Lock();
      CAttachedModel &am=m_emEditModel.edm_aamAttachedModels[iPos];
      DECLARE_CTFILENAME( fnAxis, "Data\\Models\\Editor\\Axis.mdl");
      am.am_bVisible=TRUE;
      am.am_strName="Not loaded";
      am.am_iAnimation=0;
      try
      {
        am.SetModel_t(fnAxis);
      }
      catch( char *strError)
      {
        WarningMessage( strError);
      }
      m_emEditModel.edm_aamAttachedModels.Unlock();
    }
  }

	m_bDocLoadedOk = TRUE;
  // flush stale caches
  _pShell->Execute("FreeUnusedStock();");
  SelectSurface( 0, TRUE);
  return TRUE;
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:58,代码来源:ModelerDoc.cpp

示例5: ParseSmcFile_t

// Parse smc file in existing model instance
void ParseSmcFile_t(CModelInstance &mi, const CTString &fnSmcFile)
{
  // Clear given model instance before parsing
  mi.Clear();

  CTFileName fnFileName = fnSmcFile;
  try {
    fnFileName.RemoveApplicationPath_t();
  } catch (char *) {
  }

  CTString strIncludeFile;
  strIncludeFile.Load_t(fnFileName);

  _yy_mi = &mi;
  SMCPushBuffer(fnFileName, strIncludeFile, TRUE);
  syyparse();
}
开发者ID:ArcticPheenix,项目名称:Serious-Engine,代码行数:19,代码来源:ModelInstance.cpp

示例6: SaveSkeletonListFile

// save skeleton list file 
BOOL CSeriousSkaStudioApp::SaveSkeletonListFile(CSkeleton &skl, BOOL bConvert)
{
  DisableRendering();
  CTFileName fnSkeletonList = skl.GetName();
  fnSkeletonList = fnSkeletonList.NoExt() + ".asl";
  try {
    fnSkeletonList.RemoveApplicationPath_t();
  }
  catch(char *){}

  // back up current skeleton list file
  CTString strBackUp;
  try {
    strBackUp.Load_t(fnSkeletonList);
  }
  catch(char*){}

  CTFileStream ostrFile;
  try {
    ostrFile.Create_t(fnSkeletonList,CTStream::CM_TEXT);
    SaveSkeletonList_t(skl,ostrFile);
    ostrFile.Close();
  } catch(char *strError) {
    ErrorMessage(strError);
    EnableRendering();
    return FALSE;
  }

  if(bConvert) {
    if(!ConvertSkeleton(fnSkeletonList)) {
      // convert failed
      if(strBackUp.Length()>0) {
        // try returning old mesh list file
        try {
          strBackUp.Save_t(fnSkeletonList);
        }
        catch(char*){}
      }
    }
  }
  EnableRendering();
  return TRUE;
}
开发者ID:AdamFlores,项目名称:Serious-Engine,代码行数:44,代码来源:SeriousSkaStudio.cpp

示例7: SaveMeshListFile

// save mesh list file
BOOL CSeriousSkaStudioApp::SaveMeshListFile(MeshInstance &mshi, BOOL bConvert)
{
  DisableRendering();
  // get mesh list filename
  CTFileName fnMeshList = mshi.mi_pMesh->GetName();
  fnMeshList = fnMeshList.NoExt() + ".aml";
  try {
    fnMeshList.RemoveApplicationPath_t();
  } catch(char *){}
  CTString strBackUp;
  try {
    // back up current mesh list file
    strBackUp.Load_t(fnMeshList);
  } catch(char*){}
  // save mesh instance in new mesh list file
  CTFileStream ostrFile;
  try {
    ostrFile.Create_t(fnMeshList,CTStream::CM_TEXT);
    SaveMeshInstance_t(mshi,ostrFile);
    ostrFile.Close();
  } catch(char *strError) {
    ErrorMessage(strError);
    EnableRendering();
    return FALSE;
  }

  // if new mesh list file needs to be converted
  if(bConvert) {
    if(!ConvertMesh(fnMeshList)) {
      // convert failed
      if(strBackUp.Length()>0) {
        // try returning old mesh list file
        try {
          strBackUp.Save_t(fnMeshList);
        } catch(char*){}
      }
    }
  }
  EnableRendering();
  return TRUE;
}
开发者ID:AdamFlores,项目名称:Serious-Engine,代码行数:42,代码来源:SeriousSkaStudio.cpp

示例8: SelectCharTable

static CTFileName SelectCharTable(void)
{
  try {
    char strFileName[MAX_PATH+1] = "";
    OPENFILENAME ofn;
    memset(&ofn,0,sizeof(ofn));
    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner = _hWnd;
    ofn.hInstance = _hInstance;
    ofn.lpstrFilter = " (*.tbl)\0*.tbl\0";
    ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY;
    ofn.lpstrFile  = strFileName;
    ofn.nMaxFile  = MAX_PATH;
    if(GetOpenFileName(&ofn)) {
      CTFileName fnFullFileName = (CTString)ofn.lpstrFile;
      fnFullFileName.RemoveApplicationPath_t();
      return fnFullFileName;
    } else {
      return CTString("");
    }
  } catch(char *) {
    return CTString("");
  }
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:24,代码来源:FontGen.cpp

示例9: OnSaveDocument

BOOL CModelerDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{
  CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
	//return CDocument::OnSaveDocument(lpszPathName);
  CTFileName fnModelFile = CTString(lpszPathName);
  try
  {
    fnModelFile.RemoveApplicationPath_t();
  }
  catch( char *err_str)
  {
    AfxMessageBox( err_str);
    return FALSE;
  }

#if BUILD_PUBLISHER
  WarningMessage(
    "Saving is disabled in this version!");
  return FALSE;
#else
  try
  {
  	m_emEditModel.Save_t( fnModelFile);
    m_emEditModel.SaveMapping_t( fnModelFile.NoExt()+".map", 0);
  }
  catch( char *err_str)
  {
    MessageBoxA(pMainFrame->m_hWnd, err_str, "Warning! Model Save failed.", MB_OK|MB_ICONHAND|MB_SYSTEMMODAL);
    return FALSE;
  }
  SetModifiedFlag( FALSE);

  CModelerView *pModelerView = CModelerView::GetActiveView();
  if( pModelerView != NULL)
  {
    pModelerView->SaveThumbnail();
  }

  // reload attachments of all loaded models 
  POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
  while (pos!=NULL)
  {
    CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
    if( pmdCurrent != this)
    {
      BOOL bUpdateAttachments = TRUE;
      
      // if document is modified
      if( pmdCurrent->IsModified())
      {
        CTString strMessage;
        CTFileName fnDoc = CTString(pmdCurrent->GetPathName());
        strMessage.PrintF("Do you want to save model \"%s\" before reloading its attachments?", fnDoc.FileName() );
        if( ::MessageBox( pMainFrame->m_hWnd, strMessage,
                        "Warning !", MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON1 | 
                        MB_TASKMODAL | MB_TOPMOST) != IDYES)
        {
          bUpdateAttachments = FALSE;
        }
        // save document
        else
        {
          pmdCurrent->OnSaveDocument(pmdCurrent->GetPathName());
        }
      }

      if( bUpdateAttachments)
      {
        POSITION pos = pmdCurrent->GetFirstViewPosition();
        while (pos != NULL)
        {
          CView* pView = GetNextView(pos);
          ((CModelerView *)pView)->m_ModelObject.AutoSetAttachments();
          
          //CModelData *pmd = (CModelData *) ((CModelerView *)pView)->m_ModelObject.GetData();
          //pmd->Reload();
        }
      }
    }
  }


  return TRUE;
#endif
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:85,代码来源:ModelerDoc.cpp

示例10: TestGame

void CChildFrame::TestGame( BOOL bFullScreen) 
{
  // turn off info window
  CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
  pMainFrame->HideInfoWindow();

  CWorldEditorView *pPerspectiveView = GetPerspectiveView();
  ASSERT( pPerspectiveView != NULL);
  SetActiveView( pPerspectiveView, FALSE);
	CWorldEditorDoc* pDoc = pPerspectiveView->GetDocument();

  CTFileName fnmWorldToPlay;
  CTFileName fnmTempWorld = CTString("Temp\\TestGame.wld");

  // if the world was never saved or if it is modified
  if( (!pDoc->m_bWasEverSaved && wed_bSaveTestGameFirstTime) || pDoc->IsModified())
  { // save world under temporary name
    ASSERT_VALID(pDoc);
    try {  
      pDoc->m_woWorld.Save_t(fnmTempWorld);
      fnmWorldToPlay = fnmTempWorld;
    } catch( char *strError) {
      AfxMessageBox( CString(strError));
      pPerspectiveView->EnableToolTips(TRUE);
      return;
    }
  // if the world is not modified (it is saved on disk)
  } else
  { // use the saved world
    fnmWorldToPlay = CTString(CStringA(pDoc->GetPathName()));
    try {
      fnmWorldToPlay.RemoveApplicationPath_t();
    } catch( char *strError) {
      AfxMessageBox( CString(strError));
      pPerspectiveView->EnableToolTips(TRUE);
      return;
    }
  }

  // set rendering preferences
  _wrpWorldRenderPrefs = pPerspectiveView->m_vpViewPrefs.m_wrpWorldRenderPrefs;
  _mrpModelRenderPrefs = pPerspectiveView->m_vpViewPrefs.m_mrpModelRenderPrefs;
  _wrpWorldRenderPrefs.SetShadowsType( pPerspectiveView->GetChildFrame()->m_stShadowType);
  _wrpWorldRenderPrefs.SetSelectedEntityModel( theApp.m_pEntityMarkerModelObject);
  _wrpWorldRenderPrefs.SetSelectedPortalModel( theApp.m_pPortalMarkerModelObject);
  _wrpWorldRenderPrefs.SetEmptyBrushModel( theApp.m_pEmptyBrushModelObject);
  _wrpWorldRenderPrefs.SetTextureLayerOn( theApp.m_bTexture1, 0);
  _wrpWorldRenderPrefs.SetTextureLayerOn( theApp.m_bTexture2, 1);
  _wrpWorldRenderPrefs.SetTextureLayerOn( theApp.m_bTexture3, 2);
  _wrpWorldRenderPrefs.DisableVisTweaks(FALSE);

  _wrpWorldRenderPrefs.SetSelectedEntityModel( theApp.m_pEntityMarkerModelObject);
  _wrpWorldRenderPrefs.SetSelectedPortalModel( theApp.m_pPortalMarkerModelObject);
  _wrpWorldRenderPrefs.SetEmptyBrushModel( theApp.m_pEmptyBrushModelObject);

  // prepare test game view/draw ports
  CViewPort *pvp = pPerspectiveView->m_pvpViewPort;
  CDrawPort *pdp = pPerspectiveView->m_pdpDrawPort;
  pdp->SetOverlappedRendering(FALSE); // we are not rendering scene over already rendered scene (used for CSG layer)

  // if full screen mode is required
  HWND hWndFullScreen=NULL;
  HINSTANCE hInstanceFullScreen;
  WNDCLASSEX wcFullScreen;
  char achWindowTitle[256]; // current window title
  if( bFullScreen) 
  {
    // get full screen display mode info
    const PIX pixSizeI = theApp.m_dmFullScreen.dm_pixSizeI;
    const PIX pixSizeJ = theApp.m_dmFullScreen.dm_pixSizeJ;
    const DisplayDepth dd = theApp.m_dmFullScreen.dm_ddDepth;
    const GfxAPIType gat  = theApp.m_gatFullScreen;
    // set OpenGL fullscreen (before window)
    if( gat==GAT_OGL) {
      const BOOL bRes = _pGfx->SetDisplayMode( gat, 0, pixSizeI, pixSizeJ, dd);
      if( !bRes) {
        WarningMessage( "Unable to setup full screen display.");
        return;
      }
    } // register the window class
    hInstanceFullScreen = AfxGetInstanceHandle();
    ASSERT( hInstanceFullScreen!=NULL);
    wcFullScreen.cbSize = sizeof(wcFullScreen);
    wcFullScreen.style = CS_HREDRAW | CS_VREDRAW;
    wcFullScreen.lpfnWndProc = ::DefWindowProc;
    wcFullScreen.cbClsExtra = 0;
    wcFullScreen.cbWndExtra = 0;
    wcFullScreen.hInstance = hInstanceFullScreen;
    wcFullScreen.hIcon = LoadIcon( hInstanceFullScreen, (LPCTSTR)IDR_MAINFRAME );
    wcFullScreen.hCursor = NULL;
    wcFullScreen.hbrBackground = NULL;
    wcFullScreen.lpszMenuName  = CString(APPLICATION_NAME);
    wcFullScreen.lpszClassName = CString(APPLICATION_NAME);
    wcFullScreen.hIconSm = NULL;
    RegisterClassEx(&wcFullScreen);

    // create a window, invisible initially
    hWndFullScreen = CreateWindowExA(
      WS_EX_TOPMOST,
      APPLICATION_NAME,
//.........这里部分代码省略.........
开发者ID:EgoIncarnate,项目名称:Serious-Engine,代码行数:101,代码来源:ChildFrm.cpp

示例11: OnScriptMakeModel

void CScriptView::OnScriptMakeModel() 
{
	// First we save script file
  CModelerDoc *pDoc = (CModelerDoc *) GetDocument();
  CTFileName fnScriptName = CTString(pDoc->GetPathName());

  CTFileName fnModelName = fnScriptName.FileDir() + fnScriptName.FileName() + ".mdl";
  try
  {
    fnScriptName.RemoveApplicationPath_t();
  }
  catch( char *err_str)
  {
    AfxMessageBox( err_str);
    return;
  }
  pDoc->OnSaveDocument( pDoc->GetPathName());

	// close mdl document with same name
  POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
  while (pos!=NULL)
  {
    CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
    if( CTFileName( CTString(pmdCurrent->GetPathName())) == fnModelName)
    {
      pmdCurrent->OnCloseDocument();
      break;
    }
  }

	// Now we will create one instance of new document of type CModelerDoc
  CDocument* pDocument = theApp.m_pdtModelDocTemplate->CreateNewDocument();
 	if (pDocument == NULL)
	{
		TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		return;
	}
	ASSERT_VALID(pDocument);
	
  BOOL bAutoDelete = pDocument->m_bAutoDelete;
	pDocument->m_bAutoDelete = FALSE;   // don't destroy if something goes wrong
	CFrameWnd* pFrame = theApp.m_pdtModelDocTemplate->CreateNewFrame(pDocument, NULL);
	pDocument->m_bAutoDelete = bAutoDelete;
	if (pFrame == NULL)
	{
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		delete pDocument;       // explicit delete on error
		return;
	}
	ASSERT_VALID(pFrame);

  pDocument->SetPathName( fnModelName, FALSE);
  pDocument->SetTitle( fnModelName.FileName() + fnModelName.FileExt());
  
  char strError[ 256];
  if( !((CModelerDoc *)pDocument)->CreateModelFromScriptFile( fnScriptName, strError))
  {
    pDocument->OnCloseDocument();
    AfxMessageBox( strError);
    return;
  }
	theApp.m_pdtModelDocTemplate->InitialUpdateFrame(pFrame, pDocument, TRUE);
  ((CModelerDoc *)pDocument)->m_emEditModel.edm_md.md_bPreparedForRendering = FALSE;
  pDocument->SetModifiedFlag();

  // add textures from .ini file
  CTFileName fnIniFileName = fnScriptName.NoExt() + ".ini";
  try
  {
    ((CModelerDoc *)pDocument)->m_emEditModel.CSerial::Load_t(fnIniFileName);
  }
  catch( char *strError)
  {
    // ignore errors
    (void) strError;
  }
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:78,代码来源:ScriptView.cpp


注:本文中的CTFileName::RemoveApplicationPath_t方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。