aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-07-23 15:25:46 -0400
committerMichaelTheShifter <[email protected]>2016-07-23 15:25:46 -0400
commitdcb7c04de1ac07f7004af7d5af8450308ba2e29d (patch)
tree15d583841b3a0484e690188c59e579a21ebac428
parentf8b13cfa2a571e982d8e52423b4d217ff79f62f6 (diff)
downloadshiftos-c--dcb7c04de1ac07f7004af7d5af8450308ba2e29d.tar.gz
shiftos-c--dcb7c04de1ac07f7004af7d5af8450308ba2e29d.tar.bz2
shiftos-c--dcb7c04de1ac07f7004af7d5af8450308ba2e29d.zip
Fix panel buttons
-rw-r--r--source/WindowsFormsApplication1/Apps/Shifter.cs24
-rw-r--r--source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs9
-rw-r--r--source/WindowsFormsApplication1/SkinEngine/skins.cs44
3 files changed, 59 insertions, 18 deletions
diff --git a/source/WindowsFormsApplication1/Apps/Shifter.cs b/source/WindowsFormsApplication1/Apps/Shifter.cs
index ff618cb..3e16184 100644
--- a/source/WindowsFormsApplication1/Apps/Shifter.cs
+++ b/source/WindowsFormsApplication1/Apps/Shifter.cs
@@ -36,14 +36,14 @@ select new { Type = t, Attributes = attributes.Cast<ShifterCategoryAttribute>()
btn.Text = type.Attributes.First().Name;
btn.Click += (o, a) =>
{
- ShowAllPropertyGridsInCategory(btn.Text);
+ ShowAllPropertyGridsInCategory(Activator.CreateInstance(type.Type));
};
pnlcategories.Widgets.Add(btn);
btn.Show();
}
}
- public void ShowAllPropertyGridsInCategory(string cat)
+ public void ShowAllPropertyGridsInCategory(object cls)
{
}
@@ -53,13 +53,33 @@ select new { Type = t, Attributes = attributes.Cast<ShifterCategoryAttribute>()
[ShifterPropertyGrid("Desktop")]
public class ShifterDesktopSettings
{
+ [Upgrade("skinning")]
[SkinMap("images/desktopbackground")]
public Image DesktopBackground { get; set; }
+ [Upgrade("shiftdesktopbackground")]
[SkinMap("skin/desktopbackgroundcolour")]
public Color DesktopBackgroundColor { get; set; }
}
+ public class UpgradeAttribute : Attribute
+ {
+ public UpgradeAttribute(string upgrade)
+ {
+ upg = upgrade;
+ }
+
+ private string upg = "";
+
+ public bool UpgradeInstalled
+ {
+ get
+ {
+ return API.Upgrades[upg];
+ }
+ }
+ }
+
public class SkinMapAttribute : Attribute
{
public SkinMapAttribute(string varName)
diff --git a/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs b/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
index d8be8a0..6d8af77 100644
--- a/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
+++ b/source/WindowsFormsApplication1/Desktop/ShiftOSDesktop.cs
@@ -170,6 +170,15 @@ namespace ShiftOS
private void ShiftOSDesktop_Load(object sender, EventArgs e)
{
+ this.pnlpanelbuttonholder.AutoSize = false;
+ this.pnlpanelbuttonholder.WidgetAdded += (o, a) =>
+ {
+ pnlpanelbuttonholder.Width += a.Widget.Width + API.CurrentSkin.panelbuttongap;
+ };
+ this.pnlpanelbuttonholder.WidgetRemoved += (o, a) =>
+ {
+ pnlpanelbuttonholder.Width -= a.Widget.Width + API.CurrentSkin.panelbuttongap;
+ };
Viruses.CheckForInfected();
this.ShowInTaskbar = false;
this.FormBorderStyle = FormBorderStyle.None;
diff --git a/source/WindowsFormsApplication1/SkinEngine/skins.cs b/source/WindowsFormsApplication1/SkinEngine/skins.cs
index d18770d..b9688ba 100644
--- a/source/WindowsFormsApplication1/SkinEngine/skins.cs
+++ b/source/WindowsFormsApplication1/SkinEngine/skins.cs
@@ -574,33 +574,45 @@ namespace Skinning
/// </summary>
public static void loadskin()
{
- if (Directory.Exists(Paths.LoadedSkin))
+ try
{
- string rawData = File.ReadAllText(Paths.LoadedSkin + "data.json");
- loadedSkin = JsonConvert.DeserializeObject<Skin>(rawData);
- if (File.Exists(Paths.LoadedSkin + "panels.json"))
+ if (Directory.Exists(Paths.LoadedSkin))
{
- try
- {
- string panels = File.ReadAllText(Paths.LoadedSkin + "panels.json");
- loadedSkin.DesktopPanels = JsonConvert.DeserializeObject<List<DesktopPanel>>(panels);
- Application.LoadSkin(loadedSkin); //Send the skin to ShiftUI so buttons and stuff get rendered with custom colors.
- LoadPanels();
- }
- catch
+ string rawData = File.ReadAllText(Paths.LoadedSkin + "data.json");
+ loadedSkin = JsonConvert.DeserializeObject<Skin>(rawData);
+ if (File.Exists(Paths.LoadedSkin + "panels.json"))
{
+ try
+ {
+ string panels = File.ReadAllText(Paths.LoadedSkin + "panels.json");
+ loadedSkin.DesktopPanels = JsonConvert.DeserializeObject<List<DesktopPanel>>(panels);
+ Application.LoadSkin(loadedSkin); //Send the skin to ShiftUI so buttons and stuff get rendered with custom colors.
+ LoadPanels();
+ }
+ catch
+ {
+ }
}
- }
- loadimages();
- LoadEmbeddedNamePack();
+ loadimages();
+ LoadEmbeddedNamePack();
+ }
+ else
+ {
+ loadedSkin = new Skin();
+ Application.LoadSkin(loadedSkin);
+ loadedskin_images = new Images();
+ saveskin();
+ }
}
- else
+ catch
{
loadedSkin = new Skin();
+ Application.LoadSkin(loadedSkin);
loadedskin_images = new Images();
saveskin();
+
}
}