home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / gfx / edit / tsmorph / src / handlesettings.c < prev    next >
C/C++ Source or Header  |  1994-01-29  |  27KB  |  896 lines

  1. // TSMorph - Amiga Morphing program
  2. // Copyright (C) © 1993  Topicsave Limited
  3.  
  4. // This program is free software; you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation; either version 2 of the License, or
  7. // any later version.
  8.  
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. // GNU General Public License for more details.
  13.  
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program; if not, write to the Free Software
  16. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. // mpaddock@cix.compulink.co.uk
  19.  
  20. // include precompiled headers (if not already)
  21. #ifndef TSMORPH_H
  22. #include "TSMorph.h"
  23. #endif
  24.  
  25. /* Remove menus from all windows allowing
  26.  * them to be updated
  27.  */
  28. void
  29. RemoveMenus(void) {
  30.     if (TSMorphWnd) {
  31.         ClearMenuStrip(TSMorphWnd);
  32.     }
  33.     if (ControlWindow) {
  34.         ClearMenuStrip(Pic1.Win);
  35.         ClearMenuStrip(Pic2.Win);
  36.         ClearMenuStrip(ControlWindow);
  37.     }
  38. }
  39.  
  40. /* Add the menus back again after
  41.  * calling RemoveMenus() and updating
  42.  */
  43. void
  44. AddMenus(void) {
  45.     if (TSMorphWnd) {
  46.         ResetMenuStrip(TSMorphWnd,TSMorphMenus);
  47.     }
  48.     if (ControlWindow) {
  49.         ResetMenuStrip(ControlWindow,MyMenu);
  50.         ResetMenuStrip(Pic1.Win,MyMenu);
  51.         ResetMenuStrip(Pic2.Win,MyMenu);
  52.     }
  53. }
  54.  
  55. /* Update the save format menu items
  56.  * Parameter: remove - set to TRUE to remove and add the menus
  57.  *                         to FALSE if menus have already been removed (for lots of updates)
  58.  */
  59. void
  60. UpdateSaveFormat(BOOL remove) {
  61.     if (remove) {
  62.         RemoveMenus();
  63.     }
  64.     if (TSMorphWnd) {
  65.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_ILBM24)))->Flags &= ~CHECKED;
  66.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_OPAL24)))->Flags &= ~CHECKED;
  67.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_OPAL24T)))->Flags &= ~CHECKED;
  68.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_OPAL24F)))->Flags &= ~CHECKED;
  69.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_OPAL24FT)))->Flags &= ~CHECKED;
  70.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_JPEG)))->Flags &= ~CHECKED;
  71.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_JPEGT)))->Flags &= ~CHECKED;
  72.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_PBM)))->Flags &= ~CHECKED;
  73.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_BW16)))->Flags &= ~CHECKED;
  74.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_BW256)))->Flags &= ~CHECKED;
  75.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_HAM6)))->Flags &= ~CHECKED;
  76.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_HAM8)))->Flags &= ~CHECKED;
  77.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_DCTV3)))->Flags &= ~CHECKED;
  78.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,MI_DCTV4)))->Flags &= ~CHECKED;
  79.     }
  80.     if (ControlWindow) {
  81.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_ILBM24)))->Flags &= ~CHECKED;
  82.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_OPAL24)))->Flags &= ~CHECKED;
  83.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_OPAL24T)))->Flags &= ~CHECKED;
  84.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_OPAL24F)))->Flags &= ~CHECKED;
  85.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_OPAL24FT)))->Flags &= ~CHECKED;
  86.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_JPEG)))->Flags &= ~CHECKED;
  87.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_JPEGT)))->Flags &= ~CHECKED;
  88.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_PBM)))->Flags &= ~CHECKED;
  89.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_BW16)))->Flags &= ~CHECKED;
  90.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_BW256)))->Flags &= ~CHECKED;
  91.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_HAM6)))->Flags &= ~CHECKED;
  92.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_HAM8)))->Flags &= ~CHECKED;
  93.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_DCTV3)))->Flags &= ~CHECKED;
  94.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,MI_DCTV4)))->Flags &= ~CHECKED;
  95.     }
  96.     if (TSMorphWnd) {
  97.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_SAVEFORMAT,SaveFormat)))->Flags |= CHECKED;
  98.     }
  99.     if (ControlWindow) {
  100.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_SAVEFORMAT,SaveFormat)))->Flags |= CHECKED;
  101.     }
  102.     if (remove) {
  103.         AddMenus();
  104.     }
  105. }
  106.  
  107. /* Update the render mode menu items
  108.  * see UpdateSaveFormat() for parameter
  109.  */
  110. void
  111. UpdateRenderMode(BOOL remove) {
  112.     if (remove) {
  113.         RemoveMenus();
  114.     }
  115.     if (TSMorphWnd) {
  116.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE1)))->Flags &= ~CHECKED;
  117.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE2)))->Flags &= ~CHECKED;
  118.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE4)))->Flags &= ~CHECKED;
  119.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE8)))->Flags &= ~CHECKED;
  120.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE16)))->Flags &= ~CHECKED;
  121.     }
  122.     if (ControlWindow) {
  123.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE1)))->Flags &= ~CHECKED;
  124.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE2)))->Flags &= ~CHECKED;
  125.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE4)))->Flags &= ~CHECKED;
  126.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE8)))->Flags &= ~CHECKED;
  127.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE16)))->Flags &= ~CHECKED;
  128.     }
  129.     if (TSMorphWnd) {
  130.         if (RenderMode & 1) {
  131.             (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE1)))->Flags |= CHECKED;
  132.         }
  133.         if (RenderMode & 2) {
  134.             (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE2)))->Flags |= CHECKED;
  135.         }
  136.         if (RenderMode & 4) {
  137.             (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE4)))->Flags |= CHECKED;
  138.         }
  139.         if (RenderMode & 8) {
  140.             (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE8)))->Flags |= CHECKED;
  141.         }
  142.         if (RenderMode & 16) {
  143.             (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_RENDERMODE,MI_MODE16)))->Flags |= CHECKED;
  144.         }
  145.     }
  146.     if (ControlWindow) {
  147.         if (RenderMode & 1) {
  148.             (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE1)))->Flags |= CHECKED;
  149.         }
  150.         if (RenderMode & 2) {
  151.             (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE2)))->Flags |= CHECKED;
  152.         }
  153.         if (RenderMode & 4) {
  154.             (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE4)))->Flags |= CHECKED;
  155.         }
  156.         if (RenderMode & 8) {
  157.             (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE8)))->Flags |= CHECKED;
  158.         }
  159.         if (RenderMode & 16) {
  160.             (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_RENDERMODE,MI_MODE16)))->Flags |= CHECKED;
  161.         }
  162.     }
  163.     if (remove) {
  164.         AddMenus();
  165.     }
  166. }
  167.  
  168. /* Update the open mode menu items
  169.  * see UpdateSaveFormat() for parameter
  170.  */
  171. void
  172. UpdateOpenMode(BOOL remove) {
  173.     if (remove) {
  174.         RemoveMenus();
  175.     }
  176.     if (TSMorphWnd) {
  177.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_OPENMODE,MI_ALWAYS)))->Flags &= ~CHECKED;
  178.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_OPENMODE,MI_IFILBM)))->Flags &= ~CHECKED;
  179.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_OPENMODE,MI_IFCOLOURS)))->Flags &= ~CHECKED;
  180.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_OPENMODE,MI_REMAP)))->Flags &= ~CHECKED;
  181.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_OPENMODE,MI_OPAL)))->Flags &= ~CHECKED;
  182.     }
  183.     if (ControlWindow) {
  184.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_OPENMODE,MI_ALWAYS)))->Flags &= ~CHECKED;
  185.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_OPENMODE,MI_IFILBM)))->Flags &= ~CHECKED;
  186.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_OPENMODE,MI_IFCOLOURS)))->Flags &= ~CHECKED;
  187.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_OPENMODE,MI_REMAP)))->Flags &= ~CHECKED;
  188.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_OPENMODE,MI_OPAL)))->Flags &= ~CHECKED;
  189.     }
  190.     if (TSMorphWnd) {
  191.         (ItemAddress(TSMorphMenus,FULLMENUNUM(1,MM_OPENMODE,OpenMode)))->Flags |= CHECKED;
  192.     }
  193.     if (ControlWindow) {
  194.         (ItemAddress(MyMenu,FULLMENUNUM(M_SETTINGS,MM_OPENMODE,OpenMode)))->Flags |= CHECKE