1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-06 16:29:03 +00:00

Make project properties window resizable

Useful for the project symbols tab.  The size is retained for the
current session, but resets when the program exits.
This commit is contained in:
Andy McFadden 2020-07-24 16:59:36 -07:00
parent b7d771a3b2
commit 1e7a6620e0
2 changed files with 19 additions and 5 deletions

View File

@ -23,7 +23,7 @@ limitations under the License.
xmlns:local="clr-namespace:SourceGen.WpfGui"
mc:Ignorable="d"
Title="Edit Project Properties"
Width="640" Height="400" ResizeMode="NoResize"
Width="640" Height="400" MinWidth="640" MinHeight="400" ResizeMode="CanResizeWithGrip"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
Loaded="Window_Loaded" Closing="Window_Closing">

View File

@ -40,6 +40,9 @@ namespace SourceGen.WpfGui {
public partial class EditProjectProperties : Window, INotifyPropertyChanged {
private const string NO_WIDTH_STR = "-";
private static double sWindowWidth = -1;
private static double sWindowHeight = -1;
/// <summary>
/// New set. Updated when Apply or OK is hit. This will be null if no changes have
/// been applied.
@ -65,10 +68,7 @@ namespace SourceGen.WpfGui {
/// </remarks>
public bool IsDirty {
get { return mIsDirty; }
set {
mIsDirty = value;
OnPropertyChanged();
}
set { mIsDirty = value; OnPropertyChanged(); }
}
private bool mIsDirty;
@ -161,6 +161,17 @@ namespace SourceGen.WpfGui {
}
private void Window_Loaded(object sender, RoutedEventArgs e) {
// Configure window size. Initially we set it to MinWidth/MinHeight. On subsequent
// visits we set it to the size it was the last time.
if (sWindowWidth < 0) {
sWindowWidth = Width = MinWidth;
sWindowHeight = Height = MinHeight;
} else {
Width = sWindowWidth;
Height = sWindowHeight;
}
// Configure controls and clear IsDirty.
Loaded_General();
LoadProjectSymbols();
@ -200,6 +211,9 @@ namespace SourceGen.WpfGui {
e.Cancel = true;
}
}
sWindowWidth = Width;
sWindowHeight = Height;
}
private void ApplyButton_Click(object sender, RoutedEventArgs e) {