tile-0.8.2/0000755000076500007650000000000010731273177012054 5ustar joejoe00000000000000tile-0.8.2/ANNOUNCE.txt0000444000076500007650000000610410731273156014017 0ustar joejoe00000000000000[16 Dec 2007] ANNOUNCE: Tile Widget Set, version 0.8.2. ~ What is it? The Tile widget set is an experimental reimplementation of some of the standard Tk widgets. The main features are: + Native look and feel under Windows (XP, NT, and 2K) + Nearly-native look and feel under Mac OSX + "Revitalized" look and feel under X11 + Appearance controlled by a theme engine, providing greater flexibility for custom widgets + New widgets, including notebook, progressbar, combobox, separator, and sizegrip. The Tile widget set has been integrated into Tk 8.5.0. The tile extension works with Tk 8.4.5 and up. ~ What's New in 0.8.2 A number of minor incompatibilities were introduced when tile was integrated into the core. Tile 0.8.2 is a transitional release, intended to be backward-compatible with Tile 0.7.8 and forward-compatible with Tk 8.5. See "Incompatible changes", below. ~ New features + New ttk::notebook 'hide' command + Many improvements to the ttk::combobox widget. The combobox almost works properly on OSX now. + ttk::treeview widget column resize behavior has been much improved. Horizontal scrolling works now. + ttk::treeview widget: -displaycolumns {} now means "no columns" instead of "all columns". Use -displaycolumns #all for "all columns". -displaycolumns #all is the default; code that didn't use -displaycolumns is unaffected. + ttk::panedwindow widget: Better support for saving and restoring pane configurations. ~ Incompatible changes + All routines in the tile::* namespace are no longer supported. + [style] command has been renamed to [ttk::style]. + ttk::paned widget has been renamed to ttk::panedwindow. + ttk::dialog widget lives in its own package now; use [package require ttk::dialog] to access it. + [style default] 0.6 compatibility method is gone. If you haven't changed this to [style configure] already, you should do so when you're rewriting everything to use [ttk::style]. + image element factory now takes an imageSpec argument instead of a separate image name and -map option. For example: style element create foo image $base -map {disabled $grayed} should be changed to: ttk::style element create foo image [list $base disabled $grayed] ~ On version numbers To help distinguish formal releases from CVS snapshots, the subminor version number will be incremented immediately before and immediately after making a release. Thus odd-numbered subminor versions indicate a CVS snapshot, and even-numbered ones indicate a known release. ~ Availability The tile widget set is hosted under the tktable project at SourceForge: Sources are available under the 'tile' module in CVS. A prebundled tarball is available in the file release area: Documentation is available here: tile-0.8.2/demos/0000755000076500007650000000000010731273213013152 5ustar joejoe00000000000000tile-0.8.2/demos/autocomplete.tcl0000644000076500007650000000303710176312177016370 0ustar joejoe00000000000000# # autocomplete.tcl,v 1.1 2005/01/28 01:25:19 muonics Exp # # Demonstration of inline auto-completion for Tile combobox widgets. # # Usage: # # enableAutoComplete path ?presorted? # # path may be an individual window to enable auto-completion for only # that window, or TCombobox to enable it for all comboboxes. # # By default, the values list is assumed to be pre-sorted to optimize # the search. If it is not presorted, pass 0 in for the second arg, # and the list will be sorted before the search at the cost of some # overhead. # namespace eval tile::combobox { namespace export enableAutocomplete } ## enableAutocomplete # # Enable inline auto-completion for the specified combobox widget. # proc tile::combobox::enableAutocomplete { w {presorted 1} } { bind $w [namespace code [list DoAutoComplete %W %A $presorted]] } ## DoAutoComplete # # Perform inline auto-completion of typed text in the combobox. # proc tile::combobox::DoAutoComplete { w s presorted } { set old [$w get] tile::entry::Insert $w $s set new [$w get] # Only auto-complete if the string length has changed due to insertion. if {[string length $old] != [string length $new]} { set values [$w cget -values] if {!$presorted} { set values [lsort -dictionary $values] } set match [lsearch -inline $values $new*] if {[string length $match]} { $w delete 0 end $w insert end $match $w selection range [string length $new] end $w icursor [string length $new] } } } tile-0.8.2/demos/demo.tcl0000644000076500007650000005742310730311212014604 0ustar joejoe00000000000000# # demo.tcl,v 1.114 2007/12/13 20:14:02 jenglish Exp # # Tile widget set -- widget demo # package require Tk eval destroy [winfo children .] ;# in case script is re-sourced ### Load auxilliary scripts. # variable demodir [file dirname [info script]] lappend auto_path . $demodir package require tile package require keynav source [file join $demodir iconlib.tcl] source [file join $demodir repeater.tcl] # This forces an update of the available packages list. # It's required for package names to find the themes in demos/themes/*.tcl eval [package unknown] Tcl [package provide Tcl] ### Global options and bindings. # option add *Button.default normal option add *Text.background white option add *Entry.background white option add *tearOff false # See toolbutton.tcl. # option add *Toolbar.relief groove option add *Toolbar.borderWidth 2 option add *Toolbar.Button.Pad 2 option add *Toolbar.Button.default disabled option add *Toolbar*takeFocus 0 # ... for debugging: bind all { set ::W %W } bind all { focus %W } # Stealth feature: # if {![catch {package require Img 1.3}]} { bind all screenshot proc screenshot {} { image create photo ScreenShot -format window -data . bell # Gamma looks off if we use PNG ... # Looks even worse if we use GIF ... ScreenShot write screenshot.png -format png image delete ScreenShot bell } } ### Global data. # foreach theme [lsort [ttk::themes]] { lappend THEMELIST $theme [string totitle $theme] } # Generate icons (see also: iconlib.tcl): # foreach {icon data} [array get ::ImgData] { set ::ICON($icon) [image create photo -data $data] } variable ROOT "." variable BASE [ttk::frame .base] pack $BASE -side top -expand true -fill both array set ::V { COMPOUND top CONSOLE 0 MENURADIO1 One PBMODE determinate SELECTED 1 CHOICE 2 SCALE 50 VSCALE 0 } ### Utilities. # ## foreachWidget varname widget script -- # Execute $script with $varname set to each widget in the hierarchy. # proc foreachWidget {varname Q script} { upvar 1 $varname w while {[llength $Q]} { set QN [list] foreach w $Q { uplevel 1 $script foreach child [winfo children $w] { lappend QN $child } } set Q $QN } } ## sbstub $sb -- stub -command option for a scrollbar. # Updates the scrollbar's position. # proc sbstub {sb cmd number {units units}} { sbstub.$cmd $sb $number $units } proc sbstub.moveto {sb number _} { $sb set $number [expr {$number + 0.5}] } proc sbstub.scroll {sb number units} { if {$units eq "pages"} { set delta 0.2 } else { set delta 0.05 } set current [$sb get] set new0 [expr {[lindex $current 0] + $delta*$number}] set new1 [expr {[lindex $current 1] + $delta*$number}] $sb set $new0 $new1 } ## sbset $sb -- auto-hide scrollbar # Scrollable widget -[xy]scrollcommand prefix. # Sets the scrollbar, auto-hides/shows. # Scrollbar must be controlled by the grid geometry manager. # proc sbset {sb first last} { if {$first <= 0 && $last >= 1} { grid remove $sb } else { grid $sb } $sb set $first $last } ## scrolled -- create a widget with attached scrollbars. # proc scrolled {class w args} { set sf "${w}_sf" frame $sf eval [linsert $args 0 $class $w] scrollbar $sf.hsb -orient horizontal -command [list $w xview] scrollbar $sf.vsb -orient vertical -command [list $w yview] configure.scrolled $sf $w return $sf } ## ttk::scrolled -- create a widget with attached Tile scrollbars. # proc ttk::scrolled {class w args} { set sf "${w}_sf" ttk::frame $sf eval [linsert $args 0 $class $w] ttk::scrollbar $sf.hsb -orient horizontal -command [list $w xview] ttk::scrollbar $sf.vsb -orient vertical -command [list $w yview] configure.scrolled $sf $w return $sf } ## configure.scrolled -- common factor of [scrolled] and [ttk::scrolled] # proc configure.scrolled {sf w} { $w configure -xscrollcommand [list $sf.hsb set] $w configure -yscrollcommand [list $sf.vsb set] grid $w -in $sf -row 0 -column 0 -sticky nwse grid $sf.hsb -row 1 -column 0 -sticky we grid $sf.vsb -row 0 -column 1 -sticky ns grid columnconfigure $sf 0 -weight 1 grid rowconfigure $sf 0 -weight 1 } ### Toolbars. # proc makeToolbars {} { set buttons [list open new save] set checkboxes [list bold italic] # # Tile toolbar: # set tb [ttk::frame $::BASE.tbar_styled -class Toolbar] set i 0 foreach icon $buttons { set b [ttk::button $tb.tb[incr i] \ -text $icon -image $::ICON($icon) -compound $::V(COMPOUND) \ -style Toolbutton] grid $b -row 0 -column $i -sticky news } ttk::separator $tb.sep -orient vertical grid $tb.sep -row 0 -column [incr i] -sticky news -padx 2 -pady 2 foreach icon $checkboxes { set b [ttk::checkbutton $tb.cb[incr i] \ -variable ::V($icon) \ -text $icon -image $::ICON($icon) -compound $::V(COMPOUND) \ -style Toolbutton] grid $b -row 0 -column $i -sticky news } ttk::menubutton $tb.compound \ -text "toolbar" -image $::ICON(file) -compound $::V(COMPOUND) $tb.compound configure -menu [makeCompoundMenu $tb.compound.menu] grid $tb.compound -row 0 -column [incr i] -sticky news grid columnconfigure $tb [incr i] -weight 1 # # Standard toolbar: # set tb [frame $::BASE.tbar_orig -class Toolbar] set i 0 foreach icon $buttons { set b [button $tb.tb[incr i] \ -text $icon -image $::ICON($icon) -compound $::V(COMPOUND) \ -relief flat -overrelief raised] grid $b -row 0 -column $i -sticky news } frame $tb.sep -borderwidth 1 -width 2 -relief sunken grid $tb.sep -row 0 -column [incr i] -sticky news -padx 2 -pady 2 foreach icon $checkboxes { set b [checkbutton $tb.cb[incr i] -variable ::V($icon) \ -text $icon -image $::ICON($icon) -compound $::V(COMPOUND) \ -indicatoron false \ -selectcolor {} \ -relief flat \ -overrelief raised \ -offrelief flat] grid $b -row 0 -column $i -sticky news } menubutton $tb.compound \ -text "toolbar" -image $::ICON(file) -compound $::V(COMPOUND) \ -indicatoron true $tb.compound configure -menu [makeCompoundMenu $tb.compound.menu] grid $tb.compound -row 0 -column [incr i] -sticky news grid columnconfigure $tb [incr i] -weight 1 } # # Toolbar -compound control: # proc makeCompoundMenu {menu} { variable compoundStrings {text image none top bottom left right center} menu $menu foreach string $compoundStrings { $menu add radiobutton \ -label [string totitle $string] \ -variable ::V(COMPOUND) -value $string \ -command changeToolbars ; } return $menu } proc changeToolbars {} { foreachWidget w [list $::BASE.tbar_styled $::BASE.tbar_orig] { catch { $w configure -compound $::V(COMPOUND) } } } makeToolbars ### Theme control panel. # proc makeThemeControl {c} { ttk::labelframe $c -text "Theme" -padding {6 0} foreach {theme name} $::THEMELIST { set b [ttk::radiobutton $c.s$theme -text $name \ -variable ::ttk::currentTheme -value $theme \ -command [list ttk::setTheme $theme]] pack $b -side top -expand false -fill x } return $c } makeThemeControl $::BASE.control ### Notebook widget. # set nb [ttk::notebook $::BASE.nb] ttk::notebook::enableTraversal $nb ### Main demo pane. # # Side-by comparison of Tile vs. core widgets. # set pw [ttk::panedwindow $nb.client -orient horizontal] $nb add $pw -text "Demo" -underline 0 -padding 6 set l [ttk::labelframe $pw.l -text "Themed" -padding 6 -underline 1] set r [labelframe $pw.r -text "Standard" -padx 6 -pady 6] $pw add $l -weight 1; $pw add $r -weight 1 ## menubuttonMenu -- demo menu for menubutton widgets. # proc menubuttonMenu {menu} { menu $menu foreach dir {above below left right flush} { $menu add command -label [string totitle $dir] \ -command [list [winfo parent $menu] configure -direction $dir] } $menu add cascade -label "Submenu" -menu [set submenu [menu $menu.submenu]] $submenu add command -label "Subcommand 1" $submenu add command -label "Subcommand 2" $submenu add command -label "Subcommand 3" $menu add separator $menu add command -label "Quit" -command [list destroy .] return $menu } ## Main demo pane - themed widgets. # ttk::checkbutton $l.cb -text "Checkbutton" -variable ::V(SELECTED) -underline 2 ttk::radiobutton $l.rb1 -text "One" -variable ::V(CHOICE) -value 1 -underline 0 ttk::radiobutton $l.rb2 -text "Two" -variable ::V(CHOICE) -value 2 ttk::radiobutton $l.rb3 -text "Three" -variable ::V(CHOICE) -value 3 -under 0 ttk::button $l.button -text "Button" -underline 0 ttk::menubutton $l.mb -text "Menubutton" -underline 2 $l.mb configure -menu [menubuttonMenu $l.mb.menu] set ::entryText "Entry widget" ttk::entry $l.e -textvariable ::entryText $l.e selection range 6 end set ltext [ttk::scrolled text $l.t -width 12 -height 5 -wrap none] grid $l.cb -sticky ew grid $l.rb1 -sticky ew grid $l.rb2 -sticky ew grid $l.rb3 -sticky ew grid $l.button -sticky ew -padx 2 -pady 2 grid $l.mb -sticky ew -padx 2 -pady 2 grid $l.e -sticky ew -padx 2 -pady 2 grid $ltext -sticky news grid columnconfigure $l 0 -weight 1 grid rowconfigure $l 7 -weight 1 ; # text widget (grid is a PITA) ## Main demo pane - core widgets. # checkbutton $r.cb -text "Checkbutton" -variable ::V(SELECTED) radiobutton $r.rb1 -text "One" -variable ::V(CHOICE) -value 1 radiobutton $r.rb2 -text "Two" -variable ::V(CHOICE) -value 2 -underline 1 radiobutton $r.rb3 -text "Three" -variable ::V(CHOICE) -value 3 button $r.button -text "Button" menubutton $r.mb -text "Menubutton" -underline 3 -takefocus 1 $r.mb configure -menu [menubuttonMenu $r.mb.menu] # Add -indicatoron control: set ::V(rmbIndicatoron) [$r.mb cget -indicatoron] $r.mb.menu insert 0 checkbutton -label "Indicator?" \ -variable ::V(rmbIndicatoron) \ -command "$r.mb configure -indicatoron \$::V(rmbIndicatoron)" ; $r.mb.menu insert 1 separator entry $r.e -textvariable ::entryText set rtext [scrolled text $r.t -width 12 -height 5 -wrap none] grid $r.cb -sticky ew grid $r.rb1 -sticky ew grid $r.rb2 -sticky ew grid $r.rb3 -sticky ew grid $r.button -sticky ew -padx 2 -pady 2 grid $r.mb -sticky ew -padx 2 -pady 2 grid $r.e -sticky ew -padx 2 -pady 2 grid $rtext -sticky news grid columnconfigure $r 0 -weight 1 grid rowconfigure $r 7 -weight 1 ; # text widget # # Add some text to the text boxes: # set cb $::BASE.tbar_orig.cb5 set txt "checkbutton $cb \\\n" foreach copt [$cb configure] { if {[llength $copt] == 5} { append txt " [lindex $copt 0] [lindex $copt 4] \\\n" } } append txt " ;\n" $l.t insert end $txt $r.t insert end $txt ### Scales and sliders pane. # proc scales.pane {scales} { ttk::frame $scales ttk::panedwindow $scales.pw -orient horizontal set l [ttk::labelframe $scales.styled -text "Themed" -padding 6] set r [labelframe $scales.orig -text "Standard" -padx 6 -pady 6] ttk::scale $l.scale -orient horizontal -from 0 -to 100 -variable ::V(SCALE) ttk::scale $l.vscale -orient vertical -from 100 -to 0 -variable ::V(VSCALE) ttk::progressbar $l.progress -orient horizontal -maximum 100 ttk::progressbar $l.vprogress -orient vertical -maximum 100 if {1} { $l.scale configure -command [list $l.progress configure -value] $l.vscale configure -command [list $l.vprogress configure -value] } else { # This would also work, but the Tk scale widgets # in the right hand pane cause some interference when # in autoincrement/indeterminate mode. # $l.progress configure -variable ::V(SCALE) $l.vprogress configure -variable ::V(VSCALE) } $l.scale set 50 $l.vscale set 50 ttk::label $l.lmode -text "Progress bar mode:" ttk::radiobutton $l.pbmode0 -variable ::V(PBMODE) \ -text determinate -value determinate -command [list pbMode $l] ttk::radiobutton $l.pbmode1 -variable ::V(PBMODE) \ -text indeterminate -value indeterminate -command [list pbMode $l] proc pbMode {l} { variable V $l.progress configure -mode $V(PBMODE) $l.vprogress configure -mode $V(PBMODE) } ttk::button $l.start -text "Start" -command [list pbStart $l] proc pbStart {l} { set ::V(PBMODE) indeterminate; pbMode $l $l.progress start 10 $l.vprogress start } ttk::button $l.stop -text "Stop" -command [list pbStop $l] proc pbStop {l} { $l.progress stop $l.vprogress stop } grid $l.scale -columnspan 2 -sticky ew grid $l.progress -columnspan 2 -sticky ew grid $l.vscale $l.vprogress -sticky nws grid $l.lmode -sticky we -columnspan 2 grid $l.pbmode0 -sticky we -columnspan 2 grid $l.pbmode1 -sticky we -columnspan 2 grid $l.start -sticky we -columnspan 2 grid $l.stop -sticky we -columnspan 2 grid columnconfigure $l 0 -weight 1 grid columnconfigure $l 1 -weight 1 grid rowconfigure $l 99 -weight 1 scale $r.scale -orient horizontal -from 0 -to 100 -variable ::V(SCALE) scale $r.vscale -orient vertical -from 100 -to 0 -variable ::V(VSCALE) grid $r.scale -sticky news grid $r.vscale -sticky nws grid rowconfigure $r 99 -weight 1 grid columnconfigure $r 0 -weight 1 ## $scales.pw add $l -weight 1 $scales.pw add $r -weight 1 pack $scales.pw -expand true -fill both return $scales } $nb add [scales.pane $nb.scales] -text Scales -sticky nwes -padding 6 ### Combobox demo pane. # proc combobox.pane {cbf} { ttk::frame $cbf set values [list abc def ghi jkl mno pqr stu vwx yz] pack \ [ttk::combobox $cbf.cb1 -values $values -textvariable ::COMBO] \ [ttk::combobox $cbf.cb2 -values $values -textvariable ::COMBO ] \ [ttk::combobox $cbf.cb3 -values $values -textvariable ::COMBO ] \ -side top -padx 2 -pady 2 -expand false -fill x; $cbf.cb1 configure -state readonly $cbf.cb3 configure -height 5 $cbf.cb1 current 3 return $cbf } $nb add [combobox.pane $nb.combos] -text "Combobox" -underline 7 ### Treeview widget demo pane. # proc tree.pane {w} { ttk::frame $w pack [ttk::scrolled ttk::treeview $w.t -columns [list Class]] \ -expand true -fill both $w.t heading #0 -text "Widget" $w.t heading Class -text "Class" # Populate tree: # $w.t insert {} 0 -id . -text "Main Window" \ -values [list [winfo class .]] populateTree $w.t . bind $w.t [list refreshTree %W] return $w } # populateTree $tv $id -- # Recursively add child nodes to treeview widget. # proc populateTree {tv id} { if {![winfo exists $id]} { $tv delete $id return "" } # Replace tree item children with current list of child windows. # $tv delete [$tv children $id] foreach child [winfo children $id] { $tv insert $id end -id $child -text [winfo name $child] \ -values [list [winfo class $child]] populateTree $tv $child } return $id } # refreshTree -- binding for treeview demo. # Recompute children. # proc refreshTree {tv} { set id [$tv focus] $tv item [populateTree $tv $id] -open true } $nb add [tree.pane $nb.tree] -text "Tree" -sticky news ### Other demos. # $nb add [ttk::frame $nb.others] -text "Others" -underline 4 set Timers(StateMonitor) {} set Timers(FocusMonitor) {} set others $::BASE.nb.others ttk::label $others.m -justify left -wraplength 300 bind ShowDescription { $BASE.nb.others.m configure -text $Desc(%W) } bind ShowDescription { $BASE.nb.others.m configure -text "" } foreach {command label description} { trackStates "Widget states..." "Display/modify widget state bits" scrollbarResizeDemo "Scrollbar resize behavior..." "Shows how Tile and standard scrollbars differ when they're sized too large" trackFocus "Track keyboard focus..." "Display the name of the widget that currently has focus" repeatDemo "Repeating buttons" "Demonstrates custom classes (see demos/repeater.tcl)" } { set b [ttk::button $others.$command -text $label -command $command] set Desc($b) $description bindtags $b [lreplace [bindtags $b] end 0 ShowDescription] pack $b -side top -expand false -fill x -padx 6 -pady 6 } pack $others.m -side bottom -expand true -fill both ### Scrollbar resize demo. # proc scrollbarResizeDemo {} { set t .scrollbars destroy $t toplevel $t ; wm geometry $t 200x200 frame $t.f -height 200 grid \ [ttk::scrollbar $t.f.tsb -command [list sbstub $t.f.tsb]] \ [scrollbar $t.f.sb -command [list sbstub $t.f.sb]] \ -sticky news $t.f.sb set 0 0.5 ;# prevent backwards-compatibility mode for old SB grid columnconfigure $t.f 0 -weight 1 grid columnconfigure $t.f 1 -weight 1 grid rowconfigure $t.f 0 -weight 1 pack $t.f -expand true -fill both } ### Track focus demo. # proc trackFocus {} { global Focus set t .focus destroy $t toplevel $t wm title $t "Keyboard focus" set i 0 foreach {label variable} { "Focus widget:" Focus(Widget) "Class:" Focus(WidgetClass) "Next:" Focus(WidgetNext) "Grab:" Focus(Grab) "Status:" Focus(GrabStatus) } { grid [ttk::label $t.l$i -text $label -anchor e] \ [ttk::label $t.v$i -textvariable $variable \ -width 40 -anchor w -relief groove] \ -sticky ew; incr i } grid columnconfigure $t 1 -weight 1 grid rowconfigure $t $i -weight 1 bind $t {after cancel $Timers(FocusMonitor)} FocusMonitor } proc FocusMonitor {} { global Focus set Focus(Widget) [focus] if {$::Focus(Widget) ne ""} { set Focus(WidgetClass) [winfo class $Focus(Widget)] set Focus(WidgetNext) [tk_focusNext $Focus(Widget)] } else { set Focus(WidgetClass) [set Focus(WidgetNext) ""] } set Focus(Grab) [grab current] if {$Focus(Grab) ne ""} { set Focus(GrabStatus) [grab status $Focus(Grab)] } else { set Focus(GrabStatus) "" } set ::Timers(FocusMonitor) [after 200 FocusMonitor] } ### Widget states demo. # variable Widget .tbar_styled.tb1 bind all { TrackWidget %W ; break } proc TrackWidget {w} { set ::Widget $w ; if {[winfo exists .states]} { UpdateStates } else { trackStates } } variable states [list \ active disabled focus pressed selected readonly \ background alternate invalid] proc trackStates {} { variable states set t .states destroy $t; toplevel $t ; wm title $t "Widget states" set tf [ttk::frame $t.f] ; pack $tf -expand true -fill both ttk::label $tf.info -text "Press Control-Shift-Button-1 on any widget" ttk::label $tf.lw -text "Widget:" -anchor e -relief groove ttk::label $tf.w -textvariable ::Widget -anchor w -relief groove grid $tf.info - -sticky ew -padx 6 -pady 6 grid $tf.lw $tf.w -sticky ew foreach state $states { ttk::checkbutton $tf.s$state \ -text $state \ -variable ::State($state) \ -command [list ChangeState $state] ; grid x $tf.s$state -sticky nsew } grid columnconfigure $tf 1 -weight 1 grid x [ttk::frame $tf.cmd] -sticky nse grid x \ [ttk::button $tf.cmd.close -text Close -command [list destroy $t]] \ -padx 4 -pady {6 4}; grid columnconfigure $tf.cmd 0 -weight 1 bind $t [list event generate $tf.cmd.close <>] bind $t { after cancel $::Timers(StateMonitor) } StateMonitor } proc StateMonitor {} { if {$::Widget ne ""} { UpdateStates } set ::Timers(StateMonitor) [after 200 StateMonitor] } proc UpdateStates {} { variable states variable State variable Widget foreach state $states { if {[catch {set State($state) [$Widget instate $state]}]} { # Not a Tile widget: .states.f.s$state state disabled } else { .states.f.s$state state !disabled } } } proc ChangeState {state} { variable State variable Widget if {$Widget ne ""} { if {$State($state)} { $Widget state $state } else { $Widget state !$state } } } ### Repeating button demo. # proc repeatDemo {} { set top .repeatDemo if {![catch { wm deiconify $top ; raise $top }]} { return } toplevel $top wm title $top "Repeating button" keynav::enableMnemonics $top set f [ttk::frame .repeatDemo.f] ttk::button $f.b -class Repeater -text "Press and hold" \ -command [list $f.p step] ttk::progressbar $f.p -orient horizontal -maximum 10 ttk::separator $f.sep -orient horizontal set cmd [ttk::frame $f.cmd] pack \ [ttk::button $cmd.close -text Close -command [list destroy $top]] \ -side right -padx 6; pack $f.cmd -side bottom -expand false -fill x -padx 6 -pady 6 pack $f.sep -side bottom -expand false -fill x -padx 6 -pady 6 pack $f.b -side left -expand false -fill none -padx 6 -pady 6 pack $f.p -side right -expand true -fill x -padx 6 -pady 6 $f.b configure -underline 0 $cmd.close configure -underline 0 bind $top [list event generate $cmd.close <>] pack $f -expand true -fill both } ### Command box. # set cmd [ttk::frame $::BASE.command] ttk::button $cmd.close -text Close -underline 0 -command [list destroy .] ttk::button $cmd.help -text Help -command showHelp proc showHelp {} { if {![winfo exists .helpDialog]} { lappend detail "Tile version [package provide tile]" lappend detail "Tile library: $::tile::library" lappend detail "[package ifneeded tile [package provide tile]]" lappend detail "Tk version: $::tk_patchLevel" lappend detail "Tk library: $::tk_library" ttk::dialog .helpDialog -type ok -icon info \ -message "Tile demo" -detail [join $detail \n] } } grid x $cmd.close $cmd.help -pady 6 -padx 6 grid columnconfigure $cmd 0 -weight 1 ## Status bar (to demonstrate size grip) # set statusbar [ttk::frame $BASE.statusbar] pack [ttk::sizegrip $statusbar.grip] -side right -anchor se ## Accelerators: # bind $::ROOT [list event generate $cmd.close <>] bind $::ROOT <> [list event generate $cmd.help <>] keynav::enableMnemonics $::ROOT ### Menubar. # set menu [menu $::BASE.menu] $::ROOT configure -menu $menu $menu add cascade -label "File" -underline 0 -menu [menu $menu.file] $menu.file add command -label "Open" -underline 0 \ -compound left -image $::ICON(open) $menu.file add command -label "Save" -underline 0 \ -compound left -image $::ICON(save) $menu.file add separator $menu.file add checkbutton -label "Checkbox" -underline 0 \ -variable ::V(SELECTED) $menu.file add cascade -label "Choices" -underline 1 \ -menu [menu $menu.file.choices] foreach {label value} {One 1 Two 2 Three 3} { $menu.file.choices add radiobutton \ -label $label -variable ::V(CHOICE) -value $value } $menu.file insert end separator if {[tk windowingsystem] ne "x11"} { $menu.file insert end checkbutton -label Console -underline 5 \ -variable ::V(CONSOLE) -command toggleconsole proc toggleconsole {} { if {$::V(CONSOLE)} {console show} else {console hide} } } $menu.file add command -label "Exit" -underline 1 \ -command [list event generate $cmd.close <>] # Add Theme menu. # proc makeThemeMenu {menu} { menu $menu foreach {theme name} $::THEMELIST { $menu add radiobutton -label $name \ -variable ::ttk::currentTheme -value $theme \ -command [list ttk::setTheme $theme] } return $menu } $menu add cascade -label "Theme" -underline 3 -menu [makeThemeMenu $menu.theme] ## Tools menu. # $menu add cascade -label "Tools" -underline 3 -menu [menu $menu.tools] $menu.tools add command -label "Track focus" -command trackFocus $menu.tools add command -label "Widget states" -command trackStates ### Main window layout. # pack $BASE.statusbar -side bottom -expand false -fill x pack $BASE.command -side bottom -expand false -fill x pack $BASE.tbar_styled -side top -expand false -fill x pack $BASE.tbar_orig -side top -expand false -fill x pack $BASE.control -side left -expand false -fill y -padx 6 -pady 6 pack $BASE.nb -side left -expand true -fill both -padx 6 -pady 6 wm title $ROOT "Tile demo" wm iconname $ROOT "Tile demo" update; wm deiconify $ROOT tile-0.8.2/demos/dirbrowser.tcl0000644000076500007650000001025310130630517016036 0ustar joejoe00000000000000# # dirbrowser.tcl,v 1.2 2004/10/05 23:42:07 jenglish Exp # # treeview widget demonstration. # # lappend auto_path ../generic .. package require tile # Create a treeview widget: # set f [ttk::frame .f] ttk::scrollbar $f.vsb -orient vertical -command [list $f.tv yview] set tv [ttk::treeview $f.tv -columns {size mtime} \ -yscrollcommand [list $f.vsb set] ] grid $f.tv $f.vsb -sticky news grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1 # # Set column headings: # # Column #0 is the tree colum. # $tv heading #0 -text "Name" -command [list sortBy $tv #0] $tv heading size -text "Size" -command [list sortBy $tv size] $tv heading mtime -text "Modified" -command [list sortBy $tv mtime] $tv column size -anchor e $tv column mtime -anchor e # # Create some images to use as tree icons: # (images taken from tkfbox.tcl) # foreach {icon data} { folder {R0lGODlhEAAMAKEAAAD//wAAAPD/gAAAACH5\ BAEAAAAALAAAAAAQAAwAAAIghINhyycvVFsB\ QtmS3rjaH1Hg141WaT5ouprt2HHcUgAAOw==} file {R0lGODlhDAAMAKEAALLA3AAAAP//8wAAACH5\ BAEAAAAALAAAAAAMAAwAAAIgRI4Ha+IfWHsO\ rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==} } { set Icons($icon) [image create photo -data $data] } # scanDirectory -- # Scan a directory and add items to the treeview widget. # # To prevent a long initial delay, subdirectories are # scanned "on demand" in the <> binding. # The "Pending" array holds a script to be evaluated # when an item is first opened. # proc scanDirectory {tv parent dir} { variable Icons variable Pending foreach subdir [glob -nocomplain -type d -directory $dir *] { set item [$tv insert $parent end \ -text [file tail $subdir] -image $Icons(folder) \ -values [list {} [datestamp [file mtime $subdir]] ] ] set Pending($item) [list scanDirectory $tv $item $subdir] } foreach file [glob -nocomplain -type f -directory $dir *] { set item [$tv insert $parent end \ -text [file tail $file] -image $Icons(file)] $tv set $item size [file size $file] $tv set $item mtime [datestamp [file mtime $file]] } } bind $tv <> { itemOpened %W } proc itemOpened {w} { variable Pending set item [$w focus] if {[info exists Pending($item)]} { uplevel #0 $Pending($item) unset Pending($item) } } # scanAll -- # Force the tree to be fully populated, by repeatedly # evaluating the contents of the Pending array. # proc scanAll {} { variable Pending . configure -cursor watch while {[llength [set pending [array get Pending]]]} { array unset Pending foreach {_ script} $pending { uplevel #0 $script } } . configure -cursor {} } # openAll -- # Recursively open all nodes in the tree. # proc openAll {tv {item {}}} { foreach child [$tv children $item] { $tv item $child -open true openAll $tv $child } } # datestamp -- # Convert clock values to a human-readable format # proc datestamp {clockValue} { variable clockfmt "%Y-%m-%d %H:%M" clock format $clockValue -format $clockfmt } # sortBy -- # Sort the children of each item by the specified column, # or by the -text label if $column is {}. # proc sortBy {tv column {parent {}}} { foreach child [$tv children $parent] { sortBy $tv $column $child } set items [list] if {$column eq "#0"} { # Sort by -text label: foreach child [$tv children $parent] { lappend items [list $child [$tv item $child -text]] } } else { foreach child [$tv children $parent] { lappend items [list $child [$tv set $child $column]] } } set children [list] foreach item [lsort -dictionary -index 1 $items] { lappend children [lindex $item 0] } $tv children $parent $children } # Rest of GUI. # set cmd [ttk::frame .cmd] grid x \ [ttk::button $cmd.open -text "Open all" -command [list openAll $tv]] \ [ttk::button $cmd.scan -text "Scan all" -command {scanAll} ] \ [ttk::button $cmd.close -text "Close" -command [list destroy .]] \ -padx 6 ; grid columnconfigure $cmd 0 -weight 1 bind . [list event generate $cmd.close <>] pack $cmd -side bottom -expand false -fill x -padx 6 -pady 6 pack $f -side top -expand true -fill both # Load the initial directory: # scanDirectory $tv {} ~ tile-0.8.2/demos/dlgtest.tcl0000644000076500007650000000466110523504263015334 0ustar joejoe00000000000000# # test/demo script for dialog.tcl # package require tile array set DLG { icon question title "Quit..." message "Are you sure you want to quit?" detail "Quitting the application will cause it to stop running. \ You will lose any unsaved data, and make the application \ feel unloved. Please consider leaving it open." } proc displayDialog {} { variable DLG if {[winfo exists .dlg]} { ttk::dialog::dismiss .dlg } ttk::dialog .dlg \ -icon $DLG(icon) \ -title $DLG(title) \ -message $DLG(message) \ -detail $DLG(detail) \ -type yesnocancel \ -default yes \ -cancel cancel \ ; if {0} { set f [ttk::dialog::clientframe .dlg] pack [ttk::progressbar $f.progress -value 50] -expand false -fill x tile::progressbar::start $f.progress } } # displayMessageBox -- # Display standard Tk mesageDialog, for comparison. # proc displayMessageBox {} { variable DLG tk_messageBox -parent . \ -type yesnocancel \ -icon $DLG(icon) \ -title $DLG(title) \ -message $DLG(message) \ -detail $DLG(detail) \ -default yes \ ; } proc dialogDemo {t} { variable DLG ttk::frame $t set f [ttk::frame $t.f] foreach field {title message detail} { grid \ [ttk::label $f.l$field -text "[string totitle $field]:" -anchor e] \ [ttk::entry $f.$field -textvariable ::DLG($field) -width 60] \ -sticky new -padx 3 } grid \ [ttk::label $f.licon -text "Icon:" -anchor e] \ [ttk::combobox $f.icon -state readonly -textvariable DLG(icon) \ -values [list info question warning error]] \ -sticky new -padx 3 grid columnconfigure $f 0 -weight 1 grid columnconfigure $f 1 -weight 5 grid rowconfigure $f 99 -weight 1 set cmd [ttk::frame $t.cmd] grid x \ [ttk::button $cmd.go -text "Display" -command displayDialog] \ [ttk::button $cmd.alt -text "Message" -command displayMessageBox] \ [ttk::button $cmd.quit -text "Close" \ -command [list destroy [winfo toplevel $t]]] \ -padx [list 6 0] -pady 6 -sticky ew; grid columnconfigure $cmd 0 -weight 1 bind . [list event generate $cmd.quit <>] keynav::defaultButton $cmd.go pack $t.cmd -side bottom -expand false -fill x -padx 6 -pady 6 pack $t.f -side top -expand true -fill both -padx 12 -pady 12 return $t } proc dlgtest-main {} { pack [dialogDemo .t] -expand true -fill both } if {[info exists argv0] && $argv0 eq [info script]} { dlgtest-main } tile-0.8.2/demos/iconlib.tcl0000644000076500007650000001627207742576765015337 0ustar joejoe00000000000000array set ImgData { bold {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAI6hI+py60U3wj+ RYQFJYRvEWFBCeFbRFhQQvhG8YPgX0RYUEL4FhEWlBC+RYQFJYQPFN8IPqYut/8hBQA7} copy {R0lGODlhEAAQAJEAANnZ2QAAAP///wAAhCH5BAEAAAAALAAAAAAQABAAAAJUhI8JFJ/gY4iI UEL4FyIiFIXgW0iEUDgfACBI9pzMAAGRiIghWSMDECR7JEKGtkFIRFBG+TIQKDQxtgzcDcmX IfgwQrFlCD4MyZch+EDzj+Bj6mYBADs=} cut {R0lGODlhEAAQAJEAANnZ2QAAAAAAhP///yH5BAEAAAAALAAAAAAQABAAAAJFhI+pcUHwEeIi E0gACIKPEAFBIXy0gMg8EhM+YmQiKSL4eAIiJMI/EQEhQGYGYiQIQAg+iAkIATIzECMBIgT/ RBARERlSADs=} dragfile {R0lGODlhGAAYAKIAANnZ2TMzM////wAAAJmZmf///////////yH5BAEAAAAALAAAAAAYABgA AAPACBi63IqgC4GiyxwogaAbKLrMgSKBoBoousyBogEACIGiyxwoKgGAECI4uiyCExMTOACB osuNpDoAGCI4uiyCIkREOACBosutSDoAgSI4usyCIjQAGCi63Iw0ACEoOLrMgiI0ABgoutyM NAAhKDi6zIIiNAAYKLrcjDQAISg4usyCIjQAGCi63Iw0AIGiiqPLIyhCA4CBosvNSAMQKKo4 ujyCIjQAGCi63Iw0AIGiy81IAxCBpMu9GAMAgKPL3QgJADs=} dragicon {R0lGODlhGAAYALMAANnZ2TMzM/////8zM8zMzGYAAAAAAJmZmQCZMwAzZgCZzGZmZv////// /////////yH5BAEAAAAALAAAAAAYABgAAAT/EMAgJ60SAjlBgEJOSoMIEMgZoJCT0iADBFIG KOSkNMwAAABhwiHnIEKIIIQQAQIZhBBwyDmKEMIEE0yABoAghIBDzlGEENDIaQAIQgg45BwF CinPOccAECYcUiKEEBFCiHPgMQAEIcQYYyABBUGIQCHlMQCEScZAAhKEEApCECGOARAEIQQp BRGIpAyCJCGOASBAISdEcqJAVBLiGABggELOAJGUKyiVhDgGABigkJMEhNAKSqkEhTgGgCCl FCQEGIJSSiUhjgEgQCEnJVBJmYQ4BoAAhZyTQCVnEuIYAAIUckoCk5xSiGMACFDISSs9BoBg rRXQMQAEKOSklR4DEUAI8MhJ6wwGAACgkZNWCkAEADs=} error {R0lGODlhIAAgAKIAANnZ2YQAAP8AAISEhP///////////////yH5BAEAAAAALAAAAAAgACAA AAP/CLoMGLqKoMvtGIqiqxEYCLrcioGiyxwIusyBgaLLLRiBoMsQKLrcjYGgu4Giy+2CAkFX A0WX2wXFIOgGii7trkCEohsDCACBoktEKLpKhISiGwAIECiqSKooukiqKKoxgACBooukKiIo SKooujGDECi6iqQqsopEV2MQAkV3kXQZRXdjEAJFl5F0FUWXY3ACRZcFSRdFlyVwJlB0WZB0 UXRZAmcCRZeRdBVFl2NwAkV3kXQZRXdjcAJFV5FURVaR6GoMDgSKLpKqiKAgqaLoxgwOBIoq kiqKLpIqimrM4ECg6BIRiq4SIaHoxgyCBoou7a5AhKIbMzgAAIGiy+2CTWJmBhAAAkWX2wXF zCDoBooud2PMDIKuRqDocgtGzMwg6O4Eii5z4Kgi6DIMhqLoagQGjiqCLvPgYOgqji6CLrfi 6DIj6HI7jq4i6DIkADs=} file {R0lGODlhCwANAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAALAA0AAAIyhI9G8Q0AguSH AMQdxQgxEyEFQfItICQokYgEBMm3gBCKLRIQJN8CQii2SECQfAug+FgAOw==} folder {R0lGODlhEAANAKIAANnZ2YSEhMbGxv//AP///wAAAP///////yH5BAEAAAAALAAAAAAQAA0A AANjCIqhiqDLITgyEgi6GoIjIyMYugCBpMsaWBA0giMjIzgyUYBBMjIoIyODEgVBODIygiMj E1gQJIMyMjIoI1GAQSMjODIyghMFQSgjI4MyMhJYEDSCIyMjODJRgKHLXAiApcucADs=} hourglass {R0lGODlhIAAgAKIAANnZ2YAAAAAAAP8AAP///8DAwICAgP///yH5BAEAAAAALAAAAAAgACAA AAPZCLrc/jDKSau9OGcUuqyCoMvNGENVhaMrCLrcjaLLgqDL7WhFVIVVZoKgy+1oRUSFVWaC oMvtaEVEhVVmgqDL7WhFRIVVZoKgy+1oVVaCJWaCoMvtgKxISrBMEHS5fZEVSRkKgi63NzIq EwRdbndkVCYIutzeyIqqDAVBl9sXWRFJYZkg6HI7ICsiKqwyEwRdbkcrIhKsMhMEXW5HKyIp lDITBF1uRysyEiwxEwRdbkcrIyuUEhMEXW5H0WVB0OVujKGqwtEVBF1uRtHlRdDl9odRTlrt xRmjBAA7} info {R0lGODlhIAAgAKIAANnZ2YSEhMbGxv///wAA/wAAAP///////yH5BAEAAAAALAAAAAAgACAA AAP/CLoMGLqKoMvtGCo4uhKBgaDLDRghOLqsghEIuryBgqPLPSiBoMsQOLojhEQkOLpTCLob OLqKpIujq4WgC4Gju0i6OLpbCKohOLorhEQkOLorhaAQOLrc3qgCIARHl9sbSQUEji4j6RKO Lk9hQODosiKp4ujyFIbi6LIiqeLo8hSG4uiyIqni6PIUhuLosiKp4ujyFIYKji4PkiqOLkth BASOLg+SKo4uV2AEhODoMpIqju5KYShA4Ogqku7i6E4FRgAAYOHocvugiohAUC0cXe7GiohA 0IUSHF3uQamICATdrULB0WUVrIqIQNBlCCwVHF2pwsJQRdDlDYyoKsHRPMLQDQRdbsDQqBmc wlBF0OV2jJqZwggEXW5vVDMVgaDL7Y5qKgJBl9sfVUUg6HL7AxSKoMvtr1AEgi5DAgA7} italic {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAIrhI+py+1A4hN8 hIjINBITPlpEZBqJCR8tIjKNxISPFhGZQOITfExdbv9FCgA7} new {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAJFhI95FN8IvgXJ jyD4ECQ/JAh+kPyICIIdJP+CYAfJvyDYQfIvCHaQ/AuCHST/gmAHyb8g2EHyLwh2kPwLgk3x MQg+pu4WADs=} open {R0lGODlhEAAQAKIAANnZ2QAAAP//AP///4SEAP///////////yH5BAEAAAAALAAAAAAQABAA AANZCLrczigUQZc1EDQgEHSZAwMgIhB0NQIDQkYwdANBNUZwZGQEJxBUQwZlZGRQAkE1RnAE Q5dVcCSQdDcAYySQdDcAISSQdDcAASKQdDcAAQBDlwNBl9sfApQAOw==} openfold {R0lGODlhEAANAKIAANnZ2YSEhP///8bGxv//AAAAAP///////yH5BAEAAAAALAAAAAAQAA0A AANgCIqhiqDLgaIaCLoagkNDIxi6AIFCQ0M4KKpRgCFDQzg0NIQThaHLSxgVKLochRMVMkhD Q4M0VBFYEDKEQ0NDOFFRgCE0NEhDQ4MVBRAoNDSEQ0NRWAAYuqyFBQBYurwJADs=} overstrike {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAI3hI+py80Uh+Aj RFhQCP8iMILgWwRGEHyLwAiCbxEYQfCB4iPBhwiMIPgXYREEHyEiguBj6nI7FQA7} palette {R0lGODlhEAAQAKIAANnZ2QAAAP//AP////8A/4QAhP8AAAD//yH5BAEAAAAALAAAAAAQABAA AANtCLrcjqGBoMsRKCMTgaALMSgDAYMSCKoxgAFBITgSAIAQEhUIARCAEgAQOBAwghMQEwga MoIjIxAIEgCAEBEyKBAgg4GgGxAIYTGCgaALcRgQIIGgCwEYICODgaALITgyEoGguxiqCLrc /lChBAA7} passwd {R0lGODlhIAAgAMQAANnZ2QAAAICAgICAAP///7CwsMDAwMjIAPjIAOjo6Pj4AODg4HBwcMj4 ANjY2JiYANDQ0MjIyPj4yKCgoMiYAMjImDAwAMjIMJiYmJCQkP////////////////////// /yH5BAEAAAAALAAAAAAgACAAAAX/ICCOIhiIIgiII1maZSCMQnCeJyAIQiAIAiAMwxCcJwkk EAQRCIUwGMSBDEEAAuJIlgKRJEEgGAMRBIGiDENQlqNAJAsYCEwgEEEgBAHSIEMAAuJIAgKR LEsgGEMgCEJgBMqhHENQlgJILMsSCMRABEFgGAESHMcRgIA4kgKxOIsTBAOhKAITKEGDHMhD kqIAEqAjisJAgIooBkpwNMcTgIA4jgLhOBAkEAOhKIoSKEGDIMcTkKQICgQEQQIxEIqiBEpw IMdxPAEIiCMJCEQUMUQ0EIqiHIfSIM3xBGUpCiABCUQyEMqhHMiBHMjxBCAgjuQoEAKxRANB HMqhHM1x/zxDUJajQIACsUTDQBAEIR3IcQRDAALiSIoCYQiEE03gII7HQR3BEICAOJICYRSC QDjRNE1CAAzVQR3WE5AkAAqEUQiFQEARBAUAAAzHQR3BEICAOI4CUQhFIBAREwXjUFUHdQRD QJJAABbCFAhEJBgBAADAMAwXdQRDAALiCAhEIRQCYRiCEZDjUFFHMAQkIBAFOAmTQBiFUAQg II7AUFXUEQwBCQjEJExBkBRCEZCjMIBD9RxDAALiGEzCFBBYIRTBOI7AQB1DMIoCMQkYGAjL JEwBCIgjOVDDEJCAQGACJiTTJEwBSY5BEJAiSCCwTAiCZBKmAATEkSzNQBCCYCDBJgELTNMk g0AMEgwTAhAQR7I0zYARgvM8TyAIznMMAQA7} paste {R0lGODlhEAAQAKIAANnZ2QAAAP//AISEAISEhP///wAAhP///yH5BAEAAAAALAAAAAAQABAA AANwCLrcjqGBoKsYqiKrCDSGBkMiJJCGAgCDKBB0gwYDIKYwdJUIAyBokIaGBmloAhBiaAgH TdcCEIKGBsmwVM0AIYaGcAxL1coQgoYGySoisMzMAoeGxrB01QJpaMiwMHTLAEPVsHTVEHTR dBlBlxswAQA7} print {R0lGODlhEAAQAKIAANnZ2QAAAP///4SEhP//AP///////////yH5BAEAAAAALAAAAAAQABAA AANZCLrcjqG7CLqBoquBoBuCoSqBoBsouhoIuiEYqrKBoIGiqwEYEIChyxAIEYGgywEYgKHL DAgRCLozgwABARgIukSEABEBGLq8gAEQCLobgAEAgKHLgaDLzZgAOw==} question {R0lGODlhIAAgAKIAANnZ2YSEhMbGxv///wAAAAAA/////////yH5BAEAAAAALAAAAAAgACAA AAP/CLoMGLqKoMvtGCo4uhKBgaDLDRghOLqsghEIuryBgqPLPSiBoMsQOLrcjYSgu4GjO4Kl Kzi6Qwi6EDi6I4UyU1VYgqM7hKAagqM7VTg6VYWFoztCCAqBo6tVWDVThVU4ukqBACE4ulqF VSNVWIWjq0IYEDi6K4UlU1VYOLpMgRA4uryCpTi6PIShOLq8hVU4uqyEoTi6vIUlOLqshKE4 uryFhaPLSxgqOLrc3kgoAgJHl0ewSnB0eQhDIQRHl6uwCkeXhTAUIHB0uQqrcHSZAiMAAJBw dFcKS3B0lwIjAkGVcHS5GykiAkEXSHB0uQeFIiIQdJcIBUeXVZAoIgJBT5chkFRwdIUICUMV QZc3MIKIBEcJQzcQdLkBQ4NmcAhDFUGX2zFoZggjEHS5vRHNUASCLrc7oqEIBF1uf0QUgaDL 7Q9QKIIut79CEQi6DAkAOw==} redo {R0lGODlhEAAQAJEAANnZ2QAAhP///////yH5BAEAAAAALAAAAAAQABAAAAIvhI+py+1vSByC jxAYQXDMwsyAggQAQBB8iwgMgg8REQgUwqbYBDsIPqYutz+MgBQAOw==} save {R0lGODlhEAAQAJEAANnZ2QAAAISEAP///yH5BAEAAAAALAAAAAAQABAAAAJWhI9pFB8RIIRC +BYQFqQQvkWEBSmEbyFhQQrhW0hYkEL4FhIWpBC+hYQFSYxvIgFAoXy0AAiSGP8kAIIkxgcI CSBEQvEBQgIIkVB8gJAAAhgfj+BjWgEAOw==} underline {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAI3hI+py60UBy4I vkVcBMG/iIsg+BdxEQT/Ii6C4F/ERRD8i7gIgn8RF0HwkWITfExFin8EH1OXCwA7} undo {R0lGODlhEAAQAJEAANnZ2QAAhP///////yH5BAEAAAAALAAAAAAQABAAAAIuhI+py+2vSByC HxdxQCHsCIg7oAAAEUHwLTAiKIQPgRSbYMfd3VEIH1OX2x8mUgA7} warning {R0lGODlhIAAgAKIAANnZ2YSEAP//AMbGxgAAAISEhP///////yH5BAEAAAAALAAAAAAgACAA AAP/CLq8gREIutz+KESGEHS5vVGIiAxSIehy+6JAUaUqBF1uBxQoukOFhaDL7RgoukKFhaDL 3RgoujqEVQi63IyBortUWAi63IuBostDWIWgy60YIjKERCMiSFUIutyAISKCpCoiOFSFoMsd KCpIqiKCQlUIusyBooqkKiIoQ1UIuryBooqkiqJKVQi6rIGii6SKojpUWAi6DIGiG0RIgaJL VQi6HCi6MoREg6I7VFgIuhsoukqEhKKrVFgIuhoouhuEgaKrQ1iFoAuBortDOCi6S4WFoBso uiyEostDWIWgGii63K6IqgAAIVB0WQaJBkV3h7AKAAJFl4WQiFB0mQoLRyBQdFkJiQhFl4ew CgJFl3WQaFB0WQirIFB0ud0RVVWg6HJ7o6GqAgwUXW5fNFRVhQCBpMvti0oVABCwdLndEehi 6XI7I4AEADs=} } tile-0.8.2/demos/repeater.tcl0000644000076500007650000000617710123711470015475 0ustar joejoe00000000000000# # repeater.tcl,v 1.1 2004/09/21 02:34:32 jenglish Exp # # Demonstration of custom classes. # # The Tile button doesn't have built-in support for autorepeat. # Instead of adding -repeatdelay and -repeatinterval options, # and all the extra binding scripts required to deal with them, # we create a custom widget class for autorepeating buttons. # # Usage: # ttk::button .b -class Repeater [... other options ...] # # TODO: # Use system settings for repeat interval and initial delay. # # Notes: # Repeater buttons work more like scrollbar arrows than # Tk repeating buttons: they fire once immediately when # first pressed, and $State(delay) specifies the initial # interval before the button starts autorepeating. # namespace eval tile::Repeater { variable State set State(timer) {} ;# [after] id of repeat script set State(interval) 100 ;# interval between repetitions set State(delay) 300 ;# delay after initial invocation } ### Class bindings. # bind Repeater { %W state active } bind Repeater { %W state !active } bind Repeater { tile::Repeater::Activate %W } bind Repeater <> { tile::Repeater::Activate %W } bind Repeater { tile::Repeater::Press %W } bind Repeater { tile::Repeater::Release %W } bind Repeater { tile::Repeater::Pause %W } bind Repeater { tile::Repeater::Resume %W } ;# @@@ see below # @@@ Workaround for metacity-induced bug: bind Repeater \ { if {"%d" ne "NotifyUngrab"} { tile::Repeater::Resume %W } } ### Binding procedures. # ## Activate -- Keyboard activation binding. # Simulate clicking the button, and invoke the command once. # proc tile::Repeater::Activate {w} { $w instate disabled { return } set oldState [$w state pressed] update idletasks; after 100 $w state $oldState after idle [list $w invoke] } ## Press -- ButtonPress-1 binding. # Invoke the command once and start autorepeating after # $State(delay) milliseconds. # proc tile::Repeater::Press {w} { variable State $w instate disabled { return } $w state pressed $w invoke after cancel $State(timer) set State(timer) [after $State(delay) [list tile::Repeater::Repeat $w]] } ## Release -- ButtonRelease binding. # Stop repeating. # proc tile::Repeater::Release {w} { variable State $w state !pressed after cancel $State(timer) } ## Pause -- B1-Leave binding # Temporarily suspend autorepeat. # proc tile::Repeater::Pause {w} { variable State $w state !pressed after cancel $State(timer) } ## Resume -- B1-Enter binding # Resume autorepeat. # proc tile::Repeater::Resume {w} { variable State $w instate disabled { return } $w state pressed $w invoke after cancel $State(timer) set State(timer) [after $State(interval) [list tile::Repeater::Repeat $w]] } ## Repeat -- Timer script # Invoke the command and reschedule another repetition # after $State(interval) milliseconds. # proc tile::Repeater::Repeat {w} { variable State $w instate disabled { return } $w invoke set State(timer) [after $State(interval) [list tile::Repeater::Repeat $w]] } #*EOF* tile-0.8.2/demos/toolbutton.tcl0000644000076500007650000000642510523517131016075 0ustar joejoe00000000000000# # toolbutton.tcl,v 1.6 2006/11/06 02:30:49 jenglish Exp # # Demonstration of custom widget styles. # # # ~ BACKGROUND # # Checkbuttons in toolbars have a very different appearance # than regular checkbuttons: there's no indicator, they # "pop up" when the mouse is over them, and they appear sunken # when selected. # # Tk added partial support for toolbar-style buttons in 8.4 # with the "-overrelief" option, and TIP #82 added further # support with the "-offrelief" option. So to get a toolbar-style # checkbutton, you can configure it with: # # checkbutton .cb \ # -indicatoron false -selectcolor {} -relief flat -overrelief raised -offrelief flat # # Behind the scenes, Tk has a lot of rather complicated logic # to implement this checkbutton style; see library/button.tcl, # generic/tkButton.c, and the platform-specific files unix/tkUnixButton.c # et al. for the full details. # # The tile widget set has a better way: custom styles. # Since the appearance is completely controlled by the theme engine, # we can define a new "Toolbutton" style and just use: # # checkbutton .cb -style Toolbutton # # # ~ DEMONSTRATION # # The tile built-in themes (default, "alt", windows, and XP) # already include Toolbutton styles. This script will add # them to the "step" theme as a demonstration. # # (Note: Pushbuttons and radiobuttons can also use the "Toolbutton" # style; see demo.tcl.) # ttk::style theme settings "step" { # # First, we use [ttk::style layout] to define what elements to # use and how they're arranged. Toolbuttons are pretty # simple, consisting of a border, some internal padding, # and a label. (See also the TScrollbar layout definition # in demos/blue.tcl for a more complicated layout spec.) # ttk::style layout Toolbutton { Toolbutton.border -children { Toolbutton.padding -children { Toolbutton.label } } } # (Actually the above isn't strictly necessary, since the same layout # is defined in the default theme; we could have inherited it # instead.) # # Next, specify default values for element options. # For many options (like -background), the defaults # inherited from the parent style are sufficient. # ttk::style configure Toolbutton \ -width 0 -padding 1 -relief flat -borderwidth 2 # # Finally, use [ttk::style map] to specify state-specific # resource values. We want a flat relief if the widget is # disabled, sunken if it's selected (on) or pressed, # and raised when it's active (the mouse pointer is # over the widget). Each state-value pair is checked # in order, and the first matching state takes precedence. # ttk::style map Toolbutton -relief { disabled flat selected sunken pressed sunken active raised } } # # ~ A final note: # # TIP #82 also says: "When -indicatoron is off and the button itself # is on, the relief continues to be hard-coded to sunken. For symmetry, # we might consider adding another -onrelief option to cover this # case. But it is difficult to imagine ever wanting to change the # value of -onrelief so it has been omitted from this TIP. # If there as strong desire to have -onrelief, it can be added later." # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # The Tile project aims to make sure that this never needs to happen. # tile-0.8.2/ChangeLog0000644000076500007650000057462710731267014013644 0ustar joejoe00000000000000 === TILE 0.8.2 TAGGED FOR RELEASE 2006-12-16 === 2007-12-15 Joe English * tclconfig/tcl.m4: Update to TEA 3.6 (core tclconfig/tcl r1.117) * generic/tkTheme.h, configure.in, generic/configure.in, generic/Makefile.in, win/makefile.vc: Update version number. * configure, generic/configure: Regenerated. 2007-12-12 Joe English * library/scrollbar.tcl: Tweak scrollbar swap logic so that Tile extension can be loaded into an 8.5 interp that's already swapped the scrollbars. 2007-12-11 Joe English * generic/tkTheme.c(StyleElementOptionsCmd): Use Ttk_GetElement() to find element instead of direct hash table access. 2007-12-07 Joe English * library/altTheme.tcl, library/clamTheme.tcl: s/style/ttk::style/. 2007-12-06 Joe English * macosx/aquaTheme.c: Fix TCombobox layout so as not to truncate long text when combobox is wider than requested [#1845164] 2007-12-01 Joe English * generic/tkTheme.h, generic/tkThemeInt.h, generic/layout.c, generic/tkTheme.c, generic/treeview.c, generic/clamTheme.c, generic/classicTheme.c, macosx/aquaTheme.c, win/winTheme.c, win/xpTheme.c: Improved macrology for statically-initialized layout templates; can specify layouts in one place. 2007-11-25 Joe English * generic/notebook.c: Added [$nb hide] method (currently implemented by just setting '-state hidden'). [$nb add] on an already-managed window no longer raises an error, can be used to re-add hidden tabs. * doc/notebook.n: Revised and updated; removed now-inoperative text stating or implying that slave windows must be direct children of the notebook (see also #1824996). 2007-11-25 Joe English * generic/notebook.c(SelectNearestTab): Don't map next tab immediately, instead just update currentIndex and let the PlaceSlaves hook take care of it. Fixes [#1343984] "ttk::notebook map children when destroyed" 2007-11-25 Joe English * generic/manager.h, generic/manager.c, generic/notebook.c, generic/paned.c, generic/frame.c: More manager API updates: Added SlaveRequest method; pass managerData to SlaveRemoved method instead of manager; Ttk_ManagerData no longer needed. 2007-11-19 Pat Thoyts * generic/tkTheme.c: BUGFIX: Fixed crash when 'style element create' called with insufficient args. Plus tests. (backported from core, -JE). 2007-11-18 Joe English * generic/tkElements.c, macosx/aquaTheme.c: Add "fill" element: like "background" but only erases parcel. * generic/frame.c: Use fill element in Labelframe Label sublayout. Also improved default labelmargins for -labelanchor w*, e*. * library/aquaTheme.tcl: no longer need Labelframe hack. * generic/label.c: ImageTextElement no longer needed. TextElement no longer needs '-background' option. 2007-11-18 Joe English * generic/label.c: Default -anchor for text and label elements is now "w" instead of "center" (fixes #1614540 "check and radiobuttons with explicit -width"). * library/defaults.tcl, library/*Theme.tcl: Button styles now need explicit "-anchor center". * * * POTENTIAL INCOMPATIBILITY * * * for third-party themes. 2007-11-18 Joe English * generic/frame.c: Use sublayout for ttk::labelframe labels instead of single element. * library/aquaTheme.tcl: Adjustment for previous change. 2007-11-18 Joe English * generic/layout.c(TTKInitPadding): BUGFIX: Ttk_GetPaddingFromObj() and Ttk_GetBorderFromObj() returned garbage when passed an empty list. 2007-11-18 Joe English * library/scrollbar.tcl: Swap in core scrollbars for [ttk::scrollbar]s on OSX. The Scrollbar Problem isn't gonna get fixed in time for the next release. 2007-11-18 Joe English * macosx/aquaTheme.c: Synchronize with core changes from 2007-11-09. Mostly reformatting. Only semantically significant change: now uses theme metrics for button and menubutton heights. * library/aquaTheme.tcl: extra TButton -padding no longer needed. 2007-11-18 Pat Thoyts (Backported from core change, -JE) * win/xpTheme.c: Add support for size information flags for scrollbar and combobox buttons. This handles tile patches 1596647 and 1596657 but a bit more generically. 2007-11-07 Joe English * generic/tkTheme.c(Ttk_ElementSize): Fixed longstanding, subtle bug that caused padding to sometimes be counted twice in element size computations. * generic/image.c, macosx/aquaTheme.c win/winTheme.c, win/xpTheme.c, generic/tkElements.c, generic/clamTheme.c, generic/treeview.c, generic/altTheme.c: Fix ElementSizeProcs affected by previous change. === POTENTIAL INCOMPATIBILITY === For third-party C language themes: any ElementSizeProc that sets a nonzero size and a nonzero padding may be affected by this change. Third-party pixmap themes are not affected (fixed in image.c). 2007-11-05 Joe English * library/combobox.tcl: Set focus to listbox in binding instead of in Post command (workaround for problem in TkAqua where the listbox only gets focus the first time it's posted; see #1349811 for info). 2007-11-05 Joe English * macosx/aquaTheme.c(TreeitemLayout): Remove focus ring from treeview items on OSX (problem reported by Kevin Walzer). 2007-11-04 Joe English * generic/treeview.c: Use null "treearea" element for treeview owner-draw area instead of "client", to avoid nameclash with Notebook.client element (this was causing sizing anomalies in XP theme, and introduced extraneous padding). * generic/altTheme.c: Treeitem.indicator element needs left margin now. 2007-10-30 Joe English * library/combobox.tcl(Unpost): BUGFIX: Unpost can be called with no preceding Post ( binding). 2007-10-30 Joe English * macosx/aquaTheme.c(BackgroundElement): Use SetThemeBackGround/ kThemeBrushModelessDialogBackground{Active|Inactive} instead of ApplyThemeBackground/kThemeBackgroundWindowHeader (advice from DAS). * library/aquaTheme.tcl: Use darker shade for inactive and disabled text, to match typical values of most (but not all) kThemeXXXTextColorInactive colors. 2007-10-30 Joe English * generic/widget.c: Split up RedisplayWidget() to factor out double-buffering related code. 2007-10-28 Joe English * library/fonts.tcl: Use Monaco 11 instead of Monaco 9 for TkFixedFont on OSX (backport core patch hobbs 2007-10-30) 2007-10-28 Joe English * macosx/aquaTheme.c: Reworked combobox layout: use kThemeComboBox button to draw whole widget instead of kThemeArrow button for Combobox.downarrow. * library/aquaTheme.tcl: adjust TCombobox -postoffset to match new layout. * library/combobox.tcl: Make popdown window [wm resizable 0 0] on OSX, to prevent TkAqua from shrinking the scrollbar to make room for a grow box that isn't there. Remaining OSX combobox problems: + Popdown window only takes focus the first time it's posted. + Readonly comboboxes don't have the right appearance. + "pulldown" interaction doesn't work. 2007-10-28 Joe English * library/combobox.tcl: set [wm transient] prior to posting the dropdown each time instead of just once at creation-time, in case containing toplevel has been reparented [fix from JH for #1818441]. 2007-10-25 Joe English * generic/notebook.c: Reworked $nb insert logic; fixes multiple bugs (see #1817596). 2007-10-24 Joe English * library/fonts.tcl: Update aqua font definitions to match reality instead of the HIG (backport from core; see #780617) 2007-10-24 Joe English * {generic,win,macosx}/*.c: Move widget layout registration from TtkElements_Init() to widget *_Init() routines. Renaming/consistency: s/...ElementGeometry()/...ElementSize()/ 2007-10-23 Joe English * library/combobox.tcl: [namespace import ::ttk::scrollbar] doesn't work, since ttk::scrollbar isn't [namespace export]ed in Tk 8.5. 2007-10-21 Joe English Combobox overhaul: * library/utils.tcl(SaveGrab): Avoid loops in grab stack [#1239190] * library/aquaTheme.tcl: Factored aqua-specific combobox post position offsets out of combobox.tcl; now specified in theme definition. * generic/track.c: TrackElementState now detects and handles grabs (release currently-pressed element on LeaveNotify/NotifyGrab) * library/combobox.tcl: + Place grab on popdown window instead of combobox. + Set/release grab in popdown /Unmap> binding. + Factored out ttk::combobox::LBHover. + Refactored LBSelected/LBSelect to avoid extraneous [focus] calls in LBTab binding. + Only restore focus to combobox on activation, not on every Unpost. + "Workaround for TrackElementState bug" no longer needed + Use MacWindowStyle help [fixes #1349586, see also #1780286] 2007-10-18 Joe English * library/fonts.tcl: Add other TIP#145-defined fonts TkMenuFont, TkFixedFont, and TkIconFont (backport from Tk change 2007-10-18 patthoyts). 2007-10-18 Joe English * macosx/aquaTheme.c: adjust button and separator geometry. (backport from Tk change 2007-10-18 das). 2007-10-15 Joe English * generic/ttk/ttkTreeview.c: Store pointer to column table entry instead of column index in columnNames hash table. 2007-09-30 Joe English * library/ttk/entry.tcl (WordBack, WordForward): Fix private routines accidentally defined in global namespace [#1803836] 2007-09-17 Joe English * library/combobox.tcl: Try to improve combobox appearance on OSX + Tk 8.5 [#1780286]. 2007-07-13 Joe English * configure.in, generic/Makefile.in, generic/configure.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.8.1 to indicate CVS snapshot (should have done this a while ago) * configure, generic/configure: regenerated. 2007-07-10 Joe English * library/dialog.tcl: provide package ttk::dialog. * doc/dialog.n: Add "package require ttk::dialog" to SYNOPSIS. NOTE: dialog.tcl is still automatically loaded by tile.tcl, the [package provide] call is so applications can transition to calling [package require ttk::dialog] in preparation for when it's distributed separately. 2007-07-06 Joe English * library/ttk/aquaTheme.tcl: Set -anchor w for TMenubuttons [#1614540] 2007-06-09 Joe English * generic/paned.c, doc/paned.n, tests/paned.test: Added -width and -height options. Added 'panes' method, return list of managed windows. 'sashpos' method is now documented as part of the public interface, and details clarified. Should be easier to set initial sash positions now [Alleviates #1659067]. 2007-06-09 Joe English * generic/manager.c, generic/manager.h, generic/notebook.c, generic/paned.c, generic/frame.c: Ttk_Manager API overhaul: + Ttk_Manager no longer responsible for managing slave records + Ttk_Manager structure now opaque + Ttk_Slave structure now private + Pass Ttk_Manager * to Tk_GeomMgr hooks instead of Ttk_Slave * * generic/frame.c: Simplified -labelwidget management. * generic/notebook.c, tests/notebook.test: BUGFIX: ttk::noteboook 'insert' command didn't correctly maintain current tab. * doc/paned.n, library/paned.tcl: Changed documentation of ttk::panedwindow 'identify' command to match implementation. 2007-05-19 Pat Thoyts * demos/themes/blue.tcl: fixed up for the new image element factory image spec. 2007-05-18 Joe English * generic/entry.c(EntrySetValue): Ensure that widget is in a consistent state before setting the linked -textvariable. Previously, it was possible for [$e index insert] to point past the end of the string, leading to heap corruption [Bug 1721532]. * tests/entry.test(entry-9.1): Add test case for the above. 2007-04-27 Joe English * generic/treeview.c(TagOptionSpecs): Workaround for bug in tag table resource management (never calls Tk_FreeConfigOptions, so TK_OPTION_FONT and TK_OPTION_COLOR resources aren't fully deallocated). Use TK_OPTION_STRING instead, which does get freed properly. Long-term solution: don't use Tk_OptionTables for tags. 2007-04-26 Joe English * macosx/aquaTheme.c: Element drawing code now works when drawing into the Tk_Window as well as an offscreen pixmap; will work without double-buffering now. (Backported from core changes from DAS, 2007-04-23) * * * NOTICE: now peeks into Tk private data structures, * * * stubs compatibility no longer guaranteed. 2007-04-10 Joe English * win/xpTheme.c: Skip OS version test, should work on Vista/Aero now as well as XP [Fixes #1687299, thanks to George Petasis for tracking this down]. 2007-03-21 Joe English * generic/layout.c(Ttk_BuildLayoutTemplate): BUGFIX: Nested TTK_GROUP nodes did not work unless they appeared at the end of the layout (and only by accident then). 2007-02-23 Jeff Hobbs * library/notebook.tcl (ttk::notebook::enableTraversal): OS X needs Option instead of Alt binding 2007-02-02 Pat Thoyts * win/xpTheme.c: Support IsAppThemed() call. This is what is used when theming is turned off just for an individual application. 2007-01-11 Joe English * generic/widget.h, generic/tile.c, generic/widget.c: Added various 'const' qualifiers. Patch backported from Tk CVS [2007-01-03 Jan Nijtmans]. (Note that part of the original patch didn't take, since it added contravariant 'const' qualifiers that are incompatible with Tk 8.4.) 2007-01-05 Joe English * generic/widget.h: Add MODULE_SCOPE declarations (synchronization with core copy ttkWidget.h) 2006-12-31 Benjamin Riefenstahl * macosx/aquaTheme.c: Define a constant to make it compile on Mac OS X 10.3. [Patch backported from Tk core, -JE] 2006-12-26 Joe English * generic/ttk/ttkLabel.c: ImageElement clientData no longer needed. 2006-12-18 Joe English * generic/treeview.c: Fix off-by-one condition when moving nodes forward [#1618142] * tests/treeview.test: added test cases for move and insert. 2006-12-18 Joe English * generic/treeview.c, library/treeview.tcl, doc/treeview.n: Added column '-stretch' and '-minwidth' options. Improved column drag and resize behavior. Added horizontal scrolling [#1518650]. Row height and child indent specifiable on Treeview style. Decreased default row height, no default -padding. Use correct heading height [#1163349]. Apply tag settings to tree item as well as to data columns [NOTE: 'tag configure' still buggy]. * generic/scroll.c(TtkScrollTo): Prevent overscroll ([#1173434]) * library/altTheme.tcl, library/aquaTheme.tcl, library/clamTheme.tcl, library/classicTheme.tcl, library/defaults.tcl, library/winTheme.tcl library/xpTheme.tcl: Per-theme treeview settings. * macosx/aquaTheme.c: Added disclosure triangle element. 2006-12-17 Joe English * library/combobox.tcl, generic/entry.c, doc/combobox.n: Add combobox -height option; only show scrollbar if the listbox needs to scroll [#1032869]. 2006-12-14 Joe English * generic/button.c, generic/entry.c, generic/frame.c, generic/image.c, generic/label.c, generic/notebook.c, generic/paned.c, generic/progress.c, generic/scale.c, generic/scrollbar.c, generic/separator.c, generic/tile.c, generic/tkElements.c, generic/tkTheme.h, generic/widget.h: Global reduction: use per-file *_Init() routines to reduce the number of globally-visible initialization records. 2006-12-12 Joe English * library/tile.tcl: Attempt to straighten out theme loading and selection logic. * generic/clamTheme.c, library/clamTheme.tcl, generic/tkElements.c, library/defaults.tcl: Provide package in C part instead of Tcl part as per other themes. 2006-12-10 Joe English * generic/tkTheme.h, generic/tkThemeInt.h, generic/ttk.decls, generic/tkTheme.c, generic/layout.c: Rename typedef Ttk_Element to Ttk_ElementImpl; Ttk_Element reserved for something more useful in future. * generic/ttkDecls.h: Regenerated. 2006-12-09 Joe English * generic/button.c, generic/image.c, generic/label.c, doc/image.n, generic/notebook.c, generic/widget.h, generic/tkTheme.h, generic/treeview.c: Merged duplicate functionality between image element factory, image element, and -image option processing. Image element factory now takes an imageSpec instead of a separate image name and -map option. * tests/image.test(image-1.1): Can catch this error earlier now. 2006-11-28 Joe English * library/fonts.tcl: Clean up temporary variables. 2006-11-26 Joe English * generic/layout.c, generic/tkTheme.h: Dead code removal; Ttk_LayoutNodeSetParcel unused (use Ttk_PlaceLayoutNode instead). 2006-11-26 Joe English * generic/widget.c: BUGFIX: Ensure that widget cleanup hook gets called in the error path [#1603506]. * generic/widget.c: Check for errors in UpdateLayout(). Minor cleanup. * generic/paned.c(PanedGetLayout): don't need to call Ttk_ManagerSizeChanged(). 2006-11-26 Joe English * doc/*.[3n]: Re-sync with core copy. Apparently somebody's manpage scraper doesn't like \\fP. 2006-11-26 Joe English * Makefile.in, generic/Makefile.in, win/makefile.vc: Don't build stepTheme.o. 2006-11-26 Joe English * library/utils.tcl, library/tile.tcl, library/button.tcl, library/combobox.tcl, library/notebook.tcl: Trying to remove internal dependency on 'keynav' package (still needed by ttk::dialog). 2006-11-24 Joe English * generic/treeview.c, doc/treeview.n: -displaycolumns {} now means "no columns" instead of "all columns". Use -displaycolumns #all for "all columns" [Fixes #1547622]. 2006-11-24 Joe English * library/*.tcl: Renamed ttk::CopyBindings => ttk::copyBindings; this ought to be public. 2006-11-24 Joe English * generic/treeview.c(TreeviewGetLayout): BUGFIX: didn't properly handle Ttk_CreateLayout() failure. KNOWNBUG: there's still a memory leak in the error path. * generic/paned.c(PanedGetLayout): BUGFIX: Same thing. * tests/tile.test: Added series 15-*. Discovered new KNOWNBUG, see test tile-3.3. 2006-11-22 Joe English * library/tile.tcl(ttk::do'deprecated): Dispatch in uplevel 1 scope (deprecated [style theme settings $theme { ... script... }] needs this). 2006-11-22 Joe English * library/classicTheme.tcl: Don't define or use TkClassicDefaultFont. 2006-11-22 Joe English * library/altTheme.tcl, library/clamTheme.tcl, library/defaults.tcl, library/winTheme.tcl, library/xpTheme.tcl: BUGFIX: need to explicitly specify '-anchor w' on TMenubutton style to get left-justified text if the widget has explicitly specified -width [See also: #1263470]. 2006-11-20 Jeff Hobbs * library/classicTheme.tcl: add catches to items that prevent tile * library/defaults.tcl: from being package required into 8.5a6. 2006-11-19 Joe English * win/xpTheme.c: Added PAD_MARGINS ElementInfo flag to specify if padding is inside or outside the element [#1596020, patch from Tim Baker]. * win/xpTheme.c: Add support for alternate/indeterminate checkbutton state (CBS_MIXED* flags). * win/xpTheme.c: Remove unused uxtheme stub procedures. 2006-11-19 Joe English * win/monitor.c: (core merge): Fixed Windows build. 2006-11-19 Joe English * tests/entry.test(entry-3.2): Insert "0"s instead of "M"s; entry widget uses the width of a "0" to calculate widget size (fixes platform-specific sporadic failures). * tests/entry.test(entry-2.2): Use [update] instead of [update idletasks]. 2006-11-18 Joe English * generic/tkTheme.h, generic/tile.c: Remove TILE_PATCHLEVEL, it's been unused for a long time. 2006-11-14 Joe English * generic/altTheme.c: Fix off-by-one bug in tree indicator size computation [#1596021, patch from Tim Baker]. Increased default size from 7 to 9 pixels. 2006-11-11 Joe English * generic/scroll.c: *correct* fix for #1588251 -- not safe to access h after reentering the interpreter. 2006-11-11 Joe English * tests/tile.test(tile-6.9): Explicitly specify "-font {}", XRDB settings under CDE were causing test to fail [see #1583038] 2006-11-11 Joe English * generic/scroll.c: Reworked cleanup procedure -- "self-cancelling" idle call is not robust, call Tcl_CancelIdleCall() in TtkFreeScrollHandle instead. [fixes #1588251] 2006-11-11 Joe English * {generic,win,macosx}/*.c: Big Renaming (patch from DAS); all globals now have "ttk" prefix, to match core conventions. 2006-11-11 Joe English * generic/altTheme.c: More core synchronization. 2006-11-06 Joe English * generic/altTheme.c, generic/entry.c, generic/tkTheme.c, generic/treeview.c: Add missing 'static' declarations. 2006-11-06 Joe English * library/tile.tcl: [style] --> [ttk::style] - missed a spot. 2006-11-05 Joe English * library/icons.tcl, library/dialog.tcl: Image management utilities tile::defineImage and tile::stockIcon moved into ttk::* namepace. * library/tile.tcl: Old versions available as deprecated aliases. 2006-11-05 Joe English * generic/tkTheme.c, library/tile.tcl: Renamed [style] to [ttk::style], to match 8.5a6. [style] is available as deprecated alias. * library/altTheme.tcl, library/clamTheme.tcl, library/classicTheme.tcl, library/defaults.tcl, library/stepTheme.tcl, library/treeview.tcl, library/winTheme.tcl, library/xpTheme.tcl: Quick patch to account for the above. 2006-11-05 Joe English * generic/tkTheme.c, library/tile.tcl: * generic/altTheme.c, generic/classicTheme.c, macosx/aquaTheme.c, win/winTheme.c, win/xpTheme.c, library/altTheme.tcl, library/aquaTheme.tcl, library/clamTheme.tcl, library/classicTheme.tcl, library/defaults.tcl: Theme selection and control utilities moved from tile::* namespace into ttk::*, to match Tk 8.5a6. 2006-11-05 Joe English * library/utils.tcl: Removed tile::LoadImages -- obsolete, not to be used. 2006-11-05 Joe English * generic/widget.h(WIDGET_TAKES_FOCUS): * library/utils.tcl: widget utility routines moved from 'tile' to 'ttk' namespace. * library/*.tcl: Updated to account for this. === BEGIN BACKPORTING CHANGES MADE FOR CORE INTEGRATION === 2006-11-02 Joe English * doc/paned.n, generic/paned.c, library/paned.tcl, tests/paned.test: Renamed [ttk::paned] to [ttk::panedwindow]. * library/tile.tcl: swap forward-compatibility alias with deprecated backward-compatibility alias. 2006-11-02 Joe English * library/tile.tcl: Remove old widget constructor aliases "tile::$widgetclass". Remove even older aliases ::t$widgetclass. * library/notebook.tcl: Remove deprecated synonyms tile::notebook::enableTraversal and tile::enableNotebookTraversal. (Use ttk::notebook::enableTraversal instead). * generic/tkTheme.c: Remove pre-0.7 compatibility method [style default] (use [style configure]) 2006-11-02 Joe English * configure.in, generic/Makefile.in, generic/configure.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.8.0. * configure, generic/configure: regenerated. === CORE MERGE COMPLETED 2006-10-30 === === TILE 0.7.8 TAGGED FOR RELEASE 2006-10-05 === 2006-10-05 Pat Thoyts * generic/square.c: More comments and make it work more like the Tk square widget (fixed up the -anchor option). === CORE MERGE BASE TAGGED 2006-30-03 === 2006-10-03 Joe English * configure.in generic/configure.in generic/Makefile.in generic/tkTheme.h win/makefile.vc win/tile.rc: Bumped version number to 0.7.8. * configure, generic/configure: Regenerated. 2006-10-03 Joe English * library/tile.tcl: Add 'ttk::panedwindow' as an alias for 'ttk::paned', for forward-compatibility (widget to be renamed in 0.8.0). 2006-10-03 Joe English * generic/entry.c: Remove dead code. 2006-10-03 Joe English * generic/treeview.c, library/treeview.tcl, doc/treeview.n: Added -selectmode option. 2006-09-30 Joe English * win/winTheme.c, library/winTheme.tcl, library/xpTheme.tcl: Added FilledFocus element, fixes appearance of readonly comboboxes [#1567923]. Also hide selection if combobox does not have focus. 2006-09-26 Joe English * generic/scrollbar.c(ScrollbarFractionCommand): Avoid division by zero and negative return values when scrollbar is too small. 2006-09-21 Joe English * generic/treeview.c, doc/treeview.n: Added item tags. * generic/tagset.c: New file. * Makefile.in, generic/Makefile.in, win/makefile.vc, generic/widget.h: Updated. 2006-09-20 Joe English * generic/image.c: BUGFIX: missing NULL terminator in Tcl_AppendResult 2006-09-20 Joe English * doc/style.n, doc/widget.n: Minor documentation updates: describe [style map], 'readonly' state. 2006-09-20 Joe English * generic/notebook.c: Replace WidgetIdentifyCommand (which only looks at the base layout) with new NotebookIdentifyCommand() (which examines tabs). 2006-09-13 Joe English * library/dialog.tcl: BUGFIX: ttk::dialog -parent option didn't work [#1551500]. (Never fully tested fix for #1283014). * tests/misc.test: simple test case for the above (force code coverage). 2006-09-12 Joe English * generic/layout.c(Ttk_NewBoxObj): Revised implementation that doesn't incrementally grow the list (suggestion from Andreas Kupries). * generic/scrollbar.c(ScrollbarGetCommand): Similar change. 2006-08-27 Joe English * scroll.c(UpdateScrollbar): BUGFIX: Missing Tcl_Preserve/Tcl_Release on h->corePtr (caught by valgrind/entry-5.1) 2006-08-26 Joe English * treeview.c, layout.c ttk.decls: Moved Ttk_NewBoxObj(), made public. * ttkDecls.h, ttkStubInit.c: Regenerated. * entry.c(EntryBBoxCommand): Use Ttk_NewBoxObj() 2006-08-25 Joe English * library/sizegrip.tcl: Don't need TSizegrip layout definition, it's built-in. 2006-08-24 Joe English * doc/sizegrip.n: Attempted to clarify BUGS section -- negative x or y coordinates aren't the problem, it's West or South gravity that's the problem. 2006-08-23 Joe English * generic/altTheme.c: Revert previous change -- it crashes on OSX (probably due to buggy Xlib emulation layer on that platform). 2006-08-21 Joe English * generic/altTheme.c(IndicatorElementDraw): Use XCreateImage() instead of XGetImage() (small performance boost). 2006-08-21 Joe English * library/default.tcl: Don't use "active" feedback for notebook tabs, only "selected" [#1353612] 2006-08-21 Joe English * generic/notebook.c: Notebook layout algorithm can now (almost) handle -tabposition [swe]* as well as n* [#1470246]. 2006-08-21 Joe English * library/treeview.tcl: Changed Shift-click selection behavior to match common conventions [#1389202]. Also added preliminary support for future '-selectmode' option. 2006-08-20 Joe English * library/button.tcl, library/menubutton.tcl: Buttons et. al: Don't set 'active' state if widget is disabled. This is the right thing more often than not. 2006-08-20 Joe English * library/icons.tcl: Add (semipublic) tile::defineImage procedure. 2006-08-19 Joe English * generic/notebook.c: BIG BUGFIX: Most callers of GetTabIndex() neglected to check for "not found" condition, leading to all sorts of fun and exciting ways to crash the notebook widget. 2006-08-19 Joe English * library/dialog.tcl: Add support for "no icon" [#1542785]. Make WM_DELETE_WINDOW invoke cancel button as documented. * doc/dialog.n: Updated. 2006-08-18 Joe English * generic/treeview.c(TreeviewInitialize): Properly initialize root item [Fixes #1541739 "crash in treeview widget 'see' method'] 2006-08-16 Joe English * library/tile.tcl: BUGFIX: don't sort list of [source] commands alphabetically, there are dependencies between them [#1541094]. 2006-08-04 Joe English * library/sizegrip.tcl, doc/sizegrip.n (new files): * generic/tile.c, generic/separator.c, generic/tkElements.c, library/tile.tcl: Added ttk::sizegrip widget. * demos/demo.tcl: Updated to include a statusbar and sizegrip. 2006-08-05 Pat Thoyts * generic/button.c: Add identify command to all widgets. * generic/frame.c: This makes it possible to use any widget * generic/notebook.c: as a basis for constructing modified * generic/progress.c: layouts and making them active. * generic/separator.c: * generic/square.c: 2006-08-04 Joe English * doc/style.n: Shamefully admit that this manpage is woefully incomplete, and add a pointer to some documentation that might actually be useful. 2006-08-04 Pat Thoyts * demos/themes/blue.tcl: Added new elements (tabs,sash,sizegrip) * demos/themes/blue/*.gif: and fixed the progressbar element name. 2006-08-04 Joe English * doc/widget.n: Moved description of '-xscrollcommand' and '-yscrollcommand' into their own section; these are not "supported by all Tile widgets" as the manpage claimed. * doc/*.n: Use "ttk::" namespace prefix in the NAME section of all widget manpages. 2006-07-30 Pat Thoyts * win/makefile.vc: Build the stubs lib. * win/tile.rc: Windows version resource. 2006-07-29 Joe English * macosx/aquaTheme.c: Added sizegrip element. 2006-07-22 Joe English * win/winTheme.c: Added sizegrip element. * library/cursors.tcl: Switch on platform; added 'seresize' cursor, settings for Windows. 2006-07-09 Joe English * generic/tkTheme.c: Change precedence order for element options: widget options now take precedence over [style map ...] settings [See #1517110]. * library/aquaTheme.c: Removed 'style map . -underline {{} -1}' hack, since it doesn't work anymore. 2006-07-04 Joe English * library/menubutton.tcl(TransferGrab): Use [tk_popup] instead of explicit [grab -global] call [Fixes #1486417] 2006-07-04 Joe English * library/utils.tcl: Check [winfo viewable $w] in tile::takefocus, since tk_focusNext/tk::FocusOK require this behavior [Fixes #1516479]. Merged [tile::wantsFocus] and [tile::takesFocus], since there's no easy way to distinguish these two conditions any more (see also 2006-04-07 ChangeLog entry). * library/notebook.tcl: Adjust for the above changes. 2006-05-30 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.7.7. === TILE 0.7.6 TAGGED FOR RELEASE 2006-05-06 === 2006-05-06 Joe English * generic/notebook.c(SelectTab): Check TabState(nb,index) instead of tab->state to determine if tab is disabled -- tabs can also be disabled by setting notebook state disabled [fixes #1476923] 2006-04-22 Joe English * generic/notebook.c: Add partial support for -tabposition style option (Incomplete: only 'nw', 'n', and 'ne' really work properly, but that's all we need for:) * library/aquaTheme.tcl: (finally) put notebook tabs in the right place. Someday we'll get Panther-style segmented controls working too... * generic/frame.c, generic/widget.h: Made TtkGetLabeAnchorFromObj semi-public. 2006-04-22 Joe English * generic/configure.in: Add --disable-private-headers autoconf switch. Sometimes you have to have these, sometimes you can't use them. Hard to guess which condition obtains, so punt to the packager. * generic/configure: Regenerated. 2006-04-20 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.7.6. * configure, generic/configure: regenerated. 2006-04-17 Joe English * generic/entry.c: Added [$entry identify] method; useful for [ttk::entry]-based megawidgets. 2006-04-16 Joe English * generic/frame.c, generic/label.c: Labelframe flexibility enhancements: Additional values for -labelanchor ("nwe", "wns", etc) allow label parcel to stretch across parcel; -labelinset and -labelspace style options replaced with -labelmargins. * * * POTENTIAL INCOMPATIBILITY * * * for third-party themes and custom styles. -labelanchor wn, ws, en, and es label placement different now. * library/aquaTheme.tcl, library/clamTheme.tcl: adjusted to account for above changes. 2006-04-16 Joe English * generic/tkTheme.h, generic/layout.c, generic/ttk.decls: Ttk_AnchorBox() takes a Tk_Anchor, not an int. * generic/ttkDecls.h: Regenerated. * generic/tkTheme.h, generic/layout.c: Added typedef Ttk_PositionSpec, Ttk_PositionBox(). 2006-04-16 Joe English * generic/notebook.c: More flexible tab arrangement, part 1: Added TNotebook -tabmargins style option, moved TNotebook -expandtab option to Tab -expand option. This mostly helps with pixmap themes: can now expand tabs into the margins, or overlap with adjacent tabs / client area. * library/altTheme.tcl, library/winTheme.tcl, library/xpTheme.tcl: Updated to account for above change. * * * POTENTIAL INCOMPATIBILITY * * * Third-party themes should change: style configure TNotebook -expandtab {l t r b} to: style configure TNotebook -tabmargins {l t r 0} style map TNotebook.Tab -expand [list selected {l t r b}] 2006-04-07 Joe English * library/utils.tcl: Split [tile::takesFocus] into two parts, [tile::wantsFocus] and [tile::takesFocus]. The former decides if the widget wants to take keyboard focus, the latter decides if it can. Changed tile::takefocus to return "wants to take focus" instead of "can take focus". * library/notebook.tcl(ActivateTab): Set focus to the first navigable descendant of the activated tab (tk_focusNext sometimes picks the wrong widget). * demos/demo.tcl: Make scales pane a direct child of $nb, so navigation works again. * doc/notebook.n: Added note that [ttk::notebook::enableTraversal] only works properly if all panes are direct children of the notebook. 2006-04-07 Joe English * generic/frame.c(FrameConfigure): Only issue size requests if -width, -height, or one of the other geometry-related options has been changed in the current 'configure' call [Fixes #1446608]. 2006-04-07 Joe English * library/notebook.tcl(ttk::notebook::enableTraversal): Handle traversal and mnemonic activation when there are multiple notebooks in a toplevel, nested notebooks, and when traversal-enabled notebooks are destroyed. [Fixes #1368921] * * * BEHAVIORAL CHANGE * * * Control-Tab and Shift-Control-Tab now only cycle the notebook if the focus is inside the notebook. (Previously they worked when the focus was anywhere inside the toplevel). This is a change from how Tile used to work, but it's consistent with other toolkits. 2006-04-07 Joe English * library/keynav.tcl: BUGFIX: didn't account for condition where the current default button was destroyed. 2006-04-04 Joe English * generic/altTheme.c, library/altTheme.tcl, win/winTheme.c, library/winTheme.tcl: "alt" and "winnative" themes: use rectangular sliders in ttk::scale widget instead of pointy ones. 2006-04-02 Joe English * generic/scroll.c, generic/widget.h: Added ScrollTo() function, clarified scrollbar choreography. * generic/treeview.c: Use ScrollTo(). * generic/entry.c: Updated to use general-purpose scrolling interface. * generic/entry.c: More cleanups: 'avgWidth' field no longer needed. Inlined EntryPlaceTextLayout(). * generic/entry.c: rightIndex (=xscroll.last) points one past last fully-visible character, not one past last partially-visible character. * tests/entry.test, library/entry.tcl(ttk::entry::See): Added [update idletasks] calls, which are now needed in a few more places. * * * POTENTIAL INCOMPATIBILITY * * * 2006-04-01 Joe English * generic/tkTheme.c: Store layout templates in Ttk_Style table, don't use separate layoutTable. Store pointer to Style name in Ttk_Style record. * generic/tkTheme.c: Misc. cleanups. * generic/layout.c, generic/tkTheme.h, generic/notebook.c, generic/paned.c, generic/treeview.c: Ttk_CreateSublayout prefixes sublayout name with the parent style name. [Fixes #1168548 "Custom styles for complex widgets"] 2006-03-22 Joe English * generic/manager.c, generic/manager.h: Keep slave mapped state in sync with the master mapped state, as per convention with other Tk geometry managers. * As a side effect, fixes #1455488, probably helps with #1292219 and #1277227 as well. * tests/notebook.test: Added extra [update] calls where needed, since notebook tabs don't get mapped immediately anymore. *** (MINOR) POTENTIAL INCOMPATIBILITY *** 2006-03-22 Joe English * doc/treeview.n: Updated description of [$tv set] et al., to try to make it more clear that they take a list of items. 2006-03-15 Joe English * library/icons.tcl: Added dialog/auth and dialog/busy stock icons (taken from BWidget passwd.gif and hourglass.gif) Create images immediately instead of deferring creation; this only takes a few milliseconds. Use fixed image names for better introspectibility (also: eventually want to allow applications to redefine stock icons) 2006-03-13 Joe English * library/treeview.tcl: BUGFIX(BrowseTo): [$tv selection set] takes a list of items, not a single item. [#1448421] 2006-03-11 Joe English * generic/treeview.c, doc/treeview.n: Added treeview 'bbox' method [#1443306] 2006-02-21 Joe English * library/altTheme.tcl, library/classicTheme.tcl, library/defaults.tcl: Fix combobox padding so selection doesn't overlap outer border. 2006-02-20 Joe English * library/utils.tcl(tile::takesFocus): BUGFIX: correctly handle -takefocus "". 2006-02-15 Joe English * generic/notebook.c, doc/notebook.n: (finally) added zero-argument form of [$nb select], return the widget pathname of currently-selected pane. 2006-02-09 Joe English * generic/altTheme.c: Tweaked one-pixel glitch in radiobutton indicators. 2006-02-05 Joe English * library/winTheme.tcl, library/xpTheme.tcl: Use symbolic font TkDefaultFont instead of hardcoding Tahoma/MS Sans Serif 8. * library/fonts.tcl: clarified comments: TIP#145-defined fonts aren't exactly the same as the ones Tile uses. 2006-02-05 Joe English * win/winTheme.c: remove dead code. * win/xpTheme.c: Add sizegrip element (not yet used) 2006-01-30 Joe English * win/winTheme.c(BorderElement): Handle -relief solid by passing BF_FLAT flag to DrawEdge(). * win/winTheme.c(ThumbElement): Remove -relief option, scrollbar thumbs on windows are always raised. 2006-01-30 Joe English * generic/progress.c: Add some unnecessary casts to make MSVC shut up. 2006-01-30 Joe English * generic/treeview.c, library/treeview.tcl, doc/treeview.n: Initial implementation of new syntax for [$tv identify] command -- [$tv identify row $x $y], [$tv identify column $x $y]. 2006-01-29 Joe English * library/utils.tcl(SaveGrab): Properly account for multiple displays. Attempt to properly account for multiple interps. (#1411983). 2006-01-29 Joe English * generic/tkTheme.c, doc/style.n: Add [style lookup] introspection command (#1406215). 2006-01-26 Joe English * library/winTheme.tcl, library/xpTheme.tcl: Hide the selection when entry widgets lose focus; it scares the horses. 2006-01-26 Joe English * generic/configure.in, generic/Makefile.in, generic/configure: TEA update. 2006-01-25 Jeff Hobbs * configure, configure.in: update to TEA 3.5 * tclconfig/tcl.m4: TEA rcs 1.89 2006/01/25 21:25:02 2006-01-25 Joe English * generic/notebook.c: Make sure $tab gets unmapped after [$nb tab $tab -state hidden], even if there are no other available tabs to select. (No test case yet). 2006-01-24 Michael Kirkham * generic/notebook.c: Restored SelectNearestTab() method of adjusting to removed/hidden tabs, adapted to the post-1.64 slave framework. (Deleting the last/current tab wasn't the only scenario that was causing the first tab to be selected when it shouldn't.) * tests/notebook.test: Added 9 more tests for exercising the above. 2006-01-24 Michael Kirkham * tests/all.tcl: Check for Tk package being present before attempting to destroy the main window. Otherwise running all tests via tclsh instead of wish results in an error at the end. 2006-01-24 Michael Kirkham * generic/notebook.c: When the last tab is the current tab and that tab is deleted, make the new last tab the new current tab, instead of the first tab. 2006-01-22 Joe English * generic/button.c: ttk::label options -relief, -anchor, -justify and -wraplength now have NULL defaults, so that custom TLabel styles work properly. 2006-01-22 Joe English * tclconfig/tcl.m4: Put provenance information back in (tclconfig/tcl.m4 r1.85), take "-Wno-implicit-int" out of CFLAGS_WARNING. Again. 2006-01-22 Jeff Hobbs * tclconfig/tcl.m4, configure: update to TEA 3.4 interim 2006-01-20 Joe English * library/tile.tcl, library/utils.tcl (new file): Split tile.tcl up into two files. 'tile.tcl' contains package initialization code some theme-selection logic, 'utils.tcl' contains library routines used in widget implementations. 2006-01-16 Joe English * library/progress.tcl: Oops. Remove deprecated aliases tile::progressbar::start, tile::progressbar::stop introduced in the last commit, these weren't part of the public API in the first place. 2006-01-16 Joe English * library/*.tcl: Namespace cleanup: move all widget binding support routines from tile::$widgetClass namespace to ttk::$widgetClass. 2006-01-16 Joe English * generic/entry.c, library/entry.tcl: Removed compatibility features [$e scan], and the 'anchor' internal tag and related operations [$e selection from], [$e selection to], and [$e selection adjust]. These aren't used by the widget bindings, and were only added to accomodate megawidget packages that try to use core Entry bindings on ttk::entry widgets. 2006-01-14 Joe English * library/entry.tcl: Take focus on ButtonPress in readonly state [Fixes #1400839] 2005-12-31 Joe English * generic/progress.c: Fix layout so progress bar expands to the full trough thickness (#1357605). 2005-12-12 Joe English * tclconfig/tcl.m4: Sync with TEA tcl.m4 r1.81. * configure, generic/configure: Regenerated. 2005-12-12 Joe English * generic/tkElements.c: Default menubutton layout now sets text flush-left [#1263470]. (NB: classic and XP themes still unchanged.) 2005-12-12 Joe English * generic/label.c: Move -anchor option from LabelElement to TextElement. (LabelElement uses text.anchor for compound layout arrangement). * generic/treeview.c: Add heading -anchor option [#1346328] 2005-12-07 Joe English * generic/notebook.c, doc/notebook.n, tests/notebook.test: Added [$nb insert] command [Patch#1374514]. 2005-12-07 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.7.5, to account for recent ActiveTcl 8.4.12 release. Skipping tile 0.7.4. * configure, generic/configure: regenerated. === TILE 0.7.4 RELEASE SKIPPED. THERE IS NO TILE 0.7.4. === 2005-12-06 Joe English * generic/frame.c: Make sure that sibling -labelwidgets are raised above the labelframe [Fixes #1374778] 2005-12-06 Joe English * generic/notebook.c: BUGFIX: Fix TabRemoved() logic to account for the case where NextTab() is the current tab [Fixes #1370833 "notebook forget tab -> core dump" === ACTIVETCL 8.4.12 RELEASED somewhere around here === 2005-12-02 Jeff Hobbs * tclconfig/tcl.m4, configure.in, configure: update to TEA 3.4 * win/monitor.c (CreateThemeMonitorWindow, WndProc): use Get|SetWindowLongPtr to support 64-bit Windows. 2005-11-28 Jeff Hobbs * demos/demo.tcl: add package require Tk 2005-11-20 Joe English * generic/tkElements.c: Default layout for radiobuttons and checkbuttons no longer includes a border. * library/defaults.tcl, library/altTheme.tcl, library/winTheme.tcl, library/xpTheme.tcl, library/clamTheme.tcl, library/stepTheme.tcl, demos/themes/blue.tcl: Increase -padding to compensate. (Aqua and Classic themes use nondefault check/radiobutton layouts). 2005-11-20 Joe English * macosx/aquaTheme.c: Fix compiler warnings (0 instead of NULL userData arguments). Minor refactoring of ThemeButtonParms usage. 2005-11-14 Joe English * tclconfig/tcl.m4: Updated to TEA tcl.m4 r1.75. [#1307513] * configure, generic/configure: Regenerated. 2005-11-14 Joe English * generic/frame.c: Refactoring: use Ttk_Manager API to manage labelWidget. 2005-11-14 Joe English * generic/manager.c(ManagerIdleProc): BUGFIX: Only skip call to RecomputeLayout() if RecomputeSize() has rescheduled another call to ManagerIdleProc(). 2005-11-14 Joe English * tclconfig/kde-qt.m4: Moved to tile-themes/tile-qt repository. 2005-11-14 Joe English * library/combobox.tcl: Workaround for spurious events on OSX in Tk 8.5 [#1349811]. 2005-11-12 Joe English * generic/treeview.c: Improved initial geometry management: [$tv column -width ...] affects widget request size iff widget is currently unmapped. 2005-11-11 Joe English * generic/scale.c: (duplicate code removal): Replace ScaleIdentifyCommand with WidgetIdentifyCommand. * generic/scale.c: Handle case where -from is greater than -to [fixes #1353436 part 2] * demos/demo.tcl(scales.pane): use -from 100 -to 0 instead of inverting range in command callback (test case for previous fix) 2005-11-10 Joe English * generic/manager.c, generic/manager.h, generic/frame.c: Namespace cleanup: Maintainable => Ttk_Maintainable. Dead code removal: removed unused procedure 'Manageable'. 2005-11-10 Joe English * library/scale.tcl(Press): Recognize button press in "*track" element as well as "*trough" (scale widgets can be put together either way, depending on the theme). [#1338254, patch from Victor Bonilla]. 2005-11-10 Joe English Compatibility option purge: * generic/compat.h, tools/optiondiff.tcl: Removed. * generic/button.c, generic/entry.c, generic/frame.c, generic/scrollbar.c: Removed all compatibility options. * generic/tkTheme.h: Removed TK_OPTION_COMPAT ... * generic/tkTheme.c(TTKGetOptionSpec): ... and processing of same. * configure.in, generic/configure.in: Remove autoconf goo for enabling compatibility options. 2005-11-02 Joe English * library/dialog.tcl, doc/dialog.n: Add '-parent' option, allow user to explicitly specify transient parent. If set to the empty string, dialog isn't transient [fixes #1283014] 2005-11-01 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.7.3 * configure, generic/configure: regenerated. 2005-10-27 Joe English * generic/scale.c(ScaleCleanup): BUGFIX: forgot to free variable trace when widget is destroyed [#1338148] === TILE 0.7.2 TAGGED FOR RELEASE === 2005-10-19 Joe English * generic/paned.c(PanedGeometryRequestProc): Only update pane request size if slave is currently unmapped, in order to avoid unexpected pane resizes (esp. while the user is dragging a sash [#1325286]). Also fixed an off-by-one bug in size computations (nSashes vs. nPanes). 2005-10-14 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h: Bumped version number to 0.7.2, will make a new Tile release to match CVS snapshot included with ActiveTcl 8.4.11.2. * configure, generic/configure: regenerated. 2005-10-08 Joe English * win/xpTheme.c: add some horizontal padding in treeview headers [#1208194] 2005-10-08 Joe English * generic/*.c: Don't Panic. generic/blink.c: bug already found and fixed. generic/label.c: program invariants, unreachable by inspection. generic/manager.c, generic/widget.c: these were just landmines. Left one call to Tcl_Panic() in, in tkTheme.c; this is also a landmine, but it's in a place that developers will hit before end users do. 2005-10-08 Joe English * demos/themes/blue.tcl: fix 'pressed' feedback for vertical scales (thanks to Victor Bonilla for catching this). 2005-10-08 Joe English * library/notebook.tcl, doc/notebook.n: Documentation clarification and namespace fix: use "ttk::notebook::enableTraversal". Earlier names registered as deprecated aliases. Changed notebook library procedure namespace to "ttk::notebook" while at it. 2005-10-08 Joe English * generic/widget.h, generic/*.c: API cleanup: WidgetChanged(...) renamed to TtkRedisplayWidget / TtkResizeWidget. 2005-10-07 Joe English * generic/scale.c: Removed support for '-showvalue true' (possibly to be be restored later). Removed now-unused -font and -foreground options. Moved slider placement logic out of Draw() hook into DoLayout() hook. 2005-10-07 Joe English * macosx/aquaTheme.c: Use round slider (kThemeThumbPlain) for ttk::scale widget instead of pointy one. 2005-10-07 Joe English * generic/scale.c: Remove -width widget option. * generic/altTheme.c, generic/tkElements.c: Rename -width element option to "-sliderthickness". * generic/scale.c: Accidentally prematurely committed partial fix for #1252656. Oops. 2005-10-04 Jeff Hobbs * configure: regen * tclconfig/tcl.m4 (TEA_PRIVATE_TCL_HEADERS): add / to finish sed macro 2005-10-02 Joe English * doc/frame.n, doc/labelframe.n: Added missing manpages. * generic/frame.c: Removed ttk::labelframe -font option; removed redundant -relief and -borderwidth option definitions (defaults inherited from ttk::frame are OK). 2005-09-30 Jeff Hobbs * generic/configure.in, generic/configure: * configure.in, configure: TEA 3.3 uses win32 for Windows in TEA_WINDOWINGSYSTEM. 2005-09-29 Joe English * generic/scale.c, generic/tile.c, generic/tkElements.c, generic/clamTheme.c, generic/stepTheme.c, macosx/aquaTheme.c, win/xpTheme.c, library/tile.tcl, library/altTheme.tcl, library/clamTheme.tcl, library/classicTheme.tcl, library/defaults.tcl, library/stepTheme.tcl: Removed old [ttk::progress] widget. 2005-09-28 Joe English * library/combobox.tcl: Restored [update] call in LBTab procedure (taken out 2005-07-23); this is needed after all (see #1090277). 2005-09-23 Joe English * generic/entry.c, doc/entry.n: Changed 'invalid' state handling logic: prevalidation never changes 'invalid' state bit, and rejects edits if -validatecommand returns false even when invalid state is set. See #1302146 and tktable-tile-dev discussion for more details. 2005-09-20 Joe English * tclconfig/tcl.m4: Update to TEA 3.3 (tclconfig/tcl.m4 r1.72) * configure.in, generic/configure.in: Bump TEA_VERSION. * configure, generic/configure: Regenerated. 2005-09-15 Joe English * configure.in, Makefile.in, generic/configure.in, generic/Makefile.in, win/makefile.vc, generic/tkTheme.h, generic/pkgIndex.tcl.in: Bumped version number to 0.7.1. Removed distinction between VERSION and PATCHLEVEL, use major.minor.patchlevel everywhere. * configure, generic/configure: Regenerated. 2005-09-13 Joe English * generic/tkTheme.c, doc/style.n, library/*.tcl, tests/*.tcl: Replaced [style default] command with the more sensibly-named [style configure]. [style default] is temporarily retained as a synonym so third-party code has a chance to upgrade. 2005-09-13 Joe English * generic/compat.h, tools/optiondiff.tcl: Use -DENABLE_COMPAT to turn compatibility options on, instead of -DNO_COMPAT to turn them off. * configure.in, generic/configure.in: "--disable-compat" is now the default. * configure, generic/configure: Regenerated. 2005-09-12 Joe English * generic/button.c(CheckbuttonInitialize): BUGFIX: previous change introduced refcount leak. 2005-09-11 Joe English * generic/widget.c(WidgetConstructorObjCommand): Call initializeProc() before first call to Tk_SetOptions() instead of after; this way initializeProc can set default option values. * generic/button.c: ttk::checkbutton -variable defaults to the name of the widget. ttk::radiobutton -variable defaults to "::selectedButton" [#1257319] 2005-09-11 Joe English * trace.c, widget.h, button.c, entry.c, progress.c: Reworked Ttk_TraceVariable() interface. Trace callbacks may not reenter the interpreter, and cannot signal errors. ClientData does not need to be a WidgetCore *; trace callbacks are responsible for checking WidgetDestroyed() themselves. 2005-09-10 Joe English * win/monitor.c: Remove debugging output. 2005-09-07 Joe English * generic/paned.c, generic/progress.c: Add missing 'static' declarations for internal functions. 2005-09-04 Joe English * generic/notebook.c, doc/notebook.n: Add "-padding" tab option, extra internal padding [#1203759] * demos/demo.tcl: Use the new feature. Can eliminate a few intermediate frames. * generic/tile.c(EnumerateOptions): Handle chained Tk_OptionSpec arrays. * generic/layout.c(Ttk_PadBox): Ensure box width and height >= 1. 2005-09-04 Joe English * generic/clamTheme.c: Fixed menubutton indicator. 2005-08-30 Joe English * doc/checkbutton.n, doc/radiobutton.n: Fix markup errors, added "WIDGET STATES" section. 2005-08-22 Jeff Hobbs * generic/notebook.c: removed use of // commenting * generic/stepTheme.c: older C compilers dislike it * generic/treeview.c (ConfigureHeading, ConfigureColumn): * generic/manager.c (Ttk_ConfigureSlave): fix cast for mask 2005-08-19 Joe English * notebook.c, paned.c, manager.c, manager.h: ttk:notebook and ttk::paned widgets can now manage siblings of ancestors in addition to direct descendants like other GMs [Fixes: #1263510]. * demos/demo.tcl ("Scales" pane): Tweaked a bit to test the above change. 2005-08-19 Joe English * generic/manager.c: BUGFIX: DeleteManager() wasn't fully cleaning up slave records (DeleteSlave instead of Ttk_ForgetSlave). * generic/manager.c(Maintainable): Don't call Tk_RestackWindow() on sibling; this messes up keyboard traversal order. Applications must manage stacking order instead. 2005-08-19 Joe English * generic/paned.c: Removed '#if !SHOVE_SASHES' conditional code. 2005-08-18 Joe English * generic/manager.h, generic/manager.c, generic/notebook.c, generic/paned.c: Ttk_Manager API rationalization phase 1: renamed public functions and data structures; partial opacification; added Ttk_PlaceSlave(). * generic/notebook.c, test/notebook.test: BUGFIX: NextTab() wasn't actually returning the index of the next tab. * generic/manager.h, generic/manager.c, generic/notebook.c, generic/paned.c: More refactoring: Changed signature of SlaveAdded() and SlaveRemoved() hooks. Tried to factor out SlaveConfigured / Ttk_ConfigureSlave, failed; these will have to stick around for a bit longer. 2005-08-17 Joe English * generic/widget.h, generic/widget.c, others: Remove WIDGET_SPEC_END sentinel enum. 2005-08-17 Joe English * generic/layout.c, generic/tkTheme.h, generic/notebook.c, generic/treeview.c(Ttk_RebindSublayout): Drop optionTable, tkwin arguments to Ttk_Rebind[Sub]Layout; these don't ever change. 2005-08-13 Joe English * generic/frame.c(Labelframe): made -relief and -borderwidth options NULL by default, as per recent discussion on tktable-tile-dev * library/altTheme.tcl, library/clamTheme.tcl, library/classicTheme.tcl, library/defaults.tcl, library/stepTheme.tcl, library/winTheme.tcl, demos/themes/blue.tcl: Specify TLabelframe -relief and -borderwidth options in theme definitions instead. 2005-08-11 Joe English * generic/notebook.c(NotebookDoLayout): BUGFIX: Revert earlier change to tabrowBox computation, original version was correct. 2005-08-11 Joe English * generic/entry.c, doc/entry.n, tests/validate.test: Entry widgets now set/clear the 'invalid' state bit depending on the outcome of validation. 2005-07-31 Joe English * generic/frame.c, generic/notebook.c: Consolidated Labelframe and Notebook theme parameter extraction. 2005-07-31 Joe English * generic/notebook.c: (refactoring) Use manager.h interface for geometry management. Create a single tabLayout and reuse it for all tabs. Couple minor bugfixes. * generic/manager.c, generic/manager.h, generic/paned.c: Change signature of SlaveRemoved hook. * generic/frame.c, generic/manager.c: Moved Maintainable(), made public. 2005-07-29 Joe English * generic/widget.h: Declare WIDGET_SPEC_END enumerated value outside the scope of struct WidgetSpec, to account for C++ scope rules [#1247291, patch from Mats Bengtsson] 2005-07-29 Joe English * win/xpTheme.c: Failed to compile if -DHAVE_UXTHEME_H was not set [#1247278, patch from Mats Bengtsson] 2005-07-27 Jeff Hobbs * configure, tclconfig/tcl.m4: correct _r AIX compiler tweak, and check for X11 headers on Aqua as well. * library/combobox.tcl (tile::combobox::Post): minor size adjustments for dropdown geometry to fit right under entry. 2005-07-26 Jeff Hobbs * library/combobox.tcl (tile::combobox::PopdownShell): use Tk scrollbar under aqua until Ttk one is "native" 2005-07-23 Joe English * library/combobox.tcl, library/tile.tcl: Redo grab handling code to be more robust in the face of unexpected conditions [#1239190] NOTE: comment from r1.17 "The [grab release] call in [Unpost] queues events that later re-set the focus" appears to be inoperative. Removed the [update] call. 2005-07-23 Joe English * library/entry.tcl: Initialize State(anchor); can occur without preceding if a [grab release] intervenes. * doc/dialog.n: Manpage updated to reflect implementation (-command invoked before dismissing the dialog, not after). 2005-07-20 Joe English * win/xpTheme.c: Support compilation under Windows 2000 (see #1235895) 2005-07-20 Joe English * library/dialog.tcl, library/icons.tcl, doc/dialog.n (new): added [ttk::dialog]. 2005-07-18 Joe English * library/scrollbar.tcl(Press): s/unit/units [#1240249] 2005-07-13 Joe English * generic/entry.c: Only fire -textvariable trace in [$e configure] if -textvariable was specified [#1236979] * doc/entry.n: Corrected and clarified some details about validation [#1236979] * tests/validate.test: Added test case. 2005-07-13 Joe English * generic/button.c, library/treeview.tcl: Remove default -borderwidth 2 for labels and treeview headings; use theme settings instead. 2005-07-13 Joe English * tools/genStubs.tcl, generic/ttkDecls.h: const-qualify stubs table. * generic/ttkStubLib.c: regenerated. 2005-06-30 Joe English * tclconfig/tcl.m4: Synced with sampleextension r1.69. * configure, generic/configure: Regenerated. [#1228492] 2005-06-26 Joe English * generic/clamTheme.c: Use default theme as parent, not "alt". * generic/treeview.c, generic/altTheme.c: Changed default treeview item indicators to rightwards/downwards pointing arrows; moved MSUE-style dinky boxed +/- sign indicators to "alt" theme. (NB: default indicator still not quite right, but it's an improvement.) 2005-06-26 Joe English * library/button.tcl(tile::button::activate) Call [$w invoke] directly instead of scheduling it in an [after idle] callback. See #1227911 for discussion. 2005-06-26 Joe English * generic/tkTheme.c: Implemented 3- and 4- argument forms of [style default] and [style map], as per docs. 2005-06-26 Joe English * generic/cache.c(Ttk_FreeResourceCache): BUGFIX: "free named colors" section was operating on the wrong hash table. 2005-06-25 Joe English * generic/treeview.c: (internal change) 'displayColumns' points to list of columns instead of column indices. Changed column resize behavior: last column expands to fill available space. This still isn't right but at least it's usable now. 2005-06-24 Joe English * generic/tkTheme.c: Implemented 2-argument form of [style layout $LayoutName] as per docs -- return layout spec. * generic/layout.c, generic/tkThemeInt.h: added Ttk_UnparseLayoutSpec, Ttk_NewStickyObj, for the above. 2005-06-19 Joe English * generic/treeview.c: MULTIPLE BUGFIXES: set, children, move commands - crash in [$tv set $item $column] where $item has empty -values list. - duplicate elements in [$tv children] caused infinite loop - moving an item after itself corrupted tree. New feature: [$tv set $item] returns a dictionary 2005-06-18 Joe English * library/classicTheme.tcl, library/altTheme.tcl: Fix progress bar colors. 2005-06-18 Joe English * generic/label.c: -width option specifies the requested width in characters of the text part of the label, regardless of the value of -compound [#1108822]. 2005-06-18 Joe English * generic/label.c, generic/layout.c, generic/tile.c, generic/tkTheme.h: Namespace police: renamed TK_COMPOUND_LAYOUT_* => TTK_COMPOUND_*. Misc. other cleanups in label.c. No functional changes. 2005-06-18 Joe English * library/button.tcl: Guard against spurious events; fixes #1223103, hopefully fixes #1222605. 2005-06-18 Joe English * library/combobox.tcl(Scroll): Avoid divide-by-zero error if -values list is empty [fixes #1223104]. * library/notebook.tcl(CycleTab): Set focus when selecting new tab with 2005-06-11 Pat Thoyts * demos/demo.tcl: Fixed the vertical progressbar so it works more sensibly 2005-06-09 Joe English * library/combobox.tcl: shouldn't post listbox; removed binding ([fixed #1211497]) 2005-06-09 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h: Bumped version number to 0.6.5 * configure, generic/configure: regenerated. === TILE 0.6.4 TAGGED FOR RELEASE === 2005-05-30 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h: Bumped version number to 0.6.4 for upcoming ActiveTcl release. * configure, generic/configure: regenerated. 2005-05-30 Joe English * library/combobox.tcl: If combobox value isn't in list, highlight first listbox entry [#1211322] * library/combobox.tcl: tile::combobox::Unpost can be called multiple times during a transaction (see #1208633); subsequent calls should do nothing. 2005-05-22 Joe English * library/treeview.tcl: Double-click on items with no special double-click behaviour should be the same as single-click binding, not a no-op (Fixes: #1186361). 2005-05-22 Joe English * generic/entry.c: Oops. 2005-03-22 change was sloppy; conflated "foreground" and "background". (Fixes #1206595) 2005-05-22 Joe English * generic/frame.c: Set internal padding from -borderwidth option only, don't query theme. (Fixes: #1204179; but see bug report this still isn't completely right.) 2005-05-12 Joe English * library/combobox.tcl, library/tile.tcl: Restore previous grab and focus windows when unposting combobox popdown [#1199993] 2005-05-11 Joe English * library/combobox.tcl: Include widget name, toplevel name, and "all" bindtags for combobox listbox, as per usual Tk conventions [fixes #1200012]. Generate <> events when scrolling with the mouse wheel too [fixes: #1200004] (In general: this event should be generated in response to any user action that selects an entry.) 2005-05-11 Joe English * generic/tkElements.c, generic/tkEntry.c: Moved default EntryLayout definition from tkElements.c to tkEntry.c. 2005-05-05 Michael Kirkham * library/progress.tcl: Set progressbar's -value to 0 upon stop so that indeterminate progressbars are not left active but unanimated, and determinate progress bars can use it as a quick reset. 2005-05-05 Joe English * generic/tkTheme.c, doc/style.n: added [style element options] 2005-04-20 Neil Madden * macosx/aquaTheme.c: Add 'static' qualifier to BoxToRect utility function to fix correct scope. 2005-04-20 Neil Madden * macosx/aquaTheme.c: Fixed layout of treeview header element to use fixed height, and position labels correctly. Refactored ButtonElementGeometry to provide a version which doesn't add extra padding (needed for header buttons). * generic/treeview.c: Minor fix, change use of ROWHEIGHT to HEADINGHEIGHT when drawing header elements. 2005-04-18 Joe English * macosx/aquaTheme.c: Added Aqua separator element [Patch #1184649, contributed by Mats Bengtsson] 2005-04-17 Joe English * macosx/aquaTheme.c: Make menubutton labels left-aligned instead of centered, as per Apple conventions [Fixes: #1183071] 2005-04-17 Joe English * library/treeview.tcl: Avoid excessive calls to [$tv configure -cursor ...] -- this is a lot more expensive than it looks [Fixes: #1184746] 2005-04-17 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h: Bumped version number to 0.6.3 * configure, generic/configure: regenerated. 2005-04-17 Joe English === TILE 0.6.2p1 TAGGED FOR RELEASE === === TILE 0.6.2 RECALLED == 2005-04-17 Joe English * generic/notebook.c: BUGFIX: notebook size computation didn't account for internal pane padding [fixes #1182704] 2005-04-15 Joe English * generic/widget.c: *** BUGFIX *** fix memory leak in widget construction, discovered by GPS. [#1184091] 2005-04-12 Joe English === TILE 0.6.2 TAGGED FOR RELEASE === 2005-04-12 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h: Bumped version number. * configure, generic/configure: regenerated. 2005-04-10 Joe English * generic/paned.c: Use layouts "Vertical.Sash" / "Horizontal.Sash" instead of "VSash" / "HSash". Schedule relayout when theme changes. * generic/clamTheme.c, library/clamTheme.tcl: Update sash specs. * generic/widget.c(WidgetConstructorObjCmd): BUGFIX: call getLayoutProc _after_ initializeProc. 2005-04-09 Joe English * library/tile.tcl: Use of deprecated aliases tbutton, tile::button, etc. now issues a warning. * tests/*.test: Don't use deprecated aliases tbutton, etc. 2005-04-09 Joe English * configure.in, Makefile.in, generic/configure.in, generic/Makefile.in, generic/pkgIndex.tcl.in generic/tile.c generic/tkTheme.h: Added PATCHLEVEL macros, currently 0.6.1; provide a way for application authors to distinguish releases from CVS snapshots. * configure, generic/configure: Regenerated. 2005-04-08 Joe English * library/combobox.tcl: Add combobox mouse wheel bindings [#1163055] 2005-04-05 Joe English * generic/tkstate.c(StateSpecSetFromAny): BUGFIX: don't assume objPtr->typePtr is non-NULL just because Tcl_ListObjGetElements() succeeded -- that was never guaranteed, and is no longer true. [Fixes #1177266] 2005-04-03 Joe English * generic/cache.c: Don't pass a NULL interp to Tk_AllocFontFromObj() or other allocators [fixes #1151526]. Report allocation errors as background errors. 2005-03-31 Joe English * generic/frame.c(Labelframe): Added a '-labelspace' style parameter to control spacing between label and border when -labeloutside is set * library/aquaTheme.tcl: set -labelspace 4 -labelinset 14, to match Apple HIG. [Finally fixes #1098335, #1067229] 2005-03-31 Joe English * doc/widget.n, generic/widget.h, generic/label.c, generic/button.c, generic/notebook.c, generic/treeview.c: -image option is now a list; first element is the image name, remainder of list is a statemap that can override the default image. [Patch #1171118]. * * * POTENTIAL INCOMPATIBILITY * * * both with core widgets and earlier tile releases. This will bite if you use images with spaces in their names. 2005-03-29 Jeff Hobbs * generic/tkTheme.h: remove dup Ttk_GetOrientFromObj decl 2005-03-27 Joe English * generic/frame.tcl: Add ttk::labelframe -labelinset style option; control amount of space between label and secondary edge. [See #1098335] 2005-03-27 Joe English * library/tile.tcl, library/button.tcl: Don't use click-to-focus if -takefocus is off. * demos/demo.tcl: Set -takefocus 0 for toolbar buttons. 2005-03-26 Joe English * generic/progress.c, library/progress.tcl, doc/progressbar.n: Made [$pb start] and [$pb stop] first-class widget methods instead of auxilliary routines (suggtestion from muonics) 2005-03-26 Joe English * generic/tkTheme.h, generic/ttk.decls: Rename Ttk_GetOrientationFromObj ==> Ttk_GetOrientFromObj. Added to stubs table. * generic/ttkDecls.h, generic/ttkStubInit.c: regenerated. 2005-03-26 Joe English * generic/trace.c: Pass NULL pointer to trace callback when linked variable is unset. * generic/button.c, generic/entry.c, generic/progress.c: Handle unset linked variables. 2005-03-25 Jeff Hobbs * macosx/aquaTheme.c: removed magic define of AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER. This should be added in CFLAGS if required. 2005-03-24 Joe English * win/xpTheme.c: fix ttk::progressbar elements for better native look. (Change made 2005-03-14, forgot to commit). 2005-03-22 Joe English * library/tile.tcl(availableThemes): Only list themes registered in the package database as tile::theme::*. 2005-03-22 Joe English * generic/button.c, generic/entry.c: Use different option database name and database class for ttk::label -background option, to avoid interference from X resource database [See #1104007]. * doc/label.n: -foreground and -font now real real ttk::label options. * tools/optiondiff.tcl: Add real -foreground option to a few other widgets. * generic/compat.h: regenerated. 2005-03-22 Joe English * generic/ttkStubLib.c: BUGFIX: Tile stub library initialization had same bug as Tcl #1091431 2005-03-22 Joe English * library/treeview.tcl: BUGFIX: only toggle -open for double-click on tree item, not anywhere in tree. 2005-03-20 Joe English * generic/clamTheme.c, library/clamTheme.tcl, generic/classicTheme.c: Add sash elements. * demos/demo.tcl(main demo pane): Use ttk::paned window. 2005-03-20 Joe English * demos/demo.tcl: (re)organized. 2005-03-18 Joe English * generic/paned.c: Defer pane placement to an idle callback. Misc. horizontal/vertical glitch fixes. 2005-03-18 Joe English * tclconfig/tcl.m4: Restore provenance line and CFLAGS_WARNING patch. * generic/Makefile.in: Use ${INSTALL_PROGRAM} for shared library. 2005-03-18 Jeff Hobbs * Makefile.in (AR): use @AR@, use INSTALL_PROGRAM for binaries. (LIBS): Add MATH_LIBS (needed for fmod on some platforms) * configure, tclconfig/tcl.m4: TEA 3.2 patch update 2005-03-17 Joe English * library/fonts.tcl: Derefactored to account for platform variability. Change default TkHeadingFont on Aqua and Windows [Fixes: #1163346] 2005-03-17 Joe English * generic/treeview.c, doc/treeview.n: Add treeview -show option, selectively disable tree and/or headings. * library/treeview.tcl: Changed treeview bindings to work more like other tree widgets: double-click on item or press disclosure button to toggle state (before, pressing anywhere on the item toggled open/close state). [Bryan Oakley] 2005-03-17 Joe English * tclconfig/tcl.m4, Makefile.in, configure.in, generic/configure.in: Upgrade to TEA 3.2 (tclconfig.m4 r1.59) * configure, generic/configure: Regenerated. 2005-03-16 Joe English * Makefile.in: Fix the "Joe added another library script but forgot to update PKG_TCL_SOURCES" problem once and for all. 2005-03-15 Joe English * library/xpTheme.tcl: Decrease Toolbutton padding from {8 4} to {4 4} (suggestion from Damon Courtney). 2005-03-15 Neil Madden * macosx/aquaTheme.c: Fixed to include tkInt.h so that pinstripe alignment patch compiles against latest TkAqua. Adjusted geometry of treeview heading buttons to remove excess padding, and adjusted the selected/alternate states to display sort ascending/descending indicators for now. 2005-03-14 Joe English * win/xpTheme.c: fix ttk::progressbar elements for better native look. 2005-03-13 Joe English * generic/paned.c, library/paned.tcl, doc/paned.n, tests/paned.test: New ttk::paned widget, paned window manager. * generic/manager.h, generic/manager.c (new): Support routines for geometry managers. 2005-03-13 Joe English * library/cursors.tcl (new, moved from library/treeview.tcl): Map symbolic cursor names to platform-specific Tk cursor names (rough draft -- just enough to support ttk::treeview and ttk::paned on X11 right now). 2005-03-13 Joe English * macosx/aquaTheme.c(BackgroundElementDraw): Fix pinstripe alignment in widget backgrounds [#1157739]. Thanks to Mats Bengtsson and Daniel Steffen for tracking down how to fix this. 2005-03-09 Joe English * library/aquaTheme.c: Don't stipple images in disabled buttons (workaround for #1100117, probably a good idea in any event). 2005-03-09 Joe English * generic/label.c: Use default "-justify left" instead of "-justify center". 2005-03-08 Joe English * generic/scroll.c, generic/treeview.c, generic/widget.h: BUGFIX: avoid divide-by-zero in -yscrollcommand callback when tree is empty. Ensure -yscrollcommand called after [$tv configure -yscrollcommand]. 2005-03-08 Joe English * generic/notebook.c(SelectTab): Fix typo. 2005-03-07 Joe English * generic/clamTheme.c(Ttk_GCForColor) Check for -DMAC_OSX_TK instead of -DMAC_OSX_TCL. * generic/progress.c: BUGFIX: ensure CheckAnimation called in [$pbar set] 2005-03-06 Joe English * generic/clamTheme.c: Improved appearance for Entry and Combobox. Handle -borderwidth 0. 2005-03-05 Joe English * generic/clamTheme.c: (Patch from Michael Kirkham) Workaround for Tk Aqua bug in Tk_GCForColor() [See #1115785] 2005-03-04 Joe English * library/fonts.tcl: Add TkCaptionFont -- used as message text in alert dialogs (different from TkHeadingFont, used for column headers; TkCaptionFont is larger on X11). 2005-03-03 Joe English * library/*.tcl: Avoid "creative writing" problems [#1123406]. 2005-03-01 Neil Madden * macosx/aquaTheme.c: Added a 'Toolbar' style for the ttk::frame which picks up the lighter pinstripe effect on Aqua. Also added support for Aqua list header buttons to the Treeview widget. 2005-03-01 Joe English * generic/label.c(TextDraw): Clip text if it's too wide to fit in allocated parcel. BUG: For multi-line text, this will clip more than necessary. But at least the treeview widget is usable now. 2005-02-28 Joe English * library/progress.tcl (new file, moved from demo.tcl): 'start' and 'stop' utility procedures for progress bars. Handle timer cleanup in timer itself instead of binding. * generic/progressbar.c: Added 'step' method; support for -length option; handle errors from traces on linked -variables; 2005-02-28 Michael Kirkham * macosx/aquaTheme.c: Show track only instead of a non-animated barber pole when drawing an indefinite ttk::progressbar with -value 0. 2005-02-27 Joe English * macosx/aquaTheme.c, library/aquaTheme.tcl: Add support for ttk::progressbar on Aqua (partial) 2005-02-27 Joe English * generic/progress.c, doc/progressbar.n, tests/progress.test (new): * Makefile.in, generic/Makefile.in win/makefile.vc, generic/tile.c, library/defaults.tcl, library/clamTheme.tcl: New ttk::progressbar widget. * generic/tkElements.c, generic/clamTheme.c: Add "pbar" element. * generic/stepTheme.c, library/stepTheme.tcl: 2005-02-27 Joe English * widget.h, widget.c, scale.c, scrollbar.c, separator.c: Oriented widgets no longer hardcode the layout/style name; [ttk::scrollbar .sb -orient horizontal -style Foo] will use style "Horizontal.Foo" instead of "Horizontal.TScrollbar" [Fixes #1145845] 2005-02-26 Joe English * generic/tkTheme.c: BUGFIX: Cancel pending <> calls at package cleanup time. I *knew* I was forgetting something ... 2005-02-24 Joe English * generic/tkTheme.c: Schedule <> calls whenever any style parameter is set, not just when the theme is changed. Useful for interactive debugging. 2005-02-24 Michael Kirkham * generic/frame.c: Shift the top of the labelframe's border down one pixel in "-labeloutside true" mode. Otherwise it partly still overlaps the border in the clam theme (just enough to show what looks like half a line beneath the label). 2005-02-13 Joe English * generic/frame.c: Redid labelframe layout calculations. * generic/frame.c: Added "-labeloutside" style option for Labelframes: Styles can specify whether label should appear on top of the border or outside of it [Fixes: #1098335] [sort-of fixes #1067229] * library/clamTheme.c, library/aquaTheme.c: Use "-labeloutside true" 2005-02-07 Joe English * library/treeview.tcl: Don't pollute global namespace [#1118216] 2005-02-04 Michael Kirkham * generic/entry.c: Use XFillRectangle instead of XDrawLine to draw insertion cursor and work around missing cursor under all themes in Aqua (#1115785). Free cursor drawing GC. 2005-02-03 Michael Kirkham * win/makefile.vc: Modify windows pkgIndex.tcl generation to handle spaces in $dir (#1112878). 2005-01-31 Joe English * Makefile.in: Fix 'install-headers' and 'test' targets. * Makefile.in, generic/Makefile.in: *Really* fix 'test' target this time. 2005-01-27 Michael Kirkham * demos/autocomplete.tcl: Add example implementation demonstrating inline auto-completion for comboboxes, with or without pre-sorted value lists. 2005-01-24 Michael Kirkham * generic/notebook.c: Unmap tab slave when hidden so that, if all tabs are hidden, the last hidden tab's slave is no longer shown. When all tabs are hidden and one is switched to the normal state, select that tab (really, SelectNearestTab() whenever configuring a tab with an invalid currentIndex). 2005-01-24 Michael Kirkham * generic/notebook.c: Preserve the current tab selection when the deleting a lower-index tab and fix Bug #1108204. 2005-01-15 Michael Kirkham * generic/notebook.c: Protect dummy layout tab (last patch) from NewTab() failing. 2005-01-15 Michael Kirkham * generic/notebook.c: Calculate tab height using a dummy tab if a notebook has no tabs to avoid issues with partial clipping and positioning of the bar below the tabs e.g. under Aqua. 2005-01-10 Joe English * library/combobox.tcl: Added Tab and Shift-Tab keybindings for combobox listboxes (#1090277). 2005-01-07 Joe English * generic/ttkDecls.h(Ttk_InitStubs): Ttk_InitStubs now just calls Tcl_PkgRequire(...) if -DUSE_TTK_STUBS not set. * configure.in, Makefile.in: Build and install stub library; install headers. Replaced automake-legacy install-* rules. * generic/configure.in: Cruft removal. * configure, generic/configure: Regenerated. 2005-01-05 Michael Kirkham * doc/notebook.n, generic/notebook.c: Add a third "hidden" state for notebook tabs. 2005-01-02 Michael Kirkham * library/notebook.tcl: Allow CycleTab to skip past disabled tabs. 2004-12-31 Joe English * generic/layout.c, generic/tkTheme.c, generic/tkThemeInt.h: Don't Panic: Modify Ttk_GetElement so that it never returns NULL; instead, if specified element isn't found return a no-op element. 2004-12-31 Joe English * tools/genStubs.tcl: BUGFIX: proper handling of deprecated and obsolete entry points. * generic/tkTheme.h, generic/tkThemeInt.h, generic/tkTheme.c, generic/ttk.decls, generic/layout.c, generic/image.c: Added Ttk_RegisterElement(), replacement for Ttk_RegisterElementSpec: takes a Tcl_Interp * argument for reporting error messages, and returns an (opaque) Ttk_Element handle instead of TCL_OK/TCL_ERROR * generic/ttkDecls.h, generic/ttkStubInit.c: Regenerated. * (all): Use Ttk_RegisterElement instead of Ttk_RegisterElementSpec. 2004-12-30 Joe English * tclconfig/tcl.m4: Sync with TEA tcl.m4 r1.54 (adds support for VC7). * configure, generic/configure: Regenerated. 2004-12-28 Joe English * tclconfig/teax.m4, generic/configure.in: Added TEAX_FIX_LIB_SPECS; adjust @TCL_STUB_LIB_SPEC@ et al. to work when using Windows/MSVC. 2004-12-28 Joe English * doc/converting.txt: Recommend *not* using [namespace import -force ttk::*] at global scope. 2004-12-26 Joe English * generic/notebook.c, doc/notebook.n: Added tab -state option, either "normal" or "disabled" 2004-12-26 Joe English * generic/configure.in: Use autoconf 2.5 * generic/Makefile.in: Remove unused cruft. 2004-12-26 Joe English * generic/tile.c: Add workaround for Tcl bug #1091431 "Tcl_InitStubs() failure crashes wish" 2004-12-26 Joe English * generic/ttk.decls, generic/ttkDecls.h, generic/ttkStubInit.c, generic/ttkStubLib.c (new files): Stub library support * generic/tile.c, generic/tkTheme.h: Stub library support * generic/Makefile.in: Add rules to build stub library. * win/makefile.vc, Makefile.in: Partial stub library support 2004-12-26 Joe English * tclconfig/tcl.m4: Merge with sampleextension CVS HEAD (r1.52). 2004-12-19 Joe English * generic/pixmapTheme.c(removed), Makefile.in, generic/Makefile.in, win/makefile.vc, generic/tile.c, generic/widget.h, tests/image.test, tests/layout.test: pixmap element factory no longer used; subsumed by image factory. 2004-12-19 Joe English * configure.in, generic/configure.in: Always AC_DEFINE(BUILD_tile) * configure, generic/configure: regenerated. 2004-12-10 Joe English * (all): Great Renaming: :%s/TTK_\([A-Z][a-z]\)/Ttk_\1/g 2004-12-10 Joe English * tclconfig/tcl.m4: Applied tea-die-dbgx-die.patch (#1081595) * configure, generic/configure: Regenerated. 2004-12-07 Joe English * tclconfig/teax.m4 (new file): Additional autoconf macros. 2004-11-29 Joe English * library/altTheme.tcl, library/clamTheme.tcl, library/stepTheme.tcl (TMenubutton defaults): Use -width -11 instead of -width 11 [fixes: #1075487 "tmenubutton draws long text badly for some themes"] 2004-11-29 Joe English * generic/tkTheme.h: Replace TK_STYLE_VERSION_2 #define with an enumerated type. 2004-11-28 Joe English * generic/frame.c(labelframe widget): Avoid excessive calls to Tk_MaintainGeometry() [fixes: #997793 "labelframe-3.3 locks up on Aqua"] 2004-11-27 Joe English * macosx/aquaTheme.c: Save and restore previous GWorld in all element Draw routines. (Apparently fixes #1072421). 2004-11-23 Joe English * library/aquaTheme.tcl: Decrease horizontal padding and minimum width for button widgets. * macosx/aquaTheme.c: Use "default" as parent theme instead of "alt". 2004-11-23 Joe English * macosx/aquaTheme.c: improved combobox; fix typo (patch from Michael Kirkham sent to tktable-tile-dev) 2004-11-09 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.6 * library/classicTheme.tcl: Removed [package provide] call, this is done in classicTheme.c. * configure, generic/configure: Regenerated. 2004-11-05 Pat Thoyts * win/makefile.vc: Fix for bug #1059674 - load the right dll for debug or threaded builds on windows. * win/makefile.vc: Fixes from Vince Darley to permit installation to paths that include spaces (bug #1023548). Also changed build options to use the OPTS=xxx syntax. ie: OPTS=square,nouxtheme,nostubs 2004-11-01 Joe English * tests/tile.test(tile-6.3): Fix bug reported by lvirden on c.l.t: [package versions tile] can return more than one version number. 2004-11-01 Pat Thoyts * configure.in: Fix #921012 - enable build with msys+gcc. * configure: regenerated. 2004-10-31 Joe English === TILE 0.5 TAGGED FOR RELEASE === 2004-10-31 Joe English * generic/entry.c, library/combobox.tcl, library/combobox.n: Added [$combobox current] command, track ordinal index of currently-selected item (FR from JH). 2004-10-31 Joe English * tclconfig/tcl.m4: gcc CFLAGS_WARNING: leave out -Wno-implicit-int (in case of C++) * library/altTheme.tcl: Use embossed look for disabled text 2004-10-31 Pat Thoyts * win/makefile.vc: Removed kroc theme installation lines. 2004-10-30 Joe English * win/winTheme.c(TroughElement): Fix thread-safety issues; respond to system color changes; changed logic for when to use pattern brush instead of solid brush. 2004-10-29 Pat Thoyts * demos/themes/kroc: Moved all pixmap themes to a new * demos/themes/WinXP-Blue: tile-themes cvs tree to separate * demos/themes/Aquativo: contributed themes from the core theming code. Pixmap themes are now loadable as ordinary tcl packages. * generic/square.c: Sample widget to illustrate how to create * generic/tile.c: tile widgets. The call to the init function is * win/makefile.vc: only built if TTK_SQUARE_WIDGET is defined. Needs adding to the configure build system. * win/winTheme.c: Handle the scrollbar trough natively. * win/makefile.vc: Added gdi32.lib to the link list. * configure.in: * configure: 2004-10-27 Joe English * generic/tkTheme.h: Added #ifdef'ed 'extern "C" { ... }' wrapper for the benefit of C++ compilers. 2004-10-27 Joe English * generic/notebook.c: Automatically select first tab added (fixes: #1054507) * generic/label.c(ImageTextElementDraw): Use correct bounding box for label background area (fixes: #1054492) * demos/demo.tcl: Minor tweaks to demo. 2004-10-25 Pat Thoyts * win/monitor.c: Fix for #1053389 - use the monitor window to * win/xpTheme.c: obtain theme information if a widget has not * win/winTheme.c: been mapped yet. 2004-10-24 Joe English * generic/label.c(ImageDraw): Clip width and height to ensure Tk_RedrawImage() doesn't extend outside window boundaries; otherwise this leads to a crash in XGetImage() if the image is partially transparent. 2004-10-24 Pat Thoyts * generic/label.c: Added an -embossed option to the text and * library/winTheme.tcl: label elements to support drawing the text with an embossed look. This is used in winnative for all disabled widgets. 2004-10-24 Joe English * win/winTheme.c: Focus indicator for read-only comboboxes. * win/xpTheme.c: Use separate elements for scrollbar thumb and grip * library/winTheme.tcl: (bugfix) Change entry background to frame color in disabled state as well as in readonly state [#1048888] 2004-10-19 Joe English * tools/optiondiff.tcl: Added hooks to easily change "compatibility" options into "real" ones. Made -font, -foreground, and -background on ttk::labels, and -foreground on check/radio/pushbuttons real options. * generic/compat.h: Regenerated. 2004-10-19 Joe English * library/keynav.tcl: Only override global and bindings under Tk 8.4; TIP #204 provides the same functionality. 2004-10-17 Joe English * library/defaults.tcl, library/classicTheme.tcl, library/altTheme.tcl: Change entry and combobox background to frame color in disabled state as well as in readonly state [#1048888] * library/classicTheme.tcl: Fix -selectbackground to match Tk 8.4 defaults. * generic/entry.c: Make -selectborderwidth NULL by default so theme settings take precedence. 2004-10-14 Joe English * library/button.tcl: Added up- and down- arrow keyboard navigation for radiobuttons. 2004-10-12 Joe English * demos/demo.tcl: Minor reorganization to demo program. 2004-10-12 Joe English * library/classicTheme.tcl: Add -shiftrelief to toolbar buttons. 2004-10-09 Joe English * generic/tkTheme.h, generic/layout.c: Added TTK_PlaceLayoutNode -- set parcel and place children. Added TTK_UNIT flag -- experiment. * generic/tkTheme.c: Added TTK_CloneElement, new element factory (another experiment). 2004-10-09 Joe English * generic/image.c: Fix memory leak in error path. 2004-10-07 Joe English * library/treeview.tcl: BUGFIX: Missing binding to deactivate active heading. 2004-10-05 Jeff Hobbs * library/combobox.tcl (tile::combobox::Post): set the listbox height to values size, if < 10. (tile::combobox::LBSelected): select in entry the LBselected item 2004-10-05 Joe English * generic/tkTheme.h, generic/tkstate.c, generic/button.c, macosx/aquaTheme.c, win/xpTheme.c, demos/demo.tcl, library/altTheme.tcl, library/clamTheme.tcl, doc/widget.n: Use TTK_STATE_ALTERNATE for buttons with '-default active'; "default button" isn't general enough to merit a separate state flag. 2004-10-05 Joe English * library/combobox.tcl: Revert to r1.12, r1.13 was bogus. 2004-10-05 Jeff Hobbs * Makefile.in (PKG_TCL_SOURCES): add treeview.tcl and aquaTheme.tcl to install. 2004-10-05 Joe English * generic/treeview.c, library/treeview.tcl, doc/treeview.n: Added column -anchor option. Added heading -command option, evaluated when column heading is pressed. Track active heading, update -cursor. 2004-10-05 Joe English * generic/notebook.c, generic/classicTheme.c, macosx/aquaTheme.c, library/altTheme.tcl, library/aquaTheme.tcl, library/clamTheme.tcl, library/classicTheme.tcl, library/defaults.tcl, library/stepTheme.tcl, library/winTheme.tcl, library/xpTheme.tcl: Use TNotebook.Tab as sublayout name instead of Tab.TNotebook. 2004-10-04 Joe English * win/xpTheme.c: Don't use ETS_READONLY for combobox text fields (fixes: #1032409) 2004-10-04 Joe English * win/xpTheme.c: Put all the XP element information into one big table. Finally fixed memory leak. 2004-10-04 Joe English * generic/treeview.c, win/xpTheme.c: rough hack at native XP appearance. Add workaround (sigh) for the stupid XDrawLines() off-by-one bug. 2004-10-04 Joe English * generic/treeview.c, generic/widget.c, generic/widget.h: Made GetOptionValue, EnumerateOptions semi-public. * generic/notebook.c, doc/notebook.n, library/notebook.tcl: Merged "tabcget" and "tabconfigure" commands into "tab" command. * * * INCOMPATIBILITY with tile 0.4 * * * 2004-10-04 Joe English * library/fonts.tcl, library/treeview.tcl: Define TkHeadingFont along with other symbolic fonts. 2004-10-04 Joe English * all: TTK_GetLayout() now includes background element automatically. "*.background" not included in individual layout specifications. 2004-10-04 Joe English * generic/tkThemeInt.h, generic/layout.c, generic/tkTheme.c: Reorganization & renaming; TTK_TemplateNode now semi-public. * generic/tkThemeInt.h, generic/layout.c, generic/tkTheme.c: Reorganized again. Added TTK_GetSubLayout(). 2004-10-04 Joe English * generic/treeview.c: 'detach' command takes a list of items. * doc/treeview.n: Doc fixes: 'detach' and 'delete' take a list of items. 2004-10-04 Jeff Hobbs * demos/demo.tcl: add simple tree widget demo of widget hierarchy 2004-10-04 Joe English * library/tile.tcl, library/combobox.tcl, library/button.tcl: Added tile::CopyBindings utility procedure. 2004-10-04 Joe English * generic/tile.c, library/tile.tcl, tests/all.tcl: Use $::tile::library intead of $::tile_library. Set $::tile::version in _Init() routine. 2004-10-03 Joe English * configure.in, generic/configure.in: Added --disable-compat build-time option. * configure, generic/configure: Regenerated. * tools/optiondiff.tcl, generic/compat.h: NO_COMPAT_DEFAULTS unused. 2004-10-03 Joe English * generic/treeview.c, doc/treeview.n, tests/treeview.test: New treeview widget. * generic/scroll.c, generic/widget.h: Support routines for scrolling widget (half-baked) 2004-09-29 Joe English * generic/tkTheme.h: 'typedef enum {...} TTK_Orient' instead of 'enum TTK_ORIENT { ... }', for consistency. 2004-09-29 Joe English * generic/tkTheme.h, generic/tkstate.c, doc/widget.n, demos/demo.tcl, macosx/aquaTheme.c: Renamed "indeterminate" state to "alternate"; can be used as a sort of catch-all "alternate display" flag, not just checkbutton tri-state values. 2004-09-28 Joe English * generic/tkTheme.h, generic/layout.c, generic/widget.c, generic/entry.c, generic/notebook.c, generic/scale.c: Rename TTK_LayoutReqSize() ==> TTK_LayoutSize(). Change order of arguments in TTK_DrawLayout() to match TTK_LayoutSize() and TTK_PlaceLayout(). * generic/tkTheme.h, generic/tkThemeInt.h: Added TTK_State typedef, clear up 'unsigned int' vs. 'unsigned long' confusion in places. 2004-09-28 Joe English * generic/tkTheme.h, generic/tkstate.c generic/widget.c: Rename WidgetStateSpec ==> StateSpec. Use onbits/offbits for internal rep instead of mask/match. 2004-09-28 Joe English * generic/tkElements.c: Split "separator" element into vseparator, hseparator, and generic separator. 2004-09-24 Joe English * generic/label.c(ImageDraw): Stipple over the image area, to make it look "grayed-out" when TTK_STATE_DISABLED is set (see #1031565) 2004-09-23 Joe English * doc/man.macros(.SO): Use 4 columns for STANDARD OPTIONS instead of 3. .SE: Remove reference to options(n), Tile package documents standard options in widget(n). * doc/notebook.n, doc/separator.n: Updated .SO section. 2004-09-22 Joe English * library/tile.tcl: Select initial theme from X resource database. Use "default" on X11 if it's not set. 2004-09-21 Joe English * generic/entry.c: Fixed precedence rules for -selectforeground et al: built-in default, style default, widget option, dynamic value. * generic/layout.c: TTK_QueryOption() examines widget options now. * generic/tkTheme.c, generic/tkTheme.h, generic/tkThemeInt.h: TTK_QueryStyle() now private; TTK_LayoutStyle no longer used; refactored. 2004-09-20 Joe English * demos/repeater.tcl: Added demonstration of custom widget classes. (This may be useful enough to move into the main library...) * demos/demo.tcl: Add repeating button demo. 2004-09-19 Joe English * generic/clamTheme.c: Simplified. * library/clamTheme.tcl: Remove unused settings. * generic/clamTheme.c: Prevent rightmost tab from extending past the client box when notebook is too narrow. 2004-09-19 Joe English * generic/tkElements.c: Fixed logic for XDrawLines workaround: XDrawLines() only omits the last point, not the first. * generic/notebook.c: Set USER1 and USER2 state flags for leftmost and rightmost tabs, resp. * win/xpTheme.c: use TABP_TABITEMLEFTEDGE for leftmost tab; finally gets rid of the one-pixel glitch. Can't fix the rightmost tab, unfortunately. * win/winTheme.c, library/winTheme.tcl, win/xpTheme.tcl: More tweaks to notebook; notebook almost draws correctly now under "Windows Classic" style. 2004-09-19 Joe English * demos/themes/{Aquativo,kroc}.tcl: Use "Button.button" instead of "Button.background" 2004-09-19 Joe English * demos/demo.tcl: Use "ttk::" namespace instead of "t" prefix. 2004-09-18 Joe English * library/keynav.tcl: Added 'keynav::traverseTo' (see TIP 204) * library/notebook.tcl: Use keynav::traverseTo instead of directly setting [focus]. * library/entry.tcl, library/combobox.tcl: Add <> bindings for entry and combobox widgets. * generic/frame.c: Added TLabelframe -underline option so it supports mnemonic activation. * generic/tile.tcl: Added mnemonic activation binding for labels and labelframes (traverse to next widget). * demos/demo.tcl: Minor updates to demonstrate improved keyboard navigation abilities. 2004-09-17 Joe English * demos/themes/blue.tcl: Updated to use 'image' element factory instead of 'pixmap'. Minor tweaks. 2004-09-17 Joe English * library/combobox.tcl: BUGFIX: clicking in text area in editable comboboxes posted the listbox instead of setting insert cursor. (bug exposed by recent changes to layout.c). 2004-09-17 Joe English * generic/defaults.tcl: Use #ffffff instead of activebg for unchecked indicators. 2004-09-17 Joe English * library/tile.c: BUGFIX: missing :: prefix on namespace eval. 2004-09-16 Joe English * generic/tile.c, generic/entry.c, generic/notebook.c, library/tile.tcl: Tile widgets now defined in the "ttk::*" namespace; t* and tile::* still provided as aliases for now. * doc/*.n: Consistently use "ttk::*" in widget documentation. 2004-09-16 Joe English * generic/tkTheme.c: BUGFIX: initialization of defaultTheme to 0 removed in r1.70 was *not* dead code. 2004-09-16 Joe English * generic/notebook.c: Squeeze tabs if there's not enough space to display all of them at their natural width. 2004-09-15 Joe English * generic/*.c: Use TTK_PlaceLayout instead of LayoutGeometry. Renamed TTK_LayoutDraw() -> TTK_DrawLayout(). 2004-09-15 Jeff Hobbs * library/combobox.tcl: add mouse-over tracking as a default ComboboxListbox behavior. Only apply *TCombobox*Listbox.background white for X11. (tile::combobox::PopdownShell): alter look to be more "standard" with relief on toplevel instead of higlight around lb only. 2004-09-15 Joe English * generic/image.c (new file), generic/tile.c: Added "image" element factory, enhanced version of "pixmap" factory. * Makefile.in, generic/Makefile.in, win/makefile.vc: Added image.c. * generic/layout.c, generic/tkTheme.h: Added TTK_GetBorderFromObj * demos/themes/WinXP-Blue.tcl: Use "style element create image" instead of "pixmap". 2004-09-15 Joe English * demos/demo.tcl(StateMonitor): Control-Shift-ButtonPress-1 now launches state monitor window if it's not currently active. Put .states window content inside a TFrame so background color is right. 2004-09-14 Joe English * generic/tkTheme.c: Use same inheritance chain for layout templates as for elements (specific names to generic names, fallback in parent theme.) This way a custom style like "Blue.TButton" will inherit the layout from "TButton". 2004-09-14 Jeff Hobbs * library/combobox.tcl (tile::combobox::PopdownShell): make popdown a transient of the parent toplevel. This makes Win/Tk recognize it as a child and doesn't lose focus from the main toplevel when displaying the combobox (8.4.8+). 2004-09-13 Joe English * generic/button.c, doc/label.n: Added -justify and -wraplength options to label widget. (NB: I don't think these work right.) * demos/demo.tcl ("Others" pane): Use [tlabel] instead of [message] widget for help text. * generic/compat.h: Regenerated. 2004-09-13 Joe English * generic/notebook.c: Expand selected tab based on "-expandtab" style option. Put client area in main layout instead of using a separate one. * generic/tkTheme.h, generic/layout.c, generic/tkTheme.c: Added TTK_ExpandBox(), TTK_QueryOption(). Removed TTK_RootNode() (no longer used). * win/xpTheme.c, library/xpTheme.tcl: Use notebook -expandtab feature instead of custom element and dynamic -padding. 2004-09-12 Joe English * library/fonts.tcl: Specify X11 font size in pixels even with Xft; Xft doesn't seem to be any more consistent than core X11 wrt. resolution. 2004-09-10 Joe English * generic/notebook.c, library/notebook.tcl: Generate <> from [$nb select] instead of from the widget bindings, so the event is delivered when the tab is changed under program control as well as by the user. * generic/tile.c, generic/widget.h: Added SendVirtualEvent() utility routine. 2004-09-10 Joe English * generic/layout.c: Finally fixed request-size calculations. * tests/layout.test(new file): Added test case demonstrating what was wrong with the old algorithm. 2004-09-10 Jeff Hobbs * win/xpTheme.c (ThumbElementDraw): remove redundant state check (XPTheme_Init): add IGNORE_THEMESIZE to notebook tab element data to correct against layout engine changes. 2004-09-08 Joe English * generic/label.c: Changed layout computation to have slightly better behavior when parcel is too small. Added -justify and -wraplength text element options. Don't check for failure conditions that Cant' Happen. * generic/scale.c: Inlined getFontFromObj, getForegroundFromObj; * generic/layout.c, generic/tkTheme.h: Remove getFontFromObj, getForegroundFromObj, and adjustAnchor -- no longer used. Added TTK_PlaceBox. 2004-09-08 Joe English * generic/layout.c, generic/tkTheme.c, generic/tkThemeInt.h: Store element names in ElementImpl structure, not LayoutNode. Small refactoring of layout.c. 2004-09-08 Joe English * generic/*.[ch]: Reorganizing internal data structures, phase 2: TTK_Layout structure now includes recordPtr, optionTable, and Tk_Window fields; don't need to pass these to TTK_LayoutDraw() etc. 2004-09-08 Joe English * tkThemeInt.h, layout.c, tkTheme.c: Reorganized internal data structures, phase 1: + Move element default values from ResourceMap into ElementImpl + Introduce TTK_Layout structure + Add resource map cache to ElementImpl + Remove struct ElementInstance; * tkTheme.h, frame.c, notebook.c, scale.c, scrollbar.c: Casualties of the above change. 2004-09-08 Joe English * generic/button.c: set -default normal as default. * demos/demo.tcl: Set "*Button.default normal" so default navigation does the right thing. 2004-09-08 Joe English * widget.c(WidgetConstructorObjCommand): Fix memory leak in failure path. NOTE: Some leaks remain. 2004-09-07 Joe English * tkThemeInt.h: New file; private routines moved here. * layout.c(TTK_LayoutNode): width and height fields never used. * layout.c, scrollbar.c: Added TTK_LayoutNodeReqSize(). 2004-09-07 Pat Thoyts * win/makefile.vc: Updated to support setting the INSTALLDIR to * win/rules.vc: a non-tcl directory (eg: site-lib). Added shell target and include the demo in the standard installation target. 2004-09-06 Joe English * generic/tkTheme.h, generic/clamTheme.c, generic/classicTheme.c, generic/entry.c, generic/layout.c, generic/notebook.c, generic/stepTheme.c, generic/tkElements.c, macosx/aquaTheme.c: Remove TTK_STICK_ALL synonym; use TTK_FILL_BOTH everywhere. Remove some unneeded TTK_EXPAND settings. 2004-09-06 Pat Thoyts * generic/clamTheme.c: Added XFCE-style scale and progress bar elements. Fixed the DrawSmoothBorder function to cope with small widths or heights (for the progress bar). 2004-09-04 Joe English * generic/label.c (new file): moved out of tkElements.c, it's complex enough to warrant its own source file. * generic/tkElements.c, generic/altTheme.c, generic/classicTheme.c: Move Motif-like elements into new "classic" theme. Streamlined and simplify default theme. * library/*Theme.tcl: reviewed and reorganized. * library/tile.tcl: $defaultBG, $activeBG, $troughColor no longer used. * generic/notebook.c, generic/altTheme.c, generic/tkElements.c: Got rid of ugly default notebook element implementations, use the "alt" implementation as the baseline instead. 2004-09-06 Pat Thoyts * generic/clamTheme.c: Added workarounds for the off-by-one bug in Tk's implementation of XDrawLine. This only affects the clam theme. Win32 clam now matches X11 clam look. This hack can be disabled by #defining WIN32_XDRAWLINE_HACK 0. 2004-09-03 Joe English * library/tile.tcl: Automatically select the appropriate platform-specific theme (xpnative, winnative, aqua, or alt) so application code doesn't need to worry about this anymore. * demos/demo.tcl: Initialize V(THEME) to current theme. 2004-09-03 Joe English * library/fonts.tcl: update comments. 2004-09-02 Jeff Hobbs * library/fonts.tcl: simplify font creation code, remove bold weighting for x11 font default. 2004-09-02 Joe English * generic/tkTheme.h, generic/layout.c, generic/frame.c, generic/scale.c: Refactoring: added TTK_LayoutNodeInternalPadding, use where appropriate. 2004-09-02 Jeff Hobbs * library/xpTheme.tcl: readd SystemButtonFace as default bg * generic/altTheme.c (TabElementDraw): account for off-by-one * generic/notebook.c (TabElementDraw): drawing difference for XDrawLines on Windows 2004-09-02 Joe English * doc/scrollbar.n: Added. Decision: "-command" is a script prefix, not a command prefix (see tktable-tile-dev archives). * library/scrollbar.tcl: Treat "-command" as a string, not a list. * generic/scrollbar.c: Minor formatting cleanups. 2004-09-02 Joe English * library/notebook.tcl: Fix "buried focus" problem; selecting a tab could leave the keyboard focus on an unmapped window. Fix bug in MnemonicActivation. (For the record: I think the earlier behavior, always set focus to the notebook widget itself, is more correct regardless of what Windows does :-) 2004-09-02 Joe English * library/clamTheme.tcl(Tab.TNotebook): Fix color glitch in active notebook tab border (spotted by dkf). 2004-09-02 Jeff Hobbs * library/notebook.tcl (tile::notebook::MnemonicActivation): (tile::notebook::CycleTab, tile::notebook::Select): only focus into tab on second <1>, and only generate NotebookTabChanged when we are changing tabs. 2004-09-01 Joe English * generic/widget.c: fix memory leak (corePtr->layout) * generic/tkTheme.c: fix memory leak (TTK_Style defaultsTable) 2004-09-01 Joe English * generic/layout.c, generic/tkTheme.h, generic/tkTheme.c: Refactoring: build LayoutTemplate from LayoutSpec instead of the other way around. 2004-09-01 Joe English * generic/frame.c(FrameMargins): Tweak: use TTK_AddPadding instead of inline code. 2004-08-31 Joe English * generic/tkTheme.h: Removed unused DEFAULT_* #defines * generic/tkTheme.h, generic/altTheme.c, generic/stepTheme.c, generic/tkElements.c: DEFAULT_BORDERWIDTH is theme-specific. * generic/tkTheme.h: Remove #ifdeffery: Use TIP 145 symbolic name for DEFAULT_FONT; use classic X11 default for DEFAULT_BACKGROUND and DEFAULT_FOREGROUND (platform themes will override this anyway). 2004-08-31 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.5 * configure, generic/configure: Regenerated. 2004-08-30 Joe English * library/combobox.tcl: Generate <> virtual event when item is selected from popdown listbox (suggestion from Jeff Godfrey). Use option database to make listbox font match entry field font (bug report from Jeff Godfrey). Also set default background for listbox. Position listbox above combobox if it would extend below the the screen. 2004-08-29 Joe English * win/xpTheme.c, win/winTheme.c, library/xpTheme.tcl: Changes to notebook layout (see #1015652). 2004-08-27 Joe English * generic/entry.c, library/combobox.tcl, doc/combobox.n: Add -postcommand combobox option. 2004-08-25 Jeff Hobbs * library/*.tcl: whitespace police, minor code corrections 2004-08-24 Pat Thoyts * generic/altTheme.c: TTK_UniformPadding takes a short. MSVC is * generic/clamTheme.c: noisy about using int's with this so * generic/entry.c: added a cast to reduce the noise. * generic/frame.c: * generic/notebook.c: * generic/tkElements.c: * win/makefile.vc: Default to building with Tk stubs. Add NOSTUBS=1 to the command line to link against tk84.dll for older versions of Tk 8.4. * win/winTheme.c: Added some padding to the indicator elements. Added an implemementation of the Scale slider using the winnative drawing functions. * win/winTheme.c: Made the winnative scrollbar a bit more windows-like. The thumb isn't shown when disabled and the thumb was a little too large before. It's now the correct width/height. 2004-08-19 Joe English * demos/demo.tcl: Added separator to demo. 2004-08-18 Joe English * generic/separator.c (new file), generic/tkElements.c, doc/separator.n (new file), generic/tile.c, library/tile.tcl, Makefile.in, generic/Makefile.in, win/makefile.vc: Added separator widget. 2004-08-18 Jeff Hobbs * win/xpTheme.c (XPTheme_Init): add 4px padding between indicator and text for radio|checkbuttons * generic/scrollbar.c (ScrollbarSetCommand): disable the scrollbar when there is nothing to scroll. * win/xpTheme.c (ThumbElementDraw): don't draw the thumb when state is disabled 2004-08-18 Joe English === TILE 0.4 TAGGED FOR RELEASE === 2004-08-19 Pat Thoyts * win/makefile.vc: Make default build add HAVE_UXTHEME_H. User can add NOUXTHEME=1 to the command line to avoid this is required. 2004-08-13 Joe English * tclconfig/tcl.m4: Synced with TEA 3.1 (sampleextension/tclconfig/tcl.m4 r1.51). * configure.in, Makefile.in: Update for TEA 3.1. * generic/configure.in, generic/Makefile.in: Update for TEA 3.1. Check for HAVE_UXTHEME_H on Windows. * configure, generic/configure: Regenerated. 2004-07-11 Joe English * library/tile.tcl, demos/demo.tcl: Added tile::availableThemes, tile::setTheme. 2004-07-05 Joe English * generic/widget.h, generic/*.c: Added WIDGET_INHERIT_OPTIONS macro. * demos/demo.tcl: Added combobox pane. * macosx/aquaTheme.c: Failed attempt at native comboboxes on OSX. * library/combobox.tcl: raise popup after deiconifying; this is needed under OSX. 2004-07-01 Joe English * win/xpTheme.c: Native appearance for combobox widgets. * library/combobox.tcl: BUGFIX: possible for LBSelect to be called when is actually selected; account for this. * library/combobox.tcl: BUGFIX: don't post listbox when disabled. * library/combobox.tcl: Workaround for [grab -global] not really grabbing globally on Windows. * win/winTheme.c: Added 'Field' element so entry borders drawn correctly again. * generic/entry.c: -selectborderwidth 0 -insertwidth 1 now the default, since that's what most themes use. 2004-07-01 Jeff Hobbs * Makefile.in (PKG_TCL_SOURCES): add combobox.tcl for install 2004-06-30 Joe English * generic/entry.c, library/tile.tcl, library/combobox.tcl: New combobox widget. * generic/altTheme.c, generic/tkElements.c, win/xpTheme.c, macosx/aquaTheme.c, generic/clamTheme.c, library/clamTheme.tcl: Use "field" element instead of "border" for entry and combobox widgets. 2004-06-30 Joe English * generic/scrollbar.c, generic/widget.h, generic/widget.c: Factored out ScrollbarIdentifyCommand; usable in other widgets. 2004-06-29 Joe English * generic/clamTheme.c: BUGFIX/TWEAK: scrollbar arrows not properly centered in parcel. 2004-06-27 Joe English * generic/altTheme.c, generic/clamTheme.c, generic/tkElements.c, generic/tkTheme.h: Factored out common code DrawArrow(), ArrowSize(). 2004-06-26 Joe English * library/entry.tcl: BUGFIX: selection anchor drifted when dragging across it. * generic/entry.c, library/entry.tcl: scan, selection from, and selection adjust commands moved from C to Tcl. (These commands are only needed for compatibility). 2004-06-20 Joe English * macosx/aquaTheme.c, library/aquaTheme.tcl: Added support for TEntry widget on OSX. 2004-06-19 Joe English * library/winTheme.tcl, library/xpTheme.tcl: Use system colors for -selectbackground and -selectforeground options. Tweaked button padding and width for XP buttons. 2004-06-18 Joe English * library/entry.c: Query current style for foreground, selection, and insert cursor colors * generic/tkTheme.c, generic/tkTheme.h: Added TTK_LayoutStyle(), TTK_QueryStyle(). * library/defaults.tcl, library/clamTheme.tcl, library/defaults.tcl: Add entry colors. 2004-06-18 Joe English * library/entry.tcl: Overhauled bindings. Button-2 scanning now implemented entirely in Tcl; internal selection anchor ([$e selection from], [$e selection to], [$e selection adjust]) no longer used. * library/entry.c: Not changed, actually. Unused 'scan' and 'selection' methods kept around, for BWidget compatibility. 2004-06-17 Joe English * library/notebook.tcl: figured out why Control-Shift-Tab Notebook binding wasn't working: XFree86 ISO_Left_Tab brokenness. Fixed now. * generic/entry.c: + BUGFIX: never displayed selection if -exportselection was false. + Reposition layout as soon as 'xview' command called. 2004-06-16 Joe English * generic/entry.c: Make sure 'xview' command returns up-to-date information, even if widget hasn't been redisplayed (see test entry-3.2). Fix [scan dragto] corner case. * generic/entry.c: Fix off-by-one bug in EntryVisibleRange(): Tk_PointToChar() returns [0 .. numChars], *not* [0 .. numChars-1] as the documentation indicates. Double-checked other calls to Tk_PointToChar(). 2004-06-16 Joe English * win/xpTheme.c, library/xpTheme.tcl: Added XP-style entry widgets. * win/winTheme.tcl: Tweaked. * library/entry.tcl: workaround: Command modifier matches NumLock on Windows. 2004-06-15 Joe English * generic/entry.c, library/fonts.tcl: Add symbolic font TkTextFont (not defined in TIP #145), so entry widgets can use the right font (non-bold) on X11. (It would probably be easier to just drop the Motif L&F and use a medium-weight font like everyone else does...) 2004-06-14 Joe English * generic/entry.c, library/entry.tcl: (new files) Added entry widget. * generic/compat.h: Regenerated. * generic/altTheme.c: New FieldBorder element, for entry widget * generic/tkElements.c: * generic/blink.c (new file), generic/widget.h: Added BlinkCursor utility. * generic/widget.h, generic/widget.c: Factored out WidgetEnsembleCommand. 2004-06-11 Jeff Hobbs * configure, configure.in: add MACOSX build variant info * Makefile.in: add fonts.tcl to PKG_TCL_SOURCES and aquaTheme.c for MACOSX builds. 2004-06-11 Joe English * generic/tkTheme.h, generic/tkstate.c, generic/tile.c, demos/demo.tcl, tests/tile.test: Added 'readonly' state 2004-06-10 Joe English * tkTheme.c, tkElements.c: TTK_GetTheme(interp, NULL) no longer returns default theme. Use TTK_GetDefaultTheme() instead. * tkTheme.c: Factored BuildResourceMap() out of NewElementInstance() * tkTheme.c(BuildResourceMap): Ignore accidental mismatches caused by prefix-matching in TkGetOptionSpec (e.g. "-textvariable" matching "-text"). 2004-06-09 Joe English * library/fonts.tcl: New file. * library/tile.tcl, library/defaults.tcl, library/altTheme.tcl, demos/themes/*.tcl: Changed "ButtonFont" to TkDefaultFont, as per TIP #145. Slightly cleverer heuristics to guess what to use as default font. * * * POTENTIAL INCOMPATIBILITY * * * Custom themes using "ButtonFont" must use TkDefaultFont instead. 2004-06-06 Joe English * generic/tkTheme.h, generic/tkElements.c, generic/altTheme.c: Removed old/deprecated TTK_LAYOUT_* macros 2004-06-06 Joe English * generic/button.c: BUGFIX: setting -default option incorrectly triggered -state option processing. 2004-06-05 Joe English * tools/optiondiff.tcl, generic/compat.h(COMPAT_OPTION macro): Use distinct resource db names for compatibility options instead of "unused". This seems to fix the last of the fatal BWidget errors. 2004-06-05 Joe English * generic/button.c (-width option): Workaround for bug #967209 * generic/tkTheme.c: Partially disable element/widget option compatibility checks as workaround for workaround. * generic/notebook.c: BUGFIX: wrong type for notebook -padding option (caught by test nulloption-1.3) 2004-06-04 Joe English * demos/themes/blue.tcl: Added warning about using "blue" as a basis for building other pixmap themes. 2004-05-29 Joe English * generic/button.c: move "-anchor" option from Base to Label; -anchor now a compatibility option for buttons, checkbuttons, &c. * generic/compat.h: Regenerated. * generic/button.c, generic/tkElements.c, generic/pixmapTheme.c: BUGFIX: Turns out that the Tk_ImageChangedProc can't be NULL after all. 2004-05-16 Joe English * generic/button.c: button -width option needs to have NULL default so theme can specify default. 2004-05-14 Pat Thoyts * win/makefile.vc: Fixed bug #916398 - pkgIndex.tcl creation. 2004-05-11 Joe English * generic/frame.c: Add -width and -height options to frame, labelframe * generic/compat.h: Regenerated. This time with Tk 8.4, oops. * tools/optiondiff.tcl: Make sure Tk 8.4 is used to generate compatibility resources. 2004-05-10 Joe English * generic/button.c, generic/compat.h: Made label '-font' and '-foreground' options compatibility resources instead of real resources. * demos/demo.tcl: Reworked 'Theme' menu * generic/button.c: Added default values for options -width, -borderwidth, -relief; try to improve BWidget compatibility. 2004-04-28 Pat Thoyts * Makefile.in: Added missing clamTheme.tcl (spotted by Neil Madden) 2004-04-27 Joe English * generic/frame.c(FrameOptionSpecs),generic/button.c(LabelOptionSpecs): -background is now a compatibility resource * tools/optiondiff.tcl: BUGFIX: correctly compute defaults for synonym options; widget defaults enabled by default now. * generic/compat.h: Regenerated. Tile should now be compatible with the BWidget toolkit. Drawback: "-background" widget option for frames and labels is no longer effective. 2004-04-27 Pat Thoyts * generic/notebook.c: Add stdio.h for sprintf and sscanf prototypes. * generic/scale.c: * win/monitor.c: Only define WIN32_LEAN_AND_MEAN for MSVC. * win/winTheme.c: * win/xpTheme.c: * demos/themes/blue.tcl: Added some more images to the blue theme for scrollbar, slider and progress bar elements. 2004-04-25 Joe English * generic/clamTheme.c, library/clamTheme.tcl: Added notebook elements. Minor display tweaks. 2004-04-23 Joe English * generic/compat.h, generic/frame.c(Labelframe): Added support for -labelwidget option. * tests/labelframe.test: (new file) Tests for the above. 2004-04-23 Joe English * generic/clamTheme.c, library/clamTheme.tcl: New theme, inspired by the XFCE family of GNOME themes. 2004-04-22 Joe English * library/notebook.tcl, doc/notebook.n: Added [tile::notebook::enableTraversal] procedure; enables mnemonic activation for notebook tabs and bindings. * demos/demo.tcl: added mnemonics to a couple of tabs in demo. 2004-04-22 Jeff Hobbs * generic/notebook.c (TabOptionSpecs): add -underline option for tabs * library/winTheme.tcl: make select tab "raised" 2004-04-05 Joe English * generic/altTheme.c, generic/tkElements.c: Added "-shiftrelief" to Padding element; removed Pressable/PushableBorderElement. * generic/tkTheme.h, generic/layout.c: TTK_RelievePadding takes an extra parameter. * generic/layout.c(TTK_RelievePadding): BUGFIX: was shifting relief by twice as much as it should have. * generic/altTheme.c win/winTheme.c, win/xpTheme.c: "Highlight" element renamed to "Focus" element. "Highlight" now refers (only) to external ring (default indicator, focus indicator in classic theme). * win/xpTheme.c: Added workaround for bogus results from GetThemePartSize(). * win/xpTheme.c: Removed FocusElement; can inherit from winTheme.c * win/xpTheme.c: Account for borderwidth in Labelframe.border. 2004-04-03 Joe English * macosx/aquaTheme.c: added native progress bar and scale elements; Tweaked Notebook element layouts; geometry should be correct now. Added background pattern. Fixed off-by-one bug in BoxToRect; add extra padding around buttons to account for drop shadow. * generic/layout.c: For layout nodes with children, use max(node size, child size + padding) for width, height. * generic/layout.c: Added TTK_AddPadding 2004-03-31 Joe English * generic/tile.c: BUGFIX: don't provide package tile unless init script succeeds. * generic/widget.c(CoreEventHandler): Compress events: don't schedule redisplay until the last one arrives. Also mini-bugfix: 'Expose' and 'Configure' events shouldn't share the same switch branch (see 2004-03-16 change). 2004-03-31 Pat Thoyts * win/winTheme.c: For some reason the windows stuff stopped building * win/xpTheme.c: on my Win2k system. Adding WIN32_LEAN_AND_MEAN * win/monitor.c: fixes the build. * demo/themes/blue: Redid the radio and check button pixmaps. 2004-03-29 Joe English * generic/notebook.c: BUGFIX: [$notebook tabconfigure ...] didn't redisplay widget. 2004-03-28 Joe English * generic/frame.c: BUGFIX: get border width from theme, not from -borderwidth resource. * macosx/aquaTheme.c, library/aquaTheme.tcl: Redid button elements, added notebook and labelframe elements. Accounted for focus, default buttons, background/inactive widgets, lots of other enhancements. 2004-03-28 Joe English * generic/tkstate.c, generic/tkTheme.c, doc/widget.n: New TTK_STATE values: "background", "indeterminate", "invalid", "default". * generic/button.c(ButtonConfigure): Track TTK_STATE_DEFAULT. * win/xpTheme.c: ButtonElement no longer needed, use GenericElement instead. * generic/widget.c(CoreEventProc): Track ActivateNotify, DeactivateNotify, set TTK_STATE_BACKGROUND. * macosx/aquaTheme.c: Use TTK_STATE_BACKGROUND, TTK_STATE_INDETERMINATE 2004-03-28 Joe English * generic/configure.in: More tweakage in an attempt to recognize MacOSX. * generic/configure: regenerated. 2004-03-27 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.4 * generic/configure: Regenerated. 2004-03-27 Joe English * macosx/aquaTheme.c, library/aquaTheme.tcl, library/tile.tcl, generic/widget.h, demos/demo.tcl: First cut at native OSX Aqua theme, using Appearance Manager API. 2004-03-27 Joe English === TILE 0.3 TAGGED FOR RELEASE === 2004-03-27 Joe English * ./Makefile.in: Added menubutton.tcl to PKG_TCL_SOURCES; removed unused fossil $(AM_xxx) references. 2004-03-27 Joe English * generic/altTheme.c, generic/tkElements.c: Use -arrowsize instead of -width for arrow elements. 2004-03-22 Joe English * win/xpTheme.c: Use TP_SPLITBUTTON and TP_SPLITBUTTONDROPDOWN for menubuttons. * generic/altTheme.c: Lose the vertical separator in Menubutton.indicator. * library/winTheme.tcl, library/xpTheme.tcl: More spacing tweaks. Still not quite right. * demos/demo.tcl: Moved toolbar compound control from side control panel into toolbar. 2004-03-21 Joe English * generic/gunk.h: Check for MAC_OSX_TK. 2004-03-21 Joe English * generic/tile.c, generic/widget.h, generic/button.c: Recognize "-state active" compatibility option. Accept all "-state" values, interpret as "normal". 2004-03-20 Joe English * tools/optiondiff.tcl: Tried adding default values for compatibility resources. BWidgets still breaks. Disabled feature, compile with -DCOMPAT_DEFAULTS to reenable. * generic/compat.h: regenerated. * generic/tkTheme.c, generic/tkTheme.h: Ignore compatibility resources when filling in element options. 2004-03-20 Joe English * library/tile.tcl, library/button.tcl: Moved button-specific 'activate' procedure into button.tcl. Don't generate <> and <> events; I forget what these were for in the first place. 2004-03-18 Joe English * library/defaults.tcl, library/altTheme.tcl, library/winTheme.tcl, library/xpTheme.tcl: Added Toolbutton style. * demos/demo.tcl, demos/toolbutton.tcl: Added demonstration of how to define custom styles. 2004-03-16 Joe English * generic/widget.c: *Correct* workaround for geometry problems in the XP theme. Sigh. 2004-03-16 Joe English * generic/widget.c: Call UpdateLayout() on the first ConfigureNotify event, to work around geometry problems in the XP theme and missing <> events. 2004-03-17 Pat Thoyts * win/makefile.vc: Added a demo target. 2004-03-15 Joe English * library/menubutton.tcl: BUGFIX: wasn't clearing active state. Reverse post direction if menu would extend off-screen. 2004-03-14 Joe English * library/menubutton.tcl, library/winTheme.tcl, library/xpTheme.tcl, win/winTheme.c, win/xpTheme.c, generic/altTheme.c: Ported menubutton implementation to windows: Made bindings platform-specific bindings to avoid [grab]-related lockups with native menus. Added native-ish XP menubutton (sort of). 2004-03-14 Joe English * library/menubutton.tcl: New file * generic/button.c, generic/altTheme.c, generic/tkElements.c, library/altTheme.tcl, library/defaults.tcl, library/stepTheme.tcl, library/tile.tcl: Added menubutton widget 2004-03-14 Joe English * library/scale.tcl: Make sure State array is properly initialized, in case we get an unexpected B1-Motion event (various conditions involving grabs can cause this). 2004-03-14 Joe English * generic/tkElements.c, generic/tkTheme.h, win/winTheme.c, win/xpTheme.c: Made NullElement public. 2004-03-14 Joe English * generic/cache.c, generic/tkTheme.h, generic/tkTheme.c BUGFIX: Tk_GetImage() interp parameter must not be NULL, otherwise errors (e.g., missing image) cause a coredump. Use Tcl_BackgroundError() instead. 2004-03-13 Joe English * generic/altTheme.c: Finally worked out all the off-by-one bugs in scrollbar arrows. I think. 2004-03-12 Joe English * tools/optiondiff.tcl, generic/compat.h: Added. * generic/button.c, generic/frame.c, generic/scrollbar.c: Experiment: added Tk 8.4 compatibility resources to all widgets. 2004-03-09 Joe English * generic/configure.in, generic/aclocal.m4: Autocruft removal: moved contents of aclocal.m4 into configure.in. * generic/configure: Regenerated * generic/button.c, generic/frame.c: Use "Pad" as -padding option class, for (forward-) compatibility. 2004-03-09 Joe English * win/xpTheme.c, win/winTheme.c: Fixed. 2004-03-09 Joe English * generic/tkTheme.h, generic/tkTheme.c, generic/altTheme.c, generic/tkElements.c, generic/layout.c, generic/stepTheme.c, generic/notebook.c, generic/pixmapTheme.c, win/winTheme.c, win/xpTheme.c: Changed ElementDrawProc() signature to take a TTK_Box instead of separate x,y,width,height parameters. * Removed adjustAspect(), adjustPadding(); added TTK_AnchorBox. * Various cleanup. 2004-03-06 Joe English * doc/Geometry.3: added. * doc/man.macros: Imported from tcl/doc/man.macros r1.4 * generic/tkTheme.h: Renamed TTK_PlaceBox() to TTK_StickBox(); changed signature of TTK_RelievePadding(). 2004-03-05 Joe English * Imported "kroc" theme, contributed by David Zolli 2004-03-02 Joe English * generic/Makefile.in: tcl.m4 r1.41 changed LIBS to PKG_LIBS; missed that earlier. 2004-02-28 Joe English * doc/*.n: Updated documentation slightly. * generic/widget.c, tests/tile.test: Error detection when changing -style option. (Theme changes with custom styles still not handled correctly). 2004-02-28 Joe English * generic/button.c: Refactoring: Split Label widget up into Base part and Label part; other widgets inherit from Base instead of Label. Moved -relief option to Label widget. Label widget gets extra appearance-related resources since those tend to be customized by the application more. * generic/notebook.c: Removed -anchor, -font, and -padding Tab options. 2004-02-22 Joe English * generic/cache.c, generic/tkTheme.h: Added TTK_RegisterNamedColor(); initial support for named colors. * win/monitor.c: Register Windows system colors as named colors whenever we receive a WM_SYSCOLORCHANGED message. 2004-02-22 Joe English * generic/tkTheme.c, generic/tkTheme.h: Added TTK_UseTheme() * win/monitor.c: Always (try to) set xpnative theme on WM_THEMECHANGED 2004-02-21 Joe English * (all): First cut at user-defined -style support * generic/tkTheme.c, generic/tkTheme.h: Add a Tcl_Interp* parameter to TTK_CreateLayout(), place to leave error messages. * generic/widget.c, generic/widget.h: getLayoutProc signature changed. Default getLayoutProc now uses -style option if set. * generic/notebook.c, generic/scale.c, generic/scrollbar.c: Updated other widgets for API change. (NB: notebook, scale, and scrollbar don't support custom -styles yet). * demos/demo.tcl: Added Toolbar.Button, Toolbar.Checkbutton custom styles to demo. * win/xpTheme.c, library/xpTheme.tcl: Added native toolbar buttons on Windows XP. Minor layout tweaks to XP theme. 2004-02-21 Joe English * win/xpTheme.c: Hardcode element padding instead of using GetThemeMargins(). * generic/layout.c, generic/tkTheme.h: Add TTK_MakePadding utility. 2004-02-21 Joe English * win/xpTheme.c, library/xpTheme.tcl: Reorganized and simplified XP Theme. More elements use GenericElementSpec now. Finally got GetThemeMargins to work (trick: use TMT_CONTENTMARGINS), except for the fact that GetThemeMargins just plain doesn't work. * win/xpTheme.c, win/winTheme.c, library/tile.tcl, demos/demo.tcl: Use package names "tile::theme::xpnative" and "tile::theme::winnative". 2004-02-20 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h, win/makefile.vc: Bumped version number to 0.3 * configure, generic/configure: Regenerated. 2004-02-20 Joe English * library/altTheme.c: Minor tweaks to notebook appearance. * generic/notebook.c: Minor tweaks. 2004-02-20 Joe English * generic/tkTheme.c: BUGFIX: defaultTheme->parentPtr was not initialized properly. * generic/layout.c(TTK_BuildLayout): Tcl_Panic() if an element cannot be found. This is a temporary solution. * generic/tkElements.c: Update Scale layouts. 2004-02-19 Joe English * generic/xpTheme.c: BUGFIX: TTK_StateTableLookup doesn't like NULL state tables. 2004-02-18 Joe English * generic/layout.c, generic/tkTheme.h, generic/altTheme.c, generic/tkElements.c, win/winTheme.c: Factored out TTK_RelievePadding. * generic/altTheme.c, win/winTheme.c, win/xpTheme.c, generic/tkTheme.h, generic/tkstate.c: Factored out TTK_StateTableLookup. * generic/altTheme.c, generic/stepTheme.c: remove incorrect assignment gcvalues.line_style = JoinMiter 2004-02-18 Joe English * library/tile.tcl, library/altTheme.tcl, library/defaults.tcl, library/stepTheme.tcl, library/winTheme.tcl, library/xpTheme.tcl: Moved default -font specification from option database into themes. * generic/button.c, generic/frame.c: -font option is NULL by default 2004-02-18 Joe English * generic/tkTheme.c: always USE_CACHE. Removed now-dead code. * generic/cache.c(TTK_ClearCache): BUGFIX: NULLs may appear in cache. 2004-02-17 Joe English * demos/demo.tcl: Use 'eval [package unknown] ...' ([package unknown] is a command prefix) 2004-02-16 Joe English * generic/tkElements.c: Fix #898371 "problem displaying non-english characters" 2004-02-16 Joe English === TILE 0.2 TAGGED FOR RELEASE === 2004-02-16 Joe English * configure.in, generic/configure.in, generic/Makefile.in, generic/tkTheme.h, win/makefile.vc: Bump version number to 0.2 * configure, generic/configure: Regenerated. 2004-02-16 Joe English * configure.in: don't set TCL_PKGPATH (not used anywhere). 2004-02-15 Joe English * generic/altTheme.c(ReliefElement): Handle border widths other than 2. * generic/frame.c: Update geometry when -borderwidth changed. 2004-02-15 Joe English * doc/*.*: Added as much documentation as I could stand to write ... * README.txt: Updated. 2004-02-15 Joe English * demos/demo.tcl: Added 'Widget State...' dialog, for tracking/changing widget states. 2004-02-15 Joe English * generic/tile.c, generic/widget.h: Reserve space for "-cursor" option, so "$w cget -cursor" works. 2004-02-13 Joe English * library/tile.tcl: Add aliases "tile::widgetclass" for each widget "twidgetclass". Idea: users can try 'namespace import tile::*' 2004-02-13 Joe English * doc/notebook.n: Added. 2004-02-13 Joe English * generic/notebook.c: BUGFIX: 'end' is not a legal index for most operations (bonehead mistake). 2004-02-13 Joe English * generic/layout.c(TTK_PlaceBox, TTK_PackRight): BUGFIX: don't allocate boxes larger than the containing parcel (fixes #896703) 2004-02-12 Joe English * generic/frame.c: BUGFIX: Confused 'mask' and 'flags' members of struct Tk_OptionSpec. 2004-02-12 Joe English * generic/tkTheme.c: Remove CloneElementImpl(); not needed since getting rid of [style elementconfigure] Added [style element names]. 2004-02-12 Joe English * generic/button.c: Use Tk_GetImage in LabelConfigureProc(); this fixes the last of the major known performance problems. 2004-02-12 Joe English * generic/cache.c, generic/pixmapTheme.c: Add caching for images as well. * generic/cache.c, generic/tkTheme.c: And Tk_3DBorders. * generic/cache.c: Factored out boilerplate code. 2004-02-12 Joe English * generic/cache.c (new file), generic/tkTheme.c: Added resource cache; attempt to solve bug #893844 2004-02-12 Joe English * generic/tkTheme.c: BUGFIX: NewStyle doesn't take any arguments. [ Apparently Jeff was fixing this bug at the same time I was, see next ChangeLog entry :-) ] * tclconfig/tcl.m4: Add -Wstrict-prototypes to gcc's CFLAGS_WARNING, which would have caught the above bug. * generic/layout.c(NewLayoutOp): Fix problem caught by above. * generic/configure: Regenerated. 2004-02-12 Jeff Hobbs * generic/tkTheme.c (NewStyle): specify args for NewStyle so cranky compilers don't error out. 2004-02-11 Joe English * generic/altTheme.c: Change checkbutton and radiobutton layouts to always use (the equivalent of) -anchor w instead of -anchor center. 2004-02-11 Joe English * generic/themes/blue.tcl: Tweaked notebook settings. Use "NeXT-style" scrollbars, as a demonstration of how to do this in script-defined themes. 2004-02-11 Joe English * generic/tkElements.c: Fixed LabelElement geometry management so that -anchor and -width work together. 2004-02-11 Jeff Hobbs * configure: * tclconfig/tcl.m4: updated to r1.44, fix TCL_INCLUDES on Windows 2004-02-11 Joe English * generic/notebook.c, library/notebook.tcl, tests/notebook.test, demos/demo.tcl: Renamed [$nb raise $pane] to [$nb select $pane] (advice from dkf). 2004-02-11 Pat Thoyts * win/makefile.vc: Use tkstubs if building against Tk 8.5. * generic/altTheme.c: Use the new-style layout specification to get the highlight drawn close to the text. 2004-02-10 Joe English * generic/button.c: Moved "-relief" option from TButton to parent class TLabel. It might move around again. * demos/demo.tcl: Uncovered another bug: -anchor and -width do not mix well. Need to investigate further. 2004-02-10 Joe English * generic/button.c, generic/tile.c, generic/widget.h: Added -state option to labels, buttons, checkbuttons, and radiobuttons for compatibility with standard Tk widgets. 2004-02-10 Joe English * win/winTheme.c, library/winTheme.tcl: Tweaks to make buttons look (almost) correct. (Focus ring still drawn in the wrong color) 2004-02-10 Jeff Hobbs * Makefile.in: add missing stepTheme.tcl lib file and change install-doc to install-html and make install-doc a noop for now. * configure: Updated to TEA3 spec with minor mods to make * configure.in: things work with private headers better. * tclconfig/tcl.m4: 2004-02-10 Joe English * generic/tkTheme.c: Added [style theme names] command * generic/tkTheme.c, others: Default theme now named "default" instead of (in addition to) "". 2004-02-10 Joe English * generic/tkElements.c, generic/altTheme.c, generic/notebook.c, demos/themes/Aquativo.tcl, demos/themes/WinXP-Blue.tcl, demos/themes/blue.tcl: Renamed "compound" element to "label" element. 2004-02-10 Joe English * generic/tkElements.c: Fix display glitch in button default ring (classic theme). * generic/tkTheme.h: Remove redundant #defines 2004-02-09 Joe English * generic/tkTheme.c, generic/tkTheme.h: Use TK_OPTION_STRING for "match-any" element option types instead of TK_OPTION_END. 2004-02-09 Joe English * (all): Dead code removal: * generic/pixmapTheme.c: Removed SkinObjCmd (use 'style' instead) * generic/tkTheme.c: Removed [style info layout], TTK_GetLayoutSpecFromObj * generic/pixmapTheme.c: Don't register "skin" theme (this isn't really a "theme", it's an "engine"); remove unused data structures. 2004-02-09 Joe English * (all): New API. style definetheme ==> style theme settings style createtheme ==> style theme create style settheme ==> style theme use style createelement ==> style element create style createlayout, style definelayout ==> style layout 2004-02-09 Joe English * (all): Use namespace "tile" instead of namespace "Tile". 2004-02-09 Joe English * generic/notebook.c: BUGFIX: Notebook didn't respond properly to <> messages. 2004-02-08 Joe English * generic/widget.h, generic/widget.c, generic/scrollbar.c, generic/scale.c, generic/button.c, generic/frame.c, generic/notebook.c: Refactoring: removed WidgetSetLayout, added getLayoutProc hook. * generic/widget.c, library/tile.tcl: Use <> virtual event to notify widgets of theme change, instead of the [$w configure -style [$w cget -style]] hack. 2004-02-07 Joe English * library/stepTheme.tcl: Make selected notebook tab larger than the others. * generic/notebook.c: Mods to make the above work. * generic/tkTheme.h, generic/layout.c: TTK_LayoutReqSize() now takes a 'state' parameter, to make the above work. Fixed argument order of TTK_LayoutGeometry while I'm at it. 2004-02-07 Joe English * doc/*.n: First cut at actual documentation! 2004-02-05 Pat Thoyts * demos/themes/pkgIndex.tcl: Don't provide pixmap theme packages if the image subdirectory does not exists. Fixes missing Gtk themes. * demos/demo.tcl: Fixed error in the demo script that caused incorrect display of the vertical progress widget at startup. 2004-02-04 Pat Thoyts * generic/scale.c: Fix the position of the scale label text. Also cleaned some warnings from VC++ concerning double to int conversion. 2004-02-03 Joe English * generic/Makefile.in: added missing @TK_XINCLUDES@ * generic/layout.c: BUGFIX: off-by-one error in TTK_BoxContains. * generic/notebook.c: Track active tab. (@@@ NOTE this is a tiny bit glitch-prone.) 2004-02-03 Joe English * generic/layout.c(TTK_ParseLayout): made -sticky news the default. * demos/themes/*.tcl: added focus ring; simplified some; other tweaks. 2004-02-03 Joe English * generic/tkTheme.c, generic/tkTheme.h: Added TTK_RegisterElementFactory(), [style createelement $name $type] * generic/tkTheme.c: add [style createtheme] * generic/pixmapTheme.c: Use TTK_RegisterElementFactory() * demos/themes/blue.tcl: Updated to use new API 2004-02-02 Joe English * generic/notebook.c, library/defaults.tcl, library/stepTheme.tcl, win/xpTheme.c: Use "Tab.TNotebook" and "Client.TNotebook" instead of "TNotebookTab" / "TNotebookClient". * generic/notebook.c: Another attempt to make borderwidth > 1 work properly. Still not completely right. * generic/altTheme.c: Better-looking notebook tabs. 2004-02-02 Joe English * generic/notebook.c: BUGFIX: bonehead error in RemoveTab() * generic/Makefile.in: added 'valgrind' target * tests/scrollbar.test, tests/tile.test: change to work with -singleproc true. 2004-02-01 Joe English * win/monitor.c: made internal routines 'static'. * win/xpTheme.c, generic/tkTheme.h, generic/tkTheme.c: Move clientData parameter from Theme to ThemeEnabledProc 2004-02-01 Joe English * demos/demo.tcl, generic/stepTheme.c, generic/altTheme.c: More tweaks to scrollbars. Still not quite right, but a bit simpler. 2004-02-01 Joe English * demos/themes/blue/button-n.gif: Fiddled with the GIMP, replaced this with a badly-done shaded doohickey. * demos/themes/blue/button-{h,p}.gif, others: Not changed, I'm through fiddling with the GIMP. 2004-02-01 Joe English * demos/demo.tcl: Create widgets in correct keyboard traversal order. Add "Track focus" dialog. * (all): Fix miscellaneous keyboard traversal and focus issues. * generic/button.c, generic/tile.c, generic/widget.h: "" now default -takefocus value; only traversable widgets have default "tile::takefocus". * generic/notebook.c: Draw tabs from outside-in. * generic/notebook.c, library/notebook.tcl: Fix focus and traversal issues. * library/tile.tcl (tile::takefocus): Return 0 if widget is not viewable (??? Why doesn't tk_focusNext/Prev handle this?) 2004-02-01 Joe English * generic/notebook.c: added -padding resource, [$nb forget], [$nb index current], [$nb index end], [$nb tabs], [$nb tabcget], [$nb tabconfigure]. * generic/layout.c: Added TTK_LayoutNodeInternalParcel(). 2004-01-31 Joe English * generic/layout.c: BUGFIX: off-by-one error in CountLayoutNodes. 2004-01-29 Joe English * generic/tkElements.c: Remove unused fields from CompoundElement. Separate ImageTextElement and TextElement instead of using ClientData hack in TextElement. * generic/tkTheme.c: Remove unused fields from struct Style. Remove unused routine TTK_FindStyle(). 2004-01-28 Joe English * generic/layout.c: Added TTK_ParseLayout(), TTK_ParseLayoutSpec(). * generic/tkTheme.c: Added [style definelayout] command. * demos/themes/blue.tcl: Changed to use [style definelayout] instead of [skin createlayout]. 2004-01-28 Joe English * generic/layout.c: Reorganized code. No substantive changes. 2004-01-28 Joe English * generic/tkTheme.h, generic/layout.c: Fixed layout engine algorithm. * generic/tkElements.c: Updated scrollbar layouts to use new layout scheme. * demos/demo.tcl: Added new demo showing why this makes a difference. 2004-01-27 Joe English * generic/layout.c(TTK_GetPaddingFromObj): Replaced screwball code with something more sensible. What was I thinking? 2004-01-27 Joe English * generic/tkTheme.h(TTK_Box): Rename "h" and "w" fields to "height" resp. "width". Should have done this a while ago... * generic/frame.c, generic/layout.c, generic/notebook.c, generic/pixmapTheme.c, scale.c, generic/scrollbar.c: Updated. 2004-01-27 Joe English * generic/altTheme.c generic/tile.c generic/tkElements.c generic/tkTheme.h win/xpTheme.c: Renamed TkGet{ButtonDefaultState,CompoundLayout}FromObj -> TTK_Get* * generic/layout.c: Added TTK_GetStickyFromObj(). * generic/notebook.c: Added -sticky option for tabs. * generic/tkTheme.c: Refactored StyleObjCmd/StyleInfoObjCmd to handle multi-level ensembles. 2004-01-26 Joe English * generic/tkTheme.h(TTK_CleanupProc): Removed unused Tcl_Interp parameter from TTK_CleanupProc's. * generic/pixmapTheme.c, generic/scrollbar.c, generic/tkTheme.c, win/monitor.c: Same. 2004-01-26 Joe English * generic/widget.h, generic/widget.c: Split 'displayProc' hook into separate 'layoutProc' and 'displayProc' hooks. * generic/button.c, generic/frame.c, generic/notebook.c, generic/scale.c, generic/scrollbar.c: Updated accordingly. 2004-01-26 Joe English * tclconfig/tcl.m4: Upgrade to current version from sampleextension (r1.41 2003/12/10) * generic/Makefile.in, generic/configure.in, generic/pkgIndex.tcl.in: Updated to work with new tcl.m4. * generic/configure: regenerated *** INCOMPATIBILITY: ./configure.in, ./Makefile.in *** NOT UPDATED *** Couldn't get these to work. (Jeff?) 2004-01-26 Pat Thoyts * win/wintheme.c: Seems scrollbar buttons are flat when pressed. * library/winTheme.tcl: Progress bar should be COLOR_HIGHLIGHT. * win/xpTheme.c: Add frame/labelframe themed elements. I can't get the text correct yet so it's commented out. 2004-01-25 Joe English * demos/themes/WinXP-Blue.tcl: Removed duplicate "tab" element definition so the theme will load. Put "-background" and "-foreground" specifications back. Set Button.background padding to 4 to fix display glitch. 2004-01-25 Pat Thoyts * generic/pixmapTheme.c: Fixed the tiling code and added a minimum size option to sort out the pixmap based scrollbars. * demos/themes/Aquativo.tcl: Fixed themes to use new pixmap option. * demos/themes/WinXP-Blue.tcl: 2004-01-25 Joe English * demos/demo.tcl: Tweaked layout. * demos/themes/blue.tcl, demos/themes/blue/*.gif: Tweaked appearance. "blue" theme is now *really* blue. 2004-01-25 Joe English * generic/frame.c, demos/demo.tcl: Added TLabelframe widget. * generic/layout.c: Added TTK_PlaceBox and TTK_FILL_* defines. * generic/tkElements.c: TextElement now optionally clears background area before drawing text. 2004-01-25 Joe English * demos/demo.tcl, demos/themes/*.tcl, generic/stepTheme.c: use 'tile::theme::$themeName' instead of 'tile::$themeName' for theme package names. 2004-01-24 Joe English * demos/themes/WinXP-Blue.tcl: Miscellaneous tweaks. Added "tab" element for Notebook widget. 2004-01-24 Joe English * generic/frame.c, demos/demo.tcl: Added TFrame widget, which turned out to require a lot more changes than I would have thought: * generic/widget.h: GeometryProc renamed to SizeProc; unused TTK_Padding argument removed. SizeProc now returns 1/0, indicating whether the widget should make a geometry request or not, to prevent excessive recalculations. * generic/widget.c, generic/tile.c: All widgets now take a -class resource. Which means we also have to implement: * generic/widget.c, generic/widget.h: New READONLY_OPTION mask bit for widget OptionSpecs. 2004-01-22 Joe English * win/xpTheme.c: Removed unused 'clientData' member from GenericElementData. * generic/scale.c, generic/tkElements.c, win/xpTheme.c: Un-merge horizontal and vertical scale elements again; changed layouts to select appropriately-oriented element. * win/xpTheme.c: use 'winnative' as the parent theme. 2004-01-22 Joe English * library/winTheme.tcl: Fix line endings. * generic/gunk.h: Add missing include files. 2004-01-22 Joe English * generic/winTheme.c, library/winTheme.tcl: Added first cut at Windows-native theme [from Patch #875243] 2004-01-22 Pat Thoyts * generic/tkTheme.c: Added introspection of layouts to return a list as used for the skin createlayout command. 2004-01-21 Joe English * demos/demo.tcl: Change checkbutton packing back to -expand x / -sticky ew again. Put theme list back in order. 2004-01-21 Pat Thoyts * demos/themes/Aquativo.tcl: Improved the theme import. * generic/pixmapTheme.c: Fixed the image tiling code. * demos/demo.tcl: Re-added the console showing. * demos/demo.tcl: Fix a bug in the previous demo cleanup. 2004-01-19 Jeff Hobbs * demos/demo.tcl: code cleanup. remove all use of pack gm. 2004-01-18 Pat Thoyts * generic/pixmapTheme.c: Use padding to prevent child pixmaps or * library/xpTheme.tcl: elements from overwriting the edges of * win/xpTheme.c: troughs. 2004-01-18 Joe English * demos/themes/WinXP-Blue.tcl: add a bit of padding and specify a minimum -width for buttons. 2004-01-17 Pat Thoyts * library/tile.tcl: Fix a couple of problems with the XP theme * library/xpTheme.tcl: using the new 'style default' command. * demos/themes/Aquativo.tcl: Trying to simplify the use of * demos/themes/WinXP-Blue.tcl: pixmap collections. We can unpack * demos/themes/blue.tcl: Gtk theme packs under demos/themes/ and use them unaltered. By keeping the tcl scripts in the same directory (demos/themes) we can generate the pkgIndex for them. 2004-01-16 Joe English * generic/altTheme.tcl: Tracked down performance problem with "alt" theme: notebook tabs were using a -font that wasn't used in a "real" widget, and hence wasn't cached. (@@@ Need to solve the general problem at some point). 2004-01-16 Joe English * generic/notebook.c, generic/scale.c, generic/tkTheme.c: Various bugfixes relating to window or area sizes <= 0. 2004-01-16 Joe English * generic/button.c, generic/tile.c, generic/tkElements.c, generic/widget.h: TilePart now gone. Added TLabel widget. * library/altTheme.tcl, library/defaults.tcl, library/stepTheme.tcl, demos/demo.tcl Tweaks to make toolbar buttons in demo continue to sort-of work. * library/tile.tcl, library/xpTheme.tcl: moved XP settings out of tile.tcl. 2004-01-16 Jeff Hobbs * configure: * configure.in (LIBS): add user32.lib for Windows 2004-01-16 Joe English * generic/scale.c, library/scale.tcl: Get trough border width from element, not from the widget resource (widget resource might not be used in all themes). 2004-01-15 Joe English * demos/demo.tcl, generic/altTheme.c, generic/scrollbar.c, generic/tile.c, generic/tkElements.c, generic/tkTheme.c, generic/widget.h, tests/tile.test, win/xpTheme.c: Removed the "Tile" widget; it has served its purpose. 2004-01-15 Joe English * generic/layout.c, generic/scrollbar.c, generic/scale.c: TTK_LayoutFindNode now only examines the last component of element names. 2004-01-16 Pat Thoyts * demos/themes/Aquativo.tcl: Added Gtk import theme. You should follow the instructions in the head of this file to fetch the theme package itself. 2004-01-15 Joe English * generic/pixmapTheme.c, demos/demo.tcl, demos/themes/blue/theme.tcl: Reorganized PixmapElement; [style elementconfigure] no longer used. * generic/tkTheme.c: Removed [style elementconfigure], and a whole bunch of now-dead code. * generic/tkTheme.c: Configuring a style now updates existing widgets (@@@ not immediately though; need to call WorldChanged) * generic/stepTheme.c: Specify minimum thumb size; fix horizontal scrollbar layout. 2004-01-15 Pat Thoyts * generic/pixmapTheme.c: Completed the tile-fill function. * generic/tkTheme.h: Put back support for theme client data for * generic/tkTheme.c: use in the xpnative theme. * demos/demo.tcl: Enable delayed loading of pixmap themes. * demos/themes/blue/theme.tcl: Some changes -- more to do. 2004-01-14 Joe English * generic/altTheme.c, generic/scale.c, generic/stepTheme.c, generic/tile.c, generic/tkElements.c, win/xpTheme.c: Simplified scrollbar, scale, and progressbar layouts. * library/altTheme.tcl, library/defaults.tcl, library/stepTheme.tcl, library/tile.tcl: Got rid of the last use of [style elementconfigure]. 2004-01-14 Joe English * generic/tkTheme.c: removed [style configure] command. * generic/tkTheme.c: BUGFIX: missing Tcl_IncrRefCounts in ResourceMap. (Actually this is a temporary workaround; real bug is that changes to styles don't have any effect on existing widgets). 2004-01-14 Joe English * library/altTheme.tcl, library/defaults.tcl, library/stepTheme.tcl, library/tile.tcl: Replaced all uses of [style configure] with [style map] or [style default]. Next to go: [style elementconfigure]. 2004-01-13 Joe English * generic/tkTheme.h, generic/tkTheme.c: Replaced TTK_SetThemeClientData() with TTK_RegisterCleanup(), themes can register an arbitrary number of cleanup hooks. * generic/pixmapTheme.c: Fixed memory leak introduced in last rev. 2004-01-13 Joe English * Added [style definetheme], [style map], and [style default]. Partially updated theme definitions to use these instead of [style configure], [style elementconfigure]. Also added memory leak. 2004-01-14 Pat Thoyts * demos/themes/blue/theme.tcl: Added image border option. * generic/pixmapTheme.c: Do tiling of the image. 2004-01-13 Pat Thoyts * generic/pixmapTheme.c: Correct Tk_Image handling in the GenericElement. Tk_GetImage and Tk_FreeImage must be paired. * Makefile.in: Added a pixmap theme engine along * generic/Makefile.in: with a really ugly demo theme 'blue' * generic/altTheme.c: under demos/themes/blue. * generic/notebook.c: * generic/pixmapTheme.c: This includes support for creating * generic/stepTheme.c: TTK_LayoutSpec descriptions from * generic/tile.c: a tcl list. See the blue/theme.tcl * generic/tkElements.c: file for a sample. * generic/tkTheme.c: * generic/tkTheme.h: * generic/widget.h: * library/pkgIndex.tcl: * library/tile.tcl: * win/Tile.dsp: * win/makefile.vc: * win/xpTheme.c: * demos/demo.tcl: * demos/themes/blue/*.gif: * demos/themes/blue/theme.tcl: 2004-01-12 Joe English * generic/button.c, generic/tkElements.c: Added -width resource for labels/buttons/&c; requested width (minimum width if negative) in characters. NB: only used if "-compound text" specified. 2004-01-12 Joe English * generic/tile.c, generic/button.c: Moved *button widget implementations into separate file. * generic/widget.h: made string tables for -orient, -default, and -compound resources global. * notebook.c: Removed unused "-side" option. 2004-01-12 Joe English * generic/tkTheme.c, generic/tkTheme.h: Removed TTK_GetThemeFromObj (dead code). 2004-01-11 Joe English * win/xpTheme.c: fix state map for notebook Tab elements. * generic/tkTheme.c (AllocateResources): Error detection. 2004-01-10 Pat Thoyts * generic/scale.c: Fixed progress bar geometry bug and got * generic/tkElements.c: the xp theme working. * generic/tile.tcl: Added themeing for the notebook elements. * win/xpTheme.c: The client element wont show up until we use a themed frame widget though. * demos/demo.tcl: Added more lines to show issues with scrollbar. * win/xpTheme.c: Created a generic oriented element. This resolves a problem with the vertical thumb and is useful for troughs and such. Scale themed with minor bugs to iron out. 2004-01-10 Joe English * generic/altTheme.c: Refactored BorderElementSpec. * generic/altTheme.c: Shadow colors for indicators. 2004-01-10 Pat Thoyts * generic/scale.c: Merged the vtrough/htrough elements. * generic/scrollbar.c: * generic/tkElements.c: * library/tile.tcl: * win/xpTheme.c: * demos/demo.tcl: Added progress widget. This is * generic/scale.c: really just a special case of the * generic/tkElements.c: scale widget. Some bugs to fix yet * generic/tile.c: and the slider needs fixing in * library/tile.tcl: all but classic theme. * library/scale.tcl: Added repeat motion for the scale. * win/xpTheme.c: Corrected slider breakage so it builds. 2004-01-09 Joe English * widget.c: Added postConfigureProc widget hook, for post-configuration operations that need to reenter the interpreter. * tile.c: -variable and -textvariable options now work properly (read when configured, not just when variable changes). 2004-01-09 Joe English * generic/scale.c: Set attached -variable and invoke -command in [scale set] (where it's safe) instead of in the Display callback (where it isn't). 2004-01-09 Joe English * generic/altTheme.c, generic/scale.c, generic/scrollbar.c, generic/stepTheme.c, generic/tile.c, generic/tkElements.c, generic/tkTheme.h, library/scrollbar.tcl, library/tile.tcl, win/xpTheme.c: Merged hslider/vslider and hthumb/vthumb elements. 2004-01-09 Joe English * all: Rename TK_WIDGET_STATE_* => TTK_STATE_*. * all: Rename "label" element => "text". 2004-01-08 Joe English * generic/trace.c: New file, split out from tile.c. 2004-01-08 Joe English * generic/notebook.c, library/notebook.tcl, tests/notebook.test, library/tile.tcl, demos/demo.tcl: Added an ugly but functional Notebook widget. * generic/layout.c, generic/tkTheme.h, generic/widget.c: Expose some TTK_Box-related layout functions needed by the above. 2004-01-07 Pat Thoyts * tkTheme.h: Added TTK_SetThemeClientData and * tkTheme.c: TTK_GetThemeClientData permit data to be associated with a theme engine. This also registers a deletion callback that is called when the theme is deleted. Added A TTK_SetThemeEnabledProc. This lets you register a function that is called during SetTheme. If this returns false, then the theme's parent is used (and checked too). This means XP can default to the alt theme if themeing is disabled. * win/monitor.c: New file implements an invisible window to catch global window messages from Windows. * generic/tile.c: Hook in the monitor window. 2004-01-06 Joe English * generic/track.c: various bugfixes; first version didn't work properly when mouse cursor dragged away from "pressed" element and then released. 2004-01-06 Joe English * generic/track.c: New utility, TrackElementState * generic/scrollbar.c, library/scrollbar.tcl: Updated TScrollbar to use TrackElementState; [$scrollbar elementstate] widget method no longer needed. * Scrollbar finally displays "active" state properly! 2004-01-06 Pat Thoyts * generic/tkElements.c: Permit variable width trough for win32 * library/tile.tcl: style scale (doesn't change geometry). * generic/tkTheme.c: Fix element lookup to look over multiple dot-separated names. eg: Z.x.y -> x.y -> y then lookup the same in the parent theme. * generic/scale.c: Improved the scale implementation. * generic/tkElements.c: Can now pick a slider style for all * win/xpTheme.c: styles. Made less of it hardcoded too. * library/scale.tcl: * library/tile.tcl: 2004-01-02 Joe English * generic/scrollbar.c, library/scrollbar.tcl: Removed -first and -last resources (no longer needed after thumb element simplified.) Removed -troughcolor resource. 2004-01-06 Pat Thoyts * generic/tkTheme.c: Change element lookup scheme to search parent themes for the full element name, then the generic name which fixes a problem in the scale widget which re-uses the trough element. 2004-01-06 Joe English * generic/tile.c: BUGFIX: failed to clean up -textvariable variable trace, leading to a crash. * tests/tile.test: added test case for above. 2004-01-05 Pat Thoyts * generic/scale.c: Added a themed scale widget. * library/scale.c: Scale widget bindings. * generic/tkElements.c: Added a slider element and implementation of troughcolor for troughs. Used by scale and scrollbar widgets. * generic/stepTheme.c: Playing with drawing 3D circles. * generic/tile.c: Added -bd and -bg short options. * generic/scrollbar.c: Implemented -troughcolor. * win/xpTheme.c: XP scale support. 2004-01-04 Joe English * library/scrollbar.tcl: BUGFIX: Button-2 scanning didn't work when scrollbar was attached to a real widget. * generic/scrollbar.c, library/scrollbar.tcl, generic/tkElements.c, generic/altTheme.c, generic/stepTheme.c, win/xpTheme.c: Move scrollbar thumb geometry calculations entirely into the scrollbar widget; thumb element implementations don't need to worry about first / last anymore. Minimum thumb size now works. * generic/layout.c, generic/tkTheme.h: Additional utilities needed to support the above. 2004-01-02 Joe English * demos/demo.tcl: Added compound checkbuttons to toolbars; demonstrating a conceptual error in the layout engine. * generic/altTheme.c: Workaround for above error. 2004-01-02 Pat Thoyts * demos/demo.tcl: Added a scrolled text widget to the client frames as I think this shows off the scrollbars more clearly to people unfamiliar with the code. Also hooked in a theme menu and the tile widget. * generic/altTheme.c: Added a subpackage declaration to enable introspection of the available themes. * win/xpTheme.c: Added local elements for the tile widget for testing purposes. * generic/layout.c: Themes may register new elements without * generic/tkTheme.h: registering new styles. So the element lookup * generic/tkTheme.c: (TTK_GetElement) must be given a starting theme and cannot just use the style's recorded theme. This error caused the xp theme to always use 'alt' elements. So by passing the current theme and style, we can find the correct element to use. 2003-12-30 Joe English * generic/layout.c, generic/tkElements.c, generic/tkTheme.c, generic/tkTheme.h, generic/widget.c, library/tile.tcl: Changed element resource lookup algorithm again; now examines settings from style. This is still not right, but getting closer to something sensible. * library/tile.tcl: Fix display of "active" and "pressed" states for check & radiobuttons. 2003-12-30 Joe English * generic/widget.c: Add WorldChanged ClassProc, so font changes are recognized. 2003-12-28 Joe English * generic/stepTheme.c: fix compiler warnings (signed vs unsigned) * library/tile.tcl, library/button.tcl: moved bindings for Button, Checkbutton, and Radiobuttons into separate file. 2003-12-13 Pat Thoyts * generic/altTheme.c: Make the focus ring a bit more like the windows focus ring. 2003-12-10 Pat Thoyts * generic/stepTheme.c: Implemented OPENSTEP style checkbutton * library/tile.tcl: and radiobutton indicators. * win/xpTheme.c: Fix the shading in the vertical thumb when pressed. Make xpnative a child of the alt theme. This makes the focus highlight more nearly correct and if themeing is disabled we should revert to the alt style anyway. 2003-11-29 Pat Thoyts * generic/tkElements.c: Replaced Scrollbar.trough with .vtrough and * win/xpTheme.c: .htrough as gradient fills are drawn differently for each orientation. Used in xpTheme so XP scrollbars now appear correct. * win/Makefile.vc: Added user.lib for DrawFocusRect. 2003-11-26 Joe English * generic/tkElements.c, generic/altTheme.c, library/tile.tcl: HighlightElement: only draw focus ring if widget has keyboard focus. * generic/layout.c, generic/scrollbar.c: Made TTK_LayoutNode opaque. 2003-10-28 Joe English * library/tile.tcl: Scrollbars should not take keyboard focus. * library/scrollbar.tcl: set thumb state to pressed on ButtonPresss-2 2003-10-26 Joe English * win/xpTheme.c: draw focus ring (in the wrong place) 2003-10-21 Joe English * Added -textvariable option. 2003-10-20 Joe English * generic/altTheme.c: scrollbar display tweaks. * library/scrollbar.tcl: clicking in trough scrolls by pages. 2003-10-20 Joe English * win/xpTheme.c, library/tile.tcl: Minor appearance tweaks for XP. 2003-10-20 Joe English * generic/scrollbar.c, generic/tkElements.c, library/tile.tcl, library/scrollbar.tcl: Added [scrollbar elementstate] command; "pressed / !pressed" feedback for individual scrollbar elements. 2003-10-20 Joe English * generic/layout.c: Changed layout specification internals. This is still Not Quite Right, but closer now. 2003-10-20 Joe English * generic/layout.c: Quick and dirty hack to layout engine to overcome fundamental design flaws. More comprehensive fix forthcoming... 2003-10-20 Pat Thoyts * generic/altTheme.c: Implemented a Highlight element to allow * generic/tkElements.c: placing the highlight in different parts * library/tile.tcl: of the layout. * generic/widget.h: Avoid XP code if the headers do not * win/xpTheme.c: support themeing. * win/makefile.vc: Added a working install target for win32. * demos/demo.tcl: Added some menu items as we'll want to look into this at some point. Included a 'console' item for win32. 2003-10-17 Joe English * Great Renaming: A "StyleEngine" is now called a "Theme". 2003-10-17 Joe English * Added TTK_GetDefaultTheme(), TTK_GetCurrentTheme(). * Added [style settheme $theme] command. Widget -style resource currently unused except to trigger a theme change; need to figure out what to do with this later. 2003-10-17 Joe English * tkTheme.[ch]: CHECKPOINT: halfway through implementing new "Style" data structure -- have to check in and go now. 2003-10-17 Joe English * widget.h, widget.c, tile.c: BUGFIX: recompute geometry when -compound, -text, and other geometry-influencing resources change. 2003-10-17 Joe English * Makefile.in, generic/Makefile.in: added 'install' target. 2003-10-16 Joe English * layout.h: merged into tkTheme.h * (all): Use 'TTK_' prefix for all style engine-related public symbols 2003-10-16 Joe English * tile.c(TileOptionSpecs): remove unneeded -highlightthickness, -highlightcolor resources. * demo/demo.tcl: remove dead code 2003-10-16 Joe English * Refactoring: consolidate common code into WidgetGeometry(), WidgetDisplay(). Removed TkDrawLayout(), TkLayoutGeometry() (no longer used). Added TTK_FreeLayout(), fixed memory leak. Added numerous subtle bugs. 2003-10-16 Pat Thoyts * win/xpTheme.c: Added XP themed scrollbar elements. * library/tile.tcl: Missing the gradient fill in trough. * generic/stepTheme.c: Isolated NeXTStep theme stuff to a new * win/makefile.vc: file and added a thumb element for this * generic/makefile.in in addition to the widget layout. * Makefile.in: * generic/scrollbar.c: Switch to registering widget layouts * generic/tile.c: per style engine. This allows a widget to * generic/tkElements.c: have different elements for different * generic/tkTheme.c: styles (think nextstep scrollbars) * generic/tkTheme.h: * generic/widget.h: * demos/demo.tcl: 2003-10-16 Joe English * generic/tile.c: _Correct_ proper error handling. Removed unnecessary -indicatorcolor resource from checkbuttons and radiobuttons. * library/tile.tcl: Better feedback for pressed checkbuttons in "classic" theme. 2003-10-15 Joe English * generic/widget.c: Proper error handling in widget 'configure' commands. * generic/tile.c: Proper error detection for bad -variable specifications. 2003-10-14 Joe English * library/keynav.tcl: Added comments. 2003-10-14 Pat Thoyts * win/xpTheme.c (InitElementData): handle creation of elements before they are mapped. * win/xpTheme.c: Fix type for VC++ building. 2003-10-13 Joe English * win/xpTheme.c: fix display glitches. 2003-10-13 Joe English * generic/altTheme.c, generic/scrollbar.c, generic/tkElements.c, library/scrollbar.tcl: Renamed up.arrow, &c, elements to uparrow &c. 2003-10-13 Joe English * license.terms: added. 2003-10-13 Joe English * tests/*.*: Patched so test suite runs again. 2003-10-13 Jeff Hobbs * generic/tkTheme.c: use tkInt.h only on Win32 * generic/tkTheme.h (NO_PRIVATE_HEADERS): defined for !WIN32 plats * generic/tkTheme.c: use tkInt.h to get stubs decl correct for TkGetOptionSpec usage. * Makefile.in (INCLUDES): add srcdir/generic to includes * win/xpTheme.c (ADDED): moved xpTheme.c to win/ subdir. * generic/guts.h (REMOVED): noted need for tkWinInt.h * generic/xpTheme.c (REMOVED): * aclocal.m4: TEA build system * configure: * configure.in: * Makefile.in: * generic/altTheme.c: cast correction 2003-10-13 Jeff Hobbs === Initial import into SourceForge CVS repository === 2003-10-12 Joe English * Scrollbars mostly working now. * Removed *settings resource, UpdateSettings -- do this in elements instead. 2003-09-26 Joe English * Several tweaks to make demo.tcl look reasonable. 2003-09-26 Joe English * src/tkTheme.c: Changed element lookup strategy (again): "Button.border" will look for "Button.border", then "border" in the current engine, then for "border" in the parent engine (instead of "Button.border"). This seems to work better. Realized that earlier restructuring had misimplemented the TIP 48 semantics. 2003-09-26 Pat Thoyts * src/xpTheme.c: Fix the XP theme so it builds. * src/widget.h: Fix the xpnative style to not crash. * src/tile.c: 2003-09-25 Joe English * src/altTheme.c: Use TkPutImage which works under Win32. * src/tkTheme.c: Renamed TkStylePkgFree to avoid a clash with the Tk internal function of this name. * win/Makefile.vc: * win/rules.vc: Provide a set of MSVC build scripts. * win/nmakehlp.c: 2003-09-16 Joe English * Initial implementation of a scrollbar. 2003-09-15 Joe English * Split "TilePart" up into "CorePart", "TilePart", and "LabelPart". Made more routines semi-public. Added three tenths of a scrollbar implementation. 2003-09-13 Joe English * Added -compound element. 2003-09-13 Joe English * Added -image element. 2003-09-13 Joe English * Minor style tweaks. 2003-09-13 Joe English * Added -underline option; added keyboard navigation package. 2003-09-12 Joe English * Fixed more check/radiobutton layout glitches. Layout manager didn't need that much of a rethink after all. 2003-09-12 Joe English * Added variable traces for check/radio buttons. Mostly functional now. 2003-09-12 Joe English * Imported code from TIP 109 implementation to draw better-looking radio / checkbuttons. (Not Quite Right, since the TIP 109 implementation needs to peek at Tk's internals to do its thing, and I took that bit out.) 2003-09-11 Joe English * Fixed some tcheckbutton layout glitches. 2003-09-11 Joe English * Added semifunctional, ugly tcheckbutton widget. Need to rethink layout manager now. 2003-09-11 Joe English * Added tbutton widget 2003-09-08 Joe English * tkTheme.c: renamed internal data structures and variable names to improve consistency. * tkTheme.c: removed custom Tcl_ObjType styleObjType (see tcl-core message for why). * tkTheme.c: removed last vestiges of ThreadSpecificData. * tkTheme.c: Store element implementations in a linked list instead of an array. * widget.c, tile.c: BUGFIX: setting -style to a nonexistent style crashed. Failed to propagate TCL_ERROR return codes. 2003-09-08 Joe English * Refactoring: attempt to split up generic & Tile-specific widget code. * 'WidgetCore' must be first member of widget structure; simplified WidgetCommandProc() signature accordingly. 2003-09-08 Joe English * Refactoring: extract Tk_StateMapLookup() from UpdateSettings(). 2003-09-08 Joe English * Added 'padding' element, Tk_GetPaddingFromObj(). 2003-09-07 Joe English * tile.c(TileWidgetCmd): Refactoring: replaced parallel enum/array and switch statement with Tcl_GetIndexFromObjStruct and indirect function call. 2003-09-07 Joe English * tkstate.c (WidgetStateSpecUpdateString): BUGFIX: coredump if mask == 0. 2003-09-04 Joe English * Make style engine responsible for extracting widget resources instead of element implementations (see tcl-core message for details). 2003-09-04 Joe English * Simplified element methods (see tcl-core message for details). 2003-09-03 Joe English * tkTheme.[ch]: Nuked Tk_NameOfStyle; YAGNI. 2003-09-03 Joe English * tkTheme.[ch]: Reorganized and simplified style engine data structures. As a side effect, also fixed bug #793825. 2003-09-02 Joe English * tkTheme.[ch]: Refactoring: replace two-level element lookup scheme with one-level TTK_GetElement. 2003-09-02 Joe English * tkTheme.[ch]: Cloned tk/generic/tkStyle.c; changed Tk_* to TTK_*, so I can modify style engine locally without having to patch the core. 2003-09-01 Joe English * Added support for -anchor option 2003-08-31 Joe English * Added "label" element, first cut at declarative layout utilities. 2003-08-29 Joe English * Initial snapshot release. tile-0.8.2/Makefile.in0000644000076500007650000001553010532406124014112 0ustar joejoe00000000000000# # @configure_input@ # #======================================================================== # The object files are used for linking into the final library. #======================================================================== GENERIC_OBJECTS = \ tkstate.$(OBJEXT) \ tile.$(OBJEXT) \ ttkStubInit.$(OBJEXT) \ separator.$(OBJEXT) \ frame.$(OBJEXT) \ button.$(OBJEXT) \ scrollbar.$(OBJEXT) \ progress.$(OBJEXT) \ scale.$(OBJEXT) \ notebook.$(OBJEXT) \ paned.$(OBJEXT) \ entry.$(OBJEXT) \ treeview.$(OBJEXT) \ layout.$(OBJEXT) \ widget.$(OBJEXT) \ trace.$(OBJEXT) \ track.$(OBJEXT) \ blink.$(OBJEXT) \ scroll.$(OBJEXT) \ manager.$(OBJEXT) \ tagset.$(OBJEXT) \ tkElements.$(OBJEXT) \ label.$(OBJEXT) \ altTheme.$(OBJEXT) \ classicTheme.$(OBJEXT) \ tkTheme.$(OBJEXT) \ cache.$(OBJEXT) \ image.$(OBJEXT) \ clamTheme.$(OBJEXT) WIN_OBJECTS = winTheme.$(OBJEXT) xpTheme.$(OBJEXT) monitor.$(OBJEXT) MACOSX_OBJECTS = aquaTheme.$(OBJEXT) PKG_OBJECTS = $(GENERIC_OBJECTS) @PKG_OBJECTS@ PKG_STUB_OBJECTS = ttkStubLib.$(OBJEXT) #======================================================================== # This is a list of public header files to be installed, if any. #======================================================================== PKG_HEADERS = generic/tkTheme.h generic/ttkDecls.h #======================================================================== # "PKG_LIB_FILE" refers to the library (dynamic or static as per # configuration options) composed of the named objects. #======================================================================== PKG_LIB_FILE = @PKG_LIB_FILE@ PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ BINARIES = $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE) SHELL = @SHELL@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ libdir = @libdir@ includedir = @includedir@ DESTDIR = PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) pkglibdir = $(libdir)/$(PKG_DIR) top_builddir = . INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ CC = @CC@ CFLAGS_DEFAULT = @CFLAGS_DEFAULT@ CFLAGS_WARNING = @CFLAGS_WARNING@ CLEANFILES = @CLEANFILES@ EXEEXT = @EXEEXT@ LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ MAKE_LIB = @MAKE_LIB@ MAKE_SHARED_LIB = @MAKE_SHARED_LIB@ MAKE_STATIC_LIB = @MAKE_STATIC_LIB@ MAKE_STUB_LIB = @MAKE_STUB_LIB@ OBJEXT = @OBJEXT@ RANLIB = @RANLIB@ RANLIB_STUB = @RANLIB_STUB@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_LD = @SHLIB_LD@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ STLIB_LD = @STLIB_LD@ TCL_SRC_DIR = @TCL_SRC_DIR@ TCL_BIN_DIR = @TCL_BIN_DIR@ TK_SRC_DIR = @TK_SRC_DIR@ TK_BIN_DIR = @TK_BIN_DIR@ # Not used by sample, but retained for reference of what Tcl required TCL_LIBS = @TCL_LIBS@ TK_LIBS = @TK_LIBS@ #======================================================================== # TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our # package without installing. The other environment variables allow us # to test against an uninstalled Tcl. Add special env vars that you # require for testing here (like TCLX_LIBRARY). #======================================================================== EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR):$(TK_BIN_DIR) TCLSH_ENV = TCL_LIBRARY="`@CYGPATH@ $(TCL_SRC_DIR)/library`" \ TK_LIBRARY="`@CYGPATH@ $(TK_SRC_DIR)/library`" \ TILE_LIBRARY="`@CYGPATH@ $(srcdir)/library`" \ @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \ PATH="$(EXTRA_PATH):$(PATH)" \ TCLLIBPATH="$(top_builddir)" TCLSH_PROG = @TCLSH_PROG@ WISH_PROG = @WISH_PROG@ TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) WISH = $(TCLSH_ENV) $(WISH_PROG) # The local includes must come first, because the TK_XINCLUDES can be # just a comment INCLUDES = @PKG_INCLUDES@ \ @TCL_INCLUDES@ @TK_INCLUDES@ @TK_XINCLUDES@ EXTRA_CFLAGS = @PKG_CFLAGS@ DEFS = @DEFS@ $(EXTRA_CFLAGS) CONFIG_CLEAN_FILES = Makefile CPPFLAGS = @CPPFLAGS@ LIBS = @PKG_LIBS@ @LIBS@ @MATH_LIBS@ AR = @AR@ CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/win:$(srcdir)/macosx all: package libraries package: $(PKG_LIB_FILE) pkgIndex.tcl libraries: $(PKG_STUB_LIB_FILE) # # Installation rules: # install : install-package install-libraries install-headers install-package : @mkdir -p $(DESTDIR)$(pkglibdir) $(INSTALL_PROGRAM) $(PKG_LIB_FILE) $(DESTDIR)$(pkglibdir)/$(PKG_LIB_FILE) $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir)/pkgIndex.tcl for p in $(srcdir)/library/*.tcl ; do \ destp=`basename $$p`; \ echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(pkglibdir)/$$destp; \ done install-headers: @echo "Installing header files in $(DESTDIR)$(includedir)" @mkdir -p $(DESTDIR)$(includedir) @list='$(PKG_HEADERS)'; for p in $$list; do \ echo "Installing $(srcdir)/$$p" ; \ destp=`basename $$p`; \ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(includedir)/$$destp ; \ done; install-libraries: @echo "Installing $(PKG_STUB_LIB_FILE) in $(DESTDIR)$(libdir)" @mkdir -p $(DESTDIR)$(libdir) $(INSTALL_PROGRAM) $(PKG_STUB_LIB_FILE) $(DESTDIR)$(libdir) # Test section. # TESTLOAD = -load "load ./$(PKG_LIB_FILE)" TESTFLAGS = # Piping to cat is necessary on Windows to see the output, and # harmless on Unix test: package libraries $(WISH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTLOAD) $(TESTFLAGS) | cat demo: package libraries $(WISH) `@CYGPATH@ $(srcdir)/demos/demo.tcl` shell: package libraries @$(WISH) $(SCRIPT) gdb: $(TCLSH_ENV) gdb $(WISH_PROG) $(SCRIPT) $(PKG_LIB_FILE): $(PKG_OBJECTS) -rm -f $(PKG_LIB_FILE) ${MAKE_LIB} $(RANLIB) $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) -rm -f $(PKG_STUB_LIB_FILE) ${MAKE_STUB_LIB} $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) .SUFFIXES: .c .$(OBJEXT) .c.@OBJEXT@: $(COMPILE) -c `@CYGPATH@ $<` -o $@ pkgIndex.tcl: (\ echo 'if {[catch {package require Tcl 8.4}]} return';\ echo 'package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \ [list load [file join $$dir $(PKG_LIB_FILE)] $(PACKAGE_NAME)]'\ ) > pkgIndex.tcl Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status #======================================================================== # Don't modify the file to clean here. Instead, set the "CLEANFILES" # variable in configure.in #======================================================================== clean: -test -z "$(BINARIES)" || rm -f $(BINARIES) -rm -f *.$(OBJEXT) core *.core -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean: clean -rm -f *.tab.c -rm -f $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log config.status .PHONY: all package clean depend distclean doc install libraries test # *EOF* tile-0.8.2/README.txt0000644000076500007650000000472310474076734013564 0ustar joejoe00000000000000 README.txt,v 1.8 2006/08/26 16:59:08 jenglish Exp ~ About: The Tile Widget Set is an experimental reimplementation of some of the core Tk widgets. The primary purpose is to generate ideas for how to build the next generation of Tk, when the asteroid strikes and we prepare for the 9.0 release. ~ Features: + A revised and expanded version of the TIP #48 style engine + Native look and feel under Windows XP + Native L&F under other Windows versions + "Revitalized" look and feel under Unix + scrollbar, button, checkbutton, radiobutton, menubutton, label, frame, and labelframe widgets, plus a partial implementation of the scale widget + new notebook and progressbar widgets ~ Compiling: You have your choice of not one, not two, but three, count'em three! separate build systems to try! One of them is bound to work for you. Jeff's TEA3-based build system: "./configure ; make ; make install" in the top-level directory. Joe's build system: "./configure ; make ; make install" in the "generic" subdirectory. Also TEA-based, just done differently. Pat's build system (Windows): "cd win ; nmake -f makefile.vc", or use the Developer Studio Project File "Tile.dsp". You can also compile in a separate build directory with Joe's or Jeff's system, if that's what you're into. *** NOTE *** The tile package requires access to a few Tk internal routines. These have been added to the private stubs table for Tk 8.5, but for 8.4 you will need to link against the Tk 8.4 shared library directly (import library on Windows). ~ Available themes: The tile package contains the following built-in themes: + "classic", the classic Motif-style appearance + "default", a simpler, streamlined look for X11 + "alt", a "revitalized" look and feel similar to GTK+'s default theme and Windows NT appearance; + "winnative", which uses the native Win32 API to draw widgets + "xpnative", which uses the Windows XP "Visual Styles" API + "step", an experimental playground for testing out new ideas, such as NeXTStep-style scrollbars. There are some other themes in the "demos" subdirectory: + "blue", another experimental playground used to test out the pixmap engine. ~ Availability The tile widget set is currently hosted under the tktable project at SourceForge: Sources are available under the 'tile' module in CVS. tile-0.8.2/aclocal.m40000644000076500007650000000006310144170516013702 0ustar joejoe00000000000000AC_PREREQ(2.50) builtin(include, tclconfig/tcl.m4) tile-0.8.2/configure0000755000076500007650000151656610731266347014010 0ustar joejoe00000000000000#! /bin/sh # From configure.in Revision: 1.39 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for tile 0.8.2. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='tile' PACKAGE_TARNAME='tile' PACKAGE_VERSION='0.8.2' PACKAGE_STRING='tile 0.8.2' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CYGPATH EXEEXT PKG_LIB_FILE PKG_STUB_LIB_FILE PKG_STUB_SOURCES PKG_STUB_OBJECTS PKG_TCL_SOURCES PKG_HEADERS PKG_INCLUDES PKG_LIBS PKG_CFLAGS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_LIBS TCL_DEFS TCL_EXTRA_CFLAGS TCL_LD_FLAGS TCL_SHLIB_LD_LIBS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_LIBS TK_XINCLUDES CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB EGREP MATH_LIBS PKG_SOURCES PKG_OBJECTS TCL_TOP_DIR_NATIVE TCL_GENERIC_DIR_NATIVE TCL_UNIX_DIR_NATIVE TCL_WIN_DIR_NATIVE TCL_BMAP_DIR_NATIVE TCL_TOOL_DIR_NATIVE TCL_PLATFORM_DIR_NATIVE TCL_INCLUDES TK_TOP_DIR_NATIVE TK_UNIX_DIR_NATIVE TK_WIN_DIR_NATIVE TK_GENERIC_DIR_NATIVE TK_XLIB_DIR_NATIVE TK_PLATFORM_DIR_NATIVE TK_INCLUDES TCL_THREADS SHARED_BUILD AR CELIB_DIR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS LD_LIBRARY_PATH_VAR CFLAGS_DEFAULT LDFLAGS_DEFAULT TCL_DBGX CLEANFILES MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB WISH_PROG CONFIGURE_OUTPUTS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures tile 0.8.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of tile 0.8.2:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-threads build with threads --enable-shared build and link with shared libraries (default: on) --enable-64bit enable 64bit support (default: off) --enable-64bit-vis enable 64bit Sparc VIS support (default: off) --disable-rpath disable rpath support (default: on) --enable-wince enable Win/CE support (where applicable) --enable-load allow dynamic loading and "load" command (default: on) --enable-symbols build with debugging symbols (default: off) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) --with-tk directory containing tk configuration (tkConfig.sh) --with-celib=DIR use Windows/CE support library from DIR --with-x use the X Window System Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF tile configure 0.8.2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by tile $as_me 0.8.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in tclconfig $srcdir/tclconfig; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in tclconfig $srcdir/tclconfig" >&5 echo "$as_me: error: cannot find install-sh or install.sh in tclconfig $srcdir/tclconfig" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Usual Tcl stuff: # # TEA extensions pass this us the version of TEA they think they # are compatible with. TEA_VERSION="3.6" echo "$as_me:$LINENO: checking for correct TEA configuration" >&5 echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6 if test x"${PACKAGE_NAME}" = x ; then { { echo "$as_me:$LINENO: error: The PACKAGE_NAME variable must be defined by your TEA configure.in" >&5 echo "$as_me: error: The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;} { (exit 1); exit 1; }; } fi if test x"3.6" = x ; then { { echo "$as_me:$LINENO: error: TEA version not specified." >&5 echo "$as_me: error: TEA version not specified." >&2;} { (exit 1); exit 1; }; } elif test "3.6" != "${TEA_VERSION}" ; then echo "$as_me:$LINENO: result: warning: requested TEA version \"3.6\", have \"${TEA_VERSION}\"" >&5 echo "${ECHO_T}warning: requested TEA version \"3.6\", have \"${TEA_VERSION}\"" >&6 else echo "$as_me:$LINENO: result: ok (TEA ${TEA_VERSION})" >&5 echo "${ECHO_T}ok (TEA ${TEA_VERSION})" >&6 fi case "`uname -s`" in *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CYGPATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CYGPATH"; then ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CYGPATH="cygpath -w" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" fi fi CYGPATH=$ac_cv_prog_CYGPATH if test -n "$CYGPATH"; then echo "$as_me:$LINENO: result: $CYGPATH" >&5 echo "${ECHO_T}$CYGPATH" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi EXEEXT=".exe" TEA_PLATFORM="windows" ;; *) CYGPATH=echo EXEEXT="" TEA_PLATFORM="unix" ;; esac # Check if exec_prefix is set. If not use fall back to prefix. # Note when adjusted, so that TEA_PREFIX can correct for this. # This is needed for recursive configures, since autoconf propagates # $prefix, but not $exec_prefix (doh!). if test x$exec_prefix = xNONE ; then exec_prefix_default=yes exec_prefix=$prefix fi # This package name must be replaced statically for AC_SUBST to work # Substitute STUB_LIB_FILE in case package creates a stub library too. # We AC_SUBST these here to ensure they are subst'ed, # in case the user doesn't call TEA_ADD_... # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl or --without-tcl was given. if test "${with_tcl+set}" = set; then withval="$with_tcl" with_tclconfig=${withval} fi; echo "$as_me:$LINENO: checking for Tcl configuration" >&5 echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6 if test "${ac_cv_c_tclconfig+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case ${with_tclconfig} in */tclConfig.sh ) if test -f ${with_tclconfig}; then { echo "$as_me:$LINENO: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5 echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;} with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'` fi ;; esac if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` else { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;} { (exit 1); exit 1; }; } fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ ../../tcl \ `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ ../../../tcl \ `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)` break fi done fi # TEA specific: on Windows, check in common installation locations if test "${TEA_PLATFORM}" = "windows" \ -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d C:/Tcl/lib 2>/dev/null` \ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi fi if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" { echo "$as_me:$LINENO: WARNING: Can't find Tcl configuration definitions" >&5 echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;} exit 0 else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5 echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6 fi fi echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5 echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then echo "$as_me:$LINENO: result: loading" >&5 echo "${ECHO_T}loading" >&6 . "${TCL_BIN_DIR}/tclConfig.sh" else echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6 fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. if test -f "${TCL_BIN_DIR}/Makefile" ; then TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} elif test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works # against Tcl.framework installed in an arbitary location. case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then for i in "`cd ${TCL_BIN_DIR}; pwd`" \ "`cd ${TCL_BIN_DIR}/../..; pwd`"; do if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}" break fi done fi if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}" TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}" fi ;; esac fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" # TEA specific: # # Ok, lets find the tk configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tk # if test x"${no_tk}" = x ; then # we reset no_tk in case something fails here no_tk=true # Check whether --with-tk or --without-tk was given. if test "${with_tk+set}" = set; then withval="$with_tk" with_tkconfig=${withval} fi; echo "$as_me:$LINENO: checking for Tk configuration" >&5 echo $ECHO_N "checking for Tk configuration... $ECHO_C" >&6 if test "${ac_cv_c_tkconfig+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # First check to see if --with-tkconfig was specified. if test x"${with_tkconfig}" != x ; then case ${with_tkconfig} in */tkConfig.sh ) if test -f ${with_tkconfig}; then { echo "$as_me:$LINENO: WARNING: --with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself" >&5 echo "$as_me: WARNING: --with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself" >&2;} with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'` fi ;; esac if test -f "${with_tkconfig}/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` else { { echo "$as_me:$LINENO: error: ${with_tkconfig} directory doesn't contain tkConfig.sh" >&5 echo "$as_me: error: ${with_tkconfig} directory doesn't contain tkConfig.sh" >&2;} { (exit 1); exit 1; }; } fi fi # then check for a private Tk library if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ../tk \ `ls -dr ../tk[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../tk[8-9].[0-9] 2>/dev/null` \ `ls -dr ../tk[8-9].[0-9]* 2>/dev/null` \ ../../tk \ `ls -dr ../../tk[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../tk[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../tk[8-9].[0-9]* 2>/dev/null` \ ../../../tk \ `ls -dr ../../../tk[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../tk[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../tk[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi done fi # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tk.framework/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i; pwd)` break fi done fi # TEA specific: on Windows, check in common installation locations if test "${TEA_PLATFORM}" = "windows" \ -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d C:/Tcl/lib 2>/dev/null` \ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ${srcdir}/../tk \ `ls -dr ${srcdir}/../tk[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ${srcdir}/../tk[8-9].[0-9] 2>/dev/null` \ `ls -dr ${srcdir}/../tk[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi done fi fi if test x"${ac_cv_c_tkconfig}" = x ; then TK_BIN_DIR="# no Tk configs found" { echo "$as_me:$LINENO: WARNING: Can't find Tk configuration definitions" >&5 echo "$as_me: WARNING: Can't find Tk configuration definitions" >&2;} exit 0 else no_tk= TK_BIN_DIR=${ac_cv_c_tkconfig} echo "$as_me:$LINENO: result: found ${TK_BIN_DIR}/tkConfig.sh" >&5 echo "${ECHO_T}found ${TK_BIN_DIR}/tkConfig.sh" >&6 fi fi echo "$as_me:$LINENO: checking for existence of ${TK_BIN_DIR}/tkConfig.sh" >&5 echo $ECHO_N "checking for existence of ${TK_BIN_DIR}/tkConfig.sh... $ECHO_C" >&6 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then echo "$as_me:$LINENO: result: loading" >&5 echo "${ECHO_T}loading" >&6 . "${TK_BIN_DIR}/tkConfig.sh" else echo "$as_me:$LINENO: result: could not find ${TK_BIN_DIR}/tkConfig.sh" >&5 echo "${ECHO_T}could not find ${TK_BIN_DIR}/tkConfig.sh" >&6 fi # eval is required to do the TK_DBGX substitution eval "TK_LIB_FILE=\"${TK_LIB_FILE}\"" eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\"" # If the TK_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TK_LIB_SPEC will be set to the value # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC # instead of TK_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. if test -f "${TK_BIN_DIR}/Makefile" ; then TK_LIB_SPEC=${TK_BUILD_LIB_SPEC} TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC} TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH} elif test "`uname -s`" = "Darwin"; then # If Tk was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works # against Tk.framework installed in an arbitary location. case ${TK_DEFS} in *TK_FRAMEWORK*) if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then for i in "`cd ${TK_BIN_DIR}; pwd`" \ "`cd ${TK_BIN_DIR}/../..; pwd`"; do if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}" break fi done fi if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}" fi ;; esac fi # eval is required to do the TK_DBGX substitution eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\"" eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\"" eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\"" eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\"" # TEA specific: Ensure windowingsystem is defined if test "${TEA_PLATFORM}" = "unix" ; then case ${TK_DEFS} in *MAC_OSX_TK*) cat >>confdefs.h <<\_ACEOF #define MAC_OSX_TK 1 _ACEOF TEA_WINDOWINGSYSTEM="aqua" ;; *) TEA_WINDOWINGSYSTEM="x11" ;; esac elif test "${TEA_PLATFORM}" = "windows" ; then TEA_WINDOWINGSYSTEM="win32" fi # TEA specific: if test "${prefix}" = "NONE"; then prefix_default=yes if test x"${TCL_PREFIX}" != x; then { echo "$as_me:$LINENO: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&5 echo "$as_me: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&6;} prefix=${TCL_PREFIX} else { echo "$as_me:$LINENO: --prefix defaulting to /usr/local" >&5 echo "$as_me: --prefix defaulting to /usr/local" >&6;} prefix=/usr/local fi fi if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \ -o x"${exec_prefix_default}" = x"yes" ; then if test x"${TCL_EXEC_PREFIX}" != x; then { echo "$as_me:$LINENO: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&5 echo "$as_me: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&6;} exec_prefix=${TCL_EXEC_PREFIX} else { echo "$as_me:$LINENO: --exec-prefix defaulting to ${prefix}" >&5 echo "$as_me: --exec-prefix defaulting to ${prefix}" >&6;} exec_prefix=$prefix fi fi # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) # in this macro, they need to go into TEA_SETUP_COMPILER instead. # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' #-------------------------------------------------------------------- # Checks to see if the make program sets the $MAKE variable. #-------------------------------------------------------------------- echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi #-------------------------------------------------------------------- # Find ranlib #-------------------------------------------------------------------- if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. #------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" -a -n "$GCC"; then echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5 echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6 if test "${tcl_cv_cc_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_pipe=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_pipe=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_pipe" >&5 echo "${ECHO_T}$tcl_cv_cc_pipe" >&6 if test $tcl_cv_cc_pipe = yes; then CFLAGS="$CFLAGS -pipe" fi fi #-------------------------------------------------------------------- # Common compiler flag setup #-------------------------------------------------------------------- echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # It does not; compile a test program. if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { _ascii (); _ebcdic (); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 echo "${ECHO_T}$ac_cv_c_bigendian" >&6 case $ac_cv_c_bigendian in yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; no) ;; *) { { echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac if test "${TEA_PLATFORM}" = "unix" ; then #-------------------------------------------------------------------- # On a few very rare systems, all of the libm.a stuff is # already in libc.a. Set compiler flags accordingly. # Also, Linux requires the "ieee" library for math to work # right (and it must appear before "-lm"). #-------------------------------------------------------------------- echo "$as_me:$LINENO: checking for sin" >&5 echo $ECHO_N "checking for sin... $ECHO_C" >&6 if test "${ac_cv_func_sin+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define sin to an innocuous variant, in case declares sin. For example, HP-UX 11i declares gettimeofday. */ #define sin innocuous_sin /* System header to define __stub macros and hopefully few prototypes, which can conflict with char sin (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef sin /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char sin (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_sin) || defined (__stub___sin) choke me #else char (*f) () = sin; #endif #ifdef __cplusplus } #endif int main () { return f != sin; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_sin=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_sin=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5 echo "${ECHO_T}$ac_cv_func_sin" >&6 if test $ac_cv_func_sin = yes; then MATH_LIBS="" else MATH_LIBS="-lm" fi echo "$as_me:$LINENO: checking for main in -lieee" >&5 echo $ECHO_N "checking for main in -lieee... $ECHO_C" >&6 if test "${ac_cv_lib_ieee_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lieee $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ieee_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ieee_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ieee_main" >&5 echo "${ECHO_T}$ac_cv_lib_ieee_main" >&6 if test $ac_cv_lib_ieee_main = yes; then MATH_LIBS="-lieee $MATH_LIBS" fi #-------------------------------------------------------------------- # Interactive UNIX requires -linet instead of -lsocket, plus it # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- echo "$as_me:$LINENO: checking for main in -linet" >&5 echo $ECHO_N "checking for main in -linet... $ECHO_C" >&6 if test "${ac_cv_lib_inet_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_inet_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_inet_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_inet_main" >&5 echo "${ECHO_T}$ac_cv_lib_inet_main" >&6 if test $ac_cv_lib_inet_main = yes; then LIBS="$LIBS -linet" fi if test "${ac_cv_header_net_errno_h+set}" = set; then echo "$as_me:$LINENO: checking for net/errno.h" >&5 echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 if test "${ac_cv_header_net_errno_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking net/errno.h usability" >&5 echo $ECHO_N "checking net/errno.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking net/errno.h presence" >&5 echo $ECHO_N "checking net/errno.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: net/errno.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: net/errno.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: net/errno.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: net/errno.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: net/errno.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: net/errno.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: net/errno.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: net/errno.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: net/errno.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for net/errno.h" >&5 echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 if test "${ac_cv_header_net_errno_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_net_errno_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 fi if test $ac_cv_header_net_errno_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_NET_ERRNO_H 1 _ACEOF fi #-------------------------------------------------------------------- # Check for the existence of the -lsocket and -lnsl libraries. # The order here is important, so that they end up in the right # order in the command line generated by make. Here are some # special considerations: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- tcl_checkBoth=0 echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define connect to an innocuous variant, in case declares connect. For example, HP-UX 11i declares gettimeofday. */ #define connect innocuous_connect /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef connect /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else char (*f) () = connect; #endif #ifdef __cplusplus } #endif int main () { return f != connect; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = yes; then tcl_checkSocket=0 else tcl_checkSocket=1 fi if test "$tcl_checkSocket" = 1; then echo "$as_me:$LINENO: checking for setsockopt" >&5 echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 if test "${ac_cv_func_setsockopt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define setsockopt to an innocuous variant, in case declares setsockopt. For example, HP-UX 11i declares gettimeofday. */ #define setsockopt innocuous_setsockopt /* System header to define __stub macros and hopefully few prototypes, which can conflict with char setsockopt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef setsockopt /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char setsockopt (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_setsockopt) || defined (__stub___setsockopt) choke me #else char (*f) () = setsockopt; #endif #ifdef __cplusplus } #endif int main () { return f != setsockopt; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_setsockopt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_setsockopt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 if test $ac_cv_func_setsockopt = yes; then : else echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5 echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_setsockopt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char setsockopt (); int main () { setsockopt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_setsockopt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_setsockopt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5 echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 if test $ac_cv_lib_socket_setsockopt = yes; then LIBS="$LIBS -lsocket" else tcl_checkBoth=1 fi fi fi if test "$tcl_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" echo "$as_me:$LINENO: checking for accept" >&5 echo $ECHO_N "checking for accept... $ECHO_C" >&6 if test "${ac_cv_func_accept+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define accept to an innocuous variant, in case declares accept. For example, HP-UX 11i declares gettimeofday. */ #define accept innocuous_accept /* System header to define __stub macros and hopefully few prototypes, which can conflict with char accept (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef accept /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char accept (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_accept) || defined (__stub___accept) choke me #else char (*f) () = accept; #endif #ifdef __cplusplus } #endif int main () { return f != accept; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_accept=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_accept=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 echo "${ECHO_T}$ac_cv_func_accept" >&6 if test $ac_cv_func_accept = yes; then tcl_checkNsl=0 else LIBS=$tk_oldLibs fi fi echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define gethostbyname to an innocuous variant, in case declares gethostbyname. For example, HP-UX 11i declares gettimeofday. */ #define gethostbyname innocuous_gethostbyname /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef gethostbyname /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else char (*f) () = gethostbyname; #endif #ifdef __cplusplus } #endif int main () { return f != gethostbyname; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 if test $ac_cv_func_gethostbyname = yes; then : else echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then LIBS="$LIBS -lnsl" fi fi # TEA specific: Don't perform the eval of the libraries here because # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' echo "$as_me:$LINENO: checking dirent.h" >&5 echo $ECHO_N "checking dirent.h... $ECHO_C" >&6 if test "${tcl_cv_dirent_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #ifndef _POSIX_SOURCE # ifdef __Lynx__ /* * Generate compilation error to make the test fail: Lynx headers * are only valid if really in the POSIX environment. */ missing_procedure(); # endif #endif DIR *d; struct dirent *entryPtr; char *p; d = opendir("foobar"); entryPtr = readdir(d); p = entryPtr->d_name; closedir(d); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_dirent_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_dirent_h=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $tcl_cv_dirent_h" >&5 echo "${ECHO_T}$tcl_cv_dirent_h" >&6 if test $tcl_cv_dirent_h = no; then cat >>confdefs.h <<\_ACEOF #define NO_DIRENT_H 1 _ACEOF fi # TEA specific: if test "${ac_cv_header_errno_h+set}" = set; then echo "$as_me:$LINENO: checking for errno.h" >&5 echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 if test "${ac_cv_header_errno_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 echo "${ECHO_T}$ac_cv_header_errno_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking errno.h usability" >&5 echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking errno.h presence" >&5 echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: errno.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: errno.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: errno.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for errno.h" >&5 echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 if test "${ac_cv_header_errno_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_errno_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 echo "${ECHO_T}$ac_cv_header_errno_h" >&6 fi if test $ac_cv_header_errno_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_ERRNO_H 1 _ACEOF fi if test "${ac_cv_header_float_h+set}" = set; then echo "$as_me:$LINENO: checking for float.h" >&5 echo $ECHO_N "checking for float.h... $ECHO_C" >&6 if test "${ac_cv_header_float_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 echo "${ECHO_T}$ac_cv_header_float_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking float.h usability" >&5 echo $ECHO_N "checking float.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking float.h presence" >&5 echo $ECHO_N "checking float.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: float.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: float.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: float.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: float.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: float.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: float.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for float.h" >&5 echo $ECHO_N "checking for float.h... $ECHO_C" >&6 if test "${ac_cv_header_float_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_float_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 echo "${ECHO_T}$ac_cv_header_float_h" >&6 fi if test $ac_cv_header_float_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_FLOAT_H 1 _ACEOF fi if test "${ac_cv_header_values_h+set}" = set; then echo "$as_me:$LINENO: checking for values.h" >&5 echo $ECHO_N "checking for values.h... $ECHO_C" >&6 if test "${ac_cv_header_values_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 echo "${ECHO_T}$ac_cv_header_values_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking values.h usability" >&5 echo $ECHO_N "checking values.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking values.h presence" >&5 echo $ECHO_N "checking values.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: values.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: values.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: values.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: values.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: values.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: values.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for values.h" >&5 echo $ECHO_N "checking for values.h... $ECHO_C" >&6 if test "${ac_cv_header_values_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_values_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 echo "${ECHO_T}$ac_cv_header_values_h" >&6 fi if test $ac_cv_header_values_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_VALUES_H 1 _ACEOF fi if test "${ac_cv_header_limits_h+set}" = set; then echo "$as_me:$LINENO: checking for limits.h" >&5 echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 if test "${ac_cv_header_limits_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 echo "${ECHO_T}$ac_cv_header_limits_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking limits.h usability" >&5 echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking limits.h presence" >&5 echo $ECHO_N "checking limits.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: limits.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: limits.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: limits.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for limits.h" >&5 echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 if test "${ac_cv_header_limits_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_limits_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 echo "${ECHO_T}$ac_cv_header_limits_h" >&6 fi if test $ac_cv_header_limits_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LIMITS_H 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define NO_LIMITS_H 1 _ACEOF fi if test "${ac_cv_header_stdlib_h+set}" = set; then echo "$as_me:$LINENO: checking for stdlib.h" >&5 echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 if test "${ac_cv_header_stdlib_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking stdlib.h usability" >&5 echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking stdlib.h presence" >&5 echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: stdlib.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: stdlib.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for stdlib.h" >&5 echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 if test "${ac_cv_header_stdlib_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_stdlib_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 fi if test $ac_cv_header_stdlib_h = yes; then tcl_ok=1 else tcl_ok=0 fi cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtol" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtoul" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtod" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* if test $tcl_ok = 0; then cat >>confdefs.h <<\_ACEOF #define NO_STDLIB_H 1 _ACEOF fi if test "${ac_cv_header_string_h+set}" = set; then echo "$as_me:$LINENO: checking for string.h" >&5 echo $ECHO_N "checking for string.h... $ECHO_C" >&6 if test "${ac_cv_header_string_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 echo "${ECHO_T}$ac_cv_header_string_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking string.h usability" >&5 echo $ECHO_N "checking string.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking string.h presence" >&5 echo $ECHO_N "checking string.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: string.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: string.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: string.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for string.h" >&5 echo $ECHO_N "checking for string.h... $ECHO_C" >&6 if test "${ac_cv_header_string_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_string_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 echo "${ECHO_T}$ac_cv_header_string_h" >&6 fi if test $ac_cv_header_string_h = yes; then tcl_ok=1 else tcl_ok=0 fi cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strstr" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strerror" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* # See also memmove check below for a place where NO_STRING_H can be # set and why. if test $tcl_ok = 0; then cat >>confdefs.h <<\_ACEOF #define NO_STRING_H 1 _ACEOF fi if test "${ac_cv_header_sys_wait_h+set}" = set; then echo "$as_me:$LINENO: checking for sys/wait.h" >&5 echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking sys/wait.h usability" >&5 echo $ECHO_N "checking sys/wait.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking sys/wait.h presence" >&5 echo $ECHO_N "checking sys/wait.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: sys/wait.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: sys/wait.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: sys/wait.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: sys/wait.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: sys/wait.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: sys/wait.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for sys/wait.h" >&5 echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_wait_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 fi if test $ac_cv_header_sys_wait_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_SYS_WAIT_H 1 _ACEOF fi if test "${ac_cv_header_dlfcn_h+set}" = set; then echo "$as_me:$LINENO: checking for dlfcn.h" >&5 echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 if test "${ac_cv_header_dlfcn_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for dlfcn.h" >&5 echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 if test "${ac_cv_header_dlfcn_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_dlfcn_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 fi if test $ac_cv_header_dlfcn_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_DLFCN_H 1 _ACEOF fi # OS/390 lacks sys/param.h (and doesn't need it, by chance). for ac_header in sys/param.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Let the user call this, because if it triggers, they will # need a compat/strtod.c that is correct. Users can also # use Tcl_GetDouble(FromObj) instead. #TEA_BUGGY_STRTOD fi vars="" for i in $vars; do case $i in \$*) # allow $-var names PKG_SOURCES="$PKG_SOURCES $i" PKG_OBJECTS="$PKG_OBJECTS $i" ;; *) # check for existence - allows for generic/win/unix VPATH # To add more dirs here (like 'src'), you have to update VPATH # in Makefile.in as well if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ ; then { { echo "$as_me:$LINENO: error: could not find source file '$i'" >&5 echo "$as_me: error: could not find source file '$i'" >&2;} { (exit 1); exit 1; }; } fi PKG_SOURCES="$PKG_SOURCES $i" # this assumes it is in a VPATH dir i=`basename $i` # handle user calling this before or after TEA_SETUP_COMPILER if test x"${OBJEXT}" != x ; then j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" else j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" fi PKG_OBJECTS="$PKG_OBJECTS $j" ;; esac done #TEA_ADD_HEADERS([]) vars="-I. -I\"`${CYGPATH} ${srcdir}/generic`\"" for i in $vars; do PKG_INCLUDES="$PKG_INCLUDES $i" done #TEA_ADD_LIBS([]) #TEA_ADD_CFLAGS([]) #TEA_ADD_STUB_SOURCES([]) #TEA_ADD_TCL_SOURCES([]) echo "$as_me:$LINENO: checking for Tcl private include files" >&5 echo $ECHO_N "checking for Tcl private include files... $ECHO_C" >&6 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}` TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\" TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\" TCL_UNIX_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\" TCL_WIN_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\" TCL_BMAP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/bitmaps\" TCL_TOOL_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/tools\" TCL_COMPAT_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/compat\" if test "${TEA_PLATFORM}" = "windows"; then TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE} else TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE} fi # We want to ensure these are substituted so as not to require # any *_NATIVE vars be defined in the Makefile TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}" if test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use # the framework's Headers and PrivateHeaders directories case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -d "${TCL_BIN_DIR}/Headers" -a -d "${TCL_BIN_DIR}/PrivateHeaders"; then TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"; else TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"; fi ;; esac else if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then { { echo "$as_me:$LINENO: error: Cannot find private header tclInt.h in ${TCL_SRC_DIR}" >&5 echo "$as_me: error: Cannot find private header tclInt.h in ${TCL_SRC_DIR}" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: result: Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}" >&5 echo "${ECHO_T}Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}" >&6 echo "$as_me:$LINENO: checking for Tk private include files" >&5 echo $ECHO_N "checking for Tk private include files... $ECHO_C" >&6 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}` TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\" TK_UNIX_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\" TK_WIN_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\" TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\" TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\" if test "${TEA_PLATFORM}" = "windows"; then TK_PLATFORM_DIR_NATIVE=${TK_WIN_DIR_NATIVE} else TK_PLATFORM_DIR_NATIVE=${TK_UNIX_DIR_NATIVE} fi # We want to ensure these are substituted so as not to require # any *_NATIVE vars be defined in the Makefile TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}" # Detect and add ttk subdir if test -d ${TK_SRC_DIR_NATIVE}/generic/ttk; then TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\"" fi if test "${TEA_WINDOWINGSYSTEM}" = "win32" \ -o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then TK_INCLUDES="${TK_INCLUDES} -I${TK_XLIB_DIR_NATIVE}" fi if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then TK_INCLUDES="${TK_INCLUDES} -I${TK_SRC_DIR_NATIVE}/macosx" fi if test "`uname -s`" = "Darwin"; then # If Tk was built as a framework, attempt to use # the framework's Headers and PrivateHeaders directories case ${TK_DEFS} in *TK_FRAMEWORK*) if test -d "${TK_BIN_DIR}/Headers" -a -d "${TK_BIN_DIR}/PrivateHeaders"; then TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"; fi ;; esac else if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then { { echo "$as_me:$LINENO: error: Cannot find private header tkInt.h in ${TK_SRC_DIR}" >&5 echo "$as_me: error: Cannot find private header tkInt.h in ${TK_SRC_DIR}" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: result: Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}" >&5 echo "${ECHO_T}Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}" >&6 # Build stuff: # # Check whether --enable-threads or --disable-threads was given. if test "${enable_threads+set}" = set; then enableval="$enable_threads" tcl_ok=$enableval else tcl_ok=yes fi; if test "${enable_threads+set}" = set; then enableval="$enable_threads" tcl_ok=$enableval else tcl_ok=yes fi if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then TCL_THREADS=1 if test "${TEA_PLATFORM}" != "windows" ; then # We are always OK on Windows, so check what this platform wants: # USE_THREAD_ALLOC tells us to try the special thread-based # allocator that significantly reduces lock contention cat >>confdefs.h <<\_ACEOF #define USE_THREAD_ALLOC 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF if test "`uname -s`" = "SunOS" ; then cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF fi cat >>confdefs.h <<\_ACEOF #define _THREAD_SAFE 1 _ACEOF echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5 echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6 if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_mutex_init (); int main () { pthread_mutex_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pthread_pthread_mutex_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread_pthread_mutex_init=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6 if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = "no"; then # Check a little harder for __pthread_mutex_init in the same # library, as some systems hide it there until pthread.h is # defined. We could alternatively do an AC_TRY_COMPILE with # pthread.h, but that will work with libpthread really doesn't # exist, like AIX 4.2. [Bug: 4359] echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5 echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6 if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char __pthread_mutex_init (); int main () { __pthread_mutex_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pthread___pthread_mutex_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread___pthread_mutex_init=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6 if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then tcl_ok=yes else tcl_ok=no fi fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthread" else echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5 echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6 if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthreads $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_mutex_init (); int main () { pthread_mutex_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pthreads_pthread_mutex_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthreads_pthread_mutex_init=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6 if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthreads" else echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5 echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6 if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_mutex_init (); int main () { pthread_mutex_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_c_pthread_mutex_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_pthread_mutex_init=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5 echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6 if test $ac_cv_lib_c_pthread_mutex_init = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = "no"; then echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5 echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6 if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_mutex_init (); int main () { pthread_mutex_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_c_r_pthread_mutex_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_r_pthread_mutex_init=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6 if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -pthread" else TCL_THREADS=0 { echo "$as_me:$LINENO: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&5 echo "$as_me: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&2;} fi fi fi fi fi else TCL_THREADS=0 fi # Do checking message here to not mess up interleaved configure output echo "$as_me:$LINENO: checking for building with threads" >&5 echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 if test "${TCL_THREADS}" = 1; then cat >>confdefs.h <<\_ACEOF #define TCL_THREADS 1 _ACEOF echo "$as_me:$LINENO: result: yes (default)" >&5 echo "${ECHO_T}yes (default)" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # TCL_THREADS sanity checking. See if our request for building with # threads is the same as the way Tcl was built. If not, warn the user. case ${TCL_DEFS} in *THREADS=1*) if test "${TCL_THREADS}" = "0"; then { echo "$as_me:$LINENO: WARNING: Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads." >&5 echo "$as_me: WARNING: Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads." >&2;} fi ;; *) if test "${TCL_THREADS}" = "1"; then { echo "$as_me:$LINENO: WARNING: --enable-threads requested, but building against a Tcl that is NOT thread-enabled. This is an OK configuration that will also run in a thread-enabled core." >&5 echo "$as_me: WARNING: --enable-threads requested, but building against a Tcl that is NOT thread-enabled. This is an OK configuration that will also run in a thread-enabled core." >&2;} fi ;; esac echo "$as_me:$LINENO: checking how to build libraries" >&5 echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6 # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" tcl_ok=$enableval else tcl_ok=yes fi; if test "${enable_shared+set}" = set; then enableval="$enable_shared" tcl_ok=$enableval else tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then echo "$as_me:$LINENO: result: shared" >&5 echo "${ECHO_T}shared" >&6 SHARED_BUILD=1 else echo "$as_me:$LINENO: result: static" >&5 echo "${ECHO_T}static" >&6 SHARED_BUILD=0 cat >>confdefs.h <<\_ACEOF #define STATIC_BUILD 1 _ACEOF fi # Step 0.a: Enable 64 bit support? echo "$as_me:$LINENO: checking if 64bit support is requested" >&5 echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6 # Check whether --enable-64bit or --disable-64bit was given. if test "${enable_64bit+set}" = set; then enableval="$enable_64bit" do64bit=$enableval else do64bit=no fi; echo "$as_me:$LINENO: result: $do64bit" >&5 echo "${ECHO_T}$do64bit" >&6 # Step 0.b: Enable Solaris 64 bit VIS support? echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5 echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 # Check whether --enable-64bit-vis or --disable-64bit-vis was given. if test "${enable_64bit_vis+set}" = set; then enableval="$enable_64bit_vis" do64bitVIS=$enableval else do64bitVIS=no fi; echo "$as_me:$LINENO: result: $do64bitVIS" >&5 echo "${ECHO_T}$do64bitVIS" >&6 # Force 64bit on with VIS if test "$do64bitVIS" = "yes"; then do64bit=yes fi # Step 0.c: Check if visibility support is available. Do this here so # that platform specific alternatives can be used below if this fails. echo "$as_me:$LINENO: checking if compiler supports visibility \"hidden\"" >&5 echo $ECHO_N "checking if compiler supports visibility \"hidden\"... $ECHO_C" >&6 if test "${tcl_cv_cc_visibility_hidden+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) void f(void); void f(void) {} int main () { f(); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_visibility_hidden=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_visibility_hidden=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5 echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6 if test $tcl_cv_cc_visibility_hidden = yes; then cat >>confdefs.h <<\_ACEOF #define MODULE_SCOPE extern __attribute__((__visibility__("hidden"))) _ACEOF fi # Step 0.d: Disable -rpath support? echo "$as_me:$LINENO: checking if rpath support is requested" >&5 echo $ECHO_N "checking if rpath support is requested... $ECHO_C" >&6 # Check whether --enable-rpath or --disable-rpath was given. if test "${enable_rpath+set}" = set; then enableval="$enable_rpath" doRpath=$enableval else doRpath=yes fi; echo "$as_me:$LINENO: result: $doRpath" >&5 echo "${ECHO_T}$doRpath" >&6 # TEA specific: Cross-compiling options for Windows/CE builds? if test "${TEA_PLATFORM}" = windows; then echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5 echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6 # Check whether --enable-wince or --disable-wince was given. if test "${enable_wince+set}" = set; then enableval="$enable_wince" doWince=$enableval else doWince=no fi; echo "$as_me:$LINENO: result: $doWince" >&5 echo "${ECHO_T}$doWince" >&6 fi # Step 1: set the variable "system" to hold the name and version number # for the system. echo "$as_me:$LINENO: checking system version" >&5 echo $ECHO_N "checking system version... $ECHO_C" >&6 if test "${tcl_cv_sys_version+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # TEA specific: if test "${TEA_PLATFORM}" = "windows" ; then tcl_cv_sys_version=windows elif test -f /usr/lib/NextStep/software_version; then tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5 echo "$as_me: WARNING: can't find uname command" >&2;} tcl_cv_sys_version=unknown else # Special check for weird MP-RAS system (uname returns weird # results, and the version is kept in special file). if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then tcl_cv_sys_version=MP-RAS-`awk '{print $3}' /etc/.relid` fi if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi fi fi fi echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5 echo "${ECHO_T}$tcl_cv_sys_version" >&6 system=$tcl_cv_sys_version # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then have_dl=yes else have_dl=no fi # Require ranlib early so we can override it in special cases below. # Step 3: set configuration options based on system name and version. # This is similar to Tcl's unix/tcl.m4 except that we've added a # "windows" case. do64bit_ok=no LDFLAGS_ORIG="$LDFLAGS" # When ld needs options to work in 64-bit mode, put them in # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load] # is disabled by the user. [Bug 1016796] LDFLAGS_ARCH="" TCL_EXPORT_FILE_SUFFIX="" UNSHARED_LIB_SUFFIX="" # TEA specific: use PACKAGE_VERSION instead of VERSION TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' ECHO_VERSION='`echo ${PACKAGE_VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O if test "$GCC" = yes; then # TEA specific: CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall" else CFLAGS_WARNING="" fi TCL_NEEDS_EXP_FILE=0 TCL_BUILD_EXP_FILE="" TCL_EXP_FILE="" # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STLIB_LD='${AR} cr' LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" case $system in # TEA specific: windows) # This is a 2-stage check to make sure we have the 64-bit SDK # We have to know where the SDK is installed. # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs # MACHINE is IX86 for LINK, but this is used by the manifest, # which requires x86|amd64|ia64. MACHINE="X86" if test "$do64bit" != "no" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft Platform SDK" fi MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` PATH64="" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # default to AMD64 64-bit build PATH64="${MSSDK}/Bin/Win64/x86/AMD64" ;; ia64) MACHINE="IA64" PATH64="${MSSDK}/Bin/Win64" ;; esac if test ! -d "${PATH64}" ; then { echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5 echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&2;} { echo "$as_me:$LINENO: WARNING: Ensure latest Platform SDK is installed" >&5 echo "$as_me: WARNING: Ensure latest Platform SDK is installed" >&2;} do64bit="no" else echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 do64bit_ok="yes" fi fi if test "$doWince" != "no" ; then if test "$do64bit" != "no" ; then { { echo "$as_me:$LINENO: error: Windows/CE and 64-bit builds incompatible" >&5 echo "$as_me: error: Windows/CE and 64-bit builds incompatible" >&2;} { (exit 1); exit 1; }; } fi if test "$GCC" = "yes" ; then { { echo "$as_me:$LINENO: error: Windows/CE and GCC builds incompatible" >&5 echo "$as_me: error: Windows/CE and GCC builds incompatible" >&2;} { (exit 1); exit 1; }; } fi # First, look for one uninstalled. # the alternative search directory is invoked by --with-celib if test x"${no_celib}" = x ; then # we reset no_celib in case something fails here no_celib=true # Check whether --with-celib or --without-celib was given. if test "${with_celib+set}" = set; then withval="$with_celib" with_celibconfig=${withval} fi; echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5 echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6 if test "${ac_cv_c_celibconfig+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # First check to see if --with-celibconfig was specified. if test x"${with_celibconfig}" != x ; then if test -d "${with_celibconfig}/inc" ; then ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` else { { echo "$as_me:$LINENO: error: ${with_celibconfig} directory doesn't contain inc directory" >&5 echo "$as_me: error: ${with_celibconfig} directory doesn't contain inc directory" >&2;} { (exit 1); exit 1; }; } fi fi # then check for a celib library if test x"${ac_cv_c_celibconfig}" = x ; then for i in \ ../celib-palm-3.0 \ ../celib \ ../../celib-palm-3.0 \ ../../celib \ `ls -dr ../celib-*3.[0-9]* 2>/dev/null` \ ${srcdir}/../celib-palm-3.0 \ ${srcdir}/../celib \ `ls -dr ${srcdir}/../celib-*3.[0-9]* 2>/dev/null` \ ; do if test -d "$i/inc" ; then ac_cv_c_celibconfig=`(cd $i; pwd)` break fi done fi fi if test x"${ac_cv_c_celibconfig}" = x ; then { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5 echo "$as_me: error: Cannot find celib support library directory" >&2;} { (exit 1); exit 1; }; } else no_celib= CELIB_DIR=${ac_cv_c_celibconfig} CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'` echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5 echo "${ECHO_T}found $CELIB_DIR" >&6 fi fi # Set defaults for common evc4/PPC2003 setup # Currently Tcl requires 300+, possibly 420+ for sockets CEVERSION=420; # could be 211 300 301 400 420 ... TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... ARCH=ARM; # could be ARM MIPS X86EM ... PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" if test "$doWince" != "yes"; then # If !yes then the user specified something # Reset ARCH to allow user to skip specifying it ARCH= eval `echo $doWince | awk -F, '{ \ if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \ if ($1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \ if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \ if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \ }'` if test "x${ARCH}" = "x" ; then ARCH=$TARGETCPU; fi fi OSVERSION=WCE$CEVERSION; if test "x${WCEROOT}" = "x" ; then WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" if test ! -d "${WCEROOT}" ; then WCEROOT="C:/Program Files/Microsoft eMbedded Tools" fi fi if test "x${SDKROOT}" = "x" ; then SDKROOT="C:/Program Files/Windows CE Tools" if test ! -d "${SDKROOT}" ; then SDKROOT="C:/Windows CE Tools" fi fi WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'` SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'` if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5 echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;} { (exit 1); exit 1; }; } doWince="no" else # We could PATH_NOSPACE these, but that's not important, # as long as we quote them when used. CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" if test -d "${CEINCLUDE}/${TARGETCPU}" ; then CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" fi CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" fi fi if test "$GCC" != "yes" ; then if test "${SHARED_BUILD}" = "0" ; then runtime=-MT else runtime=-MD fi if test "$do64bit" != "no" ; then # All this magic is necessary for the Win64 SDK RC1 - hobbs CC="\"${PATH64}/cl.exe\"" CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\"" RC="\"${MSSDK}/bin/rc.exe\"" lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" LINKBIN="\"${PATH64}/link.exe\"" CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" # Avoid 'unresolved external symbol __security_cookie' # errors, c.f. http://support.microsoft.com/?id=894573 vars="bufferoverflowU.lib" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done elif test "$doWince" != "no" ; then CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" if test "${TARGETCPU}" = "X86"; then CC="\"${CEBINROOT}/cl.exe\"" else CC="\"${CEBINROOT}/cl${ARCH}.exe\"" fi CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\"" arch=`echo ${ARCH} | awk '{print tolower($0)}'` defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS" if test "${SHARED_BUILD}" = "1" ; then # Static CE builds require static celib as well defs="${defs} _DLL" fi for i in $defs ; do cat >>confdefs.h <<_ACEOF #define $i 1 _ACEOF done cat >>confdefs.h <<_ACEOF #define _WIN32_WCE $CEVERSION _ACEOF cat >>confdefs.h <<_ACEOF #define UNDER_CE $CEVERSION _ACEOF CFLAGS_DEBUG="-nologo -Zi -Od" CFLAGS_OPTIMIZE="-nologo -Ox" lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" LINKBIN="\"${CEBINROOT}/link.exe\"" else RC="rc" lflags="-nologo" LINKBIN="link" CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" fi fi if test "$GCC" = "yes"; then # mingw gcc mode RC="windres" CFLAGS_DEBUG="-g" CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" SHLIB_LD="$CC -shared" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" else SHLIB_LD="${LINKBIN} -dll ${lflags}" # link -lib only works when -lib is the first arg STLIB_LD="${LINKBIN} -lib ${lflags}" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib' PATHTYPE=-w # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp # This essentially turns it all on. LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" LDFLAGS_OPTIMIZE="-release" if test "$doWince" != "no" ; then LDFLAGS_CONSOLE="-link ${lflags}" LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} else LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi fi SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dll" SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll' TCL_LIB_VERSIONS_OK=nodots # Bogus to avoid getting this turned off DL_OBJS="tclLoadNone.obj" ;; AIX-*) if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then # AIX requires the _r compiler when gcc isn't being used case "${CC}" in *_r) # ok ... ;; *) CC=${CC}_r ;; esac echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 echo "${ECHO_T}Using $CC for compiling with threads" >&6 fi LIBS="$LIBS -lc" SHLIB_CFLAGS="" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" LD_LIBRARY_PATH_VAR="LIBPATH" # Check to enable 64-bit flags for compiler/linker on AIX 4+ if test "$do64bit" = yes -a "`uname -v`" -gt 3; then if test "$GCC" = yes; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -q64" LDFLAGS_ARCH="-q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" fi fi if test "`uname -m`" = ia64; then # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC SHLIB_LD="/usr/ccs/bin/ld -G -z text" # AIX-5 has dl* in libc.so DL_LIBS="" if test "$GCC" = yes; then CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' else CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' else if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' else SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" fi SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} TCL_NEEDS_EXP_FILE=1 # TEA specific: use PACKAGE_VERSION instead of VERSION TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp' fi # AIX v<=4.1 has some different flags than 4.2+ if test "$system" = "AIX-4.1" -o "`uname -v`" -lt 4; then case $LIBOBJS in "tclLoadAix.$ac_objext" | \ *" tclLoadAix.$ac_objext" | \ "tclLoadAix.$ac_objext "* | \ *" tclLoadAix.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" ;; esac DL_LIBS="-lld" fi # On AIX <=v4 systems, libbsd.a has to be linked in to support # non-blocking file IO. This library has to be linked in after # the MATH_LIBS or it breaks the pow() function. The way to # insure proper sequencing, is to add it to the tail of MATH_LIBS. # This library also supplies gettimeofday. # # AIX does not have a timezone field in struct tm. When the AIX # bsd library is used, the timezone global and the gettimeofday # methods are to be avoided for timezone deduction instead, we # deduce the timezone by comparing the localtime result on a # known GMT value. echo "$as_me:$LINENO: checking for gettimeofday in -lbsd" >&5 echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gettimeofday (); int main () { gettimeofday (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gettimeofday=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gettimeofday=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gettimeofday" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 if test $ac_cv_lib_bsd_gettimeofday = yes; then libbsd=yes else libbsd=no fi if test $libbsd = yes; then MATH_LIBS="$MATH_LIBS -lbsd" cat >>confdefs.h <<\_ACEOF #define USE_DELTA_FOR_TZ 1 _ACEOF fi ;; BeOS*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -nostart' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" #----------------------------------------------------------- # Check for inet_ntoa in -lbind, for BeOS (which also needs # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5 echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6 if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_ntoa (); int main () { inet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bind_inet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bind_inet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6 if test $ac_cv_lib_bind_inet_ntoa = yes; then LIBS="$LIBS -lbind -lsocket" fi ;; BSD/OS-2.1*|BSD/OS-3*) SHLIB_CFLAGS="" SHLIB_LD="shlicc -r" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; BSD/OS-4.*) SHLIB_CFLAGS="-export-dynamic -fPIC" SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; dgux*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; HP-UX-*.11.*) # Use updated header definitions where possible cat >>confdefs.h <<\_ACEOF #define _XOPEN_SOURCE_EXTENDED 1 _ACEOF # TEA specific: Needed by Tcl, but not most extensions #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?]) #LIBS="$LIBS -lxnet" # Use the XOPEN network library if test "`uname -m`" = ia64; then SHLIB_SUFFIX=".so" # Use newer C++ library for C++ extensions #if test "$GCC" != "yes" ; then # CPPFLAGS="-AA" #fi else SHLIB_SUFFIX=".sl" fi echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc #CFLAGS="$CFLAGS +DAportable" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes"; then if test "$GCC" = yes; then case `${CC} -dumpmachine` in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} ;; esac else do64bit_ok=yes CFLAGS="$CFLAGS +DD64" LDFLAGS_ARCH="+DD64" fi fi ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS="" DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi ;; IRIX-5.*) SHLIB_CFLAGS="" SHLIB_LD="ld -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi ;; IRIX-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes; then CFLAGS="$CFLAGS -mabi=n32" LDFLAGS="$LDFLAGS -mabi=n32" else case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) CFLAGS="$CFLAGS -n32" ;; esac LDFLAGS="$LDFLAGS -n32" fi ;; IRIX64-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes; then if test "$GCC" = yes; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5 echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} else do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS_ARCH="-64" fi fi ;; Linux*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" # TEA specific: CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings # when you inline the string and math operations. Turn this off to # get rid of the warnings. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}' DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "`uname -m`" = "alpha"; then CFLAGS="$CFLAGS -mieee" fi if test $do64bit = yes; then echo "$as_me:$LINENO: checking if compiler accepts -m64 flag" >&5 echo $ECHO_N "checking if compiler accepts -m64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_m64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_m64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_m64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_m64" >&5 echo "${ECHO_T}$tcl_cv_cc_m64" >&6 if test $tcl_cv_cc_m64 = yes; then CFLAGS="$CFLAGS -m64" do64bit_ok=yes fi fi # The combo of gcc + glibc has a bug related to inlining of # functions like strtod(). The -fno-builtin flag should address # this problem but it does not work. The -fno-inline flag is kind # of overkill but it works. Disable inlining only when one of the # files in compat/*.c is being linked in. if test x"${USE_COMPAT}" != x; then CFLAGS="$CFLAGS -fno-inline" fi ;; GNU*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" SHLIB_LD='${CC} -shared' DL_OBJS="" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" if test "`uname -m`" = "alpha"; then CFLAGS="$CFLAGS -mieee" fi ;; Lynx*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE=-02 SHLIB_LD='${CC} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi ;; MP-RAS-02*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; MP-RAS-*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,-Bexport" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; NetBSD-1.*|FreeBSD-[1-2].*) SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi echo "$as_me:$LINENO: checking for ELF" >&5 echo $ECHO_N "checking for ELF... $ECHO_C" >&6 if test "${tcl_cv_ld_elf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __ELF__ yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then tcl_cv_ld_elf=yes else tcl_cv_ld_elf=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 echo "${ECHO_T}$tcl_cv_ld_elf" >&6 if test $tcl_cv_ld_elf = yes; then SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' else SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' fi # Ancient FreeBSD doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; OpenBSD-*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' echo "$as_me:$LINENO: checking for ELF" >&5 echo $ECHO_N "checking for ELF... $ECHO_C" >&6 if test "${tcl_cv_ld_elf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __ELF__ yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then tcl_cv_ld_elf=yes else tcl_cv_ld_elf=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 echo "${ECHO_T}$tcl_cv_ld_elf" >&6 if test $tcl_cv_ld_elf = yes; then LDFLAGS=-Wl,-export-dynamic else LDFLAGS="" fi # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; NetBSD-*|FreeBSD-*) # FreeBSD 3.* and greater have ELF. # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "${TCL_THREADS}" = "1"; then # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi case $system in FreeBSD-3.*) # FreeBSD-3 doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' TCL_LIB_VERSIONS_OK=nodots ;; esac ;; Darwin-*) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if ($i~/^(isysroot|mmacosx-version-min)/) print "-"$i}'`" CFLAGS="`echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`" if test $do64bit = yes; then case `arch` in ppc) echo "$as_me:$LINENO: checking if compiler accepts -arch ppc64 flag" >&5 echo $ECHO_N "checking if compiler accepts -arch ppc64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_arch_ppc64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_arch_ppc64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_arch_ppc64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_ppc64" >&5 echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6 if test $tcl_cv_cc_arch_ppc64 = yes; then CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes fi ;; i386) echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5 echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_arch_x86_64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_arch_x86_64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_arch_x86_64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_x86_64" >&5 echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6 if test $tcl_cv_cc_arch_x86_64 = yes; then CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes fi ;; *) { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; esac else # Check for combined 32-bit and 64-bit fat build if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then fat_32_64=yes fi fi # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}' echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5 echo $ECHO_N "checking if ld accepts -single_module flag... $ECHO_C" >&6 if test "${tcl_cv_ld_single_module+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_ld_single_module=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_ld_single_module=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi echo "$as_me:$LINENO: result: $tcl_cv_ld_single_module" >&5 echo "${ECHO_T}$tcl_cv_ld_single_module" >&6 if test $tcl_cv_ld_single_module = yes; then SHLIB_LD="${SHLIB_LD} -Wl,-single_module" fi SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: if test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then LDFLAGS="$LDFLAGS -prebind" fi LDFLAGS="$LDFLAGS -headerpad_max_install_names" echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5 echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6 if test "${tcl_cv_ld_search_paths_first+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_ld_search_paths_first=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_ld_search_paths_first=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi echo "$as_me:$LINENO: result: $tcl_cv_ld_search_paths_first" >&5 echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6 if test $tcl_cv_ld_search_paths_first = yes; then LDFLAGS="$LDFLAGS -Wl,-search_paths_first" fi if test "$tcl_cv_cc_visibility_hidden" != yes; then cat >>confdefs.h <<\_ACEOF #define MODULE_SCOPE __private_extern__ _ACEOF fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" # TEA specific: for combined 32 & 64 bit fat builds of Tk # extensions, verify that 64-bit build is possible. if test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"; then if test "${TEA_WINDOWINGSYSTEM}" = x11; then echo "$as_me:$LINENO: checking for 64-bit X11" >&5 echo $ECHO_N "checking for 64-bit X11... $ECHO_C" >&6 if test "${tcl_cv_lib_x11_64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XrmInitialize(); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_lib_x11_64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_lib_x11_64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi echo "$as_me:$LINENO: result: $tcl_cv_lib_x11_64" >&5 echo "${ECHO_T}$tcl_cv_lib_x11_64" >&6 fi # remove 64-bit arch flags from CFLAGS et al. if configuration # does not support 64-bit. if test "${TEA_WINDOWINGSYSTEM}" = aqua -o "$tcl_cv_lib_x11_64" = no; then { echo "$as_me:$LINENO: Removing 64-bit architectures from compiler & linker flags" >&5 echo "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;} for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done fi fi ;; NEXTSTEP-*) SHLIB_CFLAGS="" SHLIB_LD='${CC} -nostdlib -r' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadNext.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OS/390-*) CFLAGS_OPTIMIZE="" # Optimizer is buggy cat >>confdefs.h <<\_ACEOF #define _OE_SOCKETS 1 _ACEOF ;; OSF1-1.0|OSF1-1.1|OSF1-1.2) # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 SHLIB_CFLAGS="" # Hack: make package name same as library name SHLIB_LD='ld -R -export :' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadOSF.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 SHLIB_CFLAGS="-fPIC" if test "$SHARED_BUILD" = 1; then SHLIB_LD="ld -shared" else SHLIB_LD="ld -non_shared" fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" if test "$SHARED_BUILD" = 1; then SHLIB_LD='ld -shared -expect_unresolved "*"' else SHLIB_LD='ld -non_shared -expect_unresolved "*"' fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes; then CFLAGS="$CFLAGS -mieee" else CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" fi # see pthread_intro(3) for pthread support on osf1, k.furukawa if test "${TCL_THREADS}" = 1; then CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` if test "$GCC" = yes; then LIBS="$LIBS -lpthread -lmach -lexc" else CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi fi ;; QNX-6*) # QNX RTP # This may work for all QNX, but it was only reported for v6. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" # dlopen is in -lc on QNX DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. if test "$GCC" = yes; then SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else SHLIB_CFLAGS="-Kpic -belf" LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SINIX*5.4*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-4*) SHLIB_CFLAGS="-PIC" SHLIB_LD="ld" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # SunOS can't handle version numbers with dots in them in library # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it # requires an extra version number at the end of .so file names. # So, the library has to have a name like libtcl75.so.1.0 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; SunOS-5.[0-6]) # Careful to not let 5.10+ fall into this case # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF SHLIB_CFLAGS="-KPIC" # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else SHLIB_LD="/usr/ccs/bin/ld -G -z text" CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi ;; SunOS-5*) # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF SHLIB_CFLAGS="-KPIC" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes; then arch=`isainfo` if test "$arch" = "sparcv9 sparc"; then if test "$GCC" = yes; then if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -m64 -mcpu=v9" LDFLAGS="$LDFLAGS -m64 -mcpu=v9" SHLIB_CFLAGS="-fPIC" fi else do64bit_ok=yes if test "$do64bitVIS" = yes; then CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" else CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" fi # Solaris 64 uses this as well #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" fi else if test "$arch" = "amd64 i386"; then if test "$GCC" = yes; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -xarch=amd64" LDFLAGS="$LDFLAGS -xarch=amd64" fi else { echo "$as_me:$LINENO: WARNING: 64bit mode not supported for $arch" >&5 echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;} fi fi fi # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "$do64bit_ok" = yes; then # We need to specify -static-libgcc or we need to # add the path to the sparv9 libgcc. # JH: static-libgcc is necessary for core Tcl, but may # not be necessary for extensions. SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc" # for finding sparcv9 libgcc, get the regular libgcc # path, remove so name and append 'sparcv9' #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..." #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir" fi else case $system in SunOS-5.[1-9][0-9]*) SHLIB_LD='${CC} -G -z text';; *) SHLIB_LD='/usr/ccs/bin/ld -G -z text';; esac CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' fi ;; UNIX_SV* | UnixWare-5*) SHLIB_CFLAGS="-KPIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 if test "${tcl_cv_ld_Bexport+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_ld_Bexport=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_ld_Bexport=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5 echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6 if test $tcl_cv_ld_Bexport = yes; then LDFLAGS="$LDFLAGS -Wl,-Bexport" fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac if test "$do64bit" = yes -a "$do64bit_ok" = no; then { echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5 echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;} fi # Step 4: disable dynamic loading if requested via a command-line switch. # Check whether --enable-load or --disable-load was given. if test "${enable_load+set}" = set; then enableval="$enable_load" tcl_ok=$enableval else tcl_ok=yes fi; if test "$tcl_ok" = no; then DL_OBJS="" fi if test "x$DL_OBJS" != x; then BUILD_DLTEST="\$(DLTEST_TARGETS)" else { echo "$as_me:$LINENO: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5 echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;} SHLIB_CFLAGS="" SHLIB_LD="" SHLIB_SUFFIX="" DL_OBJS="tclLoadNone.o" DL_LIBS="" LDFLAGS="$LDFLAGS_ORIG" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" BUILD_DLTEST="" fi LDFLAGS="$LDFLAGS $LDFLAGS_ARCH" # If we're running gcc, then change the C flags for compiling shared # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then case $system in AIX-*) ;; BSD/OS*) ;; IRIX*) ;; NetBSD-*|FreeBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac fi if test "$SHARED_LIB_SUFFIX" = ""; then # TEA specific: use PACKAGE_VERSION instead of VERSION SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}' fi if test "$UNSHARED_LIB_SUFFIX" = ""; then # TEA specific: use PACKAGE_VERSION instead of VERSION UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' fi # These must be called after we do the basic CFLAGS checks and # verify any possible 64-bit or similar switches are necessary echo "$as_me:$LINENO: checking for required early compiler flags" >&5 echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6 tcl_flags="" if test "${tcl_cv_flag__isoc99_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__isoc99_source=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _ISOC99_SOURCE 1 #include int main () { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__isoc99_source=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_flag__isoc99_source=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define _ISOC99_SOURCE 1 _ACEOF tcl_flags="$tcl_flags _ISOC99_SOURCE" fi if test "${tcl_cv_flag__largefile64_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile64_source=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE64_SOURCE 1 #include int main () { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile64_source=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_flag__largefile64_source=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define _LARGEFILE64_SOURCE 1 _ACEOF tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" fi if test "${tcl_cv_flag__largefile_source64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *)open64; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile_source64=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE64 1 #include int main () { char *p = (char *)open64; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile_source64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_flag__largefile_source64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define _LARGEFILE_SOURCE64 1 _ACEOF tcl_flags="$tcl_flags _LARGEFILE_SOURCE64" fi if test "x${tcl_flags}" = "x" ; then echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 else echo "$as_me:$LINENO: result: ${tcl_flags}" >&5 echo "${ECHO_T}${tcl_flags}" >&6 fi echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 if test "${tcl_cv_type_64bit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { __int64 value = (__int64) 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_type_64bit=__int64 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_type_64bit="long long" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # See if we should use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { switch (0) { case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ; } ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_type_64bit=${tcl_type_64bit} else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "${tcl_cv_type_64bit}" = none ; then cat >>confdefs.h <<\_ACEOF #define TCL_WIDE_INT_IS_LONG 1 _ACEOF echo "$as_me:$LINENO: result: using long" >&5 echo "${ECHO_T}using long" >&6 elif test "${tcl_cv_type_64bit}" = "__int64" \ -a "${TEA_PLATFORM}" = "windows" ; then # TEA specific: We actually want to use the default tcl.h checks in # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* echo "$as_me:$LINENO: result: using Tcl header defaults" >&5 echo "${ECHO_T}using Tcl header defaults" >&6 else cat >>confdefs.h <<_ACEOF #define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} _ACEOF echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5 echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 # Now check for auxiliary declarations echo "$as_me:$LINENO: checking for struct dirent64" >&5 echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 if test "${tcl_cv_struct_dirent64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct dirent64 p; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_struct_dirent64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_struct_dirent64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5 echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_DIRENT64 1 _ACEOF fi echo "$as_me:$LINENO: checking for struct stat64" >&5 echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 if test "${tcl_cv_struct_stat64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct stat64 p; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_struct_stat64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_struct_stat64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5 echo "${ECHO_T}$tcl_cv_struct_stat64" >&6 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_STAT64 1 _ACEOF fi for ac_func in open64 lseek64 do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for off64_t" >&5 echo $ECHO_N "checking for off64_t... $ECHO_C" >&6 if test "${tcl_cv_type_off64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { off64_t offset; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_type_off64_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_type_off64_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_TYPE_OFF64_T 1 _ACEOF echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi echo "$as_me:$LINENO: checking for build with symbols" >&5 echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6 # Check whether --enable-symbols or --disable-symbols was given. if test "${enable_symbols+set}" = set; then enableval="$enable_symbols" tcl_ok=$enableval else tcl_ok=no fi; DBGX="" if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 else CFLAGS_DEFAULT="${CFLAGS_DEBUG}" LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" if test "$tcl_ok" = "yes"; then echo "$as_me:$LINENO: result: yes (standard debugging)" >&5 echo "${ECHO_T}yes (standard debugging)" >&6 fi fi # TEA specific: if test "${TEA_PLATFORM}" != "windows" ; then LDFLAGS_DEFAULT="${LDFLAGS}" fi if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then cat >>confdefs.h <<\_ACEOF #define TCL_MEM_DEBUG 1 _ACEOF fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5 echo "${ECHO_T}enabled symbols mem debugging" >&6 else echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5 echo "${ECHO_T}enabled $tcl_ok debugging" >&6 fi fi # Step 0.a: Enable 64 bit support? echo "$as_me:$LINENO: checking if 64bit support is requested" >&5 echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6 # Check whether --enable-64bit or --disable-64bit was given. if test "${enable_64bit+set}" = set; then enableval="$enable_64bit" do64bit=$enableval else do64bit=no fi; echo "$as_me:$LINENO: result: $do64bit" >&5 echo "${ECHO_T}$do64bit" >&6 # Step 0.b: Enable Solaris 64 bit VIS support? echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5 echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 # Check whether --enable-64bit-vis or --disable-64bit-vis was given. if test "${enable_64bit_vis+set}" = set; then enableval="$enable_64bit_vis" do64bitVIS=$enableval else do64bitVIS=no fi; echo "$as_me:$LINENO: result: $do64bitVIS" >&5 echo "${ECHO_T}$do64bitVIS" >&6 # Force 64bit on with VIS if test "$do64bitVIS" = "yes"; then do64bit=yes fi # Step 0.c: Check if visibility support is available. Do this here so # that platform specific alternatives can be used below if this fails. echo "$as_me:$LINENO: checking if compiler supports visibility \"hidden\"" >&5 echo $ECHO_N "checking if compiler supports visibility \"hidden\"... $ECHO_C" >&6 if test "${tcl_cv_cc_visibility_hidden+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) void f(void); void f(void) {} int main () { f(); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_visibility_hidden=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_visibility_hidden=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5 echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6 if test $tcl_cv_cc_visibility_hidden = yes; then cat >>confdefs.h <<\_ACEOF #define MODULE_SCOPE extern __attribute__((__visibility__("hidden"))) _ACEOF fi # Step 0.d: Disable -rpath support? echo "$as_me:$LINENO: checking if rpath support is requested" >&5 echo $ECHO_N "checking if rpath support is requested... $ECHO_C" >&6 # Check whether --enable-rpath or --disable-rpath was given. if test "${enable_rpath+set}" = set; then enableval="$enable_rpath" doRpath=$enableval else doRpath=yes fi; echo "$as_me:$LINENO: result: $doRpath" >&5 echo "${ECHO_T}$doRpath" >&6 # TEA specific: Cross-compiling options for Windows/CE builds? if test "${TEA_PLATFORM}" = windows; then echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5 echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6 # Check whether --enable-wince or --disable-wince was given. if test "${enable_wince+set}" = set; then enableval="$enable_wince" doWince=$enableval else doWince=no fi; echo "$as_me:$LINENO: result: $doWince" >&5 echo "${ECHO_T}$doWince" >&6 fi # Step 1: set the variable "system" to hold the name and version number # for the system. echo "$as_me:$LINENO: checking system version" >&5 echo $ECHO_N "checking system version... $ECHO_C" >&6 if test "${tcl_cv_sys_version+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # TEA specific: if test "${TEA_PLATFORM}" = "windows" ; then tcl_cv_sys_version=windows elif test -f /usr/lib/NextStep/software_version; then tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5 echo "$as_me: WARNING: can't find uname command" >&2;} tcl_cv_sys_version=unknown else # Special check for weird MP-RAS system (uname returns weird # results, and the version is kept in special file). if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then tcl_cv_sys_version=MP-RAS-`awk '{print $3}' /etc/.relid` fi if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi fi fi fi echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5 echo "${ECHO_T}$tcl_cv_sys_version" >&6 system=$tcl_cv_sys_version # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then have_dl=yes else have_dl=no fi # Require ranlib early so we can override it in special cases below. # Step 3: set configuration options based on system name and version. # This is similar to Tcl's unix/tcl.m4 except that we've added a # "windows" case. do64bit_ok=no LDFLAGS_ORIG="$LDFLAGS" # When ld needs options to work in 64-bit mode, put them in # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load] # is disabled by the user. [Bug 1016796] LDFLAGS_ARCH="" TCL_EXPORT_FILE_SUFFIX="" UNSHARED_LIB_SUFFIX="" # TEA specific: use PACKAGE_VERSION instead of VERSION TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' ECHO_VERSION='`echo ${PACKAGE_VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O if test "$GCC" = yes; then # TEA specific: CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall" else CFLAGS_WARNING="" fi TCL_NEEDS_EXP_FILE=0 TCL_BUILD_EXP_FILE="" TCL_EXP_FILE="" # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STLIB_LD='${AR} cr' LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" case $system in # TEA specific: windows) # This is a 2-stage check to make sure we have the 64-bit SDK # We have to know where the SDK is installed. # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs # MACHINE is IX86 for LINK, but this is used by the manifest, # which requires x86|amd64|ia64. MACHINE="X86" if test "$do64bit" != "no" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft Platform SDK" fi MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` PATH64="" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # default to AMD64 64-bit build PATH64="${MSSDK}/Bin/Win64/x86/AMD64" ;; ia64) MACHINE="IA64" PATH64="${MSSDK}/Bin/Win64" ;; esac if test ! -d "${PATH64}" ; then { echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5 echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&2;} { echo "$as_me:$LINENO: WARNING: Ensure latest Platform SDK is installed" >&5 echo "$as_me: WARNING: Ensure latest Platform SDK is installed" >&2;} do64bit="no" else echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 do64bit_ok="yes" fi fi if test "$doWince" != "no" ; then if test "$do64bit" != "no" ; then { { echo "$as_me:$LINENO: error: Windows/CE and 64-bit builds incompatible" >&5 echo "$as_me: error: Windows/CE and 64-bit builds incompatible" >&2;} { (exit 1); exit 1; }; } fi if test "$GCC" = "yes" ; then { { echo "$as_me:$LINENO: error: Windows/CE and GCC builds incompatible" >&5 echo "$as_me: error: Windows/CE and GCC builds incompatible" >&2;} { (exit 1); exit 1; }; } fi # First, look for one uninstalled. # the alternative search directory is invoked by --with-celib if test x"${no_celib}" = x ; then # we reset no_celib in case something fails here no_celib=true # Check whether --with-celib or --without-celib was given. if test "${with_celib+set}" = set; then withval="$with_celib" with_celibconfig=${withval} fi; echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5 echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6 if test "${ac_cv_c_celibconfig+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # First check to see if --with-celibconfig was specified. if test x"${with_celibconfig}" != x ; then if test -d "${with_celibconfig}/inc" ; then ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` else { { echo "$as_me:$LINENO: error: ${with_celibconfig} directory doesn't contain inc directory" >&5 echo "$as_me: error: ${with_celibconfig} directory doesn't contain inc directory" >&2;} { (exit 1); exit 1; }; } fi fi # then check for a celib library if test x"${ac_cv_c_celibconfig}" = x ; then for i in \ ../celib-palm-3.0 \ ../celib \ ../../celib-palm-3.0 \ ../../celib \ `ls -dr ../celib-*3.[0-9]* 2>/dev/null` \ ${srcdir}/../celib-palm-3.0 \ ${srcdir}/../celib \ `ls -dr ${srcdir}/../celib-*3.[0-9]* 2>/dev/null` \ ; do if test -d "$i/inc" ; then ac_cv_c_celibconfig=`(cd $i; pwd)` break fi done fi fi if test x"${ac_cv_c_celibconfig}" = x ; then { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5 echo "$as_me: error: Cannot find celib support library directory" >&2;} { (exit 1); exit 1; }; } else no_celib= CELIB_DIR=${ac_cv_c_celibconfig} CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'` echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5 echo "${ECHO_T}found $CELIB_DIR" >&6 fi fi # Set defaults for common evc4/PPC2003 setup # Currently Tcl requires 300+, possibly 420+ for sockets CEVERSION=420; # could be 211 300 301 400 420 ... TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... ARCH=ARM; # could be ARM MIPS X86EM ... PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" if test "$doWince" != "yes"; then # If !yes then the user specified something # Reset ARCH to allow user to skip specifying it ARCH= eval `echo $doWince | awk -F, '{ \ if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \ if ($1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \ if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \ if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \ }'` if test "x${ARCH}" = "x" ; then ARCH=$TARGETCPU; fi fi OSVERSION=WCE$CEVERSION; if test "x${WCEROOT}" = "x" ; then WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" if test ! -d "${WCEROOT}" ; then WCEROOT="C:/Program Files/Microsoft eMbedded Tools" fi fi if test "x${SDKROOT}" = "x" ; then SDKROOT="C:/Program Files/Windows CE Tools" if test ! -d "${SDKROOT}" ; then SDKROOT="C:/Windows CE Tools" fi fi WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'` SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'` if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5 echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;} { (exit 1); exit 1; }; } doWince="no" else # We could PATH_NOSPACE these, but that's not important, # as long as we quote them when used. CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" if test -d "${CEINCLUDE}/${TARGETCPU}" ; then CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" fi CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" fi fi if test "$GCC" != "yes" ; then if test "${SHARED_BUILD}" = "0" ; then runtime=-MT else runtime=-MD fi if test "$do64bit" != "no" ; then # All this magic is necessary for the Win64 SDK RC1 - hobbs CC="\"${PATH64}/cl.exe\"" CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\"" RC="\"${MSSDK}/bin/rc.exe\"" lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" LINKBIN="\"${PATH64}/link.exe\"" CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" # Avoid 'unresolved external symbol __security_cookie' # errors, c.f. http://support.microsoft.com/?id=894573 vars="bufferoverflowU.lib" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done elif test "$doWince" != "no" ; then CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" if test "${TARGETCPU}" = "X86"; then CC="\"${CEBINROOT}/cl.exe\"" else CC="\"${CEBINROOT}/cl${ARCH}.exe\"" fi CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\"" arch=`echo ${ARCH} | awk '{print tolower($0)}'` defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS" if test "${SHARED_BUILD}" = "1" ; then # Static CE builds require static celib as well defs="${defs} _DLL" fi for i in $defs ; do cat >>confdefs.h <<_ACEOF #define $i 1 _ACEOF done cat >>confdefs.h <<_ACEOF #define _WIN32_WCE $CEVERSION _ACEOF cat >>confdefs.h <<_ACEOF #define UNDER_CE $CEVERSION _ACEOF CFLAGS_DEBUG="-nologo -Zi -Od" CFLAGS_OPTIMIZE="-nologo -Ox" lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" LINKBIN="\"${CEBINROOT}/link.exe\"" else RC="rc" lflags="-nologo" LINKBIN="link" CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" fi fi if test "$GCC" = "yes"; then # mingw gcc mode RC="windres" CFLAGS_DEBUG="-g" CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" SHLIB_LD="$CC -shared" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" else SHLIB_LD="${LINKBIN} -dll ${lflags}" # link -lib only works when -lib is the first arg STLIB_LD="${LINKBIN} -lib ${lflags}" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib' PATHTYPE=-w # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp # This essentially turns it all on. LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" LDFLAGS_OPTIMIZE="-release" if test "$doWince" != "no" ; then LDFLAGS_CONSOLE="-link ${lflags}" LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} else LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi fi SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dll" SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll' TCL_LIB_VERSIONS_OK=nodots # Bogus to avoid getting this turned off DL_OBJS="tclLoadNone.obj" ;; AIX-*) if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then # AIX requires the _r compiler when gcc isn't being used case "${CC}" in *_r) # ok ... ;; *) CC=${CC}_r ;; esac echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 echo "${ECHO_T}Using $CC for compiling with threads" >&6 fi LIBS="$LIBS -lc" SHLIB_CFLAGS="" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" LD_LIBRARY_PATH_VAR="LIBPATH" # Check to enable 64-bit flags for compiler/linker on AIX 4+ if test "$do64bit" = yes -a "`uname -v`" -gt 3; then if test "$GCC" = yes; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -q64" LDFLAGS_ARCH="-q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" fi fi if test "`uname -m`" = ia64; then # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC SHLIB_LD="/usr/ccs/bin/ld -G -z text" # AIX-5 has dl* in libc.so DL_LIBS="" if test "$GCC" = yes; then CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' else CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' else if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' else SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" fi SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} TCL_NEEDS_EXP_FILE=1 # TEA specific: use PACKAGE_VERSION instead of VERSION TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp' fi # AIX v<=4.1 has some different flags than 4.2+ if test "$system" = "AIX-4.1" -o "`uname -v`" -lt 4; then case $LIBOBJS in "tclLoadAix.$ac_objext" | \ *" tclLoadAix.$ac_objext" | \ "tclLoadAix.$ac_objext "* | \ *" tclLoadAix.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" ;; esac DL_LIBS="-lld" fi # On AIX <=v4 systems, libbsd.a has to be linked in to support # non-blocking file IO. This library has to be linked in after # the MATH_LIBS or it breaks the pow() function. The way to # insure proper sequencing, is to add it to the tail of MATH_LIBS. # This library also supplies gettimeofday. # # AIX does not have a timezone field in struct tm. When the AIX # bsd library is used, the timezone global and the gettimeofday # methods are to be avoided for timezone deduction instead, we # deduce the timezone by comparing the localtime result on a # known GMT value. echo "$as_me:$LINENO: checking for gettimeofday in -lbsd" >&5 echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gettimeofday (); int main () { gettimeofday (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gettimeofday=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gettimeofday=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gettimeofday" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 if test $ac_cv_lib_bsd_gettimeofday = yes; then libbsd=yes else libbsd=no fi if test $libbsd = yes; then MATH_LIBS="$MATH_LIBS -lbsd" cat >>confdefs.h <<\_ACEOF #define USE_DELTA_FOR_TZ 1 _ACEOF fi ;; BeOS*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -nostart' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" #----------------------------------------------------------- # Check for inet_ntoa in -lbind, for BeOS (which also needs # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5 echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6 if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_ntoa (); int main () { inet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bind_inet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bind_inet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6 if test $ac_cv_lib_bind_inet_ntoa = yes; then LIBS="$LIBS -lbind -lsocket" fi ;; BSD/OS-2.1*|BSD/OS-3*) SHLIB_CFLAGS="" SHLIB_LD="shlicc -r" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; BSD/OS-4.*) SHLIB_CFLAGS="-export-dynamic -fPIC" SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; dgux*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; HP-UX-*.11.*) # Use updated header definitions where possible cat >>confdefs.h <<\_ACEOF #define _XOPEN_SOURCE_EXTENDED 1 _ACEOF # TEA specific: Needed by Tcl, but not most extensions #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?]) #LIBS="$LIBS -lxnet" # Use the XOPEN network library if test "`uname -m`" = ia64; then SHLIB_SUFFIX=".so" # Use newer C++ library for C++ extensions #if test "$GCC" != "yes" ; then # CPPFLAGS="-AA" #fi else SHLIB_SUFFIX=".sl" fi echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc #CFLAGS="$CFLAGS +DAportable" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes"; then if test "$GCC" = yes; then case `${CC} -dumpmachine` in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} ;; esac else do64bit_ok=yes CFLAGS="$CFLAGS +DD64" LDFLAGS_ARCH="+DD64" fi fi ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS="" DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi ;; IRIX-5.*) SHLIB_CFLAGS="" SHLIB_LD="ld -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi ;; IRIX-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes; then CFLAGS="$CFLAGS -mabi=n32" LDFLAGS="$LDFLAGS -mabi=n32" else case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) CFLAGS="$CFLAGS -n32" ;; esac LDFLAGS="$LDFLAGS -n32" fi ;; IRIX64-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes; then if test "$GCC" = yes; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5 echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} else do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS_ARCH="-64" fi fi ;; Linux*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" # TEA specific: CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings # when you inline the string and math operations. Turn this off to # get rid of the warnings. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}' DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "`uname -m`" = "alpha"; then CFLAGS="$CFLAGS -mieee" fi if test $do64bit = yes; then echo "$as_me:$LINENO: checking if compiler accepts -m64 flag" >&5 echo $ECHO_N "checking if compiler accepts -m64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_m64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_m64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_m64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_m64" >&5 echo "${ECHO_T}$tcl_cv_cc_m64" >&6 if test $tcl_cv_cc_m64 = yes; then CFLAGS="$CFLAGS -m64" do64bit_ok=yes fi fi # The combo of gcc + glibc has a bug related to inlining of # functions like strtod(). The -fno-builtin flag should address # this problem but it does not work. The -fno-inline flag is kind # of overkill but it works. Disable inlining only when one of the # files in compat/*.c is being linked in. if test x"${USE_COMPAT}" != x; then CFLAGS="$CFLAGS -fno-inline" fi ;; GNU*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" SHLIB_LD='${CC} -shared' DL_OBJS="" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" if test "`uname -m`" = "alpha"; then CFLAGS="$CFLAGS -mieee" fi ;; Lynx*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE=-02 SHLIB_LD='${CC} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi ;; MP-RAS-02*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; MP-RAS-*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,-Bexport" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; NetBSD-1.*|FreeBSD-[1-2].*) SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi echo "$as_me:$LINENO: checking for ELF" >&5 echo $ECHO_N "checking for ELF... $ECHO_C" >&6 if test "${tcl_cv_ld_elf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __ELF__ yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then tcl_cv_ld_elf=yes else tcl_cv_ld_elf=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 echo "${ECHO_T}$tcl_cv_ld_elf" >&6 if test $tcl_cv_ld_elf = yes; then SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' else SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' fi # Ancient FreeBSD doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; OpenBSD-*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' echo "$as_me:$LINENO: checking for ELF" >&5 echo $ECHO_N "checking for ELF... $ECHO_C" >&6 if test "${tcl_cv_ld_elf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __ELF__ yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then tcl_cv_ld_elf=yes else tcl_cv_ld_elf=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 echo "${ECHO_T}$tcl_cv_ld_elf" >&6 if test $tcl_cv_ld_elf = yes; then LDFLAGS=-Wl,-export-dynamic else LDFLAGS="" fi # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; NetBSD-*|FreeBSD-*) # FreeBSD 3.* and greater have ELF. # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "${TCL_THREADS}" = "1"; then # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi case $system in FreeBSD-3.*) # FreeBSD-3 doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' TCL_LIB_VERSIONS_OK=nodots ;; esac ;; Darwin-*) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if ($i~/^(isysroot|mmacosx-version-min)/) print "-"$i}'`" CFLAGS="`echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`" if test $do64bit = yes; then case `arch` in ppc) echo "$as_me:$LINENO: checking if compiler accepts -arch ppc64 flag" >&5 echo $ECHO_N "checking if compiler accepts -arch ppc64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_arch_ppc64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_arch_ppc64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_arch_ppc64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_ppc64" >&5 echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6 if test $tcl_cv_cc_arch_ppc64 = yes; then CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes fi ;; i386) echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5 echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_arch_x86_64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_arch_x86_64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_arch_x86_64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_x86_64" >&5 echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6 if test $tcl_cv_cc_arch_x86_64 = yes; then CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes fi ;; *) { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; esac else # Check for combined 32-bit and 64-bit fat build if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then fat_32_64=yes fi fi # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}' echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5 echo $ECHO_N "checking if ld accepts -single_module flag... $ECHO_C" >&6 if test "${tcl_cv_ld_single_module+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_ld_single_module=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_ld_single_module=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi echo "$as_me:$LINENO: result: $tcl_cv_ld_single_module" >&5 echo "${ECHO_T}$tcl_cv_ld_single_module" >&6 if test $tcl_cv_ld_single_module = yes; then SHLIB_LD="${SHLIB_LD} -Wl,-single_module" fi SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: if test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then LDFLAGS="$LDFLAGS -prebind" fi LDFLAGS="$LDFLAGS -headerpad_max_install_names" echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5 echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6 if test "${tcl_cv_ld_search_paths_first+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_ld_search_paths_first=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_ld_search_paths_first=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi echo "$as_me:$LINENO: result: $tcl_cv_ld_search_paths_first" >&5 echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6 if test $tcl_cv_ld_search_paths_first = yes; then LDFLAGS="$LDFLAGS -Wl,-search_paths_first" fi if test "$tcl_cv_cc_visibility_hidden" != yes; then cat >>confdefs.h <<\_ACEOF #define MODULE_SCOPE __private_extern__ _ACEOF fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" # TEA specific: for combined 32 & 64 bit fat builds of Tk # extensions, verify that 64-bit build is possible. if test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"; then if test "${TEA_WINDOWINGSYSTEM}" = x11; then echo "$as_me:$LINENO: checking for 64-bit X11" >&5 echo $ECHO_N "checking for 64-bit X11... $ECHO_C" >&6 if test "${tcl_cv_lib_x11_64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XrmInitialize(); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_lib_x11_64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_lib_x11_64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi echo "$as_me:$LINENO: result: $tcl_cv_lib_x11_64" >&5 echo "${ECHO_T}$tcl_cv_lib_x11_64" >&6 fi # remove 64-bit arch flags from CFLAGS et al. if configuration # does not support 64-bit. if test "${TEA_WINDOWINGSYSTEM}" = aqua -o "$tcl_cv_lib_x11_64" = no; then { echo "$as_me:$LINENO: Removing 64-bit architectures from compiler & linker flags" >&5 echo "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;} for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done fi fi ;; NEXTSTEP-*) SHLIB_CFLAGS="" SHLIB_LD='${CC} -nostdlib -r' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadNext.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OS/390-*) CFLAGS_OPTIMIZE="" # Optimizer is buggy cat >>confdefs.h <<\_ACEOF #define _OE_SOCKETS 1 _ACEOF ;; OSF1-1.0|OSF1-1.1|OSF1-1.2) # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 SHLIB_CFLAGS="" # Hack: make package name same as library name SHLIB_LD='ld -R -export :' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadOSF.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 SHLIB_CFLAGS="-fPIC" if test "$SHARED_BUILD" = 1; then SHLIB_LD="ld -shared" else SHLIB_LD="ld -non_shared" fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" if test "$SHARED_BUILD" = 1; then SHLIB_LD='ld -shared -expect_unresolved "*"' else SHLIB_LD='ld -non_shared -expect_unresolved "*"' fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes; then CFLAGS="$CFLAGS -mieee" else CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" fi # see pthread_intro(3) for pthread support on osf1, k.furukawa if test "${TCL_THREADS}" = 1; then CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` if test "$GCC" = yes; then LIBS="$LIBS -lpthread -lmach -lexc" else CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi fi ;; QNX-6*) # QNX RTP # This may work for all QNX, but it was only reported for v6. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" # dlopen is in -lc on QNX DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. if test "$GCC" = yes; then SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else SHLIB_CFLAGS="-Kpic -belf" LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SINIX*5.4*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-4*) SHLIB_CFLAGS="-PIC" SHLIB_LD="ld" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # SunOS can't handle version numbers with dots in them in library # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it # requires an extra version number at the end of .so file names. # So, the library has to have a name like libtcl75.so.1.0 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; SunOS-5.[0-6]) # Careful to not let 5.10+ fall into this case # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF SHLIB_CFLAGS="-KPIC" # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else SHLIB_LD="/usr/ccs/bin/ld -G -z text" CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi ;; SunOS-5*) # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF SHLIB_CFLAGS="-KPIC" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes; then arch=`isainfo` if test "$arch" = "sparcv9 sparc"; then if test "$GCC" = yes; then if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -m64 -mcpu=v9" LDFLAGS="$LDFLAGS -m64 -mcpu=v9" SHLIB_CFLAGS="-fPIC" fi else do64bit_ok=yes if test "$do64bitVIS" = yes; then CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" else CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" fi # Solaris 64 uses this as well #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" fi else if test "$arch" = "amd64 i386"; then if test "$GCC" = yes; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -xarch=amd64" LDFLAGS="$LDFLAGS -xarch=amd64" fi else { echo "$as_me:$LINENO: WARNING: 64bit mode not supported for $arch" >&5 echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;} fi fi fi # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "$do64bit_ok" = yes; then # We need to specify -static-libgcc or we need to # add the path to the sparv9 libgcc. # JH: static-libgcc is necessary for core Tcl, but may # not be necessary for extensions. SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc" # for finding sparcv9 libgcc, get the regular libgcc # path, remove so name and append 'sparcv9' #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..." #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir" fi else case $system in SunOS-5.[1-9][0-9]*) SHLIB_LD='${CC} -G -z text';; *) SHLIB_LD='/usr/ccs/bin/ld -G -z text';; esac CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' fi ;; UNIX_SV* | UnixWare-5*) SHLIB_CFLAGS="-KPIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 if test "${tcl_cv_ld_Bexport+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_ld_Bexport=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_ld_Bexport=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5 echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6 if test $tcl_cv_ld_Bexport = yes; then LDFLAGS="$LDFLAGS -Wl,-Bexport" fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac if test "$do64bit" = yes -a "$do64bit_ok" = no; then { echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5 echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;} fi # Step 4: disable dynamic loading if requested via a command-line switch. # Check whether --enable-load or --disable-load was given. if test "${enable_load+set}" = set; then enableval="$enable_load" tcl_ok=$enableval else tcl_ok=yes fi; if test "$tcl_ok" = no; then DL_OBJS="" fi if test "x$DL_OBJS" != x; then BUILD_DLTEST="\$(DLTEST_TARGETS)" else { echo "$as_me:$LINENO: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5 echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;} SHLIB_CFLAGS="" SHLIB_LD="" SHLIB_SUFFIX="" DL_OBJS="tclLoadNone.o" DL_LIBS="" LDFLAGS="$LDFLAGS_ORIG" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" BUILD_DLTEST="" fi LDFLAGS="$LDFLAGS $LDFLAGS_ARCH" # If we're running gcc, then change the C flags for compiling shared # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then case $system in AIX-*) ;; BSD/OS*) ;; IRIX*) ;; NetBSD-*|FreeBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac fi if test "$SHARED_LIB_SUFFIX" = ""; then # TEA specific: use PACKAGE_VERSION instead of VERSION SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}' fi if test "$UNSHARED_LIB_SUFFIX" = ""; then # TEA specific: use PACKAGE_VERSION instead of VERSION UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' fi # These must be called after we do the basic CFLAGS checks and # verify any possible 64-bit or similar switches are necessary echo "$as_me:$LINENO: checking for required early compiler flags" >&5 echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6 tcl_flags="" if test "${tcl_cv_flag__isoc99_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__isoc99_source=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _ISOC99_SOURCE 1 #include int main () { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__isoc99_source=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_flag__isoc99_source=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define _ISOC99_SOURCE 1 _ACEOF tcl_flags="$tcl_flags _ISOC99_SOURCE" fi if test "${tcl_cv_flag__largefile64_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile64_source=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE64_SOURCE 1 #include int main () { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile64_source=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_flag__largefile64_source=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define _LARGEFILE64_SOURCE 1 _ACEOF tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" fi if test "${tcl_cv_flag__largefile_source64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *)open64; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile_source64=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE64 1 #include int main () { char *p = (char *)open64; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile_source64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_flag__largefile_source64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define _LARGEFILE_SOURCE64 1 _ACEOF tcl_flags="$tcl_flags _LARGEFILE_SOURCE64" fi if test "x${tcl_flags}" = "x" ; then echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 else echo "$as_me:$LINENO: result: ${tcl_flags}" >&5 echo "${ECHO_T}${tcl_flags}" >&6 fi echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 if test "${tcl_cv_type_64bit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { __int64 value = (__int64) 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_type_64bit=__int64 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_type_64bit="long long" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # See if we should use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { switch (0) { case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ; } ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_type_64bit=${tcl_type_64bit} else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "${tcl_cv_type_64bit}" = none ; then cat >>confdefs.h <<\_ACEOF #define TCL_WIDE_INT_IS_LONG 1 _ACEOF echo "$as_me:$LINENO: result: using long" >&5 echo "${ECHO_T}using long" >&6 elif test "${tcl_cv_type_64bit}" = "__int64" \ -a "${TEA_PLATFORM}" = "windows" ; then # TEA specific: We actually want to use the default tcl.h checks in # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* echo "$as_me:$LINENO: result: using Tcl header defaults" >&5 echo "${ECHO_T}using Tcl header defaults" >&6 else cat >>confdefs.h <<_ACEOF #define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} _ACEOF echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5 echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 # Now check for auxiliary declarations echo "$as_me:$LINENO: checking for struct dirent64" >&5 echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 if test "${tcl_cv_struct_dirent64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct dirent64 p; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_struct_dirent64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_struct_dirent64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5 echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_DIRENT64 1 _ACEOF fi echo "$as_me:$LINENO: checking for struct stat64" >&5 echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 if test "${tcl_cv_struct_stat64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct stat64 p; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_struct_stat64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_struct_stat64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5 echo "${ECHO_T}$tcl_cv_struct_stat64" >&6 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_STAT64 1 _ACEOF fi for ac_func in open64 lseek64 do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for off64_t" >&5 echo $ECHO_N "checking for off64_t... $ECHO_C" >&6 if test "${tcl_cv_type_off64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { off64_t offset; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_type_off64_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_type_off64_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_TYPE_OFF64_T 1 _ACEOF echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XtMalloc (0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 not_really_there="yes" fi rm -f conftest.err conftest.$ac_ext else if test ! -r $x_includes/X11/Intrinsic.h; then not_really_there="yes" fi fi fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then echo "$as_me:$LINENO: checking for X11 header files" >&5 echo $ECHO_N "checking for X11 header files... $ECHO_C" >&6 found_xincludes="no" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then found_xincludes="yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 found_xincludes="no" fi rm -f conftest.err conftest.$ac_ext if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then echo "$as_me:$LINENO: result: $i" >&5 echo "${ECHO_T}$i" >&6 XINCLUDES=" -I$i" found_xincludes="yes" break fi done fi else if test "$x_includes" != ""; then XINCLUDES="-I$x_includes" found_xincludes="yes" fi fi if test found_xincludes = "no"; then echo "$as_me:$LINENO: result: couldn't find any!" >&5 echo "${ECHO_T}couldn't find any!" >&6 fi if test "$no_x" = yes; then echo "$as_me:$LINENO: checking for X11 libraries" >&5 echo $ECHO_N "checking for X11 libraries... $ECHO_C" >&6 XLIBSW=nope dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" for i in $dirs ; do if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then echo "$as_me:$LINENO: result: $i" >&5 echo "${ECHO_T}$i" >&6 XLIBSW="-L$i -lX11" x_libraries="$i" break fi done else if test "$x_libraries" = ""; then XLIBSW=-lX11 else XLIBSW="-L$x_libraries -lX11" fi fi if test "$XLIBSW" = nope ; then echo "$as_me:$LINENO: checking for XCreateWindow in -lXwindow" >&5 echo $ECHO_N "checking for XCreateWindow in -lXwindow... $ECHO_C" >&6 if test "${ac_cv_lib_Xwindow_XCreateWindow+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXwindow $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XCreateWindow (); int main () { XCreateWindow (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xwindow_XCreateWindow=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xwindow_XCreateWindow=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xwindow_XCreateWindow" >&5 echo "${ECHO_T}$ac_cv_lib_Xwindow_XCreateWindow" >&6 if test $ac_cv_lib_Xwindow_XCreateWindow = yes; then XLIBSW=-lXwindow fi fi if test "$XLIBSW" = nope ; then echo "$as_me:$LINENO: result: could not find any! Using -lX11." >&5 echo "${ECHO_T}could not find any! Using -lX11." >&6 XLIBSW=-lX11 fi # TEA specific: if test x"${XLIBSW}" != x ; then PKG_LIBS="${PKG_LIBS} ${XLIBSW}" fi fi # Platform-specific stuff: # case "${TEA_WINDOWINGSYSTEM}" in win32) CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb" vars="gdi32.lib user32.lib" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done vars="\$(WIN_OBJECTS)" for i in $vars; do case $i in \$*) # allow $-var names PKG_SOURCES="$PKG_SOURCES $i" PKG_OBJECTS="$PKG_OBJECTS $i" ;; *) # check for existence - allows for generic/win/unix VPATH # To add more dirs here (like 'src'), you have to update VPATH # in Makefile.in as well if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ ; then { { echo "$as_me:$LINENO: error: could not find source file '$i'" >&5 echo "$as_me: error: could not find source file '$i'" >&2;} { (exit 1); exit 1; }; } fi PKG_SOURCES="$PKG_SOURCES $i" # this assumes it is in a VPATH dir i=`basename $i` # handle user calling this before or after TEA_SETUP_COMPILER if test x"${OBJEXT}" != x ; then j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" else j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" fi PKG_OBJECTS="$PKG_OBJECTS $j" ;; esac done # Check if we have uxtheme.h for xpnative look echo "$as_me:$LINENO: checking for uxtheme.h" >&5 echo $ECHO_N "checking for uxtheme.h... $ECHO_C" >&6 if test "${ac_cv_header_uxtheme_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_uxtheme_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_uxtheme_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_uxtheme_h" >&5 echo "${ECHO_T}$ac_cv_header_uxtheme_h" >&6 if test $ac_cv_header_uxtheme_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_UXTHEME_H 1 _ACEOF else { echo "$as_me:$LINENO: xpnative theme will be unavailable" >&5 echo "$as_me: xpnative theme will be unavailable" >&6;} fi ;; aqua) vars="-I${TK_TOP_DIR_NATIVE}/macosx" for i in $vars; do PKG_INCLUDES="$PKG_INCLUDES $i" done vars="-framework Carbon" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done vars="\$(MACOSX_OBJECTS)" for i in $vars; do case $i in \$*) # allow $-var names PKG_SOURCES="$PKG_SOURCES $i" PKG_OBJECTS="$PKG_OBJECTS $i" ;; *) # check for existence - allows for generic/win/unix VPATH # To add more dirs here (like 'src'), you have to update VPATH # in Makefile.in as well if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ ; then { { echo "$as_me:$LINENO: error: could not find source file '$i'" >&5 echo "$as_me: error: could not find source file '$i'" >&2;} { (exit 1); exit 1; }; } fi PKG_SOURCES="$PKG_SOURCES $i" # this assumes it is in a VPATH dir i=`basename $i` # handle user calling this before or after TEA_SETUP_COMPILER if test x"${OBJEXT}" != x ; then j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" else j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" fi PKG_OBJECTS="$PKG_OBJECTS $j" ;; esac done ;; x11) ;; esac; CLEANFILES="$CLEANFILES pkgIndex.tcl" cat >>confdefs.h <<\_ACEOF #define USE_TCL_STUBS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define USE_TK_STUBS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define BUILD_tile 1 _ACEOF if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then MAKE_STATIC_LIB="\${STLIB_LD} -out:\$@ \$(PKG_OBJECTS)" MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\$@ \$(PKG_OBJECTS)" MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)" else MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)" MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}" MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)" fi if test "${SHARED_BUILD}" = "1" ; then MAKE_LIB="${MAKE_SHARED_LIB} " else MAKE_LIB="${MAKE_STATIC_LIB} " fi #-------------------------------------------------------------------- # Shared libraries and static libraries have different names. # Use the double eval to make sure any variables in the suffix is # substituted. (@@@ Might not be necessary anymore) #-------------------------------------------------------------------- if test "${TEA_PLATFORM}" = "windows" ; then if test "${SHARED_BUILD}" = "1" ; then # We force the unresolved linking of symbols that are really in # the private libraries of Tcl and Tk. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" if test x"${TK_BIN_DIR}" != x ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" fi eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" else eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" fi # Some packages build their own stubs libraries eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" if test "$GCC" = "yes"; then PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE} fi # These aren't needed on Windows (either MSVC or gcc) RANLIB=: RANLIB_STUB=: else RANLIB_STUB="${RANLIB}" if test "${SHARED_BUILD}" = "1" ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" if test x"${TK_BIN_DIR}" != x ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" fi eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" RANLIB=: else eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" fi # Some packages build their own stubs libraries eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" fi # These are escaped so that only CFLAGS is picked up at configure time. # The other values will be substituted at make time. CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" if test "${SHARED_BUILD}" = "1" ; then CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" fi # Fix PKG_STUB_LIB_FILE: # + base name is "ttkstub", not "tilestub" # + do not include version number in library name # if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then PKG_STUB_LIB_FILE=ttkstub.lib else PKG_STUB_LIB_FILE=libttkstub.a fi; echo "$as_me:$LINENO: checking for wish" >&5 echo $ECHO_N "checking for wish... $ECHO_C" >&6 if test -f "${TK_BIN_DIR}/Makefile" ; then # tkConfig.sh is in Tk build directory if test "${TEA_PLATFORM}" = "windows"; then WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}" else WISH_PROG="${TK_BIN_DIR}/wish" fi else # tkConfig.sh is in install location if test "${TEA_PLATFORM}" = "windows"; then WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}" else WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}" fi list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \ `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \ `ls -d ${TK_PREFIX}/bin 2>/dev/null`" for i in $list ; do if test -f "$i/${WISH_PROG}" ; then REAL_TK_BIN_DIR="`cd "$i"; pwd`/" break fi done WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}" fi echo "$as_me:$LINENO: result: ${WISH_PROG}" >&5 echo "${ECHO_T}${WISH_PROG}" >&6 CONFIGURE_OUTPUTS="Makefile config.cache config.log config.status" ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS="" CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS="" : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by tile $as_me 0.8.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ tile config.status 0.8.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CYGPATH@,$CYGPATH,;t t s,@EXEEXT@,$EXEEXT,;t t s,@PKG_LIB_FILE@,$PKG_LIB_FILE,;t t s,@PKG_STUB_LIB_FILE@,$PKG_STUB_LIB_FILE,;t t s,@PKG_STUB_SOURCES@,$PKG_STUB_SOURCES,;t t s,@PKG_STUB_OBJECTS@,$PKG_STUB_OBJECTS,;t t s,@PKG_TCL_SOURCES@,$PKG_TCL_SOURCES,;t t s,@PKG_HEADERS@,$PKG_HEADERS,;t t s,@PKG_INCLUDES@,$PKG_INCLUDES,;t t s,@PKG_LIBS@,$PKG_LIBS,;t t s,@PKG_CFLAGS@,$PKG_CFLAGS,;t t s,@TCL_VERSION@,$TCL_VERSION,;t t s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t s,@TCL_LIBS@,$TCL_LIBS,;t t s,@TCL_DEFS@,$TCL_DEFS,;t t s,@TCL_EXTRA_CFLAGS@,$TCL_EXTRA_CFLAGS,;t t s,@TCL_LD_FLAGS@,$TCL_LD_FLAGS,;t t s,@TCL_SHLIB_LD_LIBS@,$TCL_SHLIB_LD_LIBS,;t t s,@TK_VERSION@,$TK_VERSION,;t t s,@TK_BIN_DIR@,$TK_BIN_DIR,;t t s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t s,@TK_LIB_FILE@,$TK_LIB_FILE,;t t s,@TK_LIB_FLAG@,$TK_LIB_FLAG,;t t s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;t t s,@TK_STUB_LIB_FILE@,$TK_STUB_LIB_FILE,;t t s,@TK_STUB_LIB_FLAG@,$TK_STUB_LIB_FLAG,;t t s,@TK_STUB_LIB_SPEC@,$TK_STUB_LIB_SPEC,;t t s,@TK_LIBS@,$TK_LIBS,;t t s,@TK_XINCLUDES@,$TK_XINCLUDES,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@EGREP@,$EGREP,;t t s,@MATH_LIBS@,$MATH_LIBS,;t t s,@PKG_SOURCES@,$PKG_SOURCES,;t t s,@PKG_OBJECTS@,$PKG_OBJECTS,;t t s,@TCL_TOP_DIR_NATIVE@,$TCL_TOP_DIR_NATIVE,;t t s,@TCL_GENERIC_DIR_NATIVE@,$TCL_GENERIC_DIR_NATIVE,;t t s,@TCL_UNIX_DIR_NATIVE@,$TCL_UNIX_DIR_NATIVE,;t t s,@TCL_WIN_DIR_NATIVE@,$TCL_WIN_DIR_NATIVE,;t t s,@TCL_BMAP_DIR_NATIVE@,$TCL_BMAP_DIR_NATIVE,;t t s,@TCL_TOOL_DIR_NATIVE@,$TCL_TOOL_DIR_NATIVE,;t t s,@TCL_PLATFORM_DIR_NATIVE@,$TCL_PLATFORM_DIR_NATIVE,;t t s,@TCL_INCLUDES@,$TCL_INCLUDES,;t t s,@TK_TOP_DIR_NATIVE@,$TK_TOP_DIR_NATIVE,;t t s,@TK_UNIX_DIR_NATIVE@,$TK_UNIX_DIR_NATIVE,;t t s,@TK_WIN_DIR_NATIVE@,$TK_WIN_DIR_NATIVE,;t t s,@TK_GENERIC_DIR_NATIVE@,$TK_GENERIC_DIR_NATIVE,;t t s,@TK_XLIB_DIR_NATIVE@,$TK_XLIB_DIR_NATIVE,;t t s,@TK_PLATFORM_DIR_NATIVE@,$TK_PLATFORM_DIR_NATIVE,;t t s,@TK_INCLUDES@,$TK_INCLUDES,;t t s,@TCL_THREADS@,$TCL_THREADS,;t t s,@SHARED_BUILD@,$SHARED_BUILD,;t t s,@AR@,$AR,;t t s,@CELIB_DIR@,$CELIB_DIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@DL_LIBS@,$DL_LIBS,;t t s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t s,@STLIB_LD@,$STLIB_LD,;t t s,@SHLIB_LD@,$SHLIB_LD,;t t s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t s,@TCL_DBGX@,$TCL_DBGX,;t t s,@CLEANFILES@,$CLEANFILES,;t t s,@MAKE_LIB@,$MAKE_LIB,;t t s,@MAKE_SHARED_LIB@,$MAKE_SHARED_LIB,;t t s,@MAKE_STATIC_LIB@,$MAKE_STATIC_LIB,;t t s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t s,@RANLIB_STUB@,$RANLIB_STUB,;t t s,@WISH_PROG@,$WISH_PROG,;t t s,@CONFIGURE_OUTPUTS@,$CONFIGURE_OUTPUTS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi #*EOF* tile-0.8.2/configure.in0000644000076500007650000000343210731266207014363 0ustar joejoe00000000000000# # configure.in,v 1.39 2007/12/16 18:20:55 jenglish Exp # AC_REVISION(1.39) AC_INIT([tile],[0.8.2]) AC_CONFIG_AUX_DIR(tclconfig) # Usual Tcl stuff: # TEA_INIT([3.6]) TEA_PATH_TCLCONFIG TEA_LOAD_TCLCONFIG TEA_PATH_TKCONFIG TEA_LOAD_TKCONFIG TEA_PREFIX TEA_SETUP_COMPILER TEA_ADD_SOURCES([]) #TEA_ADD_HEADERS([]) TEA_ADD_INCLUDES([-I. -I\"`${CYGPATH} ${srcdir}/generic`\"]) #TEA_ADD_LIBS([]) #TEA_ADD_CFLAGS([]) #TEA_ADD_STUB_SOURCES([]) #TEA_ADD_TCL_SOURCES([]) TEA_PRIVATE_TCL_HEADERS TEA_PRIVATE_TK_HEADERS # Build stuff: # TEA_ENABLE_THREADS TEA_ENABLE_SHARED TEA_ENABLE_SYMBOLS TEA_CONFIG_CFLAGS TEA_PATH_X # Platform-specific stuff: # case "${TEA_WINDOWINGSYSTEM}" in win32) CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb" TEA_ADD_LIBS([gdi32.lib user32.lib]) TEA_ADD_SOURCES([\$(WIN_OBJECTS)]) # Check if we have uxtheme.h for xpnative look AC_CHECK_HEADER([uxtheme.h], [AC_DEFINE(HAVE_UXTHEME_H)], [AC_MSG_NOTICE([xpnative theme will be unavailable])], [#include ]) ;; aqua) TEA_ADD_INCLUDES([-I${TK_TOP_DIR_NATIVE}/macosx]) TEA_ADD_LIBS([-framework Carbon]) TEA_ADD_SOURCES([\$(MACOSX_OBJECTS)]) ;; x11) ;; esac; CLEANFILES="$CLEANFILES pkgIndex.tcl" AC_SUBST(CLEANFILES) AC_DEFINE(USE_TCL_STUBS,[1],[Should always be 1]) AC_DEFINE(USE_TK_STUBS,[1],[Should always be 1]) AC_DEFINE(BUILD_tile,[1],[Set to 1 when building package]) TEA_MAKE_LIB # Fix PKG_STUB_LIB_FILE: # + base name is "ttkstub", not "tilestub" # + do not include version number in library name # if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then PKG_STUB_LIB_FILE=ttkstub.lib else PKG_STUB_LIB_FILE=libttkstub.a fi; TEA_PROG_WISH CONFIGURE_OUTPUTS="Makefile config.cache config.log config.status" AC_SUBST(CONFIGURE_OUTPUTS) AC_CONFIG_FILES([Makefile]) AC_OUTPUT #*EOF* tile-0.8.2/license.terms0000644000076500007650000000222107742634660014555 0ustar joejoe00000000000000LICENSE ("MIT-style") This software is Copyright (C) 2003 Joe English and other parties. The following terms apply to all files associated with this software unless explicitly disclaimed in individual files. The author(s) hereby grant permission to use, copy, modify, distribute, and license this software and its documentation for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included in any distributions. No written agreement, license, or royalty fee is required for any of the authorized uses. Modifications to this software may be copyrighted by their authors and need not follow the licensing terms described here, provided that the new terms are clearly indicated on the first page of each file where they apply. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS for a PARTICULAR PURPOSE. IN NO EVENT shall the AUTHORS of THIS SOFTWARE be LIABLE to ANY PARTY for DIRECT, INDIRECT, SPECIAL, INCIDENTAL, or CONSEQUENTIAL DAMAGES arising out of the USE of THIS SOFTWARE and its DOCUMENTATION. tile-0.8.2/doc/0000755000076500007650000000000010731273212012607 5ustar joejoe00000000000000tile-0.8.2/doc/xml/0000755000076500007650000000000010731273212013407 5ustar joejoe00000000000000tile-0.8.2/doc/xml/Geometry.tmml0000644000076500007650000002510310731273205016100 0ustar joejoe00000000000000 geometry Ttk_MakeBox Ttk_PadBox Ttk_ExpandBox Ttk_PackBox Ttk_StickBox Ttk_PlaceBox Ttk_BoxContains Ttk_MakePadding Ttk_UniformPadding Ttk_AddPadding Ttk_RelievePadding Ttk_GetPaddingFromObj Ttk_GetBorderFromObj Ttk_GetStickyFromObj Geometry utilities #include <tkTheme.h> Ttk_Box Ttk_MakeBox(int x, int y, int width, int height); Ttk_Box Ttk_PadBox(Ttk_Box parcel, Ttk_Padding padding); Ttk_Box Ttk_ExpandBox(Ttk_Box parcel, Ttk_Padding padding); Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int width, int height, Ttk_Side side); Ttk_Box Ttk_StickBox(Ttk_Box parcel, int width, int height, unsigned sticky); Ttk_Box Ttk_PlaceBox(Ttk_Box *cavity, int width, int height, Ttk_Side side, unsigned sticky); Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int width, int height, Tk_Anchor anchor); Ttk_Padding Ttk_MakePadding(short left, short top, short right, short bottom); Ttk_Padding Ttk_UniformPadding(short border); Ttk_Padding Ttk_AddPadding(Ttk_Padding padding1, Ttk_Padding padding2; Ttk_Padding Ttk_RelievePadding(Ttk_Padding padding, int relief); int Ttk_BoxContains(Ttk_Box box, int x, int y); int Ttk_GetPaddingFromObj( Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Ttk_Padding *padding_rtn); int Ttk_GetBorderFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *padding_rtn); int Ttk_GetStickyFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *sticky_rtn);
ARGUMENTS Tk_Anchor anchor in One of the symbolic constants TK_ANCHOR_N, TK_ANCHOR_NE, etc. See Tk_GetAnchorFromObj(3). Ttk_Box * cavity in/out A rectangular region from which a parcel is allocated. short border in Extra padding (in pixels) to add uniformly to each side of a region. short bottom in Extra padding (in pixels) to add to the bottom of a region. Ttk_Box box in Ttk_Box * box_rtn out Specifies a rectangular region. int height in The height in pixels of a region. Tcl_Interp * interp in Used to store error messages. int left in Extra padding (in pixels) to add to the left side of a region. Tcl_Obj * objPtr in String value contains a symbolic name to be converted to an enumerated value or bitmask. Internal rep may be be modified to cache corresponding value. Ttk_Padding padding in Ttk_Padding * padding_rtn out Extra padding to add on the inside of a region. Ttk_Box parcel in A rectangular region, allocated from a cavity. int relief in One of the standard Tk relief options (TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, etc.). See Tk_GetReliefFromObj. short right in Extra padding (in pixles) to add to the right side of a region. Ttk_Side side in One of TTK_SIDE_LEFT, TTK_SIDE_TOP, TTK_SIDE_RIGHT, or TTK_SIDE_BOTTOM. unsigned sticky in A bitmask containing one or more of the bits TTK_STICK_W (west, or left), TTK_STICK_E (east, or right, TTK_STICK_N (north, or top), and TTK_STICK_S (south, or bottom). TTK_FILL_X is defined as a synonym for (TTK_STICK_W|TTK_STICK_E), TTK_FILL_Y is a synonym for (TTK_STICK_N|TTK_STICK_S), and TTK_FILL_BOTH and TTK_STICK_ALL are synonyms for (TTK_FILL_X|TTK_FILL_Y). See also: grid(n). Tk_Window tkwin in Window whose screen geometry determines the conversion between absolute units and pixels. short top in Extra padding at the top of a region. int width in The width in pixels of a region. int x in X coordinate of upper-left corner of region. int y in Y coordinate of upper-left corner of region.
BOXES

The Ttk_Box structure represents a rectangular region of a window:

typedef struct { int x; int y; int width; int height; } Ttk_Box;

All coordinates are relative to the window.

Ttk_MakeBox is a convenience routine that contsructs a Ttk_Box structure representing a region width pixels wide, height pixels tall, at the specified x, y coordinates.

Ttk_PadBox returns a new box located inside the specified parcel, shrunken according to the left, top, right, and bottom margins specified by padding.

Ttk_ExpandBox is the inverse of Ttk_PadBox: it returns a new box surrounding the specified parcel, expanded according to the left, top, right, and bottom margins specified by padding.

Ttk_PackBox allocates a parcel width by height pixels wide on the specified side of the cavity, and shrinks the cavity accordingly.

Ttk_StickBox places a box with the requested width and height inside the parcel according to the sticky bits.

Ttk_PlaceBox combines Ttk_PackBox and Ttk_StickBox: it allocates a parcel on the specified side of the cavity, places a box of the requested size inside the parcel according to sticky, and shrinks the cavity.

Ttk_AnchorBox places a box with the requested width and height inside the parcel according to the specified anchor option.

Ttk_BoxContains tests if the specified x, y coordinate lies within the rectangular region box.

PADDDING

The Ttk_Padding structure is used to represent borders, internal padding, and external margins:

typedef struct { short left; short top; short right; short bottom; } Ttk_Padding;

Ttk_MakePadding is a convenience routine that contsructs a Ttk_Padding structure with the specified left, top, right, and bottom components.

Ttk_UniformPadding constructs a Ttk_Padding structure with all components equal to the specified border.

Ttk_AddPadding adds two Ttk_Paddings together and returns a combined padding containing the sum of the individual padding components.

Ttk_RelievePadding adds an extra 2 pixels of padding to padding according to the specified relief. If relief is TK_RELIEF_SUNKEN, adds two pixels at the top and left so the inner region is shifted down and to the left. If it is TK_RELIEF_RAISED, adds two pixels at the bottom and right so the inner region is shifted up and to the right. Otherwise, adds 1 pixel on all sides. This is typically used in element geometry procedures to simulate a "pressed-in" look for pushbuttons.

CONVERSION ROUTINES

Ttk_GetPaddingFromObj converts the string in objPtr to a Ttk_Padding structure. The string representation is a list of up to four length specifications "left top right bottom". If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left. See Tk_GetPixelsFromObj(3) for the syntax of length specifications.

Ttk_GetBorderFromObj is the same as Ttk_GetPaddingFromObj except that the lengths are specified as integers (i.e., resolution-dependant values like 3m are not allowed).

Ttk_GetStickyFromObj converts the string in objPtr to a sticky bitmask. The string contains zero or more of the characters n, s, e, or w.

Tk_GetReliefFromObj(3) Tk_GetPixelsFromObj(3) Tk_GetAnchorFromObj(3) geometry padding margins box region sticky relief
tile-0.8.2/doc/xml/Theme.tmml0000644000076500007650000000315110731273205015346 0ustar joejoe00000000000000 Ttk_CreateTheme Ttk_GetTheme Ttk_GetDefaultTheme Ttk_GetCurrentTheme create and use Themes. Ttk_Theme Ttk_CreateTheme(interp, name, parentTheme); Ttk_Theme Ttk_GetTheme(interp, name); Ttk_Theme Ttk_GetDefaultTheme(interp); Ttk_Theme Ttk_GetCurrentTheme(interp);
ARGUMENTS Tcl_Interp * interp in The Tcl interpreter in which to register/query available themes. Ttk_Theme parentTheme in Fallback or parent theme from which the new theme will inherit elements and layouts. const char * name in The name of the theme.
DESCRIPTION
Ttk_RegisterLayout Ttk_BuildLayout
tile-0.8.2/doc/xml/button.tmml0000644000076500007650000000656410731273205015632 0ustar joejoe00000000000000 ttk::button Widget that issues a command when pressed ttk::button pathName ?options?
DESCRIPTION

A button widget displays a textual label and/or image, and evaluates a command when pressed.

STANDARD OPTIONS
  • -class
  • -compound
  • -cursor
  • -image
  • -state
  • -style
  • -takefocus
  • -text
  • -textvariable
  • -underline
  • -width
  • OPTIONS -command command Command A script to evaluate when the widget is invoked. -default default Default May be set to one of normal, active, or disabled. In a dialog box, one button may be designated the "default" button (meaning, roughly, "the one that gets invoked when the user presses <Enter>"). active indicates that this is currently the default button; normal means that it may become the default button, and disabled means that it is not defaultable. The default is normal.
    Depending on the theme, the default button may be displayed with an extra highlight ring, or with a different border color. See also: keynav(n).
    -width width Width If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used. Note that some themes may specify a non-zero -width in the style.
    WIDGET COMMAND
    pathName invoke
    Invokes the command associated with the button.
    pathName cget option
    pathName configure ?option? ?value option value ...?
    pathName instate statespec ?script?
    pathName state ?stateSpec?
    See widget(n)
    COMPATIBILITY OPTIONS -state state State May be set to normal or disabled to control the disabled state bit. This is a ``write-only'' option: setting it changes the widget state, but the state widget command does not affect the state option.
    widget(n) keynav(n) widget button default command
    tile-0.8.2/doc/xml/checkbutton.tmml0000644000076500007650000000627210731273205016624 0ustar joejoe00000000000000 ttk::checkbutton On/off widget ttk::checkbutton pathName ?options?
    DESCRIPTION

    A checkbutton widget is used to show or change a setting. It has two states, selected and deselected. The state of the checkbutton may be linked to a Tcl variable.

    STANDARD OPTIONS
  • -class
  • -compound
  • -cursor
  • -image
  • -state
  • -style
  • -takefocus
  • -text
  • -textvariable
  • -underline
  • -width
  • OPTIONS -command command Command A Tcl script to execute whenever the widget is invoked. -offvalue offValue OffValue The value to store in the associated -variable when the widget is deselected. Defaults to 0. -onvalue onValue OnValue The value to store in the associated -variable when the widget is selected. Defaults to 1. -variable variable Variable The name of a global variable whose value is linked to the widget. Defaults to the widget pathname if not specified.
    WIDGET COMMAND

    In addition to the standard cget, configure, instate, and state commands, checkbuttons support the following additional widget commands:

    pathname invoke
    Toggles between the selected and deselected states and evaluates the associated -command. If the widget is currently selected, sets the -variable to the -offvalue and deselects the widget; otherwise, sets the -variable to the -onvalue Returns the result of the -command.
    WIDGET STATES

    The widget does not respond to user input if the disabled state is set. The widget sets the selected state whenever the linked -variable is set to the widget's -onvalue, and clears it otherwise. The widget sets the alternate state whenever the linked -variable is unset. (The alternate state may be used to indicate a ``tri-state'' or ``indeterminate'' selection.)

    widget(n) keynav(n) radiobutton(n) widget button toggle check option
    tile-0.8.2/doc/xml/combobox.tmml0000644000076500007650000001152210731273205016115 0ustar joejoe00000000000000 ttk::combobox text field with popdown selection list ttk::combobox pathName ?options?
    STANDARD OPTIONS
  • -class
  • -cursor
  • -style
  • -takefocus
  • OPTIONS -exportselection exportSelection ExportSelection Boolean value. If set, the widget selection is linked to the X selection. -justify justify Justify Specifies how the text is aligned within the widget. One of left, center, or right. -height height Height Specifies the height of the pop-down listbox, in rows. -postcommand postCommand PostCommand A Tcl script to evaluate immediately before displaying the listbox. The -postcommand script may specify the -values to display. -state state State One of normal, readonly, or disabled. In the readonly state, the value may not be edited directly, and the user can only select one of the -values from the dropdown list. In the normal state, the text field is directly editable. In the disabled state, no interaction is possible. -textvariable textVariable TextVariable Specifies the name of a variable whose value is linked to the widget value. Whenever the variable changes value the widget value is updated, and vice versa. -values values Values Specifies the list of values to display in the drop-down listbox. -width width Width Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font.
    DESCRIPTION

    A combobox combines a text field with a pop-down list of values; the user may select the value of the text field from among the values in the list.

    WIDGET COMMAND
    pathName cget option
    Returns the current value of the specified option. See widget(n).
    pathName configure ?option? ?value option value ...?
    Modify or query widget options. See widget(n).
    pathName current ?newIndex?
    If newIndex is supplied, sets the combobox value to the element at position newIndex in the list of -values. Otherwise, returns the index of the current value in the list of -values or -1 if the current value does not appear in the list.
    pathName get
    Returns the current value of the combobox.
    pathName identify x y
    Returns the name of the element at position x, y, or the empty string if the coordinates are outside the window.
    pathName instate statespec ?script?
    Test the widget state. See widget(n).
    pathName set value
    Sets the value of the combobox to value.
    pathName state ?stateSpec?
    Modify or query the widget state. See widget(n).

    The combobox widget also supports the following entry widget commands (see entry(n) for details):

  • bbox
  • delete
  • icursor
  • index
  • insert
  • selection
  • xview
  • VIRTUAL EVENTS

    The combobox widget generates a <<ComboboxSelected>> virtual event when the user selects an element from the list of values. This event is generated after the listbox is unposted.

    widget(n) entry(n)
    tile-0.8.2/doc/xml/dialog.tmml0000644000076500007650000001260510731273206015550 0ustar joejoe00000000000000 ttk::dialog create a dialog box package require ttk::dialog ?0.8? ttk::dialog pathname ?options...? ttk::dialog::define dialogType ?options...?
    DESCRIPTION

    A dialog box is a transient top-level window containing an icon, a short message, an optional, longer, detail message, and a row of command buttons. When the user presses any of the buttons, a callback function is invoked and then the dialog is destroyed.

    Additional widgets may be added in the dialog client frame.

    OPTIONS -title n/a n/a Specifies a string to use as the window manager title. -message n/a n/a Specifies the message to display in this dialog. -detail n/a n/a Specifies a longer auxiliary message. -command n/a n/a Specifies a command prefix to be invoked when the user presses one of the command buttons. The symbolic name of the button is passed as an additional argument to the command. The dialog is dismissed after invoking the command. -parent n/a n/a Specifies a toplevel window for which the dialog is transient. If omitted, the default is the nearest ancestor toplevel. If set to the empty string, the dialog will not be a transient window. -type n/a n/a Specifies a built-in or user-defined dialog type. See PREDEFINED DIALOG TYPES, below. -icon n/a n/a Specifies one of the stock dialog icons, info, question, warning, error, auth, or busy. If set to the empty string (the default), no icon is displayed. -buttons n/a n/a A list of symbolic button names. -labels n/a n/a A dictionary mapping symbolic button names to textual labels. May be omitted if all the buttons are predefined. -default n/a n/a The symbolic name of the default button. -cancel n/a n/a The symbolic name of the "cancel" button. The cancel button is invoked if the user presses the Escape key and when the dialog is closed from the window manager. If -cancel is not specified, the dialog ignores window manager close commands (WM_DELETE_WINDOW).
    WIDGET COMMANDS
    ttk::dialog::clientframe dlg
    Returns the widget path of the client frame. Other widgets may be added to the client frame. The client frame appears between the detail message and the command buttons.
    PREDEFINED DIALOG TYPES

    The -type option, if present, specifies default values for other options. ttk::dialog::define type options... specifies a new stock dialog type. The following stock dialog types are predefined:

    ttk::dialog::define ok \ -icon info -buttons {ok} -default ok ttk::dialog::define okcancel \ -icon info -buttons {ok cancel} -default ok -cancel cancel ttk::dialog::define yesno \ -icon question -buttons {yes no} ttk::dialog::define yesnocancel \ -icon question -buttons {yes no cancel} -cancel cancel ttk::dialog::define retrycancel \ -icon question -buttons {retry cancel} -cancel cancel
    STOCK BUTTONS

    The following ``stock'' symbolic button names have predefined labels: yes, no, ok, cancel, and retry.

    It is not necessary to list these in the -labels dictionary.

    EXAMPLE proc saveFileComplete {button} { switch -- $button { yes { # save file ... } no { exit } cancel { # no-op } } } ttk::dialog .saveFileDialog \ -title "Save file?" \ -icon question \ -message "Save file before closing?" \ -detail "If you do not save the file, your work will be lost" \ -buttons [list yes no cancel] \ -labels [list yes "Save file" no "Don't save"] \ -command saveFileComplete \ ;
    tk_messageBox(n) wm(n) toplevel(n)
    tile-0.8.2/doc/xml/entry.tmml0000644000076500007650000005127110731273207015455 0ustar joejoe00000000000000 ttk::entry Editable text field widget ttk::entry pathName ?options?
    DESCRIPTION

    An entry widget displays a one-line text string and allows that string to be edited by the user. The value of the string may be linked to a Tcl variable with the -textvariable option. Entry widgets support horizontal scrolling with the standard -xscrollcommand option and xview widget command.

    STANDARD OPTIONS
  • -class
  • -cursor
  • -style
  • -takefocus
  • -xscrollcommand
  • WIDGET-SPECIFIC OPTIONS -exportselection exportSelection ExportSelection A boolean value specifying whether or not a selection in the widget should be linked to the X selection. If the selection is exported, then selecting in the widget deselects the current X selection, selecting outside the widget deselects any widget selection, and the widget will respond to selection retrieval requests when it has a selection. -invalidcommand invalidCommand InvalidCommand A script template to evaluate whenever the validateCommand returns 0. See VALIDATION below for more information. -justify justify Justify Specifies how the text is aligned within the entry widget. One of left, center, or right. -show show Show If this option is specified, then the true contents of the entry are not displayed in the window. Instead, each character in the entry's value will be displayed as the first character in the value of this option, such as ``*''. This is useful, for example, if the entry is to be used to enter a password. If characters in the entry are selected and copied elsewhere, the information copied will be what is displayed, not the true contents of the entry. -state state State Compatibility option; see widget(n) for details. Specifies one of three states for the entry, normal, disabled, or readonly. See WIDGET STATES, below. -textvariable textVariable Variable Specifies the name of a variable whose value is linked to the entry widget's contents. Whenever the variable changes value, the widget's contents are updated, and vice versa. -validate validate Validate Specifies the mode in which validation should operate: none, focus, focusin, focusout, key, or all. Default is none, meaning that validation is disabled. See VALIDATION below. -validatecommand validateCommand ValidateCommand A script template to evaluate whenever validation is triggered. If set to the empty string (the default), validation is disabled. The script must return a boolean value. See VALIDATION below. -width width Width Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font.
    NOTES

    A portion of the entry may be selected as described below. If an entry is exporting its selection (see the exportSelection option), then it will observe the standard X11 protocols for handling the selection; entry selections are available as type STRING. Entries also observe the standard Tk rules for dealing with the input focus. When an entry has the input focus it displays an insert cursor to indicate where new characters will be inserted.

    Entries are capable of displaying strings that are too long to fit entirely within the widget's window. In this case, only a portion of the string will be displayed; commands described below may be used to change the view in the window. Entries use the standard xScrollCommand mechanism for interacting with scrollbars (see the description of the xScrollCommand option for details).

    INDICES

    Many of the entry widget commands take one or more indices as arguments. An index specifies a particular character in the entry's string, in any of the following ways:

    number
    Specifies the character as a numerical index, where 0 corresponds to the first character in the string.
    @number
    In this form, number is treated as an x-coordinate in the entry's window; the character spanning that x-coordinate is used. For example, ``@0'' indicates the left-most character in the window.
    end
    Indicates the character just after the last one in the entry's string. This is equivalent to specifying a numerical index equal to the length of the entry's string.
    insert
    Indicates the character adjacent to and immediately following the insert cursor.
    sel.first
    Indicates the first character in the selection. It is an error to use this form if the selection isn't in the entry window.
    sel.last
    Indicates the character just after the last one in the selection. It is an error to use this form if the selection isn't in the entry window.

    Abbreviations may be used for any of the forms above, e.g. ``e'' or ``sel.f''. In general, out-of-range indices are automatically rounded to the nearest legal value.

    WIDGET COMMAND

    The following commands are possible for entry widgets:

    pathName bbox index
    Returns a list of four numbers describing the bounding box of the character given by index. The first two elements of the list give the x and y coordinates of the upper-left corner of the screen area covered by the character (in pixels relative to the widget) and the last two elements give the width and height of the character, in pixels. The bounding box may refer to a region outside the visible area of the window.
    pathName cget option
    Returns the current value of the specified option. See widget(n).
    pathName configure ?option? ?value option value ...?
    Modify or query widget options. See widget(n).
    pathName delete first ?last?
    Delete one or more elements of the entry. First is the index of the first character to delete, and last is the index of the character just after the last one to delete. If last isn't specified it defaults to first+1, i.e. a single character is deleted. This command returns the empty string.
    pathName get
    Returns the entry's string.
    pathName icursor index
    Arrange for the insert cursor to be displayed just before the character given by index. Returns the empty string.
    pathName identify x y
    Returns the name of the element at position x, y, or the empty string if the coordinates are outside the window.
    pathName index index
    Returns the numerical index corresponding to index.
    pathName insert index string
    Insert string just before the character indicated by index. Returns the empty string.
    pathName instate statespec ?script?
    Test the widget state. See widget(n).
    pathName selection option arg
    This command is used to adjust the selection within an entry. It has several forms, depending on option:
    pathName selection clear
    Clear the selection if it is currently in this widget. If the selection isn't in this widget then the command has no effect. Returns the empty string.
    pathName selection present
    Returns 1 if there is are characters selected in the entry, 0 if nothing is selected.
    pathName selection range start end
    Sets the selection to include the characters starting with the one indexed by start and ending with the one just before end. If end refers to the same character as start or an earlier one, then the entry's selection is cleared.
    pathName state ?stateSpec?
    Modify or query the widget state. See widget(n).
    pathName validate
    Force revalidation, independent of the conditions specified by the -validate option. Returns 0 if validation fails, 1 if it succeeds. Sets or clears the invalid state accordingly.
    pathName xview args
    This command is used to query and change the horizontal position of the text in the widget's window. It can take any of the following forms:
    pathName xview
    Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the entry's text is off-screen to the left, the middle 40% is visible in the window, and 40% of the text is off-screen to the right. These are the same values passed to scrollbars via the -xscrollcommand option.
    pathName xview index
    Adjusts the view in the window so that the character given by index is displayed at the left edge of the window.
    pathName xview moveto fraction
    Adjusts the view in the window so that the character fraction of the way through the text appears at the left edge of the window. Fraction must be a fraction between 0 and 1.
    pathName xview scroll number what
    This command shifts the view in the window left or right according to number and what. Number must be an integer. What must be either units or pages. If what is units, the view adjusts left or right by number average-width characters on the display; if it is pages then the view adjusts by number screenfuls. If number is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible.
    VALIDATION

    The -validate, -validatecommand, and -invalidcommand options are used to enable entry widget validation.

    VALIDATION MODES

    There are two main validation modes: prevalidation, in which the -validatecommand is evaluated prior to each edit and the return value is used to determine whether to accept or reject the change; and revalidation, in which the -validatecommand is evaluated to determine whether the current value is valid.

    The -validate option determines when validation occurs; it may be set to any of the following values:

    none
    Default. This means validation will only occur when specifically requested by the validate widget command.
    key
    The entry will be prevalidated prior to each edit (specifically, whenever the insert or delete widget commands are called). If prevalidation fails, the edit is rejected.
    focus
    The entry is revalidated when the entry receives or loses focus.
    focusin
    The entry is revalidated when the entry receives focus.
    focusout
    The entry is revalidated when the entry loses focus.
    all
    Validation is performed for all above conditions.

    The -invalidcommand is evaluated whenever the -validatecommand returns a false value.

    The -validatecommand and -invalidcommand may modify the entry widget's value via the widget insert or delete commands, or by setting the linked -textvariable. If either does so during prevalidation, then the edit is rejected regardless of the value returned by the -validatecommand.

    If -validatecommand is empty (the default), validation always succeeds.

    VALIDATION SCRIPT SUBSTITUTIONS

    It is possible to perform percent substitutions on the -validatecommand and invalidCommand, just as in a bind script. The following substitutions are recognized:

    %d
    Type of action: 1 for insert prevalidation, 0 for delete prevalidation, or -1 for revalidation.
    %i
    Index of character string to be inserted/deleted, if any, otherwise -1.
    %P
    In prevalidation, the new value of the entry if the edit is accepted. In revalidation, the current value of the entry.
    %s
    The current value of entry prior to editing.
    %S
    The text string being inserted/deleted, if any, {} otherwise.
    %v
    The current value of the -validate option.
    %V
    The validation condition that triggered the callback (key, focusin, focusout, or forced).
    %W
    The name of the entry widget.
    DIFFERENCES FROM TK ENTRY WIDGET VALIDATION
    • The standard Tk entry widget automatically disables validation (by setting -validate to none) if the -validatecommand or -invalidcommand modifies the entry's value. The Tile entry widget only disables validation if one of the validation scripts raises an error, or if -validatecommand does not return a valid boolean value. (Thus, it is not necessary to reenable validation after modifying the entry value in a validation script).
    • The standard entry widget invokes validation whenever the linked -textvariable is modified; the Tile entry widget does not.
    DEFAULT BINDINGS

    The entry widget's default bindings enable the following behavior. In the descriptions below, ``word'' refers to a contiguous group of letters, digits, or ``_'' characters, or any single character other than these.

    • Clicking mouse button 1 positions the insert cursor just before the character underneath the mouse cursor, sets the input focus to this widget, and clears any selection in the widget. Dragging with mouse button 1 down strokes out a selection between the insert cursor and the character under the mouse.
    • Double-clicking with mouse button 1 selects the word under the mouse and positions the insert cursor at the end of the word. Dragging after a double click strokes out a selection consisting of whole words.
    • Triple-clicking with mouse button 1 selects all of the text in the entry and positions the insert cursor at the end of the line.
    • The ends of the selection can be adjusted by dragging with mouse button 1 while the Shift key is down. If the button is double-clicked before dragging then the selection will be adjusted in units of whole words.
    • Clicking mouse button 1 with the Control key down will position the insert cursor in the entry without affecting the selection.
    • If any normal printing characters are typed in an entry, they are inserted at the point of the insert cursor.
    • The view in the entry can be adjusted by dragging with mouse button 2. If mouse button 2 is clicked without moving the mouse, the selection is copied into the entry at the position of the mouse cursor.
    • If the mouse is dragged out of the entry on the left or right sides while button 1 is pressed, the entry will automatically scroll to make more text visible (if there is more text off-screen on the side where the mouse left the window).
    • The Left and Right keys move the insert cursor one character to the left or right; they also clear any selection in the entry. If Left or Right is typed with the Shift key down, then the insertion cursor moves and the selection is extended to include the new character. Control-Left and Control-Right move the insert cursor by words, and Control-Shift-Left and Control-Shift-Right move the insert cursor by words and also extend the selection. Control-b and Control-f behave the same as Left and Right, respectively.
    • The Home key and Control-a move the insert cursor to the beginning of the entry and clear any selection in the entry. Shift-Home moves the insert cursor to the beginning of the entry and extends the selection to that point.
    • The End key and Control-e move the insert cursor to the end of the entry and clear any selection in the entry. Shift-End moves the cursor to the end and extends the selection to that point.
    • Control-/ selects all the text in the entry.
    • Control-\ clears any selection in the entry.
    • The standard Tk <<Cut>>, <<Copy>>, <<Paste>>, and <<Clear>> virtual events operate on the selection in the expected manner.
    • The Delete key deletes the selection, if there is one in the entry. If there is no selection, it deletes the character to the right of the insert cursor.
    • The BackSpace key and Control-h delete the selection, if there is one in the entry. If there is no selection, it deletes the character to the left of the insert cursor.
    • Control-d deletes the character to the right of the insert cursor.
    • Control-k deletes all the characters to the right of the insertion cursor.
    WIDGET STATES

    In the disabled state, the entry cannot be edited and the text cannot be selected. In the readonly state, no insert cursor is displayed and the entry cannot be edited (specifically: the insert and delete commands have no effect). The disabled state is the same as readonly, and in addition text cannot be selected.

    Note that changes to the linked -textvariable will still be reflected in the entry, even if it is disabled or readonly.

    Typically, the text is "grayed-out" in the disabled state, and a different background is used in the readonly state.

    The entry widget sets the invalid state if revalidation fails, and clears it whenever validation succeeds.

    entry widget text field
    tile-0.8.2/doc/xml/frame.tmml0000644000076500007650000000501510731273207015401 0ustar joejoe00000000000000 ttk::frame Simple container widget ttk::frame pathName ?options?
    DESCRIPTION

    A frame widget is a container, used to group other widgets together.

    STANDARD OPTIONS
  • -class
  • -cursor
  • -style
  • -takefocus
  • OPTIONS -borderwidth borderWidth BorderWidth The desired width of the widget border. Defaults to 0. -relief relief Relief One of the standard Tk border styles: flat, groove, raised, ridge, solid, or sunken. Defaults to flat. -padding padding Padding Additional padding to include inside the border. -width width Width If specified, the widget's requested width in pixels. -height height Height If specified, the widget's requested height in pixels.
    WIDGET COMMAND

    Supports the standard widget commands configure, cget, instate, and state; see widget(n).

    NOTES

    Note that if the pack, grid, or other geometry managers are used to manage the children of the frame, by the GM's requested size will normally take precedence over the frame widget's -width and -height options. [pack propagate] and [grid propagate] can be used to change this.

    widget(n) labelframe(n) widget frame container
    tile-0.8.2/doc/xml/image.tmml0000644000076500007650000000616710731273207015402 0ustar joejoe00000000000000 ttk_image Define an element based on an image style element create name image imageSpec ?options?
    DESCRIPTION

    The image element factory creates a new element in the current theme whose visual appearance is determined by Tk images. imageSpec is a list of one or more elements. The first element is the default image name. The rest of the list is a sequence of statespec / value pairs specifying other images to use when the element is in a particular state or combination of states.

    OPTIONS

    Valid options are:

    -border padding
    padding is a list of up to four integers, specifying the left, top, right, and bottom borders, respectively. See IMAGE STRETCHING, below.
    -height height
    Specifies a minimum height for the element. If less than zero, the base image's height is used as a default.
    -padding padding
    Specifies the element's interior padding. Defaults to -border if not specified.
    -sticky spec
    Specifies how the image is placed within the final parcel. spec contains zero or more characters "n", "s", "w", or "e".
    -width width
    Specifies a minimum width for the element. If less than zero, the base image's width is used as a default.
    IMAGE STRETCHING

    If the element's allocated parcel is larger than the image, the image will be placed in the parcel based on the -sticky option. If the image needs to stretch horizontally (i.e., -sticky ew) or vertically (-sticky ns), subregions of the image are replicated to fill the parcel based on the -border option. The -border divides the image into 9 regions: four fixed corners, top and left edges (which may be tiled horizontally), left and right edges (which may be tiled vertically), and the central area (which may be tiled in both directions).

    EXAMPLE set img1 [image create photo -file button.png] set img2 [image create photo -file button-pressed.png] set img3 [image create photo -file button-active.png] style element create Button.button image \ [list $img1 pressed $img2 active $img3] \ -border {2 4} -sticky we
    image(n) photo(n) pixmap theme image
    tile-0.8.2/doc/xml/label.tmml0000644000076500007650000000753310731273207015375 0ustar joejoe00000000000000 ttk::label Display a text string and/or image ttk::label pathName ?options?
    DESCRIPTION

    A label widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text.

    STANDARD OPTIONS
  • -class
  • -compound
  • -cursor
  • -image
  • -style
  • -takefocus
  • -text
  • -textvariable
  • -underline
  • -width
  • OPTIONS -anchor anchor Anchor Specifies how the information in the widget is positioned relative to the inner margins. Legal values are n, ne, e, se, s, sw, w, nw, and center. See also -justify. -background frameColor FrameColor The widget's background color. If unspecified, the theme default is used. -font font Font Font to use for label text. -foreground textColor TextColor The widget's foreground color. If unspecified, the theme default is used. -justify justify Justify If there are multiple lines of text, specifies how the lines are laid out relative to one another. One of left, center, or right. See also -anchor. -padding padding Padding Specifies the amount of extra space to allocate for the widget. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left. -relief relief Relief Specifies the 3-D effect desired for the widget border. Valid values are flat, groove, raised, ridge, solid, and sunken. -text text Text Specifies a text string to be displayed inside the widget (unless overridden by -textvariable). -wraplength wrapLength WrapLength Specifies the maximum line length (in pixels). If this option is less than or equal to zero, then automatic wrapping is not performed; otherwise the text is split into lines such that no line is longer than the specified value.
    WIDGET COMMAND
    pathName cget option
    pathName configure ?option? ?value option value ...?
    pathName instate statespec ?script?
    pathName state ?stateSpec?
    See widget(n)
    widget(n)
    tile-0.8.2/doc/xml/labelframe.tmml0000644000076500007650000000645210731273207016407 0ustar joejoe00000000000000 ttk::labelframe Container widget with optional label ttk::labelframe pathName ?options?
    DESCRIPTION

    A labelframe widget is a container used to group other widgets together. It has an optional label, which may be a plain text string or another widget.

    STANDARD OPTIONS
  • -class
  • -cursor
  • -style
  • -takefocus
  • OPTIONS -labelanchor labelAnchor LabelAnchor Specifies where to place the label. Allowed values are (clockwise from the top upper left corner): nw, n, ne, en, e, es, se, s,sw, ws, w and wn. The default value is theme-dependent. -text text Text Specifies the text of the label. -underline underline Underline If set, specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation (see keynav(n)). Mnemonic activation for a ttk::labelframe sets the keyboard focus to the first child of the ttk::labelframe widget. -padding padding Padding Additional padding to include inside the border. -labelwidget labelWidget LabelWidget The name of a widget to use for the label. If set, overrides the -text option. The -labelwidget must be a child of the labelframe widget or one of the labelframe's ancestors, and must belong to the same top-level widget as the labelframe. -width width Width If specified, the widget's requested width in pixels. -height height Height If specified, the widget's requested height in pixels. (See ttk::frame for further notes on -width and -height).
    WIDGET COMMAND

    Supports the standard widget commands configure, cget, instate, and state; see widget(n).

    widget(n) frame(n) widget frame container label groupbox
    tile-0.8.2/doc/xml/menubutton.tmml0000644000076500007650000000377510731273207016522 0ustar joejoe00000000000000 ttk::menubutton Widget that pops down a menu when pressed ttk::menubutton pathName ?options?
    DESCRIPTION

    A menubutton widget displays a textual label and/or image, and displays a menu when pressed.

    STANDARD OPTIONS
  • -class
  • -compound
  • -cursor
  • -image
  • -state
  • -style
  • -takefocus
  • -text
  • -textvariable
  • -underline
  • -width
  • OPTIONS -direction direction Direction Specifies where the menu is to be popped up relative to the menubutton. One of: above, below, left, right, or flush. The default is below. flush pops the menu up directly over the menubutton. -menu menu Menu Specifies the path name of the menu associated with the menubutton. To be on the safe side, the menu ought to be a direct child of the menubutton.
    WIDGET COMMAND

    Menubutton widgets support the standard cget, configure, instate, and state methods. No other widget methods are used.

    widget(n) keynav(n) menu(n) widget button menu
    tile-0.8.2/doc/xml/notebook.tmml0000644000076500007650000002172610731273207016136 0ustar joejoe00000000000000 ttk::notebook Multi-paned container widget ttk::notebook pathName ?options...? pathName add window ?options...? pathName insert index window ?options...?
    DESCRIPTION

    A ttk::notebook widget manages a collection of windows and displays a single one at a time. Each slave window is associated with a tab, which the user may select to change the currently-displayed window.

    STANDARD OPTIONS
  • -class
  • -cursor
  • -style
  • -takefocus
  • WIDGET OPTIONS -height height Height If present and greater than zero, specifies the desired height of the pane area (not including internal padding or tabs). Otherwise, the maximum height of all panes is used. -padding padding Padding Specifies the amount of extra space to add around the outside of the notebook. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left. -width width Width If present and greater than zero, specifies the desired width of the pane area (not including internal padding). Otherwise, the maximum width of all panes is used.
    TAB OPTIONS

    The following options may be specified for individual notebook panes:

    -state state State Either normal, disabled or hidden. If disabled, then the tab is not selectable. If hidden, then the tab is not shown. -sticky sticky Sticky Specifies how the slave window is positioned within the pane area. Value is a string containing zero or more of the characters n, s, e, or w. Each letter refers to a side (north, south, east, or west) that the slave window will "stick" to, as per the grid geometry manager. -padding padding Padding Specifies the amount of extra space to add between the notebook and this pane. Syntax is the same as for the widget -padding option. -text text Text Specifies a string to be displayed in the tab. -image image Image Specifies an image to display in the tab. See widget(n) for details. -compound compound Compound Specifies how to display the image relative to the text, in the case both -text and -image are present. See label(n) for legal values. -underline underline Underline Specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation if ttk::notebook::enableTraversal is called.
    WIDGET COMMAND pathname add window ?options...? Adds a new tab to the notebook. See TAB OPTIONS for the list of available options. If window is currently managed by the notebook but hidden, it is restored to its previous position. pathname configure ?options? See widget(n). pathname cget option See widget(n). pathname forget tabid Removes the tab specified by tabid, unmaps and unmanages the associated window. pathname hide tabid Hides the tab specified by tabid. The tab will not be displayed, but the associated window remains managed by the notebook and its configuration remembered. Hidden tabs may be restored with the add command. pathname index tabid Returns the numeric index of the tab specified by tabid, or the total number of tabs if tabid is the string "end". pathname insert pos subwindow options... Inserts a pane at the specified position. pos is either the string end, an integer index, or the name of a managed subwindow. If subwindow is already managed by the notebook, moves it to the specified position. See TAB OPTIONS for the list of available options. pathname instate statespec ?script...? See widget(n). pathname select ?tabid? Selects the specified tab. The associated slave window will be displayed, and the previously-selected window (if different) is unmapped. If tabid is omitted, returns the widget name of the currently selected pane. pathname state ?statespec? See widget(n). pathname tab tabid ?-option ?value ... Query or modify the options of the specific tab. If no -option is specified, returns a dictionary of the tab option values. If one -option is specified, returns the value of that option. Otherwise, sets the -options to the corresponding values. See TAB OPTIONS for the available options. pathname tabs Returns the list of windows managed by the notebook.
    KEYBOARD TRAVERSAL

    To enable keyboard traversal for a toplevel window containing a notebook widget $nb, call:

    ttk::notebook::enableTraversal $nb

    This will extend the bindings for the toplevel window containing the notebook as follows:

    • Control-Tab selects the tab following the currently selected one.
    • Shift-Control-Tab selects the tab preceding the currently selected one.
    • Alt-K, where K is the mnemonic (underlined) character of any tab, will select that tab.

    Multiple notebooks in a single toplevel may be enabled for traversal, including nested notebooks. However, notebook traversal only works properly if all panes are direct children of the notebook.

    TAB IDENTIFIERS

    The tabid argument to the above commands may take any of the following forms:

    • An integer between zero and the number of tabs;
    • The name of a slave window;
    • A positional specification of the form "@x,y", which identifies the tab
    • The literal string "current", which identifies the currently-selected tab; or:
    • The literal string "end", which returns the number of tabs (only valid for "pathname index").
    VIRTUAL EVENTS

    The notebook widget generates a <<NotebookTabChanged>> virtual event after a new tab is selected.

    EXAMPLE notebook .nb .nb add [frame .nb.f1] -text "First tab" .nb add [frame .nb.f2] -text "Second tab" .nb select .nb.f2 ttk::notebook::enableTraversal .nb
    widget(n) grid(n) pane tab
    tile-0.8.2/doc/xml/paned.tmml0000644000076500007650000001166210731273207015403 0ustar joejoe00000000000000 ttk::panedwindow Multi-pane container window ttk::panedwindow pathName ?options? pathName add window ?options...? pathName insert index window ?options...?
    DESCRIPTION

    A panedwindow widget displays a number of subwindows, stacked either vertically or horizontally. The user may adjust the relative sizes of the subwindows by dragging the sash between panes.

    STANDARD OPTIONS
  • -class
  • -cursor
  • -style
  • -takefocus
  • WIDGET OPTIONS -orient orient Orient Specifies the orientation of the window. If vertical, subpanes are stacked top-to-bottom; if horizontal, subpanes are stacked left-to-right. -width width Width If present and greater than zero, specifies the desired width of the widget in pixels. Otherwise, the requested width is determined by the width of the managed windows. -height height Height If present and greater than zero, specifies the desired height of the widget in pixels. Otherwise, the requested height is determined by the height of the managed windows.
    PANE OPTIONS

    The following options may be specified for each pane:

    -weight weight Weight An integer specifying the relative stretchability of the pane. When the panedwindow is resized, the extra space is added or subtracted to each pane proportionally to its -weight.
    WIDGET COMMAND

    Supports the standard configure, cget, state, and instate commands; see widget(n) for details. Additional commands:

    pathname add subwindow options... Adds a new pane to the window. subwindow must be a direct child of the panedwindow pathname. See PANE OPTIONS for the list of available options. pathname forget pane Removes the specified subpane from the widget. pane is either an integer index or the name of a managed subwindow. pathname insert pos subwindow options... Inserts a pane at the specified position. pos is either the string end, an integer index, or the name of a managed subwindow. If subwindow is already managed by the panedwindow, moves it to the specified position. See PANE OPTIONS for the list of available options. pathname pane pane -option ?value ?-option value... Query or modify the options of the specified pane, where pane is either an integer index or the name of a managed subwindow. If no -option is specified, returns a dictionary of the pane option values. If one -option is specified, returns the value of that option. Otherwise, sets the -options to the corresponding values. pathname panes Returns the list of all windows managed by the widget. pathname sashpos index ?newpos? If newpos is specified, sets the position of sash number index. May adjust the positions of adjacent sashes to ensure that positions are monotonically increasing. Sash positions are further constrained to be between 0 and the total size of the widget. Returns the new position of sash number index. pathname identify x y Returns the index of the sash at point x,y, or the empty string if x,y is not over a sash.
    widget(n) notebook(n)
    tile-0.8.2/doc/xml/progressbar.tmml0000644000076500007650000001021210731273210016625 0ustar joejoe00000000000000 ttk::progressbar Provide progress feedback ttk::progressbar pathName ?options?
    STANDARD OPTIONS
  • -class
  • -cursor
  • -style
  • -takefocus
  • OPTIONS -orient orient Orient One of horizontal or vertical. Specifies the orientation of the progress bar. -length length Length Specifies the length of the long axis of the progress bar (width if horizontal, height if vertical). -mode mode Mode One of determinate or indeterminate. -maximum maximum Maximum A floating point number specifying the maximum -value. Defaults to 100. -value value Value The current value of the progress bar. In determinate mode, this represents the amount of work completed. In indeterminate mode, it is interpreted modulo -maximum; that is, the progress bar completes one "cycle" when the -value increases by -maximum. -variable variable Variable The name of a Tcl variable which is linked to the -value. If specified, the -value of the progress bar is automatically set to the value of the variable whenever the latter is modified. -phase phase Phase Read-only option. The widget periodically increments the value of this option whenever the -value is greater than 0 and, in determinate mode, less than -maximum. This option may be used by the current theme to provide additional animation effects.
    DESCRIPTION

    A progress bar widget shows the status of a long-running operation. They can operate in two modes: determinate mode shows the amount completed relative to the total amount of work to be done, and indeterminate mode provides an animated display to let the user know that something is happening.

    WIDGET COMMAND
    pathName cget option
    Returns the current value of the specified option; see widget(n).
    pathName configure ?option? ?value option value ...?
    Modify or query widget options; see widget(n).
    pathName instate statespec ?script?
    Test the widget state; see widget(n).
    pathName start ?interval?
    Begin autoincrement mode: schedules a recurring timer event that calls step every interval milliseconds. If omitted, interval defaults to 50 milliseconds (20 steps/second).
    pathName state ?stateSpec?
    Modify or query the widget state; see widget(n).
    pathName step ?amount?
    Increments the -value by amount. amount defaults to 1.0 if omitted.
    pathName stop
    Stop autoincrement mode: cancels any recurring timer event initiated by pathName start.
    widget(n)
    tile-0.8.2/doc/xml/radiobutton.tmml0000644000076500007650000000560010731273210016633 0ustar joejoe00000000000000 ttk::radiobutton Mutually exclusive option widget ttk::radiobutton pathName ?options?
    DESCRIPTION

    radiobutton widgets are used in groups to show or change a set of mutually-exclusive options. Radiobuttons are linked to a Tcl variable, and have an associated value; when a radiobutton is clicked, it sets the variable to its associated value.

    STANDARD OPTIONS
  • -class
  • -compound
  • -cursor
  • -image
  • -state
  • -style
  • -takefocus
  • -text
  • -textvariable
  • -underline
  • -width
  • OPTIONS -command command Command A Tcl script to evaluate whenever the widget is invoked. -value Value Value The value to store in the associated -variable when the widget is selected. -variable variable Variable The name of a global variable whose value is linked to the widget. Default value is ::selectedButton.
    WIDGET COMMAND

    In addition to the standard cget, configure, instate, and state commands, radiobuttons support the following additional widget commands:

    pathname invoke
    Sets the -variable to the -value, selects the widget, and evaluates the associated -command. Returns the result of the -command, or the empty string if no -command is specified.
    WIDGET STATES

    The widget does not respond to user input if the disabled state is set. The widget sets the selected state whenever the linked -variable is set to the widget's -value, and clears it otherwise. The widget sets the alternate state whenever the linked -variable is unset. (The alternate state may be used to indicate a ``tri-state'' or ``indeterminate'' selection.)

    widget(n) keynav(n) checkbutton(n) widget button option
    tile-0.8.2/doc/xml/scrollbar.tmml0000644000076500007650000001766710731273210016304 0ustar joejoe00000000000000 ttk::scrollbar Control the viewport of a scrollable widget ttk::scrollbar pathName ?options...?
    STANDARD OPTIONS
  • -class
  • -cursor
  • -style
  • -takefocus
  • WIDGET-SPECIFIC OPTIONS -command command Command A Tcl script prefix to evaluate to change the view in the widget associated with the scrollbar. Additional arguments are appended to the value of this option, as described in SCROLLING COMMANDS below, whenever the user requests a view change by manipulating the scrollbar.
    This option typically consists of a two-element list, containing the name of a scrollable widget followed by either xview (for horizontal scrollbars) or yview (for vertical scrollbars).
    -orient orient Orient One of horizontal or vertical. Specifies the orientation of the scrollbar.
    DESCRIPTION

    Scrollbar widgets are typically linked to an associated window that displays a document of some sort, such as a file being edited or a drawing. A scrollbar displays a thumb in the middle portion of the scrollbar, whose position and size provides information about the portion of the document visible in the associated window. The thumb may be dragged by the user to control the visible region. Depending on the theme, two or more arrow buttons may also be present; these are used to scroll the visible region in discrete units.

    WIDGET COMMAND
    pathName cget option
    Returns the current value of the specified option; see widget(n).
    pathName configure ?option? ?value option value ...?
    Modify or query widget options; see widget(n).
    pathName get
    Returns the scrollbar settings in the form of a list whose elements are the arguments to the most recent set widget command.
    pathName instate statespec ?script?
    Test the widget state; see widget(n).
    pathName set first last
    This command is normally invoked by the scrollbar's associated widget from an -xscrollcommand or -yscrollcommand callback. Specifies the visible range to be displayed. first and last are real fractions between 0 and 1.
    pathName state ?stateSpec?
    Modify or query the widget state; see widget(n).
    INTERNAL COMMANDS

    The following widget commands are used internally by the TScrollbar widget class bindings.

    pathName delta deltaX deltaY
    Returns a real number indicating the fractional change in the scrollbar setting that corresponds to a given change in thumb position. For example, if the scrollbar is horizontal, the result indicates how much the scrollbar setting must change to move the thumb deltaX pixels to the right (deltaY is ignored in this case). If the scrollbar is vertical, the result indicates how much the scrollbar setting must change to move the thumb deltaY pixels down. The arguments and the result may be zero or negative.
    pathName fraction x y
    Returns a real number between 0 and 1 indicating where the point given by x and y lies in the trough area of the scrollbar, where 0.0 corresponds to the top or left of the trough and 1.0 corresponds to the bottom or right. X and y are pixel coordinates relative to the scrollbar widget. If x and y refer to a point outside the trough, the closest point in the trough is used.
    pathName identify x y
    Returns the name of the element under the point given by x and y, or an empty string if the point does not lie in any element of the scrollbar. X and y are pixel coordinates relative to the scrollbar widget.
    SCROLLING COMMANDS

    When the user interacts with the scrollbar, for example by dragging the thumb, the scrollbar notifies the associated widget that it must change its view. The scrollbar makes the notification by evaluating a Tcl command generated from the scrollbar's -command option. The command may take any of the following forms. In each case, prefix is the contents of the -command option, which usually has a form like .t yview

    prefix moveto fraction
    Fraction is a real number between 0 and 1. The widget should adjust its view so that the point given by fraction appears at the beginning of the widget. If fraction is 0 it refers to the beginning of the document. 1.0 refers to the end of the document, 0.333 refers to a point one-third of the way through the document, and so on.
    prefix scroll number units
    The widget should adjust its view by number units. The units are defined in whatever way makes sense for the widget, such as characters or lines in a text widget. Number is either 1, which means one unit should scroll off the top or left of the window, or -1, which means that one unit should scroll off the bottom or right of the window.
    prefix scroll number pages
    The widget should adjust its view by number pages. It is up to the widget to define the meaning of a page; typically it is slightly less than what fits in the window, so that there is a slight overlap between the old and new views. Number is either 1, which means the next page should become visible, or -1, which means that the previous page should become visible.
    WIDGET STATES

    The scrollbar automatically sets the disabled state bit. when the entire range is visible (range is 0.0 to 1.0), and clears it otherwise. It also sets the active and pressed state flags of individual elements, based on the position and state of the mouse pointer.

    EXAMPLE set f [frame .f] ttk::scrollbar $f.hsb -orient horizontal -command [list $f.t xview] ttk::scrollbar $f.vsb -orient vertical -command [list $f.t yview] text $f.t -xscrollcommand [list $f.hsb set] -yscrollcommand [list $f.vsb set] grid $f.t -row 0 -column 0 -sticky nsew grid $f.vsb -row 0 -column 1 -sticky nsew grid $f.hsb -row 1 -column 0 -sticky nsew grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1
    scrollbar widget
    tile-0.8.2/doc/xml/separator.tmml0000644000076500007650000000262010731273210016300 0ustar joejoe00000000000000 ttk::separator Separator bar ttk::separator pathName ?options?
    DESCRIPTION

    A separator widget displays a horizontal or vertical separator bar.

    STANDARD OPTIONS
  • -class
  • -cursor
  • -state
  • -style
  • -takefocus
  • OPTIONS -orient orient Orient One of horizontal or vertical. Specifies the orientation of the separator.
    WIDGET COMMAND

    Separator widgets support the standard cget, configure, instate, and state methods. No other widget methods are used.

    widget(n) widget separator
    tile-0.8.2/doc/xml/sizegrip.tmml0000644000076500007650000000450510731273210016140 0ustar joejoe00000000000000 ttk::sizegrip A silly widget ttk::sizegrip pathName ?options?
    DESCRIPTION

    A sizegrip widget (also known as a grow box) allows the user to resize the containing toplevel window by pressing and dragging the grip.

    STANDARD OPTIONS
  • -class
  • -cursor
  • -state
  • -style
  • -takefocus
  • WIDGET COMMAND

    Sizegrip widgets support the standard cget, configure, instate, and state methods. No other widget methods are used.

    PLATFORM-SPECIFIC NOTES

    On Mac OSX, toplevel windows automatically include a built-in size grip by default. Adding an ttk::sizegrip there is harmless, since the built-in grip will just mask the widget.

    EXAMPLES # Using pack: pack [ttk::frame $top.statusbar] -side bottom -fill x pack [ttk::sizegrip $top.statusbar.grip] -side right -anchor se # Using grid: grid [ttk::sizegrip $top.statusbar.grip] \ -row $lastRow -column $lastColumn -sticky se # ... optional: add vertical scrollbar in $lastColumn, # ... optional: add horizontal scrollbar in $lastRow
    BUGS

    If the containing toplevel's position was specified relative to the right or bottom of the screen (e.g., [wm geometry ... wxh-x-y] instead of [wm geometry ... wxh+x+y]), the sizegrip widget will not resize the window.

    ttk::sizegrip widgets only support "southeast" resizing.

    widget(n) widget sizegrip grow box
    tile-0.8.2/doc/xml/style.tmml0000644000076500007650000001274710731273210015453 0ustar joejoe00000000000000 ttk::style Manipulate style database ttk::style option ?args?
    NOTES

    See also the Tcl'2004 conference presentation, available at http://tktable.sourceforge.net/tile/tile-tcl2004.pdf

    DEFINITIONS

    Each widget is assigned a style, which specifies the set of elements making up the widget and how they are arranged, along with dynamic and default settings for element options. By default, the style name is the same as the widget's class; this may be overridden by the -style option.

    A theme is a collection of elements and styles which controls the overall look and feel of an application.

    DESCRIPTION

    The ttk::style command takes the following arguments:

    ttk::style configure style ?-option ?value option value...? ?
    Sets the default value of the specified option(s) in style.
    ttk::style map style ?-option { statespec value... }?
    Sets dynamic values of the specified option(s) in style. Each statespec / value pair is examined in order; the value corresponding to the first matching statespec is used.
    ttk::style lookup style -option ?state ?default??
    Returns the value specified for -option in style style in state state, using the standard lookup rules for element options. state is a list of state names; if omitted, it defaults to all bits off (the ``normal'' state). If the default argument is present, it is used as a fallback value in case no specification for -option is found.
    ttk::style layout style ?layoutSpec?
    Define the widget layout for style style. See LAYOUTS below for the format of layoutSpec. If layoutSpec is omitted, return the layout specification for style style.
    ttk::style element create elementName type ?args...?
    Creates a new element in the current theme of type type. The only built-in element type is image (see image(n)), although themes may define other element types (see Ttk_RegisterElementFactory).
    ttk::style element names
    Returns the list of elements defined in the current theme.
    ttk::style element options element
    Returns the list of element's options.
    ttk::style theme create themeName ?-parent basedon? ?-settings script... ?
    Creates a new theme. It is an error if themeName already exists. If -parent is specified, the new theme will inherit styles, elements, and layouts from the parent theme basedon. If -settings is present, script is evaluated in the context of the new theme as per ttk::style theme settings.
    ttk::style theme settings themeName script
    Temporarily sets the current theme to themeName, evaluate script, then restore the previous theme. Typically script simply defines styles and elements, though arbitrary Tcl code may appear.
    ttk::style theme names
    Returns a list of all known themes.
    ttk::style theme use themeName
    Sets the current theme to themeName, and refreshes all widgets.
    LAYOUTS

    A layout specifies a list of elements, each followed by one or more options specifying how to arrange the element. The layout mechanism uses a simplified version of the pack geometry manager: given an initial cavity, each element is allocated a parcel. Valid options are:

    -side side
    Specifies which side of the cavity to place the element; one of left, right, top, or bottom. If omitted, the element occupies the entire cavity.
    -sticky [nswe]
    Specifies where the element is placed inside its allocated parcel.
    -children { sublayout... }
    Specifies a list of elements to place inside the element.

    For example:

    ttk::style layout Horizontal.TScrollbar { Scrollbar.trough -children { Scrollbar.leftarrow -side left Scrollbar.rightarrow -side right Horizontal.Scrollbar.thumb -side left -sticky ew } }
    tile-intro widget pixmap style theme appearance
    tile-0.8.2/doc/xml/tile-intro.tmml0000644000076500007650000001545710731273210016402 0ustar joejoe00000000000000 tile_intro Introduction to the Tile theme engine
    OVERVIEW

    The tile widget set is based on a revised and enhanced version of the TIP #48 style engine. The main concepts are described below. The basic idea is to separate, to the extent possible, the code implementing a widget's behavior from the code implementing its appearance. Widget class bindings are primarily responsible for maintaining the widget state and invoking callbacks; all aspects of the widgets appearance is

    THEMES

    A theme is a collection of elements and styles that determine the look and feel of the widget set. Themes can be used to:

    • Isolate platform differences (X11 vs. classic Windows vs. XP vs. Aqua ...)
    • Adapt to display limitations (low-color, grayscale, monochrome, tiny screens)
    • Accessibility (high contrast, large type)
    • Application suite branding
    • Blend in with the rest of the desktop (Gnome, KDE, Java)
    • And, of course: eye candy.
    ELEMENTS

    An element displays an individual part of a widget. For example, a vertical scrollbar widget contains uparrow, downarrow, trough and slider elements.

    Element names use a recursive dotted notation. For example, uparrow identifies a generic arrow element, and Scrollbar.uparrow and Combobox.uparrow identify widget-specific elements. When looking for an element, the style engine looks for the specific name first, and if an element of that name is not found it looks for generic elements by stripping off successive leading components of the element name.

    Like widgets, elements have options which specify what to display and how to display it. For example, the text element (which displays a text string) has -text, -font, -foreground, -background, -underline, and -width options. The value of an element option is taken from:

    • An option of the same name and type in the widget containing the element;
    • A dynamic setting specified by style map and the current state;
    • The default setting specified by style configure; or
    • The element's built-in default value for the option.
    LAYOUTS

    A layout specifies which elements make up a widget and how they are arranged. The layout engine uses a simplified version of the pack algorithm: starting with an initial cavity equal to the size of the widget, elements are allocated a parcel within the cavity along the side specified by the -side option, and placed within the parcel according to the -sticky option. For example, the layout for a horizontal scrollbar

    ttk::style layout Horizontal.TScrollbar { Scrollbar.trough -children { Scrollbar.leftarrow -side left -sticky w Scrollbar.rightarrow -side right -sticky e Scrollbar.thumb -side left -expand true -sticky ew } }

    By default, the layout for a widget is the same as its class name. Some widgets may override this (for example, the ttk::scrollbar widget chooses different layouts based on the -orient option).

    STATES

    In standard Tk, many widgets have a -state option which (in most cases) is either normal or disabled. Some widgets support additional states, such as the entry widget which has a readonly state and the various flavors of buttons which have active state.

    The Tile widget set generalizes this idea: every widget has a bitmap of independent state flags. Widget state flags include active, disabled, pressed, focus, etc., (see widget(n) for the full list of state flags).

    Instead of a -state option, every widget now has a state widget command which is used to set or query the state. A state specification is a list of symbolic state names indicating which bits are set, each optionally prefixed with an exclamation point indicating that the bit is cleared instead.

    For example, the class bindings for the ttk::button widget are:

    bind TButton <Enter> { %W state active } bind TButton <Leave> { %W state !active } bind TButton <ButtonPress-1> { %W state pressed } bind TButton <Button1-Leave> { %W state !pressed } bind TButton <Button1-Enter> { %W state pressed } bind TButton <ButtonRelease-1> \ { %W instate {pressed} { %W state !pressed ; %W invoke } }

    This specifies that the widget becomes active when the pointer enters the widget, and inactive when it leaves. Similarly it becomes pressed when the mouse button is pressed, and !pressed on the ButtonRelease event. In addition, the button unpresses if pointer is dragged outside the widget while Button-1 is held down, and represses if it's dragged back in. Finally, when the mouse button is released, the widget's -command is invoked, but only if the button is currently in the pressed state. (The actual bindings are a little more complicated than the above, but not by much).

    Note to self: rewrite that paragraph. It's horrible.

    STYLES

    Each widget is associated with a style, which specifies values for element options. Style names use a recursive dotted notation like layouts and elements; by default, widgets use the class name to look up a style in the current theme. For example:

    ttk::style configure TButton \ -background #d9d9d9 \ -foreground black \ -relief raised \ ;

    Many elements are displayed differently depending on the widget state. For example, buttons have a different background when they are active, a different foreground when disabled, and a different relief when pressed. The style map command specifies dynamic option settings for a particular style:

    ttk::style map TButton \ -background [list disabled #d9d9d9 active #ececec] \ -foreground [list disabled #a3a3a3] \ -relief [list {pressed !disabled} sunken] \ ;
    widget(n) style(n) TIP #48
    tile-0.8.2/doc/xml/treeview.tmml0000644000076500007650000004574010731273211016145 0ustar joejoe00000000000000 ttk::treeview hierarchical multicolumn data display widget ttk::treeview pathname ?options?
    DESCRIPTION

    The treeview widget displays a hierarchical collection of items. Each item has a textual label, an optional image, and an optional list of data values. The data values are displayed in successive columns after the tree label.

    The order in which data values are displayed may be controlled by setting the -displaycolumns widget option. The tree widget can also display column headings. Columns may be accessed by number or by symbolic names listed in the -columns widget option; see COLUMN IDENTIFIERS.

    Each item is identified by a unique name. The widget will generate item IDs if they are not supplied by the caller. There is a distinguished root item, named {}. The root item itself is not displayed; its children appear at the top level of the hierarchy.

    Each item also has a list of tags, which can be used to associate event bindings with individual items and control the appearance of the item.

    Treeview widgets support horizontal and vertical scrolling with the standard -[xy]scrollcommand options and [xy]view widget commands.

    STANDARD OPTIONS
  • -class
  • -cursor
  • -style
  • -takefocus
  • -xscrollcommand
  • -yscrollcommand
  • WIDGET OPTIONS -columns columns Columns A list of column identifiers, specifying the number of columns and their names. -displaycolumns displayColumns DisplayColumns A list of column identifiers (either symbolic names or integer indices) specifying which data columns are displayed and the order in which they appear, or the string #all.
    If set to #all (the default), all columns are shown in the order given.
    -height height Height Specifies the number of rows which should be visible. Note: the requested width is determined from the sum of the column widths. -padding padding Padding Specifies the internal padding for the widget. The padding is a list of up to four length specifications; see Ttk_GetPaddingFromObj() for details. -selectmode selectMode SelectMode Controls how the built-in class bindings manage the selection. One of extended, browse, or none.
    If set to extended (the default), multiple items may be selected. If browse, only a single item will be selected at a time. If none, the selection will not be changed.
    Note that application code and tag bindings can set the selection however they wish, regardless of the value of -selectmode.
    -show show Show A list containing zero or more of the following values, specifying which elements of the tree to display.
    tree
    Display tree labels in column #0.
    headings
    Display the heading row.

    The default is tree headings, i.e., show all elements.

    NOTE: Column #0 always refers to the tree column, even if -show tree is not specified.

    WIDGET COMMAND
    pathname bbox item ?column?
    Returns the bounding box (relative to the treeview widget's window) of the specified item in the form x y width height. If column is specified, returns the bounding box of that cell. If the item is not visible (i.e., if it is a descendant of a closed item or is scrolled offscreen), returns the empty list.
    pathname cget option
    Returns the current value of the specified option; see widget(n).
    pathname children item ?newchildren?
    If newchildren is not specified, returns the list of children belonging to item.

    If newchildren is specified, replaces item's child list with newchildren. Items in the old child list not present in the new child list are detached from the tree. None of the items in newchildren may be an ancestor of item.

    pathname column column ?-option ?value -option value...?
    Query or modify the options for the specified column. If no -option is specified, returns a dictionary of option/value pairs. If a single -option is specified, returns the value of that option. Otherwise, the options are updated with the specified values. The following options may be set on each column:
    -id name
    The column name. This is a read-only option. For example, [$pathname column #n -id] returns the data column associated with display column #n.
    -anchor
    Specifies how the text in this column should be aligned with respect to the cell. One of n, ne, e, se, s, sw, w, nw, or center.
    -minwidth
    The minimum width of the column in pixels. The treeview widget will not make the column any smaller than -minwidth when the widget is resized or the user drags a column separator.
    -stretch
    Specifies whether or not the column's width should be adjusted when the widget is resized.
    -width w
    The width of the column in pixels. Default is something reasonable, probably 200 or so.

    Use pathname column #0 to configure the tree column.

    pathname configure ?option? ?value option value ...?
    Modify or query widget options; see widget(n).
    pathname delete itemList
    Deletes each of the items in itemList and all of their descendants. The root item may not be deleted. See also: detach.
    pathname detach itemList
    Unlinks all of the specified items in itemList from the tree. The items and all of their descendants are still present and may be reinserted at another point in the tree but will not be displayed. The root item may not be detached. See also: delete.
    pathname exists item
    Returns 1 if the specified item is present in the tree, 0 otherwise.
    pathname focus ?item?
    If item is specified, sets the focus item to item. Otherwise, returns the current focus item, or {} if there is none.
    pathname heading column ?-option ?value -option value...?
    Query or modify the heading options for the specified column. Valid options are:
    -text text
    The text to display in the column heading.
    -image imageName
    Specifies an image to display to the right of the column heading.
    -anchor anchor
    Specifies how the heading text should be aligned. One of the standard Tk anchor values.
    -command script
    A script to evaluate when the heading label is pressed.

    Use pathname heading #0 to configure the tree column heading.

    pathname identify component x y
    Returns a description of the specified component under the point given by x and y, or the empty string if no such component is present at that position. The following subcommands are supported: pathname identify row x y Returns the item ID of the item at position y. pathname identify column x y Returns the data column identifier of the cell at position x. The tree column has ID #0.

    See COLUMN IDENTIFIERS for a discussion of display columns and data columns.

    pathname index item
    Returns the integer index of item within its parent's list of children.
    pathname insert parent index ?-id id? options...
    Creates a new item. parent is the item ID of the parent item, or the empty string {} to create a new top-level item. index is an integer, or the value end, specifying where in the list of parent's children to insert the new item. If index is less than or equal to zero, the new node is inserted at the beginning; if index is greater than or equal to the current number of children, it is inserted at the end. If -id is specified, it is used as the item identifier; id must not already exist in the tree. Otherwise, a new unique identifier is generated.

    pathname insert returns the item identifier of the newly created item. See ITEM OPTIONS for the list of available options.

    pathname instate statespec ?script?
    Test the widget state; see widget(n).
    pathname item item ?-option ?value -option value...?
    Query or modify the options for the specified item. If no -option is specified, returns a dictionary of option/value pairs. If a single -option is specified, returns the value of that option. Otherwise, the item's options are updated with the specified values. See ITEM OPTIONS for the list of available options.
    pathname move item parent index
    Moves item to position index in parent's list of children. It is illegal to move an item under one of its descendants.

    If index is less than or equal to zero, item is moved to the beginning; if greater than or equal to the number of children, it's moved to the end.

    pathname next item
    Returns the identifier of item's next sibling, or {} if item is the last child of its parent.
    pathname parent item
    Returns the ID of the parent of item, or {} if item is at the top level of the hierarchy.
    pathname prev item
    Returns the identifier of item's previous sibling, or {} if item is the first child of its parent.
    pathname see item
    Ensure that item is visible: sets all of item's ancestors to -open true, and scrolls the widget if necessary so that item is within the visible portion of the tree.
    pathname selection ?selop itemList?
    If selop is not specified, returns the list of selected items. Otherwise, selop is one of the following: pathname selection set itemList itemList becomes the new selection. pathname selection add itemList Add itemList to the selection pathname selection remove itemList Remove itemList from the selection pathname selection toggle itemList Toggle the selection state of each item in itemList.
    pathname set item ?column ?value??
    With one argument, returns a dictionary of column/value pairs for the specified item. With two arguments, returns the current value of the specified column. With three arguments, sets the value of column column in item item to the specified value. See also COLUMN IDENTIFIERS.
    pathname state ?stateSpec?
    Modify or query the widget state; see widget(n).
    pathName tag args...
    pathName tag bind tagName ?sequence ?script??
    Add a Tk binding script for the event sequence sequence to the tag tagName. When an X event is delivered to an item, binding scripts for each of the item's -tags are evaluated in order as per bindtags(n).

    <KeyPress>, <KeyRelease>, and virtual events are sent to the focus item. <ButtonPress>, <ButtonRelease>, and <Motion> events are sent to the item under the mouse pointer. No other event types are supported.

    The binding script undergoes %-substitutions before evaluation; see bind(n) for details.

    pathName tag configure tagName ?option? ?value option value...?
    Query or modify the options for the specified tagName. If one or more option/value pairs are specified, sets the value of those options for the specified tag. If a single option is specified, returns the value of that option (or the empty string if the option has not been specified for tagName). With no additional arguments, returns a dictionary of the option settings for tagName. See TAG OPTIONS for the list of available options.
    pathName xview args
    Standard command for horizontal scrolling; see widget(n).
    pathName yview args
    Standard command for vertical scrolling; see widget(n).
    ITEM OPTIONS

    The following item options may be specified for items in the insert and item widget commands.

    -text text Text The textual label to display for the item. -image image Image A Tk image, displayed to the left of the label. -values values Values The list of values associated with the item.
    Each item should have the same number of values as the -columns widget option. If there are fewer values than columns, the remaining values are assumed empty. If there are more values than columns, the extra values are ignored.
    -open open Open A boolean value indicating whether the item's children should be displayed (-open true) or hidden (-open false). -tags tags Tags A list of tags associated with this item.
    TAG OPTIONS

    The following options may be specified on tags:

    -foreground
    Specifies the text foreground color.
    -background
    Specifies the cell or item background color.
    -font
    Specifies the font to use when drawing text.
    -image
    Specifies the item image, in case the item's -image option is empty.

    (@@@ TODO: sort out order of precedence for options)

    COLUMN IDENTIFIERS

    Column identifiers take any of the following forms:

    • A symbolic name from the list of -columns.
    • An integer n, specifying the nth data column.
    • A string of the form #n, where n is an integer, specifying the nth display column.

    NOTE: Item -values may be displayed in a different order than the order in which they are stored.

    NOTE: Column #0 always refers to the tree column, even if -show tree is not specified.

    A data column number is an index into an item's -values list; a display column number is the column number in the tree where the values are displayed. Tree labels are displayed in column #0. If -displaycolumns is not set, then data column n is displayed in display column #n+1. Again, column #0 always refers to the tree column.

    VIRTUAL EVENTS

    The treeview widget generates the following virtual events.

    <<TreeviewSelect>>
    Generated whenever the selection changes.
    <<TreeviewOpen>>
    Generated just before setting the focus item to -open true.
    <<TreeviewClose>>
    Generated just after setting the focus item to -open false.

    The focus and selection widget commands can be used to determine the affected item or items. In Tk 8.5, the affected item is also passed as the -detail field of the virtual event.

    widget(n) listbox(n) image(n) bind(n)
    tile-0.8.2/doc/xml/widget.tmml0000644000076500007650000002461310731273211015572 0ustar joejoe00000000000000 widget Standard options and commands supported by Tile widgets
    DESCRIPTION

    This manual describes common widget options and commands.

    STANDARD OPTIONS

    The following options are supported by all Tile widgets:

    -class (N/A) (N/A) Specifies the window class. The class is used when querying the option database for the window's other options, to determine the default bindtags for the window, and to select the widget's default layout and style. This is a read-only option: it may only be specified when the window is created, and may not be changed with the configure widget command. -cursor cursor Cursor Specifies the mouse cursor to be used for the widget. See Tk_GetCursor and cursors(n) in the Tk reference manual for the legal values. If set to the empty string (the default), the cursor is inherited from the parent widget. -takefocus takeFocus TakeFocus Determines whether the window accepts the focus during keyboard traversal. Either 0, 1, a command prefix (to which the widget path is appended, and which should return 0 or 1), or the empty string. See options(n) in the Tk reference manual for the full description. -style style Style May be used to specify a custom widget style.
    SCROLLABLE WIDGET OPTIONS

    The following options are supported by widgets that are controllable by a scrollbar. See scrollbar(n) for more information

    -xscrollcommand xScrollCommand ScrollCommand A command prefix, used to communicate with horizontal scrollbars.

    When the view in the widget's window changes, the widget will generate a Tcl command by concatenating the scroll command and two numbers. Each of the numbers is a fraction between 0 and 1 indicating a position in the document; 0 indicates the beginning, and 1 indicates the end. The first fraction indicates the first information in the widget that is visible in the window, and the second fraction indicates the information just after the last portion that is visible.

    Typically the xScrollCommand option consists of the path name of a scrollbar widget followed by ``set'', e.g. ``.x.scrollbar set''. This will cause the scrollbar to be updated whenever the view in the window changes.

    If this option is set to the empty string (the default), then no command will be executed.

    -yscrollcommand yScrollCommand ScrollCommand A command prefix, used to communicate with vertical scrollbars. See the description of -xscrollcommand above for details.
    LABEL OPTIONS

    The following options are supported by labels, buttons, and other button-like widgets:

    -text text Text Specifies a text string to be displayed inside the widget (unless overridden by -textvariable). -textvariable textVariable Variable Specifies the name of variable whose value will be used in place of the -text resource. -underline underline Underline If set, specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation (see keynav(n)). -image image Image Specifies an image to display. This is a list of 1 or more elements. The first element is the default image name. The rest of the list is a sequence of statespec / value pairs as per style map, specifying different images to use when the widget is in a particular state or combination of states. All images in the list should have the same size. -compound compound Compound Specifies how to display the image relative to the text, in the case both -text and -image are present. Valid values are:
    text
    Display text only.
    image
    Display image only.
    center
    Display text centered on top of image.
    top
    bottom
    left
    right
    Display image above, below, left of, or right of the text, respectively.
    none
    The default; display the image if present, otherwise the text.
    -width width Width If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used.
    COMPATIBILITY OPTIONS -state state State May be set to normal or disabled to control the disabled state bit. This is a write-only option: setting it changes the widget state, but the state widget command does not affect the -state option.
    COMMANDS
    pathName cget option
    Returns the current value of the configuration option given by option.
    pathName configure ?option? ?value option value ...?
    Query or modify the configuration options of the widget. If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. If option is specified with no value, then the command returns a list describing the named option: the elements of the list are the option name, database name, database class, default value, and current value. If no option is specified, returns a list describing all of the available options for pathName.
    pathName instate statespec ?script?
    Test the widget's state. If script is not specified, returns 1 if the widget state matches statespec and 0 otherwise. If script is specified, equivalent to if {[pathName instate stateSpec]} script
    pathName state ?stateSpec?
    Modify or inquire widget state. If stateSpec is present, sets the widget state: for each flag in stateSpec, sets the corresponding flag or clears it if prefixed by an exclamation point.

    Returns a new state spec indicating which flags were changed:

    set changes [pathName state spec] ; pathName state $changes

    will restore pathName to the original state. If stateSpec is not specified, returns a list of the currently-enabled state flags.

    WIDGET STATES

    The widget state is a bitmap of independent state flags. Widget state flags include:

    active
    The mouse cursor is over the widget and pressing a mouse button will cause some action to occur. (aka "prelight" (Gnome), "hot" (Windows), "hover").
    disabled
    Widget is disabled under program control (aka "unavailable", "inactive")
    focus
    Widget has keyboard focus
    pressed
    Widget is being pressed (aka "armed" in Motif).
    selected
    "On", "true", or "current" for things like checkbuttons and radiobuttons.
    background
    Windows and the Mac have a notion of an "active" or foreground window. The background state is set for widgets in a background window, and cleared for those in the foreground window.
    readonly
    Widget should not allow user modification.
    alternate
    A widget-specific alternate display format. For example, used for checkbuttons and radiobuttons in the "tristate" or "mixed" state, and for buttons with -default active.
    invalid
    The widget's value is invalid. (Potential uses: scale widget value out of bounds, entry widget value failed validation.)

    A state specification or stateSpec is a list of state names, optionally prefixed with an exclamation point (!) indicating that the bit is off.

    EXAMPLES set b [ttk::button .b] # Disable the widget: $b state disabled # Invoke the widget only if it is currently pressed and enabled: $b instate {pressed !disabled} { .b invoke } # Reenable widget: $b state !disabled
    tile-intro(n) style(n) state configure option
    tile-0.8.2/doc/xml/INDEX.MAP0000644000076500007650000002015310731273212014616 0ustar joejoe00000000000000 tile-0.8.2/doc/html/0000755000076500007650000000000010731273213013554 5ustar joejoe00000000000000tile-0.8.2/doc/html/manpage.css0000644000076500007650000000750010131111212015660 0ustar joejoe00000000000000/* * $Id: manpage.css,v 1.5 2004/10/01 00:10:49 jenglish Exp $ * Author: Joe English, * Created: 26 Jun 2000 * Description: CSS stylesheet for TCL man pages */ HTML { background: #FFFFFF; color: black; } BODY { background: #FFFFFF; color: black; } DIV.body { margin-left: 10%; margin-right: 10%; } DIV.header,DIV.footer { width: 100%; margin-left: 0%; margin-right: 0%; } DIV.body H1,DIV.body H2 { margin-left: -5%; } /* Navigation material: */ DIV.navbar { width: 100%; margin-top: 5pt; margin-bottom: 5pt; margin-left: 0%; margin-right: 0%; padding-top: 5pt; padding-bottom: 5pt; background: #DDDDDD; color: black; border: 1px solid black; text-align: center; font-size: small; font-family: sans-serif; } P.navaid { text-align: center; } .navaid { font-size: small; font-family: sans-serif; } P.notice { text-align: center; font-size: small; font-family: sans-serif; font-style: italic; color: red; } A.navaid:link { color: green; background: transparent; } A.navaid:visited { color: green; background: transparent; } A.navaid:active { color: yellow; background: transparent; } /* For most anchors, we should leave colors up to the user's preferences. */ /*-- A:link { color: blue; background: transparent; } A:visited { color: purple; background: transparent; } A:active { color: red; background: transparent; } --*/ H1, H2, H3, H4 { margin-top: 1em; font-family: sans-serif; font-size: large; color: #005A9C; background: transparent; text-align: left; } H1.title { text-align: center; } UL,OL { margin-right: 0em; margin-top: 3pt; margin-bottom: 3pt; } UL LI { list-style: disc; } OL LI { list-style: decimal; } DT { padding-top: 1ex; } DL.toc { font: normal 12pt/16pt sans-serif; margin-left: 10%; } UL.toc,UL.toc UL, UL.toc UL UL { font: normal 12pt/14pt sans-serif; list-style: none; } LI.tocentry,LI.tocheading { list-style: none; margin-left: 0em; text-indent: 0em; padding: 0em; } .tocheading { font-family: sans-serif; font-weight: bold; color: #005A9C; background: transparent; } PRE { display: block; font-family: monospace; white-space: pre; margin: 0%; padding-top: 0.5ex; padding-bottom: 0.5ex; padding-left: 1ex; padding-right: 1ex; width: 100%; } PRE.syntax { color: black; background: #80ffff; border: 1px solid black; font-family: serif; } PRE.example { color: black; background: #f5dcb3; border: 1px solid black; } DIV.arglist { border: 1px solid black; width: 100%; } TH, THEAD TR, TR.heading { color: #005A9C; background: #DDDDDD; text-align: center; font-family: sans-serif; font-weight: bold; } TR.syntax { color: black; background: #80ffff; } TR.desc { color: black; background: #f5dcb3; } /* TR.row[01] are used to get alternately colored table rows. * Could probably choose better colors here... */ TR.row0 { color: black; background: #efffef; } TR.row1 { color: black; background: #efefff; } /* Workaround for Netscape bugs: * Netscape doesn't seem to compute table widths properly. * unless they're wrapped inside a DIV. (Additionally, * it appears to require a non-zero border-width.) */ DIV.table { border-width: 1px; border-color: white; width: 100%; } DIV.menu { /* Wrapper for TABLE class="menu" */ margin-top: 10px; margin-bottom: 10px; border: thin solid #005A9C; width: 100%; margin-left: 5%; } VAR { font-style: italic; } /* For debugging: highlight unrecognized elements: */ .unrecognized { color: red; background: green; } /* EOF */ tile-0.8.2/doc/html/button.html0000644000076500007650000001436210731273213015763 0ustar joejoe00000000000000 Tile package reference: button

    NAME

    ttk::button -
    Widget that issues a command when pressed

    SYNOPSIS

    ttk::button pathName ?options?
    

    DESCRIPTION

    A button widget displays a textual label and/or image, and evaluates a command when pressed.

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -commandcommandCommand
     A script to evaluate when the widget is invoked.
    -defaultdefaultDefault
     May be set to one of normal, active, or disabled. In a dialog box, one button may be designated the "default" button (meaning, roughly, "the one that gets invoked when the user presses <Enter>"). active indicates that this is currently the default button; normal means that it may become the default button, and disabled means that it is not defaultable. The default is normal.
    Depending on the theme, the default button may be displayed with an extra highlight ring, or with a different border color. See also: keynav(n).
    -widthwidthWidth
     If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used. Note that some themes may specify a non-zero -width in the style.

    WIDGET COMMAND

    pathName invoke
    Invokes the command associated with the button.
    pathName cget option
    pathName configure ?option? ?value option value ...?
    pathName instate statespec ?script?
    pathName state ?stateSpec?
    See widget(n)

    COMPATIBILITY OPTIONS

    NameDatabase nameDatabase class
    -statestateState
     May be set to normal or disabled to control the disabled state bit. This is a ``write-only'' option: setting it changes the widget state, but the state widget command does not affect the state option.

    SEE ALSO

    widget(n), keynav(n)

    KEYWORDS

    widget, button, default, command

    tile-0.8.2/doc/html/checkbutton.html0000644000076500007650000001353310731273213016760 0ustar joejoe00000000000000 Tile package reference: checkbutton

    NAME

    ttk::checkbutton -
    On/off widget

    SYNOPSIS

    ttk::checkbutton pathName ?options?
    

    DESCRIPTION

    A checkbutton widget is used to show or change a setting. It has two states, selected and deselected. The state of the checkbutton may be linked to a Tcl variable.

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -commandcommandCommand
     A Tcl script to execute whenever the widget is invoked.
    -offvalueoffValueOffValue
     The value to store in the associated -variable when the widget is deselected. Defaults to 0.
    -onvalueonValueOnValue
     The value to store in the associated -variable when the widget is selected. Defaults to 1.
    -variablevariableVariable
     The name of a global variable whose value is linked to the widget. Defaults to the widget pathname if not specified.

    WIDGET COMMAND

    In addition to the standard cget, configure, instate, and state commands, checkbuttons support the following additional widget commands:

    pathname invoke
    Toggles between the selected and deselected states and evaluates the associated -command. If the widget is currently selected, sets the -variable to the -offvalue and deselects the widget; otherwise, sets the -variable to the -onvalue Returns the result of the -command.

    WIDGET STATES

    The widget does not respond to user input if the disabled state is set. The widget sets the selected state whenever the linked -variable is set to the widget's -onvalue, and clears it otherwise. The widget sets the alternate state whenever the linked -variable is unset. (The alternate state may be used to indicate a ``tri-state'' or ``indeterminate'' selection.)

    SEE ALSO

    widget(n), keynav(n), radiobutton(n)

    KEYWORDS

    widget, button, toggle, check, option

    tile-0.8.2/doc/html/combobox.html0000644000076500007650000001752710731273213016266 0ustar joejoe00000000000000 Tile package reference: combobox

    NAME

    ttk::combobox -
    text field with popdown selection list

    SYNOPSIS

    ttk::combobox pathName ?options?
    

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -exportselectionexportSelectionExportSelection
     Boolean value. If set, the widget selection is linked to the X selection.
    -justifyjustifyJustify
     Specifies how the text is aligned within the widget. One of left, center, or right.
    -heightheightHeight
     Specifies the height of the pop-down listbox, in rows.
    -postcommandpostCommandPostCommand
     A Tcl script to evaluate immediately before displaying the listbox. The -postcommand script may specify the -values to display.
    -statestateState
     One of normal, readonly, or disabled. In the readonly state, the value may not be edited directly, and the user can only select one of the -values from the dropdown list. In the normal state, the text field is directly editable. In the disabled state, no interaction is possible.
    -textvariabletextVariableTextVariable
     Specifies the name of a variable whose value is linked to the widget value. Whenever the variable changes value the widget value is updated, and vice versa.
    -valuesvaluesValues
     Specifies the list of values to display in the drop-down listbox.
    -widthwidthWidth
     Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font.

    DESCRIPTION

    A combobox combines a text field with a pop-down list of values; the user may select the value of the text field from among the values in the list.

    WIDGET COMMAND

    pathName cget option
    Returns the current value of the specified option. See widget(n).
    pathName configure ?option? ?value option value ...?
    Modify or query widget options. See widget(n).
    pathName current ?newIndex?
    If newIndex is supplied, sets the combobox value to the element at position newIndex in the list of -values. Otherwise, returns the index of the current value in the list of -values or -1 if the current value does not appear in the list.
    pathName get
    Returns the current value of the combobox.
    pathName identify x y
    Returns the name of the element at position x, y, or the empty string if the coordinates are outside the window.
    pathName instate statespec ?script?
    Test the widget state. See widget(n).
    pathName set value
    Sets the value of the combobox to value.
    pathName state ?stateSpec?
    Modify or query the widget state. See widget(n).

    The combobox widget also supports the following entry widget commands (see entry(n) for details):

    VIRTUAL EVENTS

    The combobox widget generates a <<ComboboxSelected>> virtual event when the user selects an element from the list of values. This event is generated after the listbox is unposted.

    SEE ALSO

    widget(n), entry(n)

    tile-0.8.2/doc/html/dialog.html0000644000076500007650000002064410731273213015707 0ustar joejoe00000000000000 Tile package reference: dialog

    NAME

    ttk::dialog -
    create a dialog box

    SYNOPSIS

    package require ttk::dialog ?0.8?
    
    ttk::dialog pathname ?options...?
    ttk::dialog::define dialogType ?options...?
    

    DESCRIPTION

    A dialog box is a transient top-level window containing an icon, a short message, an optional, longer, detail message, and a row of command buttons. When the user presses any of the buttons, a callback function is invoked and then the dialog is destroyed.

    Additional widgets may be added in the dialog client frame.

    OPTIONS

    NameDatabase nameDatabase class
    -titlen/an/a
     Specifies a string to use as the window manager title.
    -messagen/an/a
     Specifies the message to display in this dialog.
    -detailn/an/a
     Specifies a longer auxiliary message.
    -commandn/an/a
     Specifies a command prefix to be invoked when the user presses one of the command buttons. The symbolic name of the button is passed as an additional argument to the command. The dialog is dismissed after invoking the command.
    -parentn/an/a
     Specifies a toplevel window for which the dialog is transient. If omitted, the default is the nearest ancestor toplevel. If set to the empty string, the dialog will not be a transient window.
    -typen/an/a
     Specifies a built-in or user-defined dialog type. See PREDEFINED DIALOG TYPES, below.
    -iconn/an/a
     Specifies one of the stock dialog icons, info, question, warning, error, auth, or busy. If set to the empty string (the default), no icon is displayed.
    -buttonsn/an/a
     A list of symbolic button names.
    -labelsn/an/a
     A dictionary mapping symbolic button names to textual labels. May be omitted if all the buttons are predefined.
    -defaultn/an/a
     The symbolic name of the default button.
    -canceln/an/a
     The symbolic name of the "cancel" button. The cancel button is invoked if the user presses the Escape key and when the dialog is closed from the window manager. If -cancel is not specified, the dialog ignores window manager close commands (WM_DELETE_WINDOW).

    WIDGET COMMANDS

    ttk::dialog::clientframe dlg
    Returns the widget path of the client frame. Other widgets may be added to the client frame. The client frame appears between the detail message and the command buttons.

    PREDEFINED DIALOG TYPES

    The -type option, if present, specifies default values for other options. ttk::dialog::define type options... specifies a new stock dialog type. The following stock dialog types are predefined:

    ttk::dialog::define ok \
        -icon info -buttons {ok} -default ok
    ttk::dialog::define okcancel \
        -icon info -buttons {ok cancel} -default ok -cancel cancel
    ttk::dialog::define yesno \
        -icon question -buttons {yes no}
    ttk::dialog::define yesnocancel \
        -icon question -buttons {yes no cancel} -cancel cancel
    ttk::dialog::define retrycancel \
        -icon question -buttons {retry cancel} -cancel cancel
    

    STOCK BUTTONS

    The following ``stock'' symbolic button names have predefined labels: yes, no, ok, cancel, and retry.

    It is not necessary to list these in the -labels dictionary.

    EXAMPLE

    proc saveFileComplete {button} {
        switch -- $button {
        	yes { # save file ... }
    	no  { exit }
    	cancel { # no-op }
        }
    }
    
    ttk::dialog .saveFileDialog \
        -title "Save file?" \
        -icon question \
        -message "Save file before closing?" \
        -detail "If you do not save the file, your work will be lost" \
        -buttons [list yes no cancel] \ 
        -labels [list yes "Save file" no "Don't save"] \
        -command saveFileComplete \
        ;
    

    SEE ALSO

    tk_messageBox(n), wm(n), toplevel(n)

    tile-0.8.2/doc/html/entry.html0000644000076500007650000005715510731273213015620 0ustar joejoe00000000000000 Tile package reference: entry

    NAME

    ttk::entry -
    Editable text field widget

    SYNOPSIS

    ttk::entry pathName ?options?
    

    DESCRIPTION

    An entry widget displays a one-line text string and allows that string to be edited by the user. The value of the string may be linked to a Tcl variable with the -textvariable option. Entry widgets support horizontal scrolling with the standard -xscrollcommand option and xview widget command.

    STANDARD OPTIONS

    WIDGET-SPECIFIC OPTIONS

    NameDatabase nameDatabase class
    -exportselectionexportSelectionExportSelection
     A boolean value specifying whether or not a selection in the widget should be linked to the X selection. If the selection is exported, then selecting in the widget deselects the current X selection, selecting outside the widget deselects any widget selection, and the widget will respond to selection retrieval requests when it has a selection.
    -invalidcommandinvalidCommandInvalidCommand
     A script template to evaluate whenever the validateCommand returns 0. See VALIDATION below for more information.
    -justifyjustifyJustify
     Specifies how the text is aligned within the entry widget. One of left, center, or right.
    -showshowShow
     If this option is specified, then the true contents of the entry are not displayed in the window. Instead, each character in the entry's value will be displayed as the first character in the value of this option, such as ``*''. This is useful, for example, if the entry is to be used to enter a password. If characters in the entry are selected and copied elsewhere, the information copied will be what is displayed, not the true contents of the entry.
    -statestateState
     Compatibility option; see widget(n) for details. Specifies one of three states for the entry, normal, disabled, or readonly. See WIDGET STATES, below.
    -textvariabletextVariableVariable
     Specifies the name of a variable whose value is linked to the entry widget's contents. Whenever the variable changes value, the widget's contents are updated, and vice versa.
    -validatevalidateValidate
     Specifies the mode in which validation should operate: none, focus, focusin, focusout, key, or all. Default is none, meaning that validation is disabled. See VALIDATION below.
    -validatecommandvalidateCommandValidateCommand
     A script template to evaluate whenever validation is triggered. If set to the empty string (the default), validation is disabled. The script must return a boolean value. See VALIDATION below.
    -widthwidthWidth
     Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font.

    NOTES

    A portion of the entry may be selected as described below. If an entry is exporting its selection (see the exportSelection option), then it will observe the standard X11 protocols for handling the selection; entry selections are available as type STRING. Entries also observe the standard Tk rules for dealing with the input focus. When an entry has the input focus it displays an insert cursor to indicate where new characters will be inserted.

    Entries are capable of displaying strings that are too long to fit entirely within the widget's window. In this case, only a portion of the string will be displayed; commands described below may be used to change the view in the window. Entries use the standard xScrollCommand mechanism for interacting with scrollbars (see the description of the xScrollCommand option for details).

    INDICES

    Many of the entry widget commands take one or more indices as arguments. An index specifies a particular character in the entry's string, in any of the following ways:

    number
    Specifies the character as a numerical index, where 0 corresponds to the first character in the string.
    @number
    In this form, number is treated as an x-coordinate in the entry's window; the character spanning that x-coordinate is used. For example, ``@0'' indicates the left-most character in the window.
    end
    Indicates the character just after the last one in the entry's string. This is equivalent to specifying a numerical index equal to the length of the entry's string.
    insert
    Indicates the character adjacent to and immediately following the insert cursor.
    sel.first
    Indicates the first character in the selection. It is an error to use this form if the selection isn't in the entry window.
    sel.last
    Indicates the character just after the last one in the selection. It is an error to use this form if the selection isn't in the entry window.

    Abbreviations may be used for any of the forms above, e.g. ``e'' or ``sel.f''. In general, out-of-range indices are automatically rounded to the nearest legal value.

    WIDGET COMMAND

    The following commands are possible for entry widgets:

    pathName bbox index
    Returns a list of four numbers describing the bounding box of the character given by index. The first two elements of the list give the x and y coordinates of the upper-left corner of the screen area covered by the character (in pixels relative to the widget) and the last two elements give the width and height of the character, in pixels. The bounding box may refer to a region outside the visible area of the window.
    pathName cget option
    Returns the current value of the specified option. See widget(n).
    pathName configure ?option? ?value option value ...?
    Modify or query widget options. See widget(n).
    pathName delete first ?last?
    Delete one or more elements of the entry. First is the index of the first character to delete, and last is the index of the character just after the last one to delete. If last isn't specified it defaults to first+1, i.e. a single character is deleted. This command returns the empty string.
    pathName get
    Returns the entry's string.
    pathName icursor index
    Arrange for the insert cursor to be displayed just before the character given by index. Returns the empty string.
    pathName identify x y
    Returns the name of the element at position x, y, or the empty string if the coordinates are outside the window.
    pathName index index
    Returns the numerical index corresponding to index.
    pathName insert index string
    Insert string just before the character indicated by index. Returns the empty string.
    pathName instate statespec ?script?
    Test the widget state. See widget(n).
    pathName selection option arg
    This command is used to adjust the selection within an entry. It has several forms, depending on option:
    pathName selection clear
    Clear the selection if it is currently in this widget. If the selection isn't in this widget then the command has no effect. Returns the empty string.
    pathName selection present
    Returns 1 if there is are characters selected in the entry, 0 if nothing is selected.
    pathName selection range start end
    Sets the selection to include the characters starting with the one indexed by start and ending with the one just before end. If end refers to the same character as start or an earlier one, then the entry's selection is cleared.
    pathName state ?stateSpec?
    Modify or query the widget state. See widget(n).
    pathName validate
    Force revalidation, independent of the conditions specified by the -validate option. Returns 0 if validation fails, 1 if it succeeds. Sets or clears the invalid state accordingly.
    pathName xview args
    This command is used to query and change the horizontal position of the text in the widget's window. It can take any of the following forms:
    pathName xview
    Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the entry's text is off-screen to the left, the middle 40% is visible in the window, and 40% of the text is off-screen to the right. These are the same values passed to scrollbars via the -xscrollcommand option.
    pathName xview index
    Adjusts the view in the window so that the character given by index is displayed at the left edge of the window.
    pathName xview moveto fraction
    Adjusts the view in the window so that the character fraction of the way through the text appears at the left edge of the window. Fraction must be a fraction between 0 and 1.
    pathName xview scroll number what
    This command shifts the view in the window left or right according to number and what. Number must be an integer. What must be either units or pages. If what is units, the view adjusts left or right by number average-width characters on the display; if it is pages then the view adjusts by number screenfuls. If number is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible.

    VALIDATION

    The -validate, -validatecommand, and -invalidcommand options are used to enable entry widget validation.

    VALIDATION MODES

    There are two main validation modes: prevalidation, in which the -validatecommand is evaluated prior to each edit and the return value is used to determine whether to accept or reject the change; and revalidation, in which the -validatecommand is evaluated to determine whether the current value is valid.

    The -validate option determines when validation occurs; it may be set to any of the following values:

    none
    Default. This means validation will only occur when specifically requested by the validate widget command.
    key
    The entry will be prevalidated prior to each edit (specifically, whenever the insert or delete widget commands are called). If prevalidation fails, the edit is rejected.
    focus
    The entry is revalidated when the entry receives or loses focus.
    focusin
    The entry is revalidated when the entry receives focus.
    focusout
    The entry is revalidated when the entry loses focus.
    all
    Validation is performed for all above conditions.

    The -invalidcommand is evaluated whenever the -validatecommand returns a false value.

    The -validatecommand and -invalidcommand may modify the entry widget's value via the widget insert or delete commands, or by setting the linked -textvariable. If either does so during prevalidation, then the edit is rejected regardless of the value returned by the -validatecommand.

    If -validatecommand is empty (the default), validation always succeeds.

    VALIDATION SCRIPT SUBSTITUTIONS

    It is possible to perform percent substitutions on the -validatecommand and invalidCommand, just as in a bind script. The following substitutions are recognized:

    %d
    Type of action: 1 for insert prevalidation, 0 for delete prevalidation, or -1 for revalidation.
    %i
    Index of character string to be inserted/deleted, if any, otherwise -1.
    %P
    In prevalidation, the new value of the entry if the edit is accepted. In revalidation, the current value of the entry.
    %s
    The current value of entry prior to editing.
    %S
    The text string being inserted/deleted, if any, {} otherwise.
    %v
    The current value of the -validate option.
    %V
    The validation condition that triggered the callback (key, focusin, focusout, or forced).
    %W
    The name of the entry widget.

    DIFFERENCES FROM TK ENTRY WIDGET VALIDATION

    • The standard Tk entry widget automatically disables validation (by setting -validate to none) if the -validatecommand or -invalidcommand modifies the entry's value. The Tile entry widget only disables validation if one of the validation scripts raises an error, or if -validatecommand does not return a valid boolean value. (Thus, it is not necessary to reenable validation after modifying the entry value in a validation script).
    • The standard entry widget invokes validation whenever the linked -textvariable is modified; the Tile entry widget does not.

    DEFAULT BINDINGS

    The entry widget's default bindings enable the following behavior. In the descriptions below, ``word'' refers to a contiguous group of letters, digits, or ``_'' characters, or any single character other than these.

    • Clicking mouse button 1 positions the insert cursor just before the character underneath the mouse cursor, sets the input focus to this widget, and clears any selection in the widget. Dragging with mouse button 1 down strokes out a selection between the insert cursor and the character under the mouse.
    • Double-clicking with mouse button 1 selects the word under the mouse and positions the insert cursor at the end of the word. Dragging after a double click strokes out a selection consisting of whole words.
    • Triple-clicking with mouse button 1 selects all of the text in the entry and positions the insert cursor at the end of the line.
    • The ends of the selection can be adjusted by dragging with mouse button 1 while the Shift key is down. If the button is double-clicked before dragging then the selection will be adjusted in units of whole words.
    • Clicking mouse button 1 with the Control key down will position the insert cursor in the entry without affecting the selection.
    • If any normal printing characters are typed in an entry, they are inserted at the point of the insert cursor.
    • The view in the entry can be adjusted by dragging with mouse button 2. If mouse button 2 is clicked without moving the mouse, the selection is copied into the entry at the position of the mouse cursor.
    • If the mouse is dragged out of the entry on the left or right sides while button 1 is pressed, the entry will automatically scroll to make more text visible (if there is more text off-screen on the side where the mouse left the window).
    • The Left and Right keys move the insert cursor one character to the left or right; they also clear any selection in the entry. If Left or Right is typed with the Shift key down, then the insertion cursor moves and the selection is extended to include the new character. Control-Left and Control-Right move the insert cursor by words, and Control-Shift-Left and Control-Shift-Right move the insert cursor by words and also extend the selection. Control-b and Control-f behave the same as Left and Right, respectively.
    • The Home key and Control-a move the insert cursor to the beginning of the entry and clear any selection in the entry. Shift-Home moves the insert cursor to the beginning of the entry and extends the selection to that point.
    • The End key and Control-e move the insert cursor to the end of the entry and clear any selection in the entry. Shift-End moves the cursor to the end and extends the selection to that point.
    • Control-/ selects all the text in the entry.
    • Control-\ clears any selection in the entry.
    • The standard Tk <<Cut>>, <<Copy>>, <<Paste>>, and <<Clear>> virtual events operate on the selection in the expected manner.
    • The Delete key deletes the selection, if there is one in the entry. If there is no selection, it deletes the character to the right of the insert cursor.
    • The BackSpace key and Control-h delete the selection, if there is one in the entry. If there is no selection, it deletes the character to the left of the insert cursor.
    • Control-d deletes the character to the right of the insert cursor.
    • Control-k deletes all the characters to the right of the insertion cursor.

    WIDGET STATES

    In the disabled state, the entry cannot be edited and the text cannot be selected. In the readonly state, no insert cursor is displayed and the entry cannot be edited (specifically: the insert and delete commands have no effect). The disabled state is the same as readonly, and in addition text cannot be selected.

    Note that changes to the linked -textvariable will still be reflected in the entry, even if it is disabled or readonly.

    Typically, the text is "grayed-out" in the disabled state, and a different background is used in the readonly state.

    The entry widget sets the invalid state if revalidation fails, and clears it whenever validation succeeds.

    KEYWORDS

    entry, widget, text field

    tile-0.8.2/doc/html/frame.html0000644000076500007650000001157710731273213015547 0ustar joejoe00000000000000 Tile package reference: frame

    NAME

    ttk::frame -
    Simple container widget

    SYNOPSIS

    ttk::frame pathName ?options?
    

    DESCRIPTION

    A frame widget is a container, used to group other widgets together.

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -borderwidthborderWidthBorderWidth
     The desired width of the widget border. Defaults to 0.
    -reliefreliefRelief
     One of the standard Tk border styles: flat, groove, raised, ridge, solid, or sunken. Defaults to flat.
    -paddingpaddingPadding
     Additional padding to include inside the border.
    -widthwidthWidth
     If specified, the widget's requested width in pixels.
    -heightheightHeight
     If specified, the widget's requested height in pixels.

    WIDGET COMMAND

    Supports the standard widget commands configure, cget, instate, and state; see widget(n).

    NOTES

    Note that if the pack, grid, or other geometry managers are used to manage the children of the frame, by the GM's requested size will normally take precedence over the frame widget's -width and -height options. [pack propagate] and [grid propagate] can be used to change this.

    SEE ALSO

    widget(n), labelframe(n)

    KEYWORDS

    widget, frame, container

    tile-0.8.2/doc/html/Geometry.html0000644000076500007650000004356310731273213016250 0ustar joejoe00000000000000 Tile package reference: Geometry

    NAME

    geometry: Ttk_MakeBox, Ttk_PadBox, Ttk_ExpandBox, Ttk_PackBox, Ttk_StickBox, Ttk_PlaceBox, Ttk_BoxContains, Ttk_MakePadding, Ttk_UniformPadding, Ttk_AddPadding, Ttk_RelievePadding, Ttk_GetPaddingFromObj, Ttk_GetBorderFromObj, Ttk_GetStickyFromObj -
    Geometry utilities

    SYNOPSIS

    #include <tkTheme.h>
    
    Ttk_Box
    Ttk_MakeBox(int x, int y, int width, int height);
    
    Ttk_Box
    Ttk_PadBox(Ttk_Box parcel, Ttk_Padding padding);
    
    Ttk_Box
    Ttk_ExpandBox(Ttk_Box parcel, Ttk_Padding padding);
    
    Ttk_Box
    Ttk_PackBox(Ttk_Box *cavity, int width, int height, Ttk_Side side);
    
    Ttk_Box
    Ttk_StickBox(Ttk_Box parcel, int width, int height, unsigned sticky);
    
    Ttk_Box
    Ttk_PlaceBox(Ttk_Box *cavity, int width, int height, Ttk_Side side, unsigned sticky);
    
    Ttk_Box
    Ttk_AnchorBox(Ttk_Box parcel, int width, int height, Tk_Anchor anchor);
    
    Ttk_Padding
    Ttk_MakePadding(short left, short top, short right, short bottom);
    
    Ttk_Padding
    Ttk_UniformPadding(short border);
    
    Ttk_Padding
    Ttk_AddPadding(Ttk_Padding padding1, Ttk_Padding padding2;
    
    Ttk_Padding 
    Ttk_RelievePadding(Ttk_Padding padding, int relief);
    
    int
    Ttk_BoxContains(Ttk_Box box, int x, int y);
    
    int
    Ttk_GetPaddingFromObj(
        Tcl_Interp *interp, Tk_Window tkwin,
        Tcl_Obj *objPtr, Ttk_Padding *padding_rtn);
    
    int
    Ttk_GetBorderFromObj(
        Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *padding_rtn);
    
    int
    Ttk_GetStickyFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *sticky_rtn);
    

    ARGUMENTS

    TypeNameMode
    Tk_Anchoranchorin
     One of the symbolic constants TK_ANCHOR_N, TK_ANCHOR_NE, etc. See Tk_GetAnchorFromObj(3).
    Ttk_Box *cavityin/out
     A rectangular region from which a parcel is allocated.
    shortborderin
     Extra padding (in pixels) to add uniformly to each side of a region.
    shortbottomin
     Extra padding (in pixels) to add to the bottom of a region.
    Ttk_Boxboxin
     
    Ttk_Box *box_rtnout
     Specifies a rectangular region.
    intheightin
     The height in pixels of a region.
    Tcl_Interp *interpin
     Used to store error messages.
    intleftin
     Extra padding (in pixels) to add to the left side of a region.
    Tcl_Obj *objPtrin
     String value contains a symbolic name to be converted to an enumerated value or bitmask. Internal rep may be be modified to cache corresponding value.
    Ttk_Paddingpaddingin
     
    Ttk_Padding *padding_rtnout
     Extra padding to add on the inside of a region.
    Ttk_Boxparcelin
     A rectangular region, allocated from a cavity.
    intreliefin
     One of the standard Tk relief options (TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, etc.). See Tk_GetReliefFromObj.
    shortrightin
     Extra padding (in pixles) to add to the right side of a region.
    Ttk_Sidesidein
     One of TTK_SIDE_LEFT, TTK_SIDE_TOP, TTK_SIDE_RIGHT, or TTK_SIDE_BOTTOM.
    unsignedstickyin
     A bitmask containing one or more of the bits TTK_STICK_W (west, or left), TTK_STICK_E (east, or right, TTK_STICK_N (north, or top), and TTK_STICK_S (south, or bottom). TTK_FILL_X is defined as a synonym for (TTK_STICK_W|TTK_STICK_E), TTK_FILL_Y is a synonym for (TTK_STICK_N|TTK_STICK_S), and TTK_FILL_BOTH and TTK_STICK_ALL are synonyms for (TTK_FILL_X|TTK_FILL_Y). See also: grid(n).
    Tk_Windowtkwinin
     Window whose screen geometry determines the conversion between absolute units and pixels.
    shorttopin
     Extra padding at the top of a region.
    intwidthin
     The width in pixels of a region.
    intxin
     X coordinate of upper-left corner of region.
    intyin
     Y coordinate of upper-left corner of region.

    BOXES

    The Ttk_Box structure represents a rectangular region of a window:

     
    typedef struct 	{
        int x;
        int y;
        int width;
        int height;
    } Ttk_Box;
    

    All coordinates are relative to the window.

    Ttk_MakeBox is a convenience routine that contsructs a Ttk_Box structure representing a region width pixels wide, height pixels tall, at the specified x, y coordinates.

    Ttk_PadBox returns a new box located inside the specified parcel, shrunken according to the left, top, right, and bottom margins specified by padding.

    Ttk_ExpandBox is the inverse of Ttk_PadBox: it returns a new box surrounding the specified parcel, expanded according to the left, top, right, and bottom margins specified by padding.

    Ttk_PackBox allocates a parcel width by height pixels wide on the specified side of the cavity, and shrinks the cavity accordingly.

    Ttk_StickBox places a box with the requested width and height inside the parcel according to the sticky bits.

    Ttk_PlaceBox combines Ttk_PackBox and Ttk_StickBox: it allocates a parcel on the specified side of the cavity, places a box of the requested size inside the parcel according to sticky, and shrinks the cavity.

    Ttk_AnchorBox places a box with the requested width and height inside the parcel according to the specified anchor option.

    Ttk_BoxContains tests if the specified x, y coordinate lies within the rectangular region box.

    PADDDING

    The Ttk_Padding structure is used to represent borders, internal padding, and external margins:

     
    typedef struct {
        short left;
        short top;
        short right;
        short bottom;
    } Ttk_Padding;
    

    Ttk_MakePadding is a convenience routine that contsructs a Ttk_Padding structure with the specified left, top, right, and bottom components.

    Ttk_UniformPadding constructs a Ttk_Padding structure with all components equal to the specified border.

    Ttk_AddPadding adds two Ttk_Paddings together and returns a combined padding containing the sum of the individual padding components.

    Ttk_RelievePadding adds an extra 2 pixels of padding to padding according to the specified relief. If relief is TK_RELIEF_SUNKEN, adds two pixels at the top and left so the inner region is shifted down and to the left. If it is TK_RELIEF_RAISED, adds two pixels at the bottom and right so the inner region is shifted up and to the right. Otherwise, adds 1 pixel on all sides. This is typically used in element geometry procedures to simulate a "pressed-in" look for pushbuttons.

    CONVERSION ROUTINES

    Ttk_GetPaddingFromObj converts the string in objPtr to a Ttk_Padding structure. The string representation is a list of up to four length specifications "left top right bottom". If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left. See Tk_GetPixelsFromObj(3) for the syntax of length specifications.

    Ttk_GetBorderFromObj is the same as Ttk_GetPaddingFromObj except that the lengths are specified as integers (i.e., resolution-dependant values like 3m are not allowed).

    Ttk_GetStickyFromObj converts the string in objPtr to a sticky bitmask. The string contains zero or more of the characters n, s, e, or w.

    SEE ALSO

    Tk_GetReliefFromObj(3), Tk_GetPixelsFromObj(3), Tk_GetAnchorFromObj(3)

    KEYWORDS

    geometry, padding, margins, box, region, sticky, relief

    tile-0.8.2/doc/html/image.html0000644000076500007650000000773610731273213015541 0ustar joejoe00000000000000 Tile package reference: image

    NAME

    ttk_image -
    Define an element based on an image

    SYNOPSIS

    style element create name image imageSpec ?options?
    

    DESCRIPTION

    The image element factory creates a new element in the current theme whose visual appearance is determined by Tk images. imageSpec is a list of one or more elements. The first element is the default image name. The rest of the list is a sequence of statespec / value pairs specifying other images to use when the element is in a particular state or combination of states.

    OPTIONS

    Valid options are:

    -border padding
    padding is a list of up to four integers, specifying the left, top, right, and bottom borders, respectively. See IMAGE STRETCHING, below.
    -height height
    Specifies a minimum height for the element. If less than zero, the base image's height is used as a default.
    -padding padding
    Specifies the element's interior padding. Defaults to -border if not specified.
    -sticky spec
    Specifies how the image is placed within the final parcel. spec contains zero or more characters "n", "s", "w", or "e".
    -width width
    Specifies a minimum width for the element. If less than zero, the base image's width is used as a default.

    IMAGE STRETCHING

    If the element's allocated parcel is larger than the image, the image will be placed in the parcel based on the -sticky option. If the image needs to stretch horizontally (i.e., -sticky ew) or vertically (-sticky ns), subregions of the image are replicated to fill the parcel based on the -border option. The -border divides the image into 9 regions: four fixed corners, top and left edges (which may be tiled horizontally), left and right edges (which may be tiled vertically), and the central area (which may be tiled in both directions).

    EXAMPLE

    set img1 [image create photo -file button.png]
    set img2 [image create photo -file button-pressed.png]
    set img3 [image create photo -file button-active.png]
    style element create Button.button image \
        [list $img1  pressed $img2  active $img3] \
       -border {2 4} -sticky we
    

    SEE ALSO

    image(n), photo(n)

    KEYWORDS

    pixmap theme, image

    tile-0.8.2/doc/html/labelframe.html0000644000076500007650000001402210731273213016533 0ustar joejoe00000000000000 Tile package reference: labelframe

    NAME

    ttk::labelframe -
    Container widget with optional label

    SYNOPSIS

    ttk::labelframe pathName ?options?
    

    DESCRIPTION

    A labelframe widget is a container used to group other widgets together. It has an optional label, which may be a plain text string or another widget.

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -labelanchorlabelAnchorLabelAnchor
     Specifies where to place the label. Allowed values are (clockwise from the top upper left corner): nw, n, ne, en, e, es, se, s,sw, ws, w and wn. The default value is theme-dependent.
    -texttextText
     Specifies the text of the label.
    -underlineunderlineUnderline
     If set, specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation (see keynav(n)). Mnemonic activation for a ttk::labelframe sets the keyboard focus to the first child of the ttk::labelframe widget.
    -paddingpaddingPadding
     Additional padding to include inside the border.
    -labelwidgetlabelWidgetLabelWidget
     The name of a widget to use for the label. If set, overrides the -text option. The -labelwidget must be a child of the labelframe widget or one of the labelframe's ancestors, and must belong to the same top-level widget as the labelframe.
    -widthwidthWidth
     If specified, the widget's requested width in pixels.
    -heightheightHeight
     If specified, the widget's requested height in pixels. (See ttk::frame for further notes on -width and -height).

    WIDGET COMMAND

    Supports the standard widget commands configure, cget, instate, and state; see widget(n).

    SEE ALSO

    widget(n), frame(n)

    KEYWORDS

    widget, frame, container, label, groupbox

    tile-0.8.2/doc/html/label.html0000644000076500007650000001617510731273213015533 0ustar joejoe00000000000000 Tile package reference: label

    NAME

    ttk::label -
    Display a text string and/or image

    SYNOPSIS

    ttk::label pathName ?options?
    

    DESCRIPTION

    A label widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text.

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -anchoranchorAnchor
     Specifies how the information in the widget is positioned relative to the inner margins. Legal values are n, ne, e, se, s, sw, w, nw, and center. See also -justify.
    -backgroundframeColorFrameColor
     The widget's background color. If unspecified, the theme default is used.
    -fontfontFont
     Font to use for label text.
    -foregroundtextColorTextColor
     The widget's foreground color. If unspecified, the theme default is used.
    -justifyjustifyJustify
     If there are multiple lines of text, specifies how the lines are laid out relative to one another. One of left, center, or right. See also -anchor.
    -paddingpaddingPadding
     Specifies the amount of extra space to allocate for the widget. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left.
    -reliefreliefRelief
     Specifies the 3-D effect desired for the widget border. Valid values are flat, groove, raised, ridge, solid, and sunken.
    -texttextText
     Specifies a text string to be displayed inside the widget (unless overridden by -textvariable).
    -wraplengthwrapLengthWrapLength
     Specifies the maximum line length (in pixels). If this option is less than or equal to zero, then automatic wrapping is not performed; otherwise the text is split into lines such that no line is longer than the specified value.

    WIDGET COMMAND

    pathName cget option
    pathName configure ?option? ?value option value ...?
    pathName instate statespec ?script?
    pathName state ?stateSpec?
    See widget(n)

    SEE ALSO

    widget(n)

    tile-0.8.2/doc/html/menubutton.html0000644000076500007650000001020010731273213016633 0ustar joejoe00000000000000 Tile package reference: menubutton

    NAME

    ttk::menubutton -
    Widget that pops down a menu when pressed

    SYNOPSIS

    ttk::menubutton pathName ?options?
    

    DESCRIPTION

    A menubutton widget displays a textual label and/or image, and displays a menu when pressed.

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -directiondirectionDirection
     Specifies where the menu is to be popped up relative to the menubutton. One of: above, below, left, right, or flush. The default is below. flush pops the menu up directly over the menubutton.
    -menumenuMenu
     Specifies the path name of the menu associated with the menubutton. To be on the safe side, the menu ought to be a direct child of the menubutton.

    WIDGET COMMAND

    Menubutton widgets support the standard cget, configure, instate, and state methods. No other widget methods are used.

    SEE ALSO

    widget(n), keynav(n), menu(n)

    KEYWORDS

    widget, button, menu

    tile-0.8.2/doc/html/notebook.html0000644000076500007650000003102210731273213016260 0ustar joejoe00000000000000 Tile package reference: notebook

    NAME

    ttk::notebook -
    Multi-paned container widget

    SYNOPSIS

    ttk::notebook pathName ?options...?
    
    pathName add window ?options...?
    pathName insert index window ?options...?
    

    DESCRIPTION

    A ttk::notebook widget manages a collection of windows and displays a single one at a time. Each slave window is associated with a tab, which the user may select to change the currently-displayed window.

    STANDARD OPTIONS

    WIDGET OPTIONS

    NameDatabase nameDatabase class
    -heightheightHeight
     If present and greater than zero, specifies the desired height of the pane area (not including internal padding or tabs). Otherwise, the maximum height of all panes is used.
    -paddingpaddingPadding
     Specifies the amount of extra space to add around the outside of the notebook. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left.
    -widthwidthWidth
     If present and greater than zero, specifies the desired width of the pane area (not including internal padding). Otherwise, the maximum width of all panes is used.

    TAB OPTIONS

    The following options may be specified for individual notebook panes:

    NameDatabase nameDatabase class
    -statestateState
     Either normal, disabled or hidden. If disabled, then the tab is not selectable. If hidden, then the tab is not shown.
    -stickystickySticky
     Specifies how the slave window is positioned within the pane area. Value is a string containing zero or more of the characters n, s, e, or w. Each letter refers to a side (north, south, east, or west) that the slave window will "stick" to, as per the grid geometry manager.
    -paddingpaddingPadding
     Specifies the amount of extra space to add between the notebook and this pane. Syntax is the same as for the widget -padding option.
    -texttextText
     Specifies a string to be displayed in the tab.
    -imageimageImage
     Specifies an image to display in the tab. See widget(n) for details.
    -compoundcompoundCompound
     Specifies how to display the image relative to the text, in the case both -text and -image are present. See label(n) for legal values.
    -underlineunderlineUnderline
     Specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation if ttk::notebook::enableTraversal is called.

    WIDGET COMMAND

    pathname add window ?options...?
    Adds a new tab to the notebook. See TAB OPTIONS for the list of available options. If window is currently managed by the notebook but hidden, it is restored to its previous position.
    pathname configure ?options?
    See widget(n).
    pathname cget option
    See widget(n).
    pathname forget tabid
    Removes the tab specified by tabid, unmaps and unmanages the associated window.
    pathname hide tabid
    Hides the tab specified by tabid. The tab will not be displayed, but the associated window remains managed by the notebook and its configuration remembered. Hidden tabs may be restored with the add command.
    pathname index tabid
    Returns the numeric index of the tab specified by tabid, or the total number of tabs if tabid is the string "end".
    pathname insert pos subwindow options...
    Inserts a pane at the specified position. pos is either the string end, an integer index, or the name of a managed subwindow. If subwindow is already managed by the notebook, moves it to the specified position. See TAB OPTIONS for the list of available options.
    pathname instate statespec ?script...?
    See widget(n).
    pathname select ?tabid?
    Selects the specified tab. The associated slave window will be displayed, and the previously-selected window (if different) is unmapped. If tabid is omitted, returns the widget name of the currently selected pane.
    pathname state ?statespec?
    See widget(n).
    pathname tab tabid ?-option ?value ...
    Query or modify the options of the specific tab. If no -option is specified, returns a dictionary of the tab option values. If one -option is specified, returns the value of that option. Otherwise, sets the -options to the corresponding values. See TAB OPTIONS for the available options.
    pathname tabs
    Returns the list of windows managed by the notebook.

    KEYBOARD TRAVERSAL

    To enable keyboard traversal for a toplevel window containing a notebook widget $nb, call:

    ttk::notebook::enableTraversal $nb
    

    This will extend the bindings for the toplevel window containing the notebook as follows:

    • Control-Tab selects the tab following the currently selected one.
    • Shift-Control-Tab selects the tab preceding the currently selected one.
    • Alt-K, where K is the mnemonic (underlined) character of any tab, will select that tab.

    Multiple notebooks in a single toplevel may be enabled for traversal, including nested notebooks. However, notebook traversal only works properly if all panes are direct children of the notebook.

    TAB IDENTIFIERS

    The tabid argument to the above commands may take any of the following forms:

    • An integer between zero and the number of tabs;
    • The name of a slave window;
    • A positional specification of the form "@x,y", which identifies the tab
    • The literal string "current", which identifies the currently-selected tab; or:
    • The literal string "end", which returns the number of tabs (only valid for "pathname index").

    VIRTUAL EVENTS

    The notebook widget generates a <<NotebookTabChanged>> virtual event after a new tab is selected.

    EXAMPLE

    notebook .nb
    .nb add [frame .nb.f1] -text "First tab"
    .nb add [frame .nb.f2] -text "Second tab"
    .nb select .nb.f2
    ttk::notebook::enableTraversal .nb
    

    SEE ALSO

    widget(n), grid(n)

    KEYWORDS

    pane, tab

    tile-0.8.2/doc/html/paned.html0000644000076500007650000001611510731273213015535 0ustar joejoe00000000000000 Tile package reference: panedwindow

    NAME

    ttk::panedwindow -
    Multi-pane container window

    SYNOPSIS

    ttk::panedwindow pathName ?options?
    
    pathName add window ?options...?
    pathName insert index window ?options...?
    

    DESCRIPTION

    A panedwindow widget displays a number of subwindows, stacked either vertically or horizontally. The user may adjust the relative sizes of the subwindows by dragging the sash between panes.

    STANDARD OPTIONS

    WIDGET OPTIONS

    NameDatabase nameDatabase class
    -orientorientOrient
     Specifies the orientation of the window. If vertical, subpanes are stacked top-to-bottom; if horizontal, subpanes are stacked left-to-right.
    -widthwidthWidth
     If present and greater than zero, specifies the desired width of the widget in pixels. Otherwise, the requested width is determined by the width of the managed windows.
    -heightheightHeight
     If present and greater than zero, specifies the desired height of the widget in pixels. Otherwise, the requested height is determined by the height of the managed windows.

    PANE OPTIONS

    The following options may be specified for each pane:

    NameDatabase nameDatabase class
    -weightweightWeight
     An integer specifying the relative stretchability of the pane. When the panedwindow is resized, the extra space is added or subtracted to each pane proportionally to its -weight.

    WIDGET COMMAND

    Supports the standard configure, cget, state, and instate commands; see widget(n) for details. Additional commands:

    pathname add subwindow options...
    Adds a new pane to the window. subwindow must be a direct child of the panedwindow pathname. See PANE OPTIONS for the list of available options.
    pathname forget pane
    Removes the specified subpane from the widget. pane is either an integer index or the name of a managed subwindow.
    pathname insert pos subwindow options...
    Inserts a pane at the specified position. pos is either the string end, an integer index, or the name of a managed subwindow. If subwindow is already managed by the panedwindow, moves it to the specified position. See PANE OPTIONS for the list of available options.
    pathname pane pane -option ?value ?-option value...
    Query or modify the options of the specified pane, where pane is either an integer index or the name of a managed subwindow. If no -option is specified, returns a dictionary of the pane option values. If one -option is specified, returns the value of that option. Otherwise, sets the -options to the corresponding values.
    pathname panes
    Returns the list of all windows managed by the widget.
    pathname sashpos index ?newpos?
    If newpos is specified, sets the position of sash number index. May adjust the positions of adjacent sashes to ensure that positions are monotonically increasing. Sash positions are further constrained to be between 0 and the total size of the widget. Returns the new position of sash number index.
    pathname identify x y
    Returns the index of the sash at point x,y, or the empty string if x,y is not over a sash.

    SEE ALSO

    widget(n), notebook(n)

    tile-0.8.2/doc/html/progressbar.html0000644000076500007650000001535110731273213017000 0ustar joejoe00000000000000 Tile package reference: progressbar

    NAME

    ttk::progressbar -
    Provide progress feedback

    SYNOPSIS

    ttk::progressbar pathName ?options?
    

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -orientorientOrient
     One of horizontal or vertical. Specifies the orientation of the progress bar.
    -lengthlengthLength
     Specifies the length of the long axis of the progress bar (width if horizontal, height if vertical).
    -modemodeMode
     One of determinate or indeterminate.
    -maximummaximumMaximum
     A floating point number specifying the maximum -value. Defaults to 100.
    -valuevalueValue
     The current value of the progress bar. In determinate mode, this represents the amount of work completed. In indeterminate mode, it is interpreted modulo -maximum; that is, the progress bar completes one "cycle" when the -value increases by -maximum.
    -variablevariableVariable
     The name of a Tcl variable which is linked to the -value. If specified, the -value of the progress bar is automatically set to the value of the variable whenever the latter is modified.
    -phasephasePhase
     Read-only option. The widget periodically increments the value of this option whenever the -value is greater than 0 and, in determinate mode, less than -maximum. This option may be used by the current theme to provide additional animation effects.

    DESCRIPTION

    A progress bar widget shows the status of a long-running operation. They can operate in two modes: determinate mode shows the amount completed relative to the total amount of work to be done, and indeterminate mode provides an animated display to let the user know that something is happening.

    WIDGET COMMAND

    pathName cget option
    Returns the current value of the specified option; see widget(n).
    pathName configure ?option? ?value option value ...?
    Modify or query widget options; see widget(n).
    pathName instate statespec ?script?
    Test the widget state; see widget(n).
    pathName start ?interval?
    Begin autoincrement mode: schedules a recurring timer event that calls step every interval milliseconds. If omitted, interval defaults to 50 milliseconds (20 steps/second).
    pathName state ?stateSpec?
    Modify or query the widget state; see widget(n).
    pathName step ?amount?
    Increments the -value by amount. amount defaults to 1.0 if omitted.
    pathName stop
    Stop autoincrement mode: cancels any recurring timer event initiated by pathName start.

    SEE ALSO

    widget(n)

    tile-0.8.2/doc/html/radiobutton.html0000644000076500007650000001241710731273213017001 0ustar joejoe00000000000000 Tile package reference: radiobutton

    NAME

    ttk::radiobutton -
    Mutually exclusive option widget

    SYNOPSIS

    ttk::radiobutton pathName ?options?
    

    DESCRIPTION

    radiobutton widgets are used in groups to show or change a set of mutually-exclusive options. Radiobuttons are linked to a Tcl variable, and have an associated value; when a radiobutton is clicked, it sets the variable to its associated value.

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -commandcommandCommand
     A Tcl script to evaluate whenever the widget is invoked.
    -valueValueValue
     The value to store in the associated -variable when the widget is selected.
    -variablevariableVariable
     The name of a global variable whose value is linked to the widget. Default value is ::selectedButton.

    WIDGET COMMAND

    In addition to the standard cget, configure, instate, and state commands, radiobuttons support the following additional widget commands:

    pathname invoke
    Sets the -variable to the -value, selects the widget, and evaluates the associated -command. Returns the result of the -command, or the empty string if no -command is specified.

    WIDGET STATES

    The widget does not respond to user input if the disabled state is set. The widget sets the selected state whenever the linked -variable is set to the widget's -value, and clears it otherwise. The widget sets the alternate state whenever the linked -variable is unset. (The alternate state may be used to indicate a ``tri-state'' or ``indeterminate'' selection.)

    SEE ALSO

    widget(n), keynav(n), checkbutton(n)

    KEYWORDS

    widget, button, option

    tile-0.8.2/doc/html/scrollbar.html0000644000076500007650000002302510731273213016427 0ustar joejoe00000000000000 Tile package reference: scrollbar

    NAME

    ttk::scrollbar -
    Control the viewport of a scrollable widget

    SYNOPSIS

    ttk::scrollbar pathName ?options...?
    

    STANDARD OPTIONS

    WIDGET-SPECIFIC OPTIONS

    NameDatabase nameDatabase class
    -commandcommandCommand
     A Tcl script prefix to evaluate to change the view in the widget associated with the scrollbar. Additional arguments are appended to the value of this option, as described in SCROLLING COMMANDS below, whenever the user requests a view change by manipulating the scrollbar.
    This option typically consists of a two-element list, containing the name of a scrollable widget followed by either xview (for horizontal scrollbars) or yview (for vertical scrollbars).
    -orientorientOrient
     One of horizontal or vertical. Specifies the orientation of the scrollbar.

    DESCRIPTION

    Scrollbar widgets are typically linked to an associated window that displays a document of some sort, such as a file being edited or a drawing. A scrollbar displays a thumb in the middle portion of the scrollbar, whose position and size provides information about the portion of the document visible in the associated window. The thumb may be dragged by the user to control the visible region. Depending on the theme, two or more arrow buttons may also be present; these are used to scroll the visible region in discrete units.

    WIDGET COMMAND

    pathName cget option
    Returns the current value of the specified option; see widget(n).
    pathName configure ?option? ?value option value ...?
    Modify or query widget options; see widget(n).
    pathName get
    Returns the scrollbar settings in the form of a list whose elements are the arguments to the most recent set widget command.
    pathName instate statespec ?script?
    Test the widget state; see widget(n).
    pathName set first last
    This command is normally invoked by the scrollbar's associated widget from an -xscrollcommand or -yscrollcommand callback. Specifies the visible range to be displayed. first and last are real fractions between 0 and 1.
    pathName state ?stateSpec?
    Modify or query the widget state; see widget(n).

    INTERNAL COMMANDS

    The following widget commands are used internally by the TScrollbar widget class bindings.

    pathName delta deltaX deltaY
    Returns a real number indicating the fractional change in the scrollbar setting that corresponds to a given change in thumb position. For example, if the scrollbar is horizontal, the result indicates how much the scrollbar setting must change to move the thumb deltaX pixels to the right (deltaY is ignored in this case). If the scrollbar is vertical, the result indicates how much the scrollbar setting must change to move the thumb deltaY pixels down. The arguments and the result may be zero or negative.
    pathName fraction x y
    Returns a real number between 0 and 1 indicating where the point given by x and y lies in the trough area of the scrollbar, where 0.0 corresponds to the top or left of the trough and 1.0 corresponds to the bottom or right. X and y are pixel coordinates relative to the scrollbar widget. If x and y refer to a point outside the trough, the closest point in the trough is used.
    pathName identify x y
    Returns the name of the element under the point given by x and y, or an empty string if the point does not lie in any element of the scrollbar. X and y are pixel coordinates relative to the scrollbar widget.

    SCROLLING COMMANDS

    When the user interacts with the scrollbar, for example by dragging the thumb, the scrollbar notifies the associated widget that it must change its view. The scrollbar makes the notification by evaluating a Tcl command generated from the scrollbar's -command option. The command may take any of the following forms. In each case, prefix is the contents of the -command option, which usually has a form like .t yview

    prefix moveto fraction
    Fraction is a real number between 0 and 1. The widget should adjust its view so that the point given by fraction appears at the beginning of the widget. If fraction is 0 it refers to the beginning of the document. 1.0 refers to the end of the document, 0.333 refers to a point one-third of the way through the document, and so on.
    prefix scroll number units
    The widget should adjust its view by number units. The units are defined in whatever way makes sense for the widget, such as characters or lines in a text widget. Number is either 1, which means one unit should scroll off the top or left of the window, or -1, which means that one unit should scroll off the bottom or right of the window.
    prefix scroll number pages
    The widget should adjust its view by number pages. It is up to the widget to define the meaning of a page; typically it is slightly less than what fits in the window, so that there is a slight overlap between the old and new views. Number is either 1, which means the next page should become visible, or -1, which means that the previous page should become visible.

    WIDGET STATES

    The scrollbar automatically sets the disabled state bit. when the entire range is visible (range is 0.0 to 1.0), and clears it otherwise. It also sets the active and pressed state flags of individual elements, based on the position and state of the mouse pointer.

    EXAMPLE

    set f [frame .f]
    ttk::scrollbar $f.hsb -orient horizontal -command [list $f.t xview]
    ttk::scrollbar $f.vsb -orient vertical -command [list $f.t yview]
    text $f.t -xscrollcommand [list $f.hsb set] -yscrollcommand [list $f.vsb set] 
    grid $f.t -row 0 -column 0 -sticky nsew
    grid $f.vsb -row 0 -column 1 -sticky nsew
    grid $f.hsb -row 1 -column 0 -sticky nsew
    grid columnconfigure $f 0 -weight 1
    grid rowconfigure $f 0 -weight 1
    

    KEYWORDS

    scrollbar, widget

    tile-0.8.2/doc/html/separator.html0000644000076500007650000000574010731273213016450 0ustar joejoe00000000000000 Tile package reference: separator

    NAME

    ttk::separator -
    Separator bar

    SYNOPSIS

    ttk::separator pathName ?options?
    

    DESCRIPTION

    A separator widget displays a horizontal or vertical separator bar.

    STANDARD OPTIONS

    OPTIONS

    NameDatabase nameDatabase class
    -orientorientOrient
     One of horizontal or vertical. Specifies the orientation of the separator.

    WIDGET COMMAND

    Separator widgets support the standard cget, configure, instate, and state methods. No other widget methods are used.

    SEE ALSO

    widget(n)

    KEYWORDS

    widget, separator

    tile-0.8.2/doc/html/sizegrip.html0000644000076500007650000000724310731273213016304 0ustar joejoe00000000000000 Tile package reference: sizegrip

    NAME

    ttk::sizegrip -
    A silly widget

    SYNOPSIS

    ttk::sizegrip pathName ?options?
    

    DESCRIPTION

    A sizegrip widget (also known as a grow box) allows the user to resize the containing toplevel window by pressing and dragging the grip.

    STANDARD OPTIONS

    WIDGET COMMAND

    Sizegrip widgets support the standard cget, configure, instate, and state methods. No other widget methods are used.

    PLATFORM-SPECIFIC NOTES

    On Mac OSX, toplevel windows automatically include a built-in size grip by default. Adding an ttk::sizegrip there is harmless, since the built-in grip will just mask the widget.

    EXAMPLES

    # Using pack:
    pack [ttk::frame $top.statusbar] -side bottom -fill x
    pack [ttk::sizegrip $top.statusbar.grip] -side right -anchor se
    
    # Using grid:
    grid [ttk::sizegrip $top.statusbar.grip] \
        -row $lastRow -column $lastColumn -sticky se
    # ... optional: add vertical scrollbar in $lastColumn,
    # ... optional: add horizontal scrollbar in $lastRow
    

    BUGS

    If the containing toplevel's position was specified relative to the right or bottom of the screen (e.g., [wm geometry ... wxh-x-y] instead of [wm geometry ... wxh+x+y]), the sizegrip widget will not resize the window.

    ttk::sizegrip widgets only support "southeast" resizing.

    SEE ALSO

    widget(n)

    KEYWORDS

    widget, sizegrip, grow box

    tile-0.8.2/doc/html/style.html0000644000076500007650000001503210731273213015603 0ustar joejoe00000000000000 Tile package reference: style

    NAME

    ttk::style -
    Manipulate style database

    SYNOPSIS

    ttk::style option ?args?
    

    NOTES

    See also the Tcl'2004 conference presentation, available at http://tktable.sourceforge.net/tile/tile-tcl2004.pdf

    DEFINITIONS

    Each widget is assigned a style, which specifies the set of elements making up the widget and how they are arranged, along with dynamic and default settings for element options. By default, the style name is the same as the widget's class; this may be overridden by the -style option.

    A theme is a collection of elements and styles which controls the overall look and feel of an application.

    DESCRIPTION

    The ttk::style command takes the following arguments:

    ttk::style configure style ?-option ?value option value...? ?
    Sets the default value of the specified option(s) in style.
    ttk::style map style ?-option { statespec value... }?
    Sets dynamic values of the specified option(s) in style. Each statespec / value pair is examined in order; the value corresponding to the first matching statespec is used.
    ttk::style lookup style -option ?state ?default??
    Returns the value specified for -option in style style in state state, using the standard lookup rules for element options. state is a list of state names; if omitted, it defaults to all bits off (the ``normal'' state). If the default argument is present, it is used as a fallback value in case no specification for -option is found.
    ttk::style layout style ?layoutSpec?
    Define the widget layout for style style. See LAYOUTS below for the format of layoutSpec. If layoutSpec is omitted, return the layout specification for style style.
    ttk::style element create elementName type ?args...?
    Creates a new element in the current theme of type type. The only built-in element type is image (see image(n)), although themes may define other element types (see Ttk_RegisterElementFactory).
    ttk::style element names
    Returns the list of elements defined in the current theme.
    ttk::style element options element
    Returns the list of element's options.
    ttk::style theme create themeName ?-parent basedon? ?-settings script... ?
    Creates a new theme. It is an error if themeName already exists. If -parent is specified, the new theme will inherit styles, elements, and layouts from the parent theme basedon. If -settings is present, script is evaluated in the context of the new theme as per ttk::style theme settings.
    ttk::style theme settings themeName script
    Temporarily sets the current theme to themeName, evaluate script, then restore the previous theme. Typically script simply defines styles and elements, though arbitrary Tcl code may appear.
    ttk::style theme names
    Returns a list of all known themes.
    ttk::style theme use themeName
    Sets the current theme to themeName, and refreshes all widgets.

    LAYOUTS

    A layout specifies a list of elements, each followed by one or more options specifying how to arrange the element. The layout mechanism uses a simplified version of the pack geometry manager: given an initial cavity, each element is allocated a parcel. Valid options are:

    -side side
    Specifies which side of the cavity to place the element; one of left, right, top, or bottom. If omitted, the element occupies the entire cavity.
    -sticky [nswe]
    Specifies where the element is placed inside its allocated parcel.
    -children { sublayout... }
    Specifies a list of elements to place inside the element.

    For example:

    ttk::style layout Horizontal.TScrollbar {
        Scrollbar.trough -children {
            Scrollbar.leftarrow -side left
            Scrollbar.rightarrow -side right
            Horizontal.Scrollbar.thumb -side left -sticky ew
        }
    }
    

    SEE ALSO

    tile-intro, widget, pixmap

    KEYWORDS

    style, theme, appearance

    tile-0.8.2/doc/html/Theme.html0000644000076500007650000000607510731273213015514 0ustar joejoe00000000000000 Tile package reference: Ttk_CreateTheme

    NAME

    Ttk_CreateTheme, Ttk_GetTheme, Ttk_GetDefaultTheme, Ttk_GetCurrentTheme -
    create and use Themes.

    SYNOPSIS

    Ttk_Theme Ttk_CreateTheme(interp, name, parentTheme);
    Ttk_Theme Ttk_GetTheme(interp, name);
    Ttk_Theme Ttk_GetDefaultTheme(interp);
    Ttk_Theme Ttk_GetCurrentTheme(interp);
    

    ARGUMENTS

    TypeNameMode
    Tcl_Interp *interpin
     The Tcl interpreter in which to register/query available themes.
    Ttk_ThemeparentThemein
     Fallback or parent theme from which the new theme will inherit elements and layouts.
    const char *namein
     The name of the theme.

    DESCRIPTION

    SEE ALSO

    Ttk_RegisterLayout, Ttk_BuildLayout

    tile-0.8.2/doc/html/tile-intro.html0000644000076500007650000001701310731273213016532 0ustar joejoe00000000000000 Tile package reference: intro

    NAME

    tile_intro -
    Introduction to the Tile theme engine

    OVERVIEW

    The tile widget set is based on a revised and enhanced version of the TIP #48 style engine. The main concepts are described below. The basic idea is to separate, to the extent possible, the code implementing a widget's behavior from the code implementing its appearance. Widget class bindings are primarily responsible for maintaining the widget state and invoking callbacks; all aspects of the widgets appearance is

    THEMES

    A theme is a collection of elements and styles that determine the look and feel of the widget set. Themes can be used to:

    • Isolate platform differences (X11 vs. classic Windows vs. XP vs. Aqua ...)
    • Adapt to display limitations (low-color, grayscale, monochrome, tiny screens)
    • Accessibility (high contrast, large type)
    • Application suite branding
    • Blend in with the rest of the desktop (Gnome, KDE, Java)
    • And, of course: eye candy.

    ELEMENTS

    An element displays an individual part of a widget. For example, a vertical scrollbar widget contains uparrow, downarrow, trough and slider elements.

    Element names use a recursive dotted notation. For example, uparrow identifies a generic arrow element, and Scrollbar.uparrow and Combobox.uparrow identify widget-specific elements. When looking for an element, the style engine looks for the specific name first, and if an element of that name is not found it looks for generic elements by stripping off successive leading components of the element name.

    Like widgets, elements have options which specify what to display and how to display it. For example, the text element (which displays a text string) has -text, -font, -foreground, -background, -underline, and -width options. The value of an element option is taken from:

    • An option of the same name and type in the widget containing the element;
    • A dynamic setting specified by style map and the current state;
    • The default setting specified by style configure; or
    • The element's built-in default value for the option.

    LAYOUTS

    A layout specifies which elements make up a widget and how they are arranged. The layout engine uses a simplified version of the pack algorithm: starting with an initial cavity equal to the size of the widget, elements are allocated a parcel within the cavity along the side specified by the -side option, and placed within the parcel according to the -sticky option. For example, the layout for a horizontal scrollbar

    ttk::style layout Horizontal.TScrollbar {
        Scrollbar.trough -children {
    	Scrollbar.leftarrow -side left -sticky w
    	Scrollbar.rightarrow -side right -sticky e
    	Scrollbar.thumb -side left -expand true -sticky ew
        }
    }
    

    By default, the layout for a widget is the same as its class name. Some widgets may override this (for example, the ttk::scrollbar widget chooses different layouts based on the -orient option).

    STATES

    In standard Tk, many widgets have a -state option which (in most cases) is either normal or disabled. Some widgets support additional states, such as the entry widget which has a readonly state and the various flavors of buttons which have active state.

    The Tile widget set generalizes this idea: every widget has a bitmap of independent state flags. Widget state flags include active, disabled, pressed, focus, etc., (see widget(n) for the full list of state flags).

    Instead of a -state option, every widget now has a state widget command which is used to set or query the state. A state specification is a list of symbolic state names indicating which bits are set, each optionally prefixed with an exclamation point indicating that the bit is cleared instead.

    For example, the class bindings for the ttk::button widget are:

    bind TButton <Enter>		{ %W state active }
    bind TButton <Leave>		{ %W state !active }
    bind TButton <ButtonPress-1>	{ %W state pressed }
    bind TButton <Button1-Leave>	{ %W state !pressed }
    bind TButton <Button1-Enter>	{ %W state pressed }
    bind TButton <ButtonRelease-1>	\
        { %W instate {pressed} { %W state !pressed ; %W invoke } }
    

    This specifies that the widget becomes active when the pointer enters the widget, and inactive when it leaves. Similarly it becomes pressed when the mouse button is pressed, and !pressed on the ButtonRelease event. In addition, the button unpresses if pointer is dragged outside the widget while Button-1 is held down, and represses if it's dragged back in. Finally, when the mouse button is released, the widget's -command is invoked, but only if the button is currently in the pressed state. (The actual bindings are a little more complicated than the above, but not by much).

    Note to self: rewrite that paragraph. It's horrible.

    STYLES

    Each widget is associated with a style, which specifies values for element options. Style names use a recursive dotted notation like layouts and elements; by default, widgets use the class name to look up a style in the current theme. For example:

    ttk::style configure TButton \
    	-background #d9d9d9 \
    	-foreground black \
    	-relief raised \
    	;
    

    Many elements are displayed differently depending on the widget state. For example, buttons have a different background when they are active, a different foreground when disabled, and a different relief when pressed. The style map command specifies dynamic option settings for a particular style:

    ttk::style map TButton \
    	-background [list disabled #d9d9d9  active #ececec] \
    	-foreground [list disabled #a3a3a3] \
    	-relief [list {pressed !disabled} sunken] \
    	;
    

    SEE ALSO

    widget(n), style(n), , TIP #48

    tile-0.8.2/doc/html/treeview.html0000644000076500007650000005560210731273213016304 0ustar joejoe00000000000000 Tile package reference: treeview

    NAME

    ttk::treeview -
    hierarchical multicolumn data display widget

    SYNOPSIS

    ttk::treeview pathname ?options?
    

    DESCRIPTION

    The treeview widget displays a hierarchical collection of items. Each item has a textual label, an optional image, and an optional list of data values. The data values are displayed in successive columns after the tree label.

    The order in which data values are displayed may be controlled by setting the -displaycolumns widget option. The tree widget can also display column headings. Columns may be accessed by number or by symbolic names listed in the -columns widget option; see COLUMN IDENTIFIERS.

    Each item is identified by a unique name. The widget will generate item IDs if they are not supplied by the caller. There is a distinguished root item, named {}. The root item itself is not displayed; its children appear at the top level of the hierarchy.

    Each item also has a list of tags, which can be used to associate event bindings with individual items and control the appearance of the item.

    Treeview widgets support horizontal and vertical scrolling with the standard -[xy]scrollcommand options and [xy]view widget commands.

    STANDARD OPTIONS

    WIDGET OPTIONS

    NameDatabase nameDatabase class
    -columnscolumnsColumns
     A list of column identifiers, specifying the number of columns and their names.
    -displaycolumnsdisplayColumnsDisplayColumns
     A list of column identifiers (either symbolic names or integer indices) specifying which data columns are displayed and the order in which they appear, or the string #all.
    If set to #all (the default), all columns are shown in the order given.
    -heightheightHeight
     Specifies the number of rows which should be visible. Note: the requested width is determined from the sum of the column widths.
    -paddingpaddingPadding
     Specifies the internal padding for the widget. The padding is a list of up to four length specifications; see Ttk_GetPaddingFromObj() for details.
    -selectmodeselectModeSelectMode
     Controls how the built-in class bindings manage the selection. One of extended, browse, or none.
    If set to extended (the default), multiple items may be selected. If browse, only a single item will be selected at a time. If none, the selection will not be changed.
    Note that application code and tag bindings can set the selection however they wish, regardless of the value of -selectmode.
    -showshowShow
     A list containing zero or more of the following values, specifying which elements of the tree to display.
    tree
    Display tree labels in column #0.
    headings
    Display the heading row.

    The default is tree headings, i.e., show all elements.

    NOTE: Column #0 always refers to the tree column, even if -show tree is not specified.

    WIDGET COMMAND

    pathname bbox item ?column?
    Returns the bounding box (relative to the treeview widget's window) of the specified item in the form x y width height. If column is specified, returns the bounding box of that cell. If the item is not visible (i.e., if it is a descendant of a closed item or is scrolled offscreen), returns the empty list.
    pathname cget option
    Returns the current value of the specified option; see widget(n).
    pathname children item ?newchildren?
    If newchildren is not specified, returns the list of children belonging to item.

    If newchildren is specified, replaces item's child list with newchildren. Items in the old child list not present in the new child list are detached from the tree. None of the items in newchildren may be an ancestor of item.

    pathname column column ?-option ?value -option value...?
    Query or modify the options for the specified column. If no -option is specified, returns a dictionary of option/value pairs. If a single -option is specified, returns the value of that option. Otherwise, the options are updated with the specified values. The following options may be set on each column:
    -id name
    The column name. This is a read-only option. For example, [$pathname column #n -id] returns the data column associated with display column #n.
    -anchor
    Specifies how the text in this column should be aligned with respect to the cell. One of n, ne, e, se, s, sw, w, nw, or center.
    -minwidth
    The minimum width of the column in pixels. The treeview widget will not make the column any smaller than -minwidth when the widget is resized or the user drags a column separator.
    -stretch
    Specifies whether or not the column's width should be adjusted when the widget is resized.
    -width w
    The width of the column in pixels. Default is something reasonable, probably 200 or so.

    Use pathname column #0 to configure the tree column.

    pathname configure ?option? ?value option value ...?
    Modify or query widget options; see widget(n).
    pathname delete itemList
    Deletes each of the items in itemList and all of their descendants. The root item may not be deleted. See also: detach.
    pathname detach itemList
    Unlinks all of the specified items in itemList from the tree. The items and all of their descendants are still present and may be reinserted at another point in the tree but will not be displayed. The root item may not be detached. See also: delete.
    pathname exists item
    Returns 1 if the specified item is present in the tree, 0 otherwise.
    pathname focus ?item?
    If item is specified, sets the focus item to item. Otherwise, returns the current focus item, or {} if there is none.
    pathname heading column ?-option ?value -option value...?
    Query or modify the heading options for the specified column. Valid options are:
    -text text
    The text to display in the column heading.
    -image imageName
    Specifies an image to display to the right of the column heading.
    -anchor anchor
    Specifies how the heading text should be aligned. One of the standard Tk anchor values.
    -command script
    A script to evaluate when the heading label is pressed.

    Use pathname heading #0 to configure the tree column heading.

    pathname identify component x y
    Returns a description of the specified component under the point given by x and y, or the empty string if no such component is present at that position. The following subcommands are supported:
    pathname identify row x y
    Returns the item ID of the item at position y.
    pathname identify column x y
    Returns the data column identifier of the cell at position x. The tree column has ID #0.

    See COLUMN IDENTIFIERS for a discussion of display columns and data columns.

    pathname index item
    Returns the integer index of item within its parent's list of children.
    pathname insert parent index ?-id id? options...
    Creates a new item. parent is the item ID of the parent item, or the empty string {} to create a new top-level item. index is an integer, or the value end, specifying where in the list of parent's children to insert the new item. If index is less than or equal to zero, the new node is inserted at the beginning; if index is greater than or equal to the current number of children, it is inserted at the end. If -id is specified, it is used as the item identifier; id must not already exist in the tree. Otherwise, a new unique identifier is generated.

    pathname insert returns the item identifier of the newly created item. See ITEM OPTIONS for the list of available options.

    pathname instate statespec ?script?
    Test the widget state; see widget(n).
    pathname item item ?-option ?value -option value...?
    Query or modify the options for the specified item. If no -option is specified, returns a dictionary of option/value pairs. If a single -option is specified, returns the value of that option. Otherwise, the item's options are updated with the specified values. See ITEM OPTIONS for the list of available options.
    pathname move item parent index
    Moves item to position index in parent's list of children. It is illegal to move an item under one of its descendants.

    If index is less than or equal to zero, item is moved to the beginning; if greater than or equal to the number of children, it's moved to the end.

    pathname next item
    Returns the identifier of item's next sibling, or {} if item is the last child of its parent.
    pathname parent item
    Returns the ID of the parent of item, or {} if item is at the top level of the hierarchy.
    pathname prev item
    Returns the identifier of item's previous sibling, or {} if item is the first child of its parent.
    pathname see item
    Ensure that item is visible: sets all of item's ancestors to -open true, and scrolls the widget if necessary so that item is within the visible portion of the tree.
    pathname selection ?selop itemList?
    If selop is not specified, returns the list of selected items. Otherwise, selop is one of the following:
    pathname selection set itemList
    itemList becomes the new selection.
    pathname selection add itemList
    Add itemList to the selection
    pathname selection remove itemList
    Remove itemList from the selection
    pathname selection toggle itemList
    Toggle the selection state of each item in itemList.
    pathname set item ?column ?value??
    With one argument, returns a dictionary of column/value pairs for the specified item. With two arguments, returns the current value of the specified column. With three arguments, sets the value of column column in item item to the specified value. See also COLUMN IDENTIFIERS.
    pathname state ?stateSpec?
    Modify or query the widget state; see widget(n).
    pathName tag args...
    pathName tag bind tagName ?sequence ?script??
    Add a Tk binding script for the event sequence sequence to the tag tagName. When an X event is delivered to an item, binding scripts for each of the item's -tags are evaluated in order as per bindtags(n).

    <KeyPress>, <KeyRelease>, and virtual events are sent to the focus item. <ButtonPress>, <ButtonRelease>, and <Motion> events are sent to the item under the mouse pointer. No other event types are supported.

    The binding script undergoes %-substitutions before evaluation; see bind(n) for details.

    pathName tag configure tagName ?option? ?value option value...?
    Query or modify the options for the specified tagName. If one or more option/value pairs are specified, sets the value of those options for the specified tag. If a single option is specified, returns the value of that option (or the empty string if the option has not been specified for tagName). With no additional arguments, returns a dictionary of the option settings for tagName. See TAG OPTIONS for the list of available options.
    pathName xview args
    Standard command for horizontal scrolling; see widget(n).
    pathName yview args
    Standard command for vertical scrolling; see widget(n).

    ITEM OPTIONS

    The following item options may be specified for items in the insert and item widget commands.

    NameDatabase nameDatabase class
    -texttextText
     The textual label to display for the item.
    -imageimageImage
     A Tk image, displayed to the left of the label.
    -valuesvaluesValues
     The list of values associated with the item.
    Each item should have the same number of values as the -columns widget option. If there are fewer values than columns, the remaining values are assumed empty. If there are more values than columns, the extra values are ignored.
    -openopenOpen
     A boolean value indicating whether the item's children should be displayed (-open true) or hidden (-open false).
    -tagstagsTags
     A list of tags associated with this item.

    TAG OPTIONS

    The following options may be specified on tags:

    -foreground
    Specifies the text foreground color.
    -background
    Specifies the cell or item background color.
    -font
    Specifies the font to use when drawing text.
    -image
    Specifies the item image, in case the item's -image option is empty.

    (@@@ TODO: sort out order of precedence for options)

    COLUMN IDENTIFIERS

    Column identifiers take any of the following forms:

    • A symbolic name from the list of -columns.
    • An integer n, specifying the nth data column.
    • A string of the form #n, where n is an integer, specifying the nth display column.

    NOTE: Item -values may be displayed in a different order than the order in which they are stored.

    NOTE: Column #0 always refers to the tree column, even if -show tree is not specified.

    A data column number is an index into an item's -values list; a display column number is the column number in the tree where the values are displayed. Tree labels are displayed in column #0. If -displaycolumns is not set, then data column n is displayed in display column #n+1. Again, column #0 always refers to the tree column.

    VIRTUAL EVENTS

    The treeview widget generates the following virtual events.

    <<TreeviewSelect>>
    Generated whenever the selection changes.
    <<TreeviewOpen>>
    Generated just before setting the focus item to -open true.
    <<TreeviewClose>>
    Generated just after setting the focus item to -open false.

    The focus and selection widget commands can be used to determine the affected item or items. In Tk 8.5, the affected item is also passed as the -detail field of the virtual event.

    SEE ALSO

    widget(n), listbox(n), image(n), bind(n)

    tile-0.8.2/doc/html/widget.html0000644000076500007650000003466610731273213015744 0ustar joejoe00000000000000 Tile package reference: widget

    NAME

    widget -
    Standard options and commands supported by Tile widgets

    DESCRIPTION

    This manual describes common widget options and commands.

    STANDARD OPTIONS

    The following options are supported by all Tile widgets:

    NameDatabase nameDatabase class
    -class(N/A)(N/A)
     Specifies the window class. The class is used when querying the option database for the window's other options, to determine the default bindtags for the window, and to select the widget's default layout and style. This is a read-only option: it may only be specified when the window is created, and may not be changed with the configure widget command.
    -cursorcursorCursor
     Specifies the mouse cursor to be used for the widget. See Tk_GetCursor and cursors(n) in the Tk reference manual for the legal values. If set to the empty string (the default), the cursor is inherited from the parent widget.
    -takefocustakeFocusTakeFocus
     Determines whether the window accepts the focus during keyboard traversal. Either 0, 1, a command prefix (to which the widget path is appended, and which should return 0 or 1), or the empty string. See options(n) in the Tk reference manual for the full description.
    -stylestyleStyle
     May be used to specify a custom widget style.

    SCROLLABLE WIDGET OPTIONS

    The following options are supported by widgets that are controllable by a scrollbar. See scrollbar(n) for more information

    NameDatabase nameDatabase class
    -xscrollcommandxScrollCommandScrollCommand
     A command prefix, used to communicate with horizontal scrollbars.

    When the view in the widget's window changes, the widget will generate a Tcl command by concatenating the scroll command and two numbers. Each of the numbers is a fraction between 0 and 1 indicating a position in the document; 0 indicates the beginning, and 1 indicates the end. The first fraction indicates the first information in the widget that is visible in the window, and the second fraction indicates the information just after the last portion that is visible.

    Typically the xScrollCommand option consists of the path name of a scrollbar widget followed by ``set'', e.g. ``.x.scrollbar set''. This will cause the scrollbar to be updated whenever the view in the window changes.

    If this option is set to the empty string (the default), then no command will be executed.

    -yscrollcommandyScrollCommandScrollCommand
     A command prefix, used to communicate with vertical scrollbars. See the description of -xscrollcommand above for details.

    LABEL OPTIONS

    The following options are supported by labels, buttons, and other button-like widgets:

    NameDatabase nameDatabase class
    -texttextText
     Specifies a text string to be displayed inside the widget (unless overridden by -textvariable).
    -textvariabletextVariableVariable
     Specifies the name of variable whose value will be used in place of the -text resource.
    -underlineunderlineUnderline
     If set, specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation (see keynav(n)).
    -imageimageImage
     Specifies an image to display. This is a list of 1 or more elements. The first element is the default image name. The rest of the list is a sequence of statespec / value pairs as per style map, specifying different images to use when the widget is in a particular state or combination of states. All images in the list should have the same size.
    -compoundcompoundCompound
     Specifies how to display the image relative to the text, in the case both -text and -image are present. Valid values are:
    text
    Display text only.
    image
    Display image only.
    center
    Display text centered on top of image.
    top
    bottom
    left
    right
    Display image above, below, left of, or right of the text, respectively.
    none
    The default; display the image if present, otherwise the text.
    -widthwidthWidth
     If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used.

    COMPATIBILITY OPTIONS

    NameDatabase nameDatabase class
    -statestateState
     May be set to normal or disabled to control the disabled state bit. This is a write-only option: setting it changes the widget state, but the state widget command does not affect the -state option.

    COMMANDS

    pathName cget option
    Returns the current value of the configuration option given by option.
    pathName configure ?option? ?value option value ...?
    Query or modify the configuration options of the widget. If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. If option is specified with no value, then the command returns a list describing the named option: the elements of the list are the option name, database name, database class, default value, and current value. If no option is specified, returns a list describing all of the available options for pathName.
    pathName instate statespec ?script?
    Test the widget's state. If script is not specified, returns 1 if the widget state matches statespec and 0 otherwise. If script is specified, equivalent to
    if {[pathName instate stateSpec]} script
    
    pathName state ?stateSpec?
    Modify or inquire widget state. If stateSpec is present, sets the widget state: for each flag in stateSpec, sets the corresponding flag or clears it if prefixed by an exclamation point.

    Returns a new state spec indicating which flags were changed:

    set changes [pathName state spec] ; 
    pathName state $changes
    

    will restore pathName to the original state. If stateSpec is not specified, returns a list of the currently-enabled state flags.

    WIDGET STATES

    The widget state is a bitmap of independent state flags. Widget state flags include:

    active
    The mouse cursor is over the widget and pressing a mouse button will cause some action to occur. (aka "prelight" (Gnome), "hot" (Windows), "hover").
    disabled
    Widget is disabled under program control (aka "unavailable", "inactive")
    focus
    Widget has keyboard focus
    pressed
    Widget is being pressed (aka "armed" in Motif).
    selected
    "On", "true", or "current" for things like checkbuttons and radiobuttons.
    background
    Windows and the Mac have a notion of an "active" or foreground window. The background state is set for widgets in a background window, and cleared for those in the foreground window.
    readonly
    Widget should not allow user modification.
    alternate
    A widget-specific alternate display format. For example, used for checkbuttons and radiobuttons in the "tristate" or "mixed" state, and for buttons with -default active.
    invalid
    The widget's value is invalid. (Potential uses: scale widget value out of bounds, entry widget value failed validation.)

    A state specification or stateSpec is a list of state names, optionally prefixed with an exclamation point (!) indicating that the bit is off.

    EXAMPLES

    set b [ttk::button .b]
    
    # Disable the widget:
    $b state disabled			
    
    # Invoke the widget only if it is currently pressed and enabled:
    $b instate {pressed !disabled} { .b invoke }	
    
    # Reenable widget:
    $b state !disabled			
    

    SEE ALSO

    tile-intro(n), style(n)

    KEYWORDS

    state, configure, option

    tile-0.8.2/doc/html/index.html0000644000076500007650000000711410731273213015554 0ustar joejoe00000000000000 Tile package reference

    Tile package reference: Contents

    tile-0.8.2/doc/html/keyword-index.html0000644000076500007650000004205710731273213017243 0ustar joejoe00000000000000 Tile package reference: Keyword Index

    Tile package reference: Keywords

    Keywords: -
    -classwidget
    -compoundwidget
    -cursorwidget
    -imagewidget
    -statewidget
    -stylewidget
    -takefocuswidget
    -textwidget
    -textvariablewidget
    -underlinewidget
    -widthwidget
    -xscrollcommandwidget
    -yscrollcommandwidget
    Keywords: A
    appearancestyle
    Keywords: B
    boxGeometry
    button button · checkbutton · menubutton · radiobutton
    Keywords: C
    checkcheckbutton
    checkbuttoncheckbutton
    comboboxcombobox
    commandbutton
    configurewidget
    container frame · labelframe
    Keywords: D
    defaultbutton
    dialogdialog
    Keywords: E
    entryentry
    Keywords: F
    frame frame · labelframe
    Keywords: G
    GeometryGeometry
    groupboxlabelframe
    grow boxsizegrip
    Keywords: I
    imageimage
    Keywords: L
    label label · labelframe
    labelframelabelframe
    Keywords: M
    marginsGeometry
    menumenubutton
    menubuttonmenubutton
    Keywords: N
    notebooknotebook
    Keywords: O
    option checkbutton · radiobutton · widget
    Keywords: P
    paddingGeometry
    panenotebook
    panedpanedwindow
    pixmap themeimage
    progressbarprogressbar
    Keywords: R
    radiobuttonradiobutton
    regionGeometry
    reliefGeometry
    Keywords: S
    scrollbarscrollbar
    separatorseparator
    sizegripsizegrip
    statewidget
    stickyGeometry
    stylestyle
    Keywords: T
    tabnotebook
    text fieldentry
    theme style · Ttk_CreateTheme
    tile-introintro
    tile_introintro
    togglecheckbutton
    treeviewtreeview
    ttk::buttonbutton
    ttk::checkbuttoncheckbutton
    ttk::comboboxcombobox
    ttk::dialogdialog
    ttk::entryentry
    ttk::frameframe
    ttk::labellabel
    ttk::labelframelabelframe
    ttk::menubuttonmenubutton
    ttk::notebooknotebook
    ttk::panedwindowpanedwindow
    ttk::progressbarprogressbar
    ttk::radiobuttonradiobutton
    ttk::scrollbarscrollbar
    ttk::separatorseparator
    ttk::sizegripsizegrip
    ttk::stylestyle
    ttk::treeviewtreeview
    Ttk_AddPaddingGeometry
    Ttk_BoxGeometry
    Ttk_BoxContainsGeometry
    Ttk_CreateThemeTtk_CreateTheme
    Ttk_ExpandBoxGeometry
    Ttk_GetBorderFromObjGeometry
    Ttk_GetCurrentThemeTtk_CreateTheme
    Ttk_GetDefaultThemeTtk_CreateTheme
    Ttk_GetPaddingFromObjGeometry
    Ttk_GetStickyFromObjGeometry
    Ttk_GetThemeTtk_CreateTheme
    ttk_imageimage
    Ttk_MakeBoxGeometry
    Ttk_MakePaddingGeometry
    Ttk_PackBoxGeometry
    Ttk_PadBoxGeometry
    Ttk_PaddingGeometry
    Ttk_PlaceBoxGeometry
    Ttk_RelievePaddingGeometry
    Ttk_StickBoxGeometry
    Ttk_UniformPaddingGeometry
    Keywords: W
    widget button · checkbutton · entry · frame · labelframe · menubutton · radiobutton · scrollbar · separator · sizegrip · widget
    tile-0.8.2/doc/html/category-index.html0000644000076500007650000000764510731273213017400 0ustar joejoe00000000000000 Tile package reference: Index tile-0.8.2/doc/html/converting.txt0000644000076500007650000000746010731273213016502 0ustar joejoe00000000000000 converting.txt,v 1.5 2004/12/28 21:00:35 jenglish Exp [14 Feb 2004] ~ Converting existing applications to use the Tile widgets Note that the Tile widget set is not a 100%-compatible drop-in replacement for the standard Tk widgets. The main difference is that all the state-dependent options like -activebackground, -disabledforeground, and -overrelief are not present, replaced by the general-purpose style mechanism. Many appearance-related options like -borderwidth and -background are also missing. Applications that rely on the option database for customization will be easier to adapt than those that set resources on widgets directly. In the 0.3 release all options supported in Tk 8.4 are present, so they can be set and queried without raising an error, but their values will be ignored. If you're feeling adventurous, you can try: namespace import ttk::* in your application's namespace(s) to locally override all the widget construction commands (button, scrollbar, etc). Or, you can switch on a widget-by-widget basis by using "ttk::button" for "button", "ttk::scrollbar" for "scrollbar", and so forth. IMPORTANT NOTE: Previous versions of this document suggested using 'namespace import -force ttk::*' at global scope, for the really adventurous. This is now considered a Really Bad Idea: it will cause many things to break, and will cause more things to break in the future. So don't do that anymore. Other differences: The -state option has also been replaced by "state" and "instate" widget commands (see widget.n). Some widgets do have a "-state" option for compatibility purposes, although only "-state normal" and "-state disabled" are supported, and it's a "write-only" option -- if you disable a widget with [$w state disabled], that won't be reflected by [$w cget -state]. The -padx and -pady options have been merged into a single "-padding" option, which may be a list of up to four values specifying padding on the left, top, right, and bottom. Some widget subcommands are not implemented yet, and others (like [scrollbar identify]) work differently. The -indicatoron option for checkbuttons and radiobuttons is no longer supported. For toolbar-style buttons, use "-style Toolbar" instead. (See demos/toolbutton.tcl for an explanation.) The tile [menubutton] widget is *not* designed to be used inside a menubar by default, only as a standalone widget. If you're still using menubuttons in a frame to build menubars, switch to Tk [menu]s, or use a custom style. The -container option for frames is gone. This will eventually be replaced with a special-purpose container widget, which uses the XEmbed protocol. Similarly, the -in option on toplevels will be replaced with a special-purpose "embeddable" widget. The -colormap and -visual frame options are gone. (If anyone really needs these, please let me know. It will make *everything* a lot simpler if these can be eliminated altogether.) The -anchor option for checkbuttons, radiobuttons, and buttons is ignored. Again, if anyone has a use for anything other than "-anchor w" for checkbuttons or "-anchor center" for buttons, please let me know. There are probably some important widget options and commands still unimplemented. (Known cases: select, deselect, and toggle for checkbuttons, a few others). For buttons, labels, etc., the '-width' option always specifies the width in characters to allocate for the text string. (In Tk, it's either a width in characters, or in screen units, depending on the value of '-compound', for the entire button.) Additionally: negative widths specify a minimum size on all platforms, not just Windows. Two new values for the "-compound" option are available: "text" (display text only) and "image" (display image only). This is useful for configuring toolbars. The -bitmap option is not supported. Use -image instead. tile-0.8.2/doc/Geometry.30000644000076500007650000001750210156440424014475 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" '\" RCS: @(#) Geometry.3,v 1.7 2004/12/11 00:36:36 jenglish Exp '\" .so man.macros .TH Geometry 3 0.2 tile "Tile Widget Set" .BS .SH NAME geometry: Ttk_MakeBox, Ttk_PadBox, Ttk_ExpandBox, Ttk_PackBox, Ttk_StickBox, Ttk_PlaceBox, Ttk_BoxContains, Ttk_MakePadding, Ttk_UniformPadding, Ttk_AddPadding, Ttk_RelievePadding, Ttk_GetPaddingFromObj, Ttk_GetBorderFromObj, Ttk_GetStickyFromObj \- Geometry utilities .SH SYNOPSIS .nf \fB#include \fR Ttk_Box \fBTtk_MakeBox\fR(int \fIx\fR, int \fIy\fR, int \fIwidth\fR, int \fIheight\fR); Ttk_Box \fBTtk_PadBox\fR(Ttk_Box \fIparcel\fR, Ttk_Padding \fIpadding\fR); Ttk_Box \fBTtk_ExpandBox\fR(Ttk_Box \fIparcel\fR, Ttk_Padding \fIpadding\fR); Ttk_Box \fBTtk_PackBox\fR(Ttk_Box *\fIcavity\fR, int \fIwidth\fR, int \fIheight\fR, Ttk_Side \fIside\fR); Ttk_Box \fBTtk_StickBox\fR(Ttk_Box \fIparcel\fR, int \fIwidth\fR, int \fIheight\fR, unsigned \fIsticky\fR); Ttk_Box \fBTtk_PlaceBox\fR(Ttk_Box *\fIcavity\fR, int \fIwidth\fR, int \fIheight\fR, Ttk_Side \fIside\fR, unsigned \fIsticky\fR); Ttk_Box \fBTtk_AnchorBox\fR(Ttk_Box \fIparcel\fR, int \fIwidth\fR, int \fIheight\fR, Tk_Anchor \fIanchor\fR); Ttk_Padding \fBTtk_MakePadding\fR(\c short \fIleft\fR, short \fItop\fR, short \fIright\fR, short \fIbottom\fR); Ttk_Padding \fBTtk_UniformPadding\fR(short \fIborder\fR); Ttk_Padding \fBTtk_AddPadding\fR(Ttk_Padding \fIpadding1\fR, Ttk_Padding \fIpadding2\fR; Ttk_Padding \fBTtk_RelievePadding\fR(Ttk_Padding \fIpadding\fR, int \fIrelief\fR); int \fBTtk_BoxContains\fR(Ttk_Box \fIbox\fR, int \fIx\fR, int \fIy\fR); int \fBTtk_GetPaddingFromObj\fR( Tcl_Interp *\fIinterp\fR, Tk_Window \fItkwin\fR, Tcl_Obj *\fIobjPtr\fR, Ttk_Padding *\fIpadding_rtn\fR); int \fBTtk_GetBorderFromObj\fR( Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIobjPtr\fR, Ttk_Padding *\fIpadding_rtn\fR); int \fBTtk_GetStickyFromObj\fR(\c Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIobjPtr\fR, int *\fIsticky_rtn\fR); .fi .SH ARGUMENTS .AP Tk_Anchor anchor in One of the symbolic constants \fBTK_ANCHOR_N\fR, \fBTK_ANCHOR_NE\fR, etc. See \fITk_GetAnchorFromObj(3)\fR. .AP "Ttk_Box *" cavity in/out A rectangular region from which a parcel is allocated. .AP short border in Extra padding (in pixels) to add uniformly to each side of a region. .AP short bottom in Extra padding (in pixels) to add to the bottom of a region. .AP Ttk_Box box in .AP "Ttk_Box *" box_rtn out Specifies a rectangular region. .AP int height in The height in pixels of a region. .AP "Tcl_Interp *" interp in Used to store error messages. .AP int left in Extra padding (in pixels) to add to the left side of a region. .AP "Tcl_Obj *" objPtr in String value contains a symbolic name to be converted to an enumerated value or bitmask. Internal rep may be be modified to cache corresponding value. .AP Ttk_Padding padding in .AP "Ttk_Padding *" padding_rtn out Extra padding to add on the inside of a region. .AP Ttk_Box parcel in A rectangular region, allocated from a cavity. .AP int relief in One of the standard Tk relief options (TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, etc.). See \fBTk_GetReliefFromObj\fR. .AP short right in Extra padding (in pixles) to add to the right side of a region. .AP Ttk_Side side in One of \fBTTK_SIDE_LEFT\fR, \fBTTK_SIDE_TOP\fR, \fBTTK_SIDE_RIGHT\fR, or \fBTTK_SIDE_BOTTOM\fR. .AP unsigned sticky in A bitmask containing one or more of the bits \fBTTK_STICK_W\fR (west, or left), \fBTTK_STICK_E\fR (east, or right, \fBTTK_STICK_N\fR (north, or top), and \fBTTK_STICK_S\fR (south, or bottom). \fBTTK_FILL_X\fR is defined as a synonym for (TTK_STICK_W|TTK_STICK_E), \fBTTK_FILL_Y\fR is a synonym for (TTK_STICK_N|TTK_STICK_S), and \fBTTK_FILL_BOTH\fR and \fBTTK_STICK_ALL\fR are synonyms for (TTK_FILL_X|TTK_FILL_Y). See also: \fIgrid(n)\fR. .AP Tk_Window tkwin in Window whose screen geometry determines the conversion between absolute units and pixels. .AP short top in Extra padding at the top of a region. .AP int width in The width in pixels of a region. .AP int x in X coordinate of upper-left corner of region. .AP int y in Y coordinate of upper-left corner of region. .BE .SH "BOXES" The \fBTtk_Box\fR structure represents a rectangular region of a window: .CS typedef struct { int x; int y; int width; int height; } Ttk_Box; .CE All coordinates are relative to the window. .PP \fBTtk_MakeBox\fR is a convenience routine that contsructs a \fBTtk_Box\fR structure representing a region \fIwidth\fR pixels wide, \fIheight\fR pixels tall, at the specified \fIx, y\fR coordinates. .PP \fBTtk_PadBox\fR returns a new box located inside the specified \fIparcel\fR, shrunken according to the left, top, right, and bottom margins specified by \fIpadding\fR. .PP \fBTtk_ExpandBox\fR is the inverse of \fBTtk_PadBox\fP: it returns a new box surrounding the specified \fIparcel\fR, expanded according to the left, top, right, and bottom margins specified by \fIpadding\fR. .PP \fBTtk_PackBox\fR allocates a parcel \fIwidth\fR by \fIheight\fR pixels wide on the specified \fIside\fR of the \fIcavity\fR, and shrinks the \fIcavity\fR accordingly. .PP \fBTtk_StickBox\fR places a box with the requested \fIwidth\fR and \fIheight\fR inside the \fIparcel\fR according to the \fIsticky\fR bits. .PP \fBTtk_PlaceBox\fP combines \fBTtk_PackBox\fP and \fBTtk_StickBox\fP: it allocates a parcel on the specified \fIside\fP of the \fIcavity\fP, places a box of the requested size inside the parcel according to \fIsticky\fP, and shrinks the \fIcavity\fP. .PP \fBTtk_AnchorBox\fR places a box with the requested \fIwidth\fR and \fIheight\fR inside the \fIparcel\fR according to the specified \fIanchor\fR option. .PP \fBTtk_BoxContains\fR tests if the specified \fIx, y\fR coordinate lies within the rectangular region \fIbox\fR. .SH "PADDDING" The \fBTtk_Padding\fR structure is used to represent borders, internal padding, and external margins: .CS typedef struct { short left; short top; short right; short bottom; } Ttk_Padding; .CE .PP \fBTtk_MakePadding\fR is a convenience routine that contsructs a \fBTtk_Padding\fR structure with the specified left, top, right, and bottom components. .PP \fBTtk_UniformPadding\fR constructs a \fBTtk_Padding\fR structure with all components equal to the specified \fIborder\fR. .PP \fBTtk_AddPadding\fR adds two \fBTtk_Padding\fRs together and returns a combined padding containing the sum of the individual padding components. .PP \fBTtk_RelievePadding\fR adds an extra 2 pixels of padding to \fIpadding\fR according to the specified \fIrelief\fR. If \fIrelief\fR is \fBTK_RELIEF_SUNKEN\fR, adds two pixels at the top and left so the inner region is shifted down and to the left. If it is \fBTK_RELIEF_RAISED\fR, adds two pixels at the bottom and right so the inner region is shifted up and to the right. Otherwise, adds 1 pixel on all sides. This is typically used in element geometry procedures to simulate a "pressed-in" look for pushbuttons. .SH "CONVERSION ROUTINES" \fBTtk_GetPaddingFromObj\fR converts the string in \fIobjPtr\fR to a \fBTtk_Padding\fR structure. The string representation is a list of up to four length specifications \fI"left top right bottom"\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. See \fBTk_GetPixelsFromObj(3)\fR for the syntax of length specifications. .PP \fBTtk_GetBorderFromObj\fR is the same as \fBTtk_GetPaddingFromObj\fP except that the lengths are specified as integers (i.e., resolution-dependant values like \fI3m\fP are not allowed). .PP \fBTtk_GetStickyFromObj\fR converts the string in \fIobjPtr\fR to a \fIsticky\fR bitmask. The string contains zero or more of the characters \fBn\fR, \fBs\fR, \fBe\fR, or \fBw\fR. .SH "SEE ALSO" Tk_GetReliefFromObj(3), Tk_GetPixelsFromObj(3), Tk_GetAnchorFromObj(3) .SH "KEYWORDS" geometry, padding, margins, box, region, sticky, relief tile-0.8.2/doc/Makefile0000644000076500007650000000133610022433674014255 0ustar joejoe00000000000000# # tile/doc/Makefile -- # # Generate TMML from nroff source # Generate HTML from TMML # TMML_DIR ?= /usr/local/lib/tmml MAN2TMML = tclsh $(TMML_DIR)/man2tmml/man2tmml.tcl TMML = tclsh $(TMML_DIR)/tools/tmml.tcl HTML_DIR = html .SUFFIXES: .3 .n .tmml .html TMML_OPTIONS = --masterDocument=TILE.XML --htmlDirectory=$(HTML_DIR) --quiet=1 TXTFILES = converting.txt default : tmml html tmml :: -mkdir -p xml $(MAN2TMML) -rebuild -directory xml -extension .tmml html :: -mkdir -p $(HTML_DIR) $(TMML) makemap $(TMML_OPTIONS) ; mv INDEX.MAP xml $(TMML) tohtml xml/*.tmml $(TMML_OPTIONS) $(TMML) navpages $(TMML_OPTIONS) for file in $(TXTFILES) ; do cp $$file $(HTML_DIR) ; done clean :: -rm $(HTML_DIR)/*.* -rm xml/*.* tile-0.8.2/doc/TILE.XML0000644000076500007650000000226310730002143013721 0ustar joejoe00000000000000 Tile package reference Tcl commands Widgets C API Miscellaneous tile-0.8.2/doc/Theme.30000644000076500007650000000177410156440424013750 0ustar joejoe00000000000000'\" '\" Copyright (c) 2003 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) Theme.3,v 1.4 2004/12/11 00:36:36 jenglish Exp '\" .so man.macros .TH Ttk_CreateTheme 3 0.2 tile "Tile Widget Set" .BS .SH NAME Ttk_CreateTheme, Ttk_GetTheme, Ttk_GetDefaultTheme, Ttk_GetCurrentTheme \- create and use Themes. .SH SYNOPSIS .nf Ttk_Theme Ttk_CreateTheme(\fIinterp\fR, \fIname\fR, \fIparentTheme\fR); Ttk_Theme Ttk_GetTheme(\fIinterp\fR, \fIname\fR); Ttk_Theme Ttk_GetDefaultTheme(\fIinterp\fR); Ttk_Theme Ttk_GetCurrentTheme(\fIinterp\fR); .fi .SH ARGUMENTS .AP "Tcl_Interp *" interp in The Tcl interpreter in which to register/query available themes. .AP "Ttk_Theme" parentTheme in Fallback or parent theme from which the new theme will inherit elements and layouts. .AP "const char *" name in The name of the theme. .BE .SH DESCRIPTION .SH "SEE ALSO" Ttk_RegisterLayout, Ttk_BuildLayout .\" .SH KEYWORDS tile-0.8.2/doc/button.n0000644000076500007650000000455710532475536014330 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH button n 0.2 tile "Tile Widget Set" .BS .SH NAME ttk::button \- Widget that issues a command when pressed .SH SYNOPSIS \fBttk::button\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBbutton\fR widget displays a textual label and/or image, and evaluates a command when pressed. .SO \-class \-compound \-cursor \-image \-state \-style \-takefocus \-text \-textvariable \-underline \-width .SE .SH "OPTIONS" .OP \-command command Command A script to evaluate when the widget is invoked. .OP \-default default Default May be set to one of \fBnormal\fR, \fBactive\fR, or \fBdisabled\fR. In a dialog box, one button may be designated the "default" button (meaning, roughly, "the one that gets invoked when the user presses "). \fBactive\fR indicates that this is currently the default button; \fBnormal\fR means that it may become the default button, and \fBdisabled\fR means that it is not defaultable. The default is \fBnormal\fR. .br Depending on the theme, the default button may be displayed with an extra highlight ring, or with a different border color. See also: \fIkeynav(n)\fR. .OP \-width width Width If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used. Note that some themes may specify a non-zero \fB-width\fR in the style. '\" Not documented -- may go away '\" .OP \-padding padding Padding '\" .OP \-foreground foreground Foreground '\" .OP \-font font Font '\" .OP \-anchor anchor Anchor '\" .OP \-padding padding Padding '\" .OP \-relief relief Relief .SH "WIDGET COMMAND" .TP \fIpathName \fBinvoke\fR Invokes the command associated with the button. .TP \fIpathName \fBcget\fR \fIoption\fR .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? .TP \fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? See \fIwidget(n)\fR .SH "COMPATIBILITY OPTIONS" .OP \-state state State May be set to \fBnormal\fR or \fBdisabled\fR to control the \fBdisabled\fR state bit. This is a ``write-only'' option: setting it changes the widget state, but the \fBstate\fR widget command does not affect the state option. .SH "SEE ALSO" widget(n), keynav(n) .SH "KEYWORDS" widget, button, default, command tile-0.8.2/doc/checkbutton.n0000644000076500007650000000430710623435726015315 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH checkbutton n 0.2 tile "Tile Widget Set" .BS .SH NAME ttk::checkbutton \- On/off widget .SH SYNOPSIS \fBttk::checkbutton\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBcheckbutton\fR widget is used to show or change a setting. It has two states, selected and deselected. The state of the checkbutton may be linked to a Tcl variable. .SO \-class \-compound \-cursor \-image \-state \-style \-takefocus \-text \-textvariable \-underline \-width .SE .SH "OPTIONS" .OP \-command command Command A Tcl script to execute whenever the widget is invoked. .OP \-offvalue offValue OffValue The value to store in the associated \fI-variable\fR when the widget is deselected. Defaults to \fB0\fR. .OP \-onvalue onValue OnValue The value to store in the associated \fI-variable\fR when the widget is selected. Defaults to \fB1\fR. .OP \-variable variable Variable The name of a global variable whose value is linked to the widget. Defaults to the widget pathname if not specified. .SH "WIDGET COMMAND" In addition to the standard \fBcget\fR, \fBconfigure\fR, \fBinstate\fR, and \fBstate\fR commands, checkbuttons support the following additional widget commands: .TP \fIpathname\fR invoke Toggles between the selected and deselected states and evaluates the associated \fI-command\fR. If the widget is currently selected, sets the \fI-variable\fR to the \fI-offvalue\fR and deselects the widget; otherwise, sets the \fI-variable\fR to the \fI-onvalue\fR Returns the result of the \fI-command\fR. .\" Missing: select, deselect, toggle .\" Are these useful? They don't invoke the -command .\" Missing: flash. This is definitely not useful. .SH "WIDGET STATES" The widget does not respond to user input if the \fBdisabled\fR state is set. The widget sets the \fBselected\fR state whenever the linked \fB-variable\fR is set to the widget's \fB-onvalue\fR, and clears it otherwise. The widget sets the \fBalternate\fR state whenever the linked \fB-variable\fR is unset. (The \fBalternate\fR state may be used to indicate a ``tri-state'' or ``indeterminate'' selection.) .SH "SEE ALSO" widget(n), keynav(n), radiobutton(n) .SH "KEYWORDS" widget, button, toggle, check, option tile-0.8.2/doc/combobox.n0000644000076500007650000000642410541330070014577 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH combobox n 0.4 tile "Tile Widget Set" .BS .SH NAME ttk::combobox \- text field with popdown selection list .SH SYNOPSIS \fBttk::combobox\fR \fIpathName \fR?\fIoptions\fR? .SO \-class \-cursor \-takefocus \-style .SE .\" ALSO: Other entry widget options .SH "OPTIONS" .OP \-exportselection exportSelection ExportSelection Boolean value. If set, the widget selection is linked to the X selection. .OP \-justify justify Justify Specifies how the text is aligned within the widget. One of \fBleft\fR, \fBcenter\fR, or \fBright\fR. .OP \-height height Height Specifies the height of the pop-down listbox, in rows. .OP \-postcommand postCommand PostCommand A Tcl script to evaluate immediately before displaying the listbox. The \fB-postcommand\fR script may specify the \fB-values\fR to display. .OP \-state state State One of \fBnormal\fR, \fBreadonly\fR, or \fBdisabled\fR. In the \fBreadonly\fR state, the value may not be edited directly, and the user can only select one of the \fB-values\fR from the dropdown list. In the \fBnormal\fR state, the text field is directly editable. In the \fBdisabled\fR state, no interaction is possible. .OP \-textvariable textVariable TextVariable Specifies the name of a variable whose value is linked to the widget value. Whenever the variable changes value the widget value is updated, and vice versa. .OP \-values values Values Specifies the list of values to display in the drop-down listbox. .OP \-width width Width Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font. .BE .SH DESCRIPTION A combobox combines a text field with a pop-down list of values; the user may select the value of the text field from among the values in the list. .SH "WIDGET COMMAND" .TP \fIpathName \fBcget\fR \fIoption\fR Returns the current value of the specified \fIoption\fR. See \fIwidget(n)\fR. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? Modify or query widget options. See \fIwidget(n)\fR. .TP \fIpathName \fBcurrent\fR ?\fInewIndex\fR? If \fInewIndex\fR is supplied, sets the combobox value to the element at position \fInewIndex\fR in the list of \fB-values\fR. Otherwise, returns the index of the current value in the list of \fB-values\fR or \fB-1\fR if the current value does not appear in the list. .TP \fIpathName \fBget\fR Returns the current value of the combobox. .TP \fIpathName \fBidentify \fIx y\fR Returns the name of the element at position \fIx\fR, \fIy\fR, or the empty string if the coordinates are outside the window. .TP \fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? Test the widget state. See \fIwidget(n)\fR. .TP \fIpathName \fBset\fR \fIvalue\fR Sets the value of the combobox to \fIvalue\fR. .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? Modify or query the widget state. See \fIwidget(n)\fR. .PP The combobox widget also supports the following \fIentry\fR widget commands (see \fIentry(n)\fR for details): .DS .ta 5.5c 11c bbox delete icursor index insert selection xview .DE .SH "VIRTUAL EVENTS" The combobox widget generates a \fB<>\fR virtual event when the user selects an element from the list of values. This event is generated after the listbox is unposted. .SH "SEE ALSO" widget(n), entry(n) tile-0.8.2/doc/converting.txt0000644000076500007650000000746010164344563015545 0ustar joejoe00000000000000 converting.txt,v 1.5 2004/12/28 21:00:35 jenglish Exp [14 Feb 2004] ~ Converting existing applications to use the Tile widgets Note that the Tile widget set is not a 100%-compatible drop-in replacement for the standard Tk widgets. The main difference is that all the state-dependent options like -activebackground, -disabledforeground, and -overrelief are not present, replaced by the general-purpose style mechanism. Many appearance-related options like -borderwidth and -background are also missing. Applications that rely on the option database for customization will be easier to adapt than those that set resources on widgets directly. In the 0.3 release all options supported in Tk 8.4 are present, so they can be set and queried without raising an error, but their values will be ignored. If you're feeling adventurous, you can try: namespace import ttk::* in your application's namespace(s) to locally override all the widget construction commands (button, scrollbar, etc). Or, you can switch on a widget-by-widget basis by using "ttk::button" for "button", "ttk::scrollbar" for "scrollbar", and so forth. IMPORTANT NOTE: Previous versions of this document suggested using 'namespace import -force ttk::*' at global scope, for the really adventurous. This is now considered a Really Bad Idea: it will cause many things to break, and will cause more things to break in the future. So don't do that anymore. Other differences: The -state option has also been replaced by "state" and "instate" widget commands (see widget.n). Some widgets do have a "-state" option for compatibility purposes, although only "-state normal" and "-state disabled" are supported, and it's a "write-only" option -- if you disable a widget with [$w state disabled], that won't be reflected by [$w cget -state]. The -padx and -pady options have been merged into a single "-padding" option, which may be a list of up to four values specifying padding on the left, top, right, and bottom. Some widget subcommands are not implemented yet, and others (like [scrollbar identify]) work differently. The -indicatoron option for checkbuttons and radiobuttons is no longer supported. For toolbar-style buttons, use "-style Toolbar" instead. (See demos/toolbutton.tcl for an explanation.) The tile [menubutton] widget is *not* designed to be used inside a menubar by default, only as a standalone widget. If you're still using menubuttons in a frame to build menubars, switch to Tk [menu]s, or use a custom style. The -container option for frames is gone. This will eventually be replaced with a special-purpose container widget, which uses the XEmbed protocol. Similarly, the -in option on toplevels will be replaced with a special-purpose "embeddable" widget. The -colormap and -visual frame options are gone. (If anyone really needs these, please let me know. It will make *everything* a lot simpler if these can be eliminated altogether.) The -anchor option for checkbuttons, radiobuttons, and buttons is ignored. Again, if anyone has a use for anything other than "-anchor w" for checkbuttons or "-anchor center" for buttons, please let me know. There are probably some important widget options and commands still unimplemented. (Known cases: select, deselect, and toggle for checkbuttons, a few others). For buttons, labels, etc., the '-width' option always specifies the width in characters to allocate for the text string. (In Tk, it's either a width in characters, or in screen units, depending on the value of '-compound', for the entire button.) Additionally: negative widths specify a minimum size on all platforms, not just Windows. Two new values for the "-compound" option are available: "text" (display text only) and "image" (display image only). This is useful for configuring toolbars. The -bitmap option is not supported. Use -image instead. tile-0.8.2/doc/dialog.n0000644000076500007650000001053410644777726014256 0ustar joejoe00000000000000'\" '\" Copyright (c) 2005 Joe English '\" .so man.macros .TH dialog n 0.8 tile "Tile Widget Set" .SH "NAME" ttk::dialog \- create a dialog box .SH "SYNOPSIS" \fBpackage require ttk::dialog\fR ?\fI0.8\fR? .br \fBttk::dialog\fR \fIpathname\fR ?\fIoptions...\fR? \fBttk::dialog::define\fR \fIdialogType\fR ?\fIoptions...\fR? .SH "DESCRIPTION" A dialog box is a transient top-level window containing an icon, a short message, an optional, longer, detail message, and a row of command buttons. When the user presses any of the buttons, a callback function is invoked and then the dialog is destroyed. .PP Additional widgets may be added in the dialog \fIclient frame\fR. .SH "OPTIONS" .OP \-title n/a n/a Specifies a string to use as the window manager title. .OP \-message n/a n/a Specifies the message to display in this dialog. .OP \-detail n/a n/a Specifies a longer auxiliary message. .OP \-command n/a n/a Specifies a command prefix to be invoked when the user presses one of the command buttons. The symbolic name of the button is passed as an additional argument to the command. The dialog is dismissed after invoking the command. .OP \-parent n/a n/a Specifies a toplevel window for which the dialog is transient. If omitted, the default is the nearest ancestor toplevel. If set to the empty string, the dialog will not be a transient window. .OP \-type n/a n/a Specifies a built-in or user-defined dialog type. See \fBPREDEFINED DIALOG TYPES\fR, below. .OP \-icon n/a n/a Specifies one of the stock dialog icons, \fBinfo\fR, \fBquestion\fR, \fBwarning\fR, \fBerror\fR, \fBauth\fR, or \fBbusy\fR. If set to the empty string (the default), no icon is displayed. .OP \-buttons n/a n/a A list of symbolic button names. .OP \-labels n/a n/a A dictionary mapping symbolic button names to textual labels. May be omitted if all the buttons are predefined. .OP \-default n/a n/a The symbolic name of the default button. .OP \-cancel n/a n/a The symbolic name of the "cancel" button. The cancel button is invoked if the user presses the Escape key and when the dialog is closed from the window manager. If \fB-cancel\fR is not specified, the dialog ignores window manager close commands (WM_DELETE_WINDOW). .SH "WIDGET COMMANDS" .TP \fBttk::dialog::clientframe \fIdlg\fR Returns the widget path of the client frame. Other widgets may be added to the client frame. The client frame appears between the detail message and the command buttons. .SH "PREDEFINED DIALOG TYPES" The \fB-type\fR option, if present, specifies default values for other options. \fBttk::dialog::define \fItype options...\fR specifies a new stock dialog \fItype\fR. The following stock dialog types are predefined: .CS ttk::dialog::define ok \e -icon info -buttons {ok} -default ok ttk::dialog::define okcancel \e -icon info -buttons {ok cancel} -default ok -cancel cancel ttk::dialog::define yesno \e -icon question -buttons {yes no} ttk::dialog::define yesnocancel \e -icon question -buttons {yes no cancel} -cancel cancel ttk::dialog::define retrycancel \e -icon question -buttons {retry cancel} -cancel cancel .CE .SH "STOCK BUTTONS" The following ``stock'' symbolic button names have predefined labels: \fByes\fR, \fBno\fR, \fBok\fR, \fBcancel\fR, and \fBretry\fR. .PP It is not necessary to list these in the \fB-labels\fR dictionary. .\" .SH "DIFFERENCES FROM MESSAGE BOXES" .\" The \fBttk::dialog\fR constructor is similar to .\" the Tk library procedure \fBtk_messageBox\fR, .\" but with the following notable differences: .\" .IP \(bu .\" The first argument to \fBttk::dialog\fR is the name of .\" the widget to create; \fBtk_messageBox\fR has .\" .IP \(bu .\" Tile dialog boxes are non-modal by default. .\" .IP \(bu .\" The \fBtk_messageBox\fR command is blocking: .\" it does not return until the user presses one of the command buttons. .\" \fBttk::dialog\fR returns immediately after creating the dialog box. .SH EXAMPLE .CS proc saveFileComplete {button} { switch -- $button { yes { # save file ... } no { exit } cancel { # no-op } } } ttk::dialog .saveFileDialog \e -title "Save file?" \e -icon question \e -message "Save file before closing?" \e -detail "If you do not save the file, your work will be lost" \e -buttons [list yes no cancel] \e -labels [list yes "Save file" no "Don't save"] \e -command saveFileComplete \e ; .CE .SH "SEE ALSO" tk_messageBox(n), wm(n), toplevel(n) tile-0.8.2/doc/entry.n0000644000076500007650000004363410532475536014155 0ustar joejoe00000000000000'\" '\" SOURCE: entry.n, r1.12 '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .so man.macros .TH entry n 0.4 tile "Tile Widget Set" .BS .SH NAME ttk::entry \- Editable text field widget .SH SYNOPSIS \fBttk::entry\fR \fIpathName \fR?\fIoptions\fR? .SH DESCRIPTION .PP An \fBentry\fR widget displays a one-line text string and allows that string to be edited by the user. The value of the string may be linked to a Tcl variable with the \fB-textvariable\fR option. Entry widgets support horizontal scrolling with the standard \fB-xscrollcommand\fR option and \fBxview\fR widget command. .SO \-class \-cursor \-style \-takefocus \-xscrollcommand .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-exportselection exportSelection ExportSelection A boolean value specifying whether or not a selection in the widget should be linked to the X selection. If the selection is exported, then selecting in the widget deselects the current X selection, selecting outside the widget deselects any widget selection, and the widget will respond to selection retrieval requests when it has a selection. .\" MAYBE: .OP \-font font Font .\" MAYBE: .OP \-foreground foreground Foreground .\" MAYBE: .OP \-insertbackground insertBackground Foreground .\" MAYBE: .OP \-insertwidth insertWidth InsertWidth .OP \-invalidcommand invalidCommand InvalidCommand A script template to evaluate whenever the \fBvalidateCommand\fR returns 0. See \fBVALIDATION\fR below for more information. .OP \-justify justify Justify Specifies how the text is aligned within the entry widget. One of \fBleft\fR, \fBcenter\fR, or \fBright\fR. .\" MAYBE: .OP \-selectbackground selectBackground Foreground .\" MAYBE: .OP \-selectborderwidth selectBorderWidth BorderWidth .\" MAYBE: .OP \-selectforeground selectForeground Background .OP \-show show Show If this option is specified, then the true contents of the entry are not displayed in the window. Instead, each character in the entry's value will be displayed as the first character in the value of this option, such as ``*''. This is useful, for example, if the entry is to be used to enter a password. If characters in the entry are selected and copied elsewhere, the information copied will be what is displayed, not the true contents of the entry. .OP \-state state State Compatibility option; see \fBwidget(n)\fR for details. Specifies one of three states for the entry, \fBnormal\fR, \fBdisabled\fR, or \fBreadonly\fR. See \fBWIDGET STATES\fR, below. .OP \-textvariable textVariable Variable Specifies the name of a variable whose value is linked to the entry widget's contents. Whenever the variable changes value, the widget's contents are updated, and vice versa. .OP \-validate validate Validate Specifies the mode in which validation should operate: \fBnone\fR, \fBfocus\fR, \fBfocusin\fR, \fBfocusout\fR, \fBkey\fR, or \fBall\fR. Default is \fBnone\fR, meaning that validation is disabled. See \fBVALIDATION\fR below. .OP \-validatecommand validateCommand ValidateCommand A script template to evaluate whenever validation is triggered. If set to the empty string (the default), validation is disabled. The script must return a boolean value. See \fBVALIDATION\fR below. .OP \-width width Width Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font. .\" Not in tile: If the value is less than or equal to zero, the widget picks a .\" Not in tile: size just large enough to hold its current text. .BE .SH NOTES A portion of the entry may be selected as described below. If an entry is exporting its selection (see the \fBexportSelection\fR option), then it will observe the standard X11 protocols for handling the selection; entry selections are available as type \fBSTRING\fR. Entries also observe the standard Tk rules for dealing with the input focus. When an entry has the input focus it displays an \fIinsert cursor\fR to indicate where new characters will be inserted. .PP Entries are capable of displaying strings that are too long to fit entirely within the widget's window. In this case, only a portion of the string will be displayed; commands described below may be used to change the view in the window. Entries use the standard \fBxScrollCommand\fR mechanism for interacting with scrollbars (see the description of the \fBxScrollCommand\fR option for details). .SH "INDICES" Many of the \fBentry\fR widget commands take one or more indices as arguments. An index specifies a particular character in the entry's string, in any of the following ways: .IP \fInumber\fR Specifies the character as a numerical index, where 0 corresponds to the first character in the string. .IP \fB@\fInumber\fR In this form, \fInumber\fR is treated as an x-coordinate in the entry's window; the character spanning that x-coordinate is used. For example, ``\fB@0\fR'' indicates the left-most character in the window. .IP \fBend\fR Indicates the character just after the last one in the entry's string. This is equivalent to specifying a numerical index equal to the length of the entry's string. .IP \fBinsert\fR Indicates the character adjacent to and immediately following the insert cursor. .IP \fBsel.first\fR Indicates the first character in the selection. It is an error to use this form if the selection isn't in the entry window. .IP \fBsel.last\fR Indicates the character just after the last one in the selection. It is an error to use this form if the selection isn't in the entry window. .LP Abbreviations may be used for any of the forms above, e.g. ``\fBe\fR'' or ``\fBsel.f\fR''. In general, out-of-range indices are automatically rounded to the nearest legal value. .SH "WIDGET COMMAND" .PP The following commands are possible for entry widgets: .TP \fIpathName \fBbbox \fIindex\fR Returns a list of four numbers describing the bounding box of the character given by \fIindex\fR. The first two elements of the list give the x and y coordinates of the upper-left corner of the screen area covered by the character (in pixels relative to the widget) and the last two elements give the width and height of the character, in pixels. The bounding box may refer to a region outside the visible area of the window. .TP \fIpathName \fBcget\fR \fIoption\fR Returns the current value of the specified \fIoption\fR. See \fIwidget(n)\fR. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? Modify or query widget options. See \fIwidget(n)\fR. .TP \fIpathName \fBdelete \fIfirst \fR?\fIlast\fR? Delete one or more elements of the entry. \fIFirst\fR is the index of the first character to delete, and \fIlast\fR is the index of the character just after the last one to delete. If \fIlast\fR isn't specified it defaults to \fIfirst\fR+1, i.e. a single character is deleted. This command returns the empty string. .TP \fIpathName \fBget\fR Returns the entry's string. .TP \fIpathName \fBicursor \fIindex\fR Arrange for the insert cursor to be displayed just before the character given by \fIindex\fR. Returns the empty string. .TP \fIpathName \fBidentify \fIx y\fR Returns the name of the element at position \fIx\fR, \fIy\fR, or the empty string if the coordinates are outside the window. .TP \fIpathName \fBindex\fI index\fR Returns the numerical index corresponding to \fIindex\fR. .TP \fIpathName \fBinsert \fIindex string\fR Insert \fIstring\fR just before the character indicated by \fIindex\fR. Returns the empty string. .TP \fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? Test the widget state. See \fIwidget(n)\fR. .TP \fIpathName \fBselection \fIoption arg\fR This command is used to adjust the selection within an entry. It has several forms, depending on \fIoption\fR: .RS .TP \fIpathName \fBselection clear\fR Clear the selection if it is currently in this widget. If the selection isn't in this widget then the command has no effect. Returns the empty string. .TP \fIpathName \fBselection present\fR Returns 1 if there is are characters selected in the entry, 0 if nothing is selected. .TP \fIpathName \fBselection range \fIstart\fR \fIend\fR Sets the selection to include the characters starting with the one indexed by \fIstart\fR and ending with the one just before \fIend\fR. If \fIend\fR refers to the same character as \fIstart\fR or an earlier one, then the entry's selection is cleared. .RE .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? Modify or query the widget state. See \fIwidget(n)\fR. .TP \fIpathName \fBvalidate\fR Force revalidation, independent of the conditions specified by the \fB-validate\fR option. Returns 0 if validation fails, 1 if it succeeds. Sets or clears the \fBinvalid\fR state accordingly. .TP \fIpathName \fBxview \fIargs\fR This command is used to query and change the horizontal position of the text in the widget's window. It can take any of the following forms: .RS .TP \fIpathName \fBxview\fR Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the entry's text is off-screen to the left, the middle 40% is visible in the window, and 40% of the text is off-screen to the right. These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR option. .TP \fIpathName \fBxview\fR \fIindex\fR Adjusts the view in the window so that the character given by \fIindex\fR is displayed at the left edge of the window. .TP \fIpathName \fBxview moveto\fI fraction\fR Adjusts the view in the window so that the character \fIfraction\fR of the way through the text appears at the left edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. \fIWhat\fR must be either \fBunits\fR or \fBpages\fR. '\" or an abbreviation of one of these, but we don't document that. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by \fInumber\fR average-width characters on the display; if it is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. .RE .SH VALIDATION The \fB-validate\fR, \fB-validatecommand\fR, and \fB-invalidcommand\fR options are used to enable entry widget validation. .SS "VALIDATION MODES" There are two main validation modes: \fIprevalidation\fR, in which the \fB-validatecommand\fR is evaluated prior to each edit and the return value is used to determine whether to accept or reject the change; and \fIrevalidation\fR, in which the \fB-validatecommand\fR is evaluated to determine whether the current value is valid. .PP The \fB-validate\fR option determines when validation occurs; it may be set to any of the following values: .IP \fBnone\fR Default. This means validation will only occur when specifically requested by the \fBvalidate\fR widget command. .IP \fBkey\fR The entry will be prevalidated prior to each edit (specifically, whenever the \fBinsert\fR or \fBdelete\fR widget commands are called). If prevalidation fails, the edit is rejected. .IP \fBfocus\fR The entry is revalidated when the entry receives or loses focus. .IP \fBfocusin\fR The entry is revalidated when the entry receives focus. .IP \fBfocusout\fR The entry is revalidated when the entry loses focus. .IP \fBall\fR Validation is performed for all above conditions. .PP The \fB-invalidcommand\fR is evaluated whenever the \fB-validatecommand\fR returns a false value. .PP The \fB-validatecommand\fR and \fB-invalidcommand\fR may modify the entry widget's value via the widget \fBinsert\fR or \fBdelete\fR commands, or by setting the linked \fB-textvariable\fR. If either does so during prevalidation, then the edit is rejected regardless of the value returned by the \fB-validatecommand\fR. .PP If \fB-validatecommand\fR is empty (the default), validation always succeeds. .SS "VALIDATION SCRIPT SUBSTITUTIONS" It is possible to perform percent substitutions on the \fB-validatecommand\fR and \fBinvalidCommand\fR, just as in a \fBbind\fR script. The following substitutions are recognized: .IP \fB%d\fR Type of action: 1 for \fBinsert\fR prevalidation, 0 for \fBdelete\fR prevalidation, or -1 for revalidation. .IP \fB%i\fR Index of character string to be inserted/deleted, if any, otherwise -1. .IP \fB%P\fR In prevalidation, the new value of the entry if the edit is accepted. In revalidation, the current value of the entry. .IP \fB%s\fR The current value of entry prior to editing. .IP \fB%S\fR The text string being inserted/deleted, if any, {} otherwise. .IP \fB%v\fR The current value of the \fB-validate\fR option. .IP \fB%V\fR The validation condition that triggered the callback (\fBkey\fR, \fBfocusin\fR, \fBfocusout\fR, or \fBforced\fR). .IP \fB%W\fR The name of the entry widget. .SS "DIFFERENCES FROM TK ENTRY WIDGET VALIDATION" .IP \(bu The standard Tk entry widget automatically disables validation (by setting \fB-validate\fR to \fBnone\fR) if the \fB-validatecommand\fR or \fB-invalidcommand\fR modifies the entry's value. The Tile entry widget only disables validation if one of the validation scripts raises an error, or if \fB-validatecommand\fR does not return a valid boolean value. (Thus, it is not necessary to reenable validation after modifying the entry value in a validation script). .IP \(bu The standard entry widget invokes validation whenever the linked \fB-textvariable\fR is modified; the Tile entry widget does not. .SH "DEFAULT BINDINGS" The entry widget's default bindings enable the following behavior. In the descriptions below, ``word'' refers to a contiguous group of letters, digits, or ``_'' characters, or any single character other than these. .IP \(bu Clicking mouse button 1 positions the insert cursor just before the character underneath the mouse cursor, sets the input focus to this widget, and clears any selection in the widget. Dragging with mouse button 1 down strokes out a selection between the insert cursor and the character under the mouse. .IP \(bu Double-clicking with mouse button 1 selects the word under the mouse and positions the insert cursor at the end of the word. Dragging after a double click strokes out a selection consisting of whole words. .IP \(bu Triple-clicking with mouse button 1 selects all of the text in the entry and positions the insert cursor at the end of the line. .IP \(bu The ends of the selection can be adjusted by dragging with mouse button 1 while the Shift key is down. If the button is double-clicked before dragging then the selection will be adjusted in units of whole words. .IP \(bu Clicking mouse button 1 with the Control key down will position the insert cursor in the entry without affecting the selection. .IP \(bu If any normal printing characters are typed in an entry, they are inserted at the point of the insert cursor. .IP \(bu The view in the entry can be adjusted by dragging with mouse button 2. If mouse button 2 is clicked without moving the mouse, the selection is copied into the entry at the position of the mouse cursor. .IP \(bu If the mouse is dragged out of the entry on the left or right sides while button 1 is pressed, the entry will automatically scroll to make more text visible (if there is more text off-screen on the side where the mouse left the window). .IP \(bu The Left and Right keys move the insert cursor one character to the left or right; they also clear any selection in the entry. If Left or Right is typed with the Shift key down, then the insertion cursor moves and the selection is extended to include the new character. Control-Left and Control-Right move the insert cursor by words, and Control-Shift-Left and Control-Shift-Right move the insert cursor by words and also extend the selection. Control-b and Control-f behave the same as Left and Right, respectively. .IP \(bu The Home key and Control-a move the insert cursor to the beginning of the entry and clear any selection in the entry. Shift-Home moves the insert cursor to the beginning of the entry and extends the selection to that point. .IP \(bu The End key and Control-e move the insert cursor to the end of the entry and clear any selection in the entry. Shift-End moves the cursor to the end and extends the selection to that point. .IP \(bu Control-/ selects all the text in the entry. .IP \(bu Control-\e clears any selection in the entry. .IP \(bu The standard Tk <>, <>, <>, and <> virtual events operate on the selection in the expected manner. .IP \(bu The Delete key deletes the selection, if there is one in the entry. If there is no selection, it deletes the character to the right of the insert cursor. .IP \(bu The BackSpace key and Control-h delete the selection, if there is one in the entry. If there is no selection, it deletes the character to the left of the insert cursor. .IP \(bu Control-d deletes the character to the right of the insert cursor. .IP \(bu Control-k deletes all the characters to the right of the insertion cursor. .SH "WIDGET STATES" In the \fBdisabled\fR state, the entry cannot be edited and the text cannot be selected. In the \fBreadonly\fR state, no insert cursor is displayed and the entry cannot be edited (specifically: the \fBinsert\fR and \fBdelete\fR commands have no effect). The \fBdisabled\fR state is the same as \fBreadonly\fR, and in addition text cannot be selected. .PP Note that changes to the linked \fB-textvariable\fR will still be reflected in the entry, even if it is disabled or readonly. .PP Typically, the text is "grayed-out" in the \fBdisabled\fR state, and a different background is used in the \fBreadonly\fR state. .PP The entry widget sets the \fBinvalid\fR state if revalidation fails, and clears it whenever validation succeeds. .SH KEYWORDS entry, widget, text field tile-0.8.2/doc/frame.n0000644000076500007650000000261310532475536014076 0ustar joejoe00000000000000'\" Copyright (c) 2005 Joe English .so man.macros .TH frame n 0.7 tile "Tile Widget Set" .BS .SH NAME ttk::frame \- Simple container widget .SH SYNOPSIS \fBttk::frame\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBframe\fR widget is a container, used to group other widgets together. .SO \-class \-cursor \-takefocus \-style .SE .SH "OPTIONS" .OP -borderwidth borderWidth BorderWidth The desired width of the widget border. Defaults to 0. .OP -relief relief Relief One of the standard Tk border styles: \fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR, \fBsolid\fR, or \fBsunken\fR. Defaults to \fBflat\fR. .OP -padding padding Padding Additional padding to include inside the border. .OP -width width Width If specified, the widget's requested width in pixels. .OP -height height Height If specified, the widget's requested height in pixels. .SH "WIDGET COMMAND" Supports the standard widget commands \fBconfigure\fR, \fBcget\fR, \fBinstate\fR, and \fBstate\fR; see \fIwidget(n)\fR. .SH "NOTES" Note that if the \fBpack\fR, \fBgrid\fR, or other geometry managers are used to manage the children of the \fBframe\fR, by the GM's requested size will normally take precedence over the \fBframe\fR widget's \fB-width\fR and \fB-height\fR options. [\fBpack propagate\fR] and [\fBgrid propagate\fR] can be used to change this. .SH "SEE ALSO" widget(n), labelframe(n) .SH "KEYWORDS" widget, frame, container tile-0.8.2/doc/image.n0000644000076500007650000000575610536621136014072 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" image.n,v 1.3 2006/12/09 20:53:50 jenglish Exp '\" .so man.macros .TH image n 0.8 tile "Tile Widget Set" .BS .SH NAME ttk_image \- Define an element based on an image .SH SYNOPSIS \fBstyle element create \fIname\fR \fBimage\fR \fIimageSpec\fR ?\fIoptions\fR? .BE .SH DESCRIPTION The \fIimage\fR element factory creates a new element in the current theme whose visual appearance is determined by Tk images. \fIimageSpec\fP is a list of one or more elements. The first element is the default image name. The rest of the list is a sequence of \fIstatespec / value\fR pairs specifying other images to use when the element is in a particular state or combination of states. .SH OPTIONS Valid \fIoptions\fR are: .TP \fB-border\fR \fIpadding\fR \fIpadding\fR is a list of up to four integers, specifying the left, top, right, and bottom borders, respectively. See \fBIMAGE STRETCHING\fR, below. .TP \fB-height \fIheight\fR Specifies a minimum height for the element. If less than zero, the base image's height is used as a default. .\" -map no longer needed, first argument is an imageSpec now. .\" .TP .\" \fB-map { \fIstatespec\fP \fIimage\fP.. } .\" Specifies auxilliary images to use in different states. .\" Each \fIstatespec\fP is a list of state names optionally .\" prefixed by an exclamation point, as in \fBstyle map\fP. .\" Each \fIimageName\fP is the name of a Tk image .\" defined with \fBimage create ...\fP. .\" When the element is displayed, each \fIstatespec\fP is .\" tested in order, and the \fIimage\fP corresponding to .\" the first matching \fIstatespec\fP is used. .\" If none match, the base \fIimageName\fP is used. .TP \fB-padding\fR \fIpadding\fR Specifies the element's interior padding. Defaults to \fI-border\fR if not specified. .TP \fB-sticky\fR \fIspec\fR Specifies how the image is placed within the final parcel. \fIspec\fR contains zero or more characters "n", "s", "w", or "e". .TP \fB-width \fIwidth\fR Specifies a minimum width for the element. If less than zero, the base image's width is used as a default. .SH "IMAGE STRETCHING" If the element's allocated parcel is larger than the image, the image will be placed in the parcel based on the \fB-sticky\fR option. If the image needs to stretch horizontally (i.e., \fB-sticky ew\fR) or vertically (\fB-sticky ns\fR), subregions of the image are replicated to fill the parcel based on the \fB-border\fR option. The \fB-border\fR divides the image into 9 regions: four fixed corners, top and left edges (which may be tiled horizontally), left and right edges (which may be tiled vertically), and the central area (which may be tiled in both directions). .SH "EXAMPLE" .CS set img1 [image create photo -file button.png] set img2 [image create photo -file button-pressed.png] set img3 [image create photo -file button-active.png] style element create Button.button image \e [list $img1 pressed $img2 active $img3] \e -border {2 4} -sticky we .CE .SH "SEE ALSO" image(n), photo(n) .SH KEYWORDS pixmap theme, image tile-0.8.2/doc/internals.txt0000644000076500007650000003417210713452110015352 0ustar joejoe00000000000000 [10 Sep 2005] A tour of the Tile internals. There are roughly four major parts to the tile codebase: the theme engine, the widget framework, widget implementations, and theme implementations. What follows is a braindump describing the current codebase and a few future directions. See also http://tktable.sourceforge.net/tile/tile-tcl2004.pdf for a high-level overview of the architecture. THEME ENGINE tkTheme.h -- Public header file. Start here. tkThemeInt.h -- Private header file. Don't look at it :-) tkstate.c -- Routines for manipulating state specifications, state maps, state tables, and other things state-related. Future directions: Looks like this could use some more comments. Very old code; hasn't been revisited (or needed to be) for a long time. tkTheme.c -- The core of the theme engine. This started life as a modified copy of the TIP#48 style support code, but has been revised and expanded since then. The background and rationale from TIP#48 still apply, but the details are quite different now. The main new features relative to the original implementation are: a style database that's used to compute element option values (previously element implementations were responsible for doing this themselves); a layout engine for computing the size and position of a group of elements (see layout.c); and script-level access to both of the above. Future directions: It's been through three or four major refactorings so far, and could probably use one more. The data structures are still more complicated than they need to be. Things are currently neither optimized for space nor for speed, but could be modified to go either way. To save space, greater use of the Flyweight pattern is possible. Alternately, to speed things up, it could cache more internal state. Since the tile widgets don't seem to be too slow on the one hand or too memory-hungry on the other, as long as no performance problems arise this will probably stay as it is. I really, really want to nuke the call to TkGetOptionSpec(). This one line of code has caused more headaches than anything else (with the possible exception of Aqua support). layout.c -- This contains the layout engine. The basic algorithm is the same as the [pack] geometry manager. Future directions: Needs to be split into two pieces, one for the low-level Ttk_Box / Ttk_Padding routines, and the other for the Ttk_Layout implementation proper. As above, the data structures could probably use another refactoring and reorganization. The TTK_EXPAND flag should probably go away. The TTK_BORDER flag is probably not needed either. cache.c -- A resource cache for fonts, colors and other resources. See comments at the top of the file for full details, but the basic problem is: Tk frees fonts and colors whenever the last reference to them goes away; but the style engine accesses these resources on a just-in-time basis and releases them immediately afterwards. This is *very* expensive. The cache holds a semi-permanent reference to resources accessed by the style engine to prevent Tk from freeing them prematurely. Future directions: Preferably, change Tk's (de)allocation policies so that this workaround isn't necessary. Possibly -- but only under great duress -- add support for non-default visuals and colormaps. I really don't want to do this, since it adds a ton of complexity for a feature that nobody uses anymore. image.c -- Implements the 'style element create image' command, an element factory for defining "pixmap" themes. tile.c -- Package initialization routine, plus sort of a dumping ground for miscellaneous stuff that didn't fit anywhere else. WIDGET FRAMEWORK widget.h widget.c -- This module (and the ones below) attempt to encapsulate all of the boilerplate logic involved in a widget implementation. The central data structure is 'struct WidgetSpec_', which consists mostly of a number of callback hooks (or "strategy methods") called at various times during the widget lifecycle. Future directions: This isn't namespace-clean; public entry points, typedefs, and #defines need a Ttk prefix. There are strict rules about when each hook is called and what each hook must, may, and may not do. I need to write these rules down somewhere. scroll.c -- Attempts to encapsulates the control flow logic involved in scrolling widgets. Future directions: This is only half-baked. Needs more work. manager.h manager.c -- Utilities for writing geometry managers; used by the ttk::notebook and ttk::paned widgets. Handles the geometry propagation dance control flow logic and the nasty details about slave removal. Future directions: the Ttk_Manager and Ttk_Slave data structures need to be made opaque. Some of the function signatures are Not Quite Right. The "SlaveConfigured" hook and Ttk_ConfigureSlave() function probably don't belong here; configuration is better left to the caller. Once these are gone, the SlaveAdded hook can go away too, leaving a cleaner and simpler interface. Long-term: write a TIP to push this interface (or one like it) all the way into the core to replace the current Tk_GeomMgr API. This API is a lot easier to use, and has the potential to solve some longstanding problems (e.g., the "pack vs. grid" conflict). trace.c -- A thin wrapper/convenience layer around Tcl_TraceVar() and friends; used by widgets that have linked -variable / -textvariable options. Future directions: minor cleanups, namespace prefix (may already be done by the time you read this, it's near the top of my pile.) track.c -- Routine TrackElementState(). Used by ttk::scrollbars and other widgets where individual elements may be pressed / active instead of the widget as a whole. See header comments for details. blink.c -- Routine BlinkCursor -- registers an event handler / timer callback to blink the cursor on and off when the widget has focus. See header comments for details. WIDGET IMPLEMENTATIONS button.c / button.tcl -- Labels, buttons, checkbuttons, and radiobuttons. Not much to say about these, except that it's worthwhile comparing the Tile implementation with how the core does things. Seriously. This is the best demonstration I can think of for why I think the Tile approach is on the right track. frame.c -- Frames and labelframes. Not much to say here either. Future directions: frame widget: None. This is a simple widget, and shall remain simple. Future directions: labelframe widget: Should use the Ttk_Manager API to manage the -labelwidget. There are several alternate display style possibilities that ought to be, but are currently not, implementable with this widget (see recent discussion on tktable-tile-dev for details). entry.c -- Entry and combobox widgets. The entry widget presented something of a challenge, since the bulk of the display is handled by the widget itself instead of by an element. The theme engine doesn't support "owner-draw" widgets very well (yet). Future directions: Reuse the "scroll.c" API to manage the -xscrollcommand (once the former has been fixed). Remove the backwards-compatibility methods 'scan mark', 'scan dragto', 'selection to', and 'selection adjust'. These are unused (and actually a bad idea). It ought to be possible to build a spinbox widget on top of the [ttk::entry] entirely in Tcl code. And a searchbox widget, and a URL bar, and a bunch of other customized entry-like widgets. I don't think that's possible right now, but it ought to be. combobox: Add library routines to enable autocompletion (must be flexible, as there are lots of different autocompletion styles; a single -autocomplete true|false option will not suffice.) Fix the focus problems on OSX, Windows, and certain X11 WMs. (This might require core patches; I haven't had any luck yet.) notebook.c -- ttk::notebook widget. Future directions: Right now the widget can't do Firefox-style tabs (with a 'close' gizmo on the tab) or Mozilla-style notebooks (with a 'close' gizmo in the upper corner). Both of these should be possible, but currently aren't. Features that will not be implemented: Multiple rows of tabs, scrolling tabs. Both of these options were considered and rejected. paned.c -- ttk::paned widget. Future directions: Jeff wants to rename this to "ttk::panedwindow". Support for "collapse buttons" and other sash controls. progress.c -- ttk::progressbar widget. Future directions: I want to rename this back to "ttk::progress". There are a couple of alternate display styles (OSX-style chasing arrows, throbbers, etc.) that ought to be supported cross-theme with common custom styles. scale.c -- ttk::scale widget. This one isn't finished yet. Future directions: Finish the widget. (See recent tktable-tile-dev discussions for API considerations). scrollbar.c -- ttk::scrollbar widget. Future directions: Native appearance on OSX. This is turning out to be very difficult to do, because of an impedance mismatch with the way Carbon wants to do things. separator.c -- A separator. Use this instead of 0-width frames to get a separator, the latter doesn't look right. treeview.c -- A multi-column hierarchical display. This one isn't finished yet. Future directions: I want this widget to be something a bit more powerful than the BWidget Tree, but still simpler than TkTreeCtrl. That's a useful ecological niche that seems to be unoccupied. The trick is to find the right set of primitive features -- there are a million things you can do with a Tree, but I don't want to have a million options and subcommands. Right now I'm looking at: + Add item tags (similar to text and canvas tags) to give applications more control over appearance; + Add tag event bindings for more control over behavior; and + Fix custom style support (see #1168548). I think that'll do it. Then there's the stuff that's just plain misimplemented -- it should compute item and heading heights from the layout instead of hardcoding them; need to replace the hairball [$tv identify $x $y] command with something reasonable; horizontal scrolling doesn't work; etc... THEME IMPLEMENTATIONS tkElements.c -- Default implementations for most elements, and layout specifications for the "default" / fallback theme. Future directions: This sort of evolved over time as new widgets were added and different approaches to building them were tried out; there's little evidence of intelligent design. This could stand to be reviewed and revised with an eye to consistency and orthogonalization. Ought to remove dependencies on 'Tk_3DBorder's and related routines. label.c -- Implementation of the "text", "image", and "label" elements. This is complicated enough that it warranted being split out into its own file. Future directions: May remove auto-stippling of 'image' elements; this is a lot of effort for a feature that probably shouldn't be implemented in the first place. (Tile widgets provide a more flexible way to specify state-dependent images.) classicTheme.c -- Tk classic look and feel; 1990s-era Motif. Future directions: I might eventually get around to fixing the ttk::button default ring. altTheme.c -- The "alt" / "revitalized" theme. Follows the Windows MSUE guidelines (pre-XP); visually compatible with 1998-era GNOME and KDE. Future directions: Notebook tabs aren't right; there's a performance issue with checkbutton and radiobutton indicators. clamTheme.c -- The "clam" theme; inspired by the XFCE family of GTK+ themes. Future directions: I was going to get rid of this entirely, but due to popular demand it'll be retained. Much of the implementation is rather ad-hoc; it could be refined and streamlined. aquaTheme.c -- Platform-specific theme for OSX. Future directions: Lots of stuff still isn't right here. Still uses the old style of notebook tabs (from OSX "Bobcat") instead of the newer segmented control (from OSX "Ocelot"). Native scrollbars aren't implemented at all (tough to solve). Only supports one style of window background (nested groupboxes, "brushed metal" style, etc., aren't supported). Very tough to solve. winTheme.c -- Platform-specific theme for Windows (pre-XP). Future directions: Spacing parameters might need a bit of tweaking, other than that it seems to be in good shape. xpTheme.c -- Platform-specific theme for Windows (post-XP). Future directions: Same as above; spacing might be a little off, other than that it looks OK. stepTheme.c -- Modelled after the GNUStep/NextStep look and feel; also an experimental playground for trying out new stuff. Future directions: Unless anybody is using this in production, it will probably be shuffled off into the "demos" directory as an example of a dynamically-loadable theme. MISCELLANEOUS: ttkDecls.h ttkStubInit.c ttkStubLib.c -- The stub library; can be used to implement loadable themes written in C. * * * IMPORTANT NOTICE * * * The tile stub table is generated with a modified version of genstubs.tcl. There are a number of small but important differences in the way the Ttk stubs table works, that are intended to make future evolution easier. compat.h -- A ghastly autogenerated mess of C preprocessor macros used to implement the Tk 8.4 compatibility options. This is so people could say "namespace import -force tile::*" in existing applications without immediately breaking everything. (Note: if anyone is still doing that, STOP!) Future directions: Going away. May be gone by the time you read this. gunk.h -- Miscellaneous portability gunk that I had to add to get stuff to compile on various platforms and against different Tcl/Tk distributions. Future directions: Needs to be killed. win/monitor.c -- WIN32 voodoo. Used to detect when the user has switched desktop themes or color schemes. win/nmakehlp.c -- To be honest, I don't know what this is for :-) Has something to do with the MSVC-based build system. tile-0.8.2/doc/label.n0000644000076500007650000000462710532475536014072 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH label n 0.2 tile "Tile Widget Set" .BS .SH NAME ttk::label \- Display a text string and/or image .SH SYNOPSIS \fBttk::label\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBlabel\fR widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text. .SO \-class \-compound \-cursor \-image \-style \-takefocus \-text \-textvariable \-underline \-width .SE .SH "OPTIONS" .OP \-anchor anchor Anchor Specifies how the information in the widget is positioned relative to the inner margins. Legal values are \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, and \fBcenter\fR. See also \fB-justify\fR. .OP \-background frameColor FrameColor The widget's background color. If unspecified, the theme default is used. .OP \-font font Font Font to use for label text. .OP \-foreground textColor TextColor The widget's foreground color. If unspecified, the theme default is used. .OP \-justify justify Justify If there are multiple lines of text, specifies how the lines are laid out relative to one another. One of \fBleft\fR, \fBcenter\fR, or \fBright\fR. See also \fB-anchor\fR. .OP \-padding padding Padding Specifies the amount of extra space to allocate for the widget. The padding is a list of up to four length specifications \fIleft top right bottom\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. .OP \-relief relief Relief .\" Rewrite this: Specifies the 3-D effect desired for the widget border. Valid values are \fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR, \fBsolid\fR, and \fBsunken\fR. .OP \-text text Text Specifies a text string to be displayed inside the widget (unless overridden by \fB-textvariable\fR). .OP \-wraplength wrapLength WrapLength Specifies the maximum line length (in pixels). If this option is less than or equal to zero, then automatic wrapping is not performed; otherwise the text is split into lines such that no line is longer than the specified value. .SH "WIDGET COMMAND" .TP \fIpathName \fBcget\fR \fIoption\fR .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? .TP \fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? See \fIwidget(n)\fR .SH "SEE ALSO" widget(n) tile-0.8.2/doc/labelframe.n0000644000076500007650000000520710532475536015100 0ustar joejoe00000000000000'\" Copyright (c) 2005 Joe English .so man.macros .TH labelframe n 0.7 tile "Tile Widget Set" .BS .SH NAME ttk::labelframe \- Container widget with optional label .SH SYNOPSIS \fBttk::labelframe\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBlabelframe\fR widget is a container used to group other widgets together. It has an optional label, which may be a plain text string or another widget. .SO \-class \-cursor \-takefocus \-style .SE .SH "OPTIONS" '\" XXX: Currently included, but may go away: '\" XXX: .OP -borderwidth borderWidth BorderWidth '\" XXX: The desired width of the widget border. Default is theme-dependent. '\" XXX: .OP -relief relief Relief '\" XXX: One of the standard Tk border styles: '\" XXX: \fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR, '\" XXX: \fBsolid\fR, or \fBsunken\fR. '\" XXX: Default is theme-dependent. .OP -labelanchor labelAnchor LabelAnchor Specifies where to place the label. Allowed values are (clockwise from the top upper left corner): \fBnw\fR, \fBn\fR, \fBne\fR, \fBen\fR, \fBe\fR, \fBes\fR, \fBse\fR, \fBs\fR,\fBsw\fR, \fBws\fR, \fBw\fR and \fBwn\fR. The default value is theme-dependent. '\" Alternate explanation: The first character must be one of n, s, e, or w '\" and specifies which side the label should be placed on; '\" the remaining characters specify how the label is aligned on that side. '\" NOTE: Now allows other values as well; leave this undocumented for now .OP -text text Text Specifies the text of the label. .OP -underline underline Underline If set, specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation (see \fIkeynav(n)\fR). Mnemonic activation for a \fBttk::labelframe\fR sets the keyboard focus to the first child of the \fBttk::labelframe\fR widget. .OP -padding padding Padding Additional padding to include inside the border. .OP -labelwidget labelWidget LabelWidget The name of a widget to use for the label. If set, overrides the \fB-text\fR option. The \fB-labelwidget\fR must be a child of the \fBlabelframe\fR widget or one of the \fBlabelframe\fR's ancestors, and must belong to the same top-level widget as the \fBlabelframe\fR. .OP -width width Width If specified, the widget's requested width in pixels. .OP -height height Height If specified, the widget's requested height in pixels. (See \fIttk::frame\fR for further notes on \fB-width\fR and \fB-height\fR). .SH "WIDGET COMMAND" Supports the standard widget commands \fBconfigure\fR, \fBcget\fR, \fBinstate\fR, and \fBstate\fR; see \fIwidget(n)\fR. .SH "SEE ALSO" widget(n), frame(n) .SH "KEYWORDS" widget, frame, container, label, groupbox tile-0.8.2/doc/man.macros0000644000076500007650000001163110125145403014567 0ustar joejoe00000000000000'\" '\" SOURCE: tcl/doc/man.macros r1.4 2000/08/25 '\" CHANGES: '\" SO tab settings reverted to earlier definition (4 columns instead of 3). .\" Remove the "See the options(n) manpage..." message from SE. '\" '\" The definitions below are for supplemental macros used in Tcl/Tk '\" manual entries. '\" '\" .AP type name in/out ?indent? '\" Start paragraph describing an argument to a library procedure. '\" type is type of argument (int, etc.), in/out is either "in", "out", '\" or "in/out" to describe whether procedure reads or modifies arg, '\" and indent is equivalent to second arg of .IP (shouldn't ever be '\" needed; use .AS below instead) '\" '\" .AS ?type? ?name? '\" Give maximum sizes of arguments for setting tab stops. Type and '\" name are examples of largest possible arguments that will be passed '\" to .AP later. If args are omitted, default tab stops are used. '\" '\" .BS '\" Start box enclosure. From here until next .BE, everything will be '\" enclosed in one large box. '\" '\" .BE '\" End of box enclosure. '\" '\" .CS '\" Begin code excerpt. '\" '\" .CE '\" End code excerpt. '\" '\" .VS ?version? ?br? '\" Begin vertical sidebar, for use in marking newly-changed parts '\" of man pages. The first argument is ignored and used for recording '\" the version when the .VS was added, so that the sidebars can be '\" found and removed when they reach a certain age. If another argument '\" is present, then a line break is forced before starting the sidebar. '\" '\" .VE '\" End of vertical sidebar. '\" '\" .DS '\" Begin an indented unfilled display. '\" '\" .DE '\" End of indented unfilled display. '\" '\" .SO '\" Start of list of standard options for a Tk widget. The '\" options follow on successive lines, in four columns separated '\" by tabs. '\" '\" .SE '\" End of list of standard options for a Tk widget. '\" '\" .OP cmdName dbName dbClass '\" Start of description of a specific option. cmdName gives the '\" option's name as specified in the class command, dbName gives '\" the option's name in the option database, and dbClass gives '\" the option's class in the option database. '\" '\" .UL arg1 arg2 '\" Print arg1 underlined, then print arg2 normally. '\" '\" '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. .if t .wh -1.3i ^B .nr ^l \n(.l .ad b '\" # Start an argument description .de AP .ie !"\\$4"" .TP \\$4 .el \{\ . ie !"\\$2"" .TP \\n()Cu . el .TP 15 .\} .ta \\n()Au \\n()Bu .ie !"\\$3"" \{\ \&\\$1 \\fI\\$2\\fP (\\$3) .\".b .\} .el \{\ .br .ie !"\\$2"" \{\ \&\\$1 \\fI\\$2\\fP .\} .el \{\ \&\\fI\\$1\\fP .\} .\} .. '\" # define tabbing values for .AP .de AS .nr )A 10n .if !"\\$1"" .nr )A \\w'\\$1'u+3n .nr )B \\n()Au+15n .\" .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n .nr )C \\n()Bu+\\w'(in/out)'u+2n .. .AS Tcl_Interp Tcl_CreateInterp in/out '\" # BS - start boxed text '\" # ^y = starting y location '\" # ^b = 1 .de BS .br .mk ^y .nr ^b 1u .if n .nf .if n .ti 0 .if n \l'\\n(.lu\(ul' .if n .fi .. '\" # BE - end boxed text (draw box now) .de BE .nf .ti 0 .mk ^t .ie n \l'\\n(^lu\(ul' .el \{\ .\" Draw four-sided box normally, but don't draw top of .\" box if the box started on an earlier page. .ie !\\n(^b-1 \{\ \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' .\} .el \}\ \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' .\} .\} .fi .br .nr ^b 0 .. '\" # VS - start vertical sidebar '\" # ^Y = starting y location '\" # ^v = 1 (for troff; for nroff this doesn't matter) .de VS .if !"\\$2"" .br .mk ^Y .ie n 'mc \s12\(br\s0 .el .nr ^v 1u .. '\" # VE - end of vertical sidebar .de VE .ie n 'mc .el \{\ .ev 2 .nf .ti 0 .mk ^t \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' .sp -1 .fi .ev .\} .nr ^v 0 .. '\" # Special macro to handle page bottom: finish off current '\" # box/sidebar if in box/sidebar mode, then invoked standard '\" # page bottom macro. .de ^B .ev 2 'ti 0 'nf .mk ^t .if \\n(^b \{\ .\" Draw three-sided box if this is the box's first page, .\" draw two sides but no top otherwise. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c .\} .if \\n(^v \{\ .nr ^x \\n(^tu+1v-\\n(^Yu \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c .\} .bp 'fi .ev .if \\n(^b \{\ .mk ^y .nr ^b 2 .\} .if \\n(^v \{\ .mk ^Y .\} .. '\" # DS - begin display .de DS .RS .nf .sp .. '\" # DE - end display .de DE .fi .RE .sp .. '\" # SO - start of list of standard options .de SO .SH "STANDARD OPTIONS" .LP .nf .ta 4c 8c 12c .ft B .. '\" # SE - end of list of standard options .de SE .fi .ft R .. '\" # OP - start of full description for a single option .de OP .LP .nf .ta 4c Command-Line Name: \\fB\\$1\\fR Database Name: \\fB\\$2\\fR Database Class: \\fB\\$3\\fR .fi .IP .. '\" # CS - begin code excerpt .de CS .RS .nf .ta .25i .5i .75i 1i .. '\" # CE - end code excerpt .de CE .fi .RE .. .de UL \\$1\l'|0\(ul'\\$2 .. tile-0.8.2/doc/menubutton.n0000644000076500007650000000237310532475536015207 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH menubutton n 0.2 tile "Tile Widget Set" .BS .SH NAME ttk::menubutton \- Widget that pops down a menu when pressed .SH SYNOPSIS \fBttk::menubutton\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBmenubutton\fR widget displays a textual label and/or image, and displays a menu when pressed. .SO \-class \-compound \-cursor \-image \-state \-style \-takefocus \-text \-textvariable \-underline \-width .SE .SH "OPTIONS" .OP \-direction direction Direction Specifies where the menu is to be popped up relative to the menubutton. One of: \fIabove\fR, \fIbelow\fR, \fIleft\fR, \fIright\fR, or \fIflush\fR. The default is \fIbelow\fR. \fIflush\fR pops the menu up directly over the menubutton. .OP \-menu menu Menu Specifies the path name of the menu associated with the menubutton. To be on the safe side, the menu ought to be a direct child of the menubutton. .\" not documented: may go away: .\" .OP \-anchor anchor Anchor .\" .OP \-padding padding Pad .SH "WIDGET COMMAND" Menubutton widgets support the standard \fBcget\fR, \fBconfigure\fR, \fBinstate\fR, and \fBstate\fR methods. No other widget methods are used. .SH "SEE ALSO" widget(n), keynav(n), menu(n) .SH "KEYWORDS" widget, button, menu tile-0.8.2/doc/notebook.n0000644000076500007650000001465310722335157014626 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH notebook n 0.2 tile "Tile Widget Set" .BS .SH NAME ttk::notebook \- Multi-paned container widget .SH SYNOPSIS .nf \fBttk::notebook\fR \fIpathName \fR?\fIoptions...\fR? .br \fIpathName \fBadd\fR \fIwindow\fR ?\fIoptions...\fR? \fIpathName \fBinsert\fR \fIindex\fR \fIwindow\fR ?\fIoptions...\fR? .fi .BE .SH DESCRIPTION A \fBttk::notebook\fR widget manages a collection of windows and displays a single one at a time. Each slave window is associated with a \fItab\fR, which the user may select to change the currently-displayed window. .SO \-class \-cursor \-takefocus \-style .SE .SH "WIDGET OPTIONS" .OP \-height height Height If present and greater than zero, specifies the desired height of the pane area (not including internal padding or tabs). Otherwise, the maximum height of all panes is used. .OP \-padding padding Padding Specifies the amount of extra space to add around the outside of the notebook. The padding is a list of up to four length specifications \fIleft top right bottom\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. .OP \-width width Width If present and greater than zero, specifies the desired width of the pane area (not including internal padding). Otherwise, the maximum width of all panes is used. .SH "TAB OPTIONS" The following options may be specified for individual notebook panes: .OP \-state state State Either \fBnormal\fR, \fBdisabled\fR or \fBhidden\fR. If \fBdisabled\fR, then the tab is not selectable. If \fBhidden\fR, then the tab is not shown. .OP \-sticky sticky Sticky Specifies how the slave window is positioned within the pane area. Value is a string containing zero or more of the characters \fBn, s, e,\fR or \fBw\fR. Each letter refers to a side (north, south, east, or west) that the slave window will "stick" to, as per the \fBgrid\fR geometry manager. .OP \-padding padding Padding Specifies the amount of extra space to add between the notebook and this pane. Syntax is the same as for the widget \fB\-padding\fR option. .OP \-text text Text Specifies a string to be displayed in the tab. .OP \-image image Image Specifies an image to display in the tab. See \fIwidget(n)\fR for details. .OP \-compound compound Compound Specifies how to display the image relative to the text, in the case both \fB\-text\fR and \fB\-image\fR are present. See \fIlabel(n)\fR for legal values. .OP \-underline underline Underline Specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation if \fBttk::notebook::enableTraversal\fR is called. .SH "WIDGET COMMAND" .TP \fIpathname \fBadd\fR \fIwindow\fR ?\fIoptions...\fR? Adds a new tab to the notebook. See \fBTAB OPTIONS\fR for the list of available \fIoptions\fR. If \fIwindow\fR is currently managed by the notebook but hidden, it is restored to its previous position. .TP \fIpathname \fBconfigure\fR ?\fIoptions\fR? See \fIwidget(n)\fR. .TP \fIpathname \fBcget\fR \fIoption\fR See \fIwidget(n)\fR. .TP \fIpathname \fBforget\fR \fItabid\fR Removes the tab specified by \fItabid\fR, unmaps and unmanages the associated window. .TP \fIpathname \fBhide\fR \fItabid\fR Hides the tab specified by \fItabid\fR. The tab will not be displayed, but the associated window remains managed by the notebook and its configuration remembered. Hidden tabs may be restored with the \fBadd\fR command. .TP \fIpathname \fBindex\fR \fItabid\fR Returns the numeric index of the tab specified by \fItabid\fR, or the total number of tabs if \fItabid\fR is the string "\fBend\fR". .TP \fIpathname \fBinsert\fR \fIpos\fR \fIsubwindow\fR \fIoptions...\fR Inserts a pane at the specified position. \fIpos\fR is either the string \fBend\fR, an integer index, or the name of a managed subwindow. If \fIsubwindow\fR is already managed by the notebook, moves it to the specified position. See \fBTAB OPTIONS\fR for the list of available options. .TP \fIpathname \fBinstate\fR \fIstatespec \fR?\fIscript...\fR? See \fIwidget(n)\fR. .TP \fIpathname \fBselect\fR ?\fItabid\fR? Selects the specified tab. The associated slave window will be displayed, and the previously-selected window (if different) is unmapped. If \fItabid\fR is omitted, returns the widget name of the currently selected pane. .TP \fIpathname \fBstate\fR ?\fIstatespec\fR? See \fIwidget(n)\fR. .TP \fIpathname \fBtab\fR \fItabid\fR ?\fI\-option \fR?\fIvalue ...\fR Query or modify the options of the specific tab. If no \fI\-option\fR is specified, returns a dictionary of the tab option values. If one \fI\-option\fR is specified, returns the value of that \fIoption\fR. Otherwise, sets the \fI\-option\fRs to the corresponding \fIvalue\fRs. See \fBTAB OPTIONS\fR for the available options. .TP \fIpathname \fBtabs\fR Returns the list of windows managed by the notebook. .SH "KEYBOARD TRAVERSAL" To enable keyboard traversal for a toplevel window containing a notebook widget \fI$nb\fR, call: .CS ttk::notebook::enableTraversal $nb .CE .PP This will extend the bindings for the toplevel window containing the notebook as follows: .IP \(bu \fBControl-Tab\fR selects the tab following the currently selected one. .IP \(bu \fBShift-Control-Tab\fR selects the tab preceding the currently selected one. .IP \(bu \fBAlt-K\fR, where \fBK\fR is the mnemonic (underlined) character of any tab, will select that tab. .PP Multiple notebooks in a single toplevel may be enabled for traversal, including nested notebooks. However, notebook traversal only works properly if all panes are direct children of the notebook. .SH "TAB IDENTIFIERS" The \fItabid\fR argument to the above commands may take any of the following forms: .IP \(bu An integer between zero and the number of tabs; .IP \(bu The name of a slave window; .IP \(bu A positional specification of the form "@\fIx\fR,\fIy\fR", which identifies the tab .IP \(bu The literal string "\fBcurrent\fR", which identifies the currently-selected tab; or: .IP \(bu The literal string "\fBend\fR", which returns the number of tabs (only valid for "\fIpathname \fBindex\fR"). .SH "VIRTUAL EVENTS" The notebook widget generates a \fB<>\fR virtual event after a new tab is selected. .SH "EXAMPLE" .CS notebook .nb \.nb add [frame .nb.f1] -text "First tab" \.nb add [frame .nb.f2] -text "Second tab" \.nb select .nb.f2 ttk::notebook::enableTraversal .nb .CE .SH "SEE ALSO" widget(n), grid(n) .SH "KEYWORDS" pane, tab tile-0.8.2/doc/paned.n0000644000076500007650000000733410730002143014054 0ustar joejoe00000000000000'\" paned.n,v 1.8 2007/12/12 15:55:15 jenglish Exp '\" Copyright (c) 2005 Joe English .so man.macros .TH panedwindow n 0.7 tile "Tile Widget Set" .BS .SH "NAME" ttk::panedwindow \- Multi-pane container window .SH SYNOPSIS .nf \fBttk::panedwindow\fR \fIpathName \fR?\fIoptions\fR? .br \fIpathName \fBadd\fR \fIwindow\fR ?\fIoptions...\fR? \fIpathName \fBinsert\fR \fIindex\fR \fIwindow\fR ?\fIoptions...\fR? .fi .BE .SH "DESCRIPTION" A panedwindow widget displays a number of subwindows, stacked either vertically or horizontally. The user may adjust the relative sizes of the subwindows by dragging the sash between panes. .SO \-class \-cursor \-takefocus \-style .SE .SH "WIDGET OPTIONS" .OP \-orient orient Orient Specifies the orientation of the window. If \fBvertical\fR, subpanes are stacked top-to-bottom; if \fBhorizontal\fR, subpanes are stacked left-to-right. .OP \-width width Width If present and greater than zero, specifies the desired width of the widget in pixels. Otherwise, the requested width is determined by the width of the managed windows. .OP \-height height Height If present and greater than zero, specifies the desired height of the widget in pixels. Otherwise, the requested height is determined by the height of the managed windows. .SH "PANE OPTIONS" The following options may be specified for each pane: .OP \-weight weight Weight An integer specifying the relative stretchability of the pane. When the panedwindow is resized, the extra space is added or subtracted to each pane proportionally to its \fB-weight\fR. .SH "WIDGET COMMAND" Supports the standard \fBconfigure\fR, \fBcget\fR, \fBstate\fR, and \fBinstate\fR commands; see \fIwidget(n)\fR for details. Additional commands: .TP \fIpathname\fR \fBadd\fR \fIsubwindow\fR \fIoptions...\fR Adds a new pane to the window. \fIsubwindow\fR must be a direct child of the panedwindow \fIpathname\fR. See \fBPANE OPTIONS\fR for the list of available options. .TP \fIpathname \fBforget \fIpane\fR Removes the specified subpane from the widget. \fIpane\fR is either an integer index or the name of a managed subwindow. .TP \fIpathname \fBinsert\fR \fIpos\fR \fIsubwindow\fR \fIoptions...\fR Inserts a pane at the specified position. \fIpos\fR is either the string \fBend\fR, an integer index, or the name of a managed subwindow. If \fIsubwindow\fR is already managed by the panedwindow, moves it to the specified position. See \fBPANE OPTIONS\fR for the list of available options. .TP \fIpathname \fBpane \fIpane -option \fR?\fIvalue \fR?\fI-option value...\fR Query or modify the options of the specified \fIpane\fR, where \fIpane\fR is either an integer index or the name of a managed subwindow. If no \fI-option\fR is specified, returns a dictionary of the pane option values. If one \fI-option\fR is specified, returns the value of that \fIoption\fR. Otherwise, sets the \fI-option\fRs to the corresponding \fIvalue\fRs. .TP \fIpathname \fBpanes\fR Returns the list of all windows managed by the widget. .TP \fIpathname\fR \fBsashpos\fR \fIindex\fR ?\fInewpos\fR? If \fInewpos\fR is specified, sets the position of sash number \fIindex\fR. May adjust the positions of adjacent sashes to ensure that positions are monotonically increasing. Sash positions are further constrained to be between 0 and the total size of the widget. .\" Full story: "total size" is either the -height (resp -width), .\" or the actual window height (resp actual window width), .\" depending on which changed most recently. Returns the new position of sash number \fIindex\fR. .\" Full story: new position may be different than the requested position. .TP \fIpathname\fR \fBidentify\fR \fIx y\fR Returns the index of the sash at point \fIx,y\fR, or the empty string if \fIx,y\fR is not over a sash. .SH "SEE ALSO" widget(n), notebook(n) tile-0.8.2/doc/progressbar.n0000644000076500007650000000545210532475536015341 0ustar joejoe00000000000000'\" '\" Copyright (c) 2005 Joe English '\" .so man.macros .TH progressbar n 0.6 tile "Tile Widget Set" .BS .SH NAME ttk::progressbar \- Provide progress feedback .SH SYNOPSIS \fBttk::progressbar\fR \fIpathName \fR?\fIoptions\fR? .SO \-class \-cursor \-takefocus \-style .SE .SH "OPTIONS" .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the progress bar. .OP \-length length Length Specifies the length of the long axis of the progress bar (width if horizontal, height if vertical). .OP \-mode mode Mode One of \fBdeterminate\fR or \fBindeterminate\fR. .OP \-maximum maximum Maximum A floating point number specifying the maximum \fB-value\fR. Defaults to 100. .OP \-value value Value The current value of the progress bar. In \fIdeterminate\fR mode, this represents the amount of work completed. In \fIindeterminate\fR mode, it is interpreted modulo \fB-maximum\fR; that is, the progress bar completes one "cycle" when the \fB-value\fR increases by \fB-maximum\fR. .OP \-variable variable Variable The name of a Tcl variable which is linked to the \fB-value\fR. If specified, the \fB-value\fR of the progress bar is automatically set to the value of the variable whenever the latter is modified. .OP \-phase phase Phase Read-only option. The widget periodically increments the value of this option whenever the \fB-value\fR is greater than 0 and, in \fIdeterminate\fR mode, less than \fB-maximum\fR. This option may be used by the current theme to provide additional animation effects. .BE .SH "DESCRIPTION" A progress bar widget shows the status of a long-running operation. They can operate in two modes: \fIdeterminate\fR mode shows the amount completed relative to the total amount of work to be done, and \fIindeterminate\fR mode provides an animated display to let the user know that something is happening. .SH "WIDGET COMMAND" .TP \fIpathName \fBcget\fR \fIoption\fR Returns the current value of the specified \fIoption\fR; see \fIwidget(n)\fR. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? Modify or query widget options; see \fIwidget(n)\fR. .TP \fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? Test the widget state; see \fIwidget(n)\fR. .TP \fIpathName \fBstart\fR ?\fIinterval\fR? Begin autoincrement mode: schedules a recurring timer event that calls \fBstep\fR every \fIinterval\fR milliseconds. If omitted, \fIinterval\fR defaults to 50 milliseconds (20 steps/second). .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? Modify or query the widget state; see \fIwidget(n)\fR. .TP \fIpathName \fBstep\fR ?\fIamount\fR? Increments the \fB-value\fR by \fIamount\fR. \fIamount\fR defaults to 1.0 if omitted. .TP \fIpathName \fBstop\fR Stop autoincrement mode: cancels any recurring timer event initiated by \fIpathName \fBstart\fR. .SH "SEE ALSO" widget(n) tile-0.8.2/doc/radiobutton.n0000644000076500007650000000372210532475536015340 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH radiobutton n 0.2 tile "Tile Widget Set" .BS .SH NAME ttk::radiobutton \- Mutually exclusive option widget .SH SYNOPSIS \fBttk::radiobutton\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION \fBradiobutton\fR widgets are used in groups to show or change a set of mutually-exclusive options. Radiobuttons are linked to a Tcl variable, and have an associated value; when a radiobutton is clicked, it sets the variable to its associated value. .SO \-class \-compound \-cursor \-image \-state \-style \-takefocus \-text \-textvariable \-underline \-width .SE .SH "OPTIONS" .OP \-command command Command A Tcl script to evaluate whenever the widget is invoked. .OP \-value Value Value The value to store in the associated \fI-variable\fR when the widget is selected. .OP \-variable variable Variable The name of a global variable whose value is linked to the widget. Default value is \fB::selectedButton\fR. .SH "WIDGET COMMAND" In addition to the standard \fBcget\fR, \fBconfigure\fR, \fBinstate\fR, and \fBstate\fR commands, radiobuttons support the following additional widget commands: .TP \fIpathname\fR invoke Sets the \fI-variable\fR to the \fI-value\fR, selects the widget, and evaluates the associated \fI-command\fR. Returns the result of the \fI-command\fR, or the empty string if no \fI-command\fR is specified. .\" Missing: select, deselect. Useful? .\" Missing: flash. This is definitely not useful. .SH "WIDGET STATES" The widget does not respond to user input if the \fBdisabled\fR state is set. The widget sets the \fBselected\fR state whenever the linked \fB-variable\fR is set to the widget's \fB-value\fR, and clears it otherwise. The widget sets the \fBalternate\fR state whenever the linked \fB-variable\fR is unset. (The \fBalternate\fR state may be used to indicate a ``tri-state'' or ``indeterminate'' selection.) .SH "SEE ALSO" widget(n), keynav(n), checkbutton(n) .SH "KEYWORDS" widget, button, option tile-0.8.2/doc/scrollbar.n0000644000076500007650000001477510532475536015003 0ustar joejoe00000000000000'\" '\" SOURCE: tk/doc/scrollbar.n, r1.4 '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" scrollbar.n,v 1.4 2006/11/27 05:45:02 jenglish Exp '\" .so man.macros .TH scrollbar n 0.5 tile "Tile Widget Set" .BS .SH NAME ttk::scrollbar \- Control the viewport of a scrollable widget .SH SYNOPSIS \fBttk::scrollbar\fR \fIpathName \fR?\fIoptions...\fR? .SO \-class \-cursor \-style \-takefocus .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-command command Command A Tcl script prefix to evaluate to change the view in the widget associated with the scrollbar. Additional arguments are appended to the value of this option, as described in \fBSCROLLING COMMANDS\fR below, whenever the user requests a view change by manipulating the scrollbar. .br This option typically consists of a two-element list, containing the name of a scrollable widget followed by either \fBxview\fR (for horizontal scrollbars) or \fByview\fR (for vertical scrollbars). .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the scrollbar. .BE .SH DESCRIPTION Scrollbar widgets are typically linked to an associated window that displays a document of some sort, such as a file being edited or a drawing. A scrollbar displays a \fIthumb\fR in the middle portion of the scrollbar, whose position and size provides information about the portion of the document visible in the associated window. The thumb may be dragged by the user to control the visible region. Depending on the theme, two or more arrow buttons may also be present; these are used to scroll the visible region in discrete units. .SH "WIDGET COMMAND" .TP \fIpathName \fBcget\fR \fIoption\fR Returns the current value of the specified \fIoption\fR; see \fIwidget(n)\fR. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? Modify or query widget options; see \fIwidget(n)\fR. .TP \fIpathName \fBget\fR Returns the scrollbar settings in the form of a list whose elements are the arguments to the most recent \fBset\fR widget command. .TP \fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? Test the widget state; see \fIwidget(n)\fR. .TP \fIpathName \fBset\fR \fIfirst last\fR This command is normally invoked by the scrollbar's associated widget from an \fB-xscrollcommand\fR or \fB-yscrollcommand\fR callback. Specifies the visible range to be displayed. \fIfirst\fR and \fIlast\fR are real fractions between 0 and 1. .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? Modify or query the widget state; see \fIwidget(n)\fR. .SH "INTERNAL COMMANDS" The following widget commands are used internally by the TScrollbar widget class bindings. .TP \fIpathName \fBdelta \fIdeltaX deltaY\fR Returns a real number indicating the fractional change in the scrollbar setting that corresponds to a given change in thumb position. For example, if the scrollbar is horizontal, the result indicates how much the scrollbar setting must change to move the thumb \fIdeltaX\fR pixels to the right (\fIdeltaY\fR is ignored in this case). If the scrollbar is vertical, the result indicates how much the scrollbar setting must change to move the thumb \fIdeltaY\fR pixels down. The arguments and the result may be zero or negative. .TP \fIpathName \fBfraction \fIx y\fR Returns a real number between 0 and 1 indicating where the point given by \fIx\fR and \fIy\fR lies in the trough area of the scrollbar, where 0.0 corresponds to the top or left of the trough and 1.0 corresponds to the bottom or right. \fIX\fR and \fIy\fR are pixel coordinates relative to the scrollbar widget. If \fIx\fR and \fIy\fR refer to a point outside the trough, the closest point in the trough is used. .TP \fIpathName \fBidentify\fR \fIx y\fR Returns the name of the element under the point given by \fIx\fR and \fIy\fR, or an empty string if the point does not lie in any element of the scrollbar. \fIX\fR and \fIy\fR are pixel coordinates relative to the scrollbar widget. .SH "SCROLLING COMMANDS" When the user interacts with the scrollbar, for example by dragging the thumb, the scrollbar notifies the associated widget that it must change its view. The scrollbar makes the notification by evaluating a Tcl command generated from the scrollbar's \fB\-command\fR option. The command may take any of the following forms. In each case, \fIprefix\fR is the contents of the \fB\-command\fR option, which usually has a form like \fB.t yview\fR .TP \fIprefix \fBmoveto \fIfraction\fR \fIFraction\fR is a real number between 0 and 1. The widget should adjust its view so that the point given by \fIfraction\fR appears at the beginning of the widget. If \fIfraction\fR is 0 it refers to the beginning of the document. 1.0 refers to the end of the document, 0.333 refers to a point one-third of the way through the document, and so on. .TP \fIprefix \fBscroll \fInumber \fBunits\fR The widget should adjust its view by \fInumber\fR units. The units are defined in whatever way makes sense for the widget, such as characters or lines in a text widget. \fINumber\fR is either 1, which means one unit should scroll off the top or left of the window, or \-1, which means that one unit should scroll off the bottom or right of the window. .TP \fIprefix \fBscroll \fInumber \fBpages\fR The widget should adjust its view by \fInumber\fR pages. It is up to the widget to define the meaning of a page; typically it is slightly less than what fits in the window, so that there is a slight overlap between the old and new views. \fINumber\fR is either 1, which means the next page should become visible, or \-1, which means that the previous page should become visible. .SH "WIDGET STATES" The scrollbar automatically sets the \fBdisabled\fR state bit. when the entire range is visible (range is 0.0 to 1.0), and clears it otherwise. It also sets the \fBactive\fR and \fBpressed\fR state flags of individual elements, based on the position and state of the mouse pointer. .SH EXAMPLE .CS set f [frame .f] ttk::scrollbar $f.hsb -orient horizontal -command [list $f.t xview] ttk::scrollbar $f.vsb -orient vertical -command [list $f.t yview] text $f.t -xscrollcommand [list $f.hsb set] -yscrollcommand [list $f.vsb set] grid $f.t -row 0 -column 0 -sticky nsew grid $f.vsb -row 0 -column 1 -sticky nsew grid $f.hsb -row 1 -column 0 -sticky nsew grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1 .CE .SH KEYWORDS scrollbar, widget tile-0.8.2/doc/separator.n0000644000076500007650000000137610532475536015011 0ustar joejoe00000000000000'\" separator.n,v 1.5 2006/11/27 05:45:02 jenglish Exp '\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH separator n 0.5 tile "Tile Widget Set" .BS .SH NAME ttk::separator \- Separator bar .SH SYNOPSIS \fBttk::separator\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBseparator\fR widget displays a horizontal or vertical separator bar. .SO \-class \-cursor \-state \-style \-takefocus .SE .SH "OPTIONS" .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. Specifies the orientation of the separator. .SH "WIDGET COMMAND" Separator widgets support the standard \fBcget\fR, \fBconfigure\fR, \fBinstate\fR, and \fBstate\fR methods. No other widget methods are used. .SH "SEE ALSO" widget(n) .SH "KEYWORDS" widget, separator tile-0.8.2/doc/sizegrip.n0000644000076500007650000000315710705006353014631 0ustar joejoe00000000000000'\" sizegrip.n,v 1.5 2007/10/16 00:59:23 jenglish Exp '\" '\" Copyright (c) 2006 Joe English '\" .so man.macros .TH sizegrip n 0.8 tile "Tile Widget Set" .BS .SH NAME ttk::sizegrip \- A silly widget .SH SYNOPSIS \fBttk::sizegrip\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBsizegrip\fR widget (also known as a \fIgrow box\fR) allows the user to resize the containing toplevel window by pressing and dragging the grip. .SO \-class \-cursor \-state \-style \-takefocus .SE .SH "WIDGET COMMAND" Sizegrip widgets support the standard \fBcget\fR, \fBconfigure\fR, \fBinstate\fR, and \fBstate\fR methods. No other widget methods are used. .SH "PLATFORM-SPECIFIC NOTES" On Mac OSX, toplevel windows automatically include a built-in size grip by default. Adding an \fBttk::sizegrip\fR there is harmless, since the built-in grip will just mask the widget. .SH EXAMPLES .CS # Using pack: pack [ttk::frame $top.statusbar] -side bottom -fill x pack [ttk::sizegrip $top.statusbar.grip] -side right -anchor se # Using grid: grid [ttk::sizegrip $top.statusbar.grip] \ -row $lastRow -column $lastColumn -sticky se # ... optional: add vertical scrollbar in $lastColumn, # ... optional: add horizontal scrollbar in $lastRow .CE .SH "BUGS" If the containing toplevel's position was specified relative to the right or bottom of the screen (e.g., \fB[wm geometry ... \fIw\fBx\fIh\fB-\fIx\fB-\fIy\fB]\fR instead of \fB[wm geometry ... \fIw\fBx\fIh\fB+\fIx\fB+\fIy\fB]\fR), the sizegrip widget will not resize the window. .PP ttk::sizegrip widgets only support "southeast" resizing. .SH "SEE ALSO" widget(n) .SH "KEYWORDS" widget, sizegrip, grow box tile-0.8.2/doc/style.n0000644000076500007650000001103210730002143014113 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" style.n,v 1.15 2007/12/12 15:55:15 jenglish Exp '\" .so man.macros .TH style n 0.5 tile "Tile Widget Set" .BS .SH NAME ttk::style \- Manipulate style database .SH SYNOPSIS \fBttk::style\fR \fIoption\fR ?\fIargs\fR? .BE .SH NOTES See also the Tcl'2004 conference presentation, available at .UR http://tktable.sourceforge.net/tile/tile-tcl2004.pdf http://tktable.sourceforge.net/tile/tile-tcl2004.pdf .UE .SH DEFINITIONS Each widget is assigned a \fIstyle\fR, which specifies the set of elements making up the widget and how they are arranged, along with dynamic and default settings for element options. By default, the style name is the same as the widget's class; this may be overridden by the \fB\-style\fR option. .PP A \fItheme\fR is a collection of elements and styles which controls the overall look and feel of an application. .SH DESCRIPTION The \fBttk::style\fR command takes the following arguments: .TP \fBttk::style configure \fIstyle\fR ?\fI\-option\fR ?\fIvalue option value...\fR? ? Sets the default value of the specified option(s) in \fIstyle\fR. .TP \fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR? Sets dynamic values of the specified option(s) in \fIstyle\fR. Each \fIstatespec / value\fR pair is examined in order; the value corresponding to the first matching \fIstatespec\fR is used. .TP \fBttk::style lookup \fIstyle\fR \fI\-option \fR?\fIstate \fR?\fIdefault\fR?? Returns the value specified for \fI\-option\fR in style \fIstyle\fR in state \fIstate\fR, using the standard lookup rules for element options. \fIstate\fR is a list of state names; if omitted, it defaults to all bits off (the ``normal'' state). If the \fIdefault\fR argument is present, it is used as a fallback value in case no specification for \fI\-option\fR is found. .\" Otherwise -- signal error? return empty string? Leave unspecified for now. .TP \fBttk::style layout \fIstyle\fR ?\fIlayoutSpec\fR? Define the widget layout for style \fIstyle\fR. See \fBLAYOUTS\fR below for the format of \fIlayoutSpec\fR. If \fIlayoutSpec\fR is omitted, return the layout specification for style \fIstyle\fR. .TP \fBttk::style element create\fR \fIelementName\fR \fItype\fR ?\fIargs...\fR? Creates a new element in the current theme of type \fItype\fR. The only built-in element type is \fIimage\fR (see \fIimage(n)\fR), although themes may define other element types (see \fBTtk_RegisterElementFactory\fR). .TP \fBttk::style element names\fR Returns the list of elements defined in the current theme. .TP \fBttk::style element options \fIelement\fR Returns the list of \fIelement\fR's options. .TP \fBttk::style theme create\fR \fIthemeName\fR ?\fB\-parent \fIbasedon\fR? ?\fB\-settings \fIscript...\fR ? Creates a new theme. It is an error if \fIthemeName\fR already exists. If \fB\-parent\fR is specified, the new theme will inherit styles, elements, and layouts from the parent theme \fIbasedon\fR. If \fB\-settings\fR is present, \fIscript\fR is evaluated in the context of the new theme as per \fBttk::style theme settings\fR. .TP \fBttk::style theme settings \fIthemeName\fR \fIscript\fR Temporarily sets the current theme to \fIthemeName\fR, evaluate \fIscript\fR, then restore the previous theme. Typically \fIscript\fR simply defines styles and elements, though arbitrary Tcl code may appear. .TP \fBttk::style theme names\fR Returns a list of all known themes. .TP \fBttk::style theme use\fR \fIthemeName\fR Sets the current theme to \fIthemeName\fR, and refreshes all widgets. .SH LAYOUTS A \fIlayout\fR specifies a list of elements, each followed by one or more options specifying how to arrange the element. The layout mechanism uses a simplified version of the \fBpack\fR geometry manager: given an initial cavity, each element is allocated a parcel. Valid options are: .TP \fB\-side \fIside\fR Specifies which side of the cavity to place the element; one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR. If omitted, the element occupies the entire cavity. .TP \fB\-sticky\fR \fB[\fInswe\fB]\fR Specifies where the element is placed inside its allocated parcel. .TP \fB\-children { \fIsublayout... \fB}\fR Specifies a list of elements to place inside the element. .\" Also: -border, -unit, -expand: may go away. .PP For example: .CS ttk::style layout Horizontal.TScrollbar { Scrollbar.trough \-children { Scrollbar.leftarrow \-side left Scrollbar.rightarrow \-side right Horizontal.Scrollbar.thumb \-side left \-sticky ew } } .CE .SH "SEE ALSO" tile-intro, widget, pixmap .SH KEYWORDS style, theme, appearance tile-0.8.2/doc/tile-intro.n0000644000076500007650000001406410730002143015051 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH intro n 0.2 tile "Tile Widget Set" .BS .SH NAME tile_intro \- Introduction to the Tile theme engine .BE .SH "OVERVIEW" The tile widget set is based on a revised and enhanced version of the .UR http://purl.org/tcl/tip/48 TIP #48 .UE style engine. The main concepts are described below. The basic idea is to separate, to the extent possible, the code implementing a widget's behavior from the code implementing its appearance. Widget class bindings are primarily responsible for maintaining the widget state and invoking callbacks; all aspects of the widgets appearance is .SH "THEMES" A \fItheme\fR is a collection of elements and styles that determine the look and feel of the widget set. Themes can be used to: .IP \(bu Isolate platform differences (X11 vs. classic Windows vs. XP vs. Aqua ...) .IP \(bu Adapt to display limitations (low-color, grayscale, monochrome, tiny screens) .IP \(bu Accessibility (high contrast, large type) .IP \(bu Application suite branding .IP \(bu Blend in with the rest of the desktop (Gnome, KDE, Java) .IP \(bu And, of course: eye candy. .SH "ELEMENTS" An \fIelement\fR displays an individual part of a widget. For example, a vertical scrollbar widget contains \fBuparrow\fR, \fBdownarrow\fR, \fBtrough\fR and \fBslider\fR elements. .PP Element names use a recursive dotted notation. For example, \fBuparrow\fR identifies a generic arrow element, and \fBScrollbar.uparrow\fR and \fBCombobox.uparrow\fR identify widget-specific elements. When looking for an element, the style engine looks for the specific name first, and if an element of that name is not found it looks for generic elements by stripping off successive leading components of the element name. .PP Like widgets, elements have \fIoptions\fR which specify what to display and how to display it. For example, the \fBtext\fR element (which displays a text string) has \fB\-text\fR, \fB\-font\fR, \fB\-foreground\fR, \fB\-background\fR, \fB\-underline\fR, and \fB\-width\fR options. The value of an element option is taken from: .IP \(bu An option of the same name and type in the widget containing the element; .IP \(bu A dynamic setting specified by \fBstyle map\fR and the current state; .IP \(bu The default setting specified by \fBstyle configure\fR; or .IP \(bu The element's built-in default value for the option. .SH "LAYOUTS" A \fIlayout\fR specifies which elements make up a widget and how they are arranged. The layout engine uses a simplified version of the \fBpack\fR algorithm: starting with an initial cavity equal to the size of the widget, elements are allocated a parcel within the cavity along the side specified by the \fB\-side\fR option, and placed within the parcel according to the \fB\-sticky\fR option. For example, the layout for a horizontal scrollbar .CS ttk::style layout Horizontal.TScrollbar { Scrollbar.trough \-children { Scrollbar.leftarrow \-side left \-sticky w Scrollbar.rightarrow \-side right \-sticky e Scrollbar.thumb \-side left \-expand true \-sticky ew } } .CE By default, the layout for a widget is the same as its class name. Some widgets may override this (for example, the \fBttk::scrollbar\fR widget chooses different layouts based on the \fB\-orient\fR option). .SH "STATES" In standard Tk, many widgets have a \fB\-state\fR option which (in most cases) is either \fBnormal\fR or \fBdisabled\fR. Some widgets support additional states, such as the \fBentry\fR widget which has a \fBreadonly\fR state and the various flavors of buttons which have \fBactive\fR state. .PP The Tile widget set generalizes this idea: every widget has a bitmap of independent state flags. Widget state flags include \fBactive\fR, \fBdisabled\fR, \fBpressed\fR, \fBfocus\fR, etc., (see \fIwidget(n)\fR for the full list of state flags). .PP Instead of a \fB\-state\fR option, every widget now has a \fBstate\fR widget command which is used to set or query the state. A \fIstate specification\fR is a list of symbolic state names indicating which bits are set, each optionally prefixed with an exclamation point indicating that the bit is cleared instead. .PP For example, the class bindings for the \fBttk::button\fR widget are: .CS bind TButton { %W state active } bind TButton { %W state !active } bind TButton { %W state pressed } bind TButton { %W state !pressed } bind TButton { %W state pressed } bind TButton \e { %W instate {pressed} { %W state !pressed ; %W invoke } } .CE This specifies that the widget becomes \fBactive\fR when the pointer enters the widget, and inactive when it leaves. Similarly it becomes \fBpressed\fR when the mouse button is pressed, and \fB!pressed\fR on the ButtonRelease event. In addition, the button unpresses if pointer is dragged outside the widget while Button-1 is held down, and represses if it's dragged back in. Finally, when the mouse button is released, the widget's \fB\-command\fR is invoked, but only if the button is currently in the \fBpressed\fR state. (The actual bindings are a little more complicated than the above, but not by much). .PP \fINote to self: rewrite that paragraph. It's horrible.\fR .SH "STYLES" Each widget is associated with a \fIstyle\fR, which specifies values for element options. Style names use a recursive dotted notation like layouts and elements; by default, widgets use the class name to look up a style in the current theme. For example: .CS ttk::style configure TButton \e \-background #d9d9d9 \e \-foreground black \e \-relief raised \e ; .CE Many elements are displayed differently depending on the widget state. For example, buttons have a different background when they are active, a different foreground when disabled, and a different relief when pressed. The \fBstyle map\fR command specifies dynamic option settings for a particular style: .CS ttk::style map TButton \e \-background [list disabled #d9d9d9 active #ececec] \e \-foreground [list disabled #a3a3a3] \e \-relief [list {pressed !disabled} sunken] \e ; .CE .SH "SEE ALSO" widget(n), style(n), .UR http://purl.org/tcl/tip/48 TIP #48 .UE tile-0.8.2/doc/tmml.options0000644000076500007650000000021510013756143015175 0ustar joejoe00000000000000set Options(xsltProcessor) tdom set dictionary(pathname) cmd set manpageCategories(widget.n) stdopt set manpageCategories(tile-intro.n) misc tile-0.8.2/doc/treeview.n0000644000076500007650000003610210731010000014602 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" .so man.macros .TH treeview n 0.5 tile "Tile Widget Set" .SH NAME ttk::treeview \- hierarchical multicolumn data display widget .SH SYNOPSIS \fBttk::treeview\fR \fIpathname \fR?\fIoptions\fR? .SH "DESCRIPTION" The treeview widget displays a hierarchical collection of items. Each item has a textual label, an optional image, and an optional list of data values. The data values are displayed in successive columns after the tree label. .PP The order in which data values are displayed may be controlled by setting the \fB-displaycolumns\fR widget option. The tree widget can also display column headings. Columns may be accessed by number or by symbolic names listed in the \fB-columns\fR widget option; see \fBCOLUMN IDENTIFIERS\fR. .PP Each item is identified by a unique name. The widget will generate item IDs if they are not supplied by the caller. There is a distinguished root item, named \fB{}\fR. The root item itself is not displayed; its children appear at the top level of the hierarchy. .PP Each item also has a list of \fItags\fR, which can be used to associate event bindings with individual items and control the appearance of the item. .\" .PP .\" @@@HERE: describe selection, focus item .PP Treeview widgets support horizontal and vertical scrolling with the standard \fB-[xy]scrollcommand\fR options and \fB[xy]view\fR widget commands. .SO \-class \-cursor \-takefocus \-style \-xscrollcommand \-yscrollcommand .SE .SH "WIDGET OPTIONS" .OP \-columns columns Columns A list of column identifiers, specifying the number of columns and their names. .\"X: This is a read-only option; it may only be set when the widget is created. .OP \-displaycolumns displayColumns DisplayColumns A list of column identifiers (either symbolic names or integer indices) specifying which data columns are displayed and the order in which they appear, or the string \fB#all\fP. .br If set to \fB#all\fP (the default), all columns are shown in the order given. .OP \-height height Height Specifies the number of rows which should be visible. Note: the requested width is determined from the sum of the column widths. .OP \-padding padding Padding Specifies the internal padding for the widget. The padding is a list of up to four length specifications; see \fBTtk_GetPaddingFromObj()\fR for details. .OP \-selectmode selectMode SelectMode Controls how the built-in class bindings manage the selection. One of \fBextended\fR, \fBbrowse\fR, or \fBnone\fR. .br If set to \fBextended\fR (the default), multiple items may be selected. If \fBbrowse\fR, only a single item will be selected at a time. If \fBnone\fR, the selection will not be changed. .br Note that application code and tag bindings can set the selection however they wish, regardless of the value of \fB-selectmode\fR. .OP \-show show Show A list containing zero or more of the following values, specifying which elements of the tree to display. .RS .IP \fBtree\fR Display tree labels in column #0. .IP \fBheadings\fR Display the heading row. .PP The default is \fBtree headings\fR, i.e., show all elements. .PP \fBNOTE:\fR Column #0 always refers to the tree column, even if \fB-show tree\fR is not specified. .RE .SH "WIDGET COMMAND" .TP \fIpathname \fBbbox\fR \fIitem\fR ?\fIcolumn\fR? Returns the bounding box (relative to the treeview widget's window) of the specified \fIitem\fR in the form \fIx y width height\fR. If \fIcolumn\fR is specified, returns the bounding box of that cell. If the \fIitem\fR is not visible (i.e., if it is a descendant of a closed item or is scrolled offscreen), returns the empty list. .TP \fIpathname \fBcget\fR \fIoption\fR Returns the current value of the specified \fIoption\fR; see \fIwidget(n)\fR. .TP \fIpathname \fBchildren\fR \fIitem\fR ?\fInewchildren\fR? If \fInewchildren\fR is not specified, returns the list of children belonging to \fIitem\fR. .br If \fInewchildren\fR is specified, replaces \fIitem\fR's child list with \fInewchildren\fR. Items in the old child list not present in the new child list are detached from the tree. None of the items in \fInewchildren\fR may be an ancestor of \fIitem\fR. .TP \fIpathname \fBcolumn\fR \fIcolumn\fR ?\fI-option \fR?\fIvalue -option value...\fR? Query or modify the options for the specified \fIcolumn\fR. If no \fI-option\fR is specified, returns a dictionary of option/value pairs. If a single \fI-option\fR is specified, returns the value of that option. Otherwise, the options are updated with the specified values. The following options may be set on each column: .RS .TP \fB-id \fIname\fR The column name. This is a read-only option. For example, [\fI$pathname \fBcolumn #\fIn \fB-id\fR] returns the data column associated with display column #\fIn\fR. .TP \fB-anchor\fR Specifies how the text in this column should be aligned with respect to the cell. One of \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. .TP \fB-minwidth\fR The minimum width of the column in pixels. The treeview widget will not make the column any smaller than \fB-minwidth\fR when the widget is resized or the user drags a column separator. .TP \fB-stretch\fR Specifies whether or not the column's width should be adjusted when the widget is resized. .TP \fB-width \fIw\fR The width of the column in pixels. Default is something reasonable, probably 200 or so. .PP Use \fIpathname column #0\fR to configure the tree column. .RE .TP \fIpathname \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? Modify or query widget options; see \fIwidget(n)\fR. .TP \fIpathname \fBdelete\fR \fIitemList\fR Deletes each of the items in \fIitemList\fR and all of their descendants. The root item may not be deleted. See also: \fBdetach\fR. .TP \fIpathname \fBdetach\fR \fIitemList\fR Unlinks all of the specified items in \fIitemList\fR from the tree. The items and all of their descendants are still present and may be reinserted at another point in the tree but will not be displayed. The root item may not be detached. See also: \fBdelete\fR. .TP \fIpathname \fBexists \fIitem\fR Returns 1 if the specified \fIitem\fR is present in the tree, 0 otherwise. .TP \fIpathname \fBfocus \fR?\fIitem\fR? If \fIitem\fR is specified, sets the focus item to \fIitem\fR. Otherwise, returns the current focus item, or \fB{}\fR if there is none. .\" Need: way to clear the focus item. {} works for this... .TP \fIpathname \fBheading\fR \fIcolumn\fR ?\fI-option \fR?\fIvalue -option value...\fR? Query or modify the heading options for the specified \fIcolumn\fR. Valid options are: .RS .TP \fB-text \fItext\fR The text to display in the column heading. .TP \fB-image \fIimageName\fR Specifies an image to display to the right of the column heading. .TP \fB-anchor \fIanchor\fR Specifies how the heading text should be aligned. One of the standard Tk anchor values. .TP \fB-command \fIscript\fR A script to evaluate when the heading label is pressed. .PP Use \fIpathname heading #0\fR to configure the tree column heading. .RE .TP \fIpathname \fBidentify \fIcomponent x y\fR Returns a description of the specified \fIcomponent\fR under the point given by \fIx\fR and \fIy\fR, or the empty string if no such \fIcomponent\fR is present at that position. The following subcommands are supported: .RS .TP \fIpathname \fBidentify row\fR \fIx y\fR Returns the item ID of the item at position \fIy\fR. .TP \fIpathname \fBidentify column\fR \fIx y\fR Returns the data column identifier of the cell at position \fIx\fR. The tree column has ID \fB#0\fR. .PP See \fBCOLUMN IDENTIFIERS\fR for a discussion of display columns and data columns. .RE .TP \fIpathname \fBindex \fIitem\fR Returns the integer index of \fIitem\fR within its parent's list of children. .TP \fIpathname \fBinsert\fR \fIparent\fR \fIindex\fR ?\fB-id \fIid\fR? \fIoptions...\fR Creates a new item. \fIparent\fR is the item ID of the parent item, or the empty string \fB{}\fR to create a new top-level item. \fIindex\fR is an integer, or the value \fBend\fR, specifying where in the list of \fIparent\fR's children to insert the new item. If \fIindex\fR is less than or equal to zero, the new node is inserted at the beginning; if \fIindex\fR is greater than or equal to the current number of children, it is inserted at the end. If \fB-id\fR is specified, it is used as the item identifier; \fIid\fR must not already exist in the tree. Otherwise, a new unique identifier is generated. .br \fIpathname \fBinsert\fR returns the item identifier of the newly created item. See \fBITEM OPTIONS\fR for the list of available options. .TP \fIpathname \fBinstate \fIstatespec\fR ?\fIscript\fR? Test the widget state; see \fIwidget(n)\fR. .TP \fIpathname \fBitem\fR \fIitem\fR ?\fI-option \fR?\fIvalue -option value...\fR? Query or modify the options for the specified \fIitem\fR. If no \fI-option\fR is specified, returns a dictionary of option/value pairs. If a single \fI-option\fR is specified, returns the value of that option. Otherwise, the item's options are updated with the specified values. See \fBITEM OPTIONS\fR for the list of available options. .TP \fIpathname \fBmove \fIitem parent index\fR Moves \fIitem\fR to position \fIindex\fR in \fIparent\fR's list of children. It is illegal to move an item under one of its descendants. .br If \fIindex\fR is less than or equal to zero, \fIitem\fR is moved to the beginning; if greater than or equal to the number of children, it's moved to the end. .TP \fIpathname \fBnext \fIitem\fR Returns the identifier of \fIitem\fR's next sibling, or \fB{}\fR if \fIitem\fR is the last child of its parent. .TP \fIpathname \fBparent \fIitem\fR Returns the ID of the parent of \fIitem\fR, or \fB{}\fR if \fIitem\fR is at the top level of the hierarchy. .TP \fIpathname \fBprev \fIitem\fR Returns the identifier of \fIitem\fR's previous sibling, or \fB{}\fR if \fIitem\fR is the first child of its parent. .TP \fIpathname \fBsee\fR \fIitem\fR Ensure that \fIitem\fR is visible: sets all of \fIitem\fR's ancestors to \fB-open true\fR, and scrolls the widget if necessary so that \fIitem\fR is within the visible portion of the tree. .TP \fIpathname \fBselection\fR ?\fIselop\fR \fIitemList\fR? If \fIselop\fR is not specified, returns the list of selected items. Otherwise, \fIselop\fR is one of the following: .RS .TP \fIpathname \fBselection set \fIitemList\fR \fIitemList\fR becomes the new selection. .TP \fIpathname \fBselection add \fIitemList\fR Add \fIitemList\fR to the selection .TP \fIpathname \fBselection remove \fIitemList\fR Remove \fIitemList\fR from the selection .TP \fIpathname \fBselection toggle \fIitemList\fR Toggle the selection state of each item in \fIitemList\fR. .RE .TP \fIpathname \fBset\fR \fIitem\fR ?\fIcolumn\fR ?\fIvalue\fR?? With one argument, returns a dictionary of column/value pairs for the specified \fIitem\fR. With two arguments, returns the current value of the specified \fIcolumn\fR. With three arguments, sets the value of column \fIcolumn\fR in item \fIitem\fR to the specified \fIvalue\fR. See also \fBCOLUMN IDENTIFIERS\fR. .TP \fIpathname \fBstate\fR ?\fIstateSpec\fR? Modify or query the widget state; see \fIwidget(n)\fR. .TP \fIpathName \fBtag \fIargs...\fR .RS .TP \fIpathName \fBtag bind \fItagName \fR?\fIsequence \fR?\fIscript\fR?? Add a Tk binding script for the event sequence \fIsequence\fR to the tag \fItagName\fR. When an X event is delivered to an item, binding scripts for each of the item's \fB-tags\fR are evaluated in order as per \fIbindtags(n)\fR. .br \fB\fR, \fB\fR, and virtual events are sent to the focus item. \fB\fR, \fB\fR, and \fB\fR events are sent to the item under the mouse pointer. No other event types are supported. .br The binding \fIscript\fR undergoes \fB%\fR-substitutions before evaluation; see \fBbind(n)\fR for details. .TP \fIpathName \fBtag configure\fR \fItagName\fR ?\fIoption\fR? ?\fIvalue option value...\fR? Query or modify the options for the specified \fItagName\fR. If one or more \fIoption/value\fR pairs are specified, sets the value of those options for the specified tag. If a single \fIoption\fR is specified, returns the value of that option (or the empty string if the option has not been specified for \fItagName\fR). With no additional arguments, returns a dictionary of the option settings for \fItagName\fR. See \fBTAG OPTIONS\fR for the list of available options. .RE .TP \fIpathName \fBxview \fIargs\fR Standard command for horizontal scrolling; see \fIwidget(n)\fR. .TP \fIpathName \fByview \fIargs\fR Standard command for vertical scrolling; see \fIwidget(n)\fR. .PP .SH "ITEM OPTIONS" The following item options may be specified for items in the \fBinsert\fR and \fBitem\fR widget commands. .OP \-text text Text The textual label to display for the item. .OP \-image image Image A Tk image, displayed to the left of the label. .OP \-values values Values The list of values associated with the item. .br Each item should have the same number of values as the \fB-columns\fR widget option. If there are fewer values than columns, the remaining values are assumed empty. If there are more values than columns, the extra values are ignored. .OP \-open open Open A boolean value indicating whether the item's children should be displayed (\fB-open true\fR) or hidden (\fB-open false\fR). .OP \-tags tags Tags A list of tags associated with this item. .SH "TAG OPTIONS" The following options may be specified on tags: .IP \-foreground Specifies the text foreground color. .IP \-background Specifies the cell or item background color. .IP \-font Specifies the font to use when drawing text. .\" ??? Maybe: .IP \-anchor .\" ??? Maybe: .IP \-padding .\" ??? Maybe: .IP \-text .IP \-image Specifies the item image, in case the item's \fB-image\fR option is empty. .PP \fI(@@@ TODO: sort out order of precedence for options)\fR .SH "COLUMN IDENTIFIERS" Column identifiers take any of the following forms: .IP \(bu A symbolic name from the list of \fB-columns\fR. .IP \(bu An integer \fIn\fR, specifying the \fIn\fRth data column. .IP \(bu A string of the form \fB#\fIn\fR, where \fIn\fR is an integer, specifying the \fIn\fRth display column. .PP \fBNOTE:\fR Item \fB-values\fR may be displayed in a different order than the order in which they are stored. .PP \fBNOTE:\fR Column #0 always refers to the tree column, even if \fB-show tree\fR is not specified. .PP A \fIdata column number\fR is an index into an item's \fB-values\fR list; a \fIdisplay column number\fR is the column number in the tree where the values are displayed. Tree labels are displayed in column #0. If \fB-displaycolumns\fR is not set, then data column \fIn\fR is displayed in display column \fB#\fIn+1\fR. Again, \fBcolumn #0 always refers to the tree column\fR. .SH "VIRTUAL EVENTS" The treeview widget generates the following virtual events. .IP <> Generated whenever the selection changes. .IP <> Generated just before setting the focus item to \fB-open true\fR. .IP <> Generated just after setting the focus item to \fB-open false\fR. .PP The \fBfocus\fR and \fBselection\fR widget commands can be used to determine the affected item or items. In Tk 8.5, the affected item is also passed as the \fB-detail\fR field of the virtual event. .SH "SEE ALSO" widget(n), listbox(n), image(n), bind(n) tile-0.8.2/doc/widget.n0000644000076500007650000001751410730002143014251 0ustar joejoe00000000000000'\" '\" Copyright (c) 2004 Joe English '\" widget.n,v 1.15 2007/12/12 15:55:15 jenglish Exp '\" .so man.macros .TH widget n 0.2 tile "Tile Widget Set" .BS .SH NAME widget \- Standard options and commands supported by Tile widgets .BE .SH DESCRIPTION This manual describes common widget options and commands. .SH "STANDARD OPTIONS" The following options are supported by all Tile widgets: .OP \-class (N/A) (N/A) Specifies the window class. The class is used when querying the option database for the window's other options, to determine the default bindtags for the window, and to select the widget's default layout and style. This is a read-only option: it may only be specified when the window is created, and may not be changed with the \fBconfigure\fR widget command. .OP \-cursor cursor Cursor Specifies the mouse cursor to be used for the widget. See \fBTk_GetCursor\fR and \fIcursors(n)\fR in the Tk reference manual for the legal values. If set to the empty string (the default), the cursor is inherited from the parent widget. .OP \-takefocus takeFocus TakeFocus Determines whether the window accepts the focus during keyboard traversal. Either \fB0\fR, \fB1\fR, a command prefix (to which the widget path is appended, and which should return \fB0\fR or \fB1\fR), or the empty string. See \fIoptions(n)\fR in the Tk reference manual for the full description. .OP \-style style Style May be used to specify a custom widget style. .SH "SCROLLABLE WIDGET OPTIONS" The following options are supported by widgets that are controllable by a scrollbar. See \fIscrollbar(n)\fR for more information .OP \-xscrollcommand xScrollCommand ScrollCommand A command prefix, used to communicate with horizontal scrollbars. .RS When the view in the widget's window changes, the widget will generate a Tcl command by concatenating the scroll command and two numbers. Each of the numbers is a fraction between 0 and 1 indicating a position in the document; 0 indicates the beginning, and 1 indicates the end. The first fraction indicates the first information in the widget that is visible in the window, and the second fraction indicates the information just after the last portion that is visible. .PP Typically the \fBxScrollCommand\fR option consists of the path name of a \fBscrollbar\fR widget followed by ``set'', e.g. ``.x.scrollbar set''. This will cause the scrollbar to be updated whenever the view in the window changes. .PP If this option is set to the empty string (the default), then no command will be executed. .RE .OP \-yscrollcommand yScrollCommand ScrollCommand A command prefix, used to communicate with vertical scrollbars. See the description of \fB\-xscrollcommand\fR above for details. .SH "LABEL OPTIONS" The following options are supported by labels, buttons, and other button-like widgets: .OP \-text text Text Specifies a text string to be displayed inside the widget (unless overridden by \fB\-textvariable\fR). .OP \-textvariable textVariable Variable Specifies the name of variable whose value will be used in place of the \fB\-text\fR resource. .OP \-underline underline Underline If set, specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation (see \fIkeynav(n)\fR). .OP \-image image Image Specifies an image to display. This is a list of 1 or more elements. The first element is the default image name. The rest of the list is a sequence of \fIstatespec / value\fR pairs as per \fBstyle map\fR, specifying different images to use when the widget is in a particular state or combination of states. All images in the list should have the same size. .OP \-compound compound Compound Specifies how to display the image relative to the text, in the case both \fB\-text\fR and \fB\-image\fR are present. Valid values are: .RS .IP text Display text only. .IP image Display image only. .IP center Display text centered on top of image. .IP top .IP bottom .IP left .IP right Display image above, below, left of, or right of the text, respectively. .IP none The default; display the image if present, otherwise the text. .RE .OP \-width width Width If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used. .SH "COMPATIBILITY OPTIONS" .OP \-state state State May be set to \fBnormal\fR or \fBdisabled\fR to control the \fBdisabled\fR state bit. This is a write-only option: setting it changes the widget state, but the \fBstate\fR widget command does not affect the \fB\-state\fR option. .SH COMMANDS .TP \fIpathName \fBcget\fR \fIoption\fR Returns the current value of the configuration option given by \fIoption\fR. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? Query or modify the configuration options of the widget. If one or more \fIoption\-value\fR pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the named option: the elements of the list are the option name, database name, database class, default value, and current value. .\" Note: Tile widgets don't use TK_OPTION_SYNONYM. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR. .TP \fIpathName \fBinstate\fR \fIstatespec\fR ?\fIscript\fR? Test the widget's state. If \fIscript\fR is not specified, returns 1 if the widget state matches \fIstatespec\fR and 0 otherwise. If \fIscript\fR is specified, equivalent to .CS if {[\fIpathName\fR instate \fIstateSpec\fR]} \fIscript\fR .CE .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? Modify or inquire widget state. If \fIstateSpec\fR is present, sets the widget state: for each flag in \fIstateSpec\fR, sets the corresponding flag or clears it if prefixed by an exclamation point. .RS Returns a new state spec indicating which flags were changed: .CS set changes [\fIpathName \fRstate \fIspec\fR] ; \fIpathName \fRstate $changes .CE will restore \fIpathName\fR to the original state. If \fIstateSpec\fR is not specified, returns a list of the currently-enabled state flags. .RE .SH "WIDGET STATES" The widget state is a bitmap of independent state flags. Widget state flags include: .TP \fBactive\fR The mouse cursor is over the widget and pressing a mouse button will cause some action to occur. (aka "prelight" (Gnome), "hot" (Windows), "hover"). .TP \fBdisabled\fR Widget is disabled under program control (aka "unavailable", "inactive") .TP \fBfocus\fR Widget has keyboard focus .TP \fBpressed\fR Widget is being pressed (aka "armed" in Motif). .TP \fBselected\fR "On", "true", or "current" for things like checkbuttons and radiobuttons. .TP \fBbackground\fR Windows and the Mac have a notion of an "active" or foreground window. The \fBbackground\fR state is set for widgets in a background window, and cleared for those in the foreground window. .TP \fBreadonly\fR Widget should not allow user modification. .TP \fBalternate\fR A widget-specific alternate display format. For example, used for checkbuttons and radiobuttons in the "tristate" or "mixed" state, and for buttons with \fB-default active\fR. .TP \fBinvalid\fR The widget's value is invalid. (Potential uses: scale widget value out of bounds, entry widget value failed validation.) .PP A \fIstate specification\fR or \fIstateSpec\fR is a list of state names, optionally prefixed with an exclamation point (!) indicating that the bit is off. .SH EXAMPLES .CS set b [ttk::button .b] # Disable the widget: $b state disabled # Invoke the widget only if it is currently pressed and enabled: $b instate {pressed !disabled} { .b invoke } # Reenable widget: $b state !disabled .CE .SH "SEE ALSO" tile-intro(n), style(n) .SH KEYWORDS state, configure, option tile-0.8.2/doc/INDEX.MAP0000644000076500007650000002015310731273212014016 0ustar joejoe00000000000000 tile-0.8.2/generic/0000755000076500007650000000000010731273213013457 5ustar joejoe00000000000000tile-0.8.2/generic/Makefile.in0000644000076500007650000001141410731266207015532 0ustar joejoe00000000000000# # @configure_input@ # ### Identification division. # PACKAGE_NAME = tile PACKAGE_VERSION = 0.8.2 ### Environment division. # srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ libdir = @libdir@ includedir = @includedir@ TCL_PKGPATH = $(prefix)/lib pkglibdir = $(TCL_PKGPATH)/$(PACKAGE_NAME)$(PACKAGE_VERSION) EXTRA_DEFINES = DEFS = @DEFS@ $(EXTRA_DEFINES) LIBS = @LIBS@ INCLUDES = -I$(srcdir) @TCL_INCLUDES@ @TK_INCLUDES@ @TK_XINCLUDES@ TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@ TK_LIB_SPEC = @TK_LIB_SPEC@ PKG_LIBS = @PKG_LIBS@ CC = @CC@ SHLIB_LD = @SHLIB_LD@ STLIB_LD = @STLIB_LD@ RANLIB = @RANLIB@ WISH_PROG = @WISH_PROG@ TCLSH_PROG = @TCLSH_PROG@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ OBJEXT = @OBJEXT@ LIB_PREFIX = @LIB_PREFIX@ SHLIB_SUFFIX = @SHLIB_SUFFIX@ STLIB_SUFFIX = @STLIB_SUFFIX@ # Extra definitions not referenced directly, but that may appear # inside other susbtitutions inserted by TEA: # AR = @AR@ LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ ### Data division. # CLEANFILES = *.o *.obj $(tile_LIB_FILE) $(tile_STUB_LIB_FILE) tile_STUB_LIB_FILE = $(LIB_PREFIX)ttkstub$(STLIB_SUFFIX) tile_STUB_LIB_OBJS = ttkStubLib.$(OBJEXT) tile_LIB_FILE = $(PACKAGE_NAME)$(SHLIB_SUFFIX) tile_LIBS = \ $(TCL_STUB_LIB_SPEC) \ $(TK_STUB_LIB_SPEC) \ $(PKG_LIBS) tile_OBJECTS = \ tile.$(OBJEXT) \ ttkStubInit.$(OBJEXT) \ tkstate.$(OBJEXT) \ separator.$(OBJEXT) \ frame.$(OBJEXT) \ button.$(OBJEXT) \ scrollbar.$(OBJEXT) \ scale.$(OBJEXT) \ progress.$(OBJEXT) \ notebook.$(OBJEXT) \ paned.$(OBJEXT) \ entry.$(OBJEXT) \ treeview.$(OBJEXT) tagset.$(OBJEXT) \ layout.$(OBJEXT) \ widget.$(OBJEXT) \ trace.$(OBJEXT) \ track.$(OBJEXT) \ blink.$(OBJEXT) \ scroll.$(OBJEXT) \ manager.$(OBJEXT) \ tkElements.$(OBJEXT) \ label.$(OBJEXT) \ altTheme.$(OBJEXT) \ classicTheme.$(OBJEXT) \ tkTheme.$(OBJEXT) \ cache.$(OBJEXT) \ image.$(OBJEXT) \ clamTheme.$(OBJEXT) \ @PLATFORM_OBJS@ X11_OBJS = WIN_OBJS = winTheme.$(OBJEXT) xpTheme.$(OBJEXT) monitor.$(OBJEXT) MAC_OBJS = aquaTheme.$(OBJEXT) WISH_ENV = TILE_LIBRARY="$(TILE_LIBRARY)" TCLLIBPATH="." WISH = $(WISH_ENV) $(WISH_PROG) ### Procedure division. # VPATH = @srcdir@:@srcdir@/../win:@srcdir@/../macosx .PHONY: default all package clean distclean doc install installdirs .PHONY: test valgrind vgtest ### Targets section. # default: all all: package libraries install: install-package install-libraries package: $(tile_LIB_FILE) libraries: $(tile_STUB_LIB_FILE) ### Build stuff section. # .SUFFIXES: .c .@OBJEXT@ .c.@OBJEXT@: @echo $< @$(CC) -c $(CPPFLAGS) $(DEFS) $(INCLUDES) $(CFLAGS) $< -o $@ $(tile_LIB_FILE): $(tile_OBJECTS) -rm -f $@ $(SHLIB_LD) @SHLIB_LD_OUT@$@ $(tile_OBJECTS) $(LDFLAGS) $(tile_LIBS) $(tile_STUB_LIB_FILE): $(tile_STUB_LIB_OBJS) -rm -f $@ $(STLIB_LD) @STLIB_LD_OUT@$@ $(tile_STUB_LIB_OBJS) $(RANLIB) $@ ### Documentation section. # ### Test stuff section. # TILE_LIBRARY = $(srcdir)/../library TESTLOAD = -load "load ./$(tile_LIB_FILE)" TESTDRIVER = $(srcdir)/../tests/all.tcl $(TESTLOAD) TESTFLAGS = -verbose e VALGRIND_OPTS = --tool=memcheck --leak-check=yes --num-callers=10 VALGRIND = valgrind $(VALGRIND_OPTS) VGTESTFLAGS = -verbose pbe -singleproc true test :: $(WISH) $(TESTDRIVER) $(TESTFLAGS) vgtest :: $(WISH_ENV) $(VALGRIND) $(WISH_PROG) $(TESTDRIVER) $(VGTESTFLAGS) \ 2>&1 | tee valgrind.log valgrind :: $(WISH_ENV) $(VALGRIND) $(WISH_PROG) $(SCRIPT) 2>&1 | tee valgrind.log demo :: $(WISH) $(srcdir)/../demos/demo.tcl shell :: $(WISH) $(SCRIPT) gdb: $(WISH_ENV) gdb $(WISH_PROG) ### Install stuff section. # $(DESTDIR)$(pkglibdir): mkdir -p $(DESTDIR)$(pkglibdir) install-package: package $(DESTDIR)$(pkglibdir) $(INSTALL_PROGRAM) $(tile_LIB_FILE) \ $(DESTDIR)$(pkglibdir)/$(tile_LIB_FILE) $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir)/pkgIndex.tcl for libfile in $(TILE_LIBRARY)/*.tcl ; do \ $(INSTALL_DATA) $$libfile $(DESTDIR)$(pkglibdir) ; done install-libraries: libraries mkdir -p $(DESTDIR)$(libdir) mkdir -p $(DESTDIR)$(includedir) $(INSTALL_DATA) $(tile_STUB_LIB_FILE) $(DESTDIR)$(libdir) $(INSTALL_DATA) $(srcdir)/tkTheme.h $(DESTDIR)$(includedir) $(INSTALL_DATA) $(srcdir)/ttkDecls.h $(DESTDIR)$(includedir) ### Maintain stuff section. # Makefile : $(srcdir)/Makefile.in config.status sh config.status tags :: ctags $(srcdir)/*.[ch] GENSTUBS = $(TCLSH_PROG) $(srcdir)/../tools/genStubs.tcl genstubs : $(GENSTUBS) $(srcdir) $(srcdir)/ttk.decls ### Cleanup section. # clean:: -rm -f $(CLEANFILES) distclean: clean -rm -f Makefile config.cache config.log config.status pkgIndex.tcl # *EOF* tile-0.8.2/generic/TODO0000644000076500007650000005340310276503107014156 0ustar joejoe00000000000000[18 Jan 2004] Default/Classic "groove" border is wrong on X11 -- use "alt" borders instead. [16 Mar 2005] -- request from Damon Courtney -- "split" menubuttons. Extra features needed in ttk::menubutton: "-command" option, "identify" method. [8 Mar 2005] -- ttk::progressbar -- use [$pb start] / [$pb stop]. [$pb start] should take arguments to control speed of cylon block. [9 Mar 2005] -- possible bug: [ttk::frames] with custom styles don't compute reqwidth properly; fails to account for -padding (see nbtest.tcl); [10 minutes later]: Nope, was apparently mistaken; it does work. [2 Mar 2005] -- AllocateResource -- allow TK_OPTION_COLOR, other options to have NULL defaults. [20 Dec 2004] - winnative theme -- toolbar buttons -- should have "thin" borders, not "thick" ones. Same probably goes for labels too. [3 Oct 2004]: Treeview -- drag scrollbar down really fast -- can scroll "past end" of widget. [fixed?] [28 Sep 2004]: Swap argument order in TTK_DrawLayout: layout, state, d [done] [28 Sep 2004]: element "geometryProc" now "sizeProc"; eventually need to get around to updating all the element definitions. [21 Sep 2004]: It's now safe to redefine layouts; make this legal. (plus fix memory leak). Still can't redefine elements though. [19 Sep 2004]: Dump Tk_Draw3DBorder() and related routines -- it does the Wrong Thing on Windows more often than not. (LIGHT_GC and DARK_GC don't match System3DLight and System3DDarkShadow; "extra" border color (??? what does Windows call this???) not chosen correctly; draws wrong pattern for entry fields, listboxes, etc.) Better to just do this by hand. [19 Sep 2004]: DrawEdge() actually uses 4-color borders, not 3-color. This causes a(nother) notebook glitch if winnative theme is used when "Windows XP style" is selected. In "Windows Classic style", the 4th color (inner upper/left) matches the frame color so the glitch isn't visible. Fix later. [17 Sep 2004]: To seriously think about: interactive test harness for regression-testing look and feel. CONSIDER: Possibly: avoid setting 'pressed', 'active' in disabled state, so themes don't need to check 'active !disabled'. OTOH, there's no reason an element can't be active and disabled at the same time, and some themes might want to treat that specially. [16 Sep 2004]: Make sure 'disabled' state properly supported in all themes. (Should override 'active' and 'pressed' feedback, others) Consider: add 'readonly' state support for checkbuttons, others. [4 Mar 2005]: Definitely add 'readonly' support for checkbuttons -- useful for output-only checkbuttons (e.g., "checklist" progress windows). [10 Sep 2004] altTheme BorderElement -- separate into BorderElement and DefaultRing, or separate BorderElement and ButtonBorderElement. TTK_StateMapLookup -- don't need interp parameter or error message. Make TTK_StateMap type "more opaque". [2 Sep 2004]: Request from JH: Explicit support in notebook widget for "fattening" tabs; expand selected tab's parcel to overlap neighbors. [done, 13 Sep 2004] [4 Sep 2004] Layout engine: TODO: Remove TTK_STICK_ALL alias for TTK_FILL_BOTH; redundant and confusing [done] TTK_EXPAND confusing, possibly get rid of it; expand elements with no PACK_* bits set and/or last in group instead Theme engine routines: 'recordPtr' parameter ought to be a "void *", not (ClientData). [29 Aug 2004]: Consider: use focus ring in notebook tabs in all themes (except OSX, classic). [18 Aug 2004]: Requests from Jeff: + add margins around check/radiobutton indicators (esp. XP theme) [done, JH,PT] + [style theme use] should return current theme [done] + Need separator widget. [done] + Make scrollbars autodisable when full [done, JH] [5 Jul 2004]: Looks like XDrawRectangle() emulation on MacOSX does *not* have the off-by-one glitch. Which makes it incompatible with the real XDrawRectangle, which does... [5 Jul 2004]: combobox: BUG: MacOSX: "pull-down" interaction doesn't work, only "pop-down" does. [1 Jul 2004]: combobox binding quirk (shared w/readonly BWidget combobox): Pulldown listbox; drag outside listbox; release: Listbox stays posted (this may or may not be right). Press inside listbox: selection "blinks" to pressed item, then reverts back (This is definitely wrong). Oakley combobox cancels listbox in step 1. [1 Jul 2004]: combobox: BUG: CBListbox binding doesn't clean up the right variable. [fixed] [1 Jul 2004]: Combobox (on Windows) BUG: Press; drag over listbox; drag off of listbox; release; click scrollbar thumb & drag up & down -- listbox selection changes. (Check on Unix). Probable cause: at this point, combobox has grab, listbox never got event, but did get . Listbox probably confused. (Oakley combobox does the same thing). BUG: Windows: post listbox (popdown or pulldown and drag away); click on another window; other window activates, listbox stays posted until main app gets keypress. Can even end up below main window. (Probably due to [grab -global] not working the same on Windows) (Oakley and BWidget comboboxes don't have this problem -- what do they do differently?) [Maybe fixed: unpost when listbox gets event] [That seems to be what BWidget and Oakley boxes do, too] BUG: Combobox on Windows: Possible to iconify toplevel while listbox is active. [Maybe fixed, see above] BUG: Combobox on Windows: main toplevel is inactive (unfocused) when listbox posted (BWidget too, but not Oakley. Oakley combobox leaves focus on entry widget, passes and to listbox directly. Other keys handled by entry (and listbox loses curselection, which is probably not right)) [from JH on clt -- same issue as above] <412ADA9C.60609@removethis.activestate.com> | [...] It still has the issue (on Windows) that when | the toplevel drops down, the host toplevel loses focus. Note | that this doesn't happen with the win32 combobox control. I'm | not 100% sure how they manage this trick (I have a few guesses, | but am not sure). BUG: Grabs in general are problematic. [30 Jun 2004]: For consideration: Make -xscrollcommand, -yscrollcommand command prefixes instead of script prefixes? | jenglish Right now -xscrollcommand is a string, to | which additional arguements are appended "as if" they were | list elements; and the result is intepreted as a script. | jenglish My proposed change: -xscrollcommand is | interpreted as a list, to which additional arguments are | appended; and the result is invoked as a command | tclguy jenglish - I fully support that | tclguy jenglish - I suspect that is a remnant of the | days pre-8.0 when lists weren't real structures | tclguy jenglish - I know similar things need fixing in the core still [29 Jun 2004]: Clam theme: Frame widgets: Need to support -borderwidth 0. (Probable solution: treat zero borderwidth as no border, nonzero as 2). (Add note in "Programmer-visible changes", subheading "theme-dependant stuff"). [26 Jun 2004]: Entry widget binding bug: press, drag back and forth slowly -- behaves one way press, drag back and forth quickly -- behaves another way. Sort this out. (Probably cause: "slowly" behaviour is what it's intended to do, but dragging the mouse too quickly skips past a transition state in entry::ExtendTo) [fixed] [17 Jun 2004]: Entry: POSSIBLY: after configuring -exportselection false, do nothing in LostSelection. Maybe. Possibly: Let FetchSelection return data even if -exportselection false (user could have explicitly used [selection own]) BUG: If -exportselection false, still display selection. [fixed] [17 Jun 2004]: Make sure EntryPlaceTextLayout is called whenever anything that affects it is changed; [$entry xview] isn't the only place that requires up-to-date information. bind TEntry <> { %W selection range 0 end; %W icursor end } [14 Jun 2004]: WidgetDestroyed -- check Tcl_InterpDeleted(corePtr->interp), other Possibly Bad Things. (maybe). [12 Jun 2004] Argh. WidgetSubcommandProcs take arguments in different order than Tcl_ObjCmdProcs (closure last vs. closure first). Sigh. [8 Jun 2004]: Possibly: treat "-state active" the same as "-state normal". [8 Jun 2004]: TraceVariable -- Variable trace procedures should return 'void' for now, since we're not doing anything with the return value. [May 2004]: leaving -width option default blank causes BWidget incompatibilities (breaks Label). Setting a default overrides theme defaults. Decide which is more important. [30 Apr 2004]: dkf_fontSel dialog problems: sample text frame sets -width and -height options, which TFrame doesn't use. (Rationale: height and width of a frame are normally controlled by geometry manager based on children. This turns out to be wrong: [grid/pack propagate $f 0] can be used to make the frame's -width/height take precedence. (only do this in FrameConfigure though, otherwise layout blinks.) [fixed 11 May 2004] dkf_fontSel also uses resource-queries on scratch widgets (like BWidget does) for label -font resource; this breaks. [fixed 10 May 2004] [23 Apr 2004]: TODO: Add <> bindings for TLabel and TLabelframe (set focus to next focusable sibling / first focusable child). [5 Apr 2004, JH]: "change the padding of a tnotebook dynamically doesn't force a resize of the children" 22 Apr 2004: Focus problems w/notebook widget: mnemonic activation can leave focus on unmapped widget. Consider: Pass 'state' to element geometry procs too? Progressbars should not take focus. [3 Apr 2004] Vertical progress bars should grow up, not down. [19 Mar 2004]: Documentation: consistentize terminology: + the "-command" option is a _script_ which is _evaluated_. Also: _script prefix_ (-xscrollcommand, &c), _script template_ (-validatecommand &c). Consider: maybe -xscrollcommand should be a _command prefix_; + Widgets have "options" (not "resources", that's an Xt thing...) + Decide one way or the other "tfoobutton" or "foobutton". + [20 Jun 2004]: always use bold (or italic, decide) for manpage xrefs. (TMML keywords index: idea: specify a list of common prefixes to strip when sorting, so eg "TTK_Box" is sorted under "B", not under "T" with all the rest of the "TTK_" stuff. Also: Remove duplicates in column 2.) [Configure] -- any way to specify a minimum Tk dependency in configure script? [20 Feb 2004]: generic/layout.c(BuildLayout): Don't Panic. [fixed,31Dec2004] [14 Mar 2004]: menubuttons -- popdown -- should stay in {pressed active} state until the menu is dismissed. Oddity: On XP: click menubutton (tile or standard) to post menu; move mouse away; other widgets still get and events until the mouse enters the menu; then others stop hot-tracking. [14 Mar 2004] TODO: double-check menubutton state transitions on X11. [Checked; they were wrong. Still are, actually, but it's difficult to get this right without cooperation from the [menu] widget implementation.] [14 Mar 2004]: pixmapTheme.c -- need to do error-checks re: missing images earlier. [14 Mar 2004]: Consider using Tcl_BackgroundError() where appropriate. (Note: it's probably not appropriate during processing, unless the error condition can be fixed or disabled.) [22 Feb 2004]: Don't use SystemButtonFace as default background in classic or other non-Windows themes (unless you also use SystemWindowText as default foreground) -- some high-contrast color schemes use white-on-black. [done] [21 Feb 2004]: TODO: work out sensible fallback algorithm for layouts and styles, so users can define custom styles without having to worry about every possible theme. [21 Feb 2004]: Display/layout glitch: demo program, XP theme: "Close button" in "Widget states" dialog is the wrong size when first created. Reselecting the theme fixes. Suspicion: perhaps GetThemePartSize() doesn't work when the window is not realized, so initial geometry wrong? But why just this widget? Another bug in [grid]? [Probably fixed, 16 Mar 2004] [Fix confirmed] @@@ [10 Feb 2004] Revisit label/compound element: this is starting to really bother me. @@@ [10 Feb 2004] New bug: label/compound element: -anchor and -width do not mix. [fixed] @@@ TODO: SOON: Plug all memory leaks. Lots of known ones, possibly a few unknown ones too. @@@ BUG: <> messages not processed if widget is not realized. (See also: bug #835997) [fixed, 16 Mar 2004]. @@@ Issue: Don't even think about using the Tile widgets on a PseudoColor visual. All hell breaks loose. (This is another instance of the resource management problem affecting fonts and images). [Should be fixed now, 12 Feb 2004] Issue: May need state-based dynamic widget settings too (most useful: -image and -cursor). AllocateResource: Tk_GetFont() calls are extremely expensive unless the font is already in use. Using named fonts doesn't help. Same is probably true for colors and borders, and is definitely true for images. [Should be fixed now, 12 Feb 2004] @@@ Investigate performance issues. TWS is getting to be as slow as GTK+. [see above] [much better now] Problem: [style map TNotebook -borderwidth { focus 2 {} 1 }] doesn't do the right thing: will normally use the default 1 when computing geometry, which will not allocate enough space for when the widget has focus. Possible solutions: + special-case: add -maxborderwidth option + add 'geometry' state bit, user can specify { geometry 2 focus 2 {} 1} Possibly: Issue <>, <> virtual events [Q: Can we register a C-language event handler for these?] [A: Yes.] [done; but see BUG, above] [above BUG fixed now] @@@ NEED: introspection/debugging features (what elements make up a layout, what resources get set, &c). @@@ [style default/map] -- make sure changes get propagated to ElementImpl's. [style map] -- validate statemaps [done] @@@ change TTK_LAYOUT_AROUND to TTK_LAYOUT_BORDER; update WidgetGeometry() to use TTK_LAYOUT_BORDER-tagged element to set internal padding. [On second thought, don't. May not be necessary] @@@ Layout engine BUG: TTK_LAYOUT_INSIDE, TTK_LAYOUT_BORDER nodes must be the sole children of their parent node, otherwise reqsize calculation is wrong. (probable cause of problem: INSIDE/BORDER flags lack a packing specification). [ Fixed now, 28 Jan 2004 ] @@@ TTK_LayoutFindNode, [$sb identify], &c -- need a way to identify nodes by name instead of class. [??? Probably not needed anymore ???] ~~ Layout engine: + Reimplement; the current design is subtly but fatally flawed. [ done, 28 Jan 2004 ] + Change ElementSpec draw procedure to take a TTK_Box instead of separate x, y, width, height arguments. [done, 9 Mar 2004] ~~ General: + Use TK_OPTION_STRING instead of TK_OPTION_END for TTK_OPTION_ANY [done] + Need per-engine cleanup procedures. [done, PT] + Rethink resource allocation (AllocateResource,DeallocateResources) + [style configure] should schedule a WorldChanged call + WorldChanged handler should reload all elements [done] + Need: windows-native theme (use native (non-XP-theme) widgets) [started] + Need: MacOSX-native theme (ditto). + Need to support both "native/default" L&F and highly-customized L&F (Ex: http://www.iit.demokritos.gr/~petasis/Tcl/PeculiarButtons.gif) + Consider: distinguish "engines" from "themes" a la Gnome -- "engines" provide specific element implementations, themes bind them to individual elements. Rationale: a theme may want to pick up e.g., borders from altTheme, other elements drawn using pixmap element from pixmapTheme, frame borders from classic theme. (Maybe not; an "engine" is just a package that defines elements or element factories, no need to make this a first-class entity). ~~ Frames, labelframes: + Need -width, -height options. These don't have any effect if you use [pack] or [grid], but may be useful for [place] [done] + [13 Feb 2005] labelframe: min req. size doesn't account for label. [Fixed] ~~ Buttons, checkbuttons, radiobuttons: + Label widgets should take -relief option, possibly -borderwidth + rename 'compound' element to 'label', 'label' => 'text' [done] + add -width resource to text element; negative -width => minimum. [done] + [$checkbutton configure -variable foo] does not set state [fixed] + [$label configure -textvariable foo] does not update -text [fixed] + alt theme: focus ring should go around text (in check/radio buttons) (maybe we can get away with not doing this...) [fixed, but this broke -anchor option] + check/radiobutton -anchor option does not work in alt theme. (Can either get focus ring in the right place or a working -anchor, but not both.) + alt theme: buttons: move focus ring back into BorderElement; this shouldn't shift in/out on press/release. (OR: move shift in/out logic from PressableBorderElement into PaddingElement -- better solution) [done, 5Apr2004] + Schedule redraw/resize when image changes. ~~ Scrollbars: + classic theme: scrollbar arrows don't look quite right. + alt theme: scrollbar arrows don't look quite right. [should be fixed] + scrollbar elements don't activate/prelight on hover. [fixed] ~~ Notebook: (suggestions from dkf) + Track active state for tabs [done] + add [$nb index current] [done] + Generate <> on raise. [done] + Possibly: [$nb index $labelName] -- interpret $labelName as pattern. (Not done: conflicts with [$nb index current], [$nb index end]; not very useful in the context of L10N) + a way to reorder tabs, and insert tabs at places other than the end [$nb insert $idx $child options...]; if $child is already in, this moves it? + Ctrl-Tab / Ctrl-Shift-Tab to switch panes [this is turning out to be rather tricky to do ...] [Resolution: Won't do. Ctrl-Tab is the only way to tab out of a Text widget, don't want to override this.] [Changed mind: DKF convinced me that this is really desirable. Still don't know how to do it.] [22 Apr 2004: Done, finally] + On raise -- set focus to first child of raised pane. [no, don't] + Possibly: allow focus on tabs? (, switches tabs) Better: Focus on notebook widget, current tab implicitly has focus. [done] + Possibly: [$nb select] instead of [$nb raise] [done] + Possibly: a way to pack widgets inside tabs (gtk+), and/or in the area to the right of the tabs (Mozilla). + -sticky option for panes -- determine how to place child widget in client parcel [done] + Possibly (but probably not): allow non-child widgets to be added as panes (not supporting this simplifies things a LOT though). + Possibly: -raisecommand, -leavecommand for tabs? [No: see tktable-tile-dev discussion. <> suffices] + Handle case where widget is not wide enough to display all tabs (display left, right tabscroll arrows at right end of tab row) [Resolution: best approach is to squeeze all tabs. Scrolling tab row and stacked tabs are horrible usability-wise; not going to add all that complexity for the benefit of bad UIs.] [done, 16 Sep 2004] + [JH] Theme-specific left and right padding for tab area (needed for correct L&F on XP) [done, 13 Sep 2004] + BUG: doesn't display properly if borderwidth > 1 [N/A anymore] + Possibly: add -side {top|bottom|left|right} option; + Possibly: add -side option with same values as labelframe -labelanchor + Possibly: add per-tab -side option ~~ Windows native theme: + Scrollbar trough not always drawn w/right color (stippled?) + Pushbuttons don't show default indicator or focus ring [fixed] + Focus ring drawn in the wrong color + Check/radiobutton indicators: if you select one of the "large" display settings, these look wrong. + FrameControlElements automatically adapt to system color changes, elements that use a -background resource do not (maybe this should be fixed in Tk instead (TIP 156?)) [fixed, 22 Feb 2004]. ~ Eventually: + Make 'alt' theme the default (or something even simpler), move Motif L&F to "classic" theme. [done] ~ Possible refactorings: + Reattach Layouts to Styles? + Merge ElementInstances into LayoutNodes? + Split up tkTheme.c; it's huge. + Use a tree of LayoutOps to specify layouts internally instead of an array of LayoutInstructions. [done] + Add "-padding" (and "-ipadding"?) options to LayoutOps + Possibly: remove "Padding" element (or not: needed to make widget -padding option work.) ~ Miscellaneous: + See http://www.kroc.tk/tcl/tk_look (Update 5 Mar 2004: http://www.kroc.tk/tclkit/tile_demo.kit ; imported into tile.) + http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=3FBD203B.20303%@activestate.com&rnum=47&prev=/groups%3Fq%3Dtktable%26start%3D40%26hl%3Den%26lr%3D%26ie%3DUTF-8%26scoring%3Dd%26selm%3D3FBD203B.20303%@activestate.com%26rnum%3D47 + From Satoshi Imai: "An old style has the same mark of a radiobutton and a checkbutton. The radiobutton of a menu thinks that the round mark is better based on a Windows style." If I'm translating correctly, this means: "radiobuttons and checkbuttons in menus should have different indicators." (Out of scope for Tile at the moment, as we don't have a [tmenu] widget, but should be considered). ~ Suggested changes to Tk: + Need TK_OPTION_IMAGE resource type + Named fonts should always have a refcount >= 1, instead of freeing and reallocating them when the go in and out of use. + Expose some of Tk's internals (esp. Windows-specific stuff): ++ TkWinGetDrawableDC ++ TkGetOptionSpec + Some way to invoke WorldChanged class proc of all widgets. tile-0.8.2/generic/altTheme.c0000644000076500007650000010713510714464315015403 0ustar joejoe00000000000000/* altTheme.c,v 1.70 2007/11/08 01:39:25 jenglish Exp * * Copyright (c) 2003, Joe English * * Tk alternate theme, intended to match the MSUE and Gtk's (old) default theme */ #include #include #include #include #include #include "tkTheme.h" #include "gunk.h" #if defined(WIN32) static const int WIN32_XDRAWLINE_HACK = 1; #else static const int WIN32_XDRAWLINE_HACK = 0; #endif #define BORDERWIDTH 2 #define SCROLLBAR_WIDTH 14 #define MIN_THUMB_SIZE 8 #ifndef STRINGIFY #define StR(x) #x #define STRINGIFY(x) StR(x) #endif /* *---------------------------------------------------------------------- * * Helper routines for border drawing: * * NOTE: MSUE specifies a slightly different arrangement * for button borders than for other elements; "shadowColors" * is for button borders. * * Please excuse the gross misspelling "LITE" for "LIGHT", * but it makes things line up nicer. */ enum BorderColor { FLAT = 1, LITE = 2, DARK = 3, BRDR = 4 }; /* top-left outer, top-left inner, bottom-right inner, bottom-right outer */ static int shadowColors[6][4] = { { FLAT, FLAT, FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/ { DARK, LITE, DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/ { LITE, FLAT, DARK, BRDR }, /* TK_RELIEF_RAISED = 2*/ { LITE, DARK, LITE, DARK }, /* TK_RELIEF_RIDGE = 3*/ { BRDR, BRDR, BRDR, BRDR }, /* TK_RELIEF_SOLID = 4*/ { BRDR, DARK, FLAT, LITE } /* TK_RELIEF_SUNKEN = 5*/ }; /* top-left, bottom-right */ static int thinShadowColors[6][4] = { { FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/ { DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/ { LITE, DARK }, /* TK_RELIEF_RAISED = 2*/ { LITE, DARK }, /* TK_RELIEF_RIDGE = 3*/ { BRDR, BRDR }, /* TK_RELIEF_SOLID = 4*/ { DARK, LITE } /* TK_RELIEF_SUNKEN = 5*/ }; static void DrawCorner( Tk_Window tkwin, Drawable d, Tk_3DBorder border, /* get most GCs from here... */ GC borderGC, /* "window border" color GC */ int x,int y, int width,int height, /* where to draw */ int corner, /* 0 => top left; 1 => bottom right */ enum BorderColor color) { XPoint points[3]; GC gc; --width; --height; points[0].x = x; points[0].y = y+height; points[1].x = x+width*corner; points[1].y = y+height*corner; points[2].x = x+width; points[2].y = y; if (color == BRDR) gc = borderGC; else gc = Tk_3DBorderGC(tkwin, border, (int)color); XDrawLines(Tk_Display(tkwin), d, gc, points, 3, CoordModeOrigin); } static void DrawBorder( Tk_Window tkwin, Drawable d, Tk_3DBorder border, XColor *borderColor, Ttk_Box b, int borderWidth, int relief) { GC borderGC = Tk_GCForColor(borderColor, d); switch (borderWidth) { case 2: /* "thick" border */ DrawCorner(tkwin, d, border, borderGC, b.x, b.y, b.width, b.height, 0,shadowColors[relief][0]); DrawCorner(tkwin, d, border, borderGC, b.x+1, b.y+1, b.width-2, b.height-2, 0,shadowColors[relief][1]); DrawCorner(tkwin, d, border, borderGC, b.x+1, b.y+1, b.width-2, b.height-2, 1,shadowColors[relief][2]); DrawCorner(tkwin, d, border, borderGC, b.x, b.y, b.width, b.height, 1,shadowColors[relief][3]); break; case 1: /* "thin" border */ DrawCorner(tkwin, d, border, borderGC, b.x, b.y, b.width, b.height, 0, thinShadowColors[relief][0]); DrawCorner(tkwin, d, border, borderGC, b.x, b.y, b.width, b.height, 1, thinShadowColors[relief][1]); break; case 0: /* no border -- do nothing */ break; default: /* Fall back to Motif-style borders: */ Tk_Draw3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth,relief); break; } } /* Alternate shadow colors for entry fields: * NOTE: FLAT color is normally white, and the LITE color is a darker shade. */ static int fieldShadowColors[4] = { DARK, BRDR, LITE, FLAT }; static void DrawFieldBorder( Tk_Window tkwin, Drawable d, Tk_3DBorder border, XColor *borderColor, Ttk_Box b) { GC borderGC = Tk_GCForColor(borderColor, d); DrawCorner(tkwin, d, border, borderGC, b.x, b.y, b.width, b.height, 0,fieldShadowColors[0]); DrawCorner(tkwin, d, border, borderGC, b.x+1, b.y+1, b.width-2, b.height-2, 0,fieldShadowColors[1]); DrawCorner(tkwin, d, border, borderGC, b.x+1, b.y+1, b.width-2, b.height-2, 1,fieldShadowColors[2]); DrawCorner(tkwin, d, border, borderGC, b.x, b.y, b.width, b.height, 1,fieldShadowColors[3]); return; } /* * ArrowPoints -- * Compute points of arrow polygon. */ static void ArrowPoints(Ttk_Box b, ArrowDirection dir, XPoint points[4]) { int cx, cy, h; switch (dir) { case ARROW_UP: h = (b.width - 1)/2; cx = b.x + h; cy = b.y; if (b.height <= h) h = b.height - 1; points[0].x = cx; points[0].y = cy; points[1].x = cx - h; points[1].y = cy + h; points[2].x = cx + h; points[2].y = cy + h; break; case ARROW_DOWN: h = (b.width - 1)/2; cx = b.x + h; cy = b.y + b.height - 1; if (b.height <= h) h = b.height - 1; points[0].x = cx; points[0].y = cy; points[1].x = cx - h; points[1].y = cy - h; points[2].x = cx + h; points[2].y = cy - h; break; case ARROW_LEFT: h = (b.height - 1)/2; cx = b.x; cy = b.y + h; if (b.width <= h) h = b.width - 1; points[0].x = cx; points[0].y = cy; points[1].x = cx + h; points[1].y = cy - h; points[2].x = cx + h; points[2].y = cy + h; break; case ARROW_RIGHT: h = (b.height - 1)/2; cx = b.x + b.width - 1; cy = b.y + h; if (b.width <= h) h = b.width - 1; points[0].x = cx; points[0].y = cy; points[1].x = cx - h; points[1].y = cy - h; points[2].x = cx - h; points[2].y = cy + h; break; } points[3].x = points[0].x; points[3].y = points[0].y; } /*public*/ void TtkArrowSize(int h, ArrowDirection dir, int *widthPtr, int *heightPtr) { switch (dir) { case ARROW_UP: case ARROW_DOWN: *widthPtr = 2*h+1; *heightPtr = h+1; break; case ARROW_LEFT: case ARROW_RIGHT: *widthPtr = h+1; *heightPtr = 2*h+1; } } /* * TtkDrawArrow, TtkFillArrow -- * Draw an arrow in the indicated direction inside the specified box. */ /*public*/ void TtkFillArrow( Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir) { XPoint points[4]; ArrowPoints(b, dir, points); XFillPolygon(display, d, gc, points, 3, Convex, CoordModeOrigin); XDrawLines(display, d, gc, points, 4, CoordModeOrigin); } /*public*/ void TtkDrawArrow( Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir) { XPoint points[4]; ArrowPoints(b, dir, points); XDrawLines(display, d, gc, points, 4, CoordModeOrigin); } /* *---------------------------------------------------------------------- * +++ Border element implementation. * * This border consists of (from outside-in): * * + a 1-pixel thick default indicator (defaultable widgets only) * + 1- or 2- pixel shaded border (controlled by -background and -relief) * + 1 pixel padding (???) */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; /* Extra border color */ Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *defaultStateObj; /* for buttons */ } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(BorderElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor",TK_OPTION_COLOR, Tk_Offset(BorderElement,borderColorObj), "black" }, { "-default", TK_OPTION_ANY, Tk_Offset(BorderElement,defaultStateObj), "disabled" }, { "-borderwidth",TK_OPTION_PIXELS,Tk_Offset(BorderElement,borderWidthObj), STRINGIFY(BORDERWIDTH) }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(BorderElement,reliefObj), "flat" }, {NULL} }; static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { BorderElement *bd = elementRecord; int borderWidth = 0; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { ++borderWidth; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void BorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { BorderElement *bd = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, bd->borderColorObj); int borderWidth = 2; int relief = TK_RELIEF_FLAT; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; /* * Get option values. */ Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { GC gc = Tk_GCForColor(borderColor, d); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); } if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { /* Space for default ring: */ b = Ttk_PadBox(b, Ttk_UniformPadding(1)); } DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief); } static Ttk_ElementSpec BorderElementSpec = { TK_STYLE_VERSION_2, sizeof(BorderElement), BorderElementOptions, BorderElementSize, BorderElementDraw }; /*---------------------------------------------------------------------- * +++ Field element: * Used for editable fields. */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; /* Extra border color */ } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement,borderObj), "white" }, { "-bordercolor",TK_OPTION_COLOR, Tk_Offset(FieldElement,borderColorObj), "black" }, {NULL} }; static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(2); } static void FieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { FieldElement *field = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, field->borderColorObj); Tk_Fill3DRectangle( tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_SUNKEN); DrawFieldBorder(tkwin, d, border, borderColor, b); } static Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, FieldElementSize, FieldElementDraw }; /*------------------------------------------------------------------------ * Indicators -- * * Code derived (probably incorrectly) from TIP 109 implementation, * unix/tkUnixButton.c r 1.15. */ /* * Indicator bitmap descriptor: */ typedef struct { int width; /* Width of each image */ int height; /* Height of each image */ int nimages; /* #images / row */ char **pixels; /* array[height] of char[width*nimage] */ Ttk_StateTable *map;/* used to look up image index by state */ } IndicatorSpec; #if 0 /*XPM*/ static char *button_images[] = { /* width height ncolors chars_per_pixel */ "52 26 7 1", /* colors */ "A c #808000000000 s background", "B c #000080800000 s background", "C c #808080800000 s highlight", "D c #000000008080 s select", "E c #808000008080 s shadow", "F c #000080808080 s background", "G c #000000000000 s indicator", "H c #000080800000 s disabled", }; #endif static Ttk_StateTable checkbutton_states[] = { { 0, 0, TTK_STATE_SELECTED|TTK_STATE_DISABLED }, { 1, TTK_STATE_SELECTED, TTK_STATE_DISABLED }, { 2, TTK_STATE_DISABLED, TTK_STATE_SELECTED }, { 3, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0 }, { 0, 0, 0 } }; static char *checkbutton_pixels[] = { "AAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAAB", "AEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECB", "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB", "AEDDDDDDDDDCBAEDDDDDDDGDCBAEFFFFFFFFFCBAEFFFFFFFHFCB", "AEDDDDDDDDDCBAEDDDDDDGGDCBAEFFFFFFFFFCBAEFFFFFFHHFCB", "AEDDDDDDDDDCBAEDGDDDGGGDCBAEFFFFFFFFFCBAEFHFFFHHHFCB", "AEDDDDDDDDDCBAEDGGDGGGDDCBAEFFFFFFFFFCBAEFHHFHHHFFCB", "AEDDDDDDDDDCBAEDGGGGGDDDCBAEFFFFFFFFFCBAEFHHHHHFFFCB", "AEDDDDDDDDDCBAEDDGGGDDDDCBAEFFFFFFFFFCBAEFFHHHFFFFCB", "AEDDDDDDDDDCBAEDDDGDDDDDCBAEFFFFFFFFFCBAEFFFHFFFFFCB", "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB", "ACCCCCCCCCCCBACCCCCCCCCCCBACCCCCCCCCCCBACCCCCCCCCCCB", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", }; static IndicatorSpec checkbutton_spec = { 13, 13, 4, /* width, height, nimages */ checkbutton_pixels, checkbutton_states }; static Ttk_StateTable radiobutton_states[] = { { 0, 0, TTK_STATE_SELECTED|TTK_STATE_DISABLED }, { 1, TTK_STATE_SELECTED, TTK_STATE_DISABLED }, { 2, TTK_STATE_DISABLED, TTK_STATE_SELECTED }, { 3, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0 }, { 0, 0, 0 } }; static char *radiobutton_pixels[] = { "FFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFF", "FFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFF", "FAEEDDDDECBFFFAEEDDDDECBFFFAEEFFFFECBFFFAEEFFFFECBFF", "FAEDDDDDDCBFFFAEDDDDDDCBFFFAEFFFFFFCBFFFAEFFFFFFCBFF", "AEDDDDDDDDCBFAEDDDGGDDDCBFAEFFFFFFFFCBFAEFFFHHFFFCBF", "AEDDDDDDDDCBFAEDDGGGGDDCBFAEFFFFFFFFCBFAEFFHHHHFFCBF", "AEDDDDDDDDCBFAEDDGGGGDDCBFAEFFFFFFFFCBFAEFFHHHHFFCBF", "AEDDDDDDDDCBFAEDDDGGDDDCBFAEFFFFFFFFCBFAEFFFHHFFFCBF", "FAEDDDDDDCBFFFAEDDDDDDCBFFFAEFFFFFFCBFFFAEFFFFFFCBFF", "FACCDDDDCCBFFFACCDDDDCCBFFFACCFFFFCCBFFFACCFFFFCCBFF", "FFBBCCCCBBFFFFFBBCCCCBBFFFFFBBCCCCBBFFFFFBBCCCCBBFFF", "FFFFBBBBFFFFFFFFFBBBBFFFFFFFFFBBBBFFFFFFFFFBBBBFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", }; static IndicatorSpec radiobutton_spec = { 13, 13, 4, /* width, height, nimages */ radiobutton_pixels, radiobutton_states }; typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *foregroundObj; Tcl_Obj *colorObj; Tcl_Obj *lightColorObj; Tcl_Obj *shadeColorObj; Tcl_Obj *marginObj; } IndicatorElement; static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-foreground", TK_OPTION_COLOR, Tk_Offset(IndicatorElement,foregroundObj), DEFAULT_FOREGROUND }, { "-indicatorcolor", TK_OPTION_BORDER, Tk_Offset(IndicatorElement,colorObj), "#FFFFFF" }, { "-lightcolor", TK_OPTION_COLOR, Tk_Offset(IndicatorElement,lightColorObj), "#DDDDDD" }, { "-shadecolor", TK_OPTION_COLOR, Tk_Offset(IndicatorElement,shadeColorObj), "#888888" }, { "-indicatormargin", TK_OPTION_STRING, Tk_Offset(IndicatorElement,marginObj), "0 2 4 2" }, {NULL} }; static void IndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { IndicatorSpec *spec = clientData; IndicatorElement *indicator = elementRecord; Ttk_Padding margins; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); *widthPtr = spec->width + Ttk_PaddingWidth(margins); *heightPtr = spec->height + Ttk_PaddingHeight(margins); } static void IndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { IndicatorSpec *spec = clientData; IndicatorElement *indicator = elementRecord; Display *display = Tk_Display(tkwin); Tk_3DBorder bgBorder; Ttk_Padding padding; XColor *fgColor, *bgColor, *lightColor, *shadeColor, *selectColor; int index, ix, iy; XGCValues gcValues; GC copyGC; unsigned long imgColors[8]; XImage *img; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); if ( b.x < 0 || b.y < 0 || Tk_Width(tkwin) < b.x + spec->width || Tk_Height(tkwin) < b.y + spec->height) { /* Oops! not enough room to display the image. * Don't draw anything. */ return; } /* * Fill in imgColors palette: * * (SHOULD: take light and shade colors from the border object, * but Tk doesn't provide easy access to these in the public API.) */ fgColor = Tk_GetColorFromObj(tkwin, indicator->foregroundObj); bgBorder = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj); bgColor = Tk_3DBorderColor(bgBorder); lightColor = Tk_GetColorFromObj(tkwin, indicator->lightColorObj); shadeColor = Tk_GetColorFromObj(tkwin, indicator->shadeColorObj); selectColor = Tk_GetColorFromObj(tkwin, indicator->colorObj); imgColors[0 /*A*/] = bgColor->pixel; imgColors[1 /*B*/] = bgColor->pixel; imgColors[2 /*C*/] = lightColor->pixel; imgColors[3 /*D*/] = selectColor->pixel; imgColors[4 /*E*/] = shadeColor->pixel; imgColors[5 /*F*/] = bgColor->pixel; imgColors[6 /*G*/] = fgColor->pixel; imgColors[7 /*H*/] = selectColor->pixel; /* * Create a scratch buffer to store the image: */ img = XGetImage(display,d, 0, 0, (unsigned int)spec->width, (unsigned int)spec->height, AllPlanes, ZPixmap); if (img == NULL) return; /* * Create the image, painting it into an XImage one pixel at a time. */ index = Ttk_StateTableLookup(spec->map, state); for (iy=0 ; iyheight ; iy++) { for (ix=0 ; ixwidth ; ix++) { XPutPixel(img, ix, iy, imgColors[spec->pixels[iy][index*spec->width+ix] - 'A'] ); } } /* * Copy onto our target drawable surface. */ memset(&gcValues, 0, sizeof(gcValues)); copyGC = Tk_GetGC(tkwin, 0, &gcValues); TkPutImage(NULL, 0, display, d, copyGC, img, 0, 0, b.x, b.y, spec->width, spec->height); /* * Tidy up. */ Tk_FreeGC(display, copyGC); XDestroyImage(img); } static Ttk_ElementSpec IndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, IndicatorElementSize, IndicatorElementDraw }; /*---------------------------------------------------------------------- * +++ Arrow element(s). * * Draws a solid triangle, inside a box. * clientData is an enum ArrowDirection pointer. */ static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT }; typedef struct { Tcl_Obj *sizeObj; Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; /* Extra color for borders */ Tcl_Obj *reliefObj; Tcl_Obj *colorObj; /* Arrow color */ } ArrowElement; static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) }, { "-background", TK_OPTION_BORDER, Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ArrowElement,borderColorObj), "black" }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(ArrowElement,reliefObj),"raised"}, { "-arrowcolor", TK_OPTION_COLOR, Tk_Offset(ArrowElement,colorObj),"black"}, { NULL } }; /* * Note asymmetric padding: * top/left padding is 1 less than bottom/right, * since in this theme 2-pixel borders are asymmetric. */ static Ttk_Padding ArrowPadding = { 3,3,4,4 }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ArrowElement *arrow = elementRecord; int direction = *(int *)clientData; int width = SCROLLBAR_WIDTH; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width); width -= Ttk_PaddingWidth(ArrowPadding); TtkArrowSize(width/2, direction, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(ArrowPadding); *heightPtr += Ttk_PaddingHeight(ArrowPadding); } static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { int direction = *(int *)clientData; ArrowElement *arrow = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, arrow->borderColorObj); XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); int relief = TK_RELIEF_RAISED; int borderWidth = 2; Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief); Tk_Fill3DRectangle( tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT); DrawBorder(tkwin,d,border,borderColor,b,borderWidth,relief); TtkFillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d), Ttk_PadBox(b, ArrowPadding), direction); } static Ttk_ElementSpec ArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, ArrowElementSize, ArrowElementDraw }; /*---------------------------------------------------------------------- * +++ Menubutton indicator: * Draw an arrow in the direction where the menu will be posted. */ #define MENUBUTTON_ARROW_SIZE 5 typedef struct { Tcl_Obj *directionObj; Tcl_Obj *sizeObj; Tcl_Obj *colorObj; } MenubuttonArrowElement; static const char *directionStrings[] = { /* See also: button.c */ "above", "below", "left", "right", "flush", NULL }; enum { POST_ABOVE, POST_BELOW, POST_LEFT, POST_RIGHT, POST_FLUSH }; static Ttk_ElementOptionSpec MenubuttonArrowElementOptions[] = { { "-direction", TK_OPTION_STRING, Tk_Offset(MenubuttonArrowElement,directionObj), "below" }, { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(MenubuttonArrowElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor",TK_OPTION_COLOR, Tk_Offset(MenubuttonArrowElement,colorObj), "black"}, { NULL } }; static Ttk_Padding MenubuttonArrowPadding = { 3, 0, 3, 0 }; static void MenubuttonArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { MenubuttonArrowElement *arrow = elementRecord; int size = MENUBUTTON_ARROW_SIZE; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); *widthPtr = *heightPtr = 2 * size + 1; *widthPtr += Ttk_PaddingWidth(MenubuttonArrowPadding); *heightPtr += Ttk_PaddingHeight(MenubuttonArrowPadding); } static void MenubuttonArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { MenubuttonArrowElement *arrow = elementRecord; XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); GC gc = Tk_GCForColor(arrowColor, d); int size = MENUBUTTON_ARROW_SIZE; int postDirection = POST_BELOW; ArrowDirection arrowDirection = ARROW_DOWN; int width = 0, height = 0; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); Tcl_GetIndexFromObj(NULL, arrow->directionObj, directionStrings, ""/*message*/, 0/*flags*/, &postDirection); /* ... this might not be such a great idea ... */ switch (postDirection) { case POST_ABOVE: arrowDirection = ARROW_UP; break; case POST_BELOW: arrowDirection = ARROW_DOWN; break; case POST_LEFT: arrowDirection = ARROW_LEFT; break; case POST_RIGHT: arrowDirection = ARROW_RIGHT; break; case POST_FLUSH: arrowDirection = ARROW_DOWN; break; } TtkArrowSize(size, arrowDirection, &width, &height); b = Ttk_PadBox(b, MenubuttonArrowPadding); b = Ttk_AnchorBox(b, width, height, TK_ANCHOR_CENTER); TtkFillArrow(Tk_Display(tkwin), d, gc, b, arrowDirection); } static Ttk_ElementSpec MenubuttonArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(MenubuttonArrowElement), MenubuttonArrowElementOptions, MenubuttonArrowElementSize, MenubuttonArrowElementDraw }; /*---------------------------------------------------------------------- * +++ Trough element * * Used in scrollbars and the scale. * * The -groovewidth option can be used to set the size of the short axis * for the drawn area. This will not affect the geometry, but can be used * to draw a thin centered trough inside the packet alloted. This is used * to show a win32-style scale widget. Use -1 or a large number to use the * full area (default). * */ typedef struct { Tcl_Obj *colorObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *grooveWidthObj; Tcl_Obj *orientObj; } TroughElement; static Ttk_ElementOptionSpec TroughElementOptions[] = { { "-orient", TK_OPTION_ANY, Tk_Offset(TroughElement, orientObj), "horizontal" }, { "-troughborderwidth", TK_OPTION_PIXELS, Tk_Offset(TroughElement,borderWidthObj), "1" }, { "-troughcolor", TK_OPTION_BORDER, Tk_Offset(TroughElement,colorObj), DEFAULT_BACKGROUND }, { "-troughrelief",TK_OPTION_RELIEF, Tk_Offset(TroughElement,reliefObj), "sunken" }, { "-groovewidth", TK_OPTION_PIXELS, Tk_Offset(TroughElement,grooveWidthObj), "-1" }, { NULL } }; static void TroughElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TroughElement *troughPtr = elementRecord; int borderWidth = 2, grooveWidth = 0; Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &grooveWidth); if (grooveWidth <= 0) { *paddingPtr = Ttk_UniformPadding((short)borderWidth); } } static void TroughElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { TroughElement *troughPtr = elementRecord; Tk_3DBorder border = NULL; int borderWidth = 2, relief, groove, orient; border = Tk_Get3DBorderFromObj(tkwin, troughPtr->colorObj); Ttk_GetOrientFromObj(NULL, troughPtr->orientObj, &orient); Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &groove); if (groove != -1 && groove < b.height && groove < b.width) { if (orient == TTK_ORIENT_HORIZONTAL) { b.y = b.y + b.height/2 - groove/2; b.height = groove; } else { b.x = b.x + b.width/2 - groove/2; b.width = groove; } } Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); } static Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(TroughElement), TroughElementOptions, TroughElementSize, TroughElementDraw }; /* *---------------------------------------------------------------------- * +++ Thumb element. */ typedef struct { Tcl_Obj *sizeObj; Tcl_Obj *firstObj; Tcl_Obj *lastObj; Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; Tcl_Obj *reliefObj; Tcl_Obj *orientObj; } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-width", TK_OPTION_PIXELS, Tk_Offset(ThumbElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) }, { "-background", TK_OPTION_BORDER, Tk_Offset(ThumbElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ThumbElement,borderColorObj), "black" }, { "-relief", TK_OPTION_RELIEF,Tk_Offset(ThumbElement,reliefObj),"raised" }, { "-orient", TK_OPTION_ANY,Tk_Offset(ThumbElement,orientObj),"horizontal"}, { NULL } }; static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ThumbElement *thumb = elementRecord; int orient, size; Tk_GetPixelsFromObj(NULL, tkwin, thumb->sizeObj, &size); Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); if (orient == TTK_ORIENT_VERTICAL) { *widthPtr = size; *heightPtr = MIN_THUMB_SIZE; } else { *widthPtr = MIN_THUMB_SIZE; *heightPtr = size; } } static void ThumbElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ThumbElement *thumb = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, thumb->borderColorObj); int relief = TK_RELIEF_RAISED; int borderWidth = 2; /* * Don't draw the thumb if we are disabled. * This makes it behave like Windows ... if that's what we want. if (state & TTK_STATE_DISABLED) return; */ Tk_GetReliefFromObj(NULL, thumb->reliefObj, &relief); Tk_Fill3DRectangle( tkwin, d, border, b.x,b.y,b.width,b.height, 0, TK_RELIEF_FLAT); DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief); } static Ttk_ElementSpec ThumbElementSpec = { TK_STYLE_VERSION_2, sizeof(ThumbElement), ThumbElementOptions, ThumbElementSize, ThumbElementDraw }; /* *---------------------------------------------------------------------- * +++ Slider element. * * This is the moving part of the scale widget. * * The slider element is the thumb in the scale widget. This is drawn * as an arrow-type element that can point up, down, left or right. * */ typedef struct { Tcl_Obj *lengthObj; /* Long axis dimension */ Tcl_Obj *thicknessObj; /* Short axis dimension */ Tcl_Obj *reliefObj; /* Relief for this object */ Tcl_Obj *borderObj; /* Border / background color */ Tcl_Obj *borderColorObj; /* Additional border color */ Tcl_Obj *borderWidthObj; Tcl_Obj *orientObj; /* Orientation of overall slider */ } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj), "15" }, { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj), "15" }, { "-sliderrelief", TK_OPTION_RELIEF, Tk_Offset(SliderElement,reliefObj), "raised" }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SliderElement,borderWidthObj), STRINGIFY(BORDERWIDTH) }, { "-background", TK_OPTION_BORDER, Tk_Offset(SliderElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ThumbElement,borderColorObj), "black" }, { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj), "horizontal" }, { NULL } }; static void SliderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SliderElement *slider = elementRecord; int orient, length, thickness, borderWidth; Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length); Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness); switch (orient) { case TTK_ORIENT_VERTICAL: *widthPtr = thickness + (borderWidth *2); *heightPtr = *widthPtr/2; break; case TTK_ORIENT_HORIZONTAL: *heightPtr = thickness + (borderWidth *2); *widthPtr = *heightPtr/2; break; } } static void SliderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { SliderElement *slider = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, slider->borderColorObj); int relief = TK_RELIEF_RAISED, borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_FLAT); DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief); } static Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(SliderElement), SliderElementOptions, SliderElementSize, SliderElementDraw }; /*------------------------------------------------------------------------ * +++ Tree indicator element. */ #define TTK_STATE_OPEN TTK_STATE_USER1 /* XREF: treeview.c */ #define TTK_STATE_LEAF TTK_STATE_USER2 typedef struct { Tcl_Obj *colorObj; Tcl_Obj *marginObj; Tcl_Obj *diameterObj; } TreeitemIndicator; static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, Tk_Offset(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, { "-diameter", TK_OPTION_PIXELS, Tk_Offset(TreeitemIndicator,diameterObj), "9" }, { "-indicatormargins", TK_OPTION_STRING, Tk_Offset(TreeitemIndicator,marginObj), "2 2 4 2" }, {NULL} }; static void TreeitemIndicatorSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TreeitemIndicator *indicator = elementRecord; int diameter = 0; Ttk_Padding margins; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter); *widthPtr = diameter + Ttk_PaddingWidth(margins); *heightPtr = diameter + Ttk_PaddingHeight(margins); } static void TreeitemIndicatorDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TreeitemIndicator *indicator = elementRecord; XColor *color = Tk_GetColorFromObj(tkwin, indicator->colorObj); GC gc = Tk_GCForColor(color, d); Ttk_Padding padding = Ttk_UniformPadding(0); int w = WIN32_XDRAWLINE_HACK; int cx, cy; if (state & TTK_STATE_LEAF) { /* don't draw anything ... */ return; } Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding); b = Ttk_PadBox(b, padding); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width - 1, b.height - 1); cx = b.x + (b.width - 1) / 2; cy = b.y + (b.height - 1) / 2; XDrawLine(Tk_Display(tkwin), d, gc, b.x+2, cy, b.x+b.width-3+w, cy); if (!(state & TTK_STATE_OPEN)) { /* turn '-' into a '+' */ XDrawLine(Tk_Display(tkwin), d, gc, cx, b.y+2, cx, b.y+b.height-3+w); } } static Ttk_ElementSpec TreeitemIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(TreeitemIndicator), TreeitemIndicatorOptions, TreeitemIndicatorSize, TreeitemIndicatorDraw }; /*------------------------------------------------------------------------ * TtkAltTheme_Init -- * Install alternate theme. */ int TtkAltTheme_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_CreateTheme(interp, "alt", NULL); if (!theme) { return TCL_ERROR; } Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Checkbutton.indicator", &IndicatorElementSpec, &checkbutton_spec); Ttk_RegisterElement(interp, theme, "Radiobutton.indicator", &IndicatorElementSpec, &radiobutton_spec); Ttk_RegisterElement(interp, theme, "Menubutton.indicator", &MenubuttonArrowElementSpec, NULL); Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL); Ttk_RegisterElement(interp, theme, "trough", &TroughElementSpec, NULL); Ttk_RegisterElement(interp, theme, "thumb", &ThumbElementSpec, NULL); Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "uparrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "downarrow", &ArrowElementSpec, &ArrowElements[1]); Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "Treeitem.indicator", &TreeitemIndicatorElementSpec, 0); Tcl_PkgProvide(interp, "ttk::theme::alt", TILE_VERSION); return TCL_OK; } /*EOF*/ tile-0.8.2/generic/blink.c0000644000076500007650000001044510525445707014740 0ustar joejoe00000000000000/* * blink.c,v 1.4 2006/11/11 22:16:39 jenglish Exp * * Copyright 2004, Joe English. * * Usage: * TtkBlinkCursor(corePtr), usually called in a widget's Init hook, * arranges to periodically toggle the corePtr->flags CURSOR_ON bit * on and off (and schedule a redisplay) whenever the widget has focus. * * Note: Widgets may have additional logic to decide whether * to display the cursor or not (e.g., readonly or disabled states); * TtkBlinkCursor() does not account for this. * * TODO: * Add script-level access to configure application-wide blink rate. */ #include #include "tkTheme.h" #include "widget.h" #define DEF_CURSOR_ON_TIME 600 /* milliseconds */ #define DEF_CURSOR_OFF_TIME 300 /* milliseconds */ /* Interp-specific data for tracking cursors: */ typedef struct { WidgetCore *owner; /* Widget that currently has cursor */ Tcl_TimerToken timer; /* Blink timer */ int onTime; /* #milliseconds to blink cursor on */ int offTime; /* #milliseconds to blink cursor off */ } CursorManager; /* CursorManagerDeleteProc -- * InterpDeleteProc for cursor manager. */ static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp) { CursorManager *cm = (CursorManager*)clientData; if (cm->timer) { Tcl_DeleteTimerHandler(cm->timer); } ckfree(clientData); } /* GetCursorManager -- * Look up and create if necessary the interp's cursor manager. */ static CursorManager *GetCursorManager(Tcl_Interp *interp) { static const char *cm_key = "tile::CursorManager"; CursorManager *cm = (CursorManager *) Tcl_GetAssocData(interp, cm_key,0); if (!cm) { cm = (CursorManager*)ckalloc(sizeof(*cm)); cm->timer = 0; cm->owner = 0; cm->onTime = DEF_CURSOR_ON_TIME; cm->offTime = DEF_CURSOR_OFF_TIME; Tcl_SetAssocData(interp,cm_key,CursorManagerDeleteProc,(ClientData)cm); } return cm; } /* CursorBlinkProc -- * Timer handler to blink the insert cursor on and off. */ static void CursorBlinkProc(ClientData clientData) { CursorManager *cm = (CursorManager*)clientData; int blinkTime; if (cm->owner->flags & CURSOR_ON) { cm->owner->flags &= ~CURSOR_ON; blinkTime = cm->offTime; } else { cm->owner->flags |= CURSOR_ON; blinkTime = cm->onTime; } cm->timer = Tcl_CreateTimerHandler(blinkTime, CursorBlinkProc, clientData); TtkRedisplayWidget(cm->owner); } /* LoseCursor -- * Turn cursor off, disable blink timer. */ static void LoseCursor(CursorManager *cm, WidgetCore *corePtr) { if (corePtr->flags & CURSOR_ON) { corePtr->flags &= ~CURSOR_ON; TtkRedisplayWidget(corePtr); } if (cm->owner == corePtr) { cm->owner = NULL; } if (cm->timer) { Tcl_DeleteTimerHandler(cm->timer); cm->timer = 0; } } /* ClaimCursor -- * Claim ownership of the insert cursor and blink on. */ static void ClaimCursor(CursorManager *cm, WidgetCore *corePtr) { if (cm->owner == corePtr) return; if (cm->owner) LoseCursor(cm, cm->owner); corePtr->flags |= CURSOR_ON; TtkRedisplayWidget(corePtr); cm->owner = corePtr; cm->timer = Tcl_CreateTimerHandler(cm->onTime, CursorBlinkProc, cm); } /* * CursorEventProc -- * Event handler for FocusIn and FocusOut events; * claim/lose ownership of the insert cursor when the widget * acquires/loses keyboard focus. */ #define CursorEventMask (FocusChangeMask|StructureNotifyMask) #define RealFocusEvent(d) \ (d == NotifyInferior || d == NotifyAncestor || d == NotifyNonlinear) static void CursorEventProc(ClientData clientData, XEvent *eventPtr) { WidgetCore *corePtr = (WidgetCore *)clientData; CursorManager *cm = GetCursorManager(corePtr->interp); switch (eventPtr->type) { case DestroyNotify: if (cm->owner == corePtr) LoseCursor(cm, corePtr); Tk_DeleteEventHandler( corePtr->tkwin, CursorEventMask, CursorEventProc, clientData); break; case FocusIn: if (RealFocusEvent(eventPtr->xfocus.detail)) ClaimCursor(cm, corePtr); break; case FocusOut: if (RealFocusEvent(eventPtr->xfocus.detail)) LoseCursor(cm, corePtr); break; } } /* * TtkBlinkCursor (main routine) -- * Arrange to blink the cursor on and off whenever the * widget has focus. */ void TtkBlinkCursor(WidgetCore *corePtr) { Tk_CreateEventHandler( corePtr->tkwin, CursorEventMask, CursorEventProc, corePtr); } /*EOF*/ tile-0.8.2/generic/button.c0000644000076500007650000005607310710035347015152 0ustar joejoe00000000000000/* button.c,v 1.52 2007/10/25 06:42:47 jenglish Exp * Copyright (c) 2003, Joe English * * label, button, checkbutton, radiobutton, and menubutton widgets. */ #include #include #include "tkTheme.h" #include "widget.h" /* Bit fields for OptionSpec mask field: */ #define STATE_CHANGED (0x100) /* -state option changed */ #define DEFAULTSTATE_CHANGED (0x200) /* -default option changed */ /*------------------------------------------------------------------------ * +++ Base resources for labels, buttons, checkbuttons, etc: */ typedef struct { /* * Text element resources: */ Tcl_Obj *textObj; Tcl_Obj *textVariableObj; Tcl_Obj *underlineObj; Tcl_Obj *widthObj; Ttk_TraceHandle *textVariableTrace; Ttk_ImageSpec *imageSpec; /* * Image element resources: */ Tcl_Obj *imageObj; /* * Compound label/image resources: */ Tcl_Obj *compoundObj; Tcl_Obj *paddingObj; /* * Compatibility/legacy options: */ Tcl_Obj *stateObj; } BasePart; typedef struct { WidgetCore core; BasePart base; } Base; static Tk_OptionSpec BaseOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", "", Tk_Offset(Base,base.textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", "", Tk_Offset(Base,base.textVariableObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", Tk_Offset(Base,base.underlineObj), -1, 0,0,0 }, /* SB: OPTION_INT, see <> */ {TK_OPTION_STRING, "-width", "width", "Width", NULL, Tk_Offset(Base,base.widthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, /* * Image options */ {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/, Tk_Offset(Base,base.imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, /* * Compound base/image options */ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", "none", Tk_Offset(Base,base.compoundObj), -1, 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, Tk_Offset(Base,base.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED}, /* * Compatibility/legacy options */ {TK_OPTION_STRING, "-state", "state", "State", "normal", Tk_Offset(Base,base.stateObj), -1, 0,0,STATE_CHANGED }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* * Variable trace procedure for -textvariable option: */ static void TextVariableChanged(void *clientData, const char *value) { Base *basePtr = clientData; Tcl_Obj *newText; if (WidgetDestroyed(&basePtr->core)) { return; } newText = value ? Tcl_NewStringObj(value, -1) : Tcl_NewStringObj("", 0); Tcl_IncrRefCount(newText); Tcl_DecrRefCount(basePtr->base.textObj); basePtr->base.textObj = newText; TtkResizeWidget(&basePtr->core); } static int BaseInitialize(Tcl_Interp *interp, void *recordPtr) { Base *basePtr = recordPtr; basePtr->base.textVariableTrace = 0; basePtr->base.imageSpec = NULL; return TCL_OK; } static void BaseCleanup(void *recordPtr) { Base *basePtr = recordPtr; if (basePtr->base.textVariableTrace) Ttk_UntraceVariable(basePtr->base.textVariableTrace); if (basePtr->base.imageSpec) TtkFreeImageSpec(basePtr->base.imageSpec); } static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Base *basePtr = recordPtr; Tcl_Obj *textVarName = basePtr->base.textVariableObj; Ttk_TraceHandle *vt = 0; Ttk_ImageSpec *imageSpec = NULL; if (textVarName != NULL && *Tcl_GetString(textVarName) != '\0') { vt = Ttk_TraceVariable(interp,textVarName,TextVariableChanged,basePtr); if (!vt) return TCL_ERROR; } if (basePtr->base.imageObj) { imageSpec = TtkGetImageSpec( interp, basePtr->core.tkwin, basePtr->base.imageObj); if (!imageSpec) { goto error; } } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { error: if (imageSpec) TtkFreeImageSpec(imageSpec); if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } if (basePtr->base.textVariableTrace) { Ttk_UntraceVariable(basePtr->base.textVariableTrace); } basePtr->base.textVariableTrace = vt; if (basePtr->base.imageSpec) { TtkFreeImageSpec(basePtr->base.imageSpec); } basePtr->base.imageSpec = imageSpec; if (mask & STATE_CHANGED) { TtkCheckStateOption(&basePtr->core, basePtr->base.stateObj); } return TCL_OK; } static int BasePostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Base *basePtr = recordPtr; int status = TCL_OK; if (basePtr->base.textVariableTrace) { status = Ttk_FireTrace(basePtr->base.textVariableTrace); } return status; } /*------------------------------------------------------------------------ * +++ Label widget. * Just a base widget that adds a few appearance-related options */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *foregroundObj; Tcl_Obj *fontObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *anchorObj; Tcl_Obj *justifyObj; Tcl_Obj *wrapLengthObj; } LabelPart; typedef struct { WidgetCore core; BasePart base; LabelPart label; } Label; static Tk_OptionSpec LabelOptionSpecs[] = { {TK_OPTION_BORDER, "-background", "frameColor", "FrameColor", NULL, Tk_Offset(Label,label.backgroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", NULL, Tk_Offset(Label,label.foregroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_FONT, "-font", "font", "Font", NULL, Tk_Offset(Label,label.fontObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL, Tk_Offset(Label,label.borderWidthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, Tk_Offset(Label,label.reliefObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, Tk_Offset(Label,label.anchorObj), -1, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", NULL, Tk_Offset(Label, label.justifyObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", NULL, Tk_Offset(Label, label.wrapLengthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED /*SB: SIZE_CHANGED*/ }, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static WidgetCommandSpec LabelCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "instate", TtkWidgetInstateCommand }, { "state", TtkWidgetStateCommand }, { "identify", TtkWidgetIdentifyCommand }, { NULL, NULL } }; static WidgetSpec LabelWidgetSpec = { "TLabel", /* className */ sizeof(Label), /* recordSize */ LabelOptionSpecs, /* optionSpecs */ LabelCommands, /* subcommands */ BaseInitialize, /* initializeProc */ BaseCleanup, /* cleanupProc */ BaseConfigure, /* configureProc */ BasePostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ TtkWidgetDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(LabelLayout) TTK_GROUP("Label.border", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Label.padding", TTK_FILL_BOTH|TTK_BORDER, TTK_NODE("Label.label", TTK_FILL_BOTH))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Button widget. * Adds a new subcommand "invoke", and options "-command" and "-default" */ typedef struct { Tcl_Obj *commandObj; Tcl_Obj *defaultStateObj; } ButtonPart; typedef struct { WidgetCore core; BasePart base; ButtonPart button; } Button; /* * Option specifications: */ static Tk_OptionSpec ButtonOptionSpecs[] = { WIDGET_TAKES_FOCUS, {TK_OPTION_STRING, "-command", "command", "Command", "", Tk_Offset(Button, button.commandObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-default", "default", "Default", "normal", Tk_Offset(Button, button.defaultStateObj), -1, 0, (ClientData) ttkDefaultStrings, DEFAULTSTATE_CHANGED}, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Button *buttonPtr = recordPtr; if (BaseConfigure(interp, recordPtr, mask) != TCL_OK) { return TCL_ERROR; } /* Handle "-default" option: */ if (mask & DEFAULTSTATE_CHANGED) { int defaultState = TTK_BUTTON_DEFAULT_DISABLED; Ttk_GetButtonDefaultStateFromObj( NULL, buttonPtr->button.defaultStateObj, &defaultState); if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { TtkWidgetChangeState(&buttonPtr->core, TTK_STATE_ALTERNATE, 0); } else { TtkWidgetChangeState(&buttonPtr->core, 0, TTK_STATE_ALTERNATE); } } return TCL_OK; } /* $button invoke -- * Evaluate the button's -command. */ static int ButtonInvokeCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Button *buttonPtr = recordPtr; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "invoke"); return TCL_ERROR; } if (buttonPtr->core.state & TTK_STATE_DISABLED) { return TCL_OK; } return Tcl_EvalObjEx(interp, buttonPtr->button.commandObj, TCL_EVAL_GLOBAL); } static WidgetCommandSpec ButtonCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "invoke", ButtonInvokeCommand }, { "instate", TtkWidgetInstateCommand }, { "state", TtkWidgetStateCommand }, { "identify", TtkWidgetIdentifyCommand }, { NULL, NULL } }; static WidgetSpec ButtonWidgetSpec = { "TButton", /* className */ sizeof(Button), /* recordSize */ ButtonOptionSpecs, /* optionSpecs */ ButtonCommands, /* subcommands */ BaseInitialize, /* initializeProc */ BaseCleanup, /* cleanupProc */ ButtonConfigure, /* configureProc */ BasePostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ TtkWidgetDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(ButtonLayout) TTK_GROUP("Button.border", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Button.focus", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH)))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Checkbutton widget. */ typedef struct { Tcl_Obj *variableObj; Tcl_Obj *onValueObj; Tcl_Obj *offValueObj; Tcl_Obj *commandObj; Ttk_TraceHandle *variableTrace; } CheckbuttonPart; typedef struct { WidgetCore core; BasePart base; CheckbuttonPart checkbutton; } Checkbutton; /* * Option specifications: */ static Tk_OptionSpec CheckbuttonOptionSpecs[] = { WIDGET_TAKES_FOCUS, {TK_OPTION_STRING, "-variable", "variable", "Variable", "", Tk_Offset(Checkbutton, checkbutton.variableObj), -1, 0,0,0}, {TK_OPTION_STRING, "-onvalue", "onValue", "OnValue", "1", Tk_Offset(Checkbutton, checkbutton.onValueObj), -1, 0,0,0}, {TK_OPTION_STRING, "-offvalue", "offValue", "OffValue", "0", Tk_Offset(Checkbutton, checkbutton.offValueObj), -1, 0,0,0}, {TK_OPTION_STRING, "-command", "command", "Command", "", Tk_Offset(Checkbutton, checkbutton.commandObj), -1, 0,0,0}, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; /* * Variable trace procedure for checkbutton -variable option */ static void CheckbuttonVariableChanged(void *clientData, const char *value) { Checkbutton *checkPtr = clientData; if (WidgetDestroyed(&checkPtr->core)) { return; } if (!value) { TtkWidgetChangeState(&checkPtr->core, TTK_STATE_ALTERNATE, 0); return; } /* else */ TtkWidgetChangeState(&checkPtr->core, 0, TTK_STATE_ALTERNATE); if (!strcmp(value, Tcl_GetString(checkPtr->checkbutton.onValueObj))) { TtkWidgetChangeState(&checkPtr->core, TTK_STATE_SELECTED, 0); } else { TtkWidgetChangeState(&checkPtr->core, 0, TTK_STATE_SELECTED); } } static int CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr) { Checkbutton *checkPtr = recordPtr; Tcl_Obj *objPtr; /* default -variable is the widget name: */ objPtr = Tcl_NewStringObj(Tk_PathName(checkPtr->core.tkwin), -1); Tcl_IncrRefCount(objPtr); Tcl_DecrRefCount(checkPtr->checkbutton.variableObj); checkPtr->checkbutton.variableObj = objPtr; return BaseInitialize(interp, recordPtr); } static void CheckbuttonCleanup(void *recordPtr) { Checkbutton *checkPtr = recordPtr; Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace); checkPtr->checkbutton.variableTrace = 0; BaseCleanup(recordPtr); } static int CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Checkbutton *checkPtr = recordPtr; Ttk_TraceHandle *vt = Ttk_TraceVariable( interp, checkPtr->checkbutton.variableObj, CheckbuttonVariableChanged, checkPtr); if (!vt) { return TCL_ERROR; } if (BaseConfigure(interp, recordPtr, mask) != TCL_OK){ Ttk_UntraceVariable(vt); return TCL_ERROR; } Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace); checkPtr->checkbutton.variableTrace = vt; return TCL_OK; } static int CheckbuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Checkbutton *checkPtr = recordPtr; int status = TCL_OK; if (checkPtr->checkbutton.variableTrace) status = Ttk_FireTrace(checkPtr->checkbutton.variableTrace); if (status == TCL_OK && !WidgetDestroyed(&checkPtr->core)) status = BasePostConfigure(interp, recordPtr, mask); return status; } /* * Checkbutton 'invoke' subcommand: * Toggles the checkbutton state. */ static int CheckbuttonInvokeCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Checkbutton *checkPtr = recordPtr; WidgetCore *corePtr = &checkPtr->core; Tcl_Obj *newValue; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "invoke"); return TCL_ERROR; } if (corePtr->state & TTK_STATE_DISABLED) return TCL_OK; /* * Toggle the selected state. */ if (corePtr->state & TTK_STATE_SELECTED) newValue = checkPtr->checkbutton.offValueObj; else newValue = checkPtr->checkbutton.onValueObj; if (Tcl_ObjSetVar2(interp, checkPtr->checkbutton.variableObj, NULL, newValue, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) return TCL_ERROR; if (WidgetDestroyed(corePtr)) return TCL_ERROR; return Tcl_EvalObjEx(interp, checkPtr->checkbutton.commandObj, TCL_EVAL_GLOBAL); } static WidgetCommandSpec CheckbuttonCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "invoke", CheckbuttonInvokeCommand }, { "instate", TtkWidgetInstateCommand }, { "state", TtkWidgetStateCommand }, { "identify", TtkWidgetIdentifyCommand }, /* MISSING: select, deselect, toggle */ { NULL, NULL } }; static WidgetSpec CheckbuttonWidgetSpec = { "TCheckbutton", /* className */ sizeof(Checkbutton), /* recordSize */ CheckbuttonOptionSpecs, /* optionSpecs */ CheckbuttonCommands, /* subcommands */ CheckbuttonInitialize, /* initializeProc */ CheckbuttonCleanup, /* cleanupProc */ CheckbuttonConfigure, /* configureProc */ CheckbuttonPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ TtkWidgetDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(CheckbuttonLayout) TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH, TTK_NODE("Checkbutton.indicator", TTK_PACK_LEFT) TTK_GROUP("Checkbutton.focus", TTK_PACK_LEFT | TTK_STICK_W, TTK_NODE("Checkbutton.label", TTK_FILL_BOTH))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Radiobutton widget. */ typedef struct { Tcl_Obj *variableObj; Tcl_Obj *valueObj; Tcl_Obj *commandObj; Ttk_TraceHandle *variableTrace; } RadiobuttonPart; typedef struct { WidgetCore core; BasePart base; RadiobuttonPart radiobutton; } Radiobutton; /* * Option specifications: */ static Tk_OptionSpec RadiobuttonOptionSpecs[] = { WIDGET_TAKES_FOCUS, {TK_OPTION_STRING, "-variable", "variable", "Variable", "::selectedButton", Tk_Offset(Radiobutton, radiobutton.variableObj),-1, 0,0,0}, {TK_OPTION_STRING, "-value", "Value", "Value", "1", Tk_Offset(Radiobutton, radiobutton.valueObj), -1, 0,0,0}, {TK_OPTION_STRING, "-command", "command", "Command", "", Tk_Offset(Radiobutton, radiobutton.commandObj), -1, 0,0,0}, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; /* * Variable trace procedure for radiobuttons. */ static void RadiobuttonVariableChanged(void *clientData, const char *value) { Radiobutton *radioPtr = clientData; if (WidgetDestroyed(&radioPtr->core)) { return; } if (!value) { TtkWidgetChangeState(&radioPtr->core, TTK_STATE_ALTERNATE, 0); return; } /* else */ TtkWidgetChangeState(&radioPtr->core, 0, TTK_STATE_ALTERNATE); if (!strcmp(value, Tcl_GetString(radioPtr->radiobutton.valueObj))) { TtkWidgetChangeState(&radioPtr->core, TTK_STATE_SELECTED, 0); } else { TtkWidgetChangeState(&radioPtr->core, 0, TTK_STATE_SELECTED); } } static void RadiobuttonCleanup(void *recordPtr) { Radiobutton *radioPtr = recordPtr; Ttk_UntraceVariable(radioPtr->radiobutton.variableTrace); radioPtr->radiobutton.variableTrace = 0; BaseCleanup(recordPtr); } static int RadiobuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Radiobutton *radioPtr = recordPtr; Ttk_TraceHandle *vt = Ttk_TraceVariable( interp, radioPtr->radiobutton.variableObj, RadiobuttonVariableChanged, radioPtr); if (!vt) { return TCL_ERROR; } if (BaseConfigure(interp, recordPtr, mask) != TCL_OK) { Ttk_UntraceVariable(vt); return TCL_ERROR; } Ttk_UntraceVariable(radioPtr->radiobutton.variableTrace); radioPtr->radiobutton.variableTrace = vt; return TCL_OK; } static int RadiobuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Radiobutton *radioPtr = recordPtr; int status = TCL_OK; if (radioPtr->radiobutton.variableTrace) status = Ttk_FireTrace(radioPtr->radiobutton.variableTrace); if (status == TCL_OK && !WidgetDestroyed(&radioPtr->core)) status = BasePostConfigure(interp, recordPtr, mask); return status; } /* * Radiobutton 'invoke' subcommand: * Sets the radiobutton -variable to the -value, evaluates the -command. */ static int RadiobuttonInvokeCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Radiobutton *radioPtr = recordPtr; WidgetCore *corePtr = &radioPtr->core; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "invoke"); return TCL_ERROR; } if (corePtr->state & TTK_STATE_DISABLED) return TCL_OK; if (Tcl_ObjSetVar2(interp, radioPtr->radiobutton.variableObj, NULL, radioPtr->radiobutton.valueObj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) return TCL_ERROR; if (WidgetDestroyed(corePtr)) return TCL_ERROR; return Tcl_EvalObjEx(interp, radioPtr->radiobutton.commandObj, TCL_EVAL_GLOBAL); } static WidgetCommandSpec RadiobuttonCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "invoke", RadiobuttonInvokeCommand }, { "instate", TtkWidgetInstateCommand }, { "state", TtkWidgetStateCommand }, { "identify", TtkWidgetIdentifyCommand }, /* MISSING: select, deselect */ { NULL, NULL } }; static WidgetSpec RadiobuttonWidgetSpec = { "TRadiobutton", /* className */ sizeof(Radiobutton), /* recordSize */ RadiobuttonOptionSpecs, /* optionSpecs */ RadiobuttonCommands, /* subcommands */ BaseInitialize, /* initializeProc */ RadiobuttonCleanup, /* cleanupProc */ RadiobuttonConfigure, /* configureProc */ RadiobuttonPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ TtkWidgetDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(RadiobuttonLayout) TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH, TTK_NODE("Radiobutton.indicator", TTK_PACK_LEFT) TTK_GROUP("Radiobutton.focus", TTK_PACK_LEFT, TTK_NODE("Radiobutton.label", TTK_FILL_BOTH))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Menubutton widget. */ typedef struct { Tcl_Obj *menuObj; Tcl_Obj *directionObj; } MenubuttonPart; typedef struct { WidgetCore core; BasePart base; MenubuttonPart menubutton; } Menubutton; /* * Option specifications: */ static const char *directionStrings[] = { "above", "below", "left", "right", "flush", NULL }; static Tk_OptionSpec MenubuttonOptionSpecs[] = { WIDGET_TAKES_FOCUS, {TK_OPTION_STRING, "-menu", "menu", "Menu", "", Tk_Offset(Menubutton, menubutton.menuObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", "below", Tk_Offset(Menubutton, menubutton.directionObj), -1, 0,(ClientData)directionStrings,GEOMETRY_CHANGED}, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static WidgetCommandSpec MenubuttonCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "instate", TtkWidgetInstateCommand }, { "state", TtkWidgetStateCommand }, { "identify", TtkWidgetIdentifyCommand }, { NULL, NULL } }; static WidgetSpec MenubuttonWidgetSpec = { "TMenubutton", /* className */ sizeof(Menubutton), /* recordSize */ MenubuttonOptionSpecs, /* optionSpecs */ MenubuttonCommands, /* subcommands */ BaseInitialize, /* initializeProc */ BaseCleanup, /* cleanupProc */ BaseConfigure, /* configureProc */ BasePostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ TtkWidgetDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(MenubuttonLayout) TTK_GROUP("Menubutton.border", TTK_FILL_BOTH, TTK_GROUP("Menubutton.focus", TTK_FILL_BOTH, TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT) TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ void TtkButton_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme, "TLabel", LabelLayout); Ttk_RegisterLayout(theme, "TButton", ButtonLayout); Ttk_RegisterLayout(theme, "TCheckbutton", CheckbuttonLayout); Ttk_RegisterLayout(theme, "TRadiobutton", RadiobuttonLayout); Ttk_RegisterLayout(theme, "TMenubutton", MenubuttonLayout); RegisterWidget(interp, "ttk::label", &LabelWidgetSpec); RegisterWidget(interp, "ttk::button", &ButtonWidgetSpec); RegisterWidget(interp, "ttk::checkbutton", &CheckbuttonWidgetSpec); RegisterWidget(interp, "ttk::radiobutton", &RadiobuttonWidgetSpec); RegisterWidget(interp, "ttk::menubutton", &MenubuttonWidgetSpec); } tile-0.8.2/generic/cache.c0000644000076500007650000002270410257553620014701 0ustar joejoe00000000000000/* * cache.c -- * Tile theme engine, resource cache. * * Copyright (c) 2004, Joe English * * cache.c,v 1.10 2005/06/26 16:28:00 jenglish Exp * * The problem: * * Tk maintains reference counts for fonts, colors, and images, * and deallocates them when the reference count goes to zero. * With the theme engine, resources are allocated right before * drawing an element and released immediately after. * This causes a severe performance penalty, and on PseudoColor * visuals it causes colormap cycling as colormap entries are * released and reused. * * Solution: Acquire fonts, colors, and objects from a * resource cache instead of directly from Tk; the cache * holds a semipermanent reference to the resource to keep * it from being deallocated. * * The plumbing and control flow here is quite contorted; * it would be better to address this problem in the core instead. * * @@@ BUGS/TODO: Need distinct caches for each combination * of display, visual, and colormap. * * @@@ Colormap flashing on PseudoColor visuals is still possible, * but this will be a transient effect. */ #include /* for sprintf */ #include #include "tkTheme.h" struct Ttk_ResourceCache_ { Tcl_Interp *interp; /* Interpreter for error reporting */ Tk_Window tkwin; /* Cache window. */ Tcl_HashTable fontTable; /* Entries: Tcl_Obj* holding FontObjs */ Tcl_HashTable colorTable; /* Entries: Tcl_Obj* holding ColorObjs */ Tcl_HashTable borderTable; /* Entries: Tcl_Obj* holding BorderObjs */ Tcl_HashTable imageTable; /* Entries: Tk_Images */ Tcl_HashTable namedColors; /* Entries: RGB values as Tcl_StringObjs */ }; /* * Ttk_CreateResourceCache -- * Initialize a new resource cache. */ Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *interp) { Ttk_ResourceCache cache = (Ttk_ResourceCache)ckalloc(sizeof(*cache)); cache->tkwin = NULL; /* initialized later */ cache->interp = interp; Tcl_InitHashTable(&cache->fontTable, TCL_STRING_KEYS); Tcl_InitHashTable(&cache->colorTable, TCL_STRING_KEYS); Tcl_InitHashTable(&cache->borderTable, TCL_STRING_KEYS); Tcl_InitHashTable(&cache->imageTable, TCL_STRING_KEYS); Tcl_InitHashTable(&cache->namedColors, TCL_STRING_KEYS); return cache; } /* * Ttk_ClearCache -- * Release references to all cached resources. */ static void Ttk_ClearCache(Ttk_ResourceCache cache) { Tcl_HashSearch search; Tcl_HashEntry *entryPtr; /* * Free fonts: */ entryPtr = Tcl_FirstHashEntry(&cache->fontTable, &search); while (entryPtr != NULL) { Tcl_Obj *fontObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr); if (fontObj) { Tk_FreeFontFromObj(cache->tkwin, fontObj); Tcl_DecrRefCount(fontObj); } entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&cache->fontTable); Tcl_InitHashTable(&cache->fontTable, TCL_STRING_KEYS); /* * Free colors: */ entryPtr = Tcl_FirstHashEntry(&cache->colorTable, &search); while (entryPtr != NULL) { Tcl_Obj *colorObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr); if (colorObj) { Tk_FreeColorFromObj(cache->tkwin, colorObj); Tcl_DecrRefCount(colorObj); } entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&cache->colorTable); Tcl_InitHashTable(&cache->colorTable, TCL_STRING_KEYS); /* * Free borders: */ entryPtr = Tcl_FirstHashEntry(&cache->borderTable, &search); while (entryPtr != NULL) { Tcl_Obj *borderObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr); if (borderObj) { Tk_Free3DBorderFromObj(cache->tkwin, borderObj); Tcl_DecrRefCount(borderObj); } entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&cache->borderTable); Tcl_InitHashTable(&cache->borderTable, TCL_STRING_KEYS); /* * Free images: */ entryPtr = Tcl_FirstHashEntry(&cache->imageTable, &search); while (entryPtr != NULL) { Tk_Image image = (Tk_Image)Tcl_GetHashValue(entryPtr); if (image) { Tk_FreeImage(image); } entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&cache->imageTable); Tcl_InitHashTable(&cache->imageTable, TCL_STRING_KEYS); return; } /* * Ttk_FreeResourceCache -- * Release references to all cached resources, delete the cache. */ void Ttk_FreeResourceCache(Ttk_ResourceCache cache) { Tcl_HashEntry *entryPtr; Tcl_HashSearch search; Ttk_ClearCache(cache); Tcl_DeleteHashTable(&cache->colorTable); Tcl_DeleteHashTable(&cache->fontTable); Tcl_DeleteHashTable(&cache->imageTable); /* * Free named colors: */ entryPtr = Tcl_FirstHashEntry(&cache->namedColors, &search); while (entryPtr != NULL) { Tcl_Obj *colorNameObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(colorNameObj); entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&cache->namedColors); ckfree((ClientData)cache); } /* * CacheWinEventHandler -- * Detect when the cache window is destroyed, clear cache. */ static void CacheWinEventHandler(ClientData clientData, XEvent *eventPtr) { Ttk_ResourceCache cache = (Ttk_ResourceCache)clientData; if (eventPtr->type != DestroyNotify) { return; } Tk_DeleteEventHandler(cache->tkwin, StructureNotifyMask, CacheWinEventHandler, clientData); Ttk_ClearCache(cache); cache->tkwin = NULL; } /* * InitCacheWindow -- * Specify the cache window if not already set. * @@@ SHOULD: use separate caches for each combination * @@@ of display, visual, and colormap. */ static void InitCacheWindow(Ttk_ResourceCache cache, Tk_Window tkwin) { if (cache->tkwin == NULL) { cache->tkwin = tkwin; Tk_CreateEventHandler(tkwin, StructureNotifyMask, CacheWinEventHandler, (ClientData)cache); } } /* * Ttk_RegisterNamedColor -- * Specify an RGB triplet as a named color. * Overrides any previous named color specification. * */ void Ttk_RegisterNamedColor( Ttk_ResourceCache cache, const char *colorName, XColor *colorPtr) { int newEntry; Tcl_HashEntry *entryPtr; char nameBuf[14]; Tcl_Obj *colorNameObj; sprintf(nameBuf, "#%04X%04X%04X", colorPtr->red, colorPtr->green, colorPtr->blue); colorNameObj = Tcl_NewStringObj(nameBuf, -1); Tcl_IncrRefCount(colorNameObj); entryPtr = Tcl_CreateHashEntry(&cache->namedColors, colorName, &newEntry); if (!newEntry) { Tcl_Obj *oldColor = (Tcl_Obj*)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(oldColor); } Tcl_SetHashValue(entryPtr, (ClientData)colorNameObj); } /* * CheckNamedColor(objPtr) -- * If objPtr is a registered color name, return a Tcl_Obj * * containing the registered color value specification. * Otherwise, return the input argument. */ static Tcl_Obj *CheckNamedColor(Ttk_ResourceCache cache, Tcl_Obj *objPtr) { Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&cache->namedColors, Tcl_GetString(objPtr)); if (entryPtr) { /* Use named color instead */ objPtr = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); } return objPtr; } /* * Template for allocation routines: */ typedef void *(*Allocator)(Tcl_Interp *, Tk_Window, Tcl_Obj *); static Tcl_Obj *Ttk_Use( Tcl_Interp *interp, Tcl_HashTable *table, Allocator allocate, Tk_Window tkwin, Tcl_Obj *objPtr) { int newEntry; Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry(table,Tcl_GetString(objPtr),&newEntry); Tcl_Obj *cacheObj; if (!newEntry) { return (Tcl_Obj*)Tcl_GetHashValue(entryPtr); } cacheObj = Tcl_DuplicateObj(objPtr); Tcl_IncrRefCount(cacheObj); if (allocate(interp, tkwin, cacheObj)) { Tcl_SetHashValue(entryPtr, cacheObj); return cacheObj; } else { Tcl_DecrRefCount(cacheObj); Tcl_SetHashValue(entryPtr, NULL); Tcl_BackgroundError(interp); return NULL; } } /* * Ttk_UseFont -- * Acquire a font from the cache. */ Tcl_Obj *Ttk_UseFont(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) { InitCacheWindow(cache, tkwin); return Ttk_Use(cache->interp, &cache->fontTable,(Allocator)Tk_AllocFontFromObj, tkwin, objPtr); } /* * Ttk_UseColor -- * Acquire a color from the cache. */ Tcl_Obj *Ttk_UseColor(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) { objPtr = CheckNamedColor(cache, objPtr); InitCacheWindow(cache, tkwin); return Ttk_Use(cache->interp, &cache->colorTable,(Allocator)Tk_AllocColorFromObj, tkwin, objPtr); } /* * Ttk_UseBorder -- * Acquire a Tk_3DBorder from the cache. */ Tcl_Obj *Ttk_UseBorder( Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) { objPtr = CheckNamedColor(cache, objPtr); InitCacheWindow(cache, tkwin); return Ttk_Use(cache->interp, &cache->borderTable,(Allocator)Tk_Alloc3DBorderFromObj, tkwin, objPtr); } /* NullImageChanged -- * Tk_ImageChangedProc for Ttk_UseImage */ static void NullImageChanged(ClientData clientData, int x, int y, int width, int height, int imageWidth, int imageHeight) { /* No-op */ } /* * Ttk_UseImage -- * Acquire a Tk_Image from the cache. */ Tk_Image Ttk_UseImage(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) { const char *imageName = Tcl_GetString(objPtr); int newEntry; Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry(&cache->imageTable,imageName,&newEntry); Tk_Image image; InitCacheWindow(cache, tkwin); if (!newEntry) { return (Tk_Image)Tcl_GetHashValue(entryPtr); } image = Tk_GetImage(cache->interp, tkwin, imageName, NullImageChanged,0); Tcl_SetHashValue(entryPtr, image); if (!image) { Tcl_BackgroundError(cache->interp); } return image; } /*EOF*/ tile-0.8.2/generic/clamTheme.c0000644000076500007650000007236510724432726015547 0ustar joejoe00000000000000/* * clamTheme.c,v 1.30 2007/12/02 04:34:30 jenglish Exp * * Copyright (C) 2004 Joe English * * Tile widget set: another theme engine. * Inspired by the XFCE family of Gnome themes. */ #include #include "tkTheme.h" /* * Under windows, the Tk-provided XDrawLine and XDrawArc have an * off-by-one error in the end point. This is especially apparent with this * theme. Defining this macro as true handles this case. */ #if defined(WIN32) && !defined(WIN32_XDRAWLINE_HACK) # define WIN32_XDRAWLINE_HACK 1 #else # define WIN32_XDRAWLINE_HACK 0 #endif #define STR(x) StR(x) #define StR(x) #x #define SCROLLBAR_THICKNESS 14 #define FRAME_COLOR "#dcdad5" #define LIGHT_COLOR "#ffffff" #define DARK_COLOR "#cfcdc8" #define DARKER_COLOR "#bab5ab" #define DARKEST_COLOR "#9e9a91" /*------------------------------------------------------------------------ * +++ Utilities. */ static GC Ttk_GCForColor(Tk_Window tkwin, Tcl_Obj* colorObj, Drawable d) { GC gc = Tk_GCForColor(Tk_GetColorFromObj(tkwin, colorObj), d); #ifdef MAC_OSX_TK /* * Workaround for Tk bug under Aqua where the default line width is 0. */ Display *display = Tk_Display(tkwin); unsigned long mask = 0ul; XGCValues gcValues; gcValues.line_width = 1; mask = GCLineWidth; XChangeGC(display, gc, mask, &gcValues); #endif return gc; } static void DrawSmoothBorder( Tk_Window tkwin, Drawable d, Ttk_Box b, Tcl_Obj *outerColorObj, Tcl_Obj *upperColorObj, Tcl_Obj *lowerColorObj) { Display *display = Tk_Display(tkwin); int x1 = b.x, x2 = b.x + b.width - 1; int y1 = b.y, y2 = b.y + b.height - 1; const int w = WIN32_XDRAWLINE_HACK; GC gc; if ( outerColorObj && (gc=Ttk_GCForColor(tkwin,outerColorObj,d))) { XDrawLine(display,d,gc, x1+1,y1, x2-1+w,y1); /* N */ XDrawLine(display,d,gc, x1+1,y2, x2-1+w,y2); /* S */ XDrawLine(display,d,gc, x1,y1+1, x1,y2-1+w); /* E */ XDrawLine(display,d,gc, x2,y1+1, x2,y2-1+w); /* W */ } if ( upperColorObj && (gc=Ttk_GCForColor(tkwin,upperColorObj,d))) { XDrawLine(display,d,gc, x1+1,y1+1, x2-1+w,y1+1); /* N */ XDrawLine(display,d,gc, x1+1,y1+1, x1+1,y2-1); /* E */ } if ( lowerColorObj && (gc=Ttk_GCForColor(tkwin,lowerColorObj,d))) { XDrawLine(display,d,gc, x2-1,y2-1, x1+1-w,y2-1); /* S */ XDrawLine(display,d,gc, x2-1,y2-1, x2-1,y1+1-w); /* W */ } } static GC BackgroundGC(Tk_Window tkwin, Tcl_Obj *backgroundObj) { Tk_3DBorder bd = Tk_Get3DBorderFromObj(tkwin, backgroundObj); return Tk_3DBorderGC(tkwin, bd, TK_3D_FLAT_GC); } /*------------------------------------------------------------------------ * +++ Border element. */ typedef struct { Tcl_Obj *borderColorObj; Tcl_Obj *lightColorObj; Tcl_Obj *darkColorObj; Tcl_Obj *reliefObj; Tcl_Obj *borderWidthObj; /* See <> */ } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(BorderElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, Tk_Offset(BorderElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, Tk_Offset(BorderElement,darkColorObj), DARK_COLOR }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(BorderElement,reliefObj), "flat" }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(BorderElement,borderWidthObj), "2" }, {0,0,0} }; /* * <>: -borderwidth is only partially supported: * in this theme, borders are always exactly 2 pixels thick. * With -borderwidth 0, border is not drawn at all; * otherwise a 2-pixel border is used. For -borderwidth > 2, * the excess is used as padding. */ static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { BorderElement *border = (BorderElement*)elementRecord; int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth); if (borderWidth == 1) ++borderWidth; *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void BorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { BorderElement *border = elementRecord; int relief = TK_RELIEF_FLAT; int borderWidth = 2; Tcl_Obj *outer = 0, *upper = 0, *lower = 0; Tk_GetReliefFromObj(NULL, border->reliefObj, &relief); Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth); if (borderWidth == 0) return; switch (relief) { case TK_RELIEF_GROOVE : case TK_RELIEF_RIDGE : case TK_RELIEF_RAISED : outer = border->borderColorObj; upper = border->lightColorObj; lower = border->darkColorObj; break; case TK_RELIEF_SUNKEN : outer = border->borderColorObj; upper = border->darkColorObj; lower = border->lightColorObj; break; case TK_RELIEF_FLAT : outer = upper = lower = 0; break; case TK_RELIEF_SOLID : outer = upper = lower = border->borderColorObj; break; } DrawSmoothBorder(tkwin, d, b, outer, upper, lower); } static Ttk_ElementSpec BorderElementSpec = { TK_STYLE_VERSION_2, sizeof(BorderElement), BorderElementOptions, BorderElementSize, BorderElementDraw }; /*------------------------------------------------------------------------ * +++ Field element. */ typedef struct { Tcl_Obj *borderColorObj; Tcl_Obj *lightColorObj; Tcl_Obj *darkColorObj; Tcl_Obj *backgroundObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(FieldElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, Tk_Offset(FieldElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, Tk_Offset(FieldElement,darkColorObj), DARK_COLOR }, { "-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement,backgroundObj), "white" }, {0,0,0} }; static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(2); } static void FieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { FieldElement *field = elementRecord; Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj); Ttk_Box f = Ttk_PadBox(b, Ttk_UniformPadding(2)); Tcl_Obj *outer = field->borderColorObj, *inner = field->lightColorObj; DrawSmoothBorder(tkwin, d, b, outer, inner, inner); Tk_Fill3DRectangle( tkwin, d, bg, f.x, f.y, f.width, f.height, 0, TK_RELIEF_SUNKEN); } static Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, FieldElementSize, FieldElementDraw }; /* * Modified field element for comboboxes: * Right edge is expanded to overlap the dropdown button. */ static void ComboboxFieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { FieldElement *field = elementRecord; GC gc = Ttk_GCForColor(tkwin,field->borderColorObj,d); ++b.width; FieldElementDraw(clientData, elementRecord, tkwin, d, b, state); XDrawLine(Tk_Display(tkwin), d, gc, b.x + b.width - 1, b.y, b.x + b.width - 1, b.y + b.height - 1 + WIN32_XDRAWLINE_HACK); } static Ttk_ElementSpec ComboboxFieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, FieldElementSize, ComboboxFieldElementDraw }; /*------------------------------------------------------------------------ * +++ Indicator elements for check and radio buttons. */ typedef struct { Tcl_Obj *sizeObj; Tcl_Obj *marginObj; Tcl_Obj *backgroundObj; Tcl_Obj *foregroundObj; Tcl_Obj *upperColorObj; Tcl_Obj *lowerColorObj; } IndicatorElement; static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-indicatorsize", TK_OPTION_PIXELS, Tk_Offset(IndicatorElement,sizeObj), "10" }, { "-indicatormargin", TK_OPTION_STRING, Tk_Offset(IndicatorElement,marginObj), "1" }, { "-indicatorbackground", TK_OPTION_COLOR, Tk_Offset(IndicatorElement,backgroundObj), "white" }, { "-indicatorforeground", TK_OPTION_COLOR, Tk_Offset(IndicatorElement,foregroundObj), "black" }, { "-upperbordercolor", TK_OPTION_COLOR, Tk_Offset(IndicatorElement,upperColorObj), DARKEST_COLOR }, { "-lowerbordercolor", TK_OPTION_COLOR, Tk_Offset(IndicatorElement,lowerColorObj), DARK_COLOR }, {0,0,0} }; static void IndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { IndicatorElement *indicator = elementRecord; Ttk_Padding margins; int size = 10; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); *widthPtr = size + Ttk_PaddingWidth(margins); *heightPtr = size + Ttk_PaddingHeight(margins); } static void RadioIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { IndicatorElement *indicator = elementRecord; GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d); GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d); GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d); GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d); Ttk_Padding padding; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); XFillArc(Tk_Display(tkwin),d,gcb, b.x,b.y,b.width,b.height, 0,360*64); XDrawArc(Tk_Display(tkwin),d,gcl, b.x,b.y,b.width,b.height, 225*64,180*64); XDrawArc(Tk_Display(tkwin),d,gcu, b.x,b.y,b.width,b.height, 45*64,180*64); if (state & TTK_STATE_SELECTED) { b = Ttk_PadBox(b,Ttk_UniformPadding(3)); XFillArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64); XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64); #if WIN32_XDRAWLINE_HACK XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 300*64,360*64); #endif } } static void CheckIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { Display *display = Tk_Display(tkwin); IndicatorElement *indicator = elementRecord; GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d); GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d); GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d); GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d); Ttk_Padding padding; const int w = WIN32_XDRAWLINE_HACK; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); XFillRectangle(display,d,gcb, b.x,b.y,b.width,b.height); XDrawLine(display,d,gcl,b.x,b.y+b.height,b.x+b.width+w,b.y+b.height);/*S*/ XDrawLine(display,d,gcl,b.x+b.width,b.y,b.x+b.width,b.y+b.height+w); /*E*/ XDrawLine(display,d,gcu,b.x,b.y, b.x,b.y+b.height+w); /*W*/ XDrawLine(display,d,gcu,b.x,b.y, b.x+b.width+w,b.y); /*N*/ if (state & TTK_STATE_SELECTED) { int p,q,r,s; b = Ttk_PadBox(b,Ttk_UniformPadding(2)); p = b.x, q = b.y, r = b.x+b.width, s = b.y+b.height; r+=w, s+=w; XDrawLine(display, d, gcf, p, q, r, s); XDrawLine(display, d, gcf, p+1, q, r, s-1); XDrawLine(display, d, gcf, p, q+1, r-1, s); s-=w, q-=w; XDrawLine(display, d, gcf, p, s, r, q); XDrawLine(display, d, gcf, p+1, s, r, q+1); XDrawLine(display, d, gcf, p, s-1, r-1, q); } } static Ttk_ElementSpec RadioIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, IndicatorElementSize, RadioIndicatorElementDraw }; static Ttk_ElementSpec CheckIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, IndicatorElementSize, CheckIndicatorElementDraw }; #define MENUBUTTON_ARROW_SIZE 5 typedef struct { Tcl_Obj *sizeObj; Tcl_Obj *colorObj; Tcl_Obj *paddingObj; } MenuIndicatorElement; static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(MenuIndicatorElement,sizeObj), STR(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor",TK_OPTION_COLOR, Tk_Offset(MenuIndicatorElement,colorObj), "black" }, { "-arrowpadding",TK_OPTION_STRING, Tk_Offset(MenuIndicatorElement,paddingObj), "3" }, { NULL } }; static void MenuIndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { MenuIndicatorElement *indicator = elementRecord; Ttk_Padding margins; int size = MENUBUTTON_ARROW_SIZE; Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); Ttk_GetPaddingFromObj(NULL, tkwin, indicator->paddingObj, &margins); TtkArrowSize(size, ARROW_DOWN, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(margins); *heightPtr += Ttk_PaddingHeight(margins); } static void MenuIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { MenuIndicatorElement *indicator = elementRecord; XColor *arrowColor = Tk_GetColorFromObj(tkwin, indicator->colorObj); GC gc = Tk_GCForColor(arrowColor, d); int size = MENUBUTTON_ARROW_SIZE; int width, height; Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); TtkArrowSize(size, ARROW_DOWN, &width, &height); b = Ttk_StickBox(b, width, height, 0); TtkFillArrow(Tk_Display(tkwin), d, gc, b, ARROW_DOWN); } static Ttk_ElementSpec MenuIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(MenuIndicatorElement), MenuIndicatorElementOptions, MenuIndicatorElementSize, MenuIndicatorElementDraw }; /*------------------------------------------------------------------------ * +++ Grips. * * TODO: factor this with ThumbElementDraw */ static Ttk_Orient GripClientData[] = { TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL }; typedef struct { Tcl_Obj *lightColorObj; Tcl_Obj *borderColorObj; Tcl_Obj *gripCountObj; } GripElement; static Ttk_ElementOptionSpec GripElementOptions[] = { { "-lightcolor", TK_OPTION_COLOR, Tk_Offset(GripElement,lightColorObj), LIGHT_COLOR }, { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(GripElement,borderColorObj), DARKEST_COLOR }, { "-gripcount", TK_OPTION_INT, Tk_Offset(GripElement,gripCountObj), "5" }, {0,0,0} }; static void GripElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL; GripElement *grip = elementRecord; int gripCount; Tcl_GetIntFromObj(NULL, grip->gripCountObj, &gripCount); if (horizontal) { *widthPtr = 2*gripCount; } else { *heightPtr = 2*gripCount; } } static void GripElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { const int w = WIN32_XDRAWLINE_HACK; int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL; GripElement *grip = elementRecord; GC lightGC = Ttk_GCForColor(tkwin,grip->lightColorObj,d); GC darkGC = Ttk_GCForColor(tkwin,grip->borderColorObj,d); int gripPad = 1; int i, gripCount; Tcl_GetIntFromObj(NULL, grip->gripCountObj, &gripCount); if (horizontal) { int x = b.x + b.width / 2 - gripCount; int y1 = b.y + gripPad, y2 = b.y + b.height - gripPad - 1 + w; for (i=0; iborderColorObj,d); GC gct = Ttk_GCForColor(tkwin,sb->troughColorObj,d); XFillRectangle(Tk_Display(tkwin), d, gct, b.x, b.y, b.width-1, b.height-1); XDrawRectangle(Tk_Display(tkwin), d, gcb, b.x, b.y, b.width-1, b.height-1); } static Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, TtkNullElementSize, TroughElementDraw }; static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ScrollbarElement *sb = elementRecord; int size = SCROLLBAR_THICKNESS; Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &size); *widthPtr = *heightPtr = size; } static void ThumbElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { ScrollbarElement *sb = elementRecord; int gripCount = 3, orient = TTK_ORIENT_HORIZONTAL; GC lightGC, darkGC; int x1, y1, x2, y2, dx, dy, i; const int w = WIN32_XDRAWLINE_HACK; DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle( Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); /* * Draw grip: */ Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); if (orient == TTK_ORIENT_HORIZONTAL) { dx = 1; dy = 0; x1 = x2 = b.x + b.width / 2 - gripCount; y1 = b.y + 2; y2 = b.y + b.height - 3 + w; } else { dx = 0; dy = 1; y1 = y2 = b.y + b.height / 2 - gripCount; x1 = b.x + 2; x2 = b.x + b.width - 3 + w; } for (i=0; iorientObj, &orient); Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, sb->sliderlengthObj, &length); if (orient == TTK_ORIENT_VERTICAL) { *heightPtr = length; *widthPtr = thickness; } else { *heightPtr = thickness; *widthPtr = length; } } static Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, SliderElementSize, ThumbElementDraw }; /*------------------------------------------------------------------------ * +++ Progress bar element */ static void PbarElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SliderElementSize(clientData, elementRecord, tkwin, widthPtr, heightPtr, paddingPtr); *paddingPtr = Ttk_UniformPadding(2); *widthPtr += 4; *heightPtr += 4; } static void PbarElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { ScrollbarElement *sb = elementRecord; b = Ttk_PadBox(b, Ttk_UniformPadding(2)); if (b.width > 4 && b.height > 4) { DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle(Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); } } static Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, PbarElementSize, PbarElementDraw }; /*------------------------------------------------------------------------ * +++ Scrollbar arrows. */ static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ScrollbarElement *sb = elementRecord; int size = SCROLLBAR_THICKNESS; Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &size); *widthPtr = *heightPtr = size; } static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { ArrowDirection dir = *(ArrowDirection*)clientData; ScrollbarElement *sb = elementRecord; GC gc = Ttk_GCForColor(tkwin,sb->arrowColorObj, d); int h, cx, cy; DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle( Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); b = Ttk_PadBox(b, Ttk_UniformPadding(3)); h = b.width < b.height ? b.width : b.height; TtkArrowSize(h/2, dir, &cx, &cy); b = Ttk_AnchorBox(b, cx, cy, TK_ANCHOR_CENTER); TtkFillArrow(Tk_Display(tkwin), d, gc, b, dir); } static Ttk_ElementSpec ArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, ArrowElementSize, ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Notebook elements. * * Note: Tabs, except for the rightmost, overlap the neighbor to * their right by one pixel. */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *borderColorObj; Tcl_Obj *lightColorObj; Tcl_Obj *darkColorObj; } NotebookElement; static Ttk_ElementOptionSpec NotebookElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(NotebookElement,backgroundObj), FRAME_COLOR }, { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(NotebookElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, Tk_Offset(NotebookElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, Tk_Offset(NotebookElement,darkColorObj), DARK_COLOR }, {0,0,0} }; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int borderWidth = 2; paddingPtr->top = paddingPtr->left = paddingPtr->right = borderWidth; paddingPtr->bottom = 0; } static void TabElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { NotebookElement *tab = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj); Display *display = Tk_Display(tkwin); int borderWidth = 2, dh = 0; int x1,y1,x2,y2; GC gc; const int w = WIN32_XDRAWLINE_HACK; if (state & TTK_STATE_SELECTED) { dh = borderWidth; } if (state & TTK_STATE_USER2) { /* Rightmost tab */ --b.width; } Tk_Fill3DRectangle(tkwin, d, border, b.x+2, b.y+2, b.width-1, b.height-2+dh, borderWidth, TK_RELIEF_FLAT); x1 = b.x, x2 = b.x + b.width; y1 = b.y, y2 = b.y + b.height; gc=Ttk_GCForColor(tkwin,tab->borderColorObj,d); XDrawLine(display,d,gc, x1,y1+1, x1,y2+w); XDrawLine(display,d,gc, x2,y1+1, x2,y2+w); XDrawLine(display,d,gc, x1+1,y1, x2-1+w,y1); gc=Ttk_GCForColor(tkwin,tab->lightColorObj,d); XDrawLine(display,d,gc, x1+1,y1+1, x1+1,y2-1+dh+w); XDrawLine(display,d,gc, x1+1,y1+1, x2-1+w,y1+1); } static Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(NotebookElement), NotebookElementOptions, TabElementSize, TabElementDraw }; static void ClientElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int borderWidth = 2; *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void ClientElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { NotebookElement *ce = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj); int borderWidth = 2; Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth,TK_RELIEF_FLAT); DrawSmoothBorder(tkwin, d, b, ce->borderColorObj, ce->lightColorObj, ce->darkColorObj); } static Ttk_ElementSpec ClientElementSpec = { TK_STYLE_VERSION_2, sizeof(NotebookElement), NotebookElementOptions, ClientElementSize, ClientElementDraw }; /*------------------------------------------------------------------------ * +++ Modified widget layouts. */ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("TCombobox", TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) TTK_GROUP("Combobox.field", TTK_PACK_LEFT|TTK_FILL_BOTH|TTK_EXPAND, TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))) TTK_LAYOUT("Horizontal.Sash", TTK_GROUP("Sash.hsash", TTK_FILL_BOTH, TTK_NODE("Sash.hgrip", TTK_FILL_BOTH))) TTK_LAYOUT("Vertical.Sash", TTK_GROUP("Sash.vsash", TTK_FILL_BOTH, TTK_NODE("Sash.vgrip", TTK_FILL_BOTH))) TTK_END_LAYOUT_TABLE /*------------------------------------------------------------------------ * +++ Initialization. */ int DLLEXPORT TtkClamTheme_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_CreateTheme(interp, "clam", 0); if (!theme) { return TCL_ERROR; } Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Combobox.field", &ComboboxFieldElementSpec, NULL); Ttk_RegisterElement(interp, theme, "trough", &TroughElementSpec, NULL); Ttk_RegisterElement(interp, theme, "thumb", &ThumbElementSpec, NULL); Ttk_RegisterElement(interp, theme, "uparrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "downarrow", &ArrowElementSpec, &ArrowElements[1]); Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]); Ttk_RegisterElement(interp, theme, "Radiobutton.indicator", &RadioIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Checkbutton.indicator", &CheckIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Menubutton.indicator", &MenuIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "tab", &TabElementSpec, NULL); Ttk_RegisterElement(interp, theme, "client", &ClientElementSpec, NULL); Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "bar", &PbarElementSpec, NULL); Ttk_RegisterElement(interp, theme, "pbar", &PbarElementSpec, NULL); Ttk_RegisterElement(interp, theme, "hgrip", &GripElementSpec, &GripClientData[0]); Ttk_RegisterElement(interp, theme, "vgrip", &GripElementSpec, &GripClientData[1]); Ttk_RegisterLayouts(theme, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::clam", TILE_VERSION); return TCL_OK; } tile-0.8.2/generic/classicTheme.c0000644000076500007650000003732010724432726016244 0ustar joejoe00000000000000/* classicTheme.c,v 1.12 2007/12/02 04:34:30 jenglish Exp * * Copyright (c) 2004, Joe English * * Tile widget set: classic theme. * * Implements the "classic" Motif-like Tk look. * */ #include #include #include #include "tkTheme.h" #define DEFAULT_BORDERWIDTH "2" #define DEFAULT_ARROW_SIZE "15" /*---------------------------------------------------------------------- * +++ Highlight element implementation. * Draw a solid highlight border to indicate focus. */ typedef struct { Tcl_Obj *highlightColorObj; Tcl_Obj *highlightThicknessObj; } HighlightElement; static Ttk_ElementOptionSpec HighlightElementOptions[] = { { "-highlightcolor",TK_OPTION_COLOR, Tk_Offset(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND }, { "-highlightthickness",TK_OPTION_PIXELS, Tk_Offset(HighlightElement,highlightThicknessObj), "0" }, {NULL} }; static void HighlightElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { HighlightElement *hl = elementRecord; int highlightThickness = 0; Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness); *paddingPtr = Ttk_UniformPadding((short)highlightThickness); } static void HighlightElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { HighlightElement *hl = elementRecord; int highlightThickness = 0; XColor *highlightColor = Tk_GetColorFromObj(tkwin, hl->highlightColorObj); Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness); if (highlightColor && highlightThickness > 0) { GC gc = Tk_GCForColor(highlightColor, d); Tk_DrawFocusHighlight(tkwin, gc, highlightThickness, d); } } static Ttk_ElementSpec HighlightElementSpec = { TK_STYLE_VERSION_2, sizeof(HighlightElement), HighlightElementOptions, HighlightElementSize, HighlightElementDraw }; /*------------------------------------------------------------------------ * +++ Button Border element: * * The Motif-style button border on X11 consists of (from outside-in): * * + focus indicator (controlled by -highlightcolor and -highlightthickness), * + default ring (if -default active; blank if -default normal) * + shaded border (controlled by -background, -borderwidth, and -relief) */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *defaultStateObj; } ButtonBorderElement; static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(ButtonBorderElement,reliefObj), "flat" }, { "-default", TK_OPTION_ANY, Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" }, {NULL} }; static void ButtonBorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ButtonBorderElement *bd = elementRecord; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; int borderWidth = 0; Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { borderWidth += 5; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } /* * (@@@ Note: ButtonBorderElement still still still buggy: * padding for default ring is drawn in the wrong color * when the button is active.) */ static void ButtonBorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ButtonBorderElement *bd = elementRecord; Tk_3DBorder border = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; int inset = 0; /* * Get option values. */ border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); /* * Default ring: */ switch (defaultState) { case TTK_BUTTON_DEFAULT_DISABLED : break; case TTK_BUTTON_DEFAULT_NORMAL : inset += 5; break; case TTK_BUTTON_DEFAULT_ACTIVE : Tk_Draw3DRectangle(tkwin, d, border, b.x+inset, b.y+inset, b.width - 2*inset, b.height - 2*inset, 2, TK_RELIEF_FLAT); inset += 2; Tk_Draw3DRectangle(tkwin, d, border, b.x+inset, b.y+inset, b.width - 2*inset, b.height - 2*inset, 1, TK_RELIEF_SUNKEN); ++inset; Tk_Draw3DRectangle(tkwin, d, border, b.x+inset, b.y+inset, b.width - 2*inset, b.height - 2*inset, 2, TK_RELIEF_FLAT); inset += 2; break; } /* * 3-D border: */ if (border && borderWidth > 0) { Tk_Draw3DRectangle(tkwin, d, border, b.x+inset, b.y+inset, b.width - 2*inset, b.height - 2*inset, borderWidth,relief); } } static Ttk_ElementSpec ButtonBorderElementSpec = { TK_STYLE_VERSION_2, sizeof(ButtonBorderElement), ButtonBorderElementOptions, ButtonBorderElementSize, ButtonBorderElementDraw }; /*---------------------------------------------------------------------- * +++ Arrow element(s). * * Draws a 3-D shaded triangle. * clientData is an enum ArrowDirection pointer. */ static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT }; typedef struct { Tcl_Obj *sizeObj; Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } ArrowElement; static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,sizeObj), DEFAULT_ARROW_SIZE }, { "-background", TK_OPTION_BORDER, Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(ArrowElement,reliefObj),"raised" }, { NULL } }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ArrowElement *arrow = elementRecord; int size = 12; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); *widthPtr = *heightPtr = size; } static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { int direction = *(int *)clientData; ArrowElement *arrow = elementRecord; Tk_3DBorder border; int borderWidth; int relief = TK_RELIEF_RAISED; int size; XPoint points[3]; Tk_GetPixelsFromObj(NULL, tkwin, arrow->borderWidthObj, &borderWidth); border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief); size = b.width < b.height ? b.width : b.height; /* * @@@ There are off-by-one pixel errors in the way these are drawn; * @@@ need to take a look at Tk_Fill3DPolygon and X11 to find the * @@@ exact rules. */ switch (direction) { case ARROW_UP: points[2].x = b.x; points[2].y = b.y + size; points[1].x = b.x + size/2; points[1].y = b.y; points[0].x = b.x + size; points[0].y = b.y + size; break; case ARROW_DOWN: points[0].x = b.x; points[0].y = b.y; points[1].x = b.x + size/2; points[1].y = b.y + size; points[2].x = b.x + size; points[2].y = b.y; break; case ARROW_LEFT: points[0].x = b.x; points[0].y = b.y + size / 2; points[1].x = b.x + size; points[1].y = b.y + size; points[2].x = b.x + size; points[2].y = b.y; break; case ARROW_RIGHT: points[0].x = b.x + size; points[0].y = b.y + size / 2; points[1].x = b.x; points[1].y = b.y; points[2].x = b.x; points[2].y = b.y + size; break; } Tk_Fill3DPolygon(tkwin, d, border, points, 3, borderWidth, relief); } static Ttk_ElementSpec ArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, ArrowElementSize, ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Sash element (for ttk::panedwindow) * * NOTES: * * panedwindows with -orient horizontal use vertical sashes, and vice versa. * * Interpretation of -sashrelief 'groove' and 'ridge' are * swapped wrt. the core panedwindow, which (I think) has them backwards. * * Default -sashrelief is sunken; the core panedwindow has default * -sashrelief raised, but that looks wrong to me. */ static Ttk_Orient SashClientData[] = { TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL }; typedef struct { Tcl_Obj *borderObj; /* background color */ Tcl_Obj *sashReliefObj; /* sash relief */ Tcl_Obj *sashThicknessObj; /* overall thickness of sash */ Tcl_Obj *sashPadObj; /* padding on either side of handle */ Tcl_Obj *handleSizeObj; /* handle width and height */ Tcl_Obj *handlePadObj; /* handle's distance from edge */ } SashElement; static Ttk_ElementOptionSpec SashOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(SashElement,borderObj), DEFAULT_BACKGROUND }, { "-sashrelief", TK_OPTION_RELIEF, Tk_Offset(SashElement,sashReliefObj), "sunken" }, { "-sashthickness", TK_OPTION_PIXELS, Tk_Offset(SashElement,sashThicknessObj), "6" }, { "-sashpad", TK_OPTION_PIXELS, Tk_Offset(SashElement,sashPadObj), "2" }, { "-handlesize", TK_OPTION_PIXELS, Tk_Offset(SashElement,handleSizeObj), "8" }, { "-handlepad", TK_OPTION_PIXELS, Tk_Offset(SashElement,handlePadObj), "8" }, {0,0,0} }; static void SashElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SashElement *sash = elementRecord; int sashPad = 2, sashThickness = 6, handleSize = 8; int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL; Tk_GetPixelsFromObj(NULL, tkwin, sash->sashThicknessObj, &sashThickness); Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize); Tk_GetPixelsFromObj(NULL, tkwin, sash->sashPadObj, &sashPad); if (sashThickness < handleSize + 2*sashPad) sashThickness = handleSize + 2*sashPad; if (horizontal) *heightPtr = sashThickness; else *widthPtr = sashThickness; } static void SashElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { SashElement *sash = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, sash->borderObj); GC gc1,gc2; int relief = TK_RELIEF_RAISED; int handleSize = 8, handlePad = 8; int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL; Ttk_Box hb; Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize); Tk_GetPixelsFromObj(NULL, tkwin, sash->handlePadObj, &handlePad); Tk_GetReliefFromObj(NULL, sash->sashReliefObj, &relief); switch (relief) { case TK_RELIEF_RAISED: case TK_RELIEF_RIDGE: gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); break; case TK_RELIEF_SUNKEN: case TK_RELIEF_GROOVE: gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); break; case TK_RELIEF_SOLID: gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); break; case TK_RELIEF_FLAT: default: gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); break; } /* Draw sash line: */ if (horizontal) { int y = b.y + b.height/2 - 1; XDrawLine(Tk_Display(tkwin), d, gc1, b.x, y, b.x+b.width, y); ++y; XDrawLine(Tk_Display(tkwin), d, gc2, b.x, y, b.x+b.width, y); } else { int x = b.x + b.width/2 - 1; XDrawLine(Tk_Display(tkwin), d, gc1, x, b.y, x, b.y+b.height); ++x; XDrawLine(Tk_Display(tkwin), d, gc2, x, b.y, x, b.y+b.height); } /* Draw handle: */ if (handleSize >= 0) { if (horizontal) { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_W); hb.x += handlePad; } else { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_N); hb.y += handlePad; } Tk_Fill3DRectangle(tkwin, d, border, hb.x, hb.y, hb.width, hb.height, 1, TK_RELIEF_RAISED); } } static Ttk_ElementSpec SashElementSpec = { TK_STYLE_VERSION_2, sizeof(SashElement), SashOptions, SashElementSize, SashElementDraw }; /*------------------------------------------------------------------------ * +++ Widget layouts. */ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("TButton", TTK_GROUP("Button.highlight", TTK_FILL_BOTH, TTK_GROUP("Button.border", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH))))) TTK_LAYOUT("TCheckbutton", TTK_GROUP("Checkbutton.highlight", TTK_FILL_BOTH, TTK_GROUP("Checkbutton.border", TTK_FILL_BOTH, TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH, TTK_NODE("Checkbutton.indicator", TTK_PACK_LEFT) TTK_NODE("Checkbutton.label", TTK_PACK_LEFT|TTK_FILL_BOTH))))) TTK_LAYOUT("TRadiobutton", TTK_GROUP("Radiobutton.highlight", TTK_FILL_BOTH, TTK_GROUP("Radiobutton.border", TTK_FILL_BOTH, TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH, TTK_NODE("Radiobutton.indicator", TTK_PACK_LEFT) TTK_NODE("Radiobutton.label", TTK_PACK_LEFT|TTK_FILL_BOTH))))) TTK_LAYOUT("TMenubutton", TTK_GROUP("Menubutton.highlight", TTK_FILL_BOTH, TTK_GROUP("Menubutton.border", TTK_FILL_BOTH, TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT) TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, TTK_NODE("Menubutton.label", 0))))) /* "classic" entry, includes highlight border */ TTK_LAYOUT("TEntry", TTK_GROUP("Entry.highlight", TTK_FILL_BOTH, TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))) /* Notebook tabs -- omit focus ring */ TTK_LAYOUT("Tab", TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, TTK_GROUP("Notebook.padding", TTK_FILL_BOTH, TTK_NODE("Notebook.label", TTK_FILL_BOTH)))) TTK_END_LAYOUT_TABLE /* POSSIBLY: include Scale layouts w/focus border */ /*------------------------------------------------------------------------ * TtkClassicTheme_Init -- * Install classic theme. */ int TtkClassicTheme_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_CreateTheme(interp, "classic", NULL); if (!theme) { return TCL_ERROR; } /* * Register elements: */ Ttk_RegisterElement(interp, theme, "highlight", &HighlightElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Button.border", &ButtonBorderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "uparrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "downarrow", &ArrowElementSpec, &ArrowElements[1]); Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "hsash", &SashElementSpec, &SashClientData[0]); Ttk_RegisterElement(interp, theme, "vsash", &SashElementSpec, &SashClientData[1]); /* * Register layouts: */ Ttk_RegisterLayouts(theme, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::classic", TILE_VERSION); return TCL_OK; } /*EOF*/ tile-0.8.2/generic/configure0000755000076500007650000111224310731266347015404 0ustar joejoe00000000000000#! /bin/sh # From configure.in Revision: 1.51 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for tile 0.8.2. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='tile' PACKAGE_TARNAME='tile' PACKAGE_VERSION='0.8.2' PACKAGE_STRING='tile 0.8.2' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CYGPATH EXEEXT PKG_LIB_FILE PKG_STUB_LIB_FILE PKG_STUB_SOURCES PKG_STUB_OBJECTS PKG_TCL_SOURCES PKG_HEADERS PKG_INCLUDES PKG_LIBS PKG_CFLAGS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_LIBS TCL_DEFS TCL_EXTRA_CFLAGS TCL_LD_FLAGS TCL_SHLIB_LD_LIBS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_LIBS TK_XINCLUDES CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB CPP EGREP TCL_TOP_DIR_NATIVE TCL_GENERIC_DIR_NATIVE TCL_UNIX_DIR_NATIVE TCL_WIN_DIR_NATIVE TCL_BMAP_DIR_NATIVE TCL_TOOL_DIR_NATIVE TCL_PLATFORM_DIR_NATIVE TCL_INCLUDES TK_TOP_DIR_NATIVE TK_UNIX_DIR_NATIVE TK_WIN_DIR_NATIVE TK_GENERIC_DIR_NATIVE TK_XLIB_DIR_NATIVE TK_PLATFORM_DIR_NATIVE TK_INCLUDES TCLSH_PROG WISH_PROG AR CELIB_DIR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS LD_LIBRARY_PATH_VAR SHARED_BUILD CFLAGS_DEFAULT LDFLAGS_DEFAULT TCL_DBGX SHLIB_LD_OUT STLIB_LD_OUT SHLIB_SUFFIX STLIB_SUFFIX LIB_PREFIX PLATFORM_OBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures tile 0.8.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of tile 0.8.2:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-private-headers Disable if private headers are unavailable --enable-64bit enable 64bit support (default: off) --enable-64bit-vis enable 64bit Sparc VIS support (default: off) --disable-rpath disable rpath support (default: on) --enable-wince enable Win/CE support (where applicable) --enable-load allow dynamic loading and "load" command (default: on) --enable-shared build and link with shared libraries (default: on) --enable-symbols build with debugging symbols (default: off) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) --with-tk directory containing tk configuration (tkConfig.sh) --with-tclinclude directory containing the public Tcl header files --with-tkinclude directory containing the public Tk header files --with-celib=DIR use Windows/CE support library from DIR --with-x use the X Window System Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF tile configure 0.8.2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by tile $as_me 0.8.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in ../tclconfig $srcdir/../tclconfig; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../tclconfig $srcdir/../tclconfig" >&5 echo "$as_me: error: cannot find install-sh or install.sh in ../tclconfig $srcdir/../tclconfig" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Usual Tcl stuff: # # TEA extensions pass this us the version of TEA they think they # are compatible with. TEA_VERSION="3.6" echo "$as_me:$LINENO: checking for correct TEA configuration" >&5 echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6 if test x"${PACKAGE_NAME}" = x ; then { { echo "$as_me:$LINENO: error: The PACKAGE_NAME variable must be defined by your TEA configure.in" >&5 echo "$as_me: error: The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;} { (exit 1); exit 1; }; } fi if test x"3.6" = x ; then { { echo "$as_me:$LINENO: error: TEA version not specified." >&5 echo "$as_me: error: TEA version not specified." >&2;} { (exit 1); exit 1; }; } elif test "3.6" != "${TEA_VERSION}" ; then echo "$as_me:$LINENO: result: warning: requested TEA version \"3.6\", have \"${TEA_VERSION}\"" >&5 echo "${ECHO_T}warning: requested TEA version \"3.6\", have \"${TEA_VERSION}\"" >&6 else echo "$as_me:$LINENO: result: ok (TEA ${TEA_VERSION})" >&5 echo "${ECHO_T}ok (TEA ${TEA_VERSION})" >&6 fi case "`uname -s`" in *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CYGPATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CYGPATH"; then ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CYGPATH="cygpath -w" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" fi fi CYGPATH=$ac_cv_prog_CYGPATH if test -n "$CYGPATH"; then echo "$as_me:$LINENO: result: $CYGPATH" >&5 echo "${ECHO_T}$CYGPATH" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi EXEEXT=".exe" TEA_PLATFORM="windows" ;; *) CYGPATH=echo EXEEXT="" TEA_PLATFORM="unix" ;; esac # Check if exec_prefix is set. If not use fall back to prefix. # Note when adjusted, so that TEA_PREFIX can correct for this. # This is needed for recursive configures, since autoconf propagates # $prefix, but not $exec_prefix (doh!). if test x$exec_prefix = xNONE ; then exec_prefix_default=yes exec_prefix=$prefix fi # This package name must be replaced statically for AC_SUBST to work # Substitute STUB_LIB_FILE in case package creates a stub library too. # We AC_SUBST these here to ensure they are subst'ed, # in case the user doesn't call TEA_ADD_... # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl or --without-tcl was given. if test "${with_tcl+set}" = set; then withval="$with_tcl" with_tclconfig=${withval} fi; echo "$as_me:$LINENO: checking for Tcl configuration" >&5 echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6 if test "${ac_cv_c_tclconfig+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case ${with_tclconfig} in */tclConfig.sh ) if test -f ${with_tclconfig}; then { echo "$as_me:$LINENO: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5 echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;} with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'` fi ;; esac if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` else { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;} { (exit 1); exit 1; }; } fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ ../../tcl \ `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ ../../../tcl \ `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)` break fi done fi # TEA specific: on Windows, check in common installation locations if test "${TEA_PLATFORM}" = "windows" \ -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d C:/Tcl/lib 2>/dev/null` \ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi fi if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" { echo "$as_me:$LINENO: WARNING: Can't find Tcl configuration definitions" >&5 echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;} exit 0 else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5 echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6 fi fi echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5 echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then echo "$as_me:$LINENO: result: loading" >&5 echo "${ECHO_T}loading" >&6 . "${TCL_BIN_DIR}/tclConfig.sh" else echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6 fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. if test -f "${TCL_BIN_DIR}/Makefile" ; then TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} elif test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works # against Tcl.framework installed in an arbitary location. case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then for i in "`cd ${TCL_BIN_DIR}; pwd`" \ "`cd ${TCL_BIN_DIR}/../..; pwd`"; do if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}" break fi done fi if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}" TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}" fi ;; esac fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" # TEA specific: # # Ok, lets find the tk configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tk # if test x"${no_tk}" = x ; then # we reset no_tk in case something fails here no_tk=true # Check whether --with-tk or --without-tk was given. if test "${with_tk+set}" = set; then withval="$with_tk" with_tkconfig=${withval} fi; echo "$as_me:$LINENO: checking for Tk configuration" >&5 echo $ECHO_N "checking for Tk configuration... $ECHO_C" >&6 if test "${ac_cv_c_tkconfig+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # First check to see if --with-tkconfig was specified. if test x"${with_tkconfig}" != x ; then case ${with_tkconfig} in */tkConfig.sh ) if test -f ${with_tkconfig}; then { echo "$as_me:$LINENO: WARNING: --with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself" >&5 echo "$as_me: WARNING: --with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself" >&2;} with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'` fi ;; esac if test -f "${with_tkconfig}/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` else { { echo "$as_me:$LINENO: error: ${with_tkconfig} directory doesn't contain tkConfig.sh" >&5 echo "$as_me: error: ${with_tkconfig} directory doesn't contain tkConfig.sh" >&2;} { (exit 1); exit 1; }; } fi fi # then check for a private Tk library if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ../tk \ `ls -dr ../tk[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../tk[8-9].[0-9] 2>/dev/null` \ `ls -dr ../tk[8-9].[0-9]* 2>/dev/null` \ ../../tk \ `ls -dr ../../tk[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../tk[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../tk[8-9].[0-9]* 2>/dev/null` \ ../../../tk \ `ls -dr ../../../tk[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../tk[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../tk[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi done fi # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tk.framework/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i; pwd)` break fi done fi # TEA specific: on Windows, check in common installation locations if test "${TEA_PLATFORM}" = "windows" \ -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d C:/Tcl/lib 2>/dev/null` \ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ${srcdir}/../tk \ `ls -dr ${srcdir}/../tk[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ${srcdir}/../tk[8-9].[0-9] 2>/dev/null` \ `ls -dr ${srcdir}/../tk[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi done fi fi if test x"${ac_cv_c_tkconfig}" = x ; then TK_BIN_DIR="# no Tk configs found" { echo "$as_me:$LINENO: WARNING: Can't find Tk configuration definitions" >&5 echo "$as_me: WARNING: Can't find Tk configuration definitions" >&2;} exit 0 else no_tk= TK_BIN_DIR=${ac_cv_c_tkconfig} echo "$as_me:$LINENO: result: found ${TK_BIN_DIR}/tkConfig.sh" >&5 echo "${ECHO_T}found ${TK_BIN_DIR}/tkConfig.sh" >&6 fi fi echo "$as_me:$LINENO: checking for existence of ${TK_BIN_DIR}/tkConfig.sh" >&5 echo $ECHO_N "checking for existence of ${TK_BIN_DIR}/tkConfig.sh... $ECHO_C" >&6 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then echo "$as_me:$LINENO: result: loading" >&5 echo "${ECHO_T}loading" >&6 . "${TK_BIN_DIR}/tkConfig.sh" else echo "$as_me:$LINENO: result: could not find ${TK_BIN_DIR}/tkConfig.sh" >&5 echo "${ECHO_T}could not find ${TK_BIN_DIR}/tkConfig.sh" >&6 fi # eval is required to do the TK_DBGX substitution eval "TK_LIB_FILE=\"${TK_LIB_FILE}\"" eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\"" # If the TK_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TK_LIB_SPEC will be set to the value # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC # instead of TK_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. if test -f "${TK_BIN_DIR}/Makefile" ; then TK_LIB_SPEC=${TK_BUILD_LIB_SPEC} TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC} TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH} elif test "`uname -s`" = "Darwin"; then # If Tk was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works # against Tk.framework installed in an arbitary location. case ${TK_DEFS} in *TK_FRAMEWORK*) if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then for i in "`cd ${TK_BIN_DIR}; pwd`" \ "`cd ${TK_BIN_DIR}/../..; pwd`"; do if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}" break fi done fi if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}" fi ;; esac fi # eval is required to do the TK_DBGX substitution eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\"" eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\"" eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\"" eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\"" # TEA specific: Ensure windowingsystem is defined if test "${TEA_PLATFORM}" = "unix" ; then case ${TK_DEFS} in *MAC_OSX_TK*) cat >>confdefs.h <<\_ACEOF #define MAC_OSX_TK 1 _ACEOF TEA_WINDOWINGSYSTEM="aqua" ;; *) TEA_WINDOWINGSYSTEM="x11" ;; esac elif test "${TEA_PLATFORM}" = "windows" ; then TEA_WINDOWINGSYSTEM="win32" fi # TEA specific: if test "${prefix}" = "NONE"; then prefix_default=yes if test x"${TCL_PREFIX}" != x; then { echo "$as_me:$LINENO: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&5 echo "$as_me: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&6;} prefix=${TCL_PREFIX} else { echo "$as_me:$LINENO: --prefix defaulting to /usr/local" >&5 echo "$as_me: --prefix defaulting to /usr/local" >&6;} prefix=/usr/local fi fi if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \ -o x"${exec_prefix_default}" = x"yes" ; then if test x"${TCL_EXEC_PREFIX}" != x; then { echo "$as_me:$LINENO: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&5 echo "$as_me: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&6;} exec_prefix=${TCL_EXEC_PREFIX} else { echo "$as_me:$LINENO: --exec-prefix defaulting to ${prefix}" >&5 echo "$as_me: --exec-prefix defaulting to ${prefix}" >&6;} exec_prefix=$prefix fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # Check whether --enable-private-headers or --disable-private-headers was given. if test "${enable_private_headers+set}" = set; then enableval="$enable_private_headers" have_private_headers=$enableval else have_private_headers=yes fi; echo "$as_me:$LINENO: checking Did you ask for private headers?" >&5 echo $ECHO_N "checking Did you ask for private headers?... $ECHO_C" >&6 echo "$as_me:$LINENO: result: ${have_private_headers}" >&5 echo "${ECHO_T}${have_private_headers}" >&6 if test ${have_private_headers} = "yes" ; then ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking dirent.h" >&5 echo $ECHO_N "checking dirent.h... $ECHO_C" >&6 if test "${tcl_cv_dirent_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #ifndef _POSIX_SOURCE # ifdef __Lynx__ /* * Generate compilation error to make the test fail: Lynx headers * are only valid if really in the POSIX environment. */ missing_procedure(); # endif #endif DIR *d; struct dirent *entryPtr; char *p; d = opendir("foobar"); entryPtr = readdir(d); p = entryPtr->d_name; closedir(d); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_dirent_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_dirent_h=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $tcl_cv_dirent_h" >&5 echo "${ECHO_T}$tcl_cv_dirent_h" >&6 if test $tcl_cv_dirent_h = no; then cat >>confdefs.h <<\_ACEOF #define NO_DIRENT_H 1 _ACEOF fi # TEA specific: if test "${ac_cv_header_errno_h+set}" = set; then echo "$as_me:$LINENO: checking for errno.h" >&5 echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 if test "${ac_cv_header_errno_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 echo "${ECHO_T}$ac_cv_header_errno_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking errno.h usability" >&5 echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking errno.h presence" >&5 echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: errno.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: errno.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: errno.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: errno.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for errno.h" >&5 echo $ECHO_N "checking for errno.h... $ECHO_C" >&6 if test "${ac_cv_header_errno_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_errno_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5 echo "${ECHO_T}$ac_cv_header_errno_h" >&6 fi if test $ac_cv_header_errno_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_ERRNO_H 1 _ACEOF fi if test "${ac_cv_header_float_h+set}" = set; then echo "$as_me:$LINENO: checking for float.h" >&5 echo $ECHO_N "checking for float.h... $ECHO_C" >&6 if test "${ac_cv_header_float_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 echo "${ECHO_T}$ac_cv_header_float_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking float.h usability" >&5 echo $ECHO_N "checking float.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking float.h presence" >&5 echo $ECHO_N "checking float.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: float.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: float.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: float.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: float.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: float.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: float.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: float.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for float.h" >&5 echo $ECHO_N "checking for float.h... $ECHO_C" >&6 if test "${ac_cv_header_float_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_float_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 echo "${ECHO_T}$ac_cv_header_float_h" >&6 fi if test $ac_cv_header_float_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_FLOAT_H 1 _ACEOF fi if test "${ac_cv_header_values_h+set}" = set; then echo "$as_me:$LINENO: checking for values.h" >&5 echo $ECHO_N "checking for values.h... $ECHO_C" >&6 if test "${ac_cv_header_values_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 echo "${ECHO_T}$ac_cv_header_values_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking values.h usability" >&5 echo $ECHO_N "checking values.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking values.h presence" >&5 echo $ECHO_N "checking values.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: values.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: values.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: values.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: values.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: values.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: values.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: values.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for values.h" >&5 echo $ECHO_N "checking for values.h... $ECHO_C" >&6 if test "${ac_cv_header_values_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_values_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 echo "${ECHO_T}$ac_cv_header_values_h" >&6 fi if test $ac_cv_header_values_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_VALUES_H 1 _ACEOF fi if test "${ac_cv_header_limits_h+set}" = set; then echo "$as_me:$LINENO: checking for limits.h" >&5 echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 if test "${ac_cv_header_limits_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 echo "${ECHO_T}$ac_cv_header_limits_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking limits.h usability" >&5 echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking limits.h presence" >&5 echo $ECHO_N "checking limits.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: limits.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: limits.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: limits.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: limits.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for limits.h" >&5 echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 if test "${ac_cv_header_limits_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_limits_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 echo "${ECHO_T}$ac_cv_header_limits_h" >&6 fi if test $ac_cv_header_limits_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LIMITS_H 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define NO_LIMITS_H 1 _ACEOF fi if test "${ac_cv_header_stdlib_h+set}" = set; then echo "$as_me:$LINENO: checking for stdlib.h" >&5 echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 if test "${ac_cv_header_stdlib_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking stdlib.h usability" >&5 echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking stdlib.h presence" >&5 echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: stdlib.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: stdlib.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: stdlib.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for stdlib.h" >&5 echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 if test "${ac_cv_header_stdlib_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_stdlib_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 fi if test $ac_cv_header_stdlib_h = yes; then tcl_ok=1 else tcl_ok=0 fi cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtol" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtoul" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtod" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* if test $tcl_ok = 0; then cat >>confdefs.h <<\_ACEOF #define NO_STDLIB_H 1 _ACEOF fi if test "${ac_cv_header_string_h+set}" = set; then echo "$as_me:$LINENO: checking for string.h" >&5 echo $ECHO_N "checking for string.h... $ECHO_C" >&6 if test "${ac_cv_header_string_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 echo "${ECHO_T}$ac_cv_header_string_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking string.h usability" >&5 echo $ECHO_N "checking string.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking string.h presence" >&5 echo $ECHO_N "checking string.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: string.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: string.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: string.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for string.h" >&5 echo $ECHO_N "checking for string.h... $ECHO_C" >&6 if test "${ac_cv_header_string_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_string_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 echo "${ECHO_T}$ac_cv_header_string_h" >&6 fi if test $ac_cv_header_string_h = yes; then tcl_ok=1 else tcl_ok=0 fi cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strstr" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strerror" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* # See also memmove check below for a place where NO_STRING_H can be # set and why. if test $tcl_ok = 0; then cat >>confdefs.h <<\_ACEOF #define NO_STRING_H 1 _ACEOF fi if test "${ac_cv_header_sys_wait_h+set}" = set; then echo "$as_me:$LINENO: checking for sys/wait.h" >&5 echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking sys/wait.h usability" >&5 echo $ECHO_N "checking sys/wait.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking sys/wait.h presence" >&5 echo $ECHO_N "checking sys/wait.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: sys/wait.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: sys/wait.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: sys/wait.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: sys/wait.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: sys/wait.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: sys/wait.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: sys/wait.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for sys/wait.h" >&5 echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_wait_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 fi if test $ac_cv_header_sys_wait_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_SYS_WAIT_H 1 _ACEOF fi if test "${ac_cv_header_dlfcn_h+set}" = set; then echo "$as_me:$LINENO: checking for dlfcn.h" >&5 echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 if test "${ac_cv_header_dlfcn_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for dlfcn.h" >&5 echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 if test "${ac_cv_header_dlfcn_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_dlfcn_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 fi if test $ac_cv_header_dlfcn_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_DLFCN_H 1 _ACEOF fi # OS/390 lacks sys/param.h (and doesn't need it, by chance). for ac_header in sys/param.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to the tile lists. ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for Tcl private include files" >&5 echo $ECHO_N "checking for Tcl private include files... $ECHO_C" >&6 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}` TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\" TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\" TCL_UNIX_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\" TCL_WIN_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\" TCL_BMAP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/bitmaps\" TCL_TOOL_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/tools\" TCL_COMPAT_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/compat\" if test "${TEA_PLATFORM}" = "windows"; then TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE} else TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE} fi # We want to ensure these are substituted so as not to require # any *_NATIVE vars be defined in the Makefile TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}" if test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use # the framework's Headers and PrivateHeaders directories case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -d "${TCL_BIN_DIR}/Headers" -a -d "${TCL_BIN_DIR}/PrivateHeaders"; then TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"; else TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"; fi ;; esac else if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then { { echo "$as_me:$LINENO: error: Cannot find private header tclInt.h in ${TCL_SRC_DIR}" >&5 echo "$as_me: error: Cannot find private header tclInt.h in ${TCL_SRC_DIR}" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: result: Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}" >&5 echo "${ECHO_T}Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}" >&6 echo "$as_me:$LINENO: checking for Tk private include files" >&5 echo $ECHO_N "checking for Tk private include files... $ECHO_C" >&6 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}` TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\" TK_UNIX_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\" TK_WIN_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\" TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\" TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\" if test "${TEA_PLATFORM}" = "windows"; then TK_PLATFORM_DIR_NATIVE=${TK_WIN_DIR_NATIVE} else TK_PLATFORM_DIR_NATIVE=${TK_UNIX_DIR_NATIVE} fi # We want to ensure these are substituted so as not to require # any *_NATIVE vars be defined in the Makefile TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}" # Detect and add ttk subdir if test -d ${TK_SRC_DIR_NATIVE}/generic/ttk; then TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\"" fi if test "${TEA_WINDOWINGSYSTEM}" = "win32" \ -o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then TK_INCLUDES="${TK_INCLUDES} -I${TK_XLIB_DIR_NATIVE}" fi if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then TK_INCLUDES="${TK_INCLUDES} -I${TK_SRC_DIR_NATIVE}/macosx" fi if test "`uname -s`" = "Darwin"; then # If Tk was built as a framework, attempt to use # the framework's Headers and PrivateHeaders directories case ${TK_DEFS} in *TK_FRAMEWORK*) if test -d "${TK_BIN_DIR}/Headers" -a -d "${TK_BIN_DIR}/PrivateHeaders"; then TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"; fi ;; esac else if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then { { echo "$as_me:$LINENO: error: Cannot find private header tkInt.h in ${TK_SRC_DIR}" >&5 echo "$as_me: error: Cannot find private header tkInt.h in ${TK_SRC_DIR}" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: result: Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}" >&5 echo "${ECHO_T}Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}" >&6 else echo "$as_me:$LINENO: checking for Tcl public headers" >&5 echo $ECHO_N "checking for Tcl public headers... $ECHO_C" >&6 # Check whether --with-tclinclude or --without-tclinclude was given. if test "${with_tclinclude+set}" = set; then withval="$with_tclinclude" with_tclinclude=${withval} fi; if test "${ac_cv_c_tclh+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Use the value from --with-tclinclude, if it was given if test x"${with_tclinclude}" != x ; then if test -f "${with_tclinclude}/tcl.h" ; then ac_cv_c_tclh=${with_tclinclude} else { { echo "$as_me:$LINENO: error: ${with_tclinclude} directory does not contain tcl.h" >&5 echo "$as_me: error: ${with_tclinclude} directory does not contain tcl.h" >&2;} { (exit 1); exit 1; }; } fi else if test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use # the framework's Headers directory case ${TCL_DEFS} in *TCL_FRAMEWORK*) list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`" ;; esac fi # Look in the source dir only if Tcl is not installed, # and in that situation, look there before installed locations. if test -f "${TCL_BIN_DIR}/Makefile" ; then list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`" fi # Check order: pkg --prefix location, Tcl's --prefix location, # relative to directory of tclConfig.sh. eval "temp_includedir=${includedir}" list="$list \ `ls -d ${temp_includedir} 2>/dev/null` \ `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`" if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then list="$list /usr/local/include /usr/include" if test x"${TCL_INCLUDE_SPEC}" != x ; then d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'` list="$list `ls -d ${d} 2>/dev/null`" fi fi for i in $list ; do if test -f "$i/tcl.h" ; then ac_cv_c_tclh=$i break fi done fi fi # Print a message based on how we determined the include path if test x"${ac_cv_c_tclh}" = x ; then { { echo "$as_me:$LINENO: error: tcl.h not found. Please specify its location with --with-tclinclude" >&5 echo "$as_me: error: tcl.h not found. Please specify its location with --with-tclinclude" >&2;} { (exit 1); exit 1; }; } else echo "$as_me:$LINENO: result: ${ac_cv_c_tclh}" >&5 echo "${ECHO_T}${ac_cv_c_tclh}" >&6 fi # Convert to a native path and substitute into the output files. INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}` TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" echo "$as_me:$LINENO: checking for Tk public headers" >&5 echo $ECHO_N "checking for Tk public headers... $ECHO_C" >&6 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" with_tkinclude=${withval} fi; if test "${ac_cv_c_tkh+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Use the value from --with-tkinclude, if it was given if test x"${with_tkinclude}" != x ; then if test -f "${with_tkinclude}/tk.h" ; then ac_cv_c_tkh=${with_tkinclude} else { { echo "$as_me:$LINENO: error: ${with_tkinclude} directory does not contain tk.h" >&5 echo "$as_me: error: ${with_tkinclude} directory does not contain tk.h" >&2;} { (exit 1); exit 1; }; } fi else if test "`uname -s`" = "Darwin"; then # If Tk was built as a framework, attempt to use # the framework's Headers directory. case ${TK_DEFS} in *TK_FRAMEWORK*) list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`" ;; esac fi # Look in the source dir only if Tk is not installed, # and in that situation, look there before installed locations. if test -f "${TK_BIN_DIR}/Makefile" ; then list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`" fi # Check order: pkg --prefix location, Tk's --prefix location, # relative to directory of tkConfig.sh, Tcl's --prefix location, # relative to directory of tclConfig.sh. eval "temp_includedir=${includedir}" list="$list \ `ls -d ${temp_includedir} 2>/dev/null` \ `ls -d ${TK_PREFIX}/include 2>/dev/null` \ `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \ `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`" if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then list="$list /usr/local/include /usr/include" fi for i in $list ; do if test -f "$i/tk.h" ; then ac_cv_c_tkh=$i break fi done fi fi # Print a message based on how we determined the include path if test x"${ac_cv_c_tkh}" = x ; then { { echo "$as_me:$LINENO: error: tk.h not found. Please specify its location with --with-tkinclude" >&5 echo "$as_me: error: tk.h not found. Please specify its location with --with-tkinclude" >&2;} { (exit 1); exit 1; }; } else echo "$as_me:$LINENO: result: ${ac_cv_c_tkh}" >&5 echo "${ECHO_T}${ac_cv_c_tkh}" >&6 fi # Convert to a native path and substitute into the output files. INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}` TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" if test "${TEA_WINDOWINGSYSTEM}" = "win32" \ -o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then # On Windows and Aqua, we need the X compat headers echo "$as_me:$LINENO: checking for X11 header files" >&5 echo $ECHO_N "checking for X11 header files... $ECHO_C" >&6 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`" TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" fi echo "$as_me:$LINENO: result: ${INCLUDE_DIR_NATIVE}" >&5 echo "${ECHO_T}${INCLUDE_DIR_NATIVE}" >&6 fi cat >>confdefs.h <<\_ACEOF #define NO_PRIVATE_HEADERS 1 _ACEOF fi echo "$as_me:$LINENO: checking for tclsh" >&5 echo $ECHO_N "checking for tclsh... $ECHO_C" >&6 if test -f "${TCL_BIN_DIR}/Makefile" ; then # tclConfig.sh is in Tcl build directory if test "${TEA_PLATFORM}" = "windows"; then TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" else TCLSH_PROG="${TCL_BIN_DIR}/tclsh" fi else # tclConfig.sh is in install location if test "${TEA_PLATFORM}" = "windows"; then TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" else TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}" fi list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \ `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \ `ls -d ${TCL_PREFIX}/bin 2>/dev/null`" for i in $list ; do if test -f "$i/${TCLSH_PROG}" ; then REAL_TCL_BIN_DIR="`cd "$i"; pwd`/" break fi done TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}" fi echo "$as_me:$LINENO: result: ${TCLSH_PROG}" >&5 echo "${ECHO_T}${TCLSH_PROG}" >&6 echo "$as_me:$LINENO: checking for wish" >&5 echo $ECHO_N "checking for wish... $ECHO_C" >&6 if test -f "${TK_BIN_DIR}/Makefile" ; then # tkConfig.sh is in Tk build directory if test "${TEA_PLATFORM}" = "windows"; then WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}" else WISH_PROG="${TK_BIN_DIR}/wish" fi else # tkConfig.sh is in install location if test "${TEA_PLATFORM}" = "windows"; then WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}" else WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}" fi list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \ `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \ `ls -d ${TK_PREFIX}/bin 2>/dev/null`" for i in $list ; do if test -f "$i/${WISH_PROG}" ; then REAL_TK_BIN_DIR="`cd "$i"; pwd`/" break fi done WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}" fi echo "$as_me:$LINENO: result: ${WISH_PROG}" >&5 echo "${ECHO_T}${WISH_PROG}" >&6 # Build stuff: # # Step 0.a: Enable 64 bit support? echo "$as_me:$LINENO: checking if 64bit support is requested" >&5 echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6 # Check whether --enable-64bit or --disable-64bit was given. if test "${enable_64bit+set}" = set; then enableval="$enable_64bit" do64bit=$enableval else do64bit=no fi; echo "$as_me:$LINENO: result: $do64bit" >&5 echo "${ECHO_T}$do64bit" >&6 # Step 0.b: Enable Solaris 64 bit VIS support? echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5 echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 # Check whether --enable-64bit-vis or --disable-64bit-vis was given. if test "${enable_64bit_vis+set}" = set; then enableval="$enable_64bit_vis" do64bitVIS=$enableval else do64bitVIS=no fi; echo "$as_me:$LINENO: result: $do64bitVIS" >&5 echo "${ECHO_T}$do64bitVIS" >&6 # Force 64bit on with VIS if test "$do64bitVIS" = "yes"; then do64bit=yes fi # Step 0.c: Check if visibility support is available. Do this here so # that platform specific alternatives can be used below if this fails. echo "$as_me:$LINENO: checking if compiler supports visibility \"hidden\"" >&5 echo $ECHO_N "checking if compiler supports visibility \"hidden\"... $ECHO_C" >&6 if test "${tcl_cv_cc_visibility_hidden+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) void f(void); void f(void) {} int main () { f(); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_visibility_hidden=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_visibility_hidden=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5 echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6 if test $tcl_cv_cc_visibility_hidden = yes; then cat >>confdefs.h <<\_ACEOF #define MODULE_SCOPE extern __attribute__((__visibility__("hidden"))) _ACEOF fi # Step 0.d: Disable -rpath support? echo "$as_me:$LINENO: checking if rpath support is requested" >&5 echo $ECHO_N "checking if rpath support is requested... $ECHO_C" >&6 # Check whether --enable-rpath or --disable-rpath was given. if test "${enable_rpath+set}" = set; then enableval="$enable_rpath" doRpath=$enableval else doRpath=yes fi; echo "$as_me:$LINENO: result: $doRpath" >&5 echo "${ECHO_T}$doRpath" >&6 # TEA specific: Cross-compiling options for Windows/CE builds? if test "${TEA_PLATFORM}" = windows; then echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5 echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6 # Check whether --enable-wince or --disable-wince was given. if test "${enable_wince+set}" = set; then enableval="$enable_wince" doWince=$enableval else doWince=no fi; echo "$as_me:$LINENO: result: $doWince" >&5 echo "${ECHO_T}$doWince" >&6 fi # Step 1: set the variable "system" to hold the name and version number # for the system. echo "$as_me:$LINENO: checking system version" >&5 echo $ECHO_N "checking system version... $ECHO_C" >&6 if test "${tcl_cv_sys_version+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # TEA specific: if test "${TEA_PLATFORM}" = "windows" ; then tcl_cv_sys_version=windows elif test -f /usr/lib/NextStep/software_version; then tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5 echo "$as_me: WARNING: can't find uname command" >&2;} tcl_cv_sys_version=unknown else # Special check for weird MP-RAS system (uname returns weird # results, and the version is kept in special file). if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then tcl_cv_sys_version=MP-RAS-`awk '{print $3}' /etc/.relid` fi if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi fi fi fi echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5 echo "${ECHO_T}$tcl_cv_sys_version" >&6 system=$tcl_cv_sys_version # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then have_dl=yes else have_dl=no fi # Require ranlib early so we can override it in special cases below. # Step 3: set configuration options based on system name and version. # This is similar to Tcl's unix/tcl.m4 except that we've added a # "windows" case. do64bit_ok=no LDFLAGS_ORIG="$LDFLAGS" # When ld needs options to work in 64-bit mode, put them in # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load] # is disabled by the user. [Bug 1016796] LDFLAGS_ARCH="" TCL_EXPORT_FILE_SUFFIX="" UNSHARED_LIB_SUFFIX="" # TEA specific: use PACKAGE_VERSION instead of VERSION TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' ECHO_VERSION='`echo ${PACKAGE_VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O if test "$GCC" = yes; then # TEA specific: CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall" else CFLAGS_WARNING="" fi TCL_NEEDS_EXP_FILE=0 TCL_BUILD_EXP_FILE="" TCL_EXP_FILE="" # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STLIB_LD='${AR} cr' LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" case $system in # TEA specific: windows) # This is a 2-stage check to make sure we have the 64-bit SDK # We have to know where the SDK is installed. # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs # MACHINE is IX86 for LINK, but this is used by the manifest, # which requires x86|amd64|ia64. MACHINE="X86" if test "$do64bit" != "no" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft Platform SDK" fi MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` PATH64="" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # default to AMD64 64-bit build PATH64="${MSSDK}/Bin/Win64/x86/AMD64" ;; ia64) MACHINE="IA64" PATH64="${MSSDK}/Bin/Win64" ;; esac if test ! -d "${PATH64}" ; then { echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5 echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&2;} { echo "$as_me:$LINENO: WARNING: Ensure latest Platform SDK is installed" >&5 echo "$as_me: WARNING: Ensure latest Platform SDK is installed" >&2;} do64bit="no" else echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 do64bit_ok="yes" fi fi if test "$doWince" != "no" ; then if test "$do64bit" != "no" ; then { { echo "$as_me:$LINENO: error: Windows/CE and 64-bit builds incompatible" >&5 echo "$as_me: error: Windows/CE and 64-bit builds incompatible" >&2;} { (exit 1); exit 1; }; } fi if test "$GCC" = "yes" ; then { { echo "$as_me:$LINENO: error: Windows/CE and GCC builds incompatible" >&5 echo "$as_me: error: Windows/CE and GCC builds incompatible" >&2;} { (exit 1); exit 1; }; } fi # First, look for one uninstalled. # the alternative search directory is invoked by --with-celib if test x"${no_celib}" = x ; then # we reset no_celib in case something fails here no_celib=true # Check whether --with-celib or --without-celib was given. if test "${with_celib+set}" = set; then withval="$with_celib" with_celibconfig=${withval} fi; echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5 echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6 if test "${ac_cv_c_celibconfig+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # First check to see if --with-celibconfig was specified. if test x"${with_celibconfig}" != x ; then if test -d "${with_celibconfig}/inc" ; then ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` else { { echo "$as_me:$LINENO: error: ${with_celibconfig} directory doesn't contain inc directory" >&5 echo "$as_me: error: ${with_celibconfig} directory doesn't contain inc directory" >&2;} { (exit 1); exit 1; }; } fi fi # then check for a celib library if test x"${ac_cv_c_celibconfig}" = x ; then for i in \ ../celib-palm-3.0 \ ../celib \ ../../celib-palm-3.0 \ ../../celib \ `ls -dr ../celib-*3.[0-9]* 2>/dev/null` \ ${srcdir}/../celib-palm-3.0 \ ${srcdir}/../celib \ `ls -dr ${srcdir}/../celib-*3.[0-9]* 2>/dev/null` \ ; do if test -d "$i/inc" ; then ac_cv_c_celibconfig=`(cd $i; pwd)` break fi done fi fi if test x"${ac_cv_c_celibconfig}" = x ; then { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5 echo "$as_me: error: Cannot find celib support library directory" >&2;} { (exit 1); exit 1; }; } else no_celib= CELIB_DIR=${ac_cv_c_celibconfig} CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'` echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5 echo "${ECHO_T}found $CELIB_DIR" >&6 fi fi # Set defaults for common evc4/PPC2003 setup # Currently Tcl requires 300+, possibly 420+ for sockets CEVERSION=420; # could be 211 300 301 400 420 ... TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... ARCH=ARM; # could be ARM MIPS X86EM ... PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" if test "$doWince" != "yes"; then # If !yes then the user specified something # Reset ARCH to allow user to skip specifying it ARCH= eval `echo $doWince | awk -F, '{ \ if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \ if ($1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \ if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \ if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \ }'` if test "x${ARCH}" = "x" ; then ARCH=$TARGETCPU; fi fi OSVERSION=WCE$CEVERSION; if test "x${WCEROOT}" = "x" ; then WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" if test ! -d "${WCEROOT}" ; then WCEROOT="C:/Program Files/Microsoft eMbedded Tools" fi fi if test "x${SDKROOT}" = "x" ; then SDKROOT="C:/Program Files/Windows CE Tools" if test ! -d "${SDKROOT}" ; then SDKROOT="C:/Windows CE Tools" fi fi WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'` SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'` if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5 echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;} { (exit 1); exit 1; }; } doWince="no" else # We could PATH_NOSPACE these, but that's not important, # as long as we quote them when used. CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" if test -d "${CEINCLUDE}/${TARGETCPU}" ; then CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" fi CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" fi fi if test "$GCC" != "yes" ; then if test "${SHARED_BUILD}" = "0" ; then runtime=-MT else runtime=-MD fi if test "$do64bit" != "no" ; then # All this magic is necessary for the Win64 SDK RC1 - hobbs CC="\"${PATH64}/cl.exe\"" CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\"" RC="\"${MSSDK}/bin/rc.exe\"" lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" LINKBIN="\"${PATH64}/link.exe\"" CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" # Avoid 'unresolved external symbol __security_cookie' # errors, c.f. http://support.microsoft.com/?id=894573 vars="bufferoverflowU.lib" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done elif test "$doWince" != "no" ; then CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" if test "${TARGETCPU}" = "X86"; then CC="\"${CEBINROOT}/cl.exe\"" else CC="\"${CEBINROOT}/cl${ARCH}.exe\"" fi CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\"" arch=`echo ${ARCH} | awk '{print tolower($0)}'` defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS" if test "${SHARED_BUILD}" = "1" ; then # Static CE builds require static celib as well defs="${defs} _DLL" fi for i in $defs ; do cat >>confdefs.h <<_ACEOF #define $i 1 _ACEOF done cat >>confdefs.h <<_ACEOF #define _WIN32_WCE $CEVERSION _ACEOF cat >>confdefs.h <<_ACEOF #define UNDER_CE $CEVERSION _ACEOF CFLAGS_DEBUG="-nologo -Zi -Od" CFLAGS_OPTIMIZE="-nologo -Ox" lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" LINKBIN="\"${CEBINROOT}/link.exe\"" else RC="rc" lflags="-nologo" LINKBIN="link" CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" fi fi if test "$GCC" = "yes"; then # mingw gcc mode RC="windres" CFLAGS_DEBUG="-g" CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" SHLIB_LD="$CC -shared" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" else SHLIB_LD="${LINKBIN} -dll ${lflags}" # link -lib only works when -lib is the first arg STLIB_LD="${LINKBIN} -lib ${lflags}" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib' PATHTYPE=-w # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp # This essentially turns it all on. LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" LDFLAGS_OPTIMIZE="-release" if test "$doWince" != "no" ; then LDFLAGS_CONSOLE="-link ${lflags}" LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} else LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi fi SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dll" SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll' TCL_LIB_VERSIONS_OK=nodots # Bogus to avoid getting this turned off DL_OBJS="tclLoadNone.obj" ;; AIX-*) if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then # AIX requires the _r compiler when gcc isn't being used case "${CC}" in *_r) # ok ... ;; *) CC=${CC}_r ;; esac echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 echo "${ECHO_T}Using $CC for compiling with threads" >&6 fi LIBS="$LIBS -lc" SHLIB_CFLAGS="" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" LD_LIBRARY_PATH_VAR="LIBPATH" # Check to enable 64-bit flags for compiler/linker on AIX 4+ if test "$do64bit" = yes -a "`uname -v`" -gt 3; then if test "$GCC" = yes; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -q64" LDFLAGS_ARCH="-q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" fi fi if test "`uname -m`" = ia64; then # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC SHLIB_LD="/usr/ccs/bin/ld -G -z text" # AIX-5 has dl* in libc.so DL_LIBS="" if test "$GCC" = yes; then CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' else CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' else if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' else SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" fi SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} TCL_NEEDS_EXP_FILE=1 # TEA specific: use PACKAGE_VERSION instead of VERSION TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp' fi # AIX v<=4.1 has some different flags than 4.2+ if test "$system" = "AIX-4.1" -o "`uname -v`" -lt 4; then case $LIBOBJS in "tclLoadAix.$ac_objext" | \ *" tclLoadAix.$ac_objext" | \ "tclLoadAix.$ac_objext "* | \ *" tclLoadAix.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" ;; esac DL_LIBS="-lld" fi # On AIX <=v4 systems, libbsd.a has to be linked in to support # non-blocking file IO. This library has to be linked in after # the MATH_LIBS or it breaks the pow() function. The way to # insure proper sequencing, is to add it to the tail of MATH_LIBS. # This library also supplies gettimeofday. # # AIX does not have a timezone field in struct tm. When the AIX # bsd library is used, the timezone global and the gettimeofday # methods are to be avoided for timezone deduction instead, we # deduce the timezone by comparing the localtime result on a # known GMT value. echo "$as_me:$LINENO: checking for gettimeofday in -lbsd" >&5 echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gettimeofday (); int main () { gettimeofday (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gettimeofday=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gettimeofday=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gettimeofday" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 if test $ac_cv_lib_bsd_gettimeofday = yes; then libbsd=yes else libbsd=no fi if test $libbsd = yes; then MATH_LIBS="$MATH_LIBS -lbsd" cat >>confdefs.h <<\_ACEOF #define USE_DELTA_FOR_TZ 1 _ACEOF fi ;; BeOS*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -nostart' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" #----------------------------------------------------------- # Check for inet_ntoa in -lbind, for BeOS (which also needs # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5 echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6 if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_ntoa (); int main () { inet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bind_inet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bind_inet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6 if test $ac_cv_lib_bind_inet_ntoa = yes; then LIBS="$LIBS -lbind -lsocket" fi ;; BSD/OS-2.1*|BSD/OS-3*) SHLIB_CFLAGS="" SHLIB_LD="shlicc -r" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; BSD/OS-4.*) SHLIB_CFLAGS="-export-dynamic -fPIC" SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; dgux*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; HP-UX-*.11.*) # Use updated header definitions where possible cat >>confdefs.h <<\_ACEOF #define _XOPEN_SOURCE_EXTENDED 1 _ACEOF # TEA specific: Needed by Tcl, but not most extensions #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?]) #LIBS="$LIBS -lxnet" # Use the XOPEN network library if test "`uname -m`" = ia64; then SHLIB_SUFFIX=".so" # Use newer C++ library for C++ extensions #if test "$GCC" != "yes" ; then # CPPFLAGS="-AA" #fi else SHLIB_SUFFIX=".sl" fi echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc #CFLAGS="$CFLAGS +DAportable" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes"; then if test "$GCC" = yes; then case `${CC} -dumpmachine` in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} ;; esac else do64bit_ok=yes CFLAGS="$CFLAGS +DD64" LDFLAGS_ARCH="+DD64" fi fi ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); int main () { shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 if test $ac_cv_lib_dld_shl_load = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS="" DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi ;; IRIX-5.*) SHLIB_CFLAGS="" SHLIB_LD="ld -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi ;; IRIX-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes; then CFLAGS="$CFLAGS -mabi=n32" LDFLAGS="$LDFLAGS -mabi=n32" else case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) CFLAGS="$CFLAGS -n32" ;; esac LDFLAGS="$LDFLAGS -n32" fi ;; IRIX64-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes; then if test "$GCC" = yes; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5 echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} else do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS_ARCH="-64" fi fi ;; Linux*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" # TEA specific: CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings # when you inline the string and math operations. Turn this off to # get rid of the warnings. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}' DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "`uname -m`" = "alpha"; then CFLAGS="$CFLAGS -mieee" fi if test $do64bit = yes; then echo "$as_me:$LINENO: checking if compiler accepts -m64 flag" >&5 echo $ECHO_N "checking if compiler accepts -m64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_m64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_m64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_m64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_m64" >&5 echo "${ECHO_T}$tcl_cv_cc_m64" >&6 if test $tcl_cv_cc_m64 = yes; then CFLAGS="$CFLAGS -m64" do64bit_ok=yes fi fi # The combo of gcc + glibc has a bug related to inlining of # functions like strtod(). The -fno-builtin flag should address # this problem but it does not work. The -fno-inline flag is kind # of overkill but it works. Disable inlining only when one of the # files in compat/*.c is being linked in. if test x"${USE_COMPAT}" != x; then CFLAGS="$CFLAGS -fno-inline" fi ;; GNU*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" SHLIB_LD='${CC} -shared' DL_OBJS="" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" if test "`uname -m`" = "alpha"; then CFLAGS="$CFLAGS -mieee" fi ;; Lynx*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE=-02 SHLIB_LD='${CC} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi ;; MP-RAS-02*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; MP-RAS-*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,-Bexport" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; NetBSD-1.*|FreeBSD-[1-2].*) SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi echo "$as_me:$LINENO: checking for ELF" >&5 echo $ECHO_N "checking for ELF... $ECHO_C" >&6 if test "${tcl_cv_ld_elf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __ELF__ yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then tcl_cv_ld_elf=yes else tcl_cv_ld_elf=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 echo "${ECHO_T}$tcl_cv_ld_elf" >&6 if test $tcl_cv_ld_elf = yes; then SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' else SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' fi # Ancient FreeBSD doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; OpenBSD-*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' echo "$as_me:$LINENO: checking for ELF" >&5 echo $ECHO_N "checking for ELF... $ECHO_C" >&6 if test "${tcl_cv_ld_elf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __ELF__ yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then tcl_cv_ld_elf=yes else tcl_cv_ld_elf=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 echo "${ECHO_T}$tcl_cv_ld_elf" >&6 if test $tcl_cv_ld_elf = yes; then LDFLAGS=-Wl,-export-dynamic else LDFLAGS="" fi # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; NetBSD-*|FreeBSD-*) # FreeBSD 3.* and greater have ELF. # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "${TCL_THREADS}" = "1"; then # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi case $system in FreeBSD-3.*) # FreeBSD-3 doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' TCL_LIB_VERSIONS_OK=nodots ;; esac ;; Darwin-*) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if ($i~/^(isysroot|mmacosx-version-min)/) print "-"$i}'`" CFLAGS="`echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`" if test $do64bit = yes; then case `arch` in ppc) echo "$as_me:$LINENO: checking if compiler accepts -arch ppc64 flag" >&5 echo $ECHO_N "checking if compiler accepts -arch ppc64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_arch_ppc64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_arch_ppc64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_arch_ppc64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_ppc64" >&5 echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6 if test $tcl_cv_cc_arch_ppc64 = yes; then CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes fi ;; i386) echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5 echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_arch_x86_64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_cc_arch_x86_64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_cc_arch_x86_64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_x86_64" >&5 echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6 if test $tcl_cv_cc_arch_x86_64 = yes; then CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes fi ;; *) { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; esac else # Check for combined 32-bit and 64-bit fat build if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then fat_32_64=yes fi fi # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}' echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5 echo $ECHO_N "checking if ld accepts -single_module flag... $ECHO_C" >&6 if test "${tcl_cv_ld_single_module+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_ld_single_module=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_ld_single_module=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi echo "$as_me:$LINENO: result: $tcl_cv_ld_single_module" >&5 echo "${ECHO_T}$tcl_cv_ld_single_module" >&6 if test $tcl_cv_ld_single_module = yes; then SHLIB_LD="${SHLIB_LD} -Wl,-single_module" fi SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: if test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then LDFLAGS="$LDFLAGS -prebind" fi LDFLAGS="$LDFLAGS -headerpad_max_install_names" echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5 echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6 if test "${tcl_cv_ld_search_paths_first+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_ld_search_paths_first=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_ld_search_paths_first=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi echo "$as_me:$LINENO: result: $tcl_cv_ld_search_paths_first" >&5 echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6 if test $tcl_cv_ld_search_paths_first = yes; then LDFLAGS="$LDFLAGS -Wl,-search_paths_first" fi if test "$tcl_cv_cc_visibility_hidden" != yes; then cat >>confdefs.h <<\_ACEOF #define MODULE_SCOPE __private_extern__ _ACEOF fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" # TEA specific: for combined 32 & 64 bit fat builds of Tk # extensions, verify that 64-bit build is possible. if test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"; then if test "${TEA_WINDOWINGSYSTEM}" = x11; then echo "$as_me:$LINENO: checking for 64-bit X11" >&5 echo $ECHO_N "checking for 64-bit X11... $ECHO_C" >&6 if test "${tcl_cv_lib_x11_64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XrmInitialize(); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_lib_x11_64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_lib_x11_64=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi echo "$as_me:$LINENO: result: $tcl_cv_lib_x11_64" >&5 echo "${ECHO_T}$tcl_cv_lib_x11_64" >&6 fi # remove 64-bit arch flags from CFLAGS et al. if configuration # does not support 64-bit. if test "${TEA_WINDOWINGSYSTEM}" = aqua -o "$tcl_cv_lib_x11_64" = no; then { echo "$as_me:$LINENO: Removing 64-bit architectures from compiler & linker flags" >&5 echo "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;} for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done fi fi ;; NEXTSTEP-*) SHLIB_CFLAGS="" SHLIB_LD='${CC} -nostdlib -r' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadNext.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OS/390-*) CFLAGS_OPTIMIZE="" # Optimizer is buggy cat >>confdefs.h <<\_ACEOF #define _OE_SOCKETS 1 _ACEOF ;; OSF1-1.0|OSF1-1.1|OSF1-1.2) # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 SHLIB_CFLAGS="" # Hack: make package name same as library name SHLIB_LD='ld -R -export :' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadOSF.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 SHLIB_CFLAGS="-fPIC" if test "$SHARED_BUILD" = 1; then SHLIB_LD="ld -shared" else SHLIB_LD="ld -non_shared" fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" if test "$SHARED_BUILD" = 1; then SHLIB_LD='ld -shared -expect_unresolved "*"' else SHLIB_LD='ld -non_shared -expect_unresolved "*"' fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes; then CFLAGS="$CFLAGS -mieee" else CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" fi # see pthread_intro(3) for pthread support on osf1, k.furukawa if test "${TCL_THREADS}" = 1; then CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` if test "$GCC" = yes; then LIBS="$LIBS -lpthread -lmach -lexc" else CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi fi ;; QNX-6*) # QNX RTP # This may work for all QNX, but it was only reported for v6. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" # dlopen is in -lc on QNX DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. if test "$GCC" = yes; then SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else SHLIB_CFLAGS="-Kpic -belf" LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SINIX*5.4*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-4*) SHLIB_CFLAGS="-PIC" SHLIB_LD="ld" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # SunOS can't handle version numbers with dots in them in library # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it # requires an extra version number at the end of .so file names. # So, the library has to have a name like libtcl75.so.1.0 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; SunOS-5.[0-6]) # Careful to not let 5.10+ fall into this case # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF SHLIB_CFLAGS="-KPIC" # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else SHLIB_LD="/usr/ccs/bin/ld -G -z text" CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi ;; SunOS-5*) # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF SHLIB_CFLAGS="-KPIC" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes; then arch=`isainfo` if test "$arch" = "sparcv9 sparc"; then if test "$GCC" = yes; then if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -m64 -mcpu=v9" LDFLAGS="$LDFLAGS -m64 -mcpu=v9" SHLIB_CFLAGS="-fPIC" fi else do64bit_ok=yes if test "$do64bitVIS" = yes; then CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" else CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" fi # Solaris 64 uses this as well #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" fi else if test "$arch" = "amd64 i386"; then if test "$GCC" = yes; then { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5 echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -xarch=amd64" LDFLAGS="$LDFLAGS -xarch=amd64" fi else { echo "$as_me:$LINENO: WARNING: 64bit mode not supported for $arch" >&5 echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;} fi fi fi # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "$do64bit_ok" = yes; then # We need to specify -static-libgcc or we need to # add the path to the sparv9 libgcc. # JH: static-libgcc is necessary for core Tcl, but may # not be necessary for extensions. SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc" # for finding sparcv9 libgcc, get the regular libgcc # path, remove so name and append 'sparcv9' #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..." #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir" fi else case $system in SunOS-5.[1-9][0-9]*) SHLIB_LD='${CC} -G -z text';; *) SHLIB_LD='/usr/ccs/bin/ld -G -z text';; esac CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' fi ;; UNIX_SV* | UnixWare-5*) SHLIB_CFLAGS="-KPIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 if test "${tcl_cv_ld_Bexport+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_ld_Bexport=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_ld_Bexport=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5 echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6 if test $tcl_cv_ld_Bexport = yes; then LDFLAGS="$LDFLAGS -Wl,-Bexport" fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac if test "$do64bit" = yes -a "$do64bit_ok" = no; then { echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5 echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;} fi # Step 4: disable dynamic loading if requested via a command-line switch. # Check whether --enable-load or --disable-load was given. if test "${enable_load+set}" = set; then enableval="$enable_load" tcl_ok=$enableval else tcl_ok=yes fi; if test "$tcl_ok" = no; then DL_OBJS="" fi if test "x$DL_OBJS" != x; then BUILD_DLTEST="\$(DLTEST_TARGETS)" else { echo "$as_me:$LINENO: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5 echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;} SHLIB_CFLAGS="" SHLIB_LD="" SHLIB_SUFFIX="" DL_OBJS="tclLoadNone.o" DL_LIBS="" LDFLAGS="$LDFLAGS_ORIG" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" BUILD_DLTEST="" fi LDFLAGS="$LDFLAGS $LDFLAGS_ARCH" # If we're running gcc, then change the C flags for compiling shared # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then case $system in AIX-*) ;; BSD/OS*) ;; IRIX*) ;; NetBSD-*|FreeBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac fi if test "$SHARED_LIB_SUFFIX" = ""; then # TEA specific: use PACKAGE_VERSION instead of VERSION SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}' fi if test "$UNSHARED_LIB_SUFFIX" = ""; then # TEA specific: use PACKAGE_VERSION instead of VERSION UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' fi # These must be called after we do the basic CFLAGS checks and # verify any possible 64-bit or similar switches are necessary echo "$as_me:$LINENO: checking for required early compiler flags" >&5 echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6 tcl_flags="" if test "${tcl_cv_flag__isoc99_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__isoc99_source=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _ISOC99_SOURCE 1 #include int main () { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__isoc99_source=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_flag__isoc99_source=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define _ISOC99_SOURCE 1 _ACEOF tcl_flags="$tcl_flags _ISOC99_SOURCE" fi if test "${tcl_cv_flag__largefile64_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile64_source=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE64_SOURCE 1 #include int main () { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile64_source=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_flag__largefile64_source=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define _LARGEFILE64_SOURCE 1 _ACEOF tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" fi if test "${tcl_cv_flag__largefile_source64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *)open64; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile_source64=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE64 1 #include int main () { char *p = (char *)open64; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_flag__largefile_source64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_flag__largefile_source64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define _LARGEFILE_SOURCE64 1 _ACEOF tcl_flags="$tcl_flags _LARGEFILE_SOURCE64" fi if test "x${tcl_flags}" = "x" ; then echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6 else echo "$as_me:$LINENO: result: ${tcl_flags}" >&5 echo "${ECHO_T}${tcl_flags}" >&6 fi echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 if test "${tcl_cv_type_64bit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { __int64 value = (__int64) 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_type_64bit=__int64 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_type_64bit="long long" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # See if we should use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { switch (0) { case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ; } ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_type_64bit=${tcl_type_64bit} else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "${tcl_cv_type_64bit}" = none ; then cat >>confdefs.h <<\_ACEOF #define TCL_WIDE_INT_IS_LONG 1 _ACEOF echo "$as_me:$LINENO: result: using long" >&5 echo "${ECHO_T}using long" >&6 elif test "${tcl_cv_type_64bit}" = "__int64" \ -a "${TEA_PLATFORM}" = "windows" ; then # TEA specific: We actually want to use the default tcl.h checks in # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* echo "$as_me:$LINENO: result: using Tcl header defaults" >&5 echo "${ECHO_T}using Tcl header defaults" >&6 else cat >>confdefs.h <<_ACEOF #define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} _ACEOF echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5 echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 # Now check for auxiliary declarations echo "$as_me:$LINENO: checking for struct dirent64" >&5 echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 if test "${tcl_cv_struct_dirent64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct dirent64 p; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_struct_dirent64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_struct_dirent64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5 echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_DIRENT64 1 _ACEOF fi echo "$as_me:$LINENO: checking for struct stat64" >&5 echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 if test "${tcl_cv_struct_stat64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct stat64 p; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_struct_stat64=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_struct_stat64=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5 echo "${ECHO_T}$tcl_cv_struct_stat64" >&6 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_STAT64 1 _ACEOF fi for ac_func in open64 lseek64 do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for off64_t" >&5 echo $ECHO_N "checking for off64_t... $ECHO_C" >&6 if test "${tcl_cv_type_off64_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { off64_t offset; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then tcl_cv_type_off64_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 tcl_cv_type_off64_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_TYPE_OFF64_T 1 _ACEOF echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XtMalloc (0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 not_really_there="yes" fi rm -f conftest.err conftest.$ac_ext else if test ! -r $x_includes/X11/Intrinsic.h; then not_really_there="yes" fi fi fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then echo "$as_me:$LINENO: checking for X11 header files" >&5 echo $ECHO_N "checking for X11 header files... $ECHO_C" >&6 found_xincludes="no" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then found_xincludes="yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 found_xincludes="no" fi rm -f conftest.err conftest.$ac_ext if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then echo "$as_me:$LINENO: result: $i" >&5 echo "${ECHO_T}$i" >&6 XINCLUDES=" -I$i" found_xincludes="yes" break fi done fi else if test "$x_includes" != ""; then XINCLUDES="-I$x_includes" found_xincludes="yes" fi fi if test found_xincludes = "no"; then echo "$as_me:$LINENO: result: couldn't find any!" >&5 echo "${ECHO_T}couldn't find any!" >&6 fi if test "$no_x" = yes; then echo "$as_me:$LINENO: checking for X11 libraries" >&5 echo $ECHO_N "checking for X11 libraries... $ECHO_C" >&6 XLIBSW=nope dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" for i in $dirs ; do if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then echo "$as_me:$LINENO: result: $i" >&5 echo "${ECHO_T}$i" >&6 XLIBSW="-L$i -lX11" x_libraries="$i" break fi done else if test "$x_libraries" = ""; then XLIBSW=-lX11 else XLIBSW="-L$x_libraries -lX11" fi fi if test "$XLIBSW" = nope ; then echo "$as_me:$LINENO: checking for XCreateWindow in -lXwindow" >&5 echo $ECHO_N "checking for XCreateWindow in -lXwindow... $ECHO_C" >&6 if test "${ac_cv_lib_Xwindow_XCreateWindow+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXwindow $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XCreateWindow (); int main () { XCreateWindow (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xwindow_XCreateWindow=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xwindow_XCreateWindow=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xwindow_XCreateWindow" >&5 echo "${ECHO_T}$ac_cv_lib_Xwindow_XCreateWindow" >&6 if test $ac_cv_lib_Xwindow_XCreateWindow = yes; then XLIBSW=-lXwindow fi fi if test "$XLIBSW" = nope ; then echo "$as_me:$LINENO: result: could not find any! Using -lX11." >&5 echo "${ECHO_T}could not find any! Using -lX11." >&6 XLIBSW=-lX11 fi # TEA specific: if test x"${XLIBSW}" != x ; then PKG_LIBS="${PKG_LIBS} ${XLIBSW}" fi fi echo "$as_me:$LINENO: checking how to build libraries" >&5 echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6 # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" tcl_ok=$enableval else tcl_ok=yes fi; if test "${enable_shared+set}" = set; then enableval="$enable_shared" tcl_ok=$enableval else tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then echo "$as_me:$LINENO: result: shared" >&5 echo "${ECHO_T}shared" >&6 SHARED_BUILD=1 else echo "$as_me:$LINENO: result: static" >&5 echo "${ECHO_T}static" >&6 SHARED_BUILD=0 cat >>confdefs.h <<\_ACEOF #define STATIC_BUILD 1 _ACEOF fi echo "$as_me:$LINENO: checking for build with symbols" >&5 echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6 # Check whether --enable-symbols or --disable-symbols was given. if test "${enable_symbols+set}" = set; then enableval="$enable_symbols" tcl_ok=$enableval else tcl_ok=no fi; DBGX="" if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 else CFLAGS_DEFAULT="${CFLAGS_DEBUG}" LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" if test "$tcl_ok" = "yes"; then echo "$as_me:$LINENO: result: yes (standard debugging)" >&5 echo "${ECHO_T}yes (standard debugging)" >&6 fi fi # TEA specific: if test "${TEA_PLATFORM}" != "windows" ; then LDFLAGS_DEFAULT="${LDFLAGS}" fi if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then cat >>confdefs.h <<\_ACEOF #define TCL_MEM_DEBUG 1 _ACEOF fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then echo "$as_me:$LINENO: result: enabled symbols mem debugging" >&5 echo "${ECHO_T}enabled symbols mem debugging" >&6 else echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5 echo "${ECHO_T}enabled $tcl_ok debugging" >&6 fi fi cat >>confdefs.h <<\_ACEOF #define USE_TCL_STUBS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define USE_TK_STUBS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define BUILD_tile 1 _ACEOF #@ _TEAX_CHECK_MSVC if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then USING_MSVC="yes" else USING_MSVC="no" fi; #@ TEAX_CONFIG_LDFLAGS if test "${USING_MSVC}" = "yes"; then SHLIB_LD_OUT="/out:" STLIB_LD_OUT="/out:" STLIB_SUFFIX=".lib" LIB_PREFIX="" else SHLIB_LD_OUT="-o " STLIB_LD_OUT=" " STLIB_SUFFIX=".a" LIB_PREFIX="lib" fi #@TEAX_FIX_LIB_SPECS if test "${USING_MSVC}" = "yes"; then TCL_STUB_LIB_SPEC="$TCL_STUB_LIB_PATH" TK_STUB_LIB_SPEC="$TK_STUB_LIB_PATH" # tclConfig.sh doesn't define TCL_LIB_SPEC, but if it did, # it would be as follows: eval TCL_LIB_SPEC="${TCL_EXEC_PREFIX}/lib/$TCL_LIB_FILE" # Same for TK_LIB_SPEC: eval TK_LIB_SPEC="${TK_EXEC_PREFIX}/lib/$TK_LIB_FILE" fi #@ TEAX_EXPAND_CFLAGS CFLAGS="${CFLAGS} ${CFLAGS_DEFAULT} ${CFLAGS_WARNING}" if test "${SHARED_BUILD}" = "1" ; then CFLAGS="${CFLAGS} ${SHLIB_CFLAGS}" fi # Platform-specific stuff: # NB: With -DNO_PRIVATE_HEADERS, we need to link against libtk # in addition to libtkstub, at least on Windows. We can get away # without doing this on Unix. # case "${TEA_WINDOWINGSYSTEM}" in win32) PLATFORM_OBJS='$(WIN_OBJS)' PKG_LIBS="${PKG_LIBS}" if test ${have_private_headers} = "no" ; then vars="$TK_LIB_SPEC" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done fi vars="user32.lib gdi32.lib" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done echo "$as_me:$LINENO: checking for uxtheme.h" >&5 echo $ECHO_N "checking for uxtheme.h... $ECHO_C" >&6 if test "${ac_cv_header_uxtheme_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_uxtheme_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_uxtheme_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_uxtheme_h" >&5 echo "${ECHO_T}$ac_cv_header_uxtheme_h" >&6 if test $ac_cv_header_uxtheme_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_UXTHEME_H 1 _ACEOF else { echo "$as_me:$LINENO: xpnative theme will be unavailable" >&5 echo "$as_me: xpnative theme will be unavailable" >&6;} fi ;; aqua) PLATFORM_OBJS='$(MAC_OBJS)' ; # Ignore autoconf warning, it's bogus PKG_LIBS="${PKG_LIBS} -framework Carbon" ;; x11) PLATFORM_OBJS='$(X11_OBJS)' ;; esac; #-------------------------------------------------------------------- ac_config_files="$ac_config_files Makefile pkgIndex.tcl" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS="" : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by tile $as_me 0.8.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ tile config.status 0.8.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "pkgIndex.tcl" ) CONFIG_FILES="$CONFIG_FILES pkgIndex.tcl" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CYGPATH@,$CYGPATH,;t t s,@EXEEXT@,$EXEEXT,;t t s,@PKG_LIB_FILE@,$PKG_LIB_FILE,;t t s,@PKG_STUB_LIB_FILE@,$PKG_STUB_LIB_FILE,;t t s,@PKG_STUB_SOURCES@,$PKG_STUB_SOURCES,;t t s,@PKG_STUB_OBJECTS@,$PKG_STUB_OBJECTS,;t t s,@PKG_TCL_SOURCES@,$PKG_TCL_SOURCES,;t t s,@PKG_HEADERS@,$PKG_HEADERS,;t t s,@PKG_INCLUDES@,$PKG_INCLUDES,;t t s,@PKG_LIBS@,$PKG_LIBS,;t t s,@PKG_CFLAGS@,$PKG_CFLAGS,;t t s,@TCL_VERSION@,$TCL_VERSION,;t t s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t s,@TCL_LIBS@,$TCL_LIBS,;t t s,@TCL_DEFS@,$TCL_DEFS,;t t s,@TCL_EXTRA_CFLAGS@,$TCL_EXTRA_CFLAGS,;t t s,@TCL_LD_FLAGS@,$TCL_LD_FLAGS,;t t s,@TCL_SHLIB_LD_LIBS@,$TCL_SHLIB_LD_LIBS,;t t s,@TK_VERSION@,$TK_VERSION,;t t s,@TK_BIN_DIR@,$TK_BIN_DIR,;t t s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t s,@TK_LIB_FILE@,$TK_LIB_FILE,;t t s,@TK_LIB_FLAG@,$TK_LIB_FLAG,;t t s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;t t s,@TK_STUB_LIB_FILE@,$TK_STUB_LIB_FILE,;t t s,@TK_STUB_LIB_FLAG@,$TK_STUB_LIB_FLAG,;t t s,@TK_STUB_LIB_SPEC@,$TK_STUB_LIB_SPEC,;t t s,@TK_LIBS@,$TK_LIBS,;t t s,@TK_XINCLUDES@,$TK_XINCLUDES,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@OBJEXT@,$OBJEXT,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@TCL_TOP_DIR_NATIVE@,$TCL_TOP_DIR_NATIVE,;t t s,@TCL_GENERIC_DIR_NATIVE@,$TCL_GENERIC_DIR_NATIVE,;t t s,@TCL_UNIX_DIR_NATIVE@,$TCL_UNIX_DIR_NATIVE,;t t s,@TCL_WIN_DIR_NATIVE@,$TCL_WIN_DIR_NATIVE,;t t s,@TCL_BMAP_DIR_NATIVE@,$TCL_BMAP_DIR_NATIVE,;t t s,@TCL_TOOL_DIR_NATIVE@,$TCL_TOOL_DIR_NATIVE,;t t s,@TCL_PLATFORM_DIR_NATIVE@,$TCL_PLATFORM_DIR_NATIVE,;t t s,@TCL_INCLUDES@,$TCL_INCLUDES,;t t s,@TK_TOP_DIR_NATIVE@,$TK_TOP_DIR_NATIVE,;t t s,@TK_UNIX_DIR_NATIVE@,$TK_UNIX_DIR_NATIVE,;t t s,@TK_WIN_DIR_NATIVE@,$TK_WIN_DIR_NATIVE,;t t s,@TK_GENERIC_DIR_NATIVE@,$TK_GENERIC_DIR_NATIVE,;t t s,@TK_XLIB_DIR_NATIVE@,$TK_XLIB_DIR_NATIVE,;t t s,@TK_PLATFORM_DIR_NATIVE@,$TK_PLATFORM_DIR_NATIVE,;t t s,@TK_INCLUDES@,$TK_INCLUDES,;t t s,@TCLSH_PROG@,$TCLSH_PROG,;t t s,@WISH_PROG@,$WISH_PROG,;t t s,@AR@,$AR,;t t s,@CELIB_DIR@,$CELIB_DIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@DL_LIBS@,$DL_LIBS,;t t s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t s,@STLIB_LD@,$STLIB_LD,;t t s,@SHLIB_LD@,$SHLIB_LD,;t t s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t s,@SHARED_BUILD@,$SHARED_BUILD,;t t s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t s,@TCL_DBGX@,$TCL_DBGX,;t t s,@SHLIB_LD_OUT@,$SHLIB_LD_OUT,;t t s,@STLIB_LD_OUT@,$STLIB_LD_OUT,;t t s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t s,@STLIB_SUFFIX@,$STLIB_SUFFIX,;t t s,@LIB_PREFIX@,$LIB_PREFIX,;t t s,@PLATFORM_OBJS@,$PLATFORM_OBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi #*EOF* tile-0.8.2/generic/configure.in0000644000076500007650000000433610731266207016003 0ustar joejoe00000000000000# # configure.in,v 1.51 2007/12/16 18:20:55 jenglish Exp # builtin(include, ../tclconfig/tcl.m4) builtin(include, ../tclconfig/teax.m4) AC_INIT([tile],[0.8.2]) AC_CONFIG_AUX_DIR(../tclconfig) AC_REVISION(1.51) # Usual Tcl stuff: # TEA_INIT([3.6]) TEA_PATH_TCLCONFIG TEA_LOAD_TCLCONFIG TEA_PATH_TKCONFIG TEA_LOAD_TKCONFIG TEA_PREFIX dnl dnl Alternative to TEA_SETUP_COMPILER: dnl (TEA_SETUP_COMPILER is for building Tcl itself) dnl AC_PROG_CC AC_PROG_INSTALL AC_PROG_RANLIB AC_OBJEXT AC_ARG_ENABLE([private-headers], AC_HELP_STRING( [--disable-private-headers], [Disable if private headers are unavailable]), [have_private_headers=$enableval], [have_private_headers=yes]) AC_MSG_CHECKING([Did you ask for private headers?]) AC_MSG_RESULT(${have_private_headers}) if test ${have_private_headers} = "yes" ; then TEA_MISSING_POSIX_HEADERS TEA_PRIVATE_TCL_HEADERS TEA_PRIVATE_TK_HEADERS else TEA_PUBLIC_TCL_HEADERS TEA_PUBLIC_TK_HEADERS AC_DEFINE(NO_PRIVATE_HEADERS) fi TEA_PROG_TCLSH TEA_PROG_WISH # Build stuff: # TEA_CONFIG_CFLAGS TEA_PATH_X dnl TEA_ENABLE_THREADS TEA_ENABLE_SHARED TEA_ENABLE_SYMBOLS AC_DEFINE(USE_TCL_STUBS,1,[Use Tcl stub library]) AC_DEFINE(USE_TK_STUBS,1,[Use Tk stub library]) AC_DEFINE(BUILD_tile,1,[Source for tile package]) TEAX_CONFIG_LDFLAGS TEAX_FIX_LIB_SPECS TEAX_EXPAND_CFLAGS # Platform-specific stuff: # NB: With -DNO_PRIVATE_HEADERS, we need to link against libtk # in addition to libtkstub, at least on Windows. We can get away # without doing this on Unix. # case "${TEA_WINDOWINGSYSTEM}" in win32) PLATFORM_OBJS='$(WIN_OBJS)' PKG_LIBS="${PKG_LIBS}" if test ${have_private_headers} = "no" ; then TEA_ADD_LIBS($TK_LIB_SPEC) fi TEA_ADD_LIBS([user32.lib gdi32.lib]) AC_CHECK_HEADER([uxtheme.h], [AC_DEFINE(HAVE_UXTHEME_H,1,[XP uxtheme.h available])], [AC_MSG_NOTICE([xpnative theme will be unavailable])], [#include ]) ;; aqua) PLATFORM_OBJS='$(MAC_OBJS)' ; # Ignore autoconf warning, it's bogus PKG_LIBS="${PKG_LIBS} -framework Carbon" ;; x11) PLATFORM_OBJS='$(X11_OBJS)' ;; esac; AC_SUBST(PLATFORM_OBJS) #-------------------------------------------------------------------- AC_CONFIG_FILES([Makefile pkgIndex.tcl]) AC_OUTPUT #*EOF* tile-0.8.2/generic/entry.c0000644000076500007650000015575610623417671015017 0ustar joejoe00000000000000/* * entry.c,v 1.46 2007/05/18 21:50:49 jenglish Exp * * DERIVED FROM: tk/generic/tkEntry.c r1.35. * * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 2000 Ajuba Solutions. * Copyright (c) 2002 ActiveState Corporation. * Copyright (c) 2004 Joe English */ #include #include #include #include "tkTheme.h" #include "widget.h" /* * Extra bits for core.flags: */ #define GOT_SELECTION (WIDGET_USER_FLAG<<1) #define SYNCING_VARIABLE (WIDGET_USER_FLAG<<2) #define VALIDATING (WIDGET_USER_FLAG<<3) #define VALIDATION_SET_VALUE (WIDGET_USER_FLAG<<4) /* * Definitions for -validate option values: */ typedef enum validateMode { VMODE_ALL, VMODE_KEY, VMODE_FOCUS, VMODE_FOCUSIN, VMODE_FOCUSOUT, VMODE_NONE } VMODE; static const char *validateStrings[] = { "all", "key", "focus", "focusin", "focusout", "none", NULL }; /* * Validation reasons: */ typedef enum validateReason { VALIDATE_INSERT, VALIDATE_DELETE, VALIDATE_FOCUSIN, VALIDATE_FOCUSOUT, VALIDATE_FORCED } VREASON; static const char *validateReasonStrings[] = { "key", "key", "focusin", "focusout", "forced", NULL }; /*------------------------------------------------------------------------ * +++ Entry widget record. * * Dependencies: * * textVariableTrace : textVariableObj * * numBytes,numChars : string * displayString : numChars, showChar * layoutHeight, * layoutWidth, * textLayout : fontObj, displayString * layoutX, layoutY : textLayout, justify, xscroll.first * * Invariants: * * 0 <= insertPos <= numChars * 0 <= selectFirst < selectLast <= numChars || selectFirst == selectLast == -1 * displayString points to string if showChar == NULL, * or to malloc'ed storage if showChar != NULL. */ /* Style parameters: */ typedef struct { Tcl_Obj *foregroundObj; /* Foreground color for normal text */ Tcl_Obj *backgroundObj; /* Entry widget background color */ Tcl_Obj *selBorderObj; /* Border and background for selection */ Tcl_Obj *selBorderWidthObj; /* Width of selection border */ Tcl_Obj *selForegroundObj; /* Foreground color for selected text */ Tcl_Obj *insertColorObj; /* Color of insertion cursor */ Tcl_Obj *insertWidthObj; /* Insert cursor width */ } EntryStyleData; typedef struct { /* * Internal state: */ char *string; /* Storage for string (malloced) */ int numBytes; /* Length of string in bytes. */ int numChars; /* Length of string in characters. */ int insertPos; /* Insert index */ int selectFirst; /* Index of start of selection, or -1 */ int selectLast; /* Index of end of selection, or -1 */ Scrollable xscroll; /* Current scroll position */ ScrollHandle xscrollHandle; /* * Options managed by Tk_SetOptions: */ Tcl_Obj *textVariableObj; /* Name of linked variable */ int exportSelection; /* Tie internal selection to X selection? */ VMODE validate; /* Validation mode */ char *validateCmd; /* Validation script template */ char *invalidCmd; /* Invalid callback script template */ char *showChar; /* Used to derive displayString */ Tcl_Obj *fontObj; /* Text font to use */ Tcl_Obj *widthObj; /* Desired width of window (in avgchars) */ Tk_Justify justify; /* Text justification */ EntryStyleData styleData; /* Display style data (widget options) */ EntryStyleData styleDefaults;/* Style defaults (fallback values) */ Tcl_Obj *stateObj; /* Compatibility option -- see CheckStateObj */ /* * Derived resources: */ Ttk_TraceHandle *textVariableTrace; char *displayString; /* String to use when displaying */ Tk_TextLayout textLayout; /* Cached text layout information. */ int layoutWidth; /* textLayout width */ int layoutHeight; /* textLayout height */ int layoutX, layoutY; /* Origin for text layout. */ } EntryPart; typedef struct { WidgetCore core; EntryPart entry; } Entry; /* * Extra mask bits for Tk_SetOptions() */ #define STATE_CHANGED (0x100) /* -state option changed */ #define TEXTVAR_CHANGED (0x200) /* -textvariable option changed */ #define SCROLLCMD_CHANGED (0x400) /* -xscrollcommand option changed */ /* * Default option values: */ #define DEF_SELECT_BG "#000000" #define DEF_SELECT_FG "#ffffff" #define DEF_INSERT_BG "black" #define DEF_ENTRY_WIDTH "20" #define DEF_ENTRY_FONT "TkTextFont" #define DEF_LIST_HEIGHT "10" static Tk_OptionSpec EntryOptionSpecs[] = { WIDGET_TAKES_FOCUS, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", "1", -1, Tk_Offset(Entry, entry.exportSelection), 0,0,0 }, {TK_OPTION_FONT, "-font", "font", "Font", DEF_ENTRY_FONT, Tk_Offset(Entry, entry.fontObj),-1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", NULL, -1, Tk_Offset(Entry, entry.invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", -1, Tk_Offset(Entry, entry.justify), 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-show", "show", "Show", NULL, -1, Tk_Offset(Entry, entry.showChar), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-state", "state", "State", "normal", Tk_Offset(Entry, entry.stateObj), -1, 0,0,STATE_CHANGED}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", NULL, Tk_Offset(Entry, entry.textVariableObj), -1, TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED}, {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate", "none", -1, Tk_Offset(Entry, entry.validate), 0, (ClientData) validateStrings, 0}, {TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand", NULL, -1, Tk_Offset(Entry, entry.validateCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-width", "width", "Width", DEF_ENTRY_WIDTH, Tk_Offset(Entry, entry.widthObj), -1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", NULL, -1, Tk_Offset(Entry, entry.xscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, /* EntryStyleData options: */ {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", NULL, Tk_Offset(Entry, entry.styleData.foregroundObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor", NULL, Tk_Offset(Entry, entry.styleData.backgroundObj), -1, TK_OPTION_NULL_OK,0,0}, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ EntryStyleData management. * This is still more awkward than it should be; * it should be able to use the Element API instead. */ /* EntryInitStyleDefaults -- * Initialize EntryStyleData record to fallback values. */ static void EntryInitStyleDefaults(EntryStyleData *es) { #define INIT(member, value) \ es->member = Tcl_NewStringObj(value, -1); \ Tcl_IncrRefCount(es->member); INIT(foregroundObj, DEFAULT_FOREGROUND) INIT(selBorderObj, DEF_SELECT_BG) INIT(selForegroundObj, DEF_SELECT_FG) INIT(insertColorObj, DEFAULT_FOREGROUND) INIT(selBorderWidthObj, "0") INIT(insertWidthObj, "1") #undef INIT } static void EntryFreeStyleDefaults(EntryStyleData *es) { Tcl_DecrRefCount(es->foregroundObj); Tcl_DecrRefCount(es->selBorderObj); Tcl_DecrRefCount(es->selForegroundObj); Tcl_DecrRefCount(es->insertColorObj); Tcl_DecrRefCount(es->selBorderWidthObj); Tcl_DecrRefCount(es->insertWidthObj); } /* * EntryInitStyleData -- * Look up style-specific data for an entry widget. */ static void EntryInitStyleData(Entry *entryPtr, EntryStyleData *es) { Ttk_State state = entryPtr->core.state; Ttk_ResourceCache cache = Ttk_GetResourceCache(entryPtr->core.interp); Tk_Window tkwin = entryPtr->core.tkwin; Tcl_Obj *tmp; /* Initialize to fallback values: */ *es = entryPtr->entry.styleDefaults; # define INIT(member, name) \ if ((tmp=Ttk_QueryOption(entryPtr->core.layout,name,state))) \ es->member=tmp; INIT(foregroundObj, "-foreground"); INIT(selBorderObj, "-selectbackground") INIT(selBorderWidthObj, "-selectborderwidth") INIT(selForegroundObj, "-selectforeground") INIT(insertColorObj, "-insertcolor") INIT(insertWidthObj, "-insertwidth") #undef INIT /* Reacquire color & border resources from resource cache. */ es->foregroundObj = Ttk_UseColor(cache, tkwin, es->foregroundObj); es->selForegroundObj = Ttk_UseColor(cache, tkwin, es->selForegroundObj); es->insertColorObj = Ttk_UseColor(cache, tkwin, es->insertColorObj); es->selBorderObj = Ttk_UseBorder(cache, tkwin, es->selBorderObj); } /*------------------------------------------------------------------------ * +++ Resource management. */ /* EntryDisplayString -- * Return a malloc'ed string consisting of 'numChars' copies * of (the first character in the string) 'showChar'. * Used to compute the displayString if -show is non-NULL. */ static char *EntryDisplayString(const char *showChar, int numChars) { char *displayString, *p; int size; Tcl_UniChar ch; char buf[TCL_UTF_MAX]; Tcl_UtfToUniChar(showChar, &ch); size = Tcl_UniCharToUtf(ch, buf); p = displayString = ckalloc(numChars * size + 1); while (numChars--) { p += Tcl_UniCharToUtf(ch, p); } *p = '\0'; return displayString; } /* EntryUpdateTextLayout -- * Recompute textLayout, layoutWidth, and layoutHeight * from displayString and fontObj. */ static void EntryUpdateTextLayout(Entry *entryPtr) { Tk_FreeTextLayout(entryPtr->entry.textLayout); entryPtr->entry.textLayout = Tk_ComputeTextLayout( Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj), entryPtr->entry.displayString, entryPtr->entry.numChars, 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES, &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight); } /* EntryEditable -- * Returns 1 if the entry widget accepts user changes, 0 otherwise */ static int EntryEditable(Entry *entryPtr) { return !(entryPtr->core.state & (TTK_STATE_DISABLED|TTK_STATE_READONLY)); } /*------------------------------------------------------------------------ * +++ Selection management. */ /* EntryFetchSelection -- * Selection handler for entry widgets. */ static int EntryFetchSelection( ClientData clientData, int offset, char *buffer, int maxBytes) { Entry *entryPtr = (Entry *) clientData; size_t byteCount; const char *string; const char *selStart, *selEnd; if (entryPtr->entry.selectFirst < 0 || !entryPtr->entry.exportSelection) { return -1; } string = entryPtr->entry.displayString; selStart = Tcl_UtfAtIndex(string, entryPtr->entry.selectFirst); selEnd = Tcl_UtfAtIndex(selStart, entryPtr->entry.selectLast - entryPtr->entry.selectFirst); byteCount = selEnd - selStart - offset; if (byteCount > (size_t)maxBytes) { /* @@@POSSIBLE BUG: Can transfer partial UTF-8 sequences. Is this OK? */ byteCount = maxBytes; } if (byteCount <= 0) { return 0; } memcpy(buffer, selStart + offset, byteCount); buffer[byteCount] = '\0'; return byteCount; } /* EntryLostSelection -- * Tk_LostSelProc for Entry widgets; called when an entry * loses ownership of the selection. */ static void EntryLostSelection(ClientData clientData) { Entry *entryPtr = (Entry *) clientData; entryPtr->core.flags &= ~GOT_SELECTION; entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1; TtkRedisplayWidget(&entryPtr->core); } /* EntryOwnSelection -- * Assert ownership of the PRIMARY selection, * if -exportselection set and selection is present. */ static void EntryOwnSelection(Entry *entryPtr) { if (entryPtr->entry.exportSelection && !(entryPtr->core.flags & GOT_SELECTION)) { Tk_OwnSelection(entryPtr->core.tkwin, XA_PRIMARY, EntryLostSelection, (ClientData) entryPtr); entryPtr->core.flags |= GOT_SELECTION; } } /*------------------------------------------------------------------------ * +++ Validation. */ /* ExpandPercents -- * Expand an entry validation script template (-validatecommand * or -invalidcommand). */ static void ExpandPercents( Entry *entryPtr, /* Entry that needs validation. */ const char *template, /* Script template */ const char *new, /* Potential new value of entry string */ int index, /* index of insert/delete */ int count, /* #changed characters */ VREASON reason, /* Reason for change */ Tcl_DString *dsPtr) /* Result of %-substitutions */ { int spaceNeeded, cvtFlags; int number, length; const char *string; int stringLength; Tcl_UniChar ch; char numStorage[2*TCL_INTEGER_SPACE]; while (*template) { /* Find everything up to the next % character and append it * to the result string. */ string = Tcl_UtfFindFirst(template, '%'); if (string == NULL) { /* No more %-sequences to expand. * Copy the rest of the template. */ Tcl_DStringAppend(dsPtr, template, -1); return; } if (string != template) { Tcl_DStringAppend(dsPtr, template, string - template); template = string; } /* There's a percent sequence here. Process it. */ ++template; /* skip over % */ if (*template != '\0') { template += Tcl_UtfToUniChar(template, &ch); } else { ch = '%'; } stringLength = -1; switch (ch) { case 'd': /* Type of call that caused validation */ if (reason == VALIDATE_INSERT) { number = 1; } else if (reason == VALIDATE_DELETE) { number = 0; } else { number = -1; } sprintf(numStorage, "%d", number); string = numStorage; break; case 'i': /* index of insert/delete */ sprintf(numStorage, "%d", index); string = numStorage; break; case 'P': /* 'Peeked' new value of the string */ string = new; break; case 's': /* Current string value */ string = entryPtr->entry.string; break; case 'S': /* string to be inserted/deleted, if any */ if (reason == VALIDATE_INSERT) { string = Tcl_UtfAtIndex(new, index); stringLength = Tcl_UtfAtIndex(string, count) - string; } else if (reason == VALIDATE_DELETE) { string = Tcl_UtfAtIndex(entryPtr->entry.string, index); stringLength = Tcl_UtfAtIndex(string, count) - string; } else { string = ""; stringLength = 0; } break; case 'v': /* type of validation currently set */ string = validateStrings[entryPtr->entry.validate]; break; case 'V': /* type of validation in effect */ string = validateReasonStrings[reason]; break; case 'W': /* widget name */ string = Tk_PathName(entryPtr->core.tkwin); break; default: length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; } spaceNeeded = Tcl_ScanCountedElement(string, stringLength, &cvtFlags); length = Tcl_DStringLength(dsPtr); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); spaceNeeded = Tcl_ConvertCountedElement(string, stringLength, Tcl_DStringValue(dsPtr) + length, cvtFlags | TCL_DONT_USE_BRACES); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); } } /* RunValidationScript -- * Build and evaluate an entry validation script. * If the script raises an error, disable validation * by setting '-validate none' */ static int RunValidationScript( Tcl_Interp *interp, /* Interpreter to use */ Entry *entryPtr, /* Entry being validated */ const char *template, /* Script template */ const char *optionName, /* "-validatecommand", "-invalidcommand" */ const char *new, /* Potential new value of entry string */ int index, /* index of insert/delete */ int count, /* #changed characters */ VREASON reason) /* Reason for change */ { Tcl_DString script; int code; Tcl_DStringInit(&script); ExpandPercents(entryPtr, template, new, index, count, reason, &script); code = Tcl_EvalEx(interp, Tcl_DStringValue(&script), Tcl_DStringLength(&script), TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); Tcl_DStringFree(&script); if (WidgetDestroyed(&entryPtr->core)) return TCL_ERROR; if (code != TCL_OK && code != TCL_RETURN) { Tcl_AddErrorInfo(interp, "\n\t(in "); Tcl_AddErrorInfo(interp, optionName); Tcl_AddErrorInfo(interp, " validation command executed by "); Tcl_AddErrorInfo(interp, Tk_PathName(entryPtr->core.tkwin)); Tcl_AddErrorInfo(interp, ")"); entryPtr->entry.validate = VMODE_NONE; return TCL_ERROR; } return TCL_OK; } /* EntryNeedsValidation -- * Determine whether the specified VREASON should trigger validation * in the current VMODE. */ static int EntryNeedsValidation(VMODE vmode, VREASON reason) { return (reason == VALIDATE_FORCED) || (vmode == VMODE_ALL) || (reason == VALIDATE_FOCUSIN && (vmode == VMODE_FOCUSIN || vmode == VMODE_FOCUS)) || (reason == VALIDATE_FOCUSOUT && (vmode == VMODE_FOCUSOUT || vmode == VMODE_FOCUS)) || (reason == VALIDATE_INSERT && vmode == VMODE_KEY) || (reason == VALIDATE_DELETE && vmode == VMODE_KEY) ; } /* EntryValidateChange -- * Validate a proposed change to the entry widget's value if required. * Call the -invalidcommand if validation fails. * * Returns: * TCL_OK if the change is accepted * TCL_BREAK if the change is rejected * TCL_ERROR if any errors occured * * The change will be rejected if -validatecommand returns 0, * or if -validatecommand or -invalidcommand modifies the value. */ static int EntryValidateChange( Entry *entryPtr, /* Entry that needs validation. */ const char *newValue, /* Potential new value of entry string */ int index, /* index of insert/delete, -1 otherwise */ int count, /* #changed characters */ VREASON reason) /* Reason for change */ { Tcl_Interp *interp = entryPtr->core.interp; VMODE vmode = entryPtr->entry.validate; int code, change_ok; if ( (entryPtr->entry.validateCmd == NULL) || (entryPtr->core.flags & VALIDATING) || !EntryNeedsValidation(vmode, reason) ) { return TCL_OK; } entryPtr->core.flags |= VALIDATING; /* Run -validatecommand and check return value: */ code = RunValidationScript(interp, entryPtr, entryPtr->entry.validateCmd, "-validatecommand", newValue, index, count, reason); if (code != TCL_OK) { goto done; } code = Tcl_GetBooleanFromObj(interp,Tcl_GetObjResult(interp), &change_ok); if (code != TCL_OK) { entryPtr->entry.validate = VMODE_NONE; /* Disable validation */ Tcl_AddErrorInfo(interp, "\n(validation command did not return valid boolean)"); goto done; } /* Run the -invalidcommand if validation failed: */ if (!change_ok && entryPtr->entry.invalidCmd != NULL) { code = RunValidationScript(interp, entryPtr, entryPtr->entry.invalidCmd, "-invalidcommand", newValue, index, count, reason); if (code != TCL_OK) { goto done; } } /* Reject the pending change if validation failed * or if a validation script changed the value. */ if (!change_ok || (entryPtr->core.flags & VALIDATION_SET_VALUE)) { code = TCL_BREAK; } done: entryPtr->core.flags &= ~(VALIDATING|VALIDATION_SET_VALUE); return code; } /* EntryRevalidate -- * Revalidate the current value of an entry widget, * update the TTK_STATE_INVALID bit. * * Returns: * TCL_OK if valid, TCL_BREAK if invalid, TCL_ERROR on error. */ static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason) { int code = EntryValidateChange( entryPtr, entryPtr->entry.string, -1,0, reason); if (code == TCL_BREAK) { TtkWidgetChangeState(&entryPtr->core, TTK_STATE_INVALID, 0); } else if (code == TCL_OK) { TtkWidgetChangeState(&entryPtr->core, 0, TTK_STATE_INVALID); } return code; } /* EntryRevalidateBG -- * Revalidate in the background (called from event handler). */ static void EntryRevalidateBG(Entry *entryPtr, VREASON reason) { Tcl_Interp *interp = entryPtr->core.interp; if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) { Tcl_BackgroundError(interp); } } /*------------------------------------------------------------------------ * +++ Entry widget modification. */ /* AdjustIndex -- * Adjust index to account for insertion (nChars > 0) * or deletion (nChars < 0) at specified index. */ static int AdjustIndex(int i0, int index, int nChars) { if (i0 >= index) { i0 += nChars; if (i0 < index) { /* index was inside deleted range */ i0 = index; } } return i0; } /* AdjustIndices -- * Adjust all internal entry indexes to account for change. * Note that insertPos, and selectFirst have "right gravity", * while leftIndex (=xscroll.first) and selectLast have "left gravity". */ static void AdjustIndices(Entry *entryPtr, int index, int nChars) { EntryPart *e = &entryPtr->entry; int g = nChars > 0; /* left gravity adjustment */ e->insertPos = AdjustIndex(e->insertPos, index, nChars); e->selectFirst = AdjustIndex(e->selectFirst, index, nChars); e->selectLast = AdjustIndex(e->selectLast, index+g, nChars); e->xscroll.first= AdjustIndex(e->xscroll.first, index+g, nChars); if (e->selectLast <= e->selectFirst) e->selectFirst = e->selectLast = -1; } /* EntryStoreValue -- * Replace the contents of a text entry with a given value, * recompute dependent resources, and schedule a redisplay. * * See also: EntrySetValue(). */ static void EntryStoreValue(Entry *entryPtr, const char *value) { size_t numBytes = strlen(value); int numChars = Tcl_NumUtfChars(value, numBytes); if (entryPtr->core.flags & VALIDATING) entryPtr->core.flags |= VALIDATION_SET_VALUE; /* Make sure all indices remain in bounds: */ if (numChars < entryPtr->entry.numChars) AdjustIndices(entryPtr, numChars, numChars - entryPtr->entry.numChars); /* Free old value: */ if (entryPtr->entry.displayString != entryPtr->entry.string) ckfree(entryPtr->entry.displayString); ckfree(entryPtr->entry.string); /* Store new value: */ entryPtr->entry.string = ckalloc(numBytes + 1); strcpy(entryPtr->entry.string, value); entryPtr->entry.numBytes = numBytes; entryPtr->entry.numChars = numChars; entryPtr->entry.displayString = entryPtr->entry.showChar ? EntryDisplayString(entryPtr->entry.showChar, numChars) : entryPtr->entry.string ; /* Update layout, schedule redisplay: */ EntryUpdateTextLayout(entryPtr); TtkRedisplayWidget(&entryPtr->core); } /* EntrySetValue -- * Stores a new value in the entry widget and updates the * linked -textvariable, if any. The write trace on the * text variable is temporarily disabled; however, other * write traces may change the value of the variable. * If so, the widget is updated again with the new value. * * Returns: * TCL_OK if successful, TCL_ERROR otherwise. */ static int EntrySetValue(Entry *entryPtr, const char *value) { EntryStoreValue(entryPtr, value); if (entryPtr->entry.textVariableObj) { const char *textVarName = Tcl_GetString(entryPtr->entry.textVariableObj); if (textVarName && *textVarName) { entryPtr->core.flags |= SYNCING_VARIABLE; value = Tcl_SetVar(entryPtr->core.interp, textVarName, value, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG); entryPtr->core.flags &= ~SYNCING_VARIABLE; if (!value || WidgetDestroyed(&entryPtr->core)) { return TCL_ERROR; } else if (strcmp(value, entryPtr->entry.string) != 0) { /* Some write trace has changed the variable value. */ EntryStoreValue(entryPtr, value); } } } return TCL_OK; } /* EntryTextVariableTrace -- * Variable trace procedure for entry -textvariable */ static void EntryTextVariableTrace(void *recordPtr, const char *value) { Entry *entryPtr = recordPtr; if (WidgetDestroyed(&entryPtr->core)) { return; } if (entryPtr->core.flags & SYNCING_VARIABLE) { /* Trace was fired due to Tcl_SetVar call in EntrySetValue. * Don't do anything. */ return; } EntryStoreValue(entryPtr, value ? value : ""); } /*------------------------------------------------------------------------ * +++ Insertion and deletion. */ /* InsertChars -- * Add new characters to an entry widget. */ static int InsertChars( Entry *entryPtr, /* Entry that is to get the new elements. */ int index, /* Insert before this index */ const char *value) /* New characters to add */ { char *string = entryPtr->entry.string; size_t byteIndex = Tcl_UtfAtIndex(string, index) - string; size_t byteCount = strlen(value); int charsAdded = Tcl_NumUtfChars(value, byteCount); size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1; char *new; int code; if (byteCount == 0) { return TCL_OK; } new = ckalloc(newByteCount); memcpy(new, string, byteIndex); strcpy(new + byteIndex, value); strcpy(new + byteIndex + byteCount, string + byteIndex); code = EntryValidateChange( entryPtr, new, index, charsAdded, VALIDATE_INSERT); if (code == TCL_OK) { AdjustIndices(entryPtr, index, charsAdded); code = EntrySetValue(entryPtr, new); } else if (code == TCL_BREAK) { code = TCL_OK; } ckfree(new); return code; } /* DeleteChars -- * Remove one or more characters from an entry widget. */ static int DeleteChars( Entry *entryPtr, /* Entry widget to modify. */ int index, /* Index of first character to delete. */ int count) /* How many characters to delete. */ { char *string = entryPtr->entry.string; size_t byteIndex, byteCount, newByteCount; char *new; int code; if (index < 0) { index = 0; } if (count > entryPtr->entry.numChars - index) { count = entryPtr->entry.numChars - index; } if (count <= 0) { return TCL_OK; } byteIndex = Tcl_UtfAtIndex(string, index) - string; byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->entry.numBytes + 1 - byteCount; new = ckalloc(newByteCount); memcpy(new, string, byteIndex); strcpy(new + byteIndex, string + byteIndex + byteCount); code = EntryValidateChange( entryPtr, new, index, count, VALIDATE_DELETE); if (code == TCL_OK) { AdjustIndices(entryPtr, index, -count); code = EntrySetValue(entryPtr, new); } else if (code == TCL_BREAK) { code = TCL_OK; } ckfree(new); return code; } /*------------------------------------------------------------------------ * +++ Event handler. */ /* EntryEventProc -- * Extra event handling for entry widgets: * Triggers validation on FocusIn and FocusOut events. */ #define EntryEventMask (FocusChangeMask) static void EntryEventProc(ClientData clientData, XEvent *eventPtr) { Entry *entryPtr = (Entry *) clientData; Tcl_Preserve(clientData); switch (eventPtr->type) { case DestroyNotify: Tk_DeleteEventHandler(entryPtr->core.tkwin, EntryEventMask, EntryEventProc, clientData); break; case FocusIn: EntryRevalidateBG(entryPtr, VALIDATE_FOCUSIN); break; case FocusOut: EntryRevalidateBG(entryPtr, VALIDATE_FOCUSOUT); break; } Tcl_Release(clientData); } /*------------------------------------------------------------------------ * +++ Initialization and cleanup. */ static int EntryInitialize(Tcl_Interp *interp, void *recordPtr) { Entry *entryPtr = recordPtr; Tk_CreateEventHandler( entryPtr->core.tkwin, EntryEventMask, EntryEventProc, entryPtr); Tk_CreateSelHandler(entryPtr->core.tkwin, XA_PRIMARY, XA_STRING, EntryFetchSelection, (ClientData) entryPtr, XA_STRING); TtkBlinkCursor(&entryPtr->core); entryPtr->entry.string = ckalloc(1); *entryPtr->entry.string = '\0'; entryPtr->entry.displayString = entryPtr->entry.string; entryPtr->entry.textVariableTrace = 0; entryPtr->entry.numBytes = entryPtr->entry.numChars = 0; EntryInitStyleDefaults(&entryPtr->entry.styleDefaults); entryPtr->entry.xscrollHandle = TtkCreateScrollHandle(&entryPtr->core, &entryPtr->entry.xscroll); entryPtr->entry.insertPos = 0; entryPtr->entry.selectFirst = -1; entryPtr->entry.selectLast = -1; return TCL_OK; } static void EntryCleanup(void *recordPtr) { Entry *entryPtr = recordPtr; if (entryPtr->entry.textVariableTrace) Ttk_UntraceVariable(entryPtr->entry.textVariableTrace); TtkFreeScrollHandle(entryPtr->entry.xscrollHandle); EntryFreeStyleDefaults(&entryPtr->entry.styleDefaults); Tk_DeleteSelHandler(entryPtr->core.tkwin, XA_PRIMARY, XA_STRING); Tk_FreeTextLayout(entryPtr->entry.textLayout); if (entryPtr->entry.displayString != entryPtr->entry.string) ckfree(entryPtr->entry.displayString); ckfree(entryPtr->entry.string); } /* EntryConfigure -- * Configure hook for Entry widgets. */ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Entry *entryPtr = recordPtr; Tcl_Obj *textVarName = entryPtr->entry.textVariableObj; Ttk_TraceHandle *vt = 0; if (mask & TEXTVAR_CHANGED) { if (textVarName && *Tcl_GetString(textVarName)) { vt = Ttk_TraceVariable(interp, textVarName,EntryTextVariableTrace,entryPtr); if (!vt) return TCL_ERROR; } } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } /* Update derived resources: */ if (mask & TEXTVAR_CHANGED) { if (entryPtr->entry.textVariableTrace) Ttk_UntraceVariable(entryPtr->entry.textVariableTrace); entryPtr->entry.textVariableTrace = vt; } /* Claim the selection, in case we've suddenly started exporting it. */ if (entryPtr->entry.exportSelection && entryPtr->entry.selectFirst != -1) { EntryOwnSelection(entryPtr); } /* Handle -state compatibility option: */ if (mask & STATE_CHANGED) { TtkCheckStateOption(&entryPtr->core, entryPtr->entry.stateObj); } /* Force scrollbar update if needed: */ if (mask & SCROLLCMD_CHANGED) { TtkScrollbarUpdateRequired(entryPtr->entry.xscrollHandle); } /* Recompute the displayString, in case showChar changed: */ if (entryPtr->entry.displayString != entryPtr->entry.string) ckfree(entryPtr->entry.displayString); entryPtr->entry.displayString = entryPtr->entry.showChar ? EntryDisplayString(entryPtr->entry.showChar, entryPtr->entry.numChars) : entryPtr->entry.string ; /* Update textLayout: */ EntryUpdateTextLayout(entryPtr); return TCL_OK; } /* EntryPostConfigure -- * Post-configuration hook for entry widgets. */ static int EntryPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Entry *entryPtr = recordPtr; int status = TCL_OK; if ((mask & TEXTVAR_CHANGED) && entryPtr->entry.textVariableTrace != NULL) { status = Ttk_FireTrace(entryPtr->entry.textVariableTrace); } return status; } /*------------------------------------------------------------------------ * +++ Layout and display. */ /* EntryTextArea -- * Return bounding box of entry display ("owner-draw") area. */ static Ttk_Box EntryTextArea(Entry *entryPtr) { WidgetCore *corePtr = &entryPtr->core; Ttk_LayoutNode *node = Ttk_LayoutFindNode(corePtr->layout, "textarea"); return node ? Ttk_LayoutNodeParcel(node) : Ttk_WinBox(corePtr->tkwin); } /* EntryCharPosition -- * Return the X coordinate of the specified character index. * Precondition: textLayout and layoutX up-to-date. */ static int EntryCharPosition(Entry *entryPtr, int index) { int xPos; Tk_CharBbox(entryPtr->entry.textLayout, index, &xPos, NULL, NULL, NULL); return xPos + entryPtr->entry.layoutX; } /* EntryDoLayout -- * Layout hook for entry widgets. * * Determine position of textLayout based on xscroll.first, justify, * and display area. * * Recalculates layoutX, layoutY, and rightIndex, * and updates xscroll accordingly. * May adjust xscroll.first to ensure the maximum #characters are onscreen. */ static void EntryDoLayout(void *recordPtr) { Entry *entryPtr = recordPtr; WidgetCore *corePtr = &entryPtr->core; Tk_TextLayout textLayout = entryPtr->entry.textLayout; int leftIndex = entryPtr->entry.xscroll.first; int rightIndex; Ttk_Box textarea; Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); textarea = EntryTextArea(entryPtr); /* Center the text vertically within the available parcel: */ entryPtr->entry.layoutY = textarea.y + (textarea.height - entryPtr->entry.layoutHeight)/2; /* Recompute where the leftmost character on the display will * be drawn (layoutX) and adjust leftIndex if necessary. */ if (entryPtr->entry.layoutWidth <= textarea.width) { /* Everything fits. Set leftIndex to zero (no need to scroll), * and compute layoutX based on -justify. */ int extraSpace = textarea.width - entryPtr->entry.layoutWidth; leftIndex = 0; rightIndex = entryPtr->entry.numChars; entryPtr->entry.layoutX = textarea.x; if (entryPtr->entry.justify == TK_JUSTIFY_RIGHT) { entryPtr->entry.layoutX += extraSpace; } else if (entryPtr->entry.justify == TK_JUSTIFY_CENTER) { entryPtr->entry.layoutX += extraSpace / 2; } } else { /* The whole string doesn't fit in the window. * Limit leftIndex to leave at most one character's worth * of empty space on the right. */ int overflow = entryPtr->entry.layoutWidth - textarea.width; int maxLeftIndex = 1 + Tk_PointToChar(textLayout, overflow, 0); int leftX; if (leftIndex > maxLeftIndex) { leftIndex = maxLeftIndex; } /* Compute layoutX and rightIndex. * rightIndex is set to one past the last fully-visible character. */ Tk_CharBbox(textLayout, leftIndex, &leftX, NULL, NULL, NULL); rightIndex = Tk_PointToChar(textLayout, leftX + textarea.width, 0); entryPtr->entry.layoutX = textarea.x - leftX; } TtkScrolled(entryPtr->entry.xscrollHandle, leftIndex, rightIndex, entryPtr->entry.numChars); } /* EntryGetGC -- Helper routine. * Get a GC using the specified foreground color and the entry's font. * Result must be freed with Tk_FreeGC(). */ static GC EntryGetGC(Entry *entryPtr, Tcl_Obj *colorObj) { Tk_Window tkwin = entryPtr->core.tkwin; Tk_Font font = Tk_GetFontFromObj(tkwin, entryPtr->entry.fontObj); XColor *colorPtr; unsigned long mask = 0ul; XGCValues gcValues; gcValues.line_width = 1; mask |= GCLineWidth; gcValues.font = Tk_FontId(font); mask |= GCFont; if (colorObj != 0 && (colorPtr=Tk_GetColorFromObj(tkwin,colorObj)) != 0) { gcValues.foreground = colorPtr->pixel; mask |= GCForeground; } return Tk_GetGC(entryPtr->core.tkwin, mask, &gcValues); } /* EntryDisplay -- * Redraws the contents of an entry window. */ static void EntryDisplay(void *clientData, Drawable d) { Entry *entryPtr = clientData; Tk_Window tkwin = entryPtr->core.tkwin; int leftIndex = entryPtr->entry.xscroll.first, rightIndex = entryPtr->entry.xscroll.last, selFirst = entryPtr->entry.selectFirst, selLast = entryPtr->entry.selectLast; EntryStyleData es; GC gc; int showSelection, showCursor; EntryInitStyleData(entryPtr, &es); showCursor = (entryPtr->core.flags & CURSOR_ON) != 0 && EntryEditable(entryPtr) && entryPtr->entry.insertPos >= leftIndex && entryPtr->entry.insertPos <= rightIndex ; showSelection = (entryPtr->core.state & TTK_STATE_DISABLED) == 0 && selFirst > -1 && selLast > leftIndex && selFirst <= rightIndex ; /* Adjust selection range to keep in display bounds. */ if (showSelection) { if (selFirst < leftIndex) selFirst = leftIndex; if (selLast > rightIndex) selLast = rightIndex; } /* Draw widget background & border */ Ttk_DrawLayout(entryPtr->core.layout, entryPtr->core.state, d); /* Draw selection background */ if (showSelection && es.selBorderObj) { Tk_3DBorder selBorder = Tk_Get3DBorderFromObj(tkwin, es.selBorderObj); int selStartX = EntryCharPosition(entryPtr, selFirst); int selEndX = EntryCharPosition(entryPtr, selLast); int borderWidth = 1; Tcl_GetIntFromObj(NULL, es.selBorderWidthObj, &borderWidth); if (selBorder) { Tk_Fill3DRectangle(tkwin, d, selBorder, selStartX - borderWidth, entryPtr->entry.layoutY - borderWidth, selEndX - selStartX + 2*borderWidth, entryPtr->entry.layoutHeight + 2*borderWidth, borderWidth, TK_RELIEF_RAISED); } } /* Draw cursor: */ if (showCursor) { int cursorX = EntryCharPosition(entryPtr, entryPtr->entry.insertPos), cursorY = entryPtr->entry.layoutY, cursorHeight = entryPtr->entry.layoutHeight, cursorWidth = 1; Tcl_GetIntFromObj(NULL,es.insertWidthObj,&cursorWidth); if (cursorWidth <= 0) { cursorWidth = 1; } /* @@@ should: maybe: SetCaretPos even when blinked off */ Tk_SetCaretPos(tkwin, cursorX, cursorY, cursorHeight); gc = EntryGetGC(entryPtr, es.insertColorObj); XFillRectangle(Tk_Display(tkwin), d, gc, cursorX-cursorWidth/2, cursorY, cursorWidth, cursorHeight); Tk_FreeGC(Tk_Display(tkwin), gc); } /* Draw the text: */ gc = EntryGetGC(entryPtr, es.foregroundObj); Tk_DrawTextLayout( Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout, entryPtr->entry.layoutX, entryPtr->entry.layoutY, leftIndex, rightIndex); Tk_FreeGC(Tk_Display(tkwin), gc); /* Overwrite the selected portion (if any) in the -selectforeground color: */ if (showSelection) { gc = EntryGetGC(entryPtr, es.selForegroundObj); Tk_DrawTextLayout( Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout, entryPtr->entry.layoutX, entryPtr->entry.layoutY, selFirst, selLast); Tk_FreeGC(Tk_Display(tkwin), gc); } } /*------------------------------------------------------------------------ * +++ Widget commands. */ /* EntryIndex -- * Parse an index into an entry and return either its value * or an error. * * Results: * A standard Tcl result. If all went well, then *indexPtr is * filled in with the character index (into entryPtr) corresponding to * string. The index value is guaranteed to lie between 0 and * the number of characters in the string, inclusive. If an * error occurs then an error message is left in the interp's result. */ static int EntryIndex( Tcl_Interp *interp, /* For error messages. */ Entry *entryPtr, /* Entry widget to query */ Tcl_Obj *indexObj, /* Symbolic index name */ int *indexPtr) /* Return value */ { # define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */ int length; const char *string = Tcl_GetStringFromObj(indexObj, &length); if (strncmp(string, "end", length) == 0) { *indexPtr = entryPtr->entry.numChars; } else if (strncmp(string, "insert", length) == 0) { *indexPtr = entryPtr->entry.insertPos; } else if (strncmp(string, "left", length) == 0) { /* for debugging */ *indexPtr = entryPtr->entry.xscroll.first; } else if (strncmp(string, "right", length) == 0) { /* for debugging */ *indexPtr = entryPtr->entry.xscroll.last; } else if (strncmp(string, "sel.", 4) == 0) { if (entryPtr->entry.selectFirst < 0) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "selection isn't in widget ", Tk_PathName(entryPtr->core.tkwin), NULL); return TCL_ERROR; } if (strncmp(string, "sel.first", length) == 0) { *indexPtr = entryPtr->entry.selectFirst; } else if (strncmp(string, "sel.last", length) == 0) { *indexPtr = entryPtr->entry.selectLast; } else { goto badIndex; } } else if (string[0] == '@') { int roundUp = 0; int maxWidth = EntryWidth(entryPtr); int x; if (Tcl_GetInt(interp, string + 1, &x) != TCL_OK) { goto badIndex; } if (x > maxWidth) { x = maxWidth; roundUp = 1; } *indexPtr = Tk_PointToChar(entryPtr->entry.textLayout, x - entryPtr->entry.layoutX, 0); if (*indexPtr < entryPtr->entry.xscroll.first) { *indexPtr = entryPtr->entry.xscroll.first; } /* * Special trick: if the x-position was off-screen to the right, * round the index up to refer to the character just after the * last visible one on the screen. This is needed to enable the * last character to be selected, for example. */ if (roundUp && (*indexPtr < entryPtr->entry.numChars)) { *indexPtr += 1; } } else { if (Tcl_GetInt(interp, string, indexPtr) != TCL_OK) { goto badIndex; } if (*indexPtr < 0) { *indexPtr = 0; } else if (*indexPtr > entryPtr->entry.numChars) { *indexPtr = entryPtr->entry.numChars; } } return TCL_OK; badIndex: Tcl_ResetResult(interp); Tcl_AppendResult(interp, "bad entry index \"", string, "\"", NULL); return TCL_ERROR; } /* $entry bbox $index -- * Return the bounding box of the character at the specified index. */ static int EntryBBoxCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; Ttk_Box b; int index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { return TCL_ERROR; } if ((index == entryPtr->entry.numChars) && (index > 0)) { index--; } Tk_CharBbox(entryPtr->entry.textLayout, index, &b.x, &b.y, &b.width, &b.height); b.x += entryPtr->entry.layoutX; b.y += entryPtr->entry.layoutY; Tcl_SetObjResult(interp, Ttk_NewBoxObj(b)); return TCL_OK; } /* $entry delete $from ?$to? -- * Delete the characters in the range [$from,$to). * $to defaults to $from+1 if not specified. */ static int EntryDeleteCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; int first, last; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &first) != TCL_OK) { return TCL_ERROR; } if (objc == 3) { last = first + 1; } else if (EntryIndex(interp, entryPtr, objv[3], &last) != TCL_OK) { return TCL_ERROR; } if (last >= first && EntryEditable(entryPtr)) { return DeleteChars(entryPtr, first, last - first); } return TCL_OK; } /* $entry get -- * Return the current value of the entry widget. */ static int EntryGetCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } Tcl_SetResult(interp, entryPtr->entry.string, TCL_VOLATILE); return TCL_OK; } /* $entry icursor $index -- * Set the insert cursor position. */ static int EntryICursorCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pos"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &entryPtr->entry.insertPos) != TCL_OK) { return TCL_ERROR; } TtkRedisplayWidget(&entryPtr->core); return TCL_OK; } /* $entry index $index -- * Return numeric value (0..numChars) of the specified index. */ static int EntryIndexCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; int index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "string"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); return TCL_OK; } /* $entry insert $index $text -- * Insert $text after position $index. * Silent no-op if the entry is disabled or read-only. */ static int EntryInsertCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; int index; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "index text"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { return TCL_ERROR; } if (EntryEditable(entryPtr)) { return InsertChars(entryPtr, index, Tcl_GetString(objv[3])); } return TCL_OK; } /* selection clear -- * Clear selection. */ static int EntrySelectionClearCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1; TtkRedisplayWidget(&entryPtr->core); return TCL_OK; } /* $entry selection present -- * Returns 1 if any characters are selected, 0 otherwise. */ static int EntrySelectionPresentCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(entryPtr->entry.selectFirst >= 0)); return TCL_OK; } /* $entry selection range $start $end -- * Explicitly set the selection range. */ static int EntrySelectionRangeCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; int start, end; if (objc != 5) { Tcl_WrongNumArgs(interp, 3, objv, "start end"); return TCL_ERROR; } if ( EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK || EntryIndex(interp, entryPtr, objv[4], &end) != TCL_OK) { return TCL_ERROR; } if (entryPtr->core.state & TTK_STATE_DISABLED) { return TCL_OK; } if (start >= end) { entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1; } else { entryPtr->entry.selectFirst = start; entryPtr->entry.selectLast = end; EntryOwnSelection(entryPtr); } TtkRedisplayWidget(&entryPtr->core); return TCL_OK; } /* $entry selection $command ?arg arg...? * Ensemble, see above. */ static int EntrySelectionCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { static WidgetCommandSpec EntrySelectionCommands[] = { { "clear", EntrySelectionClearCommand }, { "present", EntrySelectionPresentCommand }, { "range", EntrySelectionRangeCommand }, {0,0} }; return TtkWidgetEnsembleCommand( EntrySelectionCommands, 2, interp, objc, objv, recordPtr); } /* $entry set $value * Sets the value of an entry widget. */ static int EntrySetCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "value"); return TCL_ERROR; } EntrySetValue(entryPtr, Tcl_GetString(objv[2])); return TCL_OK; } /* $entry validate -- * Trigger forced validation. Returns 1/0 if validation succeeds/fails * or error status from -validatecommand / -invalidcommand. */ static int EntryValidateCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; int code; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } code = EntryRevalidate(interp, entryPtr, VALIDATE_FORCED); if (code == TCL_ERROR) return code; Tcl_SetObjResult(interp, Tcl_NewBooleanObj(code == TCL_OK)); return TCL_OK; } /* $entry xview -- horizontal scrolling interface */ static int EntryXViewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; return TtkScrollviewCommand(interp, objc, objv, entryPtr->entry.xscrollHandle); } static WidgetCommandSpec EntryCommands[] = { { "bbox", EntryBBoxCommand }, { "cget", TtkWidgetCgetCommand }, { "configure", TtkWidgetConfigureCommand }, { "delete", EntryDeleteCommand }, { "get", EntryGetCommand }, { "icursor", EntryICursorCommand }, { "identify", TtkWidgetIdentifyCommand }, { "index", EntryIndexCommand }, { "insert", EntryInsertCommand }, { "instate", TtkWidgetInstateCommand }, { "selection", EntrySelectionCommand }, { "state", TtkWidgetStateCommand }, { "validate", EntryValidateCommand }, { "xview", EntryXViewCommand }, {0,0} }; /*------------------------------------------------------------------------ * +++ Entry widget definition. */ static WidgetSpec EntryWidgetSpec = { "TEntry", /* className */ sizeof(Entry), /* recordSize */ EntryOptionSpecs, /* optionSpecs */ EntryCommands, /* subcommands */ EntryInitialize, /* initializeProc */ EntryCleanup, /* cleanupProc */ EntryConfigure, /* configureProc */ EntryPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ EntryDoLayout, /* layoutProc */ EntryDisplay /* displayProc */ }; /*------------------------------------------------------------------------ * +++ Combobox widget record. */ typedef struct { Tcl_Obj *postCommandObj; Tcl_Obj *valuesObj; Tcl_Obj *heightObj; int currentIndex; } ComboboxPart; typedef struct { WidgetCore core; EntryPart entry; ComboboxPart combobox; } Combobox; static Tk_OptionSpec ComboboxOptionSpecs[] = { {TK_OPTION_STRING, "-height", "height", "Height", DEF_LIST_HEIGHT, Tk_Offset(Combobox, combobox.heightObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-postcommand", "postCommand", "PostCommand", "", Tk_Offset(Combobox, combobox.postCommandObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-values", "values", "Values", "", Tk_Offset(Combobox, combobox.valuesObj), -1, 0,0,0 }, WIDGET_INHERIT_OPTIONS(EntryOptionSpecs) }; /* ComboboxInitialize -- * Initialization hook for combobox widgets. */ static int ComboboxInitialize(Tcl_Interp *interp, void *recordPtr) { Combobox *cb = recordPtr; cb->combobox.currentIndex = -1; TtkTrackElementState(&cb->core); return EntryInitialize(interp, recordPtr); } /* ComboboxConfigure -- * Configuration hook for combobox widgets. */ static int ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Combobox *cbPtr = recordPtr; int unused; /* Make sure -values is a valid list: */ if (Tcl_ListObjLength(interp,cbPtr->combobox.valuesObj,&unused) != TCL_OK) return TCL_ERROR; return EntryConfigure(interp, recordPtr, mask); } /* $cb current ?newIndex? -- get or set current index. * Setting the current index updates the combobox value, * but the value and -values may be changed independently * of the index. Instead of trying to keep currentIndex * in sync at all times, [$cb current] double-checks */ static int ComboboxCurrentCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Combobox *cbPtr = recordPtr; int currentIndex = cbPtr->combobox.currentIndex; const char *currentValue = cbPtr->entry.string; int nValues; Tcl_Obj **values; Tcl_ListObjGetElements(interp,cbPtr->combobox.valuesObj,&nValues,&values); if (objc == 2) { /* Check if currentIndex still valid: */ if ( currentIndex < 0 || currentIndex >= nValues || strcmp(currentValue,Tcl_GetString(values[currentIndex])) ) { /* Not valid. Check current value against each element in -values: */ for (currentIndex = 0; currentIndex < nValues; ++currentIndex) { if (!strcmp(currentValue,Tcl_GetString(values[currentIndex]))) { break; } } if (currentIndex >= nValues) { /* Not found */ currentIndex = -1; } } cbPtr->combobox.currentIndex = currentIndex; Tcl_SetObjResult(interp, Tcl_NewIntObj(currentIndex)); return TCL_OK; } else if (objc == 3) { if (Tcl_GetIntFromObj(interp, objv[2], ¤tIndex) != TCL_OK) { return TCL_ERROR; } if (currentIndex < 0 || currentIndex >= nValues) { Tcl_AppendResult(interp, "Index ", Tcl_GetString(objv[2]), " out of range", NULL); return TCL_ERROR; } cbPtr->combobox.currentIndex = currentIndex; return EntrySetValue(recordPtr, Tcl_GetString(values[currentIndex])); } else { Tcl_WrongNumArgs(interp, 2, objv, "?newIndex?"); return TCL_ERROR; } return TCL_OK; } /*------------------------------------------------------------------------ * +++ Combobox widget definition. */ static WidgetCommandSpec ComboboxCommands[] = { { "bbox", EntryBBoxCommand }, { "cget", TtkWidgetCgetCommand }, { "configure", TtkWidgetConfigureCommand }, { "current", ComboboxCurrentCommand }, { "delete", EntryDeleteCommand }, { "get", EntryGetCommand }, { "icursor", EntryICursorCommand }, { "identify", TtkWidgetIdentifyCommand }, { "index", EntryIndexCommand }, { "insert", EntryInsertCommand }, { "instate", TtkWidgetInstateCommand }, { "selection", EntrySelectionCommand }, { "state", TtkWidgetStateCommand }, { "set", EntrySetCommand }, { "xview", EntryXViewCommand }, {0,0} }; static WidgetSpec ComboboxWidgetSpec = { "TCombobox", /* className */ sizeof(Combobox), /* recordSize */ ComboboxOptionSpecs, /* optionSpecs */ ComboboxCommands, /* subcommands */ ComboboxInitialize, /* initializeProc */ EntryCleanup, /* cleanupProc */ ComboboxConfigure, /* configureProc */ EntryPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ EntryDoLayout, /* layoutProc */ EntryDisplay /* displayProc */ }; /*------------------------------------------------------------------------ * +++ Textarea element. * * Text display area for Entry widgets. * Just computes requested size; display is handled by the widget itself. */ typedef struct { Tcl_Obj *fontObj; Tcl_Obj *widthObj; } TextareaElement; static Ttk_ElementOptionSpec TextareaElementOptions[] = { { "-font", TK_OPTION_FONT, Tk_Offset(TextareaElement,fontObj), DEF_ENTRY_FONT }, { "-width", TK_OPTION_INT, Tk_Offset(TextareaElement,widthObj), "20" }, {0,0,0} }; static void TextareaElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TextareaElement *textarea = elementRecord; Tk_Font font = Tk_GetFontFromObj(tkwin, textarea->fontObj); int avgWidth = Tk_TextWidth(font, "0", 1); Tk_FontMetrics fm; int prefWidth = 1; Tk_GetFontMetrics(font, &fm); Tcl_GetIntFromObj(NULL, textarea->widthObj, &prefWidth); if (prefWidth <= 0) prefWidth = 1; *heightPtr = fm.linespace; *widthPtr = prefWidth * avgWidth; } static Ttk_ElementSpec TextareaElementSpec = { TK_STYLE_VERSION_2, sizeof(TextareaElement), TextareaElementOptions, TextareaElementSize, TtkNullElementDraw }; /*------------------------------------------------------------------------ * +++ Widget layouts. */ TTK_BEGIN_LAYOUT(EntryLayout) TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(ComboboxLayout) TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) TTK_GROUP("Combobox.padding", TTK_FILL_BOTH|TTK_PACK_LEFT|TTK_EXPAND, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ void TtkEntry_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); Ttk_RegisterElement(interp, themePtr, "textarea", &TextareaElementSpec, 0); Ttk_RegisterLayout(themePtr, "TEntry", EntryLayout); Ttk_RegisterLayout(themePtr, "TCombobox", ComboboxLayout); RegisterWidget(interp, "ttk::entry", &EntryWidgetSpec); RegisterWidget(interp, "ttk::combobox", &ComboboxWidgetSpec); } /*EOF*/ tile-0.8.2/generic/frame.c0000644000076500007650000004343210722327025014724 0ustar joejoe00000000000000/* frame.c,v 1.56 2007/11/25 17:17:09 jenglish Exp * Copyright (c) 2004, Joe English * * ttk::frame and ttk::labelframe widgets. */ #include #include "tkTheme.h" #include "widget.h" #include "manager.h" /* ====================================================================== * +++ Frame widget: */ typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *paddingObj; Tcl_Obj *reliefObj; Tcl_Obj *widthObj; Tcl_Obj *heightObj; } FramePart; typedef struct { WidgetCore core; FramePart frame; } Frame; static Tk_OptionSpec FrameOptionSpecs[] = { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL, Tk_Offset(Frame,frame.borderWidthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, Tk_Offset(Frame,frame.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, Tk_Offset(Frame,frame.reliefObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_PIXELS, "-width", "width", "Width", "0", Tk_Offset(Frame,frame.widthObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-height", "height", "Height", "0", Tk_Offset(Frame,frame.heightObj), -1, 0,0,GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static WidgetCommandSpec FrameCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "instate", TtkWidgetInstateCommand }, { "state", TtkWidgetStateCommand }, { "identify", TtkWidgetIdentifyCommand }, { NULL, NULL } }; /* * FrameMargins -- * Compute internal margins for a frame widget. * This includes the -borderWidth, plus any additional -padding. */ static Ttk_Padding FrameMargins(Frame *framePtr) { Ttk_Padding margins = Ttk_UniformPadding(0); /* Check -padding: */ if (framePtr->frame.paddingObj) { Ttk_GetPaddingFromObj(NULL, framePtr->core.tkwin, framePtr->frame.paddingObj, &margins); } /* Add padding for border: */ if (framePtr->frame.borderWidthObj) { int border = 0; Tk_GetPixelsFromObj(NULL, framePtr->core.tkwin, framePtr->frame.borderWidthObj, &border); margins = Ttk_AddPadding(margins, Ttk_UniformPadding((short)border)); } return margins; } /* FrameSize procedure -- * The frame doesn't request a size of its own by default, * but it does have an internal border. See also <> */ static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr) { Frame *framePtr = recordPtr; Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr)); return 0; } /* * FrameConfigure -- configure hook. * <> Usually the size of a frame is controlled by * a geometry manager (pack, grid); the -width and -height * options are only effective if geometry propagation is turned * off or if the [place] GM is used for child widgets. * * To avoid geometry blinking, we issue a geometry request * in the Configure hook instead of the Size hook, and only * if -width and/or -height is nonzero and one of them * or the other size-related options (-borderwidth, -padding) * has been changed. */ static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Frame *framePtr = recordPtr; int width, height; /* * Make sure -padding resource, if present, is correct: */ if (framePtr->frame.paddingObj) { Ttk_Padding unused; if (Ttk_GetPaddingFromObj(interp, framePtr->core.tkwin, framePtr->frame.paddingObj, &unused) != TCL_OK) { return TCL_ERROR; } } /* See <> */ if ( TCL_OK != Tk_GetPixelsFromObj( interp,framePtr->core.tkwin,framePtr->frame.widthObj,&width) || TCL_OK != Tk_GetPixelsFromObj( interp,framePtr->core.tkwin,framePtr->frame.heightObj,&height) ) { return TCL_ERROR; } if ((width > 0 || height > 0) && (mask & GEOMETRY_CHANGED)) { Tk_GeometryRequest(framePtr->core.tkwin, width, height); } return TtkCoreConfigure(interp, recordPtr, mask); } static WidgetSpec FrameWidgetSpec = { "TFrame", /* className */ sizeof(Frame), /* recordSize */ FrameOptionSpecs, /* optionSpecs */ FrameCommands, /* subcommands */ TtkNullInitialize, /* initializeProc */ TtkNullCleanup, /* cleanupProc */ FrameConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ FrameSize, /* sizeProc */ TtkWidgetDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(FrameLayout) TTK_NODE("Frame.border", TTK_FILL_BOTH) TTK_END_LAYOUT /* ====================================================================== * +++ Labelframe widget: */ #define DEFAULT_LABELINSET 8 #define DEFAULT_BORDERWIDTH 2 int TtkGetLabelAnchorFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_PositionSpec *anchorPtr) { const char *string = Tcl_GetString(objPtr); char c = *string++; Ttk_PositionSpec flags = 0; /* First character determines side: */ switch (c) { case 'w' : flags = TTK_PACK_LEFT; break; case 'e' : flags = TTK_PACK_RIGHT; break; case 'n' : flags = TTK_PACK_TOP; break; case 's' : flags = TTK_PACK_BOTTOM; break; default : goto error; } /* Remaining characters are as per -sticky: */ while ((c = *string++) != '\0') { switch (c) { case 'w' : flags |= TTK_STICK_W; break; case 'e' : flags |= TTK_STICK_E; break; case 'n' : flags |= TTK_STICK_N; break; case 's' : flags |= TTK_STICK_S; break; default : goto error; } } *anchorPtr = flags; return TCL_OK; error: if (interp) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Bad label anchor specification ", Tcl_GetString(objPtr), NULL); } return TCL_ERROR; } /* LabelAnchorSide -- * Returns the side corresponding to a LabelAnchor value. */ static Ttk_Side LabelAnchorSide(Ttk_PositionSpec flags) { if (flags & TTK_PACK_LEFT) return TTK_SIDE_LEFT; else if (flags & TTK_PACK_RIGHT) return TTK_SIDE_RIGHT; else if (flags & TTK_PACK_TOP) return TTK_SIDE_TOP; else if (flags & TTK_PACK_BOTTOM) return TTK_SIDE_BOTTOM; /*NOTREACHED*/ return TTK_SIDE_TOP; } /* * Labelframe widget record: */ typedef struct { Tcl_Obj *labelAnchorObj; Tcl_Obj *textObj; Tcl_Obj *underlineObj; Tk_Window labelWidget; Ttk_Manager *mgr; Ttk_Layout labelLayout; /* Sublayout for label */ Ttk_Box labelParcel; /* Set in layoutProc */ } LabelframePart; typedef struct { WidgetCore core; FramePart frame; LabelframePart label; } Labelframe; #define LABELWIDGET_CHANGED 0x100 static Tk_OptionSpec LabelframeOptionSpecs[] = { {TK_OPTION_STRING, "-labelanchor", "labelAnchor", "LabelAnchor", "nw", Tk_Offset(Labelframe, label.labelAnchorObj),-1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-text", "text", "Text", "", Tk_Offset(Labelframe,label.textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", Tk_Offset(Labelframe,label.underlineObj), -1, 0,0,0 }, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL, -1, Tk_Offset(Labelframe,label.labelWidget), TK_OPTION_NULL_OK,0,LABELWIDGET_CHANGED|GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(FrameOptionSpecs) }; /* * Labelframe style parameters: */ typedef struct { int borderWidth; /* border width */ Ttk_Padding padding; /* internal padding */ Ttk_PositionSpec labelAnchor; /* corner/side to place label */ Ttk_Padding labelMargins; /* extra space around label */ int labelOutside; /* true=>place label outside border */ } LabelframeStyle; static void LabelframeStyleOptions(Labelframe *lf, LabelframeStyle *style) { Ttk_Layout layout = lf->core.layout; Tcl_Obj *objPtr; style->borderWidth = DEFAULT_BORDERWIDTH; style->padding = Ttk_UniformPadding(0); style->labelAnchor = TTK_PACK_TOP | TTK_STICK_W; style->labelOutside = 0; if ((objPtr = Ttk_QueryOption(layout, "-borderwidth", 0)) != NULL) { Tk_GetPixelsFromObj(NULL, lf->core.tkwin, objPtr, &style->borderWidth); } if ((objPtr = Ttk_QueryOption(layout, "-padding", 0)) != NULL) { Ttk_GetPaddingFromObj(NULL, lf->core.tkwin, objPtr, &style->padding); } if ((objPtr = Ttk_QueryOption(layout,"-labelanchor", 0)) != NULL) { TtkGetLabelAnchorFromObj(NULL, objPtr, &style->labelAnchor); } if ((objPtr = Ttk_QueryOption(layout,"-labelmargins", 0)) != NULL) { Ttk_GetBorderFromObj(NULL, objPtr, &style->labelMargins); } else { if (style->labelAnchor & (TTK_PACK_TOP|TTK_PACK_BOTTOM)) { style->labelMargins = Ttk_MakePadding(DEFAULT_LABELINSET,0,DEFAULT_LABELINSET,0); } else { style->labelMargins = Ttk_MakePadding(0,DEFAULT_LABELINSET,0,DEFAULT_LABELINSET); } } if ((objPtr = Ttk_QueryOption(layout,"-labeloutside", 0)) != NULL) { Tcl_GetBooleanFromObj(NULL, objPtr, &style->labelOutside); } return; } /* LabelframeLabelSize -- * Extract the requested width and height of the labelframe's label: * taken from the label widget if specified, otherwise the text label. */ static void LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr) { Tk_Window labelWidget = lframePtr->label.labelWidget; if (labelWidget) { *widthPtr = Tk_ReqWidth(labelWidget); *heightPtr = Tk_ReqHeight(labelWidget); } else { Ttk_LayoutSize(lframePtr->label.labelLayout, 0, widthPtr, heightPtr); } } /* * LabelframeSize -- * Like the frame, this doesn't request a size of its own * but it does have internal padding and a minimum size. */ static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) { Labelframe *lframePtr = recordPtr; WidgetCore *corePtr = &lframePtr->core; Ttk_Padding margins; LabelframeStyle style; int labelWidth, labelHeight; LabelframeStyleOptions(lframePtr, &style); /* Compute base margins (See also: FrameMargins) */ margins = Ttk_AddPadding( style.padding, Ttk_UniformPadding((short)style.borderWidth)); /* Adjust margins based on label size and position: */ LabelframeLabelSize(lframePtr, &labelWidth, &labelHeight); labelWidth += Ttk_PaddingWidth(style.labelMargins); labelHeight += Ttk_PaddingHeight(style.labelMargins); switch (LabelAnchorSide(style.labelAnchor)) { case TTK_SIDE_LEFT: margins.left += labelWidth; break; case TTK_SIDE_RIGHT: margins.right += labelWidth; break; case TTK_SIDE_TOP: margins.top += labelHeight; break; case TTK_SIDE_BOTTOM: margins.bottom += labelHeight; break; } Ttk_SetMargins(corePtr->tkwin,margins); /* Request minimum size based on border width and label size: */ Tk_SetMinimumRequestSize(corePtr->tkwin, labelWidth + 2*style.borderWidth, labelHeight + 2*style.borderWidth); return 0; } /* * LabelframeGetLayout -- * Getlayout widget hook. */ static Ttk_Layout LabelframeGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Labelframe *lf = recordPtr; Ttk_Layout frameLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout labelLayout; if (!frameLayout) { return NULL; } labelLayout = Ttk_CreateSublayout( interp, theme, frameLayout, ".Label", lf->core.optionTable); if (labelLayout) { if (lf->label.labelLayout) { Ttk_FreeLayout(lf->label.labelLayout); } Ttk_RebindSublayout(labelLayout, recordPtr); lf->label.labelLayout = labelLayout; } return frameLayout; } /* * LabelframeDoLayout -- * Labelframe layout hook. * * Side effects: Computes labelParcel. */ static void LabelframeDoLayout(void *recordPtr) { Labelframe *lframePtr = recordPtr; WidgetCore *corePtr = &lframePtr->core; int lw, lh; /* Label width and height */ LabelframeStyle style; Ttk_Box borderParcel = Ttk_WinBox(lframePtr->core.tkwin); Ttk_Box labelParcel; /* * Compute label parcel: */ LabelframeStyleOptions(lframePtr, &style); LabelframeLabelSize(lframePtr, &lw, &lh); lw += Ttk_PaddingWidth(style.labelMargins); lh += Ttk_PaddingHeight(style.labelMargins); labelParcel = Ttk_PadBox( Ttk_PositionBox(&borderParcel, lw, lh, style.labelAnchor), style.labelMargins); if (!style.labelOutside) { /* Move border edge so it's over label: */ switch (LabelAnchorSide(style.labelAnchor)) { case TTK_SIDE_LEFT: borderParcel.x -= lw / 2; case TTK_SIDE_RIGHT: borderParcel.width += lw/2; break; case TTK_SIDE_TOP: borderParcel.y -= lh / 2; case TTK_SIDE_BOTTOM: borderParcel.height += lh / 2; break; } } /* * Place border and label: */ Ttk_PlaceLayout(corePtr->layout, corePtr->state, borderParcel); Ttk_PlaceLayout(lframePtr->label.labelLayout, corePtr->state, labelParcel); /* labelWidget placed in LabelframePlaceSlaves GM hook */ lframePtr->label.labelParcel = labelParcel; } static void LabelframeDisplay(void *recordPtr, Drawable d) { Labelframe *lframePtr = recordPtr; Ttk_DrawLayout(lframePtr->core.layout, lframePtr->core.state, d); Ttk_DrawLayout(lframePtr->label.labelLayout, lframePtr->core.state, d); } /* +++ Labelframe geometry manager hooks. */ /* LabelframePlaceSlaves -- * Sets the position and size of the labelwidget. */ static void LabelframePlaceSlaves(void *recordPtr) { Labelframe *lframe = recordPtr; if (Ttk_NumberSlaves(lframe->label.mgr) == 1) { Ttk_Box b; LabelframeDoLayout(recordPtr); b = lframe->label.labelParcel; /* ASSERT: slave #0 is lframe->label.labelWidget */ Ttk_PlaceSlave(lframe->label.mgr, 0, b.x,b.y,b.width,b.height); } } static int LabelRequest(void *managerData, int index, int width, int height) { return 1; } /* LabelRemoved -- * Unset the -labelwidget option. * * <>: * This routine is also called when the widget voluntarily forgets * the slave in LabelframeConfigure. */ static void LabelRemoved(void *managerData, int slaveIndex) { Labelframe *lframe = managerData; lframe->label.labelWidget = 0; } static Ttk_ManagerSpec LabelframeManagerSpec = { { "labelframe", Ttk_GeometryRequestProc, Ttk_LostSlaveProc }, LabelframeSize, LabelframePlaceSlaves, LabelRequest, LabelRemoved }; /* LabelframeInitialize -- * Initialization hook. */ static int LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) { Labelframe *lframe = recordPtr; lframe->label.mgr = Ttk_CreateManager( &LabelframeManagerSpec, lframe, lframe->core.tkwin); lframe->label.labelWidget = 0; lframe->label.labelLayout = 0; lframe->label.labelParcel = Ttk_MakeBox(-1,-1,-1,-1); return TCL_OK; } /* LabelframeCleanup -- * Cleanup hook. */ static void LabelframeCleanup(void *recordPtr) { Labelframe *lframe = recordPtr; Ttk_DeleteManager(lframe->label.mgr); } /* RaiseLabelWidget -- * Raise the -labelwidget to ensure that the labelframe doesn't * obscure it (if it's not a direct child), or bring it to * the top of the stacking order (if it is). */ static void RaiseLabelWidget(Labelframe *lframe) { Tk_Window parent = Tk_Parent(lframe->label.labelWidget); Tk_Window sibling = NULL; Tk_Window w = lframe->core.tkwin; while (w && w != parent) { sibling = w; w = Tk_Parent(w); } Tk_RestackWindow(lframe->label.labelWidget, Above, sibling); } /* LabelframeConfigure -- * Configuration hook. */ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask) { Labelframe *lframePtr = recordPtr; Tk_Window labelWidget = lframePtr->label.labelWidget; Ttk_PositionSpec unused; /* Validate options: */ if (mask & LABELWIDGET_CHANGED && labelWidget != NULL) { if (!Ttk_Maintainable(interp, labelWidget, lframePtr->core.tkwin)) { return TCL_ERROR; } } if (TtkGetLabelAnchorFromObj( interp, lframePtr->label.labelAnchorObj, &unused) != TCL_OK) { return TCL_ERROR; } /* Base class configuration: */ if (FrameConfigure(interp, recordPtr, mask) != TCL_OK) { return TCL_ERROR; } /* Update -labelwidget changes, if any: */ if (mask & LABELWIDGET_CHANGED) { if (Ttk_NumberSlaves(lframePtr->label.mgr) == 1) { Ttk_ForgetSlave(lframePtr->label.mgr, 0); /* Restore labelWidget field (see <>) */ lframePtr->label.labelWidget = labelWidget; } if (labelWidget) { Ttk_InsertSlave(lframePtr->label.mgr, 0, labelWidget, NULL); RaiseLabelWidget(lframePtr); } } if (mask & GEOMETRY_CHANGED) { Ttk_ManagerSizeChanged(lframePtr->label.mgr); Ttk_ManagerLayoutChanged(lframePtr->label.mgr); } return TCL_OK; } static WidgetSpec LabelframeWidgetSpec = { "TLabelframe", /* className */ sizeof(Labelframe), /* recordSize */ LabelframeOptionSpecs, /* optionSpecs */ FrameCommands, /* subcommands */ LabelframeInitialize, /* initializeProc */ LabelframeCleanup, /* cleanupProc */ LabelframeConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ LabelframeGetLayout, /* getLayoutProc */ LabelframeSize, /* sizeProc */ LabelframeDoLayout, /* layoutProc */ LabelframeDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(LabelframeLayout) TTK_NODE("Labelframe.border", TTK_FILL_BOTH) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(LabelSublayout) TTK_GROUP("Label.fill", TTK_FILL_BOTH, TTK_NODE("Label.text", TTK_FILL_BOTH)) TTK_END_LAYOUT /* ====================================================================== * +++ Initialization. */ void TtkFrame_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme, "TFrame", FrameLayout); Ttk_RegisterLayout(theme, "TLabelframe", LabelframeLayout); Ttk_RegisterLayout(theme, "TLabelframe.Label", LabelSublayout); RegisterWidget(interp, "ttk::frame", &FrameWidgetSpec); RegisterWidget(interp, "ttk::labelframe", &LabelframeWidgetSpec); } tile-0.8.2/generic/gunk.h0000644000076500007650000000206310027563463014604 0ustar joejoe00000000000000/* * gunk.h * * Portability gunk. * * Tk doesn't seem provide a consistent API across different * platforms, at least not in the public interface. * This file is a dumping ground for any #ifdeffery needed * to get stuff to compile on multiple platforms. */ /* * ... Tk also doesn't provide a consistent set of #defines * to determine what platform we're on ... */ #if defined(__WIN32__) # define WIN_TK 1 #endif #if !defined(WIN_TK) && !defined(MAC_TK) && !defined(MAC_OSX_TK) # define X11_TK 1 #endif #if X11_TK #define TkPutImage(colors, ncolors, display, pixels, gc, image, destx, desty, srcx, srcy, width, height) \ XPutImage(display, pixels, gc, image, destx, desty, srcx, \ srcy, width, height); #endif #if defined(WIN_TK) && defined(NO_PRIVATE_HEADERS) #include #include /* From tkWinInt.h: */ typedef struct TkWinDCState { HPALETTE palette; int bkmode; } TkWinDCState; EXTERN HDC TkWinGetDrawableDC(Display *, Drawable, TkWinDCState*); EXTERN HDC TkWinReleaseDrawableDC(Drawable, HDC, TkWinDCState*); #endif tile-0.8.2/generic/image.c0000644000076500007650000002626710714464315014730 0ustar joejoe00000000000000/* image.c,v 1.9 2007/11/08 01:39:25 jenglish Exp * Image specifications and image element factory. * * Copyright (C) 2004 Pat Thoyts * Copyright (C) 2004 Joe English * * An imageSpec is a multi-element list; the first element * is the name of the default image to use, the remainder of the * list is a sequence of statespec/imagename options as per * [style map]. */ #include #include #include "tkTheme.h" #define TILE_07_COMPAT 1 #define MIN(a,b) ((a) < (b) ? (a) : (b)) /*------------------------------------------------------------------------ * +++ ImageSpec management. */ struct TtkImageSpec { Tk_Image baseImage; /* Base image to use */ int mapCount; /* #state-specific overrides */ Ttk_StateSpec *states; /* array[mapCount] of states ... */ Tk_Image *images; /* ... per-state images to use */ }; /* NullImageChanged -- * Do-nothing Tk_ImageChangedProc. */ static void NullImageChanged(ClientData clientData, int x, int y, int width, int height, int imageWidth, int imageHeight) { /* No-op */ } /* TtkGetImageSpec -- * Constructs a Ttk_ImageSpec * from a Tcl_Obj *. * Result must be released using TtkFreeImageSpec. * * TODO: Need a variant of this that takes a user-specified ImageChanged proc */ Ttk_ImageSpec * TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr) { Ttk_ImageSpec *imageSpec = 0; int i = 0, n = 0, objc; Tcl_Obj **objv; imageSpec = (Ttk_ImageSpec *)ckalloc(sizeof(*imageSpec)); imageSpec->baseImage = 0; imageSpec->mapCount = 0; imageSpec->states = 0; imageSpec->images = 0; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) { goto error; } if ((objc % 2) != 1) { if (interp) { Tcl_SetResult(interp, "image specification must contain an odd number of elements", TCL_STATIC); } goto error; } n = (objc - 1) / 2; imageSpec->states = (Ttk_StateSpec*)ckalloc(n * sizeof(Ttk_StateSpec)); imageSpec->images = (Tk_Image*)ckalloc(n * sizeof(Tk_Image *)); /* Get base image: */ imageSpec->baseImage = Tk_GetImage( interp, tkwin, Tcl_GetString(objv[0]), NullImageChanged, NULL); if (!imageSpec->baseImage) { goto error; } /* Extract state and image specifications: */ for (i = 0; i < n; ++i) { Tcl_Obj *stateSpec = objv[2*i + 1]; const char *imageName = Tcl_GetString(objv[2*i + 2]); Ttk_StateSpec state; if (Ttk_GetStateSpecFromObj(interp, stateSpec, &state) != TCL_OK) { goto error; } imageSpec->states[i] = state; imageSpec->images[i] = Tk_GetImage( interp, tkwin, imageName, NullImageChanged, NULL); if (imageSpec->images[i] == NULL) { goto error; } imageSpec->mapCount = i+1; } return imageSpec; error: TtkFreeImageSpec(imageSpec); return NULL; } /* TtkFreeImageSpec -- * Dispose of an image specification. */ void TtkFreeImageSpec(Ttk_ImageSpec *imageSpec) { int i; for (i=0; i < imageSpec->mapCount; ++i) { Tk_FreeImage(imageSpec->images[i]); } if (imageSpec->baseImage) { Tk_FreeImage(imageSpec->baseImage); } if (imageSpec->states) { ckfree((ClientData)imageSpec->states); } if (imageSpec->images) { ckfree((ClientData)imageSpec->images); } ckfree((ClientData)imageSpec); } /* TtkSelectImage -- * Return a state-specific image from an ImageSpec */ Tk_Image TtkSelectImage(Ttk_ImageSpec *imageSpec, Ttk_State state) { int i; for (i = 0; i < imageSpec->mapCount; ++i) { if (Ttk_StateMatches(state, imageSpec->states+i)) { return imageSpec->images[i]; } } return imageSpec->baseImage; } /*------------------------------------------------------------------------ * +++ Drawing utilities. */ /* LPadding, CPadding, RPadding -- * Split a box+padding pair into left, center, and right boxes. */ static Ttk_Box LPadding(Ttk_Box b, Ttk_Padding p) { return Ttk_MakeBox(b.x, b.y, p.left, b.height); } static Ttk_Box CPadding(Ttk_Box b, Ttk_Padding p) { return Ttk_MakeBox(b.x+p.left, b.y, b.width-p.left-p.right, b.height); } static Ttk_Box RPadding(Ttk_Box b, Ttk_Padding p) { return Ttk_MakeBox(b.x+b.width-p.right, b.y, p.right, b.height); } /* TPadding, MPadding, BPadding -- * Split a box+padding pair into top, middle, and bottom parts. */ static Ttk_Box TPadding(Ttk_Box b, Ttk_Padding p) { return Ttk_MakeBox(b.x, b.y, b.width, p.top); } static Ttk_Box MPadding(Ttk_Box b, Ttk_Padding p) { return Ttk_MakeBox(b.x, b.y+p.top, b.width, b.height-p.top-p.bottom); } static Ttk_Box BPadding(Ttk_Box b, Ttk_Padding p) { return Ttk_MakeBox(b.x, b.y+b.height-p.bottom, b.width, p.bottom); } /* Ttk_Fill -- * Fill the destination area of the drawable by replicating * the source area of the image. */ static void Ttk_Fill( Tk_Window tkwin, Drawable d, Tk_Image image, Ttk_Box src, Ttk_Box dst) { int dr = dst.x + dst.width; int db = dst.y + dst.height; int x,y; if (!(src.width && src.height && dst.width && dst.height)) return; for (x = dst.x; x < dr; x += src.width) { int cw = MIN(src.width, dr - x); for (y = dst.y; y <= db; y += src.height) { int ch = MIN(src.height, db - y); Tk_RedrawImage(image, src.x, src.y, cw, ch, d, x, y); } } } /* Ttk_Stripe -- * Fill a horizontal stripe of the destination drawable. */ static void Ttk_Stripe( Tk_Window tkwin, Drawable d, Tk_Image image, Ttk_Box src, Ttk_Box dst, Ttk_Padding p) { Ttk_Fill(tkwin, d, image, LPadding(src,p), LPadding(dst,p)); Ttk_Fill(tkwin, d, image, CPadding(src,p), CPadding(dst,p)); Ttk_Fill(tkwin, d, image, RPadding(src,p), RPadding(dst,p)); } /* Ttk_Tile -- * Fill successive horizontal stripes of the destination drawable. */ static void Ttk_Tile( Tk_Window tkwin, Drawable d, Tk_Image image, Ttk_Box src, Ttk_Box dst, Ttk_Padding p) { Ttk_Stripe(tkwin, d, image, TPadding(src,p), TPadding(dst,p), p); Ttk_Stripe(tkwin, d, image, MPadding(src,p), MPadding(dst,p), p); Ttk_Stripe(tkwin, d, image, BPadding(src,p), BPadding(dst,p), p); } /*------------------------------------------------------------------------ * +++ Image element definition. */ typedef struct { /* ClientData for image elements */ Ttk_ImageSpec *imageSpec; /* Image(s) to use */ int minWidth; /* Minimum width; overrides image width */ int minHeight; /* Minimum width; overrides image width */ Ttk_Sticky sticky; /* -stickiness specification */ Ttk_Padding border; /* Fixed border region */ Ttk_Padding padding; /* Internal padding */ #if TILE_07_COMPAT Ttk_ResourceCache cache; /* Resource cache for images */ Ttk_StateMap imageMap; /* State-based lookup table for images */ #endif } ImageData; static void FreeImageData(void *clientData) { ImageData *imageData = clientData; if (imageData->imageSpec) { TtkFreeImageSpec(imageData->imageSpec); } #if TILE_07_COMPAT if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); } #endif ckfree(clientData); } static void ImageElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ImageData *imageData = clientData; Tk_Image image = imageData->imageSpec->baseImage; if (image) { Tk_SizeOfImage(image, widthPtr, heightPtr); } if (imageData->minWidth >= 0) { *widthPtr = imageData->minWidth; } if (imageData->minHeight >= 0) { *heightPtr = imageData->minHeight; } *paddingPtr = imageData->padding; } static void ImageElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ImageData *imageData = clientData; Tk_Image image = 0; int imgWidth, imgHeight; Ttk_Box src, dst; #if TILE_07_COMPAT if (imageData->imageMap) { Tcl_Obj *imageObj = Ttk_StateMapLookup(NULL,imageData->imageMap,state); if (imageObj) { image = Ttk_UseImage(imageData->cache, tkwin, imageObj); } } if (!image) { image = TtkSelectImage(imageData->imageSpec, state); } #else image = TtkSelectImage(imageData->imageSpec, state); #endif if (!image) { return; } Tk_SizeOfImage(image, &imgWidth, &imgHeight); src = Ttk_MakeBox(0, 0, imgWidth, imgHeight); dst = Ttk_StickBox(b, imgWidth, imgHeight, imageData->sticky); Ttk_Tile(tkwin, d, image, src, dst, imageData->border); } static Ttk_ElementSpec ImageElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, ImageElementSize, ImageElementDraw }; /*------------------------------------------------------------------------ * +++ Image element factory. */ static int Ttk_CreateImageElement( Tcl_Interp *interp, void *clientData, Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *CONST objv[]) { const char *optionStrings[] = { "-border","-height","-padding","-sticky","-width",NULL }; enum { O_BORDER, O_HEIGHT, O_PADDING, O_STICKY, O_WIDTH }; Ttk_ImageSpec *imageSpec = 0; ImageData *imageData = 0; int padding_specified = 0; int i; if (objc <= 0) { Tcl_AppendResult(interp, "Must supply a base image", NULL); return TCL_ERROR; } imageSpec = TtkGetImageSpec(interp, Tk_MainWindow(interp), objv[0]); if (!imageSpec) { return TCL_ERROR; } imageData = (ImageData*)ckalloc(sizeof(*imageData)); imageData->imageSpec = imageSpec; imageData->minWidth = imageData->minHeight = -1; imageData->sticky = TTK_FILL_BOTH; imageData->border = imageData->padding = Ttk_UniformPadding(0); #if TILE_07_COMPAT imageData->cache = Ttk_GetResourceCache(interp); imageData->imageMap = 0; #endif for (i = 1; i < objc; i += 2) { int option; if (i == objc - 1) { Tcl_AppendResult(interp, "Value for ", Tcl_GetString(objv[i]), " missing", NULL); goto error; } #if TILE_07_COMPAT if (!strcmp("-map", Tcl_GetString(objv[i]))) { imageData->imageMap = objv[i+1]; Tcl_IncrRefCount(imageData->imageMap); continue; } #endif if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0, &option) != TCL_OK) { goto error; } switch (option) { case O_BORDER: if (Ttk_GetBorderFromObj(interp, objv[i+1], &imageData->border) != TCL_OK) { goto error; } if (!padding_specified) { imageData->padding = imageData->border; } break; case O_PADDING: if (Ttk_GetBorderFromObj(interp, objv[i+1], &imageData->padding) != TCL_OK) { goto error; } padding_specified = 1; break; case O_WIDTH: if (Tcl_GetIntFromObj(interp, objv[i+1], &imageData->minWidth) != TCL_OK) { goto error; } break; case O_HEIGHT: if (Tcl_GetIntFromObj(interp, objv[i+1], &imageData->minHeight) != TCL_OK) { goto error; } break; case O_STICKY: if (Ttk_GetStickyFromObj(interp, objv[i+1], &imageData->sticky) != TCL_OK) { goto error; } } } if (!Ttk_RegisterElement(interp, theme, elementName, &ImageElementSpec, imageData)) { goto error; } Ttk_RegisterCleanup(interp, imageData, FreeImageData); Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1)); return TCL_OK; error: FreeImageData(imageData); return TCL_ERROR; } void TtkImage_Init(Tcl_Interp *interp) { Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL); } /*EOF*/ tile-0.8.2/generic/label.c0000644000076500007650000004375310720166601014716 0ustar joejoe00000000000000/* label.c,v 1.22 2007/11/19 01:57:21 jenglish Exp * * text, image, and label elements. * * The label element combines text and image elements, * with layout determined by the "-compound" option. * */ #include #include #include "tkTheme.h" /*---------------------------------------------------------------------- * +++ Text element. * * This element displays a textual label in the foreground color. * * Optionally underlines the mnemonic character if the -underline resource * is present and >= 0. */ typedef struct { /* * Element options: */ Tcl_Obj *textObj; Tcl_Obj *fontObj; Tcl_Obj *foregroundObj; Tcl_Obj *underlineObj; Tcl_Obj *widthObj; Tcl_Obj *anchorObj; Tcl_Obj *justifyObj; Tcl_Obj *wrapLengthObj; Tcl_Obj *embossedObj; /* * Computed resources: */ Tk_Font tkfont; Tk_TextLayout textLayout; int width; int height; int embossed; } TextElement; /* Text element options table. * NB: Keep in sync with label element option table. */ static Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, Tk_Offset(TextElement,textObj), "" }, { "-font", TK_OPTION_FONT, Tk_Offset(TextElement,fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, Tk_Offset(TextElement,foregroundObj), "black" }, { "-underline", TK_OPTION_INT, Tk_Offset(TextElement,underlineObj), "-1"}, { "-width", TK_OPTION_INT, Tk_Offset(TextElement,widthObj), "-1"}, { "-anchor", TK_OPTION_ANCHOR, Tk_Offset(TextElement,anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, Tk_Offset(TextElement,justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, Tk_Offset(TextElement,wrapLengthObj), "0" }, { "-embossed", TK_OPTION_INT, Tk_Offset(TextElement,embossedObj), "0"}, {NULL} }; static int TextSetup(TextElement *text, Tk_Window tkwin) { const char *string = Tcl_GetString(text->textObj); Tk_Justify justify = TK_JUSTIFY_LEFT; int wrapLength = 0; text->tkfont = Tk_GetFontFromObj(tkwin, text->fontObj); Tk_GetJustifyFromObj(NULL, text->justifyObj, &justify); Tk_GetPixelsFromObj(NULL, tkwin, text->wrapLengthObj, &wrapLength); Tcl_GetBooleanFromObj(NULL, text->embossedObj, &text->embossed); text->textLayout = Tk_ComputeTextLayout( text->tkfont, string, -1/*numChars*/, wrapLength, justify, 0/*flags*/, &text->width, &text->height); return 1; } /* * TextReqWidth -- compute the requested width of a text element. * * If -width is positive, use that as the width * If -width is negative, use that as the minimum width * If not specified or empty, use the natural size of the text */ static int TextReqWidth(TextElement *text) { int reqWidth; if ( text->widthObj && Tcl_GetIntFromObj(NULL, text->widthObj, &reqWidth) == TCL_OK) { int avgWidth = Tk_TextWidth(text->tkfont, "0", 1); if (reqWidth <= 0) { int specWidth = avgWidth * -reqWidth; if (specWidth > text->width) return specWidth; } else { return avgWidth * reqWidth; } } return text->width; } static void TextCleanup(TextElement *text) { Tk_FreeTextLayout(text->textLayout); } /* * TextDraw -- * Draw a text element. * Called by TextElementDraw() and LabelElementDraw(). */ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) { XColor *color = Tk_GetColorFromObj(tkwin, text->foregroundObj); int underline = -1; int lastChar = -1; XGCValues gcValues; GC gc1, gc2; Tk_Anchor anchor = TK_ANCHOR_CENTER; gcValues.font = Tk_FontId(text->tkfont); gcValues.foreground = color->pixel; gc1 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); gc2 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); /* * Place text according to -anchor: */ Tk_GetAnchorFromObj(NULL, text->anchorObj, &anchor); b = Ttk_AnchorBox(b, text->width, text->height, anchor); /* * Clip text if it's too wide: * @@@ BUG: This will overclip multi-line text. */ if (b.width < text->width) { lastChar = Tk_PointToChar(text->textLayout, b.width, 1) + 1; } if (text->embossed) { Tk_DrawTextLayout(Tk_Display(tkwin), d, gc2, text->textLayout, b.x+1, b.y+1, 0/*firstChar*/, lastChar); } Tk_DrawTextLayout(Tk_Display(tkwin), d, gc1, text->textLayout, b.x, b.y, 0/*firstChar*/, lastChar); Tcl_GetIntFromObj(NULL, text->underlineObj, &underline); if (underline >= 0 && (lastChar == -1 || underline <= lastChar)) { if (text->embossed) { Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc2, text->textLayout, b.x+1, b.y+1, underline); } Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc1, text->textLayout, b.x, b.y, underline); } Tk_FreeGC(Tk_Display(tkwin), gc1); Tk_FreeGC(Tk_Display(tkwin), gc2); } static void TextElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TextElement *text = elementRecord; if (!TextSetup(text, tkwin)) return; *heightPtr = text->height; *widthPtr = TextReqWidth(text); TextCleanup(text); return; } static void TextElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TextElement *text = elementRecord; if (TextSetup(text, tkwin)) { TextDraw(text, tkwin, d, b); TextCleanup(text); } } static Ttk_ElementSpec TextElementSpec = { TK_STYLE_VERSION_2, sizeof(TextElement), TextElementOptions, TextElementSize, TextElementDraw }; /*---------------------------------------------------------------------- * +++ Image element. * Draws an image. */ typedef struct { Tcl_Obj *imageObj; Tcl_Obj *stippleObj; /* For TTK_STATE_DISABLED */ Tcl_Obj *backgroundObj; /* " " */ Ttk_ImageSpec *imageSpec; Tk_Image tkimg; int width; int height; } ImageElement; /* ===> NB: Keep in sync with label element option table. <=== */ static Ttk_ElementOptionSpec ImageElementOptions[] = { { "-image", TK_OPTION_STRING, Tk_Offset(ImageElement,imageObj), "" }, { "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */ Tk_Offset(ImageElement,stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, Tk_Offset(ImageElement,backgroundObj), DEFAULT_BACKGROUND }, {NULL} }; /* * ImageSetup() -- * Look up the Tk_Image from the image element's imageObj resource. * Caller must release the image with ImageCleanup(). * * Returns: * 1 if successful, 0 if there was an error (unreported) * or the image resource was not specified. */ static int ImageSetup( ImageElement *image, Tk_Window tkwin, Ttk_State state) { if (!image->imageObj) { return 0; } image->imageSpec = TtkGetImageSpec(NULL, tkwin, image->imageObj); if (!image->imageSpec) { return 0; } image->tkimg = TtkSelectImage(image->imageSpec, state); if (!image->tkimg) { TtkFreeImageSpec(image->imageSpec); return 0; } Tk_SizeOfImage(image->tkimg, &image->width, &image->height); return 1; } static void ImageCleanup(ImageElement *image) { TtkFreeImageSpec(image->imageSpec); } /* * StippleOver -- * Draw a stipple over the image area, to make it look "grayed-out" * when TTK_STATE_DISABLED is set. */ static void StippleOver( ImageElement *image, Tk_Window tkwin, Drawable d, int x, int y) { Pixmap stipple = Tk_AllocBitmapFromObj(NULL, tkwin, image->stippleObj); XColor *color = Tk_GetColorFromObj(tkwin, image->backgroundObj); if (stipple != None) { unsigned long mask = GCFillStyle | GCStipple | GCForeground; XGCValues gcvalues; GC gc; gcvalues.foreground = color->pixel; gcvalues.fill_style = FillStippled; gcvalues.stipple = stipple; gc = Tk_GetGC(tkwin, mask, &gcvalues); XFillRectangle(Tk_Display(tkwin),d,gc,x,y,image->width,image->height); Tk_FreeGC(Tk_Display(tkwin), gc); Tk_FreeBitmapFromObj(tkwin, image->stippleObj); } } static void ImageDraw( ImageElement *image, Tk_Window tkwin,Drawable d,Ttk_Box b,Ttk_State state) { int width = image->width, height = image->height; /* Clip width and height to remain within window bounds: */ if (b.x + width > Tk_Width(tkwin)) { width = Tk_Width(tkwin) - b.x; } if (b.y + height > Tk_Height(tkwin)) { height = Tk_Height(tkwin) - b.y; } Tk_RedrawImage(image->tkimg, 0,0, width, height, d, b.x, b.y); /* If we're disabled there's no state-specific 'disabled' image, * stipple the image. * @@@ Possibly: Don't do disabled-stippling at all; * @@@ it's ugly and out of fashion. */ if (state & TTK_STATE_DISABLED) { if (TtkSelectImage(image->imageSpec, 0ul) == image->tkimg) { StippleOver(image, tkwin, d, b.x,b.y); } } } static void ImageElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ImageElement *image = elementRecord; if (ImageSetup(image, tkwin, 0)) { *widthPtr = image->width; *heightPtr = image->height; ImageCleanup(image); } } static void ImageElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ImageElement *image = elementRecord; if (ImageSetup(image, tkwin, state)) { ImageDraw(image, tkwin, d, b, state); ImageCleanup(image); } } static Ttk_ElementSpec ImageElementSpec = { TK_STYLE_VERSION_2, sizeof(ImageElement), ImageElementOptions, ImageElementSize, ImageElementDraw }; /*------------------------------------------------------------------------ * +++ Label element. * * Displays an image and/or text, as determined by the -compound option. * * Differences from Tk 8.4 compound elements: * * This adds two new values for the -compound option, "text" * and "image". (This is useful for configuring toolbars to * display icons, text and icons, or text only, as found in * many browsers.) * * "-compound none" is supported, but I'd like to get rid of it; * it makes the logic more complex, and the only benefit is * backwards compatibility with Tk < 8.3.0 scripts. * * This adds a new resource, -space, for determining how much * space to leave between the text and image; Tk 8.4 reuses the * -padx or -pady option for this purpose. * * -width always specifies the length in characters of the text part; * in Tk 8.4 it's either characters or pixels, depending on the * value of -compound. * * Negative values of -width are interpreted as a minimum width * on all platforms, not just on Windows. * * Tk 8.4 ignores -padx and -pady if -compound is set to "none". * Here, padding is handled by a different element. */ typedef struct { /* * Element options: */ Tcl_Obj *compoundObj; Tcl_Obj *spaceObj; TextElement text; ImageElement image; /* * Computed values (see LabelSetup) */ Ttk_Compound compound; int space; int totalWidth, totalHeight; } LabelElement; static Ttk_ElementOptionSpec LabelElementOptions[] = { { "-compound", TK_OPTION_ANY, Tk_Offset(LabelElement,compoundObj), "none" }, { "-space", TK_OPTION_PIXELS, Tk_Offset(LabelElement,spaceObj), "4" }, /* Text element part: * NB: Keep in sync with TextElementOptions. */ { "-text", TK_OPTION_STRING, Tk_Offset(LabelElement,text.textObj), "" }, { "-font", TK_OPTION_FONT, Tk_Offset(LabelElement,text.fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, Tk_Offset(LabelElement,text.foregroundObj), "black" }, { "-underline", TK_OPTION_INT, Tk_Offset(LabelElement,text.underlineObj), "-1"}, { "-width", TK_OPTION_INT, Tk_Offset(LabelElement,text.widthObj), ""}, { "-anchor", TK_OPTION_ANCHOR, Tk_Offset(LabelElement,text.anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, Tk_Offset(LabelElement,text.justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, Tk_Offset(LabelElement,text.wrapLengthObj), "0" }, { "-embossed", TK_OPTION_INT, Tk_Offset(LabelElement,text.embossedObj), "0"}, /* Image element part: * NB: Keep in sync with ImageElementOptions. */ { "-image", TK_OPTION_STRING, Tk_Offset(LabelElement,image.imageObj), "" }, { "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */ Tk_Offset(LabelElement,image.stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, Tk_Offset(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND }, {NULL} }; /* * LabelSetup -- * Fills in computed fields of the label element. * * Calculate the text, image, and total width and height. */ #define MAX(a,b) ((a) > (b) ? a : b); static void LabelSetup( LabelElement *c, Tk_Window tkwin, Ttk_State state) { Tk_GetPixelsFromObj(NULL,tkwin,c->spaceObj,&c->space); Ttk_GetCompoundFromObj(NULL,c->compoundObj,(int*)&c->compound); /* * Deal with TTK_COMPOUND_NONE. */ if (c->compound == TTK_COMPOUND_NONE) { if (ImageSetup(&c->image, tkwin, state)) { c->compound = TTK_COMPOUND_IMAGE; } else { c->compound = TTK_COMPOUND_TEXT; } } else if (c->compound != TTK_COMPOUND_TEXT) { if (!ImageSetup(&c->image, tkwin, state)) { c->compound = TTK_COMPOUND_TEXT; } } if (c->compound != TTK_COMPOUND_IMAGE) TextSetup(&c->text, tkwin); /* * ASSERT: * if c->compound != IMAGE, then TextSetup() has been called * if c->compound != TEXT, then ImageSetup() has returned successfully * c->compound != COMPOUND_NONE. */ switch (c->compound) { case TTK_COMPOUND_NONE: /* Can't happen */ break; case TTK_COMPOUND_TEXT: c->totalWidth = c->text.width; c->totalHeight = c->text.height; break; case TTK_COMPOUND_IMAGE: c->totalWidth = c->image.width; c->totalHeight = c->image.height; break; case TTK_COMPOUND_CENTER: c->totalWidth = MAX(c->image.width, c->text.width); c->totalHeight = MAX(c->image.height, c->text.height); break; case TTK_COMPOUND_TOP: case TTK_COMPOUND_BOTTOM: c->totalWidth = MAX(c->image.width, c->text.width); c->totalHeight = c->image.height + c->text.height + c->space; break; case TTK_COMPOUND_LEFT: case TTK_COMPOUND_RIGHT: c->totalWidth = c->image.width + c->text.width + c->space; c->totalHeight = MAX(c->image.height, c->text.height); break; } } static void LabelCleanup(LabelElement *c) { if (c->compound != TTK_COMPOUND_TEXT) ImageCleanup(&c->image); if (c->compound != TTK_COMPOUND_IMAGE) TextCleanup(&c->text); } static void LabelElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { LabelElement *label = elementRecord; int textReqWidth = 0; LabelSetup(label, tkwin, 0); *heightPtr = label->totalHeight; /* Requested width based on -width option, not actual text width: */ if (label->compound != TTK_COMPOUND_IMAGE) textReqWidth = TextReqWidth(&label->text); switch (label->compound) { case TTK_COMPOUND_TEXT: *widthPtr = textReqWidth; break; case TTK_COMPOUND_IMAGE: *widthPtr = label->image.width; break; case TTK_COMPOUND_TOP: case TTK_COMPOUND_BOTTOM: case TTK_COMPOUND_CENTER: *widthPtr = MAX(label->image.width, textReqWidth); break; case TTK_COMPOUND_LEFT: case TTK_COMPOUND_RIGHT: *widthPtr = label->image.width + textReqWidth + label->space; break; case TTK_COMPOUND_NONE: break; /* Can't happen */ } LabelCleanup(label); } /* * DrawCompound -- * Helper routine for LabelElementDraw; * Handles layout for -compound {left,right,top,bottom} */ static void DrawCompound( LabelElement *l, Ttk_Box b, Tk_Window tkwin, Drawable d, Ttk_State state, int imageSide, int textSide) { Ttk_Box imageBox = Ttk_PlaceBox(&b, l->image.width, l->image.height, imageSide, 0); Ttk_Box textBox = Ttk_PlaceBox(&b, l->text.width, l->text.height, textSide, 0); ImageDraw(&l->image,tkwin,d,imageBox,state); TextDraw(&l->text,tkwin,d,textBox); } static void LabelElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { LabelElement *l = elementRecord; Tk_Anchor anchor = TK_ANCHOR_CENTER; LabelSetup(l, tkwin, state); /* * Adjust overall parcel based on -anchor: */ Tk_GetAnchorFromObj(NULL, l->text.anchorObj, &anchor); b = Ttk_AnchorBox(b, l->totalWidth, l->totalHeight, anchor); /* * Draw text and/or image parts based on -compound: */ switch (l->compound) { case TTK_COMPOUND_NONE: /* Can't happen */ break; case TTK_COMPOUND_TEXT: TextDraw(&l->text,tkwin,d,b); break; case TTK_COMPOUND_IMAGE: ImageDraw(&l->image,tkwin,d,b,state); break; case TTK_COMPOUND_CENTER: { Ttk_Box pb = Ttk_AnchorBox( b, l->image.width, l->image.height, TK_ANCHOR_CENTER); ImageDraw(&l->image, tkwin, d, pb, state); pb = Ttk_AnchorBox( b, l->text.width, l->text.height, TK_ANCHOR_CENTER); TextDraw(&l->text, tkwin, d, pb); break; } case TTK_COMPOUND_TOP: DrawCompound(l, b, tkwin, d, state, TTK_SIDE_TOP, TTK_SIDE_BOTTOM); break; case TTK_COMPOUND_BOTTOM: DrawCompound(l, b, tkwin, d, state, TTK_SIDE_BOTTOM, TTK_SIDE_TOP); break; case TTK_COMPOUND_LEFT: DrawCompound(l, b, tkwin, d, state, TTK_SIDE_LEFT, TTK_SIDE_RIGHT); break; case TTK_COMPOUND_RIGHT: DrawCompound(l, b, tkwin, d, state, TTK_SIDE_RIGHT, TTK_SIDE_LEFT); break; } LabelCleanup(l); } static Ttk_ElementSpec LabelElementSpec = { TK_STYLE_VERSION_2, sizeof(LabelElement), LabelElementOptions, LabelElementSize, LabelElementDraw }; /*------------------------------------------------------------------------ * +++ Initialization. */ void TtkLabel_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterElement(interp, theme, "text", &TextElementSpec, NULL); Ttk_RegisterElement(interp, theme, "image", &ImageElementSpec, NULL); Ttk_RegisterElement(interp, theme, "label", &LabelElementSpec, NULL); } tile-0.8.2/generic/layout.c0000644000076500007650000007150310724432726015156 0ustar joejoe00000000000000/* * ttkLayout.c -- * * Generic layout processing. * * Copyright (c) 2003 Joe English. Freely redistributable. * * layout.c,v 1.76 2007/12/02 04:34:30 jenglish Exp */ #include #include #include "tkThemeInt.h" #define MAX(a,b) (a > b ? a : b) #define MIN(a,b) (a < b ? a : b) /*------------------------------------------------------------------------ * +++ Ttk_Box and Ttk_Padding utilities: */ Ttk_Box Ttk_MakeBox(int x, int y, int width, int height) { Ttk_Box b; b.x = x; b.y = y; b.width = width; b.height = height; return b; } int Ttk_BoxContains(Ttk_Box box, int x, int y) { return box.x <= x && x < box.x + box.width && box.y <= y && y < box.y + box.height; } Tcl_Obj *Ttk_NewBoxObj(Ttk_Box box) { Tcl_Obj *result[4]; result[0] = Tcl_NewIntObj(box.x); result[1] = Tcl_NewIntObj(box.y); result[2] = Tcl_NewIntObj(box.width); result[3] = Tcl_NewIntObj(box.height); return Tcl_NewListObj(4, result); } /* * packTop, packBottom, packLeft, packRight -- * Carve out a parcel of the specified height (resp width) * from the specified cavity. * * Returns: * The new parcel. * * Side effects: * Adjust the cavity. */ static Ttk_Box packTop(Ttk_Box *cavity, int height) { Ttk_Box parcel; height = MIN(height, cavity->height); parcel = Ttk_MakeBox(cavity->x, cavity->y, cavity->width, height); cavity->y += height; cavity->height -= height; return parcel; } static Ttk_Box packBottom(Ttk_Box *cavity, int height) { height = MIN(height, cavity->height); cavity->height -= height; return Ttk_MakeBox( cavity->x, cavity->y + cavity->height, cavity->width, height); } static Ttk_Box packLeft(Ttk_Box *cavity, int width) { Ttk_Box parcel; width = MIN(width, cavity->width); parcel = Ttk_MakeBox(cavity->x, cavity->y, width,cavity->height); cavity->x += width; cavity->width -= width; return parcel; } static Ttk_Box packRight(Ttk_Box *cavity, int width) { width = MIN(width, cavity->width); cavity->width -= width; return Ttk_MakeBox(cavity->x + cavity->width, cavity->y, width, cavity->height); } /* * Ttk_PackBox -- * Carve out a parcel of the specified size on the specified side * in the specified cavity. * * Returns: * The new parcel. * * Side effects: * Adjust the cavity. */ Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int width, int height, Ttk_Side side) { switch (side) { default: case TTK_SIDE_TOP: return packTop(cavity, height); case TTK_SIDE_BOTTOM: return packBottom(cavity, height); case TTK_SIDE_LEFT: return packLeft(cavity, width); case TTK_SIDE_RIGHT: return packRight(cavity, width); } } /* * Ttk_PadBox -- * Shrink a box by the specified padding amount. */ Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p) { b.x += p.left; b.y += p.top; b.width -= (p.left + p.right); b.height -= (p.top + p.bottom); if (b.width <= 0) b.width = 1; if (b.height <= 0) b.height = 1; return b; } /* * Ttk_ExpandBox -- * Grow a box by the specified padding amount. */ Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p) { b.x -= p.left; b.y -= p.top; b.width += (p.left + p.right); b.height += (p.top + p.bottom); return b; } /* * Ttk_StickBox -- * Place a box of size w * h in the specified parcel, * according to the specified sticky bits. */ Ttk_Box Ttk_StickBox(Ttk_Box parcel, int width, int height, unsigned sticky) { int dx, dy; if (width > parcel.width) width = parcel.width; if (height > parcel.height) height = parcel.height; dx = parcel.width - width; dy = parcel.height - height; /* * X coordinate adjustment: */ switch (sticky & (TTK_STICK_W | TTK_STICK_E)) { case TTK_STICK_W | TTK_STICK_E: /* no-op -- use entire parcel width */ break; case TTK_STICK_W: parcel.width = width; break; case TTK_STICK_E: parcel.x += dx; parcel.width = width; break; default : parcel.x += dx / 2; parcel.width = width; break; } /* * Y coordinate adjustment: */ switch (sticky & (TTK_STICK_N | TTK_STICK_S)) { case TTK_STICK_N | TTK_STICK_S: /* use entire parcel height */ break; case TTK_STICK_N: parcel.height = height; break; case TTK_STICK_S: parcel.y += dy; parcel.height = height; break; default : parcel.y += dy / 2; parcel.height = height; break; } return parcel; } /* * AnchorToSticky -- * Convert a Tk_Anchor enum to a TTK_STICKY bitmask. */ static Ttk_Sticky AnchorToSticky(Tk_Anchor anchor) { switch (anchor) { case TK_ANCHOR_N: return TTK_STICK_N; case TK_ANCHOR_NE: return TTK_STICK_N | TTK_STICK_E; case TK_ANCHOR_E: return TTK_STICK_E; case TK_ANCHOR_SE: return TTK_STICK_S | TTK_STICK_E; case TK_ANCHOR_S: return TTK_STICK_S; case TK_ANCHOR_SW: return TTK_STICK_S | TTK_STICK_W; case TK_ANCHOR_W: return TTK_STICK_W; case TK_ANCHOR_NW: return TTK_STICK_N | TTK_STICK_W; default: case TK_ANCHOR_CENTER: return 0; } } /* * Ttk_AnchorBox -- * Place a box of size w * h in the specified parcel, * according to the specified anchor. */ Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int width, int height, Tk_Anchor anchor) { return Ttk_StickBox(parcel, width, height, AnchorToSticky(anchor)); } /* * Ttk_PlaceBox -- * Combine Ttk_PackBox() and Ttk_StickBox(). */ Ttk_Box Ttk_PlaceBox( Ttk_Box *cavity, int width, int height, Ttk_Side side, unsigned sticky) { return Ttk_StickBox( Ttk_PackBox(cavity, width, height, side), width, height, sticky); } /* * Ttk_PositionBox -- * Pack and stick a box according to PositionSpec flags. */ TTKAPI Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int width, int height, Ttk_PositionSpec flags) { Ttk_Box parcel; if (flags & TTK_EXPAND) parcel = *cavity; else if (flags & TTK_PACK_TOP) parcel = packTop(cavity, height); else if (flags & TTK_PACK_LEFT) parcel = packLeft(cavity, width); else if (flags & TTK_PACK_BOTTOM) parcel = packBottom(cavity, height); else if (flags & TTK_PACK_RIGHT) parcel = packRight(cavity, width); else parcel = *cavity; return Ttk_StickBox(parcel, width, height, flags); } /* * TTKInitPadding -- * Common factor of Ttk_GetPaddingFromObj and Ttk_GetBorderFromObj. * Initializes Ttk_Padding record, supplying default values * for missing entries. */ static void TTKInitPadding(int padc, int pixels[4], Ttk_Padding *pad) { switch (padc) { case 0: pixels[0] = 0; /*FALLTHRU*/ case 1: pixels[1] = pixels[0]; /*FALLTHRU*/ case 2: pixels[2] = pixels[0]; /*FALLTHRU*/ case 3: pixels[3] = pixels[1]; /*FALLTHRU*/ } pad->left = (short)pixels[0]; pad->top = (short)pixels[1]; pad->right = (short)pixels[2]; pad->bottom = (short)pixels[3]; } /* * Ttk_GetPaddingFromObj -- * * Extract a padding specification from a Tcl_Obj * scaled * to work with a particular Tk_Window. * * The string representation of a Ttk_Padding is a list * of one to four Tk_Pixel specifications, corresponding * to the left, top, right, and bottom padding. * * If the 'bottom' (fourth) element is missing, it defaults to 'top'. * If the 'right' (third) element is missing, it defaults to 'left'. * If the 'top' (second) element is missing, it defaults to 'left'. * * The internal representation is a Tcl_ListObj containing * one to four Tk_PixelObj objects. * * Returns: * TCL_OK or TCL_ERROR. In the latter case an error message is * left in 'interp' and '*paddingPtr' is set to all-zeros. * Otherwise, *paddingPtr is filled in with the padding specification. * */ int Ttk_GetPaddingFromObj( Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Ttk_Padding *pad) { Tcl_Obj **padv; int i, padc, pixels[4]; if (TCL_OK != Tcl_ListObjGetElements(interp, objPtr, &padc, &padv)) { goto error; } if (padc > 4) { if (interp) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Wrong #elements in padding spec", NULL); } goto error; } for (i=0; i < padc; ++i) { if (Tk_GetPixelsFromObj(interp, tkwin, padv[i], &pixels[i]) != TCL_OK) { goto error; } } TTKInitPadding(padc, pixels, pad); return TCL_OK; error: pad->left = pad->top = pad->right = pad->bottom = 0; return TCL_ERROR; } /* Ttk_GetBorderFromObj -- * Same as Ttk_GetPaddingFromObj, except padding is a list of integers * instead of Tk_Pixel specifications. Does not require a Tk_Window * parameter. * */ int Ttk_GetBorderFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *pad) { Tcl_Obj **padv; int i, padc, pixels[4]; if (TCL_OK != Tcl_ListObjGetElements(interp, objPtr, &padc, &padv)) { goto error; } if (padc > 4) { if (interp) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Wrong #elements in border spec", NULL); } goto error; } for (i=0; i < padc; ++i) { if (Tcl_GetIntFromObj(interp, padv[i], &pixels[i]) != TCL_OK) { goto error; } } TTKInitPadding(padc, pixels, pad); return TCL_OK; error: pad->left = pad->top = pad->right = pad->bottom = 0; return TCL_ERROR; } /* * Ttk_MakePadding -- * Return an initialized Ttk_Padding structure. */ Ttk_Padding Ttk_MakePadding(short left, short top, short right, short bottom) { Ttk_Padding pad; pad.left = left; pad.top = top; pad.right = right; pad.bottom = bottom; return pad; } /* * Ttk_UniformPadding -- * Returns a uniform Ttk_Padding structure, with the same * border width on all sides. */ Ttk_Padding Ttk_UniformPadding(short borderWidth) { Ttk_Padding pad; pad.left = pad.top = pad.right = pad.bottom = borderWidth; return pad; } /* * Ttk_AddPadding -- * Combine two padding records. */ Ttk_Padding Ttk_AddPadding(Ttk_Padding p1, Ttk_Padding p2) { p1.left += p2.left; p1.top += p2.top; p1.right += p2.right; p1.bottom += p2.bottom; return p1; } /* Ttk_RelievePadding -- * Add an extra n pixels of padding according to specified relief. * This may be used in element geometry procedures to simulate * a "pressed-in" look for pushbuttons. */ Ttk_Padding Ttk_RelievePadding(Ttk_Padding padding, int relief, int n) { switch (relief) { case TK_RELIEF_RAISED: padding.right += n; padding.bottom += n; break; case TK_RELIEF_SUNKEN: /* shift */ padding.left += n; padding.top += n; break; default: { int h1 = n/2, h2 = h1 + n % 2; padding.left += h1; padding.top += h1; padding.right += h2; padding.bottom += h2; break; } } return padding; } /* * Ttk_GetStickyFromObj -- * Returns a stickiness specification from the specified Tcl_Obj*, * consisting of any combination of n, s, e, and w. * * Returns: TCL_OK if objPtr holds a valid stickiness specification, * otherwise TCL_ERROR. interp is used for error reporting if non-NULL. * */ int Ttk_GetStickyFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Sticky *result) { const char *string = Tcl_GetString(objPtr); Ttk_Sticky sticky = 0; char c; while ((c = *string++) != '\0') { switch (c) { case 'w': case 'W': sticky |= TTK_STICK_W; break; case 'e': case 'E': sticky |= TTK_STICK_E; break; case 'n': case 'N': sticky |= TTK_STICK_N; break; case 's': case 'S': sticky |= TTK_STICK_S; break; default: if (interp) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Bad -sticky specification ", Tcl_GetString(objPtr), NULL); } return TCL_ERROR; } } *result = sticky; return TCL_OK; } /* Ttk_NewStickyObj -- * Construct a new Tcl_Obj * containing a stickiness specification. */ Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky sticky) { char buf[5]; char *p = buf; if (sticky & TTK_STICK_N) *p++ = 'n'; if (sticky & TTK_STICK_S) *p++ = 's'; if (sticky & TTK_STICK_W) *p++ = 'w'; if (sticky & TTK_STICK_E) *p++ = 'e'; *p = '\0'; return Tcl_NewStringObj(buf, p - buf); } /*------------------------------------------------------------------------ * +++ Layout nodes. */ struct Ttk_LayoutNode_ { unsigned flags; /* Packing and sticky flags */ Ttk_ElementImpl element; /* Element implementation */ Ttk_State state; /* Current state */ Ttk_Box parcel; /* allocated parcel */ Ttk_LayoutNode *next, *child; }; static Ttk_LayoutNode *Ttk_NewLayoutNode(unsigned flags, Ttk_ElementImpl element) { Ttk_LayoutNode *node = (Ttk_LayoutNode*)ckalloc(sizeof(Ttk_LayoutNode)); node->flags = flags; node->element = element; node->state = 0u; node->next = node->child = 0; /* parcel uninitialized */ return node; } static void Ttk_FreeLayoutNode(Ttk_LayoutNode *node) { while (node) { Ttk_LayoutNode *next = node->next; Ttk_FreeLayoutNode(node->child); ckfree((ClientData)node); node = next; } } /*------------------------------------------------------------------------ * +++ Layout templates. */ struct Ttk_TemplateNode_ { char *name; unsigned flags; struct Ttk_TemplateNode_ *next, *child; }; static Ttk_TemplateNode *Ttk_NewTemplateNode(const char *name, unsigned flags) { Ttk_TemplateNode *op = (Ttk_TemplateNode*)ckalloc(sizeof(*op)); op->name = ckalloc(strlen(name) + 1); strcpy(op->name, name); op->flags = flags; op->next = op->child = 0; return op; } void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate op) { while (op) { Ttk_LayoutTemplate next = op->next; Ttk_FreeLayoutTemplate(op->child); ckfree(op->name); ckfree((ClientData)op); op = next; } } /* InstantiateLayout -- * Create a layout tree from a template. */ static Ttk_LayoutNode * Ttk_InstantiateLayout(Ttk_Theme theme, Ttk_TemplateNode *op) { Ttk_ElementImpl elementImpl = Ttk_GetElement(theme, op->name); Ttk_LayoutNode *node = Ttk_NewLayoutNode(op->flags, elementImpl); if (op->next) { node->next = Ttk_InstantiateLayout(theme,op->next); } if (op->child) { node->child = Ttk_InstantiateLayout(theme,op->child); } return node; } /* * Ttk_ParseLayoutTemplate -- * Convert a Tcl list into a layout template. * * Syntax: * layoutSpec ::= { elementName ?-option value ...? }+ */ /* NB: This must match bit definitions TTK_PACK_LEFT etc. */ static const char *packSideStrings[] = { "left", "right", "top", "bottom", NULL }; Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr) { enum { OP_SIDE, OP_STICKY, OP_EXPAND, OP_BORDER, OP_UNIT, OP_CHILDREN }; static const char *optStrings[] = { "-side", "-sticky", "-expand", "-border", "-unit", "-children", 0 }; int i = 0, objc; Tcl_Obj **objv; Ttk_TemplateNode *head = 0, *tail = 0; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) return 0; while (i < objc) { char *elementName = Tcl_GetString(objv[i]); unsigned flags = 0x0, sticky = TTK_FILL_BOTH; Tcl_Obj *childSpec = 0; /* * Parse options: */ ++i; while (i < objc) { const char *optName = Tcl_GetString(objv[i]); int option, value; if (optName[0] != '-') break; if (Tcl_GetIndexFromObj( interp, objv[i], optStrings, "option", 0, &option) != TCL_OK) { goto error; } if (++i >= objc) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Missing value for option ",Tcl_GetString(objv[i-1]), NULL); goto error; } switch (option) { case OP_SIDE: /* <> */ if (Tcl_GetIndexFromObj(interp, objv[i], packSideStrings, "side", 0, &value) != TCL_OK) { goto error; } flags |= (TTK_PACK_LEFT << value); break; case OP_STICKY: if (Ttk_GetStickyFromObj(interp,objv[i],&sticky) != TCL_OK) goto error; break; case OP_EXPAND: if (Tcl_GetBooleanFromObj(interp,objv[i],&value) != TCL_OK) goto error; if (value) flags |= TTK_EXPAND; break; case OP_BORDER: if (Tcl_GetBooleanFromObj(interp,objv[i],&value) != TCL_OK) goto error; if (value) flags |= TTK_BORDER; break; case OP_UNIT: if (Tcl_GetBooleanFromObj(interp,objv[i],&value) != TCL_OK) goto error; if (value) flags |= TTK_UNIT; break; case OP_CHILDREN: childSpec = objv[i]; break; } ++i; } /* * Build new node: */ if (tail) { tail->next = Ttk_NewTemplateNode(elementName, flags | sticky); tail = tail->next; } else { head = tail = Ttk_NewTemplateNode(elementName, flags | sticky); } if (childSpec) { tail->child = Ttk_ParseLayoutTemplate(interp, childSpec); if (!tail->child) { goto error; } } } return head; error: Ttk_FreeLayoutTemplate(head); return 0; } /* Ttk_BuildLayoutTemplate -- * Build a layout template tree from a statically defined * Ttk_LayoutSpec array. */ Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec spec) { Ttk_TemplateNode *first = 0, *last = 0; for ( ; !(spec->opcode & _TTK_LAYOUT_END) ; ++spec) { if (spec->elementName) { Ttk_TemplateNode *node = Ttk_NewTemplateNode(spec->elementName, spec->opcode); if (last) { last->next = node; } else { first = node; } last = node; } if (spec->opcode & _TTK_CHILDREN) { int depth = 1; last->child = Ttk_BuildLayoutTemplate(spec+1); /* Skip to end of group: */ while (depth) { ++spec; if (spec->opcode & _TTK_CHILDREN) { ++depth; } if (spec->opcode & _TTK_LAYOUT_END) { --depth; } } } } /* for */ return first; } void Ttk_RegisterLayouts(Ttk_Theme theme, Ttk_LayoutSpec spec) { while (!(spec->opcode & _TTK_LAYOUT_END)) { Ttk_LayoutTemplate layoutTemplate = Ttk_BuildLayoutTemplate(spec+1); Ttk_RegisterLayoutTemplate(theme, spec->elementName, layoutTemplate); do { ++spec; } while (!(spec->opcode & _TTK_LAYOUT)); } } Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node) { Tcl_Obj *result = Tcl_NewListObj(0,0); # define APPENDOBJ(obj) Tcl_ListObjAppendElement(NULL, result, obj) # define APPENDSTR(str) APPENDOBJ(Tcl_NewStringObj(str,-1)) while (node) { unsigned flags = node->flags; APPENDSTR(node->name); /* Back-compute -side. <> * @@@ NOTES: Ick. */ if (flags & TTK_EXPAND) { APPENDSTR("-expand"); APPENDSTR("1"); } else { if (flags & _TTK_MASK_PACK) { int side = 0; unsigned sideFlags = flags & _TTK_MASK_PACK; while ((sideFlags & TTK_PACK_LEFT) == 0) { ++side; sideFlags >>= 1; } APPENDSTR("-side"); APPENDSTR(packSideStrings[side]); } } /* In Ttk_ParseLayoutTemplate, default -sticky is "nsew", * so always include this even if no sticky bits are set. */ APPENDSTR("-sticky"); APPENDOBJ(Ttk_NewStickyObj(flags & _TTK_MASK_STICK)); /* @@@ Check again: are these necessary? */ if (flags & TTK_BORDER) { APPENDSTR("-border"); APPENDSTR("1"); } if (flags & TTK_UNIT) { APPENDSTR("-unit"); APPENDSTR("1"); } if (node->child) { APPENDSTR("-children"); APPENDOBJ(Ttk_UnparseLayoutTemplate(node->child)); } node = node->next; } # undef APPENDOBJ # undef APPENDSTR return result; } /*------------------------------------------------------------------------ * +++ Layouts. */ struct Ttk_Layout_ { Ttk_Style style; void *recordPtr; Tk_OptionTable optionTable; Tk_Window tkwin; Ttk_LayoutNode *root; }; static Ttk_Layout TTKNewLayout( Ttk_Style style, void *recordPtr,Tk_OptionTable optionTable, Tk_Window tkwin, Ttk_LayoutNode *root) { Ttk_Layout layout = (Ttk_Layout)ckalloc(sizeof(*layout)); layout->style = style; layout->recordPtr = recordPtr; layout->optionTable = optionTable; layout->tkwin = tkwin; layout->root = root; return layout; } void Ttk_FreeLayout(Ttk_Layout layout) { Ttk_FreeLayoutNode(layout->root); ckfree((ClientData)layout); } /* * Ttk_CreateLayout -- * Create a layout from the specified theme and style name. * Returns: New layout, 0 on error. * Leaves an error message in interp's result if there is an error. */ Ttk_Layout Ttk_CreateLayout( Tcl_Interp *interp, /* where to leave error messages */ Ttk_Theme themePtr, const char *styleName, void *recordPtr, Tk_OptionTable optionTable, Tk_Window tkwin) { Ttk_Style style = Ttk_GetStyle(themePtr, styleName); Ttk_LayoutTemplate layoutTemplate = Ttk_FindLayoutTemplate(themePtr,styleName); Ttk_ElementImpl bgelement = Ttk_GetElement(themePtr, "background"); Ttk_LayoutNode *bgnode; if (!layoutTemplate) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Layout ", styleName, " not found", NULL); return 0; } bgnode = Ttk_NewLayoutNode(TTK_FILL_BOTH, bgelement); bgnode->next = Ttk_InstantiateLayout(themePtr, layoutTemplate); return TTKNewLayout(style, recordPtr, optionTable, tkwin, bgnode); } /* Ttk_CreateSublayout -- * Creates a new sublayout. * * Sublayouts are used to draw subparts of a compound widget. * They use the same Tk_Window, but a different option table * and data record. */ Ttk_Layout Ttk_CreateSublayout( Tcl_Interp *interp, Ttk_Theme themePtr, Ttk_Layout parentLayout, const char *baseName, Tk_OptionTable optionTable) { Tcl_DString buf; const char *styleName; Ttk_Style style; Ttk_LayoutTemplate layoutTemplate; Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, Ttk_StyleName(parentLayout->style), -1); Tcl_DStringAppend(&buf, baseName, -1); styleName = Tcl_DStringValue(&buf); style = Ttk_GetStyle(themePtr, styleName); layoutTemplate = Ttk_FindLayoutTemplate(themePtr, styleName); if (!layoutTemplate) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Layout ", styleName, " not found", NULL); return 0; } Tcl_DStringFree(&buf); return TTKNewLayout( style, 0, optionTable, parentLayout->tkwin, Ttk_InstantiateLayout(themePtr, layoutTemplate)); } /* Ttk_RebindSublayout -- * Bind sublayout to new data source. */ void Ttk_RebindSublayout(Ttk_Layout layout, void *recordPtr) { layout->recordPtr = recordPtr; } /* * Ttk_QueryOption -- * Look up an option from a layout's associated option. */ Tcl_Obj *Ttk_QueryOption( Ttk_Layout layout, const char *optionName, Ttk_State state) { return Ttk_QueryStyle( layout->style,layout->recordPtr,layout->optionTable,optionName,state); } /*------------------------------------------------------------------------ * +++ Size computation. */ static void Ttk_NodeListSize( Ttk_Layout layout, Ttk_LayoutNode *node, Ttk_State state, int *widthPtr, int *heightPtr); /* Forward */ static void Ttk_NodeSize( Ttk_Layout layout, Ttk_LayoutNode *node, Ttk_State state, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int elementWidth, elementHeight, subWidth, subHeight; Ttk_Padding elementPadding; Ttk_ElementSize(node->element, layout->style, layout->recordPtr,layout->optionTable, layout->tkwin, state|node->state, &elementWidth, &elementHeight, &elementPadding); Ttk_NodeListSize(layout,node->child,state,&subWidth,&subHeight); subWidth += Ttk_PaddingWidth(elementPadding); subHeight += Ttk_PaddingHeight(elementPadding); *widthPtr = MAX(elementWidth, subWidth); *heightPtr = MAX(elementHeight, subHeight); *paddingPtr = elementPadding; } static void Ttk_NodeListSize( Ttk_Layout layout, Ttk_LayoutNode *node, Ttk_State state, int *widthPtr, int *heightPtr) { if (!node) { *widthPtr = *heightPtr = 0; } else { int width, height, restWidth, restHeight; Ttk_Padding unused; Ttk_NodeSize(layout, node, state, &width, &height, &unused); Ttk_NodeListSize(layout, node->next, state, &restWidth, &restHeight); if (node->flags & (TTK_PACK_LEFT|TTK_PACK_RIGHT)) { *widthPtr = width + restWidth; } else { *widthPtr = MAX(width, restWidth); } if (node->flags & (TTK_PACK_TOP|TTK_PACK_BOTTOM)) { *heightPtr = height + restHeight; } else { *heightPtr = MAX(height, restHeight); } } } /* * Ttk_LayoutNodeInternalPadding -- * Returns the internal padding of a layout node. */ Ttk_Padding Ttk_LayoutNodeInternalPadding( Ttk_Layout layout, Ttk_LayoutNode *node) { int unused; Ttk_Padding padding; Ttk_ElementSize(node->element, layout->style, layout->recordPtr, layout->optionTable, layout->tkwin, 0/*state*/, &unused, &unused, &padding); return padding; } /* * Ttk_LayoutNodeInternalParcel -- * Returns the inner area of a specified layout node, * based on current parcel and element's internal padding. */ Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout layout, Ttk_LayoutNode *node) { Ttk_Padding padding = Ttk_LayoutNodeInternalPadding(layout, node); return Ttk_PadBox(node->parcel, padding); } /* Ttk_LayoutSize -- * Compute requested size of a layout. */ void Ttk_LayoutSize( Ttk_Layout layout, Ttk_State state, int *widthPtr, int *heightPtr) { Ttk_NodeListSize(layout, layout->root, state, widthPtr, heightPtr); } void Ttk_LayoutNodeReqSize( /* @@@ Rename this */ Ttk_Layout layout, Ttk_LayoutNode *node, int *widthPtr, int *heightPtr) { Ttk_Padding unused; Ttk_NodeSize(layout, node, 0/*state*/, widthPtr, heightPtr, &unused); } /*------------------------------------------------------------------------ * +++ Layout placement. */ /* Ttk_PlaceNodeList -- * Compute parcel for each node in a layout tree * according to position specification and overall size. */ static void Ttk_PlaceNodeList( Ttk_Layout layout, Ttk_LayoutNode *node, Ttk_State state, Ttk_Box cavity) { for (; node; node = node->next) { int width, height; Ttk_Padding padding; /* Compute node size: (@@@ cache this instead?) */ Ttk_NodeSize(layout, node, state, &width, &height, &padding); /* Compute parcel: */ node->parcel = Ttk_PositionBox(&cavity, width, height, node->flags); /* Place child nodes: */ if (node->child) { Ttk_Box childBox = Ttk_PadBox(node->parcel, padding); Ttk_PlaceNodeList(layout,node->child, state, childBox); } } } void Ttk_PlaceLayout(Ttk_Layout layout, Ttk_State state, Ttk_Box b) { Ttk_PlaceNodeList(layout, layout->root, state, b); } /*------------------------------------------------------------------------ * +++ Layout drawing. */ /* * Ttk_DrawLayout -- * Draw a layout tree. */ static void Ttk_DrawNodeList( Ttk_Layout layout, Ttk_State state, Ttk_LayoutNode *node, Drawable d) { for (; node; node = node->next) { int border = node->flags & TTK_BORDER; int substate = state; if (node->flags & TTK_UNIT) substate |= node->state; if (node->child && border) Ttk_DrawNodeList(layout, substate, node->child, d); Ttk_DrawElement( node->element, layout->style,layout->recordPtr,layout->optionTable,layout->tkwin, d, node->parcel, state | node->state); if (node->child && !border) Ttk_DrawNodeList(layout, substate, node->child, d); } } void Ttk_DrawLayout(Ttk_Layout layout, Ttk_State state, Drawable d) { Ttk_DrawNodeList(layout, state, layout->root, d); } /*------------------------------------------------------------------------ * +++ Inquiry and modification. */ /* * Ttk_LayoutIdentify -- * Find the layout node at the specified x,y coordinate. */ static Ttk_LayoutNode * Ttk_LayoutNodeIdentify(Ttk_LayoutNode *node, int x, int y) { Ttk_LayoutNode *closest = NULL; for (; node; node = node->next) { if (Ttk_BoxContains(node->parcel, x, y)) { closest = node; if (node->child && !(node->flags & TTK_UNIT)) { Ttk_LayoutNode *childNode = Ttk_LayoutNodeIdentify(node->child, x,y); if (childNode) { closest = childNode; } } } } return closest; } Ttk_LayoutNode *Ttk_LayoutIdentify(Ttk_Layout layout, int x, int y) { return Ttk_LayoutNodeIdentify(layout->root, x, y); } /* * tail -- * Return the last component of an element name, e.g., * "Scrollbar.thumb" => "thumb" */ static const char *tail(const char *elementName) { const char *dot; while ((dot=strchr(elementName,'.')) != NULL) elementName = dot + 1; return elementName; } /* * Ttk_LayoutFindNode -- * Look up a layout node by name. */ static Ttk_LayoutNode * Ttk_LayoutNodeFind(Ttk_LayoutNode *node, const char *nodeName) { for (; node ; node = node->next) { if (!strcmp(tail(Ttk_LayoutNodeName(node)), nodeName)) return node; if (node->child) { Ttk_LayoutNode *childNode = Ttk_LayoutNodeFind(node->child, nodeName); if (childNode) return childNode; } } return 0; } Ttk_LayoutNode *Ttk_LayoutFindNode(Ttk_Layout layout, const char *nodeName) { return Ttk_LayoutNodeFind(layout->root, nodeName); } const char *Ttk_LayoutNodeName(Ttk_LayoutNode *node) { return Ttk_ElementName(node->element); } Ttk_Box Ttk_LayoutNodeParcel(Ttk_LayoutNode *node) { return node->parcel; } void Ttk_PlaceLayoutNode(Ttk_Layout layout, Ttk_LayoutNode *node, Ttk_Box b) { node->parcel = b; if (node->child) { Ttk_PlaceNodeList(layout, node->child, 0, Ttk_PadBox(b, Ttk_LayoutNodeInternalPadding(layout, node))); } } void Ttk_ChangeElementState(Ttk_LayoutNode *node,unsigned set,unsigned clr) { node->state = (node->state | set) & ~clr; } /*EOF*/ tile-0.8.2/generic/manager.c0000644000076500007650000003454710722327025015253 0ustar joejoe00000000000000/* manager.c,v 1.14 2007/11/25 17:17:09 jenglish Exp * * Copyright 2005, Joe English. Freely redistributable. * * Support routines for geometry managers. */ #include #include #include "manager.h" /*------------------------------------------------------------------------ * +++ The Geometry Propagation Dance. * * When a slave window requests a new size or some other parameter changes, * the manager recomputes the required size for the master window and calls * Tk_GeometryRequest(). This is scheduled as an idle handler so multiple * updates can be processed as a single batch. * * If all goes well, the master's manager will process the request * (and so on up the chain to the toplevel window), and the master * window will eventually receive a event. At this point * it recomputes the size and position of all slaves and places them. * * If all does not go well, however, the master's request may be ignored * (typically because the top-level window has a fixed, user-specified size). * Tk doesn't provide any notification when this happens; to account for this, * we also schedule an idle handler to call the layout procedure * after making a geometry request. * * +++ Slave removal <>. * * There are three conditions under which a slave is removed: * * (1) Another GM claims control * (2) Manager voluntarily relinquishes control * (3) Slave is destroyed * * In case (1), Tk calls the manager's lostSlaveProc. * Case (2) is performed by calling Tk_ManageGeometry(slave,NULL,0); * in this case Tk does _not_ call the LostSlaveProc (documented behavior). * Tk doesn't handle case (3) either; to account for that we * register an event handler on the slave widget to track events. */ /* ++ Data structures. */ typedef struct { Tk_Window slaveWindow; Ttk_Manager *manager; void *slaveData; unsigned flags; } Ttk_Slave; /* slave->flags bits: */ #define SLAVE_MAPPED 0x1 /* slave to be mapped when master is */ struct TtkManager_ { Ttk_ManagerSpec *managerSpec; void *managerData; Tk_Window masterWindow; unsigned flags; int nSlaves; Ttk_Slave **slaves; }; /* manager->flags bits: */ #define MGR_UPDATE_PENDING 0x1 #define MGR_RESIZE_REQUIRED 0x2 #define MGR_RELAYOUT_REQUIRED 0x4 static void ManagerIdleProc(void *); /* forward */ /* ++ ScheduleUpdate -- * Schedule a call to recompute the size and/or layout, * depending on flags. */ static void ScheduleUpdate(Ttk_Manager *mgr, unsigned flags) { if (!(mgr->flags & MGR_UPDATE_PENDING)) { Tcl_DoWhenIdle(ManagerIdleProc, mgr); mgr->flags |= MGR_UPDATE_PENDING; } mgr->flags |= flags; } /* ++ RecomputeSize -- * Recomputes the required size of the master window, * makes geometry request. */ static void RecomputeSize(Ttk_Manager *mgr) { int width = 1, height = 1; if (mgr->managerSpec->RequestedSize(mgr->managerData, &width, &height)) { Tk_GeometryRequest(mgr->masterWindow, width, height); ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED); } mgr->flags &= ~MGR_RESIZE_REQUIRED; } /* ++ RecomputeLayout -- * Recompute geometry of all slaves. */ static void RecomputeLayout(Ttk_Manager *mgr) { mgr->managerSpec->PlaceSlaves(mgr->managerData); mgr->flags &= ~MGR_RELAYOUT_REQUIRED; } /* ++ ManagerIdleProc -- * DoWhenIdle procedure for deferred updates. */ static void ManagerIdleProc(ClientData clientData) { Ttk_Manager *mgr = clientData; mgr->flags &= ~MGR_UPDATE_PENDING; if (mgr->flags & MGR_RESIZE_REQUIRED) { RecomputeSize(mgr); } if (mgr->flags & MGR_RELAYOUT_REQUIRED) { if (mgr->flags & MGR_UPDATE_PENDING) { /* RecomputeSize has scheduled another update; relayout later */ return; } RecomputeLayout(mgr); } } /*------------------------------------------------------------------------ * +++ Event handlers. */ /* ++ ManagerEventHandler -- * Recompute slave layout when master widget is resized. * Keep the slave's map state in sync with the master's. */ static const int ManagerEventMask = StructureNotifyMask; static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) { Ttk_Manager *mgr = clientData; int i; switch (eventPtr->type) { case ConfigureNotify: RecomputeLayout(mgr); break; case MapNotify: for (i = 0; i < mgr->nSlaves; ++i) { Ttk_Slave *slave = mgr->slaves[i]; if (slave->flags & SLAVE_MAPPED) { Tk_MapWindow(slave->slaveWindow); } } break; case UnmapNotify: for (i = 0; i < mgr->nSlaves; ++i) { Ttk_Slave *slave = mgr->slaves[i]; Tk_UnmapWindow(slave->slaveWindow); } break; } } /* ++ SlaveEventHandler -- * Notifies manager when a slave is destroyed * (see <>). */ static const unsigned SlaveEventMask = StructureNotifyMask; static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) { Ttk_Slave *slave = clientData; if (eventPtr->type == DestroyNotify) { slave->manager->managerSpec->tkGeomMgr.lostSlaveProc( slave->manager, slave->slaveWindow); } } /*------------------------------------------------------------------------ * +++ Slave initialization and cleanup. */ static Ttk_Slave *NewSlave( Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData) { Ttk_Slave *slave = (Ttk_Slave*)ckalloc(sizeof(*slave)); slave->slaveWindow = slaveWindow; slave->manager = mgr; slave->flags = 0; slave->slaveData = slaveData; return slave; } static void DeleteSlave(Ttk_Slave *slave) { ckfree((ClientData)slave); } /*------------------------------------------------------------------------ * +++ Manager initialization and cleanup. */ Ttk_Manager *Ttk_CreateManager( Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow) { Ttk_Manager *mgr = (Ttk_Manager*)ckalloc(sizeof(*mgr)); mgr->managerSpec = managerSpec; mgr->managerData = managerData; mgr->masterWindow = masterWindow; mgr->nSlaves = 0; mgr->slaves = NULL; mgr->flags = 0; Tk_CreateEventHandler( mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); return mgr; } void Ttk_DeleteManager(Ttk_Manager *mgr) { Tk_DeleteEventHandler( mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); while (mgr->nSlaves > 0) { Ttk_ForgetSlave(mgr, mgr->nSlaves - 1); } if (mgr->slaves) { ckfree((ClientData)mgr->slaves); } Tk_CancelIdleCall(ManagerIdleProc, mgr); ckfree((ClientData)mgr); } /*------------------------------------------------------------------------ * +++ Slave management. */ /* ++ InsertSlave -- * Adds slave to the list of managed windows. */ static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, int index) { int endIndex = mgr->nSlaves++; mgr->slaves = (Ttk_Slave**)ckrealloc( (ClientData)mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *)); while (endIndex > index) { mgr->slaves[endIndex] = mgr->slaves[endIndex - 1]; --endIndex; } mgr->slaves[index] = slave; Tk_ManageGeometry(slave->slaveWindow, &mgr->managerSpec->tkGeomMgr, (ClientData)mgr); Tk_CreateEventHandler(slave->slaveWindow, SlaveEventMask, SlaveEventHandler, (ClientData)slave); ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } /* RemoveSlave -- * Unmanage and delete the slave. * * NOTES/ASSUMPTIONS: * * [1] It's safe to call Tk_UnmapWindow / Tk_UnmaintainGeometry even if this * routine is called from the slave's DestroyNotify event handler. */ static void RemoveSlave(Ttk_Manager *mgr, int index) { Ttk_Slave *slave = mgr->slaves[index]; int i; /* Notify manager: */ mgr->managerSpec->SlaveRemoved(mgr->managerData, index); /* Remove from array: */ --mgr->nSlaves; for (i = index ; i < mgr->nSlaves; ++i) { mgr->slaves[i] = mgr->slaves[i+1]; } /* Clean up: */ Tk_DeleteEventHandler( slave->slaveWindow, SlaveEventMask, SlaveEventHandler, slave); /* Note [1] */ Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow); Tk_UnmapWindow(slave->slaveWindow); DeleteSlave(slave); ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } /*------------------------------------------------------------------------ * +++ Tk_GeomMgr hooks. */ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow) { Ttk_Manager *mgr = clientData; int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); int reqWidth = Tk_ReqWidth(slaveWindow); int reqHeight= Tk_ReqHeight(slaveWindow); if (mgr->managerSpec->SlaveRequest( mgr->managerData, slaveIndex, reqWidth, reqHeight)) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } } void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow) { Ttk_Manager *mgr = clientData; int index = Ttk_SlaveIndex(mgr, slaveWindow); /* ASSERT: index >= 0 */ RemoveSlave(mgr, index); } /*------------------------------------------------------------------------ * +++ Public API. */ /* ++ Ttk_InsertSlave -- * Add a new slave window at the specified index. */ void Ttk_InsertSlave( Ttk_Manager *mgr, int index, Tk_Window tkwin, void *slaveData) { Ttk_Slave *slave = NewSlave(mgr, tkwin, slaveData); InsertSlave(mgr, slave, index); } /* ++ Ttk_ForgetSlave -- * Unmanage the specified slave. */ void Ttk_ForgetSlave(Ttk_Manager *mgr, int slaveIndex) { Tk_Window slaveWindow = mgr->slaves[slaveIndex]->slaveWindow; RemoveSlave(mgr, slaveIndex); Tk_ManageGeometry(slaveWindow, NULL, 0); } /* ++ Ttk_PlaceSlave -- * Set the position and size of the specified slave window. * * NOTES: * Contrary to documentation, Tk_MaintainGeometry doesn't always * map the slave. */ void Ttk_PlaceSlave( Ttk_Manager *mgr, int slaveIndex, int x, int y, int width, int height) { Ttk_Slave *slave = mgr->slaves[slaveIndex]; Tk_MaintainGeometry(slave->slaveWindow,mgr->masterWindow,x,y,width,height); slave->flags |= SLAVE_MAPPED; if (Tk_IsMapped(mgr->masterWindow)) { Tk_MapWindow(slave->slaveWindow); } } /* ++ Ttk_UnmapSlave -- * Unmap the specified slave, but leave it managed. */ void Ttk_UnmapSlave(Ttk_Manager *mgr, int slaveIndex) { Ttk_Slave *slave = mgr->slaves[slaveIndex]; Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow); slave->flags &= ~SLAVE_MAPPED; /* Contrary to documentation, Tk_UnmaintainGeometry doesn't always * unmap the slave: */ Tk_UnmapWindow(slave->slaveWindow); } /* LayoutChanged, SizeChanged -- * Schedule a relayout, resp. resize request. */ void Ttk_ManagerLayoutChanged(Ttk_Manager *mgr) { ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED); } void Ttk_ManagerSizeChanged(Ttk_Manager *mgr) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } /* +++ Accessors. */ int Ttk_NumberSlaves(Ttk_Manager *mgr) { return mgr->nSlaves; } void *Ttk_SlaveData(Ttk_Manager *mgr, int slaveIndex) { return mgr->slaves[slaveIndex]->slaveData; } Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, int slaveIndex) { return mgr->slaves[slaveIndex]->slaveWindow; } /*------------------------------------------------------------------------ * +++ Utility routines. */ /* ++ Ttk_SlaveIndex -- * Returns the index of specified slave window, -1 if not found. */ int Ttk_SlaveIndex(Ttk_Manager *mgr, Tk_Window slaveWindow) { int index; for (index = 0; index < mgr->nSlaves; ++index) if (mgr->slaves[index]->slaveWindow == slaveWindow) return index; return -1; } /* ++ Ttk_GetSlaveIndexFromObj(interp, mgr, objPtr, indexPtr) -- * Return the index of the slave specified by objPtr. * Slaves may be specified as an integer index or * as the name of the managed window. * * Returns: * Standard Tcl completion code. Leaves an error message in case of error. */ int Ttk_GetSlaveIndexFromObj( Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, int *indexPtr) { const char *string = Tcl_GetString(objPtr); int slaveIndex = 0; Tk_Window tkwin; /* Try interpreting as an integer first: */ if (Tcl_GetIntFromObj(NULL, objPtr, &slaveIndex) == TCL_OK) { if (slaveIndex < 0 || slaveIndex >= mgr->nSlaves) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Slave index ", Tcl_GetString(objPtr), " out of bounds", NULL); return TCL_ERROR; } *indexPtr = slaveIndex; return TCL_OK; } /* Try interpreting as a slave window name; */ if ( (*string == '.') && (tkwin = Tk_NameToWindow(interp, string, mgr->masterWindow))) { slaveIndex = Ttk_SlaveIndex(mgr, tkwin); if (slaveIndex < 0) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, string, " is not managed by ", Tk_PathName(mgr->masterWindow), NULL); return TCL_ERROR; } *indexPtr = slaveIndex; return TCL_OK; } Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Invalid slave specification ", string, NULL); return TCL_ERROR; } /* ++ Ttk_ReorderSlave(mgr, fromIndex, toIndex) -- * Change slave order. */ void Ttk_ReorderSlave(Ttk_Manager *mgr, int fromIndex, int toIndex) { Ttk_Slave *moved = mgr->slaves[fromIndex]; /* Shuffle down: */ while (fromIndex > toIndex) { mgr->slaves[fromIndex] = mgr->slaves[fromIndex - 1]; --fromIndex; } /* Or, shuffle up: */ while (fromIndex < toIndex) { mgr->slaves[fromIndex] = mgr->slaves[fromIndex + 1]; ++fromIndex; } /* ASSERT: fromIndex == toIndex */ mgr->slaves[fromIndex] = moved; /* Schedule a relayout. In general, rearranging slaves * may also change the size: */ ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } /* ++ Ttk_Maintainable(interp, slave, master) -- * Utility routine. Verifies that 'master' may be used to maintain * the geometry of 'slave' via Tk_MaintainGeometry: * * + 'master' is either 'slave's parent -OR- * + 'master is a descendant of 'slave's parent. * + 'slave' is not a toplevel window * + 'slave' belongs to the same toplevel as 'master' * * Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'. */ int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master) { Tk_Window ancestor = master, parent = Tk_Parent(slave), sibling = NULL; if (Tk_IsTopLevel(slave) || slave == master) { goto badWindow; } while (ancestor != parent) { if (Tk_IsTopLevel(ancestor)) { goto badWindow; } sibling = ancestor; ancestor = Tk_Parent(ancestor); } return 1; badWindow: Tcl_AppendResult(interp, "can't add ", Tk_PathName(slave), " as slave of ", Tk_PathName(master), NULL); return 0; } tile-0.8.2/generic/manager.h0000644000076500007650000000553510722327025015253 0ustar joejoe00000000000000/* manager.h,v 1.11 2007/11/25 17:17:09 jenglish Exp * * Copyright (c) 2005, Joe English. Freely redistributable. * * Geometry manager utilities. */ #ifndef _TTKMANAGER #define _TTKMANAGER typedef struct TtkManager_ Ttk_Manager; /* * Geometry manager specification record: * * RequestedSize computes the requested size of the master window. * * PlaceSlaves sets the position and size of all managed slaves * by calling Ttk_PlaceSlave(). * * SlaveRemoved() is called immediately before a slave is removed. * NB: the associated slave window may have been destroyed when this * routine is called. * * SlaveRequest() is called when a slave requests a size change. * It should return 1 if the request should propagate, 0 otherwise. */ typedef struct { /* Manager hooks */ Tk_GeomMgr tkGeomMgr; /* "real" Tk Geometry Manager */ int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr); void (*PlaceSlaves)(void *managerData); int (*SlaveRequest)(void *managerData, int slaveIndex, int w, int h); void (*SlaveRemoved)(void *managerData, int slaveIndex); } Ttk_ManagerSpec; /* * Default implementations for Tk_GeomMgr hooks: */ extern void Ttk_GeometryRequestProc(ClientData, Tk_Window slave); extern void Ttk_LostSlaveProc(ClientData, Tk_Window slave); /* * Public API: */ extern Ttk_Manager *Ttk_CreateManager( Ttk_ManagerSpec *, void *managerData, Tk_Window masterWindow); extern void Ttk_DeleteManager(Ttk_Manager *); extern void Ttk_InsertSlave( Ttk_Manager *, int position, Tk_Window, void *slaveData); extern void Ttk_ForgetSlave(Ttk_Manager *, int slaveIndex); extern void Ttk_ReorderSlave(Ttk_Manager *, int fromIndex, int toIndex); /* Rearrange slave positions */ extern void Ttk_PlaceSlave( Ttk_Manager *, int slaveIndex, int x, int y, int width, int height); /* Position and map the slave */ extern void Ttk_UnmapSlave(Ttk_Manager *, int slaveIndex); /* Unmap the slave */ extern void Ttk_ManagerSizeChanged(Ttk_Manager *); extern void Ttk_ManagerLayoutChanged(Ttk_Manager *); /* Notify manager that size (resp. layout) needs to be recomputed */ /* Utilities: */ extern int Ttk_SlaveIndex(Ttk_Manager *, Tk_Window); /* Returns: index in slave array of specified window, -1 if not found */ extern int Ttk_GetSlaveIndexFromObj( Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, int *indexPtr); /* Accessor functions: */ extern int Ttk_NumberSlaves(Ttk_Manager *); /* Returns: number of managed slaves */ extern void *Ttk_SlaveData(Ttk_Manager *, int slaveIndex); /* Returns: client data associated with slave */ extern Tk_Window Ttk_SlaveWindow(Ttk_Manager *, int slaveIndex); /* Returns: slave window */ extern int Ttk_Maintainable(Tcl_Interp *, Tk_Window slave, Tk_Window master); /* Returns: 1 if master can manage slave; 0 otherwise leaving error msg */ #endif /* _TTKMANAGER */ tile-0.8.2/generic/notebook.c0000644000076500007650000011076010722335157015456 0ustar joejoe00000000000000/* notebook.c,v 1.97 2007/11/25 18:09:51 jenglish Exp * Copyright (c) 2004, Joe English */ #include #include #include #include #include "tkTheme.h" #include "widget.h" #include "manager.h" #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) /*------------------------------------------------------------------------ * +++ Tab resources. */ #define DEFAULT_MIN_TAB_WIDTH 24 static const char *TabStateStrings[] = { "normal", "disabled", "hidden", 0 }; typedef enum { TAB_STATE_NORMAL, TAB_STATE_DISABLED, TAB_STATE_HIDDEN } TAB_STATE; typedef struct { /* Internal data: */ int width, height; /* Requested size of tab */ Ttk_Box parcel; /* Tab position */ /* Tab options: */ TAB_STATE state; /* Child window options: */ Tcl_Obj *paddingObj; /* Padding inside pane */ Ttk_Padding padding; Tcl_Obj *stickyObj; Ttk_Sticky sticky; /* Label options: */ Tcl_Obj *textObj; Tcl_Obj *imageObj; Tcl_Obj *compoundObj; Tcl_Obj *underlineObj; } Tab; /* Two different option tables are used for tabs: * TabOptionSpecs is used to draw the tab, and only includes resources * relevant to the tab. * * PaneOptionSpecs includes additional options for child window placement * and is used to configure the slave. */ static Tk_OptionSpec TabOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-state", "", "", "normal", -1,Tk_Offset(Tab,state), 0,(ClientData)TabStateStrings,0 }, {TK_OPTION_STRING, "-text", "text", "Text", "", Tk_Offset(Tab,textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/, Tk_Offset(Tab,imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", "none", Tk_Offset(Tab,compoundObj), -1, 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", Tk_Offset(Tab,underlineObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_END} }; static Tk_OptionSpec PaneOptionSpecs[] = { {TK_OPTION_STRING, "-padding", "padding", "Padding", "0", Tk_Offset(Tab,paddingObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-sticky", "sticky", "Sticky", "nsew", Tk_Offset(Tab,stickyObj), -1, 0,0,GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(TabOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Notebook resources. */ typedef struct { Tcl_Obj *widthObj; /* Default width */ Tcl_Obj *heightObj; /* Default height */ Tcl_Obj *paddingObj; /* Padding around notebook */ Ttk_Manager *mgr; /* Geometry manager */ Tk_OptionTable tabOptionTable; /* Tab options */ Tk_OptionTable paneOptionTable; /* Tab+pane options */ int currentIndex; /* index of currently selected tab */ int activeIndex; /* index of currently active tab */ Ttk_Layout tabLayout; /* Sublayout for tabs */ Ttk_Box clientArea; /* Where to pack slave widgets */ } NotebookPart; typedef struct { WidgetCore core; NotebookPart notebook; } Notebook; static Tk_OptionSpec NotebookOptionSpecs[] = { WIDGET_TAKES_FOCUS, {TK_OPTION_INT, "-width", "width", "Width", "0", Tk_Offset(Notebook,notebook.widthObj),-1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-height", "height", "Height", "0", Tk_Offset(Notebook,notebook.heightObj),-1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Padding", NULL, Tk_Offset(Notebook,notebook.paddingObj),-1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* Notebook style options: */ typedef struct { Ttk_PositionSpec tabPosition; /* Where to place tabs */ Ttk_Padding tabMargins; /* Margins around tab row */ Ttk_PositionSpec tabPlacement; /* How to pack tabs within tab row */ Ttk_Orient tabOrient; /* ... */ int minTabWidth; /* Minimum tab width */ Ttk_Padding padding; /* External padding */ } NotebookStyle; static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle) { Tcl_Obj *objPtr; nbstyle->tabPosition = TTK_PACK_TOP | TTK_STICK_W; if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabposition", 0)) != 0) { TtkGetLabelAnchorFromObj(NULL, objPtr, &nbstyle->tabPosition); } /* compute tabPlacement and tabOrient as function of tabPosition: */ if (nbstyle->tabPosition & TTK_PACK_LEFT) { nbstyle->tabPlacement = TTK_PACK_TOP | TTK_STICK_E; nbstyle->tabOrient = TTK_ORIENT_VERTICAL; } else if (nbstyle->tabPosition & TTK_PACK_RIGHT) { nbstyle->tabPlacement = TTK_PACK_TOP | TTK_STICK_W; nbstyle->tabOrient = TTK_ORIENT_VERTICAL; } else if (nbstyle->tabPosition & TTK_PACK_BOTTOM) { nbstyle->tabPlacement = TTK_PACK_LEFT | TTK_STICK_N; nbstyle->tabOrient = TTK_ORIENT_HORIZONTAL; } else { /* Assume TTK_PACK_TOP */ nbstyle->tabPlacement = TTK_PACK_LEFT | TTK_STICK_S; nbstyle->tabOrient = TTK_ORIENT_HORIZONTAL; } nbstyle->tabMargins = Ttk_UniformPadding(0); if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabmargins", 0)) != 0) { Ttk_GetBorderFromObj(NULL, objPtr, &nbstyle->tabMargins); } nbstyle->padding = Ttk_UniformPadding(0); if ((objPtr = Ttk_QueryOption(nb->core.layout, "-padding", 0)) != 0) { Ttk_GetPaddingFromObj(NULL,nb->core.tkwin,objPtr,&nbstyle->padding); } nbstyle->minTabWidth = DEFAULT_MIN_TAB_WIDTH; if ((objPtr = Ttk_QueryOption(nb->core.layout, "-mintabwidth", 0)) != 0) { Tcl_GetIntFromObj(NULL, objPtr, &nbstyle->minTabWidth); } } /*------------------------------------------------------------------------ * +++ Tab management. */ static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window slaveWindow) { Tk_OptionTable optionTable = nb->notebook.paneOptionTable; void *record = ckalloc(sizeof(Tab)); memset(record, 0, sizeof(Tab)); if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { ckfree(record); return NULL; } return record; } static void DestroyTab(Notebook *nb, Tab *tab) { void *record = tab; Tk_FreeConfigOptions(record, nb->notebook.paneOptionTable, nb->core.tkwin); ckfree(record); } static int ConfigureTab( Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window slaveWindow, int objc, Tcl_Obj *CONST objv[]) { Ttk_Sticky sticky = tab->sticky; Ttk_Padding padding = tab->padding; Tk_SavedOptions savedOptions; int mask = 0; if (Tk_SetOptions(interp, (ClientData)tab, nb->notebook.paneOptionTable, objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } /* Check options: * @@@ TODO: validate -image option. */ if (Ttk_GetStickyFromObj(interp, tab->stickyObj, &sticky) != TCL_OK) { goto error; } if (Ttk_GetPaddingFromObj(interp, slaveWindow, tab->paddingObj, &padding) != TCL_OK) { goto error; } tab->sticky = sticky; tab->padding = padding; Tk_FreeSavedOptions(&savedOptions); Ttk_ManagerSizeChanged(nb->notebook.mgr); return TCL_OK; error: Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } /* * IdentifyTab -- * Return the index of the tab at point x,y, * or -1 if no tab at that point. */ static int IdentifyTab(Notebook *nb, int x, int y) { int index; for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index); if ( tab->state != TAB_STATE_HIDDEN && Ttk_BoxContains(tab->parcel, x,y)) { return index; } } return -1; } /* * ActivateTab -- * Set the active tab index, redisplay if necessary. */ static void ActivateTab(Notebook *nb, int index) { if (index != nb->notebook.activeIndex) { nb->notebook.activeIndex = index; TtkRedisplayWidget(&nb->core); } } /* * TabState -- * Return the state of the specified tab, based on * notebook state, currentIndex, activeIndex, and user-specified tab state. * The USER1 bit is set for the leftmost tab, and USER2 * is set for the rightmost tab. */ static Ttk_State TabState(Notebook *nb, int index) { Ttk_State state = nb->core.state; Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); if (index == nb->notebook.currentIndex) { state |= TTK_STATE_SELECTED; } else { state &= ~TTK_STATE_FOCUS; } if (index == nb->notebook.activeIndex) { state |= TTK_STATE_ACTIVE; } if (index == 0) { state |= TTK_STATE_USER1; } if (index == Ttk_NumberSlaves(nb->notebook.mgr) - 1) { state |= TTK_STATE_USER2; } if (tab->state == TAB_STATE_DISABLED) { state |= TTK_STATE_DISABLED; } return state; } /*------------------------------------------------------------------------ * +++ Geometry management - size computation. */ /* TabrowSize -- * Compute max height and total width of all tabs (horizontal layouts) * or total height and max width (vertical layouts). * * Side effects: * Sets width and height fields for all tabs. * * Notes: * Hidden tabs are included in the perpendicular computation * (max height/width) but not parallel (total width/height). */ static void TabrowSize( Notebook *nb, Ttk_Orient orient, int *widthPtr, int *heightPtr) { Ttk_Layout tabLayout = nb->notebook.tabLayout; int tabrowWidth = 0, tabrowHeight = 0; int i; for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb,i); Ttk_RebindSublayout(tabLayout, tab); Ttk_LayoutSize(tabLayout,tabState,&tab->width,&tab->height); if (orient == TTK_ORIENT_HORIZONTAL) { tabrowHeight = MAX(tabrowHeight, tab->height); if (tab->state != TAB_STATE_HIDDEN) { tabrowWidth += tab->width; } } else { tabrowWidth = MAX(tabrowWidth, tab->width); if (tab->state != TAB_STATE_HIDDEN) { tabrowHeight += tab->height; } } } *widthPtr = tabrowWidth; *heightPtr = tabrowHeight; } /* NotebookSize -- GM and widget size hook. * * Total height is tab height + client area height + pane internal padding * Total width is max(client width, tab width) + pane internal padding * Client area size determined by max size of slaves, * overridden by -width and/or -height if nonzero. */ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) { Notebook *nb = clientData; NotebookStyle nbstyle; Ttk_Padding padding; Ttk_LayoutNode *clientNode = Ttk_LayoutFindNode(nb->core.layout, "client"); int clientWidth = 0, clientHeight = 0, reqWidth = 0, reqHeight = 0, tabrowWidth = 0, tabrowHeight = 0; int i; NotebookStyleOptions(nb, &nbstyle); /* Compute max requested size of all slaves: */ for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, i); Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); int slaveWidth = Tk_ReqWidth(slaveWindow) + Ttk_PaddingWidth(tab->padding); int slaveHeight = Tk_ReqHeight(slaveWindow) + Ttk_PaddingHeight(tab->padding); clientWidth = MAX(clientWidth, slaveWidth); clientHeight = MAX(clientHeight, slaveHeight); } /* Client width/height overridable by widget options: */ Tcl_GetIntFromObj(NULL, nb->notebook.widthObj,&reqWidth); Tcl_GetIntFromObj(NULL, nb->notebook.heightObj,&reqHeight); if (reqWidth > 0) clientWidth = reqWidth; if (reqHeight > 0) clientHeight = reqHeight; /* Tab row: */ TabrowSize(nb, nbstyle.tabOrient, &tabrowWidth, &tabrowHeight); tabrowHeight += Ttk_PaddingHeight(nbstyle.tabMargins); tabrowWidth += Ttk_PaddingWidth(nbstyle.tabMargins); /* Account for exterior and interior padding: */ padding = nbstyle.padding; if (clientNode) { Ttk_Padding ipad = Ttk_LayoutNodeInternalPadding(nb->core.layout, clientNode); padding = Ttk_AddPadding(padding, ipad); } *widthPtr = MAX(tabrowWidth, clientWidth) + Ttk_PaddingWidth(padding); *heightPtr = tabrowHeight + clientHeight + Ttk_PaddingHeight(padding); return 1; } /*------------------------------------------------------------------------ * +++ Geometry management - layout. */ /* SqueezeTabs -- * If the notebook is not wide enough to display all tabs, * attempt to decrease tab widths to fit. * * All tabs are shrunk by an equal amount, but will not be made * smaller than the minimum width. (If all the tabs still do * not fit in the available space, the rightmost tabs are truncated). * * The algorithm does not always yield an optimal layout, but does * have the important property that decreasing the available width * by one pixel will cause at most one tab to shrink by one pixel; * this means that tabs resize "smoothly" when the window shrinks * and grows. * * @@@ <> bug: only works for horizontal orientations */ static void SqueezeTabs( Notebook *nb, int desiredWidth, int availableWidth, int minTabWidth) { int nTabs = Ttk_NumberSlaves(nb->notebook.mgr); int shrinkage = desiredWidth - availableWidth; int extra = 0; int i; for (i = 0; i < nTabs; ++i) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr,i); int shrink = (shrinkage/nTabs) + (i < (shrinkage%nTabs)) + extra; int shrinkability = MAX(0, tab->width - minTabWidth); int delta = MIN(shrinkability, shrink); tab->width -= delta; extra = shrink - delta; } } /* PlaceTabs -- * Compute all tab parcels. */ static void PlaceTabs( Notebook *nb, Ttk_Box tabrowBox, Ttk_PositionSpec tabPlacement) { Ttk_Layout tabLayout = nb->notebook.tabLayout; int nTabs = Ttk_NumberSlaves(nb->notebook.mgr); int i; for (i = 0; i < nTabs; ++i) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb, i); if (tab->state != TAB_STATE_HIDDEN) { Ttk_Padding expand = Ttk_UniformPadding(0); Tcl_Obj *expandObj = Ttk_QueryOption(tabLayout,"-expand",tabState); if (expandObj) { Ttk_GetBorderFromObj(NULL, expandObj, &expand); } tab->parcel = Ttk_ExpandBox( Ttk_PositionBox(&tabrowBox, tab->width, tab->height, tabPlacement), expand); } } } /* NotebookDoLayout -- * Computes notebook layout and places tabs. * * Side effects: * Sets clientArea, used to place slave panes. */ static void NotebookDoLayout(void *recordPtr) { Notebook *nb = recordPtr; Tk_Window nbwin = nb->core.tkwin; Ttk_Box cavity = Ttk_WinBox(nbwin); int tabrowWidth = 0, tabrowHeight = 0; Ttk_LayoutNode *clientNode = Ttk_LayoutFindNode(nb->core.layout, "client"); Ttk_Box tabrowBox; NotebookStyle nbstyle; NotebookStyleOptions(nb, &nbstyle); /* Notebook internal padding: */ cavity = Ttk_PadBox(cavity, nbstyle.padding); /* Layout for notebook background (base layout): */ Ttk_PlaceLayout(nb->core.layout, nb->core.state, Ttk_WinBox(nbwin)); /* Place tabs: */ TabrowSize(nb, nbstyle.tabOrient, &tabrowWidth, &tabrowHeight); tabrowBox = Ttk_PadBox( Ttk_PositionBox(&cavity, tabrowWidth + Ttk_PaddingWidth(nbstyle.tabMargins), tabrowHeight + Ttk_PaddingHeight(nbstyle.tabMargins), nbstyle.tabPosition), nbstyle.tabMargins); if (tabrowWidth > tabrowBox.width) { SqueezeTabs(nb, tabrowWidth, tabrowBox.width, nbstyle.minTabWidth); } PlaceTabs(nb, tabrowBox, nbstyle.tabPlacement); /* Layout for client area frame: */ if (clientNode) { Ttk_PlaceLayoutNode(nb->core.layout, clientNode, cavity); cavity = Ttk_LayoutNodeInternalParcel(nb->core.layout, clientNode); } if (cavity.height <= 0) cavity.height = 1; if (cavity.width <= 0) cavity.width = 1; nb->notebook.clientArea = cavity; } /* * NotebookPlaceSlave -- * Set the position and size of a child widget * based on the current client area and slave options: */ static void NotebookPlaceSlave(Notebook *nb, int slaveIndex) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex); Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, slaveIndex); Ttk_Box slaveBox = Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), Tk_ReqWidth(slaveWindow), Tk_ReqHeight(slaveWindow),tab->sticky); Ttk_PlaceSlave(nb->notebook.mgr, slaveIndex, slaveBox.x, slaveBox.y, slaveBox.width, slaveBox.height); } /* NotebookPlaceSlaves -- * Geometry manager hook. */ static void NotebookPlaceSlaves(void *recordPtr) { Notebook *nb = recordPtr; int currentIndex = nb->notebook.currentIndex; if (currentIndex >= 0) { NotebookDoLayout(nb); NotebookPlaceSlave(nb, currentIndex); } } /* * SelectTab(nb, index) -- * Change the currently-selected tab. */ static void SelectTab(Notebook *nb, int index) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index); int currentIndex = nb->notebook.currentIndex; if (index == currentIndex) { return; } if (TabState(nb, index) & TTK_STATE_DISABLED) { return; } /* Unhide the tab if it is currently hidden and being selected. */ if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } if (currentIndex >= 0) { Ttk_UnmapSlave(nb->notebook.mgr, currentIndex); } NotebookPlaceSlave(nb, index); nb->notebook.currentIndex = index; TtkRedisplayWidget(&nb->core); TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); } /* NextTab -- * Returns the index of the next tab after the specified tab * in the normal state (e.g., not hidden or disabled), * or -1 if all tabs are disabled or hidden. */ static int NextTab(Notebook *nb, int index) { int nTabs = Ttk_NumberSlaves(nb->notebook.mgr); int nextIndex; /* Scan forward for following usable tab: */ for (nextIndex = index + 1; nextIndex < nTabs; ++nextIndex) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } } /* Not found -- scan backwards. */ for (nextIndex = index - 1; nextIndex >= 0; --nextIndex) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } } /* Still nothing. Give up. */ return -1; } /* SelectNearestTab -- * Handles the case where the current tab is forgotten, hidden, * or destroyed. * * Unmap the current tab and schedule the next available one * to be mapped at the next GM update. */ static void SelectNearestTab(Notebook *nb) { int currentIndex = nb->notebook.currentIndex; int nextIndex = NextTab(nb, currentIndex); if (currentIndex >= 0) { Ttk_UnmapSlave(nb->notebook.mgr, currentIndex); } if (currentIndex != nextIndex) { TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); } nb->notebook.currentIndex = nextIndex; Ttk_ManagerLayoutChanged(nb->notebook.mgr); TtkRedisplayWidget(&nb->core); } /* TabRemoved -- GM SlaveRemoved hook. * Select the next tab if the current one is being removed. * Adjust currentIndex to account for removed slave. */ static void TabRemoved(void *managerData, int index) { Notebook *nb = managerData; Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); } if (index < nb->notebook.currentIndex) { --nb->notebook.currentIndex; } DestroyTab(nb, tab); TtkRedisplayWidget(&nb->core); } static int TabRequest(void *managerData, int index, int width, int height) { return 1; } /* AddTab -- * Add new tab at specified index. */ static int AddTab( Tcl_Interp *interp, Notebook *nb, int destIndex, Tk_Window slaveWindow, int objc, Tcl_Obj *const objv[]) { Tab *tab; if (!Ttk_Maintainable(interp, slaveWindow, nb->core.tkwin)) { return TCL_ERROR; } #if 0 /* can't happen */ if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) >= 0) { Tcl_AppendResult(interp, Tk_PathName(slaveWindow), " already added", NULL); return TCL_ERROR; } #endif /* Create and insert tab. */ tab = CreateTab(interp, nb, slaveWindow); if (!tab) { return TCL_ERROR; } if (ConfigureTab(interp, nb, tab, slaveWindow, objc, objv) != TCL_OK) { DestroyTab(nb, tab); return TCL_ERROR; } Ttk_InsertSlave(nb->notebook.mgr, destIndex, slaveWindow, tab); /* Adjust indices and/or autoselect first tab: */ if (nb->notebook.currentIndex < 0) { SelectTab(nb, destIndex); } else if (nb->notebook.currentIndex >= destIndex) { ++nb->notebook.currentIndex; } return TCL_OK; } static Ttk_ManagerSpec NotebookManagerSpec = { { "notebook", Ttk_GeometryRequestProc, Ttk_LostSlaveProc }, NotebookSize, NotebookPlaceSlaves, TabRequest, TabRemoved }; /*------------------------------------------------------------------------ * +++ Event handlers. */ /* NotebookEventHandler -- * Tracks the active tab. */ static const int NotebookEventMask = StructureNotifyMask | PointerMotionMask | LeaveWindowMask ; static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr) { Notebook *nb = clientData; if (eventPtr->type == DestroyNotify) { /* Remove self */ Tk_DeleteEventHandler(nb->core.tkwin, NotebookEventMask, NotebookEventHandler, clientData); } else if (eventPtr->type == MotionNotify) { int index = IdentifyTab(nb, eventPtr->xmotion.x, eventPtr->xmotion.y); ActivateTab(nb, index); } else if (eventPtr->type == LeaveNotify) { ActivateTab(nb, -1); } } /*------------------------------------------------------------------------ * +++ Utilities. */ /* FindTabIndex -- * Find the index of the specified tab. * Tab identifiers are one of: * * + positional specifications @x,y, * + "current", * + numeric indices [0..nTabs], * + slave window names * * Stores index of specified tab in *index_rtn, -1 if not found. * * Returns TCL_ERROR and leaves an error message in interp->result * if the tab identifier was incorrect. * * See also: GetTabIndex. */ static int FindTabIndex( Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, int *index_rtn) { const char *string = Tcl_GetString(objPtr); int x, y; *index_rtn = -1; /* Check for @x,y ... */ if (string[0] == '@' && sscanf(string, "@%d,%d",&x,&y) == 2) { *index_rtn = IdentifyTab(nb, x, y); return TCL_OK; } /* ... or "current" ... */ if (!strcmp(string, "current")) { *index_rtn = nb->notebook.currentIndex; return TCL_OK; } /* ... or integer index or slave window name: */ if (Ttk_GetSlaveIndexFromObj( interp, nb->notebook.mgr, objPtr, index_rtn) == TCL_OK) { return TCL_OK; } /* Nothing matched; Ttk_GetSlaveIndexFromObj will have left error message. */ return TCL_ERROR; } /* GetTabIndex -- * Get the index of an existing tab. * Tab identifiers are as per FindTabIndex. * Returns TCL_ERROR if the tab does not exist. */ static int GetTabIndex( Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, int *index_rtn) { int status = FindTabIndex(interp, nb, objPtr, index_rtn); if (status == TCL_OK && *index_rtn < 0) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "tab '", Tcl_GetString(objPtr), "' not found", NULL); status = TCL_ERROR; } return status; } /*------------------------------------------------------------------------ * +++ Widget command routines. */ /* $nb add window ?options ... ? */ static int NotebookAddCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Notebook *nb = recordPtr; int index = Ttk_NumberSlaves(nb->notebook.mgr); Tk_Window slaveWindow; int slaveIndex; Tab *tab; if (objc <= 2 || objc % 2 != 1) { Tcl_WrongNumArgs(interp, 2, objv, "window ?options...?"); return TCL_ERROR; } slaveWindow = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin); if (!slaveWindow) { return TCL_ERROR; } slaveIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow); if (slaveIndex < 0) { /* New tab */ return AddTab(interp, nb, index, slaveWindow, objc-3,objv+3); } tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex); if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } if (ConfigureTab(interp, nb, tab, slaveWindow, objc-4,objv+4) != TCL_OK) { return TCL_ERROR; } TtkRedisplayWidget(&nb->core); return TCL_OK; } /* $nb insert $index $tab ?options...? * Insert new tab, or move existing one. */ static int NotebookInsertCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Notebook *nb = recordPtr; int current = nb->notebook.currentIndex; int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); int srcIndex, destIndex; if (objc < 4) { Tcl_WrongNumArgs(interp, 2,objv, "index slave ?options...?"); return TCL_ERROR; } if (!strcmp(Tcl_GetString(objv[2]), "end")) { destIndex = Ttk_NumberSlaves(nb->notebook.mgr); } else if (TCL_OK != Ttk_GetSlaveIndexFromObj( interp, nb->notebook.mgr, objv[2], &destIndex)) { return TCL_ERROR; } if (Tcl_GetString(objv[3])[0] == '.') { /* Window name -- could be new or existing slave. */ Tk_Window slaveWindow = Tk_NameToWindow(interp,Tcl_GetString(objv[3]),nb->core.tkwin); if (!slaveWindow) { return TCL_ERROR; } srcIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow); if (srcIndex < 0) { /* New slave */ return AddTab(interp, nb, destIndex, slaveWindow, objc-4,objv+4); } } else if (Ttk_GetSlaveIndexFromObj( interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK) { return TCL_ERROR; } /* Move existing slave: */ if (ConfigureTab(interp, nb, Ttk_SlaveData(nb->notebook.mgr,srcIndex), Ttk_SlaveWindow(nb->notebook.mgr,srcIndex), objc-4,objv+4) != TCL_OK) { return TCL_ERROR; } if (destIndex >= nSlaves) { destIndex = nSlaves - 1; } Ttk_ReorderSlave(nb->notebook.mgr, srcIndex, destIndex); /* Adjust internal indexes: */ nb->notebook.activeIndex = -1; if (current == srcIndex) { nb->notebook.currentIndex = destIndex; } else if (destIndex <= current && current < srcIndex) { ++nb->notebook.currentIndex; } else if (srcIndex < current && current <= destIndex) { --nb->notebook.currentIndex; } TtkRedisplayWidget(&nb->core); return TCL_OK; } /* $nb forget $tab -- * Removes the specified tab. */ static int NotebookForgetCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Notebook *nb = recordPtr; int index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab"); return TCL_ERROR; } if (GetTabIndex(interp, nb, objv[2], &index) != TCL_OK) { return TCL_ERROR; } Ttk_ForgetSlave(nb->notebook.mgr, index); return TCL_OK; } /* $nb hide $tab -- * Hides the specified tab. */ static int NotebookHideCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Notebook *nb = recordPtr; int index; Tab *tab; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab"); return TCL_ERROR; } if (GetTabIndex(interp, nb, objv[2], &index) != TCL_OK) { return TCL_ERROR; } tab = Ttk_SlaveData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); } return TCL_OK; } /* $nb identify $x $y -- * Returns name of tab element at $x,$y; empty string if none. */ static int NotebookIdentifyCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Notebook *nb = recordPtr; Ttk_LayoutNode *node = NULL; int x, y, tabIndex; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "x y"); return TCL_ERROR; } if ( Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) { return TCL_ERROR; } tabIndex = IdentifyTab(nb, x, y); if (tabIndex >= 0) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr, tabIndex); Ttk_State state = TabState(nb, tabIndex); Ttk_Layout tabLayout = nb->notebook.tabLayout; Ttk_RebindSublayout(tabLayout, tab); Ttk_PlaceLayout(tabLayout, state, tab->parcel); node = Ttk_LayoutIdentify(tabLayout, x, y); } if (node) { const char *elementName = Ttk_LayoutNodeName(node); Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1)); } return TCL_OK; } /* $nb index $item -- * Returns the integer index of the tab specified by $item, * the empty string if $item does not identify a tab. * See above for valid item formats. */ static int NotebookIndexCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Notebook *nb = recordPtr; int index, status; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab"); return TCL_ERROR; } /* * Special-case for "end": */ if (!strcmp("end", Tcl_GetString(objv[2]))) { int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); Tcl_SetObjResult(interp, Tcl_NewIntObj(nSlaves)); return TCL_OK; } status = FindTabIndex(interp, nb, objv[2], &index); if (status == TCL_OK && index >= 0) { Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); } return status; } /* $nb select ?$item? -- * Select the specified tab, or return the widget path of * the currently-selected pane. */ static int NotebookSelectCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Notebook *nb = recordPtr; if (objc == 2) { if (nb->notebook.currentIndex >= 0) { Tk_Window pane = Ttk_SlaveWindow( nb->notebook.mgr, nb->notebook.currentIndex); Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(pane), -1)); } return TCL_OK; } else if (objc == 3) { int index, status = GetTabIndex(interp, nb, objv[2], &index); if (status == TCL_OK) { SelectTab(nb, index); } return status; } /*else*/ Tcl_WrongNumArgs(interp, 2, objv, "?tab?"); return TCL_ERROR; } /* $nb tabs -- * Return list of tabs. */ static int NotebookTabsCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Notebook *nb = recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; Tcl_Obj *result; int i; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } result = Tcl_NewListObj(0, NULL); for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) { const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i)); Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(pathName,-1)); } Tcl_SetObjResult(interp, result); return TCL_OK; } /* $nb tab $tab ?-option ?value -option value...?? */ static int NotebookTabCommand( Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr) { Notebook *nb = recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; int index; Tk_Window slaveWindow; Tab *tab; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab ?-option ?value??..."); return TCL_ERROR; } if (GetTabIndex(interp, nb, objv[2], &index) != TCL_OK) { return TCL_ERROR; } tab = Ttk_SlaveData(mgr, index); slaveWindow = Ttk_SlaveWindow(mgr, index); if (objc == 3) { return TtkEnumerateOptions(interp, tab, PaneOptionSpecs, nb->notebook.paneOptionTable, slaveWindow); } else if (objc == 4) { return TtkGetOptionValue(interp, tab, objv[3], nb->notebook.paneOptionTable, slaveWindow); } /* else */ if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) { return TCL_ERROR; } /* If the current tab has become disabled or hidden, * select the next nondisabled, unhidden one: */ if (index == nb->notebook.currentIndex && tab->state != TAB_STATE_NORMAL) { SelectNearestTab(nb); } TtkResizeWidget(&nb->core); return TCL_OK; } /* Subcommand table: */ static WidgetCommandSpec NotebookCommands[] = { { "add", NotebookAddCommand }, { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "forget", NotebookForgetCommand }, { "hide", NotebookHideCommand }, { "identify", NotebookIdentifyCommand }, { "index", NotebookIndexCommand }, { "insert", NotebookInsertCommand }, { "instate", TtkWidgetInstateCommand }, { "select", NotebookSelectCommand }, { "state", TtkWidgetStateCommand }, { "tab", NotebookTabCommand }, { "tabs", NotebookTabsCommand }, { 0,0 } }; /*------------------------------------------------------------------------ * +++ Widget class hooks. */ static int NotebookInitialize(Tcl_Interp *interp, void *recordPtr) { Notebook *nb = recordPtr; nb->notebook.mgr = Ttk_CreateManager( &NotebookManagerSpec, recordPtr, nb->core.tkwin); nb->notebook.tabOptionTable = Tk_CreateOptionTable(interp,TabOptionSpecs); nb->notebook.paneOptionTable = Tk_CreateOptionTable(interp,PaneOptionSpecs); nb->notebook.currentIndex = -1; nb->notebook.activeIndex = -1; nb->notebook.tabLayout = 0; nb->notebook.clientArea = Ttk_MakeBox(0,0,1,1); Tk_CreateEventHandler( nb->core.tkwin, NotebookEventMask, NotebookEventHandler, recordPtr); return TCL_OK; } static void NotebookCleanup(void *recordPtr) { Notebook *nb = recordPtr; Ttk_DeleteManager(nb->notebook.mgr); Tk_DeleteOptionTable(nb->notebook.tabOptionTable); Tk_DeleteOptionTable(nb->notebook.paneOptionTable); if (nb->notebook.tabLayout) Ttk_FreeLayout(nb->notebook.tabLayout); } static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) { Notebook *nb = clientData; /* * Error-checks: */ if (nb->notebook.paddingObj) { /* Check for valid -padding: */ Ttk_Padding unused; if (Ttk_GetPaddingFromObj( interp, nb->core.tkwin, nb->notebook.paddingObj, &unused) != TCL_OK) { return TCL_ERROR; } } return TtkCoreConfigure(interp, clientData, mask); } /* NotebookGetLayout -- * GetLayout widget hook. */ static Ttk_Layout NotebookGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Notebook *nb = recordPtr; Ttk_Layout notebookLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout tabLayout; if (!notebookLayout) { return NULL; } tabLayout = Ttk_CreateSublayout( interp, theme, notebookLayout, ".Tab", nb->notebook.tabOptionTable); if (tabLayout) { if (nb->notebook.tabLayout) { Ttk_FreeLayout(nb->notebook.tabLayout); } nb->notebook.tabLayout = tabLayout; } return notebookLayout; } /*------------------------------------------------------------------------ * +++ Display routines. */ static void DisplayTab(Notebook *nb, int index, Drawable d) { Ttk_Layout tabLayout = nb->notebook.tabLayout; Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); Ttk_State state = TabState(nb, index); if (tab->state != TAB_STATE_HIDDEN) { Ttk_RebindSublayout(tabLayout, tab); Ttk_PlaceLayout(tabLayout, state, tab->parcel); Ttk_DrawLayout(tabLayout, state, d); } } static void NotebookDisplay(void *clientData, Drawable d) { Notebook *nb = clientData; int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); int index; /* Draw notebook background (base layout): */ Ttk_DrawLayout(nb->core.layout, nb->core.state, d); /* Draw tabs from left to right, but draw the current tab last * so it will overwrite its neighbors. */ for (index = 0; index < nSlaves; ++index) { if (index != nb->notebook.currentIndex) { DisplayTab(nb, index, d); } } if (nb->notebook.currentIndex >= 0) { DisplayTab(nb, nb->notebook.currentIndex, d); } } /*------------------------------------------------------------------------ * +++ Widget specification and layout definitions. */ static WidgetSpec NotebookWidgetSpec = { "TNotebook", /* className */ sizeof(Notebook), /* recordSize */ NotebookOptionSpecs, /* optionSpecs */ NotebookCommands, /* subcommands */ NotebookInitialize, /* initializeProc */ NotebookCleanup, /* cleanupProc */ NotebookConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ NotebookGetLayout, /* getLayoutProc */ NotebookSize, /* geometryProc */ NotebookDoLayout, /* layoutProc */ NotebookDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(NotebookLayout) TTK_NODE("Notebook.client", TTK_FILL_BOTH) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(TabLayout) TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, TTK_GROUP("Notebook.padding", TTK_PACK_TOP|TTK_FILL_BOTH, TTK_GROUP("Notebook.focus", TTK_PACK_TOP|TTK_FILL_BOTH, TTK_NODE("Notebook.label", TTK_PACK_TOP)))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ void TtkNotebook_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(themePtr, "Tab", TabLayout); Ttk_RegisterLayout(themePtr, "TNotebook", NotebookLayout); RegisterWidget(interp, "ttk::notebook", &NotebookWidgetSpec); } /*EOF*/ tile-0.8.2/generic/paned.c0000644000076500007650000006361110722327026014723 0ustar joejoe00000000000000/* paned.c,v 1.21 2007/11/25 17:17:10 jenglish Exp * * Copyright (c) 2005, Joe English. Freely redistributable. * * ttk::panedwindow widget implementation. * * TODO: track active/pressed sash. */ #include #include #include "manager.h" #include "tkTheme.h" #include "widget.h" #define MIN_SASH_THICKNESS 5 /*------------------------------------------------------------------------ * +++ Layout algorithm. * * (pos=x/y, size=width/height, depending on -orient=horizontal/vertical) * * Each pane carries two pieces of state: the request size and the * position of the following sash. (The final pane has no sash, * its sash position is used as a sentinel value). * * Pane geometry is determined by the sash positions. * When resizing, sash positions are computed from the request sizes, * the available space, and pane weights (see PlaceSashes()). * This ensures continuous resize behavior (that is: changing * the size by X pixels then changing the size by Y pixels * gives the same result as changing the size by X+Y pixels * in one step). * * The request size is initially set to the slave window's requested size. * When the user drags a sash, each pane's request size is set to its * actual size. This ensures that panes "stay put" on the next resize. * * If reqSize == 0, use 0 for the weight as well. This ensures that * "collapsed" panes stay collapsed during a resize, regardless of * their nominal -weight. * * +++ Invariants. * * #sash = #pane - 1 * pos(pane[0]) = 0 * pos(sash[i]) = pos(pane[i]) + size(pane[i]), 0 <= i <= #sash * pos(pane[i+1]) = pos(sash[i]) + size(sash[i]), 0 <= i < #sash * pos(sash[#sash]) = size(pw) // sentinel value, constraint * * size(pw) = sum(size(pane(0..#pane))) + sum(size(sash(0..#sash))) * size(pane[i]) >= 0, for 0 <= i < #pane * size(sash[i]) >= 0, for 0 <= i < #sash * ==> pos(pane[i]) <= pos(sash[i]) <= pos(pane[i+1]), for 0 <= i < #sash * * Assumption: all sashes are the same size. */ /*------------------------------------------------------------------------ * +++ Widget record. */ typedef struct { Tcl_Obj *orientObj; int orient; int width; int height; Ttk_Manager *mgr; Tk_OptionTable paneOptionTable; Ttk_Layout sashLayout; int sashThickness; } PanedPart; typedef struct { WidgetCore core; PanedPart paned; } Paned; /* @@@ NOTE: -orient is readonly 'cause dynamic oriention changes NYI */ static Tk_OptionSpec PanedOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", Tk_Offset(Paned,paned.orientObj), Tk_Offset(Paned,paned.orient), 0,(ClientData)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED }, {TK_OPTION_INT, "-width", "width", "Width", "0", -1,Tk_Offset(Paned,paned.width), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-height", "height", "Height", "0", -1,Tk_Offset(Paned,paned.height), 0,0,GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Slave pane record. */ typedef struct { int reqSize; /* Pane request size */ int sashPos; /* Folowing sash position */ int weight; /* Pane -weight, for resizing */ } Pane; static Tk_OptionSpec PaneOptionSpecs[] = { {TK_OPTION_INT, "-weight", "weight", "Weight", "0", -1,Tk_Offset(Pane,weight), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; /* CreatePane -- * Create a new pane record. */ static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow) { Tk_OptionTable optionTable = pw->paned.paneOptionTable; void *record = ckalloc(sizeof(Pane)); Pane *pane = record; memset(record, 0, sizeof(Pane)); if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { ckfree(record); return NULL; } pane->reqSize = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? Tk_ReqWidth(slaveWindow) : Tk_ReqHeight(slaveWindow); return pane; } /* DestroyPane -- * Free pane record. */ static void DestroyPane(Paned *pw, Pane *pane) { void *record = pane; Tk_FreeConfigOptions(record, pw->paned.paneOptionTable, pw->core.tkwin); ckfree(record); } /* ConfigurePane -- * Set pane options. */ static int ConfigurePane( Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow, int objc, Tcl_Obj *CONST objv[]) { Ttk_Manager *mgr = pw->paned.mgr; Tk_SavedOptions savedOptions; int mask = 0; if (Tk_SetOptions(interp, (void*)pane, pw->paned.paneOptionTable, objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } /* Sanity-check: */ if (pane->weight < 0) { Tcl_AppendResult(interp, "-weight must be nonnegative", NULL); goto error; } /* Done. */ Tk_FreeSavedOptions(&savedOptions); Ttk_ManagerSizeChanged(mgr); return TCL_OK; error: Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } /*------------------------------------------------------------------------ * +++ Sash adjustment. */ /* ShoveUp -- * Place sash i at specified position, recursively shoving * previous sashes upwards as needed, until hitting the top * of the window. If that happens, shove back down. * * Returns: final position of sash i. */ static int ShoveUp(Paned *pw, int i, int pos) { Pane *pane = Ttk_SlaveData(pw->paned.mgr, i); int sashThickness = pw->paned.sashThickness; if (i == 0) { if (pos < 0) pos = 0; } else { Pane *prevPane = Ttk_SlaveData(pw->paned.mgr, i-1); if (pos < prevPane->sashPos + sashThickness) pos = ShoveUp(pw, i-1, pos - sashThickness) + sashThickness; } return pane->sashPos = pos; } /* ShoveDown -- * Same as ShoveUp, but going in the opposite direction * and stopping at the sentinel sash. */ static int ShoveDown(Paned *pw, int i, int pos) { Pane *pane = Ttk_SlaveData(pw->paned.mgr,i); int sashThickness = pw->paned.sashThickness; if (i == Ttk_NumberSlaves(pw->paned.mgr) - 1) { pos = pane->sashPos; /* Sentinel value == master window size */ } else { Pane *nextPane = Ttk_SlaveData(pw->paned.mgr,i+1); if (pos + sashThickness > nextPane->sashPos) pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness; } return pane->sashPos = pos; } /* PanedSize -- * Compute the requested size of the paned widget * from the individual pane request sizes. * * Used as the WidgetSpec sizeProc and the ManagerSpec sizeProc. */ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) { Paned *pw = recordPtr; int nPanes = Ttk_NumberSlaves(pw->paned.mgr); int nSashes = nPanes - 1; int sashThickness = pw->paned.sashThickness; int width = 0, height = 0; int index; if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) { for (index = 0; index < nPanes; ++index) { Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); if (height < Tk_ReqHeight(slaveWindow)) height = Tk_ReqHeight(slaveWindow); width += pane->reqSize; } width += nSashes * sashThickness; } else { for (index = 0; index < nPanes; ++index) { Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); if (width < Tk_ReqWidth(slaveWindow)) width = Tk_ReqWidth(slaveWindow); height += pane->reqSize; } height += nSashes * sashThickness; } *widthPtr = pw->paned.width > 0 ? pw->paned.width : width; *heightPtr = pw->paned.height > 0 ? pw->paned.height : height; return 1; } /* AdjustPanes -- * Set pane request sizes from sash positions. * * NOTE: * AdjustPanes followed by PlaceSashes (called during relayout) * will leave the sashes in the same place, as long as available size * remains contant. */ static void AdjustPanes(Paned *pw) { int sashThickness = pw->paned.sashThickness; int pos = 0; int index; for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); int size = pane->sashPos - pos; pane->reqSize = size >= 0 ? size : 0; pos = pane->sashPos + sashThickness; } } /* PlaceSashes -- * Set sash positions from pane request sizes and available space. * The sentinel sash position is set to the available space. * * Allocate pane->reqSize pixels to each pane, and distribute * the difference = available size - requested size according * to pane->weight. * * If there's still some left over, squeeze panes from the bottom up * (This can happen if all weights are zero, or if one or more panes * are too small to absorb the required shrinkage). * * Notes: * This doesn't distribute the remainder pixels as evenly as it could * when more than one pane has weight > 1. */ static void PlaceSashes(Paned *pw, int width, int height) { Ttk_Manager *mgr = pw->paned.mgr; int nPanes = Ttk_NumberSlaves(mgr); int sashThickness = pw->paned.sashThickness; int available = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? width : height; int reqSize = 0, totalWeight = 0; int difference, delta, remainder, pos, i; if (nPanes == 0) return; /* Compute total required size and total available weight: */ for (i = 0; i < nPanes; ++i) { Pane *pane = Ttk_SlaveData(mgr, i); reqSize += pane->reqSize; totalWeight += pane->weight * (pane->reqSize != 0); } /* Compute difference to be redistributed: */ difference = available - reqSize - sashThickness*(nPanes-1); if (totalWeight != 0) { delta = difference / totalWeight; remainder = difference % totalWeight; if (remainder < 0) { --delta; remainder += totalWeight; } } else { delta = remainder = 0; } /* ASSERT: 0 <= remainder < totalWeight */ /* Place sashes: */ pos = 0; for (i = 0; i < nPanes; ++i) { Pane *pane = Ttk_SlaveData(mgr, i); int weight = pane->weight * (pane->reqSize != 0); int size = pane->reqSize + delta * weight; if (weight > remainder) weight = remainder; remainder -= weight; size += weight; if (size < 0) size = 0; pane->sashPos = (pos += size); pos += sashThickness; } /* Handle emergency shrink/emergency stretch: * Set sentinel sash position to end of widget, * shove preceding sashes up. */ ShoveUp(pw, nPanes - 1, available); } /* PlacePanes -- * Places slave panes based on sash positions. */ static void PlacePanes(Paned *pw) { int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; int width = Tk_Width(pw->core.tkwin), height = Tk_Height(pw->core.tkwin); int sashThickness = pw->paned.sashThickness; int pos = 0; int index; for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); int size = pane->sashPos - pos; if (size > 0) { if (horizontal) { Ttk_PlaceSlave(pw->paned.mgr, index, pos, 0, size, height); } else { Ttk_PlaceSlave(pw->paned.mgr, index, 0, pos, width, size); } } else { Ttk_UnmapSlave(pw->paned.mgr, index); } pos = pane->sashPos + sashThickness; } } /*------------------------------------------------------------------------ * +++ Manager specification. */ static void PanedPlaceSlaves(void *managerData) { Paned *pw = managerData; PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin)); PlacePanes(pw); } static void PaneRemoved(void *managerData, int index) { Paned *pw = managerData; Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); DestroyPane(pw, pane); } static int AddPane( Tcl_Interp *interp, Paned *pw, int destIndex, Tk_Window slaveWindow, int objc, Tcl_Obj *const objv[]) { Pane *pane; if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) { return TCL_ERROR; } if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) >= 0) { Tcl_AppendResult(interp, Tk_PathName(slaveWindow), " already added", NULL); return TCL_ERROR; } pane = CreatePane(interp, pw, slaveWindow); if (!pane) { return TCL_ERROR; } if (ConfigurePane(interp, pw, pane, slaveWindow, objc, objv) != TCL_OK) { DestroyPane(pw, pane); return TCL_ERROR; } Ttk_InsertSlave(pw->paned.mgr, destIndex, slaveWindow, pane); return TCL_OK; } /* PaneRequest -- * Only update pane request size if slave is currently unmapped. * Geometry requests from mapped slaves are not directly honored * in order to avoid unexpected pane resizes (esp. while the * user is dragging a sash [#1325286]). */ static int PaneRequest(void *managerData, int index, int width, int height) { Paned *pw = managerData; Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; if (!Tk_IsMapped(slaveWindow)) { pane->reqSize = horizontal ? width : height; } return 1; } static Ttk_ManagerSpec PanedManagerSpec = { { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostSlaveProc }, PanedSize, PanedPlaceSlaves, PaneRequest, PaneRemoved }; /*------------------------------------------------------------------------ * +++ Event handler. * * <> * Tk does not execute binding scripts for events when * the pointer crosses from a parent to a child. This widget * needs to know when that happens, though, so it can reset * the cursor. * * This event handler generates an <> virtual event * on LeaveNotify/NotifyInferior. */ static const unsigned PanedEventMask = LeaveWindowMask; static void PanedEventProc(ClientData clientData, XEvent *eventPtr) { WidgetCore *corePtr = clientData; if ( eventPtr->type == LeaveNotify && eventPtr->xcrossing.detail == NotifyInferior) { TtkSendVirtualEvent(corePtr->tkwin, "EnteredChild"); } } /*------------------------------------------------------------------------ * +++ Initialization and cleanup hooks. */ static int PanedInitialize(Tcl_Interp *interp, void *recordPtr) { Paned *pw = recordPtr; Tk_CreateEventHandler(pw->core.tkwin, PanedEventMask, PanedEventProc, recordPtr); pw->paned.mgr = Ttk_CreateManager(&PanedManagerSpec, pw, pw->core.tkwin); pw->paned.paneOptionTable = Tk_CreateOptionTable(interp,PaneOptionSpecs); pw->paned.sashLayout = 0; pw->paned.sashThickness = 1; return TCL_OK; } static void PanedCleanup(void *recordPtr) { Paned *pw = recordPtr; if (pw->paned.sashLayout) Ttk_FreeLayout(pw->paned.sashLayout); Tk_DeleteEventHandler(pw->core.tkwin, PanedEventMask, PanedEventProc, recordPtr); Ttk_DeleteManager(pw->paned.mgr); } /* Post-configuration hook. */ static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask) { Paned *pw = clientData; if (mask & GEOMETRY_CHANGED) { /* User has changed -width or -height. * Recalculate sash positions based on requested size. */ Tk_Window tkwin = pw->core.tkwin; PlaceSashes(pw, pw->paned.width > 0 ? pw->paned.width : Tk_Width(tkwin), pw->paned.height > 0 ? pw->paned.height : Tk_Height(tkwin)); } return TCL_OK; } /*------------------------------------------------------------------------ * +++ Layout management hooks. */ static Ttk_Layout PanedGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { Paned *pw = recordPtr; Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); if (panedLayout) { int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; const char *layoutName = horizontal ? ".Vertical.Sash" : ".Horizontal.Sash"; Ttk_Layout sashLayout = Ttk_CreateSublayout( interp, themePtr, panedLayout, layoutName, pw->core.optionTable); if (sashLayout) { int sashWidth, sashHeight; Ttk_LayoutSize(sashLayout, 0, &sashWidth, &sashHeight); pw->paned.sashThickness = horizontal ? sashWidth : sashHeight; if (pw->paned.sashLayout) Ttk_FreeLayout(pw->paned.sashLayout); pw->paned.sashLayout = sashLayout; } else { Ttk_FreeLayout(panedLayout); return 0; } } /* Sanity-check: */ if (pw->paned.sashThickness < MIN_SASH_THICKNESS) pw->paned.sashThickness = MIN_SASH_THICKNESS; return panedLayout; } /*------------------------------------------------------------------------ * +++ Drawing routines. */ static void DrawSash(Paned *pw, Drawable d, Ttk_Box b) { Ttk_Layout sashLayout = pw->paned.sashLayout; Ttk_State state = pw->core.state; Ttk_PlaceLayout(sashLayout, state, b); Ttk_DrawLayout(sashLayout, state, d); } static void PanedDisplay(void *recordPtr, Drawable d) { Paned *pw = recordPtr; int nPanes = Ttk_NumberSlaves(pw->paned.mgr), horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL, thickness = pw->paned.sashThickness, height = Tk_Height(pw->core.tkwin), width = Tk_Width(pw->core.tkwin); int i; TtkWidgetDisplay(recordPtr, d); /* Draw sashes: */ for (i = 0; i < nPanes; ++i) { Pane *pane = Ttk_SlaveData(pw->paned.mgr, i); if (horizontal) { DrawSash(pw, d, Ttk_MakeBox(pane->sashPos, 0, thickness, height)); } else { DrawSash(pw, d, Ttk_MakeBox(0, pane->sashPos, width, thickness)); } } } /*------------------------------------------------------------------------ * +++ Widget commands. */ /* $pw add window [ options ... ] */ static int PanedAddCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Paned *pw = recordPtr; Tk_Window slaveWindow; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } slaveWindow = Tk_NameToWindow( interp, Tcl_GetString(objv[2]), pw->core.tkwin); if (!slaveWindow) { return TCL_ERROR; } return AddPane(interp, pw, Ttk_NumberSlaves(pw->paned.mgr), slaveWindow, objc - 3, objv + 3); } /* $pw insert $index $slave ?options...? * Insert new slave, or move existing one. */ static int PanedInsertCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Paned *pw = recordPtr; int nSlaves = Ttk_NumberSlaves(pw->paned.mgr); int srcIndex, destIndex; Tk_Window slaveWindow; if (objc < 4) { Tcl_WrongNumArgs(interp, 2,objv, "index slave ?options...?"); return TCL_ERROR; } slaveWindow = Tk_NameToWindow( interp, Tcl_GetString(objv[3]), pw->core.tkwin); if (!slaveWindow) { return TCL_ERROR; } if (!strcmp(Tcl_GetString(objv[2]), "end")) { destIndex = Ttk_NumberSlaves(pw->paned.mgr); } else if (TCL_OK != Ttk_GetSlaveIndexFromObj( interp,pw->paned.mgr,objv[2],&destIndex)) { return TCL_ERROR; } srcIndex = Ttk_SlaveIndex(pw->paned.mgr, slaveWindow); if (srcIndex < 0) { /* New slave: */ return AddPane(interp, pw, destIndex, slaveWindow, objc-4, objv+4); } /* else -- move existing slave: */ if (destIndex >= nSlaves) destIndex = nSlaves - 1; Ttk_ReorderSlave(pw->paned.mgr, srcIndex, destIndex); return objc == 4 ? TCL_OK : ConfigurePane(interp, pw, Ttk_SlaveData(pw->paned.mgr, destIndex), Ttk_SlaveWindow(pw->paned.mgr, destIndex), objc-4,objv+4); } /* $pw forget $pane */ static int PanedForgetCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Paned *pw = recordPtr; int paneIndex; if (objc != 3) { Tcl_WrongNumArgs(interp, 2,objv, "pane"); return TCL_ERROR; } if (TCL_OK != Ttk_GetSlaveIndexFromObj( interp, pw->paned.mgr, objv[2], &paneIndex)) { return TCL_ERROR; } Ttk_ForgetSlave(pw->paned.mgr, paneIndex); return TCL_OK; } /* $pw identify $x $y -- * Return index of sash at $x,$y */ static int PanedIdentifyCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Paned *pw = recordPtr; int sashThickness = pw->paned.sashThickness; int nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1; int x, y, pos; int index; if (objc != 4) { Tcl_WrongNumArgs(interp, 2,objv, "x y"); return TCL_ERROR; } if ( Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK ) { return TCL_ERROR; } pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y; for (index = 0; index < nSashes; ++index) { Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) { Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); return TCL_OK; } } return TCL_OK; /* return empty string */ } /* $pw pane $pane ?-option ?value -option value ...?? * Query/modify pane options. */ static int PanedPaneCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Paned *pw = recordPtr; int paneIndex; Tk_Window slaveWindow; Pane *pane; if (objc < 3) { Tcl_WrongNumArgs(interp, 2,objv, "pane ?-option value...?"); return TCL_ERROR; } if (TCL_OK != Ttk_GetSlaveIndexFromObj( interp,pw->paned.mgr,objv[2],&paneIndex)) { return TCL_ERROR; } pane = Ttk_SlaveData(pw->paned.mgr, paneIndex); slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, paneIndex); switch (objc) { case 3: return TtkEnumerateOptions(interp, pane, PaneOptionSpecs, pw->paned.paneOptionTable, slaveWindow); case 4: return TtkGetOptionValue(interp, pane, objv[3], pw->paned.paneOptionTable, slaveWindow); default: return ConfigurePane(interp, pw, pane, slaveWindow, objc-3,objv+3); } } /* $pw panes -- * Return list of managed panes. */ static int PanedPanesCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Paned *pw = recordPtr; Ttk_Manager *mgr = pw->paned.mgr; Tcl_Obj *panes; int i; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } panes = Tcl_NewListObj(0, NULL); for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) { const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i)); Tcl_ListObjAppendElement(interp, panes, Tcl_NewStringObj(pathName,-1)); } Tcl_SetObjResult(interp, panes); return TCL_OK; } /* $pw sashpos $index ?$newpos? * Query or modify sash position. */ static int PanedSashposCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Paned *pw = recordPtr; int sashIndex, position = -1; Pane *pane; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2,objv, "index ?newpos?"); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) { return TCL_ERROR; } if (sashIndex < 0 || sashIndex >= Ttk_NumberSlaves(pw->paned.mgr) - 1) { Tcl_AppendResult(interp, "sash index ", Tcl_GetString(objv[2]), " out of range", NULL); return TCL_ERROR; } pane = Ttk_SlaveData(pw->paned.mgr, sashIndex); if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos)); return TCL_OK; } /* else -- set new sash position */ if (Tcl_GetIntFromObj(interp, objv[3], &position) != TCL_OK) { return TCL_ERROR; } if (position < pane->sashPos) { ShoveUp(pw, sashIndex, position); } else { ShoveDown(pw, sashIndex, position); } AdjustPanes(pw); Ttk_ManagerLayoutChanged(pw->paned.mgr); Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos)); return TCL_OK; } static WidgetCommandSpec PanedCommands[] = { { "add", PanedAddCommand }, { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "forget", PanedForgetCommand }, { "identify", PanedIdentifyCommand }, { "insert", PanedInsertCommand }, { "instate", TtkWidgetInstateCommand }, { "pane", PanedPaneCommand }, { "panes", PanedPanesCommand }, { "sashpos", PanedSashposCommand }, { "state", TtkWidgetStateCommand }, { 0,0 } }; /*------------------------------------------------------------------------ * +++ Widget specification. */ static WidgetSpec PanedWidgetSpec = { "TPanedwindow", /* className */ sizeof(Paned), /* recordSize */ PanedOptionSpecs, /* optionSpecs */ PanedCommands, /* subcommands */ PanedInitialize, /* initializeProc */ PanedCleanup, /* cleanupProc */ TtkCoreConfigure, /* configureProc */ PanedPostConfigure, /* postConfigureProc */ PanedGetLayout, /* getLayoutProc */ PanedSize, /* sizeProc */ TtkWidgetDoLayout, /* layoutProc */ PanedDisplay /* displayProc */ }; /*------------------------------------------------------------------------ * +++ Elements and layouts. */ typedef struct { Tcl_Obj *thicknessObj; } SashElement; static Ttk_ElementOptionSpec SashElementOptions[] = { { "-sashthickness", TK_OPTION_INT, Tk_Offset(SashElement,thicknessObj), "5" }, {NULL} }; static void SashElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SashElement *sash = elementRecord; int thickness = MIN_SASH_THICKNESS; Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness); *widthPtr = *heightPtr = thickness; } static Ttk_ElementSpec SashElementSpec = { TK_STYLE_VERSION_2, sizeof(SashElement), SashElementOptions, SashElementSize, TtkNullElementDraw }; TTK_BEGIN_LAYOUT(PanedLayout) TTK_NODE("Panedwindow.background", 0)/* @@@ BUG: empty layouts don't work */ TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalSashLayout) TTK_NODE("Sash.hsash", TTK_FILL_X) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(VerticalSashLayout) TTK_NODE("Sash.vsash", TTK_FILL_Y) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Registration routine. */ void TtkPanedwindow_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); RegisterWidget(interp, "ttk::panedwindow", &PanedWidgetSpec); Ttk_RegisterElement(interp, themePtr, "hsash", &SashElementSpec, 0); Ttk_RegisterElement(interp, themePtr, "vsash", &SashElementSpec, 0); Ttk_RegisterLayout(themePtr, "TPanedwindow", PanedLayout); Ttk_RegisterLayout(themePtr, "Horizontal.Sash", HorizontalSashLayout); Ttk_RegisterLayout(themePtr, "Vertical.Sash", VerticalSashLayout); } tile-0.8.2/generic/pkgIndex.tcl.in0000644000076500007650000000020210312325664016336 0ustar joejoe00000000000000# @configure_input@ # package ifneeded tile @PACKAGE_VERSION@ \ [list load [file join $dir tile[info sharedlibext]]] #*EOF* tile-0.8.2/generic/progress.c0000644000076500007650000003506610540325502015476 0ustar joejoe00000000000000/* progress.c,v 1.16 2006/12/14 19:51:30 jenglish Exp * * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham * * ttk::progressbar widget. */ #include #include #include "tkTheme.h" #include "widget.h" /*------------------------------------------------------------------------ * +++ Widget record: */ #define DEF_PROGRESSBAR_LENGTH "100" enum { TTK_PROGRESSBAR_DETERMINATE, TTK_PROGRESSBAR_INDETERMINATE }; static const char *ProgressbarModeStrings[] = { "determinate", "indeterminate", NULL }; typedef struct { Tcl_Obj *orientObj; Tcl_Obj *lengthObj; Tcl_Obj *modeObj; Tcl_Obj *variableObj; Tcl_Obj *maximumObj; Tcl_Obj *valueObj; Tcl_Obj *phaseObj; int mode; Ttk_TraceHandle *variableTrace; /* Trace handle for -variable option */ int period; /* Animation period */ int maxPhase; /* Max animation phase */ Tcl_TimerToken timer; /* Animation timer */ } ProgressbarPart; typedef struct { WidgetCore core; ProgressbarPart progress; } Progressbar; static Tk_OptionSpec ProgressbarOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Progressbar,progress.orientObj), -1, 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_PROGRESSBAR_LENGTH, Tk_Offset(Progressbar,progress.lengthObj), -1, 0, 0, GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate", Tk_Offset(Progressbar,progress.modeObj), Tk_Offset(Progressbar,progress.mode), 0, (ClientData)ProgressbarModeStrings, 0 }, {TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum", "100", Tk_Offset(Progressbar,progress.maximumObj), -1, 0, 0, 0 }, {TK_OPTION_STRING, "-variable", "variable", "Variable", NULL, Tk_Offset(Progressbar,progress.variableObj), -1, TK_OPTION_NULL_OK, 0, 0 }, {TK_OPTION_DOUBLE, "-value", "value", "Value", "0.0", Tk_Offset(Progressbar,progress.valueObj), -1, 0, 0, 0 }, {TK_OPTION_INT, "-phase", "phase", "Phase", "0", Tk_Offset(Progressbar,progress.phaseObj), -1, 0, 0, 0 }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Animation procedures: */ /* AnimationEnabled -- * Returns 1 if animation should be active, 0 otherwise. */ static int AnimationEnabled(Progressbar *pb) { double maximum = 100, value = 0; Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value); return pb->progress.period > 0 && value > 0.0 && ( value < maximum || pb->progress.mode == TTK_PROGRESSBAR_INDETERMINATE); } /* AnimateProgressProc -- * Timer callback for progress bar animation. * Increments the -phase option, redisplays the widget, * and reschedules itself if animation still enabled. */ static void AnimateProgressProc(ClientData clientData) { Progressbar *pb = clientData; pb->progress.timer = 0; if (AnimationEnabled(pb)) { int phase = 0; Tcl_GetIntFromObj(NULL, pb->progress.phaseObj, &phase); /* * Update -phase: */ ++phase; if (pb->progress.maxPhase) phase %= pb->progress.maxPhase; Tcl_DecrRefCount(pb->progress.phaseObj); pb->progress.phaseObj = Tcl_NewIntObj(phase); Tcl_IncrRefCount(pb->progress.phaseObj); /* * Reschedule: */ pb->progress.timer = Tcl_CreateTimerHandler( pb->progress.period, AnimateProgressProc, clientData); TtkRedisplayWidget(&pb->core); } } /* CheckAnimation -- * If animation is enabled and not scheduled, schedule it. * If animation is disabled but scheduled, cancel it. */ static void CheckAnimation(Progressbar *pb) { if (AnimationEnabled(pb)) { if (pb->progress.timer == 0) { pb->progress.timer = Tcl_CreateTimerHandler( pb->progress.period, AnimateProgressProc, (ClientData)pb); } } else { if (pb->progress.timer != 0) { Tcl_DeleteTimerHandler(pb->progress.timer); pb->progress.timer = 0; } } } /*------------------------------------------------------------------------ * +++ Trace hook for progressbar -variable option: */ static void VariableChanged(void *recordPtr, const char *value) { Progressbar *pb = recordPtr; Tcl_Obj *newValue; double scratch; if (WidgetDestroyed(&pb->core)) { return; } if (!value) { /* Linked variable is unset -- disable widget */ TtkWidgetChangeState(&pb->core, TTK_STATE_DISABLED, 0); return; } TtkWidgetChangeState(&pb->core, 0, TTK_STATE_DISABLED); newValue = Tcl_NewStringObj(value, -1); Tcl_IncrRefCount(newValue); if (Tcl_GetDoubleFromObj(NULL, newValue, &scratch) != TCL_OK) { TtkWidgetChangeState(&pb->core, TTK_STATE_INVALID, 0); return; } TtkWidgetChangeState(&pb->core, 0, TTK_STATE_INVALID); Tcl_DecrRefCount(pb->progress.valueObj); pb->progress.valueObj = newValue; CheckAnimation(pb); TtkRedisplayWidget(&pb->core); } /*------------------------------------------------------------------------ * +++ Widget class methods: */ static int ProgressbarInitialize(Tcl_Interp *interp, void *recordPtr) { Progressbar *pb = recordPtr; pb->progress.variableTrace = 0; pb->progress.timer = 0; return TCL_OK; } static void ProgressbarCleanup(void *recordPtr) { Progressbar *pb = recordPtr; if (pb->progress.variableTrace) Ttk_UntraceVariable(pb->progress.variableTrace); if (pb->progress.timer) Tcl_DeleteTimerHandler(pb->progress.timer); } /* * Configure hook: * * @@@ TODO: deal with [$pb configure -value ... -variable ...] */ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Progressbar *pb = recordPtr; Tcl_Obj *varName = pb->progress.variableObj; Ttk_TraceHandle *vt = 0; if (varName != NULL && *Tcl_GetString(varName) != '\0') { vt = Ttk_TraceVariable(interp, varName, VariableChanged, recordPtr); if (!vt) return TCL_ERROR; } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } if (pb->progress.variableTrace) { Ttk_UntraceVariable(pb->progress.variableTrace); } pb->progress.variableTrace = vt; return TCL_OK; } /* * Post-configuration hook: */ static int ProgressbarPostConfigure( Tcl_Interp *interp, void *recordPtr, int mask) { Progressbar *pb = recordPtr; int status = TCL_OK; if (pb->progress.variableTrace) { status = Ttk_FireTrace(pb->progress.variableTrace); if (WidgetDestroyed(&pb->core)) { return TCL_ERROR; } if (status != TCL_OK) { /* Unset -variable: */ Ttk_UntraceVariable(pb->progress.variableTrace); Tcl_DecrRefCount(pb->progress.variableObj); pb->progress.variableTrace = 0; pb->progress.variableObj = NULL; return TCL_ERROR; } } CheckAnimation(pb); return status; } /* * Size hook: * Compute base layout size, overrid */ static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr) { Progressbar *pb = recordPtr; int length = 100, orient = TTK_ORIENT_HORIZONTAL; TtkWidgetSize(recordPtr, widthPtr, heightPtr); /* Override requested width (height) based on -length and -orient */ Tk_GetPixelsFromObj(NULL, pb->core.tkwin, pb->progress.lengthObj, &length); Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = length; } else { *heightPtr = length; } return 1; } /* * Layout hook: * Adjust size and position of pbar element, if present. */ static void ProgressbarDeterminateLayout( Progressbar *pb, Ttk_LayoutNode *pbarNode, Ttk_Box parcel, double fraction, Ttk_Orient orient) { if (fraction < 0.0) fraction = 0.0; if (fraction > 1.0) fraction = 1.0; if (orient == TTK_ORIENT_HORIZONTAL) { parcel.width = (int)(parcel.width * fraction); } else { int newHeight = (int)(parcel.height * fraction); parcel.y += (parcel.height - newHeight); parcel.height = newHeight; } Ttk_PlaceLayoutNode(pb->core.layout, pbarNode, parcel); } static void ProgressbarIndeterminateLayout( Progressbar *pb, Ttk_LayoutNode *pbarNode, Ttk_Box parcel, double fraction, Ttk_Orient orient) { Ttk_Box pbarBox = Ttk_LayoutNodeParcel(pbarNode); fraction = fmod(fabs(fraction), 2.0); if (fraction > 1.0) { fraction = 2.0 - fraction; } if (orient == TTK_ORIENT_HORIZONTAL) { pbarBox.x = parcel.x + (int)(fraction * (parcel.width-pbarBox.width)); } else { pbarBox.y = parcel.y + (int)(fraction * (parcel.height-pbarBox.height)); } Ttk_PlaceLayoutNode(pb->core.layout, pbarNode, pbarBox); } static void ProgressbarDoLayout(void *recordPtr) { Progressbar *pb = recordPtr; WidgetCore *corePtr = &pb->core; Ttk_LayoutNode *pbarNode = Ttk_LayoutFindNode(corePtr->layout, "pbar"); Ttk_LayoutNode *troughNode = Ttk_LayoutFindNode(corePtr->layout, "trough"); double value = 0.0, maximum = 100.0; int orient = TTK_ORIENT_HORIZONTAL; Ttk_Box parcel = Ttk_WinBox(corePtr->tkwin); Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); /* Adjust the bar size: */ Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value); Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (pbarNode) { double fraction = value / maximum; if (troughNode) { parcel = Ttk_LayoutNodeInternalParcel(corePtr->layout, troughNode); } if (pb->progress.mode == TTK_PROGRESSBAR_DETERMINATE) { ProgressbarDeterminateLayout( pb, pbarNode, parcel, fraction, orient); } else { ProgressbarIndeterminateLayout( pb, pbarNode, parcel, fraction, orient); } } } static Ttk_Layout ProgressbarGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Progressbar *pb = recordPtr; Ttk_Layout layout = TtkWidgetGetOrientedLayout( interp, theme, recordPtr, pb->progress.orientObj); /* * Check if the style supports animation: */ pb->progress.period = 0; pb->progress.maxPhase = 0; if (layout) { Tcl_Obj *periodObj = Ttk_QueryOption(layout,"-period", 0); Tcl_Obj *maxPhaseObj = Ttk_QueryOption(layout,"-maxphase", 0); if (periodObj) Tcl_GetIntFromObj(NULL, periodObj, &pb->progress.period); if (maxPhaseObj) Tcl_GetIntFromObj(NULL, maxPhaseObj, &pb->progress.maxPhase); } return layout; } /*------------------------------------------------------------------------ * +++ Widget commands: */ /* $sb step ?amount? */ static int ProgressbarStepCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Progressbar *pb = recordPtr; double value = 0.0, stepAmount = 1.0; Tcl_Obj *newValueObj; if (objc == 3) { if (Tcl_GetDoubleFromObj(interp, objv[2], &stepAmount) != TCL_OK) { return TCL_ERROR; } } else if (objc != 2) { Tcl_WrongNumArgs(interp, 2,objv, "?stepAmount?"); return TCL_ERROR; } (void)Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value); value += stepAmount; /* In determinate mode, wrap around if value exceeds maximum: */ if (pb->progress.mode == TTK_PROGRESSBAR_DETERMINATE) { double maximum = 100.0; (void)Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); value = fmod(value, maximum); } newValueObj = Tcl_NewDoubleObj(value); TtkRedisplayWidget(&pb->core); /* Update value by setting the linked -variable, if there is one: */ if (pb->progress.variableTrace) { return Tcl_ObjSetVar2( interp, pb->progress.variableObj, 0, newValueObj, TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG) ? TCL_OK : TCL_ERROR; } /* Otherwise, change the -value directly: */ Tcl_IncrRefCount(newValueObj); Tcl_DecrRefCount(pb->progress.valueObj); pb->progress.valueObj = newValueObj; CheckAnimation(pb); return TCL_OK; } /* $sb start|stop ?args? -- * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...] * and pass to interpreter. */ static int ProgressbarStartStopCommand( Tcl_Interp *interp, const char *cmdName, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *cmd = Tcl_NewListObj(objc, objv); Tcl_Obj *prefix[2]; int status; /* ASSERT: objc >= 2 */ prefix[0] = Tcl_NewStringObj(cmdName, -1); prefix[1] = objv[0]; Tcl_ListObjReplace(interp, cmd, 0,2, 2,prefix); Tcl_IncrRefCount(cmd); status = Tcl_EvalObjEx(interp, cmd, 0); Tcl_DecrRefCount(cmd); return status; } static int ProgressbarStartCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { return ProgressbarStartStopCommand( interp, "::ttk::progressbar::start", objc, objv); } static int ProgressbarStopCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { return ProgressbarStartStopCommand( interp, "::ttk::progressbar::stop", objc, objv); } static WidgetCommandSpec ProgressbarCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "identify", TtkWidgetIdentifyCommand }, { "instate", TtkWidgetInstateCommand }, { "start", ProgressbarStartCommand }, { "state", TtkWidgetStateCommand }, { "step", ProgressbarStepCommand }, { "stop", ProgressbarStopCommand }, { NULL, NULL } }; /* * Widget specification: */ static WidgetSpec ProgressbarWidgetSpec = { "TProgressbar", /* className */ sizeof(Progressbar), /* recordSize */ ProgressbarOptionSpecs, /* optionSpecs */ ProgressbarCommands, /* subcommands */ ProgressbarInitialize, /* initializeProc */ ProgressbarCleanup, /* cleanupProc */ ProgressbarConfigure, /* configureProc */ ProgressbarPostConfigure, /* postConfigureProc */ ProgressbarGetLayout, /* getLayoutProc */ ProgressbarSize, /* sizeProc */ ProgressbarDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; /* * Layouts: */ TTK_BEGIN_LAYOUT(VerticalProgressbarLayout) TTK_GROUP("Vertical.Progressbar.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Progressbar.pbar", TTK_PACK_BOTTOM|TTK_FILL_X)) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalProgressbarLayout) TTK_GROUP("Horizontal.Progressbar.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Progressbar.pbar", TTK_PACK_LEFT|TTK_FILL_Y)) TTK_END_LAYOUT /* * Initialization: */ void TtkProgressbar_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(themePtr, "Vertical.TProgressbar", VerticalProgressbarLayout); Ttk_RegisterLayout(themePtr, "Horizontal.TProgressbar", HorizontalProgressbarLayout); RegisterWidget(interp, "ttk::progressbar", &ProgressbarWidgetSpec); } /*EOF*/ tile-0.8.2/generic/scale.c0000644000076500007650000003311710710035347014720 0ustar joejoe00000000000000/* scale.c,v 1.50 2007/10/25 06:42:47 jenglish Exp * Copyright (C) 2004 Pat Thoyts * * ttk::scale widget. */ #include #include #include #include "tkTheme.h" #include "widget.h" #define DEF_SCALE_LENGTH "100" #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) /* * Scale widget record */ typedef struct { /* slider element options */ Tcl_Obj *fromObj; /* minimum value */ Tcl_Obj *toObj; /* maximum value */ Tcl_Obj *valueObj; /* current value */ Tcl_Obj *lengthObj; /* length of the long axis of the scale */ Tcl_Obj *orientObj; /* widget orientation */ int orient; /* widget options */ Tcl_Obj *commandObj; Tcl_Obj *variableObj; /* internal state */ Ttk_TraceHandle *variableTrace; } ScalePart; typedef struct { WidgetCore core; ScalePart scale; } Scale; static Tk_OptionSpec ScaleOptionSpecs[] = { WIDGET_TAKES_FOCUS, {TK_OPTION_STRING, "-command", "command", "Command", "", Tk_Offset(Scale,scale.commandObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", "", Tk_Offset(Scale,scale.variableObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Scale,scale.orientObj), Tk_Offset(Scale,scale.orient), 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", "1.0", Tk_Offset(Scale,scale.toObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-value", "value", "Value", "0", Tk_Offset(Scale,scale.valueObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0, GEOMETRY_CHANGED}, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static XPoint ValueToPoint(Scale *scalePtr, double value); static double PointToValue(Scale *scalePtr, int x, int y); /* ScaleVariableChanged -- * Variable trace procedure for scale -variable; * Updates the scale's value. * If the linked variable is not a valid double, * sets the 'invalid' state. */ static void ScaleVariableChanged(void *recordPtr, const char *value) { Scale *scale = recordPtr; double v; if (value == NULL || Tcl_GetDouble(0, value, &v) != TCL_OK) { TtkWidgetChangeState(&scale->core, TTK_STATE_INVALID, 0); } else { Tcl_Obj *valueObj = Tcl_NewDoubleObj(v); Tcl_IncrRefCount(valueObj); Tcl_DecrRefCount(scale->scale.valueObj); scale->scale.valueObj = valueObj; TtkWidgetChangeState(&scale->core, 0, TTK_STATE_INVALID); } TtkRedisplayWidget(&scale->core); } /* ScaleInitialize -- * Scale widget initialization hook. */ static int ScaleInitialize(Tcl_Interp *interp, void *recordPtr) { Scale *scalePtr = recordPtr; TtkTrackElementState(&scalePtr->core); return TCL_OK; } static void ScaleCleanup(void *recordPtr) { Scale *scale = recordPtr; if (scale->scale.variableTrace) { Ttk_UntraceVariable(scale->scale.variableTrace); scale->scale.variableTrace = 0; } } /* ScaleConfigure -- * Configuration hook. */ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Scale *scale = recordPtr; Tcl_Obj *varName = scale->scale.variableObj; Ttk_TraceHandle *vt = 0; if (varName != NULL && *Tcl_GetString(varName) != '\0') { vt = Ttk_TraceVariable(interp,varName, ScaleVariableChanged,recordPtr); if (!vt) return TCL_ERROR; } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } if (scale->scale.variableTrace) { Ttk_UntraceVariable(scale->scale.variableTrace); } scale->scale.variableTrace = vt; return TCL_OK; } /* ScalePostConfigure -- * Post-configuration hook. */ static int ScalePostConfigure( Tcl_Interp *interp, void *recordPtr, int mask) { Scale *scale = recordPtr; int status = TCL_OK; if (scale->scale.variableTrace) { status = Ttk_FireTrace(scale->scale.variableTrace); if (WidgetDestroyed(&scale->core)) { return TCL_ERROR; } if (status != TCL_OK) { /* Unset -variable: */ Ttk_UntraceVariable(scale->scale.variableTrace); Tcl_DecrRefCount(scale->scale.variableObj); scale->scale.variableTrace = 0; scale->scale.variableObj = NULL; status = TCL_ERROR; } } return status; } /* ScaleGetLayout -- * getLayout hook. */ static Ttk_Layout ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Scale *scalePtr = recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, scalePtr->scale.orientObj); } /* * TroughBox -- * Returns the inner area of the trough element. */ static Ttk_Box TroughBox(Scale *scalePtr) { WidgetCore *corePtr = &scalePtr->core; Ttk_LayoutNode *node = Ttk_LayoutFindNode(corePtr->layout, "trough"); if (node) { return Ttk_LayoutNodeInternalParcel(corePtr->layout, node); } else { return Ttk_MakeBox( 0,0, Tk_Width(corePtr->tkwin), Tk_Height(corePtr->tkwin)); } } /* * TroughRange -- * Return the value area of the trough element, adjusted * for slider size. */ static Ttk_Box TroughRange(Scale *scalePtr) { Ttk_Box troughBox = TroughBox(scalePtr); Ttk_LayoutNode *slider=Ttk_LayoutFindNode(scalePtr->core.layout,"slider"); /* * If this is a scale widget, adjust range for slider: */ if (slider) { Ttk_Box sliderBox = Ttk_LayoutNodeParcel(slider); if (scalePtr->scale.orient == TTK_ORIENT_HORIZONTAL) { troughBox.x += sliderBox.width / 2; troughBox.width -= sliderBox.width; } else { troughBox.y += sliderBox.height / 2; troughBox.height -= sliderBox.height; } } return troughBox; } /* * ScaleFraction -- */ static double ScaleFraction(Scale *scalePtr, double value) { double from = 0, to = 1, fraction; Tcl_GetDoubleFromObj(NULL, scalePtr->scale.fromObj, &from); Tcl_GetDoubleFromObj(NULL, scalePtr->scale.toObj, &to); if (from == to) { return 1.0; } fraction = (value - from) / (to - from); return fraction < 0 ? 0 : fraction > 1 ? 1 : fraction; } /* $scale get ?x y? -- * Returns the current value of the scale widget, or if $x and * $y are specified, the value represented by point @x,y. */ static int ScaleGetCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Scale *scalePtr = recordPtr; int x, y, r = TCL_OK; double value = 0; if ((objc != 2) && (objc != 4)) { Tcl_WrongNumArgs(interp, 1, objv, "get ?x y?"); return TCL_ERROR; } if (objc == 2) { Tcl_SetObjResult(interp, scalePtr->scale.valueObj); } else { r = Tcl_GetIntFromObj(interp, objv[2], &x); if (r == TCL_OK) r = Tcl_GetIntFromObj(interp, objv[3], &y); if (r == TCL_OK) { value = PointToValue(scalePtr, x, y); Tcl_SetObjResult(interp, Tcl_NewDoubleObj(value)); } } return r; } /* $scale set $newValue */ static int ScaleSetCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Scale *scalePtr = recordPtr; double from = 0.0, to = 1.0, value; int result = TCL_OK; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "set value"); return TCL_ERROR; } if (Tcl_GetDoubleFromObj(interp, objv[2], &value) != TCL_OK) { return TCL_ERROR; } if (scalePtr->core.state & TTK_STATE_DISABLED) { return TCL_OK; } /* ASSERT: fromObj and toObj are valid doubles. */ Tcl_GetDoubleFromObj(interp, scalePtr->scale.fromObj, &from); Tcl_GetDoubleFromObj(interp, scalePtr->scale.toObj, &to); /* Limit new value to between 'from' and 'to': */ if (from < to) { value = value < from ? from : value > to ? to : value; } else { value = value < to ? to : value > from ? from : value; } /* * Set value: */ Tcl_DecrRefCount(scalePtr->scale.valueObj); scalePtr->scale.valueObj = Tcl_NewDoubleObj(value); Tcl_IncrRefCount(scalePtr->scale.valueObj); TtkRedisplayWidget(&scalePtr->core); /* * Set attached variable, if any: */ if (scalePtr->scale.variableObj != NULL) { Tcl_ObjSetVar2(interp, scalePtr->scale.variableObj, NULL, scalePtr->scale.valueObj, TCL_GLOBAL_ONLY); } if (WidgetDestroyed(&scalePtr->core)) { return TCL_ERROR; } /* * Invoke -command, if any: */ if (scalePtr->scale.commandObj != NULL) { Tcl_Obj *cmdObj = Tcl_DuplicateObj(scalePtr->scale.commandObj); Tcl_IncrRefCount(cmdObj); Tcl_AppendToObj(cmdObj, " ", 1); Tcl_AppendObjToObj(cmdObj, scalePtr->scale.valueObj); result = Tcl_EvalObjEx(interp, cmdObj, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(cmdObj); } return result; } static int ScaleCoordsCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Scale *scalePtr = recordPtr; double value; int r = TCL_OK; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "coords ?value?"); return TCL_ERROR; } if (objc == 3) { r = Tcl_GetDoubleFromObj(interp, objv[2], &value); } else { r = Tcl_GetDoubleFromObj(interp, scalePtr->scale.valueObj, &value); } if (r == TCL_OK) { Tcl_Obj *point[2]; XPoint pt = ValueToPoint(scalePtr, value); point[0] = Tcl_NewIntObj(pt.x); point[1] = Tcl_NewIntObj(pt.y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, point)); } return r; } static void ScaleDoLayout(void *clientData) { WidgetCore *corePtr = clientData; Ttk_LayoutNode *sliderNode = Ttk_LayoutFindNode(corePtr->layout, "slider"); Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); /* Adjust the slider position: */ if (sliderNode) { Scale *scalePtr = clientData; Ttk_Box troughBox = TroughBox(scalePtr); Ttk_Box sliderBox = Ttk_LayoutNodeParcel(sliderNode); double value = 0.0; double fraction; int range; Tcl_GetDoubleFromObj(NULL, scalePtr->scale.valueObj, &value); fraction = ScaleFraction(scalePtr, value); if (scalePtr->scale.orient == TTK_ORIENT_HORIZONTAL) { range = troughBox.width - sliderBox.width; sliderBox.x += (int)(fraction * range); } else { range = troughBox.height - sliderBox.height; sliderBox.y += (int)(fraction * range); } Ttk_PlaceLayoutNode(corePtr->layout, sliderNode, sliderBox); } } /* * ScaleSize -- * Compute requested size of scale. */ static int ScaleSize(void *clientData, int *widthPtr, int *heightPtr) { WidgetCore *corePtr = clientData; Scale *scalePtr = clientData; int length; Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr); /* Assert the -length configuration option */ Tk_GetPixelsFromObj(NULL, corePtr->tkwin, scalePtr->scale.lengthObj, &length); if (scalePtr->scale.orient == TTK_ORIENT_VERTICAL) { *heightPtr = MAX(*heightPtr, length); } else { *widthPtr = MAX(*widthPtr, length); } return 1; } static double PointToValue(Scale *scalePtr, int x, int y) { Ttk_Box troughBox = TroughRange(scalePtr); double from = 0, to = 1, fraction; Tcl_GetDoubleFromObj(NULL, scalePtr->scale.fromObj, &from); Tcl_GetDoubleFromObj(NULL, scalePtr->scale.toObj, &to); if (scalePtr->scale.orient == TTK_ORIENT_HORIZONTAL) { fraction = (double)(x - troughBox.x) / (double)troughBox.width; } else { fraction = (double)(y - troughBox.y) / (double)troughBox.height; } fraction = fraction < 0 ? 0 : fraction > 1 ? 1 : fraction; return from + fraction * (to-from); } /* * Return the center point in the widget corresponding to the given * value. This point can be used to center the slider. */ static XPoint ValueToPoint(Scale *scalePtr, double value) { Ttk_Box troughBox = TroughRange(scalePtr); double fraction = ScaleFraction(scalePtr, value); XPoint pt = {0, 0}; if (scalePtr->scale.orient == TTK_ORIENT_HORIZONTAL) { pt.x = troughBox.x + (int)(fraction * troughBox.width); pt.y = troughBox.y + troughBox.height / 2; } else { pt.x = troughBox.x + troughBox.width / 2; pt.y = troughBox.y + (int)(fraction * troughBox.height); } return pt; } static WidgetCommandSpec ScaleCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "state", TtkWidgetStateCommand }, { "instate", TtkWidgetInstateCommand }, { "identify", TtkWidgetIdentifyCommand }, { "set", ScaleSetCommand }, { "get", ScaleGetCommand }, { "coords", ScaleCoordsCommand }, { 0, 0 } }; static WidgetSpec ScaleWidgetSpec = { "TScale", /* Class name */ sizeof(Scale), /* record size */ ScaleOptionSpecs, /* option specs */ ScaleCommands, /* widget commands */ ScaleInitialize, /* initialization proc */ ScaleCleanup, /* cleanup proc */ ScaleConfigure, /* configure proc */ ScalePostConfigure, /* postConfigure */ ScaleGetLayout, /* getLayoutProc */ ScaleSize, /* sizeProc */ ScaleDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(VerticalScaleLayout) TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) ) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalScaleLayout) TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) ) TTK_END_LAYOUT /* * Initialization. */ void TtkScale_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme, "Vertical.TScale", VerticalScaleLayout); Ttk_RegisterLayout(theme, "Horizontal.TScale", HorizontalScaleLayout); RegisterWidget(interp, "ttk::scale", &ScaleWidgetSpec); } tile-0.8.2/generic/scroll.c0000644000076500007650000001441310541527126015130 0ustar joejoe00000000000000/* scroll.c,v 1.9 2006/12/18 15:05:58 jenglish Exp * * Copyright 2004, Joe English * * Support routines for scrollable widgets. * * (This is sort of half-baked; needs some work) * * Scrollable interface: * * + 'first' is controlled by [xy]view widget command * and other scrolling commands like 'see'; * + 'total' depends on widget contents; * + 'last' depends on first, total, and widget size. * * Choreography (typical usage): * * 1. User adjusts scrollbar, scrollbar widget calls its -command * 2. Scrollbar -command invokes the scrollee [xy]view widget method * 3. TtkScrollviewCommand calls TtkScrollTo(), which updates * 'first' and schedules a redisplay. * 4. Once the scrollee knows 'total' and 'last' (typically in * the LayoutProc), call TtkScrolled(h,first,last,total) to * synchronize the scrollbar. * 5. The scrollee -[xy]scrollcommand is called (in an idle callback) * 6. Which calls the scrollbar 'set' method and redisplays the scrollbar. * * If the scrollee has internal scrolling (e.g., a 'see' method), * it should TtkScrollTo() directly (step 2). * * If the widget value changes, it should call TtkScrolled() (step 4). * (This usually happens automatically when the widget is redisplayed). * * If the scrollee's -[xy]scrollcommand changes, it should call * TtkScrollbarUpdateRequired, which will invoke step (5) (@@@ Fix this) */ #include #include "tkTheme.h" #include "widget.h" /* Private data: */ #define SCROLL_UPDATE_PENDING (0x1) #define SCROLL_UPDATE_REQUIRED (0x2) struct ScrollHandleRec { unsigned flags; WidgetCore *corePtr; Scrollable *scrollPtr; }; /* TtkCreateScrollHandle -- * Initialize scroll handle. */ ScrollHandle TtkCreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr) { ScrollHandle h = (ScrollHandle)ckalloc(sizeof(*h)); h->flags = 0; h->corePtr = corePtr; h->scrollPtr = scrollPtr; scrollPtr->first = 0; scrollPtr->last = 1; scrollPtr->total = 1; return h; } /* UpdateScrollbar -- * Call the -scrollcommand callback to sync the scrollbar. * Returns: Whatever the -scrollcommand does. */ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h) { Scrollable *s = h->scrollPtr; WidgetCore *corePtr = h->corePtr; char args[TCL_DOUBLE_SPACE * 2]; int code; h->flags &= ~SCROLL_UPDATE_REQUIRED; if (s->scrollCmd == NULL) { return TCL_OK; } sprintf(args, " %g %g", (double)s->first / s->total, (double)s->last / s->total); Tcl_Preserve(corePtr); code = Tcl_VarEval(interp, s->scrollCmd, args, NULL); if (WidgetDestroyed(corePtr)) { Tcl_Release(corePtr); return TCL_ERROR; } Tcl_Release(corePtr); if (code != TCL_OK && !Tcl_InterpDeleted(interp)) { /* Disable the -scrollcommand, add to stack trace: */ ckfree(s->scrollCmd); s->scrollCmd = 0; Tcl_AddErrorInfo(interp, /* @@@ "horizontal" / "vertical" */ "\n (scrolling command executed by "); Tcl_AddErrorInfo(interp, Tk_PathName(h->corePtr->tkwin)); Tcl_AddErrorInfo(interp, ")"); } return code; } /* UpdateScrollbarBG -- * Idle handler to update the scrollbar. */ static void UpdateScrollbarBG(ClientData clientData) { ScrollHandle h = (ScrollHandle)clientData; Tcl_Interp *interp = h->corePtr->interp; int code; h->flags &= ~SCROLL_UPDATE_PENDING; Tcl_Preserve((ClientData) interp); code = UpdateScrollbar(interp, h); if (code == TCL_ERROR && !Tcl_InterpDeleted(interp)) { Tcl_BackgroundError(interp); } Tcl_Release((ClientData) interp); } /* TtkScrolled -- * Update scroll info, schedule scrollbar update. */ void TtkScrolled(ScrollHandle h, int first, int last, int total) { Scrollable *s = h->scrollPtr; /* Sanity-check inputs: */ if (total <= 0) { first = 0; last = 1; total = 1; } if (last > total) { first -= (last - total); if (first < 0) first = 0; last = total; } if (s->first != first || s->last != last || s->total != total || (h->flags & SCROLL_UPDATE_REQUIRED)) { s->first = first; s->last = last; s->total = total; if (!(h->flags & SCROLL_UPDATE_PENDING)) { Tcl_DoWhenIdle(UpdateScrollbarBG, (ClientData)h); h->flags |= SCROLL_UPDATE_PENDING; } } } /* TtkScrollbarUpdateRequired -- * Force a scrollbar update at the next call to TtkScrolled(), * even if scroll parameters haven't changed (e.g., if * -yscrollcommand has changed). */ void TtkScrollbarUpdateRequired(ScrollHandle h) { h->flags |= SCROLL_UPDATE_REQUIRED; } /* TtkScrollviewCommand -- * Widget [xy]view command implementation. * * $w [xy]view -- return current view region * $w [xy]view $index -- set topmost item * $w [xy]view moveto $fraction * $w [xy]view scroll $number $what -- scrollbar interface */ int TtkScrollviewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle h) { Scrollable *s = h->scrollPtr; int newFirst = s->first; if (objc == 2) { char buf[TCL_DOUBLE_SPACE * 2]; sprintf(buf, "%g %g", (double)s->first / s->total, (double)s->last / s->total); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_OK; } else if (objc == 3) { if (Tcl_GetIntFromObj(interp, objv[2], &newFirst) != TCL_OK) { return TCL_ERROR; } } else { double fraction; int count; switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { case TK_SCROLL_ERROR: return TCL_ERROR; case TK_SCROLL_MOVETO: newFirst = (int) ((fraction * s->total) + 0.5); break; case TK_SCROLL_UNITS: newFirst = s->first + count; break; case TK_SCROLL_PAGES: { int perPage = s->last - s->first; /* @@@ */ newFirst = s->first + count * perPage; break; } } } TtkScrollTo(h, newFirst); return TCL_OK; } void TtkScrollTo(ScrollHandle h, int newFirst) { Scrollable *s = h->scrollPtr; if (newFirst >= s->total) newFirst = s->total - 1; if (newFirst > s->first && s->last >= s->total) /* don't scroll past end */ newFirst = s->first; if (newFirst < 0) newFirst = 0; if (newFirst != s->first) { s->first = newFirst; TtkRedisplayWidget(h->corePtr); } } void TtkFreeScrollHandle(ScrollHandle h) { if (h->flags & SCROLL_UPDATE_PENDING) { Tcl_CancelIdleCall(UpdateScrollbarBG, (ClientData)h); } ckfree((ClientData)h); } tile-0.8.2/generic/scrollbar.c0000644000076500007650000002157110710035347015615 0ustar joejoe00000000000000/* scrollbar.c,v 1.49 2007/10/25 06:42:47 jenglish Exp * Copyright (c) 2003, Joe English * * ttk::scrollbar widget. */ #include #include "tkTheme.h" #include "widget.h" /*------------------------------------------------------------------------ * +++ Scrollbar widget record. */ typedef struct { Tcl_Obj *commandObj; int orient; Tcl_Obj *orientObj; double first; /* top fraction */ double last; /* bottom fraction */ Ttk_Box troughBox; /* trough parcel */ int minSize; /* minimum size of thumb */ } ScrollbarPart; typedef struct { WidgetCore core; ScrollbarPart scrollbar; } Scrollbar; static Tk_OptionSpec ScrollbarOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", Tk_Offset(Scrollbar,scrollbar.commandObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", Tk_Offset(Scrollbar,scrollbar.orientObj), Tk_Offset(Scrollbar,scrollbar.orient), 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Widget hooks. */ static int ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) { Scrollbar *sb = recordPtr; sb->scrollbar.first = 0.0; sb->scrollbar.last = 1.0; TtkTrackElementState(&sb->core); return TCL_OK; } static Ttk_Layout ScrollbarGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Scrollbar *sb = recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, sb->scrollbar.orientObj); } /* * ScrollbarDoLayout -- * Layout hook. Adjusts the position of the scrollbar thumb. * * Side effects: * Sets sb->troughBox and sb->minSize. */ static void ScrollbarDoLayout(void *recordPtr) { Scrollbar *sb = recordPtr; WidgetCore *corePtr = &sb->core; Ttk_LayoutNode *thumb; Ttk_Box thumbBox; int thumbWidth, thumbHeight; double first, last, size; int minSize; /* * Use generic layout manager to compute initial layout: */ Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); /* * Locate thumb element, extract parcel and requested minimum size: */ thumb = Ttk_LayoutFindNode(corePtr->layout, "thumb"); if (!thumb) /* Something has gone wrong -- bail */ return; sb->scrollbar.troughBox = thumbBox = Ttk_LayoutNodeParcel(thumb); Ttk_LayoutNodeReqSize( corePtr->layout, thumb, &thumbWidth,&thumbHeight); /* * Adjust thumb element parcel: */ first = sb->scrollbar.first; last = sb->scrollbar.last; if (sb->scrollbar.orient == TTK_ORIENT_VERTICAL) { minSize = thumbHeight; size = thumbBox.height - minSize; thumbBox.y += (int)(size * first); thumbBox.height = (int)(size * last) + minSize - (int)(size * first); } else { minSize = thumbWidth; size = thumbBox.width - minSize; thumbBox.x += (int)(size * first); thumbBox.width = (int)(size * last) + minSize - (int)(size * first); } sb->scrollbar.minSize = minSize; Ttk_PlaceLayoutNode(corePtr->layout, thumb, thumbBox); } /*------------------------------------------------------------------------ * +++ Widget commands. */ /* $sb set $first $last -- * Set the position of the scrollbar. */ static int ScrollbarSetCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Scrollbar *scrollbar = recordPtr; Tcl_Obj *firstObj, *lastObj; double first, last; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "first last"); return TCL_ERROR; } firstObj = objv[2]; lastObj = objv[3]; if (Tcl_GetDoubleFromObj(interp, firstObj, &first) != TCL_OK || Tcl_GetDoubleFromObj(interp, lastObj, &last) != TCL_OK) return TCL_ERROR; /* Range-checks: */ if (first < 0.0) { first = 0.0; } else if (first > 1.0) { first = 1.0; } if (last < first) { last = first; } else if (last > 1.0) { last = 1.0; } /* ASSERT: 0.0 <= first <= last <= 1.0 */ scrollbar->scrollbar.first = first; scrollbar->scrollbar.last = last; if (first <= 0.0 && last >= 1.0) { scrollbar->core.state |= TTK_STATE_DISABLED; } else { scrollbar->core.state &= ~TTK_STATE_DISABLED; } TtkRedisplayWidget(&scrollbar->core); return TCL_OK; } /* $sb get -- * Returns the last thing passed to 'set'. */ static int ScrollbarGetCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Scrollbar *scrollbar = recordPtr; Tcl_Obj *result[2]; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } result[0] = Tcl_NewDoubleObj(scrollbar->scrollbar.first); result[1] = Tcl_NewDoubleObj(scrollbar->scrollbar.last); Tcl_SetObjResult(interp, Tcl_NewListObj(2, result)); return TCL_OK; } /* $sb delta $dx $dy -- * Returns the percentage change corresponding to a mouse movement * of $dx, $dy. */ static int ScrollbarDeltaCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Scrollbar *sb = recordPtr; double dx, dy; double delta = 0.0; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "dx dy"); return TCL_ERROR; } if (Tcl_GetDoubleFromObj(interp, objv[2], &dx) != TCL_OK || Tcl_GetDoubleFromObj(interp, objv[3], &dy) != TCL_OK) { return TCL_ERROR; } delta = 0.0; if (sb->scrollbar.orient == TTK_ORIENT_VERTICAL) { int size = sb->scrollbar.troughBox.height - sb->scrollbar.minSize; if (size > 0) { delta = (double)dy / (double)size; } } else { int size = sb->scrollbar.troughBox.width - sb->scrollbar.minSize; if (size > 0) { delta = (double)dx / (double)size; } } Tcl_SetObjResult(interp, Tcl_NewDoubleObj(delta)); return TCL_OK; } /* $sb fraction $x $y -- * Returns a real number between 0 and 1 indicating where the * point given by x and y lies in the trough area of the scrollbar. */ static int ScrollbarFractionCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { Scrollbar *sb = recordPtr; Ttk_Box b = sb->scrollbar.troughBox; int minSize = sb->scrollbar.minSize; double x, y; double fraction = 0.0; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "x y"); return TCL_ERROR; } if (Tcl_GetDoubleFromObj(interp, objv[2], &x) != TCL_OK || Tcl_GetDoubleFromObj(interp, objv[3], &y) != TCL_OK) { return TCL_ERROR; } fraction = 0.0; if (sb->scrollbar.orient == TTK_ORIENT_VERTICAL) { if (b.height > minSize) { fraction = (double)(y - b.y) / (double)(b.height - minSize); } } else { if (b.width > minSize) { fraction = (double)(x - b.x) / (double)(b.width - minSize); } } Tcl_SetObjResult(interp, Tcl_NewDoubleObj(fraction)); return TCL_OK; } static WidgetCommandSpec ScrollbarCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "delta", ScrollbarDeltaCommand }, { "fraction", ScrollbarFractionCommand }, { "get", ScrollbarGetCommand }, { "identify", TtkWidgetIdentifyCommand }, { "instate", TtkWidgetInstateCommand }, { "set", ScrollbarSetCommand }, { "state", TtkWidgetStateCommand }, { 0,0 } }; /*------------------------------------------------------------------------ * +++ Widget specification. */ static WidgetSpec ScrollbarWidgetSpec = { "TScrollbar", /* className */ sizeof(Scrollbar), /* recordSize */ ScrollbarOptionSpecs, /* optionSpecs */ ScrollbarCommands, /* subcommands */ ScrollbarInitialize, /* initializeProc */ TtkNullCleanup, /* cleanupProc */ TtkCoreConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ ScrollbarGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ ScrollbarDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(VerticalScrollbarLayout) TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y, TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_TOP) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) TTK_NODE( "Vertical.Scrollbar.thumb", TTK_PACK_TOP|TTK_EXPAND|TTK_FILL_BOTH)) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalScrollbarLayout) TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X, TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_LEFT) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) TTK_NODE( "Horizontal.Scrollbar.thumb", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH)) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ void TtkScrollbar_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme,"Vertical.TScrollbar",VerticalScrollbarLayout); Ttk_RegisterLayout(theme,"Horizontal.TScrollbar",HorizontalScrollbarLayout); RegisterWidget(interp, "ttk::scrollbar", &ScrollbarWidgetSpec); } /*EOF*/ tile-0.8.2/generic/separator.c0000644000076500007650000000655610710035347015640 0ustar joejoe00000000000000/* separator.c,v 1.10 2007/10/25 06:42:47 jenglish Exp * * Copyright (c) 2004, Joe English * * ttk::separator and ttk::sizegrip widgets. */ #include #include "tkTheme.h" #include "widget.h" /* +++ Separator widget record: */ typedef struct { Tcl_Obj *orientObj; int orient; } SeparatorPart; typedef struct { WidgetCore core; SeparatorPart separator; } Separator; static Tk_OptionSpec SeparatorOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Separator,separator.orientObj), Tk_Offset(Separator,separator.orient), 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* * GetLayout hook -- * Choose layout based on -orient option. */ static Ttk_Layout SeparatorGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Separator *sep = recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, sep->separator.orientObj); } /* * Widget commands: */ static WidgetCommandSpec SeparatorCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "identify", TtkWidgetIdentifyCommand }, { "instate", TtkWidgetInstateCommand }, { "state", TtkWidgetStateCommand }, { NULL, NULL } }; /* * Widget specification: */ static WidgetSpec SeparatorWidgetSpec = { "TSeparator", /* className */ sizeof(Separator), /* recordSize */ SeparatorOptionSpecs, /* optionSpecs */ SeparatorCommands, /* subcommands */ TtkNullInitialize, /* initializeProc */ TtkNullCleanup, /* cleanupProc */ TtkCoreConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ SeparatorGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ TtkWidgetDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(SeparatorLayout) TTK_NODE("Separator.separator", TTK_FILL_BOTH) TTK_END_LAYOUT /* +++ Sizegrip widget: * Has no options or methods other than the standard ones. */ static WidgetCommandSpec SizegripCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "identify", TtkWidgetIdentifyCommand }, { "instate", TtkWidgetInstateCommand }, { "state", TtkWidgetStateCommand }, { NULL, NULL } }; static WidgetSpec SizegripWidgetSpec = { "TSizegrip", /* className */ sizeof(WidgetCore), /* recordSize */ ttkCoreOptionSpecs, /* optionSpecs */ SizegripCommands, /* subcommands */ TtkNullInitialize, /* initializeProc */ TtkNullCleanup, /* cleanupProc */ TtkCoreConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ TtkWidgetDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(SizegripLayout) TTK_NODE("Sizegrip.sizegrip", TTK_PACK_BOTTOM|TTK_STICK_S|TTK_STICK_E) TTK_END_LAYOUT /* +++ Initialization: */ void TtkSeparator_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme, "TSeparator", SeparatorLayout); Ttk_RegisterLayout(theme, "TSizegrip", SizegripLayout); RegisterWidget(interp, "ttk::separator", &SeparatorWidgetSpec); RegisterWidget(interp, "ttk::sizegrip", &SizegripWidgetSpec); } /*EOF*/ tile-0.8.2/generic/square.c0000644000076500007650000002401710710035347015130 0ustar joejoe00000000000000/* square.c - Copyright (C) 2004 Pat Thoyts * * Minimal sample tile widget. * * square.c,v 1.8 2007/10/25 06:42:47 jenglish Exp */ #include #include "tkTheme.h" #include "widget.h" #ifdef TTK_SQUARE_WIDGET #ifndef DEFAULT_BORDERWIDTH #define DEFAULT_BORDERWIDTH "2" #endif /* * First, we setup the widget record. The Tile package provides a structure * that contains standard widget data so it is only necessary to define * a structure that holds the data required for our widget. We do this by * defining a widget part and then specifying the widget record as the * concatenation of the two structures. */ typedef struct { Tcl_Obj *widthObj; Tcl_Obj *heightObj; Tcl_Obj *reliefObj; Tcl_Obj *borderWidthObj; Tcl_Obj *foregroundObj; Tcl_Obj *paddingObj; Tcl_Obj *anchorObj; } SquarePart; typedef struct { WidgetCore core; SquarePart square; } Square; /* * Widget options. * * This structure is the same as the option specification structure used * for Tk widgets. For each option we provide the type, name and options * database name and class name and the position in the structure and * default values. At the bottom we bring in the standard widget option * defined for all widgets. */ static Tk_OptionSpec SquareOptionSpecs[] = { WIDGET_TAKES_FOCUS, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEFAULT_BORDERWIDTH, Tk_Offset(Square,square.borderWidthObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", DEFAULT_BACKGROUND, Tk_Offset(Square,square.foregroundObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", "50", Tk_Offset(Square,square.widthObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_PIXELS, "-height", "height", "Height", "50", Tk_Offset(Square,square.heightObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, Tk_Offset(Square,square.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, Tk_Offset(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0}, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* * Almost all of the widget functionality is handled by the default Tile * widget code and the contained element. The one thing that we must handle * is the -anchor option which positions the square element within the parcel * of space available for the widget. * To do this we must find out the layout preferences for the square * element and adjust its position within our region. * * Note that if we do not have a "square" elememt then just the default * layout will be done. So if someone places a label element into the * widget layout it will still be handled but the -anchor option will be * passed onto the label element instead of handled here. */ static void SquareDoLayout(void *clientData) { WidgetCore *corePtr = (WidgetCore *)clientData; Ttk_Box winBox; Ttk_LayoutNode *squareNode; squareNode = Ttk_LayoutFindNode(corePtr->layout, "square"); winBox = Ttk_WinBox(corePtr->tkwin); Ttk_PlaceLayout(corePtr->layout, corePtr->state, winBox); /* * Adjust the position of the square element within the widget according * to the -anchor option. */ if (squareNode) { Square *squarePtr = clientData; Tk_Anchor anchor = TK_ANCHOR_CENTER; Ttk_Box b; b = Ttk_LayoutNodeParcel(squareNode); if (squarePtr->square.anchorObj != NULL) Tk_GetAnchorFromObj(NULL, squarePtr->square.anchorObj, &anchor); b = Ttk_AnchorBox(winBox, b.width, b.height, anchor); Ttk_PlaceLayoutNode(corePtr->layout, squareNode, b); } } /* * Widget commands. A widget is impelemented as an ensemble and the * subcommands are listed here. Tile provides default implementations * that are sufficient for our needs. */ static WidgetCommandSpec SquareCommands[] = { { "configure", TtkWidgetConfigureCommand }, { "cget", TtkWidgetCgetCommand }, { "identify", TtkWidgetIdentifyCommand }, { "instate", TtkWidgetInstateCommand }, { "state", TtkWidgetStateCommand }, { NULL, NULL } }; /* * The Widget specification structure holds all the implementation * information about this widget and this is what must be registered * with Tk in the package initialization code (see bottom). */ static WidgetSpec SquareWidgetSpec = { "TSquare", /* className */ sizeof(Square), /* recordSize */ SquareOptionSpecs, /* optionSpecs */ SquareCommands, /* subcommands */ TtkNullInitialize, /* initializeProc */ TtkNullCleanup, /* cleanupProc */ TtkCoreConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ SquareDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; /* ---------------------------------------------------------------------- * Square element * * In this section we demonstrate what is required to create a new themed * element. */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *foregroundObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *widthObj; Tcl_Obj *heightObj; } SquareElement; static Ttk_ElementOptionSpec SquareElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(SquareElement,borderObj), DEFAULT_BACKGROUND }, { "-foreground", TK_OPTION_BORDER, Tk_Offset(SquareElement,foregroundObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SquareElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(SquareElement,reliefObj), "raised" }, { "-width", TK_OPTION_PIXELS, Tk_Offset(SquareElement,widthObj), "20"}, { "-height", TK_OPTION_PIXELS, Tk_Offset(SquareElement,heightObj), "20"}, { NULL } }; /* * The element geometry function is called when the layout code wishes to * find out how big this element wants to be. We must return our preferred * size and padding information */ static void SquareElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SquareElement *square = elementRecord; int borderWidth = 0; Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, square->widthObj, widthPtr); Tk_GetPixelsFromObj(NULL, tkwin, square->heightObj, heightPtr); } /* * Draw the element in the box provided. */ static void SquareElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { SquareElement *square = elementRecord; Tk_3DBorder border = NULL, foreground = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; border = Tk_Get3DBorderFromObj(tkwin, square->borderObj); foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj); Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, square->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, foreground, b.x, b.y, b.width, b.height, borderWidth, relief); } static Ttk_ElementSpec SquareElementSpec = { TK_STYLE_VERSION_2, sizeof(SquareElement), SquareElementOptions, SquareElementSize, SquareElementDraw }; /* ---------------------------------------------------------------------- * * Layout section. * * Every widget class needs a layout style that specifies which elements * are part of the widget and how they should be placed. The element layout * engine is similar to the Tk pack geometry manager. Read the documentation * for the details. In this example we just need to have the square element * that has been defined for this widget placed on a background. We will * also need some padding to keep it away from the edges. */ TTK_BEGIN_LAYOUT(SquareLayout) TTK_NODE("Square.background", TTK_FILL_BOTH) TTK_GROUP("Square.padding", TTK_FILL_BOTH, TTK_NODE("Square.square", 0)) TTK_END_LAYOUT /* ---------------------------------------------------------------------- * * Widget initialization. * * This file defines a new element and a new widget. We need to register * the element with the themes that will need it. In this case we will * register with the default theme that is the root of the theme inheritance * tree. This means all themes will find this element. * We then need to register the widget class style. This is the layout * specification. If a different theme requires an alternative layout, we * could register that here. For instance, in some themes the scrollbars have * one uparrow, in other themes there are two uparrow elements. * Finally we register the widget itself. This step creates a tcl command so * that we can actually create an instance of this class. The widget is * linked to a particular style by the widget class name. This is important * to realise as the programmer may change the classname when creating a * new instance. If this is done, a new layout will need to be created (which * can be done at script level). Some widgets may require particular elements * to be present but we try to avoid this where possible. In this widget's C * code, no reference is made to any particular elements. The programmer is * free to specify a new style using completely different elements. */ /* public */ int TtkSquareWidget_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); /* register the new elements for this theme engine */ Ttk_RegisterElement(interp, theme, "square", &SquareElementSpec, NULL); /* register the layout for this theme */ Ttk_RegisterLayout(theme, "TSquare", SquareLayout); /* register the widget */ RegisterWidget(interp, "ttk::square", &SquareWidgetSpec); return TCL_OK; } #endif /* TTK_SQUARE_WIDGET */ tile-0.8.2/generic/tagset.c0000644000076500007650000000661610504554151015124 0ustar joejoe00000000000000/* tagset.c,v 1.1 2006/09/21 18:22:33 jenglish Exp * * Tile widget set: tag tables. Half-baked, work in progress. * * Copyright (C) 2005, Joe English. Freely redistributable. */ #include /* for memset() */ #include #include #include "tkTheme.h" #include "widget.h" /*------------------------------------------------------------------------ * +++ Internal data structures. */ struct TtkTag { Tcl_Obj **tagRecord; /* ... hrmph. */ }; struct TtkTagTable { Tk_OptionTable tagOptionTable; /* ... */ int tagRecordSize; /* size of tag record */ Tcl_HashTable tags; /* defined tags */ }; /*------------------------------------------------------------------------ * +++ Tags. */ static Ttk_Tag NewTag(Ttk_TagTable tagTable) { Ttk_Tag tag = (Ttk_Tag)ckalloc(sizeof(*tag)); tag->tagRecord = (Tcl_Obj **)ckalloc(tagTable->tagRecordSize); memset(tag->tagRecord, 0, tagTable->tagRecordSize); return tag; } static void DeleteTag(Ttk_Tag tag, int nOptions) { int i; for (i = 0; i < nOptions; ++i) { if (tag->tagRecord[i]) { Tcl_DecrRefCount(tag->tagRecord[i]); } } ckfree((void*)tag->tagRecord); ckfree((void*)tag); } Tcl_Obj **Ttk_TagRecord(Ttk_Tag tag) { return tag->tagRecord; } /*------------------------------------------------------------------------ * +++ Tag tables. */ Ttk_TagTable Ttk_CreateTagTable( Tk_OptionTable tagOptionTable, int tagRecordSize) { Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable)); tagTable->tagOptionTable = tagOptionTable; tagTable->tagRecordSize = tagRecordSize; Tcl_InitHashTable(&tagTable->tags, TCL_STRING_KEYS); return tagTable; } void Ttk_DeleteTagTable(Ttk_TagTable tagTable) { Tcl_HashSearch search; Tcl_HashEntry *entryPtr; int nOptions = tagTable->tagRecordSize / sizeof(Tcl_Obj *); entryPtr = Tcl_FirstHashEntry(&tagTable->tags, &search); while (entryPtr != NULL) { DeleteTag(Tcl_GetHashValue(entryPtr), nOptions); entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&tagTable->tags); ckfree((void*)tagTable); } Ttk_Tag Ttk_GetTag(Ttk_TagTable tagTable, const char *tagName) { int isNew = 0; Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry( &tagTable->tags, tagName, &isNew); if (isNew) { Tcl_SetHashValue(entryPtr, NewTag(tagTable)); } return Tcl_GetHashValue(entryPtr); } Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr) { return Ttk_GetTag(tagTable, Tcl_GetString(objPtr)); } /* Ttk_GetTagListFromObj -- * Extract an array of pointers to Ttk_Tags from a Tcl_Obj. * (suitable for passing to Tk_BindEvent). * * Result must be passed to Ttk_FreeTagList(). */ extern int Ttk_GetTagListFromObj( Tcl_Interp *interp, Ttk_TagTable tagTable, Tcl_Obj *objPtr, int *nTags_rtn, void **taglist_rtn) { Tcl_Obj **objv; int i, objc; void **tags; *taglist_rtn = NULL; *nTags_rtn = 0; if (objPtr == NULL) { return TCL_OK; } if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) { return TCL_ERROR; } tags = (void**)ckalloc((objc+1) * sizeof(void*)); for (i=0; i #include #include "tkTheme.h" #include "widget.h" /* * Legal values for the button -default option. * See also: enum Ttk_ButtonDefaultState. */ const char *ttkDefaultStrings[] = { "normal", "active", "disabled", NULL }; int Ttk_GetButtonDefaultStateFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, int *statePtr) { *statePtr = TTK_BUTTON_DEFAULT_DISABLED; return Tcl_GetIndexFromObj(interp, objPtr, ttkDefaultStrings, "default state", 0, statePtr); } /* * Legal values for the -compound option. * See also: enum Ttk_Compound. */ const char *ttkCompoundStrings[] = { "none", "text", "image", "center", "top", "bottom", "left", "right", NULL }; int Ttk_GetCompoundFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, int *statePtr) { *statePtr = TTK_COMPOUND_NONE; return Tcl_GetIndexFromObj(interp, objPtr, ttkCompoundStrings, "compound layout", 0, statePtr); } /* * Legal values for the -orient option. * See also: enum Ttk_Orient. */ CONST char *ttkOrientStrings[] = { "horizontal", "vertical", NULL }; int Ttk_GetOrientFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) { *resultPtr = TTK_ORIENT_HORIZONTAL; return Tcl_GetIndexFromObj(interp, objPtr, ttkOrientStrings, "orientation", 0, resultPtr); } /* * Recognized values for the -state compatibility option. * Other options are accepted and interpreted as synonyms for "normal". */ static const char *ttkStateStrings[] = { "normal", "readonly", "disabled", "active", NULL }; enum { TTK_COMPAT_STATE_NORMAL, TTK_COMPAT_STATE_READONLY, TTK_COMPAT_STATE_DISABLED, TTK_COMPAT_STATE_ACTIVE }; /* TtkCheckStateOption -- * Handle -state compatibility option. * * NOTE: setting -state disabled / -state enabled affects the * widget state, but the internal widget state does *not* affect * the value of the -state option. * This option is present for compatibility only. */ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr) { int stateOption = TTK_COMPAT_STATE_NORMAL; unsigned all = TTK_STATE_DISABLED|TTK_STATE_READONLY|TTK_STATE_ACTIVE; # define SETFLAGS(f) TtkWidgetChangeState(corePtr, f, all^f) (void)Tcl_GetIndexFromObj(NULL,objPtr,ttkStateStrings,"",0,&stateOption); switch (stateOption) { case TTK_COMPAT_STATE_NORMAL: default: SETFLAGS(0); break; case TTK_COMPAT_STATE_READONLY: SETFLAGS(TTK_STATE_READONLY); break; case TTK_COMPAT_STATE_DISABLED: SETFLAGS(TTK_STATE_DISABLED); break; case TTK_COMPAT_STATE_ACTIVE: SETFLAGS(TTK_STATE_ACTIVE); break; } # undef SETFLAGS } /* TtkSendVirtualEvent -- * Send a virtual event notification to the specified target window. * Equivalent to "event generate $tgtWindow <<$eventName>>" * * Note that we use Tk_QueueWindowEvent, not Tk_HandleEvent, * so this routine does not reenter the interpreter. */ void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName) { XEvent event; memset(&event, 0, sizeof(event)); event.xany.type = VirtualEvent; event.xany.serial = NextRequest(Tk_Display(tgtWin)); event.xany.send_event = False; event.xany.window = Tk_WindowId(tgtWin); event.xany.display = Tk_Display(tgtWin); ((XVirtualEvent *) &event)->name = Tk_GetUid(eventName); Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } /* TtkEnumerateOptions, TtkGetOptionValue -- * Common factors for data accessor commands. */ int TtkEnumerateOptions( Tcl_Interp *interp, void *recordPtr, const Tk_OptionSpec *specPtr, Tk_OptionTable optionTable, Tk_Window tkwin) { Tcl_Obj *result = Tcl_NewListObj(0,0); while (specPtr->type != TK_OPTION_END) { Tcl_Obj *optionName = Tcl_NewStringObj(specPtr->optionName, -1); Tcl_Obj *optionValue = Tk_GetOptionValue(interp,recordPtr,optionTable,optionName,tkwin); if (optionValue) { Tcl_ListObjAppendElement(interp, result, optionName); Tcl_ListObjAppendElement(interp, result, optionValue); } ++specPtr; if (specPtr->type == TK_OPTION_END && specPtr->clientData != NULL) { /* Chain to next option spec array: */ specPtr = specPtr->clientData; } } Tcl_SetObjResult(interp, result); return TCL_OK; } int TtkGetOptionValue( Tcl_Interp *interp, void *recordPtr, Tcl_Obj *optionName, Tk_OptionTable optionTable, Tk_Window tkwin) { Tcl_Obj *result = Tk_GetOptionValue(interp,recordPtr,optionTable,optionName,tkwin); if (result) { Tcl_SetObjResult(interp, result); return TCL_OK; } return TCL_ERROR; } /*------------------------------------------------------------------------ * Core Option specifications: * type name dbName dbClass default objOffset intOffset flags clientData mask */ /* public */ Tk_OptionSpec ttkCoreOptionSpecs[] = { {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", "", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 }, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", NULL, Tk_Offset(WidgetCore, cursorObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-style", "style", "Style", "", Tk_Offset(WidgetCore,styleObj), -1, 0,0,STYLE_CHANGED}, {TK_OPTION_STRING, "-class", "", "", NULL, Tk_Offset(WidgetCore,classObj), -1, 0,0,READONLY_OPTION}, {TK_OPTION_END} }; /*------------------------------------------------------------------------ * +++ Initialization: elements and element factories. */ extern void TtkElements_Init(Tcl_Interp *); extern void TtkLabel_Init(Tcl_Interp *); extern void TtkImage_Init(Tcl_Interp *); static void RegisterElements(Tcl_Interp *interp) { TtkElements_Init(interp); TtkLabel_Init(interp); TtkImage_Init(interp); } /*------------------------------------------------------------------------ * +++ Initialization: Widget definitions. */ extern void TtkButton_Init(Tcl_Interp *); extern void TtkEntry_Init(Tcl_Interp *); extern void TtkFrame_Init(Tcl_Interp *); extern void TtkNotebook_Init(Tcl_Interp *); extern void TtkPanedwindow_Init(Tcl_Interp *); extern void TtkProgressbar_Init(Tcl_Interp *); extern void TtkScale_Init(Tcl_Interp *); extern void TtkScrollbar_Init(Tcl_Interp *); extern void TtkSeparator_Init(Tcl_Interp *); extern void TtkSquareWidget_Init(Tcl_Interp *); extern void TtkTreeview_Init(Tcl_Interp *); static void RegisterWidgets(Tcl_Interp *interp) { TtkButton_Init(interp); TtkEntry_Init(interp); TtkFrame_Init(interp); TtkNotebook_Init(interp); TtkPanedwindow_Init(interp); TtkProgressbar_Init(interp); TtkScale_Init(interp); TtkScrollbar_Init(interp); TtkSeparator_Init(interp); TtkTreeview_Init(interp); #ifdef TTK_SQUARE_WIDGET TtkSquareWidget_Init(interp); #endif } /*------------------------------------------------------------------------ * +++ Initialization: Built-in themes. */ extern int TtkAltTheme_Init(Tcl_Interp *); extern int TtkClassicTheme_Init(Tcl_Interp *); extern int TtkClamTheme_Init(Tcl_Interp *); static void RegisterThemes(Tcl_Interp *interp) { TtkAltTheme_Init(interp); TtkClassicTheme_Init(interp); TtkClamTheme_Init(interp); } /*------------------------------------------------------------------------ * +++ Package initialization. * tcl_findLibrary basename version patch initScript enVarName varName */ static char initScript[] = "namespace eval tile { variable version " TILE_VERSION " };" "tcl_findLibrary tile $tile::version $tile::version" " tile.tcl TILE_LIBRARY tile::library;"; extern TtkStubs ttkStubs; #define TCL_VERSION_WRONG "8.0" /* Workaround for #1091431 */ int DLLEXPORT Tile_Init(Tcl_Interp *interp) { if (Tcl_InitStubs(interp, TCL_VERSION_WRONG, 0) == NULL) { return TCL_ERROR; } if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) { return TCL_ERROR; } Ttk_StylePkgInit(interp); RegisterElements(interp); RegisterWidgets(interp); RegisterThemes(interp); Ttk_PlatformInit(interp); if (Tcl_Eval(interp, initScript) != TCL_OK) return TCL_ERROR; Tcl_PkgProvideEx(interp, "tile", TILE_VERSION, (void*)&ttkStubs); return TCL_OK; } /*EOF*/ tile-0.8.2/generic/tkElements.c0000644000076500007650000011656510720166601015754 0ustar joejoe00000000000000/* tkElements.c,v 1.85 2007/11/19 01:57:21 jenglish Exp * * Copyright (c) 2003, Joe English * * Default implementation for themed elements. * */ #include #include #include #include "tkTheme.h" #define DEFAULT_BORDERWIDTH "2" #define DEFAULT_ARROW_SIZE "15" #define MIN_THUMB_SIZE 10 /*---------------------------------------------------------------------- * +++ Null element. Does nothing; used as a stub. * Null element methods, option table and element spec are public, * and may be used in other engines. */ /* public */ Ttk_ElementOptionSpec TtkNullElementOptions[] = { {NULL} }; /* public */ void TtkNullElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { } /* public */ void TtkNullElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { } /* public */ Ttk_ElementSpec ttkNullElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TtkNullElementSize, TtkNullElementDraw }; /*---------------------------------------------------------------------- * +++ Background and fill elements. * * The fill element fills its parcel with the background color. * The background element ignores the parcel, and fills the entire window. * * Ttk_GetLayout() automatically includes a background element. */ typedef struct { Tcl_Obj *backgroundObj; } BackgroundElement; static Ttk_ElementOptionSpec BackgroundElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND }, {NULL} }; static void FillElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { BackgroundElement *bg = elementRecord; Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,bg->backgroundObj); XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), b.x, b.y, b.width, b.height); } static void BackgroundElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { FillElementDraw( clientData, elementRecord, tkwin, d, Ttk_WinBox(tkwin), state); } static Ttk_ElementSpec FillElementSpec = { TK_STYLE_VERSION_2, sizeof(BackgroundElement), BackgroundElementOptions, TtkNullElementSize, FillElementDraw }; static Ttk_ElementSpec BackgroundElementSpec = { TK_STYLE_VERSION_2, sizeof(BackgroundElement), BackgroundElementOptions, TtkNullElementSize, BackgroundElementDraw }; /*---------------------------------------------------------------------- * +++ Border element. */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(BorderElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(BorderElement,reliefObj), "flat" }, {NULL} }; static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { BorderElement *bd = elementRecord; int borderWidth = 0; Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void BorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { BorderElement *bd = elementRecord; Tk_3DBorder border = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); if (border && borderWidth > 0 && relief != TK_RELIEF_FLAT) { Tk_Draw3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth,relief); } } static Ttk_ElementSpec BorderElementSpec = { TK_STYLE_VERSION_2, sizeof(BorderElement), BorderElementOptions, BorderElementSize, BorderElementDraw }; /*---------------------------------------------------------------------- * +++ Field element. * Used for editable fields. */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement,borderObj), "white" }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(FieldElement,borderWidthObj), "2" }, {NULL} }; static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { FieldElement *field = elementRecord; int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void FieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { FieldElement *field = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj); int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_SUNKEN); } static Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, FieldElementSize, FieldElementDraw }; /* *---------------------------------------------------------------------- * +++ Padding element. * * This element has no visual representation, only geometry. * It adds a (possibly non-uniform) internal border. * In addition, if "-shiftrelief" is specified, * adds additional pixels to shift child elements "in" or "out" * depending on the -relief. */ typedef struct { Tcl_Obj *paddingObj; Tcl_Obj *reliefObj; Tcl_Obj *shiftreliefObj; } PaddingElement; static Ttk_ElementOptionSpec PaddingElementOptions[] = { { "-padding", TK_OPTION_STRING, Tk_Offset(PaddingElement,paddingObj), "0" }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(PaddingElement,reliefObj), "flat" }, { "-shiftrelief", TK_OPTION_INT, Tk_Offset(PaddingElement,shiftreliefObj), "0" }, {NULL} }; static void PaddingElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { PaddingElement *padding = elementRecord; int shiftRelief = 0; int relief = TK_RELIEF_FLAT; Ttk_Padding pad; Tk_GetReliefFromObj(NULL, padding->reliefObj, &relief); Tcl_GetIntFromObj(NULL, padding->shiftreliefObj, &shiftRelief); Ttk_GetPaddingFromObj(NULL,tkwin,padding->paddingObj,&pad); *paddingPtr = Ttk_RelievePadding(pad, relief, shiftRelief); } static Ttk_ElementSpec PaddingElementSpec = { TK_STYLE_VERSION_2, sizeof(PaddingElement), PaddingElementOptions, PaddingElementSize, TtkNullElementDraw }; /*---------------------------------------------------------------------- * +++ Focus ring element. * Draws a dashed focus ring, if the widget has keyboard focus. */ typedef struct { Tcl_Obj *focusColorObj; Tcl_Obj *focusThicknessObj; } FocusElement; /* * DrawFocusRing -- * Draw a dotted rectangle to indicate focus. */ static void DrawFocusRing( Tk_Window tkwin, Drawable d, Tcl_Obj *colorObj, Ttk_Box b) { XColor *color = Tk_GetColorFromObj(tkwin, colorObj); unsigned long mask = 0UL; XGCValues gcvalues; GC gc; gcvalues.foreground = color->pixel; gcvalues.line_style = LineOnOffDash; gcvalues.line_width = 1; gcvalues.dashes = 1; gcvalues.dash_offset = 1; mask = GCForeground | GCLineStyle | GCDashList | GCDashOffset | GCLineWidth; gc = Tk_GetGC(tkwin, mask, &gcvalues); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); Tk_FreeGC(Tk_Display(tkwin), gc); } static Ttk_ElementOptionSpec FocusElementOptions[] = { { "-focuscolor",TK_OPTION_COLOR, Tk_Offset(FocusElement,focusColorObj), "black" }, { "-focusthickness",TK_OPTION_PIXELS, Tk_Offset(FocusElement,focusThicknessObj), "1" }, {NULL} }; static void FocusElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { FocusElement *focus = elementRecord; int focusThickness = 0; Tcl_GetIntFromObj(NULL, focus->focusThicknessObj, &focusThickness); *paddingPtr = Ttk_UniformPadding((short)focusThickness); } static void FocusElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { FocusElement *focus = elementRecord; int focusThickness = 0; if (state & TTK_STATE_FOCUS) { Tcl_GetIntFromObj(NULL,focus->focusThicknessObj,&focusThickness); DrawFocusRing(tkwin, d, focus->focusColorObj, b); } } static Ttk_ElementSpec FocusElementSpec = { TK_STYLE_VERSION_2, sizeof(FocusElement), FocusElementOptions, FocusElementSize, FocusElementDraw }; /*---------------------------------------------------------------------- * +++ Separator element. * Just draws a horizontal or vertical bar. * Three elements are defined: horizontal, vertical, and general; * the general separator checks the "-orient" option. */ typedef struct { Tcl_Obj *orientObj; Tcl_Obj *borderObj; } SeparatorElement; static Ttk_ElementOptionSpec SeparatorElementOptions[] = { { "-orient", TK_OPTION_ANY, Tk_Offset(SeparatorElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, Tk_Offset(SeparatorElement,borderObj), DEFAULT_BACKGROUND }, {NULL} }; static void SeparatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *widthPtr = *heightPtr = 2; } static void HorizontalSeparatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { SeparatorElement *separator = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj); GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x + b.width, b.y); XDrawLine(Tk_Display(tkwin), d, lightGC, b.x, b.y+1, b.x + b.width, b.y+1); } static void VerticalSeparatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { SeparatorElement *separator = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj); GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x, b.y + b.height); XDrawLine(Tk_Display(tkwin), d, lightGC, b.x+1, b.y, b.x+1, b.y+b.height); } static void GeneralSeparatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { SeparatorElement *separator = elementRecord; int orient; Ttk_GetOrientFromObj(NULL, separator->orientObj, &orient); switch (orient) { case TTK_ORIENT_HORIZONTAL: HorizontalSeparatorElementDraw( clientData, elementRecord, tkwin, d, b, state); break; case TTK_ORIENT_VERTICAL: VerticalSeparatorElementDraw( clientData, elementRecord, tkwin, d, b, state); break; } } static Ttk_ElementSpec HorizontalSeparatorElementSpec = { TK_STYLE_VERSION_2, sizeof(SeparatorElement), SeparatorElementOptions, SeparatorElementSize, HorizontalSeparatorElementDraw }; static Ttk_ElementSpec VerticalSeparatorElementSpec = { TK_STYLE_VERSION_2, sizeof(SeparatorElement), SeparatorElementOptions, SeparatorElementSize, HorizontalSeparatorElementDraw }; static Ttk_ElementSpec SeparatorElementSpec = { TK_STYLE_VERSION_2, sizeof(SeparatorElement), SeparatorElementOptions, SeparatorElementSize, GeneralSeparatorElementDraw }; /*---------------------------------------------------------------------- * +++ Sizegrip: lower-right corner grip handle for resizing window. */ typedef struct { Tcl_Obj *backgroundObj; } SizegripElement; static Ttk_ElementOptionSpec SizegripOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(SizegripElement,backgroundObj), DEFAULT_BACKGROUND }, {0,0,0,0} }; static void SizegripSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int gripCount = 3, gripSpace = 2, gripThickness = 3; *widthPtr = *heightPtr = gripCount * (gripSpace + gripThickness); } static void SizegripDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { SizegripElement *grip = elementRecord; int gripCount = 3, gripSpace = 2; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, grip->backgroundObj); GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); int x1 = b.x + b.width-1, y1 = b.y + b.height-1, x2 = x1, y2 = y1; while (gripCount--) { x1 -= gripSpace; y2 -= gripSpace; XDrawLine(Tk_Display(tkwin), d, darkGC, x1,y1, x2,y2); --x1; --y2; XDrawLine(Tk_Display(tkwin), d, darkGC, x1,y1, x2,y2); --x1; --y2; XDrawLine(Tk_Display(tkwin), d, lightGC, x1,y1, x2,y2); --x1; --y2; } } static Ttk_ElementSpec SizegripElementSpec = { TK_STYLE_VERSION_2, sizeof(SizegripElement), SizegripOptions, SizegripSize, SizegripDraw }; /*---------------------------------------------------------------------- * +++ Indicator element. * * Draws the on/off indicator for checkbuttons and radiobuttons. * * Draws a 3-D square (or diamond), raised if off, sunken if on. * * This is actually a regression from Tk 8.5 back to the ugly old Motif * style; use "altTheme" for the newer, nicer version. */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *reliefObj; Tcl_Obj *colorObj; Tcl_Obj *diameterObj; Tcl_Obj *marginObj; Tcl_Obj *borderWidthObj; } IndicatorElement; static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorcolor", TK_OPTION_BORDER, Tk_Offset(IndicatorElement,colorObj), DEFAULT_BACKGROUND }, { "-indicatorrelief", TK_OPTION_RELIEF, Tk_Offset(IndicatorElement,reliefObj), "raised" }, { "-indicatordiameter", TK_OPTION_PIXELS, Tk_Offset(IndicatorElement,diameterObj), "12" }, { "-indicatormargin", TK_OPTION_STRING, Tk_Offset(IndicatorElement,marginObj), "0 2 4 2" }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(IndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, {NULL} }; /* * Checkbutton indicators (default): 3-D square. */ static void SquareIndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { IndicatorElement *indicator = elementRecord; Ttk_Padding margins; int diameter = 0; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter); *widthPtr = diameter + Ttk_PaddingWidth(margins); *heightPtr = diameter + Ttk_PaddingHeight(margins); } static void SquareIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { IndicatorElement *indicator = elementRecord; Tk_3DBorder border = 0, interior = 0; int relief = TK_RELIEF_RAISED; Ttk_Padding padding; int borderWidth = 2; int diameter; interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj); border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj); Tcl_GetIntFromObj(NULL,indicator->borderWidthObj,&borderWidth); Tk_GetReliefFromObj(NULL,indicator->reliefObj,&relief); Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding); b = Ttk_PadBox(b, padding); diameter = b.width < b.height ? b.width : b.height; Tk_Fill3DRectangle(tkwin, d, interior, b.x, b.y, diameter, diameter,borderWidth, TK_RELIEF_FLAT); Tk_Draw3DRectangle(tkwin, d, border, b.x, b.y, diameter, diameter, borderWidth, relief); } /* * Radiobutton indicators: 3-D diamond. */ static void DiamondIndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { IndicatorElement *indicator = elementRecord; Ttk_Padding margins; int diameter = 0; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter); *widthPtr = diameter + 3 + Ttk_PaddingWidth(margins); *heightPtr = diameter + 3 + Ttk_PaddingHeight(margins); } static void DiamondIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { IndicatorElement *indicator = elementRecord; Tk_3DBorder border = 0, interior = 0; int borderWidth = 2; int relief = TK_RELIEF_RAISED; int diameter, radius; XPoint points[4]; Ttk_Padding padding; interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj); border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj); Tcl_GetIntFromObj(NULL,indicator->borderWidthObj,&borderWidth); Tk_GetReliefFromObj(NULL,indicator->reliefObj,&relief); Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding); b = Ttk_PadBox(b, padding); diameter = b.width < b.height ? b.width : b.height; radius = diameter / 2; points[0].x = b.x; points[0].y = b.y + radius; points[1].x = b.x + radius; points[1].y = b.y + 2*radius; points[2].x = b.x + 2*radius; points[2].y = b.y + radius; points[3].x = b.x + radius; points[3].y = b.y; Tk_Fill3DPolygon(tkwin,d,interior,points,4,borderWidth,TK_RELIEF_FLAT); Tk_Draw3DPolygon(tkwin,d,border,points,4,borderWidth,relief); } static Ttk_ElementSpec CheckbuttonIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, SquareIndicatorElementSize, SquareIndicatorElementDraw }; static Ttk_ElementSpec RadiobuttonIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, DiamondIndicatorElementSize, DiamondIndicatorElementDraw }; /* *---------------------------------------------------------------------- * +++ Menubutton indicators. * * These aren't functional like radio/check indicators, * they're just affordability indicators. * * Standard Tk sets the indicator size to 4.0 mm by 1.7 mm. * I have no idea where these numbers came from. */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *widthObj; Tcl_Obj *heightObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *marginObj; } MenuIndicatorElement; static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorwidth", TK_OPTION_PIXELS, Tk_Offset(MenuIndicatorElement,widthObj), "4.0m" }, { "-indicatorheight", TK_OPTION_PIXELS, Tk_Offset(MenuIndicatorElement,heightObj), "1.7m" }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(MenuIndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-indicatorrelief", TK_OPTION_RELIEF, Tk_Offset(MenuIndicatorElement,reliefObj),"raised" }, { "-indicatormargin", TK_OPTION_STRING, Tk_Offset(MenuIndicatorElement,marginObj), "5 0" }, { NULL } }; static void MenuIndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { MenuIndicatorElement *mi = elementRecord; Ttk_Padding margins; Tk_GetPixelsFromObj(NULL, tkwin, mi->widthObj, widthPtr); Tk_GetPixelsFromObj(NULL, tkwin, mi->heightObj, heightPtr); Ttk_GetPaddingFromObj(NULL,tkwin,mi->marginObj, &margins); *widthPtr += Ttk_PaddingWidth(margins); *heightPtr += Ttk_PaddingHeight(margins); } static void MenuIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { MenuIndicatorElement *mi = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, mi->backgroundObj); Ttk_Padding margins; int borderWidth = 2; Ttk_GetPaddingFromObj(NULL,tkwin,mi->marginObj,&margins); b = Ttk_PadBox(b, margins); Tk_GetPixelsFromObj(NULL, tkwin, mi->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_RAISED); } static Ttk_ElementSpec MenuIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(MenuIndicatorElement), MenuIndicatorElementOptions, MenuIndicatorElementSize, MenuIndicatorElementDraw }; /*---------------------------------------------------------------------- * +++ Arrow elements. * * Draws a solid triangle inside a box. * clientData is an enum ArrowDirection pointer. */ static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT }; typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *sizeObj; Tcl_Obj *colorObj; } ArrowElement; static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-relief",TK_OPTION_RELIEF, Tk_Offset(ArrowElement,reliefObj),"raised"}, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,borderWidthObj), "1" }, { "-arrowcolor",TK_OPTION_COLOR, Tk_Offset(ArrowElement,colorObj),"black"}, { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,sizeObj), "14" }, { NULL } }; static Ttk_Padding ArrowMargins = { 3,3,3,3 }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ArrowElement *arrow = elementRecord; int direction = *(int *)clientData; int width = 14; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width); width -= Ttk_PaddingWidth(ArrowMargins); TtkArrowSize(width/2, direction, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(ArrowMargins); *heightPtr += Ttk_PaddingWidth(ArrowMargins); } static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { int direction = *(int *)clientData; ArrowElement *arrow = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); int relief = TK_RELIEF_RAISED; int borderWidth = 1; Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief); Tk_Fill3DRectangle( tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); TtkFillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d), Ttk_PadBox(b, ArrowMargins), direction); } static Ttk_ElementSpec ArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, ArrowElementSize, ArrowElementDraw }; /*---------------------------------------------------------------------- * +++ Trough element. * * Used in scrollbars and scales in place of "border". */ typedef struct { Tcl_Obj *colorObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } TroughElement; static Ttk_ElementOptionSpec TroughElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(TroughElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-troughcolor", TK_OPTION_BORDER, Tk_Offset(TroughElement,colorObj), DEFAULT_BACKGROUND }, { "-troughrelief",TK_OPTION_RELIEF, Tk_Offset(TroughElement,reliefObj), "sunken" }, { NULL } }; static void TroughElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TroughElement *troughPtr = elementRecord; int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void TroughElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { TroughElement *troughPtr = elementRecord; Tk_3DBorder border = NULL; int borderWidth = 2, relief = TK_RELIEF_SUNKEN; border = Tk_Get3DBorderFromObj(tkwin, troughPtr->colorObj); Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); } static Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(TroughElement), TroughElementOptions, TroughElementSize, TroughElementDraw }; /* *---------------------------------------------------------------------- * +++ Thumb element. * * Used in scrollbars. */ typedef struct { Tcl_Obj *orientObj; Tcl_Obj *thicknessObj; Tcl_Obj *reliefObj; Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, Tk_Offset(ThumbElement, orientObj), "horizontal" }, { "-width", TK_OPTION_PIXELS, Tk_Offset(ThumbElement,thicknessObj), DEFAULT_ARROW_SIZE }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(ThumbElement,reliefObj), "raised" }, { "-background", TK_OPTION_BORDER, Tk_Offset(ThumbElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { NULL } }; static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ThumbElement *thumb = elementRecord; int orient, thickness; Tk_GetPixelsFromObj(NULL, tkwin, thumb->thicknessObj, &thickness); Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); if (orient == TTK_ORIENT_VERTICAL) { *widthPtr = thickness; *heightPtr = MIN_THUMB_SIZE; } else { *widthPtr = MIN_THUMB_SIZE; *heightPtr = thickness; } } static void ThumbElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ThumbElement *thumb = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj); int borderWidth = 2, relief = TK_RELIEF_RAISED; Tk_GetPixelsFromObj(NULL, tkwin, thumb->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, thumb->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); } static Ttk_ElementSpec ThumbElementSpec = { TK_STYLE_VERSION_2, sizeof(ThumbElement), ThumbElementOptions, ThumbElementSize, ThumbElementDraw }; /* *---------------------------------------------------------------------- * +++ Slider element. * * This is the moving part of the scale widget. Drawn as a raised box. */ typedef struct { Tcl_Obj *orientObj; /* orientation of overall slider */ Tcl_Obj *lengthObj; /* slider length */ Tcl_Obj *thicknessObj; /* slider thickness */ Tcl_Obj *reliefObj; /* the relief for this object */ Tcl_Obj *borderObj; /* the background color */ Tcl_Obj *borderWidthObj; /* the size of the border */ } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj), "30" }, { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj), "15" }, { "-sliderrelief", TK_OPTION_RELIEF, Tk_Offset(SliderElement,reliefObj), "raised" }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SliderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-background", TK_OPTION_BORDER, Tk_Offset(SliderElement,borderObj), DEFAULT_BACKGROUND }, { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj), "horizontal" }, { NULL } }; static void SliderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SliderElement *slider = elementRecord; int orient, length, thickness; Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length); Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness); switch (orient) { case TTK_ORIENT_VERTICAL: *widthPtr = thickness; *heightPtr = length; break; case TTK_ORIENT_HORIZONTAL: *widthPtr = length; *heightPtr = thickness; break; } } static void SliderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { SliderElement *slider = elementRecord; Tk_3DBorder border = NULL; int relief, borderWidth, orient; border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); if (relief != TK_RELIEF_FLAT) { if (orient == TTK_ORIENT_HORIZONTAL) { if (b.width > 4) { b.x += b.width/2; XDrawLine(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC), b.x-1, b.y+borderWidth, b.x-1, b.y+b.height-borderWidth); XDrawLine(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC), b.x, b.y+borderWidth, b.x, b.y+b.height-borderWidth); } } else { if (b.height > 4) { b.y += b.height/2; XDrawLine(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC), b.x+borderWidth, b.y-1, b.x+b.width-borderWidth, b.y-1); XDrawLine(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC), b.x+borderWidth, b.y, b.x+b.width-borderWidth, b.y); } } } } static Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(SliderElement), SliderElementOptions, SliderElementSize, SliderElementDraw }; /*------------------------------------------------------------------------ * +++ Progress bar element: * Draws the moving part of the progress bar. * * -thickness specifies the size along the short axis of the bar. * -length specifies the default size along the long axis; * the bar will be this long in indeterminate mode. */ #define DEFAULT_PBAR_THICKNESS "15" #define DEFAULT_PBAR_LENGTH "30" typedef struct { Tcl_Obj *orientObj; /* widget orientation */ Tcl_Obj *thicknessObj; /* the height/width of the bar */ Tcl_Obj *lengthObj; /* default width/height of the bar */ Tcl_Obj *reliefObj; /* border relief for this object */ Tcl_Obj *borderObj; /* background color */ Tcl_Obj *borderWidthObj; /* thickness of the border */ } PbarElement; static Ttk_ElementOptionSpec PbarElementOptions[] = { { "-orient", TK_OPTION_ANY, Tk_Offset(PbarElement,orientObj), "horizontal" }, { "-thickness", TK_OPTION_PIXELS, Tk_Offset(PbarElement,thicknessObj), DEFAULT_PBAR_THICKNESS }, { "-barsize", TK_OPTION_PIXELS, Tk_Offset(PbarElement,lengthObj), DEFAULT_PBAR_LENGTH }, { "-pbarrelief", TK_OPTION_RELIEF, Tk_Offset(PbarElement,reliefObj), "raised" }, { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(PbarElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-background", TK_OPTION_BORDER, Tk_Offset(PbarElement,borderObj), DEFAULT_BACKGROUND }, { NULL } }; static void PbarElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { PbarElement *pbar = elementRecord; int orient, thickness, length, borderWidth; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, pbar->thicknessObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, pbar->lengthObj, &length); Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth); switch (orient) { case TTK_ORIENT_HORIZONTAL: *widthPtr = length + 2 * borderWidth; *heightPtr = thickness + 2 * borderWidth; break; case TTK_ORIENT_VERTICAL: *widthPtr = thickness + 2 * borderWidth; *heightPtr = length + 2 * borderWidth; break; } } static void PbarElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { PbarElement *pbar = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, pbar->borderObj); int relief, borderWidth; Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, pbar->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); } static Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, sizeof(PbarElement), PbarElementOptions, PbarElementSize, PbarElementDraw }; /*------------------------------------------------------------------------ * +++ Notebook tabs and client area. */ typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *backgroundObj; } TabElement; static Ttk_ElementOptionSpec TabElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(TabElement,borderWidthObj),"1" }, { "-background", TK_OPTION_BORDER, Tk_Offset(TabElement,backgroundObj), DEFAULT_BACKGROUND }, {0,0,0,0} }; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TabElement *tab = elementRecord; int borderWidth = 1; Tk_GetPixelsFromObj(0, tkwin, tab->borderWidthObj, &borderWidth); paddingPtr->top = paddingPtr->left = paddingPtr->right = borderWidth; paddingPtr->bottom = 0; } static void TabElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { TabElement *tab = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj); int borderWidth = 1; int cut = 2; XPoint pts[6]; int n = 0; Tcl_GetIntFromObj(NULL, tab->borderWidthObj, &borderWidth); if (state & TTK_STATE_SELECTED) { /* * Draw slightly outside of the allocated parcel, * to overwrite the client area border. */ b.height += borderWidth; } pts[n].x = b.x; pts[n].y = b.y + b.height - 1; ++n; pts[n].x = b.x; pts[n].y = b.y + cut; ++n; pts[n].x = b.x + cut; pts[n].y = b.y; ++n; pts[n].x = b.x + b.width-1-cut; pts[n].y = b.y; ++n; pts[n].x = b.x + b.width-1; pts[n].y = b.y + cut; ++n; pts[n].x = b.x + b.width-1; pts[n].y = b.y + b.height; ++n; XFillPolygon(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC), pts, 6, Convex, CoordModeOrigin); #ifndef WIN32 /* * Account for whether XDrawLines draws endpoints by platform */ --pts[5].y; #endif while (borderWidth--) { XDrawLines(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC), pts, 4, CoordModeOrigin); XDrawLines(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC), pts+3, 3, CoordModeOrigin); ++pts[0].x; ++pts[1].x; ++pts[2].x; --pts[4].x; --pts[5].x; ++pts[2].y; ++pts[3].y; } } static Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(TabElement), TabElementOptions, TabElementSize, TabElementDraw }; /* * Client area element: * Uses same resources as tab element. */ typedef TabElement ClientElement; #define ClientElementOptions TabElementOptions static void ClientElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ClientElement *ce = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj); int borderWidth = 1; Tcl_GetIntFromObj(NULL, ce->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth,TK_RELIEF_RAISED); } static void ClientElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ClientElement *ce = elementRecord; int borderWidth = 1; Tk_GetPixelsFromObj(0, tkwin, ce->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static Ttk_ElementSpec ClientElementSpec = { TK_STYLE_VERSION_2, sizeof(ClientElement), ClientElementOptions, ClientElementSize, ClientElementDraw }; /*---------------------------------------------------------------------- * TtkElements_Init -- * Register default element implementations. */ void TtkElements_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); /* * Elements: */ Ttk_RegisterElement(interp, theme, "background", &BackgroundElementSpec,NULL); Ttk_RegisterElement(interp, theme, "fill", &FillElementSpec, NULL); Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL); Ttk_RegisterElement(interp, theme, "focus", &FocusElementSpec, NULL); Ttk_RegisterElement(interp, theme, "padding", &PaddingElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Checkbutton.indicator", &CheckbuttonIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Radiobutton.indicator", &RadiobuttonIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Menubutton.indicator", &MenuIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "indicator", &ttkNullElementSpec,NULL); Ttk_RegisterElement(interp, theme, "uparrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "downarrow", &ArrowElementSpec, &ArrowElements[1]); Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "trough", &TroughElementSpec, NULL); Ttk_RegisterElement(interp, theme, "thumb", &ThumbElementSpec, NULL); Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "pbar", &PbarElementSpec, NULL); Ttk_RegisterElement(interp, theme, "separator", &SeparatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "hseparator", &HorizontalSeparatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "vseparator", &VerticalSeparatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "sizegrip", &SizegripElementSpec, NULL); Ttk_RegisterElement(interp, theme, "tab", &TabElementSpec, NULL); Ttk_RegisterElement(interp, theme, "client", &ClientElementSpec, NULL); /* * Register "default" as a user-loadable theme (for now): */ Tcl_PkgProvide(interp, "ttk::theme::default", TILE_VERSION); } /*EOF*/ tile-0.8.2/generic/tkTheme.c0000644000076500007650000013400610727633404015237 0ustar joejoe00000000000000/* * ttkTheme.c -- * * This file implements the widget styles and themes support. * * Copyright (c) 2002 Frederic Bonnet * Copyright (c) 2003 Joe English * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * tkTheme.c,v 1.101 2007/12/12 01:19:00 jenglish Exp */ #include #include #include #include "tkThemeInt.h" #ifdef NO_PRIVATE_HEADERS EXTERN CONST Tk_OptionSpec *TkGetOptionSpec (CONST char *name, Tk_OptionTable optionTable); #else #include #endif /*------------------------------------------------------------------------ * +++ Styles. * * Invariants: * If styleName contains a dot, parentStyle->styleName is everything * after the first dot; otherwise, parentStyle is the theme's root * style ".". The root style's parentStyle is NULL. * */ typedef struct Ttk_Style_ { const char *styleName; /* points to hash table key */ Tcl_HashTable settingsTable; /* KEY: string; VALUE: StateMap */ Tcl_HashTable defaultsTable; /* KEY: string; VALUE: resource */ Ttk_LayoutTemplate layoutTemplate; /* Layout template for style, or NULL */ Ttk_Style parentStyle; /* Previous style in chain */ Ttk_ResourceCache cache; /* Back-pointer to resource cache */ } Style; static Style *NewStyle() { Style *stylePtr = (Style*)ckalloc(sizeof(Style)); stylePtr->styleName = NULL; stylePtr->parentStyle = NULL; stylePtr->layoutTemplate = NULL; stylePtr->cache = NULL; Tcl_InitHashTable(&stylePtr->settingsTable, TCL_STRING_KEYS); Tcl_InitHashTable(&stylePtr->defaultsTable, TCL_STRING_KEYS); return stylePtr; } static void FreeStyle(Style *stylePtr) { Tcl_HashSearch search; Tcl_HashEntry *entryPtr; entryPtr = Tcl_FirstHashEntry(&stylePtr->settingsTable, &search); while (entryPtr != NULL) { Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(stateMap); entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&stylePtr->settingsTable); entryPtr = Tcl_FirstHashEntry(&stylePtr->defaultsTable, &search); while (entryPtr != NULL) { Tcl_Obj *defaultValue = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(defaultValue); entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&stylePtr->defaultsTable); Ttk_FreeLayoutTemplate(stylePtr->layoutTemplate); ckfree((char*)stylePtr); } /* * LookupStateMap -- * Look up dynamic resource settings in the in the specified style. */ static Ttk_StateMap LookupStateMap(Ttk_Style stylePtr, const char *optionName) { while (stylePtr) { Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&stylePtr->settingsTable, optionName); if (entryPtr) return (Ttk_StateMap)Tcl_GetHashValue(entryPtr); stylePtr = stylePtr->parentStyle; } return 0; } /* * LookupDefault -- * Look up default resource setting the in the specified style. */ static Tcl_Obj *LookupDefault(Ttk_Style stylePtr, const char *optionName) { while (stylePtr) { Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&stylePtr->defaultsTable, optionName); if (entryPtr) return (Tcl_Obj *)Tcl_GetHashValue(entryPtr); stylePtr = stylePtr->parentStyle; } return 0; } /*------------------------------------------------------------------------ * +++ Elements. */ typedef const Tk_OptionSpec **OptionMap; /* array of Tk_OptionSpecs mapping widget options to element options */ typedef struct Ttk_ElementImpl_ /* Element implementation */ { const char *name; /* Points to hash table key */ Ttk_ElementSpec *specPtr; /* Template provided during registration. */ void *clientData; /* Client data passed in at registration time */ void *elementRecord; /* Scratch buffer for element record storage */ int nResources; /* #Element options */ Tcl_Obj **defaultValues; /* Array of option default values */ Tcl_HashTable optMapCache; /* Map: Tk_OptionTable * -> OptionMap */ } ElementImpl; /* TTKGetOptionSpec -- * Look up a Tk_OptionSpec by name from a Tk_OptionTable, * and verify that it's compatible with the specified Tk_OptionType, * along with other constraints (see below). */ static const Tk_OptionSpec *TTKGetOptionSpec( const char *optionName, Tk_OptionTable optionTable, Tk_OptionType optionType) { const Tk_OptionSpec *optionSpec = TkGetOptionSpec(optionName, optionTable); if (!optionSpec) return 0; /* Make sure widget option has a Tcl_Obj* entry: */ if (optionSpec->objOffset < 0) { return 0; } /* Grrr. Ignore accidental mismatches caused by prefix-matching: */ if (strcmp(optionSpec->optionName, optionName)) { return 0; } /* Ensure that the widget option type is compatible with * the element option type. * * TK_OPTION_STRING element options are compatible with anything. * As a workaround for the workaround for Bug #967209, * TK_OPTION_STRING widget options are also compatible with anything * (see <>). */ if ( optionType != TK_OPTION_STRING && optionSpec->type != TK_OPTION_STRING && optionType != optionSpec->type) { return 0; } return optionSpec; } /* BuildOptionMap -- * Construct the mapping from element options to widget options. */ static OptionMap BuildOptionMap(ElementImpl *elementImpl, Tk_OptionTable optionTable) { OptionMap optionMap = (OptionMap)ckalloc( sizeof(const Tk_OptionSpec) * elementImpl->nResources); int i; for (i = 0; i < elementImpl->nResources; ++i) { Ttk_ElementOptionSpec *e = elementImpl->specPtr->options+i; optionMap[i] = TTKGetOptionSpec(e->optionName, optionTable, e->type); } return optionMap; } /* GetOptionMap -- * Return a cached OptionMap matching the specified optionTable * for the specified element, creating it if necessary. */ static OptionMap GetOptionMap(ElementImpl *elementImpl, Tk_OptionTable optionTable) { OptionMap optionMap; int isNew; Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry( &elementImpl->optMapCache, (ClientData)optionTable, &isNew); if (isNew) { optionMap = BuildOptionMap(elementImpl, optionTable); Tcl_SetHashValue(entryPtr, optionMap); } else { optionMap = (OptionMap)(Tcl_GetHashValue(entryPtr)); } return optionMap; } /* * NewElementImpl -- * Allocate and initialize an element implementation record * from the specified element specification. */ static ElementImpl * NewElementImpl(const char *name, Ttk_ElementSpec *specPtr,void *clientData) { ElementImpl *elementImpl = (ElementImpl*)ckalloc(sizeof(ElementImpl)); int i; elementImpl->name = name; elementImpl->specPtr = specPtr; elementImpl->clientData = clientData; elementImpl->elementRecord = ckalloc(specPtr->elementSize); /* Count #element resources: */ for (i = 0; specPtr->options[i].optionName != 0; ++i) continue; elementImpl->nResources = i; /* Initialize default values: */ elementImpl->defaultValues = (Tcl_Obj**) ckalloc(elementImpl->nResources * sizeof(Tcl_Obj *)); for (i=0; i < elementImpl->nResources; ++i) { const char *defaultValue = specPtr->options[i].defaultValue; if (defaultValue) { elementImpl->defaultValues[i] = Tcl_NewStringObj(defaultValue,-1); Tcl_IncrRefCount(elementImpl->defaultValues[i]); } else { elementImpl->defaultValues[i] = 0; } } /* Initialize option map cache: */ Tcl_InitHashTable(&elementImpl->optMapCache, TCL_ONE_WORD_KEYS); return elementImpl; } /* * FreeElementImpl -- * Release resources associated with an element implementation record. */ static void FreeElementImpl(ElementImpl *elementImpl) { Tcl_HashSearch search; Tcl_HashEntry *entryPtr; int i; /* * Free default values: */ for (i = 0; i < elementImpl->nResources; ++i) { if (elementImpl->defaultValues[i]) { Tcl_DecrRefCount(elementImpl->defaultValues[i]); } } ckfree((ClientData)elementImpl->defaultValues); /* * Free option map cache: */ entryPtr = Tcl_FirstHashEntry(&elementImpl->optMapCache, &search); while (entryPtr != NULL) { ckfree(Tcl_GetHashValue(entryPtr)); entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&elementImpl->optMapCache); ckfree(elementImpl->elementRecord); ckfree((ClientData)elementImpl); } /*------------------------------------------------------------------------ * +++ Themes. */ static int ThemeEnabled(Ttk_Theme theme, void *clientData) { return 1; } /* Default ThemeEnabledProc -- always return true */ typedef struct Ttk_Theme_ { Ttk_Theme parentPtr; /* Parent theme. */ Tcl_HashTable elementTable; /* Map element names to ElementImpls */ Tcl_HashTable styleTable; /* Map style names to Styles */ Ttk_Style rootStyle; /* "." style, root of chain */ Ttk_ThemeEnabledProc *enabledProc; /* Function called by SetTheme */ void *enabledData; /* ClientData for enabledProc */ Ttk_ResourceCache cache; /* Back-pointer to resource cache */ } Theme; static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) { Theme *themePtr = (Theme*)ckalloc(sizeof(Theme)); Tcl_HashEntry *entryPtr; int unused; themePtr->parentPtr = parent; themePtr->enabledProc = ThemeEnabled; themePtr->enabledData = NULL; themePtr->cache = cache; Tcl_InitHashTable(&themePtr->elementTable, TCL_STRING_KEYS); Tcl_InitHashTable(&themePtr->styleTable, TCL_STRING_KEYS); /* * Create root style "." */ entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, ".", &unused); themePtr->rootStyle = NewStyle(); themePtr->rootStyle->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr); themePtr->rootStyle->cache = themePtr->cache; Tcl_SetHashValue(entryPtr, (ClientData)themePtr->rootStyle); return themePtr; } static void FreeTheme(Theme *themePtr) { Tcl_HashSearch search; Tcl_HashEntry *entryPtr; /* * Free associated ElementImpl's */ entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search); while (entryPtr != NULL) { ElementImpl *elementImpl = (ElementImpl *)Tcl_GetHashValue(entryPtr); FreeElementImpl(elementImpl); entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&themePtr->elementTable); /* * Free style table: */ entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search); while (entryPtr != NULL) { Style *stylePtr = (Style*)Tcl_GetHashValue(entryPtr); FreeStyle(stylePtr); entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&themePtr->styleTable); /* * Free theme record: */ ckfree((char *)themePtr); return; } /* * Element constructors. */ typedef struct { Ttk_ElementFactory factory; void *clientData; } FactoryRec; /* * Cleanup records: */ typedef struct CleanupStruct { void *clientData; Ttk_CleanupProc *cleanupProc; struct CleanupStruct *next; } Cleanup; /*------------------------------------------------------------------------ * +++ Master style package data structure. */ typedef struct { Tcl_Interp *interp; /* Owner interp */ Tcl_HashTable themeTable; /* KEY: name; VALUE: Theme pointer */ Tcl_HashTable factoryTable; /* KEY: name; VALUE: FactoryRec ptr */ Theme *defaultTheme; /* Default theme; global fallback*/ Theme *currentTheme; /* Currently-selected theme */ Cleanup *cleanupList; /* Cleanup records */ Ttk_ResourceCache cache; /* Resource cache */ int themeChangePending; /* scheduled ThemeChangedProc call? */ } StylePackageData; static void ThemeChangedProc(ClientData); /* Forward */ /* Ttk_StylePkgFree -- * Cleanup procedure for StylePackageData. */ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr; Theme *themePtr; Cleanup *cleanup; /* * Cancel any pending ThemeChanged calls: */ if (pkgPtr->themeChangePending) { Tcl_CancelIdleCall(ThemeChangedProc, pkgPtr); } /* * Free themes. */ entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { themePtr = (Theme *) Tcl_GetHashValue(entryPtr); FreeTheme(themePtr); entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&pkgPtr->themeTable); /* * Free element constructor table: */ entryPtr = Tcl_FirstHashEntry(&pkgPtr->factoryTable, &search); while (entryPtr != NULL) { ckfree(Tcl_GetHashValue(entryPtr)); entryPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&pkgPtr->factoryTable); /* * Release cache: */ Ttk_FreeResourceCache(pkgPtr->cache); /* * Call all registered cleanup procedures: */ cleanup = pkgPtr->cleanupList; while (cleanup) { Cleanup *next = cleanup->next; cleanup->cleanupProc(cleanup->clientData); ckfree((ClientData)cleanup); cleanup = next; } ckfree((char*)pkgPtr); } /* * GetStylePackageData -- * Look up the package data registered with the interp. */ static StylePackageData *GetStylePackageData(Tcl_Interp *interp) { return (StylePackageData*)Tcl_GetAssocData(interp, "StylePackage", NULL); } /* * Ttk_RegisterCleanup -- * * Register a function to be called when a theme engine is deleted. * (This only happens when the main interp is destroyed). The cleanup * function is called with the current Tcl interpreter and the client * data provided here. * */ void Ttk_RegisterCleanup( Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc) { StylePackageData *pkgPtr = GetStylePackageData(interp); Cleanup *cleanup = (Cleanup*)ckalloc(sizeof(*cleanup)); cleanup->clientData = clientData; cleanup->cleanupProc = cleanupProc; cleanup->next = pkgPtr->cleanupList; pkgPtr->cleanupList = cleanup; } /* ThemeChangedProc -- * Notify all widgets that the theme has been changed. * Scheduled as an idle callback; clientData is a StylePackageData *. * * Sends a <> event to every widget in the hierarchy. * Widgets respond to this by calling the WorldChanged class proc, * which in turn recreates the layout. * * The Tk C API doesn't doesn't provide an easy way to traverse * the widget hierarchy, so this is done by evaluating a Tcl script. */ static void ThemeChangedProc(ClientData clientData) { static char ThemeChangedScript[] = "ttk::ThemeChanged"; StylePackageData *pkgPtr = (StylePackageData *)clientData; if (Tcl_GlobalEval(pkgPtr->interp, ThemeChangedScript) != TCL_OK) { Tcl_BackgroundError(pkgPtr->interp); } pkgPtr->themeChangePending = 0; } /* * ThemeChanged -- * Schedule a call to ThemeChanged if one is not already pending. */ static void ThemeChanged(StylePackageData *pkgPtr) { if (!pkgPtr->themeChangePending) { Tcl_DoWhenIdle(ThemeChangedProc, pkgPtr); pkgPtr->themeChangePending = 1; } } /* * Ttk_CreateTheme -- * Create a new theme and register it in the global theme table. * * Returns: * Pointer to new Theme structure; NULL if named theme already exists. * Leaves an error message in interp's result on error. */ Ttk_Theme Ttk_CreateTheme( Tcl_Interp *interp, /* Interpreter in which to create theme */ const char *name, /* Name of the theme to create. */ Ttk_Theme parent) /* Parent/fallback theme, NULL for default */ { StylePackageData *pkgPtr = GetStylePackageData(interp); Tcl_HashEntry *entryPtr; int newEntry; Theme *themePtr; entryPtr = Tcl_CreateHashEntry(&pkgPtr->themeTable, name, &newEntry); if (!newEntry) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Theme ", name, " already exists", NULL); return NULL; } /* * Initialize new theme: */ if (!parent) parent = pkgPtr->defaultTheme; themePtr = NewTheme(pkgPtr->cache, parent); Tcl_SetHashValue(entryPtr, (ClientData) themePtr); return themePtr; } /* * Ttk_SetThemeEnabledProc -- * Sets a procedure that is used to check that this theme is available. */ void Ttk_SetThemeEnabledProc( Ttk_Theme theme, Ttk_ThemeEnabledProc enabledProc, void *enabledData) { theme->enabledProc = enabledProc; theme->enabledData = enabledData; } /* * LookupTheme -- * Retrieve a registered theme by name. If not found, * returns NULL and leaves an error message in interp's result. */ static Ttk_Theme LookupTheme( Tcl_Interp *interp, /* where to leave error messages */ StylePackageData *pkgPtr, /* style package master record */ const char *name) /* theme name */ { Tcl_HashEntry *entryPtr; entryPtr = Tcl_FindHashEntry(&pkgPtr->themeTable, name); if (!entryPtr) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "theme \"", name, "\" doesn't exist", NULL); return NULL; } return (Ttk_Theme)Tcl_GetHashValue(entryPtr); } /* * Ttk_GetTheme -- * Public interface to LookupTheme. */ Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, const char *themeName) { StylePackageData *pkgPtr = GetStylePackageData(interp); return LookupTheme(interp, pkgPtr, themeName); } Ttk_Theme Ttk_GetCurrentTheme(Tcl_Interp *interp) { StylePackageData *pkgPtr = GetStylePackageData(interp); return pkgPtr->currentTheme; } Ttk_Theme Ttk_GetDefaultTheme(Tcl_Interp *interp) { StylePackageData *pkgPtr = GetStylePackageData(interp); return pkgPtr->defaultTheme; } /* * Ttk_UseTheme -- * Set the current theme, notify all widgets that the theme has changed. */ int Ttk_UseTheme(Tcl_Interp *interp, Ttk_Theme theme) { StylePackageData *pkgPtr = GetStylePackageData(interp); /* * Check if selected theme is enabled: */ while (theme && !theme->enabledProc(theme, theme->enabledData)) { theme = theme->parentPtr; } if (!theme) { /* This shouldn't happen -- default theme should always work */ Tcl_Panic("No themes available?"); return TCL_ERROR; } pkgPtr->currentTheme = theme; ThemeChanged(pkgPtr); return TCL_OK; } /* * Ttk_GetResourceCache -- * Return the resource cache associated with 'interp' */ Ttk_ResourceCache Ttk_GetResourceCache(Tcl_Interp *interp) { StylePackageData *pkgPtr = GetStylePackageData(interp); return pkgPtr->cache; } /* * Register a new layout specification with a style. * @@@ TODO: Make sure layoutName is not ".", root style must not have a layout */ MODULE_SCOPE void Ttk_RegisterLayoutTemplate( Ttk_Theme theme, /* Target theme */ const char *layoutName, /* Name of new layout */ Ttk_LayoutTemplate layoutTemplate) /* Template */ { Ttk_Style style = Ttk_GetStyle(theme, layoutName); if (style->layoutTemplate) { Ttk_FreeLayoutTemplate(style->layoutTemplate); } style->layoutTemplate = layoutTemplate; } void Ttk_RegisterLayout( Ttk_Theme themePtr, /* Target theme */ const char *layoutName, /* Name of new layout */ Ttk_LayoutSpec specPtr) /* Static layout information */ { Ttk_LayoutTemplate layoutTemplate = Ttk_BuildLayoutTemplate(specPtr); Ttk_RegisterLayoutTemplate(themePtr, layoutName, layoutTemplate); } /* * Ttk_GetStyle -- * Look up a Style from a Theme, create new style if not found. */ Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName) { Tcl_HashEntry *entryPtr; int newStyle; entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, styleName, &newStyle); if (newStyle) { Ttk_Style stylePtr = NewStyle(); const char *dot = strchr(styleName, '.'); if (dot) { stylePtr->parentStyle = Ttk_GetStyle(themePtr, dot + 1); } else { stylePtr->parentStyle = themePtr->rootStyle; } stylePtr->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr); stylePtr->cache = stylePtr->parentStyle->cache; Tcl_SetHashValue(entryPtr, (ClientData)stylePtr); return stylePtr; } return (Style*)Tcl_GetHashValue(entryPtr); } /* FindLayoutTemplate -- * Locate a layout template in the layout table, checking * generic names to specific names first, then looking for * the full name in the parent theme. */ Ttk_LayoutTemplate Ttk_FindLayoutTemplate(Ttk_Theme themePtr, const char *layoutName) { while (themePtr) { Ttk_Style stylePtr = Ttk_GetStyle(themePtr, layoutName); while (stylePtr) { if (stylePtr->layoutTemplate) { return stylePtr->layoutTemplate; } stylePtr = stylePtr->parentStyle; } themePtr = themePtr->parentPtr; } return NULL; } const char *Ttk_StyleName(Ttk_Style stylePtr) { return stylePtr->styleName; } /* * Ttk_GetElement -- * Look up an element implementation by name in a given theme. * If not found, try generic element names in this theme, then * repeat the lookups in the parent theme. * If not found, return the null element. */ Ttk_ElementImpl Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) { Tcl_HashEntry *entryPtr; const char *dot = elementName; /* * Check if element has already been registered: */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, elementName); if (entryPtr) { return (Ttk_ElementImpl)Tcl_GetHashValue(entryPtr); } /* * Check generic names: */ while (!entryPtr && ((dot = strchr(dot, '.')) != NULL)) { dot++; entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, dot); } if (entryPtr) { return (ElementImpl *)Tcl_GetHashValue(entryPtr); } /* * Check parent theme: */ if (themePtr->parentPtr) { return Ttk_GetElement(themePtr->parentPtr, elementName); } /* * Not found, and this is the root theme; return null element, "". * (@@@ SHOULD: signal a background error) */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, ""); /* ASSERT: entryPtr != 0 */ return (Ttk_ElementImpl)Tcl_GetHashValue(entryPtr); } const char *Ttk_ElementName(ElementImpl *elementImpl) { return elementImpl->name; } /* * Ttk_RegisterElementFactory -- * Register a new element factory. */ int Ttk_RegisterElementFactory( Tcl_Interp *interp, const char *name, Ttk_ElementFactory factory, void *clientData) { StylePackageData *pkgPtr = GetStylePackageData(interp); FactoryRec *recPtr = (FactoryRec*)ckalloc(sizeof(*recPtr)); Tcl_HashEntry *entryPtr; int newEntry; recPtr->factory = factory; recPtr->clientData = clientData; entryPtr = Tcl_CreateHashEntry(&pkgPtr->factoryTable, name, &newEntry); if (!newEntry) { /* Free old factory: */ ckfree(Tcl_GetHashValue(entryPtr)); } Tcl_SetHashValue(entryPtr, recPtr); return TCL_OK; } /* Ttk_CloneElement -- element factory procedure. * (style element create $name) "from" $theme ?$element? */ static int Ttk_CloneElement( Tcl_Interp *interp, void *clientData, Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *CONST objv[]) { Ttk_Theme fromTheme; ElementImpl *fromElement; if (objc <= 0 || objc > 2) { Tcl_WrongNumArgs(interp, 0, objv, "theme ?element?"); return TCL_ERROR; } fromTheme = Ttk_GetTheme(interp, Tcl_GetString(objv[0])); if (!fromTheme) { return TCL_ERROR; } if (objc == 2) { fromElement = Ttk_GetElement(fromTheme, Tcl_GetString(objv[1])); } else { fromElement = Ttk_GetElement(fromTheme, elementName); } if (!fromElement) { return TCL_ERROR; } if (Ttk_RegisterElement(interp, theme, elementName, fromElement->specPtr, fromElement->clientData) == NULL) { return TCL_ERROR; } return TCL_OK; } /* Ttk_RegisterElement-- * Register an element in the given theme. * Returns: Element handle if successful, NULL otherwise. * On failure, leaves an error message in interp's result * if interp is non-NULL. */ Ttk_ElementImpl Ttk_RegisterElement( Tcl_Interp *interp, /* Where to leave error messages */ Ttk_Theme theme, /* Style engine providing the implementation. */ const char *name, /* Name of new element */ Ttk_ElementSpec *specPtr, /* Static template information */ void *clientData) /* application-specific data */ { ElementImpl *elementImpl; Tcl_HashEntry *entryPtr; int newEntry; if (specPtr->version != TK_STYLE_VERSION_2) { /* Version mismatch */ if (interp) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Internal error: Ttk_RegisterElement (", name, "): invalid version", NULL); } return 0; } entryPtr = Tcl_CreateHashEntry(&theme->elementTable, name, &newEntry); if (!newEntry) { if (interp) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Duplicate element ", name, NULL); } return 0; } name = Tcl_GetHashKey(&theme->elementTable, entryPtr); elementImpl = NewElementImpl(name, specPtr, clientData); Tcl_SetHashValue(entryPtr, elementImpl); return elementImpl; } /* Ttk_RegisterElementSpec (deprecated) -- * Register a new element. */ int Ttk_RegisterElementSpec(Ttk_Theme theme, const char *name, Ttk_ElementSpec *specPtr, void *clientData) { return Ttk_RegisterElement(NULL, theme, name, specPtr, clientData) ? TCL_OK : TCL_ERROR; } /*------------------------------------------------------------------------ * +++ Element record initialization. */ /* * AllocateResource -- * Extra initialization for element options like TK_OPTION_COLOR, etc. * * Returns: 1 if OK, 0 on failure. * * Note: if resource allocation fails at this point (just prior * to drawing an element), there's really no good place to * report the error. Instead we just silently fail. */ static int AllocateResource( Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj **destPtr, int optionType) { Tcl_Obj *resource = *destPtr; switch (optionType) { case TK_OPTION_FONT: return (*destPtr = Ttk_UseFont(cache, tkwin, resource)) != NULL; case TK_OPTION_COLOR: return (*destPtr = Ttk_UseColor(cache, tkwin, resource)) != NULL; case TK_OPTION_BORDER: return (*destPtr = Ttk_UseBorder(cache, tkwin, resource)) != NULL; default: /* no-op; always succeeds */ return 1; } } /* * InitializeElementRecord -- * * Fill in the element record based on the element's option table. * Resources are initialized from: * the corresponding widget option if present and non-NULL, * otherwise the dynamic state map if specified, * otherwise from the corresponding widget resource if present, * otherwise the default value specified at registration time. * * Returns: * 1 if OK, 0 if an error is detected. * * NOTES: * Tcl_Obj * reference counts are _NOT_ adjusted. */ static int InitializeElementRecord( ElementImpl *element, /* Element instance to initialize */ Ttk_Style style, /* Style table */ char *widgetRecord, /* Source of widget option values */ Tk_OptionTable optionTable, /* Option table describing widget record */ Tk_Window tkwin, /* Corresponding window */ Ttk_State state) /* Widget or element state */ { char *elementRecord = element->elementRecord; OptionMap optionMap = GetOptionMap(element,optionTable); int nResources = element->nResources; Ttk_ResourceCache cache = style->cache; Ttk_ElementOptionSpec *elementOption = element->specPtr->options; int i; for (i=0; ioffset); const char *optionName = elementOption->optionName; Tcl_Obj *stateMap = LookupStateMap(style, optionName); Tcl_Obj *dynamicSetting = 0; Tcl_Obj *widgetValue = 0; Tcl_Obj *elementDefault = element->defaultValues[i]; if (stateMap) { dynamicSetting = Ttk_StateMapLookup(NULL, stateMap, state); } if (optionMap[i]) { widgetValue = *(Tcl_Obj **) (widgetRecord + optionMap[i]->objOffset); } if (widgetValue) { *dest = widgetValue; } else if (dynamicSetting) { *dest = dynamicSetting; } else { Tcl_Obj *styleDefault = LookupDefault(style, optionName); *dest = styleDefault ? styleDefault : elementDefault; } if (!AllocateResource(cache, tkwin, dest, elementOption->type)) { return 0; } } return 1; } /*------------------------------------------------------------------------ * +++ Public API. */ /* * Ttk_QueryStyle -- * Look up a style option based on the current state. */ Tcl_Obj *Ttk_QueryStyle( Ttk_Style style, /* Style to query */ void *recordPtr, /* Widget record */ Tk_OptionTable optionTable, /* Option table describing widget record */ const char *optionName, /* Option name */ Ttk_State state) /* Current state */ { Tcl_Obj *stateMap; const Tk_OptionSpec *optionSpec; Tcl_Obj *result; /* * Check widget record: */ optionSpec = TTKGetOptionSpec(optionName, optionTable, TK_OPTION_ANY); if (optionSpec) { result = *(Tcl_Obj**)(((char*)recordPtr) + optionSpec->objOffset); if (result) { return result; } } /* * Check dynamic settings: */ stateMap = LookupStateMap(style, optionName); if (stateMap) { result = Ttk_StateMapLookup(NULL, stateMap, state); if (result) { return result; } } /* * Use style default: */ return LookupDefault(style, optionName); } /* * Ttk_ElementSize -- * Compute the requested size of the given element. */ void Ttk_ElementSize( ElementImpl *element, /* Element to query */ Ttk_Style style, /* Style settings */ char *recordPtr, /* The widget record. */ Tk_OptionTable optionTable, /* Description of widget record */ Tk_Window tkwin, /* The widget window. */ Ttk_State state, /* Current widget state */ int *widthPtr, /* Requested width */ int *heightPtr, /* Reqested height */ Ttk_Padding *paddingPtr) /* Requested inner border */ { paddingPtr->left = paddingPtr->right = paddingPtr->top = paddingPtr->bottom = *widthPtr = *heightPtr = 0; if (!InitializeElementRecord(element, style, recordPtr, optionTable, tkwin, state)) return; element->specPtr->size( element->clientData, element->elementRecord, tkwin, widthPtr, heightPtr, paddingPtr); } /* * Ttk_DrawElement -- * Draw the given widget element in a given drawable area. */ void Ttk_DrawElement( ElementImpl *element, /* Element instance */ Ttk_Style style, /* Style settings */ char *recordPtr, /* The widget record. */ Tk_OptionTable optionTable, /* Description of option table */ Tk_Window tkwin, /* The widget window. */ Drawable d, /* Where to draw element. */ Ttk_Box b, /* Element area */ Ttk_State state) /* Widget or element state flags. */ { if (b.width <= 0 || b.height <= 0) return; if (!InitializeElementRecord(element, style, recordPtr, optionTable, tkwin, state)) return; element->specPtr->draw( element->clientData, element->elementRecord, tkwin, d, b, state); } /*------------------------------------------------------------------------ * +++ 'style' command ensemble procedures. */ /* * EnumerateHashTable -- * Helper routine. Sets interp's result to the list of all keys * in the hash table. * * Returns: TCL_OK. * Side effects: Sets interp's result. */ static int EnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht) { Tcl_HashSearch search; Tcl_Obj *result = Tcl_NewListObj(0, NULL); Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); Tcl_ListObjAppendElement(interp, result, nameObj); entryPtr = Tcl_NextHashEntry(&search); } Tcl_SetObjResult(interp, result); return TCL_OK; } /* HashTableToDict -- * Helper routine. Converts a TCL_STRING_KEYS Tcl_HashTable * with Tcl_Obj * entries into a dictionary. */ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht) { Tcl_HashSearch search; Tcl_Obj *result = Tcl_NewListObj(0, NULL); Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); Tcl_Obj *valueObj = (Tcl_Obj*)Tcl_GetHashValue(entryPtr); Tcl_ListObjAppendElement(NULL, result, nameObj); Tcl_ListObjAppendElement(NULL, result, valueObj); entryPtr = Tcl_NextHashEntry(&search); } return result; } /* + style map $style ? -resource statemap ... ? * * Note that resource names are unconstrained; the Style * doesn't know what resources individual elements may use. */ static int StyleMapCmd( ClientData clientData, /* Master StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj * CONST objv[]) /* Argument objects */ { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; int i; if (objc < 3) { usage: Tcl_WrongNumArgs(interp,2,objv,"style ?-option ?value...??"); return TCL_ERROR; } styleName = Tcl_GetString(objv[2]); stylePtr = Ttk_GetStyle(theme, styleName); /* NOTE: StateMaps are actually Tcl_Obj *s, so HashTableToDict works * for settingsTable. */ if (objc == 3) { /* style map $styleName */ Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->settingsTable)); return TCL_OK; } else if (objc == 4) { /* style map $styleName -option */ const char *optionName = Tcl_GetString(objv[3]); Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&stylePtr->settingsTable, optionName); if (entryPtr) { Tcl_SetObjResult(interp, (Tcl_Obj*)Tcl_GetHashValue(entryPtr)); } return TCL_OK; } else if (objc % 2 != 1) { goto usage; } for (i = 3; i < objc; i += 2) { const char *optionName = Tcl_GetString(objv[i]); Tcl_Obj *stateMap = objv[i+1]; Tcl_HashEntry *entryPtr; int newEntry; /* Make sure 'stateMap' is legal: * (@@@ SHOULD: check for valid resource values as well, * but we don't know what types they should be at this level.) */ if (!Ttk_GetStateMapFromObj(interp, stateMap)) return TCL_ERROR; entryPtr = Tcl_CreateHashEntry( &stylePtr->settingsTable,optionName,&newEntry); Tcl_IncrRefCount(stateMap); if (!newEntry) { Tcl_DecrRefCount((Tcl_Obj*)Tcl_GetHashValue(entryPtr)); } Tcl_SetHashValue(entryPtr, stateMap); } ThemeChanged(pkgPtr); return TCL_OK; } /* + style configure $style -option ?value... */ static int StyleConfigureCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; int i; if (objc < 3) { usage: Tcl_WrongNumArgs(interp,2,objv,"style ?-option ?value...??"); return TCL_ERROR; } styleName = Tcl_GetString(objv[2]); stylePtr = Ttk_GetStyle(theme, styleName); if (objc == 3) { /* style default $styleName */ Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->defaultsTable)); return TCL_OK; } else if (objc == 4) { /* style default $styleName -option */ const char *optionName = Tcl_GetString(objv[3]); Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&stylePtr->defaultsTable, optionName); if (entryPtr) { Tcl_SetObjResult(interp, (Tcl_Obj*)Tcl_GetHashValue(entryPtr)); } return TCL_OK; } else if (objc % 2 != 1) { goto usage; } for (i = 3; i < objc; i += 2) { const char *optionName = Tcl_GetString(objv[i]); Tcl_Obj *value = objv[i+1]; Tcl_HashEntry *entryPtr; int newEntry; entryPtr = Tcl_CreateHashEntry( &stylePtr->defaultsTable,optionName,&newEntry); Tcl_IncrRefCount(value); if (!newEntry) { Tcl_DecrRefCount((Tcl_Obj*)Tcl_GetHashValue(entryPtr)); } Tcl_SetHashValue(entryPtr, value); } ThemeChanged(pkgPtr); return TCL_OK; } /* + style lookup $style -option ?statespec? ?defaultValue? */ static int StyleLookupCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { StylePackageData *pkgPtr = clientData; Ttk_Theme theme = pkgPtr->currentTheme; Ttk_Style style = NULL; const char *optionName; Ttk_State state = 0ul; Tcl_Obj *result; if (objc < 4 || objc > 6) { Tcl_WrongNumArgs(interp, 2, objv, "style -option ?state? ?default?"); return TCL_ERROR; } style = Ttk_GetStyle(theme, Tcl_GetString(objv[2])); if (!style) { return TCL_ERROR; } optionName = Tcl_GetString(objv[3]); if (objc >= 5) { Ttk_StateSpec stateSpec; /* @@@ SB: Ttk_GetStateFromObj(); 'offbits' spec is ignored */ if (Ttk_GetStateSpecFromObj(interp, objv[4], &stateSpec) != TCL_OK) { return TCL_ERROR; } state = stateSpec.onbits; } result = Ttk_QueryStyle(style, NULL,NULL, optionName, state); if (result == NULL && objc >= 6) { /* Use caller-supplied fallback */ result = objv[5]; } if (result) { Tcl_SetObjResult(interp, result); } return TCL_OK; } /* + style theme create name ?-parent $theme? ?-settings { script }? */ static int StyleThemeCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; static const char *optStrings[] = { "-parent", "-settings", NULL }; enum { OP_PARENT, OP_SETTINGS }; Ttk_Theme parentTheme = pkgPtr->defaultTheme, newTheme; Tcl_Obj *settingsScript = NULL; const char *themeName; int i; if (objc < 4 || objc % 2 != 0) { Tcl_WrongNumArgs(interp, 3, objv, "name ?options?"); return TCL_ERROR; } themeName = Tcl_GetString(objv[3]); for (i=4; i < objc; i +=2) { int option; if (Tcl_GetIndexFromObj( interp, objv[i], optStrings, "option", 0, &option) != TCL_OK) { return TCL_ERROR; } switch (option) { case OP_PARENT: parentTheme = LookupTheme( interp, pkgPtr, Tcl_GetString(objv[i+1])); if (!parentTheme) return TCL_ERROR; break; case OP_SETTINGS: settingsScript = objv[i+1]; break; } } newTheme = Ttk_CreateTheme(interp, themeName, parentTheme); if (!newTheme) { return TCL_ERROR; } /* * Evaluate the -settings script, if supplied: */ if (settingsScript) { Ttk_Theme oldTheme = pkgPtr->currentTheme; int status; pkgPtr->currentTheme = newTheme; status = Tcl_EvalObjEx(interp, settingsScript, 0); pkgPtr->currentTheme = oldTheme; return status; } else { return TCL_OK; } } /* + style theme names -- * Return list of registered themes. */ static int StyleThemeNamesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { StylePackageData *pkgPtr = clientData; return EnumerateHashTable(interp, &pkgPtr->themeTable); } /* + style theme settings $theme $script * * Temporarily sets the current theme to $themeName, * evaluates $script, then restores the old theme. */ static int StyleThemeSettingsCmd( ClientData clientData, /* Master StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj * CONST objv[]) /* Argument objects */ { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme oldTheme = pkgPtr->currentTheme; Ttk_Theme newTheme; int status; if (objc != 5) { Tcl_WrongNumArgs(interp, 3, objv, "theme script"); return TCL_ERROR; } newTheme = LookupTheme(interp, pkgPtr, Tcl_GetString(objv[3])); if (!newTheme) return TCL_ERROR; pkgPtr->currentTheme = newTheme; status = Tcl_EvalObjEx(interp, objv[4], 0); pkgPtr->currentTheme = oldTheme; return status; } /* + style element create name type ? ...args ? */ static int StyleElementCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName, *factoryName; Tcl_HashEntry *entryPtr; FactoryRec *recPtr; if (objc < 5) { Tcl_WrongNumArgs(interp, 3, objv, "name type ?options...?"); return TCL_ERROR; } elementName = Tcl_GetString(objv[3]); factoryName = Tcl_GetString(objv[4]); entryPtr = Tcl_FindHashEntry(&pkgPtr->factoryTable, factoryName); if (!entryPtr) { Tcl_AppendResult(interp, "No such element type ", factoryName, NULL); return TCL_ERROR; } recPtr = (FactoryRec *)Tcl_GetHashValue(entryPtr); return recPtr->factory(interp, recPtr->clientData, theme, elementName, objc - 5, objv + 5); } /* + style element names -- * Return a list of elements defined in the current theme. */ static int StyleElementNamesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } return EnumerateHashTable(interp, &theme->elementTable); } /* + style element options $element -- * Return list of element options for specified element */ static int StyleElementOptionsCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { StylePackageData *pkgPtr = clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName; ElementImpl *elementImpl; if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "element"); return TCL_ERROR; } elementName = Tcl_GetString(objv[3]); elementImpl = Ttk_GetElement(theme, elementName); if (elementImpl) { Ttk_ElementSpec *specPtr = elementImpl->specPtr; Ttk_ElementOptionSpec *option = specPtr->options; Tcl_Obj *result = Tcl_NewListObj(0,0); while (option->optionName) { Tcl_ListObjAppendElement( interp, result, Tcl_NewStringObj(option->optionName,-1)); ++option; } Tcl_SetObjResult(interp, result); return TCL_OK; } Tcl_AppendResult(interp, "element ", elementName, " not found", NULL); return TCL_ERROR; } /* + style layout name ?spec? */ static int StyleLayoutCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *layoutName; Ttk_LayoutTemplate layoutTemplate; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "name ?spec?"); return TCL_ERROR; } layoutName = Tcl_GetString(objv[2]); if (objc == 3) { layoutTemplate = Ttk_FindLayoutTemplate(theme, layoutName); if (!layoutTemplate) { Tcl_AppendResult(interp, "Layout ", layoutName, " not found", NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Ttk_UnparseLayoutTemplate(layoutTemplate)); } else { layoutTemplate = Ttk_ParseLayoutTemplate(interp, objv[3]); if (!layoutTemplate) { return TCL_ERROR; } Ttk_RegisterLayoutTemplate(theme, layoutName, layoutTemplate); ThemeChanged(pkgPtr); } return TCL_OK; } /* + style theme use $theme -- * Sets the current theme to $theme */ static int StyleThemeUseCmd( ClientData clientData, /* Master StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj * CONST objv[]) /* Argument objects */ { StylePackageData *pkgPtr = clientData; Ttk_Theme theme; if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "theme"); return TCL_ERROR; } theme = LookupTheme(interp, pkgPtr, Tcl_GetString(objv[3])); if (!theme) { return TCL_ERROR; } return Ttk_UseTheme(interp, theme); } /* * StyleObjCmd -- * Implementation of the [style] command. */ struct Ensemble { const char *name; /* subcommand name */ Tcl_ObjCmdProc *command; /* subcommand implementation, OR: */ struct Ensemble *ensemble; /* subcommand ensemble */ }; static struct Ensemble StyleThemeEnsemble[] = { { "create", StyleThemeCreateCmd, 0 }, { "names", StyleThemeNamesCmd, 0 }, { "settings", StyleThemeSettingsCmd, 0 }, { "use", StyleThemeUseCmd, 0 }, { NULL, 0, 0 } }; static struct Ensemble StyleElementEnsemble[] = { { "create", StyleElementCreateCmd, 0 }, { "names", StyleElementNamesCmd, 0 }, { "options", StyleElementOptionsCmd, 0 }, { NULL, 0, 0 } }; static struct Ensemble StyleEnsemble[] = { { "configure", StyleConfigureCmd, 0 }, { "map", StyleMapCmd, 0 }, { "lookup", StyleLookupCmd, 0 }, { "layout", StyleLayoutCmd, 0 }, { "theme", 0, StyleThemeEnsemble }, { "element", 0, StyleElementEnsemble }, { NULL, 0, 0 } }; static int StyleObjCmd( ClientData clientData, /* Master StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj * CONST objv[]) /* Argument objects */ { struct Ensemble *ensemble = StyleEnsemble; int optPtr = 1; int index; while (optPtr < objc) { if (Tcl_GetIndexFromObjStruct(interp, objv[optPtr], ensemble, sizeof(ensemble[0]), "command", 0, &index) != TCL_OK) { return TCL_ERROR; } if (ensemble[index].command) { return ensemble[index].command(clientData, interp, objc, objv); } ensemble = ensemble[index].ensemble; ++optPtr; } Tcl_WrongNumArgs(interp, optPtr, objv, "option ?arg arg...?"); return TCL_ERROR; } /* * Ttk_StylePkgInit -- * Initializes all the structures that are used by the style * package on a per-interp basis. */ void Ttk_StylePkgInit(Tcl_Interp *interp) { StylePackageData *pkgPtr = (StylePackageData *) ckalloc(sizeof(StylePackageData)); pkgPtr->interp = interp; Tcl_InitHashTable(&pkgPtr->themeTable, TCL_STRING_KEYS); Tcl_InitHashTable(&pkgPtr->factoryTable, TCL_STRING_KEYS); pkgPtr->cleanupList = NULL; pkgPtr->cache = Ttk_CreateResourceCache(interp); pkgPtr->themeChangePending = 0; Tcl_SetAssocData(interp, "StylePackage", Ttk_StylePkgFree, (ClientData)pkgPtr); /* * Create the default system theme: * * pkgPtr->defaultTheme must be initialized to 0 before * calling Ttk_CreateTheme for the first time, since it's used * as the parent theme. */ pkgPtr->defaultTheme = 0; pkgPtr->defaultTheme = pkgPtr->currentTheme = Ttk_CreateTheme(interp, "default", NULL); /* * Register null element, used as a last-resort fallback: */ Ttk_RegisterElement(interp, pkgPtr->defaultTheme, "", &ttkNullElementSpec, 0); /* * Register commands: */ Tcl_CreateObjCommand(interp, "::ttk::style", StyleObjCmd, (ClientData)pkgPtr, 0); Ttk_RegisterElementFactory(interp, "from", Ttk_CloneElement, 0); } /*EOF*/ tile-0.8.2/generic/tkTheme.h0000644000076500007650000003361710731266207015250 0ustar joejoe00000000000000/* tkTheme.h,v 1.130 2007/12/16 18:20:55 jenglish Exp * Copyright (c) 2003 Joe English. Freely redistributable. * * Declarations for Tk theme engine. */ #ifndef _TTKTHEME #define _TTKTHEME #ifdef __cplusplus extern "C" { #endif #if defined(BUILD_tile) # define TTKAPI DLLEXPORT # undef USE_TTK_STUBS #else # define TTKAPI DLLIMPORT #endif #ifndef MODULE_SCOPE # define MODULE_SCOPE extern #endif #define TILE_VERSION "0.8.2" /*------------------------------------------------------------------------ * +++ Defaults for element option specifications. */ #define DEFAULT_FONT "TkDefaultFont" #define DEFAULT_BACKGROUND "#d9d9d9" #define DEFAULT_FOREGROUND "black" /*------------------------------------------------------------------------ * +++ Widget states. * Keep in sync with stateNames[] in tkstate.c. */ typedef unsigned int Ttk_State; #define TTK_STATE_ACTIVE (1<<0) #define TTK_STATE_DISABLED (1<<1) #define TTK_STATE_FOCUS (1<<2) #define TTK_STATE_PRESSED (1<<3) #define TTK_STATE_SELECTED (1<<4) #define TTK_STATE_BACKGROUND (1<<5) #define TTK_STATE_ALTERNATE (1<<6) #define TTK_STATE_INVALID (1<<7) #define TTK_STATE_READONLY (1<<8) #define TTK_STATE_USER7 (1<<9) #define TTK_STATE_USER6 (1<<10) #define TTK_STATE_USER5 (1<<11) #define TTK_STATE_USER4 (1<<12) #define TTK_STATE_USER3 (1<<13) #define TTK_STATE_USER2 (1<<14) #define TTK_STATE_USER1 (1<<15) /* Maintenance note: if you get all the way to "USER1", * see tkstate.c */ typedef struct { unsigned int onbits; /* bits to turn on */ unsigned int offbits; /* bits to turn off */ } Ttk_StateSpec; #define Ttk_StateMatches(state, spec) \ (((state) & ((spec)->onbits|(spec)->offbits)) == (spec)->onbits) #define Ttk_ModifyState(state, spec) \ (((state) & ~(spec)->offbits) | (spec)->onbits) TTKAPI int Ttk_GetStateSpecFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_StateSpec *); TTKAPI Tcl_Obj *Ttk_NewStateSpecObj(unsigned int onbits,unsigned int offbits); /*------------------------------------------------------------------------ * +++ State maps and state tables. */ typedef Tcl_Obj *Ttk_StateMap; TTKAPI Ttk_StateMap Ttk_GetStateMapFromObj(Tcl_Interp *, Tcl_Obj *); TTKAPI Tcl_Obj *Ttk_StateMapLookup(Tcl_Interp*, Ttk_StateMap, Ttk_State); /* * Table for looking up an integer index based on widget state: */ typedef struct { int index; /* Value to return if this entry matches */ unsigned int onBits; /* Bits which must be set */ unsigned int offBits; /* Bits which must be cleared */ } Ttk_StateTable; TTKAPI int Ttk_StateTableLookup(Ttk_StateTable map[], Ttk_State); /*------------------------------------------------------------------------ * +++ Padding. * Used to represent internal padding and borders. */ typedef struct { short left; short top; short right; short bottom; } Ttk_Padding; TTKAPI int Ttk_GetPaddingFromObj(Tcl_Interp*,Tk_Window,Tcl_Obj*,Ttk_Padding*); TTKAPI int Ttk_GetBorderFromObj(Tcl_Interp*,Tcl_Obj*,Ttk_Padding*); TTKAPI Ttk_Padding Ttk_MakePadding(short l, short t, short r, short b); TTKAPI Ttk_Padding Ttk_UniformPadding(short borderWidth); TTKAPI Ttk_Padding Ttk_AddPadding(Ttk_Padding, Ttk_Padding); TTKAPI Ttk_Padding Ttk_RelievePadding(Ttk_Padding, int relief, int n); #define Ttk_PaddingWidth(p) ((p).left + (p).right) #define Ttk_PaddingHeight(p) ((p).top + (p).bottom) #define Ttk_SetMargins(tkwin, pad) \ Tk_SetInternalBorderEx(tkwin, pad.left, pad.right, pad.top, pad.bottom) /*------------------------------------------------------------------------ * +++ Boxes. * Used to represent rectangular regions */ typedef struct /* Hey, this is an XRectangle! */ { int x; int y; int width; int height; } Ttk_Box; TTKAPI Ttk_Box Ttk_MakeBox(int x, int y, int width, int height); TTKAPI int Ttk_BoxContains(Ttk_Box, int x, int y); #define Ttk_WinBox(tkwin) Ttk_MakeBox(0,0,Tk_Width(tkwin),Tk_Height(tkwin)) /*------------------------------------------------------------------------ * +++ Layout utilities. */ typedef enum { TTK_SIDE_LEFT, TTK_SIDE_TOP, TTK_SIDE_RIGHT, TTK_SIDE_BOTTOM } Ttk_Side; typedef unsigned int Ttk_Sticky; /* * -sticky bits for Ttk_StickBox: */ #define TTK_STICK_W (0x1) #define TTK_STICK_E (0x2) #define TTK_STICK_N (0x4) #define TTK_STICK_S (0x8) /* * Aliases and useful combinations: */ #define TTK_FILL_X (0x3) /* -sticky ew */ #define TTK_FILL_Y (0xC) /* -sticky ns */ #define TTK_FILL_BOTH (0xF) /* -sticky nswe */ TTKAPI int Ttk_GetStickyFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_Sticky *); TTKAPI Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky); /* * Extra bits for position specifications (combine -side and -sticky) */ typedef unsigned int Ttk_PositionSpec; /* See below */ #define TTK_PACK_LEFT (0x10) /* pack at left of current parcel */ #define TTK_PACK_RIGHT (0x20) /* pack at right of current parcel */ #define TTK_PACK_TOP (0x40) /* pack at top of current parcel */ #define TTK_PACK_BOTTOM (0x80) /* pack at bottom of current parcel */ #define TTK_EXPAND (0x100) /* use entire parcel */ #define TTK_BORDER (0x200) /* draw this element after children */ #define TTK_UNIT (0x400) /* treat descendants as a part of element */ /* * Extra bits for layout specifications */ #define _TTK_CHILDREN (0x1000)/* for LayoutSpecs -- children follow */ #define _TTK_LAYOUT_END (0x2000)/* for LayoutSpecs -- end of child list */ #define _TTK_LAYOUT (0x4000)/* for LayoutSpec tables -- define layout */ #define _TTK_MASK_STICK (0x0F) /* See Ttk_UnparseLayout() */ #define _TTK_MASK_PACK (0xF0) /* See Ttk_UnparseLayout(), packStrings */ TTKAPI Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int w, int h, Ttk_Side side); TTKAPI Ttk_Box Ttk_StickBox(Ttk_Box parcel, int w, int h, Ttk_Sticky sticky); TTKAPI Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int w, int h, Tk_Anchor anchor); TTKAPI Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p); TTKAPI Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p); TTKAPI Ttk_Box Ttk_PlaceBox(Ttk_Box *cavity, int w,int h, Ttk_Side,Ttk_Sticky); TTKAPI Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int w, int h, Ttk_PositionSpec); /*------------------------------------------------------------------------ * +++ Themes. */ extern void Ttk_StylePkgInit(Tcl_Interp *); typedef struct Ttk_Theme_ *Ttk_Theme; typedef struct Ttk_ElementImpl_ *Ttk_ElementImpl; typedef struct Ttk_Layout_ *Ttk_Layout; typedef struct Ttk_LayoutNode_ Ttk_LayoutNode; TTKAPI Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, const char *name); TTKAPI Ttk_Theme Ttk_GetDefaultTheme(Tcl_Interp *interp); TTKAPI Ttk_Theme Ttk_GetCurrentTheme(Tcl_Interp *interp); TTKAPI Ttk_Theme Ttk_CreateTheme( Tcl_Interp *interp, const char *name, Ttk_Theme parent); typedef int (Ttk_ThemeEnabledProc)(Ttk_Theme theme, void *clientData); extern void Ttk_SetThemeEnabledProc(Ttk_Theme, Ttk_ThemeEnabledProc, void *); extern int Ttk_UseTheme(Tcl_Interp *, Ttk_Theme); typedef void (Ttk_CleanupProc)(void *clientData); TTKAPI void Ttk_RegisterCleanup( Tcl_Interp *interp, void *deleteData, Ttk_CleanupProc *cleanupProc); /*------------------------------------------------------------------------ * +++ Elements. */ enum TTKStyleVersion2 { TK_STYLE_VERSION_2 = 2 }; typedef void (Ttk_ElementSizeProc)(void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding*); typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); typedef struct Ttk_ElementOptionSpec { char *optionName; /* Command-line name of the widget option */ Tk_OptionType type; /* Accepted option types */ int offset; /* Offset of Tcl_Obj* field in element record */ char *defaultValue; /* Default value to used if resource missing */ } Ttk_ElementOptionSpec; #define TK_OPTION_ANY TK_OPTION_STRING typedef struct Ttk_ElementSpec { enum TTKStyleVersion2 version; /* Version of the style support. */ size_t elementSize; /* Size of element record */ Ttk_ElementOptionSpec *options; /* List of options, NULL-terminated */ Ttk_ElementSizeProc *size; /* Compute min size and padding */ Ttk_ElementDrawProc *draw; /* Draw the element */ } Ttk_ElementSpec; TTKAPI Ttk_ElementImpl Ttk_RegisterElement( Tcl_Interp *interp, Ttk_Theme theme, const char *elementName, Ttk_ElementSpec *, void *clientData); typedef int (*Ttk_ElementFactory) (Tcl_Interp *, void *clientData, Ttk_Theme, const char *elementName, int objc, Tcl_Obj *const objv[]); TTKAPI int Ttk_RegisterElementFactory( Tcl_Interp *, const char *name, Ttk_ElementFactory, void *clientData); /* * Null element implementation: * has no geometry or layout; may be used as a stub or placeholder. */ typedef struct { Tcl_Obj *unused; } NullElement; extern void TtkNullElementSize (void *, void *, Tk_Window, int *, int *, Ttk_Padding *); extern void TtkNullElementDraw (void *, void *, Tk_Window, Drawable, Ttk_Box, Ttk_State); extern Ttk_ElementOptionSpec TtkNullElementOptions[]; extern Ttk_ElementSpec ttkNullElementSpec; /*------------------------------------------------------------------------ * +++ Layout templates. */ typedef struct { const char * elementName; unsigned opcode; } TTKLayoutInstruction, *Ttk_LayoutSpec; #define TTK_BEGIN_LAYOUT_TABLE(name) \ static TTKLayoutInstruction name[] = { #define TTK_LAYOUT(name, content) \ { name, _TTK_CHILDREN|_TTK_LAYOUT }, \ content \ { 0, _TTK_LAYOUT_END }, #define TTK_GROUP(name, flags, children) \ { name, flags | _TTK_CHILDREN }, \ children \ { 0, _TTK_LAYOUT_END }, #define TTK_NODE(name, flags) { name, flags }, #define TTK_END_LAYOUT_TABLE { 0, _TTK_LAYOUT | _TTK_LAYOUT_END } }; #define TTK_BEGIN_LAYOUT(name) static TTKLayoutInstruction name[] = { #define TTK_END_LAYOUT { 0, _TTK_LAYOUT_END } }; TTKAPI void Ttk_RegisterLayout( Ttk_Theme theme, const char *className, Ttk_LayoutSpec layoutSpec); TTKAPI void Ttk_RegisterLayouts( Ttk_Theme theme, Ttk_LayoutSpec layoutTable); /*------------------------------------------------------------------------ * +++ Layout instances. */ extern Ttk_Layout Ttk_CreateLayout( Tcl_Interp *, Ttk_Theme, const char *name, void *recordPtr, Tk_OptionTable, Tk_Window tkwin); extern Ttk_Layout Ttk_CreateSublayout( Tcl_Interp *, Ttk_Theme, Ttk_Layout, const char *name, Tk_OptionTable); extern void Ttk_FreeLayout(Ttk_Layout); extern void Ttk_LayoutSize(Ttk_Layout,Ttk_State,int *widthPtr,int *heightPtr); extern void Ttk_PlaceLayout(Ttk_Layout, Ttk_State, Ttk_Box); extern void Ttk_DrawLayout(Ttk_Layout, Ttk_State, Drawable); extern void Ttk_RebindSublayout(Ttk_Layout, void *recordPtr); extern Ttk_LayoutNode *Ttk_LayoutIdentify(Ttk_Layout, int x, int y); extern Ttk_LayoutNode *Ttk_LayoutFindNode(Ttk_Layout, const char *nodeName); extern const char *Ttk_LayoutNodeName(Ttk_LayoutNode *); extern Ttk_Box Ttk_LayoutNodeParcel(Ttk_LayoutNode *); extern Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout,Ttk_LayoutNode *); extern Ttk_Padding Ttk_LayoutNodeInternalPadding(Ttk_Layout,Ttk_LayoutNode *); extern void Ttk_LayoutNodeReqSize(Ttk_Layout, Ttk_LayoutNode *, int *w, int *h); extern void Ttk_PlaceLayoutNode(Ttk_Layout,Ttk_LayoutNode *, Ttk_Box); extern void Ttk_ChangeElementState(Ttk_LayoutNode *,unsigned set,unsigned clr); extern Tcl_Obj *Ttk_QueryOption(Ttk_Layout, const char *, Ttk_State); /*------------------------------------------------------------------------ * +++ Resource cache. * See resource.c for explanation. */ typedef struct Ttk_ResourceCache_ *Ttk_ResourceCache; extern Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *); extern void Ttk_FreeResourceCache(Ttk_ResourceCache); extern Ttk_ResourceCache Ttk_GetResourceCache(Tcl_Interp*); extern Tcl_Obj *Ttk_UseFont(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); extern Tcl_Obj *Ttk_UseColor(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); extern Tcl_Obj *Ttk_UseBorder(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); extern Tk_Image Ttk_UseImage(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); extern void Ttk_RegisterNamedColor(Ttk_ResourceCache, const char *, XColor *); /*------------------------------------------------------------------------ * +++ Image specifications. */ typedef struct TtkImageSpec Ttk_ImageSpec; TTKAPI Ttk_ImageSpec *TtkGetImageSpec(Tcl_Interp *, Tk_Window, Tcl_Obj *); TTKAPI void TtkFreeImageSpec(Ttk_ImageSpec *); TTKAPI Tk_Image TtkSelectImage(Ttk_ImageSpec *, Ttk_State); /*------------------------------------------------------------------------ * +++ Miscellaneous enumerations. * Other stuff that element implementations need to know about. */ typedef enum /* -default option values */ { TTK_BUTTON_DEFAULT_NORMAL, /* widget defaultable */ TTK_BUTTON_DEFAULT_ACTIVE, /* currently the default widget */ TTK_BUTTON_DEFAULT_DISABLED /* not defaultable */ } Ttk_ButtonDefaultState; TTKAPI int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, int *); typedef enum /* -compound option values */ { TTK_COMPOUND_NONE, /* image if specified, otherwise text */ TTK_COMPOUND_TEXT, /* text only */ TTK_COMPOUND_IMAGE, /* image only */ TTK_COMPOUND_CENTER, /* text overlays image */ TTK_COMPOUND_TOP, /* image above text */ TTK_COMPOUND_BOTTOM, /* image below text */ TTK_COMPOUND_LEFT, /* image to left of text */ TTK_COMPOUND_RIGHT /* image to right of text */ } Ttk_Compound; TTKAPI int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, int *); typedef enum { /* -orient option values */ TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL } Ttk_Orient; /*------------------------------------------------------------------------ * +++ Stub table declarations: */ #include "ttkDecls.h" /* * Drawing utilities for theme code: * (@@@ find a better home for this) */ typedef enum { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT } ArrowDirection; extern void TtkArrowSize(int h, ArrowDirection, int *widthPtr, int *heightPtr); extern void TtkDrawArrow(Display *, Drawable, GC, Ttk_Box, ArrowDirection); extern void TtkFillArrow(Display *, Drawable, GC, Ttk_Box, ArrowDirection); #ifdef __cplusplus } #endif #endif /* _TTKTHEME */ tile-0.8.2/generic/tkThemeInt.h0000644000076500007650000000314210724432727015715 0ustar joejoe00000000000000/* * tkThemeInt.h,v 1.17 2007/12/02 04:34:31 jenglish Exp * * Theme engine: private definitions. * * Copyright (c) 2004 Joe English. Freely redistributable. */ #ifndef TKTHEMEINT_INCLUDED #define TKTHEMEINT_INCLUDED 1 #include "tkTheme.h" typedef struct Ttk_Style_ *Ttk_Style; typedef struct Ttk_TemplateNode_ Ttk_TemplateNode, *Ttk_LayoutTemplate; MODULE_SCOPE Ttk_ElementImpl Ttk_GetElement(Ttk_Theme theme, const char *name); MODULE_SCOPE const char *Ttk_ElementName(Ttk_ElementImpl); MODULE_SCOPE void Ttk_ElementSize( Ttk_ElementImpl element, Ttk_Style, char *recordPtr, Tk_OptionTable, Tk_Window tkwin, Ttk_State state, int *widthPtr, int *heightPtr, Ttk_Padding*); MODULE_SCOPE void Ttk_DrawElement( Ttk_ElementImpl element, Ttk_Style, char *recordPtr, Tk_OptionTable, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); MODULE_SCOPE Tcl_Obj *Ttk_QueryStyle( Ttk_Style, void *, Tk_OptionTable, const char *, Ttk_State state); MODULE_SCOPE Ttk_LayoutTemplate Ttk_ParseLayoutTemplate( Tcl_Interp *, Tcl_Obj *); MODULE_SCOPE Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_LayoutTemplate); MODULE_SCOPE Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec); MODULE_SCOPE void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate); MODULE_SCOPE void Ttk_RegisterLayoutTemplate( Ttk_Theme theme, const char *layoutName, Ttk_LayoutTemplate); MODULE_SCOPE Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName); MODULE_SCOPE Ttk_LayoutTemplate Ttk_FindLayoutTemplate( Ttk_Theme themePtr, const char *layoutName); MODULE_SCOPE const char *Ttk_StyleName(Ttk_Style); #endif /* TKTHEMEINT_INCLUDED */ tile-0.8.2/generic/tkstate.c0000644000076500007650000001505110224623475015312 0ustar joejoe00000000000000/* * tkstate.c,v 1.11 2005/04/06 00:03:09 jenglish Exp * * Tk widget state utilities. * * Copyright (c) 2003 Joe English. Freely redistributable. * */ #include #include #include "tkTheme.h" /* * Table of state names. Must be kept in sync with TTK_STATE_* * #defines in tkTheme.h. */ static const char *stateNames[] = { "active", /* Mouse cursor is over widget or element */ "disabled", /* Widget is disabled */ "focus", /* Widget has keyboard focus */ "pressed", /* Pressed or "armed" */ "selected", /* "on", "true", "current", etc. */ "background", /* Top-level window lost focus (Mac,Win "inactive") */ "alternate", /* Widget-specific alternate display style */ "invalid", /* Bad value */ "readonly", /* Editing/modification disabled */ NULL }; /*------------------------------------------------------------------------ * +++ StateSpec object type: * * The string representation consists of a list of state names, * each optionally prefixed by an exclamation point (!). * * The internal representation uses the upper half of the longValue * to store the on bits and the lower half to store the off bits. * If we ever get more than 16 states, this will need to be reconsidered... */ static int StateSpecSetFromAny(Tcl_Interp *interp, Tcl_Obj *obj); /* static void StateSpecFreeIntRep(Tcl_Obj *); */ #define StateSpecFreeIntRep 0 /* not needed */ static void StateSpecDupIntRep(Tcl_Obj *, Tcl_Obj *); static void StateSpecUpdateString(Tcl_Obj *); static struct Tcl_ObjType StateSpecObjType = { "StateSpec", StateSpecFreeIntRep, StateSpecDupIntRep, StateSpecUpdateString, StateSpecSetFromAny }; static void StateSpecDupIntRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) { copyPtr->internalRep.longValue = srcPtr->internalRep.longValue; copyPtr->typePtr = &StateSpecObjType; } static int StateSpecSetFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) { int status; int objc; Tcl_Obj **objv; int i; unsigned int onbits = 0, offbits = 0; status = Tcl_ListObjGetElements(interp, objPtr, &objc, &objv); if (status != TCL_OK) return status; for (i = 0; i < objc; ++i) { char *stateName = Tcl_GetString(objv[i]); int on, j; if (*stateName == '!') { ++stateName; on = 0; } else { on = 1; } for (j = 0; stateNames[j] != 0; ++j) { if (strcmp(stateName, stateNames[j]) == 0) break; } if (stateNames[j] == 0) { if (interp) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Invalid state name ", stateName,NULL); } return TCL_ERROR; } if (on) { onbits |= (1<typePtr && objPtr->typePtr->freeIntRepProc) { objPtr->typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &StateSpecObjType; objPtr->internalRep.longValue = (onbits << 16) | offbits; return TCL_OK; } static void StateSpecUpdateString(Tcl_Obj *objPtr) { unsigned int onbits = (objPtr->internalRep.longValue & 0xFFFF0000) >> 16; unsigned int offbits = objPtr->internalRep.longValue & 0x0000FFFF; unsigned int mask = onbits | offbits; Tcl_DString result; int i, len; Tcl_DStringInit(&result); for (i=0; stateNames[i] != NULL; ++i) { if (mask & (1<bytes = Tcl_Alloc((unsigned)len); objPtr->length = len-1; strncpy(objPtr->bytes, Tcl_DStringValue(&result), (size_t)len-1); objPtr->bytes[len-1] = '\0'; } else { /* empty string */ objPtr->length = 0; objPtr->bytes = Tcl_Alloc(1); *objPtr->bytes = '\0'; } Tcl_DStringFree(&result); } Tcl_Obj *Ttk_NewStateSpecObj(unsigned int onbits, unsigned int offbits) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_InvalidateStringRep(objPtr); objPtr->typePtr = &StateSpecObjType; objPtr->internalRep.longValue = (onbits << 16) | offbits; return objPtr; } int Ttk_GetStateSpecFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_StateSpec *spec) { if (objPtr->typePtr != &StateSpecObjType) { int status = StateSpecSetFromAny(interp, objPtr); if (status != TCL_OK) return status; } spec->onbits = (objPtr->internalRep.longValue & 0xFFFF0000) >> 16; spec->offbits = objPtr->internalRep.longValue & 0x0000FFFF; return TCL_OK; } /* * Tk_StateMapLookup -- * * A state map is a paired list of StateSpec / value pairs. * Returns the value corresponding to the first matching state * specification, or NULL if not found or an error occurs. */ Tcl_Obj *Ttk_StateMapLookup( Tcl_Interp *interp, /* Where to leave error messages; may be NULL */ Ttk_StateMap map, /* State map */ Ttk_State state) /* State to look up */ { Tcl_Obj **specs; int nSpecs; int j, status; status = Tcl_ListObjGetElements(interp, map, &nSpecs, &specs); if (status != TCL_OK) return NULL; for (j = 0; j < nSpecs; j += 2) { Ttk_StateSpec spec; status = Ttk_GetStateSpecFromObj(interp, specs[j], &spec); if (status != TCL_OK) return NULL; if (Ttk_StateMatches(state, &spec)) return specs[j+1]; } if (interp) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "No match in state map", NULL); } return NULL; } /* Ttk_GetStateMapFromObj -- * Returns a Ttk_StateMap from a Tcl_Obj*. * Since a Ttk_StateMap is just a specially-formatted Tcl_Obj, * this basically just checks for errors. */ Ttk_StateMap Ttk_GetStateMapFromObj( Tcl_Interp *interp, /* Where to leave error messages; may be NULL */ Tcl_Obj *mapObj) /* State map */ { Tcl_Obj **specs; int nSpecs; int j, status; status = Tcl_ListObjGetElements(interp, mapObj, &nSpecs, &specs); if (status != TCL_OK) return NULL; if (nSpecs % 2 != 0) { if (interp) Tcl_SetResult(interp, "State map must have an even number of elements", TCL_STATIC); return 0; } for (j = 0; j < nSpecs; j += 2) { Ttk_StateSpec spec; if (Ttk_GetStateSpecFromObj(interp, specs[j], &spec) != TCL_OK) return NULL; } return mapObj; } /* * Ttk_StateTableLooup -- * Look up an index from a statically allocated state table. */ int Ttk_StateTableLookup(Ttk_StateTable *map, unsigned int state) { while ((state & map->onBits) != map->onBits || (~state & map->offBits) != map->offBits) { ++map; } return map->index; } /*EOF*/ tile-0.8.2/generic/trace.c0000644000076500007650000000730410311170705014721 0ustar joejoe00000000000000/* trace.c,v 1.4 2005/09/12 03:11:01 jenglish Exp * * Copyright 2003, Joe English * * Simplified interface to Tcl_TraceVariable. * * PROBLEM: Can't distinguish "variable does not exist" (which is OK) * from other errors (which are not). */ #include #include "tkTheme.h" #include "widget.h" struct TtkTraceHandle_ { Tcl_Interp *interp; /* Containing interpreter */ Tcl_Obj *varnameObj; /* Name of variable being traced */ Ttk_TraceProc callback; /* Callback procedure */ void *clientData; /* Data to pass to callback */ }; /* * Tcl_VarTraceProc for trace handles. */ static char * VarTraceProc( ClientData clientData, /* Widget record pointer */ Tcl_Interp *interp, /* Interpreter containing variable. */ CONST char *name1, /* (unused) */ CONST char *name2, /* (unused) */ int flags) /* Information about what happened. */ { Ttk_TraceHandle *tracePtr = clientData; const char *name, *value; Tcl_Obj *valuePtr; if (flags & TCL_INTERP_DESTROYED) { return NULL; } name = Tcl_GetString(tracePtr->varnameObj); /* * If the variable is being unset, then re-establish the trace: */ if (flags & TCL_TRACE_DESTROYED) { Tcl_TraceVar(interp, name, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, VarTraceProc, clientData); tracePtr->callback(tracePtr->clientData, NULL); return NULL; } /* * Call the callback: */ valuePtr = Tcl_GetVar2Ex(interp, name, NULL, TCL_GLOBAL_ONLY); value = valuePtr ? Tcl_GetString(valuePtr) : NULL; tracePtr->callback(tracePtr->clientData, value); return NULL; } /* Ttk_TraceVariable(interp, varNameObj, callback, clientdata) -- * Attach a write trace to the specified variable, * which will pass the variable's value to 'callback' * whenever the variable is set. * * When the variable is unset, passes NULL to the callback * and reattaches the trace. */ Ttk_TraceHandle *Ttk_TraceVariable( Tcl_Interp *interp, Tcl_Obj *varnameObj, Ttk_TraceProc callback, void *clientData) { Ttk_TraceHandle *h = (Ttk_TraceHandle*)ckalloc(sizeof(*h)); int status; h->interp = interp; h->varnameObj = Tcl_DuplicateObj(varnameObj); Tcl_IncrRefCount(h->varnameObj); h->clientData = clientData; h->callback = callback; status = Tcl_TraceVar(interp, Tcl_GetString(varnameObj), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, VarTraceProc, (ClientData)h); if (status != TCL_OK) { Tcl_DecrRefCount(h->varnameObj); ckfree((ClientData)h); return NULL; } return h; } /* * Ttk_UntraceVariable -- * Remove previously-registered trace and free the handle. */ void Ttk_UntraceVariable(Ttk_TraceHandle *h) { if (h) { Tcl_UntraceVar(h->interp, Tcl_GetString(h->varnameObj), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, VarTraceProc, (ClientData)h); Tcl_DecrRefCount(h->varnameObj); ckfree((ClientData)h); } } /* * Ttk_FireTrace -- * Executes a trace handle as if the variable has been written. * * Note: may reenter the interpreter. */ int Ttk_FireTrace(Ttk_TraceHandle *tracePtr) { Tcl_Interp *interp = tracePtr->interp; void *clientData = tracePtr->clientData; const char *name = Tcl_GetString(tracePtr->varnameObj); Ttk_TraceProc callback = tracePtr->callback; Tcl_Obj *valuePtr; const char *value; /* Read the variable. * Note that this can reenter the interpreter, and anything can happen -- * including the current trace handle being freed! */ valuePtr = Tcl_GetVar2Ex(interp, name, NULL, TCL_GLOBAL_ONLY); value = valuePtr ? Tcl_GetString(valuePtr) : NULL; /* Call callback. */ callback(clientData, value); return TCL_OK; } /*EOF*/ tile-0.8.2/generic/track.c0000644000076500007650000001056110707012536014734 0ustar joejoe00000000000000/* track.c,v 1.9 2007/10/22 03:13:34 jenglish Exp * Copyright (c) 2004, Joe English * * TtkTrackElementState() -- helper routine for widgets * like scrollbars in which individual elements may * be active or pressed instead of the widget as a whole. * * Usage: * TtkTrackElementState(&recordPtr->core); * * Registers an event handler on the widget that tracks pointer * events and updates the state of the element under the * mouse cursor. * * The "active" element is the one under the mouse cursor, * and is normally set to the ACTIVE state unless another element * is currently being pressed. * * The active element becomes "pressed" on events, * and remains "active" and "pressed" until the corresponding * event. * * TODO: Handle "chords" properly (e.g., ) */ #include #include "tkTheme.h" #include "widget.h" typedef struct { WidgetCore *corePtr; /* Widget to track */ Ttk_LayoutNode *activeElement; /* element under the mouse cursor */ Ttk_LayoutNode *pressedElement; /* currently pressed element */ } ElementStateTracker; /* * ActivateElement(es, node) -- * Make 'node' the active element if non-NULL. * Deactivates the currently active element if different. * * The active element has TTK_STATE_ACTIVE set _unless_ * another element is 'pressed' */ static void ActivateElement(ElementStateTracker *es, Ttk_LayoutNode *node) { if (es->activeElement == node) { /* No change */ return; } if (!es->pressedElement) { if (es->activeElement) { /* Deactivate old element */ Ttk_ChangeElementState(es->activeElement, 0,TTK_STATE_ACTIVE); } if (node) { /* Activate new element */ Ttk_ChangeElementState(node, TTK_STATE_ACTIVE,0); } TtkRedisplayWidget(es->corePtr); } es->activeElement = node; } /* ReleaseElement -- * Releases the currently pressed element, if any. */ static void ReleaseElement(ElementStateTracker *es) { if (!es->pressedElement) return; Ttk_ChangeElementState( es->pressedElement, 0,TTK_STATE_PRESSED|TTK_STATE_ACTIVE); es->pressedElement = 0; /* Reactivate element under the mouse cursor: */ if (es->activeElement) Ttk_ChangeElementState(es->activeElement, TTK_STATE_ACTIVE,0); TtkRedisplayWidget(es->corePtr); } /* PressElement -- * Presses the specified element. */ static void PressElement(ElementStateTracker *es, Ttk_LayoutNode *node) { if (es->pressedElement) { ReleaseElement(es); } if (node) { Ttk_ChangeElementState( node, TTK_STATE_PRESSED|TTK_STATE_ACTIVE, 0); } es->pressedElement = node; TtkRedisplayWidget(es->corePtr); } /* ElementStateEventProc -- * Event handler for tracking element states. */ static const unsigned ElementStateMask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | LeaveWindowMask | EnterWindowMask | StructureNotifyMask ; static void ElementStateEventProc(ClientData clientData, XEvent *ev) { ElementStateTracker *es = (ElementStateTracker *)clientData; Ttk_LayoutNode *node; switch (ev->type) { case MotionNotify : node = Ttk_LayoutIdentify( es->corePtr->layout,ev->xmotion.x,ev->xmotion.y); ActivateElement(es, node); break; case LeaveNotify: ActivateElement(es, 0); if (ev->xcrossing.mode == NotifyGrab) PressElement(es, 0); break; case EnterNotify: node = Ttk_LayoutIdentify( es->corePtr->layout,ev->xcrossing.x,ev->xcrossing.y); ActivateElement(es, node); break; case ButtonPress: node = Ttk_LayoutIdentify( es->corePtr->layout, ev->xbutton.x, ev->xbutton.y); if (node) PressElement(es, node); break; case ButtonRelease: ReleaseElement(es); break; case DestroyNotify: /* Unregister this event handler and free client data. */ Tk_DeleteEventHandler(es->corePtr->tkwin, ElementStateMask, ElementStateEventProc, es); ckfree(clientData); break; } } /* * TtkTrackElementState -- * Register an event handler to manage the 'pressed' * and 'active' states of individual widget elements. */ void TtkTrackElementState(WidgetCore *corePtr) { ElementStateTracker *es = (ElementStateTracker*)ckalloc(sizeof(*es)); es->corePtr = corePtr; es->activeElement = es->pressedElement = 0; Tk_CreateEventHandler(corePtr->tkwin, ElementStateMask,ElementStateEventProc,es); } tile-0.8.2/generic/treeview.c0000644000076500007650000024542310724432727015500 0ustar joejoe00000000000000/* treeview.c,v 1.45 2007/12/02 04:34:31 jenglish Exp * Copyright (c) 2004, Joe English * * ttk::treeview widget implementation. */ #include #include #include #include "tkTheme.h" #include "widget.h" #define DEF_TREE_ROWS "10" #define DEF_COLWIDTH "200" #define DEF_MINWIDTH "20" static const int DEFAULT_ROWHEIGHT = 20; static const int DEFAULT_INDENT = 20; static const int HALO = 4; /* separator */ #define TTK_STATE_OPEN TTK_STATE_USER1 #define TTK_STATE_LEAF TTK_STATE_USER2 #define STATE_CHANGED (0x100) /* item state option changed */ /*------------------------------------------------------------------------ * +++ Tree items. * * INVARIANTS: * item->children ==> item->children->parent == item * item->next ==> item->next->parent == item->parent * item->next ==> item->next->prev == item * item->prev ==> item->prev->next == item */ typedef struct TreeItemRec TreeItem; struct TreeItemRec { Tcl_HashEntry *entryPtr; /* Back-pointer to hash table entry */ TreeItem *parent; /* Parent item */ TreeItem *children; /* Linked list of child items */ TreeItem *next; /* Next sibling */ TreeItem *prev; /* Previous sibling */ /* * Options and instance data: */ Ttk_State state; Tcl_Obj *textObj; Tcl_Obj *imageObj; Tcl_Obj *valuesObj; Tcl_Obj *openObj; Tcl_Obj *tagsObj; }; static Tk_OptionSpec ItemOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", "", Tk_Offset(TreeItem,textObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", NULL, Tk_Offset(TreeItem,imageObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-values", "values", "Values", NULL, Tk_Offset(TreeItem,valuesObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_BOOLEAN, "-open", "open", "Open", "0", Tk_Offset(TreeItem,openObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-tags", "tags", "Tags", NULL, Tk_Offset(TreeItem,tagsObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; /* + NewItem -- * Allocate a new, uninitialized, unlinked item */ static TreeItem *NewItem(void) { TreeItem *item = (TreeItem*)ckalloc(sizeof(*item)); item->entryPtr = 0; item->parent = item->children = item->next = item->prev = NULL; item->state = 0ul; item->textObj = NULL; item->imageObj = NULL; item->valuesObj = NULL; item->openObj = NULL; item->tagsObj = NULL; return item; } /* + FreeItem -- * Destroy an item */ static void FreeItem(TreeItem *item) { if (item->textObj) { Tcl_DecrRefCount(item->textObj); } if (item->imageObj) { Tcl_DecrRefCount(item->imageObj); } if (item->valuesObj) { Tcl_DecrRefCount(item->valuesObj); } if (item->openObj) { Tcl_DecrRefCount(item->openObj); } if (item->tagsObj) { Tcl_DecrRefCount(item->tagsObj); } ckfree((ClientData)item); } static void FreeItemCB(void *clientData) { FreeItem(clientData); } /* + DetachItem -- * Unlink an item from the tree. */ static void DetachItem(TreeItem *item) { if (item->parent && item->parent->children == item) item->parent->children = item->next; if (item->prev) item->prev->next = item->next; if (item->next) item->next->prev = item->prev; item->next = item->prev = item->parent = NULL; } /* + InsertItem -- * Insert an item into the tree after the specified item. * * Preconditions: * + item is currently detached * + prev != NULL ==> prev->parent == parent. */ static void InsertItem(TreeItem *parent, TreeItem *prev, TreeItem *item) { item->parent = parent; item->prev = prev; if (prev) { item->next = prev->next; prev->next = item; } else { item->next = parent->children; parent->children = item; } if (item->next) { item->next->prev = item; } } /* + NextPreorder -- * Return the next item in preorder traversal order. */ static TreeItem *NextPreorder(TreeItem *item) { if (item->children) return item->children; while (!item->next) { item = item->parent; if (!item) return 0; } return item->next; } /*------------------------------------------------------------------------ * +++ Display items and tag options. */ typedef struct { Tcl_Obj *textObj; /* taken from item / data cell */ Tcl_Obj *imageObj; /* taken from item */ Tcl_Obj *anchorObj; /* from column */ Tcl_Obj *backgroundObj; /* remainder from tag */ Tcl_Obj *foregroundObj; Tcl_Obj *fontObj; } DisplayItem; static Tk_OptionSpec TagOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", NULL, Tk_Offset(DisplayItem,textObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", NULL, Tk_Offset(DisplayItem,imageObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, Tk_Offset(DisplayItem,anchorObj), -1, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-background", "windowColor", "WindowColor", /*SB:COLOR*/ NULL, Tk_Offset(DisplayItem,backgroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-foreground", "textColor", "TextColor", /*SB:COLOR*/ NULL, Tk_Offset(DisplayItem,foregroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-font", "font", "Font", /* SB:FONT */ NULL, Tk_Offset(DisplayItem,fontObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; /*------------------------------------------------------------------------ * +++ Columns. * * There are separate option tables associated with the column record: * ColumnOptionSpecs is for configuring the column, * and HeadingOptionSpecs is for drawing headings. */ typedef struct { int width; /* Column width, in pixels */ int minWidth; /* Minimum column width, in pixels */ int stretch; /* Should column stretch while resizing? */ Tcl_Obj *idObj; /* Column identifier, from -columns option */ Tcl_Obj *anchorObj; /* -anchor for cell data */ /* Column heading data: */ Tcl_Obj *headingObj; /* Heading label */ Tcl_Obj *headingImageObj; /* Heading image */ Tcl_Obj *headingAnchorObj; /* -anchor for heading label */ Tcl_Obj *headingCommandObj; /* Command to execute */ Tcl_Obj *headingStateObj; /* @@@ testing ... */ Ttk_State headingState; /* ... */ /* Temporary storage for cell data */ Tcl_Obj *data; } TreeColumn; static void InitColumn(TreeColumn *column) { column->width = 200; column->minWidth = 20; column->stretch = 1; column->idObj = 0; column->anchorObj = 0; column->headingState = 0; column->headingObj = 0; column->headingImageObj = 0; column->headingAnchorObj = 0; column->headingStateObj = 0; column->headingCommandObj = 0; column->data = 0; } static void FreeColumn(TreeColumn *column) { if (column->idObj) { Tcl_DecrRefCount(column->idObj); } if (column->anchorObj) { Tcl_DecrRefCount(column->anchorObj); } if (column->headingObj) { Tcl_DecrRefCount(column->headingObj); } if (column->headingImageObj) { Tcl_DecrRefCount(column->headingImageObj); } if (column->headingAnchorObj) { Tcl_DecrRefCount(column->headingAnchorObj); } if (column->headingStateObj) { Tcl_DecrRefCount(column->headingStateObj); } if (column->headingCommandObj) { Tcl_DecrRefCount(column->headingCommandObj); } /* Don't touch column->data, it's scratch storage */ } static Tk_OptionSpec ColumnOptionSpecs[] = { {TK_OPTION_INT, "-width", "width", "Width", DEF_COLWIDTH, -1, Tk_Offset(TreeColumn,width), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-minwidth", "minWidth", "MinWidth", DEF_MINWIDTH, -1, Tk_Offset(TreeColumn,minWidth), 0,0,0 }, {TK_OPTION_BOOLEAN, "-stretch", "stretch", "Stretch", "1", -1, Tk_Offset(TreeColumn,stretch), 0,0,0 }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "w", Tk_Offset(TreeColumn,anchorObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-id", "id", "ID", NULL, Tk_Offset(TreeColumn,idObj), -1, TK_OPTION_NULL_OK,0,READONLY_OPTION }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; static Tk_OptionSpec HeadingOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", "", Tk_Offset(TreeColumn,headingObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", "", Tk_Offset(TreeColumn,headingImageObj), -1, 0,0,0 }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "center", Tk_Offset(TreeColumn,headingAnchorObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-command", "", "", "", Tk_Offset(TreeColumn,headingCommandObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "state", "", "", "", Tk_Offset(TreeColumn,headingStateObj), -1, 0,0,STATE_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; /*------------------------------------------------------------------------ * +++ -show option: * TODO: Implement SHOW_BRANCHES. */ #define SHOW_TREE (0x1) /* Show tree column? */ #define SHOW_HEADINGS (0x2) /* Show heading row? */ #define DEFAULT_SHOW "tree headings" static const char *showStrings[] = { "tree", "headings", NULL }; static int GetEnumSetFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, const char *table[], unsigned *resultPtr) { unsigned result = 0; int i, objc; Tcl_Obj **objv; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) return TCL_ERROR; for (i = 0; i < objc; ++i) { int index; if (TCL_OK != Tcl_GetIndexFromObj( interp, objv[i], table, "value", TCL_EXACT, &index)) { return TCL_ERROR; } result |= (1 << index); } *resultPtr = result; return TCL_OK; } /*------------------------------------------------------------------------ * +++ Treeview widget record. * * Dependencies: * columns, columnNames: -columns * displayColumns: -columns, -displaycolumns * headingHeight: [layout] * rowHeight, indent: style */ typedef struct { /* Resources acquired at initialization-time: */ Tk_OptionTable itemOptionTable; Tk_OptionTable columnOptionTable; Tk_OptionTable headingOptionTable; Tk_OptionTable tagOptionTable; Tk_BindingTable bindingTable; Ttk_TagTable tagTable; /* Acquired in GetLayout hook: */ Ttk_Layout itemLayout; Ttk_Layout cellLayout; Ttk_Layout headingLayout; Ttk_Layout rowLayout; int headingHeight; /* Space for headings */ int rowHeight; /* Height of each item */ int indent; /* #pixels horizontal offset for child items */ /* Tree data: */ Tcl_HashTable items; /* Map: item name -> item */ int serial; /* Next item # for autogenerated names */ TreeItem *root; /* Root item */ TreeColumn column0; /* Column options for display column #0 */ TreeColumn *columns; /* Array of column options for data columns */ TreeItem *focus; /* Current focus item */ /* Widget options: */ Tcl_Obj *columnsObj; /* List of symbolic column names */ Tcl_Obj *displayColumnsObj; /* List of columns to display */ Tcl_Obj *heightObj; /* height (rows) */ Tcl_Obj *paddingObj; /* internal padding */ Tcl_Obj *showObj; /* -show list */ Tcl_Obj *selectModeObj; /* -selectmode option */ Scrollable xscroll; ScrollHandle xscrollHandle; Scrollable yscroll; ScrollHandle yscrollHandle; /* Derived resources: */ Tcl_HashTable columnNames; /* Map: column name -> column table entry */ int nColumns; /* #columns */ unsigned showFlags; /* bitmask of subparts to display */ TreeColumn **displayColumns; /* List of columns for display (incl tree) */ int nDisplayColumns; /* #display columns */ Ttk_Box headingArea; /* Display area for column headings */ Ttk_Box treeArea; /* Display area for tree */ int slack; /* Slack space (see Resizing section) */ } TreePart; typedef struct { WidgetCore core; TreePart tree; } Treeview; #define USER_MASK 0x0100 #define COLUMNS_CHANGED (USER_MASK) #define DCOLUMNS_CHANGED (USER_MASK<<1) #define SCROLLCMD_CHANGED (USER_MASK<<2) #define SHOW_CHANGED (USER_MASK<<3) static const char *SelectModeStrings[] = { "none", "browse", "extended", NULL }; static Tk_OptionSpec TreeviewOptionSpecs[] = { WIDGET_TAKES_FOCUS, {TK_OPTION_STRING, "-columns", "columns", "Columns", "", Tk_Offset(Treeview,tree.columnsObj), -1, 0,0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ }, {TK_OPTION_STRING, "-displaycolumns","displayColumns","DisplayColumns", "#all", Tk_Offset(Treeview,tree.displayColumnsObj), -1, 0,0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-show", "show", "Show", DEFAULT_SHOW, Tk_Offset(Treeview,tree.showObj), -1, 0,0,SHOW_CHANGED | GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-selectmode", "selectMode", "SelectMode", "extended", Tk_Offset(Treeview,tree.selectModeObj), -1, 0,(ClientData)SelectModeStrings,0 }, {TK_OPTION_PIXELS, "-height", "height", "Height", DEF_TREE_ROWS, Tk_Offset(Treeview,tree.heightObj), -1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, Tk_Offset(Treeview,tree.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", NULL, -1, Tk_Offset(Treeview, tree.xscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", NULL, -1, Tk_Offset(Treeview, tree.yscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Utilities. */ typedef void (*HashEntryIterator)(void *hashValue); static void foreachHashEntry(Tcl_HashTable *ht, HashEntryIterator func) { Tcl_HashSearch search; Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { func(Tcl_GetHashValue(entryPtr)); entryPtr = Tcl_NextHashEntry(&search); } } /* + unshare(objPtr) -- * Ensure that a Tcl_Obj * has refcount 1 -- either return objPtr * itself, or a duplicated copy. */ static Tcl_Obj *unshare(Tcl_Obj *objPtr) { if (Tcl_IsShared(objPtr)) { Tcl_Obj *newObj = Tcl_DuplicateObj(objPtr); Tcl_DecrRefCount(objPtr); Tcl_IncrRefCount(newObj); return newObj; } return objPtr; } /* DisplayLayout -- * Rebind, place, and draw a layout + object combination. */ static void DisplayLayout( Ttk_Layout layout, void *recordPtr, Ttk_State state, Ttk_Box b, Drawable d) { Ttk_RebindSublayout(layout, recordPtr); Ttk_PlaceLayout(layout, state, b); Ttk_DrawLayout(layout, state, d); } /* + GetColumn -- * Look up column by name or number. * Returns: pointer to column table entry, NULL if not found. * Leaves an error message in interp->result on error. */ static TreeColumn *GetColumn( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj) { Tcl_HashEntry *entryPtr; int columnIndex; /* Check for named column: */ entryPtr = Tcl_FindHashEntry( &tv->tree.columnNames, Tcl_GetString(columnIDObj)); if (entryPtr) { return Tcl_GetHashValue(entryPtr); } /* Check for number: */ if (Tcl_GetIntFromObj(NULL, columnIDObj, &columnIndex) == TCL_OK) { if (columnIndex < 0 || columnIndex >= tv->tree.nColumns) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Column index ", Tcl_GetString(columnIDObj), " out of bounds", NULL); return NULL; } return tv->tree.columns + columnIndex; } Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Invalid column index ", Tcl_GetString(columnIDObj), NULL); return NULL; } /* + FindColumn -- * Look up column by name, number, or display index. */ static TreeColumn *FindColumn( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj) { int colno; if (sscanf(Tcl_GetString(columnIDObj), "#%d", &colno) == 1) { /* Display column specification, #n */ if (colno >= 0 && colno < tv->tree.nDisplayColumns) { return tv->tree.displayColumns[colno]; } /* else */ Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Column ", Tcl_GetString(columnIDObj), " out of range", NULL); return NULL; } return GetColumn(interp, tv, columnIDObj); } /* + FindItem -- * Locates the item with the specified identifier in the tree. * If there is no such item, leaves an error message in interp. */ static TreeItem *FindItem( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *itemNameObj) { const char *itemName = Tcl_GetString(itemNameObj); Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&tv->tree.items, itemName); if (!entryPtr) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Item ", itemName, " not found", NULL); return 0; } return (TreeItem*)Tcl_GetHashValue(entryPtr); } /* + GetItemListFromObj -- * Parse a Tcl_Obj * as a list of items. * Returns a NULL-terminated array of items; result must * be ckfree()d. On error, returns NULL and leaves an error * message in interp. */ static TreeItem **GetItemListFromObj( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *objPtr) { TreeItem **items; Tcl_Obj **elements; int i, nElements; if (Tcl_ListObjGetElements(interp,objPtr,&nElements,&elements) != TCL_OK) { return NULL; } items = (TreeItem**)ckalloc((nElements + 1)*sizeof(TreeItem*)); for (i = 0; i < nElements; ++i) { items[i] = FindItem(interp, tv, elements[i]); if (!items[i]) { ckfree((ClientData)items); return NULL; } } items[i] = NULL; return items; } /* + ItemName -- * Returns the item's ID. */ static const char *ItemName(Treeview *tv, TreeItem *item) { return Tcl_GetHashKey(&tv->tree.items, item->entryPtr); } /* + ItemID -- * Returns a fresh Tcl_Obj * (refcount 0) holding the * item identifier of the specified item. */ static Tcl_Obj *ItemID(Treeview *tv, TreeItem *item) { return Tcl_NewStringObj(ItemName(tv, item), -1); } /*------------------------------------------------------------------------ * +++ Column configuration. */ /* + TreeviewFreeColumns -- * Free column data. */ static void TreeviewFreeColumns(Treeview *tv) { int i; Tcl_DeleteHashTable(&tv->tree.columnNames); Tcl_InitHashTable(&tv->tree.columnNames, TCL_STRING_KEYS); if (tv->tree.columns) { for (i = 0; i < tv->tree.nColumns; ++i) FreeColumn(tv->tree.columns + i); ckfree((ClientData)tv->tree.columns); tv->tree.columns = 0; } } /* + TreeviewInitColumns -- * Initialize column data when -columns changes. * Returns: TCL_OK or TCL_ERROR; */ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv) { Tcl_Obj **columns; int i, ncols; if (Tcl_ListObjGetElements( interp, tv->tree.columnsObj, &ncols, &columns) != TCL_OK) { return TCL_ERROR; } /* * Free old values: */ TreeviewFreeColumns(tv); /* * Initialize columns array and columnNames hash table: */ tv->tree.nColumns = ncols; tv->tree.columns = (TreeColumn*)ckalloc(tv->tree.nColumns * sizeof(TreeColumn)); for (i = 0; i < ncols; ++i) { int isNew; Tcl_Obj *columnName = Tcl_DuplicateObj(columns[i]); Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry( &tv->tree.columnNames, Tcl_GetString(columnName), &isNew); Tcl_SetHashValue(entryPtr, tv->tree.columns + i); InitColumn(tv->tree.columns + i); Tk_InitOptions( interp, (ClientData)(tv->tree.columns + i), tv->tree.columnOptionTable, tv->core.tkwin); Tk_InitOptions( interp, (ClientData)(tv->tree.columns + i), tv->tree.headingOptionTable, tv->core.tkwin); Tcl_IncrRefCount(columnName); tv->tree.columns[i].idObj = columnName; } return TCL_OK; } /* + TreeviewInitDisplayColumns -- * Initializes the 'displayColumns' array. * * Note that displayColumns[0] is always the tree column, * even when SHOW_TREE is not set. * * @@@ TODO: disallow duplicated columns */ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv) { Tcl_Obj **dcolumns; int index, ndcols; TreeColumn **displayColumns = 0; if (Tcl_ListObjGetElements(interp, tv->tree.displayColumnsObj, &ndcols, &dcolumns) != TCL_OK) { return TCL_ERROR; } if (!strcmp(Tcl_GetString(tv->tree.displayColumnsObj), "#all")) { ndcols = tv->tree.nColumns; displayColumns = (TreeColumn**)ckalloc((ndcols+1)*sizeof(TreeColumn*)); for (index = 0; index < ndcols; ++index) { displayColumns[index+1] = tv->tree.columns + index; } } else { displayColumns = (TreeColumn**)ckalloc((ndcols+1)*sizeof(TreeColumn*)); for (index = 0; index < ndcols; ++index) { displayColumns[index+1] = GetColumn(interp, tv, dcolumns[index]); if (!displayColumns[index+1]) { ckfree((ClientData)displayColumns); return TCL_ERROR; } } } displayColumns[0] = &tv->tree.column0; if (tv->tree.displayColumns) ckfree((ClientData)tv->tree.displayColumns); tv->tree.displayColumns = displayColumns; tv->tree.nDisplayColumns = ndcols + 1; return TCL_OK; } /*------------------------------------------------------------------------ * +++ Resizing. * Invariants: TreeWidth(tree) + slack = available space */ #define FirstColumn(tv) ((tv->tree.showFlags&SHOW_TREE) ? 0 : 1) /* + TreeWidth -- * Compute the requested tree width from the sum of visible column widths. */ static int TreeWidth(Treeview *tv) { int i = FirstColumn(tv); int width = 0; while (i < tv->tree.nDisplayColumns) { width += tv->tree.displayColumns[i++]->width; } return width; } static int SLACKINVARIANT(Treeview *tv) { return (TreeWidth(tv) + tv->tree.slack == tv->tree.treeArea.width) ; } /* + RecomputeSlack -- */ static void RecomputeSlack(Treeview *tv) { tv->tree.slack = tv->tree.treeArea.width - TreeWidth(tv); } /* + PickupSlack/DepositSlack -- * When resizing columns, distribute extra space to 'slack' first, * and only adjust column widths if 'slack' goes to zero. * That is, don't bother changing column widths if the tree * is already scrolled or short. */ static int PickupSlack(Treeview *tv, int extra) { int newSlack = tv->tree.slack + extra; if ( (newSlack < 0 && 0 <= tv->tree.slack) || (newSlack > 0 && 0 >= tv->tree.slack)) { tv->tree.slack = 0; return newSlack; } else { tv->tree.slack = newSlack; return 0; } } static void DepositSlack(Treeview *tv, int extra) { tv->tree.slack += extra; } /* + Stretch -- * Adjust width of column by N pixels, down to minimum width. * Returns: #pixels actually moved. */ static int Stretch(TreeColumn *c, int n) { int newWidth = n + c->width; if (newWidth < c->minWidth) { n = c->minWidth - c->width; c->width = c->minWidth; } else { c->width = newWidth; } return n; } /* + ShoveLeft -- * Adjust width of (stretchable) columns to the left by N pixels. * Returns: leftover slack. */ static int ShoveLeft(Treeview *tv, int i, int n) { int first = FirstColumn(tv); while (n != 0 && i >= first) { TreeColumn *c = tv->tree.displayColumns[i]; if (c->stretch) { n -= Stretch(c, n); } --i; } return n; } /* + ShoveRight -- * Adjust width of (stretchable) columns to the right by N pixels. * Returns: leftover slack. */ static int ShoveRight(Treeview *tv, int i, int n) { while (n != 0 && i < tv->tree.nDisplayColumns) { TreeColumn *c = tv->tree.displayColumns[i]; if (c->stretch) { n -= Stretch(c, n); } ++i; } return n; } /* + DistributeWidth -- * Distribute n pixels evenly across all stretchable display columns. * Returns: leftover slack. * Notes: * The "((++w % m) < r)" term is there so that the remainder r = n % m * is distributed round-robin. */ static int DistributeWidth(Treeview *tv, int n) { int w = TreeWidth(tv); int m = 0; int i, d, r; for (i = FirstColumn(tv); i < tv->tree.nDisplayColumns; ++i) { if (tv->tree.displayColumns[i]->stretch) { ++m; } } if (m == 0) { return n; } d = n / m; r = n % m; if (r < 0) { r += m; --d; } for (i = FirstColumn(tv); i < tv->tree.nDisplayColumns; ++i) { TreeColumn *c = tv->tree.displayColumns[i]; if (c->stretch) { n -= Stretch(c, d + ((++w % m) < r)); } } return n; } /* + ResizeColumns -- * Recompute column widths based on available width. * Pick up slack first; * Distribute the remainder evenly across stretchable columns; * If any is still left over due to minwidth constraints, shove left. */ static void ResizeColumns(Treeview *tv, int newWidth) { int delta = newWidth - (TreeWidth(tv) + tv->tree.slack); DepositSlack(tv, ShoveLeft(tv, tv->tree.nDisplayColumns - 1, DistributeWidth(tv, PickupSlack(tv, delta)))); } /* + DragColumn -- * Move the separator to the right of specified column, * adjusting other column widths as necessary. */ static void DragColumn(Treeview *tv, int i, int delta) { TreeColumn *c = tv->tree.displayColumns[i]; int dl = delta - ShoveLeft(tv, i-1, delta - Stretch(c, delta)); int dr = ShoveRight(tv, i+1, PickupSlack(tv, -dl)); DepositSlack(tv, dr); } /*------------------------------------------------------------------------ * +++ Event handlers. */ static TreeItem *IdentifyItem(Treeview *tv,int y,Ttk_Box *itemPos); /*forward*/ static const unsigned int TreeviewBindEventMask = KeyPressMask|KeyReleaseMask | ButtonPressMask|ButtonReleaseMask | PointerMotionMask|ButtonMotionMask | VirtualEventMask ; static void TreeviewBindEventProc(void *clientData, XEvent *event) { Treeview *tv = clientData; TreeItem *item = NULL; Ttk_Box unused; void *taglist; int nTags; /* * Figure out where to deliver the event. */ switch (event->type) { case KeyPress: case KeyRelease: case VirtualEvent: item = tv->tree.focus; break; case ButtonPress: case ButtonRelease: item = IdentifyItem(tv, event->xbutton.y, &unused); break; case MotionNotify: item = IdentifyItem(tv, event->xmotion.y, &unused); break; default: break; } if (!item) { return; } /* ASSERT: Ttk_GetTagListFromObj returns TCL_OK. */ Ttk_GetTagListFromObj(NULL, tv->tree.tagTable, item->tagsObj, &nTags, &taglist); /* * Fire binding: */ Tcl_Preserve(clientData); Tk_BindEvent(tv->tree.bindingTable, event, tv->core.tkwin, nTags, taglist); Tcl_Release(clientData); Ttk_FreeTagList(taglist); } /*------------------------------------------------------------------------ * +++ Initialization and cleanup. */ static int TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) { Treeview *tv = recordPtr; int unused; tv->tree.itemOptionTable = Tk_CreateOptionTable(interp, ItemOptionSpecs); tv->tree.columnOptionTable = Tk_CreateOptionTable(interp, ColumnOptionSpecs); tv->tree.headingOptionTable = Tk_CreateOptionTable(interp, HeadingOptionSpecs); tv->tree.tagOptionTable = Tk_CreateOptionTable(interp, TagOptionSpecs); tv->tree.tagTable = Ttk_CreateTagTable( tv->tree.tagOptionTable, sizeof(DisplayItem)); tv->tree.bindingTable = Tk_CreateBindingTable(interp); Tk_CreateEventHandler(tv->core.tkwin, TreeviewBindEventMask, TreeviewBindEventProc, tv); tv->tree.itemLayout = tv->tree.cellLayout = tv->tree.headingLayout = tv->tree.rowLayout = 0; tv->tree.headingHeight = tv->tree.rowHeight = DEFAULT_ROWHEIGHT; tv->tree.indent = DEFAULT_INDENT; Tcl_InitHashTable(&tv->tree.columnNames, TCL_STRING_KEYS); tv->tree.nColumns = tv->tree.nDisplayColumns = 0; tv->tree.columns = NULL; tv->tree.displayColumns = NULL; tv->tree.showFlags = ~0; InitColumn(&tv->tree.column0); Tk_InitOptions( interp, (ClientData)(&tv->tree.column0), tv->tree.columnOptionTable, tv->core.tkwin); Tk_InitOptions( interp, (ClientData)(&tv->tree.column0), tv->tree.headingOptionTable, tv->core.tkwin); Tcl_InitHashTable(&tv->tree.items, TCL_STRING_KEYS); tv->tree.serial = 0; tv->tree.focus = 0; /* Create root item "": */ tv->tree.root = NewItem(); Tk_InitOptions(interp, (ClientData)tv->tree.root, tv->tree.itemOptionTable, tv->core.tkwin); tv->tree.root->entryPtr = Tcl_CreateHashEntry(&tv->tree.items, "", &unused); Tcl_SetHashValue(tv->tree.root->entryPtr, tv->tree.root); /* Scroll handles: */ tv->tree.xscrollHandle = TtkCreateScrollHandle(&tv->core,&tv->tree.xscroll); tv->tree.yscrollHandle = TtkCreateScrollHandle(&tv->core,&tv->tree.yscroll); /* Size parameters: */ tv->tree.treeArea = tv->tree.headingArea = Ttk_MakeBox(0,0,0,0); tv->tree.slack = 0; return TCL_OK; } static void TreeviewCleanup(void *recordPtr) { Treeview *tv = recordPtr; Tk_DeleteEventHandler(tv->core.tkwin, TreeviewBindEventMask, TreeviewBindEventProc, tv); Tk_DeleteBindingTable(tv->tree.bindingTable); Ttk_DeleteTagTable(tv->tree.tagTable); if (tv->tree.itemLayout) Ttk_FreeLayout(tv->tree.itemLayout); if (tv->tree.cellLayout) Ttk_FreeLayout(tv->tree.cellLayout); if (tv->tree.headingLayout) Ttk_FreeLayout(tv->tree.headingLayout); if (tv->tree.rowLayout) Ttk_FreeLayout(tv->tree.rowLayout); TreeviewFreeColumns(tv); if (tv->tree.displayColumns) Tcl_Free((ClientData)tv->tree.displayColumns); foreachHashEntry(&tv->tree.items, FreeItemCB); Tcl_DeleteHashTable(&tv->tree.items); TtkFreeScrollHandle(tv->tree.xscrollHandle); TtkFreeScrollHandle(tv->tree.yscrollHandle); } /* + TreeviewConfigure -- * Configuration widget hook. * * BUG: If user sets -columns and -displaycolumns, but -displaycolumns * has an error, the widget is left in an inconsistent state. */ static int TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Treeview *tv = recordPtr; unsigned showFlags = tv->tree.showFlags; if (mask & COLUMNS_CHANGED) { if (TreeviewInitColumns(interp, tv) != TCL_OK) return TCL_ERROR; mask |= DCOLUMNS_CHANGED; } if (mask & DCOLUMNS_CHANGED) { if (TreeviewInitDisplayColumns(interp, tv) != TCL_OK) return TCL_ERROR; } if (mask & SCROLLCMD_CHANGED) { TtkScrollbarUpdateRequired(tv->tree.xscrollHandle); TtkScrollbarUpdateRequired(tv->tree.yscrollHandle); } if ( (mask & SHOW_CHANGED) && GetEnumSetFromObj( interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) { return TCL_ERROR; } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { return TCL_ERROR; } tv->tree.showFlags = showFlags; if (mask & (SHOW_CHANGED | DCOLUMNS_CHANGED)) { RecomputeSlack(tv); } return TCL_OK; } /* + ConfigureItem -- * Set item options. */ static int ConfigureItem( Tcl_Interp *interp, Treeview *tv, TreeItem *item, int objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; if (Tk_SetOptions(interp, (ClientData)item, tv->tree.itemOptionTable, objc, objv, tv->core.tkwin,&savedOptions,0) != TCL_OK) { return TCL_ERROR; } /* Make sure that -values is a valid list: */ if (item->valuesObj) { int unused; if (Tcl_ListObjLength(interp, item->valuesObj, &unused) != TCL_OK) goto error; } /* Validate -image option. */ if (item->imageObj) { Ttk_ImageSpec *imageSpec = TtkGetImageSpec(interp, tv->core.tkwin, item->imageObj); if (!imageSpec) { goto error; } TtkFreeImageSpec(imageSpec); /* @@@TODO: Keep this around */ } /* Keep TTK_STATE_OPEN flag in sync with item->openObj. * We use both a state flag and a Tcl_Obj* resource so elements * can access the value in either way. */ if (item->openObj) { int isOpen; if (Tcl_GetBooleanFromObj(interp, item->openObj, &isOpen) != TCL_OK) goto error; if (isOpen) item->state |= TTK_STATE_OPEN; else item->state &= ~TTK_STATE_OPEN; } /* Make sure -tags is a valid list * (side effect: may create new tags) */ if (item->tagsObj) { void *taglist; int nTags; if (Ttk_GetTagListFromObj(interp, tv->tree.tagTable, item->tagsObj, &nTags, &taglist) != TCL_OK) { goto error; } Ttk_FreeTagList(taglist); } /* All OK. */ Tk_FreeSavedOptions(&savedOptions); TtkRedisplayWidget(&tv->core); return TCL_OK; error: Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } /* + ConfigureColumn -- * Set column options. */ static int ConfigureColumn( Tcl_Interp *interp, Treeview *tv, TreeColumn *column, int objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; if (Tk_SetOptions(interp, (ClientData)column, tv->tree.columnOptionTable, objc, objv, tv->core.tkwin, &savedOptions,&mask) != TCL_OK) { return TCL_ERROR; } if (mask & READONLY_OPTION) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Attempt to change read-only option", NULL); goto error; } /* Propagate column width changes to overall widget request width, * but only if the widget is currently unmapped, in order to prevent * geometry jumping during interactive column resize. */ if (mask & GEOMETRY_CHANGED) { if (!Tk_IsMapped(tv->core.tkwin)) { TtkResizeWidget(&tv->core); } RecomputeSlack(tv); } TtkRedisplayWidget(&tv->core); assert(SLACKINVARIANT(tv)); Tk_FreeSavedOptions(&savedOptions); return TCL_OK; error: Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } /* + ConfigureHeading -- * Set heading options. */ static int ConfigureHeading( Tcl_Interp *interp, Treeview *tv, TreeColumn *column, int objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; if (Tk_SetOptions(interp, (ClientData)column, tv->tree.headingOptionTable, objc, objv, tv->core.tkwin, &savedOptions,&mask) != TCL_OK) { return TCL_ERROR; } /* @@@ testing ... */ if ((mask & STATE_CHANGED) && column->headingStateObj) { Ttk_StateSpec stateSpec; if (Ttk_GetStateSpecFromObj( interp, column->headingStateObj, &stateSpec) != TCL_OK) { goto error; } column->headingState = Ttk_ModifyState(column->headingState,&stateSpec); Tcl_DecrRefCount(column->headingStateObj); column->headingStateObj = Ttk_NewStateSpecObj(column->headingState,0); Tcl_IncrRefCount(column->headingStateObj); } TtkRedisplayWidget(&tv->core); Tk_FreeSavedOptions(&savedOptions); return TCL_OK; error: Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } /*------------------------------------------------------------------------ * +++ Geometry routines. */ /* + CountRows -- * Returns the number of viewable rows rooted at item */ static int CountRows(TreeItem *item) { int rows = 1; if (item->state & TTK_STATE_OPEN) { TreeItem *child = item->children; while (child) { rows += CountRows(child); child = child->next; } } return rows; } /* + IdentifyRow -- * Recursive search for item at specified y position. * Main work routine for IdentifyItem() */ static TreeItem *IdentifyRow( Treeview *tv, /* Widget record */ TreeItem *item, /* Where to start search */ Ttk_Box *bp, /* Scan position */ int y) /* Target y coordinate */ { while (item) { int next_ypos = bp->y + tv->tree.rowHeight; if (bp->y <= y && y <= next_ypos) { bp->height = tv->tree.rowHeight; return item; } bp->y = next_ypos; if (item->state & TTK_STATE_OPEN) { TreeItem *subitem = IdentifyRow(tv, item->children, bp, y); if (subitem) { bp->x += tv->tree.indent; bp->width -= tv->tree.indent; return subitem; } } item = item->next; } return 0; } /* + IdentifyItem -- * Locate the item at the specified y position, if any. * On return, *itemPos holds the parcel of the tree item. */ static TreeItem *IdentifyItem(Treeview *tv, int y, Ttk_Box *itemPos) { int rowHeight = tv->tree.rowHeight; *itemPos = Ttk_MakeBox( tv->tree.treeArea.x, tv->tree.treeArea.y - tv->tree.yscroll.first * rowHeight, tv->tree.column0.width, rowHeight); return IdentifyRow(tv, tv->tree.root->children, itemPos, y); } /* + IdentifyDisplayColumn -- * Returns the display column number at the specified x position, * or -1 if x is outside any columns. */ static int IdentifyDisplayColumn(Treeview *tv, int x, int *x1) { int colno = FirstColumn(tv); int xpos = tv->tree.treeArea.x; while (colno < tv->tree.nDisplayColumns) { TreeColumn *column = tv->tree.displayColumns[colno]; int next_xpos = xpos + column->width; if (xpos <= x && x <= next_xpos + HALO) { *x1 = next_xpos; return colno; } ++colno; xpos = next_xpos; } return -1; } /* + ItemRow -- * Returns row number of specified item relative to root, * -1 if item is not viewable. */ static int ItemRow(Treeview *tv, TreeItem *p) { TreeItem *root = tv->tree.root; int rowNumber = 0; for (;;) { if (p->prev) { p = p->prev; rowNumber += CountRows(p); } else { p = p->parent; if (!(p && (p->state & TTK_STATE_OPEN))) { /* detached or closed ancestor */ return -1; } if (p == root) { return rowNumber; } ++rowNumber; } } } /*------------------------------------------------------------------------ * +++ Display routines. */ /* + GetSublayout -- * Utility routine; acquires a sublayout for items, cells, etc. */ static Ttk_Layout GetSublayout( Tcl_Interp *interp, Ttk_Theme themePtr, Ttk_Layout parentLayout, const char *layoutName, Tk_OptionTable optionTable, Ttk_Layout *layoutPtr) { Ttk_Layout newLayout = Ttk_CreateSublayout( interp, themePtr, parentLayout, layoutName, optionTable); if (newLayout) { if (*layoutPtr) Ttk_FreeLayout(*layoutPtr); *layoutPtr = newLayout; } return newLayout; } /* + TreeviewGetLayout -- * GetLayout() widget hook. */ static Ttk_Layout TreeviewGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { Treeview *tv = recordPtr; Ttk_Layout treeLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); Tcl_Obj *objPtr; int unused; if (!( treeLayout && GetSublayout(interp, themePtr, treeLayout, ".Item", tv->tree.tagOptionTable, &tv->tree.itemLayout) && GetSublayout(interp, themePtr, treeLayout, ".Cell", tv->tree.tagOptionTable, &tv->tree.cellLayout) && GetSublayout(interp, themePtr, treeLayout, ".Heading", tv->tree.headingOptionTable, &tv->tree.headingLayout) && GetSublayout(interp, themePtr, treeLayout, ".Row", tv->tree.tagOptionTable, &tv->tree.rowLayout) )) { return 0; } /* Compute heading height. */ Ttk_RebindSublayout(tv->tree.headingLayout, &tv->tree.column0); Ttk_LayoutSize(tv->tree.headingLayout, 0, &unused, &tv->tree.headingHeight); /* Get item height, indent from style: * @@@ TODO: sanity-check. */ tv->tree.rowHeight = DEFAULT_ROWHEIGHT; tv->tree.indent = DEFAULT_INDENT; if ((objPtr = Ttk_QueryOption(treeLayout, "-rowheight", 0))) { (void)Tcl_GetIntFromObj(NULL, objPtr, &tv->tree.rowHeight); } if ((objPtr = Ttk_QueryOption(treeLayout, "-indent", 0))) { (void)Tcl_GetIntFromObj(NULL, objPtr, &tv->tree.indent); } return treeLayout; } /* + TreeviewDoLayout -- * DoLayout() widget hook. Computes widget layout. * * Side effects: * Computes headingArea and treeArea. * Computes subtree height. * Invokes scroll callbacks. */ static void TreeviewDoLayout(void *clientData) { Treeview *tv = clientData; Ttk_LayoutNode *clientNode = Ttk_LayoutFindNode(tv->core.layout,"treearea"); int visibleRows; assert(SLACKINVARIANT(tv)); Ttk_PlaceLayout(tv->core.layout,tv->core.state,Ttk_WinBox(tv->core.tkwin)); tv->tree.treeArea = clientNode ? Ttk_LayoutNodeInternalParcel(tv->core.layout,clientNode) : Ttk_WinBox(tv->core.tkwin) ; ResizeColumns(tv, tv->tree.treeArea.width); assert(SLACKINVARIANT(tv)); TtkScrolled(tv->tree.xscrollHandle, tv->tree.xscroll.first, tv->tree.xscroll.first + tv->tree.treeArea.width, TreeWidth(tv)); tv->tree.treeArea.x -= tv->tree.xscroll.first; if (tv->tree.showFlags & SHOW_HEADINGS) { tv->tree.headingArea = Ttk_PackBox( &tv->tree.treeArea, 1, tv->tree.headingHeight, TTK_SIDE_TOP); } else { tv->tree.headingArea = Ttk_MakeBox(0,0,0,0); } visibleRows = tv->tree.treeArea.height / tv->tree.rowHeight; tv->tree.root->state |= TTK_STATE_OPEN; TtkScrolled(tv->tree.yscrollHandle, tv->tree.yscroll.first, tv->tree.yscroll.first + visibleRows, CountRows(tv->tree.root) - 1); } /* + TreeviewSize -- * SizeProc() widget hook. Size is determined by * -height option and column widths. */ static int TreeviewSize(void *clientData, int *widthPtr, int *heightPtr) { Treeview *tv = clientData; int nRows, padHeight, padWidth; Ttk_LayoutSize(tv->core.layout, tv->core.state, &padWidth, &padHeight); Tcl_GetIntFromObj(NULL, tv->tree.heightObj, &nRows); *widthPtr = padWidth + TreeWidth(tv); *heightPtr = padHeight + tv->tree.rowHeight * nRows; if (tv->tree.showFlags & SHOW_HEADINGS) { *heightPtr += tv->tree.headingHeight; } return 1; } /* + ItemState -- * Returns the state of the specified item, based * on widget state, item state, and other information. */ static Ttk_State ItemState(Treeview *tv, TreeItem *item) { Ttk_State state = tv->core.state | item->state; if (!item->children) state |= TTK_STATE_LEAF; if (item != tv->tree.focus) state &= ~TTK_STATE_FOCUS; return state; } /* + DrawHeadings -- * Draw tree headings. */ static void DrawHeadings(Treeview *tv, Drawable d, Ttk_Box b) { int i = FirstColumn(tv); int x = 0; while (i < tv->tree.nDisplayColumns) { TreeColumn *column = tv->tree.displayColumns[i]; Ttk_Box parcel = Ttk_MakeBox(b.x+x, b.y, column->width, b.height); DisplayLayout(tv->tree.headingLayout, column, column->headingState, parcel, d); x += column->width; ++i; } } /* + PrepareItem -- * Fill in a displayItem record from tag settings. */ static void PrepareItem(Treeview *tv, TreeItem *item, DisplayItem *displayItem) { const int nOptions = sizeof(*displayItem)/sizeof(Tcl_Obj*); Tcl_Obj **dest = (Tcl_Obj**)displayItem; Tcl_Obj **objv = NULL; int objc = 0; memset(displayItem, 0, sizeof(*displayItem)); if ( item->tagsObj && Tcl_ListObjGetElements(NULL, item->tagsObj, &objc, &objv) == TCL_OK) { int i, j; for (i=0; itree.tagTable, objv[i]); Tcl_Obj **tagRecord = Ttk_TagRecord(tag); if (tagRecord) { for (j=0; jtree.cellLayout; Ttk_State state = ItemState(tv, item); Ttk_Padding cellPadding = {4, 0, 4, 0}; int rowHeight = tv->tree.rowHeight; int nValues = 0; Tcl_Obj **values = 0; int i; if (!item->valuesObj) { return; } Tcl_ListObjGetElements(NULL, item->valuesObj, &nValues, &values); for (i = 0; i < tv->tree.nColumns; ++i) { tv->tree.columns[i].data = (i < nValues) ? values[i] : 0; } for (i = 1; i < tv->tree.nDisplayColumns; ++i) { TreeColumn *column = tv->tree.displayColumns[i]; Ttk_Box parcel = Ttk_PadBox( Ttk_MakeBox(b.x+x, b.y+y, column->width, rowHeight), cellPadding); displayItem->textObj = column->data; displayItem->anchorObj = column->anchorObj; DisplayLayout(layout, displayItem, state, parcel, d); x += column->width; } } /* + DrawItem -- * Draw an item (row background, tree label, and cells). */ static void DrawItem( Treeview *tv, TreeItem *item, Drawable d, Ttk_Box b, int depth, int row) { Ttk_State state = ItemState(tv, item); DisplayItem displayItem; int rowHeight = tv->tree.rowHeight; int x = depth * tv->tree.indent; int y = (row - tv->tree.yscroll.first) * tv->tree.rowHeight; if (row % 2) state |= TTK_STATE_ALTERNATE; PrepareItem(tv, item, &displayItem); /* Draw row background: */ { Ttk_Box rowBox = Ttk_MakeBox(b.x, b.y+y, TreeWidth(tv), rowHeight); DisplayLayout(tv->tree.rowLayout, &displayItem, state, rowBox, d); } /* Draw tree label: */ if (tv->tree.showFlags & SHOW_TREE) { int colwidth = tv->tree.column0.width; Ttk_Box parcel = Ttk_MakeBox(b.x + x, b.y + y, colwidth - x, rowHeight); displayItem.textObj = item->textObj; displayItem.imageObj = item->imageObj; displayItem.anchorObj = 0; DisplayLayout(tv->tree.itemLayout, &displayItem, state, parcel, d); x = colwidth; } else { x = 0; } /* Draw data cells: */ DrawCells(tv, item, &displayItem, d, b, x, y); } /* + DrawSubtree -- * Draw an item and all of its (viewable) descendants. * * Returns: * Row number of the last item drawn. */ static int DrawForest( /* forward */ Treeview *tv, TreeItem *item, Drawable d, Ttk_Box b, int depth, int row); static int DrawSubtree( Treeview *tv, TreeItem *item, Drawable d, Ttk_Box b, int depth, int row) { if (row >= tv->tree.yscroll.first) { DrawItem(tv, item, d, b, depth, row); } if (item->state & TTK_STATE_OPEN) { return DrawForest(tv, item->children, d, b, depth + 1, row + 1); } else { return row + 1; } } /* + DrawForest -- * Draw a sequence of items and their visible descendants. * * Returns: * Row number of the last item drawn. */ static int DrawForest( Treeview *tv, TreeItem *item, Drawable d, Ttk_Box b, int depth, int row) { while (item && row <= tv->tree.yscroll.last) { row = DrawSubtree(tv, item, d, b, depth, row); item = item->next; } return row; } /* + TreeviewDisplay -- * Display() widget hook. Draw the widget contents. */ static void TreeviewDisplay(void *clientData, Drawable d) { Treeview *tv = clientData; Ttk_DrawLayout(tv->core.layout, tv->core.state, d); if (tv->tree.showFlags & SHOW_HEADINGS) { DrawHeadings(tv, d, tv->tree.headingArea); } DrawForest(tv, tv->tree.root->children, d, tv->tree.treeArea, 0,0); } /*------------------------------------------------------------------------ * +++ Utilities for widget commands */ /* + InsertPosition -- * Locate the previous sibling for [$tree insert]. * * Returns a pointer to the item just before the specified index, * or 0 if the item is to be inserted at the beginning. */ static TreeItem *InsertPosition(TreeItem *parent, int index) { TreeItem *prev = 0, *next = parent->children; while (next != 0 && index > 0) { --index; prev = next; next = prev->next; } return prev; } /* + EndPosition -- * Locate the last child of the specified node. */ static TreeItem *EndPosition(TreeItem *parent) { TreeItem *sibling = parent->children; if (sibling) { while (sibling->next) { sibling = sibling->next; } } return sibling; } /* + AncestryCheck -- * Verify that specified item is not an ancestor of the specified parent; * returns 1 if OK, 0 and leaves an error message in interp otherwise. */ static int AncestryCheck( Tcl_Interp *interp, Treeview *tv, TreeItem *item, TreeItem *parent) { TreeItem *p = parent; while (p) { if (p == item) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Cannot insert ", ItemName(tv, item), " as a descendant of ", ItemName(tv, parent), NULL); return 0; } p = p->parent; } return 1; } /* + DeleteItems -- * Remove an item and all of its descendants from the hash table * and detach them from the tree; returns a linked list (chained * along the ->next pointer) of deleted items. */ static TreeItem *DeleteItems(TreeItem *item, TreeItem *delq) { if (item->entryPtr) { DetachItem(item); while (item->children) { delq = DeleteItems(item->children, delq); } Tcl_DeleteHashEntry(item->entryPtr); item->entryPtr = 0; item->next = delq; delq = item; } /* else -- item has already been unlinked */ return delq; } /* + RowNumber -- * Calculate which row the specified item appears on; * returns -1 if the item is not viewable. * Xref: DrawForest, IdentifyItem. */ static int RowNumber(Treeview *tv, TreeItem *item) { TreeItem *p = tv->tree.root->children; int n = 0; while (p) { if (p == item) return n; ++n; /* Find next viewable item in preorder traversal order */ if (p->children && (p->state & TTK_STATE_OPEN)) { p = p->children; } else { while (!p->next && p && p->parent) p = p->parent; if (p) p = p->next; } } return -1; } /* + ItemDepth -- return the depth of a tree item. * The depth of an item is equal to the number of proper ancestors, * not counting the root node. */ static int ItemDepth(TreeItem *item) { int depth = 0; while (item->parent) { ++depth; item = item->parent; } return depth-1; } /*------------------------------------------------------------------------ * +++ Widget commands -- item inquiry. */ /* + $tv children $item ?newchildren? -- * Return the list of children associated with $item */ static int TreeviewChildrenCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item; Tcl_Obj *result; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "item ?newchildren?"); return TCL_ERROR; } item = FindItem(interp, tv, objv[2]); if (!item) { return TCL_ERROR; } if (objc == 3) { result = Tcl_NewListObj(0,0); for (item = item->children; item; item = item->next) { Tcl_ListObjAppendElement(interp, result, ItemID(tv, item)); } Tcl_SetObjResult(interp, result); } else { TreeItem **newChildren = GetItemListFromObj(interp, tv, objv[3]); TreeItem *child; int i; if (!newChildren) return TCL_ERROR; /* Sanity-check: */ for (i=0; newChildren[i]; ++i) { if (!AncestryCheck(interp, tv, newChildren[i], item)) { ckfree((ClientData)newChildren); return TCL_ERROR; } } /* Detach old children: */ child = item->children; while (child) { TreeItem *next = child->next; DetachItem(child); child = next; } /* Detach new children from their current locations: */ for (i=0; newChildren[i]; ++i) { DetachItem(newChildren[i]); } /* Reinsert new children: * Note: it is not an error for an item to be listed more than once, * though it probably should be... */ child = 0; for (i=0; newChildren[i]; ++i) { if (newChildren[i]->parent) { /* This is a duplicate element which has already been * inserted. Ignore it. */ continue; } InsertItem(item, child, newChildren[i]); child = newChildren[i]; } ckfree((ClientData)newChildren); TtkRedisplayWidget(&tv->core); } return TCL_OK; } /* + $tv parent $item -- * Return the item ID of $item's parent. */ static int TreeviewParentCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; } item = FindItem(interp, tv, objv[2]); if (!item) { return TCL_ERROR; } if (item->parent) { Tcl_SetObjResult(interp, ItemID(tv, item->parent)); } else { /* This is the root item. @@@ Return an error? */ Tcl_ResetResult(interp); } return TCL_OK; } /* + $tv next $item * Return the ID of $item's next sibling. */ static int TreeviewNextCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; } item = FindItem(interp, tv, objv[2]); if (!item) { return TCL_ERROR; } if (item->next) { Tcl_SetObjResult(interp, ItemID(tv, item->next)); } /* else -- leave interp-result empty */ return TCL_OK; } /* + $tv prev $item * Return the ID of $item's previous sibling. */ static int TreeviewPrevCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; } item = FindItem(interp, tv, objv[2]); if (!item) { return TCL_ERROR; } if (item->prev) { Tcl_SetObjResult(interp, ItemID(tv, item->prev)); } /* else -- leave interp-result empty */ return TCL_OK; } /* + $tv index $item -- * Return the index of $item within its parent. */ static int TreeviewIndexCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item; int index = 0; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; } item = FindItem(interp, tv, objv[2]); if (!item) { return TCL_ERROR; } while (item->prev) { ++index; item = item->prev; } Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); return TCL_OK; } /* + $tv exists $itemid -- * Test if the specified item id is present in the tree. */ static int TreeviewExistsCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; Tcl_HashEntry *entryPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "itemid"); return TCL_ERROR; } entryPtr = Tcl_FindHashEntry(&tv->tree.items, Tcl_GetString(objv[2])); Tcl_SetObjResult(interp, Tcl_NewBooleanObj(entryPtr != 0)); return TCL_OK; } /* + $tv bbox $itemid ?$column? -- * Return bounding box [x y width height] of specified item. */ static int TreeviewBBoxCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item = 0; TreeColumn *column = 0; int row; Ttk_Box bbox; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "itemid ?column"); return TCL_ERROR; } item = FindItem(interp, tv, objv[2]); if (!item) { return TCL_ERROR; } if (objc >=4 && (column = FindColumn(interp,tv,objv[3])) == NULL) { return TCL_ERROR; } /* Compute bounding box of item: */ row = ItemRow(tv, item); if (row < tv->tree.yscroll.first || row > tv->tree.yscroll.last) { /* not viewable, or off-screen */ return TCL_OK; } bbox = tv->tree.treeArea; bbox.y += (row - tv->tree.yscroll.first) * tv->tree.rowHeight; bbox.height = tv->tree.rowHeight; /* If column has been specified, compute bounding box of cell */ if (column) { int xpos = 0, i = FirstColumn(tv); while (i < tv->tree.nDisplayColumns) { if (tv->tree.displayColumns[i] == column) { break; } xpos += tv->tree.displayColumns[i]->width; ++i; } if (i == tv->tree.nDisplayColumns) { /* specified column unviewable */ return TCL_OK; } bbox.x += xpos; bbox.width = column->width; /* Special case for tree column -- account for indentation: * (@@@ NOTE: doesn't account for tree indicator or image; * @@@ this may or may not be the right thing.) */ if (column == &tv->tree.column0) { int indent = tv->tree.indent * ItemDepth(item); bbox.x += indent; bbox.width -= indent; } } Tcl_SetObjResult(interp, Ttk_NewBoxObj(bbox)); return TCL_OK; } /* + $tv identify $x $y -- (obsolescent) * Implements the old, horrible, 2-argument form of [$tv identify]. * * Returns: one of * heading #n * cell itemid #n * item itemid element * row itemid */ static int TreeviewHorribleIdentify( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Treeview *tv) { const char *what = "nothing", *detail = NULL; TreeItem *item = 0; Tcl_Obj *result; int dColumnNumber; char dcolbuf[16]; int x, y, x1; /* ASSERT: objc == 4 */ if ( Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK ) { return TCL_ERROR; } dColumnNumber = IdentifyDisplayColumn(tv, x, &x1); if (dColumnNumber < 0) { goto done; } sprintf(dcolbuf, "#%d", dColumnNumber); if (Ttk_BoxContains(tv->tree.headingArea,x,y)) { if (-HALO <= x1 - x && x1 - x <= HALO) { what = "separator"; } else { what = "heading"; } detail = dcolbuf; } else if (Ttk_BoxContains(tv->tree.treeArea,x,y)) { Ttk_Box itemBox; item = IdentifyItem(tv, y, &itemBox); if (item && dColumnNumber > 0) { what = "cell"; detail = dcolbuf; } else if (item) { Ttk_Layout layout = tv->tree.itemLayout; DisplayItem displayItem; Ttk_LayoutNode *element; PrepareItem(tv, item, &displayItem); /*@@@ FIX: -text, etc*/ Ttk_RebindSublayout(layout, &displayItem); Ttk_PlaceLayout(layout, ItemState(tv,item), itemBox); element = Ttk_LayoutIdentify(layout, x, y); if (element) { what = "item"; detail = Ttk_LayoutNodeName(element); } else { what = "row"; } } } done: result = Tcl_NewListObj(0,0); Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(what, -1)); if (item) Tcl_ListObjAppendElement(NULL, result, ItemID(tv, item)); if (detail) Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(detail, -1)); Tcl_SetObjResult(interp, result); return TCL_OK; } /* + $tv identify $component $x $y -- * Identify the component at position x,y. */ static int TreeviewIdentifyCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { static const char *componentStrings[] = { "row", "column", NULL }; enum { I_ROW, I_COLUMN }; Treeview *tv = recordPtr; int component, x, y; if (objc == 4) { /* Old form */ return TreeviewHorribleIdentify(interp, objc, objv, tv); } else if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "component x y"); return TCL_ERROR; } if ( Tcl_GetIndexFromObj(interp, objv[2], componentStrings, "component", TCL_EXACT, &component) != TCL_OK || Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK ) { return TCL_ERROR; } switch (component) { case I_ROW : { Ttk_Box itemBox; TreeItem *item = IdentifyItem(tv, y, &itemBox); if (item) { Tcl_SetObjResult(interp, ItemID(tv, item)); } break; } case I_COLUMN : { int x1; int column = IdentifyDisplayColumn(tv, x, &x1); if (column >= 0) { char dcolbuf[16]; sprintf(dcolbuf, "#%d", column); Tcl_SetObjResult(interp, Tcl_NewStringObj(dcolbuf, -1)); } break; } } return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- item and column configuration. */ /* + $tv item $item ?options ....? * Query or configure item options. */ static int TreeviewItemCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "item ?option ?value??..."); return TCL_ERROR; } if (!(item = FindItem(interp, tv, objv[2]))) { return TCL_ERROR; } if (objc == 3) { return TtkEnumerateOptions(interp, item, ItemOptionSpecs, tv->tree.itemOptionTable, tv->core.tkwin); } else if (objc == 4) { return TtkGetOptionValue(interp, item, objv[3], tv->tree.itemOptionTable, tv->core.tkwin); } else { return ConfigureItem(interp, tv, item, objc-3, objv+3); } } /* + $tv column column ?options ....? * Column data accessor */ static int TreeviewColumnCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeColumn *column; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "column -option value..."); return TCL_ERROR; } if (!(column = FindColumn(interp, tv, objv[2]))) { return TCL_ERROR; } if (objc == 3) { return TtkEnumerateOptions(interp, column, ColumnOptionSpecs, tv->tree.columnOptionTable, tv->core.tkwin); } else if (objc == 4) { return TtkGetOptionValue(interp, column, objv[3], tv->tree.columnOptionTable, tv->core.tkwin); } else { return ConfigureColumn(interp, tv, column, objc-3, objv+3); } } /* + $tv heading column ?options ....? * Heading data accessor */ static int TreeviewHeadingCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; Tk_OptionTable optionTable = tv->tree.headingOptionTable; Tk_Window tkwin = tv->core.tkwin; TreeColumn *column; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "column -option value..."); return TCL_ERROR; } if (!(column = FindColumn(interp, tv, objv[2]))) { return TCL_ERROR; } if (objc == 3) { return TtkEnumerateOptions( interp, column, HeadingOptionSpecs, optionTable, tkwin); } else if (objc == 4) { return TtkGetOptionValue( interp, column, objv[3], optionTable, tkwin); } else { return ConfigureHeading(interp, tv, column, objc-3,objv+3); } } /* + $tv set $item ?$column ?value?? * Query or configure cell values */ static int TreeviewSetCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item; TreeColumn *column; int columnNumber; if (objc < 3 || objc > 5) { Tcl_WrongNumArgs(interp, 2, objv, "item ?column ?value??"); return TCL_ERROR; } if (!(item = FindItem(interp, tv, objv[2]))) return TCL_ERROR; /* Make sure -values exists: */ if (!item->valuesObj) { item->valuesObj = Tcl_NewListObj(0,0); Tcl_IncrRefCount(item->valuesObj); } if (objc == 3) { /* Return dictionary: */ Tcl_Obj *result = Tcl_NewListObj(0,0); Tcl_Obj *value; for (columnNumber=0; columnNumbertree.nColumns; ++columnNumber) { Tcl_ListObjIndex(interp, item->valuesObj, columnNumber, &value); if (value) { Tcl_ListObjAppendElement(interp, result, tv->tree.columns[columnNumber].idObj); Tcl_ListObjAppendElement(interp, result, value); } } Tcl_SetObjResult(interp, result); return TCL_OK; } /* else -- get or set column */ if (!(column = FindColumn(interp, tv, objv[3]))) return TCL_ERROR; if (column == &tv->tree.column0) { /* @@@ Maybe set -text here instead? */ Tcl_AppendResult(interp, "Display column #0 cannot be set", NULL); return TCL_ERROR; } /* Note: we don't do any error checking in the list operations, * since item->valuesObj is guaranteed to be a list. */ columnNumber = column - tv->tree.columns; if (objc == 4) { /* get column */ Tcl_Obj *result = 0; Tcl_ListObjIndex(interp, item->valuesObj, columnNumber, &result); if (!result) { result = Tcl_NewStringObj("",0); } Tcl_SetObjResult(interp, result); return TCL_OK; } else { /* set column */ int length; item->valuesObj = unshare(item->valuesObj); /* Make sure -values is fully populated: */ Tcl_ListObjLength(interp, item->valuesObj, &length); while (length < tv->tree.nColumns) { Tcl_Obj *empty = Tcl_NewStringObj("",0); Tcl_ListObjAppendElement(interp, item->valuesObj, empty); ++length; } /* Set value: */ Tcl_ListObjReplace(interp,item->valuesObj,columnNumber,1,1,objv+4); TtkRedisplayWidget(&tv->core); return TCL_OK; } } /*------------------------------------------------------------------------ * +++ Widget commands -- tree modification. */ /* + $tv insert $parent $index ?-id id? ?-option value...? * Insert a new item. */ static int TreeviewInsertCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *parent, *sibling, *newItem; Tcl_HashEntry *entryPtr; int isNew; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "parent index ?-id id? -options..."); return TCL_ERROR; } /* Get parent node: */ if ((parent = FindItem(interp, tv, objv[2])) == NULL) { return TCL_ERROR; } /* Locate previous sibling based on $index: */ if (!strcmp(Tcl_GetString(objv[3]), "end")) { sibling = EndPosition(parent); } else { int index; if (Tcl_GetIntFromObj(interp, objv[3], &index) != TCL_OK) return TCL_ERROR; sibling = InsertPosition(parent, index); } /* Get node name: * If -id supplied and does not already exist, use that; * Otherwise autogenerate new one. */ objc -= 4; objv += 4; if (objc >= 2 && !strcmp("-id", Tcl_GetString(objv[0]))) { const char *itemName = Tcl_GetString(objv[1]); entryPtr = Tcl_CreateHashEntry(&tv->tree.items, itemName, &isNew); if (!isNew) { Tcl_AppendResult(interp, "Item ",itemName," already exists",NULL); return TCL_ERROR; } objc -= 2; objv += 2; } else { char idbuf[16]; do { ++tv->tree.serial; sprintf(idbuf, "I%03X", tv->tree.serial); entryPtr = Tcl_CreateHashEntry(&tv->tree.items, idbuf, &isNew); } while (!isNew); } /* Create and configure new item: */ newItem = NewItem(); Tk_InitOptions( interp, (ClientData)newItem, tv->tree.itemOptionTable, tv->core.tkwin); if (ConfigureItem(interp, tv, newItem, objc, objv) != TCL_OK) { Tcl_DeleteHashEntry(entryPtr); FreeItem(newItem); return TCL_ERROR; } /* Store in hash table, link into tree: */ Tcl_SetHashValue(entryPtr, newItem); newItem->entryPtr = entryPtr; InsertItem(parent, sibling, newItem); TtkRedisplayWidget(&tv->core); Tcl_SetObjResult(interp, ItemID(tv, newItem)); return TCL_OK; } /* + $tv detach $item -- * Unlink $item from the tree. */ static int TreeviewDetachCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem **items; int i; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; } if (!(items = GetItemListFromObj(interp, tv, objv[2]))) { return TCL_ERROR; } /* Sanity-check */ for (i = 0; items[i]; ++i) { if (items[i] == tv->tree.root) { Tcl_AppendResult(interp, "Cannot detach root item", NULL); ckfree((ClientData)items); return TCL_ERROR; } } for (i = 0; items[i]; ++i) { DetachItem(items[i]); } TtkRedisplayWidget(&tv->core); ckfree((ClientData)items); return TCL_OK; } /* + $tv delete $items -- * Delete each item in $items. * * Do this in two passes: * First detach the item and all its descendants and remove them * from the hash table. Free the items themselves in a second pass. * * It's done this way because an item may appear more than once * in the list of items to delete (either directly or as a descendant * of a previously deleted item.) */ static int TreeviewDeleteCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem **items, *delq; int i; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "items"); return TCL_ERROR; } if (!(items = GetItemListFromObj(interp, tv, objv[2]))) { return TCL_ERROR; } /* Sanity-check: */ for (i=0; items[i]; ++i) { if (items[i] == tv->tree.root) { ckfree((ClientData)items); Tcl_AppendResult(interp, "Cannot delete root item", NULL); return TCL_ERROR; } } /* Remove items from hash table. */ delq = 0; for (i=0; items[i]; ++i) { delq = DeleteItems(items[i], delq); } /* Free items: */ while (delq) { TreeItem *next = delq->next; if (tv->tree.focus == delq) tv->tree.focus = 0; FreeItem(delq); delq = next; } ckfree((ClientData)items); TtkRedisplayWidget(&tv->core); return TCL_OK; } /* + $tv move $item $parent $index * Move $item to the specified $index in $parent's child list. */ static int TreeviewMoveCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item, *parent; TreeItem *sibling; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "item parent index"); return TCL_ERROR; } if ( (item = FindItem(interp, tv, objv[2])) == 0 || (parent = FindItem(interp, tv, objv[3])) == 0) { return TCL_ERROR; } /* Locate previous sibling based on $index: */ if (!strcmp(Tcl_GetString(objv[4]), "end")) { sibling = EndPosition(parent); } else { TreeItem *p; int index; if (Tcl_GetIntFromObj(interp, objv[4], &index) != TCL_OK) { return TCL_ERROR; } sibling = 0; for (p = parent->children; p != NULL && index > 0; p = p->next) { if (p != item) { --index; } /* else -- moving node forward, count index+1 nodes */ sibling = p; } } /* Check ancestry: */ if (!AncestryCheck(interp, tv, item, parent)) { return TCL_ERROR; } /* Moving an item after itself is a no-op: */ if (item == sibling) { return TCL_OK; } /* Move item: */ DetachItem(item); InsertItem(parent, sibling, item); TtkRedisplayWidget(&tv->core); return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- scrolling */ static int TreeviewXViewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; return TtkScrollviewCommand(interp, objc, objv, tv->tree.xscrollHandle); } static int TreeviewYViewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; return TtkScrollviewCommand(interp, objc, objv, tv->tree.yscrollHandle); } /* $tree see $item -- * Ensure that $item is visible. */ static int TreeviewSeeCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; TreeItem *item, *parent; int rowNumber; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; } if (!(item = FindItem(interp, tv, objv[2]))) { return TCL_ERROR; } /* Make sure all ancestors are open: */ for (parent = item->parent; parent; parent = parent->parent) { if (!(parent->state & TTK_STATE_OPEN)) { parent->openObj = unshare(parent->openObj); Tcl_SetBooleanObj(parent->openObj, 1); parent->state |= TTK_STATE_OPEN; } } /* Make sure item is visible: * @@@ DOUBLE-CHECK THIS: */ rowNumber = RowNumber(tv, item); if (rowNumber < tv->tree.yscroll.first) { TtkScrollTo(tv->tree.yscrollHandle, rowNumber); } else if (rowNumber >= tv->tree.yscroll.last) { TtkScrollTo(tv->tree.yscrollHandle, tv->tree.yscroll.first + (1+rowNumber - tv->tree.yscroll.last)); } return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- interactive column resize */ /* + $tree drag $column $newX -- * Set right edge of display column $column to x position $X */ static int TreeviewDragCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; int left = tv->tree.treeArea.x; int i = FirstColumn(tv); TreeColumn *column; int newx; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "column xposition"); return TCL_ERROR; } if ( (column = FindColumn(interp, tv, objv[2])) == 0 || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK) { return TCL_ERROR; } for (;i < tv->tree.nDisplayColumns; ++i) { TreeColumn *c = tv->tree.displayColumns[i]; int right = left + c->width; if (c == column) { DragColumn(tv, i, newx - right); assert(SLACKINVARIANT(tv)); TtkRedisplayWidget(&tv->core); return TCL_OK; } left = right; } Tcl_ResetResult(interp); Tcl_AppendResult(interp, "column ", Tcl_GetString(objv[2]), " is not displayed", NULL); return TCL_ERROR; } /*------------------------------------------------------------------------ * +++ Widget commands -- focus and selection */ /* + $tree focus ?item? */ static int TreeviewFocusCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; if (objc == 2) { if (tv->tree.focus) { Tcl_SetObjResult(interp, ItemID(tv, tv->tree.focus)); } return TCL_OK; } else if (objc == 3) { TreeItem *newFocus = FindItem(interp, tv, objv[2]); if (!newFocus) return TCL_ERROR; tv->tree.focus = newFocus; TtkRedisplayWidget(&tv->core); return TCL_OK; } else { Tcl_WrongNumArgs(interp, 2, objv, "?newFocus?"); return TCL_ERROR; } } /* + $tree selection ?add|remove|set|toggle $items? */ static int TreeviewSelectionCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { enum { SELECTION_SET, SELECTION_ADD, SELECTION_REMOVE, SELECTION_TOGGLE }; static const char *selopStrings[] = { "set", "add", "remove", "toggle", NULL }; Treeview *tv = recordPtr; int selop, i; TreeItem *item, **items; if (objc == 2) { Tcl_Obj *result = Tcl_NewListObj(0,0); for (item = tv->tree.root->children; item; item=NextPreorder(item)) { if (item->state & TTK_STATE_SELECTED) Tcl_ListObjAppendElement(NULL, result, ItemID(tv, item)); } Tcl_SetObjResult(interp, result); return TCL_OK; } if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "?add|remove|set|toggle items?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[2], selopStrings, "selection operation", 0, &selop) != TCL_OK) { return TCL_ERROR; } items = GetItemListFromObj(interp, tv, objv[3]); if (!items) { return TCL_ERROR; } switch (selop) { case SELECTION_SET: for (item=tv->tree.root; item; item=NextPreorder(item)) { item->state &= ~TTK_STATE_SELECTED; } /*FALLTHRU*/ case SELECTION_ADD: for (i=0; items[i]; ++i) { items[i]->state |= TTK_STATE_SELECTED; } break; case SELECTION_REMOVE: for (i=0; items[i]; ++i) { items[i]->state &= ~TTK_STATE_SELECTED; } break; case SELECTION_TOGGLE: for (i=0; items[i]; ++i) { items[i]->state ^= TTK_STATE_SELECTED; } break; } ckfree((ClientData)items); TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect"); TtkRedisplayWidget(&tv->core); return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- tags and bindings. */ /* + $tv tag bind $tag ?$sequence ?$script?? */ static int TreeviewTagBindCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; Ttk_Tag tag; if (objc < 4 || objc > 6) { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?sequence? ?script?"); return TCL_ERROR; } tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); if (!tag) { return TCL_ERROR; } if (objc == 4) { /* $tv tag bind $tag */ Tk_GetAllBindings(interp, tv->tree.bindingTable, tag); } else if (objc == 5) { /* $tv tag bind $tag $sequence */ /* TODO: distinguish "no such binding" (OK) from "bad pattern" (ERROR) */ const char *script = Tk_GetBinding(interp, tv->tree.bindingTable, tag, Tcl_GetString(objv[4])); if (script != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(script,-1)); } } else if (objc == 6) { /* $tv tag bind $tag $sequence $script */ CONST char *sequence = Tcl_GetString(objv[4]); CONST char *script = Tcl_GetString(objv[5]); unsigned long mask = Tk_CreateBinding(interp, tv->tree.bindingTable, tag, sequence, script, 0); /* Test mask to make sure event is supported: */ if (mask & (~TreeviewBindEventMask)) { Tk_DeleteBinding(interp, tv->tree.bindingTable, tag, sequence); Tcl_ResetResult(interp); Tcl_AppendResult(interp, "unsupported event ", sequence, "\nonly key, button, motion, and virtual events supported", NULL); return TCL_ERROR; } return mask ? TCL_OK : TCL_ERROR; } return TCL_OK; } /* + $tv tag configure $tag ?-option ?value -option value...?? */ static int TreeviewTagConfigureCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; void *tagRecord; Ttk_Tag tag; if (objc < 4) { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?-option ?value ...??"); return TCL_ERROR; } tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); tagRecord = Ttk_TagRecord(tag); if (objc == 4) { return TtkEnumerateOptions(interp, tagRecord, TagOptionSpecs, tv->tree.tagOptionTable, tv->core.tkwin); } else if (objc == 5) { return TtkGetOptionValue(interp, tagRecord, objv[4], tv->tree.tagOptionTable, tv->core.tkwin); } /* else */ TtkRedisplayWidget(&tv->core); return Tk_SetOptions( interp, tagRecord, tv->tree.tagOptionTable, objc - 4, objv + 4, tv->core.tkwin, NULL/*savedOptions*/, NULL/*mask*/); } /* + $tv tag option args... */ static int TreeviewTagCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { static WidgetCommandSpec TreeviewTagCommands[] = { { "bind", TreeviewTagBindCommand }, { "configure", TreeviewTagConfigureCommand }, {0,0} }; return TtkWidgetEnsembleCommand( TreeviewTagCommands, 2, interp, objc, objv, recordPtr); } /*------------------------------------------------------------------------ * +++ Widget commands record. */ static WidgetCommandSpec TreeviewCommands[] = { { "bbox", TreeviewBBoxCommand }, { "children", TreeviewChildrenCommand }, { "cget", TtkWidgetCgetCommand }, { "column", TreeviewColumnCommand }, { "configure", TtkWidgetConfigureCommand }, { "delete", TreeviewDeleteCommand }, { "detach", TreeviewDetachCommand }, { "drag", TreeviewDragCommand }, { "exists", TreeviewExistsCommand }, { "focus", TreeviewFocusCommand }, { "heading", TreeviewHeadingCommand }, { "identify", TreeviewIdentifyCommand }, { "index", TreeviewIndexCommand }, { "instate", TtkWidgetInstateCommand }, { "insert", TreeviewInsertCommand }, { "item", TreeviewItemCommand }, { "move", TreeviewMoveCommand }, { "next", TreeviewNextCommand }, { "parent", TreeviewParentCommand }, { "prev", TreeviewPrevCommand }, { "see", TreeviewSeeCommand }, { "selection" , TreeviewSelectionCommand }, { "set", TreeviewSetCommand }, { "state", TtkWidgetStateCommand }, { "tag", TreeviewTagCommand }, { "xview", TreeviewXViewCommand }, { "yview", TreeviewYViewCommand }, { NULL, NULL } }; /*------------------------------------------------------------------------ * +++ Widget definition. */ static WidgetSpec TreeviewWidgetSpec = { "Treeview", /* className */ sizeof(Treeview), /* recordSize */ TreeviewOptionSpecs, /* optionSpecs */ TreeviewCommands, /* subcommands */ TreeviewInitialize, /* initializeProc */ TreeviewCleanup, /* cleanupProc */ TreeviewConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ TreeviewGetLayout, /* getLayoutProc */ TreeviewSize, /* sizeProc */ TreeviewDoLayout, /* layoutProc */ TreeviewDisplay /* displayProc */ }; /*------------------------------------------------------------------------ * +++ Layout specifications. */ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("Treeview", TTK_GROUP("Treeview.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Treeview.padding", TTK_FILL_BOTH, TTK_NODE("Treeview.treearea", TTK_FILL_BOTH)))) TTK_LAYOUT("Item", TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT) TTK_NODE("Treeitem.image", TTK_PACK_LEFT) TTK_GROUP("Treeitem.focus", TTK_PACK_LEFT, TTK_NODE("Treeitem.text", TTK_PACK_LEFT)))) TTK_LAYOUT("Cell", TTK_GROUP("Treedata.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.text", TTK_FILL_BOTH))) TTK_LAYOUT("Heading", TTK_NODE("Treeheading.cell", TTK_FILL_BOTH) TTK_GROUP("Treeheading.border", TTK_FILL_BOTH, TTK_GROUP("Treeheading.padding", TTK_FILL_BOTH, TTK_NODE("Treeheading.image", TTK_PACK_RIGHT) TTK_NODE("Treeheading.text", TTK_FILL_X)))) TTK_LAYOUT("Row", TTK_NODE("Treeitem.row", TTK_FILL_BOTH)) TTK_END_LAYOUT_TABLE /*------------------------------------------------------------------------ * +++ Tree indicator element. */ typedef struct { Tcl_Obj *colorObj; Tcl_Obj *sizeObj; Tcl_Obj *marginsObj; } TreeitemIndicator; static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, Tk_Offset(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, { "-indicatorsize", TK_OPTION_PIXELS, Tk_Offset(TreeitemIndicator,sizeObj), "12" }, { "-indicatormargins", TK_OPTION_STRING, Tk_Offset(TreeitemIndicator,marginsObj), "2 2 4 2" }, {NULL} }; static void TreeitemIndicatorSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TreeitemIndicator *indicator = elementRecord; Ttk_Padding margins; int size = 0; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginsObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); *widthPtr = size + Ttk_PaddingWidth(margins); *heightPtr = size + Ttk_PaddingHeight(margins); } static void TreeitemIndicatorDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TreeitemIndicator *indicator = elementRecord; ArrowDirection direction = (state & TTK_STATE_OPEN) ? ARROW_DOWN : ARROW_RIGHT; Ttk_Padding margins; XColor *borderColor = Tk_GetColorFromObj(tkwin, indicator->colorObj); XGCValues gcvalues; GC gc; unsigned mask; if (state & TTK_STATE_LEAF) /* don't draw anything */ return; Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginsObj,&margins); b = Ttk_PadBox(b, margins); gcvalues.foreground = borderColor->pixel; gcvalues.line_width = 1; mask = GCForeground | GCLineWidth; gc = Tk_GetGC(tkwin, mask, &gcvalues); TtkDrawArrow(Tk_Display(tkwin), d, gc, b, direction); Tk_FreeGC(Tk_Display(tkwin), gc); } static Ttk_ElementSpec TreeitemIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(TreeitemIndicator), TreeitemIndicatorOptions, TreeitemIndicatorSize, TreeitemIndicatorDraw }; /*------------------------------------------------------------------------ * +++ Row element. */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *rowNumberObj; } RowElement; static Ttk_ElementOptionSpec RowElementOptions[] = { { "-background", TK_OPTION_COLOR, Tk_Offset(RowElement,backgroundObj), DEFAULT_BACKGROUND }, { "-rownumber", TK_OPTION_INT, Tk_Offset(RowElement,rowNumberObj), "0" }, {NULL} }; static void RowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { RowElement *row = elementRecord; XColor *color = Tk_GetColorFromObj(tkwin, row->backgroundObj); GC gc = Tk_GCForColor(color, d); XFillRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width, b.height); } static Ttk_ElementSpec RowElementSpec = { TK_STYLE_VERSION_2, sizeof(RowElement), RowElementOptions, TtkNullElementSize, RowElementDraw }; /*------------------------------------------------------------------------ * +++ Initialisation. */ void TtkTreeview_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); RegisterWidget(interp, "ttk::treeview", &TreeviewWidgetSpec); Ttk_RegisterElement(interp, theme, "Treeitem.indicator", &TreeitemIndicatorElementSpec, 0); Ttk_RegisterElement(interp, theme, "Treeitem.row", &RowElementSpec, 0); Ttk_RegisterElement(interp, theme, "Treeheading.cell", &RowElementSpec, 0); Ttk_RegisterElement(interp, theme, "treearea", &ttkNullElementSpec, 0); Ttk_RegisterLayouts(theme, LayoutTable); } /*EOF*/ tile-0.8.2/generic/ttk.decls0000644000076500007650000000660510537054276015316 0ustar joejoe00000000000000# # ttk.decls,v 1.6 2006/12/10 18:58:06 jenglish Exp # library ttk interface ttk epoch 0 scspec TTKAPI declare 0 current { Ttk_Theme Ttk_GetTheme(Tcl_Interp *interp, const char *name); } declare 1 current { Ttk_Theme Ttk_GetDefaultTheme(Tcl_Interp *interp); } declare 2 current { Ttk_Theme Ttk_GetCurrentTheme(Tcl_Interp *interp); } declare 3 current { Ttk_Theme Ttk_CreateTheme( Tcl_Interp *interp, const char *name, Ttk_Theme parent); } declare 4 current { void Ttk_RegisterCleanup( Tcl_Interp *interp, void *deleteData, Ttk_CleanupProc *cleanupProc); } declare 5 current { int Ttk_RegisterElementSpec( Ttk_Theme theme, const char *elementName, Ttk_ElementSpec *elementSpec, void *clientData); } declare 6 current { Ttk_ElementImpl Ttk_RegisterElement( Tcl_Interp *interp, Ttk_Theme theme, const char *elementName, Ttk_ElementSpec *elementSpec, void *clientData); } declare 7 current { int Ttk_RegisterElementFactory( Tcl_Interp *interp, const char *name, Ttk_ElementFactory factoryProc, void *clientData); } declare 8 current { void Ttk_RegisterLayout( Ttk_Theme theme, const char *className, Ttk_LayoutSpec layoutSpec); } # # State maps. # declare 10 current { int Ttk_GetStateSpecFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_StateSpec *spec_rtn); } declare 11 current { Tcl_Obj *Ttk_NewStateSpecObj( unsigned int onbits,unsigned int offbits); } declare 12 current { Ttk_StateMap Ttk_GetStateMapFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr); } declare 13 current { Tcl_Obj *Ttk_StateMapLookup( Tcl_Interp *interp, Ttk_StateMap map, Ttk_State state); } declare 14 current { int Ttk_StateTableLookup( Ttk_StateTable map[], Ttk_State state); } # # Low-level geometry utilities. # declare 20 current { int Ttk_GetPaddingFromObj( Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Ttk_Padding *pad_rtn); } declare 21 current { int Ttk_GetBorderFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *pad_rtn); } declare 22 current { int Ttk_GetStickyFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Sticky *sticky_rtn); } declare 23 current { Ttk_Padding Ttk_MakePadding( short l, short t, short r, short b); } declare 24 current { Ttk_Padding Ttk_UniformPadding( short borderWidth); } declare 25 current { Ttk_Padding Ttk_AddPadding(Ttk_Padding pad1, Ttk_Padding pad2); } declare 26 current { Ttk_Padding Ttk_RelievePadding( Ttk_Padding padding, int relief, int n); } declare 27 current { Ttk_Box Ttk_MakeBox(int x, int y, int width, int height); } declare 28 current { int Ttk_BoxContains(Ttk_Box box, int x, int y); } declare 29 current { Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int w, int h, Ttk_Side side); } declare 30 current { Ttk_Box Ttk_StickBox(Ttk_Box parcel, int w, int h, Ttk_Sticky sticky); } declare 31 current { Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int w, int h, Tk_Anchor anchor); } declare 32 current { Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p); } declare 33 current { Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p); } declare 34 current { Ttk_Box Ttk_PlaceBox( Ttk_Box *cavity, int w, int h, Ttk_Side side, Ttk_Sticky sticky); } declare 35 current { Tcl_Obj *Ttk_NewBoxObj(Ttk_Box box); } # # Utilities. # declare 40 current { int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); } tile-0.8.2/generic/ttkDecls.h0000644000076500007650000002555110537054276015427 0ustar joejoe00000000000000/* * ttkDecls.h,v 1.9 2006/12/10 18:58:06 jenglish Exp * * This file is (mostly) automatically generated from ttk.decls. */ #ifndef _TTKDECLS #define _TTKDECLS #if defined(USE_TTK_STUBS) extern const char *TtkInitializeStubs( Tcl_Interp *, const char *version, int epoch, int revision); #define Ttk_InitStubs(interp) TtkInitializeStubs( \ interp, TILE_VERSION, TTK_STUBS_EPOCH, TTK_STUBS_REVISION) #else #define Ttk_InitStubs(interp) Tcl_PkgRequire(interp,"tile",TILE_VERSION) #endif /* !BEGIN!: Do not edit below this line. */ #define TTK_STUBS_EPOCH 0 #define TTK_STUBS_REVISION 31 #if !defined(USE_TTK_STUBS) /* * Exported function declarations: */ /* 0 */ TTKAPI Ttk_Theme Ttk_GetTheme (Tcl_Interp * interp, const char * name); /* 1 */ TTKAPI Ttk_Theme Ttk_GetDefaultTheme (Tcl_Interp * interp); /* 2 */ TTKAPI Ttk_Theme Ttk_GetCurrentTheme (Tcl_Interp * interp); /* 3 */ TTKAPI Ttk_Theme Ttk_CreateTheme (Tcl_Interp * interp, const char * name, Ttk_Theme parent); /* 4 */ TTKAPI void Ttk_RegisterCleanup (Tcl_Interp * interp, void * deleteData, Ttk_CleanupProc * cleanupProc); /* 5 */ TTKAPI int Ttk_RegisterElementSpec (Ttk_Theme theme, const char * elementName, Ttk_ElementSpec * elementSpec, void * clientData); /* 6 */ TTKAPI Ttk_ElementImpl Ttk_RegisterElement (Tcl_Interp * interp, Ttk_Theme theme, const char * elementName, Ttk_ElementSpec * elementSpec, void * clientData); /* 7 */ TTKAPI int Ttk_RegisterElementFactory (Tcl_Interp * interp, const char * name, Ttk_ElementFactory factoryProc, void * clientData); /* 8 */ TTKAPI void Ttk_RegisterLayout (Ttk_Theme theme, const char * className, Ttk_LayoutSpec layoutSpec); /* Slot 9 is reserved */ /* 10 */ TTKAPI int Ttk_GetStateSpecFromObj (Tcl_Interp * interp, Tcl_Obj * objPtr, Ttk_StateSpec * spec_rtn); /* 11 */ TTKAPI Tcl_Obj * Ttk_NewStateSpecObj (unsigned int onbits, unsigned int offbits); /* 12 */ TTKAPI Ttk_StateMap Ttk_GetStateMapFromObj (Tcl_Interp * interp, Tcl_Obj * objPtr); /* 13 */ TTKAPI Tcl_Obj * Ttk_StateMapLookup (Tcl_Interp * interp, Ttk_StateMap map, Ttk_State state); /* 14 */ TTKAPI int Ttk_StateTableLookup (Ttk_StateTable map[], Ttk_State state); /* Slot 15 is reserved */ /* Slot 16 is reserved */ /* Slot 17 is reserved */ /* Slot 18 is reserved */ /* Slot 19 is reserved */ /* 20 */ TTKAPI int Ttk_GetPaddingFromObj (Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr, Ttk_Padding * pad_rtn); /* 21 */ TTKAPI int Ttk_GetBorderFromObj (Tcl_Interp * interp, Tcl_Obj * objPtr, Ttk_Padding * pad_rtn); /* 22 */ TTKAPI int Ttk_GetStickyFromObj (Tcl_Interp * interp, Tcl_Obj * objPtr, Ttk_Sticky * sticky_rtn); /* 23 */ TTKAPI Ttk_Padding Ttk_MakePadding (short l, short t, short r, short b); /* 24 */ TTKAPI Ttk_Padding Ttk_UniformPadding (short borderWidth); /* 25 */ TTKAPI Ttk_Padding Ttk_AddPadding (Ttk_Padding pad1, Ttk_Padding pad2); /* 26 */ TTKAPI Ttk_Padding Ttk_RelievePadding (Ttk_Padding padding, int relief, int n); /* 27 */ TTKAPI Ttk_Box Ttk_MakeBox (int x, int y, int width, int height); /* 28 */ TTKAPI int Ttk_BoxContains (Ttk_Box box, int x, int y); /* 29 */ TTKAPI Ttk_Box Ttk_PackBox (Ttk_Box * cavity, int w, int h, Ttk_Side side); /* 30 */ TTKAPI Ttk_Box Ttk_StickBox (Ttk_Box parcel, int w, int h, Ttk_Sticky sticky); /* 31 */ TTKAPI Ttk_Box Ttk_AnchorBox (Ttk_Box parcel, int w, int h, Tk_Anchor anchor); /* 32 */ TTKAPI Ttk_Box Ttk_PadBox (Ttk_Box b, Ttk_Padding p); /* 33 */ TTKAPI Ttk_Box Ttk_ExpandBox (Ttk_Box b, Ttk_Padding p); /* 34 */ TTKAPI Ttk_Box Ttk_PlaceBox (Ttk_Box * cavity, int w, int h, Ttk_Side side, Ttk_Sticky sticky); /* 35 */ TTKAPI Tcl_Obj * Ttk_NewBoxObj (Ttk_Box box); /* Slot 36 is reserved */ /* Slot 37 is reserved */ /* Slot 38 is reserved */ /* Slot 39 is reserved */ /* 40 */ TTKAPI int Ttk_GetOrientFromObj (Tcl_Interp * interp, Tcl_Obj * objPtr, int * orient); #endif /* !defined(USE_TTK_STUBS) */ typedef struct TtkStubs { int magic; int epoch; int revision; struct TtkStubHooks *hooks; Ttk_Theme (*ttk_GetTheme) (Tcl_Interp * interp, const char * name); /* 0 */ Ttk_Theme (*ttk_GetDefaultTheme) (Tcl_Interp * interp); /* 1 */ Ttk_Theme (*ttk_GetCurrentTheme) (Tcl_Interp * interp); /* 2 */ Ttk_Theme (*ttk_CreateTheme) (Tcl_Interp * interp, const char * name, Ttk_Theme parent); /* 3 */ void (*ttk_RegisterCleanup) (Tcl_Interp * interp, void * deleteData, Ttk_CleanupProc * cleanupProc); /* 4 */ int (*ttk_RegisterElementSpec) (Ttk_Theme theme, const char * elementName, Ttk_ElementSpec * elementSpec, void * clientData); /* 5 */ Ttk_ElementImpl (*ttk_RegisterElement) (Tcl_Interp * interp, Ttk_Theme theme, const char * elementName, Ttk_ElementSpec * elementSpec, void * clientData); /* 6 */ int (*ttk_RegisterElementFactory) (Tcl_Interp * interp, const char * name, Ttk_ElementFactory factoryProc, void * clientData); /* 7 */ void (*ttk_RegisterLayout) (Ttk_Theme theme, const char * className, Ttk_LayoutSpec layoutSpec); /* 8 */ void (*reserved9)(void); int (*ttk_GetStateSpecFromObj) (Tcl_Interp * interp, Tcl_Obj * objPtr, Ttk_StateSpec * spec_rtn); /* 10 */ Tcl_Obj * (*ttk_NewStateSpecObj) (unsigned int onbits, unsigned int offbits); /* 11 */ Ttk_StateMap (*ttk_GetStateMapFromObj) (Tcl_Interp * interp, Tcl_Obj * objPtr); /* 12 */ Tcl_Obj * (*ttk_StateMapLookup) (Tcl_Interp * interp, Ttk_StateMap map, Ttk_State state); /* 13 */ int (*ttk_StateTableLookup) (Ttk_StateTable map[], Ttk_State state); /* 14 */ void (*reserved15)(void); void (*reserved16)(void); void (*reserved17)(void); void (*reserved18)(void); void (*reserved19)(void); int (*ttk_GetPaddingFromObj) (Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr, Ttk_Padding * pad_rtn); /* 20 */ int (*ttk_GetBorderFromObj) (Tcl_Interp * interp, Tcl_Obj * objPtr, Ttk_Padding * pad_rtn); /* 21 */ int (*ttk_GetStickyFromObj) (Tcl_Interp * interp, Tcl_Obj * objPtr, Ttk_Sticky * sticky_rtn); /* 22 */ Ttk_Padding (*ttk_MakePadding) (short l, short t, short r, short b); /* 23 */ Ttk_Padding (*ttk_UniformPadding) (short borderWidth); /* 24 */ Ttk_Padding (*ttk_AddPadding) (Ttk_Padding pad1, Ttk_Padding pad2); /* 25 */ Ttk_Padding (*ttk_RelievePadding) (Ttk_Padding padding, int relief, int n); /* 26 */ Ttk_Box (*ttk_MakeBox) (int x, int y, int width, int height); /* 27 */ int (*ttk_BoxContains) (Ttk_Box box, int x, int y); /* 28 */ Ttk_Box (*ttk_PackBox) (Ttk_Box * cavity, int w, int h, Ttk_Side side); /* 29 */ Ttk_Box (*ttk_StickBox) (Ttk_Box parcel, int w, int h, Ttk_Sticky sticky); /* 30 */ Ttk_Box (*ttk_AnchorBox) (Ttk_Box parcel, int w, int h, Tk_Anchor anchor); /* 31 */ Ttk_Box (*ttk_PadBox) (Ttk_Box b, Ttk_Padding p); /* 32 */ Ttk_Box (*ttk_ExpandBox) (Ttk_Box b, Ttk_Padding p); /* 33 */ Ttk_Box (*ttk_PlaceBox) (Ttk_Box * cavity, int w, int h, Ttk_Side side, Ttk_Sticky sticky); /* 34 */ Tcl_Obj * (*ttk_NewBoxObj) (Ttk_Box box); /* 35 */ void (*reserved36)(void); void (*reserved37)(void); void (*reserved38)(void); void (*reserved39)(void); int (*ttk_GetOrientFromObj) (Tcl_Interp * interp, Tcl_Obj * objPtr, int * orient); /* 40 */ } TtkStubs; #ifdef __cplusplus extern "C" { #endif extern const TtkStubs *ttkStubsPtr; #ifdef __cplusplus } #endif #if defined(USE_TTK_STUBS) /* * Inline function declarations: */ #ifndef Ttk_GetTheme #define Ttk_GetTheme \ (ttkStubsPtr->ttk_GetTheme) /* 0 */ #endif #ifndef Ttk_GetDefaultTheme #define Ttk_GetDefaultTheme \ (ttkStubsPtr->ttk_GetDefaultTheme) /* 1 */ #endif #ifndef Ttk_GetCurrentTheme #define Ttk_GetCurrentTheme \ (ttkStubsPtr->ttk_GetCurrentTheme) /* 2 */ #endif #ifndef Ttk_CreateTheme #define Ttk_CreateTheme \ (ttkStubsPtr->ttk_CreateTheme) /* 3 */ #endif #ifndef Ttk_RegisterCleanup #define Ttk_RegisterCleanup \ (ttkStubsPtr->ttk_RegisterCleanup) /* 4 */ #endif #ifndef Ttk_RegisterElementSpec #define Ttk_RegisterElementSpec \ (ttkStubsPtr->ttk_RegisterElementSpec) /* 5 */ #endif #ifndef Ttk_RegisterElement #define Ttk_RegisterElement \ (ttkStubsPtr->ttk_RegisterElement) /* 6 */ #endif #ifndef Ttk_RegisterElementFactory #define Ttk_RegisterElementFactory \ (ttkStubsPtr->ttk_RegisterElementFactory) /* 7 */ #endif #ifndef Ttk_RegisterLayout #define Ttk_RegisterLayout \ (ttkStubsPtr->ttk_RegisterLayout) /* 8 */ #endif /* Slot 9 is reserved */ #ifndef Ttk_GetStateSpecFromObj #define Ttk_GetStateSpecFromObj \ (ttkStubsPtr->ttk_GetStateSpecFromObj) /* 10 */ #endif #ifndef Ttk_NewStateSpecObj #define Ttk_NewStateSpecObj \ (ttkStubsPtr->ttk_NewStateSpecObj) /* 11 */ #endif #ifndef Ttk_GetStateMapFromObj #define Ttk_GetStateMapFromObj \ (ttkStubsPtr->ttk_GetStateMapFromObj) /* 12 */ #endif #ifndef Ttk_StateMapLookup #define Ttk_StateMapLookup \ (ttkStubsPtr->ttk_StateMapLookup) /* 13 */ #endif #ifndef Ttk_StateTableLookup #define Ttk_StateTableLookup \ (ttkStubsPtr->ttk_StateTableLookup) /* 14 */ #endif /* Slot 15 is reserved */ /* Slot 16 is reserved */ /* Slot 17 is reserved */ /* Slot 18 is reserved */ /* Slot 19 is reserved */ #ifndef Ttk_GetPaddingFromObj #define Ttk_GetPaddingFromObj \ (ttkStubsPtr->ttk_GetPaddingFromObj) /* 20 */ #endif #ifndef Ttk_GetBorderFromObj #define Ttk_GetBorderFromObj \ (ttkStubsPtr->ttk_GetBorderFromObj) /* 21 */ #endif #ifndef Ttk_GetStickyFromObj #define Ttk_GetStickyFromObj \ (ttkStubsPtr->ttk_GetStickyFromObj) /* 22 */ #endif #ifndef Ttk_MakePadding #define Ttk_MakePadding \ (ttkStubsPtr->ttk_MakePadding) /* 23 */ #endif #ifndef Ttk_UniformPadding #define Ttk_UniformPadding \ (ttkStubsPtr->ttk_UniformPadding) /* 24 */ #endif #ifndef Ttk_AddPadding #define Ttk_AddPadding \ (ttkStubsPtr->ttk_AddPadding) /* 25 */ #endif #ifndef Ttk_RelievePadding #define Ttk_RelievePadding \ (ttkStubsPtr->ttk_RelievePadding) /* 26 */ #endif #ifndef Ttk_MakeBox #define Ttk_MakeBox \ (ttkStubsPtr->ttk_MakeBox) /* 27 */ #endif #ifndef Ttk_BoxContains #define Ttk_BoxContains \ (ttkStubsPtr->ttk_BoxContains) /* 28 */ #endif #ifndef Ttk_PackBox #define Ttk_PackBox \ (ttkStubsPtr->ttk_PackBox) /* 29 */ #endif #ifndef Ttk_StickBox #define Ttk_StickBox \ (ttkStubsPtr->ttk_StickBox) /* 30 */ #endif #ifndef Ttk_AnchorBox #define Ttk_AnchorBox \ (ttkStubsPtr->ttk_AnchorBox) /* 31 */ #endif #ifndef Ttk_PadBox #define Ttk_PadBox \ (ttkStubsPtr->ttk_PadBox) /* 32 */ #endif #ifndef Ttk_ExpandBox #define Ttk_ExpandBox \ (ttkStubsPtr->ttk_ExpandBox) /* 33 */ #endif #ifndef Ttk_PlaceBox #define Ttk_PlaceBox \ (ttkStubsPtr->ttk_PlaceBox) /* 34 */ #endif #ifndef Ttk_NewBoxObj #define Ttk_NewBoxObj \ (ttkStubsPtr->ttk_NewBoxObj) /* 35 */ #endif /* Slot 36 is reserved */ /* Slot 37 is reserved */ /* Slot 38 is reserved */ /* Slot 39 is reserved */ #ifndef Ttk_GetOrientFromObj #define Ttk_GetOrientFromObj \ (ttkStubsPtr->ttk_GetOrientFromObj) /* 40 */ #endif #endif /* defined(USE_TTK_STUBS) */ /* !END!: Do not edit above this line. */ #endif /* _TTKDECLS */ tile-0.8.2/generic/ttkStubInit.c0000644000076500007650000000303010474152007016104 0ustar joejoe00000000000000/* * ttkStubInit.c,v 1.4 2006/08/26 23:06:47 jenglish Exp * * This file is (mostly) automatically generated from ttk.decls. * It is compiled and linked in with the tile package proper. */ #include "tk.h" #include "tkTheme.h" /* !BEGIN!: Do not edit below this line. */ TtkStubs ttkStubs = { TCL_STUB_MAGIC, TTK_STUBS_EPOCH, TTK_STUBS_REVISION, 0, Ttk_GetTheme, /* 0 */ Ttk_GetDefaultTheme, /* 1 */ Ttk_GetCurrentTheme, /* 2 */ Ttk_CreateTheme, /* 3 */ Ttk_RegisterCleanup, /* 4 */ Ttk_RegisterElementSpec, /* 5 */ Ttk_RegisterElement, /* 6 */ Ttk_RegisterElementFactory, /* 7 */ Ttk_RegisterLayout, /* 8 */ 0, /* 9 */ Ttk_GetStateSpecFromObj, /* 10 */ Ttk_NewStateSpecObj, /* 11 */ Ttk_GetStateMapFromObj, /* 12 */ Ttk_StateMapLookup, /* 13 */ Ttk_StateTableLookup, /* 14 */ 0, /* 15 */ 0, /* 16 */ 0, /* 17 */ 0, /* 18 */ 0, /* 19 */ Ttk_GetPaddingFromObj, /* 20 */ Ttk_GetBorderFromObj, /* 21 */ Ttk_GetStickyFromObj, /* 22 */ Ttk_MakePadding, /* 23 */ Ttk_UniformPadding, /* 24 */ Ttk_AddPadding, /* 25 */ Ttk_RelievePadding, /* 26 */ Ttk_MakeBox, /* 27 */ Ttk_BoxContains, /* 28 */ Ttk_PackBox, /* 29 */ Ttk_StickBox, /* 30 */ Ttk_AnchorBox, /* 31 */ Ttk_PadBox, /* 32 */ Ttk_ExpandBox, /* 33 */ Ttk_PlaceBox, /* 34 */ Ttk_NewBoxObj, /* 35 */ 0, /* 36 */ 0, /* 37 */ 0, /* 38 */ 0, /* 39 */ Ttk_GetOrientFromObj, /* 40 */ }; /* !END!: Do not edit above this line. */ tile-0.8.2/generic/ttkStubLib.c0000644000076500007650000000311010525445711015712 0ustar joejoe00000000000000/* * ttkStubLib.c,v 1.4 2006/11/11 22:16:41 jenglish Exp * SOURCE: tk/generic/tkStubLib.c, version 1.9 2004/03/17 */ #include "tk.h" #define USE_TTK_STUBS 1 #include "tkTheme.h" const TtkStubs *ttkStubsPtr; /* *---------------------------------------------------------------------- * * TtkInitializeStubs -- * Load the tile package, initialize stub table pointer. * Do not call this function directly, use Ttk_InitStubs() macro instead. * * Results: * The actual version of the package that satisfies the request, or * NULL to indicate that an error occurred. * * Side effects: * Sets the stub table pointer. * */ const char * TtkInitializeStubs( Tcl_Interp *interp, const char *version, int epoch, int revision) { int exact = 0; const char *packageName = "tile"; const char *errMsg = NULL; ClientData pkgClientData = NULL; const char *actualVersion= Tcl_PkgRequireEx( interp, packageName, version, exact, &pkgClientData); TtkStubs *stubsPtr = pkgClientData; if (!actualVersion) { return NULL; } if (!stubsPtr) { errMsg = "missing stub table pointer"; goto error; } if (stubsPtr->epoch != epoch) { errMsg = "epoch number mismatch"; goto error; } if (stubsPtr->revision < revision) { errMsg = "require later revision"; goto error; } ttkStubsPtr = stubsPtr; return actualVersion; error: Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Error loading ", packageName, " package", " (requested version '", version, "', loaded version '", actualVersion, "'): ", errMsg, NULL); return NULL; } tile-0.8.2/generic/widget.c0000644000076500007650000005053710711643263015124 0ustar joejoe00000000000000/* widget.c,v 1.52 2007/10/30 14:58:59 jenglish Exp * Copyright (c) 2003, Joe English * * Core widget utilities. */ #include #include #include "tkTheme.h" #include "widget.h" /*------------------------------------------------------------------------ * +++ Internal helper routines. */ /* UpdateLayout -- * Call the widget's get-layout hook to recompute corePtr->layout. * Returns TCL_OK if successful, returns TCL_ERROR and leaves * the layout unchanged otherwise. */ static int UpdateLayout(Tcl_Interp *interp, WidgetCore *corePtr) { Ttk_Theme themePtr = Ttk_GetCurrentTheme(interp); Ttk_Layout newLayout = corePtr->widgetSpec->getLayoutProc(interp, themePtr,corePtr); if (newLayout) { if (corePtr->layout) { Ttk_FreeLayout(corePtr->layout); } corePtr->layout = newLayout; return TCL_OK; } return TCL_ERROR; } /* SizeChanged -- * Call the widget's sizeProc to compute new requested size * and pass it to the geometry manager. */ static void SizeChanged(WidgetCore *corePtr) { int reqWidth = 1, reqHeight = 1; if (corePtr->widgetSpec->sizeProc(corePtr,&reqWidth,&reqHeight)) { Tk_GeometryRequest(corePtr->tkwin, reqWidth, reqHeight); } } #ifndef TK_NO_DOUBLE_BUFFERING /* BeginDrawing -- * Returns a Drawable for drawing the widget contents. * This is normally an off-screen Pixmap, copied to * the window by EndDrawing(). */ static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), DefaultDepthOfScreen(Tk_Screen(tkwin))); } /* EndDrawing -- * Copy the drawable contents to the screen and release resources. */ static void EndDrawing(Tk_Window tkwin, Drawable d) { XGCValues gcValues; GC gc; gcValues.function = GXcopy; gcValues.graphics_exposures = False; gc = Tk_GetGC(tkwin, GCFunction|GCGraphicsExposures, &gcValues); XCopyArea(Tk_Display(tkwin), d, Tk_WindowId(tkwin), gc, 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0); Tk_FreePixmap(Tk_Display(tkwin), d); Tk_FreeGC(Tk_Display(tkwin), gc); } #else /* No double-buffering: draw directly into the window. */ static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); } static void EndDrawing(Tk_Window tkwin, Drawable d) { } #endif /* DrawWidget -- * Redraw a widget. Called as an idle handler. */ static void DrawWidget(ClientData recordPtr) { WidgetCore *corePtr = recordPtr; corePtr->flags &= ~REDISPLAY_PENDING; if (Tk_IsMapped(corePtr->tkwin)) { Drawable d = BeginDrawing(corePtr->tkwin); corePtr->widgetSpec->layoutProc(recordPtr); corePtr->widgetSpec->displayProc(recordPtr, d); EndDrawing(corePtr->tkwin, d); } } /* TtkRedisplayWidget -- * Schedule redisplay as an idle handler. */ void TtkRedisplayWidget(WidgetCore *corePtr) { if (corePtr->flags & WIDGET_DESTROYED) { return; } if (!(corePtr->flags & REDISPLAY_PENDING)) { Tcl_DoWhenIdle(DrawWidget, (ClientData) corePtr); corePtr->flags |= REDISPLAY_PENDING; } } /* TtkResizeWidget -- * Recompute widget size, schedule geometry propagation and redisplay. */ void TtkResizeWidget(WidgetCore *corePtr) { if (corePtr->flags & WIDGET_DESTROYED) { return; } SizeChanged(corePtr); TtkRedisplayWidget(corePtr); } /* TtkWidgetChangeState -- * Set / clear the specified bits in the 'state' flag, */ void TtkWidgetChangeState(WidgetCore *corePtr, unsigned int setBits, unsigned int clearBits) { Ttk_State oldState = corePtr->state; corePtr->state = (oldState & ~clearBits) | setBits; if (corePtr->state ^ oldState) { TtkRedisplayWidget(corePtr); } } /* TtkWidgetEnsembleCommand -- * Invoke an ensemble defined by a WidgetCommandSpec. */ int TtkWidgetEnsembleCommand( const WidgetCommandSpec *commands, /* Ensemble definition */ int cmdIndex, /* Index of command word */ Tcl_Interp *interp, /* Interpreter to use */ int objc, Tcl_Obj *const objv[], /* Argument vector */ void *clientData) /* User data (widget record pointer) */ { int index; if (objc <= cmdIndex) { Tcl_WrongNumArgs(interp, cmdIndex, objv, "option ?arg arg...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[cmdIndex], commands, sizeof(commands[0]), "command", 0, &index) != TCL_OK) { return TCL_ERROR; } return commands[index].command(interp, objc, objv, clientData); } /* * WidgetInstanceObjCmd -- * Widget instance command implementation. */ static int WidgetInstanceObjCmd( ClientData clientData, /* Widget record pointer */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { WidgetCore *corePtr = (WidgetCore *)clientData; const WidgetCommandSpec *commands = corePtr->widgetSpec->commands; int status = TCL_OK; Tcl_Preserve(clientData); status = TtkWidgetEnsembleCommand(commands,1, interp,objc,objv,clientData); Tcl_Release(clientData); return status; } /* * Command deletion callback for widget instance commands. */ static void WidgetInstanceObjCmdDeleted(ClientData clientData) { WidgetCore *corePtr = (WidgetCore *) clientData; corePtr->widgetCmd = NULL; if (corePtr->tkwin != NULL) Tk_DestroyWindow(corePtr->tkwin); } /* * WidgetCleanup -- * Final cleanup for widget. * * @@@ TODO: check all code paths leading to widget destruction, * @@@ describe here. * @@@ Call widget-specific cleanup routine at an appropriate point. */ static void WidgetCleanup(char *memPtr) { ckfree(memPtr); } /* * CoreEventProc -- * Event handler for basic events. * Processes Expose, Configure, FocusIn/Out, and Destroy events. * Also handles <> virtual events. * * For Expose and Configure, simply schedule the widget for redisplay. * For Destroy events, handle the cleanup process. * * For Focus events, set/clear the focus bit in the state field. * It turns out this is impossible to do correctly in a binding script, * because Tk filters out focus events with detail == NotifyInferior. * * For Deactivate/Activate pseudo-events, clear/set the background state flag. * * <> On the first ConfigureNotify event * (which indicates that the window has just been created), * update the layout. This is to work around two problems: * (1) Virtual events aren't delivered to unrealized widgets * (see bug #835997), so any intervening <> events * will not have been processed. * * (2) Geometry calculations in the XP theme don't work * until the widget is realized. */ static const unsigned CoreEventMask = ExposureMask | StructureNotifyMask | FocusChangeMask | VirtualEventMask | ActivateMask ; static void CoreEventProc(ClientData clientData, XEvent *eventPtr) { WidgetCore *corePtr = (WidgetCore *) clientData; switch (eventPtr->type) { case ConfigureNotify : if (!(corePtr->flags & WIDGET_REALIZED)) { /* See <> */ (void)UpdateLayout(corePtr->interp, corePtr); SizeChanged(corePtr); corePtr->flags |= WIDGET_REALIZED; } TtkRedisplayWidget(corePtr); break; case Expose : if (eventPtr->xexpose.count == 0) { TtkRedisplayWidget(corePtr); } break; case DestroyNotify : corePtr->flags |= WIDGET_DESTROYED; Tk_DeleteEventHandler(corePtr->tkwin, CoreEventMask,CoreEventProc,clientData); if (corePtr->flags & REDISPLAY_PENDING) { Tcl_CancelIdleCall(DrawWidget, clientData); } corePtr->widgetSpec->cleanupProc(corePtr); Tk_FreeConfigOptions( clientData, corePtr->optionTable, corePtr->tkwin); corePtr->tkwin = NULL; if (corePtr->layout) { Ttk_FreeLayout(corePtr->layout); } /* NB: this can reenter the interpreter via a command traces */ if (corePtr->widgetCmd) { Tcl_Command cmd = corePtr->widgetCmd; corePtr->widgetCmd = 0; Tcl_DeleteCommandFromToken(corePtr->interp, cmd); } Tcl_EventuallyFree(clientData, WidgetCleanup); break; case FocusIn: case FocusOut: /* Don't process "virtual crossing" events */ if ( eventPtr->xfocus.detail == NotifyInferior || eventPtr->xfocus.detail == NotifyAncestor || eventPtr->xfocus.detail == NotifyNonlinear) { if (eventPtr->type == FocusIn) corePtr->state |= TTK_STATE_FOCUS; else corePtr->state &= ~TTK_STATE_FOCUS; TtkRedisplayWidget(corePtr); } break; case ActivateNotify: corePtr->state &= ~TTK_STATE_BACKGROUND; TtkRedisplayWidget(corePtr); break; case DeactivateNotify: corePtr->state |= TTK_STATE_BACKGROUND; TtkRedisplayWidget(corePtr); break; case VirtualEvent: if (!strcmp("ThemeChanged", ((XVirtualEvent *)(eventPtr))->name)) { (void)UpdateLayout(corePtr->interp, corePtr); SizeChanged(corePtr); TtkRedisplayWidget(corePtr); } default: /* can't happen... */ break; } } /* * WidgetWorldChanged -- * Default Tk_ClassWorldChangedProc() for widgets. * Invoked whenever fonts or other system resources are changed; * recomputes geometry. */ static void WidgetWorldChanged(ClientData clientData) { WidgetCore *corePtr = (WidgetCore*)clientData; SizeChanged(corePtr); TtkRedisplayWidget(corePtr); } static struct Tk_ClassProcs widgetClassProcs = { sizeof(Tk_ClassProcs), WidgetWorldChanged }; /* * TtkWidgetConstructorObjCmd -- * General-purpose widget constructor command implementation. * ClientData is a WidgetSpec *. */ int TtkWidgetConstructorObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { WidgetSpec *widgetSpec = (WidgetSpec *)clientData; const char *className = widgetSpec->className; WidgetCore *corePtr; ClientData recordPtr; Tk_Window tkwin; Tk_OptionTable optionTable; int i; if (objc < 2 || objc % 1 == 1) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?"); return TCL_ERROR; } tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), Tcl_GetStringFromObj(objv[1], NULL), (char *) NULL); if (tkwin == NULL) return TCL_ERROR; /* * Check if a -class resource has been specified: * We have to do this before the InitOptions() call, * since InitOptions() is affected by the widget class. */ for (i = 2; i < objc; i += 2) { const char *resourceName = Tcl_GetString(objv[i]); if (!strcmp(resourceName, "-class")) { className = Tcl_GetString(objv[i+1]); break; } } Tk_SetClass(tkwin, className); /* * Set the BackgroundPixmap to ParentRelative here, so * subclasses don't need to worry about setting the background. */ Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative); optionTable = Tk_CreateOptionTable(interp, widgetSpec->optionSpecs); /* * Allocate and initialize the widget record. */ recordPtr = ckalloc(widgetSpec->recordSize); memset(recordPtr, 0, widgetSpec->recordSize); corePtr = (WidgetCore *)recordPtr; corePtr->tkwin = tkwin; corePtr->interp = interp; corePtr->widgetSpec = widgetSpec; corePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin), WidgetInstanceObjCmd, recordPtr, WidgetInstanceObjCmdDeleted); corePtr->optionTable = optionTable; Tk_SetClassProcs(tkwin, &widgetClassProcs, recordPtr); if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK) goto error_nocleanup; if (widgetSpec->initializeProc(interp, recordPtr) != TCL_OK) goto error_nocleanup; if (Tk_SetOptions(interp, recordPtr, optionTable, objc - 2, objv + 2, tkwin, NULL/*savePtr*/, (int *)NULL/*maskPtr*/) != TCL_OK) goto error; if (widgetSpec->configureProc(interp, recordPtr, ~0) != TCL_OK) goto error; if (widgetSpec->postConfigureProc(interp, recordPtr, ~0) != TCL_OK) goto error; if (WidgetDestroyed(corePtr)) goto error; if (UpdateLayout(interp, corePtr) != TCL_OK) goto error; SizeChanged(corePtr); Tk_CreateEventHandler(tkwin, CoreEventMask, CoreEventProc, recordPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), -1)); return TCL_OK; error: widgetSpec->cleanupProc(recordPtr); error_nocleanup: if (corePtr->layout) { Ttk_FreeLayout(corePtr->layout); corePtr->layout = 0; } Tk_FreeConfigOptions(recordPtr, optionTable, tkwin); Tk_DestroyWindow(tkwin); corePtr->tkwin = 0; Tcl_DeleteCommandFromToken(interp, corePtr->widgetCmd); ckfree(recordPtr); return TCL_ERROR; } /*------------------------------------------------------------------------ * +++ Default implementations for widget hook procedures. */ /* TtkWidgetGetLayout -- * Default getLayoutProc. * Looks up the layout based on the -style resource (if specified), * otherwise use the widget class. */ Ttk_Layout TtkWidgetGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { WidgetCore *corePtr = recordPtr; const char *styleName = 0; if (corePtr->styleObj) styleName = Tcl_GetString(corePtr->styleObj); if (!styleName || *styleName == '\0') styleName = corePtr->widgetSpec->className; return Ttk_CreateLayout(interp, themePtr, styleName, recordPtr, corePtr->optionTable, corePtr->tkwin); } /* * TtkWidgetGetOrientedLayout -- * Helper routine. Same as TtkWidgetGetLayout, but prefixes * "Horizontal." or "Vertical." to the style name, depending * on the value of the 'orient' option. */ Ttk_Layout TtkWidgetGetOrientedLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr, Tcl_Obj *orientObj) { WidgetCore *corePtr = recordPtr; const char *baseStyleName = 0; Tcl_DString styleName; int orient = TTK_ORIENT_HORIZONTAL; Ttk_Layout layout; Tcl_DStringInit(&styleName); /* Prefix: */ Ttk_GetOrientFromObj(NULL, orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) Tcl_DStringAppend(&styleName, "Horizontal.", -1); else Tcl_DStringAppend(&styleName, "Vertical.", -1); /* Add base style name: */ if (corePtr->styleObj) baseStyleName = Tcl_GetString(corePtr->styleObj); if (!baseStyleName || *baseStyleName == '\0') baseStyleName = corePtr->widgetSpec->className; Tcl_DStringAppend(&styleName, baseStyleName, -1); /* Create layout: */ layout= Ttk_CreateLayout(interp, themePtr, Tcl_DStringValue(&styleName), recordPtr, corePtr->optionTable, corePtr->tkwin); Tcl_DStringFree(&styleName); return layout; } /* TtkNullInitialize -- * Default widget initializeProc (no-op) */ int TtkNullInitialize(Tcl_Interp *interp, void *recordPtr) { return TCL_OK; } /* TtkNullPostConfigure -- * Default widget postConfigureProc (no-op) */ int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask) { return TCL_OK; } /* TtkCoreConfigure -- * Default widget configureProc. * Handles -style option. */ int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask) { WidgetCore *corePtr = clientData; int status = TCL_OK; if (mask & STYLE_CHANGED) { status = UpdateLayout(interp, corePtr); } return status; } /* TtkNullCleanup -- * Default widget cleanupProc (no-op) */ void TtkNullCleanup(void *recordPtr) { return; } /* TtkWidgetDoLayout -- * Default widget layoutProc. */ void TtkWidgetDoLayout(void *clientData) { WidgetCore *corePtr = clientData; Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); } /* TtkWidgetDisplay -- * Default widget displayProc. */ void TtkWidgetDisplay(void *recordPtr, Drawable d) { WidgetCore *corePtr = recordPtr; Ttk_DrawLayout(corePtr->layout, corePtr->state, d); } /* TtkWidgetSize -- * Default widget sizeProc() */ int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr) { WidgetCore *corePtr = recordPtr; Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr); return 1; } /*------------------------------------------------------------------------ * +++ Default implementations for widget subcommands. */ /* $w cget -option */ int TtkWidgetCgetCommand( Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Tcl_Obj *result; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } result = Tk_GetOptionValue(interp, recordPtr, corePtr->optionTable, objv[2], corePtr->tkwin); if (result == NULL) return TCL_ERROR; Tcl_SetObjResult(interp, result); return TCL_OK; } /* $w configure ?-option ?value ....?? */ int TtkWidgetConfigureCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Tcl_Obj *result; if (objc == 2) { result = Tk_GetOptionInfo(interp, recordPtr, corePtr->optionTable, (Tcl_Obj *) NULL, corePtr->tkwin); } else if (objc == 3) { result = Tk_GetOptionInfo(interp, recordPtr, corePtr->optionTable, objv[2], corePtr->tkwin); } else { Tk_SavedOptions savedOptions; int status; int mask = 0; status = Tk_SetOptions(interp, recordPtr, corePtr->optionTable, objc - 2, objv + 2, corePtr->tkwin, &savedOptions, &mask); if (status != TCL_OK) return status; if (mask & READONLY_OPTION) { Tcl_SetResult(interp, "Attempt to change read-only option", TCL_STATIC); Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } status = corePtr->widgetSpec->configureProc(interp, recordPtr, mask); if (status != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); return status; } Tk_FreeSavedOptions(&savedOptions); status = corePtr->widgetSpec->postConfigureProc(interp,recordPtr,mask); if (status != TCL_OK) { return status; } if (mask & (STYLE_CHANGED | GEOMETRY_CHANGED)) { SizeChanged(corePtr); } TtkRedisplayWidget(corePtr); result = Tcl_NewObj(); } if (result == 0) { return TCL_ERROR; } Tcl_SetObjResult(interp, result); return TCL_OK; } /* $w state ? $stateSpec ? * * If $stateSpec is specified, modify the widget state accordingly, * return a new stateSpec representing the changed bits. * * Otherwise, return a statespec matching all the currently-set bits. */ int TtkWidgetStateCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Ttk_StateSpec spec; int status; Ttk_State oldState, changed; if (objc == 2) { Tcl_SetObjResult(interp, Ttk_NewStateSpecObj(corePtr->state, 0ul)); return TCL_OK; } if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "state-spec"); return TCL_ERROR; } status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec); if (status != TCL_OK) return status; oldState = corePtr->state; corePtr->state = Ttk_ModifyState(corePtr->state, &spec); changed = corePtr->state ^ oldState; TtkRedisplayWidget(corePtr); Tcl_SetObjResult(interp, Ttk_NewStateSpecObj(oldState & changed, ~oldState & changed)); return status; } /* $w instate $stateSpec ?$script? * * Tests if widget state matches $stateSpec. * If $script is specified, execute script if state matches. * Otherwise, return true/false */ int TtkWidgetInstateCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Ttk_State state = corePtr->state; Ttk_StateSpec spec; int status = TCL_OK; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "state-spec ?script?"); return TCL_ERROR; } status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec); if (status != TCL_OK) return status; if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Ttk_StateMatches(state,&spec))); } else if (objc == 4) { if (Ttk_StateMatches(state,&spec)) { status = Tcl_EvalObjEx(interp, objv[3], 0); } } return status; } /* $w identify $x $y * Returns: name of element at $x, $y */ int TtkWidgetIdentifyCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Ttk_LayoutNode *node; int x, y; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "x y"); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) return TCL_ERROR; node = Ttk_LayoutIdentify(corePtr->layout, x, y); if (node) { const char *elementName = Ttk_LayoutNodeName(node); Tcl_SetObjResult(interp,Tcl_NewStringObj(elementName,-1)); } return TCL_OK; } /*EOF*/ tile-0.8.2/generic/widget.h0000644000076500007650000002023610724420513015115 0ustar joejoe00000000000000/* widget.h,v 1.57 2007/12/02 03:06:51 jenglish Exp * Copyright (c) 2003, Joe English * Helper routines for widget implementations. */ #ifndef _TTKWIDGET #define _TTKWIDGET /* * State flags for 'flags' field. */ #define WIDGET_DESTROYED 0x0001 #define REDISPLAY_PENDING 0x0002 /* scheduled call to RedisplayWidget */ #define WIDGET_REALIZED 0x0010 /* set at first ConfigureNotify */ #define CURSOR_ON 0x0020 /* See TtkBlinkCursor() */ #define WIDGET_USER_FLAG 0x0100 /* 0x0100 - 0x8000 for user flags */ /* * Bit fields for OptionSpec 'mask' field: */ #define READONLY_OPTION 0x1 #define STYLE_CHANGED 0x2 #define GEOMETRY_CHANGED 0x4 /* * Core widget elements */ typedef struct WidgetSpec_ WidgetSpec; /* Forward */ typedef struct { Tk_Window tkwin; /* Window associated with widget */ Tcl_Interp *interp; /* Interpreter associated with widget. */ WidgetSpec *widgetSpec; /* Widget class hooks */ Tcl_Command widgetCmd; /* Token for widget command. */ Tk_OptionTable optionTable; /* Option table */ Ttk_Layout layout; /* Widget layout */ /* * Storage for resources: */ Tcl_Obj *takeFocusPtr; /* Storage for -takefocus option */ Tcl_Obj *cursorObj; /* Storage for -cursor option */ Tcl_Obj *styleObj; /* Name of currently-applied style */ Tcl_Obj *classObj; /* Class name (readonly option) */ Ttk_State state; /* Current widget state */ unsigned int flags; /* internal flags, see above */ } WidgetCore; /* * Subcommand specifications: */ typedef int (*WidgetSubcommandProc)( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr); typedef struct { const char *name; WidgetSubcommandProc command; } WidgetCommandSpec; MODULE_SCOPE int TtkWidgetEnsembleCommand( /* Run an ensemble command */ const WidgetCommandSpec *commands, int cmdIndex, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr); /* * Widget specifications: */ struct WidgetSpec_ { const char *className; /* Widget class name */ size_t recordSize; /* #bytes in widget record */ const Tk_OptionSpec *optionSpecs; /* Option specifications */ const WidgetCommandSpec *commands; /* Widget instance subcommands */ /* * Hooks: */ int (*initializeProc)(Tcl_Interp *, void *recordPtr); void (*cleanupProc)(void *recordPtr); int (*configureProc)(Tcl_Interp *, void *recordPtr, int flags); int (*postConfigureProc)(Tcl_Interp *, void *recordPtr, int flags); Ttk_Layout (*getLayoutProc)(Tcl_Interp *,Ttk_Theme, void *recordPtr); int (*sizeProc)(void *recordPtr, int *widthPtr, int *heightPtr); void (*layoutProc)(void *recordPtr); void (*displayProc)(void *recordPtr, Drawable d); }; /* * Common factors for widget implementations: */ MODULE_SCOPE int TtkNullInitialize(Tcl_Interp *, void *); MODULE_SCOPE int TtkNullPostConfigure(Tcl_Interp *, void *, int); MODULE_SCOPE void TtkNullCleanup(void *recordPtr); MODULE_SCOPE Ttk_Layout TtkWidgetGetLayout( Tcl_Interp *, Ttk_Theme, void *recordPtr); MODULE_SCOPE Ttk_Layout TtkWidgetGetOrientedLayout( Tcl_Interp *, Ttk_Theme, void *recordPtr, Tcl_Obj *orientObj); MODULE_SCOPE int TtkWidgetSize(void *recordPtr, int *w, int *h); MODULE_SCOPE void TtkWidgetDoLayout(void *recordPtr); MODULE_SCOPE void TtkWidgetDisplay(void *recordPtr, Drawable); MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask); /* Common widget commands: */ MODULE_SCOPE int TtkWidgetConfigureCommand( Tcl_Interp *, int, Tcl_Obj*const[], void *); MODULE_SCOPE int TtkWidgetCgetCommand( Tcl_Interp *, int, Tcl_Obj*const[], void *); MODULE_SCOPE int TtkWidgetInstateCommand( Tcl_Interp *, int, Tcl_Obj*const[], void *); MODULE_SCOPE int TtkWidgetStateCommand( Tcl_Interp *, int, Tcl_Obj*const[], void *); MODULE_SCOPE int TtkWidgetIdentifyCommand( Tcl_Interp *, int, Tcl_Obj*const[], void *); /* Widget constructor: */ MODULE_SCOPE int TtkWidgetConstructorObjCmd( ClientData, Tcl_Interp*, int, Tcl_Obj*const[]); #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand(interp, name, \ TtkWidgetConstructorObjCmd, (ClientData)specPtr,NULL) /* WIDGET_TAKES_FOCUS -- * Add this to the OptionSpecs table of widgets that * take keyboard focus during traversal to override * CoreOptionSpec's -takefocus default value: */ #define WIDGET_TAKES_FOCUS \ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \ "ttk::takefocus", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 } /* WIDGET_INHERIT_OPTIONS(baseOptionSpecs) -- * Add this at the end of an OptionSpecs table to inherit * the options from 'baseOptionSpecs'. */ #define WIDGET_INHERIT_OPTIONS(baseOptionSpecs) \ {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0, (ClientData)baseOptionSpecs, 0} /* * Useful routines for use inside widget implementations: */ /* extern int WidgetDestroyed(WidgetCore *); */ #define WidgetDestroyed(corePtr) ((corePtr)->flags & WIDGET_DESTROYED) MODULE_SCOPE void TtkWidgetChangeState(WidgetCore *, unsigned int setBits, unsigned int clearBits); MODULE_SCOPE void TtkRedisplayWidget(WidgetCore *); MODULE_SCOPE void TtkResizeWidget(WidgetCore *); MODULE_SCOPE void TtkTrackElementState(WidgetCore *); MODULE_SCOPE void TtkBlinkCursor(WidgetCore *); /* * -state option values (compatibility) */ MODULE_SCOPE void TtkCheckStateOption(WidgetCore *, Tcl_Obj *); /* * Variable traces: */ typedef void (*Ttk_TraceProc)(void *recordPtr, const char *value); typedef struct TtkTraceHandle_ Ttk_TraceHandle; MODULE_SCOPE Ttk_TraceHandle *Ttk_TraceVariable( Tcl_Interp*, Tcl_Obj *varnameObj, Ttk_TraceProc callback, void *clientData); MODULE_SCOPE void Ttk_UntraceVariable(Ttk_TraceHandle *); MODULE_SCOPE int Ttk_FireTrace(Ttk_TraceHandle *); /* * Virtual events: */ MODULE_SCOPE void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName); /* * Helper routines for data accessor commands: */ MODULE_SCOPE int TtkEnumerateOptions( Tcl_Interp *, void *, const Tk_OptionSpec *, Tk_OptionTable, Tk_Window); MODULE_SCOPE int TtkGetOptionValue( Tcl_Interp *, void *, Tcl_Obj *optName, Tk_OptionTable, Tk_Window); /* * Helper routines for scrolling widgets (see scroll.c). */ typedef struct { int first; /* First visible item */ int last; /* Last visible item */ int total; /* Total #items */ char *scrollCmd; /* Widget option */ } Scrollable; typedef struct ScrollHandleRec *ScrollHandle; MODULE_SCOPE ScrollHandle TtkCreateScrollHandle(WidgetCore *, Scrollable *); MODULE_SCOPE void TtkFreeScrollHandle(ScrollHandle); MODULE_SCOPE int TtkScrollviewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle); MODULE_SCOPE void TtkScrollTo(ScrollHandle, int newFirst); MODULE_SCOPE void TtkScrolled(ScrollHandle, int first, int last, int total); MODULE_SCOPE void TtkScrollbarUpdateRequired(ScrollHandle); /* * Tag sets (work in progress, half-baked) */ typedef struct TtkTag *Ttk_Tag; typedef struct TtkTagTable *Ttk_TagTable; MODULE_SCOPE Ttk_TagTable Ttk_CreateTagTable(Tk_OptionTable, int tagRecSize); MODULE_SCOPE void Ttk_DeleteTagTable(Ttk_TagTable); MODULE_SCOPE Ttk_Tag Ttk_GetTag(Ttk_TagTable, const char *tagName); MODULE_SCOPE Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable, Tcl_Obj *); MODULE_SCOPE Tcl_Obj **Ttk_TagRecord(Ttk_Tag); MODULE_SCOPE int Ttk_GetTagListFromObj( Tcl_Interp *interp, Ttk_TagTable, Tcl_Obj *objPtr, int *nTags_rtn, void **taglist_rtn); MODULE_SCOPE void Ttk_FreeTagList(void **taglist); /* * Useful widget base classes: */ MODULE_SCOPE Tk_OptionSpec ttkCoreOptionSpecs[]; /* * String tables for widget resource specifications: */ MODULE_SCOPE const char *ttkOrientStrings[]; MODULE_SCOPE const char *ttkCompoundStrings[]; MODULE_SCOPE const char *ttkDefaultStrings[]; /* * ... other option types... */ MODULE_SCOPE int TtkGetLabelAnchorFromObj( Tcl_Interp*, Tcl_Obj*, Ttk_PositionSpec *); /* * Platform-specific initialization. */ #if defined(__WIN32__) #define Ttk_PlatformInit Ttk_WinPlatformInit MODULE_SCOPE int Ttk_PlatformInit(Tcl_Interp *); #elif defined(MAC_OSX_TK) #define Ttk_PlatformInit Ttk_MacOSXPlatformInit MODULE_SCOPE int Ttk_PlatformInit(Tcl_Interp *); #else #define Ttk_PlatformInit(interp) /* TTK_X11PlatformInit() */ #endif #endif /* _TTKWIDGET */ tile-0.8.2/library/0000755000076500007650000000000010731273213013507 5ustar joejoe00000000000000tile-0.8.2/library/altTheme.tcl0000644000076500007650000000642010726412341015761 0ustar joejoe00000000000000# # altTheme.tcl,v 1.40 2007/12/08 03:52:01 jenglish Exp # # Tile widget set: Alternate theme # namespace eval ttk::theme::alt { variable colors array set colors { -frame "#d9d9d9" -window "#ffffff" -darker "#c3c3c3" -activebg "#ececec" -disabledfg "#a3a3a3" -selectbg "#4a6984" -selectfg "#ffffff" } ttk::style theme settings alt { ttk::style configure "." \ -background $colors(-frame) \ -foreground black \ -troughcolor $colors(-darker) \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -font TkDefaultFont \ ; ttk::style map "." -background \ [list disabled $colors(-frame) active $colors(-activebg)] ; ttk::style map "." -foreground [list disabled $colors(-disabledfg)] ; ttk::style map "." -embossed [list disabled 1] ; ttk::style configure TButton \ -anchor center -width -11 -padding "1 1" \ -relief raised -shiftrelief 1 \ -highlightthickness 1 -highlightcolor $colors(-frame) ttk::style map TButton -relief { {pressed !disabled} sunken {active !disabled} raised } -highlightcolor {alternate black} ttk::style configure TCheckbutton -indicatorcolor "#ffffff" -padding 2 ttk::style configure TRadiobutton -indicatorcolor "#ffffff" -padding 2 ttk::style map TCheckbutton -indicatorcolor \ [list disabled $colors(-frame) pressed $colors(-frame)] ttk::style map TRadiobutton -indicatorcolor \ [list disabled $colors(-frame) pressed $colors(-frame)] ttk::style configure TMenubutton \ -width -11 -padding "3 3" -relief raised ttk::style configure TEntry -padding 1 ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TCombobox -padding 1 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure Toolbutton -relief flat -padding 2 ttk::style map Toolbutton -relief \ {disabled flat selected sunken pressed sunken active raised} ttk::style map Toolbutton -background \ [list pressed $colors(-darker) active $colors(-activebg)] ttk::style configure TScrollbar -relief raised ttk::style configure TLabelframe -relief groove -borderwidth 2 ttk::style configure TNotebook -tabmargins {2 2 1 0} ttk::style configure TNotebook.Tab \ -padding {4 2} -background $colors(-darker) ttk::style map TNotebook.Tab \ -background [list selected $colors(-frame)] \ -expand [list selected {2 2 1 0}] \ ; # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Row -background $colors(-window) ttk::style configure Cell -background $colors(-window) ttk::style map Row \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; ttk::style map Cell \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; ttk::style map Item \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; ttk::style configure TScale \ -groovewidth 4 -troughrelief sunken \ -sliderwidth raised -borderwidth 2 ttk::style configure TProgressbar \ -background $colors(-selectbg) -borderwidth 0 } } tile-0.8.2/library/aquaTheme.tcl0000644000076500007650000000402610720166601016127 0ustar joejoe00000000000000# # aquaTheme.tcl,v 1.28 2007/11/19 01:57:21 jenglish Exp # # Aqua theme (OSX native look and feel) # namespace eval ttk::theme::aqua { ttk::style theme settings aqua { ttk::style configure . \ -font System \ -background White \ -foreground Black \ -selectbackground SystemHighlight \ -selectforeground SystemHighlightText \ -selectborderwidth 0 \ -insertwidth 1 \ ; ttk::style map . \ -foreground [list disabled "#7f7f7f" background "#7f7f7f"] \ -selectbackground [list background "#c3c3c3" !focus "#c3c3c3"] \ -selectforeground [list background "#a3a3a3" !focus "#000000"] \ ; # Workaround for #1100117: # Actually, on Aqua we probably shouldn't stipple images in # disabled buttons even if it did work... # ttk::style configure . -stipple {} ttk::style configure TButton -anchor center -width -6 ttk::style configure Toolbutton -padding 4 # See Apple HIG figs 14-63, 14-65 ttk::style configure TNotebook -tabposition n -padding {20 12} ttk::style configure TNotebook.Tab -padding {10 2 10 2} # Combobox: ttk::style configure TCombobox -postoffset {5 -2 -10 0} # Treeview: ttk::style configure Treeview -rowheight 18 ttk::style configure Heading -font TkHeadingFont ttk::style map Row -background [list \ {selected background} "#c3c3c3" selected SystemHighlight] ; ttk::style map Cell -foreground [list \ {selected background} "#000000" selected SystemHighlightText] ; ttk::style map Item -foreground [list \ {selected background} "#000000" selected SystemHighlightText] ; # Enable animation for ttk::progressbar widget: ttk::style configure TProgressbar -period 100 -maxphase 255 # For Aqua, labelframe labels should appear outside the border, # with a 14 pixel inset and 4 pixels spacing between border and label # (ref: Apple Human Interface Guidelines / Controls / Grouping Controls) # ttk::style configure TLabelframe \ -labeloutside true -labelmargins {14 0 14 4} # TODO: panedwindow sashes should be 9 pixels (HIG:Controls:Split Views) } } tile-0.8.2/library/button.tcl0000644000076500007650000000564410532351254015540 0ustar joejoe00000000000000# # button.tcl,v 1.14 2006/11/26 17:45:16 jenglish Exp # # Bindings for Buttons, Checkbuttons, and Radiobuttons. # # Notes: , only control the "pressed" # state; widgets remain "active" if the pointer is dragged out. # This doesn't seem to be conventional, but it's a nice way # to provide extra feedback while the grab is active. # (If the button is released off the widget, the grab deactivates and # we get a event then, which turns off the "active" state) # # Normally, and events are # delivered to the widget which received the initial # event. However, Tk [grab]s (#1223103) and menu interactions # (#1222605) can interfere with this. To guard against spurious # events, the binding only sets # the pressed state if the button is currently active. # namespace eval ttk::button {} bind TButton { %W instate !disabled {%W state active} } bind TButton { %W state !active } bind TButton { ttk::button::activate %W } bind TButton <> { ttk::button::activate %W } bind TButton \ { %W instate !disabled { ttk::clickToFocus %W; %W state pressed } } bind TButton \ { %W instate {pressed !disabled} { %W state !pressed; %W invoke } } bind TButton \ { %W state !pressed } bind TButton \ { %W instate {active !disabled} { %W state pressed } } # Checkbuttons and Radiobuttons have the same bindings as Buttons: # ttk::copyBindings TButton TCheckbutton ttk::copyBindings TButton TRadiobutton # ...plus a few more: bind TRadiobutton { ttk::button::RadioTraverse %W -1 } bind TRadiobutton { ttk::button::RadioTraverse %W +1 } # bind TCheckbutton { %W select } # bind TCheckbutton { %W deselect } # activate -- # Simulate a button press: temporarily set the state to 'pressed', # then invoke the button. # proc ttk::button::activate {w} { $w instate disabled { return } set oldState [$w state pressed] update idletasks; after 100 $w state $oldState $w invoke } # RadioTraverse -- up/down keyboard traversal for radiobutton groups. # Set focus to previous/next radiobutton in a group. # A radiobutton group consists of all the radiobuttons with # the same parent and -variable; this is a pretty good heuristic # that works most of the time. # proc ttk::button::RadioTraverse {w dir} { set group [list] foreach sibling [winfo children [winfo parent $w]] { if { [winfo class $sibling] eq "TRadiobutton" && [$sibling cget -variable] eq [$w cget -variable] && ![$sibling instate disabled] } { lappend group $sibling } } if {![llength $group]} { # Shouldn't happen, but can. return } set pos [expr {([lsearch -exact $group $w] + $dir) % [llength $group]}] ttk::traverseTo [lindex $group $pos] } tile-0.8.2/library/clamTheme.tcl0000644000076500007650000001036610720077726016131 0ustar joejoe00000000000000# # clamTheme.tcl,v 1.31 2007/11/18 18:09:26 jenglish Exp # # "Clam" theme. # # Inspired by the XFCE family of Gnome themes. # namespace eval ttk::theme::clam { variable colors array set colors { -disabledfg "#999999" -frame "#dcdad5" -window "#ffffff" -dark "#cfcdc8" -darker "#bab5ab" -darkest "#9e9a91" -lighter "#eeebe7" -lightest "#ffffff" -selectbg "#4a6984" -selectfg "#ffffff" } ttk::style theme settings clam { ttk::style configure "." \ -background $colors(-frame) \ -foreground black \ -bordercolor $colors(-darkest) \ -darkcolor $colors(-dark) \ -lightcolor $colors(-lighter) \ -troughcolor $colors(-darker) \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -selectborderwidth 0 \ -font TkDefaultFont \ ; ttk::style map "." \ -background [list disabled $colors(-frame) \ active $colors(-lighter)] \ -foreground [list disabled $colors(-disabledfg)] \ -selectbackground [list !focus $colors(-darkest)] \ -selectforeground [list !focus white] \ ; # -selectbackground [list !focus "#847d73"] ttk::style configure TButton \ -anchor center -width -11 -padding 5 -relief raised ttk::style map TButton \ -background [list \ disabled $colors(-frame) \ pressed $colors(-darker) \ active $colors(-lighter)] \ -lightcolor [list pressed $colors(-darker)] \ -darkcolor [list pressed $colors(-darker)] \ -bordercolor [list alternate "#000000"] \ ; ttk::style configure Toolbutton \ -anchor center -padding 2 -relief flat ttk::style map Toolbutton \ -relief [list \ disabled flat \ selected sunken \ pressed sunken \ active raised] \ -background [list \ disabled $colors(-frame) \ pressed $colors(-darker) \ active $colors(-lighter)] \ -lightcolor [list pressed $colors(-darker)] \ -darkcolor [list pressed $colors(-darker)] \ ; ttk::style configure TCheckbutton \ -indicatorbackground "#ffffff" \ -indicatormargin {1 1 4 1} \ -padding 2 ; ttk::style configure TRadiobutton \ -indicatorbackground "#ffffff" \ -indicatormargin {1 1 4 1} \ -padding 2 ; ttk::style map TCheckbutton -indicatorbackground \ [list disabled $colors(-frame) pressed $colors(-frame)] ttk::style map TRadiobutton -indicatorbackground \ [list disabled $colors(-frame) pressed $colors(-frame)] ttk::style configure TMenubutton \ -width -11 -padding 5 -relief raised ttk::style configure TEntry -padding 1 -insertwidth 1 ttk::style map TEntry \ -background [list readonly $colors(-frame)] \ -bordercolor [list focus $colors(-selectbg)] \ -lightcolor [list focus "#6f9dc6"] \ -darkcolor [list focus "#6f9dc6"] \ ; ttk::style configure TCombobox -padding 1 -insertwidth 1 ttk::style map TCombobox \ -background [list active $colors(-lighter) \ pressed $colors(-lighter)] \ -fieldbackground [list {readonly focus} $colors(-selectbg) \ readonly $colors(-frame)] \ -foreground [list {readonly focus} $colors(-selectfg)] \ ; ttk::style configure TNotebook.Tab -padding {6 2 6 2} ttk::style map TNotebook.Tab \ -padding [list selected {6 4 6 2}] \ -background [list selected $colors(-frame) {} $colors(-darker)] \ -lightcolor [list selected $colors(-lighter) {} $colors(-dark)] \ ; # Treeview: ttk::style configure Heading \ -font TkHeadingFont -relief raised -padding {3} ttk::style configure Row -background $colors(-window) ttk::style configure Cell -background $colors(-window) ttk::style map Row \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; ttk::style map Cell \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; ttk::style map Item \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; ttk::style configure TLabelframe \ -labeloutside true -labelmargins {0 0 0 4} \ -borderwidth 2 -relief raised ttk::style configure TProgressbar -background $colors(-frame) ttk::style configure Sash -sashthickness 6 -gripcount 10 } } tile-0.8.2/library/classicTheme.tcl0000644000076500007650000000666310726412341016633 0ustar joejoe00000000000000# # classicTheme.tcl,v 1.19 2007/12/08 03:52:01 jenglish Exp # # "classic" Tk theme. # # Implements Tk's traditional Motif-like look and feel. # namespace eval ttk::theme::classic { variable colors; array set colors { -frame "#d9d9d9" -window "#ffffff" -activebg "#ececec" -troughbg "#c3c3c3" -selectbg "#c3c3c3" -selectfg "#000000" -disabledfg "#a3a3a3" -indicator "#b03060" } ttk::style theme settings classic { ttk::style configure "." \ -font TkDefaultFont \ -background $colors(-frame) \ -foreground black \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -troughcolor $colors(-troughbg) \ -indicatorcolor $colors(-frame) \ -highlightcolor $colors(-frame) \ -highlightthickness 1 \ -selectborderwidth 1 \ -insertwidth 2 \ ; # To match pre-Xft X11 appearance, use: # ttk::style configure . -font {Helvetica 12 bold} ttk::style map "." -background \ [list disabled $colors(-frame) active $colors(-activebg)] ttk::style map "." -foreground \ [list disabled $colors(-disabledfg)] ttk::style map "." -highlightcolor [list focus black] ttk::style configure TButton \ -anchor center -padding "3m 1m" -relief raised -shiftrelief 1 ttk::style map TButton -relief [list {!disabled pressed} sunken] ttk::style configure TCheckbutton -indicatorrelief raised ttk::style map TCheckbutton \ -indicatorcolor [list \ pressed $colors(-frame) selected $colors(-indicator)] \ -indicatorrelief {selected sunken pressed sunken} \ ; ttk::style configure TRadiobutton -indicatorrelief raised ttk::style map TRadiobutton \ -indicatorcolor [list \ pressed $colors(-frame) selected $colors(-indicator)] \ -indicatorrelief {selected sunken pressed sunken} \ ; ttk::style configure TMenubutton -relief raised -padding "3m 1m" ttk::style configure TEntry -relief sunken -padding 1 -font TkTextFont ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TCombobox -padding 1 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TLabelframe -borderwidth 2 -relief groove ttk::style configure TScrollbar -relief raised ttk::style map TScrollbar -relief {{pressed !disabled} sunken} ttk::style configure TScale -sliderrelief raised ttk::style map TScale -sliderrelief {{pressed !disabled} sunken} ttk::style configure TProgressbar -background SteelBlue ttk::style configure TNotebook.Tab \ -padding {3m 1m} \ -background $colors(-troughbg) ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Row -background $colors(-window) ttk::style configure Cell -background $colors(-window) ttk::style map Row \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; ttk::style map Cell \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; # # Toolbar buttons: # ttk::style configure Toolbutton -padding 2 -relief flat -shiftrelief 2 ttk::style map Toolbutton -relief \ {disabled flat selected sunken pressed sunken active raised} ttk::style map Toolbutton -background \ [list pressed $colors(-troughbg) active $colors(-activebg)] } } tile-0.8.2/library/combobox.tcl0000644000076500007650000002726610713746774016061 0ustar joejoe00000000000000# # combobox.tcl,v 1.47 2007/11/06 02:14:20 jenglish Exp # # Combobox bindings. # # Each combobox $cb has a child $cb.popdown, which contains # a listbox $cb.popdown.l and a scrollbar. The listbox -listvariable # is set to a namespace variable, which is used to synchronize the # combobox values with the listbox values. # # <>: # # Need to set [wm transient] just before mapping the popdown # instead of when it's created, in case a containing frame # has been reparented [#1818441]. # # On Windows: setting [wm transient] prevents the parent # toplevel from becoming inactive when the popdown is posted # (Tk 8.4.8+) # # On X11: WM_TRANSIENT_FOR on override-redirect windows # may be used by compositing managers and by EWMH-aware # window managers (even though the older ICCCM spec says # it's meaningless). # # On OSX: [wm transient] does utterly the wrong thing. # Instead, we use [MacWindowStyle "help" "noActivates hideOnSuspend"]. # The "noActivates" attribute prevents the parent toplevel # from deactivating when the popdown is posted, and is also # necessary for "help" windows to receive mouse events. # "hideOnSuspend" makes the popdown disappear (resp. reappear) # when the parent toplevel is deactivated (resp. reactivated). # (see [#1814778]). Also set [wm resizable 0 0], to prevent # TkAqua from shrinking the scrollbar to make room for a grow box # that isn't there. # # In order to work around other platform quirks in TkAqua, # [grab] and [focus] are set in bindings instead of # immediately after deiconifying the window. # namespace eval ttk::combobox { variable Values ;# Values($cb) is -listvariable of listbox widget variable State set State(entryPress) 0 } ### Combobox bindings. # # Duplicate the Entry bindings, override if needed: # ttk::copyBindings TEntry TCombobox bind TCombobox { ttk::combobox::Post %W } bind TCombobox { ttk::combobox::Unpost %W } bind TCombobox { ttk::combobox::Press "" %W %x %y } bind TCombobox { ttk::combobox::Press "s" %W %x %y } bind TCombobox { ttk::combobox::Press "2" %W %x %y } bind TCombobox { ttk::combobox::Press "3" %W %x %y } bind TCombobox { ttk::combobox::Drag %W %x } bind TCombobox { ttk::combobox::Scroll %W [expr {%D/-120}] } if {[tk windowingsystem] eq "x11"} { bind TCombobox { ttk::combobox::Scroll %W -1 } bind TCombobox { ttk::combobox::Scroll %W 1 } } bind TCombobox <> { ttk::combobox::TraverseIn %W } ### Combobox listbox bindings. # bind ComboboxListbox { ttk::combobox::LBSelected %W } bind ComboboxListbox { ttk::combobox::LBSelected %W } bind ComboboxListbox { ttk::combobox::LBCancel %W } bind ComboboxListbox { ttk::combobox::LBTab %W next } bind ComboboxListbox <> { ttk::combobox::LBTab %W prev } bind ComboboxListbox { ttk::combobox::LBCleanup %W } bind ComboboxListbox { ttk::combobox::LBHover %W %x %y } bind ComboboxListbox { focus -force %W } switch -- [tk windowingsystem] { win32 { # Dismiss listbox when user switches to a different application. # NB: *only* do this on Windows (see #1814778) bind ComboboxListbox { ttk::combobox::LBCancel %W } } } ### Combobox popdown window bindings. # bind ComboboxPopdown { ttk::combobox::MapPopdown %W } bind ComboboxPopdown { ttk::combobox::UnmapPopdown %W } bind ComboboxPopdown \ { ttk::combobox::Unpost [winfo parent %W] } ### Option database settings. # option add *TCombobox*Listbox.font TkTextFont option add *TCombobox*Listbox.relief flat option add *TCombobox*Listbox.highlightThickness 0 ## Platform-specific settings. # switch -- [tk windowingsystem] { x11 { option add *TCombobox*Listbox.background white } aqua { option add *TCombobox*Listbox.borderWidth 0 } } ### Binding procedures. # ## Press $mode $x $y -- ButtonPress binding for comboboxes. # Either post/unpost the listbox, or perform Entry widget binding, # depending on widget state and location of button press. # proc ttk::combobox::Press {mode w x y} { variable State set State(entryPress) [expr { [$w instate {!readonly !disabled}] && [string match *textarea [$w identify $x $y]] }] focus $w if {$State(entryPress)} { switch -- $mode { s { ttk::entry::Shift-Press $w $x ; # Shift } 2 { ttk::entry::Select $w $x word ; # Double click} 3 { ttk::entry::Select $w $x line ; # Triple click } "" - default { ttk::entry::Press $w $x } } } else { Post $w } } ## Drag -- B1-Motion binding for comboboxes. # If the initial ButtonPress event was handled by Entry binding, # perform Entry widget drag binding; otherwise nothing. # proc ttk::combobox::Drag {w x} { variable State if {$State(entryPress)} { ttk::entry::Drag $w $x } } ## TraverseIn -- receive focus due to keyboard navigation # For editable comboboxes, set the selection and insert cursor. # proc ttk::combobox::TraverseIn {w} { $w instate {!readonly !disabled} { $w selection range 0 end $w icursor end } } ## SelectEntry $cb $index -- # Set the combobox selection in response to a user action. # proc ttk::combobox::SelectEntry {cb index} { $cb current $index $cb selection range 0 end $cb icursor end event generate $cb <> } ## Scroll -- Mousewheel binding # proc ttk::combobox::Scroll {cb dir} { $cb instate disabled { return } set max [llength [$cb cget -values]] set current [$cb current] incr current $dir if {$max != 0 && $current == $current % $max} { SelectEntry $cb $current } } ## LBSelected $lb -- Activation binding for listbox # Set the combobox value to the currently-selected listbox value # and unpost the listbox. # proc ttk::combobox::LBSelected {lb} { set cb [LBMaster $lb] LBSelect $lb Unpost $cb focus $cb } ## LBCancel -- # Unpost the listbox. # proc ttk::combobox::LBCancel {lb} { Unpost [LBMaster $lb] } ## LBTab -- Tab key binding for combobox listbox. # Set the selection, and navigate to next/prev widget. # proc ttk::combobox::LBTab {lb dir} { set cb [LBMaster $lb] switch -- $dir { next { set newFocus [tk_focusNext $cb] } prev { set newFocus [tk_focusPrev $cb] } } if {$newFocus ne ""} { LBSelect $lb Unpost $cb # The [grab release] call in [Unpost] queues events that later # re-set the focus. [update] to make sure these get processed first: update ttk::traverseTo $newFocus } } ## LBHover -- binding for combobox listbox. # Follow selection on mouseover. # proc ttk::combobox::LBHover {w x y} { $w selection clear 0 end $w activate @$x,$y $w selection set @$x,$y } ## MapPopdown -- binding for ComboboxPopdown # proc ttk::combobox::MapPopdown {w} { [winfo parent $w] state pressed ttk::globalGrab $w } ## UnmapPopdown -- binding for ComboboxPopdown # proc ttk::combobox::UnmapPopdown {w} { [winfo parent $w] state !pressed ttk::releaseGrab $w } ### # namespace eval ::ttk::combobox { # @@@ Until we have a proper native scrollbar on Aqua, use # @@@ the regular Tk one. Use ttk::scrollbar on other platforms. variable scrollbar ttk::scrollbar if {[tk windowingsystem] eq "aqua"} { set scrollbar ::scrollbar } } ## PopdownWindow -- # Returns the popdown widget associated with a combobox, # creating it if necessary. # proc ttk::combobox::PopdownWindow {cb} { variable scrollbar if {![winfo exists $cb.popdown]} { set popdown [PopdownToplevel $cb.popdown] $scrollbar $popdown.sb \ -orient vertical -command [list $popdown.l yview] listbox $popdown.l \ -listvariable ttk::combobox::Values($cb) \ -yscrollcommand [list $popdown.sb set] \ -exportselection false \ -selectmode browse \ -activestyle none \ ; bindtags $popdown.l \ [list $popdown.l ComboboxListbox Listbox $popdown all] grid $popdown.l $popdown.sb -sticky news grid columnconfigure $popdown 0 -weight 1 grid rowconfigure $popdown 0 -weight 1 } return $cb.popdown } ## PopdownToplevel -- Create toplevel window for the combobox popdown # # See also <> # proc ttk::combobox::PopdownToplevel {w} { toplevel $w -class ComboboxPopdown wm withdraw $w switch -- [tk windowingsystem] { default - x11 { $w configure -relief solid -borderwidth 1 wm overrideredirect $w true } win32 { $w configure -relief solid -borderwidth 1 wm overrideredirect $w true } aqua { $w configure -relief solid -borderwidth 0 tk::unsupported::MacWindowStyle style $w \ help {noActivates hideOnSuspend} wm resizable $w 0 0 } } return $w } ## ConfigureListbox -- # Set listbox values, selection, height, and scrollbar visibility # from current combobox values. # proc ttk::combobox::ConfigureListbox {cb} { variable Values set popdown [PopdownWindow $cb] set values [$cb cget -values] set current [$cb current] if {$current < 0} { set current 0 ;# no current entry, highlight first one } set Values($cb) $values $popdown.l selection clear 0 end $popdown.l selection set $current $popdown.l activate $current $popdown.l see $current set height [llength $values] if {$height > [$cb cget -height]} { set height [$cb cget -height] grid $popdown.sb } else { grid remove $popdown.sb } $popdown.l configure -height $height } ## PlacePopdown -- # Set popdown window geometry. # # @@@TODO: factor with menubutton::PostPosition # proc ttk::combobox::PlacePopdown {cb popdown} { set x [winfo rootx $cb] set y [winfo rooty $cb] set w [winfo width $cb] set h [winfo height $cb] set postoffset [ttk::style lookup TCombobox -postoffset {} {0 0 0 0}] foreach var {x y w h} delta $postoffset { incr $var $delta } set H [winfo reqheight $popdown] if {$y + $h + $H > [winfo screenheight $popdown]} { set Y [expr {$y - $H}] } else { set Y [expr {$y + $h}] } wm geometry $popdown ${w}x${H}+${x}+${Y} } ## Post $cb -- # Pop down the associated listbox. # proc ttk::combobox::Post {cb} { # Don't do anything if disabled: # $cb instate disabled { return } # ASSERT: ![$cb instate pressed] # Run -postcommand callback: # uplevel #0 [$cb cget -postcommand] set popdown [PopdownWindow $cb] ConfigureListbox $cb update idletasks PlacePopdown $cb $popdown # See <> switch -- [tk windowingsystem] { x11 - win32 { wm transient $popdown [winfo toplevel $cb] } } # Post the listbox: # wm deiconify $popdown raise $popdown } ## Unpost $cb -- # Unpost the listbox. # proc ttk::combobox::Unpost {cb} { if {[winfo exists $cb.popdown]} { wm withdraw $cb.popdown } grab release $cb.popdown ;# in case of stuck or unexpected grab [#1239190] } ## LBMaster $lb -- # Return the combobox main widget that owns the listbox. # proc ttk::combobox::LBMaster {lb} { winfo parent [winfo parent $lb] } ## LBSelect $lb -- # Transfer listbox selection to combobox value. # proc ttk::combobox::LBSelect {lb} { set cb [LBMaster $lb] set selection [$lb curselection] if {[llength $selection] == 1} { SelectEntry $cb [lindex $selection 0] } } ## LBCleanup $lb -- # binding for combobox listboxes. # Cleans up by unsetting the linked textvariable. # # Note: we can't just use { unset [%W cget -listvariable] } # because the widget command is already gone when this binding fires). # [winfo parent] still works, fortunately. # proc ttk::combobox::LBCleanup {lb} { variable Values unset Values([LBMaster $lb]) } #*EOF* tile-0.8.2/library/cursors.tcl0000644000076500007650000000106710523430060015711 0ustar joejoe00000000000000# # cursors.tcl,v 1.3 2006/11/05 18:40:48 jenglish Exp # # Tile package: Symbolic cursor names. # # @@@ TODO: Figure out appropriate platform-specific cursors # for the various functions. # namespace eval ttk { variable Cursors switch -glob $::tcl_platform(platform) { "windows" { array set Cursors { hresize sb_h_double_arrow vresize sb_v_double_arrow seresize size_nw_se } } "unix" - * { array set Cursors { hresize sb_h_double_arrow vresize sb_v_double_arrow seresize bottom_right_corner } } } } #*EOF* tile-0.8.2/library/defaults.tcl0000644000076500007650000000670210720077726016040 0ustar joejoe00000000000000# # defaults.tcl,v 1.38 2007/11/18 18:09:26 jenglish Exp # # Settings for default theme. # namespace eval ttk::theme::default { variable colors array set colors { -frame "#d9d9d9" -window "#ffffff" -activebg "#ececec" -selectbg "#4a6984" -selectfg "#ffffff" -darker "#c3c3c3" -disabledfg "#a3a3a3" -indicator "#4a6984" } ttk::style theme settings default { ttk::style configure "." \ -borderwidth 1 \ -background $colors(-frame) \ -foreground black \ -troughcolor $colors(-darker) \ -font TkDefaultFont \ -selectborderwidth 1 \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -insertwidth 1 \ -indicatordiameter 10 \ ; ttk::style map "." -background \ [list disabled $colors(-frame) active $colors(-activebg)] ttk::style map "." -foreground \ [list disabled $colors(-disabledfg)] ttk::style configure TButton \ -anchor center -padding "3 3" -width -9 \ -relief raised -shiftrelief 1 ttk::style map TButton -relief [list {!disabled pressed} sunken] ttk::style configure TCheckbutton \ -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1 ttk::style map TCheckbutton -indicatorcolor \ [list pressed $colors(-activebg) selected $colors(-indicator)] ttk::style configure TRadiobutton \ -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1 ttk::style map TRadiobutton -indicatorcolor \ [list pressed $colors(-activebg) selected $colors(-indicator)] ttk::style configure TMenubutton \ -relief raised -padding "10 3" ttk::style configure TEntry \ -relief sunken -fieldbackground white -padding 1 ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TCombobox -arrowsize 12 -padding 1 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TLabelframe \ -relief groove -borderwidth 2 ttk::style configure TScrollbar \ -width 12 -arrowsize 12 ttk::style map TScrollbar \ -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure TScale \ -sliderrelief raised ttk::style configure TProgressbar \ -background $colors(-selectbg) ttk::style configure TNotebook.Tab \ -padding {4 2} -background $colors(-darker) ttk::style map TNotebook.Tab \ -background [list selected $colors(-frame)] # Treeview. # ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Row -background $colors(-window) ttk::style configure Cell -background $colors(-window) ttk::style map Row \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; ttk::style map Cell \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; ttk::style map Item \ -background [list selected $colors(-selectbg)] \ -foreground [list selected $colors(-selectfg)] ; # # Toolbar buttons: # ttk::style layout Toolbutton { Toolbutton.border -children { Toolbutton.padding -children { Toolbutton.label } } } ttk::style configure Toolbutton \ -padding 2 -relief flat ttk::style map Toolbutton -relief \ [list disabled flat selected sunken pressed sunken active raised] ttk::style map Toolbutton -background \ [list pressed $colors(-darker) active $colors(-activebg)] } } tile-0.8.2/library/dialog.tcl0000644000076500007650000001635410644777726015510 0ustar joejoe00000000000000# # dialog.tcl,v 1.6 2007/07/10 21:53:26 jenglish Exp # # Copyright (c) 2005, Joe English. Freely redistributable. # # Tile widget set: dialog boxes. # # TODO: option to keep dialog onscreen ("persistent" / "transient") # TODO: accelerator keys. # TODO: use message catalogs for button labels # TODO: routines to selectively enable/disable individual command buttons # TODO: use megawidgetoid API [$dlg dismiss] vs. [ttk::dialog::dismiss $dlg] # TODO: MAYBE: option for app-modal dialogs # TODO: MAYBE: [wm withdraw] dialog on dismiss instead of self-destructing # package provide ttk::dialog 0.8 namespace eval ttk::dialog { variable Config # # Spacing parameters: # (taken from GNOME HIG 2.0, may need adjustment for other platforms) # (textwidth just a guess) # set Config(margin) 12 ;# space between icon and text set Config(interspace) 6 ;# horizontal space between buttons set Config(sepspace) 24 ;# vertical space above buttons set Config(textwidth) 400 ;# width of dialog box text (pixels) variable DialogTypes ;# map -type => list of dialog options variable ButtonOptions ;# map button name => list of button options # stockButton -- define new built-in button # proc stockButton {button args} { variable ButtonOptions set ButtonOptions($button) $args } # Built-in button types: # stockButton ok -text OK stockButton cancel -text Cancel stockButton yes -text Yes stockButton no -text No stockButton retry -text Retry # stockDialog -- define new dialog type. # proc stockDialog {type args} { variable DialogTypes set DialogTypes($type) $args } # Built-in dialog types: # stockDialog ok \ -icon info -buttons {ok} -default ok stockDialog okcancel \ -icon info -buttons {ok cancel} -default ok -cancel cancel stockDialog retrycancel \ -icon question -buttons {retry cancel} -cancel cancel stockDialog yesno \ -icon question -buttons {yes no} stockDialog yesnocancel \ -icon question -buttons {yes no cancel} -cancel cancel } ## ttk::dialog::nop -- # Do nothing (used as a default callback command). # proc ttk::dialog::nop {args} { } ## ttk::dialog -- dialog box constructor. # interp alias {} ttk::dialog {} ttk::dialog::Constructor proc ttk::dialog::Constructor {dlg args} { upvar #0 $dlg D variable Config variable ButtonOptions variable DialogTypes # # Option processing: # array set defaults { -title "" -message "" -detail "" -command ttk::dialog::nop -icon "" -buttons {} -labels {} -default {} -cancel {} -parent #AUTO } array set options [array get defaults] foreach {option value} $args { if {$option eq "-type"} { array set options $DialogTypes($value) } elseif {![info exists options($option)]} { set validOptions [join [lsort [array names options]] ", "] return -code error \ "Illegal option $option: must be one of $validOptions" } } array set options $args # ... # array set buttonOptions [array get ::ttk::dialog::ButtonOptions] foreach {button label} $options(-labels) { lappend buttonOptions($button) -text $label } # # Initialize dialog private data: # foreach option {-command -message -detail} { set D($option) $options($option) } toplevel $dlg -class Dialog; wm withdraw $dlg # # Determine default transient parent. # # NB: menus (including menubars) are considered toplevels, # so skip over those. # if {$options(-parent) eq "#AUTO"} { set parent [winfo toplevel [winfo parent $dlg]] while {[winfo class $parent] eq "Menu" && $parent ne "."} { set parent [winfo toplevel [winfo parent $parent]] } set options(-parent) $parent } # # Build dialog: # if {$options(-parent) ne ""} { wm transient $dlg $options(-parent) } wm title $dlg $options(-title) wm protocol $dlg WM_DELETE_WINDOW { } set f [ttk::frame $dlg.f] ttk::label $f.icon if {$options(-icon) ne ""} { $f.icon configure -image [ttk::stockIcon dialog/$options(-icon)] } ttk::label $f.message -textvariable ${dlg}(-message) \ -font TkCaptionFont -wraplength $Config(textwidth)\ -anchor w -justify left ttk::label $f.detail -textvariable ${dlg}(-detail) \ -font TkTextFont -wraplength $Config(textwidth) \ -anchor w -justify left # # Command buttons: # set cmd [ttk::frame $f.cmd] set column 0 grid columnconfigure $f.cmd 0 -weight 1 foreach button $options(-buttons) { incr column eval [linsert $buttonOptions($button) 0 ttk::button $cmd.$button] $cmd.$button configure -command [list ttk::dialog::Done $dlg $button] grid $cmd.$button -row 0 -column $column \ -padx [list $Config(interspace) 0] -sticky ew grid columnconfigure $cmd $column -uniform buttons } if {$options(-default) ne ""} { keynav::defaultButton $cmd.$options(-default) focus $cmd.$options(-default) } if {$options(-cancel) ne ""} { bind $dlg \ [list event generate $cmd.$options(-cancel) <>] wm protocol $dlg WM_DELETE_WINDOW \ [list event generate $cmd.$options(-cancel) <>] } # # Assemble dialog. # pack $f.cmd -side bottom -expand false -fill x \ -pady [list $Config(sepspace) $Config(margin)] -padx $Config(margin) if {0} { # GNOME and Apple HIGs say not to use separators. # But in case we want them anyway: # pack [ttk::separator $f.sep -orient horizontal] \ -side bottom -expand false -fill x \ -pady [list $Config(sepspace) 0] \ -padx $Config(margin) } if {$options(-icon) ne ""} { pack $f.icon -side left -anchor n -expand false \ -pady $Config(margin) -padx $Config(margin) } pack $f.message -side top -expand false -fill x \ -padx $Config(margin) -pady $Config(margin) if {$options(-detail) != ""} { pack $f.detail -side top -expand false -fill x \ -padx $Config(margin) } # Client area goes here. pack $f -expand true -fill both keynav::enableMnemonics $dlg wm deiconify $dlg } ## ttk::dialog::clientframe -- # Returns the widget path of the dialog client frame, # creating and managing it if necessary. # proc ttk::dialog::clientframe {dlg} { variable Config set client $dlg.f.client if {![winfo exists $client]} { pack [ttk::frame $client] -side top -expand true -fill both \ -pady $Config(margin) -padx $Config(margin) lower $client ;# so it's first in keyboard traversal order } return $client } ## ttk::dialog::Done -- # -command callback for dialog command buttons (internal) # proc ttk::dialog::Done {dlg button} { upvar #0 $dlg D set rc [catch [linsert $D(-command) end $button] result] if {$rc == 1} { return -code $rc -errorinfo $::errorInfo -errorcode $::errorCode $result } elseif {$rc == 3 || $rc == 4} { # break or continue -- don't dismiss dialog return } dismiss $dlg } ## ttk::dialog::activate $dlg $button -- # Simulate a button press. # proc ttk::dialog::activate {dlg button} { event generate $dlg.f.cmd.$button <> } ## dismiss -- # Dismiss the dialog (without invoking any actions). # proc ttk::dialog::dismiss {dlg} { uplevel #0 [list unset $dlg] destroy $dlg } #*EOF* tile-0.8.2/library/entry.tcl0000644000076500007650000003717410677752453015411 0ustar joejoe00000000000000# # entry.tcl,v 1.15 2007/09/30 16:56:11 jenglish Exp # # DERIVED FROM: tk/library/entry.tcl r1.22 # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 2004, Joe English # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # namespace eval ttk { namespace eval entry { variable State set State(x) 0 set State(selectMode) char set State(anchor) 0 set State(scanX) 0 set State(scanIndex) 0 set State(scanMoved) 0 # Button-2 scan speed is (scanNum/scanDen) characters # per pixel of mouse movement. # The standard Tk entry widget uses the equivalent of # scanNum = 10, scanDen = average character width. # I don't know why that was chosen. # set State(scanNum) 1 set State(scanDen) 1 set State(deadband) 3 ;# #pixels for mouse-moved deadband. } } ### Bindings. # # Removed the following standard Tk bindings: # # , , # , : # Tile entry widget doesn't use selection anchor. # : # Inserts PRIMARY selection (on non-Windows platforms). # This is inconsistent with typical platform bindings. # , : # These don't do the right thing to start with. # , , , # , : # Judgment call. If happens to be assigned to the Alt key, # these could conflict with application accelerators. # (Plus, who has a Meta key these days?) # : # Another judgment call. If anyone misses this, let me know # and I'll put it back. # ## Clipboard events: # bind TEntry <> { ttk::entry::Cut %W } bind TEntry <> { ttk::entry::Copy %W } bind TEntry <> { ttk::entry::Paste %W } bind TEntry <> { ttk::entry::Clear %W } ## Button1 bindings: # Used for selection and navigation. # bind TEntry { ttk::entry::Press %W %x } bind TEntry { ttk::entry::Shift-Press %W %x } bind TEntry { ttk::entry::Select %W %x word } bind TEntry { ttk::entry::Select %W %x line } bind TEntry { ttk::entry::Drag %W %x } bind TEntry { ttk::Repeatedly ttk::entry::AutoScroll %W } bind TEntry { ttk::CancelRepeat } bind TEntry { ttk::CancelRepeat } bind TEntry { %W instate {!readonly !disabled} { %W icursor @%x ; focus %W } } ## Button2 bindings: # Used for scanning and primary transfer. # Note: ButtonRelease-2 is mapped to <> in tk.tcl. # bind TEntry { ttk::entry::ScanMark %W %x } bind TEntry { ttk::entry::ScanDrag %W %x } bind TEntry { ttk::entry::ScanRelease %W %x } bind TEntry <> { ttk::entry::ScanRelease %W %x } ## Keyboard navigation bindings: # bind TEntry { ttk::entry::Move %W prevchar } bind TEntry { ttk::entry::Move %W nextchar } bind TEntry { ttk::entry::Move %W prevword } bind TEntry { ttk::entry::Move %W nextword } bind TEntry { ttk::entry::Move %W home } bind TEntry { ttk::entry::Move %W end } bind TEntry { ttk::entry::Extend %W prevchar } bind TEntry { ttk::entry::Extend %W nextchar } bind TEntry { ttk::entry::Extend %W prevword } bind TEntry { ttk::entry::Extend %W nextword } bind TEntry { ttk::entry::Extend %W home } bind TEntry { ttk::entry::Extend %W end } bind TEntry { %W selection range 0 end } bind TEntry { %W selection clear } bind TEntry <> { %W selection range 0 end; %W icursor end } ## Edit bindings: # bind TEntry { ttk::entry::Insert %W %A } bind TEntry { ttk::entry::Delete %W } bind TEntry { ttk::entry::Backspace %W } # Ignore all Alt, Meta, and Control keypresses unless explicitly bound. # Otherwise, the class binding will fire and insert the character. # Ditto for Escape, Return, and Tab. # bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} # Argh. Apparently on Windows, the NumLock modifier is interpreted # as a Command modifier. if {[tk windowingsystem] eq "aqua"} { bind TEntry {# nothing} } ## Additional emacs-like bindings: # bind TEntry { ttk::entry::Move %W home } bind TEntry { ttk::entry::Move %W prevchar } bind TEntry { ttk::entry::Delete %W } bind TEntry { ttk::entry::Move %W end } bind TEntry { ttk::entry::Move %W nextchar } bind TEntry { ttk::entry::Backspace %W } bind TEntry { %W delete insert end } ### Clipboard procedures. # ## EntrySelection -- Return the selected text of the entry. # Raises an error if there is no selection. # proc ttk::entry::EntrySelection {w} { set entryString [string range [$w get] [$w index sel.first] \ [expr {[$w index sel.last] - 1}]] if {[$w cget -show] ne ""} { return [string repeat [string index [$w cget -show] 0] \ [string length $entryString]] } return $entryString } ## Paste -- Insert clipboard contents at current insert point. # proc ttk::entry::Paste {w} { catch { set clipboard [::tk::GetSelection $w CLIPBOARD] PendingDelete $w $w insert insert $clipboard See $w insert } } ## Copy -- Copy selection to clipboard. # proc ttk::entry::Copy {w} { if {![catch {EntrySelection $w} selection]} { clipboard clear -displayof $w clipboard append -displayof $w $selection } } ## Clear -- Delete the selection. # proc ttk::entry::Clear {w} { catch { $w delete sel.first sel.last } } ## Cut -- Copy selection to clipboard then delete it. # proc ttk::entry::Cut {w} { Copy $w; Clear $w } ### Navigation procedures. # ## ClosestGap -- Find closest boundary between characters. # Returns the index of the character just after the boundary. # proc ttk::entry::ClosestGap {w x} { set pos [$w index @$x] set bbox [$w bbox $pos] if {$x - [lindex $bbox 0] > [lindex $bbox 2]/2} { incr pos } return $pos } ## See $index -- Make sure that the character at $index is visible. # proc ttk::entry::See {w {index insert}} { update idletasks ;# ensure scroll data up-to-date set c [$w index $index] # @@@ OR: check [$w index left] / [$w index right] if {$c < [$w index @0] || $c >= [$w index @[winfo width $w]]} { $w xview $c } } ## NextWord -- Find the next word position. # Note: The "next word position" follows platform conventions: # either the next end-of-word position, or the start-of-word # position following the next end-of-word position. # set ::ttk::entry::State(startNext) \ [string equal $tcl_platform(platform) "windows"] proc ttk::entry::NextWord {w start} { variable State set pos [tcl_endOfWord [$w get] [$w index $start]] if {$pos >= 0 && $State(startNext)} { set pos [tcl_startOfNextWord [$w get] $pos] } if {$pos < 0} { return end } return $pos } ## PrevWord -- Find the previous word position. # proc ttk::entry::PrevWord {w start} { set pos [tcl_startOfPreviousWord [$w get] [$w index $start]] if {$pos < 0} { return 0 } return $pos } ## RelIndex -- Compute character/word/line-relative index. # proc ttk::entry::RelIndex {w where {index insert}} { switch -- $where { prevchar { expr {[$w index $index] - 1} } nextchar { expr {[$w index $index] + 1} } prevword { PrevWord $w $index } nextword { NextWord $w $index } home { return 0 } end { $w index end } default { error "Bad relative index $index" } } } ## Move -- Move insert cursor to relative location. # Also clears the selection, if any, and makes sure # that the insert cursor is visible. # proc ttk::entry::Move {w where} { $w icursor [RelIndex $w $where] $w selection clear See $w insert } ### Selection procedures. # ## ExtendTo -- Extend the selection to the specified index. # # The other end of the selection (the anchor) is determined as follows: # # (1) if there is no selection, the anchor is the insert cursor; # (2) if the index is outside the selection, grow the selection; # (3) if the insert cursor is at one end of the selection, anchor the other end # (4) otherwise anchor the start of the selection # # The insert cursor is placed at the new end of the selection. # # Returns: selection anchor. # proc ttk::entry::ExtendTo {w index} { set index [$w index $index] set insert [$w index insert] # Figure out selection anchor: if {![$w selection present]} { set anchor $insert } else { set selfirst [$w index sel.first] set sellast [$w index sel.last] if { ($index < $selfirst) || ($insert == $selfirst && $index <= $sellast) } { set anchor $sellast } else { set anchor $selfirst } } # Extend selection: if {$anchor < $index} { $w selection range $anchor $index } else { $w selection range $index $anchor } $w icursor $index return $anchor } ## Extend -- Extend the selection to a relative position, show insert cursor # proc ttk::entry::Extend {w where} { ExtendTo $w [RelIndex $w $where] See $w } ### Button 1 binding procedures. # # Double-clicking followed by a drag enters "word-select" mode. # Triple-clicking enters "line-select" mode. # ## Press -- ButtonPress-1 binding. # Set the insertion cursor, claim the input focus, set up for # future drag operations. # proc ttk::entry::Press {w x} { variable State $w icursor [ClosestGap $w $x] $w selection clear $w instate !disabled { focus $w } # Set up for future drag, double-click, or triple-click. set State(x) $x set State(selectMode) char set State(anchor) [$w index insert] } ## Shift-Press -- Shift-ButtonPress-1 binding. # Extends the selection, sets anchor for future drag operations. # proc ttk::entry::Shift-Press {w x} { variable State focus $w set anchor [ExtendTo $w @$x] set State(x) $x set State(selectMode) char set State(anchor) $anchor } ## Select $w $x $mode -- Binding for double- and triple- clicks. # Selects a word or line (according to mode), # and sets the selection mode for subsequent drag operations. # proc ttk::entry::Select {w x mode} { variable State set cur [ClosestGap $w $x] switch -- $mode { word { WordSelect $w $cur $cur } line { LineSelect $w $cur $cur } char { # no-op } } set State(anchor) $cur set State(selectMode) $mode } ## Drag -- Button1 motion binding. # proc ttk::entry::Drag {w x} { variable State set State(x) $x DragTo $w $x } ## DragTo $w $x -- Extend selection to $x based on current selection mode. # proc ttk::entry::DragTo {w x} { variable State set cur [ClosestGap $w $x] switch $State(selectMode) { char { CharSelect $w $State(anchor) $cur } word { WordSelect $w $State(anchor) $cur } line { LineSelect $w $State(anchor) $cur } } } ## AutoScroll # Called repeatedly when the mouse is outside an entry window # with Button 1 down. Scroll the window left or right, # depending on where the mouse is, and extend the selection # according to the current selection mode. # # TODO: AutoScroll should repeat faster (50ms) than normal autorepeat. # TODO: Need a way for Repeat scripts to cancel themselves. # proc ttk::entry::AutoScroll {w} { variable State if {![winfo exists $w]} return set x $State(x) if {$x > [winfo width $w]} { $w xview scroll 2 units DragTo $w $x } elseif {$x < 0} { $w xview scroll -2 units DragTo $w $x } } ## CharSelect -- select characters between index $from and $to # proc ttk::entry::CharSelect {w from to} { if {$to <= $from} { $w selection range $to $from } else { $w selection range $from $to } $w icursor $to } ## WordSelect -- Select whole words between index $from and $to # proc ttk::entry::WordSelect {w from to} { if {$to < $from} { set first [WordBack [$w get] $to] set last [WordForward [$w get] $from] $w icursor $first } else { set first [WordBack [$w get] $from] set last [WordForward [$w get] $to] $w icursor $last } $w selection range $first $last } ## WordBack, WordForward -- helper routines for WordSelect. # proc ttk::entry::WordBack {text index} { if {[set pos [tcl_wordBreakBefore $text $index]] < 0} { return 0 } return $pos } proc ttk::entry::WordForward {text index} { if {[set pos [tcl_wordBreakAfter $text $index]] < 0} { return end } return $pos } ## LineSelect -- Select the entire line. # proc ttk::entry::LineSelect {w _ _} { variable State $w selection range 0 end $w icursor end } ### Button 2 binding procedures. # ## ScanMark -- ButtonPress-2 binding. # Marks the start of a scan or primary transfer operation. # proc ttk::entry::ScanMark {w x} { variable State set State(scanX) $x set State(scanIndex) [$w index @0] set State(scanMoved) 0 } ## ScanDrag -- Button2 motion binding. # proc ttk::entry::ScanDrag {w x} { variable State set dx [expr {$State(scanX) - $x}] if {abs($dx) > $State(deadband)} { set State(scanMoved) 1 } set left [expr {$State(scanIndex) + ($dx*$State(scanNum))/$State(scanDen)}] $w xview $left if {$left != [set newLeft [$w index @0]]} { # We've scanned past one end of the entry; # reset the mark so that the text will start dragging again # as soon as the mouse reverses direction. # set State(scanX) $x set State(scanIndex) $newLeft } } ## ScanRelease -- Button2 release binding. # Do a primary transfer if the mouse has not moved since the button press. # proc ttk::entry::ScanRelease {w x} { variable State if {!$State(scanMoved)} { $w instate {!disabled !readonly} { $w icursor [ClosestGap $w $x] catch {$w insert insert [::tk::GetSelection $w PRIMARY]} } } } ### Insertion and deletion procedures. # ## PendingDelete -- Delete selection prior to insert. # If the entry currently has a selection, delete it and # set the insert position to where the selection was. # Returns: 1 if pending delete occurred, 0 if nothing was selected. # proc ttk::entry::PendingDelete {w} { if {[$w selection present]} { $w icursor sel.first $w delete sel.first sel.last return 1 } return 0 } ## Insert -- Insert text into the entry widget. # If a selection is present, the new text replaces it. # Otherwise, the new text is inserted at the insert cursor. # proc ttk::entry::Insert {w s} { if {$s eq ""} { return } PendingDelete $w $w insert insert $s See $w insert } ## Backspace -- Backspace over the character just before the insert cursor. # If there is a selection, delete that instead. # If the new insert position is offscreen to the left, # scroll to place the cursor at about the middle of the window. # proc ttk::entry::Backspace {w} { if {[PendingDelete $w]} { See $w return } set x [expr {[$w index insert] - 1}] if {$x < 0} { return } $w delete $x if {[$w index @0] >= [$w index insert]} { set range [$w xview] set left [lindex $range 0] set right [lindex $range 1] $w xview moveto [expr {$left - ($right - $left)/2.0}] } } ## Delete -- Delete the character after the insert cursor. # If there is a selection, delete that instead. # proc ttk::entry::Delete {w} { if {![PendingDelete $w]} { $w delete insert } } #*EOF* tile-0.8.2/library/fonts.tcl0000644000076500007650000001227710726163556015371 0ustar joejoe00000000000000# # fonts.tcl,v 1.16 2007/12/07 06:25:50 jenglish Exp # # Font specifications. # # This file, [source]d at initialization time, sets up the following # symbolic fonts based on the current platform: # # TkDefaultFont -- default for GUI items not otherwise specified # TkTextFont -- font for user text (entry, listbox, others) # TkFixedFont -- standard fixed width font # TkHeadingFont -- headings (column headings, etc) # TkCaptionFont -- dialog captions (primary text in alert dialogs, etc.) # TkTooltipFont -- font to use for tooltip windows # TkIconFont -- font to use for icon captions # TkMenuFont -- used to use for menu items # # In Tk 8.5, some of these fonts may be provided by the TIP#145 implementation # (On Windows and Mac OS X as of Oct 2007). # # The TIP, fonts(n) manpage, and implementation do not as of yet agree. # # +++ Platform notes: # # Windows: # The default system font changed from "MS Sans Serif" to "Tahoma" # in Windows XP/Windows 2000. # # MS documentation says to use "Tahoma 8" in Windows 2000/XP, # although many MS programs still use "MS Sans Serif 8" # # Should use SystemParametersInfo() instead. # # Mac OSX / Aqua: # Quoth the Apple HIG: # The _system font_ (Lucida Grande Regular 13 pt) is used for text # in menus, dialogs, and full-size controls. # [...] Use the _view font_ (Lucida Grande Regular 12pt) as the default # font of text in lists and tables. # [...] Use the _emphasized system font_ (Lucida Grande Bold 13 pt) # sparingly. It is used for the message text in alerts. # [...] The _small system font_ (Lucida Grande Regular 11 pt) [...] # is also the default font for column headings in lists, for help tags, # and for small controls. # # That document lies, however (see #780617). The font sizes # used below reflect what GetThemeFont() returns. # # Note that the font for column headings (TkHeadingFont) is # _smaller_ than the default font. # # There does not appear to be any recommendations for fixed-width fonts. # # Mac classic: # Don't know, can't find *anything* on the Web about Mac pre-OSX. # Might have used Geneva. Doesn't matter, this platform # isn't supported anymore anyway. # # X11: # Need a way to tell if Xft is enabled or not. # For now, assume patch #971980 applied. # # "Classic" look used Helvetica bold for everything except # for entry widgets, which use Helvetica medium. # Most other toolkits use medium weight for all UI elements, # which is what we do now. # # Font size specified in pixels on X11, not points. # This is Theoretically Wrong, but in practice works better; using # points leads to huge inconsistencies across different servers. # namespace eval ttk { catch {font create TkDefaultFont} catch {font create TkTextFont} catch {font create TkHeadingFont} catch {font create TkCaptionFont} catch {font create TkTooltipFont} catch {font create TkFixedFont} catch {font create TkIconFont} catch {font create TkMenuFont} variable F ;# miscellaneous platform-specific font parameters switch -- [tk windowingsystem] { win32 { if {$tcl_platform(osVersion) >= 5.0} { set F(family) "Tahoma" } else { set F(family) "MS Sans Serif" } set F(size) 8 font configure TkDefaultFont -family $F(family) -size $F(size) font configure TkTextFont -family $F(family) -size $F(size) font configure TkHeadingFont -family $F(family) -size $F(size) font configure TkCaptionFont -family $F(family) -size $F(size) \ -weight bold font configure TkTooltipFont -family $F(family) -size $F(size) font configure TkFixedFont -family Courier -size 10 font configure TkIconFont -family $F(family) -size $F(size) font configure TkMenuFont -family $F(family) -size $F(size) } aqua { set F(family) "Lucida Grande" set F(fixed) "Monaco" set F(menusize) 14 set F(size) 13 set F(viewsize) 12 set F(smallsize) 11 set F(fixedsize) 11 font configure TkDefaultFont -family $F(family) -size $F(size) font configure TkTextFont -family $F(family) -size $F(size) font configure TkHeadingFont -family $F(family) -size $F(smallsize) font configure TkCaptionFont -family $F(family) -size $F(size) \ -weight bold font configure TkTooltipFont -family $F(family) -size $F(smallsize) font configure TkFixedFont -family $F(fixed) -size $F(fixedsize) font configure TkIconFont -family $F(family) -size $F(size) font configure TkMenuFont -family $F(family) -size $F(menusize) } default - x11 { if {![catch {tk::pkgconfig get fontsystem} F(fs)] && $F(fs) eq "xft"} { set F(family) "sans-serif" set F(fixed) "monospace" } else { set F(family) "Helvetica" set F(fixed) "courier" } set F(size) -12 set F(ttsize) -10 set F(capsize) -14 set F(fixedsize) -12 font configure TkDefaultFont -family $F(family) -size $F(size) font configure TkTextFont -family $F(family) -size $F(size) font configure TkHeadingFont -family $F(family) -size $F(size) \ -weight bold font configure TkCaptionFont -family $F(family) -size $F(capsize) \ -weight bold font configure TkTooltipFont -family $F(family) -size $F(ttsize) font configure TkFixedFont -family $F(fixed) -size $F(fixedsize) font configure TkIconFont -family $F(family) -size $F(size) font configure TkMenuFont -family $F(family) -size $F(size) } } unset -nocomplain F } #*EOF* tile-0.8.2/library/icons.tcl0000644000076500007650000000736410523645322015343 0ustar joejoe00000000000000# # icons.tcl,v 1.4 2006/11/06 14:46:42 jenglish Exp # # Tile package -- stock icons. # # Usage: # $w configure -image [ttk::stockIcon $context/$icon] # # At present, only includes icons for dialog boxes, # dialog/info, dialog/warning, dialog/error, etc. # # This list should be expanded. # # See the Icon Naming Specification from the Tango project: # http://standards.freedesktop.org/icon-naming-spec/ # They've finally gotten around to publishing something. # namespace eval ttk { variable Icons ;# Map: icon name -> image namespace eval icons {} ;# container namespace for images } # stockIcon $name -- # Returns a Tk image for built-in icon $name. # proc ttk::stockIcon {name} { variable Icons return $Icons($name) } # defineImage -- # Define a new stock icon. # proc ttk::defineImage {name args} { variable Icons set iconName ::ttk::icons::$name eval [linsert $args 0 image create photo $iconName] set Icons($name) $iconName } # # Stock icons for dialogs # # SOURCE: dialog icons taken from BWidget toolkit. # ttk::defineImage dialog/error -data { R0lGODlhIAAgALMAAIQAAISEhPf/Mf8AAP////////////////////////// /////////////////////yH5BAEAAAIALAAAAAAgACAAAASwUMhJBbj41s0n HmAIYl0JiCgKlNWVvqHGnnA9mnY+rBytw4DAxhci2IwqoSdFaMKaSBFPQhxA nahrdKS0MK8ibSoorBbBVvS4XNOKgey2e7sOmLPvGvkezsPtR3M2e3JzdFIB gC9vfohxfVCQWI6PII1pkZReeIeWkzGJS1lHdV2bPy9koaKopUOtSatDfECq phWKOra3G3YuqReJwiwUiRkZwsPEuMnNycslzrIdEQAAOw== } ttk::defineImage dialog/info -data { R0lGODlhIAAgALMAAAAAAAAA/4SEhMbGxvf/Mf////////////////////// /////////////////////yH5BAEAAAQALAAAAAAgACAAAAStkMhJibj41s0n HkUoDljXXaCoqqRgUkK6zqP7CvQQ7IGsAiYcjcejFYAb4ZAYMB4rMaeO51sN kBKlc/uzRbng0NWlnTF3XAAZzExj2ET3BV7cqufctv2Tj0vvFn11RndkVSt6 OYVZRmeDXRoTAGFOhTaSlDOWHACHW2MlHQCdYFebN6OkVqkZlzcXqTKWoS8w GJMhs7WoIoC7v7i+v7uTwsO1o5HHu7TLtcodEQAAOw== } ttk::defineImage dialog/question -data { R0lGODlhIAAgALMAAAAAAAAA/4SEhMbGxvf/Mf////////////////////// /////////////////////yH5BAEAAAQALAAAAAAgACAAAAS2kMhJibj41s0n HkUoDljXXaCoqqRgUkK6zqP7CnS+AiY+D4GgUKbibXwrYEoYIIqMHmcoqGLS BlBLzlrgzgC22FZYAJKvYG3ODPLS0khd+awDX+Qieh2Dnzb7dnE6VIAffYdl dmo6bHiBFlJVej+PizRuXyUTAIxBkSGBNpuImZoVAJ9roSYAqH1Yqzetrkmz GaI3F7MyoaYvHhicoLe/sk8axcnCisnKBczNxa3I0cW+1bm/EQAAOw== } ttk::defineImage dialog/warning -data { R0lGODlhIAAgALMAAAAAAISEAISEhMbGxv//AP////////////////////// /////////////////////yH5BAEAAAUALAAAAAAgACAAAASrsMhJZ7g16y0D IQPAjZr3gYBAroV5piq7uWcoxHJFv3eun0BUz9cJAmHElhFow8lcIQBgwHOu aNJsDfk8ZgHH4TX4BW/Fo12ZjJ4Z10wuZ0cIZOny0jI6NTbnSwRaS3kUdCd2 h0JWRYEhVIGFSoEfZo6FipRvaJkfUZB7cp2Cg5FDo6RSmn+on5qCPaivYTey s4sqtqswp2W+v743whTCxcbHyG0FyczJEhEAADs= } ttk::defineImage dialog/auth -data { R0lGODlhIAAgAIQAAAAA/wAAAICAgICAAP///7CwsMDAwMjIAPjIAOjo6Pj4 AODg4HBwcMj4ANjY2JiYANDQ0MjIyPj4yKCgoMiYAMjImDAwAMjIMJiYmJCQ kAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAgACAAAAX+ICCOYmCa ZKquZCCMQsDOqWC7NiAMvEyvAoLQVdgZCAfEAPWDERIJk8AwIJwUil5T91y4 GC6ry4RoKH2zYGLhnS5tMUNAcaAvaUF2m1A9GeQIAQeDaEAECw6IJlVYAmAK AWZJD3gEDpeXOwRYnHOCCgcPhTWWDhAQQYydkGYIoaOkp6h8m1ieSYOvP0ER EQwEEap0dWagok1BswmMdbiursfIBHnBQs10oKF30tQ8QkISuAcB25UGQQ4R EzzsA4MU4+WGBkXo6hMTMQADFQfwFtHmFSlCAEKEU2jc+YsHy8nAML4iJKzQ Dx65hiWKTIA4pRC7CxblORRA8E/HFfxfQo4KUiBfPgL0SDbkV0ElKZcmEjwE wqPCgwMiAQTASQDDzhkD4IkMkg+DiwU4aSTVQiIIBgFXE+ATsPHHCRVWM8QI oJUrxi04TCzA0PQsWh9kMVx1u6UFA3116zLJGwIAOw== } ttk::defineImage dialog/busy -data { R0lGODlhIAAgALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/ AP//AAAA//8A/wD//////yH5BAEAAAsALAAAAAAgACAAAASAcMlJq7046827 /2AYBmRpkoC4BMlzvEkspypg3zitIsfjvgcEQifi+X7BoUpi9AGFxFATCV0u eMEDQFu1GrdbpZXZC0e9LvF4gkifl8aX2tt7bIPvz/Q5l9btcn0gTWBJeR1G bWBdO0EPPIuHHDmUSyxIMjM1lJVrnp+goaIfEQAAOw== } #*EOF* tile-0.8.2/library/keynav.tcl0000644000076500007650000001240510415536750015521 0ustar joejoe00000000000000######################################################################## # keynav package - Enhanced keyboard navigation # Copyright (C) 2003 Joe English # Freely redistributable; see the file license.terms for details. # # keynav.tcl,v 1.8 2006/04/07 19:30:48 jenglish Exp # ######################################################################## # # Usage: # # package require keynav # # keynav::enableMnemonics $toplevel -- # Enable mnemonic accelerators for toplevel widget. # Pressing Alt-K, where K is any alphanumeric key, # will send an <> event to the widget with # mnemonic K (as determined by the -underline and -text # options). # # Side effects: adds a binding for to $toplevel # # keynav::defaultButton $button -- # Enables default activation for the toplevel window # in which $button appears. Pressing invokes # the default widget. The default widget is set to # the widget with keyboard focus if it is defaultable, # otherwise $button. A widget is _defaultable_ # if it has a -default option which is not set to # "disabled". # # Side effects: adds and bindings # to the toplevel containing $button, and a binding # to $button. # # $button must be a defaultable widget. # namespace eval keynav {} package require Tcl 8.4 package require Tk 8.4 package provide keynav 1.0 event add <> # # Bindings for stock Tk widgets: # (NB: for 8.3 use tkButtonInvoke, tkMbPost instead) # bind Button <> { tk::ButtonInvoke %W } bind Checkbutton <> { tk::ButtonInvoke %W } bind Radiobutton <> { tk::ButtonInvoke %W } bind Menubutton <> { tk::MbPost %W } proc keynav::enableMnemonics {w} { bind [winfo toplevel $w] {+ keynav::Alt-KeyPress %W %K } } # mnemonic $w -- # Return the mnemonic character for widget $w, # as determined by the -text and -underline resources. # proc keynav::mnemonic {w} { if {[catch { set label [$w cget -text] set underline [$w cget -underline] }]} { return "" } return [string index $label $underline] } # FindMnemonic $w $key -- # Locate the descendant of $w with mnemonic $key. # proc keynav::FindMnemonic {w key} { if {[string length $key] != 1} { return } set Q [list [set top [winfo toplevel $w]]] while {[llength $Q]} { set QN [list] foreach w $Q { if {[string equal -nocase $key [mnemonic $w]]} { return $w } foreach c [winfo children $w] { if {[winfo ismapped $c] && [winfo toplevel $c] eq $top} { lappend QN $c } } } set Q $QN } return {} } # Alt-KeyPress -- # Alt-KeyPress binding for toplevels with mnemonic accelerators enabled. # proc keynav::Alt-KeyPress {w k} { set w [FindMnemonic $w $k] if {$w ne ""} { event generate $w <> return -code break } } # defaultButton $w -- # Enable default activation for the toplevel containing $w, # and make $w the default default widget. # proc keynav::defaultButton {w} { variable DefaultButton $w configure -default active set top [winfo toplevel $w] set DefaultButton(current.$top) $w set DefaultButton(default.$top) $w bind $w [list keynav::CleanupDefault $top] bind $top [list keynav::ClaimDefault $top %W] bind $top [list keynav::ActivateDefault $top] } proc keynav::CleanupDefault {top} { variable DefaultButton unset DefaultButton(current.$top) unset DefaultButton(default.$top) } # ClaimDefault $top $w -- # binding for default activation. # Sets the default widget to $w if it is defaultable, # otherwise set it to the default default. # proc keynav::ClaimDefault {top w} { variable DefaultButton if {![info exists DefaultButton(current.$top)]} { # Someone destroyed the default default, but not # the rest of the toplevel. return; } set default $DefaultButton(default.$top) if {![catch {$w cget -default} dstate] && $dstate ne "disabled"} { set default $w } if {$default ne $DefaultButton(current.$top)} { # Ignore errors -- someone may have destroyed the current default catch { $DefaultButton(current.$top) configure -default normal } $default configure -default active set DefaultButton(current.$top) $default } } # ActivateDefault -- # Invoke the default widget for toplevel window, if any. # proc keynav::ActivateDefault {top} { variable DefaultButton if { [info exists DefaultButton(current.$top)] && [winfo exists $DefaultButton(current.$top)] } { event generate $DefaultButton(current.$top) <> } } # traverseTo $w -- # Set the keyboard focus to the specified window, # sending <> and <> virtual events # as per TIP #204. # proc keynav::traverseTo {w} { set focus [focus] if {$focus ne ""} { event generate $focus <> } focus $w event generate $w <> } # # Provide TIP #204 functionality if we're running 8.4: # if {![package vsatisfies [package provide Tk] 8.5]} { bind all { keynav::traverseTo [tk_focusNext %W] ; break} bind all <> { keynav::traverseTo [tk_focusPrev %W] } bind Entry <> { %W selection range 0 end; %W icursor end } bind Spinbox <> { %W selection range 0 end; %W icursor end } } #*EOF* tile-0.8.2/library/menubutton.tcl0000644000076500007650000001152210472135267016424 0ustar joejoe00000000000000# # menubutton.tcl,v 1.8 2006/08/20 19:40:39 jenglish Exp # # Bindings for Menubuttons. # # Menubuttons have three interaction modes: # # Pulldown: Press menubutton, drag over menu, release to activate menu entry # Popdown: Click menubutton to post menu # Keyboard: or accelerator key to post menu # # (In addition, when menu system is active, "dropdown" -- menu posts # on mouse-over. Tile menubuttons don't implement this). # # For keyboard and popdown mode, we hand off to tk_popup and let # the built-in Tk bindings handle the rest of the interaction. # # ON X11: # # Standard Tk menubuttons use a global grab on the menubutton. # This won't work for Tile menubuttons in pulldown mode, # since we need to process the final event, # and this might be delivered to the menu. So instead we # rely on the passive grab that occurs on events, # and transition to popdown mode when the mouse is released # or dragged outside the menubutton. # # ON WINDOWS: # # I'm not sure what the hell is going on here. [$menu post] apparently # sets up some kind of internal grab for native menus. # On this platform, just use [tk_popup] for all menu actions. # # ON MACOS: # # Same probably applies here. # namespace eval ttk { namespace eval menubutton { variable State array set State { pulldown 0 oldcursor {} } } } bind TMenubutton { %W instate !disabled {%W state active } } bind TMenubutton { %W state !active } bind TMenubutton { ttk::menubutton::Popdown %W } bind TMenubutton <> { ttk::menubutton::Popdown %W } if {[tk windowingsystem] eq "x11"} { bind TMenubutton { ttk::menubutton::Pulldown %W } bind TMenubutton { ttk::menubutton::TransferGrab %W } bind TMenubutton { ttk::menubutton::TransferGrab %W } } else { bind TMenubutton \ { %W state pressed ; ttk::menubutton::Popdown %W } bind TMenubutton \ { %W state !pressed } } # PostPosition -- # Returns the x and y coordinates where the menu # should be posted, based on the menubutton and menu size # and -direction option. # # TODO: adjust menu width to be at least as wide as the button # for -direction above, below. # proc ttk::menubutton::PostPosition {mb menu} { set x [winfo rootx $mb] set y [winfo rooty $mb] set dir [$mb cget -direction] set bw [winfo width $mb] set bh [winfo height $mb] set mw [winfo reqwidth $menu] set mh [winfo reqheight $menu] set sw [expr {[winfo screenwidth $menu] - $bw - $mw}] set sh [expr {[winfo screenheight $menu] - $bh - $mh}] switch -- $dir { above { if {$y >= $mh} { incr y -$mh } { incr y $bh } } below { if {$y <= $sh} { incr y $bh } { incr y -$mh } } left { if {$x >= $mw} { incr x -$mw } { incr x $bw } } right { if {$x <= $sw} { incr x $bw } { incr x -$mw } } flush { # post menu atop menubutton. # If there's a menu entry whose label matches the # menubutton -text, assume this is an optionmenu # and place that entry over the menubutton. set index [FindMenuEntry $menu [$mb cget -text]] if {$index ne ""} { incr y -[$menu yposition $index] } } } return [list $x $y] } # Popdown -- # Post the menu and set a grab on the menu. # proc ttk::menubutton::Popdown {mb} { if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} { return } foreach {x y} [PostPosition $mb $menu] { break } tk_popup $menu $x $y } # Pulldown (X11 only) -- # Called when Button1 is pressed on a menubutton. # Posts the menu; a subsequent ButtonRelease # or Leave event will set a grab on the menu. # proc ttk::menubutton::Pulldown {mb} { variable State if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} { return } foreach {x y} [PostPosition $mb $menu] { break } set State(pulldown) 1 set State(oldcursor) [$mb cget -cursor] $mb state pressed $mb configure -cursor [$menu cget -cursor] $menu post $x $y tk_menuSetFocus $menu } # TransferGrab (X11 only) -- # Switch from pulldown mode (menubutton has an implicit grab) # to popdown mode (menu has an explicit grab). # proc ttk::menubutton::TransferGrab {mb} { variable State if {$State(pulldown)} { $mb configure -cursor $State(oldcursor) $mb state {!pressed !active} set State(pulldown) 0 set menu [$mb cget -menu] tk_popup $menu [winfo rootx $menu] [winfo rooty $menu] } } # FindMenuEntry -- # Hack to support tk_optionMenus. # Returns the index of the menu entry with a matching -label, # -1 if not found. # proc ttk::menubutton::FindMenuEntry {menu s} { set last [$menu index last] if {$last eq "none"} { return "" } for {set i 0} {$i <= $last} {incr i} { if {![catch {$menu entrycget $i -label} label] && ($label eq $s)} { return $i } } return "" } #*EOF* tile-0.8.2/library/notebook.tcl0000644000076500007650000001245010570620642016040 0ustar joejoe00000000000000# # notebook.tcl,v 1.24 2007/02/26 18:06:26 hobbs Exp # # Bindings for TNotebook widget # namespace eval ttk::notebook { variable TLNotebooks ;# See enableTraversal } bind TNotebook { ttk::notebook::Press %W %x %y } bind TNotebook { ttk::notebook::CycleTab %W 1; break } bind TNotebook { ttk::notebook::CycleTab %W -1; break } bind TNotebook { ttk::notebook::CycleTab %W 1; break } bind TNotebook { ttk::notebook::CycleTab %W -1; break } catch { bind TNotebook { ttk::notebook::CycleTab %W -1; break } } bind TNotebook { ttk::notebook::Cleanup %W } # ActivateTab $nb $tab -- # Select the specified tab and set focus. # # If $tab was already the current tab, set the focus to the # notebook widget. Otherwise, set the focus to the first # traversable widget in the pane. The behavior is that the # notebook takes focus when the user selects the same tab # a second time. This mirrors Windows tab behavior. # proc ttk::notebook::ActivateTab {w tab} { if {[$w index $tab] eq [$w index current]} { focus $w } else { $w select $tab update ;# needed so focus logic sees correct mapped/unmapped states if {[set f [ttk::focusFirst [$w select]]] ne ""} { ttk::traverseTo $f } } } # Press $nb $x $y -- # ButtonPress-1 binding for notebook widgets. # Activate the tab under the mouse cursor, if any. # proc ttk::notebook::Press {w x y} { set index [$w index @$x,$y] if {$index ne ""} { ActivateTab $w $index } } # CycleTab -- # Select the next/previous tab in the list. # proc ttk::notebook::CycleTab {w dir} { if {[$w index end] != 0} { set current [$w index current] set select [expr {($current + $dir) % [$w index end]}] while {[$w tab $select -state] != "normal" && ($select != $current)} { set select [expr {($select + $dir) % [$w index end]}] } if {$select != $current} { ActivateTab $w $select } } } # MnemonicTab $nb $key -- # Scan all tabs in the specified notebook for one with the # specified mnemonic. If found, returns path name of tab; # otherwise returns "" # proc ttk::notebook::MnemonicTab {nb key} { set key [string toupper $key] foreach tab [$nb tabs] { set label [$nb tab $tab -text] set underline [$nb tab $tab -underline] set mnemonic [string toupper [string index $label $underline]] if {$mnemonic ne "" && $mnemonic eq $key} { return $tab } } return "" } # +++ Toplevel keyboard traversal. # # enableTraversal -- # Enable keyboard traversal for a notebook widget # by adding bindings to the containing toplevel window. # # TLNotebooks($top) keeps track of the list of all traversal-enabled # notebooks contained in the toplevel # proc ttk::notebook::enableTraversal {nb} { variable TLNotebooks set top [winfo toplevel $nb] if {![info exists TLNotebooks($top)]} { # Augment $top bindings: # bind $top {+ttk::notebook::TLCycleTab %W 1} bind $top {+ttk::notebook::TLCycleTab %W -1} catch { bind $top {+ttk::notebook::TLCycleTab %W -1} } if {[tk windowingsystem] eq "aqua"} { bind $top \ +[list ttk::notebook::MnemonicActivation $top %K] } else { bind $top \ +[list ttk::notebook::MnemonicActivation $top %K] } bind $top {+ttk::notebook::TLCleanup %W} } lappend TLNotebooks($top) $nb } # TLCleanup -- binding for traversal-enabled toplevels # proc ttk::notebook::TLCleanup {w} { variable TLNotebooks if {$w eq [winfo toplevel $w]} { unset -nocomplain -please TLNotebooks($w) } } # Cleanup -- binding for notebooks # proc ttk::notebook::Cleanup {nb} { variable TLNotebooks set top [winfo toplevel $nb] if {[info exists TLNotebooks($top)]} { set index [lsearch -exact $TLNotebooks($top) $nb] set TLNotebooks($top) [lreplace $TLNotebooks($top) $index $index] } } # EnclosingNotebook $w -- # Return the nearest traversal-enabled notebook widget # that contains $w. # # BUGS: this only works properly for tabs that are direct children # of the notebook widget. This routine should follow the # geometry manager hierarchy, not window ancestry, but that # information is not available in Tk. # proc ttk::notebook::EnclosingNotebook {w} { variable TLNotebooks set top [winfo toplevel $w] if {![info exists TLNotebooks($top)]} { return } while {$w ne $top && $w ne ""} { if {[lsearch -exact $TLNotebooks($top) $w] >= 0} { return $w } set w [winfo parent $w] } return "" } # TLCycleTab -- # toplevel binding procedure for Control-Tab / Shift-Control-Tab # Select the next/previous tab in the nearest ancestor notebook. # proc ttk::notebook::TLCycleTab {w dir} { set nb [EnclosingNotebook $w] if {$nb ne ""} { CycleTab $nb $dir return -code break } } # MnemonicActivation $nb $key -- # Alt-KeyPress binding procedure for mnemonic activation. # Scan all notebooks in specified toplevel for a tab with the # the specified mnemonic. If found, activate it and return TCL_BREAK. # proc ttk::notebook::MnemonicActivation {top key} { variable TLNotebooks foreach nb $TLNotebooks($top) { if {[set tab [MnemonicTab $nb $key]] ne ""} { ActivateTab $nb [$nb index $tab] return -code break } } } tile-0.8.2/library/paned.tcl0000644000076500007650000000377010632617617015323 0ustar joejoe00000000000000# # paned.tcl,v 1.5 2007/06/09 21:45:51 jenglish Exp # # Bindings for ttk::panedwindow widget. # namespace eval ttk::panedwindow { variable State array set State { pressed 0 pressX - pressY - sash - sashPos - } } ## Bindings: # bind TPanedwindow { ttk::panedwindow::Press %W %x %y } bind TPanedwindow { ttk::panedwindow::Drag %W %x %y } bind TPanedwindow { ttk::panedwindow::Release %W %x %y } bind TPanedwindow { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow { ttk::panedwindow::ResetCursor %W } # See <> bind TPanedwindow <> { ttk::panedwindow::ResetCursor %W } ## Sash movement: # proc ttk::panedwindow::Press {w x y} { variable State set sash [$w identify $x $y] if {$sash eq ""} { set State(pressed) 0 return } set State(pressed) 1 set State(pressX) $x set State(pressY) $y set State(sash) $sash set State(sashPos) [$w sashpos $sash] } proc ttk::panedwindow::Drag {w x y} { variable State if {!$State(pressed)} { return } switch -- [$w cget -orient] { horizontal { set delta [expr {$x - $State(pressX)}] } vertical { set delta [expr {$y - $State(pressY)}] } } $w sashpos $State(sash) [expr {$State(sashPos) + $delta}] } proc ttk::panedwindow::Release {w x y} { variable State set State(pressed) 0 SetCursor $w $x $y } ## Cursor management: # proc ttk::panedwindow::ResetCursor {w} { variable State if {!$State(pressed)} { $w configure -cursor {} } } proc ttk::panedwindow::SetCursor {w x y} { variable ::ttk::Cursors if {![llength [$w identify $x $y]]} { ResetCursor $w } else { # Assume we're over a sash. switch -- [$w cget -orient] { horizontal { $w configure -cursor $Cursors(hresize) } vertical { $w configure -cursor $Cursors(vresize) } } } } #*EOF* tile-0.8.2/library/progress.tcl0000644000076500007650000000217210362736361016071 0ustar joejoe00000000000000# # progress.tcl,v 1.5 2006/01/16 15:34:09 jenglish Exp # # Tile widget set: progress bar utilities. # namespace eval ttk::progressbar { variable Timers ;# Map: widget name -> after ID } # Autoincrement -- # Periodic callback procedure for autoincrement mode # proc ttk::progressbar::Autoincrement {pb steptime stepsize} { variable Timers if {![winfo exists $pb]} { # widget has been destroyed -- cancel timer unset -nocomplain Timers($pb) return } $pb step $stepsize set Timers($pb) [after $steptime \ [list ttk::progressbar::Autoincrement $pb $steptime $stepsize] ] } # ttk::progressbar::start -- # Start autoincrement mode. Invoked by [$pb start] widget code. # proc ttk::progressbar::start {pb {steptime 50} {stepsize 1}} { variable Timers if {![info exists Timers($pb)]} { Autoincrement $pb $steptime $stepsize } } # ttk::progressbar::stop -- # Cancel autoincrement mode. Invoked by [$pb stop] widget code. # proc ttk::progressbar::stop {pb} { variable Timers if {[info exists Timers($pb)]} { after cancel $Timers($pb) unset Timers($pb) } $pb configure -value 0 } tile-0.8.2/library/scale.tcl0000644000076500007650000000222310523430060015273 0ustar joejoe00000000000000# scale.tcl - Copyright (C) 2004 Pat Thoyts # # Bindings for the TScale widget # # scale.tcl,v 1.11 2006/11/05 18:40:48 jenglish Exp namespace eval ttk::scale { variable State array set State { dragging 0 } } bind TScale { ttk::scale::Press %W %x %y } bind TScale { ttk::scale::Drag %W %x %y } bind TScale { ttk::scale::Release %W %x %y } proc ttk::scale::Press {w x y} { variable State set State(dragging) 0 switch -glob -- [$w identify $x $y] { *track - *trough { if {[$w get $x $y] <= [$w get]} { ttk::Repeatedly Increment $w -1 } else { ttk::Repeatedly Increment $w 1 } } *slider { set State(dragging) 1 set State(initial) [$w get] } } } proc ttk::scale::Drag {w x y} { variable State if {$State(dragging)} { $w set [$w get $x $y] } } proc ttk::scale::Release {w x y} { variable State set State(dragging) 0 ttk::CancelRepeat } proc ttk::scale::Increment {w delta} { if {![winfo exists $w]} return $w set [expr {[$w get] + $delta}] } tile-0.8.2/library/scrollbar.tcl0000644000076500007650000000613710730010766016206 0ustar joejoe00000000000000# # scrollbar.tcl,v 1.19 2007/12/12 16:53:10 jenglish Exp # # Bindings for TScrollbar widget # # Still don't have a working ttk::scrollbar under OSX - # Swap in a [tk::scrollbar] on that platform, # unless user specifies -class or -style. # if {[tk windowingsystem] eq "aqua"} { rename ::ttk::scrollbar ::ttk::_scrollbar_ proc ttk::scrollbar {w args} { set constructor ::scrollbar foreach {option _} $args { if {$option eq "-class" || $option eq "-style"} { set constructor ::ttk::_scrollbar_ break } } return [eval [linsert $args 0 $constructor $w]] } } namespace eval ttk::scrollbar { variable State # State(xPress) -- # State(yPress) -- initial position of mouse at start of drag. # State(first) -- value of -first at start of drag. } bind TScrollbar { ttk::scrollbar::Press %W %x %y } bind TScrollbar { ttk::scrollbar::Drag %W %x %y } bind TScrollbar { ttk::scrollbar::Release %W %x %y } bind TScrollbar { ttk::scrollbar::Jump %W %x %y } bind TScrollbar { ttk::scrollbar::Drag %W %x %y } bind TScrollbar { ttk::scrollbar::Release %W %x %y } proc ttk::scrollbar::Scroll {w n units} { set cmd [$w cget -command] if {$cmd ne ""} { uplevel #0 $cmd scroll $n $units } } proc ttk::scrollbar::Moveto {w fraction} { set cmd [$w cget -command] if {$cmd ne ""} { uplevel #0 $cmd moveto $fraction } } proc ttk::scrollbar::Press {w x y} { variable State set State(xPress) $x set State(yPress) $y switch -glob -- [$w identify $x $y] { *uparrow - *leftarrow { ttk::Repeatedly Scroll $w -1 units } *downarrow - *rightarrow { ttk::Repeatedly Scroll $w 1 units } *thumb { set State(first) [lindex [$w get] 0] } *trough { set f [$w fraction $x $y] if {$f < [lindex [$w get] 0]} { # Clicked in upper/left trough ttk::Repeatedly Scroll $w -1 pages } elseif {$f > [lindex [$w get] 1]} { # Clicked in lower/right trough ttk::Repeatedly Scroll $w 1 pages } else { # Clicked on thumb (???) set State(first) [lindex [$w get] 0] } } } } proc ttk::scrollbar::Drag {w x y} { variable State if {![info exists State(first)]} { # Initial buttonpress was not on the thumb, # or something screwy has happened. In either case, ignore: return; } set xDelta [expr {$x - $State(xPress)}] set yDelta [expr {$y - $State(yPress)}] Moveto $w [expr {$State(first) + [$w delta $xDelta $yDelta]}] } proc ttk::scrollbar::Release {w x y} { variable State unset -nocomplain State(xPress) State(yPress) State(first) ttk::CancelRepeat } # scrollbar::Jump -- ButtonPress-2 binding for scrollbars. # Behaves exactly like scrollbar::Press, except that # clicking in the trough jumps to the the selected position. # proc ttk::scrollbar::Jump {w x y} { variable State switch -glob -- [$w identify $x $y] { *thumb - *trough { set State(first) [$w fraction $x $y] Moveto $w $State(first) set State(xPress) $x set State(yPress) $y } default { Press $w $x $y } } } tile-0.8.2/library/sizegrip.tcl0000644000076500007650000000350610523430060016045 0ustar joejoe00000000000000# # sizegrip.tcl,v 1.3 2006/11/05 18:40:48 jenglish Exp # # Tile widget set -- sizegrip widget bindings. # # Dragging a sizegrip widget resizes the containing toplevel. # # NOTE: the sizegrip widget must be in the lower right hand corner. # option add *TSizegrip.cursor $::ttk::Cursors(seresize) namespace eval ttk::sizegrip { variable State array set State { pressed 0 pressX 0 pressY 0 width 0 height 0 widthInc 1 heightInc 1 toplevel {} } } bind TSizegrip { ttk::sizegrip::Press %W %X %Y } bind TSizegrip { ttk::sizegrip::Drag %W %X %Y } bind TSizegrip { ttk::sizegrip::Release %W %X %Y } proc ttk::sizegrip::Press {W X Y} { variable State set top [winfo toplevel $W] # Sanity-checks: # If a negative X or Y position was specified for [wm geometry], # just bail out -- there's no way to handle this cleanly. # if {[scan [wm geometry $top] "%dx%d+%d+%d" width height _x _y] != 4} { return; } # Account for gridded geometry: # set grid [wm grid $top] if {[llength $grid]} { set State(widthInc) [lindex $grid 2] set State(heightInc) [lindex $grid 3] } else { set State(widthInc) [set State(heightInc) 1] } set State(toplevel) $top set State(pressX) $X set State(pressY) $Y set State(width) $width set State(height) $height set State(pressed) 1 } proc ttk::sizegrip::Drag {W X Y} { variable State if {!$State(pressed)} { return } set w [expr {$State(width) + ($X - $State(pressX))/$State(widthInc)}] set h [expr {$State(height) + ($Y - $State(pressY))/$State(heightInc)}] if {$w <= 0} { set w 1 } if {$h <= 0} { set h 1 } wm geometry $State(toplevel) ${w}x${h} } proc ttk::sizegrip::Release {W X Y} { variable State set State(pressed) 0 } #*EOF* tile-0.8.2/library/tile.tcl0000644000076500007650000001221410540031325015142 0ustar joejoe00000000000000# # tile.tcl,v 1.104 2006/12/13 17:05:25 jenglish Exp # # Tile widget set initialization script. # namespace eval tile {} ;# Old namespace, being phased out namespace eval ttk {} ;# New official namespace ### Source library scripts. # namespace eval tile { if {![info exists library]} { variable library [file dirname [info script]] } } source [file join $tile::library keynav.tcl] source [file join $tile::library fonts.tcl] source [file join $tile::library cursors.tcl] source [file join $tile::library icons.tcl] source [file join $tile::library utils.tcl] ### Deprecated aliases. # ## ttk::deprecated $old $new -- # Define $old command as a deprecated alias for $new command # $old and $new must be fully namespace-qualified. # proc ttk::deprecated {old new} { interp alias {} $old {} ttk::do'deprecate $old $new } ## do'deprecate -- # Implementation procedure for deprecated commands -- # issue a warning (once), then re-alias old to new. # proc ttk::do'deprecate {old new args} { deprecated'warning $old $new interp alias {} $old {} $new uplevel 1 [linsert $args 0 $new] } ## deprecated'warning -- # Gripe about use of deprecated commands. # proc ttk::deprecated'warning {old new} { puts stderr "$old deprecated -- use $new instead" } ### Backward compatibility: # ## 0.7.X compatibility: renamed in 0.8.0 # ttk::deprecated ::ttk::paned ::ttk::panedwindow ttk::deprecated ::tile::availableThemes ::ttk::themes ttk::deprecated ::tile::setTheme ::ttk::setTheme #Not yet: ttk::deprecated ::style ::ttk::style interp alias {} ::style {} ::ttk::style ttk::deprecated ::tile::defineImage ::ttk::defineImage ttk::deprecated ::tile::stockIcon ::ttk::stockIcon ttk::deprecated ::tile::CopyBindings ::ttk::copyBindings ### Exported routines: # namespace eval ttk { namespace export style # All widget constructor commands are exported: variable widgets { button checkbutton radiobutton menubutton label entry frame labelframe scrollbar notebook progressbar combobox separator panedwindow treeview sizegrip scale } variable wc foreach wc $widgets { namespace export $wc } } ### ttk::ThemeChanged -- # Called from [style theme use]. # Sends a <> virtual event to all widgets. # proc ttk::ThemeChanged {} { set Q . while {[llength $Q]} { set QN [list] foreach w $Q { event generate $w <> foreach child [winfo children $w] { lappend QN $child } } set Q $QN } } ### Public API. # ## ttk::themes -- # Return list of themes registered in the package database. # proc ttk::themes {} { set themes [list] foreach pkg [lsearch -inline -all -glob [package names] ttk::theme::*] { lappend themes [lindex [split $pkg :] end] } return $themes } ## ttk::setTheme $theme -- # Set the current theme to $theme, loading it if necessary. # proc ttk::setTheme {theme} { variable currentTheme if {[lsearch [style theme names] $theme] < 0} { package require ttk::theme::$theme } style theme use $theme set currentTheme $theme } ### Load widget bindings. # source [file join $tile::library button.tcl] source [file join $tile::library menubutton.tcl] source [file join $tile::library scrollbar.tcl] source [file join $tile::library scale.tcl] source [file join $tile::library progress.tcl] source [file join $tile::library notebook.tcl] source [file join $tile::library paned.tcl] source [file join $tile::library entry.tcl] source [file join $tile::library combobox.tcl] ;# dependency: entry.tcl source [file join $tile::library treeview.tcl] source [file join $tile::library sizegrip.tcl] source [file join $tile::library dialog.tcl] ## Label and Labelframe bindings: # (not enough to justify their own file...) # bind TLabelframe <> { ttk::traverseTo [tk_focusNext %W] } bind TLabel <> { ttk::traverseTo [tk_focusNext %W] } ### Load settings for built-in themes: # proc ttk::LoadThemes {} { variable ::tile::library # "default" always present: uplevel #0 [list source [file join $library defaults.tcl]] set builtinThemes [style theme names] foreach {theme script} { classic classicTheme.tcl alt altTheme.tcl clam clamTheme.tcl winnative winTheme.tcl xpnative xpTheme.tcl aqua aquaTheme.tcl } { if {[lsearch -exact $builtinThemes $theme] >= 0} { uplevel #0 [list source [file join $library $script]] } } } ttk::LoadThemes; rename ::ttk::LoadThemes {} ### Select platform-specific default theme: # # Notes: # + On OSX, aqua theme is the default # + On Windows, xpnative takes precedence over winnative if available. # + On X11, users can use the X resource database to # specify a preferred theme (*TkTheme: themeName); # otherwise "default" is used. # proc ttk::DefaultTheme {} { set preferred [list aqua xpnative winnative] set userTheme [option get . tkTheme TkTheme] if {$userTheme != {} && ![catch { uplevel #0 [list package require ttk::theme::$userTheme] }]} { return $userTheme } foreach theme $preferred { if {[package provide ttk::theme::$theme] != ""} { return $theme } } return "default" } ttk::setTheme [ttk::DefaultTheme] ; rename ttk::DefaultTheme {} #*EOF* tile-0.8.2/library/treeview.tcl0000644000076500007650000002241510541527127016056 0ustar joejoe00000000000000# treeview.tcl,v 1.22 2006/12/18 15:05:59 jenglish Exp # # ttk::treeview widget bindings and utilities. # namespace eval ttk::treeview { variable State # Enter/Leave/Motion # set State(activeWidget) {} set State(activeHeading) {} # Press/drag/release: # set State(pressMode) none set State(pressX) 0 # For pressMode == "resize" set State(resizeColumn) #0 # For pressmode == "heading" set State(heading) {} # Provide [lassign] if not already present # (@@@ TODO: check if this is still needed after horrible-identify purge) # if {![llength [info commands lassign]]} { proc lassign {vals args} { uplevel 1 [list foreach $args $vals break] } } } ### Widget bindings. # bind Treeview { ttk::treeview::Motion %W %x %y } bind Treeview { #nothing } bind Treeview { ttk::treeview::ActivateHeading {} {}} bind Treeview { ttk::treeview::Press %W %x %y } bind Treeview { ttk::treeview::DoubleClick %W %x %y } bind Treeview { ttk::treeview::Release %W %x %y } bind Treeview { ttk::treeview::Drag %W %x %y } bind Treeview { ttk::treeview::Keynav %W up } bind Treeview { ttk::treeview::Keynav %W down } bind Treeview { ttk::treeview::Keynav %W right } bind Treeview { ttk::treeview::Keynav %W left } bind Treeview { %W yview scroll -1 pages } bind Treeview { %W yview scroll 1 pages } bind Treeview { ttk::treeview::ToggleFocus %W } bind Treeview { ttk::treeview::ToggleFocus %W } bind Treeview \ { ttk::treeview::Select %W %x %y extend } bind Treeview \ { ttk::treeview::Select %W %x %y toggle } # Standard mousewheel bindings: # bind Treeview { %W yview scroll [expr {- (%D / 120) * 4}] units } if {[string equal "x11" [tk windowingsystem]]} { bind Treeview { %W yview scroll -5 units } bind Treeview { %W yview scroll 5 units } } ### Binding procedures. # ## Keynav -- Keyboard navigation # # @@@ TODO: verify/rewrite up and down code. # proc ttk::treeview::Keynav {w dir} { set focus [$w focus] if {$focus eq ""} { return } switch -- $dir { up { if {[set up [$w prev $focus]] eq ""} { set focus [$w parent $focus] } else { while {[$w item $up -open] && [llength [$w children $up]]} { set up [lindex [$w children $up] end] } set focus $up } } down { if {[$w item $focus -open] && [llength [$w children $focus]]} { set focus [lindex [$w children $focus] 0] } else { set up $focus while {$up ne "" && [set down [$w next $up]] eq ""} { set up [$w parent $up] } set focus $down } } left { if {[$w item $focus -open] && [llength [$w children $focus]]} { CloseItem $w $focus } else { set focus [$w parent $focus] } } right { OpenItem $w $focus } } if {$focus != {}} { SelectOp $w $focus choose } } ## Motion -- pointer motion binding. # Sets cursor, active element ... # proc ttk::treeview::Motion {w x y} { variable ::ttk::Cursors variable State set cursor {} set activeHeading {} lassign [$w identify $x $y] what where detail switch -- $what { separator { set cursor $Cursors(hresize) } heading { set activeHeading $where } } if {[$w cget -cursor] ne $cursor} { $w configure -cursor $cursor } ActivateHeading $w $activeHeading } ## ActivateHeading -- track active heading element # proc ttk::treeview::ActivateHeading {w heading} { variable State if {$w != $State(activeWidget) || $heading != $State(activeHeading)} { if {$State(activeHeading) != {}} { $State(activeWidget) heading $State(activeHeading) state !active } if {$heading != {}} { $w heading $heading state active } set State(activeHeading) $heading set State(activeWidget) $w } } ## Select $w $x $y $selectop # Binding procedure for selection operations. # See "Selection modes", below. # proc ttk::treeview::Select {w x y op} { if {[set item [$w identify row $x $y]] ne "" } { SelectOp $w $item $op } } ## DoubleClick -- Double-ButtonPress-1 binding. # proc ttk::treeview::DoubleClick {w x y} { if {[set row [$w identify row $x $y]] ne ""} { Toggle $w $row } else { Press $w $x $y ;# perform single-click action } } ## Press -- ButtonPress binding. # proc ttk::treeview::Press {w x y} { lassign [$w identify $x $y] what where detail focus $w ;# or: ClickToFocus? switch -- $what { nothing { } heading { heading.press $w $where } separator { resize.press $w $x $where } cell - row - item { SelectOp $w $where choose } } if {$what eq "item" && [string match *indicator $detail]} { Toggle $w $where } } ## Drag -- B1-Motion binding # proc ttk::treeview::Drag {w x y} { variable State switch $State(pressMode) { resize { resize.drag $w $x } heading { heading.drag $w $x $y } } } proc ttk::treeview::Release {w x y} { variable State switch $State(pressMode) { resize { resize.release $w $x } heading { heading.release $w } } set State(pressMode) none Motion $w $x $y } ### Interactive column resizing. # proc ttk::treeview::resize.press {w x column} { variable State set State(pressMode) "resize" set State(resizeColumn) $column } proc ttk::treeview::resize.drag {w x} { variable State $w drag $State(resizeColumn) $x } proc ttk::treeview::resize.release {w x} { # no-op } ### Heading activation. # proc ttk::treeview::heading.press {w column} { variable State set State(pressMode) "heading" set State(heading) $column $w heading $column state pressed } proc ttk::treeview::heading.drag {w x y} { variable State lassign [$w identify $x $y] what where detail if {$what eq "heading" && $where eq $State(heading)} { $w heading $State(heading) state pressed } else { $w heading $State(heading) state !pressed } } proc ttk::treeview::heading.release {w} { variable State if {[lsearch -exact [$w heading $State(heading) state] pressed] >= 0} { after idle [$w heading $State(heading) -command] } $w heading $State(heading) state !pressed } ### Selection modes. # ## SelectOp $w $item [ choose | extend | toggle ] -- # Dispatch to appropriate selection operation # depending on current value of -selectmode. # proc ttk::treeview::SelectOp {w item op} { select.$op.[$w cget -selectmode] $w $item } ## -selectmode none: # proc ttk::treeview::select.choose.none {w item} { $w focus $item } proc ttk::treeview::select.toggle.none {w item} { $w focus $item } proc ttk::treeview::select.extend.none {w item} { $w focus $item } ## -selectmode browse: # proc ttk::treeview::select.choose.browse {w item} { BrowseTo $w $item } proc ttk::treeview::select.toggle.browse {w item} { BrowseTo $w $item } proc ttk::treeview::select.extend.browse {w item} { BrowseTo $w $item } ## -selectmode multiple: # proc ttk::treeview::select.choose.extended {w item} { BrowseTo $w $item } proc ttk::treeview::select.toggle.extended {w item} { $w selection toggle $item } proc ttk::treeview::select.extend.extended {w item} { if {[set anchor [$w focus]] ne ""} { $w selection set [between $w $anchor $item] } else { BrowseTo $item } } ### Tree structure utilities. # ## between $tv $item1 $item2 -- # Returns a list of all items between $item1 and $item2, # in preorder traversal order. $item1 and $item2 may be # in either order. # # NOTES: # This routine is O(N) in the size of the tree. # There's probably a way to do this that's O(N) in the number # of items returned, but I'm not clever enough to figure it out. # proc ttk::treeview::between {tv item1 item2} { variable between [list] variable selectingBetween 0 ScanBetween $tv $item1 $item2 {} return $between } ## ScanBetween -- # Recursive worker routine for ttk::treeview::between # proc ttk::treeview::ScanBetween {tv item1 item2 item} { variable between variable selectingBetween if {$item eq $item1 || $item eq $item2} { lappend between $item set selectingBetween [expr {!$selectingBetween}] } elseif {$selectingBetween} { lappend between $item } foreach child [$tv children $item] { ScanBetween $tv $item1 $item2 $child } } ### User interaction utilities. # ## OpenItem, CloseItem -- Set the open state of an item, generate event # proc ttk::treeview::OpenItem {w item} { $w focus $item event generate $w <> $w item $item -open true } proc ttk::treeview::CloseItem {w item} { $w item $item -open false $w focus $item event generate $w <> } ## Toggle -- toggle opened/closed state of item # proc ttk::treeview::Toggle {w item} { if {[$w item $item -open]} { CloseItem $w $item } else { OpenItem $w $item } } ## ToggleFocus -- toggle opened/closed state of focus item # proc ttk::treeview::ToggleFocus {w} { set item [$w focus] if {$item ne ""} { Toggle $w $item } } ## BrowseTo -- navigate to specified item; set focus and selection # proc ttk::treeview::BrowseTo {w item} { $w see $item $w focus $item $w selection set [list $item] } #*EOF* tile-0.8.2/library/utils.tcl0000644000076500007650000001257710707013465015373 0ustar joejoe00000000000000# # utils.tcl,v 1.10 2007/10/22 03:21:25 jenglish Exp # # Utilities for widget implementations. # ### Focus management. # ## ttk::takefocus -- # This is the default value of the "-takefocus" option # for widgets that participate in keyboard navigation. # # See also: tk::FocusOK # proc ttk::takefocus {w} { expr {[$w instate !disabled] && [winfo viewable $w]} } ## ttk::traverseTo $w -- # Set the keyboard focus to the specified window. # proc ttk::traverseTo {w} { set focus [focus] if {$focus ne ""} { event generate $focus <> } focus $w event generate $w <> } ## ttk::clickToFocus $w -- # Utility routine, used in bindings -- # Assign keyboard focus to the specified widget if -takefocus is enabled. # proc ttk::clickToFocus {w} { if {[ttk::takesFocus $w]} { focus $w } } ## ttk::takesFocus w -- # Test if the widget can take keyboard focus: # # + widget is viewable, AND: # - if -takefocus is missing or empty, return 0, OR # - if -takefocus is 0 or 1, return that value, OR # - append the widget name to -takefocus and evaluate it # as a script. # # See also: tk::FocusOK # # Note: This routine doesn't implement the same fallback heuristics # as tk::FocusOK. # proc ttk::takesFocus {w} { if {![winfo viewable $w]} { return 0 } if {![catch {$w cget -takefocus} takefocus]} { switch -- $takefocus { 0 - 1 { return $takefocus } "" { return 0 } default { set value [uplevel #0 $takefocus [list $w]] return [expr {$value eq 1}] } } } return 0 } ## ttk::focusFirst $w -- # Return the first descendant of $w, in preorder traversal order, # that can take keyboard focus, "" if none do. # # See also: tk_focusNext # proc ttk::focusFirst {w} { if {[ttk::takesFocus $w]} { return $w } foreach child [winfo children $w] { if {[set c [ttk::focusFirst $child]] ne ""} { return $c } } return "" } ### Grabs. # # Rules: # Each call to [grabWindow $w] or [globalGrab $w] must be # matched with a call to [releaseGrab $w] in LIFO order. # # Do not call [grabWindow $w] for a window that currently # appears on the grab stack. # # See #1239190 and #1411983 for more discussion. # namespace eval ttk { variable Grab ;# map: window name -> grab token # grab token details: # Two-element list containing: # 1) a script to evaluate to restore the previous grab (if any); # 2) a script to evaluate to restore the focus (if any) } ## SaveGrab -- # Record current grab and focus windows. # proc ttk::SaveGrab {w} { variable Grab if {[info exists Grab($w)]} { # $w is already on the grab stack. # This should not happen, but bail out in case it does anyway: # return } set restoreGrab [set restoreFocus ""] set grabbed [grab current $w] if {[winfo exists $grabbed]} { switch [grab status $grabbed] { global { set restoreGrab [list grab -global $grabbed] } local { set restoreGrab [list grab $grabbed] } none { ;# grab window is really in a different interp } } } set focus [focus] if {$focus ne ""} { set restoreFocus [list focus -force $focus] } set Grab($w) [list $restoreGrab $restoreFocus] } ## RestoreGrab -- # Restore previous grab and focus windows. # If called more than once without an intervening [SaveGrab $w], # does nothing. # proc ttk::RestoreGrab {w} { variable Grab if {![info exists Grab($w)]} { # Ignore return; } # The previous grab/focus window may have been destroyed, # unmapped, or some other abnormal condition; ignore any errors. # foreach script $Grab($w) { catch $script } unset Grab($w) } ## ttk::grabWindow $w -- # Records the current focus and grab windows, sets an application-modal # grab on window $w. # proc ttk::grabWindow {w} { SaveGrab $w grab $w } ## ttk::globalGrab $w -- # Same as grabWindow, but sets a global grab on $w. # proc ttk::globalGrab {w} { SaveGrab $w grab -global $w } ## ttk::releaseGrab -- # Release the grab previously set by [ttk::grabWindow] # or [ttk::globalGrab]. # proc ttk::releaseGrab {w} { grab release $w RestoreGrab $w } ### Auto-repeat. # # NOTE: repeating widgets do not have -repeatdelay # or -repeatinterval resources as in standard Tk; # instead a single set of settings is applied application-wide. # (TODO: make this user-configurable) # # (@@@ Windows seems to use something like 500/50 milliseconds # @@@ for -repeatdelay/-repeatinterval) # namespace eval ttk { variable Repeat array set Repeat { delay 300 interval 100 timer {} script {} } } ## ttk::Repeatedly -- # Begin auto-repeat. # proc ttk::Repeatedly {args} { variable Repeat after cancel $Repeat(timer) set script [uplevel 1 [list namespace code $args]] set Repeat(script) $script uplevel #0 $script set Repeat(timer) [after $Repeat(delay) ttk::Repeat] } ## Repeat -- # Continue auto-repeat # proc ttk::Repeat {} { variable Repeat uplevel #0 $Repeat(script) set Repeat(timer) [after $Repeat(interval) ttk::Repeat] } ## ttk::CancelRepeat -- # Halt auto-repeat. # proc ttk::CancelRepeat {} { variable Repeat after cancel $Repeat(timer) } ### Miscellaneous. # ## ttk::copyBindings $from $to -- # Utility routine; copies bindings from one bindtag onto another. # proc ttk::copyBindings {from to} { foreach event [bind $from] { bind $to $event [bind $from $event] } } #*EOF* tile-0.8.2/library/winTheme.tcl0000644000076500007650000000513510720077726016010 0ustar joejoe00000000000000# # winTheme.tcl,v 1.39 2007/11/18 18:09:26 jenglish Exp # # Settings for 'winnative' theme. # namespace eval ttk::theme::winnative { ttk::style theme settings winnative { ttk::style configure "." \ -background SystemButtonFace \ -foreground SystemWindowText \ -selectforeground SystemHighlightText \ -selectbackground SystemHighlight \ -troughcolor SystemScrollbar \ -font TkDefaultFont \ ; ttk::style map "." -foreground [list disabled SystemGrayText] ; ttk::style map "." -embossed [list disabled 1] ; ttk::style configure TButton \ -anchor center -width -11 -relief raised -shiftrelief 1 ttk::style configure TCheckbutton -padding "2 4" ttk::style configure TRadiobutton -padding "2 4" ttk::style configure TMenubutton \ -padding "8 4" -arrowsize 3 -relief raised ttk::style map TButton -relief {{!disabled pressed} sunken} ttk::style configure TEntry \ -padding 2 -selectborderwidth 0 -insertwidth 1 ttk::style map TEntry \ -fieldbackground \ [list readonly SystemButtonFace disabled SystemButtonFace] \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ ; ttk::style configure TCombobox -padding 2 ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ -foreground [list {readonly focus} SystemHighlightText] \ -focusfill [list {readonly focus} SystemHighlight] \ ; ttk::style configure TLabelframe -borderwidth 2 -relief groove ttk::style configure Toolbutton -relief flat -padding {8 4} ttk::style map Toolbutton -relief \ {disabled flat selected sunken pressed sunken active raised} ttk::style configure TScale -groovewidth 4 ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style configure TNotebook.Tab -padding {3 1} -borderwidth 1 ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Row -background SystemWindow ttk::style configure Cell -background SystemWindow ttk::style map Row \ -background [list selected SystemHighlight] \ -foreground [list selected SystemHighlightText] ; ttk::style map Cell \ -background [list selected SystemHighlight] \ -foreground [list selected SystemHighlightText] ; ttk::style map Item \ -background [list selected SystemHighlight] \ -foreground [list selected SystemHighlightText] ; ttk::style configure TProgressbar \ -background SystemHighlight -borderwidth 0 ; } } tile-0.8.2/library/xpTheme.tcl0000755000076500007650000000375510720077726015653 0ustar joejoe00000000000000# # xpTheme.tcl,v 1.39 2007/11/18 18:09:26 jenglish Exp # # Settings for 'xpnative' theme # namespace eval ttk::theme::xpnative { ttk::style theme settings xpnative { ttk::style configure . \ -background SystemButtonFace \ -foreground SystemWindowText \ -selectforeground SystemHighlightText \ -selectbackground SystemHighlight \ -font TkDefaultFont \ ; ttk::style map "." \ -foreground [list disabled SystemGrayText] \ ; ttk::style configure TButton -anchor center -padding {1 1} -width -11 ttk::style configure TRadiobutton -padding 2 ttk::style configure TCheckbutton -padding 2 ttk::style configure TMenubutton -padding {8 4} ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style map TNotebook.Tab \ -expand [list selected {2 2 2 2}] # Treeview: ttk::style configure Heading -font TkHeadingFont ttk::style configure Row -background SystemWindow ttk::style configure Cell -background SystemWindow ttk::style map Row \ -background [list selected SystemHighlight] \ -foreground [list selected SystemHighlightText] ; ttk::style map Cell \ -background [list selected SystemHighlight] \ -foreground [list selected SystemHighlightText] ; ttk::style map Item \ -background [list selected SystemHighlight] \ -foreground [list selected SystemHighlightText] ; ttk::style configure TLabelframe -foreground "#0046d5" # OR: -padding {3 3 3 6}, which some apps seem to use. ttk::style configure TEntry -padding {2 2 2 4} ttk::style map TEntry \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ ; ttk::style configure TCombobox -padding 2 ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ -foreground [list {readonly focus} SystemHighlightText] \ -focusfill [list {readonly focus} SystemHighlight] \ ; ttk::style configure Toolbutton -padding {4 4} } } tile-0.8.2/macosx/0000755000076500007650000000000010731273175013344 5ustar joejoe00000000000000tile-0.8.2/macosx/aquaTheme.c0000644000076500007650000010031410726034052015412 0ustar joejoe00000000000000/* * aquaTheme.c,v 1.49 2007/12/06 17:58:02 jenglish Exp * * Tk theme engine for Mac OSX, using the Appearance Manager API. * * Copyright (c) 2004 Joe English * Copyright (c) 2005 Neil Madden * Copyright (c) 2006-2007 Daniel A. Steffen * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * See also: * * * * Notes: * "Active" means different things in Mac and Tk terminology -- * On Aqua, widgets are "Active" if they belong to the foreground window, * "Inactive" if they are in a background window. * Tk uses the term "active" to mean that the mouse cursor * is over a widget; aka "hover", "prelight", or "hot-tracked". * Aqua doesn't use this kind of feedback. * * The QuickDraw/Carbon coordinate system is relative to the * top-level window, not to the Tk_Window. BoxToRect() * accounts for this. */ #include #include #include #include #include #include "tkTheme.h" /* Define a constant that was renamed for Mac OS X 10.4 */ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1040 #define kThemeDisclosureTriangle kThemeDisclosureButton #endif #if !defined(BUILD_tile) /* * Use this version in the core: */ #define BEGIN_DRAWING(d) { \ TkMacOSXDrawingContext dc; \ if (!TkMacOSXSetupDrawingContext((d), NULL, 0, &dc)) {return;} #define END_DRAWING \ TkMacOSXRestoreDrawingContext(&dc); } #else /* BUILD_tile */ /* * TkMacOSXSetupDrawingContext is not available to extensions, * need to do this the hard way in Tile: */ #define BEGIN_DRAWING(d) { \ CGrafPtr saveWorld; GDHandle saveDevice; \ GetGWorld(&saveWorld, &saveDevice); \ SetGWorld(TkMacOSXGetDrawablePort(d), 0); \ TkMacOSXSetUpClippingRgn(d); #define END_DRAWING \ SetGWorld(saveWorld,saveDevice); } #endif /* defined(BUILD_TILE) */ /*---------------------------------------------------------------------- * +++ Utilities. */ /* * BoxToRect -- * Convert a Ttk_Box in Tk coordinates relative to the given Drawable * to a native Rect relative to the containing port. */ static inline Rect BoxToRect(Drawable d, Ttk_Box b) { MacDrawable *md = (MacDrawable*)d; Rect rect; rect.top = b.y + md->yOff; rect.left = b.x + md->xOff; rect.bottom = rect.top + b.height; rect.right = rect.left + b.width; return rect; } /* * PatternOrigin -- * Compute brush pattern origin for a Drawable relative to a Tk_Window. * * Notes: This will only be nonzero if the Drawable is an off-screen pixmap. * See also SF bug #1157739. */ static Point PatternOrigin(Tk_Window tkwin, Drawable d) { MacDrawable *md = (MacDrawable*)d; Rect bounds; Point origin; TkMacOSXWinBounds((TkWindow *) tkwin, &bounds); origin.h = md->xOff - bounds.left; origin.v = md->yOff - bounds.top; return origin; } /* * DontErase -- * No-op ThemeEraseProc, can be passed to DrawThemeButton &c. */ static void DontErase( const Rect *bounds, UInt32 eraseData, SInt16 depth, Boolean isColorDev) { } /* * Table mapping Tk states to Appearance manager ThemeStates */ static Ttk_StateTable ThemeStateTable[] = { {kThemeStateUnavailable, TTK_STATE_DISABLED, 0}, {kThemeStatePressed, TTK_STATE_PRESSED, 0}, {kThemeStateInactive, TTK_STATE_BACKGROUND, 0}, {kThemeStateActive, 0, 0} /* Others: Not sure what these are supposed to mean. Up/Down have something to do with "little arrow" increment controls... Dunno what a "Rollover" is. NEM: Rollover is TTK_STATE_ACTIVE... but we don't handle that yet, by the looks of things {kThemeStateRollover, 0, 0}, {kThemeStateUnavailableInactive, 0, 0} {kThemeStatePressedUp, 0, 0}, {kThemeStatePressedDown, 0, 0} */ }; /*---------------------------------------------------------------------- * +++ Button element: Used for elements drawn with DrawThemeButton. */ /* * Extra margins to account for drop shadow. */ static Ttk_Padding ButtonMargins = {2,2,2,2}; #define NoThemeMetric 0xFFFFFFFF typedef struct { ThemeButtonKind kind; ThemeMetric heightMetric; } ThemeButtonParms; static ThemeButtonParms PushButtonParms = { kThemePushButton, kThemeMetricPushButtonHeight }, CheckBoxParms = { kThemeCheckBox, kThemeMetricCheckBoxHeight }, RadioButtonParms = { kThemeRadioButton, kThemeMetricRadioButtonHeight }, BevelButtonParms = { kThemeBevelButton, NoThemeMetric }, PopupButtonParms = { kThemePopupButton, kThemeMetricPopupButtonHeight }, DisclosureParms = { kThemeDisclosureButton, kThemeMetricDisclosureTriangleHeight }, ListHeaderParms = { kThemeListHeaderButton, kThemeMetricListHeaderHeight }; static Ttk_StateTable ButtonValueTable[] = { { kThemeButtonMixed, TTK_STATE_ALTERNATE, 0 }, { kThemeButtonOn, TTK_STATE_SELECTED, 0 }, { kThemeButtonOff, 0, 0 } /* Others: kThemeDisclosureRight, kThemeDisclosureDown, kThemeDisclosureLeft */ }; static Ttk_StateTable ButtonAdornmentTable[] = { { kThemeAdornmentDefault, TTK_STATE_ALTERNATE, 0 }, { kThemeAdornmentFocus, TTK_STATE_FOCUS, 0 }, { kThemeAdornmentNone, 0, 0 } }; /* * computeButtonDrawInfo -- * Fill in an appearance manager ThemeButtonDrawInfo record. */ static ThemeButtonDrawInfo computeButtonDrawInfo( ThemeButtonParms *parms, Ttk_State state) { ThemeButtonDrawInfo info; info.state = Ttk_StateTableLookup(ThemeStateTable, state); info.value = Ttk_StateTableLookup(ButtonValueTable, state); info.adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state); return info; } static void ButtonElementSizeNoPadding( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ThemeButtonParms *parms = clientData; if (parms->heightMetric != NoThemeMetric) { SInt32 height; GetThemeMetric(parms->heightMetric, &height); *heightPtr = height; } } static void ButtonElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ThemeButtonParms *parms = clientData; ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, 0); static const Rect scratchBounds = {0, 0, 100, 100}; Rect contentBounds; ButtonElementSizeNoPadding( clientData, elementRecord, tkwin, widthPtr, heightPtr, paddingPtr); /* * To compute internal padding, query the appearance manager * for the content bounds of a dummy rectangle, then use * the difference as the padding. */ GetThemeButtonContentBounds( &scratchBounds, parms->kind, &info, &contentBounds); paddingPtr->left = contentBounds.left; paddingPtr->top = contentBounds.top; paddingPtr->right = scratchBounds.right - contentBounds.right + 1; paddingPtr->bottom = scratchBounds.bottom - contentBounds.bottom; /* * Now add a little extra padding to account for drop shadows. * @@@ SHOULD: call GetThemeButtonBackgroundBounds() instead. */ *paddingPtr = Ttk_AddPadding(*paddingPtr, ButtonMargins); *widthPtr += Ttk_PaddingWidth(ButtonMargins); *heightPtr += Ttk_PaddingHeight(ButtonMargins); } static void ButtonElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeButtonParms *parms = clientData; ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, state); Rect bounds = BoxToRect(d, Ttk_PadBox(b, ButtonMargins)); BEGIN_DRAWING(d) DrawThemeButton(&bounds, parms->kind, &info, NULL, NULL, NULL, 0); END_DRAWING } static Ttk_ElementSpec ButtonElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, ButtonElementSize, ButtonElementDraw }; /*---------------------------------------------------------------------- * +++ Notebook elements. */ static Ttk_StateTable TabStyleTable[] = { { kThemeTabFrontInactive, TTK_STATE_SELECTED|TTK_STATE_BACKGROUND, 0 }, { kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND, 0 }, { kThemeTabFrontUnavailable, TTK_STATE_DISABLED|TTK_STATE_SELECTED, 0 }, { kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED, 0 }, { kThemeTabFront, TTK_STATE_SELECTED, 0 }, { kThemeTabNonFrontPressed, TTK_STATE_PRESSED, 0 }, { kThemeTabNonFront, 0,0 } }; /* * Quoth DrawThemeTab() reference manual: * "Small tabs have a height of 16 pixels large tabs have a height of * 21 pixels. (The widths of tabs are variable.) Additionally, the * distance that the tab overlaps the pane must be included in the tab * rectangle this overlap distance is always 3 pixels, although the * 3-pixel overlap is only drawn for the front tab." */ static const int TAB_HEIGHT = 21; static const int TAB_OVERLAP = 3; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *heightPtr = TAB_HEIGHT + TAB_OVERLAP - 1; } static void TabElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Rect bounds = BoxToRect(d, b); ThemeTabStyle tabStyle = Ttk_StateTableLookup(TabStyleTable, state); bounds.bottom += TAB_OVERLAP; BEGIN_DRAWING(d) DrawThemeTab(&bounds, tabStyle, kThemeTabNorth, 0, 0); END_DRAWING } static Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TabElementSize, TabElementDraw }; /* * Notebook panes: */ static void PaneElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { /* Padding determined by trial-and-error */ *paddingPtr = Ttk_MakePadding(2,8,2,2); } static void PaneElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Rect bounds = BoxToRect(d, b); ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state); BEGIN_DRAWING(d) DrawThemeTabPane(&bounds, drawState); END_DRAWING } static Ttk_ElementSpec PaneElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, PaneElementSize, PaneElementDraw }; /* * Labelframe borders: * Use "primary group box ..." * Quoth DrawThemePrimaryGroup reference: * "The primary group box frame is drawn inside the specified * rectangle and is a maximum of 2 pixels thick." * * "Maximum of 2 pixels thick" is apparently a lie; * looks more like 4 to me with shading. */ static void GroupElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(4); } static void GroupElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Rect bounds = BoxToRect(d, b); ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state); BEGIN_DRAWING(d) DrawThemePrimaryGroup(&bounds, drawState); END_DRAWING } static Ttk_ElementSpec GroupElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, GroupElementSize, GroupElementDraw }; /*---------------------------------------------------------------------- * +++ Entry element -- * 3 pixels padding for focus rectangle * 2 pixels padding for EditTextFrame */ typedef struct { Tcl_Obj *backgroundObj; } EntryElement; static Ttk_ElementOptionSpec EntryElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(EntryElement,backgroundObj), "white" }, {0} }; static void EntryElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(5); } static void EntryElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { EntryElement *e = elementRecord; Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,e->backgroundObj); Ttk_Box inner = Ttk_PadBox(b, Ttk_UniformPadding(3)); Rect bounds = BoxToRect(d, inner); ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state); /* * Erase w/background color: */ XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), inner.x,inner.y, inner.width, inner.height); BEGIN_DRAWING(d) DrawThemeEditTextFrame(&bounds, drawState); if (state & TTK_STATE_FOCUS) { DrawThemeFocusRect(&bounds, 1); } END_DRAWING } static Ttk_ElementSpec EntryElementSpec = { TK_STYLE_VERSION_2, sizeof(EntryElement), EntryElementOptions, EntryElementSize, EntryElementDraw }; /*---------------------------------------------------------------------- * +++ Combobox: * * NOTES: * kThemeMetricComboBoxLargeDisclosureWidth -> 17 * Padding and margins guesstimated by trial-and-error. */ static Ttk_Padding ComboboxPadding = { 2, 3, 17, 1 }; static Ttk_Padding ComboboxMargins = { 3, 3, 4, 4 }; static void ComboboxElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *widthPtr = 0; *heightPtr = 0; *paddingPtr = Ttk_AddPadding(ComboboxMargins, ComboboxPadding); } static void ComboboxElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeButtonParms *parms = clientData; ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, state); Rect bounds = BoxToRect(d, Ttk_PadBox(b, ComboboxMargins)); BEGIN_DRAWING(d) DrawThemeButton( &bounds, kThemeComboBox, &info, NULL, NULL, NULL, 0); END_DRAWING } static Ttk_ElementSpec ComboboxElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, ComboboxElementSize, ComboboxElementDraw }; /*---------------------------------------------------------------------- * +++ DrawThemeTrack-based elements -- * Progress bars and scales. (See also: <>) */ static Ttk_StateTable ThemeTrackEnableTable[] = { { kThemeTrackDisabled, TTK_STATE_DISABLED, 0 }, { kThemeTrackInactive, TTK_STATE_BACKGROUND, 0 }, { kThemeTrackActive, 0, 0 } /* { kThemeTrackNothingToScroll, ?, ? }, */ }; typedef struct { /* TrackElement client data */ ThemeTrackKind kind; SInt32 thicknessMetric; } TrackElementData; static TrackElementData ScaleData = { kThemeSlider, kThemeMetricHSliderHeight }; typedef struct { Tcl_Obj *fromObj; /* minimum value */ Tcl_Obj *toObj; /* maximum value */ Tcl_Obj *valueObj; /* current value */ Tcl_Obj *orientObj; /* horizontal / vertical */ } TrackElement; static Ttk_ElementOptionSpec TrackElementOptions[] = { { "-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,fromObj) }, { "-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,toObj) }, { "-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,valueObj) }, { "-orient", TK_OPTION_STRING, Tk_Offset(TrackElement,orientObj) }, {0,0,0} }; static void TrackElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TrackElementData *data = clientData; SInt32 size = 24; /* reasonable default ... */ GetThemeMetric(data->thicknessMetric, &size); *widthPtr = *heightPtr = size; } static void TrackElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TrackElementData *data = clientData; TrackElement *elem = elementRecord; double from = 0, to = 100, value = 0; int orientation = TTK_ORIENT_HORIZONTAL; ThemeTrackDrawInfo info; Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from); Tcl_GetDoubleFromObj(NULL, elem->toObj, &to); Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value); Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation); /* @@@ BUG: min, max, and value should account for resolution: * @@@ if finer than 1.0, conversion to int breaks. */ info.kind = data->kind; info.bounds = BoxToRect(d, b); info.min = (int)from; /* @@@ */ info.max = (int)to; /* @@@ */ info.value = (int)value; /* @@@ */ info.attributes = orientation == TTK_ORIENT_HORIZONTAL ? kThemeTrackHorizontal : 0; info.attributes |= kThemeTrackShowThumb; info.enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state); switch (data->kind) { case kThemeProgressBar: info.trackInfo.progress.phase = 0; /* 1-4: animation phase */ break; case kThemeSlider: info.trackInfo.slider.pressState = 0; /* @@@ fill this in */ info.trackInfo.slider.thumbDir = kThemeThumbPlain; /* kThemeThumbUpward, kThemeThumbDownward, kThemeThumbPlain */ break; } BEGIN_DRAWING(d) DrawThemeTrack(&info, NULL, NULL, 0); END_DRAWING } static Ttk_ElementSpec TrackElementSpec = { TK_STYLE_VERSION_2, sizeof(TrackElement), TrackElementOptions, TrackElementSize, TrackElementDraw }; /* * Slider element -- <> * Has geometry only. The Scale widget adjusts the position of this element, * and uses it for hit detection. In the Aqua theme, the slider is actually * drawn as part of the trough element. * * Also buggy: The geometry here is a Wild-Assed-Guess; I can't * figure out how to get the Appearance Manager to tell me the * slider size. */ static void SliderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *widthPtr = *heightPtr = 24; } static Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SliderElementSize, TtkNullElementDraw }; /*---------------------------------------------------------------------- * +++ Progress bar element (new): * * @@@ NOTE: According to an older revision of the Aqua reference docs, * @@@ the 'phase' field is between 0 and 4. Newer revisions say * @@@ that it can be any UInt8 value. */ typedef struct { Tcl_Obj *orientObj; /* horizontal / vertical */ Tcl_Obj *valueObj; /* current value */ Tcl_Obj *maximumObj; /* maximum value */ Tcl_Obj *phaseObj; /* animation phase */ Tcl_Obj *modeObj; /* progress bar mode */ } PbarElement; static Ttk_ElementOptionSpec PbarElementOptions[] = { { "-orient", TK_OPTION_STRING, Tk_Offset(PbarElement,orientObj), "horizontal" }, { "-value", TK_OPTION_DOUBLE, Tk_Offset(PbarElement,valueObj), "0" }, { "-maximum", TK_OPTION_DOUBLE, Tk_Offset(PbarElement,maximumObj), "100" }, { "-phase", TK_OPTION_INT, Tk_Offset(PbarElement,phaseObj), "0" }, { "-mode", TK_OPTION_STRING, Tk_Offset(PbarElement,modeObj), "determinate" }, {0,0,0,0} }; static void PbarElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SInt32 size = 24; /* @@@ Check HIG for correct default */ GetThemeMetric(kThemeMetricLargeProgressBarThickness, &size); *widthPtr = *heightPtr = size; } static void PbarElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { PbarElement *pbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; double value = 0, maximum = 100; int phase = 0; ThemeTrackDrawInfo info; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum); Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); if (!strcmp("indeterminate", Tcl_GetString(pbar->modeObj)) && value) { info.kind = kThemeIndeterminateBar; } else { info.kind = kThemeProgressBar; } info.bounds = BoxToRect(d, b); info.min = 0; info.max = (int)maximum; /* @@@ See note above */ info.value = (int)value; info.attributes = orientation == TTK_ORIENT_HORIZONTAL ? kThemeTrackHorizontal : 0; info.attributes |= kThemeTrackShowThumb; info.enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state); info.trackInfo.progress.phase = phase; BEGIN_DRAWING(d) DrawThemeTrack(&info, NULL, NULL, 0); END_DRAWING } static Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, sizeof(PbarElement), PbarElementOptions, PbarElementSize, PbarElementDraw }; /*---------------------------------------------------------------------- * +++ Separator element. * * DrawThemeSeparator() guesses the orientation of the line from * the width and height of the rectangle, so the same element can * can be used for horizontal, vertical, and general separators. */ static void SeparatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *widthPtr = *heightPtr = 1; } static void SeparatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { Rect bounds = BoxToRect(d, b); ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state); /* * DrawThemeSeparator only supports kThemeStateActive / kThemeStateInactive */ state &= TTK_STATE_BACKGROUND; BEGIN_DRAWING(d) DrawThemeSeparator(&bounds, drawState); END_DRAWING } static Ttk_ElementSpec SeparatorElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SeparatorElementSize, SeparatorElementDraw }; /*---------------------------------------------------------------------- * +++ Size grip element. */ static const ThemeGrowDirection sizegripGrowDirection = kThemeGrowRight|kThemeGrowDown; static void SizegripElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { Point origin = {0, 0}; Rect bounds; GetThemeStandaloneGrowBoxBounds( origin, sizegripGrowDirection, false, &bounds); *widthPtr = bounds.right - bounds.left; *heightPtr = bounds.bottom - bounds.top; } static void SizegripElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { Rect bounds = BoxToRect(d, b); Point origin = {bounds.top, bounds.left}; /* Grow box only supports kThemeStateActive, kThemeStateInactive */ state &= TTK_STATE_BACKGROUND; BEGIN_DRAWING(d) DrawThemeStandaloneGrowBox( origin, sizegripGrowDirection, false, Ttk_StateTableLookup(ThemeStateTable, state)); END_DRAWING } static Ttk_ElementSpec SizegripElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SizegripElementSize, SizegripElementDraw }; /*---------------------------------------------------------------------- * +++ Background and fill elements. * * This isn't quite right: In Aqua, the correct background for * a control depends on what kind of container it belongs to, * and the type of the top-level window. * * Also: patterned backgrounds should be aligned with the coordinate * system of the top-level window. If we're drawing into an * off-screen graphics port this leads to alignment glitches. */ static void FillElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Rect bounds = BoxToRect(d, b); ThemeBrush brush = (state & TTK_STATE_BACKGROUND) ? kThemeBrushModelessDialogBackgroundInactive : kThemeBrushModelessDialogBackgroundActive ; BEGIN_DRAWING(d) SetThemeBackground(brush, 32, true); QDSetPatternOrigin(PatternOrigin(tkwin, d)); EraseRect(&bounds); END_DRAWING } static void BackgroundElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { FillElementDraw( clientData, elementRecord, tkwin, d, Ttk_WinBox(tkwin), state); } static Ttk_ElementSpec FillElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TtkNullElementSize, FillElementDraw }; static Ttk_ElementSpec BackgroundElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TtkNullElementSize, BackgroundElementDraw }; /*---------------------------------------------------------------------- * +++ ToolbarBackground element -- toolbar style for frames. * * This is very similar to the normal background element, but uses a * different ThemeBrush in order to get the lighter pinstripe effect * used in toolbars. We use SetThemeBackground() rather than * ApplyThemeBackground() in order to get the right style. * * * */ static void ToolbarBackgroundElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeBrush brush = kThemeBrushToolbarBackground; Rect bounds = BoxToRect(d, Ttk_WinBox(tkwin)); BEGIN_DRAWING(d) SetThemeBackground(brush, 32, true); QDSetPatternOrigin(PatternOrigin(tkwin, d)); EraseRect(&bounds); END_DRAWING } static Ttk_ElementSpec ToolbarBackgroundElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TtkNullElementSize, ToolbarBackgroundElementDraw }; /*---------------------------------------------------------------------- * +++ Treeview header * Redefine the header to use a kThemeListHeaderButton. */ static Ttk_StateTable TreeHeaderAdornmentTable[] = { { kThemeAdornmentHeaderButtonSortUp, TTK_STATE_ALTERNATE, 0 }, { kThemeAdornmentFocus, TTK_STATE_FOCUS, 0 }, { kThemeAdornmentNone, 0, 0 } }; static void TreeHeaderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeButtonParms *parms = clientData; Rect bounds = BoxToRect(d, b); ThemeButtonDrawInfo info; info.state = Ttk_StateTableLookup(ThemeStateTable, state); info.value = Ttk_StateTableLookup(ButtonValueTable, state); info.adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state); BEGIN_DRAWING(d) DrawThemeButton(&bounds, parms->kind, &info, NULL, NULL, NULL, 0); END_DRAWING } static Ttk_ElementSpec TreeHeaderElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, ButtonElementSizeNoPadding, TreeHeaderElementDraw }; /* * Disclosure triangle: */ #define TTK_TREEVIEW_STATE_OPEN TTK_STATE_USER1 #define TTK_TREEVIEW_STATE_LEAF TTK_STATE_USER2 static Ttk_StateTable DisclosureValueTable[] = { { kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0 }, { kThemeDisclosureRight, 0, 0 }, }; static void DisclosureElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SInt32 s; GetThemeMetric(kThemeMetricDisclosureTriangleWidth, &s); *widthPtr = s; GetThemeMetric(kThemeMetricDisclosureTriangleHeight, &s); *heightPtr = s; } static void DisclosureElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Rect bounds = BoxToRect(d, b); ThemeButtonDrawInfo info; if (state & TTK_TREEVIEW_STATE_LEAF) { return; } info.state = Ttk_StateTableLookup(ThemeStateTable, state); info.value = Ttk_StateTableLookup(DisclosureValueTable, state); info.adornment = kThemeAdornmentDrawIndicatorOnly; BEGIN_DRAWING(d) DrawThemeButton( &bounds, kThemeDisclosureTriangle, &info, NULL, DontErase, NULL, 0); END_DRAWING } static Ttk_ElementSpec DisclosureElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, DisclosureElementSize, DisclosureElementDraw }; /*---------------------------------------------------------------------- * +++ Widget layouts. */ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("Toolbar", TTK_NODE("Toolbar.background", TTK_FILL_BOTH)) TTK_LAYOUT("TButton", TTK_GROUP("Button.button", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH)))) TTK_LAYOUT("TRadiobutton", TTK_GROUP("Radiobutton.button", TTK_FILL_BOTH, TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH, TTK_NODE("Radiobutton.label", TTK_PACK_LEFT)))) TTK_LAYOUT("TCheckbutton", TTK_GROUP("Checkbutton.button", TTK_FILL_BOTH, TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH, TTK_NODE("Checkbutton.label", TTK_PACK_LEFT)))) TTK_LAYOUT("TMenubutton", TTK_GROUP("Menubutton.button", TTK_FILL_BOTH, TTK_GROUP("Menubutton.padding", TTK_FILL_BOTH, TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.button", TTK_PACK_TOP|TTK_FILL_X, TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_X)))) /* Notebook tabs -- no focus ring */ TTK_LAYOUT("Tab", TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, TTK_GROUP("Notebook.padding", TTK_EXPAND|TTK_FILL_BOTH, TTK_NODE("Notebook.label", TTK_EXPAND|TTK_FILL_BOTH)))) /* Progress bars -- track only */ TTK_LAYOUT("TProgressbar", TTK_NODE("Progressbar.track", TTK_EXPAND|TTK_FILL_BOTH)) /* Tree heading -- no border, fixed height */ TTK_LAYOUT("Heading", TTK_NODE("Treeheading.cell", TTK_FILL_X) TTK_NODE("Treeheading.image", TTK_PACK_RIGHT) TTK_NODE("Treeheading.text", 0)) /* Tree items -- omit focus ring */ TTK_LAYOUT("Item", TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT) TTK_NODE("Treeitem.image", TTK_PACK_LEFT) TTK_NODE("Treeitem.text", TTK_PACK_LEFT))) TTK_END_LAYOUT_TABLE /*---------------------------------------------------------------------- * +++ Initialization. */ static int AquaTheme_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_CreateTheme(interp, "aqua", NULL); if (!themePtr) { return TCL_ERROR; } /* * Elements: */ Ttk_RegisterElementSpec(themePtr, "background", &BackgroundElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "fill", &FillElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Toolbar.background", &ToolbarBackgroundElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Button.button", &ButtonElementSpec, &PushButtonParms); Ttk_RegisterElementSpec(themePtr, "Checkbutton.button", &ButtonElementSpec, &CheckBoxParms); Ttk_RegisterElementSpec(themePtr, "Radiobutton.button", &ButtonElementSpec, &RadioButtonParms); Ttk_RegisterElementSpec(themePtr, "Toolbutton.border", &ButtonElementSpec, &BevelButtonParms); Ttk_RegisterElementSpec(themePtr, "Menubutton.button", &ButtonElementSpec, &PopupButtonParms); Ttk_RegisterElementSpec(themePtr, "Combobox.button", &ComboboxElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator", &DisclosureElementSpec, &DisclosureParms); Ttk_RegisterElementSpec(themePtr, "Treeheading.cell", &TreeHeaderElementSpec, &ListHeaderParms); Ttk_RegisterElementSpec(themePtr, "Notebook.tab", &TabElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Notebook.client", &PaneElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Labelframe.border",&GroupElementSpec,0); Ttk_RegisterElementSpec(themePtr, "Entry.field",&EntryElementSpec,0); Ttk_RegisterElementSpec(themePtr, "separator",&SeparatorElementSpec,0); Ttk_RegisterElementSpec(themePtr, "hseparator",&SeparatorElementSpec,0); Ttk_RegisterElementSpec(themePtr, "vseparator",&SeparatorElementSpec,0); Ttk_RegisterElementSpec(themePtr, "sizegrip",&SizegripElementSpec,0); /* * <> * The Progressbar widget adjusts the size of the pbar element. * In the Aqua theme, the appearance manager computes the bar geometry; * we do all the drawing in the ".track" element and leave the .pbar out. */ Ttk_RegisterElementSpec(themePtr,"Scale.trough", &TrackElementSpec, &ScaleData); Ttk_RegisterElementSpec(themePtr,"Scale.slider",&SliderElementSpec,0); Ttk_RegisterElementSpec(themePtr,"Progressbar.track", &PbarElementSpec, 0); /* * Layouts: */ Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::aqua", TILE_VERSION); return TCL_OK; } MODULE_SCOPE int Ttk_MacOSXPlatformInit(Tcl_Interp *interp) { return AquaTheme_Init(interp); } tile-0.8.2/tclconfig/0000755000076500007650000000000010731273176014023 5ustar joejoe00000000000000tile-0.8.2/tclconfig/install-sh0000755000076500007650000000421207742576765016050 0ustar joejoe00000000000000#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5; it is not part of GNU. # # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ # # This script is compatible with the BSD install script, but was written # from scratch. # # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" instcmd="$mvprog" chmodcmd="" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; *) if [ x"$src" = x ] then src=$1 else dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` fi # Make a temp file name in the proper directory. dstdir=`dirname $dst` dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp # and set any options; do chmod last to preserve setuid bits if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi # Now rename the file to the real destination. $doit $rmcmd $dst $doit $mvcmd $dsttmp $dst exit 0 tile-0.8.2/tclconfig/tcl.m40000644000076500007650000037536010731266044015061 0ustar joejoe00000000000000# tcl.m4 -- # # This file provides a set of autoconf macros to help TEA-enable # a Tcl extension. # # Copyright (c) 1999-2000 Ajuba Solutions. # Copyright (c) 2002-2005 ActiveState Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # BASED ON: @(#) tclconfig/tcl.m4 r1.117 2007/11/18 07:14:28 # AC_PREREQ(2.57) dnl TEA extensions pass us the version of TEA they think they dnl are compatible with (must be set in TEA_INIT below) dnl TEA_VERSION="3.6" # Possible values for key variables defined: # # TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem') # TEA_PLATFORM - windows unix # #------------------------------------------------------------------------ # TEA_PATH_TCLCONFIG -- # # Locate the tclConfig.sh file and perform a sanity check on # the Tcl compile flags # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-tcl=... # # Defines the following vars: # TCL_BIN_DIR Full path to the directory containing # the tclConfig.sh file #------------------------------------------------------------------------ AC_DEFUN([TEA_PATH_TCLCONFIG], [ dnl TEA specific: Make sure we are initialized AC_REQUIRE([TEA_INIT]) # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl], [directory containing tcl configuration (tclConfig.sh)]), with_tclconfig=${withval}) AC_MSG_CHECKING([for Tcl configuration]) AC_CACHE_VAL(ac_cv_c_tclconfig,[ # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case ${with_tclconfig} in */tclConfig.sh ) if test -f ${with_tclconfig}; then AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself]) with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'` fi ;; esac if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` else AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../tcl \ `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../../tcl \ `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)` break fi done fi # TEA specific: on Windows, check in common installation locations if test "${TEA_PLATFORM}" = "windows" \ -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d C:/Tcl/lib 2>/dev/null` \ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi ]) if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" AC_MSG_WARN([Can't find Tcl configuration definitions]) exit 0 else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh]) fi fi ]) #------------------------------------------------------------------------ # TEA_PATH_TKCONFIG -- # # Locate the tkConfig.sh file # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-tk=... # # Defines the following vars: # TK_BIN_DIR Full path to the directory containing # the tkConfig.sh file #------------------------------------------------------------------------ AC_DEFUN([TEA_PATH_TKCONFIG], [ # # Ok, lets find the tk configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tk # if test x"${no_tk}" = x ; then # we reset no_tk in case something fails here no_tk=true AC_ARG_WITH(tk, AC_HELP_STRING([--with-tk], [directory containing tk configuration (tkConfig.sh)]), with_tkconfig=${withval}) AC_MSG_CHECKING([for Tk configuration]) AC_CACHE_VAL(ac_cv_c_tkconfig,[ # First check to see if --with-tkconfig was specified. if test x"${with_tkconfig}" != x ; then case ${with_tkconfig} in */tkConfig.sh ) if test -f ${with_tkconfig}; then AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself]) with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'` fi ;; esac if test -f "${with_tkconfig}/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` else AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh]) fi fi # then check for a private Tk library if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ../tk \ `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \ ../../tk \ `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ ../../../tk \ `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi done fi # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tk.framework/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i; pwd)` break fi done fi # TEA specific: on Windows, check in common installation locations if test "${TEA_PLATFORM}" = "windows" \ -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d C:/Tcl/lib 2>/dev/null` \ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ${srcdir}/../tk \ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi done fi ]) if test x"${ac_cv_c_tkconfig}" = x ; then TK_BIN_DIR="# no Tk configs found" AC_MSG_WARN([Can't find Tk configuration definitions]) exit 0 else no_tk= TK_BIN_DIR=${ac_cv_c_tkconfig} AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh]) fi fi ]) #------------------------------------------------------------------------ # TEA_LOAD_TCLCONFIG -- # # Load the tclConfig.sh file # # Arguments: # # Requires the following vars to be set: # TCL_BIN_DIR # # Results: # # Subst the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE # #------------------------------------------------------------------------ AC_DEFUN([TEA_LOAD_TCLCONFIG], [ AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then AC_MSG_RESULT([loading]) . "${TCL_BIN_DIR}/tclConfig.sh" else AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh]) fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. if test -f "${TCL_BIN_DIR}/Makefile" ; then TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} elif test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works # against Tcl.framework installed in an arbitary location. case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then for i in "`cd ${TCL_BIN_DIR}; pwd`" \ "`cd ${TCL_BIN_DIR}/../..; pwd`"; do if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}" break fi done fi if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}" TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}" fi ;; esac fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" AC_SUBST(TCL_VERSION) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_STUB_LIB_FILE) AC_SUBST(TCL_STUB_LIB_FLAG) AC_SUBST(TCL_STUB_LIB_SPEC) # TEA specific: AC_SUBST(TCL_LIBS) AC_SUBST(TCL_DEFS) AC_SUBST(TCL_EXTRA_CFLAGS) AC_SUBST(TCL_LD_FLAGS) AC_SUBST(TCL_SHLIB_LD_LIBS) ]) #------------------------------------------------------------------------ # TEA_LOAD_TKCONFIG -- # # Load the tkConfig.sh file # # Arguments: # # Requires the following vars to be set: # TK_BIN_DIR # # Results: # # Sets the following vars that should be in tkConfig.sh: # TK_BIN_DIR #------------------------------------------------------------------------ AC_DEFUN([TEA_LOAD_TKCONFIG], [ AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh]) if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then AC_MSG_RESULT([loading]) . "${TK_BIN_DIR}/tkConfig.sh" else AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh]) fi # eval is required to do the TK_DBGX substitution eval "TK_LIB_FILE=\"${TK_LIB_FILE}\"" eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\"" # If the TK_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TK_LIB_SPEC will be set to the value # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC # instead of TK_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. if test -f "${TK_BIN_DIR}/Makefile" ; then TK_LIB_SPEC=${TK_BUILD_LIB_SPEC} TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC} TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH} elif test "`uname -s`" = "Darwin"; then # If Tk was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works # against Tk.framework installed in an arbitary location. case ${TK_DEFS} in *TK_FRAMEWORK*) if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then for i in "`cd ${TK_BIN_DIR}; pwd`" \ "`cd ${TK_BIN_DIR}/../..; pwd`"; do if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}" break fi done fi if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}" fi ;; esac fi # eval is required to do the TK_DBGX substitution eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\"" eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\"" eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\"" eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\"" # TEA specific: Ensure windowingsystem is defined if test "${TEA_PLATFORM}" = "unix" ; then case ${TK_DEFS} in *MAC_OSX_TK*) AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?]) TEA_WINDOWINGSYSTEM="aqua" ;; *) TEA_WINDOWINGSYSTEM="x11" ;; esac elif test "${TEA_PLATFORM}" = "windows" ; then TEA_WINDOWINGSYSTEM="win32" fi AC_SUBST(TK_VERSION) AC_SUBST(TK_BIN_DIR) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_LIB_FILE) AC_SUBST(TK_LIB_FLAG) AC_SUBST(TK_LIB_SPEC) AC_SUBST(TK_STUB_LIB_FILE) AC_SUBST(TK_STUB_LIB_FLAG) AC_SUBST(TK_STUB_LIB_SPEC) # TEA specific: AC_SUBST(TK_LIBS) AC_SUBST(TK_XINCLUDES) ]) #------------------------------------------------------------------------ # TEA_PROG_TCLSH # Determine the fully qualified path name of the tclsh executable # in the Tcl build directory or the tclsh installed in a bin # directory. This macro will correctly determine the name # of the tclsh executable even if tclsh has not yet been # built in the build directory. The tclsh found is always # associated with a tclConfig.sh file. This tclsh should be used # only for running extension test cases. It should never be # or generation of files (like pkgIndex.tcl) at build time. # # Arguments # none # # Results # Subst's the following values: # TCLSH_PROG #------------------------------------------------------------------------ AC_DEFUN([TEA_PROG_TCLSH], [ AC_MSG_CHECKING([for tclsh]) if test -f "${TCL_BIN_DIR}/Makefile" ; then # tclConfig.sh is in Tcl build directory if test "${TEA_PLATFORM}" = "windows"; then TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" else TCLSH_PROG="${TCL_BIN_DIR}/tclsh" fi else # tclConfig.sh is in install location if test "${TEA_PLATFORM}" = "windows"; then TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" else TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}" fi list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \ `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \ `ls -d ${TCL_PREFIX}/bin 2>/dev/null`" for i in $list ; do if test -f "$i/${TCLSH_PROG}" ; then REAL_TCL_BIN_DIR="`cd "$i"; pwd`/" break fi done TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}" fi AC_MSG_RESULT([${TCLSH_PROG}]) AC_SUBST(TCLSH_PROG) ]) #------------------------------------------------------------------------ # TEA_PROG_WISH # Determine the fully qualified path name of the wish executable # in the Tk build directory or the wish installed in a bin # directory. This macro will correctly determine the name # of the wish executable even if wish has not yet been # built in the build directory. The wish found is always # associated with a tkConfig.sh file. This wish should be used # only for running extension test cases. It should never be # or generation of files (like pkgIndex.tcl) at build time. # # Arguments # none # # Results # Subst's the following values: # WISH_PROG #------------------------------------------------------------------------ AC_DEFUN([TEA_PROG_WISH], [ AC_MSG_CHECKING([for wish]) if test -f "${TK_BIN_DIR}/Makefile" ; then # tkConfig.sh is in Tk build directory if test "${TEA_PLATFORM}" = "windows"; then WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}" else WISH_PROG="${TK_BIN_DIR}/wish" fi else # tkConfig.sh is in install location if test "${TEA_PLATFORM}" = "windows"; then WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}" else WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}" fi list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \ `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \ `ls -d ${TK_PREFIX}/bin 2>/dev/null`" for i in $list ; do if test -f "$i/${WISH_PROG}" ; then REAL_TK_BIN_DIR="`cd "$i"; pwd`/" break fi done WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}" fi AC_MSG_RESULT([${WISH_PROG}]) AC_SUBST(WISH_PROG) ]) #------------------------------------------------------------------------ # TEA_ENABLE_SHARED -- # # Allows the building of shared libraries # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-shared=yes|no # # Defines the following vars: # STATIC_BUILD Used for building import/export libraries # on Windows. # # Sets the following vars: # SHARED_BUILD Value of 1 or 0 #------------------------------------------------------------------------ AC_DEFUN([TEA_ENABLE_SHARED], [ AC_MSG_CHECKING([how to build libraries]) AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build and link with shared libraries (default: on)]), [tcl_ok=$enableval], [tcl_ok=yes]) if test "${enable_shared+set}" = set; then enableval="$enable_shared" tcl_ok=$enableval else tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then AC_MSG_RESULT([shared]) SHARED_BUILD=1 else AC_MSG_RESULT([static]) SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) fi AC_SUBST(SHARED_BUILD) ]) #------------------------------------------------------------------------ # TEA_ENABLE_THREADS -- # # Specify if thread support should be enabled. If "yes" is specified # as an arg (optional), threads are enabled by default, "no" means # threads are disabled. "yes" is the default. # # TCL_THREADS is checked so that if you are compiling an extension # against a threaded core, your extension must be compiled threaded # as well. # # Note that it is legal to have a thread enabled extension run in a # threaded or non-threaded Tcl core, but a non-threaded extension may # only run in a non-threaded Tcl core. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-threads # # Sets the following vars: # THREADS_LIBS Thread library(s) # # Defines the following vars: # TCL_THREADS # _REENTRANT # _THREAD_SAFE # #------------------------------------------------------------------------ AC_DEFUN([TEA_ENABLE_THREADS], [ AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads], [build with threads]), [tcl_ok=$enableval], [tcl_ok=yes]) if test "${enable_threads+set}" = set; then enableval="$enable_threads" tcl_ok=$enableval else tcl_ok=yes fi if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then TCL_THREADS=1 if test "${TEA_PLATFORM}" != "windows" ; then # We are always OK on Windows, so check what this platform wants: # USE_THREAD_ALLOC tells us to try the special thread-based # allocator that significantly reduces lock contention AC_DEFINE(USE_THREAD_ALLOC, 1, [Do we want to use the threaded memory allocator?]) AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?]) if test "`uname -s`" = "SunOS" ; then AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Do we really want to follow the standard? Yes we do!]) fi AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?]) AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) if test "$tcl_ok" = "no"; then # Check a little harder for __pthread_mutex_init in the same # library, as some systems hide it there until pthread.h is # defined. We could alternatively do an AC_TRY_COMPILE with # pthread.h, but that will work with libpthread really doesn't # exist, like AIX 4.2. [Bug: 4359] AC_CHECK_LIB(pthread, __pthread_mutex_init, tcl_ok=yes, tcl_ok=no) fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthread" else AC_CHECK_LIB(pthreads, pthread_mutex_init, tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthreads" else AC_CHECK_LIB(c, pthread_mutex_init, tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = "no"; then AC_CHECK_LIB(c_r, pthread_mutex_init, tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -pthread" else TCL_THREADS=0 AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled]) fi fi fi fi fi else TCL_THREADS=0 fi # Do checking message here to not mess up interleaved configure output AC_MSG_CHECKING([for building with threads]) if test "${TCL_THREADS}" = 1; then AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?]) AC_MSG_RESULT([yes (default)]) else AC_MSG_RESULT([no]) fi # TCL_THREADS sanity checking. See if our request for building with # threads is the same as the way Tcl was built. If not, warn the user. case ${TCL_DEFS} in *THREADS=1*) if test "${TCL_THREADS}" = "0"; then AC_MSG_WARN([ Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads.]) fi ;; *) if test "${TCL_THREADS}" = "1"; then AC_MSG_WARN([ --enable-threads requested, but building against a Tcl that is NOT thread-enabled. This is an OK configuration that will also run in a thread-enabled core.]) fi ;; esac AC_SUBST(TCL_THREADS) ]) #------------------------------------------------------------------------ # TEA_ENABLE_SYMBOLS -- # # Specify if debugging symbols should be used. # Memory (TCL_MEM_DEBUG) debugging can also be enabled. # # Arguments: # none # # TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives # the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted. # Requires the following vars to be set in the Makefile: # CFLAGS_DEFAULT # LDFLAGS_DEFAULT # # Results: # # Adds the following arguments to configure: # --enable-symbols # # Defines the following vars: # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true # Sets to $(CFLAGS_OPTIMIZE) if false # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true # Sets to $(LDFLAGS_OPTIMIZE) if false # DBGX Formerly used as debug library extension; # always blank now. # #------------------------------------------------------------------------ AC_DEFUN([TEA_ENABLE_SYMBOLS], [ dnl TEA specific: Make sure we are initialized AC_REQUIRE([TEA_CONFIG_CFLAGS]) AC_MSG_CHECKING([for build with symbols]) AC_ARG_ENABLE(symbols, AC_HELP_STRING([--enable-symbols], [build with debugging symbols (default: off)]), [tcl_ok=$enableval], [tcl_ok=no]) DBGX="" if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" AC_MSG_RESULT([no]) else CFLAGS_DEFAULT="${CFLAGS_DEBUG}" LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" if test "$tcl_ok" = "yes"; then AC_MSG_RESULT([yes (standard debugging)]) fi fi # TEA specific: if test "${TEA_PLATFORM}" != "windows" ; then LDFLAGS_DEFAULT="${LDFLAGS}" fi AC_SUBST(CFLAGS_DEFAULT) AC_SUBST(LDFLAGS_DEFAULT) AC_SUBST(TCL_DBGX) if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?]) fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then AC_MSG_RESULT([enabled symbols mem debugging]) else AC_MSG_RESULT([enabled $tcl_ok debugging]) fi fi ]) #------------------------------------------------------------------------ # TEA_ENABLE_LANGINFO -- # # Allows use of modern nl_langinfo check for better l10n. # This is only relevant for Unix. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --enable-langinfo=yes|no (default is yes) # # Defines the following vars: # HAVE_LANGINFO Triggers use of nl_langinfo if defined. # #------------------------------------------------------------------------ AC_DEFUN([TEA_ENABLE_LANGINFO], [ AC_ARG_ENABLE(langinfo, AC_HELP_STRING([--enable-langinfo], [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]), [langinfo_ok=$enableval], [langinfo_ok=yes]) HAVE_LANGINFO=0 if test "$langinfo_ok" = "yes"; then AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no]) fi AC_MSG_CHECKING([whether to use nl_langinfo]) if test "$langinfo_ok" = "yes"; then AC_CACHE_VAL(tcl_cv_langinfo_h, [ AC_TRY_COMPILE([#include ], [nl_langinfo(CODESET);], [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])]) AC_MSG_RESULT([$tcl_cv_langinfo_h]) if test $tcl_cv_langinfo_h = yes; then AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?]) fi else AC_MSG_RESULT([$langinfo_ok]) fi ]) #-------------------------------------------------------------------- # TEA_CONFIG_SYSTEM # # Determine what the system is (some things cannot be easily checked # on a feature-driven basis, alas). This can usually be done via the # "uname" command, but there are a few systems, like Next, where # this doesn't work. # # Arguments: # none # # Results: # Defines the following var: # # system - System/platform/version identification code. # #-------------------------------------------------------------------- AC_DEFUN([TEA_CONFIG_SYSTEM], [ AC_CACHE_CHECK([system version], tcl_cv_sys_version, [ # TEA specific: if test "${TEA_PLATFORM}" = "windows" ; then tcl_cv_sys_version=windows elif test -f /usr/lib/NextStep/software_version; then tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then AC_MSG_WARN([can't find uname command]) tcl_cv_sys_version=unknown else # Special check for weird MP-RAS system (uname returns weird # results, and the version is kept in special file). if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid` fi if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi fi fi ]) system=$tcl_cv_sys_version ]) #-------------------------------------------------------------------- # TEA_CONFIG_CFLAGS # # Try to determine the proper flags to pass to the compiler # for building shared libraries and other such nonsense. # # Arguments: # none # # Results: # # Defines and substitutes the following vars: # # DL_OBJS - Name of the object file that implements dynamic # loading for Tcl on this system. # DL_LIBS - Library file(s) to include in tclsh and other base # applications in order for the "load" command to work. # LDFLAGS - Flags to pass to the compiler when linking object # files into an executable application binary such # as tclsh. # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib", # that tell the run-time dynamic linker where to look # for shared libraries such as libtcl.so. Depends on # the variable LIB_RUNTIME_DIR in the Makefile. Could # be the same as CC_SEARCH_FLAGS if ${CC} is used to link. # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib", # that tell the run-time dynamic linker where to look # for shared libraries such as libtcl.so. Depends on # the variable LIB_RUNTIME_DIR in the Makefile. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components # of a shared library (may request position-independent # code, among other things). # SHLIB_LD - Base command to use for combining object files # into a shared library. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when # creating shared libraries. This symbol typically # goes at the end of the "ld" commands that build # shared libraries. The value of the symbol is # "${LIBS}" if all of the dependent libraries should # be specified when creating a shared library. If # dependent libraries should not be specified (as on # SunOS 4.x, where they cause the link to fail, or in # general if Tcl and Tk aren't themselves shared # libraries), then this symbol has an empty string # as its value. # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable # extensions. An empty string means we don't know how # to use shared libraries on this platform. # LIB_SUFFIX - Specifies everything that comes after the "libfoo" # in a static or shared library name, using the $VERSION variable # to put the version in the right place. This is used # by platforms that need non-standard library names. # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs # to have a version after the .so, and ${VERSION}.a # on AIX, since a shared library needs to have # a .a extension whereas shared objects for loadable # extensions have a .so extension. Defaults to # ${VERSION}${SHLIB_SUFFIX}. # TCL_NEEDS_EXP_FILE - # 1 means that an export file is needed to link to a # shared library. # TCL_EXP_FILE - The name of the installed export / import file which # should be used to link to the Tcl shared library. # Empty if Tcl is unshared. # TCL_BUILD_EXP_FILE - # The name of the built export / import file which # should be used to link to the Tcl shared library. # Empty if Tcl is unshared. # CFLAGS_DEBUG - # Flags used when running the compiler in debug mode # CFLAGS_OPTIMIZE - # Flags used when running the compiler in optimize mode # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit) # #-------------------------------------------------------------------- AC_DEFUN([TEA_CONFIG_CFLAGS], [ dnl TEA specific: Make sure we are initialized AC_REQUIRE([TEA_INIT]) # Step 0.a: Enable 64 bit support? AC_MSG_CHECKING([if 64bit support is requested]) AC_ARG_ENABLE(64bit, AC_HELP_STRING([--enable-64bit], [enable 64bit support (default: off)]), [do64bit=$enableval], [do64bit=no]) AC_MSG_RESULT([$do64bit]) # Step 0.b: Enable Solaris 64 bit VIS support? AC_MSG_CHECKING([if 64bit Sparc VIS support is requested]) AC_ARG_ENABLE(64bit-vis, AC_HELP_STRING([--enable-64bit-vis], [enable 64bit Sparc VIS support (default: off)]), [do64bitVIS=$enableval], [do64bitVIS=no]) AC_MSG_RESULT([$do64bitVIS]) # Force 64bit on with VIS AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes]) # Step 0.c: Check if visibility support is available. Do this here so # that platform specific alternatives can be used below if this fails. AC_CACHE_CHECK([if compiler supports visibility "hidden"], tcl_cv_cc_visibility_hidden, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" AC_TRY_LINK([ extern __attribute__((__visibility__("hidden"))) void f(void); void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes, tcl_cv_cc_visibility_hidden=no) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [ AC_DEFINE(MODULE_SCOPE, [extern __attribute__((__visibility__("hidden")))], [Compiler support for module scope symbols]) ]) # Step 0.d: Disable -rpath support? AC_MSG_CHECKING([if rpath support is requested]) AC_ARG_ENABLE(rpath, AC_HELP_STRING([--disable-rpath], [disable rpath support (default: on)]), [doRpath=$enableval], [doRpath=yes]) AC_MSG_RESULT([$doRpath]) # TEA specific: Cross-compiling options for Windows/CE builds? AS_IF([test "${TEA_PLATFORM}" = windows], [ AC_MSG_CHECKING([if Windows/CE build is requested]) AC_ARG_ENABLE(wince, AC_HELP_STRING([--enable-wince], [enable Win/CE support (where applicable)]), [doWince=$enableval], [doWince=no]) AC_MSG_RESULT([$doWince]) ]) # Step 1: set the variable "system" to hold the name and version number # for the system. TEA_CONFIG_SYSTEM # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) # Require ranlib early so we can override it in special cases below. AC_REQUIRE([AC_PROG_RANLIB]) # Step 3: set configuration options based on system name and version. # This is similar to Tcl's unix/tcl.m4 except that we've added a # "windows" case. do64bit_ok=no LDFLAGS_ORIG="$LDFLAGS" # When ld needs options to work in 64-bit mode, put them in # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load] # is disabled by the user. [Bug 1016796] LDFLAGS_ARCH="" TCL_EXPORT_FILE_SUFFIX="" UNSHARED_LIB_SUFFIX="" # TEA specific: use PACKAGE_VERSION instead of VERSION TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' ECHO_VERSION='`echo ${PACKAGE_VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O AS_IF([test "$GCC" = yes], [ # TEA specific: CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall" ], [CFLAGS_WARNING=""]) TCL_NEEDS_EXP_FILE=0 TCL_BUILD_EXP_FILE="" TCL_EXP_FILE="" dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed. dnl AC_CHECK_TOOL(AR, ar) AC_CHECK_PROG(AR, ar, ar) STLIB_LD='${AR} cr' LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" case $system in # TEA specific: windows) # This is a 2-stage check to make sure we have the 64-bit SDK # We have to know where the SDK is installed. # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs # MACHINE is IX86 for LINK, but this is used by the manifest, # which requires x86|amd64|ia64. MACHINE="X86" if test "$do64bit" != "no" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft Platform SDK" fi MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` PATH64="" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # default to AMD64 64-bit build PATH64="${MSSDK}/Bin/Win64/x86/AMD64" ;; ia64) MACHINE="IA64" PATH64="${MSSDK}/Bin/Win64" ;; esac if test ! -d "${PATH64}" ; then AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode]) AC_MSG_WARN([Ensure latest Platform SDK is installed]) do64bit="no" else AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) do64bit_ok="yes" fi fi if test "$doWince" != "no" ; then if test "$do64bit" != "no" ; then AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible]) fi if test "$GCC" = "yes" ; then AC_MSG_ERROR([Windows/CE and GCC builds incompatible]) fi TEA_PATH_CELIB # Set defaults for common evc4/PPC2003 setup # Currently Tcl requires 300+, possibly 420+ for sockets CEVERSION=420; # could be 211 300 301 400 420 ... TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... ARCH=ARM; # could be ARM MIPS X86EM ... PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" if test "$doWince" != "yes"; then # If !yes then the user specified something # Reset ARCH to allow user to skip specifying it ARCH= eval `echo $doWince | awk -F, '{ \ if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \ if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \ if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \ if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \ }'` if test "x${ARCH}" = "x" ; then ARCH=$TARGETCPU; fi fi OSVERSION=WCE$CEVERSION; if test "x${WCEROOT}" = "x" ; then WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" if test ! -d "${WCEROOT}" ; then WCEROOT="C:/Program Files/Microsoft eMbedded Tools" fi fi if test "x${SDKROOT}" = "x" ; then SDKROOT="C:/Program Files/Windows CE Tools" if test ! -d "${SDKROOT}" ; then SDKROOT="C:/Windows CE Tools" fi fi WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'` SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'` if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]]) doWince="no" else # We could PATH_NOSPACE these, but that's not important, # as long as we quote them when used. CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" if test -d "${CEINCLUDE}/${TARGETCPU}" ; then CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" fi CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" fi fi if test "$GCC" != "yes" ; then if test "${SHARED_BUILD}" = "0" ; then runtime=-MT else runtime=-MD fi if test "$do64bit" != "no" ; then # All this magic is necessary for the Win64 SDK RC1 - hobbs CC="\"${PATH64}/cl.exe\"" CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\"" RC="\"${MSSDK}/bin/rc.exe\"" lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" LINKBIN="\"${PATH64}/link.exe\"" CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" # Avoid 'unresolved external symbol __security_cookie' # errors, c.f. http://support.microsoft.com/?id=894573 TEA_ADD_LIBS([bufferoverflowU.lib]) elif test "$doWince" != "no" ; then CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" if test "${TARGETCPU}" = "X86"; then CC="\"${CEBINROOT}/cl.exe\"" else CC="\"${CEBINROOT}/cl${ARCH}.exe\"" fi CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\"" arch=`echo ${ARCH} | awk '{print tolower([$]0)}'` defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS" if test "${SHARED_BUILD}" = "1" ; then # Static CE builds require static celib as well defs="${defs} _DLL" fi for i in $defs ; do AC_DEFINE_UNQUOTED($i, 1, [WinCE def ]$i) done AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION, [_WIN32_WCE version]) AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION, [UNDER_CE version]) CFLAGS_DEBUG="-nologo -Zi -Od" CFLAGS_OPTIMIZE="-nologo -Ox" lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" LINKBIN="\"${CEBINROOT}/link.exe\"" AC_SUBST(CELIB_DIR) else RC="rc" lflags="-nologo" LINKBIN="link" CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" fi fi if test "$GCC" = "yes"; then # mingw gcc mode RC="windres" CFLAGS_DEBUG="-g" CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" SHLIB_LD="$CC -shared" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" else SHLIB_LD="${LINKBIN} -dll ${lflags}" # link -lib only works when -lib is the first arg STLIB_LD="${LINKBIN} -lib ${lflags}" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib' PATHTYPE=-w # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp # This essentially turns it all on. LDFLAGS_DEBUG="-debug:full -debugtype:both -warn:2" LDFLAGS_OPTIMIZE="-release" if test "$doWince" != "no" ; then LDFLAGS_CONSOLE="-link ${lflags}" LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} else LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi fi SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dll" SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll' TCL_LIB_VERSIONS_OK=nodots # Bogus to avoid getting this turned off DL_OBJS="tclLoadNone.obj" ;; AIX-*) AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [ # AIX requires the _r compiler when gcc isn't being used case "${CC}" in *_r) # ok ... ;; *) CC=${CC}_r ;; esac AC_MSG_RESULT([Using $CC for compiling with threads]) ]) LIBS="$LIBS -lc" SHLIB_CFLAGS="" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" LD_LIBRARY_PATH_VAR="LIBPATH" # Check to enable 64-bit flags for compiler/linker on AIX 4+ AS_IF([test "$do64bit" = yes -a "`uname -v`" -gt 3], [ AS_IF([test "$GCC" = yes], [ AC_MSG_WARN([64bit mode not supported with GCC on $system]) ], [ do64bit_ok=yes CFLAGS="$CFLAGS -q64" LDFLAGS_ARCH="-q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" ]) ]) AS_IF([test "`uname -m`" = ia64], [ # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC SHLIB_LD="/usr/ccs/bin/ld -G -z text" # AIX-5 has dl* in libc.so DL_LIBS="" AS_IF([test "$GCC" = yes], [ CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' ], [ CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' ]) LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' ], [ AS_IF([test "$GCC" = yes], [SHLIB_LD='${CC} -shared'], [ SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" ]) SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} TCL_NEEDS_EXP_FILE=1 # TEA specific: use PACKAGE_VERSION instead of VERSION TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp' ]) # AIX v<=4.1 has some different flags than 4.2+ AS_IF([test "$system" = "AIX-4.1" -o "`uname -v`" -lt 4], [ AC_LIBOBJ([tclLoadAix]) DL_LIBS="-lld" ]) # On AIX <=v4 systems, libbsd.a has to be linked in to support # non-blocking file IO. This library has to be linked in after # the MATH_LIBS or it breaks the pow() function. The way to # insure proper sequencing, is to add it to the tail of MATH_LIBS. # This library also supplies gettimeofday. # # AIX does not have a timezone field in struct tm. When the AIX # bsd library is used, the timezone global and the gettimeofday # methods are to be avoided for timezone deduction instead, we # deduce the timezone by comparing the localtime result on a # known GMT value. AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no) AS_IF([test $libbsd = yes], [ MATH_LIBS="$MATH_LIBS -lbsd" AC_DEFINE(USE_DELTA_FOR_TZ, 1, [Do we need a special AIX hack for timezones?]) ]) ;; BeOS*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -nostart' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" #----------------------------------------------------------- # Check for inet_ntoa in -lbind, for BeOS (which also needs # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"]) ;; BSD/OS-2.1*|BSD/OS-3*) SHLIB_CFLAGS="" SHLIB_LD="shlicc -r" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; BSD/OS-4.*) SHLIB_CFLAGS="-export-dynamic -fPIC" SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; dgux*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; HP-UX-*.11.*) # Use updated header definitions where possible AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?]) # TEA specific: Needed by Tcl, but not most extensions #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?]) #LIBS="$LIBS -lxnet" # Use the XOPEN network library AS_IF([test "`uname -m`" = ia64], [ SHLIB_SUFFIX=".so" # Use newer C++ library for C++ extensions #if test "$GCC" != "yes" ; then # CPPFLAGS="-AA" #fi ], [ SHLIB_SUFFIX=".sl" ]) AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) AS_IF([test "$tcl_ok" = yes], [ SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" ]) AS_IF([test "$GCC" = yes], [ SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ]) # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc #CFLAGS="$CFLAGS +DAportable" # Check to enable 64-bit flags for compiler/linker AS_IF([test "$do64bit" = "yes"], [ AS_IF([test "$GCC" = yes], [ case `${CC} -dumpmachine` in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) AC_MSG_WARN([64bit mode not supported with GCC on $system]) ;; esac ], [ do64bit_ok=yes CFLAGS="$CFLAGS +DD64" LDFLAGS_ARCH="+DD64" ]) ]) ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) AS_IF([test "$tcl_ok" = yes], [ SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" SHLIB_LD_LIBS="" DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" ]) ;; IRIX-5.*) SHLIB_CFLAGS="" SHLIB_LD="ld -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}']) ;; IRIX-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}']) AS_IF([test "$GCC" = yes], [ CFLAGS="$CFLAGS -mabi=n32" LDFLAGS="$LDFLAGS -mabi=n32" ], [ case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) CFLAGS="$CFLAGS -n32" ;; esac LDFLAGS="$LDFLAGS -n32" ]) ;; IRIX64-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}']) # Check to enable 64-bit flags for compiler/linker AS_IF([test "$do64bit" = yes], [ AS_IF([test "$GCC" = yes], [ AC_MSG_WARN([64bit mode not supported by gcc]) ], [ do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS_ARCH="-64" ]) ]) ;; Linux*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" # TEA specific: CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings # when you inline the string and math operations. Turn this off to # get rid of the warnings. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}' DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"]) AS_IF([test $do64bit = yes], [ AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_m64 = yes], [ CFLAGS="$CFLAGS -m64" do64bit_ok=yes ]) ]) # The combo of gcc + glibc has a bug related to inlining of # functions like strtod(). The -fno-builtin flag should address # this problem but it does not work. The -fno-inline flag is kind # of overkill but it works. Disable inlining only when one of the # files in compat/*.c is being linked in. AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"]) ;; GNU*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" SHLIB_LD='${CC} -shared' DL_OBJS="" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"]) ;; Lynx*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE=-02 SHLIB_LD='${CC} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) ;; MP-RAS-02*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; MP-RAS-*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,-Bexport" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; NetBSD-1.*|FreeBSD-[[1-2]].*) SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}']) AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ AC_EGREP_CPP(yes, [ #ifdef __ELF__ yes #endif ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) AS_IF([test $tcl_cv_ld_elf = yes], [ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' ], [ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' ]) # Ancient FreeBSD doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; OpenBSD-*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ AC_EGREP_CPP(yes, [ #ifdef __ELF__ yes #endif ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) AS_IF([test $tcl_cv_ld_elf = yes], [ LDFLAGS=-Wl,-export-dynamic ], [LDFLAGS=""]) # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; NetBSD-*|FreeBSD-*) # FreeBSD 3.* and greater have ELF. # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} AS_IF([test "${TCL_THREADS}" = "1"], [ # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ]) case $system in FreeBSD-3.*) # FreeBSD-3 doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' TCL_LIB_VERSIONS_OK=nodots ;; esac ;; Darwin-*) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`" CFLAGS="`echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`" AS_IF([test $do64bit = yes], [ case `arch` in ppc) AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag], tcl_cv_cc_arch_ppc64, [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes, tcl_cv_cc_arch_ppc64=no) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes ]);; i386) AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag], tcl_cv_cc_arch_x86_64, [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes, tcl_cv_cc_arch_x86_64=no) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [ CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes ]);; *) AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);; esac ], [ # Check for combined 32-bit and 64-bit fat build AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [ fat_32_64=yes]) ]) # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}' AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no) LDFLAGS=$hold_ldflags]) AS_IF([test $tcl_cv_ld_single_module = yes], [ SHLIB_LD="${SHLIB_LD} -Wl,-single_module" ]) SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [ LDFLAGS="$LDFLAGS -prebind"]) LDFLAGS="$LDFLAGS -headerpad_max_install_names" AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no) LDFLAGS=$hold_ldflags]) AS_IF([test $tcl_cv_ld_search_paths_first = yes], [ LDFLAGS="$LDFLAGS -Wl,-search_paths_first" ]) AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [ AC_DEFINE(MODULE_SCOPE, [__private_extern__], [Compiler support for module scope symbols]) ]) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" # TEA specific: for combined 32 & 64 bit fat builds of Tk # extensions, verify that 64-bit build is possible. AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [ AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [ AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [ for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" AC_TRY_LINK([#include ], [XrmInitialize();], tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no) for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done]) ]) # remove 64-bit arch flags from CFLAGS et al. if configuration # does not support 64-bit. AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua -o "$tcl_cv_lib_x11_64" = no], [ AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags]) for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done]) ]) ;; NEXTSTEP-*) SHLIB_CFLAGS="" SHLIB_LD='${CC} -nostdlib -r' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadNext.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OS/390-*) CFLAGS_OPTIMIZE="" # Optimizer is buggy AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h [Should OS/390 do the right thing with sockets?]) ;; OSF1-1.0|OSF1-1.1|OSF1-1.2) # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 SHLIB_CFLAGS="" # Hack: make package name same as library name SHLIB_LD='ld -R -export $@:' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadOSF.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 SHLIB_CFLAGS="-fPIC" AS_IF([test "$SHARED_BUILD" = 1], [SHLIB_LD="ld -shared"], [ SHLIB_LD="ld -non_shared" ]) SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" AS_IF([test "$SHARED_BUILD" = 1], [ SHLIB_LD='ld -shared -expect_unresolved "*"' ], [ SHLIB_LD='ld -non_shared -expect_unresolved "*"' ]) SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}']) AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [ CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"]) # see pthread_intro(3) for pthread support on osf1, k.furukawa AS_IF([test "${TCL_THREADS}" = 1], [ CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` AS_IF([test "$GCC" = yes], [ LIBS="$LIBS -lpthread -lmach -lexc" ], [ CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ]) ]) ;; QNX-6*) # QNX RTP # This may work for all QNX, but it was only reported for v6. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" # dlopen is in -lc on QNX DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. AS_IF([test "$GCC" = yes], [ SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" ], [ SHLIB_CFLAGS="-Kpic -belf" LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" ]) SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SINIX*5.4*) SHLIB_CFLAGS="-K PIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-4*) SHLIB_CFLAGS="-PIC" SHLIB_LD="ld" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # SunOS can't handle version numbers with dots in them in library # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it # requires an extra version number at the end of .so file names. # So, the library has to have a name like libtcl75.so.1.0 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; SunOS-5.[[0-6]]) # Careful to not let 5.10+ fall into this case # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?]) AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Do we really want to follow the standard? Yes we do!]) SHLIB_CFLAGS="-KPIC" # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" AS_IF([test "$GCC" = yes], [ SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ], [ SHLIB_LD="/usr/ccs/bin/ld -G -z text" CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ]) ;; SunOS-5*) # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?]) AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Do we really want to follow the standard? Yes we do!]) SHLIB_CFLAGS="-KPIC" # Check to enable 64-bit flags for compiler/linker AS_IF([test "$do64bit" = yes], [ arch=`isainfo` AS_IF([test "$arch" = "sparcv9 sparc"], [ AS_IF([test "$GCC" = yes], [ AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [ AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system]) ], [ do64bit_ok=yes CFLAGS="$CFLAGS -m64 -mcpu=v9" LDFLAGS="$LDFLAGS -m64 -mcpu=v9" SHLIB_CFLAGS="-fPIC" ]) ], [ do64bit_ok=yes AS_IF([test "$do64bitVIS" = yes], [ CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" ], [ CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" ]) # Solaris 64 uses this as well #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" ]) ], [AS_IF([test "$arch" = "amd64 i386"], [ AS_IF([test "$GCC" = yes], [ AC_MSG_WARN([64bit mode not supported with GCC on $system]) ], [ do64bit_ok=yes CFLAGS="$CFLAGS -xarch=amd64" LDFLAGS="$LDFLAGS -xarch=amd64" ]) ], [AC_MSG_WARN([64bit mode not supported for $arch])])]) ]) # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" AS_IF([test "$GCC" = yes], [ SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} AS_IF([test "$do64bit_ok" = yes], [ # We need to specify -static-libgcc or we need to # add the path to the sparv9 libgcc. # JH: static-libgcc is necessary for core Tcl, but may # not be necessary for extensions. SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc" # for finding sparcv9 libgcc, get the regular libgcc # path, remove so name and append 'sparcv9' #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..." #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir" ]) ], [ case $system in SunOS-5.[[1-9]][[0-9]]*) SHLIB_LD='${CC} -G -z text';; *) SHLIB_LD='/usr/ccs/bin/ld -G -z text';; esac CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' ]) ;; UNIX_SV* | UnixWare-5*) SHLIB_CFLAGS="-KPIC" SHLIB_LD='${CC} -G' SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no) LDFLAGS=$hold_ldflags]) AS_IF([test $tcl_cv_ld_Bexport = yes], [ LDFLAGS="$LDFLAGS -Wl,-Bexport" ]) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [ AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform]) ]) dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so dnl # until the end of configure, as configure's compile and link tests use dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's dnl # preprocessing tests use only CPPFLAGS. AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""]) # Step 4: disable dynamic loading if requested via a command-line switch. AC_ARG_ENABLE(load, AC_HELP_STRING([--enable-load], [allow dynamic loading and "load" command (default: on)]), [tcl_ok=$enableval], [tcl_ok=yes]) AS_IF([test "$tcl_ok" = no], [DL_OBJS=""]) AS_IF([test "x$DL_OBJS" != x], [BUILD_DLTEST="\$(DLTEST_TARGETS)"], [ AC_MSG_WARN([Can't figure out how to do dynamic loading or shared libraries on this system.]) SHLIB_CFLAGS="" SHLIB_LD="" SHLIB_SUFFIX="" DL_OBJS="tclLoadNone.o" DL_LIBS="" LDFLAGS="$LDFLAGS_ORIG" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" BUILD_DLTEST="" ]) LDFLAGS="$LDFLAGS $LDFLAGS_ARCH" # If we're running gcc, then change the C flags for compiling shared # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [ case $system in AIX-*) ;; BSD/OS*) ;; IRIX*) ;; NetBSD-*|FreeBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac]) AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [ # TEA specific: use PACKAGE_VERSION instead of VERSION SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}']) AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [ # TEA specific: use PACKAGE_VERSION instead of VERSION UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a']) AC_SUBST(DL_LIBS) AC_SUBST(CFLAGS_DEBUG) AC_SUBST(CFLAGS_OPTIMIZE) AC_SUBST(CFLAGS_WARNING) AC_SUBST(STLIB_LD) AC_SUBST(SHLIB_LD) AC_SUBST(SHLIB_LD_LIBS) AC_SUBST(SHLIB_CFLAGS) AC_SUBST(LD_LIBRARY_PATH_VAR) # These must be called after we do the basic CFLAGS checks and # verify any possible 64-bit or similar switches are necessary TEA_TCL_EARLY_FLAGS TEA_TCL_64BIT_FLAGS ]) #-------------------------------------------------------------------- # TEA_SERIAL_PORT # # Determine which interface to use to talk to the serial port. # Note that #include lines must begin in leftmost column for # some compilers to recognize them as preprocessor directives, # and some build environments have stdin not pointing at a # pseudo-terminal (usually /dev/null instead.) # # Arguments: # none # # Results: # # Defines only one of the following vars: # HAVE_SYS_MODEM_H # USE_TERMIOS # USE_TERMIO # USE_SGTTY # #-------------------------------------------------------------------- AC_DEFUN([TEA_SERIAL_PORT], [ AC_CHECK_HEADERS(sys/modem.h) AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [ AC_TRY_RUN([ #include int main() { struct termios t; if (tcgetattr(0, &t) == 0) { cfsetospeed(&t, 0); t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include int main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0) { t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include int main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0) { t.sg_ospeed = 0; t.sg_flags |= ODDP | EVENP | RAW; return 0; } return 1; }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include #include int main() { struct termios t; if (tcgetattr(0, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { cfsetospeed(&t, 0); t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi if test $tcl_cv_api_serial = no; then AC_TRY_RUN([ #include #include int main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi if test $tcl_cv_api_serial = no; then AC_TRY_RUN([ #include #include int main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { t.sg_ospeed = 0; t.sg_flags |= ODDP | EVENP | RAW; return 0; } return 1; }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) fi]) case $tcl_cv_api_serial in termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);; termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);; sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);; esac ]) #-------------------------------------------------------------------- # TEA_MISSING_POSIX_HEADERS # # Supply substitutes for missing POSIX header files. Special # notes: # - stdlib.h doesn't define strtol, strtoul, or # strtod insome versions of SunOS # - some versions of string.h don't declare procedures such # as strstr # # Arguments: # none # # Results: # # Defines some of the following vars: # NO_DIRENT_H # NO_ERRNO_H # NO_VALUES_H # HAVE_LIMITS_H or NO_LIMITS_H # NO_STDLIB_H # NO_STRING_H # NO_SYS_WAIT_H # NO_DLFCN_H # HAVE_SYS_PARAM_H # # HAVE_STRING_H ? # # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and # CHECK on limits.h #-------------------------------------------------------------------- AC_DEFUN([TEA_MISSING_POSIX_HEADERS], [ AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [ AC_TRY_LINK([#include #include ], [ #ifndef _POSIX_SOURCE # ifdef __Lynx__ /* * Generate compilation error to make the test fail: Lynx headers * are only valid if really in the POSIX environment. */ missing_procedure(); # endif #endif DIR *d; struct dirent *entryPtr; char *p; d = opendir("foobar"); entryPtr = readdir(d); p = entryPtr->d_name; closedir(d); ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)]) if test $tcl_cv_dirent_h = no; then AC_DEFINE(NO_DIRENT_H, 1, [Do we have ?]) fi # TEA specific: AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have ?])]) AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have ?])]) AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have ?])]) AC_CHECK_HEADER(limits.h, [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have ?])], [AC_DEFINE(NO_LIMITS_H, 1, [Do we have ?])]) AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0) if test $tcl_ok = 0; then AC_DEFINE(NO_STDLIB_H, 1, [Do we have ?]) fi AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) # See also memmove check below for a place where NO_STRING_H can be # set and why. if test $tcl_ok = 0; then AC_DEFINE(NO_STRING_H, 1, [Do we have ?]) fi AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have ?])]) AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have ?])]) # OS/390 lacks sys/param.h (and doesn't need it, by chance). AC_HAVE_HEADERS(sys/param.h) ]) #-------------------------------------------------------------------- # TEA_PATH_X # # Locate the X11 header files and the X11 library archive. Try # the ac_path_x macro first, but if it doesn't find the X stuff # (e.g. because there's no xmkmf program) then check through # a list of possible directories. Under some conditions the # autoconf macro will return an include directory that contains # no include files, so double-check its result just to be safe. # # This should be called after TEA_CONFIG_CFLAGS as setting the # LIBS line can confuse some configure macro magic. # # Arguments: # none # # Results: # # Sets the following vars: # XINCLUDES # XLIBSW # PKG_LIBS (appends to) # #-------------------------------------------------------------------- AC_DEFUN([TEA_PATH_X], [ if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then TEA_PATH_UNIX_X fi ]) AC_DEFUN([TEA_PATH_UNIX_X], [ AC_PATH_X not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then AC_TRY_CPP([#include ], , not_really_there="yes") else if test ! -r $x_includes/X11/Intrinsic.h; then not_really_there="yes" fi fi fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then AC_MSG_CHECKING([for X11 header files]) found_xincludes="no" AC_TRY_CPP([#include ], found_xincludes="yes", found_xincludes="no") if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then AC_MSG_RESULT([$i]) XINCLUDES=" -I$i" found_xincludes="yes" break fi done fi else if test "$x_includes" != ""; then XINCLUDES="-I$x_includes" found_xincludes="yes" fi fi if test found_xincludes = "no"; then AC_MSG_RESULT([couldn't find any!]) fi if test "$no_x" = yes; then AC_MSG_CHECKING([for X11 libraries]) XLIBSW=nope dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" for i in $dirs ; do if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then AC_MSG_RESULT([$i]) XLIBSW="-L$i -lX11" x_libraries="$i" break fi done else if test "$x_libraries" = ""; then XLIBSW=-lX11 else XLIBSW="-L$x_libraries -lX11" fi fi if test "$XLIBSW" = nope ; then AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow) fi if test "$XLIBSW" = nope ; then AC_MSG_RESULT([could not find any! Using -lX11.]) XLIBSW=-lX11 fi # TEA specific: if test x"${XLIBSW}" != x ; then PKG_LIBS="${PKG_LIBS} ${XLIBSW}" fi ]) #-------------------------------------------------------------------- # TEA_BLOCKING_STYLE # # The statements below check for systems where POSIX-style # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. # On these systems (mostly older ones), use the old BSD-style # FIONBIO approach instead. # # Arguments: # none # # Results: # # Defines some of the following vars: # HAVE_SYS_IOCTL_H # HAVE_SYS_FILIO_H # USE_FIONBIO # O_NONBLOCK # #-------------------------------------------------------------------- AC_DEFUN([TEA_BLOCKING_STYLE], [ AC_CHECK_HEADERS(sys/ioctl.h) AC_CHECK_HEADERS(sys/filio.h) TEA_CONFIG_SYSTEM AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) case $system in # There used to be code here to use FIONBIO under AIX. However, it # was reported that FIONBIO doesn't work under AIX 3.2.5. Since # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO # code (JO, 5/31/97). OSF*) AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) AC_MSG_RESULT([FIONBIO]) ;; SunOS-4*) AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) AC_MSG_RESULT([FIONBIO]) ;; *) AC_MSG_RESULT([O_NONBLOCK]) ;; esac ]) #-------------------------------------------------------------------- # TEA_TIME_HANLDER # # Checks how the system deals with time.h, what time structures # are used on the system, and what fields the structures have. # # Arguments: # none # # Results: # # Defines some of the following vars: # USE_DELTA_FOR_TZ # HAVE_TM_GMTOFF # HAVE_TM_TZADJ # HAVE_TIMEZONE_VAR # #-------------------------------------------------------------------- AC_DEFUN([TEA_TIME_HANDLER], [ AC_CHECK_HEADERS(sys/time.h) AC_HEADER_TIME AC_STRUCT_TIMEZONE AC_CHECK_FUNCS(gmtime_r localtime_r) AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [ AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_tzadj;], tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)]) if test $tcl_cv_member_tm_tzadj = yes ; then AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?]) fi AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [ AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_gmtoff;], tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)]) if test $tcl_cv_member_tm_gmtoff = yes ; then AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?]) fi # # Its important to include time.h in this check, as some systems # (like convex) have timezone functions, etc. # AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [ AC_TRY_COMPILE([#include ], [extern long timezone; timezone += 1; exit (0);], tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)]) if test $tcl_cv_timezone_long = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?]) else # # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. # AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [ AC_TRY_COMPILE([#include ], [extern time_t timezone; timezone += 1; exit (0);], tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)]) if test $tcl_cv_timezone_time = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?]) fi fi ]) #-------------------------------------------------------------------- # TEA_BUGGY_STRTOD # # Under Solaris 2.4, strtod returns the wrong value for the # terminating character under some conditions. Check for this # and if the problem exists use a substitute procedure # "fixstrtod" (provided by Tcl) that corrects the error. # Also, on Compaq's Tru64 Unix 5.0, # strtod(" ") returns 0.0 instead of a failure to convert. # # Arguments: # none # # Results: # # Might defines some of the following vars: # strtod (=fixstrtod) # #-------------------------------------------------------------------- AC_DEFUN([TEA_BUGGY_STRTOD], [ AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) if test "$tcl_strtod" = 1; then AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[ AC_TRY_RUN([ extern double strtod(); int main() { char *infString="Inf", *nanString="NaN", *spaceString=" "; char *term; double value; value = strtod(infString, &term); if ((term != infString) && (term[-1] == 0)) { exit(1); } value = strtod(nanString, &term); if ((term != nanString) && (term[-1] == 0)) { exit(1); } value = strtod(spaceString, &term); if (term == (spaceString+1)) { exit(1); } exit(0); }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy, tcl_cv_strtod_buggy=buggy)]) if test "$tcl_cv_strtod_buggy" = buggy; then AC_LIBOBJ([fixstrtod]) USE_COMPAT=1 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?]) fi fi ]) #-------------------------------------------------------------------- # TEA_TCL_LINK_LIBS # # Search for the libraries needed to link the Tcl shell. # Things like the math library (-lm) and socket stuff (-lsocket vs. # -lnsl) are dealt with here. # # Arguments: # Requires the following vars to be set in the Makefile: # DL_LIBS # LIBS # MATH_LIBS # # Results: # # Subst's the following var: # TCL_LIBS # MATH_LIBS # # Might append to the following vars: # LIBS # # Might define the following vars: # HAVE_NET_ERRNO_H # #-------------------------------------------------------------------- AC_DEFUN([TEA_TCL_LINK_LIBS], [ #-------------------------------------------------------------------- # On a few very rare systems, all of the libm.a stuff is # already in libc.a. Set compiler flags accordingly. # Also, Linux requires the "ieee" library for math to work # right (and it must appear before "-lm"). #-------------------------------------------------------------------- AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm") AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) #-------------------------------------------------------------------- # Interactive UNIX requires -linet instead of -lsocket, plus it # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) AC_CHECK_HEADER(net/errno.h, [ AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have ?])]) #-------------------------------------------------------------------- # Check for the existence of the -lsocket and -lnsl libraries. # The order here is important, so that they end up in the right # order in the command line generated by make. Here are some # special considerations: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- tcl_checkBoth=0 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) if test "$tcl_checkSocket" = 1; then AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt, LIBS="$LIBS -lsocket", tcl_checkBoth=1)]) fi if test "$tcl_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) fi AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, [LIBS="$LIBS -lnsl"])]) # TEA specific: Don't perform the eval of the libraries here because # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' AC_SUBST(TCL_LIBS) AC_SUBST(MATH_LIBS) ]) #-------------------------------------------------------------------- # TEA_TCL_EARLY_FLAGS # # Check for what flags are needed to be passed so the correct OS # features are available. # # Arguments: # None # # Results: # # Might define the following vars: # _ISOC99_SOURCE # _LARGEFILE64_SOURCE # _LARGEFILE_SOURCE64 # #-------------------------------------------------------------------- AC_DEFUN([TEA_TCL_EARLY_FLAG],[ AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no, AC_TRY_COMPILE([[#define ]$1[ 1 ]$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no))) if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then AC_DEFINE($1, 1, [Add the ]$1[ flag when building]) tcl_flags="$tcl_flags $1" fi ]) AC_DEFUN([TEA_TCL_EARLY_FLAGS],[ AC_MSG_CHECKING([for required early compiler flags]) tcl_flags="" TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include ], [char *p = (char *)strtoll; char *q = (char *)strtoull;]) TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include ], [struct stat64 buf; int i = stat64("/", &buf);]) TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include ], [char *p = (char *)open64;]) if test "x${tcl_flags}" = "x" ; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${tcl_flags}]) fi ]) #-------------------------------------------------------------------- # TEA_TCL_64BIT_FLAGS # # Check for what is defined in the way of 64-bit features. # # Arguments: # None # # Results: # # Might define the following vars: # TCL_WIDE_INT_IS_LONG # TCL_WIDE_INT_TYPE # HAVE_STRUCT_DIRENT64 # HAVE_STRUCT_STAT64 # HAVE_TYPE_OFF64_T # #-------------------------------------------------------------------- AC_DEFUN([TEA_TCL_64BIT_FLAGS], [ AC_MSG_CHECKING([for 64-bit integer type]) AC_CACHE_VAL(tcl_cv_type_64bit,[ tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], tcl_type_64bit=__int64, tcl_type_64bit="long long") # See if we should use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... AC_TRY_COMPILE(,[switch (0) { case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; }],tcl_cv_type_64bit=${tcl_type_64bit})]) if test "${tcl_cv_type_64bit}" = none ; then AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?]) AC_MSG_RESULT([using long]) elif test "${tcl_cv_type_64bit}" = "__int64" \ -a "${TEA_PLATFORM}" = "windows" ; then # TEA specific: We actually want to use the default tcl.h checks in # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* AC_MSG_RESULT([using Tcl header defaults]) else AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}, [What type should be used to define wide integers?]) AC_MSG_RESULT([${tcl_cv_type_64bit}]) # Now check for auxiliary declarations AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[ AC_TRY_COMPILE([#include #include ],[struct dirent64 p;], tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in ?]) fi AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[ AC_TRY_COMPILE([#include ],[struct stat64 p; ], tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)]) if test "x${tcl_cv_struct_stat64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in ?]) fi AC_CHECK_FUNCS(open64 lseek64) AC_MSG_CHECKING([for off64_t]) AC_CACHE_VAL(tcl_cv_type_off64_t,[ AC_TRY_COMPILE([#include ],[off64_t offset; ], tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)]) dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the dnl functions lseek64 and open64 are defined. if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in ?]) AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi fi ]) ## ## Here ends the standard Tcl configuration bits and starts the ## TEA specific functions ## #------------------------------------------------------------------------ # TEA_INIT -- # # Init various Tcl Extension Architecture (TEA) variables. # This should be the first called TEA_* macro. # # Arguments: # none # # Results: # # Defines and substs the following vars: # CYGPATH # EXEEXT # Defines only: # TEA_VERSION # TEA_INITED # TEA_PLATFORM (windows or unix) # # "cygpath" is used on windows to generate native path names for include # files. These variables should only be used with the compiler and linker # since they generate native path names. # # EXEEXT # Select the executable extension based on the host type. This # is a lightweight replacement for AC_EXEEXT that doesn't require # a compiler. #------------------------------------------------------------------------ AC_DEFUN([TEA_INIT], [ # TEA extensions pass this us the version of TEA they think they # are compatible with. TEA_VERSION="3.6" AC_MSG_CHECKING([for correct TEA configuration]) if test x"${PACKAGE_NAME}" = x ; then AC_MSG_ERROR([ The PACKAGE_NAME variable must be defined by your TEA configure.in]) fi if test x"$1" = x ; then AC_MSG_ERROR([ TEA version not specified.]) elif test "$1" != "${TEA_VERSION}" ; then AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"]) else AC_MSG_RESULT([ok (TEA ${TEA_VERSION})]) fi case "`uname -s`" in *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo) EXEEXT=".exe" TEA_PLATFORM="windows" ;; *) CYGPATH=echo EXEEXT="" TEA_PLATFORM="unix" ;; esac # Check if exec_prefix is set. If not use fall back to prefix. # Note when adjusted, so that TEA_PREFIX can correct for this. # This is needed for recursive configures, since autoconf propagates # $prefix, but not $exec_prefix (doh!). if test x$exec_prefix = xNONE ; then exec_prefix_default=yes exec_prefix=$prefix fi AC_SUBST(EXEEXT) AC_SUBST(CYGPATH) # This package name must be replaced statically for AC_SUBST to work AC_SUBST(PKG_LIB_FILE) # Substitute STUB_LIB_FILE in case package creates a stub library too. AC_SUBST(PKG_STUB_LIB_FILE) # We AC_SUBST these here to ensure they are subst'ed, # in case the user doesn't call TEA_ADD_... AC_SUBST(PKG_STUB_SOURCES) AC_SUBST(PKG_STUB_OBJECTS) AC_SUBST(PKG_TCL_SOURCES) AC_SUBST(PKG_HEADERS) AC_SUBST(PKG_INCLUDES) AC_SUBST(PKG_LIBS) AC_SUBST(PKG_CFLAGS) ]) #------------------------------------------------------------------------ # TEA_ADD_SOURCES -- # # Specify one or more source files. Users should check for # the right platform before adding to their list. # It is not important to specify the directory, as long as it is # in the generic, win or unix subdirectory of $(srcdir). # # Arguments: # one or more file names # # Results: # # Defines and substs the following vars: # PKG_SOURCES # PKG_OBJECTS #------------------------------------------------------------------------ AC_DEFUN([TEA_ADD_SOURCES], [ vars="$@" for i in $vars; do case $i in [\$]*) # allow $-var names PKG_SOURCES="$PKG_SOURCES $i" PKG_OBJECTS="$PKG_OBJECTS $i" ;; *) # check for existence - allows for generic/win/unix VPATH # To add more dirs here (like 'src'), you have to update VPATH # in Makefile.in as well if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ ; then AC_MSG_ERROR([could not find source file '$i']) fi PKG_SOURCES="$PKG_SOURCES $i" # this assumes it is in a VPATH dir i=`basename $i` # handle user calling this before or after TEA_SETUP_COMPILER if test x"${OBJEXT}" != x ; then j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}" else j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}" fi PKG_OBJECTS="$PKG_OBJECTS $j" ;; esac done AC_SUBST(PKG_SOURCES) AC_SUBST(PKG_OBJECTS) ]) #------------------------------------------------------------------------ # TEA_ADD_STUB_SOURCES -- # # Specify one or more source files. Users should check for # the right platform before adding to their list. # It is not important to specify the directory, as long as it is # in the generic, win or unix subdirectory of $(srcdir). # # Arguments: # one or more file names # # Results: # # Defines and substs the following vars: # PKG_STUB_SOURCES # PKG_STUB_OBJECTS #------------------------------------------------------------------------ AC_DEFUN([TEA_ADD_STUB_SOURCES], [ vars="$@" for i in $vars; do # check for existence - allows for generic/win/unix VPATH if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ ; then AC_MSG_ERROR([could not find stub source file '$i']) fi PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i" # this assumes it is in a VPATH dir i=`basename $i` # handle user calling this before or after TEA_SETUP_COMPILER if test x"${OBJEXT}" != x ; then j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}" else j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}" fi PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j" done AC_SUBST(PKG_STUB_SOURCES) AC_SUBST(PKG_STUB_OBJECTS) ]) #------------------------------------------------------------------------ # TEA_ADD_TCL_SOURCES -- # # Specify one or more Tcl source files. These should be platform # independent runtime files. # # Arguments: # one or more file names # # Results: # # Defines and substs the following vars: # PKG_TCL_SOURCES #------------------------------------------------------------------------ AC_DEFUN([TEA_ADD_TCL_SOURCES], [ vars="$@" for i in $vars; do # check for existence, be strict because it is installed if test ! -f "${srcdir}/$i" ; then AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i']) fi PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i" done AC_SUBST(PKG_TCL_SOURCES) ]) #------------------------------------------------------------------------ # TEA_ADD_HEADERS -- # # Specify one or more source headers. Users should check for # the right platform before adding to their list. # # Arguments: # one or more file names # # Results: # # Defines and substs the following vars: # PKG_HEADERS #------------------------------------------------------------------------ AC_DEFUN([TEA_ADD_HEADERS], [ vars="$@" for i in $vars; do # check for existence, be strict because it is installed if test ! -f "${srcdir}/$i" ; then AC_MSG_ERROR([could not find header file '${srcdir}/$i']) fi PKG_HEADERS="$PKG_HEADERS $i" done AC_SUBST(PKG_HEADERS) ]) #------------------------------------------------------------------------ # TEA_ADD_INCLUDES -- # # Specify one or more include dirs. Users should check for # the right platform before adding to their list. # # Arguments: # one or more file names # # Results: # # Defines and substs the following vars: # PKG_INCLUDES #------------------------------------------------------------------------ AC_DEFUN([TEA_ADD_INCLUDES], [ vars="$@" for i in $vars; do PKG_INCLUDES="$PKG_INCLUDES $i" done AC_SUBST(PKG_INCLUDES) ]) #------------------------------------------------------------------------ # TEA_ADD_LIBS -- # # Specify one or more libraries. Users should check for # the right platform before adding to their list. For Windows, # libraries provided in "foo.lib" format will be converted to # "-lfoo" when using GCC (mingw). # # Arguments: # one or more file names # # Results: # # Defines and substs the following vars: # PKG_LIBS #------------------------------------------------------------------------ AC_DEFUN([TEA_ADD_LIBS], [ vars="$@" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done AC_SUBST(PKG_LIBS) ]) #------------------------------------------------------------------------ # TEA_ADD_CFLAGS -- # # Specify one or more CFLAGS. Users should check for # the right platform before adding to their list. # # Arguments: # one or more file names # # Results: # # Defines and substs the following vars: # PKG_CFLAGS #------------------------------------------------------------------------ AC_DEFUN([TEA_ADD_CFLAGS], [ PKG_CFLAGS="$PKG_CFLAGS $@" AC_SUBST(PKG_CFLAGS) ]) #------------------------------------------------------------------------ # TEA_PREFIX -- # # Handle the --prefix=... option by defaulting to what Tcl gave # # Arguments: # none # # Results: # # If --prefix or --exec-prefix was not specified, $prefix and # $exec_prefix will be set to the values given to Tcl when it was # configured. #------------------------------------------------------------------------ AC_DEFUN([TEA_PREFIX], [ if test "${prefix}" = "NONE"; then prefix_default=yes if test x"${TCL_PREFIX}" != x; then AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}]) prefix=${TCL_PREFIX} else AC_MSG_NOTICE([--prefix defaulting to /usr/local]) prefix=/usr/local fi fi if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \ -o x"${exec_prefix_default}" = x"yes" ; then if test x"${TCL_EXEC_PREFIX}" != x; then AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}]) exec_prefix=${TCL_EXEC_PREFIX} else AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}]) exec_prefix=$prefix fi fi ]) #------------------------------------------------------------------------ # TEA_SETUP_COMPILER_CC -- # # Do compiler checks the way we want. This is just a replacement # for AC_PROG_CC in TEA configure.in files to make them cleaner. # # Arguments: # none # # Results: # # Sets up CC var and other standard bits we need to make executables. #------------------------------------------------------------------------ AC_DEFUN([TEA_SETUP_COMPILER_CC], [ # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) # in this macro, they need to go into TEA_SETUP_COMPILER instead. # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL #-------------------------------------------------------------------- # Checks to see if the make program sets the $MAKE variable. #-------------------------------------------------------------------- AC_PROG_MAKE_SET #-------------------------------------------------------------------- # Find ranlib #-------------------------------------------------------------------- AC_PROG_RANLIB #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- AC_OBJEXT AC_EXEEXT ]) #------------------------------------------------------------------------ # TEA_SETUP_COMPILER -- # # Do compiler checks that use the compiler. This must go after # TEA_SETUP_COMPILER_CC, which does the actual compiler check. # # Arguments: # none # # Results: # # Sets up CC var and other standard bits we need to make executables. #------------------------------------------------------------------------ AC_DEFUN([TEA_SETUP_COMPILER], [ # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. AC_REQUIRE([TEA_SETUP_COMPILER_CC]) #------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" -a -n "$GCC"; then AC_CACHE_CHECK([if the compiler understands -pipe], tcl_cv_cc_pipe, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_pipe = yes; then CFLAGS="$CFLAGS -pipe" fi fi #-------------------------------------------------------------------- # Common compiler flag setup #-------------------------------------------------------------------- AC_C_BIGENDIAN if test "${TEA_PLATFORM}" = "unix" ; then TEA_TCL_LINK_LIBS TEA_MISSING_POSIX_HEADERS # Let the user call this, because if it triggers, they will # need a compat/strtod.c that is correct. Users can also # use Tcl_GetDouble(FromObj) instead. #TEA_BUGGY_STRTOD fi ]) #------------------------------------------------------------------------ # TEA_MAKE_LIB -- # # Generate a line that can be used to build a shared/unshared library # in a platform independent manner. # # Arguments: # none # # Requires: # # Results: # # Defines the following vars: # CFLAGS - Done late here to note disturb other AC macros # MAKE_LIB - Command to execute to build the Tcl library; # differs depending on whether or not Tcl is being # compiled as a shared library. # MAKE_SHARED_LIB Makefile rule for building a shared library # MAKE_STATIC_LIB Makefile rule for building a static library # MAKE_STUB_LIB Makefile rule for building a stub library #------------------------------------------------------------------------ AC_DEFUN([TEA_MAKE_LIB], [ if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)" MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)" MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)" else MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)" MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}" MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)" fi if test "${SHARED_BUILD}" = "1" ; then MAKE_LIB="${MAKE_SHARED_LIB} " else MAKE_LIB="${MAKE_STATIC_LIB} " fi #-------------------------------------------------------------------- # Shared libraries and static libraries have different names. # Use the double eval to make sure any variables in the suffix is # substituted. (@@@ Might not be necessary anymore) #-------------------------------------------------------------------- if test "${TEA_PLATFORM}" = "windows" ; then if test "${SHARED_BUILD}" = "1" ; then # We force the unresolved linking of symbols that are really in # the private libraries of Tcl and Tk. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" if test x"${TK_BIN_DIR}" != x ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" fi eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" else eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" fi # Some packages build their own stubs libraries eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" if test "$GCC" = "yes"; then PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE} fi # These aren't needed on Windows (either MSVC or gcc) RANLIB=: RANLIB_STUB=: else RANLIB_STUB="${RANLIB}" if test "${SHARED_BUILD}" = "1" ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" if test x"${TK_BIN_DIR}" != x ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" fi eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" RANLIB=: else eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" fi # Some packages build their own stubs libraries eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" fi # These are escaped so that only CFLAGS is picked up at configure time. # The other values will be substituted at make time. CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" if test "${SHARED_BUILD}" = "1" ; then CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" fi AC_SUBST(MAKE_LIB) AC_SUBST(MAKE_SHARED_LIB) AC_SUBST(MAKE_STATIC_LIB) AC_SUBST(MAKE_STUB_LIB) AC_SUBST(RANLIB_STUB) ]) #------------------------------------------------------------------------ # TEA_LIB_SPEC -- # # Compute the name of an existing object library located in libdir # from the given base name and produce the appropriate linker flags. # # Arguments: # basename The base name of the library without version # numbers, extensions, or "lib" prefixes. # extra_dir Extra directory in which to search for the # library. This location is used first, then # $prefix/$exec-prefix, then some defaults. # # Requires: # TEA_INIT and TEA_PREFIX must be called first. # # Results: # # Defines the following vars: # ${basename}_LIB_NAME The computed library name. # ${basename}_LIB_SPEC The computed linker flags. #------------------------------------------------------------------------ AC_DEFUN([TEA_LIB_SPEC], [ AC_MSG_CHECKING([for $1 library]) # Look in exec-prefix for the library (defined by TEA_PREFIX). tea_lib_name_dir="${exec_prefix}/lib" # Or in a user-specified location. if test x"$2" != x ; then tea_extra_lib_dir=$2 else tea_extra_lib_dir=NONE fi for i in \ `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \ `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \ `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \ `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \ `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \ `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \ `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \ `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do if test -f "$i" ; then tea_lib_name_dir=`dirname $i` $1_LIB_NAME=`basename $i` $1_LIB_PATH_NAME=$i break fi done if test "${TEA_PLATFORM}" = "windows"; then $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\" else # Strip off the leading "lib" and trailing ".a" or ".so" tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'` $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}" fi if test "x${$1_LIB_NAME}" = x ; then AC_MSG_ERROR([not found]) else AC_MSG_RESULT([${$1_LIB_SPEC}]) fi ]) #------------------------------------------------------------------------ # TEA_PRIVATE_TCL_HEADERS -- # # Locate the private Tcl include files # # Arguments: # # Requires: # TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has # already been called. # # Results: # # Substs the following vars: # TCL_TOP_DIR_NATIVE # TCL_GENERIC_DIR_NATIVE # TCL_UNIX_DIR_NATIVE # TCL_WIN_DIR_NATIVE # TCL_BMAP_DIR_NATIVE # TCL_TOOL_DIR_NATIVE # TCL_PLATFORM_DIR_NATIVE # TCL_BIN_DIR_NATIVE # TCL_INCLUDES #------------------------------------------------------------------------ AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [ AC_MSG_CHECKING([for Tcl private include files]) TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}` TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\" TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\" TCL_UNIX_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\" TCL_WIN_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\" TCL_BMAP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/bitmaps\" TCL_TOOL_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/tools\" TCL_COMPAT_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/compat\" if test "${TEA_PLATFORM}" = "windows"; then TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE} else TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE} fi # We want to ensure these are substituted so as not to require # any *_NATIVE vars be defined in the Makefile TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}" if test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use # the framework's Headers and PrivateHeaders directories case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -d "${TCL_BIN_DIR}/Headers" -a -d "${TCL_BIN_DIR}/PrivateHeaders"; then TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"; else TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"; fi ;; esac else if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}]) fi fi AC_SUBST(TCL_TOP_DIR_NATIVE) AC_SUBST(TCL_GENERIC_DIR_NATIVE) AC_SUBST(TCL_UNIX_DIR_NATIVE) AC_SUBST(TCL_WIN_DIR_NATIVE) AC_SUBST(TCL_BMAP_DIR_NATIVE) AC_SUBST(TCL_TOOL_DIR_NATIVE) AC_SUBST(TCL_PLATFORM_DIR_NATIVE) AC_SUBST(TCL_INCLUDES) AC_MSG_RESULT([Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}]) ]) #------------------------------------------------------------------------ # TEA_PUBLIC_TCL_HEADERS -- # # Locate the installed public Tcl header files # # Arguments: # None. # # Requires: # CYGPATH must be set # # Results: # # Adds a --with-tclinclude switch to configure. # Result is cached. # # Substs the following vars: # TCL_INCLUDES #------------------------------------------------------------------------ AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [ AC_MSG_CHECKING([for Tcl public headers]) AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval}) AC_CACHE_VAL(ac_cv_c_tclh, [ # Use the value from --with-tclinclude, if it was given if test x"${with_tclinclude}" != x ; then if test -f "${with_tclinclude}/tcl.h" ; then ac_cv_c_tclh=${with_tclinclude} else AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h]) fi else if test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use # the framework's Headers directory case ${TCL_DEFS} in *TCL_FRAMEWORK*) list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`" ;; esac fi # Look in the source dir only if Tcl is not installed, # and in that situation, look there before installed locations. if test -f "${TCL_BIN_DIR}/Makefile" ; then list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`" fi # Check order: pkg --prefix location, Tcl's --prefix location, # relative to directory of tclConfig.sh. eval "temp_includedir=${includedir}" list="$list \ `ls -d ${temp_includedir} 2>/dev/null` \ `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`" if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then list="$list /usr/local/include /usr/include" if test x"${TCL_INCLUDE_SPEC}" != x ; then d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'` list="$list `ls -d ${d} 2>/dev/null`" fi fi for i in $list ; do if test -f "$i/tcl.h" ; then ac_cv_c_tclh=$i break fi done fi ]) # Print a message based on how we determined the include path if test x"${ac_cv_c_tclh}" = x ; then AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude]) else AC_MSG_RESULT([${ac_cv_c_tclh}]) fi # Convert to a native path and substitute into the output files. INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}` TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" AC_SUBST(TCL_INCLUDES) ]) #------------------------------------------------------------------------ # TEA_PRIVATE_TK_HEADERS -- # # Locate the private Tk include files # # Arguments: # # Requires: # TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has # already been called. # # Results: # # Substs the following vars: # TK_INCLUDES #------------------------------------------------------------------------ AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [ AC_MSG_CHECKING([for Tk private include files]) TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}` TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\" TK_UNIX_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\" TK_WIN_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\" TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\" TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\" if test "${TEA_PLATFORM}" = "windows"; then TK_PLATFORM_DIR_NATIVE=${TK_WIN_DIR_NATIVE} else TK_PLATFORM_DIR_NATIVE=${TK_UNIX_DIR_NATIVE} fi # We want to ensure these are substituted so as not to require # any *_NATIVE vars be defined in the Makefile TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}" # Detect and add ttk subdir if test -d ${TK_SRC_DIR_NATIVE}/generic/ttk; then TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\"" fi if test "${TEA_WINDOWINGSYSTEM}" = "win32" \ -o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then TK_INCLUDES="${TK_INCLUDES} -I${TK_XLIB_DIR_NATIVE}" fi if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then TK_INCLUDES="${TK_INCLUDES} -I${TK_SRC_DIR_NATIVE}/macosx" fi if test "`uname -s`" = "Darwin"; then # If Tk was built as a framework, attempt to use # the framework's Headers and PrivateHeaders directories case ${TK_DEFS} in *TK_FRAMEWORK*) if test -d "${TK_BIN_DIR}/Headers" -a -d "${TK_BIN_DIR}/PrivateHeaders"; then TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"; fi ;; esac else if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}]) fi fi AC_SUBST(TK_TOP_DIR_NATIVE) AC_SUBST(TK_UNIX_DIR_NATIVE) AC_SUBST(TK_WIN_DIR_NATIVE) AC_SUBST(TK_GENERIC_DIR_NATIVE) AC_SUBST(TK_XLIB_DIR_NATIVE) AC_SUBST(TK_PLATFORM_DIR_NATIVE) AC_SUBST(TK_INCLUDES) AC_MSG_RESULT([Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}]) ]) #------------------------------------------------------------------------ # TEA_PUBLIC_TK_HEADERS -- # # Locate the installed public Tk header files # # Arguments: # None. # # Requires: # CYGPATH must be set # # Results: # # Adds a --with-tkinclude switch to configure. # Result is cached. # # Substs the following vars: # TK_INCLUDES #------------------------------------------------------------------------ AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [ AC_MSG_CHECKING([for Tk public headers]) AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files], with_tkinclude=${withval}) AC_CACHE_VAL(ac_cv_c_tkh, [ # Use the value from --with-tkinclude, if it was given if test x"${with_tkinclude}" != x ; then if test -f "${with_tkinclude}/tk.h" ; then ac_cv_c_tkh=${with_tkinclude} else AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h]) fi else if test "`uname -s`" = "Darwin"; then # If Tk was built as a framework, attempt to use # the framework's Headers directory. case ${TK_DEFS} in *TK_FRAMEWORK*) list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`" ;; esac fi # Look in the source dir only if Tk is not installed, # and in that situation, look there before installed locations. if test -f "${TK_BIN_DIR}/Makefile" ; then list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`" fi # Check order: pkg --prefix location, Tk's --prefix location, # relative to directory of tkConfig.sh, Tcl's --prefix location, # relative to directory of tclConfig.sh. eval "temp_includedir=${includedir}" list="$list \ `ls -d ${temp_includedir} 2>/dev/null` \ `ls -d ${TK_PREFIX}/include 2>/dev/null` \ `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \ `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`" if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then list="$list /usr/local/include /usr/include" fi for i in $list ; do if test -f "$i/tk.h" ; then ac_cv_c_tkh=$i break fi done fi ]) # Print a message based on how we determined the include path if test x"${ac_cv_c_tkh}" = x ; then AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude]) else AC_MSG_RESULT([${ac_cv_c_tkh}]) fi # Convert to a native path and substitute into the output files. INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}` TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" AC_SUBST(TK_INCLUDES) if test "${TEA_WINDOWINGSYSTEM}" = "win32" \ -o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then # On Windows and Aqua, we need the X compat headers AC_MSG_CHECKING([for X11 header files]) if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`" TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" AC_SUBST(TK_XINCLUDES) fi AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}]) fi ]) #------------------------------------------------------------------------ # TEA_PATH_CONFIG -- # # Locate the ${1}Config.sh file and perform a sanity check on # the ${1} compile flags. These are used by packages like # [incr Tk] that load *Config.sh files from more than Tcl and Tk. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-$1=... # # Defines the following vars: # $1_BIN_DIR Full path to the directory containing # the $1Config.sh file #------------------------------------------------------------------------ AC_DEFUN([TEA_PATH_CONFIG], [ # # Ok, lets find the $1 configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-$1 # if test x"${no_$1}" = x ; then # we reset no_$1 in case something fails here no_$1=true AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval}) AC_MSG_CHECKING([for $1 configuration]) AC_CACHE_VAL(ac_cv_c_$1config,[ # First check to see if --with-$1 was specified. if test x"${with_$1config}" != x ; then case ${with_$1config} in */$1Config.sh ) if test -f ${with_$1config}; then AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself]) with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'` fi;; esac if test -f "${with_$1config}/$1Config.sh" ; then ac_cv_c_$1config=`(cd ${with_$1config}; pwd)` else AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh]) fi fi # then check for a private $1 installation if test x"${ac_cv_c_$1config}" = x ; then for i in \ ../$1 \ `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ ../../$1 \ `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ ../../../$1 \ `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ ${srcdir}/../$1 \ `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ ; do if test -f "$i/$1Config.sh" ; then ac_cv_c_$1config=`(cd $i; pwd)` break fi if test -f "$i/unix/$1Config.sh" ; then ac_cv_c_$1config=`(cd $i/unix; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_$1config}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ ; do if test -f "$i/$1Config.sh" ; then ac_cv_c_$1config=`(cd $i; pwd)` break fi done fi ]) if test x"${ac_cv_c_$1config}" = x ; then $1_BIN_DIR="# no $1 configs found" AC_MSG_WARN([Cannot find $1 configuration definitions]) exit 0 else no_$1= $1_BIN_DIR=${ac_cv_c_$1config} AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh]) fi fi ]) #------------------------------------------------------------------------ # TEA_LOAD_CONFIG -- # # Load the $1Config.sh file # # Arguments: # # Requires the following vars to be set: # $1_BIN_DIR # # Results: # # Subst the following vars: # $1_SRC_DIR # $1_LIB_FILE # $1_LIB_SPEC # #------------------------------------------------------------------------ AC_DEFUN([TEA_LOAD_CONFIG], [ AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh]) if test -f "${$1_BIN_DIR}/$1Config.sh" ; then AC_MSG_RESULT([loading]) . "${$1_BIN_DIR}/$1Config.sh" else AC_MSG_RESULT([file not found]) fi # # If the $1_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable $1_LIB_SPEC will be set to the value # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC # instead of $1_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. # if test -f "${$1_BIN_DIR}/Makefile" ; then AC_MSG_WARN([Found Makefile - using build library specs for $1]) $1_LIB_SPEC=${$1_BUILD_LIB_SPEC} $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC} $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH} fi AC_SUBST($1_VERSION) AC_SUBST($1_BIN_DIR) AC_SUBST($1_SRC_DIR) AC_SUBST($1_LIB_FILE) AC_SUBST($1_LIB_SPEC) AC_SUBST($1_STUB_LIB_FILE) AC_SUBST($1_STUB_LIB_SPEC) AC_SUBST($1_STUB_LIB_PATH) ]) #------------------------------------------------------------------------ # TEA_PATH_CELIB -- # # Locate Keuchel's celib emulation layer for targeting Win/CE # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-celib=... # # Defines the following vars: # CELIB_DIR Full path to the directory containing # the include and platform lib files #------------------------------------------------------------------------ AC_DEFUN([TEA_PATH_CELIB], [ # First, look for one uninstalled. # the alternative search directory is invoked by --with-celib if test x"${no_celib}" = x ; then # we reset no_celib in case something fails here no_celib=true AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval}) AC_MSG_CHECKING([for Windows/CE celib directory]) AC_CACHE_VAL(ac_cv_c_celibconfig,[ # First check to see if --with-celibconfig was specified. if test x"${with_celibconfig}" != x ; then if test -d "${with_celibconfig}/inc" ; then ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` else AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory]) fi fi # then check for a celib library if test x"${ac_cv_c_celibconfig}" = x ; then for i in \ ../celib-palm-3.0 \ ../celib \ ../../celib-palm-3.0 \ ../../celib \ `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \ ${srcdir}/../celib-palm-3.0 \ ${srcdir}/../celib \ `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \ ; do if test -d "$i/inc" ; then ac_cv_c_celibconfig=`(cd $i; pwd)` break fi done fi ]) if test x"${ac_cv_c_celibconfig}" = x ; then AC_MSG_ERROR([Cannot find celib support library directory]) else no_celib= CELIB_DIR=${ac_cv_c_celibconfig} CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'` AC_MSG_RESULT([found $CELIB_DIR]) fi fi ]) # Local Variables: # mode: autoconf # End: tile-0.8.2/tclconfig/teax.m40000644000076500007650000000607610316635321015230 0ustar joejoe00000000000000dnl dnl teax.m4,v 1.3 2005/09/29 00:52:33 jenglish Exp dnl dnl Additional autoconf macros for TEA dnl dnl dnl _TEAX_CHECK_MSVC -- dnl dnl Defines the shell variable "USING_MSVC" as "yes" or "no". dnl Several tests on Windows work differently depending on dnl whether we're using MSVC or GCC. Current heuristic: dnl if it's Windows, and CC is not gcc, we're using MSVC. dnl dnl This macro doesn't need to be called from configure.ac; dnl other macros that need it will AC_REQUIRE it. dnl AC_DEFUN([_TEAX_CHECK_MSVC],[ #@ _TEAX_CHECK_MSVC AC_REQUIRE([AC_PROG_CC]) if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then USING_MSVC="yes" else USING_MSVC="no" fi; ]) dnl TEAX_CONFIG_LDFLAGS -- dnl dnl Sets the following additional variables used when building libraries: dnl dnl SHLIB_LD_OUT dnl Either "-o " or "/out:" depending on whether SHLIB_LD dnl is a Unix-style linker (ld) or MS-style (link) dnl dnl STLIB_LD_OUT -- dnl Either " " or "/out:" depending on whether STLIB_LD dnl is Unix-style (ar) or MS-style (lib) dnl dnl SHLIB_SUFFIX -- dnl Suffix for shared libraries. This is actually computed by dnl TEA_CONFIG_CFLAGS, but it doesn't AC_SUBST() it. dnl dnl STLIB_SUFFIX -- dnl Suffix for static libraries (.a, .lib, ...) dnl dnl LIB_PREFIX -- dnl Prefix for library names; either "lib" or empty. dnl AC_DEFUN([TEAX_CONFIG_LDFLAGS],[ #@ TEAX_CONFIG_LDFLAGS AC_REQUIRE([_TEAX_CHECK_MSVC]) if test "${USING_MSVC}" = "yes"; then SHLIB_LD_OUT="/out:" STLIB_LD_OUT="/out:" STLIB_SUFFIX=".lib" LIB_PREFIX="" else SHLIB_LD_OUT="-o " STLIB_LD_OUT=" " STLIB_SUFFIX=".a" LIB_PREFIX="lib" fi AC_SUBST(SHLIB_LD_OUT) AC_SUBST(STLIB_LD_OUT) AC_SUBST(SHLIB_SUFFIX) AC_SUBST(STLIB_SUFFIX) AC_SUBST(LIB_PREFIX) ]) dnl TEAX_EXPAND_CFLAGS -- dnl Computes final value of CFLAGS macro. dnl dnl Uses the same logic as TEA_MAKE_LIB, except that dnl ${CFLAGS_DEFAULT}, ${CFLAGS_WARNING}, and ${SHLIB_CFLAGS} dnl are expanded at configure-time instead of at make-time. dnl AC_DEFUN([TEAX_EXPAND_CFLAGS],[ #@ TEAX_EXPAND_CFLAGS AC_REQUIRE([TEA_ENABLE_SYMBOLS]) CFLAGS="${CFLAGS} ${CFLAGS_DEFAULT} ${CFLAGS_WARNING}" if test "${SHARED_BUILD}" = "1" ; then CFLAGS="${CFLAGS} ${SHLIB_CFLAGS}" fi ]) dnl TEAX_FIX_LIB_SPECS -- dnl TCL_STUB_LIB_SPEC is supposed to contain the linker flags dnl for picking up the Tcl stub library; however, the settings dnl in tclConfig.sh only work on Unix and with GCC on Windows. dnl TEAX_FIX_LIB_SPECS adjusts TCL_STUB_LIB_SPEC et. al. so dnl they work with MSVC as well. dnl dnl (TEA_MAKE_LIB works around this in a different way.) dnl AC_DEFUN([TEAX_FIX_LIB_SPECS],[ #@TEAX_FIX_LIB_SPECS AC_REQUIRE([_TEAX_CHECK_MSVC]) if test "${USING_MSVC}" = "yes"; then TCL_STUB_LIB_SPEC="$TCL_STUB_LIB_PATH" TK_STUB_LIB_SPEC="$TK_STUB_LIB_PATH" # tclConfig.sh doesn't define TCL_LIB_SPEC, but if it did, # it would be as follows: eval TCL_LIB_SPEC="${TCL_EXEC_PREFIX}/lib/$TCL_LIB_FILE" # Same for TK_LIB_SPEC: eval TK_LIB_SPEC="${TK_EXEC_PREFIX}/lib/$TK_LIB_FILE" fi ]) tile-0.8.2/tests/0000755000076500007650000000000010731273177013216 5ustar joejoe00000000000000tile-0.8.2/tests/bwidget.test0000644000076500007650000000616210334707361015545 0ustar joejoe00000000000000# # Test BWidget / Tile compatibility. # # NOTE: This part of the test suite is no longer operative: # [namespace import -force ttk::*] is not expected or intended to work. # # Keeping the file around for now since it contains some historical # information about how tile *tried* to make it work, and what # sort of things went wrong. # package require tcltest tcltest::cleanupTests ; return loadTestedCommands lappend auto_path . package require tile set have_compat 0 if {![catch {ttk::pkgconfig get compat} compat]} {set have_compat $compat} testConstraint bwidget [expr {$have_compat && ![catch {package require BWidget}]}] test bwidget-1.0 "Setup for BWidget test" -constraints bwidget -body { namespace import -force ttk::* puts "Loaded BWidget version [package provide BWidget]" } test bwidget-1.1 "Make Label widget" -constraints bwidget -body { pack [Label .w] } -cleanup {destroy .w} test bwidget-1.2 "Make ScrolledWindow widget" -constraints bwidget -body { pack [ScrolledWindow .w -auto both -scrollbar vertical] } -cleanup {destroy .w} test bwidget-1.3 "Make PagesManager widget" -constraints bwidget -body { pack [PagesManager .w] } -cleanup {destroy .w} # # ProgressBar: this one fails with 'unknown color name "xxx"', # where "xxx" is the default value of some other option # (variously, "4m", "100", something else). # # Update: fixed now. Source of problem: widgets were using "unused" # as the resource database name for compatibility options; # BWidgets keys off the db name instead of the option name. # test bwidget-1.4 "Make ProgressBar widget" -constraints bwidget -body { pack [ProgressBar .w] } -cleanup {destroy .w} # @@@ TODO: full BWidget coverage, # @@@ not just the ones people have reported problems with. # # <>: # # TK_OPTION_NULL_OK doesn't work for TK_OPTION_INT (among others); # see Bug #967209. # # This means that [.l configure -width [.l cget -width]] -- which is # essentially what BWidgets does -- will raise an error if -width has # a NULL default. # # Temporary workaround: declare -width, etc. as TK_OPTION_STRING instead. # This disables typechecking in the 'configure' method, but it seems # to be the best way to avoid the BWidget incompatibility for now. # test nulloptions-1.1 "Test null options" -body { ttk::label .tl .tl configure -width [.tl cget -width] } -cleanup { destroy .tl } # # <> This also means we have to (partially) disable # the widget option / element option consistency checks. # test nulloptions-1.2 "Ensure workaround doesn't break -width" -body { ttk::label .tl -text "x" -width 0 set w1 [winfo reqwidth .tl] .tl configure -width 10 set w2 [winfo reqwidth .tl] expr {$w2 > $w1} } -result 1 -cleanup { destroy .tl } test nulloptions-1.3 "Exhaustive test" -body { set readonlyOpts [list -class] foreach widget $::ttk::widgets { #puts "$widget" ttk::$widget .w foreach configspec [.w configure] { set option [lindex $configspec 0] if {[lsearch -exact $readonlyOpts $option] >= 0} { continue } .w configure $option [.w cget $option] } destroy .w } } tcltest::cleanupTests tile-0.8.2/tests/all.tcl0000644000076500007650000000056510365600374014474 0ustar joejoe00000000000000# # source all tests. # package require tcltest 2 namespace eval tile { set dir [file dirname [info script]] set ::tcltest::testsDirectory $dir set library [set ::env(TILE_LIBRARY) [file join $dir .. library]] } lappend auto_path [pwd] $::tile::library eval tcltest::configure $::argv tcltest::runAllTests if {![catch { package present Tk }]} { destroy . } tile-0.8.2/tests/cbtest.tcl0000644000076500007650000001002110711152220015157 0ustar joejoe00000000000000## # combobox test program: # # side-by-side-by-side comparison of Tile, BWidget, and Brian Oakley's combobox # # # Autocomplete: maybe need custom match procedure? (string match -nocase) # # Things to check: # Focus indicator # Blinking insert cursor (none on readonly combobox) # Listbox scrollbar arrow lines up with popdown arrow # Mouse cursor (I-beam vs. normal) over various elements. # Normal mouse cursor in readonly combobox # Location of popdown menu when close to screen edge # Focus returns to combobox on Unpost (Cancel and Select) # ButtonRelease outside of popdown - Cancel? Select? Leave posted? # Keyboard traversal (incl. Shift+Tab). # -state disabled: # + grayed out # + do not take focus on click # + do not post listbox # Click in editable combobox -- should set icursor, don't select # Keyboard traversal into combobox -- should select # Traversal out of combobox (both and ) # Change value (using other combobox) -- repost listbox -- # make sure proper entry is highlighted. # lappend auto_path . ; package require tile package require BWidget package require combobox source [file join [file dirname [info script]] testutils.tcl] set values \ [list abc def ghi jkl mno pqrs tuv wxyz yabba dabba scooby doobie doo] set t [ttk::frame .t] grid [ttk::label $t.l1 -text "Tile"] \ [ttk::label $t.l2 -text "BWidget"] \ [ttk::label $t.l3 -text "Oakley"] \ -row 1 -sticky news; ttk::combobox $t.rcb1 -width 30 -textvariable V -values $values -state readonly ComboBox $t.rcb2 -width 30 -textvariable V -values $values -editable false combobox::combobox $t.rcb3 -textvariable V -width 30 -listvar values -editable false ttk::combobox $t.ecb1 -width 30 -textvariable V -values $values ComboBox $t.ecb2 -width 30 -textvariable V -values $values -editable true ;#-autocomplete true combobox::combobox $t.ecb3 -textvariable V -width 30 -listvar values -editable true grid $t.rcb1 $t.rcb2 $t.rcb3 -sticky news -pady 4 -padx 4 -row 2 grid $t.ecb1 $t.ecb2 $t.ecb3 -sticky news -pady 4 -padx 4 -row 3 grid columnconfigure $t 0 -uniform c -weight 1 grid columnconfigure $t 1 -uniform c -weight 1 # Active element monitor: # bind $t.rcb1 { set ::element [%W identify %x %y] } bind $t.ecb1 { set ::element [%W identify %x %y] } # Focus monitor: # proc focusMonitor {} { set ::focusWidget [focus] ; after 200 focusMonitor } focusMonitor # Grab monitor: # proc grabMonitor {} { global grabWidget set grabWidget [grab current] if {$grabWidget ne ""} { lappend grabWidget [grab status $grabWidget] } after 200 grabMonitor } grabMonitor set mon [ttk::frame $t.mon] ttk::label $mon.el -text "Element:" -anchor e ttk::label $mon.e -textvariable ::element -anchor w ttk::label $mon.fl -text "Focus:" -anchor e ttk::label $mon.f -textvariable ::focusWidget -anchor w ttk::label $mon.gl -text "Grab:" -anchor e ttk::label $mon.g -textvariable ::grabWidget -anchor w grid $mon.el $mon.e -row 0 -sticky news grid $mon.fl $mon.f -row 1 -sticky news grid $mon.gl $mon.g -row 2 -sticky news grid columnconfigure $mon 1 -weight 1 grid $t.mon -row 0 -columnspan 2 -sticky nwe grid rowconfigure $t 4 -weight 1 grid [ttk::frame $t.cmd] -row 5 -sticky nwes -columnspan 3 pack [ttk::button $t.cmd.close -text "Close" -command [list destroy .]] \ -side right -padx 4 -pady 4 ### pack $t -expand true -fill both focus $t.ecb1 if {[tk windowingsystem] eq "aqua"} { set Meta Command } { set Meta Alt } bind all <$Meta-Key-d> { %W configure -state disabled } ;# "&disable" bind all <$Meta-Key-e> { %W configure -state normal } ;# "&enable" bind all <$Meta-Key-w> { %W configure -state readonly } ;# "&write-protect" bind all <$Meta-Key-q> { destroy . } bind all <$Meta-Key-b> { error "BGerror - testing" } bind all { focus -force %W } bind all { puts "+F: %W" } bind all { puts "-f: %W" } bind all { puts "+B: %W" } bind all { puts "-b: %W" } bind all { puts "---- mark ----" } # In case of a stuck grab: to set focus; to quit tile-0.8.2/tests/combobox.test0000644000076500007650000000212110474406463015723 0ustar joejoe00000000000000# # Tile package: combobox widget tests # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile test combobox-1.0 "Combobox tests -- setup" -body { ttk::combobox .cb } -result .cb test combobox-1.1 "Bad -values list" -body { .cb configure -values "bad \{list" } -result "unmatched open brace in list" -returnCodes 1 test combobox-1.end "Combobox tests -- cleanup" -body { destroy .cb } test combobox-2.0 "current command" -body { ttk::combobox .cb -values [list a b c d e a] .cb current } -result -1 test combobox-2.1 "current -- set index" -body { .cb current 5 .cb get } -result a test combobox-2.2 "current -- change -values" -body { .cb configure -values [list c b a d e] .cb current } -result 2 test combobox-2.3 "current -- change value" -body { .cb set "b" .cb current } -result 1 test combobox-2.4 "current -- value not in list" -body { .cb set "z" .cb current } -result -1 test combobox-end "Cleanup" -body { destroy .cb } tcltest::cleanupTests tile-0.8.2/tests/compound.tcl0000644000076500007650000000522610255130047015540 0ustar joejoe00000000000000# # Interactive test for -compound option. # lappend auto_path . package require tile source [file join [file dirname [info script]] testutils.tcl] # Load icons... source [file join [file dirname [info script]] ../demos/iconlib.tcl] set icons {new open error} foreach icon $icons { set Icon($icon) [image create photo -data $ImgData($icon)] } ttk::label .tb -image $Icon(new) -text text -compound left -padding 0 label .b -image $Icon(new) -text text -compound left -padx 0 -pady 0 variable compoundStrings {text image center top bottom left right none} set c [ttk::labelframe .cctl -text "Compound"] foreach string $compoundStrings { pack [ttk::radiobutton $c.$string -text [string totitle $string] \ -variable compound -value $string -command setCompound] \ -side top -expand false -fill x ; } set c [ttk::labelframe .ictl -text "Icon"] set ::Icon(none) "" pack [ttk::radiobutton $c.inone -text "None" \ -variable icon -value $string -command setIcon] \ -side top -expand false -fill x; foreach string $icons { pack [ttk::radiobutton $c.i$string -text $string \ -variable icon -value $string -command setIcon] \ -side top -expand false -fill x; } variable anchorStrings {n ne e se s sw w nw center} set c [ttk::labelframe .actl -text "Anchor"] foreach string $anchorStrings { pack [ttk::radiobutton $c.$string -text $string \ -variable anchor -value $string -command setAnchor] \ -side top -expand false -fill x ; } variable reliefStrings {flat groove raised ridge solid sunken} set c [ttk::labelframe .rctl -text "Relief"] foreach string $reliefStrings { pack [ttk::radiobutton $c.$string -text $string \ -variable relief -value $string -command setRelief] \ -side top -expand false -fill x ; } set width 0 spinbox .wctl -textvariable width -command setWidth \ -from -15 -to 15 -increment 1 pack .cctl -side left -expand false -fill none -anchor n pack .ictl -side left -expand false -fill none -anchor n pack .actl -side left -expand false -fill none -anchor n pack .rctl -side left -expand false -fill none -anchor n pack .wctl -side left -expand false -fill none -anchor n pack .tb .b -side top -expand true -fill both proc setCompound {} { .tb configure -compound $::compound catch { .b configure -compound $::compound } } proc setAnchor {} { .tb configure -anchor $::anchor .b configure -anchor $::anchor } proc setRelief {} { .tb configure -relief $::relief .b configure -relief $::relief } proc setIcon {} { global Icon icon .tb configure -image $Icon($icon) .b configure -image $Icon($icon) } proc setWidth {} { .tb configure -width $::width .b configure -width $::width } tile-0.8.2/tests/entry.test0000644000076500007650000001667610623417671015277 0ustar joejoe00000000000000# # ttk::entry widget tests # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile variable scrollInfo proc scroll args { global scrollInfo set scrollInfo $args } # Some of the tests raise background errors; # override default bgerror to catch them. # variable bgerror "" proc bgerror {error} { variable bgerror $error variable bgerrorInfo $::errorInfo variable bgerrorCode $::errorCode } # test entry-1.1 "Create entry widget" -body { ttk::entry .e } -result .e test entry-1.2 "Insert" -body { .e insert end abcde .e get } -result abcde test entry-1.3 "Selection" -body { .e selection range 1 3 selection get } -result bc test entry-1.4 "Delete" -body { .e delete 1 3 .e get } -result ade test entry-1.5 "Deletion - insert cursor" -body { .e insert end abcde .e icursor 0 .e delete 0 end .e index insert } -result 0 test entry-1.6 "Deletion - insert cursor at end" -body { .e insert end abcde .e icursor end .e delete 0 end .e index insert } -result 0 test entry-1.7 "Deletion - insert cursor in the middle " -body { .e insert end abcde .e icursor 3 .e delete 0 end .e index insert } -result 0 test entry-1.done "Cleanup" -body { destroy .e } # Scrollbar tests. test entry-2.1 "Create entry before scrollbar" -body { pack [ttk::entry .te -xscrollcommand [list .tsb set]] \ -expand true -fill both pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \ -expand false -fill x } -cleanup {destroy .te .tsb} test entry-2.2 "Initial scroll position" -body { ttk::entry .e -font fixed -width 5 -xscrollcommand scroll .e insert end "0123456789" pack .e; update set scrollInfo } -result {0 0.5} -cleanup { destroy .e } # NOTE: result can vary depending on font. # Bounding box / scrolling tests. test entry-3.0 "Series 3 setup" -body { ttk::style theme use default variable fixed fixed variable cw [font measure $fixed a] variable ch [font metrics $fixed -linespace] variable bd 2 ;# border + padding variable ux [font measure $fixed \u4e4e] pack [ttk::entry .e -font $fixed -width 20] update } test entry-3.1 "bbox widget command" -body { .e delete 0 end .e bbox 0 } -result [list $bd $bd 0 $ch] test entry-3.2 "xview" -body { .e delete 0 end; .e insert end [string repeat "0" 40] update idletasks set result [.e xview] } -result {0 0.5} test entry-3.last "Series 3 cleanup" -body { destroy .e } # Selection tests: test entry-4.0 "Selection test - setup" -body { ttk::entry .e .e insert end asdfasdf .e selection range 0 end } test entry-4.1 "Selection test" -body { selection get } -result asdfasdf test entry-4.2 "Disable -exportselection" -body { .e configure -exportselection false selection get } -returnCodes error -result "PRIMARY selection doesn't exist*" -match glob test entry-4.3 "Reenable -exportselection" -body { .e configure -exportselection true selection get } -result asdfasdf test entry-4.4 "Force selection loss" -body { selection own . .e index sel.first } -returnCodes error -result "selection isn't in widget .e" test entry-4.5 "Allow selection changes if readonly" -body { .e delete 0 end .e insert end 0123456789 .e selection range 0 end .e configure -state readonly .e selection range 2 4 .e configure -state normal list [.e index sel.first] [.e index sel.last] } -result {2 4} test entry-4.6 "Disallow selection changes if disabled" -body { .e delete 0 end .e insert end 0123456789 .e selection range 0 end .e configure -state disabled .e selection range 2 4 .e configure -state normal list [.e index sel.first] [.e index sel.last] } -result {0 10} test entry-4.7 {sel.first and sel.last gravity} -body { set result [list] .e delete 0 end .e insert 0 0123456789 .e select range 2 6 .e insert 2 XXX lappend result [.e index sel.first] [.e index sel.last] .e insert 6 YYY lappend result [.e index sel.first] [.e index sel.last] [.e get] } -result {5 9 5 12 01XXX2YYY3456789} # Self-destruct tests. test entry-5.1 {widget deletion while active} -body { destroy .e pack [ttk::entry .e] update .e config -xscrollcommand { destroy .e } update idletasks winfo exists .e } -result 0 # TODO: test killing .e in -validatecommand, -invalidcommand, variable trace; # -textvariable tests. test entry-6.1 {Update linked variable in write trace} -body { proc override args { global x set x "Overridden!" } catch {destroy .e} set x "" trace variable x w override ttk::entry .e -textvariable x .e insert 0 "Some text" set result [list $x [.e get]] set result } -result {Overridden! Overridden!} -cleanup { unset x rename override {} destroy .e } test entry-6.2 {-textvariable tests} -body { set result [list] ttk::entry .e -textvariable x set x "text" lappend result [.e get] unset x lappend result [.e get] .e insert end "newtext" lappend result [.e get] [set x] } -result [list "text" "" "newtext" "newtext"] -cleanup { destroy .e unset -nocomplain x } test entry-7.1 {Bad style options} -body { ttk::style theme create entry-7.1 -settings { ttk::style configure TEntry -foreground BadColor ttk::style map TEntry -foreground {readonly AnotherBadColor} ttk::style map TEntry -font {readonly ABadFont} ttk::style map TEntry \ -selectbackground {{} BadColor} \ -selectforeground {{} BadColor} \ -insertcolor {{} BadColor} } pack [ttk::entry .e -text "Don't crash"] ttk::style theme use entry-7.1 update .e selection range 0 end update .e state readonly; update } -cleanup { destroy .e ; ttk::style theme use default } test entry-8.1 "Unset linked variable" -body { variable foo "bar" pack [ttk::entry .e -textvariable foo] unset foo .e insert end "baz" list [.e cget -textvariable] [.e get] [set foo] } -result [list foo "baz" "baz"] -cleanup { destroy .e } test entry-8.2 "Unset linked variable by deleting namespace" -body { namespace eval ::test { variable foo "bar" } pack [ttk::entry .e -textvariable ::test::foo] namespace delete ::test .e insert end "baz" ;# <== error here list [.e cget -textvariable] [.e get] [set foo] } -returnCodes error -result "*parent namespace doesn't exist*" -match glob # '-result [list ::test::foo "baz" "baz"]' would also be sensible, # but Tcl namespaces don't work that way. test entry-8.2a "Followup to test 8.2" -body { .e cget -textvariable } -result ::test::foo -cleanup { destroy .e } # For 8.2a, -result {} would also be sensible. test entry-9.1 "Index range invariants" -setup { # See bug#1721532 for discussion proc entry-9.1-trace {n1 n2 op} { set ::V NO! } variable V trace add variable V write entry-9.1-trace ttk::entry .e -textvariable V } -body { set result [list] .e insert insert a ; lappend result [.e index insert] [.e index end] .e insert insert b ; lappend result [.e index insert] [.e index end] .e insert insert c ; lappend result [.e index insert] [.e index end] .e insert insert d ; lappend result [.e index insert] [.e index end] .e insert insert e ; lappend result [.e index insert] [.e index end] set result } -result [list 1 3 2 3 3 3 3 3 3 3] -cleanup { unset V destroy .e } tcltest::cleanupTests tile-0.8.2/tests/entrytest.tcl0000644000076500007650000000364310226105615015757 0ustar joejoe00000000000000# # Side-by-side comparison of Tile vs. standard entry widgets. # lappend auto_path . ; package require tile source [file join [file dirname [info script]] testutils.tcl] style theme use alt . configure -padx 10 -pady 10 grid [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \ -pady 2 -sticky news grid [ttk::entry .te -textvariable ::A -xscrollcommand [list .tsb set]] \ -pady 2 -sticky news grid [entry .e -textvariable ::A -xscrollcommand [list .sb set]] \ -pady 2 -sticky news grid [ttk::scrollbar .sb -orient horizontal -command [list .e xview]] \ -pady 2 -sticky news grid rowconfigure . 1 -weight 1 grid rowconfigure . 2 -weight 1 grid columnconfigure . 0 -weight 1 .te insert end "abcde fghij klmn opqr stuv wxyz" # # Test various options. # proc configboth {args} { eval .e configure $args eval .te configure $args } bind all { configboth -state disabled } ;# "&disable" bind all { configboth -state normal } ;# "&enable" bind all { configboth -state readonly } ;# "&write-protect" bind all { configboth -justify left } bind all { configboth -justify right } bind all { configboth -justify center } bind all { destroy . } # # Validation test. # # "If you can't see the fnords, they can't eat you." # proc nofnords {w p} { if {[set i [string first fnord $p]] >= 0} { return 0 } if {[set i [string first FNORD $p]] >= 0} { $w delete 0 end; $w insert end [string replace $p $i [expr {$i+4}]] $w icursor $i } return 1 } configboth -validatecommand {nofnords %W %P} -validate all # Use gaudy colors to highlight selection: # proc gaudyColors {} { .te configure \ -insertcolor red -selectbackground blue -selectforeground green .e configure \ -insertbackground red -selectbackground blue -selectforeground green \ -background white } bind all { gaudyColors } #*EOF* tile-0.8.2/tests/image.test0000644000076500007650000000507310722325572015203 0ustar joejoe00000000000000# # image.test,v 1.9 2007/11/25 17:06:02 jenglish Exp # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile # catch background errors: # if {[info procs bgerror] == "bgerror"} { rename bgerror {} } array set BGerror { caught 0 message {} } proc bgerror {message} { variable BGerror set BGerror(caught) 1 set BGerror(message) $message } proc caughtbgerror {} { variable BGerror if {!$BGerror(caught)} { error "No bgerror caught" } set BGerror(caught) 0 return $BGerror(message) } test image-1.1 "Bad image element" -body { ttk::style element create BadImage image badimage #- ttk::style layout BadImage { BadImage } #- ttk::label .l -style BadImage #- pack .l ; update #- destroy .l #- caughtbgerror } -returnCodes error -result {image "badimage" doesn't exist} test image-1.2 "Duplicate element" -setup { image create photo test.element -width 10 -height 10 ttk::style element create testElement image test.element } -body { ttk::style element create testElement image test.element } -returnCodes 1 -result "Duplicate element testElement" test image-1.3 "Bad image element later in list" -body { ttk::style element create BadImage image {test.element {} badimage} } -returnCodes error -result {image "badimage" doesn't exist} test image-1.4 "Bad image option" -body { ttk::button .b -image [list test.element {} badimage] } -returnCodes error -result {image "badimage" doesn't exist} test image-2.0 "Deletion of displayed image (label)" -constraints { KNOWNBUG } -setup { image create photo test.image -width 10 -height 10 } -body { pack [set w [ttk::label .ttk_image20 -image test.image]] tkwait visibility $w image delete test.image update } -cleanup { destroy .ttk_image20 } -result {} test image-2.1 "Deletion of displayed image (checkbutton)" -constraints { KNOWNBUG } -setup { image create photo test.image -width 10 -height 10 } -body { pack [set w [ttk::checkbutton .ttk_image21 -image test.image]] tkwait visibility $w image delete test.image update } -cleanup { destroy .ttk_image21 } -result {} test image-2.2 "Deletion of displayed image (radiobutton)" -constraints { KNOWNBUG } -setup { image create photo test.image -width 10 -height 10 } -body { pack [set w [ttk::radiobutton .ttk_image22 -image test.image]] tkwait visibility $w image delete test.image update } -cleanup { destroy .ttk_image22 } -result {} # tcltest::cleanupTests tile-0.8.2/tests/labelframe.tcl0000644000076500007650000000230710720073201015776 0ustar joejoe00000000000000# # Interactive test for labelframes. # lappend auto_path . package require tile puts "Loaded tile: [package ifneeded tile [package provide tile]]" source [file join [file dirname [info script]] testutils.tcl] #style map . -background {{} blue} variable anchorStrings { nw n ne en e es se s sw ws w wn } variable labelanchor nw variable label "-labelanchor" set c [ttk::labelframe .actl -text "-labelanchor"] $c configure -text "" -labelwidget [ttk::label .lbl -textvariable label] .lbl configure -relief solid -borderwidth 1 foreach string $anchorStrings { pack [ttk::radiobutton $c.$string -text $string \ -variable labelanchor -value $string -command setAnchor] \ -side top -expand false -fill x ; } pack [ttk::entry $c.editlabel -textvariable label] \ -side top -expand false -anchor w bind $c.editlabel "$c configure -text \[%W get\]" proc setAnchor {} { variable labelanchor .actl configure -labelanchor $labelanchor } pack $c -side top -expand true -fill both -padx 10 -pady 10 setAnchor bind . [list destroy .] bind . { .actl configure -labelwidget {} -text $::label } bind . { .actl configure -labelwidget .lbl } tile-0.8.2/tests/labelframe.test0000644000076500007650000001013710345374151016206 0ustar joejoe00000000000000# # labelframe.test,v 1.6 2005/12/06 20:45:29 jenglish Exp # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile test labelframe-1.0 "Setup" -body { pack [ttk::labelframe .lf] -expand true -fill both } test labelframe-2.1 "Can't use indirect descendant as labelwidget" -body { ttk::frame .lf.t ttk::checkbutton .lf.t.cb .lf configure -labelwidget .lf.t.cb } -returnCodes 1 -result "can't *" -match glob \ -cleanup { destroy .lf.t } ; test labelframe-2.2 "Can't use toplevel as labelwidget" -body { toplevel .lf.t .lf configure -labelwidget .lf.t } -returnCodes 1 -result "can't *" -match glob \ -cleanup { destroy .lf.t } ; test labelframe-2.3 "Can't use non-windows as -labelwidget" -body { .lf configure -labelwidget BogusWindowName } -returnCodes 1 -result {bad window path name "BogusWindowName"} test labelframe-2.4 "Can't use nonexistent-windows as -labelwidget" -body { .lf configure -labelwidget .nosuchwindow } -returnCodes 1 -result {bad window path name ".nosuchwindow"} ### # See also series labelframe-4.x # test labelframe-3.1 "Add child slave" -body { checkbutton .lf.cb -text "abcde" .lf configure -labelwidget .lf.cb list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] } -result [list 1 labelframe] test labelframe-3.2 "Remove child slave" -body { .lf configure -labelwidget {} list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] } -result [list 0 {}] test labelframe-3.3 "Re-add child slave" -body { .lf configure -labelwidget .lf.cb list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] } -result [list 1 labelframe] test labelframe-3.4 "Re-manage child slave" -body { pack .lf.cb -side right list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] [.lf cget -labelwidget] } -result [list 1 pack {}] test labelframe-3.5 "Re-add child slave" -body { .lf configure -labelwidget .lf.cb list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] } -result [list 1 labelframe] test labelframe-3.6 "Destroy child slave" -body { destroy .lf.cb .lf cget -labelwidget } -result {} ### # Re-run series labelframe-3.x with nonchild slaves. # # @@@ ODDITY, 14 Nov 2005: # @@@ labelframe-4.1 fails if .cb is a [checkbutton], # @@@ but seems to succeed if it's some other widget class. # @@@ I suspect a race condition; unable to track it down ATM. # # @@@ FOLLOWUP: This *may* have been caused by a bug in ManagerIdleProc # @@@ (see manager.c r1.11). There's still probably a race condition in here. # test labelframe-4.1 "Add nonchild slave" -body { checkbutton .cb -text "abcde" .lf configure -labelwidget .cb update list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb] } -result [list 1 1 labelframe] test labelframe-4.2 "Remove nonchild slave" -body { .lf configure -labelwidget {} update; list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb] } -result [list 0 0 {}] test labelframe-4.3 "Re-add nonchild slave" -body { .lf configure -labelwidget .cb list [update; winfo viewable .cb] [winfo manager .cb] } -result [list 1 labelframe] test labelframe-4.4 "Re-manage nonchild slave" -body { pack .cb -side right list [update; winfo viewable .cb] \ [winfo manager .cb] \ [.lf cget -labelwidget] } -result [list 1 pack {}] test labelframe-4.5 "Re-add nonchild slave" -body { .lf configure -labelwidget .cb list [update; winfo viewable .cb] \ [winfo manager .cb] \ [.lf cget -labelwidget] } -result [list 1 labelframe .cb] test labelframe-4.6 "Destroy nonchild slave" -body { destroy .cb .lf cget -labelwidget } -result {} test labelframe-5.0 "Cleanup" -body { destroy .lf } # 1342876 -- labelframe should raise sibling -labelwidget above self. # test labelframe-6.1 "Stacking order" -body { toplevel .t pack [ttk::checkbutton .t.x1] pack [ttk::labelframe .t.lf -labelwidget [ttk::label .t.lb]] pack [ttk::checkbutton .t.x2] winfo children .t } -cleanup { destroy .t } -result [list .t.x1 .t.lf .t.lb .t.x2] tcltest::cleanupTests tile-0.8.2/tests/layout.test0000644000076500007650000000147110523517131015425 0ustar joejoe00000000000000# # layout.test,v 1.7 2006/11/06 02:30:49 jenglish Exp # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile test layout-1.1 "Size computations for mixed-orientation layouts" -body { ttk::style theme use default set block [image create photo -width 10 -height 10] ttk::style element create block image $block ttk::style layout Blocks { border -children { block } -side left border -children { block } -side top border -children { block } -side bottom } ttk::style configure Blocks -borderwidth 1 -relief raised ttk::button .b -style Blocks pack .b -expand true -fill both list [winfo reqwidth .b] [winfo reqheight .b] } -cleanup { destroy .b } -result [list 24 24] tcltest::cleanupTests tile-0.8.2/tests/misc.test0000644000076500007650000000172010502010023015021 0ustar joejoe00000000000000# # misc.test,v 1.1 2006/09/13 14:05:07 jenglish Exp # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile test misc-1.0 "#1551500 -parent option in ttk::dialog doesn't work" -body { ttk::dialog .dialog -parent . -type ok \ -message "Something to say" -title "Let's see" wm transient .dialog } -result . -cleanup { destroy .dialog } test misc-1.1 "ttk::dialog w/no -parent option" -body { toplevel .t ttk::dialog .t.dialog -type ok wm transient .t.dialog } -result .t -cleanup { destroy .t } test misc-1.2 "Explicitly specify -parent" -body { toplevel .t ttk::dialog .t.dialog -type ok -parent . wm transient .t.dialog } -result . -cleanup { destroy .t } test misc-1.3 "Nontransient dialog" -body { toplevel .t ttk::dialog .t.dialog -type ok -parent "" wm transient .t.dialog } -result "" -cleanup { destroy .t } tcltest::cleanupTests tile-0.8.2/tests/nbtest.tcl0000644000076500007650000000410610522517074015215 0ustar joejoe00000000000000# # Test case for #1368921 "ttk::notebook::enableTraversal" # # Test toplevel and mnemonic activation in the presence of # multiple notebooks, nested notebooks, and traversal-enabled # notebooks that have been destroyed. # package require tile bind TNotebook { destroy [%W select] } bind TNotebook { destroy %W } # Argh. Shift-KeyPress-Fn bindings don't work under XFree bind TNotebook { destroy %W } set pw [ttk::panedwindow .pw -orient vertical] foreach nb {.pw.nb1 .pw.nb2} { $pw add [ttk::notebook $nb] -weight 1 ttk::notebook::enableTraversal $nb foreach {k} {foo bar qux} { set label [string totitle $k] $nb add [ttk::button $nb.$k -text $label \ -command [list destroy $nb.$k]] \ -text $label -underline 0 } $nb add [ttk::notebook $nb.nested] -text Nested -underline 0 ttk::notebook::enableTraversal $nb.nested foreach {k} {asdf zxcv uiop} { set label [string totitle $k] $nb.nested add [ttk::button $nb.nested.$k -text $label \ -command [list destroy $nb.nested.$k]] \ -text $label -underline 0 } } # Command frame: # option add *TButton.default normal set cmd [ttk::frame .cmd] grid x \ [ttk::button $cmd.ok -text OK -command [list destroy .]] \ [ttk::button $cmd.cancel -text Cancel -command [list destroy .]] \ -padx 6 -pady 6 ; grid columnconfigure $cmd 0 -weight 1 keynav::defaultButton $cmd.ok bind . [list event generate $cmd.cancel <>] # Status bar # set status [ttk::frame .status -class Statusbar] foreach v {focus key element} { pack [ttk::label $status.$v -textvariable ::Status($v) -anchor w \ -width 20 -relief sunken -borderwidth 1] \ -side left -expand false -fill none } bind all {+set ::Status(focus) "Focus: %W" } bind all {+set ::Status(key) "Key: %K" } bind TNotebook { set ::Status(element) "[%W identify %x %y] [%W index @%x,%y]" } pack $status -side bottom -expand false -fill x pack $cmd -side bottom -expand false -fill x pack $pw -side top -expand true -fill both tile-0.8.2/tests/notebook.test0000644000076500007650000003375410722335157015750 0ustar joejoe00000000000000# # notebook.test,v 1.26 2007/11/25 18:09:51 jenglish Exp # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile test notebook-1.0 "Setup" -body { ttk::notebook .nb } -result .nb # # Error handling tests: # test notebook-1.1 "Cannot add ancestor" -body { .nb add . } -returnCodes error -result "*" -match glob proc inoperative {args} {} inoperative test notebook-1.2 "Cannot add siblings" -body { # This is legal now .nb add [frame .sibling] } -returnCodes error -result "*" -match glob test notebook-1.3 "Cannot add toplevel" -body { .nb add [toplevel .nb.t] } -cleanup { destroy .t.nb } -returnCodes 1 -match glob -result "can't add .nb.t*" test notebook-1.4 "Try to select bad tab" -body { .nb select @6000,6000 } -returnCodes 1 -match glob -result "* not found" # # Now add stuff: # test notebook-2.0 "Add children" -body { pack .nb -expand true -fill both .nb add [frame .nb.foo] -text "Foo" pack [label .nb.foo.l -text "Foo"] .nb add [frame .nb.bar -relief raised -borderwidth 2] -text "Bar" pack [label .nb.bar.l -text "Bar"] .nb tabs } -result [list .nb.foo .nb.bar] test notebook-2.1 "select pane" -body { .nb select .nb.foo update list [winfo viewable .nb.foo] [winfo viewable .nb.bar] [.nb index current] } -result [list 1 0 0] test notebook-2.2 "select another pane" -body { .nb select 1 update list [winfo viewable .nb.foo] [winfo viewable .nb.bar] [.nb index current] } -result [list 0 1 1] test notebook-2.3 "tab - get value" -body { .nb tab .nb.foo -text } -result "Foo" test notebook-2.4 "tab - set value" -body { .nb tab .nb.foo -text "Changed Foo" .nb tab .nb.foo -text } -result "Changed Foo" test notebook-2.5 "tab - get all options" -body { .nb tab .nb.foo } -result [list \ -padding 0 -sticky nsew \ -state normal -text "Changed Foo" -image "" -compound none -underline -1] test notebook-4.1 "Test .nb index end" -body { .nb index end } -result 2 test notebook-4.2 "'end' is not a selectable index" -body { .nb select end } -returnCodes error -result "*" -match glob test notebook-4.3 "Select index out of range" -body { .nb select 2 } -returnCodes error -result "*" -match glob test notebook-4.4 "-padding option" -body { .nb configure -padding "5 5 5 5" } test notebook-4.end "Cleanup test suite 1-4.*" -body { destroy .nb } test notebook-5.1 "Virtual events" -body { toplevel .t set ::events [list] bind .t <> { lappend events changed %W } pack [set nb [ttk::notebook .t.nb]] -expand true -fill both; update $nb add [frame $nb.f1] $nb add [frame $nb.f2] $nb add [frame $nb.f3] $nb select $nb.f1 update; set events } -result [list changed .t.nb] test notebook-5.2 "Virtual events, continued" -body { set events [list] $nb select $nb.f3 update ; set events } -result [list changed .t.nb] # OR: [list deselected .t.nb.f1 selected .t.nb.f3 changed .t.nb] test notebook-5.3 "Disabled tabs" -body { set events [list] $nb tab $nb.f2 -state disabled $nb select $nb.f2 update list $events [$nb index current] } -result [list [list] 2] test notebook-5.4 "Reenable tab" -body { set events [list] $nb tab $nb.f2 -state normal $nb select $nb.f2 update list $events [$nb index current] } -result [list [list changed .t.nb] 1] test notebook-5.end "Virtual events, cleanup" -body { destroy .t } test notebook-6.0 "Select hidden tab" -setup { set nb [ttk::notebook .nb] $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] $nb tab $nb.f1 -state hidden lappend result [$nb tab $nb.f1 -state] $nb select $nb.f1 lappend result [$nb tab $nb.f1 -state] } -result [list hidden normal] test notebook-6.1 "Hide selected tab" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f2 lappend result [$nb index current] [winfo ismapped $nb.f2] update idletasks; lappend result [winfo ismapped $nb.f3] } -result [list 1 1 2 0 1] # See 1370833 test notebook-6.2 "Forget selected tab" -setup { ttk::notebook .n pack .n label .n.l -text abc .n add .n.l } -body { update after 100 .n forget .n.l update ;# Yowch! } -cleanup { destroy .n } -result {} test notebook-6.3 "Hide first tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f1 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f1] $nb hide $nb.f1 lappend result [$nb index current] [winfo ismapped $nb.f1] } -result [list 0 1 1 0] test notebook-6.4 "Forget first tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f1 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f1] $nb forget $nb.f1 lappend result [$nb index current] [winfo ismapped $nb.f1] } -result [list 0 1 0 0] test notebook-6.5 "Hide last tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f3 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f3] $nb hide $nb.f3 lappend result [$nb index current] [winfo ismapped $nb.f3] } -result [list 2 1 1 0] test notebook-6.6 "Forget a middle tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb forget $nb.f2 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 0] test notebook-6.7 "Hide a middle tab when it's the current" -setup { pack [set nb [ttk::notebook .nb]]; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f2 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 2 0] test notebook-6.8 "Forget a non-current tab < current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb forget $nb.f1 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 0 1] test notebook-6.9 "Hide a non-current tab < current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f1 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 1] test notebook-6.10 "Forget a non-current tab > current" -setup { pack [set nb [ttk::notebook .nb]] ; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb forget $nb.f3 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 1] test notebook-6.11 "Hide a non-current tab > current" -setup { pack [set nb [ttk::notebook .nb]]; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [winfo ismapped $nb.f2] $nb hide $nb.f3 lappend result [$nb index current] [winfo ismapped $nb.f2] } -result [list 1 1 1 1] test notebook-6.12 "Hide and re-add a tab" -setup { pack [set nb [ttk::notebook .nb]]; update $nb add [ttk::frame $nb.f1] $nb add [ttk::frame $nb.f2] $nb add [ttk::frame $nb.f3] $nb select $nb.f2 } -cleanup { destroy $nb } -body { set result [list] lappend result [$nb index current] [$nb tab $nb.f2 -state] $nb hide $nb.f2 lappend result [$nb index current] [$nb tab $nb.f2 -state] $nb add $nb.f2 lappend result [$nb index current] [$nb tab $nb.f2 -state] } -result [list 1 normal 2 hidden 2 normal] # # Insert: # unset nb test notebook-7.0 "insert - setup" -body { pack [ttk::notebook .nb] for {set i 0} {$i < 5} {incr i} { .nb add [ttk::frame .nb.f$i] -text "$i" } .nb select .nb.f1 list [.nb index current] [.nb tabs] } -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]] test notebook-7.1 "insert - move backwards" -body { .nb insert 1 3 list [.nb index current] [.nb tabs] } -result [list 2 [list .nb.f0 .nb.f3 .nb.f1 .nb.f2 .nb.f4]] test notebook-7.2 "insert - move backwards again" -body { .nb insert 1 3 list [.nb index current] [.nb tabs] } -result [list 3 [list .nb.f0 .nb.f2 .nb.f3 .nb.f1 .nb.f4]] test notebook-7.3 "insert - move backwards again" -body { .nb insert 1 3 list [.nb index current] [.nb tabs] } -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]] test notebook-7.4 "insert - move forwards" -body { .nb insert 3 1 list [.nb index current] [.nb tabs] } -result [list 3 [list .nb.f0 .nb.f2 .nb.f3 .nb.f1 .nb.f4]] test notebook-7.5 "insert - move forwards again" -body { .nb insert 3 1 list [.nb index current] [.nb tabs] } -result [list 2 [list .nb.f0 .nb.f3 .nb.f1 .nb.f2 .nb.f4]] test notebook-7.6 "insert - move forwards again" -body { .nb insert 3 1 list [.nb index current] [.nb tabs] } -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]] test notebook-7.7a "insert - current tab undisturbed" -body { .nb select 0 .nb insert 3 1 .nb index current } -result 0 test notebook-7.7b "insert - current tab undisturbed" -body { .nb select 0 .nb insert 1 3 .nb index current } -result 0 test notebook-7.7c "insert - current tab undisturbed" -body { .nb select 4 .nb insert 3 1 .nb index current } -result 4 test notebook-7.7d "insert - current tab undisturbed" -body { .nb select 4 .nb insert 1 3 .nb index current } -result 4 test notebook-7.8a "move tabs - current tab undisturbed - exhaustive" -body { .nb select .nb.f0 foreach i {0 1 2 3 4} { .nb insert $i .nb.f$i } foreach i {0 1 2 3 4} { .nb select .nb.f$i foreach j {0 1 2 3 4} { foreach k {0 1 2 3 4} { .nb insert $j $k set current [lindex [.nb tabs] [.nb index current]] if {$current != ".nb.f$i"} { error "($i,$j,$k) current = $current" } .nb insert $k $j if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} { error "swap $j $k; swap $k $j => [.nb tabs]" } } } } .nb tabs } -result [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4] test notebook-7.8b "insert new - current tab undisturbed - exhaustive" -body { foreach i {0 1 2 3 4} { .nb select .nb.f$i foreach j {0 1 2 3 4} { .nb select .nb.f$i .nb insert $j [frame .nb.newf] set current [lindex [.nb tabs] [.nb index current]] if {$current != ".nb.f$i"} { puts stderr "new tab at $j, current = $current, expect .nb.f$i" } destroy .nb.newf if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} { error "tabs disturbed" } } } } test notebook-7.end "insert - cleanup" -body { destroy .nb } test notebook-1817596-1 "insert should autoselect first tab" -body { pack [ttk::notebook .nb] list \ [.nb insert end [ttk::label .nb.l1 -text One] -text One] \ [.nb select] \ ; } -result [list "" .nb.l1] -cleanup { destroy .nb } test notebook-1817596-2 "error in insert should have no effect" -body { pack [ttk::notebook .nb] .nb insert end [ttk::label .nb.l1] .nb insert end [ttk::label .nb.l2] list \ [catch { .nb insert .l2 0 -badoption badvalue } err] \ [.nb tabs] \ } -result [list 1 [list .nb.l1 .nb.l2]] -cleanup { destroy .nb } test notebook-1817596-3 "insert/configure" -body { pack [ttk::notebook .nb] .nb insert end [ttk::label .nb.l0] -text "L0" .nb insert end [ttk::label .nb.l1] -text "L1" .nb insert end [ttk::label .nb.l2] -text "XX" .nb insert 0 2 -text "L2" list [.nb tabs] [.nb tab 0 -text] [.nb tab 1 -text] [.nb tab 2 -text] } -result [list [list .nb.l2 .nb.l0 .nb.l1] L2 L0 L1] -cleanup { destroy .nb } # See #1343984 test notebook-1343984-1 "don't autoselect on destroy - setup" -body { ttk::notebook .nb set ::history [list] bind TestFrame { lappend history MAP %W } bind TestFrame { lappend history DESTROY %W } .nb add [ttk::frame .nb.frame1 -class TestFrame] -text "Frame 1" .nb add [ttk::frame .nb.frame2 -class TestFrame] -text "Frame 2" .nb add [ttk::frame .nb.frame3 -class TestFrame] -text "Frame 3" pack .nb -fill both -expand 1 update set ::history } -result [list MAP .nb.frame1] test notebook-1343984-2 "don't autoselect on destroy" -body { set ::history [list] destroy .nb update set ::history } -result [list DESTROY .nb.frame1 DESTROY .nb.frame2 DESTROY .nb.frame3] tcltest::cleanupTests tile-0.8.2/tests/paned.test0000644000076500007650000001632010722327026015201 0ustar joejoe00000000000000# # paned.test,v 1.6 2007/11/25 17:17:10 jenglish Exp # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile proc propagate-geometry {} { update idletasks } # Basic sanity checks: # test paned-1.0 "Setup" -body { ttk::panedwindow .pw } -result .pw test paned-1.1 "Make sure empty panedwindow doesn't crash" -body { pack .pw -expand true -fill both update } test paned-1.2 "Add a pane" -body { .pw add [ttk::frame .pw.f1] winfo manager .pw.f1 } -result "panedwindow" test paned-1.3 "Steal pane" -body { pack .pw.f1 -side bottom winfo manager .pw.f1 } -result "pack" test paned-1.4 "Make sure empty panedwindow still doesn't crash" -body { update } test paned-1.5 "Remanage pane" -body { #XXX .pw insert 0 .pw.f1 .pw add .pw.f1 winfo manager .pw.f1 } -result "panedwindow" test paned-1.6 "Forget pane" -body { .pw forget .pw.f1 winfo manager .pw.f1 } -result "" test paned-1.7 "Make sure empty panedwindow still still doesn't crash" -body { update } test paned-1.8 "Re-forget pane" -body { .pw forget .pw.f1 } -returnCodes 1 -result ".pw.f1 is not managed by .pw" test paned-1.end "Cleanup" -body { destroy .pw } # Resize behavior: # test paned-2.1 "..." -body { ttk::panedwindow .pw -orient horizontal .pw add [listbox .pw.l1] .pw add [listbox .pw.l2] .pw add [listbox .pw.l3] .pw add [listbox .pw.l4] pack .pw -expand true -fill both update set w1 [winfo width .] # This should make the window shrink: destroy .pw.l2 update set w2 [winfo width .] expr {$w2 < $w1} } -result 1 test paned-2.2 "..., cont'd" -body { # This should keep the window from shrinking: wm geometry . [wm geometry .] set rw2 [winfo reqwidth .pw] destroy .pw.l1 update set w3 [winfo width .] set rw3 [winfo reqwidth .pw] expr {$w3 == $w2 && $rw3 < $rw2} # problem: [winfo reqwidth] shrinks, but sashes haven't moved # since we haven't gotten a ConfigureNotify. # How to (a) check for this, and (b) fix it? } -result 1 test paned-2.3 "..., cont'd" -body { .pw add [listbox .pw.l5] update set rw4 [winfo reqwidth .pw] expr {$rw4 > $rw3} } -result 1 test paned-2.end "Cleanup" -body { destroy .pw } # # ... # test paned-3.0 "configure pane" -body { ttk::panedwindow .pw .pw add [listbox .pw.lb1] .pw add [listbox .pw.lb2] .pw pane 1 -weight 2 .pw pane 1 -weight } -result 2 test paned-3.1 "configure pane -- errors" -body { .pw pane 1 -weight -4 } -returnCodes 1 -match glob -result "-weight must be nonnegative" test paned-3.2 "add pane -- errors" -body { .pw add [ttk::label .pw.l] -weight -1 } -returnCodes 1 -match glob -result "-weight must be nonnegative" test paned-3.end "cleanup" -body { destroy .pw } test paned-4.1 "forget" -body { pack [ttk::panedwindow .pw -orient vertical] -expand true -fill both .pw add [label .pw.l1 -text "L1"] .pw add [label .pw.l2 -text "L2"] .pw add [label .pw.l3 -text "L3"] .pw add [label .pw.l4 -text "L4"] update .pw forget .pw.l1 .pw forget .pw.l2 .pw forget .pw.l3 .pw forget .pw.l4 update } test paned-4.2 "forget forgotten" -body { .pw forget .pw.l1 } -returnCodes 1 -result ".pw.l1 is not managed by .pw" # checkorder $winlist -- # Ensure that Y coordinates windows in $winlist are strictly increasing. # proc checkorder {winlist} { set pos -1 set positions [list] foreach win $winlist { lappend positions [set nextpos [winfo y $win]] if {$nextpos <= $pos} { error "window $win out of order ($positions)" } set pos $nextpos } } test paned-4.3 "insert command" -body { .pw insert end .pw.l1 .pw insert end .pw.l3 .pw insert 1 .pw.l2 .pw insert end .pw.l4 update; checkorder {.pw.l1 .pw.l2 .pw.l3 .pw.l4} } test paned-4.END "cleanup" -body { destroy .pw } # See #1292219 test paned-5.1 "Propagate Map/Unmap state to children" -body { set result [list] pack [ttk::panedwindow .pw] .pw add [ttk::button .pw.b] update lappend result [winfo ismapped .pw] [winfo ismapped .pw.b] pack forget .pw update lappend result [winfo ismapped .pw] [winfo ismapped .pw.b] set result } -result [list 1 1 0 0] -cleanup { destroy .pw } ### sashpos tests. # proc sashpositions {pw} { set positions [list] set npanes [llength [winfo children $pw]] for {set i 0} {$i < $npanes - 1} {incr i} { lappend positions [$pw sashpos $i] } return $positions } test paned-sashpos-setup "Setup for sash position test" -body { ttk::style theme use default ttk::style configure -sashthickness 5 ttk::panedwindow .pw .pw add [frame .pw.f1 -width 20 -height 20] .pw add [frame .pw.f2 -width 20 -height 20] .pw add [frame .pw.f3 -width 20 -height 20] .pw add [frame .pw.f4 -width 20 -height 20] propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] } -result [list 20 [expr {20*4 + 5*3}]] test paned-sashpos-attempt-restore "Attempt to set sash positions" -body { # This is not expected to succeed, since .pw isn't large enough yet. # .pw sashpos 0 30 .pw sashpos 1 60 .pw sashpos 2 90 list [winfo reqwidth .pw] [winfo reqheight .pw] [sashpositions .pw] } -result [list 20 95 [list 0 5 10]] test paned-sashpos-restore "Set height then sash positions" -body { # Setting sash positions after setting -height _should_ succeed. # .pw configure -height 120 .pw sashpos 0 30 .pw sashpos 1 60 .pw sashpos 2 90 list [winfo reqwidth .pw] [winfo reqheight .pw] [sashpositions .pw] } -result [list 20 120 [list 30 60 90]] test paned-sashpos-cleanup "Clean up" -body { destroy .pw } test paned-propagation-setup "Setup." -body { ttk::style theme use default ttk::style configure -sashthickness 5 wm geometry . {} ttk::panedwindow .pw -orient vertical frame .pw.f1 -width 100 -height 50 frame .pw.f2 -width 100 -height 50 list [winfo reqwidth .pw.f1] [winfo reqheight .pw.f1] } -result [list 100 50] test paned-propagation-1 "Initial request size" -body { .pw add .pw.f1 .pw add .pw.f2 propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] } -result [list 100 105] test paned-propagation-2 "Slave change before map" -body { .pw.f1 configure -width 200 -height 100 propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] } -result [list 200 155] test paned-propagation-3 "Map window" -body { pack .pw -expand true -fill both update list [winfo width .pw] [winfo height .pw] [.pw sashpos 0] } -result [list 200 155 100] test paned-propagation-4 "Slave change after map, off-axis" -body { .pw.f1 configure -width 100 ;# should be granted propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0] } -result [list 100 155 100] test paned-propagation-5 "Slave change after map, on-axis" -body { .pw.f1 configure -height 50 ;# should be denied propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0] } -result [list 100 155 100] test paned-propagation-cleanup "Clean up." -body { destroy .pw } tcltest::cleanupTests tile-0.8.2/tests/progress.test0000644000076500007650000000403310311171534015747 0ustar joejoe00000000000000# # progress.test,v 1.4 2005/09/12 03:17:48 jenglish Exp # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile test progress-1.1 "Setup" -body { ttk::progressbar .pb } -result .pb test progress-1.2 "Linked variable" -body { set PB 50 .pb configure -variable PB .pb cget -value } -result 50 test progress-1.3 "Change linked variable" -body { set PB 80 .pb cget -value } -result 80 test progress-1.4 "Set linked variable to bad value" -body { set PB "bogus" .pb instate invalid } -result 1 test progress-1.4.1 "Set linked variable back to a good value" -body { set PB 80 .pb instate invalid } -result 0 test progress-1.5 "Set -variable to illegal variable" -body { set BAD "bogus" .pb configure -variable BAD .pb instate invalid } -result 1 test progress-1.6 "Unset -variable" -body { unset -nocomplain UNSET .pb configure -variable UNSET .pb instate disabled } -result 1 test progress-2.0 "step command" -body { .pb configure -variable {} ;# @@@ .pb configure -value 5 -maximum 10 -mode determinate .pb step .pb cget -value } -result 6.0 test progress-2.1 "step command, with stepamount" -body { .pb step 3 .pb cget -value } -result 9.0 test progress-2.2 "step wraps at -maximum in determinate mode" -body { .pb step .pb cget -value } -result 0.0 test progress-2.3 "step doesn't wrap in indeterminate mode" -body { .pb configure -value 8 -maximum 10 -mode indeterminate .pb step .pb step .pb step .pb cget -value } -result 11.0 test progress-2.4 "step with linked variable" -body { .pb configure -variable PB ;# @@@ set PB 5 .pb step set PB } -result 6.0 test progress-2.5 "error in write trace" -body { trace variable PB w { error "YIPES!" ;# } .pb step set PB ;# NOTREACHED } -cleanup { unset PB } -returnCodes 1 -match glob -result "*YIPES!" test progress-end "Cleanup" -body { destroy .pb } tcltest::cleanupTests tile-0.8.2/tests/pwtest.tcl0000644000076500007650000000531310632667451015254 0ustar joejoe00000000000000# [20 Mar 2005] - interactive test for Tile panedwindow widget package require tile option add *Text.height 10 option add *Listbox.height 5 option add *Listbox.width 20 option add *Panedwindow.opaqueResize 1 option add *Panedwindow.OpaqueResize 1 bind PWTestListbox {focus %W} bind PWTestListbox { %W configure -height 10 } bind PWTestListbox { %W configure -height 5 } bind PWTestListbox { %W configure -width 20 } bind PWTestListbox { %W configure -width 40 } proc pwtest.listbox {w args} { eval [linsert $args 0 listbox $w] bindtags $w [list $w PWTestListbox [winfo class $w] [winfo toplevel $w] all] return $w } ttk::panedwindow .pw -orient vertical #panedwindow .pw -opaqueresize true -orient vertical #frame .pw #proc .pw-add {win} { pack $win -side top -expand false -fill x } .pw add [ttk::frame .pw.f1] -weight 1;#$ -stretch always .pw add [ttk::frame .pw.f2] -weight 1;#$ -stretch always .pw add [set w3 [pwtest.listbox .pw.f3]] -weight 1;#$ -stretch always .pw add [ttk::frame .pw.f4] -weight 1;#$ -stretch always pack [set w1 [pwtest.listbox .pw.f1.l]] -expand true -fill both pack [set w2 [pwtest.listbox .pw.f2.l]] -expand true -fill both #X pack [set w3 [pwtest.listbox .pw.f3.l]] -expand true -fill both pack [set w4 [pwtest.listbox .pw.f4.l]] -expand true -fill both pack [label .l -textvariable ::element] -side bottom -expand false -fill x pack .pw -expand true -fill both -side top bind .pw { set ::element "[%W identify %x %y] - %x,%y" } bind . [list destroy .] #- bind . [list .pw configure -orient horizontal] #- bind . [list .pw configure -orient vertical] bind PWTestListbox [list pwtest.forget .pw %W] bind PWTestListbox [list pwtest.remember .pw] proc pwtest.forget {pw slave} { global $pw $pw forget $slave lappend $pw $slave } proc pwtest.remember {pw} { global $pw foreach slave [set $pw] { $pw add $slave } set $pw [list] } foreach w [list $w1 $w2 $w3] { foreach string {abc def ghi jkl mno pqr stu vwx yz} { $w insert end $string } } proc pwtest.save-config {pw} { update idletasks; lappend config [winfo width $pw] [winfo height $pw] set i -1; foreach _ [lrange [$pw panes] 1 end] { lappend config [$pw sashpos [incr i]] } return $config } proc pwtest.restore-config {pw config} { $pw configure -width [lindex $config 0] -height [lindex $config 1] set i -1 foreach sashpos [lrange $config 2 end] { $pw sashpos [incr i] $sashpos } } bind all { set ::A [pwtest.save-config .pw] } bind all { pwtest.restore-config .pw $::A } tile-0.8.2/tests/sbtest.tcl0000644000076500007650000000365707776136317015252 0ustar joejoe00000000000000# # side-by-side interactive test of Tk vs. Tile scrollbars. # lappend auto_path . package require Tk package require tile proc sbstub {sb cmd number {units units}} { # puts [info level 0] sbstub.$cmd $sb $number $units } proc sbstub.moveto {sb number _} { $sb set $number [expr {$number + 0.5}] # puts "[$sb get]" } proc sbstub.scroll {sb number units} { if {$units eq "pages"} { set delta 0.2 } else { set delta 0.05 } set current [$sb get] set new0 [expr {[lindex $current 0] + $delta*$number}] set new1 [expr {[lindex $current 1] + $delta*$number}] $sb set $new0 $new1 ; # puts "$current - $new0 $new1 - [$sb get]" } wm geometry . 400x200 pack [scrollbar .hsb -orient horizontal -command [list sbstub .hsb]] \ -side top -expand false -fill x pack [tscrollbar .thsb -orient horizontal -command [list sbstub .thsb]] \ -side top -expand false -fill x pack [scrollbar .vsb -orient vertical -command [list sbstub .vsb]] \ -side left -expand false -fill y pack [tscrollbar .tvsb -orient vertical -command [list sbstub .tvsb]] \ -side left -expand false -fill y pack [set c [frame .client]] -expand true -fill both grid \ [label $c.li -text "Element:" -anchor w] \ [entry $c.i -textvariable ::identified] \ -sticky ew grid \ [label $c.lf -text "Fraction:" -anchor w] \ [entry $c.f -textvariable ::fraction] \ -sticky ew grid \ [label $c.lr -text "Range:" -anchor w] \ [entry $c.r -textvariable ::range] \ -sticky ew grid columnconfigure $c 1 -weight 1 bind Test { sbdebug %W %x %y } bind Test { sbdebug %W %x %y } bind Test { sbdebug %W %x %y } proc sbdebug {W x y} { set ::identified [$W identify $x $y] set ::fraction [$W fraction $x $y] set ::range [$W get] } foreach w {.vsb .hsb .tvsb .thsb} { bindtags $w [linsert [bindtags $w] 0 Test] } .vsb set 0 0.5 .hsb set 0 0.5 .tvsb set 0 0.5 .thsb set 0 0.5 tile-0.8.2/tests/scrollbar.test0000644000076500007650000000371710720070717016103 0ustar joejoe00000000000000# # scrollbar.test,v 1.9 2007/11/18 17:09:35 jenglish Exp # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}] test scrollbar-swapout-1 "Use core scrollbars on OSX..." -constraints { coreScrollbar } -body { ttk::scrollbar .sb -command "yadda" list [winfo class .sb] [.sb cget -command] } -result [list Scrollbar yadda] -cleanup { destroy .sb } test scrollbar-swapout-2 "... unless -style is specified ..." -constraints { coreScrollbar } -body { ttk::style layout Vertical.Custom.TScrollbar \ [ttk::style layout Vertical.TScrollbar] ; # See #1833339 ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar list [winfo class .sb] [.sb cget -command] [.sb cget -style] } -result [list TScrollbar yadda Custom.TScrollbar] -cleanup { destroy .sb } test scrollbar-swapout-3 "... or -class." -constraints { coreScrollbar } -body { ttk::scrollbar .sb -command "yadda" -class Custom.TScrollbar list [winfo class .sb] [.sb cget -command] } -result [list Custom.TScrollbar yadda] -cleanup { destroy .sb } test scrollbar-1.0 "Setup" -body { ttk::scrollbar .tsb } -result .tsb test scrollbar-1.1 "Set method" -body { .tsb set 0.2 0.4 .tsb get } -result [list 0.2 0.4] test scrollbar-1.2 "Set orientation" -body { .tsb configure -orient vertical set w [winfo reqwidth .tsb] ; set h [winfo reqheight .tsb] expr {$h > $w} } -result 1 test scrollbar-1.3 "Change orientation" -body { .tsb configure -orient horizontal set w [winfo reqwidth .tsb] ; set h [winfo reqheight .tsb] expr {$h < $w} } -result 1 # # Scale tests: # test scale-1.0 "Self-destruction" -body { trace variable v w { destroy .s ;# } ttk::scale .s -variable v pack .s ; update .s set 1 ; update } -returnCodes 1 -match glob -result "*" tcltest::cleanupTests tile-0.8.2/tests/sgtest.tcl0000644000076500007650000000305510465223506015231 0ustar joejoe00000000000000# # sgtest.tcl,v 1.1 2006/08/05 23:18:30 jenglish Exp # # Interactive test driver for sizegrip widget. # package require Tk package require tile source [file join [file dirname [info script]] testutils.tcl] variable setgrid 0 proc setsetgrid {w} { $w configure -setgrid $::setgrid } variable wmgeometry bind . { set ::wmgeometry [wm geometry .] } set tb [ttk::frame .toolbar] pack \ [ttk::checkbutton $tb.cb -text "Setgrid?" \ -command [list setsetgrid .tt] -variable setgrid] \ [ttk::button $tb.tl -text "+50+50" \ -command [list wm geometry . +50+50]] \ [ttk::button $tb.br -text "-50-50" \ -command [list wm geometry . -50-50]] \ [ttk::button $tb.cg -text "Reset geometry" \ -command [list wm geometry . {}]] \ -side left -anchor w -padx 3 -pady 3 pack \ [ttk::label $tb.geometry -width 20 -textvariable wmgeometry] \ -side right ttk::sizegrip .grip ttk::scrollbar .vsb -orient vertical -command [list .tt yview] ttk::scrollbar .hsb -orient horizontal -command [list .tt xview] text .tt -setgrid $setgrid -wrap none \ -xscrollcommand [list .hsb set] -yscrollcommand [list .vsb set] \ -highlightthickness 0 .tt insert end [read [set fp [open [info script]]]] ; close $fp grid .toolbar -row 0 -columnspan 2 -sticky nsew grid .tt -row 1 -column 0 -sticky nsew grid .vsb -row 1 -column 1 -sticky nse grid .hsb -row 2 -column 0 -sticky sew grid .grip -row 2 -column 1 -sticky senw ;# -sticky se grid columnconfigure . 0 -weight 1 grid rowconfigure . 1 -weight 1 bind all [list destroy .] #*EOF* tile-0.8.2/tests/testutils.tcl0000644000076500007650000000102310531645444015754 0ustar joejoe00000000000000# # testutils.tcl,v 1.2 2006/11/24 19:42:28 jenglish Exp # # Miscellaneous utilities for interactive tests. # # Global binding: cycles the current theme. # variable currentTheme alt proc CycleTheme {} { variable currentTheme set themes [tile::availableThemes] set i [expr {([lsearch $themes $currentTheme] + 1) % [llength $themes]}] tile::setTheme [set currentTheme [lindex $themes $i]] puts "Theme: $currentTheme" } bind all { CycleTheme } lappend auto_path /usr/local/lib tile-0.8.2/tests/tile.test0000644000076500007650000004366510722325572015067 0ustar joejoe00000000000000 package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile proc skip args {} proc ok {} { return } variable widgetClasses { button checkbutton radiobutton menubutton label entry frame labelframe scrollbar notebook progressbar combobox separator panedwindow treeview sizegrip scale } proc bgerror {error} { variable bgerror $error variable bgerrorInfo $::errorInfo variable bgerrorCode $::errorCode } # Self-destruct tests. # Do these early, so any memory corruption has a longer time to cause a crash. # proc selfdestruct {w args} { destroy $w } test ttk-6.1 "Self-destructing checkbutton" -body { pack [ttk::checkbutton .sd -text "Self-destruction" -variable ::sd] trace variable sd w [list selfdestruct .sd] update .sd invoke } -returnCodes 1 test ttk-6.2 "Checkbutton self-destructed" -body { winfo exists .sd } -result 0 test ttk-6.3 "Test package cleanup" -body { interp create foo foo eval { if {[catch {package require Tk}]} { load {} Tk } } foo eval [package ifneeded tile [package provide tile]] foo eval { destroy . } interp delete foo } test ttk-6.4 "Defeat evil intentions" -body { trace variable OUCH r { kill.b } proc kill.b {args} { destroy .b } pack [ttk::checkbutton .b] .b configure -variable OUCH # At this point, .b should be gone. .b invoke list [set OUCH] [winfo exists .b] # Mostly we just care that we haven't crashed the interpreter. # } -returnCodes error -match glob -result "*" test ttk-6.5 "Clean up -textvariable traces" -body { foreach class {ttk::button ttk::checkbutton ttk::radiobutton} { $class .b1 -textvariable V set V "asdf" destroy .b1 set V "" } } test ttk-6.6 "Bad color spec in styles" -body { pack [ttk::button .b1 -text Hi!] ttk::style configure TButton -foreground badColor event generate .b1 update ttk::style configure TButton -foreground black destroy .b1 set ::bgerror } -result {unknown color name "badColor"} test ttk-6.7 "Basic destruction test" -body { foreach widget $widgetClasses { ttk::$widget .w pack .w destroy .w } } test ttk-6.8 "Button command removes itself" -body { ttk::button .b -command ".b configure -command {}; set ::A {it worked}" .b invoke destroy .b set ::A } -result {it worked} test ttk-6.9 "Bad font spec in styles" -setup { ttk::style theme create badfont -settings { ttk::style configure . -font {Helvetica 12 Bogus} } ttk::style theme use badfont } -cleanup { ttk::style theme use default } -body { pack [ttk::label .l -text Hi! -font {}] # SEE ALSO: #1583038 - "-font {}" makes test suite pass # but does not fix the underlying problem. event generate .l update destroy .l set ::bgerror } -result {unknown font style "Bogus"} # # Basic tests. # test ttk-1.1 "Create button" -body { pack [ttk::button .t] -expand true -fill both update } test ttk-1.2 "Check style" -body { .t cget -style } -result {} test ttk-1.4 "Restore default style" -body { .t cget -style } -result "" proc checkstate {w} { foreach statespec { {!active !disabled} {!active disabled} {active !disabled} {active disabled} active disabled } { lappend result [$w instate $statespec] } set result } # NB: this will fail if the top-level window pops up underneath the cursor test ttk-2.0 "Check state" -body { checkstate .t } -result [list 1 0 0 0 0 0] test ttk-2.1 "Change state" -body { .t state active } -result !active test ttk-2.2 "Check state again" -body { checkstate .t } -result [list 0 0 1 0 1 0] test ttk-2.3 "Change state again" -body { .t state {!active disabled} } -result {active !disabled} test ttk-2.4 "Check state again" -body { checkstate .t } -result [list 0 1 0 0 0 1] test ttk-2.5 "Change state again" -body { .t state !disabled } -result {disabled} test ttk-2.6 "instate scripts, false" -body { set x 0 .t instate disabled { set x 1 } set x } -result 0 test ttk-2.7 "instate scripts, true" -body { set x 0 .t instate !disabled { set x 1 } set x } -result 1 # misc. error detection test ttk-3.0 "Bad option" -body { ttk::button .bad -badoption foo } -returnCodes 1 -result {unknown option "-badoption"} -match glob test ttk-3.1 "Make sure widget command not created" -body { .bad state disabled } -returnCodes 1 -result {invalid command name ".bad"} -match glob test ttk-3.2 "Propagate errors from variable traces" -body { set A 0 trace add variable A write {error "failure" ;# } ttk::checkbutton .cb -variable A .cb invoke } -cleanup { unset ::A ; destroy .cb } -returnCodes error -result {can't set "A": failure} test ttk-3.3 "Constructor failure with cursor" -constraints KNOWNBUG -body { # This raises an X error. # See also: test 15.1 # Also: ttk::sizegrip .g -style BadStyle ttk::button .b -cursor bottom_right_corner -style BadStyle } -returnCodes 1 -result "Layout BadStyle not found" # Test resource allocation # (@@@ "-font" is a compatibility option now, so tests 4.1-4.3 # don't really test anything useful at the moment.) # test ttk-4.0 "Setup" -body { catch { destroy .t } pack [ttk::label .t -text "Button 1"] testConstraint fontOption [expr ![catch { set prevFont [.t cget -font] }]] ok } test ttk-4.1 "Change font" -constraints fontOption -body { .t configure -font "Helvetica 18 bold" } test ttk-4.2 "Check font" -constraints fontOption -body { .t cget -font } -result "Helvetica 18 bold" test ttk-4.3 "Restore font" -constraints fontOption -body { .t configure -font $prevFont } test ttk-4.4 "Bad resource specifications" -body { ttk::style theme settings alt { ttk::style configure TButton -font {Bad font} # @@@ it would be best to raise an error at this point, # @@@ but that's not really feasible in the current framework. } pack [ttk::button .tb1 -text "Ouch"] ttk::style theme use alt update; # As long as we haven't crashed, everything's OK ttk::style theme settings alt { ttk::style configure TButton -font TkDefaultFont } ttk::style theme use default destroy .tb1 } # # checkbutton tests # test ttk-5.1 "Checkbutton check" -body { pack [ttk::checkbutton .cb -text "TCheckbutton" -variable cb] } test ttk-5.2 "Checkbutton invoke" -body { .cb invoke list [set ::cb] [.cb instate selected] } -result [list 1 1] test ttk-5.3 "Checkbutton reinvoke" -body { .cb invoke list [set ::cb] [.cb instate selected] } -result [list 0 0] test ttk-5.4 "Checkbutton variable" -body { set result [] set ::cb 1 lappend result [.cb instate selected] set ::cb 0 lappend result [.cb instate selected] } -result {1 0} test ttk-5.5 "Unset checkbutton variable" -body { set result [] unset ::cb lappend result [.cb instate alternate] [info exists ::cb] set ::cb 1 lappend result [.cb instate alternate] [info exists ::cb] } -result {1 0 0 1} # See #1257319 test ttk-5.6 "Checkbutton default variable" -body { destroy .cb ; unset -nocomplain {} ; set result [list] ttk::checkbutton .cb -onvalue on -offvalue off lappend result [.cb cget -variable] [info exists .cb] [.cb state] .cb invoke lappend result [info exists .cb] [set .cb] [.cb state] .cb invoke lappend result [info exists .cb] [set .cb] [.cb state] } -result [list .cb 0 alternate 1 on selected 1 off {}] # # radiobutton tests # test ttk-7.1 "Radiobutton check" -body { pack \ [ttk::radiobutton .rb1 -text "One" -variable choice -value 1] \ [ttk::radiobutton .rb2 -text "Two" -variable choice -value 2] \ [ttk::radiobutton .rb3 -text "Three" -variable choice -value 3] \ ; } test ttk-7.2 "Radiobutton invoke" -body { .rb1 invoke set ::choice } -result 1 test ttk-7.3 "Radiobutton state" -body { .rb1 instate selected } -result 1 test ttk-7.4 "Other radiobutton invoke" -body { .rb2 invoke set ::choice } -result 2 test ttk-7.5 "Other radiobutton state" -body { .rb2 instate selected } -result 1 test ttk-7.6 "First radiobutton state" -body { .rb1 instate selected } -result 0 test ttk-7.7 "Unset radiobutton variable" -body { unset ::choice list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate] } -result {0 1 1} test ttk-7.8 "Reset radiobutton variable" -body { set ::choice 2 list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate] } -result {1 0 0} # # -compound tests: # variable iconData \ {R0lGODlhIAAgAKIAANnZ2YQAAP8AAISEhP///////////////yH5BAEAAAAALAAAAAAgACAA AAP/CLoMGLqKoMvtGIqiqxEYCLrcioGiyxwIusyBgaLLLRiBoMsQKLrcjYGgu4Giy+2CAkFX A0WX2wXFIOgGii7trkCEohsDCACBoktEKLpKhISiGwAIECiqSKooukiqKKoxgACBooukKiIo SKooujGDECi6iqQqsopEV2MQAkV3kXQZRXdjEAJFl5F0FUWXY3ACRZcFSRdFlyVwJlB0WZB0 UXRZAmcCRZeRdBVFl2NwAkV3kXQZRXdjcAJFV5FURVaR6GoMDgSKLpKqiKAgqaLoxgwOBIoq kiqKLpIqimrM4ECg6BIRiq4SIaHoxgyCBoou7a5AhKIbMzgAAIGiy+2CTWJmBhAAAkWX2wXF zCDoBooud2PMDIKuRqDocgtGzMwg6O4Eii5z4Kgi6DIMhqLoagQGjiqCLvPgYOgqji6CLrfi 6DIj6HI7jq4i6DIkADs=} variable compoundStrings {text image center top bottom left right none} if {0} { proc now {} { set ::now [clock clicks -milliseconds] } proc tick {} { puts -nonewline stderr "+" ; flush stderr } proc tock {} { set then $::now; set ::now [clock clicks -milliseconds] puts stderr " [expr {$::now - $then}] ms" } } else { proc now {} {} ; proc tick {} {} ; proc tock {} {} } now ; tick test ttk-8.0 "Setup for 8.X" -body { ttk::button .ctb image create photo icon -data $::iconData; pack .ctb } tock now test ttk-8.1 "Test -compound options" -body { # Exhaustively test each combination. # Main goal is to make sure no code paths crash. foreach image {icon ""} { foreach text {"Hi!" ""} { foreach compound $::compoundStrings { .ctb configure -image $image -text $text -compound $compound update; tick } } } } tock test ttk-8.2 "Test -compound options with regular button" -body { button .rtb pack .rtb foreach image {"" icon} { foreach text {"Hi!" ""} { foreach compound [lrange $::compoundStrings 2 end] { .rtb configure -image $image -text $text -compound $compound update; tick } } } } tock test ttk-8.3 "Rerun test 8.1" -body { foreach image {icon ""} { foreach text {"Hi!" ""} { foreach compound $::compoundStrings { .ctb configure -image $image -text $text -compound $compound update; tick } } } } tock test ttk-8.4 "ImageChanged" -body { ttk::button .b -image icon icon blank } -cleanup { destroy .b } #------------------------------------------------------------------------ test ttk-9.1 "Traces on nonexistant namespaces" -body { ttk::checkbutton .tcb -variable foo::bar } -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob test ttk-9.2 "Traces on nonexistant namespaces II" -body { ttk::checkbutton .tcb -variable X .tcb configure -variable foo::bar } -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob test ttk-9.3 "Restore saved options on configure error" -body { .tcb cget -variable } -result X test ttk-9.4 "Textvariable tests" -body { set tcbLabel "Testing..." .tcb configure -textvariable tcbLabel .tcb cget -text } -result "Testing..." # Changing -text has no effect if there is a linked -textvariable. # Compatible with core widget. test ttk-9.5 "Change -text" -body { .tcb configure -text "Changed -text" .tcb cget -text } -result "Testing..." # Unset -textvariable clears the text. # NOTE: this is different from core widgets, which automagically reinitalize # the -textvariable to the last value of -text. # test ttk-9.6 "Unset -textvariable" -body { unset tcbLabel list [info exists tcbLabel] [.tcb cget -text] } -result [list 0 ""] test ttk-9.7 "Unset textvariable, comparison" -body { # # NB: the tile label behaves differently from the standard label here; # NB: this is on purpose: I believe the standard behaviour is the Wrong Thing # unset -nocomplain V1 V2 label .l -text Foo ; ttk::label .tl -text Foo .l configure -textvariable V1 ; .tl configure -textvariable V2 list [set V1] [info exists V2] } -cleanup { destroy .l .tl } -result [list Foo 0] test ttk-9.8 "-textvariable overrides -text" -body { ttk::label .tl -textvariable TV set TV Foo .tl configure -text Bar .tl cget -text } -cleanup { destroy .tl } -result "Foo" # # Frame widget tests: # test ttk-10.1 "ttk::frame -class resource" -body { ttk::frame .f -class Foo } -result .f test ttk-10.2 "Check widget class" -body { winfo class .f } -result Foo test ttk-10.3 "Check class resource" -body { .f cget -class } -result Foo test ttk-10.4 "Try to modify class resource" -body { .f configure -class Bar } -returnCodes 1 -match glob -result "*read-only option*" test ttk-10.5 "Check class resource again" -body { .f cget -class } -result Foo test ttk-11.1 "-state test, setup" -body { ttk::button .b .b instate disabled } -result 0 test ttk-11.2 "-state test, disable" -body { .b configure -state disabled .b instate disabled } -result 1 test ttk-11.3 "-state test, reenable" -body { .b configure -state normal .b instate disabled } -result 0 test ttk-11.4 "-state test, unrecognized -state value" -body { .b configure -state bogus .b state } -result [list] test ttk-11.5 "-state test, 'active'" -body { .b configure -state active .b state } -result [list active] -cleanup { .b state !active } test ttk-11.6 "-state test, 'readonly'" -body { .b configure -state readonly .b state } -result [list readonly] -cleanup { .b state !readonly } test ttk-11.7 "-state test, cleanup" -body { destroy .b } test ttk-12.1 "-cursor option" -body { ttk::button .b .b cget -cursor } -result {} test ttk-12.2 "-cursor option" -body { .b configure -cursor arrow .b cget -cursor } -result arrow test ttk-12.3 "-borderwidth frame option" -body { destroy .t toplevel .t raise .t pack [set t [ttk::frame .t.f]] -expand true -fill x ; pack [ttk::label $t.l -text "ASDF QWERTY"] -expand true -fill both foreach theme {default alt} { ttk::style theme use $theme foreach relief {flat raised sunken ridge groove solid} { $t configure -relief $relief for {set i 5} {$i >= 0} {incr i -1} { $t configure -borderwidth $i update } } } } test ttk-12.4 "-borderwidth frame option" -body { .t.f configure -relief raised .t.f configure -borderwidth 1 ttk::style theme use alt update } test ttk-13.1 "Custom styles -- bad -style option" -body { ttk::button .tb1 -style badstyle } -returnCodes 1 -result "*badstyle not found*" -match glob test ttk-13.4 "Custom styles -- bad -style option" -body { ttk::button .tb1 .tb1 configure -style badstyle } -cleanup { destroy .tb1 } -returnCodes 1 -result "*badstyle not found*" -match glob test ttk-13.5 "Custom layouts -- missing element definition" -body { ttk::style layout badstyle { NoSuchElement } ttk::button .tb1 -style badstyle } -cleanup { destroy .tb1 } -result .tb1 # @@@ Should: signal an error, possibly a background error. # # See #793909 # test ttk-14.1 "-variable in nonexistant namespace" -body { ttk::checkbutton .tw -variable ::nsn::foo } -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \ -match glob -cleanup { destroy .tw } test ttk-14.2 "-textvariable in nonexistant namespace" -body { ttk::label .tw -textvariable ::nsn::foo } -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \ -match glob -cleanup { destroy .tw } test ttk-14.3 "-textvariable in nonexistant namespace" -body { ttk::entry .tw -textvariable ::nsn::foo } -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \ -match glob -cleanup { destroy .tw } test ttk-15.1 "style element create: insufficient args" -body { ttk::style element create } -returnCodes 1 -result "wrong # args: should be \"ttk::style element create name type ?options...?\"" test ttk-15.2 "style element create: insufficient args" -body { ttk::style element create plain.background } -returnCodes 1 -result "wrong # args: should be \"ttk::style element create name type ?options...?\"" test ttk-15.3 "style element create: insufficient args" -body { ttk::style element create plain.background from } -returnCodes 1 -result "wrong # args: should be \"theme ?element?\"" test ttk-15.4 "style element create: valid" -body { ttk::style element create plain.background from default } -returnCodes 0 -result "" # GetLayout tests: test ttk-getlayout-1 "GetLayout - setup" -body { set theme1 alt set theme2 clam ttk::style theme settings $theme2 { ttk::style layout BadLayout { background } } ttk::setTheme $theme1 return } foreach wc $widgetClasses { if {$wc eq "sizegrip"} { continue } ;# see test ttk-getlayout-2-$wc "GetLayout - bad layout, widget constructor" -body { ttk::$wc .g -style BadLayout } -returnCodes error -match regexp -result \ "Layout (Vertical.|Horizontal.)?BadLayout not found" # See #1603506 test ttk-getlayout-2a-$wc "GetLayout - update after failure" -body { update } test ttk-getlayout-3-$wc "GetLayout - bad layout, widget configure" -body { pack [ttk::$wc .g] .g configure -style BadLayout } -returnCodes error -match regexp -result \ "Layout (Vertical.|Horizontal.)?BadLayout not found" # See #1603506 test ttk-getlayout-3a-$wc "GetLayout - update after failure" -body { update } test ttk-getlayout-4-$wc "GetLayout - bad layout, put the rug down" -body { ttk::setTheme $theme2 .g configure -style BadLayout .g cget -style } -result BadLayout test ttk-getlayout-5-$wc "GetLayout - bad layout, yank the rug out" -body { ttk::setTheme $theme1 pack .g update .g cget -style } -result BadLayout test ttk-getlayout-6-$wc "GetLayout - cleanup" -body { destroy .g } } ;# foreach wc $widgetClasses ... eval destroy [winfo children .] tcltest::cleanupTests #*EOF* tile-0.8.2/tests/treetags.test0000644000076500007650000000400710624416402015725 0ustar joejoe00000000000000# # treetags.test,v 1.2 2007/05/21 22:28:18 jenglish Exp # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands tk useinputmethods 0 set auto_path [linsert $auto_path 0 .] ; package require tile testConstraint nyi 0 test treetags-1.0 "Setup" -body { set tv [ttk::treeview .tv] .tv insert {} end -id item1 -text "Item 1" pack .tv } test treetags-1.1 "Bad tag list" -body { $tv item item1 -tags {bad {list}here bad} } -returnCodes error -result "list element in braces *" -match glob test treetags-1.2 "Good tag list" -body { $tv item item1 -tags tag1 $tv item item1 -tags } -result [list tag1] test treetags-1.3 "Bad events" -body { $tv tag bind bad { puts "Entered!" } } -returnCodes 1 -result "unsupported event *" -match glob test treetags-2.0 "tag bind" -body { $tv tag bind tag1 {set ::KEY %A} $tv tag bind tag1 } -result {set ::KEY %A} test treetags-2.1 "Events delivered to tags" -body { focus -force $tv ; update ;# needed so [event generate] delivers KeyPress $tv focus item1 event generate .tv set ::KEY } -result a test treetags-2.2 "Events delivered to correct tags" -body { $tv insert {} end -id item2 -tags tag2 $tv tag bind tag2 [list set ::KEY2 %A] $tv focus item1 event generate $tv $tv focus item2 event generate $tv list $::KEY $::KEY2 } -result [list b c] test treetags-2.3 "Virtual events delivered to focus item" -body { set ::bong 0 $tv tag bind tag2 <> { incr bong } $tv focus item2 event generate $tv <> $tv focus item1 event generate $tv <> set bong } -result 1 test treetags-3.0 "tag configure" -body { $tv tag configure tag1 -foreground blue -background red } -result {} test treetags-3.1 "tag configure" -body { $tv tag configure tag1 -foreground } -result [list blue] test treetags-end "Cleanup" -body { destroy .tv } tcltest::cleanupTests tile-0.8.2/tests/treeview.test0000644000076500007650000003760610541563005015754 0ustar joejoe00000000000000# # treeview.test,v 1.9 2006/12/18 19:03:33 jenglish Exp # # [7Jun2005] TO CHECK: [$tv see {}] -- shouldn't work (at least, shouldn't do # what it currently does) # package require Tk package require tcltest ; namespace import -force tcltest::* loadTestedCommands lappend auto_path . package require tile # consistencyCheck -- # Traverse the tree to make sure the item data structures # are properly linked. # # Since [$tv children] follows ->next links and [$tv index] # follows ->prev links, this should cover all invariants. # proc consistencyCheck {tv {item {}}} { set i 0; foreach child [$tv children $item] { assert {[$tv parent $child] == $item} "parent $child = $item" assert {[$tv index $child] == $i} "index $child [$tv index $child]=$i" incr i consistencyCheck $tv $child } } proc assert {expr {message ""}} { if {![uplevel 1 [list expr $expr]]} { set error "PANIC! PANIC! PANIC: $message ($expr failed)" puts stderr $error error $error } } test treeview-0 "treeview test - setup" -body { ttk::treeview .tv -columns {a b c} pack .tv -expand true -fill both update } test treeview-1.1 "columns" -body { .tv configure -columns {a b c} } test treeview-1.2 "Bad columns" -body { #.tv configure -columns {illegal "list"value} ttk::treeview .badtv -columns {illegal "list"value} } -returnCodes 1 -result "list element in quotes followed by*" -match glob test treeview-1.3 "bad displaycolumns" -body { .tv configure -displaycolumns {a b d} } -returnCodes 1 -result "Invalid column index d" test treeview-1.4 "more bad displaycolumns" -body { .tv configure -displaycolumns {1 2 3} } -returnCodes 1 -result "Column index 3 out of bounds" test treeview-1.5 "Don't forget to check negative numbers" -body { .tv configure -displaycolumns {1 -2 3} } -returnCodes 1 -result "Column index -2 out of bounds" # Item creation. # test treeview-2.1 "insert -- not enough args" -body { .tv insert } -returnCodes 1 -result "wrong # args: *" -match glob test treeview-2.3 "insert -- bad integer index" -body { .tv insert {} badindex } -returnCodes 1 -result "expected integer *" -match glob test treeview-2.4 "insert -- bad parent node" -body { .tv insert badparent end } -returnCodes 1 -result "Item badparent not found" -match glob test treeview-2.5 "insert -- finaly insert a node" -body { .tv insert {} end -id newnode -text "New node" } -result newnode test treeview-2.6 "insert -- make sure node was inserted" -body { .tv children {} } -result [list newnode] test treeview-2.7 "insert -- prevent duplicate node names" -body { .tv insert {} end -id newnode } -returnCodes 1 -result "Item newnode already exists" test treeview-2.8 "insert -- new node at end" -body { .tv insert {} end -id lastnode consistencyCheck .tv .tv children {} } -result [list newnode lastnode] consistencyCheck .tv test treeview-2.9 "insert -- new node at beginning" -body { .tv insert {} 0 -id firstnode consistencyCheck .tv .tv children {} } -result [list firstnode newnode lastnode] test treeview-2.10 "insert -- one more node" -body { .tv insert {} 2 -id onemore consistencyCheck .tv .tv children {} } -result [list firstnode newnode onemore lastnode] test treeview-2.11 "insert -- and another one" -body { .tv insert {} 2 -id anotherone consistencyCheck .tv .tv children {} } -result [list firstnode newnode anotherone onemore lastnode] test treeview-2.12 "insert -- one more at end" -body { .tv insert {} end -id newlastone consistencyCheck .tv .tv children {} } -result [list firstnode newnode anotherone onemore lastnode newlastone] test treeview-2.13 "insert -- one more at beginning" -body { .tv insert {} 0 -id newfirstone consistencyCheck .tv .tv children {} } -result [list newfirstone firstnode newnode anotherone onemore lastnode newlastone] test treeview-2.14 "insert -- bad options" -body { .tv insert {} end -badoption foo } -returnCodes 1 -result {unknown option "-badoption"} test treeview-2.15 "insert -- at position 0 w/no children" -body { .tv insert newnode 0 -id newnode.n2 -text "Foo" .tv children newnode } -result newnode.n2 ;# don't crash test treeview-2.16 "insert -- insert way past end" -body { .tv insert newnode 99 -id newnode.n3 -text "Foo" consistencyCheck .tv .tv children newnode } -result [list newnode.n2 newnode.n3] test treeview-2.17 "insert -- insert before beginning" -body { .tv insert newnode -1 -id newnode.n1 -text "Foo" consistencyCheck .tv .tv children newnode } -result [list newnode.n1 newnode.n2 newnode.n3] ### # test treeview-3.1 "parent" -body { .tv parent newnode.n1 } -result newnode test treeview-3.2 "parent - top-level node" -body { .tv parent newnode } -result {} test treeview-3.3 "parent - root node" -body { .tv parent {} } -result {} test treeview-3.4 "index" -body { list [.tv index newnode.n3] [.tv index newnode.n2] [.tv index newnode.n1] } -result [list 2 1 0] test treeview-3.5 "index - exhaustive test" -body { set result [list] foreach item [.tv children {}] { lappend result [.tv index $item] } set result } -result [list 0 1 2 3 4 5 6] test treeview-3.6 "detach" -body { .tv detach newnode consistencyCheck .tv .tv children {} } -result [list newfirstone firstnode anotherone onemore lastnode newlastone] # XREF: treeview-2.13 test treeview-3.7 "detach didn't screw up internal links" -body { consistencyCheck .tv set result [list] foreach item [.tv children {}] { lappend result [.tv index $item] } set result } -result [list 0 1 2 3 4 5] test treeview-3.8 "detached node has no parent, index 0" -body { list [.tv parent newnode] [.tv index newnode] } -result [list {} 0] # @@@ Can't distinguish detached nodes from first root node test treeview-3.9 "detached node's children undisturbed" -body { .tv children newnode } -result [list newnode.n1 newnode.n2 newnode.n3] test treeview-3.10 "detach is idempotent" -body { .tv detach newnode consistencyCheck .tv .tv children {} } -result [list newfirstone firstnode anotherone onemore lastnode newlastone] test treeview-3.11 "Can't detach root item" -body { .tv detach [list {}] update consistencyCheck .tv } -returnCodes 1 -result "Cannot detach root item" consistencyCheck .tv test treeview-3.12 "Reattach" -body { .tv move newnode {} end consistencyCheck .tv .tv children {} } -result [list newfirstone firstnode anotherone onemore lastnode newlastone newnode] # Bug # ????? test treeview-3.13 "Re-reattach" -body { .tv move newnode {} end consistencyCheck .tv .tv children {} } -result [list newfirstone firstnode anotherone onemore lastnode newlastone newnode] .tv insert newfirstone end -id x1 .tv insert newfirstone end -id x2 .tv insert newfirstone end -id x3 test treeview-3.14 "Duplicated entry in children list" -body { .tv children newfirstone [list x3 x1 x2 x3] # ??? Maybe this should raise an error? consistencyCheck .tv .tv children newfirstone } -result [list x3 x1 x2] test treeview-3.14.1 "Duplicated entry in children list" -body { .tv children newfirstone [list x1 x2 x3 x3 x2 x1] consistencyCheck .tv .tv children newfirstone } -result [list x1 x2 x3] test treeview-3.15 "Consecutive duplicate entries in children list" -body { .tv children newfirstone [list x1 x2 x2 x3] consistencyCheck .tv .tv children newfirstone } -result [list x1 x2 x3] test treeview-3.16 "Insert child after self" -body { .tv move x2 newfirstone 1 consistencyCheck .tv .tv children newfirstone } -result [list x1 x2 x3] test treeview-3.17 "Insert last child after self" -body { .tv move x3 newfirstone 2 consistencyCheck .tv .tv children newfirstone } -result [list x1 x2 x3] test treeview-3.18 "Insert last child after end" -body { .tv move x3 newfirstone 3 consistencyCheck .tv .tv children newfirstone } -result [list x1 x2 x3] test treeview-4.1 "opened - initial state" -body { .tv item newnode -open } -result 0 test treeview-4.2 "opened - open node" -body { .tv item newnode -open 1 .tv item newnode -open } -result 1 test treeview-4.3 "opened - closed node" -body { .tv item newnode -open 0 .tv item newnode -open } -result 0 test treeview-5.1 "item -- error checks" -body { .tv item newnode -text "Bad values" -values "{bad}list" } -returnCodes 1 -result "list element in braces followed by*" -match glob test treeview-5.2 "item -- error leaves options unchanged " -body { .tv item newnode -text } -result "New node" test treeview-5.3 "Heading" -body { .tv heading #0 -text "Heading" } test treeview-5.4 "get cell" -body { set l [list a b c] .tv item newnode -values $l .tv set newnode 1 } -result b test treeview-5.5 "set cell" -body { .tv set newnode 1 XXX .tv item newnode -values } -result [list a XXX c] test treeview-5.6 "set illegal cell" -body { .tv set newnode #0 YYY } -returnCodes 1 -result "Display column #0 cannot be set" test treeview-5.7 "set illegal cell" -body { .tv set newnode 3 YY ;# 3 == current #columns } -returnCodes 1 -result "Column index 3 out of bounds" test treeview-5.8 "set display columns" -body { .tv configure -displaycolumns [list 2 1 0] .tv set newnode #1 X .tv set newnode #2 Y .tv set newnode #3 Z .tv item newnode -values } -result [list Z Y X] test treeview-5.9 "display columns part 2" -body { list [.tv column #1 -id] [.tv column #2 -id] [.tv column #3 -id] } -result [list c b a] test treeview-5.10 "cannot set column -id" -body { .tv column #1 -id X } -returnCodes 1 -result "Attempt to change read-only option" test treeview-5.11 "get" -body { .tv set newnode #1 } -result X test treeview-5.12 "get dictionary" -body { .tv set newnode } -result [list a Z b Y c X] test treeview-5.13 "get, no value" -body { set newitem [.tv insert {} end] set result [.tv set $newitem #1] .tv delete $newitem set result } -result {} test treeview-5.14 "-displaycolumns #all" -body { .tv configure -displaycolumns "#all" list [.tv column #1 -id] [.tv column #2 -id] [.tv column #3 -id] } -result [.tv cget -columns] test treeview-5.15 "-displaycolumns empty" -body { .tv configure -displaycolumns [list] list [.tv column #1 -id] [.tv column #2 -id] [.tv column #3 -id] } -returnCodes error -result "Column #1 out of range" test treeview-6.1 "deletion - setup" -body { .tv insert {} end -id dtest foreach id [list a b c d e] { .tv insert dtest end -id $id } .tv children dtest } -result [list a b c d e] test treeview-6.1 "delete" -body { .tv delete b consistencyCheck .tv list [.tv exists b] [.tv children dtest] } -result [list 0 [list a c d e]] consistencyCheck .tv test treeview-6.2 "delete - duplicate items in list" -body { .tv delete [list a e a e] consistencyCheck .tv .tv children dtest } -result [list c d] test treeview-6.3 "delete - descendants removed" -body { .tv insert c end -id c1 .tv insert c end -id c2 .tv insert c1 end -id c11 consistencyCheck .tv .tv delete c consistencyCheck .tv list [.tv exists c] [.tv exists c1] [.tv exists c2] [.tv exists c11] } -result [list 0 0 0 0] test treeview-6.4 "delete - delete parent and descendants" -body { .tv insert dtest end -id c .tv insert c end -id c1 .tv insert c end -id c2 .tv insert c1 end -id c11 consistencyCheck .tv .tv delete [list c c1 c2 c11] consistencyCheck .tv list [.tv exists c] [.tv exists c1] [.tv exists c2] [.tv exists c11] } -result [list 0 0 0 0] test treeview-6.5 "delete - delete descendants and parent" -body { .tv insert dtest end -id c .tv insert c end -id c1 .tv insert c end -id c2 .tv insert c1 end -id c11 consistencyCheck .tv .tv delete [list c11 c1 c2 c] consistencyCheck .tv list [.tv exists c] [.tv exists c1] [.tv exists c2] [.tv exists c11] } -result [list 0 0 0 0] test treeview-6.6 "delete - end" -body { consistencyCheck .tv .tv children dtest } -result [list d] test treeview-7.1 "move" -body { .tv insert d end -id d1 .tv insert d end -id d2 .tv insert d end -id d3 .tv move d3 d 0 consistencyCheck .tv .tv children d } -result [list d3 d1 d2] test treeview-7.2 "illegal move" -body { .tv move d d2 end } -returnCodes 1 -result "Cannot insert d as a descendant of d2" test treeview-7.3 "illegal move has no effect" -body { consistencyCheck .tv .tv children d } -result [list d3 d1 d2] test treeview-7.4 "Replace children" -body { .tv children d [list d3 d2 d1] consistencyCheck .tv .tv children d } -result [list d3 d2 d1] test treeview-7.5 "replace children - precondition" -body { # Just check to make sure the test suite so far has left # us in the state we expect to be in: list [.tv parent newnode] [.tv children newnode] } -result [list {} [list newnode.n1 newnode.n2 newnode.n3]] test treeview-7.6 "Replace children - illegal move" -body { .tv children newnode.n1 [list newnode.n1 newnode.n2 newnode.n3] } -returnCodes 1 -result "Cannot insert newnode.n1 as a descendant of newnode.n1" proc lmove {l from to} { linsert [lreplace $l $from $from] $to [lindex $l $from] } test treeview-7.7 "Exhaustive moves" -setup { set r [.tv insert newnode 0] set l [list m1 m2 m3 m4 m5] foreach c $l { .tv insert $r end -id $c } } -cleanup { .tv delete $r } -body { set n [llength $l] set errors [list] for {set i 0} {$i < $n} {incr i} { for {set j 0} {$j < $n} {incr j} { .tv children $r $l ; consistencyCheck .tv .tv move [lindex $l $i] $r $j ; consistencyCheck .tv set expect [lmove $l $i $j] set result [.tv children $r] foreach x $expect y $result { if {$x ne $y} { lappend errors \ "move $i -> $j: got '$result', expected '$expect'" break; } } } } join $errors \n } -result "" test treeview-7.8 "Exhaustive inserts" -setup { set r [.tv insert newnode 0] set l [list i1 i2 i3 i4] foreach c $l { .tv insert $r end -id $c } } -cleanup { .tv delete $r } -body { set n [llength $l] set errors [list] for {set i -1} {$i <= $n+1} {incr i} { consistencyCheck .tv .tv insert $r $i -id X ; consistencyCheck .tv set expect [linsert $l $i X] set result [.tv children $r] foreach x $expect y $result { if {$x ne $y} { lappend errors "insert $i: got '$result', expected '$expect'" break; } } .tv delete X ; consistencyCheck .tv } join $errors \n } -result "" consistencyCheck .tv test treeview-8.0 "Selection set" -body { .tv selection set [list newnode.n1 newnode.n3 newnode.n2] .tv selection } -result [list newnode.n1 newnode.n2 newnode.n3] test treeview-8.1 "Selection add" -body { .tv selection add [list newnode] .tv selection } -result [list newnode newnode.n1 newnode.n2 newnode.n3] test treeview-8.2 "Selection toggle" -body { .tv selection toggle [list newnode.n2 d3] .tv selection } -result [list newnode newnode.n1 newnode.n3 d3] test treeview-8.3 "Selection remove" -body { .tv selection remove [list newnode.n2 d3] .tv selection } -result [list newnode newnode.n1 newnode.n3] test treeview-8.4 "Selection - clear" -body { .tv selection set {} .tv selection } -result {} test treeview-8.5 "Selection - bad operation" -body { .tv selection badop foo } -returnCodes 1 -match glob -result {bad selection operation "badop": must be *} ### NEED: more tests for see/yview/scrolling proc scrollcallback {args} { set ::scrolldata $args } test treeview-9.0 "scroll callback - empty tree" -body { .tv configure -yscrollcommand scrollcallback .tv delete [.tv children {}] update set ::scrolldata } -result [list 0 1] ### NEED: tests for focus item, selection ### Misc. tests: destroy .tv test treeview-10.1 "Root node properly initialized (#1541739)" -setup { ttk::treeview .tv .tv insert {} end -id a .tv see a } -cleanup { destroy .tv } tcltest::cleanupTests tile-0.8.2/tests/tvtest.tcl0000644000076500007650000002127410541563005015250 0ustar joejoe00000000000000# tvtest.tcl,v 1.11 2006/12/18 19:03:33 jenglish Exp # # Sandbox test script for treeview testing # package require tile source [file join [file dirname [info script]] testutils.tcl] set haveswaplist [expr {![catch {package require swaplist}]}] set haveinplace [expr {![catch {package require tile::inplace}]}] option add *Toolbar*TCheckbutton.style Toolbutton option add *Toolbar*TRadiobutton.style Toolbutton option add *tearOff 0 # # Tree window: # set f [ttk::frame .f] set tv $f.tv ttk::scrollbar $f.vsb -orient vertical -command [list $tv yview] ttk::scrollbar $f.hsb -orient horizontal -command [list $tv xview] ttk::treeview $tv \ -columns [list X Y Z] -displaycolumns [list X Y Z] \ -yscrollcommand [list $f.vsb set] \ -xscrollcommand [list $f.hsb set] \ ; grid $f.tv $f.vsb -sticky news grid $f.hsb -sticky news grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1 # # Status bar: # style configure Indicator.TLabel -relief sunken -borderwidth 1 option add *Indicator.style Indicator.TLabel set s [ttk::frame .status -class Statusbar] pack \ [ttk::label $s.l -class Indicator -textvariable message -width 20] \ [ttk::label $s.lr -text "Row:" ] \ [ttk::label $s.r -class Indicator -textvariable ::irow -width 10] \ [ttk::label $s.lc -text "Col:" ] \ [ttk::label $s.c -class Indicator -textvariable ::icol -width 10] \ [ttk::label $s.lb -text "BBox:" ] \ [ttk::label $s.b -class Indicator -textvariable ::bbox -width 16] \ -side left -pady 2; # # View control: # set Show(headings) 1 set Show(tree) 1 proc setShow {tv} { variable Show set show [list] foreach {what} [list headings tree] { if {$Show($what)} { lappend show $what } } $tv configure -show $show } set State(selectMode) extended proc setSelectMode {tv} { variable State $tv configure -selectmode $State(selectMode) $tv selection set {} } # # Menubar: # set m [menu .menu] $m add cascade -label View -underline 0 -menu [menu $m.view] $m.view add checkbutton -label "Headings?" \ -variable Show(headings) -command [list setShow $f.tv] $m.view add checkbutton -label "Tree?" \ -variable Show(tree) -command [list setShow $f.tv] $m.view add separator $m.view add radiobutton -label "Extended" \ -variable State(selectMode) -value extended \ -command [list setSelectMode $f.tv] ; $m.view add radiobutton -label "Browse" \ -variable State(selectMode) -value browse \ -command [list setSelectMode $f.tv] ; $m.view add radiobutton -label "None" \ -variable State(selectMode) -value none \ -command [list setSelectMode $f.tv] ; . configure -menu $m # # Toolbar: # ttk::frame .t -class Toolbar raise .t pack \ [ttk::checkbutton .t.sh -text "Headings?" \ -variable Show(headings) -command [list setShow $f.tv]] \ [ttk::checkbutton .t.st -text "Tree?" \ -variable Show(tree) -command [list setShow $f.tv]] \ [ttk::button .t.db -text "Directory" -command [list dirbrowse [pwd]]] \ -side left; if {$haveswaplist} { pack \ [ttk::button .t.cl -text "Columns" -command [list selectColumns $tv]] \ -side left; } foreach selectmode {extended browse none} { pack [ttk::radiobutton .t.sm-$selectmode -text $selectmode \ -variable State(selectMode) -value $selectmode \ -command [list setSelectMode $tv] \ ] -side left; } # # Configure tree: # $tv heading #0 -text "Tree" $tv heading X -text "XXX" $tv heading Y -text "YYY" $tv heading Z -text "ZZZ" pack .t -side top -expand false -fill x pack .status -side bottom -expand false -fill x pack .f -side top -expand true -fill both -padx 6 -pady 6 bind . [list destroy .] bind $tv { identify %W %x %y } bind $tv { %W delete [%W selection] } # identify -- # Update status bar # proc identify {tv x y} { # Old form: set ::message [$tv identify $x $y] # New form: set ::irow [$tv identify row $x $y] set ::icol [$tv identify column $x $y] if {$::irow ne ""} { if {$::icol ne ""} { set ::bbox [$tv bbox $::irow $::icol] } else { set ::bbox [$tv bbox $::irow] } } else { set ::bbox N/A } } ## Add some nodes: # $tv insert {} end -id a -text "First node" -values [list a1 a2 a3] $tv insert {} end -id b -text "Second node" -values [list b1 b2 b3] $tv insert {} end -id c -text "Third node" -values [list c1 c2 c3] $tv insert {} end -id moveme -text "Press ^M to move me" -values {- - -} bind $tv { %W move moveme [%W parent [%W focus]] [%W index [%W focus]] ttk::treeview::BrowseTo %W moveme } bind $tv { %W move moveme [%W focus] 0 ttk::treeview::BrowseTo %W moveme } $tv insert a end -id a1 -text "First subnode" -values [list d1 d2 d3] $tv insert a end -id a2 -text "Second subnode" -values [list e1 e2 e3] $tv insert a1 end -text "Subsubnode!!" -values [list X! Y! Z!] foreach label {a b c d e f g h i j k l m n o} { $tv insert b end -text $label } # Directory browser: # SOURCE: tkfbox.tcl set Icons(folder) [image create photo -data { R0lGODlhEAAMAKEAAAD//wAAAPD/gAAAACH5BAEAAAAALAAAAAAQAAwAAAIghINhyycvVFsB QtmS3rjaH1Hg141WaT5ouprt2HHcUgAAOw==}] set Icons(file) [image create photo -data { R0lGODlhDAAMAKEAALLA3AAAAP//8wAAACH5BAEAAAAALAAAAAAMAAwAAAIgRI4Ha+IfWHsO rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}] proc loaddir {tv node dir} { variable Icons foreach subdir [glob -nocomplain -type d -directory $dir *] { set dirnode [$tv insert $node end -text [file tail $subdir] \ -image $Icons(folder) -tags DIR -values [list X Y Z]] loaddir $tv $dirnode $subdir } foreach file [glob -nocomplain -type f -directory $dir *] { $tv insert $node end -text [file tail $file] \ -image $Icons(file) -tags FILE -values [list X Y Z] } } proc scandir {dir} { foreach subdir [glob -nocomplain -type d -directory $dir *] { scandir $subdir } glob -nocomplain -type f -directory $dir * } proc dirbrowse {dir} { set tv $::tv $tv tag bind DIR { puts "DIR: [%W item [%W identify row %x %y] -text]" } $tv tag bind FILE { puts "FILE: [%W item [%W identify row %x %y] -text]" } $tv tag configure DIR -foreground #000077 -background #777700 $tv tag configure FILE -foreground #007700 -background #770077 loaddir $tv [$tv insert {} end -text $dir -tags DIR] $dir } proc setWidths {tv {weights {}} {width {}}} { if {$width eq {}} { set width [winfo width $tv] } array set W $weights set columns [$tv cget -displaycolumns] if {![llength $columns]} { set columns [$tv cget -columns] } set columns [linsert $columns 0 "#0"] set totalWeight 0.0 set weights [list] foreach column $columns { if {[info exists W($column)]} { set weight $W($column) } else { set weight 1 } lappend weights $weight set totalWeight [expr {$totalWeight+$weight}] } foreach column $columns weight $weights { set colwidth [expr {int(($width * $weight)/$totalWeight)}] $tv column $column -width $colwidth } } proc selectColumns {tv} { set columns [$tv cget -displaycolumns] if {[swaplist::swaplist $tv.c columns [$tv cget -columns] $columns]} { $tv configure -displaycolumns $columns } } # ... if {$haveinplace} { bind $tv { clickToEdit %W %x %y } proc clickToEdit {tv x y} { set row [$tv identify row $x $y] set column [$tv identify column $x $y] if {$row ne "" && $column ne ""} { ttk::treeview::edit $tv $row $column } } } menu $tv.m -tearoff false -borderwidth 1 bind $tv [list column-menu/post $tv $tv.m %x %y] proc column-menu/post {tv m x y} { upvar #0 $m M set M(tv) $tv set M(column) [$tv identify column $x $y] set M(stretch) [$tv column $M(column) -stretch] set displaycolumns [$tv cget -displaycolumns] foreach column [$tv cget -columns] { set M(show.$column) [expr {[lsearch $displaycolumns $column] >= 0}] } $m delete 0 end $m add checkbutton -label "Stretch?" \ -variable ${m}(stretch) \ -command [list column-menu/stretch-changed $m] \ ; $m add separator foreach column [$tv cget -columns] { $m add checkbutton \ -label [$tv heading $column -text] \ -variable ${m}(show.$column) \ -command [list column-menu/show-changed $m] \ ; } tk_popup $m [winfo pointerx $m] [winfo pointery $m] } proc column-menu/show-changed {m} { upvar #0 $m M set tv [winfo parent $m] set displaycolumns [list] foreach column [$tv cget -columns] { if {$M(show.$column)} { lappend displaycolumns $column } } $tv configure -displaycolumns $displaycolumns } proc column-menu/stretch-changed {m} { upvar #0 $m M $M(tv) column $M(column) -stretch $M(stretch) } tile-0.8.2/tests/validate.test0000644000076500007650000001746410316645535015724 0ustar joejoe00000000000000## ## Entry widget validation tests ## Derived from core test suite entry-19.1 through entry-19.20 ## package require Tk package require tcltest 2.1 namespace import -force tcltest::* loadTestedCommands testConstraint tileEntry 1 testConstraint coreEntry [expr ![testConstraint tileEntry]] eval tcltest::configure $argv test validate-0.0 "Setup" -constraints tileEntry -body { lappend auto_path . ; package require tile rename entry {} interp alias {} entry {} ttk::entry return; } test validate-0.1 "More setup" -body { destroy .e catch {unset ::e} catch {unset ::vVals} entry .e -validate all \ -validatecommand [list doval %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ ; pack .e proc doval {W d i P s S v V} { set ::vVals [list $W $d $i $P $s $S $v $V] return 1 } } # The validation tests build each one upon the previous, so cascading # failures aren't good # test validate-1.1 {entry widget validation - insert} -body { .e insert 0 a set ::vVals } -result {.e 1 0 a {} a all key} test validate-1.2 {entry widget validation - insert} -body { .e insert 1 b set ::vVals } -result {.e 1 1 ab a b all key} test validate-1.3 {entry widget validation - insert} -body { .e insert end c set ::vVals } -result {.e 1 2 abc ab c all key} test validate-1.4 {entry widget validation - insert} -body { .e insert 1 123 list $::vVals $::e } -result {{.e 1 1 a123bc abc 123 all key} a123bc} test validate-1.5 {entry widget validation - delete} -body { .e delete 2 set ::vVals } -result {.e 0 2 a13bc a123bc 2 all key} test validate-1.6 {entry widget validation - delete} -body { .e configure -validate key .e delete 1 3 set ::vVals } -result {.e 0 1 abc a13bc 13 key key} test validate-1.7 {entry widget validation - vmode focus} -body { set ::vVals {} .e configure -validate focus .e insert end d set ::vVals } -result {} test validate-1.8 {entry widget validation - vmode focus} -body { focus -force .e # update necessary to process FocusIn event update set ::vVals } -result {.e -1 -1 abcd abcd {} focus focusin} test validate-1.9 {entry widget validation - vmode focus} -body { focus -force . # update necessary to process FocusOut event update set ::vVals } -result {.e -1 -1 abcd abcd {} focus focusout} .e configure -validate all test validate-1.10 {entry widget validation - vmode all} -body { focus -force .e # update necessary to process FocusIn event update set ::vVals } -result {.e -1 -1 abcd abcd {} all focusin} test validate-1.11 {entry widget validation} -body { focus -force . # update necessary to process FocusOut event update set ::vVals } -result {.e -1 -1 abcd abcd {} all focusout} .e configure -validate focusin test validate-1.12 {entry widget validation} -body { focus -force .e # update necessary to process FocusIn event update set ::vVals } -result {.e -1 -1 abcd abcd {} focusin focusin} test validate-1.13 {entry widget validation} -body { set ::vVals {} focus -force . # update necessary to process FocusOut event update set ::vVals } -result {} .e configure -validate focuso test validate-1.14 {entry widget validation} -body { focus -force .e # update necessary to process FocusIn event update set ::vVals } -result {} test validate-1.15 {entry widget validation} -body { focus -force . # update necessary to process FocusOut event update set ::vVals } -result {.e -1 -1 abcd abcd {} focusout focusout} # DIFFERENCE: core entry temporarily sets "-validate all", ttk::entry doesn't. test validate-1.16 {entry widget validation} -body { .e configure -validate all list [.e validate] $::vVals } -result {1 {.e -1 -1 abcd abcd {} all forced}} # DIFFERENCE: ttk::entry does not perform validation when setting the -variable test validate-1.17 {entry widget validation} -constraints coreEntry -body { .e configure -validate all set ::e newdata list [.e cget -validate] $::vVals } -result {all {.e -1 -1 newdata abcd {} all forced}} proc doval {W d i P s S v V} { set ::vVals [list $W $d $i $P $s $S $v $V] return 0 } test validate-1.18 {entry widget validation} -constraints coreEntry -body { .e configure -validate all set ::e nextdata list [.e cget -validate] $::vVals } -result {none {.e -1 -1 nextdata newdata {} all forced}} # DIFFERENCE: ttk::entry doesn't validate when setting linked -variable # DIFFERENCE: ttk::entry doesn't disable validation proc doval {W d i P s S v V} { set ::vVals [list $W $d $i $P $s $S $v $V] set ::e mydata return 1 } ## This sets validate to none because it shows that we prevent a possible ## loop condition in the validation, when the entry textvar is also set test validate-1.19 {entry widget validation} -constraints coreEntry -body { .e configure -validate all .e validate list [.e cget -validate] [.e get] $::vVals } -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}} ## This leaves validate alone because we trigger validation through the ## textvar (a write trace), and the write during validation triggers ## nothing (by definition of avoiding loops on var traces). This is ## one of those "dangerous" conditions where the user will have a ## different value in the entry widget shown as is in the textvar. # DIFFERENCE: tile entry doesn't get out of sync w/textvar test validate-1.20 {entry widget validation} -constraints coreEntry -body { .e configure -validate all set ::e testdata list [.e cget -validate] [.e get] $::e $::vVals } -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}} # # New tests, -JE: # proc doval {W d i P s S v V} { set ::vVals [list $W $d $i $P $s $S $v $V] .e delete 0 end; .e insert end dovaldata return 0 } test validate-2.1 "Validation script changes value" -body { .e configure -validate none set ::e testdata .e configure -validate all .e validate list [.e get] $::e $::vVals } -result {dovaldata dovaldata {.e -1 -1 testdata testdata {} all forced}} # DIFFERENCE: core entry disables validation, tile entry does not. destroy .e catch {unset ::e ::vVals} # See bug #1236979 test validate-2.2 "configure in -validatecommand" -body { proc validate-2.2 {win str} { $win configure -foreground black return 1 } ttk::entry .e -textvariable var -validatecommand {validate-2.2 %W %P} .e validate } -result 1 -cleanup { destroy .e } ### invalid state behavior # test validate-3.0 "Setup" -body { set ::E "123" ttk::entry .e \ -validatecommand {string is integer -strict %P} \ -validate all \ -textvariable ::E \ ; return [list [.e get] [.e state]] } -result [list 123 {}] test validate-3.1 "insert - valid" -body { .e insert end "4" return [list [.e get] [.e state]] } -result [list 1234 {}] test validate-3.2 "insert - invalid" -body { .e insert end "X" return [list [.e get] [.e state]] } -result [list 1234 {}] test validate-3.3 "force invalid value" -body { append ::E "XY" return [list [.e get] [.e state]] } -result [list 1234XY {}] test validate-3.4 "revalidate" -body { return [list [.e validate] [.e get] [.e state]] } -result [list 0 1234XY {invalid}] testConstraint NA 0 # the next two tests (used to) exercise validation lockout protection -- # if the widget is currently invalid, all edits are allowed. # This behavior is currently disabled. # test validate-3.5 "all edits allowed while invalid" -constraints NA -body { .e delete 4 return [list [.e get] [.e state]] } -result [list 1234Y {invalid}] test validate-3.6 "...until the value becomes valid" -constraints NA -body { .e delete 4 return [list [.e get] [.e state]] } -result [list 1234 {}] test validate-3.last "Cleanup" -body { destroy .e } ### tcltest::cleanupTests tile-0.8.2/tools/0000755000076500007650000000000010731273177013214 5ustar joejoe00000000000000tile-0.8.2/tools/genStubs.tcl0000644000076500007650000005003510265251673015514 0ustar joejoe00000000000000# genStubs.tcl -- # # This script generates a set of stub files for a given # interface. # # # Copyright (c) 1998-1999 by Scriptics Corporation. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # genStubs.tcl,v 1.11 2005/07/13 17:47:39 jenglish Exp # # SOURCE: tcl/tools/genStubs.tcl, revision 1.17 # # CHANGES: # + Don't use _ANSI_ARGS_ macro # + Remove xxx_TCL_DECLARED #ifdeffery # + Use application-defined storage class specifier instead of "EXTERN" # + Add "epoch" and "revision" fields to stubs table record # + Remove dead code related to USE_*_STUB_PROCS (emitStubs, makeStub) # + Second argument to "declare" is used as a status guard # instead of a platform guard. # + Use void (*reserved$i)(void) = 0 instead of void *reserved$i = NULL # for unused stub entries, in case pointer-to-function and # pointer-to-object are different sizes. # + Allow trailing semicolon in function declarations # + stubs table is const-qualified # package require Tcl 8 namespace eval genStubs { # libraryName -- # # The name of the entire library. This value is used to compute # the USE_*_STUBS macro, the name of the init file, and others. variable libraryName "UNKNOWN" # interfaces -- # # An array indexed by interface name that is used to maintain # the set of valid interfaces. The value is empty. array set interfaces {} # curName -- # # The name of the interface currently being defined. variable curName "UNKNOWN" # scspec -- # # Storage class specifier for external function declarations. # Normally "extern", may be set to something like XYZAPI # variable scspec "extern" # epoch, revision -- # # The epoch and revision numbers of the interface currently being defined. # (@@@TODO: should be an array mapping interface names -> numbers) # variable epoch 0 variable revision 0 # hooks -- # # An array indexed by interface name that contains the set of # subinterfaces that should be defined for a given interface. array set hooks {} # stubs -- # # This three dimensional array is indexed first by interface name, # second by field name, and third by a numeric offset or the # constant "lastNum". The lastNum entry contains the largest # numeric offset used for a given interface. # # Field "decl,$i" contains the C function specification that # should be used for the given entry in the stub table. The spec # consists of a list in the form returned by parseDecl. # Other fields TBD later. array set stubs {} # outDir -- # # The directory where the generated files should be placed. variable outDir . } # genStubs::library -- # # This function is used in the declarations file to set the name # of the library that the interfaces are associated with (e.g. "tcl"). # This value will be used to define the inline conditional macro. # # Arguments: # name The library name. # # Results: # None. proc genStubs::library {name} { variable libraryName $name } # genStubs::interface -- # # This function is used in the declarations file to set the name # of the interface currently being defined. # # Arguments: # name The name of the interface. # # Results: # None. proc genStubs::interface {name} { variable curName $name variable interfaces variable stubs set interfaces($name) {} set stubs($name,lastNum) 0 return } # genStubs::scspec -- # # Define the storage class macro used for external function declarations. # Typically, this will be a macro like XYZAPI or EXTERN that # expands to either DLLIMPORT or DLLEXPORT, depending on whether # -DBUILD_XYZ has been set. # proc genStubs::scspec {value} { variable scspec $value } # genStubs::epoch -- # # Define the epoch number for this library. The epoch # should be incrememented when a release is made that # contains incompatible changes to the public API. # proc genStubs::epoch {value} { variable epoch $value } # genStubs::hooks -- # # This function defines the subinterface hooks for the current # interface. # # Arguments: # names The ordered list of interfaces that are reachable through the # hook vector. # # Results: # None. proc genStubs::hooks {names} { variable curName variable hooks set hooks($curName) $names return } # genStubs::declare -- # # This function is used in the declarations file to declare a new # interface entry. # # Arguments: # index The index number of the interface. # status Status of the interface: one of "current", # "deprecated", or "obsolete". # decl The C function declaration, or {} for an undefined # entry. # proc genStubs::declare {index status decl} { variable stubs variable curName variable revision incr revision # Check for duplicate declarations, then add the declaration and # bump the lastNum counter if necessary. if {[info exists stubs($curName,decl,$index)]} { puts stderr "Duplicate entry: $index" } regsub -all "\[ \t\n\]+" [string trim $decl] " " decl set decl [parseDecl $decl] set stubs($curName,status,$index) $status set stubs($curName,decl,$index) $decl if {$index > $stubs($curName,lastNum)} { set stubs($curName,lastNum) $index } return } # genStubs::rewriteFile -- # # This function replaces the machine generated portion of the # specified file with new contents. It looks for the !BEGIN! and # !END! comments to determine where to place the new text. # # Arguments: # file The name of the file to modify. # text The new text to place in the file. # # Results: # None. proc genStubs::rewriteFile {file text} { if {![file exists $file]} { puts stderr "Cannot find file: $file" return } set in [open ${file} r] set out [open ${file}.new w] while {![eof $in]} { set line [gets $in] if {[string match "*!BEGIN!*" $line]} { break } puts $out $line } puts $out "/* !BEGIN!: Do not edit below this line. */" puts $out $text while {![eof $in]} { set line [gets $in] if {[string match "*!END!*" $line]} { break } } puts $out "/* !END!: Do not edit above this line. */" puts -nonewline $out [read $in] close $in close $out file rename -force ${file}.new ${file} return } # genStubs::addPlatformGuard -- # # Wrap a string inside a platform #ifdef. # # Arguments: # plat Platform to test. # # Results: # Returns the original text inside an appropriate #ifdef. proc genStubs::addPlatformGuard {plat text} { switch $plat { win { return "#ifdef __WIN32__\n${text}#endif /* __WIN32__ */\n" } unix { return "#if !defined(__WIN32__) /* UNIX */\n${text}#endif /* UNIX */\n" } macosx { return "#ifdef MAC_OSX_TCL\n${text}#endif /* MAC_OSX_TCL */\n" } aqua { return "#ifdef MAC_OSX_TK\n${text}#endif /* MAC_OSX_TK */\n" } x11 { return "#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */\n${text}#endif /* X11 */\n" } } return "$text" } # genStubs::emitSlots -- # # Generate the stub table slots for the given interface. # # Arguments: # name The name of the interface being emitted. # textVar The variable to use for output. # # Results: # None. proc genStubs::emitSlots {name textVar} { upvar $textVar text forAllStubs $name makeSlot noGuard text {" void (*reserved$i)(void);\n"} return } # genStubs::parseDecl -- # # Parse a C function declaration into its component parts. # # Arguments: # decl The function declaration. # # Results: # Returns a list of the form {returnType name args}. The args # element consists of a list of type/name pairs, or a single # element "void". If the function declaration is malformed # then an error is displayed and the return value is {}. proc genStubs::parseDecl {decl} { if {![regexp {^(.*)\((.*)\);?$} $decl all prefix args]} { puts stderr "Malformed declaration: $decl" return } set prefix [string trim $prefix] if {![regexp {^(.+[ ][*]*)([^ *]+)$} $prefix all rtype fname]} { puts stderr "Bad return type: $decl" return } set rtype [string trim $rtype] foreach arg [split $args ,] { lappend argList [string trim $arg] } if {![string compare [lindex $argList end] "..."]} { if {[llength $argList] != 2} { puts stderr "Only one argument is allowed in varargs form: $decl" } set arg [parseArg [lindex $argList 0]] if {$arg == "" || ([llength $arg] != 2)} { puts stderr "Bad argument: '[lindex $argList 0]' in '$decl'" return } set args [list TCL_VARARGS $arg] } else { set args {} foreach arg $argList { set argInfo [parseArg $arg] if {![string compare $argInfo "void"]} { lappend args "void" break } elseif {[llength $argInfo] == 2 || [llength $argInfo] == 3} { lappend args $argInfo } else { puts stderr "Bad argument: '$arg' in '$decl'" return } } } return [list $rtype $fname $args] } # genStubs::parseArg -- # # This function parses a function argument into a type and name. # # Arguments: # arg The argument to parse. # # Results: # Returns a list of type and name with an optional third array # indicator. If the argument is malformed, returns "". proc genStubs::parseArg {arg} { if {![regexp {^(.+[ ][*]*)([^][ *]+)(\[\])?$} $arg all type name array]} { if {$arg == "void"} { return $arg } else { return } } set result [list [string trim $type] $name] if {$array != ""} { lappend result $array } return $result } # genStubs::makeDecl -- # # Generate the prototype for a function. # # Arguments: # name The interface name. # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted declaration string. proc genStubs::makeDecl {name decl index} { variable scspec lassign $decl rtype fname args append text "/* $index */\n" set line "$scspec $rtype" set count [expr {2 - ([string length $line] / 8)}] append line [string range "\t\t\t" 0 $count] set pad [expr {24 - [string length $line]}] if {$pad <= 0} { append line " " set pad 0 } append line "$fname " set arg1 [lindex $args 0] switch -exact $arg1 { void { append line "(void)" } TCL_VARARGS { set arg [lindex $args 1] append line "TCL_VARARGS([lindex $arg 0],[lindex $arg 1])" } default { set sep "(" foreach arg $args { append line $sep set next {} append next [lindex $arg 0] " " [lindex $arg 1] \ [lindex $arg 2] if {[string length $line] + [string length $next] \ + $pad > 76} { append text $line \n set line "\t\t\t\t" set pad 28 } append line $next set sep ", " } append line ")" } } append text $line append text ";\n" return $text } # genStubs::makeMacro -- # # Generate the inline macro for a function. # # Arguments: # name The interface name. # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted macro definition. proc genStubs::makeMacro {name decl index} { lassign $decl rtype fname args set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text "#ifndef $fname\n#define $fname" set arg1 [lindex $args 0] set argList "" switch -exact $arg1 { void { set argList "()" } TCL_VARARGS { } default { set sep "(" foreach arg $args { append argList $sep [lindex $arg 1] set sep ", " } append argList ")" } } append text " \\\n\t(${name}StubsPtr->$lfname)" append text " /* $index */\n#endif\n" return $text } # genStubs::makeSlot -- # # Generate the stub table entry for a function. # # Arguments: # name The interface name. # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted table entry. proc genStubs::makeSlot {name decl index} { lassign $decl rtype fname args set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text " " append text $rtype " (*" $lfname ") " set arg1 [lindex $args 0] switch -exact $arg1 { void { append text "(void)" } TCL_VARARGS { set arg [lindex $args 1] append text "TCL_VARARGS([lindex $arg 0],[lindex $arg 1])" } default { set sep "(" foreach arg $args { append text $sep [lindex $arg 0] " " [lindex $arg 1] \ [lindex $arg 2] set sep ", " } append text ")" } } append text "; /* $index */\n" return $text } # genStubs::makeInit -- # # Generate the prototype for a function. # # Arguments: # name The interface name. # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted declaration string. proc genStubs::makeInit {name decl index} { append text " " [lindex $decl 1] ", /* " $index " */\n" return $text } # genStubs::forAllStubs -- # # This function iterates over all of the slots and invokes # a callback for each slot. The result of the callback is then # placed inside appropriate guards. # # Arguments: # name The interface name. # slotProc The proc to invoke to handle the slot. It will # have the interface name, the declaration, and # the index appended. # guardProc The proc to invoke to add guards. It will have # the slot status and text appended. # textVar The variable to use for output. # skipString The string to emit if a slot is skipped. This # string will be subst'ed in the loop so "$i" can # be used to substitute the index value. # # Results: # None. proc genStubs::forAllStubs {name slotProc guardProc textVar {skipString {"/* Slot $i is reserved */\n"}}} { variable stubs upvar $textVar text set lastNum $stubs($name,lastNum) for {set i 0} {$i <= $lastNum} {incr i} { if {[info exists stubs($name,decl,$i)]} { append text [$guardProc $stubs($name,status,$i) \ [$slotProc $name $stubs($name,decl,$i) $i]] } else { eval {append text} $skipString } } } proc genStubs::noGuard {status text} { return $text } proc genStubs::addGuard {status text} { variable libraryName set upName [string toupper $libraryName] switch -- $status { current { # No change } deprecated { set text [ifdeffed "${upName}_DEPRECATED" $text] } obsolete { set text "" } default { puts stderr "Unrecognized status code $status" } } return $text } proc genStubs::ifdeffed {macro text} { join [list "#ifdef $macro" $text "#endif" ""] \n } # genStubs::emitDeclarations -- # # This function emits the function declarations for this interface. # # Arguments: # name The interface name. # textVar The variable to use for output. # # Results: # None. proc genStubs::emitDeclarations {name textVar} { variable libraryName upvar $textVar text set upName [string toupper $libraryName] append text "\n#if !defined(USE_${upName}_STUBS)\n" append text "\n/*\n * Exported function declarations:\n */\n\n" forAllStubs $name makeDecl noGuard text append text "\n#endif /* !defined(USE_${upName}_STUBS) */\n" return } # genStubs::emitMacros -- # # This function emits the inline macros for an interface. # # Arguments: # name The name of the interface being emitted. # textVar The variable to use for output. # # Results: # None. proc genStubs::emitMacros {name textVar} { variable libraryName upvar $textVar text set upName [string toupper $libraryName] append text "\n#if defined(USE_${upName}_STUBS)\n" append text "\n/*\n * Inline function declarations:\n */\n\n" forAllStubs $name makeMacro addGuard text append text "\n#endif /* defined(USE_${upName}_STUBS) */\n" return } # genStubs::emitHeader -- # # This function emits the body of the Decls.h file for # the specified interface. # # Arguments: # name The name of the interface being emitted. # # Results: # None. proc genStubs::emitHeader {name} { variable outDir variable hooks variable epoch variable revision set capName [string toupper [string index $name 0]] append capName [string range $name 1 end] set CAPName [string toupper $name] append text "\n" append text "#define ${CAPName}_STUBS_EPOCH $epoch\n" append text "#define ${CAPName}_STUBS_REVISION $revision\n" emitDeclarations $name text if {[info exists hooks($name)]} { append text "\ntypedef struct ${capName}StubHooks {\n" foreach hook $hooks($name) { set capHook [string toupper [string index $hook 0]] append capHook [string range $hook 1 end] append text " struct ${capHook}Stubs *${hook}Stubs;\n" } append text "} ${capName}StubHooks;\n" } append text "\ntypedef struct ${capName}Stubs {\n" append text " int magic;\n" append text " int epoch;\n" append text " int revision;\n" append text " struct ${capName}StubHooks *hooks;\n\n" emitSlots $name text append text "} ${capName}Stubs;\n" append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n" append text "extern const ${capName}Stubs *${name}StubsPtr;\n" append text "#ifdef __cplusplus\n}\n#endif\n" emitMacros $name text rewriteFile [file join $outDir ${name}Decls.h] $text return } # genStubs::emitInit -- # # Generate the table initializers for an interface. # # Arguments: # name The name of the interface to initialize. # textVar The variable to use for output. # # Results: # Returns the formatted output. proc genStubs::emitInit {name textVar} { variable hooks variable epoch variable revision upvar $textVar text set capName [string toupper [string index $name 0]] append capName [string range $name 1 end] set CAPName [string toupper $name] if {[info exists hooks($name)]} { append text "\nstatic ${capName}StubHooks ${name}StubHooks = \{\n" set sep " " foreach sub $hooks($name) { append text $sep "&${sub}Stubs" set sep ",\n " } append text "\n\};\n" } append text "\n${capName}Stubs ${name}Stubs = \{\n" append text " TCL_STUB_MAGIC,\n" append text " ${CAPName}_STUBS_EPOCH,\n" append text " ${CAPName}_STUBS_REVISION,\n" if {[info exists hooks($name)]} { append text " &${name}StubHooks,\n" } else { append text " 0,\n" } forAllStubs $name makeInit noGuard text {" 0, /* $i */\n"} append text "\};\n" return } # genStubs::emitInits -- # # This function emits the body of the StubInit.c file for # the specified interface. # # Arguments: # name The name of the interface being emitted. # # Results: # None. proc genStubs::emitInits {} { variable hooks variable outDir variable libraryName variable interfaces # Assuming that dependencies only go one level deep, we need to emit # all of the leaves first to avoid needing forward declarations. set leaves {} set roots {} foreach name [lsort [array names interfaces]] { if {[info exists hooks($name)]} { lappend roots $name } else { lappend leaves $name } } foreach name $leaves { emitInit $name text } foreach name $roots { emitInit $name text } rewriteFile [file join $outDir ${libraryName}StubInit.c] $text } # genStubs::init -- # # This is the main entry point. # # Arguments: # None. # # Results: # None. proc genStubs::init {} { global argv argv0 variable outDir variable interfaces if {[llength $argv] < 2} { puts stderr "usage: $argv0 outDir declFile ?declFile...?" exit 1 } set outDir [lindex $argv 0] foreach file [lrange $argv 1 end] { source $file } foreach name [lsort [array names interfaces]] { puts "Emitting $name" emitHeader $name } emitInits } # lassign -- # # This function emulates the TclX lassign command. # # Arguments: # valueList A list containing the values to be assigned. # args The list of variables to be assigned. # # Results: # Returns any values that were not assigned to variables. proc lassign {valueList args} { if {[llength $args] == 0} { error "wrong # args: lassign list varname ?varname..?" } uplevel [list foreach $args $valueList {break}] return [lrange $valueList [llength $args] end] } genStubs::init tile-0.8.2/win/0000755000076500007650000000000010731273177012651 5ustar joejoe00000000000000tile-0.8.2/win/Tile.dsp0000644000076500007650000001270410025741404014247 0ustar joejoe00000000000000# Microsoft Developer Studio Project File - Name="Tile" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) External Target" 0x0106 CFG=Tile - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "Tile.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "Tile.mak" CFG="Tile - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "Tile - Win32 Release" (based on "Win32 (x86) External Target") !MESSAGE "Tile - Win32 Debug" (based on "Win32 (x86) External Target") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "Tile" # PROP Scc_LocalPath ".." !IF "$(CFG)" == "Tile - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Tile___Win32_Release" # PROP BASE Intermediate_Dir "Tile___Win32_Release" # PROP BASE Cmd_Line "NMAKE /f Tile.mak" # PROP BASE Rebuild_Opt "/a" # PROP BASE Target_File "Tile.exe" # PROP BASE Bsc_Name "Tile.bsc" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Tile___Win32_Release" # PROP Intermediate_Dir "Tile___Win32_Release" # PROP Cmd_Line "nmake -f Makefile.vc INSTALLDIR=c:\opt\tcl TCLDIR=..\..\tcl84 TKDIR=..\..\tk84 OPTS=none all" # PROP Rebuild_Opt "/a" # PROP Target_File "Release/tile01.dll" # PROP Bsc_Name "" # PROP Target_Dir "" !ELSEIF "$(CFG)" == "Tile - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Tile___Win32_Debug" # PROP BASE Intermediate_Dir "Tile___Win32_Debug" # PROP BASE Cmd_Line "NMAKE /f Tile.mak" # PROP BASE Rebuild_Opt "/a" # PROP BASE Target_File "Tile.exe" # PROP BASE Bsc_Name "Tile.bsc" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Tile___Win32_Debug" # PROP Intermediate_Dir "Tile___Win32_Debug" # PROP Cmd_Line "nmake -f Makefile.vc INSTALLDIR=c:\opt\tcl TCLDIR=..\..\tcl TKDIR=..\..\tk OPTS=symbols all" # PROP Rebuild_Opt "/a" # PROP Target_File "Debug/tile01g.dll" # PROP Bsc_Name "" # PROP Target_Dir "" !ENDIF # Begin Target # Name "Tile - Win32 Release" # Name "Tile - Win32 Debug" !IF "$(CFG)" == "Tile - Win32 Release" !ELSEIF "$(CFG)" == "Tile - Win32 Debug" !ENDIF # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\generic\altTheme.c # End Source File # Begin Source File SOURCE=..\generic\button.c # End Source File # Begin Source File SOURCE=..\generic\cache.c # End Source File # Begin Source File SOURCE=..\generic\frame.c # End Source File # Begin Source File SOURCE=..\generic\layout.c # End Source File # Begin Source File SOURCE=.\monitor.c # End Source File # Begin Source File SOURCE=..\generic\notebook.c # End Source File # Begin Source File SOURCE=..\generic\pixmapTheme.c # End Source File # Begin Source File SOURCE=..\generic\scale.c # End Source File # Begin Source File SOURCE=..\generic\scrollbar.c # End Source File # Begin Source File SOURCE=..\generic\stepTheme.c # End Source File # Begin Source File SOURCE=..\generic\tile.c # End Source File # Begin Source File SOURCE=..\generic\tkElements.c # End Source File # Begin Source File SOURCE=..\generic\tkstate.c # End Source File # Begin Source File SOURCE=..\generic\tkTheme.c # End Source File # Begin Source File SOURCE=..\generic\trace.c # End Source File # Begin Source File SOURCE=..\generic\track.c # End Source File # Begin Source File SOURCE=..\generic\widget.c # End Source File # Begin Source File SOURCE=.\winTheme.c # End Source File # Begin Source File SOURCE=.\xpTheme.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=..\generic\compat.h # End Source File # Begin Source File SOURCE=..\generic\gunk.h # End Source File # Begin Source File SOURCE=..\generic\tkTheme.h # End Source File # Begin Source File SOURCE=..\generic\widget.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # Begin Group "library" # PROP Default_Filter ".tcl" # Begin Source File SOURCE=..\library\altTheme.tcl # End Source File # Begin Source File SOURCE=..\library\button.tcl # End Source File # Begin Source File SOURCE=..\library\defaults.tcl # End Source File # Begin Source File SOURCE=..\library\keynav.tcl # End Source File # Begin Source File SOURCE=..\library\menubutton.tcl # End Source File # Begin Source File SOURCE=..\library\notebook.tcl # End Source File # Begin Source File SOURCE=..\library\scale.tcl # End Source File # Begin Source File SOURCE=..\library\scrollbar.tcl # End Source File # Begin Source File SOURCE=..\library\stepTheme.tcl # End Source File # Begin Source File SOURCE=..\library\tile.tcl # End Source File # Begin Source File SOURCE=..\library\winTheme.tcl # End Source File # Begin Source File SOURCE=..\library\xpTheme.tcl # End Source File # End Group # Begin Group "demos" # PROP Default_Filter "*.tcl" # Begin Source File SOURCE=..\demos\demo.tcl # End Source File # End Group # Begin Source File SOURCE=.\makefile.vc # End Source File # Begin Source File SOURCE=..\generic\TODO # End Source File # End Target # End Project tile-0.8.2/win/makefile.vc0000644000076500007650000004142510731266207014762 0ustar joejoe00000000000000# makefile.vc -- -*- Makefile -*- # # Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+) # # This makefile is based upon the Tcl 8.4 Makefile.vc and modified to # make it suitable as a general package makefile. Look for the word EDIT # which marks sections that may need modification. As a minumum you will # need to change the PROJECT, DOTVERSION and DLLOBJS variables to values # relevant to your package. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # Copyright (c) 2001 ActiveState Corporation. # Copyright (c) 2001-2002 David Gravereaux. # Copyright (c) 2003-2006 Pat Thoyts # #------------------------------------------------------------------------- # RCS: @(#)makefile.vc,v 1.61 2007/12/16 18:20:55 jenglish Exp #------------------------------------------------------------------------- !if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCToolkitInstallDir) MSG = ^ You will need to run vcvars32.bat from Developer Studio, first, to setup^ the environment. Jump to this line to read the new instructions. !error $(MSG) !endif #------------------------------------------------------------------------------ # HOW TO USE this makefile: # # 1) It is now necessary to have %MSVCDir% set in the environment. This is # used as a check to see if vcvars32.bat had been run prior to running # nmake or during the installation of Microsoft Visual C++, MSVCDir had # been set globally and the PATH adjusted. Either way is valid. # # You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin # directory to setup the proper environment, if needed, for your current # setup. This is a needed bootstrap requirement and allows the swapping of # different environments to be easier. # # 2) To use the Platform SDK (not expressly needed), run setenv.bat after # vcvars32.bat according to the instructions for it. This can also turn on # the 64-bit compiler, if your SDK has it. # # 3) Targets are: # all -- Builds everything. # -- Builds the project (eg: nmake sample) # test -- Builds and runs the test suite. # install -- Installs the built binaries and libraries to $(INSTALLDIR) # in an appropriate subdirectory. # clean/realclean/distclean -- varying levels of cleaning. # # 4) Macros usable on the commandline: # # INSTALLDIR= # Sets where to install Tcl from the built binaries. # C:\Progra~1\Tcl is assumed when not specified. # # OPTS=static,msvcrt,staticpkg,threads,symbols,profile,loimpact,none # Sets special options for the core. The default is for none. # Any combination of the above may be used (comma separated). # 'none' will over-ride everything to nothing. # # static = Builds a static library of the core instead of a # dll. The shell will be static (and large), as well. # msvcrt = Effects the static option only to switch it from # using libcmt(d) as the C runtime [by default] to # msvcrt(d). This is useful for static embedding # support. # staticpkg = Effects the static option only to switch # tclshXX.exe to have the dde and reg extension linked # inside it. # nothreads = Turns off multithreading support (not recommended) # thrdalloc = Use the thread allocator (shared global free pool). # symbols = Adds symbols for step debugging. # profile = Adds profiling hooks. Map file is assumed. # loimpact = Adds a flag for how NT treats the heap to keep memory # in use, low. This is said to impact alloc performance. # # Package specific options: # nouxtheme = Do not compile in support for WinXP themeing. # nostubs = Link with the Tk library. This is required if building # against Tk < 8.4.6 which doesn't support all the methods # in the stubs table that we need. # square = Include the sample 'square' widget. # # STATS=memdbg,compdbg,none # Sets optional memory and bytecode compiler debugging code added # to the core. The default is for none. Any combination of the # above may be used (comma separated). 'none' will over-ride # everything to nothing. # # memdbg = Enables the debugging memory allocator. # compdbg = Enables byte compilation logging. # # MACHINE=(IX86|IA64|ALPHA) # Set the machine type used for the compiler, linker, and # resource compiler. This hook is needed to tell the tools # when alternate platforms are requested. IX86 is the default # when not specified. # # TMP_DIR= # OUT_DIR= # Hooks to allow the intermediate and output directories to be # changed. $(OUT_DIR) is assumed to be # $(BINROOT)\(Release|Debug) based on if symbols are requested. # $(TMP_DIR) will de $(OUT_DIR)\ by default. # # TESTPAT= # Reads the tests requested to be run from this file. # # CFG_ENCODING=encoding # name of encoding for configuration information. Defaults # to cp1252 # # 5) Examples: # # Basic syntax of calling nmake looks like this: # nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]] # # Standard (no frills) # c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat # Setting environment for using Microsoft Visual C++ tools. # c:\tcl_src\win\>nmake -f makefile.vc all # c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl # # Building for Win64 # c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat # Setting environment for using Microsoft Visual C++ tools. # c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL # Targeting Windows pre64 RETAIL # c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64 # #------------------------------------------------------------------------------ #============================================================================== ############################################################################### #------------------------------------------------------------------------------ !if !exist("makefile.vc") MSG = ^ You must run this makefile only from the directory it is in.^ Please `cd` to its location first. !error $(MSG) !endif #------------------------------------------------------------------------- # Project specific information (EDIT) # # You should edit this with the name and version of your project. This # information is used to generate the name of the package library and # it's install location. # # For example, the sample extension is going to build sample04.dll and # would install it into $(INSTALLDIR)\lib\sample04 # # You need to specify the object files that need to be linked into your # binary here. # #------------------------------------------------------------------------- PROJECT = tile !include "rules.vc" DOTVERSION = 0.8.2 VERSION = $(DOTVERSION:.=) STUBPREFIX = ttkstub DLLOBJS = \ $(TMP_DIR)\tile.obj \ $(TMP_DIR)\ttkStubInit.obj \ $(TMP_DIR)\tkElements.obj \ $(TMP_DIR)\label.obj \ $(TMP_DIR)\layout.obj \ $(TMP_DIR)\separator.obj \ $(TMP_DIR)\frame.obj \ $(TMP_DIR)\button.obj \ $(TMP_DIR)\scrollbar.obj \ $(TMP_DIR)\progress.obj \ $(TMP_DIR)\scale.obj \ $(TMP_DIR)\notebook.obj \ $(TMP_DIR)\paned.obj \ $(TMP_DIR)\entry.obj \ $(TMP_DIR)\treeview.obj \ $(TMP_DIR)\widget.obj \ $(TMP_DIR)\trace.obj \ $(TMP_DIR)\track.obj \ $(TMP_DIR)\blink.obj \ $(TMP_DIR)\scroll.obj \ $(TMP_DIR)\manager.obj \ $(TMP_DIR)\tagset.obj \ $(TMP_DIR)\tkstate.obj \ $(TMP_DIR)\altTheme.obj \ $(TMP_DIR)\classicTheme.obj \ $(TMP_DIR)\tkTheme.obj \ $(TMP_DIR)\cache.obj \ $(TMP_DIR)\clamTheme.obj \ $(TMP_DIR)\image.obj \ $(TMP_DIR)\winTheme.obj \ $(TMP_DIR)\xpTheme.obj \ $(TMP_DIR)\monitor.obj \ $(TMP_DIR)\tile.res PRJSTUBOBJS = $(TMP_DIR)\ttkStubLib.obj # Special make options. !if [nmakehlp -f $(OPTS) "nostubs"] NOSTUBS = 1 !endif #------------------------------------------------------------------------- # Target names and paths ( shouldn't need changing ) #------------------------------------------------------------------------- BINROOT = . ROOT = .. !ifdef NOSTUBS NS =ns TMP_DIR =$(TMP_DIR)_NoStubs OUT_DIR =$(OUT_DIR)_NoStubs !else NS = !endif PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib PRJLIBNAME = $(PROJECT)$(VERSION)$(NS)$(SUFX).$(EXT) PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) PRJSTUBLIBNAME = $(STUBPREFIX).lib PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) PRJHEADERS = $(GENERICDIR)\tkTheme.h ### Make sure we use backslash only. PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR) BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR) DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) DEMO_INSTALL_DIR = $(PRJ_INSTALL_DIR) INCLUDE_INSTALL_DIR = $(_TCLDIR)\include ### The following paths CANNOT have spaces in them. GENERICDIR = $(ROOT)\generic WINDIR = $(ROOT)\win LIBDIR = $(ROOT)\library DOCDIR = $(ROOT)\doc TOOLSDIR = $(ROOT)\tools COMPATDIR = $(ROOT)\compat #--------------------------------------------------------------------- # Compile flags #--------------------------------------------------------------------- !if !$(DEBUG) !if $(OPTIMIZING) ### This cranks the optimization level to maximize speed cdebug = $(OPTIMIZATIONS) !else cdebug = !endif !else if "$(MACHINE)" == "IA64" ### Warnings are too many, can't support warnings into errors. cdebug = -Z7 -Od -GZ !else cdebug = -Z7 -WX -Od -GZ !endif ### Declarations common to all compiler options cflags = -nologo -c -YX -Fp$(TMP_DIR)^\ # Warning level !if $(FULLWARNINGS) cflags = $(cflags) -W4 !else cflags = $(cflags) -W3 !endif !if $(PENT_0F_ERRATA) cflags = $(cflags) -QI0f !endif !if $(ITAN_B_ERRATA) cflags = $(cflags) -QIA64_Bx !endif !if $(MSVCRT) !if $(DEBUG) && !$(UNCHECKED) crt = -MDd !else crt = -MD !endif !else !if $(DEBUG) && !$(UNCHECKED) crt = -MTd !else crt = -MT !endif !endif INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) \ -I"$(WINDIR)" -I"$(GENERICDIR)" BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(INCLUDES) CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE TCL_CFLAGS = -DUSE_TCL_STUBS \ -DVERSION="\"$(DOTVERSION)\"" $(BASE_CFLAGS) $(OPTDEFINES) !ifndef NOSTUBS TCL_CFLAGS = $(TCL_CFLAGS) -DUSE_TK_STUBS !endif !if ![nmakehlp -f $(OPTS) "nouxtheme"] TCL_CFLAGS = $(TCL_CFLAGS) -DHAVE_UXTHEME_H !endif !if [nmakehlp -f $(OPTS) "square"] DLLOBJS = $(DLLOBJS) $(TMP_DIR)\square.obj TCL_CFLAGS = $(TCL_CFLAGS) -DTTK_SQUARE_WIDGET !endif #--------------------------------------------------------------------- # Link flags #--------------------------------------------------------------------- !if $(DEBUG) ldebug = -debug:full -debugtype:cv !else ldebug = -release -opt:ref -opt:icf,3 !endif ### Declarations common to all linker options lflags = -nologo -machine:$(MACHINE) $(ldebug) !if $(PROFILE) lflags = $(lflags) -profile !endif !if $(ALIGN98_HACK) && !$(STATIC_BUILD) ### Align sections for PE size savings. lflags = $(lflags) -opt:nowin98 !else if !$(ALIGN98_HACK) && $(STATIC_BUILD) ### Align sections for speed in loading by choosing the virtual page size. lflags = $(lflags) -align:4096 !endif !if $(LOIMPACT) lflags = $(lflags) -ws:aggressive !endif dlllflags = $(lflags) -dll conlflags = $(lflags) -subsystem:console guilflags = $(lflags) -subsystem:windows !ifdef NOSTUBS baselibs = $(TCLSTUBLIB) $(TKIMPLIB) user32.lib gdi32.lib !else baselibs = $(TCLSTUBLIB) $(TKSTUBLIB) user32.lib gdi32.lib !endif #--------------------------------------------------------------------- # TclTest flags #--------------------------------------------------------------------- !IF "$(TESTPAT)" != "" TESTFLAGS = -file $(TESTPAT) !ENDIF #--------------------------------------------------------------------- # Project specific targets (EDIT) #--------------------------------------------------------------------- all: setup $(PROJECT) $(PROJECT): setup $(PRJLIB) $(PRJSTUBLIB) install: install-binaries install-libraries install-docs install-demos test: setup $(PROJECT) set TILE_LIBRARY=$(ROOT)/library !if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE" $(TCLSH) << package require Tk set env(TILE_LIBRARY) [file normalize [file join $(ROOT) library]] load [file join [file normalize {$(OUT_DIR)}] $(PRJLIBNAME)] Tile set argv $(TESTFLAGS) source [file normalize [file join $(ROOT) tests all.tcl]] << !else @echo Please wait while the tests are collected... $(TCLSH) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) > tests.log type tests.log | more !endif demo: setup $(PROJECT) $(WISH) << set env(TILE_LIBRARY) [file normalize [file join $(ROOT) library]] load [file join [file normalize {$(OUT_DIR)}] $(PRJLIBNAME)] Tile source [file join [file normalize {$(ROOT)}] demos demo.tcl] << shell: setup $(PROJECT) $(WISH) << set env(TILE_LIBRARY) [file normalize [file join $(ROOT) library]] load [file join [file normalize {$(OUT_DIR)}] $(PRJLIBNAME)] Tile console show << setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) $(PRJLIB): $(DLLOBJS) $(link32) $(dlllflags) -out:$@ $(baselibs) @<< $** << -@del $*.exp $(PRJSTUBLIB): $(PRJSTUBOBJS) $(lib32) -nologo -out:$@ $(PRJSTUBOBJS) #--------------------------------------------------------------------- # Implicit rules #--------------------------------------------------------------------- {$(WINDIR)}.c{$(TMP_DIR)}.obj:: $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<< $< << {$(GENERICDIR)}.c{$(TMP_DIR)}.obj:: $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<< $< << {$(COMPATDIR)}.c{$(TMP_DIR)}.obj:: $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<< $< << {$(WINDIR)}.rc{$(TMP_DIR)}.res: $(rc32) -fo $@ -r -i "$(GENERICDIR)" -D__WIN32__ \ -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ -DDOTVERSION=\"$(DOTVERSION)\" \ -DVERSION=\"$(VERSION)$(SUFX)\" \ !if $(DEBUG) -d DEBUG \ !endif !if $(TCL_THREADS) -d TCL_THREADS \ !endif !if $(STATIC_BUILD) -d STATIC_BUILD \ !endif $< .SUFFIXES: .SUFFIXES:.c .rc #--------------------------------------------------------------------- # Installation. (EDIT) # # You may need to modify this section to reflect the final distribution # of your files and possibly to generate documentation. # #--------------------------------------------------------------------- install-binaries: @echo Installing binaries to '$(SCRIPT_INSTALL_DIR)' @if not exist "$(SCRIPT_INSTALL_DIR)\" mkdir "$(SCRIPT_INSTALL_DIR)" #" @$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" > NUL @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" > NUL @$(CPY) $(PRJHEADERS) "$(SCRIPT_INSTALL_DIR)" > NUL install-libraries: @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)' @if exist $(LIBDIR)\nul $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)" >NUL @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' @type << >"$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl" # This package is built with Tk stubs for 8.4.6+ but we also provide a version # for that is linked to tk84.dll for Tk 8.4.0-8.4.5. # The package cannot be used with Tk < 8.4 # if {![package vsatisfies [package provide Tcl] 8.4]} {return} if {[package vsatisfies [package provide Tcl] 8.5] || [package vsatisfies [info patchlevel] 8.4.6]} { package ifneeded $(PROJECT) $(DOTVERSION) \ "namespace eval tile { variable library [list $$dir] };\ load \[file join [list $$dir] $(PROJECT)$(VERSION).$(EXT)\]" } else { package ifneeded $(PROJECT) $(DOTVERSION) \ "namespace eval tile { variable library [list $$dir] };\ load \[file join [list $$dir] $(PROJECT)$(VERSION)ns.$(EXT)\]" } << install-docs: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if exist $(ROOT)\README.txt $(CPY) "$(ROOT)\README.txt" "$(SCRIPT_INSTALL_DIR)" >NUL @if exist $(ROOT)\license.terms $(CPY) "$(ROOT)\license.terms" "$(SCRIPT_INSTALL_DIR)" >NUL install-demos: @echo Installing sample applications in '$(DEMO_INSTALL_DIR)\demos' @if not exist "$(DEMO_INSTALL_DIR)\demos" mkdir "$(DEMO_INSTALL_DIR)\demos" @$(CPY) "$(ROOT)\demos" "$(DEMO_INSTALL_DIR)\demos" >NUL @if not exist "$(DEMO_INSTALL_DIR)\demos\themes" mkdir "$(DEMO_INSTALL_DIR)\demos\themes" @$(CPY) "$(ROOT)\demos\themes" "$(DEMO_INSTALL_DIR)\demos\themes" >NUL @if not exist "$(DEMO_INSTALL_DIR)\demos\themes\blue" mkdir "$(DEMO_INSTALL_DIR)\demos\themes\blue" @$(CPY) "$(ROOT)\demos\themes\blue" "$(DEMO_INSTALL_DIR)\demos\themes\blue" >NUL #--------------------------------------------------------------------- # Clean up #--------------------------------------------------------------------- clean: @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) @if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc realclean: clean @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) distclean: realclean @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj tile-0.8.2/win/monitor.c0000644000076500007650000001063410530131000014457 0ustar joejoe00000000000000/* monitor.c,v 1.17 2006/11/19 19:35:28 jenglish Exp */ #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN #endif #include #include #include #include #include "tkTheme.h" #if !defined(WM_THEMECHANGED) #define WM_THEMECHANGED 0x031A #endif static LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); /* * RegisterSystemColors -- * Register all known Windows system colors (as per GetSysColor) * as Tk named colors. */ typedef struct { const char *name; int index; } SystemColorEntry; static SystemColorEntry sysColors[] = { { "System3dDarkShadow", COLOR_3DDKSHADOW }, { "System3dLight", COLOR_3DLIGHT }, { "SystemActiveBorder", COLOR_ACTIVEBORDER }, { "SystemActiveCaption", COLOR_ACTIVECAPTION }, { "SystemAppWorkspace", COLOR_APPWORKSPACE }, { "SystemBackground", COLOR_BACKGROUND }, { "SystemButtonFace", COLOR_BTNFACE }, { "SystemButtonHighlight", COLOR_BTNHIGHLIGHT }, { "SystemButtonShadow", COLOR_BTNSHADOW }, { "SystemButtonText", COLOR_BTNTEXT }, { "SystemCaptionText", COLOR_CAPTIONTEXT }, { "SystemDisabledText", COLOR_GRAYTEXT }, { "SystemGrayText", COLOR_GRAYTEXT }, { "SystemHighlight", COLOR_HIGHLIGHT }, { "SystemHighlightText", COLOR_HIGHLIGHTTEXT }, { "SystemInactiveBorder", COLOR_INACTIVEBORDER }, { "SystemInactiveCaption", COLOR_INACTIVECAPTION }, { "SystemInactiveCaptionText", COLOR_INACTIVECAPTIONTEXT }, { "SystemInfoBackground", COLOR_INFOBK }, { "SystemInfoText", COLOR_INFOTEXT }, { "SystemMenu", COLOR_MENU }, { "SystemMenuText", COLOR_MENUTEXT }, { "SystemScrollbar", COLOR_SCROLLBAR }, { "SystemWindow", COLOR_WINDOW }, { "SystemWindowFrame", COLOR_WINDOWFRAME }, { "SystemWindowText", COLOR_WINDOWTEXT }, { NULL, 0 } }; static void RegisterSystemColors(Tcl_Interp *interp) { Ttk_ResourceCache cache = Ttk_GetResourceCache(interp); SystemColorEntry *sysColor; for (sysColor = sysColors; sysColor->name; ++sysColor) { DWORD pixel = GetSysColor(sysColor->index); XColor colorSpec; colorSpec.red = GetRValue(pixel) * 257; colorSpec.green = GetGValue(pixel) * 257; colorSpec.blue = GetBValue(pixel) * 257; Ttk_RegisterNamedColor(cache, sysColor->name, &colorSpec); } } static HWND CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp) { WNDCLASSEX wc; HWND hwnd = NULL; CHAR title[32] = "TtkMonitorWindow"; CHAR name[32] = "TtkMonitorClass"; wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hinst; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)COLOR_WINDOW; wc.lpszMenuName = name; wc.lpszClassName = name; if (RegisterClassEx(&wc)) { hwnd = CreateWindow( name, title, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hinst, NULL ); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG)interp); ShowWindow(hwnd, SW_HIDE); UpdateWindow(hwnd); } return hwnd; } static void DestroyThemeMonitorWindow(void *clientData) { HWND hwnd = (HWND)clientData; DestroyWindow(hwnd); } static LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { Tcl_Interp *interp = (Tcl_Interp *)GetWindowLongPtr(hwnd, GWLP_USERDATA); Ttk_Theme theme; switch (msg) { case WM_DESTROY: break; case WM_SYSCOLORCHANGE: RegisterSystemColors(interp); break; case WM_THEMECHANGED: /* * Reset the application theme to 'xpnative' if present, * which will in turn fall back to 'winnative' if XP theming * is disabled. */ theme = Ttk_GetTheme(interp, "xpnative"); if (theme) { Ttk_UseTheme(interp, theme); /* @@@ What to do about errors here? */ } break; } return DefWindowProc(hwnd, msg, wp, lp); } /* * Windows-specific platform initialization: */ extern int TtkWinTheme_Init(Tcl_Interp *, HWND hwnd); extern int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd); int Ttk_WinPlatformInit(Tcl_Interp *interp) { HWND hwnd; hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp); Ttk_RegisterCleanup(interp, (ClientData)hwnd, DestroyThemeMonitorWindow); TtkWinTheme_Init(interp, hwnd); TtkXPTheme_Init(interp, hwnd); return TCL_OK; } tile-0.8.2/win/nmakehlp.c0000644000076500007650000003041710455014732014612 0ustar joejoe00000000000000/* ---------------------------------------------------------------------------- * nmakehlp.c -- * * This is used to fix limitations within nmake and the environment. * * Copyright (c) 2002 by David Gravereaux. * Copyright (c) 2003 by Patrick Thoyts * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * ---------------------------------------------------------------------------- * RCS: @(#) nmakehlp.c,v 1.2 2006/07/11 21:36:26 patthoyts Exp * ---------------------------------------------------------------------------- */ #define _CRT_SECURE_NO_DEPRECATE #include #pragma comment (lib, "user32.lib") #pragma comment (lib, "kernel32.lib") #include /* protos */ int CheckForCompilerFeature(const char *option); int CheckForLinkerFeature(const char *option); int IsIn(const char *string, const char *substring); int GetVersionFromHeader(const char *tclh, const char *tkh); DWORD WINAPI ReadFromPipe(LPVOID args); /* globals */ #define CHUNK 25 #define STATICBUFFERSIZE 1000 typedef struct { HANDLE pipe; char buffer[STATICBUFFERSIZE]; } pipeinfo; pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'}; pipeinfo Err = {INVALID_HANDLE_VALUE, '\0'}; /* * exitcodes: 0 == no, 1 == yes, 2 == error */ int main (int argc, char *argv[]) { char msg[300]; DWORD dwWritten; int chars; /* * Make sure children (cl.exe and link.exe) are kept quiet. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); /* * Make sure the compiler and linker aren't effected by the outside world. */ SetEnvironmentVariable("CL", ""); SetEnvironmentVariable("LINK", ""); if (argc > 1 && *argv[1] == '-') { switch (*(argv[1]+1)) { case 'c': if (argc != 3) { chars = wsprintf(msg, "usage: %s -c \n" "Tests for whether cl.exe supports an option\n" "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } return CheckForCompilerFeature(argv[2]); case 'l': if (argc != 3) { chars = wsprintf(msg, "usage: %s -l \n" "Tests for whether link.exe supports an option\n" "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } return CheckForLinkerFeature(argv[2]); case 'f': if (argc == 2) { chars = wsprintf(msg, "usage: %s -f \n" "Find a substring within another\n" "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } else if (argc == 3) { /* * If the string is blank, there is no match. */ return 0; } else { return IsIn(argv[2], argv[3]); } case 'v': if (argc != 4) { chars = wsprintf(msg, "usage: %s -v \n" "Search for versions from the tcl and tk headers.", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 0; } return GetVersionFromHeader(argv[2], argv[3]); } } chars = wsprintf(msg, "usage: %s -c|-l|-f ...\n" "This is a little helper app to equalize shell differences between WinNT and\n" "Win9x and get nmake.exe to accomplish its job.\n", argv[0]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } int CheckForCompilerFeature( const char *option) { STARTUPINFO si; PROCESS_INFORMATION pi; SECURITY_ATTRIBUTES sa; DWORD threadID; char msg[300]; BOOL ok; HANDLE hProcess, h, pipeThreads[2]; char cmdline[100]; hProcess = GetCurrentProcess(); ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); ZeroMemory(&si, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESTDHANDLES; si.hStdInput = INVALID_HANDLE_VALUE; ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES)); sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = FALSE; /* * Create a non-inheritible pipe. */ CreatePipe(&Out.pipe, &h, &sa, 0); /* * Dupe the write side, make it inheritible, and close the original. */ DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); /* * Same as above, but for the error side. */ CreatePipe(&Err.pipe, &h, &sa, 0); DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); /* * Base command line. */ strcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X "); /* * Append our option for testing */ strcat(cmdline, option); /* * Filename to compile, which exists, but is nothing and empty. */ strcat(cmdline, " .\\nul"); ok = CreateProcess( NULL, /* Module name. */ cmdline, /* Command line. */ NULL, /* Process handle not inheritable. */ NULL, /* Thread handle not inheritable. */ TRUE, /* yes, inherit handles. */ DETACHED_PROCESS, /* No console for you. */ NULL, /* Use parent's environment block. */ NULL, /* Use parent's starting directory. */ &si, /* Pointer to STARTUPINFO structure. */ &pi); /* Pointer to PROCESS_INFORMATION structure. */ if (!ok) { DWORD err = GetLastError(); int chars = wsprintf(msg, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], (300-chars), 0); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err,NULL); return 2; } /* * Close our references to the write handles that have now been inherited. */ CloseHandle(si.hStdOutput); CloseHandle(si.hStdError); WaitForInputIdle(pi.hProcess, 5000); CloseHandle(pi.hThread); /* * Start the pipe reader threads. */ pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID); pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID); /* * Block waiting for the process to end. */ WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hProcess); /* * Wait for our pipe to get done reading, should it be a little slow. */ WaitForMultipleObjects(2, pipeThreads, TRUE, 500); CloseHandle(pipeThreads[0]); CloseHandle(pipeThreads[1]); #ifdef _DEBUG { DWORD err = 0; WriteFile(GetStdHandle(STD_ERROR_HANDLE), Out.buffer, strlen(Out.buffer), &err,NULL); WriteFile(GetStdHandle(STD_ERROR_HANDLE), Err.buffer, strlen(Out.buffer), &err,NULL); } #endif /* * Look for the commandline warning code in both streams. * - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002. */ return !(strstr(Out.buffer, "D4002") != NULL || strstr(Err.buffer, "D4002") != NULL || strstr(Out.buffer, "D9002") != NULL || strstr(Err.buffer, "D9002") != NULL); } int CheckForLinkerFeature( const char *option) { STARTUPINFO si; PROCESS_INFORMATION pi; SECURITY_ATTRIBUTES sa; DWORD threadID; char msg[300]; BOOL ok; HANDLE hProcess, h, pipeThreads[2]; char cmdline[100]; hProcess = GetCurrentProcess(); ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); ZeroMemory(&si, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESTDHANDLES; si.hStdInput = INVALID_HANDLE_VALUE; ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES)); sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; /* * Create a non-inheritible pipe. */ CreatePipe(&Out.pipe, &h, &sa, 0); /* * Dupe the write side, make it inheritible, and close the original. */ DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); /* * Same as above, but for the error side. */ CreatePipe(&Err.pipe, &h, &sa, 0); DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); /* * Base command line. */ strcpy(cmdline, "link.exe -nologo "); /* * Append our option for testing. */ strcat(cmdline, option); ok = CreateProcess( NULL, /* Module name. */ cmdline, /* Command line. */ NULL, /* Process handle not inheritable. */ NULL, /* Thread handle not inheritable. */ TRUE, /* yes, inherit handles. */ DETACHED_PROCESS, /* No console for you. */ NULL, /* Use parent's environment block. */ NULL, /* Use parent's starting directory. */ &si, /* Pointer to STARTUPINFO structure. */ &pi); /* Pointer to PROCESS_INFORMATION structure. */ if (!ok) { DWORD err = GetLastError(); int chars = wsprintf(msg, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], (300-chars), 0); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err,NULL); return 2; } /* * Close our references to the write handles that have now been inherited. */ CloseHandle(si.hStdOutput); CloseHandle(si.hStdError); WaitForInputIdle(pi.hProcess, 5000); CloseHandle(pi.hThread); /* * Start the pipe reader threads. */ pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID); pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID); /* * Block waiting for the process to end. */ WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hProcess); /* * Wait for our pipe to get done reading, should it be a little slow. */ WaitForMultipleObjects(2, pipeThreads, TRUE, 500); CloseHandle(pipeThreads[0]); CloseHandle(pipeThreads[1]); /* * Look for the commandline warning code in the stderr stream. */ return !(strstr(Out.buffer, "LNK1117") != NULL || strstr(Err.buffer, "LNK1117") != NULL); } #if USE_DG_CODE DWORD WINAPI ReadFromPipe( LPVOID args) { pipeinfo *pi = (pipeinfo *) args; char *lastBuf = pi->buffer; DWORD dwRead; BOOL ok; again: if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) { CloseHandle(pi->pipe); return -1; } ok = ReadFile(pi->pipe, lastBuf, CHUNK, &dwRead, 0L); if (!ok || dwRead == 0) { CloseHandle(pi->pipe); return 0; } lastBuf += dwRead; goto again; return 0; /* makes the compiler happy */ } #else DWORD WINAPI ReadFromPipe (LPVOID args) { pipeinfo *pi = (pipeinfo *) args; char *lastBuf = pi->buffer; DWORD dwRead; BOOL ok; again: ok = ReadFile(pi->pipe, lastBuf, 25, &dwRead, 0L); if (!ok || dwRead == 0) { CloseHandle(pi->pipe); return 0; } lastBuf += dwRead; goto again; return 0; /* makes the compiler happy */ } #endif int IsIn (const char *string, const char *substring) { return (strstr(string, substring) != NULL); } static double ReadVersionFromHeader(const char *file, const char *macro) { double d = 0.0; CHAR szBuffer[100]; LPSTR p; DWORD cbBuffer = 100; FILE *fp = fopen(file, "r"); if (fp != NULL) { while (fgets(szBuffer, cbBuffer, fp) != NULL) { if ((p = strstr(szBuffer, macro)) != NULL) { while (*p && !isdigit(*p)) ++p; d = strtod(p, NULL); break; } } fclose(fp); } return d; } int GetVersionFromHeader(const char *tclh, const char *tkh) { double dTcl = 0.0, dTk = 0.0; if (tclh != NULL) dTcl = ReadVersionFromHeader(tclh, "TCL_VERSION"); if (tkh != NULL) dTk = ReadVersionFromHeader(tkh, "TK_VERSION"); if (dTcl > 0 || dTk > 0) { FILE *ofp = fopen("version.vc", "w"); if (dTcl > 0) fprintf(ofp, "TCL_DOTVERSION\t= %0.1f\nTCL_VERSION\t= %u\n", dTcl, (int)(dTcl * 10.0)); if (dTk > 0) fprintf(ofp, "TK_DOTVERSION\t= %0.1f\nTK_VERSION\t= %u\n", dTk, (int)(dTk * 10.0)); fclose(ofp); return 0; } return 1; } tile-0.8.2/win/rules.vc0000644000076500007650000003007410455014732014332 0ustar joejoe00000000000000#------------------------------------------------------------------------------ # rules.vc -- # # Microsoft Visual C++ makefile include for decoding the commandline # macros. This file does not need editing to build Tcl. # # This version is modified from the Tcl source version to support # building extensions using nmake. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 2001-2002 David Gravereaux. # Copyright (c) 2003-2005 Patrick Thoyts # #------------------------------------------------------------------------------ # RCS: @(#) rules.vc,v 1.3 2006/07/11 21:36:26 patthoyts Exp #------------------------------------------------------------------------------ !ifndef _RULES_VC _RULES_VC = 1 cc32 = $(CC) # built-in default. link32 = link lib32 = lib rc32 = $(RC) # built-in default. !ifndef INSTALLDIR ### Assume the normal default. _INSTALLDIR = C:\Program Files\Tcl !else ### Fix the path separators. _INSTALLDIR = $(INSTALLDIR:/=\) !endif !ifndef MACHINE MACHINE = IX86 !endif !ifndef CFG_ENCODING CFG_ENCODING = \"cp1252\" !endif #---------------------------------------------------------- # Set the proper copy method to avoid overwrite questions # to the user when copying files and selecting the right # "delete all" method. #---------------------------------------------------------- !if "$(OS)" == "Windows_NT" RMDIR = rmdir /S /Q !if ![ver | find "4.0" > nul] CPY = echo y | xcopy /i !else CPY = xcopy /i /y !endif !else CPY = xcopy /i RMDIR = deltree /Y !endif !message =============================================================================== #---------------------------------------------------------- # build the helper app we need to overcome nmake's limiting # environment. #---------------------------------------------------------- !if !exist(nmakehlp.exe) !if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul] !endif !endif #---------------------------------------------------------- # Test for compiler features #---------------------------------------------------------- ### test for optimizations !if [nmakehlp -c -Oti] !message *** Compiler has 'Optimizations' OPTIMIZING = 1 !else !message *** Compiler doesn't have 'Optimizations' OPTIMIZING = 0 !endif OPTIMIZATIONS = !if [nmakehlp -c -O2] OPTIMIZATIONS = $(OPTIMIZATIONS) -O2 !endif !if [nmakehlp -c -Op] OPTIMIZATIONS = $(OPTIMIZATIONS) -Op !endif !if [nmakehlp -c -fp:strict] OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:strict !endif !if [nmakehlp -c -Gs] OPTIMIZATIONS = $(OPTIMIZATIONS) -Gs !endif !if [nmakehlp -c -GS] OPTIMIZATIONS = $(OPTIMIZATIONS) -GS !endif !if "$(MACHINE)" == "IX86" ### test for pentium errata !if [nmakehlp -c -QI0f] !message *** Compiler has 'Pentium 0x0f fix' PENT_0F_ERRATA = 1 !else !message *** Compiler doesn't have 'Pentium 0x0f fix' PENT_0F_ERRATA = 0 !endif ### test for -align:4096, when align:512 will do. !if [nmakehlp -l -opt:nowin98] !message *** Linker has 'Win98 alignment problem' ALIGN98_HACK = 1 !else !message *** Linker doesn't have 'Win98 alignment problem' ALIGN98_HACK = 0 !endif !else PENT_0F_ERRATA = 0 ALIGN98_HACK = 0 !endif !if "$(MACHINE)" == "IA64" ### test for Itanium errata !if [nmakehlp -c -QIA64_Bx] !message *** Compiler has 'B-stepping errata workarounds' ITAN_B_ERRATA = 1 !else !message *** Compiler doesn't have 'B-stepping errata workarounds' ITAN_B_ERRATA = 0 !endif !else ITAN_B_ERRATA = 0 !endif #---------------------------------------------------------- # Decode the options requested. #---------------------------------------------------------- !if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"] STATIC_BUILD = 0 TCL_THREADS = 1 DEBUG = 0 PROFILE = 0 MSVCRT = 0 LOIMPACT = 0 TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 USE_THREAD_STORAGE = 1 UNCHECKED = 0 !else !if [nmakehlp -f $(OPTS) "static"] !message *** Doing static STATIC_BUILD = 1 !else STATIC_BUILD = 0 !endif !if [nmakehlp -f $(OPTS) "msvcrt"] !message *** Doing msvcrt MSVCRT = 1 !else MSVCRT = 0 !endif !if [nmakehlp -f $(OPTS) "staticpkg"] !message *** Doing staticpkg TCL_USE_STATIC_PACKAGES = 1 !else TCL_USE_STATIC_PACKAGES = 0 !endif !if [nmakehlp -f $(OPTS) "nothreads"] !message *** Compile explicitly for non-threaded tcl TCL_THREADS = 0 !else TCL_THREADS = 1 !endif !if [nmakehlp -f $(OPTS) "symbols"] !message *** Doing symbols DEBUG = 1 !else DEBUG = 0 !endif !if [nmakehlp -f $(OPTS) "profile"] !message *** Doing profile PROFILE = 1 !else PROFILE = 0 !endif !if [nmakehlp -f $(OPTS) "loimpact"] !message *** Doing loimpact LOIMPACT = 1 !else LOIMPACT = 0 !endif !if [nmakehlp -f $(OPTS) "thrdalloc"] !message *** Doing thrdalloc USE_THREAD_ALLOC = 1 !else USE_THREAD_ALLOC = 0 !endif !if [nmakehlp -f $(OPTS) "thrdstorage"] !message *** Doing thrdstorage USE_THREAD_STORAGE = 1 !else USE_THREAD_STORAGE = 0 !endif !if [nmakehlp -f $(OPTS) "unchecked"] !message *** Doing unchecked UNCHECKED = 1 !else UNCHECKED = 0 !endif !endif !if !$(STATIC_BUILD) # Make sure we don't build overly fat DLLs. MSVCRT = 1 # We shouldn't statically put the extensions inside the shell when dynamic. TCL_USE_STATIC_PACKAGES = 0 !endif #---------------------------------------------------------- # Figure-out how to name our intermediate and output directories. # We wouldn't want different builds to use the same .obj files # by accident. #---------------------------------------------------------- #---------------------------------------- # Naming convention: # t = full thread support. # s = static library (as opposed to an # import library) # g = linked to the debug enabled C # run-time. # x = special static build when it # links to the dynamic C run-time. #---------------------------------------- SUFX = sgx !if $(DEBUG) BUILDDIRTOP = Debug !else BUILDDIRTOP = Release !endif !if !$(DEBUG) || $(DEBUG) && $(UNCHECKED) SUFX = $(SUFX:g=) !endif TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX !if !$(STATIC_BUILD) TMP_DIRFULL = $(TMP_DIRFULL:Static=) SUFX = $(SUFX:s=) EXT = dll !if $(MSVCRT) TMP_DIRFULL = $(TMP_DIRFULL:X=) SUFX = $(SUFX:x=) !endif !else TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=) EXT = lib !if !$(MSVCRT) TMP_DIRFULL = $(TMP_DIRFULL:X=) SUFX = $(SUFX:x=) !endif !endif !if !$(TCL_THREADS) TMP_DIRFULL = $(TMP_DIRFULL:Threaded=) SUFX = $(SUFX:t=) !endif !ifndef TMP_DIR TMP_DIR = $(TMP_DIRFULL) !ifndef OUT_DIR OUT_DIR = .\$(BUILDDIRTOP) !endif !else !ifndef OUT_DIR OUT_DIR = $(TMP_DIR) !endif !endif #---------------------------------------------------------- # Decode the statistics requested. #---------------------------------------------------------- !if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"] TCL_MEM_DEBUG = 0 TCL_COMPILE_DEBUG = 0 !else !if [nmakehlp -f $(STATS) "memdbg"] !message *** Doing memdbg TCL_MEM_DEBUG = 1 !else TCL_MEM_DEBUG = 0 !endif !if [nmakehlp -f $(STATS) "compdbg"] !message *** Doing compdbg TCL_COMPILE_DEBUG = 1 !else TCL_COMPILE_DEBUG = 0 !endif !endif #---------------------------------------------------------- # Decode the checks requested. #---------------------------------------------------------- !if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"] TCL_NO_DEPRECATED = 0 FULLWARNINGS = 0 !else !if [nmakehlp -f $(CHECKS) "nodep"] !message *** Doing nodep check TCL_NO_DEPRECATED = 1 !else TCL_NO_DEPRECATED = 0 !endif !if [nmakehlp -f $(CHECKS) "fullwarn"] !message *** Doing full warnings check FULLWARNINGS = 1 !else FULLWARNINGS = 0 !endif !endif #---------------------------------------------------------- # Set our defines now armed with our options. #---------------------------------------------------------- OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) !if $(TCL_MEM_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !endif !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS !endif !if $(TCL_THREADS) OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 !if $(USE_THREAD_ALLOC) OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 !endif !if $(USE_THREAD_STORAGE) OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_STORAGE=1 !endif !endif !if $(STATIC_BUILD) OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD !endif !if $(TCL_NO_DEPRECATED) OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED !endif !if $(DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DEBUG !elseif $(OPTIMIZING) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED !endif !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED !endif !if "$(MACHINE)" == "IA64" OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !endif #---------------------------------------------------------- # Get common info used when building extensions. #---------------------------------------------------------- !if "$(PROJECT)" != "tcl" # If INSTALLDIR set to tcl root dir then reset to the lib dir. !if exist("$(_INSTALLDIR)\include\tcl.h") _INSTALLDIR=$(_INSTALLDIR)\lib !endif !if !defined(TCLDIR) !if exist("$(_INSTALLDIR)\..\include\tcl.h") TCLINSTALL = 1 _TCLDIR = $(_INSTALLDIR)\.. _TCL_H = $(_INSTALLDIR)\..\include\tcl.h TCLDIR = $(_INSTALLDIR)\.. !else MSG=^ Failed to find tcl.h. Set the TCLDIR macro. !error $(MSG) !endif !else _TCLDIR = $(TCLDIR:/=\) !if exist("$(_TCLDIR)\include\tcl.h") TCLINSTALL = 1 _TCL_H = $(_TCLDIR)\include\tcl.h !elseif exist("$(_TCLDIR)\generic\tcl.h") TCLINSTALL = 0 _TCL_H = $(_TCLDIR)\generic\tcl.h !else MSG =^ Failed to find tcl.h. The TCLDIR macro does not appear correct. !error $(MSG) !endif !endif !if [nmakehlp -v "$(_TCL_H)" ""] == 0 !include version.vc !else TCL_DOTVERSION = 8.5 TCL_VERSION = $(TCL_DOTVERSION:.=) !endif !if $(TCLINSTALL) TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" TCLSTUBLIB = "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib" TCLIMPLIB = "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib" TCL_LIBRARY = $(_TCLDIR)\lib TCL_INCLUDES = -I"$(_TCLDIR)\include" !else TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe" TCLSTUBLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib" TCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib" TCL_LIBRARY = $(_TCLDIR)\library TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" !endif !endif #---------------------------------------------------------- # Get Tk info for building extensions. #---------------------------------------------------------- !if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" !if !defined(TKDIR) !if exist("$(_INSTALLDIR)\..\include\tk.h") TKINSTALL = 1 _TKDIR = $(_INSTALLDIR)\.. _TK_H = $(_TKDIR)\include\tk.h TKDIR = $(_TKDIR) !elseif exist("$(_TCLDIR)\include\tk.h") TKINSTALL = 1 _TKDIR = $(_TCLDIR) _TK_H = $(_TKDIR)\include\tk.h TKDIR = $(_TKDIR) !else MSG =^ Failed to find tk.h. Set the TKDIR macro. !error $(MSG) !endif !else _TKDIR = $(TKDIR:/=\) !if exist("$(_TKDIR)\include\tk.h") TKINSTALL = 1 _TK_H = $(_TKDIR)\include\tk.h !elseif exist("$(_TKDIR)\generic\tk.h") TKINSTALL = 0 _TK_H = $(_TKDIR)\generic\tk.h !else MSG =^ Failed to find tk.h. The TKDIR macro does not appear correct. !error $(MSG) !endif !endif !if [nmakehlp -v "$(_TCL_H)" "$(_TK_H)"] == 0 !include version.vc !else TK_DOTVERSION = 8.5 TK_VERSION = $(TK_DOTVERSION:.=) !endif !if $(TKINSTALL) WISH = "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe" TKSTUBLIB = "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib" TKIMPLIB = "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib" TK_INCLUDES = -I"$(_TKDIR)\include" !else WISH = "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe" TKSTUBLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib" TKIMPLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib" TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif !endif #---------------------------------------------------------- # Display stats being used. #---------------------------------------------------------- !message *** Intermediate directory will be '$(TMP_DIR)' !message *** Output directory will be '$(OUT_DIR)' !message *** Suffix for binaries will be '$(SUFX)' !message *** Optional defines are '$(OPTDEFINES)' !endif tile-0.8.2/win/tile.rc0000644000076500007650000000206410507527404014132 0ustar joejoe00000000000000// RCS: @(#) tile.rc,v 1.3 2006/09/30 17:53:08 jenglish Exp // // Version Resource Script // #include LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ VS_VERSION_INFO VERSIONINFO FILEVERSION COMMAVERSION PRODUCTVERSION COMMAVERSION FILEFLAGSMASK 0x3fL #ifdef DEBUG FILEFLAGS VS_FF_DEBUG #else FILEFLAGS 0x0L #endif FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" /* LANG_ENGLISH/SUBLANG_ENGLISH_US, Unicode CP */ BEGIN VALUE "FileDescription", "Tile " DOTVERSION " Tk theme extension\0" VALUE "OriginalFilename", "tile" VERSION ".dll\0" VALUE "FileVersion", DOTVERSION "\0" VALUE "LegalCopyright", "Copyright \251 2003 Joe English and other parties\0" VALUE "ProductName", "Tile " DOTVERSION " Tk theme extension\0" VALUE "ProductVersion", DOTVERSION "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END tile-0.8.2/win/winTheme.c0000644000076500007650000005126110724432727014602 0ustar joejoe00000000000000/* winTheme.c - Copyright (C) 2004 Pat Thoyts * * winTheme.c,v 1.41 2007/12/02 04:34:31 jenglish Exp */ #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN #endif #include #include #ifdef NO_PRIVATE_HEADERS #include #include "gunk.h" #else #include #endif #ifndef DFCS_HOT /* Windows 98/Me, Windows 200/XP only */ #define DFCS_HOT 0 #endif #include "tkTheme.h" /* * BoxToRect -- * Helper routine. Converts a Ttk_Box to a Win32 RECT. */ static RECT BoxToRect(Ttk_Box b) { RECT rc; rc.top = b.y; rc.left = b.x; rc.bottom = b.y + b.height; rc.right = b.x + b.width; return rc; } /* * ReliefToEdge -- * Convert a Tk "relief" value into an Windows "edge" value. * NB: Caller must check for RELIEF_FLAT and RELIEF_SOLID, * which must be handled specially. * * Passing the BF_FLAT flag to DrawEdge() yields something similar * to TK_RELIEF_SOLID. TK_RELIEF_FLAT can be implemented by not * drawing anything. */ static unsigned int ReliefToEdge(int relief) { switch (relief) { case TK_RELIEF_RAISED: return EDGE_RAISED; case TK_RELIEF_SUNKEN: return EDGE_SUNKEN; case TK_RELIEF_RIDGE: return EDGE_BUMP; case TK_RELIEF_GROOVE: return EDGE_ETCHED; case TK_RELIEF_SOLID: return BDR_RAISEDOUTER; default: case TK_RELIEF_FLAT: return BDR_RAISEDOUTER; } } /* ---------------------------------------------------------------------- */ static Ttk_StateTable checkbutton_statemap[] = { { DFCS_CHECKED|DFCS_INACTIVE, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0 }, { DFCS_CHECKED|DFCS_PUSHED, TTK_STATE_SELECTED|TTK_STATE_PRESSED, 0 }, { DFCS_CHECKED, TTK_STATE_SELECTED, 0 }, { DFCS_INACTIVE, TTK_STATE_DISABLED, TTK_STATE_SELECTED }, { DFCS_PUSHED, TTK_STATE_PRESSED, TTK_STATE_SELECTED}, { 0, 0, 0 } }; static Ttk_StateTable pushbutton_statemap[] = { { DFCS_INACTIVE, TTK_STATE_DISABLED, 0 }, { DFCS_PUSHED, TTK_STATE_PRESSED, 0 }, { DFCS_HOT, TTK_STATE_ACTIVE, 0 }, { 0, 0, 0 } }; static Ttk_StateTable arrow_statemap[] = { { DFCS_INACTIVE, TTK_STATE_DISABLED, 0 }, { DFCS_PUSHED | DFCS_FLAT, TTK_STATE_PRESSED, 0 }, { 0, 0, 0 } }; /*------------------------------------------------------------------------ * +++ FrameControlElement -- * General-purpose element for things drawn with DrawFrameControl */ typedef struct { const char *name; /* element name */ int classId; /* class id for DrawFrameControl */ int partId; /* part id for DrawFrameControl */ int cxId; /* system metric id for size in x */ int cyId; /* system metric id for size in y */ Ttk_StateTable *stateMap; /* map Tk states to Win32 flags */ Ttk_Padding margins; /* additional placement padding */ } FrameControlElementData; static FrameControlElementData FrameControlElements[] = { { "Checkbutton.indicator", DFC_BUTTON, DFCS_BUTTONCHECK, SM_CYMENUCHECK, SM_CYMENUCHECK, checkbutton_statemap, {0,0,4,0} }, { "Radiobutton.indicator", DFC_BUTTON, DFCS_BUTTONRADIO, SM_CYMENUCHECK, SM_CYMENUCHECK, checkbutton_statemap, {0,0,4,0} }, { "uparrow", DFC_SCROLL, DFCS_SCROLLUP, SM_CXVSCROLL, SM_CYVSCROLL, arrow_statemap, {0,0,0,0} }, { "downarrow", DFC_SCROLL, DFCS_SCROLLDOWN, SM_CXVSCROLL, SM_CYVSCROLL, arrow_statemap, {0,0,0,0} }, { "leftarrow", DFC_SCROLL, DFCS_SCROLLLEFT, SM_CXHSCROLL, SM_CYHSCROLL, arrow_statemap, {0,0,0,0} }, { "rightarrow", DFC_SCROLL, DFCS_SCROLLRIGHT, SM_CXHSCROLL, SM_CYHSCROLL, arrow_statemap, {0,0,0,0} }, { "sizegrip", DFC_SCROLL, DFCS_SCROLLSIZEGRIP, SM_CXVSCROLL, SM_CYHSCROLL, arrow_statemap, {0,0,0,0} }, { 0,0,0,0,0,0, {0,0,0,0} } }; /* ---------------------------------------------------------------------- */ static void FrameControlElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { FrameControlElementData *p = clientData; *widthPtr = GetSystemMetrics(p->cxId) + Ttk_PaddingWidth(p->margins); *heightPtr = GetSystemMetrics(p->cyId) + Ttk_PaddingHeight(p->margins); } static void FrameControlElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { FrameControlElementData *elementData = clientData; RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawFrameControl(hdc, &rc, elementData->classId, elementData->partId|Ttk_StateTableLookup(elementData->stateMap, state)); TkWinReleaseDrawableDC(d, hdc, &dcState); } static Ttk_ElementSpec FrameControlElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, FrameControlElementSize, FrameControlElementDraw }; /*---------------------------------------------------------------------- * +++ Border element implementation. */ typedef struct { Tcl_Obj *reliefObj; } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF,Tk_Offset(BorderElement,reliefObj), "flat" }, {NULL} }; static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void BorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { BorderElement *border = elementRecord; RECT rc = BoxToRect(b); int relief = TK_RELIEF_FLAT; TkWinDCState dcState; HDC hdc; Tk_GetReliefFromObj(NULL, border->reliefObj, &relief); if (relief != TK_RELIEF_FLAT) { UINT xFlags = (relief == TK_RELIEF_SOLID) ? BF_FLAT : 0; hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, ReliefToEdge(relief), BF_RECT | xFlags); TkWinReleaseDrawableDC(d, hdc, &dcState); } } static Ttk_ElementSpec BorderElementSpec = { TK_STYLE_VERSION_2, sizeof(BorderElement), BorderElementOptions, BorderElementSize, BorderElementDraw }; /* * Entry field borders: * Sunken border; also fill with window color. */ typedef struct { Tcl_Obj *backgroundObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement,backgroundObj), "white" }, {NULL} }; static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void FieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { FieldElement *field = elementRecord; Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj); RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; Tk_Fill3DRectangle( tkwin, d, bg, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT); hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_SUNKEN, BF_RECT); TkWinReleaseDrawableDC(d, hdc, &dcState); } static Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, FieldElementSize, FieldElementDraw }; /*------------------------------------------------------------------------ * +++ Button borders. * Drawn with DrawFrameControl instead of DrawEdge; * Also draw default indicator and focus ring. */ typedef struct { Tcl_Obj *reliefObj; Tcl_Obj *highlightColorObj; Tcl_Obj *defaultStateObj; } ButtonBorderElement; static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF, Tk_Offset(ButtonBorderElement,reliefObj), "flat" }, { "-highlightcolor",TK_OPTION_COLOR, Tk_Offset(ButtonBorderElement,highlightColorObj), "black" }, { "-default", TK_OPTION_ANY, Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" }, {NULL} }; static void ButtonBorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ButtonBorderElement *bd = elementRecord; int relief = TK_RELIEF_RAISED; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; short int cx, cy; Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); cx = GetSystemMetrics(SM_CXEDGE); cy = GetSystemMetrics(SM_CYEDGE); /* Space for default indicator: */ if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { ++cx; ++cy; } /* Space for focus ring: */ cx += 2; cy += 2; *paddingPtr = Ttk_MakePadding(cx,cy,cx,cy); } static void ButtonBorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ButtonBorderElement *bd = elementRecord; int relief = TK_RELIEF_FLAT; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; TkWinDCState dcState; HDC hdc; RECT rc; Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { XColor *highlightColor = Tk_GetColorFromObj(tkwin, bd->highlightColorObj); GC gc = Tk_GCForColor(highlightColor, d); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x,b.y,b.width-1,b.height-1); } if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { ++b.x; ++b.y; b.width -= 2; b.height -= 2; } hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); rc = BoxToRect(b); DrawFrameControl(hdc, &rc, DFC_BUTTON, /* classId */ DFCS_BUTTONPUSH | Ttk_StateTableLookup(pushbutton_statemap, state)); /* Draw focus ring: */ if (state & TTK_STATE_FOCUS) { short int borderWidth = 3; /* @@@ Use GetSystemMetrics?*/ rc = BoxToRect(Ttk_PadBox(b, Ttk_UniformPadding(borderWidth))); DrawFocusRect(hdc, &rc); } TkWinReleaseDrawableDC(d, hdc, &dcState); } static Ttk_ElementSpec ButtonBorderElementSpec = { TK_STYLE_VERSION_2, sizeof(ButtonBorderElement), ButtonBorderElementOptions, ButtonBorderElementSize, ButtonBorderElementDraw }; /*------------------------------------------------------------------------ * +++ Focus element. * Draw dashed focus rectangle. */ static void FocusElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(1); } static void FocusElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { if (state & TTK_STATE_FOCUS) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawFocusRect(hdc, &rc); TkWinReleaseDrawableDC(d, hdc, &dcState); } } static Ttk_ElementSpec FocusElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, FocusElementSize, FocusElementDraw }; /* FillFocusElement -- * Draws a focus ring filled with the selection color */ typedef struct { Tcl_Obj *fillColorObj; } FillFocusElement; static Ttk_ElementOptionSpec FillFocusElementOptions[] = { { "-focusfill", TK_OPTION_COLOR, Tk_Offset(FillFocusElement,fillColorObj), "white" }, { NULL } }; /* @@@ FIX THIS */ static void FillFocusElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { FillFocusElement *focus = elementRecord; if (state & TTK_STATE_FOCUS) { RECT rc = BoxToRect(b); TkWinDCState dcState; XColor *fillColor = Tk_GetColorFromObj(tkwin, focus->fillColorObj); GC gc = Tk_GCForColor(fillColor, d); HDC hdc; XFillRectangle(Tk_Display(tkwin),d,gc, b.x,b.y,b.width,b.height); hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawFocusRect(hdc, &rc); TkWinReleaseDrawableDC(d, hdc, &dcState); } } /* * ComboboxFocusElement -- * Read-only comboboxes have a filled focus ring, editable ones do not. */ static void ComboboxFocusElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { if (state & TTK_STATE_READONLY) { FillFocusElementDraw(clientData, elementRecord, tkwin, d, b, state); } } static Ttk_ElementSpec ComboboxFocusElementSpec = { TK_STYLE_VERSION_2, sizeof(FillFocusElement), FillFocusElementOptions, FocusElementSize, ComboboxFocusElementDraw }; /*---------------------------------------------------------------------- * +++ Scrollbar trough element. * * The native windows scrollbar is drawn using a pattern brush giving a * stippled appearance when the trough might otherwise be invisible. * We can deal with this here. */ typedef struct { /* clientData for Trough element */ HBRUSH PatternBrush; HBITMAP PatternBitmap; } TroughClientData; static const WORD Pattern[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa }; static void TroughClientDataDeleteProc(void *clientData) { TroughClientData *cd = clientData; DeleteObject(cd->PatternBrush); DeleteObject(cd->PatternBitmap); ckfree(clientData); } static TroughClientData *TroughClientDataInit(Tcl_Interp *interp) { TroughClientData *cd = (TroughClientData*)ckalloc(sizeof(*cd)); cd->PatternBitmap = CreateBitmap(8, 8, 1, 1, Pattern); cd->PatternBrush = CreatePatternBrush(cd->PatternBitmap); Ttk_RegisterCleanup(interp, cd, TroughClientDataDeleteProc); return cd; } static void TroughElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { TroughClientData *cd = clientData; TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); HBRUSH hbr; COLORREF bk, oldbk, oldtxt; hbr = SelectObject(hdc, GetSysColorBrush(COLOR_SCROLLBAR)); bk = GetSysColor(COLOR_3DHIGHLIGHT); oldtxt = SetTextColor(hdc, GetSysColor(COLOR_3DFACE)); oldbk = SetBkColor(hdc, bk); /* WAS: if (bk (COLOR_3DHIGHLIGHT) == GetSysColor(COLOR_WINDOW)) ... */ if (GetSysColor(COLOR_SCROLLBAR) == GetSysColor(COLOR_BTNFACE)) { /* Draw using the pattern brush */ SelectObject(hdc, cd->PatternBrush); } PatBlt(hdc, b.x, b.y, b.width, b.height, PATCOPY); SetBkColor(hdc, oldbk); SetTextColor(hdc, oldtxt); SelectObject(hdc, hbr); TkWinReleaseDrawableDC(d, hdc, &dcState); } static Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TtkNullElementSize, TroughElementDraw }; /*------------------------------------------------------------------------ * +++ Thumb element. */ typedef struct { Tcl_Obj *orientObj; } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY,Tk_Offset(ThumbElement,orientObj),"horizontal"}, { NULL } }; static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ThumbElement *thumbPtr = elementRecord; int orient; Ttk_GetOrientFromObj(NULL, thumbPtr->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = GetSystemMetrics(SM_CXHTHUMB); *heightPtr = GetSystemMetrics(SM_CYHSCROLL); } else { *widthPtr = GetSystemMetrics(SM_CXVSCROLL); *heightPtr = GetSystemMetrics(SM_CYVTHUMB); } } static void ThumbElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; /* Windows doesn't show a thumb when the scrollbar is disabled */ if (state & TTK_STATE_DISABLED) return; hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE); TkWinReleaseDrawableDC(d, hdc, &dcState); } static Ttk_ElementSpec ThumbElementSpec = { TK_STYLE_VERSION_2, sizeof(ThumbElement), ThumbElementOptions, ThumbElementSize, ThumbElementDraw }; /* ---------------------------------------------------------------------- * The slider element is the shaped thumb used in the slider widget. * Windows likes to call this a trackbar. */ typedef struct { Tcl_Obj *orientObj; /* orientation of the slider widget */ } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj), "horizontal" }, { NULL } }; static void SliderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SliderElement *slider = elementRecord; int orient; Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = (GetSystemMetrics(SM_CXHTHUMB) / 2) | 1; *heightPtr = GetSystemMetrics(SM_CYHSCROLL); } else { *widthPtr = GetSystemMetrics(SM_CXVSCROLL); *heightPtr = (GetSystemMetrics(SM_CYVTHUMB) / 2) | 1; } } static void SliderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE); TkWinReleaseDrawableDC(d, hdc, &dcState); } static Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(SliderElement), SliderElementOptions, SliderElementSize, SliderElementDraw }; /*------------------------------------------------------------------------ * +++ Notebook elements. */ static void ClientElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void ClientElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_SOFT); TkWinReleaseDrawableDC(d, hdc, &dcState); } static Ttk_ElementSpec ClientElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, ClientElementSize, ClientElementDraw }; /*------------------------------------------------------------------------ * +++ Layouts. */ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("TButton", TTK_GROUP("Button.border", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH)))) TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) TTK_GROUP("Combobox.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH, TTK_GROUP("Combobox.focus", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE /* ---------------------------------------------------------------------- */ MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd) { Ttk_Theme themePtr, parentPtr; FrameControlElementData *fce = FrameControlElements; parentPtr = Ttk_GetTheme(interp, "alt"); themePtr = Ttk_CreateTheme(interp, "winnative", parentPtr); if (!themePtr) { return TCL_ERROR; } Ttk_RegisterElementSpec(themePtr, "border", &BorderElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "Button.border", &ButtonBorderElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "field", &FieldElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "focus", &FocusElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "Combobox.focus", &ComboboxFocusElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "thumb", &ThumbElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "slider", &SliderElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "Scrollbar.trough", &TroughElementSpec, TroughClientDataInit(interp)); Ttk_RegisterElementSpec(themePtr, "client", &ClientElementSpec, NULL); for (fce = FrameControlElements; fce->name != 0; ++fce) { Ttk_RegisterElementSpec(themePtr, fce->name, &FrameControlElementSpec, fce); } Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::winnative", TILE_VERSION); return TCL_OK; } tile-0.8.2/win/xpTheme.c0000644000076500007650000007361310724432727014441 0ustar joejoe00000000000000/* * xpTheme.c,v 1.94 2007/12/02 04:34:31 jenglish Exp * * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. * * Copyright (c) 2003 by Georgios Petasis, petasis@iit.demokritos.gr. * Copyright (c) 2003 by Joe English * Copyright (c) 2003 by Pat Thoyts * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * See also: * * */ #ifndef HAVE_UXTHEME_H /* Stub for platforms that lack the XP theme API headers: */ #include #include int XPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; } #else #define WINVER 0x0501 /* Requires Windows XP APIs */ #include #include #include #ifdef NO_PRIVATE_HEADERS #include #include "gunk.h" #else #include #endif #include "tkTheme.h" typedef HTHEME (STDAPICALLTYPE OpenThemeDataProc)(HWND hwnd, LPCWSTR pszClassList); typedef HRESULT (STDAPICALLTYPE CloseThemeDataProc)(HTHEME hTheme); typedef HRESULT (STDAPICALLTYPE DrawThemeBackgroundProc)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect); typedef HRESULT (STDAPICALLTYPE GetThemePartSizeProc)(HTHEME,HDC, int iPartId, int iStateId, RECT *prc, enum THEMESIZE eSize, SIZE *psz); typedef int (STDAPICALLTYPE GetThemeSysSizeProc)(HTHEME,int); /* GetThemeTextExtent and DrawThemeText only used with BROKEN_TEXT_ELEMENT */ typedef HRESULT (STDAPICALLTYPE GetThemeTextExtentProc)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, const RECT *pBoundingRect, RECT *pExtent); typedef HRESULT (STDAPICALLTYPE DrawThemeTextProc)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect); typedef BOOL (STDAPICALLTYPE IsThemeActiveProc)(VOID); typedef BOOL (STDAPICALLTYPE IsAppThemedProc)(VOID); typedef struct { OpenThemeDataProc *OpenThemeData; CloseThemeDataProc *CloseThemeData; GetThemePartSizeProc *GetThemePartSize; GetThemeSysSizeProc *GetThemeSysSize; DrawThemeBackgroundProc *DrawThemeBackground; DrawThemeTextProc *DrawThemeText; GetThemeTextExtentProc *GetThemeTextExtent; IsThemeActiveProc *IsThemeActive; IsAppThemedProc *IsAppThemed; HWND stubWindow; } XPThemeProcs; typedef struct { HINSTANCE hlibrary; XPThemeProcs *procs; } XPThemeData; /* *---------------------------------------------------------------------- * * LoadXPThemeProcs -- * Initialize XP theming support. * * XP theme support is included in UXTHEME.DLL * We dynamically load this DLL at runtime instead of linking * to it at build-time. * * Returns: * A pointer to an XPThemeProcs table if successful, NULL otherwise. */ static XPThemeProcs * LoadXPThemeProcs(HINSTANCE *phlib) { /* * Load the library "uxtheme.dll", where the native widget * drawing routines are implemented. This will only succeed * if we are running at least on Windows XP. */ HINSTANCE handle; *phlib = handle = LoadLibrary("uxtheme.dll"); if (handle != 0) { /* * We have successfully loaded the library. Proceed in storing the * addresses of the functions we want to use. */ XPThemeProcs *procs = (XPThemeProcs*)ckalloc(sizeof(XPThemeProcs)); #define LOADPROC(name) \ (0 != (procs->name = (name ## Proc *)GetProcAddress(handle, #name) )) if ( LOADPROC(OpenThemeData) && LOADPROC(CloseThemeData) && LOADPROC(GetThemePartSize) && LOADPROC(GetThemeSysSize) && LOADPROC(DrawThemeBackground) && LOADPROC(GetThemeTextExtent) && LOADPROC(DrawThemeText) && LOADPROC(IsThemeActive) && LOADPROC(IsAppThemed) ) { return procs; } #undef LOADPROC ckfree((char*)procs); } return 0; } /* * XPThemeDeleteProc -- * * Release any theme allocated resources. */ static void XPThemeDeleteProc(void *clientData) { XPThemeData *themeData = clientData; FreeLibrary(themeData->hlibrary); ckfree(clientData); } static int XPThemeEnabled(Ttk_Theme theme, void *clientData) { XPThemeData *themeData = clientData; int active = themeData->procs->IsThemeActive(); int themed = themeData->procs->IsAppThemed(); return (active && themed); } /* * BoxToRect -- * Helper routine. Returns a RECT data structure. */ static RECT BoxToRect(Ttk_Box b) { RECT rc; rc.top = b.y; rc.left = b.x; rc.bottom = b.y + b.height; rc.right = b.x + b.width; return rc; } /* * Map Tk state bitmaps to XP style enumerated values. */ static Ttk_StateTable null_statemap[] = { {0,0,0} }; /* * Pushbuttons (Tk: "Button") */ static Ttk_StateTable pushbutton_statemap[] = { { PBS_DISABLED, TTK_STATE_DISABLED, 0 }, { PBS_PRESSED, TTK_STATE_PRESSED, 0 }, { PBS_HOT, TTK_STATE_ACTIVE, 0 }, { PBS_DEFAULTED, TTK_STATE_ALTERNATE, 0 }, { PBS_NORMAL, 0, 0 } }; /* * Checkboxes (Tk: "Checkbutton") */ static Ttk_StateTable checkbox_statemap[] = { {CBS_MIXEDDISABLED, TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0}, {CBS_MIXEDPRESSED, TTK_STATE_ALTERNATE|TTK_STATE_PRESSED, 0}, {CBS_MIXEDHOT, TTK_STATE_ALTERNATE|TTK_STATE_ACTIVE, 0}, {CBS_MIXEDNORMAL, TTK_STATE_ALTERNATE, 0}, {CBS_CHECKEDDISABLED, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0}, {CBS_CHECKEDPRESSED, TTK_STATE_SELECTED|TTK_STATE_PRESSED, 0}, {CBS_CHECKEDHOT, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0}, {CBS_CHECKEDNORMAL, TTK_STATE_SELECTED, 0}, {CBS_UNCHECKEDDISABLED, TTK_STATE_DISABLED, 0}, {CBS_UNCHECKEDPRESSED, TTK_STATE_PRESSED, 0}, {CBS_UNCHECKEDHOT, TTK_STATE_ACTIVE, 0}, {CBS_UNCHECKEDNORMAL, 0,0 } }; /* * Radiobuttons: */ static Ttk_StateTable radiobutton_statemap[] = { {RBS_CHECKEDDISABLED, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0}, {RBS_CHECKEDPRESSED, TTK_STATE_SELECTED|TTK_STATE_PRESSED, 0}, {RBS_CHECKEDHOT, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0}, {RBS_CHECKEDNORMAL, TTK_STATE_SELECTED, 0}, {RBS_UNCHECKEDDISABLED, TTK_STATE_DISABLED, 0}, {RBS_UNCHECKEDPRESSED, TTK_STATE_PRESSED, 0}, {RBS_UNCHECKEDHOT, TTK_STATE_ACTIVE, 0}, {RBS_UNCHECKEDNORMAL, 0,0 } }; /* * Groupboxes (tk: "frame") */ static Ttk_StateTable groupbox_statemap[] = { {GBS_DISABLED, TTK_STATE_DISABLED, 0}, {GBS_NORMAL, 0,0 } }; /* * Edit fields (tk: "entry") */ static Ttk_StateTable edittext_statemap[] = { { ETS_DISABLED, TTK_STATE_DISABLED, 0 }, { ETS_READONLY, TTK_STATE_READONLY, 0 }, { ETS_FOCUSED, TTK_STATE_FOCUS, 0 }, { ETS_HOT, TTK_STATE_ACTIVE, 0 }, { ETS_NORMAL, 0, 0 } /* NOT USED: ETS_ASSIST, ETS_SELECTED */ }; /* * Combobox text field statemap: * Same as edittext_statemap, but doesn't use ETS_READONLY * (fixes: #1032409) */ static Ttk_StateTable combotext_statemap[] = { { ETS_DISABLED, TTK_STATE_DISABLED, 0 }, { ETS_FOCUSED, TTK_STATE_FOCUS, 0 }, { ETS_HOT, TTK_STATE_ACTIVE, 0 }, { ETS_NORMAL, 0, 0 } }; /* * Combobox button: (CBP_DROPDOWNBUTTON) */ static Ttk_StateTable combobox_statemap[] = { { CBXS_DISABLED, TTK_STATE_DISABLED, 0 }, { CBXS_PRESSED, TTK_STATE_PRESSED, 0 }, { CBXS_HOT, TTK_STATE_ACTIVE, 0 }, { CBXS_NORMAL, 0, 0 } }; /* * Toolbar buttons (TP_BUTTON): */ static Ttk_StateTable toolbutton_statemap[] = { { TS_DISABLED, TTK_STATE_DISABLED, 0 }, { TS_PRESSED, TTK_STATE_PRESSED, 0 }, { TS_HOTCHECKED, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0 }, { TS_CHECKED, TTK_STATE_SELECTED, 0 }, { TS_HOT, TTK_STATE_ACTIVE, 0 }, { TS_NORMAL, 0,0 } }; /* * Scrollbars (Tk: "Scrollbar.thumb") */ static Ttk_StateTable scrollbar_statemap[] = { { SCRBS_DISABLED, TTK_STATE_DISABLED, 0 }, { SCRBS_PRESSED, TTK_STATE_PRESSED, 0 }, { SCRBS_HOT, TTK_STATE_ACTIVE, 0 }, { SCRBS_NORMAL, 0, 0 } }; static Ttk_StateTable uparrow_statemap[] = { { ABS_UPDISABLED, TTK_STATE_DISABLED, 0 }, { ABS_UPPRESSED, TTK_STATE_PRESSED, 0 }, { ABS_UPHOT, TTK_STATE_ACTIVE, 0 }, { ABS_UPNORMAL, 0, 0 } }; static Ttk_StateTable downarrow_statemap[] = { { ABS_DOWNDISABLED, TTK_STATE_DISABLED, 0 }, { ABS_DOWNPRESSED, TTK_STATE_PRESSED, 0 }, { ABS_DOWNHOT, TTK_STATE_ACTIVE, 0 }, { ABS_DOWNNORMAL, 0, 0 } }; static Ttk_StateTable leftarrow_statemap[] = { { ABS_LEFTDISABLED, TTK_STATE_DISABLED, 0 }, { ABS_LEFTPRESSED, TTK_STATE_PRESSED, 0 }, { ABS_LEFTHOT, TTK_STATE_ACTIVE, 0 }, { ABS_LEFTNORMAL, 0, 0 } }; static Ttk_StateTable rightarrow_statemap[] = { { ABS_RIGHTDISABLED,TTK_STATE_DISABLED, 0 }, { ABS_RIGHTPRESSED, TTK_STATE_PRESSED, 0 }, { ABS_RIGHTHOT, TTK_STATE_ACTIVE, 0 }, { ABS_RIGHTNORMAL, 0, 0 } }; /* * Trackbar thumb: (Tk: "scale slider") */ static Ttk_StateTable scale_statemap[] = { { TUS_DISABLED, TTK_STATE_DISABLED, 0 }, { TUS_PRESSED, TTK_STATE_PRESSED, 0 }, { TUS_FOCUSED, TTK_STATE_FOCUS, 0 }, { TUS_HOT, TTK_STATE_ACTIVE, 0 }, { TUS_NORMAL, 0, 0 } }; static Ttk_StateTable tabitem_statemap[] = { { TIS_DISABLED, TTK_STATE_DISABLED, 0 }, { TIS_SELECTED, TTK_STATE_SELECTED, 0 }, { TIS_HOT, TTK_STATE_ACTIVE, 0 }, { TIS_FOCUSED, TTK_STATE_FOCUS, 0 }, { TIS_NORMAL, 0, 0 }, }; /* *---------------------------------------------------------------------- * +++ Element data: * * The following structure is passed as the 'clientData' pointer * to most elements in this theme. It contains data relevant * to a single XP Theme "part". * * <>: * In theory, we should be call GetThemeMargins(...TMT_CONTENTRECT...) * to calculate the internal padding. In practice, this routine * only seems to work properly for BP_PUSHBUTTON. So we hardcode * the required padding at element registration time instead. * * The PAD_MARGINS flag bit determines whether the padding * should be added on the inside (0) or outside (1) of the element. * * <>: * This gives bogus metrics for some parts (in particular, * BP_PUSHBUTTONS). Set the IGNORE_THEMESIZE flag to skip this call. */ typedef struct /* XP element specifications */ { const char *elementName; /* Tk theme engine element name */ Ttk_ElementSpec *elementSpec; /* Element spec (usually GenericElementSpec) */ LPCWSTR className; /* Windows window class name */ int partId; /* BP_PUSHBUTTON, BP_CHECKBUTTON, etc. */ Ttk_StateTable *statemap; /* Map Tk states to XP states */ Ttk_Padding padding; /* See NOTE-GetThemeMargins */ int flags; # define IGNORE_THEMESIZE 0x80000000 /* See NOTE-GetThemePartSize */ # define PAD_MARGINS 0x40000000 /* See NOTE-GetThemeMargins */ } ElementInfo; typedef struct { /* * Static data, initialized when element is registered: */ ElementInfo *info; XPThemeProcs *procs; /* Pointer to theme procedure table */ /* * Dynamic data, allocated by InitElementData: */ HTHEME hTheme; HDC hDC; HWND hwnd; /* For TkWinDrawableReleaseDC: */ Drawable drawable; TkWinDCState dcState; } ElementData; static ElementData * NewElementData(XPThemeProcs *procs, ElementInfo *info) { ElementData *elementData = (ElementData*)ckalloc(sizeof(ElementData)); elementData->procs = procs; elementData->info = info; elementData->hTheme = elementData->hDC = 0; return elementData; } static void DestroyElementData(void *elementData) { ckfree(elementData); } /* * InitElementData -- * Looks up theme handle. If Drawable argument is non-NULL, * also initializes DC. * * Returns: * 1 on success, 0 on error. * Caller must later call FreeElementData() so this element * can be reused. */ static int InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d) { Window win = Tk_WindowId(tkwin); if (win != None) { elementData->hwnd = Tk_GetHWND(win); } else { elementData->hwnd = elementData->procs->stubWindow; } elementData->hTheme = elementData->procs->OpenThemeData( elementData->hwnd, elementData->info->className); if (!elementData->hTheme) return 0; elementData->drawable = d; if (d != 0) { elementData->hDC = TkWinGetDrawableDC(Tk_Display(tkwin), d, &elementData->dcState); } return 1; } static void FreeElementData(ElementData *elementData) { elementData->procs->CloseThemeData(elementData->hTheme); if (elementData->drawable != 0) { TkWinReleaseDrawableDC( elementData->drawable, elementData->hDC, &elementData->dcState); } } /*---------------------------------------------------------------------- * +++ Generic element implementation. * * Used for elements which are handled entirely by the XP Theme API, * such as radiobutton and checkbutton indicators, scrollbar arrows, etc. */ static void GenericElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ElementData *elementData = clientData; HRESULT result; SIZE size; if (!InitElementData(elementData, tkwin, 0)) return; if (!(elementData->info->flags & IGNORE_THEMESIZE)) { result = elementData->procs->GetThemePartSize( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, 0), NULL /*RECT *prc*/, TS_TRUE, &size); if (SUCCEEDED(result)) { *widthPtr = size.cx; *heightPtr = size.cy; } } /* See NOTE-GetThemeMargins */ *paddingPtr = elementData->info->padding; if (elementData->info->flags & PAD_MARGINS) { *widthPtr += Ttk_PaddingWidth(elementData->info->padding); *heightPtr += Ttk_PaddingHeight(elementData->info->padding); } } static void GenericElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ElementData *elementData = clientData; RECT rc; if (!InitElementData(elementData, tkwin, d)) { return; } if (elementData->info->flags & PAD_MARGINS) { b = Ttk_PadBox(b, elementData->info->padding); } rc = BoxToRect(b); elementData->procs->DrawThemeBackground( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, state), &rc, NULL/*pContentRect*/); FreeElementData(elementData); } static Ttk_ElementSpec GenericElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, GenericElementSize, GenericElementDraw }; /*---------------------------------------------------------------------- * +++ Sized element implementation. * * Used for elements which are handled entirely by the XP Theme API, * but that require a fixed size adjustment. * Note that GetThemeSysSize calls through to GetSystemMetrics */ static void GenericSizedElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ElementData *elementData = clientData; if (!InitElementData(elementData, tkwin, 0)) return; GenericElementSize(clientData, elementRecord, tkwin, widthPtr, heightPtr, paddingPtr); *widthPtr = elementData->procs->GetThemeSysSize(NULL, (elementData->info->flags >> 8) & 0xff); *heightPtr = elementData->procs->GetThemeSysSize(NULL, elementData->info->flags & 0xff); } static Ttk_ElementSpec GenericSizedElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, GenericSizedElementSize, GenericElementDraw }; /*---------------------------------------------------------------------- * +++ Scrollbar thumb element. * Same as a GenericElement, but don't draw in the disabled state. */ static void ThumbElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ElementData *elementData = clientData; unsigned stateId = Ttk_StateTableLookup(elementData->info->statemap, state); RECT rc = BoxToRect(b); /* * Don't draw the thumb if we are disabled. */ if (state & TTK_STATE_DISABLED) return; if (!InitElementData(elementData, tkwin, d)) return; elementData->procs->DrawThemeBackground(elementData->hTheme, elementData->hDC, elementData->info->partId, stateId, &rc, NULL); FreeElementData(elementData); } static Ttk_ElementSpec ThumbElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, GenericElementSize, ThumbElementDraw }; /*---------------------------------------------------------------------- * +++ Progress bar element. * Increases the requested length of PP_CHUNK and PP_CHUNKVERT parts * so that indeterminate progress bars show 3 bars instead of 1. */ static void PbarElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ElementData *elementData = clientData; int nBars = 3; GenericElementSize(clientData, elementRecord, tkwin, widthPtr, heightPtr, paddingPtr); if (elementData->info->partId == PP_CHUNK) { *widthPtr *= nBars; } else if (elementData->info->partId == PP_CHUNKVERT) { *heightPtr *= nBars; } } static Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, PbarElementSize, GenericElementDraw }; /*---------------------------------------------------------------------- * +++ Notebook tab element. * Same as generic element, with additional logic to select * proper iPartID for the leftmost tab. * * Notes: TABP_TABITEMRIGHTEDGE (or TABP_TOPTABITEMRIGHTEDGE, * which appears to be identical) should be used if the * tab is exactly at the right edge of the notebook, but * not if it's simply the rightmost tab. This information * is not available. * * The TIS_* and TILES_* definitions are identical, so * we can use the same statemap no matter what the partId. */ static void TabElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ElementData *elementData = clientData; int partId = elementData->info->partId; RECT rc = BoxToRect(b); if (!InitElementData(elementData, tkwin, d)) return; if (state & TTK_STATE_USER1) partId = TABP_TABITEMLEFTEDGE; elementData->procs->DrawThemeBackground( elementData->hTheme, elementData->hDC, partId, Ttk_StateTableLookup(elementData->info->statemap, state), &rc, NULL); FreeElementData(elementData); } static Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, GenericElementSize, TabElementDraw }; /*---------------------------------------------------------------------- * +++ Tree indicator element. * * Generic element, but don't display at all if TTK_STATE_LEAF (=USER2) set */ #define TTK_STATE_OPEN TTK_STATE_USER1 #define TTK_STATE_LEAF TTK_STATE_USER2 static Ttk_StateTable header_statemap[] = { { HIS_PRESSED, TTK_STATE_PRESSED, 0 }, { HIS_HOT, TTK_STATE_ACTIVE, 0 }, { HIS_NORMAL, 0,0 }, }; static Ttk_StateTable tvpglyph_statemap[] = { { GLPS_OPENED, TTK_STATE_OPEN, 0 }, { GLPS_CLOSED, 0,0 }, }; static void TreeIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { if (!(state & TTK_STATE_LEAF)) { GenericElementDraw(clientData,elementRecord,tkwin,d,b,state); } } static Ttk_ElementSpec TreeIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, GenericElementSize, TreeIndicatorElementDraw }; #if BROKEN_TEXT_ELEMENT /* *---------------------------------------------------------------------- * Text element (does not work yet). * * According to "Using Windows XP Visual Styles", we need to select * a font into the DC before calling DrawThemeText(). * There's just no easy way to get an HFONT out of a Tk_Font. * Maybe GetThemeFont() would work? * */ typedef struct { Tcl_Obj *textObj; Tcl_Obj *fontObj; } TextElement; static Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, Tk_Offset(TextElement,textObj), "" }, { "-font", TK_OPTION_FONT, Tk_Offset(TextElement,fontObj), DEFAULT_FONT }, { NULL } }; static void TextElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TextElement *element = elementRecord; ElementData *elementData = clientData; RECT rc = {0, 0}; HRESULT hr = S_OK; if (!InitElementData(elementData, tkwin, 0)) return; hr = elementData->procs->GetThemeTextExtent( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, 0), Tcl_GetUnicode(element->textObj), -1, DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, NULL, &rc); if (SUCCEEDED(hr)) { *widthPtr = rc.right - rc.left; *heightPtr = rc.bottom - rc.top; } if (*widthPtr < 80) *widthPtr = 80; if (*heightPtr < 20) *heightPtr = 20; FreeElementData(elementData); } static void TextElementDraw( ClientData clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { TextElement *element = elementRecord; ElementData *elementData = clientData; RECT rc = BoxToRect(b); HRESULT hr = S_OK; if (!InitElementData(elementData, tkwin, d)) return; hr = elementData->procs->DrawThemeText( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, state), Tcl_GetUnicode(element->textObj), -1, DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, (state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0, &rc); FreeElementData(elementData); } static Ttk_ElementSpec TextElementSpec = { TK_STYLE_VERSION_2, sizeof(TextElement), TextElementOptions, TextElementSize, TextElementDraw }; #endif /* BROKEN_TEXT_ELEMENT */ /*---------------------------------------------------------------------- * +++ Widget layouts: */ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("TButton", TTK_GROUP("Button.button", TTK_FILL_BOTH, TTK_GROUP("Button.focus", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH))))) TTK_LAYOUT("TMenubutton", TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y) TTK_GROUP("Menubutton.button", TTK_PACK_RIGHT|TTK_EXPAND|TTK_FILL_BOTH, TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, TTK_NODE("Menubutton.label", 0)))) TTK_LAYOUT("Horizontal.TScrollbar", TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X, TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_LEFT) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) TTK_GROUP("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH|TTK_UNIT, TTK_NODE("Horizontal.Scrollbar.grip", 0)))) TTK_LAYOUT("Vertical.TScrollbar", TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y, TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_TOP) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) TTK_GROUP("Vertical.Scrollbar.thumb", TTK_FILL_BOTH|TTK_UNIT, TTK_NODE("Vertical.Scrollbar.grip", 0)))) TTK_LAYOUT("Horizontal.TScale", TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, TTK_GROUP("Horizontal.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, TTK_NODE("Horizontal.Scale.track", TTK_FILL_X) TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) ))) TTK_LAYOUT("Vertical.TScale", TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, TTK_GROUP("Vertical.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, TTK_NODE("Vertical.Scale.track", TTK_FILL_Y) TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) ))) TTK_END_LAYOUT_TABLE /*---------------------------------------------------------------------- * +++ XP element info table: */ #define PAD(l,t,r,b) {l,t,r,b} #define NOPAD {0,0,0,0} /* name spec className partId statemap padding flags */ static ElementInfo ElementInfoTable[] = { { "Checkbutton.indicator", &GenericElementSpec, L"BUTTON", BP_CHECKBOX, checkbox_statemap, PAD(0, 0, 4, 0), PAD_MARGINS }, { "Radiobutton.indicator", &GenericElementSpec, L"BUTTON", BP_RADIOBUTTON, radiobutton_statemap, PAD(0, 0, 4, 0), PAD_MARGINS }, { "Button.button", &GenericElementSpec, L"BUTTON", BP_PUSHBUTTON, pushbutton_statemap, PAD(3, 3, 3, 3), IGNORE_THEMESIZE }, { "Labelframe.border", &GenericElementSpec, L"BUTTON", BP_GROUPBOX, groupbox_statemap, PAD(2, 2, 2, 2), 0 }, { "Entry.field", &GenericElementSpec, L"EDIT", EP_EDITTEXT, edittext_statemap, PAD(1, 1, 1, 1), 0 }, { "Combobox.field", &GenericElementSpec, L"EDIT", EP_EDITTEXT, combotext_statemap, PAD(1, 1, 1, 1), 0 }, { "Combobox.downarrow", &GenericSizedElementSpec, L"COMBOBOX", CP_DROPDOWNBUTTON, combobox_statemap, NOPAD, (SM_CXVSCROLL << 8) | SM_CYVSCROLL }, { "Vertical.Scrollbar.trough", &GenericElementSpec, L"SCROLLBAR", SBP_UPPERTRACKVERT, scrollbar_statemap, NOPAD, 0 }, { "Vertical.Scrollbar.thumb", &ThumbElementSpec, L"SCROLLBAR", SBP_THUMBBTNVERT, scrollbar_statemap, NOPAD, 0 }, { "Vertical.Scrollbar.grip", &GenericElementSpec, L"SCROLLBAR", SBP_GRIPPERVERT, scrollbar_statemap, NOPAD, 0 }, { "Horizontal.Scrollbar.trough", &GenericElementSpec, L"SCROLLBAR", SBP_UPPERTRACKHORZ, scrollbar_statemap, NOPAD, 0 }, { "Horizontal.Scrollbar.thumb", &ThumbElementSpec, L"SCROLLBAR", SBP_THUMBBTNHORZ, scrollbar_statemap, NOPAD, 0 }, { "Horizontal.Scrollbar.grip", &GenericElementSpec, L"SCROLLBAR", SBP_GRIPPERHORZ, scrollbar_statemap, NOPAD, 0 }, { "Scrollbar.uparrow", &GenericSizedElementSpec, L"SCROLLBAR", SBP_ARROWBTN, uparrow_statemap, NOPAD, (SM_CXVSCROLL << 8) | SM_CYVSCROLL }, { "Scrollbar.downarrow", &GenericSizedElementSpec, L"SCROLLBAR", SBP_ARROWBTN, downarrow_statemap, NOPAD, (SM_CXVSCROLL << 8) | SM_CYVSCROLL }, { "Scrollbar.leftarrow", &GenericSizedElementSpec, L"SCROLLBAR", SBP_ARROWBTN, leftarrow_statemap, NOPAD, (SM_CXHSCROLL << 8) | SM_CYHSCROLL }, { "Scrollbar.rightarrow", &GenericSizedElementSpec, L"SCROLLBAR", SBP_ARROWBTN, rightarrow_statemap, NOPAD, (SM_CXHSCROLL << 8) | SM_CYHSCROLL }, { "Horizontal.Scale.slider", &GenericElementSpec, L"TRACKBAR", TKP_THUMB, scale_statemap, NOPAD, 0 }, { "Vertical.Scale.slider", &GenericElementSpec, L"TRACKBAR", TKP_THUMBVERT, scale_statemap, NOPAD, 0 }, { "Horizontal.Scale.track", &GenericElementSpec, L"TRACKBAR", TKP_TRACK, scale_statemap, NOPAD, 0 }, { "Vertical.Scale.track", &GenericElementSpec, L"TRACKBAR", TKP_TRACKVERT, scale_statemap, NOPAD, 0 }, /* ttk::progressbar elements */ { "Horizontal.Progressbar.pbar", &PbarElementSpec, L"PROGRESS", PP_CHUNK, null_statemap, NOPAD, 0 }, { "Vertical.Progressbar.pbar", &PbarElementSpec, L"PROGRESS", PP_CHUNKVERT, null_statemap, NOPAD, 0 }, { "Horizontal.Progressbar.trough", &GenericElementSpec, L"PROGRESS", PP_BAR, null_statemap, PAD(3,3,3,3), IGNORE_THEMESIZE }, { "Vertical.Progressbar.trough", &GenericElementSpec, L"PROGRESS", PP_BARVERT, null_statemap, PAD(3,3,3,3), IGNORE_THEMESIZE }, /* ttk::notebook */ { "tab", &TabElementSpec, L"TAB", TABP_TABITEM, tabitem_statemap, PAD(3,3,3,0), 0 }, { "client", &GenericElementSpec, L"TAB", TABP_PANE, null_statemap, PAD(1,1,3,3), 0 }, { "NotebookPane.background", &GenericElementSpec, L"TAB", TABP_BODY, null_statemap, NOPAD, 0 }, { "Toolbutton.border", &GenericElementSpec, L"TOOLBAR", TP_BUTTON, toolbutton_statemap, NOPAD,0 }, { "Menubutton.button", &GenericElementSpec, L"TOOLBAR", TP_SPLITBUTTON,toolbutton_statemap, NOPAD,0 }, { "Menubutton.dropdown", &GenericElementSpec, L"TOOLBAR", TP_SPLITBUTTONDROPDOWN,toolbutton_statemap, NOPAD,0 }, { "Treeitem.indicator", &TreeIndicatorElementSpec, L"TREEVIEW", TVP_GLYPH, tvpglyph_statemap, PAD(1,1,6,0), PAD_MARGINS }, { "Treeheading.border", &GenericElementSpec, L"HEADER", HP_HEADERITEM, header_statemap, PAD(4,0,4,0),0 }, { "sizegrip", &GenericElementSpec, L"STATUS", SP_GRIPPER, null_statemap, NOPAD,0 }, #if BROKEN_TEXT_ELEMENT { "Labelframe.text", &TextElementSpec, L"BUTTON", BP_GROUPBOX, groupbox_statemap, NOPAD,0 }, #endif { 0,0,0,0,0,NOPAD,0 } }; #undef PAD /*---------------------------------------------------------------------- * +++ Initialization routine: */ int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { XPThemeData *themeData; XPThemeProcs *procs; HINSTANCE hlibrary; Ttk_Theme themePtr, parentPtr; ElementInfo *infoPtr; procs = LoadXPThemeProcs(&hlibrary); if (!procs) return TCL_ERROR; procs->stubWindow = hwnd; /* * Create the new style engine. */ parentPtr = Ttk_GetTheme(interp, "winnative"); themePtr = Ttk_CreateTheme(interp, "xpnative", parentPtr); if (!themePtr) return TCL_ERROR; /* * Set theme data and cleanup proc */ themeData = (XPThemeData *)ckalloc(sizeof(XPThemeData)); themeData->procs = procs; themeData->hlibrary = hlibrary; Ttk_SetThemeEnabledProc(themePtr, XPThemeEnabled, themeData); Ttk_RegisterCleanup(interp, themeData, XPThemeDeleteProc); /* * New elements: */ for (infoPtr = ElementInfoTable; infoPtr->elementName != 0; ++infoPtr) { ClientData clientData = NewElementData(procs, infoPtr); Ttk_RegisterElementSpec( themePtr, infoPtr->elementName, infoPtr->elementSpec, clientData); Ttk_RegisterCleanup(interp, clientData, DestroyElementData); } Ttk_RegisterElementSpec(themePtr, "Scale.trough", &ttkNullElementSpec, 0); /* * Layouts: */ Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::xpnative", TILE_VERSION); return TCL_OK; } #endif /* HAVE_UXTHEME_H */