]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/wxbconfigpanel.cpp
Did not intend to leave those debugging lines there.
[bacula/bacula] / bacula / src / wx-console / wxbconfigpanel.cpp
index 953cac1fb25850083f94887de8ad485abc47a426..1f57dde6ae1689cd71739436c2b65fece93a2b70 100644 (file)
@@ -1,3 +1,30 @@
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2004-2008 Free Software Foundation Europe e.V.
+
+   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 and included
+   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., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Bacula® is a registered trademark of Kern Sibbald.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
 /*
  *
  *   Config panel, used to specify parameters (for example clients, filesets... in restore)
  *
  *    Version $Id$
  */
-/*
-   Copyright (C) 2004-2005 Kern Sibbald
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   version 2 as ammended with additional clauses defined in the
-   file LICENSE in the main source directory.
-
-   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 
-   the file LICENSE for additional details.
 
+/*  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/arrimpl.cpp>
 
+
 WX_DEFINE_OBJARRAY(wxbConfig);
 
 /* Create a new config parameter */
@@ -116,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);
          }
@@ -138,6 +159,14 @@ int wxbConfigParam::GetIndex() {
    return -1;
 }
 
+int wxbConfigParam::GetCount() {
+   if (choicectrl) {
+      return choicectrl->GetCount();
+   }
+   return -1;
+}
+   
+
 void wxbConfigParam::SetIndex(int ind) {
    if (choicectrl) {
       choicectrl->SetSelection(ind);
@@ -177,18 +206,18 @@ wxbConfigPanel::wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxString tit
    
    wxBoxSizer* restoreBottomSizer = new wxBoxSizer(wxHORIZONTAL);
    
-   cfgOk = new wxButton(this, ok, wxT("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, wxT("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, wxT("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);
@@ -268,6 +297,16 @@ int wxbConfigPanel::FindRow(const wxChar* title) {
    return -1;
 }
 
+int wxbConfigPanel::GetRowCount(const wxChar* title)
+{
+   int i;
+   if ((i = FindRow(title)) > -1) {
+      return (*config)[i].GetCount();
+   }  
+
+   return -1;
+}
+
 void wxbConfigPanel::EnableApply(bool enable) {
    cfgOk->Enable(!enable);
    if (cfgApply) cfgApply->Enable(enable);