File: CompilerMainPage.h

package info (click to toggle)
codelite 12.0+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 95,112 kB
  • sloc: cpp: 424,040; ansic: 18,284; php: 9,569; lex: 4,186; yacc: 2,820; python: 2,294; sh: 312; makefile: 51; xml: 13
file content (192 lines) | stat: -rw-r--r-- 6,954 bytes parent folder | download | duplicates (2)
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright            : (C) 2014 Eran Ifrah
// file name            : CompilerMainPage.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 COMPILERMAINPAGE_H
#define COMPILERMAINPAGE_H

#include "compiler_pages.h"
#include "compiler.h"

// =================--------------------
// Helper classes
// =================--------------------
class CompilerPatternDlg : public CompilerPatternDlgBase
{
public:
    CompilerPatternDlg(wxWindow* parent, const wxString& title);
    virtual ~CompilerPatternDlg();

    void
    SetPattern(const wxString& pattern, const wxString& lineIdx, const wxString& fileIdx, const wxString& columnIndex);

protected:
    virtual void OnSubmit(wxCommandEvent& event);

public:
    wxString GetPattern() const { return m_textPattern->GetValue(); }
    wxString GetFileIndex() const { return m_textFileIndex->GetValue(); }
    wxString GetLineIndex() const { return m_textLineNumber->GetValue(); }
    wxString GetColumnIndex() const { return m_textColumn->GetValue(); }
};

/** Implementing CompilerOptionDlgBase */
class CompilerOptionDialog : public CompilerOptionDlgBase
{
public:
    CompilerOptionDialog(wxWindow* parent,
                         const wxString& title,
                         const wxString& name,
                         const wxString& help,
                         wxWindowID id = wxID_ANY)
        : CompilerOptionDlgBase(parent, id, title)
    {
        m_textCtrl18->ChangeValue(name);
        m_textCtrl19->ChangeValue(help);
    }

    wxString GetName() const { return m_textCtrl18->GetValue(); }

    wxString GetHelp() const { return m_textCtrl19->GetValue(); }
};

class CompilerCompilerOptionDialog : public CompilerOptionDialog
{
public:
    CompilerCompilerOptionDialog(wxWindow* parent, const wxString& name, const wxString& help)
        : CompilerOptionDialog(parent, _("Compiler option"), name, help)
    {
    }
};

class CompilerLinkerOptionDialog : public CompilerOptionDialog
{
public:
    CompilerLinkerOptionDialog(wxWindow* parent, const wxString& name, const wxString& help)
        : CompilerOptionDialog(parent, _("Linker option"), name, help)
    {
    }
};

// ================------------------------------
// Compiler configuration page
// ================------------------------------

class CompilerMainPage : public CompilerMainPageBase
{
    bool m_isDirty;
    CompilerPtr m_compiler;
    wxString m_selSwitchName;
    wxString m_selSwitchValue;
    long m_selectedFileType;
    long m_selectedCmpOption;
    long m_selectedLnkOption;

protected:
    virtual void OnAddExistingCompiler(wxCommandEvent& event);
    virtual void OnCloneCompiler(wxCommandEvent& event);
    virtual void OnScanCompilers(wxCommandEvent& event);
    virtual void OnCmdModify(wxCommandEvent& event);
    virtual void OnValueChanged(wxPropertyGridEvent& event);
    virtual void OnRenameCompiler(wxCommandEvent& event);
    virtual void OnDeleteCompiler(wxCommandEvent& event);
    virtual void OnContextMenu(wxContextMenuEvent& event);
    virtual void OnCompilerSelected(wxCommandEvent& event);
    void Initialize();

    // Tools
    void InitializeTools();
    void SaveTools();

    // Patterns
    void InitializePatterns();
    void SavePatterns();
    void DoUpdateErrPattern(long item);
    void DoUpdateWarnPattern(long item);

    // Compiler Switches
    void AddSwitch(const wxString& name, const wxString& value, bool choose);
    void EditSwitch();
    void SaveSwitches();
    void InitializeSwitches();

    // File Types
    void InitializeFileTypes();
    void SaveFileTypes();

    // Advanced page
    void InitializeAdvancePage();
    void SaveAdvancedPage();

    // Compiler options
    void InitializeCompilerOptions();
    void SaveComilerOptions();

    // Compiler options
    void InitializeLinkerOptions();
    void SaveLinkerOptions();

    void LoadCompiler(const wxString& compilerName);

public:
    CompilerMainPage(wxWindow* parent);
    virtual ~CompilerMainPage();
    void LoadCompilers();
    void Save();

    bool IsDirty() const { return m_isDirty; }

protected:
    virtual void OnBtnAddErrPattern(wxCommandEvent& event);
    virtual void OnBtnAddWarnPattern(wxCommandEvent& event);
    virtual void OnBtnDelErrPattern(wxCommandEvent& event);
    virtual void OnBtnDelWarnPattern(wxCommandEvent& event);
    virtual void OnBtnUpdateErrPattern(wxCommandEvent& event);
    virtual void OnBtnUpdateWarnPattern(wxCommandEvent& event);
    virtual void OnCompilerOptionActivated(wxListEvent& event);
    virtual void OnCompilerOptionDeSelected(wxListEvent& event);
    virtual void OnCompilerOptionSelected(wxListEvent& event);
    virtual void OnCustomEditorButtonClicked(wxCommandEvent& event);
    virtual void OnDeleteCompilerOption(wxCommandEvent& event);
    virtual void OnDeleteFileType(wxCommandEvent& event);
    virtual void OnDeleteLinkerOption(wxCommandEvent& event);
    virtual void OnEditIncludePaths(wxCommandEvent& event);
    virtual void OnEditLibraryPaths(wxCommandEvent& event);
    virtual void OnErrItemActivated(wxListEvent& event);
    virtual void OnErrorPatternSelectedUI(wxUpdateUIEvent& event);
    virtual void OnFileTypeActivated(wxListEvent& event);
    virtual void OnFileTypeDeSelected(wxListEvent& event);
    virtual void OnFileTypeSelected(wxListEvent& event);
    virtual void OnItemActivated(wxListEvent& event);
    virtual void OnItemSelected(wxListEvent& event);
    virtual void OnLinkerOptionActivated(wxListEvent& event);
    virtual void OnLinkerOptionDeSelected(wxListEvent& event);
    virtual void OnLinkerOptionSelected(wxListEvent& event);
    virtual void OnNewCompilerOption(wxCommandEvent& event);
    virtual void OnNewFileType(wxCommandEvent& event);
    virtual void OnNewLinkerOption(wxCommandEvent& event);
    virtual void OnWarnItemActivated(wxListEvent& event);
    virtual void OnWarningPatternSelectedUI(wxUpdateUIEvent& event);
};
#endif // COMPILERMAINPAGE_H