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 

Native %pl
Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


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

PostPosted: Wed Oct 26, 2016 4:24 pm    Post subject: Native %pl Reply with quote

A native %pl is now available for beta testing in both 32 bit and 64 bit applications.

Please use the following DLL download carefully but only if you have version 8.05 of the FTN95 and only after backing up your existing Silverfrost DLLs.

The download includes a txt file that provides instructions together with a sample program.

https://www.dropbox.com/s/11preu54yrhi11n/newDlls11.zip?dl=0
Back to top
View user's profile Send private message AIM Address
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Wed Oct 26, 2016 9:20 pm    Post subject: Reply with quote

Great!....now it works as I expected: no plot if no data. Thanks Paul for the update!......and some additional comments: I have been playing with the new version and found that "pen_style" can be varied from 0 to 4, 0 is solid, 1 is dashed an 4 seems to me to be dotted (is this correct?), but it is not easy to distiguish them, at least on my screen (1920x1080). I have changed "width" from 1 to 8, trying to distiguish the different lines and got the same "visual" line thickness in all my plots (at least on my screen). I have no printer at the moment so I cannot check if the printed output shows better the differences between lines.
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Thu Oct 27, 2016 12:32 am    Post subject: Reply with quote

Some new findings......%pl seems to be very strict: if at the very beginning one sets, for instance, "N-graphs=2", then it is not possible to plot either 1 or 3 curves (or data sets) during the run of a program. It is obviously possible to do that by adding a new %pl statement with the new option for graphs, but then the call to this new %pl opens a new, additional window. Is this so, or am I doing anything wrong?.

Agustin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Oct 27, 2016 7:57 am    Post subject: Reply with quote

Agustin

Thank you for the feedback.

The pen styles are those provided by the Microsoft GDI/GDI+ and have constants PS_SOLID = 0 etc. You will be able to get details by searching Microsoft MSDN. ClearWin+ %pl provides an interface into GDI+. GDI+ can input a user-defined "dashed array" to define the spacing. This is available in %gr but not in %pl at the moment.

There is a bug that caused the line width to get lost and this has now been fixed. In the meantime it will work (I think) if you specify the line width as the last %pl option.

The primary design of the native %pl is constrained by the aim of porting existing code as far as possible without modification. The coding within the library is simply an extension of what was already present. A new design was not really a possibility within the time available.

Having got this far there will naturally be many ways that %pl can be extended but in the short term I can only add these to the wish list.

Providing a variable number of graphs within the present design might prove to be a challenge that is difficult to resist - I will try not to be tempted.
In the meantime you might try filling in by drawing dummy graphs with zero height at every point.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Thu Oct 27, 2016 2:37 pm    Post subject: Reply with quote

Agustin

I have added a new style value [style=3] that can be applied to any of the graphs drawn on one pair of axes. This bypasses the corresponding graph. There is also a new function SET_GRAPH_STYLE@(ID,INDEX,STYLE) that enables you to set the style (and activate or clear a graph) after the window has been created.

If you are interested in trying this out I will upload a new set of DLLs.
Back to top
View user's profile Send private message AIM Address
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Thu Oct 27, 2016 2:58 pm    Post subject: Reply with quote

Thanks Paul for your work....if you upload the new set of DLLs I will implement and try the new features of %pl with my code.

Agustin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Oct 27, 2016 5:05 pm    Post subject: Reply with quote

Here is a link to a new set of DLLs. The usual cautions still apply.

https://www.dropbox.com/s/2bu71rr4wcztuex/newDlls12.zip?dl=0
Back to top
View user's profile Send private message AIM Address
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Thu Oct 27, 2016 11:35 pm    Post subject: Reply with quote

I have been testing this new version of %pl and found some issues. I have added to your example a second function z(n):
Code:
 WINAPP
      MODULE mydata
        USE clrwin
       C_EXTERNAL SET_GRAPH_STYLE@ "__set_graph_style"(VAL,VAL,VAL):INTEGER*4
        INTEGER,PARAMETER::n=1000
        INTEGER n_points
        real*8:: y(n)=0.0,z(n)=0.0
      CONTAINS
      INTEGER FUNCTION draw()
        INTEGER i,x
        DOUBLE PRECISION p1,p2,p3
        p1=1.5d0
        p2=150.0d0
        p3=15d0
        x=0
        DO i=1,n
          y(i)=p1*sin(x/p3)*exp(-x/p2)
          x=x+1
        ENDDO
        i = set_graph_style@(0,1,0)
        CALL simpleplot_redraw@()
        draw = 2
      END FUNCTION draw

       INTEGER FUNCTION draw2()
        INTEGER i,x
        DOUBLE PRECISION p2,p3,p4
        p2=150.0d0
        p3=20d0
        p4=2
        x=0
        DO i=1,n
          z(i)=p4*sin(x/p3)*exp(-x/p2)
          x=x+1
        ENDDO
        i = set_graph_style@(0,2,2)
        CALL simpleplot_redraw@()
        draw2 = 2
      END FUNCTION draw2

      INTEGER FUNCTION clear()
        CALL clear_screen@()
        i = set_graph_style@(0,1,3)
        i = set_graph_style@(0,2,3)
        CALL simpleplot_redraw@()
        clear = 2
      END FUNCTION clear
      END MODULE mydata
     
      PROGRAM main
      USE mydata
      C_EXTERNAL WINOP@ '__winop'(INSTRING)
       n_points = 1000
      i=winio@('%ww[no_border]%ca[Damped wave]%pv&')
      i=winio@('%mn[Edit[Draw,draw2, Clear]]&', draw, draw2,clear)
      i=winio@('%fn[Tahoma]&')
      i=winio@('%ts&', 1.1d0)
      i=winio@('%tc&',rgb@(0,0,80))
      i=winio@('%it&')
      i=winio@('%`bg&',rgb@(230,255,225))
      CALL winop@("%pl[native]")
      CALL winop@("%pl[style=3]")     ! curve joins points
      CALL winop@("%pl[style=3]")     ! curve joins points
      CALL winop@("%pl[pen_style=0]")
      CALL winop@("%pl[pen_style=4]")
      CALL winop@('%pl[title="Sample plot"]')
      CALL winop@("%pl[x_axis=Time(Milliseconds)]")
      CALL winop@("%pl[y_axis=Amplitude@(-4.0)]")
      CALL winop@("%pl[smoothing=4]") ! anti-aliasing
      CALL winop@("%pl[smoothing=4]") ! anti-aliasing
      CALL winop@("%pl[width=1]")
      CALL winop@("%pl[width=4]")
      i=winio@("%pl[colour=red,colour=blue,N_GRAPHS=2]",500,400,n_points,0.0d0,1.0d0,y,z)
      END


The first problem I found is that "style" should be set to 3, or the program crashes (in the NativePl.txt says that one can set 0,1,2, but seems that the old "style" has been replaced by the SET_GRAPH_STYLE@, right? ). I do not understand quite well the actual meaning of "style" (maybe because I am using the "set_graph_style@(0,1,0)" the use of style=3 is mandatory?) . The second issue I found is that the second "width" is used for both plots. I guess this is a bug. For the rest, it seems that all works fine. I have run several times the program changing options and worked. I still have to test the use of %`pl for plotting one or the other plot.

Agustin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Oct 28, 2016 8:21 am    Post subject: Reply with quote

Agustin

I don't understand the problem about the style. Your program works OK for me except for a couple of details:

a) I have to add a call to clear_screen@ before drawing otherwise the title goes wrong.

b) I get an added box around the whole graph area after calling clear_screen.

I can probably fix both these issues.

In the design I have assumed that one line width and one smoothing value will apply to all graphs. So in your program the last value that is set will be applied to all graphs. If you need either of these to vary between graphs then I could change the design.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Fri Oct 28, 2016 11:48 am    Post subject: Reply with quote

Agustin

I have managed to get it to fail now so I will take a look at it.
Back to top
View user's profile Send private message AIM Address
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Fri Oct 28, 2016 12:58 pm    Post subject: Re: Reply with quote

PaulLaidler wrote:
Agustin

a) I have to add a call to clear_screen@ before drawing otherwise the title goes wrong..


yes, I forgot to mention this issue

Quote:

In the design I have assumed that one line width and one smoothing value will apply to all graphs. So in your program the last value that is set will be applied to all graphs. If you need either of these to vary between graphs then I could change the design.


Sorry, I did not know about this design, it was not mentioned in the notes and I assumed that this option worked as others: one option for each plot. As you say, I am also not sure if one really needs different widths for each type of line in a plot, but I think that this should be clarified in the corresponding notes.

By the way, yesterday night I was testing the use of two %pl windows using a handle (`%pl). I have to test some issues, but when I tried to plot y(n) on one %pl and z(n) on the other, it resulted that the second screen showed a black background. But I am still testing this, maybe I did something wrong.
Thanks for your work.

Agustin
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Fri Oct 28, 2016 1:41 pm    Post subject: Reply with quote

Paul,

I am testing the use of %`pl option and found that in the best case, the same data is plotted on both secreens. I have set:

i=winio@("%`pl[colour=red,N_GRAPHS=1]&",500,400,n_points,0.0d0,1.0d0,y,1)
and
i=winio@("%`pl[colour=blue,N_GRAPHS=1]&",500,400,n_points,0.0d0,1.0d0,z,2)

and

i = set_graph_style@(1,1,0)

in function draw()

and
i = set_graph_style@(2,2,0)

in function draw2()

Am I right?....what I get are two windows and only the first plot is drawn in either window 1 or window 2. I guess I am doing something wrong, but what?

Agustin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Oct 29, 2016 10:10 am    Post subject: Reply with quote

Agustin

I have fixed a couple of bugs and simplified the design.

Here is a link to a new set of DLLs. The download includes new mod files, instructions and sample programs.

https://www.dropbox.com/s/hgobb0wix83d8ce/newDlls13.zip?dl=0

18 Sept 2017 This link has expired.


Last edited by PaulLaidler on Mon Sep 18, 2017 1:14 pm; edited 1 time in total
Back to top
View user's profile Send private message AIM Address
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Sat Oct 29, 2016 5:16 pm    Post subject: Reply with quote

I am testing the new dll and find that things run better now. I see that you eliminated the set_graph_style@ routine. Although this routine was a good idea, in the end introduced some confusion with the old directives for %pl. Now all is simpler and straightforward. There is however a bug: when you plot two %pl, everything is OK.....only if you maintain the size of the window: when you maximise the window, the second plot appears on top at the left and with the original size. Only the first plot is increased in size (I haven't tried what happens with four plots Smile ).

And now some comments:

a) the code you wrote in the notes does not include the statement "C_EXTERNAL WINOP@ '__winop'(INSTRING)", however you need it or the complier does not understand the winop@ statements.

b) the number of labels (and labels, and number of ticks) cannot be set by the user, they are set by clearwin and changes with the size of the window. Should it be so?. Is there any (simple) chance to modify this behaviour?

Thanks again for your work. Have a nice weekend!

Agustin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Oct 29, 2016 5:42 pm    Post subject: Reply with quote

Agustin

With two %pl controls the %pv does not work. We need to take the %pv out of that sample program. It is not a fault in the code but a limitation of %pv that it only works for one resizable control.

a) I have added winop@ to the .ins and mod files that are included in the download. If you use these then it should be OK.

b) Yes, the number of ticks cannot be set by the user. Also the user does not have much control over the way that the numbers at the tick marks are presented. I think that this was also true in the original %pl.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Page 1 of 9

 
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