Skip to content
Permalink
Browse files

more theme shit

  • Loading branch information...
alkalinethunder committed Apr 2, 2018
1 parent 59ab78d commit b614eb099e038efe29266705dc1c1b5bdab54c37
@@ -10,6 +10,7 @@
using Plex.Engine.Saves;
using Peacenet.CoreUtils;
using Plex.Engine.GraphicsSubsystem;
using Peacenet.PeacegateThemes;

namespace Peacenet.Applications
{
@@ -0,0 +1,112 @@
using Plex.Engine.GUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Plex.Engine;
using Plex.Engine.Themes;
using Peacenet.PeacegateThemes.PanelThemes;
using Microsoft.Xna.Framework;

namespace Peacenet.Applications
{
[AppLauncher("Desktop Panel Settings", "System", "Customize the look, feel and behaviour of the Peacegate Desktop panels.")]
public class DesktopPanelSettings : Window
{
private Label _panelThemeListHead = new Label();
private Label _panelThemeListDesc = new Label();

private ScrollView _panelThemeListScroller = new ScrollView();
private ListView _panelThemeList = new ListView();
private ScrollView _mainView = new ScrollView();
private Panel _mainPanel = new Panel();
private Button _apply = new Button();

[Dependency]
private ThemeManager _theme = null;

[Dependency]
private PeacenetThemeManager _pn = null;

public DesktopPanelSettings(WindowSystem _winsys) : base(_winsys)
{
Title = "Desktop Panel Settings";
SetWindowStyle(WindowStyle.Dialog);
Height = 580;
Width = 430;

AddChild(_apply);
AddChild(_mainView);
_mainView.AddChild(_mainPanel);
_mainPanel.AddChild(_panelThemeListHead);
_mainPanel.AddChild(_panelThemeListDesc);
_mainPanel.AddChild(_panelThemeListScroller);
_panelThemeListScroller.AddChild(_panelThemeList);

_apply.Text = "Apply";

_mainPanel.AutoSize = true;

_mainView.Width = 400;
_mainPanel.Width = 400;
_mainView.X = 15;
_mainView.Y = 15;


_panelThemeListHead.Text = "Panel theme";
_panelThemeListHead.AutoSize = true;
_panelThemeListHead.FontStyle = Plex.Engine.Themes.TextFontStyle.Header2;
_panelThemeListDesc.Text = "Panel Themes change the look and feel of the desktop panels, panel buttons, and Peacegate Menu button.";
_panelThemeListDesc.AutoSize = true;

_panelThemeListScroller.Height = 192;

_panelThemeList.Layout = ListViewLayout.List;
foreach (var theme in _pn.AvailablePanelThemes)
{
_panelThemeList.AddItem(new ListViewItem
{
Value = theme.Name,
Tag = theme
});
}
_panelThemeList.SelectedIndex = Array.IndexOf(_pn.AvailablePanelThemes, _pn.PanelTheme);

_apply.Click += (o, a) =>
{
if(_panelThemeList.SelectedItem != null)
{
_pn.PanelTheme = (PanelTheme)_panelThemeList.SelectedItem.Tag;
}
};
}

protected override void OnUpdate(GameTime time)
{
_mainView.X = 15;
_mainView.Y = 15;
_mainView.Width = Width - 30;
_mainPanel.Width = _mainView.Width;

_apply.X = (Width - _apply.Width) - 15;
_apply.Y = (Height - _apply.Height) - 15;

_mainView.Height = _apply.Y - 20;

_panelThemeListHead.X = 10;
_panelThemeListHead.Y = 10;
_panelThemeListHead.MaxWidth = _mainPanel.Width - 20;
_panelThemeListDesc.X = 10;
_panelThemeListDesc.Y = _panelThemeListHead.Y + _panelThemeListHead.Height + 5;
_panelThemeListDesc.MaxWidth = _panelThemeListHead.MaxWidth;

_panelThemeListScroller.X = 10;
_panelThemeListScroller.Width = _panelThemeListHead.MaxWidth;
_panelThemeListScroller.Y = _panelThemeListDesc.Y + _panelThemeListDesc.Height + 10;
_panelThemeList.Width = _panelThemeListScroller.Width;

base.OnUpdate(time);
}
}
}
@@ -10,6 +10,7 @@
using Plex.Engine;
using Plex.Engine.Config;
using System.Reflection;
using Peacenet.PeacegateThemes;

namespace Peacenet.Applications
{
@@ -0,0 +1,118 @@
using Plex.Engine.GUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Plex.Engine;
using Plex.Engine.Themes;
using Microsoft.Xna.Framework;

namespace Peacenet.Applications
{
[AppLauncher("Theme Chooser", "System", "Choose the UI theme and window border style for Peacegate OS.")]
public class ThemeChooser : Window
{
[Dependency]
private ThemeManager _theme = null;

[Dependency]
private PeacenetThemeManager _pn = null;

[Dependency]
private Plexgate _plexgate = null;

private PictureBox _preview = new PictureBox();
private ListView _themeList = new ListView();
private ScrollView _themeView = new ScrollView();

private Label _themeName = new Label();
private Label _themeDesc = new Label();

private Button _apply = new Button();

public ThemeChooser(WindowSystem _winsys) : base(_winsys)
{
Title = "Theme chooser";
_preview.Width = 448;
_preview.Height = 252;

_themeView.Width = 300;
Width = (_preview.Width + _themeView.Width) + 40;

AddChild(_preview);
AddChild(_themeView);
_themeView.AddChild(_themeList);

_themeList.Layout = ListViewLayout.List;

foreach (var item in _pn.Themes)
_themeList.AddItem(new ListViewItem
{
Value = item.Name,
Tag = item
});

int index = Array.IndexOf(_pn.Themes, _pn.Themes.FirstOrDefault(x => x.ThemeType == _theme.Theme.GetType()));
_themeList.SelectedIndex = index;

_apply.Text = "Apply theme";

AddChild(_apply);
AddChild(_themeName);
AddChild(_themeDesc);

_themeName.AutoSize = true;
_themeDesc.AutoSize = true;
_themeName.FontStyle = TextFontStyle.Header3;

_apply.Click += (o,a) =>
{
if (_themeList.SelectedItem == null)
return;
var themeinfo = (ThemeInfo)_themeList.SelectedItem.Tag;
var instance = (Theme)_plexgate.New(themeinfo.ThemeType);
_theme.Theme = instance;
};
}

protected override void OnUpdate(GameTime time)
{
_preview.X = 15;
_preview.Y = 15;

_themeView.Y = _preview.Y;
_themeView.X = _preview.X + _preview.Width + 5;

_themeList.X = 0;
_themeList.Y = 0;
_themeList.Width = _themeView.Width;

if(_themeList.SelectedItem != null)
{
var info = (_themeList.SelectedItem.Tag as ThemeInfo);
_preview.Texture = info.Preview;
_themeName.Text = info.Name;
_themeDesc.Text = info.Description;
}
_preview.Layout = System.Windows.Forms.ImageLayout.Zoom;

_themeName.MaxWidth = _preview.Width;
_themeDesc.MaxWidth = _preview.Width;

_themeName.X = _preview.X;
_themeName.Y = _preview.Y + _preview.Height + 10;
_themeDesc.X = _themeName.X;
_themeDesc.Y = _themeName.Y + _themeName.Height + 5;

Height = _themeDesc.Y + _themeDesc.Height + 15;

_apply.Y = (Height - _apply.Height) - 15;
_apply.X = (Width - _apply.Width) - 15;

_themeView.Height = _apply.Y - 25;

base.OnUpdate(time);
}
}
}
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit b614eb0

Please sign in to comment.
You can’t perform that action at this time.