1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-29 10:50:28 +00:00

Make local variable prefix configurable for display

It's kind of handy to have variable labels tagged.  This makes it
configurable.  The quick-set for Merlin sets it to "]", all others
leave it blank.
This commit is contained in:
Andy McFadden 2019-08-31 14:54:44 -07:00
parent 02c79db749
commit b65f75437d
5 changed files with 35 additions and 3 deletions

View File

@ -65,6 +65,7 @@ namespace SourceGen {
public const string FMT_PSEUDO_OP_NAMES = "fmt-pseudo-op-names";
public const string FMT_CHAR_DELIM = "fmt-char-delim";
public const string FMT_STRING_DELIM = "fmt-string-delim";
public const string FMT_LOCAL_VARIABLE_PREFIX = "fmt-local-variable-prefix";
public const string CLIP_LINE_FORMAT = "clip-line-format";
@ -297,7 +298,8 @@ namespace SourceGen {
/// Sets a string setting.
/// </summary>
/// <param name="name">Setting name.</param>
/// <param name="value">Setting value.</param>
/// <param name="value">Setting value. If the value is null, the setting will be
/// removed.</param>
public void SetString(string name, string value) {
if (value == null) {
mSettings.Remove(name);

View File

@ -420,6 +420,8 @@ namespace SourceGen.AsmGen {
// Not doing the delimiter patterns here, because what's in the config file is
// intended for on-screen display, and hence likely to be unsuited for an assembler.
// Ditto for the local variable prefix.
}
}
}

View File

@ -435,11 +435,13 @@ namespace SourceGen {
mFormatterConfig = new Formatter.FormatConfig();
AsmGen.GenCommon.ConfigureFormatterFromSettings(AppSettings.Global,
ref mFormatterConfig);
//mFormatterConfig.mLocalVariableLablePrefix = "\u00a4"; // CURRENCY SIGN
mFormatterConfig.mEndOfLineCommentDelimiter = ";";
mFormatterConfig.mFullLineCommentDelimiterBase = ";";
mFormatterConfig.mBoxLineCommentDelimiter = string.Empty;
mFormatterConfig.mLocalVariableLablePrefix =
settings.GetString(AppSettings.FMT_LOCAL_VARIABLE_PREFIX, string.Empty);
string chrDelCereal = settings.GetString(AppSettings.FMT_CHAR_DELIM, null);
if (chrDelCereal != null) {
mFormatterConfig.mCharDelimiters =

View File

@ -556,13 +556,21 @@ limitations under the License.
</GroupBox>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,16,0,0">
<TextBlock Text="Expression style:"/>
<TextBlock Text="Expression style:" Margin="0,3,0,0"/>
<ComboBox Name="expressionStyleComboBox" Width="120" Margin="8,0,0,0"
ItemsSource="{Binding ExpressionStyleItems}" DisplayMemberPath="Name"
IsReadOnly="True"
SelectionChanged="ExpressionStyleComboBox_SelectionChanged"/>
</StackPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,16,0,0">
<TextBlock Text="Local variable prefix:"/>
<TextBox Width="66" MaxLength="8" Margin="8,1,0,0"
Text="{Binding LocalVarPrefix, UpdateSourceTrigger=PropertyChanged,
FallbackValue=.placeho}"
FontFamily="{StaticResource GeneralMonoFont}"/>
</StackPanel>
<GroupBox DockPanel.Dock="Bottom" Header="Quick Set"
Width="400" HorizontalAlignment="Right" Padding="2,4">
<DockPanel LastChildFill="False" Margin="4">

View File

@ -832,6 +832,19 @@ namespace SourceGen.WpfGui {
get { return sExpStyleItems; }
}
public string LocalVarPrefix {
get { return mLocalVarPrefix; }
set {
if (mLocalVarPrefix != value) {
mLocalVarPrefix = value;
OnPropertyChanged();
mSettings.SetString(AppSettings.FMT_LOCAL_VARIABLE_PREFIX, value);
IsDirty = true;
}
}
}
private string mLocalVarPrefix;
private void Loaded_DisplayFormat() {
PopulateWidthDisamSettings();
@ -844,6 +857,9 @@ namespace SourceGen.WpfGui {
// No need to set this to anything specific.
displayFmtQuickComboBox.SelectedIndex = 0;
LocalVarPrefix = mSettings.GetString(AppSettings.FMT_LOCAL_VARIABLE_PREFIX,
string.Empty);
}
/// <summary>
@ -932,12 +948,14 @@ namespace SourceGen.WpfGui {
formatConfig.mForceAbsOperandPrefix,
formatConfig.mForceLongOperandPrefix);
SelectExpressionStyle(formatConfig.mExpressionMode);
LocalVarPrefix = formatConfig.mLocalVariableLablePrefix;
// dirty flag set by change watchers if one or more fields have changed
}
private void QuickFmtDefaultButton_Click(object sender, RoutedEventArgs e) {
SetWidthDisamSettings(null, "l", "a:", "f:");
SelectExpressionStyle(ExpressionMode.Common);
LocalVarPrefix = string.Empty;
// dirty flag set by change watchers if one or more fields have changed
}