~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to lcl/include/region.inc

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
constructor TRegion.Create;
29
29
begin
30
30
  inherited Create;
31
 
  FillChar(FRegionData, SizeOf(FRegionData), 0);
32
31
end;
33
32
 
34
33
{------------------------------------------------------------------------------
53
52
 ------------------------------------------------------------------------------}
54
53
procedure TRegion.Assign(Source : Tpersistent);
55
54
begin
56
 
  if Source is TRegion
57
 
  then begin
58
 
    Self.ClipRect := TRegion(Source).ClipRect;
59
 
    //TODO : Get Polygon INFO
 
55
  if Source is TRegion then
 
56
  begin
60
57
    Exit;
61
58
  end;
62
59
 
63
60
  inherited Assign(Source);
64
61
end;
65
62
 
 
63
procedure TRegion.AddRectangle(X1, Y1, X2, Y2: Integer);
 
64
var
 
65
  lRGN: HRGN;
 
66
begin
 
67
  ReferenceNeeded();
 
68
  lRGN := CreateRectRgn(X1, Y1, X2, Y2);
 
69
  CombineRgn(FReference.Handle, FReference.Handle, lRGN, RGN_OR);
 
70
  DeleteObject(lRGN);
 
71
end;
 
72
 
66
73
{------------------------------------------------------------------------------
67
74
  Method: TRegion.SetHandle
68
75
  Params:   a region handle
72
79
 ------------------------------------------------------------------------------}
73
80
procedure TRegion.SetHandle(const Value: HRGN);
74
81
begin
75
 
  if HRGN(FRegionData.Reference.Handle) = Value then Exit;
 
82
  if HRGN(FReference.Handle) = Value then Exit;
76
83
 
77
84
  FreeReference;
78
 
  FRegionData.Reference._lclHandle := TLCLHandle(Value);
79
 
  FRegionData.Rect := GetClipRect;
80
 
  //TODO: query polygon params
 
85
  FReference._lclHandle := TLCLHandle(Value);
 
86
  //TODO: query region description data
81
87
  Changed;
82
88
end;
83
89
 
96
102
function TRegion.GetReference: TWSRegionReference;
97
103
begin
98
104
  ReferenceNeeded;
99
 
  Result := FRegionData.Reference;
 
105
  Result := FReference;
100
106
end;
101
107
 
102
108
procedure TRegion.ReferenceNeeded;
103
 
var
104
 
  FillMode: integer;
 
109
// var
 
110
//  i: Integer;
 
111
//  lSource1, lSource2, lDest: HRGN;
105
112
begin
106
 
  if FRegionData.Reference.Allocated then Exit;
107
 
 
108
 
  if FRegionData.Polygon <> nil
109
 
  then begin
110
 
    if FRegionData.Winding
111
 
    then FillMode := Winding
112
 
    else FillMode := Alternate;
113
 
    
114
 
    FRegionData.Reference._lclHandle := TLCLHandle(CreatePolygonRgn(
115
 
      FRegionData.Polygon, FRegionData.NumPoints, FillMode));
116
 
    Exit;
117
 
  end;
118
 
    
119
 
  with FRegionData.Rect do
 
113
  if FReference.Allocated then Exit;
 
114
 
 
115
  FReference._lclHandle := TLCLHandle(CreateRectRgn(0, 0, 0, 0));
 
116
 
 
117
{ At the moment all operations are executed on a live handle, so not yet used
 
118
 
 
119
  for i := 0 to Length(RegionOperations) - 1 do
120
120
  begin
121
 
    if (Right - Left <> 0) or (Bottom - Top <> 0)
122
 
    then begin
123
 
      FRegionData.Reference._lclHandle := TLCLHandle(CreateRectRgn(Left, Top, Right, Bottom));
124
 
      Exit;
 
121
//    TRegionCombineMode = (rgnAnd, rgnCopy, rgnDiff, rgnOr, rgnXOR);
 
122
    case RegionOperations[i].ROType of
 
123
      rgnNewRect:
 
124
      begin
 
125
        lDest := LCLIntf.CreateRectRgn(
 
126
          RegionOperations[i].Rect.Left, RegionOperations[i].Rect.Top,
 
127
          RegionOperations[i].Rect.Left + RegionOperations[i].Rect.Width,
 
128
          RegionOperations[i].Rect.Top + RegionOperations[i].Rect.Height);
 
129
        AddSubRegion(lDest);
 
130
      end;
 
131
      rgnCombine:
 
132
      begin
 
133
        RegionOperations[i].CombineMode:=;
 
134
 
 
135
        CombineRgn(lDest, lSource1, lSource2);
 
136
      end;
125
137
    end;
126
 
  end;
127
 
  
 
138
    Source1, Source2, Dest: Integer; // Index to the list of sub-regions, -1 indicates the main region
 
139
    CombineMode: TRegionCombineMode; // Used only if ROType=rgnCombine
 
140
    Rect: TRect; // Used for ROType=rgnNewRect
 
141
  end;}
128
142
end;
129
143
 
130
144
{------------------------------------------------------------------------------
135
149
  Frees a region handle if needed
136
150
 ------------------------------------------------------------------------------}
137
151
 
 
152
procedure TRegion.AddOperation(AOp: TRegionOperation);
 
153
begin
 
154
 
 
155
end;
 
156
 
 
157
procedure TRegion.ClearSubRegions();
 
158
begin
 
159
 
 
160
end;
 
161
 
 
162
procedure TRegion.AddSubRegion(AHandle: HRGN);
 
163
begin
 
164
 
 
165
end;
 
166
 
138
167
procedure TRegion.FreeReference;
139
168
begin
140
 
  if not FRegionData.Reference.Allocated then Exit;
 
169
  if not FReference.Allocated then Exit;
141
170
 
142
 
  DeleteObject(HGDIOBJ(FRegionData.Reference.Handle));
143
 
  FRegionData.Reference._lclHandle := 0;
 
171
  DeleteObject(HGDIOBJ(FReference.Handle));
 
172
  FReference._lclHandle := 0;
144
173
end;
145
174
 
146
175
{------------------------------------------------------------------------------
152
181
 ------------------------------------------------------------------------------}
153
182
procedure TRegion.SetClipRect(Value : TRect);
154
183
begin
155
 
  if FRegionData.Rect = Value then Exit;
156
 
 
157
 
  FreeReference;
158
 
  FRegionData.Rect := Value;
159
 
  if FRegionData.Polygon <> nil then
160
 
    ReallocMem(FRegionData.Polygon, 0);
161
 
 
162
 
  FRegionData.Polygon := nil;
163
 
  FRegionData.NumPoints := 0;
164
 
  FRegionData.Winding := False;
165
 
    
166
 
  Changed;
 
184
//  if ClipRect = Value then Exit;
 
185
 
 
186
//  FreeReference;
 
187
//  ClipRect := Value;
 
188
 
 
189
//  Changed;
167
190
end;
168
191
 
169
192
{------------------------------------------------------------------------------
175
198
 ------------------------------------------------------------------------------}
176
199
function TRegion.GetClipRect : TRect;
177
200
begin
178
 
  if FRegionData.Reference.Allocated
 
201
  Result := Rect(0, 0, 0, 0);
 
202
//  Result := ClipRect;
 
203
{  if FRegionData.Reference.Allocated
179
204
  then begin
180
205
    GetRgnBox(HRGN(FRegionData.Reference.Handle), @Result);
181
206
  end
190
215
    end
191
216
    else
192
217
      Result := FRegionData.Rect;
193
 
  end;
 
218
  end;}
194
219
end;
195
220
 
196
221
// included by graphics.pp