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>
41 #include "wxbmainframe.h"
46 int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
47 int generate_job_event(JCR *jcr, const char *event) { return 1; }
50 // ----------------------------------------------------------------------------
52 // ----------------------------------------------------------------------------
54 class MyApp : public wxApp
57 virtual bool OnInit();
60 // ============================================================================
62 // ============================================================================
66 // ----------------------------------------------------------------------------
67 // the application class
68 // ----------------------------------------------------------------------------
70 // 'Main program' equivalent: the program execution "starts" here
73 /* wxWidgets internationalisation */
76 m_locale.AddCatalog(wxT("bacula"));
77 wxLocale::AddCatalogLookupPathPrefix(wxT(LOCALEDIR));
79 long posx, posy, sizex, sizey;
80 int displayx, displayy;
82 wxConfig::Get()->Read(wxT("/Position/X"), &posx, 50);
83 wxConfig::Get()->Read(wxT("/Position/Y"), &posy, 50);
84 wxConfig::Get()->Read(wxT("/Size/Width"), &sizex, 780);
85 wxConfig::Get()->Read(wxT("/Size/Height"), &sizey, 500);
87 wxDisplaySize(&displayx, &displayy);
89 /* Check if we are on the screen... */
90 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
91 /* Try to move the top-left corner first */
94 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
97 sizex = displayx - 50;
98 sizey = displayy - 50;
102 wxbMainFrame *frame = wxbMainFrame::CreateInstance(_("Bacula wx-console"),
103 wxPoint(posx, posy), wxSize(sizex, sizey));
107 frame->Print(wxString::Format(_("Welcome to bacula wx-console %s (%s)!\n"), wxT(VERSION), wxT(BDATE)), CS_DEBUG);
109 frame->StartConsoleThread(wxT(""));