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

Add F6 as a shortcut for the Project Symbols editor

Goes directly to the second tab of Edit Project Properties.  This is
not represented in the menu system.
This commit is contained in:
Andy McFadden 2019-12-13 11:29:37 -08:00
parent 8b20021c4d
commit 0b0944e0fc
6 changed files with 64 additions and 12 deletions

View File

@ -2071,13 +2071,13 @@ namespace SourceGen {
}
}
public void EditProjectProperties() {
public void EditProjectProperties(WpfGui.EditProjectProperties.Tab initialTab) {
string projectDir = string.Empty;
if (!string.IsNullOrEmpty(mProjectPathName)) {
projectDir = Path.GetDirectoryName(mProjectPathName);
}
EditProjectProperties dlg = new EditProjectProperties(mMainWin, mProject.ProjectProps,
projectDir, mOutputFormatter);
projectDir, mOutputFormatter, initialTab);
dlg.ShowDialog();
ProjectProperties newProps = dlg.NewProps;

View File

@ -294,6 +294,9 @@ run the importer multiple times. Labels that aren't found will not be
removed, so you can safely import from multiple projects, but will need
to manually delete any symbols that are no longer being exported.</p>
<p>Shortcut: you can open the project properties window with the
Project Symbols tab selected by hitting F6 from the main code list.</p>
<h3><a name="projprop-symfiles">Symbol Files</a></h3>
<p>From here, you can add and remove platform symbol files, or change

View File

@ -171,7 +171,6 @@ namespace SourceGen.WpfGui {
default:
Debug.Assert(false);
break;
}
// The various control initializers probably triggered events. Reset the dirty flag.

View File

@ -78,15 +78,39 @@ namespace SourceGen.WpfGui {
private string mProjectDir;
public bool HasProjectDir { get { return !string.IsNullOrEmpty(mProjectDir); } }
/// <summary>
/// Tab page enumeration.
/// </summary>
public enum Tab {
Unknown = 0,
General,
ProjectSymbols,
SymbolFiles,
ExtensionScripts
}
/// <summary>
/// Tab to show when dialog is first opened.
/// </summary>
private Tab mInitialTab;
// INotifyPropertyChanged implementation
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string propertyName = "") {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
/// <summary>
/// Constructor. Initial state is configured from an existing ProjectProperties object.
/// </summary>
/// <param name="owner">Parent window.</param>
/// <param name="props">Property holder to clone.</param>
/// <param name="projectDir">Project directory, if known.</param>
/// <param name="formatter">Text formatter.</param>
/// <param name="initialTab">Tab to open initially. Pass "Unknown" for default.</param>
public EditProjectProperties(Window owner, ProjectProperties props, string projectDir,
Formatter formatter) {
Formatter formatter, Tab initialTab) {
InitializeComponent();
Owner = owner;
DataContext = this;
@ -94,6 +118,7 @@ namespace SourceGen.WpfGui {
mWorkProps = new ProjectProperties(props);
mProjectDir = projectDir;
mFormatter = formatter;
mInitialTab = initialTab;
// Construct arrays used as item sources for combo boxes.
CpuItems = new CpuItem[] {
@ -133,12 +158,6 @@ namespace SourceGen.WpfGui {
};
}
// INotifyPropertyChanged implementation
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string propertyName = "") {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void Window_Loaded(object sender, RoutedEventArgs e) {
Loaded_General();
@ -146,6 +165,26 @@ namespace SourceGen.WpfGui {
LoadPlatformSymbolFiles();
LoadExtensionScriptNames();
switch (mInitialTab) {
case Tab.General:
tabControl.SelectedItem = generalTab;
break;
case Tab.ProjectSymbols:
tabControl.SelectedItem = projectSymbolsTab;
break;
case Tab.SymbolFiles:
tabControl.SelectedItem = symbolFilesTab;
break;
case Tab.ExtensionScripts:
tabControl.SelectedItem = extensionScriptsTab;
break;
case Tab.Unknown:
break;
default:
Debug.Assert(false);
break;
}
UpdateControls();
}

View File

@ -99,6 +99,11 @@ limitations under the License.
<KeyGesture>Ctrl+N</KeyGesture>
</RoutedUICommand.InputGestures>
</RoutedUICommand>
<RoutedUICommand x:Key="EditProjectPropertiesSymbolsCmd">
<RoutedUICommand.InputGestures>
<KeyGesture>F6</KeyGesture>
</RoutedUICommand.InputGestures>
</RoutedUICommand>
<RoutedUICommand x:Key="EditProjectSymbolCmd" Text="Edit Project Symbol..."/>
<RoutedUICommand x:Key="EditStatusFlagsCmd" Text="Override Status Flags..."/>
<RoutedUICommand x:Key="EditVisualizationSetCmd" Text="Create/Edit Visualization Set..."/>
@ -222,6 +227,8 @@ limitations under the License.
CanExecute="CanEditNote" Executed="EditNoteCmd_Executed"/>
<CommandBinding Command="{StaticResource EditOperandCmd}"
CanExecute="CanEditOperand" Executed="EditOperandCmd_Executed"/>
<CommandBinding Command="{StaticResource EditProjectPropertiesSymbolsCmd}"
CanExecute="IsProjectOpen" Executed="EditProjectPropertiesSymbolsCmd_Executed"/>
<CommandBinding Command="{StaticResource EditProjectSymbolCmd}"
CanExecute="CanEditProjectSymbol" Executed="EditProjectSymbolCmd_Executed"/>
<CommandBinding Command="{StaticResource EditStatusFlagsCmd}"
@ -344,7 +351,7 @@ limitations under the License.
<Separator/>
<MenuItem Command="{StaticResource EditHeaderCommentCmd}"/>
<MenuItem Command="Properties" Header="Project Properties..."/>
<!-- IsChecked is set whenever the menu is opened -->
<!-- IsChecked is set when the menu is opened -->
<MenuItem Name="toggleDataScanMenuItem"
Command="{StaticResource ToggleDataScanCmd}" IsCheckable="True"/>
<Separator/>

View File

@ -1180,7 +1180,11 @@ namespace SourceGen.WpfGui {
}
private void EditProjectPropertiesCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
mMainCtrl.EditProjectProperties();
mMainCtrl.EditProjectProperties(WpfGui.EditProjectProperties.Tab.Unknown);
}
private void EditProjectPropertiesSymbolsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
mMainCtrl.EditProjectProperties(WpfGui.EditProjectProperties.Tab.ProjectSymbols);
}
private void EditProjectSymbolCmd_Executed(object sender, ExecutedRoutedEventArgs e) {