Skip to content

Commit 4ff8a59

Browse files
committed
Improved ScrollBarEx update 3
Used explicit color values for default colors. Modified the default theme files. Some more minor changes.
1 parent dc1799b commit 4ff8a59

File tree

8 files changed

+105
-89
lines changed

8 files changed

+105
-89
lines changed

FlashDevelop/Bin/Debug/Settings/Themes/Default.fdi

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,18 @@ VS2005AutoHideStrip.TabUnderlineColor=#ff0000
6262
# Default (Hover), Click
6363
DockPanel.ShowAutoHideContentOn=Hover
6464

65-
#ScrollBar.ForeColor=#686A68
66-
#ScrollBar.BackColor=#A8ACAA
67-
#ScrollBar.BorderColor=#A8ACAA
68-
#ScrollBar.ActiveForeColor=#485253
69-
#ScrollBar.DisabledBackColor=#333F42
70-
#ScrollBar.DisabledBorderColor=#666D73
71-
#ScrollBar.CurrentPositionColor=#804000
65+
ScrollBar.UseCustom=False
66+
#ScrollBar.ForeColor=#D0D1D7
67+
#ScrollBar.BackColor=#E8E8EC
68+
#ScrollBar.BorderColor=#E8E8EC
69+
#ScrollBar.HotForeColor=#888888
70+
#ScrollBar.ActiveForeColor=#6A6A6A
71+
#ScrollBar.ArrowColor=#868999
72+
#ScrollBar.HotArrowColor=#1C97EA
73+
#ScrollBar.ActiveArrowColor=#007ACC
74+
#ScrollBar.DisabledBackColor=#C0C0C0
75+
#ScrollBar.DisabledBorderColor=#888888
76+
#ScrollBar.CurrentPositionColor=#0000CD
7277

7378
#LinkLabel.LinkColor=#ff0000
7479
#LinkLabel.ActiveLinkColor=#00ff00

FlashDevelop/Bin/Debug/Settings/Themes/DimGray.fdi

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,18 @@ VS2005AutoHideStrip.TabUnderlineColor=#ff0000
6262
# Default (Hover), Click
6363
DockPanel.ShowAutoHideContentOn=Hover
6464

65-
#ScrollBar.ForeColor=#686A68
66-
#ScrollBar.BackColor=#A8ACAA
67-
#ScrollBar.BorderColor=#A8ACAA
68-
#ScrollBar.ActiveForeColor=#485253
69-
#ScrollBar.DisabledBackColor=#333F42
70-
#ScrollBar.DisabledBorderColor=#666D73
71-
#ScrollBar.CurrentPositionColor=#804000
65+
ScrollBar.UseCustom=False
66+
#ScrollBar.ForeColor=#D0D1D7
67+
#ScrollBar.BackColor=#E8E8EC
68+
#ScrollBar.BorderColor=#E8E8EC
69+
#ScrollBar.HotForeColor=#888888
70+
#ScrollBar.ActiveForeColor=#6A6A6A
71+
#ScrollBar.ArrowColor=#868999
72+
#ScrollBar.HotArrowColor=#1C97EA
73+
#ScrollBar.ActiveArrowColor=#007ACC
74+
#ScrollBar.DisabledBackColor=#C0C0C0
75+
#ScrollBar.DisabledBorderColor=#888888
76+
#ScrollBar.CurrentPositionColor=#0000CD
7277

7378
#LinkLabel.LinkColor=#ff0000
7479
#LinkLabel.ActiveLinkColor=#00ff00

FlashDevelop/Bin/Debug/Settings/Themes/Obsidian.fdi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,15 @@ VS2005AutoHideStrip.TabUnderlineColor=#6D767C
6262
# Default (Hover), Click
6363
DockPanel.ShowAutoHideContentOn=Hover
6464

65+
ScrollBar.UseCustom=True
6566
ScrollBar.ForeColor=#686A68
6667
ScrollBar.BackColor=#A8ACAA
6768
ScrollBar.BorderColor=#A8ACAA
69+
#ScrollBar.HotForeColor=#XXXXXX
6870
ScrollBar.ActiveForeColor=#485253
71+
#ScrollBar.ArrowColor=#XXXXXX
72+
#ScrollBar.HotArrowColor=#XXXXXX
73+
#ScrollBar.ActiveArrowColor=#XXXXXX
6974
ScrollBar.DisabledBackColor=#A8ACAA
7075
ScrollBar.DisabledBorderColor=#A8ACAA
7176
ScrollBar.CurrentPositionColor=#804000

FlashDevelop/Bin/Debug/Settings/Themes/Thyleus.fdi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,15 @@ VS2005AutoHideStrip.TabUnderlineColor=#7B7675
6262
# Default (Hover), Click
6363
DockPanel.ShowAutoHideContentOn=Hover
6464

65+
ScrollBar.UseCustom=True
6566
ScrollBar.ForeColor=#4B4645
6667
ScrollBar.BackColor=#7B7675
6768
ScrollBar.BorderColor=#7B7675
69+
#ScrollBar.HotForeColor=#XXXXXX
6870
ScrollBar.ActiveForeColor=#333333
71+
#ScrollBar.ArrowColor=#XXXXXX
72+
#ScrollBar.HotArrowColor=#XXXXXX
73+
#ScrollBar.ActiveArrowColor=#XXXXXX
6974
ScrollBar.DisabledBackColor=#7B7675
7075
ScrollBar.DisabledBorderColor=#7B7675
7176
ScrollBar.CurrentPositionColor=#F0AC62

FlashDevelop/Settings/Accessors.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,9 @@ public ScrollBarMode UseCustomScrollBar
391391
get { return this.useCustomScrollBar; }
392392
set
393393
{
394-
if (this.useCustomScrollBar != value)
395-
{
396-
this.useCustomScrollBar = value;
397-
ScrollBarEx.NotifySettingsChanged(this.useCustomScrollBar);
398-
}
394+
if (this.useCustomScrollBar == value) return;
395+
this.useCustomScrollBar = value;
396+
ScrollBarEx.NotifySettingsChanged(this.useCustomScrollBar);
399397
}
400398
}
401399

PluginCore/PluginCore/Controls/ScrollBarEx.cs

Lines changed: 41 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ public class ScrollBarEx : Control
2222

2323
public delegate void SettingsChangedEventHandler(ScrollBarMode value);
2424
public static event SettingsChangedEventHandler SettingsChanged;
25-
26-
private static ScrollBarMode settingsMode = ScrollBarMode.Auto;
27-
25+
2826
public static ScrollBarMode SettingsMode
2927
{
30-
get { return settingsMode; }
28+
get { return PluginBase.MainForm.Settings.UseCustomScrollBar; }
29+
}
30+
31+
public static bool UseCustom
32+
{
33+
get { return PluginBase.MainForm.GetThemeValue("ScrollBar.UseCustom", "false").ToLower() == "true"; }
3134
}
3235

3336
public static void NotifySettingsChanged(ScrollBarMode value)
3437
{
35-
settingsMode = value;
36-
if (SettingsChanged != null) SettingsChanged.Invoke(settingsMode);
38+
if (SettingsChanged != null) SettingsChanged.Invoke(value);
3739
}
3840

3941
#endregion
4042

4143
#region drawing
4244

4345
private Color curPosColor/* = Color.DarkBlue*/;
44-
private Color borderColor/* = SystemColors.ActiveBorder*/;
45-
private Color borderColorDisabled/* = SystemColors.Control*/;
4646
private Color foreColor/* = SystemColors.ControlDarkDark*/;
4747
private Color foreColorHot;
4848
private Color foreColorPressed/* = SystemColors.Highlight*/;
@@ -51,25 +51,26 @@ public static void NotifySettingsChanged(ScrollBarMode value)
5151
private Color arrowColorPressed;
5252
private Color backColor/* = SystemColors.ActiveBorder*/;
5353
private Color backColorDisabled/* = SystemColors.ControlLight*/;
54-
54+
private Color borderColor/* = SystemColors.ActiveBorder*/;
55+
private Color borderColorDisabled/* = SystemColors.Control*/;
5556
private bool colorsInvalidated;
5657

5758
/// <summary>
5859
/// Resets the component colors to default values.
5960
/// </summary>
6061
private void InitializeColors()
6162
{
62-
curPosColor = Color.DarkBlue;
63-
borderColor = SystemColors.ActiveBorder;
64-
borderColorDisabled = SystemColors.InactiveBorder;
65-
foreColor = SystemColors.ScrollBar;
66-
foreColorHot = SystemColors.ControlDark;
67-
foreColorPressed = SystemColors.ControlDarkDark;
68-
arrowColor = SystemColors.ControlDark;
69-
arrowColorHot = SystemColors.Highlight;
70-
arrowColorPressed = SystemColors.HotTrack;
71-
backColor = SystemColors.Control;
72-
backColorDisabled = SystemColors.ControlLight;
63+
if (curPosColor.IsEmpty) curPosColor = Color.FromArgb( 0, 0, 205); //#0000CD
64+
if (foreColor.IsEmpty) foreColor = Color.FromArgb(208, 209, 215); //#D0D1D7
65+
if (!colorsInvalidated) foreColorHot = Color.FromArgb(136, 136, 136); //#888888
66+
if (foreColorPressed.IsEmpty) foreColorPressed = Color.FromArgb(106, 106, 106); //#6A6A6A
67+
if (!colorsInvalidated) arrowColor = Color.FromArgb(134, 137, 153); //#868999
68+
if (!colorsInvalidated) arrowColorHot = Color.FromArgb( 28, 151, 234); //#1C97EA
69+
if (!colorsInvalidated) arrowColorPressed = Color.FromArgb( 0, 122, 204); //#007ACC
70+
if (backColor.IsEmpty) backColor = Color.FromArgb(232, 232, 236); //#E8E8EC
71+
if (backColorDisabled.IsEmpty) backColorDisabled = Color.FromArgb(192, 192, 192); //#C0C0C0
72+
if (borderColor.IsEmpty) borderColor = Color.FromArgb(232, 232, 236); //#E8E8EC
73+
if (borderColorDisabled.IsEmpty) borderColorDisabled = Color.FromArgb(136, 136, 136); //#888888
7374
colorsInvalidated = false;
7475
Invalidate();
7576
}
@@ -82,25 +83,17 @@ private void InitializeColors()
8283
/// </summary>
8384
public void ValidateColors()
8485
{
85-
if (!colorsInvalidated)
86-
{
87-
// No colors defined explicitly -> Reset colors to default.
88-
InitializeColors();
89-
return;
90-
}
86+
// Reset any unassigned colors to default.
87+
InitializeColors();
88+
89+
// If no colors are explicitly defined, not fallback colors are required.
90+
if (!colorsInvalidated) return;
9191

92-
if (curPosColor.IsEmpty) curPosColor = Color.DarkBlue;
93-
if (borderColor.IsEmpty) borderColor = SystemColors.ActiveBorder;
94-
if (borderColorDisabled.IsEmpty) borderColorDisabled = SystemColors.InactiveBorder;
95-
if (foreColor.IsEmpty) foreColor = SystemColors.ScrollBar;
96-
if (foreColorPressed.IsEmpty) foreColorPressed = SystemColors.ControlDarkDark;
97-
if (backColor.IsEmpty) backColor = SystemColors.Control;
98-
if (backColorDisabled.IsEmpty) backColorDisabled = SystemColors.ControlLight;
99-
// Newly introduced color options - do not assign default colors. Instead fall back to associated colors
100-
if (foreColorHot.IsEmpty) foreColorHot = foreColor;
101-
if (arrowColor.IsEmpty) arrowColor = foreColor;
102-
if (arrowColorHot.IsEmpty) arrowColorHot = foreColorHot;
103-
if (arrowColorPressed.IsEmpty) arrowColorPressed = foreColorPressed;
92+
// Newly introduced color options - do not assign default colors. Instead fall back to associated colors.
93+
foreColorHot = PluginBase.MainForm.GetThemeColor("ScrollBar.HotForeColor", foreColor);
94+
arrowColor = PluginBase.MainForm.GetThemeColor("ScrollBar.ArrowColor", foreColor);
95+
arrowColorHot = PluginBase.MainForm.GetThemeColor("ScrollBar.HotArrowColor", arrowColor);
96+
arrowColorPressed = PluginBase.MainForm.GetThemeColor("ScrollBar.ActiveArrowColor", foreColorPressed);
10497

10598
colorsInvalidated = false;
10699
}
@@ -267,14 +260,13 @@ private void DrawBackgroundHorizontal(Graphics g, Rectangle rect)
267260
/// <param name="g">The <see cref="Graphics"/> used to paint.</param>
268261
/// <param name="rect">The rectangle in which to paint.</param>
269262
/// <param name="color">The color to draw the thumb with.</param>
270-
private void DrawThumbVertical(Graphics g, Rectangle rect, Color color)
263+
private static void DrawThumbVertical(Graphics g, Rectangle rect, Color color)
271264
{
272265
var innerRect = new Rectangle(rect.Left + ScaleHelper.Scale(2), rect.Top, rect.Width - ScaleHelper.Scale(4), rect.Height);
273266
using (Brush brush = new SolidBrush(color))
274267
{
275268
g.FillRectangle(brush, innerRect);
276269
}
277-
278270
}
279271

280272
/// <summary>
@@ -283,7 +275,7 @@ private void DrawThumbVertical(Graphics g, Rectangle rect, Color color)
283275
/// <param name="g">The <see cref="Graphics"/> used to paint.</param>
284276
/// <param name="rect">The rectangle in which to paint.</param>
285277
/// <param name="color">The color to draw the thumb with.</param>
286-
private void DrawThumbHorizontal(Graphics g, Rectangle rect, Color color)
278+
private static void DrawThumbHorizontal(Graphics g, Rectangle rect, Color color)
287279
{
288280
var innerRect = new Rectangle(rect.Left, rect.Top + ScaleHelper.Scale(2), rect.Width, rect.Height - ScaleHelper.Scale(4));
289281
using (Brush brush = new SolidBrush(color))
@@ -299,19 +291,19 @@ private void DrawThumbHorizontal(Graphics g, Rectangle rect, Color color)
299291
/// <param name="rect">The rectangle in which to paint.</param>
300292
/// <param name="color">The color to draw the arrow buttons with.</param>
301293
/// <param name="arrowUp">true for an up arrow, false otherwise.</param>
302-
private void DrawArrowButtonVertical(Graphics g, Rectangle rect, Color color, bool arrowUp)
294+
private static void DrawArrowButtonVertical(Graphics g, Rectangle rect, Color color, bool arrowUp)
303295
{
304296
using (Brush brush = new SolidBrush(color))
305297
{
306298
Point[] arrow;
307-
Int32 pad = 0;
299+
Int32 pad;
308300
Point middle = new Point(rect.Left + rect.Width / 2, (rect.Top + rect.Height / 2));
309301
switch (arrowUp)
310302
{
311303
case true:
312304
pad = ScaleHelper.Scale(4);
313305
middle.Y += ScaleHelper.Scale(2);
314-
arrow = new[]
306+
arrow = new Point[]
315307
{
316308
new Point(middle.X - pad , middle.Y + 1),
317309
new Point(middle.X + pad + 1, middle.Y + 1),
@@ -321,7 +313,7 @@ private void DrawArrowButtonVertical(Graphics g, Rectangle rect, Color color, bo
321313
default:
322314
pad = ScaleHelper.Scale(3);
323315
middle.Y -= ScaleHelper.Scale(1);
324-
arrow = new[]
316+
arrow = new Point[]
325317
{
326318
new Point(middle.X - pad, middle.Y - 1),
327319
new Point(middle.X + pad + 1, middle.Y - 1),
@@ -341,18 +333,18 @@ private void DrawArrowButtonVertical(Graphics g, Rectangle rect, Color color, bo
341333
/// <param name="rect">The rectangle in which to paint.</param>
342334
/// <param name="color">The color to draw the arrow buttons with.</param>
343335
/// <param name="arrowUp">true for an up arrow, false otherwise.</param>
344-
private void DrawArrowButtonHorizontal(Graphics g, Rectangle rect, Color color, bool arrowUp)
336+
private static void DrawArrowButtonHorizontal(Graphics g, Rectangle rect, Color color, bool arrowUp)
345337
{
346338
using (Brush brush = new SolidBrush(color))
347339
{
348340
Point[] arrow;
349-
Int32 pad = 0;
341+
Int32 pad;
350342
Point middle = new Point(rect.Left + rect.Width / 2, rect.Top + rect.Height / 2);
351343
switch (arrowUp)
352344
{
353345
case true:
354346
pad = ScaleHelper.Scale(2);
355-
arrow = new[]
347+
arrow = new Point[]
356348
{
357349
new Point(middle.X + pad, middle.Y - 2 * pad),
358350
new Point(middle.X + pad, middle.Y + 2 * pad),
@@ -361,7 +353,7 @@ private void DrawArrowButtonHorizontal(Graphics g, Rectangle rect, Color color,
361353
break;
362354
default:
363355
pad = ScaleHelper.Scale(2);
364-
arrow = new[]
356+
arrow = new Point[]
365357
{
366358
new Point(middle.X - pad, middle.Y - 2 * pad),
367359
new Point(middle.X - pad, middle.Y + 2 * pad),

PluginCore/PluginCore/Interfaces.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Drawing;
44
using System.Windows.Forms;
5+
using PluginCore.Controls;
56
using PluginCore.Localization;
67
using ScintillaNet;
78
using ScintillaNet.Configuration;
@@ -14,12 +15,12 @@ namespace PluginCore
1415
public interface IPlugin : IEventHandler
1516
{
1617
#region IPlugin Methods
17-
18+
1819
void Dispose();
1920
void Initialize();
20-
21+
2122
#endregion
22-
23+
2324
#region IPlugin Properties
2425

2526
Int32 Api { get; }
@@ -32,7 +33,7 @@ public interface IPlugin : IEventHandler
3233

3334
// List of valid API levels:
3435
// FlashDevelop 4.0 = 1
35-
36+
3637
#endregion
3738
}
3839

@@ -275,7 +276,7 @@ public interface ISettings
275276
Int32 CaretPeriod { get; set; }
276277
Int32 CaretWidth { get; set; }
277278
Int32 ScrollWidth { get; set; }
278-
Int32 PrintMarginColumn { get; set; }
279+
Int32 PrintMarginColumn { get; set; }
279280
Size WindowSize { get; set; }
280281
FormWindowState WindowState { get; set; }
281282
Point WindowPosition { get; set; }
@@ -288,7 +289,8 @@ public interface ISettings
288289
Boolean DisableSmartMatch { get; set; }
289290
Boolean SaveUnicodeWithBOM { get; set; }
290291
String InsertionTriggers { get; set; }
291-
292+
ScrollBarMode UseCustomScrollBar { get; set; }
293+
292294
#endregion
293295
}
294296

0 commit comments

Comments
 (0)