kplato

kptview.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
3 Copyright (C) 2002 - 2005 Dag Andersen <danders@get2net.dk>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library 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 GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KPLATO_VIEW
22#define KPLATO_VIEW
23
24#include <KoView.h>
25#include "kptcontext.h"
26
27class TQListViewItem;
28class TQPopupMenu;
29class TQHBoxLayout;
30class TQTabWidget;
31class TQWidgetStack;
32
33class TDEListView;
34class KPrinter;
35class TDEAction;
36class TDEActionMenu;
37class TDESelectAction;
38class TDEToggleAction;
39class TDERadioAction;
40class KStatusBarLabel;
41
42class DCOPObject;
43
44namespace KPlato
45{
46
47class AccountsView;
48class GanttView;
49class PertView;
50class ResourceView;
51//class ReportView;
52class Part;
53class Node;
54class Project;
55class Relation;
56class Context;
57
58class View : public KoView {
59 TQ_OBJECT
60
61
62public:
63 View(Part* part, TQWidget* parent=0, const char* name=0);
64 ~View();
68 virtual void setZoom(double zoom);
69
70 Part *getPart()const;
71
72 Project& getProject() const;
73
74 virtual void setupPrinter(KPrinter &printer);
75 virtual void print(KPrinter &printer);
76
77 TQPopupMenu *popupMenu(const TQString& name);
78
79 void projectCalculate();
80
81 virtual DCOPObject* dcopObject();
82
83 virtual bool setContext(Context &context);
84 virtual void getContext(Context &context) const;
85
86 void setTaskActionsEnabled(TQWidget *w, bool on);
87 void setScheduleActionsEnabled();
88
89public slots:
90 void slotUpdate(bool calculate);
91 void slotEditResource();
92 void slotEditCut();
93 void slotEditCopy();
94 void slotEditPaste();
95 void slotViewGantt();
96 void slotViewExpected();
97 void slotViewOptimistic();
98 void slotViewPessimistic();
99
100 void slotViewGanttResources();
101 void slotViewGanttTaskName();
102 void slotViewGanttTaskLinks();
103 void slotViewGanttProgress();
104 void slotViewGanttFloat();
105 void slotViewGanttCriticalTasks();
106 void slotViewGanttCriticalPath();
107 void slotViewGanttNoInformation();
108 void slotViewTaskAppointments();
109 void slotViewPert();
110 void slotViewResources();
111 void slotViewResourceAppointments();
112 void slotViewAccounts();
113 void slotAddTask();
114 void slotAddSubTask();
115 void slotAddMilestone();
116 void slotProjectEdit();
117 void slotDefineWBS();
118 void slotGenerateWBS();
119 void slotConfigure();
120 void slotAddRelation(Node *par, Node *child);
121 void slotModifyRelation(Relation *rel);
122 void slotAddRelation(Node *par, Node *child, int linkType);
123 void slotModifyRelation(Relation *rel, int linkType);
124
125 void setBaselineMode(bool on);
126
127 void slotExportGantt(); // testing
128 void setTaskActionsEnabled(bool on);
129
130 void slotRenameNode(Node *node, const TQString& name);
131
132 void slotPopupMenu(const TQString& menuname, const TQPoint & pos);
133
134protected slots:
135 void slotProjectCalendar();
136 void slotProjectWorktime();
137 void slotProjectCalculate();
138 void slotProjectCalculateExpected();
139 void slotProjectCalculateOptimistic();
140 void slotProjectCalculatePessimistic();
141 void slotProjectAccounts();
142 void slotProjectResources();
143 void slotViewReportDesign();
144 void slotViewReports();
145
146 void slotOpenNode();
147 void slotTaskProgress();
148 void slotDeleteTask();
149 void slotIndentTask();
150 void slotUnindentTask();
151 void slotMoveTaskUp();
152 void slotMoveTaskDown();
153
154 void slotConnectNode();
155 void slotChanged(TQWidget *);
156 void slotChanged();
157
158 void slotAboutToShow(TQWidget *widget);
159
160#ifndef NDEBUG
161 void slotPrintDebug();
162 void slotPrintSelectedDebug();
163 void slotPrintCalendarDebug();
164 void slotPrintTestDebug();
165#else
166 static void slotPrintDebug() { };
167 static void slotPrintSelectedDebug() { };
168 static void slotPrintCalendarDebug() { };
169 static void slotPrintTestDebug() { };
170#endif
171
172protected:
173 virtual void updateReadWrite(bool readwrite);
174 Node *currentTask();
175 void updateView(TQWidget *widget);
176
177private:
178 GanttView *m_ganttview;
179 TQHBoxLayout *m_ganttlayout;
180 PertView *m_pertview;
181 TQHBoxLayout *m_pertlayout;
182 TQWidgetStack *m_tab;
183 ResourceView *m_resourceview;
184 AccountsView *m_accountsview;
185// ReportView *m_reportview;
186 TQPtrList<TQString> m_reportTemplateFiles;
187
188 bool m_baselineMode;
189
190 int m_viewGrp;
191 int m_defaultFontSize;
192 int m_currentEstimateType;
193
194 bool m_updateGanttview;
195 bool m_updateResourceview;
196 bool m_updateAccountsview;
197
198 KStatusBarLabel *m_estlabel;
199
200 DCOPObject* m_dcop;
201
202 // ------ Edit
203 TDEAction *actionCut;
204 TDEAction *actionCopy;
205 TDEAction *actionPaste;
206
207 TDEAction *actionIndentTask;
208 TDEAction *actionUnindentTask;
209 TDEAction *actionMoveTaskUp;
210 TDEAction *actionMoveTaskDown;
211
212 // ------ View
213 TDEAction *actionViewGantt;
214 TDERadioAction *actionViewExpected;
215 TDERadioAction *actionViewOptimistic;
216 TDERadioAction *actionViewPessimistic;
217
218 TDEToggleAction *actionViewGanttResources;
219 TDEToggleAction *actionViewGanttTaskName;
220 TDEToggleAction *actionViewGanttTaskLinks;
221 TDEToggleAction *actionViewGanttProgress;
222 TDEToggleAction *actionViewGanttFloat;
223 TDEToggleAction *actionViewGanttCriticalTasks;
224 TDEToggleAction *actionViewGanttCriticalPath;
225 TDEToggleAction *actionViewGanttNotScheduled;
226 TDEToggleAction *actionViewTaskAppointments;
227 TDEAction *actionViewPert;
228 TDEAction *actionViewResources;
229 TDEToggleAction *actionViewResourceAppointments;
230 TDEAction *actionViewAccounts;
231 TDEAction *actionViewReports;
232
233 // ------ Insert
234 TDEAction *actionAddTask;
235 TDEAction *actionAddSubtask;
236 TDEAction *actionAddMilestone;
237
238 // ------ Project
239 TDEAction *actionEditMainProject;
240 TDEAction *actionEditStandardWorktime;
241 TDEAction *actionEditCalendar;
242 TDEAction *actionEditAccounts;
243 TDEAction *actionEditResources;
244 TDEActionMenu *actionCalculate;
245 TDEAction *actionCalculateExpected;
246 TDEAction *actionCalculateOptimistic;
247 TDEAction *actionCalculatePessimistic;
248 // ------ Reports
249 TDEAction *actionFirstpage;
250 TDEAction *actionPriorpage;
251 TDEAction *actionNextpage;
252 TDEAction *actionLastpage;
253
254 // ------ Tools
255 TDEAction *actionDefineWBS;
256 TDEAction *actionGenerateWBS;
257
258 // ------ Export (testing)
259 TDEAction *actionExportGantt;
260
261 // ------ Settings
262 TDEAction *actionConfigure;
263
264 // ------ Popup
265 TDEAction *actionOpenNode;
266 TDEAction *actionTaskProgress;
267 TDEAction *actionDeleteTask;
268 TDEAction *actionEditResource;
269
270 //Test
271 TDEAction *actNoInformation;
272};
273
274} //Kplato namespace
275
276#endif