File: fd_help.c

package info (click to toggle)
libforms 1.2.3-1.3
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 10,736 kB
  • ctags: 9,015
  • sloc: ansic: 97,669; sh: 11,156; makefile: 951
file content (438 lines) | stat: -rw-r--r-- 14,960 bytes parent folder | download | duplicates (5)
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
/*
 * This file is part of XForms.
 *
 *  XForms is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU Lesser General Public License as
 *  published by the Free Software Foundation; either version 2.1, or
 *  (at your option) any later version.
 *
 *  XForms 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
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with XForms.  If not, see <http://www.gnu.org/licenses/>.
 */


/**
 * \file fd_help.c
 *
 *  This file is part of XForms package
 *  Copyright (c) 1996-2002  T.C. Zhao and Mark Overmars
 *  All rights reserved.
 *
 * This file is part of the Form Designer.
 *
 * It contains the routines for the help feature of the designer.
 */

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

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

#include "fd_main.h"
#include "fd/ui_theforms.h"


/***************************************
 * Loads the help browser with specific information.
 ***************************************/

static void
load_it( char str[ ][ 80 ] )
{
    int i;

    fl_freeze_form( fd_help->helpform );
    fl_clear_browser( fd_help->browser );
    for ( i = 0; str[ i ][ 0 ]; i++ )
        fl_add_browser_line( fd_help->browser, str[ i ] );
    fl_unfreeze_form( fd_help->helpform );
}


/***************************************
 * Shows the help form.
 ***************************************/

void
help_cb( FL_OBJECT * obj  FL_UNUSED_ARG,
         long        arg  FL_UNUSED_ARG )
{
    static int has_pos = 0;

    fl_show_form( fd_help->helpform,
                  has_pos ? FL_PLACE_GEOMETRY : FL_PLACE_CENTER,
                  FL_FULLBORDER, "fdesign help" );

    if ( ! has_pos )
        has_pos = 1;
}


/***************************************
 * Stop showing the help window
 ***************************************/

void
exithelp_cb( FL_OBJECT * obj  FL_UNUSED_ARG,
             long        arg  FL_UNUSED_ARG )
{
    fl_hide_form( fd_help->helpform );
}


extern char testhelp[    ][ 80 ],
            mainhelp[    ][ 80 ],
            generalhelp[ ][ 80 ],
            keyhelp[     ][ 80 ],
            grouphelp[   ][ 80 ],
            savehelp[    ][ 80 ],
            mousehelp[   ][ 80 ];


/***************************************
 * Shows a particular help item.
 ***************************************/

void
showhelp_cb( FL_OBJECT * obj  FL_UNUSED_ARG,
             long        arg )
{
    switch ( arg )
    {
        case HELP_VERSION:
            load_it( mainhelp );
            break;

        case HELP_GENERAL:
            load_it( generalhelp );
            break;

        case HELP_MOUSE:
            load_it( mousehelp );
            break;

        case HELP_KEYBOARD:
            load_it( keyhelp );
            break;

        case HELP_GROUP:
            load_it( grouphelp );
            break;

        case HELP_TEST:
            load_it( testhelp );
            break;

        case HELP_SAVE:
            load_it( savehelp );
            break;
    }
}


#define S( a )  #a
#define LIBVERSION( a, b ) S( a ) "." S( b )
 

char mainhelp[ ][ 80 ] =
{
    "  ",
    "@C4@M@b@cForm Designer",
    "  ",
    "@C4@b@cVersion: " LIBVERSION( FL_VERSION, FL_REVISION ) "." FL_FIXLEVEL,
    "@C4@b@cWritten by T.C. Zhao & Mark Overmars",
    "@-",
    " ",
    "The Form Designer ('fdesign') is a program for interactively designing",
    "dialogue forms for use with the Forms Library. The prgram is very simple",
    "to use. Press the buttons below to get help on the different topics.",
    " ",
    "For more info on fdesign and xforms, see the complete documentation or",
    "visit the XForms home and project pages:",
    " ",
    "@f@b@chttp://xforms-toolkit.org/",
    "and",
    "@f@b@chttp://savannah.nongnu.org/projects/xforms/",
    ""
};

char generalhelp[ ][ 80 ] =
{
    "  ",
    "@l@b@cGeneral Information",
    "  ",
    "@bAdd a form",
    "To add a form use the 'New Form' entry in the 'Form' menu. You will",
    "be prompted for a name. After the form is created you can start ",
    "adding objects such as buttons etc., to this form.",
    " ",
    "@bAdding Objects",
    "To add an object to a form select what kind of object to add by clicking",
    "on that objects class in the 'Object classes' browser in the control",
    "panel. If you now click the left mouse button (keep it pressed) in the",
    "form, a rubber band will appear. The size of the rubber band determines",
    "the size of the object you're creating. Once a satifactory size is found,",
    "release the left mouse button. You can change its size, position and",
    "attributes a well as clone it afterwards as needed.",
    " ",
    "@bDeleting a form",
    "Use the 'Delete Form' entry in the 'Form' menu to delete the current",
    "form. You will have to acknowledge the deletion.",
    " ",

    "@bChanging the name of a form",
    "This can be achieved via the 'Form Name' entry in the 'Form' menu after",
    "selecting the form you want to change).",
    " ",

    "@bChanging the size of a form",
    "You either can simply resize the window showing the form or you can use",
    "the 'Resize Form' entry in the 'Form' menu to get a popup-window which",
    "allows you to enter the precise width and height of the current form.",
    " ",

    "@bAligning objects",
    "When you click on the 'Align' button a new popup window gets shown. Now",
    "select an object (or a group of objects) and press one of the buttons in",
    "the new window to align it/them left, horizontal centers, right, etc. It",
    "is also possible to put equal distances between objects. With this form",
    "you can also set the 'snap value' which tells fdesign about the number of",
    "pixels to which values are rounded when positioning or resizing objects",
    "in your forms.",
    " ",

    "@bConfiguration",
    "The following resources can be used to select where to place the various",
    "forms that control the operation of fdesign",
    " ",
    "@fformDesgin.geometry",
    "This resource controls the placement and size of the working area",
    " ",
    "@fcontrol.geometry",
    "This resource controls the placement of the control panel",
    " ",
    "@fattributes.geometry",
    "This resource controls the placement of Attributes panel, activated by",
    "double-clicking on the object or by pressing F1",
    " ",
    "@fattributes.background",
    "This resource controls the background color of the Attributes panel",
    " ",
    "@falign.geometry",
    "This resource controls the placement of the align dialog",
    " ",
    "@fxformsHeader",
    "This resource informs the fdesign to emit a header other than forms.h",
    " ",
    "@fcompensate",
    "This resource (bool) informs the fdesign to emit font size compensation",
    "code",
    " ",
    "The most useful xforms resource are",
    "@ffdesign.XForm*FontSize",
    "and",
    "@ffdesign.XForm*PupFontSize",
    " ",
    ""
};

char mousehelp[ ][80] =
{
    "  ",
    "@l@b@cUsing the Mouse",
    "  ",
    "The mouse is used to add objects, select objects and move them around",
    "or scale them. Sometimes, holding down the <Shift> key influences the",
    "action taken.",
    " ",
    "@bLeft Mouse Button",
    "When an object class is selected in the Object class browser, dragging",
    "with the left mouse button is used to add an object to a form. In normal",
    "operation, i.e., wjen not adding objects, the left mouse is used to",
    "select, move or scale objects. When you click on an object, the object",
    "is selected, indicated by a red outline with 4 small knobs on the",
    "corners. To select more than one object, draw a box by dragging the",
    "mouse. All objects that fall within the box are selected. Alternatively,",
    "clicking on an object with the <Shift> key pressed will add it to the",
    "selection. To move objects, select them first then drag them around.",
    "To scale an object, drag the scale knobs on the red selection outline.",
    " ",
    "Double clicking on an object will select it and, at the same time, bring",
    "up the form for changing its properties.",
    " "
    "Dragging a selected object with the <Shift> key pressed causes a copy of",
    "that object to be made (cloned) and moved. The cloned object will have",
    "exactly the same attributes as the original object except for object name",
    "and shortcut",
    " ",
    "@bRight Mouse Button",
    "Single clicks with the right mouse button also select an object. But",
    "a double click deletes it (a copy is still kept in the copy-and-paste",
    "buffer, so the last object deleted can be added again to the form by",
    "pasting it into the form).",
    ""
};

char keyhelp[ ][ 80 ] =
{
    " ",
    "@l@b@cCursor Keys",
    " ",
    "The arrow keys can be used to move the current selection. If <Shift>",
    "is pressed, the selection will be scaled instead. To adjust the number",
    "of pixels to move (or increment), 0-9 can be used with 0 meaning",
    "10 pixels.",

    "  ",
    "@l@b@cFunction Keys",
    "  ",
    "The function keys are used to perform certain actions on the current",
    "selection. You can either use the function keys on the keyboard or",
    "the corresponding buttons on the screen.",
    " ",
    "@bF1  Attributes",
    "Change the attributes of the current selection. This only works if the",
    "objects in the selection are all of the same class. When only one object",
    "is selected, also its label, name, callback etc. can be changed.",
    " ",
    "@bF2  Lower selection",
    "Lowers the objects in the current selection, i.e., places them below all",
    "other objects on the form.",
    " ",
    "@bF3  Raise selection",
    "Raises all objects in the selection, i.e., places them on top of all",
    "other objects in the form.",
    " ",
    "@bF4  Select all",
    "Puts all objects in a selection.",
    " ",
    "@bF5  Show selection",
    "Makes all objects in the current selection visible. You can first use",
    "F4 to select all objects.",
    " ",
    "@bF6  Hide selection",
    "Hides all objects in the current selection. Use F5 to make them",
    "visible again.",
    " ",
    "@bF7  Group selection",
    "Places all objects in the selection in a group. If the objects are",
    "already part of a group, they are removed from the old group. Groups",
    "that become empty this way are discarded. You will be asked to provide a",
    "name for the group. This must be the C-name under which the group is",
    "known to the application program.",
    " ",
    "@bF8  Ungroup selection",
    "Takes all objects in the current selection out of their groups. Empty",
    "groups will be discarded.",
    " ",
    "@bF9  Copy selection to buffer",
    "Copies the objects in the current selection to the buffer. They can",
    "later be added to the same or another form using the operation paste.",
    " ",
    "@bF10 Paste buffer into form",
    "Pastes the objects in the buffer (placed there by the last copy or cut",
    "operation) into the form. You have to indicate the position by clicking",
    "in the form window. The pasted objects will form the new selection.",
    " ",
    "@bF11",
    "Selects the next object and wraps around if the currently selected",
    "obbject is the last object in the form. <TAB> has the same functionality",
    " ",
    "@bF12 Cut selection into the buffer",
    "Deletes the current selection. The deleted objects will be placed in",
    "the copy-and-paste buffer and can be pasted back into the form (or",
    "another form) later.",
    " ",
    "@l@b@c Other Keys",
    " ",
    "@btstart/stop Testing",
    "Pressing 't' in the main window is the same as clicking on the button",
    "labeled 'Test'. If the form is already being tested, pressing 't' stops",
    "testing.",
    " ",
    "@bs Save the forms",
    "Depending on the options selected, pressing 's' will save the current",
    "set of forms to disk.",
    " ",
    "@bEsc Exit",
    "Quit form designer",
    ""
};

char grouphelp[ ][ 80 ] =
{
    "  ",
    "@l@b@cGroups",
    "  ",
    "The Form Designer has a simple mechanism for dealing with groups inside",
    "forms. To create a group of objects, select all of them, using the right",
    "mouse button, and press key <F7>. The group name you indicate is added",
    "to the list of groups. Whenever you select all elements in a group the",
    "group name is shown in red. You can also select or deselect all elements",
    "in a group by pressing the mouse on the group name. Groups whose",
    "elements get deleted automatically disappear.",
    " ",
    "@bAdding an object to a group",
    "It is not possible to directly add an object to an existing group. You",
    "should first select the group and the new object and next press <F7> to",
    "create a new group. The old group will be removed and a new group,",
    "including the new object, will be created. You will have to type in the",
    "group name again.",
    " ",
    "@bChanging the name of a group",
    "To change the name of a group, select it (and deselect the others) and",
    "press the button labeled 'Group Name' below the list of groups.",
    ""
};

char savehelp[ ][ 80 ] =
{
    "  ",
    "@l@b@cSaving and Loading",
    "  ",
    "To save the current set of forms, use the 'Save As' entry in the 'File'",
    "menu. A file selector will appear in which you can enter the name under",
    "which to save the form. This name should end with '.fd'. At least three",
    "files will be generated: <name>.c, <name>.h and <name>.fd. See the",
    "documentation for their purpose.",
    " ",
    "A new set of forms can be loaded using the 'Open' entry in the 'File'",
    "menu. It is also possible to merge the new forms with the current set",
    "using the 'Merge' entry.",
    "  ",
    ""
};

char testhelp[ ][ 80 ] =
{
    "  ",
    "@l@b@cTesting Forms",
    "  ",
    "To test the current form press the button labeled 'Test Form'. The form",
    "will be centered on the screen and in the top right corner a new form",
    "will appear. Now you can play with the form. In the browser the objects",
    "are shown that will be returned to the application program or the callback",
    "routines that will be called. In this way you can verify whether each",
    "object has got a name or callback routine associated with it. To stop",
    "testing press the button labeled 'Stop Testing'.",
    " ",
    "Note that changes you make to the objects, e.g. filling in an input field,",
    "will not be saved when saving the forms.",
    ""
};


/*
 * Local variables:
 * tab-width: 4
 * indent-tabs-mode: nil
 * End:
 */