1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
|
#include "StdAfx.h"
#include "T2AdvertiseTable.h"
#include "T2Dialog.h"
#include "T2DlgItemAnimation.h"
#include "T2DlgItemArrows.h"
#include "T2DlgItemEdit.h"
#include "T2DlgItemIButton.h"
#include "T2DlgItemICheck.h"
#include "T2DlgItemIRepeater.h"
#include "T2DlgItemListBox.h"
#include "T2DlgItemMerchandiseField.h"
#include "T2DlgItemMovie.h"
#include "T2DlgItemPeopleView.h"
#include "T2DlgItemPopup.h"
#include "T2DlgItemProgress.h"
#include "T2DlgItemRadioButton.h"
#include "T2DlgItemRadioText.h"
#include "T2DlgItemSTimeTbl.h"
#include "T2PluginInfoTable.h"
#include "../T2TowerDoc.h"
#include "T2WorldDef.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#line 19
IMPLEMENT_DYNCREATE(T2Dialog, CWnd)
T2Dialog::T2Dialog() {
mInModalLoop = false;
mUserCon = 0;
mDeleteOnClose = false;
mFontName = "\x82\x6C\x82\x72 \x82\x6F\x83\x53\x83\x56\x83\x62\x83\x4E";
for (int i = 0; i < 10; i++)
mFontNums[i] = 0;
}
/*virtual*/ T2Dialog::~T2Dialog() {
for (int i = 0; i < 10; i++) {
if (mFonts[i])
delete mFonts[i];
}
}
void T2Dialog::Realize(void* a, T2DLGTEMPLATE* tmpl, T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette, BOOL isToolWindow, CWnd* parentWnd, UINT nID, BOOL autoShow) {
mEC = a;
mTowerDoc = towerDoc;
mAutoShow = autoShow;
mTemplate = *tmpl;
mImageObj = imageObj;
if (towerDoc && mTowerDoc->mWorldDef)
mPalette = mTowerDoc->mWorldDef->GetPalette();
else if (palette)
mPalette = palette;
else
mPalette = NULL;
if (!parentWnd)
parentWnd = AfxGetMainWnd();
for (int i = 0; i < 10; i++)
mFonts[i] = NULL;
mFontCount = 0;
mCurrentFont = -1;
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = 100;
rect.bottom = 100;
CString wndClass = AfxRegisterWndClass(
CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS,
LoadCursor(NULL, IDC_ARROW),
(HBRUSH) GetStockObject(WHITE_BRUSH),
NULL);
CreateEx(
isToolWindow ? WS_EX_TOOLWINDOW : 0,
wndClass,
"",
isToolWindow ? (WS_POPUP | WS_CAPTION) : WS_CHILD,
rect,
parentWnd,
nID
);
}
BEGIN_MESSAGE_MAP(T2Dialog, CWnd)
ON_WM_CREATE()
ON_WM_DESTROY()
ON_WM_QUERYNEWPALETTE()
ON_WM_ERASEBKGND()
ON_WM_LBUTTONDBLCLK()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_ACTIVATEAPP()
END_MESSAGE_MAP()
int T2Dialog::OnCreate(CREATESTRUCT* cs) {
if (CWnd::OnCreate(cs) == -1)
return -1;
HRSRC rsrc = FindResource(mTemplate.moduleHandle, MAKEINTATOM(mTemplate.resID), "T2DLG");
if (!rsrc) {
// "ダイアログがありません。" - No dialog.
MessageBox("\x83\x5F\x83\x43\x83\x41\x83\x8D\x83\x4F\x82\xAA\x82\xA0\x82\xE8\x82\xDC\x82\xB9\x82\xF1\x81\x42");
return 0;
}
#line 90
_ASSERT(rsrc);
HGLOBAL theResHandle = LoadResource(mTemplate.moduleHandle, rsrc);
#line 92
_ASSERT(theResHandle);
void *theRes = LockResource(theResHandle);
#line 94
_ASSERT(theRes);
DWORD theResSize = SizeofResource(mTemplate.moduleHandle, rsrc);
char *data = (char *) malloc(theResSize + 1);
memcpy(data, theRes, theResSize);
data[theResSize] = 0;
DoOnCreate(data);
free(data);
OnT2Create();
if (mTowerDoc && !(GetWindowLong(m_hWnd, GWL_STYLE) & WS_CHILD)) {
if (mModal != 0)
mTowerDoc->towerDoc_vf1A0(true);
if (mModal == 1)
mTowerDoc->towerDoc_vf290(true);
}
if (mAutoShow && !(cs->style & WS_CHILD))
ShowWindow(SW_SHOW);
return 0;
}
T2Dialog::T2DialogDef::T2DialogDef()
: width(100)
, height(100)
, modal(1)
, title(NULL)
, center(true)
, flags(WS_VISIBLE | WS_CHILD)
{
}
/*virtual*/ T2Dialog::T2DialogDef::~T2DialogDef() {
}
/*virtual*/ void T2Dialog::AfterBurner(T2DialogDef& def) {
mModal = def.modal;
SetWindowText(def.title);
CRect windowRect, clientRect, theDesktopRect;
GetWindowRect(windowRect);
GetClientRect(clientRect);
GetDesktopWindow()->GetClientRect(theDesktopRect);
def.width += (windowRect.Width() - clientRect.Width());
def.height += (windowRect.Height() - clientRect.Height());
int cx = def.center ? (mTemplate.pt.x - def.width / 2) : mTemplate.pt.x;
if (cx < theDesktopRect.left)
cx = theDesktopRect.left;
if (cx + def.width >= theDesktopRect.right)
cx = theDesktopRect.right - def.width;
int cy = def.center ? (mTemplate.pt.y - def.height / 2) : mTemplate.pt.y;
if (cy < theDesktopRect.top)
cy = theDesktopRect.top;
if (cy + def.height >= theDesktopRect.bottom)
cy = theDesktopRect.bottom - def.height;
SetWindowPos(NULL, cx, cy, def.width, def.height, SWP_NOZORDER);
}
/*virtual*/ void T2Dialog::DoOnCreate(char* data) {
T2DialogDef def;
CreateDlgItemLoop(def, data);
AfterBurner(def);
}
void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) {
CTokenizer tokenizer(data);
while (tokenizer.NextWord()) {
if (tokenizer.Current()[0] == '#')
tokenizer.NextString("\r\n");
else
CreateDlgItem(tokenizer, def);
}
}
/*virtual*/ void T2Dialog::CreateDlgItem(CTokenizer& inTokenizer, T2DialogDef& inDef) {
const char *token = inTokenizer.Current();
if (!_stricmp(token, "WIDTH")) {
inDef.width = inTokenizer.NextInteger();
} else if (!_stricmp(token, "HEIGHT")) {
inDef.height = inTokenizer.NextInteger();
} else if (!_stricmp(token, "MODAL")) {
inDef.modal = 1;
} else if (!_stricmp(token, "MODALESS")) {
inDef.modal = 0;
} else if (!_stricmp(token, "TMODAL")) {
inDef.modal = 2;
} else if (!_stricmp(token, "TITLE")) {
inDef.title = inTokenizer.NextString();
} else if (!_stricmp(token, "FONTNAME")) {
mFontName = inTokenizer.NextString();
} else if (!_stricmp(token, "FONT")) {
int fontNum = inTokenizer.NextInteger();
int i;
for (i = 0; i < 10; i++) {
if (mFonts[i] && mFontNums[i] == fontNum)
break;
}
if (i == 10) {
mFontNums[mFontCount] = fontNum;
#line 228
mFonts[mFontCount] = new CFont;
CString str;
if (mFontName[0] == '!') {
str = mFontName.Mid(1);
mFonts[mFontCount]->CreateFont(-abs(fontNum), 0, 0, 0, (fontNum > 0) ? FW_NORMAL : FW_BOLD, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, DRAFT_QUALITY, DEFAULT_PITCH, str);
} else {
mFonts[mFontCount]->CreateFont(-abs(fontNum), 0, 0, 0, (fontNum > 0) ? FW_NORMAL : FW_BOLD, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, PROOF_QUALITY, DEFAULT_PITCH, mFontName);
}
mCurrentFont = mFontCount;
mFontCount++;
} else {
mCurrentFont = i;
}
} else if (!_stricmp(token, "VISIBLE")) {
inDef.flags |= WS_VISIBLE;
} else if (!_stricmp(token, "INVISIBLE")) {
inDef.flags &= ~WS_VISIBLE;
} else if (!_stricmp(token, "CENTER")) {
inDef.center = true;
} else if (!_stricmp(token, "LEFTTOP")) {
inDef.center = false;
} else if (!_stricmp(token, "OK")) {
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
#line 263
T2DlgItemOK *item = new T2DlgItemOK(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, 1);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "CANCEL")) {
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
#line 274
T2DlgItemCANCEL *item = new T2DlgItemCANCEL(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, 2);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "BUTTON")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 289
T2DlgItemTButton *item = new T2DlgItemTButton(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "IBUTTON")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 304
T2DlgItemIButton *item = new T2DlgItemIButton(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "CHECK")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
#line 316
T2DlgItemCheck *item = new T2DlgItemCheck(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "ICHECK")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
#line 329
T2DlgItemICheck *item = new T2DlgItemICheck(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "IREPEAT")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 344
T2DlgItemIRepeater *item = new T2DlgItemIRepeater(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "RADIO")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
#line 357
T2DlgItemRadioButton *item = new T2DlgItemRadioButton(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(inTokenizer.Current(), "TXRADIO")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 371
T2DlgItemRadioText *item = new T2DlgItemRadioText(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "EDIT")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
int maxChars = inTokenizer.NextInteger();
#line 386
T2DlgItemEdit *item = new T2DlgItemEdit(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id);
item->CreateSubItem(&maxChars);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "HSCROLL")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 400
T2DlgItemHScr *item = new T2DlgItemHScr(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "VSCROLL")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 414
T2DlgItemVScr *item = new T2DlgItemVScr(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "BOX")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 428
T2DlgItemBox *item = new T2DlgItemBox(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "TEXT")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 443
T2DlgItemText *item = new T2DlgItemText(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "DIALOG")) {
UINT id = inTokenizer.NextInteger();
T2DLGTEMPLATE theTemplate;
theTemplate.resID = inTokenizer.NextInteger();
theTemplate.pt.x = inTokenizer.NextInteger();
theTemplate.pt.y = inTokenizer.NextInteger();
theTemplate.moduleHandle = mTemplate.moduleHandle;
#line 457
T2Dialog *theDialog = new T2Dialog;
theDialog->Realize(this, &theTemplate, mTowerDoc, mImageObj, NULL, false, this, id, true);
} else if (!_stricmp(token, "PPVIEW")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 468
T2DlgItemPeopleView *item = new T2DlgItemPeopleView(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "PGAGE")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 482
T2DlgItemProfitsGage *item = new T2DlgItemProfitsGage(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "CGAGE")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 496
T2DlgItemCustomerGage *item = new T2DlgItemCustomerGage(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "SGAGE")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 510
T2DlgItemStressGage *item = new T2DlgItemStressGage(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "EGAGE")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 524
T2DlgItemPPLEvalGage *item = new T2DlgItemPPLEvalGage(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "BGAGE")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 538
T2DlgItemBelongGage *item = new T2DlgItemBelongGage(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "TABLE")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 552
T2DlgItemTable *item = new T2DlgItemTable(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "POPUP")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 566
T2DlgItemPopup *item = new T2DlgItemPopup(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "PINFTBL")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 580
T2PluginInfoTable *item = new T2PluginInfoTable(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "IMAGE")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 594
T2DlgItemImage *item = new T2DlgItemImage(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "MERF")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
int maxChars = inTokenizer.NextInteger();
#line 608
T2DlgItemMerchandiseField *item = new T2DlgItemMerchandiseField(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id);
item->CreateSubItem(&maxChars);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "ARROWS")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
#line 619
T2DlgItemArrows *item = new T2DlgItemArrows(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "LISTBOX")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 634
T2DlgItemListBox *item = new T2DlgItemListBox(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id);
item->CreateSubItem();
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "TBDISABLED")) {
UINT id = inTokenizer.NextInteger();
CString text = inTokenizer.NextString();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 649
CToggleButtonDisabled *item = new CToggleButtonDisabled(mTowerDoc, mImageObj, mPalette);
item->Create(text, inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "STIMETBL")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 662
T2DlgItemSTimeTbl *item = new T2DlgItemSTimeTbl(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "MOVIE")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 676
T2DlgItemMovie *item = new T2DlgItemMovie(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "MOVTBL")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 690
T2MovieTable *item = new T2MovieTable(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "ANIM")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 705
T2DlgItemAnimation *item = new T2DlgItemAnimation(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "PROG")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 719
T2DlgItemProgress *item = new T2DlgItemProgress(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id);
item->CreateSubItem();
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else if (!_stricmp(token, "ATZTBL")) {
UINT id = inTokenizer.NextInteger();
RECT rect;
rect.left = inTokenizer.NextInteger();
rect.top = inTokenizer.NextInteger();
rect.right = inTokenizer.NextInteger();
rect.bottom = inTokenizer.NextInteger();
#line 733
T2AdvertiseTable *item = new T2AdvertiseTable(mTowerDoc, mImageObj, mPalette);
item->Create("", inDef.flags, rect, this, id);
item->CreateSubItem(NULL);
if (mCurrentFont >= 0)
item->SetFont(*mFonts[mCurrentFont]);
} else {
// "ダイアログテキスト内に見知らぬトークンがあります:"
CString err = "\x83\x5F\x83\x43\x83\x41\x83\x8D\x83\x4F\x83\x65\x83\x4C\x83\x58\x83\x67\x93\xE0\x82\xC9\x8C\xA9\x92\x6D\x82\xE7\x82\xCA\x83\x67\x81\x5B\x83\x4E\x83\x93\x82\xAA\x82\xA0\x82\xE8\x82\xDC\x82\xB7\x81\x46";
err += token;
MessageBox(err, NULL, MB_ICONEXCLAMATION);
}
}
void T2Dialog::OnDestroy() {
OnT2Destroy();
CWnd::OnDestroy();
if (mTowerDoc && !(GetWindowLong(m_hWnd, GWL_STYLE) & WS_CHILD)) {
if (mModal != 0)
mTowerDoc->towerDoc_vf1A0(false);
if (mModal == 1)
mTowerDoc->towerDoc_vf290(false);
}
}
BOOL T2Dialog::OnQueryNewPalette() {
return CWnd::OnQueryNewPalette();
}
BOOL T2Dialog::OnEraseBkgnd(CDC* dc) {
BOOL result = true;
if (!OnT2PreEraseBkgnd(dc)) {
int saved = dc->SaveDC();
dc->SelectPalette(mPalette, false);
dc->RealizePalette();
CBrush theBrush;
theBrush.CreateStockObject(LTGRAY_BRUSH);
CRect rect1;
GetClientRect(rect1);
dc->FillRect(rect1, &theBrush);
CPen pen1;
pen1.CreatePen(PS_SOLID, 0, PALETTERGB(255, 255, 255));
CPen pen2;
pen2.CreateStockObject(GRAY_BRUSH); // wait... that's not a pen
CRect rect2;
GetClientRect(rect2);
dc->SelectObject(pen1);
dc->MoveTo(rect2.right - 1, rect2.top);
dc->LineTo(rect2.left, rect2.top);
dc->LineTo(rect2.left, rect2.bottom);
dc->SelectObject(pen2);
dc->MoveTo(rect2.right - 1, rect2.top + 1);
dc->LineTo(rect2.right - 1, rect2.bottom - 1);
dc->LineTo(rect2.left, rect2.bottom - 1);
dc->RestoreDC(saved);
result = OnT2EraseBkgnd(dc);
}
return result;
}
/*virtual*/ BOOL T2Dialog::OnCommand(WPARAM wParam, LPARAM lParam) {
BOOL result = true;
WORD code = HIWORD(wParam);
WORD id = LOWORD(wParam);
if ((id == 1 || id == 2) && (code == 0)) {
if (id == 1)
OnT2OK();
else
OnT2Cancel();
DoClose(id);
} else {
result = OnT2DialogCommand(wParam, lParam);
}
return result;
}
int T2Dialog::DoModal() {
mInModalLoop = true;
int result = RunModalLoop(MLF_NOIDLEMSG);
if (mInModalLoop)
DestroyWindow();
return result;
}
void T2Dialog::DoClose(int nResult) {
if (mInModalLoop)
EndModalLoop(nResult);
else
DestroyWindow();
}
/*virtual*/ BOOL T2Dialog::PreTranslateMessage(MSG* msg) {
return CWnd::PreTranslateMessage(msg);
}
/*virtual*/ BOOL T2Dialog::PreCreateWindow(CREATESTRUCT&) {
return true;
}
void T2Dialog::MakeRadioGroup(int inBaseID, int inCount, int inSelected) {
for (unsigned short i = 1; i <= inCount; i++) {
unsigned short id = inBaseID + i;
((T2DlgItem *) GetDlgItem(id))->SetValue(i == inSelected);
}
}
void T2Dialog::MakeTabPanel(int inBaseID1, int inBaseID2, int inCount, int inSelected) {
for (unsigned short i = 1; i <= inCount; i++) {
unsigned short id2 = inBaseID2 + i;
unsigned short id1 = inBaseID1 + i;
GetDlgItem(id2)->EnableWindow(i != inSelected);
if (inBaseID1 != 0)
GetDlgItem(id1)->ShowWindow((i != inSelected) ? SW_HIDE : SW_SHOW);
}
}
void T2Dialog::OnLButtonDblClk(UINT nFlags, CPoint pt) {
OnT2DlgLButtonDblClk(nFlags, pt);
}
void T2Dialog::OnLButtonDown(UINT nFlags, CPoint pt) {
OnT2DlgLButtonDown(nFlags, pt);
}
void T2Dialog::OnLButtonUp(UINT nFlags, CPoint pt) {
OnT2DlgLButtonUp(nFlags, pt);
}
/*virtual*/ void T2Dialog::PostNcDestroy() {
if (mDeleteOnClose)
delete this;
else
CWnd::PostNcDestroy();
}
HFONT T2Dialog::GetFont() {
HFONT font = NULL;
if (mCurrentFont >= 0)
font = *mFonts[mCurrentFont];
return font;
}
void T2Dialog::OnActivateApp(BOOL bActive, HTASK hTask) {
CWnd::OnActivateApp(bActive, hTask);
}
|