diff --git a/data/resources/StringResources.cz.resources b/data/resources/StringResources.cz.resources
index ee2ef349d8..df367c5261 100644
Binary files a/data/resources/StringResources.cz.resources and b/data/resources/StringResources.cz.resources differ
diff --git a/data/resources/StringResources.de.resources b/data/resources/StringResources.de.resources
index 41fc57457d..bbb6088615 100644
Binary files a/data/resources/StringResources.de.resources and b/data/resources/StringResources.de.resources differ
diff --git a/data/resources/StringResources.es-mx.resources b/data/resources/StringResources.es-mx.resources
index 88c1a2f390..ce1c86d141 100644
Binary files a/data/resources/StringResources.es-mx.resources and b/data/resources/StringResources.es-mx.resources differ
diff --git a/data/resources/StringResources.es.resources b/data/resources/StringResources.es.resources
index 7a2a5c9461..e6c5ea61b9 100644
Binary files a/data/resources/StringResources.es.resources and b/data/resources/StringResources.es.resources differ
diff --git a/data/resources/StringResources.fr.resources b/data/resources/StringResources.fr.resources
index 4a79cb17ee..c137b2e9e3 100644
Binary files a/data/resources/StringResources.fr.resources and b/data/resources/StringResources.fr.resources differ
diff --git a/data/resources/StringResources.hu.resources b/data/resources/StringResources.hu.resources
index 1fcb24c815..6bfb4fcceb 100644
Binary files a/data/resources/StringResources.hu.resources and b/data/resources/StringResources.hu.resources differ
diff --git a/data/resources/StringResources.it.resources b/data/resources/StringResources.it.resources
index 5a322ec14a..92f5e5387a 100644
Binary files a/data/resources/StringResources.it.resources and b/data/resources/StringResources.it.resources differ
diff --git a/data/resources/StringResources.kr.resources b/data/resources/StringResources.kr.resources
index 9a75d14abb..f3e22951e4 100644
Binary files a/data/resources/StringResources.kr.resources and b/data/resources/StringResources.kr.resources differ
diff --git a/data/resources/StringResources.nl.resources b/data/resources/StringResources.nl.resources
index 6205c1e2fc..5fdc28497e 100644
Binary files a/data/resources/StringResources.nl.resources and b/data/resources/StringResources.nl.resources differ
diff --git a/data/resources/StringResources.no.resources b/data/resources/StringResources.no.resources
index 30bf4a3671..5a98e0acc9 100644
Binary files a/data/resources/StringResources.no.resources and b/data/resources/StringResources.no.resources differ
diff --git a/data/resources/StringResources.pl.resources b/data/resources/StringResources.pl.resources
index e41ac2f74b..0486ae93f4 100644
Binary files a/data/resources/StringResources.pl.resources and b/data/resources/StringResources.pl.resources differ
diff --git a/data/resources/StringResources.pt-br.resources b/data/resources/StringResources.pt-br.resources
index 6123b93f54..7993f3dd27 100644
Binary files a/data/resources/StringResources.pt-br.resources and b/data/resources/StringResources.pt-br.resources differ
diff --git a/data/resources/StringResources.ro.resources b/data/resources/StringResources.ro.resources
index 67c33c8834..9e4a911059 100644
Binary files a/data/resources/StringResources.ro.resources and b/data/resources/StringResources.ro.resources differ
diff --git a/data/resources/StringResources.se.resources b/data/resources/StringResources.se.resources
index 9fb94a478c..3d393ee2c9 100644
Binary files a/data/resources/StringResources.se.resources and b/data/resources/StringResources.se.resources differ
diff --git a/data/resources/StringResources.tr.resources b/data/resources/StringResources.tr.resources
index 2dde028a99..c091da6601 100644
Binary files a/data/resources/StringResources.tr.resources and b/data/resources/StringResources.tr.resources differ
diff --git a/src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs b/src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs
index 90e8d2b6e5..1119af1612 100644
--- a/src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs
+++ b/src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs
@@ -1,12 +1,12 @@
//
//
//
-//
+//
// $Revision$
//
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Xml;
@@ -36,8 +36,12 @@ namespace ICSharpCode.SharpDevelop.Commands
}
int oldItem = 0;
+ bool editingLayout;
+
public override void Run()
{
+ if (editingLayout) return;
+
ComboBox comboBox = ((ToolBarComboBox)Owner).ComboBox;
string dataPath = Path.Combine(PropertyService.DataDirectory, "resources" + Path.DirectorySeparatorChar + "layouts");
string configPath = Path.Combine(PropertyService.ConfigDirectory, "layouts");
@@ -50,8 +54,11 @@ namespace ICSharpCode.SharpDevelop.Commands
}
if (comboBox.SelectedIndex == editIndex) {
- MessageService.ShowMessage("Todo: Edit configurations");
+ editingLayout = true;
+ ShowLayoutEditor();
+ OnOwnerChanged(EventArgs.Empty);
comboBox.SelectedIndex = oldItem;
+ editingLayout = false;
} else if (comboBox.SelectedIndex == resetIndex) {
ResetToDefaults();
@@ -64,6 +71,74 @@ namespace ICSharpCode.SharpDevelop.Commands
oldItem = comboBox.SelectedIndex;
}
+ static IEnumerable CustomLayoutNames {
+ get {
+ foreach (LayoutConfiguration layout in LayoutConfiguration.Layouts) {
+ if (layout.Custom) {
+ yield return layout.Name;
+ }
+ }
+ }
+ }
+
+ void ShowLayoutEditor()
+ {
+ using (Form frm = new Form()) {
+ frm.Text = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.Title}");
+
+ StringListEditor ed = new StringListEditor();
+ ed.Dock = DockStyle.Fill;
+ ed.ManualOrder = false;
+ ed.BrowseForDirectory = false;
+ ed.TitleText = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.Label}");
+ ed.AddButtonText = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.AddLayout}");
+
+ ed.LoadList(CustomLayoutNames);
+ FlowLayoutPanel p = new FlowLayoutPanel();
+ p.Dock = DockStyle.Bottom;
+ p.FlowDirection = FlowDirection.RightToLeft;
+
+ Button btn = new Button();
+ p.Height = btn.Height + 8;
+ btn.DialogResult = DialogResult.Cancel;
+ btn.Text = ResourceService.GetString("Global.CancelButtonText");
+ frm.CancelButton = btn;
+ p.Controls.Add(btn);
+
+ btn = new Button();
+ btn.DialogResult = DialogResult.OK;
+ btn.Text = ResourceService.GetString("Global.OKButtonText");
+ frm.AcceptButton = btn;
+ p.Controls.Add(btn);
+
+ frm.Controls.Add(ed);
+ frm.Controls.Add(p);
+
+ frm.FormBorderStyle = FormBorderStyle.FixedDialog;
+ frm.MaximizeBox = false;
+ frm.MinimizeBox = false;
+ frm.ClientSize = new System.Drawing.Size(400, 300);
+ frm.StartPosition = FormStartPosition.CenterParent;
+
+ if (frm.ShowDialog(WorkbenchSingleton.MainForm) == DialogResult.OK) {
+ IList oldNames = new List(CustomLayoutNames);
+ IList newNames = ed.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 ResetToDefaults()
{
if (MessageService.AskQuestion("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.ResetToDefaultsQuestion}")) {
@@ -83,6 +158,7 @@ namespace ICSharpCode.SharpDevelop.Commands
void LayoutChanged(object sender, EventArgs e)
{
+ if (editingLayout) return;
ToolBarComboBox toolbarItem = (ToolBarComboBox)Owner;
ComboBox comboBox = toolbarItem.ComboBox;
for (int i = 0; i < comboBox.Items.Count; ++i) {
@@ -92,11 +168,12 @@ namespace ICSharpCode.SharpDevelop.Commands
}
}
}
- protected override void OnOwnerChanged(EventArgs e)
+ protected override void OnOwnerChanged(EventArgs e)
{
base.OnOwnerChanged(e);
ToolBarComboBox toolbarItem = (ToolBarComboBox)Owner;
ComboBox comboBox = toolbarItem.ComboBox;
+ comboBox.Items.Clear();
int index = 0;
foreach (LayoutConfiguration config in LayoutConfiguration.Layouts) {
if (LayoutConfiguration.CurrentLayoutName == config.Name) {
diff --git a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs
index 33f93f53c6..65e63b7338 100644
--- a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs
+++ b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs
@@ -6,7 +6,7 @@
//
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Xml;
@@ -18,18 +18,31 @@ namespace ICSharpCode.SharpDevelop.Gui
{
public class LayoutConfiguration
{
- readonly static string configFile = "LayoutConfig.xml";
- public static ArrayList Layouts = new ArrayList();
- public static string[] DefaultLayouts = new string[] {
+ const string DataLayoutSubPath = "resources/layouts";
+ const string configFile = "LayoutConfig.xml";
+ public static readonly List Layouts = new List();
+
+ public static string[] DefaultLayouts = new string[] {
"Default",
"Debug",
"Plain"
};
+
string name;
string fileName;
string displayName = null;
bool readOnly;
+ bool custom;
+
+ public bool Custom {
+ get {
+ return custom;
+ }
+ set {
+ custom = value;
+ }
+ }
public string FileName {
get {
@@ -67,16 +80,28 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
- public LayoutConfiguration()
+ LayoutConfiguration()
{
-
}
- LayoutConfiguration(XmlElement el)
+ LayoutConfiguration(XmlElement el, bool custom)
{
name = el.GetAttribute("name");
fileName = el.GetAttribute("file");
readOnly = Boolean.Parse(el.GetAttribute("readonly"));
+ this.custom = custom;
+ }
+
+ public static LayoutConfiguration CreateCustom(string name)
+ {
+ LayoutConfiguration l = new LayoutConfiguration();
+ l.name = name;
+ l.fileName = Path.GetRandomFileName() + ".xml";
+ File.Copy(Path.Combine(Path.Combine(PropertyService.DataDirectory, DataLayoutSubPath), "Default.xml"),
+ Path.Combine(Path.Combine(PropertyService.ConfigDirectory, "layouts"), l.fileName));
+ l.custom = true;
+ Layouts.Add(l);
+ return l;
}
public override string ToString()
@@ -113,7 +138,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public static string CurrentLayoutTemplateFileName {
get {
- string dataPath = Path.Combine(PropertyService.DataDirectory, "resources" + Path.DirectorySeparatorChar + "layouts");
+ string dataPath = Path.Combine(PropertyService.DataDirectory, DataLayoutSubPath);
LayoutConfiguration current = CurrentLayout;
if (current != null) {
return Path.Combine(dataPath, current.FileName);
@@ -145,25 +170,41 @@ namespace ICSharpCode.SharpDevelop.Gui
internal static void LoadLayoutConfiguration()
{
- if (Layouts.Count == 0) {
- string configPath = Path.Combine(PropertyService.ConfigDirectory, "layouts");
- if (File.Exists(Path.Combine(configPath, configFile))) {
- LoadLayoutConfiguration(Path.Combine(configPath, configFile));
- }
- string dataPath = Path.Combine(PropertyService.DataDirectory, "resources" + Path.DirectorySeparatorChar + "layouts");
- if (File.Exists(Path.Combine(dataPath, configFile))) {
- LoadLayoutConfiguration(Path.Combine(dataPath, configFile));
- }
+ Layouts.Clear();
+ string configPath = Path.Combine(PropertyService.ConfigDirectory, "layouts");
+ if (File.Exists(Path.Combine(configPath, configFile))) {
+ LoadLayoutConfiguration(Path.Combine(configPath, configFile), true);
+ }
+ string dataPath = Path.Combine(PropertyService.DataDirectory, DataLayoutSubPath);
+ if (File.Exists(Path.Combine(dataPath, configFile))) {
+ LoadLayoutConfiguration(Path.Combine(dataPath, configFile), false);
}
}
- static void LoadLayoutConfiguration(string layoutConfig)
+ static void LoadLayoutConfiguration(string layoutConfig, bool custom)
{
XmlDocument doc = new XmlDocument();
doc.Load(layoutConfig);
foreach (XmlElement el in doc.DocumentElement.ChildNodes) {
- Layouts.Add(new LayoutConfiguration(el));
+ Layouts.Add(new LayoutConfiguration(el, custom));
+ }
+ }
+
+ public static void SaveCustomLayoutConfiguration()
+ {
+ string configPath = Path.Combine(PropertyService.ConfigDirectory, "layouts");
+ using (XmlTextWriter w = new XmlTextWriter(Path.Combine(configPath, configFile), System.Text.Encoding.UTF8)) {
+ w.Formatting = Formatting.Indented;
+ w.WriteStartElement("LayoutConfig");
+ foreach (LayoutConfiguration lc in Layouts) {
+ w.WriteStartElement("Layout");
+ w.WriteAttributeString("name", lc.name);
+ w.WriteAttributeString("file", lc.fileName);
+ w.WriteAttributeString("readonly", lc.readOnly.ToString());
+ w.WriteEndElement();
+ }
+ w.WriteEndElement();
}
}
diff --git a/src/Main/StartUp/Project/Resources/StringResources.resources b/src/Main/StartUp/Project/Resources/StringResources.resources
index 6f305e6ea1..c2d5f8388d 100644
Binary files a/src/Main/StartUp/Project/Resources/StringResources.resources and b/src/Main/StartUp/Project/Resources/StringResources.resources differ