summaryrefslogtreecommitdiffstats
path: root/libkscan/scanparams.h
blob: a9f29d0e786f8335176adfc0e051ff917aad1c45 (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
/* This file is part of the KDE Project
   Copyright (C) 1999 Klaas Freitag <freitag@suse.de>

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

   This library 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef SCANPARAMS_H
#define SCANPARAMS_H

#include "kscandevice.h"
#include "scansourcedialog.h"

#include <tqvbox.h>
#include <tqhbox.h>

#include <tqdir.h>
#include <tqpixmap.h>

/**
  *@author Klaas Freitag
  */

class GammaDialog;
class KScanOptSet;
class TQScrollView;
class KLed;
class TQProgressDialog;
class TQPushButton;
class TQCheckBox;
class TQButtonGroup;

typedef enum { ID_SANE_DEBUG, ID_TQT_IMGIO, ID_SCAN } ScanMode;

class ScanParams : public TQVBox
{
   Q_OBJECT
  TQ_OBJECT
public:
   ScanParams( TQWidget *parent, const char *name = 0);
   ~ScanParams();
#if 0
   TQSize tqsizeHint( );
#endif
   bool connectDevice( KScanDevice* );

   KLed *operationLED() { return m_led; }

public slots:
/**
 * In this slot, a custom scan window can be set, e.g. through a preview
 * image with a area selector. The TQRect-param needs to contain values
 * between 0 and 1000, which are interpreted as tenth of percent of the
 * whole image dimensions.
 **/
void slCustomScanSize( TQRect );

   /**
    * sets the scan area to the default, which is the whole area.
    */
   void slMaximalScanSize( void );

   /**
    * starts acquireing a preview image.
    * This ends up in a preview-signal of the scan-device object
    */
   void slAcquirePreview( void );
   void slStartScan( void );

   /**
    * connect this slot to KScanOptions Signal optionChanged to be informed
    * on a options change.
    */
   void slOptionNotify( KScanOption *kso );

protected slots:
/**
 * connected to the button which opens the source selection dialog
 */
void slSourceSelect( void );
   /**
    * allows to select a file or directory for the virtuell scanner
    */
   void slFileSelect	( void );

   /**
    *  Slot to call if the virtual scanner mode is changed
    */
   void slVirtScanModeSelect( int id );

   /**
    *  Slot for result on an edit-Custom Gamma Table request.
    *  Starts a dialog.
    */
   void slEditCustGamma( void );

   /**
    *  Slot called if a Gui-Option changed due to user action, eg. the
    *  user selects another entry in a List.
    *  Action to do is to apply the new value and check, if it affects others.
    */
   void slReloadAllGui( KScanOption* );

   /**
    *  Slot called when the Edit Custom Gamma-Dialog has a new gamma table
    *  to apply. This is an internal slot.
    */
   void slApplyGamma( KGammaTable* );

   /**
    *  internal slot called when the slider for x resolution changes.
    *  In the slot, the signal scanResolutionChanged will be emitted, which
    *  is visible outside the scanparam-object to notify that the resolutions
    *  changed.
    *
    *  That is e.g. useful for size calculations
    */
   void slNewXResolution( KScanOption* );

   /**
    *  the same slot as @see slNewXResolution but for y resolution changes.
    */
   void slNewYResolution( KScanOption* );


   signals:

   /**
    *  emitted if the resolution to scan changes. This signal may be connected
    *  to slots calculating the size of the image size etc.
    *
    *  As parameters the resolutions in x- and y-direction are coming.
    */
   void scanResolutionChanged( int, int );

private:


   TQScrollView*  scannerParams( );
   void          virtualScannerParams( void );
   void          createNoScannerMsg( void );
   void          initialise( KScanOption* );
   void          setEditCustomGammaTableState();

   KScanStat     performADFScan( void );

   KScanDevice      *sane_device;
   KScanOption   *virt_filename;
   TQCheckBox     *cb_gray_preview;
   TQPushButton   *pb_edit_gtable;
   TQPushButton   *pb_source_sel;
   ADF_BEHAVE	  adf;
   TQButtonGroup  *bg_virt_scan_mode;
   ScanMode  	  scan_mode;
   TQDir          last_virt_scan_path;

   KScanOption   *xy_resolution_bind;

   KScanOptSet   *startupOptset;

   TQProgressDialog *progressDialog;

   TQPixmap       pixLineArt, pixGray, pixColor, pixHalftone, pixMiniFloppy;
   KLed          *m_led;
   bool          m_firstGTEdit;

   class ScanParamsPrivate;
   ScanParamsPrivate *d;
};

#endif