Project

General

Profile

Statistics
| Revision:

vdfsplat / AppSrc / vdfdbg.vw @ 63

History | View | Annotate | Download (21 KB)

1
//TH-Header
2
//*****************************************************************************************
3
// Copyright (c)  2013 Antwise Solutions
4
// All rights reserved.
5
//
6
// $FileName    : Vdfdbg.vw
7
// $ProjectName : Splat ! Vdf Debugger
8
// $Authors     : Wil van Antwerpen
9
// $Created     : 12.14.2013  23:42
10
// $Type        : GPLv2
11
//
12
// Contents:
13
// The view that hosts the various debugger controls and the codemax editor.
14
// Pretty much everything in here gets loaded dynamically so that we can load
15
// the debugger engine for the VDF version that we need.
16
//
17
//*****************************************************************************************
18
//TH-RevisionStart
19
//TH-RevisionEnd
20

    
21
Use Windows.pkg
22
Use DFClient.pkg
23
Use vWin32fh.pkg
24
Use cSplitterContainer.pkg
25
Use cDebuggerEngine.pkg
26
Use cSplatCodeMax.pkg
27
Use cCJGrid.pkg
28
Use cCJGridColumn.pkg
29
//Use cComCDACTreeListCtl.pkg
30

    
31
Class cBPOpenFileUnderCJMenuItem is a cCJMenuItem
32
  Procedure Construct_Object
33
    Forward Send Construct_Object
34
    Set psCaption       To "&Open File"
35
    Set psToolTip       To "Open file at selected breakpoint"
36
    Set psImage         To "ActionOpen.ico"
37
  End_Procedure
38
  
39
  Procedure OnExecute Variant vCommandBarControl
40
    Handle  hoGrid
41
    Handle  hoEditor
42
    Integer iLine
43
    String  sFileName
44
    
45
    Get phoBreakPointsGrid To hoGrid
46
    If (hoGrid) Begin
47
      Get SelectedRowValue Of (oFileNameColumn(hoGrid)) To sFileName
48
      Get SelectedRowValue Of (oLineColumn(hoGrid))     To iLine
49
      If (sFileName<>"" and iLine<>0) Begin
50
        Get phoEditor To hoEditor
51
        If (hoEditor) begin
52
          Send doOpenSourceFileAtLine of hoEditor sFileName iLine
53
        End
54
      End
55
    End
56
  End_Procedure
57
End_Class
58

    
59
Class cBPEnableBreakPointCJMenuItem is a cCJMenuItem
60
  Procedure Construct_Object
61
    Forward Send Construct_Object
62
    Set psCaption       To "&Enable Breakpoint"
63
    Set psToolTip       To "Enable Breakpoint for the selected line"
64
    //Set psImage         To "ActionOpen.ico"
65
  End_Procedure
66
  
67
  Procedure OnExecute Variant vCommandBarControl
68
    Handle  hoGrid
69
    Handle  hoDebugger
70
    Integer iLine
71
    String  sFileName
72
    
73
    Get phoBreakPointsGrid To hoGrid
74
    If (hoGrid) Begin
75
      Get SelectedRowValue Of (oFileNameColumn(hoGrid)) To sFileName
76
      Get SelectedRowValue Of (oLineColumn(hoGrid))     To iLine
77
      If (sFileName<>"" and iLine<>0) Begin
78
        Get phoDebugger to hoDebugger
79
        If (hoDebugger) begin
80
          Send EnableBreakpoint of hoDebugger sFileName iLine
81
        End
82
      End
83
    End
84
  End_Procedure
85
End_Class
86

    
87
Class cBPDisableBreakPointCJMenuItem is a cCJMenuItem
88
  Procedure Construct_Object
89
    Forward Send Construct_Object
90
    Set psCaption       To "&Disable Breakpoint"
91
    Set psToolTip       To "Disable Breakpoint for the selected line"
92
//    Set psImage         To "ActionOpen.ico"
93
  End_Procedure
94
  
95
  Procedure OnExecute Variant vCommandBarControl
96
    Handle  hoGrid
97
    Handle  hoDebugger
98
    Integer iLine
99
    String  sFileName
100
    
101
    Get phoBreakPointsGrid To hoGrid
102
    If (hoGrid) Begin
103
      Get SelectedRowValue Of (oFileNameColumn(hoGrid)) To sFileName
104
      Get SelectedRowValue Of (oLineColumn(hoGrid))     To iLine
105
      If (sFileName<>"" and iLine<>0) Begin
106
        Get phoDebugger to hoDebugger
107
        If (hoDebugger) begin
108
          Send DisableBreakpoint of hoDebugger sFileName iLine
109
        End
110
      End
111
    End
112
  End_Procedure
113
End_Class
114

    
115

    
116
Class cBreakPointsGridContextMenu Is a cCJContextMenu
117
    
118
    Procedure Construct_Object
119
      Forward Send Construct_Object
120

    
121
      Object oOpenFileUnderBreakPointMenuItem is a cBPOpenFileUnderCJMenuItem
122
      End_Object
123
      
124
      Object oAddBreakpoint is a cCJAddBreakpointMenuItem
125
      End_Object
126
      
127
      Object oRemoveBreakPoint is a cCJRemoveBreakpointMenuItem
128
      End_Object
129
      
130
      Object oEnableBreakPoint is a cBPEnableBreakPointCJMenuItem
131
      End_Object
132
      
133
      Object oDisableBreakPoint is a cBPDisableBreakPointCJMenuItem
134
      End_Object
135
    End_Procedure // Construct_Object
136

    
137
End_Class // cBreakPointsGridContextMenu
138

    
139

    
140
Deferred_View Activate_oVdfdbg for ;
141
Object oVdfdbg is a dbView
142

    
143
    Set Border_Style to Border_Thick
144
    Set Size to 346 469
145
    Set Location to 3 4
146
    Set Maximize_Icon to True
147
    
148
    Set phoDebuggerHost To Self
149
    Object oDebugSplitterContainer is a cSplitterContainer
150
      Set pbSplitVertical to False
151
      Set piSplitterLocation to 200
152
      Object oEditorSplitter is a cSplitterContainerChild
153
        Object oCodeMax is a cSplatCodeMax
154
          Set Size to 188 459
155
          Set Location to 6 6
156
          Set peAnchors to anAll
157
          
158
          Set phoEditor To Self
159
        
160
            Procedure OnCreate
161
              Variant vImageList
162
              Boolean bCreated
163
              Handle  hoLanguage
164
              
165
              Forward Send OnCreate
166
              
167
              // ToDo: Set the ActiveX properties here...
168
              Get ComImageList  To vImageList
169
              //Set ComHImageList 0  // OLE_HANDLE value
170
              
171
            End_Procedure
172
    
173
          Embed_ActiveX_Resource
174
          6AMAAAgAAgAAAAAACAACAAAAAAAAAQEBAAAAAQEBAQAAAQAAAAAAAAAAAAAAAAHpAwAAAQEBAAEBAAEEAP//////////////////////////////////////////QwBv
175
          AHUAcgBpAGUAcgAgAE4AZQB3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAA/////wAAAAAAAAABAAAACgAAAAEAAf//////
176
          ////AAAAAAABAAAAAQAAAE0uAAB2FwAA.
177
          End_Embed_ActiveX_Resource
178
        
179
        End_Object
180
        
181
        
182
      End_Object
183
      Object oDebugPanelsSplitter is a cSplitterContainerChild
184
        Object oDebug_TD is a TabDialog
185
          Set Size to 135 381
186
          Set Location to 4 6
187
          Set peAnchors to anAll
188
      
189
          Object oCallStack_TP is a TabPage
190
            Set Label to "Call Stack"
191
            
192
            Object oCallStackContainer is a Container3d
193
              Set Size to 131 377
194
              Set Location to 2 2
195
              Set peAnchors to anAll
196
              Set Border_Style to Border_StaticEdge
197
              
198
              Set phoCallStackHost To Self
199
              
200
              Procedure CreateObjectCallback Handle hoObject
201
                Handle hoCallStack
202
                
203
                If (hoObject) Begin
204
                  Get phoCallStack To hoCallStack
205
                  If (hoObject=hoCallStack) Begin
206
                    Set Size                     Of hoCallStack To 118 361
207
                    Set Location                 Of hoCallStack To 9 5
208
                    Set Label_Justification_Mode Of hoCallStack To JMode_Top
209
                    Set Label_Col_Offset         Of hoCallStack To 0
210
                    Set Label                    Of hoCallStack To "Call Stack"
211
                    Set peAnchors                Of hoCallStack To anAll
212
                  End
213
                End
214
              End_Procedure // CreateObjectCallback
215
              
216
              Procedure SetControlColumnWidth handle hoObject
217
                Handle hoCallStack
218
                
219
                If (hoObject) Begin
220
                  Get phoCallStack To hoCallStack
221
                  If (hoObject=hoCallStack) Begin
222
                    Set ComObjectColumnWidth     Of hoCallStack To 200
223
                    Set ComMessageColumnWidth    Of hoCallStack To 400
224
                  End
225
                End
226
              End_Procedure
227
              
228
              //Procedure RepaintTabPage
229
              //  Handle hWindow hVoid
230
              //  Get Window_Handle To hWindow
231
              //  If hWindow Move (InvalidateRect(hWindow,0,True)) To hVoid
232
              //End_Procedure // RepaintTabPage
233
            End_Object
234
            
235
          End_Object
236
      
237
          Object oWatches_TP is a TabPage
238
            Set Label to "Watches"
239
      
240
            Object oWatchesContainer is a Container3d
241
              Set Size to 131 377
242
              Set Location to 2 2
243
              Set peAnchors to anAll
244
              Set Border_Style to Border_StaticEdge
245
            
246
              Set phoWatchesHost To Self
247
              
248
              Procedure CreateObjectCallback Handle hoObject
249
                Handle hoWatches
250
                
251
                If (hoObject) Begin
252
                  Get phoWatches To hoWatches
253
                  If (hoObject=hoWatches) Begin
254
                    Set Size                     Of hoWatches To 118 361
255
                    Set Location                 Of hoWatches To 9 6
256
                    Set peAnchors                Of hoWatches To anAll
257
                  End
258
                End
259
              End_Procedure // CreateObjectCallback
260
            End_Object
261
          End_Object
262
      
263
          Object oTrace_TP is a TabPage
264
            Set Label to "Trace"
265
            
266
            Object oTraceContainer is a Container3d
267
              Set Size to 131 377
268
              Set Location to 2 2
269
              Set peAnchors to anAll
270
              Set Border_Style to Border_StaticEdge
271
              Set phoTraceHost To Self
272
              
273
              Procedure CreateObjectCallback Handle hoObject
274
                Handle hoTrace
275
                
276
                If (hoObject) Begin
277
                  Get phoTrace To hoTrace
278
                  If (hoObject=hoTrace) Begin
279
                    Set Size                     Of hoTrace To 118 359
280
                    Set Location                 Of hoTrace To 9 6
281
                    Set Label                    Of hoTrace To "Trace"
282
                    Set peAnchors                Of hoTrace To anAll
283
                  End
284
                End
285
              End_Procedure // CreateObjectCallback
286
            End_Object
287
          End_Object
288
      
289
          //Object oDACTreelist_TP is a TabPage
290
          //  Set Label to "DACTreeList (not used)"
291
          //  // I do not think we are going to use this one.
292
          //  Object oComCDACTreeListCtl1 is a cComCDACTreeListCtl
293
          //    Set Size to 100 100
294
          //    Set Location to 10 35
295
          //
296
          //      Procedure OnCreate
297
          //          Forward Send OnCreate
298
          //          // ToDo: Set the ActiveX properties here...
299
          //      End_Procedure
300
          //
301
          //  End_Object
302
          //End_Object
303
      
304
          Object oGlobalVariables_TP is a TabPage
305
            Set Label to "Global Variables"
306
            
307
            Object oGlobalVarContainer is a Container3d
308
              Set Size to 131 377
309
              Set Location to 2 2
310
              Set peAnchors to anAll
311
              Set Border_Style to Border_StaticEdge
312
              Set phoGlobalVarHost To Self
313
        
314
              
315
              Procedure CreateObjectCallback Handle hoObject
316
                Handle hoGlobalVar
317
                
318
                If (hoObject) Begin
319
                  Get phoGlobalVariables To hoGlobalVar
320
                  If (hoObject=hoGlobalVar) Begin
321
                    Set Size                     Of hoGlobalVar To 118 359
322
                    Set Location                 Of hoGlobalVar To 8 8
323
                    Set peAnchors                Of hoGlobalVar To anAll
324
                  End
325
                End
326
              End_Procedure // CreateObjectCallback
327
            End_Object
328
          End_Object
329
      
330
          Object oLocalVariables_TP is a TabPage
331
            Set Label to "Local Variables"
332
      
333
            
334
            Object oLocalVarContainer is a Container3d
335
              Set Size to 131 377
336
              Set Location to 2 2
337
              Set peAnchors to anAll
338
              Set Border_Style to Border_StaticEdge
339
              Set phoLocalVarHost To Self
340
        
341
              
342
              Procedure CreateObjectCallback Handle hoObject
343
                Handle hoLocalVar
344
                
345
                If (hoObject) Begin
346
                  Get phoLocalVariables To hoLocalVar
347
                  If (hoObject=hoLocalVar) Begin
348
                    Set Size                     Of hoLocalVar To 118 359
349
                    Set Location                 Of hoLocalVar To 8 8
350
                    Set peAnchors                Of hoLocalVar To anAll
351
                  End
352
                End
353
              End_Procedure // CreateObjectCallback
354
            End_Object
355
          End_Object
356
      
357
          Object oTables_TP is a TabPage
358
            Set Label to "Tables"
359
            
360
            Object oTablesContainer is a Container3d
361
              Set Size to 131 377
362
              Set Location to 2 2
363
              Set peAnchors to anAll
364
              Set Border_Style to Border_StaticEdge
365
              Set phoTablesHost To Self
366
        
367
              
368
              Procedure CreateObjectCallback Handle hoObject
369
                Handle hoTables
370
                
371
                If (hoObject) Begin
372
                  Get phoTablesWindow To hoTables
373
                  If (hoObject=hoTables) Begin
374
                    Set Size                     Of hoTables To 118 363
375
                    Set Location                 Of hoTables To 7 6
376
                    Set peAnchors                Of hoTables To anAll
377
                  End
378
                End
379
              End_Procedure // CreateObjectCallback
380
            End_Object
381
          End_Object
382
          Object oBreakpoints_TP is a TabPage
383
            Set Label to "Breakpoints"
384
            Object oBreakPointsContainer is a Container3d
385
              Set Size to 131 377
386
              Set Location to 2 2
387
              Set peAnchors to anAll
388
              Set Border_Style to Border_StaticEdge
389
        
390
              Object oBreakpointsGrid is a cCJGrid
391
                Set Size to 112 282
392
                Set Location to 6 10
393
                Set peAnchors to anAll
394
                Set pbReadOnly to True
395
                Set phoBreakpointsGrid To Self
396
          
397
                Object oBPContextMenu Is a cBreakPointsGridContextMenu
398
                End_Object
399
                
400
                Set phoContextMenu To oBPContextMenu
401
                // Need to move to subclass for this technique, maybe later.
402
                //Function CreateContextMenu Returns Handle
403
                //  Handle hoMenu
404
                //
405
                //  Get Create (RefClass(cBreakPointsGridContextMenu)) To hoMenu
406
                //  If (hoMenu) Begin
407
                //    Set Name Of hoMenu To "oBPContextMenu"
408
                //  End
409
                //  Function_Return hoMenu
410
                //End_Function
411
        
412
                Object oEnabledColumn is a cCJGridColumn
413
                  Set piWidth to 57
414
                  Set psCaption to "Active"
415
                  Set pbCheckbox to True
416
                  Set pbResizable to False
417
                End_Object
418
        
419
                Object oLineColumn is a cCJGridColumn
420
                  Set piWidth to 85
421
                  Set psCaption to "Line"
422
                  Set peDataType to Mask_Numeric_Window
423
                  Set pbResizable to False
424
                End_Object
425
        
426
                Object oFileNameColumn is a cCJGridColumn
427
                  Set piWidth to 351
428
                  Set psCaption to "File"
429
                End_Object
430
                
431
                //
432
                // Procedure ComSetCaretPos Integer llLine Integer llCol
433
                //
434
                // Procedure ComSelectLine Integer llLine Boolean llMakeVisible
435
                
436
                Procedure LoadData
437
                  Handle  hoDataSource
438
                  Handle  hoDebug
439
                  Boolean bFound
440
                  Boolean bIsCreated
441
                  Integer iBreak
442
                  Integer iCount
443
                  Integer iRows
444
                  Integer iActive
445
                  Integer iLine
446
                  Integer iFile
447
                  tDataSourceRow[] TheData
448
                  tBreakPoints[] BP
449
                  
450
                  Get phoDataSource to hoDataSource
451
                  Get phoDebugger   to hoDebug
452
                  
453
                  // Get the datasource indexes of the various columns
454
                  Get piColumnId of oEnabledColumn  to iActive
455
                  Get piColumnId of oLineColumn     to iLine
456
                  Get piColumnId of oFileNameColumn to iFile
457
          
458
                  // Load all data into the datasource array
459
                  If (hoDebug) Begin
460
                    Get pBreakPoints of hoDebug To BP
461
                  End
462
                  Move (SizeOfArray(BP)) To iCount
463
                  For iBreak from 0 To (iCount-1)
464
                    // BP[iBreak].bHasCondition
465
                    // BP[iBreak].sExpression
466
                    
467
                    //If (BP[iBreak].bEnabled) Move "Y" To TheData[iRows].sValue[iActive]
468
                    //Else Move "N" To TheData[iRows].sValue[iActive]
469
                    Move BP[iBreak].bEnabled  To TheData[iRows].sValue[iActive]
470
                    Move BP[iBreak].iLine     To TheData[iRows].sValue[iLine]
471
                    Move BP[iBreak].sFileName To TheData[iRows].sValue[iFile]
472
                    Increment iRows
473
                  Loop
474
                  
475
                  Get IsComObjectCreated To bIsCreated
476
                  If (bIsCreated) Begin
477
                    // Initialize Grid with new data
478
                    Send InitializeData TheData
479
                    Send MovetoFirstRow
480
                  End
481
                End_Procedure
482
                
483
              End_Object
484
  
485
              Object oButton3 is a Button
486
                Set Size to 14 61
487
                Set Location to 57 310
488
                Set Label to "add breakpoint"
489
                Set peAnchors to anTopRight
490
                
491
                Procedure OnClick
492
                  Integer iLine
493
                  String  sFileName
494
                  Boolean bSuccess
495
                  Handle  hoDebugger
496
                  Handle  hoEditor
497
                  
498
                  Get phoDebugger to hoDebugger
499
                  Get phoEditor   to hoEditor
500
                  If (hoDebugger<>0 and hoEditor<>0) Begin
501
                    
502
                    Get psFileName    of hoEditor to sFileName
503
                    Get piCurrentLine of hoEditor to iLine
504
                    If (sFileName<>"" and iLine<>0) Begin
505
                      Get SetBreakPoint of hoDebugger sFileName (&iLine) to bSuccess
506
                      Send info_box ("Set breakpoint at line"*trim(iLine)*"success="*trim(bSuccess))
507
                      //Send ComSetMarginImages iLine 1
508
                    End
509
                  End
510
          // in codemax
511
          //    // turns on/off margin images for a specific line
512
          //    Procedure ComSetMarginImages Integer llLine UChar llImages
513
          //
514
          //    // sets the line margin images
515
          //    Procedure Set ComHImageList OLE_HANDLE value
516
          //
517
          //    // sets the line margin images
518
          //    Function ComHImageList Returns OLE_HANDLE
519
          //    // Returns the first line number with the specified margin images
520
          //    Function ComFindLineMatchingMarginImages Integer llStartLine UChar llImages Returns Integer
521
          // in debugger
522
          //    // Sets the specified breakpoint
523
          //    Function ComSetBreakPoint String llfile UInteger ByRef llline Returns Boolean
524
                End_Procedure
525
                
526
              End_Object
527
            End_Object
528
            
529
            Procedure DisplayTabDetails
530
              Send LoadData of oBreakpointsGrid
531
            End_Procedure
532
          End_Object // TP
533
      
534
          
535
          Function Tab_Change Integer iToTab Integer ePointerMode Returns Integer
536
            Handle  hoToTab
537
            Integer iCurrentTab
538
            Integer iRetVal
539
            
540
            Get Current_Tab To iCurrentTab
541
            Forward Get Tab_Change iToTab ePointerMode To iRetVal
542
            If (iCurrentTab<>-1 and iRetval=0) Begin
543
              Get Tab_Page_Id iToTab To hoToTab
544
              If (hoToTab=oBreakPoints_TP) Begin
545
                Send DisplayTabDetails of hoToTab
546
              End
547
            End
548
            Function_Return iRetVal
549
          End_Function
550
          
551
        End_Object  // oDebug_TD
552
      
553
      End_Object // oDebugPanelSplitter
554
    End_Object // oSplitterContainer
555

    
556

    
557

    
558
  
559
#IF (FMAC_VERSION < 14)
560
  // Seems this was required in the past? Let's assume that was for earlier versions as VDF14, no time to test.
561
  Procedure OnResize
562
    Integer cxy cx cy
563
    Integer dxy dx dy
564
    Handle  hoEditor
565

    
566
    Get Client_Size To cxy
567
    Move (Hi(cxy))  To cy
568
    Move (Low(cxy)) To cx
569
    Get GUISize of oDebug_TD To dxy
570
    Move (Hi(dxy))  To dy
571
    Move (Low(dxy)) To dx
572
    Get phoEditor to hoEditor
573
    If (hoEditor) begin
574
      Set GUISize of hoEditor  To (cy - (dy + 82)) (cx-143)
575
      Send Adjust_Logicals
576
    End
577
  End_Procedure // OnResize
578
#ENDIF
579
  
580
  Procedure doSetCaptionLabel String sLabel
581
    Set Label To ("Debugging:"*sLabel)
582
  End_Procedure // doSetCaptionLabel
583
Cd_End_Object