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
|
/*
SANE EPSON backend
Copyright (C) 2001, 2005, 2008 SEIKO EPSON CORPORATION
Date Author Reason
06/01/2001 N.Sasaki New
This file is part of the `iscan' program.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
As a special exception, the copyright holders give permission
to link the code of this program with the esmod library and
distribute linked combinations including the two. You must obey
the GNU General Public License in all respects for all of the
code used other then esmod.
*/
#ifndef ___PISA_VIEW_MANAGER_H
#define ___PISA_VIEW_MANAGER_H
#include <string>
#include "pisa_enums.h"
#include "pisa_settings.h"
#include "pisa_scan_manager.h"
#include "pisa_main_window.h"
#include "pisa_preview_window.h"
#include "pisa_progress_window.h"
#include "pisa_image_controls.h"
#include "pisa_gamma_correction.h"
#include "pisa_configuration.h"
#include "pisa_error.h"
#include "pisa_scan_selector.h"
#include <cstring>
#include "file-selector.h"
#include "imgstream.hh"
class view_manager
{
public:
// operation
static int create_view_manager ( int argc, char * argv [ ] );
void release_view_manager ( void );
int main ( void );
void init ( void );
void destroy ( void );
GtkWidget * create_window ( pisa_window_id id );
int close_window ( pisa_window_id id, int destroy_flag );
image_controls *get_image_controls ();
gamma_correction *get_gamma_correction ();
void * get_window_cls ( pisa_window_id id );
scan_manager * get_scan_manager ( void ) { return m_scanmanager_cls; }
void sensitive ( void );
int is_gimp ( void );
void start_scan ( void );
int update_lut (long index = -1);
int update_lut (marquee& m);
bool change_document_source (const imagetype *);
void set_device ( char * name );
char * get_device_name() const;
const settings& get_settings (void) const;
const marquee& get_marquee (long index = -1) const;
marquee& get_marquee (long index = -1);
void add_marquee (marquee **m);
void del_marquee (long index = -1);
long get_marquee_size () const;
void set_destination (long destination);
void set_resolution (long resolution);
void set_image_type (const imagetype *type);
void set_unit (long unit);
void enable_start_button (bool value);
void enable_draft_mode (bool value);
void enable_unsharp_mask (bool value);
int microsleep (size_t usec);
private:
// operation
void open_device ( void );
void close_device ( void );
void load_preference ( void );
void save_preference ( void );
int init_img_info (void);
int init_scan_param (void);
bool do_scan (iscan::imgstream& is, const iscan::file_opener& fo,
bool first_time_around = true);
int do_scan_gimp (bool first_time_around = true);
void scan_file (iscan::imgstream& is, int *status,
bool first_time_around = true);
bool scan_gimp (int *cancel,
bool first_time_around = true);
int dialog_reply( const pisa_error& err ) const;
void print (const std::string& filename) const;
bool is_multi_image (void) const;
bool wait_for_button (void) const;
bool needs_duplex_rotation (void) const;
// attribute
settings m_set;
scan_manager * m_scanmanager_cls;
main_window * m_main_cls;
preview_window * m_prev_cls;
image_controls * m_imgctrl_cls;
gamma_correction * m_gamma_cls;
config_window * m_config_cls;
file_selector * m_filsel_cls;
scan_selector * m_scansel_cls;
progress_window *_feedback;
std::string _image_format;
};
extern view_manager * g_view_manager;
inline const settings&
view_manager::get_settings (void) const
{
return m_set;
}
inline const marquee&
view_manager::get_marquee (long index) const
{
return m_set.get_marquee (index);
}
inline marquee&
view_manager::get_marquee (long index)
{
return m_set.get_marquee (index);
}
inline long
view_manager::get_marquee_size (void) const
{
return m_set.get_marquee_size ();
}
inline void
view_manager::add_marquee (marquee **m)
{
m_set.add_marquee (m);
}
inline void
view_manager::del_marquee (long index)
{
m_set.del_marquee (index);
}
inline void
view_manager::set_destination (long destination)
{
m_set.destination = destination;
}
inline void
view_manager::set_unit (long unit)
{
m_set.unit = unit;
}
inline void
view_manager::enable_start_button (bool value)
{
m_set.enable_start_button = value;
}
inline void
view_manager::enable_draft_mode (bool value)
{
m_set.enable_draft_mode = value;
}
inline void
view_manager::enable_unsharp_mask (bool value)
{
m_set.usm = (value ? 1 : 0);
}
#endif // ___PISA_VIEW_MANAGER_H
|