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 // ----------------------------------------------------------------------------
38 #include <wx/wxprec.h>
39 #include <wx/config.h>
42 #include "wxbmainframe.h"
47 int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
48 int generate_job_event(JCR *jcr, const char *event) { return 1; }
51 // ----------------------------------------------------------------------------
53 // ----------------------------------------------------------------------------
55 class MyApp : public wxApp
58 virtual bool OnInit();
61 // ============================================================================
63 // ============================================================================
67 // ----------------------------------------------------------------------------
68 // the application class
69 // ----------------------------------------------------------------------------
71 // 'Main program' equivalent: the program execution "starts" here
74 /* wxWidgets internationalisation */
77 m_locale.AddCatalog(wxT("bacula"));
78 wxLocale::AddCatalogLookupPathPrefix(wxT(LOCALEDIR));
80 long posx, posy, sizex, sizey;
81 int displayx, displayy;
83 wxConfig::Get()->Read(wxT("/Position/X"), &posx, 50);
84 wxConfig::Get()->Read(wxT("/Position/Y"), &posy, 50);
85 wxConfig::Get()->Read(wxT("/Size/Width"), &sizex, 780);
86 wxConfig::Get()->Read(wxT("/Size/Height"), &sizey, 500);
88 wxDisplaySize(&displayx, &displayy);
90 /* Check if we are on the screen... */
91 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
92 /* Try to move the top-left corner first */
95 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
98 sizex = displayx - 50;
99 sizey = displayy - 50;
103 wxbMainFrame *frame = wxbMainFrame::CreateInstance(_("Bacula wx-console"),
104 wxPoint(posx, posy), wxSize(sizex, sizey));
108 frame->Print(wxString::Format(_("Welcome to bacula wx-console %s (%s)!\n"), wxT(VERSION), wxT(BDATE)), CS_DEBUG);
110 frame->StartConsoleThread(wxT(""));