DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦98f7387fe⟧ TextFile

    Length: 7287 (0x1c77)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Bounded_String;

package body Requester is
    procedure Clear is
        use Object;
        Blanck : String (1 .. 80) := (1 .. 80 => ' ');
    begin
        for I in 1 .. 10 loop
            Easy_Y.Set_Display (Window => Requester_Window);
            Easy_Y.Print (0, Object.Index (I * 10),
                          Bounded_String.Value (Blanck, 80));
        end loop;
    end Clear;


    procedure Rectangle (X, Y : Object.Index; Title : Object.Tiny_String) is
        use Object;  
        Long : Object.Index :=
           30 + 8 * Object.Index (Bounded_String.Length (Title));
    begin
        Easy_Y.Set_Display (Window => Requester_Window);
        Easy_Y.Put_Font (To => Easy_Y.Small_Font);
        Easy_Y.Put_Size (Window => Requester_Window, Size => 1);

        Easy_Y.Line (X, Y, X + Long, Y);
        Easy_Y.Line (X + Long, Y, X + Long, Y + 40);
        Easy_Y.Line (X + Long, Y + 40, X, Y + 40);
        Easy_Y.Line (X, Y + 40, X, Y);

        Easy_Y.Line (X + 5, Y + 5, X + Long - 5, Y + 5);
        Easy_Y.Line (X + Long - 5, Y + 5, X + Long - 5, Y + 35);
        Easy_Y.Line (X + Long - 5, Y + 35, X + 5, Y + 35);
        Easy_Y.Line (X + 5, Y + 35, X + 5, Y + 5);

        Easy_Y.Print (X1 => X + 15, Y1 => Y + 25, The_String => Title);
    end Rectangle;


    procedure Push (X, Y : Object.Index; Title : Object.Tiny_String) is
        use Object;
        Long : Object.Index :=
           30 + 8 * Object.Index (Bounded_String.Length (Title));
    begin
        Easy_Y.Set_Display (Window => Requester_Window);
        Easy_Y.Put_Font (To => Easy_Y.Small_Font);
        Easy_Y.Put_Size (Window => Requester_Window, Size => 1);

        Easy_Y.Line (X, Y + 1, X + Long, Y + 1);
        Easy_Y.Line (X + Long - 1, Y, X + Long - 1, Y + 40);
        Easy_Y.Line (X + Long, Y + 39, X, Y + 39);
        Easy_Y.Line (X + 1, Y + 40, X + 1, Y);

        Easy_Y.Line (X + 5, Y + 5, X, Y);
        Easy_Y.Line (X + Long - 5, Y + 5, X + Long, Y);
        Easy_Y.Line (X + Long - 5, Y + 35, X + Long, Y + 40);
        Easy_Y.Line (X + 5, Y + 35, X, Y + 40);

        Easy_Y.Print (X1 => X + 16, Y1 => Y + 26, The_String => Title);
        delay (1.0);
    end Push;


    function In_Area (X, Y : Object.Index; Title : Object.Tiny_String)
                     return Boolean is
        use Object;
        Long : Object.Index :=
           30 + 8 * Object.Index (Bounded_String.Length (Title));
    begin
        if X <= Easy_Y.Get_X_Mouse and then
           Easy_Y.Get_X_Mouse <= X + Long and then
           Y <= Easy_Y.Get_Y_Mouse and then
           Easy_Y.Get_Y_Mouse <= Y + 40 then
            return True;
        else
            return False;
        end if;
    end In_Area;


    function Choice (The_Message : Message.Unary) return Object.Index is  
        use Object;
        Mess : Message.Unary := The_Message;
        Position : Object.Index;
    begin  
        Easy_Y.Set_Display (Window => Requester_Window);

        Message.Init (Mess);
        Position := Dx / 2;
        Clear;
        for I in 1 .. Number_Button loop
            Rectangle (X => 10 + Position,
                       Y => 35,
                       Title => Message.Get (Name_From => Mess));
            Position := Position + Dx + 50 +
                           8 * Object.Index
                                  (Bounded_String.Length
                                      (Message.Get (Name_From => Mess)));
            Message.Next (Mess);
        end loop;

        loop
            case Easy_Y.Next_Event is
                when Easy_Y.Update =>  
                    Message.Init (Mess);
                    Position := Dx / 2;
                    Clear;
                    for I in 1 .. Number_Button loop
                        Rectangle (X => 10 + Position,
                                   Y => 35,
                                   Title => Message.Get (Name_From => Mess));
                        Position := Position + Dx + 50 +
                                       8 * Object.Index
                                              (Bounded_String.Length
                                                  (Message.Get
                                                      (Name_From => Mess)));
                        Message.Next (Mess);
                    end loop;

                when Easy_Y.Button_Down =>
                    Message.Init (Mess);
                    Position := Dx / 2;
                    for I in 1 .. Number_Button loop
                        if In_Area
                              (X => 10 + Position,
                               Y => 35,
                               Title => Message.Get (Name_From => Mess)) then
                            Push (X => 10 + Position,
                                  Y => 35,
                                  Title => Message.Get (Name_From => Mess));
                            return I;
                        end if;
                        Position := Position + Dx + 50 +
                                       8 * Object.Index
                                              (Bounded_String.Length
                                                  (Message.Get
                                                      (Name_From => Mess)));
                        Message.Next (Mess);
                    end loop;
                when Easy_Y.Button_Up =>
                    null;
                when others =>
                    null;
            end case;
        end loop;
    end Choice;


    procedure Open (X, Y : Object.Index;
                    Screen : String;
                    The_Message : Message.Unary;
                    Str : Object.Tiny_String) is
        use Object;
        Long : Object.Index := 0;
        Mess : Message.Unary := The_Message;
    begin
        Easy_Y.Put_Title (Window => Requester_Window, Title => Str);
        Easy_Y.Put_Left (Window => Requester_Window, Left => X);
        Easy_Y.Put_Right (Window => Requester_Window, Right => Y);

        Message.Init (Mess);
        Number_Button := 0;
        while not Message.Is_Done (Mess) loop
            Long := Long + 50 +
                       8 * Object.Index (Bounded_String.Length
                                            (Message.Get (Name_From => Mess)));
            Number_Button := Number_Button + 1;
            Message.Next (Mess);
        end loop;
        if Number_Button /= 0 and then
           Long < 100 + 10 * Object.Index (Bounded_String.Length (Str)) then
            declare
                use Object;
                Long_Old : Object.Index := Long;
            begin
                Long := 100 + 10 * Object.Index (Bounded_String.Length (Str));
                Dx := (Long - Long_Old) / Number_Button;
            end;
        else
            Dx := 0;
        end if;

        Easy_Y.Put_Width (Window => Requester_Window, Width => Long);
        Easy_Y.Put_Height (Window => Requester_Window, Height => 100);
        Easy_Y.Open (Display => Screen, Window => Requester_Window);
        Easy_Y.Put_Font (To => Easy_Y.Small_Font);
        Easy_Y.Put_Size (Window => Requester_Window, Size => 1);

        Easy_Y.Update;
    end Open;


    procedure Close is
    begin
        Easy_Y.Close (Window => Requester_Window);
    end Close;

end Requester;