Applied patch [ 843965 ] RC/WXRC/XML related contribs and utils cleaning

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-12-11 11:27:56 +00:00
parent dacaa6f142
commit 19d0f58d39
14 changed files with 589 additions and 591 deletions

View File

@@ -206,7 +206,6 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
// save state
wxSizer *old_par = m_parentSizer;
bool old_ins = m_isInside;
bool old_gbs = m_isGBS;
// set new state
m_parentSizer = sizer;
@@ -216,7 +215,6 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
CreateChildren(m_parent, TRUE/*only this handler*/);
// restore state
old_gbs = m_isGBS;
m_isInside = old_ins;
m_parentSizer = old_par;

View File

@@ -59,6 +59,8 @@ wxObject *wxWizardXmlHandler::DoCreateResource()
else
{
wxWizardPage *page = NULL;
wxUnusedVar(page);
if (m_class == wxT("wxWizardPageSimple"))
{
XRC_MAKE_INSTANCE(p, wxWizardPageSimple)

View File

@@ -324,6 +324,7 @@ bool wxXmlResource::UpdateResources()
bool modif;
# if wxUSE_FILESYSTEM
wxFSFile *file = NULL;
wxUnusedVar(file);
wxFileSystem fsys;
# endif
@@ -353,6 +354,7 @@ bool wxXmlResource::UpdateResources()
rt = false;
}
wxDELETE(file);
wxUnusedVar(file);
# else
modif = wxDateTime(wxFileModificationTime(m_data[i].File)) > m_data[i].Time;
# endif
@@ -413,6 +415,7 @@ bool wxXmlResource::UpdateResources()
# if wxUSE_FILESYSTEM
wxDELETE(file);
wxUnusedVar(file);
# else
wxDELETE(stream);
# endif
@@ -1180,14 +1183,12 @@ static int XRCID_Lookup(const wxChar *str_id, int value_if_not_found = -2)
index %= XRCID_TABLE_SIZE;
XRCID_record *oldrec = NULL;
int matchcnt = 0;
for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next)
{
if (wxStrcmp(rec->key, str_id) == 0)
{
return rec->id;
}
matchcnt++;
oldrec = rec;
}

View File

@@ -55,14 +55,14 @@ bool wxConvertApp::OnInit()
{
//Initialize all image loaders(JPEG,BMP,PNG,and etc)
wxInitAllImageHandlers();
SetAppName("wxConvertApp");
SetAppName(_T("wxConvertApp"));
if (HandleCommandLine())
return TRUE;
// Create the main frame window
m_pFrame = new wxMainFrame(NULL, -1, "wxConvertApp", wxPoint(0, 0), wxSize(500, 400),
m_pFrame = new wxMainFrame(NULL, -1, _T("wxConvertApp"), wxPoint(0, 0), wxSize(500, 400),
wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
InitMenu();
@@ -77,12 +77,12 @@ void wxConvertApp::InitMenu()
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_RC2WXR,_T("Convert RC file to WXR file"));
filemenu->Append(ID_WXR2XML,_T("Convert WXR file to XML file"));
filemenu->Append(ID_RC2XML,_T("Convert RC file to XML file"));
filemenu->Append(ID_QUIT, "E&xit");
m_pMenuBar->Append(filemenu,"&File");
filemenu->Append(ID_QUIT, _T("E&xit"));
m_pMenuBar->Append(filemenu,_T("&File"));
m_pFrame->SetMenuBar(m_pMenuBar);
}
@@ -120,25 +120,25 @@ wxMainFrame::~wxMainFrame()
void wxMainFrame::OnQuit()
void wxMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
void wxMainFrame::OnRc2Wxr()
void wxMainFrame::OnRc2Wxr(wxCommandEvent& WXUNUSED(event))
{
wxFileDialog filed(this);
filed.SetWildcard("*.rc");
filed.SetWildcard(_T("*.rc"));
filed.SetStyle(wxOPEN);
if (filed.ShowModal()!=wxID_OK)
return;
wxFileDialog wxrfile(this,"Enter Desired WXR file name");
wxrfile.SetWildcard("*.wxr");
wxFileDialog wxrfile(this,_T("Enter Desired WXR file name"));
wxrfile.SetWildcard(_T("*.wxr"));
wxrfile.SetStyle(wxOPEN);
wxrfile.SetFilename("resource.wxr");
wxrfile.SetFilename(_T("resource.wxr"));
if (wxrfile.ShowModal()!=wxID_OK)
return;
@@ -147,18 +147,18 @@ void wxMainFrame::OnRc2Wxr()
convert.Convert(wxrfile.GetPath(),filed.GetPath());
}
void wxMainFrame::OnWXR2XML()
void wxMainFrame::OnWXR2XML(wxCommandEvent& WXUNUSED(event))
{
wxFileDialog f(this);
f.SetWildcard("*.wxr");
f.SetWildcard(_T("*.wxr"));
if (f.ShowModal()!=wxID_OK)
return;
wxFileDialog xmlfile(this,"Enter Desired XML file name");
xmlfile.SetWildcard("*.xml");
wxFileDialog xmlfile(this,_T("Enter Desired XML file name"));
xmlfile.SetWildcard(_T("*.xml"));
xmlfile.SetStyle(wxOPEN);
xmlfile.SetFilename("resource.xml");
xmlfile.SetFilename(_T("resource.xml"));
if (xmlfile.ShowModal()!=wxID_OK)
return;
@@ -168,17 +168,17 @@ void wxMainFrame::OnWXR2XML()
}
void wxMainFrame::OnRC2XML()
void wxMainFrame::OnRC2XML(wxCommandEvent& WXUNUSED(event))
{
wxFileDialog f(this);
f.SetWildcard("*.rc");
f.SetWildcard(_T("*.rc"));
if (f.ShowModal()!=wxID_OK)
return;
wxFileDialog xmlfile(this,"Enter Desired XML file name");
xmlfile.SetWildcard("*.xml");
wxFileDialog xmlfile(this,_T("Enter Desired XML file name"));
xmlfile.SetWildcard(_T("*.xml"));
xmlfile.SetStyle(wxOPEN);
xmlfile.SetFilename("resource.xml");
xmlfile.SetFilename(_T("resource.xml"));
if (xmlfile.ShowModal()!=wxID_OK)
return;
@@ -205,17 +205,17 @@ bool wxConvertApp::HandleCommandLine()
target=argv[2];
if ((source.Find(".wxr")>0)&&(target.Find(".xml")>0))
if ((source.Find(_T(".wxr"))>0)&&(target.Find(_T(".xml"))>0))
{
trans_wxr2xml.Convert(source,target);
return TRUE;
}
else if ((source.Find(".rc")!=-1)&(target.Find(".wxr")!=-1))
else if ((source.Find(_T(".rc"))!=-1)&(target.Find(_T(".wxr"))!=-1))
{
trans_rc2wxr.Convert(source,target);
return TRUE;
}
else if ((source.Find(".rc")!=-1)&(target.Find(".xml")!=-1))
else if ((source.Find(_T(".rc"))!=-1)&(target.Find(_T(".xml"))!=-1))
{
trans_rc2xml.Convert(source,target);
return TRUE;

View File

@@ -17,14 +17,14 @@
class wxMainFrame:public wxFrame
{
public:
void OnRC2XML();
void OnWXR2XML();
void OnRc2Wxr();
void OnQuit();
void OnRC2XML(wxCommandEvent& event);
void OnWXR2XML(wxCommandEvent& event);
void OnRc2Wxr(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
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");
const wxString& name = _T("frame"));
virtual ~wxMainFrame();
protected:

View File

@@ -103,7 +103,7 @@ m_rc.Open(rcfile);
m_filesize=m_rc.Length();
if( (m_wxr = fopen( wxrfile, "wt" )) == NULL )
if( (m_wxr = wxFopen( wxrfile, _T("wt") )) == NULL )
{
@@ -131,7 +131,7 @@ tok=GetToken();
if (tok=="DIALOG")
if (tok==_T("DIALOG"))
{
@@ -143,7 +143,7 @@ ParseDialog(prevtok);
if (tok=="MENU")
if (tok==_T("MENU"))
{
@@ -233,7 +233,7 @@ tok=PeekToken();
//Microsoft notation?
if (tok=="DISCARDABLE")
if (tok==_T("DISCARDABLE"))
{
@@ -251,15 +251,15 @@ if (!tok.IsNumber())
//Generate Dialog text
fprintf(m_wxr,"static char *dialog%i = \"dialog(name = '%s',\\\n",dlgid,dlgname.c_str());
wxFprintf(m_wxr,_T("static char *dialog%i = \"dialog(name = '%s',\\\n"),dlgid,dlgname.c_str());
//be lazy about style for now. add it later
fprintf(m_wxr,"style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\\\n");
wxFprintf(m_wxr,_T("style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\\\n"));
fprintf(m_wxr,"id = %i,\\\n",dlgid);
wxFprintf(m_wxr,_T("id = %i,\\\n"),dlgid);
@@ -269,7 +269,7 @@ int x,y,width,height;
ReadRect(x,y,width,height);
fprintf(m_wxr,"x = %i, y = %i, width = %i, height = %i,\\\n",x,y,width,height);
wxFprintf(m_wxr,_T("x = %i, y = %i, width = %i, height = %i,\\\n"),x,y,width,height);
@@ -285,17 +285,17 @@ wxString title;
while ((tok!="BEGIN")&(tok!="{"))
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
{
if (tok=="CAPTION")
if (tok==_T("CAPTION"))
{
title=GetQuoteField();
fprintf(m_wxr,"title = '%s',\\\n",title.c_str());
wxFprintf(m_wxr,_T("title = '%s',\\\n"),title.c_str());
}
@@ -303,17 +303,17 @@ tok=GetToken();
}
fprintf(m_wxr,"use_dialog_units = 1,\\\n");
wxFprintf(m_wxr,_T("use_dialog_units = 1,\\\n"));
fprintf(m_wxr,"use_system_defaults = 0,\\\n");
wxFprintf(m_wxr,_T("use_system_defaults = 0,\\\n"));
fprintf(m_wxr,"font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\\\n");
wxFprintf(m_wxr,_T("font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\\\n"));
ParseControls();
fprintf(m_wxr,").\";\n\n");
wxFprintf(m_wxr,_T(").\";\n\n"));
}
@@ -351,35 +351,35 @@ wxString tok;
tok=GetToken();
while ((tok!="END")&(tok!="}"))
while ((tok!=_T("END"))&(tok!=_T("}")))
{
if (tok=="LTEXT")
if (tok==_T("LTEXT"))
ParseStaticText();
if (tok=="EDITTEXT")
if (tok==_T("EDITTEXT"))
ParseTextCtrl();
if (tok=="PUSHBUTTON")
if (tok==_T("PUSHBUTTON"))
ParsePushButton();
if (tok=="DEFPUSHBUTTON")
if (tok==_T("DEFPUSHBUTTON"))
ParsePushButton();
if (tok=="GROUPBOX")
if (tok==_T("GROUPBOX"))
ParseGroupBox();
if (tok=="COMBOBOX")
if (tok==_T("COMBOBOX"))
ParseComboBox();
if (tok=="CONTROL")
if (tok==_T("CONTROL"))
ParseControlMS();
@@ -413,11 +413,11 @@ int x,y,width,height;
ReadRect(x,y,width,height);
fprintf(m_wxr," control = [%i,wxStaticText,'%s','0','%s',",m_controlid,phrase.c_str(),varname.c_str());
wxFprintf(m_wxr,_T(" control = [%i,wxStaticText,'%s','0','%s',"),m_controlid,phrase.c_str(),varname.c_str());
fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height);
wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);
fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
}
@@ -439,11 +439,11 @@ int x,y,width,height;
ReadRect(x,y,width,height);
fprintf(m_wxr," control = [%i,wxTextCtrl,'','0','%s',",m_controlid,varname.c_str());
wxFprintf(m_wxr,_T(" control = [%i,wxTextCtrl,'','0','%s',"),m_controlid,varname.c_str());
fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height);
wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);
fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
@@ -469,19 +469,19 @@ m_controlid++;
c=m_controlid;
if (varname=="IDOK")
if (varname==_T("IDOK"))
c=wxID_OK;
if (varname=="IDCANCEL")
if (varname==_T("IDCANCEL"))
c=wxID_CANCEL;
if (varname=="IDAPPLY")
if (varname==_T("IDAPPLY"))
c=wxID_APPLY;
@@ -491,11 +491,11 @@ int x,y,width,height;
ReadRect(x,y,width,height);
fprintf(m_wxr," control = [%i,wxButton,'%s','0','%s',",c,phrase.c_str(),varname.c_str());
wxFprintf(m_wxr,_T(" control = [%i,wxButton,'%s','0','%s',"),c,phrase.c_str(),varname.c_str());
fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height);
wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);
fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
@@ -551,11 +551,11 @@ int x,y,width,height;
ReadRect(x,y,width,height);
fprintf(m_wxr," control = [%i,wxStaticBox,'%s','0','%s',",m_controlid,phrase.c_str(),varname.c_str());
wxFprintf(m_wxr,_T(" control = [%i,wxStaticBox,'%s','0','%s',"),m_controlid,phrase.c_str(),varname.c_str());
fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height);
wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height);
fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
@@ -569,13 +569,13 @@ void rc2wxr::ReadRect(int & x, int & y, int & width, int & height)
{
x=atoi(GetToken());
x=wxAtoi(GetToken());
y=atoi(GetToken());
y=wxAtoi(GetToken());
width=atoi(GetToken());
width=wxAtoi(GetToken());
height=atoi(GetToken());
height=wxAtoi(GetToken());
@@ -587,7 +587,7 @@ wxString rc2wxr::GetToken()
{
wxString tok="";
wxString tok=wxEmptyString;
@@ -771,11 +771,11 @@ ReadRect(x,y,width,height);
fprintf(m_wxr," control = [%i,wxChoice,'','0','%s',",m_controlid,varname.c_str());
wxFprintf(m_wxr,_T(" control = [%i,wxChoice,'','0','%s',"),m_controlid,varname.c_str());
fprintf(m_wxr,"%i,%i,%i,%i,[],\\\n",x,y,width,height);
wxFprintf(m_wxr,_T("%i,%i,%i,%i,[],\\\n"),x,y,width,height);
fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
@@ -789,39 +789,39 @@ void rc2wxr::ParseMenu(wxString name)
{
wxString tok="";
wxString tok=wxEmptyString;
static int menuid=0;
menuid++;
fprintf(m_wxr,"static char *MenuBar%i = \"menu(name = '%s',\\\n",menuid,name.c_str());
wxFprintf(m_wxr,_T("static char *MenuBar%i = \"menu(name = '%s',\\\n"),menuid,name.c_str());
fprintf(m_wxr,"menu = \\\n");
wxFprintf(m_wxr,_T("menu = \\\n"));
fprintf(m_wxr,"[\\\n");
wxFprintf(m_wxr,_T("[\\\n"));
while ((tok!="BEGIN")&(tok!="{"))
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
tok=GetToken();
while ((tok!="END")&(tok!="}"))
while ((tok!=_T("END"))&(tok!=_T("}")))
{
tok=GetToken();
if (tok=="POPUP")
if (tok==_T("POPUP"))
{
ParsePopupMenu();
fprintf(m_wxr," ],\\\n");
wxFprintf(m_wxr,_T(" ],\\\n"));
}
@@ -829,7 +829,7 @@ if (tok=="POPUP")
fprintf(m_wxr,"]).\";\n\n");
wxFprintf(m_wxr,_T("]).\";\n\n"));
}
@@ -853,31 +853,31 @@ int spot;
//Remove /t because it causes problems
spot=tok.First("\\t");
spot=tok.First(_T("\\t"));
tok=tok.Left(spot);
fprintf(m_wxr," ['%s',%i,'',\\\n",tok.c_str(),menuitem);
wxFprintf(m_wxr,_T(" ['%s',%i,'',\\\n"),tok.c_str(),menuitem);
while ((tok!="BEGIN")&(tok!="{"))
while ((tok!=_T("BEGIN"))&(tok!=_T("{")))
tok=GetToken();
while ((tok!="END")&(tok!="}"))
while ((tok!=_T("END"))&(tok!=_T("}")))
{
tok=GetToken();
if (tok=="MENUITEM")
if (tok==_T("MENUITEM"))
{
if (PeekToken()=="SEPARATOR")
if (PeekToken()==_T("SEPARATOR"))
fprintf(m_wxr," [],\\\n");
wxFprintf(m_wxr,_T(" [],\\\n"));
else
@@ -887,13 +887,13 @@ tok=GetQuoteField();
//Remove /t because it causes problems
spot=tok.First("\\t");
spot=tok.First(_T("\\t"));
tok=tok.Left(spot);
menuitem++;
fprintf(m_wxr," ['%s',%i,''],\\\n",tok.c_str(),menuitem);
wxFprintf(m_wxr,_T(" ['%s',%i,''],\\\n"),tok.c_str(),menuitem);
}
@@ -951,15 +951,15 @@ kindctrl.MakeUpper();
if (kindctrl=="MSCTLS_TRACKBAR32")
if (kindctrl==_T("MSCTLS_TRACKBAR32"))
ParseSlider(label,varname);
if (kindctrl=="MSCTLS_PROGRESS32")
if (kindctrl==_T("MSCTLS_PROGRESS32"))
ParseProgressBar(label,varname);
if (kindctrl=="BUTTON")
if (kindctrl==_T("BUTTON"))
ParseCtrlButton(label,varname);
@@ -973,7 +973,7 @@ if (kindctrl=="BUTTON")
void rc2wxr::ParseSlider(wxString label, wxString varname)
void rc2wxr::ParseSlider(wxString WXUNUSED(label), wxString varname)
{
@@ -981,17 +981,17 @@ wxString tok;
while (ReadOrs(tok));
fprintf(m_wxr," control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',",m_controlid,varname.c_str());
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);
fprintf(m_wxr,"%i,%i,%i,%i,",x,y,width,height);
wxFprintf(m_wxr,_T("%i,%i,%i,%i,"),x,y,width,height);
fprintf(m_wxr," 1, 1, 10,\\\n");
wxFprintf(m_wxr,_T(" 1, 1, 10,\\\n"));
fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
}
@@ -1003,7 +1003,7 @@ CONTROL "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32",
*/
void rc2wxr::ParseProgressBar(wxString label, wxString varname)
void rc2wxr::ParseProgressBar(wxString WXUNUSED(label), wxString varname)
{
@@ -1011,17 +1011,17 @@ wxString tok;
while (ReadOrs(tok));
fprintf(m_wxr," control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',",m_controlid,varname.c_str());
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);
fprintf(m_wxr,"%i,%i,%i,%i,",x,y,width,height);
wxFprintf(m_wxr,_T("%i,%i,%i,%i,"),x,y,width,height);
fprintf(m_wxr," 0, 10,\\\n");
wxFprintf(m_wxr,_T(" 0, 10,\\\n"));
fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
}
@@ -1065,37 +1065,37 @@ int x,y,width,height;
if (tok=="BS_AUTOCHECKBOX")
if (tok==_T("BS_AUTOCHECKBOX"))
{
fprintf(m_wxr," control = [%i,wxCheckBox,'%s','0','%s',",m_controlid,label.c_str(),varname.c_str());
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);
fprintf(m_wxr,"%i,%i,%i,%i,0,\\\n",x,y,width,height);
wxFprintf(m_wxr,_T("%i,%i,%i,%i,0,\\\n"),x,y,width,height);
fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
}
if (tok=="BS_AUTORADIOBUTTON")
if (tok==_T("BS_AUTORADIOBUTTON"))
{
fprintf(m_wxr," control = [%i,wxRadioButton,'%s','0','%s',",m_controlid,label.c_str(),varname.c_str());
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);
fprintf(m_wxr,"%i,%i,%i,%i,0,\\\n",x,y,width,height);
wxFprintf(m_wxr,_T("%i,%i,%i,%i,0,\\\n"),x,y,width,height);
fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n");
wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"));
}

File diff suppressed because it is too large Load Diff

View File

@@ -45,20 +45,20 @@ wxr2xml::~wxr2xml()
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");
result = m_xmlfile.Open(xmlfile.c_str(), _T("w+t"));
wxASSERT_MSG(result, _T("Couldn't create XML file"));
if (!result)
return FALSE;
result = m_table.ParseResourceFile(wxrfile);
wxASSERT_MSG(result, "Couldn't Load WXR file");
wxASSERT_MSG(result, _T("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");
m_xmlfile.Write(_T("<?xml version=\"1.0\" ?>\n"));
m_xmlfile.Write(_T("<resource>\n"));
result = ParseResources();
m_xmlfile.Write("</resource>\n");
m_xmlfile.Write(_T("</resource>\n"));
m_xmlfile.Close();
@@ -70,89 +70,91 @@ bool wxr2xml::ParseResources()
m_table.BeginFind();
wxNode *node;
while ((node = m_table.Next()))
node = m_table.Next();
while (node)
{
wxItemResource *res = (wxItemResource *) node->Data();
wxItemResource *res = (wxItemResource *) node->GetData();
wxString resType(res->GetType());
if (resType == "wxDialog")
if (resType == _T("wxDialog"))
ParseDialog(res);
else if (resType == "wxPanel")
else if (resType == _T("wxPanel"))
ParsePanel(res);
else if (resType == "wxPanel")
else if (resType == _T("wxPanel"))
ParsePanel(res);
else if (resType == "wxMenu")
else if (resType == _T("wxMenu"))
ParseMenuBar(res);
else if (resType == "wxBitmap")
else if (resType == _T("wxBitmap"))
ParseBitmap(res);
else
wxLogError("Found unsupported resource " + resType);
wxLogError(_T("Found unsupported resource ") + resType);
node = m_table.Next();
}
return TRUE;
}
void wxr2xml::ParsePanel(wxItemResource * res)
{
m_xmlfile.Write("\t<object class=\"wxPanel\"");
m_xmlfile.Write(_T("\t<object class=\"wxPanel\""));
PanelStuff(res);
WriteControlInfo(res);
m_xmlfile.Write("\n");
m_xmlfile.Write(_T("\n"));
ParseControls(res);
m_xmlfile.Write("\t</object>\n\n");
m_xmlfile.Write(_T("\t</object>\n\n"));
}
void wxr2xml::ParseDialog(wxItemResource * res)
{
PanelStuff(res);
m_xmlfile.Write("\t<object class=\"wxDialog\"");
m_xmlfile.Write(_T("\t<object class=\"wxDialog\""));
WriteControlInfo(res);
m_xmlfile.Write(GetTitle(res));
m_xmlfile.Write("\n");
m_xmlfile.Write(_T("\n"));
ParseControls(res);
m_xmlfile.Write("\t</object>\n\n");
m_xmlfile.Write(_T("\t</object>\n\n"));
}
void wxr2xml::ParseControls(wxItemResource * res)
{
wxNode *node = res->GetChildren().First();
wxNode *node = res->GetChildren().GetFirst();
while (node)
{
wxItemResource *res = (wxItemResource *) node->Data();
wxItemResource *res = (wxItemResource *) node->GetData();
wxString resType(res->GetType());
if (resType == "wxButton")
if (resType == _T("wxButton"))
ParseButton(res);
else if ((resType == "wxTextCtrl") | (resType == "wxText")
| (resType == "wxMultiText"))
else if ((resType == _T("wxTextCtrl")) | (resType == _T("wxText"))
| (resType == _T("wxMultiText")))
ParseTextCtrl(res);
else if (resType == "wxCheckBox")
else if (resType == _T("wxCheckBox"))
ParseCheckBox(res);
else if (resType == "wxRadioBox")
else if (resType == _T("wxRadioBox"))
ParseRadioBox(res);
else if (resType == "wxListBox")
else if (resType == _T("wxListBox"))
ParseListBox(res);
else if ((resType == "wxStaticText") | (resType == "wxMessage"))
else if ((resType == _T("wxStaticText")) | (resType == _T("wxMessage")))
ParseStaticText(res);
else if (resType == "wxChoice")
else if (resType == _T("wxChoice"))
ParseChoice(res);
else if (resType == "wxGauge")
else if (resType == _T("wxGauge"))
ParseGauge(res);
else if (resType == "wxSlider")
else if (resType == _T("wxSlider"))
ParseSlider(res);
else if (resType == "wxComboBox")
else if (resType == _T("wxComboBox"))
ParseComboBox(res);
else if (resType == "wxRadioButton")
else if (resType == _T("wxRadioButton"))
ParseRadioButton(res);
else if (resType == "wxStaticBitmap")
else if (resType == _T("wxStaticBitmap"))
ParseStaticBitmap(res);
else if (resType == "wxScrollBar")
else if (resType == _T("wxScrollBar"))
ParseScrollBar(res);
else if ((resType == "wxStaticBox") | (resType == "wxGroupBox"))
else if ((resType == _T("wxStaticBox")) | (resType == _T("wxGroupBox")))
ParseStaticBox(res);
else if (resType == "wxBitmapButton")
else if (resType == _T("wxBitmapButton"))
ParseBitmapButton(res);
else
wxLogError("Found unsupported resource " + resType);
node = node->Next();
wxLogError(_T("Found unsupported resource ") + resType);
node = node->GetNext();
}
}
@@ -161,7 +163,7 @@ void wxr2xml::ParseControls(wxItemResource * res)
void wxr2xml::WriteControlInfo(wxItemResource * res)
{
m_xmlfile.Write(GenerateName(res));
m_xmlfile.Write(">\n");
m_xmlfile.Write(_T(">\n"));
m_xmlfile.Write(GetPosition(res));
m_xmlfile.Write(GetSize(res));
m_xmlfile.Write(GetStyles(res));
@@ -172,9 +174,9 @@ wxString wxr2xml::GetSize(wxItemResource * res)
{
wxString msg;
if (m_dlgunits)
msg << "\t\t\t\t<size>" << res->GetWidth() << "," << res->GetHeight() << "d</size>\n";
msg << _T("\t\t\t\t<size>") << res->GetWidth() << _T(",") << res->GetHeight() << _T("d</size>\n");
else
msg << "\t\t\t\t<size>" << res->GetWidth() << "," << res->GetHeight() << "</size>\n";
msg << _T("\t\t\t\t<size>") << res->GetWidth() << _T(",") << res->GetHeight() << _T("</size>\n");
return msg;
}
@@ -182,196 +184,196 @@ wxString wxr2xml::GetPosition(wxItemResource * res)
{
wxString msg;
if (m_dlgunits)
msg << "\t\t\t\t<pos>" << res->GetX() << "," << res->GetY() << "d</pos>\n";
msg << _T("\t\t\t\t<pos>") << res->GetX() << _T(",") << res->GetY() << _T("d</pos>\n");
else
msg << "\t\t\t\t<pos>" << res->GetX() << "," << res->GetY() << "</pos>\n";
msg << _T("\t\t\t\t<pos>") << res->GetX() << _T(",") << res->GetY() << _T("</pos>\n");
return msg;
}
void wxr2xml::ParseButton(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxButton\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxButton\""));
WriteControlInfo(res);
m_xmlfile.Write(GetLabel(res));
m_xmlfile.Write("\t\t\t</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
void wxr2xml::ParseTextCtrl(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxTextCtrl\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxTextCtrl\""));
WriteControlInfo(res);
m_xmlfile.Write(GetValue4(res));
m_xmlfile.Write("\t\t\t</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
wxString wxr2xml::GetTitle(wxItemResource * res)
{
wxString msg;
msg = _T("\t\t\t\t<title>" + res->GetTitle() + "</title>");
msg = _T("\t\t\t\t<title>") + res->GetTitle() + _T("</title>");
return msg;
}
wxString wxr2xml::GetValue4(wxItemResource * res)
{
wxString msg;
msg = _T("\t\t\t\t<value>" + res->GetValue4() + "</value>\n");
msg = _T("\t\t\t\t<value>") + res->GetValue4() + _T("</value>\n");
return msg;
}
void wxr2xml::ParseCheckBox(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxCheckBox\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxCheckBox\""));
WriteControlInfo(res);
m_xmlfile.Write(GetLabel(res));
m_xmlfile.Write(GetCheckStatus(res));
m_xmlfile.Write("\t\t\t</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
wxString wxr2xml::GetLabel(wxItemResource * res)
{
return _T("\t\t\t\t<label>" + res->GetTitle() + "</label>\n");
return _T("\t\t\t\t<label>") + res->GetTitle() + _T("</label>\n");
}
void wxr2xml::ParseRadioBox(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxRadioBox\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxRadioBox\""));
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</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
void wxr2xml::ParseListBox(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxListBox\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxListBox\""));
WriteControlInfo(res);
WriteStringList(res);
m_xmlfile.Write("\t\t\t</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
void wxr2xml::ParseStaticText(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxStaticText\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxStaticText\""));
WriteControlInfo(res);
m_xmlfile.Write(GetLabel(res));
m_xmlfile.Write("\t\t\t</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
void wxr2xml::ParseStaticBox(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxStaticBox\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxStaticBox\""));
WriteControlInfo(res);
m_xmlfile.Write(GetLabel(res));
m_xmlfile.Write("\t\t\t</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
void wxr2xml::WriteStringList(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t\t<content>\n");
m_xmlfile.Write(_T("\t\t\t\t<content>\n"));
for (wxStringListNode * node = res->GetStringValues().GetFirst();
node;node = node->GetNext()) {
const wxString s1 = node->GetData();
m_xmlfile.Write("\t\t\t\t\t<item>" + s1 + "</item>\n");
m_xmlfile.Write(_T("\t\t\t\t\t<item>") + s1 + _T("</item>\n"));
}
m_xmlfile.Write("\t\t\t\t</content>\n");
m_xmlfile.Write(_T("\t\t\t\t</content>\n"));
}
void wxr2xml::ParseChoice(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxChoice\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxChoice\""));
WriteControlInfo(res);
// Add choice items
WriteStringList(res);
m_xmlfile.Write("\t\t\t</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
void wxr2xml::ParseGauge(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxGauge\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxGauge\""));
WriteControlInfo(res);
m_xmlfile.Write(GetValue1(res));
m_xmlfile.Write(GetRange(res));
m_xmlfile.Write("\n\t\t\t</object>\n");
m_xmlfile.Write(_T("\n\t\t\t</object>\n"));
}
wxString wxr2xml::GetValue1(wxItemResource * res)
{
wxString msg;
msg << "\t\t\t\t<value>" << res->GetValue1() << "</value>\n";
msg << _T("\t\t\t\t<value>") << res->GetValue1() << _T("</value>\n");
return msg;
}
wxString wxr2xml::GetRange(wxItemResource * res)
{
wxString msg;
msg << "\t\t\t\t<range>" << res->GetValue2() << "</range>";
msg << _T("\t\t\t\t<range>") << res->GetValue2() << _T("</range>");
return msg;
}
void wxr2xml::ParseSlider(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxSlider\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxSlider\""));
WriteControlInfo(res);
m_xmlfile.Write(GetValue1(res));
m_xmlfile.Write(GetMax(res));
m_xmlfile.Write(GetMin(res));
m_xmlfile.Write("\n\t\t\t</object>\n");
m_xmlfile.Write(_T("\n\t\t\t</object>\n"));
}
wxString wxr2xml::GetMax(wxItemResource * res)
{
wxString msg;
msg << "\t\t\t\t<max>" << res->GetValue3() << "</max>\n";
msg << _T("\t\t\t\t<max>") << res->GetValue3() << _T("</max>\n");
return msg;
}
wxString wxr2xml::GetMin(wxItemResource * res)
{
wxString msg;
msg << "\t\t\t\t<min>" << res->GetValue2() << "</min>";
msg << _T("\t\t\t\t<min>") << res->GetValue2() << _T("</min>");
return msg;
}
void wxr2xml::ParseComboBox(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxComboBox\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxComboBox\""));
WriteControlInfo(res);
// Add combo items
WriteStringList(res);
m_xmlfile.Write("\n\t\t\t</object>\n");
m_xmlfile.Write(_T("\n\t\t\t</object>\n"));
}
void wxr2xml::ParseRadioButton(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxRadioButton\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxRadioButton\""));
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</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
void wxr2xml::ParseScrollBar(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxScrollBar\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxScrollBar\""));
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</object>\n");
m_xmlfile.Write(_T("\t\t\t\t<thumbsize>")+GetValue2(res)+_T("</thumbsize>\n"));
m_xmlfile.Write(_T("\t\t\t\t<range>")+GetValue3(res)+_T("</range>\n"));
m_xmlfile.Write(_T("\t\t\t\t<pagesize>")+GetValue5(res)+_T("</pagesize>\n"));
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
wxString wxr2xml::GetCheckStatus(wxItemResource * res)
{
wxString msg;
msg << "\t\t\t\t<checked>" << res->GetValue1() << "</checked>\n";
msg << _T("\t\t\t\t<checked>") << res->GetValue1() << _T("</checked>\n");
return msg;
}
@@ -383,158 +385,158 @@ wxString wxr2xml::GetStyles(wxItemResource * res)
restype = res->GetType();
style = res->GetStyle();
s = "\t\t\t\t<style>";
s = _T("\t\t\t\t<style>");
// Common styles for all controls
if (style & wxSIMPLE_BORDER)
s += "wxSIMPLE_BORDER|";
s += _T("wxSIMPLE_BORDER|");
if (style & wxSUNKEN_BORDER)
s += "wxSUNKEN_BORDER|";
s += _T("wxSUNKEN_BORDER|");
if (style & wxSIMPLE_BORDER)
s += "wxSIMPLE_BORDER|";
s += _T("wxSIMPLE_BORDER|");
if (style & wxDOUBLE_BORDER)
s += "wxDOUBLE_BORDER|";
s += _T("wxDOUBLE_BORDER|");
if (style & wxRAISED_BORDER)
s += "wxRAISED_BORDER|";
s += _T("wxRAISED_BORDER|");
if (style & wxTRANSPARENT_WINDOW)
s += "wxTRANSPARENT_WINDOW|";
s += _T("wxTRANSPARENT_WINDOW|");
if (style & wxWANTS_CHARS)
s += "wxWANTS_CHARS|";
s += _T("wxWANTS_CHARS|");
if (style & wxNO_FULL_REPAINT_ON_RESIZE)
s += "wxNO_FULL_REPAINT_ON_RESIZE|";
s += _T("wxNO_FULL_REPAINT_ON_RESIZE|");
if (restype == "wxDialog")
if (restype == _T("wxDialog"))
{
if (style & wxDIALOG_MODAL)
s += "wxDIALOG_MODAL|";
s += _T("wxDIALOG_MODAL|");
if (style & wxDEFAULT_DIALOG_STYLE)
s += "wxDEFAULT_DIALOG_STYLE|";
s += _T("wxDEFAULT_DIALOG_STYLE|");
if (style & wxDIALOG_MODELESS)
s += "wxDIALOG_MODELESS|";
s += _T("wxDIALOG_MODELESS|");
if (style & wxNO_3D)
s += "wxNO_3D|";
s += _T("wxNO_3D|");
if (style & wxTAB_TRAVERSAL)
s += "wxTAB_TRAVERSAL|";
s += _T("wxTAB_TRAVERSAL|");
if (style & wxWS_EX_VALIDATE_RECURSIVELY)
s += "wxWS_EX_VALIDATE_RECURSIVELY|";
s += _T("wxWS_EX_VALIDATE_RECURSIVELY|");
if (style & wxSTAY_ON_TOP)
s += "wxSTAY_ON_TOP|";
s += _T("wxSTAY_ON_TOP|");
if (style & wxCAPTION)
s += "wxCAPTION|";
s += _T("wxCAPTION|");
if (style & wxTHICK_FRAME)
s += "wxTHICK_FRAME|";
s += _T("wxTHICK_FRAME|");
if (style & wxRESIZE_BOX)
s += "wxRESIZE_BOX|";
s += _T("wxRESIZE_BOX|");
if (style & wxRESIZE_BORDER)
s += "wxRESIZE_BORDER|";
s += _T("wxRESIZE_BORDER|");
if (style & wxSYSTEM_MENU)
s += "wxSYSTEM_MENU|";
s += _T("wxSYSTEM_MENU|");
if (style & wxCLIP_CHILDREN)
s += "wxCLIP_CHILDREN|";
s += _T("wxCLIP_CHILDREN|");
}
if (restype == "wxPanel")
if (restype == _T("wxPanel"))
{
if (style & wxCLIP_CHILDREN)
s += "wxCLIP_CHILDREN|";
s += _T("wxCLIP_CHILDREN|");
if (style & wxNO_3D)
s += "wxNO_3D|";
s += _T("wxNO_3D|");
if (style & wxTAB_TRAVERSAL)
s += "wxTAB_TRAVERSAL|";
s += _T("wxTAB_TRAVERSAL|");
if (style & wxWS_EX_VALIDATE_RECURSIVELY)
s += "wxWS_EX_VALIDATE_RECURSIVELY|";
s += _T("wxWS_EX_VALIDATE_RECURSIVELY|");
}
if (restype == "wxComboBox")
if (restype == _T("wxComboBox"))
{
if (style & wxCB_SORT)
s += "wxCB_SORT|";
s += _T("wxCB_SORT|");
if (style & wxCB_SIMPLE)
s += "wxCB_SIMPLE|";
s += _T("wxCB_SIMPLE|");
if (style & wxCB_READONLY)
s += "wxCB_READONLY|";
s += _T("wxCB_READONLY|");
if (style & wxCB_DROPDOWN)
s += "wxCB_DROPDOWN|";
s += _T("wxCB_DROPDOWN|");
}
if (restype == "wxGauge")
if (restype == _T("wxGauge"))
{
if (style & wxGA_HORIZONTAL)
s += "wxGA_HORIZONTAL|";
s += _T("wxGA_HORIZONTAL|");
if (style & wxGA_VERTICAL)
s += "wxGA_VERTICAL|";
s += _T("wxGA_VERTICAL|");
if (style & wxGA_PROGRESSBAR)
s += "wxGA_PROGRESSBAR|";
s += _T("wxGA_PROGRESSBAR|");
// windows only
if (style & wxGA_SMOOTH)
s += "wxGA_SMOOTH|";
s += _T("wxGA_SMOOTH|");
}
if (restype == "wxRadioButton")
if (restype == _T("wxRadioButton"))
{
if (style & wxRB_GROUP)
s += "wxRB_GROUP|";
s += _T("wxRB_GROUP|");
}
if (restype == "wxStaticText")
if (restype == _T("wxStaticText"))
{
if (style & wxST_NO_AUTORESIZE)
s += "wxST_NO_AUTORESIZEL|";
s += _T("wxST_NO_AUTORESIZEL|");
}
if (restype == "wxRadioBox")
if (restype == _T("wxRadioBox"))
{
if (style & wxRA_HORIZONTAL)
s += "wxRA_HORIZONTAL|";
s += _T("wxRA_HORIZONTAL|");
if (style & wxRA_SPECIFY_COLS)
s += "wxRA_SPECIFY_COLS|";
s += _T("wxRA_SPECIFY_COLS|");
if (style & wxRA_SPECIFY_ROWS)
s += "wxRA_SPECIFY_ROWS|";
s += _T("wxRA_SPECIFY_ROWS|");
if (style & wxRA_VERTICAL)
s += "wxRA_VERTICAL|";
s += _T("wxRA_VERTICAL|");
}
if (restype == "wxListBox")
if (restype == _T("wxListBox"))
{
if (style & wxLB_SINGLE)
s += "wxLB_SINGLE|";
s += _T("wxLB_SINGLE|");
if (style & wxLB_MULTIPLE)
s += "wxLB_MULTIPLE|";
s += _T("wxLB_MULTIPLE|");
if (style & wxLB_EXTENDED)
s += "wxLB_EXTENDED|";
s += _T("wxLB_EXTENDED|");
if (style & wxLB_HSCROLL)
s += "wxLB_HSCROLL|";
s += _T("wxLB_HSCROLL|");
if (style & wxLB_ALWAYS_SB)
s += "wxLB_ALWAYS_SB|";
s += _T("wxLB_ALWAYS_SB|");
if (style & wxLB_NEEDED_SB)
s += "wxLB_NEEDED_SB|";
s += _T("wxLB_NEEDED_SB|");
if (style & wxLB_SORT)
s += "wxLB_SORT|";
s += _T("wxLB_SORT|");
}
if (restype == "wxTextCtrl")
if (restype == _T("wxTextCtrl"))
{
if (style & wxTE_PROCESS_ENTER)
s += "wxTE_PROCESS_ENTER|";
s += _T("wxTE_PROCESS_ENTER|");
if (style & wxTE_PROCESS_TAB)
s += "wxTE_PROCESS_TAB|";
s += _T("wxTE_PROCESS_TAB|");
if (style & wxTE_MULTILINE)
s += "wxTE_MULTILINE|";
s += _T("wxTE_MULTILINE|");
if (style & wxTE_PASSWORD)
s += "wxTE_PASSWORD|";
s += _T("wxTE_PASSWORD|");
if (style & wxTE_READONLY)
s += "wxTE_READONLY|";
s += _T("wxTE_READONLY|");
if (style & wxHSCROLL)
s += "wxHSCROLL|";
s += _T("wxHSCROLL|");
}
if (restype == "wxScrollBar")
if (restype == _T("wxScrollBar"))
{
if (style & wxSB_HORIZONTAL)
s += "wxSB_HORIZONTAL|";
s += _T("wxSB_HORIZONTAL|");
if (style & wxSB_VERTICAL)
s += "wxSB_VERTICAL|";
s += _T("wxSB_VERTICAL|");
}
int l;
@@ -545,14 +547,14 @@ wxString wxr2xml::GetStyles(wxItemResource * res)
// Trim off last |
s = s.Truncate(l - 1);
s += "</style>\n";
s += _T("</style>\n");
return s;
}
wxString wxr2xml::GetDimension(wxItemResource * res)
{
wxString msg;
msg << "\t\t\t\t<dimension>" << res->GetValue1() << "</dimension>\n";
msg << _T("\t\t\t\t<dimension>") << res->GetValue1() << _T("</dimension>\n");
return msg;
}
@@ -571,85 +573,85 @@ wxString wxr2xml::GenerateName(wxItemResource * res)
name += res->GetName();
}
name += "\"";
name += _T("\"");
return name;
}
void wxr2xml::ParseMenuBar(wxItemResource * res)
{
wxItemResource *child;
wxNode *node = res->GetChildren().First();
wxNode *node = res->GetChildren().GetFirst();
// Get Menu Bar Name
m_xmlfile.Write("\t<object class=\"wxMenuBar\" ");
m_xmlfile.Write(_T("\t<object class=\"wxMenuBar\" "));
m_xmlfile.Write(GenerateName(res));
m_xmlfile.Write(">\n");
m_xmlfile.Write(_T(">\n"));
while (node) {
child = (wxItemResource *) node->Data();
child = (wxItemResource *) node->GetData();
ParseMenu(child);
node = node->Next();
node = node->GetNext();
}
m_xmlfile.Write("\t</object> \n\n");
m_xmlfile.Write(_T("\t</object> \n\n"));
}
void wxr2xml::ParseMenu(wxItemResource * res)
{
wxItemResource *child;
wxNode *node = res->GetChildren().First();
wxNode *node = res->GetChildren().GetFirst();
// Get Menu
m_xmlfile.Write("\t\t\t<object class=\"wxMenu\" ");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxMenu\" "));
wxString menuname;
menuname << "name = \"menu_" << res->GetValue1() << "\"";
menuname << _T("name = \"menu_") << res->GetValue1() << _T("\"");
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(">\n"));
m_xmlfile.Write(_T("\t\t\t\t<label>")
+ FixMenuString(res->GetTitle()) + _T("</label>\n"));
if (res->GetValue4() != _T(""))
m_xmlfile.Write(_T("\t\t\t\t<help>") + res->GetValue4() +
_T("</help>\n"));
// Read in menu items and additional menus
while (node) {
child = (wxItemResource *) node->Data();
if (!child->GetChildren().First())
child = (wxItemResource *) node->GetData();
if (!child->GetChildren().GetFirst())
ParseMenuItem(child);
else
ParseMenu(child);
node = node->Next();
node = node->GetNext();
}
m_xmlfile.Write("\t\t\t</object> \n");
m_xmlfile.Write(_T("\t\t\t</object> \n"));
}
void wxr2xml::ParseMenuItem(wxItemResource * res)
{
// Get Menu Item or Separator
if (res->GetTitle() == "") {
m_xmlfile.Write("\t\t\t<object class=\"separator\"/>\n");
if (res->GetTitle() == _T("")) {
m_xmlfile.Write(_T("\t\t\t<object class=\"separator\"/>\n"));
} else {
m_xmlfile.Write("\t\t\t\t<object class=\"wxMenuItem\" ");
m_xmlfile.Write(_T("\t\t\t\t<object class=\"wxMenuItem\" "));
wxString menuname;
menuname << "name = \"menuitem_" << res->GetValue1() << "\"";
menuname << _T("name = \"menuitem_") << res->GetValue1() << _T("\"");
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(_T(">\n"));
m_xmlfile.Write(_T(" <label>")
+ FixMenuString(res->GetTitle()) + _T("</label>\n"));
if (res->GetValue4() != _T(""))
m_xmlfile.Write(_T(" <help>") +
res->GetValue4() + _T("</help>\n"));
if (res->GetValue2())
m_xmlfile.Write("\t\t\t\t<checkable>1</checkable>\n");
m_xmlfile.Write("\t\t\t</object> \n");
m_xmlfile.Write(_T("\t\t\t\t<checkable>1</checkable>\n"));
m_xmlfile.Write(_T("\t\t\t</object> \n"));
}
}
wxString wxr2xml::FixMenuString(wxString phrase)
{
phrase.Replace("&", "$");
phrase.Replace(_T("&"), _T("$"));
return phrase;
}
void wxr2xml::ParseStaticBitmap(wxItemResource * res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxStaticBitmap\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxStaticBitmap\""));
WriteControlInfo(res);
// value4 holds bitmap name
wxString bitmapname;
@@ -658,15 +660,15 @@ void wxr2xml::ParseStaticBitmap(wxItemResource * res)
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</object>\n");
m_xmlfile.Write(_T("\n\t\t\t\t<bitmap>") + bitmapname + _T("</bitmap>"));
m_xmlfile.Write(_T("\t\t\t</object>\n"));
// bitmap5
}
//Parse a bitmap resource
void wxr2xml::ParseBitmap(wxItemResource * res)
{
m_xmlfile.Write("\t<object class=\"wxBitmap\" ");
m_xmlfile.Write(GenerateName(res)+">");
m_xmlfile.Write(_T("\t<object class=\"wxBitmap\" "));
m_xmlfile.Write(GenerateName(res)+_T(">"));
wxString bitmapname;
bitmapname = res->GetName();
wxBitmap bitmap;
@@ -674,7 +676,7 @@ void wxr2xml::ParseBitmap(wxItemResource * res)
bitmapname += _T(".bmp");
bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP);
m_xmlfile.Write(bitmapname);
m_xmlfile.Write("</object>\n\n");
m_xmlfile.Write(_T("</object>\n\n"));
}
void wxr2xml::PanelStuff(wxItemResource * res)
@@ -719,7 +721,7 @@ wxString wxr2xml::GetValue5(wxItemResource *res)
void wxr2xml::ParseBitmapButton(wxItemResource *res)
{
m_xmlfile.Write("\t\t\t<object class=\"wxBitmapButton\"");
m_xmlfile.Write(_T("\t\t\t<object class=\"wxBitmapButton\""));
WriteControlInfo(res);
// value4 holds bitmap name
wxString bitmapname;
@@ -728,9 +730,9 @@ void wxr2xml::ParseBitmapButton(wxItemResource *res)
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\t\t<bitmap>") + bitmapname + _T("</bitmap>\n"));
m_xmlfile.Write("\t\t\t</object>\n");
m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
void wxr2xml::WriteFontInfo(wxItemResource *res)
@@ -743,21 +745,21 @@ void wxr2xml::WriteFontInfo(wxItemResource *res)
if (!font.GetRefData())
return;
m_xmlfile.Write("\t\t\t<font>\n");
m_xmlfile.Write(_T("\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";
msg<<_T("\t\t\t\t<size>")<<pt<<_T("</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\t\t<underlined>1</underlined>\n"));
m_xmlfile.Write("\t\t\t</font>\n");
m_xmlfile.Write(_T("\t\t\t</font>\n"));
}
//WARNING possible make here
@@ -771,22 +773,22 @@ void wxr2xml::GetFontFace(wxFont font)
case wxDEFAULT:
break;
case wxDECORATIVE:
m_xmlfile.Write("\t\t\t\t<face>decorative</face>\n");
m_xmlfile.Write(_T("\t\t\t\t<face>decorative</face>\n"));
break;
case wxROMAN:
m_xmlfile.Write("\t\t\t\t<face>roman</face>\n");
m_xmlfile.Write(_T("\t\t\t\t<face>roman</face>\n"));
break;
case wxSCRIPT:
m_xmlfile.Write("\t\t\t\t<face>script</face>\n");
m_xmlfile.Write(_T("\t\t\t\t<face>script</face>\n"));
break;
case wxSWISS:
m_xmlfile.Write("\t\t\t\t<face>swiss</face>\n");
m_xmlfile.Write(_T("\t\t\t\t<face>swiss</face>\n"));
break;
case wxMODERN:
m_xmlfile.Write("\t\t\t\t<face>modern</face>\n");
m_xmlfile.Write(_T("\t\t\t\t<face>modern</face>\n"));
break;
default:
wxLogError("Unknown font face");
wxLogError(_T("Unknown font face"));
}
}
@@ -801,13 +803,13 @@ void wxr2xml::GetFontStyle(wxFont font)
case wxNORMAL:
break;
case wxITALIC:
m_xmlfile.Write("<style>italic</style>\n");
m_xmlfile.Write(_T("<style>italic</style>\n"));
break;
case wxSLANT:
m_xmlfile.Write("<style>slant</style>\n");
m_xmlfile.Write(_T("<style>slant</style>\n"));
break;
default:
wxLogError("Unknown font style");
wxLogError(_T("Unknown font style"));
}
}
@@ -821,12 +823,12 @@ void wxr2xml::GetFontWeight(wxFont font)
case wxNORMAL:
break;
case wxLIGHT:
m_xmlfile.Write("\t\t\t\t<weight>light</weight>\n");
m_xmlfile.Write(_T("\t\t\t\t<weight>light</weight>\n"));
break;
case wxBOLD:
m_xmlfile.Write("\t\t\t\t<weight>bold</weight>\n");
m_xmlfile.Write(_T("\t\t\t\t<weight>bold</weight>\n"));
break;
default:
wxLogError("Unknown font weight");
wxLogError(_T("Unknown font weight"));
}
}

View File

@@ -256,9 +256,5 @@ void PropEditCtrlFile::OnDetails()
wxString PropEditCtrlImageFile::GetFileTypes()
{
return _("GIF files (*.gif)|*.gif|"
"JPEG files (*.jpg)|*.jpg|"
"PNG files (*.png)|*.png|"
"BMP files (*.bmp)|*.bmp|"
"All files (*)|*");
return _("GIF files (*.gif)|*.gif|JPEG files (*.jpg)|*.jpg|PNG files (*.png)|*.png|BMP files (*.bmp)|*.bmp|All files (*)|*");
}

View File

@@ -134,8 +134,7 @@ void PreviewFrame::MakeDirty()
if (m_Dirty) return;
m_Dirty = TRUE;
m_LogCtrl->Clear();
m_LogCtrl->SetValue(_("Resource modified.\n"
"Move mouse cursor over the preview window to refresh it."));
m_LogCtrl->SetValue(_("Resource modified.\nMove mouse cursor over the preview window to refresh it."));
}

View File

@@ -444,13 +444,12 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
wxSize clientSize = GetClientSize();
wxRect itemRect;
int cy=0;
wxTreeItemId h, lastH;
for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h))
{
if (m_treeCtrl->GetBoundingRect(h, itemRect))
{
cy = itemRect.GetTop();
int cy = itemRect.GetTop();
wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight());
lastH = h;
@@ -462,7 +461,7 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
}
if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect))
{
cy = itemRect.GetBottom();
int cy = itemRect.GetBottom();
dc.DrawLine(0, cy, clientSize.x, cy);
}
}

View File

@@ -206,7 +206,6 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
// save state
wxSizer *old_par = m_parentSizer;
bool old_ins = m_isInside;
bool old_gbs = m_isGBS;
// set new state
m_parentSizer = sizer;
@@ -216,7 +215,6 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
CreateChildren(m_parent, TRUE/*only this handler*/);
// restore state
old_gbs = m_isGBS;
m_isInside = old_ins;
m_parentSizer = old_par;

View File

@@ -59,6 +59,8 @@ wxObject *wxWizardXmlHandler::DoCreateResource()
else
{
wxWizardPage *page = NULL;
wxUnusedVar(page);
if (m_class == wxT("wxWizardPageSimple"))
{
XRC_MAKE_INSTANCE(p, wxWizardPageSimple)

View File

@@ -324,6 +324,7 @@ bool wxXmlResource::UpdateResources()
bool modif;
# if wxUSE_FILESYSTEM
wxFSFile *file = NULL;
wxUnusedVar(file);
wxFileSystem fsys;
# endif
@@ -353,6 +354,7 @@ bool wxXmlResource::UpdateResources()
rt = false;
}
wxDELETE(file);
wxUnusedVar(file);
# else
modif = wxDateTime(wxFileModificationTime(m_data[i].File)) > m_data[i].Time;
# endif
@@ -413,6 +415,7 @@ bool wxXmlResource::UpdateResources()
# if wxUSE_FILESYSTEM
wxDELETE(file);
wxUnusedVar(file);
# else
wxDELETE(stream);
# endif
@@ -1180,14 +1183,12 @@ static int XRCID_Lookup(const wxChar *str_id, int value_if_not_found = -2)
index %= XRCID_TABLE_SIZE;
XRCID_record *oldrec = NULL;
int matchcnt = 0;
for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next)
{
if (wxStrcmp(rec->key, str_id) == 0)
{
return rec->id;
}
matchcnt++;
oldrec = rec;
}