Patch level : 10.0
Files correlati : tutti Ricompilazione Demo : [ ] Commento : Nuova gestione list-box Windows-like git-svn-id: svn://10.65.10.50/trunk@18316 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c1f9317761
commit
96e3ab4ea0
@ -123,7 +123,7 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
|
|||||||
// Setta il vero menu principale se diverso dal default
|
// Setta il vero menu principale se diverso dal default
|
||||||
const int meno = _application->argc() > 1 ? atoi(_application->argv(1)+1) : 0;
|
const int meno = _application->argc() > 1 ? atoi(_application->argv(1)+1) : 0;
|
||||||
ignore_xvt_errors(TRUE);
|
ignore_xvt_errors(TRUE);
|
||||||
MENU_ITEM* menu = xvt_res_get_menu(MENU_BAR(meno));
|
MENU_ITEM* menu = xvt_res_get_menu(MENU_BAR_ID(meno));
|
||||||
ignore_xvt_errors(FALSE);
|
ignore_xvt_errors(FALSE);
|
||||||
if (menu)
|
if (menu)
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ep->v.cmd.tag >= BAR_ITEM(1))
|
if (ep->v.cmd.tag >= BAR_ITEM_ID(1))
|
||||||
{
|
{
|
||||||
if(!menu(ep->v.cmd.tag))
|
if(!menu(ep->v.cmd.tag))
|
||||||
stop_run();
|
stop_run();
|
||||||
@ -817,13 +817,13 @@ bool TApplication::get_next_mail(TToken_string& to, TToken_string& cc, TToken_st
|
|||||||
|
|
||||||
bool TSkeleton_application::create()
|
bool TSkeleton_application::create()
|
||||||
{
|
{
|
||||||
dispatch_e_menu(BAR_ITEM(1));
|
dispatch_e_menu(BAR_ITEM_ID(1));
|
||||||
return TApplication::create();
|
return TApplication::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TSkeleton_application::menu(MENU_TAG tag)
|
bool TSkeleton_application::menu(MENU_TAG tag)
|
||||||
{
|
{
|
||||||
if (tag == BAR_ITEM(1))
|
if (tag == BAR_ITEM_ID(1))
|
||||||
main_loop();
|
main_loop();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
#include <bagn006.h>
|
#include <bagn006.h>
|
||||||
//maschera dei collegamenti ad oggetti esterni
|
//maschera dei collegamenti ad oggetti esterni
|
||||||
|
|
||||||
TOOLBAR "" 0 -3 0 3
|
TOOLBAR "" 0 0 0 2
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
BUTTON DLG_OK 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -10,7 +10,7 @@ END
|
|||||||
|
|
||||||
BUTTON F_NEWREC 10 2
|
BUTTON F_NEWREC 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -25 -1 ""
|
PROMPT -25 -1 "~Nuovo"
|
||||||
PICTURE BMP_NEWREC
|
PICTURE BMP_NEWREC
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ END
|
|||||||
|
|
||||||
BUTTON F_PRINT 10 2
|
BUTTON F_PRINT 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -45 -1 ""
|
PROMPT -45 -1 "Stampa"
|
||||||
PICTURE BMP_PRINT
|
PICTURE BMP_PRINT
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -34,13 +34,13 @@ END
|
|||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
|
|
||||||
PAGE "Oggetti esterni" -1, -1, 76, 16
|
PAGE "Oggetti esterni" 0 2 0 0
|
||||||
|
|
||||||
SPREADSHEET F_SHEET 0 -3
|
SPREADSHEET F_SHEET 78
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 4 "Lista"
|
PROMPT 1 4 "Lista"
|
||||||
ITEM "File@35"
|
ITEM "File@35"
|
||||||
ITEM "Nome@15"
|
ITEM "Nome@20"
|
||||||
ITEM "Collegamento"
|
ITEM "Collegamento"
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ ENDPAGE
|
|||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
|
||||||
PAGE "Oggetto esterno" -1, -1, 76, 6
|
PAGE "Oggetto esterno" -1 -1 60 4
|
||||||
|
|
||||||
STRING S_FILE 256 50
|
STRING S_FILE 256 50
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -67,6 +67,10 @@ BEGIN
|
|||||||
PROMPT 1 3 "Collegamento esterno"
|
PROMPT 1 3 "Collegamento esterno"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
TOOLBAR "topbar" 0 0 0 2
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
BUTTON DLG_OK 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -16 -1 ""
|
PROMPT -16 -1 ""
|
||||||
@ -74,7 +78,7 @@ END
|
|||||||
|
|
||||||
BUTTON F_NEWREC 10 2
|
BUTTON F_NEWREC 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -26 -1 ""
|
PROMPT -26 -1 "~Nuovo"
|
||||||
PICTURE BMP_NEWREC
|
PICTURE BMP_NEWREC
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -93,7 +97,7 @@ END
|
|||||||
|
|
||||||
BUTTON F_PRINT 10 2
|
BUTTON F_PRINT 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -56 -1 ""
|
PROMPT -56 -1 "Stampa"
|
||||||
PICTURE BMP_PRINT
|
PICTURE BMP_PRINT
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
PAGE "Anteprima" 0 0 0 0
|
||||||
|
|
||||||
|
PREVIEW DLG_USER
|
||||||
|
BEGIN
|
||||||
|
PROMPT 0 0 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
TOOLBAR "Toolbar" 0 0 0 2
|
TOOLBAR "Toolbar" 0 0 0 2
|
||||||
|
|
||||||
BUTTON DLG_PRINT 10 2
|
BUTTON DLG_PRINT 10 2
|
||||||
@ -52,14 +61,5 @@ END
|
|||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
PAGE "Anteprima" 0 0 0 0
|
|
||||||
|
|
||||||
PREVIEW DLG_USER
|
|
||||||
BEGIN
|
|
||||||
PROMPT 0 0 ""
|
|
||||||
END
|
|
||||||
|
|
||||||
ENDPAGE
|
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ bool TConfig_application::create()
|
|||||||
{
|
{
|
||||||
TApplication::create();
|
TApplication::create();
|
||||||
|
|
||||||
_last_choice = BAR_ITEM(1);
|
_last_choice = BAR_ITEM_ID(1);
|
||||||
|
|
||||||
// process args
|
// process args
|
||||||
TString arg(16);
|
TString arg(16);
|
||||||
@ -41,12 +41,12 @@ bool TConfig_application::destroy()
|
|||||||
bool TConfig_application::menu(MENU_TAG m)
|
bool TConfig_application::menu(MENU_TAG m)
|
||||||
{
|
{
|
||||||
// funziona da se' fino a 20 voci della menubar
|
// funziona da se' fino a 20 voci della menubar
|
||||||
if (m >= BAR_ITEM(1) && m <= BAR_ITEM(20))
|
if (m >= BAR_ITEM_ID(1) && m <= BAR_ITEM_ID(20))
|
||||||
{
|
{
|
||||||
_last_choice = m;
|
_last_choice = m;
|
||||||
do_config((m - BAR_ITEM(0))/100);
|
do_config((m - BAR_ITEM_ID(0))/100);
|
||||||
}
|
}
|
||||||
return xvtil_test_menu_tag(BAR_ITEM(2));
|
return xvtil_test_menu_tag(BAR_ITEM_ID(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TConfig_application::user_create()
|
bool TConfig_application::user_create()
|
||||||
|
@ -16,6 +16,7 @@ extern "C"
|
|||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
|
#include <xvtility.h>
|
||||||
|
|
||||||
#include <statbar.h>
|
#include <statbar.h>
|
||||||
|
|
||||||
@ -46,60 +47,12 @@ bool TOOL_TEXT = true;
|
|||||||
bool EASY_RIDER = true;
|
bool EASY_RIDER = true;
|
||||||
bool ENTER_AS_TAB = false;
|
bool ENTER_AS_TAB = false;
|
||||||
|
|
||||||
HIDDEN bool _button_blocked = false;
|
HIDDEN bool _ddl_shown = false;
|
||||||
HIDDEN int _last_mouse_button = 0;
|
HIDDEN int _last_mouse_button = 0;
|
||||||
HIDDEN int X_FU_MULTIPLE = 0;
|
HIDDEN int X_FU_MULTIPLE = 0;
|
||||||
HIDDEN int Y_FU_MULTIPLE = 0;
|
HIDDEN int Y_FU_MULTIPLE = 0;
|
||||||
HIDDEN const int ITF_CID = 30000;
|
HIDDEN const int ITF_CID = 30000;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
// TDropDownList
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class TDropDownList : public TObject
|
|
||||||
{
|
|
||||||
XI_OBJ* _obj; // Owner cell or field
|
|
||||||
XI_OBJ* _xi_lst;
|
|
||||||
|
|
||||||
TToken_string _codes;
|
|
||||||
TToken_string _values;
|
|
||||||
|
|
||||||
int _selected;
|
|
||||||
bool _open;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static void ddl_str_eh (XI_OBJ* itf, XI_EVENT* xiev);
|
|
||||||
void update_selection(XI_EVENT* xiev) const;
|
|
||||||
int calc_min_width();
|
|
||||||
|
|
||||||
void create();
|
|
||||||
void destroy();
|
|
||||||
|
|
||||||
long row2rec(int) const;
|
|
||||||
int rec2row(long rec) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
const int selected() const { return _selected; }
|
|
||||||
void open();
|
|
||||||
void close();
|
|
||||||
bool is_open() const { return _open; }
|
|
||||||
|
|
||||||
const char* item(long i) { const char* s = _values.get(int(i)); return s ? s : ""; }
|
|
||||||
int items() const { return _values.items(); }
|
|
||||||
void set_values(const char* c, const char* v);
|
|
||||||
|
|
||||||
bool select(int i, bool force = false);
|
|
||||||
bool select_by_initial(char c);
|
|
||||||
bool select_by_ofs(int n);
|
|
||||||
|
|
||||||
void on_mouse_down(const PNT& pt);
|
|
||||||
|
|
||||||
TDropDownList(XI_OBJ* o, const TToken_string& codes, const TToken_string& values);
|
|
||||||
virtual ~TDropDownList();
|
|
||||||
};
|
|
||||||
|
|
||||||
HIDDEN TDropDownList* _cur_ddl = NULL;
|
|
||||||
|
|
||||||
short low_get_focus_id(WINDOW win)
|
short low_get_focus_id(WINDOW win)
|
||||||
{
|
{
|
||||||
XI_OBJ * itf = xi_get_itf((XinWindow)win);
|
XI_OBJ * itf = xi_get_itf((XinWindow)win);
|
||||||
@ -175,10 +128,7 @@ int TPicture_array::add_icon(int id)
|
|||||||
TImage* i = (TImage*)_enabled.objptr(rid);
|
TImage* i = (TImage*)_enabled.objptr(rid);
|
||||||
if (i == NULL)
|
if (i == NULL)
|
||||||
{
|
{
|
||||||
TConfig ini("res/resource.ini", "Icons");
|
TImage* i = new TImage(id, true); // id is an icon identifier!
|
||||||
TString8 strid; strid << id;
|
|
||||||
TFilename n; n << "res/" << ini.get(strid);
|
|
||||||
TImage* i = new TImage(n);
|
|
||||||
_enabled.add(i, rid);
|
_enabled.add(i, rid);
|
||||||
TImage* d = new TImage(*i);
|
TImage* d = new TImage(*i);
|
||||||
d->fade_to_gray(true);
|
d->fade_to_gray(true);
|
||||||
@ -606,7 +556,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
|||||||
CHECK(win, "Can't create an XVT window for an interface");
|
CHECK(win, "Can't create an XVT window for an interface");
|
||||||
xvtil_set_font(win, NULL, 0, 0);
|
xvtil_set_font(win, NULL, 0, 0);
|
||||||
|
|
||||||
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XinRect *) &r, (char*)caption, (long)msk);
|
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XI_RCT*) &r, (char*)caption, (long)msk);
|
||||||
CHECK(def, "Can't define an interface");
|
CHECK(def, "Can't define an interface");
|
||||||
|
|
||||||
def->v.itf->automatic_back_color = false;
|
def->v.itf->automatic_back_color = false;
|
||||||
@ -652,7 +602,7 @@ void attach_interface(WINDOW win, COLOR back)
|
|||||||
|
|
||||||
char caption[80]; xvt_vobj_get_title(win, caption, 80);
|
char caption[80]; xvt_vobj_get_title(win, caption, 80);
|
||||||
TWindow* parent = (TWindow*)xvt_vobj_get_data(win);
|
TWindow* parent = (TWindow*)xvt_vobj_get_data(win);
|
||||||
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XinRect *) &rc, caption, (long)parent);
|
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XI_RCT*)&rc, caption, (long)parent);
|
||||||
CHECK(def, "Can't define an interface");
|
CHECK(def, "Can't define an interface");
|
||||||
|
|
||||||
def->v.itf->automatic_back_color = false;
|
def->v.itf->automatic_back_color = false;
|
||||||
@ -714,8 +664,6 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
|||||||
{
|
{
|
||||||
case E_MOUSE_DOWN:
|
case E_MOUSE_DOWN:
|
||||||
_last_mouse_button = xiev->v.xvte.v.mouse.button;
|
_last_mouse_button = xiev->v.xvte.v.mouse.button;
|
||||||
if (_cur_ddl != NULL)
|
|
||||||
_cur_ddl->on_mouse_down(xiev->v.xvte.v.mouse.where);
|
|
||||||
break;
|
break;
|
||||||
case E_CHAR:
|
case E_CHAR:
|
||||||
{
|
{
|
||||||
@ -756,9 +704,6 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case E_MOUSE_UP:
|
|
||||||
_button_blocked = false;
|
|
||||||
// fall down
|
|
||||||
default:
|
default:
|
||||||
w->handler(win, &xiev->v.xvte);
|
w->handler(win, &xiev->v.xvte);
|
||||||
break;
|
break;
|
||||||
@ -1026,13 +971,13 @@ int TControl::type() const
|
|||||||
|
|
||||||
RCT& TControl::get_rect(RCT& r) const
|
RCT& TControl::get_rect(RCT& r) const
|
||||||
{
|
{
|
||||||
xi_get_rect(_obj, (XinRect *) &r);
|
xi_get_rect(_obj, (XI_RCT*) &r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TControl::set_rect(const RCT& r)
|
void TControl::set_rect(const RCT& r)
|
||||||
{
|
{
|
||||||
xi_set_rect(_obj, (XinRect*)&r, false);
|
xi_set_rect(_obj, (XI_RCT*)&r, false);
|
||||||
|
|
||||||
if ( _obj->type == XIT_BTN )
|
if ( _obj->type == XIT_BTN )
|
||||||
{
|
{
|
||||||
@ -1269,7 +1214,7 @@ TText_control::TText_control(WINDOW win, short cid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const unsigned long attrib = flags2attr(flags);
|
const unsigned long attrib = flags2attr(flags);
|
||||||
XI_OBJ_DEF* def = xi_add_text_def(NULL, cid, (XinRect *) &rct, attrib, (char*)(const char*)t);
|
XI_OBJ_DEF* def = xi_add_text_def(NULL, cid, (XI_RCT*) &rct, attrib, (char*)(const char*)t);
|
||||||
CHECKS(def, "Can't create the definition of TText_control:", text);
|
CHECKS(def, "Can't create the definition of TText_control:", text);
|
||||||
def->v.text->fore_color = color;
|
def->v.text->fore_color = color;
|
||||||
if (bold || big)
|
if (bold || big)
|
||||||
@ -1450,7 +1395,7 @@ void TField_control::create(WINDOW win, short cid,
|
|||||||
if (_obj->v.field->button)
|
if (_obj->v.field->button)
|
||||||
{
|
{
|
||||||
// Aggiusta il rettangolo del bottone in modo da allinearlo al testo
|
// Aggiusta il rettangolo del bottone in modo da allinearlo al testo
|
||||||
XinRect& br = (XinRect&)_obj->v.field->btn_rct;
|
XI_RCT& br = (XI_RCT&)_obj->v.field->btn_rct;
|
||||||
const int offset = stx->rct.right - br.left - 1;
|
const int offset = stx->rct.right - br.left - 1;
|
||||||
br.left += offset;
|
br.left += offset;
|
||||||
br.right += offset;
|
br.right += offset;
|
||||||
@ -1571,7 +1516,7 @@ void TButton_control::create(WINDOW win, short cid,
|
|||||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||||
|
|
||||||
const unsigned long attrib = flags2attr(flags);
|
const unsigned long attrib = flags2attr(flags);
|
||||||
XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, (XinRect*)&rct, attrib, (char*)t, cid);
|
XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, (XI_RCT*)&rct, attrib, (char*)t, cid);
|
||||||
CHECKD(def, "Can't create the interface of TButton_control ", cid);
|
CHECKD(def, "Can't create the interface of TButton_control ", cid);
|
||||||
def->v.btn->fore_color = color;
|
def->v.btn->fore_color = color;
|
||||||
def->app_data = (long)this;
|
def->app_data = (long)this;
|
||||||
@ -1619,7 +1564,8 @@ void TButton_control::create(WINDOW win, short cid,
|
|||||||
if (height == 1)
|
if (height == 1)
|
||||||
{
|
{
|
||||||
XI_RCT& r = _obj->v.btn->rct;
|
XI_RCT& r = _obj->v.btn->rct;
|
||||||
r.bottom+=2;
|
r.top -= 2;
|
||||||
|
r.bottom++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WC_CHECKBOX:
|
case WC_CHECKBOX:
|
||||||
@ -1825,8 +1771,8 @@ void TPushbutton_control::update()
|
|||||||
if (attrib & XI_ATR_VISIBLE)
|
if (attrib & XI_ATR_VISIBLE)
|
||||||
{
|
{
|
||||||
WINDOW win = parent();
|
WINDOW win = parent();
|
||||||
XI_RCT rct = _obj->v.btn->rct;
|
XI_RCT rct; xi_get_rect(_obj, &rct); // = _obj->v.btn->rct;
|
||||||
rct.left += 5; rct.top += 5; rct.right -= 5; rct.bottom -= 5;
|
xi_inflate_rect(&rct, -3);
|
||||||
xi_set_clip((XinWindow)win, &rct);
|
xi_set_clip((XinWindow)win, &rct);
|
||||||
|
|
||||||
// Cancello il testo sottostante
|
// Cancello il testo sottostante
|
||||||
@ -1839,14 +1785,10 @@ void TPushbutton_control::update()
|
|||||||
if (bmp > 0)
|
if (bmp > 0)
|
||||||
{
|
{
|
||||||
const TImage& i = attrib & XI_ATR_ENABLED ? _picture->image(bmp) : _picture->disabled_image(bmp);
|
const TImage& i = attrib & XI_ATR_ENABLED ? _picture->image(bmp) : _picture->disabled_image(bmp);
|
||||||
int x = (rct.right + rct.left - i.width()) / 2;
|
RCT& dst = xvtil_align_rect(i.rect(), (RCT&)rct, 'C', 'C', '-');
|
||||||
int y = (rct.bottom + rct.top - i.height()) / 2;
|
|
||||||
if (_obj->v.btn->down)
|
if (_obj->v.btn->down)
|
||||||
{
|
xvt_rect_offset(&dst, 2, 2);
|
||||||
x += 2;
|
i.draw(win, dst);
|
||||||
y += 2;
|
|
||||||
}
|
|
||||||
i.draw(win, x, y);
|
|
||||||
}
|
}
|
||||||
xi_set_clip((XinWindow)win, NULL);
|
xi_set_clip((XinWindow)win, NULL);
|
||||||
}
|
}
|
||||||
@ -1949,7 +1891,7 @@ TRadiobutton_control::TRadiobutton_control(WINDOW win, short cid,
|
|||||||
rct.left -= XI_FU_MULTIPLE / 4;
|
rct.left -= XI_FU_MULTIPLE / 4;
|
||||||
rct.right += XI_FU_MULTIPLE / 4;
|
rct.right += XI_FU_MULTIPLE / 4;
|
||||||
}
|
}
|
||||||
XI_OBJ_DEF* def = xi_add_container_def(NULL, cid, (XinRect *) &rct, orient, cid);
|
XI_OBJ_DEF* def = xi_add_container_def(NULL, cid, (XI_RCT*) &rct, orient, cid);
|
||||||
def->app_data = (long)this;
|
def->app_data = (long)this;
|
||||||
|
|
||||||
const unsigned long attrib = flags2attr(flags);
|
const unsigned long attrib = flags2attr(flags);
|
||||||
@ -2143,414 +2085,101 @@ void TTagbutton_control::set_caption(const char* text)
|
|||||||
// TListbox_control
|
// TListbox_control
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
long TDropDownList::row2rec(int row) const
|
const char* xvtil_get_cell_selection(XI_OBJ* field_or_cell, int sel, const char* cod, const char* val)
|
||||||
{
|
{
|
||||||
int rows;
|
if (sel < 0)
|
||||||
const long* handle = xi_get_list_info(_xi_lst, &rows);
|
sel = 0;
|
||||||
|
TToken_string values(val);
|
||||||
if (row < 0) row = 0;
|
if (field_or_cell->type != XIT_FIELD)
|
||||||
else
|
|
||||||
if (row >= rows)
|
|
||||||
row = rows-1;
|
|
||||||
const long r = handle[row];
|
|
||||||
CHECKD(r >= 0 && r < items(), "Sheet line out of range: ", row);
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
int TDropDownList::rec2row(long rec) const
|
|
||||||
{
|
|
||||||
int rows;
|
|
||||||
const long* handle = xi_get_list_info(_xi_lst, &rows);
|
|
||||||
|
|
||||||
int r = int(rec - handle[0]);
|
|
||||||
if (r < 0 || r >= rows)
|
|
||||||
r = -1;
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TDropDownList::update_selection(XI_EVENT* xiev) const
|
|
||||||
{
|
|
||||||
if (xiev->v.rec_request.data_rec == selected())
|
|
||||||
xiev->v.rec_request.attrib |= XI_ATR_SELECTED;
|
|
||||||
else
|
|
||||||
xiev->v.rec_request.attrib &= ~XI_ATR_SELECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TDropDownList::ddl_str_eh(XI_OBJ* itf, XI_EVENT* xiev)
|
|
||||||
{
|
|
||||||
TDropDownList* ddl = (TDropDownList*)xi_get_app_data(itf);
|
|
||||||
if (!ddl->is_open())
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch(xiev->type)
|
|
||||||
{
|
|
||||||
case XIE_GET_FIRST:
|
|
||||||
if (ddl->items() > 0)
|
|
||||||
{
|
|
||||||
// GUY
|
|
||||||
// xiev->v.rec_request.data_rec = ddl->items() * xiev->v.rec_request.percent/100;
|
|
||||||
// ddl->update_selection(xiev);
|
|
||||||
long n = ddl->items() * (long)xiev->v.rec_request.percent / 100L;
|
|
||||||
if (n < 0L) n = 0L;
|
|
||||||
xiev->v.rec_request.data_rec = n;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
xiev->refused = true;
|
|
||||||
break;
|
|
||||||
case XIE_GET_LAST:
|
|
||||||
xiev->v.rec_request.data_rec = ddl->items() - 1;
|
|
||||||
// GUY ddl->update_selection(xiev);
|
|
||||||
break;
|
|
||||||
case XIE_GET_PREV:
|
|
||||||
case XIE_GET_NEXT:
|
|
||||||
{
|
|
||||||
const long n = xiev->v.rec_request.spec_rec + (xiev->type == XIE_GET_NEXT ? +1 : -1) ;
|
|
||||||
if (n >= 0 && n < ddl->items())
|
|
||||||
xiev->v.rec_request.data_rec = n;
|
|
||||||
else
|
|
||||||
xiev->refused = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case XIE_CELL_REQUEST:
|
|
||||||
{
|
|
||||||
const long rec = xiev->v.cell_request.rec;
|
|
||||||
if (rec >= 0 && rec < ddl->items())
|
|
||||||
{
|
|
||||||
const char* row = ddl->item(xiev->v.cell_request.rec);
|
|
||||||
const int len = xiev->v.cell_request.len;
|
|
||||||
strncpy(xiev->v.cell_request.s, (char*)row, len);
|
|
||||||
xiev->v.cell_request.s[len - 1] = '\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case XIE_GET_PERCENT:
|
|
||||||
{
|
|
||||||
const long rec = xiev->v.get_percent.record;
|
|
||||||
long n = ddl->items(); if (n <= 0) n = 1;
|
|
||||||
xiev->v.get_percent.percent = int(rec * 100L / n);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case XIE_DBL_CELL:
|
|
||||||
ddl->select((int)(ddl->row2rec(xiev->v.xi_obj->v.cell.row)));
|
|
||||||
ddl->close();
|
|
||||||
break;
|
|
||||||
case XIE_SELECT:
|
|
||||||
if (xiev->v.xi_obj->type == XIT_ROW)
|
|
||||||
{
|
|
||||||
const int rec = ddl->row2rec(xiev->v.xi_obj->v.row);
|
|
||||||
ddl->select(rec);
|
|
||||||
if (itf->v.itf->mouse_is_down)
|
|
||||||
ddl->close();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case XIE_XVT_EVENT:
|
|
||||||
switch (xiev->v.xvte.type)
|
|
||||||
{
|
|
||||||
case E_CHAR:
|
|
||||||
{
|
|
||||||
const KEY k = xiev->v.xvte.v.chr.ch;
|
|
||||||
if (k == K_ENTER || k == K_ESC)
|
|
||||||
ddl->close();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (k >= ' ' && k <= 'z')
|
|
||||||
ddl->select_by_initial(char(k));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E_MOUSE_DBL:
|
|
||||||
ddl->close();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TDropDownList::close()
|
|
||||||
{
|
|
||||||
if (_open)
|
|
||||||
{
|
{
|
||||||
_open = false;
|
RCT ownrct; xi_get_rect(field_or_cell, (XI_RCT*)&ownrct);
|
||||||
if (_xi_lst != NULL)
|
const int max_width = (ownrct.right-ownrct.left) - 20; // Larghezza cella stimata senza bottone
|
||||||
xvt_vobj_set_visible((WINDOW)xi_get_window(_xi_lst->itf), false);
|
|
||||||
_cur_ddl = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TDropDownList::destroy()
|
WINDOW parent = (WINDOW)xi_get_window(field_or_cell);
|
||||||
{
|
const char* txt = values.get(sel);
|
||||||
close();
|
int text_width = xvt_dwin_get_text_width(parent, txt, -1);
|
||||||
if (_xi_lst != NULL)
|
if (text_width <= max_width)
|
||||||
{
|
|
||||||
xvt_vobj_destroy((WINDOW)xi_get_window(_xi_lst->itf));
|
|
||||||
_xi_lst = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TDropDownList::select(int i, bool force)
|
|
||||||
{
|
|
||||||
if (force || i != _selected)
|
|
||||||
{
|
|
||||||
_selected = i;
|
|
||||||
|
|
||||||
if (_obj->type == XIT_FIELD)
|
|
||||||
{
|
|
||||||
if (_open) xi_set_text(_obj, ""); // Altrimenti a volte ridisegna male!
|
|
||||||
xi_set_text(_obj, (char*)_values.get(i));
|
|
||||||
TListbox_control* listbox = (TListbox_control*)xi_get_app_data(_obj);
|
|
||||||
listbox->notify_key(K_SPACE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
xi_set_text(_obj, (char*)_codes.get(i));
|
|
||||||
|
|
||||||
if (force && _open)
|
|
||||||
xi_scroll_rec(_xi_lst, i, FOCUS_COLOR, XI_ATR_ENABLED | XI_ATR_SELECTED, 0);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TDropDownList::select_by_initial(char c)
|
|
||||||
{
|
|
||||||
const int tot = _values.items();
|
|
||||||
int i = _selected;
|
|
||||||
c = toupper(c);
|
|
||||||
while(true)
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
if (i >= tot)
|
|
||||||
i = 0;
|
|
||||||
if (i == _selected)
|
|
||||||
break;
|
|
||||||
const char p = toupper(*(_values.get(i)));
|
|
||||||
if (p == c)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ok = false;
|
|
||||||
if (i != selected())
|
|
||||||
{
|
|
||||||
if (is_open())
|
|
||||||
{
|
|
||||||
const int oldsel = selected();
|
|
||||||
|
|
||||||
// Scrolla alla selezione corrente
|
|
||||||
xi_scroll_rec(_xi_lst, i, FOCUS_COLOR, XI_ATR_SELECTED | XI_ATR_ENABLED, 0);
|
|
||||||
|
|
||||||
const int r = rec2row(oldsel);
|
|
||||||
if (r >= 0)
|
|
||||||
{
|
|
||||||
XI_OBJ riga; XI_MAKE_ROW(&riga, _xi_lst, r);
|
|
||||||
long attr = xi_get_attrib(&riga);
|
|
||||||
attr &= ~XI_ATR_SELECTED;
|
|
||||||
xi_set_attrib(&riga, attr);
|
|
||||||
xi_dequeue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
ok = select(i);
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TDropDownList::select_by_ofs(int i)
|
|
||||||
{
|
|
||||||
i += _selected;
|
|
||||||
if (i >= 0 && i < _values.items())
|
|
||||||
return select(i);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TDropDownList::set_values(const char* c, const char* v)
|
|
||||||
{
|
|
||||||
const int old_items = _codes.items();
|
|
||||||
|
|
||||||
_codes = c;
|
|
||||||
_values = v;
|
|
||||||
|
|
||||||
const int new_items = _codes.items();
|
|
||||||
if (new_items != old_items && _xi_lst != NULL)
|
|
||||||
destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
int TDropDownList::calc_min_width()
|
|
||||||
{
|
|
||||||
int len = 1;
|
|
||||||
for (const char* v = _values.get(0); v; v = _values.get())
|
|
||||||
{
|
|
||||||
const int l = strlen(v);
|
|
||||||
if (l > len) len = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (len+2) * XI_FU_MULTIPLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TDropDownList::create()
|
|
||||||
{
|
|
||||||
if (_xi_lst != NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
XI_OBJ_DEF* itfdef = xi_create_itf_def(ITF_CID+1, (XI_EVENT_HANDLER)ddl_str_eh, NULL, "",
|
|
||||||
(long)this);
|
|
||||||
itfdef->v.itf->automatic_back_color = true;
|
|
||||||
|
|
||||||
const int hei = items() <= 1 ? 2*XI_FU_MULTIPLE + 1 : (min(8,items()) * XI_FU_MULTIPLE) + 1;
|
|
||||||
XI_OBJ_DEF* lstdef = xi_add_list_def(itfdef, _obj->cid+1000, 0, 0, hei,
|
|
||||||
XI_ATR_ENABLED|XI_ATR_VISIBLE,
|
|
||||||
FOCUS_COLOR, FOCUS_BACK_COLOR,
|
|
||||||
DISABLED_COLOR, DISABLED_BACK_COLOR,
|
|
||||||
FOCUS_COLOR, 0);
|
|
||||||
XI_LIST_DEF* ld = lstdef->v.list;
|
|
||||||
ld->active_back_color = FOCUS_BACK_COLOR;
|
|
||||||
ld->scroll_bar = items() > 8;
|
|
||||||
ld->no_heading = true;
|
|
||||||
ld->no_horz_lines = true;
|
|
||||||
ld->no_vert_lines = true;
|
|
||||||
ld->resize_with_window = true;
|
|
||||||
ld->single_select = true;
|
|
||||||
#ifdef LINUX
|
|
||||||
ld->scroll_on_thumb_track = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// compute size in pixel of field (with button enclosed)
|
|
||||||
XI_RCT r; xi_get_rect(_obj, &r);
|
|
||||||
|
|
||||||
// Larghezza in pixel dell'edit field
|
|
||||||
int len = r.right - r.left;
|
|
||||||
if (lstdef->v.list->scroll_bar)
|
|
||||||
{
|
|
||||||
// Larghezza in pixel del bottone
|
|
||||||
const int bw = int(_obj->itf->v.itf->fu_height * XI_FU_MULTIPLE / _obj->itf->v.itf->fu_width);
|
|
||||||
len -= bw;
|
|
||||||
len -= 2; // Don't ask me why
|
|
||||||
}
|
|
||||||
else
|
|
||||||
len -= 6; // Don't ask me why
|
|
||||||
|
|
||||||
// Larghezza in form units dell'edit field
|
|
||||||
len = len * XI_FU_MULTIPLE / _obj->itf->v.itf->fu_width - 2;
|
|
||||||
|
|
||||||
if (_obj->type == XIT_CELL)
|
|
||||||
{
|
|
||||||
const int m = calc_min_width();
|
|
||||||
if (len < m)
|
|
||||||
{
|
{
|
||||||
len = m;
|
int maxlen = strlen(txt);
|
||||||
r.right = r.left + m * _obj->itf->v.itf->fu_width / XI_FU_MULTIPLE;
|
FOR_EACH_TOKEN(values, tok)
|
||||||
}
|
{
|
||||||
}
|
const int len = strlen(tok);
|
||||||
|
if (len > maxlen)
|
||||||
xi_add_column_def(lstdef, _obj->cid+2000,
|
{
|
||||||
XI_ATR_VISIBLE|XI_ATR_ENABLED|XI_ATR_READONLY|XI_ATR_SELECTABLE,
|
maxlen = len;
|
||||||
0, len, 80, "");
|
text_width = xvt_dwin_get_text_width(parent, tok, -1);
|
||||||
|
}
|
||||||
XI_RCT l; xi_get_def_rect(lstdef, &l);
|
}
|
||||||
PNT p; p.h = r.left;
|
}
|
||||||
WINDOW pwin = (WINDOW)xi_get_window(_obj->itf);
|
if (text_width > max_width)
|
||||||
RCT w; xvt_vobj_get_client_rect(pwin, &w);
|
{
|
||||||
// place rectangle
|
TToken_string codes(cod);
|
||||||
if (r.bottom + l.bottom - l.top <= w.bottom)
|
return codes.get(sel);
|
||||||
p.v = r.bottom;
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
p.v = r.top - l.bottom - l.top;
|
|
||||||
if (p.v < w.top) p.v = w.top;
|
|
||||||
}
|
|
||||||
RCT wr;
|
|
||||||
wr.left = p.h; wr.top = p.v;
|
|
||||||
// xi_get_def_rect(lstdef, (XinRect *) &l);
|
|
||||||
wr.right = r.right;
|
|
||||||
wr.bottom = wr.top + l.bottom - l.top;
|
|
||||||
const int delta_x = _obj->itf->v.itf->delta_x;
|
|
||||||
const int delta_y = _obj->itf->v.itf->delta_y;
|
|
||||||
wr.left -= delta_x;
|
|
||||||
wr.right -= delta_x;
|
|
||||||
wr.top -= delta_y;
|
|
||||||
wr.bottom -= delta_y;
|
|
||||||
|
|
||||||
WINDOW win = xvt_win_create(W_PLAIN, &wr, "", 0, pwin, WSF_NO_MENUBAR, EM_ALL,
|
|
||||||
(EVENT_HANDLER)xi_event, 0L);
|
|
||||||
itfdef->v.itf->win = (XinWindow)win;
|
|
||||||
itfdef->v.itf->rctp = (XinRect *) ≀
|
|
||||||
XI_OBJ* itfobj = xi_create(NULL, itfdef);
|
|
||||||
CHECK(itfobj, "Can't create listbox");
|
|
||||||
|
|
||||||
xi_dequeue();
|
|
||||||
xi_tree_free(itfdef);
|
|
||||||
|
|
||||||
_xi_lst = xi_get_obj(itfobj, _obj->cid+1000);
|
|
||||||
CHECK(_xi_lst, "Can't create listbox");
|
|
||||||
}
|
|
||||||
|
|
||||||
void TDropDownList::open()
|
|
||||||
{
|
|
||||||
if (!_open)
|
|
||||||
{
|
|
||||||
if (_xi_lst != NULL)
|
|
||||||
xvt_vobj_set_visible((WINDOW)xi_get_window(_xi_lst->itf), true);
|
|
||||||
else
|
|
||||||
create();
|
|
||||||
|
|
||||||
_open = true;
|
|
||||||
xi_cell_request(_xi_lst);
|
|
||||||
|
|
||||||
WINDOW win = (WINDOW)xi_get_window(_xi_lst->itf);
|
|
||||||
xvt_scr_set_focus_vobj(win);
|
|
||||||
xvt_vobj_raise(win);
|
|
||||||
|
|
||||||
select(_selected, true);
|
|
||||||
|
|
||||||
xi_dequeue();
|
|
||||||
_cur_ddl = this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TDropDownList::on_mouse_down(const PNT& pt)
|
|
||||||
{
|
|
||||||
if (_open)
|
|
||||||
{
|
|
||||||
RCT rct; xi_get_rect(_obj, (XinRect*)&rct);
|
|
||||||
if (xvt_rect_has_point(&rct, pt))
|
|
||||||
return; // E' nel campo di testo proprietario della lista
|
|
||||||
|
|
||||||
xvt_vobj_get_outer_rect((WINDOW)xi_get_window(_xi_lst->itf), &rct);
|
|
||||||
if (!xvt_rect_has_point(&rct, pt)) // Fuori dalla lista
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TDropDownList::TDropDownList(XI_OBJ* o, const TToken_string& codes, const TToken_string& values)
|
|
||||||
: _obj(o), _xi_lst(NULL), _codes(codes), _values(values), _selected(0), _open(false)
|
|
||||||
{
|
|
||||||
if (o->type == XIT_CELL)
|
|
||||||
{
|
|
||||||
const char* val = xi_get_text(o, NULL, -1);
|
|
||||||
_selected = _codes.get_pos(val);
|
|
||||||
if (_selected < 0)
|
|
||||||
_selected = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return values.get(sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
TDropDownList::~TDropDownList()
|
int xvtil_drop_down_list(XI_OBJ* field_or_cell, const char* codes, const char* values)
|
||||||
{
|
{
|
||||||
destroy();
|
if (_ddl_shown)
|
||||||
}
|
return -1;
|
||||||
|
_ddl_shown = true;
|
||||||
|
|
||||||
|
TToken_string val(values);
|
||||||
|
int sel = -1;
|
||||||
|
if (!val.empty_items())
|
||||||
|
{
|
||||||
|
const int TAGDDL = 1000; // Tag della prima voce della lista
|
||||||
|
TString current; // Carico l'eventuale testo corrente
|
||||||
|
xi_get_text(field_or_cell, current.get_buffer(), current.size());
|
||||||
|
|
||||||
int xvtil_drop_down_list(XI_OBJ* field_or_cell, const TToken_string& codes, const TToken_string& values)
|
const int maxi = val.items()+1; // Alloco sempre un item in piu' che fa da fine lista
|
||||||
{
|
MENU_ITEM* menu = new MENU_ITEM[maxi];
|
||||||
TDropDownList ddl(field_or_cell, codes, values);
|
memset(menu, 0, sizeof(MENU_ITEM)*maxi);
|
||||||
ddl.open();
|
|
||||||
while (ddl.is_open())
|
int items = 0;
|
||||||
do_events();
|
FOR_EACH_TOKEN(val, tok)
|
||||||
return ddl.selected();
|
{
|
||||||
|
MENU_ITEM& mi = menu[items];
|
||||||
|
mi.text = xvt_str_duplicate(tok);
|
||||||
|
mi.tag = TAGDDL+items;
|
||||||
|
mi.enabled = true;
|
||||||
|
if (sel < 0 && current == tok)
|
||||||
|
sel = items;
|
||||||
|
items++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items > 0)
|
||||||
|
{
|
||||||
|
WINDOW parent = (WINDOW)xi_get_window(field_or_cell);
|
||||||
|
|
||||||
|
XVT_COLOR_COMPONENT xcc[8]; memset(&xcc, 0, sizeof(xcc));
|
||||||
|
xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = NORMAL_BACK_COLOR;
|
||||||
|
xcc[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = NORMAL_COLOR;
|
||||||
|
xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = FOCUS_COLOR;
|
||||||
|
xcc[3].type = XVT_COLOR_SELECT; xcc[3].color = FOCUS_BACK_COLOR;
|
||||||
|
xvt_dwin_set_font(parent, xvtil_default_font()); // Prepara il font da copiare nel popup
|
||||||
|
|
||||||
|
RCT ownrct; xi_get_rect(field_or_cell, (XI_RCT*)&ownrct);
|
||||||
|
const MENU_TAG tag = xvt_list_popup(parent, &ownrct, menu, xcc, sel >= 0 ? TAGDDL+sel : -1);
|
||||||
|
if (tag >= TAGDDL)
|
||||||
|
{
|
||||||
|
sel = tag-TAGDDL;
|
||||||
|
const char* txt = xvtil_get_cell_selection(field_or_cell, sel, codes, values);
|
||||||
|
xi_set_text(field_or_cell, (char*)txt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free menu data
|
||||||
|
for (int i = items-1; i >= 0; i--)
|
||||||
|
xvt_mem_free(menu[i].text);
|
||||||
|
delete menu;
|
||||||
|
}
|
||||||
|
_ddl_shown = false;
|
||||||
|
|
||||||
|
return sel;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -2564,12 +2193,14 @@ bool TListbox_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
|||||||
{
|
{
|
||||||
case XIE_DBL_FIELD:
|
case XIE_DBL_FIELD:
|
||||||
case XIE_BUTTON:
|
case XIE_BUTTON:
|
||||||
if (!_button_blocked && !read_only())
|
if (!_ddl_shown && !read_only())
|
||||||
{
|
{
|
||||||
if (_ddl->is_open())
|
const int sel = xvtil_drop_down_list(_obj, _codes, _values);
|
||||||
_ddl->close();
|
if (sel >= 0)
|
||||||
else
|
{
|
||||||
_ddl->open();
|
select(sel);
|
||||||
|
notify_key(K_SPACE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XIE_CHAR_FIELD:
|
case XIE_CHAR_FIELD:
|
||||||
@ -2579,16 +2210,23 @@ bool TListbox_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
|||||||
if (!read_only())
|
if (!read_only())
|
||||||
{
|
{
|
||||||
if (k >= ' ' && k <= 'z')
|
if (k >= ' ' && k <= 'z')
|
||||||
_ddl->select_by_initial(char(k));
|
select_by_initial(char(k));
|
||||||
else
|
else
|
||||||
if (k == K_F9)
|
if (k == K_F9)
|
||||||
_ddl->open();
|
{
|
||||||
|
const int sel = xvtil_drop_down_list(_obj, _codes, _values);
|
||||||
|
if (sel >= 0)
|
||||||
|
{
|
||||||
|
select(sel);
|
||||||
|
notify_key(K_SPACE);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (k == K_RIGHT) // poor man's substitute for down arrow
|
if (k == K_RIGHT) // poor man's substitute for down arrow
|
||||||
_ddl->select_by_ofs(1);
|
select_by_ofs(1);
|
||||||
else
|
else
|
||||||
if (k == K_LEFT) // poor man's substitute for up arrow
|
if (k == K_LEFT) // poor man's substitute for up arrow
|
||||||
_ddl->select_by_ofs(-1);
|
select_by_ofs(-1);
|
||||||
else
|
else
|
||||||
if (k == K_F2 || k == K_F11 || k == K_F12)
|
if (k == K_F2 || k == K_F11 || k == K_F12)
|
||||||
notify_key(k);
|
notify_key(k);
|
||||||
@ -2612,49 +2250,78 @@ bool TListbox_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
|||||||
|
|
||||||
void TListbox_control::set_values(const char* cod, const char* val)
|
void TListbox_control::set_values(const char* cod, const char* val)
|
||||||
{
|
{
|
||||||
_ddl->set_values(cod, val);
|
_codes = cod;
|
||||||
|
_values = val;
|
||||||
if (selected() >= items())
|
if (selected() >= items())
|
||||||
_ddl->select(0, true);
|
select(0);
|
||||||
else
|
|
||||||
_ddl->select(selected(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int TListbox_control::items() const
|
int TListbox_control::items() const
|
||||||
{
|
{
|
||||||
return _ddl->items();
|
return _codes.items();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TListbox_control::select(int i)
|
bool TListbox_control::select(int i)
|
||||||
{
|
{
|
||||||
return _ddl->select(i);
|
const bool ok = i >= 0 && i < items();
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
if (_current != i)
|
||||||
|
{
|
||||||
|
_current = i;
|
||||||
|
xi_set_text(_obj, ""); // Senno' a volte disegna male
|
||||||
|
xi_set_text(_obj, (char*)_values.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TListbox_control::select_by_initial(char c)
|
bool TListbox_control::select_by_initial(char c)
|
||||||
{
|
{
|
||||||
return _ddl->select_by_initial(c);
|
int i = _current;
|
||||||
|
const int tot = items();
|
||||||
|
for (i = (i+1)%tot; i != _current; i = (i+1)%tot)
|
||||||
|
{
|
||||||
|
if (toupper(_values.get_char(i)) == toupper(c))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const bool changed = i != _current;
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
select(i);
|
||||||
|
notify_key(K_SPACE);
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TListbox_control::select_by_ofs(int i)
|
bool TListbox_control::select_by_ofs(int i)
|
||||||
{
|
{
|
||||||
return _ddl->select_by_ofs(i);
|
const int last = items()-1;
|
||||||
|
i += _current;
|
||||||
|
if (i < 0)
|
||||||
|
i = last; else
|
||||||
|
if (i > last)
|
||||||
|
i = last;
|
||||||
|
const bool changed = i != _current;
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
select(i);
|
||||||
|
notify_key(K_SPACE);
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TListbox_control::selected() const
|
int TListbox_control::selected() const
|
||||||
{
|
{ return _current; }
|
||||||
return _ddl->selected();
|
|
||||||
}
|
|
||||||
|
|
||||||
TListbox_control::TListbox_control(WINDOW win, short cid,
|
TListbox_control::TListbox_control(WINDOW win, short cid,
|
||||||
short left, short top, short width,
|
short left, short top, short width,
|
||||||
const char* flags, const char* text,
|
const char* flags, const char* text,
|
||||||
const char* codes, const char* values)
|
const char* codes, const char* values)
|
||||||
|
: _codes(codes), _values(values), _current(-1)
|
||||||
{
|
{
|
||||||
create(win, cid, left, top, width , 1, width, flags, text, true);
|
create(win, cid, left, top, width , 1, width, flags, text, true);
|
||||||
_ddl = new TDropDownList(_obj, codes, values);
|
|
||||||
_ddl->select(0, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TListbox_control::~TListbox_control()
|
TListbox_control::~TListbox_control()
|
||||||
{
|
{ }
|
||||||
delete _ddl; _ddl = NULL;
|
|
||||||
}
|
|
||||||
|
@ -216,7 +216,7 @@ public:
|
|||||||
|
|
||||||
class TPushbutton_control : public TButton_control
|
class TPushbutton_control : public TButton_control
|
||||||
{
|
{
|
||||||
short _bmp_up, _bmp_dn;
|
int _bmp_up, _bmp_dn;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
@ -309,14 +309,10 @@ public:
|
|||||||
virtual ~TCheckbutton_control() {}
|
virtual ~TCheckbutton_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TDropDownList;
|
|
||||||
|
|
||||||
class TListbox_control : public TField_control
|
class TListbox_control : public TField_control
|
||||||
{
|
{
|
||||||
TDropDownList* _ddl;
|
TToken_string _codes, _values;
|
||||||
|
int _current;
|
||||||
private:
|
|
||||||
void drop_down();
|
|
||||||
|
|
||||||
protected: // TTField_control
|
protected: // TTField_control
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
@ -336,6 +332,7 @@ public:
|
|||||||
virtual ~TListbox_control();
|
virtual ~TListbox_control();
|
||||||
};
|
};
|
||||||
|
|
||||||
int xvtil_drop_down_list(XI_OBJ* field_or_cell, const TToken_string& codes, const TToken_string& values);
|
int xvtil_drop_down_list(XI_OBJ* field_or_cell, const char* codes, const char* values);
|
||||||
|
const char* xvtil_get_cell_selection(XI_OBJ* field_or_cell, int sel, const char* cod, const char* val);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1058,6 +1058,17 @@ const TString& TDongle::module_code2desc(word mod) const
|
|||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TString& TDongle::module_name2desc(const char* mod) const
|
||||||
|
{
|
||||||
|
const word cod = module_name2code(mod);
|
||||||
|
if (cod == 0)
|
||||||
|
{
|
||||||
|
if (xvt_str_compare_ignoring_case(mod, "sy") == 0)
|
||||||
|
return get_tmp_string() = TR("Sistema");
|
||||||
|
}
|
||||||
|
return module_code2desc(cod);
|
||||||
|
}
|
||||||
|
|
||||||
bool TDongle::shown(word code) const
|
bool TDongle::shown(word code) const
|
||||||
{
|
{
|
||||||
bool yes = code < ENDAUT;
|
bool yes = code < ENDAUT;
|
||||||
|
@ -94,6 +94,8 @@ public:
|
|||||||
word module_name2code(const char* module) const; // Converte un nome di due lettere in numero
|
word module_name2code(const char* module) const; // Converte un nome di due lettere in numero
|
||||||
const TString& module_code2name(word module) const; // ... e viceversa
|
const TString& module_code2name(word module) const; // ... e viceversa
|
||||||
const TString& module_code2desc(word module) const; // Descrizione estesa del modulo
|
const TString& module_code2desc(word module) const; // Descrizione estesa del modulo
|
||||||
|
const TString& module_name2desc(const char* mod) const; // Converte un nome di due lettere in descrizione
|
||||||
|
|
||||||
bool shown(word module) const; // Stabilisce se un modulo e' visibile in installazione
|
bool shown(word module) const; // Stabilisce se un modulo e' visibile in installazione
|
||||||
bool hidden(word module) const { return !shown(module); } // Modulo invisibile
|
bool hidden(word module) const { return !shown(module); } // Modulo invisibile
|
||||||
|
|
||||||
|
@ -4,23 +4,5 @@ BEGIN
|
|||||||
PICTURE BMP_ELABORA
|
PICTURE BMP_ELABORA
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_INFO 2 2
|
#include <helpbar.h>
|
||||||
BEGIN
|
|
||||||
PROMPT 2 1 "Info"
|
|
||||||
MESSAGE EXIT,K_F2
|
|
||||||
PICTURE BMP_INFO
|
|
||||||
END
|
|
||||||
|
|
||||||
BUTTON DLG_HELP 2 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT 3 1 "Help"
|
|
||||||
MESSAGE EXIT,K_F1
|
|
||||||
PICTURE BMP_HELP
|
|
||||||
END
|
|
||||||
|
|
||||||
BUTTON DLG_QUIT 2 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT 5 1 "Fine"
|
|
||||||
MESSAGE EXIT,K_QUIT
|
|
||||||
PICTURE BMP_QUIT
|
|
||||||
END
|
|
@ -261,7 +261,7 @@ TGolem_mask::TGolem_mask()
|
|||||||
sm.set_handler(F_LINK, link_handler);
|
sm.set_handler(F_LINK, link_handler);
|
||||||
sm.set_handler(F_PRINT, link_handler);
|
sm.set_handler(F_PRINT, link_handler);
|
||||||
|
|
||||||
TConfig ini(CONFIG_USER, "Link");
|
TConfig ini(CONFIG_GUI, "Link");
|
||||||
TString_array list;
|
TString_array list;
|
||||||
ini.list_variables(list);
|
ini.list_variables(list);
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ TGolem_mask::TGolem_mask()
|
|||||||
|
|
||||||
// Aggiungi la posta se attiva
|
// Aggiungi la posta se attiva
|
||||||
#ifdef WIN32 // verificare
|
#ifdef WIN32 // verificare
|
||||||
if (GetProfileInt("Mail", "MAPI", 0))
|
if (::GetProfileInt("Mail", "MAPI", 0))
|
||||||
{
|
{
|
||||||
const int items = list.items();
|
const int items = list.items();
|
||||||
const int mmf_pos = (items >= MAX_ITEMS) ? MAX_ITEMS-1 : -1;
|
const int mmf_pos = (items >= MAX_ITEMS) ? MAX_ITEMS-1 : -1;
|
||||||
@ -291,12 +291,10 @@ TGolem_mask::TGolem_mask()
|
|||||||
FOR_EACH_ARRAY_ROW(list, r, row)
|
FOR_EACH_ARRAY_ROW(list, r, row)
|
||||||
{
|
{
|
||||||
TString16 ext = *row;
|
TString16 ext = *row;
|
||||||
unsigned int icon;
|
unsigned int icon = 0;
|
||||||
|
|
||||||
if (ext == "mailto")
|
if (ext == "mailto")
|
||||||
{
|
|
||||||
icon = mail2icon();
|
icon = mail2icon();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ext.insert(".", 0);
|
ext.insert(".", 0);
|
||||||
@ -306,7 +304,8 @@ TGolem_mask::TGolem_mask()
|
|||||||
{
|
{
|
||||||
const int x = (i < ITEMS_PER_ROW ? i*5 : (i-ITEMS_PER_ROW)*5) + 1;
|
const int x = (i < ITEMS_PER_ROW ? i*5 : (i-ITEMS_PER_ROW)*5) + 1;
|
||||||
const int y = i < ITEMS_PER_ROW ? 0 : 2;
|
const int y = i < ITEMS_PER_ROW ? 0 : 2;
|
||||||
TButton_field& btn = add_button(301+i, 0, ext, x, y, 3, 2);
|
TButton_field& btn = add_button(301+i, 0, "", x, y, 3, 2);
|
||||||
|
btn.set_prompt(ext);
|
||||||
btn.set_handler(ole_handler);
|
btn.set_handler(ole_handler);
|
||||||
btn.set_central_icon(icon);
|
btn.set_central_icon(icon);
|
||||||
i++;
|
i++;
|
||||||
@ -364,7 +363,7 @@ void TGolem_field::create(WINDOW parent)
|
|||||||
_ctl = new TPushbutton_control(parent, _ctl_data._dlg,
|
_ctl = new TPushbutton_control(parent, _ctl_data._dlg,
|
||||||
_ctl_data._x, _ctl_data._y,
|
_ctl_data._x, _ctl_data._y,
|
||||||
_ctl_data._width+2, _ctl_data._height,
|
_ctl_data._width+2, _ctl_data._height,
|
||||||
_ctl_data._flags, _ctl_data._prompt,
|
_ctl_data._flags, "", // No prompt -> icons olny!
|
||||||
_ctl_data._bmp_up, _ctl_data._bmp_dn);
|
_ctl_data._bmp_up, _ctl_data._bmp_dn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
|
#include <xvtility.h>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TImage
|
// TImage
|
||||||
@ -78,13 +79,13 @@ XVT_IMAGE TImage::load(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
XVT_IMAGE TImage::load(short id)
|
XVT_IMAGE TImage::load(int id)
|
||||||
{
|
{
|
||||||
return set(xvt_res_get_image(id));
|
return set(xvt_res_get_image(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
XVT_IMAGE TImage::load_icon(short id)
|
XVT_IMAGE TImage::load_icon(int id)
|
||||||
{
|
{
|
||||||
return set(xvt_res_get_icon(id));
|
return set(xvt_res_get_icon(id));
|
||||||
}
|
}
|
||||||
@ -97,7 +98,7 @@ TImage::TImage(const char* n) : _image(NULL)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
TImage::TImage(short id, bool is_icon) : _image(NULL)
|
TImage::TImage(int id, bool is_icon) : _image(NULL)
|
||||||
{
|
{
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
{
|
{
|
||||||
@ -164,7 +165,7 @@ void TImage::draw(WINDOW w) const
|
|||||||
|
|
||||||
// @mfunc Permette di gestire il disegno dell'immagine sullo schermo
|
// @mfunc Permette di gestire il disegno dell'immagine sullo schermo
|
||||||
void TImage::draw(
|
void TImage::draw(
|
||||||
WINDOW w, // @parm Immagine da disegnare
|
WINDOW win, // @parm Immagine da disegnare
|
||||||
int x, // @parm Coordinata x in cui disegnare l'immagine
|
int x, // @parm Coordinata x in cui disegnare l'immagine
|
||||||
int y) const // @parm Coordinata y in cui disegnare l'immagine
|
int y) const // @parm Coordinata y in cui disegnare l'immagine
|
||||||
// @parm RCT& | _src | Rettangolo contenente l'immagine da disegnare
|
// @parm RCT& | _src | Rettangolo contenente l'immagine da disegnare
|
||||||
@ -181,19 +182,26 @@ void TImage::draw(
|
|||||||
{
|
{
|
||||||
RCT dst = _src;
|
RCT dst = _src;
|
||||||
xvt_rect_offset(&dst, x, y);
|
xvt_rect_offset(&dst, x, y);
|
||||||
xvt_dwin_draw_image(w, _image, &dst, (RCT*)&_src);
|
xvt_dwin_draw_image(win, _image, &dst, (RCT*)&_src);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
void TImage::draw(WINDOW w, const RCT& dst) const
|
void TImage::draw(WINDOW win, const RCT& dst) const
|
||||||
{
|
{
|
||||||
xvt_dwin_draw_image(w, _image, (RCT*)&dst, (RCT*)&_src);
|
xvt_dwin_draw_image(win, _image, &dst, &_src);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
void TImage::draw(WINDOW w, const RCT& dst, const RCT& src) const
|
void TImage::draw(WINDOW win, const RCT& dst, const RCT& src) const
|
||||||
{
|
{
|
||||||
xvt_dwin_draw_image(w, _image, &dst, &src);
|
xvt_dwin_draw_image(win, _image, &dst, &_src);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Certified 99%
|
||||||
|
void TImage::draw(WINDOW win, const RCT& dst, char halign, char valign, char grow) const
|
||||||
|
{
|
||||||
|
const RCT& rct = xvtil_align_rect(_src, dst, halign, valign, grow);
|
||||||
|
draw(win, rct);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
@ -213,6 +221,8 @@ COLOR TImage::get_pixel(int x, int y) const
|
|||||||
return xvt_image_get_pixel(_image, x, y);
|
return xvt_image_get_pixel(_image, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* OBSOLETA
|
||||||
|
|
||||||
// Certified 99%
|
// Certified 99%
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
@ -256,6 +266,7 @@ void TImage::convert_to_default_colors()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
|
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
|
||||||
void TImage::convert_transparent_color(COLOR transparent)
|
void TImage::convert_transparent_color(COLOR transparent)
|
||||||
@ -269,16 +280,9 @@ void TImage::convert_transparent_color(COLOR transparent)
|
|||||||
if (same_color(trans, transparent))
|
if (same_color(trans, transparent))
|
||||||
return; // Nothing to do
|
return; // Nothing to do
|
||||||
|
|
||||||
|
/*
|
||||||
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
for (int index = xvt_image_get_ncolors(_image)-1; index >=0; index--)
|
|
||||||
if (same_color(trans, xvt_image_get_clut(_image, index)))
|
|
||||||
{
|
|
||||||
xvt_image_set_clut(_image, index, transparent);
|
|
||||||
// break; don't break: replace all colors equal to upper left in the palette
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
int i = -1;
|
int i = -1;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -302,6 +306,8 @@ void TImage::convert_transparent_color(COLOR transparent)
|
|||||||
set_pixel(x, y, transparent);
|
set_pixel(x, y, transparent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
xvt_image_replace_color(_image, trans, transparent); // New "native" method
|
||||||
}
|
}
|
||||||
|
|
||||||
inline COLOR btncolor2btngray(COLOR color, bool use_btn)
|
inline COLOR btncolor2btngray(COLOR color, bool use_btn)
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
void draw(WINDOW w, int x, int y) const;
|
void draw(WINDOW w, int x, int y) const;
|
||||||
// @cmember Disegna/modifica l'immagine sullo schermo
|
// @cmember Disegna/modifica l'immagine sullo schermo
|
||||||
void draw(WINDOW w, const RCT& dst) const;
|
void draw(WINDOW w, const RCT& dst) const;
|
||||||
|
void draw(WINDOW win, const RCT& dst, char halign, char valign, char grow) const;
|
||||||
// @cmember Disegna l'immagine sulla finestra
|
// @cmember Disegna l'immagine sulla finestra
|
||||||
void draw(WINDOW w, const RCT& dst, const RCT& src) const;
|
void draw(WINDOW w, const RCT& dst, const RCT& src) const;
|
||||||
// @cmember Setta un pixel
|
// @cmember Setta un pixel
|
||||||
@ -58,9 +59,9 @@ public:
|
|||||||
// @cmember Legge l'immagine dal file
|
// @cmember Legge l'immagine dal file
|
||||||
XVT_IMAGE load(const char* n);
|
XVT_IMAGE load(const char* n);
|
||||||
// @cmember Legge l'immagine dal file di risorse
|
// @cmember Legge l'immagine dal file di risorse
|
||||||
XVT_IMAGE load(short id);
|
XVT_IMAGE load(int id);
|
||||||
// @cmember Legge l'immagine dal file di risorse
|
// @cmember Legge l'immagine dal file di risorse
|
||||||
XVT_IMAGE load_icon(short id);
|
XVT_IMAGE load_icon(int id);
|
||||||
|
|
||||||
// @cmember Controlla che l'immagine sia un oggetto valido (diverso da NULL)
|
// @cmember Controlla che l'immagine sia un oggetto valido (diverso da NULL)
|
||||||
virtual bool ok() const
|
virtual bool ok() const
|
||||||
@ -77,8 +78,8 @@ public:
|
|||||||
{ return _src; }
|
{ return _src; }
|
||||||
|
|
||||||
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
||||||
// usando i colori di default (di Morpurgo)
|
// usando i colori di default (dell'obsoleto Morpurgo)
|
||||||
void convert_to_default_colors();
|
// void convert_to_default_colors();
|
||||||
|
|
||||||
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
||||||
// usando l'angolo in alto a sinistra dell'imagine stessa
|
// usando l'angolo in alto a sinistra dell'imagine stessa
|
||||||
@ -98,14 +99,13 @@ public:
|
|||||||
// @cmember Costruttore. Viene passato il nome del file
|
// @cmember Costruttore. Viene passato il nome del file
|
||||||
TImage(const char* n);
|
TImage(const char* n);
|
||||||
// @cmember Costruttore. Viene passato l'identificatore dell'immagine sul file di risorsa
|
// @cmember Costruttore. Viene passato l'identificatore dell'immagine sul file di risorsa
|
||||||
TImage(short id, bool is_icon = false);
|
TImage(int id, bool is_icon = false);
|
||||||
// @cmember Costruttore. Viene passata l'immagine e le sue diemsioni
|
// @cmember Costruttore. Viene passata l'immagine e le sue dimensioni
|
||||||
TImage(const TImage& i, short width = -1, short height = -1);
|
TImage(const TImage& i, short width = -1, short height = -1);
|
||||||
// @cmember Costruttore. Viene passata l'immagine e le sue diemsioni
|
// @cmember Costruttore. Viene passata l'immagine e le sue dimensioni
|
||||||
TImage(short width, short height, XVT_IMAGE_FORMAT fmt = XVT_IMAGE_CL8);
|
TImage(short width, short height, XVT_IMAGE_FORMAT fmt);
|
||||||
// @cmember Distruttore
|
// @cmember Distruttore
|
||||||
virtual ~TImage();
|
virtual ~TImage();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4078,7 +4078,7 @@ TRecfield::TRecfield(TRectype& rec, const char* name, int from, int to)
|
|||||||
_p += from;
|
_p += from;
|
||||||
if (to >= 0)
|
if (to >= 0)
|
||||||
{
|
{
|
||||||
CHECK(from <= to && to <= rd.Fd[nf].Len, "Invalid Range");
|
CHECKS(from <= to && to <= rd.Fd[nf].Len, "Invalid Range on field ", _name);
|
||||||
_len = to - from + 1;
|
_len = to - from + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -506,6 +506,11 @@ const TString& TMask_field::get() const
|
|||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long TMask_field::get_long() const
|
||||||
|
{
|
||||||
|
return atol(get());
|
||||||
|
}
|
||||||
|
|
||||||
void TMask_field::set_default(const char*)
|
void TMask_field::set_default(const char*)
|
||||||
{
|
{
|
||||||
NFCHECK("Only loadables can have a default");
|
NFCHECK("Only loadables can have a default");
|
||||||
@ -4761,18 +4766,15 @@ const char* TList_field::win2raw(const char* data) const
|
|||||||
TToken_string& codes = ((TList_field*)this)->_codes;
|
TToken_string& codes = ((TList_field*)this)->_codes;
|
||||||
TToken_string& value = ((TList_field*)this)->_values;
|
TToken_string& value = ((TList_field*)this)->_values;
|
||||||
|
|
||||||
_ctl_data._park = data; // data puo' venire da una TToken_string::get
|
TString80 str = data; // data puo' venire da una TToken_string::get
|
||||||
int pos = 0;
|
int pos = value.get_pos(str);
|
||||||
|
if (pos < 0) // Ci riprovo coi codici
|
||||||
|
pos = codes.get_pos(str);
|
||||||
|
|
||||||
if (_ctl_data._park.len() > 2) // E' veramente una descrizione
|
if (pos < 0 && (str.blank() || str == "0"))
|
||||||
pos = value.get_pos(_ctl_data._park);
|
|
||||||
else // Oppure e' un codice
|
|
||||||
pos = codes.get_pos(_ctl_data._park);
|
|
||||||
|
|
||||||
if (pos < 0 && _ctl_data._park.blank())
|
|
||||||
{
|
{
|
||||||
_ctl_data._park = codes.get(0); // Uso codes come riferimento per blank
|
str = codes.get(0); // Uso codes come riferimento per blank
|
||||||
if (_ctl_data._park.blank())
|
if (str.blank() || str == "0")
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4786,15 +4788,15 @@ const char* TList_field::raw2win(const char* data) const
|
|||||||
TToken_string& codes = ((TList_field*)this)->_codes;
|
TToken_string& codes = ((TList_field*)this)->_codes;
|
||||||
TToken_string& value = ((TList_field*)this)->_values;
|
TToken_string& value = ((TList_field*)this)->_values;
|
||||||
|
|
||||||
_ctl_data._park = data; // data puo' venire da una TToken_string::get
|
TString80 str = data; // data puo' venire da una TToken_string::get
|
||||||
int pos = codes.get_pos(_ctl_data._park);
|
int pos = codes.get_pos(str);
|
||||||
if (pos < 0 && _ctl_data._park.blank())
|
if (pos < 0 && (str.blank() || str == "0"))
|
||||||
{
|
{
|
||||||
_ctl_data._park = codes.get(0);
|
str = codes.get(0);
|
||||||
if (_ctl_data._park.blank())
|
if (str.blank() || str == "0")
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
CHECKS(pos >= 0, "Unknown listbox code:", (const char*)_ctl_data._park);
|
CHECKS(pos >= 0, "Unknown listbox code:", data);
|
||||||
return value.get(pos);
|
return value.get(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,6 +346,7 @@ public:
|
|||||||
|
|
||||||
// @cmember Ritorna il contenuto del campo
|
// @cmember Ritorna il contenuto del campo
|
||||||
virtual const TString& get() const;
|
virtual const TString& get() const;
|
||||||
|
virtual long get_long() const;
|
||||||
|
|
||||||
// @cmember Ritorna il default del campo
|
// @cmember Ritorna il default del campo
|
||||||
virtual const TString& get_default() const;
|
virtual const TString& get_default() const;
|
||||||
|
@ -978,7 +978,7 @@ void TSpreadsheet::notify_change()
|
|||||||
xvtil_statbar_refresh();
|
xvtil_statbar_refresh();
|
||||||
set_dirty();
|
set_dirty();
|
||||||
}
|
}
|
||||||
_row_dirty = _cell_dirty = TRUE; // Era tra le graffe
|
_row_dirty = _cell_dirty = true; // Era tra le graffe
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TSpreadsheet::copy_cell2field(XI_OBJ* cell)
|
const char* TSpreadsheet::copy_cell2field(XI_OBJ* cell)
|
||||||
@ -998,9 +998,7 @@ const char* TSpreadsheet::copy_cell2field(XI_OBJ* cell)
|
|||||||
{
|
{
|
||||||
if (_edit_field->class_id() == CLASS_ZOOM_FIELD)
|
if (_edit_field->class_id() == CLASS_ZOOM_FIELD)
|
||||||
_edit_field->set(row(_cur_rec).get(cid2index(_edit_field->dlg())));
|
_edit_field->set(row(_cur_rec).get(cid2index(_edit_field->dlg())));
|
||||||
const char* val = _edit_field->is_kind_of(CLASS_LIST_FIELD) ? txt :
|
const char* val = (const char*)((TEditable_field*)_edit_field)->win2raw(txt);
|
||||||
(const char*)((TEditable_field*)_edit_field)->win2raw(txt);
|
|
||||||
|
|
||||||
_edit_field->set(val);
|
_edit_field->set(val);
|
||||||
_edit_field->set_dirty(); // Get it dirty!
|
_edit_field->set_dirty(); // Get it dirty!
|
||||||
}
|
}
|
||||||
@ -1009,14 +1007,14 @@ const char* TSpreadsheet::copy_cell2field(XI_OBJ* cell)
|
|||||||
|
|
||||||
bool TSpreadsheet::off_cell_handler(XI_OBJ *cell)
|
bool TSpreadsheet::off_cell_handler(XI_OBJ *cell)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = true;
|
||||||
if (_edit_field != NULL)
|
if (_edit_field != NULL)
|
||||||
{
|
{
|
||||||
const char* nuo = copy_cell2field(cell);
|
const char* nuo = copy_cell2field(cell);
|
||||||
if (_edit_field->on_key(_edit_field->is_edit() ? K_TAB : K_SPACE) == FALSE) // Test it
|
if (_edit_field->on_key(_edit_field->is_edit() ? K_TAB : K_SPACE) == FALSE) // Test it
|
||||||
ok = *nuo == '\0'; // Se e' vuoto lascia stare
|
ok = *nuo == '\0'; // Se e' vuoto lascia stare
|
||||||
else
|
else
|
||||||
_cell_dirty = FALSE;
|
_cell_dirty = false;
|
||||||
if (_row_dirty)
|
if (_row_dirty)
|
||||||
{
|
{
|
||||||
owner().mask().notify_focus_field(id()); // A volte si diverte a perdere il focus
|
owner().mask().notify_focus_field(id()); // A volte si diverte a perdere il focus
|
||||||
@ -1112,7 +1110,13 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
switch (e->class_id())
|
switch (e->class_id())
|
||||||
{
|
{
|
||||||
case CLASS_LIST_FIELD:
|
case CLASS_LIST_FIELD:
|
||||||
break; // Leave code as is
|
{
|
||||||
|
const TList_field& lst = *(TList_field*)f;
|
||||||
|
TToken_string codes = lst.get_codes();
|
||||||
|
TToken_string values = lst.get_values();
|
||||||
|
src = xvtil_get_cell_selection(obj[num], codes.get_pos(src), codes, values);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CLASS_BOOLEAN_FIELD:
|
case CLASS_BOOLEAN_FIELD:
|
||||||
if (*src <= ' ')
|
if (*src <= ' ')
|
||||||
xiev->v.cell_request.icon_rid = ICO_CHECK_OFF;
|
xiev->v.cell_request.icon_rid = ICO_CHECK_OFF;
|
||||||
@ -1544,14 +1548,15 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
notify_change();
|
notify_change();
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
|
|
||||||
if (k == K_F9 && _edit_field->is_kind_of(CLASS_LIST_FIELD)) // list
|
if (k == K_F9 && _edit_field->is_kind_of(CLASS_LIST_FIELD)) // list or radio
|
||||||
{
|
{
|
||||||
XI_OBJ cell; XI_MAKE_CELL(&cell, _obj, _cur_row, _cur_col);
|
XI_OBJ cell; XI_MAKE_CELL(&cell, _obj, _cur_row, _cur_col);
|
||||||
const TList_field& lst = (const TList_field&)(*_edit_field);
|
const TList_field& lst = (const TList_field&)(*_edit_field);
|
||||||
TToken_string codes = lst.get_codes();
|
const int sel = xvtil_drop_down_list(&cell, lst.get_codes(), lst.get_values());
|
||||||
TToken_string values = lst.get_values();
|
if (sel >= 0)
|
||||||
xvtil_drop_down_list(&cell, codes, values);
|
{
|
||||||
copy_cell2field();
|
const char* val = copy_cell2field();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // edit_field
|
else // edit_field
|
||||||
{
|
{
|
||||||
@ -1688,6 +1693,26 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
if (k > K_CTRL)
|
if (k > K_CTRL)
|
||||||
{
|
{
|
||||||
refused = TRUE;
|
refused = TRUE;
|
||||||
|
} else
|
||||||
|
if (_edit_field->is_kind_of(CLASS_LIST_FIELD))
|
||||||
|
{
|
||||||
|
notify_change(); // Aggiorna valore corrente listbox
|
||||||
|
|
||||||
|
TList_field& lst = *(TList_field*)_edit_field;
|
||||||
|
bool changed = false;
|
||||||
|
switch (k)
|
||||||
|
{
|
||||||
|
case K_RIGHT: changed = lst.select_next(); break;
|
||||||
|
case K_LEFT : changed = lst.select_prev(); break;
|
||||||
|
default : changed = (k >= ' ' && k <= 'z') && lst.select_by_initial(char(k)); break;
|
||||||
|
}
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
XI_OBJ cell; XI_MAKE_CELL(&cell, _obj, _cur_row, _cur_col);
|
||||||
|
xi_set_text(&cell, (char*)lst.raw2win(lst.get()));
|
||||||
|
_cell_dirty = TRUE;
|
||||||
|
}
|
||||||
|
refused = TRUE;
|
||||||
} else
|
} else
|
||||||
if (is_edit_key(k))
|
if (is_edit_key(k))
|
||||||
{
|
{
|
||||||
@ -1702,36 +1727,9 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
refused = true;
|
refused = true;
|
||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
if (_edit_field->is_kind_of(CLASS_LIST_FIELD))
|
break;
|
||||||
{
|
}
|
||||||
notify_change(); // Aggiorna valore corrente listbox
|
|
||||||
|
|
||||||
TList_field& lst = ((TList_field&)*_edit_field);
|
|
||||||
bool changed = FALSE;
|
|
||||||
switch (k)
|
|
||||||
{
|
|
||||||
case K_RIGHT:
|
|
||||||
changed = lst.select_next();
|
|
||||||
break;
|
|
||||||
case K_LEFT:
|
|
||||||
changed = lst.select_prev();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (k >= ' ' && k <= 'z')
|
|
||||||
changed = lst.select_by_initial(char(k));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (changed)
|
|
||||||
{
|
|
||||||
XI_OBJ cell; XI_MAKE_CELL(&cell, _obj, _cur_row, _cur_col);
|
|
||||||
xi_set_text(&cell, (char*)(const char*)lst.get());
|
|
||||||
_cell_dirty = TRUE;
|
|
||||||
}
|
|
||||||
refused = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XIE_XVT_EVENT:
|
case XIE_XVT_EVENT:
|
||||||
@ -3261,7 +3259,6 @@ TRectype* TSheet_field::putkey(const TRelation& r)
|
|||||||
{
|
{
|
||||||
if (_sheetfile)
|
if (_sheetfile)
|
||||||
{
|
{
|
||||||
// *******
|
|
||||||
// costruisce la chiave per il record array
|
// costruisce la chiave per il record array
|
||||||
_sheetfile->zero();
|
_sheetfile->zero();
|
||||||
_file_k_ids.restart();
|
_file_k_ids.restart();
|
||||||
|
@ -1539,14 +1539,14 @@ bool TPrint_application::print_one (
|
|||||||
bool TPrint_application::menu(MENU_TAG m)
|
bool TPrint_application::menu(MENU_TAG m)
|
||||||
{
|
{
|
||||||
// funziona da se' fino a 20 voci della menubar
|
// funziona da se' fino a 20 voci della menubar
|
||||||
if (m >= BAR_ITEM (1) && m <= BAR_ITEM (20))
|
if (m >= BAR_ITEM_ID(1) && m <= BAR_ITEM_ID(20))
|
||||||
{
|
{
|
||||||
_last_choice = m;
|
_last_choice = m;
|
||||||
do_print((m - BAR_ITEM (0)) / 100);
|
do_print((m - BAR_ITEM_ID(0)) / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se non esistono altre voci di menu termina l'applicazione
|
// Se non esistono altre voci di menu termina l'applicazione
|
||||||
return xvtil_test_menu_tag (BAR_ITEM (2));
|
return xvtil_test_menu_tag (BAR_ITEM_ID(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TPrint_application::create()
|
bool TPrint_application::create()
|
||||||
@ -1592,12 +1592,12 @@ void TPrint_application::disable_print_menu()
|
|||||||
|
|
||||||
void TPrint_application::enable_setprint_menu()
|
void TPrint_application::enable_setprint_menu()
|
||||||
{
|
{
|
||||||
enable_menu_item(BAR_ITEM (1), TRUE);
|
enable_menu_item(BAR_ITEM_ID(1), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPrint_application::disable_setprint_menu()
|
void TPrint_application::disable_setprint_menu()
|
||||||
{
|
{
|
||||||
enable_menu_item (BAR_ITEM (1), FALSE);
|
enable_menu_item (BAR_ITEM_ID(1), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
TPrint_application::TPrint_application ():TApplication (), _rows (100),
|
TPrint_application::TPrint_application ():TApplication (), _rows (100),
|
||||||
@ -1621,7 +1621,7 @@ TPrint_application::TPrint_application ():TApplication (), _rows (100),
|
|||||||
_magic_currency = FALSE;
|
_magic_currency = FALSE;
|
||||||
_print_zero = FALSE;
|
_print_zero = FALSE;
|
||||||
|
|
||||||
_last_choice = BAR_ITEM (1);
|
_last_choice = BAR_ITEM_ID(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPrint_application::reset_files()
|
void TPrint_application::reset_files()
|
||||||
|
@ -124,6 +124,7 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
|||||||
if (_skip_events)
|
if (_skip_events)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
switch (o.dlg())
|
switch (o.dlg())
|
||||||
{
|
{
|
||||||
case MSK_PRINTERS:
|
case MSK_PRINTERS:
|
||||||
@ -147,15 +148,24 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
|||||||
case MSK_FONT:
|
case MSK_FONT:
|
||||||
if (e == fe_modify)
|
if (e == fe_modify)
|
||||||
{
|
{
|
||||||
TWait_cursor hourglass;
|
|
||||||
const TString& family = o.get();
|
const TString& family = o.get();
|
||||||
if (_font != family)
|
if (_font != family)
|
||||||
{
|
{
|
||||||
|
TWait_cursor hourglass;
|
||||||
_font = family;
|
_font = family;
|
||||||
fill_size_list();
|
fill_size_list();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case MSK_SIZE:
|
||||||
|
if (e == fe_modify || e == fe_close)
|
||||||
|
{
|
||||||
|
const int fs = atoi(o.get());
|
||||||
|
const int ls = 72 / get_int(MSK_LINES);
|
||||||
|
if (fs < ls/2 || fs > 4*ls/3)
|
||||||
|
ok = yesno_box(TR("La dimensione del carattere non e' adeguata all'interlinea\nSi desidera continuare ugualmente?"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
case DLG_SETPRINT:
|
case DLG_SETPRINT:
|
||||||
if (e == fe_button)
|
if (e == fe_button)
|
||||||
{
|
{
|
||||||
@ -190,7 +200,7 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
TPrinter_setup_mask::TPrinter_setup_mask()
|
TPrinter_setup_mask::TPrinter_setup_mask()
|
||||||
|
@ -307,6 +307,8 @@ void TPrint_preview_window::update_scroll_range()
|
|||||||
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
|
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
|
||||||
pnt.h -= rct.right; if (pnt.h < 0) pnt.h = 0;
|
pnt.h -= rct.right; if (pnt.h < 0) pnt.h = 0;
|
||||||
pnt.v -= rct.bottom; if (pnt.v < 0) pnt.v = 0;
|
pnt.v -= rct.bottom; if (pnt.v < 0) pnt.v = 0;
|
||||||
|
|
||||||
|
set_thumb_size(rct.right, rct.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_thumb(0, 0);
|
update_thumb(0, 0);
|
||||||
@ -394,7 +396,7 @@ void TPrint_preview_window::page_select()
|
|||||||
{
|
{
|
||||||
TMask m(TR("Ricerca"), 1, 28, 4);
|
TMask m(TR("Ricerca"), 1, 28, 4);
|
||||||
|
|
||||||
m.add_number(101, 0, TR("Pagina "), 1, 1, 4, "U").check_type(CHECK_REQUIRED);
|
m.add_number(101, 0, PR("Pagina "), 1, 1, 4, "U").check_type(CHECK_REQUIRED);
|
||||||
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
||||||
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
||||||
if (m.run())
|
if (m.run())
|
||||||
@ -657,8 +659,8 @@ void TPreview_mask::handler(WINDOW win, EVENT* ep)
|
|||||||
// Riflessione eventi di scroll
|
// Riflessione eventi di scroll
|
||||||
if (ep->type == E_HSCROLL || ep->type == E_VSCROLL)
|
if (ep->type == E_HSCROLL || ep->type == E_VSCROLL)
|
||||||
::dispatch_event(_pvf->win().win(), *ep, false);
|
::dispatch_event(_pvf->win().win(), *ep, false);
|
||||||
|
else
|
||||||
TAutomask::handler(win, ep);
|
TAutomask::handler(win, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TPreview_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
bool TPreview_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||||
|
@ -1342,7 +1342,21 @@ bool TSheet::export_handler(TMask_field& f, KEY k)
|
|||||||
if (k == K_SPACE)
|
if (k == K_SPACE)
|
||||||
{
|
{
|
||||||
TSheet& s = (TSheet&)f.mask();
|
TSheet& s = (TSheet&)f.mask();
|
||||||
TString cap; s.get_caption(cap);
|
TString cap; s.get_caption(cap);
|
||||||
|
for (char* buf = cap.get_buffer(); *buf; buf++)
|
||||||
|
{
|
||||||
|
switch (*buf)
|
||||||
|
{
|
||||||
|
case '?':
|
||||||
|
case '(':
|
||||||
|
case ')':
|
||||||
|
case '/':
|
||||||
|
case '\\':
|
||||||
|
case '*': *buf = ' '; break;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cap.strip_spaces();
|
||||||
if (cap.blank())
|
if (cap.blank())
|
||||||
cap = "export";
|
cap = "export";
|
||||||
TFilename name;
|
TFilename name;
|
||||||
|
@ -88,9 +88,12 @@ bool spotlite_send_mail(const TFilename& pdf)
|
|||||||
{
|
{
|
||||||
TToken_string to(15, ';'), cc(15, ';'), ccn(15, ';'), attach(pdf, ';');
|
TToken_string to(15, ';'), cc(15, ';'), ccn(15, ';'), attach(pdf, ';');
|
||||||
TString subj, text;
|
TString subj, text;
|
||||||
|
|
||||||
bool ui = true;
|
bool ui = true;
|
||||||
bool ok = main_app().get_next_mail(to, cc, ccn, subj, text, attach, ui);
|
bool ok = main_app().get_next_mail(to, cc, ccn, subj, text, attach, ui);
|
||||||
|
if (subj.blank())
|
||||||
|
subj.cut(0) << TR("Invio di ") << pdf.name();
|
||||||
|
if (!ui && to.empty_items() && cc.empty_items() && ccn.empty_items())
|
||||||
|
ui = true;
|
||||||
ok = xvt_mail_send(to, cc, ccn, subj, text, attach, ui) != 0;
|
ok = xvt_mail_send(to, cc, ccn, subj, text, attach, ui) != 0;
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
/* @M
|
/* @M
|
||||||
Identificatori (tag) per i menu e le voci dei menu ad uso di URL
|
Identificatori (tag) per i menu e le voci dei menu ad uso di URL
|
||||||
*/
|
*/
|
||||||
#define TASK_MENUBAR 10000
|
#define TASK_MENUBAR 10000
|
||||||
|
|
||||||
#define MENU_BAR(i) (10001+i)
|
#define MENU_BAR_ID(i) (10001+i)
|
||||||
#define BAR_ITEM(i) (5000+100*i)
|
#define BAR_ITEM_ID(i) (5000+100*i)
|
||||||
#define MENU_ITEM(i) (30000+i)
|
#define MENU_ITEM_ID(i) (30000+i)
|
||||||
#define VISWIN_BAR (7000)
|
#define VISWIN_BAR (7000)
|
||||||
#define BROWSE_BAR (8000)
|
#define BROWSE_BAR (8000)
|
||||||
|
|
||||||
|
@ -593,7 +593,8 @@ bool is_power_station()
|
|||||||
if (ps < 0)
|
if (ps < 0)
|
||||||
{
|
{
|
||||||
ps = FALSE;
|
ps = FALSE;
|
||||||
if (dongle().number() == 0 && dongle().hardware() != _dongle_network)
|
const TDongle& d = dongle();
|
||||||
|
if (d.number() == 0 && d.hardware() != _dongle_network)
|
||||||
{
|
{
|
||||||
const char* const ranger[] = { "ANTARES", "ARCHIMEDE", "BATMOBILE", "KIRK",
|
const char* const ranger[] = { "ANTARES", "ARCHIMEDE", "BATMOBILE", "KIRK",
|
||||||
"MOBILE", "PICARD", "SPOCK", "SULU", "UHURA", NULL };
|
"MOBILE", "PICARD", "SPOCK", "SULU", "UHURA", NULL };
|
||||||
|
@ -1076,6 +1076,15 @@ void TScroll_window::set_scroll_max(long maxx, long maxy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TScroll_window::set_thumb_size(long px, long py)
|
||||||
|
{
|
||||||
|
if (_has_hscroll && px >= 0)
|
||||||
|
xvt_sbar_set_proportion(win(), HSCROLL, int(px));
|
||||||
|
if (_has_vscroll && py >= 0)
|
||||||
|
xvt_sbar_set_proportion(win(), VSCROLL, int(py >> _shift));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @mfunc Aggiorna la scrollbar
|
// @mfunc Aggiorna la scrollbar
|
||||||
|
@ -368,6 +368,8 @@ public:
|
|||||||
|
|
||||||
// @cmember Setta punto di massimo scroll
|
// @cmember Setta punto di massimo scroll
|
||||||
void set_scroll_max(long maxx, long maxy);
|
void set_scroll_max(long maxx, long maxy);
|
||||||
|
// @cmember Setta le dimensioni del thumb della scroll bar
|
||||||
|
void set_thumb_size(long px, long py);
|
||||||
// @cmember Aggiorna la scrollbar
|
// @cmember Aggiorna la scrollbar
|
||||||
void update_thumb(long x = -1, long y = -1);
|
void update_thumb(long x = -1, long y = -1);
|
||||||
|
|
||||||
|
@ -169,6 +169,55 @@ RCT& resize_rect(
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT& xvtil_align_rect(const RCT& inner, const RCT& outer, char halign, char valign, char grow)
|
||||||
|
{
|
||||||
|
static RCT r;
|
||||||
|
|
||||||
|
const int ow = xvt_rect_get_width(&outer);
|
||||||
|
const int oh = xvt_rect_get_height(&outer);
|
||||||
|
int iw = xvt_rect_get_width(&inner);
|
||||||
|
int ih = xvt_rect_get_height(&inner);
|
||||||
|
int ix = 0, iy = 0;
|
||||||
|
if (iw > ow || ih > oh)
|
||||||
|
{
|
||||||
|
if (grow == '-' || grow == '*')
|
||||||
|
{
|
||||||
|
const double rx = double(ow)/iw;
|
||||||
|
const double ry = double(oh)/ih;
|
||||||
|
const double r = rx < ry ? rx : ry;
|
||||||
|
ih = int(ih*r);
|
||||||
|
iw = int(iw*r);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (iw < ow && ih < oh)
|
||||||
|
{
|
||||||
|
if (grow == '+' || grow == '*')
|
||||||
|
{
|
||||||
|
const double rx = double(ow)/iw;
|
||||||
|
const double ry = double(oh)/ih;
|
||||||
|
if (rx < ry)
|
||||||
|
ih = int(ih*rx);
|
||||||
|
else
|
||||||
|
iw = int(iw*ry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (halign)
|
||||||
|
{
|
||||||
|
case 'R': ix = outer.right-iw; break;
|
||||||
|
case 'C': ix = (outer.left + outer.right - iw) / 2; break;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
switch (valign)
|
||||||
|
{
|
||||||
|
case 'B': iy = outer.bottom-ih; break;
|
||||||
|
case 'C': iy = (outer.top + outer.bottom - ih) / 2; break;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
xvt_rect_set(&r, ix, iy, ix+iw, iy+ih);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @func Emette un suono di default
|
// @func Emette un suono di default
|
||||||
@ -497,11 +546,14 @@ WINDOW xvtil_create_window(
|
|||||||
flags,
|
flags,
|
||||||
EM_ALL, eh,
|
EM_ALL, eh,
|
||||||
app_data);
|
app_data);
|
||||||
|
CHECK(win, "Can't create a window: XVT error");
|
||||||
|
|
||||||
|
if (x == 0 && y == 0 && dx == 0 && dy == 0)
|
||||||
|
xvt_vobj_maximize(win); // Molto piu' preciso di resize_rect(0,0,0,0,parent)
|
||||||
|
|
||||||
// Utile per migliorare il calcolo delle dimensioni dei caratteri
|
// Utile per migliorare il calcolo delle dimensioni dei caratteri
|
||||||
xvt_dwin_set_font(win, xvtil_default_font());
|
xvt_dwin_set_font(win, xvtil_default_font());
|
||||||
|
|
||||||
CHECK(win, "Can't create a window: XVT error");
|
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ const long E_ADDLINE = 488L;
|
|||||||
|
|
||||||
RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent);
|
RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW parent);
|
||||||
|
|
||||||
|
// align='L|T','C','R|B' grow= '+','=','-'
|
||||||
|
RCT& xvtil_align_rect(const RCT& inner, const RCT& outer, char halign, char valign, char grow);
|
||||||
|
|
||||||
WINDOW xvtil_create_window
|
WINDOW xvtil_create_window
|
||||||
(
|
(
|
||||||
WIN_TYPE wt,
|
WIN_TYPE wt,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user