home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / gfx / superview-lib-9.12.lha / SuperView-Lib / Programmers / PCQ-Pascal / miniview / miniview.p < prev   
Text File  |  1994-12-28  |  5KB  |  153 lines

  1. PROGRAM MiniView;
  2.  
  3. {  ======================================================================== }
  4. {  = Programmname    : MiniView V1.0                                      = }
  5. {  =                                                                      = }
  6. {  ======================================================================== }
  7. {  = Author/Copyright : (c) 1994 by Andreas Neumann                       = }
  8. {  =                   based on Andreas R.Kleinert's SimpleView 7.1       = }
  9. {  =                   Freeware. All rights reserved.                     = }
  10. {  =                                                                      = }
  11. {  =                   Use it as an example for programming               = }
  12. {  =                   superview.library !                                = }
  13. {  =                                                                      = }
  14. {  ======================================================================== }
  15. {  = Function         : SVObject operations :                             = }
  16. {  =                    - Show graphics          (all SVObjects)          = }
  17. {  ======================================================================== }
  18. {  = Last Update      : 24.11.1994                                        = }
  19. {  =                                                                      = }
  20. {  ======================================================================== }
  21. {  = Remarks          : Needs "superview.library" V6+                     = }
  22. {  =                                                                      = }
  23. {  =                    CLI only                                          = }
  24. {  =                                                                      = }
  25. {  ======================================================================== }
  26. {  = Compiler         : PCQ 1.2d                                          = }
  27. {  ======================================================================== }
  28.  
  29.  
  30. {$I "Include:exec/memory.i" }
  31.  
  32. {$I "include:intuition/intuitionbase.i" } {  accessing IntuitionBase->FirstScreen }
  33.  
  34. {$I "include:sv/superview/WurzelSuperView.i" }
  35. {$I "include:sv/superview/superviewbase.i" }
  36.  
  37. {$I "Include:Utils/Stringlib.i" }
  38. {$I "Include:Utils/Parameters.i" }
  39.  
  40.    {  Help- and Info- Texts }
  41.  
  42. CONST
  43.  entry1_text  : String = "\n \c31;32;40m                    MiniView V1.0\c30;32;40m \c33;32;40m (FREEWARE) \c30;32;40m \n(c) 1994 by Andreas Neumann based on a Andreas Ralph Kleinert program.";
  44.  entry2_text  : String = "\c30;31;40m \nAndreas Neumann, c/o Schnitzler,  Espenhausen 3, 35091 Cölbe, Germany.\nAndreas R. Kleinert,  Grube Hohe Grethe 23,  D-57074 Siegen,  Germany.\n";
  45.  entry3_text  : String = "            Uses superview.library to show a picture.\n";
  46.  entry4_text  : String = "              USAGE : \"\c30;33;40mMiniView\c30;31;40m [?] [PicFileName]\"\n";
  47.  entry5_text  : String = "                       '?'    -> This text.\n";
  48.  
  49.  
  50.  ver_text : String = "\0$VER: MiniView V1.0 (24.11.94)";
  51.  
  52.  
  53. {  *************************************************** }
  54. {  *                                                 * }
  55. {  * Error-Messages for Leave() and KF_Message()     * }
  56. {  *                                                 * }
  57. {  *************************************************** }
  58.  
  59.  svlib_text :  String = "You need \42superview.library\42 V6+ !";
  60.  svstr_text :  String = "Error allocating string !";
  61.  
  62.  
  63. VAR
  64.     filename    :   String;
  65.     myIBase     :   IntuitionBasePtr;
  66.     PPBase      :   Address;
  67.  
  68.  
  69. PROCEDURE SimpleView_Show (name : String);
  70.  
  71. {  *************************************************** }
  72. {  *                                                 * }
  73. {  * Show-Function                                   * }
  74. {  *                                                 * }
  75. {  *************************************************** }
  76.  
  77. VAR
  78.     handle  :   Address;
  79.     win     :   WindowPtr;
  80.     retval  :   INTEGER;
  81.  
  82. BEGIN
  83.  
  84.  handle:=SVL_AllocHandle(NIL);
  85.  IF handle<>NIL THEN
  86.  BEGIN
  87.   retval:=SVL_InitHandleAsDOS(handle, NIL);
  88.   IF retval=0 THEN
  89.   BEGIN
  90.    retval:=SVL_SetWindowIDCMP(handle, MOUSEBUTTONS_f, NIL);
  91.    IF retval=0 THEN
  92.    BEGIN
  93.     retval:=SVL_SetScreenType(handle, CUSTOMSCREEN_f, NIL);
  94.     IF retval=0 THEN
  95.     BEGIN
  96.      retval:=SVL_SuperView(handle, name);
  97.      IF retval=0 THEN
  98.      BEGIN
  99.       retval:=SVL_GetWindowAddress(handle, Adr(win), NIL);
  100.       IF retval=0 THEN
  101.       BEGIN
  102.        IF win<>NIL THEN
  103.        BEGIN
  104.         WaitPort(Address(win^.UserPort));
  105.        END;
  106.       END;
  107.      END;
  108.     END;
  109.    END;
  110.   END;
  111.   SVL_FreeHandle(handle);
  112.  END
  113.  ELSE
  114.   retval:=SVERR_NO_HANDLE;
  115.  
  116.  IF retval<>0 THEN WRITELN (SVL_GetErrorString(retval));
  117. END;
  118.  
  119.  
  120. BEGIN
  121.  filename:=AllocString (255);
  122.  IF filename=NIL THEN
  123.   Writeln (svstr_text)
  124.  ELSE
  125.  BEGIN
  126.   GetParam (1,filename);
  127.   IF StrICmp (filename,"?")=0 THEN
  128.    Writeln (entry1_text,entry2_text,entry3_text,entry4_text,entry5_text)
  129.   ELSE
  130.   BEGIN
  131.  
  132.    SuperViewBase:=Address(OpenLibrary("superview.library", 6));
  133.    IF (SuperViewBase=Nil) THEN
  134.     Writeln (svlib_text)
  135.    ELSE
  136.    BEGIN
  137.  
  138.     myIBase:=SuperViewBase^.svb_IntuitionBase;
  139.  
  140.     {  ^ if NULL, sv-lib wouldn't have opened ! }
  141.  
  142.  
  143.     {  Show }
  144.  
  145.     IF StrLen(filename)>0 Then
  146.      SimpleView_Show (filename);
  147.     CloseLibrary (Address(SuperViewBase));
  148.    END;
  149.   END;
  150.   FreeString (filename);
  151.  END;
  152. END.
  153.