Project

General

Profile

Statistics
| Revision:

vdfsplat / AppSrc / vdfdbg.vw @ 64

History | View | Annotate | Download (22.9 KB)

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