Tk-Workspace

 view release on metacpan or  search on metacpan

Workspace.pm  view on Meta::CPAN

     'bless($workspace,\'Tk::Workspace\');',
     '$workspace -> wrap( $wrap );',
     '$workspace -> geometry( $geometry, $insert );',
     '$workspace -> commandline;',
     'MainLoop;' );

my $defaultbackgroundcolor="white";
my $defaultforegroundcolor="black";
my $defaulttextfont="*-courier-medium-r-*-*-12-*";
my $menufont="*-helvetica-medium-r-*-*-12-*";
my $clipboard;          # Internal clipboard.

sub new {
    my $proto = shift;
    my $class = ref( $proto ) || $proto;
    my @construct_args = @_;
    my @cmd_args = &custom_args( @ARGV );
    my $self = {
	window => new MainWindow,
	name => 'workspace',
	textfont => undef,

Workspace.pm  view on Meta::CPAN

	$self -> {text} -> toplevel -> Pixmap(-file => $iconpath);
      $self -> {window} -> toplevel -> iconimage($icon);
    }
    &menus( $self );
    &set_scroll( $self );
    my $t = $self -> text;
    $t -> Subwidget('yscrollbar') -> configure(-width=>10);
    $t -> Subwidget('xscrollbar') -> configure(-width=>10);
    $t -> setFixedTabs ( 5 );
    $self -> window -> protocol( WM_TAKE_FOCUS, sub{ $self -> wmgeometry});
    # Prevents errors when trying to paste from an empty clipboard.
    $t -> clipboardAppend( '' );
    $self -> focusFollowsMouse;
    $self -> {encoding} = 'iso88591';
    $t -> focus;
    $t -> markGravity( 'insert', 'right' );
    return $self;
}

# Standard X11 toolkit arguments:
# Refer to the Tk::CmdLine manual page.
# one parameter each

Workspace.pm  view on Meta::CPAN

# locking up... until then, set perms to rwx for owner only.
chmod 0700, $workspacename;
utime time, time, ($workspacename);
return( $workspacename );
}

sub ws_copy {
    my $self = shift;
    my $selection;
    if ( ! (($self -> {text}) -> tagRanges('sel')) ) { return; }
    # per clipboard.txt, this asserts workspace text widget's
    # ownership of X display clipboard, and clears it.
    ($self -> {text}) -> clipboardClear;
    $selection = ($self -> {text})
	-> SelectionGet(-selection => 'PRIMARY',
			-type => 'STRING' );
    # Appends PRIMARY selection to X display clipboard.
    ($self -> {text}) -> clipboardAppend($selection);
    $clipboard = $selection;   # our  clipboard, not X's.
    return $selection;
}

sub ws_cut {
    my $self = shift;
    my $selection;
    if ( ! (($self -> {text}) -> tagRanges('sel')) ) { return; }
    # per clipboard.txt, this asserts workspace text widget's
    # ownership of X display clipboard, and clears it.
    ($self -> {text}) -> clipboardClear;
    $selection = ($self -> {text})
	-> SelectionGet(-selection => 'PRIMARY',
			-type => 'STRING' );
    # Appends PRIMARY selection to X display clipboard.
    ($self -> {text}) -> clipboardAppend($selection);
    ($self ->{text}) ->
	delete(($self -> {text}) -> tagRanges('sel'));
    $clipboard = $selection;   # our  clipboard, not X's.
    $self -> {text} -> {SubWidget}{workspacetext}{modified} = '1';
    return $selection;
}

sub ws_paste {
    my $self = shift;
    my $selection;
    my $point;
    # Don't use CLIPBOARD because of a bug? in PerlTk...
    #
    # Checks PRIMARY selection, then X display clipboard,
    # and returns if neither is defined.
#    ($self -> {text}) ->
#	selectionOwn(-selection => 'CLIPBOARD');
#    if ( ! (($self -> {text}) -> tagRanges('sel'))
#	 or (($selection =  ($self -> {text})
#	-> SelectionGet(-selection => 'PRIMARY',
#			-type => 'STRING')) == '') ) {
#	return;
#    }
#    if ($self -> {text} -> tagRanges('sel')) {
#	$selection = ($self -> {text})
#	    -> SelectionGet(-selection => 'PRIMARY',
#			    -type => 'STRING');
#    } else {
#	$selection = $clipboard;
#    }
    $selection = ($self -> {text}) -> clipboardGet;
    $point = ($self -> {text}) -> index("insert");
    ($self -> {text}) -> insert( $point,
				      $selection);
    ($self -> {text}) -> see( 'insert' );
    $self -> {text} -> {SubWidget}{workspacetext}{modified} = '1';
    return $selection;
}

sub ws_undo {
    my $self = shift;

Workspace.pm  view on Meta::CPAN


Quit -- Close the workspace window, optionally saving to disk.

Workspaces are saved with file mode permissions 0700 (read, write, and
execute for the owner of the file).

=head2 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.

Search & Replace -- Open a dialog box to enter search and/or replace
strings.  Users can select options for exact upper/lower case
matching, regular expression searches, forward or backward searches,
and no query on replace.  If "Replace without Asking" is selected,
then all search matches will be replaced.  The default is to prompt
before the replacement.  Replacements for regular expression matches
are not supported.

Workspace.txt  view on Meta::CPAN


    Quit -- Close the workspace window, optionally saving to disk.

    Workspaces are saved with file mode permissions 0700 (read, write, and
    execute for the owner of the file).

  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.

    Search & Replace -- Open a dialog box to enter search and/or replace
    strings. Users can select options for exact upper/lower case matching,
    regular expression searches, forward or backward searches, and no query
    on replace. If "Replace without Asking" is selected, then all search
    matches will be replaced. The default is to prompt before the
    replacement. Replacements for regular expression matches are not
    supported.

WorkspaceText.pm  view on Meta::CPAN

    $w -> SUPER::Delete;
    $w -> {modified} = '1';
}

sub Backspace {
 my ($w) = @_;
 $w -> SUPER::Backspace;
 $w -> {modified} = '1';
}

sub clipboardColumnCut {
 my ($w) = @_;
 $w-> Column_Copy_or_Cut(1);
 $w -> {modified} = '1';
}

sub clipboardColumnPaste {
 my ($w) = @_;
 $w -> SUPER::clipboardColumnPaste;
 $w -> {modified} = '1';
}

sub ClassInit {
 my ($class,$mw) = @_;
 $class->SUPER::ClassInit($mw);
 $Tk::prevPos = undef;
 $mw -> bind($class, '<Tab>', 'fixed_tabs');
 $mw -> bind($class, '<Alt-h>', 'selectPara');
 $mw -> bind($class, '<Alt-l>', 'paragraphFill');

eg/mwm_menu  view on Meta::CPAN

How to create a submenu of the mwm root menu that contains
the contents of a "workspaces" subdirectory. 

The "Workspaces" submenu is updated whenever:
  - You start mwm.
  - You select "Update This Menu" from the "Workspaces" sub menu 
    of the root menu, and then select "Restart..." from the root 
    menu.

The you can either copy  and paste the paste example scripts here using
the X clipboard, to files that reside in the ~/Scripts directory, or
use them to modify your existing files.  In these examples, the 
workspaces that are listed all reside in ~/workspaces directory. You
could create directories with these names, or substitute your own 
directory configuration in the examples below.

If you have CDE, substitute ~/.dt/C/dtwmrc for ~/.mwmrc, and, if
possible, create the new menu as ~/.dt/dtwmrc, following the 
instructions in ~/.dt/C/dtwmrc.




( run in 1.824 second using v1.01-cache-2.11-cpan-84e82930d8c )