feat(win32 gui): add font selection palette

closes #102
This commit is contained in:
CJ van den Berg 2025-01-17 20:32:20 +01:00
parent 3e953981fe
commit e1b1591167
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
10 changed files with 184 additions and 14 deletions

View file

@ -37,6 +37,7 @@ const menu_commands = if (build_options.gui) &[_][]const u8{
"open_keybind_config",
"toggle_input_mode",
"change_theme",
"change_fontface",
"quit",
} else &[_][]const u8{
"open_help",
@ -101,9 +102,13 @@ fn add_menu_command(self: *Self, comptime command_name: []const u8, menu: anytyp
var buf: [64]u8 = undefined;
var fis = std.io.fixedBufferStream(&buf);
const writer = fis.writer();
try writer.print("{s} ..", .{description});
const leader = if (hint.len > 0) "." else " ";
_ = try writer.write(description);
_ = try writer.write(" ");
_ = try writer.write(leader);
_ = try writer.write(leader);
for (0..(self.max_desc_len - label_len - 5)) |_|
try writer.print(".", .{});
_ = try writer.write(leader);
try writer.print(" :{s}", .{hint});
const label = fis.getWritten();
try menu.add_item_with_handler(label, menu_action(command_name));