From e938cc5d536a5b7d8d4b6610d5e6cc5dfc666bf5 Mon Sep 17 00:00:00 2001 From: Xun Li Date: Tue, 26 Feb 2019 14:25:56 -0700 Subject: [PATCH] #1819 keep column size after change the column type --- DataViewer/DataViewerEditFieldPropertiesDlg.cpp | 6 ++++-- DataViewer/TableBase.cpp | 2 +- DataViewer/TableFrame.cpp | 2 +- version.h | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/DataViewer/DataViewerEditFieldPropertiesDlg.cpp b/DataViewer/DataViewerEditFieldPropertiesDlg.cpp index 0e93c50ad..6de0dcfc9 100644 --- a/DataViewer/DataViewerEditFieldPropertiesDlg.cpp +++ b/DataViewer/DataViewerEditFieldPropertiesDlg.cpp @@ -460,11 +460,10 @@ void DataViewerEditFieldPropertiesDlg::OnCellChanging( wxGridEvent& ev ) wx_col_order.push_back(grid->GetColPos(i)); } } - for (size_t i=0; iFindColId(var_name); + double cur_col_size = grid->GetColSize(from_col); int to_col = table_int->InsertCol(new_type, tmp_name, from_col); // get col index of old var again @@ -511,6 +510,9 @@ void DataViewerEditFieldPropertiesDlg::OnCellChanging( wxGridEvent& ev ) grid->SetColPos(i, wx_col_order[i]); } } + // adjust the column size + grid->SetColSize(to_col, cur_col_size); + } catch(GdaLocalSeparatorException& e) { return; } catch(GdaException& e) { diff --git a/DataViewer/TableBase.cpp b/DataViewer/TableBase.cpp index 16b1449c8..a29c597e9 100644 --- a/DataViewer/TableBase.cpp +++ b/DataViewer/TableBase.cpp @@ -693,7 +693,7 @@ void TableBase::update(TableState* o) int dd = table_int->GetColDispDecimals(pos); GetView()->SetColFormatFloat(pos, -1, dd); } - } + } GetView()->Refresh(); } diff --git a/DataViewer/TableFrame.cpp b/DataViewer/TableFrame.cpp index da3a7112e..8a56b4ec5 100644 --- a/DataViewer/TableFrame.cpp +++ b/DataViewer/TableFrame.cpp @@ -120,7 +120,7 @@ TableFrame::TableFrame(wxFrame *parent, Project* project, if (fac < 1) fac = 1; if (fac > 5) fac = 5; fac = fac * 1.2; - grid->SetColMinimalWidth(i, cur_col_size * fac); + grid->SetColMinimalWidth(i, cur_col_size); grid->SetColSize(i, cur_col_size * fac); } else { // add a few pixels of buffer to current label diff --git a/version.h b/version.h index b427dc763..ca02d71d8 100644 --- a/version.h +++ b/version.h @@ -2,10 +2,10 @@ namespace Gda { const int version_major = 1; const int version_minor = 12; const int version_build = 1; - const int version_subbuild = 201; + const int version_subbuild = 203; const int version_year = 2019; const int version_month = 2; - const int version_day = 20; + const int version_day = 26; const int version_night = 0; const int version_type = 2; // 0: alpha, 1: beta, 2: release }