diff --git a/SourceGenWPF/MainController.cs b/SourceGenWPF/MainController.cs
index 386737b..404f16b 100644
--- a/SourceGenWPF/MainController.cs
+++ b/SourceGenWPF/MainController.cs
@@ -1333,11 +1333,9 @@ namespace SourceGenWPF {
case LineListGen.Line.Type.EquDirective:
// Currently only does something for project symbols; platform symbols
// do nothing.
-#if false
- if (editProjectSymbolToolStripMenuItem.Enabled) {
- EditProjectSymbol_Click(sender, e);
+ if (CanEditProjectSymbol()) {
+ EditProjectSymbol();
}
-#endif
break;
case LineListGen.Line.Type.OrgDirective:
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() {
if (SelectionAnalysis.mNumItemsSelected != 1) {
return false;
diff --git a/SourceGenWPF/WpfGui/MainWindow.xaml b/SourceGenWPF/WpfGui/MainWindow.xaml
index 2f79ca1..f5b41f2 100644
--- a/SourceGenWPF/WpfGui/MainWindow.xaml
+++ b/SourceGenWPF/WpfGui/MainWindow.xaml
@@ -84,6 +84,7 @@ limitations under the License.
Ctrl+N
+
@@ -172,6 +173,8 @@ limitations under the License.
CanExecute="CanEditNote" Executed="EditNoteCmd_Executed"/>
+
-
+
diff --git a/SourceGenWPF/WpfGui/MainWindow.xaml.cs b/SourceGenWPF/WpfGui/MainWindow.xaml.cs
index 4569bc1..2d07ec8 100644
--- a/SourceGenWPF/WpfGui/MainWindow.xaml.cs
+++ b/SourceGenWPF/WpfGui/MainWindow.xaml.cs
@@ -769,6 +769,10 @@ namespace SourceGenWPF.WpfGui {
e.CanExecute = IsProjectOpen() && mMainCtrl.CanEditOperand();
}
+ private void CanEditProjectSymbol(object sender, CanExecuteRoutedEventArgs e) {
+ e.CanExecute = IsProjectOpen() && mMainCtrl.CanEditProjectSymbol();
+ }
+
private void CanEditStatusFlags(object sender, CanExecuteRoutedEventArgs e) {
e.CanExecute = IsProjectOpen() && mMainCtrl.CanEditStatusFlags();
}
@@ -888,6 +892,10 @@ namespace SourceGenWPF.WpfGui {
mMainCtrl.EditOperand();
}
+ private void EditProjectSymbolCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
+ mMainCtrl.EditProjectSymbol();
+ }
+
private void EditStatusFlagsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
mMainCtrl.EditStatusFlags();
}