Viewer

Far Manager

Viewer

The Viewer function allows to invoke the FAR internal viewer.
int WINAPI Viewer (
  const char *FileName,
  const char *Title,
  int X1,
  int Y1,
  int X2,
  int Y2,
  DWORD Flags
);

Parameters

FileName
Name of the file to view.
Title
Text string that will be shown in the top line of the viewer window. If set to NULL, the file name will be used as the title.
X1, Y1, X2, Y2
Viewer window coordinates. If X2 or Y2 equals -1, they will be replaced with screen width or height. If X1 or Y1 is less than zero it is considered as zero.
Flags
Can be a combination of the following values (VIEWER_FLAGS enum):
FlagDesciption
VF_DELETEONCLOSE Instructs FAR to delete the viewed file after closing the viewer. If the directory containing the viewed file contains no other files, it will also be deleted. If only the file needs to be deleted use VF_DELETEONLYFILEONCLOSE. The file will not be deleted if the user pressed F6 to switch between viewing and editing, or if the same file is open in a different editor or viewer instance.
VF_DELETEONLYFILEONCLOSE Similar to VF_DELETEONCLOSE, but only the file will be deleted. This flag has a lower priority than VF_DELETEONCLOSE.
VF_DISABLEHISTORY Disables adding the file name to the viewer history (Alt-F11). By default, the file name is added to the history.
VF_ENABLE_F6 Enables switching from viewer to editor by pressing F6.
VF_IMMEDIATERETURN Allows the plugin to receive control immediately after the viewer is opened. The newly opened viewer becomes the active window. This flag makes sense only if combined with the VF_NONMODAL flag.
VF_NONMODAL Creates a non-modal viewer window. If this flag is present, the user will be able to switch to other FAR windows.

The plugin will regain control only after the viewer is closed, or after the user switches to a different window (by pressing Ctrl-Tab). If you need to regain control immediately after the viewer has been opened, use the VF_IMMEDIATERETURN flag.

Return value

If the VF_NONMODAL flag is not specified, the function returns TRUE if successful or FALSE if the file cannot be opened. If the flag is specified, the function always returns TRUE.
See also: