// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWindows headers
+// need because it includes almost all "standard" wxWidgets headers
#ifndef WX_PRECOMP
{
-m_done=FALSE;
+m_done=false;
m_controlid=6000;
void rc2wxr::Convert(wxString wxrfile, wxString rcfile)
-
{
+ m_rc.Open(rcfile);
+ m_filesize=m_rc.Length();
+ if( (m_wxr = wxFopen( wxrfile.fn_str(), _T("wt") )) == NULL )
+ {
+ return;
+ }
-m_rc.Open(rcfile);
-
-m_filesize=m_rc.Length();
-
-if( (m_wxr = fopen( wxrfile, "wt" )) == NULL )
-
-{
-
- return;
-
-}
-
-
-
-
-
-wxString tok,prevtok;
-
-
-
-
-
-while (!m_done)
-
-{
-
-
-
-tok=GetToken();
-
-
-
-if (tok=="DIALOG")
-
-{
-
-ParseDialog(prevtok);
-
-}
-
-
-
-
-
-if (tok=="MENU")
-
-{
-
-ParseMenu(prevtok);
-
-}
-
-
-
-prevtok=tok;
-
-}
-
-
+ wxString tok,prevtok;
-fclose(m_wxr);
+ while (!m_done)
+ {
+ tok=GetToken();
-//fclose(m_rc);
+ if (tok==_T("DIALOG"))
+ {
+ ParseDialog(prevtok);
+ }
-m_rc.Close();
+ if (tok==_T("MENU"))
+ {
+ ParseMenu(prevtok);
+ }
+ prevtok=tok;
+ }
+ fclose(m_wxr);
+ m_rc.Close();
}
//Microsoft notation?
-if (tok=="DISCARDABLE")
+if (tok==_T("DISCARDABLE"))
{
//Generate Dialog text
-fprintf(m_wxr,"static char *dialog%i = \"dialog(name = '%s',\\\n",dlgid,dlgname);
+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);
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);
-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);
+wxFprintf(m_wxr,_T("title = '%s',\\\n"),title.c_str());
}
}
-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"));
}
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();
ReadRect(x,y,width,height);
-fprintf(m_wxr," control = [%i,wxStaticText,'%s','0','%s',",m_controlid,phrase,varname);
+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"));
}
ReadRect(x,y,width,height);
-fprintf(m_wxr," control = [%i,wxTextCtrl,'','0','%s',",m_controlid,varname);
+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"));
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;
ReadRect(x,y,width,height);
-fprintf(m_wxr," control = [%i,wxButton,'%s','0','%s',",c,phrase,varname);
+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"));
if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|'))
- return TRUE;
+ return true;
{
-m_done=TRUE;
+m_done=true;
-return TRUE;
+return true;
}
-return FALSE;
+return false;
}
ReadRect(x,y,width,height);
-fprintf(m_wxr," control = [%i,wxStaticBox,'%s','0','%s',",m_controlid,phrase,varname);
+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"));
{
-x=atoi(GetToken());
+x=wxAtoi(GetToken());
-y=atoi(GetToken());
+y=wxAtoi(GetToken());
-width=atoi(GetToken());
+width=wxAtoi(GetToken());
-height=atoi(GetToken());
+height=wxAtoi(GetToken());
{
-wxString tok="";
+wxString tok=wxEmptyString;
{
-m_done=TRUE;
+m_done=true;
return tok;
{
-m_done=TRUE;
+m_done=true;
return tok;
{
-m_done=TRUE;
+m_done=true;
if (ch==EOF)
- m_done=TRUE;
+ m_done=true;
{
- int result;
+ int result;
result=m_rc.Tell();
if((result>=m_filesize))
- m_done=TRUE;
+ m_done=true;
if((result==-1))
- m_done=TRUE;
+ m_done=true;
if(ch==EOF)
- m_done=TRUE;
+ m_done=true;
}
-fprintf(m_wxr," control = [%i,wxChoice,'','0','%s',",m_controlid,varname);
+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"));
{
-wxString tok="";
+wxString tok=wxEmptyString;
static int menuid=0;
menuid++;
-fprintf(m_wxr,"static char *MenuBar%i = \"menu(name = '%s',\\\n",menuid,name);
+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"));
- }
+ }
}
-fprintf(m_wxr,"]).\";\n\n");
+wxFprintf(m_wxr,_T("]).\";\n\n"));
}
//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,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
//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,menuitem);
+wxFprintf(m_wxr,_T(" ['%s',%i,''],\\\n"),tok.c_str(),menuitem);
}
-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);
-void rc2wxr::ParseSlider(wxString label, wxString varname)
+void rc2wxr::ParseSlider(wxString WXUNUSED(label), wxString varname)
{
wxString tok;
-while (ReadOrs(tok));
+while (ReadOrs(tok))
+ ;
-fprintf(m_wxr," control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',",m_controlid,varname);
+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"));
}
*/
-void rc2wxr::ParseProgressBar(wxString label, wxString varname)
+void rc2wxr::ParseProgressBar(wxString WXUNUSED(label), wxString varname)
{
wxString tok;
-while (ReadOrs(tok));
+while (ReadOrs(tok))
+ ;
-fprintf(m_wxr," control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',",m_controlid,varname);
+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"));
}
w=GetToken();
-return TRUE;
+return true;
}
-if (tok=="BS_AUTOCHECKBOX")
+if (tok==_T("BS_AUTOCHECKBOX"))
{
- fprintf(m_wxr," control = [%i,wxCheckBox,'%s','0','%s',",m_controlid,label,varname);
+ wxFprintf(m_wxr,_T(" control = [%i,wxCheckBox,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str());
- while (ReadOrs(tok));
+ 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,varname);
+ wxFprintf(m_wxr,_T(" control = [%i,wxRadioButton,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str());
- while(ReadOrs(tok));
+ 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"));
}