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

« back to all changes in this revision

Viewing changes to ide/frames/window_options.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:
38
38
    ApplyButton: TButton;
39
39
    Bevel1: TBevel;
40
40
    Bevel2: TBevel;
 
41
    dropSplitterPlacement: TComboBox;
41
42
    CustomPositionRadioButton: TRadioButton;
42
43
    DefaultRadioButton: TRadioButton;
43
44
    GetWindowPositionButton: TButton;
45
46
    HeightLabel: TLabel;
46
47
    HideIDEOnRunCheckBox: TCheckBox;
47
48
    HideMessagesIconsCheckBox: TCheckBox;
 
49
    SplitLabel: TLabel;
48
50
    lblWindowCaption: TLabel;
49
51
    LeftEdit: TSpinEdit;
50
52
    LeftLabel: TLabel;
 
53
    SplitterList: TListBox;
 
54
    SplitterPanel: TPanel;
51
55
    SingleTaskBarButtonCheckBox: TCheckBox;
52
56
    RestoreWindowGeometryRadioButton: TRadioButton;
 
57
    SplitEdit: TSpinEdit;
53
58
    TitleStartsWithProjectCheckBox: TCheckBox;
54
59
    ProjectDirInIdeTitleCheckBox: TCheckBox;
55
60
    TopEdit: TSpinEdit;
61
66
    WindowPositionsListBox: TListBox;
62
67
    procedure ApplyButtonClick(Sender: TObject);
63
68
    procedure GetWindowPositionButtonClick(Sender: TObject);
 
69
    procedure SplitterListSelectionChange(Sender: TObject; User: boolean);
64
70
    procedure WindowPositionsListBoxSelectionChange(Sender: TObject; User: boolean);
65
71
  private
66
72
    FLayouts: TSimpleWindowLayoutList;
67
73
    FLayout: TSimpleWindowLayout;
 
74
    FDivider: TSimpleWindowLayoutDividerPos;
 
75
    FShowSimpleLayout: boolean;
68
76
    function GetPlacementRadioButtons(APlacement: TIDEWindowPlacement): TRadioButton;
69
77
    procedure SetLayout(const AValue: TSimpleWindowLayout);
 
78
    procedure SetDivider(const AValue: TSimpleWindowLayoutDividerPos);
70
79
    procedure SetWindowPositionsItem(Index: integer);
 
80
    procedure SaveCurrentSplitterLayout;
71
81
    procedure SaveLayout;
72
82
    function GetLayoutCaption(ALayout: TSimpleWindowLayout): String;
73
83
    property Layout: TSimpleWindowLayout read FLayout write SetLayout;
 
84
    property Divider: TSimpleWindowLayoutDividerPos read FDivider write SetDivider;
74
85
  public
75
86
    constructor Create(TheOwner: TComponent); override;
76
87
    destructor Destroy; override;
122
133
    HideMessagesIconsCheckBox.Checked := HideMessagesIcons;
123
134
    TitleStartsWithProjectCheckBox.Checked:=IDETitleStartsWithProject;
124
135
    ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
125
 
 
126
136
  end;
127
137
 
128
138
  FLayouts.Assign(IDEWindowCreators.SimpleLayoutStorage);
129
139
 
130
 
  if IDEDockMaster=nil then begin
 
140
  if FShowSimpleLayout then begin
131
141
    // Window Positions
132
 
    FLayouts.Assign(IDEWindowCreators.SimpleLayoutStorage);
133
142
    WindowPositionsGroupBox.Parent:=Self;
134
143
    WindowPositionsGroupBox.Caption := dlgWinPos;
135
144
    WindowPositionsListBox.Items.BeginUpdate;
144
153
          WindowPositionsListBox.Items.AddObject(GetLayoutCaption(FLayouts[j]),FLayouts[j]);
145
154
      end;
146
155
    end;
 
156
    //WindowPositionsListBox.Sorted := True;
147
157
    WindowPositionsListBox.Items.EndUpdate;
148
158
 
149
159
    LeftLabel.Caption := dlgLeftPos;
152
162
    HeightLabel.Caption := DlgHeightPos;
153
163
    ApplyButton.Caption := dlgButApply;
154
164
    GetWindowPositionButton.Caption := dlgGetPosition;
 
165
    SplitLabel.Caption := dlgWidthPos;
155
166
 
156
167
    UseWindowManagerSettingRadioButton.Caption := rsiwpUseWindowManagerSetting;
157
168
    DefaultRadioButton.Caption := rsiwpDefault;
158
169
    RestoreWindowGeometryRadioButton.Caption := rsiwpRestoreWindowGeometry;
159
170
    CustomPositionRadioButton.Caption := rsiwpCustomPosition;
160
171
 
 
172
    dropSplitterPlacement.Clear;
 
173
    dropSplitterPlacement.Items.Add(rsiwpSplitterFollowWindow);
 
174
    dropSplitterPlacement.Items.Add(rsiwpSplitterDefault);
 
175
    dropSplitterPlacement.Items.Add(rsiwpSplitterRestoreWindowGeometry);
 
176
    dropSplitterPlacement.Items.Add(rsiwpSplitterCustomPosition);
 
177
 
161
178
    SetWindowPositionsItem(0);
162
179
  end else begin
163
180
    WindowPositionsGroupBox.Parent:=nil;
198
215
  APlacement: TIDEWindowPlacement;
199
216
  RadioButton: TRadioButton;
200
217
  p: TPoint;
 
218
  i: Integer;
201
219
begin
202
220
  FLayout := AValue;
203
 
  if Layout=nil then Exit;
 
221
  Divider := nil;
 
222
  if Layout=nil then begin
 
223
    SplitterPanel.Visible := False;
 
224
    Exit;
 
225
  end;
204
226
  //debugln(['TWindowOptionsFrame.SetLayout ',Layout.FormID,' ',IDEWindowPlacementNames[Layout.WindowPlacement]]);
205
227
 
206
228
  for APlacement := Low(TIDEWindowPlacement) to High(TIDEWindowPlacement) do
242
264
  end;
243
265
 
244
266
  GetWindowPositionButton.Enabled := (Layout.Form <> nil);
 
267
 
 
268
  SplitterPanel.Visible := Layout.Dividers.NamedCount > 0;
 
269
  SplitterList.Clear;
 
270
  for i := 0 to Layout.Dividers.NamedCount - 1 do
 
271
    SplitterList.AddItem(Layout.Dividers.NamedItems[i].DisplayName, Layout.Dividers.NamedItems[i]);
 
272
  if Layout.Dividers.NamedCount > 0 then
 
273
    SplitterList.ItemIndex := 0;
 
274
end;
 
275
 
 
276
procedure TWindowOptionsFrame.SetDivider(const AValue: TSimpleWindowLayoutDividerPos);
 
277
begin
 
278
  FDivider := AValue;
 
279
  if FDivider=nil then exit;
 
280
 
 
281
  SplitEdit.Value := FDivider.Size;
 
282
  case FDivider.Placement of
 
283
    iwpdUseWindowSetting: dropSplitterPlacement.ItemIndex := 0;
 
284
    iwpdDefault:          dropSplitterPlacement.ItemIndex := 1;
 
285
    iwpdRestore:          dropSplitterPlacement.ItemIndex := 2;
 
286
    iwpdCustomSize:       dropSplitterPlacement.ItemIndex := 3;
 
287
  end;
245
288
end;
246
289
 
247
290
procedure TWindowOptionsFrame.WindowPositionsListBoxSelectionChange(
252
295
end;
253
296
 
254
297
procedure TWindowOptionsFrame.ApplyButtonClick(Sender: TObject);
255
 
var
256
 
  NewBounds: TRect;
257
298
begin
258
299
  SaveLayout;
259
 
  if (Layout<>nil) and (Layout.Form<>nil) and (Layout.Form.Parent=nil)
260
 
  and (Layout.WindowPlacement in [iwpCustomPosition,iwpRestoreWindowGeometry])
261
 
  then begin
262
 
    if (Layout.CustomCoordinatesAreValid) then begin
263
 
      // explicit position
264
 
      NewBounds:=Bounds(Layout.Left,Layout.Top,Layout.Width,Layout.Height);
265
 
      // set minimum size
266
 
      if NewBounds.Right-NewBounds.Left<20 then
267
 
        NewBounds.Right:=NewBounds.Left+20;
268
 
      if NewBounds.Bottom-NewBounds.Top<20 then
269
 
        NewBounds.Bottom:=NewBounds.Top+20;
270
 
      // move to visible area
271
 
      if NewBounds.Right<20 then
272
 
        OffsetRect(NewBounds,20-NewBounds.Right,0);
273
 
      if NewBounds.Bottom<20 then
274
 
        OffsetRect(NewBounds,0,20-NewBounds.Bottom);
275
 
      if NewBounds.Left>Screen.DesktopWidth-20 then
276
 
        OffsetRect(NewBounds,NewBounds.Left-(Screen.DesktopWidth-20),0);
277
 
      if NewBounds.Top>Screen.DesktopHeight-20 then
278
 
        OffsetRect(NewBounds,NewBounds.Top-(Screen.DesktopHeight-20),0);
279
 
      Layout.Form.SetBounds(
280
 
        NewBounds.Left,NewBounds.Top,
281
 
        NewBounds.Right-NewBounds.Left,NewBounds.Bottom-NewBounds.Top);
 
300
  if (Layout<>nil) and (Layout.Form<>nil) and (Layout.Form.Parent=nil) then begin
 
301
    if (Layout.WindowPlacement in [iwpCustomPosition,iwpRestoreWindowGeometry]) then begin
 
302
      Layout.ValidateAndSetCoordinates; // Adjust bounds to screen area and apply them.
 
303
      Layout.Applied := True;
282
304
    end;
 
305
    Layout.ApplyDivider(True);
283
306
  end;
284
307
end;
285
308
 
292
315
    WidthEdit.Value := Layout.Form.Width;
293
316
    HeightEdit.Value := Layout.Form.Height;
294
317
  end;
 
318
  Layout.ReadCurrentDividers(True);
 
319
  SplitterListSelectionChange(nil, False);
 
320
end;
 
321
 
 
322
procedure TWindowOptionsFrame.SplitterListSelectionChange(Sender: TObject; User: boolean);
 
323
begin
 
324
  if User then SaveCurrentSplitterLayout;
 
325
 
 
326
  if (SplitterList.Count = 0) or (SplitterList.ItemIndex < 0) then exit;
 
327
  SetDivider(TSimpleWindowLayoutDividerPos(SplitterList.Items.Objects[SplitterList.ItemIndex]));
295
328
end;
296
329
 
297
330
procedure TWindowOptionsFrame.SetWindowPositionsItem(Index: integer);
308
341
    lblWindowCaption.Caption := WindowPositionsListBox.Items[Index];
309
342
end;
310
343
 
 
344
procedure TWindowOptionsFrame.SaveCurrentSplitterLayout;
 
345
begin
 
346
  if FDivider = nil then exit;
 
347
  case dropSplitterPlacement.ItemIndex of
 
348
    0: FDivider.Placement := iwpdUseWindowSetting;
 
349
    1: FDivider.Placement := iwpdDefault;
 
350
    2: FDivider.Placement := iwpdRestore;
 
351
    3: FDivider.Placement := iwpdCustomSize;
 
352
  end;
 
353
  FDivider.Size := SplitEdit.Value;
 
354
end;
 
355
 
311
356
procedure TWindowOptionsFrame.SaveLayout;
312
357
var
313
358
  APlacement: TIDEWindowPlacement;
329
374
      Layout.Height := HeightEdit.Value;
330
375
    end;
331
376
  end;
 
377
  SaveCurrentSplitterLayout;
332
378
end;
333
379
 
334
380
function TWindowOptionsFrame.GetLayoutCaption(ALayout: TSimpleWindowLayout
356
402
  if Fits('UnitDependencies',dlgUnitDepCaption) then exit;
357
403
  if Fits('CodeExplorerView',lisCodeExplorer) then exit;
358
404
  if Fits('FPDocEditor',lisCodeHelpMainFormCaption) then exit;
359
 
  if Fits('PkgGraphExplorer',dlgPackageGraph) then exit;
 
405
  if Fits('PkgGraphExplorer',lisMenuPackageGraph) then exit;
360
406
  if Fits('ProjectInspector',lisMenuProjectInspector) then exit;
361
407
  if Fits('DbgOutput',lisMenuViewDebugOutput) then exit;
362
408
  if Fits('DbgEvents',lisMenuViewDebugEvents) then exit;
370
416
  if Fits('Inspect',lisInspectDialog) then exit;
371
417
  if Fits('SearchResults',lisMenuViewSearchResults) then exit;
372
418
  if Fits('AnchorEditor',lisMenuViewAnchorEditor) then exit;
 
419
  if Fits('TabOrderEditor',lisMenuViewTabOrder) then exit;
373
420
  if Fits('CodeBrowser',lisCodeBrowser) then exit;
374
421
  if Fits('IssueBrowser',lisMenuViewRestrictionBrowser) then exit;
375
422
  if Fits('JumpHistory',lisJHJumpHistory) then exit;
 
423
  if Fits('PseudoTerminal', lisMenuViewPseudoTerminal) then exit;
 
424
  if Fits('Threads', lisMenuViewThreads) then exit;
 
425
  if Fits('DbgHistory', lisMenuViewHistory) then exit;
 
426
  if Fits('ComponentList', lisFPComponents) then exit;
376
427
  Result:=ALayout.FormCaption;
377
428
end;
378
429
 
380
431
begin
381
432
  inherited Create(TheOwner);
382
433
  FLayouts:=TSimpleWindowLayoutList.Create;
 
434
  FShowSimpleLayout:=(IDEDockMaster=nil) or (not IDEDockMaster.HideSimpleLayoutOptions);
383
435
end;
384
436
 
385
437
destructor TWindowOptionsFrame.Destroy;