~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to xmetanet/text.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright INRIA */
 
2
#include <stdio.h>
 
3
#include <X11/Intrinsic.h>
 
4
#include <X11/Shell.h>
 
5
#include <X11/StringDefs.h>
 
6
#include <X11/Xaw/Form.h>
 
7
#include <X11/Xaw/Command.h>
 
8
#include <X11/Xaw/AsciiText.h>
 
9
 
 
10
#include "metaconst.h"
 
11
#include "metawin.h"
 
12
#include "graphics.h"
 
13
 
 
14
extern void GetMetanetGeometry();
 
15
 
 
16
#define STRINGLEN 100000
 
17
#define MAXNAM 80
 
18
 
 
19
static int iText = 0;
 
20
static int iStr = 0;
 
21
static char Str[STRINGLEN];
 
22
 
 
23
void TextClose(w,shell,callData)
 
24
Widget w;
 
25
caddr_t shell;
 
26
caddr_t callData;
 
27
{
 
28
  XtPopdown((Widget)shell);
 
29
  XtDestroyWidget((Widget)shell);
 
30
}
 
31
 
 
32
void StartAddText()
 
33
{
 
34
  iStr = 0;
 
35
  Str[0] = '\0';
 
36
}  
 
37
 
 
38
void AddText(description)
 
39
char *description;
 
40
{
 
41
  sprintf(&Str[iStr],description);
 
42
  iStr = strlen(Str);
 
43
}
 
44
 
 
45
void EndAddText()
 
46
{
 
47
  Widget text, textclose;
 
48
  Arg args[10];
 
49
  int iargs = 0;
 
50
  Widget shell;
 
51
  XtCallbackRec callbacks[2];
 
52
  char name[MAXNAM];
 
53
  int x,y,w,h;
 
54
 
 
55
  if(iText++ > 4) iText = 1;
 
56
  GetMetanetGeometry(&x,&y,&w,&h);
 
57
 
 
58
  callbacks[1].callback = NULL;
 
59
  callbacks[1].closure = NULL;
 
60
  
 
61
  XtSetArg(args[iargs], XtNx, x + iText * incX); iargs++;
 
62
  XtSetArg(args[iargs], XtNy, y + iText * incY); iargs++;
 
63
  XtSetArg(args[iargs], XtNfont, theG.metafont); iargs++;
 
64
  sprintf(name,"Metanet Text %d",iText);
 
65
  shell = XtCreatePopupShell(name,transientShellWidgetClass,toplevel,
 
66
                             args,iargs);
 
67
 
 
68
  iargs = 0;
 
69
  XtSetArg(args[iargs], XtNfont, theG.metafont); iargs++;
 
70
  text = XtCreateManagedWidget("text",formWidgetClass,shell,args,iargs);
 
71
 
 
72
  callbacks[0].callback = (XtCallbackProc)TextClose;
 
73
  callbacks[0].closure = (caddr_t)shell;
 
74
  iargs = 0;
 
75
  XtSetArg(args[iargs], XtNlabel, "Close" ); iargs++;
 
76
  XtSetArg(args[iargs], XtNcallback, callbacks); iargs++;
 
77
  XtSetArg(args[iargs], XtNfont, theG.metafont); iargs++;
 
78
  XtSetArg(args[iargs], XtNbottom, XawChainTop); iargs++;
 
79
  XtSetArg(args[iargs], XtNtop, XawChainTop); iargs++;
 
80
  XtSetArg(args[iargs], XtNleft, XawChainLeft); iargs++;
 
81
  XtSetArg(args[iargs], XtNright, XawChainLeft); iargs++;
 
82
  textclose = XtCreateManagedWidget("textcommand",commandWidgetClass,
 
83
                        text,args,iargs);
 
84
 
 
85
  iargs = 0;
 
86
  XtSetArg(args[iargs], XtNstring, Str); iargs++;
 
87
  XtSetArg(args[iargs], XtNborderWidth, 1); iargs++;
 
88
  XtSetArg(args[iargs], XtNeditType, XawtextRead); iargs++;
 
89
  XtSetArg(args[iargs], XtNwrap, XawtextWrapWord); iargs++;
 
90
  XtSetArg(args[iargs], XtNscrollVertical, XawtextScrollWhenNeeded); iargs++;
 
91
  XtSetArg(args[iargs], XtNwidth, metaWidth/2); iargs++;
 
92
  XtSetArg(args[iargs], XtNheight, metaHeight/2); iargs++;
 
93
  XtSetArg(args[iargs], XtNfont, theG.metafont); iargs++;
 
94
  XtSetArg(args[iargs], XtNfromVert, textclose); iargs++;
 
95
  XtCreateManagedWidget("asciitext",asciiTextWidgetClass,
 
96
                                text,args,iargs);
 
97
 
 
98
  XtPopup(shell,XtGrabNone);
 
99
}