From: Keith Seitz <keiths@redhat.com>
To: Insight Maling List <insight@sources.redhat.com>
Subject: Re: [RFA] iwidgets: update and add "-fraction" option
Date: Fri, 22 Mar 2002 09:31:00 -0000 [thread overview]
Message-ID: <Pine.GSO.4.33.0203220927070.7189-100000@makita.cygnus.com> (raw)
In-Reply-To: <Pine.GSO.4.33.0203220914590.7189-100000@makita.cygnus.com>
On Fri, 22 Mar 2002, Keith Seitz wrote:
> I really hated the way this widget worked, so I:
>
> 1) merged with current sources (formatting changes, really)
> 2) Added a sanity check in iwidgets::Feedback::step
> 3) Added a new "-fraction" option so that we could tell it to display
> a fraction instead of just stepping it.
>
> I will submit the "-fraction" patch to the iwidgets maintainers.
>
> (Is Ian still around? Shall we nominate a new or more tcl/tk/tix/itcl
> maintainer(s)?)
Hmmm. I'll bet someone wants to see the patch! :-)
ChangeLog
2002-03-22 Keith Seitz <keiths@redhat.com>
* iwidgets3.0.0/generic/feedback.itk: Import version 1.5.
(iwidgets::Feedback): Define new option, "-fraction".
(fraction): New configbody.
(step): Cap the step increment at the total number of
requested steps.
Patch
Index: itcl/iwidgets3.0.0/generic/feedback.itk
===================================================================
RCS file: /cvs/src/src/itcl/iwidgets3.0.0/generic/feedback.itk,v
retrieving revision 1.1.1.2
diff -p -r1.1.1.2 feedback.itk
*** itcl/iwidgets3.0.0/generic/feedback.itk 2001/09/09 19:49:08 1.1.1.2
--- itcl/iwidgets3.0.0/generic/feedback.itk 2002/03/22 17:14:55
***************
*** 9,15 ****
# ----------------------------------------------------------------------
# AUTHOR: Kris Raney EMAIL: kraney@spd.dsccc.com
#
! # @(#) $Id: feedback.itk,v 1.2.172.1 2001/05/18 02:21:48 mdejong Exp $
# ----------------------------------------------------------------------
# Copyright (c) 1996 DSC Technologies Corporation
# ======================================================================
--- 9,15 ----
# ----------------------------------------------------------------------
# AUTHOR: Kris Raney EMAIL: kraney@spd.dsccc.com
#
! # @(#) $Id: feedback.itk,v 1.5 2001/08/15 18:32:18 smithc Exp $
# ----------------------------------------------------------------------
# Copyright (c) 1996 DSC Technologies Corporation
# ======================================================================
*************** itk::usual Feedback {
*** 78,90 ****
# ------------------------------------------------------------------
# FEEDBACK
# ------------------------------------------------------------------
! class iwidgets::Feedback {
inherit iwidgets::Labeledwidget
constructor {args} {}
destructor {}
itk_option define -steps steps Steps 10
public {
method reset {}
--- 78,91 ----
# ------------------------------------------------------------------
# FEEDBACK
# ------------------------------------------------------------------
! itcl::class iwidgets::Feedback {
inherit iwidgets::Labeledwidget
constructor {args} {}
destructor {}
itk_option define -steps steps Steps 10
+ itk_option define -fraction fraction Fraction 0
public {
method reset {}
*************** itcl::configbody iwidgets::Feedback::ste
*** 163,168 ****
--- 164,186 ----
}
# ------------------------------------------------------------------
+ # OPTION: -fraction
+ #
+ # Configure the widget to display the given fractional completion
+ # ------------------------------------------------------------------
+ itcl::configbody iwidgets::Feedback::fraction {
+
+ set newval [expr {ceil($itk_option(-steps) * $itk_option(-fraction))}]
+ if {$newval > $itk_option(-steps)} {
+ set newval $itk_option(-steps)
+ }
+ if {$newval != $_stepval} {
+ set _stepval $newval
+ _display
+ }
+ }
+
+ # ------------------------------------------------------------------
# METHODS
# ------------------------------------------------------------------
*************** itcl::configbody iwidgets::Feedback::ste
*** 175,187 ****
itcl::body iwidgets::Feedback::_display {} {
update idletasks
set troughwidth [winfo width $itk_component(trough)]
! set _barwidth [expr \
! (1.0*$troughwidth-(2.0*[$itk_component(trough) cget -borderwidth])) / \
! $itk_option(-steps)]
! set fraction [expr int((1.0*$_stepval)/$itk_option(-steps)*100.0)]
$itk_component(percentage) config -text "$fraction%"
! $itk_component(bar) config -width [expr $_barwidth*$_stepval]
update
}
--- 193,205 ----
itcl::body iwidgets::Feedback::_display {} {
update idletasks
set troughwidth [winfo width $itk_component(trough)]
! set _barwidth [expr {
! (1.0*$troughwidth-(2.0*[$itk_component(trough) cget -borderwidth])) /
! $itk_option(-steps)}]
! set fraction [expr {int((1.0*$_stepval)/$itk_option(-steps)*100.0)}]
$itk_component(percentage) config -text "$fraction%"
! $itk_component(bar) config -width [expr {$_barwidth*$_stepval}]
update
}
*************** itcl::body iwidgets::Feedback::step {{in
*** 208,212 ****
--- 226,233 ----
}
incr _stepval $inc
+ if {$_stepval > $itk_option(-steps)} {
+ set _stepval $itk_option(-steps)
+ }
_display
}
next prev parent reply other threads:[~2002-03-22 17:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-22 9:17 Keith Seitz
2002-03-22 9:31 ` Keith Seitz [this message]
2002-04-01 14:35 ` Keith Seitz
2002-04-01 14:37 ` Keith Seitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.4.33.0203220927070.7189-100000@makita.cygnus.com \
--to=keiths@redhat.com \
--cc=insight@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).