-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathH24Timer.cpp
3905 lines (3543 loc) · 202 KB
/
H24Timer.cpp
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//(C) 2013 Michael Johnston
#include "H24Timer.h"
//these are overused, i thought it was eloquent code use
//to reuse these dialogs, but it causes problems
//#include "AddNewProfile.h"
//#include "RenameProfile.h"
//#include "DeleteVerify.h"
#include "StopTimer.h"
#include "h24profileoverwrite.h"
#include "H24RenameProfile.h"
#include "H24AddNewProfile.h"
#include "H24DeleteProfile.h"
#include "H24CopyVerify.h"
#include <wx/msgdlg.h>
#include <wx/textfile.h>
//(*InternalHeaders(H24Timer)
#include <wx/string.h>
#include <wx/intl.h>
#include <wx/font.h>
//*)
//(*IdInit(H24Timer)
const long H24Timer::ID_STATICBOX1 = wxNewId();
const long H24Timer::ID_LISTBOX1 = wxNewId();
const long H24Timer::ID_SLIDER1 = wxNewId();
const long H24Timer::ID_SLIDER2 = wxNewId();
const long H24Timer::ID_SLIDER3 = wxNewId();
const long H24Timer::ID_SLIDER4 = wxNewId();
const long H24Timer::ID_SLIDER5 = wxNewId();
const long H24Timer::ID_SLIDER6 = wxNewId();
const long H24Timer::ID_SLIDER7 = wxNewId();
const long H24Timer::ID_SLIDER8 = wxNewId();
const long H24Timer::ID_SLIDER9 = wxNewId();
const long H24Timer::ID_SLIDER10 = wxNewId();
const long H24Timer::ID_SLIDER11 = wxNewId();
const long H24Timer::ID_SLIDER12 = wxNewId();
const long H24Timer::ID_SLIDER13 = wxNewId();
const long H24Timer::ID_SLIDER14 = wxNewId();
const long H24Timer::ID_SLIDER15 = wxNewId();
const long H24Timer::ID_SLIDER16 = wxNewId();
const long H24Timer::ID_STATICTEXT1 = wxNewId();
const long H24Timer::ID_STATICTEXT2 = wxNewId();
const long H24Timer::ID_STATICTEXT3 = wxNewId();
const long H24Timer::ID_STATICTEXT4 = wxNewId();
const long H24Timer::ID_STATICTEXT5 = wxNewId();
const long H24Timer::ID_STATICTEXT6 = wxNewId();
const long H24Timer::ID_STATICTEXT7 = wxNewId();
const long H24Timer::ID_STATICTEXT8 = wxNewId();
const long H24Timer::ID_STATICTEXT9 = wxNewId();
const long H24Timer::ID_STATICTEXT10 = wxNewId();
const long H24Timer::ID_STATICTEXT11 = wxNewId();
const long H24Timer::ID_STATICTEXT12 = wxNewId();
const long H24Timer::ID_STATICTEXT13 = wxNewId();
const long H24Timer::ID_STATICTEXT14 = wxNewId();
const long H24Timer::ID_STATICTEXT15 = wxNewId();
const long H24Timer::ID_STATICTEXT16 = wxNewId();
const long H24Timer::ID_STATICTEXT17 = wxNewId();
const long H24Timer::ID_STATICTEXT18 = wxNewId();
const long H24Timer::ID_STATICTEXT19 = wxNewId();
const long H24Timer::ID_STATICTEXT20 = wxNewId();
const long H24Timer::ID_STATICTEXT21 = wxNewId();
const long H24Timer::ID_STATICTEXT22 = wxNewId();
const long H24Timer::ID_STATICTEXT23 = wxNewId();
const long H24Timer::ID_STATICTEXT24 = wxNewId();
const long H24Timer::ID_STATICTEXT25 = wxNewId();
const long H24Timer::ID_STATICTEXT26 = wxNewId();
const long H24Timer::ID_STATICTEXT27 = wxNewId();
const long H24Timer::ID_STATICTEXT28 = wxNewId();
const long H24Timer::ID_STATICTEXT29 = wxNewId();
const long H24Timer::ID_STATICTEXT30 = wxNewId();
const long H24Timer::ID_STATICTEXT31 = wxNewId();
const long H24Timer::ID_STATICTEXT32 = wxNewId();
const long H24Timer::ID_STATICBOX2 = wxNewId();
const long H24Timer::ID_BUTTON1 = wxNewId();
const long H24Timer::ID_CHECKBOX1 = wxNewId();
const long H24Timer::ID_STATICBOX3 = wxNewId();
const long H24Timer::ID_CHOICE1 = wxNewId();
const long H24Timer::ID_STATICTEXT33 = wxNewId();
const long H24Timer::ID_LISTBOX2 = wxNewId();
const long H24Timer::ID_BUTTON2 = wxNewId();
const long H24Timer::ID_BUTTON3 = wxNewId();
const long H24Timer::ID_BUTTON4 = wxNewId();
const long H24Timer::ID_BUTTON5 = wxNewId();
const long H24Timer::ID_BUTTON6 = wxNewId();
const long H24Timer::ID_STATICTEXT34 = wxNewId();
const long H24Timer::ID_STATICTEXT35 = wxNewId();
const long H24Timer::ID_BUTTON7 = wxNewId();
const long H24Timer::ID_BUTTON8 = wxNewId();
const long H24Timer::ID_STATICTEXT36 = wxNewId();
const long H24Timer::ID_BUTTON9 = wxNewId();
const long H24Timer::ID_H24TIMER1 = wxNewId();
//*)
//for rename profile and delete profile
//extern bool yesorno;
//for profile overwrite dialog
bool savecancel;
bool timeryesorno;
bool stopcancel;
bool copyyesorno;
//for stop timer
bool stopyesorno;
extern bool istimeractive;
extern bool isIconize;
bool istimerinit;
bool timerischanged;
wxString H24RenameNameHolder;
extern bool islightprogramonstartup;
extern bool isminimizedonstartup;
//timer variables
int timercurrenthour;
int currentunit;
int getseconds;
int getminutes;
wxString wxt_timercurrenthour;
wxString wxt_timercurrenthourpadded;
//32 profiles, 24 hours (code only uses 0-23 hours)
unsigned short int h24_Channel_1 [32] [24];
unsigned short int h24_Channel_2 [32] [24];
unsigned short int h24_Channel_3 [32] [24];
unsigned short int h24_Channel_4 [32] [24];
unsigned short int h24_Channel_5 [32] [24];
unsigned short int h24_Channel_6 [32] [24];
unsigned short int h24_Channel_7 [32] [24];
unsigned short int h24_Channel_8 [32] [24];
unsigned short int h24_Channel_9 [32] [24];
unsigned short int h24_Channel_10 [32] [24];
unsigned short int h24_Channel_11 [32] [24];
unsigned short int h24_Channel_12 [32] [24];
unsigned short int h24_Channel_13 [32] [24];
unsigned short int h24_Channel_14 [32] [24];
unsigned short int h24_Channel_15 [32] [24];
unsigned short int h24_Channel_16 [32] [24];
unsigned short int issmoothtransition [32] [24];
unsigned short int transitiontime [32] [24];
wxString h24profilenames [32];
//varibles for transition calculations
unsigned short int hourdifference_Channel_1;
float timedivide_Channel_1;
float timecalculated_Channel_1;
unsigned short int hourdifference_Channel_2;
float timedivide_Channel_2;
float timecalculated_Channel_2;
unsigned short int hourdifference_Channel_3;
float timedivide_Channel_3;
float timecalculated_Channel_3;
unsigned short int hourdifference_Channel_4;
float timedivide_Channel_4;
float timecalculated_Channel_4;
unsigned short int hourdifference_Channel_5;
float timedivide_Channel_5;
float timecalculated_Channel_5;
unsigned short int hourdifference_Channel_6;
float timedivide_Channel_6;
float timecalculated_Channel_6;
unsigned short int hourdifference_Channel_7;
float timedivide_Channel_7;
float timecalculated_Channel_7;
unsigned short int hourdifference_Channel_8;
float timedivide_Channel_8;
float timecalculated_Channel_8;
unsigned short int hourdifference_Channel_9;
float timedivide_Channel_9;
float timecalculated_Channel_9;
unsigned short int hourdifference_Channel_10;
float timedivide_Channel_10;
float timecalculated_Channel_10;
unsigned short int hourdifference_Channel_11;
float timedivide_Channel_11;
float timecalculated_Channel_11;
unsigned short int hourdifference_Channel_12;
float timedivide_Channel_12;
float timecalculated_Channel_12;
unsigned short int hourdifference_Channel_13;
float timedivide_Channel_13;
float timecalculated_Channel_13;
unsigned short int hourdifference_Channel_14;
float timedivide_Channel_14;
float timecalculated_Channel_14;
unsigned short int hourdifference_Channel_15;
float timedivide_Channel_15;
float timecalculated_Channel_15;
unsigned short int hourdifference_Channel_16;
float timedivide_Channel_16;
float timecalculated_Channel_16;
//data handler variables
int h24currentprofile;
wxString h24filename;
int h24numberofprofiles;
int h24numberoflines;
int h24pos;
int h24postimes;
int h24profilecount;
int h24currenthour;
//25 lines in each profile times 32 profiles is 1600 values
wxString h24buffer [800];
//output variables for timer
unsigned short int Channel_1_timer;
unsigned short int Channel_2_timer;
unsigned short int Channel_3_timer;
unsigned short int Channel_4_timer;
unsigned short int Channel_5_timer;
unsigned short int Channel_6_timer;
unsigned short int Channel_7_timer;
unsigned short int Channel_8_timer;
unsigned short int Channel_9_timer;
unsigned short int Channel_10_timer;
unsigned short int Channel_11_timer;
unsigned short int Channel_12_timer;
unsigned short int Channel_13_timer;
unsigned short int Channel_14_timer;
unsigned short int Channel_15_timer;
unsigned short int Channel_16_timer;
//holder variables for profile color, to default to
extern unsigned short int timer_ProfileChannel_1;
extern unsigned short int timer_ProfileChannel_2;
extern unsigned short int timer_ProfileChannel_3;
extern unsigned short int timer_ProfileChannel_4;
extern unsigned short int timer_ProfileChannel_5;
extern unsigned short int timer_ProfileChannel_6;
extern unsigned short int timer_ProfileChannel_7;
extern unsigned short int timer_ProfileChannel_8;
extern unsigned short int timer_ProfileChannel_9;
extern unsigned short int timer_ProfileChannel_10;
extern unsigned short int timer_ProfileChannel_11;
extern unsigned short int timer_ProfileChannel_12;
extern unsigned short int timer_ProfileChannel_13;
extern unsigned short int timer_ProfileChannel_14;
extern unsigned short int timer_ProfileChannel_15;
extern unsigned short int timer_ProfileChannel_16;
//another spot where not over allocating array causes problems
unsigned short int hourtransitioncalculations [17] [200];
BEGIN_EVENT_TABLE(H24Timer,wxDialog)
//(*EventTable(H24Timer)
//*)
END_EVENT_TABLE()
H24Timer::H24Timer(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
//(*Initialize(H24Timer)
Create(parent, wxID_ANY, _("24-Hour Light Timer 0.1"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
SetClientSize(wxSize(820,486));
Move(wxPoint(100,100));
StaticBox1 = new wxStaticBox(this, ID_STATICBOX1, _("Light Output Levels (Different levels per hour)"), wxPoint(104,32), wxSize(408,408), 0, _T("ID_STATICBOX1"));
ListBox1 = new wxListBox(this, ID_LISTBOX1, wxPoint(8,24), wxSize(88,440), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1"));
ListBox1->SetSelection( ListBox1->Append(_("12:00 AM")) );
ListBox1->Append(_("01:00 AM"));
ListBox1->Append(_("02:00 AM"));
ListBox1->Append(_("03:00 AM"));
ListBox1->Append(_("04:00 AM"));
ListBox1->Append(_("05:00 AM"));
ListBox1->Append(_("06:00 AM"));
ListBox1->Append(_("07:00 AM"));
ListBox1->Append(_("08:00 AM"));
ListBox1->Append(_("09:00 AM"));
ListBox1->Append(_("10:00 AM"));
ListBox1->Append(_("11:00 AM"));
ListBox1->Append(_("12:00 PM"));
ListBox1->Append(_("01:00 PM"));
ListBox1->Append(_("02:00 PM"));
ListBox1->Append(_("03:00 PM"));
ListBox1->Append(_("04:00 PM"));
ListBox1->Append(_("05:00 PM"));
ListBox1->Append(_("06:00 PM"));
ListBox1->Append(_("07:00 PM"));
ListBox1->Append(_("08:00 PM"));
ListBox1->Append(_("09:00 PM"));
ListBox1->Append(_("10:00 PM"));
ListBox1->Append(_("11:00 PM"));
wxFont ListBox1Font(12,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Sans"),wxFONTENCODING_DEFAULT);
ListBox1->SetFont(ListBox1Font);
Slider1 = new wxSlider(this, ID_SLIDER1, 0, 0, 255, wxPoint(160,80), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER1"));
Slider2 = new wxSlider(this, ID_SLIDER2, 0, 0, 255, wxPoint(200,80), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER2"));
Slider3 = new wxSlider(this, ID_SLIDER3, 0, 0, 255, wxPoint(240,80), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER3"));
Slider4 = new wxSlider(this, ID_SLIDER4, 0, 0, 255, wxPoint(280,80), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER4"));
Slider5 = new wxSlider(this, ID_SLIDER5, 0, 0, 255, wxPoint(320,80), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER5"));
Slider6 = new wxSlider(this, ID_SLIDER6, 0, 0, 255, wxPoint(360,80), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER6"));
Slider7 = new wxSlider(this, ID_SLIDER7, 0, 0, 255, wxPoint(400,80), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER7"));
Slider8 = new wxSlider(this, ID_SLIDER8, 0, 0, 255, wxPoint(440,80), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER8"));
Slider9 = new wxSlider(this, ID_SLIDER9, 0, 0, 255, wxPoint(160,272), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER9"));
Slider10 = new wxSlider(this, ID_SLIDER10, 0, 0, 255, wxPoint(200,272), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER10"));
Slider11 = new wxSlider(this, ID_SLIDER11, 0, 0, 255, wxPoint(240,272), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER11"));
Slider12 = new wxSlider(this, ID_SLIDER12, 0, 0, 255, wxPoint(280,272), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER12"));
Slider13 = new wxSlider(this, ID_SLIDER13, 0, 0, 255, wxPoint(320,272), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER13"));
Slider14 = new wxSlider(this, ID_SLIDER14, 0, 0, 255, wxPoint(360,272), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER14"));
Slider15 = new wxSlider(this, ID_SLIDER15, 0, 0, 255, wxPoint(400,272), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER15"));
Slider16 = new wxSlider(this, ID_SLIDER16, 0, 0, 255, wxPoint(440,272), wxSize(24,144), wxSL_VERTICAL|wxSL_INVERSE, wxDefaultValidator, _T("ID_SLIDER16"));
StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Label"), wxPoint(160,224), wxDefaultSize, 0, _T("ID_STATICTEXT1"));
StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Label"), wxPoint(200,224), wxDefaultSize, 0, _T("ID_STATICTEXT2"));
StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("Label"), wxPoint(240,224), wxDefaultSize, 0, _T("ID_STATICTEXT3"));
StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("Label"), wxPoint(280,224), wxDefaultSize, 0, _T("ID_STATICTEXT4"));
StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("Label"), wxPoint(320,224), wxDefaultSize, 0, _T("ID_STATICTEXT5"));
StaticText6 = new wxStaticText(this, ID_STATICTEXT6, _("Label"), wxPoint(360,224), wxDefaultSize, 0, _T("ID_STATICTEXT6"));
StaticText7 = new wxStaticText(this, ID_STATICTEXT7, _("Label"), wxPoint(400,224), wxDefaultSize, 0, _T("ID_STATICTEXT7"));
StaticText8 = new wxStaticText(this, ID_STATICTEXT8, _("Label"), wxPoint(440,224), wxDefaultSize, 0, _T("ID_STATICTEXT8"));
StaticText9 = new wxStaticText(this, ID_STATICTEXT9, _("Label"), wxPoint(160,416), wxDefaultSize, 0, _T("ID_STATICTEXT9"));
StaticText10 = new wxStaticText(this, ID_STATICTEXT10, _("Label"), wxPoint(200,416), wxDefaultSize, 0, _T("ID_STATICTEXT10"));
StaticText11 = new wxStaticText(this, ID_STATICTEXT11, _("Label"), wxPoint(240,416), wxDefaultSize, 0, _T("ID_STATICTEXT11"));
StaticText12 = new wxStaticText(this, ID_STATICTEXT12, _("Label"), wxPoint(280,416), wxDefaultSize, 0, _T("ID_STATICTEXT12"));
StaticText13 = new wxStaticText(this, ID_STATICTEXT13, _("Label"), wxPoint(320,416), wxDefaultSize, 0, _T("ID_STATICTEXT13"));
StaticText14 = new wxStaticText(this, ID_STATICTEXT14, _("Label"), wxPoint(360,416), wxDefaultSize, 0, _T("ID_STATICTEXT14"));
StaticText15 = new wxStaticText(this, ID_STATICTEXT15, _("Label"), wxPoint(400,416), wxDefaultSize, 0, _T("ID_STATICTEXT15"));
StaticText16 = new wxStaticText(this, ID_STATICTEXT16, _("Label"), wxPoint(440,416), wxDefaultSize, 0, _T("ID_STATICTEXT16"));
StaticText17 = new wxStaticText(this, ID_STATICTEXT17, _("Channel 1"), wxPoint(112,64), wxDefaultSize, 0, _T("ID_STATICTEXT17"));
StaticText18 = new wxStaticText(this, ID_STATICTEXT18, _("2"), wxPoint(208,64), wxDefaultSize, 0, _T("ID_STATICTEXT18"));
StaticText19 = new wxStaticText(this, ID_STATICTEXT19, _("3"), wxPoint(248,64), wxDefaultSize, 0, _T("ID_STATICTEXT19"));
StaticText20 = new wxStaticText(this, ID_STATICTEXT20, _("4"), wxPoint(288,64), wxDefaultSize, 0, _T("ID_STATICTEXT20"));
StaticText21 = new wxStaticText(this, ID_STATICTEXT21, _("5"), wxPoint(328,64), wxDefaultSize, 0, _T("ID_STATICTEXT21"));
StaticText22 = new wxStaticText(this, ID_STATICTEXT22, _("6"), wxPoint(368,64), wxDefaultSize, 0, _T("ID_STATICTEXT22"));
StaticText23 = new wxStaticText(this, ID_STATICTEXT23, _("7"), wxPoint(408,64), wxDefaultSize, 0, _T("ID_STATICTEXT23"));
StaticText24 = new wxStaticText(this, ID_STATICTEXT24, _("8"), wxPoint(448,64), wxDefaultSize, 0, _T("ID_STATICTEXT24"));
StaticText25 = new wxStaticText(this, ID_STATICTEXT25, _("Channel 9"), wxPoint(112,256), wxDefaultSize, 0, _T("ID_STATICTEXT25"));
StaticText26 = new wxStaticText(this, ID_STATICTEXT26, _("10"), wxPoint(200,256), wxDefaultSize, 0, _T("ID_STATICTEXT26"));
StaticText27 = new wxStaticText(this, ID_STATICTEXT27, _("11"), wxPoint(240,256), wxDefaultSize, 0, _T("ID_STATICTEXT27"));
StaticText28 = new wxStaticText(this, ID_STATICTEXT28, _("12"), wxPoint(280,256), wxDefaultSize, 0, _T("ID_STATICTEXT28"));
StaticText29 = new wxStaticText(this, ID_STATICTEXT29, _("13"), wxPoint(320,256), wxDefaultSize, 0, _T("ID_STATICTEXT29"));
StaticText30 = new wxStaticText(this, ID_STATICTEXT30, _("14"), wxPoint(360,256), wxDefaultSize, 0, _T("ID_STATICTEXT30"));
StaticText31 = new wxStaticText(this, ID_STATICTEXT31, _("15"), wxPoint(400,256), wxDefaultSize, 0, _T("ID_STATICTEXT31"));
StaticText32 = new wxStaticText(this, ID_STATICTEXT32, _("16"), wxPoint(440,256), wxDefaultSize, 0, _T("ID_STATICTEXT32"));
StaticBox2 = new wxStaticBox(this, ID_STATICBOX2, _("Transition Settings"), wxPoint(528,264), wxSize(272,96), 0, _T("ID_STATICBOX2"));
Button1 = new wxButton(this, ID_BUTTON1, _("Activate 24-Hour Light Timer"), wxPoint(536,424), wxSize(272,32), 0, wxDefaultValidator, _T("ID_BUTTON1"));
Button1->SetExtraStyle( Button1->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
CheckBox1 = new wxCheckBox(this, ID_CHECKBOX1, _("Enable transition for this hour"), wxPoint(536,296), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
CheckBox1->SetValue(false);
wxFont CheckBox1Font(8,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Sans"),wxFONTENCODING_DEFAULT);
CheckBox1->SetFont(CheckBox1Font);
StaticBox3 = new wxStaticBox(this, ID_STATICBOX3, _("24-Hour Light Timer Profiles"), wxPoint(528,24), wxSize(272,224), 0, _T("ID_STATICBOX3"));
Choice1 = new wxChoice(this, ID_CHOICE1, wxPoint(688,320), wxSize(104,21), 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1"));
Choice1->SetSelection( Choice1->Append(_("5 minutes")) );
Choice1->Append(_("10 minutes"));
Choice1->Append(_("15 minutes"));
Choice1->Append(_("30 minutes"));
Choice1->Append(_("45 minutes"));
StaticText33 = new wxStaticText(this, ID_STATICTEXT33, _("Transition to next hour takes"), wxPoint(536,328), wxDefaultSize, 0, _T("ID_STATICTEXT33"));
wxFont StaticText33Font(8,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Sans"),wxFONTENCODING_DEFAULT);
StaticText33->SetFont(StaticText33Font);
ListBox2 = new wxListBox(this, ID_LISTBOX2, wxPoint(536,56), wxSize(208,128), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX2"));
ListBox2->SetSelection( ListBox2->Append(_("- Empty Profile List - ")) );
ListBox2->SetFocus();
wxFont ListBox2Font(8,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Sans"),wxFONTENCODING_DEFAULT);
ListBox2->SetFont(ListBox2Font);
Button2 = new wxButton(this, ID_BUTTON2, _("New"), wxPoint(536,208), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
Button3 = new wxButton(this, ID_BUTTON3, _("Delete"), wxPoint(712,208), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3"));
Button4 = new wxButton(this, ID_BUTTON4, _("Rename"), wxPoint(624,208), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4"));
Button5 = new wxButton(this, ID_BUTTON5, _("Move\nUp"), wxPoint(744,56), wxSize(48,64), 0, wxDefaultValidator, _T("ID_BUTTON5"));
wxFont Button5Font(8,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Sans"),wxFONTENCODING_DEFAULT);
Button5->SetFont(Button5Font);
Button6 = new wxButton(this, ID_BUTTON6, _("Move\nDown"), wxPoint(744,120), wxSize(48,64), 0, wxDefaultValidator, _T("ID_BUTTON6"));
wxFont Button6Font(8,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Sans"),wxFONTENCODING_DEFAULT);
Button6->SetFont(Button6Font);
StaticText34 = new wxStaticText(this, ID_STATICTEXT34, _("Curent Time"), wxPoint(536,368), wxDefaultSize, 0, _T("ID_STATICTEXT34"));
StaticText35 = new wxStaticText(this, ID_STATICTEXT35, _("Label"), wxPoint(544,392), wxDefaultSize, 0, _T("ID_STATICTEXT35"));
wxFont StaticText35Font(16,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT);
StaticText35->SetFont(StaticText35Font);
Button7 = new wxButton(this, ID_BUTTON7, _("Copy to Previous Hour"), wxPoint(120,440), wxSize(168,23), 0, wxDefaultValidator, _T("ID_BUTTON7"));
Button8 = new wxButton(this, ID_BUTTON8, _("Copy to Next Hour"), wxPoint(336,440), wxSize(168,23), 0, wxDefaultValidator, _T("ID_BUTTON8"));
StaticText36 = new wxStaticText(this, ID_STATICTEXT36, _("note: Use the \"X\" in the top right corner to deactivate"), wxPoint(528,456), wxDefaultSize, 0, _T("ID_STATICTEXT36"));
wxFont StaticText36Font(8,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Sans"),wxFONTENCODING_DEFAULT);
StaticText36->SetFont(StaticText36Font);
Button9 = new wxButton(this, ID_BUTTON9, _("Hide Lightput"), wxPoint(696,0), wxSize(115,23), 0, wxDefaultValidator, _T("ID_BUTTON9"));
H24Timer1.SetOwner(this, ID_H24TIMER1);
Connect(ID_LISTBOX1,wxEVT_COMMAND_LISTBOX_SELECTED,(wxObjectEventFunction)&H24Timer::OnListBox1Select);
Connect(ID_SLIDER1,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider1CmdScroll);
Connect(ID_SLIDER1,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider1CmdScroll);
Connect(ID_SLIDER2,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider2CmdScroll);
Connect(ID_SLIDER2,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider2CmdScroll);
Connect(ID_SLIDER3,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider3CmdScroll);
Connect(ID_SLIDER3,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider3CmdScroll);
Connect(ID_SLIDER4,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider4CmdScroll);
Connect(ID_SLIDER4,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider4CmdScroll);
Connect(ID_SLIDER5,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider5CmdScroll);
Connect(ID_SLIDER5,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider5CmdScroll);
Connect(ID_SLIDER6,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider6CmdScroll);
Connect(ID_SLIDER6,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider6CmdScroll);
Connect(ID_SLIDER7,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider7CmdScroll);
Connect(ID_SLIDER7,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider7CmdScroll);
Connect(ID_SLIDER8,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider8CmdScroll);
Connect(ID_SLIDER8,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider8CmdScroll);
Connect(ID_SLIDER9,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider9CmdScroll);
Connect(ID_SLIDER9,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider9CmdScroll);
Connect(ID_SLIDER10,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider10CmdScroll);
Connect(ID_SLIDER10,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider10CmdScroll);
Connect(ID_SLIDER11,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider11CmdScroll);
Connect(ID_SLIDER11,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider11CmdScroll);
Connect(ID_SLIDER12,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider12CmdScroll);
Connect(ID_SLIDER12,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider12CmdScroll);
Connect(ID_SLIDER13,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider13CmdScroll);
Connect(ID_SLIDER13,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider13CmdScroll);
Connect(ID_SLIDER14,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider14CmdScroll);
Connect(ID_SLIDER14,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider14CmdScroll);
Connect(ID_SLIDER15,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider15CmdScroll);
Connect(ID_SLIDER15,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider15CmdScroll);
Connect(ID_SLIDER16,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&H24Timer::OnSlider16CmdScroll);
Connect(ID_SLIDER16,wxEVT_COMMAND_SLIDER_UPDATED,(wxObjectEventFunction)&H24Timer::OnSlider16CmdScroll);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&H24Timer::OnButton1Click);
Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&H24Timer::OnCheckBox1Click);
Connect(ID_CHOICE1,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&H24Timer::OnChoice1Select);
Connect(ID_LISTBOX2,wxEVT_COMMAND_LISTBOX_SELECTED,(wxObjectEventFunction)&H24Timer::OnListBox2Select);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&H24Timer::OnButton2Click);
Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&H24Timer::OnButton3Click);
Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&H24Timer::OnButton4Click);
Connect(ID_BUTTON5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&H24Timer::OnButton5Click);
Connect(ID_BUTTON6,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&H24Timer::OnButton6Click);
Connect(ID_BUTTON7,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&H24Timer::OnButton7Click);
Connect(ID_BUTTON8,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&H24Timer::OnButton8Click);
Connect(ID_BUTTON9,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&H24Timer::OnButton9Click);
Connect(ID_H24TIMER1,wxEVT_TIMER,(wxObjectEventFunction)&H24Timer::OnH24Timer1Trigger);
Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&H24Timer::OnClose);
//*)
h24currentprofile = 0;
h24numberofprofiles = 0;
istimeractive = false;
timerischanged = false;
//variable for timer start handling
istimerinit = true;
h24filename = wxT("./light_programs/h24timer.lightput");
h24_loadprofiles();
StaticText35->SetLabel(wxDateTime::Now().Format(wxT("%I:%M %p")));
h24currenthour = wxAtoi(wxDateTime::Now().Format(wxT("%H")));
h24_updatelabels();
H24Timer1.Start(2000);
if (islightprogramonstartup)
{
islightprogramonstartup = false;
// if (isminimizedonstartup) isIconize = true;
///activate timer
Button1->Enable(false);
//if(!istimeractive) {
//istimerinit = false;
//stopyesorno = false;
//disable everything
StaticBox1->Enable(false);
StaticBox2->Enable(false);
StaticBox3->Enable(false);
ListBox1->Enable(false);
ListBox2->Enable(false);
Slider1->Enable(false);
Slider2->Enable(false);
Slider3->Enable(false);
Slider4->Enable(false);
Slider5->Enable(false);
Slider6->Enable(false);
Slider7->Enable(false);
Slider8->Enable(false);
Slider9->Enable(false);
Slider10->Enable(false);
Slider11->Enable(false);
Slider12->Enable(false);
Slider13->Enable(false);
Slider14->Enable(false);
Slider15->Enable(false);
Slider16->Enable(false);
CheckBox1->Enable(false);
Button2->Enable(false);
Button3->Enable(false);
Button4->Enable(false);
Button5->Enable(false);
Button6->Enable(false);
Button7->Enable(false);
Button8->Enable(false);
StaticText1->Enable(false);
StaticText2->Enable(false);
StaticText3->Enable(false);
StaticText4->Enable(false);
StaticText5->Enable(false);
StaticText6->Enable(false);
StaticText7->Enable(false);
StaticText8->Enable(false);
StaticText9->Enable(false);
StaticText10->Enable(false);
StaticText11->Enable(false);
StaticText12->Enable(false);
StaticText13->Enable(false);
StaticText14->Enable(false);
StaticText15->Enable(false);
StaticText16->Enable(false);
StaticText17->Enable(false);
StaticText18->Enable(false);
StaticText19->Enable(false);
StaticText20->Enable(false);
StaticText21->Enable(false);
StaticText22->Enable(false);
StaticText23->Enable(false);
StaticText24->Enable(false);
StaticText25->Enable(false);
StaticText26->Enable(false);
StaticText27->Enable(false);
StaticText28->Enable(false);
StaticText29->Enable(false);
StaticText30->Enable(false);
StaticText31->Enable(false);
StaticText32->Enable(false);
StaticText33->Enable(false);
Choice1->Enable(false);
Button1->SetLabel(wxT("Deactivate 24-Hour Light Timer"));
ListBox1->SetSelection(wxAtoi(wxDateTime::Now().Format(wxT("%H"))));
h24_updatelabels();
h24_calculatetransition();
istimeractive = true;
}
}
H24Timer::~H24Timer()
{
//(*Destroy(H24Timer)
//*)
}
//transition time selector
void H24Timer::OnChoice1Select(wxCommandEvent& event)
{
transitiontime [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Choice1->GetSelection();
timerischanged = true;
}
void H24Timer::h24_updatelabels(void)
{
h24currentprofile = ListBox2->GetSelection();
wxString wxt_s1 = wxString::Format(wxT("%i"),h24_Channel_1 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText1->SetLabel(wxt_s1);
wxString wxt_s2 = wxString::Format(wxT("%i"),h24_Channel_2 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText2->SetLabel(wxt_s2);
wxString wxt_s3 = wxString::Format(wxT("%i"),h24_Channel_3 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText3->SetLabel(wxt_s3);
wxString wxt_s4 = wxString::Format(wxT("%i"),h24_Channel_4 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText4->SetLabel(wxt_s4);
wxString wxt_s5 = wxString::Format(wxT("%i"),h24_Channel_5 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText5->SetLabel(wxt_s5);
wxString wxt_s6 = wxString::Format(wxT("%i"),h24_Channel_6 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText6->SetLabel(wxt_s6);
wxString wxt_s7 = wxString::Format(wxT("%i"),h24_Channel_7 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText7->SetLabel(wxt_s7);
wxString wxt_s8 = wxString::Format(wxT("%i"),h24_Channel_8 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText8->SetLabel(wxt_s8);
wxString wxt_s9 = wxString::Format(wxT("%i"),h24_Channel_9 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText9->SetLabel(wxt_s9);
wxString wxt_s10 = wxString::Format(wxT("%i"),h24_Channel_10 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText10->SetLabel(wxt_s10);
wxString wxt_s11 = wxString::Format(wxT("%i"),h24_Channel_11 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText11->SetLabel(wxt_s11);
wxString wxt_s12 = wxString::Format(wxT("%i"),h24_Channel_12 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText12->SetLabel(wxt_s12);
wxString wxt_s13 = wxString::Format(wxT("%i"),h24_Channel_13 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText13->SetLabel(wxt_s13);
wxString wxt_s14 = wxString::Format(wxT("%i"),h24_Channel_14 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText14->SetLabel(wxt_s14);
wxString wxt_s15 = wxString::Format(wxT("%i"),h24_Channel_15 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText15->SetLabel(wxt_s15);\
wxString wxt_s16 = wxString::Format(wxT("%i"),h24_Channel_16 [h24currentprofile] [ListBox1->GetSelection()]);
StaticText16->SetLabel(wxt_s16);
CheckBox1->SetValue(issmoothtransition [h24currentprofile] [ListBox1->GetSelection()]);
Choice1->SetSelection(transitiontime [h24currentprofile] [ListBox1->GetSelection()]);
//update sliders
Slider1->SetValue(h24_Channel_1 [h24currentprofile] [ListBox1->GetSelection()]);
Slider2->SetValue(h24_Channel_2 [h24currentprofile] [ListBox1->GetSelection()]);
Slider3->SetValue(h24_Channel_3 [h24currentprofile] [ListBox1->GetSelection()]);
Slider4->SetValue(h24_Channel_4 [h24currentprofile] [ListBox1->GetSelection()]);
Slider5->SetValue(h24_Channel_5 [h24currentprofile] [ListBox1->GetSelection()]);
Slider6->SetValue(h24_Channel_6 [h24currentprofile] [ListBox1->GetSelection()]);
Slider7->SetValue(h24_Channel_7 [h24currentprofile] [ListBox1->GetSelection()]);
Slider8->SetValue(h24_Channel_8 [h24currentprofile] [ListBox1->GetSelection()]);
Slider9->SetValue(h24_Channel_9 [h24currentprofile] [ListBox1->GetSelection()]);
Slider10->SetValue(h24_Channel_10 [h24currentprofile] [ListBox1->GetSelection()]);
Slider11->SetValue(h24_Channel_11 [h24currentprofile] [ListBox1->GetSelection()]);
Slider12->SetValue(h24_Channel_12 [h24currentprofile] [ListBox1->GetSelection()]);
Slider13->SetValue(h24_Channel_13 [h24currentprofile] [ListBox1->GetSelection()]);
Slider14->SetValue(h24_Channel_14 [h24currentprofile] [ListBox1->GetSelection()]);
Slider15->SetValue(h24_Channel_15 [h24currentprofile] [ListBox1->GetSelection()]);
Slider16->SetValue(h24_Channel_16 [h24currentprofile] [ListBox1->GetSelection()]);
}
void H24Timer::OnSlider1CmdScroll(wxScrollEvent& event)
{
h24_Channel_1 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider1->GetValue();
wxString wxt_s1 = wxString::Format(wxT("%i"),Slider1->GetValue());
StaticText1->SetLabel(wxt_s1);
timerischanged = true;
}
void H24Timer::OnSlider2CmdScroll(wxScrollEvent& event)
{
h24_Channel_2 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider2->GetValue();
wxString wxt_s2 = wxString::Format(wxT("%i"),Slider2->GetValue());
StaticText2->SetLabel(wxt_s2);
timerischanged = true;
}
void H24Timer::OnSlider3CmdScroll(wxScrollEvent& event)
{
h24_Channel_3 [h24currentprofile] [ListBox1->GetSelection()] = Slider3->GetValue();
wxString wxt_s3 = wxString::Format(wxT("%i"),Slider3->GetValue());
StaticText3->SetLabel(wxt_s3);
timerischanged = true;
}
void H24Timer::OnSlider4CmdScroll(wxScrollEvent& event)
{
h24_Channel_4 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider4->GetValue();
wxString wxt_s4 = wxString::Format(wxT("%i"),Slider4->GetValue());
StaticText4->SetLabel(wxt_s4);
timerischanged = true;
}
void H24Timer::OnSlider5CmdScroll(wxScrollEvent& event)
{
h24_Channel_5 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider5->GetValue();
wxString wxt_s5 = wxString::Format(wxT("%i"),Slider5->GetValue());
StaticText5->SetLabel(wxt_s5);
timerischanged = true;
}
void H24Timer::OnSlider6CmdScroll(wxScrollEvent& event)
{
h24_Channel_6 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider6->GetValue();
wxString wxt_s6 = wxString::Format(wxT("%i"),Slider6->GetValue());
StaticText6->SetLabel(wxt_s6);
timerischanged = true;
}
void H24Timer::OnSlider7CmdScroll(wxScrollEvent& event)
{
h24_Channel_7 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider7->GetValue();
wxString wxt_s7 = wxString::Format(wxT("%i"),Slider7->GetValue());
StaticText7->SetLabel(wxt_s7);
timerischanged = true;
}
void H24Timer::OnSlider8CmdScroll(wxScrollEvent& event)
{
h24_Channel_8 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider8->GetValue();
wxString wxt_s8 = wxString::Format(wxT("%i"),Slider8->GetValue());
StaticText8->SetLabel(wxt_s8);
timerischanged = true;
}
void H24Timer::OnSlider9CmdScroll(wxScrollEvent& event)
{
h24_Channel_9 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider9->GetValue();
wxString wxt_s9 = wxString::Format(wxT("%i"),Slider9->GetValue());
StaticText9->SetLabel(wxt_s9);
timerischanged = true;
}
void H24Timer::OnSlider10CmdScroll(wxScrollEvent& event)
{
h24_Channel_10 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider10->GetValue();
wxString wxt_s10 = wxString::Format(wxT("%i"),Slider10->GetValue());
StaticText10->SetLabel(wxt_s10);
timerischanged = true;
}
void H24Timer::OnSlider11CmdScroll(wxScrollEvent& event)
{
h24_Channel_11 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider11->GetValue();
wxString wxt_s11 = wxString::Format(wxT("%i"),Slider11->GetValue());
StaticText11->SetLabel(wxt_s11);
timerischanged = true;
}
void H24Timer::OnSlider12CmdScroll(wxScrollEvent& event)
{
h24_Channel_12 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider12->GetValue();
wxString wxt_s12 = wxString::Format(wxT("%i"),Slider12->GetValue());
StaticText12->SetLabel(wxt_s12);
timerischanged = true;
}
void H24Timer::OnSlider13CmdScroll(wxScrollEvent& event)
{
h24_Channel_13 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider13->GetValue();
wxString wxt_s13 = wxString::Format(wxT("%i"),Slider13->GetValue());
StaticText13->SetLabel(wxt_s13);
timerischanged = true;
}
void H24Timer::OnSlider14CmdScroll(wxScrollEvent& event)
{
h24_Channel_14 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider14->GetValue();
wxString wxt_s14 = wxString::Format(wxT("%i"),Slider14->GetValue());
StaticText14->SetLabel(wxt_s14);
}
void H24Timer::OnSlider15CmdScroll(wxScrollEvent& event)
{
h24_Channel_15 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider15->GetValue();
wxString wxt_s15 = wxString::Format(wxT("%i"),Slider15->GetValue());
StaticText15->SetLabel(wxt_s15);
timerischanged = true;
}
void H24Timer::OnSlider16CmdScroll(wxScrollEvent& event)
{
h24_Channel_16 [ListBox2->GetSelection()] [ListBox1->GetSelection()] = Slider16->GetValue();
wxString wxt_s16 = wxString::Format(wxT("%i"),Slider16->GetValue());
StaticText16->SetLabel(wxt_s16);
timerischanged = true;
}
void H24Timer::OnListBox1Select(wxCommandEvent& event)
{
h24_updatelabels();
}
void H24Timer::OnCheckBox1Click(wxCommandEvent& event)
{
if (CheckBox1->GetValue()) issmoothtransition [ListBox2->GetSelection()] [ListBox1->GetSelection()] = 1;
else issmoothtransition [ListBox2->GetSelection()] [ListBox1->GetSelection()] = 0;
timerischanged = true;
}
void H24Timer::OnH24Timer1Trigger(wxTimerEvent& event)
{
//wxMessageBox (wxT("should happen many times"),wxT("test"));
//this shit just isn't working at all
//this line redraws the current time after checking that the current time
//doesn't equal the time currently being displayed on the screen
if (h24currenthour != wxAtoi(wxDateTime::Now().Format(wxT("%H")))) {
h24currenthour = wxAtoi(wxDateTime::Now().Format(wxT("%H")));
ListBox1->SetSelection(wxAtoi(wxDateTime::Now().Format(wxT("%H"))));
h24_updatelabels();
h24_calculatetransition();
//wxMessageBox (wxT("should happen once"),wxT("test"));
}
if (StaticText35->GetLabel() != wxDateTime::Now().Format(wxT("%I:%M %p"))) {
StaticText35->SetLabel(wxDateTime::Now().Format(wxT("%I:%M %p")));
//ListBox1->SetSelection(wxAtoi(wxDateTime::Now().Format(wxT("%H"))));
}
if (istimeractive) {
//ListBox1->SetSelection(wxAtoi(wxDateTime::Now().Format(wxT("%H"))));
getminutes = wxAtoi(wxDateTime::Now().Format(wxT("%M")));
getseconds = wxAtoi(wxDateTime::Now().Format(wxT("%S")));
currentunit = (((getminutes * 60) + getseconds) / 20);
if (currentunit == 0) currentunit = 1;
Channel_1_timer = hourtransitioncalculations [1] [currentunit];
Channel_2_timer = hourtransitioncalculations [2] [currentunit];
Channel_3_timer = hourtransitioncalculations [3] [currentunit];
Channel_4_timer = hourtransitioncalculations [4] [currentunit];
Channel_5_timer = hourtransitioncalculations [5] [currentunit];
Channel_6_timer = hourtransitioncalculations [6] [currentunit];
Channel_7_timer = hourtransitioncalculations [7] [currentunit];
Channel_8_timer = hourtransitioncalculations [8] [currentunit];
Channel_9_timer = hourtransitioncalculations [9] [currentunit];
Channel_10_timer = hourtransitioncalculations [10] [currentunit];
Channel_11_timer = hourtransitioncalculations [11] [currentunit];
Channel_12_timer = hourtransitioncalculations [12] [currentunit];
Channel_13_timer = hourtransitioncalculations [13] [currentunit];
Channel_14_timer = hourtransitioncalculations [14] [currentunit];
Channel_15_timer = hourtransitioncalculations [15] [currentunit];
Channel_16_timer = hourtransitioncalculations [16] [currentunit];
}
}
void H24Timer::h24_loadprofiles(void)
{
wxTextFile h24file;
h24file.Open(h24filename, wxConvISO8859_1);
//this line checks if the FILE HAS 3 LINES OR LESS, indicationg that there are no profiles
//then returns out of the profile loading function
//new idea, get line count, divide by 19, thats number of profiles
//subtract 1 from the line count to fix loading bug
h24numberoflines = h24file.GetLineCount() - 1;
//add 1 to the value to fix the assignment of bsnumberofprofiles
h24numberofprofiles = (h24numberoflines + 1) / 25;
if (h24file.GetLineCount() <= 3)return;
int namepos = 1;
ListBox2->Clear();
h24pos = 2;
h24postimes = 0;
int intbuffer;
//count starts at 2 because the getfirstline function before the do loop gets the first count
int count = 2;
//needed to use the getfirstline function, so i did this
h24buffer [1] = h24file.GetFirstLine();
ListBox2->Append(h24buffer [1]);
h24profilenames [0] = h24buffer [1];
//h24profilenames [namepos++] = h24buffer [h24pos + (h24postimes * 25)];
//this code is less than perfect, this do loop puts all the values from the saved proflie file
//into a buffer, as well as puts the name value, number of beats value, and time value
//into SequencerPrrofileNames, SequencerBeats, and SequencerTime for using and saving later
do {
h24buffer [h24pos + (h24postimes * 25)] = h24file.GetNextLine();
if (h24pos == 1) {ListBox2->Append(h24buffer [h24pos + (h24postimes * 25)]); h24profilenames [namepos++] = h24buffer [h24pos + (h24postimes * 25)];}
//wxString displayValue = wxString::Format(wxT("%i"),ListBox1->GetSelection());
//wxMessageBox ( displayValue, displayValue);
//if (h24pos == 2) {Choice1->SetSelection(wxAtoi(buffer [((h24postimes * 19) + 2)])); SequencerBeats [nameh24pos] = wxAtoi(buffer [((h24postimes * 19) + 2)]);}
//if (h24pos == 3) {TextCtrl1->SetValue(buffer [((h24postimes * 19) + 3)]); SequencerTime [nameh24pos] = wxAtoi(buffer [((h24postimes * 19) + 3)]); nameh24pos++;}
h24pos++;
//the if in the next line fixes the problem with the last profile not loading properly
if (count < h24numberoflines)count++;
//the nested, 2nd if in the next line fixes the problem with the last profile not loading properly also
if (h24pos == 26) {h24pos=1;h24postimes++;if (count == h24numberoflines)count++;}
//those other lines above make sure this while condition stays met untill after
//the last line of the last profile loads
} while (count <= h24numberoflines);
//int selection = ListBox1->GetSelection();
wxString DMXbuffer;
h24pos = 0;
// vpos holds the beat posirtion
int vpos = 1;
count = 0;
//this next line gets the number of profiles by dividing the number of lines in
//the save file by 19, the number of lines each profile takes.
h24profilecount = (h24numberoflines / 25);
int profilepos = 0;
//this do loop decodes the lines that hold the DMX values per beat (separated by !'s)
//note it does not search for ! it knows the numbers of spaces to travel
//must save profile with leading 0's
do {
h24pos = 0;
vpos = 1;
//12:00 AM
wxString udbuffer = h24buffer [((profilepos * 25) +2)];
//wxString displayValue = wxString::Format(wxT("%i"),numberoflines);
//wxMessageBox ( udbuffer, udbuffer);
do{
DMXbuffer.clear();
do {
DMXbuffer = DMXbuffer + udbuffer [h24pos];
h24pos++;
count++;
} while (count < 3);
count = 0;
if (vpos == 1) h24_Channel_1 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 2) h24_Channel_2 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 3) h24_Channel_3 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 4) h24_Channel_4 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 5) h24_Channel_5 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 6) h24_Channel_6 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 7) h24_Channel_7 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 8) h24_Channel_8 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 9) h24_Channel_9 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 10) h24_Channel_10 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 11) h24_Channel_11 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 12) h24_Channel_12 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 13) h24_Channel_13 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 14) h24_Channel_14 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 15) h24_Channel_15 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 16) h24_Channel_16 [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 17) issmoothtransition [profilepos] [0] = wxAtoi(DMXbuffer);
if (vpos == 18) transitiontime [profilepos] [0] = wxAtoi(DMXbuffer);
// moves h24pos past exclamation point
h24pos++;
vpos++;
} while (vpos < 19);
vpos = 1;
h24pos = 0;
//1:00 AM
udbuffer = h24buffer [((profilepos * 25) +3)];
do{
DMXbuffer.clear();
do {
DMXbuffer = DMXbuffer + udbuffer [h24pos];
h24pos++;
count++;
} while (count < 3);
count = 0;
if (vpos == 1) h24_Channel_1 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 2) h24_Channel_2 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 3) h24_Channel_3 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 4) h24_Channel_4 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 5) h24_Channel_5 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 6) h24_Channel_6 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 7) h24_Channel_7 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 8) h24_Channel_8 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 9) h24_Channel_9 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 10) h24_Channel_10 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 11) h24_Channel_11 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 12) h24_Channel_12 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 13) h24_Channel_13 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 14) h24_Channel_14 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 15) h24_Channel_15 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 16) h24_Channel_16 [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 17) issmoothtransition [profilepos] [1] = wxAtoi(DMXbuffer);
if (vpos == 18) transitiontime [profilepos] [1] = wxAtoi(DMXbuffer);
h24pos++;
vpos++;
} while (vpos < 19);
vpos = 1;
h24pos = 0;
//2:00 AM
udbuffer = h24buffer [((profilepos * 25) +4)];
do{
DMXbuffer.clear();
do {
DMXbuffer = DMXbuffer + udbuffer [h24pos];
h24pos++;
count++;
} while (count < 3);
count = 0;
if (vpos == 1) h24_Channel_1 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 2) h24_Channel_2 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 3) h24_Channel_3 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 4) h24_Channel_4 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 5) h24_Channel_5 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 6) h24_Channel_6 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 7) h24_Channel_7 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 8) h24_Channel_8 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 9) h24_Channel_9 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 10) h24_Channel_10 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 11) h24_Channel_11 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 12) h24_Channel_12 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 13) h24_Channel_13 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 14) h24_Channel_14 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 15) h24_Channel_15 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 16) h24_Channel_16 [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 17) issmoothtransition [profilepos] [2] = wxAtoi(DMXbuffer);
if (vpos == 18) transitiontime [profilepos] [2] = wxAtoi(DMXbuffer);
h24pos++;
vpos++;
} while (vpos < 19);
vpos = 1;
h24pos = 0;
//3:00 AM
udbuffer = h24buffer [((profilepos * 25) +5)];
do{
DMXbuffer.clear();
do {
DMXbuffer = DMXbuffer + udbuffer [h24pos];
h24pos++;
count++;
} while (count < 3);
count = 0;