Index: demo/tmpldlg.tcl ================================================================== --- demo/tmpldlg.tcl +++ demo/tmpldlg.tcl @@ -1,215 +1,227 @@ - -namespace eval DemoDlg { - variable tmpl - variable msg - variable progmsg - variable progval - variable resources "en" -} - - -proc DemoDlg::create { nb } { - set frame [$nb insert end demoDlg -text "Dialog"] - - set titf1 [TitleFrame $frame.titf1 -text "Resources"] - set titf2 [TitleFrame $frame.titf2 -text "Template Dialog"] - set titf3 [TitleFrame $frame.titf3 -text "Message Dialog"] - set titf4 [TitleFrame $frame.titf4 -text "Other dialog"] - - set subf [$titf1 getframe] - set cmd {option read [file join $::BWIDGET::LIBRARY "lang" $DemoDlg::resources.rc]} - set rad1 [radiobutton $subf.rad1 -text "English" \ - -variable DemoDlg::resources -value en \ - -command $cmd] - set rad2 [radiobutton $subf.rad2 -text "French" \ - -variable DemoDlg::resources -value fr \ - -command $cmd] - set rad3 [radiobutton $subf.rad3 -text "German" \ - -variable DemoDlg::resources -value de \ - -command $cmd] - pack $rad1 $rad2 $rad3 -side left - - _tmpldlg [$titf2 getframe] - _msgdlg [$titf3 getframe] - _stddlg [$titf4 getframe] - - pack $titf1 -fill x -pady 2 -padx 2 - pack $titf4 -side bottom -fill x -pady 2 -padx 2 - pack $titf2 $titf3 -side left -padx 2 -fill both -expand yes -} - - -proc DemoDlg::_tmpldlg { parent } { - variable tmpl - - set tmpl(side) bottom - set tmpl(anchor) c - - set labf1 [LabelFrame $parent.labf1 -text "Button side" -side top \ - -anchor w -relief sunken -borderwidth 1] - set subf [$labf1 getframe] - radiobutton $subf.rad1 -text "Bottom" \ - -variable DemoDlg::tmpl(side) -value bottom -anchor w - radiobutton $subf.rad2 -text "Left" \ - -variable DemoDlg::tmpl(side) -value left -anchor w - radiobutton $subf.rad3 -text "Right" \ - -variable DemoDlg::tmpl(side) -value right -anchor w - radiobutton $subf.rad4 -text "Top" \ - -variable DemoDlg::tmpl(side) -value top -anchor w - - pack $subf.rad1 $subf.rad2 $subf.rad3 $subf.rad4 -fill x -anchor w - - set labf2 [LabelFrame $parent.labf2 -text "Button anchor" -side top \ - -anchor w -relief sunken -borderwidth 1] - set subf [$labf2 getframe] - radiobutton $subf.rad1 -text "North" \ - -variable DemoDlg::tmpl(anchor) -value n -anchor w - radiobutton $subf.rad2 -text "West" \ - -variable DemoDlg::tmpl(anchor) -value w -anchor w - radiobutton $subf.rad3 -text "East" \ - -variable DemoDlg::tmpl(anchor) -value e -anchor w - radiobutton $subf.rad4 -text "South" \ - -variable DemoDlg::tmpl(anchor) -value s -anchor w - radiobutton $subf.rad5 -text "Center" \ - -variable DemoDlg::tmpl(anchor) -value c -anchor w - - pack $subf.rad1 $subf.rad2 $subf.rad3 $subf.rad4 $subf.rad5 -fill x -anchor w - - set sep [Separator $parent.sep -orient horizontal] - set button [button $parent.but -text "Show" -command DemoDlg::_show_tmpldlg] - - pack $button -side bottom - pack $sep -side bottom -fill x -pady 10 - pack $labf1 $labf2 -side left -padx 4 -anchor n -} - - -proc DemoDlg::_msgdlg { parent } { - variable msg - - set msg(type) ok - set msg(icon) info - - set labf1 [LabelFrame $parent.labf1 -text "Type" -side top \ - -anchor w -relief sunken -borderwidth 1] - set subf [$labf1 getframe] - radiobutton $subf.rad1 -text "Ok" -variable DemoDlg::msg(type) -value ok -anchor w - radiobutton $subf.rad2 -text "Ok, Cancel" -variable DemoDlg::msg(type) -value okcancel -anchor w - radiobutton $subf.rad3 -text "Retry, Cancel" -variable DemoDlg::msg(type) -value retrycancel -anchor w - radiobutton $subf.rad4 -text "Yes, No" -variable DemoDlg::msg(type) -value yesno -anchor w - radiobutton $subf.rad5 -text "Yes, No, Cancel" -variable DemoDlg::msg(type) -value yesnocancel -anchor w - radiobutton $subf.rad6 -text "Abort, Retry, Ignore" -variable DemoDlg::msg(type) -value abortretryignore -anchor w - radiobutton $subf.rad7 -text "User" -variable DemoDlg::msg(type) -value user -anchor w - Entry $subf.user -textvariable DemoDlg::msg(buttons) - - pack $subf.rad1 $subf.rad2 $subf.rad3 $subf.rad4 $subf.rad5 $subf.rad6 -fill x -anchor w - pack $subf.rad7 $subf.user -side left - - set labf2 [LabelFrame $parent.labf2 -text "Icon" -side top -anchor w -relief sunken -borderwidth 1] - set subf [$labf2 getframe] - radiobutton $subf.rad1 -text "Information" -variable DemoDlg::msg(icon) -value info -anchor w - radiobutton $subf.rad2 -text "Question" -variable DemoDlg::msg(icon) -value question -anchor w - radiobutton $subf.rad3 -text "Warning" -variable DemoDlg::msg(icon) -value warning -anchor w - radiobutton $subf.rad4 -text "Error" -variable DemoDlg::msg(icon) -value error -anchor w - pack $subf.rad1 $subf.rad2 $subf.rad3 $subf.rad4 -fill x -anchor w - - - set sep [Separator $parent.sep -orient horizontal] - set button [button $parent.but -text "Show" -command DemoDlg::_show_msgdlg] - - pack $button -side bottom - pack $sep -side bottom -fill x -pady 10 - pack $labf1 $labf2 -side left -padx 4 -anchor n -} - - -proc DemoDlg::_stddlg { parent } { - set but0 [button $parent.but0 \ - -text "Select a color " \ - -command "DemoDlg::_show_color $parent.but0"] - set but1 [button $parent.but1 \ - -text "Font selector dialog" \ - -command DemoDlg::_show_fontdlg] - set but2 [button $parent.but2 \ - -text "Progression dialog" \ - -command DemoDlg::_show_progdlg] - set but3 [button $parent.but3 \ - -text "Password dialog" \ - -command DemoDlg::_show_passdlg] - - pack $but0 $but1 $but2 $but3 -side left -padx 5 -anchor w -} - -proc DemoDlg::_show_color {w} { - set color [SelectColor::menu $w.color [list below $w] \ - -color [$w cget -background] \ - -command [list $w configure -background]] - if {[string length $color]} { - $w configure -background $color - } -} - -proc DemoDlg::_show_tmpldlg { } { - variable tmpl - - set dlg [Dialog .tmpldlg -parent . -modal local \ - -separator 1 \ - -title "Template dialog" \ - -side $tmpl(side) \ - -anchor $tmpl(anchor) \ - -default 0 -cancel 1] - $dlg add -name ok - $dlg add -name cancel - set msg [message [$dlg getframe].msg -text "Template\nDialog" -justify center -anchor c] - pack $msg -fill both -expand yes -padx 100 -pady 100 - $dlg draw - destroy $dlg -} - - -proc DemoDlg::_show_msgdlg { } { - variable msg - - destroy .msgdlg - MessageDlg .msgdlg -parent . \ - -message "Message for MessageBox" \ - -type $msg(type) \ - -icon $msg(icon) \ - -buttons $msg(buttons) -} - - -proc DemoDlg::_show_fontdlg { } { - set font [SelectFont .fontdlg -parent . -font $Demo::font] - if { $font != "" } { - Demo::update_font $font - } -} - - -proc DemoDlg::_show_progdlg { } { - set DemoDlg::progmsg "Compute in progress..." - set DemoDlg::progval 0 - - ProgressDlg .progress -parent . -title "Wait..." \ - -type infinite \ - -width 20 \ - -textvariable DemoDlg::progmsg \ - -variable DemoDlg::progval \ - -stop "Stop" \ - -command {destroy .progress} - _update_progdlg -} - - -proc DemoDlg::_update_progdlg { } { - if { [winfo exists .progress] } { - set DemoDlg::progval 2 - after 20 DemoDlg::_update_progdlg - } -} - -proc DemoDlg::_show_passdlg { } { - PasswdDlg .passwd -parent . -} - + +namespace eval DemoDlg { + variable tmpl + variable msg + variable progmsg + variable progval + variable resources "en" +} + + +proc DemoDlg::create { nb } { + set frame [$nb insert end demoDlg -text "Dialog"] + + set titf1 [TitleFrame $frame.titf1 -text "Resources"] + set titf2 [TitleFrame $frame.titf2 -text "Template Dialog"] + set titf3 [TitleFrame $frame.titf3 -text "Message Dialog"] + set titf4 [TitleFrame $frame.titf4 -text "Other dialog"] + + set subf [$titf1 getframe] + set cmd {BWidget::changeLang $DemoDlg::resources} + set rad1 [radiobutton $subf.rad1 -text "English" \ + -variable DemoDlg::resources -value en \ + -command $cmd] + set rad2 [radiobutton $subf.rad2 -text "French" \ + -variable DemoDlg::resources -value fr \ + -command $cmd] + set rad3 [radiobutton $subf.rad3 -text "German" \ + -variable DemoDlg::resources -value de \ + -command $cmd] + set rad4 [radiobutton $subf.rad4 -text "Spanish" \ + -variable DemoDlg::resources -value es \ + -command $cmd] + set rad5 [radiobutton $subf.rad5 -text "Polish" \ + -variable DemoDlg::resources -value po \ + -command $cmd] + set rad6 [radiobutton $subf.rad6 -text "Norwegian" \ + -variable DemoDlg::resources -value no \ + -command $cmd] + set rad7 [radiobutton $subf.rad7 -text "Nederlans" \ + -variable DemoDlg::resources -value nl \ + -command $cmd] + pack $rad1 $rad2 $rad3 $rad4 $rad5 $rad6 $rad7 -side left + + _tmpldlg [$titf2 getframe] + _msgdlg [$titf3 getframe] + _stddlg [$titf4 getframe] + + pack $titf1 -fill x -pady 2 -padx 2 + pack $titf4 -side bottom -fill x -pady 2 -padx 2 + pack $titf2 $titf3 -side left -padx 2 -fill both -expand yes +} + + +proc DemoDlg::_tmpldlg { parent } { + variable tmpl + + set tmpl(side) bottom + set tmpl(anchor) c + + set labf1 [LabelFrame $parent.labf1 -text "Button side" -side top \ + -anchor w -relief sunken -borderwidth 1] + set subf [$labf1 getframe] + radiobutton $subf.rad1 -text "Bottom" \ + -variable DemoDlg::tmpl(side) -value bottom -anchor w + radiobutton $subf.rad2 -text "Left" \ + -variable DemoDlg::tmpl(side) -value left -anchor w + radiobutton $subf.rad3 -text "Right" \ + -variable DemoDlg::tmpl(side) -value right -anchor w + radiobutton $subf.rad4 -text "Top" \ + -variable DemoDlg::tmpl(side) -value top -anchor w + + pack $subf.rad1 $subf.rad2 $subf.rad3 $subf.rad4 -fill x -anchor w + + set labf2 [LabelFrame $parent.labf2 -text "Button anchor" -side top \ + -anchor w -relief sunken -borderwidth 1] + set subf [$labf2 getframe] + radiobutton $subf.rad1 -text "North" \ + -variable DemoDlg::tmpl(anchor) -value n -anchor w + radiobutton $subf.rad2 -text "West" \ + -variable DemoDlg::tmpl(anchor) -value w -anchor w + radiobutton $subf.rad3 -text "East" \ + -variable DemoDlg::tmpl(anchor) -value e -anchor w + radiobutton $subf.rad4 -text "South" \ + -variable DemoDlg::tmpl(anchor) -value s -anchor w + radiobutton $subf.rad5 -text "Center" \ + -variable DemoDlg::tmpl(anchor) -value c -anchor w + + pack $subf.rad1 $subf.rad2 $subf.rad3 $subf.rad4 $subf.rad5 -fill x -anchor w + + set sep [Separator $parent.sep -orient horizontal] + set button [button $parent.but -text "Show" -command DemoDlg::_show_tmpldlg] + + pack $button -side bottom + pack $sep -side bottom -fill x -pady 10 + pack $labf1 $labf2 -side left -padx 4 -anchor n +} + + +proc DemoDlg::_msgdlg { parent } { + variable msg + + set msg(type) ok + set msg(icon) info + + set labf1 [LabelFrame $parent.labf1 -text "Type" -side top \ + -anchor w -relief sunken -borderwidth 1] + set subf [$labf1 getframe] + radiobutton $subf.rad1 -text "Ok" -variable DemoDlg::msg(type) -value ok -anchor w + radiobutton $subf.rad2 -text "Ok, Cancel" -variable DemoDlg::msg(type) -value okcancel -anchor w + radiobutton $subf.rad3 -text "Retry, Cancel" -variable DemoDlg::msg(type) -value retrycancel -anchor w + radiobutton $subf.rad4 -text "Yes, No" -variable DemoDlg::msg(type) -value yesno -anchor w + radiobutton $subf.rad5 -text "Yes, No, Cancel" -variable DemoDlg::msg(type) -value yesnocancel -anchor w + radiobutton $subf.rad6 -text "Abort, Retry, Ignore" -variable DemoDlg::msg(type) -value abortretryignore -anchor w + radiobutton $subf.rad7 -text "User" -variable DemoDlg::msg(type) -value user -anchor w + Entry $subf.user -textvariable DemoDlg::msg(buttons) + + pack $subf.rad1 $subf.rad2 $subf.rad3 $subf.rad4 $subf.rad5 $subf.rad6 -fill x -anchor w + pack $subf.rad7 $subf.user -side left + + set labf2 [LabelFrame $parent.labf2 -text "Icon" -side top -anchor w -relief sunken -borderwidth 1] + set subf [$labf2 getframe] + radiobutton $subf.rad1 -text "Information" -variable DemoDlg::msg(icon) -value info -anchor w + radiobutton $subf.rad2 -text "Question" -variable DemoDlg::msg(icon) -value question -anchor w + radiobutton $subf.rad3 -text "Warning" -variable DemoDlg::msg(icon) -value warning -anchor w + radiobutton $subf.rad4 -text "Error" -variable DemoDlg::msg(icon) -value error -anchor w + pack $subf.rad1 $subf.rad2 $subf.rad3 $subf.rad4 -fill x -anchor w + + + set sep [Separator $parent.sep -orient horizontal] + set button [button $parent.but -text "Show" -command DemoDlg::_show_msgdlg] + + pack $button -side bottom + pack $sep -side bottom -fill x -pady 10 + pack $labf1 $labf2 -side left -padx 4 -anchor n +} + + +proc DemoDlg::_stddlg { parent } { + set but0 [button $parent.but0 \ + -text "Select a color " \ + -command "DemoDlg::_show_color $parent.but0"] + set but1 [button $parent.but1 \ + -text "Font selector dialog" \ + -command DemoDlg::_show_fontdlg] + set but2 [button $parent.but2 \ + -text "Progression dialog" \ + -command DemoDlg::_show_progdlg] + set but3 [button $parent.but3 \ + -text "Password dialog" \ + -command DemoDlg::_show_passdlg] + + pack $but0 $but1 $but2 $but3 -side left -padx 5 -anchor w +} + +proc DemoDlg::_show_color {w} { + set color [SelectColor::menu $w.color [list below $w] \ + -color [$w cget -background] \ + -command [list $w configure -background]] + if {[string length $color]} { + $w configure -background $color + } +} + +proc DemoDlg::_show_tmpldlg { } { + variable tmpl + + set dlg [Dialog .tmpldlg -parent . -modal local \ + -separator 1 \ + -title "Template dialog" \ + -side $tmpl(side) \ + -anchor $tmpl(anchor) \ + -default 0 -cancel 1] + $dlg add -name ok + $dlg add -name cancel + set msg [message [$dlg getframe].msg -text "Template\nDialog" -justify center -anchor c] + pack $msg -fill both -expand yes -padx 100 -pady 100 + $dlg draw + destroy $dlg +} + + +proc DemoDlg::_show_msgdlg { } { + variable msg + + destroy .msgdlg + MessageDlg .msgdlg -parent . \ + -message "Message for MessageBox" \ + -type $msg(type) \ + -icon $msg(icon) \ + -buttons $msg(buttons) +} + + +proc DemoDlg::_show_fontdlg { } { + set font [SelectFont .fontdlg -parent . -font $Demo::font] + if { $font != "" } { + Demo::update_font $font + } +} + + +proc DemoDlg::_show_progdlg { } { + set DemoDlg::progmsg "Compute in progress..." + set DemoDlg::progval 0 + + ProgressDlg .progress -parent . -title "Wait..." \ + -type infinite \ + -width 20 \ + -textvariable DemoDlg::progmsg \ + -variable DemoDlg::progval \ + -stop "Stop" \ + -command {destroy .progress} + _update_progdlg +} + + +proc DemoDlg::_update_progdlg { } { + if { [winfo exists .progress] } { + set DemoDlg::progval 2 + after 20 DemoDlg::_update_progdlg + } +} + +proc DemoDlg::_show_passdlg { } { + PasswdDlg .passwd -parent . +} + Index: init.tcl ================================================================== --- init.tcl +++ init.tcl @@ -1,55 +1,53 @@ -namespace eval Widget {} -proc Widget::_opt_defaults {{prio widgetDefault}} { - if {$::tcl_version >= 8.4} { - set plat [tk windowingsystem] - } else { - set plat $::tcl_platform(platform) - } - switch -exact $plat { - "aqua" { - } - "win32" - - "windows" { - #option add *Listbox.background SystemWindow $prio - option add *ListBox.background SystemWindow $prio - #option add *Button.padY 0 $prio - option add *ButtonBox.padY 0 $prio - option add *Dialog.padY 0 $prio - option add *Dialog.anchor e $prio - } - "x11" - - default { - option add *Scrollbar.width 12 $prio - option add *Scrollbar.borderWidth 1 $prio - option add *Dialog.separator 1 $prio - option add *MainFrame.relief raised $prio - option add *MainFrame.separator none $prio - } - } -} -Widget::_opt_defaults - -# Try to load lang file corresponding to current msgcat locale -proc Widget::_opt_lang {} { - if {0 != [llength [info commands ::msgcat::mcpreferences]]} { - set langs [::msgcat::mcpreferences] - } - lappend langs en - - foreach lang $langs { - set l [file join $::BWIDGET::LIBRARY "lang" "$lang.rc"] - if {(![catch {file readable $l} result]) && ($result)} { - option read $l - break - } - } -} -Widget::_opt_lang - -## Add a TraverseIn binding to standard Tk widgets to handle some of -## the BWidget-specific things we do. -bind Entry <> { %W selection range 0 end; %W icursor end } -bind Spinbox <> { %W selection range 0 end; %W icursor end } - -bind all { Widget::traverseTo [Widget::focusNext %W] } -bind all <> { Widget::traverseTo [Widget::focusPrev %W] } +namespace eval Widget {} +proc Widget::_opt_defaults {{prio widgetDefault}} { + if {$::tcl_version >= 8.4} { + set plat [tk windowingsystem] + } else { + set plat $::tcl_platform(platform) + } + switch -exact $plat { + "aqua" { + } + "win32" - + "windows" { + #option add *Listbox.background SystemWindow $prio + option add *ListBox.background SystemWindow $prio + #option add *Button.padY 0 $prio + option add *ButtonBox.padY 0 $prio + option add *Dialog.padY 0 $prio + option add *Dialog.anchor e $prio + } + "x11" - + default { + option add *Scrollbar.width 12 $prio + option add *Scrollbar.borderWidth 1 $prio + option add *Dialog.separator 1 $prio + option add *MainFrame.relief raised $prio + option add *MainFrame.separator none $prio + } + } +} +Widget::_opt_defaults + +# Try to load lang file corresponding to current msgcat locale +proc Widget::_opt_lang {} { + if {![catch {package require msgcat}]} { + # package loaded + namespace import ::msgcat::* + if {![::msgcat::mcload [file join $::BWIDGET::LIBRARY "lang"]]} { + # no files loaded, default to english + ::msgcat::mclocale en + ::msgcat::mcload [file join $::BWIDGET::LIBRARY "lang"] + } + source [file join $::BWIDGET::LIBRARY "lang" "xopt.tcl"] + } +} +Widget::_opt_lang + +## Add a TraverseIn binding to standard Tk widgets to handle some of +## the BWidget-specific things we do. +bind Entry <> { %W selection range 0 end; %W icursor end } +bind Spinbox <> { %W selection range 0 end; %W icursor end } + +bind all { Widget::traverseTo [Widget::focusNext %W] } +bind all <> { Widget::traverseTo [Widget::focusPrev %W] } ADDED lang/da.msg Index: lang/da.msg ================================================================== --- /dev/null +++ lang/da.msg @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------------------ +# da.msg +# This file is part of Unifix BWidget Toolkit +# Definition of da translation +# ------------------------------------------------------------------------------ + +# --- symbolic names of buttons ----------------------------------------------- + +::msgcat::mcset da {&Abort} {&Annullér} +::msgcat::mcset da {&Retry} {P&røv igen} +::msgcat::mcset da {&Ignore} {&Ignorer} +::msgcat::mcset da {&OK} {&OK} +::msgcat::mcset da {&Cancel} {&Cancel} +::msgcat::mcset da {&Yes} {&Ja} +::msgcat::mcset da {&No} {&Nej} + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +::msgcat::mcset da {Bold} {Fed} +::msgcat::mcset da {Italic} {Kursiv} +::msgcat::mcset da {Underline} {Understreg} +::msgcat::mcset da {Overstrike} {Overstreg} +::msgcat::mcset da {&Font} {&Font} +::msgcat::mcset da {&Size} {&Størrelse} +::msgcat::mcset da {St&yle} {St&il} +::msgcat::mcset da {&Color...} {F&arve...} + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +::msgcat::mcset da {&Login} {&Brugernavn} +::msgcat::mcset da {&Password} {&Password} + +# --- resource for SelectFont dialog ------------------------------------------ + +::msgcat::mcset da {Font selection} {Font-valg} +::msgcat::mcset da {Sample text} {Eksempeltekst æøå} + +# --- resource for MessageDlg dialog ------------------------------------------ + +::msgcat::mcset da {Message} {Besked} +::msgcat::mcset da {Information} {Information} +::msgcat::mcset da {Question} {Spørgsmål} +::msgcat::mcset da {Warning} {Advarsel} +::msgcat::mcset da {Error} {Fejl} + +# --- resource for PasswdDlg dialog ------------------------------------------- + +::msgcat::mcset da {Enter login and password} {Indtast brugernavn og password} + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +::msgcat::mcset da {Base colors} {Grundfarver} +::msgcat::mcset da {User colors} {Brugerdefinerede farver} +::msgcat::mcset da {Your Selection} {Dit valg} +::msgcat::mcset da {Color Selectors} {Farvervælger} + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +::msgcat::mcset da {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} {Klik eller træk musen i farvervælgeren for at vælge en farve.\nHvis den valgte farve altid er sort, uanset værdierne til venstre,\ntjek intensitetsværdien til højere.\n\nKlik en af "grundfarverne" for at aflæse værdierne fra paletten,\neller for at tildele en, hvis farven er sort. Hvis du efterfølgende\nbruger farvevælgeren til at ændre en farver, gemmes ændringen under\nbrugerdefinerede farver indtil en ny paletfarve er valgt.} +::msgcat::mcset da {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} {Klik i tekstboksen til venstre i "dit valg" området.\n\nIndtast den ønskede farve i hexadecimalt RGB-format.\nVærdien er gyldig når den består af et antal cifre deleligt med 3,\ni så fald opdateres resten af farvervælgeren.\n\nForlad tekstboksen ved at klikke andetsteds, eller ved at taste\n"Escape" eller "Return". Tekstboksen viser efterfølgende farven i\n24-bit RGB-format, dog arbejder farvevælgeren internt med\n48-bit værdier.\n\nNår tekstboksen ikke har fokus fungerer "Return" og "Escape"\ntasterne lige som henholdsvis "OK" og "Annullér".} ADDED lang/de.msg Index: lang/de.msg ================================================================== --- /dev/null +++ lang/de.msg @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------------------ +# de.msg +# This file is part of Unifix BWidget Toolkit +# Definition of de translation +# ------------------------------------------------------------------------------ + +# --- symbolic names of buttons ------------------------------------------------ + +::msgcat::mcset de {&Abort} {&Abbrechen} +::msgcat::mcset de {&Retry} {&Wiederholen} +::msgcat::mcset de {&Ignore} {&Ignorieren} +::msgcat::mcset de {&OK} {&OK} +::msgcat::mcset de {&Cancel} {&Abbrechen} +::msgcat::mcset de {&Yes} {&Ja} +::msgcat::mcset de {&No} {&Nein} + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +::msgcat::mcset de {Bold} {Fett} +::msgcat::mcset de {Italic} {Kursiv} +::msgcat::mcset de {Underline} {Unterstrichen} +::msgcat::mcset de {Overstrike} {Durchgestrichen} +::msgcat::mcset de {&Font} {&Schriftart} +::msgcat::mcset de {&Size} {S&chriftgrad} +::msgcat::mcset de {St&yle} {Sc&hriftschnitt} +::msgcat::mcset de {&Color...} {&Farbe...} + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +::msgcat::mcset de {&Login} {&Login} +::msgcat::mcset de {&Password} {&Password} + +# --- resource for SelectFont dialog ------------------------------------------ + +::msgcat::mcset de {Font selection} {Schrift Auswahl} +::msgcat::mcset de {Sample text} {Beispieltext} + +# --- resource for MessageDlg dialog ------------------------------------------ + +::msgcat::mcset de {Message} {Meldung} +::msgcat::mcset de {Information} {Hinweis} +::msgcat::mcset de {Question} {Frage} +::msgcat::mcset de {Warning} {Warnung} +::msgcat::mcset de {Error} {Fehler} + +# --- resource for PasswdDlg dialog ------------------------------------------- + +::msgcat::mcset de {Enter login and password} {Enter login and password} + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +::msgcat::mcset de {Base colors} {Grundfarben} +::msgcat::mcset de {User colors} {Benutzerdefinierte Farben} +::msgcat::mcset de {Your Selection} {Gewählte Farbe} +::msgcat::mcset de {Color Selectors} {Farbraum} + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +::msgcat::mcset de {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} {Um eine Farbe zu wählen bitte im Farbraum und im Helligkeitsregler\nklicken oder ziehen. Bleibt die gewählte Farbe wieder erwarten schwarz,\nso muß die Helligkeit ganz rechts erhöht werden.\n\nMit einem Klick auf die Grundfarbenpalette kann diese gewählt werden.\n\nEin benutzerdefinierter Farbspeicher kann durch einen Klick selektiert\nwerden. Ab dann wird jede Farbveränderung auch in den Farbspeicher\n geschrieben.} +::msgcat::mcset de {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} {Aktivieren sie das Texteingabefenster mit einem Klick oder mit der\nTabulatortaste. Eine Farbe kann als RGB-Wert eingegeben mit 3 oder 6\nhexadezimalen Ziffern eingegeben werden.\n\nDie Eingabe kann mit der Escape- oder Eingabetaste abgeschlossen werden.\n\nAusserhalb des Eingabefensters wird der Dialog mit der Eingabetaste\nbestätigt und mit der Escapetaste zurückgenommen.} ADDED lang/en.msg Index: lang/en.msg ================================================================== --- /dev/null +++ lang/en.msg @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------------------ +# en.msg +# This file is part of Unifix BWidget Toolkit +# Definition of en translation +# ------------------------------------------------------------------------------ + +# --- symbolic names of buttons ------------------------------------------------ + +::msgcat::mcset en {&Abort} {&Abort} +::msgcat::mcset en {&Retry} {&Retry} +::msgcat::mcset en {&Ignore} {&Ignore} +::msgcat::mcset en {&OK} {&OK} +::msgcat::mcset en {&Cancel} {&Cancel} +::msgcat::mcset en {&Yes} {&Yes} +::msgcat::mcset en {&No} {&No} + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +::msgcat::mcset en {Bold} {Bold} +::msgcat::mcset en {Italic} {Italic} +::msgcat::mcset en {Underline} {Underline} +::msgcat::mcset en {Overstrike} {Overstrike} +::msgcat::mcset en {&Font} {&Font} +::msgcat::mcset en {&Size} {&Size} +::msgcat::mcset en {St&yle} {St&yle} +::msgcat::mcset en {&Color...} {&Color...} + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +::msgcat::mcset en {&Login} {&Login} +::msgcat::mcset en {&Password} {&Password} + +# --- resource for SelectFont dialog ------------------------------------------ + +::msgcat::mcset en {Font selection} {Font selection} +::msgcat::mcset en {Sample text} {Sample text} + +# --- resource for MessageDlg dialog ------------------------------------------ + +::msgcat::mcset en {Message} {Message} +::msgcat::mcset en {Information} {Information} +::msgcat::mcset en {Question} {Question} +::msgcat::mcset en {Warning} {Warning} +::msgcat::mcset en {Error} {Error} + +# --- resource for PasswdDlg dialog ------------------------------------------- + +::msgcat::mcset en {Enter login and password} {Enter login and password} + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +::msgcat::mcset en {Base colors} {Base colors} +::msgcat::mcset en {User colors} {User colors} +::msgcat::mcset en {Your Selection} {Your Selection} +::msgcat::mcset en {Color Selectors} {Color Selectors} + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +::msgcat::mcset en {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} +::msgcat::mcset en {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} ADDED lang/es.msg Index: lang/es.msg ================================================================== --- /dev/null +++ lang/es.msg @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------------------ +# es.msg +# This file is part of Unifix BWidget Toolkit +# Definition of es translation +# ------------------------------------------------------------------------------ + +# --- symbolic names of buttons ------------------------------------------------ + +::msgcat::mcset es {&Abort} {&Abortar} +::msgcat::mcset es {&Retry} {&Reintentar} +::msgcat::mcset es {&Ignore} {&Ignorar} +::msgcat::mcset es {&OK} {&OK} +::msgcat::mcset es {&Cancel} {&Cancelar} +::msgcat::mcset es {&Yes} {&Sí} +::msgcat::mcset es {&No} {&No} + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +::msgcat::mcset es {Bold} {Negrita} +::msgcat::mcset es {Italic} {Cursiva} +::msgcat::mcset es {Underline} {Subrayado} +::msgcat::mcset es {Overstrike} {Tachado} +::msgcat::mcset es {&Font} {&Fuente} +::msgcat::mcset es {&Size} {&Tamaño} +::msgcat::mcset es {St&yle} {&Estilo} +::msgcat::mcset es {&Color...} {&Color...} + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +::msgcat::mcset es {&Login} {&Usuario} +::msgcat::mcset es {&Password} {&Contraseña} + +# --- resource for SelectFont dialog ------------------------------------------ + +::msgcat::mcset es {Font selection} {Selección de fuente} +::msgcat::mcset es {Sample text} {Texto de Ejemplo} + +# --- resource for MessageDlg dialog ------------------------------------------ + +::msgcat::mcset es {Message} {Mensaje} +::msgcat::mcset es {Information} {Información} +::msgcat::mcset es {Question} {Pregunta} +::msgcat::mcset es {Warning} {Aviso} +::msgcat::mcset es {Error} {Error} + +# --- resource for PasswdDlg dialog ------------------------------------------- + +::msgcat::mcset es {Enter login and password} {Introduzca su usuario y contraseña} + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +::msgcat::mcset es {Base colors} {Colores base} +::msgcat::mcset es {User colors} {Colores de usuario} +::msgcat::mcset es {Your Selection} {Su selección} +::msgcat::mcset es {Color Selectors} {Selectores de color} + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +::msgcat::mcset es {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} {Haga click o arrastre el ratón en los selectores de color para elegir un color.\nSi el color seleccionado permanece negro, sin importar lo que haga en el selector de\ncolor izquierdo (para tono y saturación), compruebe la posición del puntero en el selector\nde color derecho (para brillo).\n\nHaga click en uno de los "Colores base" para leer un valor de esa paleta.\n\nClick en uno de los "Colores de usuario" para leer un valor de esa paleta, o para escribir\nla paleta si el color está vacio. Si luego usted usa los Selectores de color para cambiar\nel color, su elección se escribirá en ese color de la paleta (de usuario) hasta seleccionar\notro color de la paleta (base o de usuario).} +::msgcat::mcset es {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} {Haga click en la ventana de entrada de texto a la izquierda del área "Su\nSelección".\n\nTeclee el color que desee en formato RGB hexadecimal. Siempre que el número de dígitos\nhexadecimales sea múltiplo de 3, el valor de color es válido y se copiará a las\notras partes del Selector de Color.\n\nSalga de la ventana de entrada de texto haciendo click en otro lugar, o presionando la\ntecla "Escape" o "Enter". La ventana de entrada de texto mostrará entonces el color en\nformato RGB 24-bit, aunque internamente el Selector de Color usa colores de 48-bit.\n\nCuando el control de entrada de texto no tenga el foco de teclado (ej, no muestra un\ncursor), las teclas "Enter" y "Escape" hacen lo mismo que los botones "OK" y "Cancel",\nrespectivamente.} ADDED lang/fr.msg Index: lang/fr.msg ================================================================== --- /dev/null +++ lang/fr.msg @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------------------ +# fr.msg +# This file is part of Unifix BWidget Toolkit +# Definition of fr translation +# ------------------------------------------------------------------------------ + +# --- symbolic names of buttons ------------------------------------------------ + +::msgcat::mcset fr {&Abort} {A&bandonner} +::msgcat::mcset fr {&Retry} {&Réessayer} +::msgcat::mcset fr {&Ignore} {&Ignorer} +::msgcat::mcset fr {&OK} {&OK} +::msgcat::mcset fr {&Cancel} {&Annuler} +::msgcat::mcset fr {&Yes} {&Oui} +::msgcat::mcset fr {&No} {&Non} + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +::msgcat::mcset fr {Bold} {&Gras} +::msgcat::mcset fr {Italic} {&Italique} +::msgcat::mcset fr {Underline} {&Souligné} +::msgcat::mcset fr {Overstrike} {&Barré} +::msgcat::mcset fr {&Font} {&Police} +::msgcat::mcset fr {&Size} {&Taille} +::msgcat::mcset fr {St&yle} {St&yle} +::msgcat::mcset fr {&Color...} {&Couleur...} + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +::msgcat::mcset fr {&Login} {Nom de l'&utilisateur} +::msgcat::mcset fr {&Password} {Mot de &passe} + +# --- resource for SelectFont dialog ------------------------------------------ + +::msgcat::mcset fr {Font selection} {Sélection d'une police} +::msgcat::mcset fr {Sample text} {Texte d'exemple} + +# --- resource for MessageDlg dialog ------------------------------------------ + +::msgcat::mcset fr {Message} {Message} +::msgcat::mcset fr {Information} {Information} +::msgcat::mcset fr {Question} {Question} +::msgcat::mcset fr {Warning} {Attention} +::msgcat::mcset fr {Error} {Erreur} + +# --- resource for PasswdDlg dialog ------------------------------------------- + +::msgcat::mcset fr {Enter login and password} {Entrez le login et le mot de passe} + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +::msgcat::mcset fr {Base colors} {Couleurs de base} +::msgcat::mcset fr {User colors} {Couleurs utilisateur} +::msgcat::mcset fr {Your Selection} {Votre sélection} +::msgcat::mcset fr {Color Selectors} {Sélecteur de couleurs} + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +::msgcat::mcset fr {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} {Cliquez ou déplacez la souris dans la palette pour choisir une couleur.\nSi la couleur affichée reste noire quelle que soit la sélection dans la palette (teinte et\nsaturation), vérifiez la position du pointeur dans le sélecteur de droite (luminosité).\n\nCliquez sur l'une des "Couleurs de base" pour la sélectionner.\n\nCliquez sur l'une des "Couleurs utilisateurs" pour la sélectionner, ou pour la\nsauver dans la palette utilisateur dans une case blanche. Les modifications via le\nsélecteur de couleurs sont alors propagées dans la case sélectionnée de la palette\nutilisateur jusqu'à ce qu'une autre couleur (de base ou utilisateur) soit sélectionnée.} +::msgcat::mcset fr {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} {Cliquez dans la zone de saisie à gauche, dans la zone "Votre sélection".\n\nEntrez la couleur désirée au format RGB hexadécimal.\nLa valeur est validée lorsque le nombre de chiffres hexadécimaux est un multiple de 3.\nElle est alors propagée aux autres zones du sélecteur de couleurs.\n\nLa zone de saisie peut être quittée en cliquant n'importe où ailleurs ou en appuyant sur la\ntouche "Escape" ou "Entrée" du clavier. Bien que le sélecteur de couleurs utilise\n48 bits en interne, la zone de saisie affichera alors la couleur au format RGB en\nhexadécimal sur 24 bits.\n\nLorsque la zone de saisie n'a pas le focus (i.e. ne montre pas le curseur), les touches\n"Entrée" et "Escape" ont la même fonction que les boutons "OK" et "Annuler" respectivement.} ADDED lang/hu.msg Index: lang/hu.msg ================================================================== --- /dev/null +++ lang/hu.msg @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------------------ +# hu.msg +# This file is part of Unifix BWidget Toolkit +# Definition of hu translation +# ------------------------------------------------------------------------------ + +# --- symbolic names of buttons ------------------------------------------------ + +::msgcat::mcset hu {&Abort} {&Megszakítás} +::msgcat::mcset hu {&Retry} {Új&ra} +::msgcat::mcset hu {&Ignore} {&Kihagyás} +::msgcat::mcset hu {&OK} {&OK} +::msgcat::mcset hu {&Cancel} {Még&sem} +::msgcat::mcset hu {&Yes} {&Igen} +::msgcat::mcset hu {&No} {&Nem} + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +::msgcat::mcset hu {Bold} {Félkövér} +::msgcat::mcset hu {Italic} {Dőlt} +::msgcat::mcset hu {Underline} {Aláhúzott} +::msgcat::mcset hu {Overstrike} {Felülírás} +::msgcat::mcset hu {&Font} {&Betűtípus} +::msgcat::mcset hu {&Size} {&Méret} +::msgcat::mcset hu {St&yle} {S&tílus} +::msgcat::mcset hu {&Color...} {&Szín...} + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +::msgcat::mcset hu {&Login} {&Felhasználónév} +::msgcat::mcset hu {&Password} {&Jelszó} + +# --- resource for SelectFont dialog ------------------------------------------ + +::msgcat::mcset hu {Font selection} {Betűtípus kiválasztása} +::msgcat::mcset hu {Sample text} {Példaszöveg} + +# --- resource for MessageDlg dialog ------------------------------------------ + +::msgcat::mcset hu {Message} {Üzenet} +::msgcat::mcset hu {Information} {Információ} +::msgcat::mcset hu {Question} {Kérdés} +::msgcat::mcset hu {Warning} {Figyelmeztetés} +::msgcat::mcset hu {Error} {Hiba} + +# --- resource for PasswdDlg dialog ------------------------------------------- + +::msgcat::mcset hu {Enter login and password} {Add meg a felhasználónevet és a jelszót} + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +::msgcat::mcset hu {Base colors} {Alapszínek} +::msgcat::mcset hu {User colors} {Felhasználói színek} +::msgcat::mcset hu {Your Selection} {Your Selection} +::msgcat::mcset hu {Color Selectors} {Color Selectors} + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +::msgcat::mcset hu {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} +::msgcat::mcset hu {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} ADDED lang/nl.msg Index: lang/nl.msg ================================================================== --- /dev/null +++ lang/nl.msg @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------------------ +# nl.msg +# This file is part of Unifix BWidget Toolkit +# Definition of nl translation +# ------------------------------------------------------------------------------ + +# --- symbolic names of buttons ------------------------------------------------ + +::msgcat::mcset nl {&Abort} {Af&breken} +::msgcat::mcset nl {&Retry} {Opnie&uw proberen} +::msgcat::mcset nl {&Ignore} {N&egeren} +::msgcat::mcset nl {&OK} {&OK} +::msgcat::mcset nl {&Cancel} {&Annuleren} +::msgcat::mcset nl {&Yes} {&Ja} +::msgcat::mcset nl {&No} {&Nee} + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +::msgcat::mcset nl {Bold} {Vet} +::msgcat::mcset nl {Italic} {Cursief} +::msgcat::mcset nl {Underline} {Onderstrepen} +::msgcat::mcset nl {Overstrike} {Doorhalen} +::msgcat::mcset nl {&Font} {&Lettertype} +::msgcat::mcset nl {&Size} {&Grootte} +::msgcat::mcset nl {St&yle} {&Stijl} +::msgcat::mcset nl {&Color...} {&Kleur...} + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +::msgcat::mcset nl {&Login} {&Inlognaam} +::msgcat::mcset nl {&Password} {&Wachtwoord} + +# --- resource for SelectFont dialog ------------------------------------------ + +::msgcat::mcset nl {Font selection} {Lettertypeselectie} +::msgcat::mcset nl {Sample text} {Voorbeeldtekst} + +# --- resource for MessageDlg dialog ------------------------------------------ + +::msgcat::mcset nl {Message} {Bericht} +::msgcat::mcset nl {Information} {Informatie} +::msgcat::mcset nl {Question} {Vraag} +::msgcat::mcset nl {Warning} {Waarschuwing} +::msgcat::mcset nl {Error} {Fout} + +# --- resource for PasswdDlg dialog ------------------------------------------- + +::msgcat::mcset nl {Enter login and password} {Voer inlognaam en wachtwoord in} + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +::msgcat::mcset nl {Base colors} {Basiskleuren} +::msgcat::mcset nl {User colors} {Aangepaste kleuren} +::msgcat::mcset nl {Your Selection} {Uw selectie} +::msgcat::mcset nl {Color Selectors} {Selecteren kleuren} + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +::msgcat::mcset nl {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} {Klik of sleep de muis in de kleurselectors om een kleur te kiezen.\nAls de geselecteerde kleur zwart blijft, ongeacht wat je doet in het\nlinkerdeel (tint en verzadiging), controleer de positie van de muispointer\nin het rechterdeel (helderheid).\n\nKlik op een van de basiskleuren om een waarde uit dit palet te lezen.\n\nKlik op een van de basiskleuren om een waarde uit dit palet te lezen of\nom een nieuwe waarde in te voeren als het vakje leeg is. Als je dan de\nkleurselectors gebruikt om de kleur te wijzigen, dan wordt die nieuwe\nkeuze naar het aanpasbare kleurvakje geschreven tot je een andere\nbasiskleur of aanpasbare kleur kiest.} +::msgcat::mcset nl {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} {Klik in het invoerveld links van het deel "Uw selectie".\nTyp de gewenste kleur in volgens het hexadecimale RGB-format.\nDe kleurwaarde is acceptabel als het aantal hexadecimale cijfers een\nveelvoud is van 3. De waarde wordt gekopieerd naar andere delen van de\nkleurselector.\n\nVerlaat het invoerveld door ergens anders te klikken of via "Escape" of\n"Return". Het invoerveld toont dan de kleur in 24-bits RGB-format\n(overigens wordt intern een 48-bits RGB-format gebruikt).\n\nAls het invoerveld niet de focus heeft (geen tekstcursor vertoont), dan\nwerken de "Return"- en "Escape"-toetsen net als de "OK"- en\n"Cancel"-buttons.} ADDED lang/no.msg Index: lang/no.msg ================================================================== --- /dev/null +++ lang/no.msg @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------------------ +# no.msg +# This file is part of Unifix BWidget Toolkit +# Definition of no translation +# ------------------------------------------------------------------------------ + +# --- symbolic names of buttons ------------------------------------------------ + +::msgcat::mcset no {&Abort} {&Om} +::msgcat::mcset no {&Retry} {&Prøv igjen} +::msgcat::mcset no {&Ignore} {&Ignore} +::msgcat::mcset no {&OK} {&OK} +::msgcat::mcset no {&Cancel} {&Avbryt} +::msgcat::mcset no {&Yes} {&Ja} +::msgcat::mcset no {&No} {&Nei} + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +::msgcat::mcset no {Bold} {Halvfet} +::msgcat::mcset no {Italic} {Kursiv} +::msgcat::mcset no {Underline} {Understreking} +::msgcat::mcset no {Overstrike} {Overstryke} +::msgcat::mcset no {&Font} {&Skrift} +::msgcat::mcset no {&Size} {&Størrelse} +::msgcat::mcset no {St&yle} {St&il} +::msgcat::mcset no {&Color...} {&Color...} + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +::msgcat::mcset no {&Login} {&Logg inn} +::msgcat::mcset no {&Password} {&Passord} + +# --- resource for SelectFont dialog ------------------------------------------ + +::msgcat::mcset no {Font selection} {Skriftvalg} +::msgcat::mcset no {Sample text} {Prøve tekst} + +# --- resource for MessageDlg dialog ------------------------------------------ + +::msgcat::mcset no {Message} {Melding} +::msgcat::mcset no {Information} {Informasjon} +::msgcat::mcset no {Question} {Spørsmål} +::msgcat::mcset no {Warning} {Advarsel} +::msgcat::mcset no {Error} {Feil} + +# --- resource for PasswdDlg dialog ------------------------------------------- + +::msgcat::mcset no {Enter login and password} {Skriv inn logginn og passord} + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +::msgcat::mcset no {Base colors} {Base colors} +::msgcat::mcset no {User colors} {User colors} +::msgcat::mcset no {Your Selection} {Your Selection} +::msgcat::mcset no {Color Selectors} {Color Selectors} + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +::msgcat::mcset no {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} +::msgcat::mcset no {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} ADDED lang/pl.msg Index: lang/pl.msg ================================================================== --- /dev/null +++ lang/pl.msg @@ -0,0 +1,60 @@ +# ------------------------------------------------------------------------------ +# pl.msg +# This file is part of Unifix BWidget Toolkit +# Definition of pl translation +# ------------------------------------------------------------------------------ + +# --- symbolic names of buttons ------------------------------------------------ + +::msgcat::mcset pl {&Abort} {&Porzuć} +::msgcat::mcset pl {&Retry} {P&onów} +::msgcat::mcset pl {&Ignore} {&Ignoruj} +::msgcat::mcset pl {&OK} {&OK} +::msgcat::mcset pl {&Cancel} {&Anyluj} +::msgcat::mcset pl {&Yes} {&Tak} +::msgcat::mcset pl {&No} {&Nie} + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +::msgcat::mcset pl {Bold} {Pogrubiona} +::msgcat::mcset pl {Italic} {Kursywa} +::msgcat::mcset pl {Underline} {Podkreślenie} +::msgcat::mcset pl {Overstrike} {Przekreślenie} +::msgcat::mcset pl {&Font} {&Czcionka:} +::msgcat::mcset pl {&Size} {&Rozmiar:} +::msgcat::mcset pl {St&yle} {St&yl czcionki:} +::msgcat::mcset pl {&Color...} {&Kolor...} + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +::msgcat::mcset pl {&Login} {&Login} +::msgcat::mcset pl {&Password} {&Hasło} + +# --- resource for SelectFont dialog ------------------------------------------ + +::msgcat::mcset pl {Font selection} {Wybór czcionki} +::msgcat::mcset pl {Sample text} {Przykładowy tekst} + +# --- resource for MessageDlg dialog ------------------------------------------ + +::msgcat::mcset pl {Message} {Wiadomość} +::msgcat::mcset pl {Information} {Informacja} +::msgcat::mcset pl {Question} {Pytanie} +::msgcat::mcset pl {Warning} {Ostrzeżenie} +::msgcat::mcset pl {Error} {Błąd} + +# --- resource for PasswdDlg dialog ------------------------------------------- + +::msgcat::mcset pl {Enter login and password} {Wpisz login i hasło} + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +::msgcat::mcset pl {Base colors} {Kolory podstawowe} +::msgcat::mcset pl {User colors} {Kolory niestandardowe} +::msgcat::mcset pl {Your Selection} {Your Selection} +::msgcat::mcset pl {Color Selectors} {Color Selectors} + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +::msgcat::mcset pl {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.} +::msgcat::mcset pl {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.} ADDED lang/xopt.tcl Index: lang/xopt.tcl ================================================================== --- /dev/null +++ lang/xopt.tcl @@ -0,0 +1,67 @@ +# ------------------------------------------------------------------------------ +# xopt.tcl +# This file is part of Unifix BWidget Toolkit +# Definition of resources +# ------------------------------------------------------------------------------ + + +# --- symbolic names of buttons ------------------------------------------------ + +option add *abortName [::msgcat::mc {&Abort}] +option add *retryName [::msgcat::mc {&Retry}] +option add *ignoreName [::msgcat::mc {&Ignore}] +option add *okName [::msgcat::mc {&OK}] +option add *cancelName [::msgcat::mc {&Cancel}] +option add *yesName [::msgcat::mc {&Yes}] +option add *noName [::msgcat::mc {&No}] + + +# --- symbolic names of label of SelectFont dialog ---------------------------- + +option add *boldName [::msgcat::mc {Bold}] +option add *italicName [::msgcat::mc {Italic}] +option add *underlineName [::msgcat::mc {Underline}] +option add *overstrikeName [::msgcat::mc {Overstrike}] +option add *fontName [::msgcat::mc {&Font}] +option add *sizeName [::msgcat::mc {&Size}] +option add *styleName [::msgcat::mc {St&yle}] +option add *colorPickerName [::msgcat::mc {&Color...}] + + +# --- symbolic names of label of PasswdDlg dialog ----------------------------- + +option add *loginName [::msgcat::mc {&Login}] +option add *passwordName [::msgcat::mc {&Password}] + + +# --- resource for SelectFont dialog ------------------------------------------ + +option add *SelectFont.title [::msgcat::mc {Font selection}] +option add *SelectFont.sampletext [::msgcat::mc {Sample text}] + + +# --- resource for MessageDlg dialog ------------------------------------------ + +option add *MessageDlg.noneTitle [::msgcat::mc {Message}] +option add *MessageDlg.infoTitle [::msgcat::mc {Information}] +option add *MessageDlg.questionTitle [::msgcat::mc {Question}] +option add *MessageDlg.warningTitle [::msgcat::mc {Warning}] +option add *MessageDlg.errorTitle [::msgcat::mc {Error}] + +# --- resource for PasswdDlg dialog ------------------------------------------- + +option add *PasswdDlg.title [::msgcat::mc {Enter login and password}] + +# --- symbolic names of label of SelectColor dialog ---------------------------- + +option add *baseColorsName [::msgcat::mc {Base colors}] +option add *userColorsName [::msgcat::mc {User colors}] + +option add *yourSelectionName [::msgcat::mc {Your Selection}] +option add *colorSelectorsName [::msgcat::mc {Color Selectors}] + +# --- dynamic help text for SelectColor dialog. Lines 75 chars max, split by '\n'. + +option add *mouseHelpTextName [::msgcat::mc {Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank. If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.}] + +option add *keyboardHelpTextName [::msgcat::mc {Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key. The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.}] Index: utils.tcl ================================================================== --- utils.tcl +++ utils.tcl @@ -1,709 +1,721 @@ -# ---------------------------------------------------------------------------- -# utils.tcl -# This file is part of Unifix BWidget Toolkit -# $Id: utils.tcl,v 1.15.2.1 2009/09/03 17:29:03 oehhar Exp $ -# ---------------------------------------------------------------------------- -# Index of commands: -# - GlobalVar::exists -# - GlobalVar::setvarvar -# - GlobalVar::getvarvar -# - BWidget::assert -# - BWidget::clonename -# - BWidget::get3dcolor -# - BWidget::XLFDfont -# - BWidget::place -# - BWidget::grab -# - BWidget::focus -# ---------------------------------------------------------------------------- - -namespace eval GlobalVar { - proc use {} {} -} - - -namespace eval BWidget { - variable _top - variable _gstack {} - variable _fstack {} - proc use {} {} -} - - -# ---------------------------------------------------------------------------- -# Command GlobalVar::exists -# ---------------------------------------------------------------------------- -proc GlobalVar::exists { varName } { - return [uplevel \#0 [list info exists $varName]] -} - - -# ---------------------------------------------------------------------------- -# Command GlobalVar::setvar -# ---------------------------------------------------------------------------- -proc GlobalVar::setvar { varName value } { - return [uplevel \#0 [list set $varName $value]] -} - - -# ---------------------------------------------------------------------------- -# Command GlobalVar::getvar -# ---------------------------------------------------------------------------- -proc GlobalVar::getvar { varName } { - return [uplevel \#0 [list set $varName]] -} - - -# ---------------------------------------------------------------------------- -# Command GlobalVar::tracevar -# ---------------------------------------------------------------------------- -proc GlobalVar::tracevar { cmd varName args } { - return [uplevel \#0 [list trace $cmd $varName] $args] -} - - - -# ---------------------------------------------------------------------------- -# Command BWidget::lreorder -# ---------------------------------------------------------------------------- -proc BWidget::lreorder { list neworder } { - set pos 0 - set newlist {} - foreach e $neworder { - if { [lsearch -exact $list $e] != -1 } { - lappend newlist $e - set tabelt($e) 1 - } - } - set len [llength $newlist] - if { !$len } { - return $list - } - if { $len == [llength $list] } { - return $newlist - } - set pos 0 - foreach e $list { - if { ![info exists tabelt($e)] } { - set newlist [linsert $newlist $pos $e] - } - incr pos - } - return $newlist -} - - -# ---------------------------------------------------------------------------- -# Command BWidget::assert -# ---------------------------------------------------------------------------- -proc BWidget::assert { exp {msg ""}} { - set res [uplevel 1 expr $exp] - if { !$res} { - if { $msg == "" } { - return -code error "Assertion failed: {$exp}" - } else { - return -code error $msg - } - } -} - - -# ---------------------------------------------------------------------------- -# Command BWidget::clonename -# ---------------------------------------------------------------------------- -proc BWidget::clonename { menu } { - set path "" - set menupath "" - set found 0 - foreach widget [lrange [split $menu "."] 1 end] { - if { $found || [winfo class "$path.$widget"] == "Menu" } { - set found 1 - append menupath "#" $widget - append path "." $menupath - } else { - append menupath "#" $widget - append path "." $widget - } - } - return $path -} - - -# ---------------------------------------------------------------------------- -# Command BWidget::getname -# ---------------------------------------------------------------------------- -proc BWidget::getname { name } { - if { [string length $name] } { - set text [option get . "${name}Name" ""] - if { [string length $text] } { - return [parsetext $text] - } - } - return {} - } - - -# ---------------------------------------------------------------------------- -# Command BWidget::parsetext -# ---------------------------------------------------------------------------- -proc BWidget::parsetext { text } { - set result "" - set index -1 - set start 0 - while { [string length $text] } { - set idx [string first "&" $text] - if { $idx == -1 } { - append result $text - set text "" - } else { - set char [string index $text [expr {$idx+1}]] - if { $char == "&" } { - append result [string range $text 0 $idx] - set text [string range $text [expr {$idx+2}] end] - set start [expr {$start+$idx+1}] - } else { - append result [string range $text 0 [expr {$idx-1}]] - set text [string range $text [expr {$idx+1}] end] - incr start $idx - set index $start - } - } - } - return [list $result $index] -} - - -# ---------------------------------------------------------------------------- -# Command BWidget::get3dcolor -# ---------------------------------------------------------------------------- -proc BWidget::get3dcolor { path bgcolor } { - foreach val [winfo rgb $path $bgcolor] { - lappend dark [expr {60*$val/100}] - set tmp1 [expr {14*$val/10}] - if { $tmp1 > 65535 } { - set tmp1 65535 - } - set tmp2 [expr {(65535+$val)/2}] - lappend light [expr {($tmp1 > $tmp2) ? $tmp1:$tmp2}] - } - return [list [eval format "#%04x%04x%04x" $dark] [eval format "#%04x%04x%04x" $light]] -} - - -# ---------------------------------------------------------------------------- -# Command BWidget::XLFDfont -# ---------------------------------------------------------------------------- -proc BWidget::XLFDfont { cmd args } { - switch -- $cmd { - create { - set font "-*-*-*-*-*-*-*-*-*-*-*-*-*-*" - } - configure { - set font [lindex $args 0] - set args [lrange $args 1 end] - } - default { - return -code error "XLFDfont: commande incorrect: $cmd" - } - } - set lfont [split $font "-"] - if { [llength $lfont] != 15 } { - return -code error "XLFDfont: description XLFD incorrect: $font" - } - - foreach {option value} $args { - switch -- $option { - -foundry { set index 1 } - -family { set index 2 } - -weight { set index 3 } - -slant { set index 4 } - -size { set index 7 } - default { return -code error "XLFDfont: option incorrecte: $option" } - } - set lfont [lreplace $lfont $index $index $value] - } - return [join $lfont "-"] -} - - - -# ---------------------------------------------------------------------------- -# Command BWidget::place -# ---------------------------------------------------------------------------- -# -# Notes: -# For Windows systems with more than one monitor the available screen area may -# have negative positions. Geometry settings with negative numbers are used -# under X to place wrt the right or bottom of the screen. On windows, Tk -# continues to do this. However, a geometry such as 100x100+-200-100 can be -# used to place a window onto a secondary monitor. Passing the + gets Tk -# to pass the remainder unchanged so the Windows manager then handles -200 -# which is a position on the left hand monitor. -# I've tested this for left, right, above and below the primary monitor. -# Currently there is no way to ask Tk the extent of the Windows desktop in -# a multi monitor system. Nor what the legal co-ordinate range might be. -# -proc BWidget::place { path w h args } { - variable _top - - update idletasks - - # If the window is not mapped, it may have any current size. - # Then use required size, but bound it to the screen width. - # This is mostly inexact, because any toolbars will still be removed - # which may reduce size. - if { $w == 0 && [winfo ismapped $path] } { - set w [winfo width $path] - } else { - if { $w == 0 } { - set w [winfo reqwidth $path] - } - set vsw [winfo vrootwidth $path] - if { $w > $vsw } { set w $vsw } - } - - if { $h == 0 && [winfo ismapped $path] } { - set h [winfo height $path] - } else { - if { $h == 0 } { - set h [winfo reqheight $path] - } - set vsh [winfo vrootheight $path] - if { $h > $vsh } { set h $vsh } - } - - set arglen [llength $args] - if { $arglen > 3 } { - return -code error "BWidget::place: bad number of argument" - } - - if { $arglen > 0 } { - set where [lindex $args 0] - set list [list "at" "center" "left" "right" "above" "below"] - set idx [lsearch $list $where] - if { $idx == -1 } { - return -code error [BWidget::badOptionString position $where $list] - } - if { $idx == 0 } { - set err [catch { - # purposely removed the {} around these expressions - [PT] - set x [expr int([lindex $args 1])] - set y [expr int([lindex $args 2])] - }] - if { $err } { - return -code error "BWidget::place: incorrect position" - } - if {$::tcl_platform(platform) == "windows"} { - # handle windows multi-screen. -100 != +-100 - if {[string index [lindex $args 1] 0] != "-"} { - set x "+$x" - } - if {[string index [lindex $args 2] 0] != "-"} { - set y "+$y" - } - } else { - if { $x >= 0 } { - set x "+$x" - } - if { $y >= 0 } { - set y "+$y" - } - } - } else { - if { $arglen == 2 } { - set widget [lindex $args 1] - if { ![winfo exists $widget] } { - return -code error "BWidget::place: \"$widget\" does not exist" - } - } else { - set widget . - } - set sw [winfo screenwidth $path] - set sh [winfo screenheight $path] - if { $idx == 1 } { - if { $arglen == 2 } { - # center to widget - set x0 [expr {[winfo rootx $widget] + ([winfo width $widget] - $w)/2}] - set y0 [expr {[winfo rooty $widget] + ([winfo height $widget] - $h)/2}] - } else { - # center to screen - set x [winfo rootx $path] - set x0 [expr {($sw - $w)/2}] - set vx [winfo vrootx $path] - set vw [winfo vrootwidth $path] - if {$x < 0 && $vx < 0} { - # We are left to the main screen - # Start of left screen: vx (negative) - # End coordinate of left screen: -1 - # Width of left screen: vx * -1 - # x0 = vx + ( -vx - w ) / 2 - set x0 [expr {($vx - $w)/2}] - } elseif {$x > $sw && $vx+$vw > $sw} { - # We are right to the main screen - # Start of right screen: sw - # End of right screen: vx+vw-1 - # Width of right screen: vx+vw-sw - # x0 = sw + ( vx + vw - sw - w ) / 2 - set x0 [expr {($vx+$vw+$sw-$w)/2}] - } - # Same for y - set y [winfo rooty $path] - set y0 [expr {($sh - $h)/2}] - set vy [winfo vrooty $path] - set vh [winfo vrootheight $path] - if {$y < 0 && $vy < 0} { - # We are above to the main screen - set y0 [expr {($vy - $h)/2}] - } elseif {$y > $sh && $vy+$vh > $sh} { - # We are below to the main screen - set x0 [expr {($vy+$vh-$sh-$h)/2+$sh}] - } - } - set x "+$x0" - set y "+$y0" - if {$::tcl_platform(platform) != "windows"} { - if { $x0+$w > $sw } {set x "-0"; set x0 [expr {$sw-$w}]} - if { $x0 < 0 } {set x "+0"} - if { $y0+$h > $sh } {set y "-0"; set y0 [expr {$sh-$h}]} - if { $y0 < 0 } {set y "+0"} - } - } else { - set x0 [winfo rootx $widget] - set y0 [winfo rooty $widget] - set x1 [expr {$x0 + [winfo width $widget]}] - set y1 [expr {$y0 + [winfo height $widget]}] - if { $idx == 2 || $idx == 3 } { - set y "+$y0" - if {$::tcl_platform(platform) != "windows"} { - if { $y0+$h > $sh } {set y "-0"; set y0 [expr {$sh-$h}]} - if { $y0 < 0 } {set y "+0"} - } - if { $idx == 2 } { - # try left, then right if out, then 0 if out - if { $x0 >= $w } { - set x [expr {$x0-$w}] - } elseif { $x1+$w <= $sw } { - set x "+$x1" - } else { - set x "+0" - } - } else { - # try right, then left if out, then 0 if out - if { $x1+$w <= $sw } { - set x "+$x1" - } elseif { $x0 >= $w } { - set x [expr {$x0-$w}] - } else { - set x "-0" - } - } - } else { - set x "+$x0" - if {$::tcl_platform(platform) != "windows"} { - if { $x0+$w > $sw } {set x "-0"; set x0 [expr {$sw-$w}]} - if { $x0 < 0 } {set x "+0"} - } - if { $idx == 4 } { - # try top, then bottom, then 0 - if { $h <= $y0 } { - set y [expr {$y0-$h}] - } elseif { $y1+$h <= $sh } { - set y "+$y1" - } else { - set y "+0" - } - } else { - # try bottom, then top, then 0 - if { $y1+$h <= $sh } { - set y "+$y1" - } elseif { $h <= $y0 } { - set y [expr {$y0-$h}] - } else { - set y "-0" - } - } - } - } - } - - ## If there's not a + or - in front of the number, we need to add one. - if {[string is integer [string index $x 0]]} { set x +$x } - if {[string is integer [string index $y 0]]} { set y +$y } - - wm geometry $path "${w}x${h}${x}${y}" - } else { - wm geometry $path "${w}x${h}" - } - update idletasks -} - - -# ---------------------------------------------------------------------------- -# Command BWidget::grab -# ---------------------------------------------------------------------------- -proc BWidget::grab { option path } { - variable _gstack - - if { $option == "release" } { - catch {::grab release $path} - while { [llength $_gstack] } { - set grinfo [lindex $_gstack end] - set _gstack [lreplace $_gstack end end] - foreach {oldg mode} $grinfo { - if { ![string equal $oldg $path] && [winfo exists $oldg] } { - if { $mode == "global" } { - catch {::grab -global $oldg} - } else { - catch {::grab $oldg} - } - return - } - } - } - } else { - set oldg [::grab current] - if { $oldg != "" } { - lappend _gstack [list $oldg [::grab status $oldg]] - } - if { $option == "global" } { - ::grab -global $path - } else { - ::grab $path - } - } -} - - -# ---------------------------------------------------------------------------- -# Command BWidget::focus -# ---------------------------------------------------------------------------- -proc BWidget::focus { option path {refocus 1} } { - variable _fstack - - if { $option == "release" } { - while { [llength $_fstack] } { - set oldf [lindex $_fstack end] - set _fstack [lreplace $_fstack end end] - if { ![string equal $oldf $path] && [winfo exists $oldf] } { - if {$refocus} {catch {::focus -force $oldf}} - return - } - } - } elseif { $option == "set" } { - lappend _fstack [::focus] - ::focus -force $path - } -} - -# BWidget::refocus -- -# -# Helper function used to redirect focus from a container frame in -# a megawidget to a component widget. Only redirects focus if -# focus is already on the container. -# -# Arguments: -# container container widget to redirect from. -# component component widget to redirect to. -# -# Results: -# None. - -proc BWidget::refocus {container component} { - if { [string equal $container [::focus]] } { - ::focus $component - } - return -} - -## These mirror tk::(Set|Restore)FocusGrab - -# BWidget::SetFocusGrab -- -# swap out current focus and grab temporarily (for dialogs) -# Arguments: -# grab new window to grab -# focus window to give focus to -# Results: -# Returns nothing -# -proc BWidget::SetFocusGrab {grab {focus {}}} { - variable _focusGrab - set index "$grab,$focus" - - lappend _focusGrab($index) [::focus] - set oldGrab [::grab current $grab] - lappend _focusGrab($index) $oldGrab - if {[winfo exists $oldGrab]} { - lappend _focusGrab($index) [::grab status $oldGrab] - } - # The "grab" command will fail if another application - # already holds the grab. So catch it. - catch {::grab $grab} - if {[winfo exists $focus]} { - ::focus $focus - } -} - -# BWidget::RestoreFocusGrab -- -# restore old focus and grab (for dialogs) -# Arguments: -# grab window that had taken grab -# focus window that had taken focus -# destroy destroy|withdraw - how to handle the old grabbed window -# Results: -# Returns nothing -# -proc BWidget::RestoreFocusGrab {grab focus {destroy destroy}} { - variable _focusGrab - set index "$grab,$focus" - if {[info exists _focusGrab($index)]} { - foreach {oldFocus oldGrab oldStatus} $_focusGrab($index) break - unset _focusGrab($index) - } else { - set oldGrab "" - } - - catch {::focus $oldFocus} - ::grab release $grab - if {[string equal $destroy "withdraw"]} { - wm withdraw $grab - } else { - ::destroy $grab - } - if {[winfo exists $oldGrab] && [winfo ismapped $oldGrab]} { - if {[string equal $oldStatus "global"]} { - ::grab -global $oldGrab - } else { - ::grab $oldGrab - } - } -} - -# BWidget::badOptionString -- -# -# Helper function to return a proper error string when an option -# doesn't match a list of given options. -# -# Arguments: -# type A string that represents the type of option. -# value The value that is in-valid. -# list A list of valid options. -# -# Results: -# None. -proc BWidget::badOptionString {type value list} { - set last [lindex $list end] - set list [lreplace $list end end] - return "bad $type \"$value\": must be [join $list ", "], or $last" -} - - -proc BWidget::wrongNumArgsString { string } { - return "wrong # args: should be \"$string\"" -} - - -proc BWidget::read_file { file } { - set fp [open $file] - set x [read $fp [file size $file]] - close $fp - return $x -} - - -proc BWidget::classes { class } { - variable use - - ${class}::use - set classes [list $class] - if {![info exists use($class)]} { return } - foreach class $use($class) { - if {![string equal $class "-classonly"]} { - eval lappend classes [classes $class] - } - } - return [lsort -unique $classes] -} - - -proc BWidget::library { args } { - variable use - - set libs [list widget init utils] - set classes [list] - foreach class $args { - ${class}::use - eval lappend classes [classes $class] - } - - eval lappend libs [lsort -unique $classes] - - set library "" - foreach lib $libs { - if {![info exists use($lib,file)]} { - set file [file join $::BWIDGET::LIBRARY $lib.tcl] - } else { - set file [file join $::BWIDGET::LIBRARY $use($lib,file).tcl] - } - append library [read_file $file] - } - - return $library -} - - -proc BWidget::inuse { class } { - variable ::Widget::_inuse - - if {![info exists _inuse($class)]} { return 0 } - return [expr $_inuse($class) > 0] -} - - -proc BWidget::write { filename {mode w} } { - variable use - - if {![info exists use(classes)]} { return } - - set classes [list] - foreach class $use(classes) { - if {![inuse $class]} { continue } - lappend classes $class - } - - set fp [open $filename $mode] - puts $fp [eval library $classes] - close $fp - - return -} - - -# BWidget::bindMouseWheel -- -# -# Bind mouse wheel actions to a given widget. -# -# Arguments: -# widget - The widget to bind. -# -# Results: -# None. -proc BWidget::bindMouseWheel { widget } { - if {[bind all ] eq ""} { - # style::as and Tk 8.5 have global bindings - # Only enable these if no global binding for MouseWheel exists - bind $widget \ - {%W yview scroll [expr {-%D/24}] units} - bind $widget \ - {%W yview scroll [expr {-%D/120}] pages} - bind $widget \ - {%W yview scroll [expr {-%D/120}] units} - } - - if {[bind all ] eq ""} { - # style::as and Tk 8.5 have global bindings - # Only enable these if no global binding for them exists - bind $widget {event generate %W -delta 120} - bind $widget {event generate %W -delta -120} - } -} - - +# ---------------------------------------------------------------------------- +# utils.tcl +# This file is part of Unifix BWidget Toolkit +# $Id: utils.tcl,v 1.15.2.1 2009/09/03 17:29:03 oehhar Exp $ +# ---------------------------------------------------------------------------- +# Index of commands: +# - GlobalVar::exists +# - GlobalVar::setvarvar +# - GlobalVar::getvarvar +# - BWidget::assert +# - BWidget::clonename +# - BWidget::get3dcolor +# - BWidget::XLFDfont +# - BWidget::place +# - BWidget::grab +# - BWidget::focus +# ---------------------------------------------------------------------------- + +namespace eval GlobalVar { + proc use {} {} +} + + +namespace eval BWidget { + variable _top + variable _gstack {} + variable _fstack {} + proc use {} {} +} + + +# ---------------------------------------------------------------------------- +# Command GlobalVar::exists +# ---------------------------------------------------------------------------- +proc GlobalVar::exists { varName } { + return [uplevel \#0 [list info exists $varName]] +} + + +# ---------------------------------------------------------------------------- +# Command GlobalVar::setvar +# ---------------------------------------------------------------------------- +proc GlobalVar::setvar { varName value } { + return [uplevel \#0 [list set $varName $value]] +} + + +# ---------------------------------------------------------------------------- +# Command GlobalVar::getvar +# ---------------------------------------------------------------------------- +proc GlobalVar::getvar { varName } { + return [uplevel \#0 [list set $varName]] +} + + +# ---------------------------------------------------------------------------- +# Command GlobalVar::tracevar +# ---------------------------------------------------------------------------- +proc GlobalVar::tracevar { cmd varName args } { + return [uplevel \#0 [list trace $cmd $varName] $args] +} + + + +# ---------------------------------------------------------------------------- +# Command BWidget::lreorder +# ---------------------------------------------------------------------------- +proc BWidget::lreorder { list neworder } { + set pos 0 + set newlist {} + foreach e $neworder { + if { [lsearch -exact $list $e] != -1 } { + lappend newlist $e + set tabelt($e) 1 + } + } + set len [llength $newlist] + if { !$len } { + return $list + } + if { $len == [llength $list] } { + return $newlist + } + set pos 0 + foreach e $list { + if { ![info exists tabelt($e)] } { + set newlist [linsert $newlist $pos $e] + } + incr pos + } + return $newlist +} + + +# ---------------------------------------------------------------------------- +# Command BWidget::assert +# ---------------------------------------------------------------------------- +proc BWidget::assert { exp {msg ""}} { + set res [uplevel 1 expr $exp] + if { !$res} { + if { $msg == "" } { + return -code error "Assertion failed: {$exp}" + } else { + return -code error $msg + } + } +} + + +# ---------------------------------------------------------------------------- +# Command BWidget::clonename +# ---------------------------------------------------------------------------- +proc BWidget::clonename { menu } { + set path "" + set menupath "" + set found 0 + foreach widget [lrange [split $menu "."] 1 end] { + if { $found || [winfo class "$path.$widget"] == "Menu" } { + set found 1 + append menupath "#" $widget + append path "." $menupath + } else { + append menupath "#" $widget + append path "." $widget + } + } + return $path +} + + +# ---------------------------------------------------------------------------- +# Command BWidget::getname +# ---------------------------------------------------------------------------- +proc BWidget::getname { name } { + if { [string length $name] } { + set text [option get . "${name}Name" ""] + if { [string length $text] } { + return [parsetext $text] + } + } + return {} + } + + +# ---------------------------------------------------------------------------- +# Command BWidget::parsetext +# ---------------------------------------------------------------------------- +proc BWidget::parsetext { text } { + set result "" + set index -1 + set start 0 + while { [string length $text] } { + set idx [string first "&" $text] + if { $idx == -1 } { + append result $text + set text "" + } else { + set char [string index $text [expr {$idx+1}]] + if { $char == "&" } { + append result [string range $text 0 $idx] + set text [string range $text [expr {$idx+2}] end] + set start [expr {$start+$idx+1}] + } else { + append result [string range $text 0 [expr {$idx-1}]] + set text [string range $text [expr {$idx+1}] end] + incr start $idx + set index $start + } + } + } + return [list $result $index] +} + + +# ---------------------------------------------------------------------------- +# Command BWidget::get3dcolor +# ---------------------------------------------------------------------------- +proc BWidget::get3dcolor { path bgcolor } { + foreach val [winfo rgb $path $bgcolor] { + lappend dark [expr {60*$val/100}] + set tmp1 [expr {14*$val/10}] + if { $tmp1 > 65535 } { + set tmp1 65535 + } + set tmp2 [expr {(65535+$val)/2}] + lappend light [expr {($tmp1 > $tmp2) ? $tmp1:$tmp2}] + } + return [list [eval format "#%04x%04x%04x" $dark] [eval format "#%04x%04x%04x" $light]] +} + + +# ---------------------------------------------------------------------------- +# Command BWidget::XLFDfont +# ---------------------------------------------------------------------------- +proc BWidget::XLFDfont { cmd args } { + switch -- $cmd { + create { + set font "-*-*-*-*-*-*-*-*-*-*-*-*-*-*" + } + configure { + set font [lindex $args 0] + set args [lrange $args 1 end] + } + default { + return -code error "XLFDfont: commande incorrect: $cmd" + } + } + set lfont [split $font "-"] + if { [llength $lfont] != 15 } { + return -code error "XLFDfont: description XLFD incorrect: $font" + } + + foreach {option value} $args { + switch -- $option { + -foundry { set index 1 } + -family { set index 2 } + -weight { set index 3 } + -slant { set index 4 } + -size { set index 7 } + default { return -code error "XLFDfont: option incorrecte: $option" } + } + set lfont [lreplace $lfont $index $index $value] + } + return [join $lfont "-"] +} + + + +# ---------------------------------------------------------------------------- +# Command BWidget::place +# ---------------------------------------------------------------------------- +# +# Notes: +# For Windows systems with more than one monitor the available screen area may +# have negative positions. Geometry settings with negative numbers are used +# under X to place wrt the right or bottom of the screen. On windows, Tk +# continues to do this. However, a geometry such as 100x100+-200-100 can be +# used to place a window onto a secondary monitor. Passing the + gets Tk +# to pass the remainder unchanged so the Windows manager then handles -200 +# which is a position on the left hand monitor. +# I've tested this for left, right, above and below the primary monitor. +# Currently there is no way to ask Tk the extent of the Windows desktop in +# a multi monitor system. Nor what the legal co-ordinate range might be. +# +proc BWidget::place { path w h args } { + variable _top + + update idletasks + + # If the window is not mapped, it may have any current size. + # Then use required size, but bound it to the screen width. + # This is mostly inexact, because any toolbars will still be removed + # which may reduce size. + if { $w == 0 && [winfo ismapped $path] } { + set w [winfo width $path] + } else { + if { $w == 0 } { + set w [winfo reqwidth $path] + } + set vsw [winfo vrootwidth $path] + if { $w > $vsw } { set w $vsw } + } + + if { $h == 0 && [winfo ismapped $path] } { + set h [winfo height $path] + } else { + if { $h == 0 } { + set h [winfo reqheight $path] + } + set vsh [winfo vrootheight $path] + if { $h > $vsh } { set h $vsh } + } + + set arglen [llength $args] + if { $arglen > 3 } { + return -code error "BWidget::place: bad number of argument" + } + + if { $arglen > 0 } { + set where [lindex $args 0] + set list [list "at" "center" "left" "right" "above" "below"] + set idx [lsearch $list $where] + if { $idx == -1 } { + return -code error [BWidget::badOptionString position $where $list] + } + if { $idx == 0 } { + set err [catch { + # purposely removed the {} around these expressions - [PT] + set x [expr int([lindex $args 1])] + set y [expr int([lindex $args 2])] + }] + if { $err } { + return -code error "BWidget::place: incorrect position" + } + if {$::tcl_platform(platform) == "windows"} { + # handle windows multi-screen. -100 != +-100 + if {[string index [lindex $args 1] 0] != "-"} { + set x "+$x" + } + if {[string index [lindex $args 2] 0] != "-"} { + set y "+$y" + } + } else { + if { $x >= 0 } { + set x "+$x" + } + if { $y >= 0 } { + set y "+$y" + } + } + } else { + if { $arglen == 2 } { + set widget [lindex $args 1] + if { ![winfo exists $widget] } { + return -code error "BWidget::place: \"$widget\" does not exist" + } + } else { + set widget . + } + set sw [winfo screenwidth $path] + set sh [winfo screenheight $path] + if { $idx == 1 } { + if { $arglen == 2 } { + # center to widget + set x0 [expr {[winfo rootx $widget] + ([winfo width $widget] - $w)/2}] + set y0 [expr {[winfo rooty $widget] + ([winfo height $widget] - $h)/2}] + } else { + # center to screen + set x [winfo rootx $path] + set x0 [expr {($sw - $w)/2}] + set vx [winfo vrootx $path] + set vw [winfo vrootwidth $path] + if {$x < 0 && $vx < 0} { + # We are left to the main screen + # Start of left screen: vx (negative) + # End coordinate of left screen: -1 + # Width of left screen: vx * -1 + # x0 = vx + ( -vx - w ) / 2 + set x0 [expr {($vx - $w)/2}] + } elseif {$x > $sw && $vx+$vw > $sw} { + # We are right to the main screen + # Start of right screen: sw + # End of right screen: vx+vw-1 + # Width of right screen: vx+vw-sw + # x0 = sw + ( vx + vw - sw - w ) / 2 + set x0 [expr {($vx+$vw+$sw-$w)/2}] + } + # Same for y + set y [winfo rooty $path] + set y0 [expr {($sh - $h)/2}] + set vy [winfo vrooty $path] + set vh [winfo vrootheight $path] + if {$y < 0 && $vy < 0} { + # We are above to the main screen + set y0 [expr {($vy - $h)/2}] + } elseif {$y > $sh && $vy+$vh > $sh} { + # We are below to the main screen + set x0 [expr {($vy+$vh-$sh-$h)/2+$sh}] + } + } + set x "+$x0" + set y "+$y0" + if {$::tcl_platform(platform) != "windows"} { + if { $x0+$w > $sw } {set x "-0"; set x0 [expr {$sw-$w}]} + if { $x0 < 0 } {set x "+0"} + if { $y0+$h > $sh } {set y "-0"; set y0 [expr {$sh-$h}]} + if { $y0 < 0 } {set y "+0"} + } + } else { + set x0 [winfo rootx $widget] + set y0 [winfo rooty $widget] + set x1 [expr {$x0 + [winfo width $widget]}] + set y1 [expr {$y0 + [winfo height $widget]}] + if { $idx == 2 || $idx == 3 } { + set y "+$y0" + if {$::tcl_platform(platform) != "windows"} { + if { $y0+$h > $sh } {set y "-0"; set y0 [expr {$sh-$h}]} + if { $y0 < 0 } {set y "+0"} + } + if { $idx == 2 } { + # try left, then right if out, then 0 if out + if { $x0 >= $w } { + set x [expr {$x0-$w}] + } elseif { $x1+$w <= $sw } { + set x "+$x1" + } else { + set x "+0" + } + } else { + # try right, then left if out, then 0 if out + if { $x1+$w <= $sw } { + set x "+$x1" + } elseif { $x0 >= $w } { + set x [expr {$x0-$w}] + } else { + set x "-0" + } + } + } else { + set x "+$x0" + if {$::tcl_platform(platform) != "windows"} { + if { $x0+$w > $sw } {set x "-0"; set x0 [expr {$sw-$w}]} + if { $x0 < 0 } {set x "+0"} + } + if { $idx == 4 } { + # try top, then bottom, then 0 + if { $h <= $y0 } { + set y [expr {$y0-$h}] + } elseif { $y1+$h <= $sh } { + set y "+$y1" + } else { + set y "+0" + } + } else { + # try bottom, then top, then 0 + if { $y1+$h <= $sh } { + set y "+$y1" + } elseif { $h <= $y0 } { + set y [expr {$y0-$h}] + } else { + set y "-0" + } + } + } + } + } + + ## If there's not a + or - in front of the number, we need to add one. + if {[string is integer [string index $x 0]]} { set x +$x } + if {[string is integer [string index $y 0]]} { set y +$y } + + wm geometry $path "${w}x${h}${x}${y}" + } else { + wm geometry $path "${w}x${h}" + } + update idletasks +} + + +# ---------------------------------------------------------------------------- +# Command BWidget::grab +# ---------------------------------------------------------------------------- +proc BWidget::grab { option path } { + variable _gstack + + if { $option == "release" } { + catch {::grab release $path} + while { [llength $_gstack] } { + set grinfo [lindex $_gstack end] + set _gstack [lreplace $_gstack end end] + foreach {oldg mode} $grinfo { + if { ![string equal $oldg $path] && [winfo exists $oldg] } { + if { $mode == "global" } { + catch {::grab -global $oldg} + } else { + catch {::grab $oldg} + } + return + } + } + } + } else { + set oldg [::grab current] + if { $oldg != "" } { + lappend _gstack [list $oldg [::grab status $oldg]] + } + if { $option == "global" } { + ::grab -global $path + } else { + ::grab $path + } + } +} + + +# ---------------------------------------------------------------------------- +# Command BWidget::focus +# ---------------------------------------------------------------------------- +proc BWidget::focus { option path {refocus 1} } { + variable _fstack + + if { $option == "release" } { + while { [llength $_fstack] } { + set oldf [lindex $_fstack end] + set _fstack [lreplace $_fstack end end] + if { ![string equal $oldf $path] && [winfo exists $oldf] } { + if {$refocus} {catch {::focus -force $oldf}} + return + } + } + } elseif { $option == "set" } { + lappend _fstack [::focus] + ::focus -force $path + } +} + +# BWidget::refocus -- +# +# Helper function used to redirect focus from a container frame in +# a megawidget to a component widget. Only redirects focus if +# focus is already on the container. +# +# Arguments: +# container container widget to redirect from. +# component component widget to redirect to. +# +# Results: +# None. + +proc BWidget::refocus {container component} { + if { [string equal $container [::focus]] } { + ::focus $component + } + return +} + +## These mirror tk::(Set|Restore)FocusGrab + +# BWidget::SetFocusGrab -- +# swap out current focus and grab temporarily (for dialogs) +# Arguments: +# grab new window to grab +# focus window to give focus to +# Results: +# Returns nothing +# +proc BWidget::SetFocusGrab {grab {focus {}}} { + variable _focusGrab + set index "$grab,$focus" + + lappend _focusGrab($index) [::focus] + set oldGrab [::grab current $grab] + lappend _focusGrab($index) $oldGrab + if {[winfo exists $oldGrab]} { + lappend _focusGrab($index) [::grab status $oldGrab] + } + # The "grab" command will fail if another application + # already holds the grab. So catch it. + catch {::grab $grab} + if {[winfo exists $focus]} { + ::focus $focus + } +} + +# BWidget::RestoreFocusGrab -- +# restore old focus and grab (for dialogs) +# Arguments: +# grab window that had taken grab +# focus window that had taken focus +# destroy destroy|withdraw - how to handle the old grabbed window +# Results: +# Returns nothing +# +proc BWidget::RestoreFocusGrab {grab focus {destroy destroy}} { + variable _focusGrab + set index "$grab,$focus" + if {[info exists _focusGrab($index)]} { + foreach {oldFocus oldGrab oldStatus} $_focusGrab($index) break + unset _focusGrab($index) + } else { + set oldGrab "" + } + + catch {::focus $oldFocus} + ::grab release $grab + if {[string equal $destroy "withdraw"]} { + wm withdraw $grab + } else { + ::destroy $grab + } + if {[winfo exists $oldGrab] && [winfo ismapped $oldGrab]} { + if {[string equal $oldStatus "global"]} { + ::grab -global $oldGrab + } else { + ::grab $oldGrab + } + } +} + +# BWidget::badOptionString -- +# +# Helper function to return a proper error string when an option +# doesn't match a list of given options. +# +# Arguments: +# type A string that represents the type of option. +# value The value that is in-valid. +# list A list of valid options. +# +# Results: +# None. +proc BWidget::badOptionString {type value list} { + set last [lindex $list end] + set list [lreplace $list end end] + return "bad $type \"$value\": must be [join $list ", "], or $last" +} + + +proc BWidget::wrongNumArgsString { string } { + return "wrong # args: should be \"$string\"" +} + + +proc BWidget::read_file { file } { + set fp [open $file] + set x [read $fp [file size $file]] + close $fp + return $x +} + + +proc BWidget::classes { class } { + variable use + + ${class}::use + set classes [list $class] + if {![info exists use($class)]} { return } + foreach class $use($class) { + if {![string equal $class "-classonly"]} { + eval lappend classes [classes $class] + } + } + return [lsort -unique $classes] +} + + +proc BWidget::library { args } { + variable use + + set libs [list widget init utils] + set classes [list] + foreach class $args { + ${class}::use + eval lappend classes [classes $class] + } + + eval lappend libs [lsort -unique $classes] + + set library "" + foreach lib $libs { + if {![info exists use($lib,file)]} { + set file [file join $::BWIDGET::LIBRARY $lib.tcl] + } else { + set file [file join $::BWIDGET::LIBRARY $use($lib,file).tcl] + } + append library [read_file $file] + } + + return $library +} + + +proc BWidget::inuse { class } { + variable ::Widget::_inuse + + if {![info exists _inuse($class)]} { return 0 } + return [expr $_inuse($class) > 0] +} + + +proc BWidget::write { filename {mode w} } { + variable use + + if {![info exists use(classes)]} { return } + + set classes [list] + foreach class $use(classes) { + if {![inuse $class]} { continue } + lappend classes $class + } + + set fp [open $filename $mode] + puts $fp [eval library $classes] + close $fp + + return +} + + +# BWidget::bindMouseWheel -- +# +# Bind mouse wheel actions to a given widget. +# +# Arguments: +# widget - The widget to bind. +# +# Results: +# None. +proc BWidget::bindMouseWheel { widget } { + if {[bind all ] eq ""} { + # style::as and Tk 8.5 have global bindings + # Only enable these if no global binding for MouseWheel exists + bind $widget \ + {%W yview scroll [expr {-%D/24}] units} + bind $widget \ + {%W yview scroll [expr {-%D/120}] pages} + bind $widget \ + {%W yview scroll [expr {-%D/120}] units} + } + + if {[bind all ] eq ""} { + # style::as and Tk 8.5 have global bindings + # Only enable these if no global binding for them exists + bind $widget {event generate %W -delta 120} + bind $widget {event generate %W -delta -120} + } +} + + + +# ---------------------------------------------------------------------------- +# utility function for language (locale) support +# ---------------------------------------------------------------------------- + +proc BWidget::changeLang { lang } { + if {![catch {package present BWidget}]} { + ::msgcat::mclocale $lang + ::msgcat::mcload [file join $::BWIDGET::LIBRARY "lang"] + source [file join $::BWIDGET::LIBRARY "lang" "xopt.tcl"] + } +}