Patch level : 10.0

Files correlati     : tutti
Ricompilazione Demo : [ ]
Commento            :
Corretta gestione copia/incolla (da tastiera e da menu) in finestre multi-pagina


git-svn-id: svn://10.65.10.50/trunk@16817 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-06-26 09:46:51 +00:00
parent cb98b4b1fc
commit 3572128134
4 changed files with 90 additions and 97 deletions

View File

@ -3,10 +3,10 @@
#include <dongle.h>
#include <extcdecl.h>
#include <isam.h>
#include <mask.h>
#include <modaut.h>
#include <printer.h>
#include <progind.h>
#include <sheet.h>
#include <urldefid.h>
#include <utility.h>
@ -19,43 +19,20 @@
// Finestra informazioni
///////////////////////////////////////////////////////////
class TInfo_mask : public TMask
class TInfo_mask : public TArray_sheet
{
int _row, _col;
public:
void add_row(const char* prompt, const char* value);
void add_row(const char* prompt, unsigned long value);
TInfo_mask();
};
void TInfo_mask::add_row(const char* prompt, const char* value)
{
const int MASK_WIDTH = 78;
const int MASK_WIDTH2 = MASK_WIDTH/2;
const int PROMPT_WIDTH = 12;
TString val(value); val.trim();
const int len = val.len();
const int estim_len = 120 * (PROMPT_WIDTH + len) / 100;
if (_col + estim_len > MASK_WIDTH)
{
_row++;
_col = 1;
}
TString16 pr(prompt);
pr.left_just(PROMPT_WIDTH);
const short id = 101 + _row*10 + (_col > 1);
TEdit_field& e = add_string(id, 0, pr, _col, _row, len, "", len > 50 ? 50 : len);
e.set(value);
if (_col == 1)
_col = (estim_len+2 >= MASK_WIDTH2) ? MASK_WIDTH : MASK_WIDTH2;
else
_col = MASK_WIDTH;
TToken_string* r = new TToken_string;
r->add(prompt);
r->add(value);
add(r);
}
void TInfo_mask::add_row(const char* prompt, unsigned long value)
@ -65,24 +42,17 @@ void TInfo_mask::add_row(const char* prompt, unsigned long value)
}
TInfo_mask::TInfo_mask()
: TMask("Informazioni", 1, 72, 11, -1, -1), _row(0), _col(1)
: TArray_sheet(-1, -1, 78, 18, "Informazioni", "@16|@60")
{
const word ser_no = dongle().number();
//pezzo commentato per la 10.0!! NON eliminare!!!
/*int year = 2008, release = 10, tag = 0, patch = 1;
TString16 versione = "2008.10";
TString16 strpatch = "00.0001";*/
int year = 2008, release = 4, tag = 0, patch = 1;
TString16 versione = "2008.04";
TString16 strpatch = "00.0001";
int year = 2008, release = 10, tag = 0, patch = 1;
TString80 versione = "2008.10.00 Patch 0001";
if (main_app().get_version_info(year, release, tag, patch))
{
versione.format("%d.%02d", year, release);
strpatch.format("%02d.%04d", tag, patch);
}
versione.format("%d.%02d.%02d Patch %04d", year, release, tag, patch);
TString80 stros, strwx;
xvt_sys_get_version(stros.get_buffer(), strwx.get_buffer(), stros.size());
TString arg;
for (int a = 0; a < main_app().argc(); a++)
@ -93,7 +63,8 @@ TInfo_mask::TInfo_mask()
TConfig userini(CONFIG_GUI, "Printer");
TString prot;
switch (dongle().hardware())
const TDongleHardware dhw = dongle().hardware();
switch (dhw)
{
case _dongle_hardlock: prot = "Hardlock"; break;
case _dongle_eutron : prot = "Eutron"; break;
@ -101,53 +72,54 @@ TInfo_mask::TInfo_mask()
default : prot = TR("Nessuna"); break;
}
add_row(TR("Versione"), versione);
add_row(TR("Patch"), strpatch);
add_row(TR("N. di serie"), ser_no);
add_row(TR("Protezione"), prot);
add_row(TR("Assistenza"), dongle().year_assist());
add_row(TR("Utente"), user());
add_row(TR("Programma"), arg);
add_row(TR("Config"), campoini.name());
add_row(TR("Studio"), firm2dir(-1));
add_row(TR("Ditta"), campoini.get("Firm", "Main"));
const int type = campoini.get_int("Type");
TString tipo = TR("Postazione singola");
const char* tipo = NULL;
switch (type)
{
case 1:
break;
case 2:
tipo = TR("Server");
break;
case 3:
tipo = TR("Client");
break;
case 1: tipo = TR("Postazione singola"); break;
case 2: tipo = TR("Server"); break;
case 3: tipo = TR("Client"); break;
default:
if (campoini.get_bool("TestDatabase"))
{
const bool td = campoini.get_bool("TestDatabase");
const bool tp = campoini.get_bool("TestPrograms");
if (td && tp)
if (dhw == _dongle_network)
tipo = TR("Server");
if (!td)
tipo = TR("Client");
if (td && !tp)
else
tipo = TR("Server o Postazione singola");
}
else
tipo = TR("Client");
break;
}
TFilename temp;
temp.tempdir();
add_row(TR("Versione"), versione);
add_row(TR("Protezione"), prot);
add_row(TR("N. di serie"), ser_no);
add_row(TR("Assistenza"), dongle().year_assist());
add_row(TR("Installazione"), tipo);
add_row(TR("Sistema"), stros);
add_row(TR("Libreria"), strwx);
add_row(TR("Utente"), user());
add_row(TR("Studio"), firm2dir(-1));
add_row(TR("Ditta"), campoini.get("Firm", "Main"));
if (prefix_valid())
add_row(TR("Valuta"), TCurrency::get_firm_val());
{
const TFirm& f = prefix().firm();
add_row(TR("Ragione Sociale"), f.ragione_sociale());
add_row(TR("Valuta"), f.codice_valuta());
}
add_row(TR("Programma"), arg);
add_row(TR("Config locale"), campoini.name());
add_row(TR("Config utente"), userini.name());
add_row(TR("File temporanei"), temp);
add_row(TR("Spazio su disco"), xvt_fsys_get_disk_free_space(firm2dir(-1), 'M'));
add_row(TR("Stampante"), userini.get("Name", "Printer"));
add_row(TR("Mb su disco"), xvt_fsys_get_disk_free_space(firm2dir(-1), 'M'));
add_button(DLG_OK, 0, "", -11, -1, 10, 2);
}
///////////////////////////////////////////////////////////
// Metodi di accesso globali all'applicazione corrente
///////////////////////////////////////////////////////////
@ -291,7 +263,6 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
void TApplication::dispatch_e_menu(MENU_TAG tag)
{
// ::dispatch_e_menu(TASK_WIN, tag);
EVENT e; memset(&e, 0, sizeof(e));
e.type = E_COMMAND;
e.v.cmd.tag = tag;
@ -351,7 +322,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
{
WINDOW w = cur_win();
if (w != NULL_WIN && w != win)
dispatch_event(w, *ep, TRUE);
dispatch_event(w, *ep, true);
}
else
{

View File

@ -706,7 +706,15 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
if (notify_xvt && xiev->v.xvte.type != 0)
{
TWindow* w = (TWindow*)xi_get_app_data(itf);
if (w != NULL && w->win() != NULL_WIN)
WINDOW win = NULL_WIN;
if (w != NULL)
{
if (w->is_kind_of(CLASS_MASK))
win = ((TMask*)w)->curr_win();
else
win = w->win();
}
if (win != NULL_WIN)
{
switch (xiev->v.xvte.type)
{
@ -718,7 +726,7 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
case WC_CHECKBOX:
break; // Ignora i bottoni altrimenti li preme due volte se nativi
default:
w->handler(w->win(), &xiev->v.xvte);
w->handler(win, &xiev->v.xvte);
break;
}
break;
@ -726,7 +734,7 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
_button_blocked = false;
// fall down
default:
w->handler(w->win(), &xiev->v.xvte);
w->handler(win, &xiev->v.xvte);
break;
}
}

View File

@ -766,18 +766,18 @@ void TMask::on_button(short)
/* Non devo fare niente !!! non essendo una TWindow */
}
void TMask::handler(WINDOW win, EVENT* ep)
void TMask::handler(WINDOW w, EVENT* ep)
{
static TSheet_field* _last_sheet = NULL;
if (ep->type == E_MOUSE_DOWN && ep->v.mouse.button == 1)
{
_last_sheet = NULL;
win = curr_win();
w = curr_win();
for (int f = fields()-1; f >= 0; f--)
{
TMask_field& cur_fld = fld(f);
if (cur_fld.shown() && cur_fld.parent() == win)
if (cur_fld.shown() && cur_fld.parent() == w)
{
RCT rct; cur_fld.get_rect(rct);
if (xvt_rect_has_point(&rct, ep->v.mouse.where))
@ -797,23 +797,38 @@ void TMask::handler(WINDOW win, EVENT* ep)
if (menu != NULL)
{
const PNT& p = ep->v.mouse.where;
xvt_menu_popup(menu->child, win, p, XVT_POPUP_CENTER, 0); // verificare
xvt_menu_popup(menu->child, w, p, XVT_POPUP_CENTER, 0); // verificare
xvt_res_free_menu_tree(menu);
}
}
return;
}
if (ep->type == E_COMMAND && _last_sheet != NULL)
if (ep->type == E_COMMAND)
{
switch (ep->v.cmd.tag)
{
case BROWSE_BAR+1: _last_sheet->save_columns_order(); break;
case BROWSE_BAR+2: _last_sheet->reset_columns_order(); break;
case BROWSE_BAR+3: _last_sheet->on_key(K_F11); break;
case BROWSE_BAR+4: _last_sheet->esporta(); break;
default: break;
const int tag = ep->v.cmd.tag;
if (_last_sheet != NULL)
{
switch (tag)
{
case BROWSE_BAR+1: _last_sheet->save_columns_order(); break;
case BROWSE_BAR+2: _last_sheet->reset_columns_order(); break;
case BROWSE_BAR+3: _last_sheet->on_key(K_F11); break;
case BROWSE_BAR+4: _last_sheet->esporta(); break;
default: break;
}
return;
}
if (tag >= M_EDIT && tag <= M_EDIT_CLIPBOARD && notebook() != NULL_WIN)
{
static long _last_tag = 0;
const long curr_tag = w ^ tag;
if (curr_tag != _last_tag)
{
_last_tag = curr_tag;
xvt_win_post_event(curr_win(), ep);
}
return;
}
return;
}
if (ep->type == E_VSCROLL)
@ -868,7 +883,7 @@ void TMask::handler(WINDOW win, EVENT* ep)
return;
}
TWindow::handler(win, ep);
TWindow::handler(w, ep);
}

View File

@ -286,8 +286,7 @@ void dispatch_e_menu(
EVENT e; memset(&e, 0, sizeof(e));
e.type = E_COMMAND;
e.v.cmd.tag = item;
// xvt_win_post_event(win, &e);
dispatch_event(win, e, TRUE);
dispatch_event(win, e, true);
}
// @doc EXTERNAL