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 ***************************************************************************/
29 #include "kmagzoomview.h"
32 // include files for Qt
33 #include <qstringlist.h>
35 #include <QContextMenuEvent>
37 // include files for KDE
38 #include <kapplication.h>
39 #include <kmainwindow.h>
40 #include <kdockwidget.h>
43 #include <knuminput.h>
46 * The base class for Kmag application windows. It sets up the main
47 * window and reads the config file as well as providing a menubar, toolbar
48 * and statusbar. An instance of KmagView creates your center view, which is connected
49 * to the window's Doc object.
50 * KmagApp reimplements the methods that KMainWindow provides for main window handling and supports
51 * full session management as well as using KActions.
56 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
57 * @version KDevelop version 1.2 code generation
59 class KmagApp
: public KMainWindow
65 * Construtor of KmagApp, calls all init functions to create the application.
67 KmagApp(QWidget
* parent
=0, const char* name
=0);
69 /// Default destructor
75 /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
79 /** read general Options again and initialize all variables like the recent file list
82 /** initializes the KActions of the application */
85 /** creates the centerwidget of the KTMainWindow instance and sets it as the view
89 /// Initialize all connections
90 void initConnections();
92 virtual bool queryClose();
94 /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
95 * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
97 * @see KTMainWindow#queryExit
98 * @see KTMainWindow#closeEvent
100 virtual bool queryExit();
102 /// Catch context menu events
103 void contextMenuEvent ( QContextMenuEvent
* e
);
106 /** open a new application window by creating a new instance of KmagApp */
107 void slotFileNewWindow();
109 /** print the actual file */
110 void slotFilePrint();
114 /** put the marked text/object into the clipboard
116 void copyToClipBoard();
118 /// Toggle the refreshing of the window
119 void slotToggleRefresh();
121 void slotModeFollowMouse();
122 void slotModeWholeScreen();
123 void slotModeSelWin();
131 /// Save the zoomed image
132 void saveZoomPixmap();
134 /// Sets the zoom index to index
135 void setZoomIndex(int index
);
137 /// Sets the rotation index to index
138 void setRotationIndex(int index
);
140 /// Sets the fps index to index
141 void setFPSIndex(int index
);
143 /// Shows/hides the mouse cursor
144 void showMouseCursor(bool show
);
147 void slotShowMainToolBar();
148 void slotShowViewToolBar();
149 void slotShowSettingsToolBar();
151 void slotToggleHideCursor();
153 /// Opens shortcut key configuration dialogue
156 /// Called when toolbar config is updated
157 void slotNewToolbarConfig();
159 /// Called when "configure toolbar" is clicked
160 void slotEditToolbars();
163 /// This signal is raised whenever the index into the zoom array is changed
164 void updateZoomIndex(int);
166 /// This signal is raised whenever the zoom value changes
167 void updateZoomValue(float);
169 /// This signal is raised whenever the index into the rotation array is changed
170 void updateRotationIndex(int);
172 /// This signal is raised whenever the rotation value changes
173 void updateRotationValue(int);
175 /// This signal is raised whenever the index into the fps array is changed
176 void updateFPSIndex(int);
178 /// This signal is raised whenever the fps value changes
179 void updateFPSValue(float);
182 /// the configuration object of the application
185 // KAction pointers to enable/disable actions
186 KAction
*fileNewWindow
, *m_pSnapshot
, *m_pCopy
, *m_keyConf
, *m_toolConf
;
191 KAction
*refreshSwitch
;
192 KToggleAction
*m_pShowMenu
, *m_pShowMainToolBar
, *m_pShowViewToolBar
, *m_pShowSettingsToolBar
;
193 KSelectAction
*m_pZoomBox
, *m_pRotationBox
, *m_pFPSBox
;
196 KIntNumInput
*m_zoomSlider
;
198 /// Current index into the zoomArray
199 unsigned int m_zoomIndex
;
201 /// Current index into the rotationArray
202 unsigned int m_rotationIndex
;
204 /// Current index into the fpsArray
205 unsigned int m_fpsIndex
;
207 QStringList zoomArrayString
;
208 std::vector
<float> zoomArray
;
210 QStringList rotationArrayString
;
211 std::vector
<int> rotationArray
;
213 QStringList fpsArrayString
;
214 std::vector
<float> fpsArray
;
216 KMagZoomView
* m_zoomView
;
217 KToggleAction
*m_hideCursor
;
218 KRadioAction
*m_modeFollowMouse
, *m_modeWholeScreen
, *m_modeSelWin
;
220 /// Stores the non-zero cursor type to be used
221 unsigned int m_mouseCursorType
;
223 unsigned int m_defaultMouseCursorType
;