void pigaleWindow::NewGraph() {setPigaleError(); statusBar()->showMessage("New graph"); UndoClear();UndoSave(); Graph G(GC); G.StrictReset(); Prop<bool> eoriented(G.Set(tedge()),PROP_ORIENTED,false); if(debug())DebugPrintf("**** New graph"); information();gw->editor->update(1); }
//--------------------------------------------------------------------------- // actor commands //--------------------------------------------------------------------------- CCommandVar CActorTools::CommandLoad(CCommandVar p1, CCommandVar p2) { xr_string temp_fn = p1.IsString()?xr_string(p1):xr_string(""); if(!p1.IsString()){ temp_fn = ChangeFileExt(m_LastFileName,"").c_str(); if (!EFS.GetOpenName ( _objects_, temp_fn )) return FALSE; } if( temp_fn.size() ){ xr_strlwr (temp_fn); if (!IfModified()) return FALSE; if (!FS.exist(temp_fn.c_str())){ Msg ("#!Can't load file: %s",temp_fn.c_str()); return FALSE; } ExecCommand (COMMAND_CLEAR); BOOL bReadOnly = !FS.can_modify_file(temp_fn.c_str()); m_Flags.set (flReadOnlyMode,bReadOnly); if (bReadOnly || EFS.CheckLocking(temp_fn.c_str(),false,true)) Msg ("#!Object '%s' opened in readonly mode.",temp_fn.c_str()); /* shared_str locker; if ((false==bReadOnly) && EFS.CheckLocking(_objects_,temp_fn.c_str(),false,true,&locker)){ Log ("#!Object opened in readonly mode. Locked by user:"******"#!You don't have permisions to modify object:",temp_fn.c_str()); } */ // set enable ... m_Props->SetReadOnly (bReadOnly); fraLeftBar->SetReadOnly (bReadOnly); CTimer T; T.Start(); if (!Load(temp_fn.c_str())){ return FALSE; } m_LastFileName = temp_fn.c_str(); ELog.Msg(mtInformation,"Object '%s' successfully loaded. Loading time - %3.2f(s).",m_LastFileName.c_str(),T.GetElapsed_sec()); EPrefs->AppendRecentFile(m_LastFileName.c_str()); ExecCommand (COMMAND_UPDATE_CAPTION); ExecCommand (COMMAND_UPDATE_PROPERTIES); // lock if (!bReadOnly) EFS.LockFile(m_LastFileName.c_str()); UndoClear(); UndoSave(); } return TRUE; }
bool FileContentBuffered::ReadFile(const wxString& fileName) { wxFile fl( fileName, wxFile::read ); if ( !fl.IsOpened() ) return false; m_Buffer.resize( fl.Length() ); UndoClear(); return (size_t)fl.Read( &m_Buffer[0], m_Buffer.size() ) == m_Buffer.size(); }
CCommandVar CActorTools::CommandClear(CCommandVar p1, CCommandVar p2) { if (!IfModified()) return FALSE; // unlock EFS.UnlockFile (m_LastFileName.c_str()); m_LastFileName = ""; Device.m_Camera.Reset(); Clear (); ExecCommand (COMMAND_UPDATE_CAPTION); ExecCommand (COMMAND_UPDATE_PROPERTIES); UndoClear (); return TRUE; }
void FData::DeleteDataFile(int _Type) { /* Delata o buffer de um arquivo */ if(ExistFileType(_Type)) { int Id = GetId(_Type); delete [] Files[Id].Buffer; Files.erase(Files.begin() + Id); if(_Type == EDIT) UndoClear(); } UpdateMaxFileType(); DefSerieMain(); }
int pigaleWindow::load(int pos) {setPigaleError(); QString m; QFileInfo fi(InputFileName); if(!fi.exists() || fi.size() == 0) {m = QString("file -%1- does not exist").arg(InputFileName); if(!ServerExecuting)statusBar()->showMessage(m,2000); LogPrintf("%s\n",(const char *)m.toLatin1()); return -1; } if (!IO_IsMine(InputDriver,(const char *)InputFileName.toLatin1())) {m.sprintf("file -%s- is not a valid %s",(const char *)InputFileName.toLatin1(),IO_Name(InputDriver)); if(!ServerExecuting)statusBar()->showMessage(m,2000); LogPrintf("%s\n",(const char *)m.toLatin1()); return -1; } UndoClear();UndoSave(); int NumRecords =IO_GetNumRecords(InputDriver,(const char *)InputFileName.toLatin1()); if(pos == 1)++(*pGraphIndex); else if(pos == -1)--(*pGraphIndex); if(*pGraphIndex > NumRecords)*pGraphIndex = 1; else if(*pGraphIndex < 1)*pGraphIndex += NumRecords; if(IO_Read(InputDriver,GC,(const char *)InputFileName.toLatin1(),NumRecords,*pGraphIndex) != 0) {m = QString("Could not read:%1").arg(InputFileName); if(!ServerExecuting)statusBar()->showMessage(m,2000); return -2; } if(debug())DebugPrintf("\n**** %s: %d/%d",(const char *)InputFileName.toLatin1(),*pGraphIndex,NumRecords); Prop<bool> eoriented(GC.Set(tedge()),PROP_ORIENTED,false); TopologicalGraph G(GC); UndoSave(); banner(); information(); gw->editor->update(1); return *pGraphIndex; }