mirror of
https://github.com/fadden/6502bench.git
synced 2025-02-08 05:30:35 +00:00
Add File > Reload External Files
The new menu item reloads platform symbol files and extension scripts, which is very handy when making edits to project files.
This commit is contained in:
parent
195c93a94a
commit
a3c7cd0cf9
@ -2402,11 +2402,10 @@ namespace SourceGen {
|
||||
|
||||
// TODO(someday): if the plugin failed to compile, we will have
|
||||
// one or more error messages, which we are currently discarding
|
||||
// because we can't create UI here. We either need a "change
|
||||
// messages" feature, or we need to pre-flight the plugin and
|
||||
// report the failure elsewhere. (We also want a manual
|
||||
// "reload all external files and plugins" command, which might
|
||||
// run through here.)
|
||||
// because we can't create UI here. We could either have a
|
||||
// general "change msgs" parameter that gets passed around, or
|
||||
// be lazy and just drop them in a "messages from last update"
|
||||
// box.
|
||||
}
|
||||
if (needExtScriptReload) {
|
||||
ClearVisualizationCache();
|
||||
@ -2459,9 +2458,9 @@ namespace SourceGen {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all visualization cached images.
|
||||
/// Clears all cached visualization images.
|
||||
/// </summary>
|
||||
private void ClearVisualizationCache() {
|
||||
public void ClearVisualizationCache() {
|
||||
foreach (KeyValuePair<int, VisualizationSet> kvp in VisualizationSets) {
|
||||
kvp.Value.RefreshNeeded();
|
||||
}
|
||||
|
@ -2700,6 +2700,26 @@ namespace SourceGen {
|
||||
}
|
||||
}
|
||||
|
||||
public void ReloadExternalFiles() {
|
||||
string messages = mProject.LoadExternalFiles();
|
||||
if (messages.Length != 0) {
|
||||
// ProjectLoadIssues isn't quite the right dialog, but it'll do. This is
|
||||
// purely informative; no decision needs to be made.
|
||||
ProjectLoadIssues dlg = new ProjectLoadIssues(mMainWin, messages,
|
||||
ProjectLoadIssues.Buttons.Continue);
|
||||
dlg.ShowDialog();
|
||||
}
|
||||
|
||||
// We only really need to do this if the set of extension scripts has changed.
|
||||
// For an explicit reload we might as well just do it all the time.
|
||||
mProject.ClearVisualizationCache();
|
||||
|
||||
// Update the project.
|
||||
UndoableChange uc =
|
||||
UndoableChange.CreateDummyChange(UndoableChange.ReanalysisScope.CodeAndData);
|
||||
ApplyChanges(new ChangeSet(uc), false);
|
||||
}
|
||||
|
||||
public void Goto() {
|
||||
int index = mMainWin.CodeListView_GetFirstSelectedIndex();
|
||||
if (index < 0) {
|
||||
@ -3569,8 +3589,51 @@ namespace SourceGen {
|
||||
return rs;
|
||||
}
|
||||
|
||||
#endregion Main window UI event handlers
|
||||
public bool CanUndo() {
|
||||
return (mProject != null && mProject.CanUndo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles Edit - Undo.
|
||||
/// </summary>
|
||||
public void UndoChanges() {
|
||||
if (!mProject.CanUndo) {
|
||||
Debug.Assert(false, "Nothing to undo");
|
||||
return;
|
||||
}
|
||||
ChangeSet cs = mProject.PopUndoSet();
|
||||
ApplyChanges(cs, true);
|
||||
UpdateTitle();
|
||||
|
||||
// If the debug dialog is visible, update it.
|
||||
if (mShowUndoRedoHistoryDialog != null) {
|
||||
mShowUndoRedoHistoryDialog.DisplayText = mProject.DebugGetUndoRedoHistory();
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanRedo() {
|
||||
return (mProject != null && mProject.CanRedo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles Edit - Redo.
|
||||
/// </summary>
|
||||
public void RedoChanges() {
|
||||
if (!mProject.CanRedo) {
|
||||
Debug.Assert(false, "Nothing to redo");
|
||||
return;
|
||||
}
|
||||
ChangeSet cs = mProject.PopRedoSet();
|
||||
ApplyChanges(cs, false);
|
||||
UpdateTitle();
|
||||
|
||||
// If the debug dialog is visible, update it.
|
||||
if (mShowUndoRedoHistoryDialog != null) {
|
||||
mShowUndoRedoHistoryDialog.DisplayText = mProject.DebugGetUndoRedoHistory();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Main window UI event handlers
|
||||
|
||||
#region References panel
|
||||
|
||||
@ -3677,50 +3740,6 @@ namespace SourceGen {
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanUndo() {
|
||||
return (mProject != null && mProject.CanUndo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles Edit - Undo.
|
||||
/// </summary>
|
||||
public void UndoChanges() {
|
||||
if (!mProject.CanUndo) {
|
||||
Debug.Assert(false, "Nothing to undo");
|
||||
return;
|
||||
}
|
||||
ChangeSet cs = mProject.PopUndoSet();
|
||||
ApplyChanges(cs, true);
|
||||
UpdateTitle();
|
||||
|
||||
// If the debug dialog is visible, update it.
|
||||
if (mShowUndoRedoHistoryDialog != null) {
|
||||
mShowUndoRedoHistoryDialog.DisplayText = mProject.DebugGetUndoRedoHistory();
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanRedo() {
|
||||
return (mProject != null && mProject.CanRedo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles Edit - Redo.
|
||||
/// </summary>
|
||||
public void RedoChanges() {
|
||||
if (!mProject.CanRedo) {
|
||||
Debug.Assert(false, "Nothing to redo");
|
||||
return;
|
||||
}
|
||||
ChangeSet cs = mProject.PopRedoSet();
|
||||
ApplyChanges(cs, false);
|
||||
UpdateTitle();
|
||||
|
||||
// If the debug dialog is visible, update it.
|
||||
if (mShowUndoRedoHistoryDialog != null) {
|
||||
mShowUndoRedoHistoryDialog.DisplayText = mProject.DebugGetUndoRedoHistory();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion References panel
|
||||
|
||||
#region Notes panel
|
||||
|
@ -147,9 +147,8 @@ directory has a project-local symbol file, called "fdraw-exports".
|
||||
for which Amper-fdraw provides an Applesoft BASIC interface.)
|
||||
|
||||
<p>NOTE: in the current version of SourceGen, changes to .sym65 files are
|
||||
not detected automatically. Closing and re-opening the project
|
||||
(File > Recent Projects, then select the first entry) will reload
|
||||
them.</p>
|
||||
not detected automatically. Use File > Reload External Files to
|
||||
import the changes.</p>
|
||||
|
||||
|
||||
<h2><a name="extension-scripts">Extension Scripts</a></h2>
|
||||
@ -183,7 +182,8 @@ additional package ("Roslyn"), so SourceGen does not support this.</p>
|
||||
are reported to the user. If the project is already open, and a script
|
||||
is added to the project through the Project Properties editor, compiler
|
||||
messages are silently discarded. (This also applies if you undo/redo across
|
||||
the property edit.)</p>
|
||||
the property edit.) Use File > Reload External Files to see the
|
||||
compiler messages.</p>
|
||||
|
||||
<h4>Development</h4>
|
||||
|
||||
@ -199,7 +199,8 @@ causes a .PDB file to be created. While this can help with debugging,
|
||||
it can sometimes get in the way: if you edit the script source code and
|
||||
reload the project without restarting the app, SourceGen will recompile
|
||||
the script, but the old .PDB file will still be open by VisualStudio
|
||||
and you'll get error messages.</p>
|
||||
and you'll see some failure messages. Exiting and restarting SourceGen
|
||||
will allow regeneration of the PDB files.</p>
|
||||
|
||||
<p>Some commonly useful functions are defined in the
|
||||
<code>PluginCommon.Util</code> class, which is available to plugins. These
|
||||
|
@ -28,8 +28,8 @@ means that the system doesn't yet have a set of symbols defined for it.)</p>
|
||||
disassemble. The dialog will update with the pathname and some notes
|
||||
about the file's size. Click "OK" if all looks good to create the
|
||||
project.</p>
|
||||
<p><strong>NOTE:</strong> Support for large 65816 programs is
|
||||
incomplete. The maximum size for a data file is currently 1 MiB.</p>
|
||||
<p><strong>NOTE:</strong> Support for very large 65816 programs is
|
||||
incomplete. The maximum size for a data file is limited to 1 MiB.</p>
|
||||
|
||||
<p>The first time you save the project (with File > Save), you will be
|
||||
prompted for the project name. It's best to use the data file's name
|
||||
|
@ -164,7 +164,6 @@ limitations under the License.
|
||||
</RoutedUICommand>
|
||||
<RoutedUICommand x:Key="NewProjectCmd" Text="New"/>
|
||||
<RoutedUICommand x:Key="OpenCmd" Text="Open"/>
|
||||
<RoutedUICommand x:Key="RemoveHintsCmd" Text="Remove Hints"/>
|
||||
<RoutedUICommand x:Key="RecentProjectCmd"/>
|
||||
<RoutedUICommand x:Key="RedoCmd" Text="Redo">
|
||||
<RoutedUICommand.InputGestures>
|
||||
@ -172,6 +171,12 @@ limitations under the License.
|
||||
<KeyGesture>Ctrl+Shift+Z</KeyGesture>
|
||||
</RoutedUICommand.InputGestures>
|
||||
</RoutedUICommand>
|
||||
<RoutedUICommand x:Key="ReloadExternalFilesCmd" Text="Reload External Files">
|
||||
<RoutedUICommand.InputGestures>
|
||||
<KeyGesture>Ctrl+Shift+R</KeyGesture>
|
||||
</RoutedUICommand.InputGestures>
|
||||
</RoutedUICommand>
|
||||
<RoutedUICommand x:Key="RemoveHintsCmd" Text="Remove Hints"/>
|
||||
<RoutedUICommand x:Key="SelectAllCmd" Text="Select All">
|
||||
<RoutedUICommand.InputGestures>
|
||||
<KeyGesture>Ctrl+A</KeyGesture>
|
||||
@ -300,12 +305,14 @@ limitations under the License.
|
||||
Executed="OpenCmd_Executed"/>
|
||||
<CommandBinding Command="Properties"
|
||||
CanExecute="IsProjectOpen" Executed="EditProjectPropertiesCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource RemoveHintsCmd}"
|
||||
CanExecute="CanRemoveHints" Executed="RemoveHintsCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource RecentProjectCmd}" x:Name="recentProjectCmd"
|
||||
Executed="RecentProjectCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource RedoCmd}"
|
||||
CanExecute="CanRedo" Executed="RedoCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource ReloadExternalFilesCmd}"
|
||||
CanExecute="IsProjectOpen" Executed="ReloadExternalFilesCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource RemoveHintsCmd}"
|
||||
CanExecute="CanRemoveHints" Executed="RemoveHintsCmd_Executed"/>
|
||||
<CommandBinding Command="Save"
|
||||
CanExecute="CanSaveProject" Executed="SaveCmd_Executed"/>
|
||||
<CommandBinding Command="SaveAs"
|
||||
@ -371,13 +378,15 @@ limitations under the License.
|
||||
<MenuItem Command="SaveAs"/>
|
||||
<MenuItem Command="{StaticResource CloseCmd}"/>
|
||||
<Separator/>
|
||||
<MenuItem Name="recentProjectsMenu" Header="Recent Projects" SubmenuOpened="RecentProjectsMenu_SubmenuOpened">
|
||||
<MenuItem Header="(none)"/>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Command="{StaticResource AssembleCmd}"/>
|
||||
<!--<MenuItem Command="Print"/>-->
|
||||
<MenuItem Command="{StaticResource ExportCmd}"/>
|
||||
<Separator/>
|
||||
<MenuItem Name="recentProjectsMenu" Header="Recent Projects" SubmenuOpened="RecentProjectsMenu_SubmenuOpened">
|
||||
<MenuItem Header="(none)"/>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{StaticResource ReloadExternalFilesCmd}"/>
|
||||
<Separator/>
|
||||
<MenuItem Command="{StaticResource ExitCmd}" InputGestureText="Alt+F4"/>
|
||||
</MenuItem>
|
||||
|
@ -1314,15 +1314,19 @@ namespace SourceGen.WpfGui {
|
||||
mMainCtrl.OpenRecentProject(recentIndex);
|
||||
}
|
||||
|
||||
private void RedoCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.RedoChanges();
|
||||
}
|
||||
|
||||
private void ReloadExternalFilesCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.ReloadExternalFiles();
|
||||
}
|
||||
|
||||
private void RemoveHintsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
Debug.WriteLine("remove hints");
|
||||
mMainCtrl.MarkAsType(CodeAnalysis.TypeHint.NoHint, false);
|
||||
}
|
||||
|
||||
private void RedoCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.RedoChanges();
|
||||
}
|
||||
|
||||
private void SaveCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.SaveProject();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user