mirror of
https://github.com/fadden/6502bench.git
synced 2024-12-01 22:50:35 +00:00
Implement Edit Project Symbol
This commit is contained in:
parent
f8b1fa3d66
commit
2dd21d433d
@ -1333,11 +1333,9 @@ namespace SourceGenWPF {
|
|||||||
case LineListGen.Line.Type.EquDirective:
|
case LineListGen.Line.Type.EquDirective:
|
||||||
// Currently only does something for project symbols; platform symbols
|
// Currently only does something for project symbols; platform symbols
|
||||||
// do nothing.
|
// do nothing.
|
||||||
#if false
|
if (CanEditProjectSymbol()) {
|
||||||
if (editProjectSymbolToolStripMenuItem.Enabled) {
|
EditProjectSymbol();
|
||||||
EditProjectSymbol_Click(sender, e);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case LineListGen.Line.Type.OrgDirective:
|
case LineListGen.Line.Type.OrgDirective:
|
||||||
if (CanEditAddress()) {
|
if (CanEditAddress()) {
|
||||||
@ -1774,6 +1772,40 @@ namespace SourceGenWPF {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanEditProjectSymbol() {
|
||||||
|
if (SelectionAnalysis.mNumItemsSelected != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (SelectionAnalysis.mLineType != LineListGen.Line.Type.EquDirective) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int selIndex = mMainWin.CodeListView_GetFirstSelectedIndex();
|
||||||
|
int symIndex = LineListGen.DefSymIndexFromOffset(CodeLineList[selIndex].FileOffset);
|
||||||
|
DefSymbol defSym = mProject.ActiveDefSymbolList[symIndex];
|
||||||
|
return (defSym.SymbolSource == Symbol.Source.Project);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EditProjectSymbol() {
|
||||||
|
int selIndex = mMainWin.CodeListView_GetFirstSelectedIndex();
|
||||||
|
int symIndex = LineListGen.DefSymIndexFromOffset(CodeLineList[selIndex].FileOffset);
|
||||||
|
DefSymbol origDefSym = mProject.ActiveDefSymbolList[symIndex];
|
||||||
|
Debug.Assert(origDefSym.SymbolSource == Symbol.Source.Project);
|
||||||
|
|
||||||
|
EditDefSymbol dlg = new EditDefSymbol(mMainWin, mOutputFormatter,
|
||||||
|
mProject.ProjectProps.ProjectSyms);
|
||||||
|
dlg.DefSym = origDefSym;
|
||||||
|
if (dlg.ShowDialog() == true) {
|
||||||
|
ProjectProperties newProps = new ProjectProperties(mProject.ProjectProps);
|
||||||
|
newProps.ProjectSyms.Remove(origDefSym.Label);
|
||||||
|
newProps.ProjectSyms[dlg.DefSym.Label] = dlg.DefSym;
|
||||||
|
|
||||||
|
UndoableChange uc = UndoableChange.CreateProjectPropertiesChange(
|
||||||
|
mProject.ProjectProps, newProps);
|
||||||
|
ChangeSet cs = new ChangeSet(uc);
|
||||||
|
ApplyUndoableChanges(cs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool CanEditStatusFlags() {
|
public bool CanEditStatusFlags() {
|
||||||
if (SelectionAnalysis.mNumItemsSelected != 1) {
|
if (SelectionAnalysis.mNumItemsSelected != 1) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -84,6 +84,7 @@ limitations under the License.
|
|||||||
<KeyGesture>Ctrl+N</KeyGesture>
|
<KeyGesture>Ctrl+N</KeyGesture>
|
||||||
</RoutedUICommand.InputGestures>
|
</RoutedUICommand.InputGestures>
|
||||||
</RoutedUICommand>
|
</RoutedUICommand>
|
||||||
|
<RoutedUICommand x:Key="EditProjectSymbolCmd" Text="Edit Project Symbol..."/>
|
||||||
<RoutedUICommand x:Key="EditStatusFlagsCmd" Text="Override Status Flags..."/>
|
<RoutedUICommand x:Key="EditStatusFlagsCmd" Text="Override Status Flags..."/>
|
||||||
<RoutedUICommand x:Key="ExitCmd" Text="Exit"/>
|
<RoutedUICommand x:Key="ExitCmd" Text="Exit"/>
|
||||||
<RoutedUICommand x:Key="FindNextCmd" Text="Find Next">
|
<RoutedUICommand x:Key="FindNextCmd" Text="Find Next">
|
||||||
@ -172,6 +173,8 @@ limitations under the License.
|
|||||||
CanExecute="CanEditNote" Executed="EditNoteCmd_Executed"/>
|
CanExecute="CanEditNote" Executed="EditNoteCmd_Executed"/>
|
||||||
<CommandBinding Command="{StaticResource EditOperandCmd}"
|
<CommandBinding Command="{StaticResource EditOperandCmd}"
|
||||||
CanExecute="CanEditOperand" Executed="EditOperandCmd_Executed"/>
|
CanExecute="CanEditOperand" Executed="EditOperandCmd_Executed"/>
|
||||||
|
<CommandBinding Command="{StaticResource EditProjectSymbolCmd}"
|
||||||
|
CanExecute="CanEditProjectSymbol" Executed="EditProjectSymbolCmd_Executed"/>
|
||||||
<CommandBinding Command="{StaticResource EditStatusFlagsCmd}"
|
<CommandBinding Command="{StaticResource EditStatusFlagsCmd}"
|
||||||
CanExecute="CanEditStatusFlags" Executed="EditStatusFlagsCmd_Executed"/>
|
CanExecute="CanEditStatusFlags" Executed="EditStatusFlagsCmd_Executed"/>
|
||||||
<CommandBinding Command="{StaticResource ExitCmd}"
|
<CommandBinding Command="{StaticResource ExitCmd}"
|
||||||
@ -270,7 +273,7 @@ limitations under the License.
|
|||||||
<MenuItem Command="{StaticResource EditCommentCmd}" InputGestureText="Ctrl+;"/>
|
<MenuItem Command="{StaticResource EditCommentCmd}" InputGestureText="Ctrl+;"/>
|
||||||
<MenuItem Command="{StaticResource EditLongCommentCmd}"/>
|
<MenuItem Command="{StaticResource EditLongCommentCmd}"/>
|
||||||
<MenuItem Command="{StaticResource EditNoteCmd}"/>
|
<MenuItem Command="{StaticResource EditNoteCmd}"/>
|
||||||
<MenuItem Header="Edit Project Symbol..."/>
|
<MenuItem Command="{StaticResource EditProjectSymbolCmd}"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Command="{StaticResource HintAsCodeEntryPointCmd}" InputGestureText="Ctrl+H, Ctrl+C"/>
|
<MenuItem Command="{StaticResource HintAsCodeEntryPointCmd}" InputGestureText="Ctrl+H, Ctrl+C"/>
|
||||||
<MenuItem Command="{StaticResource HintAsDataStartCmd}" InputGestureText="Ctrl+H, Ctrl+D"/>
|
<MenuItem Command="{StaticResource HintAsDataStartCmd}" InputGestureText="Ctrl+H, Ctrl+D"/>
|
||||||
|
@ -769,6 +769,10 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
e.CanExecute = IsProjectOpen() && mMainCtrl.CanEditOperand();
|
e.CanExecute = IsProjectOpen() && mMainCtrl.CanEditOperand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CanEditProjectSymbol(object sender, CanExecuteRoutedEventArgs e) {
|
||||||
|
e.CanExecute = IsProjectOpen() && mMainCtrl.CanEditProjectSymbol();
|
||||||
|
}
|
||||||
|
|
||||||
private void CanEditStatusFlags(object sender, CanExecuteRoutedEventArgs e) {
|
private void CanEditStatusFlags(object sender, CanExecuteRoutedEventArgs e) {
|
||||||
e.CanExecute = IsProjectOpen() && mMainCtrl.CanEditStatusFlags();
|
e.CanExecute = IsProjectOpen() && mMainCtrl.CanEditStatusFlags();
|
||||||
}
|
}
|
||||||
@ -888,6 +892,10 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
mMainCtrl.EditOperand();
|
mMainCtrl.EditOperand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EditProjectSymbolCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||||
|
mMainCtrl.EditProjectSymbol();
|
||||||
|
}
|
||||||
|
|
||||||
private void EditStatusFlagsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
private void EditStatusFlagsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||||
mMainCtrl.EditStatusFlags();
|
mMainCtrl.EditStatusFlags();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user