Hi, help please".
I want to build a simple template main.lua with the following characteristics:
- Simple GUI of floating window, 800 x 250 pixels.Equal to two tabs.
- Two switches [A Switch] & [B Switch] above to change the lower area in the same window.
- “Permutable Area” for especific functions ([A Switch]: “Area A”, [B Switch]: “Area B”. Area A and Area Boccupy the same place.
- Two buttons bellow [Insert Button ( I )] &[Cancel Button ( C )].
This basic main.luaserves as a template to create multiple separate tools.
SCHEME:
_______________________________________________________________________
| |
| [Top Title... ...] |
| |
| [A Switch] [B Switch] |
| _________________________________________________________________ |
| | | |
| | Permutable Area according Switches: A , B | |
| | _________________________________________________________ | |
| | | | | |
| | | SubArea (especific functions) | | |
| | | | | |
| | | | | |
| | | | | |
| | | _________________________________________________________ | | |
| | | |
| | _________________________________________________________________ | |
| |
| [Insert Button (I)] [Cancel Button (C)] |
| _______________________________________________________________________ |
THE BASIC ASPECT IS THIS:
I have built part of the code in main.lua
MAIN.LUA:
--VARIALBLE AREA A & B
--Subareas A , B --
--SubArea A
function subarea_a()
end
--SubArea B
function subarea_b()
end
--Variable Area A & B
--Area
function area_ab()
end
--Functions Select
function select()
-- if menu_x1.value == 1 then aaa() end
-- if menu_x2.value == 2 then bbb() end
-- if menu_x3.value == 3 then ccc() end
-- if menu_x4.value == 4 then ddd() end
end
--========= GUI =========--
function main_gui()
local vb = renoise.ViewBuilder()
local area = {}
area.one = vb:text { font = 'bold' , text = 'Area A' }
area.two = vb:text { font = 'bold' , text = 'Area B' }
--subarea_a
local subarea_a = vb:vertical_aligner {
width = 200,
height = 200,
margin = 10,
spacing = 0,
vb:horizontal_aligner {
mode = 'center',
area.one,
}
}
--subarea_b
local subarea_b = vb:vertical_aligner {
width = 200,
height = 200,
margin = 10,
spacing = 0,
vb:horizontal_aligner {
mode = 'center',
area.two,
}
}
--menu_x2
local menu_x2 = vb:switch { width = 750 , height = 20 , items = { 'A' , 'B' } , value = 1 } -- [A Switch] [B Switch]
-- if menu_x2.value == 1 then subarea_a() end
-- if menu_x2.value == 2 then subarea_b() end
--main_view
local main_view = vb:vertical_aligner {
width = 800,
height = 250,
margin = 10,
spacing = 0,
vb:horizontal_aligner {
margin = 0,
spacing = 0,
mode = 'center',
menu_x2, -- memu_x2
},
vb:horizontal_aligner {
margin = 0,
spacing = 0,
mode = 'center',
subarea_a, -- subarea_a
subarea_b, -- subarea_b
}
}
local res = renoise.app():show_custom_prompt ( 'Floating Window Multiple Options' , main_view , { 'Insert (I)', 'Cancel (C)' } ); -- [Top Title... ...] & [Insert Button (I)] + [Cancel Button (C)]
if res == 'Select (S)' then
area_ab()
end
end
--========= MENU =========--
function rebuild_menu()
local song, menu_entry = renoise.song(), 'Pattern Editor:Floating Window Multiple Options...'
if renoise.tool():has_menu_entry(menu_entry) then renoise.tool():remove_menu_entry(menu_entry) end
if (song.selected_track.type == renoise.Track.TRACK_TYPE_SEQUENCER) or (song.selected_track.type == renoise.Track.TRACK_TYPE_GROUP) then renoise.tool():add_menu_entry {
name = menu_entry,
invoke = function() main_gui() end
}
end
end
function start()
renoise.song().selected_track_observable:add_notifier(rebuild_menu)
rebuild_menu()
end
renoise.tool().app_new_document_observable:add_notifier(start)
But I can not build the Permutable Area as according switches A and B.When the area A is activated, the Area B should be hidden and vice versa.The action is the samethat the switches of the XRNI-Merger or Noodletrap tools of Danoise (Input, Record, Phrase, Events, Settings) http://www.renoise.com/tools/noodletrap(according to the switch activated, the lower area changes).
The code should be as simple as possible… Can you help me finish?