Diff of /src/PTDialogs.c [000000] .. [24dce1]  Maximize  Restore

  Switch to unified view

a b/src/PTDialogs.c
1
/* Panorama_Tools -   Generate, Edit and Convert Panoramic Images
2
   Copyright (C) 1998,1999 - Helmut Dersch  der@fh-furtwangen.de
3
   
4
   This program is free software; you can redistribute it and/or modify
5
   it under the terms of the GNU General Public License as published by
6
   the Free Software Foundation; either version 2, or (at your option)
7
   any later version.
8
9
   This program is distributed in the hope that it will be useful,
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
   GNU General Public License for more details.
13
14
   You should have received a copy of the GNU General Public License
15
   along with this program; if not, write to the Free Software
16
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
17
18
/*------------------------------------------------------------*/
19
#include "config.h"
20
21
#include "dbgutils.h"
22
23
#include "plugin-intl.h"
24
25
#include "filter.h"
26
27
#ifdef __Mac__
28
#include "sys_mac.h"
29
#endif
30
31
#ifdef __Win__
32
#include "sys_win.h"
33
#endif
34
35
#ifdef __Ansi__
36
#include "sys_ansi.h"
37
#endif
38
39
#if !__Mac__ && !__Win__ && !__Ansi__
40
#include "sys_GTK.h"
41
#endif
42
43
// Please do not change the way these dialogs work. You will certainly mess
44
// up one of the platform specific versions.
45
46
//----------------------- Dialogs for remap  -------------------------------------------
47
48
int SetRemapPrefs(  rPrefs * thePrefs )
49
{
50
  DENTER;
51
  GenDialog( rPrefs,  
52
           kSetRemapPrefs_dlg, _("Remap Options"),
53
  {
54
  CheckButton( kSetRemapPrefs_InRect,             localPrefs.from == _rectilinear);
55
  CheckButton( kSetRemapPrefs_InPano,             localPrefs.from == _panorama);
56
  CheckButton( kSetRemapPrefs_InErect,            localPrefs.from == _equirectangular);
57
  CheckButton( kSetRemapPrefs_InSphereCenter,     localPrefs.from == _spherical_cp);
58
  CheckButton( kSetRemapPrefs_InSphereTop,        localPrefs.from == _spherical_tp);
59
  CheckButton( kSetRemapPrefs_InMirror,           localPrefs.from == _mirror);
60
61
  CheckButton( kSetRemapPrefs_OutRect,            localPrefs.to == _rectilinear);
62
  CheckButton( kSetRemapPrefs_OutPano,            localPrefs.to == _panorama);
63
  CheckButton( kSetRemapPrefs_OutErect,           localPrefs.to == _equirectangular);
64
  CheckButton( kSetRemapPrefs_OutSphereCenter,    localPrefs.to == _spherical_cp);
65
  CheckButton( kSetRemapPrefs_OutSphereTop,       localPrefs.to == _spherical_tp);
66
  CheckButton( kSetRemapPrefs_OutMirror,          localPrefs.to == _mirror);
67
  },
68
  {
69
  SetText( kSetRemapPrefs_Hfov, "%g", localPrefs.hfov );
70
  SetText( kSetRemapPrefs_Vfov, "%g", localPrefs.vfov );
71
  }, 
72
  {
73
  GetText( kSetRemapPrefs_Hfov, "%lf", &localPrefs.hfov );
74
  GetText( kSetRemapPrefs_Vfov, "%lf", &localPrefs.vfov );
75
  },
76
  {
77
  case kSetRemapPrefs_InRect:
78
  localPrefs.from = _rectilinear;
79
  break;
80
  case kSetRemapPrefs_InPano:
81
  localPrefs.from = _panorama;
82
  break;
83
  case kSetRemapPrefs_InErect:
84
  localPrefs.from = _equirectangular;
85
  break;
86
  case kSetRemapPrefs_InSphereCenter:
87
  localPrefs.from = _spherical_cp;
88
  break;
89
  case kSetRemapPrefs_InSphereTop:
90
  localPrefs.from = _spherical_tp;
91
  break;
92
  case kSetRemapPrefs_InMirror:
93
  localPrefs.from = _mirror;
94
  break;
95
  case kSetRemapPrefs_OutRect:
96
  localPrefs.to = _rectilinear;
97
  break;
98
  case kSetRemapPrefs_OutPano:
99
  localPrefs.to = _panorama;
100
  break;
101
  case kSetRemapPrefs_OutErect:
102
  localPrefs.to = _equirectangular;
103
  break;
104
  case kSetRemapPrefs_OutSphereCenter:
105
  localPrefs.to = _spherical_cp;
106
  break;
107
  case kSetRemapPrefs_OutSphereTop:
108
  localPrefs.to = _spherical_tp;
109
  break;
110
  case kSetRemapPrefs_OutMirror:
111
  localPrefs.to = _mirror;
112
  break;
113
  case kSetRemapPrefs_SetPrefs:
114
  if( setSizePrefs( gsPrPtr, gTrPtr->mode & _hostCanResize ))
115
    {
116
      writePrefs((char*) gsPrPtr, _sizep );
117
    }
118
  break;
119
  }, SetRem)
120
  DEXIT;
121
}
122
123
//-------------------------- Dialogs for perspective  -------------------------------------------
124
125
int SetPerspectivePrefs(  pPrefs * thePrefs )
126
{
127
  DENTER;
128
  GenDialog( pPrefs,  
129
           kSetPerspectivePrefs_dlg   , _("Perspective Options"),
130
  {
131
  CheckButton( kSetPerspectivePrefs_InRect,       localPrefs.format == _rectilinear);
132
  CheckButton( kSetPerspectivePrefs_InSphere,     localPrefs.format == _spherical_tp);
133
  CheckButton( kSetPerspectivePrefs_Degree,       !localPrefs.unit_is_cart );
134
  CheckButton( kSetPerspectivePrefs_Points,       localPrefs.unit_is_cart);
135
  },
136
  {
137
  SetText( kSetPerspectivePrefs_X,        "%g", localPrefs.x_alpha );
138
  SetText( kSetPerspectivePrefs_Y,        "%g", localPrefs.y_beta );
139
  SetText( kSetPerspectivePrefs_Hfov,     "%g", localPrefs.hfov );
140
  SetText( kSetPerspectivePrefs_Gamma,    "%g", localPrefs.gamma );
141
  SetText( kSetPerspectivePrefs_Width,    "%ld", localPrefs.width );
142
  SetText( kSetPerspectivePrefs_Height,   "%ld", localPrefs.height );
143
  },
144
  {
145
  GetText( kSetPerspectivePrefs_X,        "%lf", &localPrefs.x_alpha );
146
  GetText( kSetPerspectivePrefs_Y,        "%lf", &localPrefs.y_beta );
147
  GetText( kSetPerspectivePrefs_Hfov,     "%lf", &localPrefs.hfov );
148
  GetText( kSetPerspectivePrefs_Gamma,    "%lf", &localPrefs.gamma );
149
  GetText( kSetPerspectivePrefs_Width,    "%ld", &localPrefs.width );
150
  GetText( kSetPerspectivePrefs_Height,   "%ld", &localPrefs.height );
151
  },
152
  {
153
  case kSetPerspectivePrefs_InRect:
154
  localPrefs.format = _rectilinear;
155
  break;
156
  case kSetPerspectivePrefs_InSphere:
157
  localPrefs.format = _spherical_tp;
158
  break;
159
  case kSetPerspectivePrefs_Degree:
160
  localPrefs.unit_is_cart = FALSE;
161
  break;
162
  case kSetPerspectivePrefs_Points    :
163
  localPrefs.unit_is_cart = TRUE;
164
  break;
165
  case kSetPerspectivePrefs_Keep:
166
  SetText( kSetPerspectivePrefs_Width, "%ld", gTrPtr->src->width );
167
  SetText( kSetPerspectivePrefs_Height, "%ld", gTrPtr->src->height );
168
  break;
169
  case kSetPerspectivePrefs_SetPrefs:
170
  if( setSizePrefs( gsPrPtr, gTrPtr->mode & _hostCanResize ))
171
    {
172
      writePrefs((char*) gsPrPtr, _sizep );
173
    }
174
  break;
175
  }, SetPerspPrefs )
176
  DEXIT;
177
}
178
      
179
// ---------------- Dialogs for correct ------------------------------------------------
180
181
int SetCorrectPrefs( cPrefs * thePrefs )
182
{
183
  DENTER;
184
  GenDialog( cPrefs,  
185
           kSetCorrectPrefs_dlg, _("Correction"), 
186
  {
187
  CheckButton( kSetCorrectPrefs_Radial,       localPrefs.radial);
188
  CheckButton( kSetCorrectPrefs_Horizontal,   localPrefs.horizontal );
189
  CheckButton( kSetCorrectPrefs_Vertical,     localPrefs.vertical);
190
  CheckButton( kSetCorrectPrefs_Shear,        localPrefs.shear);
191
  CheckButton( kSetCorrectPrefs_Scale,        localPrefs.resize);
192
  CheckButton( kSetCorrectPrefs_Lum,          localPrefs.luminance);
193
  CheckButton( kSetCorrectPrefs_CutFrame,     localPrefs.cutFrame);
194
  CheckButton( kSetCorrectPrefs_Fourier,      localPrefs.fourier);
195
  },;,;,
196
  {
197
  case kSetCorrectPrefs_Save:
198
  SaveOptions( &localPrefs );
199
  break;
200
  case kSetCorrectPrefs_Load:
201
  LoadOptions( &localPrefs );             
202
  break;
203
  case kSetCorrectPrefs_Radial:
204
  localPrefs.radial = !localPrefs.radial;
205
  break;
206
  case kSetCorrectPrefs_Horizontal:
207
  localPrefs.horizontal = !localPrefs.horizontal;
208
  break;
209
  case kSetCorrectPrefs_Vertical:
210
  localPrefs.vertical = !localPrefs.vertical;
211
  break;
212
  case kSetCorrectPrefs_Shear:
213
  localPrefs.shear = !localPrefs.shear;
214
  break;
215
  case kSetCorrectPrefs_Scale:
216
  localPrefs.resize = !localPrefs.resize;
217
  break;
218
  case kSetCorrectPrefs_RadialOption:
219
  SetRadialOptions(  &localPrefs );
220
  SetCorrectionRadius( &localPrefs );
221
  break;
222
  case kSetCorrectPrefs_HorizontalOption:
223
  SetHorizontalOptions(  &localPrefs );
224
  break;
225
  case kSetCorrectPrefs_VerticalOption:
226
  SetVerticalOptions(  &localPrefs );
227
  break;
228
  case kSetCorrectPrefs_ShearOption:
229
  SetShearOptions(  &localPrefs );
230
  break;
231
  case kSetCorrectPrefs_ScaleOption:
232
  SetScaleOptions(  &localPrefs );
233
  break;
234
  case kSetCorrectPrefs_Lum:
235
  localPrefs.luminance = !localPrefs.luminance;
236
  break;
237
  case kSetCorrectPrefs_LumOpt:
238
  SetLumOptions(  &localPrefs);
239
  break;
240
  case kSetCorrectPrefs_SetPrefs:
241
  if( setSizePrefs( gsPrPtr, gTrPtr->mode & _hostCanResize ))
242
    {
243
      writePrefs((char*) gsPrPtr, _sizep );
244
    }
245
  break;
246
  case kSetCorrectPrefs_CutFrame:
247
  localPrefs.cutFrame = !localPrefs.cutFrame;
248
  break;
249
  case kSetCorrectPrefs_CutOpt:
250
  SetCutOptions(  &localPrefs );
251
  break;
252
  case kSetCorrectPrefs_Fourier:
253
  localPrefs.fourier = !localPrefs.fourier;
254
  break;
255
  case kSetCorrectPrefs_FourierOpt:
256
  SetFourierOptions(  &localPrefs );
257
  break;
258
  }, SetCPrefs )
259
  DEXIT;
260
}
261
262
#if !__Mac__ && !__Win__
263
int SetFourierOptions( cPrefs * thePrefs )
264
{
265
  DENTER;
266
  GenDialog( cPrefs,  
267
           kSetFourierOptions_dlg, _("Fourier Filtering Options"), 
268
  {
269
  CheckButton( kSetFourierOptions_addBlur,    localPrefs.fourier_mode == _faddBlurr );
270
  CheckButton( kSetFourierOptions_remBlur,    localPrefs.fourier_mode == _fremoveBlurr);
271
  CheckButton( kSetFourierOptions_internal,   localPrefs.fourier_nf   == _nf_internal);
272
  CheckButton( kSetFourierOptions_custom,     localPrefs.fourier_nf   == _nf_custom);
273
  },
274
  {
275
  SetText( kSetFourierOptions_filterfactor,   "%g", localPrefs.filterfactor );
276
  SetText( kSetFourierOptions_fourier_frame,  "%g", localPrefs.fourier_frame);
277
  },
278
  {
279
  GetText( kSetFourierOptions_filterfactor,   "%lf", &localPrefs.filterfactor );
280
  GetText( kSetFourierOptions_fourier_frame,  "%lf", &localPrefs.fourier_frame);
281
  },
282
  {
283
  case kSetFourierOptions_findPSD:
284
  FindFile( &(localPrefs.psf) );
285
  break;
286
  case kSetFourierOptions_addBlur:
287
  localPrefs.fourier_mode = _faddBlurr;
288
  break;
289
  case kSetFourierOptions_remBlur:
290
  localPrefs.fourier_mode = _fremoveBlurr;
291
  break;
292
  case kSetFourierOptions_internal:
293
  localPrefs.fourier_nf   = _nf_internal;
294
  break;
295
  case kSetFourierOptions_custom:
296
  localPrefs.fourier_nf   = _nf_custom;
297
  break;
298
  case kSetFourierOptions_findNFF:
299
  FindFile( &(localPrefs.nff) );
300
  break;
301
  }, SetFrPrefs )
302
  DEXIT;
303
}
304
#endif
305
306
307
#ifdef __Win__
308
int SetFourierOptions( cPrefs * thePrefs )
309
{
310
  DENTER;
311
  GenDialog( cPrefs,  
312
           kSetFourierOptions_dlg, "Fourier Filtering Options", 
313
  {
314
  CheckButton( kSetFourierOptions_addBlur,    localPrefs.fourier_mode == _faddBlurr );
315
  CheckButton( kSetFourierOptions_remBlur,    localPrefs.fourier_mode == _fremoveBlurr);
316
  CheckButton( kSetFourierOptions_internal,   localPrefs.fourier_nf   == _nf_internal);
317
  CheckButton( kSetFourierOptions_custom,     localPrefs.fourier_nf   == _nf_custom);
318
  },
319
  {
320
  SetLbl(  kSetFourierOptions_PSDname,  (char*)&(localPrefs.psf) );
321
  SetText( kSetFourierOptions_filterfactor,   "%g", localPrefs.filterfactor );
322
  SetText( kSetFourierOptions_fourier_frame,  "%g", localPrefs.fourier_frame);
323
  },
324
  {
325
  GetLbl( kSetFourierOptions_PSDname, (char*)&(localPrefs.psf), 255 );
326
  GetText( kSetFourierOptions_filterfactor,   "%lf", &localPrefs.filterfactor );
327
  GetText( kSetFourierOptions_fourier_frame,  "%lf", &localPrefs.fourier_frame);
328
  },
329
  {
330
  case kSetFourierOptions_findPSD:
331
  {
332
    fullPath path;
333
334
    if( ! FindFile( &path ))
335
      {
336
        memcpy( &localPrefs.psf, &path, sizeof( fullPath ) );
337
        SetLbl(  kSetFourierOptions_PSDname,  (char*)&(localPrefs.psf) );
338
      }
339
  }
340
  break;
341
  case kSetFourierOptions_addBlur:
342
  localPrefs.fourier_mode = _faddBlurr;
343
  break;
344
  case kSetFourierOptions_remBlur:
345
  localPrefs.fourier_mode = _fremoveBlurr;
346
  break;
347
  case kSetFourierOptions_internal:
348
  localPrefs.fourier_nf   = _nf_internal;
349
  break;
350
  case kSetFourierOptions_custom:
351
  localPrefs.fourier_nf   = _nf_custom;
352
  break;
353
  case kSetFourierOptions_findNFF:
354
  FindFile( &(localPrefs.nff) );
355
  break;
356
  }, SetFrPrefs )
357
  DEXIT;
358
}
359
#endif
360
361
362
363
#ifdef __Mac__
364
int SetFourierOptions( cPrefs * thePrefs )
365
{
366
  DENTER;
367
  GenDialog( cPrefs,  
368
           kSetFourierOptions_dlg, "Fourier Filtering Options", 
369
  {
370
  CheckButton( kSetFourierOptions_addBlur,    localPrefs.fourier_mode == _faddBlurr );
371
  CheckButton( kSetFourierOptions_remBlur,    localPrefs.fourier_mode == _fremoveBlurr);
372
  CheckButton( kSetFourierOptions_scale,      localPrefs.fourier_mode == _fresize);
373
  CheckButton( kSetFourierOptions_internal,   localPrefs.fourier_nf   == _nf_internal);
374
  CheckButton( kSetFourierOptions_custom,     localPrefs.fourier_nf   == _nf_custom);
375
  ConvFileName( &(localPrefs.psf), &numString[120]); 
376
  SetLbl(  kSetFourierOptions_PSDname, &numString[120]);
377
  },
378
  {
379
  SetText( kSetFourierOptions_filterfactor,   "%g", localPrefs.filterfactor );
380
  SetText( kSetFourierOptions_fourier_frame,  "%g", localPrefs.fourier_frame);
381
  },
382
  {
383
  GetText( kSetFourierOptions_filterfactor,   "%lf", &localPrefs.filterfactor );
384
  GetText( kSetFourierOptions_fourier_frame,  "%lf", &localPrefs.fourier_frame);
385
  },
386
  {
387
  case kSetFourierOptions_findPSD: 
388
  FindFile( &(localPrefs.psf) );
389
  break;
390
  case kSetFourierOptions_addBlur:
391
  localPrefs.fourier_mode = _faddBlurr;
392
  break;
393
  case kSetFourierOptions_scale:
394
  localPrefs.fourier_mode = _fresize;
395
  break;
396
  case kSetFourierOptions_remBlur:
397
  localPrefs.fourier_mode = _fremoveBlurr;
398
  break;
399
  case kSetFourierOptions_internal:
400
  localPrefs.fourier_nf   = _nf_internal;
401
  break;
402
  case kSetFourierOptions_custom:
403
  localPrefs.fourier_nf   = _nf_custom;
404
  break;
405
  case kSetFourierOptions_findNFF:
406
  FindFile( &(localPrefs.nff) );
407
  break;
408
  }, SetFrPrefs )
409
  DEXIT;
410
}
411
#endif
412
413
int SetLumOptions(  cPrefs * thePrefs )
414
{
415
  DENTER;
416
  GenDialog( cPrefs,  
417
           kSetLumOptions_dlg, _("Luminance Correction Options"),;,
418
  {
419
  switch( gTrPtr->src->dataformat )
420
    {
421
    case _RGB:    SetLbl( kSetLumOptions_RedText,     _("Red"));
422
      SetLbl( kSetLumOptions_GreenText,   _("Green"));
423
      SetLbl( kSetLumOptions_BlueText,    _("Blue"));
424
      break;
425
    case _Lab:    SetLbl( kSetLumOptions_RedText,     _("Lightness"));
426
      SetLbl( kSetLumOptions_GreenText,   _("Color a"));
427
      SetLbl( kSetLumOptions_BlueText,    _("Color b"));
428
      break;
429
    }
430
  SetText( kSetLumOptions_Red,    "%g", localPrefs.lum_params[0] );
431
  SetText( kSetLumOptions_Green,  "%g", localPrefs.lum_params[1] );
432
  SetText( kSetLumOptions_Blue,   "%g", localPrefs.lum_params[2] );
433
  },
434
  {
435
  GetText( kSetLumOptions_Red,    "%lf", &localPrefs.lum_params[0] );
436
  GetText( kSetLumOptions_Green,  "%lf", &localPrefs.lum_params[1] );
437
  GetText( kSetLumOptions_Blue,   "%lf", &localPrefs.lum_params[2] );
438
  },;,
439
           SetLumOpt)
440
  DEXIT;
441
}
442
443
int SetRadialOptions(  cPrefs * thePrefs )
444
{
445
  DENTER;
446
  GenDialog(cPrefs,  
447
          kSetRadialOptions_dlg, /*"Radial Shift Options"*/"Set Polynomial Coefficients for Radial Shift" /*Changed by Kekus Digital August 14 2003*/,
448
  {
449
  CheckButton( kSetRadialOptions_radial,      localPrefs.correction_mode == correction_mode_radial );
450
  CheckButton( kSetRadialOptions_vertical,    localPrefs.correction_mode == correction_mode_vertical  );
451
  CheckButton( kSetRadialOptions_horizontal,  localPrefs.correction_mode == correction_mode_deregister );
452
  },
453
  {
454
  SetText( kSetRadialOptions_Red0,    "%g", localPrefs.radial_params[0][0] );
455
  SetText( kSetRadialOptions_Red1,    "%g", localPrefs.radial_params[0][1] );
456
  SetText( kSetRadialOptions_Red2,    "%g", localPrefs.radial_params[0][2] );
457
  SetText( kSetRadialOptions_Red3,    "%g", localPrefs.radial_params[0][3] );
458
  SetText( kSetRadialOptions_Green0,  "%g", localPrefs.radial_params[1][0] );
459
  SetText( kSetRadialOptions_Green1,  "%g", localPrefs.radial_params[1][1] );
460
  SetText( kSetRadialOptions_Green2,  "%g", localPrefs.radial_params[1][2] );
461
  SetText( kSetRadialOptions_Green3,  "%g", localPrefs.radial_params[1][3] );
462
  SetText( kSetRadialOptions_Blue0,   "%g", localPrefs.radial_params[2][0] );
463
  SetText( kSetRadialOptions_Blue1,   "%g", localPrefs.radial_params[2][1] );
464
  SetText( kSetRadialOptions_Blue2,   "%g", localPrefs.radial_params[2][2] );
465
  SetText( kSetRadialOptions_Blue3,   "%g", localPrefs.radial_params[2][3] );
466
  },
467
  {
468
  GetText( kSetRadialOptions_Red0,    "%lf", &localPrefs.radial_params[0][0] );
469
  GetText( kSetRadialOptions_Red1,    "%lf", &localPrefs.radial_params[0][1] );
470
  GetText( kSetRadialOptions_Red2,    "%lf", &localPrefs.radial_params[0][2] );
471
  GetText( kSetRadialOptions_Red3,    "%lf", &localPrefs.radial_params[0][3] );
472
  GetText( kSetRadialOptions_Green0,  "%lf", &localPrefs.radial_params[1][0] );
473
  GetText( kSetRadialOptions_Green1,  "%lf", &localPrefs.radial_params[1][1] );
474
  GetText( kSetRadialOptions_Green2,  "%lf", &localPrefs.radial_params[1][2] );
475
  GetText( kSetRadialOptions_Green3,  "%lf", &localPrefs.radial_params[1][3] );
476
  GetText( kSetRadialOptions_Blue0,   "%lf", &localPrefs.radial_params[2][0] );
477
  GetText( kSetRadialOptions_Blue1,   "%lf", &localPrefs.radial_params[2][1] );
478
  GetText( kSetRadialOptions_Blue2,   "%lf", &localPrefs.radial_params[2][2] );
479
  GetText( kSetRadialOptions_Blue3,   "%lf", &localPrefs.radial_params[2][3] );
480
  },
481
  {
482
  case kSetRadialOptions_radial:
483
  localPrefs.correction_mode = correction_mode_radial;
484
  break;
485
  case kSetRadialOptions_vertical:
486
  localPrefs.correction_mode = correction_mode_vertical;
487
  break;
488
  case kSetRadialOptions_horizontal:
489
  localPrefs.correction_mode = correction_mode_deregister;
490
  break;
491
  },SetRadOpt)
492
  DEXIT;
493
}
494
495
int SetHorizontalOptions(  cPrefs * thePrefs )
496
{
497
  DENTER;
498
  GenDialog( cPrefs,
499
           kSetHorizontalOptions_dlg, _("Horizontal Shift Options"),;,
500
  {
501
  SetText( kSetHorizontalOptions_Red,     "%g", localPrefs.horizontal_params[0] );
502
  SetText( kSetHorizontalOptions_Green,   "%g", localPrefs.horizontal_params[1] );
503
  SetText( kSetHorizontalOptions_Blue,    "%g", localPrefs.horizontal_params[2] );
504
  },
505
  {
506
  GetText( kSetHorizontalOptions_Red,     "%lf", &localPrefs.horizontal_params[0] );
507
  GetText( kSetHorizontalOptions_Green,   "%lf", &localPrefs.horizontal_params[1] );
508
  GetText( kSetHorizontalOptions_Blue,    "%lf", &localPrefs.horizontal_params[2] );
509
  }, ;,SetHorOpt)
510
  DEXIT;
511
}
512
513
int SetVerticalOptions(  cPrefs * thePrefs )
514
{
515
  DENTER;
516
  GenDialog(cPrefs,
517
          kSetHorizontalOptions_dlg, _("Vertical Shift Options"),;,
518
  {
519
  SetText( kSetHorizontalOptions_Red,     "%g", localPrefs.vertical_params[0] );
520
  SetText( kSetHorizontalOptions_Green,   "%g", localPrefs.vertical_params[1] );
521
  SetText( kSetHorizontalOptions_Blue,    "%g", localPrefs.vertical_params[2] );
522
  },
523
  {
524
  GetText( kSetHorizontalOptions_Red,     "%lf", &localPrefs.vertical_params[0] );
525
  GetText( kSetHorizontalOptions_Green,   "%lf", &localPrefs.vertical_params[1] );
526
  GetText( kSetHorizontalOptions_Blue,    "%lf", &localPrefs.vertical_params[2] );
527
  },; ,SetVerOpt)
528
  DEXIT;
529
}
530
531
int SetShearOptions(  cPrefs * thePrefs )
532
{
533
  DENTER;
534
  GenDialog(cPrefs,
535
          kSetShearOptions_dlg, _("Shear Options"),;,
536
  {
537
  SetLbl( kSetShearOptions_vname,  _("Vertical"));
538
  SetText( kSetShearOptions_vvar, "%g", localPrefs.shear_y);
539
  SetLbl( kSetShearOptions_hname,  _("Horizontal"));
540
  SetText( kSetShearOptions_hvar, "%g", localPrefs.shear_x);
541
  },
542
  {
543
  GetText( kSetShearOptions_vvar, "%lf", &localPrefs.shear_y);
544
  GetText( kSetShearOptions_hvar, "%lf", &localPrefs.shear_x);
545
  }, ;, SetShOpt)
546
  DEXIT;
547
}
548
549
int SetScaleOptions(  cPrefs * thePrefs )
550
{
551
  DENTER;
552
  GenDialog( cPrefs,
553
           kSetShearOptions_dlg, _("Resize Options"),;,
554
  {
555
  SetLbl( kSetShearOptions_vname,  _("Width"));
556
  SetText( kSetShearOptions_vvar, "%ld", localPrefs.width);
557
  SetLbl( kSetShearOptions_hname,  _("Height"));
558
  SetText( kSetShearOptions_hvar, "%ld", localPrefs.height);
559
  },
560
  {
561
  GetText( kSetShearOptions_vvar, "%ld", &localPrefs.width);
562
  GetText( kSetShearOptions_hvar, "%ld", &localPrefs.height);
563
  }, ;,SetScOpt)
564
  DEXIT;
565
}
566
567
568
int SetCutOptions(  cPrefs * thePrefs )
569
{
570
  DENTER;
571
  GenDialog(cPrefs,
572
          kSetShearOptions_dlg, _("Cut Frame Options"),;,
573
  {
574
  SetLbl( kSetShearOptions_vname,  _("Width"));
575
  SetText( kSetShearOptions_vvar, "%ld", localPrefs.fwidth);
576
  SetLbl( kSetShearOptions_hname,  _("Height"));
577
  SetText( kSetShearOptions_hvar, "%ld", localPrefs.fheight);
578
  },
579
  {
580
  GetText( kSetShearOptions_vvar, "%ld", &localPrefs.fwidth);
581
  GetText( kSetShearOptions_hvar, "%ld", &localPrefs.fheight);
582
  },; ,SetCutOpt)
583
  DEXIT;
584
}
585
586
587
int SetAdjustPrefs( aPrefs * thePrefs )
588
{
589
  DENTER;
590
  GenDialog( aPrefs,
591
           kSetAdjustPrefs_dlg, _("Adjust Options"),
592
  {
593
  CheckButton( kSetAdjustPrefs_Insert,        ((localPrefs.mode & 7) == _insert ));
594
  CheckButton( kSetAdjustPrefs_Extract,       ((localPrefs.mode & 7) == _extract ));
595
  CheckButton( kSetAdjustPrefs_SetCtrlPts,    ((localPrefs.mode & 7) == _readControlPoints));
596
  CheckButton( kSetAdjustPrefs_RunOptimizer,  ((localPrefs.mode & 7) == _runOptimizer));
597
  CheckButton( kSetAdjustPrefs_Options,       !(localPrefs.mode & _useScript));
598
  CheckButton( kSetAdjustPrefs_Script,        localPrefs.mode & _useScript  );
599
  },; ,; ,
600
  {
601
  case kSetAdjustPrefs_Insert:
602
  localPrefs.mode = (localPrefs.mode & _useScript) + _insert;
603
  break;
604
  case kSetAdjustPrefs_Extract:
605
  localPrefs.mode = (localPrefs.mode & _useScript) + _extract;
606
  break;
607
  case kSetAdjustPrefs_SetCtrlPts:
608
  localPrefs.mode = (localPrefs.mode & _useScript) + _readControlPoints;
609
  break;
610
  case kSetAdjustPrefs_RunOptimizer:
611
  localPrefs.mode = (localPrefs.mode & _useScript) + _runOptimizer;
612
  break;
613
  case kSetAdjustPrefs_Options:
614
  localPrefs.mode &= (~_useScript);
615
  break;
616
  case kSetAdjustPrefs_Script:
617
  localPrefs.mode |= _useScript;
618
  break;
619
  case kSetAdjustPrefs_SetOpt:
620
  SetCreateOptions(  &localPrefs );
621
  break;
622
  case kSetAdjustPrefs_FindScript :
623
  FindScript( &localPrefs );
624
  break;
625
  case kSetAdjustPrefs_SetPrefs:
626
  if( setSizePrefs( gsPrPtr, gTrPtr->mode & _hostCanResize ))
627
    {
628
      writePrefs((char*) gsPrPtr, _sizep );
629
    }
630
  break;
631
  },SetAdPrefs)
632
  DEXIT;
633
}
634
635
636
int SetCreateOptions(  aPrefs * thePrefs )
637
{
638
  DENTER;
639
  GenDialog(aPrefs,
640
          kSetCreateOptions_dlg, _("Options for Insert/Extract"),
641
  {
642
  CheckButton( kSetCreateOptions_ImR,         (localPrefs.im.format == _rectilinear ));   
643
  CheckButton( kSetCreateOptions_ImP,         (localPrefs.im.format == _panorama ));  
644
  CheckButton( kSetCreateOptions_ImFf,        (localPrefs.im.format == _fisheye_ff)); 
645
  CheckButton( kSetCreateOptions_ImFc,        (localPrefs.im.format == _fisheye_circ));   
646
  CheckButton( kSetCreateOptions_ImEq,        (localPrefs.im.format == _equirectangular));    
647
648
  CheckButton( kSetCreateOptions_PRe,         (localPrefs.pano.format == _rectilinear )); 
649
  CheckButton( kSetCreateOptions_PPa,         (localPrefs.pano.format == _panorama ));    
650
  CheckButton( kSetCreateOptions_PSp,         (localPrefs.pano.format == _equirectangular));  
651
652
  CheckButton( kSetCreateOptions_PSave,       (*localPrefs.sBuf.destName != 0));  
653
  CheckButton( kSetCreateOptions_SLoad,       (*localPrefs.sBuf.srcName != 0));
654
                  
655
  CheckButton( kSetCreateOptions_SPaste,      (localPrefs.sBuf.seam == _dest ));  
656
  CheckButton( kSetCreateOptions_SBlend,      (localPrefs.sBuf.seam == _middle ));    
657
  CheckButton( kSetCreateOptions_SIm,         (localPrefs.sBuf.colcorrect == 1 ));    
658
  CheckButton( kSetCreateOptions_SBuf,        (localPrefs.sBuf.colcorrect == 2 ));    
659
  CheckButton( kSetCreateOptions_Sboth,       (localPrefs.sBuf.colcorrect == 3 ));    
660
  CheckButton( kSetCreateOptions_Snone,       (localPrefs.sBuf.colcorrect == 0 ));
661
  },
662
  {
663
  SetText( kSetCreateOptions_ImHfov,  "%g",   localPrefs.im.hfov);
664
  SetText( kSetCreateOptions_ImW,     "%ld",  localPrefs.im.width);
665
  SetText( kSetCreateOptions_ImH,     "%ld",  localPrefs.im.height);
666
                  
667
  SetText( kSetCreateOptions_PHfov,   "%g",   localPrefs.pano.hfov);
668
  SetText( kSetCreateOptions_PWi,     "%ld",  localPrefs.pano.width);
669
  SetText( kSetCreateOptions_PHe,     "%ld",  localPrefs.pano.height);
670
  SetText( kSetCreateOptions_TY,      "%g",   localPrefs.im.yaw);
671
  SetText( kSetCreateOptions_TP,      "%g",   localPrefs.im.pitch);
672
  SetText( kSetCreateOptions_TR,      "%g",   localPrefs.im.roll);
673
  SetText( kSetCreateOptions_SF,      "%ld",  localPrefs.sBuf.feather);
674
  },
675
  {
676
  GetText( kSetCreateOptions_ImHfov,  "%lf", &localPrefs.im.hfov);
677
  GetText( kSetCreateOptions_ImW,     "%ld", &localPrefs.im.width);
678
  GetText( kSetCreateOptions_ImH,     "%ld", &localPrefs.im.height);
679
                  
680
  GetText( kSetCreateOptions_PHfov,   "%lf", &localPrefs.pano.hfov);
681
  GetText( kSetCreateOptions_PWi,     "%ld", &localPrefs.pano.width);
682
  GetText( kSetCreateOptions_PHe,     "%ld", &localPrefs.pano.height);
683
  GetText( kSetCreateOptions_TY,      "%lf", &localPrefs.im.yaw);
684
  GetText( kSetCreateOptions_TP,      "%lf", &localPrefs.im.pitch);
685
  GetText( kSetCreateOptions_TR,      "%lf", &localPrefs.im.roll);
686
  GetText( kSetCreateOptions_SF,      "%ld", &localPrefs.sBuf.feather);
687
  },
688
  {
689
  case kSetCreateOptions_ImR:
690
  localPrefs.im.format = _rectilinear;
691
  break;
692
  case kSetCreateOptions_ImP:
693
  localPrefs.im.format = _panorama;
694
  break;
695
  case kSetCreateOptions_ImFf:
696
  localPrefs.im.format = _fisheye_ff;
697
  break;
698
  case kSetCreateOptions_ImFc:
699
  localPrefs.im.format = _fisheye_circ;
700
  break;
701
  case kSetCreateOptions_ImEq:
702
  localPrefs.im.format = _equirectangular;
703
  break;
704
  case kSetCreateOptions_Correct:
705
  SetCorrectPrefs(  &localPrefs.im.cP );
706
  break;
707
  case kSetCreateOptions_PRe:
708
  localPrefs.pano.format = _rectilinear;
709
  break;
710
  case kSetCreateOptions_PPa:
711
  localPrefs.pano.format = _panorama;
712
  break;
713
  case kSetCreateOptions_PSp:
714
  localPrefs.pano.format = _equirectangular;
715
  break;
716
  case kSetCreateOptions_PSave:
717
  if(*localPrefs.sBuf.destName != 0)
718
    *localPrefs.sBuf.destName = 0;
719
  else
720
    sprintf( localPrefs.sBuf.destName, "buf" );
721
  break;
722
  case kSetCreateOptions_SLoad:
723
  if(*localPrefs.sBuf.srcName != 0)
724
    *localPrefs.sBuf.srcName = 0;
725
  else
726
    sprintf( localPrefs.sBuf.srcName, "buf" );
727
  break;
728
  case kSetCreateOptions_SPaste:
729
  localPrefs.sBuf.seam = _dest;
730
  break;
731
  case kSetCreateOptions_SBlend:
732
  localPrefs.sBuf.seam = _middle;
733
  break;
734
  case kSetCreateOptions_SIm:
735
  localPrefs.sBuf.colcorrect = 1;
736
  break;
737
  case kSetCreateOptions_SBuf:
738
  localPrefs.sBuf.colcorrect = 2;
739
  break;
740
  case kSetCreateOptions_Sboth:
741
  localPrefs.sBuf.colcorrect = 3;
742
  break;
743
  case kSetCreateOptions_Snone:
744
  localPrefs.sBuf.colcorrect = 0;
745
  break;
746
  }, SetCrOpt)
747
  DEXIT;
748
}
749
750
751
752
int   SetPanPrefs(  panControls *thePrefs )
753
{
754
  DENTER;
755
  GenDialog( panControls,
756
           kSetShearOptions_dlg, _("Pan Options"),;,
757
  {
758
  SetLbl( kSetShearOptions_vname,  _("Pan Angle"));
759
  SetLbl( kSetShearOptions_hname,  _("Zoom (%)"));
760
  SetText(  kSetShearOptions_vvar, "%g", localPrefs.panAngle);
761
  SetText(  kSetShearOptions_hvar, "%g", localPrefs.zoomFactor);
762
  },
763
  {
764
  GetText( kSetShearOptions_vvar, "%lf", &localPrefs.panAngle);
765
  GetText( kSetShearOptions_hvar, "%lf", &localPrefs.zoomFactor);
766
  }, ;, SetPanOpt)
767
  DEXIT;
768
}
769
770
 
771
int SetInterpolator( sPrefs *thePrefs) 
772
{
773
  DENTER;
774
  GenDialog( sPrefs,  kSetIntp, _("Interpolation Options"),
775
  {
776
  CheckButton( kPoly,  localPrefs.interpolator == _poly3 );                                                                           
777
  CheckButton( kSp16,  localPrefs.interpolator == _spline16 );                                                                        
778
  CheckButton( kSp36,  localPrefs.interpolator == _spline36 );                                                                            
779
  CheckButton( kSinc256,  localPrefs.interpolator == _sinc256 );                                                                          
780
  CheckButton( kSinc1024,  localPrefs.interpolator == _sinc1024 );                                                                            
781
  CheckButton( kIntrpNorm,  localPrefs.fastStep == 0 );                                                                           
782
  CheckButton( kIntrpMed,  localPrefs.fastStep == FAST_TRANSFORM_STEP_MORPH );                                                                            
783
  CheckButton( kIntrpFast,  localPrefs.fastStep == FAST_TRANSFORM_STEP_NORMAL );                                                                          
784
  },
785
  {
786
  SetText( kSetIntp_Gamma,    "%g",   localPrefs.gamma);
787
  },
788
  {
789
  GetText( kSetIntp_Gamma,    "%lf",  &localPrefs.gamma);
790
  }, 
791
  {
792
  case kPoly:
793
  localPrefs.interpolator = _poly3;
794
  break;
795
  case kSp16:
796
  localPrefs.interpolator = _spline16;
797
  break;
798
  case kSp36:
799
  localPrefs.interpolator = _spline36;
800
  break;
801
  case kSinc256:
802
  localPrefs.interpolator = _sinc256;
803
  break;
804
  case kSinc1024:
805
  localPrefs.interpolator = _sinc1024;
806
  break;
807
  case kIntrpNorm:
808
  localPrefs.fastStep = 0;
809
  break;
810
  case kIntrpMed:
811
  localPrefs.fastStep = FAST_TRANSFORM_STEP_NORMAL;
812
  break;
813
  case kIntrpFast:
814
  localPrefs.fastStep = FAST_TRANSFORM_STEP_MORPH;
815
  break;
816
  }, SetIntp )    
817
  DEXIT;
818
}
819
820
821
#ifdef __Mac__
822
// can_resize = 0 if not.
823
824
int setSizePrefs( sPrefs *thePrefs, int can_resize ) 
825
{
826
  DENTER;
827
  GenDialog( sPrefs, kSetSizePrefs_dlg, _("Preferences"),
828
  {
829
  CheckButton( kSetSizePrefs_Crop,  localPrefs.displayPart );                                                                         
830
  CheckButton( kSetSizePrefs_SFile,  localPrefs.saveFile );
831
  if(!can_resize)
832
    {
833
      CheckButton( kSetSizePrefs_OpenF,  localPrefs.launchApp );
834
      CheckButton( kSetSizePrefs_NoAlpha,  localPrefs.noAlpha );
835
    }
836
  },;,;,
837
  {
838
  case kSetSizePrefs_Crop:
839
  localPrefs.displayPart = !localPrefs.displayPart;
840
  break;
841
  case kSetSizePrefs_SFile:
842
  localPrefs.saveFile = !localPrefs.saveFile;
843
  break;
844
  case kSetSizePrefs_OpenF:
845
  localPrefs.launchApp = !localPrefs.launchApp;
846
  break;
847
  case kSetSizePrefs_BrFile:
848
  {   
849
    fullPath path;
850
    if( SaveFileAs( &path, "Save Results as...", "ptools_result" ) == 0 )
851
      {
852
        memcpy( &(localPrefs.sFile), &path,  sizeof( fullPath )); 
853
      }
854
  }
855
  break;
856
  case kSetSizePrefs_SetInt:
857
  SetInterpolator( &localPrefs );
858
  break;
859
  case kSetSizePrefs_NoAlpha:
860
  localPrefs.noAlpha = !localPrefs.noAlpha;
861
  break;
862
  }, SetSiz )
863
  DEXIT;
864
}
865
866
867
#endif
868
869
#ifdef __Win__
870
871
int setSizePrefs( sPrefs *thePrefs, int can_resize ) 
872
{
873
  DENTER;
874
  GenDialog( sPrefs, kSetSizePrefs_dlg, _("Preferences"),
875
  {
876
  CheckButton( kSetSizePrefs_Crop,    localPrefs.displayPart );                                                                           
877
  CheckButton( kSetSizePrefs_SFile,   localPrefs.saveFile );
878
  CheckButton( kSetSizePrefs_OpenF,   localPrefs.launchApp );
879
  CheckButton( kSetSizePrefs_NoAlpha,     localPrefs.noAlpha );
880
  },
881
  {
882
  SetLbl( kSetSizePrefs_FileName,  (char*)&localPrefs.sFile);
883
  SetLbl( kSetSizePrefs_AppName,   (char*)&localPrefs.lApp);
884
  },
885
  {
886
  GetLbl( kSetSizePrefs_FileName, (char*)&(localPrefs.sFile), 255);
887
  GetLbl( kSetSizePrefs_AppName, (char*)&(localPrefs.lApp), 255);
888
  },
889
  {
890
  case kSetSizePrefs_Crop:
891
  localPrefs.displayPart = !localPrefs.displayPart;
892
  break;
893
  case kSetSizePrefs_SFile:
894
  localPrefs.saveFile = !localPrefs.saveFile;
895
  break;
896
  case kSetSizePrefs_OpenF:
897
  localPrefs.launchApp = !localPrefs.launchApp;
898
  break;
899
  case kSetSizePrefs_BrFile:
900
  {   
901
    if( !SaveFileAs( &(localPrefs.sFile), "Save Results as...", "ptools_result" )  )
902
      {
903
        SetLbl( kSetSizePrefs_FileName,  (char*)&localPrefs.sFile);
904
      }
905
  }
906
  break;
907
  case kSetSizePrefs_SetInt:
908
  SetInterpolator( &localPrefs );
909
  break;
910
  case kSetSizePrefs_BrApp:
911
  {   
912
    if( !FindFile( &(localPrefs.lApp )  ) )
913
      {
914
        SetLbl( kSetSizePrefs_AppName,   (char*)&localPrefs.lApp);
915
      }
916
  }
917
  break;
918
  case kSetSizePrefs_NoAlpha:
919
  localPrefs.noAlpha = !localPrefs.noAlpha;
920
  break;
921
  }, SetSiz )
922
  DEXIT;
923
}
924
925
#endif
926
927
#if  !__Mac__  && !__Win__    // Gimp version
928
// can_resize  ignored
929
930
int setSizePrefs( sPrefs *thePrefs, int can_resize ) 
931
{
932
  DENTER;
933
  GenDialog( sPrefs, kSetSizePrefs_dlg, _("Preferences"),
934
  {
935
  CheckButton( kSetSizePrefs_Crop,  localPrefs.displayPart );                                                                         
936
  CheckButton( kSetSizePrefs_SFile,  localPrefs.saveFile );
937
  },;,;,
938
  {
939
  case kSetSizePrefs_Crop:
940
  localPrefs.displayPart = !localPrefs.displayPart;
941
  break;
942
  case kSetSizePrefs_SFile:
943
  localPrefs.saveFile = !localPrefs.saveFile;
944
  break;
945
  case kSetSizePrefs_SetInt:
946
  SetInterpolator( &localPrefs );
947
  break;
948
  }, SetSiz )
949
  DEXIT;
950
}
951
952
#endif
953
954

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks