grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / classes / zune / nlist / nlist_mcc / NList-Test.c
bloba3a331a5192fc9b340b03250512dd03500d182cc
1 /***************************************************************************
3 NList.mcc - New List MUI Custom Class
4 Registered MUI class, Serial Number: 1d51 0x9d510030 to 0x9d5100A0
5 0x9d5100C0 to 0x9d5100FF
7 Copyright (C) 1996-2001 by Gilles Masson
8 Copyright (C) 2001-2014 NList Open Source Team
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 NList classes Support Site: http://www.sf.net/projects/nlist-classes
22 $Id$
24 ***************************************************************************/
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdio.h>
29 #include <dos/dos.h>
30 #include <exec/types.h>
31 #include <exec/memory.h>
32 #include <exec/ports.h>
33 #include <exec/io.h>
34 #include <libraries/dos.h>
35 #include <libraries/dosextens.h>
36 #include <libraries/gadtools.h>
37 #include <libraries/asl.h>
38 #include <libraries/mui.h>
39 #include <workbench/workbench.h>
40 #include <intuition/intuition.h>
41 #include <intuition/classusr.h>
43 #include <proto/exec.h>
44 #include <proto/dos.h>
45 #include <proto/gadtools.h>
46 #include <proto/asl.h>
47 #include <proto/muimaster.h>
48 #include <proto/graphics.h>
49 #include <proto/intuition.h>
50 #include <proto/timer.h>
51 #include <proto/utility.h>
53 #if !defined(__amigaos4__)
54 #include <clib/alib_protos.h>
55 #endif
57 struct Library *MUIMasterBase = NULL;
58 #if defined(__AROS__)
59 struct UtilityBase *UtilityBase = NULL;
60 #else
61 struct Library *UtilityBase = NULL;
62 #endif
63 struct Library *LayersBase = NULL;
64 struct Device *ConsoleDevice = NULL;
65 struct Library *DiskfontBase = NULL;
67 #if defined(__amigaos4__)
68 struct Library *IntuitionBase = NULL;
69 struct Library *GfxBase = NULL;
70 #else
71 struct IntuitionBase *IntuitionBase = NULL;
72 struct GfxBase *GfxBase = NULL;
73 #endif
75 #if defined(__amigaos4__)
76 struct DiskfontIFace *IDiskfont = NULL;
77 struct LayersIFace *ILayers = NULL;
78 struct ConsoleIFace *IConsole = NULL;
79 struct GraphicsIFace *IGraphics = NULL;
80 struct IntuitionIFace *IIntuition = NULL;
81 struct MUIMasterIFace *IMUIMaster = NULL;
82 struct UtilityIFace *IUtility = NULL;
83 #endif
85 static struct IOStdReq ioreq;
87 #if defined(DEBUG)
88 #include "timeval.h"
89 static struct TimeRequest timereq;
90 #if defined(__MORPHOS__)
91 struct Library *TimerBase = NULL;
92 #else
93 struct Device *TimerBase = NULL;
94 #endif
95 #if defined(__amigaos4__)
96 struct TimerIFace *ITimer = NULL;
97 #endif
98 #endif // DEBUG
100 #include "private.h"
102 #include <mui/NListview_mcc.h>
103 #include <mui/NFloattext_mcc.h>
105 #include "NList_grp.h"
107 #include "Debug.h"
109 #include "SDI_compiler.h"
111 DISPATCHERPROTO(_Dispatcher);
113 /* *********************************************** */
116 static APTR APP_Main = NULL,
117 WIN_Main = NULL,
118 WIN_2 = NULL,
119 BM_img,
120 BM_img2,
121 BT_TitleOn,
122 BT_TitleOff,
123 BT_NoMulti,
124 BT_Multidef,
125 BT_Multi,
126 BT_AllMulti,
127 BT_InputOn,
128 BT_InputOff,
129 BT_Sort,
130 BT_DragSortOn,
131 BT_DragSortOff,
132 BT_SelLine,
133 BT_SelChar,
134 BT_OpenWin2,
135 BT_RemAct,
136 BT_RemSel,
137 BT_Clear,
138 BT_Add,
139 LV_Text,
140 LI_Text,
141 LV_Text2,
142 LI_Text2,
143 PR_Horiz,
144 ST_string,
145 ST_string2;
147 struct MUI_CustomClass *MCC_Main = NULL;
149 /* ************ IMG definitions ************** */
151 const ULONG list_colors[24] =
153 0xadadadad,0xadadadad,0xadadadad,
154 0x7b7b7b7b,0x7b7b7b7b,0x7b7b7b7b,
155 0x3b3b3b3b,0x67676767,0xa2a2a2a2,
156 0xadadadad,0xadadadad,0xadadadad,
157 0xadadadad,0xadadadad,0xadadadad,
158 0xadadadad,0xadadadad,0xadadadad,
159 0xffffffff,0xffffffff,0xffffffff,
160 0x00000000,0x00000000,0x00000000,
163 const UBYTE list_body[168] = {
164 0x00,0x00,0x44,0x00,0xff,0xff,0xb8,0x00,0xff,0xff,0xb8,0x00,0x00,0x00,0x00,
165 0x00,0x80,0x00,0x64,0x00,0xff,0xff,0xb8,0x00,0x3b,0xb8,0x46,0x00,0x80,0x00,
166 0x64,0x00,0xc4,0x47,0xfc,0x00,0x00,0x00,0x46,0x00,0x80,0x00,0x64,0x00,0xff,
167 0xff,0xfc,0x00,0x36,0xd8,0x46,0x00,0x80,0x00,0x64,0x00,0xc9,0x27,0xfc,0x00,
168 0x00,0x00,0x46,0x00,0x80,0x00,0x64,0x00,0xff,0xff,0xfc,0x00,0x3d,0xe8,0x6e,
169 0x00,0x80,0x00,0x5c,0x00,0xc2,0x17,0xcc,0x00,0x00,0x00,0x46,0x00,0x80,0x00,
170 0x78,0x00,0xff,0xff,0xf8,0x00,0x00,0x00,0x40,0x00,0x80,0x00,0x64,0x00,0xff,
171 0xff,0xf8,0x00,0xbf,0xff,0xee,0x00,0x7f,0xff,0xdc,0x00,0x3f,0xff,0xcc,0x00,
172 0x00,0x44,0x46,0x00,0xff,0xbb,0xb8,0x00,0xff,0xbb,0xb8,0x00,0x00,0x00,0x00,
173 0x00,0x80,0x66,0x64,0x00,0xff,0xbb,0xb8,0x00,0xbf,0xee,0xee,0x00,0x7f,0xdd,
174 0xdc,0x00,0x3f,0xcc,0xcc,0x00,0x3f,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,
175 0x00,0x00,0x00, };
177 #define LIST_WIDTH 23
178 #define LIST_HEIGHT 14
179 #define LIST_DEPTH 3
180 #define LIST_COMPRESSION 0
181 #define LIST_MASKING 2
183 #define IMG \
184 BodychunkObject,\
185 MUIA_FixWidth , LIST_WIDTH ,\
186 MUIA_FixHeight , LIST_HEIGHT,\
187 MUIA_Bitmap_Width , LIST_WIDTH ,\
188 MUIA_Bitmap_Height , LIST_HEIGHT,\
189 MUIA_Bodychunk_Depth , LIST_DEPTH ,\
190 MUIA_Bodychunk_Body , (UBYTE *) list_body,\
191 MUIA_Bodychunk_Compression, LIST_COMPRESSION,\
192 MUIA_Bodychunk_Masking , LIST_MASKING,\
193 MUIA_Bitmap_SourceColors , (ULONG *) list_colors,\
194 MUIA_Bitmap_Transparent , 0,\
198 /* ************ IMG2 definitions ************** */
200 const ULONG list2_colors[24] =
202 0xabababab,0xadadadad,0xc5c5c5c5,
203 0x7b7b7b7b,0x7b7b7b7b,0x7b7b7b7b,
204 0x3b3b3b3b,0x67676767,0xa2a2a2a2,
205 0x00000000,0x00000000,0x00000000,
206 0xffffffff,0xa9a9a9a9,0x97979797,
207 0xffffffff,0xffffffff,0xffffffff,
208 0x00000000,0x00000000,0x00000000,
209 0xadadadad,0xadadadad,0xadadadad,
212 const UBYTE list2_body[156] = {
213 0x04,0x00,0x04,0x00,0x78,0x00,0x08,0x00,0x30,0x00,0x08,0x00,0x79,0x00,0x02,
214 0x00,0x8e,0x00,0x1c,0x00,0x3e,0x00,0x1c,0x00,0x7e,0x10,0x04,0x00,0x83,0xe0,
215 0x08,0x00,0xfe,0x80,0x08,0x00,0x45,0x02,0x00,0x00,0x85,0x9c,0x00,0x00,0xff,
216 0x70,0x00,0x00,0x7e,0x1c,0x80,0x00,0xc1,0x3b,0x78,0x00,0xfe,0xf9,0x30,0x00,
217 0x00,0x2f,0xb0,0x00,0xff,0x60,0x4c,0x00,0x7e,0xbf,0x48,0x00,0x7c,0x27,0x68,
218 0x00,0x03,0xc1,0xa4,0x00,0x01,0x7f,0xb4,0x00,0x01,0x1a,0xd8,0x00,0x03,0xe3,
219 0xa4,0x00,0x01,0xbf,0xac,0x00,0x00,0x6c,0xaa,0x00,0x04,0x99,0xd4,0x00,0x03,
220 0x97,0xfc,0x00,0x01,0x76,0x5a,0x00,0x38,0x8d,0xec,0x00,0x1e,0x8b,0x7c,0x00,
221 0x02,0xeb,0x72,0x00,0x0d,0x04,0xfc,0x00,0x09,0x06,0xf8,0x00,0x01,0x84,0x06,
222 0x00,0x0e,0x02,0xf8,0x00,0x06,0x01,0xb0,0x00,0x00,0x03,0xfc,0x00,0x00,0x00,
223 0x00,0x00,0x00,0x00,0x00,0x00, };
225 #define LIST2_WIDTH 23
226 #define LIST2_HEIGHT 13
227 #define LIST2_DEPTH 3
228 #define LIST2_COMPRESSION 0
229 #define LIST2_MASKING 2
231 #define IMG2 \
232 BodychunkObject,\
233 MUIA_FixWidth , LIST2_WIDTH ,\
234 MUIA_FixHeight , LIST2_HEIGHT,\
235 MUIA_Bitmap_Width , LIST2_WIDTH ,\
236 MUIA_Bitmap_Height , LIST2_HEIGHT,\
237 MUIA_Bodychunk_Depth , LIST2_DEPTH ,\
238 MUIA_Bodychunk_Body , (UBYTE *) list2_body,\
239 MUIA_Bodychunk_Compression, LIST2_COMPRESSION,\
240 MUIA_Bodychunk_Masking , LIST2_MASKING,\
241 MUIA_Bitmap_SourceColors , (ULONG *) list2_colors,\
242 MUIA_Bitmap_Transparent , 0,\
246 /* *********************************************** */
248 #ifndef MAKE_ID
249 #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
250 #endif
252 /* *********************************************** */
254 #define SimpleButtonCycle(name) \
255 TextObject, \
256 ButtonFrame, \
257 MUIA_CycleChain, 1, \
258 MUIA_Font, MUIV_Font_Button, \
259 MUIA_Text_Contents, name, \
260 MUIA_Text_PreParse, "\33c", \
261 MUIA_InputMode , MUIV_InputMode_RelVerify, \
262 MUIA_Background , MUII_ButtonBack, \
265 /* *********************************************** */
267 #define SimpleButtonTiny(name) \
268 TextObject, \
269 ButtonFrame, \
270 MUIA_Font, MUIV_Font_Tiny, \
271 MUIA_Text_Contents, name, \
272 MUIA_Text_PreParse, "\33c", \
273 MUIA_InputMode , MUIV_InputMode_RelVerify, \
274 MUIA_Background , MUII_ButtonBack, \
277 /* *********************************************** */
279 #define NFloattext(ftxt) \
280 NListviewObject, \
281 MUIA_Weight, 50, \
282 MUIA_CycleChain, 1, \
283 MUIA_NListview_Horiz_ScrollBar, MUIV_NListview_HSB_None, \
284 MUIA_NListview_Vert_ScrollBar, MUIV_NListview_VSB_Always, \
285 MUIA_NListview_NList,NFloattextObject, \
286 MUIA_NList_DefaultObjectOnClick, TRUE, \
287 MUIA_NFloattext_Text, ftxt, \
288 MUIA_NFloattext_TabSize, 4, \
289 MUIA_NFloattext_Justify, TRUE, \
290 End, \
293 /* *********************************************** */
296 #define ID_LIST2_ACTIVE 1
298 #define NL "\n"
299 #define NL2 " "
302 /* *********************************************** */
304 const char MainTextString2[] =
306 "This new list/listview custom class \033bhas its\033n own backgrounds" NL2
307 "and pens setables from mui prefs with NListviews.mcp !" NL2
308 "It doesn't use the same way to handle multiselection" NL2
309 "with mouse and keys than standard List/Listview." NL
310 "\033C" NL
311 "You can horizontally scroll with cursor keys," NL2
312 "or going on the right and left of the list" NL2
313 "while selecting with the mouse." NL2
314 "(When there is no immediate draggin stuff active...)" NL2
315 "\033iTry just clicking on the left/right borders !\033n" NL
316 "\033C" NL
317 "\033r\033uGive some feedback about it ! :-)" NL
318 "\033r\033bhttp://www.sf.net/projects/nlist-classes/"
321 /* *********************************************** */
322 const char MainTextString[] =
324 "\033cNList.mcc \033o[0] NListview.mcc \033o[1] NListviews.mcp" NL
325 "\033E\033t\033c\033o[2@1]" NL
326 "\033c\033nThis new list/listview custom class has its own backgrounds" NL
327 "\033cand pens setables from mui prefs with NListviews.mcp !" NL
328 "\033E\033t[M7]\033c\033o[3@2]" NL
329 "" NL
330 "\033cIt doesn't use the same way to handle multiselection" NL
331 "\033cwith mouse and keys than standard List/Listview." NL
332 "" NL
333 "\033cYou can horizontally scroll with cursor keys," NL
334 "\033cor going on the right and left of the list" NL
335 "\033cwhile selecting with the mouse." NL
336 "\033c(When there is no immediate draggin stuff active...)" NL
337 "\033c\033iTry just clicking on the left/right borders !\033n" NL
338 "" NL
339 "\033r\033uGive some feedback about it ! :-)" NL
340 "\033r\033bhttp://www.sf.net/projects/nlist-classes/"
343 /* *********************************************** */
345 const char *MainTextArray[] =
347 "\033c\033nThis new list/listview custom class \033bhas its\033n own backgrounds",
348 "\033cand pens setables from mui prefs with NListviews.mcp !",
349 " ",
350 "\033cIt doesn't use the same way to handle multiselection",
351 "\033cwith mouse and keys than standard List/Listview.",
352 " ",
353 "\033cYou can horizontally scroll with cursor keys,",
354 "\033cor going on the right and left of the list",
355 "\033cwhile selecting with the mouse.",
356 "\033c(When there is no draggin stuff active...)",
357 "\033c\033iTry just clicking on the left/right borders !\033n",
359 "\033r\033uGive some feedback about it ! :-)",
360 "\033r\033bhttp://www.sf.net/projects/nlist-classes/"
364 "You can push column titles as real buttons...",
366 "You can drag column separator bar in",
367 "the title to adjust column width...",
368 "(or in upper half of first entry if title is off)",
370 "If, while dragging the bar, you press the",
371 "menu button, the width of the column will",
372 "come back to its default...",
374 "You can click on columns title to sort the list contents.",
375 "You can shift-click (or other qualifier if you modify the",
376 "default one) to add a secondary sorting column.",
380 "\033cF2 to copy selected lines to printer",
381 "\033cF3 to copy all lines to file RAM:tmp.txt",
383 "\033cF4 to copy selected lines to clipboard 0.",
384 "\033cF5 to copy active line to clipboard 0.",
385 "\033cF6 to copy all lines to clipboard 0.",
387 "\033cThe classic RightAmiga+C to copy selected",
388 "\033clines to clipboard 0 is made builtin.",
389 " ",
390 " ",
391 "\033cYou can sort the entries by dragging.",
392 "\033cYou start a drag using one of the qualifier",
393 "\033ckeys which are set in prefs,",
394 "\033cor going on the left and right of entries.",
397 "Example of horizontal line in top of entry",
398 "\033TExample of horizontal line in top of entry",
399 "Example of horizontal line in top of entry",
401 "Examples of horizontal line and thick line centered on entry",
402 "\033C",
403 "\033C\033t",
404 "\033C\033t[I7]",
405 "\033C\033t[M7]",
406 "\033C\033t[-5]",
407 "\033C\033t[N]",
408 "\033C\033t[NI3]",
409 "\033C\033t[NM7]",
410 "\033C\033t[N-5]",
411 "Examples of horizontal line and thick line centered on entry",
413 "Example of horizontal line in bottom of entry",
414 "\033BExample of horizontal line in bottom of entry",
415 "Example of horizontal line in bottom of entry",
417 "Examples of horizontal line centered on entry visible on left and rigth only",
418 "\033c\033EExample of left-right horizontal line",
419 "\033ESame, but left aligned",
420 "\033r\033ESame, but right aligned",
421 "\033t\033c\033ELeft-right horizontal thick line",
422 "\033t[N]\033c\033ELeft-right horizontal thick line",
423 "Examples of horizontal line centered on entry visible on left and rigth only",
426 "\033E\033cExamples of bitmap images :",
427 "\033c\033o[0] \033o[1]",
428 "which can be used without subclassing the NList class.",
430 "\033E\033cExamples of custom object images : ",
431 "\033o[2;9d51ffff;1] (default width/special 1)",
432 "\033o[2;9d51ffff;0,24] (24 pixel width/special 0)",
433 "\033o[2;9d51ffff;1,48] (48 pixel width/special 1)",
434 "\033o[2;9d51ffff;0,96] (96 pixel width/special 0)",
436 "\033E\033cExamples of custom object images : ",
437 "\033o[2;9d51ffff;8,30] (default width/special 8)",
438 "\033o[2;9d51ffff;6,40] (default width/special 6)",
439 "\033o[2;9d51ffff;7,40] (40 pixel width/special 7)",
440 "\033o[2;9d51ffff;4,50] (50 pixel width/special 4)",
441 "\033o[2;9d51ffff;5,50] (50 pixel width/special 5)",
442 "\033o[2;9d51ffff;2,30] (30 pixel width/special 2)",
443 "\033o[2;9d51ffff;3,30] (30 pixel width/special 3)",
445 "\033E\033cExamples of direct ImageSpec :",
446 "kmel/kmel_arrowdown.image : \033I[3:kmel/kmel_arrowdown.image]",
447 "WD/11pt/ArrowLeft.mf0 : \033I[3:WD/11pt/ArrowLeft.mf0]",
448 "color red: \033I[2:ffffffff,00000000,00000000]",
449 "color green: \033I[2:00000000,ffffffff,00000000]",
450 "color blue: \033I[2:00000000,00000000,ffffffff]",
451 "color yellow: \033I[2:ffffffff,ffffffff,00000000]",
453 "\033C",
455 "ww\tTabulation test",
456 "w\tTabulation test",
457 "\033cww\tTabulation test",
458 "\033cw\tTabulation test",
459 "\033rww\tTabulation test",
460 "\033rw\tTabulation test",
463 "long line for FULLAUTO horizontal scroller test, long line for FullAuto horizontal scroller test, long line for FULLAUTO horizontal scroller test.",
465 "0 just a little \033bline to test\033n stuffs",
466 "1 just a little \033bline to test\033n stuffs",
467 "2 just a little \033bline to test\033n stuffs",
468 "3 just a little \033bline to test\033n stuffs",
469 "\033c4 just a little \033uline to test\033n (center)",
470 "\033c5 just a little \033uline to test\033n (center)",
471 "\033c6 just a little \033uline to test\033n (center)",
472 "\033r7 just a little \033uline to test\033n (right)",
473 "\033r8 just a little \033uline to test\033n (right)",
474 "\033r9 just a little \033uline to test\033n (right)",
475 "10 just a little line to test stuffs and bugs",
476 "11 just a little line to test stuffs and bugs",
477 "12 just a little line to test stuffs and bugs",
478 "13 just a little line to test stuffs and bugs",
479 "14 just a little line to test stuffs and bugs",
480 "15 just a little \033iline to test stuffs\033n and bugs",
481 "16 just a little line to test stuffs and bugs",
482 "17 just a little line to test stuffs and bugs",
483 "18 just a little line to test stuffs and bugs",
484 "19 just a little line to test stuffs and bugs",
485 "\033c20 just a little line to test stuffs and bugs (center)",
486 "\033c21 just a little line to test stuffs and bugs (center)",
487 "\033c22 just a little line to test stuffs and bugs (center)",
488 "\033c23 just a little line to test stuffs and bugs (center)",
489 "24 just a little line to test stuffs and bugs, just a little line",
490 "25 just a little line to test stuffs and bugs, just a little line",
491 "\033r26 just a little line to test stuffs and bugs (right)",
492 "\033r27 just a little line to test stuffs and bugs (right)",
493 "\033r28 just a little line to test stuffs and bugs (right)",
494 "\033r29 just a little line to test stuffs and bugs (right)",
495 "30 just a little line to test stuffs and bugs, just a little line to test",
496 "31 just a little line to test stuffs and bugs, just a little line to test",
497 "32 \0332just a little line to test stuffs and bugs, just a little line to test",
498 "33 \0333just a little line to test stuffs and bugs, just a little line to test",
499 "34 \0334just a little line to test stuffs and bugs, just a little line to test",
500 "35 \0335just a little line to test stuffs and bugs, just a little line to test",
501 "36 \0336just a little line to test stuffs and bugs, just a little line to test",
502 "37 \0337just a little line to test stuffs and bugs, just a little line to test",
503 "38 \0338just a little line to test stuffs and bugs, just a little line to test",
504 "39 \0339just a little line to test stuffs and bugs, just a little line to test",
505 "40 \033P[]just a little line to test stuffs and bugs, just a little line to test stuffs ",
506 "41 \033P[1]just a little line to test\033P[] stuffs and bugs, just a little line to test stuffs ",
507 "42 \033P[2]just a little line to test\033P[] stuffs and bugs, just a little line to test stuffs ",
508 "43 \033P[-1]just a little line to test\033P[] stuffs and bugs, just a little line to test stuffs ",
509 "44 \033P[-3]just a little line to test\033P[] stuffs and bugs, just a little line to test stuffs ",
510 "45 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
511 "46 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
512 "47 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
513 "48 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
514 "49 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
515 "50 \033ijust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
516 "51 \033ujust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
517 "52 \033bjust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
518 "53 \033i\033ujust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
519 "54 \033i\033bjust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
520 "55 \033b\033ujust a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
521 "56 \033i\033b\033ujust a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
522 "57 just a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
523 "58 just a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
524 "59 just a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
525 " ",
526 " ",
527 "\033c\033uI find it \033bnice\033n :-)",
528 NULL
531 /* *********************************************** */
533 struct LITD {
534 LONG num;
535 char str1[7];
536 char *str2;
539 /* *********************************************** */
541 HOOKPROTONHNO(ConstructLI_TextFunc, APTR, struct NList_ConstructMessage *ncm)
543 struct LITD *new_entry = (struct LITD *) AllocVec(sizeof(struct LITD),0);
545 if (new_entry)
547 int i = 0, j = 0;
548 new_entry->num = -1;
549 new_entry->str2 = (char *) ncm->entry;
550 while ((j < 6) && new_entry->str2[i])
552 if ((new_entry->str2[i] > 'A') && (new_entry->str2[i] < 'z'))
553 new_entry->str1[j++] = new_entry->str2[i];
554 if (new_entry->str2[i] == '\033')
555 i++;
556 i++;
558 new_entry->str1[j] = '\0';
560 return (new_entry);
562 return (NULL);
564 MakeStaticHook(ConstructLI_TextHook, ConstructLI_TextFunc);
566 /* *********************************************** */
568 HOOKPROTONHNO(DestructLI_TextFunc, void, struct NList_DestructMessage *ndm)
570 if (ndm->entry)
571 FreeVec((void *) ndm->entry);
573 MakeStaticHook(DestructLI_TextHook, DestructLI_TextFunc);
575 /* *********************************************** */
577 static char buf[20];
579 HOOKPROTONHNO(DisplayLI_TextFunc, void, struct NList_DisplayMessage *ndm)
581 struct LITD *entry = (struct LITD *) ndm->entry;
583 if (entry)
584 { if (entry->num < 0)
585 entry->num = ndm->entry_pos;
587 ndm->preparses[0] = (STRPTR)"\033c";
588 ndm->preparses[1] = (STRPTR)"\033c";
590 if (entry->num % 20 == 3)
591 ndm->strings[0] = (STRPTR)"\033o[0]";
592 else if (entry->num % 20 == 13)
593 ndm->strings[0] = (STRPTR)"\033o[1]";
594 else
596 snprintf(buf, sizeof(buf), "%d", (int)entry->num);
597 ndm->strings[0] = buf;
600 ndm->strings[1] = (char *) entry->str1;
601 ndm->strings[2] = (char *) entry->str2;
603 else
605 ndm->preparses[0] = (STRPTR)"\033c";
606 ndm->preparses[1] = (STRPTR)"\033c";
607 ndm->preparses[2] = (STRPTR)"\033c";
608 ndm->strings[0] = (STRPTR)"Num";
609 ndm->strings[1] = (STRPTR)"Short";
610 ndm->strings[2] = (STRPTR)"This is the list title !\033n\033b :-)";
613 MakeStaticHook(DisplayLI_TextHook, DisplayLI_TextFunc);
615 /* *********************************************** */
617 HOOKPROTONHNO(CompareLI_TextFunc, LONG, struct NList_CompareMessage *ncm)
619 struct LITD *entry1 = (struct LITD *) ncm->entry1;
620 struct LITD *entry2 = (struct LITD *) ncm->entry2;
621 LONG col1 = ncm->sort_type & MUIV_NList_TitleMark_ColMask;
622 LONG col2 = ncm->sort_type2 & MUIV_NList_TitleMark2_ColMask;
623 LONG result = 0;
626 LONG st = ncm->sort_type & MUIV_NList_TitleMark_TypeMask;
627 kprintf("%lx|Compare() %lx / %lx / %lx\n",obj,ncm->sort_type,st,ncm->sort_type2);
630 if(ncm->sort_type == (LONG)MUIV_NList_SortType_None)
631 return (0);
633 if (col1 == 0)
634 { if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask)
635 result = entry2->num - entry1->num;
636 else
637 result = entry1->num - entry2->num;
639 else if (col1 == 1)
640 { if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask)
641 result = (LONG) stricmp(entry2->str1,entry1->str1);
642 else
643 result = (LONG) stricmp(entry1->str1,entry2->str1);
645 else if (col1 == 2)
646 { if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask)
647 result = (LONG) stricmp(entry2->str2,entry1->str2);
648 else
649 result = (LONG) stricmp(entry1->str2,entry2->str2);
652 if ((result != 0) || (col1 == col2))
653 return (result);
655 if (col2 == 0)
656 { if (ncm->sort_type2 & MUIV_NList_TitleMark2_TypeMask)
657 result = entry2->num - entry1->num;
658 else
659 result = entry1->num - entry2->num;
661 else if (col2 == 1)
662 { if (ncm->sort_type2 & MUIV_NList_TitleMark2_TypeMask)
663 result = (LONG) stricmp(entry2->str1,entry1->str1);
664 else
665 result = (LONG) stricmp(entry1->str1,entry2->str1);
667 else if (col2 == 2)
668 { if (ncm->sort_type2 & MUIV_NList_TitleMark2_TypeMask)
669 result = (LONG) stricmp(entry2->str2,entry1->str2);
670 else
671 result = (LONG) stricmp(entry1->str2,entry2->str2);
674 return (result);
676 MakeStaticHook(CompareLI_TextHook, CompareLI_TextFunc);
678 /* *********************************************** */
680 #if defined(__amigaos4__)
681 #define GETINTERFACE(iface, base) (iface = (APTR)GetInterface((struct Library *)(base), "main", 1L, NULL))
682 #define DROPINTERFACE(iface) (DropInterface((struct Interface *)iface), iface = NULL)
683 #else
684 #define GETINTERFACE(iface, base) TRUE
685 #define DROPINTERFACE(iface)
686 #endif
688 /* *********************************************** */
690 static VOID fail(APTR APP_Main,const char *str)
692 if (APP_Main)
693 MUI_DisposeObject(APP_Main);
695 if(MCC_Main)
696 MUI_DeleteCustomClass(MCC_Main);
698 ShutdownClipboardServer();
700 NGR_Delete();
702 #if defined(DEBUG)
703 if(TimerBase)
705 DROPINTERFACE(ITimer);
706 CloseDevice((struct IORequest *)&timereq);
707 TimerBase = NULL;
709 #endif // DEBUG
711 if(ConsoleDevice)
713 DROPINTERFACE(IConsole);
714 CloseDevice((struct IORequest *)&ioreq);
715 ConsoleDevice = NULL;
718 if(MUIMasterBase)
720 DROPINTERFACE(IMUIMaster);
721 CloseLibrary(MUIMasterBase);
724 if(IntuitionBase)
726 DROPINTERFACE(IIntuition);
727 CloseLibrary((struct Library *)IntuitionBase);
730 if(LayersBase)
732 DROPINTERFACE(ILayers);
733 CloseLibrary(LayersBase);
736 if(GfxBase)
738 DROPINTERFACE(IGraphics);
739 CloseLibrary((struct Library *)GfxBase);
742 if(UtilityBase)
744 DROPINTERFACE(IUtility);
745 CloseLibrary((struct Library *)UtilityBase);
748 if(DiskfontBase)
750 DROPINTERFACE(IDiskfont);
751 CloseLibrary(DiskfontBase);
755 if (str)
756 { puts(str);
757 exit(20);
759 exit(0);
762 static VOID init(VOID)
764 APP_Main = NULL;
766 if((DiskfontBase = OpenLibrary("diskfont.library", 38)) &&
767 GETINTERFACE(IDiskfont, DiskfontBase))
768 if((UtilityBase = (APTR)OpenLibrary("utility.library", 36)) &&
769 GETINTERFACE(IUtility, UtilityBase))
770 if((GfxBase = (APTR)OpenLibrary("graphics.library", 36)) &&
771 GETINTERFACE(IGraphics, GfxBase))
772 if((LayersBase = OpenLibrary("layers.library", 38)) &&
773 GETINTERFACE(ILayers, LayersBase))
774 if((IntuitionBase = (APTR)OpenLibrary("intuition.library", 36)) &&
775 GETINTERFACE(IIntuition, IntuitionBase))
776 if((MUIMasterBase = OpenLibrary("muimaster.library", 19)) &&
777 GETINTERFACE(IMUIMaster, MUIMasterBase))
779 ioreq.io_Message.mn_Length = sizeof(ioreq);
780 if(!OpenDevice("console.device", -1L, (struct IORequest *)&ioreq, 0L))
782 ConsoleDevice = (APTR)ioreq.io_Device;
784 if(GETINTERFACE(IConsole, ConsoleDevice))
786 #if defined(DEBUG)
787 timereq.Request.io_Message.mn_Length = sizeof(timereq);
788 if(OpenDevice("timer.device", 0, (struct IORequest *)&timereq, 0L) == 0)
790 TimerBase = timereq.Request.io_Device;
791 if(GETINTERFACE(ITimer, TimerBase))
793 #endif
794 if(NGR_Create())
796 if(StartClipboardServer() == TRUE)
798 #if defined(DEBUG)
799 SetupDebug();
800 #endif
802 return;
805 #if defined(DEBUG)
808 #endif // DEBUG
813 fail(NULL,"Failed to open libraries");
817 /* *********************************************** */
820 int main(UNUSED int argc, UNUSED char *argv[])
822 LONG win_opened;
823 LONG result;
825 init();
827 MCC_Main = MUI_CreateCustomClass(NULL, "Group.mui", NULL, sizeof(struct NLData), ENTRY(_Dispatcher));
829 APP_Main = ApplicationObject,
830 MUIA_Application_Title , "NList-Demo",
831 MUIA_Application_Version , "$VER: NList-Demo 1.0 (" __DATE__ ")",
832 MUIA_Application_Copyright , "(C) 2001-2014 NList Open Source Team",
833 MUIA_Application_Author , "NList Open Source Team",
834 MUIA_Application_Description, "NList-Demo",
835 MUIA_Application_Base , "NList-Demo",
837 SubWindow, WIN_Main = WindowObject,
838 MUIA_Window_Title, "NList-Demo 1996-2014",
839 MUIA_Window_ID , MAKE_ID('T','W','I','N'),
840 WindowContents, VGroup,
841 Child, HGroup,
842 Child, BT_InputOn = SimpleButtonCycle("InputOn"),
843 Child, BT_InputOff = SimpleButtonCycle("InputOff"),
844 Child, BT_SelLine = SimpleButtonCycle("Sel_Line"),
845 Child, BT_SelChar = SimpleButtonCycle("Sel_Char"),
846 Child, BT_Clear = SimpleButtonCycle("Clear"),
847 Child, BT_Add = SimpleButtonCycle("Add"),
848 End,
849 Child, HGroup,
850 Child, BT_NoMulti = SimpleButtonCycle("NoMulti"),
851 Child, BT_Multidef = SimpleButtonCycle("Def"),
852 Child, BT_Multi = SimpleButtonCycle("Multi"),
853 Child, BT_AllMulti = SimpleButtonCycle("AllMulti"),
854 Child, BM_img = IMG,
855 Child, BT_RemAct = SimpleButtonCycle("RemAct"),
856 Child, BT_RemSel = SimpleButtonCycle("RemSel"),
857 End,
858 Child, HGroup,
859 Child, BT_DragSortOn = SimpleButtonCycle("DragSortOn"),
860 Child, BT_DragSortOff = SimpleButtonCycle("DragSortOff"),
861 Child, BM_img2 = IMG2,
862 Child, BT_TitleOn = SimpleButtonCycle("TitleOn"),
863 Child, BT_TitleOff = SimpleButtonCycle("TitleOff"),
864 Child, BT_Sort = SimpleButtonCycle("Sort"),
865 Child, BT_OpenWin2 = SimpleButtonCycle("Win2"),
866 End,
867 Child, LV_Text = NListviewObject,
868 MUIA_CycleChain, 1,
870 MUIA_NListview_NList, LI_Text = NewObject(MCC_Main->mcc_Class, NULL,
871 MUIA_ObjectID, MAKE_ID('N','L','0','1'),
872 MUIA_NList_DefaultObjectOnClick, TRUE,
873 MUIA_NList_ActiveObjectOnClick, TRUE,
874 MUIA_NList_MultiSelect, MUIV_NList_MultiSelect_None,
875 MUIA_NList_DisplayHook2, &DisplayLI_TextHook,
876 MUIA_NList_CompareHook2, &CompareLI_TextHook,
877 MUIA_NList_ConstructHook2, &ConstructLI_TextHook,
878 MUIA_NList_DestructHook2, &DestructLI_TextHook,
879 MUIA_NList_Format, "BAR W=-1,BAR W=-1 PCS=L,BAR PCS=C",
880 MUIA_NList_SourceArray, MainTextArray,
881 MUIA_NList_AutoVisible, TRUE,
882 //MUIA_NList_AutoClip, FALSE,
883 MUIA_NList_TitleSeparator, TRUE,
884 MUIA_NList_Title, TRUE,
885 MUIA_NList_EntryValueDependent, TRUE,
886 MUIA_NList_MinColSortable, 0,
887 MUIA_NList_Imports, MUIV_NList_Imports_All,
888 MUIA_NList_Exports, MUIV_NList_Exports_All,
889 End,
890 MUIA_ShortHelp, "The nice multicolumn\ndraggable list\nwith char selection\npossibility :)",
891 End,
892 Child, ST_string2 = StringObject,
893 StringFrame,
894 End,
895 End,
896 End,
897 SubWindow, WIN_2 = WindowObject,
898 MUIA_Window_Title, "NList-Demo 1996-2006 Win 2",
899 MUIA_Window_ID , MAKE_ID('W','I','N','2'),
900 MUIA_Window_UseBottomBorderScroller, TRUE,
901 WindowContents, VGroup,
902 Child, NFloattext(MainTextString2),
903 Child, BalanceObject, End,
904 Child, VGroup,
905 MUIA_Group_VertSpacing, 1,
906 Child, LV_Text2 = NListviewObject,
907 MUIA_CycleChain, 1,
908 MUIA_NListview_Horiz_ScrollBar, MUIV_NListview_HSB_None,
909 MUIA_NListview_NList, LI_Text2 = NewObject(MCC_Main->mcc_Class, NULL,
910 MUIA_NList_DefaultObjectOnClick, TRUE,
911 MUIA_NList_ConstructHook, MUIV_NList_ConstructHook_String,
912 MUIA_NList_DestructHook, MUIV_NList_DestructHook_String,
913 MUIA_NList_SourceString, MainTextString,
914 End,
915 MUIA_ShortHelp, "The 2nd list",
916 End,
917 Child, ST_string = StringObject,
918 MUIA_CycleChain, 1,
919 StringFrame,
920 End,
921 Child, PR_Horiz = ScrollbarObject,
922 MUIA_Group_Horiz, TRUE,
923 MUIA_Prop_UseWinBorder,MUIV_Prop_UseWinBorder_Bottom,
924 End,
925 End,
926 End,
927 End,
928 End;
930 if(!APP_Main) fail(APP_Main,"Failed to create Application.");
933 /* ********** MAIN LIST NOTIFIES ********** */
935 DoMethod(LI_Text, MUIM_Notify, MUIA_NList_TitleClick,MUIV_EveryTime,
936 LI_Text, 4, MUIM_NList_Sort3, MUIV_TriggerValue, MUIV_NList_SortTypeAdd_2Values, MUIV_NList_Sort3_SortType_Both);
937 DoMethod(LI_Text, MUIM_Notify, MUIA_NList_TitleClick2,MUIV_EveryTime,
938 LI_Text, 4, MUIM_NList_Sort3, MUIV_TriggerValue, MUIV_NList_SortTypeAdd_2Values, MUIV_NList_Sort3_SortType_2);
939 DoMethod(LI_Text, MUIM_Notify, MUIA_NList_SortType,MUIV_EveryTime,
940 LI_Text, 3, MUIM_Set,MUIA_NList_TitleMark,MUIV_TriggerValue);
941 DoMethod(LI_Text, MUIM_Notify, MUIA_NList_SortType2,MUIV_EveryTime,
942 LI_Text, 3, MUIM_Set,MUIA_NList_TitleMark2,MUIV_TriggerValue);
945 /* ********** MAIN LIST IMAGES ********** */
947 DoMethod(LI_Text,MUIM_NList_UseImage,BM_img,0,0);
948 DoMethod(LI_Text,MUIM_NList_UseImage,BM_img2,1,0);
950 // DoMethod(LI_Text,MUIM_NList_UseImage,NImageObject,2,~0L);
953 /* ********** BUTTONS NOTIFIES ********** */
955 DoMethod(BT_TitleOn, MUIM_Notify, MUIA_Pressed,FALSE,
956 LI_Text, 3, MUIM_Set,MUIA_NList_Title,"\033cThis is that list title ! :-)");
957 DoMethod(BT_TitleOff, MUIM_Notify, MUIA_Pressed,FALSE,
958 LI_Text, 3, MUIM_Set,MUIA_NList_Title,NULL);
959 DoMethod(BT_NoMulti, MUIM_Notify, MUIA_Pressed,FALSE,
960 LI_Text, 3, MUIM_Set,MUIA_NList_MultiSelect,MUIV_NList_MultiSelect_None);
961 DoMethod(BT_Multidef, MUIM_Notify, MUIA_Pressed,FALSE,
962 LI_Text, 3, MUIM_Set,MUIA_NList_MultiSelect,MUIV_NList_MultiSelect_Default);
963 DoMethod(BT_Multi, MUIM_Notify, MUIA_Pressed,FALSE,
964 LI_Text, 3, MUIM_Set,MUIA_NList_MultiSelect,MUIV_NList_MultiSelect_Shifted);
965 DoMethod(BT_AllMulti, MUIM_Notify, MUIA_Pressed,FALSE,
966 LI_Text, 3, MUIM_Set,MUIA_NList_MultiSelect,MUIV_NList_MultiSelect_Always);
967 DoMethod(BT_InputOn, MUIM_Notify, MUIA_Pressed,FALSE,
968 LI_Text, 3, MUIM_Set,MUIA_NList_Input,TRUE);
969 DoMethod(BT_InputOff, MUIM_Notify, MUIA_Pressed,FALSE,
970 LI_Text, 3, MUIM_Set,MUIA_NList_Input,FALSE);
971 DoMethod(BT_DragSortOn, MUIM_Notify, MUIA_Pressed,FALSE,
972 LI_Text, 3, MUIM_Set,MUIA_NList_DragSortable,TRUE);
973 DoMethod(BT_DragSortOff, MUIM_Notify, MUIA_Pressed,FALSE,
974 LI_Text, 3, MUIM_Set,MUIA_NList_DragSortable,FALSE);
975 DoMethod(BT_RemAct, MUIM_Notify, MUIA_Pressed,FALSE,
976 LI_Text, 2, MUIM_NList_Remove,MUIV_NList_Remove_Active);
977 DoMethod(BT_RemSel, MUIM_Notify, MUIA_Pressed,FALSE,
978 LI_Text, 2, MUIM_NList_Remove,MUIV_NList_Remove_Selected);
979 DoMethod(BT_Clear, MUIM_Notify, MUIA_Pressed,FALSE,
980 LI_Text, 1, MUIM_NList_Clear);
981 DoMethod(BT_Add, MUIM_Notify, MUIA_Pressed,FALSE,
982 LI_Text, 4, MUIM_NList_Insert,MainTextArray,15,MUIV_NList_Insert_Bottom);
983 DoMethod(BT_Sort, MUIM_Notify, MUIA_Pressed,FALSE,
984 LI_Text, 1, MUIM_NList_Sort);
985 DoMethod(BT_SelLine, MUIM_Notify, MUIA_Pressed,FALSE,
986 LI_Text, 3, MUIM_Set,MUIA_NList_TypeSelect,MUIV_NList_TypeSelect_Line);
987 DoMethod(BT_SelChar, MUIM_Notify, MUIA_Pressed,FALSE,
988 LI_Text, 3, MUIM_Set,MUIA_NList_TypeSelect,MUIV_NList_TypeSelect_Char);
989 DoMethod(BT_OpenWin2, MUIM_Notify, MUIA_Pressed,FALSE,
990 WIN_2, 3, MUIM_Set,MUIA_Window_Open,TRUE);
993 /* ********** WINDOW1 KEYS NOTIFIES ********** */
995 DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f2",
996 LI_Text, 4,MUIM_NList_CopyTo,MUIV_NList_CopyTo_Selected,"PRT:",&result,NULL);
997 DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f3",
998 LI_Text, 4,MUIM_NList_CopyTo,MUIV_NList_CopyTo_All,"RAM:tmp.txt",&result,NULL);
999 DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f4",
1000 LI_Text, 4,MUIM_NList_CopyToClip,MUIV_NList_CopyToClip_Selected,0L,NULL,NULL);
1001 DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f5",
1002 LI_Text, 4,MUIM_NList_CopyToClip,MUIV_NList_CopyToClip_Active,0L,NULL,NULL);
1003 DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f6",
1004 LI_Text, 4,MUIM_NList_CopyToClip,MUIV_NList_CopyToClip_All,0L,NULL,NULL);
1007 /* ********** WINDOW2 LIST NOTIFIES ********** */
1009 DoMethod(LI_Text2,MUIM_Notify,MUIA_NList_ButtonClick, 1,
1010 APP_Main, 6, MUIM_Application_PushMethod,
1011 WIN_2, 3, MUIM_Set,MUIA_Window_Open,FALSE);
1013 DoMethod(LI_Text2,MUIM_Notify,MUIA_NList_ButtonClick, 2,
1014 LI_Text, 1, MUIM_NList_Clear);
1017 DoMethod(LI_Text2, MUIM_Notify, MUIA_NList_Horiz_Entries,MUIV_EveryTime,
1018 PR_Horiz, 3, MUIM_NoNotifySet,MUIA_Prop_Entries,MUIV_TriggerValue);
1019 DoMethod(LI_Text2, MUIM_Notify, MUIA_NList_Horiz_Visible,MUIV_EveryTime,
1020 PR_Horiz, 3, MUIM_NoNotifySet,MUIA_Prop_Visible,MUIV_TriggerValue);
1021 DoMethod(LI_Text2, MUIM_Notify, MUIA_NList_Horiz_First,MUIV_EveryTime,
1022 PR_Horiz, 3, MUIM_NoNotifySet,MUIA_Prop_First,MUIV_TriggerValue);
1023 DoMethod(PR_Horiz, MUIM_Notify, MUIA_Prop_First,MUIV_EveryTime,
1024 LI_Text2, 3, MUIM_NoNotifySet,MUIA_NList_Horiz_First,MUIV_TriggerValue);
1025 DoMethod(LI_Text2, MUIM_Notify, MUIA_NList_HorizDeltaFactor,MUIV_EveryTime,
1026 PR_Horiz, 3, MUIM_NoNotifySet,MUIA_Prop_DeltaFactor,MUIV_TriggerValue);
1028 set(ST_string, MUIA_String_AttachedList, LI_Text2);
1029 DoMethod(LI_Text2,MUIM_Notify,MUIA_NList_SelectChange,TRUE,APP_Main,2,MUIM_Application_ReturnID,ID_LIST2_ACTIVE);
1030 DoMethod(LI_Text2,MUIM_Notify,MUIA_NList_Active,MUIV_EveryTime,APP_Main,2,MUIM_Application_ReturnID,ID_LIST2_ACTIVE);
1031 set(LI_Text2, MUIA_NList_Active, 2);
1034 /* ********** WINDOW2 LIST IMAGES ********** */
1036 DoMethod(LI_Text2,MUIM_NList_UseImage,BM_img,0,0);
1037 DoMethod(LI_Text2,MUIM_NList_UseImage,BM_img2,1,0);
1039 DoMethod(LI_Text2,MUIM_NList_UseImage,SimpleButtonTiny("Click me to close"),2,~0L);
1040 DoMethod(LI_Text2,MUIM_NList_UseImage,SimpleButtonTiny("Clear main list"),3,~0L);
1043 /* ********** WINDOW2 NOTIFIES ********** */
1045 DoMethod(WIN_Main,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
1046 APP_Main, 5, MUIM_Application_PushMethod,
1047 APP_Main,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
1049 DoMethod(WIN_2,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
1050 APP_Main, 6, MUIM_Application_PushMethod,
1051 WIN_2, 3, MUIM_Set,MUIA_Window_Open,FALSE);
1053 set(WIN_Main, MUIA_Window_DefaultObject, LI_Text);
1054 set(WIN_Main, MUIA_Window_ActiveObject, LI_Text);
1055 set(WIN_2, MUIA_Window_ActiveObject, ST_string);
1056 set(WIN_2, MUIA_Window_DefaultObject, LV_Text2);
1058 //set(LI_Text, MUIA_NList_KeyRightFocus, ST_string2);
1060 /* ************************************** */
1062 DoMethod(APP_Main,MUIM_Application_Load,MUIV_Application_Load_ENVARC);
1064 /* *** If need to be sorted, sort then restore the active and first *** */
1065 /* *** which were set in the Application_Load *** */
1067 ULONG active,first,sorttype;
1068 get(LI_Text,MUIA_NList_SortType,&sorttype);
1069 if (sorttype != MUIV_NList_SortType_None)
1070 { get(LI_Text,MUIA_NList_Active,&active);
1071 get(LI_Text,MUIA_NList_First,&first);
1072 DoMethod(LI_Text, MUIM_NList_Sort);
1073 set(LI_Text,MUIA_NList_Active,active);
1074 set(LI_Text,MUIA_NList_First,first);
1078 set(WIN_2,MUIA_Window_Open,TRUE);
1079 set(WIN_Main,MUIA_Window_Open,TRUE);
1081 get(WIN_Main,MUIA_Window_Open,&win_opened);
1082 if (win_opened)
1084 LONG id;
1085 ULONG sigs = 0;
1086 char *line;
1088 while ((id = DoMethod(APP_Main,MUIM_Application_NewInput,&sigs)) != (LONG)MUIV_Application_ReturnID_Quit)
1090 if (id == ID_LIST2_ACTIVE)
1091 { DoMethod(LI_Text2, MUIM_NList_GetEntry, MUIV_NList_GetEntry_Active, &line);
1092 set(ST_string, MUIA_String_Contents, line);
1093 set(WIN_2, MUIA_Window_ActiveObject, ST_string);
1095 if (sigs)
1096 { sigs = Wait(sigs | SIGBREAKF_CTRL_C);
1097 if (sigs & SIGBREAKF_CTRL_C) break;
1101 else
1102 printf("failed to open main window !\n");
1104 DoMethod(APP_Main,MUIM_Application_Save,MUIV_Application_Save_ENVARC);
1106 set(WIN_2,MUIA_Window_Open,FALSE);
1107 set(WIN_Main,MUIA_Window_Open,FALSE);
1109 DoMethod(LI_Text,MUIM_NList_UseImage,NULL,-1,0);
1110 DoMethod(LI_Text2,MUIM_NList_UseImage,NULL,-1,0);
1112 fail(APP_Main,NULL);
1114 return 0;