Skip to content

Commit

Permalink
GeoDaCenter#1819 keep column size after change the column type
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Feb 26, 2019
1 parent caa13ba commit e938cc5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions DataViewer/DataViewerEditFieldPropertiesDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,10 @@ void DataViewerEditFieldPropertiesDlg::OnCellChanging( wxGridEvent& ev )
wx_col_order.push_back(grid->GetColPos(i));
}
}
for (size_t i=0; i<wx_col_order.size(); ++i)
LOG_MSG(wx_col_order[i]);

// insert new col
int from_col = table_int->FindColId(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
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion DataViewer/TableBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ void TableBase::update(TableState* o)
int dd = table_int->GetColDispDecimals(pos);
GetView()->SetColFormatFloat(pos, -1, dd);
}
}
}

GetView()->Refresh();
}
Expand Down
2 changes: 1 addition & 1 deletion DataViewer/TableFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit e938cc5

Please sign in to comment.