~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/extra/forms/demo/ll.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
program ll;
 
2
 
 
3
uses xforms;
 
4
 
 
5
{*** Forms and Objects ***}
 
6
 
 
7
Type
 
8
TFD_axypform = record
 
9
        axypform : PFL_FORM;
 
10
        xyplot : PFL_OBJECT;
 
11
        status : PFL_OBJECT;
 
12
        vdata : pointer;
 
13
        ldata : longint;
 
14
end;
 
15
PFD_axypform = ^TFD_axypform;
 
16
 
 
17
 
 
18
var
 
19
xypui : PFD_axypform;
 
20
 
 
21
{ callbacks for form axypform }
 
22
Procedure xyplot_cb(ob : PFL_OBJECT; data : longint);cdecl;
 
23
 
 
24
 
 
25
var
 
26
    x, y : double;
 
27
    i : Longint;
 
28
    temp,buf : string[64];
 
29
 
 
30
begin
 
31
    fl_get_xyplot(ob, @x, @y, @i);
 
32
    if (i < 0) then exit;
 
33
    str (x,buf);
 
34
    str (y,temp);
 
35
    Buf:='X= '+Buf+' Y= '+temp+#0;
 
36
    fl_set_object_label(xypui^.status, @buf[1]);
 
37
end;
 
38
 
 
39
 
 
40
Procedure alwaysreturn_cb(ob : PFL_OBJECT; data : longint); cdecl;
 
41
 
 
42
begin
 
43
   fl_set_xyplot_return(xypui^.xyplot, fl_get_button(ob));
 
44
end;
 
45
 
 
46
procedure interpolate_cb(ob : PFL_OBJECT; data : longint);cdecl;
 
47
 
 
48
begin
 
49
   if fl_get_button(ob)=0 then
 
50
     fl_set_xyplot_interpolate(xypui^.xyplot, 0,2,0.2)
 
51
   else
 
52
     fl_set_xyplot_interpolate(xypui^.xyplot, 0,0,0.2);
 
53
end;
 
54
 
 
55
Procedure inspect_cb(ob : PFL_OBJECT; data :longint); cdecl;
 
56
 
 
57
begin
 
58
   fl_set_xyplot_inspect(xypui^.xyplot, fl_get_button(ob));
 
59
end;
 
60
 
 
61
 
 
62
procedure notic_cb(ob : PFL_OBJECT; data :longint); cdecl;
 
63
 
 
64
var notic : Longint;
 
65
 
 
66
begin
 
67
   notic := fl_get_button(ob);
 
68
 
 
69
   if (notic)<>0 then
 
70
     begin
 
71
     fl_set_xyplot_xtics(xypui^.xyplot, -1, -1);
 
72
     fl_set_xyplot_ytics(xypui^.xyplot, -1, -1);
 
73
     end
 
74
   else
 
75
     begin
 
76
     fl_set_xyplot_xtics(xypui^.xyplot, 0, 0);
 
77
     fl_set_xyplot_ytics(xypui^.xyplot, 0, 0);
 
78
     end;
 
79
end;
 
80
 
 
81
 
 
82
Function create_form_axypform : PFD_axypform;
 
83
 
 
84
var
 
85
  obj : PFL_OBJECT;
 
86
  fdui : PFD_axypform;
 
87
 
 
88
begin
 
89
  new(fdui);
 
90
 
 
91
  fdui^.axypform := fl_bgn_form(FL_NO_BOX, 431, 301);
 
92
  obj := fl_add_box(FL_UP_BOX,0,0,431,301,'');
 
93
  obj := fl_add_xyplot(FL_ACTIVE_XYPLOT,20,50,285,235,'');
 
94
  fdui^.xyplot :=  obj;
 
95
    fl_set_object_boxtype(obj,FL_DOWN_BOX);
 
96
    fl_set_object_color(obj, FL_BLACK, FL_GREEN);
 
97
    fl_set_object_lalign(obj,FL_ALIGN_BOTTOM or FL_ALIGN_INSIDE);
 
98
    fl_set_object_callback(obj,PFL_CALLBACKPTR(@xyplot_cb),0);
 
99
  obj := fl_add_checkbutton(FL_PUSH_BUTTON,315,40,80,25,'AlwaysReturn');
 
100
    fl_set_object_color(obj,FL_COL1,FL_BLUE);
 
101
    fl_set_object_callback(obj,PFL_CALLBACKPTR(@alwaysreturn_cb),0);
 
102
  obj := fl_add_checkbutton(FL_PUSH_BUTTON,315,65,80,25,'Interpolate');
 
103
    fl_set_object_color(obj,FL_COL1,FL_BLUE);
 
104
    fl_set_object_callback(obj,PFL_CALLBACKPTR(@interpolate_cb),0);
 
105
  obj := fl_add_checkbutton(FL_PUSH_BUTTON,315,90,85,25,'InspectOnly');
 
106
    fl_set_object_color(obj,FL_COL1,FL_BLUE);
 
107
    fl_set_object_callback(obj,PFL_CALLBACKPTR(@inspect_cb),0);
 
108
  obj := fl_add_text(FL_NORMAL_TEXT,45,15,170,25,'');
 
109
  fdui^.status := obj;
 
110
    fl_set_object_boxtype(obj, FL_DOWN_BOX);
 
111
  obj := fl_add_button(FL_NORMAL_BUTTON,325,250,90,30,'Done');
 
112
  obj := fl_add_checkbutton(FL_PUSH_BUTTON,315,120,85,25,'NoTics');
 
113
    fl_set_object_color(obj,FL_COL1,FL_BLUE);
 
114
    fl_set_object_callback(obj,PFL_CALLBACKPTR(@notic_cb),0);
 
115
  fl_end_form();
 
116
 
 
117
  create_form_axypform:=fdui;
 
118
end;
 
119
 
 
120
 
 
121
var
 
122
   x,y : array[0..24] of double;
 
123
   i : longint;
 
124
 
 
125
begin
 
126
   fl_initialize(@argc, argv, 'FormDemo', nil, 0);
 
127
   xypui := create_form_axypform;
 
128
 
 
129
   { fill-in form initialization code }
 
130
   fl_set_object_dblbuffer(xypui^.status, 1);
 
131
   for i  := 0 to 10 do
 
132
      begin
 
133
      x[i] := i;
 
134
      y[i] := i;
 
135
      end;
 
136
   fl_set_xyplot_data(xypui^.xyplot, x, y, 11, '','','');
 
137
 
 
138
   { show the first form }
 
139
   fl_show_form(xypui^.axypform,FL_PLACE_MOUSE,FL_TRANSIENT,'axypform');
 
140
   fl_do_forms();
 
141
end.