forked from wrldspawn/Themer
cleanup
- code style consistency - removed unused vars for cvars that never existed - slight optimization of loops - merge settings categories into one - force tool panel labels to fix colors on apply (to the best of ability) - fix gear icon not applying to utilities tab
This commit is contained in:
parent
2124e64dd1
commit
a1c373aeb0
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 0x3bb Solutions
|
||||
Copyright (c) 2017-2024 0x3bb Solutions
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,3 +1,2 @@
|
||||
# [Themer](https://steamcommunity.com/sharedfiles/filedetails/?id=938347376)
|
||||
Themer is a utility to replace derma themes on the fly without overwriting files.
|
||||
|
||||
Themer is a utility to replace Derma themes or switch skins on the fly without overwriting files.
|
||||
|
@ -2,15 +2,16 @@
|
||||
"description": "A tool to make derma skin application easier.",
|
||||
"ignore": [
|
||||
"*.psd",
|
||||
".git/*",
|
||||
".gitignore",
|
||||
"icon.jpg",
|
||||
"themer.gma",
|
||||
"README.md"
|
||||
".git/*",
|
||||
".gitignore",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"logo": "icon.jpg",
|
||||
"tags": ["build", "scenic"],
|
||||
"title": "Themer",
|
||||
"type": "tool",
|
||||
"workshopid": 938347376.0
|
||||
"workshopid": 938347376
|
||||
}
|
||||
|
@ -5,20 +5,22 @@ AddCSLuaFile("themer/spawnmenu.lua")
|
||||
|
||||
if SERVER then
|
||||
resource.AddWorkshop("938347376")
|
||||
|
||||
return
|
||||
end
|
||||
include'skins/themer.lua'
|
||||
|
||||
surface.CreateFont("Themer.Title",{
|
||||
include("skins/themer.lua")
|
||||
|
||||
surface.CreateFont("Themer.Title", {
|
||||
font = "Roboto",
|
||||
size = 48,
|
||||
weight = 400,
|
||||
})
|
||||
|
||||
surface.CreateFont("Themer.Title2",{
|
||||
surface.CreateFont("Themer.Title2", {
|
||||
font = "Roboto",
|
||||
size = 32,
|
||||
weight = 400,
|
||||
})
|
||||
|
||||
include'themer/main.lua'
|
||||
include("themer/main.lua")
|
||||
|
1111
lua/skins/themer.lua
1111
lua/skins/themer.lua
File diff suppressed because it is too large
Load Diff
@ -1,32 +1,43 @@
|
||||
local function iconbrowser()
|
||||
local frame = vgui.Create("DFrame")
|
||||
frame:SetSize(400,300)
|
||||
frame:SetPos(5,ScrH()-305)
|
||||
frame:SetTitle("Icon Browser")
|
||||
frame:MakePopup()
|
||||
frame:SetIcon("icon16/folder_picture.png")
|
||||
local path_pnl = vgui.Create("EditablePanel",frame)
|
||||
path_pnl:Dock(TOP)
|
||||
path_pnl:DockMargin(4,0,4,4)
|
||||
path_pnl:SetTall(24)
|
||||
local path = vgui.Create("DTextEntry",path_pnl)
|
||||
path:SetText("")
|
||||
path:Dock(FILL)
|
||||
path:SetEditable(false)
|
||||
local copy = vgui.Create("DButton",path_pnl)
|
||||
copy:Dock(RIGHT)
|
||||
copy:SetWide(24)
|
||||
copy:SetImage("icon16/page_copy.png")
|
||||
copy:SetText("")
|
||||
function copy:DoClick()
|
||||
SetClipboardText(path:GetText())
|
||||
local frame = vgui.Create("DFrame") do
|
||||
frame:SetSize(400, 300)
|
||||
frame:SetPos(5, ScrH() - 305)
|
||||
frame:SetTitle("Icon Browser")
|
||||
frame:MakePopup()
|
||||
frame:SetIcon("icon16/folder_picture.png")
|
||||
end
|
||||
local browser = vgui.Create("DIconBrowser",frame)
|
||||
browser:Dock(FILL)
|
||||
browser:DockMargin(4,0,4,4)
|
||||
function browser:OnChange()
|
||||
path:SetText(self:GetSelectedIcon())
|
||||
|
||||
local top_wrapper = vgui.Create("EditablePanel", frame) do
|
||||
top_wrapper:Dock(TOP)
|
||||
top_wrapper:DockMargin(4, 0, 4, 4)
|
||||
top_wrapper:SetTall(24)
|
||||
end
|
||||
|
||||
local path = vgui.Create("DTextEntry", top_wrapper) do
|
||||
path:SetText("")
|
||||
path:Dock(FILL)
|
||||
path:SetEditable(false)
|
||||
end
|
||||
|
||||
local copy = vgui.Create("DButton", top_wrapper) do
|
||||
copy:Dock(RIGHT)
|
||||
copy:SetWide(24)
|
||||
copy:SetImage("icon16/page_copy.png")
|
||||
copy:SetText("")
|
||||
|
||||
function copy:DoClick()
|
||||
SetClipboardText(path:GetText())
|
||||
end
|
||||
end
|
||||
|
||||
local browser = vgui.Create("DIconBrowser", frame) do
|
||||
browser:Dock(FILL)
|
||||
browser:DockMargin(4,0,4,4)
|
||||
|
||||
function browser:OnChange()
|
||||
path:SetText(self:GetSelectedIcon())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
concommand.Add("themer_iconbrowser",iconbrowser)
|
||||
concommand.Add("themer_iconbrowser", iconbrowser)
|
||||
|
@ -1,15 +1,7 @@
|
||||
include("themer/iconbrowser.lua")
|
||||
include("themer/spawnmenu.lua")
|
||||
|
||||
--[[
|
||||
File: themer/main.lua
|
||||
Info: This file loads everything and contains the main code of stuff
|
||||
--]]
|
||||
|
||||
--cvars
|
||||
-- {{ cvars
|
||||
local themer_enabled = CreateClientConVar("themer_enabled", "1", true)
|
||||
local derma_skinname = CreateClientConVar("derma_skinname", "gmoddefault", true)
|
||||
local themer_skin = CreateClientConVar("themer_skin", "themer", true)
|
||||
local themer_skin = CreateClientConVar("themer_skin", "themer", true)
|
||||
|
||||
local themer_options_gear = CreateClientConVar("themer_options_gear", "0", true)
|
||||
local themer_spawnlist_icons = CreateClientConVar("themer_spawnlist_icons", "0", true)
|
||||
@ -22,8 +14,12 @@ local themer_icon_cars = CreateClientConVar("themer_icon_cars", "ico
|
||||
local themer_icon_pp = CreateClientConVar("themer_icon_pp", "icon16/image.png", true)
|
||||
local themer_icon_dupes = CreateClientConVar("themer_icon_dupes", "icon16/brick_link.png", true)
|
||||
local themer_icon_saves = CreateClientConVar("themer_icon_saves", "icon16/disk.png", true)
|
||||
-- }}}
|
||||
|
||||
-- helpers
|
||||
include("themer/iconbrowser.lua")
|
||||
include("themer/spawnmenu.lua")
|
||||
|
||||
-- {{{ helpers
|
||||
local function getupvalues(f)
|
||||
local i, t = 0, {}
|
||||
|
||||
@ -36,11 +32,12 @@ local function getupvalues(f)
|
||||
|
||||
return t
|
||||
end
|
||||
-- }}}
|
||||
|
||||
--Main loading
|
||||
local function ColorHack()
|
||||
local DMenuOption = table.Copy(vgui.GetControlTable("DMenuOption"))
|
||||
local DComboBox = table.Copy(vgui.GetControlTable("DComboBox"))
|
||||
|
||||
DMenuOption.Init = function(self)
|
||||
self:SetContentAlignment(4)
|
||||
self:SetTextInset(30,0)
|
||||
@ -71,10 +68,11 @@ local function ColorHack()
|
||||
return self:SetTextStyleColor(skin.Colours.Label.Dark)
|
||||
end
|
||||
|
||||
derma.DefineControl( "DComboBox", "", DComboBox, "DButton" )
|
||||
derma.DefineControl("DComboBox", "", DComboBox, "DButton")
|
||||
|
||||
local DProperties = table.Copy(vgui.GetControlTable("DProperties"))
|
||||
local tblCategory = getupvalues(DProperties.GetCategory).tblCategory
|
||||
|
||||
DProperties.GetCategory = function(self, name, bCreate)
|
||||
local cat = self.Categories[name]
|
||||
if IsValid(cat) then return cat end
|
||||
@ -98,114 +96,154 @@ local function ColorHack()
|
||||
local DTree_Node_Button = table.Copy(vgui.GetControlTable("DTree_Node_Button"))
|
||||
DTree_Node_Button.UpdateColours = function(self, skin)
|
||||
-- m_bSelectable is false on this for some reason
|
||||
if self.m_bSelected then return self:SetTextStyleColor( skin.Colours.Tree.Selected ) end
|
||||
if self.Hovered then return self:SetTextStyleColor( skin.Colours.Tree.Hover ) end
|
||||
if self.m_bSelected then
|
||||
return self:SetTextStyleColor(skin.Colours.Tree.Selected)
|
||||
end
|
||||
if self.Hovered then
|
||||
return self:SetTextStyleColor(skin.Colours.Tree.Hover)
|
||||
end
|
||||
|
||||
return self:SetTextStyleColor( skin.Colours.Tree.Normal )
|
||||
return self:SetTextStyleColor(skin.Colours.Tree.Normal)
|
||||
end
|
||||
derma.DefineControl( "DTree_Node_Button", "Tree Node Button", DTree_Node_Button, "DButton" )
|
||||
derma.DefineControl("DTree_Node_Button", "Tree Node Button", DTree_Node_Button, "DButton")
|
||||
end
|
||||
|
||||
hook.Add("ForceDermaSkin","Themer",function()
|
||||
if themer_enabled:GetBool() then return themer_skin:GetString() or "themer" end
|
||||
hook.Add("ForceDermaSkin", "Themer", function()
|
||||
if themer_enabled:GetBool() then
|
||||
return themer_skin:GetString() or "themer"
|
||||
end
|
||||
end)
|
||||
|
||||
concommand.Add("themer_refresh_derma",function()
|
||||
include("skins/themer.lua")
|
||||
derma.RefreshSkins()
|
||||
ColorHack()
|
||||
|
||||
for k,v in pairs(hook.GetTable()["ForceDermaSkin"]) do
|
||||
if k ~= "Themer" then
|
||||
hook.Remove("ForceDermaSkin", k)
|
||||
local hooks = hook.GetTable()
|
||||
for name in pairs(hooks.ForceDermaSkin) do
|
||||
if name == "Themer" then continue end
|
||||
|
||||
hook.Remove("ForceDermaSkin", name)
|
||||
end
|
||||
|
||||
if IsValid(g_SpawnMenu) then
|
||||
for _, tab in ipairs(g_SpawnMenu.ToolMenu.Items) do
|
||||
local tool_panel = tab.Panel
|
||||
if IsValid(tool_panel) and IsValid(tool_panel.Content) then
|
||||
tool_panel = tool_panel.Content:GetCanvas()
|
||||
end
|
||||
|
||||
if IsValid(tool_panel) then
|
||||
for _, panel in ipairs(tool_panel:GetChildren()) do
|
||||
local function recurse(c)
|
||||
if #c == 0 then return end
|
||||
|
||||
for _, panel in ipairs(c) do
|
||||
panel:InvalidateLayout()
|
||||
|
||||
recurse(panel:GetChildren())
|
||||
end
|
||||
end
|
||||
|
||||
for _, item in ipairs(panel.Items) do
|
||||
recurse(item:GetChildren())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("SpawnMenuOpen","Themer.IconHack",function()
|
||||
local ToolMenu = g_SpawnMenu.ToolMenu
|
||||
for k,v in pairs(ToolMenu.Items) do
|
||||
if v.Name == "Options" then
|
||||
v.Tab.Image:SetImage(themer_options_gear:GetBool() and "icon16/cog.png" or "icon16/wrench.png")
|
||||
hook.Add("SpawnMenuOpen", "Themer.IconHack", function()
|
||||
local ToolMenuItems = g_SpawnMenu.ToolMenu.Items
|
||||
for _, item in ipairs(ToolMenuItems) do
|
||||
if item.Name == "Options" then
|
||||
item.Tab.Image:SetImage(themer_options_gear:GetBool() and "icon16/cog.png" or "icon16/wrench.png")
|
||||
end
|
||||
if v.Name == "Utilities" then
|
||||
v.Tab.Image:SetImage(themer_options_gear:GetBool() and "icon16/cog.png" or "icon16/page_white_wrench.png")
|
||||
if item.Name == "Utilities" then
|
||||
item.Tab.Image:SetImage(themer_options_gear:GetBool() and "icon16/cog.png" or "icon16/page_white_wrench.png")
|
||||
end
|
||||
end
|
||||
|
||||
local SpawnTabs = g_SpawnMenu.CreateMenu.Items
|
||||
for k,v in pairs(SpawnTabs) do
|
||||
if v.Name == "#spawnmenu.content_tab" then
|
||||
v.Tab.Image:SetImage(Material(themer_icon_spawnlists:GetString()):IsError() and "icon16/application_view_tile.png" or themer_icon_spawnlists:GetString())
|
||||
for _, tab in ipairs(SpawnTabs) do
|
||||
if tab.Name == "#spawnmenu.content_tab" then
|
||||
tab.Tab.Image:SetImage(Material(themer_icon_spawnlists:GetString()):IsError() and "icon16/application_view_tile.png" or themer_icon_spawnlists:GetString())
|
||||
|
||||
--While we're here
|
||||
local spawnlists = v.Panel:GetChildren()[1].ContentNavBar.Tree.RootNode.ChildNodes:GetChildren()
|
||||
for _,n in pairs(spawnlists) do
|
||||
if n:GetText() == "Your Spawnlists" then
|
||||
n:SetIcon(themer_spawnlist_icons:GetBool() and "icon16/folder_page.png" or "icon16/folder.png")
|
||||
local spawnlists = tab.Panel:GetChildren()[1].ContentNavBar.Tree.RootNode.ChildNodes:GetChildren()
|
||||
for _, list in pairs(spawnlists) do
|
||||
if list:GetText() == "Your Spawnlists" then
|
||||
list:SetIcon(themer_spawnlist_icons:GetBool() and "icon16/folder_page.png" or "icon16/folder.png")
|
||||
end
|
||||
if n:GetText() == "Browse" then
|
||||
n:SetIcon(themer_spawnlist_icons:GetBool() and "icon16/folder_brick.png" or "icon16/cog.png")
|
||||
if list:GetText() == "Browse" then
|
||||
list:SetIcon(themer_spawnlist_icons:GetBool() and "icon16/folder_brick.png" or "icon16/cog.png")
|
||||
end
|
||||
if n:GetText() == "Browse Materials" then
|
||||
n:SetIcon(themer_spawnlist_icons:GetBool() and "icon16/folder_image.png" or "icon16/picture_empty.png")
|
||||
if list:GetText() == "Browse Materials" then
|
||||
list:SetIcon(themer_spawnlist_icons:GetBool() and "icon16/folder_image.png" or "icon16/picture_empty.png")
|
||||
end
|
||||
if n:GetText() == "Browse Sounds" then
|
||||
n:SetIcon(themer_spawnlist_icons:GetBool() and "icon16/folder_bell.png" or "icon16/sound.png")
|
||||
if list:GetText() == "Browse Sounds" then
|
||||
list:SetIcon(themer_spawnlist_icons:GetBool() and "icon16/folder_bell.png" or "icon16/sound.png")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if v.Name == "#spawnmenu.category.weapons" then
|
||||
v.Tab.Image:SetImage(Material(themer_icon_weapons:GetString()):IsError() and "icon16/gun.png" or themer_icon_weapons:GetString())
|
||||
if tab.Name == "#spawnmenu.category.weapons" then
|
||||
tab.Tab.Image:SetImage(Material(themer_icon_weapons:GetString()):IsError() and "icon16/gun.png" or themer_icon_weapons:GetString())
|
||||
end
|
||||
|
||||
if v.Name == "#spawnmenu.category.entities" then
|
||||
v.Tab.Image:SetImage(Material(themer_icon_ents:GetString()):IsError() and "icon16/bricks.png" or themer_icon_ents:GetString())
|
||||
if tab.Name == "#spawnmenu.category.entities" then
|
||||
tab.Tab.Image:SetImage(Material(themer_icon_ents:GetString()):IsError() and "icon16/bricks.png" or themer_icon_ents:GetString())
|
||||
end
|
||||
|
||||
if v.Name == "#spawnmenu.category.npcs" then
|
||||
v.Tab.Image:SetImage(Material(themer_icon_npcs:GetString()):IsError() and "icon16/group.png" or themer_icon_npcs:GetString())
|
||||
if tab.Name == "#spawnmenu.category.npcs" then
|
||||
tab.Tab.Image:SetImage(Material(themer_icon_npcs:GetString()):IsError() and "icon16/group.png" or themer_icon_npcs:GetString())
|
||||
end
|
||||
|
||||
if v.Name == "#spawnmenu.category.vehicles" then
|
||||
v.Tab.Image:SetImage(Material(themer_icon_cars:GetString()):IsError() and "icon16/car.png" or themer_icon_cars:GetString())
|
||||
if tab.Name == "#spawnmenu.category.vehicles" then
|
||||
tab.Tab.Image:SetImage(Material(themer_icon_cars:GetString()):IsError() and "icon16/car.png" or themer_icon_cars:GetString())
|
||||
end
|
||||
|
||||
if v.Name == "#spawnmenu.category.postprocess" then
|
||||
v.Tab.Image:SetImage(Material(themer_icon_pp:GetString()):IsError() and "icon16/image.png" or themer_icon_pp:GetString())
|
||||
if tab.Name == "#spawnmenu.category.postprocess" then
|
||||
tab.Tab.Image:SetImage(Material(themer_icon_pp:GetString()):IsError() and "icon16/image.png" or themer_icon_pp:GetString())
|
||||
end
|
||||
|
||||
if v.Name == "#spawnmenu.category.dupes" then
|
||||
v.Tab.Image:SetImage(Material(themer_icon_dupes:GetString()):IsError() and "icon16/brick_link.png" or themer_icon_dupes:GetString())
|
||||
if tab.Name == "#spawnmenu.category.dupes" then
|
||||
tab.Tab.Image:SetImage(Material(themer_icon_dupes:GetString()):IsError() and "icon16/brick_link.png" or themer_icon_dupes:GetString())
|
||||
end
|
||||
|
||||
if v.Name == "#spawnmenu.category.saves" then
|
||||
v.Tab.Image:SetImage(Material(themer_icon_saves:GetString()):IsError() and "icon16/disk.png" or themer_icon_saves:GetString())
|
||||
if tab.Name == "#spawnmenu.category.saves" then
|
||||
tab.Tab.Image:SetImage(Material(themer_icon_saves:GetString()):IsError() and "icon16/disk.png" or themer_icon_saves:GetString())
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("Initialize","Themer",function()
|
||||
timer.Simple(0,function()
|
||||
hook.Add("Initialize", "Themer", function()
|
||||
timer.Simple(0, function()
|
||||
ColorHack()
|
||||
for k,v in pairs(hook.GetTable()["ForceDermaSkin"]) do
|
||||
if k ~= "Themer" then
|
||||
hook.Remove("ForceDermaSkin", k)
|
||||
end
|
||||
|
||||
local hooks = hook.GetTable()
|
||||
for name in pairs(hooks.ForceDermaSkin) do
|
||||
if name == "Themer" then continue end
|
||||
|
||||
hook.Remove("ForceDermaSkin", name)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
for k,v in pairs(hook.GetTable()["ForceDermaSkin"]) do
|
||||
if k ~= "Themer" then
|
||||
hook.Remove("ForceDermaSkin", k)
|
||||
do
|
||||
local hooks = hook.GetTable()
|
||||
for name in pairs(hooks.ForceDermaSkin) do
|
||||
if name == "Themer" then continue end
|
||||
|
||||
hook.Remove("ForceDermaSkin", name)
|
||||
end
|
||||
|
||||
if hooks.OnGamemodeLoaded and hooks.OnGamemodeLoaded.CreateMenuBar then
|
||||
_G.__themer_oldCreateMenuBar = _G.__themer_oldCreateMenuBar or hooks.OnGamemodeLoaded.CreateMenuBar
|
||||
local oldCreateMenuBar = _G.__themer_oldCreateMenuBar
|
||||
hook.Add("OnGamemodeLoaded", "CreateMenuBar", function()
|
||||
ColorHack()
|
||||
oldCreateMenuBar()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
if hook.GetTable()["OnGamemodeLoaded"] and hook.GetTable()["OnGamemodeLoaded"]["CreateMenuBar"] then
|
||||
local oldCreateMenuBar = oldCreateMenuBar or hook.GetTable()["OnGamemodeLoaded"]["CreateMenuBar"]
|
||||
hook.Add( "OnGamemodeLoaded", "CreateMenuBar", function()
|
||||
ColorHack()
|
||||
oldCreateMenuBar()
|
||||
end)
|
||||
end
|
@ -2,9 +2,7 @@ local themer_enabled = GetConVar("themer_enabled")
|
||||
local derma_skinname = GetConVar("derma_skinname")
|
||||
local themer_skin = GetConVar("themer_skin")
|
||||
|
||||
local themer_tweaks_uselabel = GetConVar("themer_tweaks_uselabel")
|
||||
local themer_options_gear = GetConVar("themer_options_gear")
|
||||
local themer_merge_options = GetConVar("themer_merge_options")
|
||||
local themer_spawnlist_icons = GetConVar("themer_spawnlist_icons")
|
||||
|
||||
local themer_icon_spawnlists = GetConVar("themer_icon_spawnlists")
|
||||
@ -17,117 +15,130 @@ local themer_icon_dupes = GetConVar("themer_icon_dupes")
|
||||
local themer_icon_saves = GetConVar("themer_icon_saves")
|
||||
|
||||
local function MakeMenu(panel)
|
||||
panel:Help([[This menu lets you select a custom skin for most elements. The spawnmenu is most noticable.
|
||||
local info = panel:Help([[This menu lets you select a custom skin for most elements. The spawnmenu is most noticable.
|
||||
All skins will be from any addons or server downloads, or any custom ones you've made/downloaded manually.
|
||||
|
||||
If you're working on a skin and colors aren't updating, reapply changes.
|
||||
|
||||
All changes require applying changes.]])
|
||||
|
||||
panel:CheckBox("Use Custom Skin","themer_enabled")
|
||||
local enabled = panel:CheckBox("Use Custom Skin", "themer_enabled")
|
||||
|
||||
local files = {}
|
||||
|
||||
for _,f in pairs(file.Find("materials/gwenskin/*.png","GAME")) do
|
||||
f = f:gsub(".png","")
|
||||
files[f] = true
|
||||
for _, filename in ipairs(file.Find("materials/gwenskin/*.png", "GAME")) do
|
||||
filename = filename:gsub(".png", "")
|
||||
files[filename] = true
|
||||
end
|
||||
for _,f in pairs(file.Find("materials/gwenskin/*.png","THIRDPARTY")) do
|
||||
f = f:gsub(".png","")
|
||||
files[f] = true
|
||||
for _, filename in ipairs(file.Find("materials/gwenskin/*.png", "THIRDPARTY")) do
|
||||
filename = filename:gsub(".png", "")
|
||||
files[filename] = true
|
||||
end
|
||||
|
||||
local filelist = panel:ComboBox("Skin Image:","derma_skinname")
|
||||
for f,_ in pairs(files) do
|
||||
filelist:AddChoice(f)
|
||||
local filelist = panel:ComboBox("Skin Image:", "derma_skinname")
|
||||
for filename in next, files do
|
||||
filelist:AddChoice(filename)
|
||||
end
|
||||
|
||||
panel:Help([[Alternatively, you can select a full built skin, which may have other features or better compatibiliy.]])
|
||||
local skin_help = panel:Help("Alternatively, you can select a typical skin, which may have other features or better compatibiliy.")
|
||||
|
||||
local skinlist = panel:ComboBox("Skin:","themer_skin")
|
||||
for f,_ in pairs(derma.SkinList) do
|
||||
skinlist:AddChoice(f)
|
||||
local skinlist = panel:ComboBox("Skin:", "themer_skin")
|
||||
for name in next, derma.SkinList do
|
||||
skinlist:AddChoice(name)
|
||||
end
|
||||
|
||||
local refresh = panel:Button("Refresh Lists")
|
||||
refresh.DoClick = function(s)
|
||||
refresh.DoClick = function()
|
||||
filelist:Clear()
|
||||
skinlist:Clear()
|
||||
files = {}
|
||||
|
||||
for _,f in pairs(file.Find("materials/gwenskin/*.png","GAME")) do
|
||||
f = f:gsub(".png","")
|
||||
files[f] = true
|
||||
for _, filename in ipairs(file.Find("materials/gwenskin/*.png", "GAME")) do
|
||||
filename = filename:gsub(".png", "")
|
||||
files[filename] = true
|
||||
end
|
||||
for _,f in pairs(file.Find("materials/gwenskin/*.png","THIRDPARTY")) do
|
||||
f = f:gsub(".png","")
|
||||
files[f] = true
|
||||
for _, filename in ipairs(file.Find("materials/gwenskin/*.png", "THIRDPARTY")) do
|
||||
filename = filename:gsub(".png", "")
|
||||
files[filename] = true
|
||||
end
|
||||
|
||||
for f,_ in pairs(files) do
|
||||
filelist:AddChoice(f)
|
||||
for filename in next, files do
|
||||
filelist:AddChoice(filename)
|
||||
end
|
||||
|
||||
for f,_ in pairs(derma.SkinList) do
|
||||
skinlist:AddChoice(f)
|
||||
for name in next, derma.SkinList do
|
||||
skinlist:AddChoice(name)
|
||||
end
|
||||
end
|
||||
refresh:SetIcon("icon16/arrow_refresh.png")
|
||||
|
||||
local reload = panel:Button("Reload Spawnmenu","spawnmenu_reload")
|
||||
reload:SetTooltip("Only do this if you really have to, as in things aren't updating.")
|
||||
reload:SetIcon("icon16/application_view_tile.png")
|
||||
if GAMEMODE.IsSandboxDerived then
|
||||
local reload = panel:Button("Reload Spawnmenu", "spawnmenu_reload")
|
||||
reload:SetTooltip("Only do this if you really have to, such as if things aren't updating.")
|
||||
reload:SetIcon("icon16/application_view_tile.png")
|
||||
end
|
||||
|
||||
local apply = panel:Button("Apply Changes","themer_refresh_derma")
|
||||
local apply = panel:Button("Apply Changes", "themer_refresh_derma")
|
||||
apply:SetIcon("icon16/tick.png")
|
||||
end
|
||||
|
||||
local function IconSettings(panel)
|
||||
panel:Help([[Why only be limited to just the theme? Here you can set icons for spawnmenu tabs and such.
|
||||
|
||||
Note: Spawnmenu tabs for addons (Pill Pack, simfphys vehicles, SCars, etc) will not be changable.
|
||||
Note: Spawnmenu tabs for addons (Pill Pack, SCars, etc) will not be changable.
|
||||
|
||||
All of these require reopening (not reloading) of the spawnmenu to apply changes.]])
|
||||
|
||||
panel:CheckBox("Use Gear icon for Options tab","themer_options_gear")
|
||||
panel:CheckBox("Use Gear icon for Options tab", "themer_options_gear")
|
||||
|
||||
panel:CheckBox("Better Spawnlist Icons","themer_spawnlist_icons")
|
||||
panel:ControlHelp("Changes \"Your Spawnlists\" and \"Browse\" icons to more suitable icons.")
|
||||
panel:CheckBox("Better Spawnlist Icons", "themer_spawnlist_icons")
|
||||
panel:ControlHelp('Changes "Your Spawnlists" and "Browse" icons to more suitable icons.')
|
||||
|
||||
local ib = panel:Button("Popout Icon Browser","themer_iconbrowser")
|
||||
ib:SetIcon("icon16/folder_picture.png")
|
||||
local open_iconbrowser = panel:Button("Popout Icon Browser", "themer_iconbrowser")
|
||||
open_iconbrowser:SetIcon("icon16/folder_picture.png")
|
||||
|
||||
local cat_ib = vgui.Create("DCollapsibleCategory",panel)
|
||||
cat_ib:Dock(TOP)
|
||||
cat_ib:DockMargin(4,4,4,4)
|
||||
cat_ib:SetExpanded(false)
|
||||
cat_ib:SetLabel("Icon Browser")
|
||||
cat_ib.Header:SetIcon("icon16/folder_picture.png")
|
||||
cat_ib.AddItem = function(cat,ctrl) ctrl:SetParent(cat) ctrl:Dock(TOP) end
|
||||
|
||||
local path_pnl = vgui.Create("EditablePanel",panel)
|
||||
path_pnl:DockMargin(0,0,0,4)
|
||||
path_pnl:SetTall(24)
|
||||
cat_ib:AddItem(path_pnl)
|
||||
local path = vgui.Create("DTextEntry",path_pnl)
|
||||
path:SetText("")
|
||||
path:Dock(FILL)
|
||||
path:SetEditable(false)
|
||||
local copy = vgui.Create("DButton",path_pnl)
|
||||
copy:Dock(RIGHT)
|
||||
copy:SetWide(24)
|
||||
copy:SetImage("icon16/page_copy.png")
|
||||
copy:SetText("")
|
||||
function copy:DoClick()
|
||||
SetClipboardText(path:GetText())
|
||||
local iconbrowser = vgui.Create("DCollapsibleCategory", panel) do
|
||||
iconbrowser:Dock(TOP)
|
||||
iconbrowser:DockMargin(4, 4, 4, 4)
|
||||
iconbrowser:SetExpanded(false)
|
||||
iconbrowser:SetLabel("Icon Browser")
|
||||
iconbrowser.Header:SetIcon("icon16/folder_picture.png")
|
||||
iconbrowser.AddItem = function(self, ctrl)
|
||||
ctrl:SetParent(self)
|
||||
ctrl:Dock(TOP)
|
||||
end
|
||||
end
|
||||
local browser = vgui.Create("DIconBrowser",panel)
|
||||
browser:SetTall(250)
|
||||
browser:DockMargin(0,0,0,4)
|
||||
function browser:OnChange()
|
||||
path:SetText(self:GetSelectedIcon())
|
||||
|
||||
local top_wrapper = vgui.Create("EditablePanel", iconbrowser) do
|
||||
top_wrapper:DockMargin(0, 0, 0, 4)
|
||||
top_wrapper:SetTall(24)
|
||||
iconbrowser:AddItem(top_wrapper)
|
||||
end
|
||||
|
||||
local path = vgui.Create("DTextEntry", top_wrapper) do
|
||||
path:SetText("")
|
||||
path:Dock(FILL)
|
||||
path:SetEditable(false)
|
||||
end
|
||||
|
||||
local copy = vgui.Create("DButton", top_wrapper) do
|
||||
copy:Dock(RIGHT)
|
||||
copy:SetWide(24)
|
||||
copy:SetImage("icon16/page_copy.png")
|
||||
copy:SetText("")
|
||||
function copy:DoClick()
|
||||
SetClipboardText(path:GetText())
|
||||
end
|
||||
end
|
||||
|
||||
local browser = vgui.Create("DIconBrowser", iconbrowser) do
|
||||
browser:SetTall(250)
|
||||
browser:DockMargin(0, 0, 0, 4)
|
||||
function browser:OnChange()
|
||||
path:SetText(self:GetSelectedIcon())
|
||||
end
|
||||
iconbrowser:AddItem(browser)
|
||||
end
|
||||
cat_ib:AddItem(browser)
|
||||
|
||||
panel:TextEntry("#spawnmenu.content_tab", "themer_icon_spawnlists")
|
||||
panel:TextEntry("#spawnmenu.category.weapons", "themer_icon_weapons")
|
||||
@ -140,60 +151,65 @@ All of these require reopening (not reloading) of the spawnmenu to apply changes
|
||||
end
|
||||
|
||||
local function About(panel)
|
||||
local title = vgui.Create("DLabel",panel)
|
||||
title:Dock(TOP)
|
||||
title:SetFont("Themer.Title")
|
||||
title:SetText("Themer")
|
||||
title:SizeToContents()
|
||||
title:DockMargin(8,8,8,8)
|
||||
title:SetDark()
|
||||
local title = vgui.Create("DLabel", panel) do
|
||||
title:Dock(TOP)
|
||||
title:SetFont("Themer.Title")
|
||||
title:SetText("Themer")
|
||||
title:SizeToContents()
|
||||
title:DockMargin(8, 8, 8, 8)
|
||||
title:SetDark()
|
||||
end
|
||||
|
||||
local github = panel:Button("GitHub")
|
||||
github:SetIcon("icon16/world_link.png")
|
||||
github.DoClick = function(s) gui.OpenURL("https://github.com/wrldspawn/Themer") end
|
||||
local github = panel:Button("GitHub") do
|
||||
github:SetIcon("icon16/world_link.png")
|
||||
github.DoClick = function()
|
||||
gui.OpenURL("https://github.com/wrldspawn/Themer")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add("PopulateToolMenu","Themer.ToolMenu",function()
|
||||
spawnmenu.AddToolMenuOption("Theming","Theming","\1Theme Options","Theme Options","","",MakeMenu)
|
||||
spawnmenu.AddToolMenuOption("Theming","Configuration","Icons","Icons","","",IconSettings)
|
||||
spawnmenu.AddToolMenuOption("Theming","Misc","About","About","","",About)
|
||||
hook.Add("PopulateToolMenu", "Themer.ToolMenu", function()
|
||||
spawnmenu.AddToolMenuOption("Theming", "Theming", "Theme Options", "Theme Options", "", "", MakeMenu)
|
||||
spawnmenu.AddToolMenuOption("Theming", "Theming", "\xe2\x80\x8bIcons", "\xe2\x80\x8bIcons", "", "", IconSettings)
|
||||
spawnmenu.AddToolMenuOption("Theming", "Theming", "\xe2\x80\x8b\xe2\x80\x8bAbout", "\xe2\x80\x8b\xe2\x80\x8bAbout", "", "", About)
|
||||
|
||||
for k,v in pairs(spawnmenu.GetTools()) do
|
||||
if v.Name == "Theming" then
|
||||
v.Icon = "icon16/palette.png"
|
||||
for _, tab in ipairs(spawnmenu.GetTools()) do
|
||||
if tab.Name == "Theming" then
|
||||
tab.Icon = "icon16/palette.png"
|
||||
elseif tab.Name == "Utilities" and themer_options_gear:GetBool() then
|
||||
tab.Icon = "icon16/cog.png"
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
--External Settings Menu
|
||||
-- External Settings Menu
|
||||
local function ExtSettings()
|
||||
local frame = vgui.Create("DFrame")
|
||||
frame:SetSize(384,768)
|
||||
frame:SetPos(ScrW()-432,ScrH()/2-256)
|
||||
frame:SetTitle("Themer Settings")
|
||||
frame:SetIcon("icon16/palette.png")
|
||||
frame:MakePopup()
|
||||
local frame = vgui.Create("DFrame") do
|
||||
frame:SetSize(384, 768)
|
||||
frame:SetPos(ScrW() - 432, (ScrH() / 2) - 256)
|
||||
frame:SetTitle("Themer Settings")
|
||||
frame:SetIcon("icon16/palette.png")
|
||||
frame:MakePopup()
|
||||
end
|
||||
|
||||
local tabs = vgui.Create("DPropertySheet",frame)
|
||||
local tabs = vgui.Create("DPropertySheet", frame)
|
||||
tabs:Dock(FILL)
|
||||
|
||||
-- Main Area --
|
||||
local main = vgui.Create("DForm",tabs)
|
||||
local main = vgui.Create("DForm", tabs)
|
||||
MakeMenu(main)
|
||||
main:SetName("Theme Options")
|
||||
tabs:AddSheet("Theme Options",main,"icon16/palette.png")
|
||||
tabs:AddSheet("Theme Options", main, "icon16/palette.png")
|
||||
|
||||
--Icons--
|
||||
local icons = vgui.Create("DForm",tabs)
|
||||
local icons = vgui.Create("DForm", tabs)
|
||||
IconSettings(icons)
|
||||
icons:SetName("Icons")
|
||||
tabs:AddSheet("Icons",icons,"icon16/pictures.png")
|
||||
tabs:AddSheet("Icons", icons, "icon16/pictures.png")
|
||||
|
||||
--About--
|
||||
local about = vgui.Create("DForm",tabs)
|
||||
About(about)
|
||||
about:SetName("About")
|
||||
tabs:AddSheet("About",about,"icon16/information.png")
|
||||
local about = vgui.Create("DForm", tabs) do
|
||||
About(about)
|
||||
about:SetName("About")
|
||||
tabs:AddSheet("About", about, "icon16/information.png")
|
||||
end
|
||||
end
|
||||
|
||||
concommand.Add("themer_settings",ExtSettings)
|
||||
concommand.Add("themer_settings", ExtSettings)
|
||||
|
Loading…
Reference in New Issue
Block a user