toolbar->AddSeparator();
toolbar->AddTool(ID_UNDO, _T("Undo"),bmp_undo, wxNullBitmap, wxITEM_NORMAL, _T("Undo"), _T("Undo"));
toolbar->AddTool(ID_REDO, _T("Redo"),bmp_redo, wxNullBitmap, wxITEM_NORMAL, _T("Redo"), _T("Redo"));
+
toolbar->EnableTool(ID_UNDO, false);
toolbar->EnableTool(ID_REDO, false);
toolbar->SetMargins(2, 2);
void wxGUIEditorGraphicBBS::OnUndo(wxCommandEvent& event) {
unsigned short disable;
+ std::string stundo;
+ std::string stredo;
+
_tabsMgr->loadTempDiagram(0);
- disable = _tabsMgr->getUndoState();
+ disable = _tabsMgr->getUndoState(stundo);
if(disable == 0)
{
std::string name = _tabsMgr->GetNameTabPanel();
}
GetToolBar()->EnableTool(ID_UNDO,disable);
- GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState());
+ GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
+ GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
+ GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
refreshGUIControls();
}
void wxGUIEditorGraphicBBS::OnRedo(wxCommandEvent& event) {
unsigned short disable;
+ std::string stundo;
+ std::string stredo;
+
_tabsMgr->loadTempDiagram(1);
std::string name = _tabsMgr->GetNameTabPanel();
if(name[name.length() - 1] != '*')
name +="*";
_tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
- GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState());
- GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState());
+ GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
+ GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
+ GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
+ GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
refreshGUIControls();
}
}
//=========================================================================
-void wxGUIEditorGraphicBBS::SaveTempActualDiagram()
+void wxGUIEditorGraphicBBS::SaveTempActualDiagram(const std::string &action)
{
+ std::string stundo;
+ std::string stredo;
std::string name = _tabsMgr->GetNameTabPanel();
if(name[name.length() - 1] != '*')
name +="*";
_tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
- _tabsMgr->saveTempActualDiagram();
- GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState());
- GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState());
+ _tabsMgr->saveTempActualDiagram(action);
+ GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
+ GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
+ GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
+ GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
}
//=========================================================================
//=========================================================================
void wxGUIEditorGraphicBBS::refreshGUIControls() {
+ std::string stundo;
+ std::string stredo;
wxToolBar* toolbar = GetToolBar();
if (_tabsMgr->isActualDiagramComplexBox()) {
toolbar->ToggleTool(ID_BTNCOMPLEXBOX, true);
GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, true);
}
- GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState());
- GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState());
+ GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
+ GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
+ GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
+ GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
if (_tabsMgr->getNumActualSelectedObjects() > 0) {
GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM, true);
assert(inputStream.good()); // fails
_tabsMgr->addNewTab(openFileDialog->GetFilename());
_tabsMgr->loadDiagram(inputStream, fName);
- _tabsMgr->saveTempActualDiagram();
+ _tabsMgr->saveTempActualDiagram("load diagram");
GetToolBar()->EnableTool(ID_UNDO, false);
GetToolBar()->EnableTool(ID_UNDO, false);
inputStream.close();
scn->refresh();
}
- SaveTempActualDiagram();
+ SaveTempActualDiagram("New Box");
// if pnl
}// if bbDes
}
//=========================================================================
void wxGUIEditorGraphicBBS::OnCreatePackage(wxCommandEvent& event) {
- //bbtkSystemTools::CreatePackage();
+ bbtkSystemTools::CreatePackage();
}
//=========================================================================
void wxGUIEditorGraphicBBS::OnCreateBlackBox(wxCommandEvent& event) {
- //bbtkSystemTools::CreateBlackBox();
+ bbtkSystemTools::CreateBlackBox();
}
//=========================================================================
void wxGUIEditorGraphicBBS::OnPlugPackage(wxCommandEvent& event) {
void SaveActualComplexBox(std::string filename);
void SaveActualDiagram(std::string filename);
void SaveCurrentDiagramAs( ); //DFCH
- void SaveTempActualDiagram();//FCY
+ void SaveTempActualDiagram(const std::string &);//FCY
// File menu and toolbar events
}
if( closeok==1 ){
- _parent->SaveTempActualDiagram();
+ _parent->SaveTempActualDiagram("edit values");
Close(true);
}
}
_panelAUIMgr = new wxAuiManager(this);
_sceneManager = NULL;
_actualdo = states.begin();
+ _sactualdo = sstates.begin();
initWxVtkCanvas();
printf("EED wxGEditorTabPanel::wxGEditorTabPanel 1\n");
}
boxType += result;
_sceneManager->createGBlackBox(x,y,packageName, boxType);
- saveTempandUpdate();
+ saveTempandUpdate("drop box");
return true;
}
//=========================================================================
- void wxGEditorTabPanel::saveTempandUpdate()
+ void wxGEditorTabPanel::saveTempandUpdate(const std::string &action)
{
- _panelsManager->saveTempandUpdate();
+ _panelsManager->saveTempandUpdate(action);
}
//=========================================================================
//=========================================================================
- void wxGEditorTabPanel::saveTempDiagram() //FCY
+ void wxGEditorTabPanel::saveTempDiagram(const std::string &action) //FCY
{
std::string content = "";
// writing file header
if(_actualdo == states.end() ) // same size, write to the end
{
states.push_back (content);
+ saveStringAction(action);
}
else
{
std::vector<std::string>::iterator it = _actualdo+1;
states.erase(it, states.end());
states.push_back(content);
+
+ std::vector<std::string>::iterator sit = _sactualdo+1;
+ sstates.erase(sit, sstates.end());
+ saveStringAction(action);
}
_actualdo = states.end();
+ _sactualdo = sstates.end();
}
}
//=========================================================================
- unsigned short wxGEditorTabPanel::getUndoState()
+ unsigned short wxGEditorTabPanel::getUndoState( std::string &stun)
{
+ stun = "Undo";
if(states.size()>0)
{
if(_actualdo == states.begin() )
+ {
+
return 0;
+ }
else
+ {
+ stun +=" - ";
+ stun += _sactualdo->substr(0,(--_sactualdo)->find_last_of("."));
+ _sactualdo++;
return 1;
+ }
}
}
- unsigned short wxGEditorTabPanel::getRedoState()
+ unsigned short wxGEditorTabPanel::getRedoState( std::string &stre)
{
+ stre = "Redo";
if(states.size()>0)
{
- if(_actualdo == --states.end() || states.size() == 1)
+ if(_actualdo == --states.end() || states.size() == 1 || _actualdo == states.end())
return 0;
else
+ {
+ stre +=" - ";
+ stre += _sactualdo->substr(0,(++_sactualdo)->find_last_of("."));
+ --_sactualdo;
return 1;
+ }
}
}
if(_actualdo == states.end() ) // same size, write to the end
{
(_actualdo--);
+ (_sactualdo--);
}
if(_actualdo != states.begin() )
{
ss << *(--_actualdo);
+ _sactualdo--;
}
else
{
else //redo
{
_actualdo++;
+ _sactualdo++;
if(_actualdo != states.end())
{
ss << *_actualdo;
_sceneManager->loadDiagram(ss);
}
-
+
+ void wxGEditorTabPanel::saveStringAction(const std::string &action)
+ {
+ char temp[50];
+ sprintf(temp,".%d", sstates.size());
+ sstates.push_back(action + temp);
+ }
+
//=========================================================================
int wxGEditorTabPanel::getPanelId()
{
return _id;
}
+
+
//=========================================================================
void saveDiagram(std::string &content, const std::string &path); //DFCH
// Save temporary diagram as BBG
- void saveTempDiagram();
+ void saveTempDiagram(const std::string &);
// Save temporary diagram as BBG and update buttons
- void saveTempandUpdate();
+ void saveTempandUpdate(const std::string &);
// Load BBG diagram
void loadDiagram(ifstream &inputStream, const std::string &path); //DFCH
+ void saveStringAction(const std::string &action);
+
// Load temporary diagram as BBG
void loadTempDiagram(unsigned short un);
// evaluate the position in the undo actions list
- unsigned short getUndoState();
+ unsigned short getUndoState(std::string &);
// evaluate the position in the redo actions list
- unsigned short getRedoState();
+ unsigned short getRedoState(std::string &);
// Add a new complex input object to the scene
void addComplexInputPort(std::string portName);
private:
std::vector<std::string> states; // represents each modification of the tab. Maxixum size 100!!
std::vector<std::string>::iterator _actualdo; // actual position on modifications vector
+ std::vector<std::string> sstates; // represents string of each modification of the tab. Maxixum size 100!!
+ std::vector<std::string>::iterator _sactualdo; // actual position onstring modifications vector
int _id;
wxAuiManager *_panelAUIMgr;
}
//=========================================================================
- void wxTabPanelsManager::saveTempandUpdate() //FCY
+ void wxTabPanelsManager::saveTempandUpdate(const std::string &action) //FCY
{
- _parent->SaveTempActualDiagram();
+ _parent->SaveTempActualDiagram(action);
}
//=========================================================================
- void wxTabPanelsManager::saveTempActualDiagram() //FCY
+ void wxTabPanelsManager::saveTempActualDiagram(const std::string &action) //FCY
{
- _actual->saveTempDiagram();
+ _actual->saveTempDiagram(action);
}
//=========================================================================
void wxTabPanelsManager::loadTempDiagram(unsigned short un) //FCY
}
//=========================================================================
- unsigned short wxTabPanelsManager::getUndoState() //FCY
+ unsigned short wxTabPanelsManager::getUndoState( std::string &stun) //FCY
{
- return _actual->getUndoState();
+ return _actual->getUndoState(stun);
}
//=========================================================================
- unsigned short wxTabPanelsManager::getRedoState() //FCY
+ unsigned short wxTabPanelsManager::getRedoState(std::string &stre) //FCY
{
- return _actual->getRedoState();
+ return _actual->getRedoState(stre);
}
//=========================================================================
void saveActualDiagram(std::string &content, const std::string &path); //DFCH
void loadDiagram(ifstream &inputStream, const std::string &path); //DFCH
- void saveTempActualDiagram(); //FCY
- void saveTempandUpdate();
+ void saveTempActualDiagram(const std::string &); //FCY
+ void saveTempandUpdate(const std::string &);
void loadTempDiagram(unsigned short un); //FCY
- unsigned short getUndoState();
- unsigned short getRedoState();
+ unsigned short getUndoState(std::string &);
+ unsigned short getRedoState(std::string &);
bool isActualDiagramComplexBox();
void setActualDiagramComplexBox(bool val);
void addActualDiagramComplexInputPort(std::string portName);
}
// EO JGRR CM
- _parent->saveTempDiagram();
+ _parent->saveTempandUpdate("create connection");
}
manualConnectorContourController
_controllers.erase(it);
}//if
}// for
- _parent->saveTempandUpdate();
+ _parent->saveTempandUpdate("delete object");
}
//=========================================================================