Skip to content

Commit cc6dd6e

Browse files
committed
Added configurable UI fonts (thanks to Kevin Greiner)
2 parents d02e8c4 + 154c120 commit cc6dd6e

File tree

6 files changed

+317
-219
lines changed

6 files changed

+317
-219
lines changed

HuntingDog/DogConfig/Config.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ public class DogConfig
2121
{
2222
private int _selectTopXTable;
2323
private int _limitSearch;
24+
private int _fontSize;
2425

2526
public DogConfig()
2627
{
28+
FontSize = 14;
29+
2730
ScriptIndexes = true;
2831
ScriptTriggers = true;
2932
ScriptForeignKeys = false;
@@ -103,11 +106,27 @@ public int LimitSearch
103106
}
104107
}
105108

109+
[Category("GENERAL")]
110+
[DisplayName("Font Size")]
111+
[Description("Requires SSMS restart. Font size used for search results.")]
112+
public int FontSize
113+
{
114+
get { return _fontSize; }
115+
set
116+
{
117+
_fontSize = value;
118+
if (_fontSize < 8)
119+
_fontSize = 8;
120+
else if (_fontSize > 16)
121+
_fontSize = 16;
122+
}
123+
}
124+
106125
private string _launchingHotKey = "D";
107126

108127
[Category("GENERAL")]
109128
[DisplayName("Hot Key: Ctrl+")]
110-
[Description("Launch Hunting Dog using Ctrl + this key. Will be effective after SSMS is restarted")]
129+
[Description("Requires SSMS restart.Launch Hunting Dog using Ctrl + this key.")]
111130
public string LaunchingHotKey
112131
{
113132
get { return _launchingHotKey; }

HuntingDog/DogFace/Face.xaml

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@
302302
<EventSetter Event="ContextMenuClosing" Handler="ListViewContextMenuClosing" />
303303
<Setter Property="ContextMenu" Value="{StaticResource ContextActionMenu}"/>
304304
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
305+
<Setter Property="FontSize" Value="14" />
305306
<Setter Property="Template">
306307
<Setter.Value>
307308
<ControlTemplate TargetType="ListViewItem">
@@ -327,6 +328,71 @@
327328
</ControlTemplate>
328329
</Setter.Value>
329330
</Setter>
331+
<Style.Triggers>
332+
<DataTrigger
333+
Binding="{Binding Path=ResultsFontSize,
334+
RelativeSource={RelativeSource FindAncestor,
335+
AncestorType={x:Type UserControl}}}"
336+
Value="8">
337+
<Setter Property="FontSize" Value="8" />
338+
</DataTrigger>
339+
<DataTrigger
340+
Binding="{Binding Path=ResultsFontSize,
341+
RelativeSource={RelativeSource FindAncestor,
342+
AncestorType={x:Type UserControl}}}"
343+
Value="9">
344+
<Setter Property="FontSize" Value="9" />
345+
</DataTrigger>
346+
<DataTrigger
347+
Binding="{Binding Path=ResultsFontSize,
348+
RelativeSource={RelativeSource FindAncestor,
349+
AncestorType={x:Type UserControl}}}"
350+
Value="10">
351+
<Setter Property="FontSize" Value="10" />
352+
</DataTrigger>
353+
<DataTrigger
354+
Binding="{Binding Path=ResultsFontSize,
355+
RelativeSource={RelativeSource FindAncestor,
356+
AncestorType={x:Type UserControl}}}"
357+
Value="11">
358+
<Setter Property="FontSize" Value="11" />
359+
</DataTrigger>
360+
<DataTrigger
361+
Binding="{Binding Path=ResultsFontSize,
362+
RelativeSource={RelativeSource FindAncestor,
363+
AncestorType={x:Type UserControl}}}"
364+
Value="12">
365+
<Setter Property="FontSize" Value="12" />
366+
</DataTrigger>
367+
<DataTrigger
368+
Binding="{Binding Path=ResultsFontSize,
369+
RelativeSource={RelativeSource FindAncestor,
370+
AncestorType={x:Type UserControl}}}"
371+
Value="13">
372+
<Setter Property="FontSize" Value="13" />
373+
</DataTrigger>
374+
<DataTrigger
375+
Binding="{Binding Path=ResultsFontSize,
376+
RelativeSource={RelativeSource FindAncestor,
377+
AncestorType={x:Type UserControl}}}"
378+
Value="14">
379+
<Setter Property="FontSize" Value="14" />
380+
</DataTrigger>
381+
<DataTrigger
382+
Binding="{Binding Path=ResultsFontSize,
383+
RelativeSource={RelativeSource FindAncestor,
384+
AncestorType={x:Type UserControl}}}"
385+
Value="15">
386+
<Setter Property="FontSize" Value="15" />
387+
</DataTrigger>
388+
<DataTrigger
389+
Binding="{Binding Path=ResultsFontSize,
390+
RelativeSource={RelativeSource FindAncestor,
391+
AncestorType={x:Type UserControl}}}"
392+
Value="16">
393+
<Setter Property="FontSize" Value="16" />
394+
</DataTrigger>
395+
</Style.Triggers>
330396
</Style>
331397

332398
<Style x:Key="MenuListViewItem" TargetType="ListViewItem" >
@@ -626,7 +692,7 @@
626692
Tag="{Binding}"
627693
Grid.Column="1"
628694
Margin="0,0,0,0"
629-
FontSize="14"
695+
630696
ResultItem="{Binding .}"
631697
DoHighlight="{Binding IsChecked}"
632698
VerticalAlignment="Center"

HuntingDog/DogFace/Face.xaml.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ enum ERquestType : int
109109
// small hint - to use anonymous delegates in InvokeUI method
110110
public delegate void AnyInvoker();
111111

112+
public int ResultsFontSize { get; set; }
113+
112114
public IStudioController StudioController
113115
{
114116
get
@@ -171,6 +173,7 @@ public Face()
171173
{
172174
log.Info("XAML Face Constructed.");
173175
InitializeComponent();
176+
this.DataContext = this;
174177
}
175178

176179
private void UserControl_Loaded(Object sender, RoutedEventArgs e)
@@ -194,6 +197,8 @@ private void UserControl_Loaded(Object sender, RoutedEventArgs e)
194197
StudioController.OnServersRemoved += StudioController_OnServersRemoved;
195198
StudioController.ShowYourself += new System.Action(StudioController_ShowYourself);
196199
ReloadServers();
200+
201+
ResultsFontSize = _cfg.FontSize;
197202

198203
var lastSrvName = _userPref.GetByName(UserPref_LastSelectedServer);
199204
RestoreLastSearchTextFromUserProfile();
@@ -1178,7 +1183,10 @@ void userCtrol_OnNewConfig(Config.DogConfig obj)
11781183

11791184
_cfg = obj;
11801185
if (_studio != null)
1186+
{
11811187
_studio.SetConfiguration(_cfg);
1188+
ResultsFontSize = _cfg.FontSize;
1189+
}
11821190

11831191
if(_userPref!=null)
11841192
{

HuntingDog/HuntingDog.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@
249249
</ItemGroup>
250250
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
251251
<PropertyGroup>
252-
<PostBuildEvent>xcopy "$(TargetDir)HuntingDog.dll" "C:\Program Files (x86)\Hunting Dog\" /Y /R</PostBuildEvent>
252+
<PostBuildEvent>
253+
</PostBuildEvent>
253254
</PropertyGroup>
254255
<!--Target Name="AfterBuild" DependsOnTargets="GenSerializationAssembly" />
255256
<Target Name="GenSerializationAssembly"

HuntingDog2012/HuntingDog2012.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@
344344
<None Include="Resources\download.png" />
345345
</ItemGroup>
346346
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
347+
<PropertyGroup>
348+
<PostBuildEvent>
349+
</PostBuildEvent>
350+
</PropertyGroup>
347351
<!--Target Name="AfterBuild" DependsOnTargets="GenSerializationAssembly" />
348352
<Target Name="GenSerializationAssembly"
349353
DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource"

0 commit comments

Comments
 (0)