move adding to toolbar
This commit is contained in:
parent
1428d3d9bf
commit
eafafbab89
@ -870,6 +870,79 @@ fn showToolbar(self: *MainScreen) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const btn = ui.textButton("Add");
|
||||||
|
btn.borders = UI.Borders.all(.{ .size = 4, .color = srcery.green });
|
||||||
|
const signal = ui.signal(btn);
|
||||||
|
if (signal.clicked()) {
|
||||||
|
btn.persistent.open = !btn.persistent.open;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (btn.persistent.open) {
|
||||||
|
const popup = ui.createBox(.{
|
||||||
|
.key = ui.keyFromString("Add popup"),
|
||||||
|
.size_x = UI.Sizing.initFixedPixels(ui.rem(10)),
|
||||||
|
.size_y = UI.Sizing.initFitChildren(),
|
||||||
|
.flags = &.{ .clickable, .scrollable },
|
||||||
|
.layout_direction = .top_to_bottom,
|
||||||
|
.float_relative_to = btn,
|
||||||
|
.background = srcery.black,
|
||||||
|
.draw_on_top = true
|
||||||
|
});
|
||||||
|
popup.setFloatPosition(0, btn.persistent.size.y);
|
||||||
|
popup.beginChildren();
|
||||||
|
defer popup.endChildren();
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
const select_btn = ui.textButton("... from file");
|
||||||
|
select_btn.alignment.x = .start;
|
||||||
|
select_btn.size.x = UI.Sizing.initGrowFull();
|
||||||
|
select_btn.background = srcery.hard_black;
|
||||||
|
select_btn.borders = UI.Borders.all(.{ .color = srcery.hard_black, .size = 2 });
|
||||||
|
if (ui.signal(select_btn).clicked()) {
|
||||||
|
self.app.pushCommand(.add_file_from_picker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const select_btn = ui.textButton("... from device");
|
||||||
|
select_btn.alignment.x = .start;
|
||||||
|
select_btn.size.x = UI.Sizing.initGrowFull();
|
||||||
|
select_btn.background = srcery.hard_black;
|
||||||
|
select_btn.borders = UI.Borders.all(.{ .color = srcery.hard_black, .size = 2 });
|
||||||
|
if (ui.signal(select_btn).clicked()) {
|
||||||
|
self.app.screen = .add_channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// inline for (options) |option| {
|
||||||
|
// const select_option = ui.textButton(option[1]);
|
||||||
|
// select_option.alignment.x = .start;
|
||||||
|
// select_option.size.x = UI.Sizing.initGrowFull();
|
||||||
|
// select_option.borders = UI.Borders.all(.{ .color = srcery.hard_black, .size = 2 });
|
||||||
|
// select_option.background = srcery.black;
|
||||||
|
|
||||||
|
// const signal = ui.signal(select_option);
|
||||||
|
// if (signal.clicked()) {
|
||||||
|
// select.persistent.open = false;
|
||||||
|
// transform.* = switch (option[0]) {
|
||||||
|
// .sliding_window => App.Transform{ .sliding_window = sample_rate orelse 0 },
|
||||||
|
// .addition => App.Transform{ .addition = 0 },
|
||||||
|
// .multiply => App.Transform{ .multiply = 1 },
|
||||||
|
// else => unreachable
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
_ = ui.signal(popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (signal.clicked_outside) {
|
||||||
|
btn.persistent.open = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_ = ui.createBox(.{ .size_x = UI.Sizing.initFixedPixels(ui.rem(1)) });
|
_ = ui.createBox(.{ .size_x = UI.Sizing.initFixedPixels(ui.rem(1)) });
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1115,30 +1188,6 @@ pub fn tick(self: *MainScreen) !void {
|
|||||||
const view = self.app.getView(view_id);
|
const view = self.app.getView(view_id);
|
||||||
_ = try UIView.show(ui_view_ctx, view_id, UI.Sizing.initFixed(.{ .pixels = view.?.height }));
|
_ = try UIView.show(ui_view_ctx, view_id, UI.Sizing.initFixed(.{ .pixels = view.?.height }));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
const add_channel_view = ui.createBox(.{
|
|
||||||
.size_x = UI.Sizing.initGrowFull(),
|
|
||||||
.size_y = UI.Sizing.initFixed(.{ .pixels = 200 }),
|
|
||||||
.align_x = .center,
|
|
||||||
.align_y = .center,
|
|
||||||
.layout_gap = 32
|
|
||||||
});
|
|
||||||
add_channel_view.beginChildren();
|
|
||||||
defer add_channel_view.endChildren();
|
|
||||||
|
|
||||||
const add_from_file = ui.textButton("Add from file");
|
|
||||||
add_from_file.borders = UI.Borders.all(.{ .size = 2, .color = srcery.green });
|
|
||||||
if (ui.signal(add_from_file).clicked()) {
|
|
||||||
self.app.pushCommand(.add_file_from_picker);
|
|
||||||
}
|
|
||||||
|
|
||||||
const add_from_device = ui.textButton("Add from device");
|
|
||||||
add_from_device.borders = UI.Borders.all(.{ .size = 2, .color = srcery.green });
|
|
||||||
if (ui.signal(add_from_device).clicked()) {
|
|
||||||
self.app.screen = .add_channels;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.view_controls.applyCommands();
|
self.view_controls.applyCommands();
|
||||||
|
Loading…
Reference in New Issue
Block a user