Skip to content

Commit

Permalink
Use wxWidgets wxPersistenceManager for all CodeLite's dialogs and frames
Browse files Browse the repository at this point in the history
  • Loading branch information
eranif committed Apr 10, 2015
1 parent 789baa0 commit 480be91
Show file tree
Hide file tree
Showing 114 changed files with 3,647 additions and 3,737 deletions.
5 changes: 3 additions & 2 deletions CMakePlugin/CMakeSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,16 @@ CMakeSettingsDialog::CMakeSettingsDialog(wxWindow* parent, CMakePlugin* plugin)
m_choiceDefaultGenerator->Append(m_plugin->GetSupportedGenerators());

// Load window layout
WindowAttrManager::Load(this, "CMakeSettingsDialog", NULL);
SetName("CMakeSettingsDialog");
WindowAttrManager::Load(this);
}

/* ************************************************************************ */

CMakeSettingsDialog::~CMakeSettingsDialog()
{
// Save window layout
WindowAttrManager::Save(this, "CMakeSettingsDialog", NULL);

}

/* ************************************************************************ */
150 changes: 82 additions & 68 deletions CallGraph/uisettingsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,97 +29,111 @@
#include <wx/filedlg.h>
#include "windowattrmanager.h"

uisettingsdlg::uisettingsdlg( wxWindow* parent, IManager *mgr)//, CallGraph *plugin )
: uisettings(parent)
, m_mgr(mgr)
uisettingsdlg::uisettingsdlg(wxWindow* parent, IManager* mgr) //, CallGraph *plugin )
: uisettings(parent),
m_mgr(mgr)
{
//ConfCallGraph confData;
// read last stored value for paths gprof and dot
m_mgr->GetConfigTool()->ReadObject(wxT("CallGraph"), &confData);
m_textCtrl_path_gprof->SetValue(confData.GetGprofPath());
m_textCtrl_path_dot->SetValue(confData.GetDotPath());
m_spinCtrl_treshold_edge->SetValue(confData.GetTresholdEdge());
m_spinCtrl_treshold_node->SetValue(confData.GetTresholdNode());
m_spinCtrl_colors_node->SetValue(confData.GetColorsNode());
m_spinCtrl_colors_edge->SetValue(confData.GetColorsEdge());
m_checkBox_Names->SetValue(confData.GetHideParams());
m_checkBox_Parameters->SetValue(confData.GetStripParams());
m_checkBox_Namespaces->SetValue(confData.GetHideNamespaces());
//
if(m_checkBox_Names->IsChecked()) m_checkBox_Parameters->Disable();
if(m_checkBox_Parameters->IsChecked()) m_checkBox_Names->Disable();
//

GetSizer()->Fit(this);
WindowAttrManager::Load(this, wxT("CGUiSettingsDlg"), NULL);
// ConfCallGraph confData;
// read last stored value for paths gprof and dot
m_mgr->GetConfigTool()->ReadObject(wxT("CallGraph"), &confData);
m_textCtrl_path_gprof->SetValue(confData.GetGprofPath());
m_textCtrl_path_dot->SetValue(confData.GetDotPath());
m_spinCtrl_treshold_edge->SetValue(confData.GetTresholdEdge());
m_spinCtrl_treshold_node->SetValue(confData.GetTresholdNode());
m_spinCtrl_colors_node->SetValue(confData.GetColorsNode());
m_spinCtrl_colors_edge->SetValue(confData.GetColorsEdge());
m_checkBox_Names->SetValue(confData.GetHideParams());
m_checkBox_Parameters->SetValue(confData.GetStripParams());
m_checkBox_Namespaces->SetValue(confData.GetHideNamespaces());
//
if(m_checkBox_Names->IsChecked()) m_checkBox_Parameters->Disable();
if(m_checkBox_Parameters->IsChecked()) m_checkBox_Names->Disable();
//

GetSizer()->Fit(this);
SetName("uisettingsdlg");
WindowAttrManager::Load(this);
}

uisettingsdlg::~uisettingsdlg()
{
WindowAttrManager::Save(this, wxT("CGUiSettingsDlg"), NULL);
}
uisettingsdlg::~uisettingsdlg() {}

void uisettingsdlg::OnButton_click_select_gprof( wxCommandEvent& event )
void uisettingsdlg::OnButton_click_select_gprof(wxCommandEvent& event)
{
wxUnusedVar(event);
wxString new_gprof_path = wxFileSelector(_("Select gprof..."), m_textCtrl_path_gprof->GetValue().c_str(), wxT(""), wxT(""), wxFileSelectorDefaultWildcardStr, 0, this);
if (!new_gprof_path.IsEmpty()) {
m_textCtrl_path_gprof->SetValue(new_gprof_path);
}
wxUnusedVar(event);
wxString new_gprof_path = wxFileSelector(_("Select gprof..."),
m_textCtrl_path_gprof->GetValue().c_str(),
wxT(""),
wxT(""),
wxFileSelectorDefaultWildcardStr,
0,
this);
if(!new_gprof_path.IsEmpty()) {
m_textCtrl_path_gprof->SetValue(new_gprof_path);
}
}

void uisettingsdlg::OnButton_click_select_dot( wxCommandEvent& event )
void uisettingsdlg::OnButton_click_select_dot(wxCommandEvent& event)
{
wxUnusedVar(event);
wxString new_dot_path = wxFileSelector(_("Select dot..."), m_textCtrl_path_dot->GetValue().c_str(), wxT(""), wxT(""), wxFileSelectorDefaultWildcardStr, 0, this);
if (!new_dot_path.IsEmpty()) {
m_textCtrl_path_dot->SetValue(new_dot_path);
}
wxUnusedVar(event);
wxString new_dot_path = wxFileSelector(_("Select dot..."),
m_textCtrl_path_dot->GetValue().c_str(),
wxT(""),
wxT(""),
wxFileSelectorDefaultWildcardStr,
0,
this);
if(!new_dot_path.IsEmpty()) {
m_textCtrl_path_dot->SetValue(new_dot_path);
}
}

void uisettingsdlg::OnButton_click_ok( wxCommandEvent& event )
void uisettingsdlg::OnButton_click_ok(wxCommandEvent& event)
{
wxUnusedVar(event);
// store values
//ConfCallGraph confData;
confData.SetGprofPath(m_textCtrl_path_gprof->GetValue());
confData.SetDotPath(m_textCtrl_path_dot->GetValue());
confData.SetTresholdNode(m_spinCtrl_treshold_node->GetValue());
confData.SetTresholdEdge(m_spinCtrl_treshold_edge->GetValue());
confData.SetColorsEdge(m_spinCtrl_colors_edge->GetValue());
confData.SetColorsNode(m_spinCtrl_colors_node->GetValue());
confData.SetHideParams(m_checkBox_Names->GetValue());
confData.SetHideNamespaces(m_checkBox_Namespaces->GetValue());
confData.SetStripParams(m_checkBox_Parameters->GetValue());
m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);
wxUnusedVar(event);
// store values
// ConfCallGraph confData;
confData.SetGprofPath(m_textCtrl_path_gprof->GetValue());
confData.SetDotPath(m_textCtrl_path_dot->GetValue());
confData.SetTresholdNode(m_spinCtrl_treshold_node->GetValue());
confData.SetTresholdEdge(m_spinCtrl_treshold_edge->GetValue());
confData.SetColorsEdge(m_spinCtrl_colors_edge->GetValue());
confData.SetColorsNode(m_spinCtrl_colors_node->GetValue());
confData.SetHideParams(m_checkBox_Names->GetValue());
confData.SetHideNamespaces(m_checkBox_Namespaces->GetValue());
confData.SetStripParams(m_checkBox_Parameters->GetValue());

m_mgr->GetConfigTool()->WriteObject(wxT("CallGraph"), &confData);

if ((wxFileExists(m_textCtrl_path_gprof->GetValue())) && (wxFileExists(m_textCtrl_path_dot->GetValue()))) {
EndModal(wxID_OK);
} else {
wxMessageBox(_("Please check the external tools' paths settings."), wxT("CallGraph"), wxOK | wxICON_ERROR, m_mgr->GetTheApp()->GetTopWindow());
}
if((wxFileExists(m_textCtrl_path_gprof->GetValue())) && (wxFileExists(m_textCtrl_path_dot->GetValue()))) {
EndModal(wxID_OK);
} else {
wxMessageBox(_("Please check the external tools' paths settings."),
wxT("CallGraph"),
wxOK | wxICON_ERROR,
m_mgr->GetTheApp()->GetTopWindow());
}

//event.Skip();
// event.Skip();
}

void uisettingsdlg::OnButton_click_cancel( wxCommandEvent& event )
void uisettingsdlg::OnButton_click_cancel(wxCommandEvent& event)
{
wxUnusedVar(event);
EndModal(wxID_CANCEL);
wxUnusedVar(event);
EndModal(wxID_CANCEL);
}

void uisettingsdlg::OnCheckName(wxCommandEvent& event)
{
if(m_checkBox_Names->IsChecked())
m_checkBox_Parameters->Disable();
else m_checkBox_Parameters->Enable();
if(m_checkBox_Names->IsChecked())
m_checkBox_Parameters->Disable();
else
m_checkBox_Parameters->Enable();
}

void uisettingsdlg::OnCheckParam(wxCommandEvent& event)
{
if(m_checkBox_Parameters->IsChecked())
m_checkBox_Names->Disable();
else m_checkBox_Names->Enable();
if(m_checkBox_Parameters->IsChecked())
m_checkBox_Names->Disable();
else
m_checkBox_Names->Enable();
}
7 changes: 4 additions & 3 deletions CodeFormatter/codeformatterdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ CodeFormatterDlg::CodeFormatterDlg(wxWindow* parent,
} else {
m_treebook->SetSelection(0);
}

WindowAttrManager::Load(this, wxT("CodeFormatterDlgAttr"), m_cf->GetManager()->GetConfigTool());

SetName("CodeFormatterDlg");
WindowAttrManager::Load(this);
}

void CodeFormatterDlg::InitDialog()
Expand Down Expand Up @@ -246,7 +247,7 @@ void CodeFormatterDlg::UpdatePreview()

CodeFormatterDlg::~CodeFormatterDlg()
{
WindowAttrManager::Save(this, wxT("CodeFormatterDlgAttr"), m_cf->GetManager()->GetConfigTool());

}

void CodeFormatterDlg::OnApplyUI(wxUpdateUIEvent& event) { event.Enable(m_isDirty); }
Expand Down
Loading

0 comments on commit 480be91

Please sign in to comment.