Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions LiteEditor/ContextJavaScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ wxMenu* ContextJavaScript::GetMenu() { return ContextBase::GetMenu(); }

TagEntryPtr ContextJavaScript::GetTagAtCaret(bool scoped, bool impl) { return NULL; }

void ContextJavaScript::GotoPreviousDefintion() {}

bool ContextJavaScript::IsCommentOrString(long pos)
{
int style = GetCtrl().GetStyleAt(pos);
Expand All @@ -187,7 +185,10 @@ bool ContextJavaScript::IsCommentOrString(long pos)

bool ContextJavaScript::IsDefaultContext() const { return false; }

ContextBase* ContextJavaScript::NewInstance(clEditor* container) { return new ContextJavaScript(container); }
std::shared_ptr<ContextBase> ContextJavaScript::NewInstance(clEditor* container)
{
return std::make_shared<ContextJavaScript>(container);
}

void ContextJavaScript::OnCallTipClick(wxStyledTextEvent& event) {}

Expand All @@ -199,8 +200,6 @@ void ContextJavaScript::OnDbgDwellStart(wxStyledTextEvent& event) {}

void ContextJavaScript::OnDwellEnd(wxStyledTextEvent& event) {}

void ContextJavaScript::OnDwellStart(wxStyledTextEvent& event) {}

void ContextJavaScript::OnEnterHit() {}

void ContextJavaScript::OnFileSaved() {}
Expand Down Expand Up @@ -249,7 +248,7 @@ void ContextJavaScript::SemicolonShift()

void ContextJavaScript::SetActive() {}

bool ContextJavaScript::IsComment(long pos)
bool ContextJavaScript::IsComment(long pos) const
{
int style = GetCtrl().GetStyleAt(pos);
return style == wxSTC_C_COMMENT || style == wxSTC_C_COMMENTDOC || style == wxSTC_C_COMMENTDOCKEYWORD ||
Expand Down
63 changes: 31 additions & 32 deletions LiteEditor/ContextJavaScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,39 @@ class ContextJavaScript : public ContextBase
{
public:
ContextJavaScript();
ContextJavaScript(clEditor* Editor);
virtual ~ContextJavaScript() = default;
explicit ContextJavaScript(clEditor* Editor);
~ContextJavaScript() override = default;

public:
virtual int GetActiveKeywordSet() const;
virtual int DoGetCalltipParamterIndex();
virtual wxMenu* GetMenu();
virtual void AddMenuDynamicContent(wxMenu* menu);
virtual void ApplySettings();
virtual void AutoIndent(const wxChar&);
virtual wxString CallTipContent();
virtual wxString GetCurrentScopeName();
virtual TagEntryPtr GetTagAtCaret(bool scoped, bool impl);
virtual void GotoPreviousDefintion();
virtual bool IsComment(long pos);
virtual bool IsCommentOrString(long pos);
virtual bool IsDefaultContext() const;
virtual ContextBase* NewInstance(clEditor* container);
virtual void OnCallTipClick(wxStyledTextEvent& event);
virtual void OnCalltipCancel();
virtual void OnDbgDwellEnd(wxStyledTextEvent& event);
virtual void OnDbgDwellStart(wxStyledTextEvent& event);
virtual void OnDwellEnd(wxStyledTextEvent& event);
virtual void OnDwellStart(wxStyledTextEvent& event);
virtual void OnEnterHit();
virtual void OnFileSaved();
virtual void OnKeyDown(wxKeyEvent& event);
virtual void OnSciUpdateUI(wxStyledTextEvent& event);
virtual void RemoveMenuDynamicContent(wxMenu* menu);
virtual void RetagFile();
virtual void SemicolonShift();
virtual void SetActive();
virtual bool IsAtBlockComment() const;
virtual bool IsAtLineComment() const;
int GetActiveKeywordSet() const override;
int DoGetCalltipParamterIndex() override;
wxMenu* GetMenu() override;
void AddMenuDynamicContent(wxMenu* menu) override;
void ApplySettings() override;
void AutoIndent(const wxChar&) override;
wxString CallTipContent() override;
wxString GetCurrentScopeName() override;
TagEntryPtr GetTagAtCaret(bool scoped, bool impl) override;
bool IsCommentOrString(long pos) override;
bool IsDefaultContext() const override;
std::shared_ptr<ContextBase> NewInstance(clEditor* container) override;
void OnCallTipClick(wxStyledTextEvent& event) override;
void OnCalltipCancel() override;
void OnDbgDwellEnd(wxStyledTextEvent& event) override;
void OnDbgDwellStart(wxStyledTextEvent& event) override;
void OnDwellEnd(wxStyledTextEvent& event) override;
void OnEnterHit() override;
void OnFileSaved() override;
void OnKeyDown(wxKeyEvent& event) override;
void OnSciUpdateUI(wxStyledTextEvent& event) override;
void RemoveMenuDynamicContent(wxMenu* menu) override;
void RetagFile() override;
void SemicolonShift() override;
void SetActive() override;
bool IsAtBlockComment() const override;
bool IsAtLineComment() const override;

bool IsComment(long pos) const;
};

#endif // CONTEXTJAVASCRIPT_H
11 changes: 5 additions & 6 deletions LiteEditor/ContextPhp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ wxMenu* ContextPhp::GetMenu() { return ContextBase::GetMenu(); }

TagEntryPtr ContextPhp::GetTagAtCaret(bool scoped, bool impl) { return NULL; }

void ContextPhp::GotoPreviousDefintion() {}

bool ContextPhp::IsCommentOrString(long pos)
{
int style = GetCtrl().GetStyleAt(pos);
Expand All @@ -236,7 +234,10 @@ bool ContextPhp::IsCommentOrString(long pos)

bool ContextPhp::IsDefaultContext() const { return false; }

ContextBase* ContextPhp::NewInstance(clEditor* container) { return new ContextPhp(container); }
std::shared_ptr<ContextBase> ContextPhp::NewInstance(clEditor* container)
{
return std::make_shared<ContextPhp>(container);
}

void ContextPhp::OnCallTipClick(wxStyledTextEvent& event) {}

Expand All @@ -248,8 +249,6 @@ void ContextPhp::OnDbgDwellStart(wxStyledTextEvent& event) {}

void ContextPhp::OnDwellEnd(wxStyledTextEvent& event) {}

void ContextPhp::OnDwellStart(wxStyledTextEvent& event) {}

void ContextPhp::OnEnterHit() {}

void ContextPhp::OnFileSaved() {}
Expand Down Expand Up @@ -299,7 +298,7 @@ void ContextPhp::SemicolonShift()

void ContextPhp::SetActive() {}

bool ContextPhp::IsComment(long pos)
bool ContextPhp::IsComment(long pos) const
{
int style = GetCtrl().GetStyleAt(pos);
return style == wxSTC_H_COMMENT || style == wxSTC_H_XCCOMMENT || style == wxSTC_H_SGML_COMMENT ||
Expand Down
68 changes: 33 additions & 35 deletions LiteEditor/ContextPhp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,41 @@ class ContextPhp : public ContextGeneric
{
public:
ContextPhp();
ContextPhp(clEditor *Editor);
virtual ~ContextPhp() = default;
explicit ContextPhp(clEditor *Editor);
~ContextPhp() override = default;

public:
bool IsStringTriggerCodeComplete(const wxString& str) const;
virtual int GetActiveKeywordSet() const;
virtual int DoGetCalltipParamterIndex();
virtual wxMenu* GetMenu();
virtual void AddMenuDynamicContent(wxMenu* menu);
virtual void ApplySettings();
virtual void AutoIndent(const wxChar&);
virtual wxString CallTipContent();
virtual wxString GetCurrentScopeName();
virtual TagEntryPtr GetTagAtCaret(bool scoped, bool impl);
virtual void GotoPreviousDefintion();
virtual bool IsComment(long pos);
virtual bool IsCommentOrString(long pos);
virtual bool IsDefaultContext() const;
virtual ContextBase* NewInstance(clEditor* container);
virtual void OnCallTipClick(wxStyledTextEvent& event);
virtual void OnCalltipCancel();
virtual void OnDbgDwellEnd(wxStyledTextEvent& event);
virtual void OnDbgDwellStart(wxStyledTextEvent& event);
virtual void OnDwellEnd(wxStyledTextEvent& event);
virtual void OnDwellStart(wxStyledTextEvent& event);
virtual void OnEnterHit();
virtual void OnFileSaved();
virtual void OnKeyDown(wxKeyEvent& event);
virtual void OnSciUpdateUI(wxStyledTextEvent& event);
virtual void RemoveMenuDynamicContent(wxMenu* menu);
virtual void RetagFile();
virtual void SemicolonShift();
virtual void SetActive();
virtual bool IsAtBlockComment() const;
virtual bool IsAtLineComment() const;
void ProcessIdleActions();

bool IsStringTriggerCodeComplete(const wxString& str) const override;
int GetActiveKeywordSet() const override;
int DoGetCalltipParamterIndex() override;
wxMenu* GetMenu() override;
void AddMenuDynamicContent(wxMenu* menu) override;
void ApplySettings() override;
void AutoIndent(const wxChar&) override;
wxString CallTipContent() override;
wxString GetCurrentScopeName() override;
TagEntryPtr GetTagAtCaret(bool scoped, bool impl) override;
bool IsCommentOrString(long pos) override;
bool IsDefaultContext() const override;
std::shared_ptr<ContextBase> NewInstance(clEditor* container) override;
void OnCallTipClick(wxStyledTextEvent& event) override;
void OnCalltipCancel() override;
void OnDbgDwellEnd(wxStyledTextEvent& event) override;
void OnDbgDwellStart(wxStyledTextEvent& event) override;
void OnDwellEnd(wxStyledTextEvent& event) override;
void OnEnterHit() override;
void OnFileSaved() override;
void OnKeyDown(wxKeyEvent& event) override;
void OnSciUpdateUI(wxStyledTextEvent& event) override;
void RemoveMenuDynamicContent(wxMenu* menu) override;
void RetagFile() override;
void SemicolonShift() override;
void SetActive() override;
bool IsAtBlockComment() const override;
bool IsAtLineComment() const override;
void ProcessIdleActions() override;

bool IsComment(long pos) const;
};

#endif // CONTEXTPHP_H
7 changes: 4 additions & 3 deletions LiteEditor/ContextPython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

#include "ColoursAndFontsManager.h"
#include "cl_editor.h"
#include "editor_config.h"
#include "lexer_configuration.h"

#include <wx/msgdlg.h>
#include <wx/regex.h>
#include <wx/tokenzr.h>
#include <wx/xrc/xmlres.h>
Expand Down Expand Up @@ -55,7 +53,10 @@ void ContextPython::ApplySettings()
DoApplySettings(lexPtr);
}

ContextBase* ContextPython::NewInstance(clEditor* container) { return new ContextPython(container); }
std::shared_ptr<ContextBase> ContextPython::NewInstance(clEditor* container)
{
return std::make_shared<ContextPython>(container);
}

void ContextPython::OnCommentSelection(wxCommandEvent& event)
{
Expand Down
7 changes: 3 additions & 4 deletions LiteEditor/ContextPython.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "generic_context.h"

class clEditor;
class ContextPython : public ContextGeneric
{
protected:
Expand All @@ -20,10 +19,10 @@ class ContextPython : public ContextGeneric

public:
ContextPython();
ContextPython(clEditor* container);
virtual ~ContextPython();
explicit ContextPython(clEditor* container);
~ContextPython() override;
void ApplySettings() override;
ContextBase* NewInstance(clEditor* container) override;
std::shared_ptr<ContextBase> NewInstance(clEditor* container) override;
bool IsAtBlockComment() const override;
bool IsAtLineComment() const override;
};
Expand Down
11 changes: 5 additions & 6 deletions LiteEditor/ContextRust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ wxMenu* ContextRust::GetMenu() { return ContextBase::GetMenu(); }

TagEntryPtr ContextRust::GetTagAtCaret(bool scoped, bool impl) { return NULL; }

void ContextRust::GotoPreviousDefintion() {}

bool ContextRust::IsCommentOrString(long pos)
{
static std::unordered_set<int> string_styles = { wxSTC_RUST_BYTECHARACTER, wxSTC_RUST_BYTESTRING,
Expand All @@ -143,7 +141,10 @@ bool ContextRust::IsCommentOrString(long pos)

bool ContextRust::IsDefaultContext() const { return false; }

ContextBase* ContextRust::NewInstance(clEditor* container) { return new ContextRust(container); }
std::shared_ptr<ContextBase> ContextRust::NewInstance(clEditor* container)
{
return std::make_shared<ContextRust>(container);
}

void ContextRust::OnCallTipClick(wxStyledTextEvent& event) { wxUnusedVar(event); }

Expand All @@ -155,8 +156,6 @@ void ContextRust::OnDbgDwellStart(wxStyledTextEvent& event) { wxUnusedVar(event)

void ContextRust::OnDwellEnd(wxStyledTextEvent& event) { wxUnusedVar(event); }

void ContextRust::OnDwellStart(wxStyledTextEvent& event) { wxUnusedVar(event); }

void ContextRust::OnEnterHit() {}

void ContextRust::OnFileSaved() {}
Expand Down Expand Up @@ -200,7 +199,7 @@ void ContextRust::SemicolonShift()

void ContextRust::SetActive() {}

bool ContextRust::IsComment(long pos)
bool ContextRust::IsComment(long pos) const
{
static std::unordered_set<int> comment_styles = { wxSTC_RUST_COMMENTBLOCK, wxSTC_RUST_COMMENTLINE,
wxSTC_RUST_COMMENTBLOCKDOC, wxSTC_RUST_COMMENTLINEDOC };
Expand Down
67 changes: 33 additions & 34 deletions LiteEditor/ContextRust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,45 @@ class ContextRust : public ContextGeneric

public:
ContextRust();
ContextRust(clEditor* Editor);
virtual ~ContextRust();
explicit ContextRust(clEditor* Editor);
~ContextRust() override;

protected:
void OnCommentSelection(wxCommandEvent& event);
void OnCommentLine(wxCommandEvent& event);

public:
bool IsStringTriggerCodeComplete(const wxString& str) const;
virtual int GetActiveKeywordSet() const;
virtual int DoGetCalltipParamterIndex();
virtual wxMenu* GetMenu();
virtual void AddMenuDynamicContent(wxMenu* menu);
virtual void ApplySettings();
virtual void AutoIndent(const wxChar&);
virtual wxString CallTipContent();
virtual wxString GetCurrentScopeName();
virtual TagEntryPtr GetTagAtCaret(bool scoped, bool impl);
virtual void GotoPreviousDefintion();
virtual bool IsComment(long pos);
virtual bool IsCommentOrString(long pos);
virtual bool IsDefaultContext() const;
virtual ContextBase* NewInstance(clEditor* container);
virtual void OnCallTipClick(wxStyledTextEvent& event);
virtual void OnCalltipCancel();
virtual void OnDbgDwellEnd(wxStyledTextEvent& event);
virtual void OnDbgDwellStart(wxStyledTextEvent& event);
virtual void OnDwellEnd(wxStyledTextEvent& event);
virtual void OnDwellStart(wxStyledTextEvent& event);
virtual void OnEnterHit();
virtual void OnFileSaved();
virtual void OnKeyDown(wxKeyEvent& event);
virtual void OnSciUpdateUI(wxStyledTextEvent& event);
virtual void RemoveMenuDynamicContent(wxMenu* menu);
virtual void RetagFile();
virtual void SemicolonShift();
virtual void SetActive();
virtual bool IsAtBlockComment() const;
virtual bool IsAtLineComment() const;
void ProcessIdleActions();
bool IsStringTriggerCodeComplete(const wxString& str) const override;
int GetActiveKeywordSet() const override;
int DoGetCalltipParamterIndex() override;
wxMenu* GetMenu() override;
void AddMenuDynamicContent(wxMenu* menu) override;
void ApplySettings() override;
void AutoIndent(const wxChar&) override;
wxString CallTipContent() override;
wxString GetCurrentScopeName() override;
TagEntryPtr GetTagAtCaret(bool scoped, bool impl) override;
bool IsCommentOrString(long pos) override;
bool IsDefaultContext() const override;
std::shared_ptr<ContextBase> NewInstance(clEditor* container) override;
void OnCallTipClick(wxStyledTextEvent& event) override;
void OnCalltipCancel() override;
void OnDbgDwellEnd(wxStyledTextEvent& event) override;
void OnDbgDwellStart(wxStyledTextEvent& event) override;
void OnDwellEnd(wxStyledTextEvent& event) override;
void OnEnterHit() override;
void OnFileSaved() override;
void OnKeyDown(wxKeyEvent& event) override;
void OnSciUpdateUI(wxStyledTextEvent& event) override;
void RemoveMenuDynamicContent(wxMenu* menu) override;
void RetagFile() override;
void SemicolonShift() override;
void SetActive() override;
bool IsAtBlockComment() const override;
bool IsAtLineComment() const override;
void ProcessIdleActions() override;

bool IsComment(long pos) const;
};

#endif // CONTEXTRUST_HPP
Loading
Loading