]> git.saurik.com Git - wxWidgets.git/commitdiff
updated resources convertor
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 26 Sep 2000 21:59:37 +0000 (21:59 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 26 Sep 2000 21:59:37 +0000 (21:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
contrib/configure.in
contrib/utils/Makefile.in
contrib/utils/convertrc/ConvertVC.dsp [new file with mode: 0644]
contrib/utils/convertrc/Makefile.in [new file with mode: 0644]
contrib/utils/convertrc/convert.cpp [new file with mode: 0644]
contrib/utils/convertrc/convert.h [new file with mode: 0644]
contrib/utils/convertrc/rc2wxr.cpp
contrib/utils/convertrc/rc2wxr.h
contrib/utils/convertrc/rc2xml.cpp
contrib/utils/convertrc/rc2xml.h
contrib/utils/convertrc/wxconvert.rc [new file with mode: 0644]
contrib/utils/convertrc/wxr2xml.cpp
contrib/utils/convertrc/wxr2xml.h

index fccbbd25bf6fb4ecff28ede15e48cff74d1a86f0..b9f770db7e1aec9eca8c0b83f864fdb1e525a704 100644 (file)
@@ -60,4 +60,5 @@ AC_OUTPUT([
             utils/Makefile
             utils/wxrc/Makefile
             utils/wxrcedit/Makefile
+            utils/convertrc/Makefile
          ])
index 5bf9f61d11d36b3a007147b39716b51559ec1304..ac939a3f587d883ff6641d4669a52c12f56bc142 100644 (file)
@@ -1,6 +1,6 @@
 # $Id$
 
-CONTRIB_UTILS=wxrc wxrcedit
+CONTRIB_UTILS=wxrc wxrcedit convertrc
 
 all:
        @for d in $(CONTRIB_UTILS); do (cd $$d && $(MAKE)); done
diff --git a/contrib/utils/convertrc/ConvertVC.dsp b/contrib/utils/convertrc/ConvertVC.dsp
new file mode 100644 (file)
index 0000000..e5a34fd
--- /dev/null
@@ -0,0 +1,307 @@
+# Microsoft Developer Studio Project File - Name="ConvertVC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=ConvertVC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "ConvertVC.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "ConvertVC.mak" CFG="ConvertVC - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "ConvertVC - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "ConvertVC - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE "ConvertVC - Win32 Debug DLL" (based on "Win32 (x86) Application")
+!MESSAGE "ConvertVC - Win32 Release DLL" (based on "Win32 (x86) Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "ConvertVC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/wxconvert.exe"
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/wxconvert.exe" /pdbtype:sept
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Debug DLL"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "DebugDLL"
+# PROP BASE Intermediate_Dir "DebugDLL"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "DebugDLL"
+# PROP Intermediate_Dir "DebugDLL"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /YX"wxprec.h" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdlld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/wxconvert.exe" /pdbtype:sept
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Release DLL"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseDLL"
+# PROP BASE Intermediate_Dir "ReleaseDLL"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseDLL"
+# PROP Intermediate_Dir "ReleaseDLL"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdll.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/wxconvert.exe"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "ConvertVC - Win32 Release"
+# Name "ConvertVC - Win32 Debug"
+# Name "ConvertVC - Win32 Debug DLL"
+# Name "ConvertVC - Win32 Release DLL"
+# Begin Source File
+
+SOURCE=.\wx\msw\blank.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\bullseye.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\convert.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\convert.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\error.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\hand.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\info.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\magnif1.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\noentry.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\pbrush.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\pencil.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\pntleft.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\pntright.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\query.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\question.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\rc2wxr.cpp
+
+!IF  "$(CFG)" == "ConvertVC - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Debug DLL"
+
+# SUBTRACT BASE CPP /YX /Yc /Yu
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Release DLL"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\rc2wxr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\rc2xml.cpp
+
+!IF  "$(CFG)" == "ConvertVC - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Debug DLL"
+
+# SUBTRACT BASE CPP /YX /Yc /Yu
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Release DLL"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\rc2xml.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\roller.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\size.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\tip.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\warning.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\wx\msw\watch1.cur
+# End Source File
+# Begin Source File
+
+SOURCE=.\wxconvert.rc
+# ADD BASE RSC /l 0x809
+# ADD RSC /l 0x809
+# End Source File
+# Begin Source File
+
+SOURCE=.\wxr2xml.cpp
+
+!IF  "$(CFG)" == "ConvertVC - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Debug DLL"
+
+# SUBTRACT BASE CPP /YX /Yc /Yu
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF  "$(CFG)" == "ConvertVC - Win32 Release DLL"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\wxr2xml.h
+# End Source File
+# End Target
+# End Project
diff --git a/contrib/utils/convertrc/Makefile.in b/contrib/utils/convertrc/Makefile.in
new file mode 100644 (file)
index 0000000..8dffc8f
--- /dev/null
@@ -0,0 +1,11 @@
+# $Id$
+
+top_srcdir = @top_srcdir@/..
+top_builddir = ../../..
+program_dir = contrib/utils/convertrc
+
+PROGRAM=convert
+
+OBJECTS=convert.o rc2xml.o rc2wxr.o wxr2xml.o
+
+include $(top_builddir)/src/makeprog.env
diff --git a/contrib/utils/convertrc/convert.cpp b/contrib/utils/convertrc/convert.cpp
new file mode 100644 (file)
index 0000000..c4871d1
--- /dev/null
@@ -0,0 +1,222 @@
+//wxConvertApp Programming Utility
+/*This program currently offers 3 useful conversions
+1.  Converts most of an .RC file into a wxXml file
+2.  Converts most of an .wxr file into a wxXml file
+3.  Converts portions of an .RC file into a wxr file
+*/
+
+#ifdef __GNUG__
+#pragma implementation "convert.cpp"
+#pragma interface "convert.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include <wx/wxprec.h>
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/image.h>
+#include "wx/resource.h"
+
+#include "convert.h"
+#include "rc2wxr.h"
+#include "wxr2xml.h"
+#include "rc2xml.h"
+
+IMPLEMENT_APP(wxConvertApp)
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+wxConvertApp::wxConvertApp()
+{
+    m_pFrame=NULL;
+    m_pMenuBar=NULL;
+
+}
+
+wxConvertApp::~wxConvertApp()
+{
+
+}
+
+
+bool wxConvertApp::OnInit()
+{
+//Initialize all image loaders(JPEG,BMP,PNG,and etc)
+    wxInitAllImageHandlers();
+    SetAppName("wxConvertApp");
+
+    if (HandleCommandLine())
+        return TRUE;
+
+
+// Create the main frame window
+    m_pFrame = new wxMainFrame(NULL, -1, "wxConvertApp", wxPoint(0, 0), wxSize(500, 400),
+        wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
+   
+    InitMenu();
+    m_pFrame->Show(TRUE);
+    SetTopWindow(m_pFrame);
+    return TRUE;
+}
+
+void wxConvertApp::InitMenu()
+{
+    m_pMenuBar=new wxMenuBar;
+    wxASSERT(m_pMenuBar);
+
+    wxMenu *filemenu=new wxMenu;
+    filemenu->Append(ID_RC2WXR,"Convert RC file to WXR file");
+    filemenu->Append(ID_WXR2XML,"Convert WXR file to XML file");
+    filemenu->Append(ID_RC2XML,"Convert RC file to XML file");
+
+    filemenu->Append(ID_QUIT, "E&xit");
+    m_pMenuBar->Append(filemenu,"&File");
+
+    m_pFrame->SetMenuBar(m_pMenuBar);
+}
+
+
+
+// MainFrame.cpp: implementation of the wxMainFrame class.
+//
+//////////////////////////////////////////////////////////////////////
+
+BEGIN_EVENT_TABLE(wxMainFrame, wxFrame)
+    EVT_MENU(ID_QUIT,wxMainFrame::OnQuit)
+    EVT_MENU(ID_RC2WXR,wxMainFrame::OnRc2Wxr)
+    EVT_MENU(ID_WXR2XML,wxMainFrame::OnWXR2XML)
+    EVT_MENU(ID_RC2XML,wxMainFrame::OnRC2XML)
+END_EVENT_TABLE()
+
+
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+wxMainFrame::wxMainFrame(wxWindow* parent,wxWindowID id, 
+const wxString& title, const wxPoint& pos, const wxSize& size,
+long style, const wxString& name)
+:wxFrame(parent,id,title,pos,size,style,name)
+{
+   
+}
+
+wxMainFrame::~wxMainFrame()
+{
+}
+
+
+
+void wxMainFrame::OnQuit()
+{
+    Close(TRUE);
+}
+
+
+void wxMainFrame::OnRc2Wxr()
+{
+    wxFileDialog filed(this);
+    filed.SetWildcard("*.rc");
+    filed.SetStyle(wxOPEN);
+
+    if (filed.ShowModal()!=wxID_OK)
+        return;
+
+    wxFileDialog wxrfile(this,"Enter Desired WXR file name");
+    wxrfile.SetWildcard("*.wxr");
+    wxrfile.SetStyle(wxOPEN);
+    wxrfile.SetFilename("resource.wxr");
+
+    if (wxrfile.ShowModal()!=wxID_OK)
+        return;
+
+    rc2wxr convert;
+    convert.Convert(wxrfile.GetPath(),filed.GetPath());
+}
+
+void wxMainFrame::OnWXR2XML()
+{
+    wxFileDialog f(this);
+    f.SetWildcard("*.wxr");
+    if (f.ShowModal()!=wxID_OK)
+        return;
+
+
+    wxFileDialog xmlfile(this,"Enter Desired XML file name");
+    xmlfile.SetWildcard("*.xml");
+    xmlfile.SetStyle(wxOPEN);
+    xmlfile.SetFilename("resource.xml");
+
+    if (xmlfile.ShowModal()!=wxID_OK)
+        return;
+
+    wxr2xml XMLCon;
+    XMLCon.Convert(f.GetPath(),xmlfile.GetPath());
+       
+}
+
+void wxMainFrame::OnRC2XML()
+{
+    wxFileDialog f(this);
+    f.SetWildcard("*.rc");
+    if (f.ShowModal()!=wxID_OK)
+        return;
+
+    wxFileDialog xmlfile(this,"Enter Desired XML file name");
+    xmlfile.SetWildcard("*.xml");
+    xmlfile.SetStyle(wxOPEN);
+    xmlfile.SetFilename("resource.xml");
+
+    if (xmlfile.ShowModal()!=wxID_OK)
+        return;
+
+    rc2xml XMLCon;
+    XMLCon.Convert(f.GetPath(),xmlfile.GetPath());
+
+}
+
+bool wxConvertApp::HandleCommandLine()
+{
+
+   if (argc != 2) 
+       return FALSE;
+
+//Figure out kind of conversion
+    wxString source,target;
+    wxr2xml trans_wxr2xml;
+    rc2xml trans_rc2xml;
+    rc2wxr trans_rc2wxr;
+
+    source=argv[1];
+    target=argv[2];
+    
+
+    if ((source.Find(".wxr")>0)&&(target.Find(".xml")>0))
+        {
+        trans_wxr2xml.Convert(source,target);
+        return TRUE;
+        }
+    else if ((source.Find(".rc")!=-1)&(target.Find(".wxr")!=-1))
+        {
+        trans_rc2wxr.Convert(source,target);
+        return TRUE;
+        }
+    else if ((source.Find(".rc")!=-1)&(target.Find(".xml")!=-1))
+        {
+        trans_rc2xml.Convert(source,target);
+        return TRUE;
+        }
+    
+    return FALSE; 
+}
diff --git a/contrib/utils/convertrc/convert.h b/contrib/utils/convertrc/convert.h
new file mode 100644 (file)
index 0000000..472953e
--- /dev/null
@@ -0,0 +1,50 @@
+// MainFrame.h: interface for the wxMainFrame class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(MAINFRAME_H)
+#define MAINFRAME_H
+
+#include "wx/wxprec.h"
+
+
+#define ID_QUIT 1002
+#define ID_ABOUT 1003
+#define ID_RC2WXR 1005
+#define ID_WXR2XML 1006
+#define ID_RC2XML 1007
+
+class wxMainFrame:public wxFrame
+{
+public:
+    void OnRC2XML();
+    void OnWXR2XML();
+    void OnRc2Wxr();
+    void OnQuit();
+    wxMainFrame(wxWindow* parent, wxWindowID id, 
+        const wxString& title, const wxPoint& pos = wxDefaultPosition,
+        const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE,
+        const wxString& name = "frame");
+    virtual ~wxMainFrame();
+       
+protected:
+    DECLARE_EVENT_TABLE()
+};
+
+class wxConvertApp : public wxApp  
+{
+public:
+    bool HandleCommandLine();
+    void InitMenu();
+    bool OnInit(void);
+    wxConvertApp();
+    virtual ~wxConvertApp();
+
+protected:
+    wxMenuBar * m_pMenuBar;
+    wxMainFrame *m_pFrame;
+};
+
+
+
+#endif // !defined(MAINFRAME_H)
index 3c91b14a617a572b2bf9c6358b252d61be30e14a..c64398a64ee2b36630c5f84e8a0412c2aabccd69 100644 (file)
@@ -1,8 +1,32 @@
-// RC2WXR.cpp: implementation of the wxRC2WXR class.
+// rc2wxr.cpp: implementation of the rc2wxr class.
 //
 //////////////////////////////////////////////////////////////////////
+//Author:  Brian Gavin 9/24/00
+//License: wxWindows License
+/*
+WARNING- I know this code has some bugs to work out but
+I don't plan to fix them since I feel that wxr files will
+not be used much longer.
+This code was used as a starting point for my rc2xml converter
+*/
+#ifdef __GNUG__
+#pragma implementation "rc2wxr.cpp"
+#pragma interface "rc2wxr.cpp"
+#endif
+
 // For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
+#include <wx/wxprec.h>
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
 
 #include "rc2wxr.h"
 #include "wx/image.h"
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
-wxRC2WXR::wxRC2WXR()
+rc2wxr::rc2wxr()
 {
 m_done=FALSE;
 m_controlid=6000;
 }
 
-wxRC2WXR::~wxRC2WXR()
+rc2wxr::~rc2wxr()
 {
 
 }
 
-void wxRC2WXR::Open(wxString wxrfile, wxString rcfile)
+void rc2wxr::Convert(wxString wxrfile, wxString rcfile)
 {
-    wxFileProgressDlg fileprog;
-
-
-       m_rc.Open(rcfile);
-       m_filesize=m_rc.Length();
+m_rc.Open(rcfile);
+m_filesize=m_rc.Length();
 if( (m_wxr  = fopen( wxrfile, "wt" )) == NULL )
 {
-         return;
+  return;
 }
 
-fileprog.Show(TRUE);
 
 wxString tok,prevtok;
 
@@ -46,25 +66,22 @@ tok=GetToken();
 
 if (tok=="DIALOG")
 {
-       ParseDialog(prevtok);
-       fileprog.UpdateProgress(&m_rc);
+ParseDialog(prevtok);
 }
        
 
 if (tok=="MENU")
 {
-       ParseMenu(prevtok);
-       fileprog.UpdateProgress(&m_rc);
+ParseMenu(prevtok);
 }      
 
 prevtok=tok;
 }
-fileprog.UpdateProgress(&m_rc);
+
 fclose(m_wxr);
 //fclose(m_rc);  
 m_rc.Close();
 
-fileprog.Show(FALSE);
 }
 
 
@@ -88,26 +105,26 @@ FONT 8, "MS Sans Serif"
 
 
 */
-void wxRC2WXR::ParseDialog(wxString dlgname)
-{
-       wxString tok;
-       static int dlgid=999;
-       dlgid++;
-       /* Make sure that this really is a dialog 
-       microsoft reuses the keyword DIALOG for other things
-       */
-       tok=PeekToken();
-       //Microsoft notation?
-       if (tok=="DISCARDABLE")
-       {
-               tok=GetToken();
-               tok=PeekToken();
-       }
-       //This isn't a Dialog resource eject eject
-       if (!tok.IsNumber())
-               return;
+void rc2wxr::ParseDialog(wxString dlgname)
+{
+wxString tok;
+static int dlgid=999;
+dlgid++;
+/* Make sure that this really is a dialog 
+microsoft reuses the keyword DIALOG for other things
+*/
+tok=PeekToken();
+//Microsoft notation?
+if (tok=="DISCARDABLE")
+{
+tok=GetToken();
+tok=PeekToken();
+}
+//This isn't a Dialog resource eject eject
+if (!tok.IsNumber())
+    return;
 //Generate Dialog text
-fprintf(m_wxr,"static char *dialog%i = \"dialog(name = '%s',\\\n",dlgid,dlgname);
+fprintf(m_wxr,"static char *dialog%i = \"dialog(name = '%s',\\\n",dlgid,dlgname.mb_str());
 //be lazy about style for now. add it later
 fprintf(m_wxr,"style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\\\n");
 
@@ -127,10 +144,10 @@ wxString title;
 while ((tok!="BEGIN")&(tok!="{"))
 {
 if (tok=="CAPTION")
-       {
-       title=GetQuoteField();
-       fprintf(m_wxr,"title = '%s',\\\n",title);
-       }
+{
+title=GetQuoteField();
+fprintf(m_wxr,"title = '%s',\\\n",title.mb_str());
+}
 tok=GetToken();
 }
 fprintf(m_wxr,"use_dialog_units = 1,\\\n");
@@ -152,7 +169,7 @@ BEGIN
     EDITTEXT        IDC_NAME,10,3,75,14,ES_AUTOHSCROLL
 END
 */
-void wxRC2WXR::ParseControls()
+void rc2wxr::ParseControls()
 {
 wxString tok;
 
@@ -179,7 +196,7 @@ tok=GetToken();
 
 }
 //LTEXT           "Radius",IDC_STATIC,9,67,23,8
-void wxRC2WXR::ParseStaticText()
+void rc2wxr::ParseStaticText()
 {
 wxString tok;
 wxString phrase,varname;
@@ -188,12 +205,12 @@ varname=GetToken();
 m_controlid++;
 int x,y,width,height;
 ReadRect(x,y,width,height);
-fprintf(m_wxr,"  control = [%i,wxStaticText,'%s','0','%s',",m_controlid,phrase,varname);
+fprintf(m_wxr,"  control = [%i,wxStaticText,'%s','0','%s',",m_controlid,phrase.mb_str(),varname.mb_str());
 fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height);
 fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
 }
 //EDITTEXT        IDC_RADIUS,36,65,40,14,ES_AUTOHSCROLL
-void wxRC2WXR::ParseTextCtrl()
+void rc2wxr::ParseTextCtrl()
 {
 wxString tok;
 wxString varname;
@@ -201,13 +218,13 @@ varname=GetToken();
 m_controlid++;
 int x,y,width,height;
 ReadRect(x,y,width,height);
-fprintf(m_wxr,"  control = [%i,wxTextCtrl,'','0','%s',",m_controlid,varname);
+fprintf(m_wxr,"  control = [%i,wxTextCtrl,'','0','%s',",m_controlid,varname.mb_str());
 fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height);
 fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
 
 }
 //PUSHBUTTON      "Create/Update",IDC_CREATE,15,25,53,13,NOT WS_TABSTOP
-void wxRC2WXR::ParsePushButton()
+void rc2wxr::ParsePushButton()
 {
 wxString tok;
 wxString phrase,varname;
@@ -227,27 +244,27 @@ c=wxID_APPLY;
 
 int x,y,width,height;
 ReadRect(x,y,width,height);
-fprintf(m_wxr,"  control = [%i,wxButton,'%s','0','%s',",c,phrase,varname);
+fprintf(m_wxr,"  control = [%i,wxButton,'%s','0','%s',",c,phrase.mb_str(),varname.mb_str());
 fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height);
 fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
 
 }
 
 
-bool wxRC2WXR::Seperator(int ch)
+bool rc2wxr::Seperator(int ch)
 {
 if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|'))
    return TRUE;
 
 if (ch==EOF)
 {
-       m_done=TRUE;
-       return TRUE;
+m_done=TRUE;
+return TRUE;
 }
 return FALSE;
 }
 
-void wxRC2WXR::ParseGroupBox()
+void rc2wxr::ParseGroupBox()
 {
 //    GROUPBOX        "Rotate",IDC_STATIC,1,1,71,79
 wxString tok;
@@ -257,14 +274,14 @@ varname=GetToken();
 m_controlid++;
 int x,y,width,height;
 ReadRect(x,y,width,height);
-fprintf(m_wxr,"  control = [%i,wxStaticBox,'%s','0','%s',",m_controlid,phrase,varname);
+fprintf(m_wxr,"  control = [%i,wxStaticBox,'%s','0','%s',",m_controlid,phrase.mb_str(),varname.mb_str());
 fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height);
 fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
 
 
 }
 
-void wxRC2WXR::ReadRect(int & x, int & y, int & width, int & height)
+void rc2wxr::ReadRect(int & x, int & y, int & width, int & height)
 {
 x=atoi(GetToken());
 y=atoi(GetToken());
@@ -273,7 +290,7 @@ height=atoi(GetToken());
 
 }
 
-wxString wxRC2WXR::GetToken()
+wxString rc2wxr::GetToken()
 {
 wxString tok="";
 
@@ -295,20 +312,20 @@ while (Seperator(ch))
 {
   ReadChar(ch);
   if (m_done)
-         return tok;
+  return tok;
 }
 
 if (ch==EOF)
 {
-       m_done=TRUE;
+m_done=TRUE;
 
 }
   
 
 while (!Seperator(ch))
 {
-       tok+=(char)ch;
-       ReadChar(ch);
+tok+=(char)ch;
+ReadChar(ch);
 
 }
 
@@ -319,7 +336,7 @@ if (ch==EOF)
 return tok;
 }
 
-wxString wxRC2WXR::GetQuoteField()
+wxString rc2wxr::GetQuoteField()
 {
 wxString phrase;
 //ASCII code 34 "
@@ -339,7 +356,7 @@ while (ch!=34)
 return phrase;
 }
 
-void wxRC2WXR::ReadChar(int &ch)
+void rc2wxr::ReadChar(int &ch)
 {
        int result;
 result=m_rc.Tell();
@@ -356,7 +373,7 @@ if(ch==EOF)
    m_done=TRUE;
 }
 
-void wxRC2WXR::ParseComboBox()
+void rc2wxr::ParseComboBox()
 {
 /* COMBOBOX        IDC_SCALECOMBO,10,110,48,52,CBS_DROPDOWNLIST | CBS_SORT | 
                     WS_VSCROLL | WS_TABSTOP */
@@ -367,19 +384,19 @@ m_controlid++;
 int x,y,width,height;
 ReadRect(x,y,width,height);
 
-fprintf(m_wxr,"  control = [%i,wxChoice,'','0','%s',",m_controlid,varname);
+fprintf(m_wxr,"  control = [%i,wxChoice,'','0','%s',",m_controlid,varname.mb_str());
 fprintf(m_wxr,"%i,%i,%i,%i,[],\\\n",x,y,width,height);
 fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
 
 
 }
 
-void wxRC2WXR::ParseMenu(wxString name)
+void rc2wxr::ParseMenu(wxString name)
 {
 wxString tok="";
 static int menuid=0;
 menuid++;
-fprintf(m_wxr,"static char *MenuBar%i = \"menu(name = '%s',\\\n",menuid,name);  
+fprintf(m_wxr,"static char *MenuBar%i = \"menu(name = '%s',\\\n",menuid,name.mb_str());  
 fprintf(m_wxr,"menu = \\\n");
 fprintf(m_wxr,"[\\\n");
 
@@ -399,7 +416,7 @@ if (tok=="POPUP")
 fprintf(m_wxr,"]).\";\n\n");
 }
 
-void wxRC2WXR::ParsePopupMenu()
+void rc2wxr::ParsePopupMenu()
 {
 static int menuitem=99;
 menuitem++;
@@ -410,7 +427,7 @@ int spot;
 //Remove /t because it causes problems
 spot=tok.First("\\t");
 tok=tok.Left(spot);
-fprintf(m_wxr,"  ['%s',%i,'',\\\n",tok,menuitem);
+fprintf(m_wxr,"  ['%s',%i,'',\\\n",tok.mb_str(),menuitem);
 while ((tok!="BEGIN")&(tok!="{"))
    tok=GetToken();
 
@@ -418,26 +435,26 @@ while ((tok!="END")&(tok!="}"))
 {
    tok=GetToken();
 if (tok=="MENUITEM")
-       {
-       if (PeekToken()=="SEPARATOR")
-               fprintf(m_wxr,"      [],\\\n");
-       else
-       {
-       tok=GetQuoteField();
-       //Remove /t because it causes problems
-       spot=tok.First("\\t");
-       tok=tok.Left(spot);
-       menuitem++;
-    fprintf(m_wxr,"      ['%s',%i,''],\\\n",tok,menuitem);
-       }
-       }
+{
+if (PeekToken()=="SEPARATOR")
+fprintf(m_wxr,"      [],\\\n");
+else
+{
+tok=GetQuoteField();
+//Remove /t because it causes problems
+spot=tok.First("\\t");
+tok=tok.Left(spot);
+menuitem++;
+fprintf(m_wxr,"      ['%s',%i,''],\\\n",tok.mb_str(),menuitem);
+}
+}
 
 }
 
     
 }
 
-wxString wxRC2WXR::PeekToken()
+wxString rc2wxr::PeekToken()
 {
 wxString tok;
 int p;
@@ -448,7 +465,7 @@ m_rc.Seek(p);
 return tok;
 }
 //Windows pain in the butt CONTROL
-void wxRC2WXR::ParseControlMS()
+void rc2wxr::ParseControlMS()
 {
 wxString label,varname,kindctrl,tok;
 label=GetQuoteField();
@@ -468,11 +485,11 @@ if (kindctrl=="BUTTON")
                     TBS_NOTICKS | WS_TABSTOP,52,73,100,15
 */
 
-void wxRC2WXR::ParseSlider(wxString label, wxString varname)
+void rc2wxr::ParseSlider(wxString label, wxString varname)
 {
-       wxString tok;
-       while (ReadOrs(tok));
-fprintf(m_wxr,"  control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',",m_controlid,varname);  
+wxString tok;
+while (ReadOrs(tok));
+fprintf(m_wxr,"  control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',",m_controlid,varname.mb_str());  
 int x,y,width,height;
 ReadRect(x,y,width,height);
 fprintf(m_wxr,"%i,%i,%i,%i,",x,y,width,height);
@@ -483,11 +500,11 @@ fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"
 CONTROL         "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32",
                     WS_BORDER,15,52,154,13
 */
-void wxRC2WXR::ParseProgressBar(wxString label, wxString varname)
+void rc2wxr::ParseProgressBar(wxString label, wxString varname)
 {
 wxString tok;
 while (ReadOrs(tok));
-fprintf(m_wxr,"  control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',",m_controlid,varname);  
+fprintf(m_wxr,"  control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',",m_controlid,varname.mb_str());  
 int x,y,width,height;
 ReadRect(x,y,width,height);
 fprintf(m_wxr,"%i,%i,%i,%i,",x,y,width,height);
@@ -495,7 +512,7 @@ fprintf(m_wxr," 0, 10,\\\n");
 fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
 }
 
-bool wxRC2WXR::ReadOrs(wxString & w)
+bool rc2wxr::ReadOrs(wxString & w)
 {
 wxString tok;
 tok=PeekToken();
@@ -506,28 +523,28 @@ return TRUE;
 }
 
 //Is it a check button or a radio button
-void wxRC2WXR::ParseCtrlButton(wxString label, wxString varname)
+void rc2wxr::ParseCtrlButton(wxString label, wxString varname)
 {
 wxString tok;
-       tok=GetToken();
+tok=GetToken();
 
 m_controlid++;
-       int x,y,width,height;
+int x,y,width,height;
 
 if (tok=="BS_AUTOCHECKBOX")
 {
-    fprintf(m_wxr,"  control = [%i,wxCheckBox,'%s','0','%s',",m_controlid,label,varname);    
+    fprintf(m_wxr,"  control = [%i,wxCheckBox,'%s','0','%s',",m_controlid,label.mb_str(),varname.mb_str());    
     while (ReadOrs(tok));      
-       ReadRect(x,y,width,height);
+    ReadRect(x,y,width,height);
     fprintf(m_wxr,"%i,%i,%i,%i,0,\\\n",x,y,width,height);
     fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
 }
 
 if (tok=="BS_AUTORADIOBUTTON")
 {
-    fprintf(m_wxr,"  control = [%i,wxRadioButton,'%s','0','%s',",m_controlid,label,varname);    
+    fprintf(m_wxr,"  control = [%i,wxRadioButton,'%s','0','%s',",m_controlid,label.mb_str(),varname.mb_str());    
     while(ReadOrs(tok));       
-       ReadRect(x,y,width,height);
+    ReadRect(x,y,width,height);
     fprintf(m_wxr,"%i,%i,%i,%i,0,\\\n",x,y,width,height);
     fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
 }
@@ -536,106 +553,3 @@ if (tok=="BS_AUTORADIOBUTTON")
 
 }
 
-BEGIN_EVENT_TABLE(wxFileProgressDlg,wxDialog)
-END_EVENT_TABLE()
-
-wxFileProgressDlg::wxFileProgressDlg()
-{
-wxPoint pos;
-wxSize size;
-pos = ConvertDialogToPixels(wxPoint(10,10));
-size = ConvertDialogToPixels(wxSize(170,31));
-Create(GetParent(),100,"Parsing RC File",pos,size,603985920);
-SetClientSize(size);
-Move(pos);
-//wxGauge Control
-pos = ConvertDialogToPixels(wxPoint(16,16));
-size = ConvertDialogToPixels(wxSize(136,6));
-m_pProgress = new wxGauge(this,101,100,pos,size);
-//wxStaticText Control
-pos = ConvertDialogToPixels(wxPoint(72,4));
-size = ConvertDialogToPixels(wxSize(18,6));
-m_pCompleteLabel= new wxStaticText(this,102,"0",pos,size,0);
-}
-wxFileProgressDlg::~wxFileProgressDlg()
-{
-
-}
-
-void wxFileProgressDlg::UpdateProgress(wxFile * f)
-{
-int p;
-p=(int)((float)f->Tell()/(float)f->Length()*100.0);
-m_pProgress->SetValue(p);
-wxString t;
-t.sprintf("%i%%",p);
-m_pCompleteLabel->SetLabel(t);
-Refresh();
-}
-
-
-
-//////////////////////////////////////////////////////////////////////
-// GenerateBitmapSrc Class
-//////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-GenerateBitmapSrc::GenerateBitmapSrc()
-{
-
-}
-
-GenerateBitmapSrc::~GenerateBitmapSrc()
-{
-
-}
-
-bool GenerateBitmapSrc::Create(wxString imfile, wxString srcfile,wxString varname)
-{
-
-wxImage img;
-FILE *src;
-
-int h,w;
-
-img.LoadFile(imfile,wxBITMAP_TYPE_ANY);
-h=img.GetHeight();
-w=img.GetWidth();
-
-if( (src  = fopen( srcfile, "at" )) == NULL )
-      return FALSE;
-fprintf(src,"#if !defined(IMG_%s)\n",varname);
-fprintf(src,"#define IMG_%s\n",varname);
-
-fprintf(src,"//Data from bitmap file %s \n",imfile);
-fprintf(src,"//Image Height=%i,Width=%i RGB format\n",h,w);
-fprintf(src,"static unsigned char %s[][3]={\n",varname);
-
-
-for (int y=0;y<h;y++)
-{
-       for (int x=0;x<w;x++)
-       {
-       //fprintf(src,"{%i,%i,%i},",img.GetRed(x,y),img.GetGreen(x,y),img.GetBlue(x,y));
-
-       }
-fprintf(src,"\n");
-}      
-
-fprintf(src,"};\n\n");
-
-fprintf(src,"wxBitmap Load%s()\n{\n",varname);
-fprintf(src,"wxImage myimg(%i,%i);\n",w,h);
-int size=w*h*3;
-fprintf(src,"memcpy(myimg.GetData(),&%s[0][0],%i);\n",varname,size);
-fprintf(src,"return myimg.ConvertToBitmap();\n");
-fprintf(src,"}\n");
-fprintf(src,"#endif\n");
-fclose(src);
-
-return TRUE;
-}
-
index 35aeb28bc2fa0d18f31f47994df2c2429ebfdc8b..1c3790fb7d2e175d1200a7f5b5c15618251d2ee0 100644 (file)
@@ -8,12 +8,12 @@
 #include "wx/file.h"
 #include "stdio.h"
 
-class wxRC2WXR : public wxObject  
+class rc2wxr : public wxObject  
 {
 public:
-wxRC2WXR();
-~wxRC2WXR();
-void Open(wxString wxrfile, wxString rcfile);
+rc2wxr();
+~rc2wxr();
+void Convert(wxString wxrfile, wxString rcfile);
 
 private:
 wxFile m_rc;
@@ -44,28 +44,5 @@ void ParseCtrlButton(wxString label, wxString varname);
 
 };
 
-class wxFileProgressDlg : public wxDialog
-{
-public:
-       void UpdateProgress(wxFile *f);
-
-wxFileProgressDlg();
-virtual ~wxFileProgressDlg();
-
-protected:
-wxGauge *m_pProgress;
-wxStaticText *m_pCompleteLabel;
-
-  DECLARE_EVENT_TABLE()
-
-};
-class GenerateBitmapSrc : public wxObject  
-{
-public:
-       bool Create(wxString imfile, wxString srcfile,wxString varname);
-       GenerateBitmapSrc();
-       virtual ~GenerateBitmapSrc();
-
-};
 
 #endif
\ No newline at end of file
index 2518c9d8c88224866a5635591616ce2d70efdf96..795f45a9eb92c4aaa536b7fbe78342fd9aed1fac 100644 (file)
-// rc2xml.cpp: implementation of the wxRC2XML class.
-//
-//////////////////////////////////////////////////////////////////////
+// rc2xml.cpp: implementation of the rc2xml class.
+//Author:  Brian Gavin 9/24/00
+//License: wxWindows License
+/*
+How to use:
+#include "rc2xml.h"
+...
+rc2xml trans;
+trans->Convert("Myfile.rc","Myfile.xml");
+*/
+/* TODO
+1.  Figure how to fix memory leaks in all wxLists in this class
+2.  Find a way to rename MS Windows fonts so that they work
+cross platform (wxGTK,etc)
+3.  Be able to abort incorrectly formated files without crashing
+*/
+
+#ifdef __GNUG__
+#pragma implementation "rc2xml.cpp"
+#pragma interface "rc2xml.cpp"
+#endif
+
 // For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
+#include <wx/wxprec.h>
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
 
 #include "rc2xml.h"
 #include "wx/image.h"
 #include "wx/resource.h"
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+
+
+
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
-wxRC2XML::wxRC2XML()
+rc2xml::rc2xml()
 {
-m_done=FALSE;
-m_bitmaplist=new wxList(wxKEY_STRING);
-m_stringtable=new wxList(wxKEY_STRING);
-m_iconlist = new wxList(wxKEY_STRING);
+    m_done=FALSE;
+    m_bitmaplist=new wxList(wxKEY_STRING);
+    m_stringtable=new wxList(wxKEY_STRING);
+    m_iconlist = new wxList(wxKEY_STRING);
+    m_resourcelist =new wxList(wxKEY_INTEGER);
 }
 
-wxRC2XML::~wxRC2XML()
+rc2xml::~rc2xml()
 {
-delete m_bitmaplist;
-delete m_stringtable;
-delete m_iconlist;
+    delete m_bitmaplist;
+    delete m_stringtable;
+    delete m_iconlist;
+    delete m_resourcelist;
 }
 
-bool wxRC2XML::Convert(wxString rcfile, wxString xmlfile)
+bool rc2xml::Convert(wxString rcfile, wxString xmlfile)
 {
-m_rc.Open(rcfile.c_str());
-m_filesize=m_rc.Length();
-
-bool result;
-result=m_xmlfile.Open(xmlfile.c_str(),"w+t");
-wxASSERT_MSG(result,"Couldn't create XML file");       
-if (!result)
-       return FALSE;
+    m_rc.Open(rcfile.c_str());
+    m_filesize=m_rc.Length();
+    
+    bool result;
+    result=m_xmlfile.Open(xmlfile.c_str(),"w+t");
+    wxASSERT_MSG(result,"Couldn't create XML file");   
+    if (!result)
+        return FALSE;
 
        
 /* Write Basic header for XML file */
-m_xmlfile.Write("<?xml version=\"1.0\" ?>\n");
-m_xmlfile.Write("<resource>\n");
-
+    m_xmlfile.Write("<?xml version=\"1.0\" ?>\n");
+    m_xmlfile.Write("<resource>\n");
+    
+//Read resource.h
+    ParseResourceHeader();
 //Gather all the resource we need for toolbars,menus, and etc
-FirstPass();
-m_done=FALSE;
-m_rc.Seek(0);
+    FirstPass();
+    m_done=FALSE;
+    m_rc.Seek(0);
 //Read in dialogs, toolbars,menus
-SecondPass();
+    SecondPass();
 
-m_xmlfile.Write("</resource>\n");
-m_xmlfile.Close();
-m_rc.Close();
+    m_xmlfile.Write("</resource>\n");
+    m_xmlfile.Close();
+    m_rc.Close();
 
 return TRUE;
 }
 
 
-void wxRC2XML::ParseDialog(wxString dlgname)
+void rc2xml::ParseDialog(wxString dlgname)
 {
-       wxString token;
-       static int dlgid=999;
-       dlgid++;
-       /* Make sure that this really is a dialog 
-       microsoft reuses the keyword DIALOG for other things
-       */
-       token=PeekToken();
-       //Microsoft notation?
-       if (token=="DISCARDABLE")
-       {
-               token=GetToken();
-               token=PeekToken();
-       }
-       //Error isn't a Dialog resource eject eject
-       if (!token.IsNumber())
-               return;
+    wxString token;
+    static int dlgid=999;
+    dlgid++;
+/* Make sure that this really is a dialog 
+microsoft reuses the keyword DIALOG for other things
+*/
+    token=PeekToken();
+//Microsoft notation?
+    if (token=="DISCARDABLE")
+    {
+    token=GetToken();
+    token=PeekToken();
+    }
+//Error isn't a Dialog resource eject eject
+    if (!token.IsNumber())
+    return;
 
 //Record x,y,width,height
-int x,y,width,height;
-ReadRect(x,y,width,height);
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
 //Get Title
-token=GetToken();
-wxString title;
+    token=GetToken();
+    wxString title;
+    wxString ptsize,face;
+    
+    m_xmlfile.Write("\t<dialog");
+    //Avoid duplicate names this way
+    dlgname.Replace("IDD_","DLG_");
+    WriteBasicInfo(x,y,width,height,dlgname);
+    WriteTitle(title);
+    
+
+    while ((token!="BEGIN")&(token!="{"))
+    {
+    if (token=="CAPTION")
+        {
+        title=GetQuoteField();
+        }
+
+//TODO fix face name so that it is cross platform name
+//  FONT 8, "MS Sans Serif"
+    if (token=="FONT")
+        {
+        ptsize=GetToken();
+        face=GetQuoteField();
+        m_xmlfile.Write("\t\t<font>\n");
+        m_xmlfile.Write("\t\t\t<size>"+ptsize+"</size>\n");
+        m_xmlfile.Write("\t\t\t<face>"+face+"</face>\n");
+        m_xmlfile.Write("\t\t</font>\n");
+        }
+
+    token=GetToken();
+    }
 
-while ((token!="BEGIN")&(token!="{"))
-{
-if (token=="CAPTION")
-       {
-       title=GetQuoteField();
-       }
-token=GetToken();
-}
-m_xmlfile.Write("      <dialog");
-//Avoid duplicate names this way
-dlgname.Replace("IDD_","DLG_");
-
-WriteBasicInfo(x,y,width,height,dlgname);
-WriteTitle(title);
-m_xmlfile.Write("      <children>\n");
-ParseControls();
-m_xmlfile.Write("      </children>\n");
-m_xmlfile.Write("      </dialog>\n");
+    m_xmlfile.Write("\t<children>\n");
+    ParseControls();
+    m_xmlfile.Write("\t</children>\n");
+    m_xmlfile.Write("\t</dialog>\n");
 }
 
 /*
@@ -111,316 +166,305 @@ BEGIN
     EDITTEXT        IDC_NAME,10,3,75,14,ES_AUTOHSCROLL
 END
 */
-void wxRC2XML::ParseControls()
+void rc2xml::ParseControls()
 {
-wxString token;
-
-token=GetToken();
-while ((token!="END")&(token!="}"))
-       {
-       if (token=="LTEXT")
-           ParseStaticText();
-       else if (token=="EDITTEXT")
-           ParseTextCtrl();
-       else if (token=="PUSHBUTTON")
-           ParsePushButton();
-       else if (token=="DEFPUSHBUTTON")
-           ParsePushButton();
-       else if (token=="GROUPBOX")
-           ParseGroupBox();
-       else if (token=="COMBOBOX")
-           ParseComboBox();
-       else if (token=="CONTROL")
-           ParseControlMS();
-       else if (token=="LISTBOX")
-           ParseListBox();
-       else if (token=="ICON")
-               ParseIconStatic();
-       else if (token=="SCROLLBAR")
-               ParseScrollBar();
-       token=GetToken();
-       }
+    wxString token;
+
+    token=GetToken();
+    while ((token!="END")&(token!="}"))
+        {
+        if (token=="LTEXT")
+            ParseStaticText();
+        else if (token=="EDITTEXT")
+            ParseTextCtrl();
+        else if (token=="PUSHBUTTON")
+            ParsePushButton();
+        else if (token=="DEFPUSHBUTTON")
+            ParsePushButton();
+        else if (token=="GROUPBOX")
+            ParseGroupBox();
+        else if (token=="COMBOBOX")
+            ParseComboBox();
+        else if (token=="CONTROL")
+            ParseControlMS();
+        else if (token=="LISTBOX")
+            ParseListBox();
+        else if (token=="ICON")
+            ParseIconStatic();
+        else if (token=="SCROLLBAR")
+            ParseScrollBar();
+        token=GetToken();
+        }
 
 }
 //LTEXT           "Radius",IDC_STATIC,9,67,23,8
-void wxRC2XML::ParseStaticText()
+void rc2xml::ParseStaticText()
 {
-wxString token;
-wxString phrase,varname;
-phrase=GetQuoteField();
-varname=GetToken();
-int x,y,width,height;
-ReadRect(x,y,width,height);
+    wxString token;
+    wxString phrase,varname;
+    phrase=GetQuoteField();
+    varname=GetToken();
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
 
-m_xmlfile.Write("              <statictext");
-WriteBasicInfo(x,y,width,height,varname);WriteLabel(phrase);
-m_xmlfile.Write("              </statictext>\n");
+    m_xmlfile.Write("\t\t<statictext");
+    WriteBasicInfo(x,y,width,height,varname);WriteLabel(phrase);
+    m_xmlfile.Write("\t\t</statictext>\n");
 
 }
 //EDITTEXT        IDC_RADIUS,36,65,40,14,ES_AUTOHSCROLL
-void wxRC2XML::ParseTextCtrl()
+void rc2xml::ParseTextCtrl()
 {
-wxString token;
-wxString varname,style;
-varname=GetToken();
-int x,y,width,height;
-ReadRect(x,y,width,height);
+    wxString token;
+    wxString varname,style;
+    varname=GetToken();
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
 //TODO
 //style=GetToken();
-
-m_xmlfile.Write("              <textctrl");
-WriteBasicInfo(x,y,width,height,varname);
-m_xmlfile.Write("\n            </textctrl>\n");
+    m_xmlfile.Write("\t\t<textctrl");
+    WriteBasicInfo(x,y,width,height,varname);
+    m_xmlfile.Write("\t\t</textctrl>\n");
 
 }
 //PUSHBUTTON      "Create/Update",IDC_CREATE,15,25,53,13,NOT WS_TABSTOP
-void wxRC2XML::ParsePushButton()
+void rc2xml::ParsePushButton()
 {
-wxString token;
-wxString phrase,varname;
-phrase=GetQuoteField();
-varname=GetToken();
+    wxString token;
+    wxString phrase,varname;
+    phrase=GetQuoteField();
+    varname=GetToken();
 
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
 
-int x,y,width,height;
-ReadRect(x,y,width,height);
-
-m_xmlfile.Write("              <button");
-WriteBasicInfo(x,y,width,height,varname);
-WriteLabel(phrase);
-m_xmlfile.Write("              </button>\n");
+    m_xmlfile.Write("\t\t<button");
+    WriteBasicInfo(x,y,width,height,varname);
+    WriteLabel(phrase);
+    m_xmlfile.Write("\t\t</button>\n");
 
 }
 
 
-bool wxRC2XML::Seperator(int ch)
+bool rc2xml::Seperator(int ch)
 {
 //if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|')|(ch=='\t'))
-if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='\t'))
-   return TRUE;
-
-if (ch==EOF)
-{
-       m_done=TRUE;
-       return TRUE;
-}
-return FALSE;
+    if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='\t'))
+        return TRUE;
+
+    if (ch==EOF)
+        {
+        m_done=TRUE;
+        return TRUE;
+        }
+    
+    return FALSE;
 }
 
-void wxRC2XML::ParseGroupBox()
+void rc2xml::ParseGroupBox()
 {
 //    GROUPBOX        "Rotate",IDC_STATIC,1,1,71,79
-wxString token;
-wxString phrase,varname;
-phrase=GetQuoteField();
-varname=GetToken();
-int x,y,width,height;
-ReadRect(x,y,width,height);
-
-m_xmlfile.Write("              <staticbox");
-WriteBasicInfo(x,y,width,height,varname);
-WriteLabel(phrase);
-m_xmlfile.Write("              </staticbox>\n");
-
-
+    wxString token;
+    wxString phrase,varname;
+    phrase=GetQuoteField();
+    varname=GetToken();
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+
+    m_xmlfile.Write("\t\t<staticbox");
+    WriteBasicInfo(x,y,width,height,varname);
+    WriteLabel(phrase);
+    m_xmlfile.Write("\t\t</staticbox>\n");
 }
 
-void wxRC2XML::ReadRect(int & x, int & y, int & width, int & height)
+void rc2xml::ReadRect(int & x, int & y, int & width, int & height)
 {
-x=atoi(GetToken());
-y=atoi(GetToken());
-width=atoi(GetToken());
-height=atoi(GetToken());
-
+    x=atoi(GetToken());
+    y=atoi(GetToken());
+    width=atoi(GetToken());
+    height=atoi(GetToken());
 }
 
-wxString wxRC2XML::GetToken()
-{
-wxString token="";
-
-if (m_rc.Eof())
+wxString rc2xml::GetToken()
 {
-m_done=TRUE;
-return token;
-}
+    wxString token="";
 
-int ch=0;
-ReadChar(ch);
-if (ch==EOF)
-{
-m_done=TRUE;
-return token;
+    if (m_rc.Eof())
+    {
+    m_done=TRUE;
+    return token;
 }
 
-while (Seperator(ch))
-{
-  ReadChar(ch);
-  if (m_done)
-         return token;
-}
+    int ch=0;
+    ReadChar(ch);
+    if (ch==EOF)
+    {
+    m_done=TRUE;
+    return token;
+    }
 
-if (ch==EOF)
-{
-       m_done=TRUE;
+    while (Seperator(ch))
+    {
+    ReadChar(ch);
+    if (m_done)
+        return token;
+    }
 
-}
+    if (ch==EOF)
+    {
+    m_done=TRUE;
+    }
   
 
-while (!Seperator(ch))
-{
-       token+=(char)ch;
-       ReadChar(ch);
-
-}
-
-if (ch==EOF)
-   m_done=TRUE;
+    while (!Seperator(ch))
+    {
+    token+=(char)ch;
+    ReadChar(ch);
+    }
 
+    if (ch==EOF)
+        m_done=TRUE;
 
-return token;
+    return token;
 }
 
-wxString wxRC2XML::GetQuoteField()
+wxString rc2xml::GetQuoteField()
 {
-wxString phrase;
-//ASCII code 34 "
-int ch=0;
-ReadChar(ch);
+    wxString phrase;
+    //ASCII code 34 "
+    int ch=0;
+    ReadChar(ch);
 
-while (ch!=34)
-  ReadChar(ch);
+    while (ch!=34)
+        ReadChar(ch);
   
-  ReadChar(ch);
+    ReadChar(ch);
 
-while (ch!=34)
-{
-  phrase+=(char)ch;
-  ReadChar(ch);
-}
-return phrase;
+    while (ch!=34)
+    {
+    phrase+=(char)ch;
+    ReadChar(ch);
+    }
+    return phrase;
 }
 
-void wxRC2XML::ReadChar(int &ch)
+void rc2xml::ReadChar(int &ch)
 {
-       int result;
-result=m_rc.Tell();
+    int result;
+    result=m_rc.Tell();
 
-if((result>=m_filesize))
-    m_done=TRUE;
+    if((result>=m_filesize))
+        m_done=TRUE;
 
-result=m_rc.Read(&ch,1);
+    result=m_rc.Read(&ch,1);
 
-if((result==-1))
-   m_done=TRUE;
+    if((result==-1))
+        m_done=TRUE;
 
-if(ch==EOF)
-   m_done=TRUE;
+    if(ch==EOF)
+        m_done=TRUE;
 }
 
-void wxRC2XML::ParseComboBox()
+void rc2xml::ParseComboBox()
 {
 /* COMBOBOX        IDC_SCALECOMBO,10,110,48,52,CBS_DROPDOWNLIST | CBS_SORT | 
                     WS_VSCROLL | WS_TABSTOP */
-wxString token;
-wxString varname;
-varname=GetToken();
-int x,y,width,height;
-ReadRect(x,y,width,height);
-
-m_xmlfile.Write("              <combobox");
-WriteBasicInfo(x,y,width,height,varname);
-m_xmlfile.Write("\n            </combobox>\n");
-
+    wxString token;
+    wxString varname;
+    varname=GetToken();
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
 
+    m_xmlfile.Write("\t\t<combobox");
+    WriteBasicInfo(x,y,width,height,varname);
+    m_xmlfile.Write("\n\t\t</combobox>\n");
 
 }
 
-void wxRC2XML::ParseMenu(wxString varname)
+void rc2xml::ParseMenu(wxString varname)
 {
-wxString token="";
-
-//Write menubar to xml file
-m_xmlfile.Write("      <menubar");
-//Avoid duplicate names this way
-varname.Replace("IDR_","MB_");
-WriteName(varname);
-m_xmlfile.Write(">\n");
-m_xmlfile.Write("              <children>\n");
-
-while ((token!="BEGIN")&(token!="{"))
-   token=GetToken();
-
-while ((token!="END")&(token!="}"))
-{
-   token=GetToken();
-if (token=="POPUP")
-       {
-    ParsePopupMenu();
-       }
-}
-m_xmlfile.Write("              </children>\n");
-m_xmlfile.Write("      </menubar>\n");
+    wxString token="";
+
+    //Write menubar to xml file
+    m_xmlfile.Write("\t<menubar");
+    //Avoid duplicate names this way
+    varname.Replace("IDR_","MB_");
+    WriteName(varname);
+    m_xmlfile.Write(">\n");
+    m_xmlfile.Write("\t\t<children>\n");
+
+    while ((token!="BEGIN")&(token!="{"))
+        token=GetToken();
+
+    while ((token!="END")&(token!="}"))
+    {
+    token=GetToken();
+    if (token=="POPUP")
+        {
+        ParsePopupMenu();
+        }
+    }
+    m_xmlfile.Write("\t\t</children>\n");
+    m_xmlfile.Write("\t</menubar>\n");
 }
 
-void wxRC2XML::ParsePopupMenu()
+void rc2xml::ParsePopupMenu()
 {
-static menucount=0;
-menucount++;
-wxString token,name,msg,longhelp,tip;
-token=GetQuoteField();
-int spot;
-//Remove /t because it causes problems
+    static int menucount=0;
+    menucount++;
+    wxString token,name,msg,longhelp,tip;
+    token=GetQuoteField();
+
+//Remove \t because it causes problems
 
-spot=token.First("\\t");
-token=token.Left(spot);
+//spot=token.First("\\t");
+//token=token.Left(spot);
 
 //Write Menu item
 //Generate a fake name since RC menus don't have one
-name<<"Menu_"<<menucount;
-m_xmlfile.Write("              <menu");
-WriteName(name);
-m_xmlfile.Write(">\n");
-WriteLabel(token);
-m_xmlfile.Write("                      <children>\n");
-
-while ((token!="BEGIN")&(token!="{"))
-   token=GetToken();
-
-while ((token!="END")&(token!="}"))
-       {
-       token=GetToken();
-       
-       if (token=="POPUP")
-           ParsePopupMenu();
-       
-       if (token=="MENUITEM")
-               ParseMenuItem();
+    name<<"Menu_"<<menucount;
+    m_xmlfile.Write("\t\t<menu");
+    WriteName(name);
+    m_xmlfile.Write(">\n");
+    WriteLabel(token);
+    m_xmlfile.Write("\t\t\t<children>\n");
+
+    while ((token!="BEGIN")&(token!="{"))
+        token=GetToken();
+
+    while ((token!="END")&(token!="}"))
+    {
+    token=GetToken();
+    if (token=="POPUP")
+        ParsePopupMenu();
        
-       }
-m_xmlfile.Write("                      </children>\n");
-m_xmlfile.Write("              </menu>\n");
+    if (token=="MENUITEM")
+        ParseMenuItem();
+    }
+    m_xmlfile.Write("\t\t\t</children>\n");
+    m_xmlfile.Write("\t\t\t</menu>\n");
 }
 
-wxString wxRC2XML::PeekToken()
+wxString rc2xml::PeekToken()
 {
-wxString token;
-int p;
-p=m_rc.Tell();
-token=GetToken();
+    wxString token;
+    int p;
+    p=m_rc.Tell();
+    token=GetToken();
 
-m_rc.Seek(p);
-return token;
+    m_rc.Seek(p);
+    return token;
 }
 //MS Windows pain in the butt CONTROL
-void wxRC2XML::ParseControlMS()
+void rc2xml::ParseControlMS()
 {
-wxString label,varname,kindctrl,token;
-token=PeekToken();
+    wxString label,varname,kindctrl,token;
+    token=PeekToken();
 
-if (token.Contains("\""))
-       ParseNormalMSControl();
-else
-       ParseWeirdMSControl();
+    if (token.Contains("\""))
+        ParseNormalMSControl();
+    else
+        ParseWeirdMSControl();
 
 }
 
@@ -428,534 +472,526 @@ else
                     TBS_NOTICKS | WS_TABSTOP,52,73,100,15
 */
 
-void wxRC2XML::ParseSlider(wxString label, wxString varname)
+void rc2xml::ParseSlider(wxString label, wxString varname)
 {
-wxString token;
-while (ReadOrs(token));
-//TODO Handle styles
-//fprintf(m_wxrfile,"  control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',",m_controlid,varname);  
-int x,y,width,height;
-ReadRect(x,y,width,height);
-m_xmlfile.Write("              <slider");
-WriteBasicInfo(x,y,width,height,varname);
-m_xmlfile.Write("\n            </slider>\n");
+    wxString token,style;
+    ReadOrs(token);
+    if (token.Find("TBS_VERT")!=-1)
+        style+="wxSL_VERTICAL";
+    //MFC RC Default is horizontal
+    else
+        style+="wxSL_HORIZONTAL";
+
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+    m_xmlfile.Write("\t\t<slider");
+    WriteBasicInfo(x,y,width,height,varname);
+    WriteStyle(style);
+    m_xmlfile.Write("\n\t\t</slider>\n");
 
 }
 /*    
 CONTROL         "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32",
                     WS_BORDER,15,52,154,13
 */
-void wxRC2XML::ParseProgressBar(wxString label, wxString varname)
+void rc2xml::ParseProgressBar(wxString label, wxString varname)
 {
-wxString token;
-while (ReadOrs(token));
-int x,y,width,height;
-ReadRect(x,y,width,height);
-wxString style;
+    wxString token,style;
+    ReadOrs(token);
+   
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+
 //Always horizontal in MFC
-style+="wxGA_HORIZONTAL";
-m_xmlfile.Write("              <gauge");
-WriteBasicInfo(x,y,width,height,varname);
-WriteStyle(style);
-m_xmlfile.Write("              </gauge>\n");
+    m_xmlfile.Write("\t\t<gauge");
+    WriteBasicInfo(x,y,width,height,varname);
+    WriteStyle(style);
+    m_xmlfile.Write("\t\t</gauge>\n");
 }
 
-/* FIXME: this function needs to be rewritten */
-bool wxRC2XML::ReadOrs(wxString & w)
+bool rc2xml::ReadOrs(wxString & orstring)
 {
-wxString token;
-token=PeekToken();
-
-if (token.IsNumber())
-   return FALSE;
-
-w=GetToken();
-return TRUE;
+    wxString token;
+
+    token=PeekToken();
+    if (token.IsNumber())
+        return FALSE;
+    orstring=GetToken();
+
+    while(PeekToken()==_T("|"))
+    {
+    //Grab | 
+    orstring+=GetToken();
+    //Grab next token
+    orstring+=GetToken();
+    }
+    return TRUE;
 }
 
 //Is it a check button or a radio button
-void wxRC2XML::ParseCtrlButton(wxString label, wxString varname)
+void rc2xml::ParseCtrlButton(wxString label, wxString varname)
 {
-wxString token;
-       token=GetToken();
-       int x,y,width,height;
-
-if (token=="BS_AUTOCHECKBOX")
-       {
-    while (ReadOrs(token));    
-       ReadRect(x,y,width,height);
-       m_xmlfile.Write("               <checkbox");
-       WriteBasicInfo(x,y,width,height,varname);
-       WriteLabel(label);
-       m_xmlfile.Write("               </checkbox>\n");
-       }
-
-if (token=="BS_AUTORADIOBUTTON")
-       {
-    while(ReadOrs(token));     
-       ReadRect(x,y,width,height);
-       m_xmlfile.Write("               <radiobutton");
-       WriteBasicInfo(x,y,width,height,varname);
-       WriteLabel(label);
-       m_xmlfile.Write("               </radiobutton>\n");
-    }
-
-
+    wxString token;
+    ReadOrs(token);
+    int x,y,width,height;
+
+    if (token.Find("BS_AUTOCHECKBOX")!=-1)
+        {
+        ReadRect(x,y,width,height);
+        m_xmlfile.Write("\t\t<checkbox");
+        WriteBasicInfo(x,y,width,height,varname);
+        WriteLabel(label);
+        m_xmlfile.Write("\t\t</checkbox>\n");
+        }
+
+    if (token.Find("BS_AUTORADIOBUTTON")!=-1)
+        {
+        ReadRect(x,y,width,height);
+        m_xmlfile.Write("\t\t<radiobutton");
+        WriteBasicInfo(x,y,width,height,varname);
+        WriteLabel(label);
+        m_xmlfile.Write("\t\t</radiobutton>\n");
+        }
 
 }
 
 
-void wxRC2XML::WriteSize(int width, int height)
+void rc2xml::WriteSize(int width, int height)
 {
-wxString msg;
-msg<<" <size>"<<width<<","<<height<<"d</size>";
-m_xmlfile.Write(msg);
+    wxString msg;
+    msg<<" <size>"<<width<<","<<height<<"d</size>";
+    m_xmlfile.Write(msg);
 }
 
-void wxRC2XML::WritePosition(int x, int y)
+void rc2xml::WritePosition(int x, int y)
 {
-wxString msg;
-msg<<" <pos>"<<x<<","<<y<<"d</pos>";
-m_xmlfile.Write(msg);
+    wxString msg;
+    msg<<" <pos>"<<x<<","<<y<<"d</pos>";
+    m_xmlfile.Write(msg);
 }
 
-void wxRC2XML::WriteTitle(wxString title)
+void rc2xml::WriteTitle(wxString title)
 {
-wxString msg;
-msg=_T("               <title>"+title+"</title>\n");
-m_xmlfile.Write(msg);
+    wxString msg;
+    msg=_T("\t\t<title>"+title+"</title>\n");
+    m_xmlfile.Write(msg);
 }
 
-void wxRC2XML::WriteName(wxString name)
+void rc2xml::WriteName(wxString name)
 {
        
+//Try to convert any number ids into names
+name=LookUpId(name);
 //Replace common MS ids with wxWindows ids
 //I didn't do everyone of them
-if (name=="IDOK")
-       name="wxID_OK";
-else if (name=="IDCANCEL")
-       name="wxID_CANCEL";
-else if (name=="IDAPPLY")
-       name="wxID_APPLY";
-else if (name=="ID_FILE_OPEN")
-       name="wxID_OPEN";
-else if (name=="ID_FILE_CLOSE")
-       name="wxID_CLOSE";
-else if (name=="ID_FILE_SAVE")
-       name="wxID_SAVE";
-else if (name=="ID_FILE_SAVE_AS")
-       name="wxID_SAVEAS";
-else if (name=="ID_APP_EXIT")
-       name="wxID_EXIT";
-else if (name=="ID_FILE_PRINT")
-       name="wxID_PRINT";
-else if (name=="ID_FILE_PRINT_PREVIEW")
-       name="wxID_PREVIEW";
-else if (name=="ID_FILE_PRINT_SETUP")
-       name="wxID_PRINT_SETUP";
-else if (name=="ID_APP_ABOUT")
-       name="wxID_ABOUT";
-else if (name=="ID_EDIT_UNDO")
-       name="wxID_UNDO";
-else if (name=="ID_EDIT_CUT")
-       name="wxID_CUT";
-else if (name=="ID_EDIT_COPY")
-       name="wxID_COPY";
-else if (name=="ID_EDIT_PASTE")
-       name="wxID_PASTE";
-
-m_xmlfile.Write(" name= \""+name+"\"");
+    if (name=="IDOK")
+        name="wxID_OK";
+    else if (name=="IDCANCEL")
+        name="wxID_CANCEL";
+    else if (name=="IDAPPLY")
+        name="wxID_APPLY";
+    else if (name=="ID_FILE_OPEN")
+        name="wxID_OPEN";
+    else if (name=="ID_FILE_CLOSE")
+        name="wxID_CLOSE";
+    else if (name=="ID_FILE_SAVE")
+        name="wxID_SAVE";
+    else if (name=="ID_FILE_SAVE_AS")
+        name="wxID_SAVEAS";
+    else if (name=="ID_APP_EXIT")
+        name="wxID_EXIT";
+    else if (name=="ID_FILE_PRINT")
+        name="wxID_PRINT";
+    else if (name=="ID_FILE_PRINT_PREVIEW")
+        name="wxID_PREVIEW";
+    else if (name=="ID_FILE_PRINT_SETUP")
+        name="wxID_PRINT_SETUP";
+    else if (name=="ID_APP_ABOUT")
+        name="wxID_ABOUT";
+    else if (name=="ID_EDIT_UNDO")
+        name="wxID_UNDO";
+    else if (name=="ID_EDIT_CUT")
+        name="wxID_CUT";
+    else if (name=="ID_EDIT_COPY")
+        name="wxID_COPY";
+    else if (name=="ID_EDIT_PASTE")
+        name="wxID_PASTE";
+
+    m_xmlfile.Write(" name= \""+name+"\"");
 }
 
-void wxRC2XML::WriteLabel(wxString label)
+void rc2xml::WriteLabel(wxString label)
 {
-label.Replace("&","$");
-m_xmlfile.Write("                      <label>"+label+"</label>\n");
+    label.Replace("&","$");
+    m_xmlfile.Write("\t\t\t<label>"+label+"</label>\n");
 }
 
-void wxRC2XML::WriteBasicInfo(int x, int y, int width, int height, wxString name)
+void rc2xml::WriteBasicInfo(int x, int y, int width, int height, wxString name)
 {
-WriteName(name);
-m_xmlfile.Write(">\n");
-m_xmlfile.Write("              ");
-WritePosition(x,y);
-WriteSize(width,height);
-m_xmlfile.Write("\n");
-
+    WriteName(name);
+    m_xmlfile.Write(">\n");
+    m_xmlfile.Write("\t\t\t");
+    WritePosition(x,y);
+    WriteSize(width,height);
+    m_xmlfile.Write("\n");
 }
 
-void wxRC2XML::WriteStyle(wxString style)
+void rc2xml::WriteStyle(wxString style)
 {
-if (style.Length()==0)
-       return;
-m_xmlfile.Write("\n            <style>"+style+"</style>\n");
+    if (style.Length()==0)
+        return;
+    m_xmlfile.Write("\n\t\t<style>"+style+"</style>\n");
 }
 /*
     LISTBOX         IDC_LIST1,16,89,48,40,LBS_SORT | LBS_MULTIPLESEL | 
                     LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
 */
-void wxRC2XML::ParseListBox()
+void rc2xml::ParseListBox()
 {
-wxString token;
-wxString varname;
-
-varname=GetToken();
-int x,y,width,height;
-ReadRect(x,y,width,height);
+    wxString token;
+    wxString varname;
+    varname=GetToken();
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
 
-m_xmlfile.Write("              <listbox");
-WriteBasicInfo(x,y,width,height,varname);
-m_xmlfile.Write("\n            </listbox>\n");
+    m_xmlfile.Write("\t\t<listbox");
+    WriteBasicInfo(x,y,width,height,varname);
+    m_xmlfile.Write("\n\t\t</listbox>\n");
 
 }
 /*
     CONTROL         "",IDC_RICHEDIT1,"RICHEDIT",ES_AUTOHSCROLL | WS_BORDER | 
                     WS_TABSTOP,103,110,40,14
 */
-void wxRC2XML::ParseRichEdit(wxString label, wxString varname)
+void rc2xml::ParseRichEdit(wxString label, wxString varname)
 {
-wxString token;
-while (ReadOrs(token));
-int x,y,width,height;
-ReadRect(x,y,width,height);
-wxString style;
+    wxString token;
+    //while (ReadOrs(token));
+    ReadOrs(token);
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+    wxString style;
 //Make it a rich text control
-style+="wxTE_MULTILINE ";
-m_xmlfile.Write("              <textctrl");
-WriteBasicInfo(x,y,width,height,varname);
-WriteStyle(style);
-m_xmlfile.Write("              </textctrl>\n");
+    style+="wxTE_MULTILINE ";
+    m_xmlfile.Write("\t\t<textctrl");
+    WriteBasicInfo(x,y,width,height,varname);
+    WriteStyle(style);
+    m_xmlfile.Write("\t\t</textctrl>\n");
 
 }
 /*
 CONTROL         "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS,209,72,
                  19,26
 */
-void wxRC2XML::ParseSpinCtrl(wxString label, wxString varname)
+void rc2xml::ParseSpinCtrl(wxString label, wxString varname)
 {
-wxString token;
-while (ReadOrs(token));
-int x,y,width,height;
-ReadRect(x,y,width,height);
-wxString style;
-m_xmlfile.Write("              <spinbutton");
-WriteBasicInfo(x,y,width,height,varname);
-WriteStyle(style);
-m_xmlfile.Write("\n            </spinbutton>\n");
-
+    wxString token,style;
+    
+    ReadOrs(token);
+    if (token.Find("UDS_HORZ")!=-1)
+        style="wxSP_HORIZONTAL";
+    //MFC default
+    else
+        style="wxSP_VERTICAL";
+
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+    m_xmlfile.Write("\t\t<spinbutton");
+    WriteBasicInfo(x,y,width,height,varname);
+    WriteStyle(style);
+    m_xmlfile.Write("\n\t\t</spinbutton>\n");
 
 }
 
-void wxRC2XML::FirstPass()
+void rc2xml::FirstPass()
 {
-wxString token,prevtok;
-while (!m_done)
-       {
-       token=GetToken();
-       if (token=="BITMAP")
-               ParseBitmap(prevtok);
-       else if (token=="STRINGTABLE")
-               ParseStringTable(prevtok);
-       else if (token=="ICON")
-               ParseIcon(prevtok);
-       prevtok=token;
-       }
+    wxString token,prevtok;
+    while (!m_done)
+        {
+        token=GetToken();
+        if (token=="BITMAP")
+            ParseBitmap(prevtok);
+        else if (token=="STRINGTABLE")
+            ParseStringTable(prevtok);
+        else if (token=="ICON")
+            ParseIcon(prevtok);
+        
+        prevtok=token;
+        }
 }
 
-void wxRC2XML::ParseBitmap(wxString varname)
+void rc2xml::ParseBitmap(wxString varname)
 {
-wxString token,*bitmapfile;
-bitmapfile=new wxString;
-token=PeekToken();
-//Microsoft notation?
-if (token=="DISCARDABLE")
-       {
-       token=GetToken();
-       token=PeekToken();
-       }
-
-*bitmapfile=GetQuoteField();
-m_bitmaplist->Append(varname,bitmapfile);
+    wxString token,*bitmapfile;
+    
+    token=PeekToken();
+    //Microsoft notation?
+    if (token=="DISCARDABLE")
+        {
+        token=GetToken();
+        token=PeekToken();
+        }
+    bitmapfile=new wxString;
+    *bitmapfile=GetQuoteField();
+    m_bitmaplist->Append(varname,bitmapfile);
 
 }
 
 
-void wxRC2XML::SecondPass()
+void rc2xml::SecondPass()
 {
-wxString token,prevtok;
-while (!m_done)
-       {
-       token=GetToken();
-       if (token=="DIALOG")
-               ParseDialog(prevtok);
-       else if (token=="MENU")
-               ParseMenu(prevtok);
-       else if (token=="TOOLBAR")
-               ParseToolBar(prevtok);
-       prevtok=token;
-       }
+    wxString token,prevtok;
+    while (!m_done)
+        {
+        token=GetToken();
+        if (token=="DIALOG")
+            ParseDialog(prevtok);
+        else if (token=="MENU")
+            ParseMenu(prevtok);
+        else if (token=="TOOLBAR")
+            ParseToolBar(prevtok);
+        
+        prevtok=token;
+        }
 
 }
 
-void wxRC2XML::ParseToolBar(wxString varname)
+void rc2xml::ParseToolBar(wxString varname)
 {
-wxString token;        
-token=GetToken();
-wxASSERT_MSG(token=="DISCARDABLE","Error in toolbar parsing");
-       
+    wxString token;    
+    token=GetToken();
+    wxASSERT_MSG(token=="DISCARDABLE","Error in toolbar parsing");
 //Look up bitmap for toolbar and load
-wxNode *node=m_bitmaplist->Find(varname);
-wxString *bitmappath;
-bitmappath=(wxString *)node->Data();
-wxBitmap bitmap;
-if (!bitmap.LoadFile(*bitmappath,wxBITMAP_TYPE_BMP ))
-       wxLogError("Unable to load bitmap:"+*bitmappath);
+    wxNode *node=m_bitmaplist->Find(LookUpId(varname));
+    wxString *bitmappath;
+    bitmappath=(wxString *)node->Data();
+    wxBitmap bitmap;
+    if (!bitmap.LoadFile(*bitmappath,wxBITMAP_TYPE_BMP ))
+        wxLogError("Unable to load bitmap:"+*bitmappath);
 
 //Write toolbar to xml file
-m_xmlfile.Write("      <toolbar");
+    m_xmlfile.Write("  <toolbar");
 //Avoid duplicate names this way
-varname.Replace("IDR_","TB_");
-WriteName(varname);
-m_xmlfile.Write(">\n");
-wxString style;
-style+="wxTB_FLAT";
-WriteStyle(style);
+    varname.Replace("IDR_","TB_");
+    WriteName(varname);
+    m_xmlfile.Write(">\n");
+    wxString style;
+    style+="wxTB_FLAT";
+    WriteStyle(style);
 
-m_xmlfile.Write("              <children>\n");
+    m_xmlfile.Write("\t\t<children>\n");
 
 //Grab width and height
-int width,height;
-width=atoi(GetToken());
-height=atoi(GetToken());
-
-int c=0;       
-wxString buttonname,msg,tip,longhelp;
-token=GetToken();
-while ((token!="BEGIN"))
-       token=GetToken();
-
-while ((token!="END")&(token!="}"))
-       {
-       if (token=="BUTTON")
-               {
-               buttonname=GetToken();
-               m_xmlfile.Write("                       <tool");
-               WriteName(buttonname);
-               m_xmlfile.Write(">\n");
-               //Write tool tip if any
-               if (LookUpString(buttonname,msg))
-                       {
-                       SplitHelp(msg,tip,longhelp);
-                       m_xmlfile.Write("               <tooltip>"+tip+"</tooltip>\n");
-                       m_xmlfile.Write("               <longhelp>"+longhelp+"</longhelp>\n");
-                       }
-               //Make a bitmap file name
-               buttonname=CleanName(buttonname);
-               buttonname+=".bmp";
-               m_xmlfile.Write("                       <bitmap>"+buttonname+"</bitmap>\n");
-               WriteToolButton(buttonname,c,width,height,bitmap);
-               m_xmlfile.Write("                       </tool>\n");
-               c++;
-               }
-         else if (token=="SEPARATOR")
-               {
-               m_xmlfile.Write("                       <separator/>\n");
-               }
-       token=GetToken();
-       }
-m_xmlfile.Write("      </children>\n");
-m_xmlfile.Write("      </toolbar>\n");
+    int width,height;
+    width=atoi(GetToken());
+    height=atoi(GetToken());
+
+    int c=0;   
+    wxString buttonname,msg,tip,longhelp;
+    token=GetToken();
+    while ((token!="BEGIN"))
+        token=GetToken();
+
+    while ((token!="END")&(token!="}"))
+        {
+        if (token=="BUTTON")
+            {
+            buttonname=GetToken();
+            m_xmlfile.Write("\t\t\t<tool");
+            WriteName(buttonname);
+            m_xmlfile.Write(">\n");
+    //Write tool tip if any
+            if (LookUpString(buttonname,msg))
+                {
+                SplitHelp(msg,tip,longhelp);
+                m_xmlfile.Write("\t\t\t\t<tooltip>"+tip+"</tooltip>\n");
+                m_xmlfile.Write("              <longhelp>"+longhelp+"</longhelp>\n");
+                }
+            //Make a bitmap file name
+            buttonname=CleanName(buttonname);
+            buttonname+=".bmp";
+            m_xmlfile.Write("\t\t\t\t<bitmap>"+buttonname+"</bitmap>\n");
+        WriteToolButton(buttonname,c,width,height,bitmap);
+        m_xmlfile.Write("\t\t\t</tool>\n");
+        c++;
+        }
+    else if (token=="SEPARATOR")
+    {
+    m_xmlfile.Write("\t\t\t<separator/>\n");
+    }
+    token=GetToken();
+    }
+    m_xmlfile.Write("\t</children>\n");
+    m_xmlfile.Write("\t</toolbar>\n");
 }
 
 //Extract bitmaps from larger toolbar bitmap
-void wxRC2XML::WriteToolButton(wxString name,int index, int width, int height, wxBitmap bitmap)
+void rc2xml::WriteToolButton(wxString name,int index, int width, int height, wxBitmap bitmap)
 {
-int x;
-x=index*width;
-wxRect r(x,0,width,height);
-wxBitmap little;
-
-little=bitmap.GetSubBitmap(r);
-little.SaveFile(name,wxBITMAP_TYPE_BMP);
+    int x;
+    x=index*width;
+    wxRect r(x,0,width,height);
+    wxBitmap little;
+    little=bitmap.GetSubBitmap(r);
+    little.SaveFile(name,wxBITMAP_TYPE_BMP);
 }
 
-void wxRC2XML::ParseStringTable(wxString varname)
+void rc2xml::ParseStringTable(wxString varname)
 {
-wxString token;
-token=GetToken();
-while ((token!="BEGIN"))
-       token=GetToken();
-token=GetToken();
-wxString *msg;
-
-while ((token!="END")&(token!="}"))
-       {
-       msg=new wxString;
-       *msg=GetQuoteField();
-       m_stringtable->Append(token,msg);
-       token=GetToken();
-       }
+    wxString token;
+    token=GetToken();
+    while ((token!="BEGIN"))
+        token=GetToken();
+    token=GetToken();
+    wxString *msg;
+
+    while ((token!="END")&(token!="}"))
+        {
+        msg=new wxString;
+        *msg=GetQuoteField();
+        m_stringtable->Append(token,msg);
+        token=GetToken();
+        }
 
 }
 
-bool wxRC2XML::LookUpString(wxString strid,wxString & st)
+bool rc2xml::LookUpString(wxString strid,wxString & st)
 {
-wxNode *node=m_stringtable->Find(strid);
-wxString *s;
-if (node==NULL)
-       return FALSE;
+    wxNode *node=m_stringtable->Find(strid);
+    wxString *s;
+    if (node==NULL)
+        return FALSE;
 
-s=(wxString *)node->Data();
-st=*s;
+    s=(wxString *)node->Data();
+    st=*s;
 
-return TRUE;
+    return TRUE;
 }
 
-bool wxRC2XML::SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp)
+bool rc2xml::SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp)
 {
-int spot;
-spot=msg.Find("\\n");
-if (spot==-1)
-       {
-       shorthelp=msg;
-       longhelp=msg;
-       }
-
-longhelp=msg.Left(spot);
-spot=msg.Length()-spot-2;
-shorthelp=msg.Right(spot);
-return TRUE;
+    int spot;
+    spot=msg.Find("\\n");
+    if (spot==-1)
+        {
+        shorthelp=msg;
+        longhelp=msg;
+        }
+
+    longhelp=msg.Left(spot);
+    spot=msg.Length()-spot-2;
+    shorthelp=msg.Right(spot);
+    return TRUE;
 }
 
-void wxRC2XML::ParseMenuItem()
+void rc2xml::ParseMenuItem()
 {
-wxString token,name,msg,tip,longhelp;
-int spot;
-if (PeekToken()=="SEPARATOR")
-       {
-       m_xmlfile.Write("                       <separator/>\n");
-       return;
-       }
-
-token=GetQuoteField();
-name=GetToken();
-//Remove /t because it causes problems
-spot=token.First("\\t");
-token=token.Left(spot);
-m_xmlfile.Write("                      <menuitem");
-WriteName(name);
-m_xmlfile.Write(">\n");
-WriteLabel(token);
+    wxString token,name,msg,tip,longhelp;
+//int spot;
+    if (PeekToken()=="SEPARATOR")
+        {
+        m_xmlfile.Write("\t\t\t<separator/>\n");
+        return;
+        }
+
+    token=GetQuoteField();
+    name=GetToken();
+//Remove \t because it causes problems
+//spot=token.First("\\t");
+//token=token.Left(spot);
+    m_xmlfile.Write("\t\t\t<menuitem");
+    WriteName(name);
+    m_xmlfile.Write(">\n");
+    WriteLabel(token);
 //Look up help if any listed in stringtable
-if (LookUpString(name,msg))
-       {
-       SplitHelp(msg,tip,longhelp);
-       m_xmlfile.Write("                       <help>"
-               +longhelp+"</help>\n");
-       }
+    if (LookUpString(name,msg))
+        {
+        SplitHelp(msg,tip,longhelp);
+        m_xmlfile.Write("\t\t\t<help>"
+            +longhelp+"</help>\n");
+        }
 //look for extra attributes like checked and break
-wxString ptoken;
-ptoken=PeekToken();
-while ((ptoken!="MENUITEM")&(ptoken!="POPUP")&(ptoken!="END"))
-       {
-       token=GetToken();
-       if (token=="CHECKED")
-               m_xmlfile.Write("                       <checkable>1</checkable>\n");
-       else if (token=="MENUBREAK");
-               //m_xmlfile.Write("                     </break>\n");
-       else if (token=="GRAYED");
-       else
-               wxLogError("Unknown Menu Item token:"+token);
-       ptoken=PeekToken();
-       }
-m_xmlfile.Write("                      </menuitem>\n"); 
+    wxString ptoken;
+    ptoken=PeekToken();
+    while ((ptoken!="MENUITEM")&(ptoken!="POPUP")&(ptoken!="END"))
+        {
+        token=GetToken();
+        if (token=="CHECKED")
+            m_xmlfile.Write("\t\t\t<checkable>1</checkable>\n");
+        else if (token=="MENUBREAK");
+//m_xmlfile.Write("\t\t\t</break>\n");
+        else if (token=="GRAYED");
+        else
+            wxLogError("Unknown Menu Item token:"+token);
+        
+        ptoken=PeekToken();
+        }
+    m_xmlfile.Write("\t\t\t</menuitem>\n"); 
 
 }
 
 //ICON            IDR_MAINFRAME,IDC_STATIC,11,17,20,20
-void wxRC2XML::ParseIconStatic()
+void rc2xml::ParseIconStatic()
 {
-wxString token;
-wxString varname,iconname;
-iconname=GetToken();
+    wxString token;
+    wxString varname,iconname;
+    iconname=GetToken();
 //Look up icon
-wxNode *node=m_iconlist->Find(iconname);
-wxString *iconpath;
-iconpath=(wxString *)node->Data();
-wxIcon icon;
-wxBitmap bitmap;
-if (!icon.LoadFile(*iconpath,wxBITMAP_TYPE_ICO ))
-       wxLogError("Unable to load icon:"+*iconpath);
-bitmap.CopyFromIcon(icon);
-varname=GetToken();
+    varname=GetToken();
 
-int x,y,width,height;
-ReadRect(x,y,width,height);
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
 
-m_xmlfile.Write("              <staticbitmap");
-WriteBasicInfo(x,y,width,height,varname);
+    m_xmlfile.Write("\t\t<staticbitmap");
+    WriteBasicInfo(x,y,width,height,varname);
 //Save icon as a bitmap
-//Make a bitmap file name
-iconname=CleanName(iconname);
-iconname+=".bmp";
-m_xmlfile.Write("                      <bitmap>"+iconname+"</bitmap>\n");
-bitmap.SaveFile(iconname,wxBITMAP_TYPE_BMP);
-m_xmlfile.Write("              </staticbitmap>\n");
+    WriteIcon(iconname);
+    m_xmlfile.Write("\t\t</staticbitmap>\n");
 
 }
 //IDR_MAINFRAME           ICON    DISCARDABLE     "res\\mfcexample.ico"
-void wxRC2XML::ParseIcon(wxString varname)
+void rc2xml::ParseIcon(wxString varname)
 {
-wxString token,*iconfile;
-iconfile=new wxString;
-token=PeekToken();
+    wxString token,*iconfile;
+    iconfile=new wxString;
+    token=PeekToken();
 
-*iconfile=GetQuoteField();
-m_iconlist->Append(varname,iconfile);
+    *iconfile=GetQuoteField();
+    m_iconlist->Append(varname,iconfile);
+    
 
 }
 
-wxString wxRC2XML::CleanName(wxString name)
+wxString rc2xml::CleanName(wxString name)
 {
-name.MakeLower();
-name.Replace("id_","");
-name.Replace("idr_","");
-name.Replace("idb_","");
-name.Replace("idc_","");
-return name;
+    name.MakeLower();
+    name.Replace("id_","");
+    name.Replace("idr_","");
+    name.Replace("idb_","");
+    name.Replace("idc_","");
+    return name;
 }
 // And the award for most messed up control goes to...
 //    CONTROL         IDB_FACE,IDC_STATIC,"Static",SS_BITMAP,26,62,32,30
-void wxRC2XML::ParseStaticBitmap(wxString bitmapname, wxString varname)
+void rc2xml::ParseStaticBitmap(wxString bitmapname, wxString varname)
 {
-wxString token;
-//Grab SS_BITMAP
-token=GetToken();
+    wxString token;
+    //Grab SS_BITMAP
+    token=GetToken();
+
 
-//Look up bitmap
-wxNode *node=m_bitmaplist->Find(bitmapname);
-wxString *bitmappath;
-bitmappath=(wxString *)node->Data();
-wxBitmap bitmap;
-if (!bitmap.LoadFile(*bitmappath,wxBITMAP_TYPE_BMP ))
-       wxLogError("Unable to load bitmap:"+*bitmappath);
-
-int x,y,width,height;
-ReadRect(x,y,width,height);
-
-m_xmlfile.Write("              <staticbitmap");
-WriteBasicInfo(x,y,width,height,varname);
-//Make a bitmap file name
-bitmapname=CleanName(bitmapname);
-bitmapname+=".bmp";
-m_xmlfile.Write("                      <bitmap>"+bitmapname+"</bitmap>\n");
-bitmap.SaveFile(bitmapname,wxBITMAP_TYPE_BMP);
-m_xmlfile.Write("              </staticbitmap>\n");
 
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+
+    m_xmlfile.Write("\t\t<staticbitmap");
+    WriteBasicInfo(x,y,width,height,varname);
+    WriteBitmap(bitmapname);
+    m_xmlfile.Write("\t\t</staticbitmap>\n");
 
 }
 
-void wxRC2XML::ParseNormalMSControl()
+void rc2xml::ParseNormalMSControl()
 {
 wxString label,varname,kindctrl;
 
@@ -964,109 +1000,231 @@ varname=GetToken();
 kindctrl=GetQuoteField();
 kindctrl.MakeUpper();
 
-if (kindctrl=="MSCTLS_UPDOWN32")
-   ParseSpinCtrl(label,varname);
-if (kindctrl=="MSCTLS_TRACKBAR32")
-   ParseSlider(label,varname);
-if (kindctrl=="MSCTLS_PROGRESS32")
-   ParseProgressBar(label,varname);
-if (kindctrl=="SYSTREEVIEW32")
-   ParseTreeCtrl(label,varname);
-if (kindctrl=="SYSMONTHCAL32")
-   ParseCalendar(label,varname);
-if (kindctrl=="SYSLISTVIEW32")
-   ParseListCtrl(label,varname);
-if (kindctrl=="BUTTON")
-   ParseCtrlButton(label,varname);
-if (kindctrl=="RICHEDIT")
-       ParseRichEdit(label,varname);
+    if (kindctrl=="MSCTLS_UPDOWN32")
+        ParseSpinCtrl(label,varname);
+    if (kindctrl=="MSCTLS_TRACKBAR32")
+        ParseSlider(label,varname);
+    if (kindctrl=="MSCTLS_PROGRESS32")
+        ParseProgressBar(label,varname);
+    if (kindctrl=="SYSTREEVIEW32")
+        ParseTreeCtrl(label,varname);
+    if (kindctrl=="SYSMONTHCAL32")
+        ParseCalendar(label,varname);
+    if (kindctrl=="SYSLISTVIEW32")
+        ParseListCtrl(label,varname);
+    if (kindctrl=="BUTTON")
+        ParseCtrlButton(label,varname);
+    if (kindctrl=="RICHEDIT")
+        ParseRichEdit(label,varname);
 
 }
 
-void wxRC2XML::ParseWeirdMSControl()
+void rc2xml::ParseWeirdMSControl()
 {
-wxString kindctrl;
-wxString varname;
-wxString id;
-id=GetToken();
-varname=GetToken();
-kindctrl=GetQuoteField();
-kindctrl.MakeUpper();
+    wxString kindctrl;
+    wxString varname;
+    wxString id;
+    id=GetToken();
+    varname=GetToken();
+    kindctrl=GetQuoteField();
+    kindctrl.MakeUpper();
 //    CONTROL         IDB_FACE,IDC_STATIC,"Static",SS_BITMAP,26,62,32,30
-if (kindctrl=="STATIC")
-       {
-       if (PeekToken()=="SS_BITMAP")
-               ParseStaticBitmap(id,varname);
-       else
-               wxLogError("Unknown MS Control Static token");
-       }
+    if (kindctrl=="STATIC")
+        {
+        if (PeekToken()=="SS_BITMAP")
+            ParseStaticBitmap(id,varname);
+        else
+            wxLogError("Unknown MS Control Static token");
+        }
 
 }
 //SCROLLBAR       IDC_SCROLLBAR1,219,56,10,40,SBS_VERT
 
-void wxRC2XML::ParseScrollBar()
+void rc2xml::ParseScrollBar()
 {
-wxString token;
-wxString varname;
-
-varname=GetToken();
-int x,y,width,height;
-ReadRect(x,y,width,height);
-wxString style;
+    wxString token;
+    wxString varname;
+
+    varname=GetToken();
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+    wxString style;
+
+    ReadOrs(token);
+    
+if (token.Find("SBS_VERT")!=-1)
+    style=_T("wxSB_VERTICAL");
 //Default MFC style is horizontal
-style=_T("wxSB_HORIZONTAL");
-/*
-while (ReadOrs(token))
-{
-if (token=="SBS_VERT")
-       style=_T("wxSB_VERTICAL");
-}
-*/
-m_xmlfile.Write("              <scrollbar");
-WriteBasicInfo(x,y,width,height,varname);
-WriteStyle(style);
-m_xmlfile.Write("\n            </scrollbar>\n");
+    else
+        style=_T("wxSB_HORIZONTAL");
 
+    m_xmlfile.Write("\t\t<scrollbar");
+    WriteBasicInfo(x,y,width,height,varname);
+    WriteStyle(style);
+    m_xmlfile.Write("\n\t\t</scrollbar>\n");
 
 }
 //    CONTROL         "Tree1",IDC_TREE1,"SysTreeView32",WS_BORDER | WS_TABSTOP,
 //                      7,7,66,61
 
-void wxRC2XML::ParseTreeCtrl(wxString label, wxString varname)
+void rc2xml::ParseTreeCtrl(wxString label, wxString varname)
 {
-wxString token;
-while (ReadOrs(token));
-int x,y,width,height;
-ReadRect(x,y,width,height);
-m_xmlfile.Write("              <treectrl");
-WriteBasicInfo(x,y,width,height,varname);
-m_xmlfile.Write("              </treectrl>\n");
+    wxString token;
+//while (ReadOrs(token));
+    ReadOrs(token);
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+    m_xmlfile.Write("\t\t<treectrl");
+    WriteBasicInfo(x,y,width,height,varname);
+    m_xmlfile.Write("\t\t</treectrl>\n");
 
 }
 //    CONTROL         "MonthCalendar1",IDC_MONTHCALENDAR1,"SysMonthCal32",
                     //MCS_NOTODAY | WS_TABSTOP,105,71,129,89
 
-void wxRC2XML::ParseCalendar(wxString label, wxString varname)
+void rc2xml::ParseCalendar(wxString label, wxString varname)
 {
-wxString token;
-while (ReadOrs(token));
-int x,y,width,height;
-ReadRect(x,y,width,height);
-m_xmlfile.Write("              <calendarctrl");
-WriteBasicInfo(x,y,width,height,varname);
-m_xmlfile.Write("              </calendarctrl>\n");
+    wxString token;
+//while (ReadOrs(token));
+    ReadOrs(token);
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+    m_xmlfile.Write("\t\t<calendarctrl");
+    WriteBasicInfo(x,y,width,height,varname);
+    m_xmlfile.Write("\t\t</calendarctrl>\n");
 }
 //    CONTROL         "List1",IDC_LIST1,"SysListView32",WS_BORDER | WS_TABSTOP,
   //                  7,89,68,71
 
-void wxRC2XML::ParseListCtrl(wxString label, wxString varname)
+void rc2xml::ParseListCtrl(wxString label, wxString varname)
 {
-wxString token;
-while (ReadOrs(token));
-int x,y,width,height;
-ReadRect(x,y,width,height);
-m_xmlfile.Write("              <listctrl");
-WriteBasicInfo(x,y,width,height,varname);
-m_xmlfile.Write("              </listctrl>\n");
+    wxString token;
+    //while (ReadOrs(token));
+    ReadOrs(token);
+    int x,y,width,height;
+    ReadRect(x,y,width,height);
+    m_xmlfile.Write("\t\t<listctrl");
+    WriteBasicInfo(x,y,width,height,varname);
+    m_xmlfile.Write("\t\t</listctrl>\n");
 
 }
+
+void rc2xml::WriteBitmap(wxString bitmapname)
+{
+//Look up bitmap
+    wxNode *node=m_bitmaplist->Find(LookUpId(bitmapname));
+    if (node==NULL)
+        {
+        m_xmlfile.Write("\t\t\t<bitmap>missingfile</bitmap>\n");
+        wxLogError("Unable to find bitmap:"+bitmapname);
+        return;
+        }
+    
+    wxString *bitmappath;
+    bitmappath=(wxString *)node->Data();
+    wxBitmap bitmap;
+    if (!bitmap.LoadFile(*bitmappath,wxBITMAP_TYPE_BMP ))
+        wxLogError("Unable to load bitmap:"+*bitmappath);
+
+    //Make a bitmap file name
+    bitmapname=CleanName(bitmapname);
+    bitmapname+=".bmp";
+    m_xmlfile.Write("\t\t\t<bitmap>"+bitmapname+"</bitmap>\n");
+    bitmap.SaveFile(bitmapname,wxBITMAP_TYPE_BMP);
+}
+
+void rc2xml::WriteIcon(wxString iconname)
+{
+wxNode *node=m_iconlist->Find(iconname);
+    if (node==NULL)
+        {
+        m_xmlfile.Write("\t\t\t<bitmap>missing_file</bitmap>\n");
+        wxLogError("Unable to find icon:"+iconname);
+        }
+    wxString *iconpath;
+    iconpath=(wxString *)node->Data();
+    wxIcon icon;
+    wxBitmap bitmap;
+    if (!icon.LoadFile(*iconpath,wxBITMAP_TYPE_ICO ))
+        wxLogError("Unable to load icon:"+*iconpath);
+#ifdef __WXMSW__
+    bitmap.CopyFromIcon(icon);
+#else
+    bitmap = icon;
+#endif
+
+    //Make a bitmap file name
+    iconname=CleanName(iconname);
+    iconname+=".bmp";
+    m_xmlfile.Write("\t\t\t<bitmap>"+iconname+"</bitmap>\n");
+    bitmap.SaveFile(iconname,wxBITMAP_TYPE_BMP);
+
+    
+}
+/*Unfortunately sometimes the great MSVC Resource editor decides
+to use numbers instead of the word id.  I have no idea why they
+do this, but that is the way it is.
+*/
+/* this is a quick and dirty way to parse the resource.h file
+it will not recognize #ifdef so it can be easily fooled
+*/
+void rc2xml::ParseResourceHeader()
+{
+wxTextFile r;
+//Attempt to load resource.h in current path
+    if (!r.Open("resource.h"))
+        {
+        wxLogError("Warining Unable to load resource.h file");
+        return;
+        }
+    
+    wxString str;
+    wxString id,v;
+    wxStringTokenizer tok;
+    wxString *varname;
+    
+    
+    long n;
+
+//Read through entire file
+    for ( str = r.GetFirstLine(); !r.Eof(); str = r.GetNextLine() )
+    {
+    if (str.Find("#define")!=-1)
+        {
+        tok.SetString(str);
+        //Just ignore #define token
+        tok.GetNextToken();
+        v=tok.GetNextToken();
+        id=tok.GetNextToken();
+        if (id.IsNumber())
+            {
+            varname=new wxString;
+            id.ToLong(&n);
+            *varname=v;
+            m_resourcelist->Append(n,varname);
+            }
+        }
+    }
+
+  
+    
+}
+
+
+wxString rc2xml::LookUpId(wxString id)
+{
+wxString st;
+
+if (!id.IsNumber())
+    return id;
+long n;
+id.ToLong(&n);
+wxNode *node=m_resourcelist->Find(n);
+    wxString *s;
+    if (node==NULL)
+        return id;
+
+    s=(wxString *)node->Data();
+    st=*s;
+return st;
+}
index 697efea0854a656e4cdad57b6c571a18f1ac1aa0..6b2fbf85559eb791a8d0b39c5f7e6e83b08f2007 100644 (file)
 #include <wx/list.h>
 
 
-class wxRC2XML : public wxObject  
+class rc2xml : public wxObject  
 {
 public:
-       void ParseNormalMSControl();
-bool Convert(wxString rcfile, wxString xmlfile);
-wxRC2XML();
-~wxRC2XML();
+    void WriteIcon(wxString iconname);
+    void ParseNormalMSControl();
+    bool Convert(wxString rcfile, wxString xmlfile);
+    rc2xml();
+    ~rc2xml();
 
 protected:
-       void ParseListCtrl(wxString label,wxString varname);
-       void ParseCalendar(wxString label,wxString varname);
-       void ParseTreeCtrl(wxString label,wxString varname);
-       void ParseScrollBar();
-       void ParseWeirdMSControl();
-       void ParseStaticBitmap(wxString label,wxString varname);
-       wxString CleanName(wxString name);
-       void ParseIcon(wxString varname);
-       wxList * m_iconlist;
-       void ParseIconStatic();
-       void ParseMenuItem();
+       wxString LookUpId(wxString id);
+       
+    void ParseResourceHeader();
+    void WriteBitmap(wxString bitmapname);
+    void ParseListCtrl(wxString label,wxString varname);
+    void ParseCalendar(wxString label,wxString varname);
+    void ParseTreeCtrl(wxString label,wxString varname);
+    void ParseScrollBar();
+    void ParseWeirdMSControl();
+    void ParseStaticBitmap(wxString label,wxString varname);
+    wxString CleanName(wxString name);
+    void ParseIcon(wxString varname);
+    wxList * m_iconlist;
+    void ParseIconStatic();
+    void ParseMenuItem();
        
 //Functions
-bool SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp);
-bool LookUpString(wxString strid,wxString & st);
-void ParseStringTable(wxString varname);
-void WriteToolButton(wxString name,int index,int width,int height,wxBitmap bitmap);
-wxString LookupString(wxString varname,wxStringList id,wxStringList msg);
-void ParseToolBar(wxString varname);
-void SecondPass();
-void FirstPass();
-void ParseBitmap(wxString varname);
-void ParseSpinCtrl(wxString label,wxString varname);
-void ParseRichEdit(wxString label, wxString varname);
-void ParseDialog(wxString dlgname);
-void ParseControls();
-void ParseListBox();
-void ParseStaticText();
-void ParseTextCtrl();
-void ParsePushButton();
-bool Seperator(int ch);
-void ParseGroupBox();
-void ReadRect(int & x, int & y, int & width, int & height);
-wxString GetToken();
-wxString GetQuoteField();
-void ReadChar(int &ch);
-void ParseComboBox();
-void ParseMenu(wxString varname);
-void ParsePopupMenu();
-wxString PeekToken();
-void ParseControlMS();
-void ParseSlider(wxString label, wxString varname);
-void ParseProgressBar(wxString label, wxString varname);
-bool ReadOrs(wxString & w);
-void ParseCtrlButton(wxString label, wxString varname);
-void WriteStyle(wxString style);
-void WriteBasicInfo(int x,int y,int width,int height,wxString name);
-void WriteName(wxString name);
-void WriteTitle(wxString title);
-void WritePosition(int x,int y);
-void WriteSize(int width,int height);
-void WriteLabel(wxString label);
+    bool SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp);
+    bool LookUpString(wxString strid,wxString & st);
+    void ParseStringTable(wxString varname);
+    void WriteToolButton(wxString name,int index,int width,int height,wxBitmap bitmap);
+    wxString LookupString(wxString varname,wxStringList id,wxStringList msg);
+    void ParseToolBar(wxString varname);
+    void SecondPass();
+    void FirstPass();
+    void ParseBitmap(wxString varname);
+    void ParseSpinCtrl(wxString label,wxString varname);
+    void ParseRichEdit(wxString label, wxString varname);
+    void ParseDialog(wxString dlgname);
+    void ParseControls();
+    void ParseListBox();
+    void ParseStaticText();
+    void ParseTextCtrl();
+    void ParsePushButton();
+    bool Seperator(int ch);
+    void ParseGroupBox();
+    void ReadRect(int & x, int & y, int & width, int & height);
+    wxString GetToken();
+    wxString GetQuoteField();
+    void ReadChar(int &ch);
+    void ParseComboBox();
+    void ParseMenu(wxString varname);
+    void ParsePopupMenu();
+    wxString PeekToken();
+    void ParseControlMS();
+    void ParseSlider(wxString label, wxString varname);
+    void ParseProgressBar(wxString label, wxString varname);
+    bool ReadOrs(wxString & w);
+    void ParseCtrlButton(wxString label, wxString varname);
+    void WriteStyle(wxString style);
+    void WriteBasicInfo(int x,int y,int width,int height,wxString name);
+    void WriteName(wxString name);
+    void WriteTitle(wxString title);
+    void WritePosition(int x,int y);
+    void WriteSize(int width,int height);
+    void WriteLabel(wxString label);
 //variables
-wxList * m_stringtable;
-wxList *m_bitmaplist;
-wxFile m_rc;
-wxFFile m_xmlfile;
-int m_filesize;
-bool m_done;
+    wxList * m_stringtable;
+    wxList *m_bitmaplist;
+    wxList * m_resourcelist;
+    wxFile m_rc;
+    wxFFile m_xmlfile;
+    int m_filesize;
+    bool m_done;
 
 };
 
diff --git a/contrib/utils/convertrc/wxconvert.rc b/contrib/utils/convertrc/wxconvert.rc
new file mode 100644 (file)
index 0000000..b86c4e2
--- /dev/null
@@ -0,0 +1 @@
+#include "wx/msw/wx.rc"
index a6e9d0d9735917304b679ddab9ceb846da2865a3..6aa5ad54f70e106656441ccfcbc6cbd23de7ec71 100644 (file)
@@ -1,11 +1,15 @@
-// wxr2xml.cpp: implementation of the wxWxr2Xml class.
-//  8/30/00  Brian Gavin
+// wxr2xml.cpp: implementation of the wxr2xml class.
+// 8/30/00  Brian Gavin
 // only tested on wxMSW so far
-//////////////////////////////////////////////////////////////////////
-/* TODO
-  port to wxGTK should be very easy
-  support fonts
-  add unsupported controls when XML format adds them
+//License: wxWindows Liscense
+// ////////////////////////////////////////////////////////////////////
+
+/*
+How to use class:
+#include "wxr2xml.h"
+...
+wxr2xml trans;
+trans->Convert("Myfile.wxr","Myfile.xml");
 */
 #ifdef __GNUG__
 #pragma implementation "wxr2xml.h"
 
 #include "wxr2xml.h"
 
-
-//////////////////////////////////////////////////////////////////////
+// ////////////////////////////////////////////////////////////////////
 // Construction/Destruction
-//////////////////////////////////////////////////////////////////////
+// ////////////////////////////////////////////////////////////////////
 
-wxWxr2Xml::wxWxr2Xml()
+wxr2xml::wxr2xml()
 {
 
 }
 
-wxWxr2Xml::~wxWxr2Xml()
+wxr2xml::~wxr2xml()
 {
 
 }
 
-bool wxWxr2Xml::Convert(wxString wxrfile, wxString xmlfile)
+bool wxr2xml::Convert(wxString wxrfile, wxString xmlfile)
 {
-bool result;
-result=m_xmlfile.Open(xmlfile.c_str(),"w+t");
-wxASSERT_MSG(result,"Couldn't create XML file");       
-if (!result)
-       return FALSE;
+    bool result;
+    result = m_xmlfile.Open(xmlfile.c_str(), "w+t");
+    wxASSERT_MSG(result, "Couldn't create XML file");
+    if (!result)
+        return FALSE;
 
-result=m_table.ParseResourceFile(wxrfile);
-wxASSERT_MSG(result,"Couldn't Load WXR file");
-if (!result)
-       return FALSE;
-//Write basic xml header
-m_xmlfile.Write("<?xml version=\"1.0\" ?>\n");
-m_xmlfile.Write("<resource>\n");
-result=ParseResources();
-m_xmlfile.Write("</resource>\n");
+    result = m_table.ParseResourceFile(wxrfile);
+    wxASSERT_MSG(result, "Couldn't Load WXR file");
+    if (!result)
+        return FALSE;
+    // Write basic xml header
+    m_xmlfile.Write("<?xml version=\"1.0\" ?>\n");
+    m_xmlfile.Write("<resource>\n");
+    result = ParseResources();
+    m_xmlfile.Write("</resource>\n");
 
-m_xmlfile.Close();
+    m_xmlfile.Close();
 
-return result;
+    return result;
 }
 
-bool wxWxr2Xml::ParseResources()
+bool wxr2xml::ParseResources()
 {
-m_table.BeginFind();
-wxNode *node;
-       
-while ((node = m_table.Next()))
-    {
-        wxItemResource *res = (wxItemResource *)node->Data();
+    m_table.BeginFind();
+    wxNode *node;
+
+    while ((node = m_table.Next())) 
+        {
+        wxItemResource *res = (wxItemResource *) node->Data();
         wxString resType(res->GetType());
-               if (resType=="wxDialog")
-                       ParseDialog(res);
-        else if (resType=="wxPanel")
-                       ParsePanel(res);
-       else if (resType=="wxPanel")
-                       ParsePanel(res);
-          else if (resType=="wxMenu")
-                       ParseMenuBar(res);
-          else if (resType=="wxBitmap")
-                       ParseBitmap(res);
-        else 
-                  wxLogError("Found unsupported resource "+resType);
+        if (resType == "wxDialog")
+            ParseDialog(res);
+        else if (resType == "wxPanel")
+            ParsePanel(res);
+        else if (resType == "wxPanel")
+            ParsePanel(res);
+        else if (resType == "wxMenu")
+            ParseMenuBar(res);
+        else if (resType == "wxBitmap")
+            ParseBitmap(res);
+        else
+            wxLogError("Found unsupported resource " + resType);
     }
-
-return TRUE;
+    return TRUE;
 }
 
-void wxWxr2Xml::ParsePanel(wxItemResource *res)
+void wxr2xml::ParsePanel(wxItemResource * res)
 {
-
-m_xmlfile.Write("      <panel");
-PanelStuff(res);
-WriteControlInfo(res);
-m_xmlfile.Write("\n"); 
-m_xmlfile.Write("      <children>\n");
-ParseControls(res);
-m_xmlfile.Write("      </children>\n");
-
-m_xmlfile.Write("      </panel>\n");
+    m_xmlfile.Write("\t<panel");
+    PanelStuff(res);
+    WriteControlInfo(res);
+    m_xmlfile.Write("\n");
+    m_xmlfile.Write("\t\t<children>\n");
+    ParseControls(res);
+    m_xmlfile.Write(" \t\t</children>\n");
+    m_xmlfile.Write("\t</panel>\n\n");
 }
 
-
-void wxWxr2Xml::ParseDialog(wxItemResource *res)
+void wxr2xml::ParseDialog(wxItemResource * res)
 {
-PanelStuff(res);
-m_xmlfile.Write("      <dialog");
-WriteControlInfo(res);
-m_xmlfile.Write(GetTitle(res));
+    PanelStuff(res);
+    m_xmlfile.Write("\t<dialog");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetTitle(res));
 
-    
-m_xmlfile.Write("\n"); 
-m_xmlfile.Write("      <children>\n");
-ParseControls(res);
-m_xmlfile.Write("      </children>\n");
-m_xmlfile.Write("      </dialog>\n");
+    m_xmlfile.Write("\n");
+    m_xmlfile.Write("\t\t<children>\n");
+    ParseControls(res);
+    m_xmlfile.Write("\t\t</children>\n");
+    m_xmlfile.Write("\t</dialog>\n\n");
 }
 
-void wxWxr2Xml::ParseControls(wxItemResource *res)
+void wxr2xml::ParseControls(wxItemResource * res)
 {
-wxNode *node = res->GetChildren().First();
-while (node)
+    wxNode *node = res->GetChildren().First();
+    while (node) 
         {
-           wxItemResource *res = (wxItemResource *)node->Data();
-           wxString resType(res->GetType());
-               if (resType=="wxButton")
-                       ParseButton(res);
-               else if ((resType=="wxTextCtrl")|(resType=="wxText")
-                       |(resType=="wxMultiText"))
-                       ParseTextCtrl(res);
-               else if (resType=="wxCheckBox")
-                       ParseCheckBox(res);
-               else if (resType=="wxRadioBox")
-                       ParseRadioBox(res);
-               else if (resType=="wxListBox")
-                       ParseListBox(res);
-               else if ((resType=="wxStaticText")|(resType=="wxMessage"))
-                       ParseStaticText(res);
-               else if (resType=="wxChoice")
-                       ParseChoice(res);
-               else if (resType=="wxGauge")
-                       ParseGauge(res);
-               else if (resType=="wxSlider")
-                       ParseSlider(res);
-               else if (resType=="wxComboBox")
-                       ParseComboBox(res);
-               else if (resType=="wxRadioButton")
-                       ParseRadioButton(res);
-               else if (resType=="wxStaticBitmap")
-                       ParseStaticBitmap(res);
-               else if (resType=="wxScrollBar")
-                       wxLogError("wxScrollBar unsupported");
-               else if ((resType=="wxStaticBox")|(resType=="wxGroupBox"))
-                       wxLogError("wxStaticBox unsupported");
-               else if (resType=="wxBitmapButton")
-                       wxLogError("wxBitmapButton unsupported");
-               else
-                       wxLogError("Found unsupported resource "+resType);
-            node = node->Next();
+        wxItemResource *res = (wxItemResource *) node->Data();
+        wxString resType(res->GetType());
+        if (resType == "wxButton")
+            ParseButton(res);
+        else if ((resType == "wxTextCtrl") | (resType == "wxText")
+         | (resType == "wxMultiText"))
+            ParseTextCtrl(res);
+        else if (resType == "wxCheckBox")
+            ParseCheckBox(res);
+        else if (resType == "wxRadioBox")
+            ParseRadioBox(res);
+        else if (resType == "wxListBox")
+            ParseListBox(res);
+        else if ((resType == "wxStaticText") | (resType == "wxMessage"))
+            ParseStaticText(res);
+        else if (resType == "wxChoice")
+            ParseChoice(res);
+        else if (resType == "wxGauge")
+           ParseGauge(res);
+        else if (resType == "wxSlider")
+            ParseSlider(res);
+        else if (resType == "wxComboBox")
+            ParseComboBox(res);
+        else if (resType == "wxRadioButton")
+            ParseRadioButton(res);
+        else if (resType == "wxStaticBitmap")
+            ParseStaticBitmap(res);
+        else if (resType == "wxScrollBar")
+            ParseScrollBar(res);
+        else if ((resType == "wxStaticBox") | (resType == "wxGroupBox"))
+            ParseStaticBox(res);
+        else if (resType == "wxBitmapButton")
+            ParseBitmapButton(res);
+        else
+            wxLogError("Found unsupported resource " + resType);
+        node = node->Next();
         }
 }
 
-//Write out basic stuff every control has
+// Write out basic stuff every control has
 // name,position,size,bg,fg
-void wxWxr2Xml::WriteControlInfo(wxItemResource *res)
+void wxr2xml::WriteControlInfo(wxItemResource * res)
 {
-m_xmlfile.Write(GenerateName(res));
-m_xmlfile.Write(">\n");
-m_xmlfile.Write(GetPosition(res));
-m_xmlfile.Write(GetSize(res));
-m_xmlfile.Write(GetStyles(res));
+    m_xmlfile.Write(GenerateName(res));
+    m_xmlfile.Write(">\n");
+    m_xmlfile.Write(GetPosition(res));
+    m_xmlfile.Write(GetSize(res));
+    m_xmlfile.Write(GetStyles(res));
+    WriteFontInfo(res);
 }
 
-wxString wxWxr2Xml::GetSize(wxItemResource *res)
+wxString wxr2xml::GetSize(wxItemResource * res)
 {
-wxString msg;
-if (m_dlgunits)
-       msg<<" <size>"<<res->GetWidth()<<","<<res->GetHeight()<<"d</size>";
-else
-       msg<<" <size>"<<res->GetWidth()<<","<<res->GetHeight()<<"</size>";
-return msg;
+    wxString msg;
+    if (m_dlgunits)
+        msg << "\t\t\t\t<size>" << res->GetWidth() << "," << res->GetHeight() << "d</size>\n";
+    else
+        msg << "\t\t\t\t<size>" << res->GetWidth() << "," << res->GetHeight() << "</size>\n";
+    return msg;
 }
 
-wxString wxWxr2Xml::GetPosition(wxItemResource *res)
+wxString wxr2xml::GetPosition(wxItemResource * res)
 {
-wxString msg;
-if (m_dlgunits)
-       msg<<" <pos>"<<res->GetX()<<","<<res->GetY()<<"d</pos>";
-else
-       msg<<" <pos>"<<res->GetX()<<","<<res->GetY()<<"</pos>";
-return msg;
+    wxString msg;
+    if (m_dlgunits)
+        msg << "\t\t\t\t<pos>" << res->GetX() << "," << res->GetY() << "d</pos>\n";
+    else
+        msg << "\t\t\t\t<pos>" << res->GetX() << "," << res->GetY() << "</pos>\n";
+    return msg;
 }
 
-void wxWxr2Xml::ParseButton(wxItemResource *res)
+void wxr2xml::ParseButton(wxItemResource * res)
 {
-m_xmlfile.Write("              <button");
-WriteControlInfo(res);
-m_xmlfile.Write(GetLabel(res));
-m_xmlfile.Write("</button>\n");
+    m_xmlfile.Write("\t\t\t<button");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetLabel(res));
+    m_xmlfile.Write("\t\t\t</button>\n");
 }
 
-void wxWxr2Xml::ParseTextCtrl(wxItemResource *res)
+void wxr2xml::ParseTextCtrl(wxItemResource * res)
 {
-m_xmlfile.Write("              <textctrl");
-WriteControlInfo(res);
-m_xmlfile.Write(GetValue4(res));
-m_xmlfile.Write("</textctrl>\n");
+    m_xmlfile.Write("\t\t\t<textctrl");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetValue4(res));
+    m_xmlfile.Write("\t\t\t</textctrl>\n");
 
 }
 
-wxString wxWxr2Xml::GetTitle(wxItemResource *res)
+wxString wxr2xml::GetTitle(wxItemResource * res)
 {
-wxString msg;
-msg=_T(" <title>"+res->GetTitle()+"</title>");
-return msg;
+    wxString msg;
+    msg = _T("\t\t\t\t<title>" + res->GetTitle() + "</title>");
+    return msg;
 }
 
-wxString wxWxr2Xml::GetValue4(wxItemResource *res)
+wxString wxr2xml::GetValue4(wxItemResource * res)
 {
-wxString msg;
-msg=_T(" <value>"+res->GetValue4()+"</value>");
-return msg;
+    wxString msg;
+    msg = _T("\t\t\t\t<value>" + res->GetValue4() + "</value>\n");
+    return msg;
 }
 
-void wxWxr2Xml::ParseCheckBox(wxItemResource *res)
+void wxr2xml::ParseCheckBox(wxItemResource * res)
 {
-m_xmlfile.Write("              <checkbox");
-WriteControlInfo(res);
-m_xmlfile.Write(GetLabel(res));
-m_xmlfile.Write(GetCheckStatus(res));
-m_xmlfile.Write("</checkbox>\n");
+    m_xmlfile.Write("\t\t\t<checkbox");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetLabel(res));
+    m_xmlfile.Write(GetCheckStatus(res));
+    m_xmlfile.Write("\t\t\t</checkbox>\n");
 }
 
-wxString wxWxr2Xml::GetLabel(wxItemResource *res)
+wxString wxr2xml::GetLabel(wxItemResource * res)
 {
-return _T(" <label>"+res->GetTitle()+"</label>");
+    return _T("\t\t\t\t<label>" + res->GetTitle() + "</label>\n");
 }
 
-void wxWxr2Xml::ParseRadioBox(wxItemResource *res)
+void wxr2xml::ParseRadioBox(wxItemResource * res)
 {
-m_xmlfile.Write("              <radiobox");
-WriteControlInfo(res);
-m_xmlfile.Write(GetLabel(res));
-//Add radio box items
-WriteStringList(res);
-//Value1
-m_xmlfile.Write(GetDimension(res));
-m_xmlfile.Write("\n                    </radiobox>\n");
+    m_xmlfile.Write("\t\t\t<radiobox");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetLabel(res));
+    // Add radio box items
+    WriteStringList(res);
+    // Value1
+    m_xmlfile.Write(GetDimension(res));
+    m_xmlfile.Write("\t\t\t</radiobox>\n");
 }
 
-void wxWxr2Xml::ParseListBox(wxItemResource *res)
+void wxr2xml::ParseListBox(wxItemResource * res)
 {
-m_xmlfile.Write("              <listbox");
-WriteControlInfo(res);
-WriteStringList(res);
-m_xmlfile.Write("</listbox>\n");
+    m_xmlfile.Write("\t\t\t<listbox");
+    WriteControlInfo(res);
+    WriteStringList(res);
+    m_xmlfile.Write("\t\t\t</listbox>\n");
 }
 
-void wxWxr2Xml::ParseStaticText(wxItemResource *res)
+void wxr2xml::ParseStaticText(wxItemResource * res)
 {
-m_xmlfile.Write("              <statictext");
-WriteControlInfo(res);
-m_xmlfile.Write(GetLabel(res));
-m_xmlfile.Write("</statictext>\n");
+    m_xmlfile.Write("\t\t\t<statictext");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetLabel(res));
+    m_xmlfile.Write("\t\t\t</statictext>\n");
 }
 
-void wxWxr2Xml::ParseStaticBox(wxItemResource *res)
+void wxr2xml::ParseStaticBox(wxItemResource * res)
 {
-m_xmlfile.Write("              <staticbox");
-WriteControlInfo(res);
-m_xmlfile.Write(GetLabel(res));
-m_xmlfile.Write("</staticbox>\n");
+    m_xmlfile.Write("\t\t\t<staticbox");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetLabel(res));
+    m_xmlfile.Write("\t\t\t</staticbox>\n");
 }
 
-void wxWxr2Xml::WriteStringList(wxItemResource *res)
+void wxr2xml::WriteStringList(wxItemResource * res)
 {
-m_xmlfile.Write("\n                    <content>");
-for ( wxStringListNode *node = res->GetStringValues().GetFirst(); node; 
-       node = node->GetNext() )
-    {
+    m_xmlfile.Write("\t\t\t\t<content>\n");
+    for (wxStringListNode * node = res->GetStringValues().GetFirst();
+        node;node = node->GetNext()) {
         const wxString s1 = node->GetData();
-        m_xmlfile.Write("\n                    <item>"+s1+"</item>");
+        m_xmlfile.Write("\t\t\t\t\t<item>" + s1 + "</item>\n");
     }
-       m_xmlfile.Write("\n                     </content>");
+    m_xmlfile.Write("\t\t\t\t</content>\n");
 }
 
-void wxWxr2Xml::ParseChoice(wxItemResource *res)
+void wxr2xml::ParseChoice(wxItemResource * res)
 {
-m_xmlfile.Write("              <choice");
-WriteControlInfo(res);
-//Add choice items
-WriteStringList(res);
-m_xmlfile.Write("\n            </choice>\n");
+    m_xmlfile.Write("\t\t\t<choice");
+    WriteControlInfo(res);
+    // Add choice items
+    WriteStringList(res);
+    m_xmlfile.Write("\t\t\t</choice>\n");
 }
 
-void wxWxr2Xml::ParseGauge(wxItemResource *res)
+void wxr2xml::ParseGauge(wxItemResource * res)
 {
-m_xmlfile.Write("              <gauge");
-WriteControlInfo(res);
-m_xmlfile.Write(GetValue1(res));
-m_xmlfile.Write(GetRange(res));
-m_xmlfile.Write("\n                    </gauge>\n");
+    m_xmlfile.Write("\t\t\t<gauge");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetValue1(res));
+    m_xmlfile.Write(GetRange(res));
+    m_xmlfile.Write("\n\t\t\t</gauge>\n");
 }
 
-
-wxString wxWxr2Xml::GetValue1(wxItemResource *res)
+wxString wxr2xml::GetValue1(wxItemResource * res)
 {
-wxString msg;
-msg<<" <value>"<<res->GetValue1()<<"</value>";
-return msg;
+    wxString msg;
+    msg << "\t\t\t\t<value>" << res->GetValue1() << "</value>\n";
+    return msg;
 }
 
-wxString wxWxr2Xml::GetRange(wxItemResource *res)
+wxString wxr2xml::GetRange(wxItemResource * res)
 {
-wxString msg;
-msg<<" <range>"<<res->GetValue2()<<"</range>";
-return msg;
+    wxString msg;
+    msg << "\t\t\t\t<range>" << res->GetValue2() << "</range>";
+    return msg;
 }
 
-void wxWxr2Xml::ParseSlider(wxItemResource *res)
+void wxr2xml::ParseSlider(wxItemResource * res)
 {
-m_xmlfile.Write("              <slider");
-WriteControlInfo(res);
-m_xmlfile.Write(GetValue1(res));
-m_xmlfile.Write(GetMax(res));
-m_xmlfile.Write(GetMin(res));
-m_xmlfile.Write("\n                    </slider>\n");
+    m_xmlfile.Write("\t\t\t<slider");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetValue1(res));
+    m_xmlfile.Write(GetMax(res));
+    m_xmlfile.Write(GetMin(res));
+    m_xmlfile.Write("\n\t\t\t</slider>\n");
 }
 
-wxString wxWxr2Xml::GetMax(wxItemResource *res)
+wxString wxr2xml::GetMax(wxItemResource * res)
 {
-wxString msg;
-msg<<" <max>"<<res->GetValue3()<<"</max>";
-return msg;
+    wxString msg;
+    msg << "\t\t\t\t<max>" << res->GetValue3() << "</max>\n";
+    return msg;
 }
 
-wxString wxWxr2Xml::GetMin(wxItemResource *res)
+wxString wxr2xml::GetMin(wxItemResource * res)
 {
-wxString msg;
-msg<<" <min>"<<res->GetValue2()<<"</min>";
-return msg;
+    wxString msg;
+    msg << "\t\t\t\t<min>" << res->GetValue2() << "</min>";
+    return msg;
 }
 
-void wxWxr2Xml::ParseComboBox(wxItemResource *res)
+void wxr2xml::ParseComboBox(wxItemResource * res)
 {
-m_xmlfile.Write("              <combobox");
-WriteControlInfo(res);
-//Add combo items
-WriteStringList(res);
-m_xmlfile.Write("\n            </combobox>\n");
+    m_xmlfile.Write("\t\t\t<combobox");
+    WriteControlInfo(res);
+    // Add combo items
+    WriteStringList(res);
+    m_xmlfile.Write("\n\t\t\t</combobox>\n");
 }
 
-void wxWxr2Xml::ParseRadioButton(wxItemResource *res)
+void wxr2xml::ParseRadioButton(wxItemResource * res)
 {
-m_xmlfile.Write("              <radiobutton");
-WriteControlInfo(res);
-m_xmlfile.Write(GetLabel(res));
+    m_xmlfile.Write("\t\t\t<radiobutton");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetLabel(res));
+
+    wxString msg;
+    m_xmlfile.Write(GetValue1(res));
+    m_xmlfile.Write(GetCheckStatus(res));
+    m_xmlfile.Write("\t\t\t</radiobutton>\n");
+}
 
-wxString msg;
-m_xmlfile.Write(GetValue1(res));
-m_xmlfile.Write(GetCheckStatus(res));
-m_xmlfile.Write("\n                    </radiobutton>\n");
+void wxr2xml::ParseScrollBar(wxItemResource * res)
+{
+    m_xmlfile.Write("\t\t\t<scrollbar");
+    WriteControlInfo(res);
+    m_xmlfile.Write(GetValue1(res));
+    m_xmlfile.Write("\t\t\t\t<thumbsize>"+GetValue2(res)+"</thumbsize>\n");
+    m_xmlfile.Write("\t\t\t\t<range>"+GetValue3(res)+"</range>\n");
+    m_xmlfile.Write("\t\t\t\t<pagesize>"+GetValue5(res)+"</pagesize>\n");
+    m_xmlfile.Write("\t\t\t</scrollbar>\n");
 }
 
-void wxWxr2Xml::ParseScrollBar(wxItemResource *res)
+wxString wxr2xml::GetCheckStatus(wxItemResource * res)
 {
-m_xmlfile.Write("              <scrollbar");
-WriteControlInfo(res);
-//TODO learn more about XML scrollbar format
-m_xmlfile.Write("\n                    </scrollbar>\n");
-} 
+    wxString msg;
+    msg << "\t\t\t\t<checked>" << res->GetValue1() << "</checked>\n";
+    return msg;
+}
 
-wxString wxWxr2Xml::GetCheckStatus(wxItemResource *res)
+wxString wxr2xml::GetStyles(wxItemResource * res)
 {
-wxString msg;
-msg<<" <checked>"<<res->GetValue1()<<"</checked>";
-return msg;
+    // Very crude way to get styles
+    long style;
+    wxString s, restype;
+    restype = res->GetType();
+    style = res->GetStyle();
+
+    s = "\t\t\t\t<style>";
+
+    // Common styles for all controls
+    if (style & wxSIMPLE_BORDER)
+        s += "wxSIMPLE_BORDER|";
+    if (style & wxSUNKEN_BORDER)
+        s += "wxSUNKEN_BORDER|";
+    if (style & wxSIMPLE_BORDER)
+        s += "wxSIMPLE_BORDER|";
+    if (style & wxDOUBLE_BORDER)
+        s += "wxDOUBLE_BORDER|";
+    if (style & wxRAISED_BORDER)
+        s += "wxRAISED_BORDER|";
+    if (style & wxTRANSPARENT_WINDOW)
+        s += "wxTRANSPARENT_WINDOW|";
+    if (style & wxWANTS_CHARS)
+        s += "wxWANTS_CHARS|";
+    if (style & wxNO_FULL_REPAINT_ON_RESIZE)
+        s += "wxNO_FULL_REPAINT_ON_RESIZE|";
+
+    if (restype == "wxDialog") 
+        {
+        if (style & wxDIALOG_MODAL)
+            s += "wxDIALOG_MODAL|";
+        if (style & wxDEFAULT_DIALOG_STYLE)
+            s += "wxDEFAULT_DIALOG_STYLE|";
+        if (style & wxDIALOG_MODELESS)
+            s += "wxDIALOG_MODELESS|";
+        if (style & wxNO_3D)
+            s += "wxNO_3D|";
+        if (style & wxTAB_TRAVERSAL)
+            s += "wxTAB_TRAVERSAL|";
+        if (style & wxWS_EX_VALIDATE_RECURSIVELY)
+            s += "wxWS_EX_VALIDATE_RECURSIVELY|";
+        if (style & wxSTAY_ON_TOP)
+            s += "wxSTAY_ON_TOP|";
+        if (style & wxCAPTION)
+            s += "wxCAPTION|";
+        if (style & wxTHICK_FRAME)
+            s += "wxTHICK_FRAME|";
+        if (style & wxRESIZE_BOX)
+            s += "wxRESIZE_BOX|";
+        if (style & wxRESIZE_BORDER)
+            s += "wxRESIZE_BORDER|";
+        if (style & wxSYSTEM_MENU)
+            s += "wxSYSTEM_MENU|";
+        if (style & wxCLIP_CHILDREN)
+            s += "wxCLIP_CHILDREN|";
+        }
+
+    if (restype == "wxPanel") 
+        {
+        if (style & wxCLIP_CHILDREN)
+            s += "wxCLIP_CHILDREN|";
+        if (style & wxNO_3D)
+            s += "wxNO_3D|";
+        if (style & wxTAB_TRAVERSAL)
+            s += "wxTAB_TRAVERSAL|";
+        if (style & wxWS_EX_VALIDATE_RECURSIVELY)
+            s += "wxWS_EX_VALIDATE_RECURSIVELY|";
+        }
+
+    if (restype == "wxComboBox") 
+        {
+        if (style & wxCB_SORT)
+            s += "wxCB_SORT|";
+        if (style & wxCB_SIMPLE)
+            s += "wxCB_SIMPLE|";
+        if (style & wxCB_READONLY)
+            s += "wxCB_READONLY|";
+        if (style & wxCB_DROPDOWN)
+            s += "wxCB_DROPDOWN|";
+        }
+
+    if (restype == "wxGauge") 
+        {
+        if (style & wxGA_HORIZONTAL)
+            s += "wxGA_HORIZONTAL|";
+        if (style & wxGA_VERTICAL)
+            s += "wxGA_VERTICAL|";
+        if (style & wxGA_PROGRESSBAR)
+            s += "wxGA_PROGRESSBAR|";
+    // windows only
+        if (style & wxGA_SMOOTH)
+            s += "wxGA_SMOOTH|";
+        }
+
+    if (restype == "wxRadioButton") 
+        {
+        if (style & wxRB_GROUP)
+        s += "wxRB_GROUP|";
+        }
+
+    if (restype == "wxStaticText") 
+        {
+        if (style & wxST_NO_AUTORESIZE)
+            s += "wxST_NO_AUTORESIZEL|";
+        }
+
+    if (restype == "wxRadioBox") 
+        {
+        if (style & wxRA_HORIZONTAL)
+            s += "wxRA_HORIZONTAL|";
+        if (style & wxRA_SPECIFY_COLS)
+            s += "wxRA_SPECIFY_COLS|";
+        if (style & wxRA_SPECIFY_ROWS)
+            s += "wxRA_SPECIFY_ROWS|";
+        if (style & wxRA_VERTICAL)
+            s += "wxRA_VERTICAL|";
+        }
+
+    if (restype == "wxListBox") 
+        {
+        if (style & wxLB_SINGLE)
+            s += "wxLB_SINGLE|";
+        if (style & wxLB_MULTIPLE)
+            s += "wxLB_MULTIPLE|";
+        if (style & wxLB_EXTENDED)
+            s += "wxLB_EXTENDED|";
+        if (style & wxLB_HSCROLL)
+            s += "wxLB_HSCROLL|";
+        if (style & wxLB_ALWAYS_SB)
+            s += "wxLB_ALWAYS_SB|";
+        if (style & wxLB_NEEDED_SB)
+            s += "wxLB_NEEDED_SB|";
+        if (style & wxLB_SORT)
+        s += "wxLB_SORT|";
+        }
+
+    if (restype == "wxTextCtrl") 
+        {
+        if (style & wxTE_PROCESS_ENTER)
+            s += "wxTE_PROCESS_ENTER|";
+        if (style & wxTE_PROCESS_TAB)
+            s += "wxTE_PROCESS_TAB|";
+        if (style & wxTE_MULTILINE)
+            s += "wxTE_MULTILINE|";
+        if (style & wxTE_PASSWORD)
+            s += "wxTE_PASSWORD|";
+        if (style & wxTE_READONLY)
+            s += "wxTE_READONLY|";
+        if (style & wxHSCROLL)
+            s += "wxHSCROLL|";
+        }
+
+
+    if (restype == "wxScrollBar")
+        {
+        if (style & wxSB_HORIZONTAL)
+            s += "wxSB_HORIZONTAL|";
+        if (style & wxSB_VERTICAL)  
+            s += "wxSB_VERTICAL|";
+        }
+
+    int l;
+    l = s.Length();
+    // No styles defined
+    if (l == 11)
+        return _T("");
+    // Trim off last |
+    s = s.Truncate(l - 1);
+
+    s += "</style>\n";
+    return s;
 }
 
-wxString wxWxr2Xml::GetStyles(wxItemResource *res)
+wxString wxr2xml::GetDimension(wxItemResource * res)
 {
-//Very crude way to get styles
-long style;
-wxString s,restype;
-restype=res->GetType();
-style=res->GetStyle();
+    wxString msg;
+    msg << "\t\t\t\t<dimension>" << res->GetValue1() << "</dimension>\n";
+    return msg;
+}
 
-s="<style>";
+wxString wxr2xml::GenerateName(wxItemResource * res)
+{
+    wxString name;
+    name = _T(" name=\"");
+    switch (res->GetId()) {
+    case wxID_OK:
+        name += _T("wxID_OK");
+    break;
+    case wxID_CANCEL:
+        name += _T("wxID_CANCEL");
+    break;
+    default:
+        name += res->GetName();
+    }
 
-//Common styles for all controls
-if (style&wxSIMPLE_BORDER)
-               s+="wxSIMPLE_BORDER|";
-if (style&wxSUNKEN_BORDER)
-               s+="wxSUNKEN_BORDER|";
-if (style&wxSIMPLE_BORDER)
-               s+="wxSIMPLE_BORDER|";
-if (style&wxDOUBLE_BORDER)
-               s+="wxDOUBLE_BORDER|";
-if (style&wxRAISED_BORDER)
-               s+="wxRAISED_BORDER|";
-if (style&wxTRANSPARENT_WINDOW)
-               s+="wxTRANSPARENT_WINDOW|";
-if (style&wxWANTS_CHARS)
-               s+="wxWANTS_CHARS|";
-if (style&wxNO_FULL_REPAINT_ON_RESIZE)
-               s+="wxNO_FULL_REPAINT_ON_RESIZE|";
-           
-if (restype=="wxDialog")
-{
-       if (style&wxDIALOG_MODAL)
-               s+="wxDIALOG_MODAL|";
-       if (style&wxDEFAULT_DIALOG_STYLE)
-               s+="wxDEFAULT_DIALOG_STYLE|";
-       if (style&wxDIALOG_MODELESS)
-               s+="wxDIALOG_MODELESS|";
-       if (style&wxNO_3D)
-               s+="wxNO_3D|";
-       if (style&wxTAB_TRAVERSAL)
-               s+="wxTAB_TRAVERSAL|";
-       if (style&wxWS_EX_VALIDATE_RECURSIVELY)
-               s+="wxWS_EX_VALIDATE_RECURSIVELY|";
-       if (style&wxSTAY_ON_TOP)
-               s+="wxSTAY_ON_TOP|";
-       if (style&wxCAPTION)
-               s+="wxCAPTION|";
-       if (style&wxTHICK_FRAME)
-               s+="wxTHICK_FRAME|";
-       if (style&wxRESIZE_BOX)
-               s+="wxRESIZE_BOX|";
-       if (style&wxRESIZE_BORDER)
-               s+="wxRESIZE_BORDER|";
-       if (style&wxSYSTEM_MENU)
-               s+="wxSYSTEM_MENU|";
-       if (style&wxCLIP_CHILDREN)
-               s+="wxCLIP_CHILDREN|";
-       
-       
+    name += "\"";
+    return name;
 }
-    
 
-    
-if (restype=="wxPanel")
-{
-       if (style&wxCLIP_CHILDREN)
-               s+="wxCLIP_CHILDREN|";
-       if (style&wxNO_3D)
-               s+="wxNO_3D|";
-       if (style&wxTAB_TRAVERSAL)
-               s+="wxTAB_TRAVERSAL|";
-       if (style&wxWS_EX_VALIDATE_RECURSIVELY)
-               s+="wxWS_EX_VALIDATE_RECURSIVELY|";
-}
-
-if (restype=="wxComboBox")
-{
-       if (style&wxCB_SORT)
-               s+="wxCB_SORT|";
-       if (style&wxCB_SIMPLE)
-               s+="wxCB_SIMPLE|";
-       if (style&wxCB_READONLY)
-               s+="wxCB_READONLY|";
-       if (style&wxCB_DROPDOWN)
-               s+="wxCB_DROPDOWN|";
-}
-
-if (restype=="wxGauge")
-{
-       if (style&wxGA_HORIZONTAL)
-               s+="wxGA_HORIZONTAL|";
-       if (style&wxGA_VERTICAL)
-               s+="wxGA_VERTICAL|";
-       if (style&wxGA_PROGRESSBAR)
-               s+="wxGA_PROGRESSBAR|";
-       // windows only
-       if (style&wxGA_SMOOTH)
-               s+="wxGA_SMOOTH|";
-}
-
-if (restype=="wxRadioButton")
-{
-       if (style&wxRB_GROUP)
-               s+="wxRB_GROUP|";
-}
-
-if (restype=="wxStaticText")
-{
-       if (style&wxST_NO_AUTORESIZE)
-               s+="wxST_NO_AUTORESIZEL|";
-}
-
-if (restype=="wxRadioBox")
-       {
-       if (style&wxRA_HORIZONTAL)
-               s+="wxRA_HORIZONTAL|";
-       if (style&wxRA_SPECIFY_COLS)
-               s+="wxRA_SPECIFY_COLS|";
-       if (style&wxRA_SPECIFY_ROWS)
-               s+="wxRA_SPECIFY_ROWS|";
-       if (style&wxRA_VERTICAL)
-               s+="wxRA_VERTICAL|";
-       }
-
-if (restype=="wxListBox")
-{
-       if (style&wxLB_SINGLE)
-               s+="wxLB_SINGLE|";
-       if (style&wxLB_MULTIPLE)
-               s+="wxLB_MULTIPLE|";
-       if (style&wxLB_EXTENDED)
-               s+="wxLB_EXTENDED|";
-       if (style&wxLB_HSCROLL)
-               s+="wxLB_HSCROLL|";
-       if (style&wxLB_ALWAYS_SB)
-               s+="wxLB_ALWAYS_SB|";
-       if (style&wxLB_NEEDED_SB)
-               s+="wxLB_NEEDED_SB|";
-       if (style&wxLB_SORT)
-               s+="wxLB_SORT|";
-}
-       
-if (restype=="wxTextCtrl")
-{
-       if (style&wxTE_PROCESS_ENTER)
-               s+="wxTE_PROCESS_ENTER|";
-       if (style&wxTE_PROCESS_TAB)
-               s+="wxTE_PROCESS_TAB|";
-       if (style&wxTE_MULTILINE)
-               s+="wxTE_MULTILINE|";
-       if (style&wxTE_PASSWORD)
-               s+="wxTE_PASSWORD|";
-       if (style&wxTE_READONLY)
-               s+="wxTE_READONLY|";
-       if (style&wxHSCROLL)
-               s+="wxHSCROLL|";
-}
-
-int l;
-l=s.Length();
-//No styles defined
-if (l==7)
-       return _T("");
-//Trim off last |
-s=s.Truncate(l-1);
-
-s+="</style>";
-return s;      
-}
-
-wxString wxWxr2Xml::GetDimension(wxItemResource *res)
-{
-wxString msg;
-msg<<" <dimension>"<<res->GetValue1()<<"</dimension>";
-return msg;
-}
-
-wxString wxWxr2Xml::GenerateName(wxItemResource *res)
-{
-wxString name;
-name=_T(" name=\"");
-switch (res->GetId())
-       {
-       case wxID_OK:
-               name+=_T("wxID_OK");
-               break;
-       case wxID_CANCEL:
-               name+=_T("wxID_CANCEL");
-               break;
-       default:
-               name+=res->GetName();
-       }
-
-name+="\"";    
-return name;
-}
-
-void wxWxr2Xml::ParseMenuBar(wxItemResource *res)
-{
-       wxItemResource *child;
-       wxNode *node = res->GetChildren().First();
-       //Get Menu Bar Name
-       m_xmlfile.Write("<menubar ");
-       m_xmlfile.Write(GenerateName(res));
-       m_xmlfile.Write(">\n");
-       m_xmlfile.Write("       <children>\n");
-    while (node)
-    {
-               child= (wxItemResource *)node->Data();
-               ParseMenu(child);
+void wxr2xml::ParseMenuBar(wxItemResource * res)
+{
+    wxItemResource *child;
+    wxNode *node = res->GetChildren().First();
+    // Get Menu Bar Name
+    m_xmlfile.Write("\t<menubar ");
+    m_xmlfile.Write(GenerateName(res));
+    m_xmlfile.Write(">\n");
+    m_xmlfile.Write("\t\t<children>\n");
+    while (node) {
+        child = (wxItemResource *) node->Data();
+        ParseMenu(child);
         node = node->Next();
-       }
-
-       m_xmlfile.Write("       </children>\n");
-       m_xmlfile.Write("</menubar> \n");
-}
-
-
-void wxWxr2Xml::ParseMenu(wxItemResource *res)
-{
-       wxItemResource *child;
-       wxNode *node = res->GetChildren().First();
-       //Get Menu 
-       m_xmlfile.Write("       <menu ");
-       wxString menuname;
-       menuname<<"name = \"menu_"<<res->GetValue1()<<"\"";
-       m_xmlfile.Write(menuname);
-       m_xmlfile.Write(">\n");
-       m_xmlfile.Write("               <label>"
-               +FixMenuString(res->GetTitle())+"</label>\n");
-       if (res->GetValue4()!="")
-               m_xmlfile.Write("               <help>"+res->GetValue4()+"</help>\n");
-       m_xmlfile.Write("               <children>\n");
-       //Read in menu items and additional menus
-       while (node)
-    {
-               child= (wxItemResource *)node->Data();
-               if (!child->GetChildren().First())
-                       ParseMenuItem(child);
-               else
-                       ParseMenu(child);
+    }
 
-        node = node->Next();
-       }
-m_xmlfile.Write("              </children>\n");
-m_xmlfile.Write("      </menu> \n");
+    m_xmlfile.Write("\t\t</children>\n");
+    m_xmlfile.Write("\t</menubar> \n\n");
+}
+
+void wxr2xml::ParseMenu(wxItemResource * res)
+{
+    wxItemResource *child;
+    wxNode *node = res->GetChildren().First();
+    // Get Menu 
+    m_xmlfile.Write("\t\t\t<menu ");
+    wxString menuname;
+    menuname << "name = \"menu_" << res->GetValue1() << "\"";
+    m_xmlfile.Write(menuname);
+    m_xmlfile.Write(">\n");
+    m_xmlfile.Write("\t\t\t\t<label>"
+        + FixMenuString(res->GetTitle()) + "</label>\n");
+    if (res->GetValue4() != "")
+        m_xmlfile.Write("\t\t\t\t<help>" + res->GetValue4() +
+        "</help>\n");
+        m_xmlfile.Write("\t\t\t<children>\n");
+    // Read in menu items and additional menus
+    while (node) {
+        child = (wxItemResource *) node->Data();
+        if (!child->GetChildren().First())
+            ParseMenuItem(child);
+        else
+            ParseMenu(child);
+            node = node->Next();
+    }
+    m_xmlfile.Write("\t\t\t</children>\n");
+    m_xmlfile.Write("\t\t\t</menu> \n");
+}
+
+void wxr2xml::ParseMenuItem(wxItemResource * res)
+{
+    // Get Menu Item or Separator
+    if (res->GetTitle() == "") {
+        m_xmlfile.Write("\t\t\t<separator/>\n");
+    } else {
+        m_xmlfile.Write("\t\t\t\t<menuitem ");
+        wxString menuname;
+        menuname << "name = \"menuitem_" << res->GetValue1() << "\"";
+        m_xmlfile.Write(menuname);
+        m_xmlfile.Write(">\n");
+            m_xmlfile.Write("                  <label>"
+            + FixMenuString(res->GetTitle()) + "</label>\n");
+        if (res->GetValue4() != "")
+            m_xmlfile.Write("                  <help>" +
+        res->GetValue4() + "</help>\n");
+        if (res->GetValue2())
+            m_xmlfile.Write("\t\t\t\t<checkable>1</checkable>\n");
+        m_xmlfile.Write("\t\t\t</menuitem> \n");
+    }
+}
+
+wxString wxr2xml::FixMenuString(wxString phrase)
+{
+    phrase.Replace("&", "$");
+    return phrase;
+}
+
+void wxr2xml::ParseStaticBitmap(wxItemResource * res)
+{
+    m_xmlfile.Write("\t\t\t<staticbitmap");
+    WriteControlInfo(res);
+    // value4 holds bitmap name
+    wxString bitmapname;
+    bitmapname = res->GetValue4();
+    wxBitmap bitmap;
+    bitmap = wxResourceCreateBitmap(bitmapname, &m_table);
+    bitmapname += _T(".bmp");
+    bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP);
+    m_xmlfile.Write("\n\t\t\t\t<bitmap>" + bitmapname + "</bitmap>");
+    m_xmlfile.Write("\t\t\t</staticbitmap>\n");
+    // bitmap5
+}
+//Parse a bitmap resource
+void wxr2xml::ParseBitmap(wxItemResource * res)
+{
+    m_xmlfile.Write("\t<bitmap ");
+    m_xmlfile.Write(GenerateName(res)+">");
+    wxString bitmapname;
+    bitmapname = res->GetName();
+    wxBitmap bitmap;
+    bitmap = wxResourceCreateBitmap(bitmapname, &m_table);
+    bitmapname += _T(".bmp");
+    bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP);
+    m_xmlfile.Write(bitmapname);
+    m_xmlfile.Write("</bitmap>\n\n");
 }
 
-void wxWxr2Xml::ParseMenuItem(wxItemResource *res)
+void wxr2xml::PanelStuff(wxItemResource * res)
 {
-       //Get Menu Item or Separator
-if (res->GetTitle()=="")
-       {
-       m_xmlfile.Write("               <separator/>\n");
-       }
-else
-       {
-       m_xmlfile.Write("               <menuitem ");
-       wxString menuname;
-       menuname<<"name = \"menuitem_"<<res->GetValue1()<<"\"";
-       m_xmlfile.Write(menuname);
-       m_xmlfile.Write(">\n");
-       m_xmlfile.Write("                       <label>"
-               +FixMenuString(res->GetTitle())+"</label>\n");
-       if (res->GetValue4()!="")
-               m_xmlfile.Write("                       <help>"+res->GetValue4()+"</help>\n");
-       if (res->GetValue2())
-               m_xmlfile.Write("                       <checkable>1</checkable>\n");
-       m_xmlfile.Write("               </menuitem> \n");
-       }
+    if ((res->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
+        m_dlgunits = TRUE;
+    else
+        m_dlgunits = FALSE;
+
+    // If this is true ignore fonts, background color and use system
+    // defaults instead
+    if ((res->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0)
+        m_systemdefaults = TRUE;
+    else
+        m_systemdefaults = FALSE;
+
+}
+
+wxString wxr2xml::GetValue2(wxItemResource *res)
+{
+    wxString msg;
+    msg << res->GetValue2();
+    return msg;
 }
 
-wxString wxWxr2Xml::FixMenuString(wxString phrase)
+wxString wxr2xml::GetValue3(wxItemResource *res)
 {
-phrase.Replace("&","$");
-return phrase;
+    wxString msg;
+    msg << res->GetValue3();
+    return msg;
+
 }
 
-void wxWxr2Xml::ParseStaticBitmap(wxItemResource *res)
+wxString wxr2xml::GetValue5(wxItemResource *res)
 {
-m_xmlfile.Write("              <staticbitmap");
-WriteControlInfo(res);
-//value4 holds bitmap name
-wxString bitmapname;
-bitmapname=res->GetValue4();
-wxBitmap bitmap;
-bitmap= wxResourceCreateBitmap(bitmapname,&m_table);
-bitmapname+=_T(".bmp");
-bitmap.SaveFile(bitmapname,wxBITMAP_TYPE_BMP);
-m_xmlfile.Write("\n            <bitmap>"+bitmapname+"</bitmap>");
-m_xmlfile.Write("</staticbitmap>\n");
-//bitmap5
+    wxString msg;
+    msg << res->GetValue5();
+    return msg;
+
 }
 
-void wxWxr2Xml::ParseBitmap(wxItemResource *res)
+void wxr2xml::ParseBitmapButton(wxItemResource *res)
 {
+    
+    m_xmlfile.Write("\t\t\t<bitmapbutton");
+    WriteControlInfo(res);
+    // value4 holds bitmap name
+    wxString bitmapname;
+    bitmapname = res->GetValue4();
+    wxBitmap bitmap;
+    bitmap = wxResourceCreateBitmap(bitmapname, &m_table);
+    bitmapname += _T(".bmp");
+    bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP);
+    m_xmlfile.Write("\t\t\t\t<bitmap>" + bitmapname + "</bitmap>\n");
+    
+    m_xmlfile.Write("\t\t\t</bitmapbutton>\n");
+}
+
+void wxr2xml::WriteFontInfo(wxItemResource *res)
+{
+//if systems_defaults true just ignore the fonts
+    if (m_systemdefaults)
+        return;
+    wxFont font;
+    font=res->GetFont();
+    if (!font.GetRefData())
+        return;
+
+    m_xmlfile.Write("\t\t\t<font>\n");
+    //Get font point size,font family,weight,font style,underline
+    int pt;
+    wxString msg;
+    pt=font.GetPointSize();
+    msg<<"\t\t\t\t<size>"<<pt<<"</size>\n";
+    m_xmlfile.Write(msg);
+    GetFontFace(font);
+    GetFontStyle(font);
+    GetFontWeight(font);
+    
+    if (font.GetUnderlined())
+        m_xmlfile.Write("\t\t\t\t<underlined>1</underlined>\n");
+    
+    m_xmlfile.Write("\t\t\t</font>\n");
+}
 
+//WARNING possible make here
+//I wasn't really sure the right way to do this.
+void wxr2xml::GetFontFace(wxFont font)
+{
+    int family=font.GetFamily();
+    
+    switch (family)
+        {
+        case wxDEFAULT:
+            break;
+        case wxDECORATIVE:
+            m_xmlfile.Write("\t\t\t\t<face>Decorative</face>\n");
+            break;
+        case wxROMAN:
+            m_xmlfile.Write("\t\t\t\t<face>Roman</face>\n");
+            break;
+        case wxSCRIPT:
+            m_xmlfile.Write("\t\t\t\t<face>Script</face>\n");
+            break;
+        case wxSWISS:
+            m_xmlfile.Write("\t\t\t\t<face>Swiss</face>\n");
+            break;
+        case wxMODERN:
+            m_xmlfile.Write("\t\t\t\t<face>Modern</face>\n");
+            break;
+        default:
+            wxLogError("Unknown font face");
+        }
 }
 
-void wxWxr2Xml::PanelStuff(wxItemResource *res)
+void wxr2xml::GetFontStyle(wxFont font)
 {
-if ((res->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
-       m_dlgunits=TRUE;
-else 
-       m_dlgunits=FALSE;
 
-//If this is true ignore fonts, background color and use system
-//defaults instead
-if ((res->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0)
-       m_systemdefaults=TRUE;
-else 
-       m_systemdefaults=FALSE;
+    int style=font.GetStyle();
+
+    switch (style)
+        {
+//since this is default no point in making file any larger
+        case wxNORMAL:
+            break;
+        case wxITALIC:
+            m_xmlfile.Write("<style>italic</style>\n");
+            break;
+        case wxSLANT:
+            m_xmlfile.Write("<style>slant</style>\n");
+            break;
+        default:
+            wxLogError("Unknown font style");
+        }
+}
+
+void wxr2xml::GetFontWeight(wxFont font)
+{
+    int weight=font.GetWeight();
 
+    switch (weight)
+        {
+//since this is default no point in making file any larger
+        case wxNORMAL:
+            break;
+        case wxLIGHT:
+            m_xmlfile.Write("\t\t\t\t<weight>light</weight>\n");
+            break;
+        case wxBOLD:
+            m_xmlfile.Write("\t\t\t\t<weight>bold</weight>\n");
+            break;
+        default:
+            wxLogError("Unknown font weight");
+        }
 }
index 3cebb8082fae7577f4428568b43dea11a964c4d8..dd699e7e2a538776d987dbcafb17a7ae9caf711a 100644 (file)
@@ -9,59 +9,66 @@
 #include "wx/resource.h"
 
 
-class wxWxr2Xml : public wxObject  
+class wxr2xml : public wxObject  
 {
 public:
-       bool Convert(wxString wxrfile,wxString xmlfile);
-       wxWxr2Xml();
-       virtual ~wxWxr2Xml();
+    bool Convert(wxString wxrfile,wxString xmlfile);
+    wxr2xml();
+    virtual ~wxr2xml();
 
 protected:
-       void PanelStuff(wxItemResource *res);
-       bool m_systemdefaults;
-       bool m_dlgunits;
-       void ParseBitmap(wxItemResource *res);
-       void ParseStaticBitmap(wxItemResource *res);
-       wxString FixMenuString(wxString phrase);
-       void ParseMenuItem(wxItemResource *res);
-       void ParseMenu(wxItemResource *res);
-       void ParseMenuBar(wxItemResource *res);
-       wxString GenerateName(wxItemResource *res);
-       wxString GetStyles(wxItemResource *res);
-       wxString GetDimension(wxItemResource *res);
-       void ParsePanel(wxItemResource *res);
-       void ParseRadioButton(wxItemResource *res);
-       wxString GetMin(wxItemResource *res);
-       wxString GetCheckStatus(wxItemResource *res);
-       void ParseScrollBar(wxItemResource *res);
-       void ParseComboBox(wxItemResource * res);
-       wxString GetMax(wxItemResource *res);
-       void ParseSlider(wxItemResource *res);
-       wxString GetValue1(wxItemResource *res);
-       wxString GetRange(wxItemResource *res);
-       void ParseGauge(wxItemResource *res);
-       void ParseChoice(wxItemResource *res);
-       void WriteStringList(wxItemResource *res);
-       void ParseStaticBox(wxItemResource *res);
-       void ParseRadioBox(wxItemResource *res);
-       wxString GetLabel(wxItemResource *res);
-       void ParseCheckBox(wxItemResource *res);
-       wxString GetValue4(wxItemResource *res);
-       wxString GetTitle(wxItemResource *res);
-       void ParseTextCtrl(wxItemResource *res);
-       void ParseButton(wxItemResource *res);
-       wxString GetPosition(wxItemResource *res);
-       void WriteControlInfo(wxItemResource *res);
-       void ParseStaticText(wxItemResource *res);
-       void ParseListBox(wxItemResource *res);
-       wxString GetSize(wxItemResource *res);
-       void ParseControls(wxItemResource *res);
-       void ParseDialog(wxItemResource *res);
-       bool ParseResources();
-
-       //Variables
-       wxResourceTable m_table;
-       wxFFile m_xmlfile;
+    void GetFontWeight(wxFont font);
+    void GetFontStyle(wxFont font);
+    void ParseBitmapButton(wxItemResource *res);
+    void GetFontFace(wxFont font);
+    void WriteFontInfo(wxItemResource *res);
+    wxString GetValue2(wxItemResource *res);
+    wxString GetValue3(wxItemResource *res);
+    wxString GetValue5(wxItemResource *res);
+    void PanelStuff(wxItemResource *res);
+    bool m_systemdefaults;
+    bool m_dlgunits;
+    void ParseBitmap(wxItemResource *res);
+    void ParseStaticBitmap(wxItemResource *res);
+    wxString FixMenuString(wxString phrase);
+    void ParseMenuItem(wxItemResource *res);
+    void ParseMenu(wxItemResource *res);
+    void ParseMenuBar(wxItemResource *res);
+    wxString GenerateName(wxItemResource *res);
+    wxString GetStyles(wxItemResource *res);
+    wxString GetDimension(wxItemResource *res);
+    void ParsePanel(wxItemResource *res);
+    void ParseRadioButton(wxItemResource *res);
+    wxString GetMin(wxItemResource *res);
+    wxString GetCheckStatus(wxItemResource *res);
+    void ParseScrollBar(wxItemResource *res);
+    void ParseComboBox(wxItemResource * res);
+    wxString GetMax(wxItemResource *res);
+    void ParseSlider(wxItemResource *res);
+    wxString GetValue1(wxItemResource *res);
+    wxString GetRange(wxItemResource *res);
+    void ParseGauge(wxItemResource *res);
+    void ParseChoice(wxItemResource *res);
+    void WriteStringList(wxItemResource *res);
+    void ParseStaticBox(wxItemResource *res);
+    void ParseRadioBox(wxItemResource *res);
+    wxString GetLabel(wxItemResource *res);
+    void ParseCheckBox(wxItemResource *res);
+    wxString GetValue4(wxItemResource *res);
+    wxString GetTitle(wxItemResource *res);
+    void ParseTextCtrl(wxItemResource *res);
+    void ParseButton(wxItemResource *res);
+    wxString GetPosition(wxItemResource *res);
+    void WriteControlInfo(wxItemResource *res);
+    void ParseStaticText(wxItemResource *res);
+    void ParseListBox(wxItemResource *res);
+    wxString GetSize(wxItemResource *res);
+    void ParseControls(wxItemResource *res);
+    void ParseDialog(wxItemResource *res);
+    bool ParseResources();
+    //Variables
+    wxResourceTable m_table;
+    wxFFile m_xmlfile;
 };
 
 #endif