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

Modified Files:
        wxFolderView.cpp wxColumnsDlg.cpp 
Log Message:
fixed bug with col widths changing unexpectedly when just removing a column from 
folder; also don't write the widths changes to the profile unless they have really 
changed

Index: wxFolderView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderView.cpp,v
retrieving revision 1.573
retrieving revision 1.574
diff -b -u -2 -r1.573 -r1.574
--- wxFolderView.cpp    19 Mar 2002 17:36:12 -0000      1.573
+++ wxFolderView.cpp    19 Mar 2002 17:48:09 -0000      1.574
@@ -2427,4 +2427,19 @@
    if ( str != FOLDER_LISTCTRL_WIDTHS_D && str != GetColWidths() )
    {
+      // check if the only difference if for the columns we don't show anyhow:
+      // this is needed to avoid always writing the widths for a folder which
+      // just doesn't show one of the columns shown by default, it would have
+      // "-1"s instead of the global values then
+      wxArrayString widthsOld = UnpackWidths(GetColWidths()),
+                    widthsNew = UnpackWidths(str);
+      size_t col;
+      for ( col = 0; col < WXFLC_NUMENTRIES; col++ )
+      {
+         if ( m_columns[col] != -1 && widthsOld[col] != widthsNew[col] )
+            break;
+      }
+
+      if ( col < WXFLC_NUMENTRIES )
+      {
       // the widths did change, so save them
       Profile *profile = m_FolderView->GetProfile();
@@ -2438,6 +2453,6 @@
          if ( profile->HasEntry(FOLDER_IGNORE_WIDTHS) )
          {
-            // we need to remove the ignore flag or the value we write wouldn't be
-            // used
+               // we need to remove the ignore flag or the value we write
+               // wouldn't be used
             profile->DeleteEntry(FOLDER_IGNORE_WIDTHS);
          }
@@ -2446,4 +2461,5 @@
       profile->writeEntry(FOLDER_LISTCTRL_WIDTHS, str);
    }
+   }
 }
 
@@ -5119,4 +5135,5 @@
                     strWidthsStandard = UnpackWidths(FOLDER_LISTCTRL_WIDTHS_D);
 
+      bool widthsChanged = false;
       for ( n = 0; n < WXFLC_NUMENTRIES; n++ )     // loop over columns
       {
@@ -5132,8 +5149,14 @@
             strWidthsNew.Add(s);
             strWidthsDefNew.Add(s);
+
+            if ( s != strWidths[n] )
+            {
+               // write them to profile
+               widthsChanged = true;
+            }
          }
       }
 
-      if ( strWidthsNew != strWidths )
+      if ( widthsChanged )
       {
          String str = strutil_flatten_array(strWidthsNew, COLUMNS_WIDTHS_SEP);

Index: wxColumnsDlg.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxColumnsDlg.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -u -2 -r1.4 -r1.5
--- wxColumnsDlg.cpp    19 Mar 2002 17:36:13 -0000      1.4
+++ wxColumnsDlg.cpp    19 Mar 2002 17:48:10 -0000      1.5
@@ -306,5 +306,9 @@
       for ( size_t n = 0; n < m_countCol; n++ )
       {
+         if ( m_checklstBox->IsChecked(n) )
+         {
          m_widths->Add(m_spins[m_idxTrans[n]]->GetValue());
+         }
+         //else: don't return the widths for the columns which are not shown
       }
    }


_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to