2 * KmPlot - a math. function plotter for the KDE-Desktop
4 * Copyright (C) 1998, 1999 Klaus-Dieter M�ler
5 * 2000, 2002 kd.moeller@t-online.de
7 * This file is part of the KDE Project.
8 * KmPlot is part of the KDE-EDU Project.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 * @brief Contains the main window class MainDlg. */
28 #ifndef MainDlg_included
29 #define MainDlg_included
36 #include <kfiledialog.h>
37 #include <kpopupmenu.h>
38 #include <kstandarddirs.h>
39 #include <kparts/browserextension.h>
40 #include <kparts/part.h>
41 #include <kparts/factory.h>
46 #include "coordsconfigdialog.h"
51 #include "MainDlgIface.h"
55 class KRecentFilesAction
;
56 class SettingsPageColor
;
57 class SettingsPageFonts
;
58 class SettingsPagePrecision
;
59 class SettingsPageScaling
;
60 class KConstantEditor
;
61 class KToggleFullScreenAction
;
62 class BrowserExtension
;
65 /** @short This is the main window of KmPlot.
67 * Its central widget view contains the parser, accessable via its parser() function.
68 * @see View, View::m_parser, View::parser
70 class MainDlg
: public KParts::ReadOnlyPart
, virtual public MainDlgIface
75 /** @param sessionId used for the name of a temporary file.
76 * @param args containing a filename to be plot on startup.
79 MainDlg(QWidget
*parentWidget
, const char *widgetName
, QObject
*parent
, const char *name
);
80 /// Cleaning up a bit.
82 /// This class needs access to private members, too.
84 /// This class needs access to private members, too.
87 /// Asks the user and returns true if modified data shall be dicarded.
89 /// Is set to true if a file from an old file format was loaded
90 static bool oldfileversion
;
93 /// Implement the color edit dialog
95 /// Implement the coordinate system edit dialog
97 /// Implement the scaling edit dialog
99 /// Implement the fonts edit dialog
101 /// Implement the constants edit dialog
102 void editConstants();
103 /// Implement the dialog to enter a function plot and its options
105 /// Implement the dialog to enter a parametric plot and its options
106 void newParametric();
107 /// Implement the dialog to enter a polar plot and its options
109 /// Show/hide parameter slider windows
110 void toggleShowSlider0();
111 void toggleShowSlider1();
112 void toggleShowSlider2();
113 void toggleShowSlider3();
115 // ///I'm not sure it a delete-all-functions command is necessary
116 // void slotCleanWindow();
117 ///Save a plot i.e. save the function name and all the settings for the plot
119 ///Save a plot and choose a name for it
121 ///Call the dialog (an instance of FktDlg) to edit the functions and make changes on them
122 void slotEditPlots();
123 ///Print the current plot
125 ///Export the current plot as a png, svg or bmp picture
127 ///Implement the Configure KmPlot dialog
129 /// Calls the common function names dialog.
130 /// @see BezWnd::hideEvent
132 /// Change the coordinate systems, shows negative x-values and negative y-values.
134 /// Change the coordinate systems, shows positive x-values and negative y-values.
136 /// Change the coordinate systems, shows positive x-values and positive y-values.
140 void findMinimumValue();
141 void findMaximumValue();
145 /// Settings the standard and non standard actions of the application.
147 /// Called when a file is opened. The filename is is m_url
148 virtual bool openFile();
149 /// Loading the constants by start
150 void loadConstants();
151 /// Loading the constants when closing the program
152 void saveConstants();
153 /// Returns true if any changes are done
154 bool isModified(){return m_modified
;}
155 /// Toggle the slider with index num
156 void toggleShowSlider(int const num
);
158 /// Cached dialog to edit all functions
160 /// Central widget of the KMainWindow instance. tralala
162 ///The Recent Files action
163 KRecentFilesAction
* m_recentFiles
;
164 /// true == modifications not saved
166 ///An instance of the application config file
168 ///The KLineEdit which is in the toolbar
169 KLineEdit
* m_quickEdit
;
170 ///A Configure KmPlot dialog instance
171 KConfigDialog
* m_settingsDialog
;
172 ///The Precision page for the Configure KmPlot dialog
173 SettingsPagePrecision
* m_generalSettings
;
174 ///The Constants page for the Configure KmPlot constants
175 KConstantEditor
* m_constantsSettings
;
177 /// A dialog used by many tools-menu-items
179 /// the popup menu shown when cling with the right mouse button on a graph in the graph widget
180 KPopupMenu
*m_popupmenu
;
181 /// Loads and saves the user's file.
183 /// Set to true if the application is readonly
185 /// MainDlg's parent widget
189 /// The axes config dialogs
190 CoordsConfigDialog
* coordsDialog
;
194 * When you click on a File->Open Recent file, it'll open
195 * @param url name of the url to open
197 void slotOpenRecent( const KURL
&url
);
198 ///Update settings when there is a change in the Configure KmPlot dialog
199 void updateSettings();
201 * Manages the LineEdit content after returnPressed() is emitted.
202 * @param f_str_const the content of the KLineEdit
204 void slotQuickEdit( const QString
& f_str_const
);
206 void setReadOnlyStatusBarText(const QString
&);
208 /// slots for the settings-menu
209 void optionsConfigureKeys();
210 void optionsConfigureToolbars();
213 class KmPlotPartFactory
: public KParts::Factory
218 virtual ~KmPlotPartFactory();
219 virtual KParts::Part
* createPartObject( QWidget
*parentWidget
, const char *widgetName
,
220 QObject
*parent
, const char *name
,
221 const char *classname
, const QStringList
&args
);
222 static KInstance
* instance();
225 static KInstance
* s_instance
;
226 static KAboutData
* s_about
;
229 class BrowserExtension
: public KParts::BrowserExtension
233 BrowserExtension(MainDlg
*);
236 // Automatically detected by the host.
240 #endif // MainDlg_included