Skip to content

Commit aa1bb19

Browse files
committed
Merge branch 'topic/vadim/cmdline' into 'master'
Fix display of version and help on Windows See merge request eng/ide/gnatstudio!882
2 parents d80e442 + 4629fc1 commit aa1bb19

File tree

14 files changed

+423
-294
lines changed

14 files changed

+423
-294
lines changed

cli/src/gnatdoc_main.adb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Studio --
33
-- --
4-
-- Copyright (C) 2013-2023, AdaCore --
4+
-- Copyright (C) 2013-2025, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -21,6 +21,8 @@ with Ada.Command_Line;
2121
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
2222
with Ada.Text_IO; use Ada.Text_IO;
2323

24+
with VSS.Strings.Conversions;
25+
2426
with GNAT.Command_Line; use GNAT.Command_Line;
2527
with GNAT.OS_Lib;
2628
with GNAT.Regpat; use GNAT.Regpat;
@@ -415,10 +417,12 @@ begin
415417
if Show_Version then
416418
declare
417419
Version : constant String :=
418-
"GNATdoc "
419-
& To_String (Config.Version) & " ("
420-
& Config.Source_Date & ") hosted on "
421-
& Config.Target;
420+
"GNATdoc "
421+
& VSS.Strings.Conversions.To_UTF_8_String (Config.Version)
422+
& " ("
423+
& VSS.Strings.Conversions.To_UTF_8_String (Config.Source_Date)
424+
& ") hosted on "
425+
& VSS.Strings.Conversions.To_UTF_8_String (Config.Target);
422426
begin
423427
Put_Line (Version);
424428
return;

cli/src/gps-cli_utils.adb

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Studio --
33
-- --
4-
-- Copyright (C) 2013-2023, AdaCore --
4+
-- Copyright (C) 2013-2025, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -15,6 +15,16 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18+
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
19+
with GNAT.IO; use GNAT.IO;
20+
with GNAT.OS_Lib;
21+
22+
with VSS.Strings.Conversions;
23+
24+
with GNATCOLL.Scripts.Projects;
25+
with GNATCOLL.VFS_Utils;
26+
with GNATCOLL.Utils;
27+
1828
with GPS.CLI_Target_Loaders;
1929
with GPS.CLI_Scripts;
2030

@@ -39,14 +49,6 @@ with Language.Ada;
3949
with Language.C;
4050
with Language.Cpp;
4151

42-
with GNAT.IO; use GNAT.IO;
43-
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
44-
with Ada.Strings.Unbounded;
45-
with GNATCOLL.Scripts.Projects;
46-
with GNATCOLL.VFS_Utils;
47-
with GNATCOLL.Utils;
48-
with GNAT.OS_Lib;
49-
5052
package body GPS.CLI_Utils is
5153

5254
procedure Register_Classes
@@ -261,9 +263,11 @@ package body GPS.CLI_Utils is
261263
elsif Switch = "--version" or else Switch = "-v" then
262264
Put_Line
263265
("GNAT Studio version "
264-
& Ada.Strings.Unbounded.To_String (Config.Version) & " ("
265-
& Config.Source_Date & ") hosted on "
266-
& Config.Target);
266+
& VSS.Strings.Conversions.To_UTF_8_String (Config.Version)
267+
& " ("
268+
& VSS.Strings.Conversions.To_UTF_8_String (Config.Source_Date)
269+
& ") hosted on "
270+
& VSS.Strings.Conversions.To_UTF_8_String (Config.Target));
267271
GNAT.OS_Lib.OS_Exit (0);
268272
end if;
269273

common/core/src/config.ads.in

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-----------------------------------------------------------------------
2-
-- GNAT Studio --
2+
-- GNAT Studio --
33
-- --
4-
-- Copyright (C) 2001-2018, AdaCore --
4+
-- Copyright (C) 2001-2025, AdaCore --
55
-- --
66
-- GPS is free software; you can redistribute it and/or modify it --
77
-- under the terms of the GNU General Public License as published by --
@@ -20,7 +20,7 @@
2020
-- This package contains target specific parameters that are set at configure
2121
-- time.
2222

23-
with Ada.Strings.Unbounded;
23+
with VSS.Strings;
2424

2525
package Config is
2626

@@ -33,14 +33,13 @@ package Config is
3333
-- Constants --
3434
---------------
3535

36-
Current_Year : constant String := "@CURRENT_YEAR@";
36+
Current_Year : constant VSS.Strings.Virtual_String := "@CURRENT_YEAR@";
3737
-- The year to display in copyright notices
3838

39-
Version : Ada.Strings.Unbounded.Unbounded_String :=
40-
Ada.Strings.Unbounded.To_Unbounded_String ("@GPS_VERSION@");
39+
Version : VSS.Strings.Virtual_String := "@GPS_VERSION@";
4140
-- Version number of this software
4241

43-
Target : constant String := "@TARGET@";
42+
Target : constant VSS.Strings.Virtual_String := "@TARGET@";
4443
-- Target for which GPS is built
4544

4645
Darwin_Target : constant Boolean := @TARGET_IS_DARWIN@;
@@ -57,7 +56,7 @@ package Config is
5756
-- variable and do different things based on it. Consider using this
5857
-- variable as a last resort, to address very target specific issues.
5958

60-
Source_Date : constant String := "@GPS_DATE@";
59+
Source_Date : constant VSS.Strings.Virtual_String := "@GPS_DATE@";
6160

6261
Max_Frame : constant := 500;
6362
-- Maximum number of frames displayed in the backtrace window

common/ui/src/gui_utils.adb

Lines changed: 91 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Studio --
33
-- --
4-
-- Copyright (C) 2000-2024, AdaCore --
4+
-- Copyright (C) 2000-2025, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -15,87 +15,89 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18-
with Ada.Calendar; use Ada.Calendar;
18+
with Ada.Calendar; use Ada.Calendar;
1919
with Ada.Strings.Fixed;
20-
with Ada.Strings.Equal_Case_Insensitive; use Ada.Strings;
20+
with Ada.Strings.Equal_Case_Insensitive;
21+
use Ada.Strings;
2122
with Ada.Unchecked_Conversion;
2223
with Ada.Unchecked_Deallocation;
23-
2424
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
2525
with GNAT.OS_Lib; use GNAT.OS_Lib;
2626
with GNATCOLL.Utils; use GNATCOLL.Utils;
27+
with Interfaces.C;
28+
29+
with GNATCOLL.Traces; use GNATCOLL.Traces;
2730

28-
with VSS.Strings; use VSS.Strings;
29-
with VSS.Strings.Conversions; use VSS.Strings.Conversions;
30-
31-
with Glib.Convert; use Glib.Convert;
32-
with Glib.Object; use Glib.Object;
33-
with Glib.Properties; use Glib.Properties;
34-
with Glib.Menu_Model; use Glib.Menu_Model;
35-
with Glib.Values; use Glib.Values;
36-
with Glib.Variant; use Glib.Variant;
37-
38-
with Gdk; use Gdk;
39-
with Gdk.Cursor; use Gdk.Cursor;
40-
with Gdk.Device; use Gdk.Device;
41-
with Gdk.Event; use Gdk.Event;
42-
with Gdk.Keyval; use Gdk.Keyval;
31+
with VSS.Application;
32+
with VSS.Strings; use VSS.Strings;
33+
with VSS.Strings.Conversions;
34+
with VSS.Strings.Formatters.Strings; use VSS.Strings.Formatters.Strings;
35+
with VSS.Strings.Templates; use VSS.Strings.Templates;
36+
37+
with Glib.Convert; use Glib.Convert;
38+
with Glib.Object; use Glib.Object;
39+
with Glib.Properties; use Glib.Properties;
40+
with Glib.Menu_Model; use Glib.Menu_Model;
41+
with Glib.Values; use Glib.Values;
42+
with Glib.Variant; use Glib.Variant;
43+
44+
with Gdk; use Gdk;
45+
with Gdk.Cursor; use Gdk.Cursor;
46+
with Gdk.Device; use Gdk.Device;
47+
with Gdk.Event; use Gdk.Event;
48+
with Gdk.Keyval; use Gdk.Keyval;
4349
with Gdk.Main;
4450
with Gdk.Pixbuf;
45-
with Gdk.RGBA; use Gdk.RGBA;
46-
with Gdk.Types.Keysyms; use Gdk.Types.Keysyms;
47-
with Gdk.Types; use Gdk.Types;
48-
with Gdk.Window; use Gdk.Window;
49-
50-
with Gtk.Adjustment; use Gtk.Adjustment;
51-
with Gtk.Alignment; use Gtk.Alignment;
52-
with Gtk.Bin; use Gtk.Bin;
53-
with Gtk.Box; use Gtk.Box;
54-
with Gtk.Button; use Gtk.Button;
55-
with Gtk.Cell_Renderer; use Gtk.Cell_Renderer;
56-
with Gtk.Cell_Renderer_Pixbuf; use Gtk.Cell_Renderer_Pixbuf;
57-
with Gtk.Check_Button; use Gtk.Check_Button;
58-
with Gtk.Container; use Gtk.Container;
59-
with Gtk.Dialog; use Gtk.Dialog;
60-
with Gtk.Enums; use Gtk.Enums;
61-
with Gtk.Event_Box; use Gtk.Event_Box;
62-
with Gtk.Frame; use Gtk.Frame;
63-
with Gtk.GEntry; use Gtk.GEntry;
64-
with Gtk.Handlers; use Gtk.Handlers;
65-
with Gtk.Image; use Gtk.Image;
66-
with Gtk.Label; use Gtk.Label;
67-
with Gtk.List_Store; use Gtk.List_Store;
68-
with Gtk.Menu; use Gtk.Menu;
69-
with Gtk.Menu_Bar; use Gtk.Menu_Bar;
70-
with Gtk.Menu_Item; use Gtk.Menu_Item;
71-
with Gtk.Menu_Shell; use Gtk.Menu_Shell;
72-
with Gtk.Separator_Menu_Item; use Gtk.Separator_Menu_Item;
73-
with Gtk.Style_Context; use Gtk.Style_Context;
74-
with Gtk.Text_Iter; use Gtk.Text_Iter;
75-
with Gtk.Text_Mark; use Gtk.Text_Mark;
76-
with Gtk.Text_Tag; use Gtk.Text_Tag;
77-
with Gtk.Text_View; use Gtk.Text_View;
78-
with Gtk.Tree_Selection; use Gtk.Tree_Selection;
79-
with Gtk.Tree_Store; use Gtk.Tree_Store;
80-
with Gtk.Tree_View; use Gtk.Tree_View;
81-
with Gtk.Tree_View_Column; use Gtk.Tree_View_Column;
82-
with Gtk.Widget; use Gtk.Widget;
51+
with Gdk.RGBA; use Gdk.RGBA;
52+
with Gdk.Types.Keysyms; use Gdk.Types.Keysyms;
53+
with Gdk.Types; use Gdk.Types;
54+
with Gdk.Window; use Gdk.Window;
55+
56+
with Gtk.Adjustment; use Gtk.Adjustment;
57+
with Gtk.Alignment; use Gtk.Alignment;
58+
with Gtk.Bin; use Gtk.Bin;
59+
with Gtk.Box; use Gtk.Box;
60+
with Gtk.Button; use Gtk.Button;
61+
with Gtk.Cell_Renderer; use Gtk.Cell_Renderer;
62+
with Gtk.Cell_Renderer_Pixbuf; use Gtk.Cell_Renderer_Pixbuf;
63+
with Gtk.Check_Button; use Gtk.Check_Button;
64+
with Gtk.Container; use Gtk.Container;
65+
with Gtk.Dialog; use Gtk.Dialog;
66+
with Gtk.Enums; use Gtk.Enums;
67+
with Gtk.Event_Box; use Gtk.Event_Box;
68+
with Gtk.Frame; use Gtk.Frame;
69+
with Gtk.GEntry; use Gtk.GEntry;
70+
with Gtk.Handlers; use Gtk.Handlers;
71+
with Gtk.Image; use Gtk.Image;
72+
with Gtk.Label; use Gtk.Label;
73+
with Gtk.List_Store; use Gtk.List_Store;
74+
with Gtk.Menu; use Gtk.Menu;
75+
with Gtk.Menu_Bar; use Gtk.Menu_Bar;
76+
with Gtk.Menu_Item; use Gtk.Menu_Item;
77+
with Gtk.Menu_Shell; use Gtk.Menu_Shell;
78+
with Gtk.Separator_Menu_Item; use Gtk.Separator_Menu_Item;
79+
with Gtk.Style_Context; use Gtk.Style_Context;
80+
with Gtk.Text_Iter; use Gtk.Text_Iter;
81+
with Gtk.Text_Mark; use Gtk.Text_Mark;
82+
with Gtk.Text_Tag; use Gtk.Text_Tag;
83+
with Gtk.Text_View; use Gtk.Text_View;
84+
with Gtk.Tree_Selection; use Gtk.Tree_Selection;
85+
with Gtk.Tree_Store; use Gtk.Tree_Store;
86+
with Gtk.Tree_View; use Gtk.Tree_View;
87+
with Gtk.Tree_View_Column; use Gtk.Tree_View_Column;
88+
with Gtk.Widget; use Gtk.Widget;
8389
with Gtkada.Types;
8490

85-
with Pango.Enums; use Pango.Enums;
91+
with Pango.Enums; use Pango.Enums;
8692

87-
with Gtkada.Handlers; use Gtkada.Handlers;
88-
with Gtkada.MDI; use Gtkada.MDI;
93+
with Gtkada.Handlers; use Gtkada.Handlers;
94+
with Gtkada.MDI; use Gtkada.MDI;
8995

90-
with VSS.Application;
91-
92-
with Basic_Types; use Basic_Types;
93-
with Config; use Config;
94-
with Interfaces.C;
95-
with String_List_Utils; use String_List_Utils;
96-
with String_Utils; use String_Utils;
97-
with Glib_String_Utils; use Glib_String_Utils;
98-
with GNATCOLL.Traces; use GNATCOLL.Traces;
96+
with Basic_Types; use Basic_Types;
97+
with Config; use Config;
98+
with String_List_Utils; use String_List_Utils;
99+
with String_Utils; use String_Utils;
100+
with Glib_String_Utils; use Glib_String_Utils;
99101

100102
package body GUI_Utils is
101103

@@ -259,12 +261,17 @@ package body GUI_Utils is
259261
while Iter /= Null_Iter loop
260262
declare
261263
Str : Virtual_String
262-
renames To_Virtual_String (Model.Get_String (Iter, Col));
264+
renames VSS.Strings.Conversions.To_Virtual_String
265+
(Model.Get_String (Iter, Col));
263266
begin
264-
exit when Str = Text
267+
exit when
268+
Str = Text
265269
or else (not Case_Sensitive
266270
and then Equal_Case_Insensitive
267-
(To_UTF_8_String (Text), To_UTF_8_String (Str)));
271+
(VSS.Strings.Conversions.To_UTF_8_String
272+
(Text),
273+
VSS.Strings.Conversions.To_UTF_8_String
274+
(Str)));
268275
end;
269276

270277
Model.Next (Iter);
@@ -277,7 +284,7 @@ package body GUI_Utils is
277284
Gtk.List_Store.Append (Model, Iter);
278285
end if;
279286

280-
Model.Set (Iter, Col, To_UTF_8_String (Text));
287+
Model.Set (Iter, Col, VSS.Strings.Conversions.To_UTF_8_String (Text));
281288
end if;
282289

283290
if Select_Text then
@@ -3046,11 +3053,13 @@ package body GUI_Utils is
30463053
function Create_Logo_And_Title_Area
30473054
(Is_Dark_Theme : Boolean) return Gtk_Widget
30483055
is
3049-
Frame : Gtk_Frame;
3050-
Vbox : Gtk_Box;
3051-
Logo : Gtk_Image;
3052-
Label : Gtk_Label;
3053-
Suffix : constant String := (if Is_Dark_Theme then "-dark" else "");
3056+
Frame : Gtk_Frame;
3057+
Vbox : Gtk_Box;
3058+
Logo : Gtk_Image;
3059+
Label : Gtk_Label;
3060+
Suffix : constant String := (if Is_Dark_Theme then "-dark" else "");
3061+
Template : VSS.Strings.Templates.Virtual_String_Template := "Version {}";
3062+
30543063
begin
30553064
Gtk_New (Frame);
30563065
Get_Style_Context (Frame).Add_Class ("gps-welcome-dialog-logo-area");
@@ -3065,7 +3074,10 @@ package body GUI_Utils is
30653074
Size => Icon_Size_Dialog);
30663075
Vbox.Pack_Start (Logo, Expand => False);
30673076

3068-
Gtk_New (Label, "Version " & To_String (Config.Version));
3077+
Gtk_New
3078+
(Label,
3079+
VSS.Strings.Conversions.To_UTF_8_String
3080+
(Template.Format (Image (Config.Version))));
30693081
Label.Set_Alignment (0.75, 0.5);
30703082
Get_Style_Context (Label).Add_Class ("gps-welcome-dialog-version");
30713083
Vbox.Pack_Start (Label, Expand => False, Padding => 10);

0 commit comments

Comments
 (0)