-
Notifications
You must be signed in to change notification settings - Fork 0
/
SlidesMain.cpp
3908 lines (3772 loc) · 155 KB
/
SlidesMain.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
/***************************************************************
* Name: SlidesMain.cpp
* Purpose: Code for Application Frame
* Author: Mark ()
* Created: 2020-02-01
* Copyright: Mark ()
* License:
**************************************************************/
#include "SlidesMain.h"
#include <wx/msgdlg.h>
#include "../VideoCrop/VideoCropMain.cpp"
//(*InternalHeaders(SlidesFrame)
#include <wx/intl.h>
#include <wx/string.h>
//*)
using namespace std;
//helper functions
enum wxbuildinfoformat {
short_f, long_f };
wxString wxbuildinfo(wxbuildinfoformat format)
{
wxString wxbuild(wxVERSION_STRING);
if (format == long_f )
{
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
//(*IdInit(SlidesFrame)
const long SlidesFrame::ID_CREATEDATABASEBTN = wxNewId();
const long SlidesFrame::ID_SONGSLISTCTRL = wxNewId();
const long SlidesFrame::ID_REPORTSONGSBTN = wxNewId();
const long SlidesFrame::ID_CREATESLIDESBTN = wxNewId();
const long SlidesFrame::ID_VIDEORADIOBOX = wxNewId();
const long SlidesFrame::ID_FILERICHTEXTCTRL = wxNewId();
const long SlidesFrame::ID_VIDEOLISTBOX = wxNewId();
const long SlidesFrame::ID_BROWSEBTN = wxNewId();
const long SlidesFrame::ID_OPTIONSRADIOBOX = wxNewId();
const long SlidesFrame::ID_SEARCHTEXTCTRL = wxNewId();
const long SlidesFrame::ID_SEARCHCHKBOX = wxNewId();
const long SlidesFrame::ID_PLAYBTN = wxNewId();
const long SlidesFrame::ID_SEARCHTEXTCTRL2 = wxNewId();
const long SlidesFrame::ID_OVERWRITECHKBOX = wxNewId();
const long SlidesFrame::ID_URLBTN = wxNewId();
const long SlidesFrame::ID_SAVEBTN = wxNewId();
const long SlidesFrame::ID_TEMPLATELISTBOX = wxNewId();
const long SlidesFrame::ID_TEMPLATETEXTCTRL = wxNewId();
const long SlidesFrame::ID_IMPORTCREATEBTN = wxNewId();
const long SlidesFrame::ID_PLATFORMLISTCTRL = wxNewId();
const long SlidesFrame::ID_LICENSESPINCTRL = wxNewId();
const long SlidesFrame::ID_SEARCHSPINCTRL = wxNewId();
const long SlidesFrame::ID_CANCELBTN = wxNewId();
const long SlidesFrame::ID_LYRICSSPINCTRL = wxNewId();
const long SlidesFrame::ID_WEBPAGEPANEL = wxNewId();
const long SlidesFrame::ID_IMPORTBTN = wxNewId();
const long SlidesFrame::ID_DELETEBTN = wxNewId();
const long SlidesFrame::ID_FILELISTBOX = wxNewId();
const long SlidesFrame::ID_FUNCTIONSRADIOBOX = wxNewId();
const long SlidesFrame::idMenuQuit = wxNewId();
const long SlidesFrame::idMenuAbout = wxNewId();
const long SlidesFrame::idMenuDebug = wxNewId();
const long SlidesFrame::ID_MAINSTATUSBAR = wxNewId();
//*)
BEGIN_EVENT_TABLE(SlidesFrame,wxFrame)
//(*EventTable(SlidesFrame)
//*)
END_EVENT_TABLE()
SlidesFrame::SlidesFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(SlidesFrame)
wxMenu* Menu1;
wxMenu* Menu2;
wxMenuBar* MainMenuBar;
wxMenuItem* MenuItem1;
wxMenuItem* MenuItem2;
Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxVSCROLL|wxHSCROLL, _T("wxID_ANY"));
SetClientSize(wxSize(1003,515));
CreateDatabaseBtn = new wxButton(this, ID_CREATEDATABASEBTN, _("Create Database"), wxPoint(0,224), wxSize(100,30), 0, wxDefaultValidator, _T("ID_CREATEDATABASEBTN"));
CreateDatabaseBtn->SetToolTip(_("Extract lyrics from several sites\n(according to \'Search order\')"));
SongsListCtrl = new wxListCtrl(this, ID_SONGSLISTCTRL, wxPoint(0,0), wxSize(248,224), wxLC_REPORT, wxDefaultValidator, _T("ID_SONGSLISTCTRL"));
ReportSongsBtn = new wxButton(this, ID_REPORTSONGSBTN, _("Report Songs"), wxPoint(0,304), wxSize(100,30), 0, wxDefaultValidator, _T("ID_REPORTSONGSBTN"));
ReportSongsBtn->SetToolTip(_("Report songs listed above through CCLI"));
CreateSlidesBtn = new wxButton(this, ID_CREATESLIDESBTN, _("Create Slides"), wxPoint(0,336), wxSize(100,30), 0, wxDefaultValidator, _T("ID_CREATESLIDESBTN"));
CreateSlidesBtn->SetToolTip(_("Construct slides consisting of songs listed above\n(with the template specified on the far right)"));
wxString __wxRadioBoxChoices_1[4] =
{
_("None"),
_("Background"),
_("Words"),
_("Mix")
};
VideoRadioBox = new wxRadioBox(this, ID_VIDEORADIOBOX, _("Video"), wxPoint(104,304), wxSize(144,114), 4, __wxRadioBoxChoices_1, 1, 0, wxDefaultValidator, _T("ID_VIDEORADIOBOX"));
VideoRadioBox->SetSelection(0);
FileRichTextCtrl = new wxRichTextCtrl(this, ID_FILERICHTEXTCTRL, wxEmptyString, wxPoint(256,40), wxSize(208,224), wxRE_MULTILINE, wxDefaultValidator, _T("ID_FILERICHTEXTCTRL"));
wxRichTextAttr rchtxtAttr_1;
rchtxtAttr_1.SetBulletStyle(wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT);
FileRichTextCtrl->SetToolTip(_("Displays song/ text file \n(selected in the box on its direct right)"));
VideoListBox = new wxListBox(this, ID_VIDEOLISTBOX, wxPoint(680,40), wxSize(168,192), 0, 0, 0, wxDefaultValidator, _T("ID_VIDEOLISTBOX"));
VideoListBox->SetToolTip(_("Displays .mp4 files in \"Videos folder\""));
BrowseBtn = new wxButton(this, ID_BROWSEBTN, _("Browse"), wxPoint(464,272), wxSize(100,30), 0, wxDefaultValidator, _T("ID_BROWSEBTN"));
BrowseBtn->SetToolTip(_("Opens dialog to select the folder\n(specified in the \'Browse Options\' next to it)"));
wxString __wxRadioBoxChoices_2[3] =
{
_("Songs folder"),
_("Videos folder"),
_("Templates folder")
};
OptionsRadioBox = new wxRadioBox(this, ID_OPTIONSRADIOBOX, _("Browse Options"), wxPoint(568,264), wxSize(112,96), 3, __wxRadioBoxChoices_2, 1, 0, wxDefaultValidator, _T("ID_OPTIONSRADIOBOX"));
SearchTextCtrl = new wxTextCtrl(this, ID_SEARCHTEXTCTRL, wxEmptyString, wxPoint(464,40), wxSize(216,21), wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_SEARCHTEXTCTRL"));
SearchChkBox = new wxCheckBox(this, ID_SEARCHCHKBOX, _("Search inside files"), wxPoint(464,64), wxDefaultSize, 0, wxDefaultValidator, _T("ID_SEARCHCHKBOX"));
SearchChkBox->SetValue(false);
PlayBtn = new wxButton(this, ID_PLAYBTN, _("Play video"), wxPoint(680,232), wxSize(100,30), 0, wxDefaultValidator, _T("ID_PLAYBTN"));
PlayBtn->SetToolTip(_("Plays selected video above"));
SearchTextCtrl2 = new wxTextCtrl(this, ID_SEARCHTEXTCTRL2, wxEmptyString, wxPoint(0,256), wxSize(100,30), wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_SEARCHTEXTCTRL2"));
SearchTextCtrl2->SetToolTip(_("Type in query here\n(done through CCLI)"));
OverwriteChkBox = new wxCheckBox(this, ID_OVERWRITECHKBOX, _("Overwrite files"), wxPoint(0,288), wxDefaultSize, 0, wxDefaultValidator, _T("ID_OVERWRITECHKBOX"));
OverwriteChkBox->SetValue(false);
URLBtn = new wxButton(this, ID_URLBTN, _("Go to URL"), wxPoint(464,332), wxSize(100,30), 0, wxDefaultValidator, _T("ID_URLBTN"));
URLBtn->Hide();
SaveBtn = new wxButton(this, ID_SAVEBTN, _("Save file"), wxPoint(256,272), wxSize(100,30), 0, wxDefaultValidator, _T("ID_SAVEBTN"));
SaveBtn->SetToolTip(_("Saves song/ text file\n(when edits are made)"));
TemplateListBox = new wxListBox(this, ID_TEMPLATELISTBOX, wxPoint(848,40), wxSize(152,192), 0, 0, 0, wxDefaultValidator, _T("ID_TEMPLATELISTBOX"));
TemplateListBox->SetToolTip(_("Displays .ppt/.pptx files in \"Templates folder\""));
TemplateTextCtrl = new wxTextCtrl(this, ID_TEMPLATETEXTCTRL, wxEmptyString, wxPoint(848,232), wxSize(152,30), 0, wxDefaultValidator, _T("ID_TEMPLATETEXTCTRL"));
TemplateTextCtrl->Disable();
TemplateTextCtrl->SetToolTip(_("Template selected for \'Create Slides\'"));
ImportCreateBtn = new wxButton(this, ID_IMPORTCREATEBTN, _("Import + Create"), wxPoint(0,368), wxSize(100,30), 0, wxDefaultValidator, _T("ID_IMPORTCREATEBTN"));
ImportCreateBtn->SetToolTip(_("Used to apply video to existing non-video slides\n(lyrics should have the largest font, title and/or author/s have the smallest font)"));
PlatformListCtrl = new wxListCtrl(this, ID_PLATFORMLISTCTRL, wxPoint(148,224), wxSize(100,80), wxLC_REPORT|wxLC_NO_HEADER, wxDefaultValidator, _T("ID_PLATFORMLISTCTRL"));
PlatformListCtrl->SetToolTip(_("Search order"));
LicenseSpinCtrl = new wxSpinCtrl(this, ID_LICENSESPINCTRL, _T("3"), wxPoint(48,400), wxSize(50,21), 0, 1, 20, 3, _T("ID_LICENSESPINCTRL"));
LicenseSpinCtrl->SetValue(_T("3"));
LicenseSpinCtrl->SetToolTip(_("Maximum no. of lines for CCLI below slide\n(only applicable to \"Create Slides\", 1-20)"));
SearchSpinCtrl = new wxSpinCtrl(this, ID_SEARCHSPINCTRL, _T("5"), wxPoint(101,235), wxSize(48,21), 0, 1, 25, 5, _T("ID_SEARCHSPINCTRL"));
SearchSpinCtrl->SetValue(_T("5"));
SearchSpinCtrl->SetToolTip(_("Number of songs to look for each query\n(1-25)"));
CancelBtn = new wxButton(this, ID_CANCELBTN, _("Cancel"), wxPoint(100,256), wxSize(48,30), 0, wxDefaultValidator, _T("ID_CANCELBTN"));
CancelBtn->SetToolTip(_("Cancel \'Create database\' & \'Report Songs\'"));
LyricsSpinCtrl = new wxSpinCtrl(this, ID_LYRICSSPINCTRL, _T("0"), wxPoint(0,400), wxSize(50,21), 0, 0, 20, 0, _T("ID_LYRICSSPINCTRL"));
LyricsSpinCtrl->SetValue(_T("0"));
LyricsSpinCtrl->SetToolTip(_("Maximum no. of lines for lyrics on each slide\n(0 implies no preference, 0-20)"));
WebPagePanel = new wxPanel(this, ID_WEBPAGEPANEL, wxPoint(256,312), wxSize(200,128), wxTAB_TRAVERSAL, _T("ID_WEBPAGEPANEL"));
WebPagePanel->Hide();
ImportBtn = new wxButton(this, ID_IMPORTBTN, _("Import folder"), wxPoint(464,302), wxSize(100,30), 0, wxDefaultValidator, _T("ID_IMPORTBTN"));
ImportBtn->SetToolTip(_("Choose a folder to convert all existing .ppt or .pptx\nto .txt"));
DeleteBtn = new wxButton(this, ID_DELETEBTN, _("Delete file"), wxPoint(356,272), wxSize(100,30), 0, wxDefaultValidator, _T("ID_DELETEBTN"));
DeleteBtn->Disable();
DeleteBtn->SetToolTip(_("Delete file, can be enabled via Developer->Debug"));
FileListBox = new wxCheckListBox(this, ID_FILELISTBOX, wxPoint(464,88), wxSize(216,176), 0, 0, 0, wxDefaultValidator, _T("ID_FILELISTBOX"));
wxString __wxRadioBoxChoices_3[3] =
{
_("None"),
_("Include macro"),
_("Trim slides")
};
FunctionsRadioBox = new wxRadioBox(this, ID_FUNCTIONSRADIOBOX, _("Functions"), wxPoint(464,360), wxSize(104,96), 3, __wxRadioBoxChoices_3, 1, 0, wxDefaultValidator, _T("ID_FUNCTIONSRADIOBOX"));
FunctionsRadioBox->SetToolTip(_("Include macro\nInclude code for slideshow (issue)\n\nTrim slides\nRemove slides in between\n\nBoth options only applicable to \'Background\' & \'Mix\'"));
MainMenuBar = new wxMenuBar();
Menu1 = new wxMenu();
MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
Menu1->Append(MenuItem1);
MainMenuBar->Append(Menu1, _("&File"));
Menu2 = new wxMenu();
MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
Menu2->Append(MenuItem2);
MainMenuBar->Append(Menu2, _("Help"));
Menu3 = new wxMenu();
MenuItem3 = new wxMenuItem(Menu3, idMenuDebug, _("Debug"), _("Displays hidden widgets"), wxITEM_NORMAL);
Menu3->Append(MenuItem3);
MainMenuBar->Append(Menu3, _("Developer"));
SetMenuBar(MainMenuBar);
MainStatusBar = new wxStatusBar(this, ID_MAINSTATUSBAR, 0, _T("ID_MAINSTATUSBAR"));
int __wxStatusBarWidths_1[2] = { -10, -10 };
int __wxStatusBarStyles_1[2] = { wxSB_NORMAL, wxSB_NORMAL };
MainStatusBar->SetFieldsCount(2,__wxStatusBarWidths_1);
MainStatusBar->SetStatusStyles(2,__wxStatusBarStyles_1);
SetStatusBar(MainStatusBar);
dirDialog = new wxDirDialog(this, _("Select directory"), wxEmptyString, wxDD_DEFAULT_STYLE, wxDefaultPosition, wxDefaultSize, _T("wxDirDialog"));
fileDialog = new wxFileDialog(this, _("Select file"), wxEmptyString, wxEmptyString, wxFileSelectorDefaultWildcardStr, wxFD_DEFAULT_STYLE|wxFD_FILE_MUST_EXIST, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog"));
Connect(ID_CREATEDATABASEBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnCreateDatabaseBtnClick);
Connect(ID_SONGSLISTCTRL,wxEVT_COMMAND_LIST_BEGIN_DRAG,(wxObjectEventFunction)&SlidesFrame::OnSongsListCtrlBeginDrag);
Connect(ID_SONGSLISTCTRL,wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK,(wxObjectEventFunction)&SlidesFrame::OnSongsListCtrlItemRClick);
Connect(ID_REPORTSONGSBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnReportSongsBtnClick);
Connect(ID_CREATESLIDESBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnCreateSlidesBtnClick);
Connect(ID_VIDEOLISTBOX,wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,(wxObjectEventFunction)&SlidesFrame::OnVideoListBoxDClick);
Connect(ID_BROWSEBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnBrowseBtnClick);
Connect(ID_SEARCHTEXTCTRL,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&SlidesFrame::FilterSearch);
Connect(ID_SEARCHCHKBOX,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnSearchChkBoxClick);
Connect(ID_PLAYBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnPlayBtnClick);
Connect(ID_SEARCHTEXTCTRL2,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&SlidesFrame::OnCreateDatabaseBtnClick);
Connect(ID_URLBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnURLBtnClick);
Connect(ID_SAVEBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnSaveBtnClick);
Connect(ID_TEMPLATELISTBOX,wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,(wxObjectEventFunction)&SlidesFrame::OnTemplateListBoxDClick);
Connect(ID_IMPORTCREATEBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnImportCreateBtnClick);
Connect(ID_PLATFORMLISTCTRL,wxEVT_COMMAND_LIST_BEGIN_DRAG,(wxObjectEventFunction)&SlidesFrame::OnPlatformListCtrlBeginDrag);
Connect(ID_LICENSESPINCTRL,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&SlidesFrame::OnLicenseSpinCtrlChange);
Connect(ID_SEARCHSPINCTRL,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&SlidesFrame::OnSearchSpinCtrlChange);
Connect(ID_CANCELBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnCancelBtnClick);
WebPagePanel->Connect(wxEVT_LEFT_DCLICK,(wxObjectEventFunction)&SlidesFrame::OnWebPagePanelLeftDClick,0,this);
WebPagePanel->Connect(wxEVT_RIGHT_DCLICK,(wxObjectEventFunction)&SlidesFrame::OnWebPagePanelRightDClick,0,this);
Connect(ID_IMPORTBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnImportBtnClick);
Connect(ID_DELETEBTN,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SlidesFrame::OnDeleteBtnClick);
Connect(ID_FILELISTBOX,wxEVT_COMMAND_CHECKLISTBOX_TOGGLED,(wxObjectEventFunction)&SlidesFrame::OnFileListBoxToggled);
Connect(ID_FILELISTBOX,wxEVT_COMMAND_LISTBOX_SELECTED,(wxObjectEventFunction)&SlidesFrame::OnFileListBoxSelect);
Connect(ID_FILELISTBOX,wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,(wxObjectEventFunction)&SlidesFrame::OnFileListBoxDClick);
Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SlidesFrame::OnQuit);
Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SlidesFrame::OnAbout);
//*)
Connect(idMenuDebug, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&SlidesFrame::OnDebug);
//ReportSongsBtn->Enable(false);
FileListBox->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(SlidesFrame::OnFileListBoxRClick), NULL, this);
//wxLB_OWNERDRAW
SetIcon(wxICON(app_logo));
ListCtrlDropTarget* dndSongsListCtrl = new ListCtrlDropTarget(SongsListCtrl);
SongsListCtrl->SetDropTarget(dndSongsListCtrl);
SongsListCtrl->InsertColumn(0, "Song Names", wxLIST_FORMAT_LEFT);
SongsListCtrl->InsertColumn(1, "Video", wxLIST_FORMAT_LEFT);
SongsListCtrl->InsertColumn(2, "CCLI", wxLIST_FORMAT_LEFT);
SongsListCtrl->InsertColumn(3, "Song Filename", wxLIST_FORMAT_LEFT);
SongsListCtrl->InsertColumn(4, "Video Filename", wxLIST_FORMAT_LEFT);
SongsListCtrl->SetColumnWidth(0, 150);
SongsListCtrl->SetColumnWidth(2, 0);
SongsListCtrl->SetColumnWidth(3, 0);
SongsListCtrl->SetColumnWidth(4, 0);
ListCtrlDropTarget* dndPlatformListCtrl = new ListCtrlDropTarget(PlatformListCtrl);
PlatformListCtrl->SetDropTarget(dndPlatformListCtrl);
PlatformListCtrl->InsertColumn(0, "Search order", wxLIST_FORMAT_LEFT);
wxRegKey rk( wxT("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION"));
//wxString strExe = wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetFullName();
rk.SetValue("Slides.exe", 11001);
//11001 is the code to use Internet Explorer 11
webstate = -1;
ori_pos = WebPagePanel->GetPosition();
ori_size = WebPagePanel->GetSize();
ID_WEBVIEW = NewControlId();
webView = wxWebView::New(WebPagePanel, ID_WEBVIEW, "google.com", wxPoint(0, 0), \
wxSize(ori_size.GetWidth() - 20, ori_size.GetHeight()));
//webView->Hide();
Connect(ID_WEBVIEW, wxEVT_WEBVIEW_ERROR, wxWebViewEventHandler(SlidesFrame::OnErrorWebView));
Connect(ID_WEBVIEW, wxEVT_WEBVIEW_LOADED, wxWebViewEventHandler(SlidesFrame::ExecuteScript2));
SlidesFrame::Initialise();
}
SlidesFrame::~SlidesFrame()
{
SlidesFrame::Save();
//(*Destroy(SlidesFrame)
//*)
}
void SlidesFrame::Initialise()
{
//ID_WEBVIEW = NewControlId();
wxDir dir(wxGetCwd());
dirName = dir.GetName();
wxString params[] = {"Default songs directory", "Template", "Default templates directory", \
"Video", "Default videos directory", "Search order", "Items per search", \
"Maximum lines for CCLI"};
//Keys are specified here
int num_params = sizeof(params)/sizeof(wxString);
for(int i = 0; i < num_params; i++)
{
configmap[params[i]] = "";
}
wxString filename;
filename = dirName + "\\config.txt";
//config.txt should be in the same directory as the application
wxFile wxofsFile;
if (!wxofsFile.Exists(filename))
{
SetStatusText(wxT("Cannot find config.txt"), 0);
SlidesFrame::InitSearchOrder();
return;
}
wxFileInputStream input(filename);
wxTextInputStream text(input, wxT("\x09"), wxConvUTF8);
wxString line, key, value;
while(!input.Eof())
{
line = text.ReadLine();
wxStringTokenizer tkz(line, wxT(":"));
key = tkz.GetNextToken().Trim(false).Trim(true);
//Removes whitespace
if (configmap.find(key) != configmap.end())
//Include only known keys
{
value = tkz.GetString().Trim(false).Trim(true);
//Removes whitespace
configmap[key] = value;
}
}
SlidesFrame::InitSearchOrder();
SlidesFrame::InitSpinCtrls();
SlidesFrame::DefaultFolderOpen();
PlatformListCtrl->Hide();
}
void SlidesFrame::InitSearchOrder()
{
vector<wxString> platforms = {AZLyrics, WorshipTogether, LyricsOnDemand, Lyrics, Musixmatch};
//Available platforms and default order
vector<wxString> choices;
wxStringTokenizer tkz(configmap["Search order"], wxT(","));
wxString platform;
while (tkz.HasMoreTokens())
{
platform = tkz.GetNextToken().Trim(false).Trim(true);
if(find(platforms.begin(), platforms.end(), platform) != platforms.end())
{
choices.push_back(platform);
}
}
if (choices.size() > 0)
//Ensures default order is given if there is no order provided
{
for (unsigned int i = 0; i < choices.size(); i++)
{
PlatformListCtrl->InsertItem(PlatformListCtrl->GetItemCount(), choices[i]);
}
}
else
{
for (unsigned int i = 0; i < platforms.size(); i++)
{
PlatformListCtrl->InsertItem(PlatformListCtrl->GetItemCount(), platforms[i]);
}
}
}
void SlidesFrame::InitSpinCtrls()
{
int val = atoi(configmap["Items per search"]);
if (val <= 0)
//Invalid value, set to default
{
//5 as an arbitrary default value
SearchSpinCtrl->SetValue(5);
configmap["Items per search"] = "5";
}
else
{
SearchSpinCtrl->SetValue(val);
}
val = atoi(configmap["Maximum lines for CCLI"]);
if (val <= 0)
{
//3 as an arbitrary default value
LicenseSpinCtrl->SetValue(3);
configmap["Maximum lines for CCLI"] = "3";
}
else
{
LicenseSpinCtrl->SetValue(val);
}
}
void SlidesFrame::ShowSlides(wxString foldername, bool start)
{
wxDir dir(foldername);
if (!dir.IsOpened())
//Check whether folder exists
{
return;
}
int num_items = FileListBox->GetCount();
for (int i = 0; i < num_items; i++)
{
FileListBox->Delete(0);
}
fileList.clear();
wxString filename;
wxString filespec = _T("*.txt");
bool cont = dir.GetFirst(&filename, filespec, wxDIR_FILES);
while (cont)
{
wxString filenamestr(filename);
fileList.push_back(filenamestr);
cont = dir.GetNext(&filename);
}
wxVectorSort(fileList);
for (unsigned int i = 0; i < fileList.size(); i++)
{
FileListBox->Append(fileList[i]);
}
if (start)
{
wxFile wxofsFile;
filename = configmap["Default templates directory"] + "\\" + "favourites.txt";
if (wxofsFile.Exists(filename))
{
wxFileInputStream input(filename);
wxTextInputStream text(input, wxT("\x09"), wxMBConvUTF16LE());
wxString line = text.ReadLine();
while(line.compare("") != 0)
{
favourites.push_back(line);
line = text.ReadLine();
}
}
int itemCount = FileListBox->GetCount();
if(itemCount == 0)
{
return;
}
int index = 0;
list<wxString>::iterator it;
filename = FileListBox->GetString(index);
for (it = favourites.begin(); it != favourites.end(); it++)
{
while (filename.compare(*it) < 0) {
index++;
if (index == itemCount)
{
return;
}
filename = FileListBox->GetString(index);
}
if (filename.compare(*it) == 0)
{
FileListBox->Check(index);
}
}
}
}
void SlidesFrame::ShowVideos(wxString foldername)
{
wxDir dir(foldername);
if (!dir.IsOpened())
//Check whether folder exists
{
return;
}
int num_items = VideoListBox->GetCount();
for (int i = 0; i < num_items; i++)
{
VideoListBox->Delete(0);
}
videoList.clear();
wxString filename;
wxString filespec = _T("*.mp4");
bool cont = dir.GetFirst(&filename, filespec, wxDIR_FILES);
while (cont)
{
wxString filenamestr(filename);
VideoListBox->Append(filenamestr);
videoList.push_back(filenamestr);
cont = dir.GetNext(&filename);
}
}
void SlidesFrame::ShowTemplates(wxString foldername)
{
wxDir dir(foldername);
if (!dir.IsOpened())
//Check whether folder exists
{
return;
}
int num_items = TemplateListBox->GetCount();
for (int i = 0; i < num_items; i++)
{
TemplateListBox->Delete(0);
}
wxString filename;
wxString filespec = _T("*.ppt*");
bool cont = dir.GetFirst(&filename, filespec, wxDIR_FILES);
while (cont)
{
wxString filenamestr(filename);
TemplateListBox->Append(filenamestr);
cont = dir.GetNext(&filename);
}
}
void SlidesFrame::DefaultFolderOpen()
{
wxString selectedFolder = configmap["Default songs directory"];
if (selectedFolder.compare("") != 0)
{
SetStatusText(selectedFolder, 0);
SlidesFrame::ShowSlides(selectedFolder);
}
selectedFolder = configmap["Default videos directory"];
if (selectedFolder.compare("") != 0)
{
SetStatusText(selectedFolder, 0);
SlidesFrame::ShowVideos(selectedFolder);
}
selectedFolder = configmap["Default templates directory"];
if (selectedFolder.compare("") != 0)
{
SetStatusText(selectedFolder, 0);
SlidesFrame::ShowTemplates(selectedFolder);
}
}
void SlidesFrame::Save()
{
wxString filename = dirName + "\\config.txt";
wxString search_order = "";
int num_platforms = PlatformListCtrl->GetItemCount();
for (int i = 0; i < num_platforms; i++)
{
search_order += PlatformListCtrl->GetItemText(i, 0) + ",";
}
configmap["Search order"] = search_order;
wxFile wxofsFile(filename, wxFile::write);
StringHashMap::iterator it;
wxString line;
for(it = configmap.begin(); it != configmap.end(); ++it )
{
line = it->first;
line << ":" << it->second << "\n";
wxofsFile.Write(line, line.Len());
}
wxofsFile.Close();
wxDir dir(configmap["Default templates directory"]);
if (!dir.IsOpened())
//Check whether folder exists
{
return;
}
wxFile wxofsFile2(configmap["Default templates directory"] + "\\" + "favourites.txt", wxFile::write);
list<wxString>::iterator it2;
favourites.sort();
for(it2 = favourites.begin(); it2 != favourites.end(); ++it2)
{
line = *it2 << "\n";
wxofsFile2.Write(line, wxMBConvUTF16LE());
}
wxofsFile2.Close();
}
void SlidesFrame::OnSongsListCtrlItemRClick(wxListEvent& event)
{
SongsListCtrl->DeleteItem(event.GetIndex());
}
void SlidesFrame::OnSearchSpinCtrlChange(wxSpinEvent& event)
{
configmap["Items per search"] = to_string(SearchSpinCtrl->GetValue());
}
void SlidesFrame::WriteSlides()
{
/*
0
Title
Author/s
CCLI no
1
CCLI
2
One line lyrics from CCLI
3
Lyrics
*/
SetStatusText("Writing songs to files", 0);
bool first = true;
wxString title;
for(unsigned int i = 0; i < songsDetails.size(); i++)
{
wxStringTokenizer tkz(songsDetails[i][0], wxT("\n"));
title = tkz.GetNextToken();
if (songsDetails[i].size() == (unsigned int)lyrics_index)
{
wxString filename = configmap["Default songs directory"] + "\\" + "missing.txt";
wxFile wxofsFile(filename, wxFile::write_append);
wxString content;
if (first)
{
content = "\n--------\n" + title;
first = false;
}
else
{
content = "\n" + title;
}
wxofsFile.Write(content, content.Len());
wxofsFile.Close();
}
else
{
title.Replace((char)(-110), "'");
wxString firstAuthor = tkz.GetNextToken();
wxString ccli_no = tkz.GetString();
if(ccli_no.compare("") == 0)
{
ccli_no = firstAuthor.substr(0, min(firstAuthor.find("/"),firstAuthor.find(",")));
}
wxString filename = configmap["Default songs directory"] + "\\" + title \
+ " (" + ccli_no + ").txt";
wxFile wxofsFile;
if (!OverwriteChkBox->GetValue() && wxofsFile.Exists(filename))
{
continue;
}
wxofsFile.Create(filename, true);
wxString content, lyrics, line;
bool twice = false;
content = songsDetails[i][0];
content << "\n\n\n" << songsDetails[i][1].Trim(false).Trim(true) << "\n";
wxStringTokenizer tkz(songsDetails[i][lyrics_index], wxT("\n"), wxTOKEN_RET_EMPTY);
vector<int> line_counts;
int line_count = 0;
while (tkz.HasMoreTokens())
{
line = tkz.GetNextToken().Trim(false).Trim(true);
int start_bracket, end_bracket;
while(true)
{
start_bracket = line.find("(");
end_bracket = line.find(")");
if (start_bracket != wxNOT_FOUND && end_bracket != wxNOT_FOUND && start_bracket < end_bracket)
{
line = line.substr(0, start_bracket).Trim(true) + " " + line.substr(end_bracket + 1).Trim(false);
}
else
{
break;
}
}
if (line.compare("") == 0 || line.substr(0, 5).Lower().compare("intro") == 0 || line.substr(0, 6).Lower().compare("chorus") == 0 \
|| line.substr(0, 5).Lower().compare("verse") == 0 || line.substr(0, 5).Lower().compare("instr") == 0 \
|| line.substr(0, 5).Lower().compare("outro") == 0 || line.substr(0, 6).Lower().compare("bridge") == 0 \
|| line.substr(0, 13).Lower().compare("repeat chorus") == 0 || line.substr(0, 13).Lower().compare("repeat bridge") == 0 \
|| line.substr(0, 3).Lower().compare("tag") == 0 || line.substr(0, 10).Lower().compare("pre-chorus") == 0 \
|| line.substr(0, 6).Lower().compare("ending") == 0 \
|| line.substr(0, 9).Lower().compare("interlude") == 0 || line.at(0) == '[' || line.at(0) == '(' || line.at(0) == '|')
{
//Assumes empty line before abovementioned text
if (line_count != 0)
{
line_counts.push_back(line_count);
line_count = 0;
}
if (!twice)
{
twice = true;
lyrics << '\n';
}
}
else if (line.substr(0, 9).Lower().compare("copyright") == 0 || line.substr(0, 7).Lower().compare("publish") == 0 \
|| line.substr(0, 6).Lower().compare("writer") == 0 || line.substr(line.Len() - 1, 1).Lower().compare(":") == 0)
{
break;
}
else
{
if(twice)
{
line_count = 1;
twice = false;
lyrics << '\n' << line;
}
else
{
line_count++;
lyrics << '\n' << line;
}
}
}
if (line_count != 0)
{
line_counts.push_back(line_count);
}
vector<vector<int>> line_splits = {{3, 3}, {3, 4}, {4, 4}, {5, 4}, \
{4, 6}, {4, 4, 3}};
//Ambiguities in number of lines = 7, 9, 10, 11
vector<int> split_vector;
vector<int> splits;
int line_no = 0, multiples, remainder;
for (unsigned int ii = 0; ii < line_counts.size(); ii++)
{
if (line_counts[ii] < 6)
{
line_no += line_counts[ii];
}
else if (line_counts[ii] < 12)
{
split_vector = line_splits[line_counts[ii] - 6];
for (unsigned int iii = 0; iii < split_vector.size() - 1; iii++)
{
line_no += split_vector[iii];
splits.push_back(line_no);
}
line_no += split_vector.back();
}
else
{
//For any number more than 11, break for every 4, the last should be more than 4
multiples = line_counts[ii] / 4;
remainder = line_counts[ii] - (multiples*4);
if (remainder == 1)
{
multiples--;
remainder += 4;
}
for (int iii = 0; iii < multiples; iii++)
{
line_no += 4;
splits.push_back(line_no);
}
line_no += remainder;
}
}
if (splits.size() != 0)
{
twice = true;
wxStringTokenizer tkz2(lyrics, wxT("\n"), wxTOKEN_RET_EMPTY);
line_count = 0;
int step = 0;
lyrics = "";
while (tkz2.HasMoreTokens())
{
line = tkz2.GetNextToken();
if (line.compare("") == 0)
{
if (!twice)
{
twice = true;
lyrics << "\n";
}
}
else
{
if (line_count == splits[step])
{
if (splits.size() != (unsigned int)(step + 1))
{
step++;
}
lyrics << "\n\n" <<line;
}
else
{
lyrics << "\n" <<line;
}
line_count++;
twice = false;
}
}
}
content << '\n' << lyrics.Trim(false).Trim(true);
wxofsFile.Write(content);
wxofsFile.Close();
}
}
ReportSongsBtn->Enable(true);
SetStatusText("Song files created", 0);
SlidesFrame::FilterSearch_NonVerbose();
}
void SlidesFrame::ScriptProgression()
{
bool through = false;
for (unsigned int i = curr_index + 1; i < songsDetails.size(); i++)
{
if (songsDetails[i].size() == (unsigned int)lyrics_index)
//Check for songs without lyrics
{
curr_index = i;
through = true;
break;
}
}
if (through)
{
if (selected_platform.compare(AZLyrics + "_removed") == 0)
{
webView-> LoadURL("https://www.azlyrics.com/");
}
else if (selected_platform.compare(Genius + "_removed") == 0)
{
webView-> LoadURL("https://genius.com/");
}
else if (selected_platform.compare(KLove) == 0)
{
webView-> LoadURL("https://www.klove.com/music/songs#music-search-form");
}
else if (selected_platform.compare(Lyrics) == 0)
{
webView-> LoadURL("https://www.lyrics.com/");
}
else if (selected_platform.compare(LyricsOnDemand) == 0)
{
webView-> LoadURL("https://www.lyricsondemand.com/");
}
else if (selected_platform.compare(WorshipTogether+ "_removed") == 0)
{
webView-> LoadURL("https://www.worshiptogether.com/search-results/");
}
else if (selected_platform.compare(UltimateGuitar + "_removed") == 0)
{
webView-> LoadURL("https://www.ultimate-guitar.com/");
}
else
{
webView-> LoadURL("https://www.google.com/");
}
}
else
{
if (curr_platform != PlatformListCtrl->GetItemCount() - 1)
{
through = false;
for (int i = 0; i < curr_index + 1; i++)
{
if (songsDetails[i].size() == (unsigned int)lyrics_index)
//Check for songs without lyrics
{
curr_platform++;
curr_index = i;
through = true;
break;
}
}
if (through)
{
selected_platform = PlatformListCtrl->GetItemText(curr_platform);
if (selected_platform.compare(AZLyrics + "_removed") == 0)
{
webView-> LoadURL("https://www.azlyrics.com/");
}
else if (selected_platform.compare(Genius + "_removed") == 0)
{
webView-> LoadURL("https://genius.com/");
}
else if (selected_platform.compare(KLove) == 0)
{
webView-> LoadURL("https://www.klove.com/music/songs#music-search-form");
}
else if (selected_platform.compare(Lyrics) == 0)
{
webView-> LoadURL("https://www.lyrics.com/");
}
else if (selected_platform.compare(LyricsOnDemand) == 0)
{
webView-> LoadURL("https://www.lyricsondemand.com/");
}
else if (selected_platform.compare(WorshipTogether+ "_removed") == 0)
{
webView-> LoadURL("https://www.worshiptogether.com/search-results/");
}
else if (selected_platform.compare(UltimateGuitar + "_removed") == 0)
{
webView-> LoadURL("https://www.ultimate-guitar.com/");
}
else
{
webView-> LoadURL("https://www.google.com/");
}
}
else
{
SlidesFrame::WriteSlides();
ReportSongsBtn->Enable(true);
webstate = -1;
}
}
else
{
SlidesFrame::WriteSlides();
ReportSongsBtn->Enable(true);
webstate = -1;
}
}
}
wxString SlidesFrame::EncodeURI(const wxString& uri)
{
static unordered_map<int, wxString> sEncodeMap = {
{ (int)'!', "%21" }, { (int)'#', "%23" }, { (int)'$', "%24" }, { (int)'&', "%26" }, { (int)'\'', "%27" },
{ (int)'(', "%28" }, { (int)')', "%29" }, { (int)'*', "%2A" }, { (int)'+', "%2B" }, { (int)',', "%2C" },
{ (int)';', "%3B" }, { (int)'=', "%3D" }, { (int)'?', "%3F" }, { (int)'@', "%40" }, { (int)'[', "%5B" },
{ (int)']', "%5D" }, { (int)' ', "%20" }
};
wxString encoded;
for(size_t i = 0; i < uri.length(); ++i) {
wxChar ch = uri[i];
unordered_map<int, wxString>::iterator iter = sEncodeMap.find((int)ch);
if(iter != sEncodeMap.end()) {
encoded << iter->second;
} else {
encoded << ch;
}
}
return encoded;
}
void SlidesFrame::ExecuteScript(wxWebViewEvent& event)
{
if (webstate == -1)
{
return;
}
wxString url = event.GetURL();
//wxMessageBox(url);
wxString lurl = url;
lurl.MakeLower();
if (url.compare("about:blank") == 0 || url.find("https://vars.hotjar.com") == 0)
{
return;
}
else if (lurl.find("https://profile.ccli.com/account/signin") == 0)
{
webView-> RunScript(
"\
document.getElementById('EmailAddress').value = '[email protected]';\
document.getElementById('Password').value = 'markwongty1997';\
document.getElementById('sign-in').click();\
");
}
else if (lurl.compare("https://reporting.ccli.com/") == 0)
{
if (webstate == 1)
{
webView->LoadURL("https://songselect.ccli.com");
}
else if (webstate == 2)
{
wxString query = SongsListCtrl->GetItemText(curr_index, 0) + " " + SongsListCtrl->GetItemText(curr_index, 1);
query = EncodeURI(query);
webView->LoadURL(wxString::Format("https://reporting.ccli.com/search?s=%s", query));
}
}
else if (lurl.compare("https://reporting.ccli.com/search?") == 0)
{
if (webstate == 2)
{
curr_index++;
if (curr_index == SongsListCtrl->GetItemCount()) {
webstate = -1;
CreateDatabaseBtn->Enable(true);
return;
}
wxString query = SongsListCtrl->GetItemText(curr_index, 0) + " " + SongsListCtrl->GetItemText(curr_index, 1);
query = EncodeURI(query);
webView->LoadURL(wxString::Format("https://reporting.ccli.com/search?s=%s", query));
}
}
else if (url.find("https://reporting.ccli.com/search?s=") == 0)
{
if (webstate == 2)
{
webView-> RunScript(
"\
function myFunc2() {\
document.getElementById('cclDigital').value = \"" + wxString::Format("%d", 1) + "\";\
var evt = document.createEvent('HTMLEvents');\
evt.initEvent('change', false, true);\
document.getElementById('cclDigital').dispatchEvent(evt);\
document.getElementsByClassName('no-margin-bottom button primary margin-right-halfr')[0].click();\
setTimeout(function(){document.getElementById('ModalReportSongForm').submit();}, 1000);\
}\
function myFunc() {\
document.getElementsByClassName('button hollow primary small no-margin')[0].click();\
setTimeout(myFunc2, 500);\
}\
setTimeout(myFunc, 4000);\
");
}
}