X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=bacula%2Fsrc%2Fwx-console%2Fwxbconfigpanel.cpp;h=738112773f66c083d1fb4d61c74eca1f6e96df7c;hb=0a693e64227d8f721e4303d2dd7d21a3cb99d432;hp=2fb98026096c6466bca3d4ff425f493a71d36ca5;hpb=e2d0631a9bae958680f52a545c026e98042c71b8;p=bacula%2Fbacula diff --git a/bacula/src/wx-console/wxbconfigpanel.cpp b/bacula/src/wx-console/wxbconfigpanel.cpp index 2fb9802609..738112773f 100644 --- a/bacula/src/wx-console/wxbconfigpanel.cpp +++ b/bacula/src/wx-console/wxbconfigpanel.cpp @@ -4,29 +4,48 @@ * * Nicolas Boichat, April 2004 * + * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Bacula® - The Network Backup Solution - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + Copyright (C) 2004-2006 Free Software Foundation Europe e.V. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation plus additions + that are listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +/* Windows debug builds set _DEBUG which is used by wxWidgets to select their + * debug memory allocator. Unfortunately it conflicts with Bacula's SmartAlloc. + * So we turn _DEBUG off since we aren't interested in things it enables. */ -#include "wxbconfigpanel.h" +#undef _DEBUG +#include "bacula.h" +#include "wxbconfigpanel.h" #include + WX_DEFINE_OBJARRAY(wxbConfig); /* Create a new config parameter */ @@ -64,7 +83,7 @@ wxbConfigParam::~wxbConfigParam() { } void wxbConfigParam::AddControl(wxWindow* parent, wxSizer* sizer) { - sizer->Add(new wxStaticText(parent, -1, title + ": ", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT), 0, wxEXPAND | wxALIGN_CENTER_HORIZONTAL); + sizer->Add(new wxStaticText(parent, -1, title + wxT(": "), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT), 0, wxALIGN_CENTER_VERTICAL); switch (type) { case text: statictext = new wxStaticText(parent, -1, value, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); @@ -75,7 +94,12 @@ void wxbConfigParam::AddControl(wxWindow* parent, wxSizer* sizer) { sizer->Add(textctrl, 1, wxEXPAND | wxADJUST_MINSIZE); break; case choice: - choicectrl = new wxChoice(parent, id, wxDefaultPosition, wxSize(150, 20), nvalues, values); +#if defined __WXGTK20__ /* Choices are taller under GTK+-2.0 */ + wxSize size = wxSize(150, 25); +#else + wxSize size = wxSize(150, 20); +#endif + choicectrl = new wxChoice(parent, id, wxDefaultPosition, size, nvalues, values); sizer->Add(choicectrl, 1, wxEXPAND); break; } @@ -88,16 +112,16 @@ wxString wxbConfigParam::GetTitle() { wxString wxbConfigParam::GetValue() { switch (type) { case text: - return (statictext) ? statictext->GetLabel() : ""; + return (statictext != NULL) ? statictext->GetLabel() : wxString(wxT("")); break; case modifiableText: - return (textctrl) ? textctrl->GetValue() : ""; + return (textctrl != NULL) ? textctrl->GetValue() : wxString(wxT("")); break; case choice: - return (choicectrl) ? choicectrl->GetStringSelection() : ""; + return (choicectrl != NULL) ? choicectrl->GetStringSelection() : wxString(wxT("")); break; } - return ""; + return wxT(""); } void wxbConfigParam::SetValue(wxString str) { @@ -113,13 +137,13 @@ void wxbConfigParam::SetValue(wxString str) { case choice: if (choicectrl) { int k; - for (k = 0; k < choicectrl->GetCount(); k++) { + for (k = 0; k < (int)choicectrl->GetCount(); k++) { if (str == choicectrl->GetString(k)) { choicectrl->SetSelection(k); break; } } - if (k == choicectrl->GetCount()) { // Should never happen + if (k == (int)choicectrl->GetCount()) { // Should never happen choicectrl->Append(str); choicectrl->SetSelection(k); } @@ -174,18 +198,18 @@ wxbConfigPanel::wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxString tit wxBoxSizer* restoreBottomSizer = new wxBoxSizer(wxHORIZONTAL); - cfgOk = new wxButton(this, ok, "OK", wxDefaultPosition, wxSize(70, 25)); + cfgOk = new wxButton(this, ok, _("OK"), wxDefaultPosition, wxSize(70, 25)); restoreBottomSizer->Add(cfgOk, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, 10); if (apply != -1) { - cfgApply = new wxButton(this, apply, "Apply", wxDefaultPosition, wxSize(70, 25)); + cfgApply = new wxButton(this, apply, _("Apply"), wxDefaultPosition, wxSize(70, 25)); restoreBottomSizer->Add(cfgApply, 1, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 10); } else { cfgApply = NULL; } - cfgCancel = new wxButton(this, cancel, "Cancel", wxDefaultPosition, wxSize(70, 25)); + cfgCancel = new wxButton(this, cancel, _("Cancel"), wxDefaultPosition, wxSize(70, 25)); restoreBottomSizer->Add(cfgCancel, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 10); mainSizer->Add(restoreBottomSizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 5); @@ -200,29 +224,29 @@ wxbConfigPanel::~wxbConfigPanel() { delete config; } -void wxbConfigPanel::SetRowString(const char* title, wxString value) { +void wxbConfigPanel::SetRowString(const wxChar* title, wxString value) { int i; if ((i = FindRow(title)) > -1) { (*config)[i].SetValue(value); } } -wxString wxbConfigPanel::GetRowString(const char* title) { +wxString wxbConfigPanel::GetRowString(const wxChar* title) { int i; if ((i = FindRow(title)) > -1) { return (*config)[i].GetValue(); } - return ""; + return wxT(""); } -void wxbConfigPanel::SetRowSelection(const char* title, int ind) { +void wxbConfigPanel::SetRowSelection(const wxChar* title, int ind) { int i; if ((i = FindRow(title)) > -1) { (*config)[i].SetIndex(ind); } } -int wxbConfigPanel::GetRowSelection(const char* title) { +int wxbConfigPanel::GetRowSelection(const wxChar* title) { int i; if ((i = FindRow(title)) > -1) { return (*config)[i].GetIndex(); @@ -230,21 +254,21 @@ int wxbConfigPanel::GetRowSelection(const char* title) { return -1; } -void wxbConfigPanel::ClearRowChoices(const char* title) { +void wxbConfigPanel::ClearRowChoices(const wxChar* title) { int i; if ((i = FindRow(title)) > -1) { - return (*config)[i].Clear(); + (*config)[i].Clear(); } } -void wxbConfigPanel::AddRowChoice(const char* title, wxString value) { +void wxbConfigPanel::AddRowChoice(const wxChar* title, wxString value) { int i; if ((i = FindRow(title)) > -1) { - return (*config)[i].Add(value); + (*config)[i].Add(value); } } -int wxbConfigPanel::FindRow(const char* title) { +int wxbConfigPanel::FindRow(const wxChar* title) { unsigned int i; for (i = last; i < config->GetCount(); i++) {