Skip to content

Commit f892087

Browse files
committed
Move config to the menu bar
1 parent 93f63ef commit f892087

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

brute-seq/brute-seq.lua

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ end
185185

186186

187187
-- UI state -----------------------------------------------------------
188-
local showPopup = false
189188
local editText
190189

191190
local function showLanesConfigPopup()
@@ -217,10 +216,25 @@ local function showLanesConfigPopup()
217216
return visibleOK
218217
end
219218

219+
local function addMenuBar()
220+
local openLanesPopup
221+
if reaper.ImGui_BeginMenuBar(ctx) then
222+
if reaper.ImGui_BeginMenu(ctx, "Options") then
223+
openLanesPopup = reaper.ImGui_MenuItem(ctx, "Configure track lanes")
224+
reaper.ImGui_EndMenu(ctx)
225+
end
226+
reaper.ImGui_EndMenuBar(ctx)
227+
end
228+
if openLanesPopup then
229+
editText = lanesToString(loadLanes(getSequencerTrack()))
230+
reaper.ImGui_OpenPopup(ctx, "Edit Lanes")
231+
end
232+
end
233+
220234
local function loop()
221235
reaper.ImGui_PushFont(ctx,font)
222236
reaper.ImGui_SetNextWindowSize(ctx,900,420,reaper.ImGui_Cond_FirstUseEver())
223-
visible, open = reaper.ImGui_Begin(ctx,'BRUTE SEQ',true)
237+
visible, open = reaper.ImGui_Begin(ctx,'BRUTE SEQ',true, reaper.ImGui_WindowFlags_MenuBar())
224238
if visible then
225239

226240
local sequencerTrack = getSequencerTrack()
@@ -232,7 +246,10 @@ local function loop()
232246
local command = nil
233247

234248
reaper.ImGui_PushStyleColor(ctx,reaper.ImGui_Col_WindowBg(),0x222222FF)
235-
if currentPattern then
249+
if currentPattern then
250+
251+
addMenuBar()
252+
236253
-- top bar
237254
pushToolbarStyles(ctx)
238255

@@ -265,8 +282,7 @@ local function loop()
265282
reaper.ImGui_SameLine(ctx)
266283
changedRippleOption, ripple = reaper.ImGui_Checkbox(ctx, "Ripple", ripple)
267284
reaper.ImGui_SameLine(ctx)
268-
local configLanes = reaper.ImGui_Button(ctx, "Config")
269-
285+
270286
popToolbarStyles(ctx)
271287
reaper.ImGui_Separator(ctx)
272288

@@ -325,10 +341,6 @@ local function loop()
325341
nextPattern = getPattern(sequencerTrack, currentPatternIndex - 1)
326342
updateCursor(currentPattern.item, nextPattern.item)
327343
updateTimeSelection()
328-
elseif configLanes then
329-
showPopup = true
330-
editText = lanesToString(lanes)
331-
reaper.ImGui_OpenPopup(ctx, "Edit Lanes")
332344
end
333345
else -- if currentPattern
334346
reaper.ImGui_SameLine(ctx)

0 commit comments

Comments
 (0)