diff --git a/SourceGenWPF/MainController.cs b/SourceGenWPF/MainController.cs
index 58df717..467e434 100644
--- a/SourceGenWPF/MainController.cs
+++ b/SourceGenWPF/MainController.cs
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -21,6 +20,7 @@ using System.IO;
using System.Text;
using System.Web.Script.Serialization;
using System.Windows;
+using Microsoft.Win32;
using Asm65;
using CommonUtil;
@@ -70,7 +70,7 @@ namespace SourceGenWPF {
// Debug windows.
private Tools.WpfGui.ShowText mShowAnalysisTimersDialog;
- public bool IsDebugAnalysisTimersOpen { get { return mShowAnalysisTimersDialog != null; } }
+ public bool IsDebugAnalysisTimersOpen { get { return mShowAnalysisTimersDialog != null; } }
private Tools.WpfGui.ShowText mShowAnalyzerOutputDialog;
public bool IsDebugAnalyzerOutputOpen { get { return mShowAnalyzerOutputDialog != null; } }
private Tools.WpfGui.ShowText mShowUndoRedoHistoryDialog;
@@ -250,9 +250,7 @@ namespace SourceGenWPF {
// Place the main window and apply the various settings.
ApplyAppSettings();
-#if false
- UpdateMenuItemsAndTitle();
-#endif
+ UpdateTitle();
mMainWin.UpdateRecentLinks();
ProcessCommandLine();
@@ -548,6 +546,29 @@ namespace SourceGenWPF {
mMainWin.UpdateRecentLinks();
}
+ ///
+ /// Updates the main form title to show project name and modification status.
+ ///
+ private void UpdateTitle() {
+ // Update main window title.
+ StringBuilder sb = new StringBuilder();
+ sb.Append(Res.Strings.TITLE_BASE);
+ if (mProject != null) {
+ sb.Append(" - ");
+ if (string.IsNullOrEmpty(mProjectPathName)) {
+ sb.Append(Res.Strings.TITLE_NEW_PROJECT);
+ } else {
+ sb.Append(Path.GetFileName(mProjectPathName));
+ }
+
+ if (mProject.IsDirty) {
+ sb.Append(" ");
+ sb.Append(Res.Strings.TITLE_MODIFIED);
+ }
+ }
+ mMainWin.Title = sb.ToString();
+ }
+
#endregion Init and settings
@@ -572,8 +593,10 @@ namespace SourceGenWPF {
proj.Initialize(fileData.Length);
proj.PrepForNew(fileData, Path.GetFileName(dataPathName));
+ // Initial header comment is the program name and version.
+ string cmt = string.Format(Res.Strings.DEFAULT_HEADER_COMMENT_FMT, App.ProgramVersion);
proj.LongComments.Add(LineListGen.Line.HEADER_COMMENT_OFFSET,
- new MultiLineComment("6502bench SourceGen v" + App.ProgramVersion));
+ new MultiLineComment(cmt));
// The system definition provides a set of defaults that can be overridden.
// We pull everything of interest out and then discard the object.
@@ -608,6 +631,8 @@ namespace SourceGenWPF {
mNavStack.Clear();
UpdateRecentProjectList(mProjectPathName);
+
+ UpdateTitle();
}
///
@@ -651,9 +676,7 @@ namespace SourceGenWPF {
}
ApplyChanges(cs, false);
mProject.PushChangeSet(cs);
-#if false
- UpdateMenuItemsAndTitle();
-#endif
+ UpdateTitle();
// If the debug dialog is visible, update it.
if (mShowUndoRedoHistoryDialog != null) {
@@ -727,9 +750,8 @@ namespace SourceGenWPF {
// Lines may have moved around. Update the selection highlight. It's important
// we do it here, and not down in DoRefreshProject(), because at that point the
// ListView's selection index could be referencing a line off the end.
-#if false
+ // (This may not be necessary with WPF, because the way highlights work changed.)
UpdateSelectionHighlight();
-#endif
}
///
@@ -1074,9 +1096,7 @@ namespace SourceGenWPF {
mProjectPathName = mProject.ProjectPathName = pathName;
// add it to the title bar
-#if false
- UpdateMenuItemsAndTitle();
-#endif
+ UpdateTitle();
return true;
}
@@ -1105,9 +1125,7 @@ namespace SourceGenWPF {
if (mShowUndoRedoHistoryDialog != null) {
mShowUndoRedoHistoryDialog.DisplayText = mProject.DebugGetUndoRedoHistory();
}
-#if false
- UpdateMenuItemsAndTitle();
-#endif
+ UpdateTitle();
// Update this, in case this was a new project.
UpdateRecentProjectList(pathName);
@@ -2944,9 +2962,7 @@ namespace SourceGenWPF {
}
ChangeSet cs = mProject.PopUndoSet();
ApplyChanges(cs, true);
-#if false
- UpdateMenuItemsAndTitle();
-#endif
+ UpdateTitle();
// If the debug dialog is visible, update it.
if (mShowUndoRedoHistoryDialog != null) {
@@ -2968,9 +2984,7 @@ namespace SourceGenWPF {
}
ChangeSet cs = mProject.PopRedoSet();
ApplyChanges(cs, false);
-#if false
- UpdateMenuItemsAndTitle();
-#endif
+ UpdateTitle();
// If the debug dialog is visible, update it.
if (mShowUndoRedoHistoryDialog != null) {
@@ -3315,9 +3329,7 @@ namespace SourceGenWPF {
UndoableChange uc =
UndoableChange.CreateDummyChange(UndoableChange.ReanalysisScope.CodeAndData);
ApplyChanges(new ChangeSet(uc), false);
-#if false
- UpdateMenuItemsAndTitle(); // in case something changed
-#endif
+ UpdateTitle(); // in case something changed
}
public void Debug_ToggleCommentRulers() {
diff --git a/SourceGenWPF/Res/Strings.xaml b/SourceGenWPF/Res/Strings.xaml
index c8056e5..4934788 100644
--- a/SourceGenWPF/Res/Strings.xaml
+++ b/SourceGenWPF/Res/Strings.xaml
@@ -32,6 +32,7 @@ limitations under the License.
Expected output file wasn't created
Assembler Source
Disassembly
+ 6502bench SourceGen v{0}
Default
Bad format descriptor at +{0:x6}.
Bad format descriptor type
@@ -112,5 +113,8 @@ limitations under the License.
Symbol Import
Imported {0} global symbols.
No global+export symbols were found.
+ 6502bench SourceGen
+ (save needed)
+ [new project]
[unset]
\ No newline at end of file
diff --git a/SourceGenWPF/Res/Strings.xaml.cs b/SourceGenWPF/Res/Strings.xaml.cs
index aa9ac90..2daef5c 100644
--- a/SourceGenWPF/Res/Strings.xaml.cs
+++ b/SourceGenWPF/Res/Strings.xaml.cs
@@ -41,6 +41,8 @@ namespace SourceGenWPF.Res {
(string)Application.Current.FindResource("str_AsmMismatchLengthFmt");
public static string ASM_OUTPUT_NOT_FOUND =
(string)Application.Current.FindResource("str_AsmOutputNotFound");
+ public static string DEFAULT_HEADER_COMMENT_FMT =
+ (string)Application.Current.FindResource("str_DefaultHeaderCommentFmt");
public static string DEFAULT_VALUE =
(string)Application.Current.FindResource("str_DefaultValue");
public static string CLIPFORMAT_ASSEMBLER_SOURCE =
@@ -205,6 +207,12 @@ namespace SourceGenWPF.Res {
(string)Application.Current.FindResource("str_SymbolImportGoodFmt");
public static string SYMBOL_IMPORT_NONE =
(string)Application.Current.FindResource("str_SymbolImportNone");
+ public static string TITLE_BASE =
+ (string)Application.Current.FindResource("str_TitleBase");
+ public static string TITLE_MODIFIED =
+ (string)Application.Current.FindResource("str_TitleModified");
+ public static string TITLE_NEW_PROJECT =
+ (string)Application.Current.FindResource("str_TitleNewProject");
public static string UNSET =
(string)Application.Current.FindResource("str_Unset");
}