2000-09-26 17:59:37 -04:00
|
|
|
// rc2wxr.cpp: implementation of the rc2wxr class.
|
2000-09-17 15:17:13 -04:00
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2000-09-26 17:59:37 -04:00
|
|
|
//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
|
|
|
|
*/
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
// For compilers that support precompilation, includes "wx/wx.h".
|
2001-10-30 08:33:34 -05:00
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
#ifdef __BORLANDC__
|
2005-03-07 15:18:47 -05:00
|
|
|
#pragma hdrstop
|
2000-09-26 17:59:37 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// for all others, include the necessary headers (this file is usually all you
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-05-25 07:20:37 -04:00
|
|
|
// need because it includes almost all "standard" wxWidgets headers
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
#ifndef WX_PRECOMP
|
2005-03-07 15:18:47 -05:00
|
|
|
#include "wx/wx.h"
|
2000-09-26 17:59:37 -04:00
|
|
|
#endif
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
#include "wx/image.h"
|
2003-03-31 05:24:36 -05:00
|
|
|
#include "wx/deprecated/setup.h"
|
|
|
|
#include "wx/deprecated/resource.h"
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
#include "rc2wxr.h"
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2000-09-17 15:17:13 -04:00
|
|
|
// Construction/Destruction
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
rc2wxr::rc2wxr()
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
m_done=false;
|
|
|
|
m_controlid=6000;
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
rc2wxr::~rc2wxr()
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::Convert(wxString wxrfile, wxString rcfile)
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2004-12-21 13:57:20 -05:00
|
|
|
m_rc.Open(rcfile);
|
|
|
|
m_filesize=m_rc.Length();
|
2005-02-25 09:16:42 -05:00
|
|
|
if( (m_wxr = wxFopen( wxrfile, _T("wt") )) == NULL )
|
2004-12-21 13:57:20 -05:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-12-21 13:57:20 -05:00
|
|
|
wxString tok,prevtok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-12-21 13:57:20 -05:00
|
|
|
while (!m_done)
|
|
|
|
{
|
|
|
|
tok=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-12-21 13:57:20 -05:00
|
|
|
if (tok==_T("DIALOG"))
|
|
|
|
{
|
|
|
|
ParseDialog(prevtok);
|
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-12-21 13:57:20 -05:00
|
|
|
if (tok==_T("MENU"))
|
|
|
|
{
|
|
|
|
ParseMenu(prevtok);
|
|
|
|
}
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2004-12-21 13:57:20 -05:00
|
|
|
prevtok=tok;
|
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-12-21 13:57:20 -05:00
|
|
|
fclose(m_wxr);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-12-21 13:57:20 -05:00
|
|
|
m_rc.Close();
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-03-31 05:24:36 -05:00
|
|
|
Example .rc
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
Microsoft style as of v5.0
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 55
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
CAPTION "About Funimator"
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
FONT 8, "MS Sans Serif"
|
|
|
|
|
|
|
|
Borland 4.5 style rc
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
IDD_DIBATTR DIALOG 7, 16, 172, 119
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
CAPTION "DIB Attributes"
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
FONT 8, "MS Sans Serif"
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
DEFPUSHBUTTON "Ok", IDOK, 114, 8, 50, 14
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
PUSHBUTTON "Cancel", IDCANCEL, 114, 28, 50, 14
|
|
|
|
|
|
|
|
*/
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ParseDialog(wxString dlgname)
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
wxString tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
static int dlgid=999;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
dlgid++;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-03-31 05:24:36 -05:00
|
|
|
/* Make sure that this really is a dialog
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
microsoft reuses the keyword DIALOG for other things
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
*/
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
tok=PeekToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
//Microsoft notation?
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (tok==_T("DISCARDABLE"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
tok=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
tok=PeekToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
//This isn't a Dialog resource eject eject
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
if (!tok.IsNumber())
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
return;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
//Generate Dialog text
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("static char *dialog%i = \"dialog(name = '%s',\\\n"),dlgid,dlgname.c_str());
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
//be lazy about style for now. add it later
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\\\n"));
|
|
|
|
wxFprintf(m_wxr,_T("id = %i,\\\n"),dlgid);
|
2000-09-17 15:17:13 -04:00
|
|
|
|
|
|
|
//Record x,y,width,height
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
int x,y,width,height;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ReadRect(x,y,width,height);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("x = %i, y = %i, width = %i, height = %i,\\\n"),x,y,width,height);
|
2000-09-17 15:17:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
//CAPTION "About Funimator"
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
//Get Title
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
tok=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString title;
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (tok==_T("CAPTION"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
title=GetQuoteField();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("title = '%s',\\\n"),title.c_str());
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
tok=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("use_dialog_units = 1,\\\n"));
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("use_system_defaults = 0,\\\n"));
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\\\n"));
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ParseControls();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T(").\";\n\n"));
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
/*
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-31 05:24:36 -05:00
|
|
|
EDITTEXT IDC_BANDS,36,83,22,14,ES_AUTOHSCROLL | ES_NUMBER | NOT
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
WS_TABSTOP
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
LTEXT "Bands",IDC_STATIC,11,86,21,8
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
EDITTEXT IDC_NAME,10,3,75,14,ES_AUTOHSCROLL
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
END
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
*/
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ParseControls()
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString tok;
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
tok=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
while ((tok!=_T("END"))&(tok!=_T("}")))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (tok==_T("LTEXT"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ParseStaticText();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (tok==_T("EDITTEXT"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ParseTextCtrl();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (tok==_T("PUSHBUTTON"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ParsePushButton();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (tok==_T("DEFPUSHBUTTON"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ParsePushButton();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (tok==_T("GROUPBOX"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ParseGroupBox();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (tok==_T("COMBOBOX"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ParseComboBox();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (tok==_T("CONTROL"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ParseControlMS();
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
tok=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
//LTEXT "Radius",IDC_STATIC,9,67,23,8
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ParseStaticText()
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString phrase,varname;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
phrase=GetQuoteField();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
varname=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
m_controlid++;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
int x,y,width,height;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ReadRect(x,y,width,height);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T(" control = [%i,wxStaticText,'%s','0','%s',"),m_controlid,phrase.c_str(),varname.c_str());
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
//EDITTEXT IDC_RADIUS,36,65,40,14,ES_AUTOHSCROLL
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ParseTextCtrl()
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString varname;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
varname=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
m_controlid++;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
int x,y,width,height;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ReadRect(x,y,width,height);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T(" control = [%i,wxTextCtrl,'','0','%s',"),m_controlid,varname.c_str());
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
//PUSHBUTTON "Create/Update",IDC_CREATE,15,25,53,13,NOT WS_TABSTOP
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ParsePushButton()
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString phrase,varname;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
phrase=GetQuoteField();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
varname=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
int c;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
m_controlid++;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
c=m_controlid;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (varname==_T("IDOK"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
c=wxID_OK;
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (varname==_T("IDCANCEL"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
c=wxID_CANCEL;
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
if (varname==_T("IDAPPLY"))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
c=wxID_APPLY;
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
int x,y,width,height;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ReadRect(x,y,width,height);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T(" control = [%i,wxButton,'%s','0','%s',"),c,phrase.c_str(),varname.c_str());
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-05-31 05:20:43 -04:00
|
|
|
bool rc2wxr::Separator(int ch)
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|'))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-06-11 09:14:23 -04:00
|
|
|
return true;
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
if (ch==EOF)
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-06-11 09:14:23 -04:00
|
|
|
m_done=true;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-06-11 09:14:23 -04:00
|
|
|
return true;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-06-11 09:14:23 -04:00
|
|
|
return false;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ParseGroupBox()
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
// GROUPBOX "Rotate",IDC_STATIC,1,1,71,79
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
wxString phrase,varname;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
phrase=GetQuoteField();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
varname=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
m_controlid++;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
int x,y,width,height;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ReadRect(x,y,width,height);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T(" control = [%i,wxStaticBox,'%s','0','%s',"),m_controlid,phrase.c_str(),varname.c_str());
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
2000-09-17 15:17:13 -04:00
|
|
|
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ReadRect(int & x, int & y, int & width, int & height)
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
x=wxAtoi(GetToken());
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
y=wxAtoi(GetToken());
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
width=wxAtoi(GetToken());
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
height=wxAtoi(GetToken());
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
wxString rc2wxr::GetToken()
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-12-11 06:27:56 -05:00
|
|
|
wxString tok=wxEmptyString;
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
if (m_rc.Eof())
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-06-11 09:14:23 -04:00
|
|
|
m_done=true;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
return tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
int ch=0;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ReadChar(ch);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
if (ch==EOF)
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-06-11 09:14:23 -04:00
|
|
|
m_done=true;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
return tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2005-05-31 05:20:43 -04:00
|
|
|
while (Separator(ch))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
ReadChar(ch);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
if (m_done)
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
return tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
if (ch==EOF)
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-06-11 09:14:23 -04:00
|
|
|
m_done=true;
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-03-31 05:24:36 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2005-05-31 05:20:43 -04:00
|
|
|
while (!Separator(ch))
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
tok+=(char)ch;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
ReadChar(ch);
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
if (ch==EOF)
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-06-11 09:14:23 -04:00
|
|
|
m_done=true;
|
2000-09-17 15:17:13 -04:00
|
|
|
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
return tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
wxString rc2wxr::GetQuoteField()
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
wxString phrase;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
//ASCII code 34 "
|
|
|
|
int ch=0;
|
|
|
|
ReadChar(ch);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
while (ch!=34)
|
|
|
|
ReadChar(ch);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
ReadChar(ch);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
while (ch!=34)
|
|
|
|
{
|
|
|
|
phrase+=(char)ch;
|
|
|
|
ReadChar(ch);
|
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
return phrase;
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ReadChar(int &ch)
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2005-03-04 14:32:40 -05:00
|
|
|
wxFileOffset result = m_rc.Tell();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-04 14:32:40 -05:00
|
|
|
if ( result >= m_filesize )
|
|
|
|
m_done=true;
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2005-03-04 14:32:40 -05:00
|
|
|
result = m_rc.Read(&ch,1);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-04 14:32:40 -05:00
|
|
|
if ( result==wxInvalidOffset )
|
|
|
|
m_done=true;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-04 14:32:40 -05:00
|
|
|
if(ch==EOF)
|
|
|
|
m_done=true;
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-03-31 05:24:36 -05:00
|
|
|
/* COMBOBOX IDC_SCALECOMBO,10,110,48,52,CBS_DROPDOWNLIST | CBS_SORT |
|
2000-09-17 15:17:13 -04:00
|
|
|
WS_VSCROLL | WS_TABSTOP */
|
2005-03-07 15:18:47 -05:00
|
|
|
void rc2wxr::ParseComboBox()
|
|
|
|
{
|
|
|
|
int x,y,width,height;
|
|
|
|
wxString tok;
|
|
|
|
wxString varname = GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
m_controlid++;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
ReadRect(x,y,width,height);
|
|
|
|
wxFprintf(m_wxr,_T(" control = [%i,wxChoice,'','0','%s',"),m_controlid,varname.c_str());
|
|
|
|
wxFprintf(m_wxr,_T("%i,%i,%i,%i,[],\\\n"),x,y,width,height);
|
|
|
|
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ParseMenu(wxString name)
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
wxString tok;
|
|
|
|
static int menuid=0;
|
|
|
|
menuid++;
|
|
|
|
wxFprintf(m_wxr,_T("static char *MenuBar%i = \"menu(name = '%s',\\\n"),menuid,name.c_str());
|
|
|
|
wxFprintf(m_wxr,_T("menu = \\\n"));
|
|
|
|
wxFprintf(m_wxr,_T("[\\\n"));
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
|
|
|
|
tok=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
while ((tok!=_T("END"))&(tok!=_T("}")))
|
2004-06-11 09:14:23 -04:00
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
tok=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
if (tok==_T("POPUP"))
|
|
|
|
{
|
|
|
|
ParsePopupMenu();
|
|
|
|
wxFprintf(m_wxr,_T(" ],\\\n"));
|
|
|
|
}
|
2004-06-11 09:14:23 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
wxFprintf(m_wxr,_T("]).\";\n\n"));
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ParsePopupMenu()
|
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
static int menuitem=99;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
menuitem++;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
wxString tok = GetQuoteField();
|
|
|
|
int spot;
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
//Remove /t because it causes problems
|
|
|
|
spot=tok.First(_T("\\t"));
|
|
|
|
tok=tok.Left(spot);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
wxFprintf(m_wxr,_T(" ['%s',%i,'',\\\n"),tok.c_str(),menuitem);
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
|
|
|
|
tok=GetToken();
|
2003-03-31 05:24:36 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
while ((tok!=_T("END"))&(tok!=_T("}")))
|
|
|
|
{
|
|
|
|
tok=GetToken();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
if (tok==_T("MENUITEM"))
|
|
|
|
{
|
|
|
|
if (PeekToken()==_T("SEPARATOR"))
|
|
|
|
{
|
|
|
|
wxFprintf(m_wxr,_T(" [],\\\n"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tok=GetQuoteField();
|
|
|
|
//Remove /t because it causes problems
|
|
|
|
spot=tok.First(_T("\\t"));
|
|
|
|
tok=tok.Left(spot);
|
|
|
|
menuitem++;
|
|
|
|
wxFprintf(m_wxr,_T(" ['%s',%i,''],\\\n"),tok.c_str(),menuitem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
|
|
|
|
2000-09-26 17:59:37 -04:00
|
|
|
wxString rc2wxr::PeekToken()
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
wxFileOffset p = m_rc.Tell();
|
|
|
|
wxString tok = GetToken();
|
|
|
|
m_rc.Seek(p);
|
|
|
|
return tok;
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2000-09-17 15:17:13 -04:00
|
|
|
//Windows pain in the butt CONTROL
|
2000-09-26 17:59:37 -04:00
|
|
|
void rc2wxr::ParseControlMS()
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
wxString tok;
|
|
|
|
wxString label=GetQuoteField();
|
|
|
|
wxString varname=GetToken();
|
|
|
|
wxString kindctrl=GetQuoteField();
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
kindctrl.MakeUpper();
|
|
|
|
if (kindctrl==_T("MSCTLS_TRACKBAR32"))
|
|
|
|
ParseSlider(label,varname);
|
|
|
|
if (kindctrl==_T("MSCTLS_PROGRESS32"))
|
|
|
|
ParseProgressBar(label,varname);
|
|
|
|
if (kindctrl==_T("BUTTON"))
|
|
|
|
ParseCtrlButton(label,varname);
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-03-31 05:24:36 -05:00
|
|
|
/* CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
|
2000-09-17 15:17:13 -04:00
|
|
|
TBS_NOTICKS | WS_TABSTOP,52,73,100,15
|
|
|
|
*/
|
2003-12-11 06:27:56 -05:00
|
|
|
void rc2wxr::ParseSlider(wxString WXUNUSED(label), wxString varname)
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
int x,y,width,height;
|
|
|
|
wxString tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
while (ReadOrs(tok))
|
|
|
|
;
|
|
|
|
wxFprintf(m_wxr,_T(" control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',"),m_controlid,varname.c_str());
|
|
|
|
ReadRect(x,y,width,height);
|
|
|
|
wxFprintf(m_wxr,_T("%i,%i,%i,%i,"),x,y,width,height);
|
|
|
|
wxFprintf(m_wxr,_T(" 1, 1, 10,\\\n"));
|
|
|
|
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2003-03-31 05:24:36 -05:00
|
|
|
/*
|
2000-09-17 15:17:13 -04:00
|
|
|
CONTROL "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32",
|
|
|
|
WS_BORDER,15,52,154,13
|
|
|
|
*/
|
2003-12-11 06:27:56 -05:00
|
|
|
void rc2wxr::ParseProgressBar(wxString WXUNUSED(label), wxString varname)
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
int x,y,width,height;
|
|
|
|
wxString tok;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2004-03-03 05:46:59 -05:00
|
|
|
while (ReadOrs(tok))
|
|
|
|
;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
wxFprintf(m_wxr,_T(" control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',"),m_controlid,varname.c_str());
|
2000-09-26 17:59:37 -04:00
|
|
|
ReadRect(x,y,width,height);
|
2005-03-07 15:18:47 -05:00
|
|
|
wxFprintf(m_wxr,_T("%i,%i,%i,%i,"),x,y,width,height);
|
|
|
|
wxFprintf(m_wxr,_T(" 0, 10,\\\n"));
|
2003-12-11 06:27:56 -05:00
|
|
|
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
bool rc2wxr::ReadOrs(wxString & w)
|
2000-09-17 15:17:13 -04:00
|
|
|
{
|
2005-03-07 15:18:47 -05:00
|
|
|
wxString tok = PeekToken();
|
|
|
|
if (tok.IsNumber())
|
|
|
|
return false;
|
|
|
|
w=GetToken();
|
|
|
|
return true;
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
//Is it a check button or a radio button
|
|
|
|
void rc2wxr::ParseCtrlButton(wxString label, wxString varname)
|
|
|
|
{
|
|
|
|
int x,y,width,height;
|
|
|
|
wxString tok = GetToken();
|
2000-09-17 15:17:13 -04:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
m_controlid++;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
if (tok==_T("BS_AUTOCHECKBOX"))
|
|
|
|
{
|
|
|
|
wxFprintf(m_wxr,_T(" control = [%i,wxCheckBox,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str());
|
|
|
|
while (ReadOrs(tok))
|
|
|
|
;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
ReadRect(x,y,width,height);
|
|
|
|
wxFprintf(m_wxr,_T("%i,%i,%i,%i,0,\\\n"),x,y,width,height);
|
|
|
|
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
|
|
|
}
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
if (tok==_T("BS_AUTORADIOBUTTON"))
|
|
|
|
{
|
|
|
|
wxFprintf(m_wxr,_T(" control = [%i,wxRadioButton,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str());
|
|
|
|
while(ReadOrs(tok))
|
|
|
|
;
|
2001-10-30 08:33:34 -05:00
|
|
|
|
2005-03-07 15:18:47 -05:00
|
|
|
ReadRect(x,y,width,height);
|
|
|
|
wxFprintf(m_wxr,_T("%i,%i,%i,%i,0,\\\n"),x,y,width,height);
|
|
|
|
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
|
|
|
}
|
2000-09-17 15:17:13 -04:00
|
|
|
}
|
|
|
|
|