More wxFileOffset usage and making layout of the code little more readable.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32642 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
6f0344c7ff
commit
d7e3abf70f
@ -1,100 +1,55 @@
|
||||
// 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"
|
||||
|
||||
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
|
||||
// need because it includes almost all "standard" wxWidgets headers
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "rc2wxr.h"
|
||||
|
||||
#include "wx/image.h"
|
||||
|
||||
#include "wx/deprecated/setup.h"
|
||||
#include "wx/deprecated/resource.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#include "rc2wxr.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
rc2wxr::rc2wxr()
|
||||
|
||||
{
|
||||
|
||||
m_done=false;
|
||||
|
||||
m_controlid=6000;
|
||||
|
||||
m_done=false;
|
||||
m_controlid=6000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
rc2wxr::~rc2wxr()
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void rc2wxr::Convert(wxString wxrfile, wxString rcfile)
|
||||
{
|
||||
m_rc.Open(rcfile);
|
||||
@ -129,9 +84,6 @@ void rc2wxr::Convert(wxString wxrfile, wxString rcfile)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Example .rc
|
||||
@ -146,8 +98,6 @@ CAPTION "About Funimator"
|
||||
|
||||
FONT 8, "MS Sans Serif"
|
||||
|
||||
|
||||
|
||||
Borland 4.5 style rc
|
||||
|
||||
IDD_DIBATTR DIALOG 7, 16, 172, 119
|
||||
@ -164,12 +114,6 @@ FONT 8, "MS Sans Serif"
|
||||
|
||||
PUSHBUTTON "Cancel", IDCANCEL, 114, 28, 50, 14
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
void rc2wxr::ParseDialog(wxString dlgname)
|
||||
@ -215,13 +159,8 @@ wxFprintf(m_wxr,_T("static char *dialog%i = \"dialog(name = '%s',\\\n"),dlgid,dl
|
||||
//be lazy about style for now. add it later
|
||||
|
||||
wxFprintf(m_wxr,_T("style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\\\n"));
|
||||
|
||||
|
||||
|
||||
wxFprintf(m_wxr,_T("id = %i,\\\n"),dlgid);
|
||||
|
||||
|
||||
|
||||
//Record x,y,width,height
|
||||
|
||||
int x,y,width,height;
|
||||
@ -231,9 +170,6 @@ ReadRect(x,y,width,height);
|
||||
wxFprintf(m_wxr,_T("x = %i, y = %i, width = %i, height = %i,\\\n"),x,y,width,height);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//CAPTION "About Funimator"
|
||||
|
||||
//Get Title
|
||||
@ -635,41 +571,25 @@ return tok;
|
||||
|
||||
|
||||
wxString rc2wxr::GetQuoteField()
|
||||
|
||||
{
|
||||
wxString phrase;
|
||||
|
||||
wxString phrase;
|
||||
//ASCII code 34 "
|
||||
int ch=0;
|
||||
ReadChar(ch);
|
||||
|
||||
//ASCII code 34 "
|
||||
while (ch!=34)
|
||||
ReadChar(ch);
|
||||
|
||||
int ch=0;
|
||||
ReadChar(ch);
|
||||
|
||||
ReadChar(ch);
|
||||
|
||||
|
||||
|
||||
while (ch!=34)
|
||||
|
||||
ReadChar(ch);
|
||||
|
||||
|
||||
|
||||
ReadChar(ch);
|
||||
|
||||
|
||||
|
||||
while (ch!=34)
|
||||
|
||||
{
|
||||
|
||||
phrase+=(char)ch;
|
||||
|
||||
ReadChar(ch);
|
||||
|
||||
}
|
||||
|
||||
return phrase;
|
||||
while (ch!=34)
|
||||
{
|
||||
phrase+=(char)ch;
|
||||
ReadChar(ch);
|
||||
}
|
||||
|
||||
return phrase;
|
||||
}
|
||||
|
||||
|
||||
@ -691,367 +611,193 @@ void rc2wxr::ReadChar(int &ch)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* COMBOBOX IDC_SCALECOMBO,10,110,48,52,CBS_DROPDOWNLIST | CBS_SORT |
|
||||
WS_VSCROLL | WS_TABSTOP */
|
||||
void rc2wxr::ParseComboBox()
|
||||
{
|
||||
int x,y,width,height;
|
||||
wxString tok;
|
||||
wxString varname = GetToken();
|
||||
|
||||
/* COMBOBOX IDC_SCALECOMBO,10,110,48,52,CBS_DROPDOWNLIST | CBS_SORT |
|
||||
|
||||
WS_VSCROLL | WS_TABSTOP */
|
||||
|
||||
wxString tok;
|
||||
|
||||
wxString varname;
|
||||
|
||||
varname=GetToken();
|
||||
|
||||
m_controlid++;
|
||||
|
||||
int x,y,width,height;
|
||||
|
||||
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"));
|
||||
|
||||
|
||||
|
||||
|
||||
m_controlid++;
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void rc2wxr::ParseMenu(wxString name)
|
||||
|
||||
{
|
||||
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"));
|
||||
|
||||
wxString tok=wxEmptyString;
|
||||
|
||||
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"));
|
||||
|
||||
|
||||
|
||||
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
|
||||
|
||||
tok=GetToken();
|
||||
|
||||
|
||||
|
||||
while ((tok!=_T("END"))&(tok!=_T("}")))
|
||||
|
||||
{
|
||||
|
||||
tok=GetToken();
|
||||
|
||||
if (tok==_T("POPUP"))
|
||||
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
|
||||
tok=GetToken();
|
||||
|
||||
while ((tok!=_T("END"))&(tok!=_T("}")))
|
||||
{
|
||||
tok=GetToken();
|
||||
|
||||
ParsePopupMenu();
|
||||
|
||||
wxFprintf(m_wxr,_T(" ],\\\n"));
|
||||
|
||||
if (tok==_T("POPUP"))
|
||||
{
|
||||
ParsePopupMenu();
|
||||
wxFprintf(m_wxr,_T(" ],\\\n"));
|
||||
}
|
||||
}
|
||||
|
||||
wxFprintf(m_wxr,_T("]).\";\n\n"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxFprintf(m_wxr,_T("]).\";\n\n"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void rc2wxr::ParsePopupMenu()
|
||||
|
||||
{
|
||||
static int menuitem=99;
|
||||
|
||||
static int menuitem=99;
|
||||
menuitem++;
|
||||
|
||||
menuitem++;
|
||||
|
||||
|
||||
|
||||
wxString tok;
|
||||
|
||||
tok=GetQuoteField();
|
||||
|
||||
int spot;
|
||||
|
||||
//Remove /t because it causes problems
|
||||
|
||||
spot=tok.First(_T("\\t"));
|
||||
|
||||
tok=tok.Left(spot);
|
||||
|
||||
wxFprintf(m_wxr,_T(" ['%s',%i,'',\\\n"),tok.c_str(),menuitem);
|
||||
|
||||
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
|
||||
|
||||
tok=GetToken();
|
||||
|
||||
|
||||
|
||||
while ((tok!=_T("END"))&(tok!=_T("}")))
|
||||
|
||||
{
|
||||
|
||||
tok=GetToken();
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
wxString tok = GetQuoteField();
|
||||
int spot;
|
||||
|
||||
//Remove /t because it causes problems
|
||||
spot=tok.First(_T("\\t"));
|
||||
tok=tok.Left(spot);
|
||||
|
||||
wxFprintf(m_wxr,_T(" ['%s',%i,'',\\\n"),tok.c_str(),menuitem);
|
||||
|
||||
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
|
||||
tok=GetToken();
|
||||
|
||||
while ((tok!=_T("END"))&(tok!=_T("}")))
|
||||
{
|
||||
tok=GetToken();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxString rc2wxr::PeekToken()
|
||||
|
||||
{
|
||||
|
||||
wxString tok;
|
||||
|
||||
int p;
|
||||
|
||||
p=m_rc.Tell();
|
||||
|
||||
tok=GetToken();
|
||||
|
||||
|
||||
|
||||
m_rc.Seek(p);
|
||||
|
||||
return tok;
|
||||
|
||||
wxFileOffset p = m_rc.Tell();
|
||||
wxString tok = GetToken();
|
||||
m_rc.Seek(p);
|
||||
return tok;
|
||||
}
|
||||
|
||||
//Windows pain in the butt CONTROL
|
||||
|
||||
void rc2wxr::ParseControlMS()
|
||||
|
||||
{
|
||||
wxString tok;
|
||||
wxString label=GetQuoteField();
|
||||
wxString varname=GetToken();
|
||||
wxString kindctrl=GetQuoteField();
|
||||
|
||||
wxString label,varname,kindctrl,tok;
|
||||
|
||||
label=GetQuoteField();
|
||||
|
||||
varname=GetToken();
|
||||
|
||||
kindctrl=GetQuoteField();
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/* CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
|
||||
|
||||
TBS_NOTICKS | WS_TABSTOP,52,73,100,15
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
void rc2wxr::ParseSlider(wxString WXUNUSED(label), wxString varname)
|
||||
|
||||
{
|
||||
int x,y,width,height;
|
||||
wxString tok;
|
||||
|
||||
wxString tok;
|
||||
|
||||
while (ReadOrs(tok))
|
||||
;
|
||||
|
||||
wxFprintf(m_wxr,_T(" control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',"),m_controlid,varname.c_str());
|
||||
|
||||
int x,y,width,height;
|
||||
|
||||
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"));
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
CONTROL "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32",
|
||||
|
||||
WS_BORDER,15,52,154,13
|
||||
|
||||
*/
|
||||
|
||||
void rc2wxr::ParseProgressBar(wxString WXUNUSED(label), wxString varname)
|
||||
|
||||
{
|
||||
|
||||
wxString tok;
|
||||
|
||||
while (ReadOrs(tok))
|
||||
;
|
||||
|
||||
wxFprintf(m_wxr,_T(" control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',"),m_controlid,varname.c_str());
|
||||
|
||||
int x,y,width,height;
|
||||
|
||||
ReadRect(x,y,width,height);
|
||||
|
||||
wxFprintf(m_wxr,_T("%i,%i,%i,%i,"),x,y,width,height);
|
||||
|
||||
wxFprintf(m_wxr,_T(" 0, 10,\\\n"));
|
||||
|
||||
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool rc2wxr::ReadOrs(wxString & w)
|
||||
|
||||
{
|
||||
|
||||
wxString tok;
|
||||
|
||||
tok=PeekToken();
|
||||
|
||||
if (tok.IsNumber())
|
||||
|
||||
return false;
|
||||
|
||||
w=GetToken();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Is it a check button or a radio button
|
||||
|
||||
void rc2wxr::ParseCtrlButton(wxString label, wxString varname)
|
||||
|
||||
{
|
||||
|
||||
wxString tok;
|
||||
|
||||
tok=GetToken();
|
||||
|
||||
|
||||
|
||||
m_controlid++;
|
||||
|
||||
int x,y,width,height;
|
||||
|
||||
|
||||
|
||||
if (tok==_T("BS_AUTOCHECKBOX"))
|
||||
|
||||
{
|
||||
|
||||
wxFprintf(m_wxr,_T(" control = [%i,wxCheckBox,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str());
|
||||
int x,y,width,height;
|
||||
wxString tok;
|
||||
|
||||
while (ReadOrs(tok))
|
||||
;
|
||||
|
||||
wxFprintf(m_wxr,_T(" control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',"),m_controlid,varname.c_str());
|
||||
ReadRect(x,y,width,height);
|
||||
|
||||
wxFprintf(m_wxr,_T("%i,%i,%i,%i,0,\\\n"),x,y,width,height);
|
||||
|
||||
wxFprintf(m_wxr,_T("%i,%i,%i,%i,"),x,y,width,height);
|
||||
wxFprintf(m_wxr,_T(" 0, 10,\\\n"));
|
||||
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (tok==_T("BS_AUTORADIOBUTTON"))
|
||||
|
||||
bool rc2wxr::ReadOrs(wxString & w)
|
||||
{
|
||||
|
||||
wxFprintf(m_wxr,_T(" control = [%i,wxRadioButton,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str());
|
||||
|
||||
while(ReadOrs(tok))
|
||||
;
|
||||
|
||||
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"));
|
||||
|
||||
wxString tok = PeekToken();
|
||||
if (tok.IsNumber())
|
||||
return false;
|
||||
w=GetToken();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//Is it a check button or a radio button
|
||||
void rc2wxr::ParseCtrlButton(wxString label, wxString varname)
|
||||
{
|
||||
int x,y,width,height;
|
||||
wxString tok = GetToken();
|
||||
|
||||
m_controlid++;
|
||||
|
||||
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))
|
||||
;
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
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))
|
||||
;
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -146,22 +146,22 @@ microsoft reuses the keyword DIALOG for other things
|
||||
|
||||
while ((token!=_T("BEGIN"))&(token!=_T("{")))
|
||||
{
|
||||
if (token==_T("CAPTION"))
|
||||
if (token==_T("CAPTION"))
|
||||
{
|
||||
title=GetQuoteField();
|
||||
title=GetQuoteField();
|
||||
}
|
||||
|
||||
//TODO fix face name so that it is cross platform name
|
||||
// FONT 8, "MS Sans Serif"
|
||||
if (token==_T("FONT"))
|
||||
{
|
||||
{
|
||||
ptsize=GetToken();
|
||||
face=GetQuoteField();
|
||||
m_xmlfile.Write(_T("\t\t<font>\n"));
|
||||
m_xmlfile.Write(_T("\t\t\t<size>")+ptsize+_T("</size>\n"));
|
||||
m_xmlfile.Write(_T("\t\t\t<face>")+face+_T("</face>\n"));
|
||||
m_xmlfile.Write(_T("\t\t</font>\n"));
|
||||
}
|
||||
}
|
||||
|
||||
token=GetToken();
|
||||
}
|
||||
@ -350,10 +350,10 @@ bool rc2xml::Seperator(int ch)
|
||||
return true;
|
||||
|
||||
if (ch==EOF)
|
||||
{
|
||||
{
|
||||
m_done=true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -477,23 +477,24 @@ wxString rc2xml::GetStringQuote()
|
||||
wxString phrase;
|
||||
//ASCII code 34 "
|
||||
bool done=false;
|
||||
int p,ch=0,lastch=0;
|
||||
int ch=0,lastch=0;
|
||||
ReadChar(ch);
|
||||
|
||||
while (ch!=34)
|
||||
ReadChar(ch);
|
||||
|
||||
ReadChar(ch);
|
||||
while (done==false)
|
||||
{
|
||||
{
|
||||
if ((ch==34)&&(lastch!='\\'))
|
||||
{
|
||||
p=m_rc.Tell();
|
||||
{
|
||||
wxFileOffset p = m_rc.Tell();
|
||||
ReadChar(ch);
|
||||
// RC supports "", for embedded quote, as well as \"
|
||||
// RC supports "", for embedded quote, as well as \"
|
||||
if (ch==34)
|
||||
phrase+='\\';
|
||||
else
|
||||
{
|
||||
{
|
||||
m_rc.Seek(p);
|
||||
done = true;
|
||||
}
|
||||
@ -505,9 +506,10 @@ wxString rc2xml::GetStringQuote()
|
||||
if ((ch=='\n')&&(lastch=='\\')) // lastch <should> be this
|
||||
phrase+='n'; // escape
|
||||
else
|
||||
phrase+=(char)ch;
|
||||
phrase+=(char)ch;
|
||||
|
||||
lastch=ch;
|
||||
ReadChar(ch);
|
||||
ReadChar(ch);
|
||||
}
|
||||
|
||||
return phrase;
|
||||
@ -515,15 +517,14 @@ wxString rc2xml::GetStringQuote()
|
||||
|
||||
void rc2xml::ReadChar(int &ch)
|
||||
{
|
||||
int result;
|
||||
result=m_rc.Tell();
|
||||
wxFileOffset result = m_rc.Tell();
|
||||
|
||||
if((result>=m_filesize))
|
||||
m_done=true;
|
||||
|
||||
result=m_rc.Read(&ch,1);
|
||||
result = m_rc.Read(&ch,1);
|
||||
|
||||
if((result==-1))
|
||||
if( result == wxInvalidOffset )
|
||||
m_done=true;
|
||||
|
||||
if(ch==EOF)
|
||||
|
Loading…
Reference in New Issue
Block a user