77using VSGitBlame . Core ;
88using System . Linq ;
99using Microsoft . VisualStudio . Text . Editor ;
10+ using Color = System . Drawing . Color ;
1011
1112namespace VSGitBlame ;
1213
@@ -16,30 +17,96 @@ public static class CommitInfoViewFactory
1617 static TextBlock _summaryView ;
1718 static TextBlock _commitDetailsView ;
1819 static Image _profileIcon ;
20+ static StackPanel _detailsView ;
21+ static Border _detailsViewContainer ;
1922
2023 static bool _firstMouseMoveFired = false ;
2124 static bool _isDetailsVisible = false ;
2225 static IAdornmentLayer _adornmentLayer ;
26+
27+ private static VSGitBlamePackage _package ;
28+ private static CommitInfoViewOptions _options ;
2329
30+ public static void InitializeSettings ( VSGitBlamePackage package )
31+ {
32+ _package = package ;
33+ LoadSettings ( ) ;
34+ }
35+
36+ private static void LoadSettings ( )
37+ {
38+ if ( _package != null )
39+ {
40+ _options = _package . GetDialogPage ( typeof ( CommitInfoViewOptions ) ) as CommitInfoViewOptions ;
41+ }
42+ }
43+
44+ public static void RefreshSettings ( )
45+ {
46+ LoadSettings ( ) ;
47+ if ( _options != null )
48+ {
49+ ApplySettings ( ) ;
50+ }
51+ }
52+
53+ private static void ApplySettings ( )
54+ {
55+ if ( _summaryView != null && _options != null )
56+ {
57+ // Apply summary view settings
58+ _summaryView . FontSize = _options . SummaryFontSize ;
59+
60+ // Override the foreground color if specified, otherwise use theme detection
61+ if ( _options . SummaryFontColor != Color . Transparent )
62+ {
63+ _summaryView . Foreground = new SolidColorBrush ( System . Windows . Media . Color . FromArgb (
64+ _options . SummaryFontColor . A ,
65+ _options . SummaryFontColor . R ,
66+ _options . SummaryFontColor . G ,
67+ _options . SummaryFontColor . B ) ) ;
68+ }
69+ else
70+ {
71+ // Use theme detection if no specific color is set
72+ var backgroundColor = VSColorTheme . GetThemedColor ( EnvironmentColors . ToolWindowBackgroundColorKey ) ;
73+ _summaryView . Foreground = backgroundColor . GetBrightness ( ) > 0.5 ?
74+ Brushes . DarkBlue :
75+ Brushes . LightGray ;
76+ }
77+ }
78+
79+ if ( _commitDetailsView != null && _options != null )
80+ {
81+ // Apply details view settings
82+ _commitDetailsView . FontSize = _options . DetailsFontSize ;
83+ _commitDetailsView . Foreground = _options . GetDetailsFontBrush ( ) ;
84+ }
85+
86+ if ( _detailsView != null && _options != null )
87+ {
88+ // Apply background color setting
89+ _detailsViewContainer . Background = _options . GetDetailsBackgroundBrush ( ) ;
90+ }
91+ }
2492
2593 static CommitInfoViewFactory ( )
2694 {
2795 #region Summary View
2896 var backgroundColor = VSColorTheme . GetThemedColor ( EnvironmentColors . ToolWindowBackgroundColorKey ) ;
2997 _summaryView = new TextBlock
3098 {
31- Opacity = 0.6 ,
99+ Opacity = 0.5 ,
32100 Background = Brushes . Transparent ,
33101 Foreground = backgroundColor . GetBrightness ( ) > 0.5 ? Brushes . DarkBlue : Brushes . LightGray ,
34102 FontStyle = FontStyles . Italic ,
35- FontWeight = FontWeights . Bold ,
103+ FontWeight = FontWeights . Normal ,
36104 } ;
37105 #endregion
38106
39- #region Info View
40- var infoView = new StackPanel
107+ #region Details View
108+ _detailsView = new StackPanel
41109 {
42- Background = new SolidColorBrush ( Colors . DarkBlue ) ,
43110 Orientation = Orientation . Horizontal ,
44111 } ;
45112
@@ -49,33 +116,34 @@ static CommitInfoViewFactory()
49116 Height = 50 ,
50117 Margin = new Thickness ( 0 , 0 , 3 , 0 ) ,
51118 } ;
52- infoView . Children . Add ( _profileIcon ) ;
119+ _detailsView . Children . Add ( _profileIcon ) ;
53120
54121 _commitDetailsView = new TextBlock
55122 {
56123 Foreground = new SolidColorBrush ( Colors . White ) ,
57124 FontWeight = FontWeights . Bold ,
58125 } ;
59- infoView . Children . Add ( _commitDetailsView ) ;
126+ _detailsView . Children . Add ( _commitDetailsView ) ;
60127
61- var infoViewContainer = new Border
128+ _detailsViewContainer = new Border
62129 {
63130 BorderThickness = new Thickness ( 1 ) ,
131+ Background = new SolidColorBrush ( Colors . DarkBlue ) ,
64132 BorderBrush = Brushes . Transparent ,
65133 Visibility = Visibility . Hidden ,
66- Padding = new Thickness ( 2 )
134+ Padding = new Thickness ( 5 ) ,
67135 } ;
68- infoViewContainer . Child = infoView ;
136+ _detailsViewContainer . Child = _detailsView ;
69137 #endregion
70138
71139 #region Container
72140 var rootPanel = new StackPanel
73141 {
74142 Orientation = Orientation . Vertical ,
75- Background = Brushes . Transparent
143+ Background = Brushes . Transparent ,
76144 } ;
77- rootPanel . Children . Add ( infoViewContainer ) ;
78145 rootPanel . Children . Add ( _summaryView ) ;
146+ rootPanel . Children . Add ( _detailsViewContainer ) ;
79147
80148 rootPanel . MouseMove += ( sender , e ) =>
81149 {
@@ -88,16 +156,15 @@ static CommitInfoViewFactory()
88156 if ( _isDetailsVisible )
89157 return ;
90158
91- infoViewContainer . Visibility = Visibility . Visible ;
159+ _detailsViewContainer . Visibility = Visibility . Visible ;
92160 _isDetailsVisible = true ;
93161 } ;
94162
95163 rootPanel . MouseLeave += ( sender , e ) =>
96164 {
97165 _firstMouseMoveFired = false ;
98166 _isDetailsVisible = false ;
99- infoViewContainer . Visibility = Visibility . Hidden ;
100- _container . Visibility = Visibility . Hidden ;
167+ _detailsViewContainer . Visibility = Visibility . Hidden ;
101168 } ;
102169
103170 _container = new Border
0 commit comments