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 ***************************************************************************/
11 /***************************************************************************
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
18 ***************************************************************************/
24 #include "kmagzoomview.h"
27 // include files for Qt
28 #include <QStringList>
30 #include <QContextMenuEvent>
32 // include files for KDE
33 #include <kmainwindow.h>
34 #include <k3dockwidget.h>
36 #include <knuminput.h>
40 * The base class for Kmag application windows. It sets up the main
41 * window and reads the config file as well as providing a menubar, toolbar
42 * and statusbar. An instance of KmagView creates your center view, which is connected
43 * to the window's Doc object.
44 * KmagApp reimplements the methods that KMainWindow provides for main window handling and supports
45 * full session management as well as using KActions.
50 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
51 * @version KDevelop version 1.2 code generation
53 class KmagApp
: public KMainWindow
59 * Construtor of KmagApp, calls all init functions to create the application.
61 KmagApp(QWidget
* parent
=0, const char* name
=0);
63 /// Default destructor
69 /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
73 /** read general Options again and initialize all variables like the recent file list
76 /** initializes the KActions of the application */
79 /** creates the centerwidget of the KTMainWindow instance and sets it as the view
83 /// Initialize all connections
84 void initConnections();
86 virtual bool queryClose();
88 /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
89 * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
91 * @see KTMainWindow#queryExit
92 * @see KTMainWindow#closeEvent
94 virtual bool queryExit();
96 /// Catch context menu events
97 void contextMenuEvent ( QContextMenuEvent
* e
);
100 /** open a new application window by creating a new instance of KmagApp */
101 void slotFileNewWindow();
103 /** print the actual file */
104 void slotFilePrint();
108 /** put the marked text/object into the clipboard
110 void copyToClipBoard();
112 /// Toggle the refreshing of the window
113 void slotToggleRefresh();
115 void slotModeFollowMouse();
116 void slotModeWholeScreen();
117 void slotModeSelWin();
125 /// Save the zoomed image
126 void saveZoomPixmap();
128 /// Sets the zoom index to index
129 void setZoomIndex(int index
);
131 /// Sets the rotation index to index
132 void setRotationIndex(int index
);
134 /// Sets the fps index to index
135 void setFPSIndex(int index
);
137 /// Shows/hides the mouse cursor
138 void showMouseCursor(bool show
);
141 void slotShowMainToolBar();
142 void slotShowViewToolBar();
143 void slotShowSettingsToolBar();
145 void slotToggleHideCursor();
147 /// Opens shortcut key configuration dialog
150 /// Called when toolbar config is updated
151 void slotNewToolbarConfig();
153 /// Called when "configure toolbar" is clicked
154 void slotEditToolbars();
157 /// This signal is raised whenever the index into the zoom array is changed
158 void updateZoomIndex(int);
160 /// This signal is raised whenever the zoom value changes
161 void updateZoomValue(float);
163 /// This signal is raised whenever the index into the rotation array is changed
164 void updateRotationIndex(int);
166 /// This signal is raised whenever the rotation value changes
167 void updateRotationValue(int);
169 /// This signal is raised whenever the index into the fps array is changed
170 void updateFPSIndex(int);
172 /// This signal is raised whenever the fps value changes
173 void updateFPSValue(float);
176 /// the configuration object of the application
177 KSharedConfigPtr config
;
179 // KAction pointers to enable/disable actions
180 QAction
*fileNewWindow
, *m_pSnapshot
, *m_pCopy
, *m_keyConf
, *m_toolConf
;
185 QAction
*refreshSwitch
;
186 KToggleAction
*m_pShowMenu
, *m_pShowMainToolBar
, *m_pShowViewToolBar
, *m_pShowSettingsToolBar
;
187 KSelectAction
*m_pZoomBox
, *m_pRotationBox
, *m_pFPSBox
;
190 KIntNumInput
*m_zoomSlider
;
192 /// Current index into the zoomArray
193 unsigned int m_zoomIndex
;
195 /// Current index into the rotationArray
196 unsigned int m_rotationIndex
;
198 /// Current index into the fpsArray
199 unsigned int m_fpsIndex
;
201 QStringList zoomArrayString
;
202 std::vector
<float> zoomArray
;
204 QStringList rotationArrayString
;
205 std::vector
<int> rotationArray
;
207 QStringList fpsArrayString
;
208 std::vector
<float> fpsArray
;
210 KMagZoomView
* m_zoomView
;
211 KToggleAction
*m_hideCursor
;
212 KToggleAction
*m_modeFollowMouse
, *m_modeWholeScreen
, *m_modeSelWin
;
214 /// Stores the non-zero cursor type to be used
215 unsigned int m_mouseCursorType
;
217 unsigned int m_defaultMouseCursorType
;