Code::Blocks  SVN r11506
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
cbSmartIndentPlugin Class Referenceabstract

#include <cbplugin.h>

Inheritance diagram for cbSmartIndentPlugin:
Collaboration diagram for cbSmartIndentPlugin:

Public Member Functions

 cbSmartIndentPlugin ()
 
virtual void OnEditorHook (cbEditor *editor, wxScintillaEvent &event) const =0
 When this is called, the smartIndent mechanism must get to work ;). More...
 
virtual void OnCCDone (cb_unused cbEditor *ed)
 This is called after a code completion operation finishes. More...
 
- Public Member Functions inherited from cbPlugin
 cbPlugin ()
 In default cbPlugin's constructor the associated PluginInfo structure is filled with default values. More...
 
 ~cbPlugin () override
 cbPlugin destructor. More...
 
virtual PluginType GetType () const
 The plugin must return its type on request. More...
 
virtual int GetConfigurationPriority () const
 Return the plugin's configuration priority. More...
 
virtual int GetConfigurationGroup () const
 Return the configuration group for this plugin. More...
 
virtual cbConfigurationPanelGetConfigurationPanel (cb_optional wxWindow *parent)
 Return plugin's configuration panel. More...
 
virtual cbConfigurationPanelGetProjectConfigurationPanel (cb_optional wxWindow *parent, cb_optional cbProject *project)
 Return plugin's configuration panel for projects. More...
 
virtual void BuildMenu (cb_optional wxMenuBar *menuBar)
 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. More...
 
virtual void BuildModuleMenu (cb_optional const ModuleType type, cb_optional wxMenu *menu, cb_optional const FileTreeData *data=nullptr)
 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. More...
 
virtual bool BuildToolBar (cb_optional wxToolBar *toolBar)
 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. More...
 
virtual int GetToolBarPriority ()
 This method return the priority of the plugin's toolbar, the less value indicates a more preceding position when C::B starts with no configuration file. More...
 
virtual void CreateStatusField (cbStatusBar *statusBar)
 This method is called by Code::Blocks and is used by the plugin to add a field on Code::Blocks's statusbar. More...
 
bool IsAttached () const
 See whether this plugin is attached or not. More...
 
virtual bool CanDetach () const
 See whether this plugin can be detached (unloaded) or not. More...
 

Protected Member Functions

void OnAttach () override
 Any descendent plugin should override this virtual method and perform any necessary initialization. More...
 
void OnRelease (bool appShutDown) override
 
wxString GetLastNonCommentWord (cbEditor *ed, int position=-1, unsigned int NumberOfWords=1) const
 (reverse) search for the last word which is not comment More...
 
wxString GetLastNonWhitespaceChars (cbEditor *ed, int position=-1, unsigned int NumberOfChars=1) const
 (reverse) search for the last characters, which are not whitespace and not comment More...
 
wxChar GetLastNonWhitespaceChar (cbEditor *ed, int position=-1) const
 forward search to the next character which is not a whitespace More...
 
wxChar GetNextNonWhitespaceCharOnLine (cbStyledTextCtrl *stc, int position=-1, int *pos=nullptr) const
 
int FindBlockStart (cbStyledTextCtrl *stc, int position, wxChar blockStart, wxChar blockEnd, bool skipNested=true) const
 
int FindBlockStart (cbStyledTextCtrl *stc, int position, wxString blockStart, wxString blockEnd, bool CaseSensitive=true) const
 
void Indent (cbStyledTextCtrl *stc, wxString &indent) const
 
bool Indent (cbStyledTextCtrl *stc, wxString &indent, int posInLine) const
 
int GetFirstBraceInLine (cbStyledTextCtrl *stc, int string_style) const
 Get the first brace in the line according to the line style. More...
 
wxChar GetNextNonWhitespaceCharOfLine (cbStyledTextCtrl *stc, int position=-1, int *pos=nullptr) const
 Get the last non-whitespace character from position in line. More...
 
bool AutoIndentEnabled () const
 
bool SmartIndentEnabled () const
 
bool BraceSmartIndentEnabled () const
 
bool BraceCompletionEnabled () const
 
bool SelectionBraceCompletionEnabled () const
 
void OnCCDoneEvent (CodeBlocksEvent &event)
 
- Protected Member Functions inherited from cbPlugin
virtual void OnRelease (cb_optional bool appShutDown)
 Any descendent plugin should override this virtual method and perform any necessary de-initialization. More...
 
virtual void NotImplemented (const wxString &log) const
 This method logs a "Not implemented" message and is provided for convenience only. More...
 

Private Member Functions

void BuildMenu (cb_unused wxMenuBar *menuBar) override
 
void RemoveMenu (cb_unused wxMenuBar *menuBar)
 
void BuildModuleMenu (cb_unused const ModuleType type, cb_unused wxMenu *menu, cb_unused const FileTreeData *data=nullptr) override
 
bool BuildToolBar (cb_unused wxToolBar *toolBar) override
 
void RemoveToolBar (cb_unused wxToolBar *toolBar)
 

Private Attributes

int m_FunctorId
 

Additional Inherited Members

- Protected Attributes inherited from cbPlugin
PluginType m_Type
 Holds the plugin's type. More...
 
bool m_IsAttached
 Holds the "attached" state. More...
 

Detailed Description

Definition at line 1025 of file cbplugin.h.

Constructor & Destructor Documentation

◆ cbSmartIndentPlugin()

cbSmartIndentPlugin::cbSmartIndentPlugin ( )

Definition at line 1037 of file cbplugin.cpp.

References cbPlugin::m_Type, and ptSmartIndent.

Member Function Documentation

◆ AutoIndentEnabled()

bool cbSmartIndentPlugin::AutoIndentEnabled ( ) const
protected

◆ BraceCompletionEnabled()

bool cbSmartIndentPlugin::BraceCompletionEnabled ( ) const
protected

◆ BraceSmartIndentEnabled()

bool cbSmartIndentPlugin::BraceSmartIndentEnabled ( ) const
protected

◆ BuildMenu()

void cbSmartIndentPlugin::BuildMenu ( cb_unused wxMenuBar menuBar)
inlineoverrideprivate

Definition at line 1031 of file cbplugin.h.

◆ BuildModuleMenu()

void cbSmartIndentPlugin::BuildModuleMenu ( cb_unused const ModuleType  type,
cb_unused wxMenu menu,
cb_unused const FileTreeData data = nullptr 
)
inlineoverrideprivate

Definition at line 1033 of file cbplugin.h.

◆ BuildToolBar()

bool cbSmartIndentPlugin::BuildToolBar ( cb_unused wxToolBar toolBar)
inlineoverrideprivate

Definition at line 1034 of file cbplugin.h.

◆ FindBlockStart() [1/2]

int cbSmartIndentPlugin::FindBlockStart ( cbStyledTextCtrl stc,
int  position,
wxChar  blockStart,
wxChar  blockEnd,
bool  skipNested = true 
) const
protected

◆ FindBlockStart() [2/2]

int cbSmartIndentPlugin::FindBlockStart ( cbStyledTextCtrl stc,
int  position,
wxString  blockStart,
wxString  blockEnd,
bool  CaseSensitive = true 
) const
protected

◆ GetFirstBraceInLine()

int cbSmartIndentPlugin::GetFirstBraceInLine ( cbStyledTextCtrl stc,
int  string_style 
) const
protected

Get the first brace in the line according to the line style.

Definition at line 1253 of file cbplugin.cpp.

References _T, wxScintilla::GetCharAt(), wxScintilla::GetCurrentPos(), wxScintilla::GetStyleAt(), wxScintilla::GetTabWidth(), and wxScintilla::GetUseTabs().

◆ GetLastNonCommentWord()

wxString cbSmartIndentPlugin::GetLastNonCommentWord ( cbEditor ed,
int  position = -1,
unsigned int  NumberOfWords = 1 
) const
protected

◆ GetLastNonWhitespaceChar()

wxChar cbSmartIndentPlugin::GetLastNonWhitespaceChar ( cbEditor ed,
int  position = -1 
) const
protected

forward search to the next character which is not a whitespace

Definition at line 1142 of file cbplugin.cpp.

◆ GetLastNonWhitespaceChars()

wxString cbSmartIndentPlugin::GetLastNonWhitespaceChars ( cbEditor ed,
int  position = -1,
unsigned int  NumberOfChars = 1 
) const
protected

(reverse) search for the last characters, which are not whitespace and not comment

Definition at line 1147 of file cbplugin.cpp.

References _T, wxScintilla::GetCharAt(), cbEditor::GetControl(), wxScintilla::GetCurrentPos(), wxScintilla::GetStyleAt(), wxScintilla::GetTextRange(), cbStyledTextCtrl::IsComment(), and wxEmptyString.

◆ GetNextNonWhitespaceCharOfLine()

wxChar cbSmartIndentPlugin::GetNextNonWhitespaceCharOfLine ( cbStyledTextCtrl stc,
int  position = -1,
int *  pos = nullptr 
) const
protected

Get the last non-whitespace character from position in line.

Definition at line 1321 of file cbplugin.cpp.

References _T, wxScintilla::GetCharAt(), and wxScintilla::GetCurrentPos().

◆ GetNextNonWhitespaceCharOnLine()

wxChar cbSmartIndentPlugin::GetNextNonWhitespaceCharOnLine ( cbStyledTextCtrl stc,
int  position = -1,
int *  pos = nullptr 
) const
protected

◆ Indent() [1/2]

void cbSmartIndentPlugin::Indent ( cbStyledTextCtrl stc,
wxString indent 
) const
protected

Definition at line 1078 of file cbplugin.cpp.

References _T, wxScintilla::GetTabWidth(), and wxScintilla::GetUseTabs().

◆ Indent() [2/2]

bool cbSmartIndentPlugin::Indent ( cbStyledTextCtrl stc,
wxString indent,
int  posInLine 
) const
protected

Definition at line 1086 of file cbplugin.cpp.

References _T, wxScintilla::GetTabWidth(), and wxScintilla::GetUseTabs().

◆ OnAttach()

void cbSmartIndentPlugin::OnAttach ( )
overrideprotectedvirtual

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...

Reimplemented from cbPlugin.

Definition at line 1042 of file cbplugin.cpp.

References cbEVT_EDITOR_CC_DONE, Manager::Get(), OnCCDoneEvent(), Manager::RegisterEventSink(), and EditorHooks::RegisterHook().

◆ OnCCDone()

virtual void cbSmartIndentPlugin::OnCCDone ( cb_unused cbEditor ed)
inlinevirtual

This is called after a code completion operation finishes.

Use it as an opportunity to tidy up CC's formating. Don't indent for languages you don't know.

Definition at line 1053 of file cbplugin.h.

References CodeCompletionHelper::GetLastNonWhitespaceChar().

◆ OnCCDoneEvent()

void cbSmartIndentPlugin::OnCCDoneEvent ( CodeBlocksEvent event)
protected

Definition at line 1345 of file cbplugin.cpp.

References EditorBase::IsBuiltinEditor().

Referenced by OnAttach().

◆ OnEditorHook()

virtual void cbSmartIndentPlugin::OnEditorHook ( cbEditor editor,
wxScintillaEvent event 
) const
pure virtual

When this is called, the smartIndent mechanism must get to work ;).

Please check if this is the right smartIndent mechanism first: Don't indent for languages you don't know.

Referenced by EditorHooks::cbSmartIndentEditorHookFunctor::Call().

◆ OnRelease()

void cbSmartIndentPlugin::OnRelease ( bool  appShutDown)
overrideprotected

Definition at line 1048 of file cbplugin.cpp.

References EditorHooks::UnregisterHook().

◆ RemoveMenu()

void cbSmartIndentPlugin::RemoveMenu ( cb_unused wxMenuBar menuBar)
inlineprivate

Definition at line 1032 of file cbplugin.h.

◆ RemoveToolBar()

void cbSmartIndentPlugin::RemoveToolBar ( cb_unused wxToolBar toolBar)
inlineprivate

Definition at line 1035 of file cbplugin.h.

◆ SelectionBraceCompletionEnabled()

bool cbSmartIndentPlugin::SelectionBraceCompletionEnabled ( ) const
protected

◆ SmartIndentEnabled()

bool cbSmartIndentPlugin::SmartIndentEnabled ( ) const
protected

Member Data Documentation

◆ m_FunctorId

int cbSmartIndentPlugin::m_FunctorId
private

Definition at line 1083 of file cbplugin.h.


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