Zim::GUI.3pm

Langue: en

Version: 2008-11-24 (ubuntu - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Zim::GUI - The application object for zim

SYNOPSIS

         use Zim::GUI;
 
         my $zim = Zim::GUI->new(\%SETTINGS);
         $zim->gui_init;
         $zim->gui_show;
 
         Gtk2->main;
 
         exit;
 
 

DESCRIPTION

This is developer documentation, for the user manual try executing "zim --doc". For commandline options see zim(1).

This module provides the application object for the Gtk2 application zim. The application has been split into several components for which the modules can be found in the Zim::GUI:: namespace. This object brings together these components and manages the settings and data objects.

This object inherits from Zim::GUI::Component and Zim::Events.

SIGNALS

This following signals are emitted by this object:
"gui_show"
Can be used for actions that can not be done during init but need to be delayed till we actually show the interface.
"page_loaded(NAME)"
Emitted after a new page is loaded.
"t_read_only(BOOLEAN)"
Toggle the display for the current page read-only. Do not assume the whole notebook to be read-only after this signal. If that is the case read_only was already set on initialization, so it can be checked during init.

TODO: The following signals should move to the notebook object

"page_renamed(FROM =" TO)>
Emitted after a page is renamed.
"page_deleted(NAME)"
Emitted after a page is deleted.

ATTRIBUTES

"name": The name of this instance / notebook
"profile": Profile name
"notebook": Zim object
"history": Zim::History object
"settings": Hash with preferences
"state": Hash with GUI state
"read_only": Current read_only state (per page)

AUTOLOAD

You can access component object by autoloaded accesors. The component objects are autoloaded from the "Zim::GUI::" namespace. Component names need to be capitalized for this to work.

Non-capitalized methods that do not exist are called on the main window object. See Gtk2::Window for the documentation.

METHODS

"new(profile =" NAME, ...)>
Simple constructor.
"gui_init()"
This method initializes all GUI objects that make up the application.
"gui_show()"
This method actually shows the main window. This is separated from "gui_init()" so we can first load a page before showing the GUI.
"ShowWindow(%OPT)"
Used to present the window and possibly to change window state.
"HideWindow()"
Iconify or hide the window.
"ToggleWindow()"
Calls either "ShowWindow()" or "HideWindow".
"current()"
Returns a reference to the current Zim::GUI object. Class method used in plugin scripts to get a reference to the application object.
"plug(PLUGIN)"
Load plugin by name.
"unplug(PLUGIN)"
Remove plugin from the config.
"widget()"
Returns the root window widget. Use this widget for things like show_all() and hide_all().
"SaveSettings(NOTIFY)"
Save config file with settings. If NOTIFY is true and we are running with a daemon process we will notify other processes to run "LoadSettings()".
"SaveState()"
Save state parameters to file. Typically this will save ``.zim/state.conf'' in the notebook directory.
"LoadSettings()"
This will (re-)load the settings from the config file. Called by the daemon after another process changed the setting. E.g. after running the PreferencesDialog.
"LoadAccelmap()"
Loads the list of custom key bindings. Called during initialization and after an other process updated the file.
"link_clicked(LINK)"
Loads a page in zim or opens an external url in a browser.

LINK is considered to be either an page name, an url or a file name. Page names are resolved as relative links first. Dispatches to "open_file()" or "open_url()" when LINK is a file or an url.

"open_file(FILE)"
Opens FILE with the apropriate program. Calls "open_directory()" when FILE is a directory.
"open_directory(DIR)"
Opens DIR in the file browser.

If it is unknown if we are dealing with a file or a dir, use "open_file()".

"open_url(URL)"
Opens URL in the web browser.
"load_page(PAGE)"
Loads a new page, updates history etc. when necessary. PAGE should be either an absolute page name, a history record or a page object.

use "link_clicked()" for relative page names, urls etc.

"TReadOnly(BOOLEAN)"
Toggle the read-only state of the application; BOOLEAN is optional. This emits the "t_read_only" signal.

Actions

The following methods map directly to the ui actions in the menu- and toolbars.
"NewPage(PAGE)"
Open a dialog which allows you to enter a name for a new page. PAGE is used to fill in the namespace in the dialog.
"OpenNotebook(NOTEBOOK, PAGE)"
Open another notebook. NOTEBOOK can either be a directory path or a notebook name. Without NOTEBOOK the ``open notebook'' dialog is prompted to the user. When NOTEBOOK is given PAGE can be used to open the notebook at a certain page.
"Save()"
Force saving the current page and state. Returns boolean for success.
"SaveIfModified(SOFT)"
Save the page if it was modified. Returns boolean for success or if page was not changed.

SOFT is an optional argument. If this argument is true the page may not be saved if there is an issue. This is used to skip auto-saving in some cases. Also ``soft'' changes may not be committed for version management etc.

"SaveVersion(COMMENT)"
Prompt for a comment and commit a version. COMMENT is an optional argument and will be used as the suggested comment in the dialog.

If no version control is enabled prompt for initializing version control.

"Versions()"
Show the versions dialog, see Zim::GUI::VersionsDialog.
"init_vcs_dialog()"
Prompt user to initialize version control, called by "SaveVersion()".
"Export()"
Show the export dialog, see Zim::GUI::ExportDialog.
"EmailPage()"
Open the current page in the email client.
"CopyPage()"
Prompt the user to save a copy of the current page.
"RenamePage(FROM, TO, UPDATE_SELF, UPDATE_OTHER)"
Wrapper for "Zim->move_page()".

Move page from FROM to TO. If TO is undefined a dialog is shown to ask for a page name.

UPDATE_SELF is a boolean telling to update all links in this page. UPDATE_OTHER is a boolean telling to update all links to this page.

Without arguments prompts the user for input.

Returns boolean for success.

"DeletePage(PAGE, RECURS, NO_CONFIRM)"
Wrapper for "Zim->delete_page". Asks the user for confirmation.

If PAGE is undefined the current page is deleted.

TODO: make recusive delete work

"Props()"
Show the properties dialog, see Zim::GUI::PropertiesDialog.
"Close()"
Close the application. When using the TrayIcon plugin this only hides the window. Does not effect other instances.
"Quit()"
Quit the application. Also closes all other instances of zim.
"CopyLocation(PAGE, ...)"
Copies a list of page names to the clipboard. Without argument uses the current page.
"Prefs()"
Show the preferences dialog, see Zim::GUI::PreferencesDialog.
"TToolBar(BOOL)"
Toggel toolbar visibility. If BOOL is undefined it will just toggle the current state.
"TStatusBar(BOOL)"
Toggle statusbar visibility. If BOOL is undefined it will just toggle the current state.
"TPane(BOOL)"
Toggle visibility of the side pane. If BOOL is undefined it will just toggle the current state. If BOOL is ``-1'' the pane will be shown, but hidden again as soon as a page is selected.
"TPathBar(TYPE)"
Set the pathbar type to TYPE.
"Reload()"
Save and reload the current page.
"Search($QUERY)"
Open QUERY in the search dialog.
"SearchBL()"
Open backlinks for current page in search dialog.
"OpenFolder()"
Open the document dir for the current page. See<Zim::Store/document_dir>.
"OpenRootFolder()"
Open the document root folder. See ``document_root'' in Zim::Store.
"EditSource(PAGE)"
Open PAGE or the current page in an external editor.
"AttachFile(FILE, NO_ASK)"
Wrapper for "$page->store_file". Opens a filechooser dialog and copies the selected file to the document directory for the current page and inserts a link in the page.

Doesn't show the dialog if both FILE and NO_ASK are defined.

"RBIndex()"
Rebuild the index cache.
"GoBack($INT)"
Go back one or more steps in the history stack.
"GoForward($INT)"
Go forward one or more steps in the history stack.
"GoParent()"
Go to page up in namespace.
"GoChild()"
Go to page down in namespace.
"GoNext()"
Go to the next page in the index.
"GoPrev()"
Go to the previous page in the index.
"GoHome()"
Go to the home page.
"JumpTo(PAGE)"
Go to PAGE. Shows a dialog when no page is given.
"ShowHelpFAQ()"
"ShowHelpKeys()"
"ShowHelpBugs()"
Shows help on FAQ, keybindings and bugs. Defined for corresponding menu items. Trying to seduce people to actually read the manual...
"About()"
This dialog tells you about the version of zim you are using.

Other functions

Functions below are used by other methods. They are not considered part of the api.
"update_status()"
Sets the statusbar to display the current page name and some other information.
"push_status(STRING, CONTEXT)"
Put STRING in the status bar.
pop_status(CONTEXT)
Removes a string from the status bar.
"prompt_rename_page_dialog(PAGE)"
Runs a dialog that gathers info for moving a page. Returns new page name and update boolean.

BUGS

Please mail the author if you find any bugs.

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

zim(1), Zim, Zim::GUI::Component