]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - Ada95/samples/ncurses2-demo_pad.adb
ncurses 5.9 - patch 20110807
[ncurses.git] / Ada95 / samples / ncurses2-demo_pad.adb
index 399a2f4b5c82ba3deb0cb8740151475aaf17b5b9..b1b72aec0b60a3ef96d91b5671fd46fc447a31f8 100644 (file)
@@ -7,7 +7,7 @@
 --                                 B O D Y                                  --
 --                                                                          --
 ------------------------------------------------------------------------------
--- Copyright (c) 2000,2004 Free Software Foundation, Inc.                   --
+-- Copyright (c) 2000-2008,2011 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,8 +35,8 @@
 ------------------------------------------------------------------------------
 --  Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000
 --  Version Control
---  $Revision: 1.5 $
---  $Date: 2004/08/21 21:37:00 $
+--  $Revision: 1.8 $
+--  $Date: 2011/03/23 00:44:12 $
 --  Binding Version 01.00
 ------------------------------------------------------------------------------
 with ncurses2.util; use ncurses2.util;
@@ -121,13 +121,12 @@ procedure ncurses2.demo_pad is
          retval.seconds := 0;
          retval.microseconds := 0;
       else
-         retval.seconds := Integer (t.tv_sec);
-         retval.microseconds := Integer (t.tv_usec);
+         retval.seconds := Integer (t.all.tv_sec);
+         retval.microseconds := Integer (t.all.tv_usec);
       end if;
       return retval;
    end gettime;
 
-
    --  in C, The behavior of mvhline, mvvline for negative/zero length is
    --  unspecified, though we can rely on negative x/y values to stop the
    --  macro. Except Ada makes Line_Position(-1) = Natural - 1 so forget it.
@@ -153,9 +152,6 @@ procedure ncurses2.demo_pad is
       end if;
    end do_v_line;
 
-
-
-
    function padgetch (win : Window) return Key_Code is
       c : Key_Code;
       c2 : Character;
@@ -246,7 +242,6 @@ procedure ncurses2.demo_pad is
       end if;
    end panner_v_cleanup;
 
-
    procedure panner (pad    : Window;
                      top_xp : Column_Position;
                      top_yp : Line_Position;
@@ -301,7 +296,6 @@ procedure ncurses2.demo_pad is
          end if;
       end greater;
 
-
       pymax : Line_Position;
       basey : Line_Position := 0;
       pxmax : Column_Position;
@@ -358,7 +352,7 @@ procedure ncurses2.demo_pad is
                --  bottom-right corner fixed.
             when Character'Pos ('h') =>
                --  increase-columns: move left edge to left
-               if top_x <= 0 then
+               if top_x = 0 then
                   Beep;
                else
                   panner_v_cleanup (top_y, top_x, porty);
@@ -377,7 +371,7 @@ procedure ncurses2.demo_pad is
                end if;
             when Character'Pos ('k') =>
                --  increase-lines: move top-edge up
-               if top_y <= 0 then
+               if top_y = 0 then
                   Beep;
                else
                   top_y := top_y - 1;
@@ -598,19 +592,21 @@ procedure ncurses2.demo_pad is
 
          Update_Screen;
 
-         if timing then declare
-            s : String (1 .. 7);
-            elapsed : Long_Float;
-         begin
-            after := gettime;
-            elapsed := (Long_Float (after.seconds - before.seconds) +
-                        Long_Float (after.microseconds - before.microseconds)
-                        / 1.0e6);
-            Move_Cursor (Line => Lines - 1, Column => Columns - 20);
-            floatio.Put (s, elapsed, Aft => 3, Exp => 0);
-            Add (Str => s);
-            Refresh;
-         end;
+         if timing then
+            declare
+               s : String (1 .. 7);
+               elapsed : Long_Float;
+            begin
+               after := gettime;
+               elapsed := (Long_Float (after.seconds - before.seconds) +
+                           Long_Float (after.microseconds
+                                     - before.microseconds)
+                           / 1.0e6);
+               Move_Cursor (Line => Lines - 1, Column => Columns - 20);
+               floatio.Put (s, elapsed, Aft => 3, Exp => 0);
+               Add (Str => s);
+               Refresh;
+            end;
          end if;
 
          c := pgetc (pad);