3 * Bacula wx-console application
5 * Nicolas Boichat, April 2004
10 Copyright (C) 2004-2005 Kern Sibbald
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 version 2 as amended with additional clauses defined in the
15 file LICENSE in the main source directory.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 the file LICENSE for additional details.
24 // ============================================================================
26 // ============================================================================
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
34 #include <wx/wxprec.h>
35 #include <wx/config.h>
38 #include "wxbmainframe.h"
42 void InitWinAPIWrapper();
45 int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
46 int generate_job_event(JCR *jcr, const char *event) { return 1; }
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 class MyApp : public wxApp
56 virtual bool OnInit();
59 // ============================================================================
61 // ============================================================================
65 // ----------------------------------------------------------------------------
66 // the application class
67 // ----------------------------------------------------------------------------
69 // 'Main program' equivalent: the program execution "starts" here
72 /* wxWidgets internationalisation */
75 m_locale.AddCatalog(wxT("bacula"));
76 wxLocale::AddCatalogLookupPathPrefix(wxT(LOCALEDIR));
78 long posx, posy, sizex, sizey;
79 int displayx, displayy;
81 wxConfig::Get()->Read(wxT("/Position/X"), &posx, 50);
82 wxConfig::Get()->Read(wxT("/Position/Y"), &posy, 50);
83 wxConfig::Get()->Read(wxT("/Size/Width"), &sizex, 780);
84 wxConfig::Get()->Read(wxT("/Size/Height"), &sizey, 500);
86 wxDisplaySize(&displayx, &displayy);
88 /* Check if we are on the screen... */
89 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
90 /* Try to move the top-left corner first */
93 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
96 sizex = displayx - 50;
97 sizey = displayy - 50;
101 wxbMainFrame *frame = wxbMainFrame::CreateInstance(_("Bacula wx-console"),
102 wxPoint(posx, posy), wxSize(sizex, sizey));
106 frame->Print(wxString::Format(_("Welcome to bacula wx-console %s (%s)!\n"), wxT(VERSION), wxT(BDATE)), CS_DEBUG);
108 frame->StartConsoleThread(wxT(""));
114 void InitWinAPIWrapper() { };