The Gnome Chemistry Utils
0.12.11
|
#include <gcp/document.h>
Public Member Functions | |
Document (Application *App, bool StandAlone, Window *window=NULL) | |
virtual | ~Document () |
void | Clear () |
GtkWidget * | GetWidget () |
View * | GetView () |
bool | ImportOB (OpenBabel::OBMol &Mol) |
void | ExportOB () const |
void | Save () const |
virtual bool | Load (xmlNodePtr node) |
const gchar * | GetTitle () const |
void | SetTitle (const gchar *title) |
void | SetLabel (const gchar *label) |
const gchar * | GetLabel () const |
void | SetFileName (std::string const &filename, const gchar *mime_type) |
const gchar * | GetFileName () const |
void | DoPrint (GtkPrintOperation *print, GtkPrintContext *context, int page) const |
void | AddObject (Object *pObject) |
void | AddAtom (Atom *pAtom) |
void | AddFragment (Fragment *pFragment) |
void | AddBond (Bond *pBond) |
void | ParseXMLTree (xmlDocPtr xml) |
void | LoadObjects (xmlNodePtr node) |
xmlDocPtr | BuildXMLTree () const |
void | Update () |
void | Remove (Object *object) |
void | Remove (const char *Id) |
void | OnProperties () |
void | OnUndo () |
void | OnRedo () |
const GDate * | GetCreationDate () |
const GDate * | GetRevisionDate () |
const gchar * | GetAuthor () |
const gchar * | GetMail () |
const gchar * | GetComment () |
void | SetAuthor (const gchar *author) |
void | SetMail (const gchar *mail) |
void | SetComment (const gchar *comment) |
void | FinishOperation () |
void | AbortOperation () |
void | PopOperation () |
void | PushOperation (Operation *operation, bool undo=true) |
void | SetActive () |
Operation * | GetNewOperation (OperationType type) |
Operation * | GetCurrentOperation () |
void | AddData (xmlNodePtr node) |
bool | CanUndo () |
void | SetEditable (bool editable) |
bool | GetEditable () |
gcp::Application * | GetApplication () |
void | ExportImage (std::string const &filename, const char *type, int resolution=-1) |
void | SetReadOnly (bool ro) |
bool | GetReadOnly () |
virtual double | GetYAlign () |
Window * | GetWindow () |
GtkWindow * | GetGtkWindow () |
void | SetTheme (Theme *theme) |
bool | OnSignal (gcu::SignalId Signal, gcu::Object *Child) |
void | SetDirty (bool isDirty=true) |
void | OnThemeNamesChanged () |
double | GetMedianBondLength () |
bool | SetProperty (unsigned property, char const *value) |
std::string | GetProperty (unsigned property) const |
void | SetLoading (bool loading) |
void | SaveResidue (Residue const *r, xmlNodePtr node) |
gcu::Residue const * | GetResidue (char const *symbol, bool *ambiguous=NULL) |
gcu::Residue * | CreateResidue (char const *name, char const *symbol, gcu::Molecule *molecule) |
Theme * | GetTheme (void) const |
void | SetBondLength (double val) |
double | GetBondLength (void) const |
double & | GetRefBondLength (void) |
void | SetBondAngle (double val) |
double | GetBondAngle (void) const |
double & | GetRefBondAngle (void) |
void | SetArrowLength (double val) |
double | GetArrowLength (void) const |
double & | GetRefArrowLength (void) |
void | SetTextFontFamily (gchar *val) |
gchar * | GetTextFontFamily (void) const |
gchar *& | GetRefTextFontFamily (void) |
void | SetTextFontStyle (PangoStyle val) |
PangoStyle | GetTextFontStyle (void) const |
PangoStyle & | GetRefTextFontStyle (void) |
void | SetTextFontWeight (PangoWeight val) |
PangoWeight | GetTextFontWeight (void) const |
PangoWeight & | GetRefTextFontWeight (void) |
void | SetTextFontVariant (PangoVariant val) |
PangoVariant | GetTextFontVariant (void) const |
PangoVariant & | GetRefTextFontVariant (void) |
void | SetTextFontStretch (PangoStretch val) |
PangoStretch | GetTextFontStretch (void) const |
PangoStretch & | GetRefTextFontStretch (void) |
void | SetTextFontSize (gint val) |
gint | GetTextFontSize (void) const |
gint & | GetRefTextFontSize (void) |
PangoAttrList * | GetPangoAttrList (void) const |
void | SetAllowClipboard (bool val) |
bool | GetAllowClipboard (void) const |
bool & | GetRefAllowClipboard (void) |
unsigned | GetSoftwareVersion (void) const |
![]() | |
Document (Application *App=NULL) | |
std::string & | GetTranslatedId (const char *id) |
void | EraseTranslationId (const char *Id) |
void | EmptyTranslationTable () |
virtual void | SetTitle (std::string &title) |
virtual void | SetTitle (char const *title) |
std::string & | GetTitle () |
void | NotifyDirty (Object *pObject) |
bool | SetTarget (char const *id, Object **target, Object *parent, Object *owner=NULL) throw (std::runtime_error) |
virtual bool | Loaded () throw (LoaderError) |
std::string | Name () |
Application * | GetApp (void) |
bool | GetEmpty (void) |
void | SetScale (double val) |
double | GetScale (void) const |
double & | GetRefScale (void) |
![]() | |
Object (TypeId Id=OtherType) | |
virtual | ~Object () |
TypeId | GetType () const |
void | SetId (gchar const *Id) |
gchar const * | GetId () const |
virtual void | AddChild (Object *object) |
Object * | GetMolecule () const |
Object * | GetReaction () const |
Object * | GetGroup () const |
Document * | GetDocument () const |
Object * | GetParentOfType (TypeId Id) const |
Object * | GetChild (const gchar *Id) const |
Object * | GetFirstChild (std::map< std::string, Object * >::iterator &i) |
Object * | GetNextChild (std::map< std::string, Object * >::iterator &i) |
Object * | GetDescendant (const gchar *Id) const |
Object * | GetParent () const |
void | SetParent (Object *Parent) |
virtual xmlNodePtr | Save (xmlDocPtr xml) const |
virtual void | Move (double x, double y, double z=0.) |
virtual void | Transform2D (Matrix2D &m, double x, double y) |
bool | SaveChildren (xmlDocPtr xml, xmlNodePtr node) const |
void | SaveId (xmlNodePtr node) const |
xmlNodePtr | GetNodeByProp (xmlNodePtr node, char const *Property, char const *Id) |
xmlNodePtr | GetNextNodeByProp (xmlNodePtr node, char const *Property, char const *Id) |
xmlNodePtr | GetNodeByName (xmlNodePtr node, char const *Name) |
xmlNodePtr | GetNextNodeByName (xmlNodePtr node, char const *Name) |
bool | HasChildren () const |
unsigned | GetChildrenNumber () const |
virtual Object * | GetAtomAt (double x, double y, double z=0.) |
virtual bool | Build (std::list< Object * > &Children) throw (std::invalid_argument) |
virtual bool | BuildContextualMenu (GtkUIManager *UIManager, Object *object, double x, double y) |
void | EmitSignal (SignalId Signal) |
void | Lock (bool state=true) |
bool | IsLocked () |
Object * | GetFirstLink (std::set< Object * >::iterator &i) |
Object * | GetNextLink (std::set< Object * >::iterator &i) |
void | Link (Object *object) |
void | Unlink (Object *object) |
virtual void | OnUnlink (Object *object) |
void | GetPossibleAncestorTypes (std::set< TypeId > &types) const |
virtual void | OnLoaded () |
std::string | Identity () |
virtual char const * | HasPropertiesDialog () const |
void | ShowPropertiesDialog () |
bool | GetDirty (void) const |
![]() | |
DialogOwner () | |
virtual | ~DialogOwner () |
Dialog * | GetDialog (std::string name) |
void | ClearDialogs () |
![]() | |
Printable () | |
virtual | ~Printable () |
virtual bool | SupportsHeaders () |
virtual bool | SupportMultiplePages () |
virtual int | GetPagesNumber () |
void | Print (bool preview) |
void | SetPageSetup (GtkPageSetup *PageSetup) |
GtkPrintSettings * | GetPrintSettings (void) const |
void | SetUnit (GtkUnit val) |
GtkUnit | GetUnit (void) const |
GtkUnit & | GetRefUnit (void) |
void | SetHeaderHeight (double val) |
double | GetHeaderHeight (void) const |
double & | GetRefHeaderHeight (void) |
void | SetFooterHeight (double val) |
double | GetFooterHeight (void) const |
double & | GetRefFooterHeight (void) |
void | SetHorizCentered (bool val) |
bool | GetHorizCentered (void) const |
bool & | GetRefHorizCentered (void) |
void | SetVertCentered (bool val) |
bool | GetVertCentered (void) const |
bool & | GetRefVertCentered (void) |
void | SetScaleType (PrintScaleType val) |
PrintScaleType | GetScaleType (void) const |
PrintScaleType & | GetRefScaleType (void) |
void | SetScale (double val) |
double | GetScale (void) const |
double & | GetRefScale (void) |
void | SetHorizFit (bool val) |
bool | GetHorizFit (void) const |
bool & | GetRefHorizFit (void) |
void | SetVertFit (bool val) |
bool | GetVertFit (void) const |
bool & | GetRefVertFit (void) |
void | SetHPages (int val) |
int | GetHPages (void) const |
int & | GetRefHPages (void) |
void | SetVPages (int val) |
int | GetVPages (void) const |
int & | GetRefVPages (void) |
Additional Inherited Members | |
![]() | |
std::string | m_Title |
std::set< Object * > | m_DirtyObjects |
Application * | m_App |
bool | m_Empty |
The document class for GChemPaint.
Definition at line 77 of file gcp/document.h.
gcp::Document::Document | ( | Application * | App, |
bool | StandAlone, | ||
Window * | window = NULL |
||
) |
App | the application. |
StandAlone | whether the document is opened in its own window or embedded in something else. |
window | the document window if it has already been created or NULL. |
Constructs a new empty document using default theme.
|
virtual |
The destructor.
Reimplemented from gcu::Document.
void gcp::Document::AbortOperation | ( | ) |
Aborts and deletyes the current operation.
void gcp::Document::AddAtom | ( | Atom * | pAtom | ) |
pAtom | a new atom. |
Adds a new atom to the document.
void gcp::Document::AddBond | ( | Bond * | pBond | ) |
pBond | a new bond. |
Adds a new bond to the document and checks the connectivity of the new covalent structure.
void gcp::Document::AddData | ( | xmlNodePtr | node | ) |
node | the XML node representing objects to add to the document. |
Adds previously serialized objects to the document.
void gcp::Document::AddFragment | ( | Fragment * | pFragment | ) |
pFragment | a new atoms group. |
Adds a new fragment to the document.
void gcp::Document::AddObject | ( | Object * | pObject | ) |
pObject | a new object. |
Adds a new object to the document.
xmlDocPtr gcp::Document::BuildXMLTree | ( | ) | const |
Builds the XML tree representing the document. The returned value must be freed using xmlFree.
|
inline |
Definition at line 322 of file gcp/document.h.
|
virtual |
Empties a document and reinitialize it.
Reimplemented from gcu::Object.
|
virtual |
name | the name of the new residue. |
symbol | the symbol of the new residue. |
molecule | a molecule with a pseudo atom which describes the structure of the residue. |
Reimplemented from gcu::Document.
|
virtual |
a GtkPrintOperation. | |
context | a GtkPrintContext. |
page | the page to print. |
Prints the document.
Implements gcu::Printable.
void gcp::Document::ExportImage | ( | std::string const & | filename, |
const char * | type, | ||
int | resolution = -1 |
||
) |
filename | the image filename. |
type | a string representing the image type like "png", "svg", or "eps". |
resolution | the resolution to use in the image for bitmaps or −1. |
Exports the current document as an image. The image is limited to the real bounds of the document. For bitmaps, the size is evaluated using the perceived screen resolution. If the default resolution (−1) is used, the resoution will be the screen resolution.
void gcp::Document::ExportOB | ( | ) | const |
Exports the current file using OpenBabel. Only molecules will be exported.
void gcp::Document::FinishOperation | ( | ) |
Ends the current operation and pushes it on top of the undo stack. This method must be called after all changes have been done in the document and the changes described in the operation.
|
inline |
Definition at line 620 of file gcp/document.h.
|
inline |
Definition at line 336 of file gcp/document.h.
|
inline |
Definition at line 532 of file gcp/document.h.
|
inline |
Definition at line 250 of file gcp/document.h.
|
inline |
Definition at line 520 of file gcp/document.h.
|
inline |
Definition at line 505 of file gcp/document.h.
|
inline |
Definition at line 258 of file gcp/document.h.
|
inline |
Definition at line 242 of file gcp/document.h.
|
inline |
Definition at line 312 of file gcp/document.h.
|
inline |
Definition at line 332 of file gcp/document.h.
|
inline |
Definition at line 160 of file gcp/document.h.
|
virtual |
Reimplemented from gcu::Document.
const gchar* gcp::Document::GetLabel | ( | ) | const |
|
inline |
Definition at line 254 of file gcp/document.h.
double gcp::Document::GetMedianBondLength | ( | ) |
Operation* gcp::Document::GetNewOperation | ( | OperationType | type | ) |
type | the type of the new undo/redo operation. |
|
inline |
Definition at line 608 of file gcp/document.h.
|
virtual |
property | the property id as defined in objprops.h |
Used when saving to get properties from document.. Supported properties for documents are: GCU_PROP_DOC_FILENAME, GCU_PROP_DOC_MIMETYPE, GCU_PROP_DOC_TITLE, GCU_PROP_DOC_COMMENT, GCU_PROP_DOC_CREATOR, GCU_PROP_DOC_CREATION_TIME, GCU_PROP_DOC_MODIFICATION_TIME, and GCU_PROP_THEME_BOND_LENGTH.
Reimplemented from gcu::Object.
|
inline |
Definition at line 356 of file gcp/document.h.
|
inline |
Definition at line 620 of file gcp/document.h.
|
inline |
Definition at line 532 of file gcp/document.h.
|
inline |
Definition at line 520 of file gcp/document.h.
|
inline |
Definition at line 505 of file gcp/document.h.
|
inline |
Definition at line 544 of file gcp/document.h.
|
inline |
Definition at line 604 of file gcp/document.h.
|
inline |
Definition at line 592 of file gcp/document.h.
|
inline |
Definition at line 556 of file gcp/document.h.
|
inline |
Definition at line 580 of file gcp/document.h.
|
inline |
Definition at line 568 of file gcp/document.h.
|
virtual |
symbol | the symbol for which a Residue* is searched. |
ambiguous | where to store the boolean telling if the symbol is ambiguous or NULL. |
Documents might own not global residues with the samesymbol or name but a different meaning from the standard residue.
Reimplemented from gcu::Document.
|
inline |
Definition at line 246 of file gcp/document.h.
|
inline |
Retrieves the GChemPaint API number corresponding to the program which saved the file last time. Might be 0 if the file has never been saved, or if the file was not saved using GChemPaint. The version is an unsigned decimal number of the type MMMmmmµµµ, where MMM is the major version, mmm the minor version and µµµ the micro version. This is used to detect files with old syntax on loading.
Definition at line 629 of file gcp/document.h.
|
inline |
Definition at line 544 of file gcp/document.h.
|
inline |
Definition at line 604 of file gcp/document.h.
|
inline |
Definition at line 592 of file gcp/document.h.
|
inline |
Definition at line 556 of file gcp/document.h.
|
inline |
Definition at line 580 of file gcp/document.h.
|
inline |
Definition at line 568 of file gcp/document.h.
|
inline |
Definition at line 493 of file gcp/document.h.
const gchar* gcp::Document::GetTitle | ( | ) | const |
|
inline |
Definition at line 108 of file gcp/document.h.
GtkWidget* gcp::Document::GetWidget | ( | ) |
|
inline |
Definition at line 367 of file gcp/document.h.
|
virtual |
Used to retrieve the y coordinate for alignment. If the documetn contains just one objecst as a molecule or a reaction, it will reurn it's alignment value, otherwise 0 is returned.
Reimplemented from gcu::Object.
bool gcp::Document::ImportOB | ( | OpenBabel::OBMol & | Mol | ) |
Mol | an OpenBabel molecule to import. |
Imports a molecule using OpenBabel.
|
virtual |
node | the XML root node for the document. |
Loads the document from the XML tree representing it.
Reimplemented from gcu::Object.
void gcp::Document::LoadObjects | ( | xmlNodePtr | node | ) |
node | the XML node representing objects to add to the document. |
void gcp::Document::OnProperties | ( | ) |
Called by the framework when the user fires the File/Properties command.
void gcp::Document::OnRedo | ( | ) |
Called by the framework when the user fires the Edit/Redo command.
|
virtual |
Signal | a SignalId |
Child | the child which emitted the signal or NULL |
Called when a signal has been emitted by a child. Only OnThemeChangedSignal is relevant for documents.
Reimplemented from gcu::Object.
void gcp::Document::OnThemeNamesChanged | ( | ) |
Called by the framework when the theme names have changed, i.e. a new theme has ben added, or a theme has been removed or renamed.
void gcp::Document::OnUndo | ( | ) |
Called by the framework when the user fires the Edit/Undo command.
void gcp::Document::ParseXMLTree | ( | xmlDocPtr | xml | ) |
xml | the XML document representing the GChemPaint document being loaded. |
Parses the XML tree and creates all objects it represents.
void gcp::Document::PopOperation | ( | ) |
Removes an operation from the udo stack and deletes it.
void gcp::Document::PushOperation | ( | Operation * | operation, |
bool | undo = true |
||
) |
operation | the operation to add. |
undo | whether to put he operation on the undo or the redo stack. |
Adds the current operation to the appropriate task.
void gcp::Document::Remove | ( | Object * | object | ) |
object | the object to remove. |
Removes a child object from the document, and deletes it.
void gcp::Document::Remove | ( | const char * | Id | ) |
Id | the Id of the object to be removed. |
Removes a child object from the document, and deletes it.
|
virtual |
Saves the current file.
Reimplemented from gcu::Document.
void gcp::Document::SaveResidue | ( | Residue const * | r, |
xmlNodePtr | node | ||
) |
r | the residue to be saved. |
node | the XML node to which add the saved residue if needed. |
GChemPaint saves the meaning of a residue the first time it is encountered, and maintains a list of saved residues to avoid duplicates.
void gcp::Document::SetActive | ( | ) |
Called by the framework when the document becomes the active one. Updates the menus according to the document state.
|
inline |
val | whether the document may use the clipboard or no. |
Sets the rights for the document clipbard access.
Definition at line 620 of file gcp/document.h.
|
inline |
val | the new default arrow length. |
Sets the new default arrow length for the document.
Definition at line 532 of file gcp/document.h.
void gcp::Document::SetAuthor | ( | const gchar * | author | ) |
author | the new author name. |
Setes the document author name.
|
inline |
val | the new default bond angle between two consecutive bonds in a chain. |
Sets the new default bond angle between two consecutive bonds in a chain for the document.
Definition at line 520 of file gcp/document.h.
|
inline |
val | the new default bond length. |
Sets the new default bond length for the document.
Definition at line 505 of file gcp/document.h.
void gcp::Document::SetComment | ( | const gchar * | comment | ) |
comment | the new comment. |
Sets the comment associated with the document any.
void gcp::Document::SetDirty | ( | bool | isDirty = true | ) |
Mark the document as dirty. On any attempt to close a dirty document, a dialog box is opened to ask the user if he wants to save the modified document or drop the changes.
Reimplemented from gcu::Object.
|
inline |
editable | whether the document might be edited or not |
This method is used to lock a document and inhibit any change in it.
Definition at line 328 of file gcp/document.h.
void gcp::Document::SetFileName | ( | std::string const & | filename, |
const gchar * | mime_type | ||
) |
filename | the new file name (URI). |
mime_type | the new mime type. |
Sets the new file name and its associated mime type.
void gcp::Document::SetLabel | ( | const gchar * | label | ) |
label | the new window title. |
Sets the label to use as window title.
|
inline |
loading | whether the document is loading data or not. |
Used to inhibit undo/redo operation creation when loading.
Definition at line 431 of file gcp/document.h.
void gcp::Document::SetMail | ( | const gchar * | ) |
the new e-mail address. |
Sets the document author e-mail address.
|
virtual |
property | the property id as defined in objprops.h |
value | the property value as a string |
Used when loading to set properties. Supported properties for documents are: GCU_PROP_DOC_FILENAME, GCU_PROP_DOC_MIMETYPE, GCU_PROP_DOC_TITLE, GCU_PROP_DOC_COMMENT, GCU_PROP_DOC_CREATOR, GCU_PROP_DOC_CREATION_TIME, GCU_PROP_DOC_MODIFICATION_TIME, and GCU_PROP_THEME_BOND_LENGTH.
Reimplemented from gcu::Object.
void gcp::Document::SetReadOnly | ( | bool | ro | ) |
ro | whether the file is read-only or not. |
If ro is true, the File/Save menu item and corresponding button will be disabled.
|
inline |
val | the new text font family. |
Sets the new current text font family for the document.
Definition at line 544 of file gcp/document.h.
|
inline |
val | the new text font size. |
Sets the new current text font size for the document.
Definition at line 604 of file gcp/document.h.
|
inline |
val | the new text font stretch. |
Sets the new current text font stretch for the document.
Definition at line 592 of file gcp/document.h.
|
inline |
val | the new text font style. |
Sets the new current text font style for the document.
Definition at line 556 of file gcp/document.h.
|
inline |
val | the new text font variant. |
Sets the new current text font variant for the document.
Definition at line 580 of file gcp/document.h.
|
inline |
val | the new text font weight. |
Sets the new current text font weight for the document.
Definition at line 568 of file gcp/document.h.
void gcp::Document::SetTheme | ( | Theme * | theme | ) |
theme | the new theme for the document. |
Sets the theme to be used by the document. This will not change lengths of existing bonds or size of existing text.
void gcp::Document::SetTitle | ( | const gchar * | title | ) |
title | the new title. |
The document title.
void gcp::Document::Update | ( | ) |
Updates the view for all objects which have been marked as dirty.