various fixes
This commit is contained in:
parent
8ef102eff3
commit
2bce072dd1
@ -12,6 +12,24 @@ ______________________________________________________________________
|
||||
Notes for GoldED+ 1.1.4.7, November xx 2000
|
||||
______________________________________________________________________
|
||||
|
||||
- It is now possible to use filepicker if there's very long filenames.
|
||||
|
||||
- Fixed filelist parser for national languages.
|
||||
|
||||
+ It is now possible to edit Group field in addressbook even though
|
||||
there's no sence for this :-)
|
||||
|
||||
- Added workaround for inserting of random line into message.
|
||||
|
||||
- Fixed incorrect help category display after EDITHeader.
|
||||
|
||||
! Removed unused help entries from READMainmenu.
|
||||
|
||||
- Fixed memory overrun in file attach creation.
|
||||
|
||||
- Fixed insertion of extra spaces around Origin line if entry is taken
|
||||
from file.
|
||||
|
||||
+ Logged version name now combined with release date (for easy sorting
|
||||
out the logs received).
|
||||
|
||||
|
@ -2146,8 +2146,6 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) {
|
||||
if(marginquotes > margintext)
|
||||
marginquotes = margintext;
|
||||
|
||||
whelppcat(H_Editor);
|
||||
|
||||
if(currline == NULL) {
|
||||
currline = new Line("\n");
|
||||
throw_xnew(currline);
|
||||
@ -2266,7 +2264,6 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) {
|
||||
|
||||
msgptr->lin = findfirstline();
|
||||
savefile(quitnow ? MODE_UPDATE : MODE_SAVE);
|
||||
whelpop();
|
||||
|
||||
// Prune killbuffer
|
||||
if(Edit__killbuf) {
|
||||
@ -2336,6 +2333,7 @@ UndoStack::~UndoStack() {
|
||||
while(last_item) {
|
||||
switch(last_item->action & EDIT_UNDO_ACTION) {
|
||||
case EDIT_UNDO_DEL_TEXT:
|
||||
case EDIT_UNDO_INS_TEXT:
|
||||
case EDIT_UNDO_WRAP_TEXT:
|
||||
throw_delete(last_item->data.text_ptr);
|
||||
break;
|
||||
|
@ -92,6 +92,7 @@ void IEclass::windowopen() {
|
||||
gwin.style = STYLE_NOCLEAR;
|
||||
editwin.open(win_minrow, win_mincol, win_maxrow, win_maxcol, 5, C_READB, C_READW, C_READPB);
|
||||
gwin.style = _tmp;
|
||||
whelppcat(H_Editor);
|
||||
}
|
||||
|
||||
|
||||
@ -99,6 +100,7 @@ void IEclass::windowopen() {
|
||||
|
||||
void IEclass::windowclose() {
|
||||
|
||||
whelpop();
|
||||
// Close editor window without removing the window itself
|
||||
editwin.unlink();
|
||||
}
|
||||
@ -629,13 +631,15 @@ void IEclass::BlockDel(Line* anchor) {
|
||||
// The firstcutline and lastcutline pointers
|
||||
// are now pointing where they should
|
||||
|
||||
Undo->PushItem(EDIT_UNDO_DEL_TEXT, firstcutline, firstcol);
|
||||
if(firstcutline != lastcutline) {
|
||||
Undo->PushItem(EDIT_UNDO_DEL_TEXT, firstcutline, firstcol);
|
||||
firstcutline->txt.erase(firstcol);
|
||||
firstcutline->txt += lastcutline->txt.c_str()+lastcol;
|
||||
}
|
||||
else
|
||||
else {
|
||||
Undo->PushItem(EDIT_UNDO_DEL_TEXT, firstcutline, firstcol, lastcol-firstcol);
|
||||
firstcutline->txt.erase(firstcol, lastcol-firstcol);
|
||||
}
|
||||
setlinetype(firstcutline);
|
||||
firstcutline->type &= ~GLINE_BLOK;
|
||||
blockcol = -1;
|
||||
@ -901,10 +905,10 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
|
||||
ImportMode = MenuImportTxt.Run();
|
||||
}
|
||||
|
||||
Path filenamebuf, tmpfile;
|
||||
string filenamebuf;
|
||||
Path tmpfile;
|
||||
bool isPipe = NO;
|
||||
char* _filenameptr = filenamebuf;
|
||||
char* _selectedfile = NULL;
|
||||
bool fileselected = false;
|
||||
|
||||
// Should the imported text be quoted or uuencoded?
|
||||
#define quoteit (ImportMode == 1)
|
||||
@ -918,79 +922,71 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
|
||||
AA->SetInputfile(CFG->inputfile);
|
||||
|
||||
// Pointer to the filename string
|
||||
_filenameptr = strcpy(filenamebuf, AA->Inputfile());
|
||||
filenamebuf = AA->Inputfile();
|
||||
|
||||
if(_filenameptr[0] == '|'){
|
||||
if(filenamebuf.c_str()[0] == '|'){
|
||||
Path cmdline;
|
||||
|
||||
isPipe = YES;
|
||||
mktemp(strcpy(tmpfile, AddPath(CFG->goldpath, "GIXXXXXX")));
|
||||
strxmerge(cmdline, sizeof(Path), _filenameptr+1, " > ", tmpfile, NULL);
|
||||
mktemp(strxcpy(tmpfile, AddPath(CFG->goldpath, "GIXXXXXX"), sizeof(Path)));
|
||||
strxmerge(cmdline, sizeof(Path), filenamebuf.c_str()+1, " > ", tmpfile, NULL);
|
||||
ShellToDos(cmdline, "", NO, NO);
|
||||
_selectedfile = _filenameptr = tmpfile;
|
||||
filenamebuf = tmpfile;
|
||||
fileselected = true;
|
||||
} else {
|
||||
// Check for wildcards
|
||||
// Is the filename a directory?
|
||||
if(is_dir(_filenameptr)) {
|
||||
if(is_dir(filenamebuf)) {
|
||||
|
||||
// Does the filename contain wildcards?
|
||||
if(not strpbrk(_filenameptr, "*?")) {
|
||||
if(not strpbrk(filenamebuf.c_str(), "*?")) {
|
||||
|
||||
// Add match-all wildcards
|
||||
strcat(AddBackslash(_filenameptr), "*");
|
||||
AddBackslash(filenamebuf);
|
||||
filenamebuf += "*";
|
||||
}
|
||||
}
|
||||
|
||||
// Pointer to selected filename or NULL if no file is selected
|
||||
_selectedfile = _filenameptr;
|
||||
fileselected = true;
|
||||
|
||||
// Does the filename contain wildcards?
|
||||
if(strpbrk(_filenameptr, "*?")) {
|
||||
if(strpbrk(filenamebuf.c_str(), "*?")) {
|
||||
|
||||
// Set selection window title and statusline
|
||||
set_title(LNG->ImportTitle, TCENTER, C_MENUT);
|
||||
update_statuslinef(LNG->ImportStatus, _filenameptr);
|
||||
|
||||
// Copy filename with wildcards to a temp buffer
|
||||
Path _filenamebuf;
|
||||
strcpy(_filenamebuf, _filenameptr);
|
||||
update_statuslinef(LNG->ImportStatus, filenamebuf.c_str());
|
||||
|
||||
// Start the file picker
|
||||
_selectedfile = wpickfile(
|
||||
win_minrow,
|
||||
win_mincol,
|
||||
win_maxrow,
|
||||
win_maxcol,
|
||||
W_BMENU,
|
||||
C_MENUB,
|
||||
C_MENUW,
|
||||
C_MENUS,
|
||||
NO,
|
||||
_filenamebuf,
|
||||
_filenameptr,
|
||||
maketitle
|
||||
);
|
||||
|
||||
// If a file was selected, copy the filename
|
||||
if(_selectedfile)
|
||||
strcpy(_filenameptr, _selectedfile);
|
||||
fileselected = wpickfile(win_minrow, win_mincol, win_maxrow, win_maxcol, W_BMENU, C_MENUB, C_MENUW, C_MENUS, NO, filenamebuf, maketitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(_selectedfile or getclip) {
|
||||
if(fileselected or getclip) {
|
||||
|
||||
// Open the file/clipboard
|
||||
FILE* fp = NULL;
|
||||
gclipbrd clipbrd;
|
||||
|
||||
if(getclip)
|
||||
_filenameptr = strcpy(filenamebuf, CLIP_NAME);
|
||||
filenamebuf = CLIP_NAME;
|
||||
|
||||
if(getclip ? clipbrd.openread() :
|
||||
(fp = fsopen(_filenameptr, binary ? "rb" : "rt", CFG->sharemode))!=NULL) {
|
||||
(fp = fsopen(filenamebuf.c_str(), binary ? "rb" : "rt", CFG->sharemode))!=NULL) {
|
||||
|
||||
update_statuslinef(LNG->ImportStatus, _filenameptr);
|
||||
if (isPipe)
|
||||
filenamebuf = AA->Inputfile();
|
||||
|
||||
const char *imp_filename = (getclip or isPipe) ? filenamebuf.c_str() : CleanFilename(filenamebuf.c_str());
|
||||
|
||||
// we need to truncate filename to prevent unpredictable results
|
||||
int delta = strlen(imp_filename) - margintext;
|
||||
if(delta > 0) {
|
||||
filenamebuf.erase(filenamebuf.length()-delta);
|
||||
imp_filename = (getclip or isPipe) ? filenamebuf.c_str() : CleanFilename(filenamebuf.c_str());
|
||||
}
|
||||
|
||||
update_statuslinef(LNG->ImportStatus, filenamebuf.c_str());
|
||||
|
||||
// Allocate paragraph read buffer
|
||||
char* _parabuf = (char*)throw_malloc(EDIT_PARABUFLEN);
|
||||
@ -1004,15 +1000,18 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
|
||||
// Add import begin text, if any
|
||||
if(*CFG->importbegin) {
|
||||
sprintf(_parabuf, "%s\n", CFG->importbegin);
|
||||
strischg(_parabuf, "@file", getclip ? _filenameptr : isPipe ? AA->Inputfile() : CleanFilename(_filenameptr));
|
||||
strischg(_parabuf, "@file", imp_filename);
|
||||
_parabuf[margintext] = NUL;
|
||||
_parabuf[margintext-1] = '\n';
|
||||
__line = insertlinebelow(__line, _parabuf);
|
||||
setlinetype(__line);
|
||||
}
|
||||
|
||||
if(uuencode) {
|
||||
|
||||
sprintf(_parabuf, "begin 644 %s\n", CleanFilename(_filenameptr));
|
||||
sprintf(_parabuf, "begin 644 %s\n", imp_filename);
|
||||
_parabuf[margintext] = NUL;
|
||||
_parabuf[margintext-1] = '\n';
|
||||
__line = insertlinebelow(__line, _parabuf);
|
||||
setlinetype(__line);
|
||||
|
||||
@ -1046,7 +1045,8 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
|
||||
|
||||
base64_engine b64;
|
||||
|
||||
sprintf(_parabuf, "Content-type: application/octet-stream; name=\"%s\"\n", CleanFilename(_filenameptr));
|
||||
sprintf(_parabuf, "Content-type: application/octet-stream; name=\"%s\"\n", imp_filename);
|
||||
strcpy(_parabuf+margintext-2, "\"\n");
|
||||
__line = insertlinebelow(__line, _parabuf);
|
||||
setlinetype(__line);
|
||||
sprintf(_parabuf, "Content-transfer-encoding: base64\n");
|
||||
@ -1162,8 +1162,9 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
|
||||
// Add import end text, if any
|
||||
if(*CFG->importend or *CFG->importbegin) {
|
||||
sprintf(_parabuf, "%s\n", *CFG->importend ? CFG->importend : CFG->importbegin);
|
||||
strischg(_parabuf, "@file", getclip ? _filenameptr : isPipe ? AA->Inputfile() : CleanFilename(_filenameptr));
|
||||
strischg(_parabuf, "@file", imp_filename);
|
||||
_parabuf[margintext] = NUL;
|
||||
_parabuf[margintext-1] = '\n';
|
||||
__line = insertlinebelow(__line, _parabuf);
|
||||
setlinetype(__line);
|
||||
}
|
||||
@ -1176,7 +1177,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
|
||||
fclose(fp);
|
||||
}
|
||||
else {
|
||||
w_infof(LNG->CouldNotOpen, _filenameptr);
|
||||
w_infof(LNG->CouldNotOpen, filenamebuf.c_str());
|
||||
waitkeyt(10000);
|
||||
w_info(NULL);
|
||||
}
|
||||
|
@ -32,10 +32,10 @@
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
char CFG__frqinvfilechars[40] = { "\"()+,.\\/:;<=>[]| \xff@" };
|
||||
char CFG__frqinvfilechars[40] = { "\"()+,.\\/:;<=>[]| @" };
|
||||
char CFG__frqskipwordchars[40] = { "0123456789-[" };
|
||||
|
||||
inline char* invalidfilechar(char ch) { return strchr(CFG__frqinvfilechars, ch); }
|
||||
inline bool invalidfilechar(char ch) { return not isascii(ch&0xff) or strchr(CFG__frqinvfilechars, ch); }
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@ -574,18 +574,15 @@ static int frqchkdesc(char* desc) {
|
||||
if(*desc == NUL)
|
||||
strcpy(desc, " ");
|
||||
else {
|
||||
while(*ptr) {
|
||||
if(isalnum(*ptr))
|
||||
break;
|
||||
while(*ptr and not isxalnum(*ptr))
|
||||
ptr++;
|
||||
}
|
||||
if(*ptr == NUL) {
|
||||
*desc = NUL;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ptr = desc + strlen(desc) - 1;
|
||||
while(((*ptr < '!') or (*ptr > '\x7F')) and (ptr>desc))
|
||||
while(not isascii(*ptr&0xff) and not isxalnum(*ptr) and (ptr>desc))
|
||||
*ptr-- = NUL;
|
||||
|
||||
return false;
|
||||
@ -607,11 +604,11 @@ static int frqgetfile(char* file, char* desc, char* filesize, const char* txt) {
|
||||
if(not invalidfilechar(*ptr) and ((ptr - txt) > 1)) {
|
||||
|
||||
// Find end of extension
|
||||
while(*ptr and (*ptr != ' '))
|
||||
while(*ptr and ((*ptr == '.') or not invalidfilechar(*ptr)))
|
||||
ptr++;
|
||||
|
||||
// Strip invalid chars from the end of the extension
|
||||
while(invalidfilechar(*(ptr-1)))
|
||||
// Strip dots from the end of the extension
|
||||
while(*(ptr-1) == '.')
|
||||
ptr--;
|
||||
|
||||
// Copy the filename
|
||||
|
@ -428,7 +428,7 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view) {
|
||||
|
||||
ChgAttrs(false, msg);
|
||||
|
||||
whelpcat(help);
|
||||
// whelppcat(help);
|
||||
|
||||
if(not hedit.dropped and not gkbd.quitall) {
|
||||
|
||||
|
@ -529,6 +529,7 @@ int SelectFromFile(const char* file, char* selection, const char* title, const c
|
||||
n = wpickstr(6, 0, 6+n+1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, 0, title_shadow);
|
||||
if(n != -1) {
|
||||
strcpy(selection, Listi[n]);
|
||||
strtrim(selection);
|
||||
retval = true;
|
||||
}
|
||||
for(n=0; n<lines; n++)
|
||||
|
@ -997,9 +997,6 @@ int GMenuNavigate::Run() {
|
||||
TAG_UTIL_LIST = (int)KK_ReadMessageList,
|
||||
TAG_UTIL_WRITE = (int)KK_ReadWriteMsg,
|
||||
TAG_UTIL_FREQ = (int)KK_ReadFileRequest,
|
||||
TAG_HELP = 104,
|
||||
TAG_HELP_GENERAL,
|
||||
TAG_HELP_ABOUT,
|
||||
TAG_SEPARATOR,
|
||||
TAG_END
|
||||
};
|
||||
@ -1047,12 +1044,6 @@ int GMenuNavigate::Run() {
|
||||
Item(TAG_UTIL_WRITE, "W Write to disk/printer ");
|
||||
Item(TAG_UTIL_FREQ, "F File request ");
|
||||
End();
|
||||
Item(TAG_UTIL, "H Help ");
|
||||
BeginPullDown();
|
||||
Item(TAG_HELP_GENERAL, "G General ");
|
||||
Item(TAG_SEPARATOR, "----------", M_NOSEL);
|
||||
Item(TAG_HELP_ABOUT, "A About ");
|
||||
End();
|
||||
End();
|
||||
Start();
|
||||
if((finaltag >= TAG_MAIN) and (finaltag < (TAG_END*10)))
|
||||
|
@ -107,7 +107,7 @@ void CheckSubject(GMsg* msg, char* subj) {
|
||||
fspec = (FileSpec*)throw_realloc(fspec, (fspecs+1)*sizeof(FileSpec));
|
||||
memset(fspec+fspecs, 0, sizeof(FileSpec));
|
||||
fspec[fspecs].files = 1;
|
||||
strcpy(fspec[fspecs].path, ptr);
|
||||
strxcpy(fspec[fspecs].path, ptr, sizeof(Path));
|
||||
specfiles++;
|
||||
fspecs++;
|
||||
}
|
||||
@ -120,9 +120,9 @@ void CheckSubject(GMsg* msg, char* subj) {
|
||||
ISub buf;
|
||||
if(strblank(subj)) {
|
||||
if(*CFG->attachpath)
|
||||
strcpy(subj, CFG->attachpath);
|
||||
strxcpy(subj, CFG->attachpath, sizeof(ISub));
|
||||
else
|
||||
strcpy(subj, CFG->goldpath);
|
||||
strxcpy(subj, CFG->goldpath, sizeof(ISub));
|
||||
}
|
||||
strcpy(buf, subj);
|
||||
char* ptr = strtok(buf, " ");
|
||||
@ -133,7 +133,7 @@ void CheckSubject(GMsg* msg, char* subj) {
|
||||
fspec[fspecs].delsent = YES;
|
||||
ptr++;
|
||||
}
|
||||
strcpy(fspec[fspecs].path, ptr);
|
||||
strxcpy(fspec[fspecs].path, ptr, sizeof(Path));
|
||||
FileSelect(msg, LNG->AttachFiles, &fspec[fspecs]);
|
||||
specfiles += fspec[fspecs].files;
|
||||
if(fspec[fspecs].files)
|
||||
@ -156,7 +156,7 @@ void CheckSubject(GMsg* msg, char* subj) {
|
||||
else {
|
||||
fspec = (FileSpec*)throw_realloc(fspec, (fspecs+1)*sizeof(FileSpec));
|
||||
memset(fspec+fspecs, 0, sizeof(FileSpec));
|
||||
strcpy(fspec[fspecs].path, ptr);
|
||||
strxcpy(fspec[fspecs].path, ptr, sizeof(Path));
|
||||
FileSelect(msg, LNG->UpdreqFiles, &fspec[fspecs]);
|
||||
specfiles += fspec[fspecs].files;
|
||||
if(fspec[fspecs].files)
|
||||
|
@ -45,11 +45,10 @@ char* GetRandomLine(char* __buf, size_t __bufsize, const char* __file) {
|
||||
if(FiletimeCmp(__file, idxfile) > 0)
|
||||
idxexist = false;
|
||||
|
||||
FILE* fpi = fsopen(idxfile, idxexist ? "rb" : "wb+", CFG->sharemode);
|
||||
if(fpi) {
|
||||
|
||||
// Create index if one was missing
|
||||
if(not idxexist) {
|
||||
// Create index if one was missing
|
||||
if(not idxexist) {
|
||||
FILE* fpi = fsopen(idxfile, "wb+", CFG->sharemode);
|
||||
if(fpi) {
|
||||
setvbuf(fp, NULL, _IOFBF, 32000);
|
||||
setvbuf(fpi, NULL, _IOFBF, 16000);
|
||||
long fpos = 0;
|
||||
@ -58,7 +57,12 @@ char* GetRandomLine(char* __buf, size_t __bufsize, const char* __file) {
|
||||
fwrite(&fpos, sizeof(long), 1, fpi);
|
||||
fpos += strlen(buf);
|
||||
}
|
||||
fclose(fpi);
|
||||
}
|
||||
}
|
||||
|
||||
FILE* fpi = fsopen(idxfile, "rb", CFG->sharemode);
|
||||
if(fpi) {
|
||||
|
||||
// Get random line if there is at least one
|
||||
int _lines = (int)(fsize(fpi)/sizeof(long));
|
||||
|
@ -635,7 +635,7 @@ void UUDecode(GMsg* msg) {
|
||||
w_progress(MODE_UPDATE, C_INFOW, n+1, AA->Mark.Count(), LNG->Preparing);
|
||||
AA->LoadMsg(msg, AA->Mark[n], 79);
|
||||
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, infile, msg);
|
||||
}
|
||||
}
|
||||
if(AA->Mark.Count())
|
||||
w_progress(MODE_QUIT, 0, 0, 0, NULL);
|
||||
}
|
||||
|
@ -270,6 +270,7 @@ void addressbook_form::LoadForm() {
|
||||
voicephone= entry.voicephone;
|
||||
faxphone = entry.faxphone;
|
||||
dataphone = entry.dataphone;
|
||||
group = entry.group;
|
||||
snail1 = entry.snail1;
|
||||
snail2 = entry.snail2;
|
||||
snail3 = entry.snail3;
|
||||
@ -295,6 +296,7 @@ void addressbook_form::SaveForm() {
|
||||
strcpy(entry.voicephone, voicephone.c_str());
|
||||
strcpy(entry.faxphone, faxphone.c_str());
|
||||
strcpy(entry.dataphone, dataphone.c_str());
|
||||
entry.group = group.c_str()[0];
|
||||
strcpy(entry.snail1, snail1.c_str());
|
||||
strcpy(entry.snail2, snail2.c_str());
|
||||
strcpy(entry.snail3, snail3.c_str());
|
||||
@ -373,10 +375,11 @@ bool guserbase::edit_entry(uint idx) {
|
||||
form.add_field(addressbook_form::id_voicephone, 5, 13, 20, form.voicephone, sizeof(entry.voicephone));
|
||||
form.add_field(addressbook_form::id_faxphone, 6, 13, 20, form.faxphone, sizeof(entry.faxphone));
|
||||
form.add_field(addressbook_form::id_dataphone, 7, 13, 20, form.dataphone, sizeof(entry.dataphone));
|
||||
form.add_field(addressbook_form::id_group, 8, 13, 20, form.group, sizeof(entry.group)+1);
|
||||
form.add_field(addressbook_form::id_snail1, 5, 46, 26, form.snail1, sizeof(entry.snail1));
|
||||
form.add_field(addressbook_form::id_snail2, 6, 46, 26, form.snail2, sizeof(entry.snail2));
|
||||
form.add_field(addressbook_form::id_snail2, 6, 46, 26, form.snail2, sizeof(entry.snail2));
|
||||
form.add_field(addressbook_form::id_snail3, 7, 46, 26, form.snail3, sizeof(entry.snail3));
|
||||
form.add_field(addressbook_form::id_homepage , 8, 46, 26, form.homepage, sizeof(entry.homepage));
|
||||
form.add_field(addressbook_form::id_homepage, 8, 46, 26, form.homepage, sizeof(entry.homepage));
|
||||
form.add_field(addressbook_form::id_comment1, 9, 13, 59, form.comment1, sizeof(entry.comment1));
|
||||
form.add_field(addressbook_form::id_comment2, 10, 13, 59, form.comment2, sizeof(entry.comment2));
|
||||
form.add_field(addressbook_form::id_comment3, 11, 13, 59, form.comment3, sizeof(entry.comment3));
|
||||
|
@ -98,6 +98,7 @@ class addressbook_form : public gwinput2 {
|
||||
string voicephone;
|
||||
string faxphone;
|
||||
string homepage;
|
||||
string group;
|
||||
string comment1;
|
||||
string comment2;
|
||||
string comment3;
|
||||
|
@ -117,11 +117,12 @@ void update_statusline(const char* info) {
|
||||
|
||||
void update_statuslinef(const char* format, ...) {
|
||||
|
||||
char winfobuf[350];
|
||||
va_list argptr;
|
||||
va_start(argptr, format);
|
||||
vsprintf(information, format, argptr);
|
||||
vsprintf(winfobuf, format, argptr);
|
||||
va_end(argptr);
|
||||
update_statuslines();
|
||||
update_statusline(winfobuf);
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,8 +51,9 @@ inline char toupper(char c) { return tu[c]; }
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
inline int iswhite(char c) { return c < '!' and c; }
|
||||
inline int isxalnum(char c) { return isalnum(c) or (c >= 128); }
|
||||
inline int iswhite(char c) { return c and (iscntrl(c) or (c == ' ')); }
|
||||
// NLS chars detected by converting to lower or upper case and in case they don't match they treated as characters
|
||||
inline int isxalnum(char c) { return isalnum(c) or ((c >= 128) and ((c != tolower(c)) or (c != toupper(c)))); }
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@ -34,6 +34,7 @@
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
#include <gdefs.h>
|
||||
#include <gstrall.h>
|
||||
#include <gkbdbase.h>
|
||||
#include <gvidall.h>
|
||||
|
||||
@ -368,7 +369,7 @@ int wmove (int nsrow, int nscol);
|
||||
int wopen (int srow, int scol, int erow, int ecol, int btype, int battr, int wattr, int sbattr=-1, int loattr=-1);
|
||||
inline int wopen_ (int srow, int scol, int vlen, int hlen, int btype, int battr, int wattr, int sbattr=-1, int loattr=-1) { return wopen(srow, scol, srow+vlen-1, scol+hlen-1, btype, battr, wattr, sbattr, loattr); }
|
||||
int wperror (const char* message);
|
||||
char* wpickfile (int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, const char* filespec, char* selectedfile, VfvCP open, bool casesens=false);
|
||||
bool wpickfile (int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, string &filespec, VfvCP open, bool casesens=false);
|
||||
int wpickstr (int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, char* strarr[], int initelem, VfvCP open);
|
||||
int wprintc (int wrow, int wcol, int attr, vchar ch);
|
||||
int wprintf (const char* format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
|
@ -117,7 +117,7 @@ static void pre_exit(char** p, int numelems) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
char* wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, const char* filespec, char* selectedfile, VfvCP open, bool casesens) {
|
||||
bool wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, string &filespec, VfvCP open, bool casesens) {
|
||||
|
||||
Path cwd, dir, namext, tcwd, path, spec;
|
||||
|
||||
@ -138,7 +138,7 @@ char* wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr,
|
||||
getcwd(tcwd, GMAXPATH);
|
||||
|
||||
// if drive was specified, change to it
|
||||
char* q = strcpy(spec, filespec);
|
||||
char* q = strxcpy(spec, filespec.c_str(), sizeof(Path));
|
||||
|
||||
// split up input filespec into its current
|
||||
// working directory and filename/extension
|
||||
@ -168,7 +168,7 @@ char* wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr,
|
||||
if(*dir) {
|
||||
if(gchdir(dir)) {
|
||||
pre_exit(p, 0);
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ char* wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr,
|
||||
const char* name = NULL;
|
||||
if(de->is_directory()) {
|
||||
if(de->name != ".") {
|
||||
strcpy(stpcpy(path, de->name.c_str()), GOLD_SLASH_STR);
|
||||
strxmerge(path, sizeof(Path), de->name.c_str(), GOLD_SLASH_STR, NULL);
|
||||
name = path;
|
||||
}
|
||||
}
|
||||
@ -215,7 +215,7 @@ char* wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr,
|
||||
picked = wpickstr(srow, scol, erow, ecol, btype, bordattr, winattr, barattr, p, 0, disp_title);
|
||||
if(picked == -1 or files == 0) {
|
||||
pre_exit(p, files);
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
// see if a directory was selected. if so save
|
||||
@ -231,8 +231,8 @@ char* wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr,
|
||||
}
|
||||
else {
|
||||
finished = true;
|
||||
PathCopy(path, cwd);
|
||||
strcat(path, p[picked]);
|
||||
PathCopy(filespec, cwd);
|
||||
filespec += p[picked];
|
||||
}
|
||||
|
||||
// free allocated strings
|
||||
@ -248,8 +248,7 @@ char* wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr,
|
||||
throw_xfree(p);
|
||||
|
||||
// return normally
|
||||
strcpy(selectedfile, path);
|
||||
return selectedfile;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -435,10 +435,8 @@ int wpickstr(int srow, int scol, int erow, int ecol, int btype, int bordattr, in
|
||||
r.wheight = (erow-border)-(srow+border)+1;
|
||||
|
||||
// make sure longest string can fit in window
|
||||
if(r.maxstrlen > r.wwidth) {
|
||||
gwin.werrno=W_STRLONG;
|
||||
return -1;
|
||||
}
|
||||
if(r.maxstrlen > r.wwidth)
|
||||
r.maxstrlen = r.wwidth;
|
||||
|
||||
// open window which strings will reside in
|
||||
hide_mouse_cursor_pck();
|
||||
|
@ -1092,80 +1092,3 @@ bool gwinput2::run(int helpcat) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
#if defined(TESTMAIN)
|
||||
|
||||
void main() {
|
||||
|
||||
enum {
|
||||
FIELD_A,
|
||||
FIELD_B,
|
||||
FIELD_C,
|
||||
FIELD_D,
|
||||
FIELD_E
|
||||
};
|
||||
|
||||
gwindow w;
|
||||
|
||||
w.open(0, 0, gvid->numrows-1, gvid->numcols-1, 5, YELLOW|_LGREY, BLUE|_LGREY);
|
||||
|
||||
w.horizontal_line(0, 0, w.width(), 0, YELLOW|_LGREY);
|
||||
w.horizontal_line(5, 0, w.width(), 0, YELLOW|_LGREY);
|
||||
|
||||
w.prints(1, 0, BLUE|_LGREY, " Msg : 117 of 123");
|
||||
w.prints(2, 0, BLUE|_LGREY, " From : ");
|
||||
w.prints(3, 0, BLUE|_LGREY, " To : ");
|
||||
w.prints(4, 0, BLUE|_LGREY, " Subj : ");
|
||||
|
||||
gwinput* i = new gwinput(w);
|
||||
|
||||
char str_a[128] = { "Odinn Sorensen" };
|
||||
char str_b[128] = { "2:236/77" };
|
||||
char str_c[128] = { "Who Knows" };
|
||||
char str_d[128] = { "2:236/77.123" };
|
||||
char str_e[128] = { "Testing my new input class" };
|
||||
|
||||
i->idle_attr = BLUE|_LGREY;
|
||||
i->active_attr = BLACK|_LGREY;
|
||||
i->edit_attr = RED|_LGREY;
|
||||
|
||||
i->active_fill = '\xB0';
|
||||
i->edit_fill = '\xB0';
|
||||
i->fill_acs = true;
|
||||
|
||||
i->add_field(FIELD_A, 2, 8, 35, str_a, 127);
|
||||
i->add_field(FIELD_B, 2, 44, 16, str_b, 127);
|
||||
i->add_field(FIELD_C, 3, 8, 35, str_c, 127);
|
||||
i->add_field(FIELD_D, 3, 44, 16, str_d, 127);
|
||||
i->add_field(FIELD_E, 4, 8, 71, str_e, 127);
|
||||
|
||||
i->start_id = FIELD_E;
|
||||
|
||||
i->prepare_form();
|
||||
|
||||
gkey key = 0;
|
||||
do {
|
||||
|
||||
{
|
||||
// DEBUG
|
||||
char buf[256];
|
||||
sprintf(buf, "bp:%i blp:%i", i->current->buf_pos, i->current->buf_left_pos);
|
||||
wprintfs(gvid->numrows-1, 0, WHITE|_BLUE, " %-*s ", gvid->numcols-2, buf);
|
||||
}
|
||||
|
||||
key = getxch();
|
||||
} while(i->handle_key(key));
|
||||
|
||||
i->finish_form();
|
||||
|
||||
delete i;
|
||||
|
||||
window.close();
|
||||
|
||||
gvid->restore_cursor();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user