home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / texmf / source / driver / show / amiga / prefwin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-13  |  18.9 KB  |  693 lines

  1. #include "defines.h"
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <ctype.h>
  6.  
  7. #include <exec/types.h>
  8. #include <exec/lists.h>
  9. #include <intuition/intuition.h>
  10. #include <intuition/screens.h>
  11. #include <intuition/gadgetclass.h>
  12. #include <libraries/gadtools.h>
  13.  
  14. #include <clib/intuition_protos.h>
  15. #include <clib/dos_protos.h>
  16. #include <clib/graphics_protos.h>
  17. #include <clib/gadtools_protos.h>
  18.  
  19. #include <pragmas/intuition_pragmas.h>
  20. #include <pragmas/dos_pragmas.h>
  21. #include <pragmas/graphics_pragmas.h>
  22. #include <pragmas/gadtools_pragmas.h>
  23.  
  24.  
  25. #ifdef AZTEC_C
  26. #  include <functions.h>
  27. #endif
  28.  
  29.  
  30. #include "globals.h"
  31. #include "amscreen.h"
  32.  
  33. #include "amscreen.i"
  34. #include "am_requ.i"
  35. #include "prefwin.i"
  36. #include "globals.i"
  37. #include "help.i"
  38.  
  39.  
  40. /*
  41.  * Fuer die locale-Library:
  42.  *
  43.  * Hier duerfen *nur* die MSG_#? Nummern eingebunden werden!
  44.  * Achtung:
  45.  * Es muss/sollte 'multiple-include' erlaubt sein!
  46.  */
  47. #include "local.i"
  48.  
  49. #undef  CATCOMP_ARRAY
  50. #undef  CATCOMP_BLOCK
  51. #undef  CATCOMP_STRINGS
  52. #define CATCOMP_NUMBERS
  53. #include "localstr.h"
  54.  
  55.  
  56.  
  57. /*******************************************************************************/
  58. /*                 P R E F W I N D O W                   */
  59. /*******************************************************************************/
  60.  
  61.  
  62. #define INTERLACE_KNOB
  63.  
  64.  
  65. /* externals... */
  66. extern UBYTE         sig_prefwin;
  67. extern struct Screen    *screen;
  68. extern struct Window    *win2;
  69. extern struct TextAttr     txtAttr;
  70. extern short         HeightWintitle;
  71.  
  72.  
  73. /* defines... */
  74. #define NG_xsize    (NGAry + 0)
  75. #define NG_ysize    (NGAry + 1)
  76. #define NG_white    (NGAry + 2)
  77. #define NG_default    (NGAry + 3)
  78. #define NG_dvisize    (NGAry + 4)
  79. #define NG_use        (NGAry + 5)
  80. #define NG_cancel    (NGAry + 6)
  81. #define NG_ownscr    (NGAry + 7)
  82. #define NG_4col        (NGAry + 8)
  83. #define NG_scrmode    (NGAry + 9)
  84. #define NG_scrmname    (NGAry + 10)
  85.  
  86. #include "prefwin.h"    // Gadget Nummern GAD_#?
  87.  
  88. #define ACTION_NONE        ((short)0)
  89. #define ACTION_WINWIDTH        ((short)1)
  90. #define ACTION_WINHEIGHT    ((short)2)
  91. #define ACTION_WINWHITE        ((short)3)
  92. #define ACTION_WINDEFAULTSIZE    ((short)4)
  93. #define ACTION_WINDVISIZE    ((short)5)
  94. #define ACTION_WINUSE        ((short)6)
  95. #define ACTION_WINCANCEL    ((short)7)
  96. #define ACTION_WINOWNSCR    ((short)8)
  97. #define ACTION_WIN4COL        ((short)9)
  98. #define ACTION_WINSCRMODE    ((short)10)
  99. #define ACTION_WINSCRMNAME    ((short)11)
  100.  
  101.  
  102.  
  103. #define PREFWIN_WIDTH  350
  104. #define PREFWIN_HEIGHT 207
  105.  
  106.  
  107. /* globals (help.c) */
  108. struct Window    *PrefWin = NULL;    /* = NULL wichtig, damit wird gearbeitet! */
  109.  
  110.  
  111. /* locals... */
  112. static struct Gadget    *GList = NULL;
  113.  
  114. struct MyNewGadget {
  115.     struct NewGadget new;
  116.     short LeftEdge, TopEdge;
  117.     short Width, Height;
  118.     };
  119.  
  120. static struct MyNewGadget NGAry[] = {
  121.   {{0,0,0,0,NULL,NULL,GAD_xsize,PLACETEXT_LEFT,(void *)0L,(APTR)ACTION_WINWIDTH },       125,114, 50,20 },
  122.   {{0,0,0,0,NULL,NULL,GAD_ysize,PLACETEXT_LEFT,(void *)0L,(APTR)ACTION_WINHEIGHT },      125,141, 50,20 },
  123.   {{0,0,0,0,NULL,NULL,GAD_white,PLACETEXT_LEFT,(void *)0L,(APTR)ACTION_WINWHITE },       125,168, 50,20 },
  124.   {{0,0,0,0,NULL,NULL,GAD_default,PLACETEXT_IN,(void *)0L,(APTR)ACTION_WINDEFAULTSIZE }, 190,114,135,20 },
  125.   {{0,0,0,0,NULL,NULL,GAD_dvisize,PLACETEXT_IN,(void *)0L,(APTR)ACTION_WINDVISIZE },     190,141,135,20 },
  126.   {{0,0,0,0,NULL,NULL,GAD_use,PLACETEXT_IN,(void *)0L,(APTR)ACTION_WINUSE },          60,200, 80,20 },
  127.   {{0,0,0,0,NULL,NULL,GAD_cancel,PLACETEXT_IN,(void *)0L,(APTR)ACTION_WINCANCEL },     210,200, 80,20 },
  128.   {{0,0,0,0,NULL,NULL,GAD_ownscr,PLACETEXT_RIGHT,(void *)0L,(APTR)ACTION_WINOWNSCR },    125, 33, 50,20 },
  129.   {{0,0,0,0,NULL,NULL,GAD_4col,PLACETEXT_LEFT,(void *)0L,(APTR)ACTION_WIN4COL },         299,168, 50,20 },
  130.   {{0,0,0,0,NULL,NULL,GAD_scrmode,PLACETEXT_IN,(void *)0L,(APTR)ACTION_WINSCRMODE },     125, 60,200,20 },
  131.   {{0,0,0,0,NULL,NULL,GAD_scrmname,PLACETEXT_LEFT,(void *)0L,0 },             125, 87,200,20 }
  132. };
  133.  
  134. #define GADMAX    (sizeof(NGAry) / sizeof(struct MyNewGadget))
  135.  
  136.  
  137. static struct Gadget *Gad_xsize;
  138. static struct Gadget *Gad_ysize;
  139. static struct Gadget *Gad_default;
  140. static struct Gadget *Gad_dvisize;
  141. static struct Gadget *Gad_use;
  142. static struct Gadget *Gad_cancel;
  143. static struct Gadget *Gad_white;
  144. static struct Gadget *Gad_ownscr;
  145. static struct Gadget *Gad_4col;
  146. static struct Gadget *Gad_scrmode;
  147. static struct Gadget *Gad_scrmname;
  148.  
  149. static long new_is_lace;
  150. static long new_is_bhook;
  151. static long new_is_ownscr;
  152. static long new_is_4col;
  153. static long new_screen_mode;
  154.  
  155. static ULONG TmpModeID;        // hier wird die DisplayID gespeichert
  156.  
  157. static long DisableLace = FALSE;
  158.  
  159.  
  160.  
  161. static struct TagItem       NumberGadTags[] = {
  162.                     {GTIN_Number, 0},
  163.                     {GA_Disabled, FALSE},
  164.                     {GT_Underscore, '_'},
  165.                     {GTIN_MaxChars, 4},
  166.                     {TAG_DONE, 0L}
  167.                 };
  168. static struct TagItem       ButtomGadTags[] = {
  169.                     {GA_Disabled, FALSE},
  170.                     {GT_Underscore, '_'},
  171.                     {TAG_DONE, 0L}
  172.                 };
  173. static struct TagItem       ChangeNumberGadTags[] = {
  174.                     {GTIN_Number, 0},
  175.                     {TAG_DONE, 0L}
  176.                 };
  177. static struct TagItem       ChangeCheckGadTags[] = {
  178.                     {GTCB_Checked, 0},
  179.                     {TAG_DONE, 0L}
  180.                 };
  181. static struct TagItem       ChangeDisableGadTags[] = {
  182.                     {GA_Disabled, 0},
  183.                     {TAG_DONE, 0L}
  184.                 };
  185. static struct TagItem       TextGadTags[] = {
  186.                     {GTTX_Text, 0},
  187.                     {GTTX_Border, TRUE},
  188.                     {TAG_DONE, 0L}
  189.                 };
  190. static struct TagItem       ChangeTextGadTags[] = {
  191.                     {GTTX_Text, 0},
  192.                     {TAG_DONE, 0L}
  193.                 };
  194.  
  195.  
  196. /* local functions... */
  197. static struct Gadget *InitGads    (void);
  198. static long ActionScreenPref    (short action, int *cont);
  199. static void SetGads2ownscr      (void);            // verwendet new_is_onwnscr
  200.  
  201.  
  202. /* functions... */
  203.  
  204. void OpenPrefWin(void)
  205. {
  206.   struct NewWindow new_win;
  207.   WORD LeftEdge, TopEdge, Width, Height;
  208.  
  209.   if (is_prefwin) {
  210.     return;
  211.   }
  212.  
  213.   if (GadToolsBase == NULL || GadToolsBase->lib_Version < 37L) {
  214.     MySimpleRequest(1, NULL, NULL, NULL, NULL, GetTeXString(MSG_PREFWIN_GADTOOLS));
  215.     return;
  216.   }
  217.   
  218.   GList = InitGads();
  219.  
  220.   Width  = PREFWIN_WIDTH;
  221.   Height = PREFWIN_HEIGHT+win2->BorderTop;
  222.  
  223.   CenterWindow(&LeftEdge, &TopEdge, Width, Height);
  224.  
  225.   new_win.LeftEdge  = LeftEdge;
  226.   new_win.TopEdge   = TopEdge;
  227.   new_win.Width     = Width;
  228.   new_win.Height    = Height;
  229.   new_win.DetailPen = 0;
  230.   new_win.BlockPen  = 1; 
  231.   new_win.Title     = GetTeXString(MSG_PREFWIN_WIN_TITLE);
  232.   new_win.Flags     = WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_DRAGBAR | WFLG_NOCAREREFRESH | WFLG_ACTIVATE | WFLG_RMBTRAP;
  233.   new_win.IDCMPFlags = IDCMP_CLOSEWINDOW | IDCMP_VANILLAKEY | IDCMP_RAWKEY | BUTTONIDCMP | NUMBERIDCMP | CHECKBOXIDCMP | ((is_amigaguide) ? IDCMP_GADGETHELP : 0);
  234.   new_win.Type      = CUSTOMSCREEN;
  235.   new_win.FirstGadget = GList;
  236.   new_win.CheckMark = NULL;
  237.   new_win.Screen    = screen;
  238.   new_win.BitMap    = NULL;
  239.   
  240.   if (is_amigaguide) {
  241.     PrefWin = (struct Window *)OpenWindowTags(&new_win, WA_HelpGroupWindow, win2, TAG_DONE);
  242.   }
  243.   else {
  244.     PrefWin = (struct Window *)OpenWindow(&new_win);
  245.   }
  246.  
  247.   if (PrefWin == NULL) {
  248.     MySimpleRequest(1, NULL, NULL, NULL, GetTeXString(MSG_SHOWDVI_MESSAGE), 
  249.         GetTeXString(MSG_PREFWIN_CANT_OPEN));
  250.     return;
  251.   }
  252.  
  253.  
  254.   TmpModeID = get_DisplayID();
  255.   
  256.   ChangeTextGadTags[0].ti_Data = (ULONG)GetModeIDName(INVALID_ID, &new_is_lace);
  257.   GT_SetGadgetAttrsA(Gad_scrmname, PrefWin, NULL, ChangeTextGadTags);
  258.  
  259.   ChangeCheckGadTags[0].ti_Data = (is_bhook);
  260.   GT_SetGadgetAttrsA(Gad_white, PrefWin, NULL, ChangeCheckGadTags);
  261.  
  262.   ChangeCheckGadTags[0].ti_Data = (is_col4);
  263.   GT_SetGadgetAttrsA(Gad_4col, PrefWin, NULL, ChangeCheckGadTags);
  264.  
  265.   ChangeCheckGadTags[0].ti_Data = (is_ownscr);
  266.   GT_SetGadgetAttrsA(Gad_ownscr, PrefWin, NULL, ChangeCheckGadTags);
  267.  
  268.  
  269.  
  270.   /* GT_RefreshWindow(PrefWin, NULL); */
  271.   
  272.   sig_prefwin = PrefWin->UserPort->mp_SigBit;
  273.   new_is_lace   = is_lace;
  274.   new_is_bhook  = is_bhook;
  275.   new_is_ownscr = is_ownscr;
  276.   new_is_4col   = is_col4;
  277.   new_screen_mode = FALSE;
  278.   
  279.   set_prefwin;
  280. }
  281.  
  282.  
  283.  
  284. void ClosePrefWin(void)
  285. {
  286.   if (!is_prefwin) {
  287.     return;
  288.   }
  289.  
  290.   if (PrefWin != NULL) {
  291.     CloseWindow(PrefWin);
  292.     PrefWin = NULL;
  293.   }
  294.   if (GList != NULL) {
  295.     FreeGadgets(GList);
  296.     GList = NULL;
  297.   }
  298.   
  299.   unset_prefwin;
  300. }
  301.  
  302.  
  303.  
  304. void TogglePrefWin(void)
  305. {
  306.   if (is_prefwin) {
  307.     ClosePrefWin();
  308.   }
  309.   else {
  310.     OpenPrefWin();
  311.   }
  312. }
  313.  
  314.  
  315.  
  316. long DoPrefWin(void)
  317. {
  318.   short action;
  319.   struct IntuiMessage *msg;
  320.   ULONG msg_class;
  321.   UWORD    Code;
  322.   UWORD Qualifier;
  323.   struct Gadget *m_gad;
  324.   int cont = TRUE;
  325.   long ex = 0;
  326.   
  327.   if (PrefWin == NULL) {
  328.     return ex;
  329.   }
  330.   
  331.   while(cont && ex == 0 && PrefWin != NULL && (msg = GT_GetIMsg(PrefWin->UserPort)) != NULL) {
  332.     msg_class    = msg->Class;
  333.     Code      = msg->Code;
  334.     Qualifier    = msg->Qualifier;
  335.     m_gad    = (struct Gadget *)(msg->IAddress);
  336.  
  337.     action = ACTION_NONE;
  338.  
  339.     switch (msg_class) {
  340.       case IDCMP_GADGETHELP:
  341.         work_with_gadgethelp(msg);
  342.         break;
  343.  
  344.       case IDCMP_CLOSEWINDOW:
  345.       cont = FALSE;
  346.       break;
  347.  
  348.       case IDCMP_RAWKEY:
  349.         if (Code == 95) HelpKeyAGuide(Qualifier & IEQUALIFIER_CONTROL);
  350.         break;
  351.  
  352.       case IDCMP_VANILLAKEY:
  353.         switch (toupper(Code)) {
  354.       case 13 :        /* RET */
  355.       case 'U':        /* use */
  356.         action = ACTION_WINUSE;
  357.         break;
  358.       case 27 :        /* ESC */
  359.       case 'X':        /* X (start/quit key for the pref-win) */
  360.       case 'C':        /* cancel */
  361.         action = ACTION_WINCANCEL;
  362.         break;
  363.       case 'W':        /* width */
  364.         if (new_is_ownscr) {
  365.           (void)ActivateGadget(Gad_xsize, PrefWin, NULL);
  366.         }
  367.         break;
  368.       case 'H':        /* height */
  369.         if (new_is_ownscr) {
  370.           (void)ActivateGadget(Gad_ysize, PrefWin, NULL);
  371.         }
  372.         break;
  373.  
  374.       case 'G':        /* black on white */
  375.         new_is_bhook = !new_is_bhook;
  376.         ChangeCheckGadTags[0].ti_Data = (new_is_bhook);
  377.         GT_SetGadgetAttrsA(Gad_white, PrefWin, NULL, ChangeCheckGadTags);
  378.         break;
  379.  
  380. #if 0
  381.       case 'I':        /* interlace */
  382.         if (new_is_ownscr) {
  383.           new_is_lace = !new_is_lace;
  384.           ChangeCheckGadTags[0].ti_Data = (new_is_lace);
  385.           GT_SetGadgetAttrsA(Gad_lace, PrefWin, NULL, ChangeCheckGadTags);
  386.         }
  387.         break;
  388. #endif
  389.  
  390.       case 'O':        /* default */
  391.         if (new_is_ownscr) {
  392.           action = ACTION_WINDEFAULTSIZE;
  393.         }
  394.         break;
  395.       case 'D':        /* dvi page size */
  396.         if (new_is_ownscr && is_dvif) {
  397.           action = ACTION_WINDVISIZE;
  398.         }
  399.         break;
  400.       case 'S':        /* own screen */
  401.         new_is_ownscr = !new_is_ownscr;
  402.         ChangeCheckGadTags[0].ti_Data = (new_is_ownscr);
  403.         GT_SetGadgetAttrsA(Gad_ownscr, PrefWin, NULL, ChangeCheckGadTags);
  404.         SetGads2ownscr();        // ghoste oder nicht die anderen Gadgets
  405.         break;
  406.       case '4':        /* 4 col screen */
  407.         if (new_is_ownscr) {
  408.           new_is_4col = !new_is_4col;
  409.           ChangeCheckGadTags[0].ti_Data = (new_is_4col);
  410.           GT_SetGadgetAttrsA(Gad_4col, PrefWin, NULL, ChangeCheckGadTags);
  411.           ChangeDisableGadTags[0].ti_Data = !new_is_4col;
  412.           GT_SetGadgetAttrsA(Gad_white, PrefWin, NULL, ChangeDisableGadTags);
  413.         }
  414.         break;
  415.       case 'M':
  416.         action = ACTION_WINSCRMODE;
  417.         break;
  418.       case 3  :        /* CTRL C */
  419.         CXBRK();
  420.         break;
  421.         }
  422.         break;
  423.       case IDCMP_GADGETUP: 
  424.         action = (short)m_gad->UserData;
  425.         break;
  426.     }
  427.  
  428.     GT_ReplyIMsg(msg);
  429.  
  430.     ex = ActionScreenPref(action, &cont);
  431.   }
  432.   
  433.   return ex;
  434. }
  435.  
  436.  
  437.  
  438. /*------------------------------------------------------------*/
  439.  
  440.  
  441. static struct Gadget *InitGads(void)
  442. {
  443.     struct Gadget *gad, *glist;
  444.     struct MyNewGadget *ng;
  445.     struct TextAttr *txt;
  446.     short i;
  447.     WORD help;
  448.  
  449.     help = HeightWinTitle - 22;
  450.     if (screen->Font->ta_YSize > 15 || TextLength(&(screen->RastPort), "m", 1) > 11) {
  451.       txt = &txtAttr;
  452.     }
  453.     else {
  454.       txt = screen->Font;
  455.     }
  456.  
  457.     for (i = 0, ng = NGAry; i < GADMAX; ++i, ++ng) {
  458.        ng->new.ng_GadgetText = GetTeXString(MSG_PREFWIN_GADARR_0 + i);
  459.        ng->new.ng_VisualInfo = SDVI_VI;
  460.        ng->new.ng_TextAttr = txt;
  461.        ng->new.ng_TopEdge  = ng->TopEdge+help;
  462.        ng->new.ng_LeftEdge = ng->LeftEdge;
  463.        ng->new.ng_Width    = ng->Width;
  464.        ng->new.ng_Height   = ng->Height;
  465.     }
  466.  
  467.     glist = NULL;
  468.     if ((gad = CreateContext(&glist)) == NULL) return NULL;
  469.  
  470.     NumberGadTags[0].ti_Data = screen->Width;
  471.     NumberGadTags[1].ti_Data = !is_ownscr;    /* disable */
  472.     Gad_xsize = gad = CreateGadgetA(INTEGER_KIND, gad, &(NG_xsize->new), NumberGadTags);
  473.     if (gad == NULL) return(NULL);
  474.  
  475.     NumberGadTags[0].ti_Data = screen->Height;
  476.     NumberGadTags[1].ti_Data = !is_ownscr;    /* disable */
  477.     Gad_ysize = gad = CreateGadgetA(INTEGER_KIND, gad, &(NG_ysize->new), NumberGadTags);
  478.     if (gad == NULL) return(NULL);
  479.  
  480.     ButtomGadTags[0].ti_Data = !is_col4;    /* disable */
  481.     Gad_white = gad = CreateGadgetA(CHECKBOX_KIND, gad, &(NG_white->new), ButtomGadTags);
  482.     if (gad == NULL) return(NULL);
  483.  
  484.     ButtomGadTags[0].ti_Data = !is_ownscr;    /* disable */
  485.     Gad_default = gad = CreateGadgetA(BUTTON_KIND, gad, &(NG_default->new), ButtomGadTags);
  486.     if (gad == NULL) return(NULL);
  487.  
  488.     ButtomGadTags[0].ti_Data = !is_ownscr || !is_dvif;    /* disable */
  489.     Gad_dvisize = gad = CreateGadgetA(BUTTON_KIND, gad, &(NG_dvisize->new), ButtomGadTags);
  490.     if (gad == NULL) return(NULL);
  491.  
  492.     ButtomGadTags[0].ti_Data = FALSE;        /* disable */
  493.     Gad_use = gad = CreateGadgetA(BUTTON_KIND, gad, &(NG_use->new), ButtomGadTags);
  494.     if (gad == NULL) return(NULL);
  495.  
  496.     ButtomGadTags[0].ti_Data = FALSE;        /* disable */
  497.     Gad_cancel = gad = CreateGadgetA(BUTTON_KIND, gad, &(NG_cancel->new), ButtomGadTags);
  498.     if (gad == NULL) return(NULL);
  499.  
  500.     ButtomGadTags[0].ti_Data = FALSE;        /* disable */
  501.     Gad_ownscr = gad = CreateGadgetA(CHECKBOX_KIND, gad, &(NG_ownscr->new), ButtomGadTags);
  502.     if (gad == NULL) return(NULL);
  503.  
  504.     ButtomGadTags[0].ti_Data = !is_ownscr;    /* disable */
  505.     Gad_4col = gad = CreateGadgetA(CHECKBOX_KIND, gad, &(NG_4col->new), ButtomGadTags);
  506.     if (gad == NULL) return(NULL);
  507.  
  508.     ButtomGadTags[0].ti_Data = is_os21 && !is_ownscr;        /* disable */
  509.     Gad_scrmode = gad = CreateGadgetA(BUTTON_KIND, gad, &(NG_scrmode->new), ButtomGadTags);
  510.     if (gad == NULL) return(NULL);
  511.  
  512.     Gad_scrmname = gad = CreateGadgetA(TEXT_KIND, gad, &(NG_scrmname->new), TextGadTags);
  513.     if (gad == NULL) return(NULL);
  514.  
  515.     return(glist);
  516. }
  517.  
  518.  
  519. static long ActionScreenPref(short action, int *cont)
  520. {
  521.   long width, height;
  522. //  short lace;
  523.   int use = FALSE;
  524.   long ex = 0;
  525.  
  526.   switch (action) {
  527.     case ACTION_NONE:
  528.         break;
  529.     case ACTION_WINWIDTH:
  530.         break;
  531.     case ACTION_WINHEIGHT:
  532.         break;
  533.     case ACTION_WINWHITE:
  534.          new_is_bhook = !new_is_bhook;
  535.         break;
  536.     case ACTION_WINDEFAULTSIZE:
  537.             if (new_is_ownscr) {
  538.                   struct Rectangle Rect;
  539.  
  540.                   if (QueryOverscan(TmpModeID, &Rect, OSCAN_TEXT)) {
  541.             ChangeNumberGadTags[0].ti_Data = width = Rect.MaxX - Rect.MinX + 1;
  542.             GT_SetGadgetAttrsA(Gad_xsize, PrefWin, NULL, ChangeNumberGadTags);
  543.             ChangeNumberGadTags[0].ti_Data = height = Rect.MaxY - Rect.MinY + 1;
  544.             GT_SetGadgetAttrsA(Gad_ysize, PrefWin, NULL, ChangeNumberGadTags);
  545.                   }
  546.                   else {
  547.             width = NTSC_SCR_WIDTH;    /* minimal size */
  548.             height = NTSC_SCR_HEIGHT;
  549.           }
  550.         }
  551.         break;
  552.     case ACTION_WINDVISIZE:
  553.             if (new_is_ownscr) {
  554.           ChangeNumberGadTags[0].ti_Data = wx + x_win_width - x_win_i_width;
  555.           GT_SetGadgetAttrsA(Gad_xsize, PrefWin, NULL, ChangeNumberGadTags);
  556.           ChangeNumberGadTags[0].ti_Data = wy + x_win_height - x_win_i_height + HeightScreenTitle;
  557.           GT_SetGadgetAttrsA(Gad_ysize, PrefWin, NULL, ChangeNumberGadTags);
  558.         }
  559.         break;
  560.     case ACTION_WINOWNSCR:
  561.         new_is_ownscr = !new_is_ownscr;
  562.         SetGads2ownscr();
  563.         break;
  564.     case ACTION_WIN4COL:
  565.             if (new_is_ownscr) {
  566.           new_is_4col = !new_is_4col;
  567.               ChangeDisableGadTags[0].ti_Data = !new_is_4col;
  568.               GT_SetGadgetAttrsA(Gad_white, PrefWin, NULL, ChangeDisableGadTags);
  569.         }
  570.         break;
  571.     case ACTION_WINUSE:
  572.         *cont = FALSE;
  573.         use = TRUE;
  574.         break;
  575.     case ACTION_WINCANCEL:
  576.         *cont = FALSE;
  577.         break;
  578.     case ACTION_WINSCRMODE:
  579.             if (new_is_ownscr) {
  580.           ULONG DID = TmpModeID; //get_DisplayID();
  581.           long mode_lace = FALSE;
  582.               if (GetScreenMode(&DID, PrefWin)) {
  583.                 struct Rectangle Rect;
  584.                 TmpModeID = DID;
  585.                 set_numeric;
  586.                 new_screen_mode = TRUE;
  587.             ChangeTextGadTags[0].ti_Data = (ULONG)GetModeIDName(TmpModeID, &mode_lace);
  588.             GT_SetGadgetAttrsA(Gad_scrmname, PrefWin, NULL, ChangeTextGadTags);
  589.             if ((mode_lace && !new_is_lace) || (!mode_lace && new_is_lace)) {
  590.               new_is_lace = mode_lace;
  591. #if 0
  592.               ChangeCheckGadTags[0].ti_Data = (new_is_lace);
  593.               GT_SetGadgetAttrsA(Gad_lace, PrefWin, NULL, ChangeCheckGadTags);
  594. #endif
  595.             }
  596.  
  597. #if 0
  598.             ChangeDisableGadTags[0].ti_Data = DisableLace = TRUE;
  599.             GT_SetGadgetAttrsA(Gad_lace, PrefWin, NULL, ChangeDisableGadTags);
  600. #endif
  601.  
  602.                     if (QueryOverscan(TmpModeID, &Rect, OSCAN_TEXT)) {
  603.               ChangeNumberGadTags[0].ti_Data = width = Rect.MaxX - Rect.MinX + 1;
  604.               GT_SetGadgetAttrsA(Gad_xsize, PrefWin, NULL, ChangeNumberGadTags);
  605.               ChangeNumberGadTags[0].ti_Data = height = Rect.MaxY - Rect.MinY + 1;
  606.               GT_SetGadgetAttrsA(Gad_ysize, PrefWin, NULL, ChangeNumberGadTags);
  607.                     }
  608.                     else {
  609.               width  = NTSC_SCR_WIDTH;    /* minimal size */
  610.               height = NTSC_SCR_HEIGHT;
  611.             }
  612.               }
  613.         }
  614.         break;
  615.   }
  616.   
  617.   width  = ((struct StringInfo *)(Gad_xsize->SpecialInfo))->LongInt;
  618.   height = ((struct StringInfo *)(Gad_ysize->SpecialInfo))->LongInt;
  619.  
  620.   if (!*cont) {
  621.     ClosePrefWin();
  622.   }
  623.   
  624.   if (use) {
  625.     int change_bhook = FALSE;
  626.     
  627.     if (is_bhook != new_is_bhook) {
  628.       change_bhook = TRUE;
  629.       if (new_is_bhook) set_bhook;
  630.       else unset_bhook;
  631.     }
  632.  
  633.     if (!new_is_ownscr) {    // die restlichen Aenderungen werden ignoriert
  634.       unset_ownscr;
  635.       CloseOpenScreen(FALSE, FALSE, FALSE);
  636.     }
  637.     else {
  638.       const int size_change = (screen->Width != width || screen->Height != height);
  639.     
  640.       if (new_is_lace != is_lace || new_is_4col != is_col4 || is_ownscr != new_is_ownscr || new_screen_mode || size_change || change_bhook) {
  641.  
  642.         if (new_screen_mode) {
  643.           show_state.DisplayID = TmpModeID;
  644.         }
  645.  
  646.         if (size_change) {
  647.           show_state.screen_size_x = width;
  648.           show_state.screen_size_y = height;
  649.         }
  650.  
  651.         if (new_is_ownscr) {
  652.           set_ownscr;
  653.         }
  654.         else {
  655.           // ELSE Fall wird nun schon oben abgehandelt.
  656.           // (damit nicht doch noch andere Dinge mit geaendert werden)
  657.         }
  658.  
  659.         CloseOpenScreen((new_is_lace != is_lace), (new_is_4col != is_col4), size_change);
  660.       }
  661.     }
  662.   }
  663.   
  664.   return ex;
  665. }
  666.  
  667.  
  668. /*------------------------------------------------------------*/
  669.  
  670.  
  671. /* setzt je nach new_is_ownscr ob Screenmode usw. eingestellt werden kann */
  672.  
  673. static void SetGads2ownscr(void)
  674. {
  675.   ChangeDisableGadTags[0].ti_Data = !new_is_ownscr;
  676.  
  677.   GT_SetGadgetAttrsA(Gad_xsize,    PrefWin, NULL, ChangeDisableGadTags);
  678.   GT_SetGadgetAttrsA(Gad_ysize,    PrefWin, NULL, ChangeDisableGadTags);
  679.   GT_SetGadgetAttrsA(Gad_default,  PrefWin, NULL, ChangeDisableGadTags);
  680. #if 0
  681.   DisableLace = ChangeDisableGadTags[0].ti_Data;
  682.   GT_SetGadgetAttrsA(Gad_lace,     PrefWin, NULL, ChangeDisableGadTags);
  683. #endif
  684.   GT_SetGadgetAttrsA(Gad_4col,     PrefWin, NULL, ChangeDisableGadTags);
  685.   GT_SetGadgetAttrsA(Gad_scrmode,  PrefWin, NULL, ChangeDisableGadTags);
  686.   GT_SetGadgetAttrsA(Gad_scrmname, PrefWin, NULL, ChangeDisableGadTags);
  687.  
  688.   ChangeDisableGadTags[0].ti_Data = !new_is_ownscr || !is_dvif;
  689.   GT_SetGadgetAttrsA(Gad_dvisize,  PrefWin, NULL, ChangeDisableGadTags);
  690. }
  691.  
  692.  
  693.