]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/dialoged/src/reseditr.cpp
wxToolBarBase -> wxToolBar
[wxWidgets.git] / utils / dialoged / src / reseditr.cpp
index cf8c3cb2824ca4dcf5db0e103535282d54255019..2e82eb8c27702bdca543cd1865a9d630409bf711 100644 (file)
@@ -55,7 +55,6 @@
 
 #include "reseditr.h"
 #include "winprop.h"
-#include "editrpal.h"
 #include "dlghndlr.h"
 #include "edtree.h"
 #include "edlist.h"
@@ -93,10 +92,11 @@ wxResourceManager::wxResourceManager():
   m_popupMenu = NULL;
   m_editorResourceTree = NULL;
   m_editorControlList = NULL;
-  m_editorPalette = NULL;
   m_nameCounter = 1;
+  m_symbolIdCounter = 99;
   m_modified = FALSE;
   m_currentFilename = "";
+  m_symbolFilename = "";
   m_editorToolBar = NULL;
 
   // Default window positions
@@ -141,7 +141,7 @@ bool wxResourceManager::Initialize()
   m_optionsResourceFilename = buf;
 #elif defined(__X__)
   char buf[500];
-  ()wxGetHomeDir(buf);
+  wxGetHomeDir(buf);
   strcat(buf, "/.dialogedrc");
   m_optionsResourceFilename = buf;
 #else
@@ -179,6 +179,8 @@ bool wxResourceManager::Initialize()
   m_imageList.Add(icon4);
 #endif
 
+  m_symbolTable.AddStandardSymbols();
+
   return TRUE;
 }
 
@@ -228,7 +230,6 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *parent, const ch
     m_editorFrame->SetMenuBar(menuBar);
 
     m_editorToolBar = (EditorToolBar *)OnCreateToolBar(m_editorFrame);
-//    m_editorPalette = OnCreatePalette(m_editorFrame);
     m_editorControlList = new wxResourceEditorControlList(m_editorFrame, IDC_LISTCTRL, wxPoint(0, 0), wxSize(-1, -1));
     m_editorResourceTree = new wxResourceEditorProjectTree(m_editorFrame, IDC_TREECTRL, wxPoint(0, 0), wxSize(-1, -1),
       wxTR_HAS_BUTTONS);
@@ -245,17 +246,7 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *parent, const ch
     c->width.Unconstrained();
     c->height.Absolute(28);
     m_editorToolBar->SetConstraints(c);
-/*
-    // Constraints for palette
-    c = new wxLayoutConstraints;
-    c->left.SameAs       (m_editorFrame, wxLeft, 0);
-    c->top.SameAs        (m_editorToolBar, wxBottom, 0);
-    c->right.SameAs      (m_editorFrame, wxRight, 0);
-    c->bottom.Unconstrained();
-    c->width.Unconstrained();
-    c->height.Absolute(34);
-    m_editorPalette->SetConstraints(c);
-*/
+
     // Constraints for listbox
     c = new wxLayoutConstraints;
     c->left.SameAs       (m_editorFrame, wxLeft, 0);
@@ -338,6 +329,7 @@ bool wxResourceManager::Save(const wxString& filename)
   InstantiateAllResourcesFromWindows();
   if (m_resourceTable.Save(filename))
   {
+    m_symbolTable.WriteIncludeFile(m_symbolFilename);
     Modify(FALSE);
     return TRUE;
   }
@@ -354,6 +346,15 @@ bool wxResourceManager::SaveAs()
     return FALSE;
     
   m_currentFilename = s;
+  wxStripExtension(m_currentFilename);
+  m_currentFilename += ".wxr";
+
+  // Construct include filename from this file
+  m_symbolFilename = m_currentFilename;
+
+  wxStripExtension(m_symbolFilename);
+  m_symbolFilename += ".h";
+
   Save(m_currentFilename);
   return TRUE;
 }
@@ -375,6 +376,8 @@ bool wxResourceManager::New(bool loadFromFile, const wxString& filename)
   if (!Clear(TRUE, FALSE))
     return FALSE;
     
+  m_symbolTable.AddStandardSymbols();
+
   if (loadFromFile)
   {
     wxString str = filename;
@@ -397,6 +400,41 @@ bool wxResourceManager::New(bool loadFromFile, const wxString& filename)
     SetFrameTitle(m_currentFilename);
 
     UpdateResourceList();
+
+    // Construct include filename from this file
+    m_symbolFilename = m_currentFilename;
+
+    wxStripExtension(m_symbolFilename);
+    m_symbolFilename += ".h";
+
+    if (!m_symbolTable.ReadIncludeFile(m_symbolFilename))
+    {
+        wxString str("Could not find include file ");
+        str += m_symbolFilename;
+        str += ".\nDialog Editor maintains a header file containing id symbols to be used in the application.\n";
+        str += "The next time this .wxr file is saved, a header file will be saved also.";
+        wxMessageBox(str, "Dialog Editor Warning", MB_OK);
+
+        m_symbolIdCounter = 99;
+    }
+    else
+    {
+        // Set the id counter to the last known id
+        m_symbolIdCounter = m_symbolTable.FindHighestId();
+    }
+
+    // Now check in case some (or all) resources don't have resource ids, or they
+    // don't match the .h file, or something of that nature.
+    bool altered = RepairResourceIds();
+    if (altered)
+    {
+        wxMessageBox("Some resources have had new identifiers associated with them, since they were missing.", "Dialog Editor Warning", MB_OK);
+        Modify(TRUE);
+    }
+    else
+        Modify(FALSE);
+
+    return TRUE;
   }
   else
   {
@@ -425,6 +463,7 @@ bool wxResourceManager::Clear(bool deleteWindows, bool force)
   ClearCurrentDialog();
   DisassociateWindows();
 
+  m_symbolTable.Clear();
   m_resourceTable.ClearTable();
   UpdateResourceList();
 
@@ -545,10 +584,18 @@ bool wxResourceManager::SaveInfoAndDeleteHandler(wxWindow* win)
 // variable.
 bool wxResourceManager::DeleteWindow(wxWindow* win)
 {
+    bool clearDisplay = FALSE;
     if (m_editorPanel->m_childWindow == win)
+    {
         m_editorPanel->m_childWindow = NULL;
+        clearDisplay = TRUE;
+    }
 
     win->Destroy();
+
+    if (clearDisplay)
+        m_editorPanel->Clear();
+
     return TRUE;
 }
 
@@ -648,7 +695,7 @@ wxResourceEditorScrolledWindow *wxResourceManager::OnCreateEditorPanel(wxFrame *
   return panel;
 }
 
-wxToolBarBase *wxResourceManager::OnCreateToolBar(wxFrame *parent)
+wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent)
 {
   // Load palette bitmaps
 #ifdef __WXMSW__
@@ -683,10 +730,8 @@ wxToolBarBase *wxResourceManager::OnCreateToolBar(wxFrame *parent)
 #endif
 
   // Create the toolbar
-  EditorToolBar *toolbar = new EditorToolBar(parent, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER,
-                                        wxVERTICAL, 1);
+  EditorToolBar *toolbar = new EditorToolBar(parent, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER|wxTB_HORIZONTAL);
   toolbar->SetMargins(2, 2);
-//  toolbar->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH);
 
 #ifdef __WXMSW__
   int width = 24;
@@ -743,11 +788,9 @@ wxToolBarBase *wxResourceManager::OnCreateToolBar(wxFrame *parent)
                    FALSE, (float)currentX, -1, NULL, "Help");
   currentX += width + dx;
   
-  toolbar->CreateTools();
+  toolbar->Realize();
 
   return toolbar;
-
-//  parent->OnSize(-1, -1);
 }
 
 void wxResourceManager::UpdateResourceList()
@@ -815,7 +858,7 @@ void wxResourceManager::AddItemsRecursively(long parent, wxItemResource *resourc
 bool wxResourceManager::EditSelectedResource()
 {
   int sel = m_editorResourceTree->GetSelection();
-  if (sel > -1)
+  if (sel != 0)
   {
     wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel);
     return Edit(res);
@@ -867,21 +910,28 @@ bool wxResourceManager::CreateNewPanel()
   ClearCurrentDialog();
 
   char buf[256];
-  MakeUniqueName("panel", buf);
+  MakeUniqueName("dialog", buf);
   
   wxItemResource *resource = new wxItemResource;
-//  resource->SetType(wxTYPE_PANEL);
-  resource->SetType("wxPanel");
+  resource->SetType("wxDialog");
   resource->SetName(buf);
   resource->SetTitle(buf);
+
+  wxString newIdName;
+  int id = GenerateWindowId("ID_DIALOG", newIdName);
+  resource->SetId(id);
+
+  // This is now guaranteed to be unique, so just add to symbol table
+  m_symbolTable.AddSymbol(newIdName, id);
+
   m_resourceTable.AddResource(resource);
 
   wxPanel *panel = new wxPanel(m_editorPanel, -1,
      wxPoint(m_editorPanel->GetMarginX(), m_editorPanel->GetMarginY()),
-     wxSize(400, 300), wxRAISED_BORDER, buf);
+     wxSize(400, 300), wxRAISED_BORDER|wxDEFAULT_DIALOG_STYLE, buf);
   m_editorPanel->m_childWindow = panel;
 
-  resource->SetStyle(0); // panel->GetWindowStyleFlag());
+  resource->SetStyle(panel->GetWindowStyleFlag());
   resource->SetSize(10, 10, 400, 300);
 
   // For editing in situ we will need to use the hash table to ensure
@@ -918,11 +968,14 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
   wxControl *newItem = NULL;
   res->SetSize(x, y, -1, -1);
   res->SetType(iType);
+
+  wxString prefix;
   
   wxString itemType(iType);
 
   if (itemType == "wxButton")
     {
+      prefix = "ID_BUTTON";
       MakeUniqueName("button", buf);
       res->SetName(buf);
       if (isBitmap)
@@ -932,39 +985,45 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
     }
   if (itemType == "wxBitmapButton")
     {
+      prefix = "ID_BITMAPBUTTON";
       MakeUniqueName("button", buf);
       res->SetName(buf);
       newItem = new wxBitmapButton(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
     }
   else if (itemType == "wxMessage" || itemType == "wxStaticText")
     {
-      MakeUniqueName("message", buf);
+      prefix = "ID_STATIC";
+      MakeUniqueName("statictext", buf);
       res->SetName(buf);
       if (isBitmap)
         newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(0, 0), 0, buf);
       else
-        newItem = new wxStaticText(panel, -1, "Message", wxPoint(x, y), wxSize(-1, -1), 0, buf);
+        newItem = new wxStaticText(panel, -1, "Static", wxPoint(x, y), wxSize(-1, -1), 0, buf);
     }
   else if (itemType == "wxStaticBitmap")
     {
-      MakeUniqueName("message", buf);
+      prefix = "ID_STATICBITMAP";
+      MakeUniqueName("static", buf);
       res->SetName(buf);
       newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf);
     }
   else if (itemType == "wxCheckBox")
     {
+      prefix = "ID_CHECKBOX";
       MakeUniqueName("checkbox", buf);
       res->SetName(buf);
       newItem = new wxCheckBox(panel, -1, "Checkbox", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
     }
   else if (itemType == "wxListBox")
     {
+      prefix = "ID_LISTBOX";
       MakeUniqueName("listbox", buf);
       res->SetName(buf);
       newItem = new wxListBox(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf);
     }
   else if (itemType == "wxRadioBox")
     {
+      prefix = "ID_RADIOBOX";
       MakeUniqueName("radiobox", buf);
       res->SetName(buf);
       wxString names[] = { "One", "Two" };
@@ -972,32 +1031,53 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
             wxHORIZONTAL, wxDefaultValidator, buf);
       res->SetStringValues(new wxStringList("One", "Two", NULL));
     }
+  else if (itemType == "wxRadioButton")
+    {
+      prefix = "ID_RADIOBUTTON";
+      MakeUniqueName("radiobutton", buf);
+      res->SetName(buf);
+      wxString names[] = { "One", "Two" };
+      newItem = new wxRadioButton(panel, -1, "Radiobutton", wxPoint(x, y), wxSize(-1, -1),
+            0, wxDefaultValidator, buf);
+    }
   else if (itemType == "wxChoice")
     {
+      prefix = "ID_CHOICE";
       MakeUniqueName("choice", buf);
       res->SetName(buf);
       newItem = new wxChoice(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf);
     }
+  else if (itemType == "wxComboBox")
+    {
+      prefix = "ID_COMBOBOX";
+      MakeUniqueName("combobox", buf);
+      res->SetName(buf);
+      newItem = new wxComboBox(panel, -1, "", wxPoint(x, y), wxSize(-1, -1), 0, NULL, wxCB_DROPDOWN, wxDefaultValidator, buf);
+    }
   else if (itemType == "wxGroupBox" || itemType == "wxStaticBox")
     {
-      MakeUniqueName("group", buf);
+      prefix = "ID_STATICBOX";
+      MakeUniqueName("staticbox", buf);
       res->SetName(buf);
-      newItem = new wxStaticBox(panel, -1, "Groupbox", wxPoint(x, y), wxSize(200, 200), 0, buf);
+      newItem = new wxStaticBox(panel, -1, "Static", wxPoint(x, y), wxSize(200, 200), 0, buf);
     }
   else if (itemType == "wxGauge")
     {
+      prefix = "ID_GAUGE";
       MakeUniqueName("gauge", buf);
       res->SetName(buf);
       newItem = new wxGauge(panel, -1, 10, wxPoint(x, y), wxSize(80, 30), wxHORIZONTAL, wxDefaultValidator, buf);
     }
   else if (itemType == "wxSlider")
     {
+      prefix = "ID_SLIDER";
       MakeUniqueName("slider", buf);
       res->SetName(buf);
       newItem = new wxSlider(panel, -1, 1, 1, 10, wxPoint(x, y), wxSize(120, -1), wxHORIZONTAL, wxDefaultValidator, buf);
     }
   else if (itemType == "wxText" || itemType == "wxTextCtrl (single-line)")
     {
+      prefix = "ID_TEXTCTRL";
       MakeUniqueName("textctrl", buf);
       res->SetName(buf);
       res->SetType("wxTextCtrl");
@@ -1005,6 +1085,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
     }
   else if (itemType == "wxMultiText" || itemType == "wxTextCtrl (multi-line)")
     {
+      prefix = "ID_TEXTCTRL";
       MakeUniqueName("textctrl", buf);
       res->SetName(buf);
       res->SetType("wxTextCtrl");
@@ -1012,6 +1093,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
     }
   else if (itemType == "wxScrollBar")
     {
+      prefix = "ID_SCROLLBAR";
       MakeUniqueName("scrollbar", buf);
       res->SetName(buf);
       newItem = new wxScrollBar(panel, -1, wxPoint(x, y), wxSize(140, -1), wxHORIZONTAL, wxDefaultValidator, buf);
@@ -1019,6 +1101,13 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
   if (!newItem)
     return FALSE;
 
+  wxString newIdName;
+  int id = GenerateWindowId(prefix, newIdName);
+  res->SetId(id);
+
+  // This is now guaranteed to be unique, so just add to symbol table
+  m_symbolTable.AddSymbol(newIdName, id);
+
   newItem->PushEventHandler(new wxResourceEditorControlHandler(newItem, newItem));
 
   res->SetStyle(newItem->GetWindowStyleFlag());
@@ -1042,6 +1131,33 @@ void wxResourceManager::ClearCurrentDialog()
   }
 }
 
+bool wxResourceManager::TestCurrentDialog(wxWindow* parent)
+{
+  if (m_editorPanel->m_childWindow)
+  {
+    wxItemResource* item = FindResourceForWindow(m_editorPanel->m_childWindow);
+    if (!item)
+        return FALSE;
+
+    // Make sure the resources are up-to-date w.r.t. the window
+    InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE);
+
+    wxDialog* dialog = new wxDialog;
+    long oldStyle = item->GetStyle();
+    bool success = FALSE;
+//    item->SetStyle(wxDEFAULT_DIALOG_STYLE);
+    if (dialog->LoadFromResource(parent, item->GetName(), & m_resourceTable))
+    {
+        dialog->Centre();
+        dialog->ShowModal();
+        success = TRUE;
+    }
+//    item->SetStyle(oldStyle);
+    return success;
+  }
+  return FALSE;
+}
+
 // Find the first dialog or panel for which
 // there is a selected panel item.
 wxWindow *wxResourceManager::FindParentOfSelection()
@@ -1270,6 +1386,12 @@ bool wxResourceManager::DeleteResource(wxItemResource *res)
     PossiblyDeleteBitmapResource(res->GetValue4());
   }
 
+  // Remove symbol from table if appropriate
+  if (!IsSymbolUsed(res, res->GetId()))
+  {
+    m_symbolTable.RemoveSymbol(res->GetId());
+  }
+
   m_resourceTable.Delete(res->GetName());
   delete res;
   Modify(TRUE);
@@ -1419,6 +1541,145 @@ wxItemResource *wxResourceManager::FindBitmapResourceByFilename(char *filename)
   return NULL;
 }
 
+// Is this window identifier symbol in use?
+// Let's assume that we can't have 2 names for the same integer id.
+// Therefore we can tell by the integer id whether the symbol is
+// in use.
+bool wxResourceManager::IsSymbolUsed(wxItemResource* thisResource, wxWindowID id)
+{
+  m_resourceTable.BeginFind();
+  wxNode *node;
+  while (node = m_resourceTable.Next())
+  {
+    wxItemResource *res = (wxItemResource *)node->Data();
+
+    wxString resType(res->GetType());
+    if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel")
+    {
+      if ((res != thisResource) && (res->GetId() == id))
+          return TRUE;
+
+      wxNode *node1 = res->GetChildren().First();
+      while (node1)
+      {
+        wxItemResource *child = (wxItemResource *)node1->Data();
+        if ((child != thisResource) && (child->GetId() == id))
+          return TRUE;
+        node1 = node1->Next();
+      }
+    }
+  }
+  return FALSE;
+}
+
+// Is this window identifier compatible with the given name? (i.e.
+// does it already exist under a different name)
+bool wxResourceManager::IsIdentifierOK(const wxString& name, wxWindowID id)
+{
+    if (m_symbolTable.SymbolExists(name))
+    {
+        int foundId = m_symbolTable.GetIdForSymbol(name);
+        if (foundId != id)
+            return FALSE;
+    }
+    return TRUE;
+}
+
+// Change all integer ids that match oldId, to newId.
+// This is necessary if an id is changed for one resource - all resources
+// must be changed.
+void wxResourceManager::ChangeIds(int oldId, int newId)
+{
+  m_resourceTable.BeginFind();
+  wxNode *node;
+  while (node = m_resourceTable.Next())
+  {
+    wxItemResource *res = (wxItemResource *)node->Data();
+
+    wxString resType(res->GetType());
+    if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel")
+    {
+      if (res->GetId() == oldId)
+          res->SetId(newId);
+
+      wxNode *node1 = res->GetChildren().First();
+      while (node1)
+      {
+        wxItemResource *child = (wxItemResource *)node1->Data();
+        if (child->GetId() == oldId)
+            child->SetId(newId);
+
+        node1 = node1->Next();
+      }
+    }
+  }
+}
+
+// If any resource ids were missing (or their symbol was missing),
+// repair them i.e. give them new ids. Returns TRUE if any resource
+// needed repairing.
+bool wxResourceManager::RepairResourceIds()
+{
+  bool repaired = FALSE;
+
+  m_resourceTable.BeginFind();
+  wxNode *node;
+  while (node = m_resourceTable.Next())
+  {
+    wxItemResource *res = (wxItemResource *)node->Data();
+    wxString resType(res->GetType());
+    if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel")
+    {
+
+      if ( (res->GetId() == 0) || ((res->GetId() > 0) && !m_symbolTable.IdExists(res->GetId())) )
+      {
+          wxString newSymbolName;
+          int newId = GenerateWindowId("ID_DIALOG", newSymbolName) ;
+
+          if (res->GetId() == 0)
+          {
+              res->SetId(newId);
+              m_symbolTable.AddSymbol(newSymbolName, newId);
+          }
+          else
+          {
+              m_symbolTable.AddSymbol(newSymbolName, res->GetId());
+          }
+
+          repaired = TRUE;
+      }
+
+      wxNode *node1 = res->GetChildren().First();
+      while (node1)
+      {
+        wxItemResource *child = (wxItemResource *)node1->Data();
+
+        if ( (child->GetId() == 0) || ((child->GetId() > 0) && !m_symbolTable.IdExists(child->GetId())) )
+        {
+            wxString newSymbolName;
+            int newId = GenerateWindowId("ID_CONTROL", newSymbolName) ;
+
+            if (child->GetId() == 0)
+            {
+                child->SetId(newId);
+                m_symbolTable.AddSymbol(newSymbolName, newId);
+            }
+            else
+            {
+                m_symbolTable.AddSymbol(newSymbolName, child->GetId());
+            }
+
+            repaired = TRUE;
+        }
+
+        node1 = node1->Next();
+      }
+    }
+  }
+  return repaired;
+}
+
+
  // Deletes 'win' and creates a new window from the resource that
  // was associated with it. E.g. if you can't change properties on the
  // fly, you'll need to delete the window and create it again.
@@ -1448,8 +1709,12 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
   else
   {
     DisassociateResource(resource);
+    if (win->GetEventHandler() != win)
+        win->PopEventHandler(TRUE);
+
     DeleteWindow(win);
     newWin = m_resourceTable.CreateItem((wxPanel *)parent, resource);
+    newWin->PushEventHandler(new wxResourceEditorControlHandler((wxControl*) newWin, (wxControl*) newWin));
     AssociateResource(resource, newWin);
     UpdateResourceList();
   }
@@ -1467,7 +1732,7 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
 bool wxResourceManager::DeleteSelection()
 {
   int sel = m_editorResourceTree->GetSelection();
-  if (sel > -1)
+  if (sel != 0)
   {
     wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel);
     wxWindow *win = FindWindowForResource(res);
@@ -1598,10 +1863,18 @@ wxWindowPropertyInfo *wxResourceManager::CreatePropertyInfoForWindow(wxWindow *w
         {
           info = new wxRadioBoxPropertyInfo(win);
         }
+  else if (win->IsKindOf(CLASSINFO(wxRadioButton)))
+        {
+          info = new wxRadioButtonPropertyInfo(win);
+        }
   else if (win->IsKindOf(CLASSINFO(wxChoice)))
         {
           info = new wxChoicePropertyInfo(win);
         }
+  else if (win->IsKindOf(CLASSINFO(wxComboBox)))
+        {
+          info = new wxComboBoxPropertyInfo(win);
+        }
   else if (win->IsKindOf(CLASSINFO(wxButton)))
         {
           info = new wxButtonPropertyInfo(win);
@@ -1651,6 +1924,29 @@ void wxResourceManager::EditWindow(wxWindow *win)
   }
 }
 
+// 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
@@ -1729,7 +2025,7 @@ void wxResourceEditorFrame::OnAbout(wxCommandEvent& event)
 
 void wxResourceEditorFrame::OnTest(wxCommandEvent& event)
 {
-    // TODO should show the current dialog
+    manager->TestCurrentDialog(this);
 }
 
 void wxResourceEditorFrame::OnContents(wxCommandEvent& event)
@@ -1773,7 +2069,6 @@ bool wxResourceEditorFrame::OnClose()
   }
   manager->SetEditorFrame(NULL);
   manager->SetEditorToolBar(NULL);
-  manager->SetEditorPalette(NULL);
 
   return TRUE;
 }
@@ -1878,8 +2173,8 @@ BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar)
 END_EVENT_TABLE()
 
 EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& size,
-            long style, int direction, int RowsOrColumns):
-  wxToolBar(frame, -1, pos, size, style, direction, RowsOrColumns)
+            long style):
+  wxToolBar(frame, -1, pos, size, style)
 {
 }