summaryrefslogtreecommitdiffstats
path: root/chalk/ui/kis_dlg_preferences.h
blob: 358241050c180d8f9a1cb5a8f45609b04f6c0fdc (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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/*
 *  preferencesdlg.h - part of KImageShop^WChalk
 *
 *  Copyright (c) 1999 Michael Koch <koch@kde.org>
 *
 *  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.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef __preferencesdlg_h__
#define __preferencesdlg_h__

#include <tqwidget.h>

#include <kdialogbase.h>

#include <kopalettemanager.h>

#include "kis_canvas.h"

#include "wdggeneralsettings.h"
#include "wdgtabletsettings.h"
#include "wdgtabletdevicesettings.h"
#include "wdgperformancesettings.h"
#include "wdgdisplaysettings.h"
#include "wdggridsettings.h"

class TQLineEdit;
class TQCheckBox;
class KURLRequester;
class WdgColorSettings;
class KisCmbIDList;
class KisID;

/**
 *  "General"-tab for preferences dialog
 */
class GeneralTab : public WdgGeneralSettings
{
    TQ_OBJECT
  

public:

    GeneralTab( TQWidget *parent = 0, const char *name = 0 );

    enumCursorStyle cursorStyle();
    enumKoDockability dockability();
    float dockerFontSize();
    
    void setDefault();

};

//=======================

class ColorSettingsTab : public TQWidget
{
    TQ_OBJECT
  

public:

    ColorSettingsTab( TQWidget *parent = 0, const char * name = 0 );

private slots:

    void refillMonitorProfiles(const KisID & s);
    void refillPrintProfiles(const KisID & s);

public:
    void setDefault();
    WdgColorSettings * m_page;
};


/**
 *  "Performance"-tab for preferences dialog
 */
class PerformanceTab : public WdgPerformanceSettings
{
TQ_OBJECT
  

public:
    PerformanceTab( TQWidget *parent = 0, const char *name = 0 );

public:
    void setDefault();
};

//=======================


/**
 *  Tablet settings tab for preferences dialog
 */
class TabletSettingsTab : public WdgTabletSettings
{
TQ_OBJECT
  

public:
    TabletSettingsTab( TQWidget *parent = 0, const char *name = 0 );

public:
    void setDefault();
    void applySettings();

private slots:
    void slotActivateDevice(int deviceIndex);
    void slotSetDeviceEnabled(bool enabled);
    void slotConfigureDevice();
    void applyTabletDeviceSettings();

#ifdef EXTENDED_X11_TABLET_SUPPORT

private:
    class DeviceSettings {
    public:
        DeviceSettings(KisCanvasWidget::X11TabletDevice *tabletDevice, bool enabled, 
                       TQ_INT32 xAxis, TQ_INT32 yAxis, TQ_INT32 pressureAxis, 
                       TQ_INT32 xTiltAxis, TQ_INT32 yTiltAxis, TQ_INT32 wheelAxis,
                       TQ_INT32 toolIDAxis, TQ_INT32 serialNumberAxis);
        DeviceSettings();

        void applySettings();

        void setEnabled(bool enabled);
        bool enabled() const;
    
        TQ_INT32 numAxes() const;

        void setXAxis(TQ_INT32 axis);
        void setYAxis(TQ_INT32 axis);
        void setPressureAxis(TQ_INT32 axis);
        void setXTiltAxis(TQ_INT32 axis);
        void setYTiltAxis(TQ_INT32 axis);
        void setWheelAxis(TQ_INT32 axis);
        void setToolIDAxis(TQ_INT32 axis);
        void setSerialNumberAxis(TQ_INT32 axis);
    
        TQ_INT32 xAxis() const;
        TQ_INT32 yAxis() const;
        TQ_INT32 pressureAxis() const;
        TQ_INT32 xTiltAxis() const;
        TQ_INT32 yTiltAxis() const;
        TQ_INT32 wheelAxis() const;
        TQ_INT32 toolIDAxis() const;
        TQ_INT32 serialNumberAxis() const;
    
    private:
        KisCanvasWidget::X11TabletDevice *m_tabletDevice;

        bool m_enabled;
        TQ_INT32 m_xAxis;
        TQ_INT32 m_yAxis;
        TQ_INT32 m_pressureAxis;
        TQ_INT32 m_xTiltAxis;
        TQ_INT32 m_yTiltAxis;
        TQ_INT32 m_wheelAxis;
        TQ_INT32 m_toolIDAxis;
        TQ_INT32 m_serialNumberAxis;
    };

    class TabletDeviceSettingsDialog : public KDialogBase {
        typedef KDialogBase super;
    
    public:
        TabletDeviceSettingsDialog(const TQString& deviceName,
                                   DeviceSettings settings,
                                   TQWidget *parent = 0,
                                   const char *name = 0);
        virtual ~TabletDeviceSettingsDialog();

        DeviceSettings settings();
    
    private:
        WdgTabletDeviceSettings *m_page;
        DeviceSettings m_settings;
    };
    
    void initTabletDevices();

    TQValueVector<DeviceSettings> m_deviceSettings;
#endif
};

//=======================


/**
 *  Display settings tab for preferences dialog
 */
class DisplaySettingsTab : public WdgDisplaySettings
{
TQ_OBJECT
  

public:
    DisplaySettingsTab( TQWidget *parent = 0, const char *name = 0 );

public:
    void setDefault();
protected slots:
    void slotUseOpenGLToggled(bool isChecked);
};

//=======================


/**
 *  Grid settings tab for preferences dialog
 */
class GridSettingsTab : public WdgGridSettingsBase {
    TQ_OBJECT
  
    public:
        GridSettingsTab(TQWidget* parent);
    public:
        void setDefault();
    private slots:
        void linkSpacingToggled(bool);
        void spinBoxHSpacingChanged(int );
        void spinBoxVSpacingChanged(int );
    private:
        bool m_linkSpacing;
};

//=======================


/**
 *  Preferences dialog of KImageShop^WKrayon^WChalk
 */
class PreferencesDialog : public KDialogBase
{
    TQ_OBJECT
  

public:

    static bool editPreferences();


protected:

    PreferencesDialog( TQWidget *parent = 0, const char *name = 0 );
    ~PreferencesDialog();

protected:

    GeneralTab* m_general;
    ColorSettingsTab* m_colorSettings;
    PerformanceTab* m_performanceSettings;
    TabletSettingsTab * m_tabletSettings;
    DisplaySettingsTab * m_displaySettings;
    GridSettingsTab* m_gridSettings;

protected slots:

    void slotDefault();

};

#endif