Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8572/src/gui

Modified Files:
        wxDialogLayout.cpp 
Log Message:
implemented CreateControlsBelow() to show the choice containing available 
config sources, if applicable

Index: wxDialogLayout.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxDialogLayout.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -b -u -2 -r1.114 -r1.115
--- wxDialogLayout.cpp  17 Mar 2005 22:27:56 -0000      1.114
+++ wxDialogLayout.cpp  6 Jul 2005 22:02:05 -0000       1.115
@@ -35,10 +35,11 @@
 
 #  include <wx/layout.h>
-#  include <wx/stattext.h>      // for wxStaticText
+#  include <wx/stattext.h>
 #  include <wx/statbox.h>
 #  include <wx/statbmp.h>
 #endif // USE_PCH
 
-#include <wx/imaglist.h>        // for wxImageList
+#include <wx/imaglist.h>
+#include <wx/statline.h>
 
 #include "gui/wxOptionsPage.h"
@@ -46,4 +47,6 @@
 #include "gui/wxMenuDefs.h"
 
+#include "ConfigSourcesAll.h"
+
 #include "Mupgrade.h"      // for VerifyEMailSendingWorks()
 
@@ -1237,7 +1240,55 @@
    m_profileForButtons = NULL;
 
+   m_configForSave = NULL;
+
    m_lastBtn = MEventOptionsChangeData::Invalid;
 }
 
+wxControl *wxOptionsEditDialog::CreateControlsBelow(wxPanel *panel)
+{
+   const AllConfigSources::List& sources = 
AllConfigSources::Get().GetSources();
+   if ( sources.size() == 1 )
+   {
+      m_chcSources = NULL;
+      return NULL;
+   }
+
+   m_chcSources = new wxChoice(panel, -1);
+   for ( AllConfigSources::List::iterator i = sources.begin(),
+                                        end = sources.end();
+         i != end;
+         ++i )
+   {
+      m_chcSources->Append(i->GetName());
+   }
+
+   wxLayoutConstraints *c;
+
+   wxStaticLine *line = new wxStaticLine(panel, -1);
+   c = new wxLayoutConstraints;
+   c->left.SameAs(panel, wxLeft, LAYOUT_X_MARGIN);
+   c->right.SameAs(panel, wxRight, LAYOUT_X_MARGIN);
+   c->height.AsIs();
+   c->bottom.SameAs(panel, wxBottom, 5*LAYOUT_Y_MARGIN + hBtn);
+   line->SetConstraints(c);
+
+   c = new wxLayoutConstraints;
+   c->right.SameAs(panel, wxRight, LAYOUT_X_MARGIN);
+   c->width.AsIs();
+   c->height.AsIs();
+   c->bottom.Above(line, -LAYOUT_Y_MARGIN);
+   m_chcSources->SetConstraints(c);
+
+   wxStaticText *label = new wxStaticText(panel, -1, _("&Save changes to:"));
+   c = new wxLayoutConstraints;
+   c->right.LeftOf(m_chcSources, LAYOUT_X_MARGIN);
+   c->width.AsIs();
+   c->height.AsIs();
+   c->centreY.SameAs(m_chcSources, wxCentreY);
+   label->SetConstraints(c);
+
+   return m_chcSources;
+}
+
 void wxOptionsEditDialog::CreateAllControls()
 {
@@ -1265,6 +1316,7 @@
    panel->SetConstraints(c);
 
-   // optional controls above the notebook
-   wxControl *last = CreateControlsAbove(panel);
+   // optional controls above/below the notebook
+   wxControl *top = CreateControlsAbove(panel),
+             *bottom = CreateControlsBelow(panel);
 
    // the notebook itself is created by this function
@@ -1274,8 +1326,11 @@
    c->left.SameAs(panel, wxLeft, LAYOUT_X_MARGIN);
    c->right.SameAs(panel, wxRight, LAYOUT_X_MARGIN);
-   if ( last )
-      c->top.SameAs(last, wxBottom, 2*LAYOUT_Y_MARGIN);
+   if ( top )
+      c->top.SameAs(top, wxBottom, 2*LAYOUT_Y_MARGIN);
    else
       c->top.SameAs(panel, wxTop, LAYOUT_Y_MARGIN);
+   if ( bottom )
+      c->bottom.SameAs(bottom, wxTop, 2*LAYOUT_Y_MARGIN);
+   else
    c->bottom.SameAs(panel, wxBottom, 4*LAYOUT_Y_MARGIN + hBtn);
    m_notebook->SetConstraints(c);
@@ -1367,8 +1422,26 @@
 bool wxOptionsEditDialog::TransferDataFromWindow()
 {
+   // first decide where to save the changes
+   m_configForSave = NULL;
+   if ( m_chcSources )
+   {
+      const int sel = m_chcSources->GetSelection();
+      if ( sel != -1 )
+      {
+         AllConfigSources::List::iterator
+            i = AllConfigSources::Get().GetSources().begin();
+         for ( int n = 0; n < sel; n++ )
+            ++i;
+
+         m_configForSave = i.operator->();
+      }
+   }
+
+   // now do save them
    const int count = m_notebook->GetPageCount();
    for ( int nPage = 0; nPage < count; nPage++ )
    {
-      if ( !m_notebook->GetPage(nPage)->TransferDataFromWindow() )
+      wxWindow * const page = m_notebook->GetPage(nPage);
+      if ( !page->TransferDataFromWindow() )
          return FALSE;
    }



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to