mirror of
https://github.com/fadden/6502bench.git
synced 2024-10-10 19:23:39 +00:00
Implement remaining properties tabs ("Symbol Files", "Extension Scripts")
Simple ListBox controls with strings.
This commit is contained in:
parent
9c6920ae68
commit
8d78ce028a
@ -53,6 +53,8 @@ limitations under the License.
|
|||||||
<system:String x:Key="str_ErrProjectLoadFail">Unable to load project file</system:String>
|
<system:String x:Key="str_ErrProjectLoadFail">Unable to load project file</system:String>
|
||||||
<system:String x:Key="str_ErrProjectSaveFail">Unable to save project file</system:String>
|
<system:String x:Key="str_ErrProjectSaveFail">Unable to save project file</system:String>
|
||||||
<system:String x:Key="str_ErrTooLargeForPreview">[File was too large for preview window]</system:String>
|
<system:String x:Key="str_ErrTooLargeForPreview">[File was too large for preview window]</system:String>
|
||||||
|
<system:String x:Key="str_ExternalFileBadDirFmt" xml:space="preserve">Symbol files and extension scripts must live in the application runtime directory ({0}) or project directory ({1}).

File {2} lives elsewhere.</system:String>
|
||||||
|
<system:String x:Key="str_ExternalFileBadDirCaption">File Not In Runtime Directory</system:String>
|
||||||
<system:String x:Key="str_FileFilterAll">All files (*.*)|*.*</system:String>
|
<system:String x:Key="str_FileFilterAll">All files (*.*)|*.*</system:String>
|
||||||
<system:String x:Key="str_FileFilterCs">C# Source Files(*.cs)|*.cs</system:String>
|
<system:String x:Key="str_FileFilterCs">C# Source Files(*.cs)|*.cs</system:String>
|
||||||
<system:String x:Key="str_FileFilterDis65">SourceGen projects(*.dis65)|*.dis65</system:String>
|
<system:String x:Key="str_FileFilterDis65">SourceGen projects(*.dis65)|*.dis65</system:String>
|
||||||
@ -102,4 +104,5 @@ 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_Unset">[unset]</system:String>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
@ -91,6 +91,10 @@ namespace SourceGenWPF.Res {
|
|||||||
(string)Application.Current.FindResource("str_ErrProjectSaveFail");
|
(string)Application.Current.FindResource("str_ErrProjectSaveFail");
|
||||||
public static string ERR_TOO_LARGE_FOR_PREVIEW =
|
public static string ERR_TOO_LARGE_FOR_PREVIEW =
|
||||||
(string)Application.Current.FindResource("str_ErrTooLargeForPreview");
|
(string)Application.Current.FindResource("str_ErrTooLargeForPreview");
|
||||||
|
public static string EXTERNAL_FILE_BAD_DIR_FMT =
|
||||||
|
(string)Application.Current.FindResource("str_ExternalFileBadDirFmt");
|
||||||
|
public static string EXTERNAL_FILE_BAD_DIR_CAPTION =
|
||||||
|
(string)Application.Current.FindResource("str_ExternalFileBadDirCaption");
|
||||||
public static string FILE_FILTER_ALL =
|
public static string FILE_FILTER_ALL =
|
||||||
(string)Application.Current.FindResource("str_FileFilterAll");
|
(string)Application.Current.FindResource("str_FileFilterAll");
|
||||||
public static string FILE_FILTER_CS =
|
public static string FILE_FILTER_CS =
|
||||||
@ -189,5 +193,7 @@ 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 UNSET =
|
||||||
|
(string)Application.Current.FindResource("str_Unset");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ limitations under the License.
|
|||||||
FontFamily="{StaticResource GeneralMonoFont}"
|
FontFamily="{StaticResource GeneralMonoFont}"
|
||||||
ItemsSource="{Binding ProjectSymbols}"
|
ItemsSource="{Binding ProjectSymbols}"
|
||||||
SnapsToDevicePixels="True" SelectionMode="Single"
|
SnapsToDevicePixels="True" SelectionMode="Single"
|
||||||
SelectionChanged="ProjectSymbolsListView_SelectionChanged"
|
SelectionChanged="List_SelectionChanged"
|
||||||
MouseDoubleClick="ProjectSymbolsListView_MouseDoubleClick">
|
MouseDoubleClick="ProjectSymbolsListView_MouseDoubleClick">
|
||||||
<ListView.Resources>
|
<ListView.Resources>
|
||||||
<Style TargetType="TextBlock">
|
<Style TargetType="TextBlock">
|
||||||
@ -170,17 +170,22 @@ limitations under the License.
|
|||||||
<TextBlock Grid.Column="0" Grid.Row="0" Margin="4,0,0,0"
|
<TextBlock Grid.Column="0" Grid.Row="0" Margin="4,0,0,0"
|
||||||
Text="Currently configured symbol files:"/>
|
Text="Currently configured symbol files:"/>
|
||||||
|
|
||||||
<ListBox Name="symbolFilesListBox" Grid.Column="0" Grid.Row="1" Margin="4">
|
<ListBox Name="symbolFilesListBox" Grid.Column="0" Grid.Row="1" Margin="4"
|
||||||
|
SelectionMode="Extended"
|
||||||
</ListBox>
|
ItemsSource="{Binding PlatformSymbolIdentifiers}"
|
||||||
|
SelectionChanged="List_SelectionChanged"/>
|
||||||
|
|
||||||
<Button Grid.Column="0" Grid.Row="2" Width="120" HorizontalAlignment="Left"
|
<Button Grid.Column="0" Grid.Row="2" Width="120" HorizontalAlignment="Left"
|
||||||
Margin="4" Content="Add Symbol Files..."/>
|
Margin="4" Content="Add Symbol Files..."
|
||||||
|
Click="AddSymbolFilesButton_Click"/>
|
||||||
|
|
||||||
<StackPanel Grid.Column="2" Grid.Row="1">
|
<StackPanel Grid.Column="2" Grid.Row="1">
|
||||||
<Button Name="symbolFileUpButton" Width="75" Margin="4" Content="_Up"/>
|
<Button Name="symbolFileUpButton" Width="75" Margin="4" Content="_Up"
|
||||||
<Button Name="symbolFileDownButton" Width="75" Margin="4,4" Content="_Down"/>
|
Click="SymbolFileUpButton_Click"/>
|
||||||
<Button Name="symbolFileRemoveButton" Width="75" Margin="4,20,4,0" Content="_Remove"/>
|
<Button Name="symbolFileDownButton" Width="75" Margin="4,4" Content="_Down"
|
||||||
|
Click="SymbolFileDownButton_Click"/>
|
||||||
|
<Button Name="symbolFileRemoveButton" Width="75" Margin="4,20,4,0" Content="_Remove"
|
||||||
|
Click="SymbolFileRemoveButton_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@ -201,15 +206,18 @@ limitations under the License.
|
|||||||
<TextBlock Grid.Column="0" Grid.Row="0" Margin="4,0,0,0"
|
<TextBlock Grid.Column="0" Grid.Row="0" Margin="4,0,0,0"
|
||||||
Text="Currently configured symbol files:"/>
|
Text="Currently configured symbol files:"/>
|
||||||
|
|
||||||
<ListBox Name="extensionScriptsListBox" Grid.Column="0" Grid.Row="1" Margin="4">
|
<ListBox Name="extensionScriptsListBox" Grid.Column="0" Grid.Row="1" Margin="4"
|
||||||
|
SelectionMode="Extended"
|
||||||
</ListBox>
|
ItemsSource="{Binding ExtensionScriptIdentifiers}"
|
||||||
|
SelectionChanged="List_SelectionChanged"/>
|
||||||
|
|
||||||
<Button Grid.Column="0" Grid.Row="3" Width="120" HorizontalAlignment="Left"
|
<Button Grid.Column="0" Grid.Row="3" Width="120" HorizontalAlignment="Left"
|
||||||
Margin="4" Content="Add Scripts..."/>
|
Margin="4" Content="Add Scripts..."
|
||||||
|
Click="AddExtensionScriptsButton_Click"/>
|
||||||
|
|
||||||
<StackPanel Grid.Column="1" Grid.Row="1">
|
<StackPanel Grid.Column="1" Grid.Row="1">
|
||||||
<Button Name="extensionScriptRemoveButton" Width="75" Margin="4" Content="_Remove"/>
|
<Button Name="extensionScriptRemoveButton" Width="75" Margin="4" Content="_Remove"
|
||||||
|
Click="ExtensionScriptRemoveButton_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
@ -102,6 +102,8 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
LoadProjectSymbols();
|
LoadProjectSymbols();
|
||||||
LoadPlatformSymbolFiles();
|
LoadPlatformSymbolFiles();
|
||||||
LoadExtensionScriptNames();
|
LoadExtensionScriptNames();
|
||||||
|
|
||||||
|
UpdateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyButton_Click(object sender, RoutedEventArgs e) {
|
private void ApplyButton_Click(object sender, RoutedEventArgs e) {
|
||||||
@ -127,14 +129,38 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
//
|
//
|
||||||
// Project symbols tab
|
// Project symbols tab
|
||||||
//
|
//
|
||||||
|
|
||||||
// Enable or disable the edit/remove buttons based on how many items are selected.
|
// Enable or disable the edit/remove buttons based on how many items are selected.
|
||||||
// (We're currently configured for single-select, so this is really just a != 0 test.)
|
// (We're currently configured for single-select, so this is really just a != 0 test.)
|
||||||
int symSelCount = projectSymbolsListView.SelectedItems.Count;
|
int symSelCount = projectSymbolsListView.SelectedItems.Count;
|
||||||
removeSymbolButton.IsEnabled = (symSelCount == 1);
|
removeSymbolButton.IsEnabled = (symSelCount == 1);
|
||||||
editSymbolButton.IsEnabled = (symSelCount == 1);
|
editSymbolButton.IsEnabled = (symSelCount == 1);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Platform symbol files tab
|
||||||
|
//
|
||||||
|
int fileSelCount = symbolFilesListBox.SelectedItems.Count;
|
||||||
|
symbolFileRemoveButton.IsEnabled = (fileSelCount != 0);
|
||||||
|
symbolFileUpButton.IsEnabled = (fileSelCount == 1 &&
|
||||||
|
symbolFilesListBox.SelectedIndex != 0);
|
||||||
|
symbolFileDownButton.IsEnabled = (fileSelCount == 1 &&
|
||||||
|
symbolFilesListBox.SelectedIndex != symbolFilesListBox.Items.Count - 1);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extension Scripts tab
|
||||||
|
//
|
||||||
|
fileSelCount = extensionScriptsListBox.SelectedItems.Count;
|
||||||
|
extensionScriptRemoveButton.IsEnabled = (fileSelCount != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles a change in the selection of any of the lists.
|
||||||
|
/// </summary>
|
||||||
|
private void List_SelectionChanged(object sender, SelectionChangedEventArgs e) {
|
||||||
|
// Enable/disable buttons as the selection changes.
|
||||||
|
UpdateControls();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region General
|
#region General
|
||||||
|
|
||||||
// CPU combo box items
|
// CPU combo box items
|
||||||
@ -486,41 +512,29 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
|
|
||||||
#endregion Project Symbols
|
#endregion Project Symbols
|
||||||
|
|
||||||
|
|
||||||
#region Platform symbol files
|
#region Platform symbol files
|
||||||
|
|
||||||
|
public ObservableCollection<string> PlatformSymbolIdentifiers { get; private set; } =
|
||||||
|
new ObservableCollection<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the platform symbol file names into the list control.
|
/// Loads the platform symbol file names into the list control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void LoadPlatformSymbolFiles() {
|
private void LoadPlatformSymbolFiles() {
|
||||||
#if false
|
PlatformSymbolIdentifiers.Clear();
|
||||||
symbolFilesListBox.BeginUpdate();
|
|
||||||
symbolFilesListBox.Items.Clear();
|
|
||||||
|
|
||||||
foreach (string fileName in mWorkProps.PlatformSymbolFileIdentifiers) {
|
foreach (string fileName in mWorkProps.PlatformSymbolFileIdentifiers) {
|
||||||
symbolFilesListBox.Items.Add(fileName);
|
PlatformSymbolIdentifiers.Add(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
symbolFilesListBox.EndUpdate();
|
private void AddSymbolFilesButton_Click(object sender, RoutedEventArgs e) {
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProjectSymbolsListView_SelectionChanged(object sender,
|
|
||||||
SelectionChangedEventArgs e) {
|
|
||||||
// Enable/disable buttons as the selection changes.
|
|
||||||
UpdateControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if false
|
|
||||||
|
|
||||||
private void addSymbolFilesButton_Click(object sender, EventArgs e) {
|
|
||||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
OpenFileDialog fileDlg = new OpenFileDialog() {
|
||||||
Filter = PlatformSymbols.FILENAME_FILTER,
|
Filter = PlatformSymbols.FILENAME_FILTER,
|
||||||
Multiselect = true,
|
Multiselect = true,
|
||||||
InitialDirectory = RuntimeDataAccess.GetDirectory(),
|
InitialDirectory = RuntimeDataAccess.GetDirectory(),
|
||||||
RestoreDirectory = true // doesn't seem to work?
|
RestoreDirectory = true // doesn't seem to work?
|
||||||
};
|
};
|
||||||
if (fileDlg.ShowDialog() != DialogResult.OK) {
|
if (fileDlg.ShowDialog() != true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,12 +547,12 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
// Files not found in runtime or project directory.
|
// Files not found in runtime or project directory.
|
||||||
string projDir = mProjectDir;
|
string projDir = mProjectDir;
|
||||||
if (string.IsNullOrEmpty(projDir)) {
|
if (string.IsNullOrEmpty(projDir)) {
|
||||||
projDir = Properties.Resources.UNSET;
|
projDir = Res.Strings.UNSET;
|
||||||
}
|
}
|
||||||
string msg = string.Format(Properties.Resources.EXTERNAL_FILE_BAD_DIR,
|
string msg = string.Format(Res.Strings.EXTERNAL_FILE_BAD_DIR_FMT,
|
||||||
RuntimeDataAccess.GetDirectory(), projDir, pathName);
|
RuntimeDataAccess.GetDirectory(), projDir, pathName);
|
||||||
MessageBox.Show(this, msg, Properties.Resources.EXTERNAL_FILE_BAD_DIR_CAPTION,
|
MessageBox.Show(msg, Res.Strings.EXTERNAL_FILE_BAD_DIR_CAPTION,
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,149 +565,85 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
|
|
||||||
Debug.WriteLine("Adding symbol file: " + ident);
|
Debug.WriteLine("Adding symbol file: " + ident);
|
||||||
mWorkProps.PlatformSymbolFileIdentifiers.Add(ident);
|
mWorkProps.PlatformSymbolFileIdentifiers.Add(ident);
|
||||||
mDirty = true;
|
IsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDirty) {
|
if (IsDirty) {
|
||||||
LoadPlatformSymbolFiles();
|
LoadPlatformSymbolFiles();
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void symbolFileUpButton_Click(object sender, EventArgs e) {
|
private void SymbolFileUpButton_Click(object sender, EventArgs e) {
|
||||||
Debug.Assert(symbolFilesListBox.SelectedIndices.Count == 1);
|
Debug.Assert(symbolFilesListBox.SelectedItems.Count == 1);
|
||||||
int selIndex = symbolFilesListBox.SelectedIndices[0];
|
int selIndex = symbolFilesListBox.SelectedIndex;
|
||||||
Debug.Assert(selIndex > 0);
|
Debug.Assert(selIndex > 0);
|
||||||
|
|
||||||
MoveSingleItem(selIndex, symbolFilesListBox.SelectedItem, -1);
|
MoveSingleItem(selIndex, symbolFilesListBox.SelectedItem, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void symbolFileDownButton_Click(object sender, EventArgs e) {
|
private void SymbolFileDownButton_Click(object sender, EventArgs e) {
|
||||||
Debug.Assert(symbolFilesListBox.SelectedIndices.Count == 1);
|
Debug.Assert(symbolFilesListBox.SelectedItems.Count == 1);
|
||||||
int selIndex = symbolFilesListBox.SelectedIndices[0];
|
int selIndex = symbolFilesListBox.SelectedIndex;
|
||||||
Debug.Assert(selIndex < symbolFilesListBox.Items.Count - 1);
|
Debug.Assert(selIndex < symbolFilesListBox.Items.Count - 1);
|
||||||
|
|
||||||
MoveSingleItem(selIndex, symbolFilesListBox.SelectedItem, +1);
|
MoveSingleItem(selIndex, symbolFilesListBox.SelectedItem, +1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveSingleItem(int selIndex, object selectedItem, int adj) {
|
private void MoveSingleItem(int selIndex, object selectedItem, int adj) {
|
||||||
object selected = symbolFilesListBox.SelectedItem;
|
string selected = (string)symbolFilesListBox.SelectedItem;
|
||||||
symbolFilesListBox.Items.Remove(selected);
|
PlatformSymbolIdentifiers.Remove(selected);
|
||||||
symbolFilesListBox.Items.Insert(selIndex + adj, selected);
|
PlatformSymbolIdentifiers.Insert(selIndex + adj, selected);
|
||||||
symbolFilesListBox.SetSelected(selIndex + adj, true);
|
symbolFilesListBox.SelectedIndex = selIndex + adj;
|
||||||
|
|
||||||
// do the same operation in the file name list
|
// do the same operation in the file name list
|
||||||
string str = mWorkProps.PlatformSymbolFileIdentifiers[selIndex];
|
string str = mWorkProps.PlatformSymbolFileIdentifiers[selIndex];
|
||||||
mWorkProps.PlatformSymbolFileIdentifiers.RemoveAt(selIndex);
|
mWorkProps.PlatformSymbolFileIdentifiers.RemoveAt(selIndex);
|
||||||
mWorkProps.PlatformSymbolFileIdentifiers.Insert(selIndex + adj, str);
|
mWorkProps.PlatformSymbolFileIdentifiers.Insert(selIndex + adj, str);
|
||||||
|
|
||||||
mDirty = true;
|
IsDirty = true;
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void symbolFileRemoveButton_Click(object sender, EventArgs e) {
|
private void SymbolFileRemoveButton_Click(object sender, EventArgs e) {
|
||||||
Debug.Assert(symbolFilesListBox.SelectedIndices.Count > 0);
|
Debug.Assert(symbolFilesListBox.SelectedItems.Count > 0);
|
||||||
for (int i = symbolFilesListBox.SelectedIndices.Count - 1; i >= 0; i--) {
|
for (int i = symbolFilesListBox.SelectedItems.Count - 1; i >= 0; i--) {
|
||||||
int index = symbolFilesListBox.SelectedIndices[i];
|
string selItem = (string)symbolFilesListBox.SelectedItems[i];
|
||||||
symbolFilesListBox.Items.RemoveAt(index);
|
PlatformSymbolIdentifiers.Remove(selItem);
|
||||||
mWorkProps.PlatformSymbolFileIdentifiers.RemoveAt(index);
|
mWorkProps.PlatformSymbolFileIdentifiers.Remove(selItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDirty = true;
|
IsDirty = true;
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void importSymbolsButton_Click(object sender, EventArgs e) {
|
|
||||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
|
||||||
Filter = ProjectFile.FILENAME_FILTER + "|" + Properties.Resources.FILE_FILTER_ALL,
|
|
||||||
FilterIndex = 1
|
|
||||||
};
|
|
||||||
if (fileDlg.ShowDialog() != DialogResult.OK) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string projPathName = Path.GetFullPath(fileDlg.FileName);
|
|
||||||
|
|
||||||
DisasmProject newProject = new DisasmProject();
|
|
||||||
if (!ProjectFile.DeserializeFromFile(projPathName, newProject,
|
|
||||||
out FileLoadReport report)) {
|
|
||||||
// Unable to open project file. Report error and bail.
|
|
||||||
ProjectLoadIssues dlg = new ProjectLoadIssues(report.Format(),
|
|
||||||
ProjectLoadIssues.Buttons.Cancel);
|
|
||||||
dlg.ShowDialog();
|
|
||||||
// ignore dlg.DialogResult
|
|
||||||
dlg.Dispose();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Import all user labels that were marked as "global export". These become
|
|
||||||
// external-address project symbols.
|
|
||||||
int foundCount = 0;
|
|
||||||
foreach (KeyValuePair<int, Symbol> kvp in newProject.UserLabels) {
|
|
||||||
if (kvp.Value.SymbolType == Symbol.Type.GlobalAddrExport) {
|
|
||||||
Symbol sym = kvp.Value;
|
|
||||||
DefSymbol defSym = new DefSymbol(sym.Label, sym.Value, Symbol.Source.Project,
|
|
||||||
Symbol.Type.ExternalAddr, FormatDescriptor.SubType.None,
|
|
||||||
string.Empty, string.Empty);
|
|
||||||
mWorkProps.ProjectSyms[defSym.Label] = defSym;
|
|
||||||
foundCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (foundCount != 0) {
|
|
||||||
mDirty = true;
|
|
||||||
LoadProjectSymbols();
|
|
||||||
UpdateControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
newProject.Cleanup();
|
|
||||||
|
|
||||||
// Tell the user we did something. Might be nice to tell them how many weren't
|
|
||||||
// already present.
|
|
||||||
string msg;
|
|
||||||
if (foundCount == 0) {
|
|
||||||
msg = Properties.Resources.SYMBOL_IMPORT_NONE;
|
|
||||||
} else {
|
|
||||||
msg = string.Format(Properties.Resources.SYMBOL_IMPORT_GOOD, foundCount);
|
|
||||||
}
|
|
||||||
MessageBox.Show(this, msg, Properties.Resources.SYMBOL_IMPORT_CAPTION,
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endregion Platform symbol files
|
#endregion Platform symbol files
|
||||||
|
|
||||||
|
|
||||||
#region Extension scripts
|
#region Extension scripts
|
||||||
|
|
||||||
|
public ObservableCollection<string> ExtensionScriptIdentifiers { get; private set; } =
|
||||||
|
new ObservableCollection<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the extension script file names into the list control.
|
/// Loads the extension script file names into the list control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void LoadExtensionScriptNames() {
|
private void LoadExtensionScriptNames() {
|
||||||
#if false
|
ExtensionScriptIdentifiers.Clear();
|
||||||
extensionScriptsListBox.BeginUpdate();
|
|
||||||
extensionScriptsListBox.Items.Clear();
|
|
||||||
|
|
||||||
foreach (string fileName in mWorkProps.ExtensionScriptFileIdentifiers) {
|
foreach (string fileName in mWorkProps.ExtensionScriptFileIdentifiers) {
|
||||||
extensionScriptsListBox.Items.Add(fileName);
|
ExtensionScriptIdentifiers.Add(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extensionScriptsListBox.EndUpdate();
|
private void AddExtensionScriptsButton_Click(object sender, EventArgs e) {
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if false
|
|
||||||
private void extensionScriptsListBox_SelectedIndexChanged(object sender, EventArgs e) {
|
|
||||||
// Enable/disable buttons as the selection changes.
|
|
||||||
UpdateControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addExtensionScriptsButton_Click(object sender, EventArgs e) {
|
|
||||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
OpenFileDialog fileDlg = new OpenFileDialog() {
|
||||||
Filter = Sandbox.ScriptManager.FILENAME_FILTER,
|
Filter = Sandbox.ScriptManager.FILENAME_FILTER,
|
||||||
Multiselect = true,
|
Multiselect = true,
|
||||||
InitialDirectory = RuntimeDataAccess.GetDirectory(),
|
InitialDirectory = RuntimeDataAccess.GetDirectory(),
|
||||||
RestoreDirectory = true // doesn't seem to work?
|
RestoreDirectory = true // doesn't seem to work?
|
||||||
};
|
};
|
||||||
if (fileDlg.ShowDialog() != DialogResult.OK) {
|
if (fileDlg.ShowDialog() != true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -706,12 +656,12 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
// Files not found in runtime or project directory.
|
// Files not found in runtime or project directory.
|
||||||
string projDir = mProjectDir;
|
string projDir = mProjectDir;
|
||||||
if (string.IsNullOrEmpty(projDir)) {
|
if (string.IsNullOrEmpty(projDir)) {
|
||||||
projDir = Properties.Resources.UNSET;
|
projDir = Res.Strings.UNSET;
|
||||||
}
|
}
|
||||||
string msg = string.Format(Properties.Resources.EXTERNAL_FILE_BAD_DIR,
|
string msg = string.Format(Res.Strings.EXTERNAL_FILE_BAD_DIR_FMT,
|
||||||
RuntimeDataAccess.GetDirectory(), projDir, pathName);
|
RuntimeDataAccess.GetDirectory(), projDir, pathName);
|
||||||
MessageBox.Show(this, msg, Properties.Resources.EXTERNAL_FILE_BAD_DIR_CAPTION,
|
MessageBox.Show(this, msg, Res.Strings.EXTERNAL_FILE_BAD_DIR_CAPTION,
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,27 +674,26 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
|
|
||||||
Debug.WriteLine("Adding extension script: " + ident);
|
Debug.WriteLine("Adding extension script: " + ident);
|
||||||
mWorkProps.ExtensionScriptFileIdentifiers.Add(ident);
|
mWorkProps.ExtensionScriptFileIdentifiers.Add(ident);
|
||||||
mDirty = true;
|
IsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDirty) {
|
if (IsDirty) {
|
||||||
LoadExtensionScriptNames();
|
LoadExtensionScriptNames();
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extensionScriptRemoveButton_Click(object sender, EventArgs e) {
|
private void ExtensionScriptRemoveButton_Click(object sender, EventArgs e) {
|
||||||
Debug.Assert(extensionScriptsListBox.SelectedIndices.Count > 0);
|
Debug.Assert(extensionScriptsListBox.SelectedItems.Count > 0);
|
||||||
for (int i = extensionScriptsListBox.SelectedIndices.Count - 1; i >= 0; i--) {
|
for (int i = extensionScriptsListBox.SelectedItems.Count - 1; i >= 0; i--) {
|
||||||
int index = extensionScriptsListBox.SelectedIndices[i];
|
string selItem = (string)extensionScriptsListBox.SelectedItems[i];
|
||||||
extensionScriptsListBox.Items.RemoveAt(index);
|
ExtensionScriptIdentifiers.Remove(selItem);
|
||||||
mWorkProps.ExtensionScriptFileIdentifiers.RemoveAt(index);
|
mWorkProps.ExtensionScriptFileIdentifiers.Remove(selItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDirty = true;
|
IsDirty = true;
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endregion Extension scripts
|
#endregion Extension scripts
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user