1
/***************************************************************
3
* Purpose: Code::Blocks plugin
4
* Author: Daniel Anselmi (danselmi@NOSPAM@gmx.ch)
6
* Copyright: Daniel Anselmi
8
**************************************************************/
10
#ifndef CSCOPE_H_INCLUDED
11
#define CSCOPE_H_INCLUDED
13
// For compilers that support precompilation, includes <wx/wx.h>
14
#include <wx/wxprec.h>
22
#include <cbplugin.h> // for "class cbPlugin"
28
class CscopeParserThread;
31
class CscopePlugin : public cbPlugin
37
virtual ~CscopePlugin();
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.
44
virtual int GetConfigurationPriority() const { return 50; }
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".
50
virtual int GetConfigurationGroup() const { return cgUnknown; }
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.
56
virtual cbConfigurationPanel* GetConfigurationPanel(wxWindow* /*parent*/){ return 0; }
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.
65
virtual cbConfigurationPanel* GetProjectConfigurationPanel(wxWindow* /*parent*/, cbProject* /*project*/){ return 0; }
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,
72
* @param menuBar the wxMenuBar to create items in
74
virtual void BuildMenu(wxMenuBar* /*menuBar*/){}
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,
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)
91
virtual void BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data = 0);
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,
98
* @param toolBar the wxToolBar to create items on
99
* @return The plugin should return true if it needed the toolbar, false if not
101
virtual bool BuildToolBar(wxToolBar* /*toolBar*/){return false;}
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...
113
virtual void OnAttach();
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...
124
virtual void OnRelease(bool appShutDown);
127
void OnProcessGeneratedOutputLine(const wxString &line);
130
void MakeOutputPaneVisible();
132
wxString GetWordAtCaret();
133
void ClearOutputWindow();
134
bool CreateListFile(wxString &list_file);
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);
146
wxArrayString m_CscouptOutput;
152
CscopeProcess *m_pProcess;
153
CscopeParserThread *m_thrd;
155
DECLARE_EVENT_TABLE();
158
#endif // CSCOPE_H_INCLUDED