Skip to content

Commit

Permalink
Wizards plugin: remove all old ctags related code from it and simplif…
Browse files Browse the repository at this point in the history
…y it
  • Loading branch information
eranif committed Dec 7, 2021
1 parent 5f885a0 commit 580593f
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 795 deletions.
443 changes: 64 additions & 379 deletions Gizmos/gizmos.cpp

Large diffs are not rendered by default.

24 changes: 17 additions & 7 deletions Gizmos/gizmos.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,35 @@
#include "newclassdlg.h"
#include "newwxprojectinfo.h"
#include "plugin.h"
#include "vector"
#include <vector>

using namespace std;
class WizardsPlugin : public IPlugin
{
void CreateClass(NewClassInfo& info);
wxString DoGetVirtualFuncImpl(const NewClassInfo& info);
wxString DoGetVirtualFuncDecl(const NewClassInfo& info, const wxString& separator);
std::vector<wxMenuItem*> m_vdDynItems;
wxString m_folderpath;

protected:
void CreateWxProject(NewWxProjectInfo& info);
void GizmosRemoveDuplicates(std::vector<TagEntryPtr>& src, std::vector<TagEntryPtr>& target);
void DoPopupButtonMenu(wxPoint pt);
void OnFolderContentMenu(clContextMenuEvent& event);

/**
* @brief read the contet of multiple files
* @param files vector of pairs {`file-name` -> `file-content`}
* @param path_prefix prepend this prefix to each file before reading it
* @return false if we failed to read one or more files. In addition, both vectors size must me the same
*/
bool BulkRead(vector<pair<wxString, wxString*>>& files, const wxString& path_prefix = wxEmptyString) const;
/**
* @brief read the contet of multiple files to the file system
* @param files vector of pairs {`file-name` -> `file-content`}
* @param path_prefix prepend this prefix to each file before reading it
* @return false if we failed to write one or more files. In addition, both vectors size must me the same
*/
bool BulkWrite(const vector<pair<wxString, wxString>>& files, const wxString& path_prefix = wxEmptyString) const;

public:
WizardsPlugin(IManager* manager);
~WizardsPlugin();
Expand All @@ -58,14 +71,11 @@ class WizardsPlugin : public IPlugin

void DoCreateNewPlugin();
void DoCreateNewClass();
void DoCreateNewWxProject();
// event handlers
virtual void OnNewPlugin(wxCommandEvent& e);
virtual void OnNewClass(wxCommandEvent& e);
virtual void OnNewClassUI(wxUpdateUIEvent& e);
virtual void OnNewPluginUI(wxUpdateUIEvent& e);
virtual void OnNewWxProject(wxCommandEvent& e);
virtual void OnNewWxProjectUI(wxUpdateUIEvent& e);

// event handlers
virtual void OnGizmos(wxCommandEvent& e);
Expand Down
2 changes: 0 additions & 2 deletions Gizmos/new_class_dlg_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class NewClassDlgData : public SerializedObject
Singleton = (1 << 0),
NonCopyable = (1 << 1),
VirtualDtor = (1 << 2),
ImplAllVirtualFuncs = (1 << 3),
ImplAllPureVirtualFuncs = (1 << 4),
FileIniline = (1 << 5),
UseUnderscores = (1 << 6),
HppHeader = (1 << 7),
Expand Down
36 changes: 2 additions & 34 deletions Gizmos/newclassbasedlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ NewClassBaseDlg::NewClassBaseDlg(wxWindow* parent, wxWindowID id, const wxString

fgSizer1->Add(m_textCtrlNamespace, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

m_buttonBrowseNamespaces =
new wxButton(this, wxID_ANY, _("..."), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), wxBU_EXACTFIT);

fgSizer1->Add(m_buttonBrowseNamespaces, 0, wxALL, WXC_FROM_DIP(5));
fgSizer1->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));

m_staticText45 =
new wxStaticText(this, wxID_ANY, _("Inherits:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
Expand All @@ -86,11 +83,7 @@ NewClassBaseDlg::NewClassBaseDlg(wxWindow* parent, wxWindowID id, const wxString

fgSizer1->Add(m_textCtrlParentClass, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

m_button49 =
new wxButton(this, wxID_ANY, _("..."), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), wxBU_EXACTFIT);
m_button49->SetToolTip(_("Browse for classes"));

fgSizer1->Add(m_button49, 0, wxALL, WXC_FROM_DIP(5));
fgSizer1->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));

m_staticText37 =
new wxStaticText(this, wxID_ANY, _("File name:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
Expand Down Expand Up @@ -259,18 +252,6 @@ NewClassBaseDlg::NewClassBaseDlg(wxWindow* parent, wxWindowID id, const wxString

fgSizer2->Add(m_checkBoxNonMovable, 0, wxALL, WXC_FROM_DIP(5));

m_checkBoxImplVirtual = new wxCheckBox(m_panel55, wxID_ANY, _("Implement all virtual functions"), wxDefaultPosition,
wxDLG_UNIT(m_panel55, wxSize(-1, -1)), 0);
m_checkBoxImplVirtual->SetValue(false);

fgSizer2->Add(m_checkBoxImplVirtual, 0, wxALL, WXC_FROM_DIP(5));

m_checkBoxImplPureVirtual = new wxCheckBox(m_panel55, wxID_ANY, _("Implement all pure virtual functions"),
wxDefaultPosition, wxDLG_UNIT(m_panel55, wxSize(-1, -1)), 0);
m_checkBoxImplPureVirtual->SetValue(false);

fgSizer2->Add(m_checkBoxImplPureVirtual, 0, wxALL, WXC_FROM_DIP(5));

m_stdBtnSizer30 = new wxStdDialogButtonSizer();

bSizer1->Add(m_stdBtnSizer30, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(10));
Expand Down Expand Up @@ -311,10 +292,6 @@ NewClassBaseDlg::NewClassBaseDlg(wxWindow* parent, wxWindowID id, const wxString
// Connect events
m_textClassName->Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(NewClassBaseDlg::OnTextEnter), NULL,
this);
m_buttonBrowseNamespaces->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(NewClassBaseDlg::OnBrowseNamespace), NULL, this);
m_button49->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(NewClassBaseDlg::OnBrowseParentClass), NULL,
this);
m_staticText6->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewClassBaseDlg::OnBlockGuardUI), NULL, this);
m_textCtrlBlockGuard->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewClassBaseDlg::OnBlockGuardUI), NULL, this);
m_buttonSelectVD->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(NewClassBaseDlg::OnBrowseVD), NULL,
Expand All @@ -325,19 +302,13 @@ NewClassBaseDlg::NewClassBaseDlg(wxWindow* parent, wxWindowID id, const wxString
wxCommandEventHandler(NewClassBaseDlg::OnUseLowerCaseFileName), NULL, this);
m_checkBoxSingleton->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler(NewClassBaseDlg::OnCheckSingleton), NULL, this);
m_checkBoxImplVirtual->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler(NewClassBaseDlg::OnCheckImpleAllVirtualFunctions), NULL, this);
m_button34->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(NewClassBaseDlg::OnButtonOK), NULL, this);
}

NewClassBaseDlg::~NewClassBaseDlg()
{
m_textClassName->Disconnect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(NewClassBaseDlg::OnTextEnter), NULL,
this);
m_buttonBrowseNamespaces->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(NewClassBaseDlg::OnBrowseNamespace), NULL, this);
m_button49->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(NewClassBaseDlg::OnBrowseParentClass),
NULL, this);
m_staticText6->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewClassBaseDlg::OnBlockGuardUI), NULL, this);
m_textCtrlBlockGuard->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewClassBaseDlg::OnBlockGuardUI), NULL,
this);
Expand All @@ -349,9 +320,6 @@ NewClassBaseDlg::~NewClassBaseDlg()
wxCommandEventHandler(NewClassBaseDlg::OnUseLowerCaseFileName), NULL, this);
m_checkBoxSingleton->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler(NewClassBaseDlg::OnCheckSingleton), NULL, this);
m_checkBoxImplVirtual->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler(NewClassBaseDlg::OnCheckImpleAllVirtualFunctions), NULL,
this);
m_button34->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(NewClassBaseDlg::OnButtonOK), NULL,
this);
}
11 changes: 0 additions & 11 deletions Gizmos/newclassbasedlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ class NewClassBaseDlg : public wxDialog
wxStaticText* m_staticText9;
wxStaticText* m_staticTextNamespace;
wxTextCtrl* m_textCtrlNamespace;
wxButton* m_buttonBrowseNamespaces;
wxStaticText* m_staticText45;
wxTextCtrl* m_textCtrlParentClass;
wxButton* m_button49;
wxStaticText* m_staticText37;
wxTextCtrl* m_textCtrlFileName;
wxStaticText* m_staticText6;
Expand All @@ -74,22 +72,17 @@ class NewClassBaseDlg : public wxDialog
wxCheckBox* m_checkBoxNonInheritable;
wxCheckBox* m_checkBoxNonCopyable;
wxCheckBox* m_checkBoxNonMovable;
wxCheckBox* m_checkBoxImplVirtual;
wxCheckBox* m_checkBoxImplPureVirtual;
wxStdDialogButtonSizer* m_stdBtnSizer30;
wxButton* m_button32;
wxButton* m_button34;

protected:
virtual void OnTextEnter(wxCommandEvent& event) { event.Skip(); }
virtual void OnBrowseNamespace(wxCommandEvent& event) { event.Skip(); }
virtual void OnBrowseParentClass(wxCommandEvent& event) { event.Skip(); }
virtual void OnBlockGuardUI(wxUpdateUIEvent& event) { event.Skip(); }
virtual void OnBrowseVD(wxCommandEvent& event) { event.Skip(); }
virtual void OnBrowseFolder(wxCommandEvent& event) { event.Skip(); }
virtual void OnUseLowerCaseFileName(wxCommandEvent& event) { event.Skip(); }
virtual void OnCheckSingleton(wxCommandEvent& event) { event.Skip(); }
virtual void OnCheckImpleAllVirtualFunctions(wxCommandEvent& event) { event.Skip(); }
virtual void OnButtonOK(wxCommandEvent& event) { event.Skip(); }

public:
Expand All @@ -98,10 +91,8 @@ class NewClassBaseDlg : public wxDialog
wxStaticText* GetStaticText9() { return m_staticText9; }
wxStaticText* GetStaticTextNamespace() { return m_staticTextNamespace; }
wxTextCtrl* GetTextCtrlNamespace() { return m_textCtrlNamespace; }
wxButton* GetButtonBrowseNamespaces() { return m_buttonBrowseNamespaces; }
wxStaticText* GetStaticText45() { return m_staticText45; }
wxTextCtrl* GetTextCtrlParentClass() { return m_textCtrlParentClass; }
wxButton* GetButton49() { return m_button49; }
wxStaticText* GetStaticText37() { return m_staticText37; }
wxTextCtrl* GetTextCtrlFileName() { return m_textCtrlFileName; }
wxStaticText* GetStaticText6() { return m_staticText6; }
Expand All @@ -122,8 +113,6 @@ class NewClassBaseDlg : public wxDialog
wxCheckBox* GetCheckBoxNonInheritable() { return m_checkBoxNonInheritable; }
wxCheckBox* GetCheckBoxNonCopyable() { return m_checkBoxNonCopyable; }
wxCheckBox* GetCheckBoxNonMovable() { return m_checkBoxNonMovable; }
wxCheckBox* GetCheckBoxImplVirtual() { return m_checkBoxImplVirtual; }
wxCheckBox* GetCheckBoxImplPureVirtual() { return m_checkBoxImplPureVirtual; }
wxPanel* GetPanel55() { return m_panel55; }
wxNotebook* GetNotebook53() { return m_notebook53; }
NewClassBaseDlg(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("New Class"),
Expand Down
Loading

0 comments on commit 580593f

Please sign in to comment.