1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2008 by Eran Ifrah
// file name : project_settings_dlg.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifndef __project_settings_dlg__
#define __project_settings_dlg__
/**
@file
Subclass of ProjectSettingsBaseDlg, which is generated by wxFormBuilder.
@todo Add your event handlers directly to this file.
*/
#include "clWorkspaceEvent.hpp"
#include "compiler.h"
#include "project_settings.h"
#include "project_settings_base_dlg.h"
class PSGeneralPage;
class ProjectSettingsDlg;
class wxPGProperty;
class WorkspaceTab;
/////////////////////////////////////////////////////////////
// base class for the project settings pages
/////////////////////////////////////////////////////////////
class IProjectSettingsPage
{
public:
IProjectSettingsPage() {}
virtual ~IProjectSettingsPage() {}
virtual void Save(BuildConfigPtr buildConf, ProjectSettingsPtr projSettingsPtr) = 0;
virtual void Load(BuildConfigPtr buildConf) = 0;
virtual void Clear() = 0;
virtual bool PopupAddOptionDlg(wxTextCtrl* ctrl);
virtual bool PopupAddOptionDlg(wxString& value);
virtual bool SelectChoiceWithGlobalSettings(wxChoice* c, const wxString& text);
virtual void SelectChoiceWithGlobalSettings(wxPGProperty* p, const wxString& text);
virtual bool PopupAddOptionCheckDlg(wxTextCtrl* ctrl, const wxString& title,
const Compiler::CmpCmdLineOptions& options);
virtual bool PopupAddOptionCheckDlg(wxString& v, const wxString& title, const Compiler::CmpCmdLineOptions& options);
};
/**
* Implementing GlobalSettingsBasePanel
*/
class GlobalSettingsPanel : public GlobalSettingsBasePanel, public IProjectSettingsPage
{
const wxString& m_projectName;
ProjectSettingsDlg* m_dlg;
PSGeneralPage* m_gp;
public:
GlobalSettingsPanel(wxWindow* parent, const wxString& projectName, ProjectSettingsDlg* dlg, PSGeneralPage* gp);
virtual void Clear();
virtual void Load(BuildConfigPtr buildConf);
virtual void Save(BuildConfigPtr buildConf, ProjectSettingsPtr projSettingsPtr);
protected:
virtual void OnCustomEditorClicked(wxCommandEvent& event);
virtual void OnValueChanged(wxPropertyGridEvent& event);
};
/**
* Implementing ProjectSettingsBaseDlg
*/
class ProjectSettingsDlg : public ProjectSettingsBaseDlg
{
wxString m_projectName;
wxString m_configName;
bool m_isDirty;
bool m_isCustomBuild;
bool m_isProjectEnabled;
WorkspaceTab* m_workspaceTab;
protected:
virtual void OnPageChanged(wxTreebookEvent& event);
void SaveValues();
void ClearValues();
void LoadValues(const wxString& configName);
void BuildTree();
void DoClearDialog();
void DoGetAllBuildConfigs();
public:
virtual void OnButtonCancel(wxCommandEvent& event);
void SetIsProjectEnabled(bool isProjectEnabled) { this->m_isProjectEnabled = isProjectEnabled; }
bool IsProjectEnabled() const { return m_isProjectEnabled; }
bool IsCustomBuildEnabled() const { return m_isCustomBuild; }
void SetCustomBuildEnabled(bool b)
{
if(b != m_isCustomBuild) {
SetIsDirty(true);
}
m_isCustomBuild = b;
}
void SetIsDirty(bool isDirty) { this->m_isDirty = isDirty; }
bool GetIsDirty() const { return m_isDirty; }
/**
* @brief show an info bar at the top of the dialog to indicate that this project is disabled
*/
void ShowHideDisabledMessage();
/**
* @brief show an info bar at the top of dialog to indicate that the options are disabled
*/
void ShowCustomProjectMessage(bool show);
public:
/** Constructor */
ProjectSettingsDlg(wxWindow* parent, WorkspaceTab* workspaceTab, const wxString& configName,
const wxString& projectName, const wxString& title);
virtual ~ProjectSettingsDlg();
const wxString& GetConfigName() const { return m_configName; }
const wxString& GetProjectName() const { return m_projectName; }
DECLARE_EVENT_TABLE()
virtual void OnButtonApply(wxCommandEvent& event);
virtual void OnButtonOK(wxCommandEvent& event);
virtual void OnButtonHelp(wxCommandEvent& e);
virtual void OnButtonApplyUI(wxUpdateUIEvent& event);
virtual void OnConfigurationChanged(wxCommandEvent& event);
virtual void OnProjectSelected(wxCommandEvent& e);
virtual void OnWorkspaceClosed(clWorkspaceEvent& e);
};
#endif // __project_settings_dlg__
|