mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-30 01:50:10 +00:00
Set main window title
This commit is contained in:
parent
b93def6560
commit
b42aa80cff
@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
using Microsoft.Win32;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@ -21,6 +20,7 @@ using System.IO;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Web.Script.Serialization;
|
using System.Web.Script.Serialization;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using Asm65;
|
using Asm65;
|
||||||
using CommonUtil;
|
using CommonUtil;
|
||||||
@ -70,7 +70,7 @@ namespace SourceGenWPF {
|
|||||||
|
|
||||||
// Debug windows.
|
// Debug windows.
|
||||||
private Tools.WpfGui.ShowText mShowAnalysisTimersDialog;
|
private Tools.WpfGui.ShowText mShowAnalysisTimersDialog;
|
||||||
public bool IsDebugAnalysisTimersOpen { get { return mShowAnalysisTimersDialog != null; } }
|
public bool IsDebugAnalysisTimersOpen { get { return mShowAnalysisTimersDialog != null; } }
|
||||||
private Tools.WpfGui.ShowText mShowAnalyzerOutputDialog;
|
private Tools.WpfGui.ShowText mShowAnalyzerOutputDialog;
|
||||||
public bool IsDebugAnalyzerOutputOpen { get { return mShowAnalyzerOutputDialog != null; } }
|
public bool IsDebugAnalyzerOutputOpen { get { return mShowAnalyzerOutputDialog != null; } }
|
||||||
private Tools.WpfGui.ShowText mShowUndoRedoHistoryDialog;
|
private Tools.WpfGui.ShowText mShowUndoRedoHistoryDialog;
|
||||||
@ -250,9 +250,7 @@ namespace SourceGenWPF {
|
|||||||
// Place the main window and apply the various settings.
|
// Place the main window and apply the various settings.
|
||||||
ApplyAppSettings();
|
ApplyAppSettings();
|
||||||
|
|
||||||
#if false
|
UpdateTitle();
|
||||||
UpdateMenuItemsAndTitle();
|
|
||||||
#endif
|
|
||||||
mMainWin.UpdateRecentLinks();
|
mMainWin.UpdateRecentLinks();
|
||||||
|
|
||||||
ProcessCommandLine();
|
ProcessCommandLine();
|
||||||
@ -548,6 +546,29 @@ namespace SourceGenWPF {
|
|||||||
mMainWin.UpdateRecentLinks();
|
mMainWin.UpdateRecentLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the main form title to show project name and modification status.
|
||||||
|
/// </summary>
|
||||||
|
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
|
#endregion Init and settings
|
||||||
|
|
||||||
|
|
||||||
@ -572,8 +593,10 @@ namespace SourceGenWPF {
|
|||||||
proj.Initialize(fileData.Length);
|
proj.Initialize(fileData.Length);
|
||||||
proj.PrepForNew(fileData, Path.GetFileName(dataPathName));
|
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,
|
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.
|
// The system definition provides a set of defaults that can be overridden.
|
||||||
// We pull everything of interest out and then discard the object.
|
// We pull everything of interest out and then discard the object.
|
||||||
@ -608,6 +631,8 @@ namespace SourceGenWPF {
|
|||||||
mNavStack.Clear();
|
mNavStack.Clear();
|
||||||
|
|
||||||
UpdateRecentProjectList(mProjectPathName);
|
UpdateRecentProjectList(mProjectPathName);
|
||||||
|
|
||||||
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -651,9 +676,7 @@ namespace SourceGenWPF {
|
|||||||
}
|
}
|
||||||
ApplyChanges(cs, false);
|
ApplyChanges(cs, false);
|
||||||
mProject.PushChangeSet(cs);
|
mProject.PushChangeSet(cs);
|
||||||
#if false
|
UpdateTitle();
|
||||||
UpdateMenuItemsAndTitle();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// If the debug dialog is visible, update it.
|
// If the debug dialog is visible, update it.
|
||||||
if (mShowUndoRedoHistoryDialog != null) {
|
if (mShowUndoRedoHistoryDialog != null) {
|
||||||
@ -727,9 +750,8 @@ namespace SourceGenWPF {
|
|||||||
// Lines may have moved around. Update the selection highlight. It's important
|
// 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
|
// 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.
|
// 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();
|
UpdateSelectionHighlight();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -1074,9 +1096,7 @@ namespace SourceGenWPF {
|
|||||||
mProjectPathName = mProject.ProjectPathName = pathName;
|
mProjectPathName = mProject.ProjectPathName = pathName;
|
||||||
|
|
||||||
// add it to the title bar
|
// add it to the title bar
|
||||||
#if false
|
UpdateTitle();
|
||||||
UpdateMenuItemsAndTitle();
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,9 +1125,7 @@ namespace SourceGenWPF {
|
|||||||
if (mShowUndoRedoHistoryDialog != null) {
|
if (mShowUndoRedoHistoryDialog != null) {
|
||||||
mShowUndoRedoHistoryDialog.DisplayText = mProject.DebugGetUndoRedoHistory();
|
mShowUndoRedoHistoryDialog.DisplayText = mProject.DebugGetUndoRedoHistory();
|
||||||
}
|
}
|
||||||
#if false
|
UpdateTitle();
|
||||||
UpdateMenuItemsAndTitle();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Update this, in case this was a new project.
|
// Update this, in case this was a new project.
|
||||||
UpdateRecentProjectList(pathName);
|
UpdateRecentProjectList(pathName);
|
||||||
@ -2944,9 +2962,7 @@ namespace SourceGenWPF {
|
|||||||
}
|
}
|
||||||
ChangeSet cs = mProject.PopUndoSet();
|
ChangeSet cs = mProject.PopUndoSet();
|
||||||
ApplyChanges(cs, true);
|
ApplyChanges(cs, true);
|
||||||
#if false
|
UpdateTitle();
|
||||||
UpdateMenuItemsAndTitle();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// If the debug dialog is visible, update it.
|
// If the debug dialog is visible, update it.
|
||||||
if (mShowUndoRedoHistoryDialog != null) {
|
if (mShowUndoRedoHistoryDialog != null) {
|
||||||
@ -2968,9 +2984,7 @@ namespace SourceGenWPF {
|
|||||||
}
|
}
|
||||||
ChangeSet cs = mProject.PopRedoSet();
|
ChangeSet cs = mProject.PopRedoSet();
|
||||||
ApplyChanges(cs, false);
|
ApplyChanges(cs, false);
|
||||||
#if false
|
UpdateTitle();
|
||||||
UpdateMenuItemsAndTitle();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// If the debug dialog is visible, update it.
|
// If the debug dialog is visible, update it.
|
||||||
if (mShowUndoRedoHistoryDialog != null) {
|
if (mShowUndoRedoHistoryDialog != null) {
|
||||||
@ -3315,9 +3329,7 @@ namespace SourceGenWPF {
|
|||||||
UndoableChange uc =
|
UndoableChange uc =
|
||||||
UndoableChange.CreateDummyChange(UndoableChange.ReanalysisScope.CodeAndData);
|
UndoableChange.CreateDummyChange(UndoableChange.ReanalysisScope.CodeAndData);
|
||||||
ApplyChanges(new ChangeSet(uc), false);
|
ApplyChanges(new ChangeSet(uc), false);
|
||||||
#if false
|
UpdateTitle(); // in case something changed
|
||||||
UpdateMenuItemsAndTitle(); // in case something changed
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Debug_ToggleCommentRulers() {
|
public void Debug_ToggleCommentRulers() {
|
||||||
|
@ -32,6 +32,7 @@ limitations under the License.
|
|||||||
<system:String x:Key="str_AsmOutputNotFound">Expected output file wasn't created</system:String>
|
<system:String x:Key="str_AsmOutputNotFound">Expected output file wasn't created</system:String>
|
||||||
<system:String x:Key="str_ClipformatAssemblerSource">Assembler Source</system:String>
|
<system:String x:Key="str_ClipformatAssemblerSource">Assembler Source</system:String>
|
||||||
<system:String x:Key="str_ClipformatDisassembly">Disassembly</system:String>
|
<system:String x:Key="str_ClipformatDisassembly">Disassembly</system:String>
|
||||||
|
<system:String x:Key="str_DefaultHeaderCommentFmt">6502bench SourceGen v{0}</system:String>
|
||||||
<system:String x:Key="str_DefaultValue">Default</system:String>
|
<system:String x:Key="str_DefaultValue">Default</system:String>
|
||||||
<system:String x:Key="str_ErrBadFdFmt">Bad format descriptor at +{0:x6}.</system:String>
|
<system:String x:Key="str_ErrBadFdFmt">Bad format descriptor at +{0:x6}.</system:String>
|
||||||
<system:String x:Key="str_ErrBadFdFormat">Bad format descriptor type</system:String>
|
<system:String x:Key="str_ErrBadFdFormat">Bad format descriptor type</system:String>
|
||||||
@ -112,5 +113,8 @@ limitations under the License.
|
|||||||
<system:String x:Key="str_SymbolImportCaption">Symbol Import</system:String>
|
<system:String x:Key="str_SymbolImportCaption">Symbol Import</system:String>
|
||||||
<system:String x:Key="str_SymbolImportGoodFmt">Imported {0} global symbols.</system:String>
|
<system:String x:Key="str_SymbolImportGoodFmt">Imported {0} global symbols.</system:String>
|
||||||
<system:String x:Key="str_SymbolImportNone">No global+export symbols were found.</system:String>
|
<system:String x:Key="str_SymbolImportNone">No global+export symbols were found.</system:String>
|
||||||
|
<system:String x:Key="str_TitleBase">6502bench SourceGen</system:String>
|
||||||
|
<system:String x:Key="str_TitleModified">(save needed)</system:String>
|
||||||
|
<system:String x:Key="str_TitleNewProject">[new project]</system:String>
|
||||||
<system:String x:Key="str_Unset">[unset]</system:String>
|
<system:String x:Key="str_Unset">[unset]</system:String>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
@ -41,6 +41,8 @@ namespace SourceGenWPF.Res {
|
|||||||
(string)Application.Current.FindResource("str_AsmMismatchLengthFmt");
|
(string)Application.Current.FindResource("str_AsmMismatchLengthFmt");
|
||||||
public static string ASM_OUTPUT_NOT_FOUND =
|
public static string ASM_OUTPUT_NOT_FOUND =
|
||||||
(string)Application.Current.FindResource("str_AsmOutputNotFound");
|
(string)Application.Current.FindResource("str_AsmOutputNotFound");
|
||||||
|
public static string DEFAULT_HEADER_COMMENT_FMT =
|
||||||
|
(string)Application.Current.FindResource("str_DefaultHeaderCommentFmt");
|
||||||
public static string DEFAULT_VALUE =
|
public static string DEFAULT_VALUE =
|
||||||
(string)Application.Current.FindResource("str_DefaultValue");
|
(string)Application.Current.FindResource("str_DefaultValue");
|
||||||
public static string CLIPFORMAT_ASSEMBLER_SOURCE =
|
public static string CLIPFORMAT_ASSEMBLER_SOURCE =
|
||||||
@ -205,6 +207,12 @@ namespace SourceGenWPF.Res {
|
|||||||
(string)Application.Current.FindResource("str_SymbolImportGoodFmt");
|
(string)Application.Current.FindResource("str_SymbolImportGoodFmt");
|
||||||
public static string SYMBOL_IMPORT_NONE =
|
public static string SYMBOL_IMPORT_NONE =
|
||||||
(string)Application.Current.FindResource("str_SymbolImportNone");
|
(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 =
|
public static string UNSET =
|
||||||
(string)Application.Current.FindResource("str_Unset");
|
(string)Application.Current.FindResource("str_Unset");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user