std::vector<modelCDMIProjectTreeNode*> parents = this->appli->GetParents();
for (int i = 0; i < (int)(parents.size()); i++)
{
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
if (i < (int)(parents.size())-1)
std::vector<modelCDMApplication*> applications = this->appli->GetApplications();
for (int i = 0; i < (int)(applications.size()); i++)
{
- wxHyperlinkCtrl* pApplicationlk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_APPLICATION, crea::std2wx(applications[i]->GetName().c_str()), crea::std2wx(applications[i]->GetName().c_str()));
- pApplicationlk->SetWindowStyle(wxALIGN_LEFT);
+ wxHyperlinkCtrl* pApplicationlk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_APPLICATION, crea::std2wx(applications[i]->GetName().c_str()), crea::std2wx(applications[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ pApplicationlk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER);
std::string tt = "Name: " + applications[i]->GetName() + "\n";
tt += "Location: " + applications[i]->GetPath();
pApplicationlk->SetToolTip(crea::std2wx(tt.c_str()));
std::vector<modelCDMIProjectTreeNode*> parents = this->application->GetParents();
for (int i = 0; i < (int)(parents.size()); i++)
{
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
if (i < (int)(parents.size())-1)
std::vector<modelCDMIProjectTreeNode*> parents = this->blackBox->GetParents();
for (int i = 0; i < (int)(parents.size()); i++)
{
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
if (i < (int)(parents.size())-1)
std::vector<modelCDMIProjectTreeNode*> parents = this->cMakeLists->GetParents();
for (int i = 0; i < (int)(parents.size()); i++)
{
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
if (i < (int)(parents.size())-1)
std::vector<modelCDMIProjectTreeNode*> parents = this->file->GetParents();
for (int i = 0; i < (int)(parents.size()); i++)
{
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
if (i < (int)(parents.size())-1)
std::vector<modelCDMIProjectTreeNode*> parents = this->folder->GetParents();
for (int i = 0; i < (int)(parents.size()); i++)
{
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
if (i < (int)(parents.size())-1)
std::vector<modelCDMIProjectTreeNode*> parents = this->lib->GetParents();
for (int i = 0; i < (int)(parents.size()); i++)
{
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
- returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
+ returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
if (i < (int)(parents.size())-1)
{
std::vector<modelCDMLibrary*> libraries = this->lib->GetLibraries();
for (int i = 0; i < (int)(libraries.size()); i++)
{
- wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str()));
- pLibrarylk->SetWindowStyle(wxALIGN_LEFT);
+ wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ pLibrarylk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER);
std::string tt = "Name: " + libraries[i]->GetName() + "\n";
tt += "Location: " + libraries[i]->GetPath();
pLibrarylk->SetToolTip(crea::std2wx(tt.c_str()));
std::vector<modelCDMIProjectTreeNode*> parents = this->library->GetParents();
for (int i = 0; i < (int)(parents.size()); i++)
{
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
- returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
+ returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
if (i < (int)(parents.size())-1)
{
wxSize(200,400),
wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
);
+ this->actualTreeItem.Unset();
panel_Properties = new wxCDMMainDescriptionPanel(
this,
auiManager.Update();
//populate tree control
- tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
tree_Projects->Unselect();
+ this->actualTreeItem.Unset();
+ tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId());
wxMessageBox(wxT("ProjectSelected") ,_T("New Project - Success!"),wxOK | wxICON_ERROR);
}
std::cout << "building ui" << std::endl;
//populate tree control
+ tree_Projects->Unselect();
+ this->actualTreeItem.Unset();
tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
- tree_Projects->Unselect();
tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), true);
-
//change project's actions panel
if(this->panel_ProjectActions!= NULL)
{
auiManager.Update();
}
-
- event.Skip();
}
void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
}
tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
-
+ this->actualTreeItem.Unset();
if(this->panel_Properties != NULL)
{
auiManager.DetachPane(this->panel_Properties);
- this->panel_Properties->Destroy();
- this->panel_Properties = NULL;
+ this->panel_Properties->Hide();
}
if(this->panel_ProjectActions != NULL)
{
auiManager.DetachPane(this->panel_ProjectActions);
- this->panel_ProjectActions->Destroy();
- this->panel_ProjectActions = NULL;
+ this->panel_ProjectActions->Hide();
}
this->panel_Properties = new wxCDMMainDescriptionPanel(
auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
auiManager.Update();
- event.Skip();
}
void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
//get selected element
wxTreeItemId elementId = event.GetItem();
- if(elementId.IsOk() && this->tree_Projects->IsSelected(elementId))
+ //elementId.IsOk() && this->tree_Projects->IsSelected(elementId)
+ if(elementId.IsOk() && this->actualTreeItem != elementId)
{
- std::cout << "Tree Selection id: " << elementId << std::endl;
+
+ std::cout << "Tree Selection id: " << elementId.m_pItem << std::endl;
//get element from model
modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
if (element == NULL)
return;
std::cout << "Tree Selection: " << element->GetName() << std::endl;
-
- //TODO get element type
+
+ //std::stringstream ss;
+ //ss << this->actualTreeItem.m_pItem << ":" << event.GetOldItem().m_pItem << " --> " << elementId.m_pItem;
+ //wxMessageBox( wxT("Tree Selection id: " + ss.str() + " by " + element->GetName()), wxT("Refresh Project - Error"), wxICON_ERROR);
+ this->actualTreeItem = elementId;
+
+ //get element type
//project
modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
wxPanel* description;
{
this->panel_Properties->Hide();
auiManager.DetachPane(this->panel_Properties);
- this->panel_Properties->Destroy();
- this->panel_Properties = NULL;
+ //this->panel_Properties->Destroy();
+ //this->panel_Properties = NULL;
}
//set new view
auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
this->panel_Properties = description;
auiManager.Update();
- event.Skip();
}
+ else
+ {
+ event.Skip();
+ }
return;
void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
{
modelCDMIProjectTreeNode* myItem = NULL;
+ wxPanel* description = NULL;
switch(event.GetId())
{
case 0:
myItem = ((modelCDMIProjectTreeNode*)event.GetClientData());
//select out old one to generate selection event
this->tree_Projects->Unselect();
- this->tree_Projects->SelectItem(myItem->GetId().GetWxId(), true);
+ this->tree_Projects->SelectItem(myItem->GetId().GetWxId());
this->tree_Projects->Expand(myItem->GetId().GetWxId());
break;
case 1:
- wxPanel* description = NULL;
+
if(event.GetString() == wxT("manage_packages"))
{
//this->tree_Projects->Expand(this->model->GetProject()->GetId());
//this->tree_Projects->Unselect();
- description = new wxCDMPackageManagerPanel(
+ this->actualTreeItem.Unset();
+ description = new wxCDMPackageManagerPanel(
this,
this->model->GetProject(),
ID_WINDOW_PROPERTIES,
}
else if(event.GetString() == wxT("manage_libraries"))
{
- this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId().GetWxId(), true);
+ this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId().GetWxId());
this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId().GetWxId());
break;
}
else if(event.GetString() == wxT("manage_applications"))
{
- this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId().GetWxId(), true);
+ this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId().GetWxId());
this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId().GetWxId());
break;
}
else if(event.GetString() == wxT("blackbox"))
{
modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData();
+ this->actualTreeItem.Unset();
description = new wxCDMBlackBoxDescriptionPanel(
this,
bb,
wxSize(600, 400),
0
);
+
}
//delete old view
auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
this->panel_Properties = description;
auiManager.Update();
-
break;
+ default:
+ event.Skip();
}
- event.Skip();
+
}
void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
* Tree control for an open project
*/
wxCDMProjectsTreeCtrl* tree_Projects;
+ /**
+ * Tree item for the selected item in the tree.
+ */
+ wxTreeItemId actualTreeItem;
/**
* Description panel for a selected project item
*/
std::vector<modelCDMIProjectTreeNode*> parents = this->package->GetParents();
for (int i = 0; i < (int)(parents.size()); i++)
{
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
- returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
+ returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
if (i < (int)(parents.size())-1)
{
if(blackBoxes[i] != NULL)
{
- wxHyperlinkCtrl* pBBlk = new wxHyperlinkCtrl(BBPanel,ID_LINK_SELECT_BLACKBOX, crea::std2wx(blackBoxes[i]->GetName().c_str()), crea::std2wx(blackBoxes[i]->GetName().c_str()));
- pBBlk->SetWindowStyle(wxALIGN_LEFT);
+ wxHyperlinkCtrl* pBBlk = new wxHyperlinkCtrl(BBPanel,ID_LINK_SELECT_BLACKBOX, crea::std2wx(blackBoxes[i]->GetName().c_str()), crea::std2wx(blackBoxes[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ pBBlk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER);
std::string tt = "Author: " + blackBoxes[i]->GetAuthors() + "\nDescription: " + blackBoxes[i]->GetDescription() + "\nCategories: " + blackBoxes[i]->GetCategories();
pBBlk->SetToolTip(crea::std2wx(tt));
pBBlk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnMouseEnter,NULL,this);
wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
//Link to return
- wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(this->project->GetName()), crea::std2wx(this->project->GetPath()));
+ wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(this->project->GetName()), crea::std2wx(this->project->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ returnLnk->SetWindowStyle(wxNO_BORDER);
returnLnk->SetToolTip(wxT("Return to the active project description."));
sizer->Add(returnLnk, 0, wxALIGN_CENTER | wxALL, 5);
std::vector<modelCDMPackage*> packages = this->project->GetPackages();
for (int i = 0; i < (int)(packages.size()); i++)
{
- wxHyperlinkCtrl* pPackagelk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_PACKAGE, crea::std2wx(packages[i]->GetName().c_str()), crea::std2wx(packages[i]->GetName().c_str()));
- pPackagelk->SetWindowStyle(wxALIGN_LEFT);
+ wxHyperlinkCtrl* pPackagelk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_PACKAGE, crea::std2wx(packages[i]->GetName().c_str()), crea::std2wx(packages[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+ pPackagelk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER);
std::string tt = "Author: " + packages[i]->GetAuthors() + "\nDescription: " + packages[i]->GetDescription();
pPackagelk->SetToolTip(crea::std2wx(tt));
propertiesPanelSizer -> Add(pPackagelk, 0, wxEXPAND | wxALL, 5);
void wxCDMProjectsTreeCtrl::BuildTree(std::map< wxCDMTreeItemId, modelCDMIProjectTreeNode* >& modelElements, modelCDMProject* projectTree)
{
+ this->Unselect();
std::cout << "building tree" << std::endl;
this->DeleteAllItems();
modelElements.clear();