forked from mia/Aegisub
Significantly speed up resizing the window with large files open
SetColumnWidths can take a long time to run and the only column that can change width on resize is the last one, so only update that.
This commit is contained in:
parent
bb89378b7f
commit
079ccc728d
1 changed files with 6 additions and 4 deletions
|
@ -630,7 +630,11 @@ void BaseGrid::GetRowStrings(int row, AssDialogue *line, bool *paint_columns, wx
|
||||||
|
|
||||||
void BaseGrid::OnSize(wxSizeEvent &) {
|
void BaseGrid::OnSize(wxSizeEvent &) {
|
||||||
AdjustScrollbar();
|
AdjustScrollbar();
|
||||||
SetColumnWidths();
|
|
||||||
|
int w, h;
|
||||||
|
GetClientSize(&w, &h);
|
||||||
|
colWidth[10] = text_col_w = w - text_col_x;
|
||||||
|
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,8 +820,6 @@ void BaseGrid::AdjustScrollbar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseGrid::SetColumnWidths() {
|
void BaseGrid::SetColumnWidths() {
|
||||||
if (!IsShownOnScreen()) return;
|
|
||||||
|
|
||||||
// Width/height
|
// Width/height
|
||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(&w,&h);
|
GetClientSize(&w,&h);
|
||||||
|
@ -920,7 +922,7 @@ void BaseGrid::SetColumnWidths() {
|
||||||
|
|
||||||
// Set size of last
|
// Set size of last
|
||||||
int total = std::accumulate(colWidth, colWidth + 10, 0);
|
int total = std::accumulate(colWidth, colWidth + 10, 0);
|
||||||
colWidth[10] = w - total;
|
colWidth[10] = std::max(w - total, 0);
|
||||||
|
|
||||||
time_cols_x = colWidth[0] + colWidth[1];
|
time_cols_x = colWidth[0] + colWidth[1];
|
||||||
time_cols_w = colWidth[2] + colWidth[3];
|
time_cols_w = colWidth[2] + colWidth[3];
|
||||||
|
|
Loading…
Reference in a new issue