mirror of
https://github.com/fadden/6502bench.git
synced 2025-02-12 15:30:48 +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
|
#endregion Project state
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference back to MainWindow object.
|
||||||
|
/// </summary>
|
||||||
|
private MainWindow mMainWin;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of recently-opened projects.
|
/// List of recently-opened projects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -142,6 +147,10 @@ namespace SourceGenWPF {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool mUseMainAppDomainForPlugins = false;
|
private bool mUseMainAppDomainForPlugins = false;
|
||||||
|
|
||||||
|
public MainController(MainWindow win) {
|
||||||
|
mMainWin = win;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ensures that the named project is at the top of the list. If it's elsewhere
|
/// Ensures that the named project is at the top of the list. If it's elsewhere
|
||||||
@ -477,6 +486,7 @@ namespace SourceGenWPF {
|
|||||||
ShowNoProject();
|
ShowNoProject();
|
||||||
InvalidateControls(null);
|
InvalidateControls(null);
|
||||||
#endif
|
#endif
|
||||||
|
mMainWin.ShowCodeListView = false;
|
||||||
|
|
||||||
mGenerationLog = null;
|
mGenerationLog = null;
|
||||||
|
|
||||||
@ -538,6 +548,8 @@ namespace SourceGenWPF {
|
|||||||
RefreshProject(UndoableChange.ReanalysisScope.CodeAndData);
|
RefreshProject(UndoableChange.ReanalysisScope.CodeAndData);
|
||||||
//ShowProject();
|
//ShowProject();
|
||||||
//InvalidateControls(null);
|
//InvalidateControls(null);
|
||||||
|
mMainWin.ShowCodeListView = true;
|
||||||
|
mNavStack.Clear();
|
||||||
|
|
||||||
// Want to do this after ShowProject() or we see a weird glitch.
|
// Want to do this after ShowProject() or we see a weird glitch.
|
||||||
UpdateRecentProjectList(mProjectPathName);
|
UpdateRecentProjectList(mProjectPathName);
|
||||||
|
@ -31,6 +31,13 @@ limitations under the License.
|
|||||||
</RoutedUICommand.InputGestures>
|
</RoutedUICommand.InputGestures>
|
||||||
</RoutedUICommand>
|
</RoutedUICommand>
|
||||||
<RoutedUICommand x:Key="RecentProject"/>
|
<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.Resources>
|
||||||
|
|
||||||
<Window.CommandBindings>
|
<Window.CommandBindings>
|
||||||
@ -172,7 +179,8 @@ limitations under the License.
|
|||||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
|
HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Name="CenterPanel" Grid.Column="2">
|
<Grid Name="launchPanel" Grid.Column="2"
|
||||||
|
Visibility="{Binding Path=LaunchPanelVisibility}" d:IsHidden="True">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
@ -207,6 +215,24 @@ limitations under the License.
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</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 Name="RightPanel" Grid.Column="4">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" MinHeight="100"/>
|
<RowDefinition Height="*" MinHeight="100"/>
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@ -32,11 +34,8 @@ namespace SourceGenWPF.ProjWin {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for MainWindow.xaml
|
/// Interaction logic for MainWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow : Window {
|
public partial class MainWindow : Window, INotifyPropertyChanged {
|
||||||
public string ProgramVersionString {
|
/// <summary>
|
||||||
get { return App.ProgramVersion.ToString(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
private MainController mUI;
|
private MainController mUI;
|
||||||
|
|
||||||
public MainWindow() {
|
public MainWindow() {
|
||||||
@ -44,7 +43,62 @@ namespace SourceGenWPF.ProjWin {
|
|||||||
|
|
||||||
// TODO: verify that RuntimeData dir is accessible
|
// 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) {
|
private void AssembleCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user