ViewerManager Class Reference

Before directly using any of the classes in this file, you should consider reading doc/text_windows. More...

#include <viewermanager.h>

Collaboration diagram for ViewerManager:
Collaboration graph
[legend]

List of all members.

Classes

struct  FileLocation
 < The name of a file and a line number within it. More...

Public Types

typedef std::pair< application,
std::string > 
appentry
 An entry in the applications table.
typedef Viewer *(* application )(ViewerManager *vm, std::string &fullname)
 An application is a pointer to a function that returns a Viewer*. It is also called the 'application hook function'.
typedef std::list< FileLocationFileLocations
typedef CursorWindow::input_event input_event
 key or mouse button info
enum  master_commands {
  vertical_split,
  horizontal_split,
  unsplit,
  next,
  selector,
  die,
  die_and_jump,
  new_application,
  new_viewer,
  new_editor,
  display_help,
  interactive_shell,
  last_command
}
 

commands interpreted by the ViewerManager

More...
typedef Sequence_Map< int, int > master_key_map
 type of map of key sequences intercepted by the run command and not sent to the active window
typedef viewport::repaint_handler repaint_handler
 Base class ov Viewers.
typedef CursorWindow::row_col row_col
 typename alias
typedef CursorWindow::viewport viewport
 a very temporary handle to a screen region (at least as used by the viewer manager.
typedef std::auto_ptr< viewportvp_handle
 typename alias
typedef std::pair< Viewer
*, std::string > 
vpentry
 Entry in the viewers_ table.

Public Member Functions

bool activate (Viewer *v)
 Make the specified viewer visible. If it already is, then activate that viewport. If not, replace the current viewport with a viewport containing the named viewer. If you can't find the specified viewer, return an true. Otherwise, return false.
std::string active_directory () const
 Get the directory part, including the trailing /, of the name of the current viewer (active_viewer()).
Vieweractive_viewer ()
viewportactive_viewport ()
 Get the currently active viewport in case someone wants to screw around with the cursor position and then restore it without calling the activate method to repaint the whole window.
void add (Viewer *, std::string fullname)
 Replace the current viewport's viewer with this new one. Or create the first one if it isn't. Note that the current viewer is unaffected by this call -- only the binding to the viewport is lost. Note that if the viewer* is alread in the viewers_ list, the fullname will be ignored in favor of the extant name.
void add_app (application a, std::string const &s)
 Add an application to this viewermanager.
void add_editor_app (application, std::string filename_extension)
 Same as add_viewer_app except that it adds an editor application.
void add_viewer_app (application, std::string filename_extension)
 Specify which applications handle which file name extensions. This list is searched in reverse order (LIFO). Thus you can superseed the previous specifications. If the open method cannot find a match in the list created by calls to set_viewer_app, it will use the very first one specified (ie the first element in the list. If no element exists, you will get a null value from open().
void close ()
 Close the cursor window. This happens automatically in the destructor.
CppTagDB::Infodefault_cpptags_db ()
 Return a pointer to a new'ed up CppTagDb database read from the default location.
EtagsDBdefault_etags_db ()
 Return a pointer to a new'ed up etags database read from the default location.
Vieweredit (std::string const &fullname)
 Same as open(name) except that it edits instead of just viewing. Note that a viewer may also edit, but and editor explicitly edits as opposed to safely viewing the file.
void exit ()
 Close the window and terminate the program.
FileName find_file_in_standard_locations (FileName const &fragment, FileName const &directory)
 Search for a specified file (assuming it is not an absolute path) in the set of standard directories. This set include:
int find_files (std::string operand, std::list< std::string > *result)
 This function finds files in a list of standard locations independently of any viewers that might be showing any of those files. It strictly access the file system and etags database if any.
Viewerfind_viewer (std::string const &viewername)
 Search the vector of viewers in creation order to find the viewer whose name is provided. If you can't find it, return 0, otherwise, return its pointer. You can then use activate() to make it the active viewer.
std::string find_viewer_name (Viewer *vp)
 Given a viewer pointer, find the viewer name.
size_t find_viewport_index (std::string const &viewername)
void findMatchingViewers (FileName namePattern, std::list< std::pair< Viewer *, FileName > > &viewers)
 Search the list of viewers and return those that match the specified pattern.
void handle_die_request ()
 Check to see if there are any unsaved edit changes. If so, print an error and return. If not, exit(). This function is called when the user presses the 'die' key sequence.
void help ()
 Present the user with help information specific to the currently active viewer.
void help_helper (std::list< std::string > &help_text)
 This function can be called by viewer's help() methods to actually popup the help viewer. All you have to do is make a std::list<std::string> containing the text to be displayed then call ViewerManager::help_helper(list).
void hsplit (Viewer *, std::string fullname)
 Split the current viewport horizontally and give space to a new viewer. If the viewer* is already in the viewers_ list, the fullname will be ignored in favor of the extant viewer's name.
bool is_visible (Viewer *v)
 Return true if the specified viewer is displayed in a viewport that is currently visible. This envolves a search of all vieweports.
Viewermost_recent_viewer ()
 Return a pointer to the most recently activated viewer. Most of the time this means the currently active viewer. However, when this function is called after a viewer closes, then the call gives you "previous" most recently activated viewer so that you reactivate it and make the user happy.
Vieweropen (std::string const &fullname)
 Return a viewer opening the specified filename -- which should be the fullname of the target file. This does not add the viewer to the displayed viewers nor does it it put it in the list of managed viewers. You must call add(), vsplit(), or hsplit(), on your own. The viewer returned will be one defined by the type of the named file (directory or not), and by the viewer associated with the file name extension in the list. The default directory viewer application is specified using ViewerManager::set_directory_app(). To specify which applications open which file name extensions, make calls to add_viewer_app().
void open ()
 Open the cursor window for drawing. You must do this before you create any viewers or viewports. This does not occur automatically.
bool popFileLocation (FileLocation &output)
void popup_new_viewer (bool edit=false)
 Prompt the user for the name of a file or directory, starting in the directory where the currently active viewer is situated. If the user doesn't abort, use the 'open(name)' method to find a viewer for the file the user has selected. If the parameter, edit is set to true then edit(name) will be used instead of open(name) to define the viewer activated.
void run ()
 Prompt the user for input until all windows close.
void set_directory_app (application)
 Specify which application handles directory browsing. If you don't call this routine, the open() function won't be able to open directories for you.
template<class Container >
void setFileLocations (Container const &c)
void splitscreen_new_editor (bool horizontal=false)
 Prompt the user for the name of a file or directory, starting in the directory where the currently active viewer is situated. If the user doesn't abort, use the 'edit(name)' method to find a viewer for the file the user has selected. Split the current window vertically, or horizontally if the horizontal flag is specified and show the editor in the newly created split.
void unify ()
 Eliminate all viewports but a single full screen viewport holding the currently active viewer. This collapses viewports but does not close the viewers.
 ViewerManager ()
 Hmm! A constructor, what'll they thank of next.
void vs ()
 Replace the current viewer with the viewport selector viewer. It will let the user choose another viewer to store in the current viewport.
void vsplit (Viewer *, std::string fullname)
 Split the current viewport vertically and give space to a new viewer. If the viewer* is already in the viewers_ list, the fullname will be ignored in favor of the extant viewer's name.
CursorWindowwindow ()
 ~ViewerManager ()
 Aww! A destructor. Bad ole' puddy tats use destructors.

Static Public Member Functions

static std::string default_etags_path (std::string &pathlist, char const *file="TAGS")
 Get the full pathname of the TAGS file -- if any. Also return the colon separated list of directories searched by the function The pathlist will contain $ETAGSPATH, $HOME, and $CDPATH.

Public Attributes

std::string executable_name_
 The name of the main program that is currently in use. This variable must be set by the program that initially creates the viewer, or the value will be null.
std::string executable_version_
 The executable_version_ is a string set by the application that creates the viewer manager as a hint to be used to identify the version of the executable. The executable version is made visible to the user when the help command is executed -- assuming that help_helper() is invoked.
master_key_map master_keys_
 Key sequences absorbed by the viewer manager that are not passed through. Sequences of keys get mapped into one of the master_commands below.
Viewer::paste_buffer_type paste_buffer_
 When viewers copy lines into the "paste buffer", this is where they go.

Static Public Attributes

static int active_mark_att = CursorWindow::reverse_ul
 highlighted (selected) and marked lines
static int active_title_att = CursorWindow::reverse_bold
 window title bar color
static int bottom_att = CursorWindow::underlined
 bottom line of window highlights
static int highlighted_att = CursorWindow::reversed
 highlighted (selected) but not marked
static int inactive_mark_att = CursorWindow::bold
 marked but not highlighted (not selected)
static int inactive_title_att = CursorWindow::underlined
 window title bar color
static std::list< std::string > key_bindings_doc
 public so it can be used by help generators.
static int normal_att = CursorWindow::normal
 normal text color

Private Types

typedef std::pair< application,
std::string > 
opener_map_entry
 entries in the table used by open()

Private Member Functions

void dispatch_event (input_event const &e)
void handle_master_command (int cmd)
 Give event to active viewport.
void recordExitDir () const
 Called just before exiting the application to write the active_directory() to ~/.tools_home/exitDir.txt.
void setup_key_bindings ()
 Initialize master_keys_ map.

Private Attributes

size_t active_viewport_
 index in viewports_ to active viewport You can get the viewer from the the viewport using get_repaint_handler().
std::vector< appentryapps_
 list of available applications (ie viewer types)
CursorWindow cw_
 the CursorWindow assocated with this viewer
application dir_opener_
 application handling directories.
std::list< opener_map_entryeditors_
 list of applications which can be used to edit files with various extensions.
std::string exit_dir_
 If not empty, its the dir at the time of an force exit key.
FileLocations fileLocations_
 Places in various files saved for later revisiting.
std::list< opener_map_entryopeners_
 list of applications which can be used to open files with various extensions.
MRU< std::string > order_
 The order in which viewers have been activated.
size_t override_active_viewport_
 only used occasionally to override cur active_viewport_ member. mostly a kludge
std::string tool_dir_
 ~/.tools_home
std::vector< vpentryviewers_
 Active viewers. See the commentary with respect to the relationship between active viewports and active viewers under ViewportManager::viewports_. Note that viewers are "owned" by the viewer manager. When one is removed from this list, it is deleted as well.
std::vector< viewport * > viewports_
 The list of active viewports. Note that while a viewport points to a viewer, there is no one to one mapping between them.
std::auto_ptr< Viewervs_
 special Viewer selector viewer (recursive ain't it)

Friends

class appChooser
 lets you create a new viewer with an app in it
class ViewerSelector
 lets you select and activate a viewer

Detailed Description

Before directly using any of the classes in this file, you should consider reading doc/text_windows.

Note! when debugging programs using viewers, you must start the program first then attach to it using the debugger's 'attach processid' feature (or dbx -debug pdi feature). To debug the startup code, before the first keyboard input wait, set the environment variable, WAIT_FOR_DEBUGGER=1 before running the program. When the debugger attaches to the running process, you will be in a wait loop. Use the debugger's print mechanism or the assign mechanism to change the stop variable to 0. Then you can continue debugging as normal.

This class is a container for a collection of CursorWindow::viewports plus a collection of Viewers. The ViewerManager associates viewers with viewports as needed to make them visible. The ViewerManager controls the visibility and placement of the Viewer's within the outer Xterm or windows console window. Viewers fit into tiled windowing regions -- with popup style windows (CursorWindow::Dialog) appearing in the center.

The ViewerManager maintains control of the active viewport and filters all user input -- deciding which events belong to itself and which belong to the currently active viewport. When you open a ViewerManager, you are also opening a CursorWindow but it is hidden from view because the ViewerManager asserts control of resizes, input, viewport management, etc. You can get a pointer to this window if you need it.

Every Viewer controlled by a ViewerManager has a name. The names are std::strings -- they don't have to be unique. If the viewers are associated with files, the name should be the fully qualified file name. A special kind of viewer is provided by the ViewerManager. It allows the user to select a desired viewer from the list of all active viewers -- it then associates that viewer with a viewport. To use a ViewerManager, you create it, then use add(), vsplit(), or hsplit(), to insert viewers. To insert a viewer, create the viewer, then call one of the aforementioned functions. The viewer manager will delete the viewer as it sees fit. Also, you must call the open() method to open the window before creating any viewers or viewports. To 'run' the viewers, execute the member function 'run()'. When run completes, it means that all viewers are in a state that is safe for the ViewerManager to be destroyed -- that doesn't mean the window is closed -- you have to do that yourself -- or let the destructor do it.

To aid in the creation of viewers whose type can be determined by the file name extension or the stat information for the file, the ViewerManager provides a method, open(std::string filename), which determines what kind of viewer you need to use on this filename. There are no default behaviours. To use this version of the open method, see the instructions below for the open() method, set_directory_app(), and add_viewer_app().

Note that a given viewer pointer can only be inserted into the viewport manager once -- you can't stick the same thing in several times. However, the same viewer may appear in several viewports. As mentioned earlier, you can have multiple Viewers with the same name -- just not the same address. (NO YOU CAN'T! I never implemented THIS!)

The ViewerManager provides a mechanism for displaying help associated with viewers. The viewer class must provide a hook function that generates a list of help text strings. The ViewerManager knows about the help function key bindings and does all the work of calling the help hook function and displaying the text.

The ViewerManager also maintains the 'paste buffer'. That is, when user's cut or copy a block of selected lines using editor functions, rather than using the mouse and xterm mechanism, the text goes into the paste_buffer_ of the viewer manager.

Please

See also:
text_windows for more details of use.

In addition to being a container of viewports, the ViewerManager class also provides methods that help viewports communicate with one another and share common code. For example:

Definition at line 71 of file viewermanager.h.


Member Typedef Documentation

typedef std::pair<application,std::string> appentry

An entry in the applications table.

Definition at line 209 of file viewermanager.h.

typedef Viewer*(* application)(ViewerManager *vm, std::string &fullname)

An application is a pointer to a function that returns a Viewer*. It is also called the 'application hook function'.

It must be declared like this:

Viewer* your_application(ViewerManager* w, std::string &fullname);

It must not be a class member -- unless it is static.

The application may prompt the user with dialogs or it may simply return a Viewer*. It may also return 0 to indicate that the user aborted any input prompts required by the application in order to create the viewer.

The parameter fullname could be a file name, program invocation parms, etc. If it is an empty string, the application should prompt the user for a proper name. If it is not empty, the application may choose, if so desired, to produce error prompts. If fullname is not empty, the application should NOT prompt.

If the ViewerManager supplies a non-empty fullname, it will be the full pathname of the target file.

Definition at line 183 of file viewermanager.h.

typedef std::list<FileLocation> FileLocations

Definition at line 235 of file viewermanager.h.

key or mouse button info

Definition at line 177 of file viewermanager.h.

typedef Sequence_Map<int,int> master_key_map

type of map of key sequences intercepted by the run command and not sent to the active window

Definition at line 444 of file viewermanager.h.

typedef std::pair<application, std::string> opener_map_entry [private]

entries in the table used by open()

Definition at line 280 of file viewermanager.h.

Base class ov Viewers.

Definition at line 181 of file viewermanager.h.

typename alias

Definition at line 179 of file viewermanager.h.

a very temporary handle to a screen region (at least as used by the viewer manager.

Definition at line 173 of file viewermanager.h.

typedef std::auto_ptr<viewport> vp_handle

typename alias

Definition at line 178 of file viewermanager.h.

typedef std::pair<Viewer*,std::string> vpentry

Entry in the viewers_ table.

Definition at line 180 of file viewermanager.h.


Member Enumeration Documentation

commands interpreted by the ViewerManager

Enumerator:
vertical_split 

not sent to the active viewer.

split active window in 1/2 vertically

horizontal_split 

split active window in 1/2 horizontally

unsplit 

hide all but the active window and maximize it

next 

move to the next active viewport

selector 

popup the viewer selector menu

die 

attempt to close all windows and exit

die_and_jump 

same as die but save current dir in ~/.tools_home for bash edit() alias to use in cd'ing to the current directory after the editor terminates

new_application 

pop up the application selector

new_viewer 

open a new _viewer_ over current viewport

new_editor 

open a new _editor_ over current viewport

display_help 

pop up a help viewer describing the active viewer's application

interactive_shell 

goto an interactive command shell. (user must use exit to get rid of it)

last_command 

Definition at line 423 of file viewermanager.h.


Constructor & Destructor Documentation

ViewerManager (  ) 

Hmm! A constructor, what'll they thank of next.

Definition at line 142 of file viewermanager.cxx.

Here is the call graph for this function:

~ViewerManager (  ) 

Aww! A destructor. Bad ole' puddy tats use destructors.

Definition at line 164 of file viewermanager.cxx.


Member Function Documentation

bool activate ( Viewer v  ) 

Make the specified viewer visible. If it already is, then activate that viewport. If not, replace the current viewport with a viewport containing the named viewer. If you can't find the specified viewer, return an true. Otherwise, return false.

Definition at line 285 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

string active_directory (  )  const

Get the directory part, including the trailing /, of the name of the current viewer (active_viewer()).

Note that this data is only as good as was specified at the time the viewer was 'add'ed.

Definition at line 2306 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Viewer* active_viewer (  ) 

Definition at line 454 of file viewermanager.h.

Here is the caller graph for this function:

viewport* active_viewport (  ) 

Get the currently active viewport in case someone wants to screw around with the cursor position and then restore it without calling the activate method to repaint the whole window.

Definition at line 467 of file viewermanager.h.

Here is the caller graph for this function:

void add ( Viewer v,
std::string  fullname 
)

Replace the current viewport's viewer with this new one. Or create the first one if it isn't. Note that the current viewer is unaffected by this call -- only the binding to the viewport is lost. Note that if the viewer* is alread in the viewers_ list, the fullname will be ignored in favor of the extant name.

Definition at line 248 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void add_app ( application  a,
std::string const &  s 
)

Add an application to this viewermanager.

Definition at line 366 of file viewermanager.h.

Here is the caller graph for this function:

void add_editor_app ( application  a,
std::string  filename_extension 
)

Same as add_viewer_app except that it adds an editor application.

Definition at line 2201 of file viewermanager.cxx.

Here is the caller graph for this function:

void add_viewer_app ( application  a,
std::string  filename_extension 
)

Specify which applications handle which file name extensions. This list is searched in reverse order (LIFO). Thus you can superseed the previous specifications. If the open method cannot find a match in the list created by calls to set_viewer_app, it will use the very first one specified (ie the first element in the list. If no element exists, you will get a null value from open().

Definition at line 2194 of file viewermanager.cxx.

Here is the caller graph for this function:

void close (  ) 

Close the cursor window. This happens automatically in the destructor.

Definition at line 208 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

CppTagDB::Info * default_cpptags_db (  ) 

Return a pointer to a new'ed up CppTagDb database read from the default location.

If people need one, allocate them a CppTagDB::Info object -- don't alloc if not needed.

Warning:
You must delete this when you are done with it.

Definition at line 2739 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

EtagsDB * default_etags_db (  ) 

Return a pointer to a new'ed up etags database read from the default location.

If people need one, allocate them an etags db -- don't alloc if not needed.

Warning:
You must delete this when you are done with it.

Definition at line 2683 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

string default_etags_path ( std::string &  pathlist,
char const *  file = "TAGS" 
) [static]

Get the full pathname of the TAGS file -- if any. Also return the colon separated list of directories searched by the function The pathlist will contain $ETAGSPATH, $HOME, and $CDPATH.

Definition at line 2649 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void dispatch_event ( ViewerManager::input_event const &  event  )  [private]

Definition at line 515 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Viewer * edit ( std::string const &  fullname  ) 

Same as open(name) except that it edits instead of just viewing. Note that a viewer may also edit, but and editor explicitly edits as opposed to safely viewing the file.

Note that this creates a new viewer. If you want to activate an existing viewer -- which is often the case -- you will want to use 'find_viewer(fullname)' to find it. Then use activate(viewer) to make the the active_viewer().

Definition at line 2208 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void exit (  ) 

Close the window and terminate the program.

Definition at line 236 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

FileName find_file_in_standard_locations ( FileName const &  fragment,
FileName const &  directory 
)

Search for a specified file (assuming it is not an absolute path) in the set of standard directories. This set include:

A full directory pathname passed in (including trailing /).

The SOURCEPATH directory list

All directories mentioned in file TAGPP.tagpp (if any).

Directories mentioned in TAGS (the etags database -- if any).

Note that the "current" directory is explicitly NOT in the search location set unless you pass it in as "directory".

Parameters:
[in] fragment The file name extracted from a log file, or whatever that maybe relative to a different directory than the current directory.
[in] directory The name of the directory that should be treated as the "current directory" for opening the file -- it may not be the real current directory.

Definition at line 2891 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

int find_files ( std::string  operand,
std::list< std::string > *  result 
)

This function finds files in a list of standard locations independently of any viewers that might be showing any of those files. It strictly access the file system and etags database if any.

Parameters:
operand A file name fragment (base name or non-fully qualified relative path reference).
result A list of matching files. See below.
Returns:
The count of matching files.

It searches for a specified file (operand) in the "standard" locations and return the full[er] name of the file. That is, given a file name specified as a simple file basename or relative path, search for any file that matches that and return a list thereof. Return a count of said matches. The "standard" locations are defined as follows:

If operand is a fully qualified pathname, return only it.

If the operand is an empty string, return all the files in the etags database file.

If the operand is path fragment, search for all matches in the the following locations:

  • current directory
  • $SOURCEPATH
  • $CDPATH
  • TAGS list of files (ie etags generated file list)

When generating the etags database, it is desireable to specify the fully qualified pathnames on the etags command line otherwise the returned filenames are likely to be unusuable.

Note that the output list of strings is not cleared by this function call -- it appends new filenames to the resultant list and returns the count of the strings appended.

Definition at line 2801 of file viewermanager.cxx.

Here is the call graph for this function:

Viewer * find_viewer ( std::string const &  viewername  ) 

Search the vector of viewers in creation order to find the viewer whose name is provided. If you can't find it, return 0, otherwise, return its pointer. You can then use activate() to make it the active viewer.

Definition at line 1981 of file viewermanager.cxx.

Here is the caller graph for this function:

std::string find_viewer_name ( Viewer vp  ) 

Given a viewer pointer, find the viewer name.

Definition at line 1996 of file viewermanager.cxx.

Here is the caller graph for this function:

size_t find_viewport_index ( std::string const &  viewername  ) 
Returns:
the index into the viewports_ table for the specified viewer.

Search the viewers_ table then map that to the the viewports_ table.

void findMatchingViewers ( FileName  namePattern,
std::list< std::pair< Viewer *, FileName > > &  viewers 
)

Search the list of viewers and return those that match the specified pattern.

Parameters:
[in] namePattern The full pathname of the file of interest or a *.cpp style pathname pattern.
[out] viewers Pointers to the viewers that match the pattern.
Warning:
: do not store the viewers returned by this function since they can be deleted at any time after the caller returns.

Definition at line 3072 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_die_request (  ) 

Check to see if there are any unsaved edit changes. If so, print an error and return. If not, exit(). This function is called when the user presses the 'die' key sequence.

Definition at line 2581 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_master_command ( int  cmd  )  [private]

Give event to active viewport.

Interpret commands in the ViewerManager::master_commands list

Definition at line 810 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void help (  ) 

Present the user with help information specific to the currently active viewer.

Definition at line 2010 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void help_helper ( std::list< std::string > &  help_text  ) 

This function can be called by viewer's help() methods to actually popup the help viewer. All you have to do is make a std::list<std::string> containing the text to be displayed then call ViewerManager::help_helper(list).

Definition at line 2022 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void hsplit ( Viewer v,
std::string  fullname 
)

Split the current viewport horizontally and give space to a new viewer. If the viewer* is already in the viewers_ list, the fullname will be ignored in favor of the extant viewer's name.

Definition at line 444 of file viewermanager.cxx.

Here is the caller graph for this function:

bool is_visible ( Viewer v  ) 

Return true if the specified viewer is displayed in a viewport that is currently visible. This envolves a search of all vieweports.

Definition at line 2428 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Viewer * most_recent_viewer (  ) 

Return a pointer to the most recently activated viewer. Most of the time this means the currently active viewer. However, when this function is called after a viewer closes, then the call gives you "previous" most recently activated viewer so that you reactivate it and make the user happy.

Returns:
null or a pointer to a viewer. Null is only returned when there are no viewers.

Definition at line 3087 of file viewermanager.cxx.

Here is the call graph for this function:

Viewer * open ( std::string const &  fullname  ) 

Return a viewer opening the specified filename -- which should be the fullname of the target file. This does not add the viewer to the displayed viewers nor does it it put it in the list of managed viewers. You must call add(), vsplit(), or hsplit(), on your own. The viewer returned will be one defined by the type of the named file (directory or not), and by the viewer associated with the file name extension in the list. The default directory viewer application is specified using ViewerManager::set_directory_app(). To specify which applications open which file name extensions, make calls to add_viewer_app().

Note, if the basename part of the specified name contains '*' or '?', it will be assumed that this is a directory search -- ie a directory open, not some other kind. So, '/dir/*.c' is an attempt to open directory /dir, but restrict the display to the '*.c' files.

Note that this creates a new viewer. If you want to activate an existing viewer -- which is often the case -- you will want to use 'find_viewer(fullname)' to find it. Then use activate(viewer) to make the the active_viewer().

Definition at line 2110 of file viewermanager.cxx.

Here is the call graph for this function:

void open (  ) 

Open the cursor window for drawing. You must do this before you create any viewers or viewports. This does not occur automatically.

Definition at line 195 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

bool popFileLocation ( FileLocation output  ) 

Definition at line 341 of file viewermanager.h.

Here is the caller graph for this function:

void popup_new_viewer ( bool  edit = false  ) 

Prompt the user for the name of a file or directory, starting in the directory where the currently active viewer is situated. If the user doesn't abort, use the 'open(name)' method to find a viewer for the file the user has selected. If the parameter, edit is set to true then edit(name) will be used instead of open(name) to define the viewer activated.

Definition at line 2351 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void recordExitDir (  )  const [private]

Called just before exiting the application to write the active_directory() to ~/.tools_home/exitDir.txt.

Definition at line 222 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void run (  ) 

Prompt the user for input until all windows close.

Definition at line 971 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void set_directory_app ( application  a  ) 

Specify which application handles directory browsing. If you don't call this routine, the open() function won't be able to open directories for you.

Definition at line 2187 of file viewermanager.cxx.

Here is the caller graph for this function:

void setFileLocations ( Container const &  c  ) 

Definition at line 353 of file viewermanager.h.

Here is the caller graph for this function:

void setup_key_bindings (  )  [private]

Initialize master_keys_ map.

Definition at line 646 of file viewermanager.cxx.

Here is the caller graph for this function:

void splitscreen_new_editor ( bool  horizontal = false  ) 

Prompt the user for the name of a file or directory, starting in the directory where the currently active viewer is situated. If the user doesn't abort, use the 'edit(name)' method to find a viewer for the file the user has selected. Split the current window vertically, or horizontally if the horizontal flag is specified and show the editor in the newly created split.

Definition at line 2459 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void unify (  ) 

Eliminate all viewports but a single full screen viewport holding the currently active viewer. This collapses viewports but does not close the viewers.

Definition at line 1106 of file viewermanager.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void vs (  ) 

Replace the current viewer with the viewport selector viewer. It will let the user choose another viewer to store in the current viewport.

Definition at line 1134 of file viewermanager.cxx.

Here is the caller graph for this function:

void vsplit ( Viewer v,
std::string  fullname 
)

Split the current viewport vertically and give space to a new viewer. If the viewer* is already in the viewers_ list, the fullname will be ignored in favor of the extant viewer's name.

Definition at line 373 of file viewermanager.cxx.

Here is the caller graph for this function:

CursorWindow* window (  ) 

Definition at line 213 of file viewermanager.h.

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class appChooser [friend]

lets you create a new viewer with an app in it

Definition at line 170 of file viewermanager.h.

friend class ViewerSelector [friend]

lets you select and activate a viewer

Definition at line 169 of file viewermanager.h.


Member Data Documentation

int active_mark_att = CursorWindow::reverse_ul [static]

highlighted (selected) and marked lines

Definition at line 160 of file viewermanager.h.

int active_title_att = CursorWindow::reverse_bold [static]

window title bar color

Definition at line 158 of file viewermanager.h.

size_t active_viewport_ [private]

index in viewports_ to active viewport You can get the viewer from the the viewport using get_repaint_handler().

Definition at line 261 of file viewermanager.h.

std::vector<appentry> apps_ [private]

list of available applications (ie viewer types)

Definition at line 275 of file viewermanager.h.

int bottom_att = CursorWindow::underlined [static]

bottom line of window highlights

Definition at line 162 of file viewermanager.h.

CursorWindow cw_ [private]

the CursorWindow assocated with this viewer

Definition at line 243 of file viewermanager.h.

application handling directories.

Definition at line 289 of file viewermanager.h.

std::list<opener_map_entry> editors_ [private]

list of applications which can be used to edit files with various extensions.

Definition at line 285 of file viewermanager.h.

std::string executable_name_

The name of the main program that is currently in use. This variable must be set by the program that initially creates the viewer, or the value will be null.

Definition at line 615 of file viewermanager.h.

std::string executable_version_

The executable_version_ is a string set by the application that creates the viewer manager as a hint to be used to identify the version of the executable. The executable version is made visible to the user when the help command is executed -- assuming that help_helper() is invoked.

Definition at line 608 of file viewermanager.h.

std::string exit_dir_ [private]

If not empty, its the dir at the time of an force exit key.

Definition at line 291 of file viewermanager.h.

Places in various files saved for later revisiting.

Definition at line 297 of file viewermanager.h.

int highlighted_att = CursorWindow::reversed [static]

highlighted (selected) but not marked

Definition at line 163 of file viewermanager.h.

int inactive_mark_att = CursorWindow::bold [static]

marked but not highlighted (not selected)

Definition at line 161 of file viewermanager.h.

int inactive_title_att = CursorWindow::underlined [static]

window title bar color

Definition at line 159 of file viewermanager.h.

list< string > key_bindings_doc [static]

public so it can be used by help generators.

Definition at line 165 of file viewermanager.h.

Key sequences absorbed by the viewer manager that are not passed through. Sequences of keys get mapped into one of the master_commands below.

Definition at line 449 of file viewermanager.h.

int normal_att = CursorWindow::normal [static]

normal text color

Definition at line 157 of file viewermanager.h.

std::list<opener_map_entry> openers_ [private]

list of applications which can be used to open files with various extensions.

Definition at line 282 of file viewermanager.h.

MRU<std::string> order_ [private]

The order in which viewers have been activated.

Definition at line 258 of file viewermanager.h.

size_t override_active_viewport_ [private]

only used occasionally to override cur active_viewport_ member. mostly a kludge

Definition at line 277 of file viewermanager.h.

When viewers copy lines into the "paste buffer", this is where they go.

Definition at line 572 of file viewermanager.h.

std::string tool_dir_ [private]

~/.tools_home

Definition at line 241 of file viewermanager.h.

std::vector<vpentry> viewers_ [private]

Active viewers. See the commentary with respect to the relationship between active viewports and active viewers under ViewportManager::viewports_. Note that viewers are "owned" by the viewer manager. When one is removed from this list, it is deleted as well.

Definition at line 250 of file viewermanager.h.

std::vector<viewport*> viewports_ [private]

The list of active viewports. Note that while a viewport points to a viewer, there is no one to one mapping between them.

Definition at line 245 of file viewermanager.h.

std::auto_ptr<Viewer> vs_ [private]

special Viewer selector viewer (recursive ain't it)

Definition at line 273 of file viewermanager.h.


The documentation for this class was generated from the following files:
Generated on Wed Feb 29 22:58:16 2012 for CXXUtilities by  doxygen 1.6.3