1
-----------------------------------------------------------------------
4
-- Copyright (C) 2010, AdaCore --
6
-- GPS is free software; you can redistribute it and/or modify it --
7
-- under the terms of the GNU General Public License as published by --
8
-- the Free Software Foundation; either version 2 of the License, or --
9
-- (at your option) any later version. --
11
-- This program is distributed in the hope that it will be useful, --
12
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
13
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
14
-- General Public License for more details. You should have received --
15
-- a copy of the GNU General Public License along with this program; --
16
-- if not, write to the Free Software Foundation, Inc., 59 Temple --
17
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
18
-----------------------------------------------------------------------
22
with GNAT.Strings; use GNAT.Strings;
23
with Ada.Unchecked_Deallocation;
25
package GPS.Editors.Line_Information is
27
type GPS_Editor_Buffer is abstract new Editor_Buffer with null record;
29
----------------------
30
-- Line information --
31
----------------------
33
type Line_Information_Record is record
34
Text : GNAT.Strings.String_Access := null;
35
Tooltip_Text : GNAT.Strings.String_Access := null;
36
-- A text to be displayed in a tooltip
37
Image : Gdk.Pixbuf.Gdk_Pixbuf := Gdk.Pixbuf.Null_Pixbuf;
38
Associated_Command : Commands.Command_Access := null;
40
-- Text must be a valid UTF8 string, which may contain markups in the pango
43
Empty_Line_Information : constant Line_Information_Record;
45
type Line_Information_Array is array (Integer range <>)
46
of Line_Information_Record;
48
type Line_Information_Data is access Line_Information_Array;
49
for Line_Information_Data'Size use Standard'Address_Size;
50
pragma No_Strict_Aliasing (Line_Information_Data);
52
procedure Free (X : in out Line_Information_Record);
53
-- Free memory associated with X
55
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
56
(Line_Information_Array, Line_Information_Data);
58
procedure Add_File_Information
59
(This : GPS_Editor_Buffer;
61
Info : Line_Information_Data)
63
-- Add Info to Buffer.
65
function Add_Special_Line
66
(This : GPS_Editor_Buffer;
69
Category : String := "";
71
Column_Id : String := "";
72
Info : Line_Information_Data := null)
73
return Editor_Mark'Class is abstract;
74
-- Adds one non-editable line to the buffer, starting at line start_line
75
-- and contains string text. If category is specified, use it for
76
-- highlighting. Create a mark at beginning of block and return it. If name
77
-- is specified, retuned mark will have this name
78
-- Column_Id and Info, if not empty and null, indicate the Side information
79
-- to add to the buffer lines that we are inserting.
81
procedure Add_Special_Line
82
(This : GPS_Editor_Buffer'Class;
85
Category : String := "";
87
Column_Id : String := "";
88
Info : Line_Information_Data := null);
89
-- Same as above, but doesn't return mark
91
procedure Remove_Special_Lines
92
(This : GPS_Editor_Buffer;
93
Mark : Editor_Mark'Class;
94
Lines : Integer) is abstract;
95
-- Removes specified number of special lines at the specified mark. It
96
-- doesn't delete the mark
100
Empty_Line_Information : constant Line_Information_Record :=
101
(null, null, Gdk.Pixbuf.Null_Pixbuf, null);
103
end GPS.Editors.Line_Information;