Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv5485/src/gui

Modified Files:
        wxFolderView.cpp 
Log Message:
the initial state of the filter buttonss now corresponds to the initial filter
state


Index: wxFolderView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderView.cpp,v
retrieving revision 1.617
retrieving revision 1.618
diff -b -u -2 -r1.617 -r1.618
--- wxFolderView.cpp    29 Nov 2002 02:02:39 -0000      1.617
+++ wxFolderView.cpp    30 Nov 2002 00:54:45 -0000      1.618
@@ -361,4 +361,7 @@
    wxArrayString m_namesFilters;
 
+   // the array containing the default states of the filters
+   wxArrayInt m_defFilterStates;
+
    // the event handler to hook the kbd input (NULL initially, !NULL later)
    class wxFolderMsgViewerEvtHandler *m_evtHandlerMsgView;
@@ -1153,14 +1156,11 @@
    choice->SetSize(choice->GetBestSize());
 
-   UpdateViewerBar();
-
    sizer->Add(choice, 0, wxALL | wxALIGN_CENTRE_VERTICAL, LAYOUT_X_MARGIN);
 
    // add the controls for the view filters
    wxArrayString labelsFilters;
-   wxArrayInt statesFilters;
    size_t countFilters = MessageView::GetAllAvailableFilters(&m_namesFilters,
                                                              &labelsFilters,
-                                                             &statesFilters);
+                                                             &m_defFilterStates);
    for ( size_t nFilter = 0; nFilter < countFilters; nFilter++ )
    {
@@ -1181,5 +1181,5 @@
                                 );
 
-      btn->SetValue(statesFilters[nFilter] != 0);
+      btn->SetValue(m_defFilterStates[nFilter] != 0);
 
       sizer->Add(btn, 0,
@@ -1209,5 +1209,8 @@
    sizer->Add(btnClose, 0, wxALL | wxALIGN_CENTRE_VERTICAL, LAYOUT_X_MARGIN);
 
-   // final initializations
+   // set the correct values for all controls
+   UpdateViewerBar();
+
+   // put the layout together
    m_winBar->SetSizer(sizer);
    m_winBar->SetAutoLayout(TRUE);
@@ -1227,10 +1230,13 @@
 {
    Profile_obj profile(m_folderView->GetFolderProfile());
+   CHECK_RET( profile, _T("no profile in wxFolderMsgWindow::UpdateViewerBar()") );
 
+   // first update the current viewer
    wxString name = READ_CONFIG(profile, MP_MSGVIEW_VIEWER);
    int curViewer = m_namesViewers.Index(name);
    if ( curViewer != -1 )
    {
-      wxChoice *choice = wxStaticCast(FindWindow(Choice_Viewer), wxChoice);
+      wxChoice *choice = wxStaticCast(m_winBar->FindWindow(Choice_Viewer),
+                                      wxChoice);
 
       if ( choice )
@@ -1240,5 +1246,5 @@
       else
       {
-         FAIL_MSG( _T("where is out choice control?") );
+         FAIL_MSG( _T("where is our choice control?") );
       }
    }
@@ -1246,4 +1252,26 @@
    {
       FAIL_MSG( _T("current viewer not in the list of all viewers?") );
+   }
+
+   // then update the filters states
+   const size_t countFilters = m_namesFilters.GetCount();
+   for ( size_t nFilter = 0; nFilter < countFilters; nFilter++ )
+   {
+      // determine if this filter is enabled
+      bool found;
+      bool enable = profile->readEntry(m_namesFilters[nFilter], false, &found);
+      if ( !found )
+         enable = m_defFilterStates[nFilter] != 0;
+
+      // and change its state accordingly
+      wxToggleButton *btn = wxStaticCast
+                            (
+                              m_winBar->FindWindow(TglButton_First + nFilter),
+                              wxToggleButton
+                            );
+
+      CHECK_RET( btn, _T("no filter button in the viewer bar") );
+
+      btn->SetValue(enable);
    }
 }



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to