]> git.saurik.com Git - wxWidgets.git/commitdiff
Major changes to Dialog Editor (still at alpha level)
authorJulian Smart <julian@anthemion.co.uk>
Thu, 2 Jul 1998 15:19:34 +0000 (15:19 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 2 Jul 1998 15:19:34 +0000 (15:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

16 files changed:
utils/dialoged/src/dialoged.cpp
utils/dialoged/src/dialoged.h
utils/dialoged/src/dialoged.rc
utils/dialoged/src/dlghndlr.cpp
utils/dialoged/src/dlghndlr.h
utils/dialoged/src/editrpal.cpp
utils/dialoged/src/edlist.cpp [new file with mode: 0644]
utils/dialoged/src/edlist.h [new file with mode: 0644]
utils/dialoged/src/edtree.cpp [new file with mode: 0644]
utils/dialoged/src/edtree.h [new file with mode: 0644]
utils/dialoged/src/makefile.nt
utils/dialoged/src/reseditr.cpp
utils/dialoged/src/reseditr.h
utils/dialoged/src/reswrite.cpp
utils/dialoged/src/winprop.cpp
utils/dialoged/src/winprop.h

index 1abe2b507caf850fcea99202ea8fa68a61cfefe8..bde94cba52c2a7cdf84893b882bbf47867dd1201 100644 (file)
@@ -36,18 +36,26 @@ MyApp::MyApp(void)
 {
 }
 
 {
 }
 
-wxResourceManager theResourceManager;
+wxResourceManager *theResourceManager = NULL;
 
 bool MyApp::OnInit(void)
 {
 
 bool MyApp::OnInit(void)
 {
-  theResourceManager.Initialize();
-  theResourceManager.ShowResourceEditor(TRUE);
+    theResourceManager = new wxResourceManager;
+    theResourceManager->Initialize();
+
+    theResourceManager->ShowResourceEditor(TRUE);
   
   
-  if (argc > 1)
-    theResourceManager.Load(argv[1]);
+    if (argc > 1)
+        theResourceManager->Load(argv[1]);
 
 
-  SetTopWindow(theResourceManager.GetEditorFrame());
+    SetTopWindow(theResourceManager->GetEditorFrame());
 
 
-  return TRUE;
+    return TRUE;
 }
 
 }
 
+int MyApp::OnExit(void)
+{
+    delete theResourceManager;
+    theResourceManager = NULL;
+    return 0;
+}
index b7265ba16431b3e3fd2165c8f7bdf2dc311f3714..99442bdc25bd3f060a2be468ab21e2920a6d5dd8 100644 (file)
@@ -27,6 +27,7 @@ class MyApp: public wxApp
   public:
     MyApp(void);
     bool OnInit(void);
   public:
     MyApp(void);
     bool OnInit(void);
+    int OnExit(void);
 };
 
 DECLARE_APP(MyApp)
 };
 
 DECLARE_APP(MyApp)
index 1d57e4630ce56182a3048c6626fb1455b4ca0032..5328ff66abec9a966a244974859880d6449c99f2 100644 (file)
@@ -1,7 +1,31 @@
-aaa             ICON "dialoged.ico"
-DIALOGEDICON    ICON "dialoged.ico"
+aaa             ICON "bitmaps/dialoged.ico"
+DIALOGEDICON    ICON "bitmaps/dialoged.ico"
 
 
-aiai_icn                ICON    "aiai.ico"
+DIALOG_ICON     ICON "bitmaps/dialog.ico"
+FOLDER1_ICON    ICON "bitmaps/folder1.ico"
+FOLDER2_ICON    ICON "bitmaps/folder2.ico"
+BUTTONSM_ICON   ICON "bitmaps/buttonsm.ico"
+
+/* For control list */
+ARROW_ICON      ICON "bitmaps/arrow.ico"
+BUTTON_ICON     ICON "bitmaps/button.ico"
+BMPBUTTON_ICON  ICON "bitmaps/bmpbuttn.ico"
+STATICTEXT_ICON ICON "bitmaps/stattext.ico"
+STATICBMP_ICON  ICON "bitmaps/statbmp.ico"
+STATICBOX_ICON  ICON "bitmaps/statbox.ico"
+TEXTSING_ICON   ICON "bitmaps/textsing.ico"
+TEXTMULT_ICON   ICON "bitmaps/textmult.ico"
+LISTBOX_ICON    ICON "bitmaps/listbox.ico"
+CHOICE_ICON     ICON "bitmaps/choice.ico"
+COMBOBOX_ICON   ICON "bitmaps/combobox.ico"
+CHECKBOX_ICON   ICON "bitmaps/checkbox.ico"
+SLIDER_ICON     ICON "bitmaps/slider.ico"
+GAUGE_ICON      ICON "bitmaps/gauge.ico"
+RADIOBOX_ICON   ICON "bitmaps/radiobox.ico"
+RADIOBTN_ICON   ICON "bitmaps/radiobtn.ico"
+SCROLBAR_ICON   ICON "bitmaps/scrolbar.ico"
+
+aiai_icn        ICON  "bitmaps/aiai.ico"
 #include "wx/msw/wx.rc"
 
 DIALOGBOXTOOL   BITMAP "bitmaps/dialog.bmp"
 #include "wx/msw/wx.rc"
 
 DIALOGBOXTOOL   BITMAP "bitmaps/dialog.bmp"
index 3cea11c606a463fbd3c957b03d7f593b77e05804..f27188ac945dfea77661d001e34158299dfb43ee 100644 (file)
@@ -39,8 +39,7 @@
 #include "winprop.h"
 #include "editrpal.h"
 #include "dlghndlr.h"
 #include "winprop.h"
 #include "editrpal.h"
 #include "dlghndlr.h"
-
-extern void wxResourceEditWindow(wxWindow *win);
+#include "edlist.h"
 
 IMPLEMENT_CLASS(wxResourceEditorDialogHandler, wxEvtHandler)
 IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler)
 
 IMPLEMENT_CLASS(wxResourceEditorDialogHandler, wxEvtHandler)
 IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler)
@@ -75,6 +74,12 @@ wxResourceEditorDialogHandler::wxResourceEditorDialogHandler(wxPanel *dialog, wx
   oldDragY = 0;
   dragTolerance = 3;
   checkTolerance = TRUE;
   oldDragY = 0;
   dragTolerance = 3;
   checkTolerance = TRUE;
+  m_mouseCaptured = FALSE;
+//  m_treeItem = 0;
+}
+
+wxResourceEditorDialogHandler::~wxResourceEditorDialogHandler(void)
+{
 }
 
 void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select)
 }
 
 void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select)
@@ -85,34 +90,6 @@ void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select)
     resourceManager->RemoveSelection(item);
 }
 
     resourceManager->RemoveSelection(item);
 }
 
-bool wxResourceEditorDialogHandler::OnClose(void)
-{
-  handlerDialog->PopEventHandler();
-
-  // Now reset all child event handlers
-  wxNode *node = handlerDialog->GetChildren()->First();
-  while ( node )
-  {
-       wxWindow *child = (wxWindow *)node->Data();
-       wxEvtHandler *childHandler = child->GetEventHandler();
-       if ( child->IsKindOf(CLASSINFO(wxControl)) && childHandler != child )
-       {
-               child->PopEventHandler();
-               delete childHandler;
-       }
-       node = node->Next();
-  }
-  
-  // Save the information before deleting the dialog.
-  resourceManager->InstantiateResourceFromWindow(handlerResource, handlerDialog, TRUE);
-  
-  resourceManager->DisassociateResource(handlerDialog, FALSE);
-
-  handlerDialog->Show(FALSE);
-  delete this;
-  return TRUE;
-}
-
 void wxResourceEditorDialogHandler::OnPaint(wxPaintEvent& event)
 {
        wxPaintDC dc(handlerDialog);
 void wxResourceEditorDialogHandler::OnPaint(wxPaintEvent& event)
 {
        wxPaintDC dc(handlerDialog);
@@ -138,7 +115,99 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
 {
   if (keys & wxKEY_CTRL)
   {
 {
   if (keys & wxKEY_CTRL)
   {
-    wxResourceEditWindow(handlerDialog);
+    wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog);
+    return;
+  }
+
+  // Deselect all items if click on panel
+  if (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection() == RESED_POINTER)
+  {
+    int needsRefresh = 0;
+    wxNode *node = handlerDialog->GetChildren()->First();
+    while (node)
+    {
+      wxControl *item = (wxControl *)node->Data();
+         wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
+      if (item->IsKindOf(CLASSINFO(wxControl)) && childHandler->IsSelected())
+      {
+        needsRefresh ++;
+        OnItemSelect(item, FALSE);
+        childHandler->SelectItem(FALSE);
+      }
+      node = node->Next();
+    }
+    if (needsRefresh > 0)
+    {
+         wxClientDC dc(handlerDialog);
+      dc.Clear();
+      handlerDialog->Refresh();
+    }
+    return;
+  }
+
+  wxResourceManager* manager = resourceManager;
+
+  switch (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection())
+  {
+        case RESED_BUTTON:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y);
+          break;
+        case RESED_BMPBUTTON:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxBitmapButton", x, y, TRUE);
+          break;
+        case RESED_STATICTEXT:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticText", x, y);
+          break;
+        case RESED_STATICBMP:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBitmap", x, y, TRUE);
+          break;
+        case RESED_TEXTCTRL_SINGLE:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (single-line)", x, y);
+          break;
+        case RESED_TEXTCTRL_MULTIPLE:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (multi-line)", x, y);
+          break;
+        case RESED_CHOICE:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y);
+          break;
+        case RESED_CHECKBOX:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxCheckBox", x, y);
+          break;
+        case RESED_RADIOBOX:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioBox", x, y);
+          break;
+        case RESED_LISTBOX:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxListBox", x, y);
+          break;
+        case RESED_SLIDER:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxSlider", x, y);
+          break;
+        case RESED_GAUGE:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxGauge", x, y);
+          break;
+        case RESED_STATICBOX:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBox", x, y);
+          break;
+        case RESED_SCROLLBAR:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxScrollBar", x, y);
+          break;
+        default:
+          break;
+  }
+
+  // Now switch pointer on.
+  if (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection() != RESED_POINTER)
+  {
+    wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->SetItemState(RESED_POINTER, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+  }
+}
+
+#if 0
+void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
+{
+  if (keys & wxKEY_CTRL)
+  {
+    wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog);
     return;
   }
 
     return;
   }
 
@@ -168,6 +237,8 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
     return;
   }
 
     return;
   }
 
+  wxResourceManager* manager = resourceManager;
+
   switch (resourceManager->GetEditorPalette()->currentlySelected)
   {
         case PALETTE_FRAME:
   switch (resourceManager->GetEditorPalette()->currentlySelected)
   {
         case PALETTE_FRAME:
@@ -187,16 +258,16 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y, TRUE);
           break;
         case PALETTE_MESSAGE:
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y, TRUE);
           break;
         case PALETTE_MESSAGE:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMessage", x, y);
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticText", x, y);
           break;
         case PALETTE_BITMAP_MESSAGE:
           break;
         case PALETTE_BITMAP_MESSAGE:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMessage", x, y, TRUE);
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBitmap", x, y, TRUE);
           break;
         case PALETTE_TEXT:
           break;
         case PALETTE_TEXT:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxText", x, y);
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (single-line)", x, y);
           break;
         case PALETTE_MULTITEXT:
           break;
         case PALETTE_MULTITEXT:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMultiText", x, y);
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (multi-line)", x, y);
           break;
         case PALETTE_CHOICE:
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y);
           break;
         case PALETTE_CHOICE:
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y);
@@ -227,30 +298,27 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
   }
 
   // Now switch pointer on.
   }
 
   // Now switch pointer on.
-  if (resourceManager->GetEditorPalette()->currentlySelected != PALETTE_ARROW)
+  if (manager->GetEditorPalette()->currentlySelected != PALETTE_ARROW)
   {
   {
-    resourceManager->GetEditorPalette()->ToggleTool(resourceManager->GetEditorPalette()->currentlySelected, FALSE);
-    resourceManager->GetEditorPalette()->ToggleTool(PALETTE_ARROW, TRUE);
-    resourceManager->GetEditorPalette()->currentlySelected = PALETTE_ARROW;
+    manager->GetEditorPalette()->ToggleTool(manager->GetEditorPalette()->currentlySelected, FALSE);
+    manager->GetEditorPalette()->ToggleTool(PALETTE_ARROW, TRUE);
+    manager->GetEditorPalette()->currentlySelected = PALETTE_ARROW;
   }
 }
   }
 }
+#endif
 
 void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int keys)
 {
   wxMenu *menu = resourceManager->GetPopupMenu();
   menu->SetClientData((char *)handlerDialog);
 
 void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int keys)
 {
   wxMenu *menu = resourceManager->GetPopupMenu();
   menu->SetClientData((char *)handlerDialog);
-#ifdef __MOTIF__
-  handlerDialog->FakePopupMenu(menu, x, y);
-#else
   handlerDialog->PopupMenu(menu, x, y);
   handlerDialog->PopupMenu(menu, x, y);
-#endif
 }
 
 void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int x, int y, int keys)
 {
   if (keys & wxKEY_CTRL)
   {
 }
 
 void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int x, int y, int keys)
 {
   if (keys & wxKEY_CTRL)
   {
-    wxResourceEditWindow(item);
+    wxResourceManager::GetCurrentResourceManager()->EditWindow(item);
     return;
   }
   
     return;
   }
   
@@ -321,11 +389,7 @@ void wxResourceEditorDialogHandler::OnItemRightClick(wxControl *item, int x, int
 
   wxMenu *menu = resourceManager->GetPopupMenu();
   menu->SetClientData((char *)item);
 
   wxMenu *menu = resourceManager->GetPopupMenu();
   menu->SetClientData((char *)item);
-#ifdef __MOTIF__
-  handlerDialog->FakePopupMenu(menu, x, y);
-#else
   handlerDialog->PopupMenu(menu, x, y);
   handlerDialog->PopupMenu(menu, x, y);
-#endif
 }
 
 // An event outside any items: may be a drag event.
 }
 
 // An event outside any items: may be a drag event.
@@ -371,9 +435,25 @@ void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event)
     if (event.ControlDown()) keys = keys | wxKEY_CTRL;
 
     if (event.LeftUp())
     if (event.ControlDown()) keys = keys | wxKEY_CTRL;
 
     if (event.LeftUp())
-      OnLeftClick(x, y, keys);
+    {
+        if (m_mouseCaptured)
+        {
+            handlerDialog->ReleaseMouse();
+            m_mouseCaptured = FALSE;
+        }
+
+        OnLeftClick(x, y, keys);
+    }
     else if (event.RightUp())
     else if (event.RightUp())
-      OnRightClick(x, y, keys);
+    {
+        if (m_mouseCaptured)
+        {
+            handlerDialog->ReleaseMouse();
+            m_mouseCaptured = FALSE;
+        }
+
+        OnRightClick(x, y, keys);
+    }
   }
   else
        event.Skip();
   }
   else
        event.Skip();
@@ -420,12 +500,27 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
         checkTolerance = FALSE;
       }
   }
         checkTolerance = FALSE;
       }
   }
-  if (dragging && dragItem && dragMode == wxDRAG_MODE_START_LEFT)
+  if (event.LeftDClick())
+  {
+      if (m_mouseCaptured)
+      {
+        handlerDialog->ReleaseMouse();
+        m_mouseCaptured = FALSE;
+      }
+
+      wxResourceManager::GetCurrentResourceManager()->EditWindow(item);
+  }
+  else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_LEFT)
   {
     dragMode = wxDRAG_MODE_CONTINUE_LEFT;
        wxClientDC dc(handlerDialog);
     childHandler->OnDragBegin(x, y, keys, dc, selectionHandle);
     oldDragX = x; oldDragY = y;
   {
     dragMode = wxDRAG_MODE_CONTINUE_LEFT;
        wxClientDC dc(handlerDialog);
     childHandler->OnDragBegin(x, y, keys, dc, selectionHandle);
     oldDragX = x; oldDragY = y;
+    if (!m_mouseCaptured)
+    {
+        handlerDialog->CaptureMouse();
+        m_mouseCaptured = TRUE;
+    }
   }
   else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT)
   { 
   }
   else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT)
   { 
@@ -439,10 +534,18 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
        wxClientDC dc(handlerDialog);
     dragMode = wxDRAG_MODE_NONE;
     checkTolerance = TRUE;
        wxClientDC dc(handlerDialog);
     dragMode = wxDRAG_MODE_NONE;
     checkTolerance = TRUE;
+
     childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle);
     childHandler->OnDragEnd(x, y, keys, dc, selectionHandle);
     childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle);
     childHandler->OnDragEnd(x, y, keys, dc, selectionHandle);
+
     dragItem = NULL;
     dragType = wxDRAG_TYPE_NONE;
     dragItem = NULL;
     dragType = wxDRAG_TYPE_NONE;
+
+    if (m_mouseCaptured)
+    {
+        handlerDialog->ReleaseMouse();
+        m_mouseCaptured = FALSE;
+    }
   }
   else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_RIGHT)
   {
   }
   else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_RIGHT)
   {
@@ -450,6 +553,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
     dragMode = wxDRAG_MODE_CONTINUE_RIGHT;
     childHandler->OnDragBegin(x, y, keys, dc, selectionHandle);
     oldDragX = x; oldDragY = y;
     dragMode = wxDRAG_MODE_CONTINUE_RIGHT;
     childHandler->OnDragBegin(x, y, keys, dc, selectionHandle);
     oldDragX = x; oldDragY = y;
+
+    if (!m_mouseCaptured)
+    {
+        handlerDialog->CaptureMouse();
+        m_mouseCaptured = TRUE;
+    }
   }
   else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT)
   { 
   }
   else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT)
   { 
@@ -461,6 +570,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
     checkTolerance = TRUE;
     dragItem = NULL;
     dragType = wxDRAG_TYPE_NONE;
     checkTolerance = TRUE;
     dragItem = NULL;
     dragType = wxDRAG_TYPE_NONE;
+
+    if (m_mouseCaptured)
+    {
+        handlerDialog->ReleaseMouse();
+        m_mouseCaptured = FALSE;
+    }
   }
   else if (event.IsButton())
   {
   }
   else if (event.IsButton())
   {
@@ -473,6 +588,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
       firstDragX = x;
       firstDragY = y;
       dragType = selectionHandle;
       firstDragX = x;
       firstDragY = y;
       dragType = selectionHandle;
+
+      if (!m_mouseCaptured)
+      {
+        handlerDialog->CaptureMouse();
+        m_mouseCaptured = TRUE;
+      }
     }
     else if (event.RightDown())
     {
     }
     else if (event.RightDown())
     {
@@ -481,6 +602,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
       firstDragX = x;
       firstDragY = y;
       dragType = selectionHandle;
       firstDragX = x;
       firstDragY = y;
       dragType = selectionHandle;
+
+      if (!m_mouseCaptured)
+      {
+        handlerDialog->CaptureMouse();
+        m_mouseCaptured = TRUE;
+      }
     }
     else if (event.LeftUp())
     {
     }
     else if (event.LeftUp())
     {
@@ -490,6 +617,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
         OnLeftClick(x, y, keys);
 
       dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE;
         OnLeftClick(x, y, keys);
 
       dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE;
+
+      if (m_mouseCaptured)
+      {
+        handlerDialog->ReleaseMouse();
+        m_mouseCaptured = FALSE;
+      }
     }
     else if (event.RightUp())
     {
     }
     else if (event.RightUp())
     {
@@ -499,6 +632,12 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
         OnRightClick(x, y, keys);
 
       dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE;
         OnRightClick(x, y, keys);
 
       dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE;
+
+      if (m_mouseCaptured)
+      {
+        handlerDialog->ReleaseMouse();
+        m_mouseCaptured = FALSE;
+      }
     }
   }
 }
     }
   }
 }
@@ -549,6 +688,11 @@ wxResourceEditorControlHandler::wxResourceEditorControlHandler(wxControl *contro
   isSelected = FALSE;
   dragOffsetX = 0;
   dragOffsetY = 0;
   isSelected = FALSE;
   dragOffsetX = 0;
   dragOffsetY = 0;
+//  m_treeItem = 0;
+}
+
+wxResourceEditorControlHandler::~wxResourceEditorControlHandler(void)
+{
 }
 
 /*
 }
 
 /*
@@ -679,7 +823,8 @@ void wxResourceEditorControlHandler::OnDragBegin(int x, int y, int WXUNUSED(keys
 
   dc.SetLogicalFunction(wxXOR);
 
 
   dc.SetLogicalFunction(wxXOR);
 
-  dc.SetPen(wxBLACK_DASHED_PEN);
+  wxPen pen(wxColour(0, 0, 0), 1, wxDOT);
+  dc.SetPen(pen);
   dc.SetBrush(wxTRANSPARENT_BRUSH);
 
   dc.SetOptimization(TRUE);
   dc.SetBrush(wxTRANSPARENT_BRUSH);
 
   dc.SetOptimization(TRUE);
@@ -797,7 +942,8 @@ void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y,
     dc.BeginDrawing();
 
     dc.SetLogicalFunction(wxXOR);
     dc.BeginDrawing();
 
     dc.SetLogicalFunction(wxXOR);
-    dc.SetPen(wxBLACK_DASHED_PEN);
+    wxPen pen(wxColour(0, 0, 0), 1, wxDOT);
+    dc.SetPen(pen);
     dc.SetBrush(wxTRANSPARENT_BRUSH);
 
     DrawBoundingBox(dc, x1, y1, width1, height1);
     dc.SetBrush(wxTRANSPARENT_BRUSH);
 
     DrawBoundingBox(dc, x1, y1, width1, height1);
@@ -807,9 +953,9 @@ void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y,
   else
   {
       dc.BeginDrawing();
   else
   {
       dc.BeginDrawing();
-
       dc.SetLogicalFunction(wxXOR);
       dc.SetLogicalFunction(wxXOR);
-      dc.SetPen(wxBLACK_DASHED_PEN);
+      wxPen pen(wxColour(0, 0, 0), 1, wxDOT);
+      dc.SetPen(pen);
       dc.SetBrush(wxTRANSPARENT_BRUSH);
 
       DrawBoundingBox(dc, (int)(x - dragOffsetX), (int)(y - dragOffsetY), width, height);
       dc.SetBrush(wxTRANSPARENT_BRUSH);
 
       DrawBoundingBox(dc, (int)(x - dragOffsetX), (int)(y - dragOffsetY), width, height);
@@ -835,7 +981,6 @@ void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y,
         }
         node = node->Next();
       }
         }
         node = node->Next();
       }
-
       dc.EndDrawing();
   }
 }
       dc.EndDrawing();
   }
 }
@@ -936,7 +1081,6 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
       node = node->Next();
     }
   }
       node = node->Next();
     }
   }
-
   dc.SetOptimization(FALSE);
 
   dc.SetLogicalFunction(wxCOPY);
   dc.SetOptimization(FALSE);
 
   dc.SetLogicalFunction(wxCOPY);
@@ -960,9 +1104,11 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
 // by default.
 void wxResourceEditorControlHandler::OnMouseEvent(wxMouseEvent& event)
 {
 // by default.
 void wxResourceEditorControlHandler::OnMouseEvent(wxMouseEvent& event)
 {
+/*
   if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) ||
       (event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK))
     return;
   if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) ||
       (event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK))
     return;
+*/
   wxWindow *panel = handlerControl->GetParent();
   if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) )
        return;
   wxWindow *panel = handlerControl->GetParent();
   if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) )
        return;
index aced1272c7d657e19d77f1a08c2096adc3baf544..5d2369c421ccb90e13fc87f293be16b0f6ae146a 100644 (file)
@@ -41,12 +41,12 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
   int firstDragY;
   int oldDragX;
   int oldDragY;
   int firstDragY;
   int oldDragX;
   int oldDragY;
+  bool                      m_mouseCaptured;
+//  long                      m_treeItem;
 
   wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler,
      wxResourceManager *manager);
 
   wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler,
      wxResourceManager *manager);
-  ~wxResourceEditorDialogHandler(void) {}
-
-  bool OnClose(void);
+  ~wxResourceEditorDialogHandler(void);
 
   void OnPaint(wxPaintEvent& event);
   void OnMouseEvent(wxMouseEvent& event);
 
   void OnPaint(wxPaintEvent& event);
   void OnMouseEvent(wxMouseEvent& event);
@@ -64,6 +64,12 @@ DECLARE_CLASS(wxResourceEditorDialogHandler)
   void PaintSelectionHandles(wxDC& dc);
   void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle);
 
   void PaintSelectionHandles(wxDC& dc);
   void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle);
 
+// Accessors
+/*
+  inline long GetTreeItem() const { return m_treeItem; }
+  inline void SetTreeItem(long item) { m_treeItem = item; }
+*/
+
 DECLARE_EVENT_TABLE()
 };
 
 DECLARE_EVENT_TABLE()
 };
 
@@ -79,11 +85,12 @@ DECLARE_CLASS(wxResourceEditorControlHandler)
   bool isSelected;
   int handleSize;   // selection handle size
   int handleMargin; // Distance between item edge and handle edge
   bool isSelected;
   int handleSize;   // selection handle size
   int handleMargin; // Distance between item edge and handle edge
+  long                  m_treeItem;
   static int dragOffsetX;  // Distance between pointer at start of drag and
   static int dragOffsetY;  // top-left of item
 
   wxResourceEditorControlHandler(wxControl *control, wxEvtHandler *oldHandler);
   static int dragOffsetX;  // Distance between pointer at start of drag and
   static int dragOffsetY;  // top-left of item
 
   wxResourceEditorControlHandler(wxControl *control, wxEvtHandler *oldHandler);
-  ~wxResourceEditorControlHandler(void) {}
+  ~wxResourceEditorControlHandler(void);
 
   void OnMouseEvent(wxMouseEvent& event);
 
 
   void OnMouseEvent(wxMouseEvent& event);
 
@@ -116,6 +123,12 @@ DECLARE_CLASS(wxResourceEditorControlHandler)
   virtual void OnRightClick(int x, int y, int keys);
   virtual void OnSelect(bool select);
 
   virtual void OnRightClick(int x, int y, int keys);
   virtual void OnSelect(bool select);
 
+// Accessors
+/*
+  inline long GetTreeItem() const { return m_treeItem; }
+  inline void SetTreeItem(long item) { m_treeItem = item; }
+*/
+
 DECLARE_EVENT_TABLE()
 };
 
 DECLARE_EVENT_TABLE()
 };
 
index c9e55e019df2a1bf4b298e429b34f536f0fc771f..b73b693cdb1aa5928d9e72a28d16a21b6d63da4e 100644 (file)
 #include "reseditr.h"
 #include "editrpal.h"
 
 #include "reseditr.h"
 #include "editrpal.h"
 
-// Bitmaps for palette
-wxBitmap *PaletteFrameBitmap = NULL;
-wxBitmap *PaletteDialogBoxBitmap = NULL;
-wxBitmap *PalettePanelBitmap = NULL;
-wxBitmap *PaletteCanvasBitmap = NULL;
-wxBitmap *PaletteTextWindowBitmap = NULL;
-wxBitmap *PaletteMessageBitmap = NULL;
-wxBitmap *PaletteButtonBitmap = NULL;
-wxBitmap *PaletteCheckBoxBitmap = NULL;
-wxBitmap *PaletteListBoxBitmap = NULL;
-wxBitmap *PaletteRadioBoxBitmap = NULL;
-wxBitmap *PaletteChoiceBitmap = NULL;
-wxBitmap *PaletteTextBitmap = NULL;
-wxBitmap *PaletteMultiTextBitmap = NULL;
-wxBitmap *PaletteSliderBitmap = NULL;
-wxBitmap *PaletteArrowBitmap = NULL;
-wxBitmap *PaletteGroupBitmap = NULL;
-wxBitmap *PaletteGaugeBitmap = NULL;
-wxBitmap *PalettePictureBitmap = NULL;
-wxBitmap *PaletteBitmapButtonBitmap = NULL;
-wxBitmap *PaletteScrollbarBitmap = NULL;
-
 #ifdef __X__
 #include "bitmaps/frame.xbm"
 #include "bitmaps/dialog.xbm"
 #ifdef __X__
 #include "bitmaps/frame.xbm"
 #include "bitmaps/dialog.xbm"
@@ -142,23 +120,25 @@ void EditorToolPalette::OnMouseEnter(int toolIndex)
         case PALETTE_PANEL:
           managerFrame->SetStatusText("wxPanel");
           break;
         case PALETTE_PANEL:
           managerFrame->SetStatusText("wxPanel");
           break;
+#if 0
         case PALETTE_CANVAS:
           managerFrame->SetStatusText("wxCanvas");
           break;
         case PALETTE_TEXT_WINDOW:
           managerFrame->SetStatusText("wxTextWindow");
           break;
         case PALETTE_CANVAS:
           managerFrame->SetStatusText("wxCanvas");
           break;
         case PALETTE_TEXT_WINDOW:
           managerFrame->SetStatusText("wxTextWindow");
           break;
+#endif
         case PALETTE_BUTTON:
           managerFrame->SetStatusText("wxButton");
           break;
         case PALETTE_MESSAGE:
         case PALETTE_BUTTON:
           managerFrame->SetStatusText("wxButton");
           break;
         case PALETTE_MESSAGE:
-          managerFrame->SetStatusText("wxMessage");
+          managerFrame->SetStatusText("wxStaticText");
           break;
         case PALETTE_TEXT:
           break;
         case PALETTE_TEXT:
-          managerFrame->SetStatusText("wxText");
+          managerFrame->SetStatusText("wxTextCtrl (single-line)");
           break;
         case PALETTE_MULTITEXT:
           break;
         case PALETTE_MULTITEXT:
-          managerFrame->SetStatusText("wxMultiText");
+          managerFrame->SetStatusText("wxTextCtrl (multi-line)");
           break;
         case PALETTE_CHOICE:
           managerFrame->SetStatusText("wxChoice");
           break;
         case PALETTE_CHOICE:
           managerFrame->SetStatusText("wxChoice");
@@ -176,16 +156,16 @@ void EditorToolPalette::OnMouseEnter(int toolIndex)
           managerFrame->SetStatusText("wxSlider");
           break;
         case PALETTE_GROUPBOX:
           managerFrame->SetStatusText("wxSlider");
           break;
         case PALETTE_GROUPBOX:
-          managerFrame->SetStatusText("wxGroupBox");
+          managerFrame->SetStatusText("wxStaticBox");
           break;
         case PALETTE_GAUGE:
           managerFrame->SetStatusText("wxGauge");
           break;
         case PALETTE_BITMAP_MESSAGE:
           break;
         case PALETTE_GAUGE:
           managerFrame->SetStatusText("wxGauge");
           break;
         case PALETTE_BITMAP_MESSAGE:
-          managerFrame->SetStatusText("Bitmap wxMessage");
+          managerFrame->SetStatusText("wxStaticBitmap");
           break;
         case PALETTE_BITMAP_BUTTON:
           break;
         case PALETTE_BITMAP_BUTTON:
-          managerFrame->SetStatusText("Bitmap wxButton");
+          managerFrame->SetStatusText("wxBitmapButton");
           break;
         case PALETTE_SCROLLBAR:
           managerFrame->SetStatusText("wxScrollBar");
           break;
         case PALETTE_SCROLLBAR:
           managerFrame->SetStatusText("wxScrollBar");
@@ -211,58 +191,44 @@ void EditorToolPalette::OnPaint(wxPaintEvent& event)
   dc.DrawLine(0, h-1, w, h-1);
 }
 
   dc.DrawLine(0, h-1, w, h-1);
 }
 
-bool wxResourceManager::InitializeTools(void)
+EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
 {
   // Load palette bitmaps
 #ifdef __WINDOWS__
 {
   // Load palette bitmaps
 #ifdef __WINDOWS__
-  PaletteFrameBitmap = new wxBitmap("FRAMETOOL");
-  PaletteDialogBoxBitmap = new wxBitmap("DIALOGBOXTOOL");
-  PalettePanelBitmap = new wxBitmap("PANELTOOL");
-  PaletteCanvasBitmap = new wxBitmap("CANVASTOOL");
-  PaletteTextWindowBitmap = new wxBitmap("TEXTWINDOWTOOL");
-  PaletteMessageBitmap = new wxBitmap("MESSAGETOOL");
-  PaletteButtonBitmap = new wxBitmap("BUTTONTOOL");
-  PaletteCheckBoxBitmap = new wxBitmap("CHECKBOXTOOL");
-  PaletteListBoxBitmap = new wxBitmap("LISTBOXTOOL");
-  PaletteRadioBoxBitmap = new wxBitmap("RADIOBOXTOOL");
-  PaletteChoiceBitmap = new wxBitmap("CHOICETOOL");
-  PaletteTextBitmap = new wxBitmap("TEXTTOOL");
-  PaletteMultiTextBitmap = new wxBitmap("MULTITEXTTOOL");
-  PaletteSliderBitmap = new wxBitmap("SLIDERTOOL");
-  PaletteArrowBitmap = new wxBitmap("ARROWTOOL");
-  PaletteGroupBitmap = new wxBitmap("GROUPTOOL");
-  PaletteGaugeBitmap = new wxBitmap("GAUGETOOL");
-  PalettePictureBitmap = new wxBitmap("PICTURETOOL");
-  PaletteBitmapButtonBitmap = new wxBitmap("BMPBUTTONTOOL");
-  PaletteScrollbarBitmap = new wxBitmap("SCROLLBARTOOL");
+  wxBitmap PaletteMessageBitmap("MESSAGETOOL");
+  wxBitmap PaletteButtonBitmap("BUTTONTOOL");
+  wxBitmap PaletteCheckBoxBitmap("CHECKBOXTOOL");
+  wxBitmap PaletteListBoxBitmap("LISTBOXTOOL");
+  wxBitmap PaletteRadioBoxBitmap("RADIOBOXTOOL");
+  wxBitmap PaletteChoiceBitmap("CHOICETOOL");
+  wxBitmap PaletteTextBitmap("TEXTTOOL");
+  wxBitmap PaletteMultiTextBitmap("MULTITEXTTOOL");
+  wxBitmap PaletteSliderBitmap("SLIDERTOOL");
+  wxBitmap PaletteArrowBitmap("ARROWTOOL");
+  wxBitmap PaletteGroupBitmap("GROUPTOOL");
+  wxBitmap PaletteGaugeBitmap("GAUGETOOL");
+  wxBitmap PalettePictureBitmap("PICTURETOOL");
+  wxBitmap PaletteBitmapButtonBitmap("BMPBUTTONTOOL");
+  wxBitmap PaletteScrollbarBitmap("SCROLLBARTOOL");
 #endif
 #ifdef __X__
 #endif
 #ifdef __X__
-  PaletteFrameBitmap = new wxBitmap(frame_bits, frame_width, frame_height);
-  PaletteDialogBoxBitmap = new wxBitmap(dialog_bits, dialog_width, dialog_height);
-  PalettePanelBitmap = new wxBitmap(panel_bits, panel_width, panel_height);
-  PaletteCanvasBitmap = new wxBitmap(canvas_bits, canvas_width, canvas_height);
-  PaletteTextWindowBitmap = new wxBitmap(textsw_bits, textsw_width, textsw_height);
-  PaletteMessageBitmap = new wxBitmap(message_bits, message_width, message_height);
-  PaletteButtonBitmap = new wxBitmap(button_bits, button_width, button_height);
-  PaletteCheckBoxBitmap = new wxBitmap(check_bits, check_width, check_height);
-  PaletteListBoxBitmap = new wxBitmap(listbox_bits, listbox_width, listbox_height);
-  PaletteRadioBoxBitmap = new wxBitmap(radio_bits, radio_width, radio_height);
-  PaletteChoiceBitmap = new wxBitmap(choice_bits, choice_width, choice_height);
-  PaletteTextBitmap = new wxBitmap(text_bits, text_width, text_height);
-  PaletteMultiTextBitmap = new wxBitmap(mtext_bits, mtext_width, mtext_height);
-  PaletteSliderBitmap = new wxBitmap(slider_bits, slider_width, slider_height);
-  PaletteArrowBitmap = new wxBitmap(arrow_bits, arrow_width, arrow_height);
-  PaletteGroupBitmap = new wxBitmap(group_bits, group_width, group_height);
-  PaletteGaugeBitmap = new wxBitmap(gauge_bits, gauge_width, gauge_height);
-  PalettePictureBitmap = new wxBitmap(picture_bits, picture_width, picture_height);
-  PaletteBitmapButtonBitmap = new wxBitmap(bmpbuttn_bits, bmpbuttn_width, bmpbuttn_height);
-  PaletteScrollbarBitmap = new wxBitmap(scroll_bits, scroll_width, scroll_height);
+  wxBitmap PaletteMessageBitmap(message_bits, message_width, message_height);
+  wxBitmap PaletteButtonBitmap(button_bits, button_width, button_height);
+  wxBitmap PaletteCheckBoxBitmap(check_bits, check_width, check_height);
+  wxBitmap PaletteListBoxBitmap(listbox_bits, listbox_width, listbox_height);
+  wxBitmap PaletteRadioBoxBitmap(radio_bits, radio_width, radio_height);
+  wxBitmap PaletteChoiceBitmap(choice_bits, choice_width, choice_height);
+  wxBitmap PaletteTextBitmap(text_bits, text_width, text_height);
+  wxBitmap PaletteMultiTextBitmap(mtext_bits, mtext_width, mtext_height);
+  wxBitmap PaletteSliderBitmap(slider_bits, slider_width, slider_height);
+  wxBitmap PaletteArrowBitmap(arrow_bits, arrow_width, arrow_height);
+  wxBitmap PaletteGroupBitmap(group_bits, group_width, group_height);
+  wxBitmap PaletteGaugeBitmap(gauge_bits, gauge_width, gauge_height);
+  wxBitmap PalettePictureBitmap(picture_bits, picture_width, picture_height);
+  wxBitmap PaletteBitmapButtonBitmap(bmpbuttn_bits, bmpbuttn_width, bmpbuttn_height);
+  wxBitmap PaletteScrollbarBitmap(scroll_bits, scroll_width, scroll_height);
 #endif
 #endif
-  return TRUE;
-}
 
 
-EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
-{
   EditorToolPalette *palette = new EditorToolPalette(this, parent, 0, 0, -1, -1, wxNO_BORDER, // wxTB_3DBUTTONS,
                                         wxVERTICAL, 1);
   
   EditorToolPalette *palette = new EditorToolPalette(this, parent, 0, 0, -1, -1, wxNO_BORDER, // wxTB_3DBUTTONS,
                                         wxVERTICAL, 1);
   
@@ -274,28 +240,19 @@ EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
 #endif
 */
 
 #endif
 */
 
-//  palette->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH);
   palette->AddTool(PALETTE_ARROW, PaletteArrowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Pointer");
   palette->AddTool(PALETTE_ARROW, PaletteArrowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Pointer");
-/*
-  palette->AddTool(PALETTE_FRAME, PaletteFrameBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxFrame");
-  palette->AddTool(PALETTE_DIALOG_BOX, PaletteDialogBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxDialog");
-  palette->AddTool(PALETTE_PANEL, PalettePanelBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxPanel");
-  palette->AddTool(PALETTE_CANVAS, PaletteCanvasBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxCanvas");
-  palette->AddTool(PALETTE_TEXT_WINDOW, PaletteTextWindowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxTextWindow");
-
-*/
-  palette->AddTool(PALETTE_MESSAGE, PaletteMessageBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxMessage");
-  palette->AddTool(PALETTE_BITMAP_MESSAGE, PalettePictureBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Picture wxMessage");
+  palette->AddTool(PALETTE_MESSAGE, PaletteMessageBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxStaticText");
+  palette->AddTool(PALETTE_BITMAP_MESSAGE, PalettePictureBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxStaticBitmap");
   palette->AddTool(PALETTE_BUTTON, PaletteButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Button");
   palette->AddTool(PALETTE_BUTTON, PaletteButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Button");
-  palette->AddTool(PALETTE_BITMAP_BUTTON, PaletteBitmapButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Picture wxButton");
+  palette->AddTool(PALETTE_BITMAP_BUTTON, PaletteBitmapButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxBitmapButton");
   palette->AddTool(PALETTE_CHECKBOX, PaletteCheckBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxCheckBox");
   palette->AddTool(PALETTE_RADIOBOX, PaletteRadioBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxRadioBox");
   palette->AddTool(PALETTE_LISTBOX, PaletteListBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxListBox");
   palette->AddTool(PALETTE_CHOICE, PaletteChoiceBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxChoice");
   palette->AddTool(PALETTE_CHECKBOX, PaletteCheckBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxCheckBox");
   palette->AddTool(PALETTE_RADIOBOX, PaletteRadioBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxRadioBox");
   palette->AddTool(PALETTE_LISTBOX, PaletteListBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxListBox");
   palette->AddTool(PALETTE_CHOICE, PaletteChoiceBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxChoice");
-  palette->AddTool(PALETTE_TEXT, PaletteTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxText");
-  palette->AddTool(PALETTE_MULTITEXT, PaletteMultiTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxMultiText");
+  palette->AddTool(PALETTE_TEXT, PaletteTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxTextCtrl (single-line)");
+  palette->AddTool(PALETTE_MULTITEXT, PaletteMultiTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxTextCtrl (multi-line)");
   palette->AddTool(PALETTE_SLIDER, PaletteSliderBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxSlider");
   palette->AddTool(PALETTE_SLIDER, PaletteSliderBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxSlider");
-  palette->AddTool(PALETTE_GROUPBOX, PaletteGroupBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxGroupBox");
+  palette->AddTool(PALETTE_GROUPBOX, PaletteGroupBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxStaticBox");
   palette->AddTool(PALETTE_GAUGE, PaletteGaugeBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxGauge");
   palette->AddTool(PALETTE_SCROLLBAR, PaletteScrollbarBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxScrollBar");
 
   palette->AddTool(PALETTE_GAUGE, PaletteGaugeBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxGauge");
   palette->AddTool(PALETTE_SCROLLBAR, PaletteScrollbarBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxScrollBar");
 
diff --git a/utils/dialoged/src/edlist.cpp b/utils/dialoged/src/edlist.cpp
new file mode 100644 (file)
index 0000000..57ddca9
--- /dev/null
@@ -0,0 +1,144 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        edlist.cpp
+// Purpose:     Resource editor project management tree
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "edlist.h"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+
+#include "wx/checkbox.h"
+#include "wx/button.h"
+#include "wx/choice.h"
+#include "wx/listbox.h"
+#include "wx/radiobox.h"
+#include "wx/statbox.h"
+#include "wx/gauge.h"
+#include "wx/slider.h"
+#include "wx/textctrl.h"
+#endif
+
+#include "edlist.h"
+#include "reseditr.h"
+
+BEGIN_EVENT_TABLE(wxResourceEditorControlList, wxListCtrl)
+END_EVENT_TABLE()
+
+wxResourceEditorControlList::wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
+        long style):
+     wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE)
+{
+    Initialize();
+}
+
+wxResourceEditorControlList::~wxResourceEditorControlList()
+{
+    SetImageList(NULL, wxIMAGE_LIST_SMALL);
+}
+
+// Load icons and add to the list
+void wxResourceEditorControlList::Initialize()
+{
+    wxIcon icon1("ARROW_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon1);
+
+    wxIcon icon2("BUTTON_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon2);
+
+    wxIcon icon3("BMPBUTTON_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon3);
+
+    wxIcon icon4("STATICTEXT_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon4);
+
+    wxIcon icon5("STATICBMP_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon5);
+
+    wxIcon icon6("STATICBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon6);
+
+    wxIcon icon7("TEXTSING_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon7);
+
+    wxIcon icon8("TEXTMULT_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon8);
+
+    wxIcon icon9("LISTBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon9);
+
+    wxIcon icon10("CHOICE_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon10);
+
+    wxIcon icon11("COMBOBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon11);
+
+    wxIcon icon12("CHECKBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon12);
+
+    wxIcon icon13("SLIDER_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon13);
+
+    wxIcon icon14("GAUGE_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon14);
+
+    wxIcon icon15("RADIOBOX_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon15);
+
+    wxIcon icon16("RADIOBTN_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon16);
+
+    wxIcon icon17("SCROLBAR_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+    m_imageList.Add(icon17);
+
+    SetImageList(& m_imageList, wxIMAGE_LIST_SMALL);
+
+    long id = InsertItem(0,             "Pointer", 0);
+    id = InsertItem(1,                  "wxButton", 1);
+    id = InsertItem(2,                  "wxBitmapButton", 2);
+    id = InsertItem(3,                  "wxStaticText", 3);
+    id = InsertItem(4,                  "wxStaticBitmap", 4);
+    id = InsertItem(5,                  "wxStaticBox", 5);
+    id = InsertItem(6,                  "wxTextCtrl", 6);
+    id = InsertItem(7,                  "wxTextCtrl", 7);
+    id = InsertItem(8,                  "wxListBox", 8);
+    id = InsertItem(9,                  "wxChoice", 9);
+    id = InsertItem(10,                  "wxComboBox", 10);
+    id = InsertItem(11,                  "wxCheckBox", 11);
+    id = InsertItem(12,                  "wxSlider", 12);
+    id = InsertItem(13,                  "wxGauge", 13);
+    id = InsertItem(14,                  "wxRadioBox", 14);
+    id = InsertItem(15,                  "wxRadioButton", 15);
+    id = InsertItem(16,                  "wxScrollBar", 16);
+
+/*
+    InsertItem(RESED_TREECTRL,          "wxTreeCtrl", 16);
+    InsertItem(RESED_LISTCTRL,          "wxListCtrl", 17);
+    InsertItem(RESED_SPINBUTTON,        "wxSpinButton", 18);
+*/
+
+//    SetColumnWidth(-1, 80);
+}
+
+// Get selection, or -1
+long wxResourceEditorControlList::GetSelection() const
+{
+    return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+}
+
+
diff --git a/utils/dialoged/src/edlist.h b/utils/dialoged/src/edlist.h
new file mode 100644 (file)
index 0000000..9777c01
--- /dev/null
@@ -0,0 +1,38 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        edlist.h
+// Purpose:     Resource editor list of controls
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _EDLIST_H_
+#define _EDLIST_H_
+
+#include <wx/listctrl.h>
+#include <wx/imaglist.h>
+
+class wxResourceEditorControlList: public wxListCtrl
+{
+public:
+    wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
+        long style = wxLC_SMALL_ICON|wxLC_AUTOARRANGE|wxLC_SINGLE_SEL);
+    ~wxResourceEditorControlList();
+
+    // Load icons and add to the list
+    void Initialize();
+
+    // Get selection, or -1
+    long GetSelection() const;
+
+DECLARE_EVENT_TABLE()
+
+protected:
+    wxImageList m_imageList;
+};
+
+#endif
+
diff --git a/utils/dialoged/src/edtree.cpp b/utils/dialoged/src/edtree.cpp
new file mode 100644 (file)
index 0000000..a445963
--- /dev/null
@@ -0,0 +1,92 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        edtree.cpp
+// Purpose:     Resource editor project management tree
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "edtree.h"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+
+#include "wx/checkbox.h"
+#include "wx/button.h"
+#include "wx/choice.h"
+#include "wx/listbox.h"
+#include "wx/radiobox.h"
+#include "wx/statbox.h"
+#include "wx/gauge.h"
+#include "wx/slider.h"
+#include "wx/textctrl.h"
+#endif
+
+#include "edtree.h"
+#include "reseditr.h"
+
+BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl)
+    EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick)
+    EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged)
+END_EVENT_TABLE()
+
+wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
+        long style):
+     wxTreeCtrl(parent, id, pos, size, style)
+{
+}
+
+void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& event)
+{
+#if 0
+    long sel = GetSelection();
+    if (sel == -1)
+        return;
+
+    if (GetItemData(sel) == 0)
+        return;
+
+    wxItemResource* res = (wxItemResource*) GetItemData(sel);
+    wxString resType(res->GetType());
+    if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
+        return;
+
+    wxResourceEditorFrame *frame = (wxResourceEditorFrame *)wxWindow::GetParent();
+    wxResourceManager *manager = frame->manager;
+
+    manager->EditSelectedResource();
+#endif
+}
+
+void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& event)
+{
+    long sel = GetSelection();
+    if (sel == -1)
+        return;
+
+    if (GetItemData(sel) == 0)
+        return;
+
+    if (m_invalid)
+        return;
+
+    wxItemResource* res = (wxItemResource*) GetItemData(sel);
+    wxString resType(res->GetType());
+    if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
+        return;
+
+    wxResourceManager::GetCurrentResourceManager()->Edit(res);
+}
+
diff --git a/utils/dialoged/src/edtree.h b/utils/dialoged/src/edtree.h
new file mode 100644 (file)
index 0000000..3928c5a
--- /dev/null
@@ -0,0 +1,36 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        edtree.h
+// Purpose:     Resource editor project management tree control
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _EDTREE_H_
+#define _EDTREE_H_
+
+#include <wx/treectrl.h>
+
+class wxResourceEditorProjectTree: public wxTreeCtrl
+{
+public:
+    wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
+        long style = wxTR_HAS_BUTTONS);
+
+    void LeftDClick(wxMouseEvent& event);
+    void OnSelChanged(wxTreeEvent& event);
+
+    inline void SetInvalid(bool invalid) { m_invalid = invalid; }
+
+protected:
+    bool        m_invalid; // While TRUE, don't respond to selections etc.
+
+DECLARE_EVENT_TABLE()
+
+};
+
+#endif
+
index e19a83668bf85009fbb9e818830f51a688c8d23d..2944dc6f05acdbc525701af80660a8b8aabacc2c 100644 (file)
@@ -25,7 +25,7 @@ LOCALDOCDIR=$(WXDIR)\utils\dialoged\docs
 
 PROGRAM=dialoged
  
 
 PROGRAM=dialoged
  
-OBJECTS = dialoged.obj editrpal.obj reseditr.obj dlghndlr.obj reswrite.obj winprop.obj
+OBJECTS = dialoged.obj editrpal.obj reseditr.obj dlghndlr.obj reswrite.obj winprop.obj edtree.obj edlist.obj
 
 all:    wxprop dialoged.exe
 
 
 all:    wxprop dialoged.exe
 
@@ -72,6 +72,16 @@ reseditr.obj:      winprop.h reseditr.h editrpal.h reseditr.$(SRCSUFF) $(DUMMYOB
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
 
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
 
+edtree.obj:      winprop.h reseditr.h editrpal.h edtree.h edtree.$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+edlist.obj:      winprop.h reseditr.h edlist.h edlist.$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
 dlghndlr.obj:      winprop.h reseditr.h editrpal.h dlghndlr.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 dlghndlr.obj:      winprop.h reseditr.h editrpal.h dlghndlr.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
index 1aa9fea3eaa8586221813a7aa71e7a197f000404..4193ebde82f3e08f7f22968b31ba7f8f55ff4d2e 100644 (file)
 #include "winprop.h"
 #include "editrpal.h"
 #include "dlghndlr.h"
 #include "winprop.h"
 #include "editrpal.h"
 #include "dlghndlr.h"
+#include "edtree.h"
+#include "edlist.h"
 
 static void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event);
 
 static void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event);
-void wxResourceEditWindow(wxWindow *win);
-wxWindowPropertyInfo *wxCreatePropertyInfoForWindow(wxWindow *win);
-wxResourceManager *wxResourceManager::currentResourceManager = NULL;
-
-// Bitmaps for toolbar
-wxBitmap *ToolbarLoadBitmap = NULL;
-wxBitmap *ToolbarSaveBitmap = NULL;
-wxBitmap *ToolbarNewBitmap = NULL;
-wxBitmap *ToolbarVertBitmap = NULL;
-wxBitmap *ToolbarAlignTBitmap = NULL;
-wxBitmap *ToolbarAlignBBitmap = NULL;
-wxBitmap *ToolbarHorizBitmap = NULL;
-wxBitmap *ToolbarAlignLBitmap = NULL;
-wxBitmap *ToolbarAlignRBitmap = NULL;
-wxBitmap *ToolbarCopySizeBitmap = NULL;
-wxBitmap *ToolbarToFrontBitmap = NULL;
-wxBitmap *ToolbarToBackBitmap = NULL;
-wxBitmap *ToolbarHelpBitmap = NULL;
-
-wxBitmap *wxWinBitmap = NULL;
+wxResourceManager *wxResourceManager::sm_currentResourceManager = NULL;
 
 #ifdef __X__
 #include "bitmaps/load.xbm"
 
 #ifdef __X__
 #include "bitmaps/load.xbm"
@@ -101,45 +84,53 @@ wxBitmap *wxWinBitmap = NULL;
  * Resource manager
  */
 
  * Resource manager
  */
 
+wxResourceManager::wxResourceManager():
+  m_imageList(16, 16, TRUE)
+{
+  sm_currentResourceManager = this;
+  m_editorFrame = NULL;
+  m_editorPanel = NULL;
+  m_popupMenu = NULL;
+  m_editorResourceTree = NULL;
+  m_editorControlList = NULL;
+  m_editorPalette = NULL;
+  m_nameCounter = 1;
+  m_modified = FALSE;
+  m_currentFilename = "";
+  m_editorToolBar = NULL;
 
 
-wxResourceManager::wxResourceManager(void)
-{
-  currentResourceManager = this;
-  editorFrame = NULL;
-  editorPanel = NULL;
-  popupMenu = NULL;
-  editorResourceList = NULL;
-  editorPalette = NULL;
-  nameCounter = 1;
-  modified = FALSE;
-  currentFilename = "";
-  editMode = TRUE;
-  editorToolBar = NULL;
-  
   // Default window positions
   // Default window positions
-  resourceEditorWindowSize.width = 470;
-  resourceEditorWindowSize.height = 300;
+  m_resourceEditorWindowSize.width = 470;
+  m_resourceEditorWindowSize.height = 300;
 
 
-  resourceEditorWindowSize.x = 0;
-  resourceEditorWindowSize.y = 0;
-  
-  propertyWindowSize.width = 300;
-  propertyWindowSize.height = 300;
+  m_resourceEditorWindowSize.x = 0;
+  m_resourceEditorWindowSize.y = 0;
+
+  m_propertyWindowSize.width = 300;
+  m_propertyWindowSize.height = 300;
 
 
-  helpInstance = NULL;
+  m_helpController = NULL;
+
+  m_bitmapImage = NULL;
+  m_rootDialogItem = 0;
 }
 
 }
 
-wxResourceManager::~wxResourceManager(void)
+wxResourceManager::~wxResourceManager()
 {
 {
-  currentResourceManager = NULL;
+  sm_currentResourceManager = NULL;
   SaveOptions();
 
   SaveOptions();
 
-  helpInstance->Quit();
-  delete helpInstance;
-  helpInstance = NULL;
+  if (m_helpController)
+  {
+    m_helpController->Quit();
+    delete m_helpController;
+    m_helpController = NULL;
+  }
+  delete m_bitmapImage;
+  delete m_popupMenu;
 }
 
 }
 
-bool wxResourceManager::Initialize(void)
+bool wxResourceManager::Initialize()
 {
   // Set up the resource filename for each platform.
 #ifdef __WINDOWS__
 {
   // Set up the resource filename for each platform.
 #ifdef __WINDOWS__
@@ -147,63 +138,75 @@ bool wxResourceManager::Initialize(void)
   char buf[256];
   GetWindowsDirectory(buf, 256);
   strcat(buf, "\\dialoged.ini");
   char buf[256];
   GetWindowsDirectory(buf, 256);
   strcat(buf, "\\dialoged.ini");
-  optionsResourceFilename = buf;
+  m_optionsResourceFilename = buf;
 #elif defined(__X__)
   char buf[500];
 #elif defined(__X__)
   char buf[500];
-  (void)wxGetHomeDir(buf);
-  strcat(buf, "/.hardyrc");
-  optionsResourceFilename = buf;
+  ()wxGetHomeDir(buf);
+  strcat(buf, "/.dialogedrc");
+  m_optionsResourceFilename = buf;
 #else
 #error "Unsupported platform."
 #endif
 
   LoadOptions();
 
 #else
 #error "Unsupported platform."
 #endif
 
   LoadOptions();
 
-  helpInstance = new wxHelpController;
-  helpInstance->Initialize("dialoged");
+  m_helpController = new wxHelpController;
+  m_helpController->Initialize("dialoged");
 
 
-  InitializeTools();
-  popupMenu = new wxMenu("", (wxFunction)ObjectMenuProc);
-  popupMenu->Append(OBJECT_MENU_EDIT, "Edit properties");
-  popupMenu->Append(OBJECT_MENU_DELETE, "Delete object");
-  
-  if (!wxWinBitmap)
+  m_popupMenu = new wxMenu("", (wxFunction)ObjectMenuProc);
+  m_popupMenu->Append(OBJECT_MENU_EDIT, "Edit properties");
+  m_popupMenu->Append(OBJECT_MENU_DELETE, "Delete object");
+
+  if (!m_bitmapImage)
   {
 #ifdef __WINDOWS__
   {
 #ifdef __WINDOWS__
-    wxWinBitmap = new wxBitmap("WXWINBMP", wxBITMAP_TYPE_BMP_RESOURCE);
+    m_bitmapImage = new wxBitmap("WXWINBMP", wxBITMAP_TYPE_BMP_RESOURCE);
 #endif
 #ifdef __X__
 #endif
 #ifdef __X__
-    wxWinBitmap = new wxBitmap(wxwin_bits, wxwin_width, wxwin_height);
+    m_bitmapImage = new wxBitmap(wxwin_bits, wxwin_width, wxwin_height);
 #endif
   }
 #endif
   }
+
+  // Initialize the image list icons
+#ifdef __WINDOWS__
+  wxIcon icon1("DIALOG_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+  wxIcon icon2("FOLDER1_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+  wxIcon icon3("FOLDER2_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+  wxIcon icon4("BUTTONSM_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+  m_imageList.Add(icon1);
+  m_imageList.Add(icon2);
+  m_imageList.Add(icon3);
+  m_imageList.Add(icon4);
+#endif
+
   return TRUE;
 }
 
   return TRUE;
 }
 
-bool wxResourceManager::LoadOptions(void)
+bool wxResourceManager::LoadOptions()
 {
 {
-  wxGetResource("DialogEd", "editorWindowX", &resourceEditorWindowSize.x, optionsResourceFilename.GetData());
-  wxGetResource("DialogEd", "editorWindowY", &resourceEditorWindowSize.y, optionsResourceFilename.GetData());
-  wxGetResource("DialogEd", "editorWindowWidth", &resourceEditorWindowSize.width, optionsResourceFilename.GetData());
-  wxGetResource("DialogEd", "editorWindowHeight", &resourceEditorWindowSize.height, optionsResourceFilename.GetData());
-  wxGetResource("DialogEd", "propertyWindowX", &propertyWindowSize.x, optionsResourceFilename.GetData());
-  wxGetResource("DialogEd", "propertyWindowY", &propertyWindowSize.y, optionsResourceFilename.GetData());
-  wxGetResource("DialogEd", "propertyWindowWidth", &propertyWindowSize.width, optionsResourceFilename.GetData());
-  wxGetResource("DialogEd", "propertyWindowHeight", &propertyWindowSize.height, optionsResourceFilename.GetData());
+  wxGetResource("DialogEd", "editorWindowX", &m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
+  wxGetResource("DialogEd", "editorWindowY", &m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
+  wxGetResource("DialogEd", "editorWindowWidth", &m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData());
+  wxGetResource("DialogEd", "editorWindowHeight", &m_resourceEditorWindowSize.height, m_optionsResourceFilename.GetData());
+  wxGetResource("DialogEd", "propertyWindowX", &m_propertyWindowSize.x, m_optionsResourceFilename.GetData());
+  wxGetResource("DialogEd", "propertyWindowY", &m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
+  wxGetResource("DialogEd", "propertyWindowWidth", &m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
+  wxGetResource("DialogEd", "propertyWindowHeight", &m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
   return TRUE;
 }
 
   return TRUE;
 }
 
-bool wxResourceManager::SaveOptions(void)
+bool wxResourceManager::SaveOptions()
 {
 {
-  wxWriteResource("DialogEd", "editorWindowX", resourceEditorWindowSize.x, optionsResourceFilename.GetData());
-  wxWriteResource("DialogEd", "editorWindowY", resourceEditorWindowSize.y, optionsResourceFilename.GetData());
-  wxWriteResource("DialogEd", "editorWindowWidth", resourceEditorWindowSize.width, optionsResourceFilename.GetData());
-  wxWriteResource("DialogEd", "editorWindowHeight", resourceEditorWindowSize.height, optionsResourceFilename.GetData());
+  wxWriteResource("DialogEd", "editorWindowX", m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData());
+  wxWriteResource("DialogEd", "editorWindowY", m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData());
+  wxWriteResource("DialogEd", "editorWindowWidth", m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData());
+  wxWriteResource("DialogEd", "editorWindowHeight", m_resourceEditorWindowSize.height, m_optionsResourceFilename.GetData());
+
+  wxWriteResource("DialogEd", "propertyWindowX", m_propertyWindowSize.x, m_optionsResourceFilename.GetData());
+  wxWriteResource("DialogEd", "propertyWindowY", m_propertyWindowSize.y, m_optionsResourceFilename.GetData());
+  wxWriteResource("DialogEd", "propertyWindowWidth", m_propertyWindowSize.width, m_optionsResourceFilename.GetData());
+  wxWriteResource("DialogEd", "propertyWindowHeight", m_propertyWindowSize.height, m_optionsResourceFilename.GetData());
 
 
-  wxWriteResource("DialogEd", "propertyWindowX", propertyWindowSize.x, optionsResourceFilename.GetData());
-  wxWriteResource("DialogEd", "propertyWindowY", propertyWindowSize.y, optionsResourceFilename.GetData());
-  wxWriteResource("DialogEd", "propertyWindowWidth", propertyWindowSize.width, optionsResourceFilename.GetData());
-  wxWriteResource("DialogEd", "propertyWindowHeight", propertyWindowSize.height, optionsResourceFilename.GetData());
-  
   return TRUE;
 }
 
   return TRUE;
 }
 
@@ -213,65 +216,91 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *parent, const ch
 {
   if (show)
   {
 {
   if (show)
   {
-    if (editorFrame)
+    if (m_editorFrame)
     {
     {
-      editorFrame->Iconize(FALSE);
-      editorFrame->Show(TRUE);
+      m_editorFrame->Iconize(FALSE);
+      m_editorFrame->Show(TRUE);
       return TRUE;
     }
       return TRUE;
     }
-    editorFrame = OnCreateEditorFrame(title);
+    m_editorFrame = OnCreateEditorFrame(title);
     SetFrameTitle("");
     SetFrameTitle("");
-    wxMenuBar *menuBar = OnCreateEditorMenuBar(editorFrame);
-    editorFrame->SetMenuBar(menuBar);
-    editorPanel = OnCreateEditorPanel(editorFrame);
-    editorToolBar = (EditorToolBar *)OnCreateToolBar(editorFrame);
-    editorPalette = OnCreatePalette(editorFrame);
+    wxMenuBar *menuBar = OnCreateEditorMenuBar(m_editorFrame);
+    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);
+    m_editorPanel = OnCreateEditorPanel(m_editorFrame);
+
+    m_editorResourceTree->SetImageList(& m_imageList);
 
     // Constraints for toolbar
     wxLayoutConstraints *c = new wxLayoutConstraints;
 
     // Constraints for toolbar
     wxLayoutConstraints *c = new wxLayoutConstraints;
-    c->left.SameAs       (editorFrame, wxLeft, 0);
-    c->top.SameAs        (editorFrame, wxTop, 0);
-    c->right.SameAs      (editorFrame, wxRight, 0);
-    c->bottom.Unconstrained();    
+    c->left.SameAs       (m_editorFrame, wxLeft, 0);
+    c->top.SameAs        (m_editorFrame, wxTop, 0);
+    c->right.SameAs      (m_editorFrame, wxRight, 0);
+    c->bottom.Unconstrained();
     c->width.Unconstrained();
     c->height.Absolute(28);
     c->width.Unconstrained();
     c->height.Absolute(28);
-    editorToolBar->SetConstraints(c);
-
+    m_editorToolBar->SetConstraints(c);
+/*
     // Constraints for palette
     c = new wxLayoutConstraints;
     // Constraints for palette
     c = new wxLayoutConstraints;
-    c->left.SameAs       (editorFrame, wxLeft, 0);
-    c->top.SameAs        (editorToolBar, wxBottom, 0);
-    c->right.SameAs      (editorFrame, wxRight, 0);
-    c->bottom.Unconstrained();    
+    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);
     c->width.Unconstrained();
     c->height.Absolute(34);
-    editorPalette->SetConstraints(c);
+    m_editorPalette->SetConstraints(c);
+*/
+    // Constraints for listbox
+    c = new wxLayoutConstraints;
+    c->left.SameAs       (m_editorFrame, wxLeft, 0);
+    c->top.SameAs        (m_editorToolBar, wxBottom, 0);
+    c->right.Absolute    (150);
+    c->bottom.SameAs     (m_editorControlList, wxTop, 0);
+    c->width.Unconstrained();
+    c->height.Unconstrained();
+    m_editorResourceTree->SetConstraints(c);
 
     // Constraints for panel
     c = new wxLayoutConstraints;
 
     // Constraints for panel
     c = new wxLayoutConstraints;
-    c->left.SameAs       (editorFrame, wxLeft, 0);
-    c->top.SameAs        (editorPalette, wxBottom, 0);
-    c->right.SameAs      (editorFrame, wxRight, 0);
-    c->bottom.SameAs     (editorFrame, wxBottom, 0);    
+    c->left.SameAs       (m_editorResourceTree, wxRight, 0);
+    c->top.SameAs        (m_editorToolBar, wxBottom, 0);
+    c->right.SameAs      (m_editorFrame, wxRight, 0);
+    c->bottom.SameAs     (m_editorControlList, wxTop, 0);
     c->width.Unconstrained();
     c->height.Unconstrained();
     c->width.Unconstrained();
     c->height.Unconstrained();
-    editorPanel->SetConstraints(c);
+    m_editorPanel->SetConstraints(c);
+
+    // Constraints for control list (bottom window)
+    c = new wxLayoutConstraints;
+    c->left.SameAs       (m_editorFrame, wxLeft, 0);
+    c->right.SameAs      (m_editorFrame, wxRight, 0);
+    c->bottom.SameAs     (m_editorFrame, wxBottom, 0);
+    c->width.Unconstrained();
+    c->height.Absolute(60);
+    m_editorControlList->SetConstraints(c);
 
 
-    editorFrame->SetAutoLayout(TRUE);
+    m_editorFrame->SetAutoLayout(TRUE);
 
     UpdateResourceList();
 
     UpdateResourceList();
-    editorFrame->Show(TRUE);
+
+    m_editorFrame->Show(TRUE);
     return TRUE;
   }
   else
   {
     return TRUE;
   }
   else
   {
-    wxFrame *fr = editorFrame;
-    if (editorFrame->OnClose())
+    wxFrame *fr = m_editorFrame;
+    if (m_editorFrame->OnClose())
     {
       fr->Show(FALSE);
       delete fr;
     {
       fr->Show(FALSE);
       delete fr;
-      editorFrame = NULL;
-      editorPanel = NULL;
+      m_editorFrame = NULL;
+      m_editorPanel = NULL;
     }
   }
   return TRUE;
     }
   }
   return TRUE;
@@ -279,35 +308,35 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *parent, const ch
 
 void wxResourceManager::SetFrameTitle(const wxString& filename)
 {
 
 void wxResourceManager::SetFrameTitle(const wxString& filename)
 {
-  if (editorFrame)
+  if (m_editorFrame)
   {
     if (filename == wxString(""))
   {
     if (filename == wxString(""))
-      editorFrame->SetTitle("wxWindows Dialog Editor - untitled");
+      m_editorFrame->SetTitle("wxWindows Dialog Editor - untitled");
     else
     {
       wxString str("wxWindows Dialog Editor - ");
       wxString str2(wxFileNameFromPath(WXSTRINGCAST filename));
       str += str2;
     else
     {
       wxString str("wxWindows Dialog Editor - ");
       wxString str2(wxFileNameFromPath(WXSTRINGCAST filename));
       str += str2;
-      editorFrame->SetTitle(str);
+      m_editorFrame->SetTitle(str);
     }
   }
 }
 
     }
   }
 }
 
-bool wxResourceManager::Save(void)
+bool wxResourceManager::Save()
 {
 {
-  if (currentFilename == wxString(""))
+  if (m_currentFilename == wxString(""))
     return SaveAs();
   else
     return SaveAs();
   else
-    return Save(currentFilename);
+    return Save(m_currentFilename);
 }
 
 bool wxResourceManager::Save(const wxString& filename)
 {
   // Ensure all visible windows are saved to their resources
 }
 
 bool wxResourceManager::Save(const wxString& filename)
 {
   // Ensure all visible windows are saved to their resources
-  currentFilename = filename;
-  SetFrameTitle(currentFilename);
+  m_currentFilename = filename;
+  SetFrameTitle(m_currentFilename);
   InstantiateAllResourcesFromWindows();
   InstantiateAllResourcesFromWindows();
-  if (resourceTable.Save(filename))
+  if (m_resourceTable.Save(filename))
   {
     Modify(FALSE);
     return TRUE;
   {
     Modify(FALSE);
     return TRUE;
@@ -316,20 +345,20 @@ bool wxResourceManager::Save(const wxString& filename)
     return FALSE;
 }
 
     return FALSE;
 }
 
-bool wxResourceManager::SaveAs(void)
+bool wxResourceManager::SaveAs()
 {
 {
-  wxString s(wxFileSelector("Save resource file", wxPathOnly(WXSTRINGCAST currentFilename), wxFileNameFromPath(WXSTRINGCAST currentFilename),
+  wxString s(wxFileSelector("Save resource file", wxPathOnly(WXSTRINGCAST m_currentFilename), wxFileNameFromPath(WXSTRINGCAST m_currentFilename),
     "wxr", "*.wxr", wxSAVE | wxOVERWRITE_PROMPT));
     
   if (s.IsNull() || s == "")
     return FALSE;
     
     "wxr", "*.wxr", wxSAVE | wxOVERWRITE_PROMPT));
     
   if (s.IsNull() || s == "")
     return FALSE;
     
-  currentFilename = s;
-  Save(currentFilename);
+  m_currentFilename = s;
+  Save(m_currentFilename);
   return TRUE;
 }
 
   return TRUE;
 }
 
-bool wxResourceManager::SaveIfModified(void)
+bool wxResourceManager::SaveIfModified()
 {
   if (Modified())
     return Save();
 {
   if (Modified())
     return Save();
@@ -358,21 +387,21 @@ bool wxResourceManager::New(bool loadFromFile, const wxString& filename)
         return FALSE;
     }
     
         return FALSE;
     }
     
-    if (!resourceTable.ParseResourceFile(WXSTRINGCAST str))
+    if (!m_resourceTable.ParseResourceFile(WXSTRINGCAST str))
     {
       wxMessageBox("Could not read file.", "Resource file load error", wxOK | wxICON_EXCLAMATION);
       return FALSE;
     }
     {
       wxMessageBox("Could not read file.", "Resource file load error", wxOK | wxICON_EXCLAMATION);
       return FALSE;
     }
-    currentFilename = str;
-    
-    SetFrameTitle(currentFilename);
-    
+    m_currentFilename = str;
+
+    SetFrameTitle(m_currentFilename);
+
     UpdateResourceList();
   }
   else
   {
     SetFrameTitle("");
     UpdateResourceList();
   }
   else
   {
     SetFrameTitle("");
-    currentFilename = "";
+    m_currentFilename = "";
   }
   Modify(FALSE);
   
   }
   Modify(FALSE);
   
@@ -393,22 +422,23 @@ bool wxResourceManager::Clear(bool deleteWindows, bool force)
         Modify(FALSE);
   }
   
         Modify(FALSE);
   }
   
-  DisassociateWindows(deleteWindows);
+  ClearCurrentDialog();
+  DisassociateWindows();
 
 
-  resourceTable.ClearTable();
+  m_resourceTable.ClearTable();
   UpdateResourceList();
 
   return TRUE;
 }
 
   UpdateResourceList();
 
   return TRUE;
 }
 
-bool wxResourceManager::DisassociateWindows(bool deleteWindows)
+bool wxResourceManager::DisassociateWindows()
 {
 {
-  resourceTable.BeginFind();
+  m_resourceTable.BeginFind();
   wxNode *node;
   wxNode *node;
-  while (node = resourceTable.Next())
+  while (node = m_resourceTable.Next())
   {
     wxItemResource *res = (wxItemResource *)node->Data();
   {
     wxItemResource *res = (wxItemResource *)node->Data();
-    DisassociateResource(res, deleteWindows);
+    DisassociateResource(res);
   }
   
   return TRUE;
   }
   
   return TRUE;
@@ -416,14 +446,14 @@ bool wxResourceManager::DisassociateWindows(bool deleteWindows)
 
 void wxResourceManager::AssociateResource(wxItemResource *resource, wxWindow *win)
 {
 
 void wxResourceManager::AssociateResource(wxItemResource *resource, wxWindow *win)
 {
-  if (!resourceAssociations.Get((long)resource))
-    resourceAssociations.Put((long)resource, win);
-    
+  if (!m_resourceAssociations.Get((long)resource))
+    m_resourceAssociations.Put((long)resource, win);
+
   wxNode *node = resource->GetChildren().First();
   while (node)
   {
     wxItemResource *child = (wxItemResource *)node->Data();
   wxNode *node = resource->GetChildren().First();
   while (node)
   {
     wxItemResource *child = (wxItemResource *)node->Data();
-    wxWindow *childWindow = (wxWindow *)resourceAssociations.Get((long)child);
+    wxWindow *childWindow = (wxWindow *)m_resourceAssociations.Get((long)child);
     if (!childWindow)
       childWindow = win->FindWindow(child->GetName());
     if (childWindow)
     if (!childWindow)
       childWindow = win->FindWindow(child->GetName());
     if (childWindow)
@@ -439,14 +469,13 @@ void wxResourceManager::AssociateResource(wxItemResource *resource, wxWindow *wi
   }
 }
 
   }
 }
 
-bool wxResourceManager::DisassociateResource(wxItemResource *resource, bool deleteWindow)
+bool wxResourceManager::DisassociateResource(wxItemResource *resource)
 {
   wxWindow *win = FindWindowForResource(resource);
   if (!win)
     return FALSE;
 
 {
   wxWindow *win = FindWindowForResource(resource);
   if (!win)
     return FALSE;
 
-  // Disassociate children of window without deleting windows
-  // since they'll be deleted by parent.
+  // Disassociate children of window
   if (win->GetChildren())
   {
     wxNode *node = win->GetChildren()->First();
   if (win->GetChildren())
   {
     wxNode *node = win->GetChildren()->First();
@@ -454,47 +483,80 @@ bool wxResourceManager::DisassociateResource(wxItemResource *resource, bool dele
     {
       wxWindow *child = (wxWindow *)node->Data();
       if (child->IsKindOf(CLASSINFO(wxControl)))
     {
       wxWindow *child = (wxWindow *)node->Data();
       if (child->IsKindOf(CLASSINFO(wxControl)))
-       DisassociateResource(child, FALSE);
+       DisassociateResource(child);
       node = node->Next();
     }
   }
   
       node = node->Next();
     }
   }
   
-  if (deleteWindow)
-  {
-    if (win->IsKindOf(CLASSINFO(wxPanel)) && !win->IsKindOf(CLASSINFO(wxDialog)))
-      delete win->GetParent(); // Delete frame
-    else if ( win->IsKindOf(CLASSINFO(wxControl)) )
-       {
-         wxEvtHandler *childHandler = win->GetEventHandler();
-         if ( childHandler != win )
-         {
-               win->PopEventHandler();
-               delete childHandler;
-         }
-      delete win;
-       }
-       else
-         // Is this enough? What about event handler? TODO
-         delete win;
-  }
   RemoveSelection(win);
   RemoveSelection(win);
-  resourceAssociations.Delete((long)resource);
+  m_resourceAssociations.Delete((long)resource);
   return TRUE;
 }
 
   return TRUE;
 }
 
-bool wxResourceManager::DisassociateResource(wxWindow *win, bool deleteWindow)
+bool wxResourceManager::DisassociateResource(wxWindow *win)
 {
   wxItemResource *res = FindResourceForWindow(win);
   if (res)
 {
   wxItemResource *res = FindResourceForWindow(win);
   if (res)
-    return DisassociateResource(res, deleteWindow);
-  return FALSE;
+    return DisassociateResource(res);
+  else
+    return FALSE;
+}
+
+// Saves the window info into the resource, and deletes the
+// handler. Doesn't actually disassociate the window from
+// the resources. Replaces OnClose.
+bool wxResourceManager::SaveInfoAndDeleteHandler(wxWindow* win)
+{
+    wxItemResource *res = FindResourceForWindow(win);
+
+    if (win->IsKindOf(CLASSINFO(wxPanel)))
+    {
+        wxResourceEditorDialogHandler* handler = (wxResourceEditorDialogHandler*) win->GetEventHandler();
+        win->PopEventHandler();
+
+        // Now reset all child event handlers
+        wxNode *node = win->GetChildren()->First();
+        while ( node )
+        {
+               wxWindow *child = (wxWindow *)node->Data();
+               wxEvtHandler *childHandler = child->GetEventHandler();
+               if ( child->IsKindOf(CLASSINFO(wxControl)) && childHandler != child )
+               {
+                       child->PopEventHandler(TRUE);
+               }
+               node = node->Next();
+        }
+        delete handler;
+    }
+    else
+    {
+        win->PopEventHandler(TRUE);
+    }
+  
+    // Save the information
+    InstantiateResourceFromWindow(res, win, TRUE);
+  
+//  DisassociateResource(win);
+
+    return TRUE;
+}
+
+// Destroys the window. If this is the 'current' panel, NULLs the
+// variable.
+bool wxResourceManager::DeleteWindow(wxWindow* win)
+{
+    if (m_editorPanel->m_childWindow == win)
+        m_editorPanel->m_childWindow = NULL;
+
+    win->Destroy();
+    return TRUE;
 }
 
 wxItemResource *wxResourceManager::FindResourceForWindow(wxWindow *win)
 {
 }
 
 wxItemResource *wxResourceManager::FindResourceForWindow(wxWindow *win)
 {
-  resourceAssociations.BeginFind();
+  m_resourceAssociations.BeginFind();
   wxNode *node;
   wxNode *node;
-  while (node = resourceAssociations.Next())
+  while (node = m_resourceAssociations.Next())
   {
     wxWindow *w = (wxWindow *)node->Data();
     if (w == win)
   {
     wxWindow *w = (wxWindow *)node->Data();
     if (w == win)
@@ -507,7 +569,7 @@ wxItemResource *wxResourceManager::FindResourceForWindow(wxWindow *win)
 
 wxWindow *wxResourceManager::FindWindowForResource(wxItemResource *resource)
 {
 
 wxWindow *wxResourceManager::FindWindowForResource(wxItemResource *resource)
 {
-  return (wxWindow *)resourceAssociations.Get((long)resource);
+  return (wxWindow *)m_resourceAssociations.Get((long)resource);
 }
 
 
 }
 
 
@@ -515,10 +577,10 @@ void wxResourceManager::MakeUniqueName(char *prefix, char *buf)
 {
   while (TRUE)
   {
 {
   while (TRUE)
   {
-    sprintf(buf, "%s%d", prefix, nameCounter);
-    nameCounter ++;
-    
-    if (!resourceTable.FindResource(buf))
+    sprintf(buf, "%s%d", prefix, m_nameCounter);
+    m_nameCounter ++;
+
+    if (!m_resourceTable.FindResource(buf))
       return;
   }
 }
       return;
   }
 }
@@ -528,20 +590,13 @@ wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title)
   int frameWidth = 420;
   int frameHeight = 300;
   
   int frameWidth = 420;
   int frameHeight = 300;
   
-  wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, (char *)title,
-
-    resourceEditorWindowSize.x, resourceEditorWindowSize.y,
-    resourceEditorWindowSize.width, resourceEditorWindowSize.height,
+  wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, title,
+    wxPoint(m_resourceEditorWindowSize.x, m_resourceEditorWindowSize.y),
+    wxSize(m_resourceEditorWindowSize.width, m_resourceEditorWindowSize.height),
+    wxDEFAULT_FRAME_STYLE);
 
 
-    wxDEFAULT_FRAME);
+  frame->CreateStatusBar(1);
 
 
-  wxFrame::UseNativeStatusBar(FALSE);
-
-  frame->CreateStatusBar(2);
-
-  wxFrame::UseNativeStatusBar(TRUE);
-
-  frame->SetStatusText(editMode ? "Edit mode" : "Test mode", 1);
   frame->SetAutoLayout(TRUE);
 #ifdef __WINDOWS__
   wxIcon *icon = new wxIcon("DIALOGEDICON");
   frame->SetAutoLayout(TRUE);
 #ifdef __WINDOWS__
   wxIcon *icon = new wxIcon("DIALOGEDICON");
@@ -556,7 +611,6 @@ wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *parent)
 
   wxMenu *fileMenu = new wxMenu;
   fileMenu->Append(RESED_NEW_DIALOG, "New &dialog", "Create a new dialog");
 
   wxMenu *fileMenu = new wxMenu;
   fileMenu->Append(RESED_NEW_DIALOG, "New &dialog", "Create a new dialog");
-  fileMenu->Append(RESED_NEW_PANEL, "New &panel", "Create a new panel");
   fileMenu->AppendSeparator();
   fileMenu->Append(wxID_NEW, "&New project",           "Clear the current project");
   fileMenu->Append(wxID_OPEN, "&Open...",         "Load a resource file");
   fileMenu->AppendSeparator();
   fileMenu->Append(wxID_NEW, "&New project",           "Clear the current project");
   fileMenu->Append(wxID_OPEN, "&Open...",         "Load a resource file");
@@ -567,10 +621,9 @@ wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *parent)
   fileMenu->Append(wxID_EXIT, "E&xit",            "Exit resource editor");
 
   wxMenu *editMenu = new wxMenu;
   fileMenu->Append(wxID_EXIT, "E&xit",            "Exit resource editor");
 
   wxMenu *editMenu = new wxMenu;
+  editMenu->Append(RESED_TEST, "&Test Dialog",  "Test dialog");
   editMenu->Append(RESED_RECREATE, "&Recreate",  "Recreate the selected resource(s)");
   editMenu->Append(RESED_DELETE, "&Delete",  "Delete the selected resource(s)");
   editMenu->Append(RESED_RECREATE, "&Recreate",  "Recreate the selected resource(s)");
   editMenu->Append(RESED_DELETE, "&Delete",  "Delete the selected resource(s)");
-  editMenu->AppendSeparator();
-  editMenu->Append(RESED_TOGGLE_TEST_MODE, "&Toggle edit/test mode",  "Toggle edit/test mode");
 
   wxMenu *helpMenu = new wxMenu;
   helpMenu->Append(RESED_CONTENTS, "&Help topics",          "Invokes the on-line help");
 
   wxMenu *helpMenu = new wxMenu;
   helpMenu->Append(RESED_CONTENTS, "&Help topics",          "Invokes the on-line help");
@@ -584,20 +637,13 @@ wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *parent)
   return menuBar;
 }
 
   return menuBar;
 }
 
-wxPanel *wxResourceManager::OnCreateEditorPanel(wxFrame *parent)
+wxResourceEditorScrolledWindow *wxResourceManager::OnCreateEditorPanel(wxFrame *parent)
 {
 {
-  wxResourceEditorPanel *panel = new wxResourceEditorPanel(parent);
-
-  editorResourceList = new wxListBox(panel, -1, wxPoint(0, 0), wxSize(-1, -1));
+  wxResourceEditorScrolledWindow *panel = new wxResourceEditorScrolledWindow(parent, wxDefaultPosition, wxDefaultSize,
+//    wxSUNKEN_BORDER|wxCLIP_CHILDREN);
+    wxSUNKEN_BORDER);
 
 
-  wxLayoutConstraints *c = new wxLayoutConstraints;
-  c->left.SameAs       (panel, wxLeft, 5);
-  c->top.SameAs        (panel, wxTop, 5);
-  c->right.SameAs      (panel, wxRight, 5);
-  c->bottom.SameAs     (panel, wxBottom, 5);
-  c->width.Unconstrained();
-  c->height.Unconstrained();
-  editorResourceList->SetConstraints(c);
+  panel->SetScrollbars(10, 10, 100, 100);
 
   return panel;
 }
 
   return panel;
 }
@@ -606,40 +652,38 @@ wxToolBarBase *wxResourceManager::OnCreateToolBar(wxFrame *parent)
 {
   // Load palette bitmaps
 #ifdef __WINDOWS__
 {
   // Load palette bitmaps
 #ifdef __WINDOWS__
-  ToolbarLoadBitmap = new wxBitmap("LOADTOOL");
-  ToolbarSaveBitmap = new wxBitmap("SAVETOOL");
-  ToolbarNewBitmap = new wxBitmap("NEWTOOL");
-  ToolbarVertBitmap = new wxBitmap("VERTTOOL");
-  ToolbarAlignTBitmap = new wxBitmap("ALIGNTTOOL");
-  ToolbarAlignBBitmap = new wxBitmap("ALIGNBTOOL");
-  ToolbarHorizBitmap = new wxBitmap("HORIZTOOL");
-  ToolbarAlignLBitmap = new wxBitmap("ALIGNLTOOL");
-  ToolbarAlignRBitmap = new wxBitmap("ALIGNRTOOL");
-  ToolbarCopySizeBitmap = new wxBitmap("COPYSIZETOOL");
-  ToolbarToBackBitmap = new wxBitmap("TOBACKTOOL");
-  ToolbarToFrontBitmap = new wxBitmap("TOFRONTTOOL");
-  ToolbarHelpBitmap = new wxBitmap("HELPTOOL");
+  wxBitmap ToolbarLoadBitmap("LOADTOOL");
+  wxBitmap ToolbarSaveBitmap("SAVETOOL");
+  wxBitmap ToolbarNewBitmap("NEWTOOL");
+  wxBitmap ToolbarVertBitmap("VERTTOOL");
+  wxBitmap ToolbarAlignTBitmap("ALIGNTTOOL");
+  wxBitmap ToolbarAlignBBitmap("ALIGNBTOOL");
+  wxBitmap ToolbarHorizBitmap("HORIZTOOL");
+  wxBitmap ToolbarAlignLBitmap("ALIGNLTOOL");
+  wxBitmap ToolbarAlignRBitmap("ALIGNRTOOL");
+  wxBitmap ToolbarCopySizeBitmap("COPYSIZETOOL");
+  wxBitmap ToolbarToBackBitmap("TOBACKTOOL");
+  wxBitmap ToolbarToFrontBitmap("TOFRONTTOOL");
+  wxBitmap ToolbarHelpBitmap("HELPTOOL");
 #endif
 #ifdef __X__
 #endif
 #ifdef __X__
-  ToolbarLoadBitmap = new wxBitmap(load_bits, load_width, load_height);
-  ToolbarSaveBitmap = new wxBitmap(save_bits, save_width, save_height);
-  ToolbarNewBitmap = new wxBitmap(new_bits, save_width, save_height);
-  ToolbarVertBitmap = new wxBitmap(vert_bits, vert_width, vert_height);
-  ToolbarAlignTBitmap = new wxBitmap(alignt_bits, alignt_width, alignt_height);
-  ToolbarAlignBBitmap = new wxBitmap(alignb_bits, alignb_width, alignb_height);
-  ToolbarHorizBitmap = new wxBitmap(horiz_bits, horiz_width, horiz_height);
-  ToolbarAlignLBitmap = new wxBitmap(alignl_bits, alignl_width, alignl_height);
-  ToolbarAlignRBitmap = new wxBitmap(alignr_bits, alignr_width, alignr_height);
-  ToolbarCopySizeBitmap = new wxBitmap(copysize_bits, copysize_width, copysize_height);
-  ToolbarToBackBitmap = new wxBitmap(toback_bits, toback_width, toback_height);
-  ToolbarToFrontBitmap = new wxBitmap(tofront_bits, tofront_width, tofront_height);
-//  ToolbarCPPBitmap = new wxBitmap(cpp_bits, cpp_width, cpp_height);
-//  ToolbarTreeBitmap = new wxBitmap(tree_bits, tree_width, tree_height);
-  ToolbarHelpBitmap = new wxBitmap(help_bits, help_width, help_height);
+  wxBitmap ToolbarLoadBitmap(load_bits, load_width, load_height);
+  wxBitmap ToolbarSaveBitmap(save_bits, save_width, save_height);
+  wxBitmap ToolbarNewBitmap(new_bits, save_width, save_height);
+  wxBitmap ToolbarVertBitmap(vert_bits, vert_width, vert_height);
+  wxBitmap ToolbarAlignTBitmap(alignt_bits, alignt_width, alignt_height);
+  wxBitmap ToolbarAlignBBitmap(alignb_bits, alignb_width, alignb_height);
+  wxBitmap ToolbarHorizBitmap(horiz_bits, horiz_width, horiz_height);
+  wxBitmap ToolbarAlignLBitmap(alignl_bits, alignl_width, alignl_height);
+  wxBitmap ToolbarAlignRBitmap(alignr_bits, alignr_width, alignr_height);
+  wxBitmap ToolbarCopySizeBitmap(copysize_bits, copysize_width, copysize_height);
+  wxBitmap ToolbarToBackBitmap(toback_bits, toback_width, toback_height);
+  wxBitmap ToolbarToFrontBitmap(tofront_bits, tofront_width, tofront_height);
+  wxBitmap ToolbarHelpBitmap(help_bits, help_width, help_height);
 #endif
 
   // Create the toolbar
 #endif
 
   // Create the toolbar
-  EditorToolBar *toolbar = new EditorToolBar(parent, 0, 0, -1, -1, wxNO_BORDER,
+  EditorToolBar *toolbar = new EditorToolBar(parent, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER,
                                         wxVERTICAL, 1);
   toolbar->SetMargins(2, 2);
 //  toolbar->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH);
                                         wxVERTICAL, 1);
   toolbar->SetMargins(2, 2);
 //  toolbar->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH);
@@ -693,15 +737,7 @@ wxToolBarBase *wxResourceManager::OnCreateToolBar(wxFrame *parent)
   toolbar->AddTool(TOOLBAR_TO_BACK, ToolbarToBackBitmap, (wxBitmap *)NULL,
                    FALSE, (float)currentX, -1, NULL, "To back");
   currentX += width + dx + gap;
   toolbar->AddTool(TOOLBAR_TO_BACK, ToolbarToBackBitmap, (wxBitmap *)NULL,
                    FALSE, (float)currentX, -1, NULL, "To back");
   currentX += width + dx + gap;
-/*
-  toolbar->AddTool(TOOLBAR_GEN_CPP, ToolbarCPPBitmap, (wxBitmap *)NULL,
-                   FALSE, (float)currentX, -1, NULL);
-  currentX += width + dx;
 
 
-  toolbar->AddTool(TOOLBAR_TREE, ToolbarTreeBitmap, (wxBitmap *)NULL,
-                   FALSE, (float)currentX, -1, NULL);
-  currentX += width + dx;
-*/
   toolbar->AddSeparator();
   toolbar->AddTool(TOOLBAR_HELP, ToolbarHelpBitmap, (wxBitmap *)NULL,
                    FALSE, (float)currentX, -1, NULL, "Help");
   toolbar->AddSeparator();
   toolbar->AddTool(TOOLBAR_HELP, ToolbarHelpBitmap, (wxBitmap *)NULL,
                    FALSE, (float)currentX, -1, NULL, "Help");
@@ -714,32 +750,54 @@ wxToolBarBase *wxResourceManager::OnCreateToolBar(wxFrame *parent)
 //  parent->OnSize(-1, -1);
 }
 
 //  parent->OnSize(-1, -1);
 }
 
-void wxResourceManager::UpdateResourceList(void)
+void wxResourceManager::UpdateResourceList()
 {
 {
-  editorResourceList->Clear();
-  resourceTable.BeginFind();
+  if (!m_editorResourceTree)
+      return;
+
+  m_editorResourceTree->SetInvalid(TRUE);
+  m_editorResourceTree->DeleteAllItems();
+
+  long id = m_editorResourceTree->InsertItem(0, "Dialogs"
+#ifdef __WINDOWS__
+     , 1, 2
+#endif
+   );
+
+  m_resourceTable.BeginFind();
   wxNode *node;
   wxNode *node;
-  while (node = resourceTable.Next())
+  while (node = m_resourceTable.Next())
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxString resType(res->GetType());
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxString resType(res->GetType());
-//    if (res->GetType() == wxTYPE_DIALOG_BOX || res->GetType() == wxTYPE_FRAME || res->GetType() == wxTYPE_BITMAP)
     if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel" || resType == "wxBitmap")
     {
     if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel" || resType == "wxBitmap")
     {
-      AddItemsRecursively(0, res);
+      AddItemsRecursively(id, res);
     }
   }
     }
   }
+  m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
+  m_editorResourceTree->SetInvalid(FALSE);
 }
 
 }
 
-void wxResourceManager::AddItemsRecursively(int level, wxItemResource *resource)
+void wxResourceManager::AddItemsRecursively(long parent, wxItemResource *resource)
 {
 {
-  int padWidth = level*4;
-  
   wxString theString("");
   wxString theString("");
-  theString.Append(' ', padWidth);
-  theString += resource->GetName();
+  theString = resource->GetName();
+
+  int imageId = 0;
+  wxString resType(resource->GetType());
+  if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel")
+    imageId = 0;
+  else
+    imageId = 3;
   
   
-  editorResourceList->Append(theString.GetData(), (char *)resource);
+  long id = m_editorResourceTree->InsertItem(parent, theString
+#ifdef __WINDOWS__
+     , imageId
+#endif
+   );
+
+  m_editorResourceTree->SetItemData(id, (long) resource);
 
   if (strcmp(resource->GetType(), "wxBitmap") != 0)
   {
 
   if (strcmp(resource->GetType(), "wxBitmap") != 0)
   {
@@ -747,18 +805,19 @@ void wxResourceManager::AddItemsRecursively(int level, wxItemResource *resource)
     while (node)
     {
       wxItemResource *res = (wxItemResource *)node->Data();
     while (node)
     {
       wxItemResource *res = (wxItemResource *)node->Data();
-      AddItemsRecursively(level+1, res);
+      AddItemsRecursively(id, res);
       node = node->Next();
     }
   }
       node = node->Next();
     }
   }
+  m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
 }
 
 }
 
-bool wxResourceManager::EditSelectedResource(void)
+bool wxResourceManager::EditSelectedResource()
 {
 {
-  int sel = editorResourceList->GetSelection();
+  int sel = m_editorResourceTree->GetSelection();
   if (sel > -1)
   {
   if (sel > -1)
   {
-    wxItemResource *res = (wxItemResource *)editorResourceList->wxListBox::GetClientData(sel);
+    wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel);
     return Edit(res);
   }
   return FALSE;
     return Edit(res);
   }
   return FALSE;
@@ -766,106 +825,47 @@ bool wxResourceManager::EditSelectedResource(void)
 
 bool wxResourceManager::Edit(wxItemResource *res)
 {
 
 bool wxResourceManager::Edit(wxItemResource *res)
 {
+  ClearCurrentDialog();
+
   wxString resType(res->GetType());
   wxString resType(res->GetType());
-  if (resType == "wxDialog" || resType == "wxDialogBox")
-    {
-      wxDialog *dialog = (wxDialog *)FindWindowForResource(res);
-      if (dialog)
-        dialog->Show(TRUE);
-      else
-      {
-        dialog = new wxDialog;
-        wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(dialog, res, dialog->GetEventHandler(),
-           this);
-        dialog->PushEventHandler(handler);
+  wxPanel *panel = (wxPanel *)FindWindowForResource(res);
 
 
-//        dialog->SetUserEditMode(TRUE);
-          
-        dialog->LoadFromResource(GetEditorFrame(), res->GetName(), &resourceTable);
-               handler->AddChildHandlers(); // Add event handlers for all controls
-        dialog->SetModal(FALSE);
-        AssociateResource(res, dialog);
-        dialog->Show(TRUE);
-      }
-    }
-  else if (resType == "wxPanel")
-    {
-      wxPanel *panel = (wxPanel *)FindWindowForResource(res);
-      if (panel)
-        panel->GetParent()->Show(TRUE);
-      else
-      {
-        DialogEditorPanelFrame *frame = new DialogEditorPanelFrame(GetEditorFrame(), res->GetName(), 10, 10, 400, 300, wxDEFAULT_FRAME_STYLE, res->GetName());
+  if (panel)
+  {
+    wxMessageBox("Should not find panel in wxResourceManager::Edit");
+    return FALSE;
+  }
+  else
+  {
+        long style = res->GetStyle();
+        res->SetStyle(style|wxRAISED_BORDER);
         panel = new wxPanel;
         wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, res, panel->GetEventHandler(),
            this);
         panel = new wxPanel;
         wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, res, panel->GetEventHandler(),
            this);
-        panel->PushEventHandler(handler);
-//        panel->SetUserEditMode(TRUE);
-          
-        panel->LoadFromResource(frame, res->GetName(), &resourceTable);
-               handler->AddChildHandlers(); // Add event handlers for all controls
-        AssociateResource(res, panel);
-        frame->SetClientSize(res->GetWidth(), res->GetHeight());
-        frame->Show(TRUE);
-      }
-    }
-  return FALSE;
-}
 
 
-bool wxResourceManager::CreateNewDialog(void)
-{
-  char buf[256];
-  MakeUniqueName("dialog", buf);
-  
-  wxItemResource *resource = new wxItemResource;
-//  resource->SetType(wxTYPE_DIALOG_BOX);
-  resource->SetType("wxDialog");
-  resource->SetName(buf);
-  resource->SetTitle(buf);
-  resourceTable.AddResource(resource);
+        panel->LoadFromResource(m_editorPanel, res->GetName(), &m_resourceTable);
 
 
-#ifdef __MOTIF__
-  wxDialog *dialog = new wxDialog(GetEditorFrame(), -1, buf, wxPoint(10, 10), wxSize(400, 300), wxDEFAULT_DIALOG_STYLE, buf);
-/*
-  dialog->SetBackgroundColour(*wxLIGHT_GREY);
-  dialog->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH);
-  dialog->SetButtonColour(*wxBLACK);
-  dialog->SetLabelColour(*wxBLACK);
-*/
-#else
-  wxDialog *dialog = new wxDialog(GetEditorFrame(), -1, buf, wxPoint(10, 10), wxSize(400, 300), wxDEFAULT_DIALOG_STYLE, buf);
-#endif
-  
-  resource->SetValue1(FALSE); // Modeless to start with
-  resource->SetStyle(dialog->GetWindowStyleFlag());
-
-  // For editing in situ we will need to use the hash table to ensure
-  // we don't dereference invalid pointers.
-//  resourceWindowTable.Put((long)resource, dialog);
-
-  wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(dialog, resource, dialog->GetEventHandler(),
-   this);
+        panel->PushEventHandler(handler);
 
 
-  dialog->PushEventHandler(handler);
-  
-  dialog->Centre(wxBOTH);
-//  dialog->SetUserEditMode(TRUE);
-  dialog->Show(TRUE);
+        res->SetStyle(style);
+               handler->AddChildHandlers(); // Add event handlers for all controls
+        AssociateResource(res, panel);
 
 
-  SetEditMode(TRUE, FALSE);
+        m_editorPanel->m_childWindow = panel;
+        panel->Move(m_editorPanel->GetMarginX(), m_editorPanel->GetMarginY());
+        panel->Show(TRUE);
+        panel->Refresh();
 
 
-  AssociateResource(resource, dialog);
-//  SetCurrentResource(resource);
-//  SetCurrentResourceWindow(dialog);
-  UpdateResourceList();
-  
-  Modify(TRUE);
-  
-  return TRUE;
+        wxClientDC dc(m_editorPanel);
+        m_editorPanel->DrawTitle(dc);
+  }
+  return FALSE;
 }
 
 }
 
-bool wxResourceManager::CreateNewPanel(void)
+bool wxResourceManager::CreateNewPanel()
 {
 {
+  ClearCurrentDialog();
+
   char buf[256];
   MakeUniqueName("panel", buf);
   
   char buf[256];
   MakeUniqueName("panel", buf);
   
@@ -874,24 +874,15 @@ bool wxResourceManager::CreateNewPanel(void)
   resource->SetType("wxPanel");
   resource->SetName(buf);
   resource->SetTitle(buf);
   resource->SetType("wxPanel");
   resource->SetName(buf);
   resource->SetTitle(buf);
-  resourceTable.AddResource(resource);
-  
-  DialogEditorPanelFrame *frame = new DialogEditorPanelFrame(GetEditorFrame(), buf, 10, 10, 400, 300, wxDEFAULT_FRAME_STYLE, buf);
+  m_resourceTable.AddResource(resource);
 
 
-#ifdef __MOTIF__
-  wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 300), 0, buf);
-/*
-  panel->SetBackgroundColour(*wxLIGHT_GREY);
-  panel->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH);
-  panel->SetButtonColour(*wxBLACK);
-  panel->SetLabelColour(*wxBLACK);
-*/
+  wxPanel *panel = new wxPanel(m_editorPanel, -1,
+     wxPoint(m_editorPanel->GetMarginX(), m_editorPanel->GetMarginY()),
+     wxSize(400, 300), wxRAISED_BORDER, buf);
+  m_editorPanel->m_childWindow = panel;
 
 
-#else
-  wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 300), 0, buf);
-#endif
-  
-  resource->SetStyle(panel->GetWindowStyleFlag());
+  resource->SetStyle(0); // panel->GetWindowStyleFlag());
+  resource->SetSize(10, 10, 400, 300);
 
   // For editing in situ we will need to use the hash table to ensure
   // we don't dereference invalid pointers.
 
   // For editing in situ we will need to use the hash table to ensure
   // we don't dereference invalid pointers.
@@ -901,19 +892,17 @@ bool wxResourceManager::CreateNewPanel(void)
    this);
   panel->PushEventHandler(handler);
   
    this);
   panel->PushEventHandler(handler);
   
-  panel->Centre(wxBOTH);
-//  panel->SetUserEditMode(TRUE);
-  frame->Show(TRUE);
-
-  SetEditMode(TRUE, FALSE);
-
   AssociateResource(resource, panel);
   AssociateResource(resource, panel);
-//  SetCurrentResource(resource);
-//  SetCurrentResourceWindow(panel);
   UpdateResourceList();
   
   Modify(TRUE);
   UpdateResourceList();
   
   Modify(TRUE);
-  
+  m_editorPanel->m_childWindow->Refresh();
+
+//  panel->Refresh();
+
+  wxClientDC dc(m_editorPanel);
+  m_editorPanel->DrawTitle(dc);
+
   return TRUE;
 }
 
   return TRUE;
 }
 
@@ -937,7 +926,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
       MakeUniqueName("button", buf);
       res->SetName(buf);
       if (isBitmap)
       MakeUniqueName("button", buf);
       res->SetName(buf);
       if (isBitmap)
-        newItem = new wxBitmapButton(panel, -1, wxWinBitmap, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
+        newItem = new wxBitmapButton(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
       else
         newItem = new wxButton(panel, -1, "Button", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
     }
       else
         newItem = new wxButton(panel, -1, "Button", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf);
     }
@@ -945,14 +934,14 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
     {
       MakeUniqueName("button", buf);
       res->SetName(buf);
     {
       MakeUniqueName("button", buf);
       res->SetName(buf);
-      newItem = new wxBitmapButton(panel, -1, wxWinBitmap, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, 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);
       res->SetName(buf);
       if (isBitmap)
     }
   else if (itemType == "wxMessage" || itemType == "wxStaticText")
     {
       MakeUniqueName("message", buf);
       res->SetName(buf);
       if (isBitmap)
-        newItem = new wxStaticBitmap(panel, -1, wxWinBitmap, wxPoint(x, y), wxSize(0, 0), 0, buf);
+        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);
     }
       else
         newItem = new wxStaticText(panel, -1, "Message", wxPoint(x, y), wxSize(-1, -1), 0, buf);
     }
@@ -960,7 +949,7 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
     {
       MakeUniqueName("message", buf);
       res->SetName(buf);
     {
       MakeUniqueName("message", buf);
       res->SetName(buf);
-      newItem = new wxStaticBitmap(panel, -1, wxWinBitmap, wxPoint(x, y), wxSize(-1, -1), 0, buf);
+      newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf);
     }
   else if (itemType == "wxCheckBox")
     {
     }
   else if (itemType == "wxCheckBox")
     {
@@ -1007,20 +996,20 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
       res->SetName(buf);
       newItem = new wxSlider(panel, -1, 1, 1, 10, wxPoint(x, y), wxSize(120, -1), wxHORIZONTAL, wxDefaultValidator, 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")
+  else if (itemType == "wxText" || itemType == "wxTextCtrl (single-line)")
     {
     {
-      MakeUniqueName("text", buf);
+      MakeUniqueName("textctrl", buf);
       res->SetName(buf);
       res->SetName(buf);
+      res->SetType("wxTextCtrl");
       newItem = new wxTextCtrl(panel, -1, "", wxPoint(x, y), wxSize(120, -1), 0, wxDefaultValidator, buf);
     }
       newItem = new wxTextCtrl(panel, -1, "", wxPoint(x, y), wxSize(120, -1), 0, wxDefaultValidator, buf);
     }
-/*
-  else if (itemType == "wxMultiText")
+  else if (itemType == "wxMultiText" || itemType == "wxTextCtrl (multi-line)")
     {
     {
-      MakeUniqueName("multitext", buf);
+      MakeUniqueName("textctrl", buf);
       res->SetName(buf);
       res->SetName(buf);
-      newItem = new wxMultiText(panel, (wxFunction)NULL, "Multitext", "", x, y, -1, -1, 0, wxDefaultValidator, buf);
+      res->SetType("wxTextCtrl");
+      newItem = new wxTextCtrl(panel, -1, "", wxPoint(x, y), wxSize(120, 100), wxTE_MULTILINE, wxDefaultValidator, buf);
     }
     }
-*/
   else if (itemType == "wxScrollBar")
     {
       MakeUniqueName("scrollbar", buf);
   else if (itemType == "wxScrollBar")
     {
       MakeUniqueName("scrollbar", buf);
@@ -1041,13 +1030,25 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
   return TRUE;
 }
 
   return TRUE;
 }
 
+void wxResourceManager::ClearCurrentDialog()
+{
+  if (m_editorPanel->m_childWindow)
+  {
+    SaveInfoAndDeleteHandler(m_editorPanel->m_childWindow);
+    DisassociateResource(m_editorPanel->m_childWindow);
+    DeleteWindow(m_editorPanel->m_childWindow);
+    m_editorPanel->m_childWindow = NULL;
+    m_editorPanel->Clear();
+  }
+}
+
 // Find the first dialog or panel for which
 // there is a selected panel item.
 // Find the first dialog or panel for which
 // there is a selected panel item.
-wxWindow *wxResourceManager::FindParentOfSelection(void)
+wxWindow *wxResourceManager::FindParentOfSelection()
 {
 {
-  resourceTable.BeginFind();
+  m_resourceTable.BeginFind();
   wxNode *node;
   wxNode *node;
-  while (node = resourceTable.Next())
+  while (node = m_resourceTable.Next())
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxWindow *win = FindWindowForResource(res);
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxWindow *win = FindWindowForResource(res);
@@ -1150,7 +1151,7 @@ void wxResourceManager::AlignItems(int flag)
 }
 
 // Copy the first image's size to subsequent images
 }
 
 // Copy the first image's size to subsequent images
-void wxResourceManager::CopySize(void)
+void wxResourceManager::CopySize()
 {
   wxWindow *win = FindParentOfSelection();
   if (!win)
 {
   wxWindow *win = FindParentOfSelection();
   if (!win)
@@ -1217,22 +1218,22 @@ void wxResourceManager::ToBackOrFront(bool toBack)
 
 void wxResourceManager::AddSelection(wxWindow *win)
 {
 
 void wxResourceManager::AddSelection(wxWindow *win)
 {
-  if (!selections.Member(win))
-    selections.Append(win);
+  if (!m_selections.Member(win))
+    m_selections.Append(win);
 }
 
 void wxResourceManager::RemoveSelection(wxWindow *win)
 {
 }
 
 void wxResourceManager::RemoveSelection(wxWindow *win)
 {
-  selections.DeleteObject(win);
+  m_selections.DeleteObject(win);
 }
 
 // Need to search through resource table removing this from
 // any resource which has this as a parent.
 bool wxResourceManager::RemoveResourceFromParent(wxItemResource *res)
 {
 }
 
 // Need to search through resource table removing this from
 // any resource which has this as a parent.
 bool wxResourceManager::RemoveResourceFromParent(wxItemResource *res)
 {
-  resourceTable.BeginFind();
+  m_resourceTable.BeginFind();
   wxNode *node;
   wxNode *node;
-  while (node = resourceTable.Next())
+  while (node = m_resourceTable.Next())
   {
     wxItemResource *thisRes = (wxItemResource *)node->Data();
     if (thisRes->GetChildren().Member(res))
   {
     wxItemResource *thisRes = (wxItemResource *)node->Data();
     if (thisRes->GetChildren().Member(res))
@@ -1264,18 +1265,18 @@ bool wxResourceManager::DeleteResource(wxItemResource *res)
   // associate bitmap resource if not being used.
   wxString resType(res->GetType());
   
   // associate bitmap resource if not being used.
   wxString resType(res->GetType());
   
-  if ((resType == "wxMessage" || resType == "wxButton") && res->GetValue4())
+  if ((resType == "wxMessage" || resType == "wxStaticBitmap" || resType == "wxButton" || resType == "wxBitmapButton") && res->GetValue4())
   {
     PossiblyDeleteBitmapResource(res->GetValue4());
   }
 
   {
     PossiblyDeleteBitmapResource(res->GetValue4());
   }
 
-  resourceTable.Delete(res->GetName());
+  m_resourceTable.Delete(res->GetName());
   delete res;
   Modify(TRUE);
   return TRUE;
 }
 
   delete res;
   Modify(TRUE);
   return TRUE;
 }
 
-bool wxResourceManager::DeleteResource(wxWindow *win, bool deleteWindow)
+bool wxResourceManager::DeleteResource(wxWindow *win)
 {
   if (win->IsKindOf(CLASSINFO(wxControl)))
   {
 {
   if (win->IsKindOf(CLASSINFO(wxControl)))
   {
@@ -1293,13 +1294,10 @@ bool wxResourceManager::DeleteResource(wxWindow *win, bool deleteWindow)
   
   wxItemResource *res = FindResourceForWindow(win);
   
   
   wxItemResource *res = FindResourceForWindow(win);
   
-  DisassociateResource(res, deleteWindow);
+  DisassociateResource(res);
   DeleteResource(res);
   UpdateResourceList();
 
   DeleteResource(res);
   UpdateResourceList();
 
-  // What about associated event handler? Must clean up! BUGBUG
-//  if (win && deleteWindow)
-//    delete win;
   return TRUE;
 }
 
   return TRUE;
 }
 
@@ -1327,7 +1325,7 @@ char *wxResourceManager::AddBitmapResource(char *filename)
     child->SetSize(0,0,0,0);
     resource->GetChildren().Append(child);
 
     child->SetSize(0,0,0,0);
     resource->GetChildren().Append(child);
 
-    resourceTable.AddResource(resource);
+    m_resourceTable.AddResource(resource);
 
     UpdateResourceList();
   }
 
     UpdateResourceList();
   }
@@ -1342,7 +1340,7 @@ void wxResourceManager::PossiblyDeleteBitmapResource(char *resourceName)
 {
   if (!IsBitmapResourceUsed(resourceName))
   {
 {
   if (!IsBitmapResourceUsed(resourceName))
   {
-    wxItemResource *res = resourceTable.FindResource(resourceName);
+    wxItemResource *res = m_resourceTable.FindResource(resourceName);
     DeleteResource(res);
     UpdateResourceList();
   }
     DeleteResource(res);
     UpdateResourceList();
   }
@@ -1350,9 +1348,9 @@ void wxResourceManager::PossiblyDeleteBitmapResource(char *resourceName)
 
 bool wxResourceManager::IsBitmapResourceUsed(char *resourceName)
 {
 
 bool wxResourceManager::IsBitmapResourceUsed(char *resourceName)
 {
-  resourceTable.BeginFind();
+  m_resourceTable.BeginFind();
   wxNode *node;
   wxNode *node;
-  while (node = resourceTable.Next())
+  while (node = m_resourceTable.Next())
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxString resType(res->GetType());
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxString resType(res->GetType());
@@ -1380,7 +1378,7 @@ char *wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource)
 {
   if (!resource || !resource->GetValue4())
     return NULL;
 {
   if (!resource || !resource->GetValue4())
     return NULL;
-  wxItemResource *bitmapResource = resourceTable.FindResource(resource->GetValue4());
+  wxItemResource *bitmapResource = m_resourceTable.FindResource(resource->GetValue4());
   if (!bitmapResource)
     return NULL;
 
   if (!bitmapResource)
     return NULL;
 
@@ -1400,9 +1398,9 @@ char *wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource)
 
 wxItemResource *wxResourceManager::FindBitmapResourceByFilename(char *filename)
 {
 
 wxItemResource *wxResourceManager::FindBitmapResourceByFilename(char *filename)
 {
-  resourceTable.BeginFind();
+  m_resourceTable.BeginFind();
   wxNode *node;
   wxNode *node;
-  while (node = resourceTable.Next())
+  while (node = m_resourceTable.Next())
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxString resType(res->GetType());
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxString resType(res->GetType());
@@ -1433,7 +1431,7 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
   wxWindowPropertyInfo *newInfo = NULL;
   if (!info)
   {
   wxWindowPropertyInfo *newInfo = NULL;
   if (!info)
   {
-    newInfo = wxCreatePropertyInfoForWindow(win);
+    newInfo = CreatePropertyInfoForWindow(win);
     info = newInfo;
   }
 
     info = newInfo;
   }
 
@@ -1444,25 +1442,14 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
   
   if (win->IsKindOf(CLASSINFO(wxPanel)))
   {
   
   if (win->IsKindOf(CLASSINFO(wxPanel)))
   {
-    bool isDialog = win->IsKindOf(CLASSINFO(wxDialog));
-    wxWindow *parent = win->GetParent();
-    
-    win->GetEventHandler()->OnClose();
-    
-    if (!isDialog && parent)
-    {
-      // Delete frame parent of panel if this is not a dialog box
-      parent->Close(TRUE);
-    }
-
     Edit(resource);
     newWin = FindWindowForResource(resource);
   }
   else
   {
     Edit(resource);
     newWin = FindWindowForResource(resource);
   }
   else
   {
-    DisassociateResource(resource, FALSE);
-    delete win;
-    newWin = resourceTable.CreateItem((wxPanel *)parent, resource);
+    DisassociateResource(resource);
+    DeleteWindow(win);
+    newWin = m_resourceTable.CreateItem((wxPanel *)parent, resource);
     AssociateResource(resource, newWin);
     UpdateResourceList();
   }
     AssociateResource(resource, newWin);
     UpdateResourceList();
   }
@@ -1477,39 +1464,28 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
 }
 
 // Delete resource highlighted in the listbox
 }
 
 // Delete resource highlighted in the listbox
-bool wxResourceManager::DeleteSelection(bool deleteWindow)
+bool wxResourceManager::DeleteSelection()
 {
 {
-  int sel = editorResourceList->GetSelection();
+  int sel = m_editorResourceTree->GetSelection();
   if (sel > -1)
   {
   if (sel > -1)
   {
-    wxItemResource *res = (wxItemResource *)editorResourceList->wxListBox::GetClientData(sel);
+    wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel);
     wxWindow *win = FindWindowForResource(res);
     wxWindow *win = FindWindowForResource(res);
-/*
-    if (res == currentResource)
+    if (win)
     {
     {
-      currentResource = NULL;
-      currentResourceWindow = NULL;
+        DeleteResource(win);
+        DeleteWindow(win);
+        UpdateResourceList();
+        Modify(TRUE);
     }
     }
-*/
-
-    DisassociateResource(res, deleteWindow);
-    DeleteResource(res);
-    UpdateResourceList();
-
-/*
-    // What about associated event handler? Must clean up! BUGBUG
-    if (win && deleteWindow)
-      delete win;
-*/
-
-    Modify(TRUE);
+    return TRUE;
   }
 
   return FALSE;
 }
 
 // Delete resource highlighted in the listbox
   }
 
   return FALSE;
 }
 
 // Delete resource highlighted in the listbox
-bool wxResourceManager::RecreateSelection(void)
+bool wxResourceManager::RecreateSelection()
 {
   wxNode *node = GetSelections().First();
   while (node)
 {
   wxNode *node = GetSelections().First();
   while (node)
@@ -1533,74 +1509,13 @@ bool wxResourceManager::EditDialog(wxDialog *dialog, wxWindow *parent)
   return FALSE;
 }
 
   return FALSE;
 }
 
-void wxResourceManager::SetEditMode(bool flag, bool changeCurrentResource)
-{
-  editMode = flag;
-  if (editorFrame)
-    editorFrame->SetStatusText(editMode ? "Edit mode" : "Test mode", 1);
-
-  // Switch mode for each dialog in the resource list
-  resourceTable.BeginFind();
-  wxNode *node = resourceTable.Next();
-  while (node)
-  {
-    wxItemResource *resource = (wxItemResource *)node->Data();
-    wxWindow *currentResourceWindow = FindWindowForResource(resource);
-  
-    if (changeCurrentResource && currentResourceWindow && (currentResourceWindow->IsKindOf(CLASSINFO(wxPanel))))
-    {
-      wxPanel *panel = (wxPanel *)currentResourceWindow;
-      if (editMode)
-      {
-        // If we have already installed our own handler, don't bother editing.
-        // This test will need to be changed eventually because for in-situ editing,
-        // the user might have installed a different one anyway.
-        wxEvtHandler *handler = panel->GetEventHandler();
-           handler->SetEvtHandlerEnabled(TRUE);
-        // Enable all children
-        wxNode *node = panel->GetChildren()->First();
-        while (node)
-        {
-          wxControl *item = (wxControl *)node->Data();
-                 if ( item->IsKindOf(CLASSINFO(wxControl)) )
-                 {
-               wxEvtHandler *childHandler = item->GetEventHandler();
-                       childHandler->SetEvtHandlerEnabled(TRUE);
-                 }
-          node = node->Next();
-        }
-      }
-      else
-      {
-        wxEvtHandler *handler = panel->GetEventHandler();
-               handler->SetEvtHandlerEnabled(FALSE);
-        // Deselect all items on the dialog and refresh.
-        wxNode *node = panel->GetChildren()->First();
-        while (node)
-        {
-          wxControl *item = (wxControl *)node->Data();
-          if (item->IsKindOf(CLASSINFO(wxControl)))
-             {
-                    wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
-                    childHandler->SetEvtHandlerEnabled(FALSE);
-             childHandler->SelectItem(FALSE);
-                 }
-          node = node->Next();
-        }
-        panel->Refresh();
-      }
-    }
-    node = resourceTable.Next();
-  }
-}
-
 // Ensures that all currently shown windows are saved to resources,
 // e.g. just before writing to a .wxr file.
 // Ensures that all currently shown windows are saved to resources,
 // e.g. just before writing to a .wxr file.
-bool wxResourceManager::InstantiateAllResourcesFromWindows(void)
+bool wxResourceManager::InstantiateAllResourcesFromWindows()
 {
 {
-  resourceTable.BeginFind();
+  m_resourceTable.BeginFind();
   wxNode *node;
   wxNode *node;
-  while (node = resourceTable.Next())
+  while (node = m_resourceTable.Next())
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxString resType(res->GetType());
   {
     wxItemResource *res = (wxItemResource *)node->Data();
     wxString resType(res->GetType());
@@ -1623,7 +1538,7 @@ bool wxResourceManager::InstantiateAllResourcesFromWindows(void)
 
 bool wxResourceManager::InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse)
 {
 
 bool wxResourceManager::InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse)
 {
-  wxWindowPropertyInfo *info = wxCreatePropertyInfoForWindow(window);
+  wxWindowPropertyInfo *info = CreatePropertyInfoForWindow(window);
   info->SetResource(resource);
   info->InstantiateResource(resource);
   delete info;
   info->SetResource(resource);
   info->InstantiateResource(resource);
   delete info;
@@ -1651,114 +1566,194 @@ bool wxResourceManager::InstantiateResourceFromWindow(wxItemResource *resource,
   return TRUE;
 }
 
   return TRUE;
 }
 
+// Create a window information object for the give window
+wxWindowPropertyInfo *wxResourceManager::CreatePropertyInfoForWindow(wxWindow *win)
+{
+  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(wxChoice)))
+        {
+          info = new wxChoicePropertyInfo(win);
+        }
+  else if (win->IsKindOf(CLASSINFO(wxButton)))
+        {
+          info = new wxButtonPropertyInfo(win);
+        }
+  else if (win->IsKindOf(CLASSINFO(wxBitmapButton)))
+        {
+          info = new wxBitmapButtonPropertyInfo(win);
+        }
+  else if (win->IsKindOf(CLASSINFO(wxStaticText)))
+        {
+          info = new wxStaticTextPropertyInfo(win);
+        }
+  else if (win->IsKindOf(CLASSINFO(wxStaticBitmap)))
+        {
+          info = new wxStaticBitmapPropertyInfo(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);
+  }
+}
+
 
 /*
  * Resource editor frame
  */
 
 /*
  * Resource editor frame
  */
-wxResourceEditorFrame::wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, char *title,
-    int x, int y, int width, int height, long style, char *name):
-  wxFrame(parent, -1, title, wxPoint(x, y), wxSize(width, height), style, name)
+
+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)
+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;
 }
 
 {
   manager = resMan;
 }
 
-wxResourceEditorFrame::~wxResourceEditorFrame(void)
+wxResourceEditorFrame::~wxResourceEditorFrame()
 {
 }
 
 {
 }
 
-void wxResourceEditorFrame::OldOnMenuCommand(int cmd)
+void wxResourceEditorFrame::OnNew(wxCommandEvent& event)
 {
 {
-  switch (cmd)
-  {
-    case wxID_NEW:
-    {
       manager->New(FALSE);
       manager->New(FALSE);
-      break;
-    }
-    case RESED_NEW_DIALOG:
-    {
-      manager->CreateNewDialog();
-      break;
-    }
-    case RESED_NEW_PANEL:
-    {
+}
+
+void wxResourceEditorFrame::OnNewDialog(wxCommandEvent& event)
+{
       manager->CreateNewPanel();
       manager->CreateNewPanel();
-      break;
-    }
-    case wxID_OPEN:
-    {
+}
+
+void wxResourceEditorFrame::OnOpen(wxCommandEvent& event)
+{
       manager->New(TRUE);
       manager->New(TRUE);
-      break;
-    }
-    case RESED_CLEAR:
-    {
+}
+
+void wxResourceEditorFrame::OnClear(wxCommandEvent& event)
+{
       manager->Clear(TRUE, FALSE);
       manager->Clear(TRUE, FALSE);
-      break;
-    }
-    case wxID_SAVE:
-    {
+}
+
+void wxResourceEditorFrame::OnSave(wxCommandEvent& event)
+{
       manager->Save();
       manager->Save();
-      break;
-    }
-    case wxID_SAVEAS:
-    {
+}
+
+void wxResourceEditorFrame::OnSaveAs(wxCommandEvent& event)
+{
       manager->SaveAs();
       manager->SaveAs();
-      break;
-    }
-    case wxID_EXIT:
-    {
+}
+
+void wxResourceEditorFrame::OnExit(wxCommandEvent& event)
+{
          manager->Clear(TRUE, FALSE) ;
       this->Close();
          manager->Clear(TRUE, FALSE) ;
       this->Close();
-      break;
-    }
-    case wxID_ABOUT:
-    {
+}
+
+void wxResourceEditorFrame::OnAbout(wxCommandEvent& event)
+{
       char buf[300];
       sprintf(buf, "wxWindows Dialog Editor %.1f\nAuthor: Julian Smart J.Smart@ed.ac.uk\nJulian Smart (c) 1996", wxDIALOG_EDITOR_VERSION);
       char buf[300];
       sprintf(buf, "wxWindows Dialog Editor %.1f\nAuthor: Julian Smart J.Smart@ed.ac.uk\nJulian Smart (c) 1996", wxDIALOG_EDITOR_VERSION);
-      (void)wxMessageBox(buf, "About Dialog Editor", wxOK|wxCENTRE);
-      break;
-    }
-    case RESED_CONTENTS:
-    {
+      wxMessageBox(buf, "About Dialog Editor", wxOK|wxCENTRE);
+}
+
+void wxResourceEditorFrame::OnTest(wxCommandEvent& event)
+{
+    // TODO should show the current dialog
+}
+
+void wxResourceEditorFrame::OnContents(wxCommandEvent& event)
+{
       wxBeginBusyCursor();
       wxBeginBusyCursor();
-      manager->GetHelpInstance()->LoadFile();
-      manager->GetHelpInstance()->DisplayContents();
+      manager->GetHelpController()->LoadFile();
+      manager->GetHelpController()->DisplayContents();
       wxEndBusyCursor();
       wxEndBusyCursor();
-      break;
-    }
-    case RESED_DELETE:
-    {
+}
+
+void wxResourceEditorFrame::OnDeleteSelection(wxCommandEvent& event)
+{
       manager->DeleteSelection();
       manager->DeleteSelection();
-      break;
-    }
-    case RESED_RECREATE:
-    {
+}
+
+void wxResourceEditorFrame::OnRecreateSelection(wxCommandEvent& event)
+{
       manager->RecreateSelection();
       manager->RecreateSelection();
-      break;
-    }
-    case RESED_TOGGLE_TEST_MODE:
-    {
-      manager->SetEditMode(!manager->GetEditMode());
-      break;
-    }
-    default:
-      break;
-  }
 }
 
 }
 
-bool wxResourceEditorFrame::OnClose(void)
+bool wxResourceEditorFrame::OnClose()
 {
   if (manager->Modified())
   {
 {
   if (manager->Modified())
   {
-/*
-    int ans = wxMessageBox("Save modified resource file?", "Dialog Editor", wxYES_NO | wxCANCEL);
-    if (ans == wxCANCEL)
-      return FALSE;
-    if (ans == wxYES)
-      if (!manager->SaveIfModified())
-        return FALSE;
-*/
   if (!manager->Clear(TRUE, FALSE))
      return FALSE;
   }
   if (!manager->Clear(TRUE, FALSE))
      return FALSE;
   }
@@ -1767,14 +1762,14 @@ bool wxResourceEditorFrame::OnClose(void)
   {
     int w, h;
     GetSize(&w, &h);
   {
     int w, h;
     GetSize(&w, &h);
-    manager->resourceEditorWindowSize.width = w;
-    manager->resourceEditorWindowSize.height = h;
+    manager->m_resourceEditorWindowSize.width = w;
+    manager->m_resourceEditorWindowSize.height = h;
 
     int x, y;
     GetPosition(&x, &y);
 
 
     int x, y;
     GetPosition(&x, &y);
 
-    manager->resourceEditorWindowSize.x = x;
-    manager->resourceEditorWindowSize.y = y;
+    manager->m_resourceEditorWindowSize.x = x;
+    manager->m_resourceEditorWindowSize.y = y;
   }
   manager->SetEditorFrame(NULL);
   manager->SetEditorToolBar(NULL);
   }
   manager->SetEditorFrame(NULL);
   manager->SetEditorToolBar(NULL);
@@ -1784,28 +1779,67 @@ bool wxResourceEditorFrame::OnClose(void)
 }
 
 /*
 }
 
 /*
- * Resource editor panel
+ * Resource editor window that contains the dialog/panel being edited
  */
  */
-wxResourceEditorPanel::wxResourceEditorPanel(wxWindow *parent, int x, int y, int width, int height,
-    long style, char *name):
-  wxPanel(parent, -1, wxPoint(x, y), wxSize(width, height), style, name)
+
+BEGIN_EVENT_TABLE(wxResourceEditorScrolledWindow, wxScrolledWindow)
+    EVT_SCROLL(wxResourceEditorScrolledWindow::OnScroll)
+    EVT_PAINT(wxResourceEditorScrolledWindow::OnPaint)
+END_EVENT_TABLE()
+
+wxResourceEditorScrolledWindow::wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size,
+    long style):
+  wxScrolledWindow(parent, -1, pos, size, style)
 {
 {
+    m_marginX = 10;
+    m_marginY = 40;
+    m_childWindow = NULL;
 }
 
 }
 
-wxResourceEditorPanel::~wxResourceEditorPanel(void)
+wxResourceEditorScrolledWindow::~wxResourceEditorScrolledWindow()
 {
 }
 
 {
 }
 
-void wxResourceEditorPanel::OnDefaultAction(wxControl *item)
+void wxResourceEditorScrolledWindow::OnScroll(wxScrollEvent& event)
 {
 {
-  wxResourceEditorFrame *frame = (wxResourceEditorFrame *)GetParent();
-  wxResourceManager *manager = frame->manager;
+    wxScrolledWindow::OnScroll(event);
 
 
-  if (item == manager->GetEditorResourceList())
-  {
-    manager->EditSelectedResource();
-  }
+    int x, y;
+    ViewStart(& x, & y);
+
+    if (m_childWindow)
+        m_childWindow->Move(m_marginX + (- x * 10), m_marginY + (- y * 10));
+}
+
+void wxResourceEditorScrolledWindow::OnPaint(wxPaintEvent& event)
+{
+    wxPaintDC dc(this);
+
+    DrawTitle(dc);
+}
+
+void wxResourceEditorScrolledWindow::DrawTitle(wxDC& dc)
+{
+    if (m_childWindow)
+    {
+        wxItemResource* res = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_childWindow);
+        if (res)
+        {
+            wxString str(res->GetTitle());
+            int x, y;
+            ViewStart(& x, & y);
+
+            wxFont font(10, wxSWISS, wxNORMAL, wxBOLD);
+            dc.SetFont(font);
+            dc.SetBackgroundMode(wxTRANSPARENT);
+            dc.SetTextForeground(wxColour(0, 0, 0));
+
+            long w, h;
+            dc.GetTextExtent(str, & w, & h);
+
+            dc.DrawText(str, m_marginX + (- x * 10), m_marginY + (- y * 10) - h - 5);
+        }
+    }
 }
 
 // Popup menu callback
 }
 
 // Popup menu callback
@@ -1819,12 +1853,14 @@ void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event)
   {
     case OBJECT_MENU_EDIT:
     {
   {
     case OBJECT_MENU_EDIT:
     {
-      wxResourceEditWindow(data);
+      wxResourceManager::GetCurrentResourceManager()->EditWindow(data);
       break;
     }
     case OBJECT_MENU_DELETE:
     {
       break;
     }
     case OBJECT_MENU_DELETE:
     {
-      wxResourceManager::currentResourceManager->DeleteResource(data);
+      wxResourceManager::GetCurrentResourceManager()->SaveInfoAndDeleteHandler(data);
+      wxResourceManager::GetCurrentResourceManager()->DeleteResource(data);
+      wxResourceManager::GetCurrentResourceManager()->DeleteWindow(data);
       break;
     }
     default:
       break;
     }
     default:
@@ -1832,126 +1868,25 @@ void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event)
   }
 }
 
   }
 }
 
-wxWindowPropertyInfo *wxCreatePropertyInfoForWindow(wxWindow *win)
-{
-  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(wxChoice)))
-        {
-          info = new wxChoicePropertyInfo(win);
-        }
-  else if (win->IsKindOf(CLASSINFO(wxButton)))
-        {
-          info = new wxButtonPropertyInfo(win);
-/*
-          if (((wxButton *)win)->IsBitmap())
-            ((wxButtonPropertyInfo *)info)->isBitmapButton = TRUE;
-*/
-        }
-  else if (win->IsKindOf(CLASSINFO(wxStaticText)))
-        {
-          info = new wxStaticTextPropertyInfo(win);
-/*
-          if (((wxMessage *)win)->IsBitmap())
-            ((wxMessagePropertyInfo *)info)->isBitmapMessage = TRUE;
-*/
-        }
-  else if (win->IsKindOf(CLASSINFO(wxTextCtrl)))
-        {
-          info = new wxTextPropertyInfo(win);
-        }
-  else if (win->IsKindOf(CLASSINFO(wxDialog)))
-        {
-          info = new wxDialogPropertyInfo(win);
-        }
-  else if (win->IsKindOf(CLASSINFO(wxPanel)))
-        {
-          info = new wxPanelPropertyInfo(win);
-        }
-  else
-        {
-          info = new wxWindowPropertyInfo(win);
-        }
-  return info;
-}
-
-// Popup menu callback
-void wxResourceEditWindow(wxWindow *win)
-{
-  wxWindowPropertyInfo *info = wxCreatePropertyInfoForWindow(win);
-  if (info)
-  {
-    info->SetResource(wxResourceManager::currentResourceManager->FindResourceForWindow(win));
-    wxString str("Editing ");
-    str += win->GetClassInfo()->GetClassName();
-    str += ": ";
-    if (win->GetName() != "")
-        str += win->GetName();
-    else
-        str += "properties";
-    info->Edit(NULL, WXSTRINGCAST str);
-    delete info;
-  }
-}
-
 /*
  * Main toolbar
  *
  */
 
 /*
  * Main toolbar
  *
  */
 
-#if defined(__WINDOWS__) && defined(__WIN95__)
-BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar95)
-#elif defined(__WINDOWS__)
-BEGIN_EVENT_TABLE(EditorToolBar, wxToolBarMSW)
-#else
-BEGIN_EVENT_TABLE(EditorToolBar, wxToolBarSimple)
-#endif
+BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar)
        EVT_PAINT(EditorToolBar::OnPaint)
 END_EVENT_TABLE()
 
        EVT_PAINT(EditorToolBar::OnPaint)
 END_EVENT_TABLE()
 
-EditorToolBar::EditorToolBar(wxFrame *frame, int x, int y, int w, int h,
+EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& size,
             long style, int direction, int RowsOrColumns):
             long style, int direction, int RowsOrColumns):
-#if defined(__WINDOWS__) && defined(__WIN95__)
-  wxToolBar95(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns)
-#elif defined(__WINDOWS__)
-  wxToolBarMSW(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns)
-#else
-  wxToolBarSimple(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns)
-#endif
+  wxToolBar(frame, -1, pos, size, style, direction, RowsOrColumns)
 {
 }
 
 bool EditorToolBar::OnLeftClick(int toolIndex, bool toggled)
 {
 {
 }
 
 bool EditorToolBar::OnLeftClick(int toolIndex, bool toggled)
 {
-  wxResourceManager *manager = wxResourceManager::currentResourceManager;
-  
+  wxResourceManager *manager = wxResourceManager::GetCurrentResourceManager();
+
   switch (toolIndex)
   {
     case TOOLBAR_LOAD_FILE:
   switch (toolIndex)
   {
     case TOOLBAR_LOAD_FILE:
@@ -1961,7 +1896,7 @@ bool EditorToolBar::OnLeftClick(int toolIndex, bool toggled)
     }
     case TOOLBAR_NEW:
     {
     }
     case TOOLBAR_NEW:
     {
-      manager->New(FALSE);
+      manager->CreateNewPanel();
       break;
     }
     case TOOLBAR_SAVE_FILE:
       break;
     }
     case TOOLBAR_SAVE_FILE:
@@ -1972,8 +1907,8 @@ bool EditorToolBar::OnLeftClick(int toolIndex, bool toggled)
     case TOOLBAR_HELP:
     {
       wxBeginBusyCursor();
     case TOOLBAR_HELP:
     {
       wxBeginBusyCursor();
-      manager->GetHelpInstance()->LoadFile();
-      manager->GetHelpInstance()->DisplayContents();
+      manager->GetHelpController()->LoadFile();
+      manager->GetHelpController()->DisplayContents();
       wxEndBusyCursor();
       break;
     }
       wxEndBusyCursor();
       break;
     }
@@ -2086,13 +2021,7 @@ void EditorToolBar::OnMouseEnter(int toolIndex)
 
 void EditorToolBar::OnPaint(wxPaintEvent& event)
 {
 
 void EditorToolBar::OnPaint(wxPaintEvent& event)
 {
-#if defined(__WINDOWS__) && defined(__WIN95__)
-  wxToolBar95::OnPaint(event);
-#elif defined(__WINDOWS__)
-  wxToolBarMSW::OnPaint(event);
-#else
-  wxToolBarSimple::OnPaint(event);
-#endif
+  wxToolBar::OnPaint(event);
 
   wxPaintDC dc(this);
   int w, h;
 
   wxPaintDC dc(this);
   int w, h;
@@ -2102,13 +2031,4 @@ void EditorToolBar::OnPaint(wxPaintEvent& event)
   dc.DrawLine(0, h-1, w, h-1);
 }
 
   dc.DrawLine(0, h-1, w, h-1);
 }
 
-/*
- * Frame for editing a panel in
- */
-bool DialogEditorPanelFrame::OnClose(void)
-{
-  wxWindow *child = (wxWindow *)GetChildren()->First()->Data();
-  wxEvtHandler *handler = child->GetEventHandler();
-  return handler->OnClose();
-}
+
index ef629f21b387ba89337852b2b8b5028a483d0b71..c2dcec4453effec4aba7abc6b9e2763ad51c1806 100644 (file)
 #include "wx/string.h"
 #include "wx/layout.h"
 #include "wx/resource.h"
 #include "wx/string.h"
 #include "wx/layout.h"
 #include "wx/resource.h"
-#include "wx/tbarsmpl.h"
+#include "wx/toolbar.h"
+#include "wx/imaglist.h"
 
 #include "proplist.h"
 
 
 #include "proplist.h"
 
-#if defined(__WINDOWS__) && defined(__WIN95__)
-#include "wx/tbar95.h"
-#elif defined(__WINDOWS__)
-#include "wx/tbarmsw.h"
-#endif
-
 #define RESED_DELETE            1
 #define RESED_DELETE            1
-#define RESED_TOGGLE_TEST_MODE  2
 #define RESED_RECREATE          3
 #define RESED_CLEAR             4
 #define RESED_NEW_DIALOG        5
 #define RESED_NEW_PANEL         6
 #define RESED_RECREATE          3
 #define RESED_CLEAR             4
 #define RESED_NEW_DIALOG        5
 #define RESED_NEW_PANEL         6
+#define RESED_TEST              10
 
 #define RESED_CONTENTS          20
 
 
 #define RESED_CONTENTS          20
 
+#define IDC_TREECTRL            100
+#define IDC_LISTCTRL            101
+
+// For control list ('palette')
+#define RESED_POINTER           0
+#define RESED_BUTTON            1
+#define RESED_BMPBUTTON         2
+#define RESED_STATICTEXT        3
+#define RESED_STATICBMP         4
+#define RESED_STATICBOX         5
+#define RESED_TEXTCTRL_SINGLE   6
+#define RESED_TEXTCTRL_MULTIPLE 7
+#define RESED_LISTBOX           8
+#define RESED_CHOICE            9
+#define RESED_COMBOBOX          10
+#define RESED_CHECKBOX          11
+#define RESED_SLIDER            12
+#define RESED_GAUGE             13
+#define RESED_RADIOBOX          14
+#define RESED_RADIOBUTTON       15
+#define RESED_SCROLLBAR         16
+#define RESED_TREECTRL          17
+#define RESED_LISTCTRL          18
+#define RESED_SPINBUTTON        19
+
 /*
  * Controls loading, saving, user interface of resource editor(s).
  */
 /*
  * Controls loading, saving, user interface of resource editor(s).
  */
@@ -49,6 +69,8 @@ class wxResourceEditorFrame;
 class EditorToolPalette;
 class EditorToolBar;
 class wxWindowPropertyInfo;
 class EditorToolPalette;
 class EditorToolBar;
 class wxWindowPropertyInfo;
+class wxResourceEditorProjectTree;
+class wxResourceEditorControlList;
 
 #ifdef __WINDOWS__
 #define wxHelpController wxWinHelpController
 
 #ifdef __WINDOWS__
 #define wxHelpController wxWinHelpController
@@ -88,7 +110,7 @@ class wxHelpController;
 class wxResourceTableWithSaving: public wxResourceTable
 {
  public:
 class wxResourceTableWithSaving: public wxResourceTable
 {
  public:
-  wxResourceTableWithSaving(void):wxResourceTable()
+  wxResourceTableWithSaving():wxResourceTable()
   {
   }
   virtual bool Save(const wxString& filename);
   {
   }
   virtual bool Save(const wxString& filename);
@@ -117,80 +139,73 @@ class wxResourceTableWithSaving: public wxResourceTable
   wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource);
 };
  
   wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource);
 };
  
+class wxResourceEditorScrolledWindow;
+
 class wxResourceManager: public wxObject
 {
 class wxResourceManager: public wxObject
 {
- protected:
-   wxHelpController *helpInstance;
-   wxResourceTableWithSaving resourceTable;
-   wxFrame *editorFrame;
-   wxPanel *editorPanel;
-   wxMenu *popupMenu;
-   wxListBox *editorResourceList;
-   EditorToolPalette *editorPalette;
-   EditorToolBar *editorToolBar;
-   int nameCounter;
-   bool modified;
-   bool editMode;
-   wxHashTable resourceAssociations;
-   wxList selections;
-   wxString currentFilename;
-   
- public:
-   // Options to be saved/restored
-   wxString optionsResourceFilename; // e.g. dialoged.ini, .dialogrc
-   wxRectangle propertyWindowSize;
-   wxRectangle resourceEditorWindowSize;
+   friend class wxResourceEditorFrame;
 
 
- public:
-   static wxResourceManager *currentResourceManager;
+public:
+   wxResourceManager();
+   ~wxResourceManager();
 
 
-   wxResourceManager(void);
-   ~wxResourceManager(void);
+// Operations
 
 
-   bool Initialize(void);
+   // Initializes the resource manager
+   bool Initialize();
 
 
-   bool LoadOptions(void);
-   bool SaveOptions(void);
+   // Load/save window size etc.
+   bool LoadOptions();
+   bool SaveOptions();
 
    // Show or hide the resource editor frame, which displays a list
    // of resources with ability to edit them.
    virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor");
 
 
    // Show or hide the resource editor frame, which displays a list
    // of resources with ability to edit them.
    virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor");
 
-   virtual bool Save(void);
-   virtual bool SaveAs(void);
+   virtual bool Save();
+   virtual bool SaveAs();
    virtual bool Save(const wxString& filename);
    virtual bool Load(const wxString& filename);
    virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE);
    virtual void SetFrameTitle(const wxString& filename);
    virtual bool Save(const wxString& filename);
    virtual bool Load(const wxString& filename);
    virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE);
    virtual void SetFrameTitle(const wxString& filename);
-   virtual bool DisassociateWindows(bool deleteWindows = TRUE);
+   virtual void ClearCurrentDialog();
    virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
    virtual bool New(bool loadFromFile = TRUE, const wxString& filename = "");
-   virtual bool SaveIfModified(void);
+   virtual bool SaveIfModified();
    virtual void AlignItems(int flag);
    virtual void AlignItems(int flag);
-   virtual void CopySize(void);
+   virtual void CopySize();
    virtual void ToBackOrFront(bool toBack);
    virtual void ToBackOrFront(bool toBack);
-   virtual wxWindow *FindParentOfSelection(void);
+   virtual wxWindow *FindParentOfSelection();
 
    virtual wxFrame *OnCreateEditorFrame(const char *title);
    virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
 
    virtual wxFrame *OnCreateEditorFrame(const char *title);
    virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
-   virtual wxPanel *OnCreateEditorPanel(wxFrame *parent);
+   virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
    virtual wxToolBarBase *OnCreateToolBar(wxFrame *parent);
    virtual EditorToolPalette *OnCreatePalette(wxFrame *parent);
    virtual wxToolBarBase *OnCreateToolBar(wxFrame *parent);
    virtual EditorToolPalette *OnCreatePalette(wxFrame *parent);
-//   virtual bool DeletePalette(void);
-   virtual bool InitializeTools(void);
 
 
-   virtual void UpdateResourceList(void);
-   virtual void AddItemsRecursively(int level, wxItemResource *resource);
-   virtual bool EditSelectedResource(void);
+   // Create a window information object for the give window
+   wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
+   // Edit the given window
+   void EditWindow(wxWindow *win);
+
+   virtual void UpdateResourceList();
+   virtual void AddItemsRecursively(long parent, wxItemResource *resource);
+   virtual bool EditSelectedResource();
    virtual bool Edit(wxItemResource *res);
    virtual bool Edit(wxItemResource *res);
-   virtual bool CreateNewDialog(void);
-   virtual bool CreateNewPanel(void);
+   virtual bool CreateNewPanel();
    virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE);
 
    virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE);
 
-   virtual bool DeleteSelection(bool deleteWindow = TRUE);
+   virtual bool DeleteSelection();
+
+   // Saves the window info into the resource, and deletes the
+   // handler. Doesn't actually disassociate the window from
+   // the resources. Replaces OnClose.
+   virtual bool SaveInfoAndDeleteHandler(wxWindow* win);
 
 
+   // Destroys the window. If this is the 'current' panel, NULLs the
+   // variable.
+   virtual bool DeleteWindow(wxWindow* win);
    virtual bool DeleteResource(wxItemResource *res);
    virtual bool DeleteResource(wxItemResource *res);
-   virtual bool DeleteResource(wxWindow *win, bool deleteWindow = TRUE);
+   virtual bool DeleteResource(wxWindow *win);
 
    // Add bitmap resource if there isn't already one with this filename.
    virtual char *AddBitmapResource(char *filename);
 
    // Add bitmap resource if there isn't already one with this filename.
    virtual char *AddBitmapResource(char *filename);
@@ -210,7 +225,7 @@ class wxResourceManager: public wxObject
    // fly, you'll need to delete the window and create it again.
    virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL);
 
    // fly, you'll need to delete the window and create it again.
    virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL);
 
-   virtual bool RecreateSelection(void);
+   virtual bool RecreateSelection();
 
    // Need to search through resource table removing this from
    // any resource which has this as a parent.
 
    // Need to search through resource table removing this from
    // any resource which has this as a parent.
@@ -218,115 +233,128 @@ class wxResourceManager: public wxObject
 
    virtual bool EditDialog(wxDialog *dialog, wxWindow *parent);
 
 
    virtual bool EditDialog(wxDialog *dialog, wxWindow *parent);
 
-   inline void SetEditorFrame(wxFrame *fr) { editorFrame = fr; }
-   inline void SetEditorToolBar(EditorToolBar *tb) { editorToolBar = tb; }
-   inline void SetEditorPalette(EditorToolPalette *pal) { editorPalette = pal; }
-   inline wxFrame *GetEditorFrame(void) { return editorFrame; }
-   inline wxListBox *GetEditorResourceList(void) { return editorResourceList; }
-   inline EditorToolPalette *GetEditorPalette(void) { return editorPalette; }
-   inline wxList& GetSelections(void) { return selections; }
-   
    void AddSelection(wxWindow *win);
    void RemoveSelection(wxWindow *win);
 
    void AddSelection(wxWindow *win);
    void RemoveSelection(wxWindow *win);
 
-//   inline void SetCurrentResource(wxItemResource *item) { currentResource = item; }
-//   inline void SetCurrentResourceWindow(wxWindow *win) { currentResourceWindow = win; }
-//   inline wxItemResource *GetCurrentResource(void) { return currentResource; }
-//   inline wxWindow *GetCurrentResourceWindow(void) { return currentResourceWindow; }
-   inline wxMenu *GetPopupMenu(void) { return popupMenu; }
-   
-   inline wxHelpController *GetHelpInstance(void) { return helpInstance; }
-
    virtual void MakeUniqueName(char *prefix, char *buf);
 
    // (Dis)associate resource<->physical window
    virtual void MakeUniqueName(char *prefix, char *buf);
 
    // (Dis)associate resource<->physical window
+   // Doesn't delete any windows.
    virtual void AssociateResource(wxItemResource *resource, wxWindow *win);
    virtual void AssociateResource(wxItemResource *resource, wxWindow *win);
-   virtual bool DisassociateResource(wxItemResource *resource, bool deleteWindow = TRUE);
-   virtual bool DisassociateResource(wxWindow *win, bool deleteWindow = TRUE);
+   virtual bool DisassociateResource(wxItemResource *resource);
+   virtual bool DisassociateResource(wxWindow *win);
+   virtual bool DisassociateWindows();
    virtual wxItemResource *FindResourceForWindow(wxWindow *win);
    virtual wxWindow *FindWindowForResource(wxItemResource *resource);
    
    virtual wxItemResource *FindResourceForWindow(wxWindow *win);
    virtual wxWindow *FindWindowForResource(wxItemResource *resource);
    
-   virtual bool InstantiateAllResourcesFromWindows(void);
+   virtual bool InstantiateAllResourcesFromWindows();
    virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE);
 
    virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE);
 
-   virtual void Modify(bool mod = TRUE) { modified = mod; }
-   virtual bool Modified(void) { return modified; }
+// Accessors
+   inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; }
+   inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; }
+   inline void SetEditorPalette(EditorToolPalette *pal) { m_editorPalette = pal; }
+   inline wxFrame *GetEditorFrame() const { return m_editorFrame; }
+   inline wxResourceEditorProjectTree *GetEditorResourceTree() const { return m_editorResourceTree; }
+   inline wxResourceEditorControlList *GetEditorControlList() const { return m_editorControlList; }
+   inline EditorToolPalette *GetEditorPalette() const { return m_editorPalette; }
+   inline wxList& GetSelections() { return m_selections; }
+   inline wxMenu *GetPopupMenu() const { return m_popupMenu; }
+   inline wxHelpController *GetHelpController() const { return m_helpController; }
 
 
-   inline bool GetEditMode(void) { return editMode; }
-   void SetEditMode(bool flag, bool changeCurrentResource = TRUE);
+   inline void Modify(bool mod = TRUE) { m_modified = mod; }
+   inline bool Modified() const { return m_modified; }
 
 
-   inline wxResourceTable& GetResourceTable(void) { return resourceTable; }
-   inline wxHashTable& GetResourceAssociations(void) { return resourceAssociations; }
-   
-   inline wxString& GetCurrentFilename(void) { return currentFilename; }
+   inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
+   inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
+
+   inline wxString& GetCurrentFilename() { return m_currentFilename; }
+   static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; }
+
+   inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; }
+   inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; }
 
 
-//   void UsePosition(bool usePos, wxItemResource *resource = NULL, int x = 0, int y = 0);
+// Member variables
+ protected:
+   wxHelpController*                m_helpController;
+   wxResourceTableWithSaving        m_resourceTable;
+   wxFrame*                         m_editorFrame;
+   wxResourceEditorScrolledWindow*  m_editorPanel;
+   wxMenu*                          m_popupMenu;
+   wxResourceEditorProjectTree*     m_editorResourceTree;
+   wxResourceEditorControlList*     m_editorControlList;
+   EditorToolPalette*               m_editorPalette;
+   EditorToolBar*                   m_editorToolBar;
+   int                              m_nameCounter;
+   bool                             m_modified;
+   wxHashTable                      m_resourceAssociations;
+   wxList                           m_selections;
+   wxString                         m_currentFilename;
+   wxBitmap*                        m_bitmapImage; // Default for static bitmaps/buttons
+
+   wxImageList                      m_imageList;
+   long                             m_rootDialogItem; // Root of dialog hierarchy in tree (unused)
+
+   // Options to be saved/restored
+   wxString                         m_optionsResourceFilename; // e.g. dialoged.ini, .dialogrc
+   wxRect                           m_propertyWindowSize;
+   wxRect                           m_resourceEditorWindowSize;
+   static wxResourceManager*        sm_currentResourceManager;
 };
 
 };
 
+
 class wxResourceEditorFrame: public wxFrame
 {
  public:
 class wxResourceEditorFrame: public wxFrame
 {
  public:
+  DECLARE_CLASS(wxResourceEditorFrame)
+
   wxResourceManager *manager;
   wxResourceManager *manager;
-  wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, char *title, int x = -1, int y = -1, int width = 600, int height = 400,
-    long style = 0, char *name = "frame");
-  ~wxResourceEditorFrame(void);
-  void OldOnMenuCommand(int cmd);
-  bool OnClose(void);
+  wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title,
+    const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600, 400),
+    long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
+  ~wxResourceEditorFrame();
+
+  bool OnClose();
+
+  void OnNew(wxCommandEvent& event);
+  void OnOpen(wxCommandEvent& event);
+  void OnNewDialog(wxCommandEvent& event);
+  void OnClear(wxCommandEvent& event);
+  void OnSave(wxCommandEvent& event);
+  void OnSaveAs(wxCommandEvent& event);
+  void OnExit(wxCommandEvent& event);
+  void OnAbout(wxCommandEvent& event);
+  void OnContents(wxCommandEvent& event);
+  void OnDeleteSelection(wxCommandEvent& event);
+  void OnRecreateSelection(wxCommandEvent& event);
+  void OnTest(wxCommandEvent& event);
+
+  DECLARE_EVENT_TABLE()
 };
 
 };
 
-class wxResourceEditorPanel: public wxPanel
+class wxResourceEditorScrolledWindow: public wxScrolledWindow
 {
  public:
 {
  public:
-  wxResourceEditorPanel(wxWindow *parent, int x = -1, int y = -1, int width = 600, int height = 400,
-    long style = 0, char *name = "panel");
-  ~wxResourceEditorPanel(void);
-  void OnDefaultAction(wxControl *item);
-};
+  wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+      long style = 0);
+  ~wxResourceEditorScrolledWindow();
+
+  void OnScroll(wxScrollEvent& event);
+  void OnPaint(wxPaintEvent& event);
+
+  void DrawTitle(wxDC& dc);
+
+// Accessors
+  inline int GetMarginX() { return m_marginX; }
+  inline int GetMarginY() { return m_marginY; }
 
 
-class DialogEditorPanelFrame: public wxFrame
-{
  public:
  public:
-  DialogEditorPanelFrame(wxFrame *parent, char *title, int x, int y, int w, int h, long style, char *name):
-    wxFrame(parent, -1, title, wxPoint(x, y), wxSize(w, h), style, name)
-  {
-  }
-  bool OnClose(void);
-};
+  wxWindow* m_childWindow;
+ private:
+  int m_marginX, m_marginY;
 
 
-// Edit menu
-#define OBJECT_EDITOR_NEW_FRAME       220
-#define OBJECT_EDITOR_NEW_DIALOG      221
-#define OBJECT_EDITOR_NEW_PANEL       222
-#define OBJECT_EDITOR_NEW_CANVAS      223
-#define OBJECT_EDITOR_NEW_TEXT_WINDOW 224
-#define OBJECT_EDITOR_NEW_BUTTON      225
-#define OBJECT_EDITOR_NEW_CHECKBOX    226
-#define OBJECT_EDITOR_NEW_MESSAGE     227
-#define OBJECT_EDITOR_NEW_CHOICE      228
-#define OBJECT_EDITOR_NEW_LISTBOX     229
-#define OBJECT_EDITOR_NEW_RADIOBOX    230
-#define OBJECT_EDITOR_NEW_SLIDER      231
-#define OBJECT_EDITOR_NEW_TEXT        232
-#define OBJECT_EDITOR_NEW_MULTITEXT   233
-#define OBJECT_EDITOR_NEW_GAUGE       234
-#define OBJECT_EDITOR_NEW_GROUPBOX    235
-
-#define OBJECT_EDITOR_NEW_ITEM        240
-#define OBJECT_EDITOR_NEW_SUBWINDOW   241
-
-#define OBJECT_EDITOR_EDIT_MENU       250
-#define OBJECT_EDITOR_EDIT_ATTRIBUTES 251
-#define OBJECT_EDITOR_CLOSE_OBJECT    252
-#define OBJECT_EDITOR_DELETE_OBJECT   253
-#define OBJECT_EDITOR_EDIT_TOOLBAR    254
-
-#define OBJECT_EDITOR_TOGGLE_TEST_MODE 255
-
-#define OBJECT_EDITOR_RC_CONVERT      260
-#define OBJECT_EDITOR_RC_CONVERT_MENU 261
-#define OBJECT_EDITOR_RC_CONVERT_DIALOG 262
-
-#define OBJECT_EDITOR_GRID            263
+ DECLARE_EVENT_TABLE()
+};
 
 #define OBJECT_MENU_EDIT      1
 #define OBJECT_MENU_DELETE    2
 
 #define OBJECT_MENU_EDIT      1
 #define OBJECT_MENU_DELETE    2
@@ -336,16 +364,10 @@ class DialogEditorPanelFrame: public wxFrame
  *
  */
  
  *
  */
  
-#if defined(__WINDOWS__) && defined(__WIN95__)
-class EditorToolBar: public wxToolBar95
-#elif defined(__WINDOWS__)
-class EditorToolBar: public wxToolBarMSW
-#else
-class EditorToolBar: public wxToolBarSimple
-#endif
+class EditorToolBar: public wxToolBar
 {
 {
-  public:
-  EditorToolBar(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1,
+public:
+  EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0),
             long style = 0, int direction = wxVERTICAL, int RowsOrColumns = 2);
   bool OnLeftClick(int toolIndex, bool toggled);
   void OnMouseEnter(int toolIndex);
             long style = 0, int direction = wxVERTICAL, int RowsOrColumns = 2);
   bool OnLeftClick(int toolIndex, bool toggled);
   void OnMouseEnter(int toolIndex);
@@ -355,24 +377,23 @@ DECLARE_EVENT_TABLE()
 };
 
 // Toolbar ids
 };
 
 // Toolbar ids
-#define TOOLBAR_LOAD_FILE       1
-#define TOOLBAR_SAVE_FILE       2
-#define TOOLBAR_NEW             3
-// #define TOOLBAR_GEN_CLIPS       4
-#define TOOLBAR_TREE            5
-#define TOOLBAR_HELP            6
+#define TOOLBAR_LOAD_FILE                   1
+#define TOOLBAR_SAVE_FILE                   2
+#define TOOLBAR_NEW                         3
+#define TOOLBAR_TREE                        5
+#define TOOLBAR_HELP                        6
 
 // Formatting tools
 
 // Formatting tools
-#define TOOLBAR_FORMAT_HORIZ    10
-#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN    11
+#define TOOLBAR_FORMAT_HORIZ                10
+#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN     11
 #define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN    12
 #define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN    12
-#define TOOLBAR_FORMAT_VERT     13
-#define TOOLBAR_FORMAT_VERT_TOP_ALIGN     14
-#define TOOLBAR_FORMAT_VERT_BOT_ALIGN     15
+#define TOOLBAR_FORMAT_VERT                 13
+#define TOOLBAR_FORMAT_VERT_TOP_ALIGN       14
+#define TOOLBAR_FORMAT_VERT_BOT_ALIGN       15
 
 
-#define TOOLBAR_TO_FRONT        16
-#define TOOLBAR_TO_BACK         17
-#define TOOLBAR_COPY_SIZE       18
+#define TOOLBAR_TO_FRONT                    16
+#define TOOLBAR_TO_BACK                     17
+#define TOOLBAR_COPY_SIZE                   18
 
 #endif
 
 
 #endif
 
index 9d408c50f828abd4e057510f2720b2af0504ef50..2b560e4a5dcbbfd3ed51f8081a6b1cf1fc355553 100644 (file)
@@ -51,7 +51,7 @@ wxControl *wxResourceTableWithSaving::CreateItem(wxPanel *panel, wxItemResource
 {
   wxControl *item = wxResourceTable::CreateItem(panel, childResource);
   if (item)
 {
   wxControl *item = wxResourceTable::CreateItem(panel, childResource);
   if (item)
-    wxResourceManager::currentResourceManager->GetResourceAssociations().Put((long)childResource, item);
+    wxResourceManager::GetCurrentResourceManager()->GetResourceAssociations().Put((long)childResource, item);
   return item;
 }
 
   return item;
 }
 
@@ -113,10 +113,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
       stream << "  style = '" << styleBuf << "',\\\n";
       stream << "  title = '" << item->GetTitle() << "',\\\n";
       stream << "  x = " << item->GetX() << ", y = " << item->GetY();
       stream << "  style = '" << styleBuf << "',\\\n";
       stream << "  title = '" << item->GetTitle() << "',\\\n";
       stream << "  x = " << item->GetX() << ", y = " << item->GetY();
-      stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight() << ",\\\n";
-      stream << "  modal = " << item->GetValue1();
+      stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight();
+//      stream << "  modal = " << item->GetValue1();
       
       
-      if (item->GetStyle() & wxUSER_COLOURS)
+      if (1) // item->GetStyle() & wxNO_3D)
       {
         if (item->GetBackgroundColour())
         {
       {
         if (item->GetBackgroundColour())
         {
@@ -128,6 +128,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
 
           stream << ",\\\n  " << "background_colour = '" << buf << "'";
         }
 
           stream << ",\\\n  " << "background_colour = '" << buf << "'";
         }
+#if 0
         if (item->GetLabelColour())
         {
           char buf[7];
         if (item->GetLabelColour())
         {
           char buf[7];
@@ -148,21 +149,16 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
 
           stream << ",\\\n  " << "button_colour = '" << buf << "'";
         }
 
           stream << ",\\\n  " << "button_colour = '" << buf << "'";
         }
+#endif
+
       }
       
       }
       
-      if (item->GetFont())
+      if (item->GetFont() && item->GetFont()->Ok())
       {
         stream << ",\\\n  font = ";
         OutputFont(stream, item->GetFont());
       }
       {
         stream << ",\\\n  font = ";
         OutputFont(stream, item->GetFont());
       }
-/*
-      if (item->GetButtonFont())
-      {
-        stream << ",\\\n  button_font = ";
-        OutputFont(stream, item->GetButtonFont());
-      }
-*/
-      
+
       if (item->GetChildren().Number() > 0)
         stream << ",\\\n";
       else
       if (item->GetChildren().Number() > 0)
         stream << ",\\\n";
       else
@@ -184,10 +180,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
       }
       stream << ").\";\n\n";
     }
       }
       stream << ").\";\n\n";
     }
-  else if (itemType == "wxButton")
+  else if (itemType == "wxButton" || itemType == "wxBitmapButton")
     {
       GenerateButtonStyleString(item->GetStyle(), styleBuf);
     {
       GenerateButtonStyleString(item->GetStyle(), styleBuf);
-      stream << "wxButton, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
+      stream << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
       stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
       stream << item->GetWidth() << ", " << item->GetHeight();
       if (item->GetValue4())
       stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
       stream << item->GetWidth() << ", " << item->GetHeight();
       if (item->GetValue4())
@@ -198,10 +194,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
         OutputFont(stream, item->GetFont());
       }
     }
         OutputFont(stream, item->GetFont());
       }
     }
-  else if (itemType == "wxMessage")
+  else if (itemType == "wxStaticText" || itemType == "wxStaticBitmap")
     {
       GenerateMessageStyleString(item->GetStyle(), styleBuf);
     {
       GenerateMessageStyleString(item->GetStyle(), styleBuf);
-      stream << "wxMessage, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
+      stream << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
       stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
       stream << item->GetWidth() << ", " << item->GetHeight();
       if (item->GetValue4())
       stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
       stream << item->GetWidth() << ", " << item->GetHeight();
       if (item->GetValue4())
@@ -225,7 +221,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
         OutputFont(stream, item->GetFont());
       }
     }
         OutputFont(stream, item->GetFont());
       }
     }
-  else if (itemType == "wxGroupBox")
+  else if (itemType == "wxStaticBox")
     {
       GenerateGroupBoxStyleString(item->GetStyle(), styleBuf);
       stream << "wxGroupBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
     {
       GenerateGroupBoxStyleString(item->GetStyle(), styleBuf);
       stream << "wxGroupBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
@@ -237,10 +233,10 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
         OutputFont(stream, item->GetFont());
       }
     }
         OutputFont(stream, item->GetFont());
       }
     }
-  else if (itemType == "wxText" || itemType == "wxMultiText")
+  else if (itemType == "wxText" || itemType == "wxMultiText" || itemType == "wxTextCtrl")
     {
       GenerateTextStyleString(item->GetStyle(), styleBuf);
     {
       GenerateTextStyleString(item->GetStyle(), styleBuf);
-      stream << ((itemType == "wxText") ? "wxText, " : "wxMultiText, ");
+      stream << "wxTextCtrl, ";
       stream << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
       stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
       stream << item->GetWidth() << ", " << item->GetHeight();
       stream << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
       stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
       stream << item->GetWidth() << ", " << item->GetHeight();
@@ -524,7 +520,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
 
 void wxResourceTableWithSaving::GenerateWindowStyleString(long windowStyle, char *buf)
 {
 
 void wxResourceTableWithSaving::GenerateWindowStyleString(long windowStyle, char *buf)
 {
-  GenerateStyle(buf, windowStyle, wxUSER_COLOURS, "wxUSER_COLOURS");
+  GenerateStyle(buf, windowStyle, wxNO_3D, "wxNO_3D");
   GenerateStyle(buf, windowStyle, wxVSCROLL, "wxVSCROLL");
   GenerateStyle(buf, windowStyle, wxHSCROLL, "wxHSCROLL");
   GenerateStyle(buf, windowStyle, wxBORDER, "wxBORDER");
   GenerateStyle(buf, windowStyle, wxVSCROLL, "wxVSCROLL");
   GenerateStyle(buf, windowStyle, wxHSCROLL, "wxHSCROLL");
   GenerateStyle(buf, windowStyle, wxBORDER, "wxBORDER");
@@ -598,6 +594,7 @@ void wxResourceTableWithSaving::GenerateTextStyleString(long windowStyle, char *
   GenerateStyle(buf, windowStyle, wxTE_PROCESS_ENTER, "wxTE_PROCESS_ENTER");
   GenerateStyle(buf, windowStyle, wxTE_READONLY, "wxTE_READONLY");
   GenerateStyle(buf, windowStyle, wxTE_PASSWORD, "wxTE_PASSWORD");
   GenerateStyle(buf, windowStyle, wxTE_PROCESS_ENTER, "wxTE_PROCESS_ENTER");
   GenerateStyle(buf, windowStyle, wxTE_READONLY, "wxTE_READONLY");
   GenerateStyle(buf, windowStyle, wxTE_PASSWORD, "wxTE_PASSWORD");
+  GenerateStyle(buf, windowStyle, wxTE_MULTILINE, "wxTE_MULTILINE");
 
   if (strlen(buf) == 0)
     strcat(buf, "0");
 
   if (strlen(buf) == 0)
     strcat(buf, "0");
index c1a1c63d548a7d43882601df48498f51aac5fa9c..f65018724b540ecd10645953863665b54a96f3d9 100644 (file)
@@ -61,29 +61,52 @@ bool wxResourcePropertyListView::OnClose(void)
   GetManagedWindow()->GetSize(& w, & h);
   GetManagedWindow()->GetPosition(& x, & y);
 
   GetManagedWindow()->GetSize(& w, & h);
   GetManagedWindow()->GetPosition(& x, & y);
 
-  wxResourceManager::currentResourceManager->propertyWindowSize.width = w;
-  wxResourceManager::currentResourceManager->propertyWindowSize.height = h;
-  wxResourceManager::currentResourceManager->propertyWindowSize.x = x;
-  wxResourceManager::currentResourceManager->propertyWindowSize.y = y;
+  wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width = w;
+  wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height = h;
+  wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x = x;
+  wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y = y;
 
   return wxPropertyListView::OnClose();
 }
 
 
   return wxPropertyListView::OnClose();
 }
 
+wxWindow *wxPropertyInfo::sm_propertyWindow;
+
 /*
 /*
- * wxPropertyInfo
+ * wxDialogEditorPropertyListDialog
  */
 
  */
 
-wxWindow *wxPropertyInfo::sm_propertyWindow;
+wxDialogEditorPropertyListDialog::wxDialogEditorPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
+        const wxPoint& pos, const wxSize& size,
+        long style, const wxString& name):
+            wxPropertyListDialog(v, parent, title, pos, size, style, name)
+{
+        m_propSheet = NULL;
+        m_propInfo = NULL;
+}
+
+wxDialogEditorPropertyListDialog::~wxDialogEditorPropertyListDialog()
+{
+    delete m_propSheet;
+    delete m_propInfo;
+    wxPropertyInfo::sm_propertyWindow = NULL;
+}
+
+/*
+ * wxPropertyInfo
+ */
 
 // Edit the information represented by this object, whatever that
 // might be.
 
 // Edit the information represented by this object, whatever that
 // might be.
-bool wxPropertyInfo::Edit(wxWindow *parent, char *title)
+bool wxPropertyInfo::Edit(wxWindow *parent, const wxString& title)
 {
 {
-  int width = wxResourceManager::currentResourceManager->propertyWindowSize.width;
-  int height = wxResourceManager::currentResourceManager->propertyWindowSize.height;
-  int x = wxResourceManager::currentResourceManager->propertyWindowSize.x;
-  int y = wxResourceManager::currentResourceManager->propertyWindowSize.y;
-  
+    if (sm_propertyWindow)
+        return FALSE;
+
+  int width = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width;
+  int height = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height;
+  int x = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x;
+  int y = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y;
+
   wxPropertySheet *propSheet = new wxPropertySheet;
 
   wxStringList propNames;
   wxPropertySheet *propSheet = new wxPropertySheet;
 
   wxStringList propNames;
@@ -104,37 +127,33 @@ bool wxPropertyInfo::Edit(wxWindow *parent, char *title)
   // Reset 'modified' flags for all property values
   propSheet->SetAllModified(FALSE);
 
   // Reset 'modified' flags for all property values
   propSheet->SetAllModified(FALSE);
 
-  if (!title)
-    title = "Properties";
   wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL,
 #ifdef __XVIEW__
      wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL |
 #endif
      wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES);
 
   wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL,
 #ifdef __XVIEW__
      wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL |
 #endif
      wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES);
 
-  wxPropertyListDialog *propDialog = new wxPropertyListDialog(view, NULL, title, wxPoint(x, y), wxSize(width, height), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE);
+  wxDialogEditorPropertyListDialog *propDialog = new wxDialogEditorPropertyListDialog(view,
+    wxResourceManager::GetCurrentResourceManager()->GetEditorFrame(), title, wxPoint(x, y),
+    wxSize(width, height), wxDEFAULT_DIALOG_STYLE);
   sm_propertyWindow = propDialog;
   sm_propertyWindow = propDialog;
-  
-  wxPropertyValidatorRegistry theValidatorRegistry;
-  theValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator);
-  theValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator);
-  theValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator);
-  theValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator);
-  theValidatorRegistry.RegisterValidator((wxString)"filename", new wxFilenameListValidator);
-  theValidatorRegistry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
+
+  propDialog->m_registry.RegisterValidator((wxString)"real", new wxRealListValidator);
+  propDialog->m_registry.RegisterValidator((wxString)"string", new wxStringListValidator);
+  propDialog->m_registry.RegisterValidator((wxString)"integer", new wxIntegerListValidator);
+  propDialog->m_registry.RegisterValidator((wxString)"bool", new wxBoolListValidator);
+  propDialog->m_registry.RegisterValidator((wxString)"filename", new wxFilenameListValidator);
+  propDialog->m_registry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
+
+  propDialog->m_propInfo = this;
+  propDialog->m_propSheet = propSheet;
 
 //  view->propertyWindow = propDialog;
 
 //  view->propertyWindow = propDialog;
-  view->AddRegistry(&theValidatorRegistry);
+  view->AddRegistry(&(propDialog->m_registry));
   view->ShowView(propSheet, propDialog);
 
   view->ShowView(propSheet, propDialog);
 
-  int ret = propDialog->ShowModal();
-  sm_propertyWindow = NULL;
-  delete propSheet;
-
-  if ( ret == wxID_CANCEL )
-    return FALSE;
-  else
-       return TRUE;
+  propDialog->Show(TRUE);
+  return TRUE;
 }
 
 /*
 }
 
 /*
@@ -288,13 +307,13 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
   else if (name == "name")
   {
     // Remove old name from resource table, if it's there.
   else if (name == "name")
   {
     // Remove old name from resource table, if it's there.
-    wxItemResource *oldResource = (wxItemResource *)wxResourceManager::currentResourceManager->GetResourceTable().Delete(propertyWindow->GetName());
+    wxItemResource *oldResource = (wxItemResource *)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(propertyWindow->GetName());
     if (oldResource)
     {
       // It's a top-level resource
       propertyWindow->SetName(property->GetValue().StringValue());
       oldResource->SetName(property->GetValue().StringValue());
     if (oldResource)
     {
       // It's a top-level resource
       propertyWindow->SetName(property->GetValue().StringValue());
       oldResource->SetName(property->GetValue().StringValue());
-      wxResourceManager::currentResourceManager->GetResourceTable().Put(propertyWindow->GetName(), oldResource);
+      wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(propertyWindow->GetName(), oldResource);
     }
     else
     {
     }
     else
     {
@@ -303,7 +322,7 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
       propertyResource->SetName(property->GetValue().StringValue());
     }
     // Refresh the resource manager list, because the name changed.
       propertyResource->SetName(property->GetValue().StringValue());
     }
     // Refresh the resource manager list, because the name changed.
-    wxResourceManager::currentResourceManager->UpdateResourceList();
+    wxResourceManager::GetCurrentResourceManager()->UpdateResourceList();
     return TRUE;
   }
   else if (name == "title")
     return TRUE;
   }
   else if (name == "title")
@@ -337,10 +356,12 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     if (width != newWidth)
     {
       propertyWindow->SetSize(newWidth, height);
     if (width != newWidth)
     {
       propertyWindow->SetSize(newWidth, height);
+/*
       if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
       {
         propertyWindow->GetParent()->SetClientSize(newWidth, height);
       }
       if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
       {
         propertyWindow->GetParent()->SetClientSize(newWidth, height);
       }
+*/
     }
     return TRUE;
   }
     }
     return TRUE;
   }
@@ -352,10 +373,12 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     if (height != newHeight)
     {
       propertyWindow->SetSize(width, newHeight);
     if (height != newHeight)
     {
       propertyWindow->SetSize(width, newHeight);
+/*
       if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
       {
         propertyWindow->GetParent()->SetClientSize(width, newHeight);
       }
       if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog)))
       {
         propertyWindow->GetParent()->SetClientSize(width, newHeight);
       }
+*/
     }
     return TRUE;
   }
     }
     return TRUE;
   }
@@ -398,7 +421,7 @@ bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource)
 
 
 /*
 
 
 /*
- * Panel items
+ * Controls
  */
 
 wxProperty *wxItemPropertyInfo::GetProperty(wxString& name)
  */
 
 wxProperty *wxItemPropertyInfo::GetProperty(wxString& name)
@@ -454,7 +477,7 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
   wxControl *item = (wxControl *)propertyWindow;
   wxString str(item->GetLabel());
   resource->SetTitle(WXSTRINGCAST str);
   wxControl *item = (wxControl *)propertyWindow;
   wxString str(item->GetLabel());
   resource->SetTitle(WXSTRINGCAST str);
-  if (item->GetFont())
+  if (item->GetFont() && item->GetFont()->Ok())
     resource->SetFont(wxTheFontList->FindOrCreateFont(item->GetFont()->GetPointSize(),
                item->GetFont()->GetFamily(), item->GetFont()->GetStyle(), item->GetFont()->GetWeight(),
                item->GetFont()->GetUnderlined(), item->GetFont()->GetFaceName()));
     resource->SetFont(wxTheFontList->FindOrCreateFont(item->GetFont()->GetPointSize(),
                item->GetFont()->GetFamily(), item->GetFont()->GetStyle(), item->GetFont()->GetWeight(),
                item->GetFont()->GetUnderlined(), item->GetFont()->GetFaceName()));
@@ -468,30 +491,54 @@ bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource)
 wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name)
 {
   wxButton *button = (wxButton *)propertyWindow;
 wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name)
 {
   wxButton *button = (wxButton *)propertyWindow;
+  return wxItemPropertyInfo::GetProperty(name);
+}
+
+bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
+{
+  wxButton *button = (wxButton *)propertyWindow;
+  return wxItemPropertyInfo::SetProperty(name, property);
+}
+
+void wxButtonPropertyInfo::GetPropertyNames(wxStringList& names)
+{
+  names.Add("label");
+  wxItemPropertyInfo::GetPropertyNames(names);
+}
+
+bool wxButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
+{
+  return wxItemPropertyInfo::InstantiateResource(resource);
+}
+
 /*
 /*
-  if (name == "label" && isBitmapButton)
+ * wxBitmapButton
+ */
+
+wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
+{
+  wxBitmapButton *button = (wxBitmapButton *)propertyWindow;
+  if (name == "label")
   {
   {
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(button);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button);
     wxString str("none.bmp");
    
     if (resource)
     {
     wxString str("none.bmp");
    
     if (resource)
     {
-      char *filename = wxResourceManager::currentResourceManager->FindBitmapFilenameForResource(resource);
+      char *filename = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
       if (filename)
         str = filename;
     }
     return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
   }
   else
       if (filename)
         str = filename;
     }
     return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
   }
   else
-*/
-    return wxItemPropertyInfo::GetProperty(name);
+    return wxButtonPropertyInfo::GetProperty(name);
 }
 
 }
 
-bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
+bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
 {
-  wxButton *button = (wxButton *)propertyWindow;
-/*
-  if (name == "label" && isBitmapButton)
+  wxBitmapButton *button = (wxBitmapButton *)propertyWindow;
+  if (name == "label")
   {
     char *s = property->GetValue().StringValue();
     if (s && wxFileExists(s))
   {
     char *s = property->GetValue().StringValue();
     if (s && wxFileExists(s))
@@ -506,15 +553,15 @@ bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
       }
       else
       {
       }
       else
       {
-        wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(button);
+        wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button);
         if (resource)
         {
           wxString oldResource(resource->GetValue4());
         if (resource)
         {
           wxString oldResource(resource->GetValue4());
-          char *resName = wxResourceManager::currentResourceManager->AddBitmapResource(s);
+          char *resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
           resource->SetValue4(resName);
           
           if (!oldResource.IsNull())
           resource->SetValue4(resName);
           
           if (!oldResource.IsNull())
-            wxResourceManager::currentResourceManager->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
+            wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
         }
 
         button->SetLabel(bitmap);
         }
 
         button->SetLabel(bitmap);
@@ -525,52 +572,75 @@ bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     return FALSE;
   }
   else
     return FALSE;
   }
   else
-*/
-    return wxItemPropertyInfo::SetProperty(name, property);
+    return wxButtonPropertyInfo::SetProperty(name, property);
 }
 
 }
 
-void wxButtonPropertyInfo::GetPropertyNames(wxStringList& names)
+void wxBitmapButtonPropertyInfo::GetPropertyNames(wxStringList& names)
 {
 {
-  names.Add("label");
-  wxItemPropertyInfo::GetPropertyNames(names);
+//  names.Add("label");
+  wxButtonPropertyInfo::GetPropertyNames(names);
 }
 
 }
 
-bool wxButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
+bool wxBitmapButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
 
 /*
 {
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
 
 /*
- * Message
+ * wxStaticText
  */
 
 wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name)
 {
   wxStaticText *message = (wxStaticText *)propertyWindow;
  */
 
 wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name)
 {
   wxStaticText *message = (wxStaticText *)propertyWindow;
+  return wxItemPropertyInfo::GetProperty(name);
+}
+
+bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
+{
+  wxStaticText *message = (wxStaticText *)propertyWindow;
+  return wxItemPropertyInfo::SetProperty(name, property);
+}
+
+void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList& names)
+{
+  names.Add("label");
+  wxItemPropertyInfo::GetPropertyNames(names);
+}
+
+bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource)
+{
+  return wxItemPropertyInfo::InstantiateResource(resource);
+}
+
 /*
 /*
-  if (name == "label" && isBitmapMessage)
+ * wxStaticBitmap
+ */
+
+wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
+{
+  wxStaticBitmap *message = (wxStaticBitmap *)propertyWindow;
+  if (name == "label")
   {
   {
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(message);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message);
     wxString str("none.bmp");
    
     if (resource)
     {
     wxString str("none.bmp");
    
     if (resource)
     {
-      char *filename = wxResourceManager::currentResourceManager->FindBitmapFilenameForResource(resource);
+      char *filename = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
       if (filename)
         str = filename;
     }
     return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
   }
   else
       if (filename)
         str = filename;
     }
     return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
   }
   else
-*/
     return wxItemPropertyInfo::GetProperty(name);
 }
 
     return wxItemPropertyInfo::GetProperty(name);
 }
 
-bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
+bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 {
 {
-  wxStaticText *message = (wxStaticText *)propertyWindow;
-/*
-  if (name == "label" && isBitmapMessage)
+  wxStaticBitmap *message = (wxStaticBitmap *)propertyWindow;
+  if (name == "label")
   {
     char *s = property->GetValue().StringValue();
     if (s && wxFileExists(s))
   {
     char *s = property->GetValue().StringValue();
     if (s && wxFileExists(s))
@@ -586,18 +656,18 @@ bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
       }
       else
       {
       }
       else
       {
-        wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(message);
+        wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message);
         if (resource)
         {
           wxString oldResource(resource->GetValue4());
         if (resource)
         {
           wxString oldResource(resource->GetValue4());
-          char *resName = wxResourceManager::currentResourceManager->AddBitmapResource(s);
+          char *resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(s);
           resource->SetValue4(resName);
           
           if (!oldResource.IsNull())
           resource->SetValue4(resName);
           
           if (!oldResource.IsNull())
-            wxResourceManager::currentResourceManager->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
+            wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource);
         }
 
         }
 
-        message->SetLabel(bitmap);
+        message->SetBitmap(bitmap);
         delete[] s;
         return TRUE;
       }
         delete[] s;
         return TRUE;
       }
@@ -605,17 +675,16 @@ bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     return FALSE;
   }
   else
     return FALSE;
   }
   else
-*/
     return wxItemPropertyInfo::SetProperty(name, property);
 }
 
     return wxItemPropertyInfo::SetProperty(name, property);
 }
 
-void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList& names)
+void wxStaticBitmapPropertyInfo::GetPropertyNames(wxStringList& names)
 {
   names.Add("label");
   wxItemPropertyInfo::GetPropertyNames(names);
 }
 
 {
   names.Add("label");
   wxItemPropertyInfo::GetPropertyNames(names);
 }
 
-bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource)
+bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
 {
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
@@ -664,10 +733,10 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
       if ((flag & wxTE_PASSWORD) == wxTE_PASSWORD)
         flag -= wxTE_PASSWORD;
     }
       if ((flag & wxTE_PASSWORD) == wxTE_PASSWORD)
         flag -= wxTE_PASSWORD;
     }
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(text);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
     resource->SetStyle(flag);
 
     resource->SetStyle(flag);
 
-    wxResourceManager::currentResourceManager->RecreateWindowFromResource(text, this);
+    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
     return TRUE;
   }
   else if (name == "readonly")
     return TRUE;
   }
   else if (name == "readonly")
@@ -683,10 +752,10 @@ bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property)
       if ((flag & wxTE_READONLY) == wxTE_READONLY)
         flag -= wxTE_READONLY;
     }
       if ((flag & wxTE_READONLY) == wxTE_READONLY)
         flag -= wxTE_READONLY;
     }
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(text);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text);
     resource->SetStyle(flag);
 
     resource->SetStyle(flag);
 
-    wxResourceManager::currentResourceManager->RecreateWindowFromResource(text, this);
+    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this);
     return TRUE;
   }
   else
     return TRUE;
   }
   else
@@ -729,7 +798,7 @@ wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name)
   else if (name == "multiple")
   {
     char *pos = NULL;
   else if (name == "multiple")
   {
     char *pos = NULL;
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(listBox);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
     if (!resource)
       return NULL;
       
     if (!resource)
       return NULL;
       
@@ -782,10 +851,10 @@ bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
       mult = wxLB_EXTENDED;
     else
       mult = wxLB_SINGLE;
       mult = wxLB_EXTENDED;
     else
       mult = wxLB_SINGLE;
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(listBox);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox);
     if (resource)
       resource->SetValue1(mult);
     if (resource)
       resource->SetValue1(mult);
-    wxResourceManager::currentResourceManager->RecreateWindowFromResource(listBox, this);
+    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this);
     return TRUE;
   }
   else
     return TRUE;
   }
   else
@@ -926,7 +995,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
   if (name == "numberRowsOrCols")
   {
     radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue());
   if (name == "numberRowsOrCols")
   {
     radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue());
-    wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this);
+    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
     return TRUE;
   }
   else if (name == "orientation")
     return TRUE;
   }
   else if (name == "orientation")
@@ -947,7 +1016,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     }
     radioBox->SetWindowStyleFlag(windowStyle);
     
     }
     radioBox->SetWindowStyleFlag(windowStyle);
     
-    wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this);
+    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
     return TRUE;
   }
   else if (name == "values")
     return TRUE;
   }
   else if (name == "values")
@@ -955,7 +1024,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     // Set property into *resource*, not wxRadioBox, and then recreate
     // the wxRadioBox. This is because we can't dynamically set the strings
     // of a wxRadioBox.
     // Set property into *resource*, not wxRadioBox, and then recreate
     // the wxRadioBox. This is because we can't dynamically set the strings
     // of a wxRadioBox.
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(propertyWindow);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
     if (!resource)
       return FALSE;
       
     if (!resource)
       return FALSE;
       
@@ -975,7 +1044,7 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
         stringList->Add(s);
       expr = expr->GetNext();
     }
         stringList->Add(s);
       expr = expr->GetNext();
     }
-    wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this);
+    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this);
     return TRUE;
   }
   return wxItemPropertyInfo::SetProperty(name, property);
     return TRUE;
   }
   return wxItemPropertyInfo::SetProperty(name, property);
@@ -1142,7 +1211,7 @@ bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     int w, h;
     slider->GetSize(&w, &h);
     
     int w, h;
     slider->GetSize(&w, &h);
     
-    slider = (wxSlider *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(slider, this);
+    slider = (wxSlider *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(slider, this);
     slider->SetSize(-1, -1, h, w);
     
     return TRUE;
     slider->SetSize(-1, -1, h, w);
     
     return TRUE;
@@ -1307,7 +1376,7 @@ bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     int w, h;
     scrollBar->GetSize(&w, &h);
     
     int w, h;
     scrollBar->GetSize(&w, &h);
     
-    scrollBar = (wxScrollBar *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(scrollBar, this);
+    scrollBar = (wxScrollBar *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(scrollBar, this);
     scrollBar->SetSize(-1, -1, h, w);
     
     return TRUE;
     scrollBar->SetSize(-1, -1, h, w);
     
     return TRUE;
@@ -1380,10 +1449,10 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
   else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" ||
       name == "buttonFontUnderlined")
     return GetFontProperty(name, buttonFont);
   else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" ||
       name == "buttonFontUnderlined")
     return GetFontProperty(name, buttonFont);
-  else if (name == "userColours")
+  else if (name == "no3D")
   {
     bool userColours;
   {
     bool userColours;
-    if (panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS)
+    if (panelWindow->GetWindowStyleFlag() & wxNO_3D)
       userColours = TRUE;
     else
       userColours = FALSE;
       userColours = TRUE;
     else
       userColours = FALSE;
@@ -1400,6 +1469,14 @@ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name)
 
     return new wxProperty(name, buf, "string", new wxColourListValidator);
   }
 
     return new wxProperty(name, buf, "string", new wxColourListValidator);
   }
+  else if (name == "title")
+  {
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+    if (resource)
+        return new wxProperty(name, resource->GetTitle(), "string");
+    else
+        return new wxProperty(name, "Could not get title", "string");
+  }
   else
     return wxWindowPropertyInfo::GetProperty(name);
 }
   else
     return wxWindowPropertyInfo::GetProperty(name);
 }
@@ -1424,31 +1501,25 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
       panelWindow->SetButtonFont(newFont);
     return TRUE;
   }
       panelWindow->SetButtonFont(newFont);
     return TRUE;
   }
-  else if (name == "userColours")
+  else if (name == "no3D")
   {
     bool userColours = property->GetValue().BoolValue();
     long flag = panelWindow->GetWindowStyleFlag();
     
     if (userColours)
     {
   {
     bool userColours = property->GetValue().BoolValue();
     long flag = panelWindow->GetWindowStyleFlag();
     
     if (userColours)
     {
-      if ((panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) != wxUSER_COLOURS)
-        panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() | wxUSER_COLOURS);
+      if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) != wxNO_3D)
+        panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() | wxNO_3D);
     }
     else
     {
     }
     else
     {
-      if ((panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) == wxUSER_COLOURS)
-        panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() - wxUSER_COLOURS);
+      if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) == wxNO_3D)
+        panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() - wxNO_3D);
     }
     }
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(panelWindow);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
     resource->SetStyle(panelWindow->GetWindowStyleFlag());
 
     resource->SetStyle(panelWindow->GetWindowStyleFlag());
 
-    panelWindow = (wxPanel *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(panelWindow, this);
-//    panelWindow->SetUserEditMode(wxResourceManager::currentResourceManager->GetEditMode());
-#ifdef __WINDOWS__
-    // This window should not be enabled by being recreated: we're in a modal dialog (property editor)
-    ::EnableWindow((HWND) panelWindow->GetHWND(), FALSE);
-    ::BringWindowToTop((HWND) sm_propertyWindow->GetHWND());
-#endif
+    panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
     return TRUE;
   }
   else if (name == "backgroundColour")
     return TRUE;
   }
   else if (name == "backgroundColour")
@@ -1460,15 +1531,20 @@ bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     
     wxColour col(r,g,b);
     panelWindow->SetBackgroundColour(col);
     
     wxColour col(r,g,b);
     panelWindow->SetBackgroundColour(col);
-    panelWindow = (wxPanel *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(panelWindow, this);
-//    panelWindow->SetUserEditMode(wxResourceManager::currentResourceManager->GetEditMode());
-#ifdef __WINDOWS__
-    // This window should not be enabled by being recreated: we're in a modal dialog (property editor)
-    ::EnableWindow((HWND) panelWindow->GetHWND(), FALSE);
-    ::BringWindowToTop((HWND) sm_propertyWindow->GetHWND());
-#endif
+    panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this);
    return TRUE;
   }
    return TRUE;
   }
+  else if (name == "title")
+  {
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow);
+    if (resource)
+    {
+        resource->SetTitle(property->GetValue().StringValue());
+        return TRUE;
+    }
+    else
+        return FALSE;
+  }
   else
     return wxWindowPropertyInfo::SetProperty(name, property);
 }
   else
     return wxWindowPropertyInfo::SetProperty(name, property);
 }
@@ -1477,8 +1553,8 @@ void wxPanelPropertyInfo::GetPropertyNames(wxStringList& names)
 {
   wxWindowPropertyInfo::GetPropertyNames(names);
   
 {
   wxWindowPropertyInfo::GetPropertyNames(names);
   
-//  names.Add("orientation");
-  names.Add("userColours");
+  names.Add("title");
+  names.Add("no3D");
   names.Add("backgroundColour");
 }
 
   names.Add("backgroundColour");
 }
 
@@ -1495,6 +1571,7 @@ bool wxPanelPropertyInfo::InstantiateResource(wxItemResource *resource)
   return wxWindowPropertyInfo::InstantiateResource(resource);
 }
 
   return wxWindowPropertyInfo::InstantiateResource(resource);
 }
 
+#if 0
 /*
  * Dialog boxes
  */
 /*
  * Dialog boxes
  */
@@ -1504,7 +1581,7 @@ wxProperty *wxDialogPropertyInfo::GetProperty(wxString& name)
   wxDialog *dialogWindow = (wxDialog *)propertyWindow; 
   if (name == "modal")
   {
   wxDialog *dialogWindow = (wxDialog *)propertyWindow; 
   if (name == "modal")
   {
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(dialogWindow);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow);
     if (!resource)
       return NULL;
 
     if (!resource)
       return NULL;
 
@@ -1521,7 +1598,7 @@ bool wxDialogPropertyInfo::SetProperty(wxString& name, wxProperty *property)
 
   if (name == "modal")
   {
 
   if (name == "modal")
   {
-    wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(dialogWindow);
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow);
     if (!resource)
       return FALSE;
 
     if (!resource)
       return FALSE;
 
@@ -1548,6 +1625,7 @@ bool wxDialogPropertyInfo::InstantiateResource(wxItemResource *resource)
     
   return wxPanelPropertyInfo::InstantiateResource(resource);
 }
     
   return wxPanelPropertyInfo::InstantiateResource(resource);
 }
+#endif
 
 /*
  * Utilities
 
 /*
  * Utilities
index a1420e63b5fd07c95ba12f38a711933aee922e02..c8f3aff34fd8ed8b82fd84b76d258caa30ab1d04 100644 (file)
 
 class wxPropertyInfo;
 
 
 class wxPropertyInfo;
 
+class wxDialogEditorPropertyListDialog: public wxPropertyListDialog
+{
+    friend class wxPropertyInfo;
+public:
+    wxDialogEditorPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
+        const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+        long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox");
+    ~wxDialogEditorPropertyListDialog();
+
+private:
+    wxPropertySheet*            m_propSheet;
+    wxPropertyValidatorRegistry m_registry;
+    wxPropertyInfo*             m_propInfo;
+};
+
 // A kind of property list view that intercepts OnPropertyChanged
 // feedback.
 class wxResourcePropertyListView: public wxPropertyListView
 // A kind of property list view that intercepts OnPropertyChanged
 // feedback.
 class wxResourcePropertyListView: public wxPropertyListView
@@ -42,6 +57,7 @@ class wxResourcePropertyListView: public wxPropertyListView
 // them with separate classes.
 class wxPropertyInfo: public wxObject
 {
 // them with separate classes.
 class wxPropertyInfo: public wxObject
 {
+    friend class wxDialogEditorPropertyListDialog;
  protected:
   static wxWindow *sm_propertyWindow;
   wxPropertyInfo(void)
  protected:
   static wxWindow *sm_propertyWindow;
   wxPropertyInfo(void)
@@ -54,7 +70,7 @@ class wxPropertyInfo: public wxObject
   virtual wxProperty *GetProperty(wxString& propName) = 0;
   virtual bool SetProperty(wxString& propName, wxProperty *property) = 0;
   virtual void GetPropertyNames(wxStringList& names) = 0;
   virtual wxProperty *GetProperty(wxString& propName) = 0;
   virtual bool SetProperty(wxString& propName, wxProperty *property) = 0;
   virtual void GetPropertyNames(wxStringList& names) = 0;
-  virtual bool Edit(wxWindow *parent, char *title);
+  virtual bool Edit(wxWindow *parent, const wxString& title);
 };
 
 // For all windows
 };
 
 // For all windows
@@ -102,33 +118,55 @@ class wxButtonPropertyInfo: public wxItemPropertyInfo
 {
  protected:
  public:
 {
  protected:
  public:
-  bool isBitmapButton;
-  wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmButton = FALSE):
-    wxItemPropertyInfo(win, res) { isBitmapButton = bmButton; }
+  wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
+    wxItemPropertyInfo(win, res) { }
   ~wxButtonPropertyInfo(void) {}
   wxProperty *GetProperty(wxString& name);
   bool SetProperty(wxString& name, wxProperty *property);
   void GetPropertyNames(wxStringList& names);
   bool InstantiateResource(wxItemResource *resource);
   ~wxButtonPropertyInfo(void) {}
   wxProperty *GetProperty(wxString& name);
   bool SetProperty(wxString& name, wxProperty *property);
   void GetPropertyNames(wxStringList& names);
   bool InstantiateResource(wxItemResource *resource);
+};
 
 
-  inline bool IsBitmapButton(void) { return isBitmapButton; }
+// For bitmap buttons
+class wxBitmapButtonPropertyInfo: public wxButtonPropertyInfo
+{
+ protected:
+ public:
+  wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
+    wxButtonPropertyInfo(win, res) { }
+  ~wxBitmapButtonPropertyInfo(void) {}
+  wxProperty *GetProperty(wxString& name);
+  bool SetProperty(wxString& name, wxProperty *property);
+  void GetPropertyNames(wxStringList& names);
+  bool InstantiateResource(wxItemResource *resource);
 };
 
 };
 
-// For messages
+// For static text controls
 class wxStaticTextPropertyInfo: public wxItemPropertyInfo
 {
  protected:
  public:
 class wxStaticTextPropertyInfo: public wxItemPropertyInfo
 {
  protected:
  public:
-  bool isBitmapMessage;
-  wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmMessage = FALSE):
-    wxItemPropertyInfo(win, res) { isBitmapMessage = bmMessage; }
+  wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
+    wxItemPropertyInfo(win, res) { }
   ~wxStaticTextPropertyInfo(void) {}
   wxProperty *GetProperty(wxString& name);
   bool SetProperty(wxString& name, wxProperty *property);
   void GetPropertyNames(wxStringList& names);
   bool InstantiateResource(wxItemResource *resource);
   ~wxStaticTextPropertyInfo(void) {}
   wxProperty *GetProperty(wxString& name);
   bool SetProperty(wxString& name, wxProperty *property);
   void GetPropertyNames(wxStringList& names);
   bool InstantiateResource(wxItemResource *resource);
+};
 
 
-  inline bool IsBitmapMessage(void) { return isBitmapMessage; }
+// For static bitmap controls
+class wxStaticBitmapPropertyInfo: public wxItemPropertyInfo
+{
+ protected:
+ public:
+  wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
+    wxItemPropertyInfo(win, res) { }
+  ~wxStaticBitmapPropertyInfo(void) {}
+  wxProperty *GetProperty(wxString& name);
+  bool SetProperty(wxString& name, wxProperty *property);
+  void GetPropertyNames(wxStringList& names);
+  bool InstantiateResource(wxItemResource *resource);
 };
 
 // For text/multitext items
 };
 
 // For text/multitext items
@@ -271,20 +309,6 @@ class wxPanelPropertyInfo: public wxWindowPropertyInfo
   bool InstantiateResource(wxItemResource *resource);
 };
 
   bool InstantiateResource(wxItemResource *resource);
 };
 
-// For dialogs
-class wxDialogPropertyInfo: public wxPanelPropertyInfo
-{
- protected:
- public:
-  wxDialogPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
-    wxPanelPropertyInfo(win, res) {}
-  ~wxDialogPropertyInfo(void) {}
-  wxProperty *GetProperty(wxString& name);
-  bool SetProperty(wxString& name, wxProperty *property);
-  void GetPropertyNames(wxStringList& names);
-  bool InstantiateResource(wxItemResource *resource);
-};
-
 int wxStringToFontWeight(wxString& val);
 int wxStringToFontStyle(wxString& val);
 int wxStringToFontFamily(wxString& val);
 int wxStringToFontWeight(wxString& val);
 int wxStringToFontStyle(wxString& val);
 int wxStringToFontFamily(wxString& val);