text.cpp Sostituito == -1 con < 0

text.h      Aggiunti cast per evitare warnings a 32 bit
utility.*   Aggiunta funzione input_filename
viswin.cpp  Sostituite varie printat con stringat
window.cpp  Aumentato buffer per printat da 128 a 256 byte


git-svn-id: svn://10.65.10.50/trunk@6354 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-03-13 10:44:43 +00:00
parent a411177e90
commit 3251e4e4ba
6 changed files with 32 additions and 15 deletions

View File

@ -541,7 +541,7 @@ const char *TTextfile::line_formatted(
long TTextfile::get_attribute (int pos)
{
long stl = 0;
if (pos == -1)
if (pos < 0)
{
CHECK (_item > 0, "must execute piece() before style()!");
stl = _styles[_item - 1];

View File

@ -164,7 +164,7 @@ public:
// @cmember Ritorna il pezzo di testo indicato (da <p form> a <p to>), allochera' un altro
// TText che deve essere disfatto dall'utente.
TTextfile* section(TPoint& from, TPoint& to)
TTextfile* section(TPoint&, TPoint&)
{ return this; }
// @cmember Ritorna il nome del file su cui si sta lavorando
const char* name()

View File

@ -168,6 +168,25 @@ int list_files(
return count;
}
bool input_filename(TFilename& file)
{
DIRECTORY dir;
FILE_SPEC fs;
xvt_fsys_get_dir(&dir);
xvt_fsys_get_dir(&fs.dir);
strcpy(fs.type, file.ext());
strcpy(fs.name, file);
strcpy(fs.creator, "AGA");
const bool good = xvt_dm_post_file_open(&fs, "Selezionare il file ...") == FL_OK;
xvt_fsys_set_dir(&dir);
if (good)
file = fs.name;
return good;
}
#endif
// Certified 99%

View File

@ -17,6 +17,7 @@ long fsize(const char* file);
bool make_dir(const char* file);
int list_files(const char* mask, TString_array& result);
bool input_filename(TFilename& file);
const char* encode(const char* data);
const char* decode(const char* data);

View File

@ -704,7 +704,7 @@ void TViswin::paint_background(
const char* line = pr.background_chars(rw);
set_color (COLOR_BLACK, COLOR_WHITE);
if (line != NULL && (int)strlen(line) > ox)
printat (X_OFFSET, row, "%s", &line[ox]);
stringat (X_OFFSET, row, &line[ox]);
// return;
}
if (!isbackground)
@ -916,16 +916,12 @@ void TViswin::paint_row (long j)
_txt.read_line (j, origin().x);
while ((cp = _txt.piece ()) != NULL)
{
#if XVT_OS != XVT_OS_SCOUNIX
const int st = _txt.get_style();
const COLOR bg = trans_color (_txt.get_background());
const COLOR fg = trans_color (_txt.get_foreground());
set_font(PRINT_FONT, st, PRINT_HEIGHT);
set_color(fg, bg);
#else
set_color (COLOR_BLACK, COLOR_WHITE);
#endif
printat (X_OFFSET+pos, row, "%s", cp);
stringat(X_OFFSET+pos, row, cp);
pos += strlen (cp);
}
@ -933,7 +929,7 @@ void TViswin::paint_row (long j)
{
set_color (COLOR_BLACK, COLOR_WHITE);
TString80 fill; fill.spaces(80);
printat (X_OFFSET+pos, row, fill);
stringat(X_OFFSET+pos, row, fill);
}
if ((j % _formlen) == (_formlen - 1) && _toplevel) // last row
@ -1009,9 +1005,9 @@ void TViswin::paint_column (
COLOR bg = trans_color (_txt.get_background ((int) j));
COLOR fg = trans_color (_txt.get_foreground ((int) j));
set_color (fg, bg);
printat (col, riga_scr, "%c",
(unsigned int) j < strlen (c) ? c[(int) j] : ' ');
char str[2] = { (unsigned int)j < strlen (c) ? c[(int)j] : ' ', '\0' };
stringat (col, riga_scr, str);
}
xvt_dwin_set_clip(win(), NULL);

View File

@ -1013,14 +1013,15 @@ void TWindow::stringat(short x, short y, const char* str)
// @doc EXTERNAL
// @mfunc Scrive il testo formattato nella finestra all posizione indicata
// @mfunc Scrive il testo formattato nella finestra alla posizione indicata
void TWindow::printat(
short x, // @parm Coordinata x della finestra in cui scrivere il testo
short y, // @parm Coordinata y della finestra in cui scrivere il testo
const char* fmt, // @parm Formato che deve essere dato al testo
...) // @parmvar Uno o piu' parametri corrispondenti ai codici in <p fmt>
{
char tmp[128];
{
TString str(256);
char* tmp = str.get_buffer();
va_list argptr;
va_start(argptr, fmt);
vsprintf(tmp, fmt, argptr);