3 * Bacula wx-console application
5 * Nicolas Boichat, April 2004
10 Bacula® - The Network Backup Solution
12 Copyright (C) 2004-2006 Free Software Foundation Europe e.V.
14 The main author of Bacula is Kern Sibbald, with contributions from
15 many others, a complete list can be found in the file AUTHORS.
16 This program is Free Software; you can redistribute it and/or
17 modify it under the terms of version two of the GNU General Public
18 License as published by the Free Software Foundation plus additions
19 that are listed in the file LICENSE.
21 This program is distributed in the hope that it will be useful, but
22 WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 General Public License for more details.
26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
31 Bacula® is a registered trademark of John Walker.
32 The licensor of Bacula is the Free Software Foundation Europe
33 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
34 Switzerland, email:ftf@fsfeurope.org.
37 // ============================================================================
39 // ============================================================================
41 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
45 /* Windows debug builds set _DEBUG which is used by wxWidgets to select their
46 * debug memory allocator. Unfortunately it conflicts with Bacula's SmartAlloc.
47 * So we turn _DEBUG off since we aren't interested in things it enables.
58 #include <wx/wxprec.h>
59 #include <wx/config.h>
61 #include "wxbmainframe.h"
66 int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
67 int generate_job_event(JCR *jcr, const char *event) { return 1; }
70 // ----------------------------------------------------------------------------
72 // ----------------------------------------------------------------------------
74 class MyApp : public wxApp
77 virtual bool OnInit();
80 // ============================================================================
82 // ============================================================================
86 // ----------------------------------------------------------------------------
87 // the application class
88 // ----------------------------------------------------------------------------
90 // 'Main program' equivalent: the program execution "starts" here
93 /* wxWidgets internationalisation */
96 m_locale.AddCatalog(wxT("bacula"));
97 wxLocale::AddCatalogLookupPathPrefix(wxT(LOCALEDIR));
99 long posx, posy, sizex, sizey;
100 int displayx, displayy;
102 wxConfig::Get()->Read(wxT("/Position/X"), &posx, 50);
103 wxConfig::Get()->Read(wxT("/Position/Y"), &posy, 50);
104 wxConfig::Get()->Read(wxT("/Size/Width"), &sizex, 780);
105 wxConfig::Get()->Read(wxT("/Size/Height"), &sizey, 500);
107 wxDisplaySize(&displayx, &displayy);
109 /* Check if we are on the screen... */
110 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
111 /* Try to move the top-left corner first */
114 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
117 sizex = displayx - 50;
118 sizey = displayy - 50;
122 wxbMainFrame *frame = wxbMainFrame::CreateInstance(_("Bacula wx-console"),
123 wxPoint(posx, posy), wxSize(sizex, sizey));
127 frame->Print(wxString::Format(_("Welcome to bacula wx-console %s (%s)!\n"), wxT(VERSION), wxT(BDATE)), CS_DEBUG);
129 frame->StartConsoleThread(wxT(""));