Skip to content

Commit 7ddcfca

Browse files
committed
Use VSS to display dialog box on Windows.
1 parent 6563481 commit 7ddcfca

File tree

2 files changed

+73
-57
lines changed

2 files changed

+73
-57
lines changed

gnatstudio/src/gps-initialization.adb

Lines changed: 59 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,50 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18-
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
19-
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
20-
with Ada.Text_IO; use Ada.Text_IO;
21-
with Config; use Config;
22-
with Interfaces.C; use Interfaces.C;
23-
with Glib; use Glib;
24-
with Glib.Application; use Glib.Application;
25-
with Glib.Error; use Glib.Error;
26-
with Glib.Messages; use Glib.Messages;
18+
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
19+
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
20+
with Ada.Text_IO; use Ada.Text_IO;
21+
with GNAT.Command_Line; use GNAT.Command_Line;
22+
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
23+
with GNAT.OS_Lib; use GNAT.OS_Lib;
24+
with Interfaces.C; use Interfaces.C;
25+
26+
with VSS.Characters.Latin; use VSS.Characters.Latin;
27+
with VSS.Command_Line;
28+
with VSS.Standard_Paths;
29+
with VSS.Strings; use VSS.Strings;
30+
with VSS.Strings.Conversions;
31+
with VSS.Strings.Formatters.Strings; use VSS.Strings.Formatters.Strings;
32+
with VSS.Strings.Templates; use VSS.Strings.Templates;
33+
34+
with GNATCOLL.Memory;
35+
with GNATCOLL.Traces; use GNATCOLL.Traces;
36+
with GNATCOLL.Utils; use GNATCOLL.Utils;
37+
with GNATCOLL.VFS; use GNATCOLL.VFS;
38+
with GNATCOLL.VFS.VSS_Utils; use GNATCOLL.VFS.VSS_Utils;
39+
40+
with Glib; use Glib;
41+
with Glib.Application; use Glib.Application;
42+
with Glib.Error; use Glib.Error;
43+
with Glib.Messages; use Glib.Messages;
2744
with Glib.Option;
2845
with Glib.Utils;
29-
with GNAT.Command_Line; use GNAT.Command_Line;
30-
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
31-
with GNAT.OS_Lib; use GNAT.OS_Lib;
32-
with GNATCOLL.Memory;
33-
with GNATCOLL.Traces; use GNATCOLL.Traces;
34-
with GNATCOLL.Utils; use GNATCOLL.Utils;
35-
with GNATCOLL.VFS; use GNATCOLL.VFS;
36-
with GNATCOLL.VFS.VSS_Utils; use GNATCOLL.VFS.VSS_Utils;
37-
with GPS.Callbacks; use GPS.Callbacks;
38-
with GPS.Globals; use GPS.Globals;
39-
with GPS.Intl; use GPS.Intl;
40-
with GPS.Kernel; use GPS.Kernel;
41-
with GPS.Traces;
4246
with Gtk;
43-
with Gtk_Utils; use Gtk_Utils;
44-
with Gtkada.Dialogs; use Gtkada.Dialogs;
47+
with Gtk_Utils; use Gtk_Utils;
48+
with Gtkada.Dialogs; use Gtkada.Dialogs;
4549
with Gtkada.Intl;
46-
with Gtkada.Types; use Gtkada.Types;
47-
with GUI_Utils; use GUI_Utils;
50+
with Gtkada.Types; use Gtkada.Types;
51+
52+
with Config; use Config;
53+
with GPS.Callbacks; use GPS.Callbacks;
54+
with GPS.Globals; use GPS.Globals;
55+
with GPS.Intl; use GPS.Intl;
56+
with GPS.Kernel; use GPS.Kernel;
57+
with GPS.Traces;
58+
with GUI_Utils; use GUI_Utils;
4859
with Remote_Module;
49-
with Src_Editor_Box; use Src_Editor_Box;
60+
with Src_Editor_Box; use Src_Editor_Box;
5061
with String_Utils;
51-
with VSS.Standard_Paths;
52-
with VSS.Strings;
53-
with VSS.Strings.Conversions;
5462

5563
package body GPS.Initialization is
5664

@@ -173,7 +181,7 @@ package body GPS.Initialization is
173181
Setenv ("TERM", "dumb");
174182

175183
declare
176-
Home : constant VSS.Strings.Virtual_String :=
184+
Home : constant Virtual_String :=
177185
Getenv_With_Fallback ("GNATSTUDIO_HOME", "GPS_HOME");
178186

179187
begin
@@ -941,23 +949,27 @@ package body GPS.Initialization is
941949
-- in the main group (such as Gtk+ options)
942950
-- Get_Help (True) will only print options from the main
943951
-- group
944-
Help : constant String :=
945-
"GNAT Studio "
946-
& VSS.Strings.Conversions.To_UTF_8_String (Config.Version)
947-
& " ("
948-
& VSS.Strings.Conversions.To_UTF_8_String (Config.Source_Date)
949-
& ") hosted on "
950-
& VSS.Strings.Conversions.To_UTF_8_String (Config.Target)
951-
& ASCII.LF
952-
& ASCII.LF
953-
& GPS_Command_Line.Context.Get_Help
954-
(Switch /= "--help-all", null);
952+
953+
Template : constant Virtual_String_Template :=
954+
-("GNAT Studio {} ({}) hosted on {}"
955+
& Line_Feed
956+
& Line_Feed
957+
& "{}");
958+
955959
begin
956-
Put_Line (Help);
960+
GPS_Command_Line.Do_Exit := True;
961+
962+
VSS.Command_Line.Report_Message
963+
(Template.Format
964+
(Image (Config.Version),
965+
Image (Config.Source_Date),
966+
Image (Config.Target),
967+
Image
968+
(VSS.Strings.Conversions.To_Virtual_String
969+
(GPS_Command_Line.Context.Get_Help
970+
(Switch /= "--help-all", null)))));
957971
end;
958972

959-
GPS_Command_Line.Do_Exit := True;
960-
961973
elsif Switch = "-X" then
962974
Handle_X_Switch (ICS.Value (Value));
963975

@@ -989,6 +1001,7 @@ package body GPS.Initialization is
9891001
& ASCII.LF
9901002
& "For now, you can still access this feature by enabling "
9911003
& "the GPS.INTERNAL.MODULE_REMOTE trace.";
1004+
9921005
begin
9931006
Put_Line (Standard_Error, Obsolete_Msg);
9941007

@@ -1076,8 +1089,7 @@ package body GPS.Initialization is
10761089
(Filename => Create_From_Base (+ICS.Value (Value)));
10771090

10781091
elsif Switch = "--tracelist" then
1079-
GNATCOLL.Traces.Show_Configuration
1080-
(Ada.Text_IO.Put_Line'Access);
1092+
GNATCOLL.Traces.Show_Configuration (Put_Line'Access);
10811093
GPS_Command_Line.Do_Exit := True;
10821094

10831095
elsif Switch = "--pwd" then

gnatstudio/src/gps-main.adb

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ with GNATCOLL.Scripts.Python;
2929
with GNATCOLL.Traces; use GNATCOLL.Traces;
3030
with GNATCOLL.VFS; use GNATCOLL.VFS;
3131
with GNATCOLL.VFS_Utils; use GNATCOLL.VFS_Utils;
32+
33+
with VSS.Command_Line;
3234
with VSS.Strings.Conversions;
35+
with VSS.Strings.Formatters.Strings; use VSS.Strings.Formatters.Strings;
36+
with VSS.Strings.Templates; use VSS.Strings.Templates;
3337

3438
with Glib;
3539
with Glib.Application; use Glib.Application;
@@ -2111,18 +2115,18 @@ begin
21112115
or else Ada.Command_Line.Argument (J) = "-v"
21122116
then
21132117
declare
2114-
Version : constant String :=
2115-
"GNAT Studio "
2116-
& VSS.Strings.Conversions.To_UTF_8_String (Config.Version)
2117-
& " ("
2118-
& VSS.Strings.Conversions.To_UTF_8_String (Config.Source_Date)
2119-
& ") hosted on "
2120-
& VSS.Strings.Conversions.To_UTF_8_String (Config.Target);
2118+
Template : constant Virtual_String_Template :=
2119+
"GNAT Studio {} ({}) hosted on {}";
2120+
21212121
begin
2122-
Put_Line (Version);
2123-
end;
2122+
GPS_Command_Line.Do_Exit := True;
21242123

2125-
GPS_Command_Line.Do_Exit := True;
2124+
VSS.Command_Line.Report_Message
2125+
(Template.Format
2126+
(VSS.Strings.Formatters.Strings.Image (Config.Version),
2127+
VSS.Strings.Formatters.Strings.Image (Config.Source_Date),
2128+
VSS.Strings.Formatters.Strings.Image (Config.Target)));
2129+
end;
21262130
end if;
21272131
end loop;
21282132

0 commit comments

Comments
 (0)