4 Website: http://www.vultaire.net/software/jben/
5 License: GNU General Public License (GPL) version 2
6 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>
27 #include "encoding_convert.h"
37 /* The application entry point */
40 void ErrorLogDisplayFunc(ELType t
, const string
& message
, void *srcObj
) {
44 cout
<< "[Error] " << message
<< endl
;
46 wxMessageBox(utfconv_mw(message
), _T("Error"),
47 wxOK
| wxICON_ERROR
, (wxWindow
*)srcObj
);
51 cout
<< "[Warning] " << message
<< endl
;
53 wxMessageBox(utfconv_mw(message
), _T("Warning"),
54 wxOK
| wxICON_ERROR
, (wxWindow
*)srcObj
);
58 cout
<< "[Info] " << message
<< endl
;
60 wxMessageBox(utfconv_mw(message
), _T("Info"),
61 wxOK
| wxICON_ERROR
, (wxWindow
*)srcObj
);
65 cout
<< "[Silent] " << message
<< endl
;
74 kanjiList
= (KanjiList
*)NULL
;
75 vocabList
= (VocabList
*)NULL
;
76 gui
= (FrameMainGUI
*)NULL
;
78 /* the below -might- help on win32 systems, but for now is unused. */
81 setlocale(LC_ALL
, "");
85 /* Start our random number generator */
87 for(int i
=0;i
<50;i
++) rand(); /* On some platforms I've seen rand() behave
88 fairly predictably for the first iteration
89 or so. That's why I spin off a few
90 iterations of rand() before really using
93 /* Various initialization */
95 el
.RegDisplayFunc(ErrorLogDisplayFunc
);
97 /* Dictionary loading, etc., depends on our config file. */
98 Preferences
*prefs
= Preferences::Get();
100 /* This -should- never occur now. */
101 fprintf(stderr
, "Could not create preferences object. FATAL ERROR!\n\n");
105 const KDict
* kd
= KDict::Get();
106 const WDict
* wd
= WDict::Get();
108 if(wd
->MainDataLoaded()) {
109 vocabList
= new VocabList();
111 utfconv_mw(prefs
->GetSetting("vocablist")));
113 else vocabList
= NULL
;
114 if(kd
->MainDataLoaded()) {
115 kanjiList
= new KanjiList(kd
->GetHashTable());
116 kanjiList
->AddFromString(
117 utfconv_mw(prefs
->GetSetting("kanjilist")));
119 else kanjiList
= NULL
;
121 gui
= new FrameMainGUI();
130 printf("JBen::OnExit being processed...\n");
134 Preferences::Destroy();
135 if(kanjiList
) delete kanjiList
;
136 if(vocabList
) delete vocabList
;
139 printf("Terminating program.\n");