15 #include "TextViewDlg.h"
20 static char THIS_FILE[] = __FILE__;
36 CDialog::DoDataExchange(pDX);
44 ON_EN_SETFOCUS(
IDC_EDIT1, OnSetfocusEdit1)
53 char line[256], line2[256], file_text[82];
54 int i, j,
n, found = 0, comment = 0, num_files = 0;
61 fp =
cfopen(
"ships.tbl",
"r");
65 while (
cfgets(line, 255, fp)) {
66 while (line[strlen(line) - 1] ==
'\n')
67 line[strlen(line) - 1] = 0;
69 for (i=j=0; line[
i]; i++) {
70 if (line[i] ==
'/' && line[i+1] ==
'/')
73 if (line[i] ==
'/' && line[i+1] ==
'*') {
79 if (line[i] ==
'*' && line[i+1] ==
'/') {
95 while (line2[i] ==
' ' || line2[i] ==
'\t' || line2[i] ==
'@')
99 m_edit +=
"-- ships.tbl -------------------------------\r\n";
116 for (n = 0; n < num_files; n++){
117 tbl_file_names[
n] +=
".tbm";
119 fp =
cfopen(tbl_file_names[n].c_str(),
"r");
122 memset( line, 0,
sizeof(line) );
123 memset( line2, 0,
sizeof(line2) );
127 while (
cfgets(line, 255, fp)) {
128 while (line[strlen(line) - 1] ==
'\n')
129 line[strlen(line) - 1] = 0;
131 for (i=j=0; line[
i]; i++) {
132 if (line[i] ==
'/' && line[i+1] ==
'/')
135 if (line[i] ==
'/' && line[i+1] ==
'*') {
141 if (line[i] ==
'*' && line[i+1] ==
'/') {
148 line2[j++] = line[
i];
152 if (!
strnicmp(line2,
"$Name:", 6)) {
157 while (line2[i] ==
' ' || line2[i] ==
'\t' || line2[i] ==
'@')
161 memset( file_text, 0,
sizeof(file_text) );
162 snprintf(file_text,
sizeof(file_text)-1,
"-- %s -------------------------------\r\n", tbl_file_names[n].c_str());
180 ((CEdit *) GetDlgItem(
IDC_EDIT1)) -> SetSel(-1, -1);
void drop_trailing_white_space(char *str)
char * cfgets(char *buf, int n, CFILE *cfile)
#define strnicmp(s1, s2, n)
GLuint const GLchar * name
virtual void DoDataExchange(CDataExchange *pDX)
SCP_vector< ship_info > Ship_info
afx_msg void OnSetfocusEdit1()
int cfclose(CFILE *cfile)
int cf_get_file_list(SCP_vector< SCP_string > &list, int pathtype, const char *filter, int sort=CF_SORT_NONE, SCP_vector< file_list_info > *info=NULL)
text_view_dlg(CWnd *pParent=NULL)