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 Slid_Iterations : aliased MSComctlLib_Slider.SliderCtrl(Parent => Frm_Iterations'access);
33 package Slid_Iterations_Interfaces is new Gb.OleInterfaces(Slid_Iterations'access, "Main_Win_Slid_Iterations");
34 procedure Initialize_Form;
37 with GbOBJECTs; use GbOBJECTs;
40 package body Main_Win is
41 procedure Rad_Mandel_Click is
44 if Gb.Value(Rad_Mandel) = 1 then
45 Gb.Value(Rad_Julia, 0);
46 Gb.Enabled(Txt_Cx, 0);
47 Gb.Enabled(Txt_Cy, 0);
49 Gb.Value(Rad_Julia, 1);
50 Gb.Enabled(Txt_Cx, 1);
51 Gb.Enabled(Txt_Cy, 1);
56 procedure Rad_Julia_Click is
58 if Gb.Value(Rad_Julia) = 1 then
59 Gb.Value(Rad_Mandel, 0);
60 Gb.Enabled(Txt_Cx, 1);
61 Gb.Enabled(Txt_Cy, 1);
63 Gb.Value(Rad_Mandel, 1);
64 Gb.Enabled(Txt_Cx, 0);
65 Gb.Enabled(Txt_Cy, 0);
69 procedure Txt_Iterations_Changed is
71 Nb_Iterations : Gb.Long;
72 Nb_Iteration_Min : constant := 10;
73 Nb_Iteration_Max : constant := 1000;
77 Nb_Iterations := Gb.Long'Value(Text(Txt_Iterations));
79 if Nb_Iterations >= Nb_Iteration_Min and Nb_Iterations <= Nb_Iteration_Max then
81 Value(Slid_Iterations, Nb_Iterations);
85 end Txt_Iterations_Changed;
87 procedure But_Redraw_Click is
92 --line(Image2, 10, 10, 100, 100 , Color(122, 122, 122), 0,1);
96 procedure Slid_Iterations_Scroll is
100 Text(Txt_Iterations,Gb.Long'Image(Value(Slid_Iterations)));
103 end Slid_Iterations_Scroll;
105 procedure Form_WindowResized(Flag : Gb.INT; Width : Gb.INT; Height : Gb.INT) is
108 --gb.Width(Pic_Draw) + gb.Width(Frm_Part_Droite) + 16
109 if Gb.Width(Main_Win.Form) < 542 then
110 Gb.Width(Main_Win.Form, 542);
113 if Gb.Height(Main_Win.Form) < 369 then
114 Gb.Height(Main_Win.Form, 369);
118 --redimmensionnement de la zone de dessin
119 Gb.Width(Pic_Draw, Gb.Width(Main_Win.Form) - Gb.Width(Frm_Part_Droite) - 16 );
120 Gb.Height(Pic_Draw, Gb.Height(Main_Win.Form) - Gb.Height(Frm_Part_Bas) - 35 );
122 --Deplacement de la frame de droite
123 Gb.Left(Frm_Part_Droite, Gb.Width(Main_Win.Form) - Gb.Width(Frm_Part_Droite) - 9 );
125 --Deplacement de la frame du bas
126 Gb.Top(Frm_Part_Bas, Gb.Height(Main_Win.Form) - Gb.Height(Frm_Part_Bas) - 30);
128 --Deplacement du logo (en bas a gauche)
133 end Form_WindowResized;
135 procedure Initialize_Form is
137 Caption(Frm_Ensembles, "Ensembles");
138 Move(Frm_Ensembles, 6, 10, 89, 134);
139 Parent(Frm_Ensembles, Frm_Part_Droite);
141 Rad_Mandel.Click := Rad_Mandel_Click'access;
142 Caption(Rad_Mandel, "Mandelbrot");
143 Value(Rad_Mandel, Gb.True);
144 Move(Rad_Mandel, 8, 18, 77, 13);
145 Parent(Rad_Mandel, Frm_Ensembles);
147 Rad_Julia.Click := Rad_Julia_Click'access;
148 Caption(Rad_Julia, "Julia");
149 TabStop(Rad_Julia, Gb.False);
150 Move(Rad_Julia, 8, 59, 61, 13);
151 Parent(Rad_Julia, Frm_Ensembles);
153 Enabled(Txt_Cx, Gb.False);
155 Move(Txt_Cx, 31, 86, 51, 21);
156 Parent(Txt_Cx, Frm_Ensembles);
158 Enabled(Txt_Cy, Gb.False);
160 Move(Txt_Cy, 31, 107, 51, 21);
161 Parent(Txt_Cy, Frm_Ensembles);
163 Caption(Ch_Antialiasing, "Antialiasing");
164 Move(Ch_Antialiasing, 12, 206, 74, 13);
165 Parent(Ch_Antialiasing, Frm_Part_Droite);
167 Txt_Iterations.Changed := Txt_Iterations_Changed'access;
168 Text(Txt_Iterations, "0");
169 Move(Txt_Iterations, 3, 30, 84, 19);
170 Parent(Txt_Iterations, Frm_Iterations);
172 But_Redraw.Click := But_Redraw_Click'access;
173 Caption(But_Redraw, "REDRAW");
174 Move(But_Redraw, 7, 244, 88, 20);
175 Parent(But_Redraw, Frm_Part_Droite);
177 Caption(Lab_Cx, "Cx");
178 SetFont(Lab_Cx, "MS Sans Serif", 8, Gb.False, Gb.False, Gb.False);
179 Move(Lab_Cx, 14, 89, 14, 21);
180 Parent(Lab_Cx, Frm_Ensembles);
182 Caption(Lab_Cy, "Cy");
183 SetFont(Lab_Cy, "MS Sans Serif", 8, Gb.False, Gb.False, Gb.False);
184 Move(Lab_Cy, 14, 109, 16, 21);
185 Parent(Lab_Cy, Frm_Ensembles);
187 Cursor(Pic_Draw, Gb.CrossCursor);
188 Move(Pic_Draw, 3, 4, 422, 259);
190 Bitmap(Img_Logo, Gb.LoadBitmapResource("Img_Logo_Bitmap"));
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 Slid_Iterations.Scroll := Slid_Iterations_Scroll'access;
206 Move(Slid_Iterations, 2, 14, 84, 14);
208 Form.WindowResized := Form_WindowResized'access;
209 Icon(Form, Gb.LoadIconResource("Main_Win_Icon"));
210 Caption(Form, "Power Fractal 0.1");
211 MaxButton(Form, Gb.False);
212 Move(Form, 149, 269, 542, 369);
213 Visible(Form, Gb.True);
223 procedure PowerFractal is begin