This commit is contained in:
Chris 2026-02-24 18:07:05 +01:00
parent f6e53fa7c6
commit f694c490a6
10 changed files with 88 additions and 85 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -250,13 +250,16 @@ static void editor_paint(Window *win) {
int content_width = win->w - 8;
int content_height = win->h - 28;
// Draw filename and save button area at top of content
draw_rect(offset_x, offset_y, content_width, 25, COLOR_GRAY);
draw_string(offset_x + 10, offset_y + 5, "File", COLOR_DARK_TEXT);
draw_string(offset_x + 55, offset_y + 5, open_filename, COLOR_DARK_TEXT);
// Top content bar (modern dark, rounded)
draw_rounded_rect_filled(offset_x, offset_y, content_width, 25, 6, COLOR_DARK_PANEL);
draw_string(offset_x + 10, offset_y + 6, "File", COLOR_DARK_TEXT);
draw_string(offset_x + 55, offset_y + 6, open_filename, COLOR_DARK_TEXT);
// Draw save button
draw_button(offset_x + content_width - 80, offset_y + 3, 70, 20, "Save", false);
// Save button (modern rounded)
int save_btn_x = offset_x + content_width - 80;
int save_btn_y = offset_y + 3;
draw_rounded_rect_filled(save_btn_x, save_btn_y, 70, 20, 6, COLOR_DARK_BORDER);
draw_string(save_btn_x + 20, save_btn_y + 6, "Save", COLOR_DARK_TEXT);
// Draw modification indicator
if (file_modified) {
@ -364,7 +367,7 @@ static void editor_paint(Window *win) {
}
if (draw_cursor) {
int cursor_x = text_start_x + ((cursor_col - segment_start) * EDITOR_CHAR_WIDTH);
draw_rect(cursor_x, current_display_y, 2, 10, COLOR_BLACK);
draw_rect(cursor_x, current_display_y, 2, 10, COLOR_WHITE);
}
}
@ -377,9 +380,10 @@ static void editor_paint(Window *win) {
line_idx++;
}
// Draw status bar at bottom
draw_rect(offset_x, offset_y + content_height - 20, content_width, 20, COLOR_GRAY);
draw_string(offset_x + 10, offset_y + content_height - 15, "Line: ", COLOR_DARK_TEXT);
// Status bar at bottom (modern dark, rounded)
int status_y = offset_y + content_height - 20;
draw_rounded_rect_filled(offset_x, status_y, content_width, 20, 6, COLOR_DARK_PANEL);
draw_string(offset_x + 10, status_y + 5, "Line: ", COLOR_DARK_TEXT);
char line_str[32];
int temp = cursor_line + 1;
@ -395,8 +399,8 @@ static void editor_paint(Window *win) {
}
line_str[idx] = 0;
draw_string(offset_x + 60, offset_y + content_height - 15, line_str, COLOR_DARK_TEXT);
draw_string(offset_x + 100, offset_y + content_height - 15, " Col: ", COLOR_DARK_TEXT);
draw_string(offset_x + 60, status_y + 5, line_str, COLOR_DARK_TEXT);
draw_string(offset_x + 100, status_y + 5, " Col: ", COLOR_DARK_TEXT);
char col_str[32];
temp = cursor_col + 1;
@ -412,7 +416,7 @@ static void editor_paint(Window *win) {
}
col_str[idx] = 0;
draw_string(offset_x + 170, offset_y + content_height - 15, col_str, COLOR_DARK_TEXT);
draw_string(offset_x + 170, status_y + 5, col_str, COLOR_DARK_TEXT);
}
// === Key Handler ===

View file

@ -599,9 +599,9 @@ static int explorer_build_context_menu(Window *win, ExplorerContextItem *items_o
return 0;
}
// Dead space
items_out[count++] = (ExplorerContextItem){"New File", 101, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"New Folder", 102, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"Paste", 103, explorer_clipboard_has_content(), explorer_clipboard_has_content() ? COLOR_BLACK : COLOR_DKGRAY};
items_out[count++] = (ExplorerContextItem){"New File", 101, true, COLOR_WHITE};
items_out[count++] = (ExplorerContextItem){"New Folder", 102, true, COLOR_WHITE};
items_out[count++] = (ExplorerContextItem){"Paste", 103, explorer_clipboard_has_content(), explorer_clipboard_has_content() ? COLOR_WHITE : COLOR_DKGRAY};
} else {
if (explorer_str_starts_with(state->current_path, "/RecycleBin")) {
items_out[count++] = (ExplorerContextItem){"Restore", ACTION_RESTORE, true, COLOR_BLACK};
@ -612,28 +612,28 @@ static int explorer_build_context_menu(Window *win, ExplorerContextItem *items_o
bool is_dir = state->items[state->file_context_menu_item].is_directory;
if (!is_dir) {
items_out[count++] = (ExplorerContextItem){"Open", 100, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"Open w/ textedit", 110, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"Open", 100, true, COLOR_WHITE};
items_out[count++] = (ExplorerContextItem){"Open w/ textedit", 110, true, COLOR_WHITE};
if (explorer_is_markdown_file(state->items[state->file_context_menu_item].name)) {
items_out[count++] = (ExplorerContextItem){"Open w/ Markdown", 109, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"Open w/ Markdown", 109, true, COLOR_WHITE};
}
}
items_out[count++] = (ExplorerContextItem){"Cut", 104, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"Copy", 105, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"Cut", 104, true, COLOR_WHITE};
items_out[count++] = (ExplorerContextItem){"Copy", 105, true, COLOR_WHITE};
if (is_dir) {
items_out[count++] = (ExplorerContextItem){"Paste", 103, explorer_clipboard_has_content(), explorer_clipboard_has_content() ? COLOR_BLACK : COLOR_DKGRAY};
items_out[count++] = (ExplorerContextItem){"Open in new window", 112, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"Paste", 103, explorer_clipboard_has_content(), explorer_clipboard_has_content() ? COLOR_WHITE : COLOR_DKGRAY};
items_out[count++] = (ExplorerContextItem){"Open in new window", 112, true, COLOR_WHITE};
}
items_out[count++] = (ExplorerContextItem){"Delete", 106, true, COLOR_RED};
items_out[count++] = (ExplorerContextItem){"Rename", 111, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"Create Shortcut", ACTION_CREATE_SHORTCUT, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"Rename", 111, true, COLOR_WHITE};
items_out[count++] = (ExplorerContextItem){"Create Shortcut", ACTION_CREATE_SHORTCUT, true, COLOR_WHITE};
if (is_dir) {
items_out[count++] = (ExplorerContextItem){"New File", 101, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"New Folder", 102, true, COLOR_BLACK};
items_out[count++] = (ExplorerContextItem){"New File", 101, true, COLOR_WHITE};
items_out[count++] = (ExplorerContextItem){"New Folder", 102, true, COLOR_WHITE};
// Only show color options if it's NOT the Recycle Bin folder (i love hardcoding stuff cause it's lowk easier (cry about it))
if (explorer_strcmp(state->items[state->file_context_menu_item].name, "RecycleBin") != 0) {
@ -1079,12 +1079,11 @@ static void explorer_paint(Window *win) {
int menu_y = offset_y + 34;
// Draw menu background
draw_rect(menu_x, menu_y, DROPDOWN_MENU_WIDTH, dropdown_menu_item_height * DROPDOWN_MENU_ITEMS, COLOR_LTGRAY);
draw_bevel_rect(menu_x, menu_y, DROPDOWN_MENU_WIDTH, dropdown_menu_item_height * DROPDOWN_MENU_ITEMS, true);
draw_rounded_rect_filled(menu_x, menu_y, DROPDOWN_MENU_WIDTH, dropdown_menu_item_height * DROPDOWN_MENU_ITEMS, 6, COLOR_DARK_PANEL);
// Draw menu items
draw_string(menu_x + 8, menu_y + 5, "New File", COLOR_BLACK);
draw_string(menu_x + 8, menu_y + dropdown_menu_item_height + 5, "New Folder", COLOR_BLACK);
draw_string(menu_x + 8, menu_y + 5, "New File", COLOR_WHITE);
draw_string(menu_x + 8, menu_y + dropdown_menu_item_height + 5, "New Folder", COLOR_WHITE);
draw_string(menu_x + 8, menu_y + dropdown_menu_item_height * 2 + 5, "Delete", COLOR_RED);
}
@ -1093,40 +1092,42 @@ static void explorer_paint(Window *win) {
int dlg_x = win->x + win->w / 2 - 150;
int dlg_y = win->y + win->h / 2 - 60;
// Dialog background
draw_rect(dlg_x - 5, dlg_y - 5, 310, 120, COLOR_LTGRAY);
draw_bevel_rect(dlg_x, dlg_y, 300, 110, true);
// Dialog background (modern dark, rounded)
draw_rounded_rect_filled(dlg_x, dlg_y, 300, 110, 8, COLOR_DARK_PANEL);
// Title
draw_string(dlg_x + 10, dlg_y + 10, "Create New File", COLOR_BLACK);
draw_string(dlg_x + 10, dlg_y + 10, "Create New File", COLOR_WHITE);
// Input field
draw_bevel_rect(dlg_x + 10, dlg_y + 35, 280, 20, false);
draw_string(dlg_x + 15, dlg_y + 40, state->dialog_input, COLOR_BLACK);
draw_rect(dlg_x + 15 + state->dialog_input_cursor * 8, dlg_y + 39, 2, 12, COLOR_BLACK);
// Input field (rounded dark)
draw_rounded_rect_filled(dlg_x + 10, dlg_y + 35, 280, 20, 4, COLOR_DARK_BG);
draw_string(dlg_x + 15, dlg_y + 40, state->dialog_input, COLOR_WHITE);
draw_rect(dlg_x + 15 + state->dialog_input_cursor * 8, dlg_y + 39, 2, 12, COLOR_WHITE);
// Buttons
draw_button(dlg_x + 50, dlg_y + 65, 80, 25, "Create", false);
draw_button(dlg_x + 170, dlg_y + 65, 80, 25, "Cancel", false);
// Buttons (rounded)
draw_rounded_rect_filled(dlg_x + 50, dlg_y + 65, 80, 25, 6, COLOR_DARK_BORDER);
draw_string(dlg_x + 70, dlg_y + 72, "Create", COLOR_WHITE);
draw_rounded_rect_filled(dlg_x + 170, dlg_y + 65, 80, 25, 6, COLOR_DARK_BORDER);
draw_string(dlg_x + 185, dlg_y + 72, "Cancel", COLOR_WHITE);
} else if (state->dialog_state == DIALOG_CREATE_FOLDER) {
int dlg_x = win->x + win->w / 2 - 150;
int dlg_y = win->y + win->h / 2 - 60;
// Dialog background
draw_rect(dlg_x - 5, dlg_y - 5, 310, 120, COLOR_LTGRAY);
draw_bevel_rect(dlg_x, dlg_y, 300, 110, true);
// Dialog background (modern dark, rounded)
draw_rounded_rect_filled(dlg_x, dlg_y, 300, 110, 8, COLOR_DARK_PANEL);
// Title
draw_string(dlg_x + 10, dlg_y + 10, "Create New Folder", COLOR_BLACK);
draw_string(dlg_x + 10, dlg_y + 10, "Create New Folder", COLOR_WHITE);
// Input field
draw_bevel_rect(dlg_x + 10, dlg_y + 35, 280, 20, false);
draw_string(dlg_x + 15, dlg_y + 40, state->dialog_input, COLOR_BLACK);
draw_rect(dlg_x + 15 + state->dialog_input_cursor * 8, dlg_y + 39, 2, 12, COLOR_BLACK);
// Input field (rounded dark)
draw_rounded_rect_filled(dlg_x + 10, dlg_y + 35, 280, 20, 4, COLOR_DARK_BG);
draw_string(dlg_x + 15, dlg_y + 40, state->dialog_input, COLOR_WHITE);
draw_rect(dlg_x + 15 + state->dialog_input_cursor * 8, dlg_y + 39, 2, 12, COLOR_WHITE);
// Buttons
draw_button(dlg_x + 50, dlg_y + 65, 80, 25, "Create", false);
draw_button(dlg_x + 170, dlg_y + 65, 80, 25, "Cancel", false);
// Buttons (rounded)
draw_rounded_rect_filled(dlg_x + 50, dlg_y + 65, 80, 25, 6, COLOR_DARK_BORDER);
draw_string(dlg_x + 70, dlg_y + 72, "Create", COLOR_WHITE);
draw_rounded_rect_filled(dlg_x + 170, dlg_y + 65, 80, 25, 6, COLOR_DARK_BORDER);
draw_string(dlg_x + 185, dlg_y + 72, "Cancel", COLOR_WHITE);
} else if (state->dialog_state == DIALOG_DELETE_CONFIRM) {
int dlg_x = win->x + win->w / 2 - 150;
int dlg_y = win->y + win->h / 2 - 60;
@ -1221,16 +1222,16 @@ static void explorer_paint(Window *win) {
int dlg_y = win->y + win->h / 2 - 60;
draw_rect(dlg_x - 5, dlg_y - 5, 310, 120, COLOR_LTGRAY);
draw_bevel_rect(dlg_x, dlg_y, 300, 110, true);
draw_string(dlg_x + 10, dlg_y + 10, "Rename", COLOR_BLACK);
draw_bevel_rect(dlg_x + 10, dlg_y + 35, 280, 20, false);
draw_string(dlg_x + 15, dlg_y + 40, state->dialog_input, COLOR_BLACK);
draw_rect(dlg_x + 15 + state->dialog_input_cursor * 8, dlg_y + 39, 2, 12, COLOR_BLACK);
draw_button(dlg_x + 50, dlg_y + 65, 80, 25, "Rename", false);
draw_button(dlg_x + 170, dlg_y + 65, 80, 25, "Cancel", false);
// Rename dialog (modern)
draw_rounded_rect_filled(dlg_x, dlg_y, 300, 110, 8, COLOR_DARK_PANEL);
draw_string(dlg_x + 10, dlg_y + 10, "Rename", COLOR_WHITE);
draw_rounded_rect_filled(dlg_x + 10, dlg_y + 35, 280, 20, 4, COLOR_DARK_BG);
draw_string(dlg_x + 15, dlg_y + 40, state->dialog_input, COLOR_WHITE);
draw_rect(dlg_x + 15 + state->dialog_input_cursor * 8, dlg_y + 39, 2, 12, COLOR_WHITE);
draw_rounded_rect_filled(dlg_x + 50, dlg_y + 65, 80, 25, 6, COLOR_DARK_BORDER);
draw_string(dlg_x + 68, dlg_y + 72, "Rename", COLOR_WHITE);
draw_rounded_rect_filled(dlg_x + 170, dlg_y + 65, 80, 25, 6, COLOR_DARK_BORDER);
draw_string(dlg_x + 185, dlg_y + 72, "Cancel", COLOR_WHITE);
}
// Draw context menu if visible
@ -1248,17 +1249,17 @@ static void explorer_paint(Window *win) {
else menu_height += CONTEXT_MENU_ITEM_HEIGHT;
}
// Draw menu background
draw_rect(menu_screen_x, menu_screen_y, FILE_CONTEXT_MENU_WIDTH, menu_height, COLOR_LTGRAY);
draw_bevel_rect(menu_screen_x, menu_screen_y, FILE_CONTEXT_MENU_WIDTH, menu_height, true);
// Draw menu background (modern dark, rounded)
draw_rounded_rect_filled(menu_screen_x, menu_screen_y, FILE_CONTEXT_MENU_WIDTH, menu_height, 8, COLOR_DARK_PANEL);
int y_offset = 0;
for (int i = 0; i < count; i++) {
if (menu_items[i].action_id == 0) {
draw_rect(menu_screen_x + 2, menu_screen_y + y_offset + 2, FILE_CONTEXT_MENU_WIDTH - 4, 1, COLOR_DKGRAY);
// Separator (subtle)
draw_rect(menu_screen_x + 8, menu_screen_y + y_offset + 3, FILE_CONTEXT_MENU_WIDTH - 16, 1, COLOR_DARK_BORDER);
y_offset += 5;
} else {
draw_string(menu_screen_x + 5, menu_screen_y + y_offset + 5, menu_items[i].label, menu_items[i].color);
draw_string(menu_screen_x + 10, menu_screen_y + y_offset + 6, menu_items[i].label, menu_items[i].color);
y_offset += CONTEXT_MENU_ITEM_HEIGHT;
}
}

View file

@ -563,7 +563,6 @@ void draw_paint_icon(int x, int y, const char *label) {
draw_icon_label(x, y, label);
}
// New macOS-style drawing functions
static void draw_filled_circle(int cx, int cy, int r, uint32_t color);
// Draw traffic light (close button - red)
@ -579,14 +578,13 @@ void draw_squircle_icon(int x, int y, const char *label, uint32_t bg_color) {
draw_icon_label(x, y + 60, label);
}
// macOS Files icon (folder style)
// Files icon
void draw_files_icon(int x, int y, const char *label) {
// Blue folder icon with macOS styling
draw_rounded_rect_filled(x + 27, y + 6, 25, 15, 3, 0xFF4A90E2); // Blue color
draw_squircle_icon(x, y, label, 0xFF4A90E2);
}
// macOS Settings/Gear icon
// Settings/Gear icon
void draw_settings_icon(int x, int y, const char *label) {
// Gear icon with dark background
draw_squircle_icon(x, y, label, 0xFF666666);
@ -1027,16 +1025,16 @@ void wm_paint(void) {
if (desktop_menu_target_icon != -1) {
bool can_paste = explorer_clipboard_has_content();
draw_string(desktop_menu_x + 10, desktop_menu_y + 5, "Cut", COLOR_DARK_TEXT);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h, "Copy", COLOR_DARK_TEXT);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h * 2, "Paste", can_paste ? COLOR_DARK_TEXT : COLOR_DKGRAY);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5, "Cut", COLOR_WHITE);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h, "Copy", COLOR_WHITE);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h * 2, "Paste", can_paste ? COLOR_WHITE : COLOR_DKGRAY);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h * 3, "Delete", COLOR_TRAFFIC_RED);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h * 4, "Rename", COLOR_DARK_TEXT);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h * 4, "Rename", COLOR_WHITE);
} else {
bool can_paste = explorer_clipboard_has_content();
draw_string(desktop_menu_x + 10, desktop_menu_y + 5, "New File", COLOR_DARK_TEXT);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h, "New Folder", COLOR_DARK_TEXT);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h * 2, "Paste", can_paste ? COLOR_DARK_TEXT : COLOR_DKGRAY);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5, "New File", COLOR_WHITE);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h, "New Folder", COLOR_WHITE);
draw_string(desktop_menu_x + 10, desktop_menu_y + 5 + item_h * 2, "Paste", can_paste ? COLOR_WHITE : COLOR_DKGRAY);
}
}
@ -1053,17 +1051,17 @@ void wm_paint(void) {
if (desktop_dialog_state == 1) { title = "Create New File"; btn_text = "Create"; }
else if (desktop_dialog_state == 2) { title = "Create New Folder"; btn_text = "Create"; }
draw_string(dlg_x + 10, dlg_y + 10, title, COLOR_DARK_TEXT);
draw_string(dlg_x + 10, dlg_y + 10, title, COLOR_WHITE);
draw_rounded_rect_filled(dlg_x + 10, dlg_y + 35, 280, 20, 4, COLOR_DARK_BG);
draw_string(dlg_x + 15, dlg_y + 40, desktop_dialog_input, COLOR_DARK_TEXT);
draw_string(dlg_x + 15, dlg_y + 40, desktop_dialog_input, COLOR_WHITE);
// Cursor
draw_rect(dlg_x + 15 + desktop_dialog_cursor * 8, dlg_y + 39, 2, 12, COLOR_DARK_TEXT);
draw_rect(dlg_x + 15 + desktop_dialog_cursor * 8, dlg_y + 39, 2, 12, COLOR_WHITE);
draw_rounded_rect_filled(dlg_x + 50, dlg_y + 65, 80, 25, 4, COLOR_DARK_BORDER);
draw_string(dlg_x + 70, dlg_y + 72, btn_text, COLOR_DARK_TEXT);
draw_string(dlg_x + 70, dlg_y + 72, btn_text, COLOR_WHITE);
draw_rounded_rect_filled(dlg_x + 170, dlg_y + 65, 80, 25, 4, COLOR_DARK_BORDER);
draw_string(dlg_x + 185, dlg_y + 72, "Cancel", COLOR_DARK_TEXT);
draw_string(dlg_x + 185, dlg_y + 72, "Cancel", COLOR_WHITE);
}
// Message Box (dark mode)