home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / ftp.vapor.com / microdot-1 / md1_src_02.lzx / req_netcfgw.c < prev    next >
C/C++ Source or Header  |  2014-05-19  |  3KB  |  118 lines

  1. #include "microdot.h"
  2.  
  3. #include "ogre.h"
  4. #include "ogre_protos.h"
  5.  
  6. static char *doeb_options[] = 
  7. {
  8.    "Immer",
  9.    "Nachfragen",
  10.    "Nie",
  11.    NULL
  12. };
  13.  
  14. int donetcfg( void )
  15. {
  16.     struct IntuiMessage *im;
  17.     struct ogwin *ogw;
  18.     struct Window *w;
  19.     int Done = FALSE;
  20.     char wz[32], sz[32];
  21.     static char *ctrlfilteropts[]á= {á"Nein", "Alle", "Nur Cancel", NULL };
  22.  
  23.     sprintf( wz, "%ld.%ld", prefs.wz_fd, prefs.wz_fm );
  24.     sprintf( sz, "%ld.%ld", prefs.sz_fd, prefs.sz_fm );
  25.  
  26.     ogw = ogreInitWindow( scr, WFLG_RMBTRAP, NULL, "Netz-Konfiguration" );
  27.     ogreAddGroup( ogw, 0, OGFRAME_OUTLINE, " ZusΣtzliche Header " );
  28.     ogreAddString( ogw, 0, 'r', "_Realname:", 55, prefs.userrealname, 42, 40 );
  29.     ogreAddString( ogw, 1, 0, "Organisation:", 0, prefs.organisation, 42, 80 );
  30.     ogreAddString( ogw, 2, 0, "Postanschrift:", 1, prefs.postanschrift, 42, 128 );
  31.     ogreAddString( ogw, 3, 0, "Telefon:", 2, prefs.telefon, 42, 128 );
  32.  
  33.     ogreAddGroup( ogw, 1, OGFRAME_OUTLINE, " Zeitzonen " );
  34.     ogreAddString( ogw, 0, 'f', "Winterzeit An_fang", 5, wz, 6, 6 );
  35.     ogreAddInteger( ogw, 0, 0, "Abweichung zur GMT in Stunden", 6, prefs.wz_offs, -24, +24, 4, 3 );
  36.     ogreAddString( ogw, 1, 0, "Sommerzeit Anfang", 7, sz, 6, 6 );
  37.     ogreAddInteger( ogw, 1, 0, "Abweichung zur GMT in Stunden", 8, prefs.sz_offs, -24, +24, 4, 3 );
  38.  
  39.     ogreAddGroup( ogw, 2, OGFRAME_OUTLINE, " EmpfangsbestΣtigungen " );
  40.     ogreAddCycle( ogw, 0, 'v', "_Verschicken:", 4, doeb_options, 12, prefs.ebmode & 3 );
  41.     ogreAddCheckbox( ogw, 0, '0', "Uhrzeit immer _00:00:00", 3, prefs.ebmode & EBMODE_00 );
  42.  
  43.     ogreAddGroup( ogw, 3, OGFRAME_OUTLINE, " Sonstiges " );
  44.     ogreAddCycle( ogw, 0, 'c', "RFC-_Control-Nachrichten filtern:", 13, ctrlfilteropts, 10, prefs.rfc_control_filter );
  45.  
  46.     ogreAddGroup( ogw, 4, OGFRAME_NONE, NULL );
  47.     ogreAddButton( ogw, 0 | OGB_ONENTER, 'o', "_OK", 10 );
  48.     ogreAddHelp( ogw, 0 );
  49.     ogreAddButton( ogw, 0 | OGB_ONESC, 'a', "_Abbruch", 11 );
  50.  
  51.     w = ogreOpenWindow( ogw );
  52.     if( !w )
  53.         return( 0 );
  54.  
  55.     while( !Done )
  56.     {
  57.         im = ogreWaitIM( ogw );
  58.  
  59.         if( im->Class == IDCMP_GADGETHELP )
  60.             showguidenum( "netcfg_gads", im->Code );
  61.         else if( im->Class == IDCMP_GADGETUP )
  62.         {
  63.             if( im->Code == 10 )
  64.                 Done = 1;
  65.             else if( im->Code == 11 )
  66.                 Done = 2;
  67.         }
  68.  
  69.         ogreIMReply( ogw, im );
  70.     }
  71.  
  72.     /* Speichern */
  73.     if( Done == 1 )
  74.     {
  75.         char *p;
  76.  
  77.         ogreCopyStringValue( ogw, 0, prefs.organisation );
  78.         ogreCopyStringValue( ogw, 1, prefs.postanschrift );
  79.         ogreCopyStringValue( ogw, 2, prefs.telefon );
  80.         ogreCopyStringValue( ogw, 55, prefs.userrealname );
  81.  
  82.         prefs.rfc_control_filter = ogreValue( ogw, 13 );
  83.  
  84.         /* EB's verschicken */
  85.         prefs.ebmode = ogreValue( ogw, 4 );
  86.         if( ogreValue( ogw, 3 ) )
  87.             prefs.ebmode |= EBMODE_00;
  88.  
  89.         prefs.sz_offs = ogreValue( ogw, 8 );
  90.         prefs.wz_offs = ogreValue( ogw, 6 );
  91.  
  92.         p = ogreStringValue( ogw, 7 );
  93.         p = stpblk( p );
  94.         prefs.sz_fd = atoi( p );
  95.         if( prefs.sz_fd < 1 || prefs.sz_fd > 31)
  96.             prefs.sz_fd = 1;
  97.         while( isdigit( *p++ ) );
  98.         prefs.sz_fm = atoi( p );
  99.         if( prefs.sz_fm < 1 || prefs.sz_fm > 12)
  100.             prefs.sz_fm = 1;
  101.  
  102.         p = ogreStringValue( ogw, 5 );
  103.         p = stpblk( p );
  104.         prefs.wz_fd = atoi( p );
  105.         if( prefs.wz_fd < 1 || prefs.wz_fd > 31)
  106.             prefs.wz_fd = 1;
  107.         while( isdigit( *p++ ) );
  108.         prefs.wz_fm = atoi( p );
  109.         if( prefs.wz_fm < 1 || prefs.wz_fm > 12)
  110.             prefs.wz_fm = 1;
  111.  
  112.         mytzset();
  113.  
  114.     }
  115.  
  116.     ogreExitWindow( ogw );
  117. }
  118.