Ejemplo n.º 1
0
void RemoveFileDialog(void)
{
	INT32 x;

	MSYS_RemoveRegion( &BlanketRegion );

	for(x=0; x<6; x++)
	{
		RemoveButton(iFileDlgButtons[x]);
	}

	if( iFileDlgButtons[6] != -1 )
	{
		RemoveButton( iFileDlgButtons[6] );
	}

	TrashFDlgList( FileList );

	FileList = NULL;

	InvalidateScreen( );

	EnableEditorTaskbar();
	KillTextInputMode();
	MarkWorldDirty();
	RenderWorld();
	EndFrameBufferRender();
}
Ejemplo n.º 2
0
void LoadSaveScreenEntry()
{
    fEnteringLoadSaveScreen = FALSE;
    gbCurrentFileIOStatus	= IOSTATUS_NONE;

    gfReadOnly = FALSE;
    gfFileExists = FALSE;
    gfLoadError = FALSE;
    gfIllegalName = FALSE;
    gfDeleteFile = FALSE;
    gfNoFiles = FALSE;

    // setup filename dialog box
    // (*.dat and *.map) as file filter

    // If user clicks on a filename in the window, then turn off string focus and re-init the string with the new name.
    // If user hits ENTER or presses OK, then continue with the file loading/saving

    if( FileList )
        TrashFDlgList( FileList );

    iTopFileShown = iTotalFiles = 0;
    if( GetFileFirst("MAPS\\*.dat", &FileInfo) )
    {
        FileList = AddToFDlgList( FileList, &FileInfo );
        iTotalFiles++;
        while( GetFileNext(&FileInfo) )
        {
            FileList = AddToFDlgList( FileList, &FileInfo );
            iTotalFiles++;
        }
        GetFileClose(&FileInfo);
    }

    swprintf( zOrigName, L"%s Map (*.dat)", iCurrentAction == ACTION_SAVE_MAP ? L"Save" : L"Load" );

    swprintf( gzFilename, L"%S", gubFilename );

    CreateFileDialog( zOrigName );

    if( !iTotalFiles )
    {
        gfNoFiles = TRUE;
        if( iCurrentAction == ACTION_LOAD_MAP )
            DisableButton( iFileDlgButtons[0] );
    }

    iLastFileClicked = -1;
    iLastClickTime = 0;

}
Ejemplo n.º 3
0
void LoadSaveScreenEntry()
{
	fEnteringLoadSaveScreen = FALSE;
	gbCurrentFileIOStatus	= IOSTATUS_NONE;

	gfReadOnly = FALSE;
	gfFileExists = FALSE;
	gfLoadError = FALSE;
	gfIllegalName = FALSE;
	gfDeleteFile = FALSE;
	gfNoFiles = FALSE;
	gfSaveError = FALSE;//dnl ch37 200909

	// setup filename dialog box
	// (*.dat and *.map) as file filter

	// If user clicks on a filename in the window, then turn off string focus and re-init the string with the new name.
	// If user hits ENTER or presses OK, then continue with the file loading/saving

	if(FileList)
	{
		TrashFDlgList(FileList);
		FileList = NULL;
	}

	iTopFileShown = iTotalFiles = 0;
#ifdef USE_VFS//dnl ch37 300909
	FDLG_LIST* TempFileList = NULL;
	vfs::CProfileStack* st = getVFS()->getProfileStack();
	vfs::CProfileStack::Iterator it = st->begin();
	while(!it.end())
	{
		TempFileList = NULL;
		vfs::CVirtualProfile* prof = it.value();
		memset(&FileInfo, 0, sizeof(GETFILESTRUCT));
		strcpy(FileInfo.zFileName, "< ");
		strcat(FileInfo.zFileName, prof->cName.utf8().c_str());
		strcat(FileInfo.zFileName, " >");
		FileInfo.zFileName[FILENAME_BUFLEN] = 0;
		FileInfo.uiFileAttribs = FILE_IS_DIRECTORY;
		if(iCurrentAction == ACTION_SAVE_MAP && prof->cWritable == false)
		{
			it.next();
			continue;
		}
		TempFileList = AddToFDlgList(TempFileList, &FileInfo);
		iTotalFiles++;
		vfs::CVirtualProfile::FileIterator fit = prof->files(L"MAPS/*");
		while(!fit.end())
		{
			vfs::String fname = fit.value()->getName().c_str();
			memset(&FileInfo, 0, sizeof(GETFILESTRUCT));
			strcpy(FileInfo.zFileName, fname.utf8().c_str());
			FileInfo.uiFileSize = fname.length();
			FileInfo.uiFileAttribs = (fit.value()->implementsWritable() ? FILE_IS_NORMAL : FILE_IS_READONLY);
			if(strlen(FileInfo.zFileName) < FILENAME_BUFLEN)
			{
				TempFileList = AddToFDlgList(TempFileList, &FileInfo);
				iTotalFiles++;
			}
			fit.next();
		}
		if(TempFileList)
		{
			while(TempFileList->pPrev)
				TempFileList = TempFileList->pPrev;
			if(FileList)
			{
				while(FileList->pNext)
					FileList = FileList->pNext;
				FileList->pNext = TempFileList;
				TempFileList->pPrev = FileList;
			}
			else
				FileList = TempFileList;
		}
		it.next();
	}
	while(FileList->pPrev)
		FileList = FileList->pPrev;
#else
	if(GetFileFirst("MAPS\\*.dat", &FileInfo))
	{
		if(strlen(FileInfo.zFileName) < FILENAME_BUFLEN)
		{
			FileList = AddToFDlgList(FileList, &FileInfo);
			iTotalFiles++;
		}
		while(GetFileNext(&FileInfo))
		{
			if(strlen(FileInfo.zFileName) < FILENAME_BUFLEN)
			{
				FileList = AddToFDlgList(FileList, &FileInfo);
				iTotalFiles++;
			}
		}
		GetFileClose(&FileInfo);
	}
#endif
	swprintf( zOrigName, L"%s Map (*.dat)", iCurrentAction == ACTION_SAVE_MAP ? L"Save" : L"Load" );

	swprintf( gzFilename, L"%S", gubFilename );

	CreateFileDialog( zOrigName );

	if( !iTotalFiles )
	{
		gfNoFiles = TRUE;
		if( iCurrentAction == ACTION_LOAD_MAP )
			DisableButton( iFileDlgButtons[0] );
	}

	iLastFileClicked = -1;
	iLastClickTime = 0;

}