Patch level :10.0 patch 24

Files correlati     : tutte le librerie
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@16463 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-04-04 16:04:15 +00:00
parent fab5abc300
commit 0216f2cbf9
32 changed files with 962 additions and 642 deletions

View File

@ -329,7 +329,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
case M_FILE_NEW:
set_firm();
break;
case (M_FILE_ABOUT+1):
case M_FILE_ABOUT:
about();
break;
case M_HELP_CONTENTS:
@ -639,14 +639,9 @@ void TApplication::run(
CGetPref();
const int sn = get_serial_number();
if (sn < 0)
if (sn > 0 && !test_assistance_year())
{
error_box(TR("Probabilmente non e' inserita la chiave di protezione\noppure mancano i relativi driver."));
return;
}
if (!test_assistance_year())
{
error_box(TR("Probabilmente e' necessario attivare il contratto di assistenza per l'anno in corso"));
error_box(TR("E' necessario attivare il contratto di assistenza per l'anno in corso"));
return;
}
@ -671,10 +666,7 @@ void TApplication::run(
bool TApplication::get_version_info(int& year, int& release, int& tag, int& patch)
{
//Commentato per la 10.0! Non cancellare!!
//const char* const VERSIONANDPATCH = "Don't cry for me Argentina.2008.10.00.0000.2018";
const char* const VERSIONANDPATCH = "Don't cry for me Argentina.2008.04.00.0001.2013";
const char* const VERSIONANDPATCH = "Don't cry for me Argentina.2008.10.00.0000.2018";
TToken_string vep(VERSIONANDPATCH, '.');
year = vep.get_int(1);
@ -683,9 +675,6 @@ bool TApplication::get_version_info(int& year, int& release, int& tag, int& patc
patch = vep.get_int();
int checksum = vep.get_int();
//Commentato per la 10.0! Non cancellare!!
//bool valid = year >= 2008 && release > 0 && tag >= 0 && patch >= 0 &&
bool valid = year >= 2008 && release > 0 && tag >= 0 && patch >= 0 &&
checksum == (year + release + tag + patch);

View File

@ -20,8 +20,7 @@ bool TAutomask::error_box(const char* fmt, ...)
{
post_error_message(msg, 3);
}
return FALSE;
return false;
}
TField_event TAutomask::key2event(TMask_field& f, KEY key) const
@ -61,7 +60,7 @@ TField_event TAutomask::key2event(TMask_field& f, KEY key) const
if (!f.is_edit())
{
const TMask& wm = f.mask();
if (f.is_kind_of(CLASS_BUTTON_FIELD))
if (f.is_kind_of(CLASS_BUTTON_FIELD) || f.is_kind_of(CLASS_BUTTON_TOOL))
fe = fe_button; else
if (f.is_kind_of(CLASS_TREE_FIELD))
fe = wm.is_running() ? fe_modify : fe_init;

View File

@ -1,4 +1,4 @@
TOOLBAR "Toolbar" 0 -2 0 2
TOOLBAR "Toolbar" 0 0 0 2
BUTTON DLG_PRINT 10 2
BEGIN
@ -9,39 +9,38 @@ END
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -24 -1 "~Registra"
PROMPT -24 -1 "Esporta"
MESSAGE EXIT,K_SAVE
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
END
BUTTON DLG_PREVREC 3
BEGIN
PROMPT -34 -2 ""
PICTURE 122
END
BUTTON DLG_FIRSTREC 3
BEGIN
PROMPT -34 -1 ""
PROMPT -34 -1 "Prima pagina"
PICTURE 121
END
BUTTON DLG_PREVREC 3
BEGIN
PROMPT -34 -2 "Pagina Precedente"
PICTURE 122
END
BUTTON DLG_FINDREC 10 2
BEGIN
PROMPT -34 -1 ""
PROMPT -34 -1 "Ricerca Pagina"
PICTURE 166
END
BUTTON DLG_NEXTREC 3
BEGIN
PROMPT -34 -2 ""
PROMPT -34 -2 "Prossima pagina"
PICTURE 124
END
BUTTON DLG_LASTREC 3
BEGIN
PROMPT -34 -1 ""
PROMPT -34 -1 "Ultima Pagina"
PICTURE 125
END
@ -53,9 +52,9 @@ END
ENDPAGE
PAGE "Anteprima" -1 -1 60 13
PAGE "Anteprima" 0 0 0 0
PREVIEW DLG_USER -3 -1
PREVIEW DLG_USER
BEGIN
PROMPT 0 0 ""
END

View File

@ -54,6 +54,9 @@
#define CLASS_GOLEM_CLIENT_FIELD 252
#define CLASS_OUTLOOK_FIELD 253
#define CLASS_TOOL_FIELD 280
#define CLASS_BUTTON_TOOL 281
#define CLASS_BASEISAMFILE 300
#define CLASS_ISAMFILE 301
#define CLASS_SYSTEMISAMFILE 302

View File

@ -36,6 +36,7 @@ extern bool ADVANCED_GRAPHICS;
extern bool AUTOSELECT;
extern bool AUTOZOOM;
extern bool AUTOEND;
extern int TOOL_SIZE;
const COLOR COLOR_DKCYAN = MAKE_COLOR(0,128,128);
const COLOR COLOR_DKYELLOW = MAKE_COLOR(128,128, 0);

View File

@ -40,7 +40,7 @@ bool ADVANCED_GRAPHICS = true;
bool AUTOZOOM = false;
bool AUTOEND = false;
bool NATIVE_CONTROLS = false;
bool USE_NOTEBOOK = false; // NATIVE_CONTROLS
int TOOL_SIZE = 24;
HIDDEN bool _button_blocked = false;
HIDDEN int _last_mouse_button = 0;
@ -326,6 +326,7 @@ void customize_colors()
xi_set_pref(XI_PREF_NATIVE_CTRLS, NATIVE_CONTROLS);
}
}
TOOL_SIZE = colors.get_int("ToolSize", NULL, -1, TOOL_SIZE);
const int SPEECH_MODE = colors.get_int("SpeechMode", NULL, -1, 0);
xvt_vobj_set_attr(NULL_WIN, ATTR_SPEECH_MODE, SPEECH_MODE);
@ -464,7 +465,8 @@ HIDDEN void init_fu_multiple(XI_OBJ* itf)
Y_FU_MULTIPLE = max_rct.bottom / 25;
}
#define MASK_RECT_ID -883
// OBSOLETE
// #define MASK_RECT_ID -883
HIDDEN XI_BITMAP* get_background_bitmap()
{
@ -484,7 +486,7 @@ HIDDEN XI_BITMAP* get_background_bitmap()
}
WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
const char* caption, TWindow* msk, bool orecchie)
const char* caption, TWindow* msk/*, bool orecchie*/)
{
if (parent == NULL_WIN)
parent = TASK_WIN;
@ -524,17 +526,8 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
const WIN_TYPE wt = (dx == 0) ? W_PLAIN : W_DOC;
long wsf = WSF_INVISIBLE | WSF_NO_MENUBAR;
WINDOW win = NULL_WIN;
if (USE_NOTEBOOK && orecchie && parent != NULL_WIN)
{
const short tab_no = xvt_notebk_get_num_tabs(parent);
xvt_notebk_add_tab(parent, tab_no, caption, NULL);
xvt_notebk_add_page(parent, tab_no, 0, caption, (long)msk);
win = xvt_notebk_create_face(parent, tab_no, 0, EM_ALL, xi_event, (long)msk);
}
else
win = xvt_win_create(wt, &r, caption, 0L, parent, wsf,
EM_ALL, (EVENT_HANDLER)xi_event, (long)msk);
WINDOW win = xvt_win_create(wt, &r, caption, 0L, parent, wsf,
EM_ALL, (EVENT_HANDLER)xi_event, (long)msk);
CHECK(win, "Can't create an XVT window for an interface");
xvtil_set_font(win, NULL, 0, 0);
@ -574,6 +567,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
xvt_vobj_move(win, &r);
}
/* OBSOLETE
// Aggiunge rettangolo di cornice per pagine con orecchie
if (!USE_NOTEBOOK && orecchie)
{
@ -598,6 +592,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
xi_dequeue();
xi_tree_free(def);
}
*/
return win;
}
@ -914,6 +909,7 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT &
if (Y_FU_MULTIPLE == 0) // Puo' succedere che non sia ancora inizializzato
init_fu_multiple(itf);
/* OBSOLETE
// Se ci sono i tab controls sulla pagina salta una riga
if (y >= 0)
{
@ -922,6 +918,7 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT &
if (num > 0 && child[0]->cid == MASK_RECT_ID)
y++;
}
*/
RCT max_rct; xvt_vobj_get_client_rect(win, &max_rct);
xi_pu_to_fu(itf, (XinPoint *)&max_rct, 2);
@ -1409,7 +1406,7 @@ void TField_control::create(WINDOW win, short cid,
{
f->button = true;
f->pixel_button_distance = 1;
f->button_width = 16;
f->button_width = 18;
}
}
else // E' un multiline, quindi setto il rettangolo

View File

@ -24,7 +24,7 @@ XVT_FNTID xvt_default_font(bool bold = false, bool big = false);
XVT_FNTID xvt_load_default_font();
WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
const char* caption, TWindow* mask, bool tags);
const char* caption, TWindow* mask /*, bool tags*/);
void attach_interface(WINDOW win, COLOR back);
short low_get_focus_id(WINDOW win);

View File

@ -34,6 +34,8 @@
#define DLG_PROFILE 30 /* TAG del campo <Profilo> */
#define DLG_PDF 31 /* TAG del bottone Stampa PDF */
#define DLG_ARCHIVE 32 /* TAG del bottone Archiviazione */
#define DLG_INFO 33 /* TAG del bottone Informazioni */
#define DLG_HELP 34 /* TAG del bottone Informazioni */
#define DLG_USER 100 /* TAG del primo controllo definito dall'utente */
/* @M

View File

@ -5,6 +5,13 @@
#include <prefix.h>
#include <recarray.h>
static bool is_outlook_menu()
{
const int dw = xvt_vobj_get_attr(NULL_WIN, ATTR_SCREEN_WIDTH);
RCT rct; xvt_vobj_get_outer_rect(TASK_WIN, &rct);
return rct.left > 0 && rct.right < dw-1;
}
// @doc EXTERNAL
// @mfunc Esegue il processo
@ -65,6 +72,9 @@ long TExternal_app::run(
xvt_fsys_set_dir(&d);
}
}
// Vecchio titolo della finestra principale
TString256 old_title;
const bool close_all = !async && _path.starts_with("ba1 -0") && prefix_valid();
if (!async)
@ -76,11 +86,21 @@ long TExternal_app::run(
if (dongle().local())
dongle().logout();
if (iconize && utente && is_outlook_menu())
{
xvt_vobj_get_title(TASK_WIN, old_title.get_buffer(), old_title.size());
xvt_vobj_set_title(TASK_WIN, __MAGIC_CAPTION__);
iconize = false;
}
}
// iconize &= !async && show;
// _exitcode = os_execute(path, !async, iconize, show);
_exitcode = xvt_sys_execute(path, !async, iconize);
if (old_title.full()) // Rimetto le cose a posto
{
xvt_vobj_set_title(TASK_WIN, old_title);
}
// restore cwd
xvt_fsys_set_dir(&oldir);

View File

@ -5,6 +5,9 @@
#include <strings.h>
#endif
// Nome segreto per la finestra che deve ospitare un programma
#define __MAGIC_CAPTION__ "__CAMPO_HOST_WINDOW__"
// @doc EXTERNAL
// @class TExternal_app | Classe per l'esecuzione di oggetti esterni
@ -14,10 +17,8 @@ class TExternal_app : public TObject
// @author:(INTERNAL) Villa
// @comm Gli oggetti eseguiti dalla presente classe possono essere eseguiti
// @comm Gli oggetti della presente classe possono essere eseguiti
// in background in tutti gli ambienti, oppure in modo sincrono.
// <nl>Non sono implementate linee di comando; si suppone che l'utente
// utilizzi la mailbox per questo.
// @access:(INTERNAL) Private Member
{

View File

@ -299,7 +299,6 @@ void TDir::zero ()
}
void TDir::print_on (ostream & out) const
{
CHECK(_dir,"Can't print a NULL _dir");
out << _num << '\n';
@ -523,20 +522,16 @@ void TTrec::zero ()
}
int TTrec::status (TDirtype dirop) const
{
return rdir[dirop].IOR;
}
int TTrec ::field (const char *name) const
int TTrec::field(const char *name) const
{
return findfld (_rec, (char *) name);
return findfld(_rec, name);
}
const char *TTrec ::fielddef (int fld) const
{
sprintf (_files_tmp_string, "%s|%d|%d|%d", _rec->Fd[fld].Name,
(int) _rec->Fd[fld].TypeF, (int) _rec->Fd[fld].Len,
@ -545,7 +540,6 @@ const char *TTrec ::fielddef (int fld) const
}
const char *TTrec ::keydef (int key) const
{
TFixed_string s (_files_tmp_string, 128);
@ -584,26 +578,23 @@ bool TDir::is_active () const
return main_app().has_module(module, CHK_DONGLE);
}
void TTrec::update_fielddef (int nfld, const char *desc)
void TTrec::update_fielddef (int nfld, TToken_string& s)
{
TToken_string s (desc);
strcpy (_rec->Fd[nfld].Name, s.get ());
_rec->Fd[nfld].TypeF = s.get_int ();
_rec->Fd[nfld].Len = s.get_int ();
_rec->Fd[nfld].Dec = s.get_int ();
RecFieldDes& rfd = _rec->Fd[nfld];
strcpy (rfd.Name, s.get(0));
rfd.TypeF = s.get_int ();
rfd.Len = s.get_int ();
rfd.Dec = s.get_int ();
}
void TTrec::update_keydef (int key, const char *desc)
void TTrec::update_keydef (int key, TToken_string& s)
{
TExpression expr ("", _strexpr);
TToken_string s (desc);
TString ke (s.get ());
TString ke (s.get(0));
if (expr.set ((const char *) ke, _strexpr))
if (expr.set(ke, _strexpr))
{
const char * dup = s.get();
const char* dup = s.get();
_rec->Ky[key].DupKeys = (dup && *dup != ' ');
TCodearray & c = expr.code ();
c.begin ();
@ -645,8 +636,7 @@ void TTrec::update_keydef (int key, const char *desc)
}
}
void TTrec::print_on (ostream & out) const
void TTrec::print_on(ostream & out) const
{
const int n = num();
out << n;
@ -676,52 +666,46 @@ void TTrec::print_on (ostream & out) const
}
}
void TTrec::read_from (istream & in)
void TTrec::read_from(istream & in)
{
const int n = num();
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
if (_des && n>=LF_TABGEN && n<=LF_TAB)
TToken_string t(256);
in.getline (t.get_buffer(), t.size(), '\n');
if (_des && n >= LF_TABGEN && n <= LF_TAB)
{
const TFixed_string t(_files_tmp_string);
if (t.find('|') >= 0)
{
const TString4 tabname(t.right(3));
strcpy(_files_tmp_string,t.left(t.len()-4)); // Toglie il nome della tabella
if (_tab != tabname && !yesno_box("Descrizione relativa alla tabella %s.\n Continuo ?",(const char*) tabname))
t.rtrim(4); // Toglie il nome della tabella
if (_tab != tabname && !yesno_box("Descrizione relativa alla tabella %s.\n Continuare?",(const char*) tabname))
return;
}
}
const int ln = atoi (_files_tmp_string);
if (n > 0 && ln != n && !yesno_box ("Descrizione relativa al file n.ro %d.\n Continuo ?", ln))
const int ln = t.get_int(0);
if (n > 0 && ln != n && !yesno_box ("Descrizione relativa al file n.ro %d.\n Continuare?", ln))
return;
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
const int nfields = atoi (_files_tmp_string);
in.getline (t.get_buffer(), t.size(), '\n');
const int nfields = t.get_int(0);
set_fields (nfields);
TToken_string t;
int i;
for (i = 0; i < nfields; i++)
for (int i = 0; i < nfields; i++)
{
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
t = _files_tmp_string;
in.getline (t.get_buffer(), t.size(), '\n');
update_fielddef (i, t);
const int itms = t.items();
update_fielddef (i, _files_tmp_string);
if (_des && itms == 5) // La descrizione viene caricata solo se esiste
_des->set(_rec->Fd[i].Name, t.get(itms-1));
if (_des && itms >= 5) // La descrizione viene caricata solo se esiste
_des->set(_rec->Fd[i].Name, t.get(4));
}
int nkeys;
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
nkeys = atoi (_files_tmp_string);
in.getline (t.get_buffer(), t.size(), '\n');
const int nkeys = t.get_int(0);
set_keys (nkeys);
for (i = 0; i < nkeys; i++)
for (int i = 0; i < nkeys; i++)
{
in.getline (_files_tmp_string, sizeof (_files_tmp_string), '\n');
update_keydef (i, _files_tmp_string);
in.getline (t.get_buffer(), t.size(), '\n');
update_keydef (i, t);
}
rehash ();
_des = NULL;

View File

@ -245,9 +245,9 @@ public:
#ifndef FOXPRO
// @cmember Aggiorna la chiave. <p desc> e' una token string
void update_keydef(int key, const char* desc);
void update_keydef(int key, TToken_string& desc);
// @cmember Aggiorna il campo. <p desc> e' una token string
void update_fielddef(int nfld, const char* desc);
void update_fielddef(int nfld, TToken_string& desc);
// @cmember Stampa il tracciato record sull'output selezionato
virtual void print_on(ostream& out) const;
// @cmember Legge il tracciato record da input selezionato

View File

@ -12,7 +12,7 @@
#include <recarray.h>
#include <relation.h>
#include <scanner.h>
#include <utility.h>
#include <utility.h>
#include <tabutil.h>
#include <varrec.h>
@ -27,8 +27,7 @@
#include <sys/stat.h>
#include <codeb.h>
#include <nditte.h>
#ifdef JOURNAL
#include <journal.h>
@ -2126,16 +2125,16 @@ int TSystemisamfile::update(
if (newfields < MaxFields)
{
wrec.update_fielddef(newfields++, def);
wrec.set_fields(newfields);
wrec.set_fields(newfields);
wrec.rehash();
}
}
else
{
if(!yesno_box("Il campo %s non verra' preservato, devo continuare?",
(const char*)fname))
return NOERR;
}
}
}
}
if (wfields < newfields)
@ -2462,14 +2461,9 @@ int TSystemisamfile::load(
if (extended)
{
TDate d(TODAY);
TLocalisamfile ditte(LF_NDITTE);
firm.format("%05ld", prefix().get_codditta());
year.format("%04d", d.year());
ditte.zero();
ditte.put("CODDITTA", firm);
if (ditte.read() == NOERR)
attprev = ditte.get("CODATTPREV");
firm.format("%05ld", prefix().get_codditta());
attprev = cache().get(LF_NDITTE, firm, NDT_CODATTPREV);
}
fseek(fl, 0L, SEEK_END);

File diff suppressed because it is too large Load Diff

View File

@ -8,13 +8,13 @@
class TSheet_field;
class TTree_field;
class TCurrency;
class TButton_tool;
// @doc EXTERNAL
// @type MASK_HANDLER | Prototipo funzione per gestire i tasti speciali all'interno di una maschera.
typedef bool (*MASK_HANDLER)(TMask& mask, KEY key);
// @doc EXTERNAL
// @enum Modalita' di utilizzo della maschera corrente
@ -47,7 +47,8 @@ class TMask : public TWindow
private:
// @cmember:(INTERNAL) Windows delle pagine
WINDOW _pagewin[MAX_PAGES+1];
WINDOW _toolwin, _notebook, _single, _toolbar;
WINDOW _pagewin[MAX_PAGES];
// @cmember:(INTERNAL) Numero della maschera all'interno del file sorgente
int _mask_num;
@ -108,17 +109,20 @@ protected:
// @cmember Inizializza la maschera (Chiamata quando la maschera parte)
virtual void start_run();
// @cmember Aggiunge una toolbar alla maschera (top or bottom only)
void insert_bar(WINDOW bar);
WINDOW create_book(bool single);
WINDOW create_bar(int height); // if height < 0 then BottomBar else TopBar
// @cmember Aggiunge una pagina alla maschera
void insert_page(WINDOW page, int pos);
WINDOW create_page(const char* title, int pos); // -1 <= pos < MAX_PAGES
// @cmember Inizializza la maschera
void init_mask();
// @cmember Legge la pagina da file
WINDOW read_page(TScanner& scanner, bool toolbar = false);
WINDOW insert_page(const char* title, int pos);
// @cmember Aggiunge i tags ad una pagina
void add_tag_button(byte pag, TToken_string& tags, byte sel);
void read_page(TScanner& scanner, bool toolbar);
// @cmember Aggiunge alla maschera tutti i bottoni per la navigazione tra le pagine
void add_tag_buttons(TToken_string& tags);
void set_tab_buttons(TToken_string& tabs);
// @cmember Ritorna il numero del primo campo attivo della pagina con finestra <p w>
int find_first_active(WINDOW w) const;
@ -126,11 +130,12 @@ protected:
int find_parent_page(const TMask_field& f) const;
// @cmember Esegue i check del campo corrente
bool check_current_field() const;
// @cmember Mostra la prossima/precedente pagina
virtual void next_page(int p);
// @cmember Cambia arbitrariamente il nome del file (uso molto raro)
void set_source_file(const char* name) { _source_file = name; }
WINDOW notebook() const { return _notebook; }
// @access Public Member
public:
// @cmember Costruttore (crea la maschera leggendo la descrizione dal file .msk)
@ -151,6 +156,8 @@ public:
// @cmember Legge il campo da file
virtual TMask_field* parse_field(TScanner& scanner);
// @cmember Legge il bottone della toolbar da file
virtual TMask_field* parse_tool(TScanner& scanner);
// Aggiunge un campo all'array _field
void add_field(TMask_field* f);
@ -164,23 +171,19 @@ public:
// @cmember Ritorna il numero della pagina corrente
int curr_page() const { return _page; }
// @cmember Ritorna la finestra della pagina corrente (Usare con attenzione)
WINDOW win() const
{ return _page < 0 ? _pagewin[0] : _pagewin[_page]; }
// @cmember Ritorna la finestra della pagina <p> (Usare con attenzione)
WINDOW win(int p) const
{ return p < 0 ? toolwin() : _pagewin[p]; }
WINDOW page_win(int p) const;
// @cmember Ritorna la finestra della pagina corrente
WINDOW curr_win() const;
// @cmember Ritorna il nome del file contentente la maschera
const TFilename& source_file() const
{ return _source_file; }
const TFilename& source_file() const { return _source_file; }
// @cmember Ritorna il numero della maschera nel file (> 0 se spreadsheet)
int number() const
{ return _mask_num; }
int number() const { return _mask_num; }
// @cmember Aggiunge alla maschera tutti i bottoni Pag. n
void add_default_tag_buttons();
// @cmember Aggiunge alla maschera tutti i bottoni Pag.n
void set_default_tab_buttons();
// @cmember Aggiunge runtime un campo testo alla maschera
TMask_field& add_static (short id, int page, const char* prompt, int x, int y, const char* flags = "");
@ -211,6 +214,9 @@ public:
// @cmember Aggiunge runtime un group box alla maschera
TGroup_field& add_groupbox (short id, int page, const char* prompt, int x, int y, int dx = 78, int dy = 3, const char* flags = "");
// @cmember Aggiunge runtime un bottone alla toolbar
TButton_tool& add_button_tool(short id, const char* prompt, short bmpup);
// @cmember Ritorna il numero di campi della maschera
int fields() const
{ return _field.items(); }
@ -246,6 +252,7 @@ public:
virtual void close();
// @cmember Permette di attivare/disattivare tutta la pagina
virtual void activate(bool on = TRUE);
virtual void set_focus();
// @cmember Converte un identificatore di campo nella sua posizione
int id2pos(short id) const;
@ -256,6 +263,8 @@ public:
{ return (TMask_field&)_field[i]; }
// @cmember Ritorna il campo contraddistinto dall'identificatore passato
TMask_field& field(short id) const;
// @cmember Ritorna il campo corrispondente ad id se c'e'
TMask_field* find_by_id(short id) const;
// @cmember Ritorna il campo corrispondente al FIELD fieldname
TMask_field* find_by_fieldname(const char* fieldname) const;
// @cmember Ritorna il campo di edit contraddistinto dall'identificatore passato
@ -437,7 +446,9 @@ public:
int win2page(WINDOW p) const ;
// @cmember Ritorna la finestra della toolbar
WINDOW toolwin() const
{ return _pagewin[MAX_PAGES]; }
{ return _toolwin; }
WINDOW toolbar() const
{ return _toolbar; }
};
// @doc EXTERNAL

View File

@ -111,8 +111,6 @@ char TMask_field::TField_Flags::update(const char* f, bool reset)
return *s;
}
///////////////////////////////////////////////////////////
// TMask_field
///////////////////////////////////////////////////////////
@ -271,6 +269,7 @@ void TMask_field::construct(
_ctl_data._width = len;
break;
case CLASS_BUTTON_FIELD:
case CLASS_BUTTON_TOOL:
_ctl_data._height = len;
_ctl_data._width = width <= 0 ? 12 : width;
_ctl_data._bmp_up = bmp_up;
@ -334,7 +333,8 @@ void TMask_field::construct(TScanner& scanner, WINDOW parent)
void TMask_field::destroy()
{
_ctl->destroy();
if (_ctl != NULL)
_ctl->destroy();
}
void TMask_field::set_group(byte group)
@ -345,7 +345,6 @@ void TMask_field::set_group(byte group)
_groups->set(0L);
}
bool TMask_field::parse_item(TScanner& scanner)
{
if (scanner.key() == "PR") // PROMPT
@ -569,7 +568,10 @@ bool TMask_field::on_key(KEY key)
return TRUE;
}
#define build_msg() char* _msg = (char*)(const char*)_ctl_data._park;va_list argptr;va_start(argptr,fmt);vsprintf(_msg,fmt,argptr);va_end(argptr)
#define build_msg() \
char* _msg = _ctl_data._park.get_buffer(256); \
va_list argptr; va_start(argptr,fmt); \
vsprintf(_msg,fmt,argptr);va_end(argptr)
// @doc EXTERNAL
@ -1157,7 +1159,7 @@ void TButton_field::create(WINDOW parent)
if (mess)
{
TToken_string msg(mess->get(0), ',');
const TString m(msg.get(0));
const TFixed_string m = msg.get(0);
if (m == "EXIT")
{
_exit_key = msg.get_int();
@ -4548,10 +4550,8 @@ void TCurrency_field::create(WINDOW w)
TEdit_field::create(w);
}
TCurrency_field::TCurrency_field(TMask* m)
: TEdit_field(m)
{
}
TCurrency_field::TCurrency_field(TMask* m) : TEdit_field(m)
{ }
///////////////////////////////////////////////////////////
// List_field

View File

@ -3290,3 +3290,50 @@ void TSheet_field::set_userput(SHEET_USERGETPUT handler)
{
_userput = handler;
}
bool TSheet_field::esporta() const
{
TFilename name("tabella.xls");
FILE_SPEC fs;
xvt_fsys_convert_str_to_fspec(name, &fs);
if (xvt_dm_post_file_save(&fs, TR("Selezionare il file di destinazione")))
xvt_fsys_convert_fspec_to_str(&fs, name.get_buffer(), name.size());
if (name.full())
{
ofstream xls(name);
const char sep = '\t';
TToken_string tab(128, sep);
TString str;
int columns = 0;
for (columns = 0; ; columns++)
{
str = get_column_header(columns);
if (str.not_empty())
tab.add(str);
else
break;
}
xls << tab << endl;
for (long n = 0; n < items(); n++)
{
const TToken_string& r = ((TSheet_field*)this)->row(n);
tab = r;
tab.replace(r.separator(), sep);
tab.separator(sep);
for (int c = 0; tab.get(c, str); c++)
{
if (real::is_real(str))
{
xvt_str_number_format(str.get_buffer(), str.size());
tab.add(str, c);
}
}
xls << tab << endl;
}
}
return true;
}

View File

@ -269,6 +269,8 @@ public:
// @cmember Trasferisce i valori dalla riga alla maschera <p n>
void update_mask(int n) { row2mask(n, row(n)); }
bool esporta() const;
// @cmember Costruttore
TSheet_field(TMask* m);
// @cmember Distruttore

View File

@ -450,8 +450,6 @@ void TFile_info::auto_close()
const bool yes = is_open() && !(is_locked() || is_exclusive());
if (yes)
close_low();
else
NFCHECK("Can't auto_close file '%s'", (const char*)_name);
}
int TFile_info::auto_open(int key)
@ -807,7 +805,7 @@ int TFile_manager::close_closeable()
TFile_info& i = fileinfo(n);
if (i.is_open())
{
if (!i.is_exclusive())
if (!i.is_locked() && !i.is_exclusive())
{
cache().discard(i.num());
i.auto_close();
@ -826,7 +824,7 @@ void TFile_manager::close_all()
const int zoccolo_duro = close_closeable();
#ifdef DBG
if (zoccolo_duro > 0)
NFCHECK("%d files refuse can't be closed!", zoccolo_duro);
NFCHECK("%d files refuse to be closed!", zoccolo_duro);
#endif
for (int n = _recinfo.last(); n > 0; n = _recinfo.pred(n))
@ -933,14 +931,13 @@ const TString& TFirm::codice_valuta() const
}
const TString& TFirm::ragione_sociale() const
{
return get(NDT_RAGSOC);
{
return get(NDT_RAGSOC);
}
TFirm::TFirm(long code)
{
read(code);
{
read(code);
}
///////////////////////////////////////////////////////////

View File

@ -35,7 +35,7 @@ TIndwin::TIndwin(long tot, const char* txt, bool cancel, bool bar, int div)
const int y = _indwin_count == 0 ? 3 : 12;
set_win(create_interface(TASK_WIN, -1, y, hor, ver, TR("Elaborazione in corso"), this, FALSE));
set_win(create_interface(TASK_WIN, -1, y, hor, ver, TR("Elaborazione in corso"), this/*, FALSE*/));
_text = new TMultiline_control(win(), DLG_NULL, 1, 0, hor-2, lines+1, 512, "CD", "");
_text->set_read_only();

View File

@ -1613,6 +1613,16 @@ const char* real::stringa (int len, int dec, char pad) const
return str;
}
// Certified 99%
const char* real::stringe(int len, int dec, char pad) const
{
char* str = (char*)string(len, dec, pad);
if (dec > 0 || dec == UNDEFINED)
xvt_str_number_format(str, len > 0 ? len+1 : 50);
return str;
}
void real::print_on(ostream& out) const
{
out << string();

View File

@ -61,9 +61,12 @@ public:
static bool is_null(const char* n);
// @cmember Trasforma un reale in stringa
const char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
// @cmember Trasforma un reale in stringa (chiama <mf real::string>), ma
// ritorna il formato italiano
// @cmember Trasforma un reale in stringa (chiama <mf real::string>),
// ma ritorna il formato italiano
const char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
// @cmember Trasforma un reale in stringa (chiama <mf real::string>),
// ma ritorna il formato atteso da Excel
const char* stringe(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
// @cmember Ritorna la stringa con il formato passato
const char* string(const char* picture) const;
// @cmember Ritorna la stringa con il formato passato

View File

@ -34,6 +34,17 @@ static bool is_numeric(const char* str)
return true;
}
static void num_reformat(TString& val)
{
xvt_str_number_format(val.get_buffer(), val.size());
const int comma = val.find(',');
const int point = val.find('.');
if (comma >= 0 && comma < point)
val.strip(","); else
if (point >= 0 && point < comma)
val.strip(".");
}
///////////////////////////////////////////////////////////
// TRecordset
///////////////////////////////////////////////////////////
@ -170,14 +181,20 @@ bool TRecordset::save_as_silk(const char* path)
{
out << ";X" << (c+1) << ";K";
var.as_string(val);
if (var.type() == _alfafld || var.type() == _datefld)
switch (var.type())
{
val.rtrim();
val.replace('"', '\'');
out << '"' << val << '"';
}
else
case _alfafld:
case _datefld:
{
val.rtrim();
val.replace('"', '\'');
out << '"' << val << '"';
}
break;
default:
out << val;
break;
}
}
out << endl;
}
@ -209,7 +226,11 @@ bool TRecordset::save_as_text(const char* path)
if (val.find('\n') >= 0 || val.find('\t') >= 0)
out << unesc(val); // Evitiamo doppi separatori di campo e record
else
{
if (var.type() == _realfld)
num_reformat(val);
out << val;
}
}
}
out << endl;

View File

@ -1325,6 +1325,12 @@ void TRelation_application::main_loop()
if (!save(TRUE))
k = K_ENTER;
break;
case K_F1:
dispatch_e_menu(M_HELP_CONTENTS);
break;
case K_F2:
dispatch_e_menu(M_FILE_ABOUT);
break;
case K_ENTER:
if (_lnflag && _curr_transaction != TRANSACTION_RUN)
{

View File

@ -19,12 +19,6 @@
static bool _print_aborted = false;
#if _MSC_VER >= 1400
#define SAFE_SCAN sscanf_s
#else
#define SAFE_SCAN sscanf
#endif
///////////////////////////////////////////////////////////
// Utility
///////////////////////////////////////////////////////////
@ -361,6 +355,13 @@ void TPrint_preview_window::update()
TString80 str; str.format(FR("Pagina %u di %u"), _page, _book->pages());
statbar_set_title(TASK_WIN, str);
TMask& m = owner().mask();
m.enable(DLG_FIRSTREC, _page > 1);
m.enable(DLG_PREVREC, _page > 1);
m.enable(DLG_FINDREC, _book->pages() > 1);
m.enable(DLG_NEXTREC, _page < _book->pages());
m.enable(DLG_LASTREC, _page < _book->pages());
}
#define POPUP_FIRST 20883
@ -697,6 +698,7 @@ TPreview_mask::TPreview_mask(TBook* book) : _book(book)
read_mask("bagn008", 0, -1);
set_handlers();
/* Roba obsoleta con le moderne toolbar
int pos = id2pos(DLG_FINDREC);
if (pos >= 0 && id2pos(DLG_FIRSTREC) >= 0) //se e' un bottone pentapartito...
{
@ -740,6 +742,7 @@ TPreview_mask::TPreview_mask(TBook* book) : _book(book)
}
}
}
*/
}
///////////////////////////////////////////////////////////
@ -1222,9 +1225,7 @@ bool TBook::print_page(TWindow& win, size_t page)
pw.alinks().destroy();
}
const int buffer_size = 1024;
TString str(buffer_size);
char* buffer = str.get_buffer();
TToken_string str(1024, '=');
TString_array paragrafo; // Testo completo di un campo
@ -1247,7 +1248,7 @@ bool TBook::print_page(TWindow& win, size_t page)
while (!ifs.eof())
{
ifs.getline(buffer, str.size());
ifs.getline(str.get_buffer(), str.size());
if (str.starts_with("</page"))
break;
@ -1322,9 +1323,9 @@ bool TBook::print_page(TWindow& win, size_t page)
}
if (str.starts_with("<brush "))
{
COLOR col = COLOR_BLACK;
PAT_STYLE pat = PAT_SOLID;
SAFE_SCAN(str, "<brush color=%u pattern=%u />", &col, &pat);
// <brush color=%u pattern=%u />
COLOR col = str.get_long(1);
PAT_STYLE pat = (PAT_STYLE)str.get_long();
if (pat <= PAT_HOLLOW)
win.hide_brush();
else
@ -1346,8 +1347,11 @@ bool TBook::print_page(TWindow& win, size_t page)
}
if (str.starts_with("<frame "))
{
long x, y, dx, dy;
SAFE_SCAN(str, "<frame x=%ld y=%ld dx=%ld dy=%ld />", &x, &y, &dx, &dy);
// <frame x=ld y=%ld dx=%ld dy=%ld />
const long x = str.get_long(1);
const long y = str.get_long();
const long dx= str.get_long();
const long dy= str.get_long();
_rect.set(x, y, dx, dy);
win.log2dev(_rect, rct);
continue;
@ -1398,10 +1402,10 @@ bool TBook::print_page(TWindow& win, size_t page)
}
if (str.starts_with("<pen "))
{
COLOR col = COLOR_BLACK;
int width = 0;
PEN_STYLE style = P_SOLID;
SAFE_SCAN(str, "<pen color=%u width=%d style=%u />", &col, &width, &style);
// <pen color=%u width=%d style=%u />
COLOR col = str.get_long(1);
int width = str.get_int();
PEN_STYLE style = (PEN_STYLE)str.get_int();
if (width < 0)
win.hide_pen();
else
@ -1433,7 +1437,7 @@ bool TBook::print_page(TWindow& win, size_t page)
paragrafo.destroy();
while (!ifs.eof())
{
ifs.getline(buffer, str.size());
ifs.getline(str.get_buffer(), str.size());
if (str == "</text>")
break;
paragrafo.add(str);
@ -1446,21 +1450,17 @@ bool TBook::print_page(TWindow& win, size_t page)
}
if (str.starts_with("<text_align "))
{
#if _MSC_VER >= 1400
sscanf_s(str, "<text_align horizontal=%c vertical=%c />",
&_horizontal_alignment, sizeof(_horizontal_alignment),
&_vertical_alignment, sizeof(_vertical_alignment));
#else
sscanf(str, "<text_align horizontal=%c vertical=%c />",
&_horizontal_alignment, &_vertical_alignment);
#endif
// <text_align horizontal=%c vertical=%c />
_horizontal_alignment = str.get_char(1);
_vertical_alignment = str.get_char();
continue;
}
if (str.starts_with("<text_color"))
{
COLOR fore, back;
int opaque;
SAFE_SCAN(str, "<text_color fore=%u back=%u opaque=%d />", &fore, &back, &opaque);
// <text_color fore=%u back=%u opaque=%d />
const COLOR fore = str.get_long(1);
const COLOR back = str.get_long();
const int opaque = str.get_int();
win.set_color(fore, back);
win.set_opaque_text(opaque != 0);
continue;
@ -1494,8 +1494,7 @@ bool TBook::export_text(const TFilename& fname)
if (fname.ends_with(".pdf", true))
return export_pdf(fname);
TString str(1024);
char* buffer = str.get_buffer();
TToken_string str(1024, '=');
ifstream ifs(_file);
ofstream ofs(fname);
@ -1507,12 +1506,15 @@ bool TBook::export_text(const TFilename& fname)
while (!ifs.eof())
{
ifs.getline(buffer, str.size());
ifs.getline(str.get_buffer(), str.size());
if (str.starts_with("<frame "))
{
long x, y, dx, dy;
SAFE_SCAN(str, "<frame x=%ld y=%ld dx=%ld dy=%ld />", &x, &y, &dx, &dy);
// <frame x=%ld y=%ld dx=%ld dy=%ld />
const long x = str.get_long(1);
const long y = str.get_long();
const long dx= str.get_long();
const long dy= str.get_long();
row = y * lpi() / res.y;
col = x * cpi() / res.x;
wid = dx * cpi() / res.x;
@ -1595,7 +1597,7 @@ bool TBook::export_text(const TFilename& fname)
TString stringona;
while (!ifs.eof())
{
ifs.getline(buffer, str.size());
ifs.getline(str.get_buffer(), str.size());
if (str == "</text>")
break;
stringona << str << '\n';
@ -1619,14 +1621,9 @@ bool TBook::export_text(const TFilename& fname)
} else
if (str.starts_with("<text_align "))
{
#if _MSC_VER >= 1400
sscanf_s(str, "<text_align horizontal=%c vertical=%c />",
&_horizontal_alignment, sizeof(_horizontal_alignment),
&_vertical_alignment, sizeof(_vertical_alignment));
#else
sscanf(str, "<text_align horizontal=%c vertical=%c />",
&_horizontal_alignment, &_vertical_alignment);
#endif
// <text_align horizontal=%c vertical=%c />
_horizontal_alignment = str.get_char(1);
_vertical_alignment = str.get_char();
}
}
@ -1676,8 +1673,7 @@ void TBook::split_file(int colonne)
close_output(); // Chiudo file di stampa eventualmente aperto
ifstream ifs(_file); // Apro file di stampa da splittare
TString str(1024);
char* buffer = str.get_buffer();
TToken_string str(1024, '=');
for (unsigned int page = 1; page <= pages(); page++)
{
if (!pi.setstatus(page))
@ -1690,7 +1686,7 @@ void TBook::split_file(int colonne)
ifs.seekg(pos);
while (!ifs.eof())
{
ifs.getline(buffer, str.size());
ifs.getline(str.get_buffer(), str.size());
if (str.starts_with("<page "))
{
@ -1700,8 +1696,11 @@ void TBook::split_file(int colonne)
} else
if (str.starts_with("<frame "))
{
long x, y, dx, dy;
SAFE_SCAN(str, "<frame x=%ld y=%ld dx=%ld dy=%ld />", &x, &y, &dx, &dy);
// <frame x=%ld y=%ld dx=%ld dy=%ld />
const long x = str.get_long(1);
const long y = str.get_long();
const long dx= str.get_long();
const long dy= str.get_long();
str.format("<frame x=%ld y=%ld dx=%ld dy=%ld />", x-rct_page.x, y, dx, dy);
} else
if (str.starts_with("</page "))
@ -1742,7 +1741,6 @@ void TBook::join_file(int pps)
TFilename temp; temp.temp();
ofstream out(temp);
close_output(); // Chiudo file di stampa eventualmente aperto
ifstream ifs(_file); // Apro file di stampa da splittare
@ -1753,16 +1751,15 @@ void TBook::join_file(int pps)
int out_page = 0;
int off_page = 0;
TString str(1024);
char* buffer = str.get_buffer();
TToken_string str(1024, '=');
while (!ifs.eof())
{
ifs.getline(buffer, str.size());
ifs.getline(str.get_buffer(), str.size());
if (str.starts_with("<page "))
{
sscanf(str, "<page number=%d", &in_page);
// const int sub = (in_page % pps) - 1;
// <page number=%d />
in_page = str.get_int(1);
const int sub = ((in_page - 1) % pps);
off_page = sub * logical_page_height() / pps;
if (sub == 0)
@ -1779,8 +1776,11 @@ void TBook::join_file(int pps)
} else
if (str.starts_with("<frame ") && off_page > 0)
{
long x, y, dx, dy;
sscanf(str, "<frame x=%ld y=%ld dx=%ld dy=%ld />", &x, &y, &dx, &dy);
// <frame x=ld y=%ld dx=%ld dy=%ld />
const long x = str.get_long(1);
const long y = str.get_long();
const long dx= str.get_long();
const long dy= str.get_long();
str.format("<frame x=%ld y=%ld dx=%ld dy=%ld />", x, y+off_page, dx, dy);
} else
if (str.starts_with("</page "))

View File

@ -142,4 +142,4 @@ void advanced_draw_text_line(TWindow& win, const char* text, const RCT& r, char
void advanced_draw_paragraph(TWindow& win, const TString_array& text, const RCT& r,
char halign, char valign, int default_row_height);
#endif
#endif

View File

@ -1,5 +1,6 @@
#define XI_INTERNAL
#include <xinclude.h>
#include <xinclude.h>
#include <statbar.h>
#include <applicat.h>
#include <colors.h>
@ -7,6 +8,7 @@
#include <controls.h>
#include <relation.h>
#include <sheet.h>
#include <toolfld.h>
#include <urldefid.h>
#include <utility.h>
#include <xvtility.h>
@ -85,6 +87,7 @@ public:
void load_columns_order(const TEdit_field& f);
void update(long n = -1);
bool head(int c, TString& str) const;
TSheet_control(WINDOW sheet, short cid, short x, short y, short dx, short dy,
const char* flags, const char* head);
@ -270,24 +273,19 @@ TSheet_control::TSheet_control(
// Se la finestra e' troppo grande riducila
RCT cli; xvt_vobj_get_client_rect(parent, &cli);
RCT xc = cli; xi_pu_to_fu(itf, (XinPoint *) &xc, 2);
if (xc.right > 45 * XI_FU_MULTIPLE) // Deve contenere almeno 4 bottoni
{
xi_get_rect(_obj, (XinRect *) &rct);
xi_get_rect(_obj, (XinRect*)&rct);
const int width = (rct.right-rct.left) + 2*XI_FU_MULTIPLE;
if (width < cli.right)
{
RCT out; xvt_vobj_get_outer_rect(parent, &out);
RCT rct;
rct.left = out.left + (cli.right - width) / 2;
rct.right = rct.left + width;
rct.top = out.top; // cli had left = 0 and top = 0
rct.bottom = rct.top + cli.bottom;
xvt_vobj_move(parent, &rct);
}
}
const int extra = (cli.right - (rct.right-rct.left+2*XI_FU_MULTIPLE)) / 2;
if (extra > XI_FU_MULTIPLE)
{
WINDOW main_win = _sheet->win();
xvt_vobj_get_outer_rect(main_win, &cli);
cli.left += extra;
cli.right -= extra;
xvt_vobj_move(main_win, &cli);
xvt_vobj_get_client_rect(parent, &cli);
}
int num;
XI_OBJ** column = xi_get_member_list(_obj, &num);
for (i = 0; i < num; i++)
@ -315,7 +313,6 @@ int TSheet_control::rec2row(long record) const
return r;
}
// Converts a row number in the correspondig record number
long TSheet_control::row2rec(int row) const
{
@ -462,7 +459,15 @@ XI_OBJ* TSheet_control::find_column(
return c >= 0 ? column[c] : NULL;
}
bool TSheet_control::head(int c, TString& str) const
{
XI_OBJ* col = find_column(c);
if (col != NULL)
xi_get_text(col, str.get_buffer(80), 80);
else
str.cut(0);
return col != NULL;
}
void TSheet_control::enable_check(bool on)
{
@ -670,7 +675,7 @@ void TSheet_control::set_columns_order(TToken_string* order)
if (col)
{
xi_move_column(col, index);
RCT rct; xi_get_rect(col, (XinRect *) &rct);
RCT rct; xi_get_rect(col, (XinRect*)&rct);
if (_default_width[index] != rct.right - rct.left)
xi_column_set_pixel_width(col, _default_width[index]-offset);
}
@ -724,13 +729,13 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *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 >= items())
refused = TRUE;
else
xiev->v.rec_request.data_rec = n;
}
{
const long n = xiev->v.rec_request.spec_rec + (xiev->type == XIE_GET_NEXT ? +1 : -1) ;
if (n < 0 || n >= items())
refused = TRUE;
else
xiev->v.rec_request.data_rec = n;
}
break;
case XIE_CELL_REQUEST:
{
@ -778,7 +783,7 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
if (_disabled[rec])
{
xiev->v.cell_request.color = NORMAL_COLOR;
xiev->v.cell_request.color = DISABLED_COLOR;
xiev->v.cell_request.back_color = DISABLED_BACK_COLOR;
}
else
@ -975,11 +980,10 @@ void TQuery_field::create(WINDOW parent)
{
_ctl = new TSheet_control(parent, dlg(),
_ctl_data._x, _ctl_data._y,
_ctl_data._width, _ctl_data._size,
_ctl_data._width, (int)_ctl_data._size,
_ctl_data._flags, _ctl_data._prompt);
}
///////////////////////////////////////////////////////////
// TSheet
///////////////////////////////////////////////////////////
@ -989,26 +993,42 @@ void TQuery_field::create(WINDOW parent)
TSheet::TSheet(short x, short y, short dx, short dy,
const char* title, const char* head,
byte buttons, short sht_y, WINDOW parent)
: TMask(title, sht_y == 0 ? 1 : 2, dx, dy, x, y, parent),
: TMask(title, 1, dx, dy, x, y, parent),
_sheet(NULL), _select_row(-1), _parked(-1)
{
{
if (sht_y > 0) // Crea notebook se TBrowse_sheet
{
create_book(false); // Crea notebook e poi ...
create_page(title, 0); // ... la sua prima pagina
}
create_bar(1); // Crea toolbar in alto
TQuery_field* qf = new TQuery_field(this);
qf->construct(DLG_QUERY, head, 1, sht_y, -3, win(), "", -1);
qf->construct(DLG_QUERY, head, 1, sht_y, 0, page_win(0), "", 0);
fields_array().add(qf);
_sheet = qf->sheet();
if (!(buttons & 0x10)) add_button(DLG_SELECT, TR("~Selezione"), K_ENTER);
if (!(buttons & 0x10))
add_button(DLG_SELECT, TR("~Selezione"), K_ENTER, BMP_OK);
if (check_enabled())
{
add_button(DLG_USER, TR("~Tutti"), 0);
add_button(DLG_USER, TR("~Tutti"), 0, BMP_SELECT);
set_handler(DLG_USER, tutti_handler);
}
if (buttons & 0x01) add_button(DLG_LINK, TR("Colle~ga"), K_CTRL+'G', BMP_LINK);
if (buttons & 0x02) add_button(DLG_NEWREC, TR("~Nuovo"), K_INS, BMP_NEWREC, BMP_NEWRECDN);
if (buttons & 0x04) add_button(DLG_DELREC, "", K_DEL);
if (buttons & 0x08) add_button(DLG_QUIT, "", K_ESC);
else add_button(DLG_CANCEL, "", K_ESC);
if (buttons & 0x02) add_button(DLG_NEWREC, TR("~Nuovo"), K_INS, BMP_NEWREC);
if (buttons & 0x04) add_button(DLG_DELREC, "~Elimina", K_DEL, BMP_DELREC);
if (!check_enabled())
{
add_button(DLG_SAVEREC, TR("~Esporta"), 0, BMP_SAVEREC);
set_handler(DLG_SAVEREC, export_handler);
}
if (buttons & 0x08) add_button(DLG_QUIT, "Fine", K_ESC, BMP_QUIT);
else add_button(DLG_CANCEL, "Annulla", K_ESC, BMP_CANCEL);
xvt_toolbar_realize(toolbar()); // Necessario per calcolare dimensioni corrette dello sheet
}
TSheet::~TSheet()
@ -1046,14 +1066,27 @@ void TSheet::add_button(
short bmp_up, // @parm Bitmap normale
short bmp_dn) // @parm Bitmap premuta
{
TButton_field& butt = TMask::add_button(id, 0, caption, 0, -1, 11, 2,
"", bmp_up, bmp_dn);
butt.set_exit_key(key);
if (bmp_up <= 0)
{
if (toolwin() == NULL_WIN)
create_bar(-2); // Forza la creazione della bottom bar
TButton_field& butt = TMask::add_button(id, MAX_PAGES, caption, 0, -1, 11, 2);
butt.set_exit_key(key);
}
else
{
if (toolbar() == NULL_WIN)
create_bar(1); // Forza la creazione della top bar
TButton_tool& butt = add_button_tool(id, caption, bmp_up);
butt.set_exit_key(key);
}
}
bool TSheet::get_cell_colors(int row, int col, COLOR& fore, COLOR& back) const
{
fore = back = 0; // Default colors
if (row & 1)
back = REQUIRED_BACK_COLOR;
return false; // Not assigned
}
@ -1062,40 +1095,50 @@ void TSheet::repos_buttons() const
if (_sheet == NULL)
return; // Sono ancora in fase di creazione: aspetta!
RCT br;
int buttons = 0, f;
for (f = fields()-1; f >= 0; f--)
{
TMask_field& c = fld(f);
if (c.is_kind_of(CLASS_BUTTON_FIELD))
WINDOW btnwin = toolwin(); // was win()
RCT br, wr;
int buttons = 0;
FOR_EACH_MASK_FIELD((*this), f, c)
{
if (c->parent() == btnwin && c->is_kind_of(CLASS_BUTTON_FIELD))
{
if (buttons == 0)
c.get_rect(br);
c->get_rect(br);
buttons++;
}
}
RCT wr; xvt_vobj_get_client_rect(win(), &wr);
const short width = br.right - br.left;
const short height = br.bottom - br.top;
int space = (wr.right - buttons * width) / (buttons+1);
if (space < 0) space = 0;
int x = space;
const int y = wr.bottom - height - XI_FU_MULTIPLE;
if (buttons > 0)
{
xvt_vobj_get_client_rect(btnwin, &wr);
const short width = br.right - br.left;
const short height = br.bottom - br.top;
int space = (wr.right - buttons * width) / (buttons+1);
if (space < 0) space = 0;
int x = space;
const int y = (wr.bottom - height) / 2;
for (f = 0; buttons > 0; f++)
{
TMask_field& c = fld(f);
if (c.is_kind_of(CLASS_BUTTON_FIELD))
{
buttons--;
const PNT p = { y, x };
xvt_rect_set_pos(&br, p);
c.set_rect(br);
x += space+width;
FOR_EACH_MASK_FIELD((*this), f, c)
{
if (c->parent() == btnwin && c->is_kind_of(CLASS_BUTTON_FIELD))
{
buttons--;
const PNT p = { y, x };
xvt_rect_set_pos(&br, p);
c->set_rect(br);
x += space+width;
}
}
}
}
// Aggiusta anche lo spreadsheet
TMask_field& s = field(DLG_QUERY);
xvt_vobj_get_client_rect(s.parent(), &wr);
s.get_rect(br);
// br.right = wr.right - br.left + 2*CHARX;
br.bottom = wr.bottom - br.left;
s.set_rect(br);
}
void TSheet::force_update(int r)
@ -1210,6 +1253,9 @@ bool TSheet::on_key(KEY key)
{
switch(key)
{
case K_CTRL+'E':
export_handler(field(DLG_SAVEREC), K_SPACE);
break;
case K_CTRL+'T':
tutti_handler(field(DLG_USER), K_SPACE);
break;
@ -1265,7 +1311,8 @@ TToken_string& TSheet::row(
// @comm Se viene passato un numero di riga minore di 1 viene ritornato il contenuto della riga
// selezionata.
{
if (n < 0) n = selected();
if (n < 0)
n = selected();
if (n != _parked)
get_row(_parked = n, _park);
return _park;
@ -1282,6 +1329,56 @@ bool TSheet::tutti_handler(TMask_field& f, KEY k)
return true;
}
bool TSheet::export_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TSheet& s = (TSheet&)f.mask();
FILE_SPEC fs;
TFilename name;
s.get_caption(name); name.ext("xls");
xvt_fsys_convert_str_to_fspec(name, &fs);
if (xvt_dm_post_file_save(&fs, TR("Selezionare il file di destinazione")))
{
xvt_fsys_convert_fspec_to_str(&fs, name.get_buffer(), name.size());
ofstream xls(name);
const char sep = '\t';
TToken_string tab(128, sep);
TString80 str;
int columns = 0;
for (columns = 0; ; columns++)
{
if (s._sheet->head(columns, str))
tab.add(str);
else
break;
}
xls << tab << endl;
for (long n = 0; n < s.items(); n++)
{
const TToken_string& r = s.row(n);
tab = r;
tab.replace(r.separator(), sep);
tab.separator(sep);
for (int c = 0; c < columns; c++)
{
const char ct = s._sheet->column_type(c);
if (ct == 'P' || ct == 'V')
{
tab.get(c, str);
xvt_str_number_format(str.get_buffer(), str.size());
tab.add(str, c);
}
}
xls << tab << endl;
}
}
}
return true;
}
void TSheet::save_columns_order(const TEdit_field& field)
{ sheet().save_columns_order(field); }
@ -1291,7 +1388,6 @@ void TSheet::set_columns_order(TToken_string* col)
void TSheet::load_columns_order(const TEdit_field& field)
{ sheet().load_columns_order(field); }
///////////////////////////////////////////////////////////
// TArray_sheet
///////////////////////////////////////////////////////////
@ -1300,11 +1396,13 @@ TArray_sheet::TArray_sheet(short x, short y, short dx, short dy, const char* cap
const char* head, byte buttons, short sht_y)
: TSheet(x, y, dx, dy, caption, head, buttons, sht_y)
{
if (dx == 0)
TToken_string cap(caption);
if (cap.items() > 1)
{
TToken_string cap(caption);
add_tag_buttons(cap);
}
cap.get(0);
FOR_EACH_TOKEN(cap, tok)
create_page(tok, 0);
}
}
// Certified 99%
@ -1351,7 +1449,6 @@ long TArray_sheet::insert(const TToken_string& s, long n)
return n;
}
///////////////////////////////////////////////////////////
// TCursor_sheet
///////////////////////////////////////////////////////////
@ -1380,7 +1477,7 @@ bool TCursor_sheet::in_key(const TFieldref& fr) const
TCursor_sheet::TCursor_sheet(TCursor* cursor, const char* fields,
const char* title, const char* head,
byte buttons, short sht_y, WINDOW parent)
: TSheet(sht_y ? 3 : 0, sht_y ? 3 : 0, sht_y ? -3 : 0, sht_y ? -3 : 0,
: TSheet(sht_y ? 2 : 0, sht_y ? 2 : 0, sht_y ? -2 : 0, sht_y ? -2 : 0,
title, head, buttons, sht_y, parent), _cursor(cursor)
{
TToken_string fldlst(fields);
@ -1442,13 +1539,12 @@ bool TCursor_sheet::get_cell_colors(int row, int col, COLOR& fore, COLOR& back)
if (_key_cols[col])
{
fore = 0;
back = REQUIRED_BACK_COLOR;
back = REQUIRED_BACK_COLOR; // Evidenzia i campi chiave
return true;
}
return TSheet::get_cell_colors(row, col, fore, back);
}
///////////////////////////////////////////////////////////
// TBrowse_sheet
///////////////////////////////////////////////////////////
@ -1592,9 +1688,9 @@ void TBrowse_sheet::handler(
WINDOW win, // @parm Finestra da gestire
EVENT* ep) // @parm Evento da gestire nella finestra
{
if (ep->type == E_MOUSE_DOWN)
{
TSheet_control& sht = sheet();
switch (ep->type)
{
case E_MOUSE_DOWN:
switch (ep->v.mouse.button )
{
case 1:
@ -1602,7 +1698,7 @@ void TBrowse_sheet::handler(
MENU_ITEM* menu = xvt_res_get_menu(BROWSE_BAR);
if (menu)
{
dictionary_translate_menu(menu);
dictionary_translate_menu(menu);
const PNT& p = ep->v.mouse.where;
RCT cr; xvt_vobj_get_client_rect(win, &cr);
XVT_POPUP_ALIGNMENT pa = XVT_POPUP_CENTER;
@ -1620,7 +1716,7 @@ void TBrowse_sheet::handler(
break;
default:
{
RCT r; sht.get_rect(r);
RCT r; sheet().get_rect(r);
if (xvt_rect_has_point(&r, ep->v.mouse.where) && _rec_to_select >= 0)
{
post_select(_rec_to_select);
@ -1629,15 +1725,13 @@ void TBrowse_sheet::handler(
}
break;
}
}
else
if (ep->type == E_COMMAND)
{
break;
case E_COMMAND:
switch (ep->v.cmd.tag)
{
case BROWSE_BAR + 1:
save_columns_order(field());
return;
return;
case BROWSE_BAR + 2:
set_columns_order(NULL);
return;
@ -1647,6 +1741,17 @@ void TBrowse_sheet::handler(
default:
break;
}
break;
case E_CONTROL:
if (ep->v.ctl.ci.type == WC_NOTEBK)
{
const int new_search = ep->v.ctl.ci.v.notebk.tab_no;
on_key(K_CTRL+K_F1+new_search);
return;
}
break;
default:
break;
}
TCursor_sheet::handler(win, ep);
@ -1678,9 +1783,9 @@ TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
{
ca = f.prompt();
if (ca.blank())
ca = PR("Codice");
ca = TR("Codice");
}
add_tag_button(0, ca, _sel);
set_tab_buttons(ca);
TToken_string tids = head;
TToken_string tfns = fields;
@ -1800,10 +1905,8 @@ bool TBrowse_sheet::on_key(KEY k)
KEY TBrowse_sheet::run()
{
_cur_browse = this;
show_page(_sel);
const KEY key = TCursor_sheet::run();
_cur_browse = NULL;
return key;
}

View File

@ -30,7 +30,8 @@ protected: // TMask
virtual void on_idle();
static bool tutti_handler(TMask_field& f, KEY k);
static bool export_handler(TMask_field& f, KEY k);
protected:
void reset_parked() { _parked = -1; }
virtual void get_row(long r, TToken_string& row) { row.cut(0); }

View File

@ -952,14 +952,17 @@ bool TTree_window::add_child(XVT_TREEVIEW_NODE parent)
XVT_IMAGE ii = NULL, ic = NULL, ie = NULL;
TImage* im_nor = _tree->image(false);
if (type == XVT_TREEVIEW_NODE_NONTERMINAL)
if (im_nor != NULL)
{
TImage* im_sel = _tree->image(true);
ic = im_nor->xvt_image();
ie = im_sel->xvt_image();
if (type == XVT_TREEVIEW_NODE_NONTERMINAL)
{
TImage* im_sel = _tree->image(true);
ic = im_nor->xvt_image();
ie = im_sel->xvt_image();
}
else
ii = im_nor->xvt_image();
}
else
ii = im_nor->xvt_image();
XVT_TREEVIEW_NODE child = xvt_treeview_add_child_node(_ctrl, parent, type, ii, ic, ie, desc, NULL, id);
if (child != NULL && type == XVT_TREEVIEW_NODE_NONTERMINAL && _tree->expanded())
{

View File

@ -88,6 +88,8 @@
#define BMP_SAVERECDN 153
#define BMP_DELRECDN 154
#define BMP_NEWRECDN 155
#define BMP_INFO 162
#define BMP_HELP 163
#define BMP_QUITDN 164
#define BMP_SETPRINT 165
#define BMP_LENTE 166
@ -101,6 +103,34 @@
#define BMP_PDF 174
#define BMP_ARCHIVE 175
#define BMP_PROGRAM 176
#define TOOL_OK 101
#define TOOL_CANCEL 102
#define TOOL_SAVEREC 103
#define TOOL_DELREC 104
#define TOOL_NEWREC 105
#define TOOL_CONFIG 107
#define TOOL_QUIT 114
#define TOOL_SELECT 115
#define TOOL_EDIT 116
#define TOOL_LINK 117
#define TOOL_PRINT 118
#define TOOL_RECALC 119
#define TOOL_ELABORA 120
#define TOOL_FIRSTREC 121
#define TOOL_PREVREC 122
#define TOOL_STOPREC 123
#define TOOL_NEXTREC 124
#define TOOL_LASTREC 125
#define TOOL_FINDREC 126
#define TOOL_EMAIL 139
#define TOOL_INFO 162
#define TOOL_HELP 163
#define TOOL_SETPRINT 165
#define TOOL_LENTE 166
#define TOOL_PREF 204
#define TOOL_ADDPREF 205
#endif
/* @END */

View File

@ -471,7 +471,6 @@ void TWindow::open_modal()
WinManager.reg(this);
}
void TWindow::close()
{
CHECK(_win != NULL_WIN, "Can't close a NULL window");
@ -479,7 +478,6 @@ void TWindow::close()
xvt_vobj_set_visible(_win, _open = FALSE);
}
void TWindow::close_modal()
{
if (is_modal())

View File

@ -54,7 +54,7 @@ RCT& resize_rect(
{
if (xvt_vobj_get_type(parent) == W_PLAIN) // Mask with Toolbar
{
if (y >= 0)
/* if (y >= 0)
{
const TWindow* w = (const TWindow*)xvt_vobj_get_data(parent);
if (w->is_kind_of(CLASS_MASK))
@ -63,7 +63,7 @@ RCT& resize_rect(
if (parent != m->toolwin())
y++;
}
}
} */
if (x > 0 || (wt != WO_TE && wt != W_PLAIN && x == 0))
{
RCT pc; xvt_vobj_get_client_rect(parent, &pc); // Get parent window size
@ -72,13 +72,13 @@ RCT& resize_rect(
if (width > tot) x += (width-tot) / (CHARX<<1);
}
}
wt = WC_TEXTEDIT;
wt = WC_TEXTEDIT; // Campo di maschera
}
else
{
if (ROWY <= 0) // Not yet initialized
{
RCT pc; xvt_vobj_get_client_rect(TASK_WIN, &pc);
RCT pc; xvt_vobj_get_client_rect(parent, &pc);
ROWY = (pc.bottom - pc.top) / 23;
}
}
@ -86,12 +86,19 @@ RCT& resize_rect(
switch (wt)
{
case WC_TEXTEDIT :
r.left = (x+1)*CHARX;
r.top = y*ROWY;
r.right = dx*CHARX;
r.bottom = (CHARY << 1) - BASEY;
if (dy > 1)
r.bottom += ROWY*(dy-1);
if (x == 0 && dx == 0 && y == 0 && dy == 0) // Campo a tutta pagina!
{
xvt_vobj_get_client_rect(parent, &r);
}
else
{
r.left = (x+1)*CHARX;
r.top = y*ROWY;
r.right = dx*CHARX;
r.bottom = (CHARY << 1) - BASEY;
if (dy > 1)
r.bottom += ROWY*(dy-1);
}
break;
case W_DOC:
r.left = x * CHARX;