toolmanager1.pas 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. Program ToolManager1;
  2. (*
  3. * OpenTriton -- A free release of the triton.library source code
  4. * Copyright (C) 1993-1998 Stefan Zeiger
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  19. * MA 02110-1301, USA.
  20. *
  21. * Toolmanager1.c - Looks like the original ToolManager
  22. *
  23. *)
  24. {
  25. A demo in FPC Pascal using triton.library
  26. Updated for fpc 1.0.7
  27. 11 Jan 2003.
  28. [email protected]
  29. }
  30. uses exec, triton, tritonmacros, amigalib, utility, linklist;
  31. const
  32. cycle_entries : array [0..7] of PChar = ('Exec','Image','Sound','Menu','Icon','Dock','Access',NIL);
  33. liststrings : array [0..8] of PChar = (
  34. '2024view' ,
  35. 'Add to archive',
  36. 'Delete',
  37. 'Edit text',
  38. 'Env',
  39. 'Exchange',
  40. 'Global Help System',
  41. 'Multiview',
  42. 'Paint');
  43. var
  44. i : Longint;
  45. LVList : pList;
  46. MyNode : pFPCNode;
  47. Triton_App : pTR_App;
  48. procedure CleanUp(why : string; err : longint);
  49. begin
  50. if assigned(Triton_App) then TR_DeleteApp(Triton_App);
  51. if assigned(LVList) then DestroyList(LVList);
  52. if why <> '' then writeln(why);
  53. halt(err);
  54. end;
  55. begin
  56. if not Assigned(TritonBase) then
  57. begin
  58. writeln('cannot open ' + TRITONNAME);
  59. Halt(5);
  60. end;
  61. CreateList(LVList);
  62. FOR i := 0 TO 8 DO BEGIN
  63. MyNode := AddNewNode(LVList,liststrings[i]);
  64. END;
  65. Triton_App := TR_CreateAppTags([
  66. TRCA_Name, AsTag('ToolManagerGUIDemo1'),
  67. TRCA_LongName, AsTag('ToolManager GUI demo 1'),
  68. TRCA_Info, AsTag('Looks like the original ToolManager'),
  69. TAG_END]);
  70. if Triton_App = nil then CleanUp('Can''t create application',20);
  71. ProjectStart;
  72. WindowID(0); WindowPosition(TRWP_BELOWTITLEBAR);
  73. WindowTitle('ToolManager GUI demo 1'); WindowFlags(TRWF_NOSIZEGADGET OR TRWF_NODELZIP OR TRWF_NOZIPGADGET OR TRWF_NOESCCLOSE);
  74. WindowBackfillNone;
  75. VertGroupA;
  76. Space;
  77. HorizGroupAC;
  78. Space;
  79. TextID('_Object Type',1);
  80. Space;
  81. CycleGadget(@cycle_entries,0,1);
  82. Space;
  83. EndGroup;
  84. Space;
  85. HorizGroupAC;
  86. Space;
  87. VertGroupAC;
  88. CenteredTextID('Object List',2);
  89. Space;
  90. ListSSCN(LVList,2,0,0);
  91. EndGroup;
  92. Space;
  93. VertGroupA;
  94. TextN('');
  95. Space;
  96. Button('Top',3);
  97. Space;
  98. Button('Up',4);
  99. Space;
  100. Button('Down',5);
  101. Space;
  102. Button('Bottom',6);
  103. Space;
  104. Button('So_rt',7);
  105. EndGroup;
  106. Space;
  107. EndGroup;
  108. Space;
  109. HorizGroupEA;
  110. Space;
  111. Button('_New...',8);
  112. Space;
  113. Button('_Edit...',9);
  114. Space;
  115. Button('Co_py',10);
  116. Space;
  117. Button('Remove',11);
  118. Space;
  119. EndGroup;
  120. Space;
  121. HorizGroupEA;
  122. Space;
  123. Button('_Save',12);
  124. Space;
  125. Button('_Use',13);
  126. Space;
  127. Button('_Test',14);
  128. Space;
  129. Button('_Cancel',15);
  130. Space;
  131. EndGroup;
  132. Space;
  133. EndGroup;
  134. EndProject;
  135. i := TR_AutoRequest(Triton_App,NIL,@tritontags);
  136. CleanUp('',0);
  137. end.