1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-01 22:50:35 +00:00

Minor tweak to instruction operand editor

If you put a value in the "symbol" field of an instruction with an
address operand, you're establishing a symbolic reference to a label
that may be at a different address than the numeric value of the
operand.  But if you then hit the "edit label" button, you'll edit
the label at the *numeric* reference address, which can be confusing.
We now disable the create/edit label button when the format has been
set to "symbol".

The button is just a short-cut, so disabling it doesn't prevent the
user from doing anything.
This commit is contained in:
Andy McFadden 2021-10-16 13:40:27 -07:00
parent 5ee01ee8a4
commit d7dbd8d012
2 changed files with 15 additions and 3 deletions

View File

@ -169,7 +169,7 @@ limitations under the License.
</StackPanel>
<Button Width="150" Margin="0,8,0,0" HorizontalAlignment="Left"
Content="{Binding CreateEditLabelText, FallbackValue=Diddle Label}"
Click="EditLabel_Click"/>
IsEnabled="{Binding IsDiddleLabelEnabled}" Click="EditLabel_Click"/>
</StackPanel>
<StackPanel Visibility="{Binding ShowNarExternalSymbol, Converter={StaticResource BoolToVis}}">

View File

@ -308,6 +308,12 @@ namespace SourceGen.WpfGui {
SymbolValueHex = SYMBOL_NOT_USED;
}
// We want to disable the create/edit label button if a symbol has been
// specified, because the label being edited is the one that the numeric
// reference points to, not the one the symbol points to.
// TODO(maybe): leave it enabled if the symbolic ref matches the numeric ref.
IsDiddleLabelEnabled = !FormatSymbol;
UpdatePreview();
UpdateCopyToOperand();
}
@ -857,6 +863,12 @@ namespace SourceGen.WpfGui {
}
private bool mIsCopyToOperandEnabled;
public bool IsDiddleLabelEnabled {
get { return mIsDiddleLabelEnabled; }
set { mIsDiddleLabelEnabled = value; OnPropertyChanged(); }
}
private bool mIsDiddleLabelEnabled;
/// <summary>
/// Edited label value. Will be null if the label hasn't been created, or has been
/// deleted (by entering a blank string in the label edit box).
@ -889,7 +901,7 @@ namespace SourceGen.WpfGui {
private DefSymbol mEditedProjectSymbol;
/// <summary>
/// Configures the UI in the local variables box at load time.
/// Configures the UI in the Numeric Address Reference box at load time.
/// </summary>
private void NumericReferences_Loaded() {
SymbolEditOffsetResult = -1;
@ -1121,7 +1133,7 @@ namespace SourceGen.WpfGui {
/// <summary>
/// Configures the UI in the local variables box at load time.
/// Configures the UI in the Local Variable box at load time.
/// </summary>
private void LocalVariables_Loaded() {
if (!mOpDef.IsDirectPageInstruction && !mOpDef.IsStackRelInstruction) {