X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2193517f1b909b834dc6e314acc3b873dc8196d9..82dfea7723b354423e96221d4854878874cfce58:/contrib/utils/convertrc/rc2xml.cpp
diff --git a/contrib/utils/convertrc/rc2xml.cpp b/contrib/utils/convertrc/rc2xml.cpp
index 795f45a9eb..15f7ac44ee 100644
--- a/contrib/utils/convertrc/rc2xml.cpp
+++ b/contrib/utils/convertrc/rc2xml.cpp
@@ -68,6 +68,11 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile)
m_rc.Open(rcfile.c_str());
m_filesize=m_rc.Length();
+ m_workingpath=wxPathOnly(rcfile);
+ m_targetpath=wxPathOnly(xmlfile)+"\\";
+
+ wxSetWorkingDirectory(m_workingpath);
+
bool result;
result=m_xmlfile.Open(xmlfile.c_str(),"w+t");
wxASSERT_MSG(result,"Couldn't create XML file");
@@ -123,7 +128,7 @@ microsoft reuses the keyword DIALOG for other things
wxString title;
wxString ptsize,face;
- m_xmlfile.Write("\t\n");
+ m_xmlfile.Write("\t\n");
}
/*
@@ -173,6 +176,12 @@ void rc2xml::ParseControls()
token=GetToken();
while ((token!="END")&(token!="}"))
{
+ if (token=="AUTOCHECKBOX")
+ ParseCheckBox();
+ else
+ if (token=="AUTORADIOBUTTON")
+ ParseRadioButton();
+ else
if (token=="LTEXT")
ParseStaticText();
else if (token=="EDITTEXT")
@@ -207,9 +216,9 @@ void rc2xml::ParseStaticText()
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t\n");
+ m_xmlfile.Write("\t\t\n");
}
//EDITTEXT IDC_RADIUS,36,65,40,14,ES_AUTOHSCROLL
@@ -222,11 +231,50 @@ void rc2xml::ParseTextCtrl()
ReadRect(x,y,width,height);
//TODO
//style=GetToken();
- m_xmlfile.Write("\t\t\n");
+
+}
+//AUTOCHECKBOX "&log.", ID_XLOG, 25, 24, 21, 12
+void rc2xml::ParseCheckBox()
+{
+ wxString token;
+ wxString phrase,varname;
+ phrase=GetQuoteField();
+ varname=GetToken();
+
+ int x,y,width,height;
+ ReadRect(x,y,width,height);
+
+ m_xmlfile.Write("\t\t\n");
}
@@ -271,21 +319,24 @@ void rc2xml::ParseGroupBox()
int x,y,width,height;
ReadRect(x,y,width,height);
- m_xmlfile.Write("\t\t\n");
+ m_xmlfile.Write("\t\t\n");
}
-void rc2xml::ReadRect(int & x, int & y, int & width, int & height)
+bool rc2xml::ReadRect(int & x, int & y, int & width, int & height)
{
x=atoi(GetToken());
y=atoi(GetToken());
width=atoi(GetToken());
- height=atoi(GetToken());
+ bool ret;
+ wxString tmp = GetToken(&ret);
+ height=atoi(tmp);
+ return ret; // check for more parameters
}
-wxString rc2xml::GetToken()
+wxString rc2xml::GetToken(bool *listseperator)
{
wxString token="";
@@ -318,13 +369,15 @@ wxString rc2xml::GetToken()
while (!Seperator(ch))
{
- token+=(char)ch;
+ token += (char)ch;
ReadChar(ch);
}
- if (ch==EOF)
- m_done=TRUE;
+ if (ch == EOF)
+ m_done = TRUE;
+ if (listseperator)
+ *listseperator = (ch == ',');
return token;
}
@@ -369,15 +422,22 @@ void rc2xml::ParseComboBox()
{
/* COMBOBOX IDC_SCALECOMBO,10,110,48,52,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP */
- wxString token;
+ wxString token,style;
wxString varname;
varname=GetToken();
int x,y,width,height;
- ReadRect(x,y,width,height);
+ if (ReadRect(x,y,width,height))
+ ReadOrs(token);
- m_xmlfile.Write("\t\t\n");
+ 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\n");
}
@@ -386,12 +446,11 @@ void rc2xml::ParseMenu(wxString varname)
wxString token="";
//Write menubar to xml file
- m_xmlfile.Write("\t\n");
+ m_xmlfile.Write("\t\n");
}
void rc2xml::ParsePopupMenu()
@@ -423,11 +481,10 @@ void rc2xml::ParsePopupMenu()
//Write Menu item
//Generate a fake name since RC menus don't have one
name<<"Menu_"<