1 // XDrawChem
2 // Copyright (C) 2004-2005  Bryan Herger <bherger@users.sourceforge.net>
3 // Copyright (C) 2020  Yaman Qalieh <ybq987@gmail.com>
4 
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 
15 // You should have received a copy of the GNU General Public License
16 // along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 
18 #ifndef APPLICATION_H
19 #define APPLICATION_H
20 
21 #include <QAction>
22 #include <QComboBox>
23 #include <QLabel>
24 #include <QMainWindow>
25 #include <QMenu>
26 #include <QPrinter>
27 #include <QPushButton>
28 #include <QString>
29 #include <QToolBar>
30 #include <QToolButton>
31 #include <QtGlobal>
32 #include <qfontcombobox.h>
33 
34 class RenderArea;
35 class Render2D;
36 class ChemData;
37 class Clipboard;
38 class Clipboard;
39 class XRuler;
40 class NetDialog;
41 class ColorButton;
42 
43 class ApplicationWindow : public QMainWindow {
44     Q_OBJECT
45 
46   public:
47     ApplicationWindow();
48     ~ApplicationWindow();
49     QString ni_savefile;
50     bool ni_tflag;
51 
52   protected:
53     void closeEvent(QCloseEvent *);
54     bool eventFilter(QObject * /*obj*/, QEvent *e);
55 
56   public slots:
57     void newDoc();
58     void load();
59     void load(QString);
60     void save();
61     void saveAs();
62     void savePicture();
63     void externalProgram();
64     void savePNG();
65     void save3D();
66     void pageSetup();
67     void print();
68     // void MakeRingDialog();  *** obsolete.  removed.
69     void MakeNetDialog();
70     void slotChoicesFinished(const QStringList &);
71     void ShowFixedDialog();
72     void showDYK();
73     void Cut();
74     void Copy();
75     void Paste();
76     void Undo();
77     void Redo();
78     void Clear();
79     void SelectAll();
80     void DeselectAll();
81     void showTextButtons(QFont);
82     void HideTextButtons();
83     void SetStatusBar(const QString &);
84     //    void setRenderFont();
85     void SetColor(int);
86     void NewColor();
87     void BackgroundColor();
88     void SetThick(int);
89     void FromRingMenu(int);
90     // void FromNewRingMenu( QString ); // in application_ring.cpp
91     void FromRingToolbar(QString);
92     void FromArrowMenu(QAction *);
93     void FromCurveArrowMenu(QAction *);
94     void FromBracketMenu(QAction *);
95     void CubicBezierTool(int);
96     void FlipH();
97     void FlipV();
98     void Rotate90();
99     void Rotate180();
100     void Rotate270();
101     void setFixed_arrow();
102     void setFixed_bond();
103     //    void setFix_Hydrogens();
104     void MoleculeInfo();
105     void CalcEA();
106     void CalcEF();
107     void CalcMW();
108     void Calc13CNMR();
109     void Calc1HNMR();
110     void CalcIR();
111     void CalcpKa();
112     void CalcKOW();
113     void To3D();
114     void CalcName();
115     void AutoLayout();
116     void PeptideBuilder();
117     void saveCustomRing();
118     void updateCustomRingMenu();
119     void DrawRegularArrow();
120     void DrawSquareBracket();
121     void CleanUpMolecule();
122     void Retro();
123     void RetroAtomName();
124     void RetroBondName();
125     void reactionAnalysisTest();
126     void reactionAnalysisEnthalpy();
127     void reactionAnalysis1HNMR();
128     void reactionAnalysis13CNMR();
129     void reactivityForward();
130     void reactivityRetro();
131     void reactivityPC();
132     void ToSMILES();
133     void ToInChI();
134     void FromSMILES(); // defined in smilesdialog.cpp
135     void setGroup_Reactant();
136     void setGroup_Product();
137     void clearGroup();
138     void clearAllGroups();
139     void toggleGrid();
140     void svXY(int, int);
141     void zoomEvent(QWheelEvent *e);
142     void MagnifyPlus();
143     void MagnifyMinus();
144     void Magnify100();
145     void Zoom(int);
146     void XDCSettings();
147     void InsertSymbol();
148 
149     void OBGetFilters();
150     void OBImport();
151     void OBNewLoad(QString, QString);
152     void OBExport();
153     void OBNewSave();
154     QString OBGuessFileType(QString);
155 
156     void about();
157     void support();
158     void whatsThis();
159     void NewManual();
160     void HelpBrowser(QString);
161     void HelpTopic(QString);
162     void Refs();
Dummy()163     void Dummy() {}
164     void Test();
165     void setClipboard(Clipboard *);
166 
167   private slots:
168     void setRegularArrowAction(QAction *);
169     void setCurveArrowAction(QAction *);
170     void setBracketAction(QAction *);
171     void setSymbolAction(QAction *);
172     void setRingAction(QAction *);
173     void setFontFace(const QFont &);
174     void setFontPoints(const QString &);
175 
176   private:
177     // QPopupMenu *BuildRingMenu();  obsolete...
178     QMenu *BuildCustomRingMenu();
179     QMenu *BuildArrowMenu();
180     QMenu *BuildCurveArrowMenu();
181     QMenu *BuildBracketMenu();
182     QMenu *BuildNewRingMenu(); // in application_ring.cpp
183     QMenu *BuildSymbolMenu();
184 
185     QWidget *m_centralWidget;
186     XRuler *hruler, *vruler;
187     QLabel *m_rulerUnitLabel;
188     QMenu *edit, *format;
189     QMenu *ringmenu;
190     QToolBar *BuildBioTools();
191     int fix_hydrogens;
192     QPrinter *printer;
193     RenderArea *m_renderArea;
194     Render2D *m_renderer;
195     ChemData *m_chemData;
196     QToolBar *fileTools, *drawTools, *ringTools, *bioTools;
197     QString filename, filefilter;
198     QToolButton *Bold, *TextUnderline, *Italic, *Underline, *superScript, *subScript, *leftJustify,
199         *centerJustify, *rightJustify;
200 
201     ColorButton *colorBtn;
202 
203     QAction *justifyLeftAction, *justifyCenterAction, *justifyRightAction, *boldAction,
204         *italicAction, *underlineAction, *superscriptAction, *subscriptAction, *insertSymbolAction,
205         *fixedBondAction, *fixedArrowAction;
206 
207     /// regular arrows
208     QToolButton *drawArrowButton;
209     QMenu *regularArrowMenu;
210     QAction *regularArrowAction, *topharpoonArrowAction, *bottomharpoonAction, *middleArrowAction,
211         *didntworkArrowAction, *dashedArrowAction, *bi1ArrowAction, *bi2ArrowAction,
212         *retroArrowAction;
213 
214     /// curve arrows
215     QToolButton *drawCurveArrowButton;
216     QMenu *curveArrowMenu;
217     QAction *carrowCW90Action, *carrowCCW90Action, *carrowCW180Action, *carrowCCW180Action,
218         *carrowCW270Action, *carrowCCW270Action, *carrowBezierAction, *carrowBezierhalfAction,
219         *carrowBezierfullAction;
220 
221     /// brackets
222     QToolButton *drawBracketButton;
223     QMenu *bracketMenu;
224     QAction *squareBracketAction, *curveBracketAction, *braceBracketAction, *boxBracketAction,
225         *ellipseBracketAction, *closedsquareBracketAction, *circleBracketAction;
226 
227     QToolButton *drawSymbolButton;
228 
229     /// rings
230     QToolButton *drawRingButton;
231     QMenu *ringMenu;
232     QAction *ring3Action, *ring4Action, *ring5Action, *ring6Action, *ringBenzeneAction,
233         *ringImidazoleAction, *ringCyclopentadieneAction, *ring6BoatAction, *ring6ChairAction,
234         *ringPyrimidineAction, *ring7Action, *ring8Action, *ringIndoleAction, *ringNaphAction,
235         *ringPurineAction, *ringBiphenylAction, *ringAnthraAction, *ringSteroidAction;
236     QAction *naAdenineAction, *naCytosineAction, *naGuanineAction, *naThymineAction,
237         *naUracilAction;
238     QAction *srAction, *sdAction, *sfAction, *sgAction;
239     QAction *customRingMenuAction;
240 
241     QComboBox *colorList, *fontSizeList, *ltList;
242     QFontComboBox *fonts;
243     QStringList ringlist, symbollist, arrowlist, curvearrowlist, bracketlist;
244     QStringList filters, readFilters, writeFilters;
245     NetDialog *netDlg;
246 };
247 
248 #endif
249