-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathterminal_gui.c
More file actions
58 lines (54 loc) · 1.38 KB
/
Copy pathterminal_gui.c
File metadata and controls
58 lines (54 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "terminal_gui.h"
// Initialize the terminal GUI
void init_terminal_gui()
{
printf("\033[H\033[J"); // Clear the screen
printf("%s=== File Management System Initialized ===%s\n", COLOR_CYAN, COLOR_RESET);
}
// Clean up the terminal GUI
void cleanup_terminal_gui()
{
printf("\n%s=== Exiting File Management System ===%s\n", COLOR_RED, COLOR_RESET);
}
// Add a command to the history sidebar
void add_to_history(const char *command, int color_code)
{
const char *color = COLOR_RESET; // Default color
switch (color_code)
{
case 0:
color = COLOR_GREEN; // File operations
break;
case 1:
color = COLOR_BLUE; // Directory operations
break;
case 2:
color = COLOR_YELLOW; // System operations
break;
case 3:
color = COLOR_CYAN; // Navigation
break;
case 4:
color = COLOR_MAGENTA; // Other operations
break;
default:
color = COLOR_RESET; // Default color
}
printf("%s[History] %s%s\n", color, command, COLOR_RESET);
}
// Show a popup message
void show_popup_message(const char *message)
{
int len = strlen(message);
int padding = (80 - len) / 2; // Center-align the message
printf("\n");
for (int i = 0; i < 80; i++)
printf("-");
printf("\n");
for (int i = 0; i < padding; i++)
printf(" ");
printf("%s%s%s\n", COLOR_YELLOW, message, COLOR_RESET);
for (int i = 0; i < 80; i++)
printf("-");
printf("\n");
}