home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / dos / listz21s.exe / LZSET10S.RAR / LZS_SDIR.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-25  |  3.9 KB  |  137 lines

  1. /*
  2.  * This file is part of LZSETUP (Configuration program for Listerz)
  3.  *
  4.  * Copyright (c) 1997 Branislav L. Slantchev (gargoyle)
  5.  * A fine product of Silicon Creations, Inc.
  6.  *
  7.  * This file is released under the terms and conditions of the GNU
  8.  * General Public License Version 2. The full text of the license is
  9.  * supplied in the Copying.Doc file included with this archive. This
  10.  * free software comes with absolutely no warranty, as outlined in the
  11.  * licensing text. You are not allowed to remove this copyright notice.
  12.  *
  13.  * Contact: Branislav L. Slantchev at 73023.262@compuserve.com
  14. */
  15. #include <opdefine.h>
  16. #include <string.h>
  17. #include <opcolor.h>
  18. #include <opentry.h>
  19. #include <opstring.h>
  20. #include "lzs_cmds.h"
  21. #include "../lzconfig.h"
  22. #include "file.h"
  23.  
  24. extern FrameArray lz_FrameType;
  25. extern boolean    lz_Dirty;
  26. extern ColorSet   lz_Colors;
  27.  
  28. typedef struct
  29. {
  30.     char system[80];
  31.     char ansiMain[80];
  32.     char procAnsi[80];
  33.     char globalHeader[80];
  34.     char globalFooter[80];
  35.     char areaHeader[80];
  36.     char areaFooter[80];
  37. } SysdirRecord;
  38.  
  39. static word
  40. InitSysdirDlg(EntryScreen &ES, ColorSet &EsColors, SysdirRecord &UR)
  41. {
  42.     char Pic[255];
  43.     long options = wBordered | wClear | wUserContents;
  44.  
  45.     if( !ES.InitCustom(9, 7, 68, 18, EsColors, options) )
  46.         return ES.InitStatus;
  47.  
  48.     ES.wFrame.SetFrameType(lz_FrameType);
  49.     ES.EnableExplosions(15);
  50.     ES.wFrame.AddShadow(shBR, shSeeThru);
  51.     ES.wFrame.AddHeader(" System Paths ", heTR);
  52.     ES.esFieldOptionsOff(efInsertPushes | efAllowEscape |
  53.         efShowReadChar | efDefaultAccepted);
  54.     ES.esFieldOptionsOn(efAutoAdvanceChar | efAutoAdvanceCursor |
  55.         efCursorToEnd | efTrimBlanks | efClearFirstChar);
  56.     ES.SetWrapMode(WrapAtEdges);
  57.  
  58.     CharStr('!', 79, Pic);
  59.  
  60.     ES.AddStringField("System directory  ", 2, 3, Pic, 2, 22, 37,
  61.         hi_System, UR.system);
  62.     ES.AddStringField("Main screen       ", 4, 3, Pic, 4, 22, 37,
  63.         hi_AnsiMain, UR.ansiMain);
  64.     ES.AddStringField("Processing screen ", 5, 3, Pic, 5, 22, 37,
  65.         hi_ProcAnsi, UR.procAnsi);
  66.     ES.AddStringField("Allfiles header   ", 7, 3, Pic, 7, 22, 37,
  67.         hi_GlobalHeader, UR.globalHeader);
  68.     ES.AddStringField("Allfiles footer   ", 8, 3, Pic, 8, 22, 37,
  69.         hi_GlobalFooter, UR.globalFooter);
  70.     ES.AddStringField("Area header       ", 10, 3, Pic, 10, 22, 37,
  71.         hi_AreaHeader, UR.areaHeader);
  72.     ES.AddStringField("Area footer       ", 11, 3, Pic, 11, 22, 37,
  73.         hi_AreaFooter, UR.areaFooter);
  74.  
  75.     if( ES.RawError() ) ES.Done();
  76.     return ES.RawError();
  77. }
  78.  
  79. void
  80. SystemPaths()
  81. {
  82.     SysdirRecord rec;
  83.     EntryScreen  dlg;
  84.  
  85.     strcpy(rec.system, lz_Config.sys_Path);
  86.     strcpy(rec.ansiMain, lz_Config.sys_MainFile);
  87.     strcpy(rec.procAnsi, lz_Config.sys_ProcFile);
  88.     strcpy(rec.globalHeader, lz_Config.text_HeaderAll);
  89.     strcpy(rec.globalFooter, lz_Config.text_FooterAll);
  90.     strcpy(rec.areaHeader, lz_Config.text_Header);
  91.     strcpy(rec.areaFooter, lz_Config.text_Footer);
  92.  
  93.     if( 0 == InitSysdirDlg(dlg, lz_Colors, rec) )
  94.     {
  95.         dlg.Draw();
  96.         dlg.Process();
  97.         dlg.Erase();
  98.         dlg.Done();
  99.  
  100.         if( strcmp(rec.system, lz_Config.sys_Path) )
  101.         {
  102.             file_appchr(lz_Config.sys_Path, rec.system);
  103.             lz_Dirty = TRUE;
  104.         }
  105.         if( strcmp(rec.ansiMain, lz_Config.sys_MainFile) )
  106.         {
  107.             strcpy(lz_Config.sys_MainFile, rec.ansiMain);
  108.             lz_Dirty = TRUE;
  109.         }
  110.         if( strcmp(rec.procAnsi, lz_Config.sys_ProcFile) )
  111.         {
  112.             strcpy(lz_Config.sys_ProcFile, rec.procAnsi);
  113.             lz_Dirty = TRUE;
  114.         }
  115.         if( strcmp(rec.globalHeader, lz_Config.text_HeaderAll) )
  116.         {
  117.             strcpy(lz_Config.text_HeaderAll, rec.globalHeader);
  118.             lz_Dirty = TRUE;
  119.         }
  120.         if( strcmp(rec.globalFooter, lz_Config.text_FooterAll) )
  121.         {
  122.             strcpy(lz_Config.text_FooterAll, rec.globalFooter);
  123.             lz_Dirty = TRUE;
  124.         }
  125.         if( strcmp(rec.areaHeader, lz_Config.text_Header) )
  126.         {
  127.             strcpy(lz_Config.text_Header, rec.areaHeader);
  128.             lz_Dirty = TRUE;
  129.         }
  130.         if( strcmp(rec.areaFooter, lz_Config.text_Footer) )
  131.         {
  132.             strcpy(lz_Config.text_Footer, rec.areaFooter);
  133.             lz_Dirty = TRUE;
  134.         }
  135.     }
  136. }
  137.