2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
6 /*********************************************************************************************/
10 #include "compilerspecific.h"
12 #include "arossupport.h"
18 extern struct NewMenu nm
[];
19 extern struct NewMenu nmpict
[];
20 extern struct NewMenu nmtext
[];
22 /*********************************************************************************************/
24 /* Many datatype classes seem to rely on OM_NOTIFY calls coming back to the datatype object
27 #define BACK_CONNECTION 1
29 /*********************************************************************************************/
31 #define ARG_TEMPLATE "FILE,CLIPBOARD/S,CLIPUNIT/K/N,SCREEN/S,PUBSCREEN/K,REQUESTER/S," \
32 "BOOKMARK/S,FONTNAME/K,FONTSIZE/K/N,BACKDROP/S,WINDOW/S," \
33 "PORTNAME/K,IMMEDIATE/S,REPEAT/S,PRTUNIT/K/N"
36 #define ARG_CLIPBOARD 1
37 #define ARG_CLIPUNIT 2
39 #define ARG_PUBSCREEN 4
40 #define ARG_REQUESTER 5
41 #define ARG_BOOKMARK 6
42 #define ARG_FONTNAME 7
43 #define ARG_FONTSIZE 8
44 #define ARG_BACKDROP 9
46 #define ARG_PORTNAME 11
47 #define ARG_IMMEDIATE 12
49 #define ARG_PRTUNIT 14
53 /*********************************************************************************************/
62 {&IntuitionBase
, "intuition.library" , 39 },
63 {&GfxBase
, "graphics.library" , 39 },
64 {&GadToolsBase
, "gadtools.library" , 39 },
65 {&LayersBase
, "layers.library" , 39 },
66 {&UtilityBase
, "utility.library" , 39 },
67 {&KeymapBase
, "keymap.library" , 39 },
68 {&DataTypesBase
, "datatypes.library" , 39 },
69 {&DiskfontBase
, "diskfont.library" , 39 },
73 static struct TextAttr textattr
;
74 static struct TextFont
*font
;
75 static struct RDArgs
*myargs
;
76 static IPTR args
[NUM_ARGS
];
77 static UBYTE fontname
[256];
78 static WORD winwidth
, winheight
;
79 static WORD sizeimagewidth
, sizeimageheight
;
80 static BOOL model_has_members
;
81 static jmp_buf exit_buf
;
83 /*********************************************************************************************/
85 static void CloseLibs(void);
86 static void KillFont(void);
87 static void FreeArguments(void);
88 static void KillICObjects(void);
89 static void FreeVisual(void);
90 static void KillGadgets(void);
91 static void CloseDTO(void);
92 static void KillWindow(void);
93 static void ScrollTo(UWORD dir
, UWORD quali
);
94 static void FitToWindow(void);
96 /*********************************************************************************************/
98 void OutputMessage(CONST_STRPTR msg
)
100 struct EasyStruct es
;
104 if ( IntuitionBase
&& !((struct Process
*)FindTask(NULL
))->pr_CLI
)
106 es
.es_StructSize
= sizeof(es
);
108 es
.es_Title
= "MultiView";
109 es
.es_TextFormat
= msg
;
110 es
.es_GadgetFormat
= MSG(MSG_OK
);
112 EasyRequestArgs(win
, &es
, NULL
, NULL
);
116 Printf("MultiView: %s\n", msg
);
121 /*********************************************************************************************/
123 void WinCleanup(void)
128 wincoords
.MinX
= win
->LeftEdge
;
129 wincoords
.MinY
= win
->TopEdge
;
130 wincoords
.MaxX
= win
->Width
;
131 wincoords
.MaxY
= win
->Height
;
133 D(bug("[Multiview] WinCleanup() MinX = %d MinY = %d MaxX = %d MaxY = %d\n",
134 wincoords
.MinX
, wincoords
.MinY
, wincoords
.MaxX
, wincoords
.MaxY
));
138 DeleteMsgPort(msgport
);
140 D(bug("[Multiview] removed msgport\n"));
144 RemoveAppWindow(appwindow
);
146 D(bug("[Multiview] removed appwindow\n"));
158 /*********************************************************************************************/
160 void Cleanup(CONST_STRPTR msg
)
162 struct ScreenNotifyMessage
*snmsg
;
166 while (!EndScreenNotify (isnstarted
))
171 while ((snmsg
= (struct ScreenNotifyMessage
*) GetMsg (isnport
)))
173 ReplyMsg((struct Message
*)snmsg
);
175 DeleteMsgPort(isnport
);
183 CurrentDir(cd
); /* restore current directory */
188 longjmp(exit_buf
, 0);
192 /*********************************************************************************************/
194 static void OpenLibs(void)
198 for(li
= libtable
; li
->var
; li
++)
200 if (!((*(struct Library
**)li
->var
) = OpenLibrary(li
->name
, li
->version
)))
202 __sprintf(s
, MSG(MSG_CANT_OPEN_LIB
), li
->name
, li
->version
);
209 /*********************************************************************************************/
211 static void CloseLibs(void)
215 for(li
= libtable
; li
->var
; li
++)
217 if (*(struct Library
**)li
->var
) CloseLibrary((*(struct Library
**)li
->var
));
221 /*********************************************************************************************/
223 static void LoadFont(void)
225 font
= OpenDiskFont(&textattr
);
228 textattr
.ta_Name
= "topaz.font";
229 textattr
.ta_YSize
= 8;
230 textattr
.ta_Style
= 0;
231 textattr
.ta_Flags
= 0;
233 font
= OpenFont(&textattr
);
237 /*********************************************************************************************/
239 static void KillFont(void)
241 if (font
) CloseFont(font
);
244 /*********************************************************************************************/
246 static void InitDefaults(void)
248 struct TextFont
*defaultfont
= GfxBase
->DefaultFont
;
250 /* This might be a bit problematic depending on how default system font
251 switching through Font prefs program works and if then the previous
252 default system font is closed or not. So this is very likely only safe
253 when in such a case the previous font is not closed (means -> the font
254 will remain in memory in any case)
256 ClipView example program on Amiga Dev CD also does it like this. So ... */
258 textattr
.ta_Name
= defaultfont
->tf_Message
.mn_Node
.ln_Name
;
259 textattr
.ta_YSize
= defaultfont
->tf_YSize
;
260 textattr
.ta_Style
= defaultfont
->tf_Style
;
261 textattr
.ta_Flags
= defaultfont
->tf_Flags
;
264 /*********************************************************************************************/
266 static void GetArguments(void)
269 if (!(myargs
= ReadArgs(ARG_TEMPLATE
, args
, NULL
)))
271 Fault(IoErr(), 0, s
, 256);
275 filename
= (STRPTR
)args
[ARG_FILE
];
276 if (!filename
&& !args
[ARG_CLIPBOARD
])
278 filename
= GetFileName(MSG_ASL_OPEN_TITLE
);
279 if (!filename
) Cleanup(NULL
);
282 if (args
[ARG_FONTNAME
])
284 strncpy(fontname
, (char *)args
[ARG_FONTNAME
], 255 - 5);
285 if (!strstr(fontname
, ".font")) strcat(fontname
, ".font");
287 textattr
.ta_Name
= fontname
;
290 if (args
[ARG_FONTSIZE
])
292 textattr
.ta_YSize
= *(LONG
*)args
[ARG_FONTSIZE
];
297 /*********************************************************************************************/
299 static void FreeArguments(void)
301 if (myargs
) FreeArgs(myargs
);
304 /*********************************************************************************************/
306 static void MakeICObjects(void)
308 static const struct TagItem dto_to_vert_map
[] =
310 {DTA_TopVert
, PGA_Top
},
311 {DTA_VisibleVert
, PGA_Visible
},
312 {DTA_TotalVert
, PGA_Total
},
315 static const struct TagItem dto_to_horiz_map
[] =
317 {DTA_TopHoriz
, PGA_Top
},
318 {DTA_VisibleHoriz
, PGA_Visible
},
319 {DTA_TotalHoriz
, PGA_Total
},
322 static const struct TagItem vert_to_dto_map
[] =
324 {PGA_Top
, DTA_TopVert
},
327 static const struct TagItem horiz_to_dto_map
[] =
329 {PGA_Top
, DTA_TopHoriz
},
333 model_obj
= NewObject(NULL
, MODELCLASS
, ICA_TARGET
, ICTARGET_IDCMP
,
335 dto_to_vert_ic_obj
= NewObject(NULL
, ICCLASS
, ICA_MAP
, (IPTR
)dto_to_vert_map
,
337 dto_to_horiz_ic_obj
= NewObject(NULL
, ICCLASS
, ICA_MAP
, (IPTR
)dto_to_horiz_map
,
339 vert_to_dto_ic_obj
= NewObject(NULL
, ICCLASS
, ICA_MAP
, (IPTR
)vert_to_dto_map
,
341 horiz_to_dto_ic_obj
= NewObject(NULL
, ICCLASS
, ICA_MAP
, (IPTR
)horiz_to_dto_map
,
344 model_to_dto_ic_obj
= NewObject(NULL
, ICCLASS
, TAG_DONE
);
348 !dto_to_vert_ic_obj
||
349 !dto_to_horiz_ic_obj
||
350 !vert_to_dto_ic_obj
||
353 || !model_to_dto_ic_obj
357 Cleanup(MSG(MSG_CANT_CREATE_IC
));
360 DoMethod(model_obj
, OM_ADDMEMBER
, (IPTR
) dto_to_vert_ic_obj
);
361 DoMethod(model_obj
, OM_ADDMEMBER
, (IPTR
) dto_to_horiz_ic_obj
);
363 DoMethod(model_obj
, OM_ADDMEMBER
, (IPTR
) model_to_dto_ic_obj
);
366 model_has_members
= TRUE
;
370 /*********************************************************************************************/
372 static void KillICObjects(void)
374 if (!model_has_members
)
376 if (dto_to_vert_ic_obj
) DisposeObject(dto_to_vert_ic_obj
);
377 if (dto_to_horiz_ic_obj
) DisposeObject(dto_to_horiz_ic_obj
);
379 if (model_to_dto_ic_obj
) DisposeObject(model_to_dto_ic_obj
);
383 if (model_obj
) DisposeObject(model_obj
);
384 if (vert_to_dto_ic_obj
) DisposeObject(vert_to_dto_ic_obj
);
385 if (horiz_to_dto_ic_obj
) DisposeObject(horiz_to_dto_ic_obj
);
388 /*********************************************************************************************/
390 static void GetVisual(void)
392 scr
= LockPubScreen((CONST_STRPTR
)args
[ARG_PUBSCREEN
]);
393 if (!scr
) Cleanup(MSG(MSG_CANT_LOCK_SCR
));
395 dri
= GetScreenDrawInfo(scr
);
396 if (!dri
) Cleanup(MSG(MSG_CANT_GET_DRI
));
398 vi
= GetVisualInfoA(scr
, NULL
);
399 if (!vi
) Cleanup(MSG(MSG_CANT_GET_VI
));
402 /*********************************************************************************************/
404 static void FreeVisual(void)
406 if (vi
) FreeVisualInfo(vi
);
407 if (dri
) FreeScreenDrawInfo(scr
, dri
);
408 if (scr
) UnlockPubScreen(NULL
, scr
);
411 /*********************************************************************************************/
413 static void MakeGadgets(void)
415 static WORD img2which
[] =
424 IPTR imagew
[NUM_IMAGES
], imageh
[NUM_IMAGES
];
425 WORD v_offset
, h_offset
, btop
, i
;
427 for(i
= 0; i
< NUM_IMAGES
; i
++)
429 img
[i
] = NewObject(NULL
, SYSICLASS
, SYSIA_DrawInfo
, (IPTR
)( dri
),
430 SYSIA_Which
, (IPTR
)( img2which
[i
] ),
433 if (!img
[i
]) Cleanup(MSG(MSG_CANT_CREATE_SYSIMAGE
));
435 GetAttr(IA_Width
,(Object
*)img
[i
],&imagew
[i
]);
436 GetAttr(IA_Height
,(Object
*)img
[i
],&imageh
[i
]);
439 sizeimagewidth
= imagew
[IMG_SIZE
];
440 sizeimageheight
= imageh
[IMG_SIZE
];
442 btop
= scr
->WBorTop
+ dri
->dri_Font
->tf_YSize
+ 1;
444 v_offset
= imagew
[IMG_DOWNARROW
] / 4;
445 h_offset
= imageh
[IMG_LEFTARROW
] / 4;
447 gad
[GAD_UPARROW
] = NewObject(NULL
, BUTTONGCLASS
,
448 GA_Image
, (IPTR
)( img
[IMG_UPARROW
] ),
449 GA_RelRight
, (IPTR
)( -imagew
[IMG_UPARROW
] + 1 ),
450 GA_RelBottom
, (IPTR
)( -imageh
[IMG_DOWNARROW
] - imageh
[IMG_UPARROW
] - imageh
[IMG_SIZE
] + 1 ),
451 GA_ID
, (IPTR
)( GAD_UPARROW
),
452 GA_RightBorder
, (IPTR
)TRUE
,
453 GA_Immediate
, (IPTR
)TRUE
,
454 GA_RelVerify
, (IPTR
)TRUE
,
457 gad
[GAD_DOWNARROW
] = NewObject(NULL
, BUTTONGCLASS
,
458 GA_Image
, (IPTR
)( img
[IMG_DOWNARROW
] ),
459 GA_RelRight
, (IPTR
)( -imagew
[IMG_UPARROW
] + 1 ),
460 GA_RelBottom
, (IPTR
)( -imageh
[IMG_UPARROW
] - imageh
[IMG_SIZE
] + 1 ),
461 GA_ID
, (IPTR
)( GAD_DOWNARROW
),
462 GA_RightBorder
, (IPTR
)TRUE
,
463 GA_Previous
, (IPTR
)( gad
[GAD_UPARROW
] ),
464 GA_Immediate
, (IPTR
)TRUE
,
465 GA_RelVerify
, (IPTR
)TRUE
,
468 gad
[GAD_VERTSCROLL
] = NewObject(NULL
, PROPGCLASS
,
469 GA_Top
, (IPTR
)( btop
+ 1 ),
470 GA_RelRight
, (IPTR
)( -imagew
[IMG_DOWNARROW
] + v_offset
+ 1 ),
471 GA_Width
, (IPTR
)( imagew
[IMG_DOWNARROW
] - v_offset
* 2 ),
472 GA_RelHeight
, (IPTR
)( -imageh
[IMG_DOWNARROW
] - imageh
[IMG_UPARROW
] - imageh
[IMG_SIZE
] - btop
-2 ),
473 GA_ID
, (IPTR
)( GAD_VERTSCROLL
),
474 GA_Previous
, (IPTR
)( gad
[GAD_DOWNARROW
] ),
475 GA_RightBorder
, (IPTR
)TRUE
,
476 GA_RelVerify
, (IPTR
)TRUE
,
477 GA_Immediate
, (IPTR
)TRUE
,
478 PGA_NewLook
, (IPTR
)TRUE
,
479 PGA_Borderless
, (IPTR
)TRUE
,
480 PGA_Total
, (IPTR
)100,
481 PGA_Visible
, (IPTR
)100,
482 PGA_Freedom
, (IPTR
)FREEVERT
,
483 PGA_NotifyBehaviour
, (IPTR
)PG_BEHAVIOUR_NICE
,
486 gad
[GAD_RIGHTARROW
] = NewObject(NULL
, BUTTONGCLASS
,
487 GA_Image
, (IPTR
)( img
[IMG_RIGHTARROW
] ),
488 GA_RelRight
, (IPTR
)( -imagew
[IMG_SIZE
] - imagew
[IMG_RIGHTARROW
] + 1 ),
489 GA_RelBottom
, (IPTR
)( -imageh
[IMG_RIGHTARROW
] + 1 ),
490 GA_ID
, (IPTR
)( GAD_RIGHTARROW
),
491 GA_BottomBorder
, (IPTR
)TRUE
,
492 GA_Previous
, (IPTR
)( gad
[GAD_VERTSCROLL
] ),
493 GA_Immediate
, (IPTR
)TRUE
,
494 GA_RelVerify
, (IPTR
)TRUE
,
497 gad
[GAD_LEFTARROW
] = NewObject(NULL
, BUTTONGCLASS
,
498 GA_Image
, (IPTR
)( img
[IMG_LEFTARROW
] ),
499 GA_RelRight
, (IPTR
)( -imagew
[IMG_SIZE
] - imagew
[IMG_RIGHTARROW
] - imagew
[IMG_LEFTARROW
] + 1 ),
500 GA_RelBottom
, (IPTR
)( -imageh
[IMG_RIGHTARROW
] + 1 ),
501 GA_ID
, (IPTR
)( GAD_LEFTARROW
),
502 GA_BottomBorder
, (IPTR
)TRUE
,
503 GA_Previous
, (IPTR
)( gad
[GAD_RIGHTARROW
] ),
504 GA_Immediate
, (IPTR
)TRUE
,
505 GA_RelVerify
, (IPTR
)TRUE
,
508 gad
[GAD_HORIZSCROLL
] = NewObject(NULL
, PROPGCLASS
,
509 GA_Left
, (IPTR
)( scr
->WBorLeft
),
510 GA_RelBottom
, (IPTR
)( -imageh
[IMG_LEFTARROW
] + h_offset
+ 1 ),
511 GA_RelWidth
, (IPTR
)( -imagew
[IMG_LEFTARROW
] - imagew
[IMG_RIGHTARROW
] - imagew
[IMG_SIZE
] - scr
->WBorRight
- 2 ),
512 GA_Height
, (IPTR
)( imageh
[IMG_LEFTARROW
] - (h_offset
* 2) ),
513 GA_ID
, (IPTR
)( GAD_HORIZSCROLL
),
514 GA_Previous
, (IPTR
)( gad
[GAD_LEFTARROW
] ),
515 GA_BottomBorder
, (IPTR
)TRUE
,
516 GA_RelVerify
, (IPTR
)TRUE
,
517 GA_Immediate
, (IPTR
)TRUE
,
518 PGA_NewLook
, (IPTR
)TRUE
,
519 PGA_Borderless
, (IPTR
)TRUE
,
520 PGA_Total
, (IPTR
)100,
521 PGA_Visible
, (IPTR
)100,
522 PGA_Freedom
, (IPTR
)FREEHORIZ
,
523 PGA_NotifyBehaviour
, (IPTR
)PG_BEHAVIOUR_NICE
,
526 for(i
= 0;i
< NUM_GADGETS
;i
++)
528 if (!gad
[i
]) Cleanup(MSG(MSG_CANT_CREATE_GADGET
));
531 SetAttrs(gad
[GAD_VERTSCROLL
] , ICA_TARGET
, (IPTR
)vert_to_dto_ic_obj
, TAG_DONE
);
532 SetAttrs(gad
[GAD_HORIZSCROLL
], ICA_TARGET
, (IPTR
)horiz_to_dto_ic_obj
, TAG_DONE
);
533 SetAttrs(dto_to_vert_ic_obj
, ICA_TARGET
, (IPTR
)gad
[GAD_VERTSCROLL
], TAG_DONE
);
534 SetAttrs(dto_to_horiz_ic_obj
, ICA_TARGET
, (IPTR
)gad
[GAD_HORIZSCROLL
], TAG_DONE
);
537 /*********************************************************************************************/
539 static void KillGadgets(void)
543 for(i
= 0; i
< NUM_GADGETS
;i
++)
545 if (win
) RemoveGadget(win
, (struct Gadget
*)gad
[i
]);
546 if (gad
[i
]) DisposeObject(gad
[i
]);
550 for(i
= 0; i
< NUM_IMAGES
;i
++)
552 if (img
[i
]) DisposeObject(img
[i
]);
557 /*********************************************************************************************/
559 void AddDTOToWin(void)
561 EraseRect(win
->RPort
, win
->BorderLeft
,
563 win
->Width
- 1 - win
->BorderRight
,
564 win
->Height
- 1 - win
->BorderBottom
);
566 SetDTAttrs (dto
, NULL
, NULL
, GA_Left
, win
->BorderLeft
+ 2 ,
567 GA_Top
, win
->BorderTop
+ 2 ,
568 GA_RelWidth
, - win
->BorderLeft
- win
->BorderRight
- 4 ,
569 GA_RelHeight
, - win
->BorderTop
- win
->BorderBottom
- 4 ,
572 AddDTObject(win
, NULL
, dto
, -1);
573 RefreshDTObjects(dto
, win
, NULL
, 0); // seems to be needed by text datatype to render more than first line at start...
576 /*********************************************************************************************/
578 static void OpenDTO(void)
580 struct DTMethod
*triggermethods
;
582 STRPTR objname
= NULL
;
590 if (!old_dto
&& args
[ARG_CLIPBOARD
])
594 if (args
[ARG_CLIPUNIT
]) clipunit
= *(APTR
*)args
[ARG_CLIPUNIT
];
596 D(bug("MultiView: calling NewDTObject\n"));
598 dto
= NewDTObject(clipunit
, ICA_TARGET
, (IPTR
)model_obj
,
600 DTA_SourceType
, DTST_CLIPBOARD
,
601 DTA_TextAttr
, (IPTR
)&textattr
,
604 D(bug("MultiView: NewDTObject returned %x\n", dto
));
608 dto
= NewDTObject(filename
, ICA_TARGET
, (IPTR
)model_obj
,
610 DTA_TextAttr
, (IPTR
)&textattr
,
616 ULONG errnum
= IoErr();
618 if (errnum
== DTERROR_UNKNOWN_DATATYPE
)
620 BPTR lock
= Lock(filename
,ACCESS_READ
);
623 struct DataType
*dtn
;
624 if ((dtn
= ObtainDataTypeA(DTST_FILE
, (APTR
)lock
, NULL
)))
626 if (!Stricmp(dtn
->dtn_Header
->dth_Name
, "directory"))
628 /* file is a directory and no directory.datatype is installed */
629 strncpy(filenamebuffer
, (filename
? filename
: (STRPTR
)""), 298);
630 filenamebuffer
[298]=0;
632 if (strlen(filenamebuffer
) &&
633 filenamebuffer
[strlen(filenamebuffer
)-1] != ':' &&
634 filenamebuffer
[strlen(filenamebuffer
)-1] != '/')
636 strcat(filenamebuffer
,"/");
639 filename
= GetFileName(MSG_ASL_OPEN_TITLE
);
640 if (filename
) continue;
642 ReleaseDataType(dtn
);
648 if (errnum
>= DTERROR_UNKNOWN_DATATYPE
)
649 __sprintf(s
, GetDTString(errnum
), filename
);
651 Fault(errnum
, 0, s
, 256);
655 /* Check if file is 0-length, fail silently (AOS confirmed) */
657 BPTR lock
= Lock(filename
, ACCESS_READ
);
660 struct FileInfoBlock
* fib
= AllocDosObject(DOS_FIB
, NULL
);
661 if (Examine(lock
, fib
))
663 if (fib
->fib_Size
== 0)
665 /* prog_exitcode = 20; */ /* ABIV1 Multiview no longer exits in Cleanup */
669 FreeDosObject(DOS_FIB
, fib
);
680 strncpy(filenamebuffer
, (filename
? filename
: (STRPTR
)""), 299);
682 SetAttrs(vert_to_dto_ic_obj
, ICA_TARGET
, (IPTR
)dto
, TAG_DONE
);
683 SetAttrs(horiz_to_dto_ic_obj
, ICA_TARGET
, (IPTR
)dto
, TAG_DONE
);
685 SetAttrs(model_to_dto_ic_obj
, ICA_TARGET
, (IPTR
)dto
, TAG_DONE
);
689 GetDTAttrs(dto
, DTA_NominalHoriz
, (IPTR
)&val
, TAG_DONE
);
690 pdt_origwidth
= winwidth
= (WORD
)val
;
691 GetDTAttrs(dto
, DTA_NominalVert
, (IPTR
)&val
, TAG_DONE
);
692 pdt_origheight
= winheight
= (WORD
)val
;
696 * Add 4 Pixels for border around DataType-Object
697 * See AddDTOToWin() for details
709 GetDTAttrs(dto
, DTA_ObjName
, (IPTR
)&objname
, TAG_DONE
);
710 strncpy(objnamebuffer
, objname
? objname
: filenamebuffer
, 299);
713 dto_subclass_gid
= 0;
714 if (GetDTAttrs(dto
, DTA_DataType
, (IPTR
)&dt
, TAG_DONE
))
718 dto_subclass_gid
= dt
->dtn_Header
->dth_GroupID
;
722 dto_supports_write
= FALSE
;
723 dto_supports_write_iff
= FALSE
;
724 dto_supports_print
= FALSE
;
725 dto_supports_copy
= FALSE
;
726 dto_supports_selectall
= FALSE
;
727 dto_supports_clearselected
= FALSE
;
729 if (DoWriteMethod(NULL
, DTWM_RAW
)) dto_supports_write
= TRUE
; /* probe raw saving */
730 if ((methods
= GetDTMethods(dto
)))
732 if (FindMethod(methods
, DTM_WRITE
)) dto_supports_write_iff
= TRUE
;
733 if (FindMethod(methods
, DTM_PRINT
)) dto_supports_print
= TRUE
;
734 if (FindMethod(methods
, DTM_COPY
)) dto_supports_copy
= TRUE
;
735 if (FindMethod(methods
, DTM_SELECT
)) dto_supports_selectall
= TRUE
;
736 if (FindMethod(methods
, DTM_CLEARSELECTED
)) dto_supports_clearselected
= TRUE
;
739 dto_supports_activate_field
= FALSE
;
740 dto_supports_next_field
= FALSE
;
741 dto_supports_prev_field
= FALSE
;
742 dto_supports_retrace
= FALSE
;
743 dto_supports_browse_next
= FALSE
;
744 dto_supports_browse_prev
= FALSE
;
745 dto_supports_search
= FALSE
;
746 dto_supports_search_next
= FALSE
;
747 dto_supports_search_prev
= FALSE
;
749 if ((triggermethods
= (struct DTMethod
*)GetDTTriggerMethods(dto
)))
751 if (FindTriggerMethod(triggermethods
, NULL
, STM_ACTIVATE_FIELD
)) dto_supports_activate_field
= TRUE
;
752 if (FindTriggerMethod(triggermethods
, NULL
, STM_NEXT_FIELD
)) dto_supports_next_field
= TRUE
;
753 if (FindTriggerMethod(triggermethods
, NULL
, STM_PREV_FIELD
)) dto_supports_prev_field
= TRUE
;
754 if (FindTriggerMethod(triggermethods
, NULL
, STM_RETRACE
)) dto_supports_retrace
= TRUE
;
755 if (FindTriggerMethod(triggermethods
, NULL
, STM_BROWSE_NEXT
)) dto_supports_browse_next
= TRUE
;
756 if (FindTriggerMethod(triggermethods
, NULL
, STM_BROWSE_PREV
)) dto_supports_browse_prev
= TRUE
;
757 if (FindTriggerMethod(triggermethods
, NULL
, STM_SEARCH
)) dto_supports_search
= TRUE
;
758 if (FindTriggerMethod(triggermethods
, NULL
, STM_SEARCH_NEXT
)) dto_supports_search_next
= TRUE
;
759 if (FindTriggerMethod(triggermethods
, NULL
, STM_SEARCH_PREV
)) dto_supports_search_prev
= TRUE
;
762 D(bug("\nMultiview: Found Methods:%s%s%s%s%s%s\n",
763 dto_supports_write
? " DTM_WRITE->RAW" : "",
764 dto_supports_write_iff
? " DTM_WRITE->IFF" : "",
765 dto_supports_print
? " DTM_PRINT" : "",
766 dto_supports_copy
? " DTM_COPY" : "",
767 dto_supports_selectall
? " DTM_SELECT" : "",
768 dto_supports_clearselected
? " DTM_CLEARSELECTED" : ""));
770 D(bug("Multiview: Found Triggers:%s%s%s%s%s%s%s\n\n",
771 dto_supports_activate_field
? " STM_ACTIVATE_FIELD" : "",
772 dto_supports_next_field
? " STM_NEXT_FIELD" : "",
773 dto_supports_prev_field
? " STM_PREV_FIELD" : "",
774 dto_supports_retrace
? " STM_RETRACE" : "",
775 dto_supports_browse_next
? " STM_BROWSE_NEXT" : "",
776 dto_supports_browse_prev
? " STM_BROWSE_PREV" : "",
777 dto_supports_search
? " STM_SEARCH" : "",
778 dto_supports_search_next
? " STM_SEARCH_NEXT" : "",
779 dto_supports_search_prev
? " STM_SEARCH_PREV" : ""));
783 if (win
) RemoveDTObject(win
, old_dto
);
784 DisposeDTObject(old_dto
);
789 SetWindowTitles(win
, objnamebuffer
, (UBYTE
*)~0);
792 // adopt object to current settings
793 if (dto_subclass_gid
== GID_TEXT
)
795 SetDTAttrs (dto
, NULL
, NULL
,
796 TDTA_WordWrap
, tdt_text_wordwrap
,
800 else if (dto_subclass_gid
== GID_PICTURE
)
802 // zoom has been set to 1 above
804 SetDTAttrs (dto
, NULL
, NULL
,
805 PDTA_DestMode
, (pdt_force_map
) ? PMODE_V42
: PMODE_V43
,
807 SetDTAttrs (dto
, NULL
, NULL
,
808 PDTA_DitherQuality
, pdt_pict_dither
? 4 : 0,
816 /*********************************************************************************************/
818 static void CloseDTO(void)
822 if (win
) RemoveDTObject(win
, dto
);
823 DisposeDTObject(dto
);
828 /*********************************************************************************************/
830 static void MakeWindow(void)
832 WORD minwidth
, minheight
;
834 winwidth
= winheight
= 0;
836 if (wincoords
.MinX
== 0)
837 wincoords
.MinX
= (- scr
->LeftEdge
);
838 if (wincoords
.MinY
== 0)
839 wincoords
.MinY
= ( (- scr
->TopEdge
) < (scr
->BarHeight
+ 1) ) ? (scr
->BarHeight
+ 1) : (- scr
->TopEdge
);
840 if (wincoords
.MaxX
== 0)
841 wincoords
.MaxX
= scr
->ViewPort
.DWidth
;
842 if (wincoords
.MaxY
== 0)
843 wincoords
.MaxY
= scr
->ViewPort
.DHeight
- scr
->BarHeight
- 1;
845 minwidth
= ( (winwidth
) && (winwidth
< 50) ) ? winwidth
: 50;
846 minheight
= ( (winheight
) && (winheight
< 50) ) ? winheight
: 50;
848 win
= OpenWindowTags(0, WA_PubScreen
, (IPTR
)scr
,
849 WA_Title
, (IPTR
)objnamebuffer
,
850 WA_CloseGadget
, TRUE
,
851 WA_DepthGadget
, TRUE
,
853 WA_SizeGadget
, TRUE
,
855 WA_SimpleRefresh
, TRUE
,
856 WA_NoCareRefresh
, TRUE
,
857 WA_NewLookMenus
, TRUE
,
858 WA_Left
, wincoords
.MinX
,
859 WA_Top
, wincoords
.MinY
,
860 ( winwidth
? WA_InnerWidth
862 ( winwidth
? winwidth
864 ( winheight
? WA_InnerHeight
866 ( winheight
? winheight
868 WA_AutoAdjust
, TRUE
,
869 WA_MinWidth
, minwidth
,
870 WA_MinHeight
, minheight
,
871 WA_MaxWidth
, 16383 ,
872 WA_MaxHeight
, 16383 ,
873 WA_Gadgets
, (IPTR
)gad
[GAD_UPARROW
],
874 WA_IDCMP
, IDCMP_CLOSEWINDOW
|
886 if (!win
) Cleanup(MSG(MSG_CANT_CREATE_WIN
));
890 SetMenuStrip(win
, menus
);
892 winmask
= 1L << win
->UserPort
->mp_SigBit
;
893 if (!(msgport
= CreateMsgPort()))
895 Cleanup(MSG(MSG_CANT_CREATE_MSGPORT
));
897 if (!(appwindow
= AddAppWindow(0, 0, win
, msgport
, NULL
)))
899 Cleanup(MSG(MSG_CANT_ADD_APPWINDOW
));
901 msgmask
= 1L << msgport
->mp_SigBit
;
904 /*********************************************************************************************/
906 static void KillWindow(void)
910 if (dto
) RemoveDTObject(win
, dto
);
911 if (menus
) ClearMenuStrip(win
);
915 winwidth
= winheight
= 0;
919 /*********************************************************************************************/
921 static void InitIScreenNotify(void)
923 if (!(isnport
= CreateMsgPort()))
925 Cleanup(MSG(MSG_CANT_CREATE_MSGPORT
));
927 if ( (isnstarted
= StartScreenNotifyTags(SNA_Notify
, SNOTIFY_WAIT_REPLY
|
928 SNOTIFY_BEFORE_CLOSEWB
|
929 SNOTIFY_AFTER_OPENWB
,
930 SNA_MsgPort
, isnport
,
934 isnmask
= 1L << isnport
->mp_SigBit
;
938 /************************************************************************************/
939 /* Handle Intuition's ScreenNotify signals */
941 static void HandleIScreenNotify(void)
943 struct ScreenNotifyMessage
*isnmsg
;
944 while ((isnmsg
= (struct ScreenNotifyMessage
*) GetMsg (isnport
)))
946 IPTR isnmclass
= isnmsg
->snm_Class
;
950 case SNOTIFY_BEFORE_CLOSEWB
:
951 D(bug("[Multiview] received isn before close WB msg\n"));
956 ReplyMsg ((struct Message
*) isnmsg
);
958 case SNOTIFY_AFTER_OPENWB
:
959 ReplyMsg ((struct Message
*) isnmsg
);
960 D(bug("[Multiview] received isn after open WB msg\n"));
967 ReplyMsg ((struct Message
*) isnmsg
);
968 D(bug("[Multiview] received unexpected msg!\n"));
974 /*********************************************************************************************/
976 static void ScrollTo(UWORD dir
, UWORD quali
)
979 LONG oldtop
, top
, total
, visible
, delta
= 1;
986 case RAWKEY_NM_WHEEL_UP
:
991 case RAWKEY_NM_WHEEL_DOWN
:
996 case RAWKEY_NM_WHEEL_LEFT
:
1001 case RAWKEY_NM_WHEEL_RIGHT
:
1008 if ((dir
== CURSORUP
) || (dir
== CURSORDOWN
))
1011 if (dir
== CURSORUP
) inc
= FALSE
; else inc
= TRUE
;
1013 GetDTAttrs(dto
, DTA_TopVert
, (IPTR
)&val
, TAG_DONE
);
1015 GetDTAttrs(dto
, DTA_TotalVert
, (IPTR
)&val
, TAG_DONE
);
1017 GetDTAttrs(dto
, DTA_VisibleVert
, (IPTR
)&val
, TAG_DONE
);
1018 visible
= (LONG
)val
;
1023 if (dir
== CURSORLEFT
) inc
= FALSE
; else inc
= TRUE
;
1025 GetDTAttrs(dto
, DTA_TopHoriz
, (IPTR
)&val
, TAG_DONE
);
1027 GetDTAttrs(dto
, DTA_TotalHoriz
, (IPTR
)&val
, TAG_DONE
);
1029 GetDTAttrs(dto
, DTA_VisibleHoriz
, (IPTR
)&val
, TAG_DONE
);
1030 visible
= (LONG
)val
;
1035 if (quali
& (IEQUALIFIER_LALT
| IEQUALIFIER_RALT
| IEQUALIFIER_CONTROL
))
1037 if (inc
) top
= total
; else top
= 0;
1040 if (quali
& (IEQUALIFIER_LSHIFT
| IEQUALIFIER_RSHIFT
))
1042 if (inc
) top
+= visible
- 1; else top
-= visible
- 1;
1046 if (inc
) top
+= delta
; else top
-= delta
;
1049 if (top
+ visible
> total
) top
= total
- visible
;
1050 if (top
< 0) top
= 0;
1058 g
= (struct Gadget
*)gad
[GAD_HORIZSCROLL
];
1062 g
= (struct Gadget
*)gad
[GAD_VERTSCROLL
];
1065 SetGadgetAttrs(g
, win
, NULL
, PGA_Top
, top
,
1069 /* Looks like setting PGA_Top on Amiga does not cause OM_NOTIFIEs
1070 to be sent (to dto). Or something like that. */
1072 SetDTAttrs(dto
, win
, NULL
, (horiz
? DTA_TopHoriz
: DTA_TopVert
), top
, TAG_DONE
);
1075 } /* if (top != oldtop) */
1079 /*********************************************************************************************/
1081 static void FitToWindow(void)
1087 x
= win
->Width
- (win
->BorderLeft
+ win
->BorderRight
+ 4);
1088 y
= win
->Height
- (win
->BorderTop
+ win
->BorderBottom
+ 4);
1089 D(bug("=> width %ld height %ld\n", x
, y
));
1090 DoScaleMethod(x
, y
, pdt_keep_aspect
);
1091 // DoLayout(TRUE); seems to be done by intuition ?
1095 /*********************************************************************************************/
1097 static void HandleAll(void)
1099 struct IntuiMessage
*msg
;
1100 struct TagItem
*tstate
, *tags
;
1101 struct TagItem
*tag
;
1102 struct MenuItem
*item
;
1103 struct Gadget
*activearrowgad
= NULL
;
1104 WORD arrowticker
= 0, activearrowkind
= 0;
1107 BOOL quitme
= FALSE
;
1108 const STRPTR not_supported
= "Sorry, not supported yet\n";
1113 // if ( (sigs & winmask) || (sigs & msgmask) )
1114 TEXT editorvarbuffer
[300];
1115 struct AppMessage
*appmsg
;
1117 sigs
= Wait(msgmask
| winmask
| isnmask
);
1121 HandleIScreenNotify();
1124 while ( (msgport
) && (appmsg
= (struct AppMessage
*) GetMsg(msgport
)) )
1126 if (appmsg
->am_Type
== AMTYPE_APPWINDOW
)
1128 if (appmsg
->am_NumArgs
>= 1)
1130 NameFromLock(appmsg
->am_ArgList
->wa_Lock
, filenamebuffer
, 299);
1131 AddPart(filenamebuffer
, appmsg
->am_ArgList
->wa_Name
, 299);
1132 filename
= filenamebuffer
;
1133 D(bug("[Multiview] appwindow received message: filename = %s\n", filename
));
1137 ReplyMsg ((struct Message
*) appmsg
);
1138 ActivateWindow(win
);
1146 } /* while ((appmsg = (struct AppMessage *) GetMsg(msgport))) */
1148 while( (win
) && (msg
= (struct IntuiMessage
*)GetMsg(win
->UserPort
)) )
1150 // D(if (msg->Class!=IDCMP_INTUITICKS) bug(" Msg Class %08lx\n", (long)msg->Class));
1153 case IDCMP_CLOSEWINDOW
:
1157 case IDCMP_VANILLAKEY
:
1158 D(bug("[Multiview] Vanillakey %d\n", (int)msg
->Code
));
1165 case 13: /* RETURN */
1166 if (dto_supports_activate_field
) DoTrigger(STM_ACTIVATE_FIELD
);
1167 else if (dto_supports_search
) DoTrigger(STM_SEARCH
);
1168 RefreshDTObjects (dto
, win
, NULL
, (IPTR
) NULL
);
1172 if (dto_supports_next_field
) DoTrigger(STM_NEXT_FIELD
);
1173 else if (dto_supports_search_next
) DoTrigger(STM_SEARCH_NEXT
);
1176 case 8: /* Backspace */
1177 if (dto_supports_retrace
) DoTrigger(STM_RETRACE
);
1178 else ScrollTo(CURSORUP
, IEQUALIFIER_LSHIFT
);
1182 ScrollTo(CURSORDOWN
, IEQUALIFIER_LSHIFT
);
1186 if (dto_supports_browse_next
) DoTrigger(STM_BROWSE_NEXT
);
1190 if (dto_supports_browse_prev
) DoTrigger(STM_BROWSE_PREV
);
1193 } /* switch(msg->Code) */
1194 if (strchr(MSG(MSG_SHORTCUT_EDITOR
), ToUpper(msg
->Code
)))
1196 if ( (GetVar("editor", (STRPTR
) editorvarbuffer
, 299, GVF_GLOBAL_ONLY
)) != -1L )
1198 __sprintf(s
, "Run QUIET \"%s\" \"%s\"", editorvarbuffer
, filename
);
1199 D(bug("[Multiview] editor command: '%s'\n", s
));
1200 if (SystemTags(s
, TAG_END
))
1210 case RAWKEY_NM_WHEEL_UP
:
1211 case RAWKEY_NM_WHEEL_DOWN
:
1212 case RAWKEY_NM_WHEEL_LEFT
:
1213 case RAWKEY_NM_WHEEL_RIGHT
:
1219 ScrollTo(msg
->Code
, msg
->Qualifier
);
1223 case RAWKEY_HOME
: /* HOME */
1224 ScrollTo(CURSORUP
, IEQUALIFIER_LALT
);
1227 case RAWKEY_END
: /* END */
1228 ScrollTo(CURSORDOWN
, IEQUALIFIER_LALT
);
1231 case RAWKEY_PAGEUP
: /* PAGE UP */
1232 ScrollTo(CURSORUP
, IEQUALIFIER_LSHIFT
);
1235 case RAWKEY_PAGEDOWN
: /* PAGE DOWN */
1236 ScrollTo(CURSORDOWN
, IEQUALIFIER_LSHIFT
);
1240 case 0x42: /* SHIFT TAB? */
1241 if (msg
->Qualifier
& (IEQUALIFIER_LSHIFT
| IEQUALIFIER_RSHIFT
))
1243 if (dto_supports_prev_field
) DoTrigger(STM_PREV_FIELD
);
1244 else if (dto_supports_search_prev
) DoTrigger(STM_SEARCH_PREV
);
1248 } /* switch(msg->Code) */
1251 case IDCMP_GADGETDOWN
:
1253 activearrowgad
= (struct Gadget
*)msg
->IAddress
;
1254 switch(activearrowgad
->GadgetID
)
1257 activearrowkind
= CURSORUP
;
1258 ScrollTo(CURSORUP
, 0);
1262 activearrowkind
= CURSORDOWN
;
1263 ScrollTo(CURSORDOWN
, 0);
1267 activearrowkind
= CURSORLEFT
;
1268 ScrollTo(CURSORLEFT
, 0);
1271 case GAD_RIGHTARROW
:
1272 activearrowkind
= CURSORRIGHT
;
1273 ScrollTo(CURSORRIGHT
, 0);
1277 activearrowkind
= 0;
1283 case IDCMP_INTUITICKS
:
1284 if (activearrowkind
)
1290 else if (activearrowgad
->Flags
& GFLG_SELECTED
)
1292 ScrollTo(activearrowkind
, 0);
1297 case IDCMP_GADGETUP
:
1298 switch(((struct Gadget
*)msg
->IAddress
)->GadgetID
)
1303 case GAD_RIGHTARROW
:
1304 activearrowkind
= 0;
1309 case IDCMP_MENUPICK
:
1311 // D(bug(" * MV: men %08lx\n", (long)men));
1312 while(men
!= MENUNULL
)
1314 if ((item
= ItemAddress(menus
, men
)))
1316 // D(bug(" * MV: item %08lx menus %08lx\n", (long)item, (long)menus));
1317 switch((IPTR
)GTMENUITEM_USERDATA(item
))
1319 case MSG_MEN_PROJECT_OPEN
:
1320 filename
= GetFileName(MSG_ASL_OPEN_TITLE
);
1321 if (filename
) OpenDTO();
1324 case MSG_MEN_PROJECT_SAVEAS
:
1325 filename
= GetFileName(MSG_ASL_SAVE_TITLE
);
1326 if (filename
) DoWriteMethod(filename
, DTWM_RAW
);
1329 case MSG_MEN_PROJECT_SAVEAS_IFF
:
1330 filename
= GetFileName(MSG_ASL_SAVE_TITLE
);
1331 if (filename
) DoWriteMethod(filename
, DTWM_IFF
);
1334 case MSG_MEN_PROJECT_PRINT
:
1338 case MSG_MEN_PROJECT_ABOUT
:
1342 case MSG_MEN_PROJECT_QUIT
:
1346 case MSG_MEN_EDIT_MARK
:
1347 #if defined(__AROS__) && !defined(__MORPHOS__)
1348 if (StartDragSelect(dto
))
1351 struct DTSpecialInfo
*si
;
1354 ** ClipView example on AmigaDev CD does just the following.
1355 ** None of the checks AROS datatypes.library/StartDragSelect()
1359 si
= (struct DTSpecialInfo
*)(((struct Gadget
*)dto
)->SpecialInfo
);
1360 si
->si_Flags
|= DTSIF_DRAGSELECT
;
1364 //TODO: change mouse pointer to crosshair
1368 case MSG_MEN_EDIT_COPY
:
1370 struct dtGeneral dtg
;
1372 dtg
.MethodID
= DTM_COPY
;
1373 dtg
.dtg_GInfo
= NULL
;
1375 DoDTMethodA(dto
, win
, NULL
, (Msg
)&dtg
);
1379 case MSG_MEN_EDIT_SELECTALL
:
1380 OutputMessage(not_supported
);
1383 case MSG_MEN_EDIT_CLEARSELECTED
:
1385 struct dtGeneral dtg
;
1387 dtg
.MethodID
= DTM_CLEARSELECTED
;
1388 dtg
.dtg_GInfo
= NULL
;
1390 DoDTMethodA(dto
, win
, NULL
, (Msg
)&dtg
);
1394 case MSG_MEN_WINDOW_SEPSCREEN
:
1395 OutputMessage(not_supported
);
1398 case MSG_MEN_WINDOW_MINIMIZE
:
1399 OutputMessage(not_supported
);
1402 case MSG_MEN_WINDOW_NORMAL
:
1403 OutputMessage(not_supported
);
1406 case MSG_MEN_WINDOW_MAXIMIZE
:
1407 OutputMessage(not_supported
);
1410 case MSG_MEN_SETTINGS_SAVEDEF
:
1411 OutputMessage(not_supported
);
1414 case MSG_MEN_PICT_ZOOM_IN
:
1416 if (pdt_zoom
== -1 ) pdt_zoom
= 1;
1420 case MSG_MEN_PICT_ZOOM_OUT
:
1422 if (pdt_zoom
== 0 ) pdt_zoom
= -2;
1426 case MSG_MEN_PICT_RESET
:
1431 case MSG_MEN_PICT_FIT_WIN
:
1432 pdt_fit_win
= (item
->Flags
& CHECKED
) ? TRUE
: FALSE
;
1437 case MSG_MEN_PICT_KEEP_ASPECT
:
1438 pdt_keep_aspect
= (item
->Flags
& CHECKED
) ? TRUE
: FALSE
;
1443 case MSG_MEN_PICT_FORCE_MAP
:
1444 pdt_force_map
= (item
->Flags
& CHECKED
) ? TRUE
: FALSE
;
1445 SetDTAttrs (dto
, NULL
, NULL
,
1446 PDTA_DestMode
, (pdt_force_map
) ? PMODE_V42
: PMODE_V43
,
1451 case MSG_MEN_PICT_DITHER
:
1452 pdt_pict_dither
= (item
->Flags
& CHECKED
) ? TRUE
: FALSE
;
1453 SetDTAttrs (dto
, NULL
, NULL
,
1454 PDTA_DitherQuality
, pdt_pict_dither
? 4 : 0,
1459 case MSG_MEN_TEXT_WORDWRAP
:
1460 tdt_text_wordwrap
= (item
->Flags
& CHECKED
) ? TRUE
: FALSE
;
1462 if (tdt_text_wordwrap
)
1463 bug("wordwrap enabled\n");
1465 bug("wordwrap disabled\n");
1467 SetDTAttrs (dto
, NULL
, NULL
,
1468 TDTA_WordWrap
, tdt_text_wordwrap
,
1473 case MSG_MEN_TEXT_SEARCH
:
1474 if (dto_supports_search
) DoTrigger(STM_SEARCH
);
1477 case MSG_MEN_TEXT_SEARCH_PREV
:
1478 if (dto_supports_search_prev
) DoTrigger(STM_SEARCH_PREV
);
1481 case MSG_MEN_TEXT_SEARCH_NEXT
:
1482 if (dto_supports_search_next
) DoTrigger(STM_SEARCH_NEXT
);
1485 } /* switch(GTMENUITEM_USERDATA(item)) */
1487 men
= item
->NextSelect
;
1494 } /* while(men != MENUNULL) */
1498 D(bug("IDCMP NEWSIZE\n"));
1502 case IDCMP_IDCMPUPDATE
:
1503 tstate
= tags
= (struct TagItem
*) msg
->IAddress
;
1504 while ((tag
= NextTagItem(&tstate
)) != NULL
)
1506 tidata
= tag
->ti_Data
;
1507 // D(bug("IDCMP UPDATE %08lx %08lx\n", (long)tag->ti_Tag, (long)tag->ti_Data));
1508 switch (tag
->ti_Tag
)
1510 /* Change in busy state */
1513 SetWindowPointer (win
, WA_BusyPointer
, TRUE
, TAG_DONE
);
1515 SetWindowPointer (win
, WA_Pointer
, (IPTR
) NULL
, TAG_DONE
);
1519 SetWindowTitles(win
, (UBYTE
*)tidata
, (UBYTE
*)~0);
1523 case DTA_ErrorLevel
:
1526 errnum = GetTagData (DTA_ErrorNumber, NULL, tags);
1527 PrintErrorMsg (errnum, (STRPTR) options[OPT_NAME]);
1531 /* Time to refresh */
1533 /* Refresh the DataType object */
1534 D(bug("Multiview: DTA_SYNC\n"));
1535 RefreshDTObjects (dto
, win
, NULL
, (IPTR
) NULL
);
1538 } /* switch (tag->ti_Tag) */
1540 } /* while ((tag = NextTagItem ((const struct TagItem **)&tstate))) */
1543 } /* switch (msg->Class) */
1545 ReplyMsg((struct Message
*)msg
);
1547 } /* while((msg = (struct IntuiMessage *)GetMsg(win->UserPort))) */
1549 } /* while (!quitme) */
1552 /*********************************************************************************************/
1562 menus
= MakeMenus(nm
);
1563 pictmenus
= MakeMenus(nmpict
);
1564 textmenus
= MakeMenus(nmtext
);
1567 SetDTAttrs (dto
, NULL
, NULL
,
1568 PDTA_DestMode
, (pdt_force_map
) ? PMODE_V42
: PMODE_V43
,
1569 PDTA_DitherQuality
, (pdt_pict_dither
) ? 4 : 0,
1570 TDTA_WordWrap
, tdt_text_wordwrap
,
1575 /*********************************************************************************************/
1577 int main(int argc
, char **argv
)
1581 /* This is for when Cleanup() is called */
1582 rc
= setjmp(exit_buf
);
1591 pdt_fit_win
= FALSE
;
1592 pdt_keep_aspect
= FALSE
;
1593 pdt_force_map
= FALSE
;
1594 pdt_pict_dither
= TRUE
;
1595 tdt_text_wordwrap
= TRUE
;
1596 separate_screen
= FALSE
;
1598 InitLocale("System/Utilities/MultiView.catalog", 2);
1606 struct WBStartup
*startup
= (struct WBStartup
*) argv
;
1608 if (startup
->sm_NumArgs
>= 2)
1610 /* FIXME: all arguments but the first are ignored */
1611 cd
= CurrentDir(startup
->sm_ArgList
[1].wa_Lock
);
1612 filename
= startup
->sm_ArgList
[1].wa_Name
;
1616 filename
= GetFileName(MSG_ASL_OPEN_TITLE
);
1617 if (!filename
) Cleanup(NULL
);
1625 InitIScreenNotify();
1634 /*********************************************************************************************/