Zim::GUI::PageView.3pm

Langue: en

Autres versions - même langue

Version: 2009-02-23 (debian - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Zim::GUI::PageView - Page TextView widgets

DESCRIPTION

This module contains the widgets to display an editable text buffer containing the current page. It includes a search entry at the bottom of the TextView, and autoformatting logic.

METHODS

Undefined methods are AUTOLOADED to the Gtk2::Ex::HyperTextView object.
"new(app =" PARENT)>
Simple constructor.

Actions

"ApplyFormat(FORMAT, BOOLEAN)"
Applies the property FORMAT to any selected text or toggles the edit mode.

BOOLEAN is used to force format (TRUE) or un-format (FALSE). If BOOLEAN is undefined the function acts as a toggle.

"Link(LINK, BOOLEAN)"
This method is called by the ``Link'' button or by the ^L keybinding. It makes any selected text a link or toggles the link property. This link is followed immediatly if the 'follow_new_link' config option is set.

If LINK is undefined the link target is the same as the selected text.

In readonly modus the selected text is regarded as a link and followed immediatly, but no actual link is made.

BOOLEAN is used to force link (TRUE) or unlink (FALSE). If BOOLEAN is undefined the function acts as a toggle.

"Undo()"
Undo one editing step in the buffer.
"Redo()"
Redo one editing step in the buffer.
"Delete()"
Delete from cursor.
"ToggleCheckbox(ITER, TYPE)"
"XToggleCheckbox(ITER)"
Same as ToggleCheckbox with type 'x'.
"EditObject(ITER)"
Dispatches to "EditLink()", "EditImage()" or a custom handler for special objects.

If no object is found and text is selected it calls "EditLink()"

"EditLink(ITER)"
Shows the ``Edit link'' dialog. ITER defaults to the current cursor position. Doesn't do anything if there is no link at ITER.
"EditImage(ITER)"
Shows the ``Edit Image'' dialog. ITER defaults to the current cursor position. Doesn't do anything if there is no image at ITER.
"Find(STRING)"
Shows the ``Find'' bar below the TextView. STRING is optional query string, which is executed.
"FindNext()"
Repeat previous find in forward direction.
"FindPrev()"
Repeat previous find in backward direction.
"CloseFind()"
Hides the ``Find'' bar.
"FindReplace(STRING)"
Show the ``Find and Replace'' dialog. STRING is the optional query string.
"InsertDate(DATE, NO_ASK)"
Inserts a date into the text. DATE is optional and should be an array ref to the fields as produced by "localtime()". By default the current date is used.

A dialog with formatting options is presented to the user unless NO_ASK is true.

"prompt_date_format(DATE)"
Used by "InsertDate()".
"InsertLink(LINK, TEXT, NO_ASK)"
Insert LINK or prompt the user for a link. LINK can be either a page, a file or a url, however the dialog only has page name completion. See "InsertExtLink" for an alternative interface.

NO_ASK is a boolean to suppress the prompt.

"InsertExtLink(LINK, TEXT, NO_ASK)"
Like "InsertLink()" but shows a dialog with a browse button instead of page name completion.
"InsertImage(PATH, NO_ASK)"
Inserts an image into the buffer. PATH is an optional path for the image. Unless NO_ASK is a dialog is presented which allows the user to set the path and other properties for the image. An error is raised when NO_ASK is set but no PATH is given.

If PATH is given and it is not absolute we assume it to be a relative path returned by e.g. "$page-"store_file()>.

"InsertFromFile(FILE, NO_ASK)"
Insert contents of FILE as verbatim.
"WordCount()"
Pop up a dialog showing word, line and char count.

Other Functions

"set_font(STRING)"
Set the default font for the pageview. Calling with "undef" as argument will reset to the default.
"get_state()"
Returns a HASH ref with properties that need to be saved in the history.
"set_state(\%PROPETIES)"
Set a number of properties that were saved in the history.
"load_page(PAGE)"
Load a new page in the page view widgets.
"load_page_contents(PAGE, TREE)"
To be overloaded by child classes, use "load_page()" from the GUI.

Load the contents of PAGE into the buffer. This method should die when an error is encountered.

TREE is an optional argument, child classes do not need to support it.

"modified()"
"modified(BOOLEAN)"
Get or set the modified bit. This bit is set when the buffer is modified by the user. It should be reset after succesfully saving the buffer content.
"save_page(PAGE)"
Save current buffer contents to PAGE.
"save_page_contents(PAGE)"
To be overloaded by child classes, use "save_page()" from the GUI.

This method saves the buffer contents to PAGE. Should return 1 on success or 0 when the buffer was empty. Returning 0 results in the page being deleted.

This method should die when an error is encountered.

"change_widget(WIDGET)"
Replaces the curren page view widget in the interface with WIDGET. Returns the old widget.
"parse_backspace(ITER)"
This method is called when the user types a backspace. It tries to update the formatting of the current line.

When TRUE is returned the widget does not receive the backspace.

"parse_line(ITER)"
This method is called when the user is about to insert a linebreak. It checks the line left of the cursor of any markup that needs updating. It also takes care of autoindenting.

When TRUE is returned the widget does not receive the linebreak.

"parse_word(ITER, CHAR)"
This method is called after the user ended typing a word. It checks the word left of the cursor for any markup that needs updating.

CHAR can be the key that caused a word to end, returning TRUE makes it never reaching the widget.

"toggle_bullets()"
If selected text is a bullet list this removes the bullets, else it adds bullets.
"selection_tab()"
Puts a tab before every line of a selection.
"selection_backspace()"
Removes a tab for every line of a selection.

AUTHOR

Jaap Karssenberg (Pardus) <pardus@cpan.org>

Copyright (c) 2005 Jaap G Karssenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO