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 // ----------------------------------------------------------------------------
32 #include <wx/wxprec.h>
33 #include <wx/config.h>
35 #include "wxbmainframe.h"
39 void InitWinAPIWrapper();
42 int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
43 int generate_job_event(JCR *jcr, const char *event) { return 1; }
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 class MyApp : public wxApp
53 virtual bool OnInit();
56 // ============================================================================
58 // ============================================================================
62 // ----------------------------------------------------------------------------
63 // the application class
64 // ----------------------------------------------------------------------------
66 // 'Main program' equivalent: the program execution "starts" here
69 setlocale(LC_ALL, "");
70 bindtextdomain("bacula", LOCALEDIR);
73 long posx, posy, sizex, sizey;
74 int displayx, displayy;
76 wxConfig::Get()->Read(wxT("/Position/X"), &posx, 50);
77 wxConfig::Get()->Read(wxT("/Position/Y"), &posy, 50);
78 wxConfig::Get()->Read(wxT("/Size/Width"), &sizex, 780);
79 wxConfig::Get()->Read(wxT("/Size/Height"), &sizey, 500);
81 wxDisplaySize(&displayx, &displayy);
83 /* Check if we are on the screen... */
84 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
85 /* Try to move the top-left corner first */
88 if ((posx+sizex > displayx) || (posy+sizey > displayy)) {
91 sizex = displayx - 50;
92 sizey = displayy - 50;
96 wxbMainFrame *frame = wxbMainFrame::CreateInstance(wxT(_("Bacula wx-console")),
97 wxPoint(posx, posy), wxSize(sizex, sizey));
101 frame->Print(wxString::Format(wxT(_("Welcome to bacula wx-console %s (%s)!\n")), wxT(VERSION), wxT(BDATE)), CS_DEBUG);
103 frame->StartConsoleThread(wxT(""));
109 void InitWinAPIWrapper() { };