m_workingpath=wxPathOnly(rcfile);
- m_targetpath=wxPathOnly(xmlfile)+"\\";
+ m_targetpath=wxPathOnly(xmlfile) + _T("\\");
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;
/* Write Basic header for XML file */
- 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"));
//Read resource.h
ParseResourceHeader();
//Read in dialogs, toolbars,menus
SecondPass();
- m_xmlfile.Write("</resource>\n");
+ m_xmlfile.Write(_T("</resource>\n"));
m_xmlfile.Close();
m_rc.Close();
wxMessageBox(_("Conversion complete."), _("Done"),
*/
token=PeekToken();
//Microsoft notation?
- while ((token=="DISCARDABLE")
- ||(token=="LOADONCALL")||(token=="MOVEABLE"))
+ while ((token==_T("DISCARDABLE"))
+ ||(token==_T("LOADONCALL"))||(token==_T("MOVEABLE")))
{
token=GetToken();
token=PeekToken();
wxString title;
wxString ptsize,face;
- m_xmlfile.Write("\t<object class=\"wxDialog\"");
+ m_xmlfile.Write(_T("\t<object class=\"wxDialog\""));
//Avoid duplicate names this way
- dlgname.Replace("IDD_","DLG_");
+ dlgname.Replace(_T("IDD_"),_T("DLG_"));
WriteBasicInfo(x,y,width,height,dlgname);
WriteTitle(title);
- while ((token!="BEGIN")&(token!="{"))
+ while ((token!=_T("BEGIN"))&(token!=_T("{")))
{
- if (token=="CAPTION")
+ if (token==_T("CAPTION"))
{
title=GetQuoteField();
}
//TODO fix face name so that it is cross platform name
// FONT 8, "MS Sans Serif"
- if (token=="FONT")
+ if (token==_T("FONT"))
{
ptsize=GetToken();
face=GetQuoteField();
- m_xmlfile.Write("\t\t<font>\n");
- m_xmlfile.Write("\t\t\t<size>"+ptsize+"</size>\n");
- m_xmlfile.Write("\t\t\t<face>"+face+"</face>\n");
- m_xmlfile.Write("\t\t</font>\n");
+ 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();
}
ParseControls();
- m_xmlfile.Write("\t</object>\n");
+ m_xmlfile.Write(_T("\t</object>\n"));
}
/*
wxString label,varname;
token=GetToken();
- while ((token!="END")&(token!="}"))
+ while ((token!=_T("END"))&(token!=_T("}")))
{
- if (token=="AUTOCHECKBOX")
+ if (token==_T("AUTOCHECKBOX"))
{
label=GetQuoteField();
varname=GetToken();
ParseCheckBox(label,varname);
}
else
- if (token=="AUTORADIOBUTTON")
+ if (token==_T("AUTORADIOBUTTON"))
{
label=GetQuoteField();
varname=GetToken();
ParseRadioButton(label,varname);
}
else
- if (token=="LTEXT")
+ if (token==_T("LTEXT"))
{
label=GetQuoteField();
varname=GetToken();
ParseStaticText(label,varname);
}
- else if (token=="EDITTEXT")
+ else if (token==_T("EDITTEXT"))
{
varname=GetToken();
ParseTextCtrl(varname);
}
- else if ((token=="PUSHBUTTON")||(token=="DEFPUSHBUTTON"))
+ else if ((token==_T("PUSHBUTTON"))||(token==_T("DEFPUSHBUTTON")))
{
label=GetQuoteField();
varname=GetToken();
ParsePushButton(label,varname);
}
- else if (token=="GROUPBOX")
+ else if (token==_T("GROUPBOX"))
{
label=GetQuoteField();
varname=GetToken();
ParseGroupBox(label,varname);
}
- else if (token=="COMBOBOX")
+ else if (token==_T("COMBOBOX"))
{
varname=GetToken();
ParseComboBox(varname);
}
- else if (token=="CONTROL")
+ else if (token==_T("CONTROL"))
ParseControlMS();
- else if (token=="LISTBOX")
+ else if (token==_T("LISTBOX"))
{
varname=GetToken();
ParseListBox(varname);
}
- else if (token=="ICON")
+ else if (token==_T("ICON"))
ParseIconStatic();
- else if (token=="SCROLLBAR")
+ else if (token==_T("SCROLLBAR"))
ParseScrollBar();
token=GetToken();
}
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxStaticText\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxStaticText\""));
WriteBasicInfo(x,y,width,height,varname);WriteLabel(phrase);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
//EDITTEXT IDC_RADIUS,36,65,40,14,ES_AUTOHSCROLL
ReadRect(x,y,width,height);
//TODO
//style=GetToken();
- m_xmlfile.Write("\t\t<object class=\"wxTextCtrl\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxTextCtrl\""));
WriteBasicInfo(x,y,width,height,varname);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
//AUTOCHECKBOX "&log.", ID_XLOG, 25, 24, 21, 12
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxCheckBox\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxCheckBox\""));
WriteBasicInfo(x,y,width,height,varname);
WriteLabel(phrase);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
//AUTORADIOBUTTON "&text", ID_SW10, 13, 12, 68, 10, BS_AUTORADIOBUTTON | WS_GROUP
if (ReadRect(x,y,width,height))
if (GotOrs==FALSE)
ReadOrs(token);
- if (token.Find("WS_GROUP") != -1)
- style += "wxRB_GROUP";
+ if (token.Find(_T("WS_GROUP")) != -1)
+ style += _T("wxRB_GROUP");
- m_xmlfile.Write("\t\t<object class=\"wxRadioButton\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxRadioButton\""));
WriteBasicInfo(x,y,width,height,varname);
WriteLabel(phrase);
WriteStyle(style);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxButton\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxButton\""));
WriteBasicInfo(x,y,width,height,varname);
WriteLabel(phrase);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxStaticBox\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxStaticBox\""));
WriteBasicInfo(x,y,width,height,varname);
WriteLabel(phrase);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
bool rc2xml::ReadRect(int & x, int & y, int & width, int & height)
{
- x=atoi(GetToken());
- y=atoi(GetToken());
- width=atoi(GetToken());
+ x=wxAtoi(GetToken());
+ y=wxAtoi(GetToken());
+ width=wxAtoi(GetToken());
bool ret;
wxString tmp = GetToken(&ret);
- height=atoi(tmp);
+ height=wxAtoi(tmp);
return ret; // check for more parameters
}
wxString rc2xml::GetToken(bool *listseperator)
{
- wxString token="";
+ wxString token=wxEmptyString;
if (m_rc.Eof())
{
if (GotOrs==FALSE)
ReadOrs(token);
- m_xmlfile.Write("\t\t<object class=\"wxComboBox\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxComboBox\""));
WriteBasicInfo(x,y,width,height,varname);
- if (token.Find("CBS_SIMPLE") != -1)
- WriteStyle("wxCB_SIMPLE");
- if (token.Find("CBS_SORT") != -1)
- WriteStyle("wxCB_SORT");
- if (token.Find("CBS_DISABLENOSCROLL") != -1)
- WriteStyle("wxLB_ALWAYS_SB");
- m_xmlfile.Write("\n\t\t</object>\n");
+ if (token.Find(_T("CBS_SIMPLE")) != -1)
+ WriteStyle(_T("wxCB_SIMPLE"));
+ if (token.Find(_T("CBS_SORT")) != -1)
+ WriteStyle(_T("wxCB_SORT"));
+ if (token.Find(_T("CBS_DISABLENOSCROLL")) != -1)
+ WriteStyle(_T("wxLB_ALWAYS_SB"));
+ m_xmlfile.Write(_T("\n\t\t</object>\n"));
}
void rc2xml::ParseMenu(wxString varname)
{
- wxString token="";
+ wxString token=wxEmptyString;
//Write menubar to xml file
- m_xmlfile.Write("\t<object class=\"wxMenuBar\"");
+ m_xmlfile.Write(_T("\t<object class=\"wxMenuBar\""));
//Avoid duplicate names this way
- varname.Replace("IDR_","MB_");
+ varname.Replace(_T("IDR_"),_T("MB_"));
WriteName(varname);
- m_xmlfile.Write(">\n");
+ m_xmlfile.Write(_T(">\n"));
- while ((token!="BEGIN")&(token!="{"))
+ while ((token!=_T("BEGIN"))&(token!=_T("{")))
token=GetToken();
- while ((token!="END")&(token!="}"))
+ while ((token!=_T("END"))&(token!=_T("}")))
{
token=GetToken();
token.MakeUpper();
- if (token=="POPUP")
+ if (token==_T("POPUP"))
{
ParsePopupMenu();
}
}
- m_xmlfile.Write("\t</object>\n");
+ m_xmlfile.Write(_T("\t</object>\n"));
}
void rc2xml::ParsePopupMenu()
//Write Menu item
//Generate a fake name since RC menus don't have one
- name<<"Menu_"<<menucount;
- m_xmlfile.Write("\t\t<object class=\"wxMenu\"");
+ name << _T("Menu_") << menucount;
+ m_xmlfile.Write(_T("\t\t<object class=\"wxMenu\""));
WriteName(name);
- m_xmlfile.Write(">\n");
+ m_xmlfile.Write(_T(">\n"));
WriteLabel(token);
- while ((token!="BEGIN")&(token!="{"))
+ while ((token!=_T("BEGIN"))&(token!=_T("{")))
token=GetToken();
- while ((token!="END")&(token!="}"))
+ while ((token!=_T("END"))&(token!=_T("}")))
{
token=GetToken();
token.MakeUpper();
- if (token=="POPUP")
+ if (token==_T("POPUP"))
ParsePopupMenu();
- if (token=="MENUITEM")
+ if (token==_T("MENUITEM"))
ParseMenuItem();
}
- m_xmlfile.Write("\t\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
wxString rc2xml::PeekToken()
wxString label,varname,kindctrl,token;
token=PeekToken();
- if (token.Contains("\""))
+ if (token.Contains(_T("\"")))
ParseNormalMSControl();
else
ParseWeirdMSControl();
TBS_NOTICKS | WS_TABSTOP,52,73,100,15
*/
-void rc2xml::ParseSlider(wxString label, wxString varname)
+void rc2xml::ParseSlider(wxString WXUNUSED(label), wxString varname)
{
wxString token,style;
ReadOrs(token);
- if (token.Find("TBS_VERT")!=-1)
- style+="wxSL_VERTICAL";
+ if (token.Find(_T("TBS_VERT"))!=-1)
+ style+=_T("wxSL_VERTICAL");
//MFC RC Default is horizontal
else
- style+="wxSL_HORIZONTAL";
+ style+=_T("wxSL_HORIZONTAL");
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxSlider\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxSlider\""));
WriteBasicInfo(x,y,width,height,varname);
WriteStyle(style);
- m_xmlfile.Write("\n\t\t</object>\n");
+ m_xmlfile.Write(_T("\n\t\t</object>\n"));
}
/*
CONTROL "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32",
WS_BORDER,15,52,154,13
*/
-void rc2xml::ParseProgressBar(wxString label, wxString varname)
+void rc2xml::ParseProgressBar(wxString WXUNUSED(label), wxString varname)
{
wxString token,style;
ReadOrs(token);
ReadRect(x,y,width,height);
//Always horizontal in MFC
- m_xmlfile.Write("\t\t<object class=\"wxGauge\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxGauge\""));
WriteBasicInfo(x,y,width,height,varname);
WriteStyle(style);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
bool rc2xml::ReadOrs(wxString & orstring)
ReadOrs(token);
m_rc.Seek(p);
- if (token.Find("BS_AUTOCHECKBOX")!=-1)
+ if (token.Find(_T("BS_AUTOCHECKBOX"))!=-1)
ParseCheckBox(label, varname);
- else if ((token.Find("BS_AUTORADIOBUTTON")!=-1)||
- (token.Find("BS_RADIOBUTTON")!=-1))
+ else if ((token.Find(_T("BS_AUTORADIOBUTTON"))!=-1)||
+ (token.Find(_T("BS_RADIOBUTTON"))!=-1))
ParseRadioButton(label, varname);
- else if (token.Find("BS_GROUPBOX")!=-1)
+ else if (token.Find(_T("BS_GROUPBOX"))!=-1)
ParseGroupBox(label, varname);
else // if ((token.Find("BS_PUSHBUTTON")!=-1)||
// (token.Find("BS_DEFPUSHBUTTON")!=-1))
void rc2xml::WriteSize(int width, int height)
{
wxString msg;
- msg<<" <size>"<<width<<","<<height<<"d</size>";
+ msg << _T(" <size>") << width << _T(",") << height << _T("d</size>");
m_xmlfile.Write(msg);
}
void rc2xml::WritePosition(int x, int y)
{
wxString msg;
- msg<<" <pos>"<<x<<","<<y<<"d</pos>";
+ msg << _T(" <pos>") << x << _T(",") << y << _T("d</pos>");
m_xmlfile.Write(msg);
}
void rc2xml::WriteTitle(wxString title)
{
wxString msg;
- msg=_T("\t\t<title>"+title+"</title>\n");
+ msg=_T("\t\t<title>")+title+_T("</title>\n");
m_xmlfile.Write(msg);
}
name=LookUpId(name);
//Replace common MS ids with wxWindows ids
//I didn't do everyone of them
- if (name=="IDOK")
- name="wxID_OK";
- else if (name=="IDCANCEL")
- name="wxID_CANCEL";
- else if (name=="IDAPPLY")
- name="wxID_APPLY";
- else if (name=="ID_FILE_OPEN")
- name="wxID_OPEN";
- else if (name=="ID_FILE_CLOSE")
- name="wxID_CLOSE";
- else if (name=="ID_FILE_SAVE")
- name="wxID_SAVE";
- else if (name=="ID_FILE_SAVE_AS")
- name="wxID_SAVEAS";
- else if (name=="ID_APP_EXIT")
- name="wxID_EXIT";
- else if (name=="ID_FILE_PRINT")
- name="wxID_PRINT";
- else if (name=="ID_FILE_PRINT_PREVIEW")
- name="wxID_PREVIEW";
- else if (name=="ID_FILE_PRINT_SETUP")
- name="wxID_PRINT_SETUP";
- else if (name=="ID_APP_ABOUT")
- name="wxID_ABOUT";
- else if (name=="ID_EDIT_UNDO")
- name="wxID_UNDO";
- else if (name=="ID_EDIT_CUT")
- name="wxID_CUT";
- else if (name=="ID_EDIT_COPY")
- name="wxID_COPY";
- else if (name=="ID_EDIT_PASTE")
- name="wxID_PASTE";
- else if (name=="IDYES")
- name="wxID_YES";
- else if (name=="IDNO")
- name="wxID_NO";
- else if (name=="IDHELP")
- name="wxID_HELP";
-
- m_xmlfile.Write(" name= \""+name+"\"");
+ if (name==_T("IDOK"))
+ name=_T("wxID_OK");
+ else if (name==_T("IDCANCEL"))
+ name=_T("wxID_CANCEL");
+ else if (name==_T("IDAPPLY"))
+ name=_T("wxID_APPLY");
+ else if (name==_T("ID_FILE_OPEN"))
+ name=_T("wxID_OPEN");
+ else if (name==_T("ID_FILE_CLOSE"))
+ name=_T("wxID_CLOSE");
+ else if (name==_T("ID_FILE_SAVE"))
+ name=_T("wxID_SAVE");
+ else if (name==_T("ID_FILE_SAVE_AS"))
+ name=_T("wxID_SAVEAS");
+ else if (name==_T("ID_APP_EXIT"))
+ name=_T("wxID_EXIT");
+ else if (name==_T("ID_FILE_PRINT"))
+ name=_T("wxID_PRINT");
+ else if (name==_T("ID_FILE_PRINT_PREVIEW"))
+ name=_T("wxID_PREVIEW");
+ else if (name==_T("ID_FILE_PRINT_SETUP"))
+ name=_T("wxID_PRINT_SETUP");
+ else if (name==_T("ID_APP_ABOUT"))
+ name=_T("wxID_ABOUT");
+ else if (name==_T("ID_EDIT_UNDO"))
+ name=_T("wxID_UNDO");
+ else if (name==_T("ID_EDIT_CUT"))
+ name=_T("wxID_CUT");
+ else if (name==_T("ID_EDIT_COPY"))
+ name=_T("wxID_COPY");
+ else if (name==_T("ID_EDIT_PASTE"))
+ name=_T("wxID_PASTE");
+ else if (name==_T("IDYES"))
+ name=_T("wxID_YES");
+ else if (name==_T("IDNO"))
+ name=_T("wxID_NO");
+ else if (name==_T("IDHELP"))
+ name=_T("wxID_HELP");
+
+ m_xmlfile.Write(_T(" name= \"")+name+_T("\""));
}
void rc2xml::WriteLabel(wxString label)
{
- label.Replace("&","$");
- m_xmlfile.Write("\t\t\t<label>"+label+"</label>\n");
+ label.Replace(_T("&"),_T("$"));
+ m_xmlfile.Write(_T("\t\t\t<label>")+label+_T("</label>\n"));
}
void rc2xml::WriteBasicInfo(int x, int y, int width, int height, wxString name)
{
WriteName(name);
- m_xmlfile.Write(">\n");
- m_xmlfile.Write("\t\t\t");
+ m_xmlfile.Write(_T(">\n"));
+ m_xmlfile.Write(_T("\t\t\t"));
WritePosition(x,y);
WriteSize(width,height);
- m_xmlfile.Write("\n");
+ m_xmlfile.Write(_T("\n"));
}
void rc2xml::WriteStyle(wxString style)
{
if (style.Length()==0)
return;
- m_xmlfile.Write("\t\t\t<style>"+style+"</style>\n");
+ m_xmlfile.Write(_T("\t\t\t<style>")+style+_T("</style>\n"));
}
/*
LISTBOX IDC_LIST1,16,89,48,40,LBS_SORT | LBS_MULTIPLESEL |
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxListBox\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxListBox\""));
WriteBasicInfo(x,y,width,height,varname);
- m_xmlfile.Write("\n\t\t</object>\n");
+ m_xmlfile.Write(_T("\n\t\t</object>\n"));
}
/*
ReadRect(x,y,width,height);
wxString style;
//Make it a rich text control
- style+="wxTE_MULTILINE ";
- m_xmlfile.Write("\t\t<object class=\"wxTextCtrl\"");
+ style+=_T("wxTE_MULTILINE ");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxTextCtrl\""));
WriteBasicInfo(x,y,width,height,varname);
WriteStyle(style);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
/*
CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS,209,72,
19,26
*/
-void rc2xml::ParseSpinCtrl(wxString label, wxString varname)
+void rc2xml::ParseSpinCtrl(wxString WXUNUSED(label), wxString varname)
{
wxString token,style;
ReadOrs(token);
- if (token.Find("UDS_HORZ")!=-1)
- style="wxSP_HORIZONTAL";
+ if (token.Find(_T("UDS_HORZ"))!=-1)
+ style=_T("wxSP_HORIZONTAL");
//MFC default
else
- style="wxSP_VERTICAL";
+ style=_T("wxSP_VERTICAL");
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxSpinButton\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxSpinButton\""));
WriteBasicInfo(x,y,width,height,varname);
WriteStyle(style);
- m_xmlfile.Write("\n\t\t</object>\n");
+ m_xmlfile.Write(_T("\n\t\t</object>\n"));
}
while (!m_done)
{
token=GetToken();
- if (token=="BITMAP")
+ if (token==_T("BITMAP"))
ParseBitmap(prevtok);
- else if (token=="STRINGTABLE")
+ else if (token==_T("STRINGTABLE"))
ParseStringTable(prevtok);
- else if (token=="ICON")
+ else if (token==_T("ICON"))
ParseIcon(prevtok);
prevtok=token;
token=PeekToken();
//Microsoft notation?
- if (token=="DISCARDABLE")
+ if (token==_T("DISCARDABLE"))
{
token=GetToken();
token=PeekToken();
while (!m_done)
{
token=GetToken();
- if ((token=="DIALOG")||(token=="DIALOGEX"))
+ if ((token==_T("DIALOG"))||(token==_T("DIALOGEX")))
ParseDialog(prevtok);
- else if (token=="MENU")
+ else if (token==_T("MENU"))
ParseMenu(prevtok);
- else if (token=="TOOLBAR")
+ else if (token==_T("TOOLBAR"))
ParseToolBar(prevtok);
prevtok=token;
{
wxString token;
token=GetToken();
- wxASSERT_MSG(token=="DISCARDABLE","Error in toolbar parsing");
+ wxASSERT_MSG(token==_T("DISCARDABLE"),_T("Error in toolbar parsing"));
//Look up bitmap for toolbar and load
wxNode *node=m_bitmaplist->Find(LookUpId(varname));
wxString *bitmappath;
- bitmappath=(wxString *)node->Data();
+ bitmappath=(wxString *)node->GetData();
wxBitmap bitmap;
if (!bitmap.LoadFile(*bitmappath,wxBITMAP_TYPE_BMP ))
- wxLogError("Unable to load bitmap:"+*bitmappath);
+ wxLogError(_T("Unable to load bitmap:")+*bitmappath);
//Write toolbar to xml file
- m_xmlfile.Write(" <object class=\"wxToolBar\"");
+ m_xmlfile.Write(_T(" <object class=\"wxToolBar\""));
//Avoid duplicate names this way
- varname.Replace("IDR_","TB_");
+ varname.Replace(_T("IDR_"),_T("TB_"));
WriteName(varname);
- m_xmlfile.Write(">\n");
+ m_xmlfile.Write(_T(">\n"));
wxString style;
- style+="wxTB_FLAT";
+ style+=_T("wxTB_FLAT");
WriteStyle(style);
//Grab width and height
int width,height;
- width=atoi(GetToken());
- height=atoi(GetToken());
+ width=wxAtoi(GetToken());
+ height=wxAtoi(GetToken());
int c=0;
wxString buttonname,msg,tip,longhelp;
token=GetToken();
- while ((token!="BEGIN")&(token!="{"))
+ while ((token!=_T("BEGIN"))&(token!=_T("{")))
token=GetToken();
- while ((token!="END")&(token!="}"))
+ while ((token!=_T("END"))&(token!=_T("}")))
{
- if (token=="BUTTON")
+ if (token==_T("BUTTON"))
{
buttonname=GetToken();
- m_xmlfile.Write("\t\t\t<object class=\"tool\"");
+ m_xmlfile.Write(_T("\t\t\t<object class=\"tool\""));
WriteName(buttonname);
- m_xmlfile.Write(">\n");
+ m_xmlfile.Write(_T(">\n"));
//Write tool tip if any
if (LookUpString(buttonname,msg))
{
SplitHelp(msg,tip,longhelp);
- m_xmlfile.Write("\t\t\t\t<tooltip>"+tip+"</tooltip>\n");
- m_xmlfile.Write(" <longhelp>"+longhelp+"</longhelp>\n");
+ m_xmlfile.Write(_T("\t\t\t\t<tooltip>")+tip+_T("</tooltip>\n"));
+ m_xmlfile.Write(_T(" <longhelp>")+longhelp+_T("</longhelp>\n"));
}
//Make a bitmap file name
buttonname=CleanName(buttonname);
- buttonname+=".bmp";
- m_xmlfile.Write("\t\t\t\t<bitmap>"+buttonname+"</bitmap>\n");
+ buttonname+=_T(".bmp");
+ m_xmlfile.Write(_T("\t\t\t\t<bitmap>")+buttonname+_T("</bitmap>\n"));
WriteToolButton(buttonname,c,width,height,bitmap);
- m_xmlfile.Write("\t\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t\t</object>\n"));
c++;
}
- else if (token=="SEPARATOR")
+ else if (token==_T("SEPARATOR"))
{
- m_xmlfile.Write("\t\t\t<object class=\"separator\"/>\n");
+ m_xmlfile.Write(_T("\t\t\t<object class=\"separator\"/>\n"));
}
token=GetToken();
}
- m_xmlfile.Write("\t</object>\n");
+ m_xmlfile.Write(_T("\t</object>\n"));
}
//Extract bitmaps from larger toolbar bitmap
{
wxString token;
token=GetToken();
- while ((token!="BEGIN")&(token!="{"))
+ while ((token!=_T("BEGIN"))&(token!=_T("{")))
token=GetToken();
token=GetToken();
wxString *msg;
- while ((token!="END")&(token!="}"))
+ while ((token!=_T("END"))&(token!=_T("}")))
{
msg=new wxString;
*msg=GetStringQuote();
if (node==NULL)
return FALSE;
- s=(wxString *)node->Data();
+ s=(wxString *)node->GetData();
st=*s;
return TRUE;
bool rc2xml::SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp)
{
int spot;
- spot=msg.Find("\\n");
+ spot=msg.Find(_T("\\n"));
if (spot==-1)
{
shorthelp=msg;
{
wxString token,name,msg,tip,longhelp;
//int spot;
- if (PeekToken()=="SEPARATOR")
+ if (PeekToken()==_T("SEPARATOR"))
{
- m_xmlfile.Write("\t\t\t<object class=\"separator\"/>\n");
+ m_xmlfile.Write(_T("\t\t\t<object class=\"separator\"/>\n"));
return;
}
//Remove \t because it causes problems
//spot=token.First("\\t");
//token=token.Left(spot);
- m_xmlfile.Write("\t\t\t<object class=\"wxMenuItem\"");
+ m_xmlfile.Write(_T("\t\t\t<object class=\"wxMenuItem\""));
WriteName(name);
- m_xmlfile.Write(">\n");
+ m_xmlfile.Write(_T(">\n"));
WriteLabel(token);
//Look up help if any listed in stringtable
//can't assume numbers correlate, restrict to string identifiers
if ((!name.IsNumber())&&(LookUpString(name,msg)))
{
SplitHelp(msg,tip,longhelp);
- m_xmlfile.Write("\t\t\t<help>"
- +longhelp+"</help>\n");
+ m_xmlfile.Write(_T("\t\t\t<help>")
+ +longhelp+_T("</help>\n"));
}
//look for extra attributes like checked and break
wxString ptoken;
ptoken=PeekToken();
ptoken.MakeUpper();
- while ((ptoken!="MENUITEM")&(ptoken!="POPUP")&(ptoken!="END"))
+ while ((ptoken!=_T("MENUITEM"))&(ptoken!=_T("POPUP"))&(ptoken!=_T("END")))
{
token=GetToken();
ptoken.MakeUpper();
- if (token=="CHECKED")
- m_xmlfile.Write("\t\t\t<checkable>1</checkable>\n");
- else if (token=="MENUBREAK");
+ if (token==_T("CHECKED"))
+ m_xmlfile.Write(_T("\t\t\t<checkable>1</checkable>\n"));
+ else if (token==_T("MENUBREAK"));
//m_xmlfile.Write("\t\t\t</break>\n");
- else if (token=="GRAYED");
+ else if (token==_T("GRAYED"));
else
- wxLogError("Unknown Menu Item token:"+token);
+ wxLogError(_T("Unknown Menu Item token:")+token);
ptoken=PeekToken();
ptoken.MakeUpper();
}
- m_xmlfile.Write("\t\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t\t</object>\n"));
}
wxString token;
wxString varname,iconname;
token = PeekToken();
- if (token.Contains("\""))
+ if (token.Contains(_T("\"")))
iconname = GetQuoteField();
else
iconname=GetToken();
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxStaticBitmap\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxStaticBitmap\""));
WriteBasicInfo(x,y,width,height,varname);
//Save icon as a bitmap
WriteIcon(iconname);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
//IDR_MAINFRAME ICON DISCARDABLE "res\\mfcexample.ico"
wxString rc2xml::CleanName(wxString name)
{
name.MakeLower();
- name.Replace("id_","");
- name.Replace("idr_","");
- name.Replace("idb_","");
- name.Replace("idc_","");
+ name.Replace(_T("id_"),wxEmptyString);
+ name.Replace(_T("idr_"),wxEmptyString);
+ name.Replace(_T("idb_"),wxEmptyString);
+ name.Replace(_T("idc_"),wxEmptyString);
- name.Replace(".ico","");
+ name.Replace(_T(".ico"),wxEmptyString);
- name.Replace(".bmp","");
+ name.Replace(_T(".bmp"),wxEmptyString);
return name;
}
// And the award for most messed up control goes to...
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxStaticBitmap\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxStaticBitmap\""));
WriteBasicInfo(x,y,width,height,varname);
WriteBitmap(bitmapname);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
kindctrl=GetQuoteField();
kindctrl.MakeUpper();
- if (kindctrl=="MSCTLS_UPDOWN32")
+ if (kindctrl==_T("MSCTLS_UPDOWN32"))
ParseSpinCtrl(label,varname);
- 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=="SYSTREEVIEW32")
+ if (kindctrl==_T("SYSTREEVIEW32"))
ParseTreeCtrl(label,varname);
- if (kindctrl=="SYSMONTHCAL32")
+ if (kindctrl==_T("SYSMONTHCAL32"))
ParseCalendar(label,varname);
- if (kindctrl=="SYSLISTVIEW32")
+ if (kindctrl==_T("SYSLISTVIEW32"))
ParseListCtrl(label,varname);
- if (kindctrl=="BUTTON")
+ if (kindctrl==_T("BUTTON"))
ParseCtrlButton(label,varname);
- if (kindctrl=="RICHEDIT")
+ if (kindctrl==_T("RICHEDIT"))
ParseRichEdit(label,varname);
- if (kindctrl=="STATIC")
+ if (kindctrl==_T("STATIC"))
{
wxString token;
int p=m_rc.Tell();
ReadOrs(token);
m_rc.Seek(p);
- if (token.Find("SS_BITMAP")!=-1)
+ if (token.Find(_T("SS_BITMAP"))!=-1)
ParseStaticBitmap(label,varname);
else
ParseStaticText(label,varname);
}
- if (kindctrl=="EDIT")
+ if (kindctrl==_T("EDIT"))
ParseTextCtrl(varname);
- if (kindctrl=="LISTBOX")
+ if (kindctrl==_T("LISTBOX"))
ParseListBox(varname);
- if (kindctrl=="COMBOBOX")
+ if (kindctrl==_T("COMBOBOX"))
ParseComboBox(varname);
}
kindctrl=GetQuoteField();
kindctrl.MakeUpper();
// CONTROL IDB_FACE,IDC_STATIC,"Static",SS_BITMAP,26,62,32,30
- if (kindctrl=="STATIC")
+ if (kindctrl==_T("STATIC"))
{
- if (PeekToken()=="SS_BITMAP")
+ if (PeekToken()==_T("SS_BITMAP"))
ParseStaticBitmap(id,varname);
else
- wxLogError("Unknown MS Control Static token");
+ wxLogError(_T("Unknown MS Control Static token"));
}
}
ReadOrs(token);
-if (token.Find("SBS_VERT")!=-1)
+if (token.Find(_T("SBS_VERT"))!=-1)
style=_T("wxSB_VERTICAL");
//Default MFC style is horizontal
else
style=_T("wxSB_HORIZONTAL");
- m_xmlfile.Write("\t\t<object class=\"wxScrollBar\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxScrollBar\""));
WriteBasicInfo(x,y,width,height,varname);
WriteStyle(style);
- m_xmlfile.Write("\n\t\t</object>\n");
+ m_xmlfile.Write(_T("\n\t\t</object>\n"));
}
// CONTROL "Tree1",IDC_TREE1,"SysTreeView32",WS_BORDER | WS_TABSTOP,
// 7,7,66,61
-void rc2xml::ParseTreeCtrl(wxString label, wxString varname)
+void rc2xml::ParseTreeCtrl(wxString WXUNUSED(label), wxString varname)
{
wxString token;
//while (ReadOrs(token));
ReadOrs(token);
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxTreeCtrl\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxTreeCtrl\""));
WriteBasicInfo(x,y,width,height,varname);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
// CONTROL "MonthCalendar1",IDC_MONTHCALENDAR1,"SysMonthCal32",
//MCS_NOTODAY | WS_TABSTOP,105,71,129,89
-void rc2xml::ParseCalendar(wxString label, wxString varname)
+void rc2xml::ParseCalendar(wxString WXUNUSED(label), wxString varname)
{
wxString token;
//while (ReadOrs(token));
ReadOrs(token);
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxCalendarCtrl\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxCalendarCtrl\""));
WriteBasicInfo(x,y,width,height,varname);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
// CONTROL "List1",IDC_LIST1,"SysListView32",WS_BORDER | WS_TABSTOP,
// 7,89,68,71
-void rc2xml::ParseListCtrl(wxString label, wxString varname)
+void rc2xml::ParseListCtrl(wxString WXUNUSED(label), wxString varname)
{
wxString token;
//while (ReadOrs(token));
ReadOrs(token);
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t<object class=\"wxListCtrl\"");
+ m_xmlfile.Write(_T("\t\t<object class=\"wxListCtrl\""));
WriteBasicInfo(x,y,width,height,varname);
- m_xmlfile.Write("\t\t</object>\n");
+ m_xmlfile.Write(_T("\t\t</object>\n"));
}
wxNode *node=m_bitmaplist->Find(LookUpId(bitmapname));
if (node==NULL)
{
- m_xmlfile.Write("\t\t\t<bitmap>missingfile</bitmap>\n");
- wxLogError("Unable to find bitmap:"+bitmapname);
+ m_xmlfile.Write(_T("\t\t\t<bitmap>missingfile</bitmap>\n"));
+ wxLogError(_T("Unable to find bitmap:")+bitmapname);
return;
}
wxString *bitmappath;
- bitmappath=(wxString *)node->Data();
+ bitmappath=(wxString *)node->GetData();
bitmapname=wxFileNameFromPath(*bitmappath);
wxBitmap bitmap;
if (!bitmap.LoadFile(*bitmappath,wxBITMAP_TYPE_BMP ))
- wxLogError("Unable to load bitmap:"+*bitmappath);
+ wxLogError(_T("Unable to load bitmap:")+*bitmappath);
//Make a bitmap file name
bitmapname=CleanName(bitmapname);
- bitmapname+=".bmp";
- m_xmlfile.Write("\t\t\t<bitmap>"+bitmapname+"</bitmap>\n");
+ bitmapname+=_T(".bmp");
+ m_xmlfile.Write(_T("\t\t\t<bitmap>")+bitmapname+_T("</bitmap>\n"));
bitmap.SaveFile(m_targetpath+bitmapname,wxBITMAP_TYPE_BMP);
}
wxNode *node=m_iconlist->Find(iconname);
if (node==NULL)
{
- m_xmlfile.Write("\t\t\t<bitmap>missing_file</bitmap>\n");
- wxLogError("Unable to find icon:"+iconname);
+ m_xmlfile.Write(_T("\t\t\t<bitmap>missing_file</bitmap>\n"));
+ wxLogError(_T("Unable to find icon:")+iconname);
}
wxString *iconpath;
- iconpath=(wxString *)node->Data();
+ iconpath=(wxString *)node->GetData();
wxIcon icon;
wxBitmap bitmap;
if (!icon.LoadFile(*iconpath,wxBITMAP_TYPE_ICO ))
- wxLogError("Unable to load icon:"+*iconpath);
+ wxLogError(_T("Unable to load icon:")+*iconpath);
#ifdef __WXMSW__
bitmap.CopyFromIcon(icon);
#else
iconname=wxFileNameFromPath(*iconpath);
//Make a bitmap file name
iconname=CleanName(iconname);
- iconname+=".bmp";
- m_xmlfile.Write("\t\t\t<bitmap>"+iconname+"</bitmap>\n");
+ iconname+=_T(".bmp");
+ m_xmlfile.Write(_T("\t\t\t<bitmap>")+iconname+_T("</bitmap>\n"));
bitmap.SaveFile(m_targetpath+iconname,wxBITMAP_TYPE_BMP);
{
wxTextFile r;
//Attempt to load resource.h in current path
- if (!r.Open("resource.h"))
+ if (!r.Open(_T("resource.h")))
{
- wxLogError("Warining Unable to load resource.h file");
+ wxLogError(_T("Warining Unable to load resource.h file"));
return;
}
//Read through entire file
for ( str = r.GetFirstLine(); !r.Eof(); str = r.GetNextLine() )
{
- if (str.Find("#define")!=-1)
+ if (str.Find(_T("#define"))!=-1)
{
tok.SetString(str);
//Just ignore #define token
if (node==NULL)
return id;
- s=(wxString *)node->Data();
+ s=(wxString *)node->GetData();
st=*s;
return st;
}