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
29 #include <QContextMenuEvent>
31 // include files for KDE
32 #include <kxmlguiwindow.h>
33 #include <k3dockwidget.h>
35 #include <knuminput.h>
39 * The base class for Kmag application windows. It sets up the main
40 * window and reads the config file as well as providing a menubar, toolbar
41 * and statusbar. An instance of KmagView creates your center view, which is connected
42 * to the window's Doc object.
43 * KmagApp reimplements the methods that KXmlGuiWindow provides for main window handling and supports
44 * full session management as well as using KActions.
49 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
50 * @version KDevelop version 1.2 code generation
52 class KmagApp
: public KXmlGuiWindow
58 * Construtor of KmagApp, calls all init functions to create the application.
60 KmagApp(QWidget
* parent
=0, const char* name
=0);
62 /// Default destructor
68 /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
72 /** read general Options again and initialize all variables like the recent file list
75 /** initializes the KActions of the application */
78 /** creates the centerwidget of the KTMainWindow instance and sets it as the view
82 /// Initialize all connections
83 void initConnections();
85 virtual bool queryClose();
87 /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
88 * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
90 * @see KTMainWindow#queryExit
91 * @see KTMainWindow#closeEvent
93 virtual bool queryExit();
95 /// Catch context menu events
96 void contextMenuEvent ( QContextMenuEvent
* e
);
99 /** open a new application window by creating a new instance of KmagApp */
100 void slotFileNewWindow();
102 /** print the actual file */
103 void slotFilePrint();
107 /** put the marked text/object into the clipboard
109 void copyToClipBoard();
111 /// Toggle the refreshing of the window
112 void slotToggleRefresh();
114 void slotModeFollowMouse();
115 void slotModeWholeScreen();
116 void slotModeSelWin();
124 /// Save the zoomed image
125 void saveZoomPixmap();
127 /// Sets the zoom index to index
128 void setZoomIndex(int index
);
130 /// Sets the rotation index to index
131 void setRotationIndex(int index
);
133 /// Sets the fps index to index
134 void setFPSIndex(int index
);
136 /// Shows/hides the mouse cursor
137 void showMouseCursor(bool show
);
140 void slotShowMainToolBar();
141 void slotShowViewToolBar();
142 void slotShowSettingsToolBar();
144 void slotToggleHideCursor();
146 /// Opens shortcut key configuration dialog
149 /// Called when toolbar config is updated
150 void slotNewToolbarConfig();
152 /// Called when "configure toolbar" is clicked
153 void slotEditToolbars();
155 void slotChangeZoomBoxIndex(int index
);
156 void slotChangeRotationBoxIndex(int index
);
157 void slotChangeFPSIndex(int index
);
161 /// This signal is raised whenever the index into the zoom array is changed
162 void updateZoomIndex(int);
164 /// This signal is raised whenever the zoom value changes
165 void updateZoomValue(float);
167 /// This signal is raised whenever the index into the rotation array is changed
168 void updateRotationIndex(int);
170 /// This signal is raised whenever the rotation value changes
171 void updateRotationValue(int);
173 /// This signal is raised whenever the index into the fps array is changed
174 void updateFPSIndex(int);
176 /// This signal is raised whenever the fps value changes
177 void updateFPSValue(float);
180 /// the configuration object of the application
181 KSharedConfigPtr config
;
183 // KAction pointers to enable/disable actions
184 QAction
*fileNewWindow
, *m_pSnapshot
, *m_pCopy
, *m_keyConf
, *m_toolConf
;
189 QAction
*refreshSwitch
;
190 KToggleAction
*m_pShowMenu
, *m_pShowMainToolBar
, *m_pShowViewToolBar
, *m_pShowSettingsToolBar
;
191 KSelectAction
*m_pZoomBox
, *m_pRotationBox
, *m_pFPSBox
;
194 KIntNumInput
*m_zoomSlider
;
196 /// Current index into the zoomArray
197 unsigned int m_zoomIndex
;
199 /// Current index into the rotationArray
200 unsigned int m_rotationIndex
;
202 /// Current index into the fpsArray
203 unsigned int m_fpsIndex
;
205 QStringList zoomArrayString
;
206 std::vector
<float> zoomArray
;
208 QStringList rotationArrayString
;
209 std::vector
<int> rotationArray
;
211 QStringList fpsArrayString
;
212 std::vector
<float> fpsArray
;
214 KMagZoomView
* m_zoomView
;
215 KToggleAction
*m_hideCursor
;
216 KToggleAction
*m_modeFollowMouse
, *m_modeWholeScreen
, *m_modeSelWin
;
218 /// Stores the non-zero cursor type to be used
219 unsigned int m_mouseCursorType
;
221 unsigned int m_defaultMouseCursorType
;