replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - New Video
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 Video
Goto page Previous  1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Sat Jun 20, 2020 10:56 pm    Post subject: Reply with quote

Martin,

The %pl call back will only be called once by the pl part of the code and that is when the %pl region is initially created. This is indicated by the presence of the PLOT_ADJUST string. The captions will therefore be drawn initially correctly. Subsequent calls to SIMPLEPLOT_REDRAW@ will now no longer call the %pl call back, so the actions that previously were there triggered by the PLOT_ADJUST string have to be placed elsewhere.

Move everything that was within the

Code:
 IF (cb_reason .eq. 'PLOT_ADJUST') THEN  ;;;;;; END IF

to a new subroutine

Call this new subroutine from within the IF (cb_reason .eq. 'PLOT_ADJUST') THEN control block in the pl_cb, and also after your calls to SIMPLEPLOT_REDRAW@. With the previous DLLs the call to SIMPLEPLOT_REDRAW@ would call the pl_cb � now it does not.

If you do this it should fix your axes problem.

No changes should be necessary to any other parts of the pl_cb associated with mouse moves etc.

Paul, may have an idea why the previous limits set for the pl region now appear to get forgotten � which is a change to the way the program operated before.

I did a quick test on my previous code � the one with the buttons to pan and zoom. I added another button, the call back of which only calls simpleplot_redraw@ and the currently selected limits, after a zoom operation are not �lost�. Added another button which changes the data to be plotted, - again the call to SIMPLEPLOT_REDRAW@ associated with this does not change the plot limits. This code is below.

If you comment out all the code in the pl_cb associated with a mouse move and drawing the yellow box of coordinates does the zoom function still fail?

Ken
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Sat Jun 20, 2020 10:58 pm    Post subject: Reply with quote

Code:

implicit none
integer, parameter :: dp = kind(1.d0), n = 1000
real(kind=dp), parameter :: pi = 3.14159265359d0, dt = 1.d-4, omega = 50.d0*2.d0*pi, ta = 0.040d0
real(kind=dp) t1(1:n), ac(1:n), dc(1:n), inst(1:n), xmin_data, xmax_data, ymin_data, ymax_data, xstep, ystep
real(kind=dp) x_min_now, x_max_now, y_min_now, y_max_now
contains
  integer function generate_data()
  integer i
  real(kind=dp) ran
  ran=random@()
    do i = 1, n, 1
      if (i .gt. 1) then
        t1(i) = t1(i-1) + dt
      else
        t1(i) = 0.d0
      end if
      ac(i) = ran*sqrt(2.d0)*cos(omega*t1(i)-pi)  ;  dc(i) = -ac(1)*exp(-t1(i)/ta) ; inst(i)=ac(i)+dc(i)
    end do
    generate_data = 1
  end function generate_data
  integer function plot()
  include<windows.ins>
  integer, save :: iw
    xmin_data = minval(t1)  ; xmax_data = maxval(t1)
    ymin_data = min(minval(ac), minval(dc), minval(inst)) ; ymax_data = max(maxval(ac), maxval(dc), maxval(inst))
    xstep = (xmax_data - xmin_data)/10.d0 ; ystep = (ymax_data - ymin_data)/10.d0
    x_min_now = xmin_data ; x_max_now = xmax_data ; y_min_now = ymin_data ; y_max_now = ymax_data
    call winop@('%pl[native,x_array,gridlines,n_graphs=3,width=2,frame,etched,colour=blue,colour=red,colour=black]')
    iw = winio@('%pl[full_mouse_input]&',700,600,n,t1,ac,dc,inst)
    iw = winio@('%ob[scored]&')
    iw = winio@('%2nl%cn%^tt[Zoom in]&',              zoom_in_cb)
    iw = winio@('%2nl%cn%^tt[Zoom out]&',             zoom_out_cb)
    iw = winio@('%2nl%cn%^tt[Full extents]%2nl&',     zoom_out_full_cb)
    iw = winio@('%2nl%cn%^tt[Pan pos X]&',            pan_positive_x_cb)
    iw = winio@('%2nl%cn%^tt[Pan neg X]&',            pan_negative_x_cb)
    iw = winio@('%2nl%cn%^tt[Pan pos Y]&',            pan_positive_y_cb)
    iw = winio@('%2nl%cn%^tt[Pan neg Y]&',            pan_negative_y_cb)
    iw = winio@('%2nl%cn%^tt[Simpleplot Redraw]&',    spr_cb)
    iw = winio@('%2nl%cn%^tt[New data]&',             new_data_cb)
    iw = winio@('%cb%ff%2nl%cn%tt[Close]&')
    iw = winio@(' ') ; plot = 1
  end function plot
  integer function spr_cb()
  include<windows.ins>
    call simpleplot_redraw@()
    spr_cb = 1
  end function spr_cb
  integer function new_data_cb()
  include<windows.ins>
  integer i
    i = generate_data()
    call simpleplot_redraw@()
    new_data_cb = 1
  end function new_data_cb
  integer function update_pl_limits()
  include<windows.ins>
  integer k
    k = CHANGE_PLOT_DBL@(0, 'x_min', 0, x_min_now) ; k = CHANGE_PLOT_DBL@(0, 'x_max', 0, x_max_now)
    k = CHANGE_PLOT_DBL@(0, 'y_min', 0, y_min_now) ; k = CHANGE_PLOT_DBL@(0, 'y_max', 0, y_max_now)
    call simpleplot_redraw@()           
    update_pl_limits = 1
  end function update_pl_limits
  subroutine swap_real_dp(r1,r2)
  real(kind=dp), intent(inout) :: r1, r2
  real(kind=dp) temp
    temp = r2 ; r2 = r1 ; r1 = temp
  end subroutine swap_real_dp
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Sat Jun 20, 2020 10:58 pm    Post subject: Reply with quote

Code:
  integer function zoom_out_cb()
  include<windows.ins>
  integer i
    x_min_now = x_min_now - xstep ; x_max_now = x_max_now + xstep ; y_min_now = y_min_now - ystep ; y_max_now = y_max_now + ystep
    i = update_pl_limits() ; zoom_out_cb = 1
  end function zoom_out_cb
  integer function zoom_in_cb()
  real(kind=dp) x_min_now_save, x_max_now_save, y_min_now_save, y_max_now_save
  integer i
  integer, save :: iw
    x_min_now_save = x_min_now ; x_max_now_save = x_max_now  ; y_min_now_save = y_min_now ; y_max_now_save = y_max_now
    x_min_now = x_min_now + xstep ; x_max_now = x_max_now - xstep ; y_min_now = y_min_now + ystep ; y_max_now = y_max_now - ystep
    if ( ( x_max_now - x_min_now .gt. xstep ) .and. ( y_max_now - y_min_now .gt. xstep ) ) then
      i = update_pl_limits()
    else
      x_min_now = x_min_now_save ; x_max_now = x_max_now_save ; y_min_now = y_min_now_save ; y_max_now = y_max_now_save
      iw = winio@('%ws%2nl%cn%tt[Continue]','Max zoom level with this control.')
    end if
   zoom_in_cb = 1
  end function zoom_in_cb
  integer function zoom_out_full_cb()
  integer i
!    x_min_now = xmin_data ; y_min_now = ymin_data ; x_max_now = xmax_data ; y_max_now = ymax_data
!   Copied from function plot() - since the extent of the data may have changed following a call to new_data
    xmin_data = minval(t1)  ; xmax_data = maxval(t1)
    ymin_data = min(minval(ac), minval(dc), minval(inst)) ; ymax_data = max(maxval(ac), maxval(dc), maxval(inst))
    xstep = (xmax_data - xmin_data)/10.d0 ; ystep = (ymax_data - ymin_data)/10.d0
    x_min_now = xmin_data ; x_max_now = xmax_data ; y_min_now = ymin_data ; y_max_now = ymax_data
    i = update_pl_limits()
    zoom_out_full_cb = 1
  end function zoom_out_full_cb
  integer function pan_positive_x_cb()
  integer i
    x_min_now = x_min_now + xstep ; x_max_now = x_max_now + xstep ; i = update_pl_limits() ; pan_positive_x_cb = 1
  end function pan_positive_x_cb
  integer function pan_negative_x_cb()
  integer i
    x_min_now = x_min_now - xstep ; x_max_now = x_max_now - xstep ; i = update_pl_limits() ; pan_negative_x_cb = 1
  end function pan_negative_x_cb
  integer function pan_positive_y_cb()
  integer i
    y_min_now = y_min_now + ystep ; y_max_now = y_max_now + ystep ; i = update_pl_limits() ; pan_positive_y_cb = 1
  end function pan_positive_y_cb
  integer function pan_negative_y_cb()
  integer i
    y_min_now = y_min_now - ystep ; y_max_now = y_max_now - ystep ; i = update_pl_limits() ; pan_negative_y_cb = 1
  end function pan_negative_y_cb
end module example
program main
use example
implicit none
integer i
i = generate_data() ; i = plot()
end program main
Back to top
View user's profile Send private message
Martin_K



Joined: 09 Apr 2020
Posts: 227

PostPosted: Sun Jun 21, 2020 11:22 pm    Post subject: Reply with quote

Ken,

profound thanks for your help! Today, I had another family program so I was
not able to seat in front of my PC. I will do it within next week.

BUT, I already did what you suggest practically immediately after your advise (your post of Friday, June 19, 3.46pm)!

I was struggling with this change a while and my best result was that I achieved that the axes captions were always present (even after zooming in/out),
BUT the problem with automatic zoom to extents, when I moved with mouse cursor over graphs, remained unsolved with these changes! It means, as soon as I move the cursor over the graphs after some zooming in/out, the program automatically re-draws whole graphs to their extents.

I have to mention that I created a FUNCTION called within the block IF (cb_reason.eq. 'PLOT_ADJUST') THEN ... END IF, which contained everything, NOT SUBROUTINE! I suppose it should make no difference.

It looked as follows:

Code:

!integer function new_dll_cb()

!        CALL SELECT_GRAPHICS_OBJECT@(handle_pl)
!      call simpleplot_redraw@()
       
!      CALL select_font@('arial')
!        CALL bold_font@(1)
!!        CALL size_in_pixels@(15,15)
!        CALL size_in_points@(15,15)
!        CALL draw_characters@('Y_S-JTSK [m]',600,630,RGB@(255,0,255))
!        CALL rotate_font@(90.0d0)
!        CALL draw_characters@('X_S-JTSK [m]',90,400,RGB@(255,0,255))
!        CALL rotate_font@(0.0d0)
!   i = COPY_GRAPHICS_REGION@(handle_internal_gr, 1, 1, gw, gh, handle_pl, 1, 1, gw, gh, 13369376)

!new_data_cb = 2
!end function new_dll_cb
....
....
IF (cb_reason .eq. 'PLOT_ADJUST') THEN

i = new_dll_cb()

END IF




In next days I will create a subroutine (instead of function), if it should help to solve my problem. I will give a feedback as soon as I get something new.
At the moment I am quite sceptic, since there are some additional issues (the switching on/off of graphs does not work correctly). Since I am already under time
pressure to present the results of the whole graphics in a seminar, probably I will downgrade the DLL�s back to the previous ones,
where everything worked problem free and later, after seminar, I will try to adapt whole program to the latest DLLs, since now - the %PL command offers
very exciting features and flexibility (it would be for us as surveyors worthful, when it would be added to the %PL still the option SCALE)!.

However, my program has about 1300 lines of code in 5 different subroutines/modules, so it will not be a easy work.

Martin
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Mon Jun 22, 2020 4:05 am    Post subject: Reply with quote

Paul,
Tried this new feature and my immediate wish was to set parameters in the file. If user often doing changes (adjusting minimum and maximum x and y, changing step etc) he will be forced to recompile the code every time he adjusts the plot for new variants. There exist tasks where you set the plot just ones for all future cases but in vast other life situations you need permanently change something in the plot.

Parameters are automatically saved in the filename which user provides for this specific plot, and they will be automatically loaded from same file when user next time opens this specific plot. No further intervention is needed, all done in background. This is how all my plots are set in all programs, no recompilation needed. There was no single plot ever which I set ones and never changed something in it again! Besides it is easy quickly clone old plot to new plot using existing plot settings if needed

May be there exist situations where current way of save setting could be the only practical method but I can not quickly imagine one. I understand that this was just the demo, and your route for the final product lie in different way
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jun 22, 2020 8:01 am    Post subject: Reply with quote

Dan

At the moment I don't understand what you are asking for.

Do you want ClearWin+ to offer to save the data to a file and prompt for a file name?

As it is, your program can save the data to a file and read it back on the next run. You will have to do the reading back anyway even if ClearWin+ saves to a file for you.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Mon Jun 22, 2020 10:16 am    Post subject: Reply with quote

The mechanism within ClearWin+ that is used to block re-entry to a %pl callback from a call to simpleplot_redraw@ has been modified. With this change, calling simpleplot_redraw@ will lead to a call to the callback but a call to simpleplot_redraw@ from the %pl callback will be blocked.

New DLLs that incorporate this change can be downloaded via the link given here http://forums.silverfrost.com/viewtopic.php?t=4245.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Mon Jun 22, 2020 12:01 pm    Post subject: Reply with quote

Martin,

your old code may well work with today's DLLs - which implement the change that was made but in a different way. I don't have time to download and test myself until this evening.

Ken
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Mon Jun 22, 2020 1:17 pm    Post subject: Reply with quote

Paul
I meant to offer an option that settings data saved to the harddrive automatically at the exit of settings process. In this case next time you run this program it starts not with basic plot like it does for first time but already using created settings. For that additional filename has to be provided like

Call Winop@('AutoSetfile=PLplotMain01.set')

and that's basically it

Of course user can save settings by himself and read them next time program runs but that is an additional programming by the user. With above mentioned addition the user will be able to use both options for saving settings to harddrive if he wants plus use the existing saving to the clipboard with recompilation. The automatic saving settings to the disk with similarly automatic reading next time program runs the plot will be the most used I predict
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jun 22, 2020 3:27 pm    Post subject: Reply with quote

Dan

I will see what can be done.

John

The order is coded using the following list but you will need to remove some items particularly those like line colour that vary from one line to another. Line attributes are added one line at a time at the end of the first two lists each of which is terminated by a semi-colons.


Code:
enum
{
  pl_title_ix,
  pl_title_iy,
  pl_xcap_ix,
  pl_xcap_iy,
  pl_ycap_ix,
  pl_ycap_iy,
  pl_tick_value_ix,
  pl_tick_value_iy,
  pl_xmin_supplied,
  pl_ymin_supplied,
  pl_xmax_supplied,
  pl_ymax_supplied,
  pl_x_sigfigs,
  pl_y_sigfigs,
  pl_width,
  pl_depth,
  pl_link,
  pl_pen_style,
  pl_line_width,
  pl_symbol,
  pl_symbol_size,
  pl_axes_pen,
  pl_frame_pen,
  pl_tick_len,
  pl_gridlines,
  pl_frame,
  pl_framed,
  pl_etched,
  pl_external_ticks,
  pl_fixed_aspect,
  pl_title_height,
  pl_caption_height,
  pl_tick_value_height,
  pl_back_colour,
  pl_font_colour,
  pl_margin_left,
  pl_margin_top,
  pl_margin_right,
  pl_margin_bottom,
  pl_smoothing,
  pl_idata_end
};

enum
{
  pl_xmin,
  pl_ymin,
  pl_xmax,
  pl_ymax,
  pl_ddx,
  pl_ddy,
  pl_fdata_end
};
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Mon Jun 22, 2020 4:45 pm    Post subject: Reply with quote

Paul,

Which .mod and .inc files go alongside the new DLLs?

I'm a bit reticent to make any further changes now.

Currently, I have the new .mod and .inc files on my machine, i.e. those from the link from your post above on Fri Jun 19, 2020 8:43 am

Ken
Back to top
View user's profile Send private message
Martin_K



Joined: 09 Apr 2020
Posts: 227

PostPosted: Mon Jun 22, 2020 5:09 pm    Post subject: Reply with quote

There is probably something missing with the new DLLs v48 (.mod file?), I have a problem when creating executable (TARGET DOES NOT EXIST) with FTN v8.63 and DLLs v48,
so I had to copy back the v47 DLLs. I copied the FTN v8.63 along with DLLs v48, it does not work.

As soon as I copied back the DLLs either v47 or v46, it works also with FTN v8.63.

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


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

PostPosted: Mon Jun 22, 2020 6:30 pm    Post subject: Reply with quote

You should use the latest mod and ins files from the last link on this thread. You won't find them in the other download.
Back to top
View user's profile Send private message AIM Address
Martin_K



Joined: 09 Apr 2020
Posts: 227

PostPosted: Mon Jun 22, 2020 7:40 pm    Post subject: Reply with quote

Thanks Paul!

I used the latest .mod and .ins files with the v48 DLLs and after you modified the DLLs, now, NEARLY everything works for me problem free
(with classical direct calls to SIMPLEPLOT_REDRAW@!). So, there is no need to re-code some parts of my program (very joyful info for me)!

Again - many thanks, Paul!

Just still one small issue/question to SYMBOL=12:

After several clicks on zoom in or zoom out and then a click on zoom to extents, SOMETIMES (not always and I did NOT observed some systematic behaviour, only random behaviour) I get instead of PLUS (+) signs, a rectangular symbol (see picture below):



Do you have any idea, why it occurs?

Martin
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 818
Location: Lanarkshire, Scotland.

PostPosted: Mon Jun 22, 2020 8:42 pm    Post subject: Reply with quote

Martin,

Do you have any calls to CHANGE_PLOT_INT@ in your code where the second argument is �symbol� ?

Ken
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 -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 3 of 6

 
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