Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DoxyBlocks Class Reference

The main plug-in application class. More...

#include <DoxyBlocks.h>

Collaboration diagram for DoxyBlocks:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DoxyBlocks ()
virtual ~DoxyBlocks ()
virtual int Configure ()
virtual int GetConfigurationPriority () const
virtual int GetConfigurationGroup () const
virtual cbConfigurationPanel * GetConfigurationPanel (wxWindow *parent)
virtual cbConfigurationPanel * GetProjectConfigurationPanel (wxWindow *parent, cbProject *project)
virtual void BuildMenu (wxMenuBar *menuBar)
virtual void BuildModuleMenu (const ModuleType type, wxMenu *menu, const FileTreeData *data=0)
virtual bool BuildToolBar (wxToolBar *toolBar)
void OnDialogueDone (ConfigPanel *pDlg)
 Save prefs before the dialogue closes.

Protected Member Functions

virtual void OnAttach ()
virtual void OnRelease (bool appShutDown)

Private Member Functions

bool RunDoxywizard (void)
 Run doxywizard. Load the project's doxyfile, if one exists.
void BlockComment (void)
 Insert a comment block at the current line.
void LineComment (void)
 Insert an inline comment at the current cursor position.
void ExtractProject ()
 Extract and compile documentation for the currently active project.
void WriteConfigFiles (cbProject *prj, wxString sPrjName, wxString sPrjPath, wxString sDoxygenDir, wxFileName fnDoxyfile, wxFileName fnDoxygenLog)
 Write the doxygen configuration and log files.
int GenerateDocuments (cbProject *prj)
 Manage the generation of the doxygen configuration and log files.
void AppendToLog (const wxString &sText, int flag=LOG_NORMAL, bool bReturnFocus=true) const
 Append a message to DoxyBlocks' log window.
bool IsProjectOpen () const
 Check whether a project is open.
wxString GetInputList (cbProject *prj, wxFileName fnDoxyfile)
 Get the list of input files for the doxygen configuration file.
void RunHTML ()
 Run the HTML documentation.
void RunCHM ()
 Get parameters and call RunCompiledHelp() to run the Compiled Help documentation.
void RunCompiledHelp (wxString sDocPath, wxString sPrjName)
 Run the Compiled Help documentation.
wxString GetDocPath () const
 Get the document path.
wxString GetProjectName ()
 Get the project name.
void GetBlockCommentStrings (int iBlockComment, wxString &sStartComment, wxString &sMidComment, wxString &sEndComment)
 Initialise the comment structure strings to the selected style.
void StartComment (cbStyledTextCtrl *control, int &iPos, int iBlockComment, wxString sStartComment, wxString sMidComment, wxString sTagBrief, wxString sIndent)
 Insert the tags that begin a comment block in the selected style.
void CommentFunction (cbStyledTextCtrl *control, int &iPos, wxString sMidComment, wxString sTagParam, wxString sTagReturn, wxString sIndent, wxString sParams, wxString sReturn, wxString sFunction)
 Add comment lines for a function's parameters and return type in the selected style.
void AddCommentLine (cbStyledTextCtrl *control, int &iPos, wxString sText)
 Add a line to a comment block in the selected style.
wxString ProcessReturnString (wxString sReturn, wxString sFunction)
void CheckForAutoVersioning ()
 Check whether the AutoVersioning plug-in is active.
wxString GetAutoVersion ()
 Get the Autoversion string.
void OnProjectActivate (CodeBlocksEvent &event)
 Hooks the IDE's project activated event.
void OnEditorOpen (CodeBlocksEvent &event)
 Hooks the editor open event.
void OnEditorClose (CodeBlocksEvent &event)
 Hooks the editor close event.
void OnUpdateUI (wxUpdateUIEvent &event)
 An UPDATE_UI event was raised.
void OnTextURL (wxTextUrlEvent &event)
 A URL was clicked in the log window.
void LoadSettings ()
 Load configuration settings.
void SaveSettings ()
 Save configuration settings.
wxString ValidateRelativePath (wxString path)
 Validate the doxygen sub-directory name, removing dots, slashes, colons and tildes.
void ReadPrefsTemplate ()
 Read the settings template.
void WritePrefsTemplate ()
 Write the settings template.
 DECLARE_EVENT_TABLE ()
 Declare the event table.

Private Attributes

wxToolBar * m_pToolbar
 The plug-in toolbar.
DoxyBlocksLoggerm_DoxyBlocksLog
 The log tab in the message pane.
int m_LogPageIndex
 The index of the log tab.
bool m_bAutoVersioning
 Whether Autoversioning is active for the current project.
wxString m_sAutoVersion
 The autoversion string - MAJOR.MINOR.BUILD.
wxString m_sVersionHeader
 The Autoversion header path for the current project.
DoxyBlocksConfigm_pConfig
 Configuration object.

Detailed Description

The main plug-in application class.


Constructor & Destructor Documentation

DoxyBlocks::DoxyBlocks (  ) 

Constructor.

DoxyBlocks::~DoxyBlocks (  )  [virtual]

Destructor.


Member Function Documentation

void DoxyBlocks::AddCommentLine ( cbStyledTextCtrl *  control,
int &  iPos,
wxString  sText 
) [private]

Add a line to a comment block in the selected style.

Parameters:
control cbStyledTextCtrl* The editor's wxStyledTextControl.
iPos int& The current editor position.
sText wxString The text to add to the comment block.
Returns:
void
void DoxyBlocks::AppendToLog ( const wxString &  sText,
int  flag = LOG_NORMAL,
bool  bReturnFocus = true 
) const [private]

Append a message to DoxyBlocks' log window.

Parameters:
sText wxString& The text to display.
flag int A flag controlling the entry's style. Defaults to LOG_NORMAL.
bReturnFocus bool Whether to return the focus to the editor window after logging.

The style flags are:

  • LOG_NORMAL - normal text
  • LOG_WARNING - italic text
  • LOG_ERROR - bold red text
void DoxyBlocks::BuildMenu ( wxMenuBar *  menuBar  )  [virtual]

This method is called by Code::Blocks and is used by the plugin to add any menu items it needs on Code::Blocks's menu bar.
It is a pure virtual method that needs to be implemented by all plugins. If the plugin does not need to add items on the menu, just do nothing ;)

Parameters:
menuBar the wxMenuBar to create items in

Here is the call graph for this function:

void DoxyBlocks::BuildModuleMenu ( const ModuleType  type,
wxMenu *  menu,
const FileTreeData *  data = 0 
) [virtual]

This method is called by Code::Blocks core modules (EditorManager, ProjectManager etc) and is used by the plugin to add any menu items it needs in the module's popup menu. For example, when the user right-clicks on a project file in the project tree, ProjectManager prepares a popup menu to display with context sensitive options for that file. Before it displays this popup menu, it asks all attached plugins (by asking PluginManager to call this method), if they need to add any entries in that menu. This method is called.
If the plugin does not need to add items in the menu, just do nothing ;)

Parameters:
type the module that's preparing a popup menu
menu pointer to the popup menu
data pointer to FileTreeData object (to access/modify the file tree)
bool DoxyBlocks::BuildToolBar ( wxToolBar *  toolBar  )  [virtual]

This method is called by Code::Blocks and is used by the plugin to add any toolbar items it needs on Code::Blocks's toolbar.
It is a pure virtual method that needs to be implemented by all plugins. If the plugin does not need to add items on the toolbar, just do nothing ;)

Parameters:
toolBar the wxToolBar to create items on
Returns:
The plugin should return true if it needed the toolbar, false if not

Here is the call graph for this function:

void DoxyBlocks::CheckForAutoVersioning (  )  [private]

Check whether the AutoVersioning plug-in is active.

This function iterates over the Extensions node of the project's .cbp file looking for the AutoVersioning node. It is run on project activation and sets the global flag bAutoVersioning.

Here is the call graph for this function:

void DoxyBlocks::CommentFunction ( cbStyledTextCtrl *  control,
int &  iPos,
wxString  sMidComment,
wxString  sTagParam,
wxString  sTagReturn,
wxString  sIndent,
wxString  sParams,
wxString  sReturn,
wxString  sFunction 
) [private]

Add comment lines for a function's parameters and return type in the selected style.

Parameters:
control cbStyledTextCtrl* The editor's wxStyledTextControl.
iPos int& The current editor position.
sMidComment wxString The comment tag that starts each line in a block.
sTagParam wxString The doxygen tag for a parameter description.
sTagReturn wxString The doxygen tag for a return value description.
sIndent wxString A string of spaces matching the function's indent level.
sFunction wxString A string containing the the name of the function being documented.
sParams wxString A string containing the parameters of the function being documented.
sReturn wxString A string containing the return type of the function being documented.
Returns:
void

Here is the call graph for this function:

int DoxyBlocks::Configure (  )  [virtual]

Invoke configuration dialog.

Returns:
The configuration dialogue's return value.

Here is the call graph for this function:

int DoxyBlocks::GenerateDocuments ( cbProject *  prj  )  [private]

Manage the generation of the doxygen configuration and log files.

Parameters:
prj cbProject* The project.
Returns:
int 0 on success, -1 on failure.

Here is the call graph for this function:

wxString DoxyBlocks::GetAutoVersion (  )  [private]

Get the Autoversion string.

Returns:
wxString Version string in the form MAJOR.MINOR.BUILD.

Here is the call graph for this function:

void DoxyBlocks::GetBlockCommentStrings ( int  iBlockComment,
wxString &  sStartComment,
wxString &  sMidComment,
wxString &  sEndComment 
) [private]

Initialise the comment structure strings to the selected style.

Parameters:
iBlockComment int The selected comment style.
sStartComment wxString The comment tag that starts a block.
sMidComment wxString The comment tag that starts each line in a block.
sEndComment wxString& The comment tag that ends a block.
Returns:
void
virtual int DoxyBlocks::GetConfigurationGroup (  )  const [inline, virtual]

Return the configuration group for this plugin. Default is cgUnknown. Notice that you can logically OR more than one configuration groups, so you could set it, for example, as "cgCompiler | cgContribPlugin".

Returns:
The configuration group.
cbConfigurationPanel * DoxyBlocks::GetConfigurationPanel ( wxWindow *  parent  )  [virtual]

Return plugin's configuration panel.

Parameters:
parent The parent window.
Returns:
A pointer to the plugin's cbConfigurationPanel. It is deleted by the caller.
virtual int DoxyBlocks::GetConfigurationPriority (  )  const [inline, virtual]

Return the plugin's configuration priority. This is a number (default is 50) that is used to sort plugins in configuration dialogs. Lower numbers mean the plugin's configuration is put higher in the list.

Returns:
The plugin's configuration priority.
wxString DoxyBlocks::GetDocPath (  )  const [private]

Get the document path.

Returns:
wxString The document path.

Here is the call graph for this function:

wxString DoxyBlocks::GetInputList ( cbProject *  prj,
wxFileName  fnDoxyfile 
) [private]

Get the list of input files for the doxygen configuration file.

Parameters:
prj cbProject* The project.
fnDoxyfile wxFileName Doxyfile filename object.
Returns:
wxString The input file list.

This function queries the cbProject object for a list of files actually attached to the project. Other files in the project directory are ignored.

cbConfigurationPanel * DoxyBlocks::GetProjectConfigurationPanel ( wxWindow *  parent,
cbProject *  project 
) [virtual]

Return plugin's configuration panel for projects. The panel returned from this function will be added in the project's configuration dialog.

Parameters:
parent The parent window.
project The project that is being edited.
Returns:
A pointer to the plugin's cbConfigurationPanel. It is deleted by the caller.
Note:
This function's body was moved to Doxygen.cpp to prevent the disabled variables causing warnings in doxygen. Warnings will occur if there is a single declaration/implementation and variables are disabled, as doxygen can't find them.
wxString DoxyBlocks::GetProjectName (  )  [private]

Get the project name.

Returns:
wxString The project name.
bool DoxyBlocks::IsProjectOpen (  )  const [private]

Check whether a project is open.

Returns:
bool true if a project is open, false otherwise.

Here is the call graph for this function:

void DoxyBlocks::LoadSettings (  )  [private]

Load configuration settings.

Returns:
void

Here is the call graph for this function:

void DoxyBlocks::OnAttach (  )  [protected, virtual]

Any descendent plugin should override this virtual method and perform any necessary initialization. This method is called by Code::Blocks (PluginManager actually) when the plugin has been loaded and should attach in Code::Blocks. When Code::Blocks starts up, it finds and loads all plugins but does not activate (attaches) them. It then activates all plugins that the user has selected to be activated on start-up.
This means that a plugin might be loaded but not activated...
Think of this method as the actual constructor...

Here is the call graph for this function:

void DoxyBlocks::OnDialogueDone ( ConfigPanel pDlg  ) 

Save prefs before the dialogue closes.

Parameters:
pDlg ConfigPanel* DoxyBlocks' configuration panel.
Returns:
void
void DoxyBlocks::OnEditorClose ( CodeBlocksEvent &  event  )  [private]

Hooks the editor close event.

Parameters:
event CodeBlocksEvent& A CodeBlocks event object.
Returns:
void

Checks that there is at least one editor window open and disables the comment menu items and toolbar buttons if not.

void DoxyBlocks::OnEditorOpen ( CodeBlocksEvent &  event  )  [private]

Hooks the editor open event.

Parameters:
event CodeBlocksEvent& A CodeBlocks event object.
Returns:
void

Checks that there is at least one editor window open and enables the comment menu items and toolbar buttons if so.

void DoxyBlocks::OnProjectActivate ( CodeBlocksEvent &  event  )  [private]

Hooks the IDE's project activated event.

Parameters:
event CodeBlocksEvent& A CodeBlocks event object.
Returns:
void

Checks whether AutoVersioning is active for the activated project. Loads settings and inits the config object. Enables/disables toolbar and menu items.

Here is the call graph for this function:

void DoxyBlocks::OnRelease ( bool  appShutDown  )  [protected, virtual]

Any descendent plugin should override this virtual method and perform any necessary de-initialization. This method is called by Code::Blocks (PluginManager actually) when the plugin has been loaded, attached and should de-attach from Code::Blocks.
Think of this method as the actual destructor...

Parameters:
appShutDown If true, the application is shutting down. In this case *don't* use Manager::Get()->Get...() functions or the behaviour is undefined...
void DoxyBlocks::OnTextURL ( wxTextUrlEvent &  event  )  [private]

A URL was clicked in the log window.

Parameters:
event wxTextUrlEvent& The event object.
Returns:
void

Here is the call graph for this function:

void DoxyBlocks::OnUpdateUI ( wxUpdateUIEvent &  event  )  [private]

An UPDATE_UI event was raised.

Parameters:
event CodeBlocksEvent& A CodeBlocks event object.
Returns:
void

Enables/disables the menu and toolbar items accordingly.

wxString DoxyBlocks::ProcessReturnString ( wxString  sReturn,
wxString  sFunction 
) [private]
Parameters:
sReturn wxString Return statement string.
sFunction wxString Function name string.
Returns:
wxString The processed return string.

This function strips the keywords "static" and "inline" from the return statement and formats the rest, processing *, ** and & symbols so that the symbol follows the type name.

void DoxyBlocks::ReadPrefsTemplate (  )  [private]

Read the settings template.

Returns:
void

Here is the call graph for this function:

void DoxyBlocks::RunCompiledHelp ( wxString  sDocPath,
wxString  sPrjName 
) [private]

Run the Compiled Help documentation.

Parameters:
sDocPath wxString The path to the CHM file.
sPrjName wxString The path to the project.

Here is the call graph for this function:

bool DoxyBlocks::RunDoxywizard ( void   )  [private]

Run doxywizard. Load the project's doxyfile, if one exists.

Returns:
bool true on success, otherwise false.

Here is the call graph for this function:

void DoxyBlocks::RunHTML (  )  [private]

Run the HTML documentation.

This function checks configuration settings and either runs the HTML in the internal viewer or the default browser.

Here is the call graph for this function:

void DoxyBlocks::SaveSettings (  )  [private]

Save configuration settings.

Returns:
void

Settings that might change between projects are stored in the project file. Global settings are stored in C::B's config tree. Default values are not written.

Todo:
(Gary#3#): There's probably a more elegant way to avoid writing default vals.

Here is the call graph for this function:

void DoxyBlocks::StartComment ( cbStyledTextCtrl *  control,
int &  iPos,
int  iBlockComment,
wxString  sStartComment,
wxString  sMidComment,
wxString  sTagBrief,
wxString  sIndent 
) [private]

Insert the tags that begin a comment block in the selected style.

Parameters:
control cbStyledTextCtrl* The editor's wxStyledTextControl.
iPos int& The current editor position.
iBlockComment int The selected comment style.
sStartComment wxString The comment tag that starts a block.
sMidComment wxString The comment tag that starts each line in a block.
sTagBrief wxString The doxygen tag for a brief description.
sIndent wxString A string of spaces matching the function's indent level.
Returns:
void
wxString DoxyBlocks::ValidateRelativePath ( wxString  path  )  [private]

Validate the doxygen sub-directory name, removing dots, slashes, colons and tildes.

Parameters:
path wxString The string to validate.
Returns:
wxString
void DoxyBlocks::WriteConfigFiles ( cbProject *  prj,
wxString  sPrjName,
wxString  sPrjPath,
wxString  sDoxygenDir,
wxFileName  fnDoxyfile,
wxFileName  fnDoxygenLog 
) [private]

Write the doxygen configuration and log files.

Parameters:
prj cbProject* The project.
sPrjName wxString The project's name.
sPrjPath wxString The path to the project.
sDoxygenDir wxString The relative path to the doxygen files.
fnDoxyfile wxFileName Doxyfile filename object.
fnDoxygenLog wxFileName Doxygen log filename object.

TODO (Gary#1#): I should look at other macros for inclusion here.

Here is the call graph for this function:

void DoxyBlocks::WritePrefsTemplate (  )  [private]

Write the settings template.

Returns:
void

Here is the call graph for this function:


The documentation for this class was generated from the following files: