X-Git-Url: http://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=Ada95%2Fsamples%2Fncurses2-acs_and_scroll.adb;h=5d965983b84e7a14b2c5674e7b1b6203791bb334;hb=77afe78361875f531dc2bf8d73f2e781c8e76176;hp=65c2939a8597426b277f5675fcfc16892389a088;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01;p=ncurses.git diff --git a/Ada95/samples/ncurses2-acs_and_scroll.adb b/Ada95/samples/ncurses2-acs_and_scroll.adb index 65c2939a..5d965983 100644 --- a/Ada95/samples/ncurses2-acs_and_scroll.adb +++ b/Ada95/samples/ncurses2-acs_and_scroll.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000-2008,2009 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.9 $ +-- $Date: 2009/12/26 17:38:58 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- Windows and scrolling tester. @@ -55,14 +56,12 @@ with Ada.Streams; use Ada.Streams; procedure ncurses2.acs_and_scroll is - Macro_Quit : constant Key_Code := Character'Pos ('Q') mod 16#20#; Macro_Escape : constant Key_Code := Character'Pos ('[') mod 16#20#; Quit : constant Key_Code := CTRL ('Q'); Escape : constant Key_Code := CTRL ('['); - Botlines : constant Line_Position := 4; type pair is record @@ -94,9 +93,6 @@ procedure ncurses2.acs_and_scroll is dx : Column_Position); function delete_framed (fp : FrameA; showit : Boolean) return FrameA; - use Ada.Streams.Stream_IO; - - -- A linked list -- I wish there was a standard library linked list. Oh well. type Frame is record @@ -172,7 +168,6 @@ procedure ncurses2.acs_and_scroll is when Curses_Exception => return False; end HaveScroll; - procedure newwin_legend (curpw : Window) is package p is new genericPuts (200); @@ -224,8 +219,8 @@ procedure ncurses2.acs_and_scroll is ); buf : Bounded_String; - do_keypad : Boolean := HaveKeyPad (curpw); - do_scroll : Boolean := HaveScroll (curpw); + do_keypad : constant Boolean := HaveKeyPad (curpw); + do_scroll : constant Boolean := HaveScroll (curpw); pos : Natural; @@ -272,7 +267,6 @@ procedure ncurses2.acs_and_scroll is Clear_To_End_Of_Line; end newwin_legend; - procedure transient (curpw : Window; msg : String) is begin newwin_legend (curpw); @@ -289,16 +283,15 @@ procedure ncurses2.acs_and_scroll is else Add (Str => "All other"); end if; - Add (str => " characters are echoed, window should "); + Add (Str => " characters are echoed, window should "); if not HaveScroll (curpw) then Add (Str => "not "); end if; - Add (str => "scroll"); + Add (Str => "scroll"); Clear_To_End_Of_Line; end transient; - procedure newwin_report (win : Window := Standard_Window) is y : Line_Position; x : Column_Position; @@ -331,8 +324,8 @@ procedure ncurses2.acs_and_scroll is res : pair; i : Line_Position := 0; j : Column_Position := 0; - si : Line_Position := lri - uli + 1; - sj : Column_Position := lrj - ulj + 1; + si : constant Line_Position := lri - uli + 1; + sj : constant Column_Position := lrj - ulj + 1; begin res.y := uli; res.x := ulj; @@ -401,7 +394,6 @@ procedure ncurses2.acs_and_scroll is end loop; end selectcell; - function getwindow return Window is rwindow : Window; ul, lr : pair; @@ -441,7 +433,6 @@ procedure ncurses2.acs_and_scroll is return rwindow; end getwindow; - procedure newwin_move (win : Window; dy : Line_Position; dx : Column_Position) is @@ -499,8 +490,9 @@ begin case c is when Character'Pos ('c') mod 16#20# => -- Ctrl('c') declare - neww : FrameA := new Frame'(null, null, False, False, - Null_Window); + neww : constant FrameA := new Frame'(null, null, + False, False, + Null_Window); begin neww.wind := getwindow; if neww.wind = Null_Window then @@ -533,11 +525,11 @@ begin current := current.last; end if; when Character'Pos ('F') mod 16#20# => -- Ctrl('F') - if current /= null and HaveScroll (current.wind) then + if current /= null and then HaveScroll (current.wind) then Scroll (current.wind, 1); end if; when Character'Pos ('B') mod 16#20# => -- Ctrl('B') - if current /= null and HaveScroll (current.wind) then + if current /= null and then HaveScroll (current.wind) then -- The C version of Scroll may return ERR which is ignored -- we need to avoid the exception -- with the 'and HaveScroll(current.wind)' @@ -714,7 +706,7 @@ begin Allow_Scrolling (Mode => True); - End_Mouse; + End_Mouse (Mask2); Set_Raw_Mode (SwitchOn => True); Erase; End_Windows;