|
|
|
@ -8,11 +8,10 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.IO; |
|
|
|
using System.IO; |
|
|
|
using System.Windows.Forms; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using ICSharpCode.Core; |
|
|
|
using ICSharpCode.Core; |
|
|
|
using ICSharpCode.Core.WinForms; |
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop.Gui; |
|
|
|
using ICSharpCode.SharpDevelop.Gui; |
|
|
|
|
|
|
|
using System.Windows.Forms; |
|
|
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.SharpDevelop.Commands |
|
|
|
namespace ICSharpCode.SharpDevelop.Commands |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -42,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Commands |
|
|
|
if (editingLayout) return; |
|
|
|
if (editingLayout) return; |
|
|
|
LoggingService.Debug("ChooseLayoutCommand.Run()"); |
|
|
|
LoggingService.Debug("ChooseLayoutCommand.Run()"); |
|
|
|
|
|
|
|
|
|
|
|
ComboBox comboBox = ((ToolBarComboBox)Owner).ComboBox; |
|
|
|
var comboBox = (System.Windows.Controls.ComboBox)Owner; |
|
|
|
string dataPath = Path.Combine(PropertyService.DataDirectory, "resources" + Path.DirectorySeparatorChar + "layouts"); |
|
|
|
string dataPath = Path.Combine(PropertyService.DataDirectory, "resources" + Path.DirectorySeparatorChar + "layouts"); |
|
|
|
string configPath = Path.Combine(PropertyService.ConfigDirectory, "layouts"); |
|
|
|
string configPath = Path.Combine(PropertyService.ConfigDirectory, "layouts"); |
|
|
|
if (!Directory.Exists(configPath)) { |
|
|
|
if (!Directory.Exists(configPath)) { |
|
|
|
@ -157,8 +156,7 @@ namespace ICSharpCode.SharpDevelop.Commands |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (editingLayout) return; |
|
|
|
if (editingLayout) return; |
|
|
|
LoggingService.Debug("ChooseLayoutCommand.LayoutChanged(object,EventArgs)"); |
|
|
|
LoggingService.Debug("ChooseLayoutCommand.LayoutChanged(object,EventArgs)"); |
|
|
|
ToolBarComboBox toolbarItem = (ToolBarComboBox)Owner; |
|
|
|
var comboBox = (System.Windows.Controls.ComboBox)Owner; |
|
|
|
ComboBox comboBox = toolbarItem.ComboBox; |
|
|
|
|
|
|
|
for (int i = 0; i < comboBox.Items.Count; ++i) { |
|
|
|
for (int i = 0; i < comboBox.Items.Count; ++i) { |
|
|
|
if (((LayoutConfiguration)comboBox.Items[i]).Name == LayoutConfiguration.CurrentLayoutName) { |
|
|
|
if (((LayoutConfiguration)comboBox.Items[i]).Name == LayoutConfiguration.CurrentLayoutName) { |
|
|
|
comboBox.SelectedIndex = i; |
|
|
|
comboBox.SelectedIndex = i; |
|
|
|
@ -169,23 +167,28 @@ namespace ICSharpCode.SharpDevelop.Commands |
|
|
|
protected override void OnOwnerChanged(EventArgs e) |
|
|
|
protected override void OnOwnerChanged(EventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
base.OnOwnerChanged(e); |
|
|
|
base.OnOwnerChanged(e); |
|
|
|
ToolBarComboBox toolbarItem = (ToolBarComboBox)Owner; |
|
|
|
|
|
|
|
ComboBox comboBox = toolbarItem.ComboBox; |
|
|
|
editingLayout = true; |
|
|
|
comboBox.Items.Clear(); |
|
|
|
try { |
|
|
|
int index = 0; |
|
|
|
var comboBox = (System.Windows.Controls.ComboBox)Owner; |
|
|
|
foreach (LayoutConfiguration config in LayoutConfiguration.Layouts) { |
|
|
|
comboBox.Items.Clear(); |
|
|
|
if (LayoutConfiguration.CurrentLayoutName == config.Name) { |
|
|
|
int index = 0; |
|
|
|
index = comboBox.Items.Count; |
|
|
|
foreach (LayoutConfiguration config in LayoutConfiguration.Layouts) { |
|
|
|
|
|
|
|
if (LayoutConfiguration.CurrentLayoutName == config.Name) { |
|
|
|
|
|
|
|
index = comboBox.Items.Count; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
comboBox.Items.Add(config); |
|
|
|
} |
|
|
|
} |
|
|
|
comboBox.Items.Add(config); |
|
|
|
editIndex = comboBox.Items.Count; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
comboBox.Items.Add(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditItem}")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resetIndex = comboBox.Items.Count; |
|
|
|
|
|
|
|
comboBox.Items.Add(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.ResetToDefaultItem}")); |
|
|
|
|
|
|
|
comboBox.SelectedIndex = index; |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
editingLayout = false; |
|
|
|
} |
|
|
|
} |
|
|
|
editIndex = comboBox.Items.Count; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
comboBox.Items.Add(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditItem}")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resetIndex = comboBox.Items.Count; |
|
|
|
|
|
|
|
comboBox.Items.Add(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.ResetToDefaultItem}")); |
|
|
|
|
|
|
|
comboBox.SelectedIndex = index; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|