1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-25 05:29:31 +00:00

Work around the mysterious shrinking side-window problem

When a project is opened, the main window layout subtly changes.
Of particular note: the vertical splitters below the references and
symbols windows shift upward 1 pixel when a project is opened, and
back down a pixel when the project is closed.  So if you close the
app while a project is open, the settings file gets updated with the
new values for the sliders.  If you restart the app a lot the effect
becomes noticeably fairly quickly.

I'm not yet sure what's causing this.  I'm currently working around
the issue by not updating the window sizes in the settings file if
they're off by only one pixel.
This commit is contained in:
Andy McFadden 2020-01-01 17:27:03 -08:00
parent 02fb5c50ea
commit 9c5ba9ca4b

View File

@ -387,10 +387,33 @@ namespace SourceGen {
(int)mMainWin.RightPanelWidth);
// Vertical splitters.
AppSettings.Global.SetInt(AppSettings.MAIN_REFERENCES_HEIGHT,
(int)mMainWin.ReferencesPanelHeight);
AppSettings.Global.SetInt(AppSettings.MAIN_SYMBOLS_HEIGHT,
(int)mMainWin.SymbolsPanelHeight);
//AppSettings.Global.SetInt(AppSettings.MAIN_REFERENCES_HEIGHT,
// (int)mMainWin.ReferencesPanelHeight);
//AppSettings.Global.SetInt(AppSettings.MAIN_SYMBOLS_HEIGHT,
// (int)mMainWin.SymbolsPanelHeight);
// Something peculiar happens when we switch from the launch window to the
// code list: the refs/notes splitter and sym/info splitter shift down a pixel.
// Closing the project causes everything to shift back. I'm not sure what's
// causing the layout to change. I'm working around the issue by not saving the
// splitter positions if they've only moved 1 pixel.
// TODO: fix this properly
int refSetting = AppSettings.Global.GetInt(AppSettings.MAIN_REFERENCES_HEIGHT, -1);
if ((int)mMainWin.ReferencesPanelHeight == refSetting ||
(int)mMainWin.ReferencesPanelHeight == refSetting - 1) {
Debug.WriteLine("NOT updating references height");
} else {
AppSettings.Global.SetInt(AppSettings.MAIN_REFERENCES_HEIGHT,
(int)mMainWin.ReferencesPanelHeight);
}
int symSetting = AppSettings.Global.GetInt(AppSettings.MAIN_SYMBOLS_HEIGHT, -1);
if ((int)mMainWin.SymbolsPanelHeight == symSetting ||
(int)mMainWin.SymbolsPanelHeight == symSetting - 1) {
Debug.WriteLine("NOT updating symbols height");
} else {
AppSettings.Global.SetInt(AppSettings.MAIN_SYMBOLS_HEIGHT,
(int)mMainWin.SymbolsPanelHeight);
}
mMainWin.CaptureColumnWidths();