|
The Gnome Chemistry Utils
0.12.11
|
GChemPaint application base class. More...
#include <gcp/application.h>
Public Member Functions | |
| Application () | |
| virtual | ~Application () |
| void | ActivateTool (const std::string &toolname, bool activate) |
| void | ActivateWindowsActionWidget (const char *path, bool activate) |
| virtual void | ClearStatus () |
| virtual void | SetStatusText (const char *text) |
| virtual GtkWindow * | GetWindow ()=0 |
| Tool * | GetActiveTool () |
| gcp::Document * | GetActiveDocument () |
| void | SetActiveDocument (gcp::Document *pDoc) |
| Tool * | GetTool (const std::string &name) |
| void | SetTool (const std::string &toolname, Tool *tool) |
| GtkWidget * | GetToolItem (const std::string &name) |
| void | SetToolItem (const std::string &name, GtkWidget *w) |
| void | SetCurZ (int Z) |
| int | GetCurZ () |
| void | OnSaveAs () |
| bool | FileProcess (const gchar *filename, const gchar *mime_type, bool bSave, GtkWindow *window, gcu::Document *pDoc=NULL) |
| void | SaveWithBabel (std::string const &filename, const gchar *mime_type, gcp::Document *pDoc) |
| void | OpenWithBabel (std::string const &filename, const gchar *mime_type, gcp::Document *pDoc) |
| void | SaveGcp (std::string const &filename, gcp::Document *pDoc) |
| void | OpenGcp (std::string const &filename, gcp::Document *pDoc) |
| xmlDocPtr | GetXmlDoc () |
| void | OnSaveAsImage () |
| bool | HaveGhemical () |
| bool | HaveInChI () |
| int | GetDocsNumber () |
| void | Zoom (double zoom) |
| void | AddActions (GtkRadioActionEntry const *entries, int nb, char const *ui_description, IconDesc const *icons) |
| void | RegisterToolbar (char const *name, int index) |
| void | OnToolChanged (GtkAction *current) |
| void | AddTarget (Target *target) |
| void | DeleteTarget (Target *target) |
| void | NotifyIconification (bool iconified) |
| void | NotifyFocus (bool has_focus, Target *target=NULL) |
| void | CloseAll () |
| std::list< std::string > & | GetSupportedMimeTypes () |
| void | OnConfigChanged (GOConfNode *node, gchar const *name) |
| std::list< std::string > & | GetExtensions (std::string &mime_type) |
| void | OnThemeNamesChanged () |
| void | AddMenuCallback (BuildMenuCb cb) |
| void | BuildMenu (GtkUIManager *manager) |
| gcu::Document * | CreateNewDocument () |
| virtual void | OnFileNew (char const *Theme=NULL)=0 |
| GdkCursor * | GetCursor (CursorId id) |
| GtkStyle const * | GetStyle (void) const |
Public Member Functions inherited from gcu::Application | |
| Application (std::string name, std::string datadir=DATADIR, char const *help_name=NULL, char const *icon_name=NULL) | |
| void | OnHelp (std::string s="") |
| bool | HasHelp () |
| std::string & | GetName () |
| virtual bool | FileProcess (G_GNUC_UNUSED const gchar *filename, G_GNUC_UNUSED const gchar *mime_type, G_GNUC_UNUSED bool bSave, G_GNUC_UNUSED GtkWindow *window, G_GNUC_UNUSED Document *pDoc=NULL) |
| char const * | GetCurDir () |
| void | SetCurDir (char const *dir) |
| void | SetCurDir (std::string const &dir) |
| void | ShowURI (std::string &uri) |
| void | OnBug (char const *uri=PACKAGE_BUGREPORT) |
| void | OnWeb (char const *uri="http://gchemutils.nongnu.org/") |
| void | OnMail (char const *MailAddress="mailto:gchemutils-main@nongnu.org") |
| void | OnLiveAssistance () |
| GtkWidget * | GetImageResolutionWidget () |
| GtkWidget * | GetImageSizeWidget () |
| std::map< std::string, GdkPixbufFormat * > & | GetSupportedPixbufFormats () |
| char const * | GetPixbufTypeName (std::string &filename, char const *mime_type) |
| ContentType | Load (std::string const &uri, const gchar *mime_type, Document *Doc) |
| bool | Save (std::string const &uri, const gchar *mime_type, Document const *Doc, ContentType type) |
| std::string const & | GetIconName () |
| void | RegisterOptions (GOptionEntry const *entries, char const *translation_domain=GETTEXT_PACKAGE) |
| void | AddOptions (GOptionContext *context) |
| std::set< Document * > | GetDocs (void) |
| unsigned | GetScreenResolution (void) const |
| void | SetImageResolution (unsigned val) |
| unsigned | GetImageResolution (void) const |
| unsigned & | GetRefImageResolution (void) |
| void | SetImageWidth (unsigned val) |
| unsigned | GetImageWidth (void) const |
| unsigned & | GetRefImageWidth (void) |
| void | SetImageHeight (unsigned val) |
| unsigned | GetImageHeight (void) const |
| unsigned & | GetRefImageHeight (void) |
| void | SetTransparentBackground (bool val) |
| bool | GetTransparentBackground (void) const |
| bool & | GetRefTransparentBackground (void) |
| GtkRecentManager * | GetRecentManager (void) const |
Public Member Functions inherited from gcu::DialogOwner | |
| DialogOwner () | |
| virtual | ~DialogOwner () |
| Dialog * | GetDialog (std::string name) |
| void | ClearDialogs () |
Protected Member Functions | |
| void | InitTools () |
| void | BuildTools () throw (std::runtime_error) |
| void | ShowTools (bool visible) |
Protected Member Functions inherited from gcu::Application | |
| virtual void | NoMoreDocsEvent () |
Protected Attributes | |
| gcp::Document * | m_pActiveDoc |
| Target * | m_pActiveTarget |
| unsigned | m_NumWindow |
Protected Attributes inherited from gcu::Application | |
| std::map< std::string, GdkPixbufFormat * > | m_SupportedPixbufFormats |
| std::set< Document * > | m_Docs |
Additional Inherited Members | |
Static Public Member Functions inherited from gcu::Application | |
| static GOConfNode * | GetConfDir () |
| static WindowState | GetDefaultWindowState () |
| static Application * | GetDefaultApplication () |
GChemPaint application base class.
This class is used to represent a GChemPaint application. It is a virtual class since at least one method is pure virtual (gcp::Application::GetWindow)
Definition at line 92 of file gcp/application.h.
| gcp::Application::Application | ( | ) |
The default constructor.
|
virtual |
The destructor.
Reimplemented from gcu::Application.
| void gcp::Application::ActivateTool | ( | const std::string & | toolname, |
| bool | activate | ||
| ) |
| toolname | the name of the tool. |
| activate | whether to activate or deactivate. |
Activates or deactivates a tool in the GChempaint tool box.
To activate the selection tool:
| void gcp::Application::ActivateWindowsActionWidget | ( | const char * | path, |
| bool | activate | ||
| ) |
| path | the path to activate. |
| activate | whether to activate or deactivate. |
Activates or deactivates the menu item corresponding to path according to the value of activate.
To deactivate the "Paste" menu item, use:
| void gcp::Application::AddActions | ( | GtkRadioActionEntry const * | entries, |
| int | nb, | ||
| char const * | ui_description, | ||
| IconDesc const * | icons | ||
| ) |
| entries | an array of GtkRadioActionEntry structures. |
| nb | the number of entries. |
| ui_description | an xml like text describing the user interface. |
| icons | an array of IconDesc structures for the icons used by the buttons. |
Adds new buttons in the tools box. The code used in the selection plugin is:
| void gcp::Application::AddMenuCallback | ( | BuildMenuCb | cb | ) |
| cb,: | the BuildMenuCb callback to call when building the menu. |
adds a callback for adding entries to the windows menus.
| void gcp::Application::AddTarget | ( | Target * | target | ) |
| void gcp::Application::BuildMenu | ( | GtkUIManager * | manager | ) |
| manager,: | the GtkUIManager to populate. |
Populates the user interface by calling all callbacks registered with AddMenuCallback.
|
protected |
Builds the tools box. This method is called only once after startup by the framework.
|
virtual |
Clears the message in the status bar.
| void gcp::Application::CloseAll | ( | ) |
Closes all open documents and ends the application.
|
virtual |
Creates a new document using the default theme.
Reimplemented from gcu::Application.
| void gcp::Application::DeleteTarget | ( | Target * | target | ) |
| bool gcp::Application::FileProcess | ( | const gchar * | filename, |
| const gchar * | mime_type, | ||
| bool | bSave, | ||
| GtkWindow * | window, | ||
| gcu::Document * | pDoc = NULL |
||
| ) |
| filename | the URI of the file to save or open. |
| mime_type | the mime type. |
| bSave | true when saving and false when opening. |
| window | a parent GtkWindow which is used for messabe boxes if any. |
| pDoc | a document (might be NULL when loading. |
Callback called when the user clicks on the Save or Open button in the file chooser to process the file.
|
inline |
Definition at line 154 of file gcp/application.h.
References m_pActiveDoc.
|
inline |
Definition at line 150 of file gcp/application.h.
|
inline |
| id | a CursorId |
Definition at line 423 of file gcp/application.h.
|
inline |
Definition at line 196 of file gcp/application.h.
|
inline |
Definition at line 263 of file gcp/application.h.
References gcu::Application::m_Docs.
| std::list<std::string>& gcp::Application::GetExtensions | ( | std::string & | mime_type | ) |
| mime_type | a mime type. |
|
inline |
Definition at line 491 of file gcp/application.h.
|
inline |
Definition at line 366 of file gcp/application.h.
|
inline |
| name | the name of a tool |
Definition at line 165 of file gcp/application.h.
|
inline |
| name | the name of a tool |
Definition at line 178 of file gcp/application.h.
|
pure virtual |
This pure virtual method must be overloaded by derived classes.
Reimplemented from gcu::Application.
|
inline |
Definition at line 247 of file gcp/application.h.
|
inline |
Definition at line 255 of file gcp/application.h.
|
inline |
Definition at line 259 of file gcp/application.h.
|
protected |
Initialize the tools box so that the selection tool is active. This method is called only once aafter startup by the framework.
| void gcp::Application::NotifyFocus | ( | bool | has_focus, |
| Target * | target = NULL |
||
| ) |
| void gcp::Application::NotifyIconification | ( | bool | iconified | ) |
| void gcp::Application::OnConfigChanged | ( | GOConfNode * | node, |
| gchar const * | name | ||
| ) |
| node | the GONode which changed. |
| name | the name of the key. |
Called by the framework when the configuration entry has changed to update a running application preferences if the system allows such callbacks.
|
pure virtual |
| Theme | a gcp::Theme or NULL. |
Creates a new document using the ginev theme or the default theme if Theme is NULL. This method must be overloaded by derived classes since it is pure virtual.
| void gcp::Application::OnSaveAs | ( | ) |
Open the file save as dialog to save the current document with a new name.
| void gcp::Application::OnSaveAsImage | ( | ) |
Saves the active view as an image.
| void gcp::Application::OnThemeNamesChanged | ( | ) |
Called by the framework after a change of a theme name. Ensure evrything is correctly updated.
| void gcp::Application::OnToolChanged | ( | GtkAction * | current | ) |
| current | the GtkAction for the activated tool. |
Call by the framework when the active tool changed.
| void gcp::Application::OpenGcp | ( | std::string const & | filename, |
| gcp::Document * | pDoc | ||
| ) |
| filename | the URI of the file to load. |
| pDoc | a document or NULL. |
Loads a GChemPaint document.
| void gcp::Application::OpenWithBabel | ( | std::string const & | filename, |
| const gchar * | mime_type, | ||
| gcp::Document * | pDoc | ||
| ) |
| filename | the URI of the file to load. |
| mime_type | the mime type. |
| pDoc | a document or NULL. |
Loads a document using the Openbabel library.
| void gcp::Application::RegisterToolbar | ( | char const * | name, |
| int | index | ||
| ) |
| name | the name of the toolbar. |
| index | the rank of the toolbar in the toolbox. |
Adds a new toolbar to the tools box. See the documentation of gcp::Application::AddActions() for a case use.
| void gcp::Application::SaveGcp | ( | std::string const & | filename, |
| gcp::Document * | pDoc | ||
| ) |
| filename | the URI of the file to save. |
| pDoc | the document to save. |
Saves the active document in the native GChemPaint format.
| void gcp::Application::SaveWithBabel | ( | std::string const & | filename, |
| const gchar * | mime_type, | ||
| gcp::Document * | pDoc | ||
| ) |
| filename | the URI of the file to save. |
| mime_type | the mime type. |
| pDoc | the document to save. |
Saves the active document using the Openbabel library.
|
inline |
| pDoc | the document becoming active. |
Sets the new active document.
Definition at line 160 of file gcp/application.h.
References m_pActiveDoc.
|
inline |
| Z | the new current atomic number. |
Sets the new current atomic number. This number is used for new atoms.
Definition at line 192 of file gcp/application.h.
|
virtual |
| text | a text to display |
Displays text in the status bar.
|
inline |
| toolname | the name of a new tool. |
| tool | the new Tool. |
Adds a new tool to the tools box. This method is called from the Tool constructor.
Definition at line 173 of file gcp/application.h.
|
inline |
| name | the name of a new tool. |
| w | a GtkWidget. |
Associates w to the Tool named name. SetTool() will return this widget when its argument is name.
Definition at line 186 of file gcp/application.h.
|
protected |
| visible | whether the tools box should be visible or not |
Shows or hides the tools box.
| void gcp::Application::Zoom | ( | double | zoom | ) |
| zoom | the new zoom level. |
Sets the zoom level for the active document window.
|
protected |
Used to add a number to new files default names.
Definition at line 460 of file gcp/application.h.
|
protected |
The active document.
Definition at line 452 of file gcp/application.h.
Referenced by GetActiveDocument(), and SetActiveDocument().
|
protected |
The active target.
Definition at line 456 of file gcp/application.h.
1.8.1.1