implemented settings functionallity
This commit is contained in:
12
main.c
12
main.c
@ -9,7 +9,7 @@ unsigned int terminal_height;
|
||||
unsigned int terminal_width;
|
||||
unsigned int temp_heigth = 0; //used for screen refresh
|
||||
unsigned int temp_width = 0;
|
||||
unsigned int settings;
|
||||
unsigned int settings = 1;
|
||||
unsigned int status; //bit 0 = enable
|
||||
char **content_l; //content of parent dir, used in left window
|
||||
char **content_m; //content of current dir, used in main window
|
||||
@ -20,15 +20,19 @@ char *path = ".";
|
||||
int main() {
|
||||
initscr(); //start ncurses
|
||||
timeout(50); //blocking timeout of getch()
|
||||
keypad(stdscr, TRUE);
|
||||
|
||||
getmaxyx(stdscr, terminal_height, terminal_width);
|
||||
WINDOW *winl = newwin(terminal_height, terminal_width/3, terminal_height, (terminal_width/3));
|
||||
WINDOW *winm = newwin(terminal_height, terminal_width/3, 0, 0);
|
||||
WINDOW *winr = newwin(terminal_height, terminal_width/3, terminal_height, ((terminal_width/3)*2));
|
||||
settings ^= 1; //bit 0 = show_hidden_files
|
||||
status = 2; //update ui bit
|
||||
status ^= 2; //update ui bit
|
||||
char input = 0;
|
||||
|
||||
content_l = calloc(1, sizeof(*content_l)); //allocation in order to allow a more streamlined backend
|
||||
content_m = calloc(1, sizeof(*content_m));
|
||||
content_r = calloc(1, sizeof(*content_r));
|
||||
|
||||
while(!(status & 1)){
|
||||
getmaxyx(stdscr, temp_heigth, temp_width);
|
||||
@ -51,7 +55,7 @@ int main() {
|
||||
getmaxyx(stdscr, terminal_height, terminal_width);
|
||||
temp_heigth -= terminal_height;
|
||||
temp_width -= terminal_width;
|
||||
if (!temp_heigth || !temp_width || (status & 2)) {
|
||||
if (!temp_heigth || !temp_width || (status & 2)) { //updates screen
|
||||
window_left(winl, 0, 0, content_l);
|
||||
window_main(winm, 0, terminal_width/3, content_m);
|
||||
window_right(winr, 0, (terminal_width/3)*2, content_r);
|
||||
@ -62,7 +66,7 @@ int main() {
|
||||
|
||||
|
||||
if ((input = getch())) {
|
||||
user_interactions(&input, &status);
|
||||
user_interactions(&input, &status, &settings);
|
||||
}
|
||||
}
|
||||
free(content_l);
|
||||
|
Reference in New Issue
Block a user