Skip to content

Commit 9d11866

Browse files
committed
✨ Implement taskbar transparency in settings
1 parent 2499f92 commit 9d11866

File tree

6 files changed

+89
-24
lines changed

6 files changed

+89
-24
lines changed

SRC/Aura_OS/Properties/VersionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ namespace Aura_OS
22
{
33
public class VersionInfo
44
{
5-
public static string revision = "040320241545";
5+
public static string revision = "040320241613";
66
}
77
}

SRC/Aura_OS/System/Graphics/UI/GUI/Components/Slider.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,38 @@
55
*/
66

77
using Cosmos.System;
8+
using UniLua;
89

910
namespace Aura_OS.System.Graphics.UI.GUI.Components
1011
{
1112
public class Slider : Component
1213
{
13-
public int Value = 0;
14+
public int Value
15+
{
16+
get { return _value; }
17+
set
18+
{
19+
_value = value;
20+
int newPositionX = (_value * (Width - _slide.Width)) / 255;
21+
if (newPositionX < 0)
22+
{
23+
newPositionX = 0;
24+
}
25+
else if (newPositionX > Width - _slide.Width)
26+
{
27+
newPositionX = Width - _slide.Width;
28+
}
29+
30+
_slide.X = newPositionX;
31+
_slide.MarkDirty();
32+
MarkDirty();
33+
}
34+
}
1435

1536
private Button _slide;
1637
private bool _sliderPressed = false;
1738
private int _firstX;
39+
private int _value = 0;
1840

1941
public Slider(int x, int y, int width, int height) : base(x, y, width, height)
2042
{

SRC/Aura_OS/System/Graphics/UI/GUI/WindowManager.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Aura_OS.System.Graphics.UI.GUI.Components;
1313
using Rectangle = Aura_OS.System.Graphics.UI.GUI.Rectangle;
1414
using Component = Aura_OS.System.Graphics.UI.GUI.Components.Component;
15+
using Aura_OS.System.Utils;
1516

1617
namespace Aura_OS
1718
{
@@ -22,6 +23,7 @@ public class WindowManager : IManager
2223
public Application FocusedApp { get; set; }
2324
public RightClick ContextMenu { get; set; }
2425
public byte WindowsTransparency { get; set; }
26+
public byte TaskbarTransparency { get; set; }
2527

2628
public List<Application> Applications;
2729
public List<Rectangle> ClipRects;
@@ -35,7 +37,20 @@ public void Initialize()
3537

3638
Applications = new List<Application>();
3739
ClipRects = new List<Rectangle>();
38-
WindowsTransparency = 0xFF;
40+
41+
if (Kernel.Installed)
42+
{
43+
Settings config = new Settings(@"0:\System\settings.ini");
44+
byte windowsTransparency = byte.Parse(config.GetValue("windowsTransparency"));
45+
byte taskbarTransparency = byte.Parse(config.GetValue("taskbarTransparency"));
46+
WindowsTransparency = windowsTransparency;
47+
TaskbarTransparency = taskbarTransparency;
48+
}
49+
else
50+
{
51+
WindowsTransparency = 0xFF;
52+
TaskbarTransparency = 0xFF;
53+
}
3954
}
4055

4156
public void AddComponent(Component component)
@@ -177,6 +192,10 @@ public void DrawComponentAndChildren(Component component)
177192
{
178193
_screen.DrawImageAlpha(component.GetBuffer(), component.X, component.Y, WindowsTransparency);
179194
}
195+
else if (component is Taskbar)
196+
{
197+
_screen.DrawImageAlpha(component.GetBuffer(), component.X, component.Y, TaskbarTransparency);
198+
}
180199
else
181200
{
182201
_screen.DrawImage(component.GetBuffer(), component.X, component.Y);

SRC/Aura_OS/System/Processing/ApplicationManager.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ public class ApplicationConfig
2121
public Type Template;
2222
public int X;
2323
public int Y;
24-
public int Weight;
24+
public int Width;
2525
public int Height;
2626

27-
public ApplicationConfig(Type template, int x, int y, int weight, int height)
27+
public ApplicationConfig(Type template, int x, int y, int width, int height)
2828
{
2929
Template = template;
3030
X = x;
3131
Y = y;
32-
Weight = weight;
32+
Width = width;
3333
Height = height;
3434
}
3535
}
@@ -57,17 +57,17 @@ public void LoadApplications()
5757
RegisterApplication(typeof(CubeApp), 40, 40, 200, 200);
5858
RegisterApplication(typeof(GameBoyApp), 40, 40, 160 + 6, 144 + 26);
5959
RegisterApplication(typeof(SampleApp), 40, 40, 500, 500);
60-
RegisterApplication(typeof(SettingsApp), 40, 40, 450, 350);
60+
RegisterApplication(typeof(SettingsApp), 40, 40, 340, 350);
6161
}
6262

6363
public void RegisterApplication(ApplicationConfig config)
6464
{
6565
ApplicationTemplates.Add(config);
6666
}
6767

68-
public void RegisterApplication(Type template, int x, int y, int weight, int height)
68+
public void RegisterApplication(Type template, int x, int y, int width, int height)
6969
{
70-
ApplicationConfig config = new(template, x, y, weight, height);
70+
ApplicationConfig config = new(template, x, y, width, height);
7171
ApplicationTemplates.Add(config);
7272
}
7373

@@ -116,39 +116,39 @@ public Application Instantiate(ApplicationConfig config)
116116

117117
if (config.Template == typeof(TerminalApp))
118118
{
119-
app = new TerminalApp(config.Weight, config.Height, config.X, config.Y);
119+
app = new TerminalApp(config.Width, config.Height, config.X, config.Y);
120120
}
121121
else if (config.Template == typeof(CubeApp))
122122
{
123-
app = new CubeApp(config.Weight, config.Height, config.X, config.Y);
123+
app = new CubeApp(config.Width, config.Height, config.X, config.Y);
124124
}
125125
else if (config.Template == typeof(SystemInfoApp))
126126
{
127-
app = new SystemInfoApp(config.Weight, config.Height, config.X, config.Y);
127+
app = new SystemInfoApp(config.Width, config.Height, config.X, config.Y);
128128
}
129129
else if (config.Template == typeof(MemoryInfoApp))
130130
{
131-
app = new MemoryInfoApp(config.Weight, config.Height, config.X, config.Y);
131+
app = new MemoryInfoApp(config.Width, config.Height, config.X, config.Y);
132132
}
133133
else if (config.Template == typeof(GameBoyApp))
134134
{
135-
app = new GameBoyApp(config.Weight, config.Height, config.X, config.Y);
135+
app = new GameBoyApp(config.Width, config.Height, config.X, config.Y);
136136
}
137137
else if (config.Template == typeof(SampleApp))
138138
{
139-
app = new SampleApp(config.Weight, config.Height, config.X, config.Y);
139+
app = new SampleApp(config.Width, config.Height, config.X, config.Y);
140140
}
141141
else if (config.Template == typeof(SettingsApp))
142142
{
143-
app = new SettingsApp(config.Weight, config.Height, config.X, config.Y);
143+
app = new SettingsApp(config.Width, config.Height, config.X, config.Y);
144144
}
145145
/*else if (config.Template == typeof(ExplorerApp))
146146
{
147147
app = new ExplorerApp(Kernel.CurrentVolume, config.Weight, config.Height, config.X, config.Y);
148148
}*/
149149
else if (config.Template == typeof(EditorApp))
150150
{
151-
app = new EditorApp("", config.Weight, config.Height, config.X, config.Y);
151+
app = new EditorApp("", config.Width, config.Height, config.X, config.Y);
152152
}
153153
else
154154
{

SRC/Aura_OS/System/Processing/Applications/SettingsApp.cs

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ public class SettingsApp : Application
2929
Label _themeBmpPathLabel;
3030
Label _themeXmlPathLabel;
3131
Label _windowsAlphaLabel;
32+
Label _taskbarAlphaLabel;
3233

3334
Checkbox _autoLogin;
3435

3536
Slider _windowsAlpha;
37+
Slider _taskbarAlpha;
3638

3739
Button _save;
3840

@@ -52,7 +54,8 @@ public SettingsApp(int width, int height, int x = 0, int y = 0) : base(Applicati
5254
_computerNameLabel = new Label("Computer Name: ", Color.Black, labelX, baseY + (23 + spacing) * 2);
5355
_themeBmpPathLabel = new Label("Theme BMP Path: ", Color.Black, labelX, baseY + (23 + spacing) * 3);
5456
_themeXmlPathLabel = new Label("Theme XML Path: ", Color.Black, labelX, baseY + (23 + spacing) * 4);
55-
_windowsAlphaLabel = new Label("Windows Alpha: ", Color.Black, labelX, baseY + (23 + spacing) * 6);
57+
_windowsAlphaLabel = new Label("Windows Alpha: ", Color.Black, labelX, baseY + (23 + spacing) * 5);
58+
_taskbarAlphaLabel = new Label("Taskbar Alpha: ", Color.Black, labelX, baseY + (23 + spacing) * 6);
5659

5760
int textBoxXOffset = 6 + (_themeXmlPathLabel.Text.Length * Kernel.font.Width);
5861

@@ -61,25 +64,34 @@ public SettingsApp(int width, int height, int x = 0, int y = 0) : base(Applicati
6164
_computerName = new TextBox(textBoxXOffset, baseY + (23 + spacing) * 2, 200, 23, "");
6265
_themeBmpPath = new TextBox(textBoxXOffset, baseY + (23 + spacing) * 3, 200, 23, "");
6366
_themeXmlPath = new TextBox(textBoxXOffset, baseY + (23 + spacing) * 4, 200, 23, "");
64-
65-
_windowsAlpha = new Slider(textBoxXOffset, baseY + (23 + spacing) * 6, 200, 23);
67+
_windowsAlpha = new Slider(textBoxXOffset, baseY + (23 + spacing) * 5, 200, 23);
68+
_taskbarAlpha = new Slider(textBoxXOffset, baseY + (23 + spacing) * 6, 200, 23);
6669

6770
if (Kernel.Installed)
6871
{
6972
Settings config = new Settings(@"0:\System\settings.ini");
7073
string autologin = config.GetValue("autologin");
74+
byte windowsTransparency = byte.Parse(config.GetValue("windowsTransparency"));
75+
_windowsAlpha.Value = windowsTransparency;
76+
byte taskbarTransparency = byte.Parse(config.GetValue("taskbarTransparency"));
77+
_taskbarAlpha.Value = taskbarTransparency;
7178

7279
if (autologin == "true")
7380
{
74-
_autoLogin = new Checkbox("Auto LogIn: ", Color.Black, labelX, baseY + (23 + spacing) * 5, true);
81+
_autoLogin = new Checkbox("Auto LogIn: ", Color.Black, labelX, baseY + (23 + spacing) * 7, true);
7582
}
7683
else
7784
{
78-
_autoLogin = new Checkbox("Auto LogIn: ", Color.Black, labelX, baseY + (23 + spacing) * 5);
85+
_autoLogin = new Checkbox("Auto LogIn: ", Color.Black, labelX, baseY + (23 + spacing) * 7);
7986
}
80-
}
8187

82-
_save = new Button("Save Settings", Width / 2 - 100 / 2, baseY + (23 + spacing) * 7, 100, 23);
88+
_save = new Button("Save Settings", Width / 2 - 100 / 2, baseY + (23 + spacing) * 8, 100, 23);
89+
}
90+
else
91+
{
92+
_save = new Button("Save Settings", Width / 2 - 100 / 2, baseY + (23 + spacing) * 7, 100, 23);
93+
}
94+
8395
_save.Click = new Action(() =>
8496
{
8597
_showDialog = true;
@@ -91,13 +103,16 @@ public SettingsApp(int width, int height, int x = 0, int y = 0) : base(Applicati
91103
Kernel.ThemeManager.BmpPath = _themeBmpPath.Text;
92104
Kernel.ThemeManager.XmlPath = _themeXmlPath.Text;
93105
Explorer.WindowManager.WindowsTransparency = (byte)_windowsAlpha.Value;
106+
Explorer.WindowManager.TaskbarTransparency = (byte)_taskbarAlpha.Value;
94107

95108
if (Kernel.Installed)
96109
{
97110
Settings config = new Settings(@"0:\System\settings.ini");
98111
config.EditValue("hostname", Kernel.ComputerName);
99112
config.EditValue("themeBmpPath", Kernel.ThemeManager.BmpPath);
100113
config.EditValue("themeXmlPath", Kernel.ThemeManager.XmlPath);
114+
config.EditValue("windowsTransparency", Explorer.WindowManager.WindowsTransparency.ToString());
115+
config.EditValue("taskbarTransparency", Explorer.WindowManager.TaskbarTransparency.ToString());
101116
if (_autoLogin.Checked)
102117
{
103118
config.EditValue("autologin", "true");
@@ -130,13 +145,15 @@ public SettingsApp(int width, int height, int x = 0, int y = 0) : base(Applicati
130145
AddChild(_themeBmpPath);
131146
AddChild(_themeXmlPath);
132147
AddChild(_windowsAlpha);
148+
AddChild(_taskbarAlpha);
133149

134150
AddChild(_usernameLabel);
135151
AddChild(_passwordLabel);
136152
AddChild(_computerNameLabel);
137153
AddChild(_themeBmpPathLabel);
138154
AddChild(_themeXmlPathLabel);
139155
AddChild(_windowsAlphaLabel);
156+
AddChild(_taskbarAlphaLabel);
140157

141158
AddChild(_dialog);
142159

@@ -164,6 +181,7 @@ public override void Update()
164181
_themeBmpPath.Update();
165182
_themeXmlPath.Update();
166183
_windowsAlpha.Update();
184+
_taskbarAlpha.Update();
167185

168186
if (Kernel.Installed)
169187
{
@@ -196,6 +214,8 @@ public override void Draw()
196214
_themeXmlPath.DrawInParent();
197215
_windowsAlpha.Update();
198216
_windowsAlpha.DrawInParent();
217+
_taskbarAlpha.Update();
218+
_taskbarAlpha.DrawInParent();
199219

200220
_usernameLabel.Draw();
201221
_usernameLabel.DrawInParent();
@@ -209,6 +229,8 @@ public override void Draw()
209229
_themeXmlPathLabel.DrawInParent();
210230
_windowsAlphaLabel.Update();
211231
_windowsAlphaLabel.DrawInParent();
232+
_taskbarAlphaLabel.Update();
233+
_taskbarAlphaLabel.DrawInParent();
212234

213235
if (Kernel.Installed)
214236
{

SRC/Aura_OS/System/Users/Setup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ public void Installation()
229229

230230
config.PutValue("themeBmpPath", @"0:\System\Themes\Suave.bmp");
231231
config.PutValue("themeXmlPath", @"0:\System\Themes\Suave.xml");
232+
config.PutValue("windowsTransparency", "255");
233+
config.PutValue("taskbarTransparency", "255");
232234

233235
config.PutValue("debugger", "off");
234236

0 commit comments

Comments
 (0)