Changeset 87b1c46 in tol for tolbase/lib/toltk/graph.tcl


Ignore:
Timestamp:
Nov 15, 2016, 9:03:42 AM (10 years ago)
Author:
Pedro Gea <pgea@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
4592f76
Parents:
06f7d3d
Message:

Refs #1933
Se sustituye BLT por RBC.
Se prescinde de otros widgets no usados, dependientes de BLT. (Véanse loadByswidget.tcl y pkgIndex.tcl)

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@7340 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tolbase/lib/toltk/graph.tcl

    r06f7d3d r87b1c46  
    11#/////////////////////////////////////////////////////////////////////////////
    22# FILE    : graph.tcl
    3 # PURPOSE : This file is part of BLT Toolkit
     3# PURPOSE : This file is part of RBC Toolkit
    44#/////////////////////////////////////////////////////////////////////////////
    55
    6 # force blt load
    7 
    8 if { [info command "_blt_InitStack"] eq "" } {
    9   blt::graph .__g__
    10   Blt_ZoomStack .__g__
     6# force rbc load
     7
     8if { [info command "_rbc_InitStack"] eq "" } {
     9  rbc::graph .__g__
     10  Rbc_ZoomStack .__g__
    1111  destroy .__g__
    12   rename blt::InitStack _blt_InitStack
     12  rename rbc::InitStack _rbc_InitStack
    1313}
    1414
    … …  
    2525}
    2626
    27 if { [ catch { blt::busy patched } ] } {
    28   rename ::blt::busy _blt_busy
    29   interp alias {} ::blt::busy {} Busy_Patched
    30   puts "interp alias {} ::blt::busy {} Busy_Patched"
     27if { [ catch { rbc::busy patched } ] } {
     28  rename ::rbc::busy _rbc_busy
     29  interp alias {} ::rbc::busy {} Busy_Patched
     30  puts "interp alias {} ::rbc::busy {} Busy_Patched"
    3131}
    3232
    … …  
    3939#   scroll
    4040
    41 proc Blt_ViewMode { graph mode } {
    42   global zoomInfo
    43 
    44   if { ![blt::ClearMode $graph $mode] } return
     41proc Rbc_ViewMode { graph mode } {
     42  global zoomInfo
     43
     44  if { ![rbc::ClearMode $graph $mode] } return
    4545
    4646  set zoomInfo($graph,mode) $mode
    … …  
    4848  if { [string equal $mode "scroll"] } {
    4949    # limpio el stack
    50     blt::InitStack $graph $mode
    51     bind scroll-$graph <ButtonPress-1> { blt::SetScrollPoint %W %x %y }
    52     bind scroll-$graph <ButtonRelease-1> { blt::SetScrollPoint %W %x %y }
     50    rbc::InitStack $graph $mode
     51    bind scroll-$graph <ButtonPress-1> { rbc::SetScrollPoint %W %x %y }
     52    bind scroll-$graph <ButtonRelease-1> { rbc::SetScrollPoint %W %x %y }
    5353    # este evento posiblemente ya no hara falta
    5454    bind scroll-$graph <ButtonPress-3> {
    5555      if { [%W inside %x %y] } {
    56         blt::ResetScroll %W
    57       }
    58     }
    59     blt::AddBindTag $graph scroll-$graph
     56        rbc::ResetScroll %W
     57      }
     58    }
     59    rbc::AddBindTag $graph scroll-$graph
    6060  } elseif { [regexp "zoom-*" $mode] } {
    6161    puts "mode = $mode"
    62     bind zoom-$graph <ButtonPress-1> { blt::SetZoomPoint %W %x %y }
     62    bind zoom-$graph <ButtonPress-1> { rbc::SetZoomPoint %W %x %y }
    6363    if { [string equal $mode zoom-frame] } {
    64       bind zoom-$graph <ButtonRelease-1> { blt::SetZoomPoint %W %x %y }
     64      bind zoom-$graph <ButtonRelease-1> { rbc::SetZoomPoint %W %x %y }
    6565    } else {
    6666      bind zoom-$graph <ButtonRelease-1> ""
    … …  
    6868    bind zoom-$graph <ButtonPress-3> {
    6969      if { [%W inside %x %y] } {
    70         blt::ResetZoom %W
    71       }
    72     }
    73     blt::AddBindTag $graph zoom-$graph
    74   }
    75 }
    76 
    77 proc blt::RemoveBindTag { widget args } {
     70        rbc::ResetZoom %W
     71      }
     72    }
     73    rbc::AddBindTag $graph zoom-$graph
     74  }
     75}
     76
     77proc rbc::RemoveBindTag { widget args } {
    7878  set oldTagList [bindtags $widget]
    7979  foreach tag $args {
    … …  
    8585}
    8686
    87 proc blt::InitStack { graph {mode zoom-frame} } {
     87proc rbc::InitStack { graph {mode zoom-frame} } {
    8888    global zoomInfo
    8989 
    90     _blt_InitStack $graph
     90    _rbc_InitStack $graph
    9191    # this is to allow zoom in, out scroll
    9292 
    … …  
    9595
    9696
    97 proc blt::SetZoomScale { graph scale } {
     97proc rbc::SetZoomScale { graph scale } {
    9898  global zoomInfo
    9999
    … …  
    101101}
    102102
    103 proc blt::ClearMode { graph newmode } {
     103proc rbc::ClearMode { graph newmode } {
    104104  global zoomInfo
    105105
    … …  
    111111    if { [string equal $zoomInfo($graph,mode) "scroll"] } {
    112112      eval $graph marker delete [$graph marker names "scroll*"]
    113       blt::RemoveBindTag $graph "scroll-region-$graph" "scroll-$graph"
     113      rbc::RemoveBindTag $graph "scroll-region-$graph" "scroll-$graph"
    114114    } else {
    115115      eval $graph marker delete [$graph marker names "zoom*"]
    116       blt::RemoveBindTag $graph "select-region-$graph" "zoom-$graph"
    117     }
    118   } else {
    119     blt::InitStack $graph ""
     116      rbc::RemoveBindTag $graph "select-region-$graph" "zoom-$graph"
     117    }
     118  } else {
     119    rbc::InitStack $graph ""
    120120  }
    121121  return 1
    122122}
    123123
    124 proc blt::ZoomScale { graph } {
     124proc rbc::ZoomScale { graph } {
    125125  global zoomInfo
    126126
    … …  
    166166}
    167167
    168 proc blt::SetZoomPoint { graph x y } {
     168proc rbc::SetZoomPoint { graph x y } {
    169169  global zoomInfo zoomMod
    170170  if { ![info exists zoomInfo($graph,corner)] } {
    171     blt::InitStack $graph
    172   }
    173   blt::GetCoords $graph $x $y $zoomInfo($graph,corner)
    174 
    175   #puts  blt::SetZoomPoint
     171    rbc::InitStack $graph
     172  }
     173  rbc::GetCoords $graph $x $y $zoomInfo($graph,corner)
     174
     175  #puts  rbc::SetZoomPoint
    176176
    177177  if { [string compare $zoomInfo($graph,mode) "zoom-frame"] } {
    178     blt::ZoomScale $graph
     178    rbc::ZoomScale $graph
    179179    return
    180180  }
    … …  
    186186  }
    187187  bind select-region-$graph <${modifier}Motion> {
    188     blt::GetCoords %W %x %y B
    189     #blt::MarkPoint $graph B
    190     blt::Box %W
     188    rbc::GetCoords %W %x %y B
     189    #rbc::MarkPoint $graph B
     190    rbc::Box %W
    191191  }
    192192  if { $zoomInfo($graph,corner) == "A" } {
    … …  
    196196        # First corner selected, start watching motion events
    197197
    198         #blt::MarkPoint $graph A
    199         blt::ZoomTitleNext $graph
    200 
    201         blt::AddBindTag $graph select-region-$graph
     198        #rbc::MarkPoint $graph A
     199        rbc::ZoomTitleNext $graph
     200
     201        rbc::AddBindTag $graph select-region-$graph
    202202        set zoomInfo($graph,corner) B
    203203  } else {
    204204        # Delete the modal binding
    205         blt::RemoveBindTag $graph select-region-$graph
    206         blt::PushZoom $graph
     205        rbc::RemoveBindTag $graph select-region-$graph
     206        rbc::PushZoom $graph
    207207        set zoomInfo($graph,corner) A
    208208  }
    209209}
    210210
    211 proc blt::SetScrollPoint { graph x y } {
     211proc rbc::SetScrollPoint { graph x y } {
    212212    global zoomInfo
    213213
    214     blt::GetCoords $graph $x $y A
     214    rbc::GetCoords $graph $x $y A
    215215    bind scroll-region-$graph <Any-Motion> {
    216         blt::GetCoords %W %x %y B
    217         #blt::MarkPoint $graph B
    218         blt::Scroll %W
     216        rbc::GetCoords %W %x %y B
     217        #rbc::MarkPoint $graph B
     218        rbc::Scroll %W
    219219    }
    220220    if { $zoomInfo($graph,corner) == "A" } {
    … …  
    224224        # First corner selected, start watching motion events
    225225
    226         #blt::MarkPoint $graph A
    227         blt::ScrollTitle $graph
    228 
    229         blt::AddBindTag $graph scroll-region-$graph
     226        #rbc::MarkPoint $graph A
     227        rbc::ScrollTitle $graph
     228
     229        rbc::AddBindTag $graph scroll-region-$graph
    230230        set zoomInfo($graph,corner) B
    231231    } else {
    … …  
    235235}
    236236
    237 proc blt::Scroll { graph } {
     237proc rbc::Scroll { graph } {
    238238  global zoomInfo
    239239
    … …  
    257257}
    258258
    259 proc blt::ResetScroll { graph } {
     259proc rbc::ResetScroll { graph } {
    260260  global zoomInfo
    261261
    262262  eval $graph marker delete [$graph marker names "scroll*"]
    263   blt::RemoveBindTag $graph scroll-region-$graph
     263  rbc::RemoveBindTag $graph scroll-region-$graph
    264264  set zoomInfo($graph,corner) A 
    265265}
    266266
    267 proc blt::ScrollTitle { graph } {
     267proc rbc::ScrollTitle { graph } {
    268268    if { [$graph cget -invertxy] } {
    269269        set coords "-Inf -Inf"
Note: See TracChangeset for help on using the changeset viewer.