2 * Simulator of microcontrollers (app.cc)
4 * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
10 /* This file is part of microcontroller simulator: ucsim.
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
34 cl_app::cl_app(char *iname):
54 pos= new cl_box(0,0, COLS, LINES);
56 state|= SF_SELECTED;//select();
60 if ((desk= mk_desk(&b)))
72 cl_app::mk_input(void)
74 class cl_gin *i= new cl_gin();
76 i->add_input(stdin, 0);
81 cl_app::mk_palette(void)
87 p= (int*)malloc(colors * sizeof(int));
92 init_pair(i= C_WIN+C_WIN_NORMAL, COLOR_YELLOW, COLOR_BLUE);
93 p[i]= COLOR_PAIR(i)|A_BOLD;
94 for (i= 1; i < colors; i++)
95 p[i]= p[C_WIN+C_WIN_NORMAL];
97 init_pair(i= C_DSK_BG, COLOR_BLACK, COLOR_WHITE);
99 // menus and status bar
100 init_pair(i= C_DSK_NORMAL, COLOR_WHITE, COLOR_BLUE);
101 p[i]= COLOR_PAIR(i)|A_BOLD;
102 init_pair(i= C_DSK_DISABLED, COLOR_WHITE, COLOR_BLUE);
105 init_pair(i= C_WIN+C_WIN_FPASSIVE, COLOR_WHITE, COLOR_BLUE);
107 init_pair(i= C_WIN+C_WIN_FACTIVE, COLOR_WHITE, COLOR_BLUE);
108 p[i]= COLOR_PAIR(i)|A_BOLD;
109 init_pair(i= C_WIN+C_WIN_SELECTED, COLOR_YELLOW, COLOR_RED);
110 p[i]= COLOR_PAIR(i)|A_BOLD;
114 for (i= 0; i < colors; i++)
116 p[C_WIN+C_WIN_FACTIVE]|= A_BOLD;
117 p[C_WIN+C_WIN_SELECTED]|= A_REVERSE;
123 cl_app::mk_desk(class cl_box *ipos)
125 class cl_group *d= new cl_desk(ipos, "desktop", this);
132 cl_app::handle_event(struct t_event *event)
134 if (!cl_group::handle_event(event))
136 if (event->what == EV_KEY)
137 switch (event->event.key)
139 case KEY_BREAK: case KEY_EXIT:
140 event->what= EV_COMMAND;
141 event->event.msg.cmd= CMD_QUIT;
151 struct t_event event;
154 while (get_event(&event))
156 if (!handle_event(&event))
158 if (event.what == EV_COMMAND &&
159 event.event.msg.cmd == CMD_QUIT)
171 /* End of gui.src/app.cc */