~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to packages/extra/ptc/baseconi.inc

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    Free Pascal port of the OpenPTC C++ library.
 
3
    Copyright (C) 2001-2003  Nikolay Nikolov (nickysn@users.sourceforge.net)
 
4
    Original C++ version by Glenn Fiedler (ptc@gaffer.org)
 
5
 
 
6
    This library is free software; you can redistribute it and/or
 
7
    modify it under the terms of the GNU Lesser General Public
 
8
    License as published by the Free Software Foundation; either
 
9
    version 2.1 of the License, or (at your option) any later version.
 
10
 
 
11
    This library is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
    Lesser General Public License for more details.
 
15
 
 
16
    You should have received a copy of the GNU Lesser General Public
 
17
    License along with this library; if not, write to the Free Software
 
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
}
 
20
 
 
21
Constructor TPTCBaseConsole.Create;
 
22
 
 
23
Begin
 
24
  FReleaseEnabled := False;
 
25
End;
 
26
 
 
27
Procedure TPTCBaseConsole.open(Const _title : String);{ Overload;}
 
28
 
 
29
Begin
 
30
  open(_title, 0);
 
31
End;
 
32
 
 
33
Procedure TPTCBaseConsole.open(Const _title : String; Const _format : TPTCFormat);{ Overload;}
 
34
 
 
35
Begin
 
36
  open(_title, _format, 0);
 
37
End;
 
38
 
 
39
Procedure TPTCBaseConsole.open(Const _title : String; _width, _height : Integer;
 
40
                               Const _format : TPTCFormat);{ Overload;}
 
41
 
 
42
Begin
 
43
  open(_title, _width, _height, _format, 0);
 
44
End;
 
45
 
 
46
Procedure TPTCBaseConsole.open(Const _title : String; Const _mode : TPTCMode);{ Overload;}
 
47
 
 
48
Begin
 
49
  open(_title, _mode, 0);
 
50
End;
 
51
 
 
52
Function TPTCBaseConsole.KeyPressed : Boolean;
 
53
 
 
54
Var
 
55
  k : TPTCKey;
 
56
 
 
57
Begin
 
58
  k := TPTCKey.Create;
 
59
  Try
 
60
    Repeat
 
61
      If internal_PeekKey(k) = False Then
 
62
        Exit(False);
 
63
      If FReleaseEnabled Or k.Press Then
 
64
        Exit(True);
 
65
      internal_ReadKey(k);
 
66
    Until False;
 
67
  Finally
 
68
    k.Free;
 
69
  End;
 
70
End;
 
71
 
 
72
Procedure TPTCBaseConsole.ReadKey(k : TPTCKey);
 
73
 
 
74
Begin
 
75
  Repeat
 
76
    internal_ReadKey(k);
 
77
  Until FReleaseEnabled Or k.Press;
 
78
End;
 
79
 
 
80
Function TPTCBaseConsole.PeekKey(k : TPTCKey) : Boolean;
 
81
 
 
82
Begin
 
83
  If KeyPressed Then
 
84
  Begin
 
85
    ReadKey(k);
 
86
    Result := True;
 
87
  End
 
88
  Else
 
89
    Result := False;
 
90
End;
 
91
 
 
92
Procedure TPTCBaseConsole.ReadKey;
 
93
 
 
94
Var
 
95
  k : TPTCKey;
 
96
 
 
97
Begin
 
98
  k := TPTCKey.Create;
 
99
  Try
 
100
    ReadKey(k);
 
101
  Finally
 
102
    k.Free;
 
103
  End;
 
104
End;