summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c2
-rw-r--r--menu.c11
-rw-r--r--ted.cfg2
-rw-r--r--ui.c12
4 files changed, 18 insertions, 9 deletions
diff --git a/config.c b/config.c
index 46a389f..868122d 100644
--- a/config.c
+++ b/config.c
@@ -307,7 +307,7 @@ void config_read(Ted *ted, char const *filename) {
config_err(cfg, "Invalid max menu width: %s.", value);
}
} else if (streq(key, "padding")) {
- if (is_integer && integer >= 10 && integer < 100) {
+ if (is_integer && integer >= 0 && integer < 100) {
settings->padding = (u8)integer;
} else {
config_err(cfg, "Invalid padding: %s.", value);
diff --git a/menu.c b/menu.c
index 40742cf..287b153 100644
--- a/menu.c
+++ b/menu.c
@@ -73,6 +73,8 @@ static void menu_render(Ted *ted, Menu menu) {
Settings const *settings = &ted->settings;
u32 const *colors = settings->colors;
float window_width = ted->window_width, window_height = ted->window_height;
+ Font *font_bold = ted->font_bold;
+ float char_height_bold = text_font_char_height(font_bold);
// render backdrop
glBegin(GL_QUADS);
@@ -101,6 +103,15 @@ static void menu_render(Ted *ted, Menu menu) {
menu_y2 -= padding;
+ gl_color_rgba(colors[COLOR_TEXT]);
+ if (menu == MENU_OPEN) {
+ text_render(font_bold, "Open...", menu_x1, menu_y1);
+ } else if (menu == MENU_SAVE_AS) {
+ text_render(font_bold, "Save as...", menu_x1, menu_y1);
+ }
+
+ menu_y1 += char_height_bold * 0.75f + padding;
+
FileSelector *fs = &ted->file_selector;
fs->bounds = rect4(menu_x1, menu_y1, menu_x2, menu_y2);
file_selector_render(ted, fs);
diff --git a/ted.cfg b/ted.cfg
index 8abc633..1705862 100644
--- a/ted.cfg
+++ b/ted.cfg
@@ -14,7 +14,7 @@ undo-save-time = 6
text-size = 18
border-thickness = 1
max-menu-width = 600
-padding = 10
+padding = 6
error-display-time = 10
[keyboard]
diff --git a/ui.c b/ui.c
index 0619e21..065fb50 100644
--- a/ui.c
+++ b/ui.c
@@ -6,10 +6,9 @@ static float file_selector_entries_start_y(Ted const *ted, FileSelector const *f
Rect bounds = fs->bounds;
float padding = ted->settings.padding;
float char_height = text_font_char_height(ted->font);
- float char_height_bold = text_font_char_height(ted->font_bold);
return bounds.pos.y
- + char_height_bold + padding // make room for cwd
- + char_height * 1.5f; // make room for line buffer
+ + char_height * 0.75f + padding // make room for cwd
+ + char_height * 1.75f + padding; // make room for line buffer
}
// number of file entries that can be displayed on the screen
@@ -408,17 +407,16 @@ static void file_selector_render(Ted *ted, FileSelector *fs) {
Rect bounds = fs->bounds;
u32 n_entries = fs->n_entries;
FileEntry const *entries = fs->entries;
- Font *font = ted->font, *font_bold = ted->font_bold;
+ Font *font = ted->font;
float padding = settings->padding;
float char_height = text_font_char_height(font);
- float char_height_bold = text_font_char_height(font_bold);
float x1, y1, x2, y2;
rect_coords(bounds, &x1, &y1, &x2, &y2);
// current working directory
gl_color_rgba(colors[COLOR_TEXT]);
- text_render(font_bold, fs->cwd, x1, y1);
- y1 += char_height_bold + padding;
+ text_render(font, fs->cwd, x1, y1);
+ y1 += char_height + padding;
// search buffer
float line_buffer_height = char_height * 1.5f;