Patch level : 10.0

Files correlati     : agalib.lib
Ricompilazione Demo : [ ]
Commento            :
Aggiunto valore di ritorno agli handler delle finestre
void TWindow::handler(WINDOW win, EVENT* e)
e' diventato
long TWindow::handler(WINDOW win, EVENT* e)


git-svn-id: svn://10.65.10.50/trunk@19478 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-10-20 15:22:22 +00:00
parent 69d1f20de3
commit 3d6a0f9bae
31 changed files with 249 additions and 178 deletions

View File

@ -137,14 +137,14 @@ class TAVM_list_window : public TField_window
protected: protected:
virtual void update(); virtual void update();
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
public: public:
void set_bytecode(const TBytecode* bc, int ip, const TString_array& uw); void set_bytecode(const TBytecode* bc, int ip, const TString_array& uw);
TAVM_list_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner); TAVM_list_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner);
}; };
void TAVM_list_window::handler(WINDOW win, EVENT* ep) long TAVM_list_window::handler(WINDOW win, EVENT* ep)
{ {
if (ep->type == E_MOUSE_DOWN) if (ep->type == E_MOUSE_DOWN)
{ {
@ -156,7 +156,7 @@ void TAVM_list_window::handler(WINDOW win, EVENT* ep)
force_update(); force_update();
} }
} }
TField_window::handler(win, ep); return TField_window::handler(win, ep);
} }
void TAVM_list_window::update() void TAVM_list_window::update()

View File

@ -12,14 +12,9 @@ bool TAutomask::error_box(const char* fmt, ...)
va_end(argptr); va_end(argptr);
if (is_sheetmask() && !is_running()) if (is_sheetmask() && !is_running())
{ get_sheet()->error_box(msg);
xvtil_statbar_set(msg);
beep(2);
}
else else
{
post_error_message(msg, 3); post_error_message(msg, 3);
}
return false; return false;
} }

View File

@ -11,6 +11,8 @@ BEGIN
MESSAGE SHOW,MSK_PRINTERS|HIDE,MSK_FILENAME MESSAGE SHOW,MSK_PRINTERS|HIDE,MSK_FILENAME
ITEM "1|File su disco" ITEM "1|File su disco"
MESSAGE HIDE,MSK_PRINTERS|SHOW,MSK_FILENAME MESSAGE HIDE,MSK_PRINTERS|SHOW,MSK_FILENAME
ITEM "4|Acrobat"
MESSAGE SHOW,MSK_PRINTERS|HIDE,MSK_FILENAME
FLAGS "Z" FLAGS "Z"
END END

View File

@ -895,7 +895,7 @@ bool ini_set_bool(int cfg, const char* paragraph, const char* name, bool val, in
const TString& get_oem_info(const char* varname) const TString& get_oem_info(const char* varname)
{ {
static int oem = ini_get_int(CONFIG_OEM, "MAIN", "OEM"); TString& tmp = get_tmp_string(50);
TString8 para; para.format("OEM_%d", oem); xvt_sys_get_oem_string(varname, tmp, tmp.get_buffer(), tmp.size());
return ini_get_string(CONFIG_OEM, para, varname); return tmp;
} }

View File

@ -193,5 +193,6 @@ bool ini_set_int (int cfg, const char* para, const char* name, int v
bool ini_set_string(int cfg, const char* para, const char* name, const char* val, int idx = -1); bool ini_set_string(int cfg, const char* para, const char* name, const char* val, int idx = -1);
const TString& get_oem_info(const char* varname); // ini_get_string(CONFIG_OEM, "OEM_?", varname); const TString& get_oem_info(const char* varname); // ini_get_string(CONFIG_OEM, "OEM_?", varname);
bool is_aga_version(bool power_user_only = false);
#endif #endif

View File

@ -769,7 +769,7 @@ bool TDongle::burn_hardlock()
{ {
memcpy(data, &_eprom[60], sizeof(data)); memcpy(data, &_eprom[60], sizeof(data));
garble(data); garble(data);
if (data[0] < 1997 || data[0] > 2997) if (data[0] < 2001 || data[0] > 3001)
return error_box("On Line Assistance error."); return error_box("On Line Assistance error.");
if (data[1] == 0 || data[1] >= 10000) if (data[1] == 0 || data[1] >= 10000)
return error_box("Bad users number."); return error_box("Bad users number.");

View File

@ -4569,8 +4569,8 @@ void TForm::read(
// read base form // read base form
TFilename n(_name); n.ext("frm"); TFilename n(_name); n.ext("frm");
n.custom_path();
if (n.exist()) if (n.custom_path())
{ {
_filename = n; _filename = n;
printer().set_form_name(n); printer().set_form_name(n);
@ -4585,16 +4585,15 @@ void TForm::read(
TString filter(80); TString filter(80);
ok = parse_use(scanner, filter); ok = parse_use(scanner, filter);
while (ok && scanner.popkey() == "JO" || scanner.key() == "SO") while (ok)
{ {
if (scanner.key() == "JO") const TString& k = scanner.popkey();
ok = parse_join(scanner); if (k == "JO") ok = parse_join(scanner); else
else // join a sorted file if (k == "SO") ok = parse_sortedjoin(scanner);
{ else
ok= parse_sortedjoin(scanner); break;
} }
} if (filter.full())
if (!filter.empty())
_cursor->setfilter(filter); _cursor->setfilter(filter);
parse_description(scanner); // Parse description parse_description(scanner); // Parse description
} }

View File

@ -508,7 +508,7 @@ class TGolem_window : public TField_window
protected: protected:
virtual bool on_key(KEY k); virtual bool on_key(KEY k);
virtual void update(); virtual void update();
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
public: public:
@ -633,7 +633,7 @@ bool TGolem_window::on_key(KEY k)
return TField_window::on_key(k); return TField_window::on_key(k);
} }
void TGolem_window::handler(WINDOW win, EVENT* ep) long TGolem_window::handler(WINDOW win, EVENT* ep)
{ {
switch (ep->type) switch (ep->type)
{ {
@ -679,7 +679,7 @@ void TGolem_window::handler(WINDOW win, EVENT* ep)
default: default:
break; break;
} }
TField_window::handler(win, ep); return TField_window::handler(win, ep);
} }
TGolem_window::TGolem_window(int x, int y, int dx, int dy, WINDOW parent, TGolem_client_field* owner) TGolem_window::TGolem_window(int x, int y, int dx, int dy, WINDOW parent, TGolem_client_field* owner)

View File

@ -239,7 +239,7 @@ bool rpc_UserLogin(const char* server, const char* user,
if (_client == NULL) if (_client == NULL)
{ {
if (!rpc_Start()) if (!rpc_Start())
return FALSE; return false;
} }
const bool local = server == NULL || *server == '\0' || const bool local = server == NULL || *server == '\0' ||
@ -308,7 +308,7 @@ bool rpc_UserLogout(const char* appname)
_connection = 0; _connection = 0;
} }
return TRUE; return true;
} }
bool http_isredirected_server(TString& server, bool http_isredirected_server(TString& server,
@ -330,10 +330,7 @@ bool http_isredirected_server(TString& server,
return ok; return ok;
} }
bool http_get(const char* server, bool http_get(const char* server, const char* remote_file, const char* local_file, const char* authorization)
const char* remote_file,
const char* local_file,
const char* authorization)
{ {
TSocketClient client; TSocketClient client;
if (!client.IsOk()) if (!client.IsOk())

View File

@ -71,8 +71,12 @@ TMask::TMask(const char* title, int pages, int cols, int rows,
init_mask(); init_mask();
if (pages > 1) if (pages > 1)
{ {
WINDOW w = create_interface(parent, xpos, ypos, cols, rows, title, this); //WINDOW w = create_interface(parent, xpos, ypos, cols, rows, title, this);
set_win(w); // Crea la pagina principale che ospitera' il notebook //set_win(w); // Crea la pagina principale che ospitera' il notebook
const WIN_TYPE wt = (cols == 0) ? W_PLAIN : W_DOC;
const long wsf = WSF_INVISIBLE | WSF_NO_MENUBAR;
create(xpos, ypos, cols, rows, title, wsf, wt);
create_book(false); // Crea il notebook che ospitera' le pagine create_book(false); // Crea il notebook che ospitera' le pagine
for (int p = 1; p <= pages; p++) for (int p = 1; p <= pages; p++)
{ {
@ -782,7 +786,7 @@ void TMask::on_button(short)
/* Non devo fare niente !!! non essendo una TWindow */ /* Non devo fare niente !!! non essendo una TWindow */
} }
void TMask::handler(WINDOW w, EVENT* ep) long TMask::handler(WINDOW w, EVENT* ep)
{ {
static TSheet_field* _last_sheet = NULL; static TSheet_field* _last_sheet = NULL;
@ -817,7 +821,7 @@ void TMask::handler(WINDOW w, EVENT* ep)
xvt_res_free_menu_tree(menu); xvt_res_free_menu_tree(menu);
} }
} }
return; return 0L;
} }
if (ep->type == E_COMMAND) if (ep->type == E_COMMAND)
{ {
@ -832,12 +836,12 @@ void TMask::handler(WINDOW w, EVENT* ep)
case 4: _last_sheet->esporta(); break; case 4: _last_sheet->esporta(); break;
default: break; default: break;
} }
return; return 0L;
} }
if (tag == M_HELP_ONCONTEXT) if (tag == M_HELP_ONCONTEXT)
{ {
on_key(K_F1); on_key(K_F1);
return; return 0L;
} }
} }
@ -868,11 +872,16 @@ void TMask::handler(WINDOW w, EVENT* ep)
case WC_NOTEBK: case WC_NOTEBK:
if (ep->v.ctl.ci.win == _notebook) if (ep->v.ctl.ci.win == _notebook)
{ {
const int new_page = ep->v.ctl.ci.v.notebk.tab_no; const int new_page = ep->v.ctl.ci.v.notebk.page_new;
if (new_page != _page && new_page < _pages) // Cambio pagina effettivo if (new_page != _page && new_page < _pages) // Cambio pagina effettivo
{ {
if (fld(_focus).on_key(K_TAB)) bool can_proceed = true;
if (_focus >= 0 && find_parent_page(fld(_focus)) != new_page)
can_proceed = check_current_field();
if (can_proceed)
show_page(new_page); show_page(new_page);
else
return 1;
} }
} }
break; break;
@ -902,7 +911,7 @@ void TMask::handler(WINDOW w, EVENT* ep)
break; break;
} }
} }
return; return 0L;
} }
if (ep->type == E_UPDATE && w == page_win(0)) if (ep->type == E_UPDATE && w == page_win(0))
@ -927,7 +936,7 @@ void TMask::handler(WINDOW w, EVENT* ep)
} }
} }
TWindow::handler(w, ep); return TWindow::handler(w, ep);
} }
@ -1241,8 +1250,9 @@ WINDOW TMask::create_book(bool single)
WINDOW parent = win(); WINDOW parent = win();
if (parent == NULL_WIN) if (parent == NULL_WIN)
{ {
parent = create_interface(NULL_WIN, 0, 0, 0, 0, "", this); //parent = create_interface(NULL_WIN, 0, 0, 0, 0, "", this);
set_win(parent); //set_win(parent);
parent = create(0, 0, 0, 0, "", WSF_INVISIBLE|WSF_NO_MENUBAR, W_PLAIN);
} }
if (single) if (single)
{ {
@ -1856,12 +1866,9 @@ void TMask::on_idle()
set_focus(); set_focus();
switch(_error_severity) switch(_error_severity)
{ {
case 2: case 2: xvt_dm_popup_warning(_error_message); break;
warning_box("%s", (const char*)_error_message); break; case 3: xvt_dm_popup_error (_error_message); break;
case 3: default: xvt_dm_popup_message(_error_message); break;
error_box("%s", (const char*)_error_message); break;
default:
message_box("%s", (const char*)_error_message); break;
} }
_error_severity = 0; _error_severity = 0;
} }
@ -2584,8 +2591,8 @@ TTimed_box::TTimed_box(const char * header,const char * message,int seconds,shor
: TMask(header,1,x,y) : TMask(header,1,x,y)
{ {
// costruisce una maschera run time // costruisce una maschera run time
add_memo(FIRST_FIELD, 0, "", 1, 0,-1,-3); TMemo_field& m = add_memo(DLG_NULL, 0, "", 1, 0,-1,-3);
set(FIRST_FIELD, message); m.set(message);
// setta il timer per l'evento // setta il timer per l'evento
_timer_delay=seconds * 1000 + 1; _timer_delay=seconds * 1000 + 1;
@ -2601,11 +2608,11 @@ void TTimed_box::start_run()
TMask::start_run(); TMask::start_run();
} }
void TTimed_box::handler(WINDOW win, EVENT* ep) long TTimed_box::handler(WINDOW win, EVENT* ep)
{ {
if (ep->type == E_TIMER && ep->v.timer.id==_timer_id) if (ep->type == E_TIMER && ep->v.timer.id==_timer_id)
send_key(K_SPACE, _button_id); send_key(K_SPACE, _button_id);
TMask::handler(win, ep); return TMask::handler(win, ep);
} }
TTimed_box::~TTimed_box() TTimed_box::~TTimed_box()
@ -2654,3 +2661,4 @@ TYesnoallnone_box::TYesnoallnone_box(const char * message, int default_key)
TYesnoallnone_box::~TYesnoallnone_box() TYesnoallnone_box::~TYesnoallnone_box()
{} {}

View File

@ -41,7 +41,7 @@ class TMask : public TWindow
enum { MAX_PAGES = 16 }; enum { MAX_PAGES = 16 };
// @cmember Gestisce gli eventi della finestra // @cmember Gestisce gli eventi della finestra
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
// @access:(INTERNAL) Private Member // @access:(INTERNAL) Private Member
private: private:
@ -464,9 +464,11 @@ class TTimed_box: public TMask
long _timer_delay; long _timer_delay;
long _timer_id; long _timer_id;
short _button_id; short _button_id;
protected: protected:
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
virtual void start_run(); virtual void start_run();
public: public:
TTimed_box(const char * header,const char * message,int seconds,short button_id,int x,int y); TTimed_box(const char * header,const char * message,int seconds,short button_id,int x,int y);
~TTimed_box(); ~TTimed_box();

View File

@ -1659,7 +1659,7 @@ class TField_window : public TScroll_window
protected: protected:
virtual void update(); virtual void update();
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
void set_owner(TWindowed_field* o); void set_owner(TWindowed_field* o);
public: public:

View File

@ -2560,11 +2560,13 @@ bool TSpreadsheet::add_row_auto()
bool TSpreadsheet::error_box(const char* msg) bool TSpreadsheet::error_box(const char* msg)
{ {
_check_enabled = false; _check_enabled = false;
xvt_dm_post_speech(msg, 0, TRUE);
const int r = _cur_row; const int r = _cur_row;
const int c = _cur_col; const int c = _cur_col;
::error_box(msg);
xvt_scr_set_focus_vobj(parent()); xvt_dm_popup_error(msg); // was xvt_dm_post_error(msg);
TMask& m = owner().mask();
m.set_focus_field(owner().dlg());
set_focus_cell(r, c); set_focus_cell(r, c);
xvt_win_set_caret_visible(parent(), true); xvt_win_set_caret_visible(parent(), true);
_check_enabled = true; _check_enabled = true;
@ -3152,8 +3154,6 @@ bool TSheet_field::on_key(KEY k)
s->add_row_auto(); s->add_row_auto();
return true; return true;
} }
return TOperable_field::on_key(k); return TOperable_field::on_key(k);
} }

View File

@ -2,6 +2,7 @@
#include <automask.h> #include <automask.h>
#include <config.h> #include <config.h>
#include <golem.h> #include <golem.h>
#include <execp.h>
#include <printer.h> #include <printer.h>
#include <printwin.h> #include <printwin.h>
#include <toolfld.h> #include <toolfld.h>
@ -231,6 +232,8 @@ TPrinter_setup_mask::TPrinter_setup_mask()
set(MSK_TYPE, "1"); set(MSK_TYPE, "1");
else if (pr._printertype == screenvis) else if (pr._printertype == screenvis)
set(MSK_TYPE, "2"); set(MSK_TYPE, "2");
else if (pr._printertype == acrobatprinter)
set(MSK_TYPE, "4");
else else
set(MSK_TYPE, "0"); set(MSK_TYPE, "0");
@ -1402,6 +1405,7 @@ void TPrinter::read_configuration(
case 1: _printertype = fileprinter; break; case 1: _printertype = fileprinter; break;
case 2: _printertype = screenvis; break; case 2: _printertype = screenvis; break;
case 3: _printertype = exportprinter; break; case 3: _printertype = exportprinter; break;
case 4: _printertype = acrobatprinter; break;
default: _printertype = winprinter; break; default: _printertype = winprinter; break;
} }
} }
@ -1559,11 +1563,12 @@ bool TPrinter::printrow(
if (_currentpage < _frompage || _currentpage > _topage) if (_currentpage < _frompage || _currentpage > _topage)
return true; return true;
TString rw (rowtoprint == NULL ? "" : ((_printertype == screenvis || _printertype == winprinter || TString rw;
_printertype == exportprinter) ? if (rowtoprint != NULL)
rowtoprint->row_codified () : {
rowtoprint->row ())); rw = (_printertype == fileprinter) ? rowtoprint->row() : rowtoprint->row_codified();
rw.rtrim(); rw.rtrim();
}
int lun = rw.len (); int lun = rw.len ();
int idx; int idx;
@ -1815,6 +1820,8 @@ bool TPrinter::set()
break; break;
case 2: // video case 2: // video
_printertype = screenvis; break; _printertype = screenvis; break;
case 4: // acrobat
_printertype = acrobatprinter; break;
default: // stampante default: // stampante
_printertype = winprinter; break; _printertype = winprinter; break;
} }
@ -1905,7 +1912,6 @@ bool TPrinter::print_txt(TTextfile& txt)
return ok; return ok;
} }
bool TPrinter::print_pdf(TTextfile& txt, const TFilename& pdf) bool TPrinter::print_pdf(TTextfile& txt, const TFilename& pdf)
{ {
bool ok = txt.lines() > 0; bool ok = txt.lines() > 0;
@ -1932,6 +1938,21 @@ bool TPrinter::print_pdf(TTextfile& txt, const TFilename& pdf)
return ok; return ok;
} }
bool TPrinter::acrobatically_print_pdf(const TFilename& pdf) const
{
TString cmd(512);
bool ok = xvt_sys_find_editor(pdf, cmd.get_buffer()) != FALSE;
if (ok)
{
// /s=suppress banner; /t=file name + printer name
cmd << " /s /t \"" << pdf << "\" \"" << printername() << "\"";
xvt_sys_execute(cmd, TRUE, FALSE);
}
else
error_box(TR("Adobe Acrobat non installato"));
return ok;
}
void TPrinter::close () void TPrinter::close ()
{ {
@ -1945,7 +1966,46 @@ void TPrinter::close ()
_fp = NULL; _fp = NULL;
} }
if (_printertype == screenvis) switch (_printertype)
{
case winprinter:
if (_txt.lines() > 0L)
print_txt(_txt);
break;
case fileprinter:
{
FILE* fp = fopen(_printerfile, _appendfile ? "a" : "w");
if (fp == NULL)
{
error_box(FR("Impossibile aprire il file %s"), (const char*)_printerfile);
return;
}
for (long i = 0; i < _txt.lines(); i++)
fprintf(fp,"%s\n", _txt.line(i));
fclose(fp);
message_box(FR("Stampa su file terminata. Nome archivio: %s"),(const char *)_printerfile);
}
break;
case exportprinter:
if (_exportfile.not_empty() && _txt.lines() > 0L)
{
ofstream txt(_exportfile);
for (long i = 0; i < _txt.lines(); i++)
txt << _txt.line_formatted(i) << '\n';
txt.close();
}
break;
case acrobatprinter:
{
TWait_cursor hourglass;
TFilename fn; fn.tempdir(); fn.add("tmp.pdf");
if (print_pdf(_txt, fn))
acrobatically_print_pdf(fn);
fn.fremove();
}
break;
case screenvis:
default:
{ {
_vf->close_print(); _vf->close_print();
const KEY key = _vf->run(); const KEY key = _vf->run();
@ -1962,32 +2022,7 @@ void TPrinter::close ()
delete _vf; _vf = NULL; delete _vf; _vf = NULL;
} }
else if (_printertype == exportprinter) break;
{
if (_exportfile.not_empty() && _txt.lines() > 0L)
{
ofstream txt(_exportfile);
for (long i = 0; i < _txt.lines(); i++)
txt << _txt.line_formatted(i) << '\n';
txt.close();
}
}
else if (_printertype == winprinter && _txt.lines() > 0L)
{
print_txt(_txt);
}
else if (_printertype == fileprinter)
{
FILE* fp = fopen(_printerfile, _appendfile ? "a" : "w");
if (fp == NULL)
{
error_box(FR("Impossibile aprire il file %s"), (const char*)_printerfile);
return;
}
for (long i = 0; i < _txt.lines(); i++)
fprintf(fp,"%s\n", _txt.line(i));
fclose(fp);
message_box(FR("Stampa su file terminata. Nome archivio: %s"),(const char *)_printerfile);
} }
if (_finker) if (_finker)

View File

@ -33,7 +33,8 @@ enum TPrtype
winprinter = 0, // @emem Stampa su stampante normale winprinter = 0, // @emem Stampa su stampante normale
fileprinter = 1, // @emem Stampa su file fileprinter = 1, // @emem Stampa su file
screenvis = 2, // @emem Anteprima a video screenvis = 2, // @emem Anteprima a video
exportprinter = 3 // @emem Esporatzione di stampa exportprinter= 3, // @emem Esportazione di stampa
acrobatprinter=4, // @emem Stampa tramite Acrobat
}; };
// @doc EXTERNAL // @doc EXTERNAL
@ -421,6 +422,8 @@ public:
bool print_txt(TTextfile& txt); bool print_txt(TTextfile& txt);
// @cmember Stampa il testo su pdf // @cmember Stampa il testo su pdf
bool print_pdf(TTextfile& txt, const TFilename& fn); bool print_pdf(TTextfile& txt, const TFilename& fn);
// @cmember Stampa il pdf con Acrobat
bool acrobatically_print_pdf(const TFilename& pdf) const;
// @cmember Setta l'handle dell'header // @cmember Setta l'handle dell'header
void setheaderhandler(PRINTSECTIONHANDLER h) void setheaderhandler(PRINTSECTIONHANDLER h)

View File

@ -277,7 +277,7 @@ bool TProgind::setstatus(long l)
// TTimerind ------------------------------------------------------------ // TTimerind ------------------------------------------------------------
void TTimerind::handler(WINDOW w, EVENT* e) long TTimerind::handler(WINDOW w, EVENT* e)
{ {
switch(e->type) switch(e->type)
{ {
@ -296,7 +296,7 @@ void TTimerind::handler(WINDOW w, EVENT* e)
default: default:
break; break;
} }
TIndwin::handler(w,e); return TIndwin::handler(w,e);
} }
TTimerind::TTimerind(long msec, const char* txt, bool cancel, bool bar, int div, int i) TTimerind::TTimerind(long msec, const char* txt, bool cancel, bool bar, int div, int i)

View File

@ -145,7 +145,7 @@ class TTimerind : public TIndwin
// @access Protected Member // @access Protected Member
protected: protected:
// @cmember Gestisce gli eventi della finestra // @cmember Gestisce gli eventi della finestra
virtual void handler(WINDOW w, EVENT* e); virtual long handler(WINDOW w, EVENT* e);
// @access Public Member // @access Public Member
public: public:

View File

@ -1636,8 +1636,8 @@ void real::print_on(ostream& out) const
void TDistrib::add(real slice) void TDistrib::add(real slice)
{ {
if (slice > real (1.0)) if (slice > UNO)
slice /= 100.0; slice /= CENTO;
CHECK (!_ready, "TDistrib: les jeux sont faits"); CHECK (!_ready, "TDistrib: les jeux sont faits");
_slices.add (slice); _slices.add (slice);
} }
@ -1668,10 +1668,11 @@ void TDistrib::init (
// cambia solo il totale // cambia solo il totale
{ {
_current = 0; _prog = 0; _current = 0; _prog = 0;
_tot = r; _ready = FALSE; _tot = r; _ready = false;
if (zap) _slices.destroy(); if (zap) _slices.destroy();
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Generic_distrib // Generic_distrib
// Oggetto per dividere un real in parti prefissate // Oggetto per dividere un real in parti prefissate
@ -1688,7 +1689,7 @@ void TGeneric_distrib::add(real slice)
real TGeneric_distrib::get () real TGeneric_distrib::get ()
{ {
_ready = TRUE; _ready = true;
CHECK (_current < _slices.items(), "TGeneric_distrib: too many gets"); CHECK (_current < _slices.items(), "TGeneric_distrib: too many gets");
real & currslice = (real &) _slices[_current++]; real & currslice = (real &) _slices[_current++];
real r = currslice; real r = currslice;

View File

@ -338,15 +338,9 @@ extern const real ZERO;
extern const real UNO; extern const real UNO;
extern const real CENTO; extern const real CENTO;
// @doc EXTERNAL
// @class TDistrib | Classe per dividere un <c real> in varie sue percentuali
// in modo che la loro somma dia sempre il real di partenza
//
// @base public | TObject
class TDistrib : public TObject class TDistrib : public TObject
// @author:(INTERNAL) Guido // @author:(INTERNAL) Villa
{ {
// @access:(INTERNAL) Private Member // @access:(INTERNAL) Private Member
@ -396,6 +390,7 @@ public:
{} {}
}; };
// @doc EXTERNAL // @doc EXTERNAL
// @class TGeneric_distrib | Classe per dividere un real in parti fissate // @class TGeneric_distrib | Classe per dividere un real in parti fissate

View File

@ -1597,7 +1597,10 @@ void TRecordset_sheet::get_row(long r, TToken_string& row)
if (_query.move_to(r)) if (_query.move_to(r))
{ {
TString str; TString str;
for (unsigned int c = 0; c < _query.columns(); c++) unsigned int cols = _query.sheet_head().items();
if (cols == 0)
cols = _query.columns();
for (unsigned int c = 0; c < cols; c++)
{ {
_query.get(c).as_string(str); _query.get(c).as_string(str);
row.add(str); row.add(str);

View File

@ -5,13 +5,13 @@
#include <defmask.h> #include <defmask.h>
#include <diction.h> #include <diction.h>
#include <dongle.h> #include <dongle.h>
#include <execp.h>
#include <modaut.h> #include <modaut.h>
#include <printer.h> #include <printer.h>
#include <progind.h> #include <progind.h>
#include <reprint.h> #include <reprint.h>
#include <spotlite.h> #include <spotlite.h>
#include <statbar.h> #include <statbar.h>
#include <treectrl.h>
#include <urldefid.h> #include <urldefid.h>
#include <utility.h> #include <utility.h>
#include <xvtility.h> #include <xvtility.h>
@ -256,7 +256,7 @@ protected:
const TReport_link* find_link(const PNT& pnt) const; const TReport_link* find_link(const PNT& pnt) const;
void draw_page(int pg); void draw_page(int pg);
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
virtual void update(); virtual void update();
virtual bool on_key(KEY k); virtual bool on_key(KEY k);
@ -468,7 +468,7 @@ const TReport_link* TPrint_preview_window::find_link(const PNT& pnt) const
return NULL; return NULL;
} }
void TPrint_preview_window::handler(WINDOW win, EVENT* ep) long TPrint_preview_window::handler(WINDOW win, EVENT* ep)
{ {
static PNT ptPan; static PNT ptPan;
@ -565,9 +565,9 @@ void TPrint_preview_window::handler(WINDOW win, EVENT* ep)
} }
break; break;
default: default:
TField_window::handler(win, ep); return TField_window::handler(win, ep);
break;
} }
return 0L;
} }
void TPrint_preview_window::do_scroll(int kx, int ky) void TPrint_preview_window::do_scroll(int kx, int ky)
@ -663,7 +663,7 @@ protected:
virtual bool on_key(KEY k); virtual bool on_key(KEY k);
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
virtual TMask_field* parse_field(TScanner& scanner); virtual TMask_field* parse_field(TScanner& scanner);
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
public: public:
TPreview_mask(TBook* book); TPreview_mask(TBook* book);
@ -694,7 +694,7 @@ bool TPreview_mask::on_key(KEY k)
return TAutomask::on_key(k); return TAutomask::on_key(k);
} }
void TPreview_mask::handler(WINDOW win, EVENT* ep) long TPreview_mask::handler(WINDOW win, EVENT* ep)
{ {
// Riflessione eventi di scroll // Riflessione eventi di scroll
switch (ep->type) switch (ep->type)
@ -713,9 +713,9 @@ void TPreview_mask::handler(WINDOW win, EVENT* ep)
} }
break; break;
default: default:
TAutomask::handler(win, ep); return TAutomask::handler(win, ep);
break;
} }
return 0L;
} }
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)
@ -2073,9 +2073,10 @@ bool TBook::print(size_t pagefrom, size_t pageto, word copies)
if (pages() <= 0) if (pages() <= 0)
return false; return false;
TPrinter& p = printer();
if (pagefrom == 0) if (pagefrom == 0)
{ {
TPrinter& p = printer();
TMask msk("bagn003"); TMask msk("bagn003");
msk.set(F_PRINTER, p.printername()); msk.set(F_PRINTER, p.printername());
msk.set(F_FORM, p.get_form_name()); msk.set(F_FORM, p.get_form_name());
@ -2089,7 +2090,7 @@ bool TBook::print(size_t pagefrom, size_t pageto, word copies)
msk.set(F_COPIES, 1); msk.set(F_COPIES, 1);
if (msk.run() == K_ENTER) if (msk.run() == K_ENTER)
{ {
_copies = msk.get_int(F_COPIES); _copies = max(msk.get_int(F_COPIES), 1);
_pagefrom = msk.get_int(F_FROMPAGE); _pagefrom = msk.get_int(F_FROMPAGE);
_pageto = msk.get_int(F_TOPAGE); _pageto = msk.get_int(F_TOPAGE);
} }
@ -2100,11 +2101,28 @@ bool TBook::print(size_t pagefrom, size_t pageto, word copies)
{ {
_pagefrom = pagefrom; _pagefrom = pagefrom;
_pageto = pageto; _pageto = pageto;
_copies = copies; _copies = max(copies, 1);
} }
bool ok = false;
if (p.printtype() == acrobatprinter)
{
TFilename f;
f.tempdir(); f.add("tmp.pdf");
f.fremove();
_pdf_file = f;
ok = xvt_print_start_thread(main_loop_callback, (long)this) != 0;
if (ok && fsize(f) > 0)
printer().acrobatically_print_pdf(f);
f.fremove();
}
else
{
_pdf_file.cut(0); _pdf_file.cut(0);
return xvt_print_start_thread(main_loop_callback, (long)this) != 0; ok = xvt_print_start_thread(main_loop_callback, (long)this) != 0;
}
return ok;
} }
bool TBook::export_pdf(TFilename& filename, bool signature) bool TBook::export_pdf(TFilename& filename, bool signature)
@ -2123,9 +2141,9 @@ bool TBook::export_pdf(TFilename& filename, bool signature)
if (ok && signature && main_app().has_module(FDAUT)) // Controllo paranoico dei permessi if (ok && signature && main_app().has_module(FDAUT)) // Controllo paranoico dei permessi
{ {
char outfile[_MAX_PATH] = ""; char outfile[_MAX_PATH] = "";
if (xvt_sign_file(filename, outfile)) if (xvt_sign_file(filename, outfile) && filename != outfile)
{ {
xvt_fsys_remove_file(filename); // Sbatto via il documento originale non firmato filename.fremove(); // Sbatto via il documento originale non firmato
filename = outfile; filename = outfile;
} }
} }
@ -2226,9 +2244,7 @@ bool TBook::print_or_preview()
bool ok = true; bool ok = true;
switch (printer().printtype()) switch (printer().printtype())
{ {
case screenvis: case screenvis: ok = preview(); break;
ok = preview();
break;
case exportprinter: case exportprinter:
{ {
TFilename f = printer().get_export_file(); TFilename f = printer().get_export_file();
@ -2237,9 +2253,17 @@ bool TBook::print_or_preview()
xvt_sys_goto_url(f, "open"); xvt_sys_goto_url(f, "open");
} }
break; break;
default: case acrobatprinter:
ok = print(); {
TFilename f; f.tempdir(); f.add("tmp.pdf");
if (export_pdf(f, false))
{
printer().acrobatically_print_pdf(f);
f.fremove();
}
}
break; break;
default: ok = print(); break;
} }
return ok; return ok;
} }

View File

@ -1719,7 +1719,7 @@ bool TBrowse_sheet::filter_handler(TMask_field& f, KEY k)
// @doc EXTERNAL // @doc EXTERNAL
// @mfunc Gestisce l'handler della finestra // @mfunc Gestisce l'handler della finestra
void TBrowse_sheet::handler( long TBrowse_sheet::handler(
WINDOW win, // @parm Finestra da gestire WINDOW win, // @parm Finestra da gestire
EVENT* ep) // @parm Evento da gestire nella finestra EVENT* ep) // @parm Evento da gestire nella finestra
{ {
@ -1739,7 +1739,7 @@ void TBrowse_sheet::handler(
dictionary_translate_menu(menu); dictionary_translate_menu(menu);
xvt_menu_popup(menu->child, win, ep->v.mouse.where, XVT_POPUP_LEFT_ALIGN, NULL); xvt_menu_popup(menu->child, win, ep->v.mouse.where, XVT_POPUP_LEFT_ALIGN, NULL);
xvt_res_free_menu_tree(menu); xvt_res_free_menu_tree(menu);
return; // no default handling! return 0L; // no default handling!
} }
} }
} }
@ -1761,16 +1761,16 @@ void TBrowse_sheet::handler(
{ {
case 1: case 1:
save_columns_order(field()); save_columns_order(field());
return; return 0L;
case 2: case 2:
set_columns_order(NULL); set_columns_order(NULL);
return; return 0L;
case 3: case 3:
fld(0).on_key(K_F11); fld(0).on_key(K_F11);
return; return 0L;
case 4: case 4:
on_key(K_CTRL + 'E'); on_key(K_CTRL + 'E');
return; return 0L;
default: default:
break; break;
} }
@ -1779,7 +1779,7 @@ void TBrowse_sheet::handler(
break; break;
} }
TCursor_sheet::handler(win, ep); return TCursor_sheet::handler(win, ep);
} }
bool lst_handler(TMask_field& lst, KEY k) bool lst_handler(TMask_field& lst, KEY k)

View File

@ -240,7 +240,7 @@ protected:
// @cmember Gestisce la pressione del tasto (vedi <mf TWindow::on_key>) // @cmember Gestisce la pressione del tasto (vedi <mf TWindow::on_key>)
virtual bool on_key(KEY k); virtual bool on_key(KEY k);
// @cmember Gestisce gli eventi della finestra // @cmember Gestisce gli eventi della finestra
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
// @cmember Ritorna il campo a cui si riferisce lo sheet // @cmember Ritorna il campo a cui si riferisce lo sheet
TEdit_field& field() { return _field; } TEdit_field& field() { return _field; }

View File

@ -13,15 +13,7 @@
// TField_window // TField_window
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
#ifndef INCL_XI long TField_window::handler(WINDOW win, EVENT* ep)
extern "C"
{
void xi_draw_3d_rect( WINDOW win, RCT* rctp, BOOLEAN well, int height,
COLOR color_light, COLOR color_ctrl, COLOR color_dark );
}
#endif
void TField_window::handler(WINDOW win, EVENT* ep)
{ {
switch (ep->type) switch (ep->type)
{ {
@ -37,13 +29,13 @@ void TField_window::handler(WINDOW win, EVENT* ep)
if (ep->v.mouse.button == 1 && _owner != NULL) if (ep->v.mouse.button == 1 && _owner != NULL)
{ {
_owner->on_key(K_F11); _owner->on_key(K_F11);
return; return 0L;
} }
break; break;
default: default:
break; break;
} }
TScroll_window::handler(win, ep); return TScroll_window::handler(win, ep);
} }
bool TField_window::on_key(KEY k) bool TField_window::on_key(KEY k)
@ -201,7 +193,7 @@ TWindowed_field::~TWindowed_field()
// TControl_host_window // TControl_host_window
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
void TControl_host_window::handler(WINDOW win, EVENT* ep) long TControl_host_window::handler(WINDOW win, EVENT* ep)
{ {
switch (ep->type) switch (ep->type)
{ {
@ -215,12 +207,12 @@ void TControl_host_window::handler(WINDOW win, EVENT* ep)
break; break;
case E_UPDATE: case E_UPDATE:
if (_ctrl != NULL_WIN) if (_ctrl != NULL_WIN)
return; // Inutile disegnare: _ctrl occupa tutta la client area return 0L; // Inutile disegnare: _ctrl occupa tutta la client area
break; break;
default: default:
break; break;
} }
TField_window::handler(win, ep); return TField_window::handler(win, ep);
} }
TControl_host_window::TControl_host_window(int x, int y, int dx, int dy, TControl_host_window::TControl_host_window(int x, int y, int dx, int dy,
@ -247,7 +239,7 @@ private:
protected: // TWindow protected: // TWindow
virtual void update(); virtual void update();
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
virtual void force_update(); virtual void force_update();
public: public:
@ -408,21 +400,24 @@ void TTree_window::update()
} }
} }
void TTree_window::handler(WINDOW win, EVENT* ep) long TTree_window::handler(WINDOW win, EVENT* ep)
{ {
switch (ep->type) switch (ep->type)
{ {
case E_CONTROL: case E_CONTROL:
if (ep->v.ctl.ci.type == WC_TREE && _tree != NULL) if (ep->v.ctl.ci.type == WC_TREE && _tree != NULL)
{
handle_tree_event(ep); handle_tree_event(ep);
return 0L;
}
break; break;
case E_UPDATE: case E_UPDATE:
update(); // TControl_host_window non lo fa update(); // TControl_host_window non lo fa
return; return 0L;
default: default:
break; break;
} }
TControl_host_window::handler(win, ep); return TControl_host_window::handler(win, ep);
} }
bool TTree_window::select_current() bool TTree_window::select_current()
@ -599,7 +594,7 @@ TField_window* TTree_field::create_window(int x, int y, int dx, int dy, WINDOW p
class TOutlook_window : public TControl_host_window class TOutlook_window : public TControl_host_window
{ {
public: public:
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
public: public:
int add_item(short icon, const char* text, int flags); int add_item(short icon, const char* text, int flags);
@ -610,7 +605,7 @@ public:
TOutlook_window(int x, int y, int dx, int dy, WINDOW parent, TOutlook_field* owner); TOutlook_window(int x, int y, int dx, int dy, WINDOW parent, TOutlook_field* owner);
}; };
void TOutlook_window::handler(WINDOW win, EVENT* ep) long TOutlook_window::handler(WINDOW win, EVENT* ep)
{ {
switch (ep->type) switch (ep->type)
{ {
@ -618,13 +613,13 @@ void TOutlook_window::handler(WINDOW win, EVENT* ep)
if (ep->v.ctl.ci.type == WC_OUTLOOKBAR) if (ep->v.ctl.ci.type == WC_OUTLOOKBAR)
{ {
owner().on_key(K_SPACE); owner().on_key(K_SPACE);
return; return 0L;
} }
break; break;
default: default:
break; break;
} }
TControl_host_window::handler(win, ep); return TControl_host_window::handler(win, ep);
} }
int TOutlook_window::add_item(short icon, const char* text, int flags) int TOutlook_window::add_item(short icon, const char* text, int flags)

View File

@ -12,7 +12,7 @@ protected:
WINDOW _ctrl; WINDOW _ctrl;
protected: protected:
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
TControl_host_window(int x, int y, int dx, int dy, TControl_host_window(int x, int y, int dx, int dy,
WINDOW parent, TWindowed_field* owner); WINDOW parent, TWindowed_field* owner);
}; };

View File

@ -606,6 +606,14 @@ bool is_power_station()
return ps != 0; return ps != 0;
} }
bool is_power_reseller(bool power_user_only)
{
bool yes = xvt_sys_get_oem_int("OEM", -1);
if (yes && power_user_only)
yes = is_power_station();
return yes;
}
bool expand_sys_vars(TString& str) bool expand_sys_vars(TString& str)
{ {
bool found = false; bool found = false;

View File

@ -51,6 +51,7 @@ istream& eatwhite (istream& i);
const TString& get_hostname(); const TString& get_hostname();
bool is_power_station(); bool is_power_station();
bool is_power_reseller(bool power_user_only = false);
long daytime(); long daytime();
bool expand_sys_vars(TString& str); bool expand_sys_vars(TString& str);

View File

@ -1326,7 +1326,7 @@ void TViswin::on_button(short dlg)
} }
void TViswin::handler (WINDOW win, EVENT * ep) long TViswin::handler (WINDOW win, EVENT * ep)
{ {
static bool ignore = FALSE; static bool ignore = FALSE;
@ -1855,7 +1855,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
if (_isselection) if (_isselection)
display_selection (); display_selection ();
} }
TWindow::handler (win, ep); return TWindow::handler (win, ep);
} }
bool TViswin::on_key(KEY key) bool TViswin::on_key(KEY key)

View File

@ -261,7 +261,7 @@ protected:
// @cmember Aggiorna la finestra di stampa // @cmember Aggiorna la finestra di stampa
virtual void update(); virtual void update();
// @cmember Gestisce l'handler della finestra (vedi <mf TWindow::handler> // @cmember Gestisce l'handler della finestra (vedi <mf TWindow::handler>
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
// @cmember Controlla se e' stato selezionato la voce <p item> (parametro <p on>???) // @cmember Controlla se e' stato selezionato la voce <p item> (parametro <p on>???)
void check_menu_item(MENU_TAG item, bool on = TRUE); void check_menu_item(MENU_TAG item, bool on = TRUE);

View File

@ -392,10 +392,11 @@ word TWindow::class_id() const
long TWindow::window_handler(WINDOW win, EVENT* ep) long TWindow::window_handler(WINDOW win, EVENT* ep)
{ {
long ret = 0;
TWindow* w = (TWindow*)xvt_vobj_get_data(win); TWindow* w = (TWindow*)xvt_vobj_get_data(win);
if (w != NULL) if (w != NULL)
w->handler(win, ep); ret = w->handler(win, ep);
return 0L; return ret;
} }
// @doc EXTERNAL // @doc EXTERNAL
@ -552,7 +553,7 @@ void TWindow::on_button(short dlg)
// @doc EXTERNAL // @doc EXTERNAL
// @mfunc Gestisce l'handler della finestra // @mfunc Gestisce l'handler della finestra
void TWindow::handler( long TWindow::handler(
WINDOW win, // @parm Finestra da gestire WINDOW win, // @parm Finestra da gestire
EVENT* ep) // @parm Evento da gestire nella finestra EVENT* ep) // @parm Evento da gestire nella finestra
{ {
@ -581,6 +582,7 @@ void TWindow::handler(
default: default:
break; break;
} }
return 0L;
} }
void TWindow::on_idle() void TWindow::on_idle()
@ -1104,7 +1106,7 @@ void TScroll_window::update_thumb(
xvt_sbar_set_pos(win(), VSCROLL, int(_origin.y >> _shift)); xvt_sbar_set_pos(win(), VSCROLL, int(_origin.y >> _shift));
} }
void TScroll_window::handler(WINDOW win, EVENT* ep) long TScroll_window::handler(WINDOW win, EVENT* ep)
{ {
if (ep->type == E_HSCROLL || ep->type == E_VSCROLL) if (ep->type == E_HSCROLL || ep->type == E_VSCROLL)
{ {
@ -1142,7 +1144,7 @@ void TScroll_window::handler(WINDOW win, EVENT* ep)
} }
} }
TWindow::handler(win, ep); return TWindow::handler(win, ep);
} }
bool TScroll_window::on_key(KEY key) bool TScroll_window::on_key(KEY key)

View File

@ -164,7 +164,7 @@ public:
virtual void on_button(short dlg); virtual void on_button(short dlg);
// @cmember Gestisce gli eventi della finestra // @cmember Gestisce gli eventi della finestra
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
// @cmember Mette la finestra in primo piano // @cmember Mette la finestra in primo piano
virtual void set_focus(); virtual void set_focus();
@ -367,7 +367,7 @@ public:
virtual bool on_key(KEY key); virtual bool on_key(KEY key);
// @cmember Gestisce l'handler della finestra (vedi <mf TWindow::handler>) // @cmember Gestisce l'handler della finestra (vedi <mf TWindow::handler>)
virtual void handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
// @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);