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

« back to all changes in this revision

Viewing changes to xmetanet/help.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/Command.h>
 
7
#include <X11/Xaw/Form.h>
 
8
#include <X11/Xaw/AsciiText.h>
 
9
 
 
10
#include "metaconst.h"
 
11
#include "metadir.h"
 
12
#include "metawin.h"
 
13
#include "graphics.h"
 
14
 
 
15
extern void GetMetanetGeometry();
 
16
extern char beginHelp[];
 
17
extern char studyHelp[];
 
18
extern char modifyHelp[];
 
19
 
 
20
void HelpClose(w,shell,callData)
 
21
Widget w;
 
22
caddr_t shell;
 
23
caddr_t callData;
 
24
{
 
25
  XtPopdown((Widget)shell);
 
26
  XtDestroyWidget((Widget)shell);
 
27
}
 
28
 
 
29
void DisplayHelp(file)
 
30
char *file;
 
31
{
 
32
  Arg args[15];
 
33
  int iargs = 0;
 
34
  Widget shell, helpclose, help;
 
35
  XtCallbackRec callbacks[2];
 
36
  int helpwidth;
 
37
  int x,y,w,h;
 
38
  char str[80];
 
39
 
 
40
  callbacks[1].callback = NULL;
 
41
  callbacks[1].closure = NULL;
 
42
 
 
43
  GetMetanetGeometry(&x,&y,&w,&h);
 
44
  strcpy(str,"12345678901234567890123456789012345678901234567890123456789012345678901234567890"); /* 80 characters string */
 
45
  helpwidth = XTextWidth(theG.helpfont,str,strlen(str));
 
46
  if (helpwidth > metaWidth) helpwidth = metaWidth;
 
47
  
 
48
  XtSetArg(args[iargs], XtNx, x + incX); iargs++;
 
49
  XtSetArg(args[iargs], XtNy, y + incY); iargs++;
 
50
  XtSetArg(args[iargs], XtNfont, theG.helpfont); iargs++;
 
51
  shell = XtCreatePopupShell("Metanet Help",transientShellWidgetClass,toplevel,
 
52
                             args,iargs);
 
53
 
 
54
  iargs = 0;
 
55
  XtSetArg(args[iargs], XtNfont, theG.helpfont); iargs++;
 
56
  help =  XtCreateManagedWidget("helpform",formWidgetClass,shell,args,iargs);
 
57
 
 
58
  callbacks[0].callback = (XtCallbackProc)HelpClose;
 
59
  callbacks[0].closure = (caddr_t)shell;
 
60
  iargs = 0;
 
61
  XtSetArg(args[iargs], XtNlabel, "Close" ); iargs++;
 
62
  XtSetArg(args[iargs], XtNcallback, callbacks); iargs++;
 
63
  XtSetArg(args[iargs], XtNfont, theG.helpfont); iargs++;
 
64
  XtSetArg(args[iargs], XtNbottom, XawChainTop); iargs++;
 
65
  XtSetArg(args[iargs], XtNtop, XawChainTop); iargs++;
 
66
  XtSetArg(args[iargs], XtNleft, XawChainLeft); iargs++;
 
67
  XtSetArg(args[iargs], XtNright, XawChainLeft); iargs++;
 
68
  helpclose = XtCreateManagedWidget("helpcommand",commandWidgetClass,
 
69
                        help,args,iargs);
 
70
 
 
71
  iargs = 0;
 
72
  XtSetArg(args[iargs], XtNtype, XawAsciiFile); iargs++;
 
73
  XtSetArg(args[iargs], XtNstring, file); iargs++;
 
74
  XtSetArg(args[iargs], XtNborderWidth, 1); iargs++;
 
75
  XtSetArg(args[iargs], XtNeditType, XawtextRead); iargs++;
 
76
  XtSetArg(args[iargs], XtNscrollVertical, XawtextScrollWhenNeeded); iargs++;
 
77
  XtSetArg(args[iargs], XtNscrollHorizontal, XawtextScrollWhenNeeded); iargs++;
 
78
  XtSetArg(args[iargs], XtNwidth, helpwidth); iargs++;
 
79
  XtSetArg(args[iargs], XtNheight, metaHeight/2); iargs++;
 
80
  XtSetArg(args[iargs], XtNfont, theG.helpfont); iargs++;
 
81
  XtSetArg(args[iargs], XtNfromVert, helpclose); iargs++;
 
82
  XtCreateManagedWidget("asciitext",asciiTextWidgetClass,
 
83
                                help,args,iargs);
 
84
 
 
85
  XtPopup(shell,XtGrabNone);
 
86
}
 
87
 
 
88
void DisplayBeginHelp()
 
89
{
 
90
  DisplayHelp(beginHelp);
 
91
}
 
92
 
 
93
void DisplayStudyHelp()
 
94
{
 
95
  DisplayHelp(studyHelp);
 
96
}
 
97
 
 
98
void DisplayModifyHelp()
 
99
{
 
100
  DisplayHelp(modifyHelp);
 
101
}