~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/plugins/contrib/Cscope/CscopePlugin.h

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************
 
2
 * Name:      Cscope
 
3
 * Purpose:   Code::Blocks plugin
 
4
 * Author:    Daniel Anselmi (danselmi@NOSPAM@gmx.ch)
 
5
 * Created:   2009-09-15
 
6
 * Copyright: Daniel Anselmi
 
7
 * License:   GPL
 
8
 **************************************************************/
 
9
 
 
10
#ifndef CSCOPE_H_INCLUDED
 
11
#define CSCOPE_H_INCLUDED
 
12
 
 
13
// For compilers that support precompilation, includes <wx/wx.h>
 
14
#include <wx/wxprec.h>
 
15
 
 
16
#ifndef WX_PRECOMP
 
17
    #include <wx/wx.h>
 
18
#endif
 
19
#include <wx/timer.h>
 
20
 
 
21
 
 
22
#include <cbplugin.h> // for "class cbPlugin"
 
23
 
 
24
#include <queue>
 
25
 
 
26
class CscopeConfig;
 
27
class CscopeView;
 
28
class CscopeParserThread;
 
29
class CscopeProcess;
 
30
 
 
31
class CscopePlugin : public cbPlugin
 
32
{
 
33
    public:
 
34
        /** Constructor. */
 
35
        CscopePlugin();
 
36
        /** Destructor. */
 
37
        virtual ~CscopePlugin();
 
38
 
 
39
        /** Return the plugin's configuration priority.
 
40
          * This is a number (default is 50) that is used to sort plugins
 
41
          * in configuration dialogs. Lower numbers mean the plugin's
 
42
          * configuration is put higher in the list.
 
43
          */
 
44
        virtual int GetConfigurationPriority() const { return 50; }
 
45
 
 
46
        /** Return the configuration group for this plugin. Default is cgUnknown.
 
47
          * Notice that you can logically OR more than one configuration groups,
 
48
          * so you could set it, for example, as "cgCompiler | cgContribPlugin".
 
49
          */
 
50
        virtual int GetConfigurationGroup() const { return cgUnknown; }
 
51
 
 
52
        /** Return plugin's configuration panel.
 
53
          * @param parent The parent window.
 
54
          * @return A pointer to the plugin's cbConfigurationPanel. It is deleted by the caller.
 
55
          */
 
56
        virtual cbConfigurationPanel* GetConfigurationPanel(wxWindow* /*parent*/){ return 0; }
 
57
 
 
58
        /** Return plugin's configuration panel for projects.
 
59
          * The panel returned from this function will be added in the project's
 
60
          * configuration dialog.
 
61
          * @param parent The parent window.
 
62
          * @param project The project that is being edited.
 
63
          * @return A pointer to the plugin's cbConfigurationPanel. It is deleted by the caller.
 
64
          */
 
65
        virtual cbConfigurationPanel* GetProjectConfigurationPanel(wxWindow* /*parent*/, cbProject* /*project*/){ return 0; }
 
66
 
 
67
        /** This method is called by Code::Blocks and is used by the plugin
 
68
          * to add any menu items it needs on Code::Blocks's menu bar.\n
 
69
          * It is a pure virtual method that needs to be implemented by all
 
70
          * plugins. If the plugin does not need to add items on the menu,
 
71
          * just do nothing ;)
 
72
          * @param menuBar the wxMenuBar to create items in
 
73
          */
 
74
        virtual void BuildMenu(wxMenuBar* /*menuBar*/){}
 
75
 
 
76
        /** This method is called by Code::Blocks core modules (EditorManager,
 
77
          * ProjectManager etc) and is used by the plugin to add any menu
 
78
          * items it needs in the module's popup menu. For example, when
 
79
          * the user right-clicks on a project file in the project tree,
 
80
          * ProjectManager prepares a popup menu to display with context
 
81
          * sensitive options for that file. Before it displays this popup
 
82
          * menu, it asks all attached plugins (by asking PluginManager to call
 
83
          * this method), if they need to add any entries
 
84
          * in that menu. This method is called.\n
 
85
          * If the plugin does not need to add items in the menu,
 
86
          * just do nothing ;)
 
87
          * @param type the module that's preparing a popup menu
 
88
          * @param menu pointer to the popup menu
 
89
          * @param data pointer to FileTreeData object (to access/modify the file tree)
 
90
          */
 
91
        virtual void BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data = 0);
 
92
 
 
93
        /** This method is called by Code::Blocks and is used by the plugin
 
94
          * to add any toolbar items it needs on Code::Blocks's toolbar.\n
 
95
          * It is a pure virtual method that needs to be implemented by all
 
96
          * plugins. If the plugin does not need to add items on the toolbar,
 
97
          * just do nothing ;)
 
98
          * @param toolBar the wxToolBar to create items on
 
99
          * @return The plugin should return true if it needed the toolbar, false if not
 
100
          */
 
101
        virtual bool BuildToolBar(wxToolBar* /*toolBar*/){return false;}
 
102
    protected:
 
103
        /** Any descendent plugin should override this virtual method and
 
104
          * perform any necessary initialization. This method is called by
 
105
          * Code::Blocks (PluginManager actually) when the plugin has been
 
106
          * loaded and should attach in Code::Blocks. When Code::Blocks
 
107
          * starts up, it finds and <em>loads</em> all plugins but <em>does
 
108
          * not</em> activate (attaches) them. It then activates all plugins
 
109
          * that the user has selected to be activated on start-up.\n
 
110
          * This means that a plugin might be loaded but <b>not</b> activated...\n
 
111
          * Think of this method as the actual constructor...
 
112
          */
 
113
        virtual void OnAttach();
 
114
 
 
115
        /** Any descendent plugin should override this virtual method and
 
116
          * perform any necessary de-initialization. This method is called by
 
117
          * Code::Blocks (PluginManager actually) when the plugin has been
 
118
          * loaded, attached and should de-attach from Code::Blocks.\n
 
119
          * Think of this method as the actual destructor...
 
120
          * @param appShutDown If true, the application is shutting down. In this
 
121
          *         case *don't* use Manager::Get()->Get...() functions or the
 
122
          *         behaviour is undefined...
 
123
          */
 
124
        virtual void OnRelease(bool appShutDown);
 
125
 
 
126
    public:
 
127
        void OnProcessGeneratedOutputLine(const wxString &line);
 
128
 
 
129
    private:
 
130
        void MakeOutputPaneVisible();
 
131
 
 
132
        wxString GetWordAtCaret();
 
133
        void ClearOutputWindow();
 
134
        bool CreateListFile(wxString &list_file);
 
135
 
 
136
        void DoCscopeCommand(const wxString &cmd, const wxString &endMsg);
 
137
        void OnFind(wxCommandEvent &event);
 
138
        wxString GetCscopeBinaryName();
 
139
        void OnParserThreadEnded(wxCommandEvent &event);
 
140
        void OnParserThreadUpdateStatus(wxCommandEvent &e);
 
141
        void OnCscopeUI(wxUpdateUIEvent &event);
 
142
        void OnCscopeReturned(wxProcessEvent &event);
 
143
        void OnIdle(wxIdleEvent& event);
 
144
 
 
145
        wxString m_EndMsg;
 
146
        wxArrayString m_CscouptOutput;
 
147
 
 
148
 
 
149
        CscopeConfig *m_cfg;
 
150
        CscopeView *m_view;
 
151
        int m_ListPageIndex;
 
152
        CscopeProcess *m_pProcess;
 
153
        CscopeParserThread *m_thrd;
 
154
    private:
 
155
        DECLARE_EVENT_TABLE();
 
156
};
 
157
 
 
158
#endif // CSCOPE_H_INCLUDED