 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8177 Location: Salford, UK
|
Posted: Sat Jan 25, 2025 7:43 am Post subject: |
|
|
Ken
Upon reflection, I think that %pl[external] ought to pick up the local font and I will take a look at this.
In the mean time I would expect the font (and background colour) to be picked up by the original %gr. |
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 799 Location: Hamilton, Lanarkshire, Scotland.
|
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 799 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Sun Jan 26, 2025 3:07 pm Post subject: |
|
|
It took me a while to realise that the %pl[external,buffered] has only a fleeting existence, being destroyed after the image is copied to the %gr. So calls later to simpleplot_redraw@ do not update the %gr.
Here is a minimum example to show what is required to get this approach to work.
Code: | module sin_wave
use clrwin
implicit none
integer, parameter :: max_size = 100, gw = 900, gh = 500
real*8, parameter :: freq = 50.d0, omega = 2.d0*freq*4.d0*atan(1.d0)
real*8, parameter :: t_end = 1.d0/freq, dt = t_end / (max_size - 1)
real*8 :: y(max_size)
integer :: i
integer :: npts
contains
integer function gui()
integer :: iw
y = [(sin(omega*((i - 1) * dt)), i = 1, max_size)]
iw = winio@('%^bt[Run]%nl&',run_cb)
iw = winio@('%gr[white]&', gw, gh)
iw = winio@('')
gui = 1
end function gui
integer function plot()
integer :: iw
iw = winio@('%pl[native,n_graphs=1,axes_pen=2,width=3,external,buffered]',&
npts,0.d0,dt,y)
plot = 2
end function plot
integer function run_cb()
integer :: i, k
do i = 1, max_size
npts = i
k = plot()
call sleep@(0.02)
end do
run_cb = 2
end function run_cb
end module sin_wave
winapp
program test
use sin_wave, only : gui
i = gui()
end program test |
|
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8177 Location: Salford, UK
|
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 799 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Mon Jan 27, 2025 10:30 am Post subject: |
|
|
Paul, Thanks for your efforts on this. My test code works as expected now. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Tue Jan 28, 2025 9:41 am Post subject: |
|
|
Ken,
I am a bit behind, as I am not using Ver 9.06 as yet.
However I ran your 27-Jan example in Plato (without buffering), plus having FTN95 help window opened and the FTN95 Help window index was also flickering.
Also noticed "call sleep@(0.02)" was also working, contrary to sleep@(time), for time < .05.
Thanks for the examples. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8177 Location: Salford, UK
|
Posted: Tue Jan 28, 2025 11:36 am Post subject: |
|
|
John
There was a bug in ClearWin+ that in some contexts was causing other applications to flicker. This has been fixed. |
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 799 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Tue Jan 28, 2025 1:07 pm Post subject: |
|
|
Paul,
If you run this program a dozen times, you may get a surprise. Using winop@ calls and extremely rapid update I occasionally get the clearwin error "Too many colours for %pl plot".
I m guessing, but it looks like the character string created by winop@ in the previous iteration is not cleared.
Code: | module data_mod
use clrwin
implicit none
integer, parameter :: n = 100
real*8 :: x(n), random_y(n), mean_y(n)
end module data_mod
program p
implicit none
integer :: iw
integer, external :: run_cb
iw = winio@('%^bt[Run]%nl&',run_cb)
iw = winio@('%gr[white]', 900, 600)
end program p
integer function run_cb()
use data_mod
implicit none
integer :: i, iw
real*8 :: acc
call random_number(random_y)
acc = 0.d0
do i = 1, n, 1
x(i) = dble(i)
acc = acc + random_y(i)
mean_y(i) = acc / x(i)
!$$$$$$ iw = winio@('%fn[Consolas]%ts&',1.5d0)
!$$$$$$ iw = winio@('%pl[native,n_graphs=2,frame,gridlines,width=3,'//&
!$$$$$$ 'link=none,colour=red,symbol=10,'//&
!$$$$$$ 'link=lines,colour=blue,symbol=0,'//&
!$$$$$$ 'external,buffered'//']', i, 1.d0, 1.d0, random_y, mean_y)
! The code commented out above works without any issues.
! The equivalent code below using winop@ calls will
! ** on occasion ** fail reporting the clearwin error
! "Too many colours for %pl plot"
! This happens when i is small, typically < 6
print*, i
call winop@('%pl[native]')
call winop_int@('%pl[n_graphs]', 2)
call winop@('%pl[frame,gridlines]')
call winop_int@('%pl[width]',3)
call winop@('%pl[link=none,colour=red,symbol=10]')
call winop@('%pl[link=lines,colour=blue,symbol=0]')
call winop@('%pl[external,buffered]')
iw = winio@('%fn[Consolas]%tc[blue]%ts&',1.5d0)
iw = winio@('%pl', i, 0.d0, 1.d0, random_y, mean_y)
end do
run_cb = 2
end function run_cb |
|
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8177 Location: Salford, UK
|
Posted: Wed Jan 29, 2025 8:48 am Post subject: |
|
|
Ken
When setting the number of graphs, it must be the first option when using winop@ etc..
Also it looks like the %pl options must be kept together by moving the font attributes to the beginning. But I don't know why this is necessary.
So...
iw = winio@('%fn[Consolas]%tc[blue]%ts&',1.5d0)
call winop_int@('%pl[n_graphs]', 2)
call winop@('%pl[native]')
call winop@('%pl[frame,gridlines]')
call winop_int@('%pl[width]',3)
call winop@('%pl[link=none,colour=red,symbol=10]')
call winop@('%pl[link=lines,colour=blue,symbol=0]')
call winop@('%pl[external,buffered]')
iw = winio@('%pl', i, 0.d0, 1.d0, random_y, mean_y)
then maybe a call to perform_graphics_update@() and temporary_yield@() might be good. |
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 799 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Wed Jan 29, 2025 11:46 am Post subject: |
|
|
Thanks Paul,
For some reason I had it in my head that the requirement for n_graphs to be in the first winop@ call only applied when n_graphs > 10. I�m pretty sure that�s stated in the documentation somewhere.
All working now.
Also fine in the case where there are multiple %gr regions and a call to select_graphics_object@ is required. I plan to do a few more tests. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8177 Location: Salford, UK
|
Posted: Wed Jan 29, 2025 12:58 pm Post subject: |
|
|
Yes. The documentation needs fixing. The change may not get into the next full release. |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2910 Location: South Pole, Antarctica
|
Posted: Wed Jan 29, 2025 3:29 pm Post subject: |
|
|
Thanks, Paul, for polishing one more thing in CWP.
Noticed something unusual here: winop_int@ and when looked at ctwplus.enh file I found a lot of things I missed because did not have time to look into this file hidden deeply into the directory structure. All these new features have to be actively advertised otherwise the situation look like with Franz Schubert, who was writing all his music into the table shelf  |
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 799 Location: Hamilton, Lanarkshire, Scotland.
|
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 799 Location: Hamilton, Lanarkshire, Scotland.
|
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8177 Location: Salford, UK
|
Posted: Mon Feb 03, 2025 8:24 am Post subject: |
|
|
Ken
These applications are very impressive. |
|
Back to top |
|
 |
|
|
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
|