4
4
#include " myConfig.h"
5
5
#include " gimage_parse.h"
6
6
#include " gimage_process.h"
7
+ #include " myFloatCtrl.h"
7
8
#include " util.h"
8
9
#include " undo.xpm"
9
10
#include " run.xpm"
@@ -279,7 +280,8 @@ class RotatePanel: public PicProcPanel
279
280
r45 = new wxRadioButton (this , ROTATE45, _ (" Rotate < 45:" ));
280
281
b->Add (r45 , 0 , wxALIGN_LEFT | wxALL, 1 );
281
282
282
- rotate = new rotateSlider (this , wxID_ANY, initialvalue);
283
+ // rotate = new rotateSlider(this, wxID_ANY, initialvalue);
284
+ rotate = new myFloatCtrl (this , wxID_ANY, " " , 0.0 );
283
285
b->Add (rotate , 0 , wxALIGN_LEFT | wxALL, 1 );
284
286
285
287
@@ -311,7 +313,10 @@ class RotatePanel: public PicProcPanel
311
313
else if ((int ) initialvalue == 90 ) r90->SetValue (true );
312
314
else if ((int ) initialvalue == 180 ) r180->SetValue (true );
313
315
else if ((int ) initialvalue == 270 ) r270->SetValue (true );
314
- else r45->SetValue (true );
316
+ else {
317
+ r45->SetValue (true );
318
+ rotate->SetFloatValue (initialvalue);
319
+ }
315
320
316
321
rotateSelection ();
317
322
SetSizerAndFit (b);
@@ -328,6 +333,8 @@ class RotatePanel: public PicProcPanel
328
333
q->getCommandTree ()->Bind (wxEVT_TREE_SEL_CHANGED, &RotatePanel::OnCommandtreeSelChanged, this );
329
334
Bind (wxEVT_TIMER, &RotatePanel::OnTimer, this );
330
335
Bind (wxEVT_CHAR_HOOK, &RotatePanel::OnKey, this );
336
+ Bind (myFLOATCTRL_CHANGE, &RotatePanel::floatParamChanged, this );
337
+ Bind (myFLOATCTRL_UPDATE, &RotatePanel::floatParamUpdated, this );
331
338
Thaw ();
332
339
}
333
340
@@ -375,15 +382,43 @@ class RotatePanel: public PicProcPanel
375
382
void OnTimer (wxTimerEvent& event)
376
383
{
377
384
if (autocrop->GetValue ())
378
- q->setParams (wxString::Format (" %2.1f,autocrop" ,rotate->GetValue ()/ 10.0 ));
385
+ q->setParams (wxString::Format (" %2.1f,autocrop" ,rotate->GetFloatValue () ));
379
386
else
380
- q->setParams (wxString::Format (" %2.1f" ,rotate->GetValue ()/ 10.0 ));
387
+ q->setParams (wxString::Format (" %2.1f" ,rotate->GetFloatValue () ));
381
388
q->processPic ();
382
389
DeletePendingEvents ();
383
390
t.Stop ();
384
391
event.Skip ();
385
392
}
386
393
394
+ void floatParamChanged (wxCommandEvent& event)
395
+ {
396
+ preview->setAutocrop (autocrop->GetValue ());
397
+ preview->Rotate (rotate->GetFloatValue ());
398
+ if (thumb) {
399
+ thumb = false ;
400
+ }
401
+ else {
402
+ t.Start (500 ,wxTIMER_ONE_SHOT);
403
+ Refresh ();
404
+ Update ();
405
+ }
406
+ }
407
+
408
+ void floatParamUpdated (wxCommandEvent& event)
409
+ {
410
+ preview->setAutocrop (autocrop->GetValue ());
411
+ preview->Rotate (rotate->GetFloatValue ());
412
+ if (thumb) {
413
+ thumb = false ;
414
+ }
415
+ else {
416
+ t.Start (500 ,wxTIMER_ONE_SHOT);
417
+ Refresh ();
418
+ Update ();
419
+ }
420
+ }
421
+
387
422
void rotateSelection ()
388
423
{
389
424
double rotation;
@@ -397,7 +432,7 @@ class RotatePanel: public PicProcPanel
397
432
// preview->Show(true);
398
433
399
434
preview->setAutocrop (autocrop->GetValue ());
400
- rotation = rotate->GetValue ()/ 10.0 ;
435
+ rotation = rotate->GetFloatValue () ;
401
436
if (autocrop->GetValue ())
402
437
q->setParams (wxString::Format (" %2.1f,autocrop" ,rotation));
403
438
else
@@ -433,7 +468,7 @@ class RotatePanel: public PicProcPanel
433
468
void OnChanged (wxCommandEvent& event)
434
469
{
435
470
preview->setAutocrop (autocrop->GetValue ());
436
- preview->Rotate (rotate->GetValue ()/ 10.0 );
471
+ preview->Rotate (rotate->GetFloatValue () );
437
472
if (thumb) {
438
473
thumb = false ;
439
474
}
@@ -448,7 +483,7 @@ class RotatePanel: public PicProcPanel
448
483
void OnThumbTrack (wxCommandEvent& event)
449
484
{
450
485
thumb = true ;
451
- preview->Rotate (rotate->GetValue ()/ 10.0 );
486
+ preview->Rotate (rotate->GetFloatValue () );
452
487
event.Skip ();
453
488
Refresh ();
454
489
Update ();
@@ -458,9 +493,9 @@ class RotatePanel: public PicProcPanel
458
493
{
459
494
preview->setAutocrop (autocrop->GetValue ());
460
495
if (autocrop->GetValue ())
461
- q->setParams (wxString::Format (" %2.1f,autocrop" ,rotate->GetValue ()/ 10.0 ));
496
+ q->setParams (wxString::Format (" %2.1f,autocrop" ,rotate->GetFloatValue () ));
462
497
else
463
- q->setParams (wxString::Format (" %2.1f" ,rotate->GetValue ()/ 10.0 ));
498
+ q->setParams (wxString::Format (" %2.1f" ,rotate->GetFloatValue () ));
464
499
event.Skip ();
465
500
q->processPic ();
466
501
thumb = true ;
@@ -469,11 +504,11 @@ class RotatePanel: public PicProcPanel
469
504
void OnButton (wxCommandEvent& event)
470
505
{
471
506
double resetval = atof (myConfig::getConfig ().getValueOrDefault (" tool.rotate.initialvalue" ," 0.0" ).c_str ());
472
- rotate->SetValue (resetval);
507
+ rotate->SetFloatValue (resetval);
473
508
if (autocrop->GetValue ())
474
- q->setParams (wxString::Format (" %2.1f,autocrop" ,rotate->GetValue ()/ 10.0 ));
509
+ q->setParams (wxString::Format (" %2.1f,autocrop" ,rotate->GetFloatValue () ));
475
510
else
476
- q->setParams (wxString::Format (" %2.1f" ,rotate->GetValue ()/ 10.0 ));
511
+ q->setParams (wxString::Format (" %2.1f" ,rotate->GetFloatValue () ));
477
512
preview->Rotate (0.0 );
478
513
Refresh ();
479
514
q->processPic ();
@@ -484,7 +519,8 @@ class RotatePanel: public PicProcPanel
484
519
private:
485
520
wxCheckBox *autocrop, *enablebox;
486
521
wxRadioButton *r45, *r90, *r180, *r270, *rH, *rV;
487
- rotateSlider *rotate;
522
+ // rotateSlider *rotate;
523
+ myFloatCtrl *rotate;
488
524
wxTimer t;
489
525
RotatePreview *preview;
490
526
bool thumb;
0 commit comments