-
Notifications
You must be signed in to change notification settings - Fork 1
/
frm.frm
executable file
·1820 lines (1510 loc) · 49.3 KB
/
frm.frm
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
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "richtx32.ocx"
Begin VB.Form frm
Caption = "Visual Regex (by Davide Chiappetta)"
ClientHeight = 11100
ClientLeft = 60
ClientTop = 645
ClientWidth = 12540
LinkTopic = "Form1"
ScaleHeight = 740
ScaleMode = 3 'Pixel
ScaleWidth = 836
StartUpPosition = 1 'CenterOwner
Begin VB.VScrollBar VScrollPat
Height = 5085
Left = 11520
Max = 0
TabIndex = 25
Top = 780
Width = 330
End
Begin VB.CheckBox chkTop
Caption = "top"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 315
Left = 0
TabIndex = 24
Top = 60
Width = 705
End
Begin VB.HScrollBar HScroll
Height = 315
Left = 30
Max = 100
TabIndex = 23
Top = 10740
Width = 11505
End
Begin VB.ComboBox cmbFontSize
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 1320
Style = 2 'Dropdown List
TabIndex = 21
Top = 5850
Width = 855
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 0
Left = 0
TabIndex = 7
Top = 750
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
BackColor = 12648384
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":0000
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.VScrollBar VScroll
Height = 3795
Left = 11580
Max = 0
TabIndex = 6
Top = 6930
Width = 330
End
Begin VB.PictureBox pic
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
BeginProperty Font
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 3885
Left = 30
ScaleHeight = 257
ScaleMode = 3 'Pixel
ScaleWidth = 765
TabIndex = 5
Top = 6840
Width = 11505
End
Begin VB.CheckBox chkIgnoreCase
Caption = "ignore case"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 1800
TabIndex = 2
Top = 90
Width = 1425
End
Begin VB.CheckBox chkGlobal
Caption = "global"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 780
TabIndex = 1
Top = 90
Value = 1 'Checked
Width = 975
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 1
Left = 0
TabIndex = 8
Top = 1170
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":009D
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 2
Left = 0
TabIndex = 9
Top = 1590
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":014A
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 4
Left = 0
TabIndex = 10
Top = 2430
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":01C7
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 5
Left = 0
TabIndex = 11
Top = 2850
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":0244
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 6
Left = 0
TabIndex = 12
Top = 3270
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":02C1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 7
Left = 0
TabIndex = 13
Top = 3690
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":033E
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 8
Left = 0
TabIndex = 14
Top = 4110
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":03BB
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 9
Left = 0
TabIndex = 15
Top = 4530
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":0438
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 10
Left = 0
TabIndex = 16
Top = 4950
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":04B5
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 11
Left = 0
TabIndex = 17
Top = 5370
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":0532
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox r
Height = 435
Index = 3
Left = 0
TabIndex = 20
Top = 2010
Width = 11505
_ExtentX = 20294
_ExtentY = 767
_Version = 393217
Enabled = -1 'True
MultiLine = 0 'False
Appearance = 0
AutoVerbMenu = -1 'True
TextRTF = $"frm.frx":05AF
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Consolas"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "index char/s (start:end) result from regexp"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 240
Index = 6
Left = 60
TabIndex = 29
Top = 6540
Width = 3615
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "index selected char/s with mouse (start:end)"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 240
Index = 5
Left = 60
TabIndex = 28
Top = 6270
Width = 3825
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "select index line pattern and index line text corresponding"
BeginProperty Font
Name = "Arial"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 255
Index = 0
Left = 3420
TabIndex = 27
Top = 450
Width = 5625
End
Begin VB.Label lblValidRegExp
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "Valid"
BeginProperty Font
Name = "Consolas"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 315
Left = 2100
TabIndex = 26
Top = 420
Width = 1185
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "text font size:"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Index = 4
Left = 30
TabIndex = 22
Top = 5940
Width = 1275
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "{F4} de-comment"
BeginProperty Font
Name = "Arial"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 255
Index = 3
Left = 8820
TabIndex = 19
Top = 90
Width = 1710
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "{F5} comment part of strings of line pattern with char ""·"""
BeginProperty Font
Name = "Arial"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 255
Index = 2
Left = 3420
TabIndex = 18
Top = 90
Width = 5355
End
Begin VB.Label lblInfoCollectionMatch
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "Consolas"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 255
Left = 3930
TabIndex = 4
Top = 6540
Width = 7545
End
Begin VB.Label lblInfoCaretTxtString
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "0:0"
BeginProperty Font
Name = "Consolas"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 255
Left = 3930
TabIndex = 3
Top = 6270
Width = 1125
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Pattern: Valid/Invalid"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Index = 1
Left = 30
TabIndex = 0
Top = 450
Width = 2010
End
Begin VB.Menu pMenu
Caption = "pMenu"
Visible = 0 'False
Begin VB.Menu pMenuCopy
Caption = "copy"
End
Begin VB.Menu pMenuPaste
Caption = "paste"
End
Begin VB.Menu pMenuCut
Caption = "cut"
End
End
Begin VB.Menu mnuFile
Caption = "File"
Begin VB.Menu mnuLoadALL
Caption = "load pattern and string"
End
Begin VB.Menu mnuSaveALL
Caption = "save pattern and string"
End
End
Begin VB.Menu mnuAbout
Caption = "?"
End
End
Attribute VB_Name = "frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function ShellExecuteA Lib "shell32.dll" ( _
ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function CreateCaret Lib "user32" (ByVal hWnd As Long, ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SetCaretPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function ShowCaret Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function HideCaret Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function DestroyCaret Lib "user32" () As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Const STRING_ALLOW = " ""!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
Dim g_pattern As String
Dim g_string As String
Private Type POINTSINGLE
X As Single
Y As Single
End Type
Dim ptMouseDown As POINTSINGLE
Private Type t_pattern
pattern As String
testo As String
iSelectPat As Long
arPar(100) As String
End Type
Dim p As t_pattern
Private Type t_gen
maxLine As Long 'max lines on frame visible
maxChar As Long 'max char on line
cy As Long
cx As Long
iSelLine As Long
iSelCharStart As Long
iSelCharEnd As Long
ShowCaret As Boolean
ar(100) As String
End Type
Private gen As t_gen
Private Type t_match
firstIndex As Long
length As Long
isMatch As Boolean
End Type
Private arMatch(100) As t_match
Private Sub chkGlobal_Click()
processaRegExp
draw
End Sub
Private Sub chkIgnoreCase_Click()
processaRegExp
draw
End Sub
Private Function getTextValidFromComment(ByVal s As String) As String
t = ""
For a = 1 To Len(s)
ch = Mid(s, a, 1)
If ch = "·" And comment = False Then
comment = True
ElseIf ch = "·" And comment = True Then
comment = False
GoTo salto
End If
If comment = False Then
t = t & ch
End If
salto:
Next a
getTextValidFromComment = t
End Function
Private Sub colorizaCommentiPattern(ByVal Index As Integer)
LockWindowUpdate r(Index).hWnd
r(Index).Tag = "skip"
iStart = r(Index).SelStart
s = r(Index).Text
n = 0
colora = False
s = r(Index).Text
r(Index).SelStart = 0
r(Index).SelLength = Len(s)
r(Index).SelColor = vbBlack
If InStr(r(Index).Text, "·") = 0 Then
r(Index).Tag = ""
LockWindowUpdate False
r(Index).SelStart = iStart
Exit Sub
End If
For a = 1 To Len(s)
ch = Mid(s, a, 1)
If ch = "·" And colora = False Then
colora = True
i = a - 1
ElseIf ch = "·" And colora = True Then
colora = False
r(Index).SelStart = i
r(Index).SelLength = n + 1
r(Index).SelColor = &HD0D0D0
n = 0
End If
If colora = True Then
n = n + 1
End If
Next a
If colora = True Then
r(Index).SelStart = i
r(Index).SelLength = n
r(Index).SelColor = &HD0D0D0
End If
r(Index).SelStart = iStart
r(Index).Tag = ""
LockWindowUpdate False
End Sub
Private Sub chkTop_Click()
If chkTop.Value = 1 Then
Call SetWindowPos(Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
Else
Call SetWindowPos(Me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End If
End Sub
Private Sub cmbFontSize_Click()
If cmbFontSize.Tag = "skip" Then Exit Sub
initControl "Consolas", cmbFontSize.Text
draw
End Sub
Private Sub Form_Load()
p.pattern = getTextValidFromComment(r(0).Text)
m = UBound(p.arPar) - r.Count + 1
If m < 0 Then m = 0
VScrollPat.max = m
'put trash to array for test
'For a = 0 To UBound(gen.ar)
' gen.ar(a) = a & " " & Rnd(100000000) & Rnd(1000000000)
'Next a
gen.ar(0) = "234-234-2345"
gen.ar(1) = "student-id@alumni.school.edu"
gen.iSelLine = -1
For a = 10 To 40 Step 2
cmbFontSize.AddItem a
Next a
cmbFontSize.Tag = "skip"
cmbFontSize.ListIndex = 3
cmbFontSize.Tag = ""
initControl "Consolas", cmbFontSize.Text
loadALL
drawPattern
draw
End Sub
Sub initControl(ByVal fontname As String, ByVal fontsize As Long)
pic.fontname = fontname
pic.fontsize = fontsize
gen.cx = pic.TextWidth("W")
gen.cy = pic.TextHeight("Gj")
gen.maxLine = pic.ScaleHeight \ gen.cy
gen.maxChar = pic.ScaleWidth \ gen.cx
m = UBound(gen.ar) - (gen.maxLine - 1)
If m < 0 Then m = 0
VScroll.max = m
End Sub
Sub drawPattern()
For a = 0 To r.Count - 1
n = a + VScrollPat.Value
If n = p.iSelectPat Then
If r(a).BackColor <> &HC0FFC0 Then r(a).BackColor = &HC0FFC0
Else
If r(a).BackColor <> vbWhite Then r(a).BackColor = vbWhite
End If
r(a).Tag = "skip"
r(a).Text = p.arPar(n)
colorizaCommentiPattern a
r(a).Tag = ""
Next a
End Sub
Sub draw()
pic.Line (0, 0)-(pic.ScaleWidth, pic.ScaleHeight), vbWhite, BF
hs = HScroll.Value * gen.cx
Y = 0
For a = 0 To gen.maxLine - 1
n = a + VScroll.Value
If n = gen.iSelLine Then
If a = 0 Then
pic.Line (0, 0)-(pic.ScaleWidth - 1, Y + gen.cy + 1), vbRed, B
pic.Line (0, 0)-(pic.ScaleWidth - 2, Y + gen.cy + 2), vbRed, B
Else
pic.Line (0, Y - 1)-(pic.ScaleWidth - 1, Y + gen.cy + 1), vbRed, B
pic.Line (0, Y - 2)-(pic.ScaleWidth - 1, Y + gen.cy + 2), vbRed, B
End If
'il cuore del disegno regexp
For B = 0 To UBound(arMatch)
If arMatch(B).isMatch = False Then Exit For
fi = (arMatch(B).firstIndex * gen.cx) - hs
le = (arMatch(B).length * gen.cx) '+ hs
pic.Line (fi, Y)-(fi + le, Y + gen.cy), &HC0C0F0, BF
pic.Line (fi, Y)-(fi + le, Y + gen.cy), &H505050, B
Next B
'il caret
'If gen.ShowCaret = True Then
If gen.ShowCaret = True Then
caretStart = (gen.iSelCharStart * gen.cx) - hs
caretEnd = (gen.iSelCharEnd * gen.cx) - hs
If caretStart <> caretEnd Then
pic.Line (caretStart, Y)-(caretEnd, Y + gen.cy), &HA0A0A0, BF
End If
'pic.Line (caretEnd + 1, y)-(caretEnd + 1, y + gen.cy), vbBlue, BF
SetCaretPos caretEnd, Y
End If
'End If
End If
pic.CurrentX = -hs
pic.CurrentY = Y
pic.Print gen.ar(n)
Y = Y + gen.cy
Next a
End Sub
Function processaRegExp()
On Error GoTo hell
Dim rx As New RegExp
Dim a As Long
Dim mColl As MatchCollection
lblInfoCollectionMatch.Caption = ""
lblValidRegExp.ForeColor = &H8000&
lblValidRegExp.Caption = "Valid"
Erase arMatch
If gen.iSelLine = -1 Then
rx.Global = chkGlobal.Value = 1
rx.IgnoreCase = chkIgnoreCase.Value = 1
rx.pattern = p.pattern
Set mColl = rx.Execute("dummy") 'test is error
Exit Function
End If
testo = gen.ar(gen.iSelLine)
If Trim(testo) = "" Or Trim(p.pattern) = "" Then
Exit Function