1 /*------------------------------------------------------------\
2 |                                                             |
3 | This file is part of the Alliance CAD System Copyright      |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 |                                                             |
6 | Home page      : http://www-asim.lip6.fr/alliance/          |
7 | E-mail         : mailto:alliance-users@asim.lip6.fr       |
8 |                                                             |
9 | This progam is  free software; you can redistribute it      |
10 | and/or modify it under the  terms of the GNU General Public |
11 | License as  published by the Free Software Foundation;      |
12 | either version 2 of the License, or (at your option) any    |
13 | later version.                                              |
14 |                                                             |
15 | Alliance VLSI  CAD System  is distributed  in the hope that |
16 | it  will be useful, but WITHOUT  ANY WARRANTY;              |
17 | without even the  implied warranty of MERCHANTABILITY or    |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General       |
19 | Public License for more details.                            |
20 |                                                             |
21 | You should have received a copy  of the GNU General Public  |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc.,        |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                     |
25 |                                                             |
26 \------------------------------------------------------------*/
27 
28 /*------------------------------------------------------------\
29 |                                                             |
30 | Tool    :                   GRAAL                           |
31 |                                                             |
32 | File    :                Message.c                          |
33 |                                                             |
34 | Author  :                Jacomme Ludovic                    |
35 |                                                             |
36 | Date    :                  28.03.95                         |
37 |                                                             |
38 \------------------------------------------------------------*/
39 
40 /*------------------------------------------------------------\
41 |                                                             |
42 |                         Include Files                       |
43 |                                                             |
44 \------------------------------------------------------------*/
45 
46 # include <stdio.h>
47 # include <Xm/Xm.h>
48 # include <Xm/Form.h>
49 # include <Xm/Frame.h>
50 # include <Xm/Label.h>
51 # include <Xm/LabelG.h>
52 # include <Xm/TextF.h>
53 # include <Xm/Text.h>
54 
55 # include "mut.h"
56 # include "mph.h"
57 # include "rds.h"
58 # include "rpr.h"
59 # include "GSB.h"
60 # include "GTB.h"
61 # include "GMX.h"
62 # include "GMX_message.h"
63 
64 /*------------------------------------------------------------\
65 |                                                             |
66 |                           Constants                         |
67 |                                                             |
68 \------------------------------------------------------------*/
69 /*------------------------------------------------------------\
70 |                                                             |
71 |                            Types                            |
72 |                                                             |
73 \------------------------------------------------------------*/
74 /*------------------------------------------------------------\
75 |                                                             |
76 |                          Variables                          |
77 |                                                             |
78 \------------------------------------------------------------*/
79 
80   Widget        GraalMessageMainForm;
81   Widget        GraalMessageText  [ GRAAL_MAX_MESSAGE ];
82   Widget        GraalMessageLabel [ GRAAL_MAX_MESSAGE ];
83   Widget        GraalMessageFrame [ GRAAL_MAX_MESSAGE ];
84   Widget        GraalMessageForm  [ GRAAL_MAX_MESSAGE ];
85 
86   static char *GraalMessageLabelName [ GRAAL_MAX_MESSAGE ] =
87 
88          {
89            "X :",
90            "Y :",
91            "Dx :",
92            "Dy :",
93            NULL,
94            NULL,
95            NULL
96          };
97 
98   static char *GraalMessageTextName [ GRAAL_MAX_MESSAGE ] =
99 
100          {
101            "0",
102            "0",
103            "0",
104            "0",
105            "Measure",
106            "Select point",
107            "Enter base point"
108          };
109 
110   static char *GraalMessageFormName [ GRAAL_MAX_MESSAGE ] =
111 
112          {
113            "GraalMessageFormX",
114            "GraalMessageFormY",
115            "GraalMessageFormDx",
116            "GraalMessageFormDy",
117            "GraalMessageFormMode",
118            "GraalMessageFormInfo",
119            "GraalMessageFormPrompt"
120          };
121 
122   static char *GraalMessageFrameName [ GRAAL_MAX_MESSAGE ] =
123 
124          {
125            "GraalMessageFrameX",
126            "GraalMessageFrameY",
127            "GraalMessageFrameDx",
128            "GraalMessageFrameDy",
129            "GraalMessageFrameMode",
130            "GraalMessageFrameInfo",
131            "GraalMessageFramePrompt"
132          };
133 
134 /*------------------------------------------------------------\
135 |                                                             |
136 |                          Functions                          |
137 |                                                             |
138 \------------------------------------------------------------*/
139 /*------------------------------------------------------------\
140 |                                                             |
141 |                      GraalDisplayMessage                    |
142 |                                                             |
143 \------------------------------------------------------------*/
144 
GraalDisplayMessage(Where,Text)145 void GraalDisplayMessage( Where, Text )
146 
147      char  Where;
148      char *Text;
149 {
150   XmString TextString;
151 
152   rdsbegin();
153 
154   TextString = XmStringCreateSimple( Text );
155 
156   XtVaSetValues( GraalMessageText[ (int)Where ], XmNlabelString, TextString, NULL );
157 
158   XmStringFree( TextString );
159 
160   rdsend();
161 }
162 
163 /*------------------------------------------------------------\
164 |                                                             |
165 |                     GraalPromptEditMeasure                  |
166 |                                                             |
167 \------------------------------------------------------------*/
168 
GraalPromptEditMeasure()169 void GraalPromptEditMeasure()
170 
171 {
172   rdsbegin();
173 
174   GraalDisplayMessage( GRAAL_MESSAGE_MODE  , "Measure" );
175   GraalDisplayMessage( GRAAL_MESSAGE_PROMPT, "Enter base point" );
176   GraalDisplayMessage( GRAAL_MESSAGE_INFO  , "Select point" );
177 
178   rdsend();
179 }
180 
181 /*------------------------------------------------------------\
182 |                                                             |
183 |                    GraalInitializeMessage                   |
184 |                                                             |
185 \------------------------------------------------------------*/
186 
GraalInitializeMessage()187 void GraalInitializeMessage()
188 
189 {
190   int Counter;
191   int Column;
192   int Left;
193   int Width;
194 
195   rdsbegin();
196 
197   GraalMessageMainForm =
198 
199     XtVaCreateManagedWidget( "GraalMessageMainForm",
200                               xmFormWidgetClass    ,
201                               GraalMainForm        ,
202                               XmNtopAttachment     , XmATTACH_POSITION,
203                               XmNtopPosition       , 193,
204                               XmNbottomAttachment  , XmATTACH_POSITION,
205                               XmNbottomPosition    , 199,
206                               XmNleftAttachment    , XmATTACH_POSITION,
207                               XmNleftPosition      , 0,
208                               XmNrightAttachment   , XmATTACH_POSITION,
209                               XmNrightPosition     , 200,
210                               XmNfractionBase      , 200,
211                               NULL );
212 
213   Column = 1;
214   Width  = 17;
215 
216   for ( Counter = 0; Counter < GRAAL_MAX_MESSAGE; Counter++ )
217   {
218     if ( Counter == 4 ) Width = 22;
219     if ( Counter == 5 ) Width = 68;
220     if ( Counter == 6 ) Width = 40;
221 
222     GraalMessageFrame[ Counter ] =
223 
224       XtVaCreateManagedWidget( GraalMessageFrameName[ Counter ],
225                                xmFrameWidgetClass,
226                                GraalMessageMainForm,
227                                XmNshadowType            , XmSHADOW_ETCHED_IN,
228                                XmNleftAttachment        , XmATTACH_POSITION,
229                                XmNleftPosition          , Column,
230                                XmNrightAttachment       , XmATTACH_POSITION,
231                                XmNrightPosition         , Column + Width,
232                                XmNtopAttachment         , XmATTACH_FORM,
233                                XmNbottomAttachment      , XmATTACH_FORM,
234                                NULL
235                              );
236 
237     GraalMessageForm[ Counter ] =
238 
239       XtVaCreateManagedWidget( GraalMessageFormName[ Counter ],
240                                xmFormWidgetClass   ,
241                                GraalMessageFrame[ Counter ],
242                                XmNleftAttachment           , XmATTACH_FORM,
243                                XmNrightAttachment          , XmATTACH_FORM,
244                                XmNtopAttachment            , XmATTACH_FORM,
245                                XmNbottomAttachment         , XmATTACH_FORM,
246                                XmNfractionBase             , 18,
247                                NULL
248                              );
249 
250     if ( GraalMessageLabelName[ Counter ] != (char *)NULL )
251     {
252       GraalMessageLabel [ Counter ] =
253 
254         XtVaCreateManagedWidget( GraalMessageLabelName[ Counter ],
255                                  xmLabelWidgetClass,
256                                  GraalMessageForm [ Counter ],
257                                  XmNleftAttachment           , XmATTACH_FORM,
258                                  XmNrightAttachment          , XmATTACH_POSITION,
259                                  XmNrightPosition            , 6,
260                                  XmNbottomAttachment         , XmATTACH_FORM,
261                                  XmNtopAttachment            , XmATTACH_FORM,
262                                  XmNrecomputeSize            , False,
263                                  NULL
264                                );
265       Left = 6;
266     }
267     else
268     {
269       Left = 0;
270     }
271 
272     GraalMessageText [ Counter ]  =
273 
274       XtVaCreateManagedWidget( GraalMessageTextName[ Counter ],
275                                xmLabelWidgetClass,
276                                GraalMessageForm [ Counter ],
277                                XmNtopAttachment            , XmATTACH_FORM,
278                                XmNbottomAttachment         , XmATTACH_FORM,
279                                XmNrightAttachment          , XmATTACH_FORM,
280                                XmNleftAttachment           , XmATTACH_POSITION,
281                                XmNleftPosition             , Left,
282                                XmNrecomputeSize            , False,
283                                NULL
284                              );
285 
286     Column = Column + Width;
287   }
288 
289   rdsend();
290 }
291