3 * Bacula wx-console application
5 * Nicolas Boichat, April 2004
10 Copyright (C) 2004-2006 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 // ----------------------------------------------------------------------------
32 /* Windows debug builds set _DEBUG which is used by wxWidgets to select their
33 * debug memory allocator. Unfortunately it conflicts with Bacula's SmartAlloc.
34 * So we turn _DEBUG off since we aren't interested in things it enables.
45 #include <wx/wxprec.h>
46 #include <wx/config.h>
48 #include "wxbmainframe.h"
53 int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
54 int generate_job_event(JCR *jcr, const char *event) { return 1; }
57 // ----------------------------------------------------------------------------
59 // ----------------------------------------------------------------------------
61 class MyApp : public wxApp
64 virtual bool OnInit();
67 // ============================================================================
69 // ============================================================================
73 // ----------------------------------------------------------------------------
74 // the application class
75 // ----------------------------------------------------------------------------
77 // 'Main program' equivalent: the program execution "starts" here
80 /* wxWidgets internationalisation */
83 m_locale.AddCatalog(wxT("bacula"));
84 wxLocale::AddCatalogLookupPathPrefix(wxT(LOCALEDIR));
86 long posx, posy, sizex, sizey;
87 int displayx, displayy;
89 wxConfig::Get()->Read(wxT("/Position/X"), &posx, 50);
90 wxConfig::Get()->Read(wxT("/Position/Y"), &posy, 50);
91 wxConfig::Get()->Read(wxT("/Size/Width"), &sizex, 780);
92 wxConfig::Get()->Read(wxT("/Size/Height"), &sizey, 500);
94 wxDisplaySize(&displayx, &displayy);
96 /* Check if we are on the screen... */
97 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
98 /* Try to move the top-left corner first */
101 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
104 sizex = displayx - 50;
105 sizey = displayy - 50;
109 wxbMainFrame *frame = wxbMainFrame::CreateInstance(_("Bacula wx-console"),
110 wxPoint(posx, posy), wxSize(sizex, sizey));
114 frame->Print(wxString::Format(_("Welcome to bacula wx-console %s (%s)!\n"), wxT(VERSION), wxT(BDATE)), CS_DEBUG);
116 frame->StartConsoleThread(wxT(""));