64
62
pragma No_Strict_Aliasing (Kernel_Handle);
65
63
-- A kernel handle used to share information throughout GPS
67
package Kernel_Desktop is new Gtkada.MDI.Desktop (Kernel_Handle);
70
70
(Handle : out Kernel_Handle;
71
71
Main_Window : Gtk.Window.Gtk_Window;
73
Prefix_Directory : String);
72
Home_Dir : Virtual_File;
73
Prefix_Directory : Virtual_File);
74
74
-- Create a new GPS kernel.
75
75
-- By default, it isn't associated with any project, nor any source editor.
76
76
-- Home_Dir is the directory under which config files can be loaded/saved.
94
94
procedure Destroy (Handle : access Kernel_Handle_Record);
95
95
-- Free the memory occupied by the kernel
97
function Get_Default_Accelerators
98
(Handle : access Kernel_Handle_Record)
99
return Gtk.Accel_Group.Gtk_Accel_Group;
100
-- Returns the defauls accelerators group for the main window
102
97
function Get_Preferences
103
98
(Handle : access Kernel_Handle_Record)
104
99
return Default_Preferences.Preferences_Manager;
105
100
-- Return the preference manager associated with Handle
107
function Has_User_Desktop
108
(Handle : access Kernel_Handle_Record) return Boolean;
109
-- Return True if an user-defined desktop is present, and False
110
-- if the default desktop is used.
112
procedure Save_Desktop
113
(Handle : access Kernel_Handle_Record;
114
As_Default_Desktop : Boolean := False);
115
-- Save the current desktop.
116
-- If As_Default_Desktop is true, then this desktop will be loaded any time
117
-- no other valid desktop is found in the future.
119
function Load_Desktop (Handle : access Kernel_Handle_Record) return Boolean;
120
-- Reload a saved desktop.
121
-- Calls "Show_All" on Handle.Main_Window before loading the desktop.
122
-- Return False if no desktop could be loaded (in which case the default
123
-- desktop was loaded).
125
102
function Get_Main_Window
126
103
(Handle : access Kernel_Handle_Record) return Gtk.Window.Gtk_Window;
127
104
-- Return the main window associated with the kernel
129
function Get_Tooltips
130
(Handle : access Kernel_Handle_Record) return Gtk.Tooltips.Gtk_Tooltips;
131
-- Return the widget used to register tooltips for the graphical interface
134
(Handle : access Kernel_Handle_Record) return Gtk.Toolbar.Gtk_Toolbar;
135
-- Return the main toolbar associated with the kernel
137
106
function Get_History
138
107
(Handle : access Kernel_Handle_Record) return Histories.History;
139
108
-- Return the history database
175
144
(Handle : access Kernel_Handle_Record'Class) return Boolean;
176
145
-- Return whether the current state of the Kernel is a processing state
178
function Get_Home_Dir (Handle : access Kernel_Handle_Record) return String;
147
function Get_Home_Dir
148
(Handle : access Kernel_Handle_Record)
179
150
-- Return the Home directory. (eg ~/.gps/).
180
151
-- The directory ends with a directory separator
182
153
function Get_System_Dir
183
(Handle : access Kernel_Handle_Record) return String;
154
(Handle : access Kernel_Handle_Record)
184
156
-- Return the installation directory for GPS. This always ends up with a
185
157
-- directory separator.
202
174
function GNAT_Version
203
175
(Handle : access Kernel_Handle_Record) return String;
204
176
-- Return a string containing the GNAT version number.
205
-- The string has the form "3.16w (20020610)"
177
-- The string has the form "Pro 6.4.0w (20100727-43)"
178
-- See also Require_GNAT_Date below.
207
function Get_Icon_Factory
208
(Handle : access Kernel_Handle_Record)
209
return Gtk.Icon_Factory.Gtk_Icon_Factory;
210
-- Return the default icon factory
180
function Require_GNAT_Date
181
(Handle : access Kernel_Handle_Record;
182
Date : Basic_Types.Date_Type) return Boolean;
183
-- Return True if the version of GNAT associated with Handle is at
212
186
procedure Set_Destruction_Flag
213
187
(Handle : access Kernel_Handle_Record;
219
193
-- When return True, the kernel is in the process of being destroyed
221
195
procedure Report_Preference_File_Error
222
(Handle : access Kernel_Handle_Record;
196
(Handle : access Kernel_Handle_Record;
197
Filename : Virtual_File);
224
198
-- Print out an error message in messages window, or display a dialog
225
199
-- if GPS is exiting.
253
227
-- if it doesn't directly belong to a project.
255
229
function Create_From_Base
256
(Name : Glib.UTF8_String;
230
(Name : Filesystem_String;
257
231
Kernel : access Kernel_Handle_Record) return GNATCOLL.VFS.Virtual_File;
258
232
-- Create a new file. First try to resolve Base_Name (Name) to an absolute
259
233
-- path based on the source and object paths. If no file is found,
271
245
function Is_Hidden
272
246
(Kernel : access Kernel_Handle_Record;
273
Base_Name : String) return Boolean;
247
Base_Name : Filesystem_String) return Boolean;
274
248
-- Return whether File or Directory identified by its Base_Name should be
275
249
-- considered as hidden for all GUI purposes, such as the Project/File
276
250
-- explorer or the VCS operations.
282
256
procedure Parse_All_LI_Information
283
257
(Kernel : access Kernel_Handle_Record;
284
Project : Projects.Project_Type;
258
Project : GNATCOLL.Projects.Project_Type;
285
259
Recursive : Boolean);
286
260
-- Parse all the LI information in Project, for all the supported
287
261
-- languages. This can be used in cases where there is no obvious way to
297
271
return Language.Tree.Database.Construct_Database_Access;
298
272
-- Return the database storing the construct information
275
(Kernel : access Kernel_Handle_Record)
276
return GNATCOLL.Symbols.Symbol_Table_Access;
277
-- Return the symbol table used to store various shared strings, in
278
-- particular storing the name of all entities found in the source files
300
280
procedure Find_Declaration_Or_Overloaded
301
281
(Kernel : access Kernel_Handle_Record;
302
282
File : Entities.Source_File;
306
286
Ask_If_Overloaded : Boolean;
307
287
Entity : out Entities.Entity_Information;
308
288
Closest_Ref : out Entities.Entity_Reference;
309
Status : out Entities.Queries.Find_Decl_Or_Body_Query_Status);
289
Status : out Entities.Queries.Find_Decl_Or_Body_Query_Status;
290
Fuzzy_Expected : Boolean := False);
310
291
-- Find the declaration of the given entity in the file.
311
292
-- If Ask_If_Overloaded is True and there are several possible matches for
312
-- the entiy (for instance because the xref info is not up-to-date), an
293
-- the entity (for instance because the xref info is not up-to-date), an
313
294
-- interactive dialog is opened.
295
-- If Fast is True, get the entity information only from the
296
-- constructs database, do not attempt to refine the search using the ALI
297
-- database. ??? There is no Fast parameter
339
323
(Context : Selection_Context) return Abstract_Module_ID;
340
324
-- Return the module ID for the module that created the context
342
function Get_Current_Context
343
(Kernel : access Kernel_Handle_Record) return Selection_Context;
344
-- Return the context associated with the current MDI child.
345
-- The caller should not free the returned value, this is taken care of by
346
-- the kernel automatically. If the caller needs to keep the context valid
347
-- throughout its execution, it should first call Ref, and then Unref on
348
-- the context, similarly for any caller that need to keep a valid context.
349
-- The returned value might be null, if the current child doesn't support
350
-- selection contexts.
351
-- This function is mostly intended to be called for the callbacks in the
353
-- The context returned will be that of the active contextual menu if there
354
-- is one at that point in time (therefore, we ignore cases where for
355
-- instance a new child has been selected automatically at that point)
357
function Get_Context_For_Child
358
(Child : Gtkada.MDI.MDI_Child) return Selection_Context;
359
-- Return the context associated with Child.
360
-- The user should free the returned value.
362
function Get_Current_Focus_Widget
363
(Kernel : access Kernel_Handle_Record) return Gtk.Widget.Gtk_Widget;
364
-- Return the widget which currently has the keyboard focus. null is
365
-- returned if no widget has the focus, or if GPS itself doesn't have
385
343
-- If this function returns False, it is assumed the marker is no longer
386
344
-- legal, and should be removed from the history.
347
(Marker : access Location_Marker_Record)
348
return Location_Marker is abstract;
349
-- Return a clone of Marker
388
351
procedure Destroy (Marker : in out Location_Marker_Record);
389
-- Free the memory used by Marker. By default, this does nothing
352
-- Free the memory used by Marker. By default, this does nothing.
391
354
function To_String
392
355
(Marker : access Location_Marker_Record) return String is abstract;
398
361
(Marker : access Location_Marker_Record)
399
return Xml_Int.Node_Ptr is abstract;
362
return XML_Utils.Node_Ptr is abstract;
400
363
-- Saves the marker to an XML node, so that it can be reloaded later on,
401
364
-- possibly in a different GPS session.
407
370
-- visited. This is the basic interface for the handling of the history of
408
371
-- locations. It emits the hook Marker_Added_To_History.
374
(Left : access Location_Marker_Record;
375
Right : access Location_Marker_Record'Class) return Boolean is abstract;
376
-- Return True if Left and Right point to the same location in the sense
377
-- that GPS should not add a new marker in history for two locations that
384
procedure Register_Perma_Command
385
(Kernel : access Kernel_Handle_Record'Class;
386
Command : access Commands.Root_Command'Class);
387
-- Register a command to be freed when GPS exits. Such commands must not be
388
-- added to command queues, and therefore this is mostly intended for
389
-- commands used in actions or menus (but in such case the command is
390
-- automatically added already). A given command can be registered
391
-- several times though.
392
-- The current reference to Command is stolen, ie you must not call Unref
393
-- on the command before first calling Ref yourself.
410
395
--------------------
411
396
-- Action filters --
412
397
--------------------
590
576
-- a string instead of an Action_Record.
592
578
---------------------
593
-- Signal emission --
594
580
---------------------
596
procedure Setup (Data : Glib.Object.GObject; Id : Gtk.Handlers.Handler_Id);
597
-- Make sure that when Data is destroyed, Id is properly removed
599
package Object_User_Callback is new Gtk.Handlers.User_Callback_With_Setup
600
(Glib.Object.GObject_Record, Glib.Object.GObject, Setup);
601
-- Generic callback that can be used to connect a signal to a kernel
603
package Object_Return_Callback is new Gtk.Handlers.Return_Callback
604
(Glib.Object.GObject_Record, Boolean);
605
-- Generic callback that can be used to connect a signal to a kernel
607
package Object_User_Return_Callback
608
is new Gtk.Handlers.User_Return_Callback_With_Setup
609
(Widget_Type => Glib.Object.GObject_Record,
610
User_Type => Glib.Object.GObject,
611
Return_Type => Boolean,
613
-- Generic callback that can be used to connect a signal to a kernel
615
package Kernel_Callback is new Gtk.Handlers.User_Callback
616
(Glib.Object.GObject_Record, Kernel_Handle);
617
-- Generic callback that can be used to connect a signal to a kernel
619
package Object_Idle is new Gtk.Main.Idle (Glib.Object.GObject);
620
-- General Idle loop for a GObject
622
type File_Project_Record is record
623
Project : Projects.Project_Type;
624
File : aliased GNATCOLL.VFS.Virtual_File;
627
package File_Project_Cb is new Gtk.Handlers.User_Callback
628
(Glib.Object.GObject_Record, File_Project_Record);
629
-- Generic callback that can be used to connect a signal to a kernel
631
package Entity_Callback is new Gtk.Handlers.User_Callback
632
(Glib.Object.GObject_Record, Entities.Entity_Information);
582
function Get_Buffer_Factory
583
(Kernel : access Kernel_Handle_Record)
584
return GPS.Editors.Editor_Buffer_Factory_Access;
586
procedure Set_Buffer_Factory
587
(Kernel : access Kernel_Handle_Record;
588
Factory : GPS.Editors.Editor_Buffer_Factory_Access);
594
function Refactoring_Context
595
(Kernel : access Kernel_Handle_Record) return Refactoring.Factory_Context;
601
-- Handle the global state of the Hyper Mode
603
procedure Enter_Hyper_Mode (Kernel : access Kernel_Handle_Record);
606
procedure Leave_Hyper_Mode (Kernel : access Kernel_Handle_Record);
609
function In_Hyper_Mode
610
(Kernel : access Kernel_Handle_Record) return Boolean;
611
-- Return True if we are in Hyper mode
683
662
(Handle : access Kernel_Handle_Record;
684
663
Category : String;
686
Shadow : Boolean) return Boolean;
666
Background : Boolean) return Boolean;
687
667
-- Runs the "compilation_starting" hook.
688
668
-- The Category corresponds to the location/highlighting category that
689
669
-- will contain the compilation output.
692
672
-- Return True if the compilation should be started.
694
674
procedure Compilation_Finished
695
(Handle : access Kernel_Handle_Record;
675
(Handle : access Kernel_Handle_Record;
677
Target_Name : String;
680
Background : Boolean;
697
682
-- Runs the "compilation_finished" hook
698
683
-- The Category corresponds to the location/highlighting category that
699
684
-- contains the compilation output.
763
751
File_Status_Changed_Hook : constant Hook_Name := "file_status_changed";
764
752
-- Called when the status of a file is changed : Modified, Unmodified...
754
-- Hooks with String_Hooks_Args argument
755
Compute_Build_Targets_Hook : constant Hook_Name := "compute_build_targets";
756
-- Called when computing list of build targets, e.g. list of mains, or list
757
-- of Makefile targets. The string parameter gives the kind of target to
758
-- be computed (e.g. "main", "makefile").
768
762
type Filter_Type is (Filter_And, Filter_Or, Filter_Not, Standard_Filter);
812
806
Files : GNATCOLL.VFS.File_Array_Access := null;
813
807
-- The current selected files
815
Project : Projects.Project_Type := Projects.No_Project;
816
Importing_Project : Projects.Project_Type := Projects.No_Project;
809
Project : GNATCOLL.Projects.Project_Type :=
810
GNATCOLL.Projects.No_Project;
811
Importing_Project : GNATCOLL.Projects.Project_Type :=
812
GNATCOLL.Projects.No_Project;
817
813
Line : Integer := 0;
818
814
Column : Basic_Types.Visible_Column_Type := 0;
830
826
-- When several lines are selected in a file. The selection starts
831
827
-- at Line. Text is the current selection.
833
Entity_Name : GNAT.Strings.String_Access := null; -- ??? Use Text
829
Entity_Name : GNATCOLL.Symbols.Symbol := GNATCOLL.Symbols.No_Symbol;
834
830
Entity_Column : Basic_Types.Visible_Column_Type := 0;
836
832
Expression : GNAT.Strings.String_Access := null;
839
835
Closest_Ref : Entities.Entity_Reference := Entities.No_Entity_Reference;
840
836
-- The entity on which the user has clicked
842
Activity_Id : GNAT.Strings.String_Access := null;
838
Activities : String_List_Utils.String_List.List :=
839
String_List_Utils.String_List.Null_List;
845
842
Entity_Resolved : Entities.Queries.Find_Decl_Or_Body_Query_Status :=
846
843
Entities.Queries.Entity_Not_Found;
871
868
-- Selection_Context should not be visibly tagged, otherwise we would have
872
869
-- operations dispatching on multiple types above
874
872
procedure Adjust (Context : in out Selection_Context_Controlled);
875
875
procedure Finalize (Context : in out Selection_Context_Controlled);
876
876
-- See inherited documentation
878
878
No_Context : constant Selection_Context :=
879
(Data => (Ada.Finalization.Controlled with null));
879
(Data => (Ada.Finalization.Controlled with null));
881
881
No_Tool : constant Tool_Properties_Record :=
882
(null, null, null, null, null, False, null, null);
882
(null, null, null, null, null, False, null, null);
884
884
package Tools_List is new Ada.Containers.Doubly_Linked_Lists
885
885
(Tool_Properties_Record);
932
932
procedure Free (L : in out Hook_Description_Base_Access);
933
933
package Hooks_Hash is new HTables.Simple_HTable
934
(Hook_Htable_Num, Hook_Description_Base_Access, Free, null,
935
Hook_Name, Hash, "=");
934
(Header_Num => Hook_Htable_Num,
935
Element => Hook_Description_Base_Access,
940
Free_Element => Free);
937
942
type Location_Marker_Record is abstract tagged null record;
969
978
Startup_Scripts : Root_Table_Access;
970
979
-- The list of startup scripts and whether they should be loaded
972
Hooks : Hooks_Hash.HTable;
981
Hooks : Hooks_Hash.Instance;
973
982
-- The hooks registered in the kernel
975
Action_Filters : Action_Filters_Htable.String_Hash_Table.HTable;
984
Action_Filters : Action_Filters_Htable.String_Hash_Table.Instance;
976
985
All_Action_Filters : Action_Filters_List.List;
977
986
-- The action contexts registered in the kernel
983
992
Main_Window : Gtk.Window.Gtk_Window;
984
993
-- The main GPS window
986
Tooltips : Gtk.Tooltips.Gtk_Tooltips;
987
-- The widget used to register all tooltips
989
Registry : Projects.Registry.Project_Registry_Access;
995
Registry : Projects.Project_Registry_Access;
990
996
-- The project registry
992
998
Scripts : GNATCOLL.Scripts.Scripts_Repository;
1005
1011
Preferences : Default_Preferences.Preferences_Manager;
1006
1012
-- The current setting for the preferences
1014
Perma_Commands : Commands.Command_Lists.List;
1015
-- The list of global commands associated with menus, actions or
1016
-- contextual menus, so that they can be freed on exit. These commands
1017
-- are automatically added to the list when the menu or action is
1008
1020
Last_Context_For_Contextual : Selection_Context := No_Context;
1009
1021
-- The context used in the last contextual menu.
1010
1022
-- This variable should remain not null and unchanged while a contextual
1015
1027
-- Whether Last_Context_For_Contextual has been obtain from a contextual
1018
Last_Event_For_Contextual : Gdk.Event.Gdk_Event;
1019
-- The event triggering the last contextual menu
1021
Home_Dir : GNAT.Strings.String_Access;
1030
Home_Dir : Virtual_File;
1022
1031
-- The home directory (e.g ~/.gps)
1024
Prefix : GNAT.Strings.String_Access;
1033
Prefix : Virtual_File;
1025
1034
-- Prefix directory (e.g. /opt/gps)
1027
1036
Logs_Mapper : Basic_Mapper.File_Mapper_Access;
1042
1051
Custom_Files_Loaded : Custom_Load_State := None;
1043
1052
-- Whether all custom files have already been loaded
1045
Customization_Strings : Glib.Xml_Int.Node_Ptr;
1054
Customization_Strings : XML_Utils.Node_Ptr;
1046
1055
-- The customization strings hard-coded by the modules, and they have
1047
1056
-- been registered before all modules are loaded.
1049
Icon_Factory : Gtk.Icon_Factory.Gtk_Icon_Factory;
1050
-- The icon factory specific to GPS
1052
1058
Contextual : System.Address := System.Null_Address;
1053
1059
-- The contextual menus registered by the user. This is only used in
1054
1060
-- GPS.Kernel.Modules, and cast to the appropriate type in that
1062
1068
-- Determies wether the kernel is being destroyed
1064
1070
Hidden_File_Matcher : Pattern_Matcher_Access;
1072
Editor_Factory : GPS.Editors.Editor_Buffer_Factory_Access;
1074
Hyper_Mode : Boolean := False;
1075
-- Whether we are in hyper mode
1077
Messages_Container : System.Address := System.Null_Address;
1078
-- The message container for this instance of kernel
1080
Locations_View_Manager : System.Address := System.Null_Address;
1081
-- The locations view manager
1083
Refactoring : Standard.Refactoring.Factory_Context;
1067
1086
end GPS.Kernel;