1096 |
"Type": "1", |
"Type": "1", |
1097 |
"Name": "CalendarPaper", |
"Name": "CalendarPaper", |
1098 |
"Data": """ |
"Data": """ |
1099 |
|
TextRenderer *r_date; |
1100 |
TextRenderer *r; |
TextRenderer *r; |
1101 |
float linewidth; |
float linewidth; |
1102 |
|
|
1103 |
|
int empty_days; |
1104 |
|
int days; |
1105 |
|
int first_week_number; |
1106 |
|
|
1107 |
|
unicodecharvector d_txt[7]; |
1108 |
|
unicodecharvector m_txt; |
1109 |
|
|
1110 |
|
float week_num_w; |
1111 |
|
float weekday_h; |
1112 |
|
float month_name_h; |
1113 |
|
|
1114 |
""", |
""", |
1115 |
"Params": """ |
"Params": """ |
1116 |
Font f, |
Font f_date, |
1117 |
float linewidth |
Font f, |
1118 |
|
float linewidth, |
1119 |
|
|
1120 |
|
int empty_days, |
1121 |
|
int days, |
1122 |
|
int first_week_number, |
1123 |
|
|
1124 |
|
String t1, |
1125 |
|
String t2, |
1126 |
|
String t3, |
1127 |
|
String t4, |
1128 |
|
String t5, |
1129 |
|
String t6, |
1130 |
|
String t7, |
1131 |
|
String t8, |
1132 |
|
|
1133 |
|
float week_num_w, |
1134 |
|
float weekday_h, |
1135 |
|
float month_name_h |
1136 |
|
|
1137 |
""", |
""", |
1138 |
"ParamCode": """ |
"ParamCode": """ |
1139 |
|
r_date = f_date; |
1140 |
r = f; |
r = f; |
1141 |
|
|
1142 |
|
d_txt[0] = t1; |
1143 |
|
d_txt[1] = t2; |
1144 |
|
d_txt[2] = t3; |
1145 |
|
d_txt[3] = t4; |
1146 |
|
d_txt[4] = t5; |
1147 |
|
d_txt[5] = t6; |
1148 |
|
d_txt[6] = t7; |
1149 |
|
|
1150 |
|
m_txt = t8; |
1151 |
|
|
1152 |
this->linewidth = linewidth; |
this->linewidth = linewidth; |
1153 |
|
|
1154 |
|
this->empty_days = empty_days; |
1155 |
|
this->days = days; |
1156 |
|
this->first_week_number = first_week_number; |
1157 |
|
|
1158 |
|
this->week_num_w = week_num_w; |
1159 |
|
this->weekday_h = weekday_h; |
1160 |
|
this->month_name_h = month_name_h; |
1161 |
|
|
1162 |
|
|
1163 |
""", |
""", |
1164 |
"ExtraClass" : """ |
"ExtraClass" : """ |
1165 |
template<class Coords> struct Vertexer { |
template<class Coords> struct Vertexer { |
1179 |
glPushAttrib(GL_ENABLE_BIT); |
glPushAttrib(GL_ENABLE_BIT); |
1180 |
glEnable(GL_BLEND); |
glEnable(GL_BLEND); |
1181 |
|
|
1182 |
// STILL STATIC MONTH |
int weeks = (days + empty_days) / 7; |
1183 |
int empty = 2; |
if ( (days + empty_days) % 7 != 0) weeks++; |
|
int days = 30; |
|
|
int weeks = (days + empty) / 7; |
|
|
if ( (days + empty) % 7 != 0) weeks++; |
|
|
|
|
|
if (dbg) cout << "w" << weeks << " d " << days << " e " << empty << "\\n"; |
|
1184 |
|
|
1185 |
// Coordinating system |
// Coordinating system |
1186 |
ZPt cs; |
ZPt cs; |
1187 |
|
|
1188 |
|
glDisable(GL_TEXTURE_2D); |
1189 |
|
|
1190 |
glLineWidth(linewidth); |
glLineWidth(linewidth); |
1191 |
glColor3f(0.0, 0.0, 0.0); |
glColor3f(0.0, 0.0, 0.0); |
1192 |
|
|
1193 |
glBegin(GL_LINES); |
glBegin(GL_LINES); |
1194 |
|
|
1195 |
|
// left -vert |
1196 |
|
cs = coords1.transform( ZPt(0.0, 0.0, 0.0) ); |
1197 |
|
glVertex3f(cs.x, cs.y, cs.z); |
1198 |
|
cs = coords1.transform( ZPt(0.0, weeks + weekday_h + month_name_h, 0.0) ); |
1199 |
|
glVertex3f(cs.x, cs.y, cs.z); |
1200 |
|
|
1201 |
|
// right -vert |
1202 |
|
cs = coords1.transform( ZPt(7.0+ week_num_w, 0.0, 0.0) ); |
1203 |
|
glVertex3f(cs.x, cs.y, cs.z); |
1204 |
|
cs = coords1.transform( ZPt(7.0+ week_num_w, weeks + weekday_h + month_name_h, 0.0) ); |
1205 |
|
glVertex3f(cs.x, cs.y, cs.z); |
1206 |
|
|
1207 |
|
// weekday - horiz |
1208 |
|
cs = coords1.transform( ZPt(0.0, month_name_h, 0.0) ); |
1209 |
|
glVertex3f(cs.x, cs.y, cs.z); |
1210 |
|
cs = coords1.transform( ZPt(7.0+week_num_w, month_name_h, 0.0) ); |
1211 |
|
glVertex3f(cs.x, cs.y, cs.z); |
1212 |
|
|
1213 |
|
// top - horiz line |
1214 |
|
cs = coords1.transform( ZPt(0.0, 0.0, 0.0) ); |
1215 |
|
glVertex3f(cs.x, cs.y, cs.z); |
1216 |
|
cs = coords1.transform( ZPt(7.0+week_num_w, 0.0, 0.0) ); |
1217 |
|
glVertex3f(cs.x, cs.y, cs.z); |
1218 |
|
|
1219 |
|
|
1220 |
|
// Calendar: |
1221 |
// Vertical lines. |
// Vertical lines. |
1222 |
for (int i=0; i<=7; i++) { |
for (int i=0; i<7; i++) { |
1223 |
cs = coords1.transform( ZPt(i, 0.0, 0.0) ); |
cs = coords1.transform( ZPt(i + week_num_w, month_name_h, 0.0) ); |
1224 |
glVertex3f(cs.x, cs.y, cs.z); |
glVertex3f(cs.x, cs.y, cs.z); |
1225 |
|
|
1226 |
cs = coords1.transform( ZPt(i, weeks, 0.0) ); |
cs = coords1.transform( ZPt(i + week_num_w, month_name_h + weeks + weekday_h, 0.0) ); |
1227 |
glVertex3f(cs.x, cs.y, cs.z); |
glVertex3f(cs.x, cs.y, cs.z); |
1228 |
} |
} |
1229 |
// Horizontal lines. |
// Horizontal lines. |
1230 |
for (int i=0; i<=weeks; i++) { |
for (int i=0; i<=weeks; i++) { |
1231 |
cs = coords1.transform( ZPt(0.0, i, 0.0) ); |
cs = coords1.transform( ZPt(0.0, i+month_name_h+weekday_h, 0.0) ); |
1232 |
glVertex3f(cs.x, cs.y, cs.z); |
glVertex3f(cs.x, cs.y, cs.z); |
1233 |
|
|
1234 |
cs = coords1.transform( ZPt(7.0, i, 0.0) ); |
cs = coords1.transform( ZPt(7.0+week_num_w, i+month_name_h+weekday_h, 0.0) ); |
1235 |
glVertex3f(cs.x, cs.y, cs.z); |
glVertex3f(cs.x, cs.y, cs.z); |
1236 |
} |
} |
1237 |
glEnd(); |
glEnd(); |
1238 |
|
|
1239 |
|
glEnable(GL_TEXTURE_2D); |
1240 |
|
|
1241 |
for (int i=1; i<=days; i++) { |
Vertexer<Coords> v(coords1); |
|
int column = (empty + i) % 7; |
|
|
int row = 1 + (empty + i) / 7; |
|
1242 |
|
|
1243 |
Vertexer<Coords> v(coords1); |
for (int i=1; i<=days; i++) { |
1244 |
|
int column = (empty_days + i -1) % 7; |
1245 |
|
int row = 1 + (empty_days + i -1) / 7; |
1246 |
|
|
1247 |
static char buffer[64]; |
static char buffer[64]; |
1248 |
sprintf(buffer, "%i", i); |
sprintf(buffer, "%i", i); |
1249 |
|
|
1250 |
float fcol, frow; |
float fcol, frow; |
1251 |
|
|
1252 |
|
fcol = week_num_w; |
1253 |
|
frow = weekday_h + month_name_h; |
1254 |
|
|
1255 |
if (i<10) { |
if (i<10) { |
1256 |
fcol = column + 0.30; |
fcol += column + 0.30; |
1257 |
frow = row - 0.25; |
frow += row - 0.25; |
1258 |
} else { |
} else { |
1259 |
fcol = column + 0.10; |
fcol += column + 0.10; |
1260 |
frow = row - 0.25; |
frow += row - 0.25; |
1261 |
} |
} |
1262 |
|
|
1263 |
glColor3f(1.0, 1.0, 1.0); |
glColor3f(1.0, 1.0, 1.0); |
1264 |
|
|
1265 |
Text::renderIter(*r, buffer, buffer+strlen(buffer), |
Text::renderIter(*r_date, buffer, buffer+strlen(buffer), |
1266 |
fcol , frow, v |
fcol , frow, v |
1267 |
); |
); |
1268 |
|
|
1269 |
if (column == 6) glColor3f(1.0, 0.0, 0.0); |
if (column == 6) glColor3f(1.0, 0.0, 0.0); |
1270 |
else glColor3f(0.0, 0.0, 0.0); |
else glColor3f(0.0, 0.0, 0.0); |
1271 |
|
|
1272 |
Text::renderIter(*r, buffer, buffer+strlen(buffer), |
Text::renderIter(*r_date, buffer, buffer+strlen(buffer), |
1273 |
fcol + 0.03 , frow + 0.03, v |
fcol + 0.03 , frow + 0.03, v |
1274 |
); |
); |
1275 |
|
|
1276 |
} |
} |
1277 |
|
|
1278 |
|
glColor3f(0.0, 0.0, 0.0); |
1279 |
|
|
1280 |
|
for (int i=0; i<weeks; i++) { |
1281 |
|
static char buffer[64]; |
1282 |
|
sprintf(buffer, "%i", first_week_number + i); |
1283 |
|
|
1284 |
|
Text::renderIter(*r, buffer, buffer+strlen(buffer), |
1285 |
|
0.1 , month_name_h + weekday_h + i + 0.8, v |
1286 |
|
); |
1287 |
|
|
1288 |
|
} |
1289 |
|
|
1290 |
|
for (int i=0; i<7; i++) { |
1291 |
|
Text::renderIter(*r, d_txt[i].begin(), d_txt[i].end(), |
1292 |
|
week_num_w + i, month_name_h + weekday_h -0.1, v |
1293 |
|
); |
1294 |
|
} |
1295 |
|
|
1296 |
|
Text::renderIter(*r, m_txt.begin(), m_txt.end(), |
1297 |
|
week_num_w+2.0, month_name_h-0.1, v |
1298 |
|
); |
1299 |
|
|
1300 |
|
|
1301 |
glPopAttrib(); |
glPopAttrib(); |
1302 |
|
|
1303 |
if (dbg) cout << "Calendar done\\n"; |
if (dbg) cout << "Calendar done\\n"; |