1 /***************************************************************************
4 begin : Mon Feb 12 23:45:41 EST 2001
5 copyright : (C) 2001 by Sarang Lakare
6 email : sarang@users.sourceforge.net
7 copyright : (C) 2003-2004 by Olaf Schmidt
8 email : ojschmidt@kde.org
9 copyright : (C) 2008 by Matthew Woehlke
10 email : mw_triad@users.sourceforge.net
11 ***************************************************************************/
13 /***************************************************************************
15 * This program is free software; you can redistribute it and/or modify *
16 * it under the terms of the GNU General Public License as published by *
17 * the Free Software Foundation; either version 2 of the License, or *
18 * (at your option) any later version. *
20 ***************************************************************************/
26 #include "kmagzoomview.h"
30 // include files for Qt
31 #include <QtGui/QContextMenuEvent>
32 #include <QtGui/QPrinter>
34 // include files for KDE
35 #include <kxmlguiwindow.h>
36 #include <k3dockwidget.h>
38 #include <knuminput.h>
42 * The base class for Kmag application windows. It sets up the main
43 * window and reads the config file as well as providing a menubar, toolbar
44 * and statusbar. An instance of KmagView creates your center view, which is connected
45 * to the window's Doc object.
46 * KmagApp reimplements the methods that KXmlGuiWindow provides for main window handling and supports
47 * full session management as well as using KActions.
52 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
53 * @version KDevelop version 1.2 code generation
55 class KmagApp
: public KXmlGuiWindow
61 * Construtor of KmagApp, calls all init functions to create the application.
63 explicit KmagApp(QWidget
* parent
=0, const char* name
=0);
65 /// Default destructor
71 /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
75 /** read general Options again and initialize all variables like the recent file list
78 /** initializes the KActions of the application */
81 /** creates the centerwidget of the KTMainWindow instance and sets it as the view
85 /// Initialize all connections
86 void initConnections();
88 virtual bool queryClose();
90 /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
91 * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
93 * @see KTMainWindow#queryExit
94 * @see KTMainWindow#closeEvent
96 virtual bool queryExit();
98 /// Catch context menu events
99 void contextMenuEvent ( QContextMenuEvent
* e
);
102 /** open a new application window by creating a new instance of KmagApp */
103 void slotFileNewWindow();
105 /** print the actual file */
106 void slotFilePrint();
110 /** put the marked text/object into the clipboard
112 void copyToClipBoard();
114 /// Toggle the refreshing of the window
115 void slotToggleRefresh();
117 void slotModeFollowMouse();
118 void slotModeWholeScreen();
119 void slotModeSelWin();
127 /// Save the zoomed image
128 void saveZoomPixmap();
130 /// Sets the zoom index to index
131 void setZoomIndex(int index
);
133 /// Sets the rotation index to index
134 void setRotationIndex(int index
);
136 /// Sets the fps index to index
137 void setFPSIndex(int index
);
139 /// Sets the color index to index
140 void setColorIndex(int index
);
142 /// Shows/hides the mouse cursor
143 void showMouseCursor(bool show
);
146 void slotShowMainToolBar();
147 void slotShowViewToolBar();
148 void slotShowSettingsToolBar();
150 void slotToggleHideCursor();
152 /// Opens shortcut key configuration dialog
155 /// Called when toolbar config is updated
156 void slotNewToolbarConfig();
158 /// Called when "configure toolbar" is clicked
159 void slotEditToolbars();
161 void slotChangeZoomBoxIndex(int index
);
162 void slotChangeRotationBoxIndex(int index
);
163 void slotChangeFPSIndex(int index
);
164 void slotChangeColorIndex(int index
);
168 /// This signal is raised whenever the index into the zoom array is changed
169 void updateZoomIndex(int);
171 /// This signal is raised whenever the zoom value changes
172 void updateZoomValue(float);
174 /// This signal is raised whenever the index into the rotation array is changed
175 void updateRotationIndex(int);
177 /// This signal is raised whenever the rotation value changes
178 void updateRotationValue(int);
180 /// This signal is raised whenever the index into the fps array is changed
181 void updateFPSIndex(int);
183 /// This signal is raised whenever the fps value changes
184 void updateFPSValue(float);
186 /// This signal is raised whenever the index into the color array is changed
187 void updateColorIndex(int);
189 /// This signal is raised whenever the color value changes
190 void updateColorValue(int);
193 /// the configuration object of the application
194 KSharedConfigPtr config
;
196 // KAction pointers to enable/disable actions
197 QAction
*fileNewWindow
, *m_pSnapshot
, *m_pCopy
, *m_keyConf
, *m_toolConf
;
202 QAction
*refreshSwitch
;
203 KToggleAction
*m_pShowMenu
, *m_pShowMainToolBar
, *m_pShowViewToolBar
, *m_pShowSettingsToolBar
;
204 KSelectAction
*m_pZoomBox
, *m_pRotationBox
, *m_pFPSBox
, *m_pColorBox
;
207 KIntNumInput
*m_zoomSlider
;
209 /// Current index into the zoomArray
210 unsigned int m_zoomIndex
;
212 /// Current index into the rotationArray
213 unsigned int m_rotationIndex
;
215 /// Current index into the fpsArray
216 unsigned int m_fpsIndex
;
218 /// Current index into the colorArray
219 unsigned int m_colorIndex
;
221 QStringList zoomArrayString
;
222 std::vector
<float> zoomArray
;
224 QStringList rotationArrayString
;
225 std::vector
<int> rotationArray
;
227 QStringList fpsArrayString
;
228 std::vector
<float> fpsArray
;
230 QStringList colorArrayString
;
231 std::vector
<int> colorArray
;
233 KMagZoomView
* m_zoomView
;
234 KToggleAction
*m_hideCursor
;
235 KToggleAction
*m_modeFollowMouse
, *m_modeWholeScreen
, *m_modeSelWin
;
237 /// Stores the non-zero cursor type to be used
238 unsigned int m_mouseCursorType
;
240 unsigned int m_defaultMouseCursorType
;
242 #ifndef QT_NO_PRINTER
243 // Keep QPrinter so settings persist
245 #endif // QT_NO_PRINTER