library: libGui #include "TGTextEditor.h" |
TGTextEditor
class description - header file - source file - inheritance tree (.pdf)
protected:
virtual void Build()
public:
TGTextEditor(const char* filename = "0", const TGWindow* p = 0, UInt_t w = 900, UInt_t h = 600)
TGTextEditor(TMacro* macro, const TGWindow* p = 0, UInt_t w = 0, UInt_t h = 0)
TGTextEditor(const TGTextEditor&)
virtual ~TGTextEditor()
void About()
static TClass* Class()
void ClearText()
virtual void CloseWindow()
void CompileMacro()
void DataChanged()
void ExecuteMacro()
void Goto()
virtual Bool_t HandleKey(Event_t* event)
virtual Bool_t HandleTimer(TTimer* t)
void InterruptMacro()
virtual TClass* IsA() const
Int_t IsSaved()
void LoadFile(char* fname = "NULL")
void PrintText()
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
void SaveFile(const char* fname)
Bool_t SaveFileAs()
void Search(Bool_t ret)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
protected:
TTimer* fTimer for statusbar and toolbar update
TGStatusBar* fStatusBar for file name, line and col number
TGToolBar* fToolBar toolbar with common tool buttons
TGTextEdit* fTextEdit text edit widget
TGComboBox* fComboCmd commands combobox
TGTextEntry* fCommand command text entry widget
TGTextBuffer* fCommandBuf command text buffer
TGLayoutHints* fMenuBarLayout used for the menubar
TGLayoutHints* fMenuBarItemLayout used for for menubar items
TGMenuBar* fMenuBar editor's menu bar
TGPopupMenu* fMenuFile "File" menu entry
TGPopupMenu* fMenuEdit "Edit" menu entry
TGPopupMenu* fMenuSearch "Search" menu entry
TGPopupMenu* fMenuTools "Tools" menu entry
TGPopupMenu* fMenuHelp "Help" menu entry
Bool_t fExiting true if editor is closing
Bool_t fTextChanged true if text has changed
TString fFilename name of the opened file
TMacro* fMacro pointer on the opened macro
TGTextEditor
A simple text editor that uses the TGTextEdit widget.
It provides all functionalities of TGTextEdit as copy, paste, cut,
search, go to a given line number. In addition, it provides the
possibilities for compiling, executing or interrupting a running
macro.
This class can be used in following ways:
- with file name as argument:
new TGTextEditor("hsimple.C");
- with a TMacro* as argument:
TMacro *macro = new TMacro("hsimple.C");
new TGTextEditor(macro);
Basic Features:
New Document
To create a new blank document, select File menu / New, or click
the New toolbar button. It will create a new instance of
TGTextEditor.
Open/Save File
To open a file, select File menu / Open or click on the Open
toolbar button. This will bring up the standard File Dialog for
opening files.
If the current document has not been saved yet, you will be asked
either to save or abandon the changes.
To save the file using the same name, select File menu / Save or
the toolbar Save button. To change the file name use File menu /
Save As... or corresponding SaveAs button on the toolbar.
Text Selection
You can move the cursor by simply clicking on the desired location
with the left mouse button. To highlight some text, press the mouse
and drag the mouse while holding the left button pressed.
To select a word, double-click on it;
to select the text line - triple-click on it;
to select all do quadruple-click.
Cut, Copy, Paste
After selecting some text, you can cut or copy it to the clipboard.
A subsequent paste operation will insert the contents of the
clipboard at the current cursor location.
Text Search
The editor uses a standard Search dialog. You can specify a forward
or backward search direction starting from the current cursor
location according to the selection made of a case sensitive mode
or not. The last search can be repeated by pressing F3.
Text Font
You can change the text font by selecting Edit menu / Set Font.
The Font Dialog pops up and shows the Name, Style, and Size of any
available font. The selected font sample is shown in the preview
area.
Executing Macros
You can execute the currently loaded macro in the editor by
selecting Tools menu / Execute Macro; by clicking on the
corresponding toolbar button, or by using Ctrl+F5 accelerator keys.
This is identical to the command ".x macro.C" in the root prompt
command line.
Compiling Macros
The currently loaded macro can be compiled with ACLiC if you select
Tools menu / Compile Macro; by clicking on the corresponding
toolbar button, or by using Ctrl+F7 accelerator keys.
This is identical to the command ".L macro.C++" in the root prompt
command line.
Interrupting a Running Macro
You can interrupt a running macro by selecting the Tools menu /
Interrupt; by clicking on the corresponding toolbar button, or by
using Shift+F5 accelerator keys.
Interface to CINT Interpreter
Any command entered in the Command combo box will be passed to
the CINT interpreter. This combo box will keep the commands history
and will allow you to re-execute the same commands during an editor
session.
Keyboard Bindings
The following table lists the keyboard shortcuts and accelerator
keys.
Key: Action:
==== =======
Up Move cursor up.
Shift+Up Move cursor up and extend selection.
Down Move cursor down.
Shift+Down Move cursor down and extend selection.
Left Move cursor left.
Shift+Left Move cursor left and extend selection.
Right Move cursor right.
Shift+Right Move cursor right and extend selection.
Home Move cursor to begin of line.
Shift+Home Move cursor to begin of line and extend selection.
Ctrl+Home Move cursor to top of page.
End Move cursor to end of line.
Shift+End Move cursor to end of line and extend selection.
Ctrl+End Move cursor to end of page.
PgUp Move cursor up one page.
Shift+PgUp Move cursor up one page and extend selection.
PgDn Move cursor down one page.
Shift+PgDn Move cursor down one page and extend selection.
Delete Delete character after cursor, or text selection.
BackSpace Delete character before cursor, or text selection.
Ctrl+B Move cursor left.
Ctrl+D Delete character after cursor, or text selection.
Ctrl+E Move cursor to end of line.
Ctrl+H Delete character before cursor, or text selection.
Ctrl+K Delete characters from current position to the
end of line.
Ctrl+U Delete current line.
void SaveFile(const char *fname)
Save the edited text in the file "fname".
Int_t IsSaved()
Check if file has to be saved in case of modifications.
void PrintText()
Open the print dialog and send current buffer to printer.
void Search(Bool_t again)
Invokes search dialog, or just search previous string if again is true.
void Goto()
Invokes goto dialog, and go to the specified line.
void CompileMacro()
Save the edited text in a temporary macro, then compile it.
void ExecuteMacro()
Save the edited text in a temporary macro, execute it, and then delete
the temporary file.
Author: Bertrand Bellenot 20/06/06
Last update: root/gui:$Name: $:$Id: TGTextEditor.cxx,v 1.5 2006/07/11 09:05:01 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.