forked from DrCoolzic/BIG2
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBIG2.H
More file actions
1837 lines (1568 loc) · 84.3 KB
/
Copy pathBIG2.H
File metadata and controls
1837 lines (1568 loc) · 84.3 KB
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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*! @file big2.h
@brief This is the main include file for the BIG library
@verbatim
BIG = "BIG Is GEM" - A high level GEM library.
Initial Development by Claude ATTARD, Maintenance by Jean LOUIS-GUERIN
Copyright (c) 1993-2014 Claude ATTARD
Copyright (c) 2010-2014 Jean LOUIS-GUERIN
website: http://info-coach.fr/atari/software/projects/big.php
forum: http://www.atari-forum.com/viewtopic.php?f=16&t=27060
The BIG library may be used and distributed without restriction provided that
this copyright statement is not removed from the file and that any derivative
work contains the original copyright notice and the associated disclaimer.
The BIG library 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 3 of the License, or (at your option) any
later version.
The BIG library 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
HxCFloppyEmulator; if not, write to the Free Software Foundation, Inc., 51
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@endverbatim
@todo Description for BIG2.H file
*/
#ifndef _BIG_H_
#define _BIG_H_
#ifdef WIN32 /* allow to compile in Windows environment */
#define cdecl /* used in AES.H */
#pragma warning(disable : 4996) /* disable deprecated function */
#pragma warning(disable : 4018) /* disable signed/unsigned mismatch */
#pragma warning(disable : 4129) /* disable unrecognized character escape sequence */
#endif
#include <STRING.H>
#include <AES.H>
#include <VDI.H>
#include <TOS.H>
#include <STDIO.H>
#include <STDLIB.H>
#include <CTYPE.H>
/*! @addtogroup const_group
@{ */
#if defined(LIGHT)
#define dialog dialog_light /*!< Dialog light processing without timer */
#endif
#define FALSE 0 /*!< FALSE = 0 */
#define TRUE 1 /*!< TRUE = 1 */
#define NOT ! /*!< NOT='!' */
#define BLANK -1 /*!< Defined to -1. Used a lot in BIG! */
#define ZERO 0 /*!< instead of 0 */
#define MAX_ALRT 250 /*!< Maximum size for an alert string */
#ifndef max /* not present in stdlib for Pure C */
#define max(a, b)((a)>(b)?(a):(b)) /*!< compute max value of two numbers */
#define min(a, b)((a)<(b)?(a):(b)) /*!< compute min value of two numbers */
#endif
/* Some compilers do not define color icons */
#if !defined( G_CICON )
#define G_CICON 33
typedef struct cicon_data {
int num_planes;
int* col_data;
int* col_mask;
int* sel_data;
int* sel_mask;
struct cicon_data* next_res;
} CICON;
typedef struct cicon_blk {
ICONBLK monoblk;
CICON* mainlist;
} CICONBLK;
#endif
/* in case iconify messages not defined */
#if !defined( WM_ICONIFY )
#define WM_ICONIFY 34
#define WM_UNICONIFY 35
#define WM_ALLICONIFY 36
#endif
/* in case send window to bottom not defined */
#define WM_CYCLED 38
#if !defined( WM_BOTTOM )
#define WM_BOTTOM 33
#endif
#define NGAD 23 /*!< Number of BIG object windows */
#define BIT15 0x8000 /*!< Test bit 15 set */
/* BIG new extended types */
#define B_MOVE 17 /*!< Button used to move a form on the screen */
#define B_SELEC 18 /*!< Used to define B_CHECKB and B_ROUNDB buttons */
#define B_GRASTR 19 /*!< Character String with Graphical Attribute */
#define B_FRAME 20 /*!< Frame with text used to group objects like radio button */
#define B_HELP 21 /*!< Help button called without quiting current form */
#define B_POPUP 22 /*!< Button to access associated popup */
#define B_LIST 23 /*!< Button to access popup list with slider */
#define B_PICT 24 /*!< To place an MFDB picture in a form */
#define B_EDIT 25 /*!< extended editable Text field */
#define B_SMSTR 26 /*!< Small Character String with Graphical Attribute */
#define B_UNDER 30 /*!< Button that can have an underlined character */
#define B_UNDO 31 /*!< Normal button also activated by pressing the Undo key */
#define B_HIERM 41 /*!< Menu option that calls a hierarchical menu */
#define B_FNCP 51 /*!< Callback function associated to button or menu option */
/* Usual event bit mask */
#define DLG_DESK (MU_KEYBD | MU_BUTTON | MU_M1 | MU_MESAG | MU_TIMER)
#define DLG_FORM (MU_KEYBD | MU_BUTTON | MU_TIMER)
/* BIG new events */
#define BEV_HIERM 150 /*!< MU_MESAG Event option of a hier. menu selected */
#define BEV_FREEPU 151 /*!< MU_BUTTON Event option of a "free" popup selected */
#define BEV_WFORM 152 /*!< MU_BUTTON Event exit object of a form selected */
#define BEV_WMENU 153 /*!< MU_BUTTON Event menu option in a window selected */
#define BEV_WHIER 154 /*!< MU_BUTTON Event option hier. menu in a window selected */
#define BEV_TOOL 155 /*!< MU_BUTTON Event toolbar object in a window selected */
/* definitions of a set of shortcuts for windows attributes */
#define WATR_ALLG (NAME|CLOSER|FULLER|MOVER|INFO|SIZER|UPARROW|DNARROW|VSLIDE|LFARROW|RTARROW|HSLIDE)
#define WATR_ALLB (CLOSER|FULLER|MOVER|INFO|SIZER|UPARROW|DNARROW|VSLIDE|LFARROW|RTARROW|HSLIDE|CYCLER|SMALLER|ALLSIZER)
#define WATR_CURRG (NAME|CLOSER|FULLER|MOVER|SIZER|UPARROW|DNARROW|VSLIDE|LFARROW|RTARROW|HSLIDE)
#define WATR_CURRB (CLOSER|FULLER|MOVER|SIZER|UPARROW|DNARROW|VSLIDE|LFARROW|RTARROW|HSLIDE|CYCLER|SMALLER|ALLSIZER)
#define WATR_FORMG (NAME|CLOSER|MOVER)
#define WATR_FORMB (CLOSER|MOVER|CYCLER|SMALLER)
/* define the BIG windows types*/
#define WTYP_NORM 1 /*!< "normal" window contain probably text. */
#define WTYP_FORM 2 /*!< form window. BIG takes care of all. */
#define WTYP_PICT 3 /*!< Picture window. BIG takes care of all. */
#define WTYP_TOOL 0x4000 /*!< Window with Toolbar */
#define WTYP_MENU 0x8000 /*!< Window with Menu */
/* Flags used for BIG windows */
#define WFFULL 0x0001 /*!< set when window is "fulled" */
#define WFARROW 0x0002 /*!< when set allow window operation from keyboard */
#define WFCALAG 0x0004 /*!< slider & win size multiple of shift unit */
#define WFDECAL 0x0008 /*!< if set w_lin & w_col are updated on win resize */
#define WFGROUP 0x0010 /*!< if set all slider arrows in bottom right corner */
#define WFLAST 0x0080 /*!< Last window indicator (like LASTOBJ) */
#if !defined( SMALLER )
#define SMALLER 0x4000 /*!< Smaller attribute in BIG window */
#endif
#define CYCLER 0x2000 /*!< Cycler attribute in BIG window */
#define ALLSIZER 0x8000 /*!< Allsizer attribute in BIG window */
#define BKGR 0x0400 /*!< used for 3D (bit 10 of ob_flags) */
#define DCDEFAULT 0x0800 /*!< activate def button on dbl click (bit 11 ob_flags) */
#define WFCLOSE 0x1000 /*!< button close form in window (bit 12 ob_flags) */
#define BS_RIGHT 0x2000 /*!< right justification in B_SELEC (bit 13 ob_flags) */
#define AIDE_OBJET 0x4000 /*!< bubble-help on object Bit (14 ob_flags) */
#define NOTOP 0x8000 /*!< ops to window-form not in front (bit 15 ob_flags) */
/* For menus in windows */
#define WM_BKGR 0 /*!< ??? @todo */
#define WM_BOXMENU 1 /*!< ??? @todo */
#define WM_BOXARROWS 2 /*!< ??? @todo */
#define WM_LFARROW 3 /*!< ??? @todo */
#define WM_RTARROW 4 /*!< ??? @todo */
#define WM_BOXTITLES 5 /*!< ??? @todo */
/* keyboard define */
#define HELP 0x6200 /*!< HELP key */
#define UNDO 0x6100 /*!< UNDO key */
#define ENTER 0x1C0D /*!< ENTER key */
#define RETURN 0x720D /*!< RETURN key */
#define BACKSPC 0x0E08 /*!< BACKSPACE key */
#define DELETE 0x537F /*!< DELETE key */
#define SH_DELETE 0x537F /*!< SHIFT + DELETE key */
#define INSERT 0x5200 /*!< INSERT key */
#define SH_INSERT 0x5230 /*!< SHIFT + INSERT key */
#define TAB 0x0F09 /*!< TAB key */
#define ARDN 0x5000 /*!< ARROW_DOWN key */
#define ARUP 0x4800 /*!< ARROW_UP key */
#define ARLF 0x4B00 /*!< ARROW_LEFT key */
#define ARRT 0x4D00 /*!< ARROW_RIGHT key */
#define CT_ARDN 0x5000 /*!< CTRL + ARROW_DOWN key */
#define CT_ARUP 0x4800 /*!< CTRL + ARROW_UP key */
#define CT_ARLF 0x7300 /*!< CTRL + ARROW_LEFT key */
#define CT_ARRT 0x7400 /*!< CTRL + ARROW_RIGHT key */
#define SH_ARDN 0x5032 /*!< SHIFT + ARROW_DOWN key */
#define SH_ARUP 0x4838 /*!< SHIFT + ARROW_UP key */
#define SH_ARLF 0x4B34 /*!< SHIFT + ARROW_LEFT key */
#define SH_ARRT 0x4D36 /*!< SHIFT + ARROW_RIGHT key */
#define ESC 0x011B /*!< ESC key */
#define CLR 0x4700 /*!< CLR key */
#define CT_CLR 0x7700 /*!< CTRL + CLR key */
#define SH_CLR 0x4737 /*!< SHIFT + CLR key */
#define ESPACE 0x3920 /*!< SPACE key */
#define F1 0x3B00 /*!< F1 key */
#define SH_F1 0x5400 /*!< SHIFT + F1 key */
#define F2 0x3C00 /*!< F2 key */
#define SH_F2 0x5500 /*!< SHIFT + F2 key */
#define F3 0x3D00 /*!< F3 key */
#define SH_F3 0x5600 /*!< SHIFT + F3 key */
#define F4 0x3E00 /*!< F4 key */
#define SH_F4 0x5700 /*!< SHIFT + F4 key */
#define F5 0x3F00 /*!< F5 key */
#define SH_F5 0x5800 /*!< SHIFT + F5 key */
#define F6 0x4000 /*!< F6 key */
#define SH_F6 0x5900 /*!< SHIFT + F6 key */
#define F7 0x4100 /*!< F7 key */
#define SH_F7 0x5A00 /*!< SHIFT + F7 key */
#define F8 0x4200 /*!< F8 key */
#define SH_F8 0x5B00 /*!< SHIFT + F8 key */
#define F9 0x4300 /*!< F9 key */
#define SH_F9 0x5C00 /*!< SHIFT + F9 key */
#define F10 0x4400 /*!< F10 key */
#define SH_F10 0x5D00 /*!< SHIFT + F10 key */
/* shortcuts */
#define ADR ir_trindex /*!< Shortcut see ir_trindex */
#define get_popup match /*!< Shortcut see get_popup() */
/* VDI.H complementary definitions */
#define POINTIL 0x8888 /*!< define dotted line for vsl_type() & vsl_udsty() */
/* pattern shape (vsm_type) */
#define MTPOINT 1 /*!< point */
#define MTPLUS 2 /*!< plus */
#define MTETOILE 3 /*!< star */
#define MTCARRE 4 /*!< square */
#define MTCROIX 5 /*!< cross */
#define MTLOSANGE 6 /*!< diamond */
/* effect attribute (vst_effects) */
#define EFNONE 0x00 /*!< None */
#define EFGRAS 0x01 /*!< bold */
#define EFGRIS 0x02 /*!< grayed */
#define EFITAL 0x04 /*!< italic */
#define EFSOULI 0x08 /*!< underline */
#define EFCONT 0x10 /*!< contour */
/* justification attribute (vst_alignment) */
#define HLEFT 0 /*!< left */
#define HCENT 1 /*!< center */
#define HRIGHT 2 /*!< right */
#define VDOWN 0 /*!< down */
#define VLINE 3 /*!< base */
#define VTOP 5 /*!< top */
/* size attribute (vst_height) */
#define HNORM 13 /*!< norm */
#define HPETIT 6 /*!< small */
#define HMINUS 4 /*!< tiny */
/* rotation attribute (vst_rotation) */
#define RONORM 0 /*!< 0 deg. */
#define RO90 900 /*!< 90 deg. */
#define RO180 1800 /*!< 180 deg. */
#define RO270 2700 /*!< 270 deg. */
/*! @} */
/*! @addtogroup typedef_group
@{ */
typedef int Palette[3]; /*!< used by ::bpal[16] */
typedef void (*FNCP)(void); /*!< function pointer type */
/*! structure used for forms in windows */
typedef struct form {
OBJECT *w_tree; /*!< Tree address */
int w_edit; /*!< current editable */
int w_pos; /*!< cursor position */
char *w_bak; /*!< for saving state of a form */
} Form;
/*! structure used to define the content of a window */
typedef union cont {
Form w_form; /*!< if form */
MFDB w_img; /*!< if image */
char* w_adr; /*!< if text or other data */
} Cont;
/*! define data before iconification */
typedef struct oldw {
GRECT w_coord; /*!< old coordinate */
int w_att; /*!< old attribute */
} Oldw;
/*! Definition of BIG Windows */
typedef struct bigwind {
int w_hg; /*!< GEM Handle: positive=GEM, -1=init, 0=closed */
int w_type; /*!< BIG type of windows */
int w_attr; /*!< GEM Window attribute */
GRECT w_curr; /*!< window current coordinates */
Oldw w_old; /*!< coordinate before iconification */
int w_wmini; /*!< minimum width */
int w_hmini; /*!< minimum Height */
int w_wmaxi; /*!< maximum width */
int w_hmaxi; /*!< maximum Height */
int w_wunit; /*!< horizontal shift unit */
int w_hunit; /*!< vertical shift unit */
int w_hprot; /*!< number of protected points on left */
int w_vprot; /*!< number of protected points on top */
Cont w_cont; /*!< vary according to window content */
Palette *w_pal; /*!< Pointer to the associated pallet */
OBJECT *w_bar; /*!< window with menu/toolbar => tree address */
OBJECT w_fen[NGAD]; /*!< windowed form */
int w_flags; /*!< BIG Windows Flags */
int w_mouse; /*!< mouse pointer shape in the window */
int w_icon; /*!< iconification : associated window index */
FNCP w_redicn; /*!< Function pointer redraw if win iconified */
FNCP w_cycle; /*!< Function pointer display next window */
FNCP w_redraw; /*!< Function pointer win redraw */
FNCP w_top; /*!< Function pointer bring win to top */
FNCP w_close; /*!< Function pointer close win */
FNCP w_move; /*!< Function pointer move win */
FNCP w_size; /*!< Function pointer resize win */
FNCP w_full; /*!< Function pointer full size win */
FNCP w_hslid; /*!< Function pointer slider horizontal */
FNCP w_vslid; /*!< Function pointer slider vertical */
FNCP w_uppage; /*!< Function pointer one page up */
FNCP w_dnpage; /*!< Function pointer one page down */
FNCP w_lfpage; /*!< Function pointer one page left */
FNCP w_rtpage; /*!< Function pointer one page right */
FNCP w_upline; /*!< Function pointer one line up */
FNCP w_dnline; /*!< Function pointer one line down */
FNCP w_lfline; /*!< Function pointer one line left */
FNCP w_rtline; /*!< Function pointer one line right */
char *w_title; /*!< window title pointer */
char *w_infos; /*!< window info pointer */
long w_wtot; /*!< max window content width (in pixels) */
long w_htot; /*!< max window content Height (in pixels) */
long w_lin; /*!< window first line */
long w_col; /*!< window first column */
} BigWind;
/*! used for images in form MA 26/06/1994 */
typedef struct t_image_dial {
MFDB mfdb_image; /*!< MFDB image to display */
GRECT cur_pos; /*!< position of the image */
} t_image_dial;
/*! structure for cookies */
typedef struct {
long ident; /*!< Cookie identifier */
union {
long l; /*!< if data is type long */
int i[2]; /*!< if data is type int */
char c[4]; /*!< if data is type char */
} datack; /*!< Cookie data */
} COOKIE;
/*! Atari model used */
typedef enum {
ST, /*!< Atari ST Model */
STE, /*!< Atari STE Model */
TT, /*!< Atari TT Model */
FALCON_030, /*!< Atari Falcon 30 Model */
AUTRE_MACHINE /*!< Unknown model */
} t_machine;
/*! Graphical processor used */
typedef enum {
PG_ST, /*!< ST graphical processor */
PG_STE, /*!< STE graphical processor */
PG_TT, /*!< TT graphical processor */
PG_FALCON_030, /*!< Falcon graphical processor */
AUTRE_PG /*!< Unknown graphical processor */
} t_proc_graphique;
/*! CPU used */
typedef enum {
PROC_68000, /*!< 68000 Processor */
PROC_68030, /*!< 68030 Processor */
AUTRE_PROCESSEUR /*!< Unknown Processor */
} t_cpu;
/*! Resolution used */
typedef enum {
ST_BASSE = 0, /*!< low resolution */
ST_MOYENNE = 1, /*!< medium resolution */
ST_HAUTE = 2, /*!< high resolution */
VGA_16COL = 4, /*!< TT VGA */
VGA_256COL = 5, /*!< FALCON VGA */
R_256C_320_480 = 7, /*!< TT 320*480 16 col */
TRUE_COLOR_320_480 = 8, /*!< Falcon 320*480 VGA */
INCONNU = -1 /*!< Unknown resolution */
} t_resolution;
/*! type of GDOS used */
typedef enum {
AUCUN_GDOS =0, /*!< No GDOS running */
GDOS_STANDARD =1, /*!< Standard GDOS running */
FONT_GDOS =2, /*!< Font GDOS running */
FSM_GDOS =3, /*!< FSM GDOS running */
SPEEDO_GDOS =4 /*!< Speedo GDOS running */
} type_gdos;
/*! Hardware / Software information */
typedef struct {
t_machine la_machine; /*!< Atari model */
t_proc_graphique proc_graphique; /*!< Graphical processor used */
t_cpu le_cpu; /*!< CPU used */
int v_aes; /*!< AES version in hex e.g. "0x410" is V4.10 */
int v_tos; /*!< TOS version in hex same as above */
char multitache; /*!< TRUE if multitasking */
type_gdos le_gdos; /*!< GDOS used */
} t_ident_hard_soft;
/*! Display Information */
typedef struct t_display {
size_t taille; /*!< Screen size in number of bytes */
size_t taille_ligne; /*!< line size in number of bytes */
int handle; /*!< VDI virtual workstation handle */
int w; /*!< Screen width in pixels */
int h; /*!< Screen Height in pixels */
int hc; /*!< "Normal" Character Height from baseline to top-line */
t_resolution res; /*!< resolution at application start */
int mode; /*!< Current mode if running on Falcon */
char une_palette; /*!< FALSE no pallet (NEAR_TRUE_COLOR or TRUE_COLOR) */
long n_color_pal; /*!< pallet or system number of color */
long n_color; /*!< number of pen available simultaneously */
int n_plane; /*!< screen depth in number of plans */
Palette* palette; /*!< Save pallet Pointer */
int nb_bit_coul[3]; /*!< number of bits per color */
int masque_coul[3]; /*!< Color mask */
void* phys; /*!< Physical address of screen at startup */
void* log; /*!< Logical address of screen at startup */
} t_display;
/*! desktop coordinate */
typedef struct t_desktop
{
int xd; /*!< X top corner of desktop */
int yd; /*!< Y top corner of desktop */
int wd; /*!< width of desktop */
int hd; /*!< height of desktop */
} t_desktop;
/*! @} */
/*! @addtogroup global_group
@{ */
/* Global Variables */
extern int ap_id; /*!< AES application identifier */
extern int buf[8]; /*!< Events buffer */
extern int mx; /*!< Mouse X Position */
extern int my; /*!< Mouse Y Position */
extern int mk; /*!< Mouse state */
extern int edit; /*!< Current Editable */
extern int pos; /*!< Position cursor in editable */
extern int object; /*!< Object clicked for MU_BUTTON */
extern int kbd; /*!< State control key */
extern int key; /*!< Current KB event */
extern int clik; /*!< number of mouse clicks */
extern int wind; /*!< GEM handle of clicked window in working area */
extern int intgr; /*!< True if resource is internal */
extern char pathapp[]; /*!< Application path at startup */
extern Palette bpal[16]; /*!< Internal 16 color palette */
extern OBJECT* adr_menu; /*!< Reserved address for menu form */
extern OBJECT* adr_desk; /*!< Reserved address for desktop */
extern OBJECT** ir_trindex; /*!< Address of all forms in program */
extern int cliq_in; /*!< Validate option selection */
extern GRECT zclip; /*!< clipping zone for redraw */
extern FNCP* fnc; /*!< Pointer to function pointer array */
extern BigWind* win; /*!< Pointer to the windows array */
extern t_ident_hard_soft desc_hard_soft; /*!< Hard/Soft information */
extern t_display work_display; /*!< Display information */
extern t_desktop bureau; /*!< Desktop information */
extern int aide_en_ligne; /*!< Bubble-help -1=active; 0=never; other=kbshift mask */
/*! @} */
/*! @addtogroup control_group
@{ */
/* Control Functions */
/*! @brief Initializes the BIG Library
@param rsc pointer to a string which contains the filename of the resource to
load, or an empty string for an integrated resource.
@param menu is the tree number (in the resource) which will be taken as
top menu of the application. In the case of a desktop accessory
this parameter is ignored. If one wishes to create a program
without menu, it is necessary to transmit "-1" in this parameter
@param desk is the tree number (in the resource) which will be taken as
desktop of the application. In the case of a desktop accessory
this parameter is ignored. If one wishes to create a program
without desktop, it is necessary to transmit "-1" in this parameter
@param nb_tree must be equal to 0 if the resource use an external file.
If the program works with an integrated resource, nb_tree indicates
the number of trees (menu and forms) of its resource.
@param rs_tree is a special pointer. In the case of an integrated resource,
it make it possible to indicate to BIG where in memory begin the
tables "rs_trindex[]" created by file RSH. If not, it point on ZERO.
See in the chapter "Working with an integrated resource the way of
using it.
@param rs_str is a special pointer. In the case of an integrated resource,
it make it possible to indicate to BIG where in memory begin the
tables "rs_frstr[]" created by file RSH. If not, it point on ZERO.
See in the chapter "Working with an integrated resource the way of
using it.
@param n_wind total number of BIG windows used by the program.
@param acc Number in the resource of the free string to use for the call of
the function menu_register() if the application is a desktop
(name of the accessory in the desktop menu). If it is a program,
this parameter is ignored, one can transmit "-1".
@return TRUE if everything went well, FALSE otherwise (for example, if the
resource file was not found).
This function declares the application, opens the workstation, initializes
the majority of the global variables, loads the resource (if it is external,
if not adapts the integrated resource to the current resolution), sets up the
resource included of BIG, sets up the storage areas for window management,
of the userdef objects, of extended editable, of the pointers on function,
of the pallet, reserves the memory for window management by BIG, initializes
certain elements of the BigWind structures, etc...
@note The variables "adr_menu" and "adr_desk" have fixed names to facilitate
their management. Indeed, there are many functions which make call to these
addresses, and to transmit them each time would be tiresome and not very
practical. If your program works with several menu bars (or even several
desktops - why not), the address of the current menu must be in adr_menu.
The function centers in advance all the forms and empty all the editable
fields. You can reach the windows structures (and their elements) as
elements of a table, by win[index].w_adr for example
(numbering starts obviously at zero).\n
It is strongly recommended not to save up with the quantity of windows
necessary, and to declare a window by data element to be treated.
For example, it is not advised to have only one window to display a text or an
image, with the excuse that both will never be displayed at the same time.
It is, in this case, better to have two distinct windows, the parameters contained
in their elements being different. In the same way, declare a window for each form
in window. The management of the program will be simplified by doing so, even if
it means to close a window before opening another one if both are not displayed at
the same time.\n
A BigWind structure represents only 158 bytes in memory, whereas a complicated
management of few windows sharing different contents is likely to take much
more, without speaking of processing time.\n
This function must IMPERATIVELY be called by the main() function of the program
at the beginning of the execution. */
int initial(char* rsc, int menu, int desk, int nb_tree,
OBJECT* rs_tree, char* rs_str, int n_wind, int acc);
/*! @brief Terminates and cleans BIG library
This function closes all the windows of the program, it releases the various
storage areas which were reserved by initialization with initial() and in the
course of program, it releases the resource, it closes the workstation, it
restores the palette and other parameters of display and it leaves the program.
@note This function is not called by BIG. It is your program which will have to
take care of this call when the user asks to leave the application.
If a storage area is assigned to the contents of a window, it must be released.
If the closing function assigned to the element win[index].w_close
of this window does not take care of it, you will have to do it \b BEFORE calling
end(). */
void end(void);
/*! @} */
/*! @addtogroup form_group
@{ */
/****** Forms Management Functions *******/
/*! @brief Display a movable form
@param adr Address of the form to be displayed.
@param ed Object Number of the editable field in which the cursor must be
placed at the beginning of the management of the form. The cursor
is placed at the end of the field. -1 if there is no editable.
@param flmove Move flag: If this flag is FALSE, the displacement of the form is
done as a "phantom box". If it is TRUE, the function reserve a
memory area and saves the screen there in order to carry out
displacement in real-time. If it is not possible to reserve this
memory, displacement is done with a phantom box.
@param img Pointer to a MFDB used to save the background under the form.
@return Nothing
This function displays a movable form
@note To remove the form from the screen at the end of management, it is
imperatively necessary to use the function formm_undraw(). */
void formm_draw(OBJECT* adr, int ed, int flmove, MFDB* img);
/*! @brief Erase a movable form
@param adr Address of the tree.
@param img Pointer to the MFDB in which the background of the form was saved.
@return Nothing
This function erases a movable form which was displayed by the function formm_draw()
form from the screen.
@note The movable form should have been displayed imperatively by the function
formm_draw(). */
void formm_undraw(OBJECT* adr, MFDB* img);
/*! @brief Display a traditional form
@param adr Address of the tree to be displayed.
@param ed Object Number of the editable field, if there is one, where to place
the cursor at the beginning of management or -1 if no editable. The
cursor is placed at the end of the field.
Display a traditional form
@note This function exists only for reasons of compatibility and to be complete,
but the function formm_draw() should preferably be used. The form displayed with
this function must be removed from the screen with formf_undraw() function. */
void formf_draw(OBJECT* adr, int ed);
/*! @brief Erase a traditional form
@param adr Address of the tree.
@return Nothing
This function erases the screen for a fixed form which was displayed by the
function formf_draw().
@note The function must be used in complement of formf_draw() function. */
void formf_undraw(OBJECT* adr);
/*! @brief Place an arrow in a menu
@param adr Address of the menu tree.
@return Nothing
This function seeks the B_HIERM objects of a menu and places in the last but
one character of the string an arrow towards the right or left according to
where the hierarchical menu will unroll
@note With regard to the top menu of an application, the function initial() is
given the responsibility to call this function. It is also called automatically
with each time a click takes place on a title of of menu in windows, because the
window could have been moved, and the sub-menus could then have to be unrolled
on the other side. But if you wish to change the menu bar (and if the new one
contains some B_HIERM), you must call this function during the first display
of this bar. At the time of the later redraw, or reactivation of the first bar,
it is not necessary. The menu options of the type B_HIERM must be filled with
spaces on all their width. The last but one character is replaced by an arrow
(ASCII 3 or 4) placed by this function. */
void create_hierm(OBJECT* adr);
/*! @brief Manage all the events in BIG
@param flags It is the bits mask, the same one as for the GEM function
evnt_multi(), who indicates which events must be supervised.
BIG proposes several defines for the usual situations:
::WATR_ALLG, ::WATR_ALLB, ::WATR_CURRG, ::WATR_CURRB, ::WATR_FORMG,
::WATR_FORMB
@param address Address of the form or the desktop to be work on.
@param f Flag. If this flag is TRUE, the function supervises the menu,
the desktop, the windows, etc If it is FALSE, it is limited to
the form indicated by address, considering that the other events
are blocked by wind_update().
@param fl_rb Flag Right button. If TRUE, a right click of a button of the mouse
calls a free pop-up menu (see following parameter).
@param form_pu Pop-Up Form. Tree number for the form used as a free pop-up in the
event of click on the right button. -1 if there is not. To reserve
for work on the desktop.
@param img In the case of a movable form, it is a pointer to the MFDB which
contains the background of this form. This parameter is not used
if one work on the desktop, but nevertheless a MFDB must be transmitted.
@param fl_move Indicates if the form is removable (TRUE) or not (FALSE).
Also FALSE if the function manages the desktop.
@return The function turns over a bit mask corresponding to the type of event
which occurred. This mask is the same one as for the GEM function
evnt_multi(). Here is a reminder the bit mask of bits used by
evnt_multi() and dialog():
- Bit 0: MU_KEYBD (keyboard event)
- Bit 1: MU_BUTTON (mouse click event)
- Bit 2: MU_M1 (mouse area 1 event)
- Bit 3: MU_M2 (mouse area 2 event)
- Bit 4: MU_MESAG (menu or window message event)
- Bit 5: MU_TIMER (timer event)
This function is the heart of BIG. It is the main loop which scans the events and
manages them mainly. It will be always called at least once in a program under BIG.
@note The function dialog() also performs, thanks to the timer, the monitoring of
several things: windows in foreground to activate the corresponding palette even on
intervention of another application, bubble-help, hierarchical menu and right-click
of the mouse. This permanent monitoring involves a certain slow down, particularly
obvious on the old 8 MHz machines. It is possible to "shutdown" these functions by
typing in the source of your program the line:
@code
#define LIGHT
#include "big2.h"
@endcode
The definition must be placed \b BEFORE the include. Obviously, the
mentioned effects also disappear. No more bubbles-help, no more menus hierarchical,
etc. (but the hierarchical menus for menus in window are always active). But in a
program which does not use them, it is to better shut them down (it is for example
the case of the program BIG_DOC). However, the processing of the color palette
continue to be active since it is at the time when a window is brought to the
foreground that BIG activates the pallet which corresponds to this window. Simply,
this management will no more take into account the windows belonging to other
applications. */
int dialog(int flags, OBJECT* address, int f,
int fl_rb, int form_pu, MFDB* img, int fl_move);
/*! @brief Search for a text match in pop-up pop-list
@param adr Address of the form in which the button is.
@param button Button Number in this form.
@return Object Number in the pop-up form if an occurrence is found, 0 if not.
`
This function seeks if there is a correspondence between the text (or the pattern
of image or box) for a pop-up button or pop-list and one of the objects of its
associated pop-up form.
@note The root-object of the pop-up form having the number 0, it is not possible
to have an occurrence with this object number. The function thus return 0 if no
correspondence is found. */
int match(OBJECT* adr, int button);
/*! @brief Link Text to pop-up
@param adr Address of the form that contain the button
@param button Button Number in this form.
@param option Object Number of the option in the pop-up menu.
@return Nothing
This function connects the text (or the pattern of image or box) for a pop-up
menu option to the pop-up or pop-list button associated. */
void set_popup(OBJECT* adr, int button, int option);
/*! @brief Create text pop-up menu
@param nbre It is the number of character strings intended to become
the options of the pop-up.
@param list Pointer to the beginning of the string table. They must imperatively
be consecutive in memory while being separated by a null byte.
@return The address of the reserved area which is from now on the pop-up
menu or zero in the event of problem.
This function makes it possible to create a text pop-up menu in memory
from a list of character string.
@note This function is extremely practical to create a pop-up menu when you do not
know in advance (at the creation of the resource) the number of options or the text.
For example, pop-up allowing for choice of a SpeedoGDOS font. The pop-up created can
be used only as a free pop-up free, with the function free_popup(). Indeed,
"ordinary" pop_up would have to be related to a form button, which would contain
into its ob_state the number of the sub-menu. But the pop-up created does not have
a number! In addition, one should not forget to release the memory which the function
has reserved, like this:
@code
adr = create_popup(20, list);
free_pop_up(x, y, BLANK, adr);
free(adr);
@endcode
The memory reservation is made with the C function malloc() and not the one from
GEMDOS, which has lots of bugs. The release of memory must thus be also made by
C function. If some options must be "deactivated" or "checked", the programmer
will have to take care of it. For example: adr[3].ob_flags |= HIDETREE;
deactivate the third option (the object numbered 0 is the root). */
OBJECT* create_popup(int nbre, char* list);
/*! @brief Call a free pop-up
@param posx X Coordinate of the center of the pop-up. It will be possibly
shifted if it were to leave the screen.
@param posy Y Coordinate of the center of the pop-up. It will be possibly
shifted if it were to leave the screen.
@param tree Number of the tree serving as pop-up, or "-1" if one prefers
to transmit the address directly.
@param adr If the preceding parameter is set to "-1", addresses of the pop-up
form. If not, this parameter is ignored.
@return TRUE if an option was selected, FALSE if the pop-up was left by
clicking outside.
This function calls a "free" pop-up form, in the sense that its position is not
related to the position of a button in a form.
@note If an object has been chosen, TRUE is returned and an event is set up by
the function in the buffer of events. It is of type ::BEV_FREEPU.
If the clicked object is of type function pointer, the function is
automatically carried out before the return of the function.
Although this function is called internally by the function dialog()
(see the parameter "fl_rb" of dialog()), you may need to call it directly in
certain situations. */
int free_popup(int posx, int posy, int tree, OBJECT* adr);
/*! @brief Saves the image of an area in a MFDB
@param of_x X offset Coordinate of the Image area to save
@param of_y Y offset Coordinate of the Image area to save
@param of_w Width offset of the Image area to save
@param of_h Height offset of the Image area to save
@param img Pointer to the MFDB which will describe the saved area.
@return nothing
This function saves the image of an area in a MFDB, in order to restore it later.
It makes it possible to put "aside" the bottom of a form or pop-up, for example.
This bottom will be restored by the function put_bkgr().
@note This function is called internally by BIG, but you can use it to save area
of screen of necessary. See also function put_bkgr(). */
void get_bkgr(int of_x, int of_y, int of_w, int of_h, MFDB* img);
/*! @brief Restore the image of an area from a MFDB
@param of_x X offset Coordinate of the Image area to restore
@param of_y Y offset Coordinate of the Image area to restore
@param of_w Width offset of the Image area to restore
@param of_h Height offset of the Image area to restore
@param img Pointer to the MFDB which will be used to restore the saved area.
@return nothing
This function restores the image of an area which was saved in a MFDB, by the
function get_bkgr().
@note This function is called internally by BIG, but you can use it to restore
zones of screen if necessary. See also function get_bkgr(). */
void put_bkgr(int of_x, int of_y, int of_w, int of_h, MFDB* img);
/*! @brief Call and manage a BIG Alert
@param button Number of the default button: 0, 1, 2, or 3.
@param number Number (in the resource) of the free string containing the text
of the alert box, with the same format as for the GEM function
form_alert(). If that is more appropriate for the situation, the
string can be indicated directly in the following parameter. In this
case number must be equal to -1 (BLANK).
@param str If one wishes to directly transmit the string, it must set the
preceding parameter is -1 and str is then a pointer on the alert
string. Otherwise the string is empty.
@param fl_alrt If this flag is TRUE, alert will be managed by BIG, like a movable
form. If it is FALSE, it will be a normal GEM alarm, called by
form_alert().
@return: Number (1, 2 or 3) of the button which was clicked, as in GEM function
This function calls and manages a BIG alert box, i.e. a movable form. The call and
the string of alert are similar to their GEM counterparts. Alert can contain up to
5 lines of 31 characters maximum, and three buttons of 20 characters maximum.
@note BIG proposes 9 alert icons. If the string contains 0 as the icon number
the alert will be displayed without icon. Numbers 1 to 9 correspond to the
following icons:
- 1: Exclamation point
- 2: Question mark
- 3: Stop Panel
- 4: prohibited Direction Panel
- 5: Open hand
- 6: Letter "I", like Information
- 7: Bomb (for the error messages)
- 8: Printer
- 9: Diskette
.
If one works with 16 colors or more, the alert box is displayed in 3D, the bottom
being gray (color number 8). If not, it is displayed with a white background,
without 3D. */
int big_alert(int button, int number, char* str, int fl_alrt);
/*! @brief Return a pointer to a free string
@param number Number of the free string in the resource (given in the file
header created by the resource).
@return Pointer on the string in memory.
This function returns a pointer on a free string (or on a free alert) of an
internal or external resource. */
char* get_string(int number);
/*! @brief Link pop-up object and a sub-menu
@param tree Number of the tree containing the object.
@param obj Number of the object concerned.
@param formular Number of the sub-menu (or help form) to assign to the object.
@return Nothing
This function creates the link between an object of the pop-up type, B_POPUP,
B_LIST, B_HELP or B_HIERM and the sub-menu (or help form) who must be affected to it.
@note It is possible to create the link manually at the time of the creation of
the resource. However, that is rather tedious and especially, if new tree structures
are inserted later on, the work must be remade. It is thus more convenient to use
a series of calls to this function at the beginning of the program in order to
create these links by using the names of the trees and objects. */
void form_attach(int tree, int obj, char formular);
/*! @brief Create a link between an object an a free string of a bubble-help
@param tree Number of the tree containing the object.
@param obj Number of the object concerned.
@param bulle Number of the free string to assign to the object as a text of
the bubble.
@return Nothing
This function create the link between an object and the free string which must
be affected to him as a bubble-help.
@note It is possible to create the link "manually" at the time of the creation
of the resource. However, that is rather tedious and especially, if new strings
are inserted later on, the work must be remade. It is thus more convenient to
make series of calls to this function at the beginning of the program in order
to create these links by using the names of the trees, objects and strings.
The function also set the bit AIDE_OBJET of the concerned object in order to
announce that a bubble-help is affected to it. The function is without effect
for the objects which cannot receive bubble-help (see the chapter on the
bubble-help) */
void bulle_attach(int tree, int obj, char bulle);
/*! @brief Modify aspect parameters of BIG object
@param under Flag. If it is TRUE, the character will be underlined in
objects ::B_SELEC, ::B_UNDO and ::B_UNDER. If it is FALSE,
the character will not be underlined.
@param cunder Color Index of the underlined character.
@param ctxt_under Color index of the remainder of the text for the objects
already mentioned above.
@param cicn_coche Color Index of the icon for B_CHECKB buttons.
@param ctxt_coche Color index of the text for B_CHECKB buttons.
@param cicn_radio Color Index of the icon for B_RADIOB buttons.
@param ctxt_radio Color index of the text for B_RADIOB buttons.
@param cicn_popup Color Index of the icon for B_POPUP & B_LIST buttons.
@param ctxt_popup Color Index of the text for B_POPUP & B_LIST buttons.
@param cmove Color index of the lines for B_MOVE objects.
@param cgrastr Color index of the text for B_GRASTR objects.
@param clin_frame Color index of the frame for B_FRAME objects.
@param ctxt_frame Color index of the text for B_FRAME objects.
@param cniceline Color index of the lines for B_NICELINE objects.
This function makes it possible to modify certain parameters concerning the aspect
of BIG objects.
@note If "-1" is transmitted to an element, the corresponding adjustment is
unchanged. By default, the character is underlined (under == TRUE), it is in
red (cunder == RED), and all the other parameters are set to "black" (BLACK).
The numbers of the patterns correspond to those used by VDI function
vsf_style(). The design for the pattern is thus not limited to the 7 models of
the AES, but can take one of the 24 patterns provided by the VDI. The adjustments
affect all the corresponding objects of all the forms of the application.\n
The function tests if there is at the time of the call some window-forms or
windows with toolbar opened. If it finds some, these windows are entirely redrawn
to bring up to date the new adjustments. Therefore, this function should never be
called when the GEM is "freezed" by a blocking form. */
void set_interface(int under, int cunder, int ctxt_under, int cicn_coche,
int ctxt_coche, int cicn_radio, int ctxt_radio,
int cicn_popup, int ctxt_popup, int cmove, int cgrastr,
int clin_frame, int ctxt_frame, int cniceline);
/*! @brief Return the number of the parent object
@param adr Address of the form.
@param object number of the object which one seeks the parent.
@return Parent object Number
This function return the parent object number of an object. */
int cdecl parent(OBJECT* adr, int object);
/*! @brief Save the state of a Form
@param tree Address of the form.
@param bak Pointer on a pointer of string which is used as a backup buffer
by the function. This buffer is an storage area reserved with the
size necessary by the function. It will be released by res_rsc()
if called, or will be the responsibility of programmer if not.
@return Nothing
This function backs up in a buffer the state of a form, i.e. the buttons selected
or not, the text of editable, and the pop-up, etc, in order to restore them by
the function res_rsc() if the button 'Cancel' is clicked.
@note The call of this function must be made by the programmer before drawing the
form (by formm_draw() for example). In a form in window, it is necessary to call
this function in the event of click on the button 'Apply' in order to record the
new state. Then do not forget to precede this call with Mfree(adr_bakrsc)
(where adr_bakrsc is the address of the buffer), if not, an equivalent size would
be reserved for each time, without being released. See also the function res_rsc(). */
void bak_rsc(OBJECT* tree, char** bak);
/*! @brief Restore the state of a Form
@param tree Address of the form.
@param bak Pointer on a pointer of string which is used as a restore buffer
by the function. This buffer is an storage area that has been
reserved with the size necessary by the function bak_rsc(). The
memory is released by res_rsc().
@return Nothing
This function restores the state of a form saved by the function bak_rsc().
@note Warning: If the management of the form is left by 'Cancel', the programmer
must call this function to restore the form state. The storage area is then
released. If management is left by 'Confirm', it is the programmer who must
undertake the release of the storage area by: Mfree(adr_bakrsc)
If not, the storage area would remain allocated. See also the function bak_rsc(). */
void res_rsc(OBJECT* tree, char** bak);
/*! @brief Change mouse pointer in working area
@return Nothing
This function tests the position of the mouse compared to the working area of
the window in the foreground and changes possibly its shape.
@note It is useful to call this function in the following situation: a window
is opened, and the mouse must take a shape determined in its working area. The
window size is changed by the program, without the user directly changing its
dimensions. For example, the window displays a series of tables. By a keyboard
shortcut, the user requires to pass in the following table, the window size
is automatically adjusted by the program to the dimensions of the new table.
At the end of the process, if the mouse is in the working area, it is necessary
to activate the shape envisaged. If not, it is necessary to activate the default
arrow shape. This operation is carried out by the call to this function. */
void dlg_mouse(void);
/*! @brief Select a radio button in a group