~ubuntu-branches/ubuntu/vivid/lazarus/vivid-proposed

« back to all changes in this revision

Viewing changes to lcl/interfaces/gtk2/gtk2lclintf.inc

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Paul Gevers
  • Date: 2013-06-22 13:31:45 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130622133145-kf2awlf322usnrfv
Tags: 1.0.10+dfsg-1
[ Abou Al Montacir ]
* New upstream maintenance release offering many fixes improving the IDE and
  the LCL stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch#Fixes_for_1.0.10
* Use compiler configuration file to pass debian custom compiler flags.
* Recover FTBFS on arm machines fix, dropped unintentionally when upgrading
  to 1.0.8. QT4 based LCL WS could not use QTOPIA. (Closes: Bug#712834)
* Update copyright notice to highlight that upstream source where repacked.

[ Paul Gevers ]
* Update Standard to 3.9.4 (no changes needed)
* Remove obsolete DM-Upload-Allowed
* Update lintian overrides
* Add myself to uploaders
* Update Vsc-Browser URL to the browse interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
{%MainUnit gtk2int.pas}
2
 
{ $Id: gtk2lclintf.inc 38822 2012-09-25 03:34:08Z paul $ }
 
2
{ $Id: gtk2lclintf.inc 41477 2013-05-31 15:32:57Z mattias $ }
3
3
{******************************************************************************
4
4
                 All GTK2 interface communication implementations.
5
5
                   Initial Revision  : Sat Jan 17 19:00:00 2004
889
889
end;
890
890
 
891
891
function TGtk2WidgetSet.AskUser(const DialogCaption, DialogMessage: string; DialogType:
892
 
   LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt;
 
892
  LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt;
893
893
 
894
894
const
895
895
  ButtonResults : array[mrNone..mrYesToAll] of Longint = (
896
896
    -1, idButtonOK, idButtonCancel, idButtonAbort, idButtonRetry,
897
 
    idButtonIgnore, idButtonYes,idButtonNo, idButtonAll, idButtonNoToAll,
 
897
    idButtonIgnore, idButtonYes, idButtonNo, idButtonAll, idButtonNoToAll,
898
898
    idButtonYesToAll);
899
899
 
900
900
var
901
 
  Btn: PGtkButton;
902
 
  BtnId: Longint;
903
901
  Dialog: PGtkWidget;
904
 
  ADialogResult: Integer;
905
 
  GtkDialogType: TGtkMessageType;
906
 
  Btns: TGtkButtonsType;
907
 
  BtnIdx: Integer;
908
 
  DefaultID: Integer;
909
 
  X: Integer;
910
 
  MainList,ChildList: PGList;
911
 
  Title: String;
912
 
  ActiveWindow: HWND;
913
 
  BtnResult: LongInt;
 
902
 
 
903
  function ResponseID(const AnID: Integer): Integer;
 
904
  begin
 
905
    case AnID of
 
906
      idButtonOK       : Result := GTK_RESPONSE_OK;
 
907
      idButtonCancel   : Result := GTK_RESPONSE_CANCEL;
 
908
      idButtonHelp     : Result := GTK_RESPONSE_HELP;
 
909
      idButtonYes      : Result := GTK_RESPONSE_YES;
 
910
      idButtonNo       : Result := GTK_RESPONSE_NO;
 
911
      idButtonClose    : Result := GTK_RESPONSE_CLOSE;
 
912
      idButtonAbort    : Result := GTK_RESPONSE_REJECT;
 
913
      idButtonRetry    : Result := GTK_RESPONSE_LCL_RETRY;
 
914
      idButtonIgnore   : Result := GTK_RESPONSE_LCL_IGNORE;
 
915
      idButtonAll      : Result := GTK_RESPONSE_LCL_ALL;
 
916
      idButtonNoToAll  : Result := GTK_RESPONSE_LCL_NOTOALL;
 
917
      idButtonYesToAll : Result := GTK_RESPONSE_LCL_YESTOALL;
 
918
    end;
 
919
  end;
914
920
 
915
921
  procedure CreateButton(const ALabel : String; const AResponse: Integer;
916
922
      const AImageHint: Integer = -1);
952
958
    end;
953
959
  end;
954
960
 
955
 
  function ResponseID(const AnID: Integer): Integer;
956
 
  begin
957
 
    case AnID of
958
 
      idButtonOK       : Result := GTK_RESPONSE_OK;
959
 
      idButtonCancel   : Result := GTK_RESPONSE_CANCEL;
960
 
      idButtonHelp     : Result := GTK_RESPONSE_HELP;
961
 
      idButtonYes      : Result := GTK_RESPONSE_YES;
962
 
      idButtonNo       : Result := GTK_RESPONSE_NO;
963
 
      idButtonClose    : Result := GTK_RESPONSE_CLOSE;
964
 
      idButtonAbort    : Result := GTK_RESPONSE_REJECT;
965
 
      idButtonRetry    : Result := GTK_RESPONSE_LCL_RETRY;
966
 
      idButtonIgnore   : Result := GTK_RESPONSE_LCL_IGNORE;
967
 
      idButtonAll      : Result := GTK_RESPONSE_LCL_ALL;
968
 
      idButtonNoToAll  : Result := GTK_RESPONSE_LCL_NOTOALL;
969
 
      idButtonYesToAll : Result := GTK_RESPONSE_LCL_YESTOALL;
970
 
    end;
971
 
  end;
 
961
var
 
962
  Btn: PGtkButton;
 
963
  BtnId: Longint;
 
964
  GtkDialogType: TGtkMessageType;
 
965
  BtnIdx: Integer;
 
966
  DefaultID, CancelID: Integer;
 
967
  X: Integer;
 
968
  MainList,ChildList: PGList;
 
969
  Title: String;
 
970
  ActiveWindow: HWND;
 
971
  BtnResult: LongInt;
 
972
  DlgBtn: TDialogButton;
 
973
  ADialogResult: Integer;
 
974
  Btns: TGtkButtonsType;
972
975
begin
973
976
  Result := mrNone;
974
977
  ReleaseCapture;
984
987
 
985
988
  Btns := GTK_BUTTONS_NONE;
986
989
  DefaultId := 0;
 
990
  CancelId := -1;
987
991
  for X := 0 to Buttons.Count - 1 do
988
992
  begin
989
 
    if Buttons[X].Default then
 
993
    DlgBtn:=Buttons[X];
 
994
    if (Buttons.DefaultButton=DlgBtn)
 
995
    or ((Buttons.DefaultButton=nil) and DlgBtn.Default) then
990
996
      DefaultID := X;
 
997
    if (Buttons.CancelButton=DlgBtn)
 
998
    or ((Buttons.CancelButton=nil) and DlgBtn.Cancel)
 
999
    then begin
 
1000
      CancelID := X;
 
1001
      ADialogResult := DlgBtn.ModalResult;
 
1002
    end;
991
1003
 
992
1004
    if (ADialogResult = mrNone) and
993
 
      (Buttons[X].ModalResult in [mrCancel, mrAbort, mrIgnore,
994
 
        mrNo, mrNoToAll]) then
 
1005
      (Buttons[X].ModalResult in [mrCancel, mrAbort, mrIgnore, mrNo, mrNoToAll])
 
1006
    then
995
1007
      ADialogResult := Buttons[X].ModalResult;
996
1008
  end;
997
1009
 
1036
1048
  MainList := gtk_container_children(PGtkContainer(PGtkDialog(Dialog)^.action_area));
1037
1049
  ChildList := MainList;
1038
1050
  BtnIdx := 0;
1039
 
 
1040
1051
  while ChildList <> nil do
1041
1052
  begin
1042
1053
    if (ChildList^.Data <> nil) then
1044
1055
      if GTK_IS_BUTTON(ChildList^.Data) then
1045
1056
      begin
1046
1057
        Btn := PGtkButton(ChildList^.Data);
 
1058
        DlgBtn := Buttons[BtnIdx];
1047
1059
 
1048
1060
        BtnID := -1;
1049
 
        BtnResult:=Buttons[BtnIdx].ModalResult;
 
1061
        BtnResult:=DlgBtn.ModalResult;
1050
1062
        if (BtnResult>=Low(ButtonResults)) and (BtnResult<=High(ButtonResults)) then
1051
 
        BtnID := ButtonResults[Buttons[BtnIdx].ModalResult];
1052
 
        if BtnID = idButtonCancel then
1053
 
           gtk_object_set_data(PGtkObject(Dialog), 'modal_result', Pointer(idButtonCancel));
 
1063
          BtnID := ButtonResults[DlgBtn.ModalResult];
 
1064
        if (BtnIdx=CancelID) then
 
1065
          g_object_set_data(PGObject(Dialog), 'modal_result', Pointer(PtrInt(DlgBtn.ModalResult)));
1054
1066
 
1055
 
        X := Buttons[BtnIdx].ModalResult;
1056
 
        gtk_object_set_data(PGtkObject(Btn), 'modal_result',
 
1067
        X := DlgBtn.ModalResult;
 
1068
        g_object_set_data(PGObject(Btn), 'modal_result',
1057
1069
          {%H-}Pointer(PtrInt(X)));
1058
1070
 
1059
1071
        g_signal_connect(PGtkObject(Btn), 'clicked',
1062
1074
        if DefaultID = BtnIdx then
1063
1075
        begin
1064
1076
          gtk_dialog_set_default_response(PGtkDialog(Dialog), ResponseID(BtnID));
1065
 
          X := Buttons[BtnIdx].ModalResult;
1066
 
          gtk_object_set_data(PGtkObject(Dialog), 'modal_result',
1067
 
            {%H-}Pointer(PtrInt(X)));
 
1077
          X := DlgBtn.ModalResult;
 
1078
          if CancelID<0 then
 
1079
            g_object_set_data(PGObject(Dialog), 'modal_result',
 
1080
              {%H-}Pointer(PtrInt(X)));
1068
1081
        end;
1069
1082
 
1070
1083
        inc(BtnIdx);