1
-----------------------------------------------------------------------
2
-- GDialog - GtkAda Components --
4
-- Copyright (C) 2000 --
5
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
7
-- Dialog is free software; you can redistribute it and/or modify it --
8
-- under the terms of the GNU General Public License as published by --
9
-- the Free Software Foundation; either version 2 of the License, or --
10
-- (at your option) any later version. --
12
-- This program is distributed in the hope that it will be useful, --
13
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
14
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
15
-- General Public License for more details. You should have received --
16
-- a copy of the GNU General Public License along with this library; --
17
-- if not, write to the Free Software Foundation, Inc., 59 Temple --
18
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
19
-----------------------------------------------------------------------
21
-- Display a GtkAda dialog on the screen with the contents of the standard
22
-- input file until an end of file is encountered.
24
-- Example using a unix-like shell:
26
-- $ cat << EOF | gdialog error justify_fill
27
-- > Merge of some changes failed. It usually means that some modified code
28
-- > is obsolete in the current project file.
30
-- > Files with the ".rej" extension have been generated to help merging
31
-- > manually if needed.
34
with Gtk.Main; use Gtk.Main;
35
with Gtk.Enums; use Gtk.Enums;
37
with Gtkada.Dialogs; use Gtkada.Dialogs;
39
with Ada.Text_IO; use Ada.Text_IO;
40
with Ada.Command_Line; use Ada.Command_Line;
41
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
42
with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
44
with GNAT.OS_Lib; use GNAT.OS_Lib;
47
Button : Message_Dialog_Buttons;
48
pragma Warnings (Off, Button);
50
Buffer : String (1 .. 8192);
52
Kind : Message_Dialog_Type := Information;
53
Justification : Gtk_Justification := Justify_Center;
58
if Argument_Count > 0 then
60
Kind := Message_Dialog_Type'Value (Argument (1));
62
when Constraint_Error =>
63
Put_Line (Standard_Error, "Wrong message dialog type: " &
65
Put_Line (Standard_Error, "Possible values are:");
67
for J in Message_Dialog_Type'Range loop
68
Put_Line (Standard_Error,
69
Translate (Message_Dialog_Type'Image (J), Lower_Case_Map));
76
if Argument_Count > 1 then
78
Justification := Gtk_Justification'Value (Argument (2));
80
when Constraint_Error =>
81
Put_Line (Standard_Error, "Wrong justification value: " &
83
Put_Line (Standard_Error, "Possible values are:");
85
for J in Gtk_Justification'Range loop
86
Put_Line (Standard_Error,
87
Translate (Gtk_Justification'Image (J), Lower_Case_Map));
96
Get_Line (Buffer (Last + 1 .. Buffer'Last), Last);
98
Buffer (Last) := ASCII.LF;
105
Button := Message_Dialog
106
(Buffer (1 .. Last), Kind, Button_OK,
107
Justification => Justification);