Skip to content

Commit

Permalink
Release Track icon selector v1.02 (#1434)
Browse files Browse the repository at this point in the history
  • Loading branch information
GoranKovac authored Sep 27, 2024
1 parent 433db9b commit f146706
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Tracks/reapertips_Track icon selector.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-- @description Track icon selector
-- @author Reapertips & Sexan
-- @version 1.01
-- @version 1.02
-- @changelog
-- Removed IsRectVisible optiomization (not doing much but introduceds other problems)
-- Fix highlighted button draw oversized width and height
-- @screenshot
-- https://i.imgur.com/bFK2HYk.png
-- https://i.imgur.com/MabMOW1.png
Expand Down Expand Up @@ -282,15 +282,12 @@ local function PngSelector(button_size)
for n = 0, #FILTERED_PNG - 1 do
local image = FILTERED_PNG[n + 1].name
local stripped_name = FILTERED_PNG[n + 1].short_name
local xx, yy = imgui.GetCursorPos(ctx)

imgui.PushID(ctx, n)
if not imgui.ValidatePtr(FILTERED_PNG[n + 1].img_obj, 'ImGui_Image*') then
FILTERED_PNG[n + 1].img_obj = imgui.CreateImage(image)
end

imgui.SetCursorPos(ctx, xx, yy)

if imgui.ImageButton(ctx, "##png_select", FILTERED_PNG[n + 1].img_obj, button_size, button_size, 0, 0, 1, 1) then
for i = 1, #TRACKS do
r.GetSetMediaTrackInfo_String(TRACKS[i], "P_ICON", image, true)
Expand All @@ -313,7 +310,7 @@ local function PngSelector(button_size)
SCROLL_TO_IMG = true
LAST_ICON = CUR_ICON
end
imgui.DrawList_AddRect(DRAW_LIST, minx, miny, maxx + (padding*2), maxy + padding*2, COLORS["outline_col"], 0, 0, 2)
imgui.DrawList_AddRect(DRAW_LIST, minx, miny, maxx, maxy, COLORS["outline_col"], 0, 0, 2)
if SCROLL_TO_IMG then
SCROLL_TO_IMG = nil
imgui.SetScrollHereY(ctx)
Expand Down

0 comments on commit f146706

Please sign in to comment.