2 Copyright © 1995-1997 Stefan Stuntz.
3 Copyright © 2009, The AROS Development Team.
11 #define _WBenchMsg WBenchMsg
13 #define BETWEEN(a,x,b) ((x)>=(a) && (x)<=(b))
17 static const char VersionString
[] = "$VER: PSI 20.0 (14.04.2009)";
21 /****************************************************************************/
23 /****************************************************************************/
27 struct Library
*MUIScreenBase
;
28 struct Library
*MUIMasterBase
;
30 struct Catalog
*Catalog
;
32 struct MUI_CustomClass
*CL_EditWindow
;
33 struct MUI_CustomClass
*CL_EditPanel
;
34 struct MUI_CustomClass
*CL_SysPenField
;
35 struct MUI_CustomClass
*CL_DispIDlist
;
36 struct MUI_CustomClass
*CL_DispIDinfo
;
37 struct MUI_CustomClass
*CL_ScreenList
;
38 struct MUI_CustomClass
*CL_ScreenPanel
;
39 struct MUI_CustomClass
*CL_MainWindow
;
41 #define TG CHECKIT|MENUTOGGLE
43 enum { MEN_OPEN
=1,MEN_APPEND
,MEN_SAVEAS
,MEN_ABOUT
,MEN_QUIT
,MEN_LASTSAVED
,MEN_RESTORE
,MEN_MUI
};
44 struct NewMenu MainMenu
[] =
46 { NM_TITLE
, (STRPTR
)MSG_MENU_PROJECT
, 0 ,0,0,(APTR
)0 },
47 { NM_ITEM
, (STRPTR
)MSG_MENU_PROJECT_OPEN
,"O",0,0,(APTR
)MEN_OPEN
},
48 { NM_ITEM
, (STRPTR
)MSG_MENU_PROJECT_APPEND
,"P",0,0,(APTR
)MEN_APPEND
},
49 { NM_ITEM
, (STRPTR
)MSG_MENU_PROJECT_SAVEAS
,"A",0,0,(APTR
)MEN_SAVEAS
},
50 { NM_ITEM
, (STRPTR
)NM_BARLABEL
, 0 ,0,0,(APTR
)0 },
51 { NM_ITEM
, (STRPTR
)MSG_MENU_PROJECT_ABOUT
,"?",0,0,(APTR
)MEN_ABOUT
},
52 { NM_ITEM
, (STRPTR
)NM_BARLABEL
, 0 ,0,0,(APTR
)0 },
53 { NM_ITEM
, (STRPTR
)MSG_MENU_PROJECT_QUIT
,"Q",0,0,(APTR
)MEN_QUIT
},
55 { NM_TITLE
, (STRPTR
)MSG_MENU_EDIT
, 0 ,0,0,(APTR
)0 },
56 { NM_ITEM
, (STRPTR
)MSG_MENU_EDIT_LASTSAVED
,"L",0,0,(APTR
)MEN_LASTSAVED
},
57 { NM_ITEM
, (STRPTR
)MSG_MENU_EDIT_RESTORE
,"R",0,0,(APTR
)MEN_RESTORE
},
59 { NM_TITLE
, (STRPTR
)MSG_MENU_SETTINGS
, 0 ,0,0,(APTR
)0 },
60 { NM_ITEM
, (STRPTR
)MSG_MENU_SETTINGS_MUI
, 0 ,0,0,(APTR
)MEN_MUI
},
62 { NM_END
,NULL
,0,0,0,(APTR
)0 },
65 struct NewMenu PaletteMenu
[] =
67 { NM_TITLE
, (STRPTR
)MSG_PALPRES_TITLE
, 0 , 0,0,(APTR
)0 },
68 { NM_ITEM
, (STRPTR
)MSG_PALPRES_CLONEWB
, 0,0,0,(APTR
)10},
69 { NM_ITEM
, (STRPTR
)NM_BARLABEL
, 0,0,0,(APTR
)0 },
70 { NM_ITEM
, (STRPTR
)MSG_PALPRES_MAGICWB
, 0,0,0,(APTR
)9 },
71 { NM_ITEM
, (STRPTR
)NM_BARLABEL
, 0,0,0,(APTR
)0 },
72 { NM_ITEM
, (STRPTR
)MSG_PALPRES_STANDARD
, 0,0,0,(APTR
)0 },
73 { NM_ITEM
, (STRPTR
)MSG_PALPRES_TINT
, 0,0,0,(APTR
)1 },
74 { NM_ITEM
, (STRPTR
)MSG_PALPRES_PHARAO
, 0,0,0,(APTR
)2 },
75 { NM_ITEM
, (STRPTR
)MSG_PALPRES_SUNSET
, 0,0,0,(APTR
)3 },
76 { NM_ITEM
, (STRPTR
)MSG_PALPRES_OCEAN
, 0,0,0,(APTR
)4 },
77 { NM_ITEM
, (STRPTR
)MSG_PALPRES_STEEL
, 0,0,0,(APTR
)5 },
78 { NM_ITEM
, (STRPTR
)MSG_PALPRES_CHOCOLATE
, 0,0,0,(APTR
)6 },
79 { NM_ITEM
, (STRPTR
)MSG_PALPRES_PEWTER
, 0,0,0,(APTR
)7 },
80 { NM_ITEM
, (STRPTR
)MSG_PALPRES_WINE
, 0,0,0,(APTR
)8 },
82 { NM_END
,NULL
,0,0,0,(APTR
)0 },
85 char *CYA_EditPages
[] =
87 (char *)MSG_EDITPAGE_ATTRIBUTES
,
88 (char *)MSG_EDITPAGE_DISPLAY
,
89 (char *)MSG_EDITPAGE_COLORS
,
93 char *CYA_Overscan
[] =
95 (char *)MSG_OVERSCAN_TEXT
,
96 (char *)MSG_OVERSCAN_GRAPHICS
,
97 (char *)MSG_OVERSCAN_EXTREME
,
98 (char *)MSG_OVERSCAN_MAXIMUM
,
103 /****************************************************************************/
105 /****************************************************************************/
107 char *GetStr(int num
)
109 struct CatCompArrayType
*cca
= (struct CatCompArrayType
*)CatCompArray
;
110 while (cca
->cca_ID
!= num
) cca
++;
111 if (LocaleBase
) return(GetCatalogStr(Catalog
,num
,cca
->cca_Str
));
112 return((char *)cca
->cca_Str
);
115 VOID
LocalizeStringArray(char **array
)
119 *x
= GetStr((int)*x
);
122 VOID
LocalizeNewMenu(struct NewMenu
*nm
)
124 for (;nm
->nm_Type
!=NM_END
;nm
++)
125 if (nm
->nm_Label
!= NM_BARLABEL
)
126 nm
->nm_Label
= GetStr((int)nm
->nm_Label
);
129 VOID
InitLocale(VOID
)
131 if (LocaleBase
= OpenLibrary("locale.library",38))
132 Catalog
= OpenCatalog(NULL
,"psi.catalog",OC_Version
,VERSION
,TAG_DONE
);
134 LocalizeNewMenu(MainMenu
);
135 LocalizeNewMenu(PaletteMenu
);
136 /*LocalizeNewMenu(EditMenu);*/
137 LocalizeStringArray(CYA_Overscan
);
138 LocalizeStringArray(CYA_EditPages
);
141 VOID
ExitLocale(VOID
)
143 if (Catalog
) { CloseCatalog(Catalog
); Catalog
=NULL
; }
144 if (LocaleBase
) CloseLibrary(LocaleBase
); { LocaleBase
=NULL
; }
149 /****************************************************************************/
150 /* Misc Help Functions */
151 /****************************************************************************/
153 IPTR
xget(Object
*obj
,IPTR attribute
)
156 get(obj
,attribute
,&x
);
160 char *getstr(Object
*obj
)
162 return((char *)xget(obj
,MUIA_String_Contents
));
165 BOOL
getbool(Object
*obj
)
167 return((BOOL
)xget(obj
,MUIA_Selected
));
170 VOID
setstr(APTR str
,LONG num
)
172 DoMethod(str
,MUIM_SetAsString
,MUIA_String_Contents
,"%ld",num
);
175 VOID
settxt(APTR str
,LONG num
)
177 DoMethod(str
,MUIM_SetAsString
,MUIA_Text_Contents
,"%ld",num
);
180 Object
*MakeCheck(int num
)
182 Object
*obj
= MUI_MakeObject(MUIO_Checkmark
,GetStr(num
));
183 if (obj
) set(obj
,MUIA_CycleChain
,1);
187 Object
*MakeButton(int num
)
189 Object
*obj
= MUI_MakeObject(MUIO_Button
,GetStr(num
));
190 if (obj
) set(obj
,MUIA_CycleChain
,1);
195 Object *MakeBackground(int num)
199 obj = MUI_NewObject(MUIC_Popimage,
200 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Background,
201 MUIA_Window_Title, "Adjust Screen Background",
209 Object
*MakeString(int maxlen
,int num
)
211 Object
*obj
= MUI_MakeObject(MUIO_String
,GetStr(num
),maxlen
);
217 MUIA_String_AdvanceOnCR
,TRUE
,
224 Object
*MakeCycle(char **array
,int num
)
226 Object
*obj
= MUI_MakeObject(MUIO_Cycle
,GetStr(num
),array
);
227 if (obj
) set(obj
,MUIA_CycleChain
,1);
231 Object
*MakeSlider(int min
,int max
,int num
)
233 Object
*obj
= MUI_MakeObject(MUIO_Slider
,GetStr(num
),min
,max
);
234 if (obj
) set(obj
,MUIA_CycleChain
,1);
239 static Object
*MakeCLabel(int num
) { return(MUI_MakeObject(MUIO_Label
,GetStr(num
),MUIO_Label_Centered
)); }
241 Object
*MakeLabel (int num
) { return(MUI_MakeObject(MUIO_Label
,GetStr(num
),0)); }
242 Object
*MakeLabel1 (int num
) { return(MUI_MakeObject(MUIO_Label
,GetStr(num
),MUIO_Label_SingleFrame
)); }
243 Object
*MakeLabel2 (int num
) { return(MUI_MakeObject(MUIO_Label
,GetStr(num
),MUIO_Label_DoubleFrame
)); }
244 Object
*MakeLLabel (int num
) { return(MUI_MakeObject(MUIO_Label
,GetStr(num
),MUIO_Label_LeftAligned
)); }
245 Object
*MakeLLabel1 (int num
) { return(MUI_MakeObject(MUIO_Label
,GetStr(num
),MUIO_Label_LeftAligned
|MUIO_Label_SingleFrame
)); }
246 Object
*MakeFreeLabel(int num
) { return(MUI_MakeObject(MUIO_Label
,GetStr(num
),MUIO_Label_FreeVert
)); }
247 Object
*MakeFreeLLabel(int num
) { return(MUI_MakeObject(MUIO_Label
,GetStr(num
),MUIO_Label_FreeVert
|MUIO_Label_LeftAligned
)); }
249 BOOL
TestPubScreen(char *name
)
252 struct PubScreenNode
*psn
,*succ
;
254 pslist
= LockPubScreenList();
255 ForEntries(pslist
,psn
,succ
)
257 if (!stricmp(psn
->psn_Node
.ln_Name
,name
))
263 UnlockPubScreenList();
268 /****************************************************************************/
269 /* DisplayIDinfo class */
270 /****************************************************************************/
272 struct DispIDinfo_Data
274 Object
*TX_Visible
[2];
275 Object
*TX_Minimum
[2];
276 Object
*TX_Maximum
[2];
277 Object
*TX_BitsPerGun
;
278 Object
*TX_NumColors
;
283 Object
*MakeMoni(LONG w
,LONG h
,LONG d
,const UBYTE
*body
,const ULONG
*colors
)
285 Object
*obj
= BodychunkObject
,
288 MUIA_Bitmap_Width
, w
,
289 MUIA_Bitmap_Height
, h
,
290 MUIA_Bodychunk_Depth
, d
,
291 MUIA_Bodychunk_Body
, (UBYTE
*)body
,
292 MUIA_Bodychunk_Compression
, PSI_COLORS_COMPRESSION
,
293 MUIA_Bodychunk_Masking
, PSI_COLORS_MASKING
,
294 MUIA_Bitmap_SourceColors
, (ULONG
*)colors
,
295 MUIA_Bitmap_Transparent
, 0,
300 Object
*MakeSize(void)
302 Object
*obj
= TextObject
,
303 MUIA_Text_Contents
, "0",
304 MUIA_Text_PreParse
, "\33r",
305 MUIA_FixWidthTxt
, "00000",
310 ULONG
DispIDinfo_New(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
312 Object
*TX_Visible
[2];
313 Object
*TX_Minimum
[2];
314 Object
*TX_Maximum
[2];
315 Object
*TX_BitsPerGun
;
316 Object
*TX_NumColors
;
321 obj
= (Object
*)DoSuperNewTags(cl
,obj
,NULL
,
322 MUIA_Group_Columns
, 2,
323 Child
, g1
= MakeMoni(PSI_SIZES_WIDTH
,PSI_SIZES_HEIGHT
,PSI_SIZES_DEPTH
,psi_sizes_body
,psi_sizes_colors
),
324 Child
, ColGroup(4), MUIA_Group_VertSpacing
, 0, MUIA_Group_HorizSpacing
, 4,
325 Child
, MakeLabel(MSG_LABEL_VISIBLE
), Child
, TX_Visible
[0]=MakeSize(), Child
, Label("x"), Child
, TX_Visible
[1]=MakeSize(),
326 Child
, MakeLabel(MSG_LABEL_MINIMUM
), Child
, TX_Minimum
[0]=MakeSize(), Child
, Label("x"), Child
, TX_Minimum
[1]=MakeSize(),
327 Child
, MakeLabel(MSG_LABEL_MAXIMUM
), Child
, TX_Maximum
[0]=MakeSize(), Child
, Label("x"), Child
, TX_Maximum
[1]=MakeSize(),
329 Child
, g2
= MakeMoni(PSI_COLORS_WIDTH
,PSI_COLORS_HEIGHT
,PSI_COLORS_DEPTH
,psi_colors_body
,psi_sizes_colors
),
330 Child
, ColGroup(2), MUIA_Group_VertSpacing
, 0, MUIA_Group_HorizSpacing
, 4,
331 Child
, MakeLabel(MSG_LABEL_BITSPERGUN
), Child
, TX_BitsPerGun
= TextObject
, End
,
332 Child
, MakeLabel(MSG_LABEL_MAXIMUM
), Child
, TX_NumColors
= TextObject
, End
,
334 Child
, g3
= MakeMoni(PSI_FREQS_WIDTH
,PSI_FREQS_HEIGHT
,PSI_FREQS_DEPTH
,psi_freqs_body
,psi_sizes_colors
),
335 Child
, ColGroup(2), MUIA_Group_VertSpacing
, 0, MUIA_Group_HorizSpacing
, 4,
336 Child
, MakeLabel(MSG_LABEL_SCANRATE
), Child
, TX_ScanRate
= TextObject
, End
,
337 Child
, MakeLabel(MSG_LABEL_SCANLINE
), Child
, TX_ScanLine
= TextObject
, End
,
339 TAG_MORE
,msg
->ops_AttrList
);
343 struct DispIDinfo_Data
*data
= INST_DATA(cl
,obj
);
346 set(g1,MUIA_VertDisappear,3);
347 set(g2,MUIA_VertDisappear,2);
348 set(g3,MUIA_VertDisappear,1);
351 data
->TX_Visible
[0] = TX_Visible
[0];
352 data
->TX_Visible
[1] = TX_Visible
[1];
353 data
->TX_Minimum
[0] = TX_Minimum
[0];
354 data
->TX_Minimum
[1] = TX_Minimum
[1];
355 data
->TX_Maximum
[0] = TX_Maximum
[0];
356 data
->TX_Maximum
[1] = TX_Maximum
[1];
357 data
->TX_BitsPerGun
= TX_BitsPerGun
;
358 data
->TX_NumColors
= TX_NumColors
;
359 data
->TX_ScanRate
= TX_ScanRate
;
360 data
->TX_ScanLine
= TX_ScanLine
;
368 ULONG
DispIDinfo_Set(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
370 #define offset(a,b) (((ULONG)b)-(((ULONG)a)))
371 struct DispIDinfo_Data
*data
= INST_DATA(cl
,obj
);
374 if (tag
= FindTagItem(MUIA_DispIDinfo_ID
,msg
->ops_AttrList
))
376 struct DisplayInfo dis
;
377 struct DimensionInfo dim
;
378 struct MonitorInfo mon
;
383 set(data
->TX_Visible
[0],MUIA_String_Contents
,"");
384 set(data
->TX_Visible
[1],MUIA_String_Contents
,"");
385 set(data
->TX_Minimum
[0],MUIA_String_Contents
,"");
386 set(data
->TX_Minimum
[1],MUIA_String_Contents
,"");
387 set(data
->TX_Maximum
[0],MUIA_String_Contents
,"");
388 set(data
->TX_Maximum
[1],MUIA_String_Contents
,"");
389 set(data
->TX_BitsPerGun
,MUIA_String_Contents
,"");
390 set(data
->TX_NumColors
,MUIA_String_Contents
,"");
391 set(data
->TX_ScanRate
,MUIA_String_Contents
,"");
392 set(data
->TX_ScanLine
,MUIA_String_Contents
,"");
394 dislen
= GetDisplayInfoData(0,(char *)&dis
,sizeof(struct DisplayInfo
),DTAG_DISP
,tag
->ti_Data
);
395 dimlen
= GetDisplayInfoData(0,(char *)&dim
,sizeof(struct DimensionInfo
),DTAG_DIMS
,tag
->ti_Data
);
396 monlen
= GetDisplayInfoData(0,(char *)&mon
,sizeof(struct MonitorInfo
),DTAG_MNTR
,tag
->ti_Data
);
398 if (dimlen
>offset(&dim
,&dim
.MaxOScan
))
400 settxt(data
->TX_Visible
[0],RectangleWidth (dim
.MaxOScan
));
401 settxt(data
->TX_Visible
[1],RectangleHeight(dim
.MaxOScan
));
402 settxt(data
->TX_Minimum
[0],dim
.MinRasterWidth
);
403 settxt(data
->TX_Minimum
[1],dim
.MinRasterHeight
);
404 settxt(data
->TX_Maximum
[0],dim
.MaxRasterWidth
);
405 settxt(data
->TX_Maximum
[1],dim
.MaxRasterHeight
);
406 settxt(data
->TX_NumColors
,1<<dim
.MaxDepth
);
409 if (dislen
>offset(&dis
,&dis
.BlueBits
))
411 DoMethod(data
->TX_BitsPerGun
,MUIM_SetAsString
,MUIA_Text_Contents
,"%ld x %ld x %ld",dis
.RedBits
,dis
.GreenBits
,dis
.BlueBits
);
414 if (monlen
>offset(&mon
,&mon
.TotalColorClocks
))
416 /* These calculations were taken from ScreenManager by Bernhard "ZZA" Moellemann. Thanks! */
420 ULONG vfreqint
=1000000000L/((ULONG
)mon
.TotalColorClocks
*280*mon
.TotalRows
/1000)+5;
421 DoMethod(data
->TX_ScanRate
,MUIM_SetAsString
,MUIA_Text_Contents
,"%ld.%02ld Hz",vfreqint
/1000,(vfreqint
-(vfreqint
/1000)*1000)/10);
423 if (mon
.TotalColorClocks
)
425 ULONG hfreq
=1000000000L/((ULONG
)mon
.TotalColorClocks
*280)+5;
426 ULONG hfreqint
=hfreq
/1000;
427 DoMethod(data
->TX_ScanLine
,MUIM_SetAsString
,MUIA_Text_Contents
,"%ld.%02ld kHz",hfreqint
,(hfreq
-hfreqint
*1000)/10);
432 return(DoSuperMethodA(cl
,obj
,msg
));
435 BOOPSI_DISPATCHER(IPTR
, DispIDinfo_Dispatcher
, cl
, obj
, msg
)
437 switch (msg
->MethodID
)
439 case OM_NEW
: return(DispIDinfo_New(cl
,obj
,(APTR
)msg
));
440 case OM_SET
: return(DispIDinfo_Set(cl
,obj
,(APTR
)msg
));
442 return(DoSuperMethodA(cl
,obj
,msg
));
444 BOOPSI_DISPATCHER_END
448 /****************************************************************************/
449 /* DisplayIDlist class */
450 /****************************************************************************/
452 struct DispIDlist_Data
455 struct Hook ConstructHook
;
456 struct Hook DisplayHook
;
459 IPTR
DispIDlist_DisplayFunc(struct Hook
*hook
, char **array
, struct NameInfo
*ni
)
465 IPTR
DispIDlist_CompareFunc(struct Hook
*hook
, struct NameInfo
*n1
, struct NameInfo
*n2
)
467 return(stricmp(n1
->Name
,n2
->Name
));
470 VOID
DispIDlist_DestructFunc(struct Hook
*hook
, APTR pool
, struct NameInfo
*ni
)
475 IPTR
DispIDlist_ConstructFunc(struct Hook
*hook
, APTR pool
, ULONG modeid
)
478 struct NameInfo NameInfo
;
479 struct DisplayInfo DisplayInfo
;
480 struct DimensionInfo DimensionInfo
;
483 if ((modeid
& MONITOR_ID_MASK
)==DEFAULT_MONITOR_ID
) return(NULL
);
484 if (!(handle
= FindDisplayInfo(modeid
))) return(NULL
);
485 if (!GetDisplayInfoData(handle
,(char *)&NameInfo
,sizeof(struct NameInfo
),DTAG_NAME
,0)) return(NULL
);
486 if (!GetDisplayInfoData(handle
,(char *)&DisplayInfo
,sizeof(struct DisplayInfo
),DTAG_DISP
,0)) return(NULL
);
487 if (!GetDisplayInfoData(handle
,(char *)&DimensionInfo
,sizeof(struct DimensionInfo
),DTAG_DIMS
,0)) return(NULL
);
488 if (!(DisplayInfo
.PropertyFlags
& DIPF_IS_WB
)) return(NULL
);
489 if (DisplayInfo
.NotAvailable
) return(NULL
);
490 if (!(ni
= AllocVec(sizeof(struct NameInfo
),MEMF_ANY
))) return(NULL
);
496 ULONG
DispIDlist_New(struct IClass
*cl
,Object
*obj
,Msg msg
)
498 static struct Hook ConstructHook
;
499 ConstructHook
.h_Entry
= HookEntry
;
500 ConstructHook
.h_SubEntry
= DispIDlist_ConstructFunc
;
501 static struct Hook DestructHook
;
502 DestructHook
.h_Entry
= HookEntry
;
503 DestructHook
.h_SubEntry
= DispIDlist_DestructFunc
;
504 static struct Hook CompareHook
;
505 CompareHook
.h_Entry
= HookEntry
;
506 CompareHook
.h_SubEntry
= DispIDlist_CompareFunc
;
507 static struct Hook DisplayHook
;
508 DisplayHook
.h_Entry
= HookEntry
;
509 DisplayHook
.h_SubEntry
= DispIDlist_DisplayFunc
;
510 LONG id
= INVALID_ID
;
512 if (!(obj
=(Object
*)DoSuperMethodA(cl
,obj
,msg
)))
515 SetSuperAttrs(cl
,obj
,
516 MUIA_List_ConstructHook
, &ConstructHook
,
517 MUIA_List_DestructHook
, &DestructHook
,
518 MUIA_List_CompareHook
, &CompareHook
,
519 MUIA_List_DisplayHook
, &DisplayHook
,
520 MUIA_List_AutoVisible
, TRUE
,
523 while ((id
=NextDisplayInfo(id
))!=INVALID_ID
)
524 DoMethod(obj
,MUIM_List_InsertSingle
,id
,MUIV_List_Insert_Bottom
);
526 DoMethod(obj
,MUIM_List_Sort
);
528 DoMethod(obj
,MUIM_Notify
,MUIA_List_Active
,MUIV_EveryTime
,obj
,1,MUIM_DispIDlist_Change
);
533 ULONG
DispIDlist_Set(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
535 struct DispIDlist_Data
*data
= INST_DATA(cl
,obj
);
536 struct TagItem
*tag
,*quiet
;
538 quiet
= FindTagItem(MUIA_DispIDlist_Quiet
,msg
->ops_AttrList
);
540 if (tag
= FindTagItem(MUIA_DispIDlist_CurrentID
,msg
->ops_AttrList
))
542 data
->CurrentID
= tag
->ti_Data
;
554 DoMethod(obj
,MUIM_List_GetEntry
,i
,&ni
);
556 if ((ni
->Header
.DisplayID
& ~mask
)==(data
->CurrentID
& ~mask
)) { mask
= MONITOR_ID_MASK
; break; }
559 if (mask
==MONITOR_ID_MASK
) break;
560 mask
= MONITOR_ID_MASK
;
564 set(obj
,MUIA_List_Active
,i
);
566 set(obj
,MUIA_List_Active
,MUIV_List_Active_Off
);
569 return(DoSuperMethodA(cl
,obj
,msg
));
572 ULONG
DispIDlist_Get(struct IClass
*cl
,Object
*obj
,struct opGet
*msg
)
574 struct DispIDlist_Data
*data
= INST_DATA(cl
,obj
);
576 switch (msg
->opg_AttrID
)
578 case MUIA_DispIDlist_CurrentID
:
579 *(msg
->opg_Storage
) = data
->CurrentID
;
583 return(DoSuperMethodA(cl
,obj
,msg
));
586 ULONG
DispIDlist_Change(struct IClass
*cl
,Object
*obj
,Msg msg
)
589 DoMethod(obj
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&ni
);
591 MUIA_DispIDlist_Quiet
,TRUE
,
592 MUIA_DispIDlist_CurrentID
,ni
? ni
->Header
.DisplayID
: INVALID_ID
,
597 BOOPSI_DISPATCHER(IPTR
, DispIDlist_Dispatcher
, cl
, obj
, msg
)
599 switch (msg
->MethodID
)
601 case OM_NEW
: return(DispIDlist_New(cl
,obj
,(APTR
)msg
));
602 case OM_SET
: return(DispIDlist_Set(cl
,obj
,(APTR
)msg
));
603 case OM_GET
: return(DispIDlist_Get(cl
,obj
,(APTR
)msg
));
604 case MUIM_DispIDlist_Change
: return(DispIDlist_Change(cl
,obj
,(APTR
)msg
));
606 return(DoSuperMethodA(cl
,obj
,msg
));
608 BOOPSI_DISPATCHER_END
612 /****************************************************************************/
613 /* SysPenField class */
614 /****************************************************************************/
616 struct SysPenField_Data
622 ULONG
SysPenField_DragQuery(struct IClass
*cl
,Object
*obj
,struct MUIP_DragQuery
*msg
)
625 return(MUIV_DragQuery_Refuse
);
627 if (muiUserData(msg
->obj
)<1 || muiUserData(msg
->obj
)>8)
628 return(MUIV_DragQuery_Refuse
);
630 return(MUIV_DragQuery_Accept
);
635 ULONG
SysPenField_DragDrop(struct IClass
*cl
,Object
*obj
,struct MUIP_DragDrop
*msg
)
637 set(obj
,MUIA_Pendisplay_Reference
,msg
->obj
);
642 BOOPSI_DISPATCHER(IPTR
, SysPenField_Dispatcher
, cl
, obj
, msg
)
644 switch (msg
->MethodID
)
646 case MUIM_DragQuery
: return(SysPenField_DragQuery (cl
,obj
,(APTR
)msg
));
647 case MUIM_DragDrop
: return(SysPenField_DragDrop (cl
,obj
,(APTR
)msg
));
649 return(DoSuperMethodA(cl
,obj
,msg
));
651 BOOPSI_DISPATCHER_END
655 static Object
*MakePalette(void)
659 obj
= MUI_NewObject(MUIC_Poppen
,
661 MUIA_Window_Title
, "Adjust Color",
662 MUIA_Penadjust_PSIMode
, 2,
670 Object
*MakeMUIPen(int nr
,Object
**adr
)
674 obj
= VGroup
, MUIA_Group_Spacing
, 1,
675 Child
, *adr
= MUI_NewObject(MUIC_Poppen
,
677 MUIA_Window_Title
, "Adjust MUI Pen",
678 MUIA_Penadjust_PSIMode
, 1,
682 MUIA_Text_Contents
, GetStr(nr
),
683 MUIA_Text_PreParse
, "\33c",
684 MUIA_Font
, MUIV_Font_Tiny
,
692 Object
*MakeSysPen(int nr
,Object
**adr
)
696 obj
= VGroup
, MUIA_Group_Spacing
, 1,
697 Child
, *adr
= NewObject(CL_SysPenField
->mcc_Class
,NULL
,
699 MUIA_Background
, MUII_BACKGROUND
,
706 MUIA_Font
, MUIV_Font_Tiny
,
707 MUIA_Text_Contents
, GetStr(nr
),
708 MUIA_Text_PreParse
, "\33c",
718 /****************************************************************************/
719 /* EditPanel class */
720 /****************************************************************************/
722 #define ForChilds(group) \
725 struct MinList *list;\
726 get(group,MUIA_Group_ChildList,&list);\
727 cstate=list->mlh_Head;\
728 while (child=NextObject(&cstate))
732 struct EditPanel_Data
736 Object *CM_Adjustable;
739 Object
*GR_EditPages
;
744 Object
*ST_Background
;
745 Object
*CM_AutoScroll
;
747 Object
*CM_Exclusive
;
748 Object
*CM_Interleaved
;
750 Object
*CM_SysDefault
;
751 Object
*CM_AutoClose
;
752 Object
*CM_CloseGadget
;
763 Object
*palette
[PSD_NUMCOLS
];
764 Object
*syspens
[PSD_NUMSYSPENS
];
765 /*Object *muipens[PSD_NUMMUIPENS];*/
772 ULONG
EditPanel_SetScreen(struct IClass
*cl
,Object
*obj
,struct MUIP_EditPanel_SetScreen
*msg
)
774 struct EditPanel_Data
*data
= INST_DATA(cl
,obj
);
775 struct MUI_PubScreenDesc
*desc
= msg
->desc
;
778 set(data
->ST_Name
,MUIA_String_Contents
,desc
->Name
);
779 set(data
->ST_Title
,MUIA_String_Contents
,desc
->Title
);
780 set(data
->ST_Font
,MUIA_String_Contents
,desc
->Font
);
781 set(data
->ST_Background
,MUIA_String_Contents
,desc
->Background
);
784 set(data->CM_Adjustable ,MUIA_Selected ,!desc->Foreign );
786 set(data
->CM_AutoScroll
,MUIA_Selected
,desc
->AutoScroll
);
787 set(data
->CM_NoDrag
,MUIA_Selected
,desc
->NoDrag
);
788 set(data
->CM_Exclusive
,MUIA_Selected
,desc
->Exclusive
);
789 set(data
->CM_Interleaved
,MUIA_Selected
,desc
->Interleaved
);
790 set(data
->CM_SysDefault
,MUIA_Selected
,desc
->SysDefault
);
791 set(data
->CM_Behind
,MUIA_Selected
,desc
->Behind
);
792 set(data
->CM_AutoClose
,MUIA_Selected
,desc
->AutoClose
);
793 set(data
->CM_CloseGadget
,MUIA_Selected
,desc
->CloseGadget
);
795 set(data
->LI_Modes
,MUIA_DispIDlist_CurrentID
,desc
->DisplayID
);
797 setstr(data
->ST_Width
,desc
->DisplayWidth
);
798 setstr(data
->ST_Height
,desc
->DisplayHeight
);
799 set(data
->SL_Depth
,MUIA_Slider_Level
,desc
->DisplayDepth
);
800 set(data
->CY_Overscan
,MUIA_Cycle_Active
,desc
->OverscanType
);
802 for (i
=0;i
<PSD_NUMCOLS
;i
++)
804 set(data
->palette
[i
],MUIA_Pendisplay_RGBcolor
,&desc
->Palette
[i
]);
808 for (i=0;i<PSD_NUMMUIPENS;i++)
810 set(data->muipens[i],MUIA_Pendisplay_Spec,&desc->MUIPens[i]);
814 for (i
=0;i
<PSD_NUMSYSPENS
;i
++)
816 if (data
->syspens
[i
])
818 BYTE p
= desc
->SystemPens
[i
];
819 p
= BETWEEN(0,p
,3) ? p
: BETWEEN(-4,p
,-1) ? 8+p
: 0;
820 set(data
->syspens
[i
],MUIA_Pendisplay_Reference
,data
->palette
[p
]);
828 ULONG
EditPanel_GetScreen(struct IClass
*cl
,Object
*obj
,struct MUIP_EditPanel_GetScreen
*msg
)
830 struct EditPanel_Data
*data
= INST_DATA(cl
,obj
);
831 struct MUI_PubScreenDesc
*desc
= msg
->desc
;
834 strcpy(desc
->Name
,getstr(data
->ST_Name
));
835 strcpy(desc
->Title
,getstr(data
->ST_Title
));
836 strcpy(desc
->Font
,getstr(data
->ST_Font
));
837 strcpy(desc
->Background
,getstr(data
->ST_Background
));
840 desc->Foreign = !getbool(data->CM_Adjustable );
842 desc
->AutoScroll
= getbool(data
->CM_AutoScroll
);
843 desc
->NoDrag
= getbool(data
->CM_NoDrag
);
844 desc
->Exclusive
= getbool(data
->CM_Exclusive
);
845 desc
->Interleaved
= getbool(data
->CM_Interleaved
);
846 desc
->SysDefault
= getbool(data
->CM_SysDefault
);
847 desc
->Behind
= getbool(data
->CM_Behind
);
848 desc
->AutoClose
= getbool(data
->CM_AutoClose
);
849 desc
->CloseGadget
= getbool(data
->CM_CloseGadget
);
851 desc
->DisplayID
= xget(data
->LI_Modes
,MUIA_DispIDlist_CurrentID
);
852 desc
->DisplayWidth
= atol(getstr(data
->ST_Width
));
853 desc
->DisplayHeight
= atol(getstr(data
->ST_Height
));
855 desc
->DisplayDepth
= xget(data
->SL_Depth
,MUIA_Slider_Level
);
856 desc
->OverscanType
= xget(data
->CY_Overscan
,MUIA_Cycle_Active
);
858 for (i
=0;i
<PSD_NUMCOLS
;i
++)
860 desc
->Palette
[i
] = *((struct MUI_RGBcolor
*)xget(data
->palette
[i
],MUIA_Pendisplay_RGBcolor
));
864 for (i=0;i<PSD_NUMMUIPENS;i++)
866 desc->MUIPens[i] = *((struct MUI_PenSpec *)xget(data->muipens[i],MUIA_Pendisplay_Spec));
870 for (i
=0;i
<PSD_NUMSYSPENS
;i
++)
872 if (data
->syspens
[i
])
874 BYTE p
= muiUserData(xget(data
->syspens
[i
],MUIA_Pendisplay_Reference
));
875 desc
->SystemPens
[i
] = BETWEEN(1,p
,4) ? p
-1 : p
-9;
883 ULONG
EditPanel_ContextMenuChoice(struct IClass
*cl
,Object
*obj
,struct MUIP_ContextMenuChoice
*msg
)
887 struct MUI_RGBcolor col
[8];
890 static const struct PalettePreset PalettePreset
[10] =
895 { 0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA },
896 { 0x00000000,0x00000000,0x00000000 },
897 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
898 { 0x66666666,0x88888888,0xBBBBBBBB },
899 { 0xEEEEEEEE,0x44444444,0x44444444 },
900 { 0x55555555,0xDDDDDDDD,0x55555555 },
901 { 0x00000000,0x44444444,0xDDDDDDDD },
902 { 0xEEEEEEEE,0x99999999,0x00000000 },
908 { 0xCCCCCCCC,0xCCCCCCCC,0xBBBBBBBB },
909 { 0x00000000,0x00000000,0x33333333 },
910 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
911 { 0x99999999,0xAAAAAAAA,0xBBBBBBBB },
912 { 0xEEEEEEEE,0x44444444,0x44444444 },
913 { 0x55555555,0xDDDDDDDD,0x55555555 },
914 { 0xE0E0E0E0,0xF0F0F0F0,0x88888888 },
915 { 0x00000000,0x44444444,0xDDDDDDDD },
921 { 0x55555555,0xBBBBBBBB,0xAAAAAAAA },
922 { 0x00000000,0x00000000,0x22222222 },
923 { 0xEEEEEEEE,0xEEEEEEEE,0xFFFFFFFF },
924 { 0x55555555,0x77777777,0xAAAAAAAA },
925 { 0xF6F6F6F6,0xF6F6F6F6,0x00000000 },
926 { 0x62626262,0x51515151,0xF0F0F0F0 },
927 { 0x00000000,0xF0F0F0F0,0x00000000 },
928 { 0xF0F0F0F0,0x30303030,0x10101010 },
934 { 0xAAAAAAAA,0x99999999,0x88888888 },
935 { 0x33333333,0x22222222,0x11111111 },
936 { 0xFFFFFFFF,0xEEEEEEEE,0xEEEEEEEE },
937 { 0xFFFFFFFF,0xDDDDDDDD,0xBBBBBBBB },
938 { 0xEEEEEEEE,0x44444444,0x44444444 },
939 { 0x55555555,0xDDDDDDDD,0x55555555 },
940 { 0xCFCFCFCF,0xDBDBDBDB,0xFFFFFFFF },
941 { 0x00000000,0x44444444,0xDDDDDDDD },
947 { 0x88888888,0xAAAAAAAA,0xCCCCCCCC },
948 { 0x00000000,0x00000000,0x22222222 },
949 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
950 { 0xFFFFFFFF,0xCCCCCCCC,0x99999999 },
951 { 0x00000000,0x00000000,0xF0F0F0F0 },
952 { 0xF9F9F9F9,0x21212121,0x21212121 },
953 { 0x52525252,0xF2F2F2F2,0x76767676 },
954 { 0xDFDFDFDF,0xA5A5A5A5,0x26262626 },
960 { 0x99999999,0xBBBBBBBB,0xDDDDDDDD },
961 { 0x00000000,0x00000000,0x22222222 },
962 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
963 { 0x66666666,0x88888888,0xBBBBBBBB },
964 { 0xB2B2B2B2,0xDEDEDEDE,0xFFFFFFFF },
965 { 0xFFFFFFFF,0xA1A1A1A1,0x1C1C1C1C },
966 { 0xF0F0F0F0,0x44444444,0x87878787 },
967 { 0xBFBFBFBF,0xFFFFFFFF,0x90909090 },
973 { 0xBBBBBBBB,0xAAAAAAAA,0x99999999 },
974 { 0x00000000,0x00000000,0x22222222 },
975 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
976 { 0x66666666,0x88888888,0xBBBBBBBB },
977 { 0xEEEEEEEE,0x44444444,0x44444444 },
978 { 0x55555555,0xDDDDDDDD,0x55555555 },
979 { 0x00000000,0x44444444,0xDDDDDDDD },
980 { 0xEEEEEEEE,0x99999999,0x00000000 },
986 { 0x88888888,0xAAAAAAAA,0xCCCCCCCC },
987 { 0x00000000,0x00000000,0x22222222 },
988 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
989 { 0xEEEEEEEE,0x99999999,0x77777777 },
990 { 0xD9D9D9D9,0xFFFFFFFF,0x09090909 },
991 { 0xF0F0F0F0,0x2D2D2D2D,0x31313131 },
992 { 0x38383838,0xF2F2F2F2,0x38383838 },
993 { 0x44444444,0x49494949,0xF0F0F0F0 },
999 { 0xCCCCCCCC,0x99999999,0x99999999 },
1000 { 0x00000000,0x00000000,0x22222222 },
1001 { 0xFFFFFFFF,0xEEEEEEEE,0xEEEEEEEE },
1002 { 0xBBBBBBBB,0x66666666,0x77777777 },
1003 { 0xE0E0E0E0,0xF0F0F0F0,0x88888888 },
1004 { 0x79797979,0x46464646,0xE8E8E8E8 },
1005 { 0x60606060,0xC7C7C7C7,0x52525252 },
1006 { 0x89898989,0xEAEAEAEA,0xC8C8C8C8 },
1012 { 0x95959595,0x95959595,0x95959595 },
1013 { 0x00000000,0x00000000,0x00000000 },
1014 { 0xffffffff,0xffffffff,0xffffffff },
1015 { 0x3b3b3b3b,0x67676767,0xa2a2a2a2 },
1016 { 0x7b7b7b7b,0x7b7b7b7b,0x7b7b7b7b },
1017 { 0xafafafaf,0xafafafaf,0xafafafaf },
1018 { 0xaaaaaaaa,0x90909090,0x7c7c7c7c },
1019 { 0xffffffff,0xa9a9a9a9,0x97979797 },
1023 /*{ 0, 1, 1, 2, 1, 3, 1, 0, 2, 1, 2, 1 }*/
1025 LONG i
= muiUserData(msg
->item
);
1026 struct MUI_PubScreenDesc
*desc
= NULL
;
1027 struct MUI_RGBcolor
*new = NULL
;
1028 struct EditPanel_Data
*data
= INST_DATA(cl
,obj
);
1032 new = (struct MUI_RGBcolor
*)PalettePreset
[i
].col
;
1036 if (desc
= MUIS_AllocPubScreenDesc(NULL
))
1038 new = desc
->Palette
;
1044 for (i
=0;i
<PSD_NUMCOLS
;i
++)
1046 set(data
->palette
[i
],MUIA_Pendisplay_RGBcolor
,&new[i
]);
1051 MUIS_FreePubScreenDesc(desc
);
1057 ULONG
EditPanel_New(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
1059 struct EditPanel_Data tmp
= {0};
1062 obj
= (Object
*)DoSuperNewTags(cl
,obj
,NULL
,
1063 MUIA_Group_Horiz
, FALSE
,
1065 MUIA_ContextMenu
, tmp
.ColorMenu
= MUI_MakeObject(MUIO_MenustripNM
,PaletteMenu
,MUIO_MenustripNM_CommandKeyCheck
),
1068 Child, HGroup, GroupSpacing(1),
1071 Child
, tmp
.TX_Info
= TextObject
,TextFrame
,MUIA_Background
,MUII_TextBack
,MUIA_Text_PreParse
,"\33c",End
,
1073 Child, tmp.CM_Adjustable = MUI_MakeObject(MUIO_Checkmark,NULL),
1077 Child
, tmp
.GR_EditPages
= RegisterGroup(CYA_EditPages
),
1081 Child
, MakeLabel2(MSG_LABEL_PUBLICNAME
),
1082 Child
, tmp
.ST_Name
= MUI_NewObject(MUIC_Popscreen
,
1083 MUIA_Popstring_String
, MakeString(PSD_MAXLEN_NAME
,MSG_LABEL_PUBLICNAME
),
1084 MUIA_Popstring_Button
, PopButton(MUII_PopUp
),
1086 Child
, MakeLabel2(MSG_LABEL_SCREENTITLE
), Child
, tmp
.ST_Title
= MakeString(PSD_MAXLEN_TITLE
,MSG_LABEL_SCREENTITLE
),
1087 Child
, MakeLabel2(MSG_LABEL_DEFAULTFONT
), Child
, tmp
.ST_Font
= PopaslObject
, MUIA_Popstring_String
, MakeString(PSD_MAXLEN_FONT
,MSG_LABEL_DEFAULTFONT
), MUIA_Popstring_Button
, PopButton(MUII_PopUp
), MUIA_Popasl_Type
, ASL_FontRequest
, End
,
1088 Child
, MakeLabel2(MSG_LABEL_BACKGROUND
), Child
, tmp
.ST_Background
= PopaslObject
, MUIA_Popstring_String
, MakeString(PSD_MAXLEN_BACKGROUND
,MSG_LABEL_BACKGROUND
), MUIA_Popstring_Button
, PopButton(MUII_PopUp
), MUIA_Popasl_Type
, ASL_FileRequest
, End
,
1089 Child
, VSpace(2), Child
, VSpace(2),
1090 Child
, MakeFreeLabel(MSG_LABEL_PUBLICFLAGS
),
1093 Child
, tmp
.CM_AutoScroll
= MakeCheck(MSG_LABEL_AUTOSCROLL
), Child
, MakeLLabel1(MSG_LABEL_AUTOSCROLL
),
1094 Child
, tmp
.CM_NoDrag
= MakeCheck(MSG_LABEL_NODRAG
), Child
, MakeLLabel1(MSG_LABEL_NODRAG
),
1095 Child
, tmp
.CM_Exclusive
= MakeCheck(MSG_LABEL_EXCLUSIVE
), Child
, MakeLLabel1(MSG_LABEL_EXCLUSIVE
),
1099 Child
, tmp
.CM_AutoClose
= MakeCheck(MSG_LABEL_AUTOCLOSE
), Child
, MakeLLabel1(MSG_LABEL_AUTOCLOSE
),
1100 Child
, tmp
.CM_Interleaved
= MakeCheck(MSG_LABEL_INTERLEAVED
), Child
, MakeLLabel1(MSG_LABEL_INTERLEAVED
),
1101 Child
, tmp
.CM_Behind
= MakeCheck(MSG_LABEL_OPENBEHIND
), Child
, MakeLLabel1(MSG_LABEL_OPENBEHIND
),
1105 Child
, tmp
.CM_SysDefault
= MakeCheck(MSG_LABEL_SYSTEMDEFAULT
), Child
, MakeLLabel1(MSG_LABEL_SYSTEMDEFAULT
),
1106 Child
, tmp
.CM_CloseGadget
= MakeCheck(MSG_LABEL_CLOSEGADGET
), Child
, MakeLLabel1(MSG_LABEL_CLOSEGADGET
),
1107 Child
, VSpace(0), Child
, VSpace(0),
1113 Child
, tmp
.LV_Modes
= ListviewObject
,
1115 MUIA_Listview_List
, tmp
.LI_Modes
= NewObject(CL_DispIDlist
->mcc_Class
,NULL
,
1117 MUIA_List_AdjustWidth
, TRUE
,
1121 Child
, ScrollgroupObject
,
1122 MUIA_Scrollgroup_FreeHoriz
, FALSE
,
1123 MUIA_Scrollgroup_Contents
, VirtgroupObject
,
1126 MUIA_Group_Horiz
, TRUE
,
1127 Child
, tmp
.TX_ModeInfo
= NewObject(CL_DispIDinfo
->mcc_Class
,NULL
,TAG_DONE
),
1131 Child
, RectangleObject
, MUIA_VertWeight
, 1, End
,
1132 Child
, tmp
.GR_Size
= ColGroup(2),
1133 Child
, MakeLabel1(MSG_LABEL_OVERSCAN
), Child
, tmp
.CY_Overscan
= MakeCycle(CYA_Overscan
,MSG_LABEL_OVERSCAN
),
1134 Child
, MakeLabel2(MSG_LABEL_SIZE
),
1136 Child
, tmp
.ST_Width
= MakeString(8,MSG_LABEL_SIZE
),
1137 Child
, MakeLabel2(MSG_LABEL_CROSS
),
1138 Child
, tmp
.ST_Height
= MakeString(8,MSG_LABEL_CROSS
),
1140 Child
, MakeLabel2(MSG_LABEL_DEPTH
), Child
, tmp
.SL_Depth
= MakeSlider(1,24,MSG_LABEL_DEPTH
),
1147 GroupFrameT(GetStr(MSG_PALETTE_TITLE
)),
1148 MUIA_Group_VertSpacing
, 1,
1149 Child
, l1
= MakeCLabel(MSG_PALETTE_FIRST
),
1151 Child
, l2
= MakeCLabel(MSG_PALETTE_LAST
),
1153 Child
, tmp
.palette
[0] = MakePalette(),
1154 Child
, tmp
.palette
[1] = MakePalette(),
1155 Child
, tmp
.palette
[2] = MakePalette(),
1156 Child
, tmp
.palette
[3] = MakePalette(),
1160 Child
, tmp
.palette
[4] = MakePalette(),
1161 Child
, tmp
.palette
[5] = MakePalette(),
1162 Child
, tmp
.palette
[6] = MakePalette(),
1163 Child
, tmp
.palette
[7] = MakePalette(),
1168 GroupFrameT(GetStr(MSG_SYSPENS_TITLE
)),
1169 Child
, MakeSysPen(MSG_SYSPEN_TEXT
,&tmp
.syspens
[TEXTPEN
]),
1170 Child
, MakeSysPen(MSG_SYSPEN_SHINE
,&tmp
.syspens
[SHINEPEN
]),
1171 Child
, MakeSysPen(MSG_SYSPEN_SHADOW
,&tmp
.syspens
[SHADOWPEN
]),
1172 Child
, MakeSysPen(MSG_SYSPEN_FILL
,&tmp
.syspens
[FILLPEN
]),
1173 Child
, MakeSysPen(MSG_SYSPEN_FILLTEXT
,&tmp
.syspens
[FILLTEXTPEN
]),
1174 Child
, MakeSysPen(MSG_SYSPEN_HIGHLIGHT
,&tmp
.syspens
[HIGHLIGHTTEXTPEN
]),
1175 Child
, MakeSysPen(MSG_SYSPEN_BARDETAIL
,&tmp
.syspens
[BARDETAILPEN
]),
1176 Child
, MakeSysPen(MSG_SYSPEN_BARBLOCK
,&tmp
.syspens
[BARBLOCKPEN
]),
1177 Child
, MakeSysPen(MSG_SYSPEN_BARTRIM
,&tmp
.syspens
[BARTRIMPEN
]),
1181 GroupFrameT(GetStr(MSG_MUIPENS_TITLE)),
1183 Child, MakeMUIPen(MSG_MUIPEN_SHINE ,&tmp.muipens[MPEN_SHINE ]),
1184 Child, MakeMUIPen(MSG_MUIPEN_HALFSHINE ,&tmp.muipens[MPEN_HALFSHINE ]),
1185 Child, MakeMUIPen(MSG_MUIPEN_BACKGROUND,&tmp.muipens[MPEN_BACKGROUND]),
1186 Child, MakeMUIPen(MSG_MUIPEN_HALFSHADOW,&tmp.muipens[MPEN_HALFSHADOW]),
1187 Child, MakeMUIPen(MSG_MUIPEN_SHADOW ,&tmp.muipens[MPEN_SHADOW ]),
1188 Child, MakeMUIPen(MSG_MUIPEN_TEXT ,&tmp.muipens[MPEN_TEXT ]),
1189 Child, MakeMUIPen(MSG_MUIPEN_FILL ,&tmp.muipens[MPEN_FILL ]),
1190 Child, MakeMUIPen(MSG_MUIPEN_MARK ,&tmp.muipens[MPEN_MARK ]),
1198 TAG_MORE
,msg
->ops_AttrList
);
1202 struct EditPanel_Data
*data
= INST_DATA(cl
,obj
);
1207 DoMethod(tmp
.LI_Modes
,MUIM_Notify
,MUIA_DispIDlist_CurrentID
,MUIV_EveryTime
,obj
,2,MUIM_EditPanel_Update
,3);
1208 DoMethod(tmp
.CY_Overscan
,MUIM_Notify
,MUIA_Cycle_Active
,MUIV_EveryTime
,obj
,2,MUIM_EditPanel_Update
,2);
1209 DoMethod(tmp
.ST_Width
,MUIM_Notify
,MUIA_String_Acknowledge
,MUIV_EveryTime
,obj
,2,MUIM_EditPanel_Update
,1);
1210 DoMethod(tmp
.ST_Height
,MUIM_Notify
,MUIA_String_Acknowledge
,MUIV_EveryTime
,obj
,2,MUIM_EditPanel_Update
,1);
1211 DoMethod(tmp
.SL_Depth
,MUIM_Notify
,MUIA_Slider_Level
,MUIV_EveryTime
,obj
,2,MUIM_EditPanel_Update
,1);
1214 set(tmp.CM_Adjustable,MUIA_Selected,TRUE);
1215 DoMethod(tmp.CM_Adjustable,MUIM_Notify,MUIA_Selected ,MUIV_EveryTime,obj,1,MUIM_EditPanel_ToggleForeign);
1218 set(tmp
.TX_Info
,MUIA_ShortHelp
,GetStr(MSG_HELP_INFO
));
1220 set(tmp.CM_Adjustable ,MUIA_ShortHelp,GetStr(MSG_HELP_ADJUSTABLE ));
1222 set(tmp
.ST_Name
,MUIA_ShortHelp
,GetStr(MSG_HELP_NAME
));
1223 set(tmp
.ST_Title
,MUIA_ShortHelp
,GetStr(MSG_HELP_TITLE
));
1224 set(tmp
.ST_Font
,MUIA_ShortHelp
,GetStr(MSG_HELP_FONT
));
1225 set(tmp
.ST_Background
,MUIA_ShortHelp
,GetStr(MSG_HELP_BACKGROUND
));
1226 set(tmp
.CM_AutoScroll
,MUIA_ShortHelp
,GetStr(MSG_HELP_AUTOSCROLL
));
1227 set(tmp
.CM_NoDrag
,MUIA_ShortHelp
,GetStr(MSG_HELP_NODRAG
));
1228 set(tmp
.CM_Exclusive
,MUIA_ShortHelp
,GetStr(MSG_HELP_EXCLUSIVE
));
1229 set(tmp
.CM_Interleaved
,MUIA_ShortHelp
,GetStr(MSG_HELP_INTERLEAVED
));
1230 set(tmp
.CM_Behind
,MUIA_ShortHelp
,GetStr(MSG_HELP_BEHIND
));
1231 set(tmp
.CM_AutoClose
,MUIA_ShortHelp
,GetStr(MSG_HELP_AUTOCLOSE
));
1232 set(tmp
.CM_CloseGadget
,MUIA_ShortHelp
,GetStr(MSG_HELP_CLOSEGADGET
));
1233 set(tmp
.CM_SysDefault
,MUIA_ShortHelp
,GetStr(MSG_HELP_SYSTEMDEFAULT
));
1234 set(tmp
.LV_Modes
,MUIA_ShortHelp
,GetStr(MSG_HELP_MODELIST
));
1235 set(tmp
.CY_Overscan
,MUIA_ShortHelp
,GetStr(MSG_HELP_OVERSCAN
));
1236 set(tmp
.ST_Width
,MUIA_ShortHelp
,GetStr(MSG_HELP_WIDTH
));
1237 set(tmp
.ST_Height
,MUIA_ShortHelp
,GetStr(MSG_HELP_HEIGHT
));
1238 set(tmp
.SL_Depth
,MUIA_ShortHelp
,GetStr(MSG_HELP_DEPTH
));
1239 set(tmp
.TX_ModeInfo
,MUIA_ShortHelp
,GetStr(MSG_HELP_MODEINFO
));
1242 set(data
->palette
[i
],MUIA_UserData
,i
+1);
1244 set(l1
,MUIA_Font
,MUIV_Font_Tiny
);
1245 set(l2
,MUIA_Font
,MUIV_Font_Tiny
);
1248 DoMethod(obj,MUIM_EditPanel_ToggleForeign);
1252 if (IntuitionBase->lib_Version<39)
1253 set(tmp.ST_Background,MUIA_Disabled,TRUE);
1263 ULONG
EditPanel_Dispose(struct IClass
*cl
,Object
*obj
,Msg msg
)
1265 struct EditPanel_Data
*data
= INST_DATA(cl
,obj
);
1267 if (data
->ColorMenu
)
1268 MUI_DisposeObject(data
->ColorMenu
);
1270 return(DoSuperMethodA(cl
,obj
,msg
));
1275 ULONG EditPanel_ToggleForeign(struct IClass *cl,Object *obj,Msg msg)
1277 struct EditPanel_Data *data = INST_DATA(cl,obj);
1278 BOOL disable = !getbool(data->CM_Adjustable);
1281 set(data->GR_EditPages,MUIA_Group_ActivePage,2);
1283 DoMethod(obj,MUIM_EditPanel_Update,1);
1285 DoMethod(obj,MUIM_MultiSet,MUIA_Disabled,disable,
1288 data->ST_Background,
1289 data->CM_AutoScroll,
1292 data->CM_Interleaved,
1294 data->CM_SysDefault,
1296 data->CM_CloseGadget,
1310 ULONG
EditPanel_Update(struct IClass
*cl
,Object
*obj
,struct MUIP_EditPanel_Update
*msg
)
1312 struct EditPanel_Data
*data
= INST_DATA(cl
,obj
);
1313 struct NameInfo
*ni
;
1314 struct DimensionInfo DimensionInfo
;
1316 if (data
->update
) return(0);
1317 data
->update
= TRUE
;
1320 if (getbool(data->CM_Adjustable))
1323 DoMethod(data
->LI_Modes
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&ni
);
1325 if (ni
&& GetDisplayInfoData(NULL
,(char *)&DimensionInfo
,sizeof(DimensionInfo
),DTAG_DIMS
,ni
->Header
.DisplayID
))
1327 /*set(data->GR_SysPots,MUIA_Coloradjust_ModeID,ni->Header.DisplayID); !!!*/
1331 set(data
->GR_Size
,MUIA_Disabled
,FALSE
);
1332 set(data
->SL_Depth
,MUIA_Slider_Max
,DimensionInfo
.MaxDepth
);
1336 set(data
->TX_ModeInfo
,MUIA_DispIDinfo_ID
,ni
->Header
.DisplayID
);
1340 int w
= RectangleWidth(DimensionInfo
.TxtOScan
);
1341 int h
= RectangleHeight(DimensionInfo
.TxtOScan
);
1343 switch (xget(data
->CY_Overscan
,MUIA_Cycle_Active
))
1346 w
= RectangleWidth(DimensionInfo
.StdOScan
);
1347 h
= RectangleHeight(DimensionInfo
.StdOScan
);
1351 w
= RectangleWidth(DimensionInfo
.MaxOScan
);
1352 h
= RectangleHeight(DimensionInfo
.MaxOScan
);
1356 w
= RectangleWidth(DimensionInfo
.VideoOScan
);
1357 h
= RectangleHeight(DimensionInfo
.VideoOScan
);
1361 setstr(data
->ST_Width
,w
);
1362 setstr(data
->ST_Height
,h
);
1366 DoMethod(data
->TX_Info
,MUIM_SetAsString
,MUIA_Text_Contents
,"%s (%ld x %ld x %ld)",ni
->Name
,atol(getstr(data
->ST_Width
)),atol(getstr(data
->ST_Height
)),xget(data
->SL_Depth
,MUIA_Slider_Level
));
1370 /* set(data->GR_SysPots,MUIA_Coloradjust_ModeID,INVALID_ID); !!!*/
1371 set(data
->TX_ModeInfo
,MUIA_DispIDinfo_ID
,INVALID_ID
);
1372 set(data
->TX_Info
,MUIA_Text_Contents
,GetStr(MSG_TEXT_UNKNOWNMODE
));
1373 set(data
->GR_Size
,MUIA_Disabled
,TRUE
);
1379 set(data->TX_Info,MUIA_Text_Contents,GetStr(MSG_TEXT_FOREIGNSCREEN));
1383 data
->update
= FALSE
;
1388 BOOPSI_DISPATCHER(IPTR
, EditPanel_Dispatcher
, cl
, obj
, msg
)
1390 switch (msg
->MethodID
)
1392 case OM_NEW
: return(EditPanel_New (cl
,obj
,(APTR
)msg
));
1393 case OM_DISPOSE
: return(EditPanel_Dispose (cl
,obj
,(APTR
)msg
));
1395 case MUIM_ContextMenuChoice
: return(EditPanel_ContextMenuChoice(cl
,obj
,(APTR
)msg
));
1397 case MUIM_EditPanel_SetScreen
: return(EditPanel_SetScreen (cl
,obj
,(APTR
)msg
));
1398 case MUIM_EditPanel_GetScreen
: return(EditPanel_GetScreen (cl
,obj
,(APTR
)msg
));
1399 case MUIM_EditPanel_Update
: return(EditPanel_Update (cl
,obj
,(APTR
)msg
));
1401 case MUIM_EditPanel_ToggleForeign: return(EditPanel_ToggleForeign (cl,obj,(APTR)msg));
1404 return(DoSuperMethodA(cl
,obj
,msg
));
1406 BOOPSI_DISPATCHER_END
1410 /****************************************************************************/
1411 /* EditWindow class */
1412 /****************************************************************************/
1414 struct EditWindow_Data
1417 char wtitle
[PSD_MAXLEN_TITLE
+20];
1420 ULONG
EditWindow_New(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
1422 struct EditWindow_Data
*data
;
1429 if (obj
= (Object
*)DoSuperNewTags(cl
,obj
,NULL
,
1430 /*MUIA_Window_Menustrip, strip = MUI_MakeObject(MUIO_MenustripNM,EditMenu,0),*/
1431 WindowContents
, VGroup
,
1432 Child
, panel
= NewObject(CL_EditPanel
->mcc_Class
,NULL
,TAG_DONE
),
1433 Child
, HGroup
, MUIA_Group_SameSize
, TRUE
,
1434 Child
, ok
= MakeButton(MSG_BUTTON_OK
),
1438 Child
, cancel
= MakeButton(MSG_BUTTON_CANCEL
),
1441 TAG_MORE
,msg
->ops_AttrList
))
1443 data
= INST_DATA(cl
,obj
);
1445 data
->panel
= panel
;
1447 strcpy(data
->wtitle
,GetStr(MSG_TITLE_PUBSCREENWINDOW
));
1448 strcat(data
->wtitle
," ");
1449 strcat(data
->wtitle
,(char *)GetTagData(MUIA_EditWindow_Title
,(ULONG
)"",msg
->ops_AttrList
));
1451 set(obj
,MUIA_Window_Title
,data
->wtitle
);
1452 set(obj
,MUIA_Window_ID
,MAKE_ID('E','D','I','T'));
1454 originator
= (Object
*)GetTagData(MUIA_EditWindow_Originator
,0,msg
->ops_AttrList
);
1456 DoMethod(obj
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
,MUIV_Notify_Application
,6,MUIM_Application_PushMethod
,originator
,3,MUIM_ScreenPanel_Finish
,obj
,FALSE
);
1457 DoMethod(cancel
,MUIM_Notify
,MUIA_Pressed
,FALSE
,MUIV_Notify_Application
,6,MUIM_Application_PushMethod
,originator
,3,MUIM_ScreenPanel_Finish
,obj
,FALSE
);
1458 DoMethod(ok
,MUIM_Notify
,MUIA_Pressed
,FALSE
,MUIV_Notify_Application
,6,MUIM_Application_PushMethod
,originator
,3,MUIM_ScreenPanel_Finish
,obj
,TRUE
);
1461 DoMethod((Object *)DoMethod(strip,MUIM_FindUData,MEN_2COL),MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,panel,2,MUIM_EditPanel_DefColors,0);
1462 DoMethod((Object *)DoMethod(strip,MUIM_FindUData,MEN_4COL),MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,panel,2,MUIM_EditPanel_DefColors,1);
1463 DoMethod((Object *)DoMethod(strip,MUIM_FindUData,MEN_8COL),MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,panel,2,MUIM_EditPanel_DefColors,2);
1466 set(ok
,MUIA_ShortHelp
,GetStr(MSG_HELP_EDITOK
));
1467 set(cancel
,MUIA_ShortHelp
,GetStr(MSG_HELP_EDITCANCEL
));
1474 BOOPSI_DISPATCHER(IPTR
, EditWindow_Dispatcher
, cl
, obj
, msg
)
1476 switch (msg
->MethodID
)
1478 case OM_NEW
: return(EditWindow_New(cl
,obj
,(APTR
)msg
));
1481 ** The next methods actually don't belong to the
1482 ** edit window class. We just forward them here to
1483 ** allow treating an edit window much like an edit
1484 ** panel from outside.
1487 case MUIM_EditPanel_SetScreen
:
1488 case MUIM_EditPanel_GetScreen
:
1490 struct EditWindow_Data
*data
= INST_DATA(cl
,obj
);
1491 return(DoMethodA(data
->panel
,msg
));
1494 return(DoSuperMethodA(cl
,obj
,msg
));
1496 BOOPSI_DISPATCHER_END
1500 /****************************************************************************/
1501 /* ScreenList class */
1502 /****************************************************************************/
1504 #define USE_PSI_SCREENON_HEADER
1505 #define USE_PSI_SCREENON_BODY
1506 #define USE_PSI_SCREENON_COLORS
1507 #include "psi_screenon.bh"
1510 #define USE_PSI_SCREENOF_BODY
1511 #include "psi_screenof.bh"
1514 #define USE_PSI_SCREENCN_BODY
1515 #include "psi_screencn.bh"
1518 #define USE_PSI_SCREENCF_BODY
1519 #include "psi_screencf.bh"
1524 struct ScreenList_Data
1529 Object *oforeign[2];
1535 struct Hook DisplayHook
;
1538 IPTR
ScreenList_ConstructFunc(struct Hook
*hook
, APTR pool
, struct MUI_PubScreenDesc
*src
)
1540 struct MUI_PubScreenDesc
*desc
;
1542 if (desc
= MUIS_AllocPubScreenDesc(src
))
1544 desc
->Changed
= FALSE
;
1545 desc
->UserData
= NULL
;
1550 VOID
ScreenList_DestructFunc(struct Hook
*hook
, APTR pool
, struct MUI_PubScreenDesc
*desc
)
1552 MUIS_FreePubScreenDesc(desc
);
1555 LONG
ScreenList_CompareFunc(struct Hook
*hook
, struct MUI_PubScreenDesc
*d2
, struct MUI_PubScreenDesc
*d1
)
1557 if (!strcmp(d1
->Name
,PSD_INITIAL_NAME
))
1558 return(strcmp(d2
->Name
,PSD_INITIAL_NAME
) ? 1 : 0);
1559 else if (!strcmp(d2
->Name
,PSD_INITIAL_NAME
))
1562 return(stricmp(d1
->Name
,d2
->Name
));
1565 LONG
ScreenList_DisplayFunc(struct Hook
*hook
, char **array
, struct MUI_PubScreenDesc
*desc
)
1567 struct ScreenList_Data
*data
= (APTR
)hook
->h_Data
;
1573 static char buf1
[30],buf2
[30];
1574 strcpy(buf1
,"\33b\33u");
1575 strcpy(buf2
,"\33b\33u");
1576 strcat(buf1
,GetStr(MSG_LIST_SCREENNAME
));
1577 strcat(buf2
,GetStr(MSG_LIST_SCREENMODE
));
1584 static struct NameInfo ni
;
1585 static char buf1
[PSD_MAXLEN_NAME
+2];
1586 static char buf2
[50];
1588 strcpy(buf1
,desc
->UserData
? "\33b" : desc
->Changed
? "\33u" : "");
1589 strcat(buf1
,desc
->Name
);
1594 strcpy(ni.Name,GetStr(MSG_LIST_FOREIGNSCREEN));
1595 sprintf(buf2,"\33O[%08lx]",data->iforeign[TestPubScreen(desc->Name) ? 1 : 0]);
1600 if (!GetDisplayInfoData(0,(UBYTE
*)&ni
,sizeof(ni
),DTAG_NAME
,desc
->DisplayID
))
1601 strcpy(ni
.Name
,GetStr(MSG_LIST_UNKNOWNMODE
));
1603 sprintf(buf2
,"\33O[%08lx]",data
->inormal
[TestPubScreen(desc
->Name
) ? 1 : 0]);
1615 ULONG
ScreenList_Load(struct IClass
*cl
,Object
*obj
,struct MUIP_ScreenList_Load
*msg
)
1617 ULONG result
= FALSE
;
1618 struct MUI_PubScreenDesc
*desc
;
1621 if (pfh
= MUIS_OpenPubFile(msg
->name
,MODE_OLDFILE
))
1626 DoMethod(obj
,MUIM_List_Clear
);
1628 set(obj
,MUIA_List_Quiet
,TRUE
);
1630 while (desc
= MUIS_ReadPubFile(pfh
))
1632 DoMethod(obj
,MUIM_List_InsertSingle
,desc
,MUIV_List_Insert_Sorted
);
1635 set(obj
,MUIA_List_Quiet
,FALSE
);
1637 MUIS_ClosePubFile(pfh
);
1643 ULONG
ScreenList_Save(struct IClass
*cl
,Object
*obj
,struct MUIP_ScreenList_Save
*msg
)
1645 ULONG result
= FALSE
;
1646 struct MUI_PubScreenDesc
*desc
;
1650 DoMethod(obj
,MUIM_List_Sort
);
1652 if (pfh
= MUIS_OpenPubFile(msg
->name
,MODE_NEWFILE
))
1656 for (i
=0;result
;i
++)
1658 DoMethod(obj
,MUIM_List_GetEntry
,i
,&desc
);
1661 desc
->Changed
= FALSE
;
1662 desc
->UserData
= NULL
;
1664 if (!MUIS_WritePubFile(pfh
,desc
))
1667 MUIS_ClosePubFile(pfh
);
1673 ULONG
ScreenList_Find(struct IClass
*cl
,Object
*obj
,struct MUIP_ScreenList_Find
*msg
)
1676 struct MUI_PubScreenDesc
*desc
;
1678 *(msg
->desc
) = NULL
;
1682 DoMethod(obj
,MUIM_List_GetEntry
,i
,&desc
);
1684 if (!stricmp(desc
->Name
,msg
->name
))
1686 *(msg
->desc
) = desc
;
1687 set(obj
,MUIA_List_Active
,i
);
1695 static Object
*makescreenimage(UBYTE
*body
)
1697 Object
*obj
= BodychunkObject
,
1698 MUIA_FixWidth
, PSI_SCREENON_WIDTH
,
1699 MUIA_FixHeight
, PSI_SCREENON_HEIGHT
,
1700 MUIA_Bitmap_Width
, PSI_SCREENON_WIDTH
,
1701 MUIA_Bitmap_Height
, PSI_SCREENON_HEIGHT
,
1702 MUIA_Bodychunk_Depth
, PSI_SCREENON_DEPTH
,
1703 MUIA_Bodychunk_Body
, (UBYTE
*)body
,
1704 MUIA_Bodychunk_Compression
, PSI_SCREENON_COMPRESSION
,
1705 MUIA_Bodychunk_Masking
, PSI_SCREENON_MASKING
,
1706 MUIA_Bitmap_SourceColors
, (ULONG
*)psi_screenon_colors
,
1707 MUIA_Bitmap_Transparent
, 0,
1714 ULONG
ScreenList_Setup(struct IClass
*cl
,Object
*obj
,Msg msg
)
1716 struct ScreenList_Data
*data
= INST_DATA(cl
,obj
);
1718 if (!DoSuperMethodA(cl
,obj
,msg
))
1721 data
->onormal
[0] = makescreenimage((UBYTE
*)psi_screencn_body
);
1722 data
->onormal
[1] = makescreenimage((UBYTE
*)psi_screenon_body
);
1724 data->oforeign[0] = makescreenimage((UBYTE *)psi_screencf_body);
1725 data->oforeign[1] = makescreenimage((UBYTE *)psi_screenof_body);
1728 data
->inormal
[0] = (APTR
)DoMethod(obj
,MUIM_List_CreateImage
,data
->onormal
[0] ,0);
1729 data
->inormal
[1] = (APTR
)DoMethod(obj
,MUIM_List_CreateImage
,data
->onormal
[1] ,0);
1731 data->iforeign[0] = (APTR)DoMethod(obj,MUIM_List_CreateImage,data->oforeign[0],0);
1732 data->iforeign[1] = (APTR)DoMethod(obj,MUIM_List_CreateImage,data->oforeign[1],0);
1735 MUI_RequestIDCMP(obj
,IDCMP_MOUSEBUTTONS
|IDCMP_RAWKEY
);
1741 ULONG
ScreenList_Cleanup(struct IClass
*cl
,Object
*obj
,Msg msg
)
1743 struct ScreenList_Data
*data
= INST_DATA(cl
,obj
);
1745 DoMethod(obj
,MUIM_List_DeleteImage
,data
->inormal
[0] );
1746 DoMethod(obj
,MUIM_List_DeleteImage
,data
->inormal
[1] );
1748 DoMethod(obj,MUIM_List_DeleteImage,data->iforeign[0]);
1749 DoMethod(obj,MUIM_List_DeleteImage,data->iforeign[1]);
1752 if (data
->onormal
[0] ) MUI_DisposeObject(data
->onormal
[0] );
1753 if (data
->onormal
[1] ) MUI_DisposeObject(data
->onormal
[1] );
1755 if (data->oforeign[0]) MUI_DisposeObject(data->oforeign[0]);
1756 if (data->oforeign[1]) MUI_DisposeObject(data->oforeign[1]);
1759 MUI_RejectIDCMP(obj
,IDCMP_MOUSEBUTTONS
|IDCMP_RAWKEY
);
1761 return(DoSuperMethodA(cl
,obj
,msg
));
1765 ULONG
ScreenList_New(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
1767 static struct Hook ScreenList_ConstructHook
;
1768 ScreenList_ConstructHook
.h_Entry
= HookEntry
;
1769 ScreenList_ConstructHook
.h_SubEntry
= ScreenList_ConstructFunc
;
1770 static struct Hook ScreenList_DestructHook
;
1771 ScreenList_DestructHook
.h_Entry
= HookEntry
;
1772 ScreenList_DestructHook
.h_SubEntry
= ScreenList_DestructFunc
;
1773 static struct Hook ScreenList_CompareHook
;
1774 ScreenList_CompareHook
.h_Entry
= HookEntry
;
1775 ScreenList_CompareHook
.h_SubEntry
= ScreenList_CompareFunc
;
1777 obj
=(Object
*)DoSuperNewTags(cl
,obj
,NULL
,
1778 MUIA_List_ConstructHook
, &ScreenList_ConstructHook
,
1779 MUIA_List_DestructHook
, &ScreenList_DestructHook
,
1780 MUIA_List_CompareHook
, &ScreenList_CompareHook
,
1781 MUIA_List_Format
, "DELTA=2,,,",
1782 MUIA_List_Title
, TRUE
,
1783 MUIA_List_MinLineHeight
, 14,
1784 TAG_MORE
,msg
->ops_AttrList
);
1788 struct ScreenList_Data
*data
= INST_DATA(cl
,obj
);
1790 data
->DisplayHook
.h_Entry
= HookEntry
;
1791 data
->DisplayHook
.h_SubEntry
= (VOID
*)ScreenList_DisplayFunc
;
1792 data
->DisplayHook
.h_Data
= (APTR
)data
;
1794 set(obj
,MUIA_List_DisplayHook
,&data
->DisplayHook
);
1800 BOOPSI_DISPATCHER(IPTR
, ScreenList_Dispatcher
, cl
, obj
, msg
)
1802 switch (msg
->MethodID
)
1804 case OM_NEW
: return(ScreenList_New (cl
,obj
,(APTR
)msg
));
1805 case MUIM_Setup
: return(ScreenList_Setup (cl
,obj
,(APTR
)msg
));
1806 case MUIM_Cleanup
: return(ScreenList_Cleanup(cl
,obj
,(APTR
)msg
));
1807 case MUIM_ScreenList_Save
: return(ScreenList_Save (cl
,obj
,(APTR
)msg
));
1808 case MUIM_ScreenList_Load
: return(ScreenList_Load (cl
,obj
,(APTR
)msg
));
1809 case MUIM_ScreenList_Find
: return(ScreenList_Find (cl
,obj
,(APTR
)msg
));
1811 return(DoSuperMethodA(cl
,obj
,msg
));
1813 BOOPSI_DISPATCHER_END
1817 /****************************************************************************/
1818 /* ScreenPanel class */
1819 /****************************************************************************/
1821 struct ScreenPanel_Data
1836 ULONG
ScreenPanel_Finish(struct IClass
*cl
,Object
*obj
,struct MUIP_ScreenPanel_Finish
*msg
)
1838 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
1839 struct MUI_PubScreenDesc
*desc
;
1841 Object
*win
= msg
->win
;
1846 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,i
,&desc
);
1847 if (!desc
) return(0); /* should never happen */
1848 if (desc
->UserData
==win
) break;
1851 desc
->UserData
= NULL
;
1855 DoMethod(win
,MUIM_EditPanel_GetScreen
,desc
);
1856 desc
->Changed
= TRUE
;
1858 DoMethod(data
->LV_Screens
,MUIM_List_Redraw
,i
);
1859 DoMethod(obj
,MUIM_ScreenPanel_SetStates
);
1861 set(win
,MUIA_Window_Open
,FALSE
);
1862 DoMethod((Object
*)xget(obj
,MUIA_ApplicationObject
),OM_REMMEMBER
,win
);
1863 MUI_DisposeObject(win
);
1868 ULONG
ScreenPanel_Edit(struct IClass
*cl
,Object
*obj
,Msg msg
)
1870 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
1871 struct MUI_PubScreenDesc
*desc
;
1873 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&desc
);
1877 set((Object
*)xget(obj
,MUIA_ApplicationObject
),MUIA_Application_Sleep
,TRUE
);
1879 if (!desc
->UserData
)
1881 if (desc
->UserData
= (APTR
)NewObject(CL_EditWindow
->mcc_Class
,NULL
,
1882 MUIA_Window_Width
, MUIV_Window_Width_MinMax(0),
1883 MUIA_Window_Height
, MUIV_Window_Height_MinMax(0),
1884 MUIA_EditWindow_Title
, desc
->Name
,
1885 MUIA_EditWindow_Originator
, obj
,
1888 DoMethod((Object
*)xget(obj
,MUIA_ApplicationObject
),OM_ADDMEMBER
,desc
->UserData
);
1889 DoMethod(desc
->UserData
,MUIM_EditPanel_SetScreen
,desc
);
1890 DoMethod(data
->LV_Screens
,MUIM_List_Redraw
,MUIV_List_Redraw_Active
);
1895 set(desc
->UserData
,MUIA_Window_Open
,TRUE
);
1899 set((Object
*)xget(obj
,MUIA_ApplicationObject
),MUIA_Application_Sleep
,FALSE
);
1904 ULONG
ScreenPanel_Delete(struct IClass
*cl
,Object
*obj
,Msg msg
)
1906 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
1907 struct MUI_PubScreenDesc
*desc
;
1909 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&desc
);
1912 if (!desc
->UserData
)
1914 MUIS_ClosePubScreen(desc
->Name
);
1915 DoMethod(data
->LV_Screens
,MUIM_List_Remove
,MUIV_List_Remove_Active
);
1923 ULONG
ScreenPanel_Create(struct IClass
*cl
,Object
*obj
,Msg msg
)
1925 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
1926 DoMethod(data
->LV_Screens
,MUIM_List_InsertSingle
,NULL
,MUIV_List_Insert_Bottom
);
1927 set(data
->LV_Screens
,MUIA_List_Active
,MUIV_List_Active_Bottom
);
1931 ULONG
ScreenPanel_Copy(struct IClass
*cl
,Object
*obj
,Msg msg
)
1933 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
1934 struct MUI_PubScreenDesc
*new,*src
;
1935 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&src
);
1936 if (new = MUIS_AllocPubScreenDesc(src
))
1938 char namebuf
[PSD_MAXLEN_NAME
];
1939 strcpy(namebuf
,new->Name
);
1940 strcpy(new->Name
,">");
1941 stccpy(new->Name
+1,namebuf
,PSD_MAXLEN_NAME
-1);
1942 DoMethod(data
->LV_Screens
,MUIM_List_InsertSingle
,new,MUIV_List_Insert_Bottom
);
1943 set(data
->LV_Screens
,MUIA_List_Active
,MUIV_List_Active_Bottom
);
1944 MUIS_FreePubScreenDesc(new);
1951 ULONG
ScreenPanel_SetStates(struct IClass
*cl
,Object
*obj
,Msg msg
)
1953 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
1954 struct MUI_PubScreenDesc
*desc
;
1955 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&desc
);
1961 set(data->BT_Copy ,MUIA_Disabled,FALSE);
1962 set(data->BT_Delete,MUIA_Disabled,FALSE);
1963 set(data->BT_Edit ,MUIA_Disabled,FALSE);
1964 set(data->BT_Open ,MUIA_Disabled,TRUE );
1965 set(data->BT_Close ,MUIA_Disabled,TRUE );
1966 set(data->BT_Jump ,MUIA_Disabled,FALSE);
1971 BOOL opened
= TestPubScreen(desc
->Name
);
1973 set(data
->BT_Copy
,MUIA_Disabled
,FALSE
);
1974 set(data
->BT_Delete
,MUIA_Disabled
,FALSE
);
1975 set(data
->BT_Edit
,MUIA_Disabled
,FALSE
);
1976 set(data
->BT_Open
,MUIA_Disabled
, opened
);
1977 set(data
->BT_Close
,MUIA_Disabled
,!opened
);
1978 set(data
->BT_Jump
,MUIA_Disabled
,FALSE
);
1983 set(data
->BT_Copy
,MUIA_Disabled
,TRUE
);
1984 set(data
->BT_Delete
,MUIA_Disabled
,TRUE
);
1985 set(data
->BT_Edit
,MUIA_Disabled
,TRUE
);
1986 set(data
->BT_Open
,MUIA_Disabled
,TRUE
);
1987 set(data
->BT_Close
,MUIA_Disabled
,TRUE
);
1988 set(data
->BT_Jump
,MUIA_Disabled
,TRUE
);
1993 ULONG
ScreenPanel_Close(struct IClass
*cl
,Object
*obj
,Msg msg
)
1995 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
1996 struct MUI_PubScreenDesc
*desc
;
1997 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&desc
);
1998 if (!desc
|| !MUIS_ClosePubScreen(desc
->Name
))
2003 ULONG
ScreenPanel_Open(struct IClass
*cl
,Object
*obj
,Msg msg
)
2005 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
2006 struct MUI_PubScreenDesc
*desc
;
2007 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&desc
);
2014 if (!MUIS_OpenPubScreen(desc
))
2022 ULONG
ScreenPanel_Jump(struct IClass
*cl
,Object
*obj
,Msg msg
)
2024 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
2025 struct MUI_PubScreenDesc
*desc
;
2026 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,MUIV_List_GetEntry_Active
,&desc
);
2033 DoMethod((Object
*)xget(obj
,MUIA_ApplicationObject
),MUIM_Application_SetConfigItem
,MUICFG_PublicScreen
,desc
->Name
);
2041 ULONG
ScreenPanel_Update(struct IClass
*cl
,Object
*obj
,Msg msg
)
2043 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
2044 DoMethod(data
->LV_Screens
,MUIM_List_Redraw
,MUIV_List_Redraw_All
);
2045 DoMethod(obj
,MUIM_ScreenPanel_SetStates
);
2049 ULONG
ScreenPanel_New(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
2051 struct ScreenPanel_Data tmp
= {0};
2053 obj
= (Object
*)DoSuperNewTags(cl
,obj
,NULL
,
2054 MUIA_Group_Horiz
, FALSE
,
2055 MUIA_Group_VertSpacing
, 0,
2056 Child
, tmp
.LV_Screens
= ListviewObject
,
2058 MUIA_Listview_List
, NewObject(CL_ScreenList
->mcc_Class
,NULL
,InputListFrame
,MUIA_List_AutoVisible
,TRUE
,TAG_DONE
),
2060 Child
, ColGroup(4), GroupSpacing(0), MUIA_Group_SameSize
, TRUE
,
2061 Child
, tmp
.BT_Create
= MakeButton(MSG_BUTTON_NEW
),
2062 Child
, tmp
.BT_Copy
= MakeButton(MSG_BUTTON_COPY
),
2063 Child
, tmp
.BT_Delete
= MakeButton(MSG_BUTTON_DELETE
),
2064 Child
, tmp
.BT_Edit
= MakeButton(MSG_BUTTON_EDIT
),
2065 Child
, tmp
.BT_Open
= MakeButton(MSG_BUTTON_OPEN
),
2066 Child
, tmp
.BT_Close
= MakeButton(MSG_BUTTON_CLOSE
),
2067 Child
, tmp
.BT_Jump
= MakeButton(MSG_BUTTON_JUMP
),
2069 Child
, tmp
.BT_Foo
= SimpleButton("Foo"),
2078 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
2082 DoMethod(tmp
.BT_Delete
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,1,MUIM_ScreenPanel_Delete
);
2083 DoMethod(tmp
.BT_Create
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,1,MUIM_ScreenPanel_Create
);
2084 DoMethod(tmp
.BT_Copy
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,1,MUIM_ScreenPanel_Copy
);
2085 DoMethod(tmp
.BT_Edit
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,1,MUIM_ScreenPanel_Edit
);
2086 DoMethod(tmp
.BT_Open
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,1,MUIM_ScreenPanel_Open
);
2087 DoMethod(tmp
.BT_Close
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,1,MUIM_ScreenPanel_Close
);
2088 DoMethod(tmp
.BT_Jump
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,1,MUIM_ScreenPanel_Jump
);
2090 DoMethod(tmp
.BT_Foo
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,1,MUIM_ScreenPanel_Foo
);
2092 DoMethod(tmp
.LV_Screens
,MUIM_Notify
,MUIA_Listview_DoubleClick
,TRUE
,obj
,1,MUIM_ScreenPanel_Edit
);
2093 DoMethod(tmp
.LV_Screens
,MUIM_Notify
,MUIA_List_Active
,MUIV_EveryTime
,obj
,1,MUIM_ScreenPanel_SetStates
);
2095 set(tmp
.BT_Delete
,MUIA_ShortHelp
,GetStr(MSG_HELP_DELETESCREEN
));
2096 set(tmp
.BT_Create
,MUIA_ShortHelp
,GetStr(MSG_HELP_NEWSCREEN
));
2097 set(tmp
.BT_Copy
,MUIA_ShortHelp
,GetStr(MSG_HELP_COPYSCREEN
));
2098 set(tmp
.BT_Edit
,MUIA_ShortHelp
,GetStr(MSG_HELP_EDITSCREEN
));
2099 set(tmp
.BT_Open
,MUIA_ShortHelp
,GetStr(MSG_HELP_OPENSCREEN
));
2100 set(tmp
.BT_Close
,MUIA_ShortHelp
,GetStr(MSG_HELP_CLOSESCREEN
));
2101 set(tmp
.BT_Jump
,MUIA_ShortHelp
,GetStr(MSG_HELP_JUMPSCREEN
));
2102 set(tmp
.LV_Screens
,MUIA_ShortHelp
,GetStr(MSG_HELP_SCREENLIST
));
2104 DoMethod(obj
,MUIM_ScreenPanel_SetStates
);
2109 ULONG
ScreenPanel_Dispose(struct IClass
*cl
,Object
*obj
,Msg msg
)
2111 DoMethod(obj
,MUIM_ScreenPanel_CloseWindows
);
2112 return(DoSuperMethodA(cl
,obj
,msg
));
2115 ULONG
ScreenPanel_CloseWindows(struct IClass
*cl
,Object
*obj
,Msg msg
)
2117 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
2118 struct MUI_PubScreenDesc
*desc
;
2122 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,i
,&desc
);
2124 if (desc
->UserData
) DoMethod(obj
,MUIM_ScreenPanel_Finish
,desc
->UserData
,FALSE
);
2131 BOOL
SavePubScreen(struct MUI_PubScreenDesc
*desc
)
2134 char filename
[PSD_MAXLEN_NAME
+16];
2138 strcpy(filename
,"mui:Screens");
2139 AddPart(filename
,desc
->Name
,sizeof(filename
));
2140 strcat(filename
,".mps");
2142 if (file
= Open(filename
,MODE_NEWFILE
))
2144 FPrintf(file
,"T=\"%s\"\n",desc
->Title
);
2145 FPrintf(file
,"F=\"%s\"\n",desc
->Font
);
2146 FPrintf(file
,"B=\"%s\"\n",desc
->Background
);
2147 FPrintf(file
,"W=%ld\n" ,desc
->DisplayWidth
);
2148 FPrintf(file
,"H=%ld\n" ,desc
->DisplayHeight
);
2149 FPrintf(file
,"D=%ld\n" ,desc
->DisplayDepth
);
2150 FPrintf(file
,"I=%ld\n" ,desc
->DisplayID
);
2151 if (desc
->OverscanType
) FPrintf(file
,"OS\n");
2152 if (desc
->AutoScroll
) FPrintf(file
,"AS\n");
2153 if (desc
->NoDrag
) FPrintf(file
,"ND\n");
2154 if (desc
->Exclusive
) FPrintf(file
,"EX\n");
2155 if (desc
->Interleaved
) FPrintf(file
,"IN\n");
2156 if (desc
->SysDefault
) FPrintf(file
,"SD\n");
2157 if (desc
->Behind
) FPrintf(file
,"BH\n");
2158 if (desc
->AutoClose
) FPrintf(file
,"AC\n");
2159 if (desc
->CloseGadget
) FPrintf(file
,"CG\n");
2161 FPrintf(file
,"PEN=\"");
2162 for (p
=0;p
<PSD_NUMSYSPENS
;p
++)
2163 FPrintf(file
,"%ld:%ld ",p
,desc
->SystemPens
[p
]);
2164 FPrintf(file
,"\"\n");
2166 FPrintf(file
,"PAL=\"");
2167 for (p
=0;p
<PSD_NUMCOLS
;p
++)
2168 FPrintf(file
,"%ld:%02lx%02lx%02lx ",p
<4 ? p
: p
-8,desc
->Palette
[p
].red
>>24,desc
->Palette
[p
].green
>>24,desc
->Palette
[p
].blue
>>24);
2169 FPrintf(file
,"\"\n");
2179 ULONG
ScreenPanel_Foo(struct IClass
*cl
,Object
*obj
,Msg msg
)
2181 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
2182 struct MUI_PubScreenDesc
*desc
;
2189 DoMethod(data
->LV_Screens
,MUIM_List_GetEntry
,i
,&desc
);
2192 printf("N=\"%s\"\n",desc
->Name
);
2193 printf("T=\"%s\"\n",desc
->Title
);
2194 printf("F=\"%s\"\n",desc
->Font
);
2195 printf("B=\"%s\"\n",desc
->Background
);
2196 printf("W=%ld\n" ,desc
->DisplayWidth
);
2197 printf("H=%ld\n" ,desc
->DisplayHeight
);
2198 printf("D=%ld\n" ,desc
->DisplayDepth
);
2199 printf("I=%ld\n" ,desc
->DisplayID
);
2200 if (desc
->OverscanType
) printf("OS\n");
2201 if (desc
->AutoScroll
) printf("AS\n");
2202 if (desc
->NoDrag
) printf("ND\n");
2203 if (desc
->Exclusive
) printf("EX\n");
2204 if (desc
->Interleaved
) printf("IN\n");
2205 if (desc
->SysDefault
) printf("SD\n");
2206 if (desc
->Behind
) printf("BH\n");
2207 if (desc
->AutoClose
) printf("AC\n");
2208 if (desc
->CloseGadget
) printf("CG\n");
2211 for (p
=0;p
<PSD_NUMSYSPENS
;p
++)
2212 printf("%ld:%ld ",p
,desc
->SystemPens
[p
]);
2215 printf("PALETTE=\"");
2216 for (p
=0;p
<PSD_NUMCOLS
;p
++)
2217 printf("%ld:%02lx%02lx%02lx ",p
<4 ? p
: p
-8,desc
->Palette
[p
].red
>>24,desc
->Palette
[p
].green
>>24,desc
->Palette
[p
].blue
>>24);
2225 SavePubScreen(desc
);
2231 BOOPSI_DISPATCHER(IPTR
, ScreenPanel_Dispatcher
, cl
, obj
, msg
)
2233 switch (msg
->MethodID
)
2235 case OM_NEW
: return(ScreenPanel_New (cl
,obj
,(APTR
)msg
));
2236 case OM_DISPOSE
: return(ScreenPanel_Dispose (cl
,obj
,(APTR
)msg
));
2237 case MUIM_ScreenPanel_Create
: return(ScreenPanel_Create (cl
,obj
,(APTR
)msg
));
2238 case MUIM_ScreenPanel_Copy
: return(ScreenPanel_Copy (cl
,obj
,(APTR
)msg
));
2239 case MUIM_ScreenPanel_Delete
: return(ScreenPanel_Delete (cl
,obj
,(APTR
)msg
));
2240 case MUIM_ScreenPanel_Edit
: return(ScreenPanel_Edit (cl
,obj
,(APTR
)msg
));
2241 case MUIM_ScreenPanel_Finish
: return(ScreenPanel_Finish (cl
,obj
,(APTR
)msg
));
2242 case MUIM_ScreenPanel_CloseWindows
: return(ScreenPanel_CloseWindows(cl
,obj
,(APTR
)msg
));
2243 case MUIM_ScreenPanel_SetStates
: return(ScreenPanel_SetStates (cl
,obj
,(APTR
)msg
));
2244 case MUIM_ScreenPanel_Open
: return(ScreenPanel_Open (cl
,obj
,(APTR
)msg
));
2245 case MUIM_ScreenPanel_Close
: return(ScreenPanel_Close (cl
,obj
,(APTR
)msg
));
2246 case MUIM_ScreenPanel_Jump
: return(ScreenPanel_Jump (cl
,obj
,(APTR
)msg
));
2247 case MUIM_ScreenPanel_Update
: return(ScreenPanel_Update (cl
,obj
,(APTR
)msg
));
2249 case MUIM_ScreenPanel_Foo
: return(ScreenPanel_Foo (cl
,obj
,(APTR
)msg
));
2252 case MUIM_ScreenList_Find
:
2254 struct ScreenPanel_Data
*data
= INST_DATA(cl
,obj
);
2255 return(DoMethodA(data
->LV_Screens
,msg
));
2258 return(DoSuperMethodA(cl
,obj
,msg
));
2260 BOOPSI_DISPATCHER_END
2264 /****************************************************************************/
2265 /* MainWindow class */
2266 /****************************************************************************/
2268 struct MainWindow_Data
2274 ULONG
MainWindow_Finish(struct IClass
*cl
,Object
*obj
,struct MUIP_MainWindow_Finish
*msg
)
2276 struct MainWindow_Data
*data
= INST_DATA(cl
,obj
);
2277 if (msg
->level
>=1) DoMethod(data
->PA_Screens
,MUIM_ScreenList_Save
,PSD_FILENAME_USE
);
2278 if (msg
->level
>=2) DoMethod(data
->PA_Screens
,MUIM_ScreenList_Save
,PSD_FILENAME_SAVE
);
2279 DoMethod((Object
*)xget(obj
,MUIA_ApplicationObject
),MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
2284 ULONG
MainWindow_About(struct IClass
*cl
,Object
*obj
,Msg msg
)
2286 struct MainWindow_Data
*data
= INST_DATA(cl
,obj
);
2287 Object
*app
= (Object
*)xget(obj
,MUIA_ApplicationObject
);
2288 static const char AboutText
[] = "\33b\33cPSI - Public Screen Inspector\33n\n\33cVersion: %s\n\33c%s\n\n\33c%s %ld\n\33cARexx-Port: %s";
2289 MUI_Request(app
,obj
,0,NULL
,GetStr(MSG_BUTTON_OK
),(char *)AboutText
,
2290 ((char *)xget(app
,MUIA_Application_Version
))+10,
2291 ((char *)xget(app
,MUIA_Application_Copyright
)),
2292 GetStr(MSG_ABOUT_NUMBEROFSCREENS
),
2293 xget(data
->PA_Screens
,MUIA_List_Entries
),
2294 ((char *)xget(app
,MUIA_Application_Base
)));
2298 VOID
IntuiMsgFunc(struct Hook
*hook
, struct FileRequester
*req
, struct IntuiMessage
*imsg
)
2300 if (imsg
->Class
==IDCMP_REFRESHWINDOW
)
2301 DoMethod(req
->fr_UserData
,MUIM_Application_CheckRefresh
);
2304 char *getfilename(Object
*win
,char *title
,BOOL save
)
2306 static char buf
[512];
2307 struct FileRequester
*req
;
2309 static LONG left
=-1,top
=-1,width
=-1,height
=-1;
2310 Object
*app
= (Object
*)xget(win
,MUIA_ApplicationObject
);
2312 static struct Hook IntuiMsgHook
;
2314 IntuiMsgHook
.h_Entry
= HookEntry
;
2315 IntuiMsgHook
.h_SubEntry
= IntuiMsgFunc
;
2317 get(win
,MUIA_Window_Window
,&w
);
2320 left
= w
->LeftEdge
+w
->BorderLeft
+2;
2321 top
= w
->TopEdge
+w
->BorderTop
+2;
2322 width
= w
->Width
-w
->BorderLeft
-w
->BorderRight
-4;
2323 height
= w
->Height
-w
->BorderTop
-w
->BorderBottom
-4;
2326 if (req
=MUI_AllocAslRequestTags(ASL_FileRequest
,
2328 ASLFR_TitleText
, title
,
2329 ASLFR_InitialLeftEdge
, left
,
2330 ASLFR_InitialTopEdge
, top
,
2331 ASLFR_InitialWidth
, width
,
2332 ASLFR_InitialHeight
, height
,
2333 ASLFR_InitialDrawer
, "envarc:Zune",
2334 ASLFR_InitialPattern
, "#?.iff",
2335 ASLFR_DoSaveMode
, save
,
2336 ASLFR_DoPatterns
, TRUE
,
2337 ASLFR_RejectIcons
, TRUE
,
2338 ASLFR_UserData
, app
,
2339 ASLFR_IntuiMsgFunc
, &IntuiMsgHook
,
2342 set(app
,MUIA_Application_Sleep
,TRUE
);
2343 if (MUI_AslRequestTags(req
,TAG_DONE
))
2348 stccpy(buf
,req
->fr_Drawer
,sizeof(buf
));
2349 AddPart(buf
,req
->fr_File
,sizeof(buf
));
2351 left
= req
->fr_LeftEdge
;
2352 top
= req
->fr_TopEdge
;
2353 width
= req
->fr_Width
;
2354 height
= req
->fr_Height
;
2356 MUI_FreeAslRequest(req
);
2357 set(app
,MUIA_Application_Sleep
,FALSE
);
2362 ULONG
MainWindow_Open(struct IClass
*cl
,Object
*obj
,struct MUIP_MainWindow_Open
*msg
)
2364 struct MainWindow_Data
*data
= INST_DATA(cl
,obj
);
2365 char *title
= msg
->append
? GetStr(MSG_TITLE_APPEND
) : GetStr(MSG_TITLE_OPEN
);
2367 if ((name
=getfilename(obj
,title
,FALSE
)) && *name
)
2369 if (!msg
->append
) DoMethod(data
->PA_Screens
,MUIM_ScreenPanel_CloseWindows
);
2370 DoMethod(data
->PA_Screens
,MUIM_ScreenList_Load
,name
,msg
->append
? FALSE
: TRUE
);
2375 ULONG
MainWindow_SaveAs(struct IClass
*cl
,Object
*obj
,Msg msg
)
2377 struct MainWindow_Data
*data
= INST_DATA(cl
,obj
);
2378 char *title
= GetStr(MSG_TITLE_SAVE
);
2380 if ((name
=getfilename(obj
,title
,TRUE
)) && *name
)
2382 DoMethod(data
->PA_Screens
,MUIM_ScreenList_Save
,name
);
2387 ULONG
MainWindow_Restore(struct IClass
*cl
,Object
*obj
,struct MUIP_MainWindow_Restore
*msg
)
2389 struct MainWindow_Data
*data
= INST_DATA(cl
,obj
);
2390 DoMethod(data
->PA_Screens
,MUIM_ScreenPanel_CloseWindows
);
2391 DoMethod(data
->PA_Screens
,MUIM_ScreenList_Load
,msg
->envarc
? PSD_FILENAME_SAVE
: PSD_FILENAME_USE
,TRUE
);
2395 ULONG
MainWindow_New(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
2403 if (obj
= (Object
*)DoSuperNewTags(cl
,obj
,NULL
,
2404 MUIA_Window_Title
, "PSI - Public Screen Inspector",
2405 MUIA_Window_ID
, MAKE_ID('M','A','I','N'),
2406 MUIA_Window_Menustrip
, strip
= MUI_MakeObject(MUIO_MenustripNM
,MainMenu
,0),
2407 WindowContents
, VGroup
,
2408 Child
, PA_Screens
= NewObject(CL_ScreenPanel
->mcc_Class
,NULL
,TAG_DONE
),
2409 Child
, MUI_MakeObject(MUIO_HBar
,2),
2410 Child
, HGroup
, MUIA_Group_SameSize
, TRUE
,
2411 Child
, BT_Save
= MakeButton(MSG_BUTTON_SAVE
),
2413 Child
, BT_Use
= MakeButton(MSG_BUTTON_USE
),
2415 Child
, BT_Cancel
= MakeButton(MSG_BUTTON_CANCEL
),
2418 TAG_MORE
,msg
->ops_AttrList
))
2420 struct MainWindow_Data
*data
= INST_DATA(cl
,obj
);
2422 data
->PA_Screens
= PA_Screens
;
2424 DoMethod(obj
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
,obj
,2,MUIM_MainWindow_Finish
,0);
2425 DoMethod(BT_Cancel
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,2,MUIM_MainWindow_Finish
,0);
2426 DoMethod(BT_Use
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,2,MUIM_MainWindow_Finish
,1);
2427 DoMethod(BT_Save
,MUIM_Notify
,MUIA_Pressed
,FALSE
,obj
,2,MUIM_MainWindow_Finish
,2);
2429 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MEN_ABOUT
),MUIM_Notify
,MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,1,MUIM_MainWindow_About
);
2430 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MEN_OPEN
),MUIM_Notify
,MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,2,MUIM_MainWindow_Open
,0);
2431 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MEN_APPEND
),MUIM_Notify
,MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,2,MUIM_MainWindow_Open
,1);
2432 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MEN_SAVEAS
),MUIM_Notify
,MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,1,MUIM_MainWindow_SaveAs
);
2433 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MEN_QUIT
),MUIM_Notify
,MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,2,MUIM_MainWindow_Finish
,0);
2434 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MEN_LASTSAVED
),MUIM_Notify
,MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,2,MUIM_MainWindow_Restore
,1);
2435 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MEN_RESTORE
),MUIM_Notify
,MUIA_Menuitem_Trigger
,MUIV_EveryTime
,obj
,2,MUIM_MainWindow_Restore
,0);
2436 DoMethod((Object
*)DoMethod(strip
,MUIM_FindUData
,MEN_MUI
),MUIM_Notify
,MUIA_Menuitem_Trigger
,MUIV_EveryTime
,MUIV_Notify_Application
,2,MUIM_Application_OpenConfigWindow
,0);
2438 DoMethod(PA_Screens
,MUIM_ScreenList_Load
,PSD_FILENAME_USE
,TRUE
);
2440 set(BT_Save
,MUIA_ShortHelp
,GetStr(MSG_HELP_SAVE
));
2441 set(BT_Use
,MUIA_ShortHelp
,GetStr(MSG_HELP_USE
));
2442 set(BT_Cancel
,MUIA_ShortHelp
,GetStr(MSG_HELP_CANCEL
));
2449 BOOPSI_DISPATCHER(IPTR
, MainWindow_Dispatcher
, cl
, obj
, msg
)
2451 switch (msg
->MethodID
)
2453 case OM_NEW
: return(MainWindow_New (cl
,obj
,(APTR
)msg
));
2454 case MUIM_MainWindow_Finish
: return(MainWindow_Finish (cl
,obj
,(APTR
)msg
));
2455 case MUIM_MainWindow_About
: return(MainWindow_About (cl
,obj
,(APTR
)msg
));
2456 case MUIM_MainWindow_Open
: return(MainWindow_Open (cl
,obj
,(APTR
)msg
));
2457 case MUIM_MainWindow_SaveAs
: return(MainWindow_SaveAs (cl
,obj
,(APTR
)msg
));
2458 case MUIM_MainWindow_Restore
: return(MainWindow_Restore(cl
,obj
,(APTR
)msg
));
2460 case MUIM_ScreenPanel_CloseWindows
:
2461 case MUIM_ScreenPanel_Update
:
2462 case MUIM_ScreenList_Find
:
2464 struct MainWindow_Data
*data
= INST_DATA(cl
,obj
);
2465 return(DoMethodA(data
->PA_Screens
,msg
));
2468 return(DoSuperMethodA(cl
,obj
,msg
));
2470 BOOPSI_DISPATCHER_END
2473 /****************************************************************************/
2474 /* Init/Exit Functions */
2475 /****************************************************************************/
2479 if (IntuitionBase
) CloseLibrary(IntuitionBase
);
2480 if (GfxBase
) CloseLibrary(GfxBase
);
2481 if (AslBase
) CloseLibrary(AslBase
);
2482 if (UtilityBase
) CloseLibrary(UtilityBase
);
2483 if (MUIScreenBase
) CloseLibrary(MUIScreenBase
);
2484 if (MUIMasterBase
) CloseLibrary(MUIMasterBase
);
2489 MUIMasterBase
= OpenLibrary("muimaster.library",11);
2490 MUIScreenBase
= OpenLibrary("muiscreen.library",1);
2491 UtilityBase
= OpenLibrary("utility.library" ,36);
2492 AslBase
= OpenLibrary("asl.library" ,36);
2493 GfxBase
= OpenLibrary("graphics.library" ,36);
2494 IntuitionBase
= OpenLibrary("intuition.library",36);
2496 if (MUIMasterBase
&& MUIScreenBase
&& UtilityBase
&& AslBase
&& GfxBase
&& IntuitionBase
)
2503 VOID
ExitClasses(VOID
)
2505 if (CL_MainWindow
) MUI_DeleteCustomClass(CL_MainWindow
);
2506 if (CL_ScreenPanel
) MUI_DeleteCustomClass(CL_ScreenPanel
);
2507 if (CL_ScreenList
) MUI_DeleteCustomClass(CL_ScreenList
);
2508 if (CL_DispIDinfo
) MUI_DeleteCustomClass(CL_DispIDinfo
);
2509 if (CL_DispIDlist
) MUI_DeleteCustomClass(CL_DispIDlist
);
2510 if (CL_EditPanel
) MUI_DeleteCustomClass(CL_EditPanel
);
2511 if (CL_EditWindow
) MUI_DeleteCustomClass(CL_EditWindow
);
2512 if (CL_SysPenField
) MUI_DeleteCustomClass(CL_SysPenField
);
2515 BOOL
InitClasses(VOID
)
2517 CL_SysPenField
= MUI_CreateCustomClass(NULL
,MUIC_Pendisplay
,NULL
,sizeof(struct SysPenField_Data
),SysPenField_Dispatcher
);
2518 CL_EditWindow
= MUI_CreateCustomClass(NULL
,MUIC_Window
,NULL
,sizeof(struct EditWindow_Data
),EditWindow_Dispatcher
);
2519 CL_EditPanel
= MUI_CreateCustomClass(NULL
,MUIC_Group
,NULL
,sizeof(struct EditPanel_Data
),EditPanel_Dispatcher
);
2520 CL_DispIDlist
= MUI_CreateCustomClass(NULL
,MUIC_List
,NULL
,sizeof(struct DispIDlist_Data
),DispIDlist_Dispatcher
);
2521 CL_DispIDinfo
= MUI_CreateCustomClass(NULL
,MUIC_Group
,NULL
,sizeof(struct DispIDinfo_Data
),DispIDinfo_Dispatcher
);
2522 CL_ScreenList
= MUI_CreateCustomClass(NULL
,MUIC_List
,NULL
,sizeof(struct ScreenList_Data
),ScreenList_Dispatcher
);
2523 CL_ScreenPanel
= MUI_CreateCustomClass(NULL
,MUIC_Group
,NULL
,sizeof(struct ScreenPanel_Data
),ScreenPanel_Dispatcher
);
2524 CL_MainWindow
= MUI_CreateCustomClass(NULL
,MUIC_Window
,NULL
,sizeof(struct MainWindow_Data
),MainWindow_Dispatcher
);
2526 if (CL_SysPenField
&& CL_EditWindow
&& CL_EditPanel
&& CL_DispIDlist
&& CL_DispIDinfo
&& CL_ScreenList
&& CL_ScreenPanel
&& CL_MainWindow
)
2534 const char CLITemplate
[] = "NAME,OPEN/S,CLOSE/S";
2536 const char CLIHelp
[] = "\
2538 Usage: PSI <name> OPEN/CLOSE\n\
2539 <name>: name of (preconfigured) public screen\n\
2540 OPEN : open this public screen\n\
2541 CLOSE: close this public screen\n\
2544 LONG
HandleArgs(Object
*mainwin
)
2546 struct MUI_PubScreenDesc
*desc
;
2547 struct RDArgs
*rda
,*rdas
;
2554 } argarray
= { 0,0,0 };
2556 if (rdas
= AllocDosObject(DOS_RDARGS
,NULL
))
2558 rdas
->RDA_ExtHelp
= (char *)CLIHelp
;
2560 if (rda
= ReadArgs((char *)CLITemplate
,(LONG
*)&argarray
,rdas
))
2564 DoMethod(mainwin
,MUIM_ScreenList_Find
,argarray
.Name
,&desc
);
2569 msg
= MSG_CLI_SCREENNOTFOUND
;
2570 else if (MUIS_OpenPubScreen(desc
))
2571 msg
= MSG_CLI_SCREENOPENED
;
2573 msg
= MSG_CLI_SCREENOPENFAILED
;
2575 else if (argarray
.Close
)
2578 msg
= MSG_CLI_SCREENNOTFOUND
;
2579 else if (MUIS_ClosePubScreen(desc
->Name
))
2580 msg
= MSG_CLI_SCREENCLOSED
;
2582 msg
= MSG_CLI_SCREENCLOSEFAILED
;
2587 if (argarray
.Open
|| argarray
.Close
)
2588 msg
= MSG_CLI_SYNTAXERROR
;
2592 FreeDosObject(DOS_RDARGS
,rdas
);
2595 msg
= MSG_CLI_OUTOFMEMORY
;
2602 /****************************************************************************/
2604 /****************************************************************************/
2606 int main(int argc
,char *argv
[])
2608 extern struct WBStartup
*_WBenchMsg
;
2609 struct MUIS_InfoClient sic
;
2622 app
= ApplicationObject
,
2623 MUIA_Application_Title
, "PSI",
2624 MUIA_Application_Version
, VersionString
,
2625 MUIA_Application_Copyright
, "©1995-97, Stefan Stuntz",
2626 MUIA_Application_Author
, "Stefan Stuntz",
2627 MUIA_Application_Description
, "Public Screen Inspector",
2628 MUIA_Application_Base
, "PSI",
2629 MUIA_Application_Window
, win
= NewObject(CL_MainWindow
->mcc_Class
,NULL
,TAG_DONE
),
2634 if (/*argc==0*/ _WBenchMsg
)
2637 msg
= HandleArgs(win
);
2641 set(win
,MUIA_Window_Open
,TRUE
);
2643 /* special magic to keep track about public screen open/close status */
2644 sic
.task
= FindTask(NULL
);
2645 sic
.sigbit
= SIGBREAKF_CTRL_E
;
2646 MUIS_AddInfoClient(&sic
);
2648 while (DoMethod(app
,MUIM_Application_NewInput
,&sigs
) != MUIV_Application_ReturnID_Quit
)
2652 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
| SIGBREAKF_CTRL_E
| SIGBREAKF_CTRL_F
);
2654 /* quit when receiving break from console */
2655 if (sigs
& SIGBREAKF_CTRL_C
)
2658 /* update listview whenever a screen was opened/closed */
2659 if (sigs
& SIGBREAKF_CTRL_E
)
2660 DoMethod(win
,MUIM_ScreenPanel_Update
);
2662 /* deiconify & activate on ctrl-f just like the other prefs programs */
2663 if (sigs
& SIGBREAKF_CTRL_F
)
2665 set(app
,MUIA_Application_Iconified
,FALSE
);
2666 set(win
,MUIA_Window_Open
,TRUE
);
2671 MUIS_RemInfoClient(&sic
);
2673 DoMethod(win
,MUIM_ScreenPanel_CloseWindows
);
2674 set(win
,MUIA_Window_Open
,FALSE
);
2676 MUI_DisposeObject(app
);
2678 else msg
= MSG_CLI_NOAPPLICATION
;
2681 else msg
= MSG_CLI_OUTOFMEMORY
;
2684 else msg
= MSG_CLI_NOMUIMASTER
;
2688 char *str
= GetStr(msg
);
2689 char *c
= strchr(str
,'(');
2690 Write(Output(),str
,strlen(str
));
2691 res
= c
? atol(c
+1) : RETURN_OK
;