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

« back to all changes in this revision

Viewing changes to lcl/interfaces/qt/qtwsdialogs.pp

  • 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
 
{ $Id: qtwsdialogs.pp 27717 2010-10-15 10:25:27Z sekelsenmat $}
 
1
{ $Id: qtwsdialogs.pp 40032 2013-01-29 21:29:03Z martin $}
2
2
{
3
3
 *****************************************************************************
4
4
 *                              QtWSDialogs.pp                               * 
134
134
    Result := TQtWidget(Application.MainForm.Handle).Widget
135
135
  else
136
136
    Result := nil;
 
137
  {$IFDEF MSWINDOWS}
 
138
  if Assigned(Result) then
 
139
  begin
 
140
    if (QWidget_windowFlags(Result) and QtTool <> 0) or
 
141
      (QWidget_windowFlags(Result) and QtDrawer <> 0) or
 
142
      (QWidget_windowFlags(Result) and QtSheet <> 0) or
 
143
      (QWidget_windowFlags(Result) and QtPopup <> 0) then
 
144
      Result := QApplication_desktop;
 
145
  end;
 
146
  {$ENDIF}
137
147
end;
138
148
 
139
149
{------------------------------------------------------------------------------
294
304
begin
295
305
  ATitle := GetUtf8String(AFileDialog.Title);
296
306
  QtFileDialog.setWindowTitle(@ATitle);
297
 
  QtFileDialog.setDirectory(GetUtf8String(AFileDialog.InitialDir));
 
307
  if (AFileDialog.InitialDir = '') then
 
308
    QtFileDialog.setDirectory(GetUtf8String(SysUtils.GetCurrentDir))
 
309
  else
 
310
    QtFileDialog.setDirectory(GetUtf8String(AFileDialog.InitialDir));
298
311
  QtFileDialog.setHistory(AFileDialog.HistoryList);
299
312
  QtFileDialog.setFilter(GetQtFilterString(AFileDialog, ATitle));
300
313
  QtFileDialog.setSelectedFilter(ATitle);
357
370
  i: integer;
358
371
  QtFileDialog: TQtFileDialog;
359
372
  {$ifdef QT_NATIVE_DIALOGS}
360
 
  selectedFilter, saveFileName, saveFilter, saveTitle: WideString;
 
373
  selectedFilter, saveFileName, saveFilter, saveTitle, sDir: WideString;
361
374
  Flags: Cardinal;
362
375
  {$endif}
363
376
  ActiveWin: HWND;
389
402
  begin
390
403
    {$ifdef QT_NATIVE_DIALOGS}
391
404
    saveFilter := GetQtFilterString(TSaveDialog(ACommonDialog), selectedFilter);
392
 
    saveFileName := GetUtf8String(FileDialog.InitialDir+FileDialog.Filename);
 
405
    sDir := FileDialog.InitialDir;
 
406
    if (SDir <> '') and (SDir[length(SDir)] <> PathDelim) then
 
407
      SDir := SDir + PathDelim;
 
408
    if (FileDialog.FileName <> '') and
 
409
      (ExtractFileName(FileDialog.FileName) <> FileDialog.FileName) then
 
410
        saveFileName := GetUtf8String(FileDialog.Filename)
 
411
    else
 
412
      saveFileName := GetUtf8String(SDir+FileDialog.Filename);
393
413
    saveTitle := GetUTF8String(FileDialog.Title);
394
414
 
395
415
    Flags := 0;
441
461
  begin
442
462
    {$ifdef QT_NATIVE_DIALOGS}
443
463
    saveFilter := GetQtFilterString(TOpenDialog(ACommonDialog), selectedFilter);
444
 
    saveFileName := GetUtf8String(FileDialog.InitialDir+FileDialog.Filename);
 
464
 
 
465
    sDir := FileDialog.InitialDir;
 
466
    if (SDir <> '') and (SDir[length(SDir)] <> PathDelim) then
 
467
      SDir := SDir + PathDelim;
 
468
    if (FileDialog.FileName <> '') and
 
469
      (ExtractFileName(FileDialog.FileName) <> FileDialog.FileName) then
 
470
        saveFileName := GetUtf8String(FileDialog.Filename)
 
471
    else
 
472
      saveFileName := GetUtf8String(SDir+FileDialog.Filename);
445
473
    saveTitle := GetUTF8String(FileDialog.Title);
446
474
 
447
475
    Flags := 0;
646
674
 ------------------------------------------------------------------------------}
647
675
class procedure TQtWSColorDialog.ShowModal(const ACommonDialog: TCommonDialog);
648
676
var
649
 
  AColor: TColor;
 
677
  AColor: TColorRef;
650
678
  AQColor: TQColor;
651
679
  AQtColor: QColorH;
652
680
  ARgb: QRgb;
662
690
    for i := 0 to ColorDialog.CustomColors.Count - 1 do
663
691
      if ExtractColorIndexAndColor(ColorDialog.CustomColors, i, AIndex, AColor) then
664
692
        if AIndex < CustomColorCount then
665
 
          QColorDialog_setCustomColor(AIndex, AColor);
 
693
          QColorDialog_setCustomColor(AIndex, QRgb(AColor));
666
694
  end;
667
695
 
668
696
begin
682
710
  try
683
711
    QColor_toRgb(AQtColor, @AQColor);
684
712
    TQColorToColorRef(AQColor, AColor);
685
 
    ColorDialog.Color := AColor;
 
713
    ColorDialog.Color := TColor(AColor);
686
714
  finally
687
715
    QColor_destroy(AQtColor);
688
716
  end;
715
743
  {------------------------------------------------------------------------------
716
744
    Code to call the dialog
717
745
   ------------------------------------------------------------------------------}
718
 
  CurrentFont := TQtFont(TFontDialog(ACommonDialog).Font.Reference.Handle).Widget;
 
746
  CurrentFont := TQtFont(TFontDialog(ACommonDialog).Font.Reference.Handle).FHandle;
719
747
 
720
748
  ReturnFont := QFont_create;
721
749
  try