Browse Source

New Search Results pad.

Add support for DropDownButton in toolbars.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4165 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts^2
Daniel Grunwald 16 years ago
parent
commit
3c7a54507f
  1. 80
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 3
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  3. 32
      src/Main/Base/Project/Src/Gui/Pads/SearchResultPad/ISearchResult.cs
  4. 82
      src/Main/Base/Project/Src/Gui/Pads/SearchResultPad/SearchResultPad.cs
  5. 42
      src/Main/Base/Project/Src/Gui/Pads/SearchResultPad/SearchResultPadToolbarCommands.cs
  6. 43
      src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs
  7. 71
      src/Main/ICSharpCode.Core.Presentation/DropDownButton.cs
  8. 7
      src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj
  9. 8
      src/Main/ICSharpCode.Core.Presentation/Menu/MenuService.cs
  10. 19
      src/Main/ICSharpCode.Core.Presentation/SplitButton.cs
  11. 5
      src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarButton.cs
  12. 58
      src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarDropDownButton.cs
  13. 6
      src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarService.cs
  14. 5
      src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarSplitButton.cs
  15. 80
      src/Main/ICSharpCode.Core.Presentation/themes/Aero.NormalColor.xaml
  16. 88
      src/Main/ICSharpCode.Core.Presentation/themes/generic.xaml

80
AddIns/ICSharpCode.SharpDevelop.addin

@ -104,20 +104,20 @@
<CommandBinding command="SDBuildCommands.BuildSolution" class="ICSharpCode.SharpDevelop.Project.Commands.Build" gestures="F8" /> <CommandBinding command="SDBuildCommands.BuildSolution" class="ICSharpCode.SharpDevelop.Project.Commands.Build" gestures="F8" />
<CommandBinding command="SDBuildCommands.RebuildSolution" class="ICSharpCode.SharpDevelop.Project.Commands.Rebuild" gestures="Alt+F8" /> <CommandBinding command="SDBuildCommands.RebuildSolution" class="ICSharpCode.SharpDevelop.Project.Commands.Rebuild" gestures="Alt+F8" />
<CommandBinding command="SDBuildCommands.CleanSolution" class="ICSharpCode.SharpDevelop.Project.Commands.Clean" /> <CommandBinding command="SDBuildCommands.CleanSolution" class="ICSharpCode.SharpDevelop.Project.Commands.Clean" />
<CommandBinding command="SDBuildCommands.BuildProject" class="ICSharpCode.SharpDevelop.Project.Commands.BuildProject" gestures="F9" /> <CommandBinding command="SDBuildCommands.BuildProject" class="ICSharpCode.SharpDevelop.Project.Commands.BuildProject" gestures="F9" />
<CommandBinding command="SDBuildCommands.RebuildProject" class="ICSharpCode.SharpDevelop.Project.Commands.RebuildProject" gestures="Alt+F9" /> <CommandBinding command="SDBuildCommands.RebuildProject" class="ICSharpCode.SharpDevelop.Project.Commands.RebuildProject" gestures="Alt+F9" />
<CommandBinding command="SDBuildCommands.CleanProject" class="ICSharpCode.SharpDevelop.Project.Commands.CleanProject" /> <CommandBinding command="SDBuildCommands.CleanProject" class="ICSharpCode.SharpDevelop.Project.Commands.CleanProject" />
<CommandBinding command="SDBuildCommands.AbortBuild" class="ICSharpCode.SharpDevelop.Project.Commands.AbortBuild" /> <CommandBinding command="SDBuildCommands.AbortBuild" class="ICSharpCode.SharpDevelop.Project.Commands.AbortBuild" />
<CommandBinding command="SDBuildCommands.EditConfigurationsCommand" class="ICSharpCode.SharpDevelop.Project.Commands.EditConfigurationsCommand" /> <CommandBinding command="SDBuildCommands.EditConfigurationsCommand" class="ICSharpCode.SharpDevelop.Project.Commands.EditConfigurationsCommand" />
<CommandBinding command="SDProjectCommands.AddNewProjectToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddNewProjectToSolution" /> <CommandBinding command="SDProjectCommands.AddNewProjectToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddNewProjectToSolution" />
<CommandBinding command="SDProjectCommands.AddExitingProjectToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddExitingProjectToSolution" /> <CommandBinding command="SDProjectCommands.AddExitingProjectToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddExitingProjectToSolution" />
<CommandBinding command="SDProjectCommands.AddExistingItemToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddExistingItemToSolution" /> <CommandBinding command="SDProjectCommands.AddExistingItemToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddExistingItemToSolution" />
<CommandBinding command="SDProjectCommands.AddNewSolutionFolderToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddNewSolutionFolderToSolution" /> <CommandBinding command="SDProjectCommands.AddNewSolutionFolderToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddNewSolutionFolderToSolution" />
<CommandBinding command="SDDebugCommands.Execute" class="ICSharpCode.SharpDevelop.Project.Commands.Execute" gestures="F5" /> <CommandBinding command="SDDebugCommands.Execute" class="ICSharpCode.SharpDevelop.Project.Commands.Execute" gestures="F5" />
<CommandBinding command="SDDebugCommands.ExecuteWithoutDebugger" class="ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger" gestures="Ctrl+F5" /> <CommandBinding command="SDDebugCommands.ExecuteWithoutDebugger" class="ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger" gestures="Ctrl+F5" />
<CommandBinding command="SDDebugCommands.StopDebugging" class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand" /> <CommandBinding command="SDDebugCommands.StopDebugging" class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand" />
<CommandBinding command="SDDebugCommands.AttachToProcess" class="ICSharpCode.SharpDevelop.Project.Commands.AttachToProcessCommand" /> <CommandBinding command="SDDebugCommands.AttachToProcess" class="ICSharpCode.SharpDevelop.Project.Commands.AttachToProcessCommand" />
@ -128,15 +128,15 @@
<CommandBinding command="SDDebugCommands.StepInto" class="ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand" gestures="F11" /> <CommandBinding command="SDDebugCommands.StepInto" class="ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand" gestures="F11" />
<CommandBinding command="SDDebugCommands.StepOut" class="ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand" gestures="Shift+F11" /> <CommandBinding command="SDDebugCommands.StepOut" class="ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand" gestures="Shift+F11" />
<CommandBinding command="SDDebugCommands.ToggleBreakpoint" class="ICSharpCode.SharpDevelop.Project.Commands.ToggleBreakpointCommand" gestures="F7" /> <CommandBinding command="SDDebugCommands.ToggleBreakpoint" class="ICSharpCode.SharpDevelop.Project.Commands.ToggleBreakpointCommand" gestures="F7" />
<CommandBinding command="SDSearchCommands.ToggleBookmark" class="ICSharpCode.SharpDevelop.Bookmarks.ToggleBookmark" gestures="Ctrl+F2" /> <CommandBinding command="SDSearchCommands.ToggleBookmark" class="ICSharpCode.SharpDevelop.Bookmarks.ToggleBookmark" gestures="Ctrl+F2" />
<CommandBinding command="SDSearchCommands.PrevBookmark" class="ICSharpCode.SharpDevelop.Bookmarks.PrevBookmark" gestures="Alt+F2" /> <CommandBinding command="SDSearchCommands.PrevBookmark" class="ICSharpCode.SharpDevelop.Bookmarks.PrevBookmark" gestures="Alt+F2" />
<CommandBinding command="SDSearchCommands.NextBookmark" class="ICSharpCode.SharpDevelop.Bookmarks.NextBookmark" gestures="F2" /> <CommandBinding command="SDSearchCommands.NextBookmark" class="ICSharpCode.SharpDevelop.Bookmarks.NextBookmark" gestures="F2" />
<CommandBinding command="SDSearchCommands.ClearBookmarks" class="ICSharpCode.SharpDevelop.Bookmarks.ClearBookmarks" /> <CommandBinding command="SDSearchCommands.ClearBookmarks" class="ICSharpCode.SharpDevelop.Bookmarks.ClearBookmarks" />
<CommandBinding command="SDSearchCommands.GotoLineNumber" class="ICSharpCode.SharpDevelop.DefaultEditor.Commands.GotoLineNumber" gestures="Ctrl+G" /> <CommandBinding command="SDSearchCommands.GotoLineNumber" class="ICSharpCode.SharpDevelop.DefaultEditor.Commands.GotoLineNumber" gestures="Ctrl+G" />
<CommandBinding command="SDSearchCommands.GotoBrace" class="ICSharpCode.SharpDevelop.DefaultEditor.Commands.GotoMatchingBrace" gestures="Ctrl+B" /> <CommandBinding command="SDSearchCommands.GotoBrace" class="ICSharpCode.SharpDevelop.DefaultEditor.Commands.GotoMatchingBrace" gestures="Ctrl+B" />
</Path> </Path>
<Path name="/SharpDevelop/Workbench/InputBindings"> <Path name="/SharpDevelop/Workbench/InputBindings">
@ -227,7 +227,7 @@
category = "Tools" category = "Tools"
title = "${res:MainWindow.Windows.SearchResultsLabel}" title = "${res:MainWindow.Windows.SearchResultsLabel}"
icon = "PadIcons.FindResults" icon = "PadIcons.FindResults"
class = "SearchAndReplace.SearchResultPanel" class = "ICSharpCode.SharpDevelop.Gui.SearchResultPad"
defaultPosition = "Bottom, Hidden" /> defaultPosition = "Bottom, Hidden" />
<Pad id = "Bookmarks" <Pad id = "Bookmarks"
@ -284,7 +284,7 @@
<ToolbarItem id = "Refresh" <ToolbarItem id = "Refresh"
icon = "ProjectBrowser.Toolbar.Refresh" icon = "ProjectBrowser.Toolbar.Refresh"
tooltip = "${res:AddIns.HtmlHelp2.Refresh}" tooltip = "${res:AddIns.HtmlHelp2.Refresh}"
class = "ICSharpCode.SharpDevelop.Project.Commands.RefreshProjectBrowser" class = "ICSharpCode.SharpDevelop.Project.Commands.RefreshProjectBrowser"
command = "SDProjectCommands.RefreshProjectBrowser" /> command = "SDProjectCommands.RefreshProjectBrowser" />
</Condition> </Condition>
</Path> </Path>
@ -587,7 +587,7 @@
icon = "Icons.16x16.PasteIcon" icon = "Icons.16x16.PasteIcon"
loadclasslazy = "false" loadclasslazy = "false"
class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode" class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode"
/> />
<MenuItem id = "Remove" <MenuItem id = "Remove"
label = "${res:Global.RemoveButtonText}" label = "${res:Global.RemoveButtonText}"
type = "Item" type = "Item"
@ -979,7 +979,7 @@
icon = "Icons.16x16.RunProgramIcon" icon = "Icons.16x16.RunProgramIcon"
tooltip = "${res:XML.MainMenu.RunMenu.Run.Description}" tooltip = "${res:XML.MainMenu.RunMenu.Run.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.Execute" class = "ICSharpCode.SharpDevelop.Project.Commands.Execute"
/> />
</Condition> </Condition>
<Condition name="DebuggerSupports" debuggersupports = "StartWithoutDebugging"> <Condition name="DebuggerSupports" debuggersupports = "StartWithoutDebugging">
@ -987,7 +987,7 @@
icon = "Icons.16x16.Debug.StartWithoutDebugging" icon = "Icons.16x16.Debug.StartWithoutDebugging"
tooltip = "${res:XML.MainMenu.DebugMenu.RunWithoutDebug.Description}" tooltip = "${res:XML.MainMenu.DebugMenu.RunWithoutDebug.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger" class = "ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger"
/> />
</Condition> </Condition>
</Condition> </Condition>
</Condition> </Condition>
@ -1526,7 +1526,7 @@
command = "SDBuildCommands.RebuildProject" /> command = "SDBuildCommands.RebuildProject" />
<MenuItem id = "Clean project" <MenuItem id = "Clean project"
label = "${res:XML.MainMenu.BuildMenu.CleanProject}" label = "${res:XML.MainMenu.BuildMenu.CleanProject}"
class = "ICSharpCode.SharpDevelop.Project.Commands.CleanProject" class = "ICSharpCode.SharpDevelop.Project.Commands.CleanProject"
command = "SDBuildCommands.CleanProject" /> command = "SDBuildCommands.CleanProject" />
<!--<MenuItem id = "Publish project" <!--<MenuItem id = "Publish project"
label = "${res:XML.MainMenu.BuildMenu.PublishProject}" label = "${res:XML.MainMenu.BuildMenu.PublishProject}"
@ -1543,16 +1543,16 @@
<MenuItem id = "SetConfiguration" <MenuItem id = "SetConfiguration"
label = "${res:XML.MainMenu.BuildMenu.SetConfiguration}" label = "${res:XML.MainMenu.BuildMenu.SetConfiguration}"
type = "Menu"> type = "Menu">
<MenuItem id = "ConfigurationBuilder" <MenuItem id = "ConfigurationBuilder"
type = "Builder" type = "Builder"
class = "ICSharpCode.SharpDevelop.Project.Commands.SetConfigurationMenuBuilder" /> class = "ICSharpCode.SharpDevelop.Project.Commands.SetConfigurationMenuBuilder" />
</MenuItem> </MenuItem>
<MenuItem id = "SetPlatform" <MenuItem id = "SetPlatform"
label = "${res:XML.MainMenu.BuildMenu.SetPlatform}" label = "${res:XML.MainMenu.BuildMenu.SetPlatform}"
type = "Menu"> type = "Menu">
<MenuItem <MenuItem
id = "PlatformBuilder" id = "PlatformBuilder"
type = "Builder" type = "Builder"
class = "ICSharpCode.SharpDevelop.Project.Commands.SetPlatformMenuBuilder" /> class = "ICSharpCode.SharpDevelop.Project.Commands.SetPlatformMenuBuilder" />
</MenuItem> </MenuItem>
<MenuItem id = "EditConfigurations" <MenuItem id = "EditConfigurations"
@ -1596,7 +1596,7 @@
label = "${res:XML.MainMenu.DebugMenu.Stop}" label = "${res:XML.MainMenu.DebugMenu.Stop}"
icon = "Icons.16x16.StopProcess" icon = "Icons.16x16.StopProcess"
class = "ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand" class = "ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
command = "SDDebugCommands.StopDebugging" /> command = "SDDebugCommands.StopDebugging" />
</Condition> </Condition>
</Condition> </Condition>
@ -1605,7 +1605,7 @@
<MenuItem id = "Attach" <MenuItem id = "Attach"
label = "${res:XML.MainMenu.DebugMenu.Attach}" label = "${res:XML.MainMenu.DebugMenu.Attach}"
class = "ICSharpCode.SharpDevelop.Project.Commands.AttachToProcessCommand" class = "ICSharpCode.SharpDevelop.Project.Commands.AttachToProcessCommand"
command = "SDDebugCommands.AttachToProcess" /> command = "SDDebugCommands.AttachToProcess" />
</Condition> </Condition>
</Condition> </Condition>
@ -1614,7 +1614,7 @@
<MenuItem id = "Detach" <MenuItem id = "Detach"
label = "${res:XML.MainMenu.DebugMenu.Detach}" label = "${res:XML.MainMenu.DebugMenu.Detach}"
class = "ICSharpCode.SharpDevelop.Project.Commands.DetachFromProcessCommand" class = "ICSharpCode.SharpDevelop.Project.Commands.DetachFromProcessCommand"
command = "SDDebugCommands.DetachFromProcess" /> command = "SDDebugCommands.DetachFromProcess" />
</Condition> </Condition>
</Condition> </Condition>
@ -1626,7 +1626,7 @@
icon = "Icons.16x16.Debug.Break" icon = "Icons.16x16.Debug.Break"
shortcut = "Ctrl+Alt+B" shortcut = "Ctrl+Alt+B"
class = "ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand" class = "ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand"
command = "SDDebugCommands.BreakDebugging" /> command = "SDDebugCommands.BreakDebugging" />
</Condition> </Condition>
<Condition name="IsProcessRunning" isprocessrunning = "False" isdebugging = "True" action = "Disable"> <Condition name="IsProcessRunning" isprocessrunning = "False" isdebugging = "True" action = "Disable">
<MenuItem id = "Continue" <MenuItem id = "Continue"
@ -1634,7 +1634,7 @@
icon = "Icons.16x16.Debug.Continue" icon = "Icons.16x16.Debug.Continue"
shortcut = "F6" shortcut = "F6"
class = "ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand" class = "ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand"
command = "SDDebugCommands.ContinueDebugging" /> command = "SDDebugCommands.ContinueDebugging" />
</Condition> </Condition>
</Condition> </Condition>
@ -1646,19 +1646,19 @@
icon = "Icons.16x16.Debug.StepOver" icon = "Icons.16x16.Debug.StepOver"
shortcut = "F10" shortcut = "F10"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand" class = "ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand"
command = "SDDebugCommands.StepOver" /> command = "SDDebugCommands.StepOver" />
<MenuItem id = "Step into" <MenuItem id = "Step into"
label = "${res:XML.MainMenu.DebugMenu.StepInto}" label = "${res:XML.MainMenu.DebugMenu.StepInto}"
icon = "Icons.16x16.Debug.StepInto" icon = "Icons.16x16.Debug.StepInto"
shortcut = "F11" shortcut = "F11"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand" class = "ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand"
command = "SDDebugCommands.StepInto" /> command = "SDDebugCommands.StepInto" />
<MenuItem id = "Step out" <MenuItem id = "Step out"
label = "${res:XML.MainMenu.DebugMenu.StepOut}" label = "${res:XML.MainMenu.DebugMenu.StepOut}"
icon = "Icons.16x16.Debug.StepOut" icon = "Icons.16x16.Debug.StepOut"
shortcut = "Shift|F11" shortcut = "Shift|F11"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand" class = "ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand"
command = "SDDebugCommands.StepOut" /> command = "SDDebugCommands.StepOut" />
</Condition> </Condition>
</Condition> </Condition>
@ -1950,8 +1950,8 @@
<MenuItem id = "SearchIncremental" <MenuItem id = "SearchIncremental"
label = "${res:XML.MainMenu.SearchMenu.IncrementalSearch}" label = "${res:XML.MainMenu.SearchMenu.IncrementalSearch}"
shortcut = "Ctrl+E" shortcut = "Ctrl+E"
class = "ICSharpCode.SharpDevelop.DefaultEditor.Commands.RunIncrementalSearch" class = "ICSharpCode.SharpDevelop.DefaultEditor.Commands.RunIncrementalSearch"
/> />
<MenuItem id = "SearchReverseIncremental" <MenuItem id = "SearchReverseIncremental"
label = "${res:XML.MainMenu.SearchMenu.ReverseIncrementalSearch}" label = "${res:XML.MainMenu.SearchMenu.ReverseIncrementalSearch}"
shortcut = "Ctrl+Shift+E" shortcut = "Ctrl+Shift+E"
@ -2185,6 +2185,20 @@
class = "ICSharpCode.SharpDevelop.Bookmarks.DeleteAllMarks"/> class = "ICSharpCode.SharpDevelop.Bookmarks.DeleteAllMarks"/>
</Path> </Path>
<Path name = "/SharpDevelop/Pads/SearchResultPad/Toolbar">
<ToolbarItem id = "ShowLast"
type = "DropDownButton"
icon = "Icons.16x16.FindIcon"
tooltip = "${res:MainWindow.Windows.SearchResultPanel.ShowLast.ToolTip}">
<MenuItem id="RecentList" type="Builder" class="ICSharpCode.SharpDevelop.Gui.LastSearchResultsBuilder"/>
<MenuItem id="Separator" type="Separator"/>
<MenuItem id="ClearRecentList"
type="Item"
label="${res:MainWindow.Windows.SearchResultPanel.ClearHistory}"
class="ICSharpCode.SharpDevelop.Gui.ClearSearchResultsList" />
</ToolbarItem>
</Path>
<Path name = "/SharpDevelop/Pads/SearchResultPanel/Toolbar"> <Path name = "/SharpDevelop/Pads/SearchResultPanel/Toolbar">
<Condition name = "Ownerstate" ownerstate = "DefaultMode" action = "Exclude"> <Condition name = "Ownerstate" ownerstate = "DefaultMode" action = "Exclude">
<ToolbarItem id = "ExpandAll" <ToolbarItem id = "ExpandAll"

3
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -157,13 +157,16 @@
</Compile> </Compile>
<Compile Include="Src\Gui\IImage.cs" /> <Compile Include="Src\Gui\IImage.cs" />
<Compile Include="Src\Gui\Pads\ProjectBrowser\TreeNodes\DirectoryNodeFactory.cs" /> <Compile Include="Src\Gui\Pads\ProjectBrowser\TreeNodes\DirectoryNodeFactory.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\ISearchResult.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\Nodes\SearchFolderNode.cs" /> <Compile Include="Src\Gui\Pads\SearchResultPad\Nodes\SearchFolderNode.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\Nodes\SearchResultNode.cs" /> <Compile Include="Src\Gui\Pads\SearchResultPad\Nodes\SearchResultNode.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\Nodes\SearchRootNode.cs" /> <Compile Include="Src\Gui\Pads\SearchResultPad\Nodes\SearchRootNode.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\ProvidedDocumentInformation.cs" /> <Compile Include="Src\Gui\Pads\SearchResultPad\ProvidedDocumentInformation.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\SearchResult.cs" /> <Compile Include="Src\Gui\Pads\SearchResultPad\SearchResult.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\SearchResultMatch.cs" /> <Compile Include="Src\Gui\Pads\SearchResultPad\SearchResultMatch.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\SearchResultPadToolbarCommands.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\SearchResultPanel.cs" /> <Compile Include="Src\Gui\Pads\SearchResultPad\SearchResultPanel.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\SearchResultPad.cs" />
<Compile Include="Src\Gui\Pads\SearchResultPad\SearchResultPanelToolbarCommands.cs" /> <Compile Include="Src\Gui\Pads\SearchResultPad\SearchResultPanelToolbarCommands.cs" />
<Compile Include="Src\Gui\Pads\TaskList\TaskListPadCommands.cs" /> <Compile Include="Src\Gui\Pads\TaskList\TaskListPadCommands.cs" />
<Compile Include="Src\Gui\Pads\ToolsPad.cs" /> <Compile Include="Src\Gui\Pads\ToolsPad.cs" />

32
src/Main/Base/Project/Src/Gui/Pads/SearchResultPad/ISearchResult.cs

@ -0,0 +1,32 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
namespace ICSharpCode.SharpDevelop.Gui
{
/// <summary>
/// Represents the content of the search results pad.
/// </summary>
public interface ISearchResult
{
/// <summary>
/// Gets the title of the search result.
/// </summary>
string Text { get; }
/// <summary>
/// Retrieves the UI Element for displaying the search results.
/// It is valid to create a new UI Element on each call or to reuse an existing one.
///
/// This method will only be called on the active search result in the 'Search Results' pad, so
/// it is valid to use a control for multiple search result instances and exchange that control's data when
/// this method is called.
/// </summary>
object GetControl();
}
}

82
src/Main/Base/Project/Src/Gui/Pads/SearchResultPad/SearchResultPad.cs

@ -0,0 +1,82 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.Core.Presentation;
using System;
using System.Collections.Generic;
using System.Windows.Controls;
namespace ICSharpCode.SharpDevelop.Gui
{
/// <summary>
/// Pad that displays search results.
/// </summary>
public class SearchResultPad : AbstractPadContent
{
static SearchResultPad instance;
public static SearchResultPad Instance {
get {
if (instance == null) {
WorkbenchSingleton.Workbench.GetPad(typeof(SearchResultPad)).CreatePad();
}
return instance;
}
}
DockPanel dockPanel;
ToolBar toolBar;
ContentControl contentPlaceholder;
public SearchResultPad()
{
if (instance != null)
throw new InvalidOperationException("Cannot create multiple instances");
instance = this;
toolBar = ToolBarService.CreateToolBar(this, "/SharpDevelop/Pads/SearchResultPad/Toolbar");
DockPanel.SetDock(toolBar, Dock.Top);
contentPlaceholder = new ContentControl();
dockPanel = new DockPanel {
Children = { toolBar, contentPlaceholder }
};
}
public override object Control {
get {
return dockPanel;
}
}
List<ISearchResult> lastSearches = new List<ISearchResult>();
public IEnumerable<ISearchResult> LastSearches {
get { return lastSearches; }
}
public void ClearLastSearchesList()
{
lastSearches.Clear();
}
public void ShowSearchResults(ISearchResult result)
{
if (result == null)
throw new ArgumentNullException("result");
// move result to top of last searches
lastSearches.Remove(result);
lastSearches.Insert(0, result);
contentPlaceholder.SetContent(result.GetControl());
SearchResultsShown.RaiseEvent(this, EventArgs.Empty);
}
public event EventHandler SearchResultsShown;
}
}

42
src/Main/Base/Project/Src/Gui/Pads/SearchResultPad/SearchResultPadToolbarCommands.cs

@ -0,0 +1,42 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using ICSharpCode.Core;
using ICSharpCode.Core.Presentation;
using System.Windows.Controls;
namespace ICSharpCode.SharpDevelop.Gui
{
public class LastSearchResultsBuilder : IMenuItemBuilder
{
public ICollection BuildItems(Codon codon, object owner)
{
List<object> items = new List<object>();
foreach (ISearchResult searchResult in SearchResultPad.Instance.LastSearches) {
MenuItem menuItem = new MenuItem();
menuItem.Header = searchResult.Text;
// copy in local variable so that lambda refers to correct loop iteration
ISearchResult searchResultCopy = searchResult;
menuItem.Click += (sender, e) => SearchResultPad.Instance.ShowSearchResults(searchResultCopy);
items.Add(menuItem);
}
return items;
}
}
public class ClearSearchResultsList : AbstractMenuCommand
{
public override void Run()
{
SearchResultPad.Instance.ClearLastSearchesList();
}
}
}

43
src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs

@ -91,18 +91,18 @@ namespace ICSharpCode.SharpDevelop.Gui
// Register context and load all commands from addin // Register context and load all commands from addin
CommandsRegistry.LoadAddinCommands(AddInTree.AddIns.FirstOrDefault(a => a.Name == "SharpDevelop")); CommandsRegistry.LoadAddinCommands(AddInTree.AddIns.FirstOrDefault(a => a.Name == "SharpDevelop"));
CommandsRegistry.RegisterCommandBindingsUpdateHandler(CommandsRegistry.DefaultContext, delegate { CommandsRegistry.RegisterCommandBindingsUpdateHandler(CommandsRegistry.DefaultContext, delegate {
var bindings = CommandsRegistry.GetCommandBindings(CommandsRegistry.DefaultContext, null, null); var bindings = CommandsRegistry.GetCommandBindings(CommandsRegistry.DefaultContext, null, null);
CommandsRegistry.RemoveManagedCommandBindings(CommandBindings); CommandsRegistry.RemoveManagedCommandBindings(CommandBindings);
CommandBindings.AddRange(bindings); CommandBindings.AddRange(bindings);
}); });
CommandsRegistry.RegisterInputBindingUpdateHandler(CommandsRegistry.DefaultContext, delegate { CommandsRegistry.RegisterInputBindingUpdateHandler(CommandsRegistry.DefaultContext, delegate {
var bindings = CommandsRegistry.GetInputBindings(CommandsRegistry.DefaultContext, null, null); var bindings = CommandsRegistry.GetInputBindings(CommandsRegistry.DefaultContext, null, null);
CommandsRegistry.RemoveManagedInputBindings(InputBindings); CommandsRegistry.RemoveManagedInputBindings(InputBindings);
InputBindings.AddRange(bindings); InputBindings.AddRange(bindings);
}); });
CommandsRegistry.InvokeCommandBindingUpdateHandlers(CommandsRegistry.DefaultContext); CommandsRegistry.InvokeCommandBindingUpdateHandlers(CommandsRegistry.DefaultContext);
CommandsRegistry.InvokeInputBindingUpdateHandlers(CommandsRegistry.DefaultContext); CommandsRegistry.InvokeInputBindingUpdateHandlers(CommandsRegistry.DefaultContext);
@ -159,12 +159,14 @@ namespace ICSharpCode.SharpDevelop.Gui
public ICollection<IViewContent> ViewContentCollection { public ICollection<IViewContent> ViewContentCollection {
get { get {
WorkbenchSingleton.AssertMainThread();
return WorkbenchWindowCollection.SelectMany(w => w.ViewContents).ToList().AsReadOnly(); return WorkbenchWindowCollection.SelectMany(w => w.ViewContents).ToList().AsReadOnly();
} }
} }
public ICollection<IViewContent> PrimaryViewContents { public ICollection<IViewContent> PrimaryViewContents {
get { get {
WorkbenchSingleton.AssertMainThread();
return (from window in WorkbenchWindowCollection return (from window in WorkbenchWindowCollection
where window.ViewContents.Count > 0 where window.ViewContents.Count > 0
select window.ViewContents[0] select window.ViewContents[0]
@ -174,6 +176,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public IList<IWorkbenchWindow> WorkbenchWindowCollection { public IList<IWorkbenchWindow> WorkbenchWindowCollection {
get { get {
WorkbenchSingleton.AssertMainThread();
if (workbenchLayout != null) if (workbenchLayout != null)
return workbenchLayout.WorkbenchWindows; return workbenchLayout.WorkbenchWindows;
else else
@ -183,6 +186,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public IList<PadDescriptor> PadContentCollection { public IList<PadDescriptor> PadContentCollection {
get { get {
WorkbenchSingleton.AssertMainThread();
return padDescriptorCollection.AsReadOnly(); return padDescriptorCollection.AsReadOnly();
} }
} }
@ -191,6 +195,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public IWorkbenchWindow ActiveWorkbenchWindow { public IWorkbenchWindow ActiveWorkbenchWindow {
get { get {
WorkbenchSingleton.AssertMainThread();
return activeWorkbenchWindow; return activeWorkbenchWindow;
} }
private set { private set {
@ -245,7 +250,10 @@ namespace ICSharpCode.SharpDevelop.Gui
IViewContent activeViewContent; IViewContent activeViewContent;
public IViewContent ActiveViewContent { public IViewContent ActiveViewContent {
get { return activeViewContent; } get {
WorkbenchSingleton.AssertMainThread();
return activeViewContent;
}
private set { private set {
if (activeViewContent != value) { if (activeViewContent != value) {
activeViewContent = value; activeViewContent = value;
@ -260,7 +268,10 @@ namespace ICSharpCode.SharpDevelop.Gui
object activeContent; object activeContent;
public object ActiveContent { public object ActiveContent {
get { return activeContent; } get {
WorkbenchSingleton.AssertMainThread();
return activeContent;
}
private set { private set {
if (activeContent != value) { if (activeContent != value) {
activeContent = value; activeContent = value;
@ -279,6 +290,8 @@ namespace ICSharpCode.SharpDevelop.Gui
return workbenchLayout; return workbenchLayout;
} }
set { set {
WorkbenchSingleton.AssertMainThread();
if (workbenchLayout != null) { if (workbenchLayout != null) {
workbenchLayout.ActiveContentChanged -= OnActiveWindowChanged; workbenchLayout.ActiveContentChanged -= OnActiveWindowChanged;
workbenchLayout.Detach(); workbenchLayout.Detach();
@ -305,6 +318,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public void ShowView(IViewContent content, bool switchToOpenedView) public void ShowView(IViewContent content, bool switchToOpenedView)
{ {
WorkbenchSingleton.AssertMainThread();
if (content == null) if (content == null)
throw new ArgumentNullException("content"); throw new ArgumentNullException("content");
System.Diagnostics.Debug.Assert(WorkbenchLayout != null); System.Diagnostics.Debug.Assert(WorkbenchLayout != null);
@ -319,6 +333,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public void ShowPad(PadDescriptor content) public void ShowPad(PadDescriptor content)
{ {
WorkbenchSingleton.AssertMainThread();
if (content == null) if (content == null)
throw new ArgumentNullException("content"); throw new ArgumentNullException("content");
if (padDescriptorCollection.Contains(content)) if (padDescriptorCollection.Contains(content))
@ -337,6 +352,9 @@ namespace ICSharpCode.SharpDevelop.Gui
public PadDescriptor GetPad(Type type) public PadDescriptor GetPad(Type type)
{ {
WorkbenchSingleton.AssertMainThread();
if (type == null)
throw new ArgumentNullException("type");
foreach (PadDescriptor pad in PadContentCollection) { foreach (PadDescriptor pad in PadContentCollection) {
if (pad.Class == type.FullName) { if (pad.Class == type.FullName) {
return pad; return pad;
@ -352,6 +370,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public void CloseAllViews() public void CloseAllViews()
{ {
WorkbenchSingleton.AssertMainThread();
try { try {
closeAll = true; closeAll = true;
foreach (IWorkbenchWindow window in this.WorkbenchWindowCollection.ToArray()) { foreach (IWorkbenchWindow window in this.WorkbenchWindowCollection.ToArray()) {

71
src/Main/ICSharpCode.Core.Presentation/DropDownButton.cs

@ -0,0 +1,71 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace ICSharpCode.Core.Presentation
{
/// <summary>
/// A button that opens a drop-down menu when clicked.
/// </summary>
public class DropDownButton : ButtonBase
{
public static readonly DependencyProperty DropDownMenuProperty
= DependencyProperty.Register("DropDownMenu", typeof(ContextMenu),
typeof(DropDownButton), new FrameworkPropertyMetadata(null));
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
protected static readonly DependencyPropertyKey IsDropDownMenuOpenPropertyKey
= DependencyProperty.RegisterReadOnly("IsDropDownMenuOpen", typeof(bool),
typeof(DropDownButton), new FrameworkPropertyMetadata(false));
public static readonly DependencyProperty IsDropDownMenuOpenProperty = IsDropDownMenuOpenPropertyKey.DependencyProperty;
static DropDownButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(DropDownButton), new FrameworkPropertyMetadata(typeof(DropDownButton)));
}
public ContextMenu DropDownMenu {
get { return (ContextMenu)GetValue(DropDownMenuProperty); }
set { SetValue(DropDownMenuProperty, value); }
}
public bool IsDropDownMenuOpen {
get { return (bool)GetValue(IsDropDownMenuOpenProperty); }
protected set { SetValue(IsDropDownMenuOpenPropertyKey, value); }
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
if (DropDownMenu != null && !IsDropDownMenuOpen) {
DropDownMenu.Placement = PlacementMode.Bottom;
DropDownMenu.PlacementTarget = this;
DropDownMenu.IsOpen = true;
DropDownMenu.Closed += DropDownMenu_Closed;
this.IsDropDownMenuOpen = true;
}
}
void DropDownMenu_Closed(object sender, RoutedEventArgs e)
{
((ContextMenu)sender).Closed -= DropDownMenu_Closed;
this.IsDropDownMenuOpen = false;
}
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
if (!IsMouseCaptured) {
e.Handled = true;
}
}
}
}

7
src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj

@ -6,7 +6,7 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.Core.Presentation</RootNamespace> <RootNamespace>ICSharpCode.Core.Presentation</RootNamespace>
<AssemblyName>ICSharpCode.Core.Presentation</AssemblyName> <AssemblyName>ICSharpCode.Core.Presentation</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<SourceAnalysisOverrideSettingsFile>"C:\Program Files\SharpDevelop\3.0\bin\..\AddIns\AddIns\Misc\SourceAnalysis\Settings.SourceAnalysis"</SourceAnalysisOverrideSettingsFile> <SourceAnalysisOverrideSettingsFile>"C:\Program Files\SharpDevelop\3.0\bin\..\AddIns\AddIns\Misc\SourceAnalysis\Settings.SourceAnalysis"</SourceAnalysisOverrideSettingsFile>
<OutputPath>..\..\..\bin\</OutputPath> <OutputPath>..\..\..\bin\</OutputPath>
@ -51,6 +51,9 @@
<RequiredTargetFramework>3.0</RequiredTargetFramework> <RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
@ -74,6 +77,7 @@
<Compile Include="CommandsService\ManagedInputBinding.cs" /> <Compile Include="CommandsService\ManagedInputBinding.cs" />
<Compile Include="CommandsService\WpfCommandWrapper.cs" /> <Compile Include="CommandsService\WpfCommandWrapper.cs" />
<Compile Include="ConditionalSeparator.cs" /> <Compile Include="ConditionalSeparator.cs" />
<Compile Include="DropDownButton.cs" />
<Compile Include="GetBitmapExtension.cs" /> <Compile Include="GetBitmapExtension.cs" />
<Compile Include="IStatusUpdate.cs" /> <Compile Include="IStatusUpdate.cs" />
<Compile Include="LocalizeExtension.cs" /> <Compile Include="LocalizeExtension.cs" />
@ -88,6 +92,7 @@
<Compile Include="SplitButton.cs" /> <Compile Include="SplitButton.cs" />
<Compile Include="ToolBar\ToolBarButton.cs" /> <Compile Include="ToolBar\ToolBarButton.cs" />
<Compile Include="ToolBar\ToolBarComboBox.cs" /> <Compile Include="ToolBar\ToolBarComboBox.cs" />
<Compile Include="ToolBar\ToolBarDropDownButton.cs" />
<Compile Include="ToolBar\ToolBarService.cs" /> <Compile Include="ToolBar\ToolBarService.cs" />
<Compile Include="ToolBar\ToolBarSplitButton.cs" /> <Compile Include="ToolBar\ToolBarSplitButton.cs" />
<CodeAnalysisDictionary Include="Properties\CodeAnalysisDictionary.xml" /> <CodeAnalysisDictionary Include="Properties\CodeAnalysisDictionary.xml" />

8
src/Main/ICSharpCode.Core.Presentation/Menu/MenuService.cs

@ -94,7 +94,7 @@ namespace ICSharpCode.Core.Presentation
public static IList CreateMenuItems(UIElement inputBindingOwner, object owner, string addInTreePath) public static IList CreateMenuItems(UIElement inputBindingOwner, object owner, string addInTreePath)
{ {
return CreateMenuItems(inputBindingOwner, AddInTree.BuildItems<MenuItemDescriptor>(addInTreePath, owner, false)); return ExpandMenuBuilders(CreateUnexpandedMenuItems(inputBindingOwner, AddInTree.BuildItems<MenuItemDescriptor>(addInTreePath, owner, false)));
} }
sealed class MenuItemBuilderPlaceholder sealed class MenuItemBuilderPlaceholder
@ -116,7 +116,7 @@ namespace ICSharpCode.Core.Presentation
} }
} }
internal static IList CreateMenuItems(UIElement inputBindingOwner, IEnumerable descriptors) internal static IList CreateUnexpandedMenuItems(UIElement inputBindingOwner, IEnumerable descriptors)
{ {
ArrayList result = new ArrayList(); ArrayList result = new ArrayList();
if (descriptors != null) { if (descriptors != null) {
@ -124,7 +124,7 @@ namespace ICSharpCode.Core.Presentation
result.Add(CreateMenuItemFromDescriptor(inputBindingOwner, descriptor)); result.Add(CreateMenuItemFromDescriptor(inputBindingOwner, descriptor));
} }
} }
return ExpandMenuBuilders(result); return result;
} }
static IList ExpandMenuBuilders(ICollection input) static IList ExpandMenuBuilders(ICollection input)
@ -167,7 +167,7 @@ namespace ICSharpCode.Core.Presentation
var item = new CoreMenuItem(codon, descriptor.Caller) { var item = new CoreMenuItem(codon, descriptor.Caller) {
ItemsSource = new object[1] ItemsSource = new object[1]
}; };
var subItems = CreateMenuItems(inputBindingOwner, descriptor.SubItems); var subItems = CreateUnexpandedMenuItems(inputBindingOwner, descriptor.SubItems);
item.SubmenuOpened += (sender, args) => { item.SubmenuOpened += (sender, args) => {
item.ItemsSource = ExpandMenuBuilders(subItems); item.ItemsSource = ExpandMenuBuilders(subItems);
args.Handled = true; args.Handled = true;

19
src/Main/ICSharpCode.Core.Presentation/SplitButton.cs

@ -16,13 +16,12 @@ using System.Windows.Shapes;
namespace ICSharpCode.Core.Presentation namespace ICSharpCode.Core.Presentation
{ {
/// <summary> /// <summary>
/// A button with drop-down menu. /// A button that is split into two parts: the left part works like a normal button, the right part opens a drop-down menu when it is clicked.
/// </summary> /// </summary>
public class SplitButton : ButtonBase public class SplitButton : ButtonBase
{ {
public static readonly DependencyProperty DropDownMenuProperty public static readonly DependencyProperty DropDownMenuProperty
= DependencyProperty.Register("DropDownMenu", typeof(ContextMenu), = DropDownButton.DropDownMenuProperty.AddOwner(typeof(SplitButton));
typeof(SplitButton), new FrameworkPropertyMetadata(null));
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
protected static readonly DependencyPropertyKey IsDropDownMenuOpenPropertyKey protected static readonly DependencyPropertyKey IsDropDownMenuOpenPropertyKey
@ -46,24 +45,24 @@ namespace ICSharpCode.Core.Presentation
protected set { SetValue(IsDropDownMenuOpenPropertyKey, value); } protected set { SetValue(IsDropDownMenuOpenPropertyKey, value); }
} }
FrameworkElement dropDownButton; FrameworkElement dropDownArrow;
public override void OnApplyTemplate() public override void OnApplyTemplate()
{ {
base.OnApplyTemplate(); base.OnApplyTemplate();
dropDownButton = (FrameworkElement)Template.FindName("PART_DropDownButton", this); dropDownArrow = (FrameworkElement)Template.FindName("PART_DropDownArrow", this);
} }
bool IsOverDropDownButton(MouseEventArgs e) bool IsOverDropDownArrow(MouseEventArgs e)
{ {
if (dropDownButton == null) if (dropDownArrow == null)
return false; return false;
return e.GetPosition(dropDownButton).X >= 0; return e.GetPosition(dropDownArrow).X >= 0;
} }
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{ {
if (IsOverDropDownButton(e)) { if (IsOverDropDownArrow(e)) {
e.Handled = true; e.Handled = true;
if (DropDownMenu != null) { if (DropDownMenu != null) {
DropDownMenu.Placement = PlacementMode.Bottom; DropDownMenu.Placement = PlacementMode.Bottom;
@ -85,7 +84,7 @@ namespace ICSharpCode.Core.Presentation
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{ {
if (!IsMouseCaptured && IsOverDropDownButton(e)) { if (!IsMouseCaptured && IsOverDropDownArrow(e)) {
e.Handled = true; e.Handled = true;
} else { } else {
base.OnMouseLeftButtonUp(e); base.OnMouseLeftButtonUp(e);

5
src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarButton.cs

@ -38,6 +38,8 @@ namespace ICSharpCode.Core.Presentation
image.Height = 16; image.Height = 16;
image.SetResourceReference(StyleProperty, ToolBarService.ImageStyleKey); image.SetResourceReference(StyleProperty, ToolBarService.ImageStyleKey);
this.Content = new PixelSnapper(image); this.Content = new PixelSnapper(image);
} else {
this.Content = codon.Id;
} }
UpdateText(); UpdateText();
@ -46,9 +48,6 @@ namespace ICSharpCode.Core.Presentation
public void UpdateText() public void UpdateText()
{ {
if (codon.Properties.Contains("label")){
this.Content = StringParser.Parse(codon.Properties["label"]);
}
if (codon.Properties.Contains("tooltip")) { if (codon.Properties.Contains("tooltip")) {
this.ToolTip = StringParser.Parse(codon.Properties["tooltip"]); this.ToolTip = StringParser.Parse(codon.Properties["tooltip"]);
} }

58
src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarDropDownButton.cs

@ -0,0 +1,58 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
using System.Windows;
using System.Windows.Controls;
namespace ICSharpCode.Core.Presentation
{
/// <summary>
/// A tool bar button that opens a drop down menu.
/// </summary>
sealed class ToolBarDropDownButton : DropDownButton, IStatusUpdate
{
readonly Codon codon;
readonly object caller;
public ToolBarDropDownButton(Codon codon, object caller, IList subMenu)
{
ToolTipService.SetShowOnDisabled(this, true);
this.codon = codon;
this.caller = caller;
if (codon.Properties.Contains("icon")) {
var image = PresentationResourceService.GetImage(StringParser.Parse(codon.Properties["icon"]));
image.Height = 16;
image.SetResourceReference(StyleProperty, ToolBarService.ImageStyleKey);
this.Content = new PixelSnapper(image);
} else {
this.Content = codon.Id;
}
this.DropDownMenu = MenuService.CreateContextMenu(subMenu);
UpdateText();
}
public void UpdateText()
{
if (codon.Properties.Contains("tooltip")) {
this.ToolTip = StringParser.Parse(codon.Properties["tooltip"]);
}
}
public void UpdateStatus()
{
if (codon.GetFailedAction(caller) == ConditionFailedAction.Exclude)
this.Visibility = Visibility.Collapsed;
else
this.Visibility = Visibility.Visible;
}
}
}

6
src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarService.cs

@ -72,10 +72,9 @@ namespace ICSharpCode.Core.Presentation
return "Label"; return "Label";
//return new ToolBarLabel(codon, caller); //return new ToolBarLabel(codon, caller);
case "DropDownButton": case "DropDownButton":
return "DropDownButton"; return new ToolBarDropDownButton(codon, caller, MenuService.CreateUnexpandedMenuItems(null, descriptor.SubItems));
//return new ToolBarDropDownButton(codon, caller, MenuService.CreateMenuItems(descriptor.SubItems));
case "SplitButton": case "SplitButton":
return new ToolBarSplitButton(codon, caller, MenuService.CreateMenuItems(null, descriptor.SubItems)); return new ToolBarSplitButton(codon, caller, MenuService.CreateUnexpandedMenuItems(null, descriptor.SubItems));
case "Builder": case "Builder":
return codon.AddIn.CreateObject(codon.Properties["class"]); return codon.AddIn.CreateObject(codon.Properties["class"]);
default: default:
@ -86,6 +85,7 @@ namespace ICSharpCode.Core.Presentation
static ToolBar CreateToolBar(object owner, AddInTreeNode treeNode) static ToolBar CreateToolBar(object owner, AddInTreeNode treeNode)
{ {
ToolBar tb = new ToolBar(); ToolBar tb = new ToolBar();
ToolBarTray.SetIsLocked(tb, true);
tb.ItemsSource = CreateToolBarItems(treeNode.BuildChildItems<ToolbarItemDescriptor>(owner)); tb.ItemsSource = CreateToolBarItems(treeNode.BuildChildItems<ToolbarItemDescriptor>(owner));
UpdateStatus(tb.ItemsSource); // setting Visible is only possible after the items have been added UpdateStatus(tb.ItemsSource); // setting Visible is only possible after the items have been added
//new LanguageChangeWatcher(toolStrip); //new LanguageChangeWatcher(toolStrip);

5
src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarSplitButton.cs

@ -33,6 +33,8 @@ namespace ICSharpCode.Core.Presentation
image.Height = 16; image.Height = 16;
image.SetResourceReference(StyleProperty, ToolBarService.ImageStyleKey); image.SetResourceReference(StyleProperty, ToolBarService.ImageStyleKey);
this.Content = new PixelSnapper(image); this.Content = new PixelSnapper(image);
} else {
this.Content = codon.Id;
} }
menuCommand = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]); menuCommand = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]);
@ -46,9 +48,6 @@ namespace ICSharpCode.Core.Presentation
public void UpdateText() public void UpdateText()
{ {
if (codon.Properties.Contains("label")){
this.Content = StringParser.Parse(codon.Properties["label"]);
}
if (codon.Properties.Contains("tooltip")) { if (codon.Properties.Contains("tooltip")) {
this.ToolTip = StringParser.Parse(codon.Properties["tooltip"]); this.ToolTip = StringParser.Parse(codon.Properties["tooltip"]);
} }

80
src/Main/ICSharpCode.Core.Presentation/themes/Aero.NormalColor.xaml

@ -2,80 +2,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.Core.Presentation" xmlns:local="clr-namespace:ICSharpCode.Core.Presentation"
> >
<Style TargetType="{x:Type local:SplitButton}"> <!-- TODO: these colors don't get used currently - the StaticResource in generic.xaml doesn't pick them up, and DynamicResource doesn't work at all -->
<Setter Property="TextElement.Foreground" Value = "{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /> <SolidColorBrush x:Key="DropDownButtonActiveBorder" Color="#FF3399FF"/>
<Setter Property="Control.Padding" Value="2,2,2,2"/> <SolidColorBrush x:Key="DropDownButtonActiveBackground" Color="#FFC2E0FF"/>
<Setter Property="Border.BorderThickness" Value="1,1,1,1"/> <SolidColorBrush x:Key="SplitButtonPressedBackground" Color="#FF99CCFF"/>
<Setter Property="Panel.Background" Value="Transparent"/>
<Setter Property="Border.BorderBrush" Value="Transparent"/>
<Setter Property="FrameworkElement.HorizontalAlignment" Value="Center"/>
<Setter Property="FrameworkElement.VerticalAlignment" Value="Center"/>
<Setter Property="Control.HorizontalContentAlignment" Value="Center"/>
<Setter Property="Control.VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:SplitButton"
xmlns:s="clr-namespace:System;assembly=mscorlib">
<Border
BorderThickness="{TemplateBinding Border.BorderThickness}"
BorderBrush="{TemplateBinding Border.BorderBrush}"
Background="{TemplateBinding Panel.Background}"
Name="OuterBorder"
SnapsToDevicePixels="True"
>
<StackPanel Orientation="Horizontal">
<ContentPresenter
Margin="{TemplateBinding Control.Padding}"
Content="{TemplateBinding ContentControl.Content}"
ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
<Border
Name="PART_DropDownButton"
BorderThickness="1,0,0,0"
BorderBrush="{Binding ElementName=OuterBorder, Path=BorderBrush}"
SnapsToDevicePixels="True"
>
<Path Margin="2"
Data = "M0,0 L1,0 0.5,1 z"
Fill = "{TemplateBinding TextElement.Foreground}"
Width = "7"
Height = "3.5"
Stretch = "Fill"/>
</Border>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="#FF3399FF" />
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="#FFC2E0FF"/>
<Setter Property="Panel.Background" TargetName="PART_DropDownButton" Value="#FFC2E0FF"/>
</Trigger>
<Trigger Property="UIElement.IsKeyboardFocused" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="#FF3399FF"/>
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="#FFC2E0FF"/>
<Setter Property="Panel.Background" TargetName="PART_DropDownButton" Value="#FFC2E0FF"/>
</Trigger>
<Trigger Property="ButtonBase.IsPressed" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="#FF3399FF"/>
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="#FF99CCFF"/>
</Trigger>
<Trigger Property="UIElement.IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="local:SplitButton.IsDropDownMenuOpen" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
<Setter Property="Border.BorderBrush" TargetName="PART_DropDownButton" Value="Transparent" />
<Setter Property="Border.BorderThickness" TargetName="OuterBorder" Value="1,1,1,0" />
<Setter Property="Border.Padding" TargetName="OuterBorder" Value="0,0,0,1" />
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="Transparent"/>
<Setter Property="Panel.Background" TargetName="PART_DropDownButton" Value="Transparent"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary> </ResourceDictionary>

88
src/Main/ICSharpCode.Core.Presentation/themes/generic.xaml

@ -2,6 +2,72 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.Core.Presentation" xmlns:local="clr-namespace:ICSharpCode.Core.Presentation"
> >
<SolidColorBrush x:Key="DropDownButtonActiveBorder" Color="#FF0A246A"/>
<SolidColorBrush x:Key="DropDownButtonActiveBackground" Color="#FFB6BDD2"/>
<SolidColorBrush x:Key="SplitButtonPressedBackground" Color="#FF8592B5"/>
<Style TargetType="{x:Type local:DropDownButton}">
<Setter Property="TextElement.Foreground" Value = "{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="Control.Padding" Value="2,2,2,2"/>
<Setter Property="Border.BorderThickness" Value="1,1,1,1"/>
<Setter Property="Panel.Background" Value="Transparent"/>
<Setter Property="Border.BorderBrush" Value="Transparent"/>
<Setter Property="FrameworkElement.HorizontalAlignment" Value="Center"/>
<Setter Property="FrameworkElement.VerticalAlignment" Value="Center"/>
<Setter Property="Control.HorizontalContentAlignment" Value="Center"/>
<Setter Property="Control.VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:DropDownButton"
xmlns:s="clr-namespace:System;assembly=mscorlib">
<Border
BorderThickness="{TemplateBinding Border.BorderThickness}"
BorderBrush="{TemplateBinding Border.BorderBrush}"
Background="{TemplateBinding Panel.Background}"
Name="OuterBorder"
SnapsToDevicePixels="True"
>
<StackPanel Orientation="Horizontal">
<ContentPresenter
Margin="{TemplateBinding Control.Padding}"
Content="{TemplateBinding ContentControl.Content}"
ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
<Path Margin="0,2,2,2"
Data = "M0,0 L1,0 0.5,1 z"
Fill = "{TemplateBinding TextElement.Foreground}"
Width = "7"
Height = "3.5"
Stretch = "Fill"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="{StaticResource DropDownButtonActiveBorder}" />
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="{DynamicResource DropDownButtonActiveBackground}"/>
</Trigger>
<Trigger Property="UIElement.IsKeyboardFocused" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="{StaticResource DropDownButtonActiveBorder}"/>
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="{StaticResource DropDownButtonActiveBackground}"/>
</Trigger>
<Trigger Property="UIElement.IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="local:DropDownButton.IsDropDownMenuOpen" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
<Setter Property="Border.BorderThickness" TargetName="OuterBorder" Value="1,1,1,0" />
<Setter Property="Border.Padding" TargetName="OuterBorder" Value="0,0,0,1" />
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="Transparent"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type local:SplitButton}"> <Style TargetType="{x:Type local:SplitButton}">
<Setter Property="TextElement.Foreground" Value = "{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /> <Setter Property="TextElement.Foreground" Value = "{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="Control.Padding" Value="2,2,2,2"/> <Setter Property="Control.Padding" Value="2,2,2,2"/>
@ -33,7 +99,7 @@
VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" /> SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
<Border <Border
Name="PART_DropDownButton" Name="PART_DropDownArrow"
BorderThickness="1,0,0,0" BorderThickness="1,0,0,0"
BorderBrush="{Binding ElementName=OuterBorder, Path=BorderBrush}" BorderBrush="{Binding ElementName=OuterBorder, Path=BorderBrush}"
SnapsToDevicePixels="True" SnapsToDevicePixels="True"
@ -49,29 +115,29 @@
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True"> <Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="#FF0A246A" /> <Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="{StaticResource DropDownButtonActiveBorder}" />
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="#FFB6BDD2"/> <Setter Property="Panel.Background" TargetName="OuterBorder" Value="{StaticResource DropDownButtonActiveBackground}"/>
<Setter Property="Panel.Background" TargetName="PART_DropDownButton" Value="#FFB6BDD2"/> <Setter Property="Panel.Background" TargetName="PART_DropDownArrow" Value="{StaticResource DropDownButtonActiveBackground}"/>
</Trigger> </Trigger>
<Trigger Property="UIElement.IsKeyboardFocused" Value="True"> <Trigger Property="UIElement.IsKeyboardFocused" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="#FF0A246A"/> <Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="{StaticResource DropDownButtonActiveBorder}" />
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="#FFB6BDD2"/> <Setter Property="Panel.Background" TargetName="OuterBorder" Value="{StaticResource DropDownButtonActiveBackground}"/>
<Setter Property="Panel.Background" TargetName="PART_DropDownButton" Value="#FFB6BDD2"/> <Setter Property="Panel.Background" TargetName="PART_DropDownArrow" Value="{StaticResource DropDownButtonActiveBackground}"/>
</Trigger> </Trigger>
<Trigger Property="ButtonBase.IsPressed" Value="True"> <Trigger Property="ButtonBase.IsPressed" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="#FF0A246A"/> <Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="{StaticResource DropDownButtonActiveBorder}" />
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="#FF8592B5"/> <Setter Property="Panel.Background" TargetName="OuterBorder" Value="{StaticResource SplitButtonPressedBackground}"/>
</Trigger> </Trigger>
<Trigger Property="UIElement.IsEnabled" Value="False"> <Trigger Property="UIElement.IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> <Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger> </Trigger>
<Trigger Property="local:SplitButton.IsDropDownMenuOpen" Value="True"> <Trigger Property="local:SplitButton.IsDropDownMenuOpen" Value="True">
<Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" /> <Setter Property="Border.BorderBrush" TargetName="OuterBorder" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
<Setter Property="Border.BorderBrush" TargetName="PART_DropDownButton" Value="Transparent" /> <Setter Property="Border.BorderBrush" TargetName="PART_DropDownArrow" Value="Transparent" />
<Setter Property="Border.BorderThickness" TargetName="OuterBorder" Value="1,1,1,0" /> <Setter Property="Border.BorderThickness" TargetName="OuterBorder" Value="1,1,1,0" />
<Setter Property="Border.Padding" TargetName="OuterBorder" Value="0,0,0,1" /> <Setter Property="Border.Padding" TargetName="OuterBorder" Value="0,0,0,1" />
<Setter Property="Panel.Background" TargetName="OuterBorder" Value="Transparent"/> <Setter Property="Panel.Background" TargetName="OuterBorder" Value="Transparent"/>
<Setter Property="Panel.Background" TargetName="PART_DropDownButton" Value="Transparent"/> <Setter Property="Panel.Background" TargetName="PART_DropDownArrow" Value="Transparent"/>
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>

Loading…
Cancel
Save