home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / ui_utils / aib623.lha / source / windows.c < prev    next >
C/C++ Source or Header  |  1992-03-21  |  9KB  |  396 lines

  1. #include "aib.h"
  2. #include "extern.h"
  3.  
  4.  
  5. /* prototypes */
  6. void other_gads (struct Gadget *,UWORD);
  7. void replace_flags (void);
  8. void capture_flags (void);
  9. void Modify_Theirs (void);
  10. void capture_params(void);
  11. void replace_params(void);
  12.  
  13.  
  14. /************************* modified ***************************************/
  15.  
  16. void Modify_Theirs (void)
  17. {
  18. WORD zoom[4];
  19.  
  20. zoom[0]=theirs.zl;
  21. zoom[1]=theirs.zt;
  22. zoom[2]=theirs.zw;
  23. zoom[3]=theirs.zh;
  24.  
  25. if (theirs.sketchpad) CloseWindow(theirs.sketchpad);
  26. if (their_menu) 
  27. {
  28.     if (menu) FreeMenus(menu);
  29.     if ( !(menu=CreateMenus(their_menu,GTMN_FrontPen,0,
  30.         TAG_DONE))) abort_me("no menu!");
  31.     if (!(LayoutMenus(menu,vi,
  32.         GTMN_TextAttr,menuta,
  33.         TAG_DONE))) abort_me("no layout!");
  34. }
  35.  
  36. if (theirs.zoom)
  37. theirs.sketchpad = OpenWindowTags(NULL,
  38.            WA_Activate, theirs.act,
  39.            WA_IDCMP,CLOSEWINDOW | NEWSIZE | REFRESHWINDOW | MENUPICK |
  40.                     SLIDERIDCMP | STRINGIDCMP | BUTTONIDCMP |
  41.                     CHECKBOXIDCMP | MXIDCMP | MENUPICK |LISTVIEWIDCMP,
  42.        WA_Gadgets,sketchlist,
  43.        WA_Left,theirs.left,
  44.        WA_Width,theirs.width,
  45.        WA_Top,theirs.top,
  46.        WA_Height,theirs.height,
  47.            WA_InnerHeight,theirs.innerh,
  48.        WA_InnerWidth,theirs.innerw,
  49.            WA_DragBar,theirs.drag,
  50.            WA_DepthGadget, theirs.depth,
  51.            WA_CloseGadget, theirs.close,
  52.        WA_SizeGadget, theirs.size,
  53.        WA_MinWidth,theirs.minw,
  54.        WA_MinHeight,theirs.minh,
  55.        WA_MaxHeight,theirs.maxh,
  56.        WA_MaxWidth,theirs.maxw,
  57.        WA_RptQueue,theirs.rpt,
  58.        WA_Backdrop, theirs.back,
  59.        WA_ReportMouse,theirs.report,
  60.        WA_NoCareRefresh, theirs.nocare,
  61.        WA_Borderless, theirs.bord,
  62.        WA_SimpleRefresh,TRUE,
  63.        WA_RMBTrap, theirs.rmb,
  64.            WA_Title,theirs.title,
  65.        WA_Zoom,zoom, 
  66.            TAG_DONE);
  67.  
  68. else 
  69.    theirs.sketchpad  =   OpenWindowTags(NULL,
  70.            WA_Activate, theirs.act,
  71.            WA_IDCMP,CLOSEWINDOW | NEWSIZE | REFRESHWINDOW | MENUPICK |
  72.                     SLIDERIDCMP | STRINGIDCMP | BUTTONIDCMP |
  73.                     CHECKBOXIDCMP | MXIDCMP | MENUPICK |LISTVIEWIDCMP,
  74.        WA_Gadgets,sketchlist,
  75.        WA_Left,theirs.left,
  76.        WA_Width,theirs.width, 
  77.        WA_Top,theirs.top,
  78.        WA_Height,theirs.height,
  79.            WA_InnerHeight,theirs.innerh,
  80.        WA_InnerWidth,theirs.innerw,
  81.            WA_DragBar,theirs.drag,
  82.            WA_DepthGadget, theirs.depth,
  83.            WA_CloseGadget, theirs.close,
  84.        WA_SizeGadget, theirs.size,
  85.        WA_MinWidth,theirs.minw,
  86.        WA_MinHeight,theirs.minh,
  87.        WA_MaxHeight,theirs.maxh,
  88.        WA_MaxWidth,theirs.maxw,
  89.        WA_RptQueue,theirs.rpt,
  90.        WA_Backdrop, theirs.back,
  91.        WA_ReportMouse,theirs.report,
  92.        WA_NoCareRefresh, theirs.nocare,
  93.        WA_Borderless, theirs.bord,
  94.        WA_RMBTrap, theirs.rmb,
  95.            WA_Title,theirs.title,
  96.        WA_SimpleRefresh,TRUE,
  97.            TAG_DONE);
  98.  
  99.  
  100.     GT_RefreshWindow(theirs.sketchpad,NULL); 
  101.     if (their_menu) SetMenuStrip(theirs.sketchpad,menu);
  102. }
  103.  
  104.  
  105.  
  106. /****************** other gads (for windows )*********************************/
  107. void other_gads (struct Gadget *gad, UWORD code)
  108. {
  109.  
  110.  
  111. switch (gad->GadgetID) {
  112.     
  113.     /* toggle window flags */
  114.  
  115.     case W1_size:    
  116.         their.size = (their.size)?FALSE:TRUE;
  117.         printf("%d\n",their.size);
  118.         break;
  119.  
  120.     case W1_drag:
  121.         their.drag = (their.drag)?FALSE:TRUE;
  122.         break;
  123.  
  124.     case W1_dept:
  125.         their.depth = (their.depth)?FALSE:TRUE;
  126.         break;
  127.  
  128.     case W1_clos:
  129.         their.close = (their.close)?FALSE:TRUE;
  130.         break;
  131.  
  132.     case W1_back:
  133.         their.back = (their.back)?FALSE:TRUE;
  134.         break;
  135.  
  136.     case W1_repo:
  137.         their.report = (their.report)?FALSE:TRUE;
  138.         break;
  139.  
  140.     case W1_noca:
  141.         their.nocare = (their.nocare)?FALSE:TRUE;
  142.         break;
  143.  
  144.     case W1_bord:
  145.         their.bord = (their.bord)?FALSE:TRUE;
  146.         break;
  147.  
  148.     case W1_acti:
  149.         their.act = (their.act)?FALSE:TRUE;
  150.         break;
  151.  
  152.     case W1_rmbt:
  153.         their.rmb = (their.rmb)?FALSE:TRUE;
  154.         break;
  155.  
  156.     case W1_simp:
  157.         their.simple = (their.simple)?FALSE:TRUE;
  158.         break;
  159.  
  160.     case W1_smar:
  161.         their.smart = (their.smart)?FALSE:TRUE;
  162.         break;
  163.  
  164.     case W1_sizer:
  165.         their.sizer = (their.sizer)?FALSE:TRUE;
  166.         break;
  167.  
  168.     case W1_sizeb:
  169.         their.sizeb = (their.sizeb)?FALSE:TRUE;
  170.         break;
  171.  
  172.     case W1_auto:
  173.         their.aut = (their.aut)?FALSE:TRUE;
  174.         break;
  175.  
  176.     case W1_gimm:
  177.         their.gimme = (their.gimme)?FALSE:TRUE;
  178.         break;
  179.  
  180.     /*** main window specs ****/
  181.  
  182.  
  183.     case W_tit:
  184.         strcpy(their.title,((struct StringInfo *)gad->SpecialInfo)->Buffer);
  185.         break;
  186.  
  187.     case W_lef:
  188.         their.left = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  189.             break;
  190.  
  191.     case W_top:
  192.         their.top = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  193.             break;
  194.  
  195.     case W_wid:
  196.         their.width = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  197.             break;
  198.  
  199.     case W_hei:
  200.         their.height = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  201.             break;
  202.  
  203.     case W_IDC:
  204.             break;
  205.  
  206.     case W_fla:
  207.             break;
  208.  
  209.     case W_minw:
  210.         their.minw = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  211.             break;
  212.  
  213.     case W_minh:
  214.         their.minh = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  215.             break;
  216.  
  217.     case W_maxw:
  218.         their.maxw = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  219.             break;
  220.  
  221.     case W_maxh:
  222.         their.maxh = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  223.             break;
  224.  
  225.     case W_inw:
  226.         their.innerw = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  227.             break;
  228.  
  229.     case W_inh:
  230.         their.innerh = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  231.             break;
  232.  
  233.     case W_pubn:
  234.             break;
  235.  
  236.     case W_pub:
  237.             break;
  238.  
  239.     case W_pubf:
  240.             break;
  241.  
  242.     case W_zoo1:
  243.         their.zl = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  244.             break;
  245.  
  246.     case W_zoo2:
  247.         their.zt = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  248.             break;
  249.  
  250.     case W_zoo3:
  251.         their.zw = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  252.             break;
  253.  
  254.     case W_zoo4:
  255.         their.zh = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  256.             break;
  257.  
  258.     case W_zoo:
  259.  
  260.         their.zoom = (their.zoom)?FALSE:TRUE;
  261.     
  262.         GT_SetGadgetAttrs(zt,window,NULL,
  263.         GA_Disabled,!their.zoom,
  264.         TAG_DONE);
  265.  
  266.         GT_SetGadgetAttrs(zw,window,NULL,
  267.         GA_Disabled,!their.zoom,
  268.         TAG_DONE);
  269.  
  270.         GT_SetGadgetAttrs(zh,window,NULL,
  271.         GA_Disabled,!their.zoom,
  272.         TAG_DONE);
  273.  
  274.         GT_SetGadgetAttrs(zl,window,NULL,
  275.         GA_Disabled,!their.zoom,
  276.         TAG_DONE);
  277.             break;
  278.  
  279.     case W_rpt:
  280.         their.report = ((struct StringInfo *)gad->SpecialInfo)->LongInt;
  281.             break;
  282.     
  283.     default:
  284.         menu_opts(gad, code);    
  285.         break;
  286.  
  287.   }
  288. }
  289.  
  290.  
  291. /******************************* capture params ****************************/
  292.  
  293. void capture_params(void)
  294. {
  295.  
  296.  their.top = theirs.top;
  297.  their.width = theirs.width;
  298.  strcpy (their.title,theirs.title);
  299.  their.height = theirs.height;
  300.  their.left = theirs.left;
  301.  their.minw = theirs.minw;
  302.  their.minh = theirs.minh;
  303.  their.maxh = theirs.maxh;
  304.  their.maxw = theirs.maxw;
  305.  their.innerw = theirs.innerw;
  306.  their.innerh = theirs.innerh;
  307.  their.rpt = theirs.rpt;
  308.  their.zt = theirs.zt;
  309.  their.zh = theirs.zh;
  310.  their.zl = theirs.zl;
  311.  their.zw = theirs.zw;
  312.  their.zoom = theirs.zoom;
  313.  their.flags = theirs.flags;
  314.  
  315. }
  316.  
  317. /************************* replace params ********************************/
  318. void replace_params(void)
  319. {
  320.  
  321.  theirs.top = their.top;
  322.  theirs.width = their.width;
  323.  strcpy (theirs.title,their.title);
  324.  theirs.height = their.height;
  325.  theirs.left = their.left;
  326.  theirs.minw = their.minw;
  327.  theirs.minh = their.minh;
  328.  theirs.maxh = their.maxh;
  329.  theirs.maxw = their.maxw;
  330.  theirs.innerw = their.innerw;
  331.  theirs.innerh = their.innerh;
  332.  theirs.rpt = their.rpt;
  333.  theirs.zt = their.zt;
  334.  theirs.zh = their.zh;
  335.  theirs.zl = their.zl;
  336.  theirs.zw = their.zw;
  337.  theirs.zoom = their.zoom;
  338.  theirs.flags = their.flags;
  339.  
  340.  Modify_Theirs();
  341.  
  342. }
  343.  
  344.  
  345. /******************* replace flags ******************************************/
  346.  
  347. void replace_flags(void)
  348. {
  349.  
  350.   theirs.size = their.size;
  351.   theirs.drag = their.drag;
  352.   theirs.depth = their.depth;
  353.   theirs.close = their.close;
  354.   theirs.back = their.back;
  355.   theirs.report = their.report;
  356.   theirs.nocare = their.nocare;
  357.   theirs.bord = their.bord;
  358.   theirs.act = their.act;
  359.   theirs.rmb = their.rmb;
  360.   theirs.simple = their.simple;
  361.   theirs.smart = their.smart;
  362.   theirs.sizer = their.sizer;
  363.   theirs.sizeb = their.sizeb;
  364.   theirs.aut = their.aut;
  365.   theirs.gimme = their.gimme;
  366.  
  367.   Modify_Theirs();
  368.  
  369.  
  370. }
  371.  
  372.  
  373. /*********************** caputre flags **********************************/
  374.  
  375. void capture_flags(void)
  376. {
  377.   their.size = theirs.size;
  378.   their.drag = theirs.drag;
  379.   their.depth = theirs.depth;
  380.   their.close = theirs.close;
  381.   their.back = theirs.back;
  382.   their.report = theirs.report;
  383.   their.nocare = theirs.nocare;
  384.   their.bord = theirs.bord;
  385.   their.act = theirs.act;
  386.   their.rmb = theirs.rmb;
  387.   their.simple = theirs.simple;
  388.   their.smart = theirs.smart;
  389.   their.sizer = theirs.sizer;
  390.   their.sizeb = theirs.sizeb;
  391.   their.aut = theirs.aut;
  392.   their.gimme = theirs.gimme;
  393.  
  394. }
  395.  
  396.