Patch level : 2.1 66

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Migliorate selezioni campi


git-svn-id: svn://10.65.10.50/trunk@12179 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-06-11 14:16:21 +00:00
parent da591c3a6e
commit 0126346ff7
2 changed files with 88 additions and 57 deletions

View File

@ -318,7 +318,7 @@ class TReport_window : public TField_window
int _dragging;
TPoint _pt_drag_start;
PNT _pt_drag_offset;
PNT _pt_click, _pt_drag_offset;
RCT _rct_drag;
TArray _clipboard;
@ -337,7 +337,7 @@ protected:
void draw_field(const TReport_field& rf);
void draw_broken_paper(const TReport_field& rf);
void popup_menu(EVENT* ep);
void popup_menu();
void popup_cut();
void popup_copy();
void popup_paste();
@ -377,7 +377,7 @@ bool TReport_window::pick(const TPoint& ptlog) const
{
TReport_section& rs = curr_section();
FOR_EACH_ARRAY_ITEM(rs, i, o)
FOR_EACH_ARRAY_ITEM_BACK(rs, i, o)
{
TReport_field& f = *(TReport_field*)o;
const TRectangle& rct = f.get_rect();
@ -505,48 +505,56 @@ void TReport_window::snap(TRectangle& rct, bool shift) const
#define POPUP_PASTE 20885
#define POPUP_DUP 20886
#define POPUP_CLEAR 20887
#define POPUP_PROPERTIES 20888
#define POPUP_NEWFIELD 20889
#define POPUP_ZOOMIN 20888
#define POPUP_ZOOMOUT 20889
#define POPUP_PROPERTIES 20890
#define POPUP_NEWFIELD 20891
bool TReport_window::on_key(KEY k)
{
switch (k)
{
case K_LEFT:
offset_selection(TPoint(-100, 0));
offset_selection(TPoint(-50, 0));
force_update();
return true;
case K_LEFT+K_SHIFT:
resize_selection(TPoint(-100, 0));
resize_selection(TPoint(-50, 0));
force_update();
return true;
case K_RIGHT:
offset_selection(TPoint(+100, 0));
offset_selection(TPoint(+50, 0));
force_update();
return true;
case K_RIGHT+K_SHIFT:
resize_selection(TPoint(+100, 0));
resize_selection(TPoint(+50, 0));
force_update();
return true;
case K_DOWN:
offset_selection(TPoint(0, +50));
offset_selection(TPoint(0, +25));
force_update();
return true;
case K_DOWN+K_SHIFT:
resize_selection(TPoint(0, +100));
resize_selection(TPoint(0, +25));
force_update();
return true;
case K_UP:
offset_selection(TPoint(0, -50));
offset_selection(TPoint(0, -25));
force_update();
return true;
case K_UP+K_SHIFT:
resize_selection(TPoint(0, -100));
resize_selection(TPoint(0, -25));
force_update();
return true;
case K_DEL:
dispatch_e_menu(win(), POPUP_CUT);
return true;
case '+':
dispatch_e_menu(win(), POPUP_ZOOMIN);
return true;
case '-':
dispatch_e_menu(win(), POPUP_ZOOMOUT);
return true;
case K_ENTER:
owner().mask().send_key(K_SPACE, F_FLD_PROPERTIES);
break;
@ -568,7 +576,7 @@ bool TReport_window::on_key(KEY k)
return TField_window::on_key(k);
}
void TReport_window::popup_menu(EVENT* ep)
void TReport_window::popup_menu()
{
MENU_ITEM menu[16]; // Stiamo larghi
memset(menu, 0, sizeof(menu));
@ -577,18 +585,20 @@ void TReport_window::popup_menu(EVENT* ep)
const bool sel = get_selection_rect(rct) != 0;
const bool clp = _clipboard.items() > 0;
menu[0].tag = POPUP_CUT; menu[0].text = "Taglia"; menu[0].enabled = sel;
menu[1].tag = POPUP_COPY; menu[1].text = "Copia"; menu[1].enabled = sel;
menu[2].tag = POPUP_PASTE; menu[2].text = "Incolla"; menu[2].enabled = clp;
menu[3].tag = POPUP_DUP; menu[3].text = "Duplica"; menu[3].enabled = sel;
menu[4].tag = POPUP_CLEAR; menu[4].text = "Cancella"; menu[4].enabled = sel;
menu[5].tag = -1; menu[5].separator = true;
menu[6].tag = POPUP_PROPERTIES; menu[6].text = "Proprieta'"; menu[6].enabled = true;
menu[7].tag = POPUP_NEWFIELD; menu[7].text = "Nuovo"; menu[7].enabled = true;
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[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[4].tag = POPUP_CLEAR; menu[4].text = (char*)TR("Cancella"); menu[4].enabled = sel;
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[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[9].tag = POPUP_PROPERTIES; menu[9].text = "Proprieta'"; menu[9].enabled = true;
menu[10].tag = POPUP_NEWFIELD; menu[10].text = "Nuovo"; menu[10].enabled = true;
const PNT& p = ep->v.mouse.where;
_pt_drag_start = dev2log(p);
xvt_menu_popup(menu, win(), p, XVT_POPUP_CENTER, 0);
_pt_drag_start = dev2log(_pt_click);
xvt_menu_popup(menu, win(), _pt_click, XVT_POPUP_CENTER, 0);
}
void TReport_window::popup_cut()
@ -678,9 +688,10 @@ void TReport_window::handler(WINDOW win, EVENT* ep)
switch (ep->type)
{
case E_MOUSE_DOWN:
_pt_click = ep->v.mouse.where;
if (ep->v.mouse.button == 0)
{
const TPoint pt = dev2log(ep->v.mouse.where);
const TPoint pt = dev2log(_pt_click);
TRectangle rct;
int full = get_selection_rect(rct);
if (!full || !rct.contains(pt))
@ -723,7 +734,7 @@ void TReport_window::handler(WINDOW win, EVENT* ep)
}
else
{
popup_menu(ep);
popup_menu();
}
owner().mask().notify_focus_field(owner().dlg());
break;
@ -766,38 +777,41 @@ void TReport_window::handler(WINDOW win, EVENT* ep)
draw_dragster();
PNT pt = ep->v.mouse.where;
switch (_dragging)
if (abs(pt.h-_pt_click.h) > 2 || abs(pt.v-_pt_click.v) > 2) // Mi sono veramente spostato?
{
case 1:
switch (_dragging)
{
_rct_drag.right = pt.h;
_rct_drag.bottom = pt.v;
TRectangle rct; TWindow::dev2log(_rct_drag, rct);
select(rct);
case 1:
{
_rct_drag.right = pt.h;
_rct_drag.bottom = pt.v;
TRectangle rct; TWindow::dev2log(_rct_drag, rct);
select(rct);
}
break;
case 2:
{
pt.h -= _pt_drag_offset.h;
pt.v -= _pt_drag_offset.v;
TPoint offset = dev2log(pt);
snap(offset, ep->v.mouse.shift != 0);
offset.x -= _pt_drag_start.x;
offset.y -= _pt_drag_start.y;
offset_selection(offset);
}
break;
case 3:
{
TReport_field* rf = first_selected();
TRectangle rct; TWindow::dev2log(_rct_drag, rct);
snap(rct, ep->v.mouse.shift != 0);
rf->set_pos(rct.x, rct.y);
rf->set_size(rct.width(), rct.height());
}
break;
default:
break;
}
break;
case 2:
{
pt.h -= _pt_drag_offset.h;
pt.v -= _pt_drag_offset.v;
TPoint offset = dev2log(pt);
snap(offset, ep->v.mouse.shift != 0);
offset.x -= _pt_drag_start.x;
offset.y -= _pt_drag_start.y;
offset_selection(offset);
}
break;
case 3:
{
TReport_field* rf = first_selected();
TRectangle rct; TWindow::dev2log(_rct_drag, rct);
snap(rct, ep->v.mouse.shift != 0);
rf->set_pos(rct.x, rct.y);
rf->set_size(rct.width(), rct.height());
}
break;
default:
break;
}
force_update();
_dragging = 0;
@ -825,6 +839,22 @@ void TReport_window::handler(WINDOW win, EVENT* ep)
popup_copy();
popup_paste();
break;
case POPUP_ZOOMIN:
if (_dpi.v < 300)
{
_dpi.h = _dpi.v = _dpi.v + 24;
curr_section().unmap_font();
force_update();
}
break;
case POPUP_ZOOMOUT:
if (_dpi.v > 48)
{
_dpi.h = _dpi.v = _dpi.v - 24;
curr_section().unmap_font();
force_update();
}
break;
case POPUP_PROPERTIES:
{
clear_selection();
@ -1031,7 +1061,7 @@ void TReport_window::draw_field(const TReport_field& rf)
}
if (rf.selected())
{
advanced_set_draw_tools(*this, 0, COLOR_WHITE, COLOR_LTGRAY);
advanced_set_draw_tools(*this, 0, COLOR_WHITE, COLOR_GRAY);
const int k = 5;
RCT s = r; s.right = s.left+k; s.bottom = s.top+k;
xvt_dwin_draw_rect(win(), &s);

View File

@ -87,6 +87,7 @@
DUP EMPTY= \ Controlla se e' vuoto
IF
DROP \ Scarta il valore nullo
DROP \ Scarta f1
ELSE
" " \ Inserisco uno spazio
+ \ Sommo uno spazio all'inizio della stringa