Tools__CodeView2.st
changeset 14843 ab82df4f1f99
parent 14705 4750b6f40d9a
child 14844 7a0e0c3a430e
equal deleted inserted replaced
14842:cbd8fde601b7 14843:ab82df4f1f99
  1318 
  1318 
  1319     "Modified: / 07-03-2010 / 13:53:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1319     "Modified: / 07-03-2010 / 13:53:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1320     "Modified: / 06-10-2011 / 14:13:57 / cg"
  1320     "Modified: / 06-10-2011 / 14:13:57 / cg"
  1321 !
  1321 !
  1322 
  1322 
       
  1323 buttonMultiPress: button x:x y:y in: view
       
  1324     "Delegates events to services. Answers true iff at least
       
  1325      one service handler method returns true. In that case,
       
  1326      the event is is NOT processes by the view."
       
  1327 
       
  1328     ^ services
       
  1329         contains:[:service |
       
  1330             service isEnabled and:[ ((service buttonMultiPress: button x:x y:y in: view) == true) ]
       
  1331         ].
       
  1332 
       
  1333     "Modified: / 07-03-2010 / 13:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1334     "Modified: / 06-10-2011 / 14:14:00 / cg"
       
  1335     "Modified (format): / 05-03-2012 / 08:56:02 / cg"
       
  1336 !
       
  1337 
  1323 buttonPress: button x:x y:y in: view
  1338 buttonPress: button x:x y:y in: view
  1324     "Delegates events to services. Answers true iff at least
  1339     "Delegates events to services. Answers true iff at least
  1325      one service handler method returns true. In that case,
  1340      one service handler method returns true. In that case,
  1326      the event is is NOT processes by the view."
  1341      the event is is NOT processes by the view."
  1327 
  1342 
  2093 
  2108 
  2094 !CodeView2 methodsFor:'services'!
  2109 !CodeView2 methodsFor:'services'!
  2095 
  2110 
  2096 breakpointService
  2111 breakpointService
  2097     "that one or nil"
  2112     "that one or nil"
  2098 
  2113 Transcript showCR:services.
  2099     ^ services detect:[:any| (any isKindOf: BreakpointService)] ifNone:nil
  2114     ^ services detect:[:any| (any isKindOf: BreakpointService)] ifNone:nil
  2100 !
  2115 !
  2101 
  2116 
  2102 registerService: aCodeViewService
  2117 registerService: aCodeViewService
  2103 
  2118 
  2104     services add: aCodeViewService.
  2119     services add: aCodeViewService.
  2105     aCodeViewService registerIn: self
  2120     aCodeViewService registerIn: self
  2106 
  2121 
  2107     "Created: / 06-03-2010 / 19:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2122     "Created: / 06-03-2010 / 19:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  2123 !
       
  2124 
       
  2125 servicesDo:aBlock
       
  2126     services notNil ifTrue:[ services do:aBlock ]
  2108 !
  2127 !
  2109 
  2128 
  2110 syntaxHighlightingService
  2129 syntaxHighlightingService
  2111     "that one or nil"
  2130     "that one or nil"
  2112 
  2131 
  2401     "Modified: / 14-02-2014 / 12:08:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2420     "Modified: / 14-02-2014 / 12:08:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2402 ! !
  2421 ! !
  2403 
  2422 
  2404 !CodeView2::GutterView methodsFor:'event handling'!
  2423 !CodeView2::GutterView methodsFor:'event handling'!
  2405 
  2424 
       
  2425 buttonMultiPress: btn x: x y: y
       
  2426     |extraSafeArea|
       
  2427 
       
  2428     "/ for the embedded accept-cancel bar
       
  2429     (x <= (self paddingLeft + self usedWidthForAcceptCancel)) ifTrue:[
       
  2430         textView reallyModified ifTrue:[
       
  2431             (y < self acceptButtonBottom) ifTrue:[
       
  2432                 ^self.
       
  2433             ].
       
  2434             (y < self cancelButtonBottom) ifTrue:[
       
  2435                 ^self.            
       
  2436             ].
       
  2437         ].
       
  2438         ^self.
       
  2439     ].
       
  2440 
       
  2441     codeView notNil ifTrue:[
       
  2442         ((x > (self paddingLeft + self usedWidthForAcceptCancel)) or:
       
  2443             [x < (self width - self paddingRight - widthDiffInfo)]
       
  2444         ) ifTrue:[
       
  2445             (codeView buttonMultiPress: btn x:x y:y in: self) ifTrue:[^ self].   "/ event eaten
       
  2446         ].
       
  2447     ].
       
  2448     super buttonMultiPress: btn x: x y: y
       
  2449 !
       
  2450 
  2406 buttonPress: btn x: x y: y
  2451 buttonPress: btn x: x y: y
  2407     |extraSafeArea|
  2452     |extraSafeArea|
  2408 
  2453 
  2409     (x <= (self paddingLeft + self usedWidthForAcceptCancel)) ifTrue:[
  2454     (x <= (self paddingLeft + self usedWidthForAcceptCancel)) ifTrue:[
  2410         textView reallyModified ifTrue:[
  2455         textView reallyModified ifTrue:[
  2447     "Created: / 10-09-2013 / 03:19:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2492     "Created: / 10-09-2013 / 03:19:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2448 ! !
  2493 ! !
  2449 
  2494 
  2450 !CodeView2::GutterView methodsFor:'help'!
  2495 !CodeView2::GutterView methodsFor:'help'!
  2451 
  2496 
  2452 flyByHelpText
  2497 flyByHelpTextAt:aPointOrNil
  2453     |bpntService|
  2498     |lineNr bpntService servicesWithAnnotations serviceToShowHelpFor|
  2454 
  2499 
  2455     (codeView notNil
  2500     codeView isNil ifTrue:[^ nil].
  2456     and:[ (bpntService := codeView breakpointService) notNil
  2501     bpntService := codeView breakpointService.
  2457     and:[ bpntService isEnabled ]]) ifTrue:[
  2502 
  2458         ^ bpntService flyByHelpText
  2503     aPointOrNil notNil ifTrue:[
  2459     ].
  2504         lineNr := codeView lineAtY:aPointOrNil y.
  2460     ^ nil
  2505         lineNr notNil ifTrue:[
       
  2506             "/ which service has an annotation for that line
       
  2507             servicesWithAnnotations := OrderedCollection new.
       
  2508             codeView servicesDo:[:eachService |
       
  2509                 (eachService flyByHelpTextAtLine:lineNr) notNil ifTrue:[
       
  2510                     servicesWithAnnotations add:eachService.
       
  2511                 ].
       
  2512             ].
       
  2513             Transcript showCR:servicesWithAnnotations.
       
  2514         ].
       
  2515     ].
       
  2516 
       
  2517     "/ if there is either ONLY a breakpoint service which has an annotation
       
  2518     "/ or none has an annotation, return the breakpoint service's message
       
  2519     (servicesWithAnnotations isEmpty
       
  2520     or:[ servicesWithAnnotations size == 1 and:[servicesWithAnnotations first == bpntService]]) ifTrue:[
       
  2521         (bpntService notNil and:[ bpntService isEnabled ]) ifTrue:[
       
  2522             serviceToShowHelpFor := bpntService
       
  2523         ].
       
  2524     ] ifFalse:[
       
  2525         serviceToShowHelpFor := servicesWithAnnotations first
       
  2526     ].
       
  2527     serviceToShowHelpFor notNil ifTrue:[
       
  2528         ^ serviceToShowHelpFor flyByHelpTextAtLine:lineNr
       
  2529     ].
  2461 ! !
  2530 ! !
  2462 
  2531 
  2463 !CodeView2::GutterView methodsFor:'initialize & release'!
  2532 !CodeView2::GutterView methodsFor:'initialize & release'!
  2464 
  2533 
  2465 initialize
  2534 initialize
  4017 ! !
  4086 ! !
  4018 
  4087 
  4019 !CodeView2 class methodsFor:'documentation'!
  4088 !CodeView2 class methodsFor:'documentation'!
  4020 
  4089 
  4021 version
  4090 version
  4022     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.167 2014-08-08 12:23:44 vrany Exp $'
  4091     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.168 2014-11-19 17:46:59 cg Exp $'
  4023 !
  4092 !
  4024 
  4093 
  4025 version_CVS
  4094 version_CVS
  4026     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.167 2014-08-08 12:23:44 vrany Exp $'
  4095     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.168 2014-11-19 17:46:59 cg Exp $'
  4027 !
  4096 !
  4028 
  4097 
  4029 version_SVN
  4098 version_SVN
  4030     ^ '$Id: Tools__CodeView2.st,v 1.167 2014-08-08 12:23:44 vrany Exp $'
  4099     ^ '$Id: Tools__CodeView2.st,v 1.168 2014-11-19 17:46:59 cg Exp $'
  4031 ! !
  4100 ! !
  4032 
  4101 
  4033 
  4102 
  4034 CodeView2 initialize!
  4103 CodeView2 initialize!