mirror of
https://github.com/fadden/6502bench.git
synced 2025-02-03 02:32:18 +00:00
Add a place-holder code ListView
Set up a notifiable property to control whether the "launch panel" (i.e. the thing you see when the app launches) or the code ListView is visible. Unearthed the magic required to left-justify the column headers.
This commit is contained in:
parent
bf310d17bc
commit
d830605f5e
@ -70,6 +70,11 @@ namespace SourceGenWPF {
|
||||
#endregion Project state
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reference back to MainWindow object.
|
||||
/// </summary>
|
||||
private MainWindow mMainWin;
|
||||
|
||||
/// <summary>
|
||||
/// List of recently-opened projects.
|
||||
/// </summary>
|
||||
@ -142,6 +147,10 @@ namespace SourceGenWPF {
|
||||
/// </summary>
|
||||
private bool mUseMainAppDomainForPlugins = false;
|
||||
|
||||
public MainController(MainWindow win) {
|
||||
mMainWin = win;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that the named project is at the top of the list. If it's elsewhere
|
||||
@ -477,6 +486,7 @@ namespace SourceGenWPF {
|
||||
ShowNoProject();
|
||||
InvalidateControls(null);
|
||||
#endif
|
||||
mMainWin.ShowCodeListView = false;
|
||||
|
||||
mGenerationLog = null;
|
||||
|
||||
@ -538,6 +548,8 @@ namespace SourceGenWPF {
|
||||
RefreshProject(UndoableChange.ReanalysisScope.CodeAndData);
|
||||
//ShowProject();
|
||||
//InvalidateControls(null);
|
||||
mMainWin.ShowCodeListView = true;
|
||||
mNavStack.Clear();
|
||||
|
||||
// Want to do this after ShowProject() or we see a weird glitch.
|
||||
UpdateRecentProjectList(mProjectPathName);
|
||||
|
@ -31,6 +31,13 @@ limitations under the License.
|
||||
</RoutedUICommand.InputGestures>
|
||||
</RoutedUICommand>
|
||||
<RoutedUICommand x:Key="RecentProject"/>
|
||||
|
||||
<!-- don't center the ListView(GridView) column headers
|
||||
https://stackoverflow.com/questions/44119146/wpf-listview-column-header-alignment
|
||||
-->
|
||||
<Style TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Window.CommandBindings>
|
||||
@ -172,7 +179,8 @@ limitations under the License.
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Name="CenterPanel" Grid.Column="2">
|
||||
<Grid Name="launchPanel" Grid.Column="2"
|
||||
Visibility="{Binding Path=LaunchPanelVisibility}" d:IsHidden="True">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
@ -207,6 +215,24 @@ limitations under the License.
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<ListView Name="codeListView" Grid.Column="2"
|
||||
FontFamily="{StaticResource GeneralMonoFont}"
|
||||
Visibility="{Binding Path=CodeListVisibility}">
|
||||
<ListView.View>
|
||||
<GridView AllowsColumnReorder="False">
|
||||
<GridViewColumn Header="Offset"/>
|
||||
<GridViewColumn Header="Addr"/>
|
||||
<GridViewColumn Header="Bytes"/>
|
||||
<GridViewColumn Header="Flags"/>
|
||||
<GridViewColumn Header="Attr"/>
|
||||
<GridViewColumn Header="Label"/>
|
||||
<GridViewColumn Header="Opcode"/>
|
||||
<GridViewColumn Header="Operand"/>
|
||||
<GridViewColumn Header="Comment"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
<Grid Name="RightPanel" Grid.Column="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" MinHeight="100"/>
|
||||
|
@ -15,8 +15,10 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@ -32,11 +34,8 @@ namespace SourceGenWPF.ProjWin {
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window {
|
||||
public string ProgramVersionString {
|
||||
get { return App.ProgramVersion.ToString(); }
|
||||
}
|
||||
|
||||
public partial class MainWindow : Window, INotifyPropertyChanged {
|
||||
/// <summary>
|
||||
private MainController mUI;
|
||||
|
||||
public MainWindow() {
|
||||
@ -44,7 +43,62 @@ namespace SourceGenWPF.ProjWin {
|
||||
|
||||
// TODO: verify that RuntimeData dir is accessible
|
||||
|
||||
mUI = new MainController();
|
||||
this.DataContext = this;
|
||||
mUI = new MainController(this);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// INotifyPropertyChanged event
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Call this when a notification-worthy property changes value.
|
||||
///
|
||||
/// The CallerMemberName attribute puts the calling property's name in the first arg.
|
||||
/// </summary>
|
||||
/// <param name="propertyName">Name of property that changed.</param>
|
||||
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") {
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private bool mShowCodeListView;
|
||||
|
||||
/// <summary>
|
||||
/// Which panel are we showing, launchPanel or codeListView?
|
||||
/// </summary>
|
||||
public bool ShowCodeListView {
|
||||
get {
|
||||
return mShowCodeListView;
|
||||
}
|
||||
set {
|
||||
mShowCodeListView = value;
|
||||
NotifyPropertyChanged("LaunchPanelVisibility");
|
||||
NotifyPropertyChanged("CodeListVisibility");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if we should be showing the launch panel.
|
||||
/// (Intended for use from XAML.)
|
||||
/// </summary>
|
||||
public Visibility LaunchPanelVisibility {
|
||||
get { return mShowCodeListView ? Visibility.Hidden : Visibility.Visible; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if we should be showing the code ListView.
|
||||
/// (Intended for use from XAML.)
|
||||
/// </summary>
|
||||
public Visibility CodeListVisibility {
|
||||
get { return mShowCodeListView ? Visibility.Visible : Visibility.Hidden; }
|
||||
}
|
||||
|
||||
/// Version string, for display.
|
||||
/// </summary>
|
||||
public string ProgramVersionString {
|
||||
get { return App.ProgramVersion.ToString(); }
|
||||
}
|
||||
|
||||
private void AssembleCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user