Changeset 5222 for branches/uq


Ignore:
Timestamp:
Apr 14, 2015, 9:02:37 PM (9 years ago)
Author:
mmh
Message:

add ScreenSize? command and use it instead of broken tk screenwidth

Location:
branches/uq
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/uq/gui/scripts/balloon.tcl

    r4572 r5222  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: Balloon - toplevel popup window, like a cartoon balloon
     
    139139    set sh [image height $_fills($placement)]
    140140    set p $itk_component(hull)
    141     set screenw [winfo screenwidth $p]
    142     set screenh [winfo screenheight $p]
     141
     142    # set screenw [winfo screenwidth $p]
     143    # set screenh [winfo screenheight $p]
     144    foreach {screenw screenh} [Rappture::ScreenSize [winfo screen $p]] break
    143145
    144146    if {[winfo exists $where]} {
     
    308310            #
    309311            #     --------  ---       LEFT STEM
    310             #    |..##    |  ^ 
     312            #    |..##    |  ^
    311313            #    |  ..##  |  |        . = light color
    312314            #    |    ..##|  | s      @ = dark color
  • branches/uq/gui/scripts/dropdown.tcl

    r3330 r5222  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: dropdown - base class for drop-down panels
     
    8484    set w [winfo width $itk_component(hull)]
    8585    set h [winfo height $itk_component(hull)]
    86     set sw [winfo screenwidth $itk_component(hull)]
    87     set sh [winfo screenheight $itk_component(hull)]
     86    # set sw [winfo screenwidth $itk_component(hull)]
     87    # set sh [winfo screenheight $itk_component(hull)]
     88    foreach {sw sh} [Rappture::ScreenSize [winfo screen $itk_component(hull)]] break
    8889
    8990    if {[regexp {^@([0-9]+),([0-9]+)$} $where match x y]} {
  • branches/uq/gui/scripts/editor.tcl

    r3330 r5222  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: editor - pop-up editor for little bits of text
     
    5959    protected variable _loc   ;# array of editor location parameters
    6060}
    61                                                                                
     61
    6262itk::usual Editor {
    6363    keep -cursor -font
     
    276276    set fnt [$e cget -font]
    277277
     278    foreach {screenw screenh} [Rappture::ScreenSize [winfo screen $e]] break
    278279    set w [expr {[font measure $fnt $str]+20}]
    279280    set w [expr {($w < $_loc(w)) ? $_loc(w) : $w}]
    280     if {$w+$_loc(x) >= [winfo screenwidth $e]} {
    281         set w [expr {[winfo screenwidth $e]-$_loc(x)}]
     281    if {$w+$_loc(x) >= $screenw} {
     282        set w [expr {$screenw-$_loc(x)}]
    282283    }
    283284
    284285    set h [expr {[font metrics $fnt -linespace]+4}]
    285286    set h [expr {($h < $_loc(h)) ? $_loc(h) : $h}]
    286     if {$h+$_loc(y) >= [winfo screenheight $e]} {
    287         set h [expr {[winfo screenheight $e]-$_loc(y)}]
    288     }                                       
     287    if {$h+$_loc(y) >= $screenh} {
     288        set h [expr {$screenh-$_loc(y)}]
     289    }
    289290    # Temporary fix to prevent Opps. Don't deal with negative dimensions.
    290291    if { $w <= 0 || $h <= 0 } {
  • branches/uq/gui/scripts/main.tcl

    r5121 r5222  
    354354} elseif {[llength [$win.pager page]] == 2} {
    355355    set style [string trim [$xmlobj get tool.layout]]
    356     set screenw [winfo screenwidth .]
     356
     357    # set screenw [winfo screenwidth .]
     358    foreach {screenw screenh} [Rappture::ScreenSize [winfo screen .]] break
    357359
    358360    update idletasks
  • branches/uq/gui/scripts/mainwin.tcl

    r3330 r5222  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: mainwin - main application window for Rappture
     
    8989    private variable _bgparser ""  ;# parser for bgscript
    9090}
    91                                                                                
     91
    9292itk::usual MainWin {
    9393    keep -background -cursor foreground -font
     
    260260itcl::body Rappture::MainWin::draw {option args} {
    261261    set w $itk_component(hull)
    262     regsub -all {<w>} $args [winfo screenwidth $w] args
    263     regsub -all {<h>} $args [winfo screenheight $w] args
     262    foreach {screenw screenh} [Rappture::ScreenSize [winfo screen $w]] break
     263    regsub -all {<w>} $args $screenw args
     264    regsub -all {<h>} $args $screenh args
    264265    eval $itk_component(area) create $option $args
    265266}
     
    364365            component hull configure -menu ""
    365366            pack forget $itk_component(app)
    366             set wx [winfo screenwidth $itk_component(hull)]
    367             set wy [winfo screenheight $itk_component(hull)]
     367            foreach {wx wy} [Rappture::ScreenSize [winfo screen $itk_component(hull)]] break
    368368            wm geometry $itk_component(hull) ${wx}x${wy}+0+0
    369369            _redraw
  • branches/uq/gui/scripts/pager.tcl

    r3642 r5222  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: pager - notebook for displaying pages of widgets
     
    5656    public method current {args}
    5757
    58     public method busy { bool } 
     58    public method busy { bool }
    5959
    6060    protected method _layout {}
     
    6868    private variable _current ""     ;# page currently shown
    6969}
    70                                                                                
     70
    7171itk::usual Pager {
    7272}
     
    412412# ----------------------------------------------------------------------
    413413itcl::body Rappture::Pager::_fixSize {} {
    414     set sw [expr {[winfo screenwidth $itk_component(hull)]-200}]
    415     set sh [expr {[winfo screenheight $itk_component(hull)]-200}]
     414    foreach {screenw screenh} [Rappture::ScreenSize [winfo screen $itk_component(hull)]] break
     415    set sw [expr {$screenw-200}]
     416    set sh [expr {$screenh-200}]
    416417
    417418    update  ;# force layout changes so sizes are correct
     
    642643#
    643644#       If true (this indicates a simulation is occurring), the widget
    644 #       should prevent the user from 
    645 #               1) clicking an item previous in the breadcrumbs, and 
     645#       should prevent the user from
     646#               1) clicking an item previous in the breadcrumbs, and
    646647#               2) using the "back" button.
    647648#
    648649itcl::body Rappture::Pager::busy { bool } {
    649650    if { $bool } {
    650         blt::busy hold $itk_component(breadcrumbs) 
     651        blt::busy hold $itk_component(breadcrumbs)
    651652        $itk_component(back) configure -state disabled
    652     } else { 
    653         blt::busy release $itk_component(breadcrumbs) 
     653    } else {
     654        blt::busy release $itk_component(breadcrumbs)
    654655        $itk_component(back) configure -state normal
    655656    }
  • branches/uq/gui/scripts/tooltip.tcl

    r3330 r5222  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*- 
     1# -*- mode: tcl; indent-tabs-mode: nil -*-
    22# ----------------------------------------------------------------------
    33#  COMPONENT: tooltip - help information that pops up beneath a widget
     
    160160    #
    161161    update idletasks
     162    foreach {screenw screenh} [Rappture::ScreenSize [winfo screen $hull]] break
    162163    if {$signx == "+"} {
    163         if {$xpos+[winfo reqwidth $hull] > [winfo screenwidth $hull]} {
    164             set xpos [expr {[winfo screenwidth $hull]-[winfo reqwidth $hull]}]
     164        if {$xpos+[winfo reqwidth $hull] > $screenw} {
     165            set xpos [expr {$screenw-[winfo reqwidth $hull]}]
    165166        }
    166167        if {$xpos < 0} { set xpos 0 }
    167168    } else {
    168169        if {$xpos-[winfo reqwidth $hull] < 0} {
    169             set xpos [expr {[winfo screenwidth $hull]-[winfo reqwidth $hull]}]
    170         }
    171         set xpos [expr {[winfo screenwidth $hull]-$xpos}]
     170            set xpos [expr {$screenw-[winfo reqwidth $hull]}]
     171        }
     172        set xpos [expr {$screenw-$xpos}]
    172173    }
    173174
    174175    if {$signy == "+"} {
    175         if {$ypos+[winfo reqheight $hull] > [winfo screenheight $hull]} {
    176             set ypos [expr {[winfo screenheight $hull]-[winfo reqheight $hull]}]
     176        if {$ypos+[winfo reqheight $hull] > $screenh} {
     177            set ypos [expr {$screenh-[winfo reqheight $hull]}]
    177178        }
    178179        if {$ypos < 0} { set ypos 0 }
    179180    } else {
    180181        if {$ypos-[winfo reqheight $hull] < 0} {
    181             set ypos [expr {[winfo screenheight $hull]-[winfo reqheight $hull]}]
    182         }
    183         set ypos [expr {[winfo screenheight $hull]-$ypos}]
     182            set ypos [expr {$screenh-[winfo reqheight $hull]}]
     183        }
     184        set ypos [expr {$screenh-$ypos}]
    184185    }
    185186
     
    194195          && $py >= $ypos && $py <= $ypos+[winfo reqheight $hull]} {
    195196
    196         if {$px > [winfo screenwidth $hull]/2} {
     197        if {$px > $screenw/2} {
    197198            set signx "-"
    198             set xpos [expr {[winfo screenwidth $hull]-$px+4}]
     199            set xpos [expr {$screenw-$px+4}]
    199200        } else {
    200201            set signx "+"
    201202            set xpos [expr {$px+4}]
    202203        }
    203         if {$py > [winfo screenheight $hull]/2} {
     204        if {$py > $screenh/2} {
    204205            set signy "-"
    205             set ypos [expr {[winfo screenheight $hull]-$py+4}]
     206            set ypos [expr {$screenh-$py+4}]
    206207        } else {
    207208            set signy "+"
  • branches/uq/lang/tcl/src/Makefile.in

    r4501 r5222  
    5353LIBS = \
    5454        -L../../../src/core -lrappture \
    55         $(TCL_LIB_SPEC) -lncurses -lexpat -lz -lm -lstdc++
     55        $(TCL_LIB_SPEC) -lncurses -lexpat -lz -lm -lstdc++ -lXrandr -lX11
    5656
    5757OBJS = \
     
    6565        RpSignal.o  \
    6666        RpSlice.o  \
     67        RpScreenSize.o \
    6768        RpSysinfo.o  \
    6869        Switch.o \
     
    7677ifeq ($(HAVE_LIBCURSES),yes)
    7778   OBJS += RpCurses.o
    78    LIBS += -lncurses 
     79   LIBS += -lncurses
    7980endif
    8081
  • branches/uq/lang/tcl/src/Rappture_Init.c

    r3739 r5222  
    3030extern Tcl_AppInitProc RpDaemon_Init;
    3131extern Tcl_AppInitProc RpCurses_Init;
    32 
     32extern Tcl_AppInitProc RpScreenSize_Init;
    3333#ifdef notdef
    3434extern Tcl_AppInitProc RpLibrary_Init;
     
    7979        return TCL_ERROR;
    8080    }
     81    if (RpScreenSize_Init(interp) != TCL_OK) {
     82        return TCL_ERROR;
     83    }
    8184    if (RpSysinfo_Init(interp) != TCL_OK) {
    8285        return TCL_ERROR;
Note: See TracChangeset for help on using the changeset viewer.