The Gnome Chemistry Utils
0.12.13
Main Page
Namespaces
Classes
Files
File List
File Members
libs
gcu
gcu/document.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
3
/*
4
* Gnome Chemistry Utils
5
* gcu/document.h
6
*
7
* Copyright (C) 2004-2010 Jean Bréfort <jean.brefort@normalesup.org>
8
*
9
* This program is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU General Public License as
11
* published by the Free Software Foundation; either version 2 of the
12
* License, or (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22
* USA
23
*/
24
25
26
#ifndef GCU_DOCUMENT_H
27
#define GCU_DOCUMENT_H
28
29
#include <
gcu/object.h
>
30
#include <
gcu/dialog-owner.h
>
31
#include <
gcu/macros.h
>
32
#include <
gcu/loader-error.h
>
33
#include <string>
34
#include <set>
35
37
namespace
gcu
38
{
39
40
class
Application;
41
class
Dialog;
42
class
Molecule;
43
class
Residue;
44
45
class
PendingTarget
46
{
47
public
:
48
Object *parent;
49
Object *owner;
50
Object **target;
51
};
52
56
class
Document
:
public
Object
,
virtual
public
DialogOwner
57
{
58
friend
class
Object
;
59
friend
class
Dialog
;
60
public
:
66
Document
(
Application
*App = NULL);
70
virtual
~Document
();
71
72
public
:
73
81
std::string&
GetTranslatedId
(
const
char
*
id
) {
return
m_TranslationTable[id];}
82
89
void
EraseTranslationId
(
const
char
* Id) {m_TranslationTable.erase (Id);}
90
96
void
EmptyTranslationTable
() {m_TranslationTable.clear();}
97
101
virtual
void
SetTitle
(std::string& title) {
m_Title
= title;}
105
virtual
void
SetTitle
(
char
const
*title) {
m_Title
= title;}
109
std::string &
GetTitle
() {
return
m_Title
;}
110
117
void
NotifyDirty
(
Object
* pObject) {
m_DirtyObjects
.insert (pObject);}
122
virtual
void
Save
()
const
{;}
133
virtual
Residue
*
CreateResidue
(
char
const
*name,
char
const
*symbol,
Molecule
*molecule);
143
virtual
Residue
const
*
GetResidue
(
char
const
*symbol,
bool
*ambiguous = NULL);
149
virtual
GtkWindow *
GetGtkWindow
() {
return
NULL;}
150
163
bool
SetTarget
(
char
const
*
id
,
Object
**target,
Object
*parent,
Object
*owner = NULL) throw (std::runtime_error);
164
169
virtual
bool
Loaded
() throw (LoaderError);
173
std::
string
Name
();
174
175
private:
176
186
gchar* GetNewId (gchar*
id
,
bool
Cache = true);
187
188
private:
189
std::map <std::
string
, std::
string
> m_TranslationTable;
//used when Ids translations are necessary (on pasting...)
190
std::map <std::
string
, std::list <PendingTarget> > m_PendingTable;
//used to set pointers to objects when loading does not occur in the ideal order
191
192
protected:
196
std::
string
m_Title
;
197
201
std::set<
Object
*>
m_DirtyObjects
;
202
210
GCU_PROT_PROP
(
Application
*, App)
217
GCU_PROT_PROP
(
bool
, Empty);
229
GCU_PROP
(
double
, Scale);
230
};
231
232
233
}
234
#endif //GCU_DOCUMENT_H
Generated on Sat Aug 11 2012 14:48:00 for The Gnome Chemistry Utils by
1.8.1.2