Project

General

Profile

Statistics
| Revision:

vdfsplat / AppSrc / vdfdbg.vw @ 58

History | View | Annotate | Download (21 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
    Set Size to 346 469
145
    Set Location to 3 4
146 17 wil
    Set Maximize_Icon to True
147 2 wil
148 8 wil
    Set phoDebuggerHost To Self
149 17 wil
    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 22 wil
          Set Size to 188 459
155 18 wil
          Set Location to 6 6
156 17 wil
          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 7 wil
173 17 wil
          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 18 wil
          Set Size to 135 381
186
          Set Location to 4 6
187
          Set peAnchors to anAll
188 4 wil
189 17 wil
          Object oCallStack_TP is a TabPage
190
            Set Label to "Call Stack"
191
192 23 wil
            Object oCallStackContainer is a Container3d
193
              Set Size to 131 377
194
              Set Location to 2 2
195
              Set peAnchors to anAll
196 25 wil
              Set Border_Style to Border_StaticEdge
197 17 wil
198 23 wil
              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 37 wil
                    Set Size                     Of hoCallStack To 118 361
207 23 wil
                    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 17 wil
                End
214 23 wil
              End_Procedure // CreateObjectCallback
215
216 37 wil
              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 23 wil
              //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 17 wil
235
          End_Object
236 2 wil
237 17 wil
          Object oWatches_TP is a TabPage
238
            Set Label to "Watches"
239 8 wil
240 23 wil
            Object oWatchesContainer is a Container3d
241
              Set Size to 131 377
242
              Set Location to 2 2
243
              Set peAnchors to anAll
244 25 wil
              Set Border_Style to Border_StaticEdge
245 17 wil
246 23 wil
              Set phoWatchesHost To Self
247 17 wil
248 23 wil
              Procedure CreateObjectCallback Handle hoObject
249
                Handle hoWatches
250
251
                If (hoObject) Begin
252
                  Get phoWatches To hoWatches
253
                  If (hoObject=hoWatches) Begin
254 37 wil
                    Set Size                     Of hoWatches To 118 361
255 23 wil
                    Set Location                 Of hoWatches To 9 6
256
                    Set peAnchors                Of hoWatches To anAll
257
                  End
258 17 wil
                End
259 23 wil
              End_Procedure // CreateObjectCallback
260
            End_Object
261 17 wil
          End_Object
262 8 wil
263 17 wil
          Object oTrace_TP is a TabPage
264
            Set Label to "Trace"
265
266 23 wil
            Object oTraceContainer is a Container3d
267
              Set Size to 131 377
268
              Set Location to 2 2
269
              Set peAnchors to anAll
270 25 wil
              Set Border_Style to Border_StaticEdge
271 23 wil
              Set phoTraceHost To Self
272 17 wil
273 23 wil
              Procedure CreateObjectCallback Handle hoObject
274
                Handle hoTrace
275
276
                If (hoObject) Begin
277
                  Get phoTrace To hoTrace
278
                  If (hoObject=hoTrace) Begin
279 37 wil
                    Set Size                     Of hoTrace To 118 359
280 23 wil
                    Set Location                 Of hoTrace To 9 6
281
                    Set Label                    Of hoTrace To "Trace"
282
                    Set peAnchors                Of hoTrace To anAll
283
                  End
284 17 wil
                End
285 23 wil
              End_Procedure // CreateObjectCallback
286
            End_Object
287 17 wil
          End_Object
288 7 wil
289 17 wil
          //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 2 wil
304 17 wil
          Object oGlobalVariables_TP is a TabPage
305
            Set Label to "Global Variables"
306
307 23 wil
            Object oGlobalVarContainer is a Container3d
308
              Set Size to 131 377
309
              Set Location to 2 2
310
              Set peAnchors to anAll
311 25 wil
              Set Border_Style to Border_StaticEdge
312 23 wil
              Set phoGlobalVarHost To Self
313
314 17 wil
315 23 wil
              Procedure CreateObjectCallback Handle hoObject
316
                Handle hoGlobalVar
317
318
                If (hoObject) Begin
319
                  Get phoGlobalVariables To hoGlobalVar
320
                  If (hoObject=hoGlobalVar) Begin
321 37 wil
                    Set Size                     Of hoGlobalVar To 118 359
322 23 wil
                    Set Location                 Of hoGlobalVar To 8 8
323
                    Set peAnchors                Of hoGlobalVar To anAll
324
                  End
325 17 wil
                End
326 23 wil
              End_Procedure // CreateObjectCallback
327
            End_Object
328 17 wil
          End_Object
329 2 wil
330 17 wil
          Object oLocalVariables_TP is a TabPage
331
            Set Label to "Local Variables"
332 2 wil
333 17 wil
334 23 wil
            Object oLocalVarContainer is a Container3d
335
              Set Size to 131 377
336
              Set Location to 2 2
337
              Set peAnchors to anAll
338 25 wil
              Set Border_Style to Border_StaticEdge
339 23 wil
              Set phoLocalVarHost To Self
340
341 17 wil
342 23 wil
              Procedure CreateObjectCallback Handle hoObject
343
                Handle hoLocalVar
344
345
                If (hoObject) Begin
346
                  Get phoLocalVariables To hoLocalVar
347
                  If (hoObject=hoLocalVar) Begin
348 37 wil
                    Set Size                     Of hoLocalVar To 118 359
349 23 wil
                    Set Location                 Of hoLocalVar To 8 8
350
                    Set peAnchors                Of hoLocalVar To anAll
351
                  End
352 17 wil
                End
353 23 wil
              End_Procedure // CreateObjectCallback
354
            End_Object
355 17 wil
          End_Object
356 2 wil
357 17 wil
          Object oTables_TP is a TabPage
358
            Set Label to "Tables"
359
360 23 wil
            Object oTablesContainer is a Container3d
361
              Set Size to 131 377
362
              Set Location to 2 2
363
              Set peAnchors to anAll
364 25 wil
              Set Border_Style to Border_StaticEdge
365 23 wil
              Set phoTablesHost To Self
366
367 17 wil
368 23 wil
              Procedure CreateObjectCallback Handle hoObject
369
                Handle hoTables
370
371
                If (hoObject) Begin
372
                  Get phoTablesWindow To hoTables
373
                  If (hoObject=hoTables) Begin
374 37 wil
                    Set Size                     Of hoTables To 118 363
375 23 wil
                    Set Location                 Of hoTables To 7 6
376
                    Set peAnchors                Of hoTables To anAll
377
                  End
378 17 wil
                End
379 23 wil
              End_Procedure // CreateObjectCallback
380
            End_Object
381 17 wil
          End_Object
382 20 wil
          Object oBreakpoints_TP is a TabPage
383
            Set Label to "Breakpoints"
384 23 wil
            Object oBreakPointsContainer is a Container3d
385
              Set Size to 131 377
386
              Set Location to 2 2
387 22 wil
              Set peAnchors to anAll
388 25 wil
              Set Border_Style to Border_StaticEdge
389 23 wil
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 43 wil
                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 23 wil
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 20 wil
431 23 wil
                //
432
                // Procedure ComSetCaretPos Integer llLine Integer llCol
433
                //
434
                // Procedure ComSelectLine Integer llLine Boolean llMakeVisible
435 20 wil
436 23 wil
                Procedure LoadData
437 43 wil
                  Handle  hoDataSource
438
                  Handle  hoDebug
439 23 wil
                  Boolean bFound
440 43 wil
                  Boolean bIsCreated
441 23 wil
                  Integer iBreak
442
                  Integer iCount
443
                  Integer iRows
444
                  Integer iActive
445
                  Integer iLine
446
                  Integer iFile
447
                  tDataSourceRow[] TheData
448
                  tBreakPoints[] BP
449 20 wil
450 23 wil
                  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 20 wil
458 23 wil
                  // Load all data into the datasource array
459 38 wil
                  If (hoDebug) Begin
460
                    Get pBreakPoints of hoDebug To BP
461
                  End
462 23 wil
                  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 43 wil
                  Get IsComObjectCreated To bIsCreated
476
                  If (bIsCreated) Begin
477
                    // Initialize Grid with new data
478
                    Send InitializeData TheData
479
                    Send MovetoFirstRow
480
                  End
481 23 wil
                End_Procedure
482 22 wil
483 23 wil
              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 22 wil
498 23 wil
                  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 22 wil
                  End
510 23 wil
          // 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 37 wil
526 23 wil
              End_Object
527 22 wil
            End_Object
528 37 wil
529
            Procedure DisplayTabDetails
530
              Send LoadData of oBreakpointsGrid
531
            End_Procedure
532 20 wil
          End_Object // TP
533 37 wil
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 17 wil
        End_Object  // oDebug_TD
552 8 wil
553 20 wil
      End_Object // oDebugPanelSplitter
554
    End_Object // oSplitterContainer
555 2 wil
556
557 17 wil
558 2 wil
559 17 wil
#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 4 wil
  Procedure OnResize
562
    Integer cxy cx cy
563 17 wil
    Integer dxy dx dy
564 8 wil
    Handle  hoEditor
565 4 wil
566
    Get Client_Size To cxy
567
    Move (Hi(cxy))  To cy
568
    Move (Low(cxy)) To cx
569 17 wil
    Get GUISize of oDebug_TD To dxy
570
    Move (Hi(dxy))  To dy
571
    Move (Low(dxy)) To dx
572 8 wil
    Get phoEditor to hoEditor
573
    If (hoEditor) begin
574 17 wil
      Set GUISize of hoEditor  To (cy - (dy + 82)) (cx-143)
575 8 wil
      Send Adjust_Logicals
576
    End
577 4 wil
  End_Procedure // OnResize
578 17 wil
#ENDIF
579 4 wil
580 2 wil
  Procedure doSetCaptionLabel String sLabel
581 38 wil
    Set Label To ("Debugging:"*sLabel)
582 17 wil
  End_Procedure // doSetCaptionLabel
583 2 wil
Cd_End_Object