fix: Remove duplicate zoom state declarations and add zoom indicator

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-03 11:15:07 +00:00
parent d43a7be97d
commit e3198bc4ce

62
gui.c
View File

@@ -61,16 +61,6 @@ static int zoom_focus_channel = 0; /* which channel is focused when zoomed */
static const int zoom_levels[] = {1, 2, 4};
static const char *zoom_labels[] = {"1x", "2x", "4x"};
/* ---------------------------------------------------------------------------
* zoom mode state
* ------------------------------------------------------------------------- */
static int zoom_enabled = 0; /* 0 = normal, 1 = zoomed */
static int zoom_level = 0; /* 0 = 1x, 1 = 2x, 2 = 4x */
static int zoom_focus_scene = 0; /* which scene is focused when zoomed */
static int zoom_focus_channel = 0; /* which channel is focused when zoomed */
static const int zoom_levels[] = {1, 2, 4};
static const char *zoom_labels[] = {"1x", "2x", "4x"};
/* ---------------------------------------------------------------------------
* drawing helpers (stubs for microui)
* ------------------------------------------------------------------------- */
@@ -141,47 +131,19 @@ static void gui_update(void)
}
}
/* Zoom mode controls */
mu_layout_row(ctx, 2, (int[]) { 60, -1 }, 0);
mu_label(ctx, "Zoom:");
if (mu_button(ctx, zoom_enabled ? "Disable" : "Enable")) {
zoom_enabled = !zoom_enabled;
if (!zoom_enabled) {
zoom_focus_scene = 0;
zoom_focus_channel = 0;
}
}
if (zoom_enabled) {
mu_layout_row(ctx, 2, (int[]) { 60, -1 }, 0);
mu_label(ctx, "Level:");
if (mu_button(ctx, zoom_labels[zoom_level])) {
zoom_level = (zoom_level + 1) % 3;
}
mu_layout_row(ctx, 2, (int[]) { 60, -1 }, 0);
mu_label(ctx, "Scene:");
{
char buf[32];
snprintf(buf, sizeof(buf), "%d", zoom_focus_scene + 1);
if (mu_button(ctx, buf)) {
/* click to reset? no action needed */
}
}
mu_layout_row(ctx, 2, (int[]) { 60, -1 }, 0);
mu_label(ctx, "Channel:");
{
char buf[32];
snprintf(buf, sizeof(buf), "%d", zoom_focus_channel + 1);
if (mu_button(ctx, buf)) {
/* click to reset? no action needed */
}
}
/* Navigation hint */
/* zoom indicator */
mu_layout_row(ctx, 1, (int[]) { -1 }, 0);
mu_label(ctx, "Use arrow keys to navigate when zoomed");
{
char buf[64];
if (zoom_enabled) {
snprintf(buf, sizeof(buf), "Zoom: %s Scene:%d Channel:%d",
zoom_labels[zoom_level],
zoom_focus_scene + 1,
zoom_focus_channel + 1);
} else {
snprintf(buf, sizeof(buf), "Zoom: Off");
}
mu_label(ctx, buf);
}
/* Zoom mode controls */