home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / modelers / chmsthtc / chmsthtc.lzh / Chemesthetics / Source / Source.LZH / prefs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-19  |  3.2 KB  |  121 lines

  1. /* $Revision Header *** Header built automatically - do not edit! ***********
  2.  *
  3.  *    (C) Copyright 1991 by Metalworx
  4.  *
  5.  *    Name .....: prefs.c
  6.  *    Created ..: Mon 07-Oct-91 17:59
  7.  *    Revision .: 1
  8.  *
  9.  *    Date        Author        Comment
  10.  *    =========    ========    ====================
  11.  *    20-Oct-91    Mtwx        Icon f. .CDM und Zeit-Info-Fenster
  12.  *    02-Apr-91    Mtwx        Created this file!
  13.  *
  14.  * $Revision Header ********************************************************/
  15.  #define REVISION 1
  16.  
  17. /***************************************************************************
  18. * prefs.c: Voreinstellungen des Programmes verΣndern               *
  19. *       - BildverhΣltnis                           *
  20. *       - Icons fⁿr .CDM-Dateien ja/nein                   *
  21. *       - Icons fuer IFF-Dateien ja/nein                   *
  22. *       - Screen-Titel-Zeile ja/nein                    *
  23. *       - Zeit-Info-Fenster ja/nein                       *
  24. ***************************************************************************/
  25.  
  26. /* ------------------------------- Includes ----------------------------- */
  27.  
  28. #include <math.h>
  29. #include <stdio.h>
  30. #include <libraries/arpbase.h>
  31. #include <proto/intuition.h>
  32. #include "chem_defs.h"
  33. #include "prefs.h"
  34.  
  35. /* ------------------------------- Defines ------------------------------ */
  36.  
  37. /* ------------------------------- external references ------------------ */
  38.  
  39. extern USHORT GadgetID;
  40. extern struct Border StringGBorder2;
  41. extern struct Window *Window1;
  42. extern struct Screen *FirstScreen;
  43.  
  44. extern void SimpleRequest(char*,...);
  45.  
  46. /* ---------------------------------------------------------------------- */
  47.  
  48. void prefs(struct ChemPrefs *ChemPrefs)
  49. {
  50.   int ende=0;
  51.   SHORT SGVec2[]={ 0,11,35,11,35,0 };
  52.   SHORT SGVec1[]={ 0,10,0,0,34,0 };
  53.   struct Border LocalSGBorder1;
  54.   struct Border LocalSGBorder2;
  55.   struct Window *PrefsWindow=NULL;
  56.  
  57.   LocalSGBorder1=StringGBorder1;
  58.   LocalSGBorder2=StringGBorder2;
  59.   LocalSGBorder1.NextBorder=&LocalSGBorder2;
  60.   LocalSGBorder1.XY=SGVec1;
  61.   LocalSGBorder2.XY=SGVec2;
  62.   BVGadget.GadgetRender=(APTR)&LocalSGBorder1;
  63.   PrefsFenster.Screen = FirstScreen;
  64.   sprintf(BVBuffer,"%3.1f",ChemPrefs->bv);
  65.  
  66.   if (!(PrefsWindow = OpenWindow(&PrefsFenster)))
  67.   {
  68.     SimpleRequest(NO_PREFS_WIN);
  69.     return;
  70.   }
  71.   Print(PrefsWindow,YXREL_TEXT,1,0,320,28);
  72.   Print(PrefsWindow,ICONCREAIFF_TEXT,1,0,50,28);
  73.   Print(PrefsWindow,ICONCREACDM_TEXT,1,0,50,43);
  74.   Print(PrefsWindow,TITLE_TEXT,1,0,50,58);
  75.   Print(PrefsWindow,TIME_WINDOW_TEXT,1,0,50,73);
  76.   while(!ende)
  77.   {
  78.     switch(Nachricht(PrefsWindow))
  79.     {
  80.       case CLOSEWINDOW:
  81.     CloseWindowSafely(PrefsWindow,TRUE);
  82.     ende++;
  83.     break;
  84.       case GADGETUP:
  85.     switch(GadgetID)
  86.     {
  87.       case BVERH:
  88.         ChemPrefs->bv=atof(BVBuffer);
  89.         break;
  90.       case ICONCREACDM:
  91.         if(IconCreaCDMGadget.Flags & SELECTED)
  92.           ChemPrefs->IconCreaCDM=TRUE;
  93.         else
  94.           ChemPrefs->IconCreaCDM=FALSE;
  95.         break;
  96.       case ICONCREAIFF:
  97.         if(IconCreaIFFGadget.Flags & SELECTED)
  98.           ChemPrefs->IconCreaIFF=TRUE;
  99.         else
  100.           ChemPrefs->IconCreaIFF=FALSE;
  101.         break;
  102.       case TITEL:
  103.         if(TitleGadget.Flags & SELECTED)
  104.           ChemPrefs->Title=TRUE;
  105.         else
  106.           ChemPrefs->Title=FALSE;
  107.         ShowTitle(FirstScreen,ChemPrefs->Title);
  108.         break;
  109.       case TIMEWINDOW:
  110.         if(TimeWindowGadget.Flags & SELECTED)
  111.           ChemPrefs->TimeWindow=TRUE;
  112.         else
  113.           ChemPrefs->TimeWindow=FALSE;
  114.         break;
  115.     }
  116.     break;
  117.     }
  118.   }
  119.   return;
  120. }
  121.