3 with gbOBJECTs; use gbOBJECTs;
4 with Win32, Win32.WinDef, Win32.WinMain, Win32.WinUser, Win32.WinError, System;
5 with Win32.WinGDI, Win32.WinBase, Win32.WinNT, Win32.Utils, Interfaces.C;
6 use Win32, Win32.WinError, Interfaces.C, System;
8 with MSComctlLib_Slider; use MSComctlLib_Slider;
10 Form : aliased gb.MainWindow;
11 Frm_Ensembles : aliased gb.Frame;
12 Rad_Mandel : aliased gb.RadioButton;
13 Rad_Julia : aliased gb.RadioButton;
14 Txt_Cx : aliased gb.TextBox(Alignment => Right, AutoScroll => Both,
15 MultiLine => gb.False, Password => gb.False,
16 ReadOnly => gb.False);
17 Txt_Cy : aliased gb.TextBox(Alignment => Right, AutoScroll => Both,
18 MultiLine => gb.False, Password => gb.False,
19 ReadOnly => gb.False);
20 Ch_Antialiasing : aliased gb.CheckBox;
21 Txt_Iterations : aliased gb.TextBox(Alignment => Right, AutoScroll => Both,
22 MultiLine => gb.False, Password => gb.False,
23 ReadOnly => gb.False);
24 But_Redraw : aliased gb.Button;
25 Lab_Cx : aliased gb.Label;
26 Lab_Cy : aliased gb.Label;
27 Pic_Draw : aliased gb.Picture;
28 Img_Logo : aliased gb.Image;
29 Frm_Iterations : aliased gb.Frame;
30 Frm_Part_Droite : aliased gb.Frame;
31 Frm_Part_Bas : aliased gb.Frame;
32 Image2 : aliased gb.Image;
33 Slid_Iterations : aliased MSComctlLib_Slider.SliderCtrl(Parent => Frm_Iterations'access);
34 package Slid_Iterations_Interfaces is new gb.OleInterfaces(Slid_Iterations'access, "Main_Win_Slid_Iterations");
35 procedure Initialize_Form;
38 with gbOBJECTs; use gbOBJECTs;
41 package body Main_Win is
42 procedure Rad_Mandel_Click is
45 if gb.Value(Rad_Mandel) = 1 then
46 gb.Value(Rad_Julia, 0);
47 gb.Enabled(Txt_Cx, 0);
48 gb.Enabled(Txt_Cy, 0);
50 gb.Value(Rad_Julia, 1);
51 gb.enabled(Txt_Cx, 1);
52 gb.enabled(Txt_Cy, 1);
57 procedure Rad_Julia_Click is
59 if gb.Value(Rad_Julia) = 1 then
60 gb.Value(Rad_Mandel, 0);
61 gb.enabled(Txt_Cx, 1);
62 gb.enabled(Txt_Cy, 1);
64 gb.Value(Rad_Mandel, 1);
65 gb.enabled(Txt_Cx, 0);
66 gb.enabled(Txt_Cy, 0);
70 procedure Txt_Iterations_Changed is
72 Nb_Iterations : gb.Long;
73 Nb_Iteration_Min : Constant := 10;
74 Nb_Iteration_Max : Constant := 1000;
78 Nb_Iterations := gb.Long'value(Text(Txt_Iterations));
80 if Nb_Iterations >= Nb_Iteration_Min and Nb_Iterations <= Nb_Iteration_Max then
82 Value(Slid_Iterations, Nb_Iterations);
86 end Txt_Iterations_Changed;
88 procedure But_Redraw_Click is
93 Line(Image2, 10, 10, 100, 100 , Color(122, 122, 122), 0,1);
97 procedure Slid_Iterations_Scroll is
101 Text(Txt_Iterations,gb.Long'Image(Value(Slid_Iterations)));
104 end Slid_Iterations_Scroll;
106 procedure Form_WindowResized(Flag : gb.INT; Width : gb.INT; Height : gb.INT) is
109 --gb.Width(Pic_Draw) + gb.Width(Frm_Part_Droite) + 16
110 if gb.Width(Main_win.Form) < 542 then
111 gb.Width(Main_win.Form, 542);
114 if gb.Height(Main_win.Form) < 369 then
115 gb.Height(Main_win.Form, 369);
119 --redimmensionnement de la zone de dessin
120 gb.Width(Pic_Draw, gb.width(Main_Win.Form) - gb.Width(Frm_Part_Droite) - 16 );
121 gb.Height(Pic_Draw, gb.Height(Main_Win.Form) - gb.Height(Frm_Part_Bas) - 35 );
123 --Deplacement de la frame de droite
124 gb.Left(Frm_Part_Droite, gb.Width(Main_Win.Form) - gb.Width(Frm_Part_Droite) - 9 );
126 --Deplacement de la frame du bas
127 gb.Top(Frm_Part_Bas, gb.Height(Main_Win.Form) - gb.Height(Frm_Part_Bas) - 30);
129 --Deplacement du logo (en bas a gauche)
134 end Form_WindowResized;
136 procedure Initialize_Form is
138 Caption(Frm_Ensembles, "Ensembles");
139 Move(Frm_Ensembles, 6, 10, 89, 134);
140 Parent(Frm_Ensembles, Frm_Part_Droite);
142 Rad_Mandel.Click := Rad_Mandel_Click'Access;
143 Caption(Rad_Mandel, "Mandelbrot");
144 Value(Rad_Mandel, gb.True);
145 Move(Rad_Mandel, 8, 18, 77, 13);
146 Parent(Rad_Mandel, Frm_Ensembles);
148 Rad_Julia.Click := Rad_Julia_Click'Access;
149 Caption(Rad_Julia, "Julia");
150 TabStop(Rad_Julia, gb.False);
151 Move(Rad_Julia, 8, 59, 61, 13);
152 Parent(Rad_Julia, Frm_Ensembles);
154 Enabled(Txt_Cx, gb.False);
156 Move(Txt_Cx, 31, 86, 51, 21);
157 Parent(Txt_Cx, Frm_Ensembles);
159 Enabled(Txt_Cy, gb.False);
161 Move(Txt_Cy, 31, 107, 51, 21);
162 Parent(Txt_Cy, Frm_Ensembles);
164 Caption(Ch_Antialiasing, "Antialiasing");
165 Move(Ch_Antialiasing, 12, 206, 74, 13);
166 Parent(Ch_Antialiasing, Frm_Part_Droite);
168 Txt_Iterations.Changed := Txt_Iterations_Changed'Access;
169 Text(Txt_Iterations, "0");
170 Move(Txt_Iterations, 3, 30, 84, 19);
171 Parent(Txt_Iterations, Frm_Iterations);
173 But_Redraw.Click := But_Redraw_Click'Access;
174 Caption(But_Redraw, "REDRAW");
175 Move(But_Redraw, 7, 244, 88, 20);
176 Parent(But_Redraw, Frm_Part_Droite);
178 Caption(Lab_Cx, "Cx");
179 SetFont(Lab_Cx, "MS Sans Serif", 8, gb.False, gb.False, gb.False);
180 Move(Lab_Cx, 14, 89, 14, 21);
181 Parent(Lab_Cx, Frm_Ensembles);
183 Caption(Lab_Cy, "Cy");
184 SetFont(Lab_Cy, "MS Sans Serif", 8, gb.False, gb.False, gb.False);
185 Move(Lab_Cy, 14, 109, 16, 21);
186 Parent(Lab_Cy, Frm_Ensembles);
188 Cursor(Pic_Draw, gb.CrossCursor);
189 Move(Pic_Draw, 3, 4, 422, 259);
191 Border(Img_Logo, gb.False);
192 Move(Img_Logo, 1, 287, 100, 48);
193 Parent(Img_Logo, Frm_Part_Droite);
195 Caption(Frm_Iterations, "Iterations");
196 Move(Frm_Iterations, 7, 145, 89, 51);
197 Parent(Frm_Iterations, Frm_Part_Droite);
199 Caption(Frm_Part_Droite, "");
200 Move(Frm_Part_Droite, 429, -2, 104, 341);
202 Caption(Frm_Part_Bas, "");
203 Move(Frm_Part_Bas, 3, 264, 423, 75);
205 Move(Image2, 197, 15, 109, 51);
206 Parent(Image2, Frm_Part_Bas);
208 Slid_Iterations.Scroll := Slid_Iterations_Scroll'Access;
209 Move(Slid_Iterations, 2, 14, 84, 14);
211 Form.WindowResized := Form_WindowResized'Access;
212 Caption(Form, "Power Fractal 0.1");
213 MaxButton(Form, gb.False);
214 Move(Form, 203, 205, 542, 369);
215 Visible(Form, gb.True);
225 procedure PowerFractal is begin