lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 9f1cb2e 39/46: Only auto-size columns when th


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9f1cb2e 39/46: Only auto-size columns when they change, not after each update
Date: Wed, 22 Jul 2020 11:05:16 -0400 (EDT)

branch: master
commit 9f1cb2e3844ac42e09620931d1bf02860ac024fa
Author: Vadim Zeitlin <vadim@tt-solutions.com>
Commit: Vadim Zeitlin <vadim@tt-solutions.com>

    Only auto-size columns when they change, not after each update
    
    Doing this every time makes census view unusably slow for big censuses.
---
 census_view.cpp | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/census_view.cpp b/census_view.cpp
index 95fe6a6..81e564f 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -2274,19 +2274,20 @@ void CensusGridView::update_visible_columns()
             grid_table_->AppendCols(new_columns_count - old_columns_count);
             }
 
+        // Recompute the best fitting sizes if the columns have changed.
+        // Ideally, we would only do it for the new columns, but this would be
+        // more complicated, and for now we prefer to keep the things simple.
+        if(autosize_columns_)
+            {
+            // Pass false to avoid setting min size to the best size.
+            grid_window_->AutoSizeColumns(false);
+            }
+
         grid_window_->SetGridCursor
             (cursor_row
             ,std::min(cursor_col, new_columns_count - 1)
             );
         }
-
-    // Even if the visible columns are the same as before, their contents could
-    // have changed, so always auto-size them if we're configured to do so.
-    if(autosize_columns_)
-        {
-        // Pass false to avoid setting min size to the best size.
-        grid_window_->AutoSizeColumns(false);
-        }
 }
 
 char const* CensusView::icon_xrc_resource() const



reply via email to

[Prev in Thread] Current Thread [Next in Thread]