OSDN Git Service

wxMessageBoxの呼び出しにを簡易なマクロを用いるよう変更。
[tpi/lychee.git] / src / frontend / frontend.cpp
1 /*******************************************************************************
2   TPI - flexible but useless plug-in framework.
3   Copyright (C) 2002-2009 Silky
4
5   This library is free software; you can redistribute it and/or modify it under
6   the terms of the GNU Lesser General Public License as published by the Free
7   Software Foundation; either version 2.1 of the License, or (at your option)
8   any later version.
9
10   This library is distributed in the hope that it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
12   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
13   for more details.
14
15   You should have received a copy of the GNU Lesser General Public License along
16   with this library; if not, write to the Free Software Foundation, Inc.,
17   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18
19   $Id: frontend.cpp,v 1.3 2009/08/27 11:26:00 sirakaba Exp $
20 *******************************************************************************/
21
22 #include "frontend.h"
23 #include "frm_main.h"
24
25 //******************************************************************************
26 // Frontend
27 //******************************************************************************
28
29 class Frontend: public wxApp
30 {
31 public:
32     bool OnInit();
33 };
34
35 IMPLEMENT_APP(Frontend)
36
37 bool Frontend::OnInit()
38 {
39         wxInitAllImageHandlers();
40         ::wxXmlResource::Get()->InitAllHandlers();
41
42         MainFrame * frm_main = new MainFrame();
43
44         // \8dì\8bÆ\83p\83X\82ð\90Ý\92è\81B
45         {
46                 wxChar cSep = wxFileName::GetPathSeparator();
47                 wxStandardPaths p;
48                 frm_main->szCurrentPath = ::wxGetCwd() + cSep;
49                 ::wxSetWorkingDirectory(::wxPathOnly(p.GetExecutablePath()) + cSep);
50         }
51
52         if (! ::wxXmlResource::Get()->Load(FE_DIR_S_XRC wxT("frm_main.xrc")))
53         {
54                 ::ErrDlg(wxT("Unable to find XRC!"), NULL);
55                 return false;
56         }
57
58         ::wxXmlResource::Get()->LoadFrame(frm_main, NULL, wxT("frame_main"));
59         ::wxXmlResource::Get()->Unload(FE_DIR_S_XRC wxT("frm_main.xrc"));
60         SetTopWindow(frm_main);
61         frm_main->cmdLine.SetCmdLine(this->argc, this->argv);
62         frm_main->InitDialog();
63         frm_main->Show();
64
65         return true;
66 }