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

« back to all changes in this revision

Viewing changes to .pc/spell_errors.diff/examples/dockmanager/elasticsite/feditorsite.pas

  • 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:
 
1
unit fEditorSite;
 
2
(* EditorSite by DoDi <DrDiettrich1@aol.com>
 
3
Mimics an Delphi editor window, that allows to dock other windows to it,
 
4
with several extensions:
 
5
- optionally enlarging the window
 
6
- detach a page into a new editor window
 
7
- move a page into a different editor window
 
8
 
 
9
 
 
10
Some quirks should be handled properly in a true IDE implementation:
 
11
 
 
12
For simplicity an IDE main menu has been added to the main window,
 
13
that allows to create several project (View) window dummies,
 
14
which can be docked to each other, or to the editor window.
 
15
 
 
16
Mixed docking of editor pages and View windows (currently) is not blocked,
 
17
so that you can have multiple edit views within the editor window.
 
18
 
 
19
Secondary editor windows should have the same docking capabilities.
 
20
(not yet)
 
21
 
 
22
Known bugs:
 
23
- The IDE suspects dangling references - KEEP these references!
 
24
  Please report if you know how to fix this issue.
 
25
 
 
26
+ Problems with non-form project windows.
 
27
  Since the IDE windows are all forms, we only handle this case now.
 
28
*)
 
29
 
 
30
{$mode objfpc}{$H+}
 
31
 
 
32
{$DEFINE minimize} //test application minimize/restore
 
33
 
 
34
interface
 
35
 
 
36
uses
 
37
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
 
38
  ExtCtrls, ComCtrls, Menus,
 
39
  //fElasticSite,
 
40
  fEditBook,
 
41
  fEditForm;
 
42
 
 
43
type
 
44
  //TEditorSite = class(TDockingSite)
 
45
  TEditorSite = class(TForm)
 
46
    MenuItem10: TMenuItem;
 
47
    MenuItem11: TMenuItem;
 
48
    MenuItem12: TMenuItem;
 
49
    MenuItem13: TMenuItem;
 
50
    MenuItem14: TMenuItem;
 
51
    mnRestore: TMenuItem;
 
52
    mnMinimize: TMenuItem;
 
53
    mnWindowDump: TMenuItem;
 
54
    MenuItem2: TMenuItem;
 
55
    MenuItem3: TMenuItem;
 
56
    MenuItem4: TMenuItem;
 
57
    MenuItem5: TMenuItem;
 
58
    MenuItem6: TMenuItem;
 
59
    MenuItem7: TMenuItem;
 
60
    MenuItem8: TMenuItem;
 
61
    MenuItem9: TMenuItem;
 
62
    mnView: TMenuItem;
 
63
    OpenDialog1: TOpenDialog;
 
64
    MainMenu1: TMainMenu;
 
65
    MenuItem1: TMenuItem;
 
66
    mnExit: TMenuItem;
 
67
    mnOpen: TMenuItem;
 
68
    mnFile: TMenuItem;
 
69
    procedure FormActivate(Sender: TObject);
 
70
    procedure FormCreate(Sender: TObject);
 
71
    procedure FormDeactivate(Sender: TObject);
 
72
    procedure FormHide(Sender: TObject);
 
73
    procedure FormResize(Sender: TObject);
 
74
    procedure FormWindowStateChange(Sender: TObject);
 
75
    procedure mnMinimizeClick(Sender: TObject);
 
76
    procedure mnRestoreClick(Sender: TObject);
 
77
    procedure mnWindowDumpClick(Sender: TObject);
 
78
    procedure ViewMenuClick(Sender: TObject);
 
79
    procedure mnExitClick(Sender: TObject);
 
80
    procedure mnOpenClick(Sender: TObject);
 
81
  private
 
82
    FEdit: TEditBook; //to become a frame!
 
83
    CurEdit: TEditPage;
 
84
  public
 
85
    function CreateDockable(const cap: string): TWinControl;
 
86
    function OpenFile(const FileName: string): TObject;
 
87
  end;
 
88
 
 
89
var
 
90
  EditorSite: TEditorSite;
 
91
 
 
92
implementation
 
93
 
 
94
uses
 
95
  LCLProc,
 
96
  uMiniRestore,
 
97
  fClientForm,
 
98
  fFloatingSite;
 
99
 
 
100
{ TEditorSite }
 
101
 
 
102
procedure TEditorSite.FormCreate(Sender: TObject);
 
103
begin
 
104
(* EditBook should be a frame!
 
105
*)
 
106
  FEdit := TEditBook.Create(self);
 
107
  FEdit.Align := alClient;
 
108
  FEdit.BorderStyle := bsNone;
 
109
  FEdit.Parent := self;
 
110
  FEdit.Visible := True;
 
111
  FEdit.DragMode := dmManual; //disallow undocking
 
112
  FEdit.StayDocked := True;
 
113
end;
 
114
 
 
115
function TEditorSite.CreateDockable(const cap: string): TWinControl;
 
116
var
 
117
  Site: TFloatingSite;
 
118
  Client: TViewWindow;
 
119
begin
 
120
(* Create a client form, and dock it into a floating dock host site.
 
121
  We must force docking here, later the client will dock itself into
 
122
  a float host site, when it becomes floating.
 
123
*)
 
124
//create the form
 
125
  Client := TViewWindow.Create(Application);
 
126
  Client.Label1.Caption := cap;
 
127
  Client.Visible := True;
 
128
//name it
 
129
  Client.Caption := cap;
 
130
  try
 
131
    Client.Name := StringReplace(cap, ' ', '', [rfReplaceAll]);
 
132
  except
 
133
    //here: simply ignore duplicate name
 
134
  end;
 
135
  //Client.FloatingDockSiteClass := TFloatingSite;
 
136
  Site := TFloatingSite.Create(Application);
 
137
  Client.ManualDock(Site, nil, alClient);
 
138
  Site.Show;
 
139
  Result := Client;
 
140
end;
 
141
 
 
142
procedure TEditorSite.ViewMenuClick(Sender: TObject);
 
143
var
 
144
  item: TMenuItem absolute Sender;
 
145
begin
 
146
(* Create a dummy window from the menu item name.
 
147
*)
 
148
  CreateDockable(item.Caption);
 
149
end;
 
150
 
 
151
function TEditorSite.OpenFile(const FileName: string): TObject;
 
152
begin
 
153
//todo: load the file
 
154
  CurEdit := TEditPage.Create(self);
 
155
  CurEdit.LoadFile(FileName);
 
156
  CurEdit.ManualDock(FEdit);
 
157
//make it visible
 
158
  Result := CurEdit; //or what?
 
159
end;
 
160
 
 
161
procedure TEditorSite.mnOpenClick(Sender: TObject);
 
162
begin
 
163
  if OpenDialog1.Execute then begin
 
164
    OpenFile(OpenDialog1.FileName);
 
165
  end;
 
166
end;
 
167
 
 
168
procedure TEditorSite.mnExitClick(Sender: TObject);
 
169
begin
 
170
  Close;
 
171
end;
 
172
 
 
173
 
 
174
// ----------- application window handling -------------
 
175
 
 
176
procedure TEditorSite.FormActivate(Sender: TObject);
 
177
begin
 
178
  //DebugLn('--- Activate');
 
179
end;
 
180
 
 
181
procedure TEditorSite.FormDeactivate(Sender: TObject);
 
182
begin
 
183
  //DebugLn('--- Deactivate');
 
184
end;
 
185
 
 
186
procedure TEditorSite.FormHide(Sender: TObject);
 
187
begin
 
188
  //DebugLn('--- FormHide'); //not when minimized manually (win32)
 
189
  //mnMinimizeClick(Sender);
 
190
end;
 
191
 
 
192
procedure TEditorSite.FormResize(Sender: TObject);
 
193
begin
 
194
  //DebugLn('--- Resize');
 
195
end;
 
196
 
 
197
procedure TEditorSite.FormWindowStateChange(Sender: TObject);
 
198
begin
 
199
{$IFDEF minimize}
 
200
  //test manual Hide/Show
 
201
{$ELSE}
 
202
  DoMiniRestore;
 
203
{$ENDIF}
 
204
end;
 
205
 
 
206
procedure TEditorSite.mnMinimizeClick(Sender: TObject);
 
207
var
 
208
  i: integer;
 
209
  f: TForm;
 
210
begin
 
211
{$IFDEF minimize}
 
212
  for i := 0 to Screen.FormCount - 1 do begin
 
213
    f := Screen.Forms[i];
 
214
    //if f = self then f.WindowState := wsMinimized else
 
215
    if (f <> self) and f.Visible and (f.WindowState = wsNormal) then begin
 
216
    //both changes together crash on Linux/gtk2 :-(
 
217
      f.Hide;
 
218
      //f.WindowState := wsMinimized;
 
219
    end;
 
220
  end;
 
221
{$ELSE}
 
222
{$ENDIF}
 
223
end;
 
224
 
 
225
procedure TEditorSite.mnRestoreClick(Sender: TObject);
 
226
var
 
227
  i: integer;
 
228
  f: TForm;
 
229
begin
 
230
{$IFDEF minimize}
 
231
  for i := 0 to Screen.FormCount - 1 do begin
 
232
    f := Screen.Forms[i];
 
233
    //if f = self then f.WindowState := wsMinimized else
 
234
    if not f.Visible and (f.WindowState = wsNormal) then begin
 
235
    //both changes together crash on Linux/gtk2 :-(
 
236
      f.Show;
 
237
      //f.WindowState := wsNormal;
 
238
    end;
 
239
  end;
 
240
{$ELSE}
 
241
{$ENDIF}
 
242
end;
 
243
 
 
244
procedure TEditorSite.mnWindowDumpClick(Sender: TObject);
 
245
var
 
246
  i: integer;
 
247
  f: TWinControl;
 
248
  s: string;
 
249
begin
 
250
  DebugLn('--- CustomForms ---');
 
251
  for i := 0 to Screen.CustomFormCount - 1 do begin
 
252
    f := Screen.CustomForms[i];
 
253
    s := f.Name;
 
254
    while f.HostDockSite <> nil do begin
 
255
      f := f.HostDockSite;
 
256
      s := s + ' in ' + f.Name;
 
257
    end;
 
258
    DebugLn(s);
 
259
  end;
 
260
{ Seems to be the same list
 
261
}
 
262
  DebugLn('--- Forms ---');
 
263
  for i := 0 to Screen.FormCount - 1 do begin
 
264
    f := Screen.Forms[i];
 
265
    s := f.Name;
 
266
    while f.Parent <> nil do begin
 
267
      f := f.Parent;
 
268
      s := s + ' in ' + f.Name;
 
269
    end;
 
270
    DebugLn(s);
 
271
  end;
 
272
{}
 
273
  DebugLn('---');
 
274
end;
 
275
 
 
276
initialization
 
277
  {$I feditorsite.lrs}
 
278
 
 
279
end.
 
280