X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FwxCDMMainFrame.cpp;h=ad37e22c023a6bc3f12de9fd1ab7163100d14836;hb=f4451b0dfa9bfa593ada3e9462570b6ca250f0d7;hp=062552faff265cf311ac272719fb2b4e00ffd274;hpb=e75a80c4a8a5d67aeb1e941f0c980a11c09cc125;p=crea.git
diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp
index 062552f..ad37e22 100755
--- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp
+++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp
@@ -97,6 +97,13 @@ wxCDMMainFrame::wxCDMMainFrame(
long style
)
{
+ this->menu_File = NULL;
+ this->menu_Edit = NULL;
+ this->menu_Tools = NULL;
+ this->menu_Help = NULL;
+ this->panel_Properties = NULL;
+ this->panel_ProjectActions = NULL;
+ this->tree_Projects = NULL;
Create(parent, id, caption, pos, size, style);
}
@@ -209,7 +216,7 @@ void wxCDMMainFrame::CreateControls()
ID_TREE_PROJECTS,
wxDefaultPosition,
wxSize(200,400),
- wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
+ wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
);
panel_Properties = new wxCDMMainDescriptionPanel(
@@ -221,19 +228,10 @@ void wxCDMMainFrame::CreateControls()
0
);
-
-
-
-
-
-
auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
-
- wxString pers = auiManager.SavePerspective();
-
auiManager.Update();
- auiManager.LoadPerspective(pers,true);
+ //auiManager.LoadPerspective(pers,true);
wxToolTip::Enable(true);
wxToolTip::SetDelay(0);
}
@@ -262,6 +260,7 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
}
}
+
if(!this->model->CreateProject(
crea::wx2std(dialog->GetProjectName()),
crea::wx2std(dialog->GetProjectLocation()),
@@ -278,8 +277,8 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
//populate tree control
tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject());
- tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
- tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
+ tree_Projects->Unselect();
+ tree_Projects->SelectItem(this->model->GetProject()->GetId());
//show project actions panel
@@ -353,7 +352,7 @@ void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
//populate tree control
tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
- tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
+ tree_Projects->Unselect();
tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
@@ -438,9 +437,7 @@ void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
{
std::cout << "error closing project: " << *result << std::endl;
- wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
}
- tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
if(this->panel_Properties != NULL)
{
@@ -448,6 +445,13 @@ void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
this->panel_Properties->Destroy();
this->panel_Properties = NULL;
}
+
+ if(this->tree_Projects != NULL)
+ {
+ auiManager.DetachPane(this->tree_Projects);
+ this->tree_Projects->Destroy();
+ this->tree_Projects = NULL;
+ }
if(this->panel_ProjectActions != NULL)
{
@@ -455,9 +459,8 @@ void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
this->panel_ProjectActions->Destroy();
this->panel_ProjectActions = NULL;
}
-
+
Close();
- event.Skip();
}
//Edit Menu
@@ -473,7 +476,7 @@ void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
this->auiManager.Update();
- this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
+ this->tree_Projects->Unselect();
this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
}
event.Skip();
@@ -529,7 +532,42 @@ void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
html -> SetBorders(0);
- html -> LoadPage(wxT("about.html"));
+
+ std::string content = ""
+ ""
+ "
"
+ ""
+ " "
+ " "
+ " "
+ " CREA Development Manager"
+ " "
+ " "
+ " | "
+ "
"
+ " "
+ " "
+ " Creatis 2012 - Lyon, France "
+ " "
+ " "
+ " "
+ " "
+ " Created by Daniel González - daniel.gonzalez@creatis.insa-lyon.fr "
+ " | "
+ " "
+ " "
+ " "
+ " This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software. "
+ " "
+ " "
+ " | "
+ "
"
+ "
"
+ ""
+ ""
+ ;
+
+ html -> SetPage(crea::std2wx(content));
html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(),
html -> GetInternalRepresentation() -> GetHeight());
@@ -564,8 +602,10 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
std::cout << "Tree Selection id: " << elementId << 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
//project
modelCDMProject* elementProject = dynamic_cast(element);
@@ -762,24 +802,18 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
}
}
- if(this->panel_Properties!= NULL)
- this->panel_Properties->Hide();
-
- auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
- auiManager.Update();
-
//delete old view
if(this->panel_Properties!= NULL)
{
+ this->panel_Properties->Hide();
auiManager.DetachPane(this->panel_Properties);
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.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false));
auiManager.Update();
event.Skip();
}
@@ -790,20 +824,22 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
{
+ modelCDMIProjectTreeNode* myItem = NULL;
switch(event.GetId())
{
case 0:
+ myItem = ((modelCDMIProjectTreeNode*)event.GetClientData());
//select out old one to generate selection event
- this->tree_Projects->SelectItem(event.GetInt(), false);
- this->tree_Projects->SelectItem(event.GetInt(), true);
- this->tree_Projects->Expand(event.GetInt());
+ this->tree_Projects->Unselect();
+ this->tree_Projects->SelectItem(myItem->GetId(), true);
+ this->tree_Projects->Expand(myItem->GetId());
break;
case 1:
wxPanel* description = NULL;
if(event.GetString() == wxT("manage_packages"))
{
- this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
- this->tree_Projects->Expand(this->model->GetProject()->GetId());
+ //this->tree_Projects->Expand(this->model->GetProject()->GetId());
+ //this->tree_Projects->Unselect();
description = new wxCDMPackageManagerPanel(
this,
this->model->GetProject(),
@@ -828,7 +864,6 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
}
else if(event.GetString() == wxT("blackbox"))
{
- this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData();
description = new wxCDMBlackBoxDescriptionPanel(
this,
@@ -841,23 +876,19 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
);
}
- if(this->panel_Properties!= NULL)
- this->panel_Properties->Hide();
-
- auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false));
- auiManager.Update();
-
//delete old view
if(this->panel_Properties!= NULL)
{
+ this->panel_Properties->Hide();
auiManager.DetachPane(this->panel_Properties);
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();
+
break;
}
event.Skip();
@@ -866,19 +897,21 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event)
void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
{
//std::cout << "element " << event.GetInt() << std::endl;
- this->tree_Projects->EnsureVisible(event.GetInt());
- this->tree_Projects->SetItemBold(event.GetInt(), true);
- this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,255));
- this->tree_Projects->SetItemBackgroundColour(event.GetInt(), wxColour(230,230,255));
+ modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
+ this->tree_Projects->EnsureVisible(item->GetId());
+ this->tree_Projects->SetItemBold(item->GetId(), true);
+ this->tree_Projects->SetItemTextColour(item->GetId(), wxColour(0,0,255));
+ this->tree_Projects->SetItemBackgroundColour(item->GetId(), wxColour(230,230,255));
this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
auiManager.Update();
}
void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
{
- this->tree_Projects->SetItemBold(event.GetInt(), false);
- this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,0));
- this->tree_Projects->SetItemBackgroundColour(event.GetInt(), wxColour(255,255,255));
+ modelCDMIProjectTreeNode* item = (modelCDMIProjectTreeNode*)event.GetClientData();
+ this->tree_Projects->SetItemBold(item->GetId(), false);
+ this->tree_Projects->SetItemTextColour(item->GetId(), wxColour(0,0,0));
+ this->tree_Projects->SetItemBackgroundColour(item->GetId(), wxColour(255,255,255));
this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
auiManager.Update();
}