Example #1
0
void wxMaskController::EmptyData(bool bOnlyInput/*=FALSE*/)
{
	if(m_listData.GetCount()==0)
	{
		DeleteContents();
		return;
	}

	if(bOnlyInput)
	{
		// If emptying only the data, the iterate through the list 
		// of data and replace input data with the prompt symbol. 
		wxFieldMaskData* pobjData = NULL;
		for(unsigned long pos = 0;pos < m_listData.GetCount();pos++)
		{
			pobjData = (wxFieldMaskData *) (m_listData.Item(pos))->GetData();
			if(pobjData->IsInputData())
				pobjData->m_chValue=m_chPromptSymbol;
		}
	}
	else
		DeleteContents();
	
	Update();
}
Example #2
0
void COXMaskedEdit::EmptyData(BOOL bOnlyInput/*=FALSE*/)
{
	if(m_listData.GetCount()==0)
	{
		DeleteContents();
		return;
	}

	if(bOnlyInput)
	{
		// If emptying only the data, the iterate through the list 
		// of data and replace input data with the prompt symbol. 
		CMaskData* pobjData=NULL;
		for(POSITION pos=m_listData.GetHeadPosition(); pos;)
		{
			pobjData=m_listData.GetNext(pos);
			if(pobjData->IsInputData())
				pobjData->m_chValue=m_chPromptSymbol;
		}
	}
	else
		DeleteContents();
	
	Update();
}
Example #3
0
void CKnownFileList::Clear()
{
	wxMutexLocker sLock(list_mut);

	DeleteContents(m_knownFileMap);
	DeleteContents(m_duplicateFileList);
	ReleaseIndex();
}
//----------------------------------------------------------------------------
BOOL CDockingPaletteDoc::OnOpenDocument(LPCTSTR lpszPathName,LPCTSTR lpszPaneName){
//----------------------------------------------------------------------------
	PROC_TRACE;


   if (IsModified())
		TRACE("Warning: OnOpenDocument replaces an unsaved document.\n");

	CFileException fe;
	CFile* pFile = GetFile(lpszPathName,
		CFile::modeRead|CFile::shareDenyWrite, &fe);
	if (pFile == NULL)
	{
		ReportSaveLoadException(lpszPathName, &fe,
			FALSE, AFX_IDP_FAILED_TO_OPEN_DOC);
		return FALSE;
	}

	DeleteContents();
	SetModifiedFlag();  

	CArchive loadArchive(pFile, CArchive::load | CArchive::bNoFlushOnDelete);
	loadArchive.m_pDocument = this;
	loadArchive.m_bForceFlat = FALSE;
	TRY
	{
		CWaitCursor wait;
		if (pFile->GetLength() != 0)
			Serialize(loadArchive);     // load me
		loadArchive.Close();
		ReleaseFile(pFile, FALSE);
	}
	CATCH_ALL(e)
	{
		ReleaseFile(pFile, TRUE);
		DeleteContents();   // remove failed contents

		TRY
		{
			ReportSaveLoadException(lpszPathName, e,
				FALSE, AFX_IDP_FAILED_TO_OPEN_DOC);
		}
		END_TRY
		return FALSE;
	}
	END_CATCH_ALL

	SetModifiedFlag(FALSE);     // start off with unmodified
	m_documentName = lpszPaneName;
	return TRUE;
}
Example #5
0
// Property Data-> Object Data Change
BOOL CGXGridCellData::SetMultiCaptionBlobDataChange ( CString  strPropertyData )
{
	DeleteContents();
	if ( strPropertyData.IsEmpty() )
	{
		return FALSE;
	}

	BYTE*	pvData = NULL;
	pvData = StringToBinaryEx( strPropertyData );
	ASSERT( pvData != NULL );
    if( pvData != NULL )
	{
		DWORD	dwDataLen;
		dwDataLen = *(long*)pvData;
		
		CMemFile memFile;
		memFile.Attach ( (BYTE*)pvData+sizeof(DWORD), dwDataLen - sizeof(DWORD) );
		
		CArchive arMem(&memFile, CArchive::load );
		Serialize ( arMem );

		free ( pvData );
		return TRUE;
	}
	return FALSE;
}
Example #6
0
BOOL CDibDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
	CFile file;
	CFileException fe;
	if (!file.Open(lpszPathName, CFile::modeRead | CFile::shareDenyWrite, &fe))
	{
		ReportSaveLoadException(lpszPathName, &fe,
			FALSE, AFX_IDP_FAILED_TO_OPEN_DOC);
		return FALSE;
	}

	DeleteContents();
	BeginWaitCursor();

	// replace calls to Serialize with ReadDIBFile function
	TRY
	{
		m_hDIB = ::ReadDIBFile(file);
	}
	CATCH (CFileException, eLoad)
	{
		file.Abort(); // will not throw an exception
		EndWaitCursor();
		ReportSaveLoadException(lpszPathName, eLoad,
			FALSE, AFX_IDP_FAILED_TO_OPEN_DOC);
		m_hDIB = NULL;
		return FALSE;
	}
Example #7
0
void CEMSocket::ClearQueues()
{
	wxMutexLocker lock(m_sendLocker);

	DeleteContents(m_control_queue);

	{
		CStdPacketQueue::iterator it = m_standard_queue.begin();
		for (; it != m_standard_queue.end(); ++it) {
			delete it->packet;
		}
		m_standard_queue.clear();
	}
	
	// Download (pseudo) rate control	
	downloadLimit = 0;
	downloadLimitEnable = false;
	pendingOnReceive = false;

	// Download partial header
	pendingHeaderSize = 0;

	// Download partial packet
	delete[] pendingPacket;
	pendingPacket = NULL;
	pendingPacketSize = 0;

	// Upload control
	delete[] sendbuffer;
	sendbuffer = NULL;
	sendblen = 0;
	sent = 0;
}
Example #8
0
// Variable argument list, terminated by a zero
// Makes new storage for the strings
wxStringList::wxStringList (const wxChar *first, ...)
{
  DeleteContents(true);
  if ( !first )
    return;

  va_list ap;
  va_start(ap, first);

  const wxChar *s = first;
  for (;;)
  {
      Add(s);

      s = va_arg(ap, const wxChar *);
      //    if (s == NULL)
#ifdef __WXMSW__
      if ((int)(long) s == 0)
#else
      if ((long) s == 0)
#endif
          break;
  }

  va_end(ap);
}
Example #9
0
// Variable argument list, terminated by a zero
// Makes new storage for the strings
wxStringList::wxStringList (const wxChar *first, ...)
{
  DeleteContents(true);
  if ( !first )
    return;

  va_list ap;
  va_start(ap, first);

  const wxChar *s = first;
  for (;;)
  {
      Add(s);

      // icc gives this warning in its own va_arg() macro, argh
#ifdef __INTELC__
    #pragma warning(push)
    #pragma warning(disable: 1684)
#endif

      s = va_arg(ap, const wxChar *);

#ifdef __INTELC__
    #pragma warning(pop)
#endif

      if ( !s )
          break;
  }

  va_end(ap);
}
Example #10
0
/// Adds x children. Subclassed in e.g. Matrix-class in order to setup contents properly.
bool UIMatrix::SetContents(List<UIElement*> children)
{
	DeleteContents();	
	matrixElements = children;	
	FormatContents();
	return true;
}
Example #11
0
VError VFolder::Delete( bool inRemoveContent ) const
{
	VError err;
	bool needThrow;
	if (IsEmpty())
	{
		err = fFolder.Delete();
		needThrow = IS_NATIVE_VERROR( err);
	}
	else
	{
		if ( inRemoveContent )
		{
			err = DeleteContents( true );
			if ( err == VE_OK )
				err = fFolder.Delete();
			needThrow = IS_NATIVE_VERROR( err);
		}
		else
		{
			err = VE_FOLDER_NOT_EMPTY;
			needThrow = true;
		}
	}

	xbox_assert( (err != VE_OK) || !fFolder.Exists( true));

	if (needThrow)
	{
		StThrowFileError errThrow( this, VE_FOLDER_CANNOT_DELETE, err);
		err = errThrow.GetError();
	}

	return err;
}
Example #12
0
void CLocalTransport::DeleteContents(
	/* [in] */ IFile* dirname)
{
    assert(dirname != NULL);
    AutoPtr<IObjectContainer> files;
    AutoPtr<IObjectEnumerator> filesEmu;
    dirname->ListFiles((IObjectContainer**)&files);
    files->GetObjectEnumerator((IObjectEnumerator**)&filesEmu);

    if (filesEmu != NULL) {
        Boolean hasNext = FALSE, successed = FALSE;;
        while (filesEmu->MoveNext(&hasNext), hasNext) {
            AutoPtr<IFile> f;
            filesEmu->Current((IInterface**)&f);
            assert(f != NULL);

            Boolean isDir = FALSE;
            f->IsDirectory(&isDir);
            if (isDir) {
                DeleteContents(f);
            }

            f->Delete(&successed);
        }
    }
}
Example #13
0
CGXGridCellData::~CGXGridCellData()
{
	DeleteContents();

	if ( m_bSingleMode && m_pDefCaptionStyle )
		delete m_pDefCaptionStyle;
}
Example #14
0
void CScribbleDoc::OnEditClearAll() 
{
	DeleteContents();
	SetModifiedFlag();  // Mark the document as having been modified, for
						// purposes of confirming File Close.
	UpdateAllViews(NULL);
}
Example #15
0
BOOL CDocument::OnNewDocument()
/*****************************/
{
    DeleteContents();
    m_strPathName.Empty();
    m_strTitle.Empty();
    SetModifiedFlag( FALSE );
    return( TRUE );
}
Example #16
0
ECode CLocalTransport::InitializeDevice(
    /* [out] */ Int32* error)
{
    assert(error != NULL);
    //if (DEBUG) Log.v(TAG, "wiping all data");
    DeleteContents(mDataDir);
    *error = BackupConstants::TRANSPORT_OK;
    return NOERROR;
}
Example #17
0
BExtractorDoc::~BExtractorDoc()
{
	if (m_hdd)
	{
		DrawDibClose(m_hdd);
		m_hdd = NULL;
	}
	DeleteContents();
}
Example #18
0
BOOL CHMMDemoDoc::OnOpenDocument(LPCTSTR path)
{
    bool result = false;
    
    int length = strlen( path );
    const char* tmp = path + length - 3;

    if( _stricmp(tmp,"bmp") == 0 || _stricmp(tmp,"jpg") == 0 || 
        _stricmp(tmp-1,"jpeg") == 0 )
    {
        CHMMDemoView* camera_view = GetCameraView();
        CCamera& camera = camera_view->Camera();

        if ( camera.IsRunning() ) camera.Stop();

        //load image from disk
        CImage& image = camera.GetFrame();
        image.Load( path, 1 );

        camera_view->Invalidate();
        camera_view->SetSelection(0); 
        
    }
    else if( _stricmp(tmp,"txt") == 0 )
    {   
        DeleteContents();
        SetModifiedFlag();  // dirty during de-serialize

        m_base.SetBaseView( GetImageBaseView() );

        {
            CWaitCursor wait;
            m_base.SetFileName( path );
            result = m_base.Load();
        }

        if( !result )
        {
            m_base.SetFileName("");
            AfxMessageBox("Failed to open database");
        }
        else
        {
            SetModifiedFlag(FALSE);     // start off with unmodified

            //try to read appropriate config file.
            //create cfg file name
            CString cfg_name = path;
            cfg_name.Replace( ".txt", "CFG.txt" );
            
            //reset parameters (HMM, Sampling etc.) for whole application
            CHMMDemoApp* app = (CHMMDemoApp*)AfxGetApp();
            app->LoadConfig( cfg_name, true );
        }
    }
    return  result;
}
Example #19
0
void Character::Delete() {
    // delete contents
    DeleteContents( m_factory );

    // delete character record
    m_factory.db().DeleteCharacter(itemID());

    // let the parent care about the rest
    Owner::Delete();
}
Example #20
0
BOOL CRIBPreviewDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
//	if (!CDocument::OnOpenDocument(lpszPathName))
//		return FALSE;
	
	// TODO: Add your specialized creation code here
	DeleteContents();
	SetModifiedFlag();  // dirty during de-serialize

	m_strPathName = lpszPathName;
	m_strRealPathName = lpszPathName;
	unsigned int i;
	for ( i = 0; i < m_strPathName.length(); ++i ) {
		if ( m_strPathName[i] == '\\' )
			m_strPathName[i] = '/';
	}
	SetModifiedFlag(FALSE);     // start off with unmodified

	if ( !m_strPathName.empty() && m_strPathName[0] != '\0' ) {
		TRi *ri = ((CRIBPreviewApp *)AfxGetApp())->GetRenderer();
		if ( ri ) {
			try {
				ri->begin();
				m_contextHandle = ri->getContext();
				m_invalid = m_contextHandle == NULL;
				ri->errorHandler(((CRIBPreviewApp *)AfxGetApp())->errorPrint);
			} catch (TRendererError &t) {
				m_invalid = TRUE;
				t.displayMessage();
			} catch ( ... ) {
				m_invalid = TRUE;
				::MessageBox(NULL, "Error while open document, RiBegin()", "ERROR", MB_ICONEXCLAMATION|MB_OK) ;
			}

			if ( m_invalid && m_contextHandle ) {
				try {
					ri->synchronize(ri->RI_ABORT);
				} catch (TRendererError &t) {
					t.displayMessage();
				} catch ( ... ) {
					::MessageBox(NULL, "Error while open document, RiSynchronize()", "ERROR", MB_ICONEXCLAMATION|MB_OK) ;
				}
			}

			((CRIBPreviewApp *)AfxGetApp())->ClearLog();
		}
	}
	
	return TRUE;
}
Example #21
0
BOOL CPLViewerDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
    // recycle document
    DeleteContents();

    m_pDib = new PLWinBmpEx;

    // have PaintLib perform I/O instead of Serialization
    bool bRet = true;
    try
    {
        // Jo Hagelberg 15.4.99: added "this" for progress notification
        thisApp.GetDecoder()->MakeBmpFromFile(lpszPathName, m_pDib, PLPixelFormat::DONTCARE, this);
    }
    catch (PLTextException e)
    {
        AfxMessageBox(e);
        DeleteContents();
        bRet = false;
    }

    if (bRet)
    {
        SetPathName(lpszPathName);
        SetModifiedFlag(false);      // start off with unmodified
        char *cp = strrchr(lpszPathName,'\\');
        if (cp) // establish this image's directory as our new wd
        {
            *cp = '\0';
            SetCurrentDirectory(lpszPathName);
            // pretend we did not touch that string
            *cp = '\\';
        }
    }

    return bRet;    // Belgian resolution enhancement technology :-)
}
Example #22
0
void CMatrixDoc::ProcOpenDocText(const CString sDataString)
{
	DeleteContents();
	CString temp=sDataString;
	temp.GetBufferSetLength(temp.GetLength()+1);
	int num=0;
	for(int i=0;i<sDataString.GetLength();i++)//把多个邻接的分号和并为一个
	{
		if(sDataString[i]==TCHAR(';'))
		{
			if((i+1)!=sDataString.GetLength()&&sDataString[i+1]==TCHAR(';'))
				continue;
			else
			{
				temp.SetAt(num,sDataString[i]);
				num++;
			}
		}
		else
		{
			temp.SetAt(num,sDataString[i]);
			num++;
		}
	}
	temp.SetAt(num,'\0');
	temp.GetBufferSetLength(lstrlen(temp));
	num=temp.Replace(';',';');
	if(num==0) return;
	CString *p=new CString[num];
	for(i=0;i<num;i++) p[i]=_T("");
	CString tpRS=temp;
	int nlen=0;
	int len=lstrlen(temp);
	for(i=0;i<num;i++)
	{
		tpRS=temp.Right(len-nlen);
		p[i]=tpRS.SpanExcluding(";");
		nlen=lstrlen(p[i])+1+nlen;
	}	
	//现在每个数据项保存着每个字符串中
	for(i=0;i<num;i++)
	{
		ProcOneString(p[i]);
	}
	delete []p;
}
BOOL CEtsEodManagerDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
	DeleteContents();
	SetModifiedFlag();

	CWaitCursor wait;
	if(ERROR_SUCCESS == FileOpen(lpszPathName))
	{
		_ReadReport();

		m_bIsCurrent = _IsCurrent(lpszPathName);
		EnableNotify(m_bIsCurrent);
	}

	SetModifiedFlag(FALSE);
	return TRUE;
}
BOOL CNifTextureDoc::OnOpenDocument(LPCTSTR lpszPathName) { 
  bool Result;

  DeleteContents();
  SetModifiedFlag();

	/* Input the NIF file */
  Result = m_NifFile.Read(lpszPathName);
  
  if (!Result) {
    ErrorHandler.Notify("NIF Load Error");
    return (FALSE);
   }

  SetModifiedFlag(FALSE);
  return (TRUE);
 }
Example #25
0
void CDocument::OnCloseDocument()
/*******************************/
{
    POSITION position;
    BOOL bOldAutoDelete = m_bAutoDelete;
    m_bAutoDelete = FALSE;
    while( (position = GetFirstViewPosition()) != NULL ) {
        CView *pView = GetNextView( position );
        ASSERT( pView != NULL );
        CFrameWnd *pFrame = pView->GetParentFrame();
        ASSERT( pFrame != NULL );
        pFrame->DestroyWindow();
    }
    DeleteContents();
    if( bOldAutoDelete ) { 
        delete this;
    }
}
Example #26
0
BOOL CDIPDemoDoc::OnOpenDocument ( LPCTSTR
                                   lpszPathName )
{
    DeleteContents();
    // 更改光标形状
    BeginWaitCursor();

    // 读取图像并附加到m_Image上
    if ( !m_Image.AttachFromFile ( lpszPathName ) )
    {
        EndWaitCursor();
        AfxMessageBox ( L"打开文件时出错!请确保正确的位图(*.bmp)文件类型。" );
        return FALSE;
    }

    // 恢复光标形状
    EndWaitCursor();

    // 判断读取成功否
    if ( !m_Image.m_lpData )
    {
        // 失败,可能非BMP格式
        CString strMsg;
        strMsg = L"读取图像时出错!可能是不支持该类型的图像文件!";
        // 提示出错
        MessageBox ( NULL, strMsg, L"系统提示",
                     MB_ICONINFORMATION | MB_OK );
        // 返回FALSE
        return FALSE;
    }

    Init(); //对图像的尺寸和调色板信息进行初始化
    // 设置文件名称
    SetPathName ( lpszPathName );
    // 拷贝当前m_Image到m_OImage
    m_OImage = m_Image;
    // 初始化胀标记为FALSE
    SetModifiedFlag ( FALSE );
    // 返回TRUE
    return TRUE;
}
/// Loads a power tab file.
/// @param fileName Full path of the file to load.
/// @throw std::ifstream::failure
void Document::Load(const string& fileName)
{
    std::ifstream fileStream(fileName.c_str(), std::ifstream::in | std::ifstream::binary);
    PowerTabInputStream stream(fileStream);

    DeleteContents();

    // read the header
    if (!m_header.Deserialize(stream))
    {
        throw std::runtime_error("Invalid header");
    }

    // read the rest of the document
    Deserialize(stream);

#if 0
    m_header.SetVersion(PowerTabFileHeader::FILEVERSION_CURRENT);
#endif
    m_fileName = fileName;
}
Example #28
0
CKartenCtrl::~CKartenCtrl() {
    // TODO: Cleanup your control's instance data here.
    DeleteContents( );
    POSITION	pos;
    CObject*	pValue;
    CString		sKey;
    for( pos = m_listOfPalettes.GetStartPosition( ); pos != NULL; ) {
        m_listOfPalettes.GetNextAssoc( pos, sKey, pValue );
        delete pValue;
        m_listOfPalettes.RemoveKey( sKey );
    }
    m_listOfPalTypes.RemoveAll();
    CRuntimeClass	*pRT;
    for( pos = m_pictTypes.GetStartPosition(); NULL != pos; ) {
        m_pictTypes.GetNextAssoc( pos, (void*&) pRT, (void*&) pValue );
        ASSERT_KINDOF( CPicture, pValue );
        delete pValue;
    }
    m_pictTypes.RemoveAll();
    delete m_pMemBlock;
}
Example #29
0
void COleDocument::LoadFromStorage()
{
	ASSERT(m_lpRootStg != NULL);

	// open Contents stream
	COleStreamFile file;
	CFileException fe;
	if (!file.OpenStream(m_lpRootStg, _T("Contents"),
			CFile::modeRead|CFile::shareExclusive, &fe) &&
		!file.CreateStream(m_lpRootStg, _T("Contents"),
			CFile::modeRead|CFile::shareExclusive|CFile::modeCreate, &fe))
	{
		if (fe.m_cause == CFileException::fileNotFound)
			AfxThrowArchiveException(CArchiveException::badSchema);
		else
			AfxThrowFileException(fe.m_cause, fe.m_lOsError);
	}

	// load it with CArchive (loads from Contents stream)
	CArchive loadArchive(&file, CArchive::load | CArchive::bNoFlushOnDelete);
	loadArchive.m_pDocument = this;
	loadArchive.m_bForceFlat = FALSE;

	TRY
	{
		if (file.GetLength() != 0)
			Serialize(loadArchive);     // load main contents
		loadArchive.Close();
		file.Close();
	}
	CATCH_ALL(e)
	{
		file.Abort();   // will not throw an exception
		DeleteContents();   // removed failed contents
		NO_CPP_EXCEPTION(loadArchive.Abort());
		THROW_LAST();
	}
	END_CATCH_ALL
}
Example #30
0
BOOL
CGenethonDoc::OnOpenDocument(const char *pszPathName)
{
    if (IsModified())
        TRACE0("Warning: OnOpenDocument replaces an unsaved document\n");


    BeginWaitCursor();

    DeleteContents();

    if ( pGSFiller != NULL ) {
        delete pGSFiller;
        pGSFiller = NULL;
    }

    if ( !GetMSFFile( pszPathName ) ) {
        EndWaitCursor();
        return FALSE;
    }

    // Save the File Path

    SetFilePath(pszPathName);

    // user defaults
    GetNewUserDefaults( );

    // Set printer orientation for this file.
    ((CGenethonApp *)AfxGetApp())->SetLandscape( m_UserVars.m_Orientation );

    SetModifiedFlag(FALSE);     // start off with unmodified

    EndWaitCursor();


    return TRUE;
}