Adding new version of ProCFG 2.22
This commit is contained in:
parent
3f594172b9
commit
155a6800a9
|
@ -0,0 +1,252 @@
|
|||
#define Use_DynamicArrayFile
|
||||
|
||||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
#include "area.hpp"
|
||||
|
||||
|
||||
_MsgArea
|
||||
MsgArea::fEmpty(long r)
|
||||
{
|
||||
_MsgArea ma;
|
||||
|
||||
CLEAR_OBJECT(ma);
|
||||
|
||||
ma.areaNum = r+1;
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
void
|
||||
MsgArea::fMove(long /*r1*/,long r2,_MsgArea& ma)
|
||||
{
|
||||
ma.areaNum = r2+1;
|
||||
}
|
||||
|
||||
_FileArea
|
||||
FileArea::fEmpty(long)
|
||||
{
|
||||
_FileArea fa;
|
||||
|
||||
CLEAR_OBJECT(fa);
|
||||
|
||||
return fa;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
MsgArea_sortfunc(_MsgArea& ma1,_MsgArea& ma2)
|
||||
{
|
||||
return stricmp(ma2.name,ma1.name);
|
||||
}
|
||||
|
||||
static int
|
||||
FileArea_sortfunc(_FileArea& fa1,_FileArea& fa2)
|
||||
{
|
||||
return stricmp(fa2.name,fa1.name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Area::selected_start = -1;
|
||||
int Area::selected_end = -1;
|
||||
|
||||
int MsgArea::file_count = 0;
|
||||
File MsgArea::f;
|
||||
DynamicArrayFile<_MsgArea> *MsgArea::df = NULL;
|
||||
|
||||
int FileArea::file_count = 0;
|
||||
File FileArea::f;
|
||||
DynamicArrayFile<_FileArea> *FileArea::df = NULL;
|
||||
|
||||
MsgArea::MsgArea()
|
||||
{
|
||||
if(file_count <= 0)
|
||||
{
|
||||
f.open(FileName(syspath,"MESSAGES.PB"),fmode_rw | fmode_copen);
|
||||
|
||||
file_count = 0;
|
||||
|
||||
if(!f.opened()) return;
|
||||
|
||||
df = new DynamicArrayFile<_MsgArea>(f);
|
||||
|
||||
df->setEmptyFunc(fEmpty);
|
||||
df->setMoveFunc(fMove);
|
||||
|
||||
selStart(-1);
|
||||
selEnd(-1);
|
||||
}
|
||||
|
||||
file_count++;
|
||||
}
|
||||
|
||||
MsgArea::~MsgArea()
|
||||
{
|
||||
if(file_count <= 1 && f.opened())
|
||||
{
|
||||
delete df;
|
||||
|
||||
f.close();
|
||||
|
||||
file_count = 1;
|
||||
}
|
||||
|
||||
file_count--;
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::read(int rec)
|
||||
{
|
||||
return df->read(rec-1,*this);
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::write(int rec)
|
||||
{
|
||||
areaNum = rec;
|
||||
|
||||
return df->write(rec-1,*this);
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::clear(int rec)
|
||||
{
|
||||
CLEAR_OBJECT(*((_MsgArea *)this));
|
||||
|
||||
return write(rec);
|
||||
}
|
||||
|
||||
int
|
||||
MsgArea::numAreas()
|
||||
{
|
||||
return int(df->numRecords());
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::insert(int rec)
|
||||
{
|
||||
return df->insert(rec-1);
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::remove(int rec)
|
||||
{
|
||||
return df->remove(rec-1);
|
||||
}
|
||||
|
||||
|
||||
dword
|
||||
MsgArea::crc()
|
||||
{
|
||||
return crc32(this,sizeof(_MsgArea));
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::sort(int from,int to)
|
||||
{
|
||||
return df->sort(from,to,MsgArea_sortfunc);
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::move(int start,int end,int to)
|
||||
{
|
||||
return df->move(start,end,to);
|
||||
}
|
||||
|
||||
FileArea::FileArea()
|
||||
{
|
||||
if(file_count <= 0)
|
||||
{
|
||||
f.open(FileName(syspath,"FILECFG.PRO"),fmode_rw | fmode_copen);
|
||||
|
||||
file_count = 0;
|
||||
|
||||
if(!f.opened()) return;
|
||||
|
||||
df = new DynamicArrayFile<_FileArea>(f);
|
||||
|
||||
df->setEmptyFunc(fEmpty);
|
||||
|
||||
selStart(-1);
|
||||
selEnd(-1);
|
||||
}
|
||||
|
||||
file_count++;
|
||||
}
|
||||
|
||||
FileArea::~FileArea()
|
||||
{
|
||||
if(file_count <= 1 && f.opened())
|
||||
{
|
||||
delete df;
|
||||
|
||||
f.close();
|
||||
|
||||
file_count = 1;
|
||||
}
|
||||
|
||||
file_count--;
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::read(int rec)
|
||||
{
|
||||
areaNum = rec;
|
||||
|
||||
return df->read(rec-1,*this);
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::write(int rec)
|
||||
{
|
||||
areaNum = rec;
|
||||
|
||||
return df->write(rec-1,*this);
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::clear(int rec)
|
||||
{
|
||||
CLEAR_OBJECT(*((_FileArea *)this));
|
||||
|
||||
return write(rec);
|
||||
}
|
||||
|
||||
int
|
||||
FileArea::numAreas()
|
||||
{
|
||||
return int(df->numRecords());
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::insert(int rec)
|
||||
{
|
||||
return df->insert(rec-1);
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::remove(int rec)
|
||||
{
|
||||
return df->remove(rec-1);
|
||||
}
|
||||
|
||||
dword
|
||||
FileArea::crc()
|
||||
{
|
||||
return crc32(this,sizeof(_FileArea));
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::sort(int from,int to)
|
||||
{
|
||||
return df->sort(from,to,FileArea_sortfunc);
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::move(int start,int end,int to)
|
||||
{
|
||||
return df->move(start,end,to);
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
class Area
|
||||
{
|
||||
static int selected_start;
|
||||
static int selected_end;
|
||||
public:
|
||||
virtual ~Area() {}
|
||||
|
||||
virtual bool read(int) = 0;
|
||||
virtual bool write(int) = 0;
|
||||
virtual bool clear(int) = 0;
|
||||
|
||||
virtual bool insert(int) = 0;
|
||||
virtual bool remove(int) = 0;
|
||||
|
||||
virtual int numAreas() = 0;
|
||||
|
||||
virtual KEY edit() = 0;
|
||||
|
||||
virtual int selStart(int i = -20000)
|
||||
{
|
||||
if(i != -20000)
|
||||
selected_start = i;
|
||||
|
||||
return selected_start;
|
||||
}
|
||||
virtual int selEnd (int i = -20000)
|
||||
{
|
||||
if(i != -20000)
|
||||
selected_end = i;
|
||||
|
||||
return selected_end;
|
||||
}
|
||||
virtual void listFunc(int,int,int) = 0;
|
||||
virtual dword crc() = 0;
|
||||
|
||||
virtual bool sort(int,int) = 0;
|
||||
virtual bool move(int,int,int) = 0;
|
||||
};
|
||||
|
||||
|
||||
class MsgArea : public _MsgArea , public Area
|
||||
{
|
||||
static File f;
|
||||
static DynamicArrayFile<_MsgArea> *df;
|
||||
static int file_count;
|
||||
|
||||
static _MsgArea fEmpty(long);
|
||||
static void fMove(long,long,_MsgArea&);
|
||||
public:
|
||||
|
||||
|
||||
MsgArea();
|
||||
~MsgArea();
|
||||
|
||||
bool read(int);
|
||||
bool write(int);
|
||||
bool clear(int);
|
||||
|
||||
bool insert(int);
|
||||
bool remove(int);
|
||||
|
||||
int numAreas();
|
||||
|
||||
KEY edit();
|
||||
|
||||
void listFunc(int,int x,int y);
|
||||
|
||||
dword crc();
|
||||
|
||||
bool sort(int,int);
|
||||
bool move(int,int,int);
|
||||
};
|
||||
|
||||
class FileArea : public _FileArea , public Area
|
||||
{
|
||||
static File f;
|
||||
static DynamicArrayFile<_FileArea> *df;
|
||||
static int file_count;
|
||||
|
||||
static _FileArea fEmpty(long);
|
||||
|
||||
int areaNum;
|
||||
|
||||
public:
|
||||
FileArea();
|
||||
~FileArea();
|
||||
|
||||
bool read(int);
|
||||
bool write(int);
|
||||
bool clear(int);
|
||||
|
||||
bool insert(int);
|
||||
bool remove(int);
|
||||
|
||||
int numAreas();
|
||||
|
||||
KEY edit();
|
||||
|
||||
void listFunc(int,int x,int y);
|
||||
|
||||
dword crc();
|
||||
|
||||
bool sort(int,int);
|
||||
bool move(int,int,int);
|
||||
};
|
|
@ -0,0 +1,107 @@
|
|||
area.hpp 1: class Area
|
||||
area.hpp 2: {
|
||||
area.hpp 3: static int selected_start;
|
||||
area.hpp 4: static int selected_end;
|
||||
area.hpp 5: public:
|
||||
area.hpp 6: virtual ~Area() {}
|
||||
area.hpp 7:
|
||||
area.hpp 8: virtual bool read(int) = 0;
|
||||
area.hpp 9: virtual bool write(int) = 0;
|
||||
area.hpp 10: virtual bool clear(int) = 0;
|
||||
area.hpp 11:
|
||||
area.hpp 12: virtual bool insert(int) = 0;
|
||||
area.hpp 13: virtual bool remove(int) = 0;
|
||||
area.hpp 14:
|
||||
area.hpp 15: virtual int numAreas() = 0;
|
||||
area.hpp 16:
|
||||
area.hpp 17: virtual KEY edit() = 0;
|
||||
area.hpp 18:
|
||||
area.hpp 19: virtual int selStart(int i = -20000)
|
||||
area.hpp 20: {
|
||||
area.hpp 21: if(i != -20000)
|
||||
area.hpp 22: selected_start = i;
|
||||
area.hpp 23:
|
||||
area.hpp 24: return selected_start;
|
||||
area.hpp 25: }
|
||||
area.hpp 26: virtual int selEnd (int i = -20000)
|
||||
area.hpp 27: {
|
||||
area.hpp 28: if(i != -20000)
|
||||
area.hpp 29: selected_end = i;
|
||||
area.hpp 30:
|
||||
area.hpp 31: return selected_end;
|
||||
area.hpp 32: }
|
||||
area.hpp 33: virtual void listFunc(int,int,int) = 0;
|
||||
area.hpp 34: virtual dword crc() = 0;
|
||||
area.hpp 35:
|
||||
area.hpp 36: virtual bool sort(int,int) = 0;
|
||||
area.hpp 37: virtual bool move(int,int,int) = 0;
|
||||
area.hpp 38: };
|
||||
area.hpp 39:
|
||||
area.hpp 40:
|
||||
area.hpp 41: class MsgArea : public _MsgArea , public Area
|
||||
area.hpp 42: {
|
||||
area.hpp 43: static File f;
|
||||
area.hpp 44: static DynamicArrayFile<_MsgArea> *df;
|
||||
area.hpp 45: static int file_count;
|
||||
area.hpp 46:
|
||||
area.hpp 47: static _MsgArea fEmpty(long);
|
||||
area.hpp 48: static void fMove(long,long,_MsgArea&);
|
||||
area.hpp 49: public:
|
||||
area.hpp 50:
|
||||
area.hpp 51:
|
||||
area.hpp 52: MsgArea();
|
||||
area.hpp 53: ~MsgArea();
|
||||
area.hpp 54:
|
||||
area.hpp 55: bool read(int);
|
||||
area.hpp 56: bool write(int);
|
||||
area.hpp 57: bool clear(int);
|
||||
area.hpp 58:
|
||||
area.hpp 59: bool insert(int);
|
||||
area.hpp 60: bool remove(int);
|
||||
area.hpp 61:
|
||||
area.hpp 62: int numAreas();
|
||||
area.hpp 63:
|
||||
area.hpp 64: KEY edit();
|
||||
area.hpp 65:
|
||||
area.hpp 66: void listFunc(int,int x,int y);
|
||||
area.hpp 67:
|
||||
area.hpp 68: dword crc();
|
||||
area.hpp 69:
|
||||
area.hpp 70: bool sort(int,int);
|
||||
area.hpp 71: bool move(int,int,int);
|
||||
area.hpp 72: };
|
||||
area.hpp 73:
|
||||
area.hpp 74: class FileArea : public _FileArea , public Area
|
||||
area.hpp 75: {
|
||||
area.hpp 76: static File f;
|
||||
area.hpp 77: static DynamicArrayFile<_FileArea> *df;
|
||||
area.hpp 78: static int file_count;
|
||||
area.hpp 79:
|
||||
area.hpp 80: static _FileArea fEmpty(long);
|
||||
area.hpp 81:
|
||||
area.hpp 82: int areaNum;
|
||||
area.hpp 83:
|
||||
area.hpp 84: public:
|
||||
area.hpp 85: FileArea();
|
||||
area.hpp 86: ~FileArea();
|
||||
area.hpp 87:
|
||||
area.hpp 88: bool read(int);
|
||||
area.hpp 89: bool write(int);
|
||||
area.hpp 90: bool clear(int);
|
||||
area.hpp 91:
|
||||
area.hpp 92: bool insert(int);
|
||||
area.hpp 93: bool remove(int);
|
||||
area.hpp 94:
|
||||
area.hpp 95: int numAreas();
|
||||
area.hpp 96:
|
||||
area.hpp 97: KEY edit();
|
||||
area.hpp 98:
|
||||
area.hpp 99: void listFunc(int,int x,int y);
|
||||
area.hpp 100:
|
||||
area.hpp 101: dword crc();
|
||||
area.hpp 102:
|
||||
area.hpp 103: bool sort(int,int);
|
||||
area.hpp 104: bool move(int,int,int);
|
||||
area.hpp 105: };
|
||||
area.hpp 106:
|
||||
area.hpp 107:
|
Binary file not shown.
|
@ -0,0 +1,103 @@
|
|||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
void
|
||||
edit_akas()
|
||||
{
|
||||
KEY hotkeys[]={ KEY_INS, KEY_DEL, 0 };
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_INT , 0, 0,0, 0, 5 , 6 , 10,2 },
|
||||
{ FRM_INT , 0, 0,0, 0, 5 , 6 , 10,3 },
|
||||
{ FRM_INT , 0, 0,0, 0, 5 , 6 , 10,4 },
|
||||
{ FRM_INT , 0, 0,0, 0, 5 , 6 , 10,5 }
|
||||
};
|
||||
|
||||
SelectWindow sw( num_aka,
|
||||
0x70,
|
||||
aka_select_func,
|
||||
0,
|
||||
NULL,
|
||||
hotkeys );
|
||||
|
||||
sw.open( 37,
|
||||
8,
|
||||
62,
|
||||
20,
|
||||
0x5F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x5D,
|
||||
NULL,
|
||||
0x51 );
|
||||
|
||||
sw.title( "Matrix Addresses", 0x5E );
|
||||
|
||||
for(;;)
|
||||
{
|
||||
tsw_showfooter("\x1<Del>\x1 - Delete Aka \x1<Ins>\x1 - Add Aka \x1<Enter>\x1 - Edit", BAR_NORM, BAR_HIGH );
|
||||
|
||||
sw.redefine(num_aka);
|
||||
|
||||
int choice = sw.process();
|
||||
|
||||
if(choice==SL_ESC) break;
|
||||
|
||||
if(choice==SL_HOTKEY)
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case KEY_INS:
|
||||
{
|
||||
memset(&akas[num_aka],0,sizeof(aka));
|
||||
choice=num_aka++;
|
||||
sw.current=choice;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_DEL:
|
||||
{
|
||||
for(int i=sw.current;i<num_aka-1;i++)
|
||||
akas[i] = akas[i+1];
|
||||
|
||||
if(num_aka)
|
||||
num_aka--;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
FormWindow w( 31,
|
||||
8,
|
||||
51,
|
||||
15,
|
||||
0x3F,
|
||||
SHADOW | EXPLODE | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x38 );
|
||||
|
||||
w.define( frm,
|
||||
4,
|
||||
0x31,
|
||||
0x4E );
|
||||
|
||||
w.open();
|
||||
w.title( "Edit AKA", 0x3F );
|
||||
|
||||
w.attrib( 0x3F );
|
||||
|
||||
w << "\n Zone:\n Net:\n Node:\n Point:";
|
||||
|
||||
frm[0].value=&akas[choice].zone;
|
||||
frm[1].value=&akas[choice].net;
|
||||
frm[2].value=&akas[choice].node;
|
||||
frm[3].value=&akas[choice].point;
|
||||
|
||||
CursorState _cursor(TRUE);
|
||||
|
||||
w.process();
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
|
@ -0,0 +1,801 @@
|
|||
#define Use_DynamicArrayFile
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
#include "area.hpp"
|
||||
|
||||
static void list_func(int i,int x,int y);
|
||||
|
||||
Area *area;
|
||||
|
||||
void
|
||||
edit_areas(int fa)
|
||||
{
|
||||
if(fa)
|
||||
area = new FileArea;
|
||||
else
|
||||
area = new MsgArea;
|
||||
|
||||
int num_areas = area->numAreas();
|
||||
|
||||
KEY hotkeys[]={ ' ','1','2','3','4','5','6','7','8','9',KEY_INS, KEY_DEL , KEY_ALTC, KEY_ALTA, KEY_ALTD, KEY_ALTS, KEY_ALTM, KEY_ALTU, NULL };
|
||||
|
||||
SelectWindow sw;
|
||||
|
||||
sw.open( 1,
|
||||
1,
|
||||
tsw_hsize,
|
||||
tsw_vsize - 3,
|
||||
0x70,
|
||||
BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x7F,
|
||||
NULL,
|
||||
0x78 );
|
||||
|
||||
sw.define( num_areas + 1,
|
||||
0x1E,
|
||||
list_func,
|
||||
0,
|
||||
NULL,
|
||||
hotkeys );
|
||||
|
||||
if(fa)
|
||||
{
|
||||
sw.title( "Select file area", 0x70);
|
||||
|
||||
sw.direct( 10, 0, 0x7F, 'Â' );
|
||||
sw.direct( 10, tsw_vsize - 6, 0x78, 'Á' );
|
||||
}
|
||||
else
|
||||
{
|
||||
sw.title( "Select Message Area", 0x70 );
|
||||
|
||||
sw.direct( 10, 0, 0x7F, 'Â' );
|
||||
sw.direct( 29, tsw_vsize-6, 0x78, 'Á' );
|
||||
sw.direct( 10, tsw_vsize-6, 0x78, 'Á' );
|
||||
}
|
||||
|
||||
int choice = 0;
|
||||
|
||||
bool reselect = TRUE;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(reselect)
|
||||
{
|
||||
Window footwin;
|
||||
|
||||
footwin.open( 1,
|
||||
tsw_vsize - 2,
|
||||
tsw_hsize,
|
||||
tsw_vsize,
|
||||
BAR_COLOR,
|
||||
NOBORDER );
|
||||
|
||||
KeyItem( footwin,
|
||||
10,
|
||||
1,
|
||||
0x4E,
|
||||
"<Ins>",
|
||||
0x4F,
|
||||
"Insert area" );
|
||||
|
||||
KeyItem( footwin,
|
||||
10,
|
||||
2,
|
||||
0x4E,
|
||||
"<AltS>",
|
||||
0x4F,
|
||||
"Sort marked areas" );
|
||||
|
||||
KeyItem( footwin,
|
||||
10,
|
||||
3,
|
||||
0x4E,
|
||||
"<AltU>",
|
||||
0x4F,
|
||||
"Untag all areas" );
|
||||
|
||||
|
||||
KeyItem( footwin,
|
||||
40,
|
||||
1,
|
||||
0x4E,
|
||||
"<Del>",
|
||||
0x4F,
|
||||
"Delete area(s)" );
|
||||
|
||||
KeyItem( footwin,
|
||||
40,
|
||||
2,
|
||||
0x4E,
|
||||
"<AltM>",
|
||||
0x4F,
|
||||
"Move area(s)" );
|
||||
|
||||
KeyItem( footwin,
|
||||
40,
|
||||
3,
|
||||
0x4E,
|
||||
"<Space>",
|
||||
0x4F,
|
||||
"Mark range" );
|
||||
|
||||
|
||||
KeyItem( footwin,
|
||||
66,
|
||||
1,
|
||||
0x4E,
|
||||
"<AltA>",
|
||||
0x4F,
|
||||
"Add area" );
|
||||
|
||||
KeyItem( footwin,
|
||||
66,
|
||||
2,
|
||||
0x4E,
|
||||
"<AltC>",
|
||||
0x4F,
|
||||
"Clear area(s)" );
|
||||
|
||||
KeyItem( footwin,
|
||||
66,
|
||||
3,
|
||||
0x4E,
|
||||
"<Enter>",
|
||||
0x4F,
|
||||
"Edit" );
|
||||
|
||||
|
||||
choice=sw.process();
|
||||
|
||||
if(choice==SL_ESC) break;
|
||||
|
||||
if(choice==SL_HOTKEY)
|
||||
{
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case ' ':
|
||||
{
|
||||
if(sw.current >= num_areas)
|
||||
continue;
|
||||
|
||||
if(area->selStart() < 0)
|
||||
{
|
||||
area->selStart(sw.current);
|
||||
area->selEnd (sw.current);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sw.current == area->selStart()-1)
|
||||
{
|
||||
area->selStart(sw.current);
|
||||
}
|
||||
else
|
||||
if(sw.current == area->selEnd()+1)
|
||||
{
|
||||
area->selEnd(sw.current);
|
||||
}
|
||||
else
|
||||
if(sw.current < area->selStart() || sw.current > area->selEnd())
|
||||
{
|
||||
area->selStart(sw.current);
|
||||
area->selEnd (sw.current);
|
||||
}
|
||||
}
|
||||
|
||||
if(sw.current < num_areas-1)
|
||||
KB.push(KEY_DN);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case KEY_ALTU:
|
||||
{
|
||||
area->selStart(-1);
|
||||
area->selEnd(-1);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case KEY_INS:
|
||||
{
|
||||
area->insert(sw.current+1);
|
||||
num_areas = area->numAreas();
|
||||
sw.redefine(num_areas+1);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case KEY_DEL:
|
||||
{
|
||||
if(area->selStart() >= 0)
|
||||
{
|
||||
if(!ask_confirm("Delete all marked areas?"))
|
||||
continue;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
area->remove(area->selStart()+1);
|
||||
|
||||
if(area->selStart() == area->selEnd())
|
||||
break;
|
||||
|
||||
area->selEnd(area->selEnd()-1);
|
||||
}
|
||||
|
||||
area->selStart(-1);
|
||||
area->selEnd(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sw.current >= num_areas)
|
||||
{
|
||||
tsw_beep();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(ask_confirm("Delete current area?"))
|
||||
{
|
||||
area->remove(sw.current+1);
|
||||
}
|
||||
}
|
||||
|
||||
num_areas = area->numAreas();
|
||||
sw.redefine(num_areas+1);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case KEY_ALTC:
|
||||
{
|
||||
if(area->selStart() >= 0)
|
||||
{
|
||||
if(!ask_confirm("Clear all marked areas?"))
|
||||
continue;
|
||||
|
||||
for(int i=area->selStart();i<=area->selEnd();i++)
|
||||
area->clear(i+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(num_areas < 1 || !area->read(sw.current+1))
|
||||
{
|
||||
tsw_beep();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(ask_confirm("Clear this area?") > 0)
|
||||
area->clear(sw.current+1);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case KEY_ALTS:
|
||||
{
|
||||
ShowBusy("Sorting Areas");
|
||||
|
||||
if(area->selStart() >= 0 && (area->selEnd()-area->selStart()))
|
||||
{
|
||||
area->sort(area->selStart(),area->selEnd());
|
||||
}
|
||||
|
||||
HideBusy();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case KEY_ALTM:
|
||||
{
|
||||
ShowBusy("Moving Areas");
|
||||
|
||||
if(area->selStart() >= 0)
|
||||
{
|
||||
if(!area->move(area->selStart(),area->selEnd(),sw.current))
|
||||
tsw_beep();
|
||||
}
|
||||
|
||||
HideBusy();
|
||||
|
||||
area->selStart(-1);
|
||||
area->selEnd (-1);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9': KB.push((KEY)(char)sw.hotkey);
|
||||
case KEY_ALTA:
|
||||
{
|
||||
int newareanum = num_areas+1;
|
||||
|
||||
Window w( 10,
|
||||
5,
|
||||
40,
|
||||
7,
|
||||
0x3F,
|
||||
SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
w.open();
|
||||
|
||||
w << " New area number: ";
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
w.attrib(0x3E);
|
||||
w.scan(newareanum,5,6);
|
||||
tsw_cursoroff();
|
||||
|
||||
if(newareanum > MAX_MSGAREA || newareanum < 1) continue;
|
||||
|
||||
if(newareanum > num_areas)
|
||||
{
|
||||
for(int i=num_areas+1;i<=newareanum;i++)
|
||||
area->clear(i);
|
||||
|
||||
num_areas = newareanum;
|
||||
|
||||
sw.redefine(num_areas+1);
|
||||
}
|
||||
|
||||
choice = newareanum - 1;
|
||||
|
||||
sw.show(choice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(sw.current == num_areas)
|
||||
{
|
||||
area->clear(sw.current+1);
|
||||
num_areas++;
|
||||
sw.redefine(num_areas+1);
|
||||
}
|
||||
|
||||
if(!area->read(choice+1))
|
||||
{
|
||||
tsw_beep();
|
||||
choice = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
dword crcvalue = area->crc();
|
||||
|
||||
KEY retval = area->edit();
|
||||
|
||||
if(crcvalue != area->crc())
|
||||
{
|
||||
if(ask_save() == 0)
|
||||
area->write(choice+1);
|
||||
}
|
||||
|
||||
if(retval == KEY_PGUP && choice > 0)
|
||||
{
|
||||
choice--;
|
||||
reselect = FALSE;
|
||||
}
|
||||
if(retval == KEY_PGDN && choice < num_areas-1)
|
||||
{
|
||||
choice++;
|
||||
reselect = FALSE;
|
||||
}
|
||||
if(retval == KEY_ESC)
|
||||
reselect = TRUE;
|
||||
}
|
||||
|
||||
delete area;
|
||||
}
|
||||
|
||||
static void
|
||||
ma_help(int i)
|
||||
{
|
||||
char *txt[]=
|
||||
{
|
||||
"Name to use for this message area",
|
||||
"Squish: Full filename of message area ÄÄÄ *.MSG: directory for .MSG files",
|
||||
"Kind of message area (Local/NetMail/EchoMail/Pvt EchoMail)",
|
||||
"Type of messages allowed (Private and/or Public)",
|
||||
"Can users write messages using an alias name?",
|
||||
"Type of message base (Squish/Hudson/*.MSG)",
|
||||
"Level needed to read messages in this area",
|
||||
"Flags needed to read messages in this area",
|
||||
"Level needed to write messages in this area",
|
||||
"Flags needed to write messages in this area",
|
||||
"Level needed to be allowed all operations on messages in this area",
|
||||
"Flags needed to be allowed all operations on messages in this area",
|
||||
"Origin line to use for this area (leave blank for default origin line)",
|
||||
"Press [Enter] to select an AKA address to use for this area",
|
||||
"Echomail tag name (only for \"Echomail\" type areas)",
|
||||
"QWK Area Name (limited to 12 characters)",
|
||||
"Area number where replies will be posted",
|
||||
"Sysop name for this area",
|
||||
"Group #1 this area belongs to",
|
||||
"Group #2 this area belongs to",
|
||||
"Group #3 this area belongs to",
|
||||
"Group #4 this area belongs to",
|
||||
"Does this message area belong to all groups?",
|
||||
"Messages will be killed after specified number of days",
|
||||
"Messages will be killed when received for specified number of days",
|
||||
"Maximum number of messages allowed in this area"
|
||||
};
|
||||
|
||||
tsw_showfooter(txt[i], BAR_COLOR);
|
||||
}
|
||||
|
||||
static void
|
||||
fa_help(int i)
|
||||
{
|
||||
char *txt[]=
|
||||
{
|
||||
"Name/description of this file area",
|
||||
"Directory where files are located",
|
||||
"Full path and filename of file listing for this area",
|
||||
"Flags needed to download from this area (<Enter>=Edit)",
|
||||
"Level needed to download from this area",
|
||||
"Use CD-ROM specific listing format?",
|
||||
"Include files from this area in TOPFILES.A??",
|
||||
"Free area?",
|
||||
"Group #1 this area belongs to",
|
||||
"Group #2 this area belongs to",
|
||||
"Group #3 this area belongs to",
|
||||
"Group #4 this area belongs to",
|
||||
"Does this area belong to all groups?",
|
||||
"Maximum number of downloaded files per day for this area (0=unlimited)",
|
||||
"Maximum number of downloaded Kbytes per day for this area (0=unlimited)",
|
||||
"The date format that is used in FILES.BBS for this area (if listed)"
|
||||
};
|
||||
|
||||
tsw_showfooter(txt[i], BAR_COLOR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
KEY
|
||||
MsgArea::edit()
|
||||
{
|
||||
static char *msgkind[] = { "Local" , "NetMail" , "EchoMail" , "Pvt EchoMail",NULL};
|
||||
static char *msgtype[] = { "Private/Public" , "Private Only" , "Public Only" , "To-All" , NULL };
|
||||
static char *msgaccess[] = { "Real Names Only" , "Free Alias" , "Fixed Alias (or real name)" ,"Fixed Alias (enforced)",NULL};
|
||||
static char *msgbasetype[] = { "Hudson" , "Squish" , "Fido *.MSG", "JAM", NULL};
|
||||
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 80 ,32 , 17,2 },
|
||||
{ FRM_STRING , 0 , 0,0 , FRM_UPPER , 80 ,32 , 17,3 },
|
||||
{ FRM_CHOICE , 0 , msgkind,0 , 0 , 12, 12, 17,4 },
|
||||
{ FRM_CHOICE , 0 , msgtype,0 , 0 , 14, 14, 17,5 },
|
||||
{ FRM_CHOICE , 0 , msgaccess,0 , 0 , 26, 26, 17,6 },
|
||||
{ FRM_CHOICE , 0 , msgbasetype,0,0 , 10, 10, 17,7 },
|
||||
{ FRM_UNSIGNED, 0 , 0,0 , 0 , 5, 6, 17,9 },
|
||||
{ FRM_FUNCTION, 0 , 0,flagonoff_select,0 , 26, 26, 38,9 },
|
||||
{ FRM_UNSIGNED, 0 , 0,0 , 0 , 5, 6, 17,10 },
|
||||
{ FRM_FUNCTION, 0 , 0,flagonoff_select,0 , 26, 26, 38,10 },
|
||||
{ FRM_UNSIGNED, 0 , 0,0 , 0 , 5, 6, 17,11 },
|
||||
{ FRM_FUNCTION, 0 , 0,flagonoff_select,0 , 26, 26, 38,11 },
|
||||
{ FRM_STRING , 0 , 0,0,0 , 61, 54, 17,13 },
|
||||
{ FRM_FUNCTION, 0 , 0,aka_select ,0 , 20, 20, 17,14 },
|
||||
{ FRM_STRING , 0 , 0,0 , FRM_UPPER , 60, 25, 17,15 },
|
||||
{ FRM_STRING , 0 , 0,0 , FRM_UPPER , 12, 13, 17,16 },
|
||||
{ FRM_INT , 0 , 0,0 , 0 , 3, 4, 17,17 },
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 35 ,36 , 17,18 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3, 4, 61,2 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3, 4, 61,3 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3, 4, 61,4 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3, 4, 61,5 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3, 3, 61,7 },
|
||||
{ FRM_INT , 0 , 0,0 , 0 , 3 , 4 , 60,15 },
|
||||
{ FRM_INT , 0 , 0,0 , 0 , 3 , 4 , 60,16 },
|
||||
{ FRM_INT , 0 , 0,0 , 0 , 4 , 5 , 60,17 }
|
||||
};
|
||||
|
||||
|
||||
if(!name[0])
|
||||
{
|
||||
readLevel = 1;
|
||||
writeLevel = 1;
|
||||
sysopLevel = 32000;
|
||||
msgKillDays = 30;
|
||||
rcvKillDays = 14;
|
||||
maxMsgs = 500;
|
||||
}
|
||||
|
||||
|
||||
AccessFlags *readflags[2];
|
||||
AccessFlags *writeflags[2];
|
||||
AccessFlags *sysopflags[2];
|
||||
|
||||
readflags[0] = &readFlags;
|
||||
readflags[1] = &readFlagsNot;
|
||||
writeflags[0] = &writeFlags;
|
||||
writeflags[1] = &writeFlagsNot;
|
||||
sysopflags[0] = &sysopFlags;
|
||||
sysopflags[1] = &sysopFlagsNot;
|
||||
|
||||
frm[0].value = name;
|
||||
frm[1].value = path;
|
||||
frm[2].value = &msgKind;
|
||||
frm[3].value = &msgType;
|
||||
frm[4].value = &flags;
|
||||
frm[5].value = &msgBaseType;
|
||||
frm[6].value = &readLevel;
|
||||
frm[7].value = readflags;
|
||||
frm[8].value = &writeLevel;
|
||||
frm[9].value = writeflags;
|
||||
frm[10].value = &sysopLevel;
|
||||
frm[11].value = sysopflags;
|
||||
frm[12].value = origin;
|
||||
frm[13].value = &aka;
|
||||
frm[14].value = tag;
|
||||
frm[15].value = qwkname;
|
||||
frm[16].value = &replyBoard;
|
||||
frm[17].value = sysop;
|
||||
frm[18].value = &groups[0];
|
||||
frm[19].value = &groups[1];
|
||||
frm[20].value = &groups[2];
|
||||
frm[21].value = &groups[3];
|
||||
frm[22].value = &allGroups;
|
||||
frm[23].value = &msgKillDays;
|
||||
frm[24].value = &rcvKillDays;
|
||||
frm[25].value = &maxMsgs;
|
||||
|
||||
KEY form_keys[] = { KEY_PGUP , KEY_PGDN, 0 };
|
||||
|
||||
FormWindow w( 2,
|
||||
3,
|
||||
77,
|
||||
23,
|
||||
0x1F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x19,
|
||||
NULL,
|
||||
0x10 );
|
||||
|
||||
w.define( frm,
|
||||
26,
|
||||
0x1B,
|
||||
0x4E,
|
||||
form_keys,
|
||||
ma_help );
|
||||
|
||||
w.open();
|
||||
w.title(form( "Message Area #%d", areaNum ), 0x1E );
|
||||
|
||||
w.attrib( 0x1F );
|
||||
w << "\n Name: Group #1:\n"
|
||||
" Path: Group #2:\n"
|
||||
" Message Kind: Group #3:\n"
|
||||
" Message Type: Group #4:\n"
|
||||
" Name Options:\n"
|
||||
" Message Base: All groups:\n"
|
||||
"\n"
|
||||
" Read Level: Read Flags:\n"
|
||||
" Write Level: Write Flags:\n"
|
||||
" Sysop Level: Sysop Flags:\n\n"
|
||||
" Origin Line:\n"
|
||||
" Use AKA:\n"
|
||||
" EchoMail Tag: Kill after days\n"
|
||||
" QWK Area Name: Kill rcvd after days\n"
|
||||
" Reply Area: Max msgs\n"
|
||||
" Sysop:\n";
|
||||
|
||||
w.direct( 3,20,0x1E," <PgUp> Previous Area ");
|
||||
w.direct(53,20,0x1E," <PgDn> Next Area ");
|
||||
|
||||
tsw_cursoron();
|
||||
int retval = w.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
if(retval == ED_HOT)
|
||||
return w.scanHotKey;
|
||||
else
|
||||
return KEY_ESC;
|
||||
}
|
||||
|
||||
KEY
|
||||
FileArea::edit()
|
||||
{
|
||||
char *dateFormats[] =
|
||||
{
|
||||
"MM/DD/YY", "YY/MM/DD", "DD/MM/YY",
|
||||
NULL
|
||||
};
|
||||
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 79 , 45, 17,2 },
|
||||
{ FRM_STRING , 0 , 0,0 , FRM_UPPER , 79 , 45, 17,4 },
|
||||
{ FRM_STRING , 0 , 0,0 , FRM_UPPER , 79 , 45, 17,5 },
|
||||
{ FRM_FUNCTION, 0 , 0,flagonoff_select ,0, 26 , 26, 17,7 },
|
||||
{ FRM_UNSIGNED, 0 , 0,0 , 0 , 5 , 6 , 17,8 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,10 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,11 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,12 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3 , 4 , 17,14 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3 , 4 , 17,15 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3 , 4 , 17,16 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3 , 4 , 17,17 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,18 },
|
||||
{ FRM_INT , 0 , 0,0 , 0 , 5 , 6 , 54,10 },
|
||||
{ FRM_INT , 0 , 0,0 , 0 , 5 , 6 , 54,11 },
|
||||
{ FRM_CHOICE , 0 ,dateFormats,0,0 , 8 , 8 , 54,13 }
|
||||
};
|
||||
|
||||
AccessFlags *fl[2];
|
||||
|
||||
fl[0] = &flags;
|
||||
fl[1] = &flagsNot;
|
||||
|
||||
int tops = (notops) ? 0 : 1;
|
||||
|
||||
frm[0].value = name;
|
||||
frm[1].value = filepath;
|
||||
frm[2].value = listpath;
|
||||
frm[3].value = fl;
|
||||
frm[4].value = &level;
|
||||
frm[5].value = &cdrom;
|
||||
frm[6].value = &tops;
|
||||
frm[7].value = &free;
|
||||
frm[8].value = &groups[0];
|
||||
frm[9].value = &groups[1];
|
||||
frm[10].value = &groups[2];
|
||||
frm[11].value = &groups[3];
|
||||
frm[12].value = &allGroups;
|
||||
frm[13].value = &maxfiles;
|
||||
frm[14].value = &maxkb;
|
||||
frm[15].value = &dateFormat;
|
||||
|
||||
KEY form_keys[] = { KEY_PGUP , KEY_PGDN, 0 };
|
||||
|
||||
FormWindow w( 6,
|
||||
3,
|
||||
71,
|
||||
23,
|
||||
0x1F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x19,
|
||||
NULL,
|
||||
0x10 );
|
||||
|
||||
w.define( frm,
|
||||
16,
|
||||
0x1B,
|
||||
0x4E,
|
||||
form_keys,
|
||||
fa_help );
|
||||
|
||||
w.open();
|
||||
|
||||
w.title( form( "File Area #%d", areaNum ), 0x1E );
|
||||
|
||||
w.attrib(0x1F);
|
||||
|
||||
w << "\n Area name:\n\n"
|
||||
" File Location:\n"
|
||||
" Listing file:\n\n"
|
||||
" Access Flags:\n"
|
||||
" Access Level:\n\n"
|
||||
" Copy local: Max files:\n"
|
||||
" In TOPFILES: Max Kb:\n"
|
||||
" Free Area:\n"
|
||||
" FILES.BBS Date Format:\n"
|
||||
" Group #1:\n"
|
||||
" Group #2:\n"
|
||||
" Group #3:\n"
|
||||
" Group #4:\n"
|
||||
" All Groups:";
|
||||
|
||||
w.direct( 2,20,0x1E," <PgUp> Previous Area ");
|
||||
w.direct(44,20,0x1E," <PgDn> Next Area ");
|
||||
|
||||
CursorState _cursor(TRUE);
|
||||
|
||||
int retval = w.process();
|
||||
|
||||
notops = (tops) ? 0 : 1;
|
||||
|
||||
if(!listpath[0] && filepath[0])
|
||||
{
|
||||
strcpy(listpath , filepath);
|
||||
append_backspace(listpath);
|
||||
strcat(listpath , "FILES.BBS");
|
||||
}
|
||||
|
||||
if(retval == ED_HOT)
|
||||
return w.scanHotKey;
|
||||
else
|
||||
return KEY_ESC;
|
||||
}
|
||||
|
||||
static void
|
||||
list_func(int i,int x,int y)
|
||||
{
|
||||
area->listFunc(i,x,y);
|
||||
}
|
||||
|
||||
void
|
||||
MsgArea::listFunc(int i,int x,int y)
|
||||
{
|
||||
MsgArea ma;
|
||||
char *ptr;
|
||||
|
||||
if(!ma.read(i+1))
|
||||
ptr = form(" <end> ł ł");
|
||||
else
|
||||
if(!ma.name[0])
|
||||
ptr = form(" %5d ł úúúúúúúúúúúúúúúú ł úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú",i+1);
|
||||
else
|
||||
ptr = form(" %5d ł %-16.16s ł %s",i+1,ma.tag,ma.name);
|
||||
|
||||
if(strlen(ptr)>62) ptr[62]=0;
|
||||
|
||||
tsw_maputs(x,y,0x7F,ptr);
|
||||
|
||||
if(i == ma.selStart())
|
||||
tsw_maputs(x,y,0x7E,"Ú>");
|
||||
|
||||
if(i == ma.selEnd())
|
||||
tsw_maputs(x,y,0x7E,"Ŕ>");
|
||||
|
||||
if(i == ma.selEnd() && i == ma.selStart())
|
||||
tsw_maputs(x,y,0x7E,"Ä>");
|
||||
|
||||
if(i > ma.selStart() && i < ma.selEnd())
|
||||
tsw_maputs(x,y,0x7F,"ł");
|
||||
|
||||
tsw_maputc(x+9,y,0x7F,'ł');
|
||||
tsw_maputc(x+28,y,0x7F,'ł');
|
||||
}
|
||||
|
||||
void
|
||||
FileArea::listFunc(int i,int x,int y)
|
||||
{
|
||||
FileArea fa;
|
||||
char *ptr;
|
||||
|
||||
if(!fa.read(i+1))
|
||||
ptr = form(" <end> ł ł ");
|
||||
else
|
||||
if(!fa.name[0])
|
||||
ptr = form(" %5d ł úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú ł úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú",i+1);
|
||||
else
|
||||
ptr = form(" %5d ł %-32.32s ł %s",i+1,fa.name,fa.filepath);
|
||||
|
||||
if(strlen(ptr)>75) ptr[75]=0;
|
||||
|
||||
tsw_maputs(x,y,0x7F,ptr);
|
||||
|
||||
if(i == fa.selStart())
|
||||
tsw_maputs(x,y,0x7E,"Ú>");
|
||||
|
||||
if(i == fa.selEnd())
|
||||
tsw_maputs(x,y,0x7E,"Ŕ>");
|
||||
|
||||
if(i == fa.selEnd() && i == fa.selStart())
|
||||
tsw_maputs(x,y,0x7E,"Ä>");
|
||||
|
||||
if(i > fa.selStart() && i < fa.selEnd())
|
||||
tsw_maputs(x,y,0x7E,"ł");
|
||||
|
||||
tsw_maputc(x+9,y,0x7F,'ł');
|
||||
tsw_maputc(x+44,y,0x7F,'ł');
|
||||
}
|
||||
|
Binary file not shown.
|
@ -0,0 +1,365 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
struct FileArea : _FileArea
|
||||
{
|
||||
static File f;
|
||||
static int file_count;
|
||||
public:
|
||||
FileArea();
|
||||
~FileArea();
|
||||
|
||||
bool read(int);
|
||||
bool write(int);
|
||||
bool clear(int);
|
||||
|
||||
int numAreas();
|
||||
void truncate();
|
||||
};
|
||||
|
||||
int FileArea::file_count = 0;
|
||||
File FileArea::f;
|
||||
|
||||
FileArea::FileArea()
|
||||
{
|
||||
if(file_count <= 0)
|
||||
{
|
||||
f.open(FileName(syspath,"FILECFG.PRO"),fmode_rw | fmode_copen);
|
||||
file_count = 0;
|
||||
}
|
||||
|
||||
file_count++;
|
||||
}
|
||||
|
||||
FileArea::~FileArea()
|
||||
{
|
||||
if(file_count <= 1)
|
||||
{
|
||||
f.close();
|
||||
file_count = 1;
|
||||
}
|
||||
|
||||
file_count--;
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::read(int rec)
|
||||
{
|
||||
f.seek(long(rec-1) * sizeof(_FileArea));
|
||||
|
||||
return (f.read(this,sizeof(*this)) == sizeof(*this)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::write(int rec)
|
||||
{
|
||||
f.seek(long(rec-1) * sizeof(_FileArea));
|
||||
return (f.write(this,sizeof(*this)) == sizeof(*this)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::clear(int rec)
|
||||
{
|
||||
CLEAR_OBJECT(*this);
|
||||
|
||||
return write(rec);
|
||||
}
|
||||
|
||||
int
|
||||
FileArea::numAreas()
|
||||
{
|
||||
return int(f.len() / sizeof(_FileArea));
|
||||
}
|
||||
|
||||
void
|
||||
FileArea::truncate()
|
||||
{
|
||||
FileArea fa;
|
||||
int i = numAreas();
|
||||
|
||||
for(;i>0;i--)
|
||||
{
|
||||
if(!fa.read(i)) continue;
|
||||
|
||||
if(fa.name[0])
|
||||
{
|
||||
f.seek(long(i) * sizeof(_FileArea));
|
||||
f.cut();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!i)
|
||||
{
|
||||
f.seek(0);
|
||||
f.cut();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
farea_list_func(int i,int x,int y)
|
||||
{
|
||||
FileArea fa;
|
||||
char *ptr;
|
||||
|
||||
if(!fa.read(i+1) || !fa.name[0])
|
||||
ptr = form("%5d úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú",i+1);
|
||||
else
|
||||
ptr = form("%5d %s",i+1,fa.name);
|
||||
|
||||
if(strlen(ptr)>43) ptr[43]=0;
|
||||
|
||||
tsw_maputs(x,y,0x5F,ptr);
|
||||
tsw_maputc(x+6,y,0x5E,'³');
|
||||
}
|
||||
|
||||
static void
|
||||
helpfunction(int i)
|
||||
{
|
||||
char *txt[]=
|
||||
{
|
||||
"Name/description of this file area",
|
||||
"Directory where files are located",
|
||||
"Full path and filename of file listing for this area",
|
||||
"Flags needed to download from this area (<Enter>=Edit)",
|
||||
"Level needed to download from this area",
|
||||
"Use CD-ROM specific listing format?",
|
||||
"Include files from this area in TOPFILES.A??",
|
||||
"Free area?",
|
||||
"Group #1 this area belongs to",
|
||||
"Group #2 this area belongs to",
|
||||
"Group #3 this area belongs to",
|
||||
"Group #4 this area belongs to",
|
||||
"Does this area belong to all groups?",
|
||||
"Maximum number of downloaded files per day for this area (0=unlimited)",
|
||||
"Maximum number of downloaded Kbytes per day for this area (0=unlimited)",
|
||||
"The date format that is used in FILES.BBS for this area (if listed)"
|
||||
};
|
||||
|
||||
tsw_showfooter(txt[i], BAR_COLOR);
|
||||
}
|
||||
|
||||
void
|
||||
edit_files()
|
||||
{
|
||||
char *dateFormats[] =
|
||||
{
|
||||
"MM/DD/YY", "YY/MM/DD", "DD/MM/YY",
|
||||
NULL
|
||||
};
|
||||
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 79 , 45, 17,2 },
|
||||
{ FRM_STRING , 0 , 0,0 , FRM_UPPER , 79 , 45, 17,4 },
|
||||
{ FRM_STRING , 0 , 0,0 , FRM_UPPER , 79 , 45, 17,5 },
|
||||
{ FRM_FUNCTION, 0 , 0,flagonoff_select ,0, 26 , 26, 17,7 },
|
||||
{ FRM_UNSIGNED, 0 , 0,0 , 0 , 5 , 6 , 17,8 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,10 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,11 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,12 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3 , 4 , 17,14 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3 , 4 , 17,15 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3 , 4 , 17,16 },
|
||||
{ FRM_SHORT , 0 , 0,0 , 0 , 3 , 4 , 17,17 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,18 },
|
||||
{ FRM_INT , 0 , 0,0 , 0 , 5 , 6 , 54,10 },
|
||||
{ FRM_INT , 0 , 0,0 , 0 , 5 , 6 , 54,11 },
|
||||
{ FRM_CHOICE , 0 ,dateFormats,0,0 , 8 , 8 , 54,13 }
|
||||
};
|
||||
|
||||
FileArea fa;
|
||||
|
||||
int num_areas = fa.numAreas();
|
||||
|
||||
KEY hotkeys[]={ '1','2','3','4','5','6','7','8','9',KEY_INS, KEY_DEL , NULL };
|
||||
|
||||
SelectWindow sw;
|
||||
sw.open(3,3,50,tsw_vsize-3,0x5E,SHADOW);
|
||||
sw.title(" Select File Area ",0x5F);
|
||||
sw.define(num_areas,0x70,farea_list_func,0,NULL,hotkeys);
|
||||
|
||||
sw.direct(7,0,'Ñ');
|
||||
sw.direct(7 ,tsw_vsize-6,'Ï');
|
||||
|
||||
bool reselect = TRUE;
|
||||
int choice;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(reselect)
|
||||
{
|
||||
tsw_showfooter("\001<Ins>\001 - Add Area \001<Del>\001 - Delete Area \001<Enter>\001 - Edit Area", BAR_NORM, BAR_HIGH);
|
||||
|
||||
choice=sw.process();
|
||||
|
||||
if(choice==SL_ESC) break;
|
||||
|
||||
if(choice==SL_HOTKEY)
|
||||
{
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case KEY_DEL:
|
||||
{
|
||||
if(!fa.read(sw.current+1))
|
||||
{
|
||||
tsw_beep();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(fa.name[0])
|
||||
if(ask_save() == 0)
|
||||
fa.clear(sw.current+1);
|
||||
|
||||
continue;
|
||||
}
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9': KB.push((KEY)(char)sw.hotkey);
|
||||
case KEY_INS:
|
||||
{
|
||||
CursorState _cursor(TRUE);
|
||||
|
||||
int newareanum = num_areas+1;
|
||||
|
||||
Window w(10,5,40,7,0x3F);
|
||||
w.open();
|
||||
w << " New area number: ";
|
||||
w.attrib(0x3E);
|
||||
w.scan(newareanum,5,6);
|
||||
|
||||
if(newareanum > MAX_FILEAREA || newareanum < 1) continue;
|
||||
|
||||
if(newareanum > num_areas)
|
||||
{
|
||||
for(int i=num_areas+1;i<=newareanum;i++) fa.clear(i);
|
||||
|
||||
num_areas = newareanum;
|
||||
|
||||
sw.redefine(num_areas);
|
||||
}
|
||||
|
||||
choice = newareanum - 1;
|
||||
|
||||
sw.show(choice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!fa.read(choice+1))
|
||||
{
|
||||
tsw_beep();
|
||||
continue;
|
||||
}
|
||||
|
||||
word crcvalue = crc(&fa,sizeof(fa));
|
||||
|
||||
if(!fa.name[0])
|
||||
{
|
||||
memset(&fa,0,sizeof(fa));
|
||||
fa.level = 1;
|
||||
}
|
||||
|
||||
AccessFlags *flags[2];
|
||||
|
||||
flags[0] = &fa.flags;
|
||||
flags[1] = &fa.flagsNot;
|
||||
|
||||
int tops = (fa.notops) ? 0 : 1;
|
||||
|
||||
frm[0].value = fa.name;
|
||||
frm[1].value = fa.filepath;
|
||||
frm[2].value = fa.listpath;
|
||||
frm[3].value = flags;
|
||||
frm[4].value = &fa.level;
|
||||
frm[5].value = &fa.cdrom;
|
||||
frm[6].value = &tops;
|
||||
frm[7].value = &fa.free;
|
||||
frm[8].value = &fa.groups[0];
|
||||
frm[9].value = &fa.groups[1];
|
||||
frm[10].value = &fa.groups[2];
|
||||
frm[11].value = &fa.groups[3];
|
||||
frm[12].value = &fa.allGroups;
|
||||
frm[13].value = &fa.maxfiles;
|
||||
frm[14].value = &fa.maxkb;
|
||||
frm[15].value = &fa.dateFormat;
|
||||
|
||||
KEY form_keys[] = { KEY_PGUP , KEY_PGDN, 0 };
|
||||
|
||||
FormWindow w(6,3,71,23,0x1F,SHADOW);
|
||||
w.define(frm,16,0x1F,0x70,form_keys,helpfunction);
|
||||
w.open();
|
||||
w.title(form(" File Area #%d ",choice+1),0x1E);
|
||||
w.attrib(0x1E);
|
||||
|
||||
w << "\n Area name :\n\n"
|
||||
" File Location:\n"
|
||||
" Listing file :\n\n"
|
||||
" Access Flags :\n"
|
||||
" Access Level :\n\n"
|
||||
" Copy local : Max files:\n"
|
||||
" In TOPFILES : Max Kb :\n"
|
||||
" Free Area :\n"
|
||||
" FILES.BBS Date Format:\n"
|
||||
" Group #1 :\n"
|
||||
" Group #2 :\n"
|
||||
" Group #3 :\n"
|
||||
" Group #4 :\n"
|
||||
" All Groups :";
|
||||
|
||||
w.direct( 2,20,0x1B," <PgUp> Previous Area ");
|
||||
w.direct(44,20,0x1B," <PgDn> Next Area ");
|
||||
|
||||
CursorState _cursor(TRUE);
|
||||
|
||||
int retval = w.process();
|
||||
|
||||
fa.notops = (tops) ? 0 : 1;
|
||||
|
||||
if(!fa.listpath[0] && fa.filepath[0])
|
||||
{
|
||||
strcpy(fa.listpath , fa.filepath);
|
||||
append_backspace(fa.listpath);
|
||||
strcat(fa.listpath , "FILES.BBS");
|
||||
}
|
||||
|
||||
if(crcvalue != crc(&fa,sizeof(fa)) && fa.name[0])
|
||||
{
|
||||
if(ask_save() == 0)
|
||||
{
|
||||
fa.write(choice+1);
|
||||
}
|
||||
}
|
||||
|
||||
if(retval == ED_HOT)
|
||||
{
|
||||
if(w.scanHotKey == KEY_PGUP && choice > 0)
|
||||
choice--;
|
||||
if(w.scanHotKey == KEY_PGDN && choice < num_areas-1)
|
||||
choice++;
|
||||
|
||||
reselect = FALSE;
|
||||
}
|
||||
else
|
||||
reselect = TRUE;
|
||||
|
||||
}
|
||||
|
||||
if(fa.read(num_areas))
|
||||
{
|
||||
if(!fa.name[0])
|
||||
fa.truncate();
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
|
@ -0,0 +1,428 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
|
||||
|
||||
const int MAX_GROUPS = 255;
|
||||
|
||||
|
||||
|
||||
struct AreaGroup : _AreaGroup
|
||||
{
|
||||
static File f;
|
||||
static int file_count;
|
||||
static String fName;
|
||||
|
||||
|
||||
public:
|
||||
AreaGroup();
|
||||
~AreaGroup();
|
||||
|
||||
static void setFname(char *n)
|
||||
{
|
||||
fName = n;
|
||||
}
|
||||
|
||||
bool read(int);
|
||||
bool write(int);
|
||||
bool clear(int);
|
||||
|
||||
int numGroups();
|
||||
void truncate();
|
||||
};
|
||||
|
||||
|
||||
|
||||
int AreaGroup::file_count = 0;
|
||||
File AreaGroup::f;
|
||||
String AreaGroup::fName;
|
||||
|
||||
|
||||
|
||||
AreaGroup::AreaGroup()
|
||||
{
|
||||
if(file_count <= 0)
|
||||
{
|
||||
f.open(FileName(syspath,fName),fmode_rw | fmode_copen);
|
||||
file_count = 0;
|
||||
}
|
||||
|
||||
file_count++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AreaGroup::~AreaGroup()
|
||||
{
|
||||
if(file_count <= 1)
|
||||
{
|
||||
f.close();
|
||||
file_count = 1;
|
||||
}
|
||||
|
||||
|
||||
file_count--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool AreaGroup::read(int rec)
|
||||
{
|
||||
f.seek(long(rec-1) * sizeof(_AreaGroup));
|
||||
return (f.read(this,sizeof(*this)) == sizeof(*this)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool AreaGroup::write(int rec)
|
||||
{
|
||||
f.seek(long(rec-1) * sizeof(_AreaGroup));
|
||||
return (f.write(this,sizeof(*this)) == sizeof(*this)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool AreaGroup::clear(int rec)
|
||||
{
|
||||
CLEAR_OBJECT(*this);
|
||||
|
||||
return write(rec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int AreaGroup::numGroups()
|
||||
{
|
||||
return f.len() / sizeof(_AreaGroup);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AreaGroup::truncate()
|
||||
{
|
||||
AreaGroup fa;
|
||||
int i = numGroups();
|
||||
|
||||
for(;i>0;i--)
|
||||
{
|
||||
if(!fa.read(i)) continue;
|
||||
|
||||
|
||||
if(fa.name[0])
|
||||
{
|
||||
f.seek(long(i) * sizeof(_AreaGroup));
|
||||
f.cut();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!i)
|
||||
{
|
||||
f.seek(0);
|
||||
f.cut();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
void farea_list_func(int i,int x,int y)
|
||||
{
|
||||
AreaGroup fa;
|
||||
char *ptr;
|
||||
|
||||
if(!fa.read(i+1) || !fa.name[0])
|
||||
{
|
||||
ptr = form("%5d úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú",i+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = form("%5d %s",i+1,fa.name);
|
||||
}
|
||||
|
||||
|
||||
if(strlen(ptr)>43)
|
||||
{
|
||||
ptr[43]=0;
|
||||
}
|
||||
|
||||
|
||||
tsw_maputs( x, y, 0x3F, ptr );
|
||||
tsw_maputc( x + 6, y, 0x3F, 'ł' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
void helpfunction(int i)
|
||||
{
|
||||
char *txt[] = {
|
||||
"Name/description of this group",
|
||||
"Level needed to access this group",
|
||||
"Flags needed to access this group"
|
||||
};
|
||||
|
||||
tsw_showfooter(txt[i], BAR_COLOR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void edit_groups( bool filegroups )
|
||||
{
|
||||
Field frm[] =
|
||||
{
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 79 , 45, 17,2 },
|
||||
{ FRM_UNSIGNED, 0 , 0,0 , 0 , 5 , 6 , 17,4 },
|
||||
{ FRM_FUNCTION, 0 , 0,flagonoff_select ,0, 26 , 26, 17,5 }
|
||||
};
|
||||
|
||||
|
||||
AreaGroup::setFname(filegroups ? "FGROUPS.PB" : "MGROUPS.PB");
|
||||
|
||||
AreaGroup fa;
|
||||
|
||||
int num_areas = fa.numGroups();
|
||||
|
||||
KEY hotkeys[]={ '1','2','3','4','5','6','7','8','9',KEY_INS, KEY_DEL , NULL };
|
||||
|
||||
SelectWindow sw;
|
||||
|
||||
|
||||
sw.open( 3,
|
||||
3,
|
||||
50,
|
||||
tsw_vsize - 3,
|
||||
0x30,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3F,
|
||||
NULL,
|
||||
0x38 );
|
||||
|
||||
sw.title( filegroups ? "Select File Area Group"
|
||||
: "Select Message Area Group",
|
||||
0x30 );
|
||||
|
||||
sw.define(num_areas,0x1F,farea_list_func,0,NULL,hotkeys);
|
||||
|
||||
sw.direct(7, 0, 0x3F, 'Â');
|
||||
sw.direct(7, tsw_vsize - 6, 0x38, 'Á');
|
||||
|
||||
|
||||
again:
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
int alias;
|
||||
|
||||
tsw_showfooter( "\x1<Ins>\x1 - Add Area \x1<Del>\x1 - Delete Area \x1<Enter>\x1 - Edit Area",
|
||||
BAR_NORM,
|
||||
BAR_HIGH );
|
||||
|
||||
int choice=sw.process();
|
||||
|
||||
|
||||
if(choice==SL_ESC)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(choice==SL_HOTKEY)
|
||||
{
|
||||
switch ( sw.hotkey )
|
||||
{
|
||||
case KEY_DEL:
|
||||
{
|
||||
if(!fa.read(sw.current+1))
|
||||
{
|
||||
tsw_beep();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(fa.name[0])
|
||||
{
|
||||
if(ask_save() == 0)
|
||||
{
|
||||
fa.clear(sw.current+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
|
||||
KB.push((KEY)(char)sw.hotkey);
|
||||
|
||||
|
||||
case KEY_INS:
|
||||
{
|
||||
int newareanum = num_areas+1;
|
||||
|
||||
Window w( 10,
|
||||
5,
|
||||
40,
|
||||
7,
|
||||
0x70,
|
||||
SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x7F,
|
||||
NULL,
|
||||
0x71 );
|
||||
|
||||
|
||||
w.open();
|
||||
|
||||
w << " New group number: ";
|
||||
|
||||
tsw_cursoron();
|
||||
w.attrib(0x1E);
|
||||
w.scan(newareanum,5,6);
|
||||
tsw_cursoroff();
|
||||
|
||||
if ( newareanum > MAX_GROUPS ||
|
||||
newareanum < 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ( newareanum > num_areas )
|
||||
{
|
||||
for ( int i = num_areas + 1;
|
||||
i <= newareanum;
|
||||
i++ )
|
||||
{
|
||||
fa.clear( i );
|
||||
}
|
||||
|
||||
|
||||
num_areas = newareanum;
|
||||
|
||||
sw.redefine(num_areas);
|
||||
}
|
||||
|
||||
|
||||
choice = newareanum - 1;
|
||||
|
||||
sw.show(choice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ! fa.read( choice + 1 ) )
|
||||
{
|
||||
tsw_beep();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
unsigned crcvalue = crc(&fa,sizeof(fa));
|
||||
|
||||
|
||||
if ( ! fa.name[ 0 ] )
|
||||
{
|
||||
memset(&fa,0,sizeof(fa));
|
||||
fa.level = 1;
|
||||
}
|
||||
|
||||
|
||||
AccessFlags *flags[2];
|
||||
|
||||
flags[0] = &fa.flags;
|
||||
flags[1] = &fa.flagsNot;
|
||||
|
||||
frm[0].value = fa.name;
|
||||
frm[1].value = &fa.level;
|
||||
frm[2].value = flags;
|
||||
|
||||
|
||||
FormWindow w( 8,
|
||||
6,
|
||||
73,
|
||||
13,
|
||||
0x70,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x7F,
|
||||
NULL,
|
||||
0x78 );
|
||||
|
||||
w.define( frm,
|
||||
3,
|
||||
0x71,
|
||||
0x1E,
|
||||
NULL,
|
||||
helpfunction );
|
||||
|
||||
w.open();
|
||||
|
||||
w.title( form( filegroups
|
||||
? " File Area Group #%d "
|
||||
: " Message Area Group #%d ",
|
||||
choice + 1 ),
|
||||
0x70 );
|
||||
|
||||
w.attrib( 0x70 );
|
||||
|
||||
w << "\n Area name:\n\n"
|
||||
" Access Level:\n"
|
||||
" Access Flags:";
|
||||
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
|
||||
if ( crcvalue != crc( & fa, sizeof( fa ) ) &&
|
||||
fa.name[ 0 ] )
|
||||
{
|
||||
if ( ask_save() == 0)
|
||||
{
|
||||
fa.write(choice+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(fa.read(num_areas))
|
||||
{
|
||||
if( ! fa.name[ 0 ] )
|
||||
{
|
||||
fa.truncate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void edit_fgroups()
|
||||
{
|
||||
edit_groups(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void edit_mgroups()
|
||||
{
|
||||
edit_groups(FALSE);
|
||||
}
|
||||
|
Binary file not shown.
|
@ -0,0 +1,111 @@
|
|||
#include "procfg.hpp"
|
||||
|
||||
void
|
||||
EditListColors()
|
||||
{
|
||||
Window sample_w( 3,
|
||||
16,
|
||||
78,
|
||||
23,
|
||||
0x7,
|
||||
0,
|
||||
CHISEL_BORDER,
|
||||
0x07,
|
||||
NULL,
|
||||
0x08 );
|
||||
|
||||
sample_w.open();
|
||||
|
||||
menu_item savemenu[]=
|
||||
{
|
||||
{ 'T', 12,12," File Tag " },
|
||||
{ 'N', 7,7, " File Name" },
|
||||
{ 'S', 7,7, " File Size" },
|
||||
{ 'D', 7,7, " File Date" },
|
||||
{ 'C', 7,7, " File Counter" },
|
||||
{ 'E', 8,8, " File Description" },
|
||||
{ 'X', 3,3, " Extended descriptions & seperators" },
|
||||
{ 'M', 2,2, " Missing files" },
|
||||
{ 'H', 2,2, " Hide/Show File Counter" },
|
||||
{ 0 , 0,0, NULL }
|
||||
};
|
||||
|
||||
PopMenu menu( savemenu,
|
||||
0x70,
|
||||
0x3E );
|
||||
|
||||
menu.open( 20,
|
||||
3,
|
||||
61,
|
||||
13,
|
||||
0x3F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
menu.title( "File List Format", 0x3E );
|
||||
|
||||
for(;;)
|
||||
{
|
||||
sample_w.attrib(7);
|
||||
sample_w.clear();
|
||||
|
||||
sample_w << "" << cfg.listColorTag << "A ";
|
||||
sample_w << "" << cfg.listColorFileName << "PB_200.ZIP ";
|
||||
sample_w << "" << cfg.listColorDate << "01/02/1994 ";
|
||||
sample_w << "" << cfg.listColorSize << " 450k ";
|
||||
if(!cfg.hideFileCounter)
|
||||
sample_w << "" << cfg.listColorCounter << "[14] ";
|
||||
sample_w << "" << cfg.listColorDesc << "ProBoard v2.00 BBS Software\n";
|
||||
sample_w.moveCursor(37-5*cfg.hideFileCounter,0);
|
||||
sample_w << "" << cfg.listColorDesc << "\"The Choice of Professionals\"\n";
|
||||
sample_w << "" << cfg.listColorSeperator << "-----------------------------------------------------------------------\n";
|
||||
sample_w << "" << cfg.listColorTag << "B ";
|
||||
sample_w << "" << cfg.listColorFileName << "PB_ESP.ZIP ";
|
||||
sample_w << "" << cfg.listColorDate << "18/04/1994 ";
|
||||
sample_w << "" << cfg.listColorSize << " 10k ";
|
||||
if(!cfg.hideFileCounter)
|
||||
sample_w << "" << cfg.listColorCounter << "[04] ";
|
||||
sample_w << "" << cfg.listColorDesc << "Spanish language file for ProBoard\n";
|
||||
sample_w.moveCursor(37-5*cfg.hideFileCounter,0);
|
||||
sample_w << "" << cfg.listColorDesc << "v2.00 or higher\n";
|
||||
sample_w << "" << cfg.listColorTag << " ";
|
||||
sample_w << "" << cfg.listColorFileName << "PB_DUT.ZIP ";
|
||||
sample_w << "" << cfg.listColorMissing << " <MISSING> ";
|
||||
if(!cfg.hideFileCounter)
|
||||
sample_w << "" << cfg.listColorCounter << "[00] ";
|
||||
sample_w << "" << cfg.listColorDesc << "Dutch language file for ProBoard";
|
||||
|
||||
int choice = menu.process();
|
||||
byte *colorPtr;
|
||||
|
||||
if(choice < 1)
|
||||
break;
|
||||
|
||||
switch(choice)
|
||||
{
|
||||
case 1: colorPtr = &cfg.listColorTag;
|
||||
break;
|
||||
case 2: colorPtr = &cfg.listColorFileName;
|
||||
break;
|
||||
case 3: colorPtr = &cfg.listColorSize;
|
||||
break;
|
||||
case 4: colorPtr = &cfg.listColorDate;
|
||||
break;
|
||||
case 5: colorPtr = &cfg.listColorCounter;
|
||||
break;
|
||||
case 6: colorPtr = &cfg.listColorDesc;
|
||||
break;
|
||||
case 7: colorPtr = &cfg.listColorSeperator;
|
||||
break;
|
||||
case 8: colorPtr = &cfg.listColorMissing;
|
||||
break;
|
||||
case 9: cfg.hideFileCounter = !cfg.hideFileCounter;
|
||||
continue;
|
||||
}
|
||||
|
||||
edit_color(1,menu,7,5,menu.attrib(),colorPtr);
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,209 @@
|
|||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
|
||||
|
||||
static
|
||||
void limit_select(int i,int x,int y)
|
||||
{
|
||||
tsw_maputs( x,
|
||||
y,
|
||||
0x3E,
|
||||
form( " %-5s ³ %5u ³%5d' ³%5u ³%4d' ºº%5d ³ %2d%% ³%3d ³ %5d ³%5d ",
|
||||
limit[i].id,
|
||||
limit[i].level,
|
||||
limit[i].timelimit,
|
||||
limit[i].daily_klimit,
|
||||
limit[i].pre_download,
|
||||
limit[i].free,
|
||||
limit[i].factor,
|
||||
limit[i].msgfactor,
|
||||
limit[i].max_download,
|
||||
limit[i].fallto ) );
|
||||
|
||||
tsw_maputc(x+7 ,y,0x3F,'³');
|
||||
tsw_maputc(x+15,y,0x3F,'³');
|
||||
tsw_maputc(x+23,y,0x3F,'³');
|
||||
tsw_maputc(x+30,y,0x3F,'³');
|
||||
tsw_maputs(x+37,y,0x3F,"ºº");
|
||||
tsw_maputc(x+45,y,0x3F,'³');
|
||||
tsw_maputc(x+51,y,0x3F,'³');
|
||||
tsw_maputc(x+56,y,0x3F,'³');
|
||||
tsw_maputc(x+64,y,0x3F,'³');
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
void limit_clear( int x,
|
||||
int y )
|
||||
{
|
||||
tsw_maputs( x,
|
||||
y,
|
||||
0x3F,
|
||||
" ³ ³ ³ ³ ºº ³ ³ ³ ³ ");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void edit_limits()
|
||||
{
|
||||
KEY hotkeys[] = { KEY_INS, KEY_DEL, 0 };
|
||||
|
||||
Field frm[] = {
|
||||
{ FRM_UNSIGNED, 0, 0,0, 0, 5 , 6 ,23,1 },
|
||||
{ FRM_INT , 0, 0,0, 0, 3 , 6 ,23,2 },
|
||||
{ FRM_UNSIGNED, 0, 0,0, 0, 5 , 6 ,23,3 },
|
||||
{ FRM_INT , 0, 0,0, 0, 3 , 6 ,23,4 },
|
||||
{ FRM_STRING , 0, 0,0, 0, 5 , 6 ,23,6 },
|
||||
{ FRM_UNSIGNED, 0, 0,0, 0, 5 , 6 ,23,9 },
|
||||
{ FRM_SHORT , 0, 0,0, 0, 2 , 6 ,23,10 },
|
||||
{ FRM_UNSIGNED, 0, 0,0, 0, 3 , 6 ,23,11 },
|
||||
{ FRM_UNSIGNED, 0, 0,0, 0, 5 , 6 ,23,12 },
|
||||
{ FRM_UNSIGNED, 0, 0,0, 0, 5 , 6 ,23,13 }
|
||||
};
|
||||
|
||||
SelectWindow sw( num_limits,
|
||||
0x1F,
|
||||
limit_select,
|
||||
0,
|
||||
NULL,
|
||||
hotkeys,
|
||||
NULLFUNC,
|
||||
limit_clear );
|
||||
|
||||
|
||||
sw.open( 2,
|
||||
10,
|
||||
77,
|
||||
21,
|
||||
0x30,
|
||||
SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x3F,
|
||||
NULL,
|
||||
0x38 );
|
||||
|
||||
sw.title( "ÄIDÄÄÄÂÄLevelÄÂTmLimitÂDailyKÂPre-DLÒÒÄFreeÄÂFactrÂMsgKÂÄMaxKbÄÂFallTo");
|
||||
|
||||
sw.direct( 1,
|
||||
11,
|
||||
0x38,
|
||||
"ÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÐÐÄÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÁÄÄÄÄÄÄÄÁ" );
|
||||
|
||||
for(;;)
|
||||
{
|
||||
for(int i=0;i<num_limits-1;i++)
|
||||
{
|
||||
for(int j=i+1;j<num_limits;j++)
|
||||
{
|
||||
if(limit[i].level<limit[j].level)
|
||||
{
|
||||
limits temp = limit[i];
|
||||
limit[i] = limit[j];
|
||||
limit[j] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tsw_showfooter("\x1<Del>\x1 - Delete \x1<Ins>\x1 - Add \x1<Enter>\x1 - Edit", BAR_NORM, BAR_HIGH);
|
||||
sw.redefine(num_limits);
|
||||
int choice=sw.process();
|
||||
|
||||
|
||||
if(choice==SL_ESC)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(choice==SL_HOTKEY)
|
||||
{
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case KEY_INS:
|
||||
{
|
||||
memset(&limit[num_limits],0,sizeof(*limit));
|
||||
choice=num_limits++;
|
||||
sw.current=choice;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case KEY_DEL:
|
||||
|
||||
for(int i=sw.current;i<num_limits-1;i++)
|
||||
{
|
||||
limit[i]=limit[i+1];
|
||||
}
|
||||
|
||||
|
||||
if(num_limits)
|
||||
{
|
||||
num_limits--;
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FormWindow w( 9,
|
||||
4,
|
||||
49,
|
||||
18,
|
||||
0x3F,
|
||||
SHADOW | EXPLODE,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
|
||||
w.define( frm,
|
||||
10,
|
||||
0x31,
|
||||
0x4E );
|
||||
w.open();
|
||||
|
||||
w.attrib( 0x3F );
|
||||
|
||||
w << " Security Level:\n"
|
||||
" Time per day: min\n"
|
||||
" Kb Download per day: Kbytes\n"
|
||||
" Download delay: min\n\n"
|
||||
" Usergroup ID:\n\n\n"
|
||||
" Free Download: Kbytes\n"
|
||||
" Upload needed: %\n"
|
||||
" Free download/msg: Kbytes\n"
|
||||
" Maximum download: Kbytes\n"
|
||||
" Fall to level:";
|
||||
|
||||
|
||||
frm[0].value=&limit[choice].level;
|
||||
frm[1].value=&limit[choice].timelimit;
|
||||
frm[2].value=&limit[choice].daily_klimit;
|
||||
frm[3].value=&limit[choice].pre_download;
|
||||
frm[4].value=limit[choice].id;
|
||||
frm[5].value=&limit[choice].free;
|
||||
frm[6].value=&limit[choice].factor;
|
||||
frm[7].value=&limit[choice].msgfactor;
|
||||
frm[8].value=&limit[choice].max_download;
|
||||
frm[9].value=&limit[choice].fallto;
|
||||
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
|
||||
// if(limit[choice].daily_klimit < 0)
|
||||
// {
|
||||
// limit[choice].daily_klimit = 0;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
|
@ -0,0 +1,57 @@
|
|||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
void
|
||||
edit_macros()
|
||||
{
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_STRING , cfg.sysopkeys[0] , 0,0 , 0 , 59 , 40 , 11,2 },
|
||||
{ FRM_STRING , cfg.sysopkeys[1] , 0,0 , 0 , 59 , 40 , 11,3 },
|
||||
{ FRM_STRING , cfg.sysopkeys[2] , 0,0 , 0 , 59 , 40 , 11,4 },
|
||||
{ FRM_STRING , cfg.sysopkeys[3] , 0,0 , 0 , 59 , 40 , 11,5 },
|
||||
{ FRM_STRING , cfg.sysopkeys[4] , 0,0 , 0 , 59 , 40 , 11,6 },
|
||||
{ FRM_STRING , cfg.sysopkeys[5] , 0,0 , 0 , 59 , 40 , 11,7 },
|
||||
{ FRM_STRING , cfg.sysopkeys[6] , 0,0 , 0 , 59 , 40 , 11,8 },
|
||||
{ FRM_STRING , cfg.sysopkeys[7] , 0,0 , 0 , 59 , 40 , 11,9 },
|
||||
{ FRM_STRING , cfg.sysopkeys[8] , 0,0 , 0 , 59 , 40 , 11,10 },
|
||||
{ FRM_STRING , cfg.sysopkeys[9] , 0,0 , 0 , 59 , 40 , 11,11 },
|
||||
};
|
||||
|
||||
FormWindow w( 23,
|
||||
8,
|
||||
78,
|
||||
21,
|
||||
0x5F,
|
||||
SHADOW | BRACKETS | CENTERED_X,
|
||||
CHISEL_BORDER,
|
||||
0x5D,
|
||||
NULL,
|
||||
0x51 );
|
||||
|
||||
w.define( frm,
|
||||
10,
|
||||
0x5E,
|
||||
0x4E );
|
||||
|
||||
w.open();
|
||||
w.attrib( 0x5F );
|
||||
w.title("Sysop Macros", 0x5E );
|
||||
w << "\n Alt-F1:\n"
|
||||
" Alt-F2:\n"
|
||||
" Alt-F3:\n"
|
||||
" Alt-F4:\n"
|
||||
" Alt-F5:\n"
|
||||
" Alt-F6:\n"
|
||||
" Alt-F7:\n"
|
||||
" Alt-F8:\n"
|
||||
" Alt-F9:\n"
|
||||
" Alt-F10:\n";
|
||||
|
||||
tsw_showfooter("Enter \"\001@<doscommand>\001\" OR \"\001<keystrokes>\001\" ('\001|\001'=Enter , '\001^\001'=Esc)", BAR_NORM, BAR_HIGH );
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
}
|
||||
|
Binary file not shown.
|
@ -0,0 +1,908 @@
|
|||
#include <dos.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
struct MenuItem : _MenuItem
|
||||
{
|
||||
MenuItem()
|
||||
{
|
||||
CLEAR_OBJECT(*this);
|
||||
access.timeFrame.setAll();
|
||||
access.terminals = 0xFF;
|
||||
}
|
||||
};
|
||||
|
||||
struct MenuFile : _MenuFile {};
|
||||
|
||||
typedef MenuItem *pMenuItem;
|
||||
|
||||
#define MAX_MENU_ITEMS 255
|
||||
|
||||
static char menunames[200][13];
|
||||
|
||||
KEY
|
||||
colorselect(int mode,Window& ww,int x,int y,char attr,void *data)
|
||||
{
|
||||
char *colnames[]={ "Black","Blue","Green","Cyan","Red","Magenta","Yellow","White"};
|
||||
char cols[]={0,4,2,6,1,5,3,7};
|
||||
char col=*((char *)data);
|
||||
char fg=col&0x7;
|
||||
char bg=(col&0x70)>>4;
|
||||
char dark=(col&0x8)>>3;
|
||||
|
||||
fg=cols[fg];
|
||||
bg=cols[bg];
|
||||
|
||||
col=(bg<<4)|fg;
|
||||
if(!dark) col|=0x8;
|
||||
|
||||
if(!mode)
|
||||
{
|
||||
String s;
|
||||
if(!dark) s="Bright ";
|
||||
s << form("%s on %s",colnames[fg],colnames[bg]);
|
||||
ww.direct(x,y,attr,form("%-25.25s",(char *)s));
|
||||
ww.direct(x+26,y,col," Example Text ");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int starty = ww.minY+y-7;
|
||||
|
||||
if(starty<1)
|
||||
starty = 1;
|
||||
|
||||
Window w( ww.minX + x + 2,
|
||||
starty,
|
||||
ww.minX + x + 23,
|
||||
starty + 11,
|
||||
0xF,
|
||||
EXPLODE | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x07,
|
||||
NULL,
|
||||
0x08 );
|
||||
|
||||
w.open();
|
||||
w.title("Edit Color",0xE);
|
||||
|
||||
int curx=fg,cury=bg;
|
||||
if(!dark) curx|=8;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
for(byte i=0;i<0x80;i++)
|
||||
{
|
||||
w.direct(i%16+2,i/16+2,i,'X');
|
||||
}
|
||||
w.direct(curx+1,cury+2,0xf,'³');
|
||||
w.direct(curx+1,cury+1,0xf,"ÚÄ¿");
|
||||
w.direct(curx+3,cury+2,0xf,'³');
|
||||
w.direct(curx+1,cury+3,0xf,"ÀÄÙ");
|
||||
|
||||
|
||||
KEY k=KB.get();
|
||||
if(k==KEY_ESC) return 0;
|
||||
if(k==KEY_RET) break;
|
||||
w.direct(curx+1,cury+2,0xf,' ');
|
||||
w.direct(curx+1,cury+1,0xf," ");
|
||||
w.direct(curx+3,cury+2,0xf,' ');
|
||||
w.direct(curx+1,cury+3,0xf," ");
|
||||
switch(k)
|
||||
{
|
||||
case KEY_UP: if(cury) cury--; break;
|
||||
case KEY_DN: if(cury<7) cury++; break;
|
||||
case KEY_LT: if(curx) curx--; break;
|
||||
case KEY_RT: if(curx<15) curx++; break;
|
||||
}
|
||||
}
|
||||
|
||||
fg=cols[curx&7];
|
||||
bg=cols[cury];
|
||||
dark=curx&8;
|
||||
|
||||
col=(bg<<4)|fg;
|
||||
if(!dark) col|=8;
|
||||
|
||||
*((char *)data)=col;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
menu_select_func(int i,int x,int y)
|
||||
{
|
||||
tsw_maputs(x+1,y,0x5F,menunames[i]);
|
||||
}
|
||||
|
||||
static LanguageFile far langheader;
|
||||
|
||||
void
|
||||
menu_editor(int n,char *args[])
|
||||
{
|
||||
File lf;
|
||||
|
||||
String langfile = select_language(FALSE);
|
||||
|
||||
if(!langfile.len())
|
||||
return;
|
||||
|
||||
if(langfile != "*")
|
||||
{
|
||||
if(!lf.open(FileName(syspath,langfile,".PBL")))
|
||||
{
|
||||
tsw_beep();
|
||||
tsw_beep();
|
||||
tsw_beep();
|
||||
tsw_beep();
|
||||
tsw_beep();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
lf.read(&langheader , sizeof(LanguageFile));
|
||||
lf.close();
|
||||
|
||||
if(langheader.menuPath[0] == '\0')
|
||||
strcpy(langheader.menuPath,cfg.mnupath);
|
||||
|
||||
if(langheader.txtPath[0] == '\0')
|
||||
strcpy(langheader.txtPath,cfg.txtpath);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(langheader.menuPath,cfg.mnupath);
|
||||
strcpy(langheader.txtPath,cfg.txtpath);
|
||||
}
|
||||
|
||||
String searchpath(langheader.menuPath);
|
||||
searchpath << "*.PBM";
|
||||
int num_menus;
|
||||
|
||||
if(n >= 1)
|
||||
{
|
||||
edit_menu(args[0]);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DirScan f(searchpath);
|
||||
|
||||
for(int i=0;int(f);i++)
|
||||
{
|
||||
FileName fn(f.name());
|
||||
fn.stripExt();
|
||||
strcpy(menunames[i],fn);
|
||||
f++;
|
||||
};
|
||||
num_menus=i;
|
||||
|
||||
qsort(menunames,num_menus,13,(int (*)(const void *,const void *))stricmp);
|
||||
}
|
||||
|
||||
KEY hotkeys[]={ KEY_INS , 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
|
||||
KEY_DEL , 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
|
||||
'1','2','3','4','5','6','7','8','9','0','_','-', 8 , NULL };
|
||||
|
||||
SelectWindow sw( num_menus,
|
||||
0x70,
|
||||
menu_select_func,
|
||||
0,
|
||||
NULL,
|
||||
hotkeys );
|
||||
|
||||
sw.open( 3,
|
||||
3,
|
||||
18,
|
||||
22,
|
||||
0x50,
|
||||
SHADOW | EXPLODE | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x5F,
|
||||
NULL,
|
||||
0x58 );
|
||||
|
||||
sw.title( "Select", 0x5E );
|
||||
|
||||
int index = 0;
|
||||
int found = -1;
|
||||
String cur_title;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
tsw_showfooter("\x1<Ins>\x1 - Create Menu \x1<Enter>\x1 - Edit Menu", BAR_NORM, BAR_HIGH );
|
||||
sw.redefine(num_menus);
|
||||
int choice=sw.process();
|
||||
|
||||
|
||||
if(choice==SL_HOTKEY)
|
||||
{
|
||||
if(sw.hotkey == KEY_INS)
|
||||
{
|
||||
Window w( 10,
|
||||
10,
|
||||
32,
|
||||
12,
|
||||
0x3F,
|
||||
SHADOW | EXPLODE,
|
||||
CHISEL_BORDER,
|
||||
0x3F,
|
||||
NULL,
|
||||
0x38 );
|
||||
w.open();
|
||||
w.attrib(0x3E);
|
||||
w << " Create: ";
|
||||
w.attrib(0x31);
|
||||
tsw_cursoron();
|
||||
w.scan(menunames[num_menus],8U,9U,SCAN_UPPER);
|
||||
tsw_cursoroff();
|
||||
if(!menunames[num_menus][0]) continue;
|
||||
choice=num_menus++;
|
||||
sw.current=choice;
|
||||
}
|
||||
else if(sw.hotkey == KEY_DEL)
|
||||
{
|
||||
Window w( 1,
|
||||
1,
|
||||
40,
|
||||
3,
|
||||
0x4F,
|
||||
SHADOW | EXPLODE | CENTERED_X | CENTERED_Y,
|
||||
CHISEL_BORDER,
|
||||
0x4C,
|
||||
NULL,
|
||||
0x40 );
|
||||
w.open();
|
||||
char *s = menunames[sw.current];
|
||||
w.centerLine(1,form("Delete menu '%s' ? [y/N]",s),0x4E);
|
||||
if(toupper(KB.get())=='Y')
|
||||
{
|
||||
FileName fn(langheader.menuPath,s,".PBM");
|
||||
unlink(fn);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((sw.hotkey<0x0100 && isalnum(toupper(char(sw.hotkey)))) || sw.hotkey == '_' || sw.hotkey == '-')
|
||||
{
|
||||
if(sw.current != found)
|
||||
{
|
||||
cur_title = "";
|
||||
index = 0;
|
||||
found = -1;
|
||||
}
|
||||
|
||||
String tmp_str = cur_title + String(char(toupper(char(sw.hotkey))));
|
||||
|
||||
for(int i = 0 ; i < num_menus ; i++)
|
||||
if(strlen(menunames[i]) >= tmp_str.len() && !strnicmp(tmp_str,menunames[i],tmp_str.len()))
|
||||
{
|
||||
found = i;
|
||||
sw.show(found);
|
||||
cur_title = tmp_str;
|
||||
index++;
|
||||
break;
|
||||
}
|
||||
|
||||
if(i == num_menus) tsw_beep();
|
||||
}
|
||||
else
|
||||
{
|
||||
found = -1;
|
||||
index = 0;
|
||||
cur_title = "";
|
||||
}
|
||||
|
||||
sw.title(cur_title,0x5e);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(choice<0) break;
|
||||
edit_menu(menunames[choice]);
|
||||
}
|
||||
}
|
||||
|
||||
struct m_item
|
||||
{
|
||||
union {
|
||||
char type;
|
||||
char highlight;
|
||||
};
|
||||
unsigned level;
|
||||
AccessFlags flags;
|
||||
char string[76];
|
||||
char key;
|
||||
char data[81];
|
||||
char color;
|
||||
byte attr;
|
||||
};
|
||||
|
||||
const byte MNU_RIP_SHOW_REMOTE = 1;
|
||||
const byte MNU_RIP_HIDE_LOCAL = 2;
|
||||
const byte MNU_RIP_NO_RESET = 4;
|
||||
|
||||
static MenuItem **mitem;
|
||||
static MenuFile *mfile;
|
||||
|
||||
static int num_mitems;
|
||||
|
||||
char *menufunctions[]=
|
||||
{
|
||||
" 0 - Display only",
|
||||
" 1 - Goto menu",
|
||||
" 2 - Gosub menu",
|
||||
" 3 - Goto previous menu",
|
||||
" 4 - Clear stack and goto menu",
|
||||
" 5 - Show ANS/ASC file",
|
||||
" 6 - Change State",
|
||||
" 7 - Shell",
|
||||
" 8 - Version information",
|
||||
" 9 - Logoff",
|
||||
"10 - System usage graph by hour",
|
||||
"11 - Chat request",
|
||||
"12 - Execute Questionnaire",
|
||||
"13 - User list",
|
||||
"14 - Time info",
|
||||
"15 - Show .A??-file & wait",
|
||||
"16 - Change City",
|
||||
"17 - Change Password",
|
||||
"18 - Change Screen Size",
|
||||
"19 - Toggle Clearscreen",
|
||||
"20 - Toggle More Prompt",
|
||||
"21 - Toggle ANSI graphics",
|
||||
"22 - Check for mail & files",
|
||||
"23 - Read messages",
|
||||
"24 - Scan messages",
|
||||
"25 - Qscan messages",
|
||||
"26 - System usage graph by day",
|
||||
"27 - Write a message",
|
||||
"28 - Combined boards select",
|
||||
"29 - System usage graph per week",
|
||||
"30 - Show directory",
|
||||
"31 - List files",
|
||||
"32 - Download a file",
|
||||
"33 - Upload a file",
|
||||
"34 - View archive",
|
||||
"35 - Keyword search",
|
||||
"36 - Filename search",
|
||||
"37 - Show new files",
|
||||
"38 - View a file",
|
||||
"39 - View a named file",
|
||||
"40 - Display .A?? file w/hotkeys",
|
||||
"41 - Toggle fullscreen-editor",
|
||||
"42 - Toggle hotkeys",
|
||||
"43 - Clear marked messages",
|
||||
"44 - Global boards selection",
|
||||
"45 - Display textfile & wait",
|
||||
"46 - Change User's level/flags",
|
||||
"47 - Make a log entry",
|
||||
"48 - Display user hitparade",
|
||||
"49 - Select New MsgArea",
|
||||
"50 - Show users online",
|
||||
"51 - List last callers",
|
||||
"52 - Remote User Editor",
|
||||
"53 - Multi-line chat",
|
||||
"54 - Select New FileArea",
|
||||
"55 - View GIF-file type",
|
||||
"56 - Toggle IBM characters",
|
||||
"57 - Change Phone #",
|
||||
"58 - Change Data/Fax Phone #",
|
||||
"59 - Change Alias",
|
||||
"60 - Run ProBoard PEX File",
|
||||
"61 - Display Bulletin Menu",
|
||||
"62 - Toggle AVATAR",
|
||||
"63 - Toggle AVT/0+",
|
||||
"64 - Show graph (general)",
|
||||
"65 - Display A??/RIP file w/hotkeys",
|
||||
"66 - Change RIPscrip font",
|
||||
"67 - Toggle RIPscrip graphics",
|
||||
"68 - Edit Tagged Files",
|
||||
"69 - Select a new language",
|
||||
"70 - Change date format" ,
|
||||
"71 - Change mailing address" ,
|
||||
"72 - Change fax number",
|
||||
"73 - Change country",
|
||||
"74 - Change default protocol",
|
||||
"75 - Select message area group",
|
||||
"76 - Select file area group"
|
||||
};
|
||||
|
||||
static void simulate();
|
||||
|
||||
static void
|
||||
mitem_select_func(int i,int x,int y)
|
||||
{
|
||||
if(i>=num_mitems) return;
|
||||
|
||||
char *s = mitem[i]->text;
|
||||
|
||||
while(*s==' ') s++;
|
||||
|
||||
if(mitem[i]->function)
|
||||
tsw_maputs(x+1,y,0x1E,form("%c ³ %-22.22s³ %-25.25s³ %-20.20s",mitem[i]->hotKey,s,&menufunctions[mitem[i]->function][5],mitem[i]->data));
|
||||
else
|
||||
tsw_maputs(x+1,y,0x1E,form(" ³ %-22.22s³ ³",s,mitem[i]->data));
|
||||
}
|
||||
|
||||
void
|
||||
menufunc_select_func(int i,int x,int y)
|
||||
{
|
||||
tsw_maputs(x+1,y,0x3E,menufunctions[i]);
|
||||
}
|
||||
|
||||
KEY
|
||||
func_select(int mode,Window& w,int x,int y,char attr,void *data)
|
||||
{
|
||||
char *func=(char *)data;
|
||||
|
||||
if(!mode)
|
||||
w.direct(x,y,attr,form("%-30.30s",menufunctions[*func]));
|
||||
else
|
||||
{
|
||||
SelectWindow sw( 77,
|
||||
0x70,
|
||||
menufunc_select_func );
|
||||
|
||||
sw.open( 17,
|
||||
2,
|
||||
63,
|
||||
23,
|
||||
0x3F,
|
||||
SHADOW | EXPLODE | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3F,
|
||||
NULL,
|
||||
0x38 );
|
||||
|
||||
sw.title( "Select a function" );
|
||||
|
||||
sw.show(*func);
|
||||
int i=sw.process();
|
||||
if(i<0) return 0;
|
||||
*func=i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
edit_menu(char *menu)
|
||||
{
|
||||
int i;
|
||||
static int runcount=0;
|
||||
static MenuItem copy_mitem;
|
||||
|
||||
if(!runcount++) CLEAR_OBJECT(copy_mitem);
|
||||
|
||||
FileName fn(langheader.menuPath,menu);
|
||||
fn << ".PBM";
|
||||
|
||||
mitem = new pMenuItem[MAX_MENU_ITEMS];
|
||||
|
||||
for(i=0;i<MAX_MENU_ITEMS;i++)
|
||||
mitem[i] = new MenuItem;
|
||||
|
||||
mfile = new MenuFile;
|
||||
|
||||
CLEAR_OBJECT(*mfile);
|
||||
|
||||
File f(fn);
|
||||
if(!f.opened())
|
||||
{
|
||||
strcpy(mfile->prompt,"Select: ");
|
||||
mfile->color=7;
|
||||
mfile->highlight=3;
|
||||
num_mitems=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
f.read(mfile,sizeof(*mfile));
|
||||
|
||||
for(num_mitems=0;num_mitems<MAX_MENU_ITEMS;num_mitems++)
|
||||
if(f.read(mitem[num_mitems],sizeof(MenuItem)) != sizeof(MenuItem))
|
||||
break;
|
||||
|
||||
f.close();
|
||||
}
|
||||
|
||||
word crc = 0;
|
||||
|
||||
for(i=0;i<num_mitems;i++)
|
||||
crc += word(i+1) * ::crc(mitem[i],sizeof(MenuItem));
|
||||
|
||||
crc += ::crc(mfile,sizeof(*mfile));
|
||||
|
||||
KEY hotkeys[]={ KEY_INS, KEY_DEL, KEY_ALTP, KEY_ALTS, KEY_ALTC, KEY_CTLP, NULL };
|
||||
|
||||
SelectWindow sw( num_mitems + 1,
|
||||
0x4E,
|
||||
mitem_select_func,
|
||||
0,
|
||||
NULL,
|
||||
hotkeys );
|
||||
|
||||
sw.open( 1,
|
||||
1,
|
||||
80,
|
||||
24,
|
||||
0x1F,
|
||||
EXPLODE | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x19,
|
||||
NULL,
|
||||
0x10 );
|
||||
|
||||
sw.title( menu, 0x1E );
|
||||
|
||||
for(;;)
|
||||
{
|
||||
tsw_showfooter("\001AltC\001-Copy \001CtrlP\001-Paste \001AltP\001-Prompt/RIP \001Ins\001-Insert \001Del\001-Delete \001AltS\001-Show", BAR_NORM, BAR_HIGH );
|
||||
|
||||
sw.redefine(num_mitems+1);
|
||||
int choice=sw.process();
|
||||
|
||||
if(choice==SL_ESC)
|
||||
{
|
||||
word newcrc = 0;
|
||||
|
||||
for(i=0;i<num_mitems;i++)
|
||||
newcrc += word(i+1) * ::crc(mitem[i],sizeof(MenuItem));
|
||||
|
||||
newcrc += ::crc(mfile,sizeof(*mfile));
|
||||
|
||||
if(crc != newcrc)
|
||||
{
|
||||
int choice = ask_save();
|
||||
if(choice>=0)
|
||||
{
|
||||
if(choice == 0)
|
||||
{
|
||||
File f;
|
||||
f.open(fn,fmode_create);
|
||||
if(f.opened())
|
||||
{
|
||||
f.write(mfile,sizeof(*mfile));
|
||||
for(i=0;i<num_mitems;i++)
|
||||
f.write(mitem[i],sizeof(MenuItem));
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(choice==SL_HOTKEY)
|
||||
{
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case KEY_ALTC: {
|
||||
if(!num_mitems || sw.current>=num_mitems) continue;
|
||||
copy_mitem = *mitem[sw.current];
|
||||
continue;
|
||||
}
|
||||
case KEY_CTLP: {
|
||||
if(sw.current<0) sw.current = 0;
|
||||
for(i=num_mitems-1;i>=sw.current;i--) *mitem[i+1] = *mitem[i];
|
||||
*mitem[sw.current] = copy_mitem;
|
||||
num_mitems++;
|
||||
continue;
|
||||
}
|
||||
case KEY_INS: {
|
||||
if(sw.current<0) sw.current=0;
|
||||
for(i=num_mitems-1;i>=sw.current;i--) *mitem[i+1] = *mitem[i];
|
||||
delete mitem[sw.current];
|
||||
mitem[sw.current] = new MenuItem;
|
||||
num_mitems++;
|
||||
continue;
|
||||
}
|
||||
case KEY_DEL: {
|
||||
if(!num_mitems || sw.current>=num_mitems) continue;
|
||||
for(i=sw.current;i<num_mitems-1;i++) *mitem[i]=*mitem[i+1];
|
||||
num_mitems--;
|
||||
continue;
|
||||
}
|
||||
case KEY_ALTP:{
|
||||
FormWindow w( 7,
|
||||
4,
|
||||
74,
|
||||
13,
|
||||
0x3F,
|
||||
SHADOW | EXPLODE | BRACKETS | SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x3F,
|
||||
NULL,
|
||||
0x38 );
|
||||
|
||||
w.open();
|
||||
|
||||
w.title( "Prompt", 0x3E );
|
||||
|
||||
w << "\n Prompt:\n"
|
||||
"\n Color:"
|
||||
"\n Highlight:\n"
|
||||
"\n RIP Menu: (Name: )";
|
||||
|
||||
Field frm[]={
|
||||
{ FRM_STRING, 0, 0,0, 0, 50, 50, 13,2 },
|
||||
{ FRM_FUNCTION, 0, 0,colorselect,0, 25, 25, 13,4 },
|
||||
{ FRM_FUNCTION, 0, 0,colorselect,0, 25, 25, 13,5 },
|
||||
{ FRM_YESNO, 0, 0,0 ,0, 3,3 , 13,7 },
|
||||
{ FRM_STRING, 0, 0,0,FRM_UPPER,8,9,25,7}
|
||||
};
|
||||
frm[0].value=mfile->prompt;
|
||||
frm[1].value=&mfile->color;
|
||||
frm[2].value=&mfile->highlight;
|
||||
frm[3].value=&mfile->attr;
|
||||
frm[4].value=mfile->RIPname;
|
||||
|
||||
//if(strlen(mitem->data) > 8 || !mitem->attr) mitem->data[0]='\0';
|
||||
|
||||
w.define( frm,
|
||||
5,
|
||||
0x31,
|
||||
0x4E );
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
continue;
|
||||
}
|
||||
case KEY_ALTS: simulate();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(choice>=num_mitems)
|
||||
{
|
||||
num_mitems++;
|
||||
delete mitem[choice];
|
||||
mitem[choice] = new MenuItem;
|
||||
}
|
||||
|
||||
char *sex_choices[] = { "Don't Care" , "Male Only" , "Female Only" , NULL };
|
||||
|
||||
Field frm[]={
|
||||
{ FRM_STRING , 0, 0, 0, 0, 159, 74 , 2,3 },
|
||||
{ FRM_FUNCTION, 0, 0, colorselect , 0, 25,25,13,5},
|
||||
{ FRM_CHAR , 0, 0, 0, FRM_UPPER, 1, 1, 13,7 },
|
||||
{ FRM_FUNCTION, 0, 0, func_select, 0, 30, 30 , 13,8 },
|
||||
{ FRM_STRING , 0, 0, 0, 0, 159, 60, 13,9 },
|
||||
{ FRM_UNSIGNED, 0, 0, 0, 0, 5 , 6, 13,11},
|
||||
{ FRM_UNSIGNED, 0, 0, 0, 0, 5 , 6, 13,12},
|
||||
{ FRM_FUNCTION, 0, 0,flagonoff_select,0,32,32,13,13},
|
||||
{ FRM_SHORT , 0, 0, 0, 0, 3 , 4, 13,14},
|
||||
{ FRM_SHORT , 0, 0, 0, 0, 3 , 4, 13,15},
|
||||
{ FRM_CHOICE , 0, sex_choices,0,0,11,11,13,16 },
|
||||
{ FRM_UNSIGNED, 0, 0, 0, 0, 5 , 6, 13,17},
|
||||
{ FRM_UNSIGNED, 0, 0, 0, 0, 5 , 6, 13,18},
|
||||
{ FRM_FUNCTION, 0, 0,edit_timeframe,0,20,20, 13 ,19 },
|
||||
{ FRM_LONG , 0, 0, 0, 0, 5 , 6, 13,20},
|
||||
{ FRM_LONG , 0, 0, 0, 0, 5 , 6, 13,21},
|
||||
|
||||
{ FRM_FUNCTION, 0, 0,edit_nodes,0,20,20, 52 ,11 },
|
||||
|
||||
{ FRM_YESNO , 0, 0,0,0,3,3,52,14},
|
||||
{ FRM_STRING , 0, 0, 0, 0, 15, 16 , 52,15 },
|
||||
|
||||
{ FRM_YESNO , 0, 0,0,0,3,3,56,18},
|
||||
{ FRM_YESNO , 0, 0,0,0,3,3,56,19},
|
||||
{ FRM_YESNO , 0, 0,0,0,3,3,56,20}
|
||||
};
|
||||
|
||||
if(!mitem[choice]->text[0])
|
||||
{
|
||||
mitem[choice]->color = 0x0F;
|
||||
}
|
||||
|
||||
byte rip_remoteshow = (mitem[choice]->attr & MNU_RIP_SHOW_REMOTE) ? 1 : 0;
|
||||
byte rip_localshow = (mitem[choice]->attr & MNU_RIP_HIDE_LOCAL ) ? 0 : 1;
|
||||
byte rip_reset = (mitem[choice]->attr & MNU_RIP_NO_RESET ) ? 0 : 1;
|
||||
byte password_req = (mitem[choice]->attr & MENU_PASSWORD ) ? 1 : 0;
|
||||
|
||||
AccessFlags *flags[2];
|
||||
|
||||
flags[0] = &mitem[choice]->access.flags;
|
||||
flags[1] = &mitem[choice]->access.flagsNot;
|
||||
|
||||
|
||||
frm[0 ].value = mitem[choice]->text;
|
||||
frm[1 ].value = &mitem[choice]->color;
|
||||
frm[2 ].value = &mitem[choice]->hotKey;
|
||||
frm[3 ].value = &mitem[choice]->function;
|
||||
frm[4 ].value = mitem[choice]->data;
|
||||
frm[5 ].value = &mitem[choice]->access.minLevel;
|
||||
frm[6 ].value = &mitem[choice]->access.maxLevel;
|
||||
frm[7 ].value = flags;
|
||||
frm[8 ].value = &mitem[choice]->access.minAge;
|
||||
frm[9 ].value = &mitem[choice]->access.maxAge;
|
||||
frm[10].value = &mitem[choice]->access.sex;
|
||||
frm[11].value = &mitem[choice]->access.minTimeLeft;
|
||||
frm[12].value = &mitem[choice]->access.minTimeOnline;
|
||||
frm[13].value = &mitem[choice]->access.timeFrame;
|
||||
frm[14].value = &mitem[choice]->access.minSpeed;
|
||||
frm[15].value = &mitem[choice]->access.maxSpeed;
|
||||
frm[16].value = mitem[choice]->access.nodes;
|
||||
frm[17].value = &password_req;
|
||||
frm[18].value = mitem[choice]->password;
|
||||
frm[19].value = &rip_remoteshow;
|
||||
frm[20].value = &rip_localshow;
|
||||
frm[21].value = &rip_reset;
|
||||
|
||||
FormWindow w( 1,
|
||||
1,
|
||||
80,
|
||||
24,
|
||||
0x7F,
|
||||
EXPLODE | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x7F,
|
||||
NULL,
|
||||
0x78 );
|
||||
|
||||
w.define( frm,
|
||||
22,
|
||||
0x71,
|
||||
0x4E );
|
||||
|
||||
w.open();
|
||||
w.title( menu, 0x7E );
|
||||
|
||||
w << " 0 1 2 3 4 5 6 7\n"
|
||||
" 12345678901234567890123456789012345678901234567890123456789012345678901234\n\n"
|
||||
"\n Color:\n"
|
||||
"\n Hotkey:"
|
||||
"\n Function:"
|
||||
"\n Data:\n"
|
||||
"\n Min.Level: Nodes:"
|
||||
"\n Max.Level:"
|
||||
"\n Flags:"
|
||||
"\n Min. Age: Password required:"
|
||||
"\n Max. Age: Password:"
|
||||
"\n Sex:"
|
||||
"\n Time Left: ÚÄRIPÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
|
||||
"\n Time Onl.: ³ Show remote: ³"
|
||||
"\n Timeframe: ³ Show local: ³"
|
||||
"\n Min.Speed: ³ Reset screen: ³"
|
||||
"\n Max.Speed: ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ";
|
||||
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
mitem[choice]->attr = rip_remoteshow ? MNU_RIP_SHOW_REMOTE : 0;
|
||||
mitem[choice]->attr |= rip_localshow ? 0 : MNU_RIP_HIDE_LOCAL ;
|
||||
mitem[choice]->attr |= rip_reset ? 0 : MNU_RIP_NO_RESET ;
|
||||
mitem[choice]->attr |= password_req ? MENU_PASSWORD : 0;
|
||||
}
|
||||
|
||||
for(i=0;i<MAX_MENU_ITEMS;i++)
|
||||
delete mitem[i];
|
||||
|
||||
delete [] mitem;
|
||||
delete mfile;
|
||||
}
|
||||
|
||||
static void
|
||||
simulate()
|
||||
{
|
||||
char cols[] = { 0,4,2,6,1,5,3,7 };
|
||||
|
||||
tsw_showfooter("Press any key to return", BAR_COLOR);
|
||||
|
||||
Window w;
|
||||
|
||||
w.open( 1,
|
||||
1,
|
||||
tsw_hsize,
|
||||
tsw_vsize - 1,
|
||||
0xF,
|
||||
NOBORDER | EXPLODE );
|
||||
|
||||
char hl_att = cols[mfile->highlight & 0x7]
|
||||
| (cols[(mfile->highlight & 0x70 )>>4] << 4)
|
||||
| (((mfile->highlight & 0x8 )>>3)?0x00:0x08);
|
||||
|
||||
for(int i=0;i<=num_mitems;i++)
|
||||
{
|
||||
char x[160];
|
||||
MenuItem mi = *mitem[i];
|
||||
|
||||
if(i==num_mitems)
|
||||
{
|
||||
w << '\n';
|
||||
|
||||
CLEAR_OBJECT(mi);
|
||||
strcpy(mi.text,mfile->prompt);
|
||||
mi.color = mfile->color;
|
||||
}
|
||||
|
||||
char att = cols[mi.color&0x7] | (cols[(mi.color&0x70)>>4] << 4) | (((mi.color&0x8)>>3)?0x00:0x08);
|
||||
|
||||
strcpy(x,mi.text);
|
||||
|
||||
w.attrib(att);
|
||||
|
||||
if(x[strlen(x)-1] == ';')
|
||||
{
|
||||
x[strlen(x)-1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
x[strlen(x)+1] = '\0';
|
||||
x[strlen(x)] = '\n';
|
||||
}
|
||||
|
||||
bool highlight = FALSE;
|
||||
|
||||
for(int j=0;j<strlen(x);j++)
|
||||
{
|
||||
switch(x[j])
|
||||
{
|
||||
case '^' :
|
||||
{
|
||||
highlight = !highlight;
|
||||
|
||||
if(highlight)
|
||||
w.attrib(hl_att);
|
||||
else
|
||||
w.attrib(att);
|
||||
}
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
{
|
||||
switch(x[j+1])
|
||||
{
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7': w.attrib(cols[x[j+1]-'0'] | 0x8);
|
||||
j++;
|
||||
break;
|
||||
case '0': w.attrib(att);
|
||||
j++;
|
||||
break;
|
||||
default : w << '\\';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default : w << x[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(mi.hotKey == 1)
|
||||
{
|
||||
if(mi.function==40)
|
||||
{
|
||||
append_backspace(langheader.txtPath);
|
||||
FileName fn(langheader.txtPath,mi.data,".ANS");
|
||||
File f(fn,fmode_read,5000);
|
||||
if(f.opened())
|
||||
{
|
||||
char c;
|
||||
for(;;)
|
||||
{
|
||||
if(f.read(&c,1) != 1) break;
|
||||
w << c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KB.get();
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,121 @@
|
|||
#include <stdio.h>
|
||||
#include "procfg.hpp"
|
||||
|
||||
BitArray *gn;
|
||||
|
||||
static void
|
||||
show_node(int n,int x,int y)
|
||||
{
|
||||
char str[20];
|
||||
|
||||
sprintf(str,"[ ] Node #%-3d",n+1);
|
||||
|
||||
if((*gn)[n+1])
|
||||
str[1] = 'û';
|
||||
|
||||
tsw_mputs(x+1,y,str);
|
||||
}
|
||||
|
||||
KEY
|
||||
edit_nodes(int mode,Window& ww,int x,int y,char attr,void *data)
|
||||
{
|
||||
int i;
|
||||
int totalcleared = 0;
|
||||
byte *arr = (byte *)data;
|
||||
BitArray nodes(255,1);
|
||||
|
||||
gn = &nodes;
|
||||
|
||||
for(i=1;i<=cfg.numnodes;i++)
|
||||
nodes.set(i);
|
||||
|
||||
for(i=0;i<cfg.numnodes;i++)
|
||||
{
|
||||
if(arr[i/8] & (1 << (i & 7)))
|
||||
{
|
||||
nodes.clear(i+1);
|
||||
totalcleared++;
|
||||
}
|
||||
}
|
||||
|
||||
if(!mode)
|
||||
{
|
||||
String str;
|
||||
|
||||
if(!totalcleared)
|
||||
{
|
||||
str = "All nodes";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(totalcleared == cfg.numnodes)
|
||||
{
|
||||
str = "None";
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=1 ; i<=cfg.numnodes;i++)
|
||||
if(nodes[i])
|
||||
{
|
||||
if(str.len() > 16)
|
||||
{
|
||||
str.delLast();
|
||||
str << "....";
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
str << form("%d,",i);
|
||||
}
|
||||
}
|
||||
|
||||
str.delLast();
|
||||
}
|
||||
}
|
||||
|
||||
ww.direct(x,y,attr,form("%-20.20s",(char *)str));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int starty = ww.minY+y-cfg.numnodes/2;
|
||||
|
||||
if(starty<2)
|
||||
starty = 2;
|
||||
|
||||
int endy = starty + cfg.numnodes+1;
|
||||
|
||||
if(endy > 22)
|
||||
endy = 22;
|
||||
|
||||
SelectWindow w(cfg.numnodes,0x70,show_node);
|
||||
|
||||
w.open(ww.minX+x-6,starty,ww.minX+x+14,endy,0x3F,SHADOW);
|
||||
//w.title(" Edit Color ",0xE);
|
||||
|
||||
tsw_cursoroff();
|
||||
for(;;)
|
||||
{
|
||||
int x = w.process();
|
||||
|
||||
if(x < 0)
|
||||
break;
|
||||
|
||||
if(nodes[x+1])
|
||||
nodes.clear(x+1);
|
||||
else
|
||||
nodes.set(x+1);
|
||||
}
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
for(i=0;i<32;i++)
|
||||
arr[i] = 0;
|
||||
|
||||
for(i=1;i<=cfg.numnodes;i++)
|
||||
if(!nodes[i])
|
||||
arr[(i-1)/8] |= (1 << ((i-1) & 7));
|
||||
|
||||
return 0;
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,477 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
void edit_modem(int node);
|
||||
|
||||
static void
|
||||
edit_connect()
|
||||
{
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_STRING , pbcfg.msgCon300 , 0,0 , 0 , 79 , 20, 19,2 },
|
||||
{ FRM_STRING , pbcfg.msgCon1200 , 0,0 , 0 , 79 , 20, 19,3 },
|
||||
{ FRM_STRING , pbcfg.msgCon1275 , 0,0 , 0 , 79 , 20, 19,4 },
|
||||
{ FRM_STRING , pbcfg.msgCon2400 , 0,0 , 0 , 79 , 20, 19,5 },
|
||||
{ FRM_STRING , pbcfg.msgCon4800 , 0,0 , 0 , 79 , 20, 19,6 },
|
||||
{ FRM_STRING , pbcfg.msgCon7200 , 0,0 , 0 , 79 , 20, 19,7 },
|
||||
{ FRM_STRING , pbcfg.msgCon9600 , 0,0 , 0 , 79 , 20, 19,8 },
|
||||
{ FRM_STRING , pbcfg.msgCon12000 , 0,0 , 0 , 79 , 20, 19,9 },
|
||||
{ FRM_STRING , pbcfg.msgCon14400 , 0,0 , 0 , 79 , 20, 19,10 },
|
||||
{ FRM_STRING , pbcfg.msgCon16800 , 0,0 , 0 , 79 , 20, 19,11 },
|
||||
{ FRM_STRING , pbcfg.msgCon19200 , 0,0 , 0 , 79 , 20, 19,12 },
|
||||
{ FRM_STRING , pbcfg.msgCon21600 , 0,0 , 0 , 79 , 20, 19,13 },
|
||||
{ FRM_STRING , pbcfg.msgCon24000 , 0,0 , 0 , 79 , 20, 19,14 },
|
||||
{ FRM_STRING , pbcfg.msgCon26400 , 0,0 , 0 , 79 , 20, 19,15 },
|
||||
|
||||
{ FRM_STRING , pbcfg.msgCon28800 , 0,0 , 0 , 79 , 20, 57,2 },
|
||||
{ FRM_STRING , pbcfg.msgCon31200 , 0,0 , 0 , 79 , 20, 57,3 },
|
||||
{ FRM_STRING , pbcfg.msgCon33600 , 0,0 , 0 , 79 , 20, 57,4 },
|
||||
{ FRM_STRING , pbcfg.msgCon36000 , 0,0 , 0 , 79 , 20, 57,5 },
|
||||
{ FRM_STRING , pbcfg.msgCon38400 , 0,0 , 0 , 79 , 20, 57,6 },
|
||||
{ FRM_STRING , pbcfg.msgCon57600 , 0,0 , 0 , 79 , 20, 57,7 },
|
||||
{ FRM_STRING , pbcfg.msgCon64000 , 0,0 , 0 , 79 , 20, 57,8 },
|
||||
{ FRM_STRING , pbcfg.msgCon115200 , 0,0 , 0 , 79 , 20, 57,9 },
|
||||
{ FRM_LONG , &pbcfg.userConBps1 , 0,0 , 0 , 5 , 6, 40,10 },
|
||||
{ FRM_STRING , pbcfg.msgConUser1 , 0,0 , 0 , 79 , 20, 57,10 },
|
||||
{ FRM_LONG , &pbcfg.userConBps2 , 0,0 , 0 , 5 , 6, 40,11 },
|
||||
{ FRM_STRING , pbcfg.msgConUser2 , 0,0 , 0 , 79 , 20, 57,11 },
|
||||
{ FRM_LONG , &pbcfg.userConBps3 , 0,0 , 0 , 5 , 6, 40,12 },
|
||||
{ FRM_STRING , pbcfg.msgConUser3 , 0,0 , 0 , 79 , 20, 57,12 },
|
||||
{ FRM_LONG , &pbcfg.userConBps4 , 0,0 , 0 , 5 , 6, 40,13 },
|
||||
{ FRM_STRING , pbcfg.msgConUser4 , 0,0 , 0 , 79 , 20, 57,13 },
|
||||
{ FRM_LONG , &pbcfg.userConBps5 , 0,0 , 0 , 5 , 6, 40,14 },
|
||||
{ FRM_STRING , pbcfg.msgConUser5 , 0,0 , 0 , 79 , 20, 57,14 },
|
||||
{ FRM_LONG , &pbcfg.userConBps6 , 0,0 , 0 , 5 , 6, 40,15 },
|
||||
{ FRM_STRING , pbcfg.msgConUser6 , 0,0 , 0 , 79 , 20, 57,15 }
|
||||
};
|
||||
|
||||
FormWindow w( 1,
|
||||
5,
|
||||
80,
|
||||
22,
|
||||
0x3F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
w.open();
|
||||
|
||||
w.title( "Connect Result Strings", 0x3E );
|
||||
|
||||
w.attrib(0x3F);
|
||||
|
||||
w << "\n 300 bps call: 28800 bps call:\n"
|
||||
" 1200 bps call: 31200 bps call:\n"
|
||||
"1200/75 bps call: 33600 bps call:\n"
|
||||
" 2400 bps call: 36000 bps call:\n"
|
||||
" 4800 bps call: 38400 bps call:\n"
|
||||
" 7200 bps call: 57600 bps call:\n"
|
||||
" 9600 bps call: 64000 bps call:\n"
|
||||
" 12000 bps call: 115200 bps call:\n"
|
||||
" 14400 bps call: bps call:\n"
|
||||
" 16800 bps call: bps call:\n"
|
||||
" 19200 bps call: bps call:\n"
|
||||
" 21600 bps call: bps call:\n"
|
||||
" 24000 bps call: bps call:\n"
|
||||
" 26400 bps call: bps call:\n";
|
||||
|
||||
|
||||
w.define( frm,
|
||||
34,
|
||||
0x31,
|
||||
0x4E );
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
edit_commands()
|
||||
{
|
||||
bool manual_answer = !!(pbcfg.flags & MODEM_MANUAL_ANSWER);
|
||||
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_STRING , pbcfg.cmdInit1 , 0,0 , 0 , 79 , 30, 21,2 },
|
||||
{ FRM_STRING , pbcfg.cmdInit2 , 0,0 , 0 , 79 , 30, 21,3 },
|
||||
{ FRM_STRING , pbcfg.cmdInit3 , 0,0 , 0 , 79 , 30, 21,4 },
|
||||
{ FRM_STRING , pbcfg.msgOk , 0,0 , 0 , 79 , 30, 21,6 },
|
||||
{ FRM_STRING , pbcfg.cmdOffHook , 0,0 , 0 , 79 , 30, 21,7 },
|
||||
{ FRM_STRING , pbcfg.cmdDown , 0,0 , 0 , 79 , 30, 21,8 },
|
||||
{ FRM_YESNO , &manual_answer , 0,0 , 0 , 3 , 3 , 21,10 },
|
||||
{ FRM_STRING , pbcfg.msgRing , 0,0 , 0 , 79 , 30, 21,11 },
|
||||
{ FRM_STRING , pbcfg.cmdAnswer , 0,0 , 0 , 79 , 30, 21,12 },
|
||||
{ FRM_STRING , pbcfg.msgConExternal , 0,0 , 0 , 79 , 30, 21,14 },
|
||||
{ FRM_INT , &pbcfg.externalErrorLevel,0,0,0 , 3 , 4 , 21,15 }
|
||||
};
|
||||
|
||||
FormWindow w( 4,
|
||||
6,
|
||||
60,
|
||||
22,
|
||||
0x3F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
w.open();
|
||||
|
||||
w.title( "Command/Message Strings", 0x3E);
|
||||
|
||||
w.attrib(0x3F);
|
||||
|
||||
w << "\n Init Command 1:\n"
|
||||
" Init Command 2:\n"
|
||||
" Init Command 3:\n\n"
|
||||
" Ok Message:\n"
|
||||
" Off Hook Command:\n"
|
||||
" Down Command:\n\n"
|
||||
" Manual Answer:\n"
|
||||
" RING Message:\n"
|
||||
" Answer Command:\n\n"
|
||||
" External/Fax Msg:\n"
|
||||
" ÀÄ>Errorlevel:";
|
||||
|
||||
w.define( frm,
|
||||
11,
|
||||
0x31,
|
||||
0x4E );
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
if(manual_answer)
|
||||
pbcfg.flags |= MODEM_MANUAL_ANSWER;
|
||||
else
|
||||
pbcfg.flags &= ~MODEM_MANUAL_ANSWER;
|
||||
}
|
||||
|
||||
static void
|
||||
edit_hardware()
|
||||
{
|
||||
bool locked = !!(pbcfg.flags & MODEM_LOCKED);
|
||||
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_INT , &pbcfg.port , 0,0 , 0 , 1 , 2 , 18,2 },
|
||||
{ FRM_YESNO , &locked , 0,0 , 0 , 3 , 3 , 18,4 },
|
||||
{ FRM_LONG , &pbcfg.maxBps , 0,0 , 0 , 6 , 7 , 18,5 },
|
||||
{ FRM_INT , &pbcfg.commandDelay , 0,0 , 0 , 2 , 2 , 18,7 },
|
||||
{ FRM_INT , &pbcfg.answerDelay , 0,0 , 0 , 2 , 2 , 18,8 }
|
||||
};
|
||||
|
||||
FormWindow w( 24,
|
||||
7,
|
||||
55,
|
||||
17,
|
||||
0x3F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
w.open();
|
||||
|
||||
w.title( "Modem Hardware Setup", 0x3E );
|
||||
|
||||
w.attrib(0x30);
|
||||
|
||||
w << "\n COM Port:\n"
|
||||
"\n"
|
||||
" Locked Speed:\n"
|
||||
" Max Bps Rate:\n"
|
||||
"\n"
|
||||
" Modem Delay:\n"
|
||||
" Answer Delay:\n";
|
||||
|
||||
w.define( frm,
|
||||
5,
|
||||
0x31,
|
||||
0x4E );
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
if(locked)
|
||||
pbcfg.flags |= MODEM_LOCKED;
|
||||
else
|
||||
pbcfg.flags &= ~MODEM_LOCKED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
static void
|
||||
edit_other()
|
||||
{
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_STRING , pbcfg.ext_connect1 , 0,0 , 0 , 39 , 30, 18,1 },
|
||||
{ FRM_INT , &pbcfg.ext_errlevel1 , 0,0 , 0 , 3 , 4, 62,1 },
|
||||
{ FRM_STRING , pbcfg.ext_connect2 , 0,0 , 0 , 39 , 30, 18,2 },
|
||||
{ FRM_INT , &pbcfg.ext_errlevel2 , 0,0 , 0 , 3 , 4, 62,2 }
|
||||
};
|
||||
|
||||
FormWindow w(4,6,73,9,0x3F,SHADOW|EXPLODE);
|
||||
w.open();
|
||||
w.title(" External Mail Result Strings ",0x3E);
|
||||
w.attrib(0x3F);
|
||||
w << " Match String 1: Errorlevel:\n"
|
||||
" Match String 2: Errorlevel:";
|
||||
|
||||
w.define(frm,4,0x3E,0x70);
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
void
|
||||
edit_pb()
|
||||
{
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_UNSIGNED, &pbcfg.baud , 0,0 , 0 , 5 , 6 , 18,2 },
|
||||
{ FRM_INT , &pbcfg.port , 0,0 , 0 , 1 , 2 , 18,3 },
|
||||
{ FRM_INT , &pbcfg.blanktime , 0,0 , 0 , 4 , 4 , 18,4 },
|
||||
{ FRM_INT , &pbcfg.delay , 0,0 , 0 , 2 , 2 , 18,5 },
|
||||
{ FRM_STRING , pbcfg.initstring , 0,0 , 0 , 69 , 30, 18,6 },
|
||||
{ FRM_STRING , pbcfg.initok , 0,0 , 0 , 39 , 30, 18,7 },
|
||||
{ FRM_STRING , pbcfg.busystring , 0,0 , 0 , 69 , 30, 18,8 },
|
||||
{ FRM_YESNO , &pbcfg.forceanswer , 0,0 , 0 , 3 , 3 , 18,9 },
|
||||
{ FRM_STRING , pbcfg.ring , 0,0 , 0 , 39 , 30, 18,10 },
|
||||
{ FRM_STRING , pbcfg.answer , 0,0 , 0 , 39 , 30, 18,11 },
|
||||
{ FRM_STRING , pbcfg.connect300 , 0,0 , 0 , 39 , 30, 18,13 },
|
||||
{ FRM_STRING , pbcfg.connect1200 , 0,0 , 0 , 39 , 30, 18,14 },
|
||||
{ FRM_STRING , pbcfg.connect2400 , 0,0 , 0 , 39 , 30, 18,15 },
|
||||
{ FRM_STRING , pbcfg.connect4800 , 0,0 , 0 , 39 , 30, 18,16 },
|
||||
{ FRM_STRING , pbcfg.connect7200 , 0,0 , 0 , 39 , 30, 18,17 },
|
||||
{ FRM_STRING , pbcfg.connect9600 , 0,0 , 0 , 39 , 30, 18,18 },
|
||||
{ FRM_STRING , pbcfg.connect12000 , 0,0 , 0 , 39 , 30, 18,19 },
|
||||
{ FRM_STRING , pbcfg.connect14400 , 0,0 , 0 , 39 , 30, 18,20 },
|
||||
{ FRM_STRING , pbcfg.connect19200 , 0,0 , 0 , 39 , 30, 18,21 },
|
||||
{ FRM_STRING , pbcfg.connect38400 , 0,0 , 0 , 39 , 30, 18,22 }
|
||||
};
|
||||
|
||||
FormWindow w(4,1,55,25,0x3F,SHADOW|EXPLODE);
|
||||
w.open();
|
||||
w.title(" Modem Parameters ",0x3E);
|
||||
w.attrib(0x3F);
|
||||
w << "\n Max Baud Rate :\n"
|
||||
" Com-port :\n"
|
||||
" Blanktime (s) :\n"
|
||||
" Modem delay :\n"
|
||||
" Init string :\n"
|
||||
" Init response :\n"
|
||||
" Busy string :\n"
|
||||
" Manual Answer :\n"
|
||||
" RING string :\n"
|
||||
" Answer string :\n\n"
|
||||
" 300 bps call:\n"
|
||||
" 1200 bps call:\n"
|
||||
" 2400 bps call:\n"
|
||||
" 4800 bps call:\n"
|
||||
" 7200 bps call:\n"
|
||||
" 9600 bps call:\n"
|
||||
" 12000 bps call:\n"
|
||||
" 14400 bps call:\n"
|
||||
" 19200 bps call:\n"
|
||||
" 38400 bps call:";
|
||||
|
||||
w.define(frm,20,0x3E,0x70);
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
void
|
||||
edit_pb()
|
||||
{
|
||||
menu_item menuitems[]=
|
||||
{
|
||||
{ 'D', 8,8, " Default" },
|
||||
{ 'N', 5,5, " Node Specific" },
|
||||
{ 0,0,0,NULL }
|
||||
};
|
||||
|
||||
PopMenu menu( menuitems,
|
||||
0x70,
|
||||
0x5E );
|
||||
|
||||
menu.open( 45,
|
||||
15,
|
||||
70,
|
||||
18,
|
||||
0x5F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x5D,
|
||||
NULL,
|
||||
0x51 );
|
||||
|
||||
//menu.border(0x5E);
|
||||
|
||||
menu.title( "Modem Parameters", 0x5E );
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
tsw_showfooter("", BAR_COLOR);
|
||||
int choice=menu.process();
|
||||
if(choice<1) break;
|
||||
switch(choice)
|
||||
{
|
||||
case 1: edit_modem(0); break;
|
||||
case 2:
|
||||
{
|
||||
int n = 1;
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
Window w( 40,
|
||||
17,
|
||||
65,
|
||||
19,
|
||||
0x30,
|
||||
SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
w.open();
|
||||
w << " Enter Node #: ";
|
||||
|
||||
w.attrib(0x31);
|
||||
|
||||
w.scan(n,3,4);
|
||||
|
||||
tsw_cursoroff();
|
||||
|
||||
if(n < 1 || n > cfg.numnodes)
|
||||
tsw_beep();
|
||||
else
|
||||
{
|
||||
w.close();
|
||||
edit_modem(n);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
edit_modem(int node)
|
||||
{
|
||||
FileName fn,fn2;
|
||||
|
||||
menu_item menuitems[]=
|
||||
{
|
||||
{ 'H', 2,2, " Hardware Setup" },
|
||||
{ 'M', 4,4, " coMmand Strings" },
|
||||
{ 'N', 4,4, " coNnect Strings" },
|
||||
{ 0,0,0,NULL }
|
||||
};
|
||||
|
||||
PopMenu menu( menuitems,
|
||||
0x70,
|
||||
0x5E );
|
||||
|
||||
menu.open( 45,
|
||||
15,
|
||||
70,
|
||||
19,
|
||||
0x5F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x5D,
|
||||
NULL,
|
||||
0x51 );
|
||||
|
||||
//menu.border(0x5F);
|
||||
|
||||
if(node)
|
||||
menu.title( form( "Setup #%d", node ), 0x5E );
|
||||
else
|
||||
menu.title( "Default Setup", 0x5E );
|
||||
|
||||
if(node)
|
||||
fn(syspath,form("MODEM%03d.PB",node));
|
||||
else
|
||||
fn(syspath,"MODEM.PB");
|
||||
|
||||
File f;
|
||||
word crc;
|
||||
|
||||
memset(&pbcfg,0,sizeof(pbcfg));
|
||||
|
||||
if(!f.open(fn))
|
||||
f.open(FileName(syspath,"MODEM.PB"));
|
||||
|
||||
if(f.opened())
|
||||
{
|
||||
f.read(&pbcfg,sizeof(pbcfg));
|
||||
f.close();
|
||||
|
||||
crc = ::crc(&pbcfg,sizeof(pbcfg));
|
||||
}
|
||||
else
|
||||
{
|
||||
crc=0xFFFF;
|
||||
}
|
||||
|
||||
again:
|
||||
|
||||
for(;;)
|
||||
{
|
||||
tsw_showfooter("", BAR_COLOR);
|
||||
int choice=menu.process();
|
||||
if(choice<1) break;
|
||||
switch(choice)
|
||||
{
|
||||
case 1: edit_hardware(); break;
|
||||
case 2: edit_commands(); break;
|
||||
case 3: edit_connect(); break;
|
||||
// case 4: edit_other(); break;
|
||||
}
|
||||
}
|
||||
|
||||
if(crc != ::crc(&pbcfg,sizeof(pbcfg)))
|
||||
{
|
||||
int save_choice = ask_save();
|
||||
|
||||
if(save_choice < 0)
|
||||
goto again;
|
||||
|
||||
if(save_choice == 0 )
|
||||
{
|
||||
fn2 = fn;
|
||||
fn2.changeExt("BAK");
|
||||
unlink(fn2);
|
||||
rename(fn,fn2);
|
||||
f.open(fn,fmode_create);
|
||||
f.write(&pbcfg,sizeof(pbcfg));
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,174 @@
|
|||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
static void
|
||||
prot_list_func(int i,int x,int y)
|
||||
{
|
||||
char str[81];
|
||||
strcpy(str,p[i].name);
|
||||
if(strlen(str)>32) str[30]=0;
|
||||
tsw_maputs(x+1,y,0x30,str);
|
||||
}
|
||||
|
||||
void
|
||||
edit_protocol()
|
||||
{
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 49 , 49, 17,2 }, // Protocol name
|
||||
{ FRM_CHAR , 0 , 0,0 , FRM_UPPER , 1 , 1 , 17,4 }, // Protocol key
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,5 }, // batch
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,6 }, // enabled
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,7 }, // both
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 3 , 17,8 }, // bimodem
|
||||
{ FRM_STRING , 0 , 0,0 , FRM_UPPER , 12 , 12, 17,9 }, // Protocol logfile
|
||||
{ FRM_STRING , 0 , 0,0 , FRM_UPPER , 12 , 12, 17,10 }, // Protocol ctlfile
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 127, 59, 17,12 }, // Download command
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 127, 59, 17,14 }, // Upload command
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 79 , 59, 17,16 }, // Download string
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 79 , 59, 17,17 }, // Upload string
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 39 , 39, 17,19 }, // Download keyword
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 39 , 39, 17,20 }, // Upload keyword
|
||||
{ FRM_INT , 0 , 0,0 , 0 , 2 , 3 , 17,22 }, // Upload keyword
|
||||
{ FRM_UNSIGNED, 0 , 0,0 , 0 , 3 , 4 , 65,5 },
|
||||
{ FRM_YESNO , 0 , 0,0 , 0 , 3 , 4 , 65,7 }
|
||||
};
|
||||
|
||||
SelectWindow sw;
|
||||
sw.open( 40,
|
||||
5,
|
||||
75,
|
||||
17,
|
||||
0x30,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3F,
|
||||
NULL,
|
||||
0x38 );
|
||||
|
||||
sw.title( "Select Protocol", 0x3E );
|
||||
|
||||
sw.define( num_proto,
|
||||
0x1E,
|
||||
prot_list_func,
|
||||
0,
|
||||
NULL,
|
||||
select_hotkeys );
|
||||
|
||||
for(;;)
|
||||
{
|
||||
int batch,both,enabled,bimodem,loconly;
|
||||
|
||||
tsw_showfooter( "\x1<Del>\x1 - Delete Protocol \x1<Ins>\x1 - Add Protocol \x1<Enter>\x1 - Edit",
|
||||
BAR_NORM,
|
||||
BAR_HIGH );
|
||||
|
||||
sw.redefine(num_proto);
|
||||
int choice=sw.process();
|
||||
if(choice==SL_ESC) break;
|
||||
if(choice==SL_HOTKEY)
|
||||
{
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case KEY_INS: memset(&p[num_proto],0,sizeof(protocol));
|
||||
choice=num_proto++;
|
||||
sw.current=choice;
|
||||
break;
|
||||
case KEY_DEL: for(int i=sw.current;i<num_proto-1;i++) p[i]=p[i+1];
|
||||
if(num_proto) num_proto--;
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!p[choice].name[0])
|
||||
{
|
||||
p[choice].flags = PROT_ENABLED | PROT_BATCH;
|
||||
strcpy(p[choice].logfile,"DSZLOG.TXT");
|
||||
strcpy(p[choice].ctlfile,"DSZCTL.TXT");
|
||||
strcpy(p[choice].dlstring,"#");
|
||||
strcpy(p[choice].dlkeyword,"S");
|
||||
strcpy(p[choice].ulkeyword,"R");
|
||||
p[choice].wordnr = 10;
|
||||
p[choice].eff = 95;
|
||||
}
|
||||
|
||||
|
||||
if(p[choice].eff>100 || p[choice].eff<50) p[choice].eff=90;
|
||||
|
||||
batch =(p[choice].flags&PROT_BATCH )?1:0;
|
||||
both =(p[choice].flags&PROT_BOTH )?1:0;
|
||||
enabled=(p[choice].flags&PROT_ENABLED)?1:0;
|
||||
bimodem=(p[choice].flags&PROT_BIM )?1:0;
|
||||
loconly=(p[choice].flags&PROT_LOCAL )?1:0;
|
||||
|
||||
frm[0].value=p[choice].name;
|
||||
frm[1].value=&p[choice].key;
|
||||
frm[2].value=&batch;
|
||||
frm[3].value=&enabled;
|
||||
frm[4].value=&both;
|
||||
frm[5].value=&bimodem;
|
||||
frm[6].value=p[choice].logfile;
|
||||
frm[7].value=p[choice].ctlfile;
|
||||
frm[8].value=p[choice].dlcom;
|
||||
frm[9].value=p[choice].ulcom;
|
||||
frm[10].value=p[choice].dlstring;
|
||||
frm[11].value=p[choice].ulstring;
|
||||
frm[12].value=p[choice].dlkeyword;
|
||||
frm[13].value=p[choice].ulkeyword;
|
||||
frm[14].value=&p[choice].wordnr;
|
||||
frm[15].value=&p[choice].eff;
|
||||
frm[16].value=&loconly;
|
||||
|
||||
FormWindow w( 1,
|
||||
1,
|
||||
80,
|
||||
25,
|
||||
0x1F,
|
||||
BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x19,
|
||||
NULL,
|
||||
0x10 );
|
||||
|
||||
w.open();
|
||||
|
||||
w.title( "Protocol Configuration", 0x1E );
|
||||
|
||||
w.attrib( 0x1F );
|
||||
|
||||
w << "\n Protocol Name:\n\n"
|
||||
" Hotkey:\n"
|
||||
" Batch: Efficiency: %\n"
|
||||
" Enabled:\n"
|
||||
" Both-way: Local only:\n"
|
||||
" Bimodem:\n"
|
||||
" Log-file:\n"
|
||||
" Control-file:\n\n"
|
||||
" Download cmd:\n\n"
|
||||
" Upload cmd:\n\n"
|
||||
" Downl. string:\n"
|
||||
" Upload string:\n\n"
|
||||
" Downl. keyw.:\n"
|
||||
" Upload keyw.:\n\n"
|
||||
" File word nr:";
|
||||
|
||||
w.define( frm,
|
||||
17,
|
||||
0x1B,
|
||||
0x4E );
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
p[choice].flags=0;
|
||||
|
||||
if(batch) p[choice].flags |= PROT_BATCH;
|
||||
if(both) p[choice].flags |= PROT_BOTH;
|
||||
if(enabled) p[choice].flags |= PROT_ENABLED;
|
||||
if(bimodem) p[choice].flags |= PROT_BIM;
|
||||
if(loconly) p[choice].flags |= PROT_LOCAL;
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,440 @@
|
|||
|
||||
/* ------------------------------------------------------------
|
||||
* Filename ............... EditPvt.Cpp
|
||||
*
|
||||
* General Purpose ........ Edit private files settings
|
||||
* ------------------------------------------------------------
|
||||
* First date ............. 19 dec 1993
|
||||
*
|
||||
* First in version ....... 2.00
|
||||
*
|
||||
* Written by ............. Alain Schellinck
|
||||
* ------------------------------------------------------------
|
||||
* Revisions:
|
||||
* ----------
|
||||
*
|
||||
* Date | By | Purpose |
|
||||
* ---------+----+--------------------------------------------+
|
||||
* | | |
|
||||
* | | |
|
||||
* | | |
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#include <io.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define Use_LinkedList
|
||||
|
||||
#include <TsWin.Hpp>
|
||||
|
||||
|
||||
#define Uses_PbUsersIdx
|
||||
#define Uses_PbUsersPb
|
||||
#define Uses_PbUsersBbs
|
||||
#include "ThProCfg.Hpp"
|
||||
#include "Template.Hpp"
|
||||
|
||||
struct FileEntry
|
||||
{
|
||||
FileName fname;
|
||||
LngT size;
|
||||
Date date;
|
||||
Time time;
|
||||
};
|
||||
|
||||
LinkedList<_PrivateFile> far pvtfiles;
|
||||
LinkedList<FileEntry> far filelist;
|
||||
|
||||
/*--] Code [-------------------------------------] sortedFileList [--------*/
|
||||
|
||||
/*
|
||||
* Routine : compare()
|
||||
* Purpose : compare two objects from the linked list
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: pointer to 2 objects
|
||||
* Return : return code from stricmp()
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
CompareFileEntry(FileEntry& e1,FileEntry& e2)
|
||||
{
|
||||
return stricmp(e1.fname, e2.fname);
|
||||
}
|
||||
|
||||
/*--] Code [-------------------------------------] File pick functions [---*/
|
||||
|
||||
/*
|
||||
* Routine : listFile()
|
||||
* Purpose : list the specified private file record
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: record number, X and Y coordinates
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
LCL void listFile(IntT recno, IntT x, IntT y)
|
||||
{
|
||||
ChrT c = '+';
|
||||
char lp = '(';
|
||||
char rp = ')';
|
||||
|
||||
FileName fn(pvtfiles[recno].fname);
|
||||
|
||||
if(strchr(fn,'\\'))
|
||||
{
|
||||
if(access(fn,0))
|
||||
c = '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
lp = rp = ' ';
|
||||
|
||||
if(access(FileName(cfg.pvtuploadpath, fn), 0))
|
||||
c = '-';
|
||||
}
|
||||
|
||||
|
||||
fn.stripPath();
|
||||
|
||||
String keep_kill;
|
||||
|
||||
if(pvtfiles[recno].attr & PVTFILE_KEEP)
|
||||
keep_kill = "KEEP";
|
||||
else
|
||||
keep_kill = "KILL";
|
||||
|
||||
tsw_maputs(x + 1, y, setFBColor(hYellow, nMagenta), form("[%c] %s %c%-12s%c - %-28.28s [%4s]",
|
||||
c,
|
||||
ChrP(pvtfiles[recno].date.format("DD MMM YY")),
|
||||
lp,(char *)fn,rp,
|
||||
pvtfiles[recno].to,
|
||||
(char *)keep_kill
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : listFileEntry()
|
||||
* Purpose : list the specified file from private files directory
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: record number, X and Y coordinates
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
LCL void listFileEntry(IntT recno, IntT x, IntT y)
|
||||
{
|
||||
FileEntry entry = filelist[recno];
|
||||
|
||||
tsw_maputs(x + 1, y, setFBColor(hYellow, nBlue), form("%-12.12s %s %s %6lu",
|
||||
(char *)entry.fname,
|
||||
(char *)entry.date.format("DD MMM CCYY"),
|
||||
(char *)entry.time.format("HH:MM.SS"),
|
||||
entry.size
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : editPvtFile()
|
||||
* Purpose : edit private files
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: None
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
void editPvtFile()
|
||||
{
|
||||
KEY hotkeys[] =
|
||||
{
|
||||
KEY_INS,
|
||||
KEY_DEL,
|
||||
0
|
||||
};
|
||||
|
||||
Field frm[]=
|
||||
{
|
||||
/* TYPE dataPtr choices hookFunc flags len width x y */
|
||||
/* ------------------------------------------------------------------------------------------------------- */
|
||||
{ FRM_STRING ,0 ,0 ,0 ,FRM_UPPER ,79 ,50 ,13 ,2 },
|
||||
{ FRM_STRING ,0 ,0 ,0 ,0 ,35 ,36 ,13 ,4 },
|
||||
{ FRM_STRING ,0 ,0 ,0 ,0 ,35 ,36 ,13 ,5 },
|
||||
{ FRM_YESNO ,0 ,0 ,0 ,0 ,3 ,3 ,13 ,7 }
|
||||
};
|
||||
|
||||
pvtfiles.kill();
|
||||
|
||||
File f;
|
||||
|
||||
if(f.open(FileName(syspath,"PVTFILES.PB")))
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
_PrivateFile tmp;
|
||||
|
||||
if(f.read(&tmp,sizeof(tmp)) != sizeof(tmp))
|
||||
break;
|
||||
|
||||
if(tmp.fname[0])
|
||||
pvtfiles.add(tmp);
|
||||
}
|
||||
|
||||
f.close();
|
||||
}
|
||||
|
||||
|
||||
SelectWindow sw( pvtfiles.count(),
|
||||
0x70,
|
||||
listFile,
|
||||
0,
|
||||
NULL,
|
||||
hotkeys );
|
||||
|
||||
sw.open( 3,
|
||||
4,
|
||||
77,
|
||||
21,
|
||||
0x5F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x5D,
|
||||
NULL,
|
||||
0x51 );
|
||||
|
||||
sw.title( "Personal Files", 0x5E );
|
||||
|
||||
for(;;)
|
||||
{
|
||||
tsw_showfooter( "\x1<Del>\x1 - Delete \x1<Ins>\x1 - Add \x1<Enter>\x1 - Edit", BAR_NORM, BAR_HIGH );
|
||||
sw.redefine(pvtfiles.count());
|
||||
|
||||
ShrtT choice = sw.process();
|
||||
if(choice == SL_ESC)
|
||||
break;
|
||||
|
||||
if(choice == SL_HOTKEY)
|
||||
{
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case KEY_INS:
|
||||
{
|
||||
_PrivateFile tmp;
|
||||
|
||||
CLEAR_OBJECT(tmp);
|
||||
|
||||
choice = pvtfiles.count();
|
||||
sw.current = choice;
|
||||
|
||||
tmp.date.today();
|
||||
strcpy(tmp.from,cfg.sysopname);
|
||||
|
||||
pvtfiles.add(tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_DEL:
|
||||
{
|
||||
if(!pvtfiles.count())
|
||||
{
|
||||
tsw_beep();
|
||||
continue;
|
||||
}
|
||||
|
||||
FileName fn(cfg.pvtuploadpath,pvtfiles[sw.current].fname);
|
||||
if(!access(fn,0))
|
||||
if(askYesNo(form("Delete file %s ?",pvtfiles[sw.current].fname)) == TRUE)
|
||||
unlink(fn);
|
||||
|
||||
pvtfiles.get(sw.current);
|
||||
pvtfiles.remove();
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShrtT recno = choice;
|
||||
KEY pickkeys[]=
|
||||
{
|
||||
KEY_ALTL , // list
|
||||
NULL
|
||||
};
|
||||
|
||||
FormWindow w( 7,
|
||||
8,
|
||||
74,
|
||||
17,
|
||||
0x3F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
w.define( frm,
|
||||
4,
|
||||
0x31,
|
||||
0x4E,
|
||||
pickkeys,
|
||||
NULL );
|
||||
|
||||
w.open();
|
||||
w.title( "Edit Personal File", 0x3E );
|
||||
|
||||
w.attrib( 0x3F );
|
||||
w << "\n FileName:\n"
|
||||
"\n From user:"
|
||||
"\n To user:\n"
|
||||
"\n Delete?:";
|
||||
|
||||
bool kill_file = !(pvtfiles[recno].attr & PVTFILE_KEEP);
|
||||
|
||||
frm[0].value = pvtfiles[recno].fname;
|
||||
frm[1].value = pvtfiles[recno].from;
|
||||
frm[2].value = pvtfiles[recno].to;
|
||||
frm[3].value = &kill_file;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
tsw_showfooter("[\001ALT-L\001] Show file- or userlist", BAR_NORM, BAR_HIGH );
|
||||
|
||||
tsw_cursoron();
|
||||
ShrtT choice = w.process();
|
||||
if(choice == ED_ESC)
|
||||
break;
|
||||
|
||||
if(choice == ED_HOT)
|
||||
{
|
||||
switch(w.scanHotKey)
|
||||
{
|
||||
case KEY_ALTL:
|
||||
{
|
||||
User user;
|
||||
User::setDir(cfg.msgpath);
|
||||
NumUsers = ShrtT(User::numUsers());
|
||||
|
||||
userFilter filter;
|
||||
fillUserList(filter);
|
||||
|
||||
CLEAR_OBJECT(usrFind);
|
||||
|
||||
switch(w.getField())
|
||||
{
|
||||
|
||||
case 0: // filename
|
||||
{
|
||||
FileName mask(cfg.pvtuploadpath);
|
||||
mask.appendBS();
|
||||
mask << "*.*";
|
||||
|
||||
filelist.kill();
|
||||
{
|
||||
DirScan find;
|
||||
int status = find.first(mask);
|
||||
while(status == TRUE)
|
||||
{
|
||||
FileEntry entry;
|
||||
entry.fname = find.name();
|
||||
entry.size = find.size();
|
||||
entry.date = find.date();
|
||||
entry.time = find.time();
|
||||
|
||||
filelist.add(entry);
|
||||
|
||||
status = find.next();
|
||||
}
|
||||
}
|
||||
|
||||
if(filelist.count() != 0)
|
||||
{
|
||||
filelist.sort(CompareFileEntry);
|
||||
|
||||
SelectWindow sw( filelist.count(),
|
||||
0x70,
|
||||
listFileEntry,
|
||||
0,
|
||||
NULL,
|
||||
NULL );
|
||||
|
||||
sw.open( 13,
|
||||
6,
|
||||
67,
|
||||
19,
|
||||
0x17,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x19,
|
||||
NULL,
|
||||
0x10 );
|
||||
|
||||
sw.title( ChrP( mask ), 0x1E );
|
||||
|
||||
tsw_cursoroff();
|
||||
int fileno = sw.process();
|
||||
if(fileno != SL_ESC)
|
||||
{
|
||||
strcpy(pvtfiles[recno].fname, filelist[fileno].fname);
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case 1: // from user
|
||||
{
|
||||
ShrtT userno = pickUser(0);
|
||||
if(userno != -1)
|
||||
{
|
||||
user.read(getDiskRecNo(userno));
|
||||
strcpy(pvtfiles[recno].from, user.name);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case 2: // to user
|
||||
{
|
||||
ShrtT userno = pickUser(0);
|
||||
if(userno != -1)
|
||||
{
|
||||
user.read(getDiskRecNo(userno));
|
||||
strcpy(pvtfiles[recno].to, user.name);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pvtfiles[choice].attr = 0;
|
||||
|
||||
if(!kill_file)
|
||||
pvtfiles[choice].attr |= PVTFILE_KEEP;
|
||||
}
|
||||
|
||||
|
||||
if(f.open(FileName(syspath,"PVTFILES.PB"),fmode_create))
|
||||
{
|
||||
for(pvtfiles.rewind(); !pvtfiles.eol();pvtfiles++)
|
||||
{
|
||||
if(f.write(&pvtfiles.get(),sizeof(_PrivateFile)) != sizeof(_PrivateFile))
|
||||
break;
|
||||
}
|
||||
|
||||
f.close();
|
||||
}
|
||||
|
||||
tsw_cursoroff();
|
||||
}
|
||||
|
||||
/*---------------------------] END OF THE CODE [---------------------------*/
|
Binary file not shown.
|
@ -0,0 +1,213 @@
|
|||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
void edit_hourly();
|
||||
void edit_weekly();
|
||||
|
||||
void
|
||||
edit_stats()
|
||||
{
|
||||
menu_item mi[] = {
|
||||
{ 'H' , 2,2, " Hourly Usage" },
|
||||
// { 'D' , 2,2, " Daily Usage" },
|
||||
{ 'W' , 2,2, " Weekly Usage" },
|
||||
{ 0 , 0,0, NULL }
|
||||
};
|
||||
PopMenu pm(mi,0x70,0x5E);
|
||||
pm.open(40,18,65,22,0x5F,SHADOW);
|
||||
pm.title(" Edit Statistics ");
|
||||
|
||||
for(;;)
|
||||
{
|
||||
int item = pm.process();
|
||||
switch(item)
|
||||
{
|
||||
case 1: edit_hourly(); break;
|
||||
// case 2: edit_daily(); break;
|
||||
case 2: edit_weekly(); break;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct timelog
|
||||
{
|
||||
int numdays;
|
||||
Date lastdate;
|
||||
long hours[24];
|
||||
long days[7];
|
||||
long weeks[53];
|
||||
long totalcalls;
|
||||
int daysactive;
|
||||
byte extra[100];
|
||||
};
|
||||
|
||||
static timelog tl;
|
||||
|
||||
static int
|
||||
read_timelog()
|
||||
{
|
||||
File f;
|
||||
|
||||
if(!f.open(FileName(syspath,"TIMELOG.PRO"),fmode_read)) return -1;
|
||||
|
||||
f.read(&tl,sizeof(tl));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
write_timelog()
|
||||
{
|
||||
File f;
|
||||
|
||||
f.open(FileName(syspath,"TIMELOG.PRO"),fmode_create);
|
||||
|
||||
f.write(&tl,sizeof(tl));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
edit_hourly()
|
||||
{
|
||||
if(read_timelog()<0)
|
||||
{
|
||||
tsw_beep();
|
||||
return;
|
||||
}
|
||||
|
||||
Field fld[] = {
|
||||
{ FRM_LONG, &tl.hours[0] , 0,0 , 0 , 7 , 8 , 16,2 },
|
||||
{ FRM_LONG, &tl.hours[1] , 0,0 , 0 , 7 , 8 , 16,3 },
|
||||
{ FRM_LONG, &tl.hours[2] , 0,0 , 0 , 7 , 8 , 16,4 },
|
||||
{ FRM_LONG, &tl.hours[3] , 0,0 , 0 , 7 , 8 , 16,5 },
|
||||
{ FRM_LONG, &tl.hours[4] , 0,0 , 0 , 7 , 8 , 16,6 },
|
||||
{ FRM_LONG, &tl.hours[5] , 0,0 , 0 , 7 , 8 , 16,7 },
|
||||
{ FRM_LONG, &tl.hours[6] , 0,0 , 0 , 7 , 8 , 16,8 },
|
||||
{ FRM_LONG, &tl.hours[7] , 0,0 , 0 , 7 , 8 , 16,9 },
|
||||
{ FRM_LONG, &tl.hours[8] , 0,0 , 0 , 7 , 8 , 16,10 },
|
||||
{ FRM_LONG, &tl.hours[9] , 0,0 , 0 , 7 , 8 , 16,11 },
|
||||
{ FRM_LONG, &tl.hours[10] , 0,0 , 0 , 7 , 8 , 16,12 },
|
||||
{ FRM_LONG, &tl.hours[11] , 0,0 , 0 , 7 , 8 , 16,13 },
|
||||
{ FRM_LONG, &tl.hours[12] , 0,0 , 0 , 7 , 8 , 41,2 },
|
||||
{ FRM_LONG, &tl.hours[13] , 0,0 , 0 , 7 , 8 , 41,3 },
|
||||
{ FRM_LONG, &tl.hours[14] , 0,0 , 0 , 7 , 8 , 41,4 },
|
||||
{ FRM_LONG, &tl.hours[15] , 0,0 , 0 , 7 , 8 , 41,5 },
|
||||
{ FRM_LONG, &tl.hours[16] , 0,0 , 0 , 7 , 8 , 41,6 },
|
||||
{ FRM_LONG, &tl.hours[17] , 0,0 , 0 , 7 , 8 , 41,7 },
|
||||
{ FRM_LONG, &tl.hours[18] , 0,0 , 0 , 7 , 8 , 41,8 },
|
||||
{ FRM_LONG, &tl.hours[19] , 0,0 , 0 , 7 , 8 , 41,9 },
|
||||
{ FRM_LONG, &tl.hours[20] , 0,0 , 0 , 7 , 8 , 41,10 },
|
||||
{ FRM_LONG, &tl.hours[21] , 0,0 , 0 , 7 , 8 , 41,11 },
|
||||
{ FRM_LONG, &tl.hours[22] , 0,0 , 0 , 7 , 8 , 41,12 },
|
||||
{ FRM_LONG, &tl.hours[23] , 0,0 , 0 , 7 , 8 , 41,13 },
|
||||
{ FRM_LONG, &tl.totalcalls , 0,0 , 0 , 7 , 8 , 34,15 }
|
||||
};
|
||||
|
||||
FormWindow w(9,3,62,20,0x3F,SHADOW);
|
||||
w.open();
|
||||
w.title(form(" Hourly System Usage (%d days) ",tl.numdays));
|
||||
w << "\n";
|
||||
|
||||
for(int i=0;i<12;i++) w << form(" %02d:00-%02d:59 : %02d:00-%02d:59 :\n",i,i,i+12,i+12);
|
||||
|
||||
w << "\n Total # remote calls :";
|
||||
|
||||
w.define(fld,25,0x3E);
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
w.process();
|
||||
|
||||
tsw_cursoroff();
|
||||
|
||||
write_timelog();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
edit_weekly()
|
||||
{
|
||||
if(read_timelog()<0)
|
||||
{
|
||||
tsw_beep();
|
||||
return;
|
||||
}
|
||||
|
||||
Field fld[] = {
|
||||
{ FRM_LONG, &tl.weeks[0] , 0,0 , 0 , 5 , 6 , 7, 2 },
|
||||
{ FRM_LONG, &tl.weeks[1] , 0,0 , 0 , 5 , 6 , 7, 3 },
|
||||
{ FRM_LONG, &tl.weeks[2] , 0,0 , 0 , 5 , 6 , 7, 4 },
|
||||
{ FRM_LONG, &tl.weeks[3] , 0,0 , 0 , 5 , 6 , 7, 5 },
|
||||
{ FRM_LONG, &tl.weeks[4] , 0,0 , 0 , 5 , 6 , 7, 6 },
|
||||
{ FRM_LONG, &tl.weeks[5] , 0,0 , 0 , 5 , 6 , 7, 7 },
|
||||
{ FRM_LONG, &tl.weeks[6] , 0,0 , 0 , 5 , 6 , 7, 8 },
|
||||
{ FRM_LONG, &tl.weeks[7] , 0,0 , 0 , 5 , 6 , 7, 9 },
|
||||
{ FRM_LONG, &tl.weeks[8] , 0,0 , 0 , 5 , 6 , 7,10 },
|
||||
{ FRM_LONG, &tl.weeks[9] , 0,0 , 0 , 5 , 6 , 7,11 },
|
||||
{ FRM_LONG, &tl.weeks[10] , 0,0 , 0 , 5 , 6 , 7,12 },
|
||||
{ FRM_LONG, &tl.weeks[11] , 0,0 , 0 , 5 , 6 , 19, 2 },
|
||||
{ FRM_LONG, &tl.weeks[12] , 0,0 , 0 , 5 , 6 , 19, 3 },
|
||||
{ FRM_LONG, &tl.weeks[13] , 0,0 , 0 , 5 , 6 , 19, 4 },
|
||||
{ FRM_LONG, &tl.weeks[14] , 0,0 , 0 , 5 , 6 , 19, 5 },
|
||||
{ FRM_LONG, &tl.weeks[15] , 0,0 , 0 , 5 , 6 , 19, 6 },
|
||||
{ FRM_LONG, &tl.weeks[16] , 0,0 , 0 , 5 , 6 , 19, 7 },
|
||||
{ FRM_LONG, &tl.weeks[17] , 0,0 , 0 , 5 , 6 , 19, 8 },
|
||||
{ FRM_LONG, &tl.weeks[18] , 0,0 , 0 , 5 , 6 , 19, 9 },
|
||||
{ FRM_LONG, &tl.weeks[19] , 0,0 , 0 , 5 , 6 , 19,10 },
|
||||
{ FRM_LONG, &tl.weeks[20] , 0,0 , 0 , 5 , 6 , 19,11 },
|
||||
{ FRM_LONG, &tl.weeks[21] , 0,0 , 0 , 5 , 6 , 19,12 },
|
||||
{ FRM_LONG, &tl.weeks[22] , 0,0 , 0 , 5 , 6 , 31, 2 },
|
||||
{ FRM_LONG, &tl.weeks[23] , 0,0 , 0 , 5 , 6 , 31, 3 },
|
||||
{ FRM_LONG, &tl.weeks[24] , 0,0 , 0 , 5 , 6 , 31, 4 },
|
||||
{ FRM_LONG, &tl.weeks[25] , 0,0 , 0 , 5 , 6 , 31, 5 },
|
||||
{ FRM_LONG, &tl.weeks[26] , 0,0 , 0 , 5 , 6 , 31, 6 },
|
||||
{ FRM_LONG, &tl.weeks[27] , 0,0 , 0 , 5 , 6 , 31, 7 },
|
||||
{ FRM_LONG, &tl.weeks[28] , 0,0 , 0 , 5 , 6 , 31, 8 },
|
||||
{ FRM_LONG, &tl.weeks[29] , 0,0 , 0 , 5 , 6 , 31, 9 },
|
||||
{ FRM_LONG, &tl.weeks[30] , 0,0 , 0 , 5 , 6 , 31,10 },
|
||||
{ FRM_LONG, &tl.weeks[31] , 0,0 , 0 , 5 , 6 , 31,11 },
|
||||
{ FRM_LONG, &tl.weeks[32] , 0,0 , 0 , 5 , 6 , 31,12 },
|
||||
{ FRM_LONG, &tl.weeks[33] , 0,0 , 0 , 5 , 6 , 43, 2 },
|
||||
{ FRM_LONG, &tl.weeks[34] , 0,0 , 0 , 5 , 6 , 43, 3 },
|
||||
{ FRM_LONG, &tl.weeks[35] , 0,0 , 0 , 5 , 6 , 43, 4 },
|
||||
{ FRM_LONG, &tl.weeks[36] , 0,0 , 0 , 5 , 6 , 43, 5 },
|
||||
{ FRM_LONG, &tl.weeks[37] , 0,0 , 0 , 5 , 6 , 43, 6 },
|
||||
{ FRM_LONG, &tl.weeks[38] , 0,0 , 0 , 5 , 6 , 43, 7 },
|
||||
{ FRM_LONG, &tl.weeks[39] , 0,0 , 0 , 5 , 6 , 43, 8 },
|
||||
{ FRM_LONG, &tl.weeks[40] , 0,0 , 0 , 5 , 6 , 43, 9 },
|
||||
{ FRM_LONG, &tl.weeks[41] , 0,0 , 0 , 5 , 6 , 43,10 },
|
||||
{ FRM_LONG, &tl.weeks[42] , 0,0 , 0 , 5 , 6 , 43,11 },
|
||||
{ FRM_LONG, &tl.weeks[43] , 0,0 , 0 , 5 , 6 , 43,12 },
|
||||
{ FRM_LONG, &tl.weeks[44] , 0,0 , 0 , 5 , 6 , 55, 2 },
|
||||
{ FRM_LONG, &tl.weeks[45] , 0,0 , 0 , 5 , 6 , 55, 3 },
|
||||
{ FRM_LONG, &tl.weeks[46] , 0,0 , 0 , 5 , 6 , 55, 4 },
|
||||
{ FRM_LONG, &tl.weeks[47] , 0,0 , 0 , 5 , 6 , 55, 5 },
|
||||
{ FRM_LONG, &tl.weeks[48] , 0,0 , 0 , 5 , 6 , 55, 6 },
|
||||
{ FRM_LONG, &tl.weeks[49] , 0,0 , 0 , 5 , 6 , 55, 7 },
|
||||
{ FRM_LONG, &tl.weeks[50] , 0,0 , 0 , 5 , 6 , 55, 8 },
|
||||
{ FRM_LONG, &tl.weeks[51] , 0,0 , 0 , 5 , 6 , 55, 9 },
|
||||
{ FRM_LONG, &tl.weeks[52] , 0,0 , 0 , 5 , 6 , 55,10 },
|
||||
{ FRM_LONG, &tl.totalcalls , 0,0 , 0 , 5 , 6 , 40,14 }
|
||||
};
|
||||
|
||||
FormWindow w(8,5,72,20,0x1F,SHADOW);
|
||||
w.open();
|
||||
w.title(" Weekly System Usage ");
|
||||
w << "\n";
|
||||
|
||||
for(int i=1;i<=11;i++) w << form(" %2d : %2d : %2d : %2d : %2d :\n",i,i+11,i+22,i+33,i+44);
|
||||
|
||||
w.attrib(0x1B);
|
||||
w << "\n Total # remote calls :";
|
||||
|
||||
w.define(fld,54,0x1E);
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
w.process();
|
||||
|
||||
tsw_cursoroff();
|
||||
|
||||
write_timelog();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,771 @@
|
|||
|
||||
/* ------------------------------------------------------------
|
||||
* Filename ............... EditVTpl.Cpp
|
||||
*
|
||||
* General Purpose ........ Edit validate templates
|
||||
* ------------------------------------------------------------
|
||||
* First date ............. 6 november 1993
|
||||
*
|
||||
* First in version ....... 2.00
|
||||
*
|
||||
* Written by ............. Alain Schellinck
|
||||
* ------------------------------------------------------------
|
||||
* Revisions:
|
||||
* ----------
|
||||
*
|
||||
* Date | By | Purpose |
|
||||
* ---------+----+--------------------------------------------+
|
||||
* | | |
|
||||
* | | |
|
||||
* | | |
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define Uses_MultiRecIO
|
||||
#include "ThProCfg.Hpp"
|
||||
#include "Template.Hpp"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
TemplateIOP tpl = NULL;
|
||||
ChrT tplFind[80];
|
||||
|
||||
/*--] Code [-------------------------------------] search functions [------*/
|
||||
|
||||
/*
|
||||
* Routine : searchTemplate()
|
||||
* Purpose : search the whole template database for a selected template
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: record number to start on (-1 for 1st search)
|
||||
* Return : record number or -1 if not found
|
||||
*
|
||||
*/
|
||||
|
||||
LCL ShrtT searchTemplate(ShrtT startRec)
|
||||
{
|
||||
ShrtT max_rec = tpl->count();
|
||||
if(max_rec < 2)
|
||||
return(-1);
|
||||
|
||||
Window w;
|
||||
|
||||
if(startRec == -1)
|
||||
{
|
||||
w.open( 10,
|
||||
7,
|
||||
62,
|
||||
9,
|
||||
0x3F,
|
||||
SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
CLEAR_OBJECT(tplFind);
|
||||
|
||||
w << " Search for: ";
|
||||
|
||||
w.attrib( 0x3E );
|
||||
|
||||
tsw_cursoron();
|
||||
if(w.scan(tplFind, 60, 35, SCAN_UPPER) == SF_ESC)
|
||||
return(-1);
|
||||
|
||||
w.close();
|
||||
}
|
||||
|
||||
tsw_cursoroff();
|
||||
|
||||
if(strlen(tplFind) == 0)
|
||||
return(-1);
|
||||
|
||||
|
||||
if(startRec + 1 >= max_rec)
|
||||
return(-1);
|
||||
|
||||
w.open( 11,
|
||||
10,
|
||||
70,
|
||||
12,
|
||||
0x3F,
|
||||
BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
w.title( "Searching (Press <Esc> to cancel)", 0x3E );
|
||||
|
||||
ShrtT found = -1;
|
||||
w.gauge( 2, 1, setFBColor(hWhite, nBlack), 54, 0, max_rec - 1, TRUE);
|
||||
for(ShrtT cnt = startRec + 1; cnt < max_rec && found == -1; cnt++)
|
||||
{
|
||||
w.gauge( 2, 1, setFBColor(hWhite, nBlack), 54, cnt, max_rec - 1, FALSE);
|
||||
|
||||
if(KB.hit() && KB.get() == KEY_ESC)
|
||||
break;
|
||||
|
||||
tpl->read(cnt);
|
||||
|
||||
String desc(tpl->desc);
|
||||
if(desc.fuzzySearch(tplFind, cfg.fuzzyRate) >= cfg.fuzzyRate)
|
||||
found = cnt;
|
||||
}
|
||||
|
||||
return(found);
|
||||
}
|
||||
|
||||
/*--] Code [-------------------------------------] pick functions [--------*/
|
||||
|
||||
/*
|
||||
* Routine : listTemplate()
|
||||
* Purpose : list the specified template
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: template number, X and Y coordinates
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
LCL void listTemplate(IntT recno, IntT x, IntT y)
|
||||
{
|
||||
String txt = form(" ³ %5d ³ ............................................................", recno + 1);
|
||||
|
||||
if(tpl->read(recno) == TRUE)
|
||||
if(tpl->inUse() == TRUE)
|
||||
txt = form(" %c ³ %5d ³ %s", (tpl->deleted ? 'þ' : ' '), recno + 1, tpl->desc);
|
||||
|
||||
if(txt.len() > 72)
|
||||
txt.del(72, 0);
|
||||
|
||||
tsw_maputs(x , y, 0x3F, txt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : pickTemplate
|
||||
* Purpose : Let the user pick another template
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: current record number
|
||||
* Return : selected record number or -1 to cancel
|
||||
*
|
||||
*/
|
||||
|
||||
ShrtT pickTemplate(ShrtT curRecNo)
|
||||
{
|
||||
ShrtT ret_val = -1;
|
||||
|
||||
LCL ChrP pickHelp[] =
|
||||
{
|
||||
" 5EPage Up: 5BGo to previous page",
|
||||
" 5EPage Down: 5BGo to next page",
|
||||
" 5EHome: 5BGo to first record",
|
||||
" 5EEnd: 5BGo to last record",
|
||||
" 5EEscape: 5BEnd",
|
||||
"50ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ",
|
||||
" 5E1..9: 5BStart typing record number to go to",
|
||||
" 5EA..Z: 5BStart typing record number to search",
|
||||
" 5EALT-G: 5BGo to another record",
|
||||
" 5EALT-S: 5BSearch record by description",
|
||||
" 5EALT-N: 5BSearch next record",
|
||||
NULL
|
||||
};
|
||||
|
||||
KEY hotkeys[]=
|
||||
{
|
||||
'1','2','3','4','5','6','7','8','9', // GOTO
|
||||
'A','B','C','D','E','F','G','H','I', // SEARCH
|
||||
'J','K','L','M','N','O','P','Q','R',
|
||||
'S','T','U','V','W','X','Y','Z',
|
||||
KEY_ALTG, // GOTO
|
||||
KEY_ALTN, // SEARCH NEXT
|
||||
KEY_ALTS, // SEARCH
|
||||
KEY_F1 , // SHOW HELP
|
||||
NULL
|
||||
};
|
||||
|
||||
ShrtT maxRec = tpl->count();
|
||||
|
||||
SelectWindow sw;
|
||||
|
||||
sw.open( 2,
|
||||
3,
|
||||
78,
|
||||
tsw_vsize - 2,
|
||||
0x3F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
sw.title( "Select Template", 0x3E );
|
||||
|
||||
sw.define( maxRec,
|
||||
0x1E,
|
||||
listTemplate,
|
||||
0,
|
||||
NULL,
|
||||
hotkeys );
|
||||
|
||||
sw.direct( 4,0 ,0x3B, 'Â'); sw.direct(12,0 ,0x3B, 'Â');
|
||||
sw.direct( 4,tsw_vsize - 5, 0x31, 'Á'); sw.direct(12,tsw_vsize - 5,0x31, 'Á');
|
||||
|
||||
sw.show(curRecNo);
|
||||
|
||||
FlgT pickLoop = TRUE;
|
||||
while(pickLoop)
|
||||
{
|
||||
tsw_showfooter("Press [\001F1\001] to see the help screen", BAR_NORM, BAR_HIGH);
|
||||
|
||||
tsw_cursoroff();
|
||||
ShrtT choice = sw.process();
|
||||
tsw_cursoron ();
|
||||
|
||||
switch(choice)
|
||||
{
|
||||
case SL_ESC:
|
||||
{
|
||||
pickLoop = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case SL_HOTKEY:
|
||||
{
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case KEY_F1 :
|
||||
{
|
||||
showHelp( pickHelp, "Pick Template Help" );
|
||||
}
|
||||
break;
|
||||
|
||||
case '1': case '2': case '3':
|
||||
case '4': case '5': case '6':
|
||||
case '7': case '8': case '9':
|
||||
{
|
||||
KB.push((KEY)(char)sw.hotkey);
|
||||
} // NO BREAK!!!
|
||||
|
||||
case KEY_ALTG :
|
||||
{
|
||||
IntT tplNo = 1;
|
||||
|
||||
Window w(10, 5, 36, 7, setFBColor(hWhite, nCyan));
|
||||
w.open();
|
||||
w << " Goto template: ";
|
||||
|
||||
tsw_cursoron();
|
||||
w.attrib(setFBColor(hYellow, nCyan));
|
||||
|
||||
if(w.scan(tplNo, 5, 6) == SF_ESC)
|
||||
tplNo = -1;
|
||||
|
||||
tsw_cursoroff();
|
||||
|
||||
if((tplNo <= maxTemplates) && (tplNo >= 1) )
|
||||
{
|
||||
pickLoop = FALSE;
|
||||
ret_val = tplNo - 1;
|
||||
sw.show(ret_val);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_ALTN:
|
||||
{
|
||||
ShrtT tplNo = searchTemplate(sw.current);
|
||||
if(tplNo != -1)
|
||||
{
|
||||
sw.show(tplNo);
|
||||
}
|
||||
else
|
||||
tsw_beep();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'A': case 'B': case 'C': case 'D':
|
||||
case 'E': case 'F': case 'G': case 'H':
|
||||
case 'I': case 'J': case 'K': case 'L':
|
||||
case 'M': case 'N': case 'O': case 'P':
|
||||
case 'Q': case 'R': case 'S': case 'T':
|
||||
case 'U': case 'V': case 'W': case 'X':
|
||||
case 'Y': case 'Z':
|
||||
{
|
||||
KB.push((KEY)(char)sw.hotkey);
|
||||
}
|
||||
|
||||
case KEY_ALTS:
|
||||
{
|
||||
ShrtT tplNo = searchTemplate(-1);
|
||||
if(tplNo != -1)
|
||||
{
|
||||
sw.show(tplNo);
|
||||
}
|
||||
else
|
||||
tsw_beep();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
ret_val = choice;
|
||||
pickLoop = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
/*--] Code [-------------------------------------] Edit functions [--------*/
|
||||
|
||||
/*
|
||||
* Routine : helpFunction()
|
||||
* Purpose : show the online help for each field
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: field number
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
LCL void helpFunction(IntT helpNo)
|
||||
{
|
||||
ChrP txt[]=
|
||||
{
|
||||
"Description for this template.",
|
||||
"The security level the user will get when validated with this template.",
|
||||
"How many days he/she will get the new security level.",
|
||||
"The expiration level for this template.",
|
||||
"Deposit an amount of time in the user's time bank account.",
|
||||
"Deposit an amount of kbytes in the user's time bank account.",
|
||||
"The netmail credit a user can use.",
|
||||
|
||||
"Name of the file containing the validation text (for TheUser).",
|
||||
|
||||
"Flags to turn on when validating a user.",
|
||||
"Flags to turn off when validating a user.",
|
||||
"Flags to turn on when a user's level is expired.",
|
||||
"Flags to turn off when a user's level is expired.",
|
||||
"Comment to place in a user's record.",
|
||||
"The new log level for the user after validation.",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Template marked for deletion?",
|
||||
};
|
||||
|
||||
if(strlen(txt[helpNo]) != 0)
|
||||
tsw_showfooter(txt[helpNo], BAR_COLOR);
|
||||
else
|
||||
tsw_showfooter("Press [\001F1\001] to see the help screen", BAR_NORM, BAR_HIGH);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : editTemplate()
|
||||
* Purpose : edit a selected template
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: system path
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
void editTemplate(ChrP sysPath)
|
||||
{
|
||||
LCL ChrP editHelp[] =
|
||||
{
|
||||
" 5EPage Up: 5BGo to previous record",
|
||||
" 5EPage Down: 5BGo to next record",
|
||||
" 5ECTRL-Page Up: 5BGo to first record",
|
||||
" 5ECTRL-Page Down: 5BGo to last record",
|
||||
" 5EEscape: 5BEnd",
|
||||
"50ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ",
|
||||
" 5EALT-A: 5BAdd a record",
|
||||
" 5EALT-D: 5BDelete / Undelete the current template",
|
||||
" 5EALT-F: 5BShow flag description",
|
||||
" 5EALT-L: 5BList all records",
|
||||
" 5EALT-S: 5BSearch record by description",
|
||||
" 5EALT-N: 5BSearch next record",
|
||||
NULL
|
||||
};
|
||||
|
||||
CLEAR_OBJECT(tplFind);
|
||||
|
||||
LCL ChrP LogLevels[] =
|
||||
{
|
||||
"Friend" , "Normal" , "Suspicious" , "Extensive" , "Ignore",
|
||||
NULL
|
||||
};
|
||||
|
||||
LCL ChrP YesNo[] =
|
||||
{
|
||||
"No", "Yes",
|
||||
NULL
|
||||
};
|
||||
|
||||
LCL ChrP YesNoIgnore[] =
|
||||
{
|
||||
"No", "Yes", "Ignore",
|
||||
NULL
|
||||
};
|
||||
|
||||
tpl = new TemplateIO(sysPath);
|
||||
if(tpl->open(fmode_rw|fmode_copen)== FALSE)
|
||||
{
|
||||
tsw_beep();
|
||||
return;
|
||||
}
|
||||
|
||||
Field frm[]=
|
||||
{
|
||||
/* TYPE dataPtr choices hookFunc flags len width x y */
|
||||
/* -------------------------------------------------------------------------------------------------- */
|
||||
{ FRM_STRING , tpl->desc ,0 ,0 ,0 ,60 ,53 ,19 ,2 }, // description
|
||||
{ FRM_UNSIGNED ,&tpl->secLevel ,0 ,0 ,0 ,5 ,6 ,19 ,3 }, // securiy level
|
||||
{ FRM_UNSIGNED ,&tpl->subscribe ,0 ,0 ,0 ,5 ,6 ,19 ,5 }, // subscribe
|
||||
{ FRM_UNSIGNED ,&tpl->expLevel ,0 ,0 ,0 ,5 ,6 ,19 ,6 }, // expiration level
|
||||
{ FRM_UNSIGNED ,&tpl->tbTime ,0 ,0 ,0 ,5 ,6 ,19 ,8 }, // timebank time
|
||||
{ FRM_UNSIGNED ,&tpl->tbKbyte ,0 ,0 ,0 ,5 ,6 ,19 ,9 }, // timebank kbyte
|
||||
{ FRM_UNSIGNED ,&tpl->netCredit ,0 ,0 ,0 ,5 ,6 ,19 ,10 }, // netmail credit
|
||||
{ FRM_STRING , tpl->valMsg ,0 ,0 ,0 ,8 ,9 ,19 ,11 }, // validate message
|
||||
{ FRM_FUNCTION ,&tpl->valFlagsOn ,0 ,flag_select ,0 ,26 ,26 ,19 ,13 }, // flags on
|
||||
{ FRM_FUNCTION ,&tpl->valFlagsOff,0 ,flag_select ,0 ,26 ,26 ,19 ,14 }, // flags off
|
||||
{ FRM_FUNCTION ,&tpl->expFlagsOn ,0 ,flag_select ,0 ,26 ,26 ,19 ,15 }, // flags on
|
||||
{ FRM_FUNCTION ,&tpl->expFlagsOff,0 ,flag_select ,0 ,26 ,26 ,19 ,16 }, // flags off
|
||||
{ FRM_STRING , tpl->comment ,0 ,0 ,0 ,80 ,53 ,19 ,18 }, // comment
|
||||
{ FRM_CHOICE ,&tpl->logLevel ,LogLevels ,0 ,0 ,10 ,10 ,57 ,3 }, // loglevels
|
||||
{ FRM_CHOICE ,&tpl->hidden ,YesNoIgnore,0 ,0 ,6 ,6 ,57 ,5 }, // hidden
|
||||
{ FRM_CHOICE ,&tpl->noTops ,YesNoIgnore,0 ,0 ,6 ,6 ,57 ,6 }, // in tops
|
||||
{ FRM_CHOICE ,&tpl->atten ,YesNoIgnore,0 ,0 ,6 ,6 ,57 ,7 }, // attention
|
||||
{ FRM_CHOICE ,&tpl->noKill ,YesNoIgnore,0 ,0 ,6 ,6 ,57 ,8 }, // no kill
|
||||
{ FRM_CHOICE ,&tpl->ignDld ,YesNoIgnore,0 ,0 ,6 ,6 ,57 ,9 }, // ignore dl
|
||||
{ FRM_CHOICE ,&tpl->deleted ,YesNo ,0 ,0 ,6 ,6 ,57 ,11 }, // template deleted?
|
||||
};
|
||||
|
||||
FormWindow w( 2,
|
||||
3,
|
||||
77,
|
||||
23,
|
||||
0x1F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x19,
|
||||
NULL,
|
||||
0x10 );
|
||||
w.open();
|
||||
|
||||
w.attrib( 0x1F );
|
||||
w << "\n"
|
||||
" Description:\n"
|
||||
" Security level: Loglevel:\n"
|
||||
"\n"
|
||||
" Subscribe: Hidden:\n"
|
||||
" Expir. level: NoTops:\n"
|
||||
" Attention:\n"
|
||||
" Time bank time: NoKill:\n"
|
||||
" Time bank KB: IgnoreDL:\n"
|
||||
" Netmail credit:\n"
|
||||
" Validate Msg: Deleted:\n"
|
||||
"\n"
|
||||
" Val. Flags ON:\n"
|
||||
" Val. Flags OFF:\n"
|
||||
" Exp. Flags ON:\n"
|
||||
" Exp. Flags OFF:\n"
|
||||
"\n"
|
||||
" Comment:";
|
||||
|
||||
|
||||
KEY hotkeys[]=
|
||||
{
|
||||
KEY_PGUP , // next
|
||||
KEY_PGDN , // previous
|
||||
KEY_CPGUP, // first
|
||||
KEY_CPGDN, // last
|
||||
KEY_ALTA , // add
|
||||
KEY_ALTD , // delete / undelete
|
||||
KEY_ALTF , // show flags-info
|
||||
KEY_ALTL , // list
|
||||
KEY_ALTN , // search next
|
||||
KEY_ALTS , // search
|
||||
KEY_F1 , // help
|
||||
NULL
|
||||
};
|
||||
|
||||
w.define( frm,
|
||||
20,
|
||||
0x1B,
|
||||
0x4E,
|
||||
hotkeys, helpFunction);
|
||||
|
||||
ShrtT maxRec = tpl->count();
|
||||
if(maxRec == 0)
|
||||
{
|
||||
tpl->clear();
|
||||
tpl->write(0);
|
||||
maxRec++;
|
||||
}
|
||||
|
||||
ShrtT curRecNo = 0;
|
||||
ShrtT nextRecNo = curRecNo;
|
||||
FlgT readRequired = TRUE;
|
||||
|
||||
tpl->clear();
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
WrdT crcVal;
|
||||
|
||||
FlgT editLoop = TRUE;
|
||||
while(editLoop)
|
||||
{
|
||||
FlgT forcedSave = FALSE;
|
||||
|
||||
if(curRecNo != nextRecNo)
|
||||
{
|
||||
curRecNo = nextRecNo;
|
||||
readRequired = TRUE;
|
||||
}
|
||||
|
||||
if(readRequired == TRUE)
|
||||
{
|
||||
readRequired = FALSE;
|
||||
tpl->read(curRecNo);
|
||||
crcVal = crc(tpl, sizeof(template_data));
|
||||
}
|
||||
|
||||
w.title( form( "Record %d/%d", curRecNo + 1, maxRec), 0x1E );
|
||||
|
||||
IntT ret_code = w.process();
|
||||
|
||||
switch(ret_code)
|
||||
{
|
||||
case ED_HOT:
|
||||
{
|
||||
switch(w.scanHotKey)
|
||||
{
|
||||
case KEY_F1 :
|
||||
{
|
||||
showHelp( editHelp, "Edit Template Help" );
|
||||
continue;
|
||||
}
|
||||
|
||||
case KEY_ALTD :
|
||||
{
|
||||
if(tpl->inUse())
|
||||
tpl->deleted = (tpl->deleted ? FALSE : TRUE);
|
||||
|
||||
forcedSave = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_ALTF :
|
||||
{
|
||||
tsw_cursoroff();
|
||||
show_flags();
|
||||
tsw_cursoron();
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
FlgT isChanged = FALSE;
|
||||
if(tpl->inUse())
|
||||
{
|
||||
if(crcVal != crc(tpl, sizeof(template_data)))
|
||||
{
|
||||
ShrtT stat;
|
||||
isChanged = TRUE;
|
||||
|
||||
if(forcedSave == FALSE)
|
||||
stat = ask_save();
|
||||
else
|
||||
stat = 1;
|
||||
|
||||
if(stat == 0)
|
||||
{
|
||||
tpl->write(curRecNo);
|
||||
readRequired = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch(ret_code)
|
||||
{
|
||||
case ED_HOT :
|
||||
{
|
||||
switch(w.scanHotKey)
|
||||
{
|
||||
case KEY_PGDN :
|
||||
{
|
||||
if(curRecNo + 1 < maxRec)
|
||||
nextRecNo = curRecNo + 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_PGUP :
|
||||
{
|
||||
if(curRecNo > 0)
|
||||
nextRecNo = curRecNo - 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_CPGUP :
|
||||
{
|
||||
if(curRecNo != 0)
|
||||
nextRecNo = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_CPGDN :
|
||||
{
|
||||
if(curRecNo + 1 < maxRec)
|
||||
nextRecNo = maxRec - 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_ALTA :
|
||||
{
|
||||
IntT tplNo = tpl->count() + 1;
|
||||
|
||||
Window w( 10,
|
||||
5,
|
||||
36,
|
||||
7,
|
||||
0x3F,
|
||||
SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
w.open();
|
||||
w << " New template: ";
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
w.attrib( 0x3E );
|
||||
|
||||
if(w.scan(tplNo, 5, 6) == SF_ESC)
|
||||
tplNo = -1;
|
||||
|
||||
tsw_cursoroff();
|
||||
|
||||
if((tplNo <= maxTemplates) && (tplNo > 1) )
|
||||
{
|
||||
if(tplNo > maxRec)
|
||||
{
|
||||
tpl->clear();
|
||||
for(ShrtT cnt = maxRec; cnt < tplNo; cnt++)
|
||||
tpl->write(cnt);
|
||||
}
|
||||
|
||||
nextRecNo = tplNo - 1;
|
||||
}
|
||||
|
||||
maxRec = tpl->count();
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_ALTL :
|
||||
{
|
||||
nextRecNo = pickTemplate(curRecNo);
|
||||
if(nextRecNo == -1)
|
||||
{
|
||||
nextRecNo = curRecNo;
|
||||
readRequired = TRUE;
|
||||
}
|
||||
|
||||
if(nextRecNo > maxRec - 1)
|
||||
{
|
||||
tpl->clear();
|
||||
for(ShrtT cnt = maxRec; cnt <= nextRecNo; cnt++)
|
||||
tpl->write(cnt);
|
||||
}
|
||||
|
||||
maxRec = tpl->count();
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_ALTN :
|
||||
{
|
||||
nextRecNo = searchTemplate(curRecNo);
|
||||
if(nextRecNo == -1)
|
||||
{
|
||||
tsw_beep();
|
||||
nextRecNo = curRecNo;
|
||||
readRequired = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_ALTS:
|
||||
{
|
||||
nextRecNo = searchTemplate(-1);
|
||||
if(nextRecNo == -1)
|
||||
{
|
||||
tsw_beep();
|
||||
nextRecNo = curRecNo;
|
||||
readRequired = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ED_ESC :
|
||||
{
|
||||
if((isChanged == FALSE) || (askYesNo("Exit template editor?") == TRUE))
|
||||
editLoop = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
maxRec = tpl->count();
|
||||
|
||||
FlgT found = FALSE; // search deleted records
|
||||
for(ShrtT cnt = 0; cnt < maxRec && found == FALSE; cnt++)
|
||||
if(tpl->read(cnt) == TRUE)
|
||||
if(tpl->deleted == TRUE)
|
||||
found = TRUE;
|
||||
|
||||
if(found == TRUE) // clear deleted records
|
||||
if(askYesNo("Clear deleted records?") == TRUE)
|
||||
for(ShrtT cnt = 0; cnt < maxRec; cnt++)
|
||||
if(tpl->read(cnt) == TRUE)
|
||||
if(tpl->deleted == TRUE)
|
||||
{
|
||||
tpl->clear();
|
||||
tpl->write(cnt);
|
||||
}
|
||||
|
||||
|
||||
ShrtT lastUsed = -1; // search last used record
|
||||
for(cnt = maxRec - 1; cnt >= 0 && lastUsed == -1; cnt--)
|
||||
if(tpl->read(cnt) == TRUE)
|
||||
if(tpl->inUse() == TRUE)
|
||||
lastUsed = cnt;
|
||||
|
||||
if(lastUsed + 1 != maxRec)
|
||||
{
|
||||
tpl->pos(lastUsed + 1); // cut all other records
|
||||
tpl->cut();
|
||||
}
|
||||
|
||||
delete(tpl);
|
||||
tsw_cursoroff();
|
||||
}
|
||||
|
||||
/*---------------------------] END OF THE CODE [---------------------------*/
|
Binary file not shown.
|
@ -0,0 +1,288 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
|
||||
|
||||
/*
|
||||
_AccessEvent ev[27];
|
||||
|
||||
void
|
||||
event_show(int i,int x,int y)
|
||||
{
|
||||
Dstring s;
|
||||
|
||||
s << (i ? char('A'+i-1) : '@') << '³';
|
||||
|
||||
for(int j = 0 ; j < 48 ; j++)
|
||||
{
|
||||
if(ev[i].hoursActive[j]) s << 'þ';
|
||||
else s << ' ';
|
||||
if((j & 1) && j < 47) s << '³';
|
||||
}
|
||||
|
||||
tsw_mputs(x+1,y,s);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
edit_accessevents()
|
||||
{
|
||||
KEY hotkeys[]={ KEY_INS, KEY_DEL, 0 };
|
||||
|
||||
memset(ev,0,sizeof(ev));
|
||||
|
||||
memset(ev[0].hoursActive,1,48);
|
||||
|
||||
ev[1].hoursActive[20] = TRUE;
|
||||
ev[1].hoursActive[21] = TRUE;
|
||||
ev[1].hoursActive[22] = TRUE;
|
||||
|
||||
ev[2].hoursActive[12] = TRUE;
|
||||
ev[2].hoursActive[23] = TRUE;
|
||||
ev[2].hoursActive[24] = TRUE;
|
||||
ev[2].hoursActive[25] = TRUE;
|
||||
|
||||
SelectWindow sw( 27,
|
||||
0x70,
|
||||
event_show,
|
||||
0,
|
||||
NULL,
|
||||
hotkeys );
|
||||
|
||||
sw.open( 2,
|
||||
10,
|
||||
79,
|
||||
21,
|
||||
0x3F,
|
||||
EXPLODE );
|
||||
|
||||
sw.title( "ÍÍÑ00Ñ01Ñ02Ñ03Ñ04Ñ05Ñ06Ñ07Ñ08Ñ09Ñ10Ñ11Ñ12Ñ13Ñ14Ñ15Ñ16Ñ17Ñ18Ñ19Ñ20Ñ21Ñ22Ñ23");
|
||||
sw.direct(1,11,"ÍÍÏ00Ï01Ï02Ï03Ï04Ï05Ï06Ï07Ï08Ï09Ï10Ï11Ï12Ï13Ï14Ï15Ï16Ï17Ï18Ï19Ï20Ï21Ï22Ï23");
|
||||
|
||||
for(;;)
|
||||
{
|
||||
tsw_showfooter("\001<Del>\001 - Delete \001<Ins>\001 - Add \001<Enter>\001 - Edit", BAR_NORM, BAR_HIGH);
|
||||
int choice=sw.process();
|
||||
if(choice==SL_ESC) break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
KEY
|
||||
days_select(int mode,Window& w,int x,int y,char attr,void *data)
|
||||
{
|
||||
byte *days=(byte *)data;
|
||||
int mon=0,tue=0,wed=0,thu=0,fri=0,sat=0,sun=0;
|
||||
|
||||
if(mode)
|
||||
{
|
||||
FormWindow ww( x + w.minX - 4,
|
||||
y + w.minY - 3,
|
||||
x + w.minX + 18,
|
||||
y + w.minY + 7,
|
||||
0xF,
|
||||
EXPLODE | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x07,
|
||||
NULL,
|
||||
0x08 );
|
||||
|
||||
ww.open();
|
||||
|
||||
ww.title( "Days", 0xE );
|
||||
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_YESNO , 0, 0,0, 0, 3 , 3 ,15,2 },
|
||||
{ FRM_YESNO , 0, 0,0, 0, 3 , 3 ,15,3 },
|
||||
{ FRM_YESNO , 0, 0,0, 0, 3 , 3 ,15,4 },
|
||||
{ FRM_YESNO , 0, 0,0, 0, 3 , 3 ,15,5 },
|
||||
{ FRM_YESNO , 0, 0,0, 0, 3 , 3 ,15,6 },
|
||||
{ FRM_YESNO , 0, 0,0, 0, 3 , 3 ,15,7 },
|
||||
{ FRM_YESNO , 0, 0,0, 0, 3 , 3 ,15,8 }
|
||||
};
|
||||
|
||||
ww.define( frm,
|
||||
7,
|
||||
0xE );
|
||||
|
||||
mon=(*days&1)?1:0;
|
||||
tue=(*days&2)?1:0;
|
||||
wed=(*days&4)?1:0;
|
||||
thu=(*days&8)?1:0;
|
||||
fri=(*days&16)?1:0;
|
||||
sat=(*days&32)?1:0;
|
||||
sun=(*days&64)?1:0;
|
||||
|
||||
frm[0].value=&mon;
|
||||
frm[1].value=&tue;
|
||||
frm[2].value=&wed;
|
||||
frm[3].value=&thu;
|
||||
frm[4].value=&fri;
|
||||
frm[5].value=&sat;
|
||||
frm[6].value=&sun;
|
||||
|
||||
ww << "\n"
|
||||
" Monday:\n"
|
||||
" Tuesday:\n"
|
||||
" Wednesday:\n"
|
||||
" Thursday:\n"
|
||||
" Friday:\n"
|
||||
" Saturday:\n"
|
||||
" Sunday:";
|
||||
|
||||
ww.process();
|
||||
|
||||
*days=0;
|
||||
|
||||
if(mon) *days|=1;
|
||||
if(tue) *days|=2;
|
||||
if(wed) *days|=4;
|
||||
if(thu) *days|=8;
|
||||
if(fri) *days|=16;
|
||||
if(sat) *days|=32;
|
||||
if(sun) *days|=64;
|
||||
}
|
||||
else
|
||||
{
|
||||
String s("MTWTFSS");
|
||||
|
||||
for(int i=0;i<7;i++) if(!((*days)&(1<<i))) s[i]='-';
|
||||
w.direct(x,y,(byte)attr,s);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
event_select(int i,int x,int y)
|
||||
{
|
||||
String s("MTWTFSS");
|
||||
|
||||
for(int d=0;d<7;d++) if(!(events[i].days&(1<<d))) s[d]='-';
|
||||
|
||||
tsw_maputs(x+1,y,0x5E,form("[%c] On %s, at %02d:%02d on node %d for %2d minutes",events[i].enabled?'+':'-',(char *)s,events[i].start[0],events[i].start[1],events[i].node,events[i].duration));
|
||||
}
|
||||
|
||||
static char *types[]={ "Errorlevel","Command",NULL};
|
||||
|
||||
void
|
||||
edit_events()
|
||||
{
|
||||
//edit_accessevents();
|
||||
|
||||
KEY hotkeys[]={ KEY_INS, KEY_DEL, 0 };
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_YESNO , 0, 0,0, 0, 3 , 3 ,15,1 },
|
||||
{ FRM_FUNCTION, 0, 0,days_select,0 , 7, 7, 15,3 },
|
||||
{ FRM_STRING , 0, 0,0, 0, 5 , 6 ,15,4 },
|
||||
{ FRM_INT , 0, 0,0, 0, 3 , 4 ,15,5 },
|
||||
{ FRM_CHOICE , 0, types,0,0,10,10,15,7 },
|
||||
{ FRM_INT , 0, 0,0, 0, 4 , 5 ,15,9 },
|
||||
{ FRM_STRING , 0, 0,0, 0, 79 , 20 ,15,10 },
|
||||
{ FRM_SHORT , 0, 0,0, 0, 3 , 4 ,15,12 }
|
||||
};
|
||||
SelectWindow sw( num_events,
|
||||
0x70,
|
||||
event_select,
|
||||
0,
|
||||
NULL,
|
||||
hotkeys );
|
||||
|
||||
sw.open( 12,
|
||||
10,
|
||||
67,
|
||||
21,
|
||||
0x5F,
|
||||
SHADOW | EXPLODE | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x5D,
|
||||
NULL,
|
||||
0x51 );
|
||||
|
||||
sw.title( "Events", 0x5E );
|
||||
|
||||
for(;;)
|
||||
{
|
||||
tsw_showfooter("\x1<Del>\x1 - Delete \x1<Ins>\x1 - Add \x1<Enter>\x1 - Edit", BAR_NORM, BAR_HIGH );
|
||||
sw.redefine(num_events);
|
||||
int choice=sw.process();
|
||||
if(choice==SL_ESC) break;
|
||||
if(choice==SL_HOTKEY)
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case KEY_INS: {
|
||||
memset(&events[num_events],0,sizeof(event));
|
||||
choice=num_events++;
|
||||
sw.current=choice;
|
||||
events[choice].node=1;
|
||||
} break;
|
||||
case KEY_DEL: for(int i=sw.current;i<num_events-1;i++) events[i]=events[i+1];
|
||||
if(num_events) num_events--;
|
||||
continue;
|
||||
}
|
||||
|
||||
FormWindow w( 9,
|
||||
4,
|
||||
47,
|
||||
17,
|
||||
0x3F,
|
||||
SHADOW | EXPLODE | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
w.open();
|
||||
|
||||
w.attrib( 0x3F );
|
||||
|
||||
w << " Enabled:\n\n"
|
||||
" Active days:\n"
|
||||
" Event Time:\n"
|
||||
" Duration: min.\n\n"
|
||||
" Event type:\n\n"
|
||||
" Errorlevel:\n"
|
||||
" DOS-Command:\n\n"
|
||||
" Node number:";
|
||||
|
||||
char time[6];
|
||||
sprintf(time,"%02d:%02d",events[choice].start[0],events[choice].start[1]);
|
||||
|
||||
frm[0].value=&events[choice].enabled;
|
||||
frm[1].value=&events[choice].days;
|
||||
frm[2].value=time;
|
||||
frm[3].value=&events[choice].duration;
|
||||
frm[4].value=&events[choice].type;
|
||||
frm[5].value=&events[choice].errorlevel;
|
||||
frm[6].value=events[choice].command;
|
||||
frm[7].value=&events[choice].node;
|
||||
|
||||
w.define( frm,
|
||||
8,
|
||||
0x31,
|
||||
0x4E );
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
events[choice].start[0]=atoi(strtok(time,":"));
|
||||
events[choice].start[1]=atoi(strtok(NULL,":"));
|
||||
|
||||
for(int i=0;i<num_events-1;i++)
|
||||
for(int j=i+1;j<num_events;j++)
|
||||
if(events[i].start>events[j].start)
|
||||
{
|
||||
event temp;
|
||||
temp=events[i];
|
||||
events[i]=events[j];
|
||||
events[j]=temp;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,360 @@
|
|||
#ifdef PEX
|
||||
#define NO_KEY_DEF
|
||||
#include <pb_sdk.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#include <tswin.hpp>
|
||||
#include "extsel.hpp"
|
||||
|
||||
#define max(a,b) ( (a)>(b) ? (a) : (b) )
|
||||
#define min(a,b) ( (a)<(b) ? (a) : (b) )
|
||||
|
||||
void
|
||||
ExtSelectWindow::recalc(int order)
|
||||
{
|
||||
int i,y;
|
||||
int height = maxY - minY + 1;
|
||||
|
||||
if(end >= numEntries)
|
||||
{
|
||||
end = numEntries-1;
|
||||
|
||||
for(i=1,y=height - (*func)(*this,end) ; y>0 ; i++)
|
||||
{
|
||||
y -= (*func)(*this,end-i);
|
||||
}
|
||||
|
||||
start = end - i + 1;
|
||||
|
||||
for(i = start ; y < height; i++)
|
||||
{
|
||||
offset[i-start] = y;
|
||||
|
||||
y += (*func)(*this,i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i = start , y = 0; y < height; i++)
|
||||
{
|
||||
if(i >= numEntries)
|
||||
{
|
||||
end = numEntries;
|
||||
recalc();
|
||||
return;
|
||||
}
|
||||
offset[i-start] = y;
|
||||
|
||||
y += (*func)(*this,i);
|
||||
}
|
||||
|
||||
end = i-1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ExtSelectWindow::scrollUp(int n)
|
||||
{
|
||||
end++;
|
||||
|
||||
int left = offset[0] + (*func)(*this,start); // # lines of 1st item on screen
|
||||
|
||||
int new_offset = offset[0];
|
||||
|
||||
int i = n;
|
||||
|
||||
while( i >= left)
|
||||
{
|
||||
new_offset += (*func)(*this,start);
|
||||
start++;
|
||||
i -= (*func)(*this,start);
|
||||
}
|
||||
|
||||
offset[0] = new_offset - n;
|
||||
|
||||
for(i = start+1 ; i <= end ; i++)
|
||||
{
|
||||
offset[i-start] = offset[i-start-1] + (*func)(*this,i-1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ExtSelectWindow::scrollDown(int)
|
||||
{
|
||||
start--;
|
||||
recalc();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExtSelectWindow::redraw(int n)
|
||||
{
|
||||
if(n >= 0)
|
||||
{
|
||||
(*func)(*this,n,offset[n-start] + 1,maxY - minY - offset[n-start] + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
clear();
|
||||
|
||||
for(int i=start; i <= end ; i++)
|
||||
{
|
||||
(*func)(*this,i,offset[i-start] + 1,maxY - minY - offset[i-start] + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ExtSelectWindow::keyDown()
|
||||
{
|
||||
if(current >= numEntries-1)
|
||||
return;
|
||||
|
||||
previous = current++;
|
||||
|
||||
int height = (maxY-minY+1);
|
||||
|
||||
if( current == end
|
||||
&& offset[end-start]+(*func)(*this,current) > height)
|
||||
{
|
||||
int n = offset[end-start] + (*func)(*this,current) - height;
|
||||
|
||||
tsw_scroll(UP,minX,minY,maxX,maxY,n,attr);
|
||||
|
||||
scrollUp(n);
|
||||
|
||||
redraw(current);
|
||||
}
|
||||
|
||||
if(current > end)
|
||||
{
|
||||
int n = (*func)(*this,current);
|
||||
|
||||
tsw_scroll(UP,minX,minY,maxX,maxY,n,attr);
|
||||
scrollUp(n);
|
||||
|
||||
redraw(current);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ExtSelectWindow::keyUp()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
ExtSelectWindow::process()
|
||||
{
|
||||
previous = current;
|
||||
|
||||
if(!end)
|
||||
{
|
||||
recalc();
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
int ofs;
|
||||
|
||||
if(previous >= start && previous <= end)
|
||||
{
|
||||
ofs = offset[previous-start];
|
||||
tsw_selbar(max(ofs,0)+minY,minX,maxX,attr,(*func)(*this,previous)+((ofs < 0)?ofs:0));
|
||||
redraw(previous);
|
||||
}
|
||||
|
||||
ofs = offset[current-start];
|
||||
|
||||
tsw_selbar(max(ofs,0)+minY,minX,maxX,barAttr,(*func)(*this,current)+((ofs < 0) ? ofs:0));
|
||||
|
||||
|
||||
if(action!=NULLFUNC && numEntries) (*action)(current);
|
||||
KB.clear();
|
||||
KEY k = KB.uget();
|
||||
|
||||
if(hotKeys!=NULL)
|
||||
for(int i=0 ; hotKeys[i] ; i++)
|
||||
if(k == hotKeys[i])
|
||||
{
|
||||
hotkey = k;
|
||||
return SL_HOTKEY;
|
||||
}
|
||||
|
||||
if(k == KEY_ESC)
|
||||
{
|
||||
return SL_ESC;
|
||||
}
|
||||
|
||||
if(k == 13)
|
||||
{
|
||||
return current;
|
||||
}
|
||||
|
||||
switch(k)
|
||||
{
|
||||
case KEY_DN: keyDown();
|
||||
break;
|
||||
case KEY_UP:
|
||||
{
|
||||
if(current <= 0)
|
||||
break;
|
||||
|
||||
previous = current--;
|
||||
|
||||
if(current == start && offset[0] < 0)
|
||||
{
|
||||
tsw_scroll(DOWN,minX,minY,maxX,maxY,-offset[0],attr);
|
||||
recalc();
|
||||
redraw(current);
|
||||
}
|
||||
|
||||
if(current < start)
|
||||
{
|
||||
int n = (*func)(*this,current);
|
||||
|
||||
tsw_scroll(DOWN,minX,minY,maxX,maxY,n,attr);
|
||||
scrollDown(n);
|
||||
|
||||
redraw(current);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_PGUP:
|
||||
{
|
||||
if(start == 0)
|
||||
{
|
||||
previous = current;
|
||||
current = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
int n = 0;
|
||||
int y = offset[current-start];
|
||||
|
||||
for(int i = start;i>0 && n<(maxY-minY+1);i--)
|
||||
{
|
||||
n += (*func)(*this,i);
|
||||
}
|
||||
|
||||
start = i;
|
||||
recalc();
|
||||
|
||||
current = start;
|
||||
|
||||
for(i=start;i<=end;i++)
|
||||
{
|
||||
if(offset[i-start] >= y)
|
||||
{
|
||||
current = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_PGDN:
|
||||
{
|
||||
if(end == numEntries-1)
|
||||
{
|
||||
previous = current;
|
||||
current = end;
|
||||
break;
|
||||
}
|
||||
|
||||
int y = offset[current-start];
|
||||
|
||||
start = end+1;
|
||||
recalc();
|
||||
|
||||
previous = current;
|
||||
current = start;
|
||||
|
||||
for(int i=start;i<=end;i++)
|
||||
{
|
||||
if(offset[i-start] >= y)
|
||||
{
|
||||
current = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_HOME:
|
||||
{
|
||||
start = 0;
|
||||
current = previous = 0;
|
||||
recalc();
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_END:
|
||||
{
|
||||
if(current == numEntries-1)
|
||||
break;
|
||||
|
||||
//start = numEntries-2;
|
||||
end = numEntries;
|
||||
current = numEntries-1;
|
||||
recalc();
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ExtSelectWindow::show(int n)
|
||||
{
|
||||
start = n;
|
||||
current = previous = n;
|
||||
recalc();
|
||||
redraw();
|
||||
}
|
||||
|
||||
ExtSelectWindow::ExtSelectWindow(int num,ATTR battr,int(*f)(ExtSelectWindow&,int,int,int),KEY *hot,void(*actionf)(int))
|
||||
{
|
||||
barAttr = battr;
|
||||
numEntries = num;
|
||||
hotKeys = hot;
|
||||
func = f;
|
||||
action = actionf;
|
||||
|
||||
current = 0;
|
||||
previous = 0;
|
||||
start = 0;
|
||||
end = 0;
|
||||
}
|
||||
|
||||
void
|
||||
ExtSelectWindow::define(int num,ATTR battr,int(*f)(ExtSelectWindow&,int,int,int),KEY *hot,void(*actionf)(int))
|
||||
{
|
||||
barAttr = battr;
|
||||
numEntries = num;
|
||||
hotKeys = hot;
|
||||
func = f;
|
||||
action = actionf;
|
||||
|
||||
current = 0;
|
||||
previous = 0;
|
||||
start = 0;
|
||||
end = 0;
|
||||
}
|
||||
|
||||
void
|
||||
ExtSelectWindow::reDefine(int num)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
class ExtSelectWindow : public Window
|
||||
{
|
||||
int start,
|
||||
end,
|
||||
previous;
|
||||
KEY *hotKeys;
|
||||
int (*func)(ExtSelectWindow&,int n,int y=0,int maxheight=0);
|
||||
void (*action)(int);
|
||||
ATTR barAttr;
|
||||
int numEntries;
|
||||
int offset[100];
|
||||
|
||||
void recalc(int order = 1);
|
||||
void redraw(int = -1);
|
||||
void scrollUp(int n);
|
||||
void scrollDown(int n);
|
||||
|
||||
void keyDown();
|
||||
void keyUp();
|
||||
void keyPgUp();
|
||||
void keyPgDn();
|
||||
void keyHome();
|
||||
void keyEnd();
|
||||
|
||||
public:
|
||||
int current;
|
||||
KEY hotkey;
|
||||
|
||||
ExtSelectWindow () { }
|
||||
ExtSelectWindow (int num,ATTR battr,int (*f)(ExtSelectWindow&,int,int,int),KEY *hot=NULL,void(*actionf)(int)=NULLFUNC);
|
||||
|
||||
void define (int num,ATTR battr,int (*f)(ExtSelectWindow&,int,int,int),KEY *hot=NULL,void(*actionf)(int)=NULLFUNC);
|
||||
void reDefine (int num);
|
||||
|
||||
int process();
|
||||
|
||||
void show(int n);
|
||||
void showLast() { show(numEntries-1); }
|
||||
void showFirst() { show(0); }
|
||||
};
|
|
@ -0,0 +1,42 @@
|
|||
extsel.hpp 1: class ExtSelectWindow : public Window
|
||||
extsel.hpp 2: {
|
||||
extsel.hpp 3: int start,
|
||||
extsel.hpp 4: end,
|
||||
extsel.hpp 5: previous;
|
||||
extsel.hpp 6: KEY *hotKeys;
|
||||
extsel.hpp 7: int (*func)(ExtSelectWindow&,int n,int y=0,int maxheight=0);
|
||||
extsel.hpp 8: void (*action)(int);
|
||||
extsel.hpp 9: ATTR barAttr;
|
||||
extsel.hpp 10: int numEntries;
|
||||
extsel.hpp 11: int offset[100];
|
||||
extsel.hpp 12:
|
||||
extsel.hpp 13: void recalc(int order = 1);
|
||||
extsel.hpp 14: void redraw(int = -1);
|
||||
extsel.hpp 15: void scrollUp(int n);
|
||||
extsel.hpp 16: void scrollDown(int n);
|
||||
extsel.hpp 17:
|
||||
extsel.hpp 18: void keyDown();
|
||||
extsel.hpp 19: void keyUp();
|
||||
extsel.hpp 20: void keyPgUp();
|
||||
extsel.hpp 21: void keyPgDn();
|
||||
extsel.hpp 22: void keyHome();
|
||||
extsel.hpp 23: void keyEnd();
|
||||
extsel.hpp 24:
|
||||
extsel.hpp 25: public:
|
||||
extsel.hpp 26: int current;
|
||||
extsel.hpp 27: KEY hotkey;
|
||||
extsel.hpp 28:
|
||||
extsel.hpp 29: ExtSelectWindow () { }
|
||||
extsel.hpp 30: ExtSelectWindow (int num,ATTR battr,int (*f)(ExtSelectWindow&,int,int,int),KEY *hot=NULL,void(*actionf)(int)=NULLFUNC);
|
||||
extsel.hpp 31:
|
||||
extsel.hpp 32: void define (int num,ATTR battr,int (*f)(ExtSelectWindow&,int,int,int),KEY *hot=NULL,void(*actionf)(int)=NULLFUNC);
|
||||
extsel.hpp 33: void reDefine (int num);
|
||||
extsel.hpp 34:
|
||||
extsel.hpp 35: int process();
|
||||
extsel.hpp 36:
|
||||
extsel.hpp 37: void show(int n);
|
||||
extsel.hpp 38: void showLast() { show(numEntries-1); }
|
||||
extsel.hpp 39: void showFirst() { show(0); }
|
||||
extsel.hpp 40: };
|
||||
extsel.hpp 41:
|
||||
extsel.hpp 42:
|
Binary file not shown.
|
@ -0,0 +1,119 @@
|
|||
#include <ctype.h>
|
||||
#include "procfg.hpp"
|
||||
|
||||
KEY
|
||||
flagonoff_select(int mode,Window& w,int x,int y,char attr,void *data)
|
||||
{
|
||||
AccessFlags *af_on=((AccessFlags **)data)[0];
|
||||
AccessFlags *af_off=((AccessFlags **)data)[1];
|
||||
|
||||
tsw_cursoroff();
|
||||
|
||||
if(mode)
|
||||
{
|
||||
Window ww( x + w.minX - 1,
|
||||
y + w.minY - 2,
|
||||
x + w.minX + 36,
|
||||
y + w.minY,
|
||||
0xF,
|
||||
BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x07,
|
||||
NULL,
|
||||
0x08 );
|
||||
|
||||
ww.open();
|
||||
|
||||
ww.title( "Press A..Z , 1..6 to toggle", 0xE );
|
||||
|
||||
ww.direct( 9,
|
||||
2,
|
||||
0xE,
|
||||
" [F1] - Flag Help " );
|
||||
|
||||
for(;;)
|
||||
{
|
||||
int x = 2;
|
||||
|
||||
for(int i=1;i<=32;i++)
|
||||
{
|
||||
char c = (i<=26) ? ('A'+i-1) : ('0'+i-26);
|
||||
|
||||
if(af_on->getflag(i))
|
||||
{
|
||||
ww.direct(x++,1,0xF,c);
|
||||
}
|
||||
else
|
||||
if(af_off->getflag(i))
|
||||
{
|
||||
ww.direct(x++,1,0x70,c);
|
||||
}
|
||||
else
|
||||
{
|
||||
ww.direct(x++,1,0xF,'-');
|
||||
}
|
||||
}
|
||||
|
||||
KEY k=KB.get();
|
||||
|
||||
if(k == KEY_F1) show_flags();
|
||||
|
||||
if(k==27 || k==13) return 0;
|
||||
|
||||
if(isalpha(k))
|
||||
{
|
||||
k = toupper(k)-'A'+1;
|
||||
}
|
||||
else
|
||||
if(k>='1' && k<='6')
|
||||
{
|
||||
k -= '1'-27;
|
||||
}
|
||||
else
|
||||
k = 0;
|
||||
|
||||
if(k)
|
||||
{
|
||||
if(af_on->getflag(k))
|
||||
{
|
||||
af_on->clearflag(k);
|
||||
af_off->setflag(k);
|
||||
}
|
||||
else
|
||||
if(af_off->getflag(k))
|
||||
{
|
||||
af_on->clearflag(k);
|
||||
af_off->clearflag(k);
|
||||
}
|
||||
else
|
||||
{
|
||||
af_on->setflag(k);
|
||||
af_off->clearflag(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=1;i<=32;i++)
|
||||
{
|
||||
char c = (i<=26) ? ('A'+i-1) : ('0'+i-26);
|
||||
|
||||
if(af_on->getflag(i))
|
||||
{
|
||||
w.direct(x++,y,attr,c);
|
||||
}
|
||||
else
|
||||
if(af_off->getflag(i))
|
||||
{
|
||||
w.direct(x++,y,0x70,c);
|
||||
}
|
||||
else
|
||||
{
|
||||
w.direct(x++,y,attr,'-');
|
||||
}
|
||||
}
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
return 0;
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,640 @@
|
|||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "procfg.hpp"
|
||||
//#include <deflang.hpp>
|
||||
|
||||
#include "extsel.hpp"
|
||||
|
||||
static void edit_properties();
|
||||
static bool read_default_language();
|
||||
|
||||
typedef _LanguageString LanguageString;
|
||||
|
||||
const int MAX_LSTRINGS = 400;
|
||||
|
||||
static LanguageFile far lang_file;
|
||||
|
||||
static LanguageString *lstrings;
|
||||
static LanguageString *default_lstrings;
|
||||
|
||||
static word num_lstrings;
|
||||
|
||||
static void edit_language_string( LanguageString& l );
|
||||
|
||||
static int
|
||||
list_func(ExtSelectWindow& w , int i,int y,int maxheight)
|
||||
{
|
||||
char *s = lstrings[i].s;
|
||||
int count = 0;
|
||||
|
||||
if(y <= 0)
|
||||
{
|
||||
for( ; *s ; s++)
|
||||
if(*s == '\n')
|
||||
count++;
|
||||
|
||||
return count + 1;
|
||||
}
|
||||
|
||||
bool highlight = FALSE;
|
||||
int old_x,old_y;
|
||||
byte old_attr;
|
||||
|
||||
old_attr = w.attrib();
|
||||
w.getPos(old_x,old_y);
|
||||
w.setPos(1,y);
|
||||
w.attrib(lstrings[i].color);
|
||||
|
||||
tsw_clearrect(w.minX,w.minY+y-1,w.maxX,w.minY+y-1,w.attrib());
|
||||
|
||||
for(;*s;s++)
|
||||
{
|
||||
byte c = 0;
|
||||
|
||||
c = *s;
|
||||
|
||||
if(w.inEscape())
|
||||
{
|
||||
w << c;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(c == '\\')
|
||||
{
|
||||
char c = *(++s);
|
||||
|
||||
if(c == '\\')
|
||||
{
|
||||
w << '\\';
|
||||
s++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte col = 0;
|
||||
|
||||
if(isxdigit(c))
|
||||
{
|
||||
for( int i = 0; i < 2 ; i++ , s++)
|
||||
{
|
||||
c = *s;
|
||||
|
||||
if(isdigit(c))
|
||||
col = col * 16 + c - '0';
|
||||
else
|
||||
col = col * 16 + toupper(c) - 'A' + 10;
|
||||
}
|
||||
|
||||
w.attrib(col);
|
||||
|
||||
s--;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(c == 'H' || c == 'L')
|
||||
{
|
||||
switch(*(++s))
|
||||
{
|
||||
case 'B': col = 1;
|
||||
break;
|
||||
case 'G': col = 2;
|
||||
break;
|
||||
case 'C': col = 3;
|
||||
break;
|
||||
case 'R': col = 4;
|
||||
break;
|
||||
case 'P': col = 5;
|
||||
break;
|
||||
case 'Y': col = 6;
|
||||
break;
|
||||
case 'W': col = 7;
|
||||
break;
|
||||
}
|
||||
|
||||
if(c == 'H') col |= 8;
|
||||
}
|
||||
|
||||
w.attrib(col);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(c == '^')
|
||||
{
|
||||
highlight = !highlight;
|
||||
|
||||
if(highlight)
|
||||
w.attrib(lstrings[i].highlight);
|
||||
else
|
||||
w.attrib(lstrings[i].color);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(c == '\n')
|
||||
{
|
||||
if(++count >= maxheight)
|
||||
break;
|
||||
|
||||
tsw_clearrect(w.minX,w.minY+w.getY(),w.maxX,w.minY+w.getY(),w.attrib());
|
||||
}
|
||||
|
||||
if(c != '\f')
|
||||
w << c;
|
||||
}
|
||||
|
||||
w.setPos(old_x,old_y);
|
||||
w.attrib(old_attr);
|
||||
|
||||
return count+1;
|
||||
}
|
||||
|
||||
static void
|
||||
action_func(int i)
|
||||
{
|
||||
tsw_clearrect( 1, tsw_vsize , tsw_hsize , tsw_vsize , BAR_COLOR );
|
||||
tsw_mputs( 2, tsw_vsize , default_lstrings[i].s );
|
||||
tsw_maputs(2,2, 0x1B, form("Prompt #%-4d",i+1));
|
||||
}
|
||||
|
||||
void
|
||||
edit_language(char *langname)
|
||||
{
|
||||
ScreenRestore restore;
|
||||
|
||||
tsw_clearrect(1,1,tsw_hsize,2,0x1E);
|
||||
tsw_centerline(1,"[Alt-D] Restore default [Alt-P] Language Properties [Alt-S] Search");
|
||||
|
||||
KEY hotkeys[] = { KEY_ALTD , KEY_ALTP , KEY_ALTS, KEY_ALTN, 0 };
|
||||
|
||||
ExtSelectWindow sw;
|
||||
|
||||
sw.open( 1,
|
||||
3,
|
||||
tsw_hsize,
|
||||
tsw_vsize - 1,
|
||||
0x0F,
|
||||
NOBORDER | NOSAVE );
|
||||
|
||||
File f;
|
||||
int i;
|
||||
|
||||
CLEAR_OBJECT(lang_file);
|
||||
|
||||
default_lstrings = new LanguageString[ MAX_LSTRINGS ];
|
||||
|
||||
if(!read_default_language())
|
||||
{
|
||||
tsw_beep();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
lstrings = new LanguageString[ MAX_LSTRINGS ];
|
||||
|
||||
for( i=0 ; default_lstrings[i].len ; i++ )
|
||||
{
|
||||
lstrings[i] = default_lstrings[i];
|
||||
}
|
||||
|
||||
num_lstrings = i;
|
||||
|
||||
if(f.open(FileName(syspath,langname,".PBL")))
|
||||
{
|
||||
f.read(&lang_file , sizeof(LanguageFile));
|
||||
|
||||
word numinfile;
|
||||
|
||||
f >> numinfile;
|
||||
|
||||
for(i=0;i<numinfile;i++)
|
||||
{
|
||||
if(!lstrings[i].read(f))
|
||||
break;
|
||||
}
|
||||
|
||||
for( ; default_lstrings[i].len ; i++ )
|
||||
{
|
||||
lstrings[i] = default_lstrings[i];
|
||||
}
|
||||
|
||||
num_lstrings = i;
|
||||
|
||||
f.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
delete [] lstrings;
|
||||
delete [] default_lstrings;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sw.define(num_lstrings,0x70,list_func,hotkeys,action_func);
|
||||
|
||||
String search_spec;
|
||||
int last_search_num;
|
||||
|
||||
bool state = tsw_cursorstate;
|
||||
|
||||
tsw_cursoroff();
|
||||
|
||||
for(;;)
|
||||
{
|
||||
int choice = sw.process();
|
||||
|
||||
if(choice == SL_HOTKEY)
|
||||
{
|
||||
switch(sw.hotkey)
|
||||
{
|
||||
case KEY_ALTS:
|
||||
{
|
||||
char s[80];
|
||||
|
||||
Window w;
|
||||
|
||||
w.open( 10,
|
||||
7,
|
||||
60,
|
||||
9,
|
||||
0x3F,
|
||||
SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
s[0] = '\0';
|
||||
|
||||
w << " Search for : ";
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
w.attrib(0x31);
|
||||
|
||||
if(w.scan(s, 35, 32, SCAN_UPPER) == SF_ESC)
|
||||
{
|
||||
tsw_cursoroff();
|
||||
continue;
|
||||
}
|
||||
|
||||
search_spec = s;
|
||||
|
||||
tsw_cursoroff();
|
||||
w.close();
|
||||
|
||||
for(int i=0;i<num_lstrings;i++)
|
||||
{
|
||||
String s = lstrings[i].s;
|
||||
|
||||
if(s.find(search_spec) >= 0)
|
||||
{
|
||||
sw.show(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(i == num_lstrings)
|
||||
{
|
||||
tsw_beep();
|
||||
tsw_beep();
|
||||
}
|
||||
else
|
||||
last_search_num = i;
|
||||
}
|
||||
continue;
|
||||
|
||||
case KEY_ALTN:
|
||||
{
|
||||
if(search_spec.len() < 2)
|
||||
continue;
|
||||
|
||||
for(int i=last_search_num+1;i<num_lstrings;i++)
|
||||
{
|
||||
String s = lstrings[i].s;
|
||||
|
||||
if(s.find(search_spec) >= 0)
|
||||
{
|
||||
sw.show(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(i == num_lstrings)
|
||||
{
|
||||
tsw_beep();
|
||||
tsw_beep();
|
||||
}
|
||||
else
|
||||
last_search_num = i;
|
||||
}
|
||||
continue;
|
||||
case KEY_ALTD:
|
||||
{
|
||||
lstrings[sw.current] = default_lstrings[sw.current];
|
||||
}
|
||||
continue;
|
||||
case KEY_ALTP:
|
||||
{
|
||||
edit_properties();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(choice<0) break;
|
||||
|
||||
int prevlines = list_func(sw,choice,0,0);
|
||||
|
||||
edit_language_string( lstrings[choice] );
|
||||
|
||||
if(prevlines != list_func(sw,choice,0,0)) sw.show(choice);
|
||||
}
|
||||
|
||||
if(state)
|
||||
tsw_cursoron();
|
||||
|
||||
f.open(FileName(syspath,langname,".PBL") , fmode_create , 4096);
|
||||
|
||||
f.write(&lang_file,sizeof(LanguageFile));
|
||||
|
||||
f << num_lstrings;
|
||||
|
||||
for(i=0 ; i<num_lstrings ; i++)
|
||||
{
|
||||
lstrings[i].write(f);
|
||||
}
|
||||
|
||||
delete [] lstrings;
|
||||
delete [] default_lstrings;
|
||||
|
||||
tsw_fillrect(1,1,tsw_hsize,1,'°',0x70);
|
||||
}
|
||||
|
||||
static void
|
||||
edit_language_string( LanguageString& l )
|
||||
{
|
||||
Field frm_all[]=
|
||||
{
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 200, 55, 14,2 },
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 200, 55, 14,3 },
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 200, 55, 14,4 },
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 200, 55, 14,5 },
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 200, 55, 14,6 },
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 200, 55, 14,7 },
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 200, 55, 14,8 },
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 200, 55, 14,9 },
|
||||
|
||||
{ FRM_STRING , 0 , 0,0 , 0 , 49 , 50, 14,11 },
|
||||
|
||||
{ FRM_FUNCTION, 0 , 0,edit_color , 0 , 20 , 20, 14,13 },
|
||||
{ FRM_FUNCTION, 0 , 0,edit_color , 0 , 20 , 20, 14,14 },
|
||||
{ FRM_FUNCTION, 0 , 0,edit_color , 0 , 20 , 20, 14,15 }
|
||||
};
|
||||
|
||||
char *ss[8] =
|
||||
{
|
||||
new char[201] ,
|
||||
new char[201] ,
|
||||
new char[201] ,
|
||||
new char[201] ,
|
||||
new char[201] ,
|
||||
new char[201] ,
|
||||
new char[201] ,
|
||||
new char[201]
|
||||
};
|
||||
|
||||
dword crc = 0;
|
||||
|
||||
crc += crc32(l.s);
|
||||
crc += crc32(l.hotkeys);
|
||||
crc += crc32(&l.color,1);
|
||||
crc += crc32(&l,sizeof(l));
|
||||
|
||||
*ss[0] = '\0';
|
||||
*ss[1] = '\0';
|
||||
*ss[2] = '\0';
|
||||
*ss[3] = '\0';
|
||||
*ss[4] = '\0';
|
||||
*ss[5] = '\0';
|
||||
*ss[6] = '\0';
|
||||
*ss[7] = '\0';
|
||||
|
||||
char *s = l.s;
|
||||
|
||||
for( int i = 0 , j = 0; *s && i < 8 ; s++)
|
||||
{
|
||||
if(*s == '\n')
|
||||
{
|
||||
ss[i++][j] = '\0';
|
||||
j = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
ss[i][j++] = *s;
|
||||
}
|
||||
|
||||
ss[i][j] = '\0';
|
||||
|
||||
char *hk = new char[50];
|
||||
strcpy(hk,l.hotkeys);
|
||||
|
||||
Field frm[12];
|
||||
|
||||
int n_frm = 0;
|
||||
|
||||
frm[n_frm++] = frm_all[0];
|
||||
frm[n_frm++] = frm_all[1];
|
||||
frm[n_frm++] = frm_all[2];
|
||||
frm[n_frm++] = frm_all[3];
|
||||
frm[n_frm++] = frm_all[4];
|
||||
frm[n_frm++] = frm_all[5];
|
||||
frm[n_frm++] = frm_all[6];
|
||||
frm[n_frm++] = frm_all[7];
|
||||
|
||||
if(l.numHotkeys)
|
||||
{
|
||||
frm[n_frm ] = frm_all[8];
|
||||
frm[n_frm++].value = hk;
|
||||
}
|
||||
|
||||
if(!(l.flags & LANG_NOCOLOR))
|
||||
{
|
||||
frm[n_frm ] = frm_all[ 9];
|
||||
frm[n_frm++].value = &l.color;
|
||||
frm[n_frm ] = frm_all[10];
|
||||
frm[n_frm++].value = &l.highlight;
|
||||
}
|
||||
|
||||
if(l.flags & LANG_PROMPT)
|
||||
{
|
||||
frm[n_frm ] = frm_all[11];
|
||||
frm[n_frm++].value = &l.promptcolor;
|
||||
}
|
||||
|
||||
frm[0].value = ss[0];
|
||||
frm[1].value = ss[1];
|
||||
frm[2].value = ss[2];
|
||||
frm[3].value = ss[3];
|
||||
frm[4].value = ss[4];
|
||||
frm[5].value = ss[5];
|
||||
frm[6].value = ss[6];
|
||||
frm[7].value = ss[7];
|
||||
|
||||
FormWindow fw( 4,
|
||||
5,
|
||||
77,
|
||||
22,
|
||||
0x1F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x19,
|
||||
NULL,
|
||||
0x10 );
|
||||
|
||||
fw.open();
|
||||
|
||||
fw.title( "Edit Language String", 0x1E );
|
||||
|
||||
fw.attrib(0x1B);
|
||||
|
||||
fw << "\n String #1:"
|
||||
"\n String #2:"
|
||||
"\n String #3:"
|
||||
"\n String #4:"
|
||||
"\n String #5:"
|
||||
"\n String #6:"
|
||||
"\n String #7:"
|
||||
"\n String #8:\n"
|
||||
"\n Hotkeys: n/a\n"
|
||||
"\n Color: n/a"
|
||||
"\n Highlight: n/a"
|
||||
"\n Prompt Col: n/a";
|
||||
|
||||
fw.define( frm,
|
||||
n_frm,
|
||||
0x1B,
|
||||
0x4E );
|
||||
|
||||
tsw_cursoron();
|
||||
fw.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
for(j=7;j>=0;j--) if(ss[j][0]) break;
|
||||
|
||||
String result = ss[0];
|
||||
|
||||
if(j > 0) result << '\n' << ss[1];
|
||||
if(j > 1) result << '\n' << ss[2];
|
||||
if(j > 2) result << '\n' << ss[3];
|
||||
if(j > 3) result << '\n' << ss[4];
|
||||
if(j > 4) result << '\n' << ss[5];
|
||||
if(j > 5) result << '\n' << ss[6];
|
||||
if(j > 6) result << '\n' << ss[7];
|
||||
|
||||
if( crc32(result)+crc32(hk)+crc32(&l.color,1)+crc32(&l,sizeof(l)) != crc)
|
||||
{
|
||||
if(ask_save() == 0)
|
||||
l = LanguageString(result,hk,l.color,l.highlight,l.flags,l.promptcolor);
|
||||
}
|
||||
|
||||
delete [] ss[0];
|
||||
delete [] ss[1];
|
||||
delete [] ss[2];
|
||||
delete [] ss[3];
|
||||
delete [] ss[4];
|
||||
delete [] ss[5];
|
||||
delete [] ss[6];
|
||||
delete [] ss[7];
|
||||
delete [] hk;
|
||||
}
|
||||
|
||||
static void
|
||||
edit_properties()
|
||||
{
|
||||
Field frm[]=
|
||||
{
|
||||
{ FRM_STRING , lang_file.name , 0,0 , 0 , 40 , 41, 17,2 },
|
||||
{ FRM_YESNO , &lang_file.avail , 0,0 , 0 , 3 , 3 , 17,4 },
|
||||
{ FRM_UNSIGNED, &lang_file.level , 0,0 , 0 , 5 , 6 , 17,6 },
|
||||
{ FRM_FUNCTION, &lang_file.flags , 0,flag_select ,0, 26 , 26, 17,7 },
|
||||
{ FRM_STRING , lang_file.menuPath, 0,0 , FRM_UPPER , 60 , 45, 17,9 },
|
||||
{ FRM_STRING , lang_file.txtPath, 0,0 , FRM_UPPER , 60 , 45, 17,10 },
|
||||
{ FRM_STRING , lang_file.questPath, 0,0 , FRM_UPPER , 60 , 45, 17,11 }
|
||||
//{ FRM_STRING , lang_file.copyright , 0,0 , 0 , 80 , 45, 17,13 }
|
||||
};
|
||||
|
||||
FormWindow w( 6,
|
||||
7,
|
||||
75,
|
||||
20,
|
||||
0x3F,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x3B,
|
||||
NULL,
|
||||
0x31 );
|
||||
|
||||
w.define( frm,
|
||||
7,
|
||||
0x31,
|
||||
0x4E );
|
||||
|
||||
w.open();
|
||||
|
||||
w.title( "Language Properties", 0x3E );
|
||||
|
||||
w.attrib(0x3F);
|
||||
|
||||
w << "\n Description:\n\n"
|
||||
" Available:\n\n"
|
||||
" Level:\n"
|
||||
" Flags:\n\n"
|
||||
" Menu Path:\n"
|
||||
" Text Path:\n"
|
||||
" Quest. Path:";
|
||||
//" Copyright:";
|
||||
|
||||
tsw_cursoron();
|
||||
w.process();
|
||||
tsw_cursoroff();
|
||||
|
||||
if(strlen(lang_file.menuPath) >= 3)
|
||||
append_backspace(lang_file.menuPath);
|
||||
else
|
||||
lang_file.menuPath[0] = '\0';
|
||||
|
||||
if(strlen(lang_file.txtPath) >= 3)
|
||||
append_backspace(lang_file.txtPath);
|
||||
else
|
||||
lang_file.txtPath[0] = '\0';
|
||||
|
||||
if(strlen(lang_file.questPath) >= 3)
|
||||
append_backspace(lang_file.questPath);
|
||||
else
|
||||
lang_file.questPath[0] = '\0';
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
read_default_language()
|
||||
{
|
||||
File f;
|
||||
|
||||
if(!f.open(FileName(syspath,"DEFLANG.PB") , fmode_read , 4096))
|
||||
return FALSE;
|
||||
|
||||
f.seek(long(sizeof(LanguageFile) + 2));
|
||||
|
||||
for(int i=0;;i++)
|
||||
{
|
||||
if(!default_lstrings[i].read(f)) break;
|
||||
}
|
||||
|
||||
default_lstrings[i].len = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
|
||||
call mc.bat *.cpp
|
|
@ -0,0 +1,22 @@
|
|||
## Makefile for ProCFG
|
||||
|
||||
OBJS = procfg.obj editaka.obj editlim.obj editmac.obj \
|
||||
editmenu.obj editarea.obj editpb.obj editprot.obj editsys.obj \
|
||||
edituser.obj events.obj editpvt.obj language.obj sel_lang.obj \
|
||||
extsel.obj flags.obj promisc.obj editvtpl.obj template.obj \
|
||||
editgrp.obj editlcol.obj editnode.obj area.obj misc.obj
|
||||
|
||||
MODEL = LARGE
|
||||
OVERLAY = 1
|
||||
|
||||
OVLOBJS = $(OBJS,Ntemplate\.obj,Nedituser\.obj,Narea\.obj)
|
||||
|
||||
TSLIB = 1
|
||||
TSWIN = 1
|
||||
PBLIB = 1
|
||||
|
||||
LIBS = \cpp\lib\pb\proboard.lib \cpp\lib\th\thehouse.lib
|
||||
|
||||
CFLAGS = -I\cpp\lib\pb -I\cpp\lib\th
|
||||
|
||||
ProCFG.EXE: $(OBJS)
|
|
@ -0,0 +1,5 @@
|
|||
@echo off
|
||||
|
||||
echo Compiling %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
bcc @mc.cfg %1 %2 %3 %4 %5 %6 %7 %8 %9
|
|
@ -0,0 +1,17 @@
|
|||
-P-cpp
|
||||
-c
|
||||
-ml
|
||||
-Y
|
||||
-w-par
|
||||
-w-aus
|
||||
-w-use
|
||||
-w-inl
|
||||
-w-pin
|
||||
-w-amb
|
||||
-w-asm
|
||||
-w-def
|
||||
-w-nod
|
||||
-w-pro
|
||||
-w-stv
|
||||
-w-pre
|
||||
-w-sig
|
|
@ -0,0 +1,65 @@
|
|||
#include <string.h>
|
||||
#include "procfg.hpp"
|
||||
|
||||
static Window *busywin = NULL;
|
||||
|
||||
void
|
||||
ShowBusy(char *msg)
|
||||
{
|
||||
if(busywin)
|
||||
return;
|
||||
|
||||
busywin = new Window;
|
||||
|
||||
int len = strlen(msg);
|
||||
|
||||
len += 10;
|
||||
|
||||
if(len > tsw_hsize-6)
|
||||
len = tsw_hsize-6;
|
||||
|
||||
busywin->open( 1,
|
||||
1,
|
||||
len,
|
||||
5,
|
||||
0x0F,
|
||||
CENTERED_X | CENTERED_Y | SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x07,
|
||||
NULL,
|
||||
0x08 );
|
||||
|
||||
busywin->centerLine( 2,
|
||||
msg,
|
||||
0x0E );
|
||||
}
|
||||
|
||||
void
|
||||
HideBusy()
|
||||
{
|
||||
if(busywin)
|
||||
delete busywin;
|
||||
|
||||
busywin = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void KeyItem( Window &w,
|
||||
int x,
|
||||
int y,
|
||||
ATTR iKeyColor,
|
||||
char *pKey,
|
||||
ATTR iDescColor,
|
||||
char *pDesc )
|
||||
{
|
||||
w.direct( x - strlen( pKey ) - 1,
|
||||
y,
|
||||
iKeyColor,
|
||||
pKey );
|
||||
|
||||
w.direct( x,
|
||||
y,
|
||||
iDescColor,
|
||||
pDesc );
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,717 @@
|
|||
#ifndef PROBOARD_HPP
|
||||
#define PROBOARD_HPP
|
||||
|
||||
#include <tslib.hpp>
|
||||
#include <time.h>
|
||||
|
||||
#define VERSION "2.22"
|
||||
#define TEARVERSION "2.22"
|
||||
#define PID_STRING "ProBoard 2.22"
|
||||
#define PID_STRING_HUDSON PID_STRING " H"
|
||||
#define PID_STRING_SQUISH PID_STRING " S"
|
||||
#define PID_STRING_JAM PID_STRING " J"
|
||||
#define PORT_VALUE 10
|
||||
|
||||
#define MAX_UNREG_NODES 255
|
||||
#define MAX_UNREG_USERS 100000
|
||||
|
||||
#define VER_NUM 222
|
||||
|
||||
const word VER_WORD = 0x0220;
|
||||
const word VER_BETA = 0xFFFF; // 0000-EFFF = beta
|
||||
// F000-FEEE = gamma
|
||||
// FFFF = release
|
||||
|
||||
|
||||
//--------------------------------------------
|
||||
// Color of the status bar on the main console
|
||||
//--------------------------------------------
|
||||
|
||||
#define BAR_COLOR 0x4E
|
||||
|
||||
|
||||
#include <pb_lib.hpp>
|
||||
|
||||
#ifndef MSGAPI
|
||||
class MSG;
|
||||
#endif
|
||||
|
||||
#ifdef Use_MsgBase
|
||||
#include "msgbase.hpp"
|
||||
#else
|
||||
class Message;
|
||||
class MsgBase;
|
||||
class MsgBaseList;
|
||||
class SquishMsgBase;
|
||||
class HudsonMsgBase;
|
||||
class JamMsgBase;
|
||||
#endif
|
||||
|
||||
extern String S_PRESS_ENTER_TO_CONTINUE;
|
||||
|
||||
const int MAX_PEX_HANDLERS = 100;
|
||||
|
||||
const int BUFSIZE_FAST = 2048;
|
||||
const int BUFSIZE_SLOW = 512;
|
||||
|
||||
#ifdef RELEASE
|
||||
inline void SCRAMBLE()
|
||||
{
|
||||
*((dword _far *)12) = *((dword _far *)0x46C);
|
||||
}
|
||||
#else
|
||||
#define SCRAMBLE() ;
|
||||
#endif
|
||||
|
||||
/*
|
||||
struct User : _User
|
||||
{
|
||||
int Read(int rec); // Read record from recnr 'rec'
|
||||
int Write(int rec); // Write record to recnr 'rec' (-1 = add)
|
||||
int Find(char *username); // Find user with name 'username'
|
||||
int FindAlias(char *alias); // Find user with alias 'alias'
|
||||
void list(char *); // Generate user list
|
||||
void gentops(); // Generate top-statistics
|
||||
int FindFirstMatch(char *str,bool fuzzy);
|
||||
int FindNextMatch (char *str,bool fuzzy);
|
||||
};
|
||||
*/
|
||||
|
||||
struct User : _User
|
||||
{
|
||||
void list(char *,bool aliases=FALSE); // Generate user list
|
||||
//void gentops(); // Generate top-statistics
|
||||
};
|
||||
|
||||
struct Config : _Config {};
|
||||
struct LanguageString : _LanguageString {};
|
||||
struct AreaGroup : _AreaGroup {};
|
||||
|
||||
struct FileArea : _FileArea
|
||||
{
|
||||
static File f;
|
||||
static int lastAreaNum;
|
||||
static FileArea *lastArea;
|
||||
static int numAreas;
|
||||
|
||||
static void open();
|
||||
public:
|
||||
int areaNum;
|
||||
|
||||
bool read(int);
|
||||
|
||||
static void close();
|
||||
static int highAreaNum();
|
||||
};
|
||||
|
||||
struct timelog : _TimeLog
|
||||
{
|
||||
void read();
|
||||
void update();
|
||||
};
|
||||
|
||||
struct dl_today
|
||||
{
|
||||
int files;
|
||||
int kb;
|
||||
};
|
||||
|
||||
struct BinLog
|
||||
{
|
||||
Date date; // 3
|
||||
Time timeIn; // 3
|
||||
Time timeOut; // 3
|
||||
char name[36]; // 36
|
||||
char city[26]; // 26
|
||||
char country[26]; // 26
|
||||
long baud; // 4
|
||||
word node; // 2
|
||||
long kbDown; // 4
|
||||
long kbUp; // 4
|
||||
word yells; // 2
|
||||
word level; // 2
|
||||
dword uflags; // 4
|
||||
char alias[36]; // 36
|
||||
|
||||
byte extra[45];
|
||||
|
||||
BinLog();
|
||||
|
||||
bool append();
|
||||
};
|
||||
|
||||
struct user_online
|
||||
{
|
||||
char name[36];
|
||||
char city[16];
|
||||
unsigned baud;
|
||||
int status;
|
||||
byte extra[8];
|
||||
|
||||
void read(int = 0);
|
||||
void write();
|
||||
void clear();
|
||||
int chatreq(int); // 0->Chat Granted 1->Timeout 2->Not Avail
|
||||
int check_chat(); // 0->No (>0)->node
|
||||
void setstatus(int stat,int node=0);
|
||||
int getstatus(int node=0);
|
||||
};
|
||||
|
||||
#define UO_OFFLINE -2
|
||||
#define UO_BROWSING 0
|
||||
#define UO_SHELLING -3
|
||||
#define UO_BUSY -4
|
||||
#define UO_CHATTING -1
|
||||
|
||||
struct limits
|
||||
{
|
||||
unsigned level;
|
||||
int timelimit;
|
||||
int daily_klimit;
|
||||
int pre_download;
|
||||
char id[6];
|
||||
unsigned free; // Free upload in Kb.
|
||||
unsigned char factor; // Percentage upload required
|
||||
unsigned max_download; // Max download for this level
|
||||
unsigned fallto; // Fall to level x when max. reached
|
||||
int msgfactor; // # Kbytes granted per message written
|
||||
int sessionlimit; // Time limit per session
|
||||
byte extra[3];
|
||||
};
|
||||
|
||||
struct topentry
|
||||
{
|
||||
char name[36];
|
||||
dword n;
|
||||
};
|
||||
|
||||
struct aka
|
||||
{
|
||||
int zone;
|
||||
int net;
|
||||
int node;
|
||||
int point;
|
||||
|
||||
int read(int n);
|
||||
};
|
||||
|
||||
|
||||
class usertimer
|
||||
{
|
||||
time_t started;
|
||||
time_t suspend_start;
|
||||
int suspendedtime;
|
||||
bool suspended;
|
||||
int fixedtime;
|
||||
time_t inactivity_start;
|
||||
public:
|
||||
usertimer();
|
||||
void start(int minutes);
|
||||
void increase();
|
||||
void decrease();
|
||||
void changeleft(int);
|
||||
void suspend();
|
||||
void restart();
|
||||
int timesuspended() { return suspendedtime; }
|
||||
int left();
|
||||
int online();
|
||||
int used();
|
||||
void check();
|
||||
void clearinactivity();
|
||||
void checkinactivity();
|
||||
};
|
||||
|
||||
#define READMODE_ALL 0
|
||||
#define READMODE_UPFIRST 1
|
||||
#define READMODE_UPALL 2
|
||||
#define READMODE_DIGITS 3
|
||||
#define READMODE_PWD 64
|
||||
#define READMODE_NOFIELD 128
|
||||
|
||||
class command_stack
|
||||
{
|
||||
int sp;
|
||||
char buf[100];
|
||||
public:
|
||||
command_stack() { sp=0; }
|
||||
void parse(char *);
|
||||
void clear() { sp=0; }
|
||||
char getnext();
|
||||
char pollnext();
|
||||
};
|
||||
|
||||
struct fossilio
|
||||
{
|
||||
int port; // comport (0=COM1)
|
||||
long baud; // baud rate
|
||||
int external; // 1 if key received from com-port
|
||||
int stopenabled;
|
||||
bool show_local;
|
||||
bool show_remote;
|
||||
command_stack inputbuffer;
|
||||
int (*more_func)();
|
||||
|
||||
byte *outputBuffer;
|
||||
int bufferPtr;
|
||||
|
||||
void init(int port,long baud);
|
||||
fossilio() { baud = 65535L; outputBuffer = NULL; }
|
||||
~fossilio();
|
||||
void flush();
|
||||
byte readkey();
|
||||
byte wait();
|
||||
byte wait(char *);
|
||||
void wait(char);
|
||||
fossilio& operator<<(char);
|
||||
fossilio& operator<<(char*);
|
||||
byte send(char *str,char *hotkeys=NULL);
|
||||
byte sendfile(char *filename,char *hotkeys=NULL);
|
||||
void drawfield(int len);
|
||||
void read(char *s,int max,byte mode=READMODE_ALL);
|
||||
int read(int& i,int max=5);
|
||||
int read(long&, int max=7);
|
||||
void readpass(char *s);
|
||||
void hangup();
|
||||
int ask(int def=1);
|
||||
void cooldown();
|
||||
void heatup();
|
||||
void color(byte);
|
||||
void fullcolor(byte);
|
||||
void move(int x,int y);
|
||||
void clreol();
|
||||
void cls();
|
||||
void enablestop();
|
||||
void disablestop();
|
||||
void clearinput();
|
||||
};
|
||||
|
||||
|
||||
struct node_entry
|
||||
{
|
||||
byte type;
|
||||
int zone,region,net,node;
|
||||
int cost;
|
||||
char name[50];
|
||||
char city[50];
|
||||
|
||||
int read(char *);
|
||||
};
|
||||
|
||||
struct KeyData
|
||||
{
|
||||
Date createDate;
|
||||
Time createTime;
|
||||
char createdBy[36];
|
||||
char sysopName[36];
|
||||
char bbsName[36];
|
||||
bool alpha;
|
||||
bool beta;
|
||||
bool gamma;
|
||||
bool distSite;
|
||||
bool regSite;
|
||||
bool commercial;
|
||||
Date expirDate;
|
||||
word expirVersion;
|
||||
byte extra[2];
|
||||
};
|
||||
|
||||
#define NODE_ZONE 1
|
||||
#define NODE_REGION 2
|
||||
#define NODE_HOST 3
|
||||
#define NODE_HUB 4
|
||||
|
||||
struct event
|
||||
{
|
||||
int type; // Errorlevel or DOS command
|
||||
int errorlevel; // Errorlevel to use (>5)
|
||||
char command[80]; // DOS Command to execute
|
||||
Time start; // Time of the event
|
||||
int duration; // Duration of the event (min).
|
||||
byte empty;
|
||||
byte days; // Bits 0-6 -> days of the week
|
||||
byte node; // Node number to execute the event on
|
||||
byte enabled; // Enabled?
|
||||
|
||||
int minutesleft(); // Minutes until this event
|
||||
int nextday(); // Day of this event
|
||||
};
|
||||
|
||||
struct pvt_file
|
||||
{
|
||||
Date date;
|
||||
char fname[13];
|
||||
char username[36];
|
||||
char from[36];
|
||||
};
|
||||
|
||||
|
||||
struct modem_response
|
||||
{
|
||||
long baud;
|
||||
int port;
|
||||
};
|
||||
|
||||
struct protocol
|
||||
{
|
||||
char name[50]; // Name of protocol
|
||||
char key; // Hotkey for Protocol
|
||||
char flags; // Protocol behavior
|
||||
char logfile[60]; // Logfile from protocol
|
||||
char ctlfile[60]; // Control file (redirection file)
|
||||
char dlcom[126]; // Download command line
|
||||
unsigned efficiency; // Throughput efficiency
|
||||
char ulcom[128]; // Upload command line
|
||||
char dlstring[80]; // String to place in download control file
|
||||
char ulstring[80]; // String to place in upload control file
|
||||
char dlkeyword[40]; // Download keyword to search for in logfile
|
||||
char ulkeyword[40]; // Upload keyword to search for in logfile
|
||||
int wordnr; // File name word nr after keyword (1-..)
|
||||
|
||||
bool read(int n);
|
||||
};
|
||||
|
||||
#define PROT_BATCH 1
|
||||
#define PROT_ENABLED 2
|
||||
#define PROT_BOTH 4
|
||||
#define PROT_BIM 8
|
||||
#define PROT_LOCAL 16
|
||||
|
||||
extern byte current_color;
|
||||
|
||||
extern bool chatflag;
|
||||
extern bool noyell_flag;
|
||||
extern int num_yells;
|
||||
|
||||
extern bool stopped;
|
||||
|
||||
extern char user_firstname[];
|
||||
extern char mypath[];
|
||||
extern char syspath[];
|
||||
extern char curmenu[];
|
||||
extern char page_reason[];
|
||||
|
||||
extern bool menuchanged;
|
||||
extern bool updatemenu;
|
||||
|
||||
extern long totalcalls;
|
||||
extern bool password_ok;
|
||||
extern int num_users;
|
||||
extern int time_limit;
|
||||
extern int event_due;
|
||||
extern int time_removed;
|
||||
extern int download_limit;
|
||||
extern int download_delay;
|
||||
extern word free_download;
|
||||
extern word upload_needed;
|
||||
extern int node_number;
|
||||
extern bool desqview;
|
||||
extern int num_limits;
|
||||
extern int returnvalue;
|
||||
extern bool quiet;
|
||||
extern bool net_entered,echo_entered;
|
||||
extern bool registered;
|
||||
extern word max_node_count;
|
||||
extern int display_mode;
|
||||
extern bool ega_43;
|
||||
extern bool use_ems;
|
||||
extern byte org_videomode;
|
||||
extern word org_numlines;
|
||||
extern bool ignore_carrier;
|
||||
extern bool reliable;
|
||||
extern bool fatal;
|
||||
extern bool no_hangup;
|
||||
extern word min_level;
|
||||
extern bool rip_detected;
|
||||
extern bool sysop_next;
|
||||
extern int rip_screenlines;
|
||||
extern int pastFirstUse;
|
||||
extern bool newFilesChecked;
|
||||
|
||||
extern User user;
|
||||
extern int user_recnr;
|
||||
extern Config far cfg;
|
||||
extern limits limit[];
|
||||
extern command_stack comstack;
|
||||
extern KeyData regis;
|
||||
extern fossilio io;
|
||||
extern event nextevent;
|
||||
|
||||
extern LanguageFile pb_curlang;
|
||||
extern LanguageString *pb_lang;
|
||||
extern int pb_num_lang;
|
||||
|
||||
extern BinLog lastcaller;
|
||||
|
||||
#ifdef Use_TagList
|
||||
extern LinkedList<FilesIdx> taglist;
|
||||
#endif
|
||||
|
||||
struct PEXhandle
|
||||
{
|
||||
void *func;
|
||||
unsigned ds;
|
||||
};
|
||||
|
||||
//extern PEXhandle pex_handlers[];
|
||||
|
||||
extern "C" int CallPEX(PEXhandle * ...);
|
||||
//extern "C" void add_fhandles();
|
||||
|
||||
#ifdef Use_Handlers
|
||||
extern LinkedList<PEXhandle> sysopkey_handlers;
|
||||
extern LinkedList<PEXhandle> hangup_handlers;
|
||||
#endif
|
||||
|
||||
/*
|
||||
#define PEX_IO_INIT (&pex_handlers[0])
|
||||
#define PEX_IO_STATUS (&pex_handlers[1])
|
||||
#define PEX_IO_HANGUP (&pex_handlers[2])
|
||||
#define PEX_IO_READBYTE (&pex_handlers[3])
|
||||
#define PEX_IO_SENDBYTE (&pex_handlers[4])
|
||||
#define PEX_IO_SENDBLOCK (&pex_handlers[5])
|
||||
#define PEX_SYSOPKEY (&pex_handlers[6])
|
||||
#define PEX_HANGUP (&pex_handlers[7])
|
||||
*/
|
||||
|
||||
/*
|
||||
extern
|
||||
File f_users,
|
||||
f_usersxi,
|
||||
f_usersidx,
|
||||
f_userspb;
|
||||
*/
|
||||
|
||||
extern char *noregmsg;
|
||||
|
||||
extern Date login_date;
|
||||
extern Time login_time;
|
||||
|
||||
void chat();
|
||||
void LOG(char * ...);
|
||||
void LOG(int level, char * ...);
|
||||
void fatalerror(char *s);
|
||||
void file_error(int fn , int errno = 0); // <0 -> Return, >0 -> Exit
|
||||
void file_error (char *fn , int errno = 0);
|
||||
void file_warning(char *fn , int errno = 0);
|
||||
int login();
|
||||
void menu_processor();
|
||||
|
||||
void shell (char * = NULL), combined_clear (char * = NULL),
|
||||
showansasc (char * = NULL), clearmarked (char * = NULL),
|
||||
pagesysop (char * = NULL), qscan_msg (char * = NULL),
|
||||
writemsg (char * = NULL), scan_msg (char * = NULL),
|
||||
readmsg (char * = NULL), usage_graph (char * ),
|
||||
city_change (char * = NULL), days_graph (char * ),
|
||||
change_state (char * = NULL), weeks_graph (char * ),
|
||||
password_change (char * = NULL), version_info (char * = NULL),
|
||||
lines_change (char * = NULL), raw_dir (char * = NULL),
|
||||
ansi_toggle (char * = NULL), list_files (char * = NULL),
|
||||
cls_toggle (char * = NULL), new_files (char * = NULL),
|
||||
pause_toggle (char * = NULL), keyword_search (char * = NULL),
|
||||
set_filearea (char * = NULL), filename_search (char * = NULL),
|
||||
fsed_toggle (char * = NULL), download (char * = NULL),
|
||||
hotkey_toggle (char * = NULL), upload (char * = NULL),
|
||||
user_list (char * = NULL), view_named_file (char * = NULL),
|
||||
questionnaire (char * = NULL), view_file (char * = NULL),
|
||||
mailcheck (char * = NULL), view_file_wait (char * = NULL),
|
||||
list_archive (char * = NULL), lastcallers (char * = NULL),
|
||||
time_stat (char * = NULL), logentry (char * = NULL),
|
||||
combined_select (char * = NULL), logoff (char * = NULL),
|
||||
change_access (char * = NULL), view_gif (char * = NULL),
|
||||
tops (char * = NULL), ibm_toggle (char * = NULL),
|
||||
show_users_online (char * = NULL), phone_change (char * = NULL),
|
||||
multichat (char * = NULL), dataphone_change (char * = NULL),
|
||||
set_msgarea (char * = NULL), handle_change (char * = NULL),
|
||||
view_ans_wait (char * = NULL), usereditor (char * = NULL),
|
||||
bulletin (char * = NULL), toggle_avatar (char * = NULL),
|
||||
toggle_avtplus (char * = NULL), show_graph (char * ),
|
||||
ripfont_change (char * = NULL), select_language (char * = NULL),
|
||||
rip_toggle (char * = NULL), edit_taglist (char * = NULL),
|
||||
change_dateformat (char * = NULL), change_faxphone (char * = NULL),
|
||||
change_address (char * = NULL), change_country (char * = NULL),
|
||||
change_default_protocol(char * = NULL),
|
||||
select_msggroup (char * = NULL), select_filegroup (char * = NULL);
|
||||
|
||||
int run_sdkfile (char * = NULL);
|
||||
char showansascrip (char *);
|
||||
extern void (*menufunctions[])(char *);
|
||||
|
||||
void parse_date(Date& d,char *s,int format);
|
||||
void multilinechat(int);
|
||||
char *strstrl(char *,char *);
|
||||
int check_access(unsigned,AccessFlags); // 0 -> Denied
|
||||
int check_access(unsigned,AccessFlags,AccessFlags); // 0 -> Denied
|
||||
int linecounter(int = -1);
|
||||
void sysopkey(word);
|
||||
void replymsg(Message&);
|
||||
int matchstring(char *s,char *d); // 1->ok, 0->not ok
|
||||
int matchstring(char *s,char *d,int l); // 1->ok, 0->not ok
|
||||
int matchfile(char *search,char *file);
|
||||
char *findmatch(char *,char *);
|
||||
void strip_path(char *);
|
||||
void strip_fname(char *);
|
||||
void msged();
|
||||
char showansasc(char *file,char *hotkeys);
|
||||
bool show_rip( char *file , bool reset = FALSE);
|
||||
|
||||
void rip_send( char *s);
|
||||
void rip_query( char *cmd);
|
||||
void rip_reset();
|
||||
void rip_textmode();
|
||||
void rip_nomore();
|
||||
void rip_kill_mouse_fields();
|
||||
void rip_bar(int,int,int,int);
|
||||
void rip_color(int);
|
||||
void rip_fill_color(int,int);
|
||||
void rip_send_icons();
|
||||
void rip_button(int x1,int y1,int x2,int y2,int hotkey,bool def,char *icon,char *text,char *hostcmd);
|
||||
void rip_start_dialog(char *prompt,int max);
|
||||
void rip_end_dialog();
|
||||
void rip_start_yesno_dialog( char *prompt , bool);
|
||||
void rip_clear_status();
|
||||
void rip_show_more();
|
||||
void rip_show_more_tag();
|
||||
void rip_show_enter();
|
||||
|
||||
#define rip_save_textwindow() rip_query("$STW$")
|
||||
#define rip_restore_textwindow() rip_query("$RTW$")
|
||||
#define rip_save_mouse_fields() rip_query("$SMF$")
|
||||
#define rip_restore_mouse_fields() rip_query("$RMF$")
|
||||
#define rip_paste_clipboard() rip_query("$PCB$")
|
||||
#define rip_doorway_on() rip_query("$DWAYON$")
|
||||
#define rip_doorway_off() rip_query("$DWAYOFF$")
|
||||
#define rip_cursor_on() rip_query("$CON$")
|
||||
#define rip_cursor_off() rip_query("$COFF$")
|
||||
|
||||
String meganum(word);
|
||||
|
||||
void readconfig();
|
||||
int parse_data(char *s,String *param); // ret=number of params
|
||||
void create_arealist(String param[],int numpara,BitArray& arealist,bool msgareas = FALSE);
|
||||
void adjust_limits();
|
||||
void deltrailspaces(char *);
|
||||
int wordwrap(char *,String&,int max);
|
||||
char playsong(char *name,char *keys,int length);
|
||||
void toggle_userinfo();
|
||||
void toggle_help();
|
||||
void toggle_macrohelp();
|
||||
void edit_user();
|
||||
void screen_image();
|
||||
void update_user_window();
|
||||
void update_display();
|
||||
long post_message(char *from,char *to,char *subj,int area,int pvt);
|
||||
long post_netmail_message(char *from,char *to,char *subj,int area,int zone,int net,int node,int point,bool crash,bool attach,bool kill);
|
||||
void write_msgtmp(char *s);
|
||||
void edit_message();
|
||||
void write_msginf( char *from , char *to , char *subj , long num , char *area , char *pvt);
|
||||
String replace_stringvars(char *s);
|
||||
void show_intro();
|
||||
void check_exe(char *);
|
||||
int fuzzy_search(char *,char *,int);
|
||||
int intimewindow(Time t1,Time t2);
|
||||
char *dos_error_message(int errno);
|
||||
bool select_protocol(protocol& p , char protocol_key = '\0' , bool seldef = FALSE);
|
||||
String fullcolor_string(byte color);
|
||||
void remove_tag(char *name , int area);
|
||||
bool is_tagged(char *name , int area);
|
||||
void write_taglist();
|
||||
void read_taglist();
|
||||
void InputDate( Date &d,
|
||||
byte iDateFormat );
|
||||
|
||||
void rip_text_window( int x0, int y0 , int x1 , int y1 , int font );
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void set43();
|
||||
void set25();
|
||||
void setvideomode(unsigned);
|
||||
unsigned getvideomode();
|
||||
}
|
||||
|
||||
void exit_proboard(int level = 0);
|
||||
|
||||
extern char *months_short[];
|
||||
extern char *months_full [];
|
||||
extern char *days_short [];
|
||||
extern char *days_full [];
|
||||
extern char *date_formats[];
|
||||
extern char *date_formats_long[];
|
||||
|
||||
extern usertimer timer;
|
||||
|
||||
extern FileName FN_BINLOG_PB,
|
||||
FN_TIMELOG_PRO,
|
||||
FN_ONLINE_PRO,
|
||||
FN_MSGAREAS_PRO,
|
||||
FN_PVTFILES_PB;
|
||||
|
||||
const int ERR_BINLOG_PB = 6;
|
||||
const int ERR_TIMELOG_PRO = 7;
|
||||
const int ERR_ONLINE_PRO = 9;
|
||||
const int ERR_AKA_PRO = 10;
|
||||
const int ERR_USERS_BBS = 11;
|
||||
const int ERR_USERSXI_BBS = 12;
|
||||
const int ERR_USERSIDX_BBS = 13;
|
||||
const int ERR_USERSPB_BBS = 14;
|
||||
const int ERR_LASTREAD_BBS = 15;
|
||||
|
||||
extern char *EMPTY_STRING;
|
||||
|
||||
#define COLOR_RED 1
|
||||
#define COLOR_GREEN 2
|
||||
#define COLOR_YELLOW 3
|
||||
#define COLOR_BLUE 4
|
||||
#define COLOR_MAGENTA 5
|
||||
#define COLOR_CYAN 6
|
||||
#define COLOR_WHITE 7
|
||||
#define COLOR_BLINK 0x80
|
||||
|
||||
#define ERRLVL_FATALERR 1
|
||||
|
||||
#define READMSG_ALL 1
|
||||
#define READMSG_FWD 1
|
||||
#define READMSG_REV 2
|
||||
#define READMSG_SEL 3
|
||||
#define READMSG_SEARCH 4
|
||||
#define READMSG_NEW 5
|
||||
#define READMSG_INDIV 6
|
||||
#define READMSG_MARKED 7
|
||||
|
||||
#define ANS_OK 0 // showansasc retval if ok
|
||||
#define ANS_STOP 1 // showansasc retval if file stopped
|
||||
#define ANS_NOFILE 2 // showansasc retval if no file
|
||||
|
||||
#define ansi_mode (user.uFlags & UFLAG_ANSI)
|
||||
#define cls_mode (user.uFlags & UFLAG_CLEAR)
|
||||
#define pause_mode (user.uFlags & UFLAG_PAUSE)
|
||||
#define fsed_mode (user.uFlags & UFLAG_FSED)
|
||||
#define rip_mode (rip_detected && !(user.uFlags & UFLAG_NORIP))
|
||||
#define stack_mode (!(user.uFlags & UFLAG_HOTKEYS))
|
||||
#define no_ibm (user.uFlags & UFLAG_NOIBM)
|
||||
#define avatar (user.uFlags & UFLAG_AVATAR)
|
||||
#define avtplus (user.uFlags & UFLAG_AVTPLUS)
|
||||
|
||||
struct DownloadFile
|
||||
{
|
||||
int area;
|
||||
long size;
|
||||
bool free;
|
||||
bool copy;
|
||||
String name;
|
||||
};
|
||||
|
||||
#include "prompts.hpp"
|
||||
|
||||
bool ReadLanguage( char *langname );
|
||||
|
||||
char wait_language_hotkeys(char *hk, bool enter = TRUE);
|
||||
int language_string_length( char *str );
|
||||
|
||||
|
||||
|
||||
#include "reg.hpp"
|
||||
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,222 @@
|
|||
|
||||
/* ------------------------------------------------------------
|
||||
* Filename ............... ProCfg.Hpp
|
||||
*
|
||||
* General Purpose ........ main include file
|
||||
* ------------------------------------------------------------
|
||||
* First date ............. long time ago ;-)
|
||||
*
|
||||
* First in version ....... 0.00 alpha 1 ?
|
||||
*
|
||||
* Written by ............. P. Leybaert & A. Schellinck
|
||||
* ------------------------------------------------------------
|
||||
* Revisions:
|
||||
* ----------
|
||||
*
|
||||
* Date | By | Purpose |
|
||||
* ---------+----+--------------------------------------------+
|
||||
* 08/05/99 | JR | Updated to v2.2 |
|
||||
* | | |
|
||||
* | | |
|
||||
*/
|
||||
|
||||
|
||||
/*--] Include files [------------------------------------------------------*/
|
||||
|
||||
#include <tslib.hpp>
|
||||
#include <tswin.hpp>
|
||||
#include <pb_lib.hpp>
|
||||
|
||||
/*--] Defines [------------------------------------------------------------*/
|
||||
|
||||
//----------------------------------
|
||||
// Color of status bar at the bottom
|
||||
//----------------------------------
|
||||
|
||||
#define BAR_COLOR 0x4E // Generic color
|
||||
#define BAR_HIGH 0x4E // Status bar highlight color
|
||||
#define BAR_NORM 0x4F // Status bar normal color
|
||||
|
||||
|
||||
#define PROT_BATCH 1
|
||||
#define PROT_ENABLED 2
|
||||
#define PROT_BOTH 4
|
||||
#define PROT_BIM 8
|
||||
#define PROT_LOCAL 16
|
||||
|
||||
#define MAX_AKA 50
|
||||
#define MAX_FILEAREA 10000
|
||||
#define MAX_MSGAREA 10000
|
||||
#define MAX_PVTFILE 100
|
||||
#define MAX_LIMITS 50
|
||||
#define MAX_PROTOCOL 20
|
||||
#define MAX_EVENT 30
|
||||
|
||||
/*--] version control [----------------------------------------------------*/
|
||||
|
||||
#define VERSION "2.22"
|
||||
|
||||
/*--] Structure definitions [----------------------------------------------*/
|
||||
|
||||
struct filearea : _FileArea {};
|
||||
struct Config : _Config {};
|
||||
struct pbconfig : _ModemConfig {};
|
||||
|
||||
/*--] Structures [-------------------------------] aka [-------------------*/
|
||||
|
||||
struct aka
|
||||
{
|
||||
int zone;
|
||||
int net;
|
||||
int node;
|
||||
int point;
|
||||
};
|
||||
|
||||
/*--] Structures [-------------------------------] protocol [--------------*/
|
||||
|
||||
struct protocol
|
||||
{
|
||||
char name[50]; // Name of protocol
|
||||
char key; // Hotkey for Protocol
|
||||
char flags; // Protocol behavior
|
||||
char logfile[60]; // Logfile from protocol
|
||||
char ctlfile[60]; // Control file (redirection file)
|
||||
char dlcom[126]; // Download command line
|
||||
unsigned eff;
|
||||
char ulcom[128]; // Upload command line
|
||||
char dlstring[80]; // String to place in download control file
|
||||
char ulstring[80]; // String to place in upload control file
|
||||
char dlkeyword[40]; // Download keyword to search for in logfile
|
||||
char ulkeyword[40]; // Upload keyword to search for in logfile
|
||||
int wordnr; // File name word nr after keyword (1-..)
|
||||
};
|
||||
|
||||
/*--] Structures [-------------------------------] limits [----------------*/
|
||||
|
||||
struct limits
|
||||
{
|
||||
unsigned level;
|
||||
int timelimit;
|
||||
int daily_klimit;
|
||||
int pre_download;
|
||||
char id[6];
|
||||
unsigned free; // Free upload in Kb.
|
||||
unsigned char factor; // Percentage upload required
|
||||
unsigned max_download; // Max download for this level
|
||||
int fallto; // Fall to level x when max. reached
|
||||
int msgfactor; // # Kbytes granted per message written
|
||||
byte extra[5];
|
||||
};
|
||||
|
||||
/*--] Structures [-------------------------------] topentry [--------------*/
|
||||
|
||||
struct topentry
|
||||
{
|
||||
char name[36];
|
||||
unsigned n;
|
||||
};
|
||||
|
||||
|
||||
/*--] Structures [-------------------------------] event [-----------------*/
|
||||
|
||||
struct event
|
||||
{
|
||||
int type; // Errorlevel or DOS command
|
||||
int errorlevel; // Errorlevel to use (>5)
|
||||
char command[80]; // DOS Command to execute
|
||||
Time start; // Start time for event
|
||||
int duration; // Duration (min)
|
||||
byte empty;
|
||||
byte days; // Bits 0-6 -> days of the week
|
||||
byte node; // Node number to execute the event on
|
||||
byte enabled; // Enabled?
|
||||
};
|
||||
|
||||
/*--] Structures [-------------------------------] pvt_files [-------------*/
|
||||
|
||||
struct pvt_file
|
||||
{
|
||||
Date date;
|
||||
char fname[13];
|
||||
char username[36];
|
||||
char from[36];
|
||||
};
|
||||
|
||||
/*--] Structures [-------------------------------] User [------------------*/
|
||||
|
||||
struct User : _User
|
||||
{
|
||||
};
|
||||
|
||||
/*--] Prototypes [---------------------------------------------------------*/
|
||||
|
||||
int ask_save ( );
|
||||
int ask_confirm ( char *title );
|
||||
KEY aka_select ( int, Window&, int, int ,char, void* );
|
||||
void aka_select_func ( int i,int x,int y );
|
||||
void append_backspace ( char * );
|
||||
|
||||
void editPvtFile ( );
|
||||
void editSysParam ( );
|
||||
void editTemplate ( char *sysPath );
|
||||
void editUser ( char *syspath, int, char *[] );
|
||||
|
||||
void edit_akas ( );
|
||||
KEY edit_color ( int, Window&, int, int ,char, void* );
|
||||
void edit_events ( );
|
||||
void edit_fgroups ( );
|
||||
void edit_mgroups ( );
|
||||
void edit_language ( char * );
|
||||
void edit_limits ( );
|
||||
void edit_macros ( );
|
||||
void edit_menu ( char * );
|
||||
void edit_areas ( int fa );
|
||||
void edit_pb ( );
|
||||
void edit_protocol ( );
|
||||
void edit_stats ( );
|
||||
KEY edit_timeframe ( int, Window&, int, int ,char, void* );
|
||||
KEY edit_nodes ( int, Window& ,int ,int ,char, void* );
|
||||
void EditListColors ( );
|
||||
KEY flag_select ( int, Window&, int, int ,char, void* );
|
||||
KEY flagonoff_select ( int, Window&, int, int ,char, void* );
|
||||
void menu_editor ( int, char *[] );
|
||||
String select_language ( bool edit );
|
||||
void show_flags ( );
|
||||
void showAbout ( );
|
||||
|
||||
void ShowBusy(char *msg);
|
||||
void HideBusy();
|
||||
|
||||
|
||||
/*--] Global variables [---------------------------------------------------*/
|
||||
|
||||
extern protocol *p;
|
||||
extern Config far cfg;
|
||||
extern pbconfig far pbcfg;
|
||||
extern limits *limit;
|
||||
extern aka *akas;
|
||||
extern event *events;
|
||||
//extern pvt_file *pvtfiles;
|
||||
extern int num_proto;
|
||||
extern int num_msgareas;
|
||||
extern int num_limits;
|
||||
extern int num_aka;
|
||||
extern int num_events;
|
||||
//extern int num_pvtfiles;
|
||||
extern KEY select_hotkeys[];
|
||||
extern char *loglevels[];
|
||||
extern char *months_short[];
|
||||
extern char *days_short[];
|
||||
extern char *yesnoask[];
|
||||
extern char syspath[];
|
||||
|
||||
void KeyItem( Window &w,
|
||||
int x,
|
||||
int y,
|
||||
ATTR iKeyColor,
|
||||
char *pKey,
|
||||
ATTR iDescColor,
|
||||
char *pDesc );
|
||||
|
||||
/*---------------------------] END OF THE CODE [---------------------------*/
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,113 @@
|
|||
|
||||
Start Stop Length Name Class
|
||||
|
||||
00000H 04013H 04014H _TEXT CODE
|
||||
04014H 057B5H 017A2H EDITAREA_TEXT CODE
|
||||
057B6H 08366H 02BB1H EDITUSER_TEXT CODE
|
||||
08367H 08565H 001FFH TEMPLATE_TEXT CODE
|
||||
08566H 0AF22H 029BDH AREA_TEXT CODE
|
||||
0AF23H 0B246H 00324H MISC_TEXT CODE
|
||||
0B247H 0B354H 0010EH PB_BOARD_TEXT CODE
|
||||
0B355H 0B688H 00334H PB_FLAGS_TEXT CODE
|
||||
0B689H 0B7CFH 00147H PB_MISC_TEXT CODE
|
||||
0B7D0H 0BAF0H 00321H TH_RECIO_TEXT CODE
|
||||
0BAF1H 0C433H 00943H _OVRTEXT_ CODE
|
||||
0C434H 0CB0BH 006D8H PB_LIB_TEXT CODE
|
||||
0CB0CH 0D2ECH 007E1H LANG_TEXT CODE
|
||||
0D2EDH 0FBE3H 028F7H USER_TEXT CODE
|
||||
0FBE4H 1111AH 01537H DATE_TEXT CODE
|
||||
1111BH 11398H 0027EH DIRSCAN_TEXT CODE
|
||||
1139AH 113D1H 00038H FIND_TEXT CODE
|
||||
113D2H 1234FH 00F7EH DSTRING_TEXT CODE
|
||||
12350H 124F0H 001A1H BITARRAY_TEXT CODE
|
||||
124F1H 1256AH 0007AH SOUND_TEXT CODE
|
||||
1256BH 1263EH 000D4H CRC16_TEXT CODE
|
||||
1263FH 12783H 00145H CRC32_TEXT CODE
|
||||
12784H 12B8DH 0040AH FUZZY_TEXT CODE
|
||||
12B8EH 146A5H 01B18H FORM_TEXT CODE
|
||||
146A6H 147BFH 0011AH MSDOS_TEXT CODE
|
||||
147C0H 14CDEH 0051FH FNAME_TEXT CODE
|
||||
14CDFH 16010H 01332H FILE_TEXT CODE
|
||||
16011H 16696H 00686H DIRFUNC_TEXT CODE
|
||||
16697H 167F9H 00163H INIT_TEXT CODE
|
||||
167FAH 1694DH 00154H KEYBOARD_TEXT CODE
|
||||
1694EH 16F0FH 005C2H POPMENU_TEXT CODE
|
||||
16F10H 173B5H 004A6H RECTANG_TEXT CODE
|
||||
173B6H 17EC9H 00B14H SCAN_TEXT CODE
|
||||
17ECAH 18AEBH 00C22H SELECT_TEXT CODE
|
||||
18AECH 1A6C7H 01BDCH WINDOW_TEXT CODE
|
||||
1A6C8H 1AB78H 004B1H PWS_ASM_TEXT CODE
|
||||
1AB79H 1AC95H 0011DH RESTORE_TEXT CODE
|
||||
1AC96H 1AD43H 000AEH GAUGE_TEXT CODE
|
||||
1AD44H 1AF58H 00215H SAVEBUF_TEXT CODE
|
||||
1AF59H 1B115H 001BDH MSGBOX_TEXT CODE
|
||||
1B116H 1B3A4H 0028FH SELBOX_TEXT CODE
|
||||
1B3A5H 1B430H 0008CH TSW_ASM_TEXT CODE
|
||||
1B440H 1B440H 00000H _FARDATA FAR_DATA
|
||||
1B440H 1CBB5H 01776H PROCFG5_DATA FAR_DATA
|
||||
1CBC0H 1CEECH 0032DH EDITMENU5_DATA FAR_DATA
|
||||
1CEF0H 1CEFFH 00010H EDITPVT5_DATA FAR_DATA
|
||||
1CF00H 1D22CH 0032DH LANGUAGE5_DATA FAR_DATA
|
||||
1D230H 1D230H 00000H _FARBSS FAR_BSS
|
||||
1D230H 1D230H 00000H _OVERLAY_ OVRINFO
|
||||
1D230H 1D2C6H 00097H _OVRDATA_ OVRINFO
|
||||
1D2D0H 1D2EFH 00020H _STUB_ OVRINFO
|
||||
1D2F0H 1D2F0H 00000H _EXTSEG_ OVRINFO
|
||||
1D2F0H 1D2F0H 00000H _EMSSEG_ OVRINFO
|
||||
1D2F0H 1D2F0H 00000H _VDISKSEG_ OVRINFO
|
||||
1D2F0H 1D5B7H 002C8H _EXEINFO_ OVRINFO
|
||||
1D5C0H 1D5C0H 00000H _1STUB_ STUBSEG
|
||||
1D5C0H 1D616H 00057H PROCFG_TEXT STUBSEG
|
||||
1D620H 1D644H 00025H EDITAKA_TEXT STUBSEG
|
||||
1D650H 1D67EH 0002FH EDITLIM_TEXT STUBSEG
|
||||
1D680H 1D6A4H 00025H EDITMAC_TEXT STUBSEG
|
||||
1D6B0H 1D6FCH 0004DH EDITMENU_TEXT STUBSEG
|
||||
1D700H 1D729H 0002AH EDITPB_TEXT STUBSEG
|
||||
1D730H 1D759H 0002AH EDITPROT_TEXT STUBSEG
|
||||
1D760H 1D7BBH 0005CH EDITSYS_TEXT STUBSEG
|
||||
1D7C0H 1D7EEH 0002FH EVENTS_TEXT STUBSEG
|
||||
1D7F0H 1D8B9H 000CAH EDITPVT_TEXT STUBSEG
|
||||
1D8C0H 1D902H 00043H LANGUAGE_TEXT STUBSEG
|
||||
1D910H 1D948H 00039H SEL_LANG_TEXT STUBSEG
|
||||
1D950H 1D9A6H 00057H EXTSEL_TEXT STUBSEG
|
||||
1D9B0H 1D9D4H 00025H FLAGS_TEXT STUBSEG
|
||||
1D9E0H 1DA1DH 0003EH PROMISC_TEXT STUBSEG
|
||||
1DA20H 1DA53H 00034H EDITVTPL_TEXT STUBSEG
|
||||
1DA60H 1DAC5H 00066H EDITGRP_TEXT STUBSEG
|
||||
1DAD0H 1DAF4H 00025H EDITLCOL_TEXT STUBSEG
|
||||
1DB00H 1DB29H 0002AH EDITNODE_TEXT STUBSEG
|
||||
1DB30H 1DB5EH 0002FH MISC_TEXT STUBSEG
|
||||
1DB60H 29AF9H 0BF9AH _DATA DATA
|
||||
29AFAH 29AFBH 00002H _CVTSEG DATA
|
||||
29AFCH 29B01H 00006H _SCNSEG DATA
|
||||
29B02H 29B02H 00000H _CONST CONST
|
||||
29B02H 29B61H 00060H _INIT_ INITDATA
|
||||
29B62H 29B62H 00000H _INITEND_ INITDATA
|
||||
29B62H 29B8BH 0002AH _EXIT_ EXITDATA
|
||||
29B8CH 29B8CH 00000H _EXITEND_ EXITDATA
|
||||
29B8CH 2B6B5H 01B2AH _BSS BSS
|
||||
2B6B6H 2B6B6H 00000H _BSSEND BSSEND
|
||||
2B6C0H 2B73FH 00080H _STACK STACK
|
||||
2B750H 2DBEDH 0249EH PROCFG_TEXT :OVY
|
||||
2DF00H 2E1EAH 002EBH EDITAKA_TEXT :OVY
|
||||
2E220H 2E83AH 0061BH EDITLIM_TEXT :OVY
|
||||
2E890H 2E994H 00105H EDITMAC_TEXT :OVY
|
||||
2E9B0H 319FDH 0304EH EDITMENU_TEXT :OVY
|
||||
31C40H 324F0H 008B1H EDITPB_TEXT :OVY
|
||||
325C0H 32C71H 006B2H EDITPROT_TEXT :OVY
|
||||
32CB0H 344D7H 01828H EDITSYS_TEXT :OVY
|
||||
34740H 353AEH 00C6FH EVENTS_TEXT :OVY
|
||||
35430H 375F6H 021C7H EDITPVT_TEXT :OVY
|
||||
37820H 38E70H 01651H LANGUAGE_TEXT :OVY
|
||||
39010H 3967CH 0066DH SEL_LANG_TEXT :OVY
|
||||
39700H 3A3CDH 00CCEH EXTSEL_TEXT :OVY
|
||||
3A3F0H 3A6FAH 0030BH FLAGS_TEXT :OVY
|
||||
3A730H 3AF33H 00804H PROMISC_TEXT :OVY
|
||||
3AFB0H 3C037H 01088H EDITVTPL_TEXT :OVY
|
||||
3C150H 3CA92H 00943H EDITGRP_TEXT :OVY
|
||||
3CB30H 3D1F2H 006C3H EDITLCOL_TEXT :OVY
|
||||
3D2D0H 3D6D5H 00406H EDITNODE_TEXT :OVY
|
||||
3D730H 3D87EH 0014FH MISC_TEXT :OVY
|
||||
|
||||
Program entry point at 0000:0000
|
||||
|
Binary file not shown.
|
@ -0,0 +1,498 @@
|
|||
|
||||
/* ------------------------------------------------------------
|
||||
* Filename ............... ProMisc.Cpp
|
||||
*
|
||||
* General Purpose ........ some miscellaneous functions
|
||||
* ------------------------------------------------------------
|
||||
* First date ............. 15 dec 1993
|
||||
*
|
||||
* First in version ....... 2.00
|
||||
*
|
||||
* Written by ............. Alain Schellinck
|
||||
* ------------------------------------------------------------
|
||||
* Revisions:
|
||||
* ----------
|
||||
*
|
||||
* Date | By | Purpose |
|
||||
* ---------+----+--------------------------------------------+
|
||||
* | | |
|
||||
* | | |
|
||||
* | | |
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ThProCfg.Hpp"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Routine : enterPwd
|
||||
* Purpose : let the user enter a password
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: None
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
KEY
|
||||
enterPwd(IntT mode, Window& w, IntT x, IntT y, ChrT attr, AnyP data)
|
||||
{
|
||||
User *user = (User *) data;
|
||||
tsw_cursoroff();
|
||||
|
||||
if(mode == TRUE)
|
||||
{
|
||||
Window w(10, 5, 40, 7, setFBColor(hWhite, nMagenta));
|
||||
w.open();
|
||||
w << " Password: ";
|
||||
|
||||
w.attrib(setFBColor(hYellow, nMagenta));
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
ChrT buffer[16];
|
||||
|
||||
if(user->passWord[0] == '\0')
|
||||
{
|
||||
buffer[0] = '\0';
|
||||
|
||||
w.scan(buffer, 15, 16);
|
||||
|
||||
if(buffer[0])
|
||||
{
|
||||
strcpy(user->passWord , buffer);
|
||||
|
||||
user->passWordCRC = RaCrc(user->passWord);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(buffer, user->passWord);
|
||||
|
||||
w.scan(buffer, 15, 16);
|
||||
tsw_cursoroff();
|
||||
|
||||
strcpy(user->passWord, buffer);
|
||||
|
||||
user->passWordCRC = RaCrc(user->passWord);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(user->passWord[0] == '\0')
|
||||
{
|
||||
w.direct(x,y,attr,String(cfg.pwdchar,16));
|
||||
}
|
||||
else
|
||||
{
|
||||
String str(user->passWord);
|
||||
|
||||
if(cfg.hidePassword == TRUE)
|
||||
str = String(cfg.pwdchar, strlen(user->passWord));
|
||||
|
||||
str.justify(String::left, 16);
|
||||
w.direct(x, y, attr, str);
|
||||
}
|
||||
}
|
||||
|
||||
tsw_cursoron();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : askYesNo()
|
||||
* Purpose : ask YES or NO
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: Title
|
||||
* Return : -1 = ESC, TRUE = YES, FALSE = NO
|
||||
*
|
||||
*/
|
||||
|
||||
ShrtT askYesNo(ChrP title)
|
||||
{
|
||||
ShrtT ret_val = -1;
|
||||
|
||||
Window w(16, 9, 65, 16, setFBColor(hWhite, nBlack), SHADOW|CENTERED_X);
|
||||
w.open();
|
||||
|
||||
w.centerLine(2, title, setFBColor(hYellow, nBlack));
|
||||
|
||||
menu_item yesNoMenu[]=
|
||||
{
|
||||
{ 'Y', 18,18, " YES " },
|
||||
{ 'N', 17,17, " NO " },
|
||||
{ 0 , 0,0, NULL }
|
||||
};
|
||||
|
||||
PopMenu menu(yesNoMenu, setFBColor(nBlack, nWhite), setFBColor(hWhite, nBlack));
|
||||
menu.open(18, 13, 63, 14, setFBColor(nWhite, nBlack), NOBORDER|CENTERED_X);
|
||||
|
||||
tsw_cursoroff();
|
||||
ShrtT choice = menu.process();
|
||||
|
||||
if(choice > 0)
|
||||
ret_val = 2 - choice;
|
||||
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// Calculate the raw string width of a help line, without color codes
|
||||
//
|
||||
// Prototype: int CalcHelpWidth( char *pData );
|
||||
//
|
||||
// Parameters: pData ... Help data to calculate the length of
|
||||
//
|
||||
// Returns: The length, without any color codes
|
||||
//
|
||||
// Remarks:
|
||||
//
|
||||
// This routine takes a help line, and calculates how long it is without any
|
||||
// color codes. A color code is a three byte sequence starting with 0x01,
|
||||
// then two hex-encoded digits (i.e., "71" would indicate blue on a gray
|
||||
// background.)
|
||||
//
|
||||
// -------------------------------------------------------------------------
|
||||
//
|
||||
// Created on: 08/06/99 (Jeff Reeder)
|
||||
// Last modified: 08/06/99 (Jeff Reeder) Created
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
int CalcHelpWidth( char *pData )
|
||||
{
|
||||
int cLength = 0;
|
||||
|
||||
|
||||
while ( pData &&
|
||||
*pData )
|
||||
{
|
||||
if ( *pData == 0x01 )
|
||||
{
|
||||
pData++;
|
||||
|
||||
|
||||
if ( *pData &&
|
||||
isxdigit( *pData ) )
|
||||
{
|
||||
pData++;
|
||||
|
||||
|
||||
if ( *pData &&
|
||||
isxdigit( *pData ) )
|
||||
{
|
||||
pData++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cLength++;
|
||||
pData++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return cLength;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// Converts a single hex character to a numerical value from 0-15
|
||||
//
|
||||
// Prototype: int HexCharToInt( char iChar );
|
||||
//
|
||||
// Parameters: iChar ... Hex value to convert
|
||||
//
|
||||
// Returns: A value from 0 through 15.
|
||||
//
|
||||
// Remarks:
|
||||
//
|
||||
// If the character value is not a valid hex digit, then a value of 0 is
|
||||
// returned.
|
||||
//
|
||||
// -------------------------------------------------------------------------
|
||||
//
|
||||
// Created on: 08/06/99 (Jeff Reeder)
|
||||
// Last modified: 08/06/99 (Jeff Reeder) Created
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
int HexCharToInt( char iChar )
|
||||
{
|
||||
if ( isxdigit( iChar ) )
|
||||
{
|
||||
if ( iChar >= '0' &&
|
||||
iChar <= '9' )
|
||||
{
|
||||
return iChar - '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
return toupper( iChar ) - 'A' + 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//------------------
|
||||
// Invalid hex digit
|
||||
//------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Prototype: void helpShowLine( Window &w, int iLine, char *pText );
|
||||
//
|
||||
// Parameters: w ... Window to show line of help text in
|
||||
// iLine ... Line number in window to receive the text
|
||||
// iDefAttr ... Default color attribute
|
||||
// pText ... Text to show
|
||||
//
|
||||
// Returns: Nothing
|
||||
//
|
||||
// Remarks:
|
||||
//
|
||||
// This routine displays a single line of text to the help window. It
|
||||
// properly handles all color codes, and displays data appropriately.
|
||||
//
|
||||
// If the help line doesn't contain any color codes, then it is displayed in
|
||||
// the default color attribute <iDefAttr>.
|
||||
//
|
||||
// -------------------------------------------------------------------------
|
||||
//
|
||||
// Created on: 08/06/99 (Jeff Reeder)
|
||||
// Last modified: 08/06/99 (Jeff Reeder) Created
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
static
|
||||
void helpShowLine( Window &w,
|
||||
int iLine,
|
||||
ATTR iDefAttr,
|
||||
char *pText )
|
||||
{
|
||||
int iPos = 0;
|
||||
int cLength = strlen( pText );
|
||||
ATTR iCurAttr = iDefAttr;
|
||||
|
||||
|
||||
for ( int i = 0; i < cLength; i++ )
|
||||
{
|
||||
if ( pText[ i ] == 0x01 )
|
||||
{
|
||||
//------------------------
|
||||
// Looks like a color code
|
||||
//------------------------
|
||||
|
||||
if ( isxdigit( pText[ i + 1 ] ) &&
|
||||
isxdigit( pText[ i + 2 ] ) )
|
||||
{
|
||||
//----------------------------
|
||||
// We have a valid color code!
|
||||
//----------------------------
|
||||
|
||||
int iBack;
|
||||
int iFore;
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the foreground and background colors
|
||||
//-----------------------------------------
|
||||
|
||||
iBack = HexCharToInt( pText[ i + 1 ] );
|
||||
iFore = HexCharToInt( pText[ i + 2 ] );
|
||||
|
||||
|
||||
iCurAttr = ( ( iBack & 0x0F ) << 4 ) |
|
||||
( iFore & 0x0F );
|
||||
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tsw_maputc( w.minX + iPos,
|
||||
w.minY + iLine - 1,
|
||||
iCurAttr,
|
||||
pText[ i ] );
|
||||
|
||||
iPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// Display a help message
|
||||
//
|
||||
// Prototype: void showHelp( ChrP hlp[], char *pTitle, FlgT center );
|
||||
//
|
||||
// Parameters: hlp ... An array of help lines to display
|
||||
// pTitle ... Help window title
|
||||
// center ... TRUE to center each line, FALSE otherwise
|
||||
//
|
||||
// Returns: Nothing
|
||||
//
|
||||
// Remarks:
|
||||
//
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------------------
|
||||
//
|
||||
// Created on: ??/??/???? (Philippe Leybaert)
|
||||
// Last modified: 08/06/1999 (Jeff Reeder) Modified to support custom
|
||||
// color codes in individual lines in the message
|
||||
//
|
||||
//**************************************************************************
|
||||
|
||||
void showHelp( ChrP hlp[],
|
||||
char *pTitle,
|
||||
FlgT center )
|
||||
{
|
||||
int bHasCodes = 0;
|
||||
|
||||
|
||||
tsw_cursoroff();
|
||||
|
||||
|
||||
ShrtT lines = 0;
|
||||
ShrtT width = 0;
|
||||
|
||||
|
||||
while ( hlp[ lines ] != NULL )
|
||||
{
|
||||
if ( strchr( hlp[ lines ], 0x01 ) )
|
||||
{
|
||||
bHasCodes = 1;
|
||||
}
|
||||
|
||||
|
||||
width = max( width,
|
||||
CalcHelpWidth( hlp[ lines ] ) + ( center * 4 ) );
|
||||
|
||||
lines++;
|
||||
}
|
||||
|
||||
|
||||
ShrtT hFree = tsw_hsize - ( width + 3 );
|
||||
ShrtT vFree = tsw_vsize - ( lines + 1 );
|
||||
ShrtT ux = hFree / 2;
|
||||
ShrtT uy = vFree / 2;
|
||||
|
||||
|
||||
Window w( ux,
|
||||
uy,
|
||||
ux + width + 3,
|
||||
uy + lines + 1,
|
||||
0x5F,
|
||||
( pTitle && *pTitle )
|
||||
? ( SHADOW | BRACKETS )
|
||||
: SHADOW,
|
||||
CHISEL_BORDER,
|
||||
0x5D,
|
||||
NULL,
|
||||
0x50 );
|
||||
|
||||
|
||||
w.open();
|
||||
|
||||
|
||||
if ( pTitle &&
|
||||
*pTitle )
|
||||
{
|
||||
w.title( pTitle, 0x5F );
|
||||
}
|
||||
|
||||
|
||||
for ( ShrtT cnt = 0; cnt < lines; cnt++ )
|
||||
{
|
||||
if ( bHasCodes )
|
||||
{
|
||||
helpShowLine( w,
|
||||
cnt + 1,
|
||||
0x5F,
|
||||
hlp[ cnt ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
String txt( hlp[ cnt ] );
|
||||
|
||||
|
||||
if ( center == TRUE )
|
||||
{
|
||||
txt.justify( String::centered, width );
|
||||
txt.rtrim();
|
||||
}
|
||||
|
||||
|
||||
w << ChrP( txt );
|
||||
|
||||
|
||||
if (
|
||||
( cnt + 1 != lines ) &&
|
||||
( txt.len() < width )
|
||||
)
|
||||
{
|
||||
w << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tsw_showfooter( "Press any key to continue.", BAR_NORM );
|
||||
|
||||
|
||||
KB.get();
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : showAbout()
|
||||
* Purpose : show the about screen
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: None
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
void showAbout()
|
||||
{
|
||||
LCL ChrP aboutText[] =
|
||||
{
|
||||
" ",
|
||||
" 5EProBoard v" VERSION " Configuration Utility",
|
||||
" ",
|
||||
" Copyright (c) 2019 John Riley ",
|
||||
" All Rights Reserved ",
|
||||
" ",
|
||||
" Developed by the ProBoard Development Ninja Team ",
|
||||
" ",
|
||||
" 5DPortions written by Alain Schellinck ",
|
||||
" ",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
showHelp( aboutText, "About ProBoard" );
|
||||
}
|
||||
|
||||
/*---------------------------] END OF THE CODE [---------------------------*/
|
Binary file not shown.
|
@ -0,0 +1,132 @@
|
|||
#include <string.h>
|
||||
#include "procfg.hpp"
|
||||
|
||||
static String fn_languages [100];
|
||||
static String desc_languages [100];
|
||||
|
||||
static int num_languages;
|
||||
static int show_def;
|
||||
|
||||
void
|
||||
list_func(int i , int x , int y)
|
||||
{
|
||||
if(show_def && i==0)
|
||||
{
|
||||
tsw_maputs( x, y , 0x5F , " ³ (default)");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(show_def)
|
||||
i--;
|
||||
|
||||
tsw_maputs( x,
|
||||
y ,
|
||||
0x5F ,
|
||||
form(" %-8s ³ %-38.38s",(char *)fn_languages[i],(char *)desc_languages[i]));
|
||||
}
|
||||
|
||||
tsw_maputc(x+10,y,0x5D,'³');
|
||||
}
|
||||
|
||||
void
|
||||
line_clear(int x,int y)
|
||||
{
|
||||
tsw_maputc(x+10,y,0x5D,'³');
|
||||
}
|
||||
|
||||
String
|
||||
select_language( bool edit )
|
||||
{
|
||||
SelectWindow sw;
|
||||
|
||||
sw.open( 3,
|
||||
3,
|
||||
56,
|
||||
tsw_vsize - 3,
|
||||
0x5E,
|
||||
SHADOW | BRACKETS,
|
||||
CHISEL_BORDER,
|
||||
0x5D,
|
||||
NULL,
|
||||
0x51 );
|
||||
|
||||
sw.title( edit
|
||||
? "Select language to edit"
|
||||
: "Select language for menus",
|
||||
0x5E );
|
||||
|
||||
DirScan scan(FileName(syspath,"*.PBL"));
|
||||
|
||||
for(num_languages=0;int(scan);scan++)
|
||||
{
|
||||
File f;
|
||||
|
||||
if(f.open(FileName(syspath,scan.name())))
|
||||
{
|
||||
LanguageFile *lf = new LanguageFile;
|
||||
|
||||
f.read(lf,sizeof(*lf));
|
||||
|
||||
FileName fn(scan.name());
|
||||
fn.stripExt();
|
||||
|
||||
fn_languages[num_languages] = fn;
|
||||
desc_languages[num_languages] = lf->name;
|
||||
|
||||
f.close();
|
||||
|
||||
if(fn != "_DEFAULT" && (lf->menuPath[0] || edit))
|
||||
num_languages++;
|
||||
|
||||
delete lf;
|
||||
}
|
||||
}
|
||||
|
||||
int i,j;
|
||||
|
||||
for(i=0;i<num_languages-1;i++)
|
||||
for(j=i+1;j<num_languages;j++)
|
||||
{
|
||||
if(stricmp(desc_languages[i],desc_languages[j]) > 0)
|
||||
{
|
||||
String tmp;
|
||||
|
||||
tmp = desc_languages[i];
|
||||
desc_languages[i] = desc_languages[j];
|
||||
desc_languages[j] = tmp;
|
||||
|
||||
tmp = fn_languages[i];
|
||||
fn_languages[i] = fn_languages[j];
|
||||
fn_languages[j] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if(num_languages == 0 && !edit)
|
||||
return "*";
|
||||
|
||||
KEY hotkeys[] = { 0 };
|
||||
|
||||
sw.define( num_languages + (edit ? 0:1),0x70,list_func,0,NULL,hotkeys,NULLFUNC,line_clear);
|
||||
|
||||
sw.direct(11,0,0x5D, 'Â');
|
||||
sw.direct(11 ,tsw_vsize-6,0x51, 'Á');
|
||||
|
||||
show_def = !edit;
|
||||
|
||||
CursorState _cursor(FALSE);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
i = sw.process();
|
||||
|
||||
if(i<0)
|
||||
break;
|
||||
|
||||
if(edit)
|
||||
edit_language(fn_languages[i]);
|
||||
else
|
||||
return (i ? (char *)fn_languages[i-1] : "*");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,131 @@
|
|||
|
||||
/* ------------------------------------------------------------
|
||||
* Filename ............... Template.Cpp
|
||||
*
|
||||
* General Purpose ........ Template IO functions
|
||||
* ------------------------------------------------------------
|
||||
* First date ............. 6 november 1993
|
||||
*
|
||||
* First in version ....... 2.00
|
||||
*
|
||||
* Written by ............. Alain Schellinck
|
||||
* ------------------------------------------------------------
|
||||
* Revisions:
|
||||
* ----------
|
||||
*
|
||||
* Date | By | Purpose |
|
||||
* ---------+----+--------------------------------------------+
|
||||
* | | |
|
||||
* | | |
|
||||
* | | |
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define Uses_MultiRecIO
|
||||
#include <ProBoard.Hpp>
|
||||
#include "Template.Hpp"
|
||||
|
||||
/*--] Code [-------------------------------------] TemplateIO class [------*/
|
||||
|
||||
/*
|
||||
* Routine : TemplateIO()
|
||||
* Purpose : The constructor
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: ProBoard pex path, filename
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
TemplateIO::TemplateIO(ChrP path, ChrP fn)
|
||||
{
|
||||
setFname(path, fn);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : readRec()
|
||||
* Purpose : read a record from the current file
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: None
|
||||
* Return : TRUE if OK, FALSE if NOT
|
||||
*
|
||||
*/
|
||||
|
||||
FlgT TemplateIO::readRec()
|
||||
{
|
||||
return(File::read(this, recLen()) == recLen());
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : writeRec()
|
||||
* Purpose : write a record to the current file
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: None
|
||||
* Return : TRUE if OK, FALSE if NOT
|
||||
*
|
||||
*/
|
||||
|
||||
FlgT TemplateIO::writeRec()
|
||||
{
|
||||
return(File::write(this, recLen()) == recLen());
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : recLen()
|
||||
* Purpose : return the record length
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: None
|
||||
* Return : record length
|
||||
*
|
||||
*/
|
||||
|
||||
ShrtT TemplateIO::recLen()
|
||||
{
|
||||
return(SIZ(template_data));
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : clear()
|
||||
* Purpose : clear the current record
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: None
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
void TemplateIO::clear()
|
||||
{
|
||||
memset(this, 0, recLen());
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : inUse()
|
||||
* Purpose : check if a record is in use
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: None
|
||||
* Return : TRUE if in use, FALSE if NOT
|
||||
*
|
||||
*/
|
||||
|
||||
FlgT TemplateIO::inUse()
|
||||
{
|
||||
return((strlen(desc) > 0) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine : copy()
|
||||
* Purpose : Copy the data from another object (of the same type !)
|
||||
* ------------------------------------------------------------------------
|
||||
* Parameters: pointer to the other object
|
||||
* Return : None
|
||||
*
|
||||
*/
|
||||
|
||||
void TemplateIO::copy(TemplateIOP orig)
|
||||
{
|
||||
memcpy(this, orig, recLen());
|
||||
}
|
||||
|
||||
/*---------------------------] END OF THE CODE [---------------------------*/
|
|
@ -0,0 +1,70 @@
|
|||
|
||||
/* ------------------------------------------------------------
|
||||
* Filename ............... Template.Hpp
|
||||
*
|
||||
* General Purpose ........ include file with template class
|
||||
* ------------------------------------------------------------
|
||||
* First date ............. 15 dec 1993
|
||||
*
|
||||
* First in version ....... 2.00
|
||||
*
|
||||
* Written by ............. Alain Schellinck
|
||||
* ------------------------------------------------------------
|
||||
* Revisions:
|
||||
* ----------
|
||||
*
|
||||
* Date | By | Purpose |
|
||||
* ---------+----+--------------------------------------------+
|
||||
* | | |
|
||||
* | | |
|
||||
* | | |
|
||||
*/
|
||||
|
||||
/*--] Classes [----------------------------------] TemplateIO [------------*/
|
||||
|
||||
const ShrtT maxTemplates = 256;
|
||||
|
||||
_StructType(template_data)
|
||||
struct template_data
|
||||
{
|
||||
ChrT desc [ 61]; // description
|
||||
ChrT comment [ 81]; // comment
|
||||
ChrT valMsg [ 9]; // message to send when validating
|
||||
WrdT secLevel; // security level
|
||||
WrdT subscribe; // subscribe period in days
|
||||
WrdT expLevel; // expiration level
|
||||
WrdT tbTime; // time to add on the timebank
|
||||
WrdT tbKbyte; // kbyte to add on the timebank
|
||||
WrdT netCredit; // netmail credit
|
||||
IntT logLevel; // his/her loglevel
|
||||
FlgT hidden; // some UFLAGS_xxx booleans
|
||||
FlgT noTops;
|
||||
FlgT atten;
|
||||
FlgT noKill;
|
||||
FlgT ignDld;
|
||||
FlgT deleted; // is this template deleted ?
|
||||
ChrT reserved [99]; // reserved for the future
|
||||
PbFlags valFlagsOn; // access flags to switch on (validated)
|
||||
PbFlags valFlagsOff; // access flags to switch off (validated)
|
||||
PbFlags expFlagsOn; // access flags to switch on (expired)
|
||||
PbFlags expFlagsOff; // access flags to switch off (expired)
|
||||
};
|
||||
|
||||
_ClassType(TemplateIO)
|
||||
class TemplateIO : public template_data, public MultiRecIO
|
||||
{
|
||||
public:
|
||||
TemplateIO ( ChrP path, ChrP fn = "Template.Pb" );
|
||||
|
||||
FlgT readRec ( );
|
||||
FlgT writeRec ( );
|
||||
ShrtT recLen ( );
|
||||
void clear ( );
|
||||
void copy ( TemplateIOP orig );
|
||||
|
||||
FlgT inUse ( );
|
||||
};
|
||||
|
||||
extern TemplateIOP tpl;
|
||||
|
||||
/*---------------------------] END OF THE CODE [---------------------------*/
|
|
@ -0,0 +1,72 @@
|
|||
template.hpp 1:
|
||||
template.hpp 2:
|
||||
template.hpp 3:
|
||||
template.hpp 4:
|
||||
template.hpp 5:
|
||||
template.hpp 6:
|
||||
template.hpp 7:
|
||||
template.hpp 8:
|
||||
template.hpp 9:
|
||||
template.hpp 10:
|
||||
template.hpp 11:
|
||||
template.hpp 12:
|
||||
template.hpp 13:
|
||||
template.hpp 14:
|
||||
template.hpp 15:
|
||||
template.hpp 16:
|
||||
template.hpp 17:
|
||||
template.hpp 18:
|
||||
template.hpp 19:
|
||||
template.hpp 20:
|
||||
template.hpp 21:
|
||||
template.hpp 22:
|
||||
template.hpp 23:
|
||||
template.hpp 24:
|
||||
template.hpp 25: const ShrtT maxTemplates = 256;
|
||||
template.hpp 26:
|
||||
template.hpp 27: _StructType(template_data)
|
||||
template.hpp 28: struct template_data
|
||||
template.hpp 29: {
|
||||
template.hpp 30: ChrT desc [ 61];
|
||||
template.hpp 31: ChrT comment [ 81];
|
||||
template.hpp 32: ChrT valMsg [ 9];
|
||||
template.hpp 33: WrdT secLevel;
|
||||
template.hpp 34: WrdT subscribe;
|
||||
template.hpp 35: WrdT expLevel;
|
||||
template.hpp 36: WrdT tbTime;
|
||||
template.hpp 37: WrdT tbKbyte;
|
||||
template.hpp 38: WrdT netCredit;
|
||||
template.hpp 39: IntT logLevel;
|
||||
template.hpp 40: FlgT hidden;
|
||||
template.hpp 41: FlgT noTops;
|
||||
template.hpp 42: FlgT atten;
|
||||
template.hpp 43: FlgT noKill;
|
||||
template.hpp 44: FlgT ignDld;
|
||||
template.hpp 45: FlgT deleted;
|
||||
template.hpp 46: ChrT reserved [99];
|
||||
template.hpp 47: PbFlags valFlagsOn;
|
||||
template.hpp 48: PbFlags valFlagsOff;
|
||||
template.hpp 49: PbFlags expFlagsOn;
|
||||
template.hpp 50: PbFlags expFlagsOff;
|
||||
template.hpp 51: };
|
||||
template.hpp 52:
|
||||
template.hpp 53: _ClassType(TemplateIO)
|
||||
template.hpp 54: class TemplateIO : public template_data, public MultiRecIO
|
||||
template.hpp 55: {
|
||||
template.hpp 56: public:
|
||||
template.hpp 57: TemplateIO ( ChrP path, ChrP fn = "Template.Pb" );
|
||||
template.hpp 58:
|
||||
template.hpp 59: FlgT readRec ( );
|
||||
template.hpp 60: FlgT writeRec ( );
|
||||
template.hpp 61: ShrtT recLen ( );
|
||||
template.hpp 62: void clear ( );
|
||||
template.hpp 63: void copy ( TemplateIOP orig );
|
||||
template.hpp 64:
|
||||
template.hpp 65: FlgT inUse ( );
|
||||
template.hpp 66: };
|
||||
template.hpp 67:
|
||||
template.hpp 68: extern TemplateIOP tpl;
|
||||
template.hpp 69:
|
||||
template.hpp 70:
|
||||
template.hpp 71:
|
||||
template.hpp 72:
|
Binary file not shown.
|
@ -0,0 +1,166 @@
|
|||
|
||||
/* ------------------------------------------------------------
|
||||
* Filename ............... ThProCfg.Hpp
|
||||
*
|
||||
* General Purpose ........ main include file
|
||||
* ------------------------------------------------------------
|
||||
* First date ............. 15 dec 1993
|
||||
*
|
||||
* First in version ....... 2.00
|
||||
*
|
||||
* Written by ............. Alain Schellinck
|
||||
* ------------------------------------------------------------
|
||||
* Revisions:
|
||||
* ----------
|
||||
*
|
||||
* Date | By | Purpose |
|
||||
* ---------+----+--------------------------------------------+
|
||||
* | | |
|
||||
* | | |
|
||||
* | | |
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#include <ProBoard.Hpp>
|
||||
#include "ProCfg.Hpp"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
const BytT nBlack = 0; const BytT hBlack = 8;
|
||||
const BytT nBlue = 1; const BytT hBlue = 9;
|
||||
const BytT nGreen = 2; const BytT hGreen = 10;
|
||||
const BytT nCyan = 3; const BytT hCyan = 11;
|
||||
const BytT nRed = 4; const BytT hRed = 12;
|
||||
const BytT nMagenta = 5; const BytT hMagenta = 13;
|
||||
const BytT nYellow = 6; const BytT hYellow = 14;
|
||||
const BytT nWhite = 7; const BytT hWhite = 15;
|
||||
|
||||
inline setFBColor(BytT fg, BytT bg)
|
||||
{
|
||||
return((bg << 4) + fg);
|
||||
}
|
||||
|
||||
/*--] Structures [-------------------------------] userFilter [------------*/
|
||||
|
||||
_StructType(userFilter)
|
||||
struct userFilter
|
||||
{
|
||||
ChrT name[36];
|
||||
ChrT location[26];
|
||||
PbFlags flagsOn;
|
||||
PbFlags flagsOff;
|
||||
WrdT lowerLevel;
|
||||
WrdT higherLevel;
|
||||
|
||||
userFilter ( )
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void clear ( )
|
||||
{
|
||||
CLEAR_OBJECT(name);
|
||||
CLEAR_OBJECT(location);
|
||||
flagsOn = "";
|
||||
flagsOff = "";
|
||||
lowerLevel = 0;
|
||||
higherLevel = WrdT(65535L);
|
||||
}
|
||||
};
|
||||
|
||||
/*--] Structures [-------------------------------] globalChange [----------*/
|
||||
|
||||
_StructType(globalChange)
|
||||
struct globalChange
|
||||
{
|
||||
enum what
|
||||
{
|
||||
chExpFlagsOn, // expiration flags on
|
||||
chExpFlagsOff, // expiration flags off
|
||||
chSecFlags, // security flags
|
||||
chSecLevel, // security level
|
||||
chExpLevel, // expiration level
|
||||
chNetCredit // netmail credit
|
||||
};
|
||||
|
||||
enum who
|
||||
{
|
||||
chEqualTo, // equal to specified level
|
||||
chLessThan, // less than specified level
|
||||
chGreaterThan, // greater than specified level
|
||||
chAllUsers // all users
|
||||
};
|
||||
|
||||
ShrtT changeWhat;
|
||||
ShrtT changeWho;
|
||||
UShrtT changeLevel;
|
||||
|
||||
PbFlags expFlagsOn;
|
||||
PbFlags expFlagsOff;
|
||||
PbFlags secFlags;
|
||||
UShrtT secLevel;
|
||||
UShrtT expLevel;
|
||||
LngT netCredit;
|
||||
|
||||
globalChange ( )
|
||||
{
|
||||
changeWhat = chSecLevel;
|
||||
changeWho = chAllUsers;
|
||||
changeLevel = 0;
|
||||
|
||||
expFlagsOn = "";
|
||||
expFlagsOff = "";
|
||||
secFlags = "";
|
||||
secLevel = 0;
|
||||
expLevel = 0;
|
||||
netCredit = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/*--] Classes [----------------------------------] fileEntry [-------------*/
|
||||
|
||||
_ClassType(fileEntry)
|
||||
class fileEntry : public Object
|
||||
{
|
||||
public:
|
||||
FileName fname;
|
||||
LngT size;
|
||||
Date date;
|
||||
Time time;
|
||||
|
||||
virtual ~fileEntry ( )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/*--] External variables [-------------------------------------------------*/
|
||||
|
||||
extern ChrT usrFind[80];
|
||||
extern LngP userList;
|
||||
extern UShrtT userListCount;
|
||||
extern UShrtT NumUsers;
|
||||
|
||||
/*--] prototypes [-------------------------------] EditUser.Cpp [----------*/
|
||||
void clearUserList ( );
|
||||
ShrtT fillUserList ( userFilter& filter );
|
||||
ShrtT getDiskRecNo ( ShrtT recno );
|
||||
ShrtT getListRecNo ( ShrtT recno );
|
||||
ShrtT filterUser ( );
|
||||
ShrtT searchUser ( ShrtT startRec );
|
||||
void listUser ( IntT recno, IntT x, IntT y );
|
||||
ShrtT pickUser ( ShrtT curRecNo );
|
||||
|
||||
/*--] prototypes [-------------------------------] EditVTpl.Cpp [----------*/
|
||||
ShrtT pickTemplate ( ShrtT curRecNo = 0 );
|
||||
|
||||
/*--] prototypes [-------------------------------] ProMisc.Cpp [-----------*/
|
||||
KEY enterPwd ( IntT mode, Window& w, IntT x, IntT y, ChrT attr,
|
||||
AnyP data );
|
||||
|
||||
ShrtT askYesNo ( ChrP title );
|
||||
void showHelp ( ChrP hlp[], char *pTitle=NULL, FlgT center = FALSE );
|
||||
|
||||
/*--] prototypes [---------------------------------------------------------*/
|
||||
|
||||
/*---------------------------] END OF THE CODE [---------------------------*/
|
|
@ -0,0 +1,15 @@
|
|||
-wbbf
|
||||
-weas
|
||||
-wpin
|
||||
-wamp
|
||||
-wasm
|
||||
-wdef
|
||||
-wnod
|
||||
-wpro
|
||||
-wstv
|
||||
-wcln
|
||||
-wpre
|
||||
-w-inl
|
||||
-w-par
|
||||
-w-rch
|
||||
-I\BC31\INCLUDE;\CPP\LIB\TSLIB;\CPP\LIB\TSWIN;\CPP\PB\LIB -X
|
|
@ -0,0 +1 @@
|
|||
path=d:\windows;d:\windows\command;d:\4dos602;d:\opus;c:\;d:\util;d:\brief;d:\bc31\bin
|
|
@ -0,0 +1,7 @@
|
|||
EDITAREA CPP 23,162 01-01-00 6:41p EDITAREA.CPP
|
||||
EDITFILE CPP 9,105 01-01-00 6:41p EDITFILE.CPP
|
||||
EDITGRP CPP 8,984 01-01-00 6:41p EDITGRP.CPP
|
||||
EDITMENU CPP 25,155 01-01-00 6:42p EDITMENU.CPP
|
||||
EDITPB CPP 14,860 01-01-00 6:42p EDITPB.CPP
|
||||
LANGUAGE CPP 14,510 01-01-00 6:42p LANGUAGE.CPP
|
||||
PROCFG CPP 28,660 01-01-00 6:42p PROCFG.CPP
|
|
@ -0,0 +1,7 @@
|
|||
EDITAREA CPP 23,157 08-09-99 4:46a EDITAREA.CPP
|
||||
EDITFILE CPP 9,099 08-09-99 4:55a EDITFILE.CPP
|
||||
EDITGRP CPP 8,979 08-06-99 2:26a EDITGRP.CPP
|
||||
EDITMENU CPP 25,150 08-09-99 2:51a EDITMENU.CPP
|
||||
EDITPB CPP 14,854 08-09-99 3:08a EDITPB.CPP
|
||||
LANGUAGE CPP 14,505 08-09-99 3:55a LANGUAGE.CPP
|
||||
PROCFG CPP 28,660 08-09-99 5:05a PROCFG.CPP
|
|
@ -0,0 +1 @@
|
|||
copy procfg.exe \bbs
|
|
@ -0,0 +1,2 @@
|
|||
@echo off
|
||||
del procfg.exe
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,252 @@
|
|||
#define Use_DynamicArrayFile
|
||||
|
||||
#include <string.h>
|
||||
#include <tswin.hpp>
|
||||
#include "procfg.hpp"
|
||||
#include "area.hpp"
|
||||
|
||||
|
||||
_MsgArea
|
||||
MsgArea::fEmpty(long r)
|
||||
{
|
||||
_MsgArea ma;
|
||||
|
||||
CLEAR_OBJECT(ma);
|
||||
|
||||
ma.areaNum = r+1;
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
void
|
||||
MsgArea::fMove(long /*r1*/,long r2,_MsgArea& ma)
|
||||
{
|
||||
ma.areaNum = r2+1;
|
||||
}
|
||||
|
||||
_FileArea
|
||||
FileArea::fEmpty(long)
|
||||
{
|
||||
_FileArea fa;
|
||||
|
||||
CLEAR_OBJECT(fa);
|
||||
|
||||
return fa;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
MsgArea_sortfunc(_MsgArea& ma1,_MsgArea& ma2)
|
||||
{
|
||||
return stricmp(ma2.name,ma1.name);
|
||||
}
|
||||
|
||||
static int
|
||||
FileArea_sortfunc(_FileArea& fa1,_FileArea& fa2)
|
||||
{
|
||||
return stricmp(fa2.name,fa1.name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Area::selected_start = -1;
|
||||
int Area::selected_end = -1;
|
||||
|
||||
int MsgArea::file_count = 0;
|
||||
File MsgArea::f;
|
||||
DynamicArrayFile<_MsgArea> *MsgArea::df = NULL;
|
||||
|
||||
int FileArea::file_count = 0;
|
||||
File FileArea::f;
|
||||
DynamicArrayFile<_FileArea> *FileArea::df = NULL;
|
||||
|
||||
MsgArea::MsgArea()
|
||||
{
|
||||
if(file_count <= 0)
|
||||
{
|
||||
f.open(FileName(syspath,"MESSAGES.PB"),fmode_rw | fmode_copen);
|
||||
|
||||
file_count = 0;
|
||||
|
||||
if(!f.opened()) return;
|
||||
|
||||
df = new DynamicArrayFile<_MsgArea>(f);
|
||||
|
||||
df->setEmptyFunc(fEmpty);
|
||||
df->setMoveFunc(fMove);
|
||||
|
||||
selStart(-1);
|
||||
selEnd(-1);
|
||||
}
|
||||
|
||||
file_count++;
|
||||
}
|
||||
|
||||
MsgArea::~MsgArea()
|
||||
{
|
||||
if(file_count <= 1 && f.opened())
|
||||
{
|
||||
delete df;
|
||||
|
||||
f.close();
|
||||
|
||||
file_count = 1;
|
||||
}
|
||||
|
||||
file_count--;
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::read(int rec)
|
||||
{
|
||||
return df->read(rec-1,*this);
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::write(int rec)
|
||||
{
|
||||
areaNum = rec;
|
||||
|
||||
return df->write(rec-1,*this);
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::clear(int rec)
|
||||
{
|
||||
CLEAR_OBJECT(*((_MsgArea *)this));
|
||||
|
||||
return write(rec);
|
||||
}
|
||||
|
||||
int
|
||||
MsgArea::numAreas()
|
||||
{
|
||||
return int(df->numRecords());
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::insert(int rec)
|
||||
{
|
||||
return df->insert(rec-1);
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::remove(int rec)
|
||||
{
|
||||
return df->remove(rec-1);
|
||||
}
|
||||
|
||||
|
||||
dword
|
||||
MsgArea::crc()
|
||||
{
|
||||
return crc32(this,sizeof(_MsgArea));
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::sort(int from,int to)
|
||||
{
|
||||
return df->sort(from,to,MsgArea_sortfunc);
|
||||
}
|
||||
|
||||
bool
|
||||
MsgArea::move(int start,int end,int to)
|
||||
{
|
||||
return df->move(start,end,to);
|
||||
}
|
||||
|
||||
FileArea::FileArea()
|
||||
{
|
||||
if(file_count <= 0)
|
||||
{
|
||||
f.open(FileName(syspath,"FILECFG.PRO"),fmode_rw | fmode_copen);
|
||||
|
||||
file_count = 0;
|
||||
|
||||
if(!f.opened()) return;
|
||||
|
||||
df = new DynamicArrayFile<_FileArea>(f);
|
||||
|
||||
df->setEmptyFunc(fEmpty);
|
||||
|
||||
selStart(-1);
|
||||
selEnd(-1);
|
||||
}
|
||||
|
||||
file_count++;
|
||||
}
|
||||
|
||||
FileArea::~FileArea()
|
||||
{
|
||||
if(file_count <= 1 && f.opened())
|
||||
{
|
||||
delete df;
|
||||
|
||||
f.close();
|
||||
|
||||
file_count = 1;
|
||||
}
|
||||
|
||||
file_count--;
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::read(int rec)
|
||||
{
|
||||
areaNum = rec;
|
||||
|
||||
return df->read(rec-1,*this);
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::write(int rec)
|
||||
{
|
||||
areaNum = rec;
|
||||
|
||||
return df->write(rec-1,*this);
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::clear(int rec)
|
||||
{
|
||||
CLEAR_OBJECT(*((_FileArea *)this));
|
||||
|
||||
return write(rec);
|
||||
}
|
||||
|
||||
int
|
||||
FileArea::numAreas()
|
||||
{
|
||||
return int(df->numRecords());
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::insert(int rec)
|
||||
{
|
||||
return df->insert(rec-1);
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::remove(int rec)
|
||||
{
|
||||
return df->remove(rec-1);
|
||||
}
|
||||
|
||||
dword
|
||||
FileArea::crc()
|
||||
{
|
||||
return crc32(this,sizeof(_FileArea));
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::sort(int from,int to)
|
||||
{
|
||||
return df->sort(from,to,FileArea_sortfunc);
|
||||
}
|
||||
|
||||
bool
|
||||
FileArea::move(int start,int end,int to)
|
||||
{
|
||||
return df->move(start,end,to);
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
class Area
|
||||
{
|
||||
static int selected_start;
|
||||
static int selected_end;
|
||||
public:
|
||||
virtual ~Area() {}
|
||||
|
||||
virtual bool read(int) = 0;
|
||||
virtual bool write(int) = 0;
|
||||
virtual bool clear(int) = 0;
|
||||
|
||||
virtual bool insert(int) = 0;
|
||||
virtual bool remove(int) = 0;
|
||||
|
||||
virtual int numAreas() = 0;
|
||||
|
||||
virtual KEY edit() = 0;
|
||||
|
||||
virtual int selStart(int i = -20000)
|
||||
{
|
||||
if(i != -20000)
|
||||
selected_start = i;
|
||||
|
||||
return selected_start;
|
||||
}
|
||||
virtual int selEnd (int i = -20000)
|
||||
{
|
||||
if(i != -20000)
|
||||
selected_end = i;
|
||||
|
||||
return selected_end;
|
||||
}
|
||||
virtual void listFunc(int,int,int) = 0;
|
||||
virtual dword crc() = 0;
|
||||
|
||||
virtual bool sort(int,int) = 0;
|
||||
virtual bool move(int,int,int) = 0;
|
||||
};
|
||||
|
||||
|
||||
class MsgArea : public _MsgArea , public Area
|
||||
{
|
||||
static File f;
|
||||
static DynamicArrayFile<_MsgArea> *df;
|
||||
static int file_count;
|
||||
|
||||
static _MsgArea fEmpty(long);
|
||||
static void fMove(long,long,_MsgArea&);
|
||||
public:
|
||||
|
||||
|
||||
MsgArea();
|
||||
~MsgArea();
|
||||
|
||||
bool read(int);
|
||||
bool write(int);
|
||||
bool clear(int);
|
||||
|
||||
bool insert(int);
|
||||
bool remove(int);
|
||||
|
||||
int numAreas();
|
||||
|
||||
KEY edit();
|
||||
|
||||
void listFunc(int,int x,int y);
|
||||
|
||||
dword crc();
|
||||
|
||||
bool sort(int,int);
|
||||
bool move(int,int,int);
|
||||
};
|
||||
|
||||
class FileArea : public _FileArea , public Area
|
||||
{
|
||||
static File f;
|
||||
static DynamicArrayFile<_FileArea> *df;
|
||||
static int file_count;
|
||||
|
||||
static _FileArea fEmpty(long);
|
||||
|
||||
int areaNum;
|
||||
|
||||
public:
|
||||
FileArea();
|
||||
~FileArea();
|
||||
|
||||
bool read(int);
|
||||
bool write(int);
|
||||
bool clear(int);
|
||||
|
||||
bool insert(int);
|
||||
bool remove(int);
|
||||
|
||||
int numAreas();
|
||||
|
||||
KEY edit();
|
||||
|
||||
void listFunc(int,int x,int y);
|
||||
|
||||
dword crc();
|
||||
|
||||
bool sort(int,int);
|
||||
bool move(int,int,int);
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue