Corrette maschere gestione form

git-svn-id: svn://10.65.10.50/trunk@1402 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-05-29 10:19:44 +00:00
parent 98ecd1aa2d
commit 61f440602f
7 changed files with 222 additions and 211 deletions

View File

@ -612,7 +612,6 @@ void TManutenzione_app::update_dir()
} }
void TManutenzione_app::convert_dir() void TManutenzione_app::convert_dir()
{ {
const TString pref(prefix().name()); const TString pref(prefix().name());
const bool is_com = prefix().is_com(); const bool is_com = prefix().is_com();
@ -665,20 +664,27 @@ void TManutenzione_app::convert_dir()
void TManutenzione_app::update() void TManutenzione_app::update()
{ {
bool lock_users = FALSE;
TIsamfile utenti(LF_USER, FALSE); TIsamfile utenti(LF_USER, FALSE);
utenti.open(_excllock); utenti.open(_excllock);
for (int err = utenti.first(); err == NOERR; err = utenti.next()) if (utenti.curr().exist("CONNECTED"))
{ {
const TString16 u = utenti.get("USERNAME"); for (int err = utenti.first(); err == NOERR; err = utenti.next())
if (u != "PRASSI" && utenti.get_bool("CONNECTED")) {
{ const TString16 u = utenti.get("USERNAME");
error_box("La conversione non puo' essere effettuata\n" if (u != "PRASSI" && utenti.get_bool("CONNECTED"))
"se ci sono utenti collegati: %s", (const char*)u); {
utenti.close(); error_box("La conversione non puo' essere effettuata\n"
return; "se ci sono utenti collegati: %s", (const char*)u);
} utenti.close();
} return;
}
}
lock_users = TRUE;
}
else utenti.close();
long firm = get_firm(); long firm = get_firm();
TString pref; TString pref;
@ -721,7 +727,8 @@ void TManutenzione_app::update()
if (firm > 0) set_firm(firm); if (firm > 0) set_firm(firm);
else prefix().set(pref); else prefix().set(pref);
utenti.close(); if (lock_users)
utenti.close();
end_wait(); end_wait();
} }

View File

@ -12,7 +12,7 @@
class TForm_editor : public TApplication class TForm_editor : public TApplication
{ {
TForm* _form; TForm* _form;
bool _edit; bool _extra;
protected: protected:
virtual bool create(); virtual bool create();
@ -32,7 +32,7 @@ public:
}; };
TForm_editor::TForm_editor() : _form(NULL) TForm_editor::TForm_editor() : _form(NULL), _extra(FALSE)
{} {}
TForm_editor::~TForm_editor() TForm_editor::~TForm_editor()
@ -42,32 +42,33 @@ bool TForm_editor::create()
{ {
TApplication::create(); TApplication::create();
if (argc() < 3) const char* form = NULL;
return error_box("Specificare il nome del profilo di stampa"); long code = 0;
TFilename form(argv(2)); form.ext("frm"); for (int a = 2; a < argc(); a++)
if (!fexist(form))
{ {
TFilename base(form.left(3)); base.ext("frm"); if (stricmp(argv(a), "-E") == 0)
if (!fexist(base)) {
return error_box("Non esiste il profilo campione %s", (const char*)base); _extra = TRUE;
continue;
}
if (!yesno_box("Si desidera creare un nuovo profilo %s", (const char*)form)) if (form == NULL)
return FALSE; form = argv(a);
else
if (!fcopy(base, form)) if (code == 0)
return error_box("Impossibile copiare %s in %s", (const char*)base, (const char*)form); code = atol(argv(a));
} }
_edit = argc() > 3; if (form)
_form = new TForm(form); {
_form = new TForm(form, code, _extra ? 2 : 1);
enable_menu_item(M_FILE_PRINT);
if (!_extra) dispatch_e_menu(MENU_ITEM(31));
}
else error_box("Specificare il form da modificare!");
enable_menu_item(M_FILE_PRINT); return form != NULL;
if (!_edit) dispatch_e_menu(MENU_ITEM(31));
return TRUE;
} }
bool TForm_editor::destroy() bool TForm_editor::destroy()
@ -125,7 +126,7 @@ bool TForm_editor::menu(MENU_TAG tag)
} }
edit(sec, pt); edit(sec, pt);
return _edit; return _extra;
} }
void TForm_editor::print() void TForm_editor::print()
@ -139,10 +140,14 @@ bool TForm_editor::file_handler(TMask_field& f, KEY k)
bool ok = TRUE; bool ok = TRUE;
if (k == K_TAB && f.dirty()) if (k == K_TAB && f.dirty())
{ {
const char* d = prefix().description(f.get()); const char* n = f.get();
if (*d == '\0') ok = error_box("Nome di file o tabella errato"); if (*n > ' ')
f.mask().set(f.dlg()+1, d); {
const char* d = prefix().description(n);
if (*d == '\0') ok = error_box("Nome di file o tabella errato");
f.mask().set(f.dlg()+1, d);
}
} }
return ok; return ok;
@ -160,9 +165,10 @@ bool TForm_editor::edit_relation()
if (rel) if (rel)
{ {
rel->print_on(s.rows_array()); s.rows_array() = _form->rel_desc().get_all_desc();
s.force_update(); // Disable meaningless fields for main file
s.disable_cell(0, 2); s.disable_cell(0, 5); s.disable_cell(0, 2); // Join
s.disable_cell(0, 4); // Alias
} }
if (m.run() != K_ENTER || !m.dirty()) if (m.run() != K_ENTER || !m.dirty())
@ -180,10 +186,9 @@ bool TForm_editor::edit_relation()
if (name.not_empty()) if (name.not_empty())
{ {
int logicnum = atoi(name); int logicnum = atoi(name);
r.get(); // Skip description
int alias = 0, to = 0, key = r.get_int(2); int alias = 0, to = 0, key = r.get_int(3);
TString80 exp = r.get(4); TString80 exp = r.get(5);
rel = (logicnum > 0) ? new TRelation(logicnum) : new TRelation(name); rel = (logicnum > 0) ? new TRelation(logicnum) : new TRelation(name);
cur = new TCursor(rel, exp, key); cur = new TCursor(rel, exp, key);
@ -192,10 +197,11 @@ bool TForm_editor::edit_relation()
{ {
TToken_string& r = s.row(i); TToken_string& r = s.row(i);
name = r.get(0); logicnum = atoi(name); name = r.get(0); logicnum = atoi(name);
to = name2log(r.get()); r.get(); // Skip description
key = r.get_int(); to = name2log(r.get()); // Join
alias = r.get_int(); key = r.get_int(); // Key
exp = r.get(); alias = r.get_int(); // Alias
exp = r.get(); // Expression
const int l = exp.len(); const int l = exp.len();
for (int j = 0; j < l; j++) for (int j = 0; j < l; j++)
@ -206,6 +212,8 @@ bool TForm_editor::edit_relation()
else else
rel->add(name, exp, key, to, alias); // join table rel->add(name, exp, key, to, alias); // join table
} }
_form->rel_desc().change_relation(*rel, s.rows_array());
} }
return TRUE; return TRUE;
@ -218,65 +226,71 @@ bool TForm_editor::edit(char s, pagetype t)
if (s == 'R') if (s == 'R')
dirty = edit_relation(); dirty = edit_relation();
if (s == 'D')
form_config();
else else
{ if (s == 'D')
TString80 caption; form_config();
switch(s) else
{ {
case 'F': TString80 caption;
caption << "Piede"; break; switch(s)
case 'G':
caption << "Sfondo"; break;
case 'H':
caption << "Testa"; break;
default:
caption << "Corpo"; break;
}
switch(t)
{
case first_page:
caption << " della prima pagina"; break;
case even_page:
caption << " delle pagine pari"; break;
case last_page:
caption << " dell'ultima pagina"; break;
default:
caption << " standard"; break;
}
dirty = TRUE;
if (!_form->exist(s, t))
{
const KEY k = yesnocancel_box("La sezione %s non esiste:\n"
"si desidera generare quella standard?",
(const char*)caption);
if (k == K_ESC)
dirty = FALSE;
else
{ {
TPrint_section* sec = _form->exist(s, t, TRUE); case 'F':
if (k == K_YES) caption << "Piede"; break;
case 'G':
caption << "Sfondo"; break;
case 'H':
caption << "Testa"; break;
default:
caption << "Corpo"; break;
}
switch(t)
{
case first_page:
caption << " della prima pagina"; break;
case even_page:
caption << " delle pagine pari"; break;
case last_page:
caption << " dell'ultima pagina"; break;
default:
caption << " standard"; break;
}
dirty = TRUE;
if (!_form->exist(s, t))
{
const KEY k = yesnocancel_box("La sezione %s non esiste:\n"
"si desidera generare quella standard?",
(const char*)caption);
if (k == K_ESC)
dirty = FALSE;
else
{ {
const TPrint_section* def = _form->exist(s, odd_page); TPrint_section* sec = _form->exist(s, t, TRUE);
if (def) *sec = *def; if (k == K_YES)
else dirty = FALSE; {
const TPrint_section* def = _form->exist(s, odd_page);
if (def) *sec = *def;
else dirty = FALSE;
}
} }
} }
} if (dirty)
if (dirty) dirty = _form->section(s, t).edit(caption);
dirty = _form->section(s, t).edit(caption, _edit); }
}
if (dirty && yesno_box("Salvare le modifiche?")) if (dirty && yesno_box("Salvare le modifiche?"))
{ {
const TFilename& n = _form->name(); if (_form->code() == 0L)
TFilename bak(n); bak.ext("bak"); {
rename(n, bak); TFilename n(_form->name()); n.ext("frm");
ofstream out(n); TFilename bak(n); bak.ext("bak");
_form->print_on(out); rename(n, bak);
ofstream out(n);
_form->print_on(out);
}
else
_form->write_profile();
} }
return dirty; return dirty;
@ -285,13 +299,13 @@ bool TForm_editor::edit(char s, pagetype t)
bool TForm_editor::form_config() const bool TForm_editor::form_config() const
{ {
TFilename cnfnam(_form->name().path()); TFilename cnfnam(_form->name()); cnfnam.ext("ini");
const TString16 n(_form->name().name());
cnfnam.add(n.left(3));
cnfnam.ext("ini");
TFilename cnfpar(_form->name()); TString16 cnfpar;
cnfpar.ext(""); if (_form->code() != 0L)
cnfpar << _form->code();
else
cnfpar << "Main";
TConfig cnf(cnfnam, cnfpar); TConfig cnf(cnfnam, cnfpar);
bool ok = FALSE; bool ok = FALSE;
@ -339,7 +353,6 @@ bool TForm_editor::form_config() const
} }
int ba2100(int argc, char* argv[]) int ba2100(int argc, char* argv[])
{ {
TForm_editor a; TForm_editor a;

View File

@ -1,3 +1,5 @@
// Maschera di edit dei form
#define F_CLASS 101 #define F_CLASS 101
#define F_KEY 102 #define F_KEY 102
#define F_Y 103 #define F_Y 103
@ -9,25 +11,7 @@
#define F_DISABLED 109 #define F_DISABLED 109
#define F_AUTOMAGIC 110 #define F_AUTOMAGIC 110
#define F_PICTURE 111 #define F_PICTURE 111
#define F_ID 112
#define F_FILE1 112
#define F_BUT_FILE1 113
#define F_FIELD1 114
#define F_BUT_FIELD1 115
#define F_FIELDREF1 116
#define F_FILE2 117
#define F_BUT_FILE2 118
#define F_FIELD2 119
#define F_BUT_FIELD2 120
#define F_FIELDREF2 121
#define F_ID 124
#define F_PERM_COORD 125
#define F_PERM_ENABLE 126
#define F_PERM_SHOW 127
#define F_PERM_FIELD 128
#define F_PERM_REMOVE 129
#define F_GROUP 130 #define F_GROUP 130
#define F_GROUP1 131 #define F_GROUP1 131
@ -54,17 +38,30 @@
#define F_GROUP22 152 #define F_GROUP22 152
#define F_GROUP23 153 #define F_GROUP23 153
#define F_GROUP24 154 #define F_GROUP24 154
#define F_DFORMAT 155
#define F_DDAY 156 #define F_DFORMAT 160
#define F_DMONTH 157 #define F_DDAY 161
#define F_DYEAR 158 #define F_DMONTH 162
#define F_DSEP 159 #define F_DYEAR 163
#define F_DEXAMPLE 160 #define F_DSEP 164
#define F_FILE 161 #define F_DEXAMPLE 165
#define F_BUT_FILE 162 #define F_FILE 166
#define F_BUT_FIELD 163
#define F_FIELDREF1 170
#define F_FILE1 171
#define F_BUT_FILE1 172
#define F_FIELD1 173
#define F_BUT_FIELD1 174
#define F_FROM1 175
#define F_TO1 176
#define F_FIELDREF2 180
#define F_FILE2 181
#define F_BUT_FILE2 182
#define F_FIELD2 183
#define F_BUT_FIELD2 184
#define F_FROM2 185
#define F_TO2 186
#define F_ITEMS 200 #define F_ITEMS 200
#define F_DECIMALS 206 #define F_DECIMALS 206

View File

@ -180,9 +180,9 @@ BEGIN
GROUP 7 GROUP 7
END END
STRING F_FIELD1 40 STRING F_FIELD1 60
BEGIN BEGIN
PROMPT 2 13 "Campo " PROMPT 2 13 "Campo 1 "
HELP "Nome del campo su file" HELP "Nome del campo su file"
FLAGS "D" FLAGS "D"
GROUP 7 GROUP 7
@ -190,26 +190,36 @@ END
BUTTON F_BUT_FIELD1 2 1 BUTTON F_BUT_FIELD1 2 1
BEGIN BEGIN
PROMPT 53 13 "*" PROMPT 73 13 "*"
PICTURE 109 PICTURE 109
GROUP 7 GROUP 7
END END
STRING F_FIELDREF1 16 STRING F_FIELDREF1 16
BEGIN BEGIN
PROMPT 60 13 "" PROMPT 60 14 ""
FLAGS "D" FLAGS "D"
GROUP 7 GROUP 7
END END
GROUPBOX DLG_NULL 78 4 NUMBER F_FROM1 2
BEGIN BEGIN
PROMPT 1 11 "Campo principale su file" PROMPT 2 14 "Da "
FLAGS "U"
GROUP 7
END END
NUMBER F_TO1 2
BEGIN
PROMPT 22 14 "A "
FLAGS "U"
GROUP 7
END
STRING F_FILE2 60 STRING F_FILE2 60
BEGIN BEGIN
PROMPT 2 16 "Archivio " PROMPT 2 15 "Archivio "
HELP "Nome dell'archivio relativo al campo" HELP "Nome dell'archivio relativo al campo"
FLAGS "D" FLAGS "D"
GROUP 7 GROUP 7
@ -217,14 +227,14 @@ END
BUTTON F_BUT_FILE2 2 1 BUTTON F_BUT_FILE2 2 1
BEGIN BEGIN
PROMPT 73 16 "*" PROMPT 73 15 "*"
PICTURE 109 PICTURE 109
GROUP 7 GROUP 7
END END
STRING F_FIELD2 40 STRING F_FIELD2 60
BEGIN BEGIN
PROMPT 2 17 "Campo " PROMPT 2 16 "Campo 2 "
HELP "Nome del campo su file" HELP "Nome del campo su file"
FLAGS "D" FLAGS "D"
GROUP 7 GROUP 7
@ -232,7 +242,7 @@ END
BUTTON F_BUT_FIELD2 2 1 BUTTON F_BUT_FIELD2 2 1
BEGIN BEGIN
PROMPT 53 17 "*" PROMPT 73 16 "*"
PICTURE 109 PICTURE 109
GROUP 7 GROUP 7
END END
@ -244,45 +254,29 @@ BEGIN
GROUP 7 GROUP 7
END END
GROUPBOX DLG_NULL 78 4 NUMBER F_FROM2 2
BEGIN
PROMPT 2 17 "Da "
FLAGS "U"
GROUP 7
END
NUMBER F_TO2 2
BEGIN
PROMPT 22 17 "A "
FLAGS "U"
GROUP 7
END
GROUPBOX DLG_NULL 78 8
BEGIN BEGIN
PROMPT 1 15 "Campo alternativo su file" PROMPT 1 11 "Campi su file"
END END
ENDPAGE ENDPAGE
PAGE "SUPERPRASSI" -1 -1 78 20 PAGE "SUPERPRASSI" -1 -1 78 20
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 1 "Permessi di modifica"
END
BOOLEAN F_PERM_COORD
BEGIN
PROMPT 4 2 "Coordinate e dimensioni"
END
BOOLEAN F_PERM_SHOW
BEGIN
PROMPT 32 2 "Visibilita'"
END
BOOLEAN F_PERM_FIELD
BEGIN
PROMPT 60 2 "Campi su file"
END
BOOLEAN F_PERM_REMOVE
BEGIN
PROMPT 4 3 "Cancellazione"
END
BOOLEAN F_PERM_ENABLE
BEGIN
PROMPT 32 3 "Abilitazione"
END
GROUPBOX DLG_NULL 78 3 GROUPBOX DLG_NULL 78 3
BEGIN BEGIN
PROMPT 1 5 "Caratteristiche speciali" PROMPT 1 5 "Caratteristiche speciali"
@ -297,7 +291,7 @@ END
BOOLEAN F_AUTOMAGIC BOOLEAN F_AUTOMAGIC
BEGIN BEGIN
PROMPT 32 6 "Automatico" PROMPT 42 6 "Automatico"
HELP "Il campo viene calcolato automaticamente" HELP "Il campo viene calcolato automaticamente"
GROUP 7 GROUP 7
END END

View File

@ -6,40 +6,42 @@ SPREADSHEET F_ITEMS 0 9
BEGIN BEGIN
PROMPT 0 1 "Spreadsheet" PROMPT 0 1 "Spreadsheet"
ITEM "File@4" ITEM "File@4"
ITEM "Descrizione@40" ITEM "Descrizione@50"
ITEM "Join@4" ITEM "Join@4"
ITEM "Chiave@2" ITEM "Chiave@2"
ITEM "Alias@3" ITEM "Alias@4"
ITEM "Espressione@40" ITEM "Espressione@50"
END END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""
END END
BUTTON DLG_CANCEL 10 2 BUTTON DLG_CANCEL 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -1 ""
END END
ENDPAGE ENDPAGE
ENDMASK ENDMASK
PAGE "Spreadsheet" -1 -1 60 8 PAGE "Spreadsheet" -1 -1 70 8
STRING 101 4 STRING 101 4
BEGIN BEGIN
PROMPT 1 1 "File " PROMPT 1 1 "File "
FLAGS "U" FLAGS "U"
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
WARNING "Il codice del file e' obbligatorio"
END END
STRING 102 40 STRING 102 50
BEGIN BEGIN
PROMPT 16 1 "" PROMPT 16 1 ""
FLAGS "D" CHECKTYPE REQUIRED
WARNING "La descrizione del file e' obbligatoria"
END END
STRING 103 4 STRING 103 4
@ -54,13 +56,13 @@ BEGIN
FLAGS "U" FLAGS "U"
END END
NUMBER 105 3 NUMBER 105 4
BEGIN BEGIN
PROMPT 1 4 "Alias " PROMPT 1 4 "Alias "
FLAGS "U" FLAGS "U"
END END
STRING 106 40 STRING 106 50
BEGIN BEGIN
PROMPT 1 5 "Espr. " PROMPT 1 5 "Espr. "
FLAGS "U" FLAGS "U"
@ -69,12 +71,12 @@ END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""
END END
BUTTON DLG_CANCEL 10 2 BUTTON DLG_CANCEL 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -1 ""
END END
ENDPAGE ENDPAGE

View File

@ -266,27 +266,28 @@ bool TArchive::backup(const char* dir, char floppy, const char* desc)
const TFilename d(dir); const TFilename d(dir);
const TString16 name(d.name()); const TString16 name(d.name());
TFilename work; work.tempdir(); work << '/' << name << ".gal"; TFilename work; work.tempdir(); work.add(name); work.ext("gal");
_arc = new ALArchive(work); _arc = new ALArchive(work);
TProgress_win w("Archiviazione", this); TProgress_win w("Archiviazione", this);
ALEntryList list(w.monitor()); ALEntryList list(w.monitor());
_arc->AddWildCardFiles( list, "*.*" ); _arc->AddWildCardFiles(list, "*.*");
w.open_modal(); w.open_modal();
_arc->Create( list ); _arc->Create( list );
w.close_modal();
bool ok = _arc->mStatus == AL_SUCCESS; bool ok = _arc->mStatus == AL_SUCCESS;
if (!ok) if (ok)
ok = fsplit(work, floppy, desc);
else
error_box("Compressione degli archivi errata o incompleta:\n%s", error_box("Compressione degli archivi errata o incompleta:\n%s",
_arc->mStatus.GetStatusString()); _arc->mStatus.GetStatusDetail());
w.close_modal();
delete _arc; _arc = NULL; delete _arc; _arc = NULL;
if (ok) ok = fsplit(work, floppy, desc);
remove(work); remove(work);
xvt_fsys_restore_dir(); xvt_fsys_restore_dir();
prefix().set(old); prefix().set(old);
@ -375,13 +376,13 @@ void TArchive::stop_job()
// TProgress_win implementation // TProgress_win implementation
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TProgress_win::TProgress_win(const char* title, TArchive* _arc) TProgress_win::TProgress_win(const char* title, TArchive* arc)
: TMask(title, 1, 60, 5) : TMask(title, 1, 60, 5), _arc(arc)
{ {
WINDOW wtxt = add_string(101, 0, "", -11, 1, 56, "D"); WINDOW wtxt = add_string(101, 0, "", -11, 1, 56, "D");
WINDOW wnum = add_number(102, 0, "", -11, 2, 4, "D"); WINDOW wnum = add_number(102, 0, "", -11, 2, 4, "D");
WINDOW wcan = add_button(DLG_CANCEL, 0, "", -11, 3, 10, 2); WINDOW wcan = add_button(DLG_USER, 0, "#102Cancel", -11, 3, 10, 2);
set_handler(DLG_CANCEL, cancel_handler); set_handler(DLG_USER, cancel_handler);
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
HWND txt = (HWND)xvt_vobj_get_attr(wtxt, ATTR_NATIVE_WINDOW); HWND txt = (HWND)xvt_vobj_get_attr(wtxt, ATTR_NATIVE_WINDOW);

View File

@ -7,12 +7,9 @@ JOIN %BAN ALIAS 14 INTO CODTAB=S7
JOIN %BAN ALIAS 24 INTO CODTAB=S7+S8 JOIN %BAN ALIAS 24 INTO CODTAB=S7+S8
JOIN 13 TO 24@ ALIAS 313 INTO COM=S5 JOIN 13 TO 24@ ALIAS 313 INTO COM=S5
END
PERMISSIONS
BEGIN
END END
SECTION BODY ODD 66 0 0 SECTION BODY ODD 63 0 0
STRINGA 1 STRINGA 1
BEGIN BEGIN