Skip to content

Commit 97371e4

Browse files
committed
UI Tweaks
1 parent 22b5ba0 commit 97371e4

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Modules/GUI.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,13 @@ function drawTimesSeparator()
9191
reaper.ImGui_SetCursorPosY(ctx, currentY + cellH / 3)
9292
reaper.ImGui_Text(ctx, '-')
9393
reaper.ImGui_SameLine(ctx)
94+
end
95+
96+
function SameLineAutoWrap(ctx, widgetWidth, spacing)
97+
spacing = spacing or 0
98+
local avail_w, avail_h = reaper.ImGui_GetContentRegionAvail(ctx)
99+
if avail_w < widgetWidth + spacing then
100+
reaper.ImGui_NewLine(ctx)
101+
end
102+
reaper.ImGui_SameLine(ctx, spacing)
94103
end

brute-seq.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ local function loop()
101101
reaper.ImGui_Text(ctx, 'Pattern:')
102102
reaper.ImGui_SameLine(ctx)
103103
changedPattern, currentPatternIndex = drawSlider(ctx, '##Pattern', currentPatternIndex, 1, patternCount, 140)
104+
reaper.ImGui_SameLine(ctx)
105+
106+
local y = reaper.ImGui_GetCursorPosY(ctx)
107+
reaper.ImGui_SetCursorPosY(ctx, y + 1)
108+
reaper.ImGui_PushStyleVar(ctx, reaper.ImGui_StyleVar_FramePadding(), 4, 2)
109+
addedPattern = reaper.ImGui_Button(ctx, "+")
110+
reaper.ImGui_PopStyleVar(ctx)
111+
104112
reaper.ImGui_SameLine(ctx)
105113
reaper.ImGui_Text(ctx, 'Steps:')
106114
reaper.ImGui_SameLine(ctx)
@@ -110,11 +118,8 @@ local function loop()
110118
reaper.ImGui_SameLine(ctx)
111119
changedTimes, currentPattern.times = drawSlider(ctx, '##Times', currentPattern.times, 1, 32, 140, 4, 4)
112120

113-
reaper.ImGui_SameLine(ctx)
114-
addedPattern = reaper.ImGui_Button(ctx, "Add Pattern")
115-
116121
-- draw options
117-
reaper.ImGui_SameLine(ctx)
122+
SameLineAutoWrap(ctx, 1000)
118123
changedFollowOption, followCursor = reaper.ImGui_Checkbox(ctx, "Follow", followCursor)
119124
reaper.ImGui_SameLine(ctx)
120125
changedLoopPatternOption, loopPattern = reaper.ImGui_Checkbox(ctx, "Loop pattern", loopPattern)

0 commit comments

Comments
 (0)