NAME Workspace.pm -- Persistent, multi-purpose text processor. (File browser, shell, editor) script. Requires Perl/Tk. SYNOPSIS # Create a workspace from the shell prompt: #mkws "workspace" # Open an existing workspace from the shell prompt: #./workspace & # Open from a Perl script: use Tk; use Tk::Workspace; Tk::Workspace::open(Tk::Workspace::create("workspace")); # Create workspace object: $w = Tk::Workspace -> new( textfont => "*-courier-medium-r-*-*-12-*", foreground => 'white', background => 'black', scroll => 'se', height => 351, width => 565, x => 100, y => 100, insertionpoint => '1.0', menubarvisible => 'True', text => 'Text to be inserted' ); DESCRIPTION Workspace uses the Tk::TextUndo widget to create an embedded Perl text editor. The resulting file can be run as a standalone program. COMMAND LINE OPTIONS A Workspace recognizes the same command line options as its parent Tk::MainWindow. Refer to the Tk::CmdLine manual page for a list of the options and their function. The command line options and the workspace parameters generally complement each other. The command line color and font options act on the widget colors; e.g., menus and dialogs, while the embedded values specify colors and fonts for editable text. The most notable exception to a standard command-line option is -geometry, where a Workspace will use its persistent geometry (that is, the default geometry when last saved), instead of a command line geometry specification. MENU FUNCTIONS A workspace contains a menu bar with File, Edit, Options, and Help menus. The menus also pop up by pressing the right mouse button (Button-3) over the text area, whether the menu bar is visible or not. The menu functions are provided by the Tk::Workspace, Tk::TextUndo, Tk::Text, and Tk::Widget modules. File Menu Import Text -- Insert the contents of a selected text file at the insertion point. Export Text -- Write the contents of the workspace to a text file. System Command -- Prompts for the name of a command to be executed by the shell, /bin/sh. The output is inserted into the workspace. For example, to insert a manual page into the workspace, enter: man | colcrt - | col -b Shell -- Starts an interactive shell. The prompt is the PS1 prompt of the environment where the workspace was started. At present the workspace shell recognizes only a subset of the bash prompt variables, and does not implement command history or setting of environment variables in the subshell. Due to I/O blocking, results can be unpredictable, especially if the called program causes an eof condition on STDERR. For details refer to the Tk::Shell POD documentation. Refer to the bash(1) manual page for further information. Typing 'exit' leaves the shell and returns the workspace to normal text editing mode. Save -- Save the workspace to disk. Quit -- Close the workspace window, optionally saving to disk. Edit Menu Undo -- Reverse the next previous change to the text. Cut -- Delete the selected text and place it on the X clipboard. Copy -- Copy the selected text to the X clipboard. Paste -- Insert text from the X clipboard at the insertion point. Evaluate Selection -- Interpret the selected text as Perl code. Find -- Search for specified text, and specify search options. Marks text for later replacement (see below). Find Next -- Find next match of search text. Previous -- Find previous match of search text. Replace -- Replace marked search text with text from the replacement entry. Goto Line -- Go to the line entered by the user. Which Line -- Report the line and column position of the insertion point. Options Menu Wrap -- Select how the text should wrap at the right margin. Scroll Bars -- Select from scroll bars at right or left, top or bottom of the text area. Show/Hide Menubar -- Toggle whether the menubar is visible. A popup version of the menus is always available by pressing the right mouse button (Button 3) over the text area. Color Editor -- Pops up a Color Editor window. You can select the text attribute that you want to change from the Colors -> Color Attributes menu. Pressing the Apply... button at the bottom of the Color Editor applies the color selection to the text. The most useful attributes for Workspace text are foreground, background, and insertBackground. Text Font -- Select text font from list of system fonts. Help Menu About -- Report name of workspace and modification time, and version of Workspace.pm library. Help -- Display the Workspace.pm POD documentation in a text window formatted by pod2text. KEY BINDINGS For further information, please refer to the Tk::Text and Tk::bind man pages. Alt-Q Quit, Optionally Saving Text Alt-S Save Workspace to Disk Alt-U Undo Alt-X Copy Selection to Clipboard and Delete Alt-C Copy Selection to Clipboard Alt-V Insert Clipboard Contents at Cursor Right, Ctrl-F Forward Character Left, Ctrl-B Backward Character Up, Ctrl-P Up One Line Down, Ctrl-N Down One Line Shift-Right Forward Character Extend Selection Shift-Left Backward Character Extend Selection Shift-Up Up One Line, Extend Selection Shift-Down Down One Line, Extend Selection Ctrl-Right, Meta-F Forward Word Ctrl-Left, Meta-B Backward Word Ctrl-Up Up One Paragraph Ctrl-Down Down One Paragraph PgUp Scroll View Up One Screen PgDn Scroll View Down One Screen Ctrl-PgUp Scroll View Right Ctrl-PgDn Scroll View Left Home, Ctrl-A Beginning of Line End, Ctrl-E End of Line Ctrl-Home, Meta-< Beginning of Text Ctrl-End, Meta-> End of Text Ctrl-/ Select All Ctrl-\ Clear Selection F16, Copy, Meta-W Copy Selection to Clipboard F20, Cut, Ctrl-W Copy Selection to Clipboard and Delete F18, Paste, Ctrl-Y Paste Clipboard Text at Insertion Point Delete, Ctrl-D Delete Character to Right, or Selection Backspace, Ctrl-H Delete Character to Left, or Selection Meta-D Delete Word to Right Meta-Backspace, Meta-Delete Delete Word to Left Ctrl-K Delete from Cursor to End of Line Ctrl-O Open a Blank Line Ctrl-X Clear Selection Ctrl-T Reverse Order of Characters on Either Side of the Cursor Mouse Button 1: Single Click: Set Insertion Cursor at Mouse Pointer Double Click: Select Word Under the Mouse Pointer and Position Cursor at the Beginning of the Word Triple Click: Select Line Under the Mouse Pointer and Position Cursor at the Beginning of the Line Drag: Define Selection from Insertion Cursor Shift-Drag: Extend Selection Double Click, Shift-Drag: Extend Selection by Whole Words Triple Click, Shift-Drag: Extend Selection by Whole Lines Ctrl: Position Insertion Cursor without Affecting Selection Mouse Button 2: Click: Copy Selection into Text at the Mouse Pointer Drag:Shift View Mouse Button 3: Pop Up Menu Bar Meta Escape METHODS There is no actual API specification, but Workspaces recognize the following instance methods: about, bind, close_dialog, create, editmenu, elementColor, evalselection, filemenu, filenotfound, fontdialogaccept, fontdialogapply, fontdialogclose, geometry, goto_line, height, helpmenu, insert_output, insertionpoint, ishell, libname, menubar, menubarvisible, menus, my_directory, name, new, open, optionsmenu, parent_ws, popupmenu, postpopupmenu, process_args, prompt, scroll, scrollbar, self_help, set_scroll, shell_client, shell_cmd, text, textfont, togglemenubar, what_line, width, window, wrap, write_to_disk, ws_copy, ws_cut, ws_export, ws_font, ws_import, ws_paste, ws_undo, x, y The following class methods are available: new, ScrollMenuItems, WrapMenuItems, workspaceobject. The 'new' constructor recognizes the settings of the following options, which are used by Workspace.pm : window, name, textfont, width, height, x, y, foreground, background, textfont, filemenu, editmenu, optionsmenu, wrapmenu, scrollmenu, modemenu, helpmenu, menubar, popupmenu, menubarvisible, scroll, scrollbuttons, insertionpoint, text CREDITS Tk::Workspace by rkiesling@mainmatter.com (Robert Kiesling) Perl/Tk by Nick Ing-Simmons. Tk::ColorEditor widget by Steven Lidie. Perl by Larry Wall and many others. REVISION $Id: Workspace.pm,v 1.50 2000/10/28 19:26:59 kiesling Exp kiesling $ SEE ALSO: Tk::overview(1), Tk::ColorEditor(1), perl(1) manual pages.