#include "creaDevManagerIds.h"
+#include "modelCDMProject.h"
+#include "modelCDMPackage.h"
+
BEGIN_EVENT_TABLE(wxCDMBlackBoxHelpDialog, wxDialog)
EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMBlackBoxHelpDialog::OnFinish)
EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMBlackBoxHelpDialog::OnCMakeLists)
"If you don't understand how this inputs and outputs are used, try looking at the sample black boxes available "
"in the sample package, which is shipped with every new project.\n"
"Also, don't forget to include the libraries your boxes use in the header and implementation files. They should "
- "also be pointed and included in the package's directory CMakeLists.txt file and the project's directory "
- "CMakeLists.txt file. Again, please take a look at the sample package and its boxes to see how to include libraries "
- "in order to use them in the boxes.\n"
+ "also be pointed and included in the package's directory CMakeLists.txt file by uncommenting the \"SET\" commands "
+ "for third party libraries or by including the library name inside the \"SET(${BBTK_PACKAGE_NAME}_LIBS\"command "
+ "and its path inside the \"SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS\" command for custom libraries. You must also "
+ "include the package your black box is in by including the command \"ADD_SUBDIRECTORY([packageName])\" in the "
+ "project's directory CMakeLists.txt file. Again, please take a look at the sample package and its boxes to see "
+ "how to include libraries in order to use them in the boxes.\n"
"\n"
"You can easily edit the CMakeLists files previously mentioned by clicking on the following buttons."),
wxDefaultPosition,
);
v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
- wxButton* editCMakePKGBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file"));
- wxButton* editCMakePRJBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file"));
+ wxButton* editCMakePkgBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file"));
+ editCMakePkgBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsEnter,NULL,this);
+ editCMakePkgBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsExit,NULL,this);
+ wxButton* editCMakePrjBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file"));
+ editCMakePrjBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsEnter,NULL,this);
+ editCMakePrjBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsExit,NULL,this);
- v_sizer1->Add(editCMakePKGBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
- v_sizer1->Add(editCMakePRJBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+ v_sizer1->Add(editCMakePkgBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+ v_sizer1->Add(editCMakePrjBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
void wxCDMBlackBoxHelpDialog::OnCMakeLists(wxCommandEvent& event)
{
- //TODO: implement method
- std::cout << "OnCMakeLists not implemented yet." << std::endl;
- event.Skip();
+ std::string* result;
+
+ if((int)((wxButton*)event.GetEventObject())->GetId() == (int)ID_BUTTON_EDIT_CMAKELISTSFILE)
+ {
+ modelCDMIProjectTreeNode* node = this->blackBox;
+ while (node != NULL && dynamic_cast<modelCDMPackage*>(node) == NULL)
+ {
+ node = node->GetParent();
+ }
+ if (node != NULL)
+ {
+ if(!((modelCDMPackage*)node)->OpenCMakeListsFile(result))
+ wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+
+ if(((modelCDMPackage*)node)->GetCMakeLists() != NULL)
+ {
+ newEvent->SetClientData(((modelCDMPackage*)node)->GetCMakeLists());
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ }
+ }
+ else
+ {
+ wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+ }
+ }
+ else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+ {
+ modelCDMIProjectTreeNode* node = this->blackBox;
+ while (node != NULL && dynamic_cast<modelCDMProject*>(node) == NULL)
+ {
+ node = node->GetParent();
+ }
+ if (node != NULL)
+ {
+ if(!((modelCDMProject*)node)->OpenCMakeListsFile(result))
+ wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+
+ if(((modelCDMProject*)node)->GetCMakeLists() != NULL)
+ {
+ newEvent->SetClientData(((modelCDMProject*)node)->GetCMakeLists());
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ }
+ }
+ else
+ {
+ wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+ }
+ }
}
void wxCDMBlackBoxHelpDialog::OnCMakeListsEnter(wxMouseEvent& event)
{
- //TODO: implement method
- std::cout << "OnCMakeListsEnter not implemented yet." << std::endl;
+ if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+ {
+ modelCDMIProjectTreeNode* node = this->blackBox;
+ while (node != NULL && dynamic_cast<modelCDMPackage*>(node) == NULL)
+ {
+ node = node->GetParent();
+ }
+ if (node != NULL)
+ {
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
+
+ if(((modelCDMPackage*)node)->GetCMakeLists() != NULL)
+ {
+ newEvent->SetClientData(((modelCDMPackage*)node)->GetCMakeLists());
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ }
+ }
+ }
+ else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+ {
+ modelCDMIProjectTreeNode* node = this->blackBox;
+ while (node != NULL && dynamic_cast<modelCDMProject*>(node) == NULL)
+ {
+ node = node->GetParent();
+ }
+ if (node != NULL)
+ {
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
+
+ if(((modelCDMProject*)node)->GetCMakeLists() != NULL)
+ {
+ newEvent->SetClientData(((modelCDMProject*)node)->GetCMakeLists());
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ }
+ }
+ }
event.Skip();
}
void wxCDMBlackBoxHelpDialog::OnCMakeListsExit(wxMouseEvent& event)
{
- //TODO: implement method
- std::cout << "OnCMakeListsExit not implemented yet." << std::endl;
- event.Skip();
+ if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+ {
+ modelCDMIProjectTreeNode* node = this->blackBox;
+ while (node != NULL && dynamic_cast<modelCDMPackage*>(node) == NULL)
+ {
+ node = node->GetParent();
+ }
+ if (node != NULL)
+ {
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+
+ if(((modelCDMPackage*)node)->GetCMakeLists() != NULL)
+ {
+ newEvent->SetClientData(((modelCDMPackage*)node)->GetCMakeLists());
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ }
+ }
+ }
+ else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+ {
+ modelCDMIProjectTreeNode* node = this->blackBox;
+ while (node != NULL && dynamic_cast<modelCDMProject*>(node) == NULL)
+ {
+ node = node->GetParent();
+ }
+ if (node != NULL)
+ {
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+
+ if(((modelCDMProject*)node)->GetCMakeLists() != NULL)
+ {
+ newEvent->SetClientData(((modelCDMProject*)node)->GetCMakeLists());
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ }
+ }
+ }
+ event.Skip();
}
void wxCDMBlackBoxHelpDialog::OnDisableHelp(wxCommandEvent& event)