forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

New LOG slider option

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sat May 25, 2013 5:28 am    Post subject: New LOG slider option Reply with quote

I'd really like to see in CWP the following option. Consider this example

x=1
winio@('%20sl[LOG]', X, 0.01D0, 100.0D0)

With current linear scale we get initially at X=1 slider being too close to zero and it is impossible to do smooth sliding between 0.01 and 1.

With LOG scale slider would initially stay in the middle which correspond X=1. At 0 and 1/4 of slider length X will be equal 0.01 and 0.1 and at 3/4 and full slider length X=10.0 and 100.0 respectively

This should emulate known tech of LOG variable resistors used everywhere as sound regulators. With current linear slider scale we have to supply additional callback functions which transform linear slider into log
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat May 25, 2013 6:44 am    Post subject: Reply with quote

I will add this to the wish list.
If you could supply code for the callback then this would clarify what you are asking for.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sat May 25, 2013 7:05 pm    Post subject: Reply with quote

How we all work with LOG? I'll be more verbose, may be somebody will start using Clearwin/sliders/Simpleplot after that - the more users the more features. We do all manipulations with the exponent Y as in 10^Y or e^Y or other base ( which does not matter, it's just the convenience) instead of the X number itself which is equal 10^Y and when all manipulations with Y (which scales linearly) are done then we turn Y into the final number X=10^Y.

SO i use inside the slider instead of value X as in the example above its exponent Y=log10(X) and instead of mentioned limits 0.01 and 100 their log10(limits) which are -2 and 2. Initial value of slider is also substituted by log10(initialvalue)=log10(1) = 0.

Then inside the code i transform slider value Y to final needed value X just by X=10**Y. The code below demonstrates how difficult to use linear slider for calculating for example the frequency of LC circuit and how nice all goes with LOG one. I took L,C initially =1 and varying C in the mentioned above range. Transformation goes inside the function transfExpToValue

The option LOG (and may be LIN) to the slider looks like natural addition (as always better dynamically updatable). This will simplify integration with %fl%df%rf if they are also duplicating the slider functionality in more complex GUIs

Code:

 WINAPP
 INCLUDE <windows.ins>
 integer  transfExpToValue, SettingXYforPlotting
 external transfExpToValue, SettingXYforPlotting

 PARAMETER(n=1000)
 REAL*8 X(n),Y(n), ExpOfC, C, L
 common X, Y, ExpOfC, C, L, kBusyPlotting

 kBusyPlotting=0
 L=1
 ExpOfC=0
 i=winio@('%ww%ca[LOG Slider]&')
 i=winio@('%`bg[yellow] Log %ta%30^sl log10(C) %5rf %ta%`bg[yellow] C %5rf%ff&',  &
 ExpOfC, -2d0, 2d0, '+', transfExpToValue, SettingXYforPlotting, ExpOfC, C)

 i=winio@('%`bg[gray] Linear %ta%30^sl %3ta%`bg[gray] C %5rf %ff&', C, 0.01d0, 100d0, &
 SettingXYforPlotting, C)

 i=winio@('%pv%pl[x_array]%ff&',600,400,N,x,y)

 i=winio@('%sc&','+',transfExpToValue,SettingXYforPlotting)
 i=winio@('%ac[esc]&','exit')
 i=winio@('%ff%cn%tt[OK]')
 END

!......................................

 integer function transfExpToValue  ()
 PARAMETER(n=1000)
 REAL*8 X(n),Y(n), ExpOfC, C, L
 common X, Y, ExpOfC, C, L, kBusyPlotting

 C = 10.**ExpOfC
 transfExpToValue=1
 end function

!.......................................

 integer function SettingXYforPlotting()
 INCLUDE <windows.ins>
 PARAMETER(n=1000)
 REAL*8 X(n),Y(n), ExpOfC, C, L
 common X, Y, ExpOfC, C, L, kBusyPlotting

 do i= 1, n
  X(i)=i/100.
  Y(i)=SIN( X(i)/sqrt(L*C) )
 enddo
 if(kBusyPlotting.eq.1) goto 1
 kBusyPlotting = 1
 call simpleplot_redraw@
 kBusyPlotting = 0
1 continue
 SettingXYforPlotting=1
 end function
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group