File: help.c

package info (click to toggle)
xmakemol 5.14-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,568 kB
  • ctags: 1,299
  • sloc: ansic: 17,975; sh: 2,780; makefile: 114; perl: 98
file content (259 lines) | stat: -rw-r--r-- 6,743 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
/*
  
Copyright (C) 1997, 98, 99, 2000 Matthew P. Hodges
This file is part of XMakemol.

XMakemol is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

XMakemol is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with XMakemol; see the file COPYING.  If not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include <Xm/MessageB.h>

#include "globals.h"


void
help_cb(Widget widget, XtPointer client_data, XtPointer call_data)
{
  
  void make_about_dlg(Widget);
  void make_doc_dlg(Widget);
  void make_mouse_dlg(Widget);
  void make_bugs_dlg(Widget);
  
  int item_no=(int)client_data;
  
  switch(item_no){
  case 0:
    make_about_dlg(main_w);
    break;
  case 1:
    make_doc_dlg(main_w);
    break;
  case 2:
    make_mouse_dlg(main_w);
    break;
  case 3:
    make_bugs_dlg(main_w);
    break;
  }
  
}


#define ABOUT_MSG "XMakemol version %s\nCopyright (C) 2003 Matthew P. Hodges\n\nXMakemol is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2, or (at your option)\nany later version.\n\nXMakemol is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with XMakemol; see the file COPYING.  If not, write to the Free Software\nFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA"


void
make_about_dlg(Widget parent)
{

  int n;
 
  char *about_string = NULL;

  static Widget about_dialog = NULL;

  XmString msg,title;

  if(about_dialog == NULL)
    {
      title = XmStringCreateLocalized("About XMakemol");
      
      n=0;
      XtSetArg(args[n], XmNdialogTitle, title); n++;

      if(about_string == NULL)
        {
          about_string = malloc (sizeof (ABOUT_MSG) + sizeof (VERSION));
        }
      
      sprintf(about_string, ABOUT_MSG, VERSION);
      msg = XmStringCreateLtoR(about_string, XmFONTLIST_DEFAULT_TAG);
      XtSetArg(args[n], XmNmessageString, msg); n++;
  
      about_dialog =
        XmCreateInformationDialog(main_w, "about" ,args, n);
  
      XmStringFree(title);

      XtUnmanageChild
        (XmMessageBoxGetChild(about_dialog, XmDIALOG_OK_BUTTON));
  
      XtUnmanageChild
        (XmMessageBoxGetChild(about_dialog, XmDIALOG_HELP_BUTTON));
      
    }
  
  XtManageChild(about_dialog);
  
}


#define DOC_MSG "For documentation, see:-\nhttp://www.nongnu.org/xmakemol."


void
make_doc_dlg(Widget parent)
{
  
  int n;
 
  char *doc_string = NULL;

  static Widget doc_dialog = NULL;

  XmString msg,title;

  if(doc_dialog == NULL)
    {
      
      title = XmStringCreateLocalized("Documentation");

      n=0;
      XtSetArg(args[n], XmNdialogTitle, title); n++;

      if(doc_string == NULL)
        {
          doc_string = malloc(sizeof(DOC_MSG));
        }
      
      sprintf(doc_string, DOC_MSG);
      msg = XmStringCreateLtoR(doc_string, XmFONTLIST_DEFAULT_TAG);
      XtSetArg(args[n], XmNmessageString, msg); n++;
  
      doc_dialog =
        XmCreateInformationDialog(main_w, "doc", args, n);
  
      XmStringFree(title);

      XtUnmanageChild
        (XmMessageBoxGetChild(doc_dialog, XmDIALOG_OK_BUTTON));
      
      XtUnmanageChild
        (XmMessageBoxGetChild(doc_dialog, XmDIALOG_HELP_BUTTON));
      
    }
  
  XtManageChild(doc_dialog);
  
}


#define MOUSE_MSG "These are the mouse translations:\n\nNo modifier:\n\nMouse-1         Rotate atoms about an axis in the XY plane\nMouse-2         Rotate atoms about the Z axis\nMouse-3         Select atom for the Measure dialog\n\nControl modifier:\n\nMouse-1         Translate atoms in the XY plane\nMouse-2         Translate atoms along the Z axis\nMouse-3         Select closest atom for the Edit->Positions dialog\n\nShift modifier:\n\nMouse-1         Create a rectangular region on the canvas\nMouse-2         Show invisible atoms\nMouse-3         Toggle closest atom's visibility"


void
make_mouse_dlg(Widget parent)
{
  
  int n;
 
  char *doc_string = NULL;

  static Widget doc_dialog = NULL;

  XmString msg,title;

  if(doc_dialog == NULL)
    {
      
      title = XmStringCreateLocalized("Mouse actions");

      n=0;
      XtSetArg(args[n], XmNdialogTitle, title); n++;

      if(doc_string == NULL)
        {
          doc_string = malloc(sizeof(MOUSE_MSG));
        }
      
      sprintf(doc_string, MOUSE_MSG);
      msg = XmStringCreateLtoR(doc_string, XmFONTLIST_DEFAULT_TAG);
      XtSetArg(args[n], XmNmessageString, msg); n++;
  
      doc_dialog =
        XmCreateInformationDialog(main_w, "mouse", args, n);
  
      XmStringFree(title);

      XtUnmanageChild
        (XmMessageBoxGetChild(doc_dialog, XmDIALOG_OK_BUTTON));
      
      XtUnmanageChild
        (XmMessageBoxGetChild(doc_dialog, XmDIALOG_HELP_BUTTON));
      
    }
  
  XtManageChild(doc_dialog);
  
}


#define BUGS_MSG "Send bug reports to:-\nxmakemol-bugs@nongnu.org\n\nAll bug reports should state which version of XMakemol is being used\nand the platform on which it is being run.\n\nYou should detail what you expected to happen and what actually did\nhappen."


void
make_bugs_dlg(Widget parent)
{
  
  
  int n;
 
  char *bugs_string = NULL;

  static Widget bugs_dialog = NULL;

  XmString msg,title;

  if(bugs_dialog == NULL)
    {
      
      title = XmStringCreateLocalized("Reporting bugs");

      n=0;
      XtSetArg(args[n], XmNdialogTitle, title); n++;
      
      if(bugs_string == NULL)
        {
          bugs_string = malloc(sizeof(BUGS_MSG));
        }
      
      sprintf(bugs_string, BUGS_MSG);
      msg = XmStringCreateLtoR(bugs_string, XmFONTLIST_DEFAULT_TAG);
      XtSetArg(args[n], XmNmessageString, msg); n++;
  
      bugs_dialog =
        XmCreateInformationDialog(main_w, "bugs", args, n);
  
      XtUnmanageChild
        (XmMessageBoxGetChild(bugs_dialog, XmDIALOG_OK_BUTTON));
  
      XtUnmanageChild
        (XmMessageBoxGetChild(bugs_dialog, XmDIALOG_HELP_BUTTON));
      
    }
  
  XtManageChild(bugs_dialog);

}