]> git.saurik.com Git - wxWidgets.git/commitdiff
Dialog Editor edits
authorJulian Smart <julian@anthemion.co.uk>
Fri, 24 Jul 1998 20:44:36 +0000 (20:44 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 24 Jul 1998 20:44:36 +0000 (20:44 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
utils/dialoged/src/dialoged.cpp
utils/dialoged/src/dlghndlr.cpp
utils/dialoged/src/editrpal.cpp [deleted file]
utils/dialoged/src/editrpal.h [deleted file]
utils/dialoged/src/makefile.b32
utils/dialoged/src/makefile.g95
utils/dialoged/src/makefile.nt
utils/dialoged/src/reseditr.cpp
utils/dialoged/src/reseditr.h
utils/dialoged/src/reswrite.cpp
utils/dialoged/src/symbtabl.cpp [new file with mode: 0644]
utils/dialoged/src/symbtabl.h [new file with mode: 0644]
utils/dialoged/src/winprop.cpp
utils/dialoged/src/winprop.h

index 7c1145286f16c0599b911d7b7b7c3def6a279011..1a1b6b4b91a91f3b6b9bfd55d4cc285301fee7a7 100644 (file)
@@ -34,6 +34,8 @@ MyApp::MyApp(void)
 
 wxResourceManager *theResourceManager = NULL;
 
+#include "symbtabl.h"
+
 bool MyApp::OnInit(void)
 {
     theResourceManager = new wxResourceManager;
index 7eb928ae6a6d83b2a333ab46ea91459ef53fbfa4..da08a1f589d63ba49fbea90f7641f6b0ea21a3f8 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "reseditr.h"
 #include "winprop.h"
-#include "editrpal.h"
 #include "dlghndlr.h"
 #include "edlist.h"
 
@@ -176,6 +175,9 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
         case RESED_RADIOBOX:
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioBox", x, y);
           break;
+        case RESED_RADIOBUTTON:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioButton", x, y);
+          break;
         case RESED_LISTBOX:
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxListBox", x, y);
           break;
@@ -321,7 +323,8 @@ void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int x, int
     wxResourceManager::GetCurrentResourceManager()->EditWindow(item);
     return;
   }
-  
+
+/*
   // If this is a wxStaticBox and the pointer isn't an arrow, chances
   // are that we really meant to place an item on the panel.
   // Fake this event.
@@ -330,6 +333,7 @@ void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int x, int
     OnLeftClick(x,  y, keys);
     return;
   }
+*/
   
   wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
 
diff --git a/utils/dialoged/src/editrpal.cpp b/utils/dialoged/src/editrpal.cpp
deleted file mode 100644 (file)
index 570bf6a..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        editrpal.cpp
-// Purpose:     Editor tool palette
-// Author:      Julian Smart
-// Modified by:
-// Created:     04/01/98
-// RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart
-// Licence:    wxWindows license
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#pragma implementation "editrpal.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"
-#endif
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#if defined(__WXMSW__) && !defined(__GNUWIN32__)
-#include <strstrea.h>
-#else
-#include <strstream.h>
-#endif
-
-#include "reseditr.h"
-#include "editrpal.h"
-
-#ifdef __X__
-#include "bitmaps/frame.xbm"
-#include "bitmaps/dialog.xbm"
-#include "bitmaps/panel.xbm"
-#include "bitmaps/canvas.xbm"
-#include "bitmaps/textsw.xbm"
-#include "bitmaps/message.xbm"
-#include "bitmaps/button.xbm"
-#include "bitmaps/check.xbm"
-#include "bitmaps/listbox.xbm"
-#include "bitmaps/radio.xbm"
-#include "bitmaps/choice.xbm"
-#include "bitmaps/text.xbm"
-#include "bitmaps/mtext.xbm"
-#include "bitmaps/slider.xbm"
-#include "bitmaps/arrow.xbm"
-#include "bitmaps/group.xbm"
-#include "bitmaps/gauge.xbm"
-#include "bitmaps/scroll.xbm"
-#include "bitmaps/picture.xbm"
-#include "bitmaps/bmpbuttn.xbm"
-#endif
-
-/*
- * Object editor tool palette
- *
- */
-
-BEGIN_EVENT_TABLE(EditorToolPalette, wxToolBarSimple)
-       EVT_PAINT(EditorToolPalette::OnPaint)
-END_EVENT_TABLE()
-
-EditorToolPalette::EditorToolPalette(wxResourceManager *manager, wxFrame *frame, int x, int y, int w, int h,
-            long style, int direction, int RowsOrColumns):
-  TOOLPALETTECLASS(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns)
-{
-  currentlySelected = -1;
-  resourceManager = manager;
-}
-
-bool EditorToolPalette::OnLeftClick(int toolIndex, bool toggled)
-{
-  // BEGIN mutual exclusivity code
-  if (toggled && (currentlySelected != -1) && (toolIndex != currentlySelected))
-    ToggleTool(currentlySelected, FALSE);
-
-  if (toggled)
-    currentlySelected = toolIndex;
-  else if (currentlySelected == toolIndex)
-    currentlySelected = -1;
-  //  END mutual exclusivity code
-/*
-  if (MainFrame)
-  {
-    if (toggled && (toolIndex != PALETTE_ARROW))
-      MainFrame->canvas->SetCursor(crossCursor);
-    else
-      MainFrame->canvas->SetCursor(handCursor);
-  }
-*/
-
-  return TRUE;
-}
-
-void EditorToolPalette::OnMouseEnter(int toolIndex)
-{
-  if (!resourceManager) return;
-  wxFrame *managerFrame = resourceManager->GetEditorFrame();
-  
-  if (toolIndex > -1)
-  {
-      switch (toolIndex)
-      {
-        case PALETTE_FRAME:
-          managerFrame->SetStatusText("wxFrame");
-          break;
-        case PALETTE_DIALOG_BOX:
-          managerFrame->SetStatusText("wxDialog");
-          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;
-#endif
-        case PALETTE_BUTTON:
-          managerFrame->SetStatusText("wxButton");
-          break;
-        case PALETTE_MESSAGE:
-          managerFrame->SetStatusText("wxStaticText");
-          break;
-        case PALETTE_TEXT:
-          managerFrame->SetStatusText("wxTextCtrl (single-line)");
-          break;
-        case PALETTE_MULTITEXT:
-          managerFrame->SetStatusText("wxTextCtrl (multi-line)");
-          break;
-        case PALETTE_CHOICE:
-          managerFrame->SetStatusText("wxChoice");
-          break;
-        case PALETTE_CHECKBOX:
-          managerFrame->SetStatusText("wxCheckBox");
-          break;
-        case PALETTE_RADIOBOX:
-          managerFrame->SetStatusText("wxRadioBox");
-          break;
-        case PALETTE_LISTBOX:
-          managerFrame->SetStatusText("wxListBox");
-          break;
-        case PALETTE_SLIDER:
-          managerFrame->SetStatusText("wxSlider");
-          break;
-        case PALETTE_GROUPBOX:
-          managerFrame->SetStatusText("wxStaticBox");
-          break;
-        case PALETTE_GAUGE:
-          managerFrame->SetStatusText("wxGauge");
-          break;
-        case PALETTE_BITMAP_MESSAGE:
-          managerFrame->SetStatusText("wxStaticBitmap");
-          break;
-        case PALETTE_BITMAP_BUTTON:
-          managerFrame->SetStatusText("wxBitmapButton");
-          break;
-        case PALETTE_SCROLLBAR:
-          managerFrame->SetStatusText("wxScrollBar");
-          break;
-        case PALETTE_ARROW:
-          managerFrame->SetStatusText("Pointer");
-          break;
-      }
-  }
-  else managerFrame->SetStatusText("");
-}
-
-void EditorToolPalette::OnPaint(wxPaintEvent& event)
-{
-  TOOLPALETTECLASS::OnPaint(event);
-
-  wxPaintDC dc(this);
-
-  int w, h;
-  GetSize(&w, &h);
-  dc.SetPen(wxBLACK_PEN);
-  dc.SetBrush(wxTRANSPARENT_BRUSH);
-  dc.DrawLine(0, h-1, w, h-1);
-}
-
-EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent)
-{
-  // Load palette bitmaps
-#ifdef __WXMSW__
-  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__
-  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
-
-  EditorToolPalette *palette = new EditorToolPalette(this, parent, 0, 0, -1, -1, wxNO_BORDER, // wxTB_3DBUTTONS,
-                                        wxVERTICAL, 1);
-  
-  palette->SetMargins(2, 2);
-/*
-#ifdef __WXMSW__
-  if (palette->IsKindOf(CLASSINFO(wxToolBarMSW)))
-    ((wxToolBarMSW *)palette)->SetDefaultSize(22, 22);
-#endif
-*/
-
-  palette->AddTool(PALETTE_ARROW, PaletteArrowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Pointer");
-  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_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_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_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->Layout();
-  palette->CreateTools();
-  
-  palette->ToggleTool(PALETTE_ARROW, TRUE);
-  palette->currentlySelected = PALETTE_ARROW;
-  return palette;
-}
-
diff --git a/utils/dialoged/src/editrpal.h b/utils/dialoged/src/editrpal.h
deleted file mode 100644 (file)
index fb6f0d7..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        editrpal.h
-// Purpose:     Tool palette
-// Author:      Julian Smart
-// Modified by:
-// Created:     04/01/98
-// RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart
-// Licence:    wxWindows license
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _EDITRPAL_H_
-#define _EDITRPAL_H_
-
-#ifdef __GNUG__
-#pragma interface "editrpal.h"
-#endif
-
-#include "wx/wx.h"
-#include "wx/string.h"
-#include "wx/layout.h"
-#include "wx/resource.h"
-#include "wx/tbarsmpl.h"
-
-#include "proplist.h"
-
-/*
- * Object editor tool palette
- *
- */
-
-// For some reason, wxButtonBar under Windows 95 cannot be moved to a non-0,0 position!
-#define TOOLPALETTECLASS    wxToolBarSimple
-
-class EditorToolPalette: public TOOLPALETTECLASS
-{
- public:
-  int currentlySelected;
-  wxResourceManager *resourceManager;
-
-  EditorToolPalette(wxResourceManager *manager, wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1,
-            long style = wxNO_BORDER, int direction = wxVERTICAL, int RowsOrColumns = 2);
-  bool OnLeftClick(int toolIndex, bool toggled);
-  void OnMouseEnter(int toolIndex);
-  void OnPaint(wxPaintEvent& event);
-
-DECLARE_EVENT_TABLE()
-};
-
-#define PALETTE_FRAME           1
-#define PALETTE_DIALOG_BOX      2
-#define PALETTE_PANEL           3
-#define PALETTE_CANVAS          4
-#define PALETTE_TEXT_WINDOW     5
-#define PALETTE_MESSAGE         6
-#define PALETTE_BUTTON          7
-#define PALETTE_CHECKBOX        8
-#define PALETTE_LISTBOX         9
-#define PALETTE_RADIOBOX        10
-#define PALETTE_CHOICE          11
-#define PALETTE_TEXT            12
-#define PALETTE_MULTITEXT       13
-#define PALETTE_SLIDER          14
-#define PALETTE_ARROW           15
-#define PALETTE_GAUGE           16
-#define PALETTE_GROUPBOX        17
-#define PALETTE_BITMAP_MESSAGE  18
-#define PALETTE_BITMAP_BUTTON   19
-#define PALETTE_SCROLLBAR       20
-
-#endif
index 1e447bdb211c666fb99bfac9a27ce699992c5d7a..bda1b8a670aab326308e374aac054da7f3c4bb31 100644 (file)
@@ -38,7 +38,7 @@ DEBUG_FLAGS =
 !endif
 CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) @$(INCFILE)
 
-OBJECTS = dialoged.obj editrpal.obj reseditr.obj dlghndlr.obj reswrite.obj winprop.obj edtree.obj edlist.obj
+OBJECTS = dialoged.obj reseditr.obj dlghndlr.obj reswrite.obj winprop.obj edtree.obj edlist.obj
 
 $(TARGET).exe: wxprop $(INCFILE) $(OBJECTS) $(TARGET).def $(TARGET).res
   tlink32 $(LINKFLAGS) @&&!
index 164db4f32d172992731d1ce1e9387a81bc43b2d4..c1fafdcc455e70c635e9331ac16c27aaa105c8fc 100644 (file)
@@ -14,7 +14,7 @@ WXDIR = ../../..
 # this central makefile.
 include $(WXDIR)/src/makeg95.env
 
-OBJECTS = $(OBJDIR)/dialoged.$(OBJSUFF) $(OBJDIR)/editrpal.$(OBJSUFF) $(OBJDIR)/reseditr.$(OBJSUFF)\
+OBJECTS = $(OBJDIR)/dialoged.$(OBJSUFF) $(OBJDIR)/reseditr.$(OBJSUFF)\
  $(OBJDIR)/dlghndlr.$(OBJSUFF) $(OBJDIR)/reswrite.$(OBJSUFF) $(OBJDIR)/winprop.$(OBJSUFF)\
  $(OBJDIR)/edlist.$(OBJSUFF) $(OBJDIR)/edtree.$(OBJSUFF)\
  $(OBJDIR)/dialoged_resources.$(OBJSUFF)
@@ -40,9 +40,6 @@ dialoged$(GUISUFFIX)$(EXESUFF):       $(OBJECTS) $(WXLIB)
 $(OBJDIR)/dialoged.$(OBJSUFF): dialoged.$(SRCSUFF)
        $(CC) -c $(CPPFLAGS) -o $@ dialoged.$(SRCSUFF)
 
-$(OBJDIR)/editrpal.$(OBJSUFF): winprop.h reseditr.h editrpal.h editrpal.$(SRCSUFF)
-       $(CC) -c $(CPPFLAGS) -o $@ editrpal.$(SRCSUFF)
-
 $(OBJDIR)/winprop.$(OBJSUFF):  winprop.h reseditr.h editrpal.h winprop.$(SRCSUFF)
        $(CC) -c $(CPPFLAGS) -o $@ winprop.$(SRCSUFF)
 
index 2944dc6f05acdbc525701af80660a8b8aabacc2c..ee113fa8af54f55a3fca51a529c345bb5a6755dd 100644 (file)
@@ -25,7 +25,8 @@ LOCALDOCDIR=$(WXDIR)\utils\dialoged\docs
 
 PROGRAM=dialoged
  
-OBJECTS = dialoged.obj editrpal.obj reseditr.obj dlghndlr.obj reswrite.obj winprop.obj edtree.obj edlist.obj
+OBJECTS = dialoged.obj reseditr.obj dlghndlr.obj reswrite.obj\
+  winprop.obj edtree.obj edlist.obj symbtabl.obj
 
 all:    wxprop dialoged.exe
 
@@ -47,42 +48,42 @@ $(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
 $(LIBS)
 <<
 
-dialoged.obj:      winprop.h reseditr.h editrpal.h dialoged.$(SRCSUFF) $(DUMMYOBJ)
+dialoged.obj:      winprop.h reseditr.h dialoged.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
 
-winprop.obj:      winprop.h reseditr.h editrpal.h winprop.$(SRCSUFF) $(DUMMYOBJ)
+winprop.obj:      winprop.h reseditr.h winprop.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
 
-editrpal.obj:      winprop.h reseditr.h editrpal.h editrpal.$(SRCSUFF) $(DUMMYOBJ)
+reswrite.obj:      winprop.h reseditr.h reswrite.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
 
-reswrite.obj:      winprop.h reseditr.h editrpal.h reswrite.$(SRCSUFF) $(DUMMYOBJ)
+reseditr.obj:      winprop.h reseditr.h reseditr.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
 
-reseditr.obj:      winprop.h reseditr.h editrpal.h reseditr.$(SRCSUFF) $(DUMMYOBJ)
+edtree.obj:      winprop.h reseditr.h edtree.h edtree.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
 
-edtree.obj:      winprop.h reseditr.h editrpal.h edtree.h edtree.$(SRCSUFF) $(DUMMYOBJ)
+edlist.obj:      winprop.h reseditr.h edlist.h edlist.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
 
-edlist.obj:      winprop.h reseditr.h edlist.h edlist.$(SRCSUFF) $(DUMMYOBJ)
+dlghndlr.obj:      winprop.h reseditr.h dlghndlr.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
 
-dlghndlr.obj:      winprop.h reseditr.h editrpal.h dlghndlr.$(SRCSUFF) $(DUMMYOBJ)
+symbtabl.obj:      symbtabl.h symbtabl.$(SRCSUFF) $(DUMMYOBJ)
         $(cc) @<<
 $(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
 <<
index cf8c3cb2824ca4dcf5db0e103535282d54255019..61d14b9b6cd237f3fd72912aa1e81f57df4ba313 100644 (file)
@@ -55,7 +55,6 @@
 
 #include "reseditr.h"
 #include "winprop.h"
-#include "editrpal.h"
 #include "dlghndlr.h"
 #include "edtree.h"
 #include "edlist.h"
@@ -93,10 +92,10 @@ wxResourceManager::wxResourceManager():
   m_popupMenu = NULL;
   m_editorResourceTree = NULL;
   m_editorControlList = NULL;
-  m_editorPalette = NULL;
   m_nameCounter = 1;
   m_modified = FALSE;
   m_currentFilename = "";
+  m_symbolFilename = "";
   m_editorToolBar = NULL;
 
   // Default window positions
@@ -228,7 +227,6 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *parent, const ch
     m_editorFrame->SetMenuBar(menuBar);
 
     m_editorToolBar = (EditorToolBar *)OnCreateToolBar(m_editorFrame);
-//    m_editorPalette = OnCreatePalette(m_editorFrame);
     m_editorControlList = new wxResourceEditorControlList(m_editorFrame, IDC_LISTCTRL, wxPoint(0, 0), wxSize(-1, -1));
     m_editorResourceTree = new wxResourceEditorProjectTree(m_editorFrame, IDC_TREECTRL, wxPoint(0, 0), wxSize(-1, -1),
       wxTR_HAS_BUTTONS);
@@ -245,17 +243,7 @@ bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *parent, const ch
     c->width.Unconstrained();
     c->height.Absolute(28);
     m_editorToolBar->SetConstraints(c);
-/*
-    // Constraints for palette
-    c = new wxLayoutConstraints;
-    c->left.SameAs       (m_editorFrame, wxLeft, 0);
-    c->top.SameAs        (m_editorToolBar, wxBottom, 0);
-    c->right.SameAs      (m_editorFrame, wxRight, 0);
-    c->bottom.Unconstrained();
-    c->width.Unconstrained();
-    c->height.Absolute(34);
-    m_editorPalette->SetConstraints(c);
-*/
+
     // Constraints for listbox
     c = new wxLayoutConstraints;
     c->left.SameAs       (m_editorFrame, wxLeft, 0);
@@ -397,6 +385,58 @@ bool wxResourceManager::New(bool loadFromFile, const wxString& filename)
     SetFrameTitle(m_currentFilename);
 
     UpdateResourceList();
+
+    // Construct include filename from this file
+    m_symbolFilename = m_currentFilename;
+
+       if (m_symbolFilename[0] == 'c')
+       {
+       }
+
+       wxString stringA("123456.45");
+       wxString stringB("");
+       stringB = str;
+
+       size_t i = 0;
+       char c = stringB[i];
+#if 0
+       size_t len = stringB.Length();
+       size_t i = len-1;
+       while (i > 0)
+       {
+               //    if (buffer.GetChar(i) == '.')
+               if (stringB[i] == '.')
+               {
+                       stringB = stringB.Left(i);
+                       break;
+               }
+               i --;
+       }
+#endif
+
+#if 0  
+       size_t len = m_symbolFilename.Length();
+       size_t i = len-1;
+       while (i > 0)
+       {
+               //    if (buffer.GetChar(i) == '.')
+               if (m_symbolFilename[i] == '.')
+               {
+                       m_symbolFilename = m_symbolFilename.Left(i);
+                       break;
+               }
+               i --;
+       }
+#endif
+//    wxStripExtension(m_symbolFilename);
+    m_symbolFilename += ".h";
+
+    if (!m_symbolTable.ReadIncludeFile(m_symbolFilename))
+    {
+        wxString str("Could not find include file ");
+        str += m_symbolFilename;
+        wxMessageBox(str, "Dialog Editor Warning", MB_OK);
+    }
   }
   else
   {
@@ -425,6 +465,7 @@ bool wxResourceManager::Clear(bool deleteWindows, bool force)
   ClearCurrentDialog();
   DisassociateWindows();
 
+  m_symbolTable.Clear();
   m_resourceTable.ClearTable();
   UpdateResourceList();
 
@@ -545,10 +586,18 @@ bool wxResourceManager::SaveInfoAndDeleteHandler(wxWindow* win)
 // variable.
 bool wxResourceManager::DeleteWindow(wxWindow* win)
 {
+    bool clearDisplay = FALSE;
     if (m_editorPanel->m_childWindow == win)
+    {
         m_editorPanel->m_childWindow = NULL;
+        clearDisplay = TRUE;
+    }
 
     win->Destroy();
+
+    if (clearDisplay)
+        m_editorPanel->Clear();
+
     return TRUE;
 }
 
@@ -815,7 +864,7 @@ void wxResourceManager::AddItemsRecursively(long parent, wxItemResource *resourc
 bool wxResourceManager::EditSelectedResource()
 {
   int sel = m_editorResourceTree->GetSelection();
-  if (sel > -1)
+  if (sel != 0)
   {
     wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel);
     return Edit(res);
@@ -972,6 +1021,14 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
             wxHORIZONTAL, wxDefaultValidator, buf);
       res->SetStringValues(new wxStringList("One", "Two", NULL));
     }
+  else if (itemType == "wxRadioButton")
+    {
+      MakeUniqueName("radiobutton", buf);
+      res->SetName(buf);
+      wxString names[] = { "One", "Two" };
+      newItem = new wxRadioButton(panel, -1, "Radiobutton", wxPoint(x, y), wxSize(-1, -1),
+            0, wxDefaultValidator, buf);
+    }
   else if (itemType == "wxChoice")
     {
       MakeUniqueName("choice", buf);
@@ -1042,6 +1099,33 @@ void wxResourceManager::ClearCurrentDialog()
   }
 }
 
+bool wxResourceManager::TestCurrentDialog(wxWindow* parent)
+{
+  if (m_editorPanel->m_childWindow)
+  {
+    wxItemResource* item = FindResourceForWindow(m_editorPanel->m_childWindow);
+    if (!item)
+        return FALSE;
+
+    // Make sure the resources are up-to-date w.r.t. the window
+    InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE);
+
+    wxDialog* dialog = new wxDialog;
+    long oldStyle = item->GetStyle();
+    bool success = FALSE;
+    item->SetStyle(wxDEFAULT_DIALOG_STYLE);
+    if (dialog->LoadFromResource(parent, item->GetName(), & m_resourceTable))
+    {
+        dialog->Centre();
+        dialog->ShowModal();
+        success = TRUE;
+    }
+    item->SetStyle(oldStyle);
+    return success;
+  }
+  return FALSE;
+}
+
 // Find the first dialog or panel for which
 // there is a selected panel item.
 wxWindow *wxResourceManager::FindParentOfSelection()
@@ -1467,7 +1551,7 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
 bool wxResourceManager::DeleteSelection()
 {
   int sel = m_editorResourceTree->GetSelection();
-  if (sel > -1)
+  if (sel != 0)
   {
     wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel);
     wxWindow *win = FindWindowForResource(res);
@@ -1598,6 +1682,10 @@ wxWindowPropertyInfo *wxResourceManager::CreatePropertyInfoForWindow(wxWindow *w
         {
           info = new wxRadioBoxPropertyInfo(win);
         }
+  else if (win->IsKindOf(CLASSINFO(wxRadioButton)))
+        {
+          info = new wxRadioButtonPropertyInfo(win);
+        }
   else if (win->IsKindOf(CLASSINFO(wxChoice)))
         {
           info = new wxChoicePropertyInfo(win);
@@ -1729,7 +1817,7 @@ void wxResourceEditorFrame::OnAbout(wxCommandEvent& event)
 
 void wxResourceEditorFrame::OnTest(wxCommandEvent& event)
 {
-    // TODO should show the current dialog
+    manager->TestCurrentDialog(this);
 }
 
 void wxResourceEditorFrame::OnContents(wxCommandEvent& event)
@@ -1773,7 +1861,6 @@ bool wxResourceEditorFrame::OnClose()
   }
   manager->SetEditorFrame(NULL);
   manager->SetEditorToolBar(NULL);
-  manager->SetEditorPalette(NULL);
 
   return TRUE;
 }
index c5f07132af28566a6e59a3f70b9b4befef7a992a..3839f94ee8a81056784a7f1e405c032fa48a7447 100644 (file)
@@ -26,6 +26,7 @@
 #include "wx/imaglist.h"
 
 #include "proplist.h"
+#include "symbtabl.h"
 
 #define RESED_DELETE            1
 #define RESED_RECREATE          3
@@ -66,7 +67,6 @@
  */
 
 class wxResourceEditorFrame;
-class EditorToolPalette;
 class EditorToolBar;
 class wxWindowPropertyInfo;
 class wxResourceEditorProjectTree;
@@ -125,6 +125,7 @@ class wxResourceTableWithSaving: public wxResourceTable
   void GenerateTextStyleString(long windowStyle, char *buf);
   void GenerateButtonStyleString(long windowStyle, char *buf);
   void GenerateCheckBoxStyleString(long windowStyle, char *buf);
+  void GenerateRadioButtonStyleString(long windowStyle, char *buf);
   void GenerateListBoxStyleString(long windowStyle, char *buf);
   void GenerateSliderStyleString(long windowStyle, char *buf);
   void GenerateGroupBoxStyleString(long windowStyle, char *buf);
@@ -180,7 +181,6 @@ public:
    virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent);
    virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent);
    virtual wxToolBarBase *OnCreateToolBar(wxFrame *parent);
-   virtual EditorToolPalette *OnCreatePalette(wxFrame *parent);
 
    // Create a window information object for the give window
    wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win);
@@ -193,8 +193,8 @@ public:
    virtual bool Edit(wxItemResource *res);
    virtual bool CreateNewPanel();
    virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE);
-
    virtual bool DeleteSelection();
+   virtual bool TestCurrentDialog(wxWindow* parent);
 
    // Saves the window info into the resource, and deletes the
    // handler. Doesn't actually disassociate the window from
@@ -253,11 +253,9 @@ public:
 // 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; }
@@ -268,9 +266,12 @@ public:
    inline wxResourceTable& GetResourceTable() { return m_resourceTable; }
    inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; }
 
-   inline wxString& GetCurrentFilename() { return m_currentFilename; }
+   inline wxString GetCurrentFilename() const { return m_currentFilename; }
    static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; }
 
+   inline void SetSymbolFilename(const wxString& s) { m_symbolFilename = s; }
+   inline wxString GetSymbolFilename() const { return m_symbolFilename; }
+
    inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; }
    inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; }
 
@@ -283,7 +284,6 @@ public:
    wxMenu*                          m_popupMenu;
    wxResourceEditorProjectTree*     m_editorResourceTree;
    wxResourceEditorControlList*     m_editorControlList;
-   EditorToolPalette*               m_editorPalette;
    EditorToolBar*                   m_editorToolBar;
    int                              m_nameCounter;
    bool                             m_modified;
@@ -300,6 +300,11 @@ public:
    wxRect                           m_propertyWindowSize;
    wxRect                           m_resourceEditorWindowSize;
    static wxResourceManager*        sm_currentResourceManager;
+
+   // Symbol table with identifiers for controls
+   wxResourceSymbolTable            m_symbolTable;
+   // Filename for include file, e.g. resource.h
+   wxString                         m_symbolFilename;
 };
 
 
index eef90e684c2562209ba239c105644f2ffecdd3b9..695bf6081d11d9505e2a982685aa24c0f9c479bd 100644 (file)
@@ -221,6 +221,19 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
         OutputFont(stream, item->GetFont());
       }
     }
+  else if (itemType == "wxRadioButton")
+    {
+      GenerateRadioButtonStyleString(item->GetStyle(), styleBuf);
+      stream << "wxRadioButton, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
+      stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
+      stream << item->GetWidth() << ", " << item->GetHeight();
+      stream << ", " << item->GetValue1();
+      if (item->GetFont())
+      {
+        stream << ",\\\n      ";
+        OutputFont(stream, item->GetFont());
+      }
+    }
   else if (itemType == "wxStaticBox")
     {
       GenerateGroupBoxStyleString(item->GetStyle(), styleBuf);
@@ -618,6 +631,15 @@ void wxResourceTableWithSaving::GenerateCheckBoxStyleString(long windowStyle, ch
     strcat(buf, "0");
 }
 
+void wxResourceTableWithSaving::GenerateRadioButtonStyleString(long windowStyle, char *buf)
+{
+  buf[0] = 0;
+  GenerateItemStyleString(windowStyle, buf);
+  
+  if (strlen(buf) == 0)
+    strcat(buf, "0");
+}
+
 void wxResourceTableWithSaving::GenerateListBoxStyleString(long windowStyle, char *buf)
 {
   buf[0] = 0;
diff --git a/utils/dialoged/src/symbtabl.cpp b/utils/dialoged/src/symbtabl.cpp
new file mode 100644 (file)
index 0000000..a2f42f5
--- /dev/null
@@ -0,0 +1,173 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        symbtabl.cpp
+// Purpose:     wxResourceSymbolTable
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "symbtabl.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"
+#endif
+
+#include <wx/file.h>
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "symbtabl.h"
+
+wxResourceSymbolTable::wxResourceSymbolTable():
+  m_hashTable(wxKEY_STRING)
+{
+}
+
+wxResourceSymbolTable::~wxResourceSymbolTable()
+{
+    Clear();
+}
+
+// Operations
+
+bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename)
+{
+    wxFile file;
+    if (!file.Open(filename, wxFile::read))
+        return FALSE;
+
+    off_t len = file.Length();
+    if (len == -1)
+        return FALSE;
+
+    wxString str;
+    char* p = str.GetWriteBuf(len + 1);
+
+    if (file.Read(p, len) == ofsInvalid)
+    {
+        str.UngetWriteBuf();
+        return FALSE;
+    }
+    str.UngetWriteBuf();
+
+    // Look for #define occurrences
+    size_t pos = str.Find("#define");
+    while (pos != -1)
+    {
+        size_t len = str.Length();
+
+        size_t i = pos + 8;
+
+        // Eat whitespace until symbol
+        while ((str[i] == ' ' || str[i] == '\t') && (i < len))
+            i ++;
+
+        size_t start = i;
+
+        // Eat symbol
+        while (str[i] != ' ' && str[i] != '\t' && (i < len))
+            i ++;
+        size_t end = i-1;
+
+        wxString symbol(str.Mid(start, (end - start + 1)));
+
+        // Eat whitespace until number
+        while ((str[i] == ' ' || str[i] == '\t') && (i < len))
+            i ++;
+
+        size_t startNum = i;
+
+        // Eat number
+        while (str[i] != ' ' && str[i] != '\t' && str[i] != '\n' && (i < len))
+            i ++;
+
+        size_t endNum = i-1;
+
+        wxString numStr(str.Mid(startNum, (endNum - startNum + 1)));
+
+        long id = atol(numStr);
+
+        AddSymbol(symbol, id);
+
+        str = str.Right(len - i);
+        pos = str.Find("#define");
+    }
+
+    return TRUE;
+}
+
+bool wxResourceSymbolTable::WriteIncludeFile(const wxString& filename)
+{
+    wxFile file;
+    if (!file.Open(filename, wxFile::write))
+        return FALSE;
+
+    m_hashTable.BeginFind();
+
+    wxNode* node = m_hashTable.Next();
+    while (node)
+    {
+        char* str = node->key.string;
+        long id = (long) node->Data() ;
+
+        wxString line;
+        line.Printf("#define %s %ld\n", str, id);
+
+        file.Write(line, line.Length());
+
+        node = m_hashTable.Next();
+    }
+    return TRUE;
+}
+
+void wxResourceSymbolTable::Clear()
+{
+    m_hashTable.Clear();
+}
+
+bool wxResourceSymbolTable::AddSymbol(const wxString& symbol, long id)
+{
+    m_hashTable.Put(symbol, (wxObject*) id);
+    return TRUE;
+}
+
+// Accessors
+wxString wxResourceSymbolTable::GetSymbolForId(long id)
+{
+    m_hashTable.BeginFind();
+
+    wxNode* node = m_hashTable.Next();
+    while (node)
+    {
+        char* str = node->key.string;
+        if (str && ( ((long) node->Data()) == id) )
+            return wxString(str);
+
+        node = m_hashTable.Next();
+    }
+    return wxString("");
+}
+
+long wxResourceSymbolTable::GetIdForSymbol(const wxString& symbol)
+{
+    return (long) m_hashTable.Get(symbol);
+}
+
+bool wxResourceSymbolTable::SymbolExists(const wxString& symbol) const
+{
+    return (m_hashTable.Get(symbol) != NULL);
+}
+
diff --git a/utils/dialoged/src/symbtabl.h b/utils/dialoged/src/symbtabl.h
new file mode 100644 (file)
index 0000000..e231447
--- /dev/null
@@ -0,0 +1,45 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        symbtabl.h
+// Purpose:     wxResourceSymbolTable class for storing/reading #defines
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _SYMBTABL_H_
+#define _SYMBTABL_H_
+
+#ifdef __GNUG__
+#pragma interface "symbtabl.h"
+#endif
+
+class wxResourceSymbolTable: public wxObject
+{
+public:
+    wxResourceSymbolTable();
+    ~wxResourceSymbolTable();
+
+// Operations
+    bool ReadIncludeFile(const wxString& filename);
+    bool WriteIncludeFile(const wxString& filename);
+    void Clear();
+    bool AddSymbol(const wxString& symbol, long id);
+
+// Accessors
+    wxString GetSymbolForId(long id);
+    long GetIdForSymbol(const wxString& symbol);
+    bool SymbolExists(const wxString& symbol) const;
+
+// Implementation
+
+// Member variables
+protected:
+    wxHashTable m_hashTable;
+};
+
+#endif
+    // _SYMBTABL_H_
+
index 4e43b02a452e23bc38614a384917b7570c7f441a..602c87a7635bd78fba685715f5aba6bd274fa6ea 100644 (file)
@@ -40,7 +40,6 @@
 #endif
 
 #include "reseditr.h"
-#include "editrpal.h"
 #include "winprop.h"
 
 // Causes immediate feedback.
@@ -144,6 +143,7 @@ bool wxPropertyInfo::Edit(wxWindow *parent, const wxString& title)
   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_registry.RegisterValidator((wxString)"window_id", new wxResourceSymbolValidator);
 
   propDialog->m_propInfo = this;
   propDialog->m_propSheet = propSheet;
@@ -290,6 +290,11 @@ wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name)
     propertyWindow->GetSize(&width, &height);
     return new wxProperty("height", (long)height, "integer");
   }
+  else if (name == "id")
+  {
+    wxString symbolName("TODO");
+    return new wxProperty("id", symbolName, "window_id");
+  }
   else
     return NULL;
 }
@@ -382,12 +387,18 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     }
     return TRUE;
   }
+  else if (name == "id")
+  {
+    // TODO
+    return TRUE;
+  }
   else
     return FALSE;
 }
 
 void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names)
 {
+  names.Add("id");
   names.Add("name");
   names.Add("x");
   names.Add("y");
@@ -1147,6 +1158,45 @@ bool wxCheckBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
 
+/*
+ * Radiobutton item
+ */
+
+wxProperty *wxRadioButtonPropertyInfo::GetProperty(wxString& name)
+{
+  wxRadioButton *checkBox = (wxRadioButton *)propertyWindow;
+  if (name == "value")
+    return new wxProperty("value", checkBox->GetValue(), "bool");
+  else
+    return wxItemPropertyInfo::GetProperty(name);
+}
+
+bool wxRadioButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
+{
+  wxRadioButton *checkBox = (wxRadioButton *)propertyWindow;
+  if (name == "value")
+  {
+    checkBox->SetValue((bool)property->GetValue().BoolValue());
+    return TRUE;
+  }
+  else
+    return wxItemPropertyInfo::SetProperty(name, property);
+}
+
+void wxRadioButtonPropertyInfo::GetPropertyNames(wxStringList& names)
+{
+  names.Add("label");
+  names.Add("value");
+  wxItemPropertyInfo::GetPropertyNames(names);
+}
+
+bool wxRadioButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
+{
+  wxRadioButton *cbox = (wxRadioButton *)propertyWindow;
+  resource->SetValue1(cbox->GetValue());
+  return wxItemPropertyInfo::InstantiateResource(resource);
+}
+
 /*
  * Slider item
  */
@@ -1654,3 +1704,178 @@ int wxStringToFontFamily(wxString& val)
   else if (val == "wxTELETYPE") return wxTELETYPE;
   else return wxSWISS;
 }
+
+///
+/// Resource symbol validator
+/// 
+IMPLEMENT_DYNAMIC_CLASS(wxResourceSymbolValidator, wxPropertyListValidator)
+
+wxResourceSymbolValidator::wxResourceSymbolValidator(long flags):
+  wxPropertyListValidator(flags)
+{
+}
+
+wxResourceSymbolValidator::~wxResourceSymbolValidator(void)
+{
+}
+
+bool wxResourceSymbolValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+{
+  return TRUE;
+}
+
+// Called when TICK is pressed or focus is lost or view wants to update
+// the property list.
+// Does the transferance from the property editing area to the property itself
+bool wxResourceSymbolValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+{
+  if (!view->GetValueText())
+    return FALSE;
+  wxString value(view->GetValueText()->GetValue());
+  property->GetValue() = value ;
+  return TRUE;
+}
+
+// Called when TICK is pressed or focus is lost or view wants to update
+// the property list.
+// Does the transferance from the property editing area to the property itself
+bool wxResourceSymbolValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+{
+  if (!view->GetValueText())
+    return FALSE;
+  wxString str(property->GetValue().GetStringRepresentation());
+  view->GetValueText()->SetValue(str);
+  return TRUE;
+}
+
+// Called when the property is double clicked. Extra functionality can be provided,
+// cycling through possible values.
+bool wxResourceSymbolValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+{
+  if (!view->GetValueText())
+    return FALSE;
+  OnEdit(property, view, parentWindow);
+  return TRUE;
+}
+
+bool wxResourceSymbolValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+{
+  if (view->GetConfirmButton())
+    view->GetConfirmButton()->Enable(TRUE);
+  if (view->GetCancelButton())
+    view->GetCancelButton()->Enable(TRUE);
+  if (view->GetEditButton())
+    view->GetEditButton()->Enable(TRUE);
+  if (view->GetValueText())
+    view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING);
+  return TRUE;
+}
+
+void wxResourceSymbolValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
+{
+  if (!view->GetValueText())
+    return;
+
+  wxResourceSymbolDialog* dialog = new wxResourceSymbolDialog(parentWindow, -1, "Edit Symbol");
+
+  dialog->SetSymbol(property->GetValue().StringValue());
+
+  // TODO: split name/id pair e.g. "IDC_TEXT=123" or get from symbol table - which?
+  dialog->SetId(1234);
+
+  dialog->Init();
+
+  if (dialog->ShowModal())
+  {
+    wxString symbolName(dialog->GetSymbol());
+    long id = dialog->GetId();
+    dialog->Destroy();
+
+    // TODO: set id somewhere
+    property->GetValue() = wxString(symbolName);
+
+    view->DisplayProperty(property);
+    view->UpdatePropertyDisplayInList(property);
+    view->OnPropertyChanged(property);
+  }
+
+#if 0
+  char *s = wxFileSelector(
+     filenameMessage.GetData(),
+     wxPathOnly(property->GetValue().StringValue()),
+     wxFileNameFromPath(property->GetValue().StringValue()),
+     NULL,
+     filenameWildCard.GetData(),
+     0,
+     parentWindow);
+  if (s)
+  {
+    property->GetValue() = wxString(s);
+    view->DisplayProperty(property);
+    view->UpdatePropertyDisplayInList(property);
+    view->OnPropertyChanged(property);
+  }
+#endif
+}
+
+BEGIN_EVENT_TABLE(wxResourceSymbolDialog, wxDialog)
+    EVT_BUTTON(wxID_OK, wxResourceSymbolDialog::OnOK)
+END_EVENT_TABLE()
+
+wxResourceSymbolDialog::wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title, const wxPoint& pos,
+        const wxSize& size, long style):
+    wxDialog(parent, id, title, pos, size, style)
+{
+    int x = 5;
+    int y = 5;
+
+    (void) new wxStaticText(this, -1, "Name: ", wxPoint(x, y));
+
+    x += 80;
+
+    m_nameCtrl = new wxComboBox(this, ID_SYMBOLNAME_COMBOBOX, "",
+        wxPoint(x, y), wxSize(200, -1), 0, NULL, wxCB_DROPDOWN);
+
+    y += 30;
+    x = 5;
+
+    (void) new wxStaticText(this, -1, "Id: ", wxPoint(x, y));
+
+    x += 80;
+
+    m_idCtrl = new wxTextCtrl(this, ID_SYMBOLID_TEXTCTRL, "",
+        wxPoint(x, y), wxSize(200, -1));
+
+    y += 30;
+    x = 5;
+    (void) new wxButton(this, wxID_OK, "OK", wxPoint(x, y), wxSize(90, -1));
+
+    x += 120;
+    (void) new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(x, y), wxSize(90, -1));
+
+    Fit();
+    Centre();
+}
+
+void wxResourceSymbolDialog::Init()
+{
+    wxString defaultId;
+    defaultId.Printf("%ld", m_symbolId);
+
+    m_nameCtrl->SetValue(m_symbolName);
+    m_idCtrl->SetValue(defaultId);
+}
+
+void wxResourceSymbolDialog::OnOK(wxCommandEvent& event)
+{
+    if (CheckValues())
+    {
+        wxDialog::OnOK(event);
+    }
+}
+
+bool wxResourceSymbolDialog::CheckValues()
+{
+    return TRUE;
+}
+
index c8f3aff34fd8ed8b82fd84b76d258caa30ab1d04..025ddfb263be5210151d81d92ffbeadd792e422c 100644 (file)
@@ -253,6 +253,20 @@ class wxCheckBoxPropertyInfo: public wxItemPropertyInfo
   bool InstantiateResource(wxItemResource *resource);
 };
 
+// For radiobutton items
+class wxRadioButtonPropertyInfo: public wxItemPropertyInfo
+{
+ protected:
+ public:
+  wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
+    wxItemPropertyInfo(win, res) {}
+  ~wxRadioButtonPropertyInfo(void) {}
+  wxProperty *GetProperty(wxString& name);
+  bool SetProperty(wxString& name, wxProperty *property);
+  void GetPropertyNames(wxStringList& names);
+  bool InstantiateResource(wxItemResource *resource);
+};
+
 // For gauge items
 class wxGaugePropertyInfo: public wxItemPropertyInfo
 {
@@ -313,5 +327,70 @@ int wxStringToFontWeight(wxString& val);
 int wxStringToFontStyle(wxString& val);
 int wxStringToFontFamily(wxString& val);
 
-#endif
+/*
+ * A validator to allow editing symbol/id pairs
+ */
+
+class wxResourceSymbolValidator: public wxPropertyListValidator
+{
+  DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator)
+ protected:
+ public:
+   wxResourceSymbolValidator(long flags = 0);
+
+   ~wxResourceSymbolValidator(void);
+
+   // Called when TICK is pressed or focus is lost.
+   // Return FALSE if value didn't check out; signal to restore old value.
+   bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
+
+   // Called when TICK is pressed or focus is lost or view wants to update
+   // the property list.
+   // Does the transferance from the property editing area to the property itself
+   bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
+   bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
 
+   bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
+
+   bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
+
+   // Called when the edit (...) button is pressed.
+   void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
+};
+
+/*
+ * A dialog for editing symbol/id pairs
+ */
+
+class wxResourceSymbolDialog: public wxDialog
+{
+public:
+    wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
+        const wxPoint& pos = wxDefaultPosition,
+        const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
+
+    void Init();
+
+    inline void SetSymbol(const wxString& symbol) { m_symbolName = symbol; }
+    inline void SetId(long id) { m_symbolId = id; }
+
+    inline wxString GetSymbol() const { return m_symbolName; }
+    inline long GetId() const { return m_symbolId; }
+
+    bool CheckValues();
+    void OnOK(wxCommandEvent& event);
+
+protected:
+    wxString        m_symbolName;
+    long            m_symbolId;
+    wxComboBox*     m_nameCtrl;
+    wxTextCtrl*     m_idCtrl;
+
+DECLARE_EVENT_TABLE()
+};
+
+#define ID_SYMBOLNAME_COMBOBOX  100
+#define ID_SYMBOLID_TEXTCTRL    101
+
+#endif
+ // _WINPROP_H_