summaryrefslogtreecommitdiffstats
path: root/kmag/kmag.h
blob: a834da55b79215ad6488e30503397773119761eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
/***************************************************************************
                          kmag.h  -  description
                             -------------------
    begin                : Mon Feb 12 23:45:41 EST 2001
    copyright            : (C) 2001 by Sarang Lakare
    email                : [email protected]
    copyright            : (C) 2003-2004 by Olaf Schmidt
    email                : [email protected]
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/


#ifndef KMAG_H
#define KMAG_H


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "kmagzoomview.h"

#include <vector>
// include files for TQt
#include <tqstringlist.h>

// include files for KDE
#include <kapplication.h>
#include <kmainwindow.h>
#include <kdockwidget.h>
#include <kaction.h>
#include <kaccel.h>
#include <knuminput.h>

/**
  * The base class for Kmag application windows. It sets up the main
  * window and reads the config file as well as providing a menubar, toolbar
  * and statusbar. An instance of KmagView creates your center view, which is connected
  * to the window's Doc object.
  * KmagApp reimplements the methods that KMainWindow provides for main window handling and supports
  * full session management as well as using KActions.
  * @see KMainWindow
  * @see TDEApplication
  * @see TDEConfig
  *
  * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
  * @version KDevelop version 1.2 code generation
  */
class KmagApp : public KMainWindow
{
  Q_OBJECT
  

  public:
    /**
     * Construtor of KmagApp, calls all init functions to create the application.
     */
    KmagApp(TQWidget* parent=0, const char* name=0);

    /// Default destructor
    ~KmagApp();



  protected:
    /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
     * file
     */
    void saveOptions();
    /** read general Options again and initialize all variables like the recent file list
     */
    void readOptions();
    /** initializes the KActions of the application */
    void initActions();

    /** creates the centerwidget of the KTMainWindow instance and sets it as the view
     */
    void initView();

    /// Initialize all connections
    void initConnections();

    virtual bool queryClose();

    /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
     * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
     * properties.
     * @see KTMainWindow#queryExit
     * @see KTMainWindow#closeEvent
     */
    virtual bool queryExit();

  public slots:
    /** open a new application window by creating a new instance of KmagApp */
    void slotFileNewWindow();

    /** print the actual file */
    void slotFilePrint();
    
    void slotFileQuit();

    /** put the marked text/object into the clipboard
     */
    void copyToClipBoard();

    /// Toggle the refreshing of the window
    void slotToggleRefresh();

    void slotModeFollowMouse();
    void slotModeSelWin();
    void slotModeEdgeTop();
    void slotModeEdgeLeft();
    void slotModeEdgeRight();
    void slotModeEdgeBottom();

    /// Zooms in
    void zoomIn();

    /// Zooms out
    void zoomOut();

    /// Save the zoomed image
    void saveZoomPixmap();

    /// Sets the zoom index to index
    void setZoomIndex(int index);

    /// Sets the invertation mode
    void slotToggleInvert();

    /// Sets the rotation index to index
    void setRotationIndex(int index);

    /// Sets the fps index to index
    void setFPSIndex(int index);

    /// Shows/hides the mouse cursor
    void showMouseCursor(bool show);

    void slotShowMenu();
    void slotShowMainToolBar();
    void slotShowViewToolBar();
    void slotShowSettingsToolBar();

    void slotToggleHideCursor();

    /// Opens shortcut key configuration dialogue
    void slotConfKeys();

    /// Called when toolbar config is updated
    void slotNewToolbarConfig();

    /// Called when "configure toolbar" is clicked
    void slotEditToolbars();

    void contextMenu(TQPoint pos);

  signals:
    /// This signal is raised whenever the index into the zoom array is changed
    void updateZoomIndex(int);

    /// This signal is raised whenever the zoom value changes
    void updateZoomValue(float);

    /// This signal is raised whenever the index into the rotation array is changed
    void updateRotationIndex(int);

    /// This signal is raised whenever the rotation value changes
    void updateRotationValue(int);

    /// This signal is raised whenever the index into the fps array is changed
    void updateFPSIndex(int);

    /// This signal is raised whenever the fps value changes
    void updateFPSValue(float);

  private:

    void setEdgeMode (KToggleAction *mode);
    void unsetEdgeMode (KToggleAction *mode);

    int edgesize;

    /// the configuration object of the application
    TDEConfig *config;

    // KAction pointers to enable/disable actions
    KAction *fileNewWindow, *m_pSnapshot, *m_pCopy, *m_keyConf, *m_toolConf;
    KAction *m_pPrint;
    KAction *m_pZoomIn;
    KAction *m_pZoomOut;
    KAction *m_pQuit;
    KAction *refreshSwitch;
    KToggleAction *m_pInvert, *m_pShowMenu, *m_pShowMainToolBar, *m_pShowViewToolBar, *m_pShowSettingsToolBar;
    KSelectAction *m_pZoomBox, *m_pRotationBox, *m_pFPSBox;

    /// zoom slider
    KIntNumInput *m_zoomSlider;

    /// Current index into the zoomArray
    unsigned int m_zoomIndex;

    /// Current index into the rotationArray
    unsigned int m_rotationIndex;

    /// Current index into the fpsArray
    unsigned int m_fpsIndex;

    TQStringList zoomArrayString;
    std::vector<float> zoomArray;

    TQStringList rotationArrayString;
    std::vector<int> rotationArray;

    TQStringList fpsArrayString;
    std::vector<float> fpsArray;

  KMagZoomView* m_zoomView;
  KToggleAction *m_hideCursor;
  KRadioAction *m_modeFollowMouse, *m_modeSelWin;
  KRadioAction *m_modeEdgeTop, *m_modeEdgeLeft, *m_modeEdgeRight, *m_modeEdgeBottom;

  /// Stores the non-zero cursor type to be used
  unsigned int m_mouseCursorType;

  unsigned int m_defaultMouseCursorType;
};


#endif // KMAG_H