Imported Upstream version 2.9.0
[debian/cc1111] / sim / ucsim / gui.src / obsolete / win.cc
1 /*
2  * Simulator of microcontrollers (win.cc)
3  *
4  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
5  * 
6  * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
7  *
8  */
9
10 /* This file is part of microcontroller simulator: ucsim.
11
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.
16
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.
21
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
25 02111-1307, USA. */
26 /*@1@*/
27
28 #include "ddconfig.h"
29
30 #include <stdlib.h>
31 #include "i_string.h"
32
33 #include "wincl.h"
34
35
36 cl_win::cl_win(class cl_box *ipos, char *ititle, class cl_app *iapp):
37   cl_group(ipos, 0, iapp)
38 {
39   title= strdup(ititle);
40   free(name);
41   if (!ititle ||
42       !(*ititle))
43     {
44       name= (char*)malloc(100);
45       sprintf(name, "win%p", this);
46     }
47   else
48     name= strdup(ititle);
49 }
50
51 cl_win::~cl_win(void)
52 {
53   if (frame)
54     delete frame;
55   if (title)
56     free(title);
57 }
58
59 int
60 cl_win::init(void)
61 {
62   cl_group::init();
63   if ((frame= mk_frame(pos)))
64     insert(frame);
65   class cl_box *b= new cl_box(pos->x,pos->y, pos->w,pos->h);
66   b->move_rel(1,1);
67   b->grow(-2,-2);
68   if ((intern= mk_intern(b)))
69     insert(intern);
70   //draw();
71   delete b;
72   return(0);
73 }
74
75 int *
76 cl_win::mk_palette(void)
77 {
78   int *p= (int*)malloc(8*sizeof(int)), i;
79   for (i= 0; i < 8; i++)
80     p[i]= i+C_WIN;
81   return(p);
82 }
83
84 class cl_frame *
85 cl_win::mk_frame(class cl_box *ipos)
86 {
87   char n[100]= "";
88   
89   sprintf(n, "frameof_\"%s\"", name);
90   class cl_frame *f= new cl_frame(ipos, this, n, app);
91   f->init();
92   return(f);
93 }
94
95 class cl_view *
96 cl_win::mk_intern(class cl_box *ipos)
97 {
98   class cl_view *v= new cl_view(ipos, 0, app);
99   v->init();
100   v->options&= ~OF_SELECTABLE;
101   return(v);
102 }
103
104 char *
105 cl_win::get_title(void)
106 {
107   return(title);
108 }
109
110
111 /* End of gui.src/win.cc */