Patch level : 10.0
Files correlati : Ricompilazione Demo : [ ] Commento : execp: usate macro USR_* per accedere ai cami di LF_USER progind: eliminato bottone di annullamento e sostituito con X di chiusura finestra retprint:tolte righe commentate inutili window: sostituito TRUE con true git-svn-id: svn://10.65.10.50/trunk@17342 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1e9d8243a7
commit
68569f358f
@ -4,6 +4,7 @@
|
|||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
#include <recarray.h>
|
#include <recarray.h>
|
||||||
|
#include <user.h>
|
||||||
|
|
||||||
static bool is_outlook_menu_chain()
|
static bool is_outlook_menu_chain()
|
||||||
{
|
{
|
||||||
@ -70,7 +71,7 @@ long TExternal_app::run(
|
|||||||
if (dir.not_empty() && dir.find("custom") < 0)
|
if (dir.not_empty() && dir.find("custom") < 0)
|
||||||
{
|
{
|
||||||
DIRECTORY d;
|
DIRECTORY d;
|
||||||
if (xvt_fsys_convert_str_to_dir((char*)(const char*)dir, &d))
|
if (xvt_fsys_convert_str_to_dir(dir, &d))
|
||||||
xvt_fsys_set_dir(&d);
|
xvt_fsys_set_dir(&d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,18 +134,18 @@ bool TExternal_app::can_run() const
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
const TLocalisamfile test(LF_USER);
|
const TLocalisamfile test(LF_USER);
|
||||||
if (test.curr().exist("PERMISSION"))
|
if (test.curr().exist(USR_PERMISSION))
|
||||||
{
|
{
|
||||||
TRecord_cache utonti(LF_USER); // Non uso cache() per problemi durante conversioni
|
TRecord_cache utonti(LF_USER); // Non uso cache() per problemi durante conversioni
|
||||||
TToken_string perm(4096, '\n'), row(80,SAFE_PIPE_CHR);
|
TToken_string perm(4096, '\n'), row(80,SAFE_PIPE_CHR);
|
||||||
for (TString16 u = user(); u.not_empty(); u = utonti.get(u, "GROUPNAME"))
|
for (TString16 u = user(); u.not_empty(); u = utonti.get(u, USR_GROUPNAME))
|
||||||
{
|
{
|
||||||
if (utonti.already_loaded(u))
|
if (utonti.already_loaded(u))
|
||||||
{
|
{
|
||||||
NFCHECK("L'utente %s ha dei permessi ricorsivi", (const char*)u);
|
NFCHECK("L'utente %s ha dei permessi ricorsivi", (const char*)u);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
perm = utonti.get(u, "PERMISSION");
|
perm = utonti.get(u, USR_PERMISSION);
|
||||||
if (!perm.blank())
|
if (!perm.blank())
|
||||||
{
|
{
|
||||||
FOR_EACH_TOKEN(perm, tok)
|
FOR_EACH_TOKEN(perm, tok)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <diction.h>
|
#include <diction.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
|
#include <reprint.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
|
|
||||||
int TIndwin::_indwin_count = 0;
|
int TIndwin::_indwin_count = 0;
|
||||||
@ -23,7 +24,7 @@ word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
|||||||
|
|
||||||
// Certified 70%
|
// Certified 70%
|
||||||
TIndwin::TIndwin(long tot, const char* txt, bool cancel, bool bar, int div)
|
TIndwin::TIndwin(long tot, const char* txt, bool cancel, bool bar, int div)
|
||||||
: _text(NULL), _cancel(NULL), _gauge(NULL_WIN), _bar(0),
|
: _gauge(NULL_WIN), _can_cancel(cancel), _bar_top(0),
|
||||||
_flags(0x0), _max(tot), _status(0L)
|
_flags(0x0), _max(tot), _status(0L)
|
||||||
{
|
{
|
||||||
TToken_string testo(txt, '\n');
|
TToken_string testo(txt, '\n');
|
||||||
@ -31,34 +32,27 @@ TIndwin::TIndwin(long tot, const char* txt, bool cancel, bool bar, int div)
|
|||||||
const word lines = measure_text(testo, maxlen);
|
const word lines = measure_text(testo, maxlen);
|
||||||
|
|
||||||
const int hor = min(maxlen+3, 78);
|
const int hor = min(maxlen+3, 78);
|
||||||
const int ver = lines+1 + (bar ? 2 : 0) + (cancel ? 2: 0);
|
const int ver = lines+3 + (bar ? 2 : 0);
|
||||||
|
|
||||||
const int y = _indwin_count == 0 ? 3 : 12;
|
const int y = _indwin_count == 0 ? 3 : 12;
|
||||||
|
|
||||||
set_win(create_interface(TASK_WIN, -1, y, hor, ver, TR("Elaborazione in corso"), this/*, FALSE*/));
|
long flags = WSF_INVISIBLE;
|
||||||
|
if (_can_cancel)
|
||||||
|
flags |= WSF_CLOSE;
|
||||||
|
create(-1, y, hor, ver, TR("Elaborazione in corso"), flags, WD_MODAL);
|
||||||
|
|
||||||
|
_bar_top = (lines+1)*ROWY;
|
||||||
|
|
||||||
_text = new TMultiline_control(win(), DLG_NULL, 1, 0, hor-2, lines+1, 512, "CD", "");
|
|
||||||
_text->set_read_only();
|
|
||||||
set_text(testo);
|
set_text(testo);
|
||||||
|
|
||||||
if (bar)
|
if (bar)
|
||||||
{
|
{
|
||||||
WIN_DEF wd; memset(&wd, 0, sizeof(wd));
|
WIN_DEF wd; memset(&wd, 0, sizeof(wd));
|
||||||
wd.wtype = WC_HGAUGE;
|
wd.wtype = WC_HGAUGE;
|
||||||
|
get_bar_rct(wd.rct);
|
||||||
RCT& r = wd.rct;
|
|
||||||
_text->get_rect(r);
|
|
||||||
_bar = r.bottom + CHARY;
|
|
||||||
get_bar_rct(r);
|
|
||||||
|
|
||||||
_gauge = xvt_ctl_create_def(&wd, win(), tot);
|
_gauge = xvt_ctl_create_def(&wd, win(), tot);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cancel)
|
|
||||||
_cancel = new TPushbutton_control(win(), DLG_CANCEL, -11, -1, 12, 2, "", "", BMP_CANCEL);
|
|
||||||
|
|
||||||
open_modal();
|
open_modal();
|
||||||
do_events();
|
|
||||||
|
|
||||||
_indwin_count++;
|
_indwin_count++;
|
||||||
setmax(tot);
|
setmax(tot);
|
||||||
@ -75,15 +69,13 @@ void TIndwin::set_text(
|
|||||||
// passato, quindi occorre dimensionare correttamente il primo passato
|
// passato, quindi occorre dimensionare correttamente il primo passato
|
||||||
// (es. inserire degli spazi) quando se ne prevede uno piu' lungo.
|
// (es. inserire degli spazi) quando se ne prevede uno piu' lungo.
|
||||||
{
|
{
|
||||||
//#ifdef XI_R4
|
_text.destroy();
|
||||||
_text->set_caption(t);
|
TToken_string txt(t, '\n');
|
||||||
/*
|
FOR_EACH_TOKEN(txt, tok)
|
||||||
#else
|
_text.add(tok);
|
||||||
TString testo(t);
|
|
||||||
testo.replace('\n', '\r');
|
RCT r; get_txt_rct(r);
|
||||||
_text->set_caption(testo);
|
xvt_dwin_invalidate_rect(win(), &r);
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIndwin::setmax(long m)
|
void TIndwin::setmax(long m)
|
||||||
@ -98,9 +90,6 @@ TIndwin::~TIndwin()
|
|||||||
{
|
{
|
||||||
if (is_open())
|
if (is_open())
|
||||||
close_modal();
|
close_modal();
|
||||||
|
|
||||||
if (_cancel) delete _cancel;
|
|
||||||
if (_text) delete _text;
|
|
||||||
_indwin_count--;
|
_indwin_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,19 +106,26 @@ KEY TIndwin::check_stop()
|
|||||||
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
||||||
{
|
{
|
||||||
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
||||||
stop_run(k);
|
if (is_running())
|
||||||
|
stop_run(k);
|
||||||
}
|
}
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT* TIndwin::get_bar_rct(RCT& r) const
|
void TIndwin::get_bar_rct(RCT& r) const
|
||||||
{
|
{
|
||||||
xvt_vobj_get_client_rect(win(), &r);
|
xvt_vobj_get_client_rect(win(), &r);
|
||||||
r.left += CHARX;
|
r.left += CHARX;
|
||||||
r.right -= CHARX;
|
r.right -= CHARX;
|
||||||
r.top = _bar;
|
r.top = _bar_top;
|
||||||
r.bottom = r.top + ROWY;
|
r.bottom = r.top + ROWY;
|
||||||
return &r;
|
}
|
||||||
|
|
||||||
|
void TIndwin::get_txt_rct(RCT& r) const
|
||||||
|
{
|
||||||
|
get_bar_rct(r);
|
||||||
|
r.bottom = r.top - ROWY/2;
|
||||||
|
r.top = ROWY/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIndwin::sec2str(unsigned long ss, TString& str) const
|
void TIndwin::sec2str(unsigned long ss, TString& str) const
|
||||||
@ -185,8 +181,26 @@ void TIndwin::update_bar()
|
|||||||
|
|
||||||
void TIndwin::update()
|
void TIndwin::update()
|
||||||
{
|
{
|
||||||
|
clear(MASK_BACK_COLOR);
|
||||||
|
|
||||||
if (_gauge != NULL_WIN)
|
if (_gauge != NULL_WIN)
|
||||||
update_bar();
|
update_bar();
|
||||||
|
|
||||||
|
if (!_text.empty())
|
||||||
|
{
|
||||||
|
RCT r; get_txt_rct(r);
|
||||||
|
|
||||||
|
WINDOW w = win();
|
||||||
|
CBRUSH brush; brush.pat = PAT_SOLID; brush.color = MASK_BACK_COLOR;
|
||||||
|
xvt_dwin_set_cbrush(w, &brush);
|
||||||
|
xvt_dwin_set_std_cpen(w, TL_PEN_HOLLOW);
|
||||||
|
xvt_dwin_draw_rect(w, &r);
|
||||||
|
xvt_dwin_set_clip(w, NULL);
|
||||||
|
set_color(NORMAL_COLOR, MASK_BACK_COLOR);
|
||||||
|
set_opaque_text(TRUE);
|
||||||
|
set_font();
|
||||||
|
advanced_draw_paragraph(*this, _text, r, 'L', 'C', CHARY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TIndwin::setstatus(long l)
|
bool TIndwin::setstatus(long l)
|
||||||
@ -207,18 +221,24 @@ bool TIndwin::setstatus(long l)
|
|||||||
|
|
||||||
bool TIndwin::on_key(KEY k)
|
bool TIndwin::on_key(KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_ESC && _cancel)
|
if (k == K_ESC && _can_cancel)
|
||||||
{
|
{
|
||||||
_flags |= IND_CANCELLED;
|
_flags |= IND_CANCELLED;
|
||||||
check_stop();
|
check_stop();
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true; // Ignora tutti gli altri tasti, senza chiamare TWindow::on_key(k)
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIndwin::on_button(short id)
|
bool TIndwin::stop_run(KEY k)
|
||||||
{
|
{
|
||||||
if (id == DLG_CANCEL)
|
if (k == K_ESC)
|
||||||
on_key(K_ESC);
|
{
|
||||||
|
if (_can_cancel)
|
||||||
|
_flags |= IND_CANCELLED;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return TWindow::stop_run(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,13 +28,12 @@ class TIndwin : public TWindow
|
|||||||
// @ccost:(INTERNAL) IND_FINISHED | 0x02 | Controlla se l'operazione e' terminata
|
// @ccost:(INTERNAL) IND_FINISHED | 0x02 | Controlla se l'operazione e' terminata
|
||||||
IND_FINISHED= 0x02 };
|
IND_FINISHED= 0x02 };
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Testo da inserire nella finestra
|
TString_array _text;
|
||||||
TField_control* _text;
|
short _bar_top;
|
||||||
// @cmember:(INTERNAL) Bottone "Annulla"
|
bool _can_cancel;
|
||||||
TControl* _cancel;
|
|
||||||
// @cmember:(INTERNAL) Movimento della barra e percentuale
|
// @cmember:(INTERNAL) Movimento della barra e percentuale
|
||||||
WINDOW _gauge;
|
WINDOW _gauge;
|
||||||
int _bar;
|
|
||||||
// @cmember:(INTERNAL) ora inizio elaborazione
|
// @cmember:(INTERNAL) ora inizio elaborazione
|
||||||
unsigned long _start_time;
|
unsigned long _start_time;
|
||||||
|
|
||||||
@ -53,16 +52,16 @@ protected:
|
|||||||
word measure_text(TToken_string& t, word& len) const;
|
word measure_text(TToken_string& t, word& len) const;
|
||||||
|
|
||||||
// @cmember Calcola il rettangolo della barra di attesa
|
// @cmember Calcola il rettangolo della barra di attesa
|
||||||
RCT* get_bar_rct(RCT& r) const;
|
void get_bar_rct(RCT& r) const;
|
||||||
|
// @cmember Calcola il rettangolo del testo
|
||||||
|
void get_txt_rct(RCT& r) const;
|
||||||
|
|
||||||
// @cmember converte secondi in una stringa nel formato hh:mm:ss
|
// @cmember converte secondi in una stringa nel formato hh:mm:ss
|
||||||
void sec2str(unsigned long ss, TString& str) const;
|
void sec2str(unsigned long ss, TString& str) const;
|
||||||
|
|
||||||
// @cmember Gestisce gli eventi tasto della finestra
|
// @cmember Gestisce gli eventi tasto della finestra
|
||||||
virtual bool on_key(KEY k);
|
virtual bool on_key(KEY k);
|
||||||
|
virtual bool stop_run(KEY k);
|
||||||
// @cmember Gestisce gli eventi bottone della finestra
|
|
||||||
virtual void on_button(short id);
|
|
||||||
|
|
||||||
// @cmember Aggiorna la barra di attesa (chiama update_bar)
|
// @cmember Aggiorna la barra di attesa (chiama update_bar)
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
@ -114,8 +114,6 @@ void advanced_draw_text_line(TWindow& win, const char* text, const RCT& r, char
|
|||||||
xvt_dwin_draw_text(w, x, y, text, -1);
|
xvt_dwin_draw_text(w, x, y, text, -1);
|
||||||
if (restore_clip)
|
if (restore_clip)
|
||||||
xvt_dwin_set_clip(w, &orig);
|
xvt_dwin_set_clip(w, &orig);
|
||||||
// else
|
|
||||||
// xvt_dwin_set_clip(w, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -492,7 +492,7 @@ bool TWindow::stop_run(KEY key)
|
|||||||
{
|
{
|
||||||
_running = FALSE;
|
_running = FALSE;
|
||||||
_lastkey = key;
|
_lastkey = key;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TWindow::can_be_closed() const
|
bool TWindow::can_be_closed() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user