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

View File

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

View File

@ -1,3 +1,5 @@
// Maschera di edit dei form
#define F_CLASS 101
#define F_KEY 102
#define F_Y 103
@ -9,25 +11,7 @@
#define F_DISABLED 109
#define F_AUTOMAGIC 110
#define F_PICTURE 111
#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_ID 112
#define F_GROUP 130
#define F_GROUP1 131
@ -54,17 +38,30 @@
#define F_GROUP22 152
#define F_GROUP23 153
#define F_GROUP24 154
#define F_DFORMAT 155
#define F_DDAY 156
#define F_DMONTH 157
#define F_DYEAR 158
#define F_DSEP 159
#define F_DEXAMPLE 160
#define F_FILE 161
#define F_BUT_FILE 162
#define F_BUT_FIELD 163
#define F_DFORMAT 160
#define F_DDAY 161
#define F_DMONTH 162
#define F_DYEAR 163
#define F_DSEP 164
#define F_DEXAMPLE 165
#define F_FILE 166
#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_DECIMALS 206

View File

@ -180,9 +180,9 @@ BEGIN
GROUP 7
END
STRING F_FIELD1 40
STRING F_FIELD1 60
BEGIN
PROMPT 2 13 "Campo "
PROMPT 2 13 "Campo 1 "
HELP "Nome del campo su file"
FLAGS "D"
GROUP 7
@ -190,26 +190,36 @@ END
BUTTON F_BUT_FIELD1 2 1
BEGIN
PROMPT 53 13 "*"
PROMPT 73 13 "*"
PICTURE 109
GROUP 7
END
STRING F_FIELDREF1 16
BEGIN
PROMPT 60 13 ""
PROMPT 60 14 ""
FLAGS "D"
GROUP 7
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 11 "Campo principale su file"
NUMBER F_FROM1 2
BEGIN
PROMPT 2 14 "Da "
FLAGS "U"
GROUP 7
END
NUMBER F_TO1 2
BEGIN
PROMPT 22 14 "A "
FLAGS "U"
GROUP 7
END
STRING F_FILE2 60
BEGIN
PROMPT 2 16 "Archivio "
PROMPT 2 15 "Archivio "
HELP "Nome dell'archivio relativo al campo"
FLAGS "D"
GROUP 7
@ -217,14 +227,14 @@ END
BUTTON F_BUT_FILE2 2 1
BEGIN
PROMPT 73 16 "*"
PROMPT 73 15 "*"
PICTURE 109
GROUP 7
END
STRING F_FIELD2 40
STRING F_FIELD2 60
BEGIN
PROMPT 2 17 "Campo "
PROMPT 2 16 "Campo 2 "
HELP "Nome del campo su file"
FLAGS "D"
GROUP 7
@ -232,7 +242,7 @@ END
BUTTON F_BUT_FIELD2 2 1
BEGIN
PROMPT 53 17 "*"
PROMPT 73 16 "*"
PICTURE 109
GROUP 7
END
@ -244,45 +254,29 @@ BEGIN
GROUP 7
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
PROMPT 1 15 "Campo alternativo su file"
PROMPT 1 11 "Campi su file"
END
ENDPAGE
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
BEGIN
PROMPT 1 5 "Caratteristiche speciali"
@ -297,7 +291,7 @@ END
BOOLEAN F_AUTOMAGIC
BEGIN
PROMPT 32 6 "Automatico"
PROMPT 42 6 "Automatico"
HELP "Il campo viene calcolato automaticamente"
GROUP 7
END

View File

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

View File

@ -266,27 +266,28 @@ bool TArchive::backup(const char* dir, char floppy, const char* desc)
const TFilename d(dir);
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);
TProgress_win w("Archiviazione", this);
ALEntryList list(w.monitor());
_arc->AddWildCardFiles( list, "*.*" );
_arc->AddWildCardFiles(list, "*.*");
w.open_modal();
_arc->Create( list );
w.close_modal();
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",
_arc->mStatus.GetStatusString());
w.close_modal();
_arc->mStatus.GetStatusDetail());
delete _arc; _arc = NULL;
if (ok) ok = fsplit(work, floppy, desc);
remove(work);
xvt_fsys_restore_dir();
prefix().set(old);
@ -375,13 +376,13 @@ void TArchive::stop_job()
// TProgress_win implementation
///////////////////////////////////////////////////////////
TProgress_win::TProgress_win(const char* title, TArchive* _arc)
: TMask(title, 1, 60, 5)
TProgress_win::TProgress_win(const char* title, TArchive* arc)
: TMask(title, 1, 60, 5), _arc(arc)
{
WINDOW wtxt = add_string(101, 0, "", -11, 1, 56, "D");
WINDOW wnum = add_number(102, 0, "", -11, 2, 4, "D");
WINDOW wcan = add_button(DLG_CANCEL, 0, "", -11, 3, 10, 2);
set_handler(DLG_CANCEL, cancel_handler);
WINDOW wcan = add_button(DLG_USER, 0, "#102Cancel", -11, 3, 10, 2);
set_handler(DLG_USER, cancel_handler);
#if XVT_OS == XVT_OS_WIN
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 13 TO 24@ ALIAS 313 INTO COM=S5
END
PERMISSIONS
BEGIN
END
SECTION BODY ODD 66 0 0
SECTION BODY ODD 63 0 0
STRINGA 1
BEGIN