File: fd_help.c

package info (click to toggle)
libforms 1.0.93sp1-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 11,548 kB
  • ctags: 9,107
  • sloc: ansic: 97,227; sh: 9,236; makefile: 858
file content (426 lines) | stat: -rw-r--r-- 14,670 bytes parent folder | download | duplicates (2)
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
/*
 * 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 "include/forms.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 )
{
    fl_show_form( fd_help->helpform,
                  FL_PLACE_GEOMETRY, FL_FULLBORDER, "fdesign help" );
}


/***************************************
 * 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 ) " (LibraryVersion " S( a ) "." S( b ) ")"

char mainhelp[ ][ 80 ] =
{
    "  ",
    "@C4@M@b@cForm Designer",
    "  ",
    "@C4@b@c$Revision: 1.14 $" LIBVERSION(FL_VERSION, FL_REVISION),
    "@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, press the button labeled 'New Form'. You will be prompted",
    "for a name.  After the form is created, you can start adding various objects",
    "such as buttons etc., to this form.",
    " ",
    "@bAdding Objects",
    "To add an object to the newly created form indicate what kind of object",
    "to add by clicking on that object under 'Objects' 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 is the size of the",
    "object you're creating.  Once a satifactory size is found, release the",
    "left mouse button. You can change the size and position afterwards.",
    "Multiple objects can be added in a similar way. After objects are added",
    "you can move, resize and clone them as needed. See Mouse section",
    " ",
    "@bDeleting a form",
    "Use the button labeled 'Delete Form' to delete the current form. You",
    "will have to acknowledge the deletion.",
    " ",

    "@bChanging the name of a form",
    "This can be achieved by pressing the button labeled 'Form Name' above",
    "the list of forms (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 click",
    "on the button labeled 'Resize Form' to get a popup-window which allows",
    "you to enter the precise width and height of the currently displayed 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 a 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 adding object is indicated in the Object Browser, dragging the",
    "left mouse button is used to add an object to a form. In normal operation",
    "i.e., not adding objects, 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. To move objects, select them first then drag the",
    "selected object. To scale an object, drag the scale knobs on the red",
    "selection outline. To delete an object, double click on the object.",
    " ",
    "When the <shift> key is down, selecting an object adds the newly selected",
    "object to the existing selection, and moving an object causes a copy of",
    "the object 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",
    "The right mouse button works the same way as left mouse button, except",
    "for adding and deleting objects. Double click an object to change the",
    "attributes of the object.",
    ""
};

char keyhelp[ ][ 80 ] =
{
    " ",
    "@l@b@cCursor Keys",
    " ",
    "The arrow keys can be used to move the current selection. If <shift>",
    "is down, 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 label and name 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 the 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 will 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 can indicate the required position. The",
    "pasted objects will form the new selection.",
    " ",
    "@bF11",
    "Selects next object and wraps around if the current selection is the last",
    "object. <TAB> has the same functionality",
    " ",
    "@bF12 Cut selection into the buffer",
    "Deletes the current selection. The deleted objects will be placed in",
    "the 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 Test button",
    "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, press the button labeled 'Save Forms'.",
    "The file selector will appear in which you can indicate the name under",
    "which to save the form. This name should end with .fd. 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 button labeled 'Load Forms'.",
    "It is also possible to merge the new forms with the current set using",
    "the button labeled 'Merge Forms'.",
    "  ",
    ""
};

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:
 */