mirror of
https://github.com/chev2/gmod-addons.git
synced 2025-12-16 21:12:12 +00:00
Add drop-down menus to DScreenshotEditor
This commit is contained in:
parent
1ccbab200f
commit
80e17fd32c
1 changed files with 51 additions and 12 deletions
|
|
@ -163,9 +163,8 @@ function PANEL:Init()
|
|||
filterButtonLeft:SetTextColor(color_white)
|
||||
filterButtonLeft.Paint = BUTTON_PAINT
|
||||
filterButtonLeft.DoClick = function(panel)
|
||||
self.CurrentFilter = (self.CurrentFilter - 1) % #FILTER_DATA
|
||||
|
||||
self.CurrentFilterLabel:SetText("Current Filter: " .. FILTER_DATA[self.CurrentFilter + 1].FilterName)
|
||||
local newFilterIndex = (self.CurrentFilter - 1) % #FILTER_DATA
|
||||
self:SelectFilter(newFilterIndex)
|
||||
end
|
||||
|
||||
local filterButtonRight = vgui.Create("DButton", filterBase)
|
||||
|
|
@ -177,9 +176,8 @@ function PANEL:Init()
|
|||
filterButtonRight:SetTextColor(color_white)
|
||||
filterButtonRight.Paint = BUTTON_PAINT
|
||||
filterButtonRight.DoClick = function(panel)
|
||||
self.CurrentFilter = (self.CurrentFilter + 1) % #FILTER_DATA
|
||||
|
||||
self.CurrentFilterLabel:SetText("Current Filter: " .. FILTER_DATA[self.CurrentFilter + 1].FilterName)
|
||||
local newFilterIndex = (self.CurrentFilter + 1) % #FILTER_DATA
|
||||
self:SelectFilter(newFilterIndex)
|
||||
end
|
||||
|
||||
local currentFilterName = vgui.Create("DLabel", filterBase)
|
||||
|
|
@ -188,6 +186,20 @@ function PANEL:Init()
|
|||
currentFilterName:Dock(FILL)
|
||||
currentFilterName:SetContentAlignment(5)
|
||||
|
||||
currentFilterName:SetMouseInputEnabled(true)
|
||||
currentFilterName:SetCursor("hand")
|
||||
currentFilterName.DoClick = function()
|
||||
local dMenu = DermaMenu()
|
||||
|
||||
for index, filterEntryData in ipairs(screenshot_editor.GetFilters()) do
|
||||
dMenu:AddOption(filterEntryData.FilterName, function()
|
||||
self:SelectFilter(index - 1)
|
||||
end)
|
||||
end
|
||||
|
||||
dMenu:Open()
|
||||
end
|
||||
|
||||
self.CurrentFilterLabel = currentFilterName
|
||||
|
||||
--[[
|
||||
|
|
@ -214,9 +226,8 @@ function PANEL:Init()
|
|||
frameButtonLeft:SetTextColor(color_white)
|
||||
frameButtonLeft.Paint = BUTTON_PAINT
|
||||
frameButtonLeft.DoClick = function(panel)
|
||||
self.CurrentFrame = (self.CurrentFrame - 1) % #FRAME_DATA
|
||||
|
||||
self.CurrentFrameLabel:SetText("Current Frame: " .. FRAME_DATA[self.CurrentFrame + 1].FrameName)
|
||||
local newFrameIndex = (self.CurrentFrame - 1) % #FRAME_DATA
|
||||
self:SelectFrame(newFrameIndex)
|
||||
end
|
||||
|
||||
local frameButtonRight = vgui.Create("DButton", frameBase)
|
||||
|
|
@ -228,9 +239,8 @@ function PANEL:Init()
|
|||
frameButtonRight:SetTextColor(color_white)
|
||||
frameButtonRight.Paint = BUTTON_PAINT
|
||||
frameButtonRight.DoClick = function(panel)
|
||||
self.CurrentFrame = (self.CurrentFrame + 1) % #FRAME_DATA
|
||||
|
||||
self.CurrentFrameLabel:SetText("Current Frame: " .. FRAME_DATA[self.CurrentFrame + 1].FrameName)
|
||||
local newFrameIndex = (self.CurrentFrame + 1) % #FRAME_DATA
|
||||
self:SelectFrame(newFrameIndex)
|
||||
end
|
||||
|
||||
local currentFrameName = vgui.Create("DLabel", frameBase)
|
||||
|
|
@ -239,6 +249,21 @@ function PANEL:Init()
|
|||
currentFrameName:Dock(FILL)
|
||||
currentFrameName:SetContentAlignment(5)
|
||||
|
||||
currentFrameName:SetMouseInputEnabled(true)
|
||||
currentFrameName:SetCursor("hand")
|
||||
currentFrameName.DoClick = function()
|
||||
local dMenu = DermaMenu()
|
||||
|
||||
for index, frameEntryData in ipairs(screenshot_editor.GetFrames()) do
|
||||
dMenu:AddOption(frameEntryData.FrameName, function()
|
||||
self:SelectFrame(index - 1)
|
||||
end)
|
||||
end
|
||||
|
||||
dMenu:Open()
|
||||
end
|
||||
|
||||
|
||||
self.CurrentFrameLabel = currentFrameName
|
||||
|
||||
--[[
|
||||
|
|
@ -387,6 +412,20 @@ function PANEL:Init()
|
|||
end
|
||||
end
|
||||
|
||||
function PANEL:SelectFilter(index)
|
||||
self.CurrentFilter = index
|
||||
|
||||
local filterData = screenshot_editor.GetFilter(self.CurrentFilter + 1)
|
||||
self.CurrentFilterLabel:SetText("Current Filter: " .. filterData.FilterName)
|
||||
end
|
||||
|
||||
function PANEL:SelectFrame(index)
|
||||
self.CurrentFrame = index
|
||||
|
||||
local frameData = screenshot_editor.GetFrame(self.CurrentFrame + 1)
|
||||
self.CurrentFrameLabel:SetText("Current Frame: " .. frameData.FrameName)
|
||||
end
|
||||
|
||||
-- Add screenshots to the DListView
|
||||
function PANEL:AddScreenshotsToList()
|
||||
local fileScroll = self.FileScroll
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue