diff --git a/data/resources/StringResources.es-mx.resources b/data/resources/StringResources.es-mx.resources index 2102748f1b..542e38011a 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 08f825a4d5..636eca6519 100644 Binary files a/data/resources/StringResources.es.resources and b/data/resources/StringResources.es.resources differ diff --git a/data/resources/StringResources.nl.resources b/data/resources/StringResources.nl.resources index 5da2f8a541..250880f16d 100644 Binary files a/data/resources/StringResources.nl.resources and b/data/resources/StringResources.nl.resources differ diff --git a/data/resources/layouts/Debug.xml b/data/resources/layouts/Debug.xml index c054d30963..5b66adc4d0 100644 --- a/data/resources/layouts/Debug.xml +++ b/data/resources/layouts/Debug.xml @@ -2,7 +2,7 @@ - + @@ -33,8 +33,9 @@ - - + + + @@ -76,7 +77,7 @@ - + @@ -105,12 +106,13 @@ - + + @@ -118,9 +120,9 @@ - + - + diff --git a/data/resources/layouts/Default.xml b/data/resources/layouts/Default.xml index 88917a3d9a..59423a5b38 100644 --- a/data/resources/layouts/Default.xml +++ b/data/resources/layouts/Default.xml @@ -2,7 +2,7 @@ - + @@ -34,8 +34,9 @@ + - + @@ -90,14 +91,20 @@ + + + + + - + + diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/OutlineViewPad.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/OutlineViewPad.cs new file mode 100644 index 0000000000..d150b2d6b7 --- /dev/null +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/OutlineViewPad.cs @@ -0,0 +1,59 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Windows; +using System.Windows.Controls; + +using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Gui; + +namespace ICSharpCode.WpfDesign.AddIn +{ + public class OutlineViewPad : AbstractPadContent + { + SharpDevelopElementHost host = new SharpDevelopElementHost(); + TextBlock notAvailableTextBlock = new TextBlock { + Text = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.OutlinePad.NotAvailable}"), + TextWrapping = TextWrapping.Wrap + }; + + public OutlineViewPad() + { + WorkbenchSingleton.Workbench.ActiveViewContentChanged += WorkbenchActiveViewContentChanged; + WorkbenchActiveViewContentChanged(null, null); + } + + void WorkbenchActiveViewContentChanged(object sender, EventArgs e) + { + WpfViewContent wpfView = WorkbenchSingleton.Workbench.ActiveViewContent as WpfViewContent; + if (wpfView != null) { + host.Child = wpfView.Outline; + } else { + host.Child = notAvailableTextBlock; + } + } + + /// + /// The representing the pad + /// + public override System.Windows.Forms.Control Control { + get { + return host; + } + } + + /// + /// Cleans up all used resources + /// + public override void Dispose() + { + host.Dispose(); + base.Dispose(); + } + } +} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopElementHost.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopElementHost.cs index f835a0319b..fddce2f0bf 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopElementHost.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopElementHost.cs @@ -22,13 +22,17 @@ namespace ICSharpCode.WpfDesign.AddIn [ThreadStatic] static bool registeredErrorHandler; - public SharpDevelopElementHost(WpfViewContent viewContent, UIElement child) + public SharpDevelopElementHost() { if (!registeredErrorHandler) { registeredErrorHandler = true; Dispatcher.CurrentDispatcher.UnhandledException += CurrentDispatcher_UnhandledException; } - + } + + public SharpDevelopElementHost(WpfViewContent viewContent, UIElement child) + : this() + { this.viewContent = viewContent; this.Child = child; } @@ -43,15 +47,19 @@ namespace ICSharpCode.WpfDesign.AddIn bool IsEnabled(RoutedCommand command) { - if (command.CanExecute(null, null)) return true; - return command.CanExecute(null, viewContent.DesignSurface); + if (command.CanExecute(null, null)) + return true; + else if (viewContent != null) + return command.CanExecute(null, viewContent.DesignSurface); + else + return false; } void Run(RoutedCommand command) { if (command.CanExecute(null, null)) { command.Execute(null, null); - } else { + } else if (viewContent != null) { command.Execute(null, viewContent.DesignSurface); } } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs index 0ffc938a3d..a23673dd6e 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs @@ -5,24 +5,24 @@ // $Revision$ // +using ICSharpCode.WpfDesign.Designer.OutlineView; using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Text; using System.Windows.Forms; using System.Windows.Forms.Integration; using System.Windows.Markup; using System.Xml; - using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.WpfDesign.Designer; +using ICSharpCode.WpfDesign.Designer.PropertyGrid; using ICSharpCode.WpfDesign.Designer.Services; using ICSharpCode.WpfDesign.Designer.Xaml; using ICSharpCode.WpfDesign.PropertyGrid; -using ICSharpCode.WpfDesign.Designer.PropertyGrid; -using System.IO; -using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; namespace ICSharpCode.WpfDesign.AddIn { @@ -30,23 +30,23 @@ namespace ICSharpCode.WpfDesign.AddIn /// IViewContent implementation that hosts the WPF designer. /// public class WpfViewContent : AbstractViewContentHandlingLoadErrors, IHasPropertyContainer, IToolsHost - { + { public WpfViewContent(OpenedFile file) : base(file) { BasicMetadata.Register(); - + this.TabPageText = "${res:FormsDesigner.DesignTabPages.DesignTabPage}"; this.IsActiveViewContentChanged += OnIsActiveViewContentChanged; this.editor = file.RegisteredViewContents[0] as TextEditorDisplayBindingWrapper; } - + ElementHost wpfHost; DesignSurface designer; List tasks = new List(); - + // save text from editor when designer cannot be saved (e.g. invalid xml) - TextEditorDisplayBindingWrapper editor; - + TextEditorDisplayBindingWrapper editor; + public DesignSurface DesignSurface { get { return designer; } } @@ -58,15 +58,18 @@ namespace ICSharpCode.WpfDesign.AddIn protected override void LoadInternal(OpenedFile file, System.IO.Stream stream) { Debug.Assert(file == this.PrimaryFile); - + if (designer == null) { // initialize designer on first load DragDropExceptionHandler.HandleException = ICSharpCode.Core.MessageService.ShowError; designer = new DesignSurface(); - wpfHost = new SharpDevelopElementHost(this, designer); + wpfHost = new SharpDevelopElementHost(this, designer); this.UserControl = wpfHost; InitPropertyEditor(); } + if (outline != null) { + outline.Root = null; + } using (XmlTextReader r = new XmlTextReader(stream)) { XamlLoadSettings settings = new XamlLoadSettings(); settings.DesignerAssemblies.Add(typeof(WpfViewContent).Assembly); @@ -81,9 +84,13 @@ namespace ICSharpCode.WpfDesign.AddIn settings.TypeFinder = MyTypeFinder.Create(this.PrimaryFile); designer.LoadDesigner(r, settings); - + UpdateTasks(); - + + if (outline != null && designer.DesignContext != null && designer.DesignContext.RootItem != null) { + outline.Root = OutlineNode.Create(designer.DesignContext.RootItem); + } + propertyGridView.PropertyGrid.SelectedItems = null; designer.DesignContext.Services.Selection.SelectionChanged += OnSelectionChanged; designer.DesignContext.Services.GetService().UndoStackChanged += OnUndoStackChanged; @@ -105,20 +112,20 @@ namespace ICSharpCode.WpfDesign.AddIn editor.Save(file, stream); } } - + public override bool SupportsSwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView) { return newView == editor && !designer.DesignContext.CanSave; } - + void UpdateTasks() { foreach (var task in tasks) { TaskService.Remove(task); } - + tasks.Clear(); - + var xamlErrorService = designer.DesignContext.Services.GetService(); foreach (var error in xamlErrorService.Errors) { var task = new Task(PrimaryFile.FileName, error.Message, error.Column - 1, error.Line - 1, TaskType.Error); @@ -140,7 +147,7 @@ namespace ICSharpCode.WpfDesign.AddIn void InitPropertyEditor() { propertyGridView = new PropertyGridView(); - propertyEditorHost = new SharpDevelopElementHost(this, propertyGridView); + propertyEditorHost = new SharpDevelopElementHost(this, propertyGridView); propertyContainer.PropertyGridReplacementControl = propertyEditorHost; } @@ -195,5 +202,19 @@ namespace ICSharpCode.WpfDesign.AddIn } } } + + Outline outline; + + public Outline Outline { + get { + if (outline == null) { + outline = new Outline(); + if (DesignSurface != null && DesignSurface.DesignContext != null && DesignSurface.DesignContext.RootItem != null) { + outline.Root = OutlineNode.Create(DesignSurface.DesignContext.RootItem); + } + } + return outline; + } + } } } \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.AddIn.csproj b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.AddIn.csproj index ae5a9cc0ee..b0a4d54f83 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.AddIn.csproj +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.AddIn.csproj @@ -65,6 +65,7 @@ ObjectEditor.xaml + diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin index bc5fd34df7..0df15edf4b 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin @@ -23,4 +23,13 @@ class = "ICSharpCode.WpfDesign.AddIn.WpfSecondaryDisplayBinding" fileNamePattern = "\.xaml$"/> + + + + diff --git a/src/Main/StartUp/Project/Resources/StringResources.resources b/src/Main/StartUp/Project/Resources/StringResources.resources index 9f7d1c8e24..0c3f5a23ab 100644 Binary files a/src/Main/StartUp/Project/Resources/StringResources.resources and b/src/Main/StartUp/Project/Resources/StringResources.resources differ