forked from VFPX/FoxcodePlus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfoxcodeplus.prg
More file actions
6815 lines (5507 loc) · 246 KB
/
Copy pathfoxcodeplus.prg
File metadata and controls
6815 lines (5507 loc) · 246 KB
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
*/--------------------------------------------------------------------------------------------------------
*/ Description..: O FoxcodePlus não substituí o IntelliSense do VFP, ele interage em pontos que o
*/ IntelliSense padrão do VFP não ajuda adequadamente ou não faz absolutamente nada.
*/ A ideia do FoxcodePlus é trazer um pouco da funcionalidade do IntelliSense do Visual Studio
*/ para o VFP, ou seja, dar mais agilidade e evitar erros ao escrever os programas.
*/
*/ Author.......: Rodrigo Duarte Bruscain - São Paulo SP - Brazil | Kitchener ON - Canada
*/ Date start...: May 01, 2010
*/--------------------------------------------------------------------------------------------------------
*/
*/ BETA 3.14 - ??? ??, 2013
*/--------------------------------------------
* NEW: IntelliSense para propriedades em classes PRG checando o metodo atual e o INIT se tem propriedade recebendo objeto
* NEW: IntelliSense para propriedades em FORMS checando o metodo atual e o INIT se tem propriedade recebendo objeto
* NEW: Assinatura dos user metodos em run-time. (consigo somente qdo a assinatura esta na mesma linha, mudar this.GetMembers())
* NEW: Seleção de captionlization para campos e fields
* FIX: Tratar erro qdo esta conectado a outro database diferente de SQL. (verificar se tem como usar outros database)
*
*
*/
*/ BETA 3.13 - May 4, 2013
*/--------------------------------------------
* NEW: SQL Intellisense (valid only inside TEXT...ENDTEXT)
* OK - Tables with incremental search in current database connected
* OK - Table and Alias with incremental searching in currente SQL instruction with the database disconnected
* OK - Fields with incremental searching in current database connected considering the tables used in currente SQL instruction
* OK - Fields list from tables and Alias when pressed "." dot
* OK - IntelliSense for tables/alias pressing SPACE after the clauses FROM, JOIN and INTO
* NEW: Intellisense to the command "INDEX ON"
* NEW: Now, objects instatied at run-time show more informations in the tooltip.
* NEW: Intellisense for object created by "FOR EACH" at run-time and designer-time
* NEW: Intellisense for Collection object at run-time and designer-time (ex: thisform.grid1.columns[1].)
* NEW: Referencing any object through of a variable at run-time and designer-time (ex: loObj = _screen / loObj = thisform.grid1.column1)
* NEW: FoxCode table update through the merger between native FoxCode and FoxCode provided by FoxcodePlus.
* FIX: SHIFT+ARROWS, SHIFT+END and SHIFT+HOME behavior not adequate
* FIX: "THIS" in containers object in some cases the IntelliSense hasn't load.
*/ BETA 3.12 - April 21, 2013
*/--------------------------------------------
* NEW: Now, Create Table <tablename> and Create DBF <tablename> shown tables and fields in write-time.
* NEW: Possibility to select an item in IntelliSense pressing "*" or "/"
* NEW: IntelliSense to the comand REPLACE
* FIX: _MemberData Capitalization for objects at run-time.
* FIX: Thisform in form designer occur an error when the object has a property "Caption" with data type # of char.
* FIX: "Error List Window" doesn't work when activated directly from "View" menu
* FIX: In select sql-command the clause "into ..." now is dismembered
* FIX: Sometimes an error happens at run-time when the IntelliSense try to open the list
* FIX: CTRL+S conflict
* FIX: OleControl with anonymous object
*/ BETA 3.11 - April 03, 2013
*/--------------------------------------------
* NEW: Support for Windows 8
* NEW: Like in Visual Studio, the native or custom Code Snippets can be shown in the IntelliSense.
* NEW: Now, VFP can read custom Code Snippets for functions (native IntelliSense is only for commands)
* NEW: Several Code Snippets were included for commands and functions
* NEW: In the IntelliSense Manager there is an option to increment the IntelliSense only with keywords started by typed
* NEW: In the IntelliSense Manager there is an option to include the Code Snippets in IntelliSense
* NEW: In the IntelliSense Manager there is an option to replace the native IntelliSense in form and class desinger
* NEW: Now, when an object in a form and class designer is selected in incremental IntelliSense, the hierarchy is included
* NEW: IntelliSense to the command "COPY TO <MyFileName> TYPE"
* NEW: IntelliSense to the command "SET PROCEDURE TO <listfiles>"
* NEW: Now, IntelliSense can read classes and functions invoked by "SET PROCEDURE TO"
* NEW: IntelliSense to the command "SET CLASSLIB TO <filename>"
* NEW: Now, IntelliSense can read classes invoked by "SET CLASSLIB TO"
* NEW: IntelliSense to the command "DO FORM <filename>"
* NEW: IntelliSense to the command "REPORT FORM <filename>"
* NEW: IntelliSense to the command "USE <filename>"
* NEW: Now, IntelliSense is showing in the tooltip more information about the controls in forms and class designer
* NEW: Now, tooltip with signature from custom procedures and custom methods are shown. In addiction, number of parameters are controlled and summary is supported.
* NEW: Now, API functions at write-time show the signature.
* NEW: Possibility to select an item in IntelliSense pressing "," or "#"
* FIX: Typing "." in properties documentation using "&&&"
* FIX: Invalid subscript error to obtain the summary
* FIX: VFP freeze when exist _MemberData property in _Screen object
* FIX: Clauses in command "USE" in the native IntelliSense VFP have don't work correctly when table or alias name contain the name one of clauses
* FIX: SET PATH at run-time is not considered when a file is referenced at write-time
* FIX: IntelliSense doesn't work with properly with commands like SELECT SQL with ";" used to break lines
* FIX: Incremental IntelliSense doesn't work in "#Preprocessor Directive"
* FIX: "Local Array laArrayName[10]" in IntelliSense shows "Array laArrayName" and should be "laArrayName"
*/ BETA 3.XX
*/----------------------------------------
* FIX: Clause "IN" in several command doesn't open IntelliSense for tables.
* FIX: Added tables from DataEnviroment when used clause "IN" in several commands.
* FIX: Typing "." outside of the editor in some places.
* FIX: Typing "=" outside of the editor in some places.
* FIX: Sometimes an error happend to obtain constants from file .H
* FIX: API Exception ... more modifications to avoid this problem.
* FIX: FoxcodePlus has not considered the "Error Tip" when unchecked in IntelliSense Manager.
* XXX FIX: Code snippets inserted in wrong places
* NEW: IntelliSense for classes in PRG file when an object is instantiated with CreateObject() and NewObject() in the same PRG.
* NEW: Shows the FoxcodePlus version in IntelliSense Manager and in error messagebox.
* NEW: More informations if error happens in FoxcodePlus and now a file called foxcodeplus.err is generated.
* FIX: "m." wasn't work.
* FIX: Sometimes some tables in DataEnvironment weren't shown.
* FIX: Automatic selection erases contents when typing "." or "=" after close with ")" or "]"
* FIX: Restore default VFP fonts if uncheck option "Visual Studio font style" in IntelliSense Mananger.
* FIX: Sometimes when select an item from a class member or table field, they are inserted in wrong place.
* FIX: When included the path of PRG or VCX file when used Createobject() or NewObject(), sometimes the IntelliSense wasn't work.
* FIX: Possibility to select an item in IntelliSense typing with "<" or ">" or "+" or "-"
* FIX: Possibility to select an item in IntelliSense closing the parenthesis ")".
* FIX: When a procedure was incluided in a classe in PRG file sometimes a bug happend.
* FIX: Some changes in IntelliSense list to avoid the "API Call" error.
* FIX: In some cases tooltip for members class doesn't appear when the IntelliSense was opened.
* FIX: Duplicated items in IntelliSense for Sql Command.
* NEW: Included more commands to SQL Command IntelliSense
* FIX: Constants files .H with long directory + long file name .H
* FIX: Use more than one constants files .H in the same PRG, Method or Function
* FIX: Adjusted error message to possibly copy and paste the error
* FIX: DataEnviroment with relation object
* FIX: Capitalization / Expansion now can use Foxcode Default option
* FIX: Tables in DataEnvironment using CursorAdapter
* FIX: SET EXACT has been turned "ON" even when turned "OFF"
* NEW: Error list has included in default menu VIEW with HotKey to activate "Error List" window.
* NEW: Incremental IntelliSense for tables defined in DataEnvironment Forms and Reports.
* NEW: IntelliSense for fields in DataEnvironment Forms and Reports.
* NEW: IntelliSense for command "REPORT FORM"
* FIX: In class in prg file, methods inherited from class has repeted if the same method has included by developer.
* FIX: ? or ?? has not sent the message to screen when necessary.
* FIX: Canceled selection to procedural functions or commands when typing "."
* FIX: In Command window with "Error List" activated when execute the command "Clear", "Error list" was cleared.
* FIX: Setting breakpoints on prg editor triggers 'invalid function argument type or count' when the debugger is auto-opened for the first time.
* FIX: When an item was positioned using key up, down, pgup or pgdw, the item wans't selected.
*/ BETA 2 - 2012.11.10
*/------------------------------------
*/ FIX: Fast typing
*/ FIX: Picos de consumo do processador
*/ FIX: When another FLL library was called without ADDITIVE clause FoxcodePlus crashed.
*/ FIX: Objetos selecionados na lista do foxcodeplus teclando "." agora são selecionados. (OBS: In Default VFP IntelliSense doesn't work yet.)
*/ FIX: Quando estou usando o Report, nas propriedades do objeto, Aba "Print When", Propriedade "Print only when expression is true:" pressionar "="
*/ FIX: Ao criar um prg pela 1a. vez o IntelliSense nao abre, se salvar e abri-lo funciona.
*/ FIX: Quando pressiono "(" o item da lista do IntelliSense nao é completado.
*/ FIX: Error list quando dockado em outro janela ocorre erro de dimensionamento na coluna 3
*/ FIX: Visual Studio Colors Style background yellow string was removed.
*/ NEW: Error list para forms e classes
*/ NEW: Dokagem com redimensionamento do error list.
*/ NEW: _memberdata para objetos instanciados em runtime (OBS -> Sem suporte para _memberdata protected or hidden para objetos instanciados). As propriedade
*/ NEW: Ler conteudo de arquivo .H em forms e PRGs
*/ NEW: #DEFINE e #INCLUDE em forms nao aparece
*/ NEW: Em controles visuais o tooltip apresenta o caption de controles que tem a propriedade caption.
*/ NEW: IntelliSense para o comando alter table
*/ NEW: _Tally now is present in incremental IntelliSense
*/ NEW: Tooltip de erro de programação em write-time com parametro no foxcode.app
*/ BETA 1 - 2012.10.10
*/------------------------------------
*/ FIX: ESC cancelava quando estava dentro da lista do IntelliSense.
*/ FIX: Correção de apresentacao incorreta no IntelliSense qdo uma propriedade em write-time é tipada
*/ FIX: Correção do conflito com o Debugger. Agora o IntelliSense nao é apresentado enquanto o Debugger estiver aberto.
*/ FIX: Corrigido comportamento para desenvolvedores que usam o VFP em background. Estava apresentando informações no _screen indevidamente.
*/ NEW: IntelliSense agora identifica no tooltip as PEMs que são Read Only.
*/ FIX: Corrigido o metodo this.GetMembers() que não trazia algumas users pmes.
*/ FIX: Corrigido o metodo this.GetDot() que estava considerando linha comentada
*/ FIX: Tratamento de erros do FoxcodePlus (ninguem faz tudo 100% rsrsrsrs)
*/ NEW: IntelliSense de variaveis valorizadas por outras variaveis que contem createobjet(), newobject(), createobjectex()
*/ NEW: Disponibilizado IntelliSense para createobjet(), newobject(), createobjectex() em write-time
*/ NEW: IntelliSense abria dentro de textos o que atrapalhava a digitacao livre.
*/ NEW: IntelliSense abria dentro do Text...EndText, agora é abre somente dentro dos delimiters.
*/--------------------------------------------------------------------------------------------------------
*/ WISHLIST
*/--------------------------------------------------------------------------------------------------------
*- ERROR: funcoes que abrem o IntelliSense do vfp estão em conflito com o foxcodeplus ... set(), adir(), etc.
*- ERROR: Erro no "code zoom" do relatorio em "propriedades" (editor do vfp aberto em outra janela)
*- MELHORIA: Salvar dockagem da "Error List"
*/----------------------------------------------------------------------------------------------------
*/ Starting FoxcodePlus
*/----------------------------------------------------------------------------------------------------
#DEFINE WM_KEYUP 0x0101
#DEFINE WM_DESTROY 0x0002
#DEFINE CRLF chr(13) + chr(10)
external array plaCodePrg
external array plaItemsVars
set console off
if not file(home(1)+"foxtools.fll") or not val(substr(version(4),1,2)) >= 9
return .f.
endif
if not file(home(1)+"foxcodeplus.ini")
return .f.
endif
use (_foxcode) alias ___chkFoxcodeVersion in 0 shared again
locate for "foxcodeplus" $ lower(data)
if found()
use in ___chkFoxcodeVersion
else
messagebox("FoxcodePlus has not been installed correctly."+chr(13)+"Go to the IntelliSense Manager to update your FoxCode table.",16,"FoxcodePlus")
use in ___chkFoxcodeVersion
return .f.
endif
set message to "Loading FoxcodePlus..."
with _screen
.AddProperty("FoxcodePlus",.null.)
.FoxCodePlus = createobject("FoxcodePlusMain")
endwith
set message to
set console on
*- Definicao do menu "Error List" no menu "View" do VFP
define bar 2 of _MVIEW prompt "\<Error List" message "Show Error List at write-time" key ALT+K,"Alt+K" picture home(1)+"foxcodeplus\images\error_list_menu.bmp" skip for type("_screen.foxcodeplus.EditorSource")<>"N"
on selection bar 2 of _MVIEW _screen.foxcodeplus.showerrorlist()
*/----------------------------------------------------------------------------------------------------
*/ FoxcodePlus Class
*/----------------------------------------------------------------------------------------------------
define class FoxCodePlusMain as custom
IntelliSense = .null. &&& objeto com a lista de itens do IntelliSense do foxcodeplus
*FoxTools = .null. &&& classe para maipulacao do editor da IDE do VFP.
ToolbarProcInfo = .null. &&& objeto com a toolbar com informações do programa aberto
FormErrorList = .null. &&& objeto com o form que exibe os erros de compilação em write-time
ToolTip = .null. &&& objeto com o tooltip
LastTopToolTip = 0 &&& somente para auxiliar na apresentação do tooltip
LastLeftToolTip = 0 &&& somente para auxiliar na apresentação do tooltip
TextLine = "" &&& texto da linha corrente
TextLine2 = "" &&& texto da linha corrente (anterior a modificacao)
WordCount = 0 &&& total de palavras na linha corrente
LastWord = "" &&& ultima palavra da linha atual (da posicao do ponteiro)
LastKey = 0 &&& ultima tecla pressionada
CursorPos = 0 &&& posicao corrente dentro do texto
CursorLine = 0 &&& linha atual onde o cursor esta posicionado
MaxWidth = 0 &&& width do item mais largo incluido no IntelliSense
*dimension NoIntelliSense[1,3] &&& comandos e funcoes que não devem ter IntelliSense do foxcodeplus
NoIntelliSense = "" &&& comandos e funcoes que não devem ter IntelliSense do foxcodeplus
FoxcodeCore = .f. &&& .T. indica que o IntelliSense do core do vfp esta aberto
HasDebugger = .f. &&& .T. indica que o debug do vfp esta aberto
HasSelectedItem = .f. &&& controla inserçao do code snippet para comandos e funcoes
LoadScriptBoolean = .f. &&& indica que o script "Boolean" do foxcode.dbf e foxcode.app deve ser executado
EditorSource = -1 &&& editor onde o IntelliSense esta aberto
EditorFileName = "" &&& nome do arquivo aberto no editor
EditorFontName = "" &&& nome da fonte usada no editor
EditorFontSize = 0 &&& tamanho da fonte usada no editor
EditorHwnd = 0 &&& Handle da tela corrente do editor
EditorToolTip = .null. &&& objeto com o tooltip do editor
TmpFile = sys(2023)+"\tmp"+sys(2015)+".tmp" &&& nome do arquivo temporario usado no mecanismo do IntelliSense
ProcClass = "" &&& nome da classe corrente de um prg em write-time
ProcBaseClass = "" &&& nome do baseclass de classe corrente de um prg em write-time
ControlClassName = "" &&& nome da classname de um um objeto de controle inserido em um define class de um prg com ADD OBJECTS
ControlOleClass = "" &&& nome do Oleclass de um um objeto de controle inserido em um define class de um prg com ADD OBJECTS
WithReference = "" &&& armazena a ultima referencia do with/endwith antes de selecionar um item no IntelliSense
IncrementalResult = .t. &&& indica que o IntelliSense retorna somente oq foi encontrado oq contem na palavra digitada
CommandCase = "" &&& upper, lower or proper to the vfp commands
FunctionCase = "" &&& upper, lower or proper to the vfp functions
HasDot = .f. &&& indica se tem ou não "." na linha capturada
IsComment = .f. &&& indica que a linha capturada é um comentario
IsTextEndText = .f. &&& .T. indica que esta dentro um bloco TEXT...ENDTEXT
TextEndBlock = "" &&& bloco de todo o texto do TEXT...ENDTEXT posicionado
IsSqlIntelliSense = .f. &&& indica que é uma instrucao SQL dentro de um TEXT...ENDTEXT e por isso abertura do intellisense SQL
dimension Items[1,4] &&& array with properties, methods, events, procedures, vars, cursos, tables and dlls
dimension ItemsTables[1,2] &&& tabelas encontradas em write-time e o codigo de programa de criação da mesma.
dimension ItemsObjects[1,3] &&& objetos adicionados pelo "define class ... add object" e suas respectivas classes.
dimension ItemsAuxVars[1,4] &&& usado para auxiliar nas variaveis valorizadas por outra variavel (Var = AnotherVar)
dimension Environment[9] &&& array que controla o ambiente da IDE do VFP para o Foxcodeplus
dimension ItemsCodeSnippets[1,2] &&& Itens definidos no foxcode.dbf
dimension FoxcodeFunctions[1] &&& Funcoes contidas no foxcode.dbf
*- used in foxcodeplus.ini
chkFC = "1"
chkTF = "1"
chkControl = "1"
chkObj = "1"
chkVar = "1"
chkAPI = "1"
chkFont = "1"
chkColors = "1"
chkErrorList = "1"
chkErrorListDockPos = 3
chkErrorToolTip = "1"
chkCodeSnippet = "1"
chkAutoCloseQuotes = "1"
cboSearch = "1"
chkMngDesignTime = "1"
cboDisplayCount = 10
chkTFsql = "1" &&& SQL Server and others
chkIncrTablesSql = "1" &&& SQL Server and others
chkIncrFieldsSql = "1" &&& SQL Server and others
*/------------------------------------------------------------------------------------------------
*/ inicio o foxcodeplus
*/------------------------------------------------------------------------------------------------
protected procedure init
set console off
*- carrego as configurações do foxcodeplus
local lcSets, lnDisplayCount, lcAlias, lcDefaultCase
lcSets = iif(file(home(1)+"foxcodeplus.ini"), filetostr(home(1)+"foxcodeplus.ini"), "")
lnDisplayCount = int( val(strextract(lcSets,"<cboDisplayCount>","</cboDisplayCount>")) )
this.cboDisplayCount = iif(between(lnDisplayCount,10,15), lnDisplayCount, 10)
this.chkFC = strextract(lcSets,"<chkFC>","</chkFC>")
this.chkTF = strextract(lcSets,"<chkTF>","</chkTF>")
this.chkControl = strextract(lcSets,"<chkControl>","</chkControl>")
this.chkObj = strextract(lcSets,"<chkObj>","</chkObj>")
this.chkVar = strextract(lcSets,"<chkVar>","</chkVar>")
this.chkAPI = strextract(lcSets,"<chkAPI>","</chkAPI>")
this.chkFont = strextract(lcSets,"<chkFont>","</chkFont>")
this.chkColors = strextract(lcSets,"<chkColors>","</chkColors>")
this.chkCodeSnippet = strextract(lcSets,"<chkCodeSnippet>","</chkCodeSnippet>")
this.chkErrorList = strextract(lcSets,"<chkErrorList>","</chkErrorList>")
this.chkErrorToolTip = strextract(lcSets,"<chkErrorToolTip>","</chkErrorToolTip>")
this.chkErrorListDockPos = int( val( strextract(lcSets,"<chkErrorListDockPos>","</chkErrorListDockPos>") ) )
this.chkAutoCloseQuotes = strextract(lcSets,"<chkAutoCloseQuotes>","</chkAutoCloseQuotes>")
this.cboSearch = strextract(lcSets,"<cboSearch>","</cboSearch>")
this.chkTFsql = strextract(lcSets,"<chkTFsql>","</chkTFsql>")
this.chkIncrTablesSql = strextract(lcSets,"<chkIncrTablesSql>","</chkIncrTablesSql>")
this.chkIncrFieldsSql = strextract(lcSets,"<chkIncrFieldsSql>","</chkIncrFieldsSql>")
*- objeto que apresenta o IntelliSense
this.IntelliSense = newobject("FoxCodePlusIntelliSense","FoxCodePlusIntelliSense.vcx")
*- objeto para manipulacao do editor
*this.FoxTools = newobject("FoxTools","FoxcodeTools.fxp")
*- objeto para visualização do tooltip da lista de itens do IntelliSense
this.ToolTip = newobject("ToolTip","FoxCodeToolTip.fxp")
*- objeto para visualização do tooltip do editor
this.EditorToolTip = newobject("ToolTip","FoxCodeToolTip.fxp")
*- apresenta os erros em write-time
if this.chkErrorList = "1"
this.ShowErrorList()
endif
*- se trabalho com a toolbar do Modify Command
*this.ToolBarProcInfo = newobject("ToolbarProcInfo","FoxCodePlusIntelliSense.vcx")
*this.ToolBarProcInfo.show()
*- configuro as teclas abaixo para interagir com o IntelliSense
on key label "." _screen.FoxCodePlus.GetDot()
on key label "=" _screen.FoxCodePlus.GetEqual()
*- comandos sem IntelliSense plus porque usam o intelisense padrao
this.NoIntelliSense = "<activate><add><append><build><browse><clear><close><crea><creat><create><copy><deactivate><do form>"+;
"<define><local><delete><display><drop><hide><keyboard><list><modify><move><on>"+;
"<prtinfo(><pop><push><release><remove><rename><restore><save><scatter><gather><set><set(><set collate to>"+;
"<set database to><set date><set order to><set path to><set strictdate to>"+;
"<set udfparms to><show><size><use><report><zap><protected><hidden><wait>"
lcAlias = alias()
use (_foxcode) again alias __xfoxcode in 0 shared
Select __xfoxcode
*- comandos e funcoes sem IntelliSense plus porque usam o intelisense padrao
*!* select type, iif(type="F", abbrev+"(", expanded)) ;
*!* from __xfoxcode ;
*!* where ( inlist(type,"F","C") and ;
*!* inlist(cmd,"{}","{funcmenu}","{funcmenu2}","{setsysmenu}","{onkeymenu}","{dbgetmenu}","{setmenu}","{onoffmenu}") or ;
*!* (cmd="{cmdhandler}" and not empty(data)) ) and ;
*!* not ",T" $ strtran(data," ","") and not deleted() ;
*!* into array this.NoIntelliSense
*- foxcode.dbf functions
select Expanded from __xfoxcode where type = "F " into array this.FoxcodeFunctions
*- Upper, lower or proper to the vfp commands e functions
locate for __xfoxcode.type = "V" &&- Foxcode Default
lcDefaultCase = iif(found(), __xfoxcode.case, "")
go top
locate for __xfoxcode.type = "C" &&- Commands
this.CommandCase = iif(found(), __xfoxcode.case, "")
if empty(this.CommandCase)
this.CommandCase = lcDefaultCase
endif
go top
locate for __xfoxcode.type = "F" &&- Functions
this.FunctionCase = iif(found(), __xfoxcode.case, "")
if empty(this.FunctionCase)
this.FunctionCase = lcDefaultCase
endif
*- Itens para o codesnippet definidos no foxcode.dbf
if this.chkCodeSnippet = "1"
select Abbrev, Expanded from __xfoxcode where type = "U" and not deleted() into array this.ItemsCodeSnippets
else
dimension This.ItemsCodeSnippets[1,2]
This.ItemsCodeSnippets[1,1] = ""
endif
use in __xfoxcode
if used(lcAlias)
select (lcAlias)
endif
*- Incremental IntelliSense.
*- pesquisa pelo IntelliSense a cada tecla pressionada.
bindevent(0, WM_KEYUP, this, "GetKeyPressed", 4)
endproc
*/------------------------------------------------------------------------------------------------
*/ used on bindevent and to control the main method
*/------------------------------------------------------------------------------------------------
protected procedure GetKeyPressed
lparameters pln1 as Integer, pln2 as Integer, plnKey as Integer, pln4 as Integer, pll5 as Boolean
set console off
sys(2030,0)
*- check if debug is active
*- desabilito o IntelliSense se o debug estiver ativo para nao entrar em conflito com o foxcodeplus.
this.ChkDebugger()
if this.HasDebugger
if this.IntelliSense.Showed
this.IntelliSense.hide()
endif
sys(2030,1)
return
endif
*- Save VFP environment
this.SetFoxcodePlusEnvironment(1)
*- main function
this.Main(pln1, pln2, plnKey, pln4, pll5)
*- Restore VFP environment
this.SetFoxcodePlusEnvironment(0)
*this.EditorToolTip.NoClose = .f.
set console on
activate screen &&- caso o Error list esteja aberto asseguro de que qualquer informacao "output" seja enviada ao _Scree
sys(2030,1)
return
endproc
*/------------------------------------------------------------------------------------------------
*/ Verifico o que estou digitando para compor o montar o conteudo para o IntelliSense
*/ **- MAIN FUNCTION -**
*/------------------------------------------------------------------------------------------------
protected procedure Main
lparameters pln1 as Integer, pln2 as Integer, plnKey as Integer, pln4 as Integer, pll5 as Boolean
set console off
*- sempre que teclar algo, asseguro de fechar o tooltip do editor caso esteja aberto
if lastkey() <> 46
this.EditorToolTip.hide()
endif
*- check for a valid editor and foxtools.fll
if not this.SetWontop()
if this.IntelliSense.Showed
this.IntelliSense.hide()
endif
return
endif
*- controlo a integridade da tela "Error List".
*- isso pq na command window eu posso enviar um "clear" e limpar a tela.
*- com o codigo abaixo mais alguns codigos no lostfocus da tela e no activate resolvo o problema.
if type("this.FormErrorList.LockScreen") = "L"
if this.FormErrorList.LockScreen = .t.
this.FormErrorList.LockScreen = .f.
this.FormErrorList.refresh()
endif
endif
*- save lastkey pressed (used to increment)
this.LastKey = lastkey()
*- invalid combination key
if (this.LastKey = 50 and plnKey = 40) or ; &&- SHIFT + ARROW DOWN
(this.LastKey = 50 and plnKey = 16) or ; &&- SHIFT + ARROW DOWN
(this.LastKey = 56 and plnKey = 38) or ; &&- SHIFT + ARROW UP
(this.LastKey = 56 and plnKey = 16) or ; &&- SHIFT + ARROW UP
(this.LastKey = 54 and plnKey = 39) or ; &&- SHIFT + ARROW RIGHT
(this.LastKey = 54 and plnKey = 16) or ; &&- SHIFT + ARROW RIGHT
(this.LastKey = 52 and plnKey = 37) or ; &&- SHIFT + ARROW LEFT
(this.LastKey = 52 and plnKey = 16) or ; &&- SHIFT + ARROW LEFT
(this.LastKey = 57 and plnKey = 33) or ; &&- SHIFT + ARROW PGUP
(this.LastKey = 57 and plnKey = 16) or ; &&- SHIFT + ARROW PGUP
(this.LastKey = 51 and plnKey = 34) or ; &&- SHIFT + ARROW PGDN
(this.LastKey = 51 and plnKey = 16) or ; &&- SHIFT + ARROW PGDN
(this.LastKey = 49 and plnKey = 35) or ; &&- SHIFT + END
(this.LastKey = 49 and plnKey = 16) or ; &&- SHIFT + END
(this.LastKey = 55 and plnKey = 36) or ; &&- SHIFT + HOME
(this.LastKey = 55 and plnKey = 16) &&- SHIFT + HOME
if this.IntelliSense.Showed
this.IntelliSense.hide()
endif
return
endif
*- caso pressionei uma das teclas válidas para acionar o IntelliSense
*- De a "A" a "Z" de "a" a "z" .... de "0" a "9" .... "." or "*" or "#" or "_" or "Backspace"
if between(this.LastKey,65,90) or between(this.LastKey,97,122) or between(this.LastKey,48,57) or inlist(this.LastKey,46,42,35,95,127)
this.IntelliSense.ManualChoice = .f.
*- quando um script do foxcode.dbf é acionado o IntelliSense do core do VFP é acionado
*- neste caso se eu digitar algo fecho o IntelliSense do core do VFP para abrir o IntelliSense do Foxcodeplus.
if this.FoxcodeCore
this.FoxcodeCore = .f.
return
endif
*- pego a texto da linha corrente que estou digitando até a posicao do cursor
local lcText, lnWordCount, lcLastFullWord, lcLastWord, lcCommand1, lcCommand2, lcCommand3, lnLines
lcText = this.TreatLine(this.GetTextLine())
lcText = iif(substr(lcText,1,1) = "#", lcText, this.TreatWords(lcText))
lnWordCount = getwordcount(lcText)
lcLastFullWord = getwordnum(lcText, lnWordCount)
lcLastWord = iif("."$lcLastFullWord, substr(lcLastFullWord, rat(".",lcLastFullWord,1)+1), lcLastFullWord)
lcCommand1 = getwordnum(lcText,1)
lcCommand2 = getwordnum(lcText,2)
lcCommand3 = getwordnum(lcText,3)
this.CursorPos = _EdGetPos(this.EditorHwnd)
this.CursorLine = this.GetLineNo()
this.HasDot = iif("."$lcLastFullWord,.t.,.f.)
this.LastWord = lcLastWord
*- se estou dentro de uma string ou dentro de um Text...EndText nao abro o IntelliSense
if lastkey() <> 46
if this.IsInQuotes(lcText)
return
else
this.IsTextEndText = this.GetTextEndText(lcText)
endif
endif
*- especifics behaviors for some keys
if not this.IsTextEndText
do case
*- summary like Visual Studio
*- If pressed three times "***"
case this.lastkey = 42
this.SetSummary()
return
case this.lastkey = 46
return
*- controlo o backspace
case this.lastkey = 127
*wait window lcText+chr(13)+this.TextLine nowait
*- apaguei o "."
local llHasDelDot, llHasDelEqual
llHasDelDot = .f.
if right(this.TextLine,1) = "." and right(lcText,1) <> "." &&and "."$this.TextLine
llHasDelDot = .t.
endif
llHasDelEqual = .f.
if right(this.TextLine,1) = "=" and right(lcText,1) <> "=" &&and "="$this.TextLine
llHasDelEqual = .t.
endif
*- escondo o IntelliSense se nao for possivel recompor o texto ao apagar com o backspace
if empty(lcText) or empty(this.TextLine) or llHasDelDot or llHasDelEqual or (lcText==this.TextLine)
if this.IntelliSense.Showed
this.IntelliSense.hide()
this.TextLine2 = this.TextLine
this.TextLine = lcText
return
endif
endif
*- include file doesn't exist
case lower(chr(this.lastkey))="h" and lnWordCount = 3 and lower(substr(lcText,1,10)) == " # include" and lower(right(lcText,2)) == ".h"
if not this.GetFilePath(@lcCommand3)
this.ShowErrorWriteTime(1994, upper(justfname(lcCommand3)))
endif
return
*- do "program" doesn't exist
case inlist(lower(chr(this.lastkey)),"g","r","p","e") and lnWordCount = 2 and lower(lcCommand1) == "do" and inlist(lower(right(lcCommand2,4)),".prg",".mpr",".spr",".qpr",".fxp",".app",".exe")
if not this.GetFilePath(@lcCommand2)
this.ShowErrorWriteTime(1,upper(justfname(lcCommand2)))
endif
return
endcase
endif
*- Nao prossigo se não mudei o que digitei ou se
*- o comando nao tem IntelliSense plus.
if not this.IsTextEndText and ;
( ;
(this.TextLine == lcText) or empty(lcText) or ;
("<"+lower(lcCommand1)+">" $ this.NoIntelliSense and lnWordCount>=2) or ;
("<"+lower(lcCommand1+" "+lcCommand2)+">" $ this.NoIntelliSense and lnWordCount>=3) or ;
("<"+lower(lcCommand1+" "+lcCommand2+" "+lcCommand3)+">" $ this.NoIntelliSense and lnWordCount>=4) or ;
(lower(getwordnum(lcText,lnWordCount-1)) == "in" and lower(lcCommand1+" "+lcCommand2) <> "for each") or ;
(lower(getwordnum(lcText,lnWordCount-1)) == "set(" ) or ;
(substr(lower(lcCommand1),1,4) == "sele" and lnWordCount = 2 and right(lcCommand2,1)<>".") or ;
(lower(getwordnum(lcText,lnWordCount-1)) == "as" and lnWordCount >= 2) or ;
(lower(lcCommand1) == "index" and lower(lcCommand2) == "on" and lnWordCount >= 4) or ;
(lower(substr(lcCommand1,1,4)) == "crea" and lnWordCount <= 4) ;
)
if this.TextLine <> lcText
this.IntelliSense.Find(lcLastWord)
endif
return
else
*- estou dentro de um text..endtext, é uma instrucao SQL e pressionei space ao lado das clausulas abaixo
*- neste caso nao abro o intellisense incremental pois ira abrir o intellisense do foxcode.app
if this.IsTextEndText and this.IsSqlIntelliSense and ;
( ;
inlist(lower(getwordnum(lcText,lnWordCount-1)), "from", "join", "into", "update") or ;
inlist(lower(getwordnum(lcText,lnWordCount-2)), "from", "join", "into", "update") ;
)
if this.TextLine <> lcText
this.IntelliSense.Find(lcLastWord)
endif
if this.IntelliSense.Showed
this.IntelliSense.hide()
endif
return
*- prossigo com a checagem para abertura do intellisense incremental
else
*- Preencho as propriedades auxiliares para preenchimento do IntelliSense
this.TextLine2 = this.TextLine
this.TextLine = lcText
this.WordCount = lnWordCount
endif
endif
*- sempre escondo o IntelliSense antes de reabri-lo.
*- faço isso para limpar a lista e executar outros comandos que estão dentro no method hide.
if not this.HasDot
this.IntelliSense.hide()
*- 1 to 9 ... prevendo erros de sintax quando palavras iniciadas por numero
*- assim ignoro IntelliSense para isso.
if isdigit(this.LastWord) &&between(asc(substr(this.LastWord,1,1)), 48, 57)
return
endif
*- se o caracter atual for " " espaço escondo o IntelliSense ao pressionar backspace
if this.LastKey=127
if _EdGetChar(this.EditorHwnd, this.CursorPos-1) = " "
if this.IntelliSense.Showed
this.IntelliSense.hide()
endif
return
endif
endif
*- busco os itens para a lista do IntelliSense
this.IntelliSense = newobject("FoxCodePlusIntelliSense","FoxCodePlusIntelliSense.vcx")
lnLines = 0
if not this.IsTextEndText
*--- vfp intellisense ---*
lnLines = lnLines + this.GetFCs(this.LastWord) &&- funcoes e comandos
lnLines = lnLines + this.GetCodeSnippets(this.LastWord) &&- CodeSnippet
lnLines = lnLines + this.GetTablesUsed(this.LastWord) &&- tabelas abertas em run-time
lnLines = lnLines + this.GetTablesDataEnvironment(this.LastWord) &&- tabelas abertas em run-time
lnLines = lnLines + this.GetAPIs(this.LastWord) &&- APIs em run-time
lnLines = lnLines + this.GetControls(this.LastWord) &&- Objetos contidos em forms, classes e toolbar em write-time.
lnLines = lnLines + this.GetObjectsRunTime(this.LastWord) &&- Objetos em memória em run-time
lnLines = lnLines + this.GetSetProcInfoPrgRunTime() &&- Verifica os PRGs invocados pelo SET PROCEDURE TO em run-time.
lnLines = lnlines + this.GetProcInfo(0,1,.t.) &&- funcoes, methodes, events, variables, cursors, tables, DLLs function and #defines em write-time
else
*--- sql intellisense ---*
if this.chkTFsql = "1" and this.IsSqlIntelliSense
*- tabelas do SQL no modo incremental são verificadas somente se for uma instrucao "SELECT" ou qualquer outra com "WHERE"
*-
if getwordnum(lower(this.TextEndBlock),1) == "select" or " where " $ lower(this.TextEndBlock)
local array laCnx[1]
if this.chkIncrTablesSql = "1"
lnLines = lnLines + this.GetSqlTables(this.LastWord, .t., .t.) &&- tabelas no SQL
lnLines = lnLines + this.GetSqlTablesInCmd(this.LastWord, 2, .t., .f.) &&- alias no instruncao SQL
else
*- tabelas e alias existentes na select-sql
lnLines = lnLines + this.GetSqlTablesInCmd(this.LastWord, 0, .t., .f.) &&- tabelas e alias no instruncao SQL
endif
endif
*- Todos os campos das tabelas e alias incluidas no instruncao SQL no modo incremental
if this.chkIncrFieldsSql = "1"
lnLines = lnLines + this.GetSqlFieldsInAllTablesCmd()
endif
endif
endif
else
*- a funcao this.GetDot() ja preencheu a lista do IntelliSense pois a mesma é acionada pelo commando On key label "."
*- com isso, por padrao posiciona no 1o. item da lista.
if this.IntelliSense.Rows >= 1
lnLines = 1
else
lnLines = 0
endif
endif
*- Apresento ou escondo o IntelliSense
if lnLines > 0
with this.IntelliSense
*- se o IntelliSense ja esta com a tela aberta fecho-o... porem o parametro ".T."
*- significa que o seu conteudo permarecerá o mesmo.
if .showed
.hide(.t.)
endif
*- posiciono na lista conforme o que foi digitado
.LastFind = ""
.Find(lcLastWord)
*- se o tooltip padrao da IDE do VFP estiver aberto a funcao abaixo fecha-o
*- tambem asseguro que vou apresentar o IntelliSense no Handle correto.
_wSelect(this.EditorHwnd)
*- apresento o IntelliSense
.show()
endwith
else
this.IntelliSense.hide()
endif
return
*- nenhuma das teclas validas para chamada da lista de itens,
*- então trato outras funcionalidades
else
*- inicio tratamentos de navegação do IntelliSense sem o foco no mesmo
do case
*- se abrir aspas, aspas simples ou colchetes, é fechado automaticamente.
case inlist(this.LastKey,34,39,91) and this.chkAutoCloseQuotes = "1"
do case
case this.LastKey=34 &&- "
keyboard '"'
case this.LastKey=39 &&- '
keyboard "'"
case this.LastKey=91 &&- [
keyboard ']'
endcase
keyboard '{leftarrow}'
*- up arrow, down arrow, page up, page down, ctrl+home, ctrl+end or enter
case inlist(this.LastKey,5,24,3,18,29,23,13)
*- se troquei de linha faço a compilação em write-time para obter os erros
if not this.IntelliSense.Showed
if this.GetLineNo() <> this.CursorLine
this.CursorLine = this.GetLineNo()
this.GetErrorList()
endif
endif
*- se pressionei "(" or "," or LeftArrow or RightArrow
case inlist(this.lastkey,40,44,19,4) and not inlist(plnKey,17,83) &&-plnKey 17 and 83 is CTRL+S
if this.IntelliSense.Showed
this.IntelliSense.hide()
endif
*- verifico se tem assinatura de metodo ou funcao para ser apresentanda no tooltip
if not this.IsTextEndText
this.GetSignature()
endif
*- limpo pq fechei o IntelliSense e posso recomeçar a pesquisa incremental
case this.lastkey = 27
this.HasSelectedItem = .f.
if this.IntelliSense.Showed
this.TextLine = ""
endif
*- ATTENTION: SPACE IS USED ESCLUSIVELY FOR DEFAULT VFP CORE IntelliSense.
*- NEVER USE THIS GAP TO INCLUDE SOMETHING. FOR THAT WE HAVE TO CUSTOM
*- FOXCODE.APP PROJECT. FOXCODEPLUS.APP WORKS TOGETHER FOXCODE.APP
case this.lastkey = 32
* dont use this place.
*- escondo o IntelliSense
otherwise
if this.lastkey <> 46
if this.IntelliSense.Showed
this.IntelliSense.hide()
endif
endif
endcase
endif
return
endproc
*/------------------------------------------------------------------------------------------------
*/ Verifico se a tela ativa da IDE do VFP é uma tela valida para o IntelliSense
*/ e se for capturo o handle do tela
*/------------------------------------------------------------------------------------------------
procedure SetWontop
lparameters plcWindowsNumbers
local lnOldEditorHwnd
set console off
if not "foxtools.fll" $ lower(set("Library"))
set library to home(1)+"foxtools.fll" additive
endif
*- handle do editor do VFP ativo
lnOldEditorHwnd = this.EditorHwnd
this.EditorHwnd = _wontop()
*- se troquei de editor e o IntelliSense esta aberto deve fecha-lo
if this.EditorHwnd <> lnOldEditorHwnd
if this.IntelliSense.Showed
this.IntelliSense.hide()
endif
endif
*- Não prossigo se nao foi possivel obter o Hwnd do editor corrente ou se existir uma tela filha do editor aberta com foco
*- ex: tela "Find" or "Go to line" and so on.
if this.EditorHwnd <= 0 or (sys(2325,this.EditorHwnd) = this.EditorHwnd) or this.GetLineNo()=-1
return .f.
endif
*- -1 -> the window is not an edit window
*- 0 -> command window
*- 1 -> modify command window
*- 2 -> modify file window
*- 3 -> memo window
*- 6 -> Query
*- 7 -> screen
*- 8 -> menu designer code window
*- 9 -> view
*- 10 -> method edit window in class or form designer
*- 11 -> Text
*- 12 -> modify procedure window
*- 13 -> Project Text
*- se não for uma tela de IDE valida para abertura do IntelliSense não prossigo
local array laEditorSets[25]
try
_EdGetEnv(this.EditorHwnd, @laEditorSets)
catch
laEditorSets[25] = -1
this.EditorFileName = ""
endtry
this.EditorFileName = alltrim(laEditorSets[1])
this.EditorSource = laEditorSets[25]
this.EditorFontName = laEditorSets[22]
this.EditorFontSize = laEditorSets[23]
*- configuro o editor com a font do visual studio
if this.chkFont = "1"
if lower(laEditorSets[22]) <> "consolas"
laEditorSets[22] = "Consolas"
_EdSetEnv(this.EditorHwnd, @laEditorSets[25])
_wselect(this.EditorHwnd)
endif
else
if lower(laEditorSets[22]) = "consolas"
laEditorSets[22] = "courier new"
_EdSetEnv(this.EditorHwnd, @laEditorSets[25])
_wselect(this.EditorHwnd)
endif
endif
*- se for um editor válido
if empty(plcWindowsNumbers)
if inlist(this.EditorSource, 1, 8, 10, 12)
return .t.
else
return .f.
endi
else
if transform(this.EditorSource,"@L 99") $ plcWindowsNumbers
return .t.
else
return .f.
endif
endif
endproc
*/------------------------------------------------------------------------------------------------
*/ se a janela do debug estiver ativada pauso o foxcodeplus ate que o debug seja fechado.
*/ faço isso para evitar conflitos durante a depuraçao de programas.
*/------------------------------------------------------------------------------------------------
protected procedure ChkDebugger
if wvisible("visual foxpro debugger") and not this.HasDebugger
local lnDebugHwnd
*- capturo o hwnd da tela do debug
lnDebugHwnd = this.GetDebuggerHwnd()
*- pauso o foxcodeplus
this.HasDebugger = .t.
*unbindevents(0, WM_KEYUP)
*- quando fechar o debug o foxcodeplus sera restartado (despausado)
bindevent( lnDebugHwnd, WM_DESTROY, this, "ReStartIntelliSense", 4 )
return .f.
endif
endproc
*/------------------------------------------------------------------------------------------------
*/ usado exclusivamente no bindevent() da this.ChkDebugger() para reativar o foxcodeplus.
*/ quando fechar o Debugger o FoxcodePlus volta a funcionar
*/------------------------------------------------------------------------------------------------
protected procedure ReStartIntelliSense(hwnd as integer, msg as integer, wparam as integer, lparam as integer)
unbindevents(hWnd, msg)
sys(2030,1)
this.HasDebugger = .f.
endproc
*/------------------------------------------------------------------------------------------------
*/ usado exclusivamente no bindevent() da this.ChkDebugger() para obter o Hwnd da tela do Debugger do VFP
*/------------------------------------------------------------------------------------------------
protected procedure GetDebuggerHwnd
set console off
declare integer GetActiveWindow in win32api as xxfcpWinAPI_GetActiveWindow
declare integer GetWindow in Win32API as xxfcpWinAPI_GetWindow integer hwnd, integer nType
declare integer GetWindowText in Win32API as xxfcpWinAPI_GetWindowText integer hwnd, string @cText, integer nType
local lnNext, lcText
lnNext = xxfcpWinAPI_GetActiveWindow()
*- iterate through the open windows
do while lnNext<>0
*- get window title
lcText = replicate(chr(0),80)
xxfcpWinAPI_GetWindowText(lnNext,@lcText,80)
if "visual foxpro debugger" $ lower(lcText)
return lnNext
endif
lnNext = xxfcpWinAPI_GetWindow(lnNext,2)
enddo
clear dlls "xxfcpWinAPI_GetActiveWindow","xxfcpWinAPI_GetWindow","xxfcpWinAPI_GetWindowText"
endproc
*/------------------------------------------------------------------------------------------------
*/ Retorna o numero da linha a qual estou posicionado no codigo
*/ caso ocorra erro retorna -1
*/------------------------------------------------------------------------------------------------
procedure GetLineNo
set console off