/* gui.c
This file is part of the "First" CPU simulator project.
Copyright (c) 2024 Efthymios Kritikos
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
#include
#include
#include "simdata.h"
int terminal_width;
int terminal_height;
WINDOW *tabs;
int monochrome;
int get_terminal_size(){
int new_height,new_width;
getmaxyx(stdscr,new_height,new_width);
int changed=(new_width!=terminal_width)||(new_height!=terminal_height);
terminal_width=new_width;
terminal_height=new_height;
return changed;
}
int gui_ncurses_refresh(){
if(refresh()==ERR)
return 1;
if(wrefresh(tabs)==ERR)
return 1;
return 0;
}
char *tab_name[]={"Overview","Memory","Test"};
unsigned int CURRENT_TAB=0;
enum CPU_STATE_t CPU_STATE=STOPPED;
void update_tabs(){
wattron(tabs,COLOR_PAIR(2));
for(int i=0;i