From 6bc491885a337a4a62b884a31f89fbe4504f7626 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Wed, 18 Sep 2019 18:11:48 -0700 Subject: [PATCH] Minor UI tweaks Typing a long comment in the project symbol editor caused the window to expand, which wasn't intended. Use the mono font in the comment editor. Set the focus to the OK button after creating or editing a project property. Show constant vs. address in the info panel when an EQU directive is selected. --- SourceGen/LineListGen.cs | 22 +++++-------------- SourceGen/MainController.cs | 5 +++++ SourceGen/WpfGui/EditComment.xaml | 1 + SourceGen/WpfGui/EditDefSymbol.xaml | 4 ++-- .../WpfGui/EditProjectProperties.xaml.cs | 4 ++++ 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/SourceGen/LineListGen.cs b/SourceGen/LineListGen.cs index 8c434aa..dfdcfb2 100644 --- a/SourceGen/LineListGen.cs +++ b/SourceGen/LineListGen.cs @@ -788,21 +788,6 @@ namespace SourceGen { return true; } - ///// - ///// Removes all header lines from the line list. - ///// - //private void ClearHeaderLines() { - // // Find the first non-header item. - // int endIndex = FindLineByOffset(mLineList, 0); - // if (endIndex == 0) { - // // no header lines present - // Debug.WriteLine("No header lines found"); - // return; - // } - // Debug.WriteLine("Removing " + endIndex + " header lines"); - // mLineList.RemoveRange(0, endIndex); - //} - /// /// Generates a synthetic offset for the FileOffset field from an index value. The /// index arg is the index of an entry in the DisasmProject.ActiveDefSymbolList. @@ -823,6 +808,10 @@ namespace SourceGen { return offset + (1 << 24); } + // NOTE: the two functions above are tied to the implementation of the function + // below: we output the lines in the order in which they appear in ActiveDefSymbolList. + // If we want to get fancy and sort them, we'll need to do some additional work. + /// /// Generates the header lines (header comment, EQU directives). /// @@ -834,7 +823,6 @@ namespace SourceGen { PseudoOp.PseudoOpNames opNames) { List tmpLines = new List(); Line line; - FormattedParts parts; // Check for header comment. if (proj.LongComments.TryGetValue(Line.HEADER_COMMENT_OFFSET, @@ -853,7 +841,7 @@ namespace SourceGen { null, defSym.DataDescriptor, defSym.Value, 1, PseudoOp.FormatNumericOpFlags.None); string comment = formatter.FormatEolComment(defSym.Comment); - parts = FormattedParts.CreateEquDirective(defSym.Label, + FormattedParts parts = FormattedParts.CreateEquDirective(defSym.Label, formatter.FormatPseudoOp(opNames.EquDirective), valueStr, comment); line.Parts = parts; diff --git a/SourceGen/MainController.cs b/SourceGen/MainController.cs index 3ef4737..00b5cd5 100644 --- a/SourceGen/MainController.cs +++ b/SourceGen/MainController.cs @@ -3270,6 +3270,11 @@ namespace SourceGen { sourceStr = "???"; } extraStr = "Source: " + sourceStr; + if (defSym.SymbolType == Symbol.Type.Constant) { + extraStr += " (constant)"; + } else { + extraStr += " (address)"; + } } break; case LineListGen.Line.Type.LocalVariableTable: diff --git a/SourceGen/WpfGui/EditComment.xaml b/SourceGen/WpfGui/EditComment.xaml index 33cccd6..da25a65 100644 --- a/SourceGen/WpfGui/EditComment.xaml +++ b/SourceGen/WpfGui/EditComment.xaml @@ -30,6 +30,7 @@ limitations under the License. @@ -69,7 +69,7 @@ limitations under the License. + FontFamily="{StaticResource GeneralMonoFont}" ScrollViewer.CanContentScroll="True"/> diff --git a/SourceGen/WpfGui/EditProjectProperties.xaml.cs b/SourceGen/WpfGui/EditProjectProperties.xaml.cs index e453fce..cebc6d8 100644 --- a/SourceGen/WpfGui/EditProjectProperties.xaml.cs +++ b/SourceGen/WpfGui/EditProjectProperties.xaml.cs @@ -452,6 +452,8 @@ namespace SourceGen.WpfGui { // the symbol at the correct sorted position. LoadProjectSymbols(); UpdateControls(); + + okButton.Focus(); } } @@ -485,6 +487,8 @@ namespace SourceGen.WpfGui { IsDirty = true; LoadProjectSymbols(); UpdateControls(); + + okButton.Focus(); } }