// Check filename and update preview
BOOL DFUFileDialog::Update()
{
	// Update the preview
	CString comment;
	CStringX xcomment;
	bool valid = false;
	if (GetPathName().IsEmpty()
		|| !DFUEngine::IsDFUFileValid(GetPathName(), xcomment))
	{
		comment.Format(m_bOpenFileDialog
		               ? IDS_FILE_SELECT_NONE_OPEN
					   : IDS_FILE_SELECT_NONE_SAVE);
	}
	else
	{
		comment = xcomment;

		valid = true;
		if (comment.IsEmpty())
		{
			comment.Format(IDS_FILE_SELECT_NO_COMMENT, (LPCTSTR) GetFileName());
		}
	}
	editPreview.SetWindowText(comment);
	editPreview.EnableScrollBarCtrl(SB_VERT, true);
	if (editPreview.GetScrollLimit(SB_VERT) == 0)
	{
		editPreview.EnableScrollBarCtrl(SB_VERT, false);
	}

	// Return whether the file is valid
	return valid;
}
Example #2
0
void CBonfireDoc::OnFileReload() 
{
	if (!GetPathName().IsEmpty())
	{
		SetModifiedFlag(FALSE);
		m_xTextBuffer.FreeAll();
		m_xTextBuffer.LoadFromFile(GetPathName(),
			CRLF_STYLE_AUTOMATIC,ExistsSourceView(GetPathName()));
		UpdateAllViews(NULL);
	}
}
Example #3
0
//************************************************************************
void CNutDropScene::CreateSprites()
//************************************************************************
{
	FNAME szFileName;
	POINT ptOrigin;

	ptOrigin.x = 0;
	ptOrigin.y = 0; 

	// Create the object sprites
	for (int i = 0 ; i < MAX_PIECES ; i++)
	{
		if (m_ObjectList[i].m_szImage[0] != '\0')
		{
			m_ObjectList[i].m_lpSprite = m_pAnimator->CreateSprite (&ptOrigin);
			if (m_ObjectList[i].m_lpSprite)
			{
				GetPathName (szFileName, m_ObjectList[i].m_szImage);
				// Set up the sprite parameters
				m_ObjectList[i].m_lpSprite->AddCells (szFileName, m_ObjectList[i].m_nTotalCells, NULL);
				m_ObjectList[i].m_lpSprite->SetCellsPerSec (10);
				m_ObjectList[i].m_lpSprite->SetSpeed (m_nObjectSpeed);
				m_ObjectList[i].m_lpSprite->SetCycleBack (TRUE);
				m_ObjectList[i].m_lpSprite->Jump (0, 0);
				m_ObjectList[i].m_lpSprite->SetNotifyProc (OnSpriteNotify, (DWORD)this);    
				m_ObjectList[i].m_lpSprite->Show (FALSE);
			}
		}
	}

	// Create the player sprite
	m_lpPlayerSprite = m_pAnimator->CreateSprite (&ptOrigin);
	if (m_lpPlayerSprite)
	{
		if (! m_nPlayerCells)
			m_nPlayerCells = 1;
		GetPathName (szFileName, m_szPlayerBmp); 
		m_lpPlayerSprite->AddCells (szFileName, m_nPlayerCells, NULL);
		m_lpPlayerSprite->ActivateCells(0, (m_nPlayerCells/2)-1, YES);
		m_lpPlayerSprite->ActivateCells(m_nPlayerCells/2, m_nPlayerCells, NO);
		m_lpPlayerSprite->SetCellsPerSec (0);
		m_lpPlayerSprite->SetSpeed (m_nPlayerSpeed);
		m_lpPlayerSprite->Jump (m_nScreenLeftEdge, m_nScreenBottom);
		m_lpPlayerSprite->SetNotifyProc (OnSpriteNotify, (DWORD)this);    
		m_lpPlayerSprite->Show (TRUE);
	}

	// Initially walking right
	m_WalkDir = WALKRIGHT;

	// Create the score sprites
	m_lpCaughtScore[0] = CreateScoreSprite (m_ptCaughtScore.x, m_ptCaughtScore.y, 10);
	m_lpCaughtScore[1] = CreateScoreSprite (m_ptCaughtScore.x + m_nScoreWidth, m_ptCaughtScore.y, 0);
}
Example #4
0
void CColorEyeIDoc::OnFileSave() 
{
    // TODO: Add your command handler code here
//    SetPathName()
    if (GetPathName().IsEmpty())            //若還沒有存過的檔
        OnFileSaveAs();                     //就另存新檔
    else
    {
        SetModifiedFlag(FALSE);
//        saveTxtFile(GetPathName());
         saveOmdFile(GetPathName());
    }
    SetModifiedFlag(FALSE);
}
Example #5
0
void USoundWave::GetChunkData(int32 ChunkIndex, uint8** OutChunkData)
{
	if (RunningPlatformData->TryLoadChunk(ChunkIndex, OutChunkData) == false)
	{
		// Unable to load chunks from the cache. Rebuild the sound and try again.
		UE_LOG(LogAudio, Warning, TEXT("GetChunkData failed for %s"), *GetPathName());
#if WITH_EDITORONLY_DATA
		ForceRebuildPlatformData();
		if (RunningPlatformData->TryLoadChunk(ChunkIndex, OutChunkData) == false)
		{
			UE_LOG(LogAudio, Error, TEXT("Failed to build sound %s."), *GetPathName());
		}
#endif // #if WITH_EDITORONLY_DATA
	}
}
Example #6
0
BOOL CBonfireDoc::ExistsSourceView(LPCTSTR lpszPathName)
{
	CStringList pTabList;
	CString ext = (lpszPathName == NULL) 
				? GetFileExtension(GetPathName()) 
				: GetFileExtension(lpszPathName);
	
	// generate tabs based on the file extension
	CString strViews	= theApp.m_opOptions.views.vAssociations[0].strViews; // init to default views
	CString strExtList	= "";
	size_t nExt			= theApp.m_opOptions.views.vAssociations.size();
	
	// see if the current file's extension is in the list
	while (nExt-- > 0) // 0 is the default file extension
	{
		strExtList = (CString)theApp.m_opOptions.views.vAssociations[nExt].strExtensions;
		strExtList.Remove(' ');

		if (IsStringPresent(strExtList, ext))
		{
			strViews = theApp.m_opOptions.views.vAssociations[nExt].strViews;
			break;
		}
	}

	return (strViews[0] != '-' || strViews[0] == 's');
}
Example #7
0
bool CTwiBootProgDoc::SaveFileAs()
{
    CFileDialog dlg(FALSE, NULL, NULL, OFN_HIDEREADONLY, m_strFileTypeFilter, NULL);
    CString FilePath = GetPathName();
    CString FileName = GetTitle();
    if (FilePath.IsEmpty())
        FilePath = FileName;
    dlg.m_ofn.lpstrTitle = FileName;
    dlg.m_ofn.lpstrFile = FilePath.GetBuffer(_MAX_PATH);
    INT_PTR res = dlg.DoModal();
    FilePath.ReleaseBuffer();
    if (res == IDCANCEL)
        return false;
    CString FileExt = dlg.GetFileExt();

    switch(dlg.m_ofn.nFilterIndex)
    {
    case 1:
        m_FileType = ftBinary;
        if (FileExt.IsEmpty())
            FilePath += ".bin";
        break;
    case 2:
        m_FileType = ftIntelHex;
        if (FileExt.IsEmpty())
            FilePath += ".hex";
        break;
    default:
        ASSERT(FALSE);
        return false;
    }
    SetPathName(FilePath);
    SetTitle(FilePath);
    return SaveFile();
}
Example #8
0
void UEdGraphNode::PostLoad()
{
	Super::PostLoad();

	// Create Guid if not present (and not CDO)
	if(!NodeGuid.IsValid() && !IsTemplate() && GetLinker() && GetLinker()->IsPersistent() && GetLinker()->IsLoading())
	{
		UE_LOG(LogBlueprint, Warning, TEXT("Node '%s' missing NodeGuid."), *GetPathName());

		// Generate new one
		CreateNewGuid();
	}

	// Duplicating a Blueprint needs to have a new Node Guid generated, which was not occuring before this version
	if(GetLinkerUE4Version() < VER_UE4_POST_DUPLICATE_NODE_GUID)
	{
		// Generate new one
		CreateNewGuid();
	}
	// Moving to the new style comments requires conversion to preserve previous state
	if(GetLinkerUE4Version() < VER_UE4_GRAPH_INTERACTIVE_COMMENTBUBBLES)
	{
		bCommentBubbleVisible = !NodeComment.IsEmpty();
	}
}
Example #9
0
void CKaiDoc::OnFileSave()
{
    // TODO: Add your command handler code here
    if (pco_Doc_->b_IsImported())
    {
        OnFileSaveAs();
        return;
    }

    CString cstr_path = GetPathName();
    if (!cstr_path.IsEmpty())
    {
        CString cstr_ext = PathFindExtension (cstr_path);
        SetPathName (CString (cstr_path.Left (cstr_path.GetLength() - 
                                              cstr_ext.GetLength())) + 
                              _T(".kai"));
    }
    else
    {
        SetTitle (pco_Doc_->str_Title_.data());
    }

    CDocument::OnFileSave();

    if (IsModified())
    {
        SetTitle (CString (pco_Doc_->str_Title_.data()) + _T("*"));
    }

}
void CWaveOpen::OnBtnPlay() {
	sndPlaySound( NULL, NULL );
	CString str = GetPathName();
	if( str.GetLength() > 0 ) {
		sndPlaySound( str, SND_FILENAME | SND_ASYNC );
	}
}
Example #11
0
CString CGenethonDoc::ConvertPathname( const char *nExt )
{
    char *pName;
    CString PathName = GetPathName();

    int NameLen = PathName.GetLength();

    pName = PathName.GetBuffer(NameLen);

    int tLen = NameLen - 1;
    int i;
    for ( i = 0; i < 4; ++i ) {
        if ( pName[tLen] == '.' ) {
            break;
        }
        tLen--;
    }

    if ( pName[tLen] == '.' ) {
        i = 0;
        while ( (tLen < NameLen) && (i < 4) ) {
            pName[tLen] = nExt[i];
            i++;
            tLen++;
        }
        PathName.ReleaseBuffer();
    } else {
        PathName.ReleaseBuffer();
        PathName += nExt;
    }

    return PathName;
}
Example #12
0
//************************************************************************
void CNutDropScene::OnLButtonDown (HWND hWnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
//************************************************************************
{
	if (m_SoundPlaying == IntroPlaying)
	{
		m_SoundPlaying = NotPlaying;
	 	m_pSound->StopChannel (NORMAL_CHANNEL);
		StartGame();
	}	
	else
	if (m_SoundPlaying == SuccessPlaying)
	{
		m_SoundPlaying = NotPlaying;
	 	GetSound()->StopChannel(NORMAL_CHANNEL);
		// Start the looping soundtrack if one is defined
		FNAME szFileName;
		if (GetSound() && m_szSoundTrack[0] != '\0')
			GetSound()->StartFile (GetPathName (szFileName, m_szSoundTrack), YES/*bLoop*/,
							MUSIC_CHANNEL, FALSE);
		// If Play mode, go to the next scene
		if (m_nSceneNo == IDD_NUTDROPI)
			FORWARD_WM_COMMAND (m_hWnd, IDC_NEXT, NULL, m_nNextSceneNo, PostMessage);
		else
			StartGame();
	}	
}
Example #13
0
void CStorageDoc::Close (bool blAsk/* = true*/, bool blSave/* = true*/) {
	if (blSave)
		OnSaveDocument (GetPathName ());
	if (!blAsk)
		SetModifiedFlag (false);
	OnCloseDocument ();
}
//Implementation of CreateDirectory.
BOOL APIENTRY AddDirToVhd(HANDLE hVhdObj,LPCSTR pDirName)    //Create directory.
{
	DWORD                    dwDirCluster                  = 0;
	CHAR                     DirName[MAX_FILE_NAME_LEN]    = {0};
	CHAR                     SubDirName[MAX_FILE_NAME_LEN] = {0};
	__FAT32_SHORTENTRY       DirShortEntry                 = {0};
	__FAT32_FS*              pFat32Fs                      = (__FAT32_FS*)hVhdObj;
	

	if((NULL == pFat32Fs) || (NULL == pDirName))
	{
		return FALSE;
	}

	if(!GetPathName((LPSTR)pDirName,DirName,SubDirName))
	{
		return FALSE;
	}

	//Try to open the parent directory.
	if(!GetDirEntry(pFat32Fs,DirName,&DirShortEntry,NULL,NULL))
	{	
		return FALSE;
	}

	if(!(DirShortEntry.FileAttributes & FILE_ATTR_DIRECTORY))  //Is not a directory.
	{
		return FALSE;
	}

	dwDirCluster = MAKELONG(DirShortEntry.wFirstClusLow,DirShortEntry.wFirstClusHi);

	return CreateFatDir(pFat32Fs,dwDirCluster,SubDirName,0);
}
Example #15
0
PathName
DviDoc::GetDocDir ()
{
  PathName result = GetPathName();
  result.RemoveFileSpec ();
  return (result);
}
bool UPagedVolumeComponent::SetPagedVolume(UVoreealPagedVolume* NewVolume)
{
	if (NewVolume == Volume && NewVolume == nullptr)
		return false;

	AActor* Owner = GetOwner();
	if (!AreDynamicDataChangesAllowed() && Owner != NULL)
	{
		FMessageLog("PIE").Warning(FText::Format(
			FText::FromString(TEXT("Calling SetPagedVolume on '{0}' but Mobility is Static.")),
			FText::FromString(GetPathName())));
		return false;
	}

	Volume = NewVolume;

	// If there were a volume before we call then we force gc
	UWorld* World = GetWorld();
	if (World)
	{
		World->ForceGarbageCollection(true);
	}

	return true;
}
BOOL CSkinButtonResource::LoadSkin(const TCHAR *skinfile, const CString& strControlType)
{
    static const TCHAR * ps = _T("Buttons");
    TCHAR buf[1000];
    CString path = GetPathName( skinfile );
	
	//wyw
	if (m_bInited)
	{
		m_bmpButton.DeleteObject();
	}

//    GetPrivateProfileString( ps, "Bitmap", "", buf, 1000, skinfile );
    GetPrivateProfileString( ps, strControlType, _T(""), buf, 1000, skinfile );
    if ( *buf == 0 || !m_bmpButton.LoadBitmap( path + _T("/")+ GetFileName( buf,1 )) )
        return FALSE;

    m_TopHeight = GetPrivateProfileInt( ps, _T("TopHeight"), 0, skinfile );
    m_BottomHeight = GetPrivateProfileInt( ps, _T("BottomHeight"), 0, skinfile );
    m_LeftWidth = GetPrivateProfileInt( ps, _T("LeftWidth"), 0, skinfile );
    m_RightWidth = GetPrivateProfileInt( ps, _T("RightWidth"), 0, skinfile );

    m_bTrans = GetPrivateProfileInt( ps, _T("Trans"), 0, skinfile );
    

    m_bInited = TRUE;
    return TRUE;
}
Example #18
0
void CWedDoc::Serialize(CArchive& ar)

{
    CString	 docname  = GetPathName();
    // Call overridden version
	Serialize(ar, docname);
}
bool UBasicVolumeComponent::SetBasicVolume(UBasicVolume* NewVolume)
{
	if (NewVolume == GetVolume() && NewVolume == nullptr)
		return false;

	AActor* Owner = GetOwner();
	if (!AreDynamicDataChangesAllowed() && Owner != NULL)
	{
		FMessageLog("PIE").Warning(FText::Format(
			FText::FromString(TEXT("Calling SetBasicVolume on '{0}' but Mobility is Static.")),
			FText::FromString(GetPathName())));
		return false;
	}

	if (m_octree.IsValid())
	{
		m_octree.Reset();
	}

	PRAGMA_DISABLE_DEPRECATION_WARNINGS
	Volume = NewVolume;
	PRAGMA_ENABLE_DEPRECATION_WARNINGS

	// If there were a volume before we call then we force gc
	UWorld* World = GetWorld();
	if (World)
	{
		World->ForceGarbageCollection(true);
	}

	EnsureRendering();

	return true;
}
Example #20
0
//------------------------------------------------------------------KBDelete
void CScriptDoc::SetModifiedFlag()
{ CString Path;
  Path = GetPathName( );
  if (Path.IsEmpty()==FALSE) 
    OnSaveDocument(Path); 
  else CDocument::SetModifiedFlag();
}
Example #21
0
void COpenFileDlg::OnDestroy()
{
    int i = GetPathName().Find(__DUMMY__);
    if(i >= 0) m_pOFN->lpstrFile[i] = m_pOFN->lpstrFile[i+1] = 0;

    CFileDialog::OnDestroy();
}
Example #22
0
//************************************************************************
void CNutDropScene::PlayLevelSuccessWave()
//************************************************************************
{
	// Get the sound to play based on the level
	int iCount = 0;
	for (int i = 0 ; i < MAX_SUCCESSWAVES ; i++)
	{
		if (m_szSuccessLevel[i][0] != '\0')
			iCount++;
	}

	LPSTR lpWave;
	if (iCount <= 0)
	{
		lpWave = m_szSuccessLevel[0];
	}
	else
	{
		i = GetRandomNumber (iCount);
		lpWave = m_szSuccessLevel[i];
	}

	if (*lpWave != '\0')
	{
		FNAME szFileName;
		if (GetSound() )
		{
			m_SoundPlaying = SuccessPlaying;
			GetSound()->StopChannel(NORMAL_CHANNEL);
			if (m_nSceneNo == IDD_NUTDROPI)
			{ // Play this wave without wavemix
				LPSOUND lpSound = new CSound;
				if ( lpSound )
				{
					GetSound()->Activate (FALSE);
					lpSound->StartFile( GetPathName(szFileName, lpWave),
						NO/*bLoop*/, NORMAL_CHANNEL/*iChannel*/, TRUE/*bWait*/, m_hWnd);
					delete lpSound;
					GetSound()->Activate (TRUE);
					FORWARD_WM_COMMAND (m_hWnd, IDC_NEXT, NULL, m_nNextSceneNo, PostMessage);
				}
			}
			else
				GetSound()->StartFile(GetPathName (szFileName, lpWave), NO/*bLoop*/, NORMAL_CHANNEL/*iChannel*/, FALSE/*bWait*/, m_hWnd);
		}
	}
}
Example #23
0
//************************************************************************
void CNutDropScene::CheckObjectCollision (LPSPRITE lpSprite)
//************************************************************************
{
	if (!m_lpPlayerSprite || !m_pAnimator)
		return;

	// See if they've picked enough already
	if (m_nGoodPicks >= m_nMatchesNeeded)
		return;

	static BOOL fBusy = FALSE;
	if (fBusy)
		return;
	fBusy = TRUE;

	RECT rBasket, rBasketX;
	rBasket = (m_WalkDir == WALKLEFT ? m_rLeftBasket : m_rRightBasket );
	m_lpPlayerSprite->Location (&rBasketX);
	OffsetRect( &rBasket, rBasketX.left, rBasketX.top );
	IntersectRect( &rBasket, &rBasket, &rBasketX );

	if (m_pAnimator->CheckCollision (m_lpPlayerSprite, lpSprite, &rBasket))
	{
		int idx = GetObjectIndex (lpSprite);
		if (idx == -1 || m_ObjectList[idx].m_nState == StateGoodPick)
		{
			fBusy = FALSE;
			return;
		}

		m_ObjectList[idx].m_nState = StateGoodPick;
		m_nGoodPicks++;

		// Play the got one sound if one is defined
		FNAME szFileName;
		GetPathName (szFileName, m_szGotOneWave);
		if (m_nGoodPicks < m_nMatchesNeeded)
		{
			if (GetSound() && m_szGotOneWave[0] != '\0')
			{
				GetSound()->StopChannel (NORMAL_CHANNEL);
				GetSound()->StartFile (szFileName, NO/*bLoop*/, NORMAL_CHANNEL/*iChannel*/, FALSE);
			}
		}
		else
			PlaySound(szFileName, FALSE); // how to play with wait AND wavemix

		// Hide this object
		lpSprite->Show (FALSE);

		// Update the caught score
		UpdateSpriteScore (m_lpCaughtScore[0], m_lpCaughtScore[1], m_nGoodPicks);
		
		// See if they've picked enough to win this level
		if (m_nGoodPicks >= m_nMatchesNeeded)
			PlayLevelSuccessWave();
	}
	fBusy = FALSE;
}
FString UUserDefinedEnum::GenerateFullEnumName(const TCHAR* InEnumName) const
{
	check(CppForm == ECppForm::Namespaced);

	FString PathName;
	GetPathName(NULL, PathName);
	return UEnum::GenerateFullEnumName(this, InEnumName);
}
Example #25
0
void CInputDoc::SetModifiedFlag(BOOL bModified)
{
	if(bModified==IsModified())
		return; // no change

	CDocument::SetModifiedFlag(bModified);
	SetTitle(getFullFileName(GetPathName()));
}
Example #26
0
// Called by an ingredient wanting external content.
void MHEngine::RequestExternalContent(MHIngredient *pRequester)
{
    // It seems that some MHEG applications contain active ingredients with empty contents
    // This isn't correct but we simply ignore that.
    if (! pRequester->m_ContentRef.IsSet())
    {
        return;
    }

    // Remove any existing content requests for this ingredient.
    CancelExternalContentRequest(pRequester);

    QString csPath = GetPathName(pRequester->m_ContentRef.m_ContentRef);

    if (csPath.isEmpty())
    {
        MHLOG(MHLogWarning, "RequestExternalContent empty path");
        return;
    }
    
    if (m_Context->CheckCarouselObject(csPath))
    {
        // Available now - pass it to the ingredient.
        QByteArray text;
        if (m_Context->GetCarouselData(csPath, text))
        {
            // If the content is not recognized catch the exception and continue
            try
            {
                pRequester->ContentArrived(
                    reinterpret_cast< const unsigned char * >(text.constData()),
                    text.size(), this);
            }
            catch (char const *)
            {}
        }
        else
        {
            MHLOG(MHLogWarning, QString("WARN No file content %1 <= %2")
                .arg(pRequester->m_ObjectReference.Printable()).arg(csPath));
            if (kProtoHTTP == PathProtocol(csPath))
                EngineEvent(203); // 203=RemoteNetworkError if 404 reply
            EngineEvent(3); // ContentRefError
        }
    }
    else
    {
        // Need to record this and check later.
        MHLOG(MHLogNotifications, QString("Waiting for %1 <= %2")
            .arg(pRequester->m_ObjectReference.Printable()).arg(csPath.left(128)) );
        MHExternContent *pContent = new MHExternContent;
        pContent->m_FileName = csPath;
        pContent->m_pRequester = pRequester;
        pContent->m_time.start();
        m_ExternContentTable.append(pContent);
    }
}
void UActorComponent::SendRenderDynamicData_Concurrent()
{
	check(bRenderStateCreated);
	bRenderDynamicDataDirty = false;

#if LOG_RENDER_STATE
	UE_LOG(LogActorComponent, Log, TEXT("SendRenderDynamicData_Concurrent: %s"), *GetPathName());
#endif
}
Example #28
0
//////////////////
// Used for custom filtering. You must override to specify filter flags.
//
HRESULT CFolderDialog::OnGetEnumFlags(
	IShellFolder* psf,			// this folder's IShellFolder
	LPCITEMIDLIST pidlFolder,	// folder's PIDL
	DWORD *pgrfFlags)				// [out] return flags you want to allow
{
	BFTRACE(_T("CFolderDialog::OnGetEnumFlags(%p): %s\n"),
		psf, GetPathName(pidlFolder));
	return S_OK;
}
Example #29
0
bool CWorldEditDoc::ReOpen()
{
	m_bLastPicked=false;

	SAFE_DELETE(m_pBspObject);

	m_pBspObject=new RBspObject;
	return m_pBspObject->Open(GetPathName(), "xml",RBspObject::ROF_EDITOR);
}
void UActorComponent::DestroyRenderState_Concurrent()
{
	check(bRenderStateCreated);
	bRenderStateCreated = false;

#if LOG_RENDER_STATE
	UE_LOG(LogActorComponent, Log, TEXT("DestroyRenderState_Concurrent: %s"), *GetPathName());
#endif
}