Browse Source

ChooseLayoutComboBox.cs, remove StringListEditor, use StringListEditorDialog.xaml.cs

newNRvisualizers
Peter Forstmeier 13 years ago
parent
commit
8b4f05c4d6
  1. 12
      src/Main/Base/Project/Src/Gui/Components/StringListEditorDialog.xaml
  2. 13
      src/Main/Base/Project/Src/Gui/Components/StringListEditorDialog.xaml.cs
  3. 32
      src/Main/SharpDevelop/Workbench/ChooseLayoutComboBox.cs

12
src/Main/Base/Project/Src/Gui/Components/StringListEditorDialog.xaml

@ -6,9 +6,11 @@ @@ -6,9 +6,11 @@
xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Gui"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
Height="300" Width="400"
Title="ICSharpCode.CppBinding.Project">
Height="300" Width="400"
WindowStartupLocation="CenterOwner"
Title="ICSharpCode.CppBinding.Project"
Style="{x:Static core:GlobalStyles.DialogWindowStyle}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition ></RowDefinition>
@ -24,7 +26,7 @@ @@ -24,7 +26,7 @@
<Button Margin="0,3,5,3" Grid.Row="1" Grid.Column="1" IsDefault="True" Click="Button_Click" Content="{core:Localize Global.OKButtonText}"></Button>
<Button Margin="0,3,5,3" Grid.Row="1" Grid.Column="2" IsCancel="True" Content="{core:Localize Global.CancelButtonText}"></Button>
</Grid>
</Grid>
</Window>

13
src/Main/Base/Project/Src/Gui/Components/StringListEditorDialog.xaml.cs

@ -28,7 +28,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -28,7 +28,7 @@ namespace ICSharpCode.SharpDevelop.Gui
}
public bool BrowseForDirectory {
public bool BrowseForDirectory {
get {return stringListEditor.BrowseForDirectory;}
set {stringListEditor.BrowseForDirectory = value;}
}
@ -49,12 +49,19 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -49,12 +49,19 @@ namespace ICSharpCode.SharpDevelop.Gui
public void LoadList(IEnumerable<string> list) {
stringListEditor.LoadList(list);
}
}
void Button_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
}
public string AddButtonText
{
get {return stringListEditor.Content.ToString();}
set {stringListEditor.addButton.Content = value;}
}
}
}

32
src/Main/SharpDevelop/Workbench/ChooseLayoutComboBox.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows;
using System.Windows.Forms;
using ICSharpCode.Core;
@ -102,7 +103,36 @@ namespace ICSharpCode.SharpDevelop.Workbench @@ -102,7 +103,36 @@ namespace ICSharpCode.SharpDevelop.Workbench
}
}
void ShowLayoutEditor()
{
var editor = new StringListEditorDialog();
editor.Owner = ((WpfWorkbench)SD.Workbench).MainWindow;
editor.Title = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.Title}");
editor.TitleText = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.Label}");
editor.ListCaption = "List:";
editor.AddButtonText = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.AddLayout}");
editor.ShowDialog();
if (editor.DialogResult ?? false) {
IList<string> oldNames = new List<string>(CustomLayoutNames);
IList<string> newNames = editor.GetList();
// add newly added layouts
foreach (string newLayoutName in newNames) {
if (!oldNames.Contains(newLayoutName)) {
oldNames.Add(newLayoutName);
LayoutConfiguration.CreateCustom(newLayoutName);
}
}
// remove deleted layouts
LayoutConfiguration.Layouts.RemoveAll(delegate(LayoutConfiguration lc) {
return lc.Custom && !newNames.Contains(lc.Name);
});
LayoutConfiguration.SaveCustomLayoutConfiguration();
}
}
/*
void aa_howLayoutEditor()
{
using (Form frm = new Form()) {
frm.Text = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.Title}");
@ -161,6 +191,8 @@ namespace ICSharpCode.SharpDevelop.Workbench @@ -161,6 +191,8 @@ namespace ICSharpCode.SharpDevelop.Workbench
}
}
*/
void ResetToDefaults()
{
if (MessageService.AskQuestion("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.ResetToDefaultsQuestion}")) {

Loading…
Cancel
Save