Skin Loader for BWM added

Next skinning upgrade has been added, which is the Skin Loader that
allows you to save and load skins.
This commit is contained in:
TheUltimateHacker 2015-05-29 12:39:04 -04:00
parent ccdbbbed18
commit 2bed5c22ff
17 changed files with 405 additions and 7 deletions

Binary file not shown.

View file

@ -47,6 +47,23 @@
BasicWM.Desktop.Redraw()
End Sub
'Copy skin file to save data
Public Sub loadskin(file As String)
If IO.Directory.Exists(bwmskin) Then
IO.Directory.Delete(bwmskin, True)
IO.Directory.CreateDirectory(bwmskin)
IO.File.Copy(file, bwmskin + "data.bsk")
loadskindata()
End If
End Sub
'Copy skin from save data to file
Public Sub saveskin(file As String)
Dim savelines() As String = IO.File.ReadAllLines(bwmskin + "data.bsk")
IO.File.WriteAllLines(file, savelines)
End Sub
#End Region

View file

@ -0,0 +1,170 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class SkinLoader
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Titlebar = New shiftos_next.Titlebar()
Me.Label1 = New System.Windows.Forms.Label()
Me.pnlwindowpreview = New System.Windows.Forms.Panel()
Me.prev_titlebar = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.prev_desktop = New System.Windows.Forms.Panel()
Me.prev_newterminal = New System.Windows.Forms.Button()
Me.btnapply = New System.Windows.Forms.Button()
Me.btnload = New System.Windows.Forms.Button()
Me.btnsave = New System.Windows.Forms.Button()
Me.pnlwindowpreview.SuspendLayout()
Me.prev_desktop.SuspendLayout()
Me.SuspendLayout()
'
'Titlebar
'
Me.Titlebar.AppName = "Skin Loader"
Me.Titlebar.Dock = System.Windows.Forms.DockStyle.Top
Me.Titlebar.Font = New System.Drawing.Font("Courier New", 8.25!)
Me.Titlebar.ForeColor = System.Drawing.Color.White
Me.Titlebar.Location = New System.Drawing.Point(0, 0)
Me.Titlebar.Name = "Titlebar"
Me.Titlebar.Size = New System.Drawing.Size(458, 32)
Me.Titlebar.TabIndex = 0
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 53)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(119, 14)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Preview (Window)"
'
'pnlwindowpreview
'
Me.pnlwindowpreview.Controls.Add(Me.prev_titlebar)
Me.pnlwindowpreview.Location = New System.Drawing.Point(15, 84)
Me.pnlwindowpreview.Name = "pnlwindowpreview"
Me.pnlwindowpreview.Size = New System.Drawing.Size(431, 127)
Me.pnlwindowpreview.TabIndex = 2
'
'prev_titlebar
'
Me.prev_titlebar.BackColor = System.Drawing.Color.Gray
Me.prev_titlebar.Dock = System.Windows.Forms.DockStyle.Top
Me.prev_titlebar.Location = New System.Drawing.Point(0, 0)
Me.prev_titlebar.Name = "prev_titlebar"
Me.prev_titlebar.Size = New System.Drawing.Size(431, 30)
Me.prev_titlebar.TabIndex = 0
Me.prev_titlebar.Text = "Application"
Me.prev_titlebar.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(15, 227)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(126, 14)
Me.Label2.TabIndex = 3
Me.Label2.Text = "Preview (Desktop)"
'
'prev_desktop
'
Me.prev_desktop.Controls.Add(Me.prev_newterminal)
Me.prev_desktop.Location = New System.Drawing.Point(15, 244)
Me.prev_desktop.Name = "prev_desktop"
Me.prev_desktop.Size = New System.Drawing.Size(431, 161)
Me.prev_desktop.TabIndex = 4
'
'prev_newterminal
'
Me.prev_newterminal.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.prev_newterminal.Location = New System.Drawing.Point(17, 13)
Me.prev_newterminal.Name = "prev_newterminal"
Me.prev_newterminal.Size = New System.Drawing.Size(109, 23)
Me.prev_newterminal.TabIndex = 0
Me.prev_newterminal.Text = "New Terminal"
Me.prev_newterminal.UseVisualStyleBackColor = True
'
'btnapply
'
Me.btnapply.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnapply.Location = New System.Drawing.Point(338, 417)
Me.btnapply.Name = "btnapply"
Me.btnapply.Size = New System.Drawing.Size(108, 23)
Me.btnapply.TabIndex = 5
Me.btnapply.Text = "Apply Skin"
Me.btnapply.UseVisualStyleBackColor = True
'
'btnload
'
Me.btnload.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnload.Location = New System.Drawing.Point(207, 417)
Me.btnload.Name = "btnload"
Me.btnload.Size = New System.Drawing.Size(125, 23)
Me.btnload.TabIndex = 6
Me.btnload.Text = "Load from File"
Me.btnload.UseVisualStyleBackColor = True
'
'btnsave
'
Me.btnsave.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnsave.Location = New System.Drawing.Point(93, 417)
Me.btnsave.Name = "btnsave"
Me.btnsave.Size = New System.Drawing.Size(108, 23)
Me.btnsave.TabIndex = 7
Me.btnsave.Text = "Save to File"
Me.btnsave.UseVisualStyleBackColor = True
'
'SkinLoader
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 14.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Black
Me.ClientSize = New System.Drawing.Size(458, 452)
Me.Controls.Add(Me.btnsave)
Me.Controls.Add(Me.btnload)
Me.Controls.Add(Me.btnapply)
Me.Controls.Add(Me.prev_desktop)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.pnlwindowpreview)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Titlebar)
Me.Font = New System.Drawing.Font("Courier New", 8.25!)
Me.ForeColor = System.Drawing.Color.White
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Name = "SkinLoader"
Me.Text = "SkinLoader"
Me.pnlwindowpreview.ResumeLayout(False)
Me.prev_desktop.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Titlebar As shiftos_next.Titlebar
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents pnlwindowpreview As System.Windows.Forms.Panel
Friend WithEvents prev_titlebar As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents prev_desktop As System.Windows.Forms.Panel
Friend WithEvents prev_newterminal As System.Windows.Forms.Button
Friend WithEvents btnapply As System.Windows.Forms.Button
Friend WithEvents btnload As System.Windows.Forms.Button
Friend WithEvents btnsave As System.Windows.Forms.Button
End Class

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,39 @@
Public Class SkinLoader
Public skintoload As String
Public Sub readfile(file As String)
Dim filinf As New IO.FileInfo(file)
If filinf.Extension = ".bsk" Then
Dim loadlines() As String = IO.File.ReadAllLines(file)
prev_titlebar.BackColor = Color.FromArgb(loadlines(0))
prev_titlebar.ForeColor = Color.FromArgb(loadlines(1))
prev_desktop.BackColor = Color.FromArgb(loadlines(2))
prev_newterminal.BackColor = Color.FromArgb(loadlines(3))
prev_newterminal.ForeColor = Color.FromArgb(loadlines(4))
Else
basicwm_infobox.showinfo("Unsupported file", "The skin file provided cannot be read.")
End If
End Sub
Private Sub btnload_Click(sender As Object, e As EventArgs) Handles btnload.Click
file_skimmer.mode = "open"
file_skimmer.application = "skin_loader"
file_skimmer.Show()
End Sub
Private Sub btnapply_Click(sender As Object, e As EventArgs) Handles btnapply.Click
If Not skintoload = "" Then
loadskin(skintoload)
Else
basicwm_infobox.showinfo("Can't apply skin!", "Cannot apply the skin, as there is currently no skin file loaded.")
End If
End Sub
Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles btnsave.Click
file_skimmer.mode = "save"
file_skimmer.application = "skin_loader"
file_skimmer.Show()
End Sub
End Class

View file

@ -46,6 +46,7 @@ Partial Class file_skimmer
Me.Label1 = New System.Windows.Forms.Label()
Me.btnsave = New System.Windows.Forms.Button()
Me.pnltop = New shiftos_next.Titlebar()
Me.lbextension = New System.Windows.Forms.Label()
Me.topmenu.SuspendLayout()
Me.tools.SuspendLayout()
Me.pnlsave.SuspendLayout()
@ -176,6 +177,7 @@ Partial Class file_skimmer
'
'pnlsave
'
Me.pnlsave.Controls.Add(Me.lbextension)
Me.pnlsave.Controls.Add(Me.txtfilename)
Me.pnlsave.Controls.Add(Me.Label1)
Me.pnlsave.Controls.Add(Me.btnsave)
@ -191,7 +193,7 @@ Partial Class file_skimmer
Me.txtfilename.ForeColor = System.Drawing.Color.White
Me.txtfilename.Location = New System.Drawing.Point(86, 5)
Me.txtfilename.Name = "txtfilename"
Me.txtfilename.Size = New System.Drawing.Size(421, 20)
Me.txtfilename.Size = New System.Drawing.Size(376, 20)
Me.txtfilename.TabIndex = 2
'
'Label1
@ -225,6 +227,15 @@ Partial Class file_skimmer
Me.pnltop.Size = New System.Drawing.Size(591, 32)
Me.pnltop.TabIndex = 5
'
'lbextension
'
Me.lbextension.AutoSize = True
Me.lbextension.Location = New System.Drawing.Point(468, 8)
Me.lbextension.Name = "lbextension"
Me.lbextension.Size = New System.Drawing.Size(35, 14)
Me.lbextension.TabIndex = 3
Me.lbextension.Text = ".xxx"
'
'file_skimmer
'
Me.AcceptButton = Me.btnsave
@ -277,4 +288,5 @@ Partial Class file_skimmer
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents btnsave As System.Windows.Forms.Button
Friend WithEvents pnltop As shiftos_next.Titlebar
Friend WithEvents lbextension As System.Windows.Forms.Label
End Class

View file

@ -63,6 +63,8 @@
FileType = "Data File"
Case ".dri"
FileType = "Driver"
Case ".bsk"
FileType = "Basic WM Skin"
Case Else
FileType = "Unknown File"
End Select
@ -76,8 +78,21 @@
Else
Dim filinf As New IO.FileInfo(file)
Select Case filinf.Extension
Case ".txt"
If boughttextpad = True Then
Dim sr As New IO.StreamReader(file)
TextPad.txtfilebody.Text = sr.ReadToEnd()
sr.Close()
TextPad.Show()
Else
basicwm_infobox.showinfo("File can't be opened.", "The file """ & filinf.Name & """ can't be opened because a program able to open it has not been found.")
End If
Case ".bsk"
SkinLoader.readfile(file)
SkinLoader.skintoload = file
SkinLoader.Show()
Case Else
basicwm_infobox.showinfo("Exodus - File Format not valid", "The format of the file """ & filinf.Name & """ is not a format in which Exodus File Browser can read.")
basicwm_infobox.showinfo("File can't be opened.", "The file """ & filinf.Name & """ can't be opened because a program able to open it has not been found.")
End Select
End If
End Sub
@ -90,11 +105,18 @@
End If
Else
If mode = "open" Then
Select Case Application
Dim filinf As New IO.FileInfo(lvfiles.SelectedItems(0).Tag)
Select Case application
Case "textpad"
Dim sr As New IO.StreamReader(lvfiles.SelectedItems(0).Tag.ToString)
TextPad.txtfilebody.Text = sr.ReadToEnd()
sr.Close()
If filinf.Extension = ".txt" Then
Dim sr As New IO.StreamReader(lvfiles.SelectedItems(0).Tag.ToString)
TextPad.txtfilebody.Text = sr.ReadToEnd()
sr.Close()
Me.Close()
End If
Case "skin_loader"
SkinLoader.readfile(lvfiles.SelectedItems(0).Tag.ToString)
SkinLoader.skintoload = lvfiles.SelectedItems(0).Tag.ToString
Me.Close()
End Select
Else
@ -120,6 +142,12 @@
btndelete.Visible = boughtfileskimmerdelete
If mode = "save" Then
pnlsave.Visible = True
Select Case application
Case "textpad"
lbextension.Text = ".txt"
Case "skin_loader"
lbextension.Text = ".bsk"
End Select
Else
pnlsave.Visible = False
End If
@ -165,10 +193,12 @@
Else
Select Case Application
Case "textpad"
Dim sw As New IO.StreamWriter(currentdir + "\" + txtfilename.Text)
Dim sw As New IO.StreamWriter(currentdir + "\" + txtfilename.Text + ".txt")
sw.Write(TextPad.txtfilebody.Text)
sw.Close()
Me.Close()
Case "skin_loader"
saveskin(currentdir + "\" + txtfilename.Text + ".bsk")
End Select
End If
Else

View file

@ -45,3 +45,4 @@ C:\Users\Michael\Documents\GitHub\shiftos-next\shiftos_next\bin\Debug\shiftos_ne
C:\Users\Michael\Documents\GitHub\shiftos-next\shiftos_next\bin\Debug\shiftos_next.xml
C:\Users\Michael\Documents\GitHub\shiftos-next\shiftos_next\obj\Debug\shiftos_next.Titlebar.resources
C:\Users\Michael\Documents\GitHub\shiftos-next\shiftos_next\obj\Debug\shiftos_next.Shifter.resources
C:\Users\Michael\Documents\GitHub\shiftos-next\shiftos_next\obj\Debug\shiftos_next.SkinLoader.resources

View file

@ -78,6 +78,12 @@
<Compile Include="BWM and CMD Apps\Shifter.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="BWM and CMD Apps\SkinLoader.Designer.vb">
<DependentUpon>SkinLoader.vb</DependentUpon>
</Compile>
<Compile Include="BWM and CMD Apps\SkinLoader.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Menu Renderers\BasicWM_ColorTable.vb" />
<Compile Include="BWM and CMD Apps\basicwm_infobox.Designer.vb">
<DependentUpon>basicwm_infobox.vb</DependentUpon>
@ -161,6 +167,9 @@
<EmbeddedResource Include="BWM and CMD Apps\Shifter.resx">
<DependentUpon>Shifter.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BWM and CMD Apps\SkinLoader.resx">
<DependentUpon>SkinLoader.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BWM User Controls\Titlebar.resx">
<DependentUpon>Titlebar.vb</DependentUpon>
</EmbeddedResource>