1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-12 08:29:29 +00:00

Populate toolbar icons

Extract some XAML icons from the VS2017 Image Library.  There's no
particular reason to prefer XAML over PNG, but somehow it feels
more forward-compatible.  (OTOH, defining images as ControlTemplate
instances is just weird.  Yay WPF.)
This commit is contained in:
Andy McFadden 2019-06-11 14:36:38 -07:00
parent 9c8afab2ea
commit 41b6a97408
4 changed files with 217 additions and 4 deletions

View File

@ -62,6 +62,10 @@ namespace CommonWPF {
/// Figures out which item index is at the top of the window. This only works for a
/// ListView with a VirtualizingStackPanel.
/// </summary>
/// <remarks>
/// See https://stackoverflow.com/q/2926722/294248 for an alternative approach that
/// uses hit-testing, as well as a copy of this approach.
/// </remarks>
/// <returns>The item index, or -1 if the list is empty.</returns>
public static int GetTopItemIndex(this ListView lv) {
if (lv.Items.Count == 0) {

View File

@ -30,6 +30,7 @@ limitations under the License.
<!-- style and control templates for main code ListView items -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CodeListItemStyle.xaml"/>
<ResourceDictionary Source="../Res/CommandIcons.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- don't center the ListView(GridView) column headers
@ -157,16 +158,42 @@ limitations under the License.
</MenuItem>
</Menu>
<ToolBar DockPanel.Dock="Top">
<Button Content="tbb" Width="75"/>
</ToolBar>
<ToolBarTray DockPanel.Dock="Top">
<ToolBar RenderOptions.BitmapScalingMode="NearestNeighbor">
<Button ToolTip="Navigate backward">
<ContentControl Template="{StaticResource icon_StepBackwards}"/>
</Button>
<Button ToolTip="Navigate forward">
<ContentControl Template="{StaticResource icon_StepForward}"/>
</Button>
<Separator/>
<Button ToolTip="Create new project">
<ContentControl Template="{StaticResource icon_NewFile}"/>
</Button>
<Button ToolTip="Open project">
<ContentControl Template="{StaticResource icon_OpenFile}"/>
</Button>
<Button ToolTip="Save project">
<ContentControl Template="{StaticResource icon_SaveFile}"/>
</Button>
<Separator/>
<Button ToolTip="Copy to clipboard">
<ContentControl Template="{StaticResource icon_CopyToClipboard}"/>
</Button>
<Separator/>
<Button ToolTip="Help - open manual in browser">
<ContentControl Template="{StaticResource icon_F1Help}"/>
</Button>
</ToolBar>
</ToolBarTray>
<StatusBar Name="mainStatusBar" DockPanel.Dock="Bottom">
<TextBlock Text="Ready"/>
</StatusBar>
<!-- Main part of the window. Three side-by-side panels, only the middle of which changes
size when the window is resized. -->
size when the window is resized. This needs to be the last thing defined in the
DockPanel, so that LastChildFill will expand this to fill all available space. -->
<Grid Name="triptychGrid" DockPanel.Dock="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="168" MinWidth="100"/>

View File

@ -0,0 +1,178 @@
<!--
All images in this file are from the Microsoft Visual Studio 2017 Image Library.
https://www.microsoft.com/en-my/download/details.aspx?id=35825
The interesting part of the licensing terms is:
"You may copy and distribute images from the Image Library in applications you develop
with the Visual Studio family of products. Your use of the Images must be in accordance
with the use descriptions associated with the Images"
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SourceGenWPF.Res">
<ControlTemplate x:Key="icon_CopyToClipboard">
<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22116.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M12.375,1L7.999,1C7.029,1,6,1.701,6,3L6,5 3.999,5C3.029,5,2,5.701,2,7L2,12C2,13.299,3.029,14,4,14L8,14C9.299,14,10,12.97,10,12L10,10 12,10C13.299,10,14,8.97,14,8L14,3.062z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M8,10L8,10 8,12 4,12 4,7 7,7 7,8 8,8z M7.313,6L3.963,6C3.963,6,3,6,3,7L3,12C3,13,3.964,13,3.964,13L7.964,13C8.964,13,9,12,9,12L9,8.136z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M11.3125,2L7.9625,2C7.9625,2,7.0005,2,7.0005,3L7.0005,5 7.9995,5 7.9995,3 11.0005,3 11.0005,4 11.9995,4 11.9995,6 11.9995,8 10.0005,8 10.0005,9 11.9635,9C12.9635,9,12.9995,8,12.9995,8L12.9995,4.136z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M4,7L7,7 7,8 8,8 8,12 4,12z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M11,4L11,3 8,3 8,5 8.375,5 10,7.062 10,8 12,8 12,4z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</ControlTemplate>
<ControlTemplate x:Key="icon_F1Help">
<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M1,16L15,16 15,0 1,0z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M9,11L7,11 7,13 9,13z M9,10L7,10 7,9C7,7.897,7.897,7,9,7L9,5.203C8.841,5.115 8.495,5 8,5 7.505,5 7.159,5.115 7,5.203L7,6 5,6 5,5C5,3.841 6.262,3 8,3 9.738,3 11,3.841 11,5L11,7C11,8.103,10.102,9,9,9z" />
<GeometryDrawing Brush="#FF1AA1E2" Geometry="F1M11,7C11,8.103,10.102,9,9,9L9,10 7,10 7,9C7,7.897,7.897,7,9,7L9,5.203C8.841,5.115 8.495,5 8,5 7.505,5 7.159,5.115 7,5.203L7,6 5,6 5,5C5,3.841 6.262,3 8,3 9.738,3 11,3.841 11,5z M9,13L7,13 7,11 9,11z M2,15L14,15 14,1 2,1z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</ControlTemplate>
<ControlTemplate x:Key="icon_NewFile">
<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M15,5.52L15,13C15,13.97,14.299,15,13,15L7,15C6.031,15,5,14.299,5,13L5,9 3,9 3,8.121 2.379,8.742 0.257,6.621 0.878,6 0,6 0,3 0.878,3 0.257,2.379 2.379,0.257 3,0.877999999999999 3,0 6,0 6,0.877999999999999 6.621,0.257 8.742,2.379 8.121,3 9,3 12.069,3z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M14,6.1362L14,13.0002C14,13.0002,13.965,14.0002,12.965,14.0002L6.965,14.0002C6.965,14.0002,6,14.0002,6,13.0002L6,8.1442 6.598,8.7422 7,8.3402 7,13.0002 13,13.0002 13,9.0002 13,8.0002 13,7.0002 11,7.0002 11,5.0002 9,5.0002 9,4.0002 11.625,4.0002z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M13,7L13,13 7,13 7,8.363 8.742,6.621 8.121,6 9,6 9,5 11,5 11,7z" />
<GeometryDrawing Brush="#FFC27D1A" Geometry="F1M5,5L4,5 4,4 5,4z M8,4L5.707,4 7.328,2.379 6.621,1.671 5,3.292 5,1 4,1 4,3.292 2.379,1.671 1.671,2.379 3.292,4 1,4 1,5 3.292,5 1.671,6.621 2.379,7.328 4,5.707 4,8 5,8 5,5.707 6.621,7.328 7.328,6.621 5.707,5 8,5z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</ControlTemplate>
<ControlTemplate x:Key="icon_OpenFile">
<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16.018L0,16.018 0,0.0180000000000007 16,0.0180000000000007z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M16,4.3965L16,16.0175 3,16.0175 3,9.9675C1.308,9.7215 0,8.2765 0,6.5175 0,4.7595 1.308,3.3135 3,3.0685L3,0.0175000000000001 5.711,0.0175000000000001 5.729,0.000499999999999723 5.746,0.0175000000000001 11.621,0.0175000000000001z" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M10,6.0176L10,4.7636 5.729,9.0356 5,8.3066 5,14.0176 14,14.0176 14,6.0176z M10,4.2716L10,2.0176 7.746,2.0176z M13.793,5.0176L11,5.0176 11,2.2246z" />
<GeometryDrawing Brush="#FF424242" Geometry="F1M6.7464,1.0177L7.7464,2.0177 9.9994,2.0177 9.9994,6.0167 14.0004,6.0167 14.0004,14.0177 5.0004,14.0177 5.0004,10.0177 3.9994,10.0177 3.9994,15.0167 15.0004,15.0167 15.0004,4.8107 11.2064,1.0177z M10.9994,2.2247L13.7934,5.0177 10.9994,5.0177z" />
<GeometryDrawing Brush="#FF00529C" Geometry="F1M8.832,4.5176L5.728,7.6216 5.021,6.9136 6.918,5.0176 3.5,5.0176C2.673,5.0176 2,5.6906 2,6.5176 2,7.3446 2.673,8.0176 3.5,8.0176L3.5,9.0176C2.122,9.0176 1,7.8966 1,6.5176 1,5.1396 2.122,4.0176 3.5,4.0176L6.918,4.0176 5.021,2.1216 5.728,1.4136z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</ControlTemplate>
<ControlTemplate x:Key="icon_SaveFile">
<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M16,2L16,16 2.586,16 0,13.414 0,2C0,0.897,0.897,0,2,0L14,0C15.103,0,16,0.897,16,2" />
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M4,10L4,15 6,15 6,12 8,12 8,15 12,15 12,10z M13,7L3,7 3,3 13,3z" />
<GeometryDrawing Brush="#FF00529C" Geometry="F1M13,3L3,3 3,7 13,7z M15,2L15,15 12,15 12,10 4,10 4,15 3,15 1,13 1,2C1,1.448,1.448,1,2,1L14,1C14.553,1,15,1.448,15,2 M6,12L8,12 8,15 6,15z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</ControlTemplate>
<ControlTemplate x:Key="icon_StepBackwards">
<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M15.0947,11L11.4517,11 11.3387,10.128C11.2367,9.338,10.8127,8.655,10.2087,8.205L6.4137,12 0.999699999999999,12 0.999699999999999,6.586 4.9997,2.586 4.9997,5.03C6.0327,4.367 7.2447,4 8.4997,4 11.8417,4 14.6957,6.596 14.9957,9.91z" />
<GeometryDrawing Brush="#FF00529C" Geometry="F1M14,10L12.331,10C12.085,8.102 10.465,6.637 8.5,6.637 6.898,6.637 5.348,7.611 4.762,9L5,8.998 5,9 8,9 6,11 2,11 2,7 4,5 4,7.348C4.996,5.931 6.64,5 8.5,5 11.363,5 13.746,7.201 14,10" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</ControlTemplate>
<ControlTemplate x:Key="icon_StepForward">
<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M15,6.5859L15,11.9999 9.586,11.9999 5.791,8.2049C5.187,8.6549,4.764,9.3379,4.661,10.1279L4.548,10.9999 0.904999999999999,10.9999 1.004,9.9099C1.305,6.5959 4.158,3.9999 7.5,3.9999 8.755,3.9999 9.967,4.3669 11,5.0299L11,2.5859z" />
<GeometryDrawing Brush="#FF00529C" Geometry="F1M14,7L14,11 10,11 8,9 11,9 11,8.998 11.238,9C10.652,7.611 9.102,6.637 7.5,6.637 5.535,6.637 3.915,8.102 3.669,10L2,10C2.254,7.201 4.637,5 7.5,5 9.359,5 11.004,5.931 12,7.348L12,5z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</ControlTemplate>
</ResourceDictionary>

View File

@ -169,6 +169,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Res\CommandIcons.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Res\Strings.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>