Next: Contextual Menus for Editing Files, Previous: The File Selector, Up: Editing Files
The main menus that give access to extended functionalities related to source editing are described in this section.
When you save a new file for the first time, GPS will ask you to enter the
name of the file. In case you have started typing Ada code, GPS will try
to guess based on the first main entity in the editor and on the current
naming scheme, what should be the default name of this new file.
A new view can also be created by keeping the <shift> key pressed while
drag-and-dropping the editor (see Moving Windows). This second method is
preferred, since you can then specify directly where you want to put the new
view. The default when using the menu is that the new view is put on top of
the editor itself.
The first text area allows you to type a file name. You can start the beginning of a file name, and use the <Tab> key to complete the file name. If there are several possible completions, the common prefix will be displayed, and a list of all possible completions will be displayed in the second text area.
You can then either complete the name by typing it, or continue hitting the <Tab> key to cycle through the possible completions, or click on one of the completions in the list displayed.
If you press the down arrow key, the focus will move to the list of completions, so that you can select a file from this list without using the mouse.
Once you have made your choice, click on the OK
button to validate.
Clicking on Cancel
or hitting the <Esc> key will cancel the
operation and close the dialog.
This dialog will only show each file once. If you have extended
projects in your hierarchy, some files may be redefined in some
extending project. In this case, only the files from the extending
project are shown, and you cannot have access through this dialog to
the overridden files of the extended project. Of course, you can still
use the project explorer or the standard File->Open
menu to
open these files.
This default desktop is never overidden automatically by GPS.
On Windows, if no command is specified in the preferences the standard Windows
print dialog box is displayed. This dialog box allows the user to specify the
target printer, the properties of the printer, which pages to print (all, or a
specific range of pages), the number of copies to print, and, when more than
one copy is specified, whether the pages should be collated. Pressing the
Cancel button on the dialog box returns to GPS without printing the window
contents; otherwise the specified pages and copies are printed on the selected
printer. Each page is printed with a header containing the name of the file
(if the window has ever been saved). The page number is printed on the bottom
of each page.
See Print Command.
By default, if you press Paste, the newest text will be copied at the current position. But if you select Paste Previous immediately after (one or more times) you can instead paste text that was copied previously in the clipboard.
For instance, if you copy through Edit->Copy
the text "First", then
copy the text "Second", you can then select Edit->Paste
to insert
"Second" at the current location. If you then select
Edit->Paste Previous
, "Second" will be replaced by "First".
Selecting this menu several times will replace the text previously pasted by the previous one in the list saved in the clipboard. When reaching the end of this list, GPS will started from the beginning, and insert again the last text copied into the clipboard.
The size of this list is controlled by the Clipboard Size
preference.
For more information, See The Clipboard View.
Build->Load xref info in memory
, or this can be done automatically on
GPS startup via a preference. The first time you use this feature, GPS will
ask you wether you want this enabled or not.
In order to use this feature, open any Ada file, and begin to type an identifier. It has to be an identifier declared either in the current file (and accessible from the cursor location) or in one of the packages of the project loaded. Move the cursor right after the last character of the incomplete identifier and hit the completion key (which is <ctrl+space> by default). GPS will open a popup displaying all the known identifiers beginning with the prefix you typed. You can then browse among the various proposals by clicking on the <up> and <down> keys, or using the left scrollbar. For each entity, a documentation box is filled. If the location of the entity is known, it's displayed as an hyperlink, and you can jump directly to its declaration by clicking on it.
Typing new letters will reduce the range of proposal, as long as there remain solutions. Once you've selected the expected completion, you can validate by pressing <Enter>.
GPS is also able to complete a dotted notation. For example, if you type
with Ada.
and then hit the completion key, you will be offered all the child and nested packages of Ada. You can also write the beginning of the package, e.g.:
with Ada.Text
will offer you Text_IO.
If you are in a code section, you will be able to complete the fields of a record, or the contents of a package, e.g.:
type R is record Field1 : Integer; Field2 : Integer; end record; V : R; begin V.
Completing V. will propose Field1 and Field2.
Limitations:
gnatstub
.
gnatpp
. It is possible to specify gnatpp
switches in the
switch editor. See The Switches Editor.