envprint.pas 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. Program EnvPrint;
  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., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20. * envprint.c - Envprint 2.0 GUI created with Triton
  21. *
  22. * As you can see below, it is possible to mix the tag format with
  23. * the C pre-processor macro format. (Actually I was just too lazy
  24. * to transform the whole project definition from tags to macros ;)
  25. *
  26. *)
  27. {
  28. A demo in FPC Pascal using triton.library
  29. Updated for fpc 1.0.7.
  30. Added const null and made use of the updated
  31. tritonmacros.
  32. 09 Jan 2003.
  33. [email protected]
  34. }
  35. uses triton, tritonmacros,utility;
  36. const
  37. null : longint = longint(nil);
  38. var
  39. Triton_App : pTR_App;
  40. PROCEDURE do_demo;
  41. VAR
  42. close_me : BOOLEAN;
  43. trmsg : pTR_Message;
  44. dummy : Longint;
  45. Project : pTR_Project;
  46. BEGIN
  47. ProjectStart;
  48. WindowID(1); WindowPosition(TRWP_CENTERDISPLAY);
  49. WindowTitle('EnvPrint 2.0 <THIS IS ONLY A NON-FUNCTIONAL GUI DEMO>');
  50. BeginMenu('Project');
  51. BeginSub('Load');
  52. SubItem('S_Load sender...',1);
  53. SubItem('D_Load addressee...',2);
  54. SubItem('C_Load comment...',3);
  55. BeginSub('Save');
  56. SubItem('O_Load sender',4);
  57. SubItem('E_Load addressee',5);
  58. SubItem('M_Load comment',6);
  59. BeginSub('Sace as');
  60. SubItem('U_Load sender as...',7);
  61. SubItem('T_Load addressee as...',8);
  62. SubItem('N_Load comment as...',9);
  63. MenuItem('F_Delete file...',10);
  64. ItemBarlabel;
  65. MenuItem('P_Print...',11);
  66. MenuItem('R_Preferences...',12);
  67. ItemBarlabel;
  68. MenuItem('?_About...',13);
  69. ItemBarlabel;
  70. MenuItem('Q_Quit',14);
  71. BeginMenu('Edit');
  72. MenuItem('W_Swap',15);
  73. MenuItem('X_Clear',16);
  74. HorizGroupA;
  75. Space;
  76. VertGroupA;
  77. HorizGroupEAC;
  78. VertGroupA;
  79. Space;
  80. NamedSeparatorI('Se_nder',101);
  81. SetTRTag(TROB_Space, null);
  82. HorizGroup;
  83. StringGadget(NIL,101);
  84. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  85. GetEntryButtonS('_1',1101);
  86. EndGroup;
  87. EndGroup;
  88. SpaceS;
  89. HorizGroup;
  90. StringGadget(NIL,102);
  91. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  92. GetEntryButtonS('_2',1102);
  93. EndGroup;
  94. EndGroup;
  95. SpaceS;
  96. HorizGroup;
  97. StringGadget(NIL,103);
  98. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  99. GetEntryButtonS('_3',1103);
  100. EndGroup;
  101. EndGroup;
  102. SetTRTag(TROB_Space, TRST_SMALL);
  103. HorizGroup;
  104. StringGadget(NIL,104);
  105. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  106. GetEntryButtonS('_4',1104);
  107. EndGroup;
  108. EndGroup;
  109. SetTRTag(TROB_Space, TRST_SMALL);
  110. HorizGroup;
  111. StringGadget(NIL,105);
  112. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  113. GetEntryButtonS('_5',1105);
  114. EndGroup;
  115. EndGroup;
  116. SetTRTag(TROB_Space, TRST_SMALL);
  117. HorizGroup;
  118. StringGadget(NIL,106);
  119. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  120. GetEntryButtonS('_6',1106);
  121. EndGroup;
  122. EndGroup;
  123. SetTRTag(TROB_Space, TRST_SMALL);
  124. HorizGroup;
  125. StringGadget(NIL,107);
  126. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  127. GetEntryButtonS('_7',1107);
  128. EndGroup;
  129. EndGroup;
  130. SetTRTag(TROB_Space, TRST_SMALL);
  131. HorizGroup;
  132. StringGadget(NIL,108);
  133. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  134. GetEntryButtonS('_8',1108);
  135. EndGroup;
  136. EndGroup;
  137. SetTRTag(TROB_Space, null);
  138. SetTRTag(TRGR_End, null);
  139. SetTRTag(TROB_Space, null);
  140. SetTRTag(TRGR_Vert, TRGR_PROPSHARE OR TRGR_ALIGN);
  141. SetTRTag(TROB_Space, null);
  142. NamedSeparatorI('Add_ressee',201);
  143. SetTRTag(TROB_Space, null);
  144. HorizGroup;
  145. StringGadget(NIL,201);
  146. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  147. GetEntryButtonS('_!',1201);
  148. EndGroup;
  149. EndGroup;
  150. SpaceS;
  151. HorizGroup;
  152. StringGadget(NIL,202);
  153. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  154. GetEntryButtonS('_''',1202);
  155. EndGroup;
  156. EndGroup;
  157. SpaceS;
  158. HorizGroup;
  159. StringGadget(NIL,203);
  160. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  161. GetEntryButtonS('_§',1203);
  162. EndGroup;
  163. EndGroup;
  164. SetTRTag(TROB_Space, TRST_SMALL);
  165. HorizGroup;
  166. StringGadget(NIL,204);
  167. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  168. GetEntryButtonS('_$',1204);
  169. EndGroup;
  170. EndGroup;
  171. SetTRTag(TROB_Space, TRST_SMALL);
  172. HorizGroup;
  173. StringGadget(NIL,205);
  174. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  175. GetEntryButtonS('_%%',1205);
  176. EndGroup;
  177. EndGroup;
  178. SetTRTag(TROB_Space, TRST_SMALL);
  179. HorizGroup;
  180. StringGadget(NIL,206);
  181. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  182. GetEntryButtonS('_&',1206);
  183. EndGroup;
  184. EndGroup;
  185. SetTRTag(TROB_Space, TRST_SMALL);
  186. HorizGroup;
  187. StringGadget(NIL,207);
  188. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  189. GetEntryButtonS('_/',1207);
  190. EndGroup;
  191. EndGroup;
  192. SetTRTag(TROB_Space, TRST_SMALL);
  193. HorizGroup;
  194. StringGadget(NIL,208);
  195. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  196. GetEntryButtonS('_(',1208);
  197. EndGroup;
  198. EndGroup;
  199. SetTRTag(TROB_Space, null);
  200. SetTRTag(TRGR_End, null);
  201. SetTRTag(TRGR_End, null);
  202. NamedSeparatorI('Co_mment',301);
  203. SetTRTag(TROB_Space, null);
  204. HorizGroup;
  205. StringGadget(NIL,301);
  206. SetTRTag(TRGR_Horiz,0 OR TRGR_FIXHORIZ);;
  207. GetEntryButtonS('_0',1301);
  208. EndGroup;
  209. EndGroup;
  210. SetTRTag(TROB_Space, null);
  211. SetTRTag(TRGR_End, null);
  212. SetTRTag(TROB_Space, null);
  213. SetTRTag(TROB_Line, TROF_VERT OR TROF_RAISED);
  214. SetTRTag(TROB_Space, TRST_BIG);
  215. SetTRTag(TRGR_Vert, TRGR_PROPSHARE OR TRGR_ALIGN OR TRGR_FIXHORIZ);
  216. SetTRTag(TROB_Space, null);
  217. SetTRTag(TRGR_Horiz, TRGR_EQUALSHARE OR TRGR_CENTER);
  218. SetTRTag(TROB_Line, TROF_HORIZ);
  219. SetTRTag(TROB_Space, null);
  220. SetTRTag(TROB_Text, null); SetTRTag(TRAT_Text, 'Load'); SetTRTag(TRAT_Flags, TRTX_TITLE);
  221. SetTRTag(TROB_Space, null);
  222. SetTRTag(TROB_Line, TROF_HORIZ);
  223. SetTRTag(TRGR_End, null);
  224. SetTRTag(TROB_Space, null);
  225. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, '_Sender...'); SetTRTag(TRAT_ID, 501);
  226. SetTRTag(TROB_Space, TRST_SMALL);
  227. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, '_Addressee...'); SetTRTag(TRAT_ID, 502);
  228. SetTRTag(TROB_Space, TRST_SMALL);
  229. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, '_Comment...'); SetTRTag(TRAT_ID, 503);
  230. SetTRTag(TROB_Space, null);
  231. SetTRTag(TRGR_Horiz, TRGR_EQUALSHARE OR TRGR_CENTER);
  232. SetTRTag(TROB_Line, TROF_HORIZ);
  233. SetTRTag(TROB_Space, null);
  234. SetTRTag(TROB_Text, null); SetTRTag(TRAT_Text, 'Save'); SetTRTag(TRAT_Flags, TRTX_TITLE);
  235. SetTRTag(TROB_Space, null);
  236. SetTRTag(TROB_Line, TROF_HORIZ);
  237. SetTRTag(TRGR_End, null);
  238. SetTRTag(TROB_Space, null);
  239. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, 'S_ender...'); SetTRTag(TRAT_ID, 504);
  240. SetTRTag(TROB_Space, TRST_SMALL);
  241. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, 'A_ddressee...'); SetTRTag(TRAT_ID, 505);
  242. SetTRTag(TROB_Space, TRST_SMALL);
  243. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, 'C_omment...'); SetTRTag(TRAT_ID, 506);
  244. SetTRTag(TROB_Space, TRST_BIG);
  245. SetTRTag(TROB_Line, TROF_HORIZ);
  246. SetTRTag(TROB_Space, TRST_BIG);
  247. SetTRTag(TRGR_Horiz, TRGR_EQUALSHARE);
  248. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, '_Print...'); SetTRTag(TRAT_ID, 507);
  249. SetTRTag(TROB_Space, TRST_SMALL);
  250. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, 'S_wap'); SetTRTag(TRAT_ID, 508);
  251. SetTRTag(TRGR_End, null);
  252. SetTRTag(TROB_Space, TRST_SMALL);
  253. SetTRTag(TRGR_Horiz, TRGR_EQUALSHARE);
  254. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, 'Pre_fs...'); SetTRTag(TRAT_ID, 509);
  255. SetTRTag(TROB_Space, TRST_SMALL);
  256. SetTRTag(TROB_Button, null); SetTRTag(TRAT_Text, 'C_lear'); SetTRTag(TRAT_ID, 510);
  257. SetTRTag(TRGR_End, null);
  258. SetTRTag(TROB_Space, null);
  259. SetTRTag(TRGR_End, null);
  260. SetTRTag(TROB_Space, null);
  261. SetTRTag(TRGR_End, null);
  262. EndProject;
  263. Project := TR_OpenProject(Triton_App,@tritontags);
  264. IF Project <> NIL THEN BEGIN
  265. close_me := FALSE;
  266. WHILE NOT close_me DO BEGIN
  267. dummy := TR_Wait(Triton_App,0);
  268. REPEAT
  269. trmsg := TR_GetMsg(Triton_App);
  270. IF trmsg <> NIL THEN BEGIN
  271. IF (trmsg^.trm_Project = Project) THEN BEGIN
  272. CASE trmsg^.trm_Class OF
  273. TRMS_CLOSEWINDOW : close_me := True;
  274. TRMS_ERROR: WriteLN(TR_GetErrorString(trmsg^.trm_Data));
  275. END;
  276. END;
  277. TR_ReplyMsg(trmsg);
  278. END;
  279. UNTIL close_me OR (trmsg = NIL);
  280. END;
  281. TR_CloseProject(Project);
  282. END ELSE WriteLN(TR_GetErrorString(TR_GetLastError(Triton_App)));
  283. END;
  284. begin
  285. Triton_App := TR_CreateAppTags([
  286. TRCA_Name,'Envprint',
  287. TRCA_LongName,'EnvPrint GUI demo',
  288. TRCA_Version,'2.0',
  289. TAG_END]);
  290. if Triton_App <> nil then begin
  291. do_demo;
  292. TR_DeleteApp(Triton_App);
  293. END
  294. ELSE writeln('Can''t create application');
  295. END.