Patch #1568 2006-10-18 07:42
workwind
classwizard improvements- Download
- 1568-classwizard_im.patch (39.3 KB)
Index: classwizard.cpp
===================================================================
--- classwizard.cpp (revision 3111)
+++ classwizard.cpp (working copy)
@@ -71,34 +71,32 @@
{
ProjectManager* prjMan = Manager::Get()->GetProjectManager();
cbProject* prj = prjMan->GetActiveProject();
- if (prj)
- wxSetWorkingDirectory(prj->GetBasePath());
- ClassWizardDlg dlg(Manager::Get()->GetAppWindow());
+ ClassWizardDlg dlg(Manager::Get()->GetAppWindow());
PlaceWindow(&dlg);
- if (dlg.ShowModal() == wxID_OK)
- {
- if (!prj)
- {
- cbMessageBox( _("The new class has been created."),
- _("Information"),
- wxOK | wxICON_INFORMATION,
- Manager::Get()->GetAppWindow());
- }
- else if( cbMessageBox( _("The new class has been created.\n"
- "Do you want to add it to the current project?"),
- _("Add to project?"),
- wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION,
- Manager::Get()->GetAppWindow()) == wxID_YES)
- {
+ if (dlg.ShowModal() == wxID_OK)
+ {
+ if (!prj)
+ {
+ cbMessageBox( _("The new class has been created."),
+ _("Information"),
+ wxOK | wxICON_INFORMATION,
+ Manager::Get()->GetAppWindow());
+ }
+ else if( cbMessageBox( _("The new class has been created.\n"
+ "Do you want to add it to the current project?"),
+ _("Add to project?"),
+ wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION,
+ Manager::Get()->GetAppWindow()) == wxID_YES)
+ {
wxArrayInt targets;
- prjMan->AddFileToProject(dlg.GetHeaderFilename(), prj, targets);
- if (targets.GetCount() != 0)
- prjMan->AddFileToProject(dlg.GetImplementationFilename(), prj, targets);
- prjMan->RebuildTree();
- }
- return 0;
- }
+ prjMan->AddFileToProject(dlg.GetHeaderFilename(), prj, targets);
+ if ((targets.GetCount() != 0) && (dlg.GetImplementationFilename() != _T("")) )
+ prjMan->AddFileToProject(dlg.GetImplementationFilename(), prj, targets);
+ prjMan->RebuildTree();
+ }
+ return 0;
+ }
- return -1;
+ return -1;
}
Index: classwizard.h
===================================================================
--- classwizard.h (revision 3111)
+++ classwizard.h (working copy)
@@ -12,7 +12,7 @@
virtual void OnAttach();
virtual void OnRelease(bool appShutDown);
virtual int Configure(){ return -1; }
- virtual int Execute();
+ virtual int Execute();
};
#endif // CLASSWIZARD_H
Index: classwizarddlg.cpp
===================================================================
--- classwizarddlg.cpp (revision 3111)
+++ classwizarddlg.cpp (working copy)
@@ -40,82 +40,159 @@
#include "manager.h"
#endif
#include "classwizarddlg.h"
+#include <wx/tokenzr.h>
+#include <wx/dirdlg.h>
+namespace {
+
+
+void ForceDirectory(const wxFileName & filename)
+{
+ wxFileName parentname(filename);
+ parentname.RemoveLastDir();
+ if (filename!=parentname)
+ ForceDirectory(parentname);
+ if (!wxDirExists(filename.GetPath()))
+ wxMkdir(filename.GetPath());
+}
+
+}
+
+
BEGIN_EVENT_TABLE(ClassWizardDlg, wxDialog)
- EVT_UPDATE_UI(-1, ClassWizardDlg::OnUpdateUI)
- EVT_BUTTON(XRCID("wxID_OK"), ClassWizardDlg::OnOKClick)
- EVT_BUTTON(XRCID("wxID_CANCEL"), ClassWizardDlg::OnCancelClick)
- EVT_TEXT(XRCID("txtName"), ClassWizardDlg::OnNameChange)
+ EVT_UPDATE_UI(-1, ClassWizardDlg::OnUpdateUI)
+ EVT_BUTTON(XRCID("wxID_OK"), ClassWizardDlg::OnOKClick)
+ EVT_BUTTON(XRCID("wxID_CANCEL"), ClassWizardDlg::OnCancelClick)
+ EVT_TEXT(XRCID("txtName"), ClassWizardDlg::OnNameChange)
+ EVT_TEXT(XRCID("txtInheritance"), ClassWizardDlg::OnAncestorChange)
+ EVT_BUTTON(XRCID("btnBaseDir"), ClassWizardDlg::OnBaseDirClick)
END_EVENT_TABLE()
+
ClassWizardDlg::ClassWizardDlg(wxWindow* parent)
{
- wxXmlResource::Get()->LoadDialog(this, parent, _T("dlgNewClass"));
+ wxXmlResource::Get()->LoadDialog(this, parent, _T("dlgNewClass"));
+
+ ProjectManager* prjMan = Manager::Get()->GetProjectManager();
+ cbProject* prj = prjMan->GetActiveProject();
+ if (prj)
+ XRCCTRL(*this, "txtBaseDir", wxTextCtrl)->SetValue(prj->GetBasePath());
+ else
+ XRCCTRL(*this, "txtBaseDir", wxTextCtrl)->SetValue(wxGetWorkingDirectory());
}
+
ClassWizardDlg::~ClassWizardDlg()
{
}
+
void ClassWizardDlg::DoGuardBlock()
{
- m_Header = XRCCTRL(*this, "txtHeader", wxTextCtrl)->GetValue();
- wxFileName headerFname(m_Header);
- wxString GuardWord
download for full patch...
History
workwind 2006-10-19 16:37
* New version allows to select base directory
* Updated Code to conform C::B coding-conventions
mortenmacfly 2006-10-20 18:11
Looks good to me.