Skip to content

Commit 5e90b90

Browse files
committed
Fix broken styles
1 parent dc6429b commit 5e90b90

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

Modules/GUI.lua

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local images_path = script_path .. 'Images/'
1010
-- Load fonts
1111
-----------------------------------------------------------------------
1212

13-
local font = reaper.ImGui_CreateFont(fonts_path .. 'Inter.ttc', fontSize)
13+
font = reaper.ImGui_CreateFont(fonts_path .. 'Inter.ttc', fontSize)
1414
local fontBigger = reaper.ImGui_CreateFont(fonts_path .. 'Inter.ttc', fontSize + 4)
1515
local fontSmall = reaper.ImGui_CreateFont(fonts_path .. 'Inter.ttc', fontSize - 1)
1616
reaper.ImGui_Attach(ctx, font)
@@ -56,6 +56,26 @@ local function stepSprite(on,odd, accent)
5656
end
5757
local cellW,cellH = images.Step_odd_off.w, images.Step_odd_off.h
5858

59+
local buttonColor = 0x2f2f34ff
60+
local activeButtonColor = 0x576065ff
61+
local slideBackgroundColor = 0x060607ff
62+
63+
function pushToolbarStyles(ctx)
64+
reaper.ImGui_PushStyleVar(ctx, reaper.ImGui_StyleVar_FramePadding(), 4, 4)
65+
reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_SliderGrab(), buttonColor)
66+
reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_SliderGrabActive(), activeButtonColor)
67+
reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBg(), slideBackgroundColor)
68+
reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBgHovered(), slideBackgroundColor)
69+
reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_FrameBgActive(), slideBackgroundColor)
70+
reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_Button(), buttonColor)
71+
reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_ButtonHovered(), buttonColor)
72+
reaper.ImGui_PushStyleColor(ctx, reaper.ImGui_Col_ButtonActive(), activeButtonColor)
73+
end
74+
75+
function popToolbarStyles(ctx)
76+
reaper.ImGui_PopStyleColor(ctx, 8)
77+
reaper.ImGui_PopStyleVar(ctx, 1)
78+
end
5979

6080
function drawSlider(ctx, label, value, minVal, maxVal,
6181
width)
@@ -67,6 +87,7 @@ function drawSlider(ctx, label, value, minVal, maxVal,
6787
reaper.ImGui_PushItemWidth(ctx, width)
6888
reaper.ImGui_PushFont(ctx, fontSmall)
6989

90+
7091
local changed, newVal = reaper.ImGui_SliderInt(ctx, label, value, minVal, maxVal)
7192

7293
reaper.ImGui_PopItemWidth(ctx)

brute-seq.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ end
194194

195195
local function loop()
196196
passThroughShortcuts(ctx)
197+
reaper.ImGui_PushFont(ctx,font)
197198
reaper.ImGui_SetNextWindowSize(ctx,900,420,reaper.ImGui_Cond_FirstUseEver())
198-
visible, open = reaper.ImGui_Begin(ctx,'brute-seq',true)
199+
visible, open = reaper.ImGui_Begin(ctx,'BRUTE SEQ',true)
199200
if visible then
200-
reaper.ImGui_PushFont(ctx,font)
201201
reaper.ImGui_PushStyleColor(ctx,reaper.ImGui_Col_WindowBg(),0x222222FF)
202202

203203
local sequencerTrack = getSequencerTrack()
@@ -209,8 +209,8 @@ local function loop()
209209
local command = nil
210210
if currentPattern then
211211
-- top bar
212-
reaper.ImGui_PushStyleVar(ctx, reaper.ImGui_StyleVar_FramePadding(), 4, 4)
213-
212+
pushToolbarStyles(ctx)
213+
214214
reaper.ImGui_SameLine(ctx)
215215
reaper.ImGui_AlignTextToFramePadding(ctx)
216216
reaper.ImGui_Text(ctx, 'Pattern:')
@@ -220,7 +220,7 @@ local function loop()
220220

221221
local y = reaper.ImGui_GetCursorPosY(ctx)
222222
reaper.ImGui_SetCursorPosY(ctx, y + 1)
223-
reaper.ImGui_PushStyleVar(ctx, reaper.ImGui_StyleVar_FramePadding(), 4, 2)
223+
reaper.ImGui_PushStyleVar(ctx, reaper.ImGui_StyleVar_FramePadding(), 5, 2)
224224
removedPattern = reaper.ImGui_Button(ctx, "-")
225225
reaper.ImGui_PopStyleVar(ctx)
226226
reaper.ImGui_SameLine(ctx)
@@ -250,7 +250,7 @@ local function loop()
250250
reaper.ImGui_SameLine(ctx)
251251
changedRippleOption, ripple = reaper.ImGui_Checkbox(ctx, "Ripple", ripple)
252252

253-
reaper.ImGui_PopStyleVar(ctx, 1)
253+
popToolbarStyles(ctx)
254254
reaper.ImGui_Separator(ctx)
255255

256256
if isMidi(currentPattern.item) then
@@ -318,9 +318,9 @@ local function loop()
318318
end
319319
end
320320
reaper.ImGui_PopStyleColor(ctx)
321-
reaper.ImGui_PopFont(ctx)
322321
end
323322
reaper.ImGui_End(ctx)
323+
reaper.ImGui_PopFont(ctx)
324324
if open then
325325
reaper.defer(loop)
326326
end

0 commit comments

Comments
 (0)