From 9b490525584f77b21ce3f1092ae3b73922a06127 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Aug 11 2006 21:22:43 +0000 Subject: - Add patch for adding a color selector to the font dialog --- diff --git a/bwidget-1.7.0-colorchooser.patch b/bwidget-1.7.0-colorchooser.patch new file mode 100644 index 0000000..ca665ca --- /dev/null +++ b/bwidget-1.7.0-colorchooser.patch @@ -0,0 +1,106 @@ +--- /usr/share/bwidget1.7.0/font.tcl~ 2006-07-30 11:28:59.000000000 +0200 ++++ /usr/share/bwidget1.7.0/font.tcl 2006-07-30 12:43:37.000000000 +0200 +@@ -24,8 +24,10 @@ + + {-type Enum dialog 0 {dialog toolbar}} + {-font TkResource "" 0 label} ++ {-initialcolor String "" 0} + {-families String "all" 1} + {-querysystem Boolean 1 0} ++ {-nosizes Boolean 0 1} + {-styles String "bold italic underline overstrike" 1} + {-command String "" 0} + {-sampletext String "Sample Text" 0} +@@ -189,7 +191,9 @@ + LabelFrame::configure $labf3 -focus $subf.[lindex $_styles 0] + + pack $labf1 -side left -anchor n -fill both -expand yes +- pack $labf2 -side left -anchor n -fill both -expand yes -padx 8 ++ if { ![Widget::getoption "$path#SelectFont" -nosizes] } { ++ pack $labf2 -side left -anchor n -fill both -expand yes -padx 8 ++ } + pack $labf3 -side left -anchor n -fill both -expand yes + + set botf [frame $frame.botf -width 100 -height 50 \ +@@ -204,8 +208,38 @@ + -text [Widget::getoption "$path#SelectFont" -sampletext]] + place $lab -relx 0.5 -rely 0.5 -anchor c + +- pack $topf -pady 4 -fill both -expand yes +- pack $botf -pady 4 -fill x ++ pack $topf -pady 4 -fill both -expand yes ++ ++ if { [Widget::getoption "$path#SelectFont" -initialcolor] != ""} { ++ set thecolor [Widget::getoption "$path#SelectFont" -initialcolor] ++ set colf [frame $frame.colf] ++ ++ set frc [frame $colf.frame -width 50 -height 20 -bg $thecolor -bd 0 -relief flat\ ++ -highlightthickness 1 -takefocus 0 \ ++ -highlightbackground black \ ++ -highlightcolor black] ++ ++ set script "set [list SelectFont::${path}(fontcolor)] \[tk_chooseColor -parent $colf.button -initialcolor \[set [list SelectFont::${path}(fontcolor)]\]\];\ ++ SelectFont::_update [list $path]" ++ ++ set but [button $colf.button -command $script \ ++ -text "Color..."] ++ ++ $lab configure -foreground $thecolor ++ $frc configure -bg $thecolor ++ ++ pack $but -side left ++ pack $frc -side left -padx 5 ++ ++ set data(frc) $frc ++ set data(fontcolor) $thecolor ++ ++ pack $colf -pady 4 -fill x -expand true ++ ++ } else { ++ set data(fontcolor) -1 ++ } ++ pack $botf -pady 4 -fill x + + Dialog::add $path -name ok + Dialog::add $path -name cancel +@@ -360,13 +394,24 @@ + + if { [Dialog::draw $path] == 0 } { + set result [Widget::getoption "$path#SelectFont" -font] ++ set color $data(fontcolor) ++ ++ if { $color == "" } { ++ set color #000000 ++ } ++ + } else { + set result "" ++ set color "" + } + unset data + Widget::destroy "$path#SelectFont" + destroy $path +- return $result ++ if { $color != -1 } { ++ return [list $result $color] ++ } else { ++ return $result ++ } + } + + +@@ -428,6 +473,14 @@ + if { $type == "dialog" } { + $data(label) configure -font $font + $path:cmd configure -cursor $curs ++ if { ($data(fontcolor) != "") && ($data(fontcolor) != -1) } { ++ $data(label) configure -foreground $data(fontcolor) ++ $data(frc) configure -bg $data(fontcolor) ++ } elseif { $data(fontcolor) == "" } { ++ #If no color is selected, restore previous one ++ set data(fontcolor) [$data(label) cget -foreground] ++ ++ } + } elseif { [set cmd [Widget::getoption "$path#SelectFont" -command]] != "" } { + uplevel \#0 $cmd + } diff --git a/bwidget.spec b/bwidget.spec index 5252682..5d254ba 100644 --- a/bwidget.spec +++ b/bwidget.spec @@ -1,12 +1,13 @@ Name: bwidget Version: 1.7.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Extended widget set for Tk Group: Development/Libraries License: Distributable URL: http://tcllib.sourceforge.net/ Source0: http://download.sourceforge.net/tcllib/BWidget-1.7.0.tar.gz +Patch0: bwidget-1.7.0-colorchooser.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -17,6 +18,7 @@ An extended widget set for Tcl/Tk. %prep %setup -q -n BWidget-%{version} +%patch0 -p4 %{__sed} -i 's/\r//' LICENSE.txt %install @@ -44,7 +46,11 @@ rm -rf $RPM_BUILD_ROOT %doc BWman/*.html %changelog +* Fri Aug 11 2006 Wart 1.7.0-3 +- Add patch for adding a color selector to the font dialog + * Sat Dec 10 2005 Wart 1.7.0-2 - added dist tag to release tag. + * Sat Dec 10 2005 Wart 1.7.0-1 - Initial spec file.