Patch level : 2.1 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Primi accenni di stampa


git-svn-id: svn://10.65.10.50/trunk@11913 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-03-25 16:36:29 +00:00
parent ae174dc58e
commit 927d84c8c0
12 changed files with 2425 additions and 1635 deletions

View File

@ -397,7 +397,11 @@ bool TQuery_mask::edit_file_in_tree()
FOR_EACH_TOKEN((*row), tok)
{
TToken_string str(tok, '.');
newrow.add(str.get(1));
str.strip_spaces();
if (str.items() > 1)
newrow.add(str.get(1));
else
newrow.add(str);
}
}
}
@ -925,7 +929,9 @@ void TQuery_mask::global_reset()
if (_tree.goto_root())
{
_tree.kill_node();
tfield(F_TABLES).win().force_update();
TTree_field& tf = tfield(F_TABLES);
tf.select_current();
tf.win().force_update();
}
reset();
}

View File

@ -24,6 +24,11 @@ const TString& TRecordset::get(const char* column_name) const
return EMPTY_STRING;
}
const TString& TRecordset::query_text() const
{
return EMPTY_STRING;
}
const TToken_string& TRecordset::sheet_head() const
{
TToken_string& head = get_tmp_string();

View File

@ -1,5 +1,9 @@
#ifndef __SQLITE_H
#define __SQLITE_H
#ifndef _RECORDSET_H
#define _RECORDSET_H
#ifndef __RECTYPES_H
#include <rectypes.h>
#endif
#ifndef __SHEET_H
#include <sheet.h>
@ -30,11 +34,17 @@ public: // Absolutely needed methods
virtual TRecnotype items() const pure;
virtual bool move_to(TRecnotype pos) pure;
virtual TRecnotype current_row() const pure;
virtual bool move_first() { return move_to(0); }
virtual bool move_prev() { return move_to(current_row()-1); }
virtual bool move_next() { return move_to(current_row()+1); }
virtual bool move_last() { return move_to(items()-1); }
virtual unsigned int columns() const pure;
virtual const TRecordset_column_info& column_info(unsigned int column) const pure;
virtual const TString& get(unsigned int column) const pure;
virtual const TString& query_text() const;
virtual const TString& get(const char* column_name) const;
virtual const TToken_string& sheet_head() const;
@ -63,7 +73,8 @@ public: // TRecordset
virtual unsigned int columns() const;
virtual const TRecordset_column_info& column_info(unsigned int c) const;
virtual const TString& get(unsigned int column) const;
const TString& query_text() const { return _sql; }
public:
void set(const char* sql);

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
#define F_TYPE 105
#define F_FLD_PROPERTIES 106
#define F_SEC_PROPERTIES 107
#define F_REP_PROPERTIES 108
#define F_X 111
#define F_Y 112
#define F_DX 113

View File

@ -89,6 +89,11 @@ BEGIN
GROUP 1
END
BUTTON F_REP_PROPERTIES 10 2
BEGIN
PROMPT -46 -1 "Generali"
END
NUMBER F_Y 3
BEGIN
PROMPT 58 -1 "Riga "

View File

@ -1,12 +1,12 @@
#include "ba8300.h"
PAGE "Campo" -1 -1 60 13
PAGE "Campo" -1 -1 60 15
RADIOBUTTON F_TYPE 1 16
BEGIN
PROMPT 1 0 "@bTipo"
ITEM "T|Testo"
MESSAGE SHOW,1@
MESSAGE SHOW,1@|HIDE,F_SOURCE
ITEM "S|Stringa"
MESSAGE SHOW,1@
ITEM "N|Numero"
@ -17,11 +17,13 @@ BEGIN
MESSAGE HIDE,1@
ITEM "R|Rettangolo"
MESSAGE HIDE,1@
ITEM "E|Ellisse"
MESSAGE HIDE,1@
ITEM "I|Immagine"
MESSAGE HIDE,1@|SHOW,F_SOURCE
END
GROUPBOX DLG_NULL 40 9
GROUPBOX DLG_NULL 40 11
BEGIN
PROMPT 18 0 "@bParametri"
END
@ -79,23 +81,29 @@ END
BUTTON F_FGCOLOR 14 1
BEGIN
PROMPT 20 6 "Colore Testo"
PROMPT 20 6 "Colore ~Testo"
END
BUTTON F_BGCOLOR 14 1
BEGIN
PROMPT 20 7 "Colore Sfondo"
PROMPT 20 7 "Colore ~Sfondo"
END
BUTTON F_FONT_SELECT 14 2
BEGIN
PROMPT 20 8 "~Font"
GROUP 1
END
STRING F_TEXT 196 50
BEGIN
PROMPT 1 9 "Formato "
PROMPT 1 12 "Formato "
GROUP 1
END
STRING F_SOURCE 80 50
BEGIN
PROMPT 1 10 "Dato "
PROMPT 1 13 "Dato "
GROUP 1
END

29
ba/ba8300d.uml Executable file
View File

@ -0,0 +1,29 @@
#include "ba8300.h"
PAGE "Report" -1 -1 60 13
NUMBER F_DY 2
BEGIN
PROMPT 1 1 "Linee per pollice "
CHEKCTYPE REQUIRED
END
BUTTON F_FONT_SELECT 10 2
BEGIN
PROMPT 1 3 "~Font"
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

File diff suppressed because it is too large Load Diff

View File

@ -1,221 +1,61 @@
#ifndef __PAGEPRNT_H
#define __PAGEPRNT_H
#ifndef __ASSOC_H
#include <assoc.h>
#ifndef __MASKFLD_H
#include <maskfld.h>
#endif
#ifndef __WINDOW_H
#include <window.h>
#ifndef __TREE_H
#include <tree.h>
#endif
#ifndef __REPORT_H
#include "ba8302.h"
#endif
///////////////////////////////////////////////////////////
// TReport_font
// TReport_tree
///////////////////////////////////////////////////////////
class TReport_font : public TObject
{
enum { DEFAULT_FONT_SIZE = 10 };
TString _name;
int _size, _cpi;
XVT_FONT_STYLE_MASK _style;
WINDOW _win_mapped;
XVT_FNTID _fontid;
protected:
void copy(const TReport_font& f);
public:
const TString& name() const { return _name; }
int size() const { return _size; }
XVT_FONT_STYLE_MASK style() const { return _style; }
int cpi() const { return _cpi; }
XVT_FNTID get_xvt_font(const TWindow& win) const;
void create(const char* name, int size, XVT_FONT_STYLE_MASK style);
TReport_font& operator=(const TReport_font& f) { copy(f); return *this; }
TReport_font();
TReport_font(const TReport_font& f) { copy(f); }
virtual ~TReport_font();
};
class TReport;
class TReport_field;
class TReport_section : public TArray
class TReport_tree : public TBidirectional_tree
{
TReport& _report;
char _type; // Head,Body,Tail
int _level; // 0,1,2,...
short _width, _height; // In centesimi
TString _groupby;
bool _hidden_if_needed;
TReport_font* _font;
TString4 _curr;
protected:
TReport_section* father_section() const;
virtual bool get_description(TString& str) const;
virtual TImage* image(bool selected) const;
virtual void node2id(const TObject* node, TString& id) const;
public:
virtual int add(TObject* obj);
virtual int add(TObject& obj);
TReport_field& field(int i) { return *(TReport_field*)objptr(i); }
const TReport_field& field(int i) const { return *(TReport_field*)objptr(i); }
TReport& report() { return _report; }
char type() const { return _type; }
int level() const { return _level; }
const TReport_font& font() const;
virtual bool goto_root();
virtual bool goto_firstson();
virtual bool goto_rbrother();
virtual bool goto_node(const TString &id);
virtual bool has_son() const;
virtual bool has_rbrother() const;
virtual TObject* curr_node() const { return (TObject*)&_curr; }
short width() const { return _width; }
short height() const { return _height; }
void set_width(short w) { _width = w; }
void set_height(short h) { _height = h; }
bool get_rect(RCT& rct) const;
virtual bool has_root() const;
virtual bool has_father() const;
virtual bool has_lbrother() const;
virtual bool goto_father();
virtual bool goto_lbrother();
const TString& grouped_by() const { return _groupby; }
void group_by(const char* gb) { _groupby = gb; }
TReport_section& curr_section() const;
bool goto_node(char type, int level);
bool hidden_if_needed() const { return _hidden_if_needed; }
void hide_if_needed(bool h) { _hidden_if_needed = h; }
void set_font(const char* name, int size, XVT_FONT_STYLE_MASK style);
TReport_section(TReport& r, char t, int l);
virtual ~TReport_section();
int image_height() const;
TReport_tree(TReport& r) : _report(r) { goto_root(); }
};
class TReport_field : public TObject
{
TReport_section* _section;
char _type; // Text, String, Numeric, Date, Line, Rectangle, Image
short _x, _y; // Coordinate in centesimi
short _width, _height; // Dimensioni in centesimi
COLOR _fgcolor, _bgcolor;
short _border;
char _halign, _valign;
TString _picture, _field;
///////////////////////////////////////////////////////////
// TReport_drawer
///////////////////////////////////////////////////////////
TReport_font* _font;
bool _selected;
protected:
void copy(const TReport_field& rf);
public:
virtual TObject* dup() const { return new TReport_field(*this); }
TReport_field& operator=(const TReport_field& rf) { copy(rf); return *this; }
TReport_section& section() { return *_section; }
void set_section(TReport_section* sec) { _section = sec; }
char type() const { return _type; }
const char* type_name() const;
const TReport_font& font() const;
const TString& picture() const { return _picture; }
void set_picture(const char* str) { _picture = str; }
const TString& field() const { return _field; }
void set_field(const char* str) { _field = str; }
void set_type(char t) { _type = t; }
void set_pos(short x, short y);
void set_row(short y) { _y = y; }
void set_column(short x) { _x = x; }
void set_size(short w, short h);
void set_width(short dx) { _width = dx; }
void set_height(short dy) { _height = dy; }
void get_rect(RCT& rct) const;
void set_fore_color(COLOR c) { _fgcolor = c; }
COLOR fore_color() const { return _fgcolor; }
void set_back_color(COLOR c) { _bgcolor = c; }
COLOR back_color() const { return _bgcolor; }
void set_border(short b) { _border = b; }
short border() const { return _border; }
void set_horizontal_alignment(char a) { _halign = a; }
char horizontal_alignment() const { return _halign; }
void set_vertical_alignment(char a) { _valign = a; }
char vertical_alignment() const { return _valign; }
void select(bool ok = true) { _selected = ok; }
bool selected() const { return _selected; }
void offset(const TPoint& pt);
virtual void draw_rect(TWindow& win) const;
virtual void draw_text(TWindow& win, const char* text) const;
virtual void draw(TWindow& win) const;
TReport_field();
TReport_field(const TXmlItem& item);
TReport_field(const TReport_field& rf) { copy(rf); }
};
class TReport : public TObject
{
TAssoc_array _sections;
TFilename _path;
TString _description, _sql;
TReport_font _font;
int _lpi; // Lines per inch
protected:
void build_section_key(char type, int level, TString& key) const;
void load_sections(const TXmlItem& xml);
short get_num_attr(const TXmlItem& item, const char* attr, short def = 0) const;
COLOR get_col_attr(const TXmlItem& item, const char* attr, COLOR defcol = COLOR_BLACK) const;
public:
TReport_section* find_section(char type, int level) const;
TReport_section& section(char type, int level);
bool kill_section(char type, int level);
int find_max_level() const;
TReport_font& font() { return _font; }
int cpi() const { return _font.cpi(); }
int lpi() const { return _lpi; }
void set_sql(const char* sql);
const TString& sql() const { return _sql; }
void set_description(const char* d);
const TString& description() const { return _description; }
bool load(const char* fname);
void destroy();
TReport();
};
class TPage_printer : public TWindow
class TReport_drawer : public TWindowed_field
{
protected:
long _pw, _ph, _phr, _pvr; // Printer width, height, horizontal and vertical resolution
word _copies;
word _pagefrom;
word _pageto;
bool _aborted;
virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent);
public:
virtual int pages() const pure;
virtual bool print_page(int p) pure;
virtual const char* form_name() const;
virtual const char* font_name() const;
virtual int font_size() const;
virtual bool ask_pages();
virtual bool print();
TPage_printer();
virtual ~TPage_printer();
void set_report(TReport* rep);
TReport_drawer(TMask* m) : TWindowed_field(m) { }
};
#endif

1014
ba/ba8302.cpp Executable file

File diff suppressed because it is too large Load Diff

281
ba/ba8302.h Executable file
View File

@ -0,0 +1,281 @@
#ifndef __REPORT_H
#define __REPORT_H
#ifndef __ASSOC_H
#include <assoc.h>
#endif
#ifndef __WINDOW_H
#include <window.h>
#endif
#ifndef __XML_H
#include <xml.h>
#endif
///////////////////////////////////////////////////////////
// TReport_font
///////////////////////////////////////////////////////////
class TReport_font : public TSortable
{
enum { DEFAULT_FONT_SIZE = 10 };
TString _name;
int _size, _cpi;
XVT_FONT_STYLE_MASK _style;
WINDOW _win_mapped;
XVT_FNTID _fontid;
int _leading, _ascent, _descent;
protected:
virtual int compare(const TSortable& s) const;
void copy(const TReport_font& f);
public:
const TString& name() const { return _name; }
int size() const { return _size; }
XVT_FONT_STYLE_MASK style() const { return _style; }
int cpi() const { return _cpi; }
XVT_FNTID get_xvt_font(const TWindow& win) const;
int leading() const { return _leading; }
int ascent() const { return _ascent; }
int descent() const { return _descent; }
void save(TXmlItem& root) const;
bool load(const TXmlItem& root);
void create(const char* name, int size, XVT_FONT_STYLE_MASK style);
TReport_font& operator=(const TReport_font& f) { copy(f); return *this; }
TReport_font();
TReport_font(const TReport_font& f);
virtual ~TReport_font();
};
class TReport;
class TReport_field;
enum TReport_draw_mode { rdm_edit, rdm_print, rdm_print_preview };
class TReport_section : public TArray
{
TReport& _report;
char _type; // Head,Body,Tail
int _level; // 0,1,2,...
short _width, _height; // In centesimi
TString _groupby;
bool _hidden_if_needed;
TReport_font* _font;
protected:
TReport_section* father_section() const;
public:
virtual int add(TObject* obj);
virtual int add(TObject& obj);
TReport_field& field(int i) { return *(TReport_field*)objptr(i); }
const TReport_field& field(int i) const { return *(TReport_field*)objptr(i); }
TReport& report() { return _report; }
char type() const { return _type; }
int level() const { return _level; }
short width() const { return _width; }
short height() const { return _height; }
void set_width(short w) { _width = w; }
void set_height(short h) { _height = h; }
bool get_rect(RCT& rct) const;
const TString& grouped_by() const { return _groupby; }
void group_by(const char* gb) { _groupby = gb; }
bool hidden_if_needed() const { return _hidden_if_needed; }
void hide_if_needed(bool h) { _hidden_if_needed = h; }
bool has_font() const { return _font != NULL; }
const TReport_font& font() const;
void set_font(const TReport_font& f);
void compute_values();
void draw(TWindow& win, TReport_draw_mode mode) const;
TReport_section(TReport& r, char t, int l);
virtual ~TReport_section();
};
class TReport_field : public TObject
{
TReport_section* _section;
char _type; // Text, String, Numeric, Date, Line, Rectangle, Image
short _x, _y; // Coordinate in centesimi
short _width, _height; // Dimensioni in centesimi
COLOR _fgcolor, _bgcolor;
short _border;
char _halign, _valign;
TString _picture, _field;
TString _value;
TReport_font* _font;
bool _selected;
protected:
void copy(const TReport_field& rf);
public:
virtual TObject* dup() const { return new TReport_field(*this); }
TReport_field& operator=(const TReport_field& rf) { copy(rf); return *this; }
TReport_section& section() { return *_section; }
void set_section(TReport_section* sec) { _section = sec; }
char type() const { return _type; }
const char* type_name() const;
bool has_font() const { return _font != NULL; }
const TReport_font& font() const;
void set_font(const TReport_font& f);
const TString& picture() const { return _picture; }
void set_picture(const char* str) { _picture = str; }
const TString& field() const { return _field; }
void set_field(const char* str) { _field = str; }
bool compute_value();
void set_type(char t) { _type = t; }
void set_pos(short x, short y);
void set_row(short y) { _y = y; }
void set_column(short x) { _x = x; }
void set_size(short w, short h);
void set_width(short dx) { _width = dx; }
void set_height(short dy) { _height = dy; }
void get_rect(RCT& rct) const;
void set_fore_color(COLOR c) { _fgcolor = c; }
COLOR fore_color() const { return _fgcolor; }
void set_back_color(COLOR c) { _bgcolor = c; }
COLOR back_color() const { return _bgcolor; }
void set_border(short b) { _border = b; }
short border() const { return _border; }
void set_horizontal_alignment(char a) { _halign = a; }
char horizontal_alignment() const { return _halign; }
void set_vertical_alignment(char a) { _valign = a; }
char vertical_alignment() const { return _valign; }
void select(bool ok = true) { _selected = ok; }
bool selected() const { return _selected; }
void offset(const TPoint& pt);
virtual void draw_rect(TWindow& win) const;
virtual void draw_text(TWindow& win, const char* text) const;
virtual void draw(TWindow& win, TReport_draw_mode mode) const;
void save(TXmlItem& root) const;
bool load(const TXmlItem& root);
TReport_field(TReport_section* sec);
TReport_field(const TReport_field& rf);
virtual ~TReport_field();
};
class TRecordset;
class TReport : public TObject
{
TAssoc_array _sections;
TFilename _path;
TString _description;
TReport_font _font;
int _lpi; // Lines per inch
TRecordset* _recordset;
protected:
void build_section_key(char type, int level, TString& key) const;
short get_num_attr(const TXmlItem& item, const char* attr, short def = 0) const;
COLOR get_col_attr(const TXmlItem& item, const char* attr, COLOR defcol = COLOR_BLACK) const;
void load_sections(const TXmlItem& xml);
void save_section(const TReport_section& rs, TXmlItem& item) const;
public:
TReport_section* find_section(char type, int level) const;
TReport_section& section(char type, int level);
bool kill_section(char type, int level);
int find_max_level(char type) const;
const TReport_font& font() const { return _font; }
void set_font(const TReport_font& f) { _font = f; }
int cpi() const { return _font.cpi(); }
int lpi() const { return _lpi; }
void set_lpi(int lpi) { _lpi= lpi; }
bool set_recordset(const TString& sql);
bool set_recordset(TRecordset* sql);
TRecordset* recordset() const { return _recordset; }
void set_description(const char* d) { _description = d; }
const TString& description() const { return _description; }
const TFilename& filename() const { return _path; }
bool save(const char* fname) const;
bool load(const char* fname);
void destroy();
TReport();
virtual ~TReport();
};
class TPage_printer : public TWindow
{
protected:
long _pw, _ph, _phr, _pvr; // Printer width, height, horizontal and vertical resolution
word _copies, _pagefrom, _pageto;
bool print_band(word page, const RCT& rct);
protected:
virtual const char* form_name() const;
virtual const char* font_name() const;
virtual int font_size() const;
virtual bool ask_pages();
public:
virtual word pages() const pure;
virtual bool print_page(word p) pure;
virtual bool print_loop(); // Internal use only
virtual bool print(); // Use this
TPage_printer();
virtual ~TPage_printer();
};
class TReport_printer : public TPage_printer
{
TReport& _report;
TPoint _delta;
double _kx, _ky;
protected:
virtual const char* form_name() const;
virtual const char* font_name() const;
virtual int font_size() const;
virtual PNT log2dev(long x, long y) const;
virtual TPoint dev2log(const PNT& p) const;
public:
virtual word pages() const;
virtual bool print_page(word p);
TReport_printer(TReport& r) : _report(r) { }
};
void advanced_draw_rect(TWindow& win, const RCT& r, int border, COLOR fore, COLOR back);
void advanced_draw_text(TWindow& win, const char* text, const RCT& r,
char halign, char valign);
#endif