diff --git a/include/colors.cpp b/include/colors.cpp
index 3816d0a00..3337e53f3 100755
--- a/include/colors.cpp
+++ b/include/colors.cpp
@@ -46,7 +46,8 @@ COLOR blend_colors(COLOR col1, COLOR col2, double perc)
const byte g = byte(g1 * perc + g2*(1.0-perc));
const byte b = byte(b1 * perc + b2*(1.0-perc));
- return RGB2COLOR(r, g, b);
+ // return RGB2COLOR(r, g, b);
+ return MAKE_COLOR(r, g, b); // Faster
}
unsigned int color_distance(COLOR col1, COLOR col2)
diff --git a/include/recset.cpp b/include/recset.cpp
index 3fb902c38..29d953355 100755
--- a/include/recset.cpp
+++ b/include/recset.cpp
@@ -1731,25 +1731,16 @@ TCursor_parser::TCursor_parser(istream& instr, TArray& col)
if (_cursor == NULL)
_cursor = new TCursor(_relation, "", key);
- TRectype rec_start(_relation->curr());
- TRectype rec_stop(_relation->curr());
-
- pop();
- if (tok.starts_with("FR"))
- parse_region(rec_start);
- else
- push();
- pop();
- if (tok.starts_with("TO"))
- parse_region(rec_stop);
- else
- push();
- if (!rec_start.empty() || !rec_stop.empty())
- _cursor->setregion(rec_start, rec_stop, 0x2);
+ TRectype rec_start(_relation->curr().num());
+ TRectype rec_stop(rec_start);
while (true)
{
pop();
+ if (tok.starts_with("FR"))
+ parse_region(rec_start); else
+ if (tok.starts_with("TO"))
+ parse_region(rec_stop); else
if (tok.starts_with("JO"))
parse_join(); else
if (tok.starts_with("SO"))
@@ -1759,6 +1750,9 @@ TCursor_parser::TCursor_parser(istream& instr, TArray& col)
}
push();
+ if (!rec_start.empty() || !rec_stop.empty())
+ _cursor->setregion(rec_start, rec_stop, 0x2);
+
if (_relation->items() == 0) // Non ci sono anche tabelle collegate
{
FOR_EACH_ARRAY_ITEM(_column, i, obj)
diff --git a/include/report.h b/include/report.h
index bc1626dea..eee433bc4 100755
--- a/include/report.h
+++ b/include/report.h
@@ -448,7 +448,7 @@ public:
int cpi() const { return _font.cpi(); }
int lpi() const { return _lpi; }
- void set_lpi(int lpi) { _lpi= lpi; }
+ void set_lpi(int lpi) { _lpi = lpi; }
bool set_recordset(const TString& sql);
bool set_recordset(TRecordset* sql);
@@ -460,8 +460,8 @@ public:
void set_prescript(const char* src);
const TString& postscript() const;
void set_postscript(const char* src);
- bool execute_prescript();
- bool execute_postscript();
+ virtual bool execute_prescript();
+ virtual bool execute_postscript();
const TString_array& params() const { return _params; }
void set_params(const TString_array& p) { _params = p; }
diff --git a/include/reprint.cpp b/include/reprint.cpp
index a0da36758..e1df98936 100755
--- a/include/reprint.cpp
+++ b/include/reprint.cpp
@@ -965,7 +965,7 @@ bool TBook::export_text(const TFilename& fname) const
row = y * lpi() / res.y;
col = x * cpi() / res.x;
wid = dx * cpi() / res.x;
- hei = dy * cpi() / res.y;
+ hei = dy * lpi() / res.y;
} else
if (str == "")
{
@@ -973,9 +973,44 @@ bool TBook::export_text(const TFilename& fname) const
{
if (page.objptr(row) == NULL)
page.add("", row);
- TString& line = page.row(row++);
- const TString stringona(wid, '-');
- line.overwrite(stringona, col);
+ TString& line = page.row(row);
+ for (int i = 0; i < wid; i++)
+ {
+ const int j = i+col;
+ if (j >= line.len())
+ line.overwrite("-", j);
+ else
+ {
+ if (line[j] == '|')
+ line[j] = '+';
+ else
+ {
+ if (line[j] == ' ')
+ line[j] = '-';
+ }
+ }
+ }
+ } else
+ if (hei > 0 && wid == 0)
+ {
+ for (int i = row; i < row+hei; i++)
+ {
+ if (page.objptr(i) == NULL)
+ page.add("", i);
+ TString& line = page.row(i);
+ if (line.len() <= col)
+ line.overwrite("|", col);
+ else
+ {
+ if (line[col] == '-')
+ line[col] = '+';
+ else
+ {
+ if (line[col] == ' ')
+ line[col] = '|';
+ }
+ }
+ }
}
}
if (str.starts_with("")
{
+ TString stringona;
while (!ifs.eof())
{
ifs.getline(buffer, str.size());
if (str == "")
break;
- if (page.objptr(row) == NULL)
- page.add("", row);
- TString& line = page.row(row++);
+ stringona << str << '\n';
+ }
+ stringona.rtrim();
+ TParagraph_string para(stringona, wid);
+ for (int i = 0; i < hei && i < para.items(); i++)
+ {
+ const int j = row+i;
+ if (page.objptr(j) == NULL)
+ page.add("", j);
+ str = para.get();
+ TString& line = page.row(j);
switch (_horizontal_alignment)
{
case 'C': line.overwrite(str, col+(wid-str.len())/2); break;
case 'R': line.overwrite(str, col+wid-str.len()); break;
default : line.overwrite(str, col); break;
- }
+ }
}
} else
if (str.starts_with("