revert between 56095 -> 55830 in arch
[AROS.git] / workbench / prefs / PSI / editpanel_class.c
blobaa0c63f061aa76c79210515fc70e8c8e41fee1d0
1 /*
2 Copyright © 1995-1997 Stefan Stuntz.
3 Copyright © 2009-2011, The AROS Development Team.
4 All rights reserved.
6 $Id$
7 */
9 #define MUI_OBSOLETE
11 #include <libraries/muiscreen.h>
13 #include <proto/muiscreen.h>
14 #include <proto/intuition.h>
15 #include <proto/muimaster.h>
16 #include <proto/asl.h>
17 #include <proto/intuition.h>
18 #include <proto/graphics.h>
20 #include <string.h>
21 #include <stdlib.h>
23 #include "displayidlist_class.h"
24 #include "displayidinfo_class.h"
25 #include "editpanel_class.h"
26 #include "syspenfield_class.h"
28 /****************************************************************************************/
30 #define ForChilds(group) \
32 APTR child,cstate;\
33 struct MinList *list;\
34 get(group,MUIA_Group_ChildList,&list);\
35 cstate=list->mlh_Head;\
36 while (child=NextObject(&cstate))
38 #define NextChilds }
40 struct NewMenu PaletteMenu[] =
42 { NM_TITLE, (STRPTR)MSG_PALPRES_TITLE, 0 , 0,0,(APTR)0 },
43 { NM_ITEM , (STRPTR)MSG_PALPRES_CLONEWB , 0,0,0,(APTR)10},
44 { NM_ITEM , (STRPTR)NM_BARLABEL , 0,0,0,(APTR)0 },
45 { NM_ITEM , (STRPTR)MSG_PALPRES_MAGICWB , 0,0,0,(APTR)9 },
46 { NM_ITEM , (STRPTR)NM_BARLABEL , 0,0,0,(APTR)0 },
47 { NM_ITEM , (STRPTR)MSG_PALPRES_STANDARD , 0,0,0,(APTR)0 },
48 { NM_ITEM , (STRPTR)MSG_PALPRES_TINT , 0,0,0,(APTR)1 },
49 { NM_ITEM , (STRPTR)MSG_PALPRES_PHARAO , 0,0,0,(APTR)2 },
50 { NM_ITEM , (STRPTR)MSG_PALPRES_SUNSET , 0,0,0,(APTR)3 },
51 { NM_ITEM , (STRPTR)MSG_PALPRES_OCEAN , 0,0,0,(APTR)4 },
52 { NM_ITEM , (STRPTR)MSG_PALPRES_STEEL , 0,0,0,(APTR)5 },
53 { NM_ITEM , (STRPTR)MSG_PALPRES_CHOCOLATE, 0,0,0,(APTR)6 },
54 { NM_ITEM , (STRPTR)MSG_PALPRES_PEWTER , 0,0,0,(APTR)7 },
55 { NM_ITEM , (STRPTR)MSG_PALPRES_WINE , 0,0,0,(APTR)8 },
57 { NM_END,NULL,0,0,0,(APTR)0 },
60 CONST_STRPTR CYA_EditPages[] =
62 (CONST_STRPTR)MSG_EDITPAGE_ATTRIBUTES,
63 (CONST_STRPTR)MSG_EDITPAGE_DISPLAY,
64 (CONST_STRPTR)MSG_EDITPAGE_COLORS,
65 NULL
68 CONST_STRPTR CYA_Overscan[] =
70 (CONST_STRPTR)MSG_OVERSCAN_TEXT,
71 (CONST_STRPTR)MSG_OVERSCAN_GRAPHICS,
72 (CONST_STRPTR)MSG_OVERSCAN_EXTREME,
73 (CONST_STRPTR)MSG_OVERSCAN_MAXIMUM,
74 NULL
77 /****************************************************************************************/
79 struct EditPanel_Data
81 Object *TX_Info;
83 Object *CM_Adjustable;
86 Object *GR_EditPages;
88 Object *ST_Name;
89 Object *ST_Title;
90 Object *ST_Font;
91 Object *ST_Background;
92 Object *CM_AutoScroll;
93 Object *CM_NoDrag;
94 Object *CM_Exclusive;
95 Object *CM_Interleaved;
96 Object *CM_Behind;
97 Object *CM_SysDefault;
98 Object *CM_AutoClose;
99 Object *CM_CloseGadget;
101 Object *GR_Size;
102 Object *LV_Modes;
103 Object *LI_Modes;
104 Object *CY_Overscan;
105 Object *ST_Width;
106 Object *ST_Height;
107 Object *SL_Depth;
108 Object *TX_ModeInfo;
110 Object *palette[PSD_NUMCOLS];
111 Object *syspens[PSD_NUMSYSPENS];
112 /*Object *muipens[PSD_NUMMUIPENS];*/
113 Object *ColorMenu;
115 LONG update;
118 /****************************************************************************************/
120 IPTR EditPanel_SetScreen(struct IClass *cl, Object *obj, struct MUIP_EditPanel_SetScreen *msg)
122 struct EditPanel_Data *data = INST_DATA(cl, obj);
123 struct MUI_PubScreenDesc *desc = msg->desc;
124 int i;
126 set(data->ST_Name , MUIA_String_Contents, desc->Name );
127 set(data->ST_Title , MUIA_String_Contents, desc->Title );
128 set(data->ST_Font , MUIA_String_Contents, desc->Font );
129 set(data->ST_Background, MUIA_String_Contents, desc->Background);
132 set(data->CM_Adjustable ,MUIA_Selected ,!desc->Foreign );
134 set(data->CM_AutoScroll , MUIA_Selected, desc->AutoScroll );
135 set(data->CM_NoDrag , MUIA_Selected, desc->NoDrag );
136 set(data->CM_Exclusive , MUIA_Selected, desc->Exclusive );
137 set(data->CM_Interleaved, MUIA_Selected, desc->Interleaved);
138 set(data->CM_SysDefault , MUIA_Selected, desc->SysDefault );
139 set(data->CM_Behind , MUIA_Selected, desc->Behind );
140 set(data->CM_AutoClose , MUIA_Selected, desc->AutoClose );
141 set(data->CM_CloseGadget, MUIA_Selected, desc->CloseGadget);
143 set(data->LI_Modes, MUIA_DispIDlist_CurrentID, desc->DisplayID);
145 setstr(data->ST_Width, desc->DisplayWidth);
146 setstr(data->ST_Height, desc->DisplayHeight);
147 set(data->SL_Depth, MUIA_Slider_Level, desc->DisplayDepth);
148 set(data->CY_Overscan, MUIA_Cycle_Active, desc->OverscanType);
150 for (i = 0; i < PSD_NUMCOLS; i++)
152 set(data->palette[i], MUIA_Pendisplay_RGBcolor, &desc->Palette[i]);
156 for (i=0;i<PSD_NUMMUIPENS;i++)
158 set(data->muipens[i],MUIA_Pendisplay_Spec,&desc->MUIPens[i]);
162 for (i = 0; i < PSD_NUMSYSPENS; i++)
164 if (data->syspens[i])
166 BYTE p = desc->SystemPens[i];
167 p = BETWEEN(0, p, 3) ? p : BETWEEN(-4, p, -1) ? 8 + p : 0;
168 set(data->syspens[i], MUIA_Pendisplay_Reference, data->palette[p]);
172 return 0;
175 /****************************************************************************************/
177 IPTR EditPanel_GetScreen(struct IClass *cl, Object *obj, struct MUIP_EditPanel_GetScreen *msg)
179 struct EditPanel_Data *data = INST_DATA(cl, obj);
180 struct MUI_PubScreenDesc *desc = msg->desc;
181 int i;
183 strcpy(desc->Name , getstr(data->ST_Name ));
184 strcpy(desc->Title , getstr(data->ST_Title ));
185 strcpy(desc->Font , getstr(data->ST_Font ));
186 strcpy(desc->Background, getstr(data->ST_Background));
189 desc->Foreign = !getbool(data->CM_Adjustable );
191 desc->AutoScroll = getbool(data->CM_AutoScroll );
192 desc->NoDrag = getbool(data->CM_NoDrag );
193 desc->Exclusive = getbool(data->CM_Exclusive );
194 desc->Interleaved = getbool(data->CM_Interleaved);
195 desc->SysDefault = getbool(data->CM_SysDefault );
196 desc->Behind = getbool(data->CM_Behind );
197 desc->AutoClose = getbool(data->CM_AutoClose );
198 desc->CloseGadget = getbool(data->CM_CloseGadget);
200 desc->DisplayID = xget(data->LI_Modes, MUIA_DispIDlist_CurrentID);
201 desc->DisplayWidth = atol(getstr(data->ST_Width ));
202 desc->DisplayHeight = atol(getstr(data->ST_Height));
204 desc->DisplayDepth = xget(data->SL_Depth, MUIA_Slider_Level);
205 desc->OverscanType = xget(data->CY_Overscan, MUIA_Cycle_Active);
207 for (i = 0; i < PSD_NUMCOLS; i++)
209 desc->Palette[i] = *((struct MUI_RGBcolor *)xget(data->palette[i], MUIA_Pendisplay_RGBcolor));
213 for (i=0;i<PSD_NUMMUIPENS;i++)
215 desc->MUIPens[i] = *((struct MUI_PenSpec *)xget(data->muipens[i],MUIA_Pendisplay_Spec));
219 for (i = 0; i < PSD_NUMSYSPENS; i++)
221 if (data->syspens[i])
223 BYTE p = muiUserData(xget(data->syspens[i], MUIA_Pendisplay_Reference));
224 desc->SystemPens[i] = BETWEEN(1, p, 4) ? p - 1 : p - 9;
228 return 0;
231 /****************************************************************************************/
233 IPTR EditPanel_ContextMenuChoice(struct IClass *cl, Object *obj, struct MUIP_ContextMenuChoice *msg)
235 struct PalettePreset
237 struct MUI_RGBcolor col[8];
240 static const struct PalettePreset PalettePreset[10] =
242 /* def */
245 { 0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA },
246 { 0x00000000,0x00000000,0x00000000 },
247 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
248 { 0x66666666,0x88888888,0xBBBBBBBB },
249 { 0xEEEEEEEE,0x44444444,0x44444444 },
250 { 0x55555555,0xDDDDDDDD,0x55555555 },
251 { 0x00000000,0x44444444,0xDDDDDDDD },
252 { 0xEEEEEEEE,0x99999999,0x00000000 },
255 /* tint */
258 { 0xCCCCCCCC,0xCCCCCCCC,0xBBBBBBBB },
259 { 0x00000000,0x00000000,0x33333333 },
260 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
261 { 0x99999999,0xAAAAAAAA,0xBBBBBBBB },
262 { 0xEEEEEEEE,0x44444444,0x44444444 },
263 { 0x55555555,0xDDDDDDDD,0x55555555 },
264 { 0xE0E0E0E0,0xF0F0F0F0,0x88888888 },
265 { 0x00000000,0x44444444,0xDDDDDDDD },
268 /* pharao */
271 { 0x55555555,0xBBBBBBBB,0xAAAAAAAA },
272 { 0x00000000,0x00000000,0x22222222 },
273 { 0xEEEEEEEE,0xEEEEEEEE,0xFFFFFFFF },
274 { 0x55555555,0x77777777,0xAAAAAAAA },
275 { 0xF6F6F6F6,0xF6F6F6F6,0x00000000 },
276 { 0x62626262,0x51515151,0xF0F0F0F0 },
277 { 0x00000000,0xF0F0F0F0,0x00000000 },
278 { 0xF0F0F0F0,0x30303030,0x10101010 },
281 /* sunset */
284 { 0xAAAAAAAA,0x99999999,0x88888888 },
285 { 0x33333333,0x22222222,0x11111111 },
286 { 0xFFFFFFFF,0xEEEEEEEE,0xEEEEEEEE },
287 { 0xFFFFFFFF,0xDDDDDDDD,0xBBBBBBBB },
288 { 0xEEEEEEEE,0x44444444,0x44444444 },
289 { 0x55555555,0xDDDDDDDD,0x55555555 },
290 { 0xCFCFCFCF,0xDBDBDBDB,0xFFFFFFFF },
291 { 0x00000000,0x44444444,0xDDDDDDDD },
294 /* ocean */
297 { 0x88888888,0xAAAAAAAA,0xCCCCCCCC },
298 { 0x00000000,0x00000000,0x22222222 },
299 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
300 { 0xFFFFFFFF,0xCCCCCCCC,0x99999999 },
301 { 0x00000000,0x00000000,0xF0F0F0F0 },
302 { 0xF9F9F9F9,0x21212121,0x21212121 },
303 { 0x52525252,0xF2F2F2F2,0x76767676 },
304 { 0xDFDFDFDF,0xA5A5A5A5,0x26262626 },
307 /* steel */
310 { 0x99999999,0xBBBBBBBB,0xDDDDDDDD },
311 { 0x00000000,0x00000000,0x22222222 },
312 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
313 { 0x66666666,0x88888888,0xBBBBBBBB },
314 { 0xB2B2B2B2,0xDEDEDEDE,0xFFFFFFFF },
315 { 0xFFFFFFFF,0xA1A1A1A1,0x1C1C1C1C },
316 { 0xF0F0F0F0,0x44444444,0x87878787 },
317 { 0xBFBFBFBF,0xFFFFFFFF,0x90909090 },
320 /* chocolate */
323 { 0xBBBBBBBB,0xAAAAAAAA,0x99999999 },
324 { 0x00000000,0x00000000,0x22222222 },
325 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
326 { 0x66666666,0x88888888,0xBBBBBBBB },
327 { 0xEEEEEEEE,0x44444444,0x44444444 },
328 { 0x55555555,0xDDDDDDDD,0x55555555 },
329 { 0x00000000,0x44444444,0xDDDDDDDD },
330 { 0xEEEEEEEE,0x99999999,0x00000000 },
333 /* pewter */
336 { 0x88888888,0xAAAAAAAA,0xCCCCCCCC },
337 { 0x00000000,0x00000000,0x22222222 },
338 { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF },
339 { 0xEEEEEEEE,0x99999999,0x77777777 },
340 { 0xD9D9D9D9,0xFFFFFFFF,0x09090909 },
341 { 0xF0F0F0F0,0x2D2D2D2D,0x31313131 },
342 { 0x38383838,0xF2F2F2F2,0x38383838 },
343 { 0x44444444,0x49494949,0xF0F0F0F0 },
346 /* wine */
349 { 0xCCCCCCCC,0x99999999,0x99999999 },
350 { 0x00000000,0x00000000,0x22222222 },
351 { 0xFFFFFFFF,0xEEEEEEEE,0xEEEEEEEE },
352 { 0xBBBBBBBB,0x66666666,0x77777777 },
353 { 0xE0E0E0E0,0xF0F0F0F0,0x88888888 },
354 { 0x79797979,0x46464646,0xE8E8E8E8 },
355 { 0x60606060,0xC7C7C7C7,0x52525252 },
356 { 0x89898989,0xEAEAEAEA,0xC8C8C8C8 },
359 /* magicwb */
362 { 0x95959595,0x95959595,0x95959595 },
363 { 0x00000000,0x00000000,0x00000000 },
364 { 0xffffffff,0xffffffff,0xffffffff },
365 { 0x3b3b3b3b,0x67676767,0xa2a2a2a2 },
366 { 0x7b7b7b7b,0x7b7b7b7b,0x7b7b7b7b },
367 { 0xafafafaf,0xafafafaf,0xafafafaf },
368 { 0xaaaaaaaa,0x90909090,0x7c7c7c7c },
369 { 0xffffffff,0xa9a9a9a9,0x97979797 },
373 /*{ 0, 1, 1, 2, 1, 3, 1, 0, 2, 1, 2, 1 }*/
375 LONG i = muiUserData(msg->item);
376 struct MUI_PubScreenDesc *desc = NULL;
377 struct MUI_RGBcolor *new = NULL;
378 struct EditPanel_Data *data = INST_DATA(cl,obj);
380 if (i >= 0 && i < 10)
382 new = (struct MUI_RGBcolor *)PalettePreset[i].col;
384 else if (i == 10)
386 if ((desc = MUIS_AllocPubScreenDesc(NULL)))
388 new = desc->Palette;
392 if (new)
394 for (i = 0; i < PSD_NUMCOLS; i++)
396 set(data->palette[i], MUIA_Pendisplay_RGBcolor, &new[i]);
400 if (desc)
401 MUIS_FreePubScreenDesc(desc);
403 return 0;
406 /****************************************************************************************/
408 IPTR EditPanel_New(struct IClass *cl, Object *obj, struct opSet *msg)
410 struct EditPanel_Data tmp = {0};
411 Object *l1,*l2;
413 obj = (Object *)DoSuperNewTags(cl, obj, NULL,
414 MUIA_Group_Horiz, FALSE,
416 MUIA_ContextMenu, tmp.ColorMenu = MUI_MakeObject(MUIO_MenustripNM, PaletteMenu, MUIO_MenustripNM_CommandKeyCheck),
419 Child, HGroup, GroupSpacing(1),
420 MUIA_Weight, 0,
422 Child, tmp.TX_Info = TextObject,
423 TextFrame, MUIA_Background, MUII_TextBack, MUIA_Text_PreParse, "\33c",
424 End,
426 Child, tmp.CM_Adjustable = MUI_MakeObject(MUIO_Checkmark,NULL),
427 End,
430 Child, tmp.GR_EditPages = RegisterGroup(CYA_EditPages),
431 MUIA_CycleChain, 1,
433 Child, ColGroup(2),
434 Child, MakeLabel2(MSG_LABEL_PUBLICNAME),
435 Child, tmp.ST_Name = MUI_NewObject(MUIC_Popscreen,
436 MUIA_Popstring_String, MakeString(PSD_MAXLEN_NAME, MSG_LABEL_PUBLICNAME),
437 MUIA_Popstring_Button, PopButton(MUII_PopUp),
438 TAG_DONE),
439 Child, MakeLabel2(MSG_LABEL_SCREENTITLE),
440 Child, tmp.ST_Title = MakeString(PSD_MAXLEN_TITLE,MSG_LABEL_SCREENTITLE),
441 Child, MakeLabel2(MSG_LABEL_DEFAULTFONT),
442 Child, tmp.ST_Font = PopaslObject,
443 MUIA_Popstring_String, MakeString(PSD_MAXLEN_FONT,MSG_LABEL_DEFAULTFONT),
444 MUIA_Popstring_Button, PopButton(MUII_PopUp),
445 MUIA_Popasl_Type, ASL_FontRequest,
446 End,
447 Child, MakeLabel2(MSG_LABEL_BACKGROUND ),
448 Child, tmp.ST_Background = PopaslObject,
449 MUIA_Popstring_String, MakeString(PSD_MAXLEN_BACKGROUND,MSG_LABEL_BACKGROUND),
450 MUIA_Popstring_Button, PopButton(MUII_PopUp),
451 MUIA_Popasl_Type, ASL_FileRequest,
452 End,
453 Child, VSpace(2), Child, VSpace(2),
454 Child, MakeFreeLabel(MSG_LABEL_PUBLICFLAGS),
455 Child, HGroup,
456 Child, ColGroup(2),
457 Child, tmp.CM_AutoScroll = MakeCheck(MSG_LABEL_AUTOSCROLL ), Child, MakeLLabel1(MSG_LABEL_AUTOSCROLL ),
458 Child, tmp.CM_NoDrag = MakeCheck(MSG_LABEL_NODRAG ), Child, MakeLLabel1(MSG_LABEL_NODRAG ),
459 Child, tmp.CM_Exclusive = MakeCheck(MSG_LABEL_EXCLUSIVE ), Child, MakeLLabel1(MSG_LABEL_EXCLUSIVE ),
460 End,
461 Child, HSpace(0),
462 Child, ColGroup(2),
463 Child, tmp.CM_AutoClose = MakeCheck(MSG_LABEL_AUTOCLOSE ), Child, MakeLLabel1(MSG_LABEL_AUTOCLOSE ),
464 Child, tmp.CM_Interleaved = MakeCheck(MSG_LABEL_INTERLEAVED ), Child, MakeLLabel1(MSG_LABEL_INTERLEAVED ),
465 Child, tmp.CM_Behind = MakeCheck(MSG_LABEL_OPENBEHIND ), Child, MakeLLabel1(MSG_LABEL_OPENBEHIND ),
466 End,
467 Child, HSpace(0),
468 Child, ColGroup(2),
469 Child, tmp.CM_SysDefault = MakeCheck(MSG_LABEL_SYSTEMDEFAULT), Child, MakeLLabel1(MSG_LABEL_SYSTEMDEFAULT),
470 Child, tmp.CM_CloseGadget = MakeCheck(MSG_LABEL_CLOSEGADGET ), Child, MakeLLabel1(MSG_LABEL_CLOSEGADGET ),
471 Child, VSpace(0), Child, VSpace(0),
472 End,
473 End,
474 End,
476 Child, HGroup,
477 Child, tmp.LV_Modes = ListviewObject,
478 MUIA_CycleChain, 1,
479 MUIA_Listview_List, tmp.LI_Modes = NewObject(CL_DispIDlist->mcc_Class, NULL,
480 InputListFrame,
481 MUIA_List_AdjustWidth, TRUE,
482 TAG_DONE),
483 End,
484 Child, VGroup,
485 Child, ScrollgroupObject,
486 MUIA_Scrollgroup_FreeHoriz, FALSE,
487 MUIA_Scrollgroup_Contents, VirtgroupObject,
488 TextFrame,
489 GroupSpacing(0),
490 MUIA_Group_Horiz, TRUE,
491 Child, tmp.TX_ModeInfo = NewObject(CL_DispIDinfo->mcc_Class,NULL,TAG_DONE),
492 Child, HSpace(0),
493 End,
494 End,
495 Child, RectangleObject, MUIA_VertWeight, 1, End,
496 Child, tmp.GR_Size = ColGroup(2),
497 Child, MakeLabel1(MSG_LABEL_OVERSCAN), Child, tmp.CY_Overscan = MakeCycle(CYA_Overscan,MSG_LABEL_OVERSCAN),
498 Child, MakeLabel2(MSG_LABEL_SIZE),
499 Child, HGroup,
500 Child, tmp.ST_Width = MakeString(8,MSG_LABEL_SIZE),
501 Child, MakeLabel2(MSG_LABEL_CROSS),
502 Child, tmp.ST_Height = MakeString(8,MSG_LABEL_CROSS),
503 End,
504 Child, MakeLabel2(MSG_LABEL_DEPTH), Child, tmp.SL_Depth = MakeSlider(1, 24, MSG_LABEL_DEPTH),
505 End,
506 End,
507 End,
509 Child, VGroup,
510 Child, ColGroup(3),
511 GroupFrameT(GetStr(MSG_PALETTE_TITLE)),
512 MUIA_Group_VertSpacing, 1,
513 Child, l1 = MakeCLabel(MSG_PALETTE_FIRST),
514 Child, HSpace(4),
515 Child, l2 = MakeCLabel(MSG_PALETTE_LAST),
516 Child, HGroup,
517 Child, tmp.palette[0] = MakePalette(),
518 Child, tmp.palette[1] = MakePalette(),
519 Child, tmp.palette[2] = MakePalette(),
520 Child, tmp.palette[3] = MakePalette(),
521 End,
522 Child, HSpace(4),
523 Child, HGroup,
524 Child, tmp.palette[4] = MakePalette(),
525 Child, tmp.palette[5] = MakePalette(),
526 Child, tmp.palette[6] = MakePalette(),
527 Child, tmp.palette[7] = MakePalette(),
528 End,
529 End,
530 Child, HGroup,
531 Child, ColGroup(3),
532 GroupFrameT(GetStr(MSG_SYSPENS_TITLE)),
533 Child, MakeSysPen(MSG_SYSPEN_TEXT ,&tmp.syspens[TEXTPEN ]),
534 Child, MakeSysPen(MSG_SYSPEN_SHINE ,&tmp.syspens[SHINEPEN ]),
535 Child, MakeSysPen(MSG_SYSPEN_SHADOW ,&tmp.syspens[SHADOWPEN ]),
536 Child, MakeSysPen(MSG_SYSPEN_FILL ,&tmp.syspens[FILLPEN ]),
537 Child, MakeSysPen(MSG_SYSPEN_FILLTEXT ,&tmp.syspens[FILLTEXTPEN ]),
538 Child, MakeSysPen(MSG_SYSPEN_HIGHLIGHT,&tmp.syspens[HIGHLIGHTTEXTPEN]),
539 Child, MakeSysPen(MSG_SYSPEN_BARDETAIL,&tmp.syspens[BARDETAILPEN ]),
540 Child, MakeSysPen(MSG_SYSPEN_BARBLOCK ,&tmp.syspens[BARBLOCKPEN ]),
541 Child, MakeSysPen(MSG_SYSPEN_BARTRIM ,&tmp.syspens[BARTRIMPEN ]),
542 End,
544 Child, VGroup,
545 GroupFrameT(GetStr(MSG_MUIPENS_TITLE)),
546 Child, ColGroup(3),
547 Child, MakeMUIPen(MSG_MUIPEN_SHINE ,&tmp.muipens[MPEN_SHINE ]),
548 Child, MakeMUIPen(MSG_MUIPEN_HALFSHINE ,&tmp.muipens[MPEN_HALFSHINE ]),
549 Child, MakeMUIPen(MSG_MUIPEN_BACKGROUND,&tmp.muipens[MPEN_BACKGROUND]),
550 Child, MakeMUIPen(MSG_MUIPEN_HALFSHADOW,&tmp.muipens[MPEN_HALFSHADOW]),
551 Child, MakeMUIPen(MSG_MUIPEN_SHADOW ,&tmp.muipens[MPEN_SHADOW ]),
552 Child, MakeMUIPen(MSG_MUIPEN_TEXT ,&tmp.muipens[MPEN_TEXT ]),
553 Child, MakeMUIPen(MSG_MUIPEN_FILL ,&tmp.muipens[MPEN_FILL ]),
554 Child, MakeMUIPen(MSG_MUIPEN_MARK ,&tmp.muipens[MPEN_MARK ]),
555 End,
556 End,
558 End,
559 End,
561 End,
562 TAG_MORE, msg->ops_AttrList);
564 if (obj)
566 struct EditPanel_Data *data = INST_DATA(cl, obj);
567 int i;
569 *data = tmp;
571 DoMethod(tmp.LI_Modes , MUIM_Notify,MUIA_DispIDlist_CurrentID, MUIV_EveryTime, obj, 2,MUIM_EditPanel_Update, 3);
572 DoMethod(tmp.CY_Overscan, MUIM_Notify,MUIA_Cycle_Active , MUIV_EveryTime, obj, 2,MUIM_EditPanel_Update, 2);
573 DoMethod(tmp.ST_Width , MUIM_Notify,MUIA_String_Acknowledge , MUIV_EveryTime, obj, 2,MUIM_EditPanel_Update, 1);
574 DoMethod(tmp.ST_Height , MUIM_Notify,MUIA_String_Acknowledge , MUIV_EveryTime, obj, 2,MUIM_EditPanel_Update, 1);
575 DoMethod(tmp.SL_Depth , MUIM_Notify,MUIA_Slider_Level , MUIV_EveryTime, obj, 2,MUIM_EditPanel_Update, 1);
578 set(tmp.CM_Adjustable,MUIA_Selected,TRUE);
579 DoMethod(tmp.CM_Adjustable,MUIM_Notify,MUIA_Selected ,MUIV_EveryTime,obj,1,MUIM_EditPanel_ToggleForeign);
582 set(tmp.TX_Info , MUIA_ShortHelp, GetStr(MSG_HELP_INFO ));
584 set(tmp.CM_Adjustable ,MUIA_ShortHelp,GetStr(MSG_HELP_ADJUSTABLE ));
586 set(tmp.ST_Name , MUIA_ShortHelp, GetStr(MSG_HELP_NAME ));
587 set(tmp.ST_Title , MUIA_ShortHelp, GetStr(MSG_HELP_TITLE ));
588 set(tmp.ST_Font , MUIA_ShortHelp, GetStr(MSG_HELP_FONT ));
589 set(tmp.ST_Background , MUIA_ShortHelp, GetStr(MSG_HELP_BACKGROUND ));
590 set(tmp.CM_AutoScroll , MUIA_ShortHelp, GetStr(MSG_HELP_AUTOSCROLL ));
591 set(tmp.CM_NoDrag , MUIA_ShortHelp, GetStr(MSG_HELP_NODRAG ));
592 set(tmp.CM_Exclusive , MUIA_ShortHelp, GetStr(MSG_HELP_EXCLUSIVE ));
593 set(tmp.CM_Interleaved, MUIA_ShortHelp, GetStr(MSG_HELP_INTERLEAVED ));
594 set(tmp.CM_Behind , MUIA_ShortHelp, GetStr(MSG_HELP_BEHIND ));
595 set(tmp.CM_AutoClose , MUIA_ShortHelp, GetStr(MSG_HELP_AUTOCLOSE ));
596 set(tmp.CM_CloseGadget, MUIA_ShortHelp, GetStr(MSG_HELP_CLOSEGADGET ));
597 set(tmp.CM_SysDefault , MUIA_ShortHelp, GetStr(MSG_HELP_SYSTEMDEFAULT));
598 set(tmp.LV_Modes , MUIA_ShortHelp, GetStr(MSG_HELP_MODELIST ));
599 set(tmp.CY_Overscan , MUIA_ShortHelp, GetStr(MSG_HELP_OVERSCAN ));
600 set(tmp.ST_Width , MUIA_ShortHelp, GetStr(MSG_HELP_WIDTH ));
601 set(tmp.ST_Height , MUIA_ShortHelp, GetStr(MSG_HELP_HEIGHT ));
602 set(tmp.SL_Depth , MUIA_ShortHelp, GetStr(MSG_HELP_DEPTH ));
603 set(tmp.TX_ModeInfo , MUIA_ShortHelp, GetStr(MSG_HELP_MODEINFO ));
605 for (i = 0; i < 8; i++)
606 set(data->palette[i], MUIA_UserData, i + 1);
608 set(l1, MUIA_Font,MUIV_Font_Tiny);
609 set(l2, MUIA_Font,MUIV_Font_Tiny);
612 DoMethod(obj,MUIM_EditPanel_ToggleForeign);
616 if (IntuitionBase->lib_Version<39)
617 set(tmp.ST_Background,MUIA_Disabled,TRUE);
620 return (IPTR)obj;
623 return 0;
626 /****************************************************************************************/
628 IPTR EditPanel_Dispose(struct IClass *cl,Object *obj,Msg msg)
630 struct EditPanel_Data *data = INST_DATA(cl, obj);
632 if (data->ColorMenu)
633 MUI_DisposeObject(data->ColorMenu);
635 return DoSuperMethodA(cl, obj, msg);
640 ULONG EditPanel_ToggleForeign(struct IClass *cl,Object *obj,Msg msg)
642 struct EditPanel_Data *data = INST_DATA(cl,obj);
643 BOOL disable = !getbool(data->CM_Adjustable);
645 if (disable)
646 set(data->GR_EditPages,MUIA_Group_ActivePage,2);
648 DoMethod(obj,MUIM_EditPanel_Update,1);
650 DoMethod(obj,MUIM_MultiSet,MUIA_Disabled,disable,
651 data->ST_Title,
652 data->ST_Font,
653 data->ST_Background,
654 data->CM_AutoScroll,
655 data->CM_NoDrag,
656 data->CM_Exclusive,
657 data->CM_Interleaved,
658 data->CM_Behind,
659 data->CM_SysDefault,
660 data->CM_AutoClose,
661 data->CM_CloseGadget,
662 data->LV_Modes,
663 data->CY_Overscan,
664 data->ST_Width,
665 data->ST_Height,
666 data->SL_Depth,
667 data->TX_ModeInfo,
668 NULL);
670 return(0);
674 /****************************************************************************************/
676 IPTR EditPanel_Update(struct IClass *cl, Object *obj, struct MUIP_EditPanel_Update *msg)
678 struct EditPanel_Data *data = INST_DATA(cl, obj);
679 struct NameInfo *ni;
680 struct DimensionInfo DimensionInfo;
682 if (data->update)
683 return 0;
684 data->update = TRUE;
687 if (getbool(data->CM_Adjustable))
690 DoMethod(data->LI_Modes, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &ni);
692 if (ni && GetDisplayInfoData(NULL, (char *)&DimensionInfo, sizeof(DimensionInfo), DTAG_DIMS, ni->Header.DisplayID))
694 /*set(data->GR_SysPots,MUIA_Coloradjust_ModeID,ni->Header.DisplayID); !!!*/
696 if (msg->level >= 1)
698 set(data->GR_Size, MUIA_Disabled, FALSE);
699 set(data->SL_Depth, MUIA_Slider_Max, DimensionInfo.MaxDepth);
702 if (msg->level >= 3)
703 set(data->TX_ModeInfo, MUIA_DispIDinfo_ID, ni->Header.DisplayID);
705 if (msg->level >= 2)
707 int w = RectangleWidth(DimensionInfo.TxtOScan);
708 int h = RectangleHeight(DimensionInfo.TxtOScan);
710 switch (xget(data->CY_Overscan, MUIA_Cycle_Active))
712 case 1:
713 w = RectangleWidth(DimensionInfo.StdOScan);
714 h = RectangleHeight(DimensionInfo.StdOScan);
715 break;
717 case 2:
718 w = RectangleWidth(DimensionInfo.MaxOScan);
719 h = RectangleHeight(DimensionInfo.MaxOScan);
720 break;
722 case 3:
723 w = RectangleWidth(DimensionInfo.VideoOScan);
724 h = RectangleHeight(DimensionInfo.VideoOScan);
725 break;
728 setstr(data->ST_Width , w);
729 setstr(data->ST_Height, h);
732 if (msg->level >= 1)
733 DoMethod
735 data->TX_Info, MUIM_SetAsString, MUIA_Text_Contents, "%s (%ld x %ld x %ld)",
736 ni->Name, atol(getstr(data->ST_Width)), atol(getstr(data->ST_Height)),
737 xget(data->SL_Depth, MUIA_Slider_Level)
740 else
742 /* set(data->GR_SysPots,MUIA_Coloradjust_ModeID,INVALID_ID); !!!*/
743 set(data->TX_ModeInfo, MUIA_DispIDinfo_ID, INVALID_ID);
744 set(data->TX_Info, MUIA_Text_Contents, GetStr(MSG_TEXT_UNKNOWNMODE));
745 set(data->GR_Size, MUIA_Disabled, TRUE);
749 else
751 set(data->TX_Info,MUIA_Text_Contents,GetStr(MSG_TEXT_FOREIGNSCREEN));
755 data->update = FALSE;
756 return 0;
759 /****************************************************************************************/
761 BOOPSI_DISPATCHER(IPTR, EditPanel_Dispatcher, cl, obj, msg)
763 switch (msg->MethodID)
765 case OM_NEW : return EditPanel_New (cl,obj,(APTR)msg);
766 case OM_DISPOSE : return EditPanel_Dispose (cl,obj,(APTR)msg);
768 case MUIM_ContextMenuChoice : return EditPanel_ContextMenuChoice(cl,obj,(APTR)msg);
770 case MUIM_EditPanel_SetScreen : return EditPanel_SetScreen (cl,obj,(APTR)msg);
771 case MUIM_EditPanel_GetScreen : return EditPanel_GetScreen (cl,obj,(APTR)msg);
772 case MUIM_EditPanel_Update : return EditPanel_Update (cl,obj,(APTR)msg);
774 case MUIM_EditPanel_ToggleForeign: return EditPanel_ToggleForeign (cl,obj,(APTR)msg);
778 return DoSuperMethodA(cl,obj,msg);
780 BOOPSI_DISPATCHER_END
782 /****************************************************************************************/
784 VOID EditPanel_Init(VOID)
786 CL_EditPanel = MUI_CreateCustomClass
788 NULL, MUIC_Group, NULL, sizeof(struct EditPanel_Data), EditPanel_Dispatcher
792 /****************************************************************************************/
794 VOID EditPanel_Exit(VOID)
796 if (CL_EditPanel)
797 MUI_DeleteCustomClass(CL_EditPanel);