-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeneratorDlg.cpp
1122 lines (948 loc) · 29.7 KB
/
GeneratorDlg.cpp
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
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// GeneratorDlg.cpp : implementation file
//
#include "stdafx.h"
#include "afxwin.h"
#include "Generator.h"
#include "GeneratorDlg.h"
#include "regexer.h"
#include "ModClassListDlg.h"
#include "GeneratorIniFile.h"
#include "hlinkctrl\hlinkctl.h"
#include ".\generatordlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// globals
int iRod;
CFont Font;
using namespace regex;
using namespace std;
extern class REParser REP;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog {
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CEdit CAbout;
CString strAbout;
CHLinkCtrl ctrlRTADS_hlink;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
afx_msg void OnUpdateEdit1();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
CHLinkCtrl ctrlGrAndreyEmail;
CHLinkCtrl ctrlStasEmail;
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
strAbout = "Ñîâåòû ïî ãåíåðàöèè ïàäåæíûõ ôîðì:\r\n\r\n\
 âåðõíåå ïîëå ââîäà äà¸òñÿ âûðàæåíèå. \
Åñëè îíî áîëåå îäíîé áóêâû, òî íåìåäëåííî íà÷íåòñÿ îáðàáîòêà. \
Åñëè âàñ íå óñòðàèâàåò \
ðåçóëüòàò, òî, âåðîÿòíî, Âàì íåîáõîäèìî ïîìåíÿòü ïîë èëè \
ñâîéñòâî îäóøåâë¸ííîñòè îáúåêòà.  èíîì ñëó÷àå ïåðåéäèòå íà \
ñîîòâåòñòâóþùåå ïîëå è íàáåðèòå íóæíîå çíà÷åíèå. \
Êàê òîëüêî Âû íà÷íåòå ðàáîòó ñî ñòðîêîé, ñïðàâà îò íå¸ ñíèìåòñÿ \
ãàëî÷êà, êîòîðàÿ îáîçíà÷àåò, ÷òî ïðè èçìåíåíèè èìåíèòåëüíîãî \
ïàäåæà (âåðõíÿÿ ñòðîêà) äàííàÿ ñòðîêà íå áóäåò ìåíÿòüñÿ. \
Åñëè íåîáõîäèìî ÷òîáû âñå ïàäåæíûå ôîðìû âûãëÿäåëè \
îäèíàêîâî, ïîñòàâüòå ãàëî÷êó íàïðîòèâ ïåðâîé ñòðîêè.\r\n\r\n\
Òðè ãàëî÷êè âî âòîðîì ñòîëáöå âûçûâàþò äîáàâëåíèå \
äîïîëíèòåëüíîãî ñëîâà ñ ïîìåòêîé äëÿ ïàðñåðà (ñèíòàêñè÷åñêîãî \
àíàëèçàòîðà), óêàçûâàþùåé åãî êàê ñîîòâåòñòâóþùèé ïàäåæ. \
Ãàëî÷êà íàïðîòèâ ðîäèòåëüíîãî ïàäåæà ñîçäàþò ïîìåòêó \
ðîäèòåëüíîãî ïàäåæà äëÿ âñåõ ñëîâ, îïðåäåë¸ííûõ ïîñëå \
ïðåäëîãîâ \"èç\", \"äëÿ\", \"îò\" è ìíîãèõ äðóãèõ. Ýòî ïîçâîëèò ïàðñåðó \
(ñèíòàêñè÷åñêîìó àíàëèçàòîðó) óçíàâàòü îïðåäåëÿþùèå ñëîâà ïîñëå \
îïðåäåëÿåìîãî ñóùåñòâèòåëüíîãî. Íàïðèìåð, ÷òîáû áûë ðàñïîçíàí îáúåêò \
\"ïîñîõ óæàñà\", íóæíî ââåñòè åãî êàê \"ïîñîõ äëÿ óæàñà\" è \
âêëþ÷èòü ïîìåòêó íàïðîòèâ ðîäèòåëüíîãî ïàäåæà. Åñëè \
âàì íóæåí \"êëþ÷ èç çîëîòà\", òî ïîìåòêó äåëàòü íå íóæíî. \
Ò.å. ãàëî÷êà íóæíà òîëüêî â ñëó÷àå îòñóòñòâèÿ ïðåäëîãà.\r\n\r\n\
Àëãîðèòì ðàññ÷èòàí íà ïðåäëîæåíèå èç ïðèëàãàòåëüíûõ è \
ñóùåñòâèòåëüíûõ. Ââîäèòü ìîæíî äî 15 ñëîâ. \
Äâà è áîëåå ñóùåñòâèòåëüíûõ áóäóò îáðàáàòûâàòüñÿ ïî îäíîé \
ñõåìå - îäóøåâëåííîñòü/ïîë.  ñîìíèòåëüíûõ ñëó÷àÿõ àëãîðèòì ïðèíèìàåò \
ïåðâûå ñëîâà çà ïðèëàãàòåëüíûå, à ïîñëåäíåå - çà \
ñóùåñòâèòåëüíîå, íàïðèìåð, \"çëîé ñìåøíîé êîâáîé\" áóäåò \
îáðàáîòàí ïðàâèëüíî, à \"êîâáîé çëîé\" - íåò.\r\n\r\n\
Ó áîëüøèíñòâà ýëåìåíòîâ óïðàâëåíèÿ èìåþòñÿ âñïëûâàþùèå \
ïîäñêàçêè.\r\n\
";
ctrlRTADS_hlink.SetHyperLink( _T("http://rtads.h-type.com/") );
ctrlGrAndreyEmail.SetHyperLink( _T("mailto:[email protected]") );
ctrlStasEmail.SetHyperLink( _T("mailto:[email protected]") );
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Control(pDX, IDC_EDIT1, CAbout);
DDX_Text(pDX, IDC_EDIT1, strAbout);
DDX_Control(pDX, IDC_STATIC_RTADS_HLINK, ctrlRTADS_hlink);
DDX_Control(pDX, IDC_STATIC_GRANDREY_MAIL, ctrlGrAndreyEmail);
DDX_Control(pDX, IDC_STATIC_STAS_MAIL, ctrlStasEmail);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_EN_UPDATE(IDC_EDIT1, OnUpdateEdit1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGeneratorDlg dialog
CGeneratorDlg::CGeneratorDlg(CWnd* pParent /*=NULL*/)
: CDialog(CGeneratorDlg::IDD, pParent) {
//{{AFX_DATA_INIT(CGeneratorDlg)
strDEdit = _T("");
strVEdit = _T("");
strTEdit = _T("");
strTEdit2 = _T("");
strPEdit = _T("");
iCombo2 = -1;
strCombo1 = _T("");
strClass = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CGeneratorDlg::DoDataExchange(CDataExchange* pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGeneratorDlg)
DDX_Control(pDX, IDC_CHANGE_CLASS_LIST, ctrlChangeClassList);
DDX_Control(pDX, IDC_CLASS, ctrlClass);
DDX_Control(pDX, IDC_COMBO1, ctrlCombo1);
DDX_Control(pDX, IDC_RESEDIT, ctrlResEdit);
DDX_Control(pDX, IDC_REDIT, ctrlREdit);
DDX_Control(pDX, IDC_IEDIT, ctrlIEdit);
DDX_Control(pDX, IDC_CHISLO, ctrlChislo);
DDX_Control(pDX, IDC_NOTSKLON, ctrlNotsklon);
DDX_Control(pDX, IDC_PAUTO, ctrlPAuto);
DDX_Control(pDX, IDC_DAUTO, ctrlDAuto);
DDX_Control(pDX, IDC_VAUTO, ctrlVAuto);
DDX_Control(pDX, IDC_TAUTO, ctrlTAuto);
DDX_Control(pDX, IDC_TAUTO2, ctrlTAuto2);
DDX_Control(pDX, IDC_RAUTO, ctrlRAuto);
DDX_Text(pDX, IDC_DEDIT, strDEdit);
DDX_Text(pDX, IDC_VEDIT, strVEdit);
DDX_Text(pDX, IDC_TEDIT, strTEdit);
DDX_Text(pDX, IDC_TEDIT2, strTEdit2);
DDX_Text(pDX, IDC_PEDIT, strPEdit);
DDX_CBIndex(pDX, IDC_COMBO2, iCombo2);
DDX_CBString(pDX, IDC_COMBO1, strCombo1);
DDV_MaxChars(pDX, strCombo1, 2);
DDX_CBString(pDX, IDC_CLASS, strClass);
DDX_Text(pDX, IDC_IEDIT, strIEdit);
DDX_Text(pDX, IDC_REDIT, strREdit);
DDX_Text(pDX, IDC_RESEDIT, strResEdit);
DDX_Control(pDX, IDC_ODUSH, ctrlOdush);
DDX_Control(pDX, IDC_RADIO1, ctrlRadio1);
DDX_Control(pDX, IDC_RADIO2, ctrlRadio2);
DDX_Control(pDX, IDC_RADIO3, ctrlRadio3);
//}}AFX_DATA_MAP
DDX_Control(pDX, IDC_EDIT1, ctrlLexems);
DDX_Control(pDX, IDC_BUTTON2, ctrlAddsynbtn);
DDX_Control(pDX, IDC_BUTTON1, ctrlMakecodebtn);
DDX_Control(pDX, IDC_EDIT2, ctrlAdjLex);
}
BEGIN_MESSAGE_MAP(CGeneratorDlg, CDialog)
//{{AFX_MSG_MAP(CGeneratorDlg)
ON_WM_SYSCOMMAND()
ON_WM_DESTROY()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_EN_SETFOCUS(IDC_REDIT, OnSetfocusRedit)
ON_EN_SETFOCUS(IDC_DEDIT, OnSetfocusDedit)
ON_EN_SETFOCUS(IDC_PEDIT, OnSetfocusPedit)
ON_EN_SETFOCUS(IDC_TEDIT, OnSetfocusTedit)
ON_EN_SETFOCUS(IDC_VEDIT, OnSetfocusVedit)
ON_BN_CLICKED(IDC_COPYTOCLIPBOARD, OnCopytoclipboard)
ON_BN_CLICKED(IDC_CHISLO, OnBnClickedChislo)
ON_BN_CLICKED(IDC_ABOUT, OnAbout)
ON_BN_CLICKED(IDC_RADIO1, OnBnClickedRadio1)
ON_BN_CLICKED(IDC_ODUSH, OnBnClickedOdush)
ON_EN_CHANGE(IDC_IEDIT, OnEnChangeIEdit)
ON_EN_CHANGE(IDC_REDIT, OnChangeRedit)
ON_EN_CHANGE(IDC_DEDIT, OnChangeDedit)
ON_EN_CHANGE(IDC_VEDIT, OnChangeVedit)
ON_EN_CHANGE(IDC_TEDIT, OnChangeTedit)
ON_EN_CHANGE(IDC_PEDIT, OnChangePedit)
ON_BN_CLICKED(IDC_NOTSKLON, OnNotsklon)
ON_CBN_EDITCHANGE(IDC_COMBO1, OnEditchangeCombo1)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
ON_CBN_KILLFOCUS(IDC_COMBO1, OnKillfocusCombo1)
ON_CBN_SELCHANGE(IDC_COMBO2, OnSelchangeCombo2)
ON_BN_CLICKED(IDC_RAUTO, OnRauto)
ON_BN_CLICKED(IDC_DAUTO, OnDauto)
ON_BN_CLICKED(IDC_VAUTO, OnVauto)
ON_BN_CLICKED(IDC_TAUTO, OnTauto)
ON_BN_CLICKED(IDC_PAUTO, OnPauto)
ON_BN_CLICKED(IDC_CHOOSEFONT, OnChooseFont)
ON_CBN_SELCHANGE(IDC_CLASS, OnSelchangeClass)
ON_CBN_KILLFOCUS(IDC_CLASS, OnKillfocusClass)
ON_BN_CLICKED(IDC_CHANGE_CLASS_LIST, OnChangeClassList)
ON_WM_GETMINMAXINFO() // êîíòðîëü çà ðàçìåðîì îêíà
ON_BN_CLICKED(IDC_RADIO2, OnBnClickedRadio1)
ON_BN_CLICKED(IDC_RADIO3, OnBnClickedRadio1)
//}}AFX_MSG_MAP
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify) // tool tips
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGeneratorDlg message handlers
BOOL CGeneratorDlg::OnInitDialog() {
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL) {
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty()) {
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
EnableTrackingToolTips(TRUE); // enable tool tips for view
strREdit = "Ðîäèòåëüíûé ïàäåæ";
strDEdit = "Äàòåëüíûé ïàäåæ";
strVEdit = "Âèíèòåëüíûé ïàäåæ";
strTEdit = "Òâîðèòåëüíûé ïàäåæ";
strTEdit2 = "Äîïîëíèòåëüíûé òâîðèòåëüíûé ïàäåæ";
strPEdit = "Ïðåäëîæíûé ïàäåæ";
ctrlRAuto.SetCheck( TRUE );
ctrlDAuto.SetCheck( TRUE );
ctrlVAuto.SetCheck( TRUE );
ctrlTAuto.SetCheck( TRUE );
ctrlTAuto2.SetCheck( TRUE );
ctrlPAuto.SetCheck( TRUE );
ctrlRadio1.SetCheck( TRUE );
strCombo1.Format( "%d", IniFile.Tabs.iNumberOfTabs ) ;
iCombo1 = IniFile.Tabs.iNumberOfTabs;
iCombo2 = IniFile.Tabs.iTabsOrSpaces;
// ????????? ?????? ???????
for ( int i = 0; i < IniFile.ChosenClasses.iNumberOfChosenClasses; i++ )
ctrlClass.AddString( IniFile.ChosenClasses.strChosenClass[ i ] );
strClass = IniFile.ChosenClasses.strDefaultClass;
UpdateData( FALSE );
bOdush = false;
bChislo = true;
iRod = 0;
bOldWindowRectSaved = false;
// ???????? ?????
Font.CreateFontIndirect( &IniFile.Font.logfontLogFont );
ctrlResEdit.SetFont( &Font );
brushResEdit.CreateSysColorBrush( COLOR_WINDOW );
HIChangeClassList = AfxGetApp()->LoadIcon( IDI_CHANGE_CLASS_LIST );
ctrlChangeClassList.SetIcon( HIChangeClassList );
return TRUE; // return TRUE unless you set the focus to a control
}
//TollTip notification handler
BOOL CGeneratorDlg::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult) {
// need to handle both ANSI and UNICODE versions of the message
TOOLTIPTEXTA * pTTTA = (TOOLTIPTEXTA*)pNMHDR;
TOOLTIPTEXTW * pTTTW = (TOOLTIPTEXTW*)pNMHDR;
CString strTipText;
UINT nID = pNMHDR->idFrom;
if ( pNMHDR->code == TTN_NEEDTEXTA && ( pTTTA->uFlags & TTF_IDISHWND ) ||
pNMHDR->code == TTN_NEEDTEXTW && ( pTTTW->uFlags & TTF_IDISHWND ) ) {
// idFrom is actually the HWND of the tool
nID = ::GetDlgCtrlID( (HWND)nID );
}
switch ( nID ) {
case IDC_IEDIT:
strTipText = "Êòî? ×òî? (Èìåíèòåëüíûé ïàäåæ)";
break;
case IDC_REDIT:
strTipText = "Íåò êîãî? ÷åãî? (Ðîäèòåëüíûé ïàäåæ)";
break;
case IDC_DEDIT:
strTipText = "Ðàä êîìó? ÷åìó? (Äàòåëüíûé ïàäåæ)";
break;
case IDC_VEDIT:
strTipText = "Âèæó êîãî? ÷òî? (Âèíèòåëüíûé ïàäåæ)";
break;
case IDC_TEDIT:
strTipText = "Ëþáóþñü êåì? ÷åì? (Òâîðèòåëüíûé ïàäåæ)";
break;
case IDC_TEDIT2:
strTipText = "Òâîðèòåëüíûé ïàäåæ - àëüòåðíàòèâíàÿ ôîðìà";
break;
case IDC_PEDIT:
strTipText = "Ãîâîðþ î êîì? î ÷åì? (Ïðåäëîæíûé ïàäåæ)";
break;
case IDC_ODUSH:
if ( bOdush )
strTipText = "Îáúåêò ÿâëÿåòñÿ îäóøåâëåííûì";
else
strTipText = "Îáúåêò ÿâëÿåòñÿ íåîäóøåâëåííûì";
break;
case IDC_CHISLO:
if ( bChislo )
strTipText = "Îáúåêò èìååò åäèíñòâåííîå ÷èñëî";
else
strTipText = "Îáúåêò èìååò ìíîæåñòâåííîå ÷èñëî";
break;
case IDC_ABOUT:
strTipText = "Ñïðàâêà î ïðîãðàììå";
break;
case IDC_RADIO1:
strTipText = "Îáúåêò ìóæñêîãî ðîäà";
break;
case IDC_RADIO2:
strTipText = "Îáúåêò æåíñêîãî ðîäà";
break;
case IDC_RADIO3:
strTipText = "Îáúåêò ñðåäíåãî ðîäà";
break;
case IDC_NOTSKLON:
strTipText = "Íå ñêëîíÿòü ñëîâî, òîëüêî ñîçäàòü êîä";
break;
case IDC_RAUTO:
strTipText = "Ðàçðåøèòü àâòîìàòè÷åñêîå çàïîëíåíèå äàííîé ñòðîêè";
break;
case IDC_DAUTO:
strTipText = "Ðàçðåøèòü àâòîìàòè÷åñêîå çàïîëíåíèå äàííîé ñòðîêè";
break;
case IDC_VAUTO:
strTipText = "Ðàçðåøèòü àâòîìàòè÷åñêîå çàïîëíåíèå äàííîé ñòðîêè";
break;
case IDC_TAUTO:
strTipText = "Ðàçðåøèòü àâòîìàòè÷åñêîå çàïîëíåíèå äàííîé ñòðîêè";
break;
case IDC_PAUTO:
strTipText = "Ðàçðåøèòü àâòîìàòè÷åñêîå çàïîëíåíèå äàííîé ñòðîêè";
break;
case IDC_RESEDIT:
strTipText = "Ñëîâà äëÿ ïîèñêà";
break;
case IDC_BUTTON1:
strTipText = "Î÷èñòèòü ñïèñîê ïîèñêà";
break;
default:
strTipText = "";
}
if ( pNMHDR->code == TTN_NEEDTEXTA )
lstrcpyn( pTTTA->szText, strTipText, sizeof(pTTTA->szText) );
else
_mbstowcsz( pTTTW->szText, strTipText, sizeof(pTTTW->szText) );
*pResult = 0;
return TRUE; // message was handled
}
void CGeneratorDlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { // êîíòðîëü ðàçìåðîâ îêíà
CRect rectWindow;
GetWindowRect( &rectWindow );
lpMMI->ptMinTrackSize.x = 500;//rectOldWindow.Width(); // ìàêñèìàëüíûå/ìèíèìàëüíûå ðàçìåðû îêíà
lpMMI->ptMinTrackSize.y = 140;//rectOldWindow.Height(); // çàêîììåíòèðîâàííîå ïî÷åìó-òî ãëþ÷èò â Win32 Release (VC6)
lpMMI->ptMaxTrackSize.x = 99999;
lpMMI->ptMaxTrackSize.y = 99999;
// ñîîòâåòñòâåííî óâåëè÷èâàåì IDC_RESEDIT
CEdit * pResEdit;
pResEdit = (CEdit *) GetDlgItem( IDC_RESEDIT );
if ( pResEdit != NULL ) {
UpdateData( TRUE );
int iY = 0;
int iX = 0;
if ( IsZoomed() ) { // maximized
iY = rectOldResEdit.Height() - rectOldWindow.Height() +
GetSystemMetrics( SM_CYMAXIMIZED );
iX = rectOldResEdit.Width() - rectOldWindow.Width() +
GetSystemMetrics( SM_CXMAXIMIZED );
} else if ( IsIconic() ) {
} else {
iY = rectOldResEdit.Height() - rectOldWindow.Height() +
iHeightBeforeMax;
iX = rectOldResEdit.Width() - rectOldWindow.Width() +
iWidthBeforeMax;
if ( rectWindow.Height() != GetSystemMetrics( SM_CYMAXIMIZED ) &&
rectWindow.Width() != GetSystemMetrics( SM_CXMAXIMIZED ) && // åñëè íå âîçâðàòèëèñü èç maximized
rectWindow.left > 0 && rectWindow.top > 0 ) { // ïðåäîòâðàùàåì bug: min, restore, min, restore -- IDC_RESEDIT èñ÷åçàåò
iHeightBeforeMax = rectWindow.Height();
iWidthBeforeMax = rectWindow.Width();
}
}
pResEdit->SetWindowPos( &wndTop, 0, 0, iX, iY,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER |
SWP_NOSENDCHANGING | SWP_NOZORDER );
UpdateData( FALSE );
}
}
void CGeneratorDlg::OnSysCommand(UINT nID, LPARAM lParam) {
if ((nID & 0xFFF0) == IDM_ABOUTBOX) {
CAboutDlg dlgAbout;
EnableTrackingToolTips( FALSE );
dlgAbout.DoModal();
EnableTrackingToolTips( TRUE );
} else {
CDialog::OnSysCommand(nID, lParam);
}
}
void CGeneratorDlg::OnDestroy() {
CDialog::OnDestroy();
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CGeneratorDlg::OnPaint() {
if (IsIconic()) {
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else {
// çàïîìèíàåì ïåðâîíà÷àëüíûå ðàçìåðû îêíà è IDC_RESEDIT
if ( !bOldWindowRectSaved ) {
bOldWindowRectSaved = true;
GetWindowRect( &rectOldWindow );
iHeightBeforeMax = rectOldWindow.Height();
iWidthBeforeMax = rectOldWindow.Width();
ctrlResEdit.GetRect( &rectOldResEdit );
rectOldResEdit.bottom = rectOldWindow.Height() - 254 -
2 * GetSystemMetrics( SM_CXBORDER ) -
GetSystemMetrics( SM_CYSIZE ) -
2 * GetSystemMetrics( SM_CXEDGE );
rectOldResEdit.right = rectOldWindow.Width() - 6 -
2 * GetSystemMetrics( SM_CXEDGE ) -
2 * GetSystemMetrics( SM_CXBORDER );
int iY = rectOldResEdit.Height();
int iX = rectOldResEdit.Width();
ctrlResEdit.SetWindowPos( &wndTop, 0, 0, iX, iY, SWP_DRAWFRAME |
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER |
SWP_NOSENDCHANGING | SWP_NOZORDER );
}
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CGeneratorDlg::OnQueryDragIcon() {
return (HCURSOR) m_hIcon;
}
void CGeneratorDlg::OnEnChangeIEdit() {
string text,nslv,a;
int mode, dopoln=false;
UpdateData( TRUE );
// íå äàåì ââåñòè ñëèøêîì ìíîãî ñëîâ
if ( StrCount( nslv ) > 15 ) {
strIEdit = strIEdit.Left( strIEdit.GetLength() - 1 );
UpdateData( FALSE );
MessageBox( "Ïðåâûøåíî ìàêñèìàëüíî âîçìîæíîå êîëè÷åñòâî ñëîâ", "Îøèáêà" );
return;
}
text = strIEdit;
// îïðåäåëÿåì ñâîéñòâà ãëàâíîãî ñëîâà
mode = (bChislo?SINGL:PLURAL);
if (iRod==0) mode|=MALE;
else if (iRod==1) mode|=FEMALE;
else mode|=NEUTER;
CString *CStrs[6] = {&strREdit, &strDEdit, &strVEdit, &strTEdit, &strTEdit2, &strPEdit};
CButton *ctrlAutos[6] = {&ctrlRAuto, &ctrlDAuto, &ctrlVAuto, &ctrlTAuto, &ctrlTAuto2, &ctrlPAuto};
// ïðèñòóïàåì ê îáðàáîòêå
if ( ctrlNotsklon.GetCheck() )
{
for ( int cnt=0; cnt<6; cnt++ ) if (ctrlAutos[cnt]->GetCheck()) *(CStrs[cnt]) = strIEdit;
} else {
for (int i=1; i <= StrCount( text ); i++ )
{
// äîáàâëÿåì ïðîáåë ïåðåä íîâûì ñëîâîì
if (i>1)
{
for ( int cnt=0; cnt<6; cnt++ ) if (ctrlAutos[cnt]->GetCheck()) *(CStrs[cnt])+=" ";
}
else
{
for ( int cnt=0; cnt<6; cnt++ ) if (ctrlAutos[cnt]->GetCheck()) CStrs[cnt]->Empty();
}
// áåðåì ñëîâî
nslv = TakeWord( i, text );
int placeForNoun = StrCount1( text );
if (i==placeForNoun)
{
mode^=ADJ;
mode|=NOUN;
}
else mode|=ADJ;
// ïðè íàõîæäåíèè ïðåäëîãà, ìåíÿåì ðåæèì
// îáðàáîòêà ðåæèìà ïîñëå ïðåäëîãà
if (i>placeForNoun)
{
for ( int cnt=0; cnt<6; cnt++ )
if (ctrlAutos[cnt]->GetCheck()) *(CStrs[cnt])+=nslv.c_str();
}
// îáû÷íûé ðåæèì
else
{
if ( ctrlRAuto.GetCheck() ) {
strREdit += REP.TakePad( nslv, mode|GENITIVE).c_str();
}
if ( ctrlDAuto.GetCheck() ) {
strDEdit += REP.TakePad( nslv, mode|DATIVE).c_str();
}
if ( ctrlVAuto.GetCheck() ) {
strVEdit += REP.TakePad( nslv, mode|ACCUSATIVE).c_str();
}
if ( ctrlTAuto.GetCheck() ) {
strTEdit += REP.TakePad( nslv, mode|INSTRUMENTAL).c_str();
}
if ( ctrlTAuto2.GetCheck() ) {
strTEdit2 += REP.TakePad( nslv, mode|INSTRUMENTAL2).c_str();
}
if ( ctrlPAuto.GetCheck() ) {
strPEdit += REP.TakePad( nslv, mode|PREPOSITIONAL).c_str();
}
}
}
}
UpdateData( FALSE );
}
//---------------------------------------------------------------------------
void CGeneratorDlg::OnBnClickedRadio1() {
UpdateData( TRUE );
if ( ctrlRadio1.GetCheck() )
iRod = 0;
else if ( ctrlRadio2.GetCheck() )
iRod = 1;
else if ( ctrlRadio3.GetCheck() )
iRod = 2;
OnEnChangeIEdit();
}
//---------------------------------------------------------------------------
int CGeneratorDlg::GenDet( char * str ) {
if ( strlen( str ) > 1 ) {
switch ( str[ strlen( str ) - 1 ] ) { // Àâòîîïðåäåëåíèå ïîëà
case 'é':
return 0;
case 'î':
return 2;
case 'å':
return 2;
case '¸':
return 2;
}
}
return iRod;
}
void CGeneratorDlg::OnBnClickedOdush() {
EnableTrackingToolTips( FALSE );
if ( bOdush ) {
bOdush = false;
ctrlOdush.SetWindowText( "Íå&îäóøåâëåííûé" );
} else {
bOdush = true;
ctrlOdush.SetWindowText( "&Îäóøåâëåííûé" );
}
OnEnChangeIEdit();
EnableTrackingToolTips( TRUE );
}
void CGeneratorDlg::OnBnClickedChislo() {
EnableTrackingToolTips( FALSE );
if ( bChislo ) {
bChislo = false;
ctrlChislo.SetWindowText( "Ì&íîæåñòâåííûé" );
} else {
bChislo = true;
ctrlChislo.SetWindowText( "Åäè&íñòâåííûé" );
}
OnEnChangeIEdit();
EnableTrackingToolTips( TRUE );
}
void CGeneratorDlg::OnSetfocusRedit() {
if ( strREdit == "Ðîäèòåëüíûé ïàäåæ" ) {
strREdit = "";
UpdateData( FALSE );
}
}
void CGeneratorDlg::OnSetfocusDedit() {
if ( strDEdit == "Äàòåëüíûé ïàäåæ" ) {
strDEdit = "";
UpdateData( FALSE );
}
}
void CGeneratorDlg::OnSetfocusVedit() {
if ( strVEdit == "Âèíèòåëüíûé ïàäåæ" ) {
strVEdit = "";
UpdateData( FALSE );
}
}
void CGeneratorDlg::OnSetfocusTedit() {
if ( strTEdit == "Òâîðèòåëüíûé ïàäåæ" ) {
strTEdit = "";
UpdateData( FALSE );
}
}
void CGeneratorDlg::OnSetfocusPedit() {
if ( strPEdit == "Ïðåäëîæíûé ïàäåæ" ) {
strPEdit = "";
UpdateData( FALSE );
}
}
void CAboutDlg::OnUpdateEdit1() {
UpdateData( FALSE );
}
void CGeneratorDlg::OnAbout() {
CAboutDlg dlgAbout;
EnableTrackingToolTips( FALSE );
dlgAbout.DoModal();
EnableTrackingToolTips( TRUE );
}
void CGeneratorDlg::OnChangeRedit() {
ctrlRAuto.SetCheck( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnChangeDedit() {
ctrlDAuto.SetCheck( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnChangeVedit() {
ctrlVAuto.SetCheck( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnChangeTedit() {
ctrlTAuto.SetCheck( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnChangeTedit2() {
ctrlTAuto.SetCheck( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnChangePedit() {
ctrlPAuto.SetCheck( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnDcheck() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnTcheck() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnTcheck2() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnRcheck() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnRauto() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnDauto() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnVauto() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnTauto() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnPauto() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnNotsklon() {
OnEnChangeIEdit();
}
void CGeneratorDlg::OnBnClickedCheck1()
{
OnEnChangeIEdit();
}
// ãîòîâèì ñòðîêè äëÿ ïîèñêà
/*
void CGeneratorDlg::OnBnClickedReady()
{
// ðåæèì 1: çàäàåì ïàäåæíûå ôîðìû â ïðÿìîì âèäå
CString *CStrs[7] = {&strIEdit, &strREdit, &strDEdit, &strVEdit, &strTEdit, &strTEdit2, &strPEdit};
vector<int> ignore;
string result="";
if (ctrlSoglas.GetCheck())
{
// èùåì êëîíîâ
for (int i=0; i<7; i++ )
for (int j=i+1; j<7; j++ )
{
if ((*CStrs[i])==(*CStrs[j]))
ignore.push_back(j);
}
for (int i=0; i<7; i++)
{
bool found = false;
// ïðîâåðÿåì íàëè÷èå êëîíà
for (int j=0; j<ignore.size(); j++)
{
if ((ignore[j])==i) found = true;
}
// åñëè íåò êëîíà - ïèøåì
if (!found && (*CStrs[i]).GetLength()!=0)
{
if (result.size()>0) result+="|";
result+=(*CStrs[i]);
}
}
strResEdit+=result.c_str();
strResEdit+="\r\n";
}
// ðåæèì ¹2
else
{
vector<string> words;
string str, tmpstr;
//áåðåì âñå ñëîâà âñåõ ïàäåæåé
for (int i=0; i<7; i++ )
{
str = (*CStrs[i]);
for (int i=1; i <= StrCount( str ); i++ )
{
tmpstr = TakeWord( i, str );
words.push_back( tmpstr );
}
}
int count=0;
while (count<words.size())
{
for (int j=count+1; j<words.size(); j++)
if (!strcmp(words[count].c_str(),words[j].c_str()))
{
vector<string>::iterator Iter; int k;
for ( Iter = words.begin(), k=0 ; j != k ; Iter++, k++ ) {};
words.erase(Iter);
j--;
}
count++;
}
while (!words.empty())
{
int prevbaslen=0, i=1;
bool noDelim=false;
// ñðàâíèâàåì ïåðâîå ñëîâî ñ îñòàëüíûìè
while (i<words.size())
{
int len1 = words[0].size();
int len2 = words[i].size();
string str = words[i];
int minlen = (len1>len2)?i:0;
int interlen = strcmpe(words[0],words[i]);
if (interlen>1 && interlen>=(words[minlen].size()/2) && (!prevbaslen || interlen==prevbaslen))
{
if (!prevbaslen)
{
prevbaslen=interlen;
strResEdit += words[0].substr(0,interlen).c_str();
strResEdit += "(";
if (words[0].size()!=interlen)
strResEdit += words[0].substr(interlen,words[0].size()-interlen).c_str();
else noDelim=true;
}
if (noDelim) noDelim=false;
else strResEdit += "|";
strResEdit += words[i].substr(prevbaslen,words[i].size()-prevbaslen).c_str();
vector<string>::iterator Iter; int j;
for ( Iter = words.begin(), j=0 ; j != i ; Iter++, j++ ) {};
words.erase(Iter);
i--;
}
i++;
}
// åñëè íè÷åãî íå íàøëè
if (!prevbaslen)
strResEdit += words[0].c_str();
else strResEdit += ")";
words.erase(words.begin());
strResEdit += "\r\n";
}
}
UpdateData( FALSE );
}
*/
void CGeneratorDlg::OnChooseFont() {
CFont * curfont = ctrlResEdit.GetFont();
LOGFONT curlf;
curfont->GetLogFont( &curlf );
CFontDialog dlg( &curlf );
dlg.m_cf.rgbColors = IniFile.Font.FontColor;
if ( dlg.DoModal() == IDOK ) {
Font.DeleteObject();
VERIFY( Font.CreateFontIndirect( &curlf ) );
ctrlResEdit.SetFont( &Font );
IniFile.Font.FontColor = dlg.GetColor();
}
}
void CGeneratorDlg::OnEditchangeCombo1() {
char str[20];
UpdateData( TRUE );
iCombo1 = atoi( strCombo1 );
if ( iCombo1 < 0 )
iCombo1 = 0;
itoa( iCombo1, str, 10 );
if ( strCombo1 != "" )
strCombo1 = str;
IniFile.Tabs.iNumberOfTabs = iCombo1;
UpdateData( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnSelchangeCombo1() {
char str[20];
UpdateData( TRUE );
iCombo1 = ctrlCombo1.GetCurSel();
itoa( iCombo1, str, 10 );
strCombo1 = str;
IniFile.Tabs.iNumberOfTabs = iCombo1;
UpdateData( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnKillfocusCombo1() {
char str[20];
itoa( iCombo1, str, 10 );
strCombo1 = str;
IniFile.Tabs.iNumberOfTabs = iCombo1;
UpdateData( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnSelchangeCombo2() {
OnEnChangeIEdit();
IniFile.Tabs.iTabsOrSpaces = iCombo2;
}
void CGeneratorDlg::OnSelchangeClass() {
UpdateData( TRUE );
int iIndex = ctrlClass.GetCurSel();
if ( iIndex != -1 )
ctrlClass.GetLBText( iIndex, strClass );
UpdateData( FALSE );
OnEnChangeIEdit();
}
void CGeneratorDlg::OnKillfocusClass() {
CGeneratorDlg::OnSelchangeClass();
}
void CGeneratorDlg::OnChangeClassList() {
CModClassListDlg dlgModClassList;
EnableTrackingToolTips( FALSE );
int nResponse = dlgModClassList.DoModal();
if ( nResponse == IDOK ) {
for ( int i = 0; ctrlClass.GetCount(); i++ )
ctrlClass.DeleteString( 0 );
for ( i = 0; i < IniFile.ChosenClasses.iNumberOfChosenClasses; i++ )
ctrlClass.AddString( IniFile.ChosenClasses.strChosenClass[ i ] );