|
From: Joe E. <jen...@fl...> - 2005-02-24 20:57:29
|
We've had a progress bar widget for a while now,
but it's lacking documentation and is missing a few
features. Some things I can think of that it needs:
+ An "indeterminate" (aka "barber-pole") mode. Currently
only the "determinate" (aka "thermometer") mode is supported.
Note that "barber-pole" mode doesn't always look like
a barber pole; Windows and GTK+ display a rectangle that
bounces back and forth instead.
+ Linked -variables. The current implementation has a
-variable option, but it goes in the wrong direction --
setting the progress bar updates the -variable, but
setting the variable doesn't change the widget value.
+ Animation. On Aqua and on some KDE themes (depending on
the user's preferred eye candy level) thermometer-style
progress bars have an additional pulsing/throbbing effect,
presumably to let the user know that the program hasn't
locked up even if the bar isn't otherwise moving.
Michael Kirkham (muonics) has a patch that implements this
on OSX.
Anyway, I've put up another strawmanpage describing a
possible interface:
<URL: http://tktable.sourceforge.net/tile/doc/progress.html >
Questions: Are the 'set' and 'get' methods really needed?
They're equivalent to [$w configure -value] and [$w cget -value],
respectively; or you can just access the linked -variable.
And if so, would a 'step' method be useful for indeterminate
progress bars, where [$w step] is equivalent to:
$w configure -value [expr {[$w cget -value] + [$w cget -stepsize]}]
or
incr $linkedVariable $stepSize
Anything else missing?
The current implementation also has -font, -foreground,
and -showvalue options (which don't do anything at the moment);
and -command and -width options, which I don't think are
needed either -- -width should be taken from the style,
and -command isn't really useful for output-only widgets
like this one.
--Joe English
jen...@fl...
|
|
From: Michael K. <mi...@mu...> - 2005-02-25 14:40:12
|
On Thu, 24 Feb 2005, Joe English wrote: > + Animation. On Aqua and on some KDE themes (depending on > the user's preferred eye candy level) thermometer-style > progress bars have an additional pulsing/throbbing effect, > presumably to let the user know that the program hasn't > locked up even if the bar isn't otherwise moving. > Michael Kirkham (muonics) has a patch that implements this > on OSX. The latest version of the patch submitted a little while ago implements barber-pole style indeterminate progress bars for other themes except clam (any that doesn't already have its own progress widget, I think), too. Still needs a few tweaks, but it's functional. Indeterminate mode is obtained by setting -from and -to both to 0. As long as both have value 0, it will animate a barberpole. Change either to non-zero and it will switch to a regular progress bar (showing just a track if the "set" value is <= -from). If anyone wants to play with it the current patch is at: https://sourceforge.net/tracker/index.php?func=detail&aid=1144673&group_id=11464&atid=311464 -- Michael Kirkham www.muonics.com |
|
From: Kevin W. <sw...@wo...> - 2005-02-25 20:37:08
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Forgive my ignorance--I downloaded this patch and am trying to apply it, but I'm not getting the correct results. There actually seem to be patches/diffs for several files here. Can someone outline the steps I sohuld take to apply it? Cheers, Kevin Walzer, PhD WordTech Software--Open Source Applications and Packages for OS X http://www.wordtech-software.com http://www.smallbizmac.com http://www.kevin-walzer.com mailto:sw...@wo... Michael Kirkham wrote: | | On Thu, 24 Feb 2005, Joe English wrote: | |> + Animation. On Aqua and on some KDE themes (depending on |> the user's preferred eye candy level) thermometer-style |> progress bars have an additional pulsing/throbbing effect, |> presumably to let the user know that the program hasn't |> locked up even if the bar isn't otherwise moving. |> Michael Kirkham (muonics) has a patch that implements this |> on OSX. | | | The latest version of the patch submitted a little while ago implements | barber-pole style indeterminate progress bars for other themes except | clam (any that doesn't already have its own progress widget, I think), | too. Still needs a few tweaks, but it's functional. | | Indeterminate mode is obtained by setting -from and -to both to 0. As | long as both have value 0, it will animate a barberpole. Change either | to non-zero and it will switch to a regular progress bar (showing just a | track if the "set" value is <= -from). | | If anyone wants to play with it the current patch is at: | | https://sourceforge.net/tracker/index.php?func=detail&aid=1144673&group_id=11464&atid=311464 | | | -- | Michael Kirkham | www.muonics.com | | | ------------------------------------------------------- | SF email is sponsored by - The IT Product Guide | Read honest & candid reviews on hundreds of IT Products from real users. | Discover which products truly live up to the hype. Start reading now. | http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click | _______________________________________________ | Tktable-tile-dev mailing list | Tkt...@li... | https://lists.sourceforge.net/lists/listinfo/tktable-tile-dev | | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCH4xtJmdQs+6YVcoRAu5QAJwL8RvFzPvrKluiyVctKWWSRo3bRACgiOPQ NsxIQ8fqe6O+TTLxMKqanbo= =yeaU -----END PGP SIGNATURE----- |
|
From: Michael K. <mi...@mu...> - 2005-02-25 20:53:30
|
I probably forgot to do the diffs in unified format. I tend to do that a lot. :P It should be okay, it just requires telling it which files to patch when it prompts you to. And make sure you have the latest sources from CVS HEAD. cd /your/tile/src/dir patch < /wherever/is/progressanim2.diff At each prompt, type in the name of the file to patch that it shows you. e.g. "generic/scale.c" when it tells you about scale.c and asks you which file to patch. Looking at the diffs, It'll want to patch generic/scale.c, generic/tkElements.c, aquaTheme.tcl and aquaTheme.c. You can skip aquaTheme.tcl - that shouldn't be in the rev 2 patch, but it doesn't matter. It just specifies a theme setting for the period between animation frames which is unused in the 2nd rev and will be ignored. On Fri, 25 Feb 2005, Kevin Walzer wrote: > Date: Fri, 25 Feb 2005 15:37:02 -0500 > From: Kevin Walzer <sw...@wo...> > To: Michael Kirkham <mi...@mu...> > Cc: Joe English <jen...@fl...>, > tkt...@li... > Subject: Re: [Tile-dev] Progress bars > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Forgive my ignorance--I downloaded this patch and am trying to apply it, > but I'm not getting the correct results. There actually seem to be > patches/diffs for several files here. Can someone outline the steps I > sohuld take to apply it? > > Cheers, > > Kevin Walzer, PhD > WordTech Software--Open Source Applications and Packages for OS X > http://www.wordtech-software.com > http://www.smallbizmac.com > http://www.kevin-walzer.com > mailto:sw...@wo... > > Michael Kirkham wrote: > | > | On Thu, 24 Feb 2005, Joe English wrote: > | > |> + Animation. On Aqua and on some KDE themes (depending on > |> the user's preferred eye candy level) thermometer-style > |> progress bars have an additional pulsing/throbbing effect, > |> presumably to let the user know that the program hasn't > |> locked up even if the bar isn't otherwise moving. > |> Michael Kirkham (muonics) has a patch that implements this > |> on OSX. > | > | > | The latest version of the patch submitted a little while ago implements > | barber-pole style indeterminate progress bars for other themes except > | clam (any that doesn't already have its own progress widget, I think), > | too. Still needs a few tweaks, but it's functional. > | > | Indeterminate mode is obtained by setting -from and -to both to 0. As > | long as both have value 0, it will animate a barberpole. Change either > | to non-zero and it will switch to a regular progress bar (showing just a > | track if the "set" value is <= -from). > | > | If anyone wants to play with it the current patch is at: > | > | > https://sourceforge.net/tracker/index.php?func=detail&aid=1144673&group_id=11464&atid=311464 > > | > | > | -- > | Michael Kirkham > | www.muonics.com > | > | > | ------------------------------------------------------- > | SF email is sponsored by - The IT Product Guide > | Read honest & candid reviews on hundreds of IT Products from real users. > | Discover which products truly live up to the hype. Start reading now. > | http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > | _______________________________________________ > | Tktable-tile-dev mailing list > | Tkt...@li... > | https://lists.sourceforge.net/lists/listinfo/tktable-tile-dev > | > | > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.4 (Darwin) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFCH4xtJmdQs+6YVcoRAu5QAJwL8RvFzPvrKluiyVctKWWSRo3bRACgiOPQ > NsxIQ8fqe6O+TTLxMKqanbo= > =yeaU > -----END PGP SIGNATURE----- > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Tktable-tile-dev mailing list > Tkt...@li... > https://lists.sourceforge.net/lists/listinfo/tktable-tile-dev > -- Michael Kirkham www.muonics.com |
|
From: Kevin W. <sw...@wo...> - 2005-02-25 21:58:40
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Michael,
OK, I think I've gotten the patches applied correctly, and the new
version of Tile built. I have written a little script to display the
barber pole, and I'm not getting it right (nothing displays but the
"trough" where the progress bar should be). Can you take a look and let
me know what I'm doing wrong?
Thanks.
- ---
package require tile
ttk::progress .p1 -from 0 -to 0
pack .p1
.p1 set 0
set i1 0
proc showprog {} {
global i1
incr i1
.p1 set $i1
after 10 showprog
}
after 10 showprog
- --
Cheers,
Kevin Walzer, PhD
WordTech Software--Open Source Applications and Packages for OS X
http://www.wordtech-software.com
http://www.smallbizmac.com
http://www.kevin-walzer.com
mailto:sw...@wo...
Michael Kirkham wrote:
|
| I probably forgot to do the diffs in unified format. I tend to do that
| a lot. :P It should be okay, it just requires telling it which files to
| patch when it prompts you to. And make sure you have the latest sources
| from CVS HEAD.
|
| cd /your/tile/src/dir
| patch < /wherever/is/progressanim2.diff
|
| At each prompt, type in the name of the file to patch that it shows you.
| e.g. "generic/scale.c" when it tells you about scale.c and asks you
| which file to patch.
|
| Looking at the diffs, It'll want to patch generic/scale.c,
| generic/tkElements.c, aquaTheme.tcl and aquaTheme.c. You can skip
| aquaTheme.tcl - that shouldn't be in the rev 2 patch, but it doesn't
| matter. It just specifies a theme setting for the period between
| animation frames which is unused in the 2nd rev and will be ignored.
|
| On Fri, 25 Feb 2005, Kevin Walzer wrote:
|
|> Date: Fri, 25 Feb 2005 15:37:02 -0500
|> From: Kevin Walzer <sw...@wo...>
|> To: Michael Kirkham <mi...@mu...>
|> Cc: Joe English <jen...@fl...>,
|> tkt...@li...
|> Subject: Re: [Tile-dev] Progress bars
|>
| Forgive my ignorance--I downloaded this patch and am trying to apply it,
| but I'm not getting the correct results. There actually seem to be
| patches/diffs for several files here. Can someone outline the steps I
| sohuld take to apply it?
|
| Cheers,
|
| Kevin Walzer, PhD
| WordTech Software--Open Source Applications and Packages for OS X
| http://www.wordtech-software.com
| http://www.smallbizmac.com
| http://www.kevin-walzer.com
| mailto:sw...@wo...
|
| Michael Kirkham wrote:
| |
| | On Thu, 24 Feb 2005, Joe English wrote:
| |
| |> + Animation. On Aqua and on some KDE themes (depending on
| |> the user's preferred eye candy level) thermometer-style
| |> progress bars have an additional pulsing/throbbing effect,
| |> presumably to let the user know that the program hasn't
| |> locked up even if the bar isn't otherwise moving.
| |> Michael Kirkham (muonics) has a patch that implements this
| |> on OSX.
| |
| |
| | The latest version of the patch submitted a little while ago implements
| | barber-pole style indeterminate progress bars for other themes except
| | clam (any that doesn't already have its own progress widget, I think),
| | too. Still needs a few tweaks, but it's functional.
| |
| | Indeterminate mode is obtained by setting -from and -to both to 0. As
| | long as both have value 0, it will animate a barberpole. Change either
| | to non-zero and it will switch to a regular progress bar (showing
| just a
| | track if the "set" value is <= -from).
| |
| | If anyone wants to play with it the current patch is at:
| |
| |
|
https://sourceforge.net/tracker/index.php?func=detail&aid=1144673&group_id=11464&atid=311464
|
|
| |
| |
| | --
| | Michael Kirkham
| | www.muonics.com
| |
| |
| | -------------------------------------------------------
| | SF email is sponsored by - The IT Product Guide
| | Read honest & candid reviews on hundreds of IT Products from real
| users.
| | Discover which products truly live up to the hype. Start reading now.
| | http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
| | _______________________________________________
| | Tktable-tile-dev mailing list
| | Tkt...@li...
| | https://lists.sourceforge.net/lists/listinfo/tktable-tile-dev
| |
| |
|>
|>
- -------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Tktable-tile-dev mailing list
Tkt...@li...
https://lists.sourceforge.net/lists/listinfo/tktable-tile-dev
|>
| --
| Michael Kirkham
| www.muonics.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCH5+JJmdQs+6YVcoRAuVxAJ9Xn6OnOv4ilqVzRntYIzPuzWPo1ACgiav9
XXQQaAm8ESfmN0UbEl/7RAw=
=TSXj
-----END PGP SIGNATURE-----
|
|
From: Michael K. <mi...@mu...> - 2005-02-25 22:17:45
Attachments:
progressanim3.diff
|
On Fri, 25 Feb 2005, Kevin Walzer wrote:
> Michael,
>
> OK, I think I've gotten the patches applied correctly, and the new
> version of Tile built. I have written a little script to display the
> barber pole, and I'm not getting it right (nothing displays but the
> "trough" where the progress bar should be). Can you take a look and let
> me know what I'm doing wrong?
What you have should work. I'd have to guess the patches weren't applied
correctly, or it's using your unpatched version or something. Perhaps the
attached will work better if the former (unified diff format).
> package require tile
>
> ttk::progress .p1 -from 0 -to 0
> pack .p1
This should actually be sufficient to get the barber pole, as currently
implemented. It uses timer events to animate, rather than relying set
calls to refresh. Otherwise the animation would be anything but smooth.
To turn off the barber pole:
.p1 config -to 1; # anything non-zero, really
> .p1 set 0
> set i1 0
>
> proc showprog {} {
> global i1
> incr i1
> .p1 set $i1
> after 10 showprog
> }
>
> after 10 showprog
This will actually never set the value beyond 0 (with or without the
patch): the set value gets capped at the -to value. i.e.,
.p1 config -to 0
.p1 set 10000
puts [.p1 get]
...will print 0.
--
Michael Kirkham
www.muonics.com |
|
From: Kevin W. <sw...@wo...> - 2005-02-25 22:32:13
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 D'oh. I built the new Tile correctly, but didn't place it in /Library/Tcl. Moving things over fixed the problem. This is really cool, and absolutely perfect for the DarwinPorts GUI I'm working on. Thanks for putting it together. Cheers, Kevin Walzer, PhD WordTech Software--Open Source Applications and Packages for OS X http://www.wordtech-software.com http://www.smallbizmac.com http://www.kevin-walzer.com mailto:sw...@wo... Michael Kirkham wrote: | On Fri, 25 Feb 2005, Kevin Walzer wrote: | |> Michael, |> |> OK, I think I've gotten the patches applied correctly, and the new |> version of Tile built. I have written a little script to display the |> barber pole, and I'm not getting it right (nothing displays but the |> "trough" where the progress bar should be). Can you take a look and let |> me know what I'm doing wrong? | | | What you have should work. I'd have to guess the patches weren't | applied correctly, or it's using your unpatched version or something. | Perhaps the attached will work better if the former (unified diff format). | |> package require tile |> |> ttk::progress .p1 -from 0 -to 0 |> pack .p1 | | | This should actually be sufficient to get the barber pole, as currently | implemented. It uses timer events to animate, rather than relying set | calls to refresh. Otherwise the animation would be anything but smooth. | | To turn off the barber pole: | | .p1 config -to 1; # anything non-zero, really | |> .p1 set 0 |> set i1 0 |> |> proc showprog {} { |> global i1 |> incr i1 |> .p1 set $i1 |> after 10 showprog |> } |> |> after 10 showprog | | | This will actually never set the value beyond 0 (with or without the | patch): the set value gets capped at the -to value. i.e., | | .p1 config -to 0 | .p1 set 10000 | puts [.p1 get] | | ...will print 0. | | -- | Michael Kirkham | www.muonics.com | | | ------------------------------------------------------------------------ | | Index: generic/scale.c | =================================================================== | RCS file: /cvsroot/tktable/tile/generic/scale.c,v | retrieving revision 1.39 | diff -u -r1.39 scale.c | --- generic/scale.c 11 Dec 2004 00:36:38 -0000 1.39 | +++ generic/scale.c 25 Feb 2005 22:07:04 -0000 | @@ -18,6 +18,10 @@ | #define DEF_SCALE_WIDTH "15" | #define DEF_SCALE_LENGTH "100" | #define DEF_SCALE_SHOW_VALUE "1" | +#define DEF_SCALE_PERIOD 100 | + | +#define DEF_SCALE_STRIPE_WIDTH 10.0 | +#define DEF_SCALE_STRIPE_PHASES 4 | | #ifndef MAX | #define MAX(a,b) ((a) > (b) ? (a) : (b)) | @@ -45,6 +49,9 @@ | | /* internal state */ | int orient; | + | + /* Timer handler for animated progress bars */ | + Tcl_TimerToken timer; | } ScalePart; | | typedef struct | @@ -98,6 +105,8 @@ | { | Scale *scalePtr = recordPtr; | | + scalePtr->scale.timer = (Tcl_TimerToken) NULL; | + | TrackElementState(&scalePtr->core); | return TCL_OK; | } | @@ -235,6 +244,11 @@ | return r; | } | | +static void | +AnimateProgress(Scale *scalePtr); | +static void | +CancelAnimation(Scale *scalePtr); | + | static int | ScaleSetCommand( | Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) | @@ -279,6 +293,7 @@ | scalePtr->scale.valueObj, TCL_GLOBAL_ONLY); | } | if (WidgetDestroyed(&scalePtr->core)) { | + CancelAnimation(scalePtr); | return TCL_ERROR; | } | | @@ -466,6 +481,27 @@ | } | } | | +/* | + * ProgressDisplay -- | + * Display progress bar, possibly with animation. | + */ | +void ProgressDisplay(void *clientData, Drawable d) | +{ | + WidgetCore *corePtr = clientData; | + Scale *scalePtr = clientData; | + | + Ttk_DrawLayout(corePtr->layout, corePtr->state, d); | + | + /* | + * Set a new timer handler for animation re-display if necessary. | + * This is done here so that animation will resume on a progress | + * bar that hasn't changed its current value between theme | + * changes to/from animated/non-animated themes. | + */ | + | + AnimateProgress(scalePtr); | +} | + | /* | * ScaleSize -- | * Compute requested size of scale. | @@ -553,12 +589,56 @@ | * Progress widget overrides. | */ | | +static void | +AnimateProgressProc(ClientData clientData) | +{ | + Scale *scalePtr = (Scale *)clientData; | + | + WidgetChanged(&scalePtr->core, REDISPLAY_REQUIRED); | +} | + | +static void | +CancelAnimation(Scale *scalePtr) | +{ | + if (scalePtr->scale.timer) { | + Tcl_DeleteTimerHandler(scalePtr->scale.timer); | + scalePtr->scale.timer = (Tcl_TimerToken) NULL; | + } | +} | + | +static void | +AnimateProgress(Scale *scalePtr) | +{ | + double from = 0, to = 0, current = 0; | + | + Tcl_GetDoubleFromObj(NULL, scalePtr->scale.fromObj, &from); | + Tcl_GetDoubleFromObj(NULL, scalePtr->scale.toObj, &to); | + Tcl_GetDoubleFromObj(NULL, scalePtr->scale.valueObj, ¤t); | + | + /* | + * Cancel pending animation redisplay timer handler, if any | + */ | + | + CancelAnimation(scalePtr); | + | + /* | + * Only animate if the current value is within the from/to range | + * or from and to are the same for an indeterminate progress bar. | + */ | + | + if (((current > from) && (current < to)) || ((from == 0) && (to == 0))) { | + scalePtr->scale.timer = Tcl_CreateTimerHandler(DEF_SCALE_PERIOD, | + AnimateProgressProc, (ClientData)scalePtr); | + } | +} | + | static int | ProgressInitialize(Tcl_Interp *interp, void *recordPtr) | { | Scale *scalePtr = recordPtr; | | scalePtr->scale.showValue = 0; | + scalePtr->scale.timer = (Tcl_TimerToken) NULL; | | return TCL_OK; | } | @@ -622,7 +702,7 @@ | ProgressGetLayout, /* getLayoutProc */ | ScaleSize, /* sizeProc */ | ProgressDoLayout, /* layoutProc */ | - WidgetDisplay, /* displayProc */ | + ProgressDisplay, /* displayProc */ | WIDGET_SPEC_END /* sentinel */ | }; | | Index: generic/tkElements.c | =================================================================== | RCS file: /cvsroot/tktable/tile/generic/tkElements.c,v | retrieving revision 1.69 | diff -u -r1.69 tkElements.c | --- generic/tkElements.c 31 Dec 2004 01:32:57 -0000 1.69 | +++ generic/tkElements.c 25 Feb 2005 22:07:05 -0000 | @@ -9,6 +9,7 @@ | #include <tcl.h> | #include <tk.h> | #include <string.h> | +#include <sys/time.h> | #include "tkTheme.h" | | #define DEFAULT_BORDERWIDTH "2" | @@ -901,6 +902,9 @@ | Tcl_Obj *reliefObj; /* the relief for this object */ | Tcl_Obj *borderObj; /* the background color */ | Tcl_Obj *borderWidthObj; /* the size of the border */ | + Tcl_Obj *fromObj; /* minimum value for progress range */ | + Tcl_Obj *toObj; /* maximum value for progress range */ | + Tcl_Obj *stripeObj; /* stripe color for indeterminite progress */ | } SliderElement; | | static Ttk_ElementOptionSpec SliderElementOptions[] = | @@ -917,6 +921,12 @@ | DEFAULT_BACKGROUND }, | { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj), | "horizontal" }, | + { "-from", TK_OPTION_DOUBLE, Tk_Offset(SliderElement,fromObj), | + "0" }, | + { "-to", TK_OPTION_DOUBLE, Tk_Offset(SliderElement,toObj), | + "1.0" }, | + { "-stripecolor", TK_OPTION_COLOR, Tk_Offset(SliderElement,stripeObj), | + "white" }, | { NULL } | }; | | @@ -1004,22 +1014,94 @@ | * A progress bar. | */ | | +#define DEF_SCALE_PERIOD 100 | +#define DEF_SCALE_STRIPE_WIDTH 10.0 | +#define DEF_SCALE_STRIPE_PHASES 4 | + | static void | ProgressElementDraw(void *clientData, void *elementRecord, | Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) | { | SliderElement *slider = elementRecord; | - Tk_3DBorder border = NULL; | - int relief, borderWidth, orient; | + double from, to; | | - border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); | - Ttk_GetOrientationFromObj(NULL, slider->orientObj, &orient); | - Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); | - Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); | + Tcl_GetDoubleFromObj(NULL, slider->fromObj, &from); | + Tcl_GetDoubleFromObj(NULL, slider->toObj, &to); | | - Tk_Fill3DRectangle(tkwin, d, border, | - b.x, b.y, b.width, b.height, | - borderWidth, relief); | + /* | + * Display barberpole-style stripes for an indefinite progress bar | + * if the from and to values are both zero. | + */ | + | + if ((from == 0) && (to == 0)) { | + Display *display = Tk_Display(tkwin); | + struct timeval tv; | + struct timezone tz; | + int phase; | + int x; | + int ofs1 = b.height/2; | + int ofs2 = b.height*3/2; | + GC gc; | + XGCValues gcValues; | + XColor* colorPtr = Tk_GetColorFromObj(tkwin, slider->borderObj); | + | + gc = Tk_GCForColor(colorPtr, d); | + | + XFillRectangle(display, d, gc, b.x, b.y, b.width, b.height); | + | + /* | + * Calculate the phase based on the time of day and hard-coded | + * phase period. | + */ | + | + gettimeofday(&tv, &tz); | + | + phase = (((tv.tv_sec * 1000) + (tv.tv_usec / 1000)) / DEF_SCALE_PERIOD); | + phase %= DEF_SCALE_STRIPE_PHASES; | + | + /* | + * Start drawing the stripes within the region one stripe width to | + * the left of the visible area so that the stripes don't jump | + * between phase resets. | + */ | + | + x = -b.height; | + x += ((b.height * 1.5) / DEF_SCALE_STRIPE_PHASES)*phase; | + | + colorPtr = Tk_GetColorFromObj(tkwin, slider->stripeObj); | + | + /* | + * colorPtr = Tk_GetColorFromObj(tkwin, scalePtr->scale.foregroundObj); | + */ | + | + gcValues.foreground = colorPtr->pixel; | + gcValues.line_width = (int)b.height/2; | + | + gc = Tk_GetGC(tkwin, GCForeground | GCLineWidth, &gcValues); | + | + /* | + * Draw the stripes. | + */ | + | + while (x < b.width + b.height / 2) { | + XDrawLine(display, d, gc, x - ofs1, -ofs1, (x + ofs2), ofs2); | + x += (int)(b.height * 1.5); | + } | + | + Tk_FreeGC(display, gc); | + } else { | + Tk_3DBorder border = NULL; | + int relief, borderWidth, orient; | + | + border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); | + Ttk_GetOrientationFromObj(NULL, slider->orientObj, &orient); | + Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); | + Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); | + | + Tk_Fill3DRectangle(tkwin, d, border, | + b.x, b.y, b.width, b.height, | + borderWidth, relief); | + } | } | | static Ttk_ElementSpec ProgressElementSpec = | Index: macosx/aquaTheme.c | =================================================================== | RCS file: /cvsroot/tktable/tile/macosx/aquaTheme.c,v | retrieving revision 1.19 | diff -u -r1.19 aquaTheme.c | --- macosx/aquaTheme.c 11 Dec 2004 00:36:41 -0000 1.19 | +++ macosx/aquaTheme.c 25 Feb 2005 22:07:06 -0000 | @@ -35,6 +35,8 @@ | #include <tkMacOSX.h> | #include "tkTheme.h" | | +#define DEF_SCALE_PERIOD 100 | + | /*---------------------------------------------------------------------- | * +++ Utilities. | */ | @@ -507,7 +509,25 @@ | | switch (data->kind) { | case kThemeProgressBar: | - drawInfo.trackInfo.progress.phase = 0; /* 1-4: animation phase */ | + { | + struct timeval tv; | + struct timezone tz; | + gettimeofday(&tv, &tz); | + | + /* @@@ Should check -period style setting and divide by | + * @@@ period rather than 100 if non-zero, or set phase to 0 | + * @@@ if period is 0? | + */ | + | + drawInfo.trackInfo.progress.phase = | + (UInt8)(((tv.tv_sec * 1000) + (tv.tv_usec / 1000)) | + / DEF_SCALE_PERIOD); | + | + if ((from == 0) && (to == 0)) { | + drawInfo.max = 1; | + drawInfo.kind = kThemeIndeterminateBar; | + } | + } | break; | case kThemeSlider: | drawInfo.trackInfo.slider.pressState = 0; /* @@@ fill this in */ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCH6doJmdQs+6YVcoRAsvqAJ41InCX2Bk0VVEkek9cKjW6CIx0VgCghl04 5lyQ2sLiSlQkUIB52DZ3/7U= =HEga -----END PGP SIGNATURE----- |
|
From: Eric B. <eri...@fr...> - 2005-02-25 17:47:52
|
Joe English wrote:
> Questions: Are the 'set' and 'get' methods really needed?
> They're equivalent to [$w configure -value] and [$w cget -value],
> respectively; or you can just access the linked -variable.
Isn't there a general rule in tk that options are never changed
internally, but only via configure subcommand ?
This is at least what I have observed, with for example [entry].
> And if so, would a 'step' method be useful for indeterminate
> progress bars, where [$w step] is equivalent to:
>
> $w configure -value [expr {[$w cget -value] + [$w cget -stepsize]}]
[$w step] is cleaner.
--
-eric
|
|
From: Brian G. <bgr...@mo...> - 2005-02-25 18:54:04
|
Eric Boudaillier wrote: > Joe English wrote: > >> Questions: Are the 'set' and 'get' methods really needed? >> They're equivalent to [$w configure -value] and [$w cget -value], >> respectively; or you can just access the linked -variable. > > > Isn't there a general rule in tk that options are never changed > internally, but only via configure subcommand ? > This is at least what I have observed, with for example [entry]. Actually, if you look at a label widget, the -text option changes to match the -textvariable variable contents. -Brian -- ------------------------------------------------------------- -- Model Technology Inc. -- -- 8005 SW Boeckman Road 503.685.7000 tel -- -- Wilsonville, OR 97070 USA 503.685.0921 fax -- ------------------------------------------------------------- -- Technical support ............ mailto:su...@mo... -- -- Sales and marketing info ....... mailto:sa...@mo... -- -- Licensing .................... mailto:li...@mo... -- -- Home Page ........................ http://www.model.com -- -- AIM ........................................ bgriffin42 -- ------------------------------------------------------------- |
|
From: Joe E. <jen...@fl...> - 2005-02-25 22:24:10
|
Some more random thoughts:
* * *
I see three main use cases for progress bars:
(1) the application knows exactly how much work is to be
done and the progress is shown proportionally;
(2) the application doesn't know how much work is to be done,
but can at least provide feedback about how fast it's going
(the "bouncing rectangle"); and
(3) the application just wants to show a throbber to keep
the user from thinking the program has locked up.
Sometimes a progess bar will start out in mode (2) or (3),
then switch to mode (1), so this should be configurable
by widget options; using separate -styles for determinate
and indeterminate progress bars isn't appropriate.
* * *
Eric Boudaillier wrote:
> Joe English wrote:
> > Questions: Are the 'set' and 'get' methods really needed?
> > They're equivalent to [$w configure -value] and [$w cget -value],
> > respectively; or you can just access the linked -variable.
>
> Isn't there a general rule in tk that options are never changed
> internally, but only via configure subcommand ?
> This is at least what I have observed, with for example [entry].
That's not a hard and fast rule, but it does seem to
be the tendency; don't provide too many redundant equivalent
redundant ways of doing the same thing.
I'm inclined to drop [$w get] and [$w set].
> > And if so, would a 'step' method be useful for indeterminate
> > progress bars, where [$w step] is equivalent to:
> >
> > $w configure -value [expr {[$w cget -value] + [$w cget -stepsize]}]
>
> [$w step] is cleaner.
You could also use [incr $linkedVar $amount], although having
a separate [$w step] method seems just useful enough to me
to warrant including it. I'm inclined to add this one.
* * *
It occurs to me that there is no reason for -from to ever
be anything other than 0; we could replace -from and -to
with a single -maximum option.
That would make the Tile progress bar nearly compatible with the
BWidget one; the main difference would be -mode vs. -type.
(And to be honest, I never really did understand the difference
between -type incremental, -type infinite, and -type
nonincremental_infinite, so this difference might be
a good thing :-)
* * *
I kind of like muonics approach:
| Indeterminate mode is obtained by setting -from and -to both to 0. As
| long as both have value 0, it will animate a barberpole. Change either to
| non-zero and it will switch to a regular progress bar (showing just a
| track if the "set" value is <= -from).
(or, specify "-maximum 0" to get an indeterminate progress bar).
Except that, on most platforms indeterminate progress bars use a
"bouncing rectangle" effect instead of a "barberpole" effect.
This can be used to indicate how fast things are going, but
with '-maximum 0', the programmer doesn't know / can't control
how much the bar will move when the -value is incrememented
by a particular amount.
We could just hardcode this -- pick a value and say "indeterminate
progress bars complete one cycle each time the value increments by 100"
or something like that. But for now I'm inclined to use a "-mode"
option.
* * *
Anyway, new strawmanpage posted reflecting the above:
<URL: http://tktable.sourceforge.net/tile/doc/progressbar.html >
This version is closer to BWidget's ProgressBar (good),
but, with the loss of -from, -to, and set, is completely
incompatible with the current ttk::progress widget (bad).
So I've changed the widget name to 'ttk::progressbar'.
If this ends up as the final version, we'll keep the
current [ttk::progress] widget around for one more
release cycle so early adopters will have a chance
to upgrade.
--Joe English
jen...@fl...
|
|
From: Michael K. <mi...@mu...> - 2005-02-25 22:46:48
|
On Fri, 25 Feb 2005, Joe English wrote:
>>> And if so, would a 'step' method be useful for indeterminate
>>> progress bars, where [$w step] is equivalent to:
>>>
>>> $w configure -value [expr {[$w cget -value] + [$w cget -stepsize]}]
>>
>> [$w step] is cleaner.
Would step take an optional argument for the step size? What's the
default increment given that the current default range is 0-1? Or would
you make the default step 1, and change the default range to be 0-100? Or
add a -stepsize option?
> It occurs to me that there is no reason for -from to ever
> be anything other than 0; we could replace -from and -to
> with a single -maximum option.
Mmm... I could probably think of a reason (though perhaps an artificial
one): suppose you had a listbox of a bunch of records or files you wanted
to do something on a selection for that takes some time. One might set
their range to the minimum and maximum list index.
Of course, it would undoubtedly be better to set the maximum to the number
of items selected, so it's certainly not a compelling reason.
> I kind of like muonics approach:
Credit where due, it was Pat's idea, though he suggested also having
-value != 0 be part of the rule that turns on the barber pole. That's not
possible without lifting the cap, however, and that cap may be there for a
good reason (if none other than so that each theme doesn't have to do its
own capping to not draw more than necessary).
> We could just hardcode this -- pick a value and say "indeterminate
> progress bars complete one cycle each time the value increments by 100"
> or something like that. But for now I'm inclined to use a "-mode"
> option.
To do that the cap that forces -from <= -value <= -to will have to be
lifted.
--
Michael Kirkham
www.muonics.com
|
|
From: Joe E. <jen...@fl...> - 2005-02-25 23:10:17
|
Michael Kirkham wrote:
> Would step take an optional argument for the step size?
Yes -- the full synopsis is:
| pathName step ?amount?
| Increments the -value by amount. amount defaults to 1.0 if omitted.
> What's the
> default increment given that the current default range is 0-1? Or would
> you make the default step 1, and change the default range to be 0-100? Or
> add a -stepsize option?
The default -maximum is 100. That's somewhat arbitrary --
1.0 would be more logical from a mathematical point of view --
but 100% will probably be used more often than any other
arbitrary number I can think of.
> > We could just hardcode this -- pick a value and say "indeterminate
> > progress bars complete one cycle each time the value increments by 100"
> > or something like that. But for now I'm inclined to use a "-mode"
> > option.
>
> To do that the cap that forces -from <= -value <= -to will have to be
> lifted.
As currently specified, animation is active if:
(theme supports it) && (-value > 0)
&& (-mode == indeterminate || -value < -maximum)
--Joe English
jen...@fl...
|
|
From: Jeff H. <je...@Ac...> - 2005-02-25 23:35:24
|
> The default -maximum is 100. That's somewhat arbitrary -- > 1.0 would be more logical from a mathematical point of view > -- but 100% will probably be used more often than any other > arbitrary number I can think of. Let's just ensure that whatever value is chosen, we don't get caught in any double-imprecision traps. For that reason, I prefer 100 instead of 1.0 to start with. Jeff |
|
From: Jeff H. <je...@Ac...> - 2005-02-28 19:42:20
|
> Anyway, new strawmanpage posted reflecting the above: > > <URL: http://tktable.sourceforge.net/tile/doc/progressbar.html > > > This version is closer to BWidget's ProgressBar (good), > but, with the loss of -from, -to, and set, is completely > incompatible with the current ttk::progress widget (bad). > > So I've changed the widget name to 'ttk::progressbar'. The doc still says ttk::progress, and then the util procedures are in the tile::progressbar namespace. Is that right? Jeff |
|
From: Michael K. <mi...@mu...> - 2005-02-28 23:24:25
|
On Mon, 28 Feb 2005, Joe English wrote: > Also just committed some final fixes; the widget is now implemented > and works more or less as documented. Some comments: 1. I don't think indeterminate bars should show the cylon block (dunno what else to call it :P) when they are not running. 2. The start/stop stuff doesn't work under the Aqua theme. It turns the track to a barber pole (actually the initial version always showed the barber pole, but I fixed that) but doesn't animate. Phase is always 0. -- Michael Kirkham www.muonics.com |
|
From: Michael K. <mi...@mu...> - 2005-02-28 23:26:18
|
On Mon, 28 Feb 2005, Michael Kirkham wrote: > Some comments: > > 1. I don't think indeterminate bars should show the cylon block (dunno what > else to call it :P) when they are not running. > > 2. The start/stop stuff doesn't work under the Aqua theme. It turns the > track to a barber pole (actually the initial version always showed the barber > pole, but I fixed that) but doesn't animate. Phase is always 0. Oh. And why "ttk::progress::start $w" instead of "$w start"? -- Michael Kirkham www.muonics.com |
|
From: Joe E. <jen...@fl...> - 2005-02-28 22:55:39
|
Jeff Hobbs wrote: > The doc still says ttk::progress, and then the util procedures > are in the tile::progressbar namespace. Is that right? Oops! Missed a spot. The widget name is ttk::progressbar, manpage fixed now. Also just committed some final fixes; the widget is now implemented and works more or less as documented. XP theme still (probably) looks wrong, haven't tested there yet. --Joe |
|
From: Joe E. <jen...@fl...> - 2005-03-01 03:50:33
|
Michael Kirkham wrote: > > 1. I don't think indeterminate bars should show the cylon block (dunno what > else to call it :P) when they are not running. "Cylon block" is an excellent name :-) I'm going to start calling it that instead. But yeah, with -mode indeterminate -value 0, the block probably shouldn't appear. Possibly the trough/track shouldn't be visible either. > 2. The start/stop stuff doesn't work under the Aqua theme. It turns the > track to a barber pole (actually the initial version always showed the barber > pole, but I fixed that) but doesn't animate. Phase is always 0. That doesn't sound right -- it worked for me on Aqua when I last tried it. Maybe I broke something between then and now... > Oh. And why "ttk::progress::start $w" instead of "$w start"? Judgment call, mostly; it just seemed to fit together better that way. We could make these widget methods instead; it just seemed better to me to handle this at the script level. Conversely, we could also handle the -phase-autoincrement logic at the script level, but since -phase is part of the interface between the widget and the theme I think it's better that the scripting layer not have to worry about it. More on this next message. --Joe English jen...@fl... |
|
From: Pat T. <pat...@us...> - 2005-02-25 20:22:19
|
-----BEGIN PGP SIGNED MESSAGE----- Joe English wrote: | We've had a progress bar widget for a while now, | but it's lacking documentation and is missing a few | features. Some things I can think of that it needs: | | | + An "indeterminate" (aka "barber-pole") mode. Currently | only the "determinate" (aka "thermometer") mode is supported. muonics is currently dealing with this. | Questions: Are the 'set' and 'get' methods really needed? | They're equivalent to [$w configure -value] and [$w cget -value], | respectively; or you can just access the linked -variable. If I remember correctly, I basically just copied the interface from the scale widget here. I see no problem rationalising the interface. | The current implementation also has -font, -foreground, | and -showvalue options (which don't do anything at the moment); | and -command and -width options, which I don't think are | needed either -- -width should be taken from the style, | and -command isn't really useful for output-only widgets | like this one. As above. Its got these only because Tk's scale has them. Pat Thoyts. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3-nr1 (Windows XP) iQCVAwUBQh+IzmB90JXwhOSJAQFztgP/VIUc3ymniX9+BjeCK5UHbujfNH4FGmn/ rEdTrel5WW5SArmuglLIe1Gx2il1CFQGj9VAh6/hdY9OjKZvt8nj/v0u5WQxzNSW 6xn+CDYhnNHDS/zVzFbkROVzyGql0df0XDhJMS5OTjyvVmt2T/01IOjzvOhvpHZT e7gxxlsC8kk= =f93T -----END PGP SIGNATURE----- |