+ wxWindowPropertyInfo *info = NULL;
+ if (win->IsKindOf(CLASSINFO(wxScrollBar)))
+ {
+ info = new wxScrollBarPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxStaticBox)))
+ {
+ info = new wxGroupBoxPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxCheckBox)))
+ {
+ info = new wxCheckBoxPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxSlider)))
+ {
+ info = new wxSliderPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxGauge)))
+ {
+ info = new wxGaugePropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxListBox)))
+ {
+ info = new wxListBoxPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxRadioBox)))
+ {
+ info = new wxRadioBoxPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxRadioButton)))
+ {
+ info = new wxRadioButtonPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxComboBox)))
+ {
+ info = new wxComboBoxPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxChoice)))
+ {
+ info = new wxChoicePropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxBitmapButton)))
+ {
+ info = new wxBitmapButtonPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxButton)))
+ {
+ info = new wxButtonPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxStaticBitmap)))
+ {
+ info = new wxStaticBitmapPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxStaticText)))
+ {
+ info = new wxStaticTextPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxTextCtrl)))
+ {
+ info = new wxTextPropertyInfo(win);
+ }
+ else if (win->IsKindOf(CLASSINFO(wxPanel)))
+ {
+ info = new wxPanelPropertyInfo(win);
+ }
+ else
+ {
+ info = new wxWindowPropertyInfo(win);
+ }
+ return info;
+}
+
+// Edit the given window
+void wxResourceManager::EditWindow(wxWindow *win)
+{
+ wxWindowPropertyInfo *info = CreatePropertyInfoForWindow(win);
+ if (info)
+ {
+ info->SetResource(FindResourceForWindow(win));
+ wxString str("Editing ");
+ str += win->GetClassInfo()->GetClassName();
+ str += ": ";
+ if (win->GetName() != "")
+ str += win->GetName();
+ else
+ str += "properties";
+ info->Edit(NULL, str);
+ }
+}
+
+// Generate a window id and a first stab at a name
+int wxResourceManager::GenerateWindowId(const wxString& prefix, wxString& idName)
+{
+ m_symbolIdCounter ++;
+ while (m_symbolTable.IdExists(m_symbolIdCounter))
+ m_symbolIdCounter ++;
+
+ int nameId = m_symbolIdCounter;
+
+ wxString str;
+ str.Printf("%d", nameId);
+ idName = prefix + str;
+
+ while (m_symbolTable.SymbolExists(idName))
+ {
+ nameId ++;
+ str.Printf("%d", nameId);
+ idName = prefix + str;
+ }
+
+ return m_symbolIdCounter;
+}
+
+
+/*
+* Resource editor frame
+*/
+
+IMPLEMENT_CLASS(wxResourceEditorFrame, wxFrame)
+
+BEGIN_EVENT_TABLE(wxResourceEditorFrame, wxFrame)
+EVT_MENU(wxID_NEW, wxResourceEditorFrame::OnNew)
+EVT_MENU(RESED_NEW_DIALOG, wxResourceEditorFrame::OnNewDialog)
+EVT_MENU(wxID_OPEN, wxResourceEditorFrame::OnOpen)
+EVT_MENU(RESED_CLEAR, wxResourceEditorFrame::OnClear)
+EVT_MENU(wxID_SAVE, wxResourceEditorFrame::OnSave)
+EVT_MENU(wxID_SAVEAS, wxResourceEditorFrame::OnSaveAs)
+EVT_MENU(wxID_EXIT, wxResourceEditorFrame::OnExit)
+EVT_MENU(wxID_ABOUT, wxResourceEditorFrame::OnAbout)
+EVT_MENU(RESED_CONTENTS, wxResourceEditorFrame::OnContents)
+EVT_MENU(RESED_DELETE, wxResourceEditorFrame::OnDeleteSelection)
+EVT_MENU(RESED_RECREATE, wxResourceEditorFrame::OnRecreateSelection)
+EVT_MENU(RESED_TEST, wxResourceEditorFrame::OnTest)
+EVT_MENU(RESED_CONVERT_WXRS, wxResourceEditorFrame::OnConvertWXRs)
+EVT_CLOSE(wxResourceEditorFrame::OnCloseWindow)
+END_EVENT_TABLE()
+
+wxResourceEditorFrame::wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title,
+ const wxPoint& pos, const wxSize& size, long style, const wxString& name):
+wxFrame(parent, -1, title, pos, size, style, name)
+{
+ manager = resMan;
+}
+
+wxResourceEditorFrame::~wxResourceEditorFrame()
+{
+}
+
+void wxResourceEditorFrame::OnConvertWXRs(wxCommandEvent& WXUNUSED(event))
+{
+ manager->ConvertWXRs();
+}
+
+void wxResourceEditorFrame::OnNew(wxCommandEvent& WXUNUSED(event))
+{
+ manager->New(FALSE);
+}
+
+void wxResourceEditorFrame::OnNewDialog(wxCommandEvent& WXUNUSED(event))
+{
+ manager->CreateNewPanel();
+}
+
+void wxResourceEditorFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
+{
+ manager->New(TRUE);
+}
+
+void wxResourceEditorFrame::OnClear(wxCommandEvent& WXUNUSED(event))
+{
+ manager->Clear(TRUE, FALSE);
+}
+
+void wxResourceEditorFrame::OnSave(wxCommandEvent& WXUNUSED(event))
+{
+ manager->Save();
+}
+
+void wxResourceEditorFrame::OnSaveAs(wxCommandEvent& WXUNUSED(event))
+{
+ manager->SaveAs();
+}
+
+void wxResourceEditorFrame::OnExit(wxCommandEvent& WXUNUSED(event))
+{
+ manager->Clear(TRUE, FALSE) ;
+ this->Destroy();
+}
+
+void wxResourceEditorFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+ char buf[300];
+ sprintf(buf, "wxWindows Dialog Editor %.1f\nAuthor: Julian Smart <julian.smart@ukonline.co.uk>\nJulian Smart (c) 1996-1999", wxDIALOG_EDITOR_VERSION);
+ wxMessageBox(buf, "About Dialog Editor", wxOK|wxCENTRE);
+}
+
+void wxResourceEditorFrame::OnTest(wxCommandEvent& WXUNUSED(event))
+{
+ manager->TestCurrentDialog(this);
+}
+
+void wxResourceEditorFrame::OnContents(wxCommandEvent& WXUNUSED(event))
+{
+#ifdef __WXMSW__
+ wxBeginBusyCursor();
+ manager->GetHelpController()->LoadFile();
+ manager->GetHelpController()->DisplayContents();
+ wxEndBusyCursor();
+#endif
+}
+
+void wxResourceEditorFrame::OnDeleteSelection(wxCommandEvent& WXUNUSED(event))
+{
+ manager->DeleteSelection();
+}
+
+void wxResourceEditorFrame::OnRecreateSelection(wxCommandEvent& WXUNUSED(event))
+{
+ manager->RecreateSelection();
+}
+
+void wxResourceEditorFrame::OnCloseWindow(wxCloseEvent& event)
+{
+ wxPropertyInfo::CloseWindow();
+ manager->ClearCurrentDialog();
+ if (manager->Modified())
+ {
+ if (!manager->Clear(TRUE, FALSE))