[news.software.anu-news] Idea to fix newsitem scrolling problem

fac2@dayton.saic.com (Earle Ake) (02/23/90)

> The SMG display used to map the file to the screen is 500 rows deep - making it
> larger will enable you to view longer items without this problem, but still
> doen't address the problem of a finite size of the SMG display.
> 
> If you have any suggestions as to appropriate modifications to NEWSDISPLAY.C
> to enable arbitrary sized items to be mapped into a finite-sized SMG display
> with dual-directional scrolling, I'd be keen to see the code.

Geoff,

	All depends if you want to still support those folks running V4.x or
not with the new versions.  Evidently since you are using callable mail which
I believe is available only on V5.0 and above, you have already decided to
exclude those people running V4.x from future versions.  There is a new
set of routines added to the SMG functions for V5.0.  Look at the ones involving
viewports.  I have included a small FORTRAN program, (yes, I am a FORTRAN 
programmer first and other languages second) to illustrate how this could be 
done for ANU NEWS.  It sets up the SMG stuff, defines a 2000 row display, puts 
something in every line, defines a viewport into that display, and scrolls 
down and then back up through the display using the viewport defined.  Let me 
know if this is of any help to you.  Also, I didn't have any problems defining 
a 2000 row display under V5.1 as indicated above.  Must also be a V4.x bug.


	program testsmg

	implicit integer*4 (a-z)

	integer*4 smg$create_pasteboard, smg$create_virtual_keyboard
	integer*4 smg$create_virtual_display, smg$paste_virtual_display
	integer*4 status, pasteboard, keyboard, display
	character*24 string

	include '($smgdef)'

	rows = 2000

c
c	Create a pasteboard and keyboard
c

	status = smg$create_pasteboard(pasteboard)
	if(.not. status) call lib$stop(%val(status))

	status = smg$create_virtual_keyboard(keyboard)
	if(.not. status) call lib$stop(%val(status))

c
c	Create a 2000 row by 80 column display
c

	status = smg$create_virtual_display(rows,80,display)
	if(.not. status) call lib$stop(%val(status))

c
c	Define a viewport into previously mentioned display
c

	status = smg$create_viewport(display,1,1,10,30)
	if(.not. status) call lib$stop(%val(status))

c
c	Fill that sucker with stuff
c

	do i = 1, rows

	  write(string,1000) i
1000	  format('This is line number ',i4)

	  status = smg$put_chars(display,string,i,1,,,,)
	  if(.not. status) call lib$stop(%val(status))

	enddo

c
c	Paste the virtual display
c

	status = smg$paste_virtual_display(display,pasteboard,1,1)
	if(.not. status) call lib$stop(%val(status))

	status = lib$wait(2.0)
	if(.not. status) call lib$stop(%val(status))

c
c	Scroll down 500 lines
c

	status = smg$scroll_viewport(display,smg$m_up,500)
	if(.not. status) call lib$stop(%val(status))

	status = lib$wait(2.0)
	if(.not. status) call lib$stop(%val(status))

c
c	Scroll down 1200 lines
c

	status = smg$scroll_viewport(display,smg$m_up,1200)
	if(.not. status) call lib$stop(%val(status))

	status = lib$wait(2.0)
	if(.not. status) call lib$stop(%val(status))

c
c	Scroll up 1700 lines (at TOP again)
c

	status = smg$scroll_viewport(display,smg$m_down,1700)
	if(.not. status) call lib$stop(%val(status))

	status = lib$wait(2.0)
	if(.not. status) call lib$stop(%val(status))

	call exit
	end

-- 
_____________________________________________________________________________
             ____ ____    ___
Earle Ake   /___ /___/ / /     Science Applications International Corporation
           ____//   / / /__                 Dayton, Ohio
-----------------------------------------------------------------------------
Internet: fac2%dayton.saic.com@uunet.uu.net    uucp: uunet!dayvb!fac2