home *** CD-ROM | disk | FTP | other *** search
/ ST-Computer Leser 1998 October / STC_CD_10_1998.iso / BASE / ACS / CPLUSLIB / ACSPLUS.H next >
Encoding:
C/C++ Source or Header  |  1998-09-26  |  14.3 KB  |  417 lines

  1. /*
  2.  *    Copyright    (c) 1992 Stefan Bachert
  3.  *
  4.  *    16 JULI 1994
  5.  *
  6.  *        Extensions to ACS
  7.  *
  8.  *        Userdef Objects:
  9.  *                        (Wi)Sliders        100 .. 199
  10.  *                        Editor                200 .. 299
  11.  *                        (Ftext                300 .. 399)
  12.  *                        (Cycle                400 .. 499)
  13.  *                        (Picture            500 .. 599)
  14.  *
  15.  *        Predefined Windows, (Menu Calls)
  16.  *                        DESKTOP                100 .. 199
  17.  *                        EDITOR                200 .. 299
  18.  *                        PROTOCOL            200 .. 299
  19.  *                        PLOTTER                300 .. 399
  20.  *            LIST_WINDOW        400 .. 499
  21.  *
  22.  *        Prefefined Dialogs
  23.  *                        Fontsel
  24.  *
  25.  */
  26.  
  27. #include        <stdarg.h>
  28.  
  29. /*
  30. --------------------------------------------------------------
  31.         Userdefined Objects
  32. --------------------------------------------------------------
  33. */
  34.  
  35. /*
  36.         SLIDER
  37.  
  38.         ub_code    = A_slider
  39.         ub_parm = Bit 0         0 = horizontal, 1 = vertical
  40.         ub_serv = Auo_slider
  41.         ub_ptr1 = 'object'
  42.         ub_ptr2 = unused
  43.         ub_ptr3 = unused
  44.  
  45.         click        = Aus_slider
  46.  
  47.         supports also:
  48.                 AUO_CREATE                AUO_TERM
  49.                 AUO_GETVAL                AUO_SETVAL
  50.                 AUO_UPDATE                AUO_WINDOW
  51.                 AUO_FULLUPDATE
  52. */
  53.  
  54. typedef struct {
  55.     char* (*call) (void* obj, long pos);
  56.     void* obj;
  57. } SLLIVE;
  58.  
  59. #define AUO_SLFULL                (100)        /*    set full */
  60. #define AUO_SLSIZE                (101)        /*    set size */
  61. #define AUO_SLSTEP                (102)        /*    set step */
  62. #define AUO_SLCALL                (103)        /*    set display routine and its object */
  63. #define AUO_SLLEN                    (104)        /*    set display char length        */
  64. #define AUO_SLLIVE                (105)        /*    call live update routine */
  65. #define AUO_SLWIPOS                (106)
  66. #define AUO_SLGETPOS            (107)        /*    get actual pos */
  67.  
  68. INT16 CDECL A_slider (PARMBLK* pb);        /* Draw routine */
  69. INT16 Auo_slider (OBJECT *entry, INT16 task, void* in_out);        /* Standard service routine */
  70. void Aus_slider (void);                                /* standard click routine */
  71.  
  72. /*
  73.  *    Userdef controls Windowslider like slider (as far as possible)
  74.  */
  75.  
  76. #define AUO_SLWIPOS                (106)        /*    accept pos as received from WM_HSLID / WM_VSLID, INT16 * */
  77.  
  78. INT16 CDECL A_wislider (PARMBLK* pb);        /* 'Draw' routine */
  79. INT16 Auo_wislider (OBJECT *entry, INT16 task, void* in_out);        /* Standard service routine */
  80.  
  81. /*
  82.         EDITOR
  83.  
  84.         ub_code    = A_editor
  85.         ub_parm =
  86.         ub_serv = Auo_editor
  87.         ub_ptr1 = 'object'
  88.         ub_ptr2 = unused
  89.         ub_ptr3 = unused
  90.  
  91.         click        = Aus_editor
  92.  
  93.         supports also:
  94.                 AUO_CREATE                AUO_TERM
  95.                 AUO_GETVAL                AUO_SETVAL
  96.                 AUO_UPDATE
  97. */
  98.  
  99. typedef struct {
  100.     long row1;                /* range of substitution */
  101.     long col1;
  102.     long row2;
  103.     long col2;
  104.     long nrow;                /* number of new lines */
  105.     char **text;                /* all lines */
  106. } EDITSUBS;
  107.  
  108. typedef struct {
  109.     long row;                    /* which line */
  110.     long size;                /* char size of line */
  111.     char *text;                /* pointer to line */
  112. } EDITGETS;
  113.  
  114. typedef struct {
  115.     void (*call) (void* obj, char* text);
  116.     void* obj;
  117. } EDITLIVE;
  118.  
  119. #define AUO_EDVERSLIDER        (200)                /* register vertical slider, Awiob * */
  120. #define AUO_EDHORSLIDER        (201)                /* register horizontal slider, Awiob * */
  121. #define AUO_EDGETROW            (202)                /* get pointer on line, EDITGETS * */
  122. #define AUO_EDNEWLINE            (203)                /* append newline */
  123. #define AUO_EDAPPLINE            (204)                /* append text, char * */
  124. #define AUO_EDWRAP                (205)                /* set wrap lines, long * */
  125. #define AUO_EDDELETE            (206)                /* delete all text */
  126. #define AUO_EDFONT                (207)                /* font ID, INT16 * */
  127. #define AUO_EDHEIGHT            (208)                /* font height, INT16 * */
  128. #define AUO_EDCOLOR                (209)                /* font color, INT16 * */
  129. #define AUO_EDCFULL                (210)                /* columns (max 512), INT16 * */
  130. #define AUO_EDCURON                (211)                /* cursor on */
  131. #define AUO_EDCUROFF            (212)                /* cursor off */
  132. #define AUO_EDCURHIDE            (213)                /* hide cursor */
  133. #define AUO_EDCURSHOW            (214)                /* show cursor */
  134. #define AUO_EDCURPOS            (215)                /* set cursor pos, INT16 * */
  135. #define AUO_EDGETPOS            (216)                /* get line, long * */
  136. #define AUO_EDHCOL                (217)                /* set home col, long * */
  137. #define AUO_EDHROW                (218)                /* set home row, long * */
  138. #define AUO_EDVIEW                (219)                /* set cursor pos in visible range */
  139. #define AUO_ED1SELECT            (220)                /* select exactly one */
  140. #define AUO_ED01SELECT        (221)                /* select one or nothing */
  141. #define AUO_EDNSELECT            (222)                /* select countinous */
  142. #define AUO_EDNMSELECT        (223)                /* select discontinuos */
  143. #define AUO_EDCHARSELECT    (224)                /* select charmode */
  144. #define AUO_EDBLKSELECT        (225)                /* select blockchar mode */
  145. #define AUO_EDUNSELECT        (226)                /* unselect */
  146. #define AUO_EDGETSELECT        (227)                /* get selection block (row1,col1), (row2,col2), long [4] */
  147.                                                                             /* multi gets for discontinous, starting from prev */
  148. #define AUO_EDSETSELECT        (228)                /* set selection block (row1,col1), (row2,col2), long [4] */
  149. #define AUO_EDCALL                (229)                /* set live selection call */
  150. #define AUO_EDLIVE                (230)                /* call live routine */
  151. #define AUO_EDGETCURPOS        (231)                /* get cursor pos, long * */
  152. #define AUO_EDGETLENGTH        (232)                /* get length of act line, long * */
  153. #define AUO_EDGETROWS            (233)                /* get count of rows, long * */
  154. #define AUO_EDSUB                    (234)                /* substitute val, EDITSUBS * */
  155. #define AUO_EDUNDO                (235)                /* UNDO */
  156. #define AUO_EDTABSIZE            (236)                /* Tabsize (def = 4), INT16 * */
  157. #define AUO_EDCLEARUNDO        (237)                /* Clear UNDO Buffer*/
  158. #define AUO_EDRESIZE            (238)                /* Size has been modified, update internal vals */
  159. #define AUO_EDUPDATE            (239)                /* update without sliders */
  160. #define AUO_EDGETTABSIZE    (240)                /* get Tabsize, INT16 * */
  161. #define AUO_EDBLOCKMODE        (241)                /* ? Blockmode, INT16 *, TRUE / FALSE */
  162. #define AUO_EDFIND                (242)                /* Find string, char * */
  163. #define AUO_EDBACKWARD        (243)                /* Find direction backwards */
  164. #define AUO_EDFORWARD            (244)                /* Find direction forward */
  165. #define AUO_EDCASE                (245)                /* Case sensitive */
  166. #define AUO_EDNOCASE            (246)                /* Not Case sensitive */
  167. #define AUO_EDWORD                (247)                /* Word search */
  168. #define AUO_EDNOWORD            (248)                /* No word search */
  169. #define AUO_EDRESET                (249)                /* Set to unchanged */
  170. #define AUO_EDGETCHANGED    (250)                /* changed status, INT16 * */
  171. #define AUO_EDGETNEED            (251)                /* returns byte count needed for save, long * */
  172. #define AUO_EDSELECTWORD    (252)                /* select word at cursor pos */
  173. #define AUO_EDSLIDERS            (253)                /* updates sliders */
  174. #define AUO_EDCURSOR            (254)                /* set cursorform, INT16 * */
  175. #define AUO_EDGETVCURPOS    (255)                /* get !visible! cursor pos, long * */
  176. #define AUO_EDGETHCOL            (256)                /* get col number of visibile leftmost col */
  177. #define AUO_EDGETHROW            (257)                /* get row number of first visible row */
  178. #define AUO_EDGETERROR        (258)                /* get error flag (actually memory alloc errors only) */
  179. #define AUO_EDRESETERROR    (259)                /* reset error flag */
  180. #define AUO_EDPUTINFO            (260)                /* put info, not supported anymore */
  181. #define AUO_EDDIRTY                (261)                /* set's ditry-flag */
  182. #define AUO_EDSETSEPARATOR    (262)            /* set's word-seps */
  183. #define AUO_EDGETSEPARATOR    (263)            /* vice-versa */
  184.  
  185. INT16 CDECL A_editor (PARMBLK *pb);                /* Draw routine */
  186. INT16 Auo_editor (OBJECT *entry, INT16 task, void* in_out);        /* Standard service routine */
  187. void Aus_editor (void);                                        /* standard click routine */
  188.  
  189. /*
  190.  *        ACS Plus Windows
  191.  */
  192.  
  193.                                                         /* desktop */
  194. #define AS_PLACEICON        (100)                /* place icon, in_out = the window */
  195. #define AS_REMICON            (101)                /* remove icon, INT16 * */
  196. #define AS_GHOSTICON        (102)                /* change to ghost icon, INT16 * */
  197. #define AS_NORMICON            (103)                /* chance from ghost icon to normal icon, INT16 * */
  198. #define AS_NEWCALL            (104)                /* set new call */
  199. #define AS_BACKOBJECT        (105)                /* Set Background Objekt, (ob_type, ob_spec) ACSinit0 ! */
  200. #define AS_ICONNEW            (106)                /* Set New-Icon, ACSinit0 ! (wi == NULL) */
  201. #define AS_ICONTRASH        (107)                /* Set Trash-Icon, ACSinit0 ! (wi == NULL) */
  202. #define AS_ICONWINDOW        (108)                /* Set Default-Icon, ACSinit0 ! (wi == NULL) */
  203. #define AS_UPDATEICON        (109)                /* updates icon, INT16 * */
  204.  
  205. void Awd_quit (void); 
  206. void Awd_open (void); 
  207. void Awd_close (void);
  208. void Awd_delete (void);
  209. void Awd_info (void);
  210. void Awd_hor (void); 
  211. void Awd_list (void); 
  212. void Awd_ver (void); 
  213. void Awd_behaviour (void); 
  214. void Awd_save (void);
  215. void Awd_module (void); 
  216.  
  217. extern Awindow DESKTOP;
  218.  
  219. void Apd_close (void);
  220. void Apd_delete (void);
  221. void Apd_info (void);
  222. void Apd_list (void);
  223. void Apd_module (void); 
  224. void Apd_new (void);
  225. void Apd_open (void); 
  226. void Apd_quit (void); 
  227. extern Awindow PUR_DESK;
  228.  
  229. /*
  230.     "printf"-Interface for 'EDITOR'
  231. */
  232.  
  233. INT16 uputs (char* text, OBJECT *entry);
  234. INT16 uvprintf (OBJECT* entry, const char* format, va_list arglist);
  235. INT16 uprintf (OBJECT* entry, const char* format, ... );
  236.  
  237.     /*
  238.      *    Routines from EDITOR-Menu
  239.      */
  240.  
  241. void Aed_wrap (void);
  242. void Aed_toclip (void);
  243. void Aed_fromclip (void);
  244. void Aed_copy (void);
  245. void Aed_cut (void);
  246. void Aed_cutline (void);
  247. void Aed_find (void);
  248. void Aed_findnext (void);
  249. void Aed_fkey (void);
  250. void Aed_gotoline (void);
  251. void Aed_info (void);
  252. void Aed_open (void);
  253. void Aed_merge (void);
  254. void Aed_paste (void);
  255. void Aed_quit (void);
  256. void Aed_replace (void);
  257. void Aed_replacenext (void);
  258. void Aed_save (void);
  259. void Aed_saveas (void);
  260. void Aed_saveoptions (void);
  261. void Aed_selall (void);
  262. void Aed_swap (void);
  263. void Aed_font (void);
  264. void Aed_option (void);
  265. void Aed_undo (void);
  266.  
  267. /*
  268.  *        EDITOR
  269.  */
  270.  
  271. #define AS_EDGETENTRY        (200)                        /* return Editors OBJECT-Entry, OBJECT **    */
  272. #define AS_EDEXT                (201)                        /* Set Extension, char * */
  273. #define AS_EDLOADFILE        (202)                        /* Load file, Path char * */
  274. #define AS_EDTITLE            (203)                        /* Set normal Title format %s will by substituted by filename, char * */
  275. #define AS_EDTITLEDIRTY    (204)                        /* Set dirty Title format %s will by substituted by filename, char * */
  276. #define AS_EDPUTSTRING    (205)                        /* Put NUL terminate string LineSep LF / CRLF, char * */
  277. #define AS_EDGETSTRING    (206)                        /* Get NUL terminate string LineSep LF / CRLF, char * */
  278. #define AS_EDGETNEED        (207)                        /* get memory size of string */
  279. #define AS_EDWINDOW            (208)                        /* set controlling window */
  280. #define AS_EDTERM                (209)                        /* send to controlling window, editor will terminate, Awindow* editor */
  281. #define AS_EDSAVE                (210)                        /* send to controlling window, editor/user wants to save, Awindow* editor */
  282. #define AS_EDCLEAN            (211)                        /* define contents clean/unmodified */
  283. #define AS_EDHOME                (212)                        /* set cursor at home position */
  284. #define AS_EDICONTEXT        (213)                        /* set icontext */
  285. #define AS_EDSAVEIT            (214)                        /* text should be saved */
  286. #define AS_EDGETFNAME        (215)                        /* places filename into inout */
  287.  
  288. extern Awindow EDITOR;
  289.  
  290. /*
  291.         Protocol Window
  292. */
  293.  
  294. typedef struct {
  295.     INT16 fontid;
  296.     INT16 height;
  297.     INT16 col;
  298.     INT16 row;
  299.     INT16 tabsize;
  300.     INT16 wrap;
  301.     INT16 x;
  302.     INT16 y;
  303. } PROTOCOLDATA;
  304.  
  305. /*
  306.     "printf"-Interface
  307. */
  308. INT16 wputs (char *text, Awindow *wi);
  309. INT16 wvprintf (Awindow *wi, const char *format, va_list arglist);
  310. INT16 wprintf (Awindow *wi, const char *format, ... );
  311. extern Awindow PROTOCOL;            /* parameter NULL, or PROTOCOLDATA */
  312.  
  313. /*
  314.         Plotter Window
  315. */
  316.  
  317. /*
  318.     VDI-like Interface
  319. */
  320.  
  321. void w_pline (Awindow *wi, INT16 count, INT16 *pxy);
  322. void w_pmarker (Awindow *wi, INT16 count, INT16 *pxy);
  323. void w_gtext (Awindow *wi, INT16 x, INT16 y, char* string);
  324. void w_fillarea (Awindow *wi, INT16 count, INT16 *pxy);
  325. void w_contourfill (Awindow *wi, INT16 x, INT16 y, INT16 index);
  326. void wr_recfl (Awindow *wi, INT16 *pxy);
  327. void w_bar (Awindow *wi, INT16 *pxy);
  328. void w_arc (Awindow *wi, INT16 x, INT16 y, INT16 rad, INT16 begang, INT16 endang);
  329. void w_pieslice (Awindow *wi, INT16 x, INT16 y, INT16 rad, INT16 begang, INT16 endang);
  330. void w_circle (Awindow *wi, INT16 x, INT16 y, INT16 rad);
  331. void w_ellipse (Awindow *wi, INT16 x, INT16 y, INT16 xrad, INT16 yrad);
  332. void w_ellarc (Awindow *wi, INT16 x, INT16 y, INT16 xrad, INT16 yrad, INT16 begang, INT16 endang);
  333. void w_ellpie (Awindow *wi, INT16 x, INT16 y, INT16 xrad, INT16 yrad, INT16 begang, INT16 endang);
  334. void w_rbox (Awindow *wi, INT16 *pxy);
  335. void w_rfbox (Awindow *wi, INT16 *pxy);
  336. void w_justified (Awindow *wi, INT16 x, INT16 y, char* string, INT16 length, INT16 word_space, INT16 char_space);
  337.  
  338. void w_draw (Awindow *wi, INT16 x1, INT16 y1, INT16 x2, INT16 y2);
  339. void w_update (Awindow *wi);            /* update */
  340. void w_clr (Awindow *wi);                /* clear */
  341. void w_inv (Awindow *wi);                /* invert */
  342.  
  343. #define    AS_PLOTHANDLE            (300)                    /* Plot windows VDI-handle, INT16 *    */
  344. #define    AS_PLOTMFDB                (301)                    /* Plot windows MFDB, MFDB**    */
  345. #define    AS_PLOTSIZE                (302)                    /* resize MFDB, INT16 [2] (w, h) */
  346. #define    AS_PLOTENTRY            (303)                    /* return Plotters OBJECT-Entry, OBJECT **    */
  347.  
  348. typedef struct {
  349.     INT16 x;
  350.     INT16 y;
  351.     INT16 w;
  352.     INT16 h;
  353. } PLOTTERDATA;
  354.  
  355. extern Awindow PLOTTER;
  356.  
  357. /*
  358.     List-Window
  359. */
  360.  
  361. typedef struct
  362. {    long    idx;
  363.     void    *item;
  364. }    LISTITEM;
  365.  
  366. /* LIST_WINDOW-Nachrichten               *in_out */
  367. #define AS_LIST_UPDATE                (400)        /* NULL */
  368. #define    AS_LIST_COUNT                    (401)        /* *long */
  369. #define    AS_LIST_ADD                        (402)        /* *void */
  370. #define    AS_LIST_DELETE                (403)        /* *long */
  371. #define AS_LIST_GET                        (404)        /* *LISTITEM */
  372. #define AS_LIST_GET_DIRTY            (405)        /* *INT16 */
  373. #define    AS_LIST_REPLACE                (406)        /* *LISTITEM */
  374. #define    AS_LIST_RESET_DIRTY        (407)        /* NULL */
  375.  
  376. /* Message-Codes */
  377. #define    LM_OUT_OF_MEM    (1)
  378. #define    LM_IDX_RANGE    (2)
  379. #define    LM_DBL_ITEM        (3)
  380. #define LM_INFO                (4)
  381.  
  382. /* Struktur zum Aufruf */
  383. typedef struct
  384. {    void            *expara;                /* freier Parameter */
  385.     char            title[128];            /* Fenstertitel */
  386.     Axywh            winsize;                /* Fensterausma₧e */
  387.     CICONBLK    *icon;                    /* Icon-Vorlage */
  388.     long            len;                        /* Länge eines Eintrags */
  389.     INT16 (*acc_item) (AOBJECT *aob, void *expara);
  390.     INT16 (*comp_item) (void *org, void *new, void *expara);
  391.     INT16 (*drag_item) (AOBJECT *aob, void *item, void *expara);
  392.     INT16 (*edit_item) (void *item, void *expara);
  393.     long    (*key_item) (INT16 key, void *expara);
  394.     INT16 (*message) (INT16 mess, void *expara);
  395.     INT16 (*print_item) (char *line, void *item, void *expara);
  396.     INT16 (*term_list) (void *expara);
  397. }    LISTDATA;
  398.  
  399. extern Awindow LIST_WINDOW;
  400.  
  401. /*
  402. --------------------------------------------------------------
  403.     Predefined Dialogs
  404. --------------------------------------------------------------
  405. */
  406.  
  407. INT16 A_fontsel (INT16* fontid, INT16* height, INT16 prop);
  408.  
  409. /*
  410. --------------------------------------------------------------
  411.         useful goodies
  412. --------------------------------------------------------------
  413. */
  414.  
  415. void read_multiline (char* dest, INT16 len, char** from, INT16 lines);
  416. void write_multiline (char* dest, INT16 len, char** from, INT16 lines);
  417.