Patch level : 2.1 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento : Corretta duplicazione campi git-svn-id: svn://10.65.10.50/trunk@12182 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
dcd927717e
commit
3c0c826b57
@ -511,8 +511,10 @@ void TReport_window::snap(TRectangle& rct, bool shift) const
|
|||||||
#define POPUP_CLEAR 20887
|
#define POPUP_CLEAR 20887
|
||||||
#define POPUP_ZOOMIN 20888
|
#define POPUP_ZOOMIN 20888
|
||||||
#define POPUP_ZOOMOUT 20889
|
#define POPUP_ZOOMOUT 20889
|
||||||
#define POPUP_PROPERTIES 20890
|
#define POPUP_SELALL 20890
|
||||||
#define POPUP_NEWFIELD 20891
|
#define POPUP_UNSELALL 20891
|
||||||
|
#define POPUP_PROPERTIES 20892
|
||||||
|
#define POPUP_NEWFIELD 20893
|
||||||
|
|
||||||
bool TReport_window::on_key(KEY k)
|
bool TReport_window::on_key(KEY k)
|
||||||
{
|
{
|
||||||
@ -585,21 +587,25 @@ void TReport_window::popup_menu()
|
|||||||
MENU_ITEM menu[16]; // Stiamo larghi
|
MENU_ITEM menu[16]; // Stiamo larghi
|
||||||
memset(menu, 0, sizeof(menu));
|
memset(menu, 0, sizeof(menu));
|
||||||
|
|
||||||
TRectangle rct;
|
TRectangle rct;
|
||||||
const bool sel = get_selection_rect(rct) != 0;
|
const bool ful = curr_section().items() > 0;
|
||||||
|
const bool sel = ful && get_selection_rect(rct) != 0;
|
||||||
const bool clp = _clipboard.items() > 0;
|
const bool clp = _clipboard.items() > 0;
|
||||||
|
|
||||||
menu[0].tag = POPUP_CUT; menu[0].text = (char*)TR("Taglia"); menu[0].enabled = sel;
|
menu[ 0].tag = POPUP_CUT; menu[ 0].text = (char*)TR("Taglia"); menu[0].enabled = sel;
|
||||||
menu[1].tag = POPUP_COPY; menu[1].text = (char*)TR("Copia"); menu[1].enabled = sel;
|
menu[ 1].tag = POPUP_COPY; menu[ 1].text = (char*)TR("Copia"); menu[1].enabled = sel;
|
||||||
menu[2].tag = POPUP_PASTE; menu[2].text = (char*)TR("Incolla"); menu[2].enabled = clp;
|
menu[ 2].tag = POPUP_PASTE; menu[ 2].text = (char*)TR("Incolla"); menu[2].enabled = clp;
|
||||||
menu[3].tag = POPUP_DUP; menu[3].text = (char*)TR("Duplica"); menu[3].enabled = sel;
|
menu[ 3].tag = POPUP_DUP; menu[ 3].text = (char*)TR("Duplica"); menu[3].enabled = sel;
|
||||||
menu[4].tag = POPUP_CLEAR; menu[4].text = (char*)TR("Cancella"); menu[4].enabled = sel;
|
menu[ 4].tag = POPUP_CLEAR; menu[ 4].text = (char*)TR("Cancella"); menu[4].enabled = sel;
|
||||||
menu[5].tag = -1; menu[5].separator = true;
|
menu[ 5].tag = -1; menu[ 5].separator = true;
|
||||||
menu[6].tag = POPUP_ZOOMIN; menu[6].text = (char*)TR("Zoom +"); menu[6].enabled = _dpi.v < 300;
|
menu[ 6].tag = POPUP_ZOOMIN; menu[ 6].text = (char*)TR("Zoom +"); menu[6].enabled = _dpi.v < 300;
|
||||||
menu[7].tag = POPUP_ZOOMOUT; menu[7].text = (char*)TR("Zoom -"); menu[7].enabled = _dpi.v > 48;
|
menu[ 7].tag = POPUP_ZOOMOUT; menu[ 7].text = (char*)TR("Zoom -"); menu[7].enabled = _dpi.v > 48;
|
||||||
menu[8].tag = -1; menu[8].separator = true;
|
menu[ 8].tag = -1; menu[ 8].separator = true;
|
||||||
menu[9].tag = POPUP_PROPERTIES; menu[9].text = "Proprieta'"; menu[9].enabled = true;
|
menu[ 9].tag = POPUP_SELALL; menu[ 9].text = (char*)TR("Seleziona tutto"); menu[ 9].enabled = ful;
|
||||||
menu[10].tag = POPUP_NEWFIELD; menu[10].text = "Nuovo"; menu[10].enabled = true;
|
menu[10].tag = POPUP_UNSELALL; menu[10].text = (char*)TR("Deseleziona tutto"); menu[10].enabled = ful;
|
||||||
|
menu[11].tag = -1; menu[11].separator = true;
|
||||||
|
menu[12].tag = POPUP_PROPERTIES; menu[12].text = "Proprieta'"; menu[12].enabled = true;
|
||||||
|
menu[13].tag = POPUP_NEWFIELD; menu[13].text = "Nuovo"; menu[13].enabled = true;
|
||||||
|
|
||||||
_pt_drag_start = dev2log(_pt_click);
|
_pt_drag_start = dev2log(_pt_click);
|
||||||
xvt_menu_popup(menu, win(), _pt_click, XVT_POPUP_CENTER, 0);
|
xvt_menu_popup(menu, win(), _pt_click, XVT_POPUP_CENTER, 0);
|
||||||
@ -614,7 +620,8 @@ void TReport_window::popup_cut()
|
|||||||
TReport_field& f = *(TReport_field*)o;
|
TReport_field& f = *(TReport_field*)o;
|
||||||
if (f.selected())
|
if (f.selected())
|
||||||
{
|
{
|
||||||
TObject* obj = rs.remove(i, true);
|
TReport_field* obj = (TReport_field*)rs.remove(i, true);
|
||||||
|
obj->set_section(NULL);
|
||||||
_clipboard.add(obj);
|
_clipboard.add(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -629,7 +636,11 @@ void TReport_window::popup_copy()
|
|||||||
{
|
{
|
||||||
TReport_field& f = *(TReport_field*)o;
|
TReport_field& f = *(TReport_field*)o;
|
||||||
if (f.selected())
|
if (f.selected())
|
||||||
_clipboard.add(f);
|
{
|
||||||
|
TReport_field* cp = new TReport_field(f);
|
||||||
|
cp->set_section(NULL);
|
||||||
|
_clipboard.add(cp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,8 +656,6 @@ void TReport_window::popup_paste()
|
|||||||
{
|
{
|
||||||
const TReport_field& oldf = *(TReport_field*)o;
|
const TReport_field& oldf = *(TReport_field*)o;
|
||||||
TReport_field* newf = new TReport_field(oldf);
|
TReport_field* newf = new TReport_field(oldf);
|
||||||
newf->set_section(&rs);
|
|
||||||
newf->set_font(oldf.font()); // Font is section dependent!
|
|
||||||
newf->select();
|
newf->select();
|
||||||
newf->offset(off);
|
newf->offset(off);
|
||||||
rs.add(newf);
|
rs.add(newf);
|
||||||
@ -872,6 +881,28 @@ void TReport_window::handler(WINDOW win, EVENT* ep)
|
|||||||
case POPUP_ZOOMOUT:
|
case POPUP_ZOOMOUT:
|
||||||
do_zoom(-24, true);
|
do_zoom(-24, true);
|
||||||
break;
|
break;
|
||||||
|
case POPUP_SELALL:
|
||||||
|
{
|
||||||
|
TReport_section& rs = curr_section();
|
||||||
|
FOR_EACH_ARRAY_ITEM(rs, i, o)
|
||||||
|
{
|
||||||
|
TReport_field& f = *(TReport_field*)o;
|
||||||
|
f.select();
|
||||||
|
}
|
||||||
|
force_update();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case POPUP_UNSELALL:
|
||||||
|
{
|
||||||
|
TReport_section& rs = curr_section();
|
||||||
|
FOR_EACH_ARRAY_ITEM(rs, i, o)
|
||||||
|
{
|
||||||
|
TReport_field& f = *(TReport_field*)o;
|
||||||
|
f.select(false);
|
||||||
|
}
|
||||||
|
force_update();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case POPUP_PROPERTIES:
|
case POPUP_PROPERTIES:
|
||||||
{
|
{
|
||||||
clear_selection();
|
clear_selection();
|
||||||
|
@ -959,7 +959,7 @@ void TReport_field::set_font(const TReport_font& f)
|
|||||||
delete _font;
|
delete _font;
|
||||||
_font = NULL;
|
_font = NULL;
|
||||||
}
|
}
|
||||||
if (f != font())
|
if (_section == NULL || f != font())
|
||||||
_font = new TReport_font(f);
|
_font = new TReport_font(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -991,7 +991,6 @@ void TReport_field::set_postscript(const char* src)
|
|||||||
|
|
||||||
void TReport_field::copy(const TReport_field& rf)
|
void TReport_field::copy(const TReport_field& rf)
|
||||||
{
|
{
|
||||||
_section = rf._section;
|
|
||||||
_id = rf.id();
|
_id = rf.id();
|
||||||
_type = rf.type();
|
_type = rf.type();
|
||||||
_rct = rf._rct;
|
_rct = rf._rct;
|
||||||
@ -1007,8 +1006,9 @@ void TReport_field::copy(const TReport_field& rf)
|
|||||||
_prescript = rf._prescript;
|
_prescript = rf._prescript;
|
||||||
_postscript = rf._postscript;
|
_postscript = rf._postscript;
|
||||||
_list = rf._list;
|
_list = rf._list;
|
||||||
|
if (rf._font != NULL)
|
||||||
set_font(rf.font());
|
set_font(*rf._font);
|
||||||
|
_draw_hidden = _draw_deactivated = false;
|
||||||
_selected = false;
|
_selected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1317,6 +1317,13 @@ void TReport_field::print(TBook& book) const
|
|||||||
book.draw_text(get_draw_rect(), _picture);
|
book.draw_text(get_draw_rect(), _picture);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'N':
|
||||||
|
if (field() == "#BOOKPAGES")
|
||||||
|
{
|
||||||
|
print_rect(book);
|
||||||
|
book.draw_book_pages(get_draw_rect());
|
||||||
|
break;
|
||||||
|
}
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
print_rect(book);
|
print_rect(book);
|
||||||
@ -1530,10 +1537,13 @@ TReport_field::TReport_field(TReport_section* sec)
|
|||||||
: _section(sec), _id(0), _type('T'), _rct(0,0,1000,100),
|
: _section(sec), _id(0), _type('T'), _rct(0,0,1000,100),
|
||||||
_fgcolor(COLOR_BLACK), _bgcolor(COLOR_WHITE), _radius(0), _pattern(PAT_SOLID),
|
_fgcolor(COLOR_BLACK), _bgcolor(COLOR_WHITE), _radius(0), _pattern(PAT_SOLID),
|
||||||
_border(0), _halign('L'), _valign('T'),_dynamic_height(false), _font(NULL),
|
_border(0), _halign('L'), _valign('T'),_dynamic_height(false), _font(NULL),
|
||||||
_hidden(false), _deactivated(false), _hide_zeroes(false), _selected(false)
|
_hidden(false), _deactivated(false), _hide_zeroes(false), _selected(false),
|
||||||
|
_draw_hidden(false), _draw_deactivated(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
TReport_field::TReport_field(const TReport_field& rf) : _font(NULL)
|
TReport_field::TReport_field(const TReport_field& rf)
|
||||||
|
: _section(NULL), _font(NULL), _draw_hidden(false), _draw_deactivated(false)
|
||||||
|
|
||||||
{
|
{
|
||||||
copy(rf);
|
copy(rf);
|
||||||
}
|
}
|
||||||
|
@ -773,6 +773,12 @@ void TBook::draw_text(const TRectangle& r, const char* txt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TBook::draw_book_pages(const TRectangle& r)
|
||||||
|
{
|
||||||
|
define_frame(r);
|
||||||
|
*_out << "<pages/>" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
void TBook::set_pen(COLOR color, int width, PEN_STYLE style)
|
void TBook::set_pen(COLOR color, int width, PEN_STYLE style)
|
||||||
{
|
{
|
||||||
if (_tools.pen.color != color || _tools.pen.width != width || _tools.pen.style != style)
|
if (_tools.pen.color != color || _tools.pen.width != width || _tools.pen.style != style)
|
||||||
@ -1019,6 +1025,7 @@ bool TBook::print_page(TWindow& win, size_t page)
|
|||||||
TImage* img = _images.image(name);
|
TImage* img = _images.image(name);
|
||||||
if (img != NULL)
|
if (img != NULL)
|
||||||
img->draw(win.win(), rct);
|
img->draw(win.win(), rct);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (str == "<line/>")
|
if (str == "<line/>")
|
||||||
{
|
{
|
||||||
@ -1026,6 +1033,13 @@ bool TBook::print_page(TWindow& win, size_t page)
|
|||||||
PNT to = { rct.bottom, rct.right };
|
PNT to = { rct.bottom, rct.right };
|
||||||
xvt_dwin_draw_set_pos(win.win(), fr);
|
xvt_dwin_draw_set_pos(win.win(), fr);
|
||||||
xvt_dwin_draw_line(win.win(), to);
|
xvt_dwin_draw_line(win.win(), to);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (str == "<pages/>")
|
||||||
|
{
|
||||||
|
TString8 str; str.format("%u", pages());
|
||||||
|
advanced_draw_text(win, str, rct, _horizontal_alignment, _vertical_alignment);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (str.starts_with("<pen "))
|
if (str.starts_with("<pen "))
|
||||||
{
|
{
|
||||||
@ -1193,6 +1207,17 @@ bool TBook::export_text(const TFilename& fname) const
|
|||||||
ofs << endl;
|
ofs << endl;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
if (str == "<pages/>")
|
||||||
|
{
|
||||||
|
TString8 str; str.format("%u", pages());
|
||||||
|
TString& line = page.row(row);
|
||||||
|
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 == "<text>")
|
if (str == "<text>")
|
||||||
{
|
{
|
||||||
TString stringona;
|
TString stringona;
|
||||||
|
@ -47,6 +47,7 @@ public:
|
|||||||
void draw_image(const TRectangle& rect, const char* filename);
|
void draw_image(const TRectangle& rect, const char* filename);
|
||||||
void draw_text(const TRectangle& rect, const char* text);
|
void draw_text(const TRectangle& rect, const char* text);
|
||||||
void draw_link(const TRectangle& rect, const char* text, const char* link);
|
void draw_link(const TRectangle& rect, const char* text, const char* link);
|
||||||
|
void draw_book_pages(const TRectangle& r);
|
||||||
|
|
||||||
TPoint page_size() const;
|
TPoint page_size() const;
|
||||||
TPoint page_res() const;
|
TPoint page_res() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user