Skip to content

Commit e17d2b9

Browse files
committed
update manual
1 parent 460da9e commit e17d2b9

File tree

3 files changed

+333
-1
lines changed

3 files changed

+333
-1
lines changed

Rebuild.info

0 Bytes
Binary file not shown.

Rebuild_manual.txt

Lines changed: 333 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Just a few of the improvements are:
2828
4) Copy buffer making it easier to move or duplicate gadgets
2929
5) More flexible system of arranging gadgets and layouts
3030

31+
3132
2. License
3233

3334
The program is released into the public domain for anyone to use however
@@ -39,6 +40,7 @@ without restriction however use of this project is entirely at your own
3940
risk. I will not accept responsibilty for any issues arising from the
4041
use of Rebuild.
4142

43+
4244
3. Using Rebuild
4345

4446
Upon loading Rebuild you will be presented with the main working window of
@@ -93,12 +95,47 @@ You could create it using an arrangement like this:
9395

9496
There are some example files included in the examples folder.
9597

98+
In addition to the layout control there are two other gadget types that
99+
can have child controls added to them. The ClickTab gadget and the Virtual
100+
gadget.
101+
102+
The ClickTab gadget displays tabs according to its list (see list manager
103+
section below). In addition it can also support different pages of controls
104+
for each tab. Child gadgets are added to a ClickTab control in exactly the
105+
same way as they are added to a layout control. Each child control will
106+
be displayed in a different tab. Typically you would add a layout control
107+
to the ClickTab for each tab. Then you can build up a UI design for that tab
108+
by adding further child controls to each layout.
109+
110+
The Virtual gadget displays a group of gadgets within a scrollable area.
111+
You can display a larger number of gadgets than would normally be visible
112+
in the window by allowing the user to scroll around the virtual area. The
113+
virtual gadget allows only one child control to be added directly. That
114+
would typically be a layout control in order that further gadgets can
115+
be displayed within the virtual scroll area.
116+
96117
You can also control the screen settings that are using for your GUI design
97118
and add menu definitions for each window. You can also specify a set of
98119
Arexx commands. The screen settings and Arexx commands will not affect how
99120
the design works in Rebuild but they will be included in the source code
100121
that you generate.
101122

123+
Note:
124+
125+
The TextField gadget is not a Reaction gadget and is not included by defaullt
126+
in OS 3.2. You should avoid using this gadget. It was included in the
127+
original ClassAct library but was not carried forwards into the Reaction
128+
implementation. The stand alone textfield gadget can be downloaded from
129+
the Aminet here:
130+
131+
http://aminet.net/package/dev/gui/textfield
132+
133+
If you use this gadget in your GUI design and it is not installed on your
134+
system you will only see a placeholder graphic in the preview window.
135+
If you generate code and attempt to run that code on a system where the
136+
TextField gadget is not installed it will fail on startup.
137+
138+
102139
4. The list manager
103140

104141
Some of the gadget types (List Browser, Chooser, RadioButton and ClickTab)
@@ -109,6 +146,7 @@ add them to a gadget. You can add the same list to more than one gadget.
109146
If you need to go back later and modify the list, it can easily be edited
110147
in the list manager even after it has been added to a gadget.
111148

149+
112150
5. The copy buffer
113151

114152
On the right side of the main window you will see the copy buffer.
@@ -117,6 +155,7 @@ window into the copy buffer. This is highly useful if you want to
117155
duplicate a gadget several times with the same settings or move a gadget
118156
from one window to another in your design.
119157

158+
120159
6. Source code generation
121160

122161
Rebuild is able to generate fully working SAS C and Amiga E code for the
@@ -179,9 +218,290 @@ values into your custom code then it will need to be re-coded.
179218

180219
There is more information regarding this in the next section.
181220

221+
182222
7. Tips on working with the rebuild generated source code.
183223

184-
to be completed.
224+
Here is an example of some C code generated by rebuild. I have annotated it
225+
with some comments to explain the intended use of some of the parts of the
226+
code. The generated code is only intended as a possible starting point for
227+
the application. In order to make the application functional there will be
228+
a lot of additional coded needed to drive the GUI.
229+
230+
Rebuild is not designed to be a fully functional development environment,
231+
it is purely a GUI design tool. If you use this code structure as a basis
232+
for your application, it would be recommended that you try to separate
233+
your custom code from the auto-generated code as much as possible in
234+
order to reduce the amount of rework needed if you change the GUI design
235+
and have to regenerate the code.
236+
237+
#include <clib/macros.h>
238+
#include <clib/alib_protos.h>
239+
#include <clib/compiler-specific.h>
240+
241+
#include <proto/exec.h>
242+
#include <proto/dos.h>
243+
#include <proto/utility.h>
244+
#include <proto/graphics.h>
245+
#include <proto/intuition.h>
246+
#include <proto/gadtools.h>
247+
#include <proto/icon.h>
248+
249+
#include <stdio.h>
250+
#include <stdlib.h>
251+
#include <string.h>
252+
253+
#include <proto/window.h>
254+
#include <proto/layout.h>
255+
#include <proto/button.h>
256+
#include <proto/string.h>
257+
#include <proto/label.h>
258+
259+
#include <libraries/gadtools.h>
260+
#include <reaction/reaction.h>
261+
#include <intuition/gadgetclass.h>
262+
#include <reaction/reaction_macros.h>
263+
#include <classes/window.h>
264+
#include <exec/memory.h>
265+
266+
void window_3( void );
267+
268+
struct Screen *gScreen = NULL;
269+
struct DrawInfo *gDrawInfo = NULL;
270+
APTR gVisinfo = NULL;
271+
struct MsgPort *gAppPort = NULL;
272+
273+
struct Library *WindowBase = NULL,
274+
*ButtonBase = NULL,
275+
*StringBase = NULL,
276+
*LabelBase = NULL,
277+
*GadToolsBase = NULL,
278+
*LayoutBase = NULL,
279+
*IconBase = NULL;
280+
struct IntuitionBase *IntuitionBase = NULL;
281+
282+
//Window_3
283+
//this enumeration should be used to access the main_gadgets array. the names
284+
//of the enumerations have the reaction gadget id's on the end so these names
285+
//will never change even if the design is update (eg another gadget added).
286+
//If the code is regenerated then the positions will change but the names
287+
//will not. This means its safe to use these enumeration names in any custom
288+
//code you may write.
289+
enum window_3_idx { layout_5, string_6, string_7, layout_8, button_9, button_10 };
290+
291+
//this enumeration should be used when you need to check the GA_ID values
292+
//against a particular gadget (eg when writing your message handling code
293+
//the enumeration names will be in the same order as those in the enum
294+
//above and the names will be the same as those above with _id appended.
295+
enum window_3_id { layout_5_id = 5, string_6_id = 6, string_7_id = 7, layout_8_id = 8,
296+
button_9_id = 9, button_10_id = 10 };
297+
298+
int setup( void )
299+
{
300+
if( !(IntuitionBase = (struct IntuitionBase*) OpenLibrary("intuition.library",0L)) ) return 0;
301+
if( !(GadToolsBase = (struct Library*) OpenLibrary("gadtools.library",0L) ) ) return 0;
302+
if( !(WindowBase = (struct Library*) OpenLibrary("window.class",0L) ) ) return 0;
303+
if( !(IconBase = (struct Library*) OpenLibrary("icon.library",0L) ) ) return 0;
304+
if( !(LayoutBase = (struct Library*) OpenLibrary("gadgets/layout.gadget",0L) ) ) return 0;
305+
if( !(ButtonBase = (struct Library*) OpenLibrary("gadgets/button.gadget",0L) ) ) return 0;
306+
if( !(StringBase = (struct Library*) OpenLibrary("gadgets/string.gadget",0L) ) ) return 0;
307+
if( !(LabelBase = (struct Library*) OpenLibrary("images/label.image",0L) ) ) return 0;
308+
if( !(gScreen = LockPubScreen( 0 ) ) ) return 0;
309+
if( !(gVisinfo = GetVisualInfo( gScreen, TAG_DONE ) ) ) return 0;
310+
if( !(gDrawInfo = GetScreenDrawInfo ( gScreen ) ) ) return 0;
311+
if( !(gAppPort = CreateMsgPort() ) ) return 0;
312+
313+
return -1;
314+
}
315+
316+
void cleanup( void )
317+
{
318+
if ( gDrawInfo ) FreeScreenDrawInfo( gScreen, gDrawInfo);
319+
if ( gVisinfo ) FreeVisualInfo( gVisinfo );
320+
if ( gAppPort ) DeleteMsgPort( gAppPort );
321+
if ( gScreen ) UnlockPubScreen( 0, gScreen );
322+
323+
if (GadToolsBase) CloseLibrary( (struct Library *)GadToolsBase );
324+
if (IconBase) CloseLibrary( (struct Library *)IconBase );
325+
if (IntuitionBase) CloseLibrary( (struct Library *)IntuitionBase );
326+
if (ButtonBase) CloseLibrary( (struct Library *)ButtonBase );
327+
if (StringBase) CloseLibrary( (struct Library *)StringBase );
328+
if (LabelBase) CloseLibrary( (struct Library *)LabelBase );
329+
if (LayoutBase) CloseLibrary( (struct Library *)LayoutBase );
330+
if (WindowBase) CloseLibrary( (struct Library *)WindowBase );
331+
}
332+
333+
//this is a generic routine that will be used to run the message loop
334+
//for all windows in this project. You should use the window id to determine
335+
//which window is being displayed. In order to avoid a huge message
336+
//processing loop with many different windows and gadgets being handled
337+
//I would recommend creating a function for each window and calling that
338+
//according to the window id.
339+
//
340+
//Currently this code structure is designed for projects with modal windows.
341+
//If you wanted to display a settings page for example you would call the
342+
//window function in the gadget press handling code you have written.
343+
//This would create the window object and call runWindow. Once that
344+
//window is closed control would return to the calling window.
345+
//
346+
//If this structure does not suit your application then you can code the
347+
//message handling from scratch and just use the window definitions that
348+
//can be generated using Rebuild.
349+
//
350+
void runWindow( Object *window_object, int window_id, struct Menu *menu_strip, struct Gadget *win_gadgets[] )
351+
{
352+
struct Window *main_window = NULL;
353+
354+
if ( window_object )
355+
{
356+
if ( main_window = (struct Window *) RA_OpenWindow( window_object ))
357+
{
358+
WORD Code;
359+
ULONG wait = 0, signal = 0, result = 0, done = FALSE;
360+
GetAttr( WINDOW_SigMask, window_object, &signal );
361+
if ( menu_strip) SetMenuStrip( main_window, menu_strip );
362+
while ( !done)
363+
{
364+
wait = Wait( signal | SIGBREAKF_CTRL_C );
365+
366+
if ( wait & SIGBREAKF_CTRL_C )
367+
done = TRUE;
368+
else
369+
while (( result = RA_HandleInput( window_object, &Code )) != WMHI_LASTMSG)
370+
{
371+
switch ( result & WMHI_CLASSMASK )
372+
{
373+
case WMHI_CLOSEWINDOW:
374+
done = TRUE;
375+
break;
376+
377+
case WMHI_MENUPICK:
378+
//put your menu handling code here
379+
//it is advised that you call a separate function for this
380+
puts("menu pick");
381+
break;
382+
383+
case WMHI_GADGETUP:
384+
//put your gadget handling code here
385+
//it is advised that you call a separate function for this
386+
puts("gadget press");
387+
break;
388+
389+
case WMHI_ICONIFY:
390+
if ( RA_Iconify( window_object ) )
391+
main_window = NULL;
392+
break;
393+
394+
case WMHI_UNICONIFY:
395+
main_window = RA_OpenWindow( window_object );
396+
if ( menu_strip) SetMenuStrip( main_window, menu_strip );
397+
break;
398+
399+
}
400+
}
401+
}
402+
}
403+
}
404+
}
405+
406+
407+
//this is the window function, it creates the window and displays it
408+
//it will return once the window is closed
409+
//
410+
void window_3( void )
411+
{
412+
struct Gadget *main_gadgets[ 7 ];
413+
Object *window_object = NULL;
414+
415+
window_object = WindowObject,
416+
WA_Title, "Please log in...",
417+
WA_Left, 5,
418+
WA_Top, 20,
419+
WA_Width, 250,
420+
WA_Height, 80,
421+
WA_MinWidth, 150,
422+
WA_MinHeight, 80,
423+
WA_MaxWidth, 8192,
424+
WA_MaxHeight, 8192,
425+
WINDOW_AppPort, gAppPort,
426+
WA_CloseGadget, TRUE,
427+
WA_DepthGadget, TRUE,
428+
WA_SizeGadget, TRUE,
429+
WA_DragBar, TRUE,
430+
WINDOW_Position, WPOS_CENTERSCREEN,
431+
WINDOW_IconTitle, "MyApp",
432+
WA_NoCareRefresh, TRUE,
433+
WA_IDCMP, IDCMP_GADGETDOWN | IDCMP_GADGETUP | IDCMP_CLOSEWINDOW,
434+
WINDOW_ParentGroup, VLayoutObject,
435+
LAYOUT_SpaceOuter, TRUE,
436+
LAYOUT_DeferLayout, TRUE,
437+
LAYOUT_AddChild, main_gadgets[layout_5] = LayoutObject,
438+
GA_ID, layout_5_id,
439+
LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
440+
LAYOUT_AddChild, main_gadgets[string_6] = StringObject,
441+
GA_ID, string_6_id,
442+
GA_RelVerify, TRUE,
443+
GA_TabCycle, TRUE,
444+
STRINGA_MaxChars, 80,
445+
StringEnd,
446+
CHILD_Label, LabelObject,
447+
LABEL_Text, "User name",
448+
LabelEnd,
449+
LAYOUT_AddChild, main_gadgets[string_7] = StringObject,
450+
GA_ID, string_7_id,
451+
GA_RelVerify, TRUE,
452+
GA_TabCycle, TRUE,
453+
STRINGA_MaxChars, 80,
454+
StringEnd,
455+
CHILD_Label, LabelObject,
456+
LABEL_Text, "Password",
457+
LabelEnd,
458+
LAYOUT_AddChild, main_gadgets[layout_8] = LayoutObject,
459+
GA_ID, layout_8_id,
460+
LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
461+
LAYOUT_AddChild, main_gadgets[button_9] = ButtonObject,
462+
GA_ID, button_9_id,
463+
GA_Text, "OK",
464+
GA_RelVerify, TRUE,
465+
GA_TabCycle, TRUE,
466+
BUTTON_TextPen, 1,
467+
BUTTON_BackgroundPen, 0,
468+
BUTTON_FillTextPen, 1,
469+
BUTTON_FillPen, 3,
470+
ButtonEnd,
471+
LAYOUT_AddChild, main_gadgets[button_10] = ButtonObject,
472+
GA_ID, button_10_id,
473+
GA_Text, "Cancel",
474+
GA_RelVerify, TRUE,
475+
GA_TabCycle, TRUE,
476+
BUTTON_TextPen, 1,
477+
BUTTON_BackgroundPen, 0,
478+
BUTTON_FillTextPen, 1,
479+
BUTTON_FillPen, 3,
480+
ButtonEnd,
481+
LayoutEnd,
482+
LayoutEnd,
483+
LayoutEnd,
484+
WindowEnd;
485+
//a blank entry at the end in case you need to loop through the
486+
//array and know where the end of the data is
487+
main_gadgets[6] = 0;
488+
489+
//call the code to display the window
490+
//the window id is 3 and it has no menu structure.
491+
runWindow( window_object, 3, 0, main_gadgets );
492+
493+
if ( window_object ) DisposeObject( window_object );
494+
}
495+
496+
int main( int argc, char **argv )
497+
{
498+
if ( setup() )
499+
{
500+
window_3();
501+
}
502+
cleanup();
503+
}
504+
185505

186506
8. Tooltype settings
187507

@@ -207,6 +527,7 @@ Here is a list of the tooltypes that can be defined
207527
WINDOWWIDTH =
208528
WINDOWHEIGHT = (override the main window size and position)
209529

530+
210531
9. Futher inforation
211532

212533
ReBuild is written using my own E-VO compiler.
@@ -218,6 +539,17 @@ If you find any issues with this product please do feel free to raise an
218539
issue in the gitgub repo or if you wish to contact me for any reason
219540
regarding this project please do.
220541

542+
Michael Bergmann has put in a lot of time and effort in testing Rebuild and
543+
has also developed a tutorial for Rebuild. This tutorial goes into depth
544+
regarding the use of Rebuild and each of the gadget types.
545+
546+
The tutorial is available separately from gitub repository:
547+
548+
https://github.com/dmcoles/ReBuild/tree/main/tutorial
549+
550+
My thanks go to Michael for this great work.
551+
552+
221553
10. Future (possible) enhancements
222554

223555
I have many ideas for future enhancements to this project. My plan was to

Rebuild_manual.txt.info

1.28 KB
Binary file not shown.

0 commit comments

Comments
 (0)