Nuova versione campi a video
git-svn-id: svn://10.65.10.50/trunk@2783 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
48be325130
commit
80b7a2bc86
@ -1,7 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <xvt.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
@ -21,6 +21,7 @@
|
||||
#include <relation.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <xvtility.h>
|
||||
|
||||
#include <bagn002.h>
|
||||
|
||||
@ -162,11 +163,13 @@ long XVT_CALLCONV1 TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
customize_controls(TRUE);
|
||||
create_backdrop();
|
||||
#if defined(DBG) && XVT_OS == XVT_OS_SCOUNIX
|
||||
message_box("Attach to process %d ...", getpid());
|
||||
#endif
|
||||
do_events();
|
||||
|
||||
break;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
case E_UPDATE:
|
||||
@ -481,8 +484,8 @@ void TApplication::run(
|
||||
cfg.taskwin_title = (char*)(const char*)caption;
|
||||
cfg.menu_bar_ID = TASK_MENUBAR+addbar;
|
||||
cfg.about_box_ID = 0;
|
||||
|
||||
customize_controls(TRUE);
|
||||
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
|
||||
|
||||
_application = this;
|
||||
xvt_app_create(argc, argv, 0L, task_eh, &cfg);
|
||||
@ -543,6 +546,17 @@ void TApplication::dispatch_e_menu(MENU_TAG item)
|
||||
#endif
|
||||
}
|
||||
|
||||
// @cmember Setta il cursore a clessidra (To be removed soon)
|
||||
void TApplication::begin_wait()
|
||||
{
|
||||
::begin_wait();
|
||||
}
|
||||
|
||||
// @cmember Setta il cursore standard (To be removed soon)
|
||||
void TApplication::end_wait()
|
||||
{
|
||||
::end_wait();
|
||||
}
|
||||
|
||||
bool TApplication::has_module(int module, int checktype) const
|
||||
{
|
||||
@ -647,7 +661,7 @@ bool TApplication::config()
|
||||
// carica campi
|
||||
for (int i = 0; i < m.fields(); i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
TEditable_field& f = (TEditable_field&)m.fld(i);
|
||||
const TFieldref* fref = f.field();
|
||||
if (fref != NULL)
|
||||
{
|
||||
@ -669,7 +683,7 @@ bool TApplication::config()
|
||||
// aggiusta campi
|
||||
for (i = 0; i < m.fields(); i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
TEditable_field& f = (TEditable_field&)m.fld(i);
|
||||
if (f.dirty())
|
||||
{
|
||||
const TFieldref* fref = f.field();
|
||||
@ -684,31 +698,6 @@ bool TApplication::config()
|
||||
return ok;
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
// @mfunc Cambia il cursore del mouse
|
||||
void TApplication::set_cursor(
|
||||
bool w) // @parm Indica il tipo di cursore da utilizzare:
|
||||
//
|
||||
// @flag TRUE | Cursore a clessidra per le wait
|
||||
// @flag FALSE | Cursore a frecca normale
|
||||
{
|
||||
static int _count = 0;
|
||||
|
||||
if (w)
|
||||
{
|
||||
if (_count == 0)
|
||||
xvt_win_set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||
_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_count--;
|
||||
CHECK(_count >= 0, "end_wait without matching begin_wait");
|
||||
if (_count == 0)
|
||||
xvt_win_set_cursor(TASK_WIN, CURSOR_ARROW);
|
||||
}
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Controlla se al programma corrente e' concesso cambiare ditta da menu.
|
||||
|
@ -173,11 +173,9 @@ public:
|
||||
{ return _waiting; }
|
||||
|
||||
// @cmember Setta il cursore a clessidra
|
||||
void begin_wait()
|
||||
{ set_cursor(TRUE); }
|
||||
void begin_wait();
|
||||
// @cmember Setta il cursore standard
|
||||
void end_wait()
|
||||
{ set_cursor(FALSE); }
|
||||
void end_wait();
|
||||
|
||||
// @cmember Interfaccia runtime del menu' della finestra principale???
|
||||
bool add_menu(TString_array& menu, MENU_TAG id = 0);
|
||||
|
@ -1,16 +1,15 @@
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <array.h>
|
||||
#include <strings.h>
|
||||
|
||||
void TContainer::for_each( OPERATION_FUNCTION op )
|
||||
{
|
||||
TObject* curr = first_item( );
|
||||
while( curr )
|
||||
TObject* curr = first_item();
|
||||
while(curr)
|
||||
{
|
||||
op( *curr );
|
||||
curr = succ_item( );
|
||||
op(*curr);
|
||||
curr = succ_item();
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,7 +165,7 @@ bool TArray::destroy(
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
for (int i = size(); i--;) if (_data[i] != NULL)
|
||||
for (int i = size()-1; i >= 0; i--) if (_data[i] != NULL)
|
||||
{
|
||||
delete _data[i];
|
||||
_data[i] = NULL;
|
||||
@ -183,16 +182,20 @@ bool TArray::destroy(
|
||||
}
|
||||
|
||||
|
||||
TArray::TArray(int arraysize) : _size(0), _items(0), _next(0), _data(NULL)
|
||||
TArray::TArray(int arraysize)
|
||||
: _size(0), _items(0), _next(0), _data(NULL)
|
||||
{
|
||||
if (arraysize) resize(arraysize);
|
||||
if (arraysize)
|
||||
resize(arraysize);
|
||||
}
|
||||
|
||||
TArray::TArray() : _size(0), _items(0), _next(0), _data(NULL)
|
||||
TArray::TArray()
|
||||
: _size(0), _items(0), _next(0), _data(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
TArray::TArray(const TArray& a) : _size(0), _items(0), _next(0), _data(NULL)
|
||||
TArray::TArray(const TArray& a)
|
||||
: _size(0), _items(0), _next(0), _data(NULL)
|
||||
{
|
||||
(*this) = a;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class TViswin;
|
||||
// dal testo ritornato
|
||||
typedef const char* (*MASK_LINKHANDLER)(TMask&, int, const char*, bool doubleclick);
|
||||
|
||||
class TBrowsefile_field : public TMask_field
|
||||
class TBrowsefile_field : public TOperable_field
|
||||
{
|
||||
friend class TViswin;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <brwapp.h>
|
||||
#include <mailbox.h>
|
||||
#include <utility.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TBrowse_application
|
||||
@ -90,17 +89,20 @@ bool TBrowse_application::main_loop()
|
||||
curr_mask().close_modal();
|
||||
|
||||
curr_mask().set_mode(NO_MODE);
|
||||
|
||||
if (recins > 0 && autoins_caller().not_empty())
|
||||
{
|
||||
TMessage msg(autoins_caller(), MSG_AI, format("%ld", recins));
|
||||
msg.send();
|
||||
|
||||
if (recins > 0)
|
||||
{
|
||||
TString16 ri; ri << recins;
|
||||
if (autoins_caller().not_empty())
|
||||
{
|
||||
TMessage msg(autoins_caller(), MSG_AI, ri);
|
||||
msg.send();
|
||||
}
|
||||
if (lnflag())
|
||||
{
|
||||
TMessage msg(autoins_caller(), MSG_LN, ri);
|
||||
msg.send();
|
||||
}
|
||||
}
|
||||
if (recins > 0 && lnflag())
|
||||
{
|
||||
TMessage msg(autoins_caller(), MSG_LN, format("%ld", recins));
|
||||
msg.send();
|
||||
}
|
||||
|
||||
return k != K_QUIT;
|
||||
}
|
||||
|
@ -66,11 +66,19 @@ extern "C" {
|
||||
//
|
||||
// @xref <m CHECKS> <m CHECK>
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @msg CHECKD | Macro che richiama una <m yesnofatal_box> per stampare messaggi d'errore a video
|
||||
#define NFCHECK yesnofatal_box
|
||||
|
||||
// @xref <m CHECKS> <m CHECK>
|
||||
|
||||
#else
|
||||
|
||||
#define CHECK(p, m)
|
||||
#define CHECKS(p, m, s)
|
||||
#define CHECKD(p, m, d)
|
||||
#define CHECKD(p, m, d)
|
||||
#define NFCHECK 1 ? 0 : yesnofatal_box
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -6,40 +6,49 @@
|
||||
// @END
|
||||
|
||||
// @M
|
||||
#define CLASS_OBJECT 1
|
||||
#define CLASS_ERROR 0
|
||||
#define CLASS_SORTABLE 2
|
||||
#define CLASS_ERROR 0
|
||||
#define CLASS_OBJECT 1
|
||||
#define CLASS_SORTABLE 2
|
||||
|
||||
#define CLASS_STRING 10
|
||||
#define CLASS_FIXED_STRING 11
|
||||
#define CLASS_FILENAME 12
|
||||
#define CLASS_TOKEN_STRING 13
|
||||
#define CLASS_STRING 10
|
||||
#define CLASS_FIXED_STRING 11
|
||||
#define CLASS_FILENAME 12
|
||||
#define CLASS_TOKEN_STRING 13
|
||||
|
||||
#define CLASS_APPLICATION 40
|
||||
#define CLASS_PRINT_APPLICATION 41
|
||||
#define CLASS_APPLICATION 20
|
||||
#define CLASS_RELATION_APPLICATION 21
|
||||
#define CLASS_PRINT_APPLICATION 22
|
||||
|
||||
#define CLASS_PRINTROW 50
|
||||
#define CLASS_PRINTER 51
|
||||
#define CLASS_PRINTER 50
|
||||
#define CLASS_PRINTROW 51
|
||||
|
||||
#define CLASS_CONTAINER 100
|
||||
#define CLASS_ARRAY 101
|
||||
#define CLASS_STACK 102
|
||||
#define CLASS_CONTAINER 100
|
||||
#define CLASS_ARRAY 101
|
||||
#define CLASS_STACK 102
|
||||
|
||||
#define CLASS_FIELD 20
|
||||
#define CLASS_EDIT_FIELD 21
|
||||
#define CLASS_REAL_FIELD 22
|
||||
#define CLASS_DATE_FIELD 23
|
||||
#define CLASS_BOOLEAN_FIELD 24
|
||||
#define CLASS_LIST_FIELD 25
|
||||
#define CLASS_RADIO_FIELD 26
|
||||
#define CLASS_BUTTON_FIELD 27
|
||||
#define CLASS_SHEET_FIELD 28
|
||||
#define CLASS_BROWSEFILE_FIELD 29
|
||||
#define CLASS_MEMO_FIELD 30
|
||||
#define CLASS_ZOOM_FIELD 31
|
||||
|
||||
#define CLASS_GOLEM 200
|
||||
#define CLASS_WINDOW 200
|
||||
#define CLASS_SHEET 201
|
||||
#define CLASS_MASK 210
|
||||
#define CLASS_FIELD 220
|
||||
#define CLASS_TEXT_FIELD 221
|
||||
#define CLASS_LINE_FIELD 222
|
||||
#define CLASS_RECTANGLE_FIELD 223
|
||||
#define CLASS_GROUPBOX_FIELD 224
|
||||
#define CLASS_OPERABLE_FIELD 230
|
||||
#define CLASS_BUTTON_FIELD 231
|
||||
#define CLASS_SHEET_FIELD 232
|
||||
#define CLASS_BROWSEFILE_FIELD 233
|
||||
#define CLASS_MEMO_FIELD 234
|
||||
#define CLASS_ZOOM_FIELD 235
|
||||
#define CLASS_EDITABLE_FIELD 240
|
||||
#define CLASS_BOOLEAN_FIELD 241
|
||||
#define CLASS_LIST_FIELD 242
|
||||
#define CLASS_RADIO_FIELD 243
|
||||
#define CLASS_EDIT_FIELD 244
|
||||
#define CLASS_REAL_FIELD 245
|
||||
#define CLASS_DATE_FIELD 246
|
||||
|
||||
#define CLASS_GOLEM 900
|
||||
|
||||
// @END
|
||||
#endif // __CLASSES_H
|
||||
|
@ -1,10 +1,7 @@
|
||||
#include <confapp.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <mask.h>
|
||||
#include <relation.h>
|
||||
|
||||
#define comunque
|
||||
#include <urldefid.h>
|
||||
|
||||
bool TConfig_application::create()
|
||||
{
|
||||
@ -69,20 +66,17 @@ void TConfig_application::do_config(int m)
|
||||
TMask m(maskname);
|
||||
|
||||
// carica campi
|
||||
for (int i = 0; i < m.fields(); i++)
|
||||
{
|
||||
const int max = m.fields();
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
const TFieldref* fref = f.field();
|
||||
if (fref != NULL)
|
||||
if (f.field() != NULL)
|
||||
{
|
||||
const char* fname = fref->name();
|
||||
if (fname != NULL)
|
||||
{
|
||||
TString& oldvl = cnf.get(fname);
|
||||
if (!oldvl.empty())
|
||||
f.set(oldvl);
|
||||
}
|
||||
}
|
||||
const char* fname = f.field()->name();
|
||||
TString& oldvl = cnf.get(fname);
|
||||
if (!oldvl.empty())
|
||||
f.set(oldvl);
|
||||
}
|
||||
}
|
||||
|
||||
// run mask
|
||||
@ -97,33 +91,29 @@ void TConfig_application::do_config(int m)
|
||||
if (k == K_ENTER || k == K_QUIT)
|
||||
{
|
||||
// aggiusta campi
|
||||
for (i = 0; i < m.fields(); i++)
|
||||
for (i = 0; i < max; i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
if (f.dirty())
|
||||
if (f.dirty() && f.field())
|
||||
{
|
||||
const TFieldref* fref = f.field();
|
||||
if (fref != NULL)
|
||||
{
|
||||
const char* fname = fref->name();
|
||||
const char* value = f.get();
|
||||
const char* oldvl = cnf.get(fname);
|
||||
const char* fname = f.field()->name();
|
||||
const char* value = f.get();
|
||||
const char* oldvl = cnf.get(fname);
|
||||
|
||||
if (!tosave)
|
||||
tosave = yesno_box("Modifiche non registrate. Salvare?");
|
||||
if (!tosave)
|
||||
tosave = yesno_box("Modifiche non registrate. Salvare?");
|
||||
|
||||
if (!tosave) break;
|
||||
if (!tosave) break;
|
||||
|
||||
if (postprocess_config_changed(par,fname, oldvl,value))
|
||||
cnf.set(fname, value, NULL, TRUE);
|
||||
}
|
||||
if (postprocess_config_changed(par, fname, oldvl, value))
|
||||
cnf.set(fname, value, NULL, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else break;
|
||||
}
|
||||
if (k == K_QUIT)
|
||||
break comunque;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -90,14 +90,14 @@ void TConfig::_write_file()
|
||||
temp.temp("cnf");
|
||||
ofstream out(temp);
|
||||
|
||||
TFixed_string l(__tmp_string, sizeof(__tmp_string));
|
||||
TString80 cnf; cnf << '[' << _paragraph << ']';
|
||||
TString l(256);
|
||||
TString cnf(16); cnf << '[' << _paragraph << ']';
|
||||
|
||||
bool skip = FALSE, done = FALSE;
|
||||
|
||||
while (!in.eof())
|
||||
{
|
||||
in.getline(__tmp_string,sizeof(__tmp_string)-1);
|
||||
in.getline((char*)(const char*)l, l.size());
|
||||
l.trim();
|
||||
|
||||
if (cnf == l)
|
||||
@ -232,7 +232,10 @@ long TConfig::get_long(
|
||||
if (*n)
|
||||
def = atol(n);
|
||||
else
|
||||
set(var, format("%ld", def), section, TRUE, index);
|
||||
{
|
||||
TString16 d; d << def;
|
||||
set(var, d, section, TRUE, index);
|
||||
}
|
||||
return def;
|
||||
|
||||
}
|
||||
@ -261,8 +264,11 @@ char TConfig::get_char(
|
||||
const char* n = get(var,section,index);
|
||||
if (*n)
|
||||
def = *n;
|
||||
else
|
||||
set(var, format("%c", def), section, TRUE, index);
|
||||
else
|
||||
{
|
||||
const char d[2] = { def, '\0' };
|
||||
set(var, d, section, TRUE, index);
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
@ -314,11 +320,9 @@ bool TConfig::get_bool(
|
||||
//
|
||||
// @xref <mf TConfig::get> <mf TConfig::get_long> <mf TConfig::get_int>
|
||||
// <mf TConfig::get_color>
|
||||
{
|
||||
if (def) strcpy(__tmp_string, "X");
|
||||
else *__tmp_string = '\0';
|
||||
|
||||
const TString& s = get(var, section, index, __tmp_string).upper();
|
||||
{
|
||||
const TString16 d(def ? "X" : "");
|
||||
const TString& s = get(var, section, index, d).upper();
|
||||
return s != "" && (s == "X" || s == "ON" || s == "YES" || s == "OK" || s == "TRUE");
|
||||
}
|
||||
|
||||
@ -359,7 +363,8 @@ COLOR TConfig::get_color(
|
||||
else
|
||||
{
|
||||
int r, g, b; RGB_COLOR(def, r, g, b);
|
||||
set(var, format("%d,%d,%d", r, g, b), section, TRUE, index);
|
||||
TString16 d; d << r << ',' << g << ',' << b;
|
||||
set(var, d, section, TRUE, index);
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
2593
include/controls.cpp
2593
include/controls.cpp
File diff suppressed because it is too large
Load Diff
@ -5,47 +5,23 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
WINDOW xvt_create_checkbox(
|
||||
short left, short top, short right, short bottom,
|
||||
const char* caption,
|
||||
WINDOW parent,
|
||||
long flags,
|
||||
long app_data,
|
||||
int id);
|
||||
class TWindow; // __WINDOW_H
|
||||
class TMask_field; // __MASKFLD_H
|
||||
|
||||
WINDOW xvt_create_radiobutton(
|
||||
short left, short top, short right, short bottom,
|
||||
const char* caption,
|
||||
WINDOW parent,
|
||||
long flags,
|
||||
long app_data,
|
||||
int id);
|
||||
#ifndef INCL_XI
|
||||
#define XI_INTERNAL
|
||||
#include <xi.h>
|
||||
#endif
|
||||
|
||||
WINDOW xvt_create_pushbutton(
|
||||
short left, short top, short right, short bottom,
|
||||
const char* caption,
|
||||
WINDOW parent,
|
||||
long flags,
|
||||
long app_data,
|
||||
int id);
|
||||
void init_controls();
|
||||
void free_controls();
|
||||
XVT_FNTID xvt_default_font(bool bold = FALSE);
|
||||
|
||||
WINDOW xvt_create_text(
|
||||
short left, short top, short right, short bottom,
|
||||
const char* caption,
|
||||
WINDOW parent,
|
||||
long flags,
|
||||
long app_data,
|
||||
int id);
|
||||
WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
const char* caption, TWindow* mask, bool tags);
|
||||
|
||||
WINDOW xvt_create_groupbox(
|
||||
short left, short top, short right, short bottom,
|
||||
const char* caption,
|
||||
WINDOW parent,
|
||||
long flags,
|
||||
long app_data,
|
||||
int id);
|
||||
void attach_interface(WINDOW win, COLOR back = COLOR_WHITE);
|
||||
|
||||
void free_controls_bmp();
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Custom control
|
||||
@ -53,107 +29,297 @@ void free_controls_bmp();
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @class TControl | Classe per la creazione di controlli personalizzati
|
||||
class TControl
|
||||
// @class TControl | Classe per la creazione di controlli
|
||||
class TControl : public TObject
|
||||
// @author:(INTERNAL) Guido
|
||||
|
||||
// @access:(INTERNAL) Private Member
|
||||
{
|
||||
// @cmember:(INTERNAL) Handle del controllo creato
|
||||
WINDOW _win;
|
||||
// @cmember:(INTERNAL) Iedntificatore assegnato al cotrollo
|
||||
short _id;
|
||||
// @cmember:(INTERNAL) Prompt del controllo
|
||||
TString _caption;
|
||||
// @cmember:(INTERNAL) Colore di foreground del controllo
|
||||
COLOR _color;
|
||||
// @cmember:(INTERNAL) Colore di background del controllo
|
||||
COLOR _backcolor;
|
||||
|
||||
// @cmember:(INTERNAL) Indica se il controllo e' disabilitato
|
||||
bool _disabled : 1;
|
||||
// @cmember:(INTERNAL) Indica se il controllo ha un check
|
||||
bool _checked : 1;
|
||||
// @cmember:(INTERNAL) Indica se il controllo ha il focus
|
||||
bool _focused : 1;
|
||||
// @cmember:(INTERNAL) Indica varie cose a seconda del tipo di controllo she si sta utilizzando
|
||||
bool _multiple : 1;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember E' l'handler del controllo
|
||||
static long XVT_CALLCONV1 handler(WINDOW win, EVENT* ep);
|
||||
// @cmember:(INTERNAL) Puntatore al controllo creato
|
||||
XI_OBJ* _obj;
|
||||
|
||||
// @cmember Crea il controllo
|
||||
void create(short left, short top, short right, short bottom, const char* caption, WINDOW parent, long flags, long app_data, short id);
|
||||
// @cmember:(INTERNAL) Puntatore al TMask_field eventualmente associato
|
||||
TMask_field* _fld;
|
||||
|
||||
// @cmember Ridisegna il controllo a video
|
||||
virtual void update() const pure;
|
||||
// @cmember Chiamate ogni volta che viene premuto il mouse sul controllo
|
||||
virtual void mouse_down(PNT)
|
||||
{};
|
||||
// @cmember Chiamate ogni volta che viene rialsciato il mouse sul controllo
|
||||
virtual void mouse_up()
|
||||
{};
|
||||
// @cmember Ritorna il tipo di finestra su cui si trova il controllo
|
||||
virtual WIN_TYPE type() const
|
||||
{ return W_NO_BORDER; }
|
||||
// @cmember Ricava l'interfaccia da una finestra
|
||||
XI_OBJ* get_interface(WINDOW win = NULL_WIN) const;
|
||||
|
||||
// @cmember Cerca un controllo operabile (in avanti o all'indietro)
|
||||
TControl& find_operable_ctl(bool forward) const;
|
||||
|
||||
// @cmember Setta l'identificatore del prossimo controllo per il tasto TAB
|
||||
void set_tab_cid(short id);
|
||||
|
||||
void coord2rct(WINDOW win, short left, short top, short width, short height, RCT& rct) const;
|
||||
unsigned long flags2attr(const char* flags) const;
|
||||
void update_tab_cid();
|
||||
const char* parse_caption(const char* cap, bool& bold, COLOR& color) const;
|
||||
|
||||
void change_attrib(unsigned long attr, bool on, XI_OBJ* obj = NULL);
|
||||
|
||||
bool notify_key(KEY k);
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Ritorna il TControl dalla finestra del controllo
|
||||
static TControl* WINDOW2TControl(WINDOW win);
|
||||
// @cmember Distruttore. Necessariamente virtuale per derivare altri distruttori
|
||||
TControl();
|
||||
virtual ~TControl();
|
||||
|
||||
static KEY xiev_to_key(const XI_EVENT* xiev);
|
||||
|
||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* ep);
|
||||
|
||||
bool is_edit_key(KEY k) const;
|
||||
|
||||
// @cmember Ritorna l'handle del controllo
|
||||
WINDOW win() const
|
||||
{ return _win; }
|
||||
// @cmember Ritorna l'identificatore assegnato al controllo
|
||||
short id() const
|
||||
{ return _id; }
|
||||
short id() const { return _obj->cid; }
|
||||
WINDOW parent() const;
|
||||
|
||||
XI_OBJ_TYPE type() const { return _obj->type; }
|
||||
|
||||
// @cmember Ritorna il prompt del controllo
|
||||
const char* caption() const
|
||||
{ return _caption; }
|
||||
const char* caption() const;
|
||||
// @cmember Setta il prompt del controllo
|
||||
void set_caption(const char* c);
|
||||
virtual void set_caption(const char* c);
|
||||
|
||||
// @cmember Ritorna il colore di forground del controllo
|
||||
COLOR color() const
|
||||
{ return _color; }
|
||||
// @cmember Setta il colore di forground del controllo
|
||||
void set_color(COLOR c)
|
||||
{ _color = c; }
|
||||
|
||||
// @cmember Ritorna il colore di background del controllo
|
||||
COLOR back_color() const
|
||||
{ return _backcolor; }
|
||||
// @cmember Setta il colore di background del controllo
|
||||
void set_back_color(COLOR c)
|
||||
{ _backcolor = c; }
|
||||
|
||||
// @cmember Ritorna se il controllo possiede un check
|
||||
bool checked() const
|
||||
{ return _checked; }
|
||||
// @cmember Setta se il controllo debba avere un check
|
||||
virtual void check(bool on);
|
||||
|
||||
// @cmember Ritorna se il controllo e' disabilitato
|
||||
bool disabled() const
|
||||
{ return _disabled; }
|
||||
// @cmember Abilita/disabilita il controllo
|
||||
void enable(bool on);
|
||||
|
||||
// @cmember Ritorna se il controllo ha il focus
|
||||
bool focused() const
|
||||
{ return _focused; }
|
||||
// @cmember Setta il focus sul cursore (stessa sintassi di <mf TCursor::enable>)
|
||||
void focus(bool on)
|
||||
{ _focused = on; }
|
||||
|
||||
// @cmember Ritorna il contenuto della variabile <md TControl::_multiple>
|
||||
bool multiple() const
|
||||
{ return _multiple; }
|
||||
virtual void enable(bool on = TRUE);
|
||||
void disable() { enable(FALSE); }
|
||||
|
||||
// @cmember Mostra/nasconde il controllo
|
||||
virtual void show(bool on = TRUE);
|
||||
void hide() { show(FALSE); }
|
||||
|
||||
void autoselect(bool on);
|
||||
|
||||
// @cmember Forza il focus al controllo
|
||||
virtual void set_focus() const;
|
||||
|
||||
RCT& get_rect(RCT& r) const;
|
||||
virtual void set_rect(const RCT& r);
|
||||
|
||||
bool on_key(KEY k);
|
||||
};
|
||||
|
||||
|
||||
class TText_control : public TControl
|
||||
{
|
||||
public: // TControl
|
||||
virtual void set_caption(const char* text);
|
||||
|
||||
public:
|
||||
TText_control(WINDOW win, short cid,
|
||||
short left, short top, short width, short height,
|
||||
const char* flags, const char* text);
|
||||
virtual ~TText_control() {}
|
||||
};
|
||||
|
||||
|
||||
class TGroupbox_control : public TText_control
|
||||
{
|
||||
XI_OBJ* _rct; // Rettangolo del gruppo
|
||||
|
||||
public: // TControl
|
||||
virtual void show(bool on);
|
||||
|
||||
public:
|
||||
TGroupbox_control(WINDOW win, short cid,
|
||||
short left, short top, short width, short height,
|
||||
const char* flags, const char* text);
|
||||
virtual ~TGroupbox_control() {}
|
||||
};
|
||||
|
||||
class TField_control : public TControl
|
||||
{
|
||||
protected:
|
||||
bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||
|
||||
void create(WINDOW win, short cid,
|
||||
short left, short top,
|
||||
short width, short height, short maxlen,
|
||||
const char* flags, const char* text, bool button);
|
||||
|
||||
TField_control() {}
|
||||
|
||||
public:
|
||||
// @cmember Mostra o nasconde il bottone associato
|
||||
void show_button(bool on);
|
||||
|
||||
// @cmember Forza il focus al controllo
|
||||
virtual void set_focus() const;
|
||||
|
||||
TField_control(WINDOW win, short cid,
|
||||
short left, short top,
|
||||
short width, short maxlen,
|
||||
const char* flags, const char* text);
|
||||
virtual ~TField_control() {}
|
||||
};
|
||||
|
||||
class TMultiline_control : public TField_control
|
||||
{
|
||||
public:
|
||||
TMultiline_control(WINDOW win, short cid,
|
||||
short left, short top,
|
||||
short width, short height, short maxlen,
|
||||
const char* flags, const char* text);
|
||||
virtual ~TMultiline_control() {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TButton_control : public TControl
|
||||
{
|
||||
protected:
|
||||
void create(WINDOW win, short cid,
|
||||
short left, short top, short width, short height,
|
||||
const char* flags, const char* text,
|
||||
WIN_TYPE wc, XI_OBJ* container);
|
||||
|
||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* ep);
|
||||
|
||||
public:
|
||||
virtual void set_rect(const RCT& r);
|
||||
|
||||
bool checked() const;
|
||||
void check(bool on = TRUE);
|
||||
void uncheck() { check(FALSE); }
|
||||
bool toggle();
|
||||
|
||||
XI_BTN_TYPE button_type() const;
|
||||
XI_OBJ* container() const;
|
||||
|
||||
TButton_control() {}
|
||||
virtual ~TButton_control() {}
|
||||
};
|
||||
|
||||
class TPushbutton_control : public TButton_control
|
||||
{
|
||||
short _bmp_up, _bmp_dn;
|
||||
|
||||
protected:
|
||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||
|
||||
public:
|
||||
virtual void update();
|
||||
|
||||
void set_bmp(short up, short dn);
|
||||
|
||||
TPushbutton_control(WINDOW win, short cid,
|
||||
short left, short top, short width, short height,
|
||||
const char* flags, const char* text,
|
||||
short bmp_up = 0, short _bmp_dn = 0);
|
||||
virtual ~TPushbutton_control() {}
|
||||
};
|
||||
|
||||
class TRadiobutton_control : public TButton_control
|
||||
{
|
||||
protected: // TControl
|
||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||
virtual void set_focus() const;
|
||||
|
||||
protected:
|
||||
TRadiobutton_control() { } // To be derived
|
||||
|
||||
public:
|
||||
// @cmember Abilita/disabilita il controllo
|
||||
virtual void enable(bool on = TRUE);
|
||||
// @cmember Mostra/nasconde il controllo
|
||||
virtual void show(bool on = TRUE);
|
||||
|
||||
byte get_checked() const;
|
||||
void check_button(byte b);
|
||||
|
||||
void show_button(byte b, bool on = TRUE);
|
||||
void hide_button(byte b) { show_button(b, FALSE); }
|
||||
|
||||
TRadiobutton_control(WINDOW win, short cid,
|
||||
short left, short top, short width, short height,
|
||||
const char* flags, const char* text);
|
||||
virtual ~TRadiobutton_control() {}
|
||||
};
|
||||
|
||||
class TTagbutton_control : public TRadiobutton_control
|
||||
{
|
||||
protected: // TControl
|
||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||
|
||||
public:
|
||||
TTagbutton_control(WINDOW win, short cid,
|
||||
short left, short top, short width, short height,
|
||||
const char* flags, const char* text, int tag);
|
||||
virtual ~TTagbutton_control() {}
|
||||
};
|
||||
|
||||
|
||||
class TCheckbox_control : public TButton_control
|
||||
{
|
||||
public:
|
||||
TCheckbox_control(WINDOW win, short cid,
|
||||
short left, short top, short width,
|
||||
const char* flags, const char* text);
|
||||
virtual ~TCheckbox_control() {}
|
||||
};
|
||||
|
||||
class TDropDownList : public TObject
|
||||
{
|
||||
|
||||
XI_OBJ* _xi_obj;
|
||||
XI_OBJ* _xi_lst;
|
||||
TToken_string _values;
|
||||
int _selected;
|
||||
int _width;
|
||||
bool _open;
|
||||
bool _displayed;
|
||||
bool _in_cell;
|
||||
|
||||
static void ddl_str_eh (XI_OBJ* itf, XI_EVENT* xiev);
|
||||
|
||||
public:
|
||||
|
||||
const int selected() const { return _selected; }
|
||||
void select_by_initial(char c);
|
||||
void open();
|
||||
void close();
|
||||
bool is_open() { return _open; }
|
||||
bool displayed() { return _displayed; }
|
||||
|
||||
const char* item(int i) { return _values.get(i); }
|
||||
int items() const { return _values.items(); }
|
||||
long row2rec(int) const;
|
||||
int rec2row(long rec) const;
|
||||
void select(int i, bool force = FALSE);
|
||||
void set_values(const char* v) { _values = v; _selected = 0; }
|
||||
|
||||
TDropDownList(XI_OBJ* o, const char* values, int wid, bool cell = FALSE);
|
||||
virtual ~TDropDownList() {}
|
||||
};
|
||||
|
||||
class TListbox_control : public TField_control
|
||||
{
|
||||
friend class TDropDownList;
|
||||
TDropDownList* _ddl;
|
||||
TToken_string _values;
|
||||
void drop_down();
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||
|
||||
public:
|
||||
|
||||
void set_values(const char* c);
|
||||
int selected() const;
|
||||
int items() const { return _values.items(); }
|
||||
void select(int i);
|
||||
|
||||
TListbox_control(WINDOW win, short cid,
|
||||
short left, short top, short width,
|
||||
const char* flags, const char* text, const char* values);
|
||||
virtual ~TListbox_control();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@ SUBMENU M_EDIT "~Edit"
|
||||
|
||||
MENU MENU_VISWIN
|
||||
ITEM M_EDIT_CLIPBOARD "Interrompi\tESC"
|
||||
ITEM M_EDIT_CUT "~Collega...\tCtrl+C" DISABLED
|
||||
ITEM M_EDIT_CUT "Colle~ga...\tCtrl+G" DISABLED
|
||||
ITEM M_EDIT_PASTE "~Esporta...\tCtrl+E"
|
||||
ITEM M_EDIT_SEL_ALL "~Stampa... \tCtrl+S" DISABLED
|
||||
SEPARATOR
|
||||
|
@ -29,8 +29,8 @@
|
||||
#define DLG_PRINT 24 /* TAG del bottone Stampa */
|
||||
#define DLG_SETPRINT 25 /* TAG del bottone Imposta Stampa */
|
||||
#define DLG_RECALC 26 /* TAG del bottone Ricalcola */
|
||||
#define DLG_F8 27 /* TAG del bottone <Ricerca zoom> */
|
||||
#define DLG_USER 100 /* TAG del primo controllo definito dall'utente */
|
||||
#define DLG_F8 27 /* TAG del bottone <Ricerca> */
|
||||
|
||||
/* @M
|
||||
Funzioni di libreria per i validate delle maschere
|
||||
|
@ -310,22 +310,19 @@ TTrec::~TTrec ()
|
||||
delete _rec;
|
||||
}
|
||||
|
||||
int TTrec ::compare (const TSortable & a) const
|
||||
|
||||
int TTrec::compare(const TSortable & a) const
|
||||
{
|
||||
const TTrec & r = (const TTrec &) a;
|
||||
const int res = memcmp ((const void *) _rec, (const void *) r._rec, sizeof (*_rec));
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
void TTrec::rehash ()
|
||||
|
||||
void TTrec::rehash()
|
||||
{
|
||||
setrdes (_rec);
|
||||
}
|
||||
|
||||
TTrec & TTrec::operator = (const TTrec & b)
|
||||
|
||||
{
|
||||
_num = b._num;
|
||||
memcpy (_rec, b._rec, sizeof (*_rec));
|
||||
|
@ -1383,7 +1383,7 @@ bool TForm_string::read()
|
||||
const TRelation* r = form().relation();
|
||||
CHECK(r, "Can't read from null relation");
|
||||
for (int i = 0; i < _field.items() && *s == '\0'; i++)
|
||||
s = field(i).read(r);
|
||||
s = field(i).read(*r);
|
||||
set(s);
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ bool TGolem::import()
|
||||
correct = fcopy(from, path(TRUE));
|
||||
if (correct)
|
||||
{
|
||||
msk.autosave(_golem);
|
||||
msk.autosave(*_golem);
|
||||
int err = _golem->write();
|
||||
if (err == _isreinsert)
|
||||
err = _golem->rewrite();
|
||||
|
@ -3055,7 +3055,7 @@ void TRecfield::set(int from, int to)
|
||||
CHECK(from >= 0, "Invalid Start");
|
||||
_p = _rec->string() + rd->Fd[nf].RecOff + from;
|
||||
_dec = rd->Fd[nf].Dec;
|
||||
_type = rd->Fd[nf].TypeF;
|
||||
_type = (TFieldtypes)rd->Fd[nf].TypeF;
|
||||
if (to >= 0)
|
||||
{
|
||||
CHECK(from <= to && to <= rd->Fd[nf].Len, "Invalid Range");
|
||||
@ -3314,8 +3314,11 @@ TRecfield::operator TDate() const
|
||||
|
||||
|
||||
TRecfield::operator const char*() const
|
||||
{
|
||||
__getfieldbuff( _len, _type, _p, _isam_string);
|
||||
{
|
||||
if (_type == _memofld)
|
||||
return _rec->get(_name);
|
||||
|
||||
__getfieldbuff(_len, _type, _p, _isam_string);
|
||||
return _isam_string;
|
||||
}
|
||||
|
||||
|
@ -658,7 +658,7 @@ class TSystemisamfile : public TIsamfile
|
||||
// @cmember:(INTERNAL) Esegue la conversione del file
|
||||
bool exec_convapp(long flev, const bool before);
|
||||
// @cmember:(INTERNAL) Esegue la conversione sui record del file (utilizzando le espressione definite
|
||||
// in fconv.ini)
|
||||
// in fconv.ini)
|
||||
void makelc(TRectype& rec);
|
||||
|
||||
// @access Public Member
|
||||
@ -806,7 +806,7 @@ class TRecfield : public TObject
|
||||
// @cmember:(INTERNAL) Numero di decimali del campo
|
||||
byte _dec;
|
||||
// @cmember:(INTERNAL) Tipo del campo
|
||||
byte _type;
|
||||
TFieldtypes _type;
|
||||
|
||||
// @cmember:(INTERNAL) Setta il campo <p to>-esimo con i valori di <p from>-esimo
|
||||
void set(int from, int to);
|
||||
|
1363
include/mask.cpp
1363
include/mask.cpp
File diff suppressed because it is too large
Load Diff
175
include/mask.h
175
include/mask.h
@ -22,12 +22,11 @@ typedef bool (*MASK_HANDLER)(TMask& mask, KEY key);
|
||||
// @enum Modalita' di utilizzo della maschera corrente
|
||||
enum TMaskmode {
|
||||
NO_MODE, // @emem Nessun modo
|
||||
MODE_INS , // @emem Modalita' di inserimento dati
|
||||
MODE_MOD , // @emem Modalita' di modifca dati
|
||||
MODE_VIS , // @emem Modalita' di visualizzaione dati
|
||||
MODE_QUERY, // @emem Modalita' di richiesta chiave
|
||||
MODE_QUERYINS }; // @emem Modalita' di richiesta chiave e inserimento dati
|
||||
|
||||
MODE_QUERYINS, // @emem Modalita' di richiesta chiave e inserimento dati
|
||||
MODE_INS , // @emem Modalita' di inserimento dati
|
||||
MODE_MOD // @emem Modalita' di modifca dati
|
||||
};
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
@ -37,18 +36,19 @@ enum TMaskmode {
|
||||
class TMask : public TWindow
|
||||
{
|
||||
// @author:(INTERNAL) Guido
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
|
||||
// @ccost:(INTERNAL) MAX_PAGES | 16 | Massimo numero di pagine nella maschera
|
||||
enum { MAX_PAGES = 16 };
|
||||
|
||||
// @access:(INTERNAL) Private Member
|
||||
private:
|
||||
|
||||
// @ccost:(INTERNAL) MAX_PAGES | 12 | Massimo numero di pagine nella maschera
|
||||
enum { MAX_PAGES = 12 };
|
||||
// @cmember:(INTERNAL) Windows delle pagine
|
||||
WINDOW _pagewin[MAX_PAGES+1];
|
||||
// @cmember:(INTERNAL) Windows per pgup/pgdn
|
||||
WINDOW _pagepag[MAX_PAGES];
|
||||
// @cmember:(INTERNAL) Windows di numeri pagina
|
||||
WINDOW _pagetag[MAX_PAGES];
|
||||
|
||||
|
||||
// @cmember:(INTERNAL) Numero di pagine della maschera
|
||||
int _pages;
|
||||
// @cmember:(INTERNAL) Pagina corrente
|
||||
@ -63,13 +63,9 @@ class TMask : public TWindow
|
||||
|
||||
// @cmember:(INTERNAL) Primo controllo che deve ricevere il focus
|
||||
int _first_focus;
|
||||
// @cmember:(INTERNAL) Controllo che possiede il focus
|
||||
|
||||
int _focus;
|
||||
// @cmember:(INTERNAL) Controllo che deve ricevere il focus
|
||||
int _next_fld;
|
||||
|
||||
// @cmember:(INTERNAL) Numero di sheet contenuti nella maschera
|
||||
int _sheets;
|
||||
// @cmember:(INTERNAL) Puntatore allo sheet che contiene la maschera (puo' essere NULL)
|
||||
TSheet_field* _sheet;
|
||||
|
||||
@ -80,7 +76,6 @@ class TMask : public TWindow
|
||||
TFilename _source_file;
|
||||
// @cmember:(INTERNAL) Nome del file di salvataggio in cui sono scaricati i valori della maschera
|
||||
TFilename _workfile;
|
||||
|
||||
// @cmember:(INTERNAL) Ultimo offset letto nel file di salvataggio
|
||||
long _lastpos;
|
||||
|
||||
@ -88,6 +83,9 @@ class TMask : public TWindow
|
||||
real _exchange;
|
||||
// @cmember:(INTERNAL) Controlla se la maschera deve fare i controlli iniziali di validita' dei campi
|
||||
bool _should_check;
|
||||
|
||||
int _error_severity;
|
||||
TString _error_message;
|
||||
|
||||
// @cmember:(INTERNAL) Tempo totale di caricamento della maschera
|
||||
long _total_time;
|
||||
@ -96,17 +94,17 @@ class TMask : public TWindow
|
||||
// @cmember:(INTERNAL) Tempo di inizializzazione della maschera
|
||||
long _init_time;
|
||||
|
||||
// @cmember:(INTERNAL) numeri pagina
|
||||
TArray _pagetag;
|
||||
|
||||
// @cmember:(INTERNAL) identificatore del campo da testare per l'autopremimento
|
||||
short _test_fld;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Ritorna la finestra della pagina corrente (Usare con attenzione)
|
||||
WINDOW win() const
|
||||
{ return _page < 0 ? _pagewin[0] : _pagewin[_page]; }
|
||||
|
||||
// @cmember Ritorna il numero di campi nella finestra
|
||||
int find_field_win(WINDOW win) const;
|
||||
|
||||
// @cmember Aggiorna i controlli a video con i valori iniziali della maschera
|
||||
void set_mask_fields() const;
|
||||
// @cmember:(INTERNAL) Numero di sheet contenuti nella maschera
|
||||
int _sheets;
|
||||
|
||||
// @cmember Legge i controlli relativi ad un campo
|
||||
void load_checks() const;
|
||||
@ -121,65 +119,75 @@ protected:
|
||||
WINDOW read_page(TScanner& scanner, bool toolbar = FALSE);
|
||||
// @cmember Legge la maschera da file
|
||||
void read_mask(const char* name, int num, int max);
|
||||
// @cmember Permette di aggiungere sulla maschera tutti i bottoni per la
|
||||
// navigazione tra le pagine
|
||||
void add_buttons();
|
||||
|
||||
// @cmember Aggiunge i tags ad una pagina
|
||||
void add_tag_button(byte pag, TToken_string& tags, byte sel);
|
||||
|
||||
// @cmember Aggiunge alla maschera tutti i bottoni per la navigazione tra le pagine
|
||||
void add_tag_buttons(TToken_string& tags);
|
||||
|
||||
// @cmember Ritorna il numero del primo campo attivo della pagina con finestra <p w>
|
||||
int find_first_active(WINDOW w) const;
|
||||
// @cmember Ritorna il numero della finestra padre del campo <p f>
|
||||
int find_parent_page(const TMask_field& f) const;
|
||||
// @cmember Ritorna la posizione del primo campo attivo nella direzione specificata
|
||||
int find_first_field(WINDOW w, int dir) const;
|
||||
// @cmember Ritorna il prossimo campo attivabile
|
||||
int find_active_field(int first, int dir) const;
|
||||
// @cmember Controlla tutti i campi della pagina corrente
|
||||
bool check_current_page();
|
||||
// @cmember Esegue i check del campo corrente
|
||||
bool check_current_field() const;
|
||||
// @cmember Mostra la prossima/precedente pagina
|
||||
void next_page(int p);
|
||||
// @cmember Ritorna il numero della pagina corrente
|
||||
int curr_page() const
|
||||
{ return _page; }
|
||||
|
||||
// @cmember Controlla se e' possibile dare il focus alla finestra <p next> (TRUE se possibile)
|
||||
bool test_focus_change(WINDOW next = NULL_WIN);
|
||||
// @cmember Funzione chiamata ogni volta che arriva un evento e lo gestisce
|
||||
void control_handler(EVENT* ep);
|
||||
// @cmember Gestisce gli eventi XVT diretti alla pagina corrente della maschera
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
// @cmember Costruttore (crea una maschera vuota\)
|
||||
TMask() { init_mask();}
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Costruttore (crea la maschera leggendo la descrizione dal file .msk)
|
||||
TMask(const char* name, int num = 0, int max = MAX_PAGES);
|
||||
TMask(const char* title, int num = 0, int max = MAX_PAGES);
|
||||
// @cmember Costruttore (crea una maschera vuota con i parametri dati)
|
||||
TMask(const char* title, int pages, int cols, int rows, int xpos = -1, int ypos = -1);
|
||||
|
||||
// @cmember Distruttore
|
||||
virtual ~TMask();
|
||||
|
||||
// @cmember Ritorna l'identificatore della classe maschera
|
||||
virtual word class_id() const;
|
||||
|
||||
// @cmember Ritorna TRUE se la maschera deriva dalla classe <p c>
|
||||
virtual bool is_kind_of(word c) const;
|
||||
|
||||
// @cmember Ritorna la finestra della pagina corrente (Usare con attenzione)
|
||||
WINDOW win() const
|
||||
{ return _page < 0 ? _pagewin[0] : _pagewin[_page]; }
|
||||
|
||||
// @cmember Ritorna il nome del file contentente la maschera
|
||||
const TFilename& source_file() const
|
||||
{ return _source_file; }
|
||||
|
||||
// @cmember Aggiunge alla maschera tutti i bottoni Pag. n
|
||||
void add_default_tag_buttons();
|
||||
|
||||
// @cmember Aggiunge runtime un campo testo alla maschera
|
||||
WINDOW add_static (short id, int page, const char* prompt, int x, int y, const char* flags = "");
|
||||
TMask_field& add_static (short id, int page, const char* prompt, int x, int y, const char* flags = "");
|
||||
// @cmember Aggiunge runtime un campo stringa alla maschera
|
||||
WINDOW add_string (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", int width = 0);
|
||||
TEdit_field& add_string (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", int width = 0);
|
||||
|
||||
// @cmember Aggiunge runtime un campo numerico alla maschera
|
||||
WINDOW add_number (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", int ndec = 0);
|
||||
TReal_field& add_number (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", int ndec = 0);
|
||||
// @cmember Aggiunge runtime un campo data alla maschera
|
||||
WINDOW add_date (short id, int page, const char* prompt, int x, int y, const char* flags = "");
|
||||
TDate_field& add_date (short id, int page, const char* prompt, int x, int y, const char* flags = "");
|
||||
// @cmember Aggiunge runtime un campo bottone alla maschera
|
||||
WINDOW add_button (short id, int page, const char* prompt, int x, int y, int dx = 9, int dy = 1, const char* flags = "");
|
||||
TButton_field& add_button (short id, int page, const char* prompt, int x, int y, int dx = 9, int dy = 1, const char* flags = "", short bmpup = 0, short bmpdn = 0);
|
||||
// @cmember Aggiunge runtime un campo boolean alla maschera
|
||||
WINDOW add_boolean (short id, int page, const char* prompt, int x, int y, const char* flags = "");
|
||||
TBoolean_field& add_boolean (short id, int page, const char* prompt, int x, int y, const char* flags = "");
|
||||
// @cmember Aggiunge runtime un campo radio button alla maschera
|
||||
WINDOW add_radio(short id, int page, const char* prompt, int x, int y, int dx, const char* codes, const char* items, const char* flags = "");
|
||||
TRadio_field& add_radio(short id, int page, const char* prompt, int x, int y, int dx, const char* codes, const char* items, const char* flags = "");
|
||||
// @cmember Aggiunge runtime un campo memo alla maschera
|
||||
WINDOW add_memo (short id, int page, const char* prompt, int x, int y, int dx = 78, int dy = 4, const char* flags = "");
|
||||
TMemo_field& add_memo (short id, int page, const char* prompt, int x, int y, int dx = 78, int dy = 4, const char* flags = "");
|
||||
// @cmember Aggiunge runtime un campo zoom alla maschera
|
||||
WINDOW add_zoom (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", int width = 0);
|
||||
TZoom_field& add_zoom (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", int width = 0);
|
||||
// @cmember Aggiunge runtime un campo lista alla maschera
|
||||
WINDOW add_list (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", const char* codes = NULL, const char* items = NULL);
|
||||
TList_field& add_list (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", const char* codes = NULL, const char* items = NULL);
|
||||
|
||||
// @cmember Ritorna il numero di campi della maschera
|
||||
int fields() const
|
||||
@ -194,6 +202,13 @@ public:
|
||||
// @cmember Ritorna la modalita' corrente di utilizzo della maschera
|
||||
int mode() const
|
||||
{ return _mode; }
|
||||
|
||||
// @cmember Setta la chiave da testare per l'autopremimento
|
||||
void set_test_field(int id)
|
||||
{ if (_test_fld < 0) _test_fld = id; }
|
||||
|
||||
void set_focus_field(short id);
|
||||
void notify_focus_field(short id);
|
||||
|
||||
// @cmember Setta il valore attuale della valuta
|
||||
void set_exchange(bool show_value, const real& nuo);
|
||||
@ -203,8 +218,8 @@ public:
|
||||
|
||||
// @cmember Controlla i campi di una maschera (TRUE se tutti validi)
|
||||
bool check_fields();
|
||||
// @cmember Mette il contenuto dei campi a video in stringhe interne
|
||||
void get_mask_fields();
|
||||
// @cmember Esegue il check e i messaggi sul campo <p fld_id> della maschera
|
||||
virtual void check_field( short fld_id );
|
||||
// @cmember Forza la chiusura della maschera
|
||||
virtual bool stop_run(KEY key);
|
||||
// @cmember Controlla se la maschera puo' essere chiusa (TRUE se puo' esserlo)
|
||||
@ -219,9 +234,6 @@ public:
|
||||
|
||||
// @cmember Converte un identificatore di campo nella sua posizione
|
||||
int id2pos(short id) const;
|
||||
// @cmember Ritorna l'id del campo che sta prendendo il focus, DLG_NULL se non esiste
|
||||
short next_fld() const
|
||||
{ return _next_fld;}
|
||||
// @cmember Ritorna il campo i-esimo della maschera
|
||||
TMask_field& fld(int i) const
|
||||
{ return (TMask_field&)_field[i]; }
|
||||
@ -255,15 +267,11 @@ public:
|
||||
|
||||
// @cmember Indica quale campo deve ricevere per primo il focus nella maschera
|
||||
int first_focus(short id);
|
||||
// @cmember Setta il focus al campo corrente
|
||||
void set_focus();
|
||||
// @cmember Muove il focus al prossimo o al precedente controllo valido
|
||||
void move_focus_field(int num);
|
||||
// @cmember Setta il focus al campo la cui finestra e' <p win>
|
||||
void set_focus_win(WINDOW win, bool force);
|
||||
|
||||
// @cmember Ritorna il numero del controllo che possiede il focus
|
||||
TMask_field& focus_field() const
|
||||
{ return fld(_focus); }
|
||||
TOperable_field& focus_field() const
|
||||
{ return (TOperable_field&)fld(_focus); }
|
||||
|
||||
// @cmember Disabilita la lettura dei check della maschera
|
||||
void disable_starting_check()
|
||||
{ _should_check = FALSE;}
|
||||
@ -282,7 +290,7 @@ public:
|
||||
void disable(short fld_id)
|
||||
{ enable(fld_id, FALSE); }
|
||||
// @cmember Riporta il cmpo allo stato di abilitazione iniziale
|
||||
void enable_default(short fld_id = -1);
|
||||
void enable_default(short fld_id = 0);
|
||||
|
||||
// @cmember Forza la visualizzazione della pagina p
|
||||
void show_page(int p);
|
||||
@ -302,28 +310,26 @@ public:
|
||||
void disable_key(byte key)
|
||||
{ enable_key(key, FALSE); }
|
||||
// @cmember Ritorna il l'identificatore di un campo della chiave <p key>
|
||||
short get_key_field(byte key, bool first) const;
|
||||
TEditable_field* get_key_field(byte key, bool first) const;
|
||||
// @cmember Controlla se la chiave <p key> ha un valore significativo
|
||||
// (TRUE se il valore e' valido)
|
||||
bool key_valid(int key) const;
|
||||
|
||||
// @cmember Permette di mostrare/nascondere un campo
|
||||
// @cmember Permette di mostrare/nascondere un campo (chiama <mf TMask_field::show>)
|
||||
virtual void show(short fld_id = -1, bool on = TRUE);
|
||||
// @cmember Permette di nascondere un campo (chiama <mf TMask::show>)
|
||||
void hide(short fld_id = -1)
|
||||
void hide(short fld_id = 0)
|
||||
{ show(fld_id, FALSE); }
|
||||
// @cmember Rimette lo stato di default del campo
|
||||
void show_default(short fld_id = -1);
|
||||
void show_default(short fld_id = 0);
|
||||
|
||||
// @cmember Rimette lo stato di default del campo
|
||||
void reset(short fld_id = -1);
|
||||
// @cmember Riporta il valori originali nel campo
|
||||
void undo(short fld_id = -1);
|
||||
// @cmember Azzera il campo
|
||||
void reset(short fld_id = 0);
|
||||
|
||||
// @cmember Legge, dalla relazione <p Trelation>, i valori del campo con specifica FIELD
|
||||
void autoload(const TRelation*);
|
||||
void autoload(const TRelation& r);
|
||||
// @cmember Scrive, dalla relazione <p Trelation>, i valori del campo con specifica FIELD
|
||||
void autosave(TRelation*) const;
|
||||
void autosave(TRelation& r) const;
|
||||
|
||||
// @cmember Permette di mandare un tasto ad un campo
|
||||
void send_key(KEY key, short id, TMask_field* from = NULL);
|
||||
@ -334,10 +340,12 @@ public:
|
||||
// @cmember Permette di settare il nome del file di salvataggio
|
||||
void set_workfile(const char* workfile)
|
||||
{ _workfile = workfile; _lastpos = 0L;}
|
||||
// @cmember Permette di salvare il file di salvataggio
|
||||
// @cmember Salva i valori dei campi della maschera sul file di salvataggio
|
||||
bool save(bool append = FALSE) const;
|
||||
// @cmember Permette di leggere il file di salvataggio
|
||||
// @cmember Legge i valori dei campi della maschera da file di salvataggio
|
||||
bool load(bool reset = FALSE);
|
||||
// @cmember Copia i valori dei campi dalla maschera <p m>
|
||||
void copy_values(const TMask &m);
|
||||
|
||||
// @cmember Ritorna il primo campo dirty
|
||||
short dirty() const;
|
||||
@ -371,15 +379,16 @@ public:
|
||||
virtual const char* get_caption() const;
|
||||
// @cmember Setta il titolo della maschera
|
||||
virtual void set_caption(const char* c);
|
||||
|
||||
// @cmember Mostra un messaggio d'errore appena possibile
|
||||
void post_error_message(const char* msg, int severity);
|
||||
|
||||
// @cmember Viene eseguita se il campo viene modificato???
|
||||
virtual bool on_dirty(TMask_field& c );
|
||||
// @cmember Viene eseguita se il campo viene modificato
|
||||
virtual bool on_dirty(TMask_field& c);
|
||||
|
||||
// @cmember Ritorna la finestra della toolbar
|
||||
WINDOW toolwin() const
|
||||
{ return _pagewin[MAX_PAGES]; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // __MASK_H
|
||||
|
3705
include/maskfld.cpp
3705
include/maskfld.cpp
File diff suppressed because it is too large
Load Diff
1197
include/maskfld.h
1197
include/maskfld.h
File diff suppressed because it is too large
Load Diff
1167
include/msksheet.cpp
1167
include/msksheet.cpp
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
#define FIRST_FIELD 101
|
||||
#define K_ROWEDIT ( K_CTRL + 'I' )
|
||||
|
||||
|
||||
@ -17,15 +18,10 @@ typedef bool (*SPREADSHEET_NOTIFY)(TSheet_field& s, int r, KEY k);
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @type SPREADSHEET_GETMASK | Prototipo funzione che ritorna una maschera di edit diversa a seconda della riga
|
||||
typedef TMask* (*SPREADSHEET_GETMASK)( int numriga, TMask& fullmask, bool destroy );
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TSheet_field | Classe per la gestione dei campi di uno spreadsheet
|
||||
//
|
||||
// @base public | TMask_field
|
||||
class TSheet_field : public TMask_field
|
||||
class TSheet_field : public TOperable_field
|
||||
{
|
||||
// @author:(INTERNAL) Guido
|
||||
|
||||
@ -34,10 +30,6 @@ class TSheet_field : public TMask_field
|
||||
|
||||
// @access:(INTERNAL) Private Member
|
||||
|
||||
// @cmember:(INTERNAL) Spreadsheet di apprtenenza dei campi
|
||||
TSpreadsheet* _sheet;
|
||||
// @cmember:(INTERNAL) Intestazione di tutte le colonne
|
||||
TToken_string _head;
|
||||
// @cmember:(INTERNAL) Indica se aggiungere a fondo dello spreadsheet o nella riga in cui ti trovi
|
||||
bool _append;
|
||||
|
||||
@ -45,12 +37,13 @@ class TSheet_field : public TMask_field
|
||||
protected:
|
||||
// @cmember Ritorna l'identificatore della classe
|
||||
virtual word class_id() const;
|
||||
|
||||
virtual bool is_kind_of(word cid) const;
|
||||
|
||||
// @cmember Gestisce la chiamata all'handler del campo
|
||||
virtual bool on_hit();
|
||||
// @cmember Gestisce la pressione del tasto (TRUE se la gestione ha avuto successo)
|
||||
virtual bool on_key(KEY k);
|
||||
// @cmember Ritorna TRUE se il campo puo' lasciare il focus
|
||||
virtual bool test_focus_change();
|
||||
|
||||
// @cmember Legge la testata dello spreadsheet da <p scanner>
|
||||
virtual void parse_head(TScanner& scanner);
|
||||
@ -63,6 +56,10 @@ protected:
|
||||
virtual void highlight() const;
|
||||
// @cmember Permette di settare il valore del cambio del campo
|
||||
virtual void exchange(bool show_value, const real& n);
|
||||
// @cmember Ricopia i campi della maschera nel record <p n>-esimo
|
||||
virtual void mask2row(int n, TToken_string & rec);
|
||||
// @cmember Ricopia i campi del record <p n>-esimo nella maschera
|
||||
virtual void row2mask(int n, TToken_string & rec);
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
@ -100,11 +97,11 @@ public:
|
||||
void force_update(int r = -1);
|
||||
|
||||
// @cmember Ritorna la maschera corrispondente ad una riga dello spreadsheet
|
||||
TMask& sheet_mask() const;
|
||||
virtual TMask& sheet_mask() const;
|
||||
// @cmember esegue la maschera di edit dello speadsheet;
|
||||
virtual KEY run_editmask(int ) { return sheet_mask().run();}
|
||||
// @cmember Setta il membro <p _notify> della classe <c TSpreadsheet>
|
||||
void set_notify(SPREADSHEET_NOTIFY n);
|
||||
// @cmember Setta il membro <p _set_getmask> della classe <c TSpreadsheet>
|
||||
void set_getmask(SPREADSHEET_GETMASK n);
|
||||
|
||||
// @cmember Abilita/disabilita una colonna dello spreadsheet (vedi <mf TSpreadsheet::enable_column>)
|
||||
void enable_column(int col, bool on = TRUE);
|
||||
|
@ -7,21 +7,23 @@
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
const char* TObject::class_name() const
|
||||
|
||||
{
|
||||
return "Object";
|
||||
}
|
||||
|
||||
|
||||
word TObject::class_id() const
|
||||
|
||||
{
|
||||
return CLASS_OBJECT;
|
||||
}
|
||||
|
||||
bool TObject::is_kind_of(word cid) const
|
||||
{
|
||||
return cid == CLASS_OBJECT;
|
||||
}
|
||||
|
||||
|
||||
bool TObject::ok() const
|
||||
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -47,18 +49,22 @@ void TObject::print_on(ostream& out) const
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
const char* TError_Object::class_name() const
|
||||
|
||||
{
|
||||
return "Error_Object";
|
||||
}
|
||||
|
||||
|
||||
word TError_Object::class_id() const
|
||||
|
||||
{
|
||||
return CLASS_ERROR;
|
||||
}
|
||||
|
||||
bool TError_Object::is_kind_of(word cid) const
|
||||
{
|
||||
return cid == CLASS_ERROR || TObject::is_kind_of(cid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool TError_Object::ok() const
|
||||
|
||||
|
@ -36,6 +36,8 @@ public:
|
||||
virtual const char* class_name() const;
|
||||
// @cmember Ritorna l'id della classe
|
||||
virtual word class_id() const;
|
||||
// @cmember Controlla se si tratta di un oggetto derivato dalla classe <p cid>
|
||||
virtual bool is_kind_of(word cid) const;
|
||||
// @cmember Controlla se si tratta di un oggetto valido (sempre TRUE)
|
||||
virtual bool ok() const;
|
||||
// @cmember Duplica un'oggetto
|
||||
@ -69,6 +71,8 @@ public:
|
||||
virtual const char* class_name() const;
|
||||
// @cmember Ritorna l'id della classe
|
||||
virtual word class_id() const;
|
||||
// @cmember Controlla se si tratta di un oggetto derivato dalla classe <p cid>
|
||||
virtual bool is_kind_of(word cid) const;
|
||||
// @cmember Controlla se si tratta di un oggetto valido (sempre FALSE)
|
||||
virtual bool ok() const;
|
||||
|
||||
|
@ -65,8 +65,11 @@ TPrefix& prefix()
|
||||
// @func Distrugge l'oggett <c TPrefix> in memoria
|
||||
void prefix_destroy()
|
||||
{
|
||||
delete _prefhndl;
|
||||
_prefhndl = NULL;
|
||||
if (_prefhndl)
|
||||
{
|
||||
delete _prefhndl;
|
||||
_prefhndl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include <defmask.h>
|
||||
#include <progind.h>
|
||||
#include <controls.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
const char* const CANCEL_TEXT = "Annulla";
|
||||
const char* const TITLE_TEXT = "Attesa";
|
||||
|
||||
word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
||||
@ -18,15 +19,12 @@ word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
||||
|
||||
// Certified 70%
|
||||
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
: _text(NULL), _cancel(NULL), _bar(0),
|
||||
_status(0L), _max(max), _flags(0x0)
|
||||
{
|
||||
_cancel = _bar = _text = NULL_WIN;
|
||||
|
||||
_status = 0l;
|
||||
_max = max;
|
||||
if (_max <= 0) _max = 1;
|
||||
_flags = 0x0;
|
||||
|
||||
TToken_string testo(txt, '\n');
|
||||
TToken_string testo(txt, '\r');
|
||||
word maxlen = div;
|
||||
const word lines = measure_text(testo, maxlen);
|
||||
|
||||
@ -41,14 +39,22 @@ TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
}
|
||||
ver += cancel ? 3 : 0;
|
||||
|
||||
create(-1, -1, hor, ver, TITLE_TEXT);
|
||||
|
||||
set_win(create_interface(TASK_WIN, -1, -1, hor, ver, TITLE_TEXT, this, FALSE));
|
||||
|
||||
/*
|
||||
RCT r; r.left = CHARX; r.top = CHARY; r.right = CHARX*(hor-2); r.bottom = r.top + lines*CHARY+4;
|
||||
_text = xvt_ctl_create(WC_TEXT, &r, (char*)txt, win(), CTL_FLAG_CENTER_JUST, 0l, DLG_NULL);
|
||||
*/
|
||||
_text = new TField_control(win(), DLG_NULL, 1, 1, hor-2, lines, "CD", (char*)txt);
|
||||
|
||||
if (cancel)
|
||||
{
|
||||
/*
|
||||
_cancel = xvt_create_control(WC_PUSHBUTTON, -11, -1, 9, 2,
|
||||
CANCEL_TEXT, win(), 0, 0l, DLG_CANCEL);
|
||||
"Annulla", win(), 0, 0l, DLG_CANCEL);
|
||||
*/
|
||||
_cancel = new TPushbutton_control(win(), DLG_CANCEL, -11, -1, 10, 2, "", "Annulla", BMP_CANCEL);
|
||||
}
|
||||
open_modal();
|
||||
do_events();
|
||||
}
|
||||
@ -64,11 +70,16 @@ void TIndwin::set_text(
|
||||
// passato, quindi occorre dimensionare correttamente il primo passato
|
||||
// (es. inserire degli spazi) se se ne prevede uno piu' lungo.
|
||||
{
|
||||
xvt_vobj_set_title(_text, (char*)t);
|
||||
_text->set_caption(t);
|
||||
}
|
||||
|
||||
TIndwin::~TIndwin()
|
||||
{ close_modal(); }
|
||||
{
|
||||
close_modal();
|
||||
|
||||
if (_text) delete _text;
|
||||
if (_cancel) delete _cancel;
|
||||
}
|
||||
|
||||
bool TIndwin::can_be_closed() const
|
||||
{
|
||||
@ -129,44 +140,29 @@ void TIndwin::update_bar()
|
||||
void TIndwin::update()
|
||||
{
|
||||
if (_bar) update_bar();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TIndwin::handler(WINDOW w, EVENT* e)
|
||||
bool TIndwin::on_key(KEY k)
|
||||
{
|
||||
switch(e->type)
|
||||
if (k == K_ESC && _cancel)
|
||||
{
|
||||
case E_UPDATE:
|
||||
xvt_dwin_clear(w, COLOR_WHITE);
|
||||
update();
|
||||
return;
|
||||
case E_CONTROL:
|
||||
if (e->v.ctl.id == DLG_CANCEL)
|
||||
dispatch_e_char(w, K_ESC);
|
||||
break;
|
||||
case E_CHAR:
|
||||
// allowed only if cancel button is there
|
||||
if (e->v.chr.ch == K_ESC)
|
||||
{
|
||||
if (_cancel)
|
||||
{
|
||||
_flags |= IND_CANCELLED;
|
||||
check_stop();
|
||||
}
|
||||
else return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TWindow::handler(w,e);
|
||||
_flags |= IND_CANCELLED;
|
||||
check_stop();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TIndwin::on_button(short id)
|
||||
{
|
||||
if (id == DLG_CANCEL)
|
||||
on_key(K_ESC);
|
||||
}
|
||||
|
||||
|
||||
// TProgind --------------------------------------------------------------
|
||||
|
||||
TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
: TIndwin(max, txt, cancel, bar, div)
|
||||
: TIndwin(max, txt, cancel, bar, div)
|
||||
{}
|
||||
|
||||
// TTimerind ------------------------------------------------------------
|
||||
|
@ -2,12 +2,16 @@
|
||||
#ifndef __PROGIND_H
|
||||
#define __PROGIND_H
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#ifndef __CONTROLS_H
|
||||
class TControl;
|
||||
#endif
|
||||
|
||||
// @doc EXTERNAL
|
||||
@ -27,9 +31,9 @@ class TIndwin : public TWindow
|
||||
IND_FINISHED= 0x02 };
|
||||
|
||||
// @cmember:(INTERNAL) Testo da inserire nella finestra
|
||||
WINDOW _text;
|
||||
TControl* _text;
|
||||
// @cmember:(INTERNAL) Bottone "Annulla"
|
||||
WINDOW _cancel;
|
||||
TControl* _cancel;
|
||||
// @cmember:(INTERNAL) Movimento della barra e percentuale
|
||||
WINDOW _bar;
|
||||
// @cmember:(INTERNAL) Flag che indica quali operazioni sono state effettuate
|
||||
@ -44,8 +48,12 @@ protected:
|
||||
// @cmember Ritorna il numero di linee necessarie per scrivere il testo nella finestra
|
||||
word measure_text(TToken_string& t, word& len) const;
|
||||
|
||||
// @cmember Gestisce gli eventi della finestra
|
||||
virtual void handler(WINDOW w, EVENT* e);
|
||||
// @cmember Gestisce gli eventi tasto della finestra
|
||||
virtual bool on_key(KEY k);
|
||||
|
||||
// @cmember Gestisce gli eventi bottone della finestra
|
||||
virtual void on_button(short id);
|
||||
|
||||
// @cmember Aggiorna la barra di attesa (chiama update_bar)
|
||||
virtual void update();
|
||||
|
||||
|
@ -341,13 +341,13 @@ void real::trail( )
|
||||
|
||||
bool real::is_real (const char *s)
|
||||
{
|
||||
bool ok = FALSE;
|
||||
bool ok = TRUE;
|
||||
if (s)
|
||||
{
|
||||
while (*s == ' ')
|
||||
s++; // Remove leading spaces before atod
|
||||
|
||||
ok = atod (__tmp_real.ptr (), (char *) s) != GM_NULL;
|
||||
if (*s)
|
||||
ok = atod (__tmp_real.ptr (), (char *) s) != GM_NULL;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -1155,6 +1155,22 @@ char *real::ita2eng (const char *s)
|
||||
return __string;
|
||||
}
|
||||
|
||||
bool real::is_null(const char *s)
|
||||
{
|
||||
bool z = TRUE;
|
||||
if (s != NULL) for (const char* n = s; *n; n++)
|
||||
{
|
||||
if (strchr("123456789", *n) != NULL)
|
||||
{
|
||||
z = FALSE;
|
||||
break;
|
||||
}
|
||||
if (strchr(" ,-.0", *n) == NULL)
|
||||
break;
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
bool real::is_natural (const char *s)
|
||||
{
|
||||
bool ok = s && *s != '\0';
|
||||
|
@ -15,7 +15,7 @@
|
||||
class real : public TObject
|
||||
|
||||
// @comm Questa classe utilizza i long double definiti per Visual C++. Esiste un'altra classe
|
||||
// real: per accedere scegliere il tasto successivo (<gt><gt>) dalla barra deo bottoni
|
||||
// real: per accedere scegliere il tasto successivo (<gt><gt>) dalla barra deo bottoni
|
||||
|
||||
// @author:(INTERNAL) Guido
|
||||
{
|
||||
@ -50,7 +50,8 @@ public:
|
||||
static bool is_real(const char* n);
|
||||
// @cmember Controlla se si tratta di un numero naturale intero (TRUE se vero)
|
||||
static bool is_natural(const char* n);
|
||||
|
||||
// @cmember Controlla se si tratta di uno zero (TRUE se vero)
|
||||
static bool is_null(const char* n);
|
||||
// @cmember Trasforma un reale in stringa
|
||||
char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
||||
// @cmember Trasforma un reale in stringa (chiama <mf real::string>), ma
|
||||
@ -140,7 +141,7 @@ long double abs(long double a) ;
|
||||
class real : public TObject
|
||||
|
||||
// @comm Questa classe utilizza i DEC definiti per GREENLEAF. Esiste un'altra classe
|
||||
// real: per accedere scegliere il tasto precedente (<lt><lt>) dalla barra deo bottoni
|
||||
// real: per accedere scegliere il tasto precedente (<lt><lt>) dalla barra deo bottoni
|
||||
|
||||
// @author:(INTERNAL) Guido
|
||||
{
|
||||
@ -177,6 +178,8 @@ public:
|
||||
static bool is_real(const char* n);
|
||||
// @cmember Controlla se si tratta di un numero naturale intero (TRUE se vero)
|
||||
static bool is_natural(const char* n);
|
||||
// @cmember Controlla se si tratta di uno zero (TRUE se vero)
|
||||
static bool is_null(const char* n);
|
||||
|
||||
// @cmember Ritorna l'indirizzo del numero reale
|
||||
DEC* ptr() const
|
||||
|
@ -9,105 +9,23 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Array delle chiavi della maschera di ricerca
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @class TChiave | Array delle chiavi della maschera di ricerca
|
||||
// @base public | TObject
|
||||
class TChiave : public TObject
|
||||
// @author:(INTERNAL) Guido
|
||||
|
||||
// @access:(INTERNAL) Private Member
|
||||
{
|
||||
// @ccost:(INTERNAL) MAX | 16 | Numero massimo di chiavi della maschera di ricerca
|
||||
enum { MAX = 16 };
|
||||
// @cmember:(INTERNAL) Posizione delle chiavi nella msachera di ricerca
|
||||
int _pos[MAX];
|
||||
// @cmember:(INTERNAL) Numero di chiavi presenti nella maschera di ricerca
|
||||
byte _num;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Aggiunge una nuova chiave alla posizione <p p>
|
||||
void add(int p);
|
||||
// @cmember Ritorna la posizione della chiave <p n>-esima (-1 se non esiste)
|
||||
int pos(byte n) const
|
||||
{ return (n >= _num) ? -1 : _pos[n]; }
|
||||
// @cmember Ritorna il numero di chiavi attualmente presente nella maschera
|
||||
byte items() const
|
||||
{ return _num; }
|
||||
// @cmember Costruttore
|
||||
TChiave() : _num(0)
|
||||
{}
|
||||
// @cmember Distruttore
|
||||
virtual ~TChiave()
|
||||
{}
|
||||
};
|
||||
|
||||
void TChiave::add(int p)
|
||||
{
|
||||
CHECKD(_num < MAX, "Too many fields in key : field n.", p);
|
||||
_pos[_num++] = p;
|
||||
}
|
||||
|
||||
class TKey_array : public TArray
|
||||
{
|
||||
const TMask* _mask;
|
||||
|
||||
public:
|
||||
TKey_array(const TMask* m);
|
||||
virtual ~TKey_array() {}
|
||||
|
||||
TChiave& key(byte k);
|
||||
};
|
||||
|
||||
TChiave& TKey_array::key(byte k)
|
||||
{
|
||||
k--;
|
||||
TChiave* chiave = (TChiave*)objptr(k);
|
||||
if (chiave == NULL)
|
||||
{
|
||||
chiave = new TChiave;
|
||||
add(chiave, k);
|
||||
}
|
||||
return *chiave;
|
||||
}
|
||||
|
||||
TKey_array::TKey_array(const TMask* m) : _mask(m)
|
||||
{
|
||||
const byte keys = m->num_keys();
|
||||
for (int f = 0; f < m->fields(); f++)
|
||||
{
|
||||
TMask_field& c = m->fld(f);
|
||||
if (c.in_key(0))
|
||||
for (byte k = 1; k <= keys; k++)
|
||||
if (c.in_key(k))
|
||||
key(k).add(f);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRelation_application
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TRelation_application::TRelation_application()
|
||||
: _mask(NULL), _maskeys(NULL), _search_id(-1), _lnflag(FALSE)
|
||||
{}
|
||||
: _mask(NULL), _search_id(-1), _lnflag(FALSE)
|
||||
{ }
|
||||
|
||||
TRelation_application::~TRelation_application()
|
||||
{
|
||||
if (_maskeys) delete _maskeys;
|
||||
}
|
||||
{ }
|
||||
|
||||
void TRelation_application::setkey()
|
||||
{
|
||||
if (has_filtered_cursor())
|
||||
{
|
||||
TEdit_field* f = (TEdit_field*) get_search_field();
|
||||
TCursor* cur = f->browse()->cursor();
|
||||
TEdit_field& f = get_search_field();
|
||||
TCursor* cur = f.browse()->cursor();
|
||||
cur->setkey();
|
||||
return;
|
||||
}
|
||||
@ -129,15 +47,14 @@ void TRelation_application::set_limits(
|
||||
{
|
||||
if (has_filtered_cursor())
|
||||
{
|
||||
TEdit_field* f = (TEdit_field*)get_search_field();
|
||||
CHECK(f, "Manca il campo di ricerca");
|
||||
TEdit_field& f = get_search_field();
|
||||
|
||||
TBrowse* b = f->browse();
|
||||
TCursor* cur = b ? b->cursor() : NULL;
|
||||
TBrowse* b = f.browse();
|
||||
TCursor* cur = b != NULL ? b->cursor() : NULL;
|
||||
if (cur)
|
||||
{
|
||||
cur->setkey();
|
||||
f->browse()->do_input(TRUE);
|
||||
f.browse()->do_input(TRUE);
|
||||
if (cur->items() == 0) _first = _last = -1;
|
||||
else
|
||||
{
|
||||
@ -186,7 +103,6 @@ bool TRelation_application::create()
|
||||
write_enable();
|
||||
_mask = get_mask(MODE_QUERY);
|
||||
filter();
|
||||
_maskeys = new TKey_array(_mask);
|
||||
set_limits();
|
||||
dispatch_e_menu(BAR_ITEM(1));
|
||||
}
|
||||
@ -204,7 +120,6 @@ bool TRelation_application::menu(MENU_TAG m)
|
||||
|
||||
bool TRelation_application::destroy()
|
||||
{
|
||||
if (_maskeys) delete _maskeys;
|
||||
user_destroy();
|
||||
return TApplication::destroy();
|
||||
}
|
||||
@ -212,7 +127,7 @@ bool TRelation_application::destroy()
|
||||
|
||||
void TRelation_application::set_fixed()
|
||||
{
|
||||
TString256 s;
|
||||
TString s;
|
||||
for (const char* f = _fixed.get(0); f && *f; f = _fixed.get())
|
||||
{
|
||||
s = f;
|
||||
@ -231,20 +146,15 @@ void TRelation_application::enable_query()
|
||||
const bool query = _mask->query_mode();
|
||||
const bool keyon = query || get_relation()->status() == _isreinsert;
|
||||
|
||||
for (byte k = 1; k <= _maskeys->items(); k++)
|
||||
for (int i = _mask->fields() - 1; i >= 0; i--)
|
||||
{
|
||||
const TChiave& chiave = _maskeys->key(k);
|
||||
for (int i = 0; i < chiave.items(); i++)
|
||||
TMask_field& c = _mask->fld(i);
|
||||
if (c.in_key(0) && c.enabled_default())
|
||||
{
|
||||
const int num = chiave.pos(i);
|
||||
TMask_field& c = _mask->fld(num);
|
||||
if (c.enabled_default())
|
||||
{
|
||||
if (k == 1)
|
||||
c.enable(keyon);
|
||||
if (c.has_query())
|
||||
((TEdit_field&)c).enable_check(query);
|
||||
}
|
||||
if (c.in_key(1))
|
||||
c.enable(keyon);
|
||||
if (c.has_query())
|
||||
((TEdit_field&)c).enable_check(query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,8 +241,8 @@ int TRelation_application::set_mode(int mode)
|
||||
// @flag TRUE | Il campo chiave non e' vuoto
|
||||
// @flag FALSE | Non e' riuscii ad autonumerare il campo chiave
|
||||
bool TRelation_application::autonum(
|
||||
TMask* m, // @parm Maschera a cui applicare l'autonumerazione
|
||||
bool rec) // @parm Indica se registrare il record corrente
|
||||
TMask* m, // @parm Maschera a cui applicare l'autonumerazione
|
||||
bool rec) // @parm Indica se registrare il record corrente
|
||||
{
|
||||
TToken_string k(get_next_key());
|
||||
|
||||
@ -346,8 +256,8 @@ bool TRelation_application::autonum(
|
||||
CHECKD (id > 0, "Identificatore di autonumerazione errato: ", id);
|
||||
const char* val = k.get();
|
||||
TMask_field& f = m->field(id);
|
||||
if (rec || f.get().empty()) f.set(val);
|
||||
if (rec) f.autosave(get_relation());
|
||||
if (rec || f.empty()) f.set(val);
|
||||
if (rec) ((TEditable_field&)f).autosave(*get_relation());
|
||||
if (_renum_message.empty() || f.in_key(1))
|
||||
_renum_message.format("Il documento e' stato registrato con :\n %s = %s", (const char *) f.prompt(), (const char *) f.get());
|
||||
}
|
||||
@ -358,10 +268,10 @@ bool TRelation_application::autonum(
|
||||
|
||||
// @mfunc Entra in modo di ricerca
|
||||
void TRelation_application::query_mode(
|
||||
bool pre_ins) // @parm Indica in quale modo andare:
|
||||
//
|
||||
// @flag TRUE | Entra in modo MODE_QUERY_INSERT
|
||||
// @flag FALSE | Entra in modo MODE_QUERY (default)
|
||||
bool pre_ins) // @parm Indica in quale modo andare:
|
||||
//
|
||||
// @flag TRUE | Entra in modo MODE_QUERY_INSERT
|
||||
// @flag FALSE | Entra in modo MODE_QUERY (default)
|
||||
{
|
||||
TMask* old = _mask;
|
||||
const bool was_open = old != NULL && old->is_open();
|
||||
@ -375,8 +285,6 @@ void TRelation_application::query_mode(
|
||||
{
|
||||
if (was_open)
|
||||
_mask->open_modal();
|
||||
if (_maskeys) delete _maskeys;
|
||||
_maskeys = new TKey_array(_mask);
|
||||
set_limits();
|
||||
}
|
||||
|
||||
@ -424,8 +332,6 @@ void TRelation_application::insert_mode()
|
||||
_mask->load();
|
||||
::remove(workname);
|
||||
_mask->open_modal();
|
||||
delete _maskeys;
|
||||
_maskeys = new TKey_array(_mask);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -463,11 +369,7 @@ bool TRelation_application::modify_mode()
|
||||
_mask = get_mask(MODE_MOD);
|
||||
|
||||
if (changing)
|
||||
{
|
||||
_mask->open_modal();
|
||||
delete _maskeys;
|
||||
_maskeys = new TKey_array(_mask);
|
||||
}
|
||||
|
||||
set_mode(MODE_MOD);
|
||||
|
||||
@ -484,18 +386,25 @@ bool TRelation_application::modify_mode()
|
||||
}
|
||||
|
||||
|
||||
TMask_field* TRelation_application::get_search_field() const
|
||||
{
|
||||
if (_search_id > 0)
|
||||
return &_mask->field(_search_id);
|
||||
|
||||
const TChiave& k = _maskeys->key(1);
|
||||
for (int i = 0; i < k.items(); i++)
|
||||
{
|
||||
TMask_field* f = &_mask->fld(k.pos(i));
|
||||
if (f->required()) return f;
|
||||
TEdit_field& TRelation_application::get_search_field() const
|
||||
{
|
||||
short id = _search_id;
|
||||
|
||||
if (id <= 0)
|
||||
{
|
||||
const int max = _mask->fields();
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
const TMask_field& f = _mask->fld(i);
|
||||
if (f.in_key(1) && f.required())
|
||||
{
|
||||
id = f.dlg();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
return _mask->efield(id);
|
||||
}
|
||||
|
||||
bool TRelation_application::search_mode()
|
||||
@ -503,7 +412,7 @@ bool TRelation_application::search_mode()
|
||||
if (_mask->mode() != MODE_QUERY)
|
||||
query_mode();
|
||||
|
||||
TMask_field* prima = get_search_field();
|
||||
TEdit_field* prima = &get_search_field();
|
||||
while (prima)
|
||||
{
|
||||
if (prima->on_key(K_F9))
|
||||
@ -513,7 +422,7 @@ bool TRelation_application::search_mode()
|
||||
}
|
||||
|
||||
TMask_field* dopo = &_mask->focus_field();
|
||||
prima = (dopo == prima) ? NULL : dopo;
|
||||
prima = (dopo == prima || !dopo->is_edit()) ? NULL : (TEdit_field*)dopo;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -524,25 +433,23 @@ bool TRelation_application::search_mode()
|
||||
//
|
||||
// @rdesc Ritorna se la chave esiste sul file
|
||||
bool TRelation_application::test_key(
|
||||
byte k, // @parm Chiave da ricercare
|
||||
bool err) // @parm Indica se visualizzare eventuali errori occorsi
|
||||
byte k, // @parm Chiave da ricercare
|
||||
bool err) // @parm Indica se visualizzare eventuali errori occorsi
|
||||
{
|
||||
const TChiave& chiave = _maskeys->key(k);
|
||||
bool onereq = FALSE, onefill = FALSE;
|
||||
|
||||
for (int i = 0; i < chiave.items(); i++)
|
||||
for (TEditable_field* e = _mask->get_key_field(k, TRUE);
|
||||
e != NULL;
|
||||
e = _mask->get_key_field(k, FALSE))
|
||||
{
|
||||
const int num = chiave.pos(i);
|
||||
TMask_field& c = _mask->fld(num);
|
||||
|
||||
if (c.required())
|
||||
if (e->required())
|
||||
{
|
||||
onereq = TRUE;
|
||||
if (c.get().empty())
|
||||
if (e->empty())
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
_mask->first_focus(-c.dlg());
|
||||
_mask->first_focus(-e->dlg());
|
||||
error_box("Manca un valore indispensabile per la ricerca");
|
||||
}
|
||||
return FALSE;
|
||||
@ -550,7 +457,7 @@ bool TRelation_application::test_key(
|
||||
}
|
||||
else
|
||||
/* if (k == 1 && !onereq && !onefill && c.get().not_empty()) */
|
||||
if (!onereq && !onefill && c.is_edit() && c.get().not_empty())
|
||||
if (!onereq && !onefill && e->is_edit() && !e->empty())
|
||||
onefill = TRUE;
|
||||
}
|
||||
if (k == 1 && !onereq && !onefill)
|
||||
@ -562,32 +469,21 @@ bool TRelation_application::test_key(
|
||||
return onefill || onereq;
|
||||
}
|
||||
|
||||
// Guy: doesn't change fields
|
||||
bool TRelation_application::find(byte k)
|
||||
{
|
||||
if (changing_keys())
|
||||
{
|
||||
delete _maskeys;
|
||||
_maskeys= new TKey_array(_mask);
|
||||
}
|
||||
|
||||
const byte numkeys = _maskeys->items();
|
||||
|
||||
if (k == 0)
|
||||
{
|
||||
for (k = 1; k <= numkeys && !test_key(k, FALSE); k++);
|
||||
if (k > numkeys)
|
||||
for (k = 1; k <= MAX_KEYS && !test_key(k, FALSE); k++);
|
||||
if (k > MAX_KEYS)
|
||||
return test_key(1, TRUE);
|
||||
}
|
||||
|
||||
file().setkey(k);
|
||||
file().zero();
|
||||
const TChiave& chiave = _maskeys->key(k);
|
||||
for (int i = 0; i < chiave.items(); i++)
|
||||
for (TEditable_field* e = _mask->get_key_field(k, TRUE); e; e = _mask->get_key_field(k, FALSE))
|
||||
{
|
||||
const TMask_field& c = _mask->fld(chiave.pos(i));
|
||||
if (c.shown()) // Ignora campi invisibili
|
||||
c.autosave(get_relation());
|
||||
if (e->shown()) // Ignora campi invisibili
|
||||
e->autosave(*get_relation());
|
||||
}
|
||||
|
||||
const int err = file().read(_isequal);
|
||||
@ -633,8 +529,11 @@ bool TRelation_application::save(bool check_dirty)
|
||||
{
|
||||
if (annulla)
|
||||
{
|
||||
TString80 w(_mask->field(dirty).warning());
|
||||
if (w.empty()) w = "Campo inconsistente";
|
||||
TString w(80);
|
||||
if (_mask->field(dirty).is_edit())
|
||||
w = _mask->efield(dirty).get_warning();
|
||||
if (w.empty())
|
||||
w = "Campo inconsistente";
|
||||
w << ": si desidera ";
|
||||
switch (last)
|
||||
{
|
||||
@ -734,7 +633,7 @@ bool TRelation_application::save(bool check_dirty)
|
||||
|
||||
int TRelation_application::read(TMask& m)
|
||||
{
|
||||
const TRelation *r = get_relation();
|
||||
const TRelation &r = *get_relation();
|
||||
m.autoload(r);
|
||||
return NOERR;
|
||||
}
|
||||
@ -742,19 +641,19 @@ int TRelation_application::read(TMask& m)
|
||||
|
||||
int TRelation_application::write(const TMask& m)
|
||||
{
|
||||
TRelation *r = get_relation();
|
||||
TRelation &r = *get_relation();
|
||||
m.autosave(r);
|
||||
r->write();
|
||||
return r->status();
|
||||
r.write();
|
||||
return r.status();
|
||||
}
|
||||
|
||||
|
||||
int TRelation_application::rewrite(const TMask& m)
|
||||
{
|
||||
TRelation *r = get_relation();
|
||||
TRelation& r = *get_relation();
|
||||
m.autosave(r);
|
||||
r->rewrite();
|
||||
return r->status();
|
||||
r.rewrite();
|
||||
return r.status();
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -765,7 +664,7 @@ int TRelation_application::rewrite(const TMask& m)
|
||||
bool TRelation_application::relation_remove()
|
||||
|
||||
// @comm Se la maschera e' in MODE_MOD non e' possibile cancellare il record e viene
|
||||
// emesso un <f CHECK> di errore.
|
||||
// emesso un <f CHECK> di errore.
|
||||
{
|
||||
CHECK(_mask->mode() == MODE_MOD, "You can call remove in MODE_MOD only");
|
||||
TRelation *r = get_relation();
|
||||
@ -873,8 +772,8 @@ bool TRelation_application::main_loop()
|
||||
k = K_QUIT;
|
||||
}
|
||||
break;
|
||||
case K_F9:
|
||||
if (save(TRUE))
|
||||
case K_F9:
|
||||
if (_mask->mode() == MODE_QUERY || save(TRUE))
|
||||
search_mode();
|
||||
break;
|
||||
default:
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
class TKey_array;
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TRelation_application | Classe per la gestione di una apllicazione di manutenzione di uno
|
||||
@ -29,8 +27,6 @@ class TRelation_application : public TApplication
|
||||
{
|
||||
// @cmember:(INTERNAL) Maschera corrente dell'applicazione
|
||||
TMask* _mask;
|
||||
// @cmember:(INTERNAL) Array di chiavi della maschera
|
||||
TKey_array* _maskeys;
|
||||
// @cmember:(INTERNAL) Primo record
|
||||
TRecnotype _first;
|
||||
// @cmember:(INTERNAL) Ultimo record
|
||||
@ -39,7 +35,7 @@ class TRelation_application : public TApplication
|
||||
int _search_id;
|
||||
|
||||
// @cmember:(INTERNAL) Nome del programma chiamante
|
||||
TString16 _autoins_caller;
|
||||
TString _autoins_caller;
|
||||
// @cmember:(INTERNAL) Numero del record nuovo/editato
|
||||
long _recins;
|
||||
|
||||
@ -73,7 +69,7 @@ class TRelation_application : public TApplication
|
||||
// @cmember:(INTERNAL) Cancella il record corrente
|
||||
bool relation_remove();
|
||||
// @cmember:(INTERNAL) Ritorna il campo di ricerca della maschera
|
||||
TMask_field* get_search_field() const;
|
||||
TEdit_field& get_search_field() const;
|
||||
|
||||
// @cmember:(INTERNAL) Permette di autonumerare un record
|
||||
bool autonum(TMask* m, bool rec);
|
||||
@ -128,19 +124,15 @@ protected:
|
||||
bool lnflag() const
|
||||
{ return _lnflag;}
|
||||
// @cmember Indica se la futura <mf TRelation_application::get_mask> ritornera' una maschera diversa
|
||||
// dalla corrente.
|
||||
// <nl>La richiesta della maschera da utilizzare per ogni fase di lavoro
|
||||
// (ricerca, inserimento, modifica) avviene sempre in due tempi: <mf TRelation_application::changing_mask> e
|
||||
// <mf TRelation_application::get_mask>. Cio' serve per gestire correttamente le applicazioni
|
||||
// con mashere multiple.
|
||||
// dalla corrente.
|
||||
// <nl>La richiesta della maschera da utilizzare per ogni fase di lavoro
|
||||
// (ricerca, inserimento, modifica) avviene sempre in due tempi: <mf TRelation_application::changing_mask> e
|
||||
// <mf TRelation_application::get_mask>. Cio' serve per gestire correttamente le applicazioni
|
||||
// con mashere multiple.
|
||||
virtual bool changing_mask(int mode) pure;
|
||||
// @cmember Richiede la maschera da usare
|
||||
virtual TMask* get_mask(int mode) pure;
|
||||
|
||||
// @cmember Forza la rigenerazione della lista interna di chiavi ad ogni <mf TRealtion_application::find>
|
||||
virtual bool changing_keys() const
|
||||
{ return FALSE; }
|
||||
|
||||
// @cmember Ritorna la relazione da modificare
|
||||
virtual TRelation* get_relation() const pure;
|
||||
// @cmember Legge dalla relazione i valori nella maschera <p m>
|
||||
@ -153,10 +145,10 @@ protected:
|
||||
virtual bool remove();
|
||||
|
||||
// @cmember Richiede una stringa nella forma CAMPO1<pipe>VALORE1<pipe>CAMPO2<pipe>VALORE2<pipe>...
|
||||
// <pipe>CAMPOn<pipe>VALOREn contenente le coppie NUMERO_CAMPO_MASCHERA - VALORE_DA_ASSEGNARE
|
||||
// <pipe>CAMPOn<pipe>VALOREn contenente le coppie NUMERO_CAMPO_MASCHERA - VALORE_DA_ASSEGNARE
|
||||
// che descrivono il prossimo codice libero da utilizzare per la autonumerazione.
|
||||
// <nl>Nel caso di banale numerazione progressiva potrebbe essere implementata come
|
||||
// return format("%d<pipe>%s", F_NUM, get_relation()-<gt>items());
|
||||
// <nl>Nel caso di banale numerazione progressiva potrebbe essere implementata come
|
||||
// return format("%d<pipe>%s", F_NUM, get_relation()-<gt>items());
|
||||
virtual const char* get_next_key()
|
||||
{ return ""; }
|
||||
|
||||
@ -181,7 +173,7 @@ protected:
|
||||
virtual bool force_cursor_usage() const
|
||||
{ return FALSE;}
|
||||
// @cmember Indica se abilitare/disabilitare la scrittura sul file
|
||||
// principale (vedi <mf TRealtion::write_enable>)
|
||||
// principale (vedi <mf TRealtion::write_enable>)
|
||||
virtual void write_enable(bool on = TRUE)
|
||||
{ get_relation()->write_enable(0, on); }
|
||||
// @cmember Indica se disabilitare la scrittura sul file principale (vedi <mf TRealtion::write_enable>)
|
||||
|
@ -873,14 +873,12 @@ int TRelation::remove(TDate& atdate)
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
HIDDEN bool __evalcondition(const TRelation* r,TExpression* cond)
|
||||
|
||||
HIDDEN bool __evalcondition(const TRelation& r,TExpression* cond)
|
||||
{
|
||||
for (int i = 0; i < cond->numvar(); i++)
|
||||
for (int i = cond->numvar() - 1; i >= 0; i--)
|
||||
{
|
||||
const char* s = cond->varname(i);
|
||||
TFieldref f(s,0);
|
||||
|
||||
cond->setvar(i, f.read(r));
|
||||
}
|
||||
return (bool) *cond;
|
||||
@ -993,7 +991,7 @@ int TCursor::filtercursor(int pagecnt, TRecnotype* page)
|
||||
file().readat(rec,page[i]);
|
||||
if (update_relation()) _if->update();
|
||||
if ((_filterfunction ? _filterfunction(_if) : TRUE ) &&
|
||||
(_fexpr ? __evalcondition(_if, _fexpr) : TRUE))
|
||||
(_fexpr ? __evalcondition(*_if, _fexpr) : TRUE))
|
||||
{
|
||||
if (np < i) page[np] = page[i];
|
||||
np++;
|
||||
@ -1021,7 +1019,7 @@ bool TCursor::ok() const
|
||||
return FALSE;
|
||||
if (_filter_update || _filterfunction_update) _if->update();
|
||||
if ((_filterfunction ? _filterfunction(_if) : TRUE ) &&
|
||||
(_fexpr ? __evalcondition(_if, _fexpr) : TRUE))
|
||||
(_fexpr ? __evalcondition(*_if, _fexpr) : TRUE))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
@ -1186,7 +1184,6 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop, TDate& atdate)
|
||||
{
|
||||
_pos = _totrec - max + i;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
if (_pos == -1) _pos = 0;
|
||||
@ -1505,7 +1502,7 @@ int TSorted_cursor::filtercursor(int pagecnt, TRecnotype* page)
|
||||
file().readat(rec,page[i]);
|
||||
if (update_relation()) relation()->update();
|
||||
if ((filterfunction() ? filterfunction()(relation()) : TRUE ) &&
|
||||
(expression() ? __evalcondition(relation(), expression()) : TRUE))
|
||||
(expression() ? __evalcondition(*relation(), expression()) : TRUE))
|
||||
{
|
||||
if (np < i) page[np] = page[i];
|
||||
np++;
|
||||
@ -1522,7 +1519,7 @@ int TSorted_cursor::filtercursor(int pagecnt, TRecnotype* page)
|
||||
if (s.right(1) == "-" || s.right(1) == "+")
|
||||
s.cut(s.len()-1);
|
||||
TFieldref f(s,0);
|
||||
TString sf=f.read(relation());
|
||||
TString sf=f.read(*relation());
|
||||
TFieldtypes fld_type = file(f.file()).curr().type(f.name());
|
||||
if (fld_type == _datefld) // Se il campo e' di tipo data, la converte in ANSI!
|
||||
{
|
||||
@ -1737,18 +1734,16 @@ const char* TFieldref::read(const TRectype& rec) const
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char* TFieldref::read(const TRelation* r) const
|
||||
const char* TFieldref::read(const TRelation& r) const
|
||||
{
|
||||
CHECK(r != NULL, "Can't read field from NULL relation");
|
||||
const TRectype& rec = _id.empty() ? r->curr() : r->lfile(_id).curr();
|
||||
const TRectype& rec = _id.empty() ? r.curr() : r.lfile(_id).curr();
|
||||
const char *s = read(rec);
|
||||
return s;
|
||||
}
|
||||
|
||||
void TFieldref::write(const char* val, TRelation* r) const
|
||||
void TFieldref::write(const char* val, TRelation& r) const
|
||||
{
|
||||
CHECK(r != NULL, "Can't write field on NULL relation");
|
||||
TRectype &rec = _id.empty() ? r->curr() : r->lfile(_id).curr();
|
||||
TRectype &rec = _id.empty() ? r.curr() : r.lfile(_id).curr();
|
||||
write(val, rec);
|
||||
}
|
||||
|
||||
@ -1758,7 +1753,7 @@ void TFieldref::write(const char* val, TRectype& rec) const
|
||||
if (_fileid >= CNF_GENERAL) return;
|
||||
if (_from > 0)
|
||||
{
|
||||
TString256 campo(rec.get(_name));
|
||||
TString campo(rec.get(_name));
|
||||
campo.overwrite(val, _from);
|
||||
rec.put(_name, campo);
|
||||
}
|
||||
@ -1795,7 +1790,7 @@ TRecord_array::TRecord_array(int logicnum, const char* numfield, int first)
|
||||
}
|
||||
|
||||
TRecord_array::TRecord_array(const TRecord_array& a)
|
||||
: TArray(a), _file(a._file), _offset(a._offset), _num(a._num)
|
||||
: TArray(a), _file(a._file), _offset(a._offset), _num(a._num)
|
||||
{}
|
||||
|
||||
void TRecord_array::set_key(TRectype* r)
|
||||
|
@ -595,11 +595,11 @@ class TFieldref : public TObject
|
||||
protected:
|
||||
// @cmember Stampa l'oggetto
|
||||
virtual void print_on(ostream& out) const;
|
||||
// @cmember Duplica l'oggetto TFieldref
|
||||
virtual TObject* dup() const;
|
||||
|
||||
// @access Public Memeber
|
||||
public:
|
||||
// @cmember Duplica l'oggetto TFieldref
|
||||
virtual TObject* dup() const;
|
||||
// @cmember Costruttore
|
||||
TFieldref();
|
||||
// @cmember Costruttore
|
||||
@ -640,11 +640,11 @@ public:
|
||||
// @cmember Ritorna la lunghezza del campo di <p TRectype>
|
||||
int len(TRectype &rec) const;
|
||||
// @cmember Cerca nella relazione il campo e ne ritorna il contenuto
|
||||
const char* read(const TRelation*) const;
|
||||
const char* read(const TRelation&) const;
|
||||
// @cmember Cerca nel record il campo e ne ritorna il contenuto
|
||||
const char* read(const TRectype&) const;
|
||||
// @cmember Cerca nella relazione il campo e vi scrive <p val>
|
||||
void write(const char* val, TRelation*) const;
|
||||
void write(const char* val, TRelation&) const;
|
||||
// @cmember Cerca nel record il campo e vi scrive <p val>
|
||||
void write(const char* val, TRectype& rec) const;
|
||||
};
|
||||
|
@ -18,7 +18,7 @@
|
||||
// @class TScanner | Classe per le lettura e la traduzione dei file
|
||||
//
|
||||
// @base private | ifstream
|
||||
class TScanner : private ifstream
|
||||
class TScanner : public ifstream
|
||||
// @author:(INTERNAL) Guido
|
||||
{
|
||||
// @access:(INTERNAL) Private Member
|
||||
|
1646
include/sheet.cpp
1646
include/sheet.cpp
File diff suppressed because it is too large
Load Diff
257
include/sheet.h
257
include/sheet.h
@ -1,163 +1,71 @@
|
||||
#ifndef __SHEET_H
|
||||
#define __SHEET_H
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#ifndef __MASK_H
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RELATION_H
|
||||
class TCursor;
|
||||
#endif
|
||||
|
||||
#ifndef __MASKFLD_H
|
||||
class TEdit_field;
|
||||
#endif
|
||||
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @class TSheet | Classe per la definizione e la gestione degli sheet per le ricerche
|
||||
//
|
||||
// @base public | TScroll_window
|
||||
class TSheet : public TScroll_window
|
||||
class TSheet : public TMask
|
||||
|
||||
// @author:(INTERNAL) Guido
|
||||
|
||||
// @access:(INTERNAL) Privete Member
|
||||
{
|
||||
// @ccost:(INTERNAL) MAX_BUT | 8 | Numero massimo di bottoni
|
||||
enum { MAX_BUT = 8,
|
||||
// @ccost:(INTERNAL) MAX_COL | 128 | Numero massimo di colonne
|
||||
MAX_COL = 128 };
|
||||
friend class TSheet_control;
|
||||
|
||||
// @cmember:(INTERNAL) Array di stringhe con il contenuto dello sheet
|
||||
TString_array _page;
|
||||
|
||||
// @cmember:(INTERNAL) Numero di colonne dello sheet
|
||||
byte _columns;
|
||||
// @cmember:(INTERNAL) Dimensione di ogni colonna
|
||||
byte _size[MAX_COL];
|
||||
// @cmember:(INTERNAL) Tipo di ogni colonne
|
||||
byte _type[MAX_COL];
|
||||
// @cmember:(INTERNAL) Riga corrente
|
||||
long _curr;
|
||||
// @cmember:(INTERNAL) Indice della prima riga visibile
|
||||
long _last_update;
|
||||
|
||||
// @cmember:(INTERNAL) Numero di righe visibili
|
||||
short _visible_rows;
|
||||
|
||||
// @cmember:(INTERNAL) Indica se e' possibile inserire un check (X di selezione) sulle righe sheet
|
||||
bool _checkable;
|
||||
// @cmember:(INTERNAL) Indica se e attivata la gestione dei check delle righe
|
||||
bool _check_enabled;
|
||||
// @cmember:(INTERNAL) Array di righe attivate
|
||||
TBit_array _checked;
|
||||
// @cmember:(INTERNAL) Array di righe disabilitate
|
||||
TBit_array _disabled;
|
||||
|
||||
// @cmember:(INTERNAL) Handles dei bottoni presenti nella finestra
|
||||
WINDOW _button[MAX_BUT];
|
||||
// @cmember:(INTERNAL) Tasto associato ad ogni bottone
|
||||
KEY _key[MAX_BUT];
|
||||
// @cmember:(INTERNAL) Maschera di bit corrispondente ai bottoni standard
|
||||
byte _buttonmask;
|
||||
TSheet_control* _sheet; // Spreadsheet contenuto
|
||||
|
||||
TToken_string _park; // Ultima riga richiesta
|
||||
long _parked; // Numero riga richiesta
|
||||
long _select_row; // Riga da selezionare
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Ritorna se il numero di colonne e' maggiore di 1
|
||||
bool head_on() const
|
||||
{ return _columns > 1; }
|
||||
// @cmember Indica se esitono i bottoni in fondo
|
||||
bool buttons_on() const
|
||||
{ return *_button != NULL_WIN; }
|
||||
// @cmember Ritorna il numero di righe visibili
|
||||
short visible_rows() const
|
||||
{ return _visible_rows; }
|
||||
// @cmember Ritorna il numero di righe riservate ai bottoni
|
||||
virtual short reserved_rows() const;
|
||||
// @cmember Crea la pagina
|
||||
void build_page(long first = -1);
|
||||
|
||||
// @cmember Converte le coordinate da logiche (caratteri) in coordinate fisiche (pixel)
|
||||
// (vedi <mf TWindow::log2dev>)
|
||||
virtual PNT log2dev(long x, long y) const;
|
||||
// @cmember Gestisce l'handler della finestra (vedi <mf TWindow::handler>)
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
// @cmember Gestisce la pressione del tasto (vedi <mf TWindow::on_key>)
|
||||
virtual bool on_key(KEY);
|
||||
// @cmember Fa' l'update della finestra (vedi <mf TWindow::update>)
|
||||
virtual void update();
|
||||
|
||||
// @cmember Setta il numero della prima riga dello sheet
|
||||
void set_first(long n);
|
||||
// @cmember Ritorna se la riga <p n>-esima e' visibile
|
||||
bool is_visible(long n) const
|
||||
{ return n >= first() && n < first()+visible_rows(); }
|
||||
|
||||
// @cmember Calcola la larghezza totale dello sheet virtuale
|
||||
int width() const;
|
||||
// @cmember Converte il numero di riga <p n> assoluto nell'indice dell'array <p _page>
|
||||
int row_to_page(long n) const;
|
||||
// @cmember Converte il numero di riga <p n> assoluto nella coordinata y sulla finestra
|
||||
int row_to_win(long n) const;
|
||||
|
||||
// @cmember Ritorna il numero della prima riga
|
||||
long first() const
|
||||
{ return origin().y; }
|
||||
// @cmember Forza il ridisegno di una riga
|
||||
bool update_row(long n);
|
||||
// @cmember Permette di scriveiere in inverso la riga <p n>-esima
|
||||
void invert_row(long n);
|
||||
|
||||
// @cmember Aggiunge una riga all'array di quelle visibile
|
||||
void set_row(const TToken_string& row, byte n);
|
||||
protected: // TMask
|
||||
// @cmember Lavori in background
|
||||
virtual void on_idle();
|
||||
|
||||
static bool tutti_handler(TMask_field& f, KEY k);
|
||||
|
||||
protected:
|
||||
virtual void get_row(long r, TToken_string& row) { row.cut(0); }
|
||||
virtual long get_items() const { return 0L; }
|
||||
|
||||
TSheet_control& sheet();
|
||||
|
||||
// @cmember Permette di riposizionare i bottoni all'interno della pagina
|
||||
virtual void repos_buttons() const;
|
||||
|
||||
// @cmember Copia le righe nella pagina da visualizzare
|
||||
virtual void page_build(long first, byte num) pure;
|
||||
|
||||
// @cmember Stampa lo sheet
|
||||
void print();
|
||||
|
||||
|
||||
void post_select(long rec);
|
||||
|
||||
// @access Public Member
|
||||
public: // TWindow
|
||||
// @cmember Gestisce la pressione del tasto (vedi <mf TWindow::on_key>)
|
||||
virtual bool on_key(KEY);
|
||||
|
||||
// @cmember Inizializzazione
|
||||
virtual void start_run();
|
||||
|
||||
public:
|
||||
// @cmember Costruttore
|
||||
TSheet(short x,short y,short dx,short dy,const char* title,const char* head,byte buttons = 0,long first = 0L,WINDOW parent = NULL_WIN);
|
||||
|
||||
// @cmember Mostra la finestra (vedi <mf TWindow::open>)
|
||||
virtual void open();
|
||||
|
||||
// @cmember Aggiunge un bottone nella finestra
|
||||
void add_button(short id, const char* caption, KEY key = K_ESC);
|
||||
void add_button(short id, const char* caption, KEY key);
|
||||
|
||||
// @cmember Ritorna il numero di elementi di <p _page>
|
||||
virtual long items() const pure;
|
||||
long items() const { return get_items(); }
|
||||
// @cmember Ritorna il contenuto di una riga
|
||||
virtual TToken_string& row(long s = -1);
|
||||
TToken_string& row(long s = -1);
|
||||
|
||||
// @cmember Ritorna il numero della riga corrente
|
||||
long selected() const
|
||||
{ return _curr; }
|
||||
long selected() const;
|
||||
// @cmember Seleziona una riga facendola diventare corrente
|
||||
void select(long n);
|
||||
virtual void select(long n);
|
||||
|
||||
// @cmember Ritorna il tipo della colonna <p c>-esima
|
||||
byte column_flag(int c) const
|
||||
{ return _type[c]; }
|
||||
// @cmember Ritorna il tipo della colonna <p c>-esima (permette di modificarlo)
|
||||
byte& column_flag(int c)
|
||||
{ return _type[c]; }
|
||||
|
||||
// @cmember Ritorna se la riga <p n>-esima e' attivata
|
||||
bool checked(long n) const
|
||||
{ return _checked[n]; }
|
||||
bool checked(long n) const;
|
||||
// @cmember Permette di attivare/disattivare una riga
|
||||
void check(long n, bool on = TRUE);
|
||||
// @cmember Permette di disattivare una riga (chiama <mf TSheet::check>)
|
||||
@ -165,30 +73,33 @@ public:
|
||||
{ check(n, FALSE); }
|
||||
// @cmember Permette di abilitare (<p yn> = TRUE) o disabilitare (<p yn> = FALSE)
|
||||
// la gestione dei check sullo sheet
|
||||
void enable_check(bool yn = TRUE)
|
||||
{ _check_enabled = yn; }
|
||||
void enable_check(bool on = TRUE);
|
||||
// @cmember Permette di disbilitare (<p yn> = FALSE) i check sullo sheet
|
||||
void disable_check()
|
||||
{ enable_check(FALSE); }
|
||||
// @cmember Ritorna TRUE se e' possibile mettere un check sulle righe
|
||||
bool check_enabled() const;
|
||||
|
||||
// @cmember Abilita/disabilita una riga
|
||||
void enable(long n = -1, bool on = TRUE);
|
||||
void enable_row(long n, bool on = TRUE);
|
||||
// @cmember Disabilita una riga (chiama <mf TSheet::enable>)
|
||||
void disable(long n = -1)
|
||||
{ enable(n, FALSE); }
|
||||
// @cmember Ritorna se e' abilitata la riiga <p n>-esima
|
||||
bool enabled(long n) const
|
||||
{ return !_disabled[n]; }
|
||||
// @cmember Ritorna se e' disabilitata la riiga <p n>-esima
|
||||
bool disabled(long n) const
|
||||
{ return _disabled[n]; }
|
||||
void disable_row(long n)
|
||||
{ enable_row(n, FALSE); }
|
||||
// @cmember Ritorna se e' abilitata la riga <p n>-esima
|
||||
bool row_enabled(long n) const;
|
||||
|
||||
// @cmember Ritrna se esiston elementi attivati nello sheet (TRUE se esitono)
|
||||
bool one_checked() const
|
||||
{ return _checked.first_one() != -1; }
|
||||
// @cmember Ritorna se esistono elementi attivati nello sheet (TRUE se esitono)
|
||||
bool one_checked() const;
|
||||
// @cmember Ritorna il numero di elementi attivati (vedi <mf TBit_array::ones>)
|
||||
long checked() const
|
||||
{ return _checked.ones(); }
|
||||
long checked() const;
|
||||
|
||||
// @cmember Costruttore
|
||||
TSheet(short x, short y, short dx, short dy,
|
||||
const char* title, const char* head,
|
||||
byte buttons = 0, short sht_y = 0);
|
||||
|
||||
// @cmember Distruttore
|
||||
virtual ~TSheet();
|
||||
};
|
||||
|
||||
// @doc EXTERNAL
|
||||
@ -207,19 +118,23 @@ class TArray_sheet : public TSheet
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Costruisce la pgaina (vedi <mf TSheet::page_build>)
|
||||
virtual void page_build(long first, byte num);
|
||||
// @cmember Ritorna il contenuto dell'elemento <p n>-esimo
|
||||
TToken_string& data(long n)
|
||||
{ return _data.row((int)n); }
|
||||
|
||||
// @cmember Ritorna la riga n
|
||||
virtual void get_row(long n, TToken_string& row)
|
||||
{ row = data(n); }
|
||||
|
||||
// @cmember Ritorna il numero degli elemnti dello sheet
|
||||
virtual long get_items() const
|
||||
{ return _data.items(); }
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Costruttore
|
||||
TArray_sheet(short x, short y, short dx, short dy, const char* caption, const char* head, byte buttons = 0, WINDOW parent = NULL_WIN);
|
||||
// @cmember Ritorna il numero degli elemnti dello sheet
|
||||
virtual long items() const
|
||||
{ return _data.items(); }
|
||||
TArray_sheet(short x, short y, short dx, short dy,
|
||||
const char* caption, const char* head, byte buttons = 0);
|
||||
// @cmember Ritorna il contenuto dello sheet
|
||||
TString_array& rows_array()
|
||||
{ return _data; }
|
||||
@ -229,9 +144,6 @@ public:
|
||||
long add(TToken_string* s);
|
||||
// @cmember Inserisce un elemento nella posizione
|
||||
long insert(const TToken_string& s, long n);
|
||||
// @cmember Ritorna la riga <p s>-esima dell'array
|
||||
virtual TToken_string& row(long s = -1)
|
||||
{ return (s < 0) ? data(selected()) : data(s); }
|
||||
// @cmember Azzera l'array dello sheet
|
||||
bool destroy(int i = -1);
|
||||
};
|
||||
@ -258,14 +170,16 @@ class TCursor_sheet : public TSheet
|
||||
|
||||
// @access Protected Member
|
||||
protected: // TSheet
|
||||
// @cmember Costruisce la pgaina (vedi <mf TSheet::page_build>)
|
||||
virtual void page_build(long first, byte rows);
|
||||
|
||||
// @cmember Ritorna il numero dei records del cursore
|
||||
virtual long get_items() const
|
||||
{ return _records; }
|
||||
|
||||
// @cmember Ritorna la riga n
|
||||
virtual void get_row(long n, TToken_string& row);
|
||||
|
||||
// @access Public Member
|
||||
public: // TSheet
|
||||
// @cmember Ritorna il numero dei records del cursore
|
||||
virtual long items() const
|
||||
{ return _records; }
|
||||
|
||||
// @cmember Lancia la finestra con lo sheet
|
||||
virtual KEY run();
|
||||
@ -277,7 +191,9 @@ public:
|
||||
{ return _cursor; }
|
||||
|
||||
// @cmember Costruttore
|
||||
TCursor_sheet(TCursor* cursor, const char* fields, const char* title, const char* head, byte buttons = 0);
|
||||
TCursor_sheet(TCursor* cursor, const char* fields,
|
||||
const char* title, const char* head,
|
||||
byte buttons = 0, short sht_y = 0);
|
||||
// @cmember Distruttore
|
||||
virtual ~TCursor_sheet()
|
||||
{}
|
||||
@ -296,27 +212,29 @@ class TBrowse_sheet : public TCursor_sheet
|
||||
{
|
||||
// @cmember:(INTERNAL) Campi collegati ai campi editabili (vedi <c TEdit_field>)
|
||||
TEdit_field* const _field;
|
||||
// @cmember:(INTERNAL) Riga selezionata
|
||||
|
||||
// @cmember:(INTERNAL) Campo di ricerca attuale (Tag button selezionato)
|
||||
int _sel;
|
||||
|
||||
|
||||
long _select_row;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Gestisce l'handler della finestra (vedi <mf TWindow::handler>)
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
// @cmember Ritorna il numero di righe riservate
|
||||
virtual short reserved_rows() const;
|
||||
// @cmember Permette di riposizionare i bottoni nella finestra
|
||||
virtual void repos_buttons() const;
|
||||
// @cmember Gestisce la pressione del tasto (vedi <mf TWindow::on_key>)
|
||||
virtual bool on_key(KEY k);
|
||||
|
||||
// @cmember Ritorna il campo a cui si riferisce lo sheet
|
||||
TEdit_field& field()
|
||||
{ return *_field; }
|
||||
|
||||
|
||||
static bool browse_field_handler(TMask_field& f, KEY k);
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Costruttore
|
||||
TBrowse_sheet(TCursor* cursor, const char* fields, const char* title, const char* head, byte buttons, TEdit_field* f, TToken_string* siblings = NULL);
|
||||
TBrowse_sheet(TCursor* cursor, const char* fields, const char* title,
|
||||
const char* head, byte buttons,
|
||||
TEdit_field* f, TToken_string& siblings);
|
||||
// @cmember Distruttore
|
||||
virtual ~TBrowse_sheet()
|
||||
{}
|
||||
@ -324,5 +242,4 @@ public:
|
||||
virtual KEY run();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -100,10 +100,6 @@ void free_global_vars()
|
||||
#ifndef FOXPRO
|
||||
#include <xvt.h>
|
||||
|
||||
#ifdef DBG
|
||||
unsigned long _alloc_count = 0;
|
||||
#endif
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @func Operatore per la creazione di un oggetto (sostituisce operatore C++)
|
||||
@ -112,7 +108,7 @@ unsigned long _alloc_count = 0;
|
||||
void* operator new(size_t size)
|
||||
|
||||
// @comm Per maggiori informazioni fare riferimento all'omonimo comando sull'help
|
||||
// in linea del C++.
|
||||
// in linea del C++.
|
||||
// <nl>Questa funzione viene implementata se non si opera in ambiante FoxPro.
|
||||
|
||||
{
|
||||
@ -120,10 +116,6 @@ void* operator new(size_t size)
|
||||
if (mem == NULL)
|
||||
fatal_box("Out of memory: can't allocate %u bytes", size);
|
||||
|
||||
#ifdef DBG
|
||||
_alloc_count++;
|
||||
#endif
|
||||
|
||||
return mem;
|
||||
}
|
||||
// @doc EXTERNAL
|
||||
@ -133,7 +125,7 @@ void operator delete(
|
||||
void* ptr) // @parm Puntatore all'oggetto da distruggere
|
||||
|
||||
// @comm Per maggiori informazioni fare riferimento all'omonimo comando sull'help
|
||||
// in linea del C++.
|
||||
// in linea del C++.
|
||||
// <nl>Nel caso venga passato un puntatore NULL viene emesso un <f CKECK>.
|
||||
// <nl>Questa funzione viene implementata se non si opera in ambiante FoxPro.
|
||||
|
||||
|
@ -347,17 +347,16 @@ int TString::replace(char find_char, char replace_char)
|
||||
{
|
||||
const int l = len();
|
||||
int n = 0;
|
||||
|
||||
for (int i = 0; i<l; i++)
|
||||
for (int i = 0; i < l; i++)
|
||||
if (_str[i] == find_char)
|
||||
{
|
||||
_str[i] = replace_char;
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
// Certified 99%
|
||||
// @doc EXTERNAL
|
||||
|
||||
@ -796,13 +795,23 @@ TString& TString::insert(
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Villa's megasmart hash function
|
||||
// Certified 90%
|
||||
word TString::hash() const
|
||||
{
|
||||
/*
|
||||
// Villa's megasmart hash function
|
||||
word h = 0x0000;
|
||||
for (int i = 0; _str[i]; i++)
|
||||
h ^= (i & 0x1) ? (_str[i] << 8) : _str[i];
|
||||
*/
|
||||
// Peter Weinberger's (PJW) generic hashing
|
||||
word h = 0;
|
||||
for (const char* s = _str; *s; s++)
|
||||
{
|
||||
h = (h << 2) + *s;
|
||||
const word i = h & 0xC000;
|
||||
if (i) h = (h ^ (i >> 12)) & 0x3FFF;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
int find(char, int from = 0) const;
|
||||
// @cmember Ritorna la posizione della stringa s nell'oggetto TString
|
||||
int find(const char* s, int from = 0) const;
|
||||
// @cmember Rimpiazza tutte le occorrenze del carattere find_char con il carattere replace_char. Ritorna il numero di sostituzioni effettuate.
|
||||
// @cmember Sostituisce le occorrenze di <p find_char> col carattere <p replace_char>
|
||||
int replace(char find_char, char replace_char);
|
||||
|
||||
// @cmember Ritorna l'oggetto TString composto dai count caratteri da sinistra
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <text.h>
|
||||
#include <fstream.h>
|
||||
#include <ctype.h>
|
||||
#include <applicat.h>
|
||||
|
||||
static char TEXT_TMP[512];
|
||||
#include <text.h>
|
||||
#include <xvtility.h>
|
||||
|
||||
static char TEXT_TMP[513];
|
||||
|
||||
class _HotSpot : public TObject
|
||||
{
|
||||
@ -57,7 +57,7 @@ style TTextfile::_trans_style (char ch)
|
||||
|
||||
void TTextfile::_save_changes()
|
||||
{
|
||||
main_app().begin_wait();
|
||||
begin_wait();
|
||||
// fa i dovuti replace anche sul disco (solo replace di linee esistenti)
|
||||
long line = 0l;
|
||||
|
||||
@ -114,7 +114,7 @@ void TTextfile::_save_changes()
|
||||
_filename = oldfile;
|
||||
_instr = fopen(_filename, "a+");
|
||||
|
||||
main_app().end_wait();
|
||||
end_wait();
|
||||
}
|
||||
|
||||
void TTextfile::_read_page (long n)
|
||||
@ -464,7 +464,7 @@ int TTextfile::replace(
|
||||
bool sforating = FALSE;
|
||||
|
||||
// here's a nice casin
|
||||
while(i < 512)
|
||||
while(i < 256)
|
||||
{
|
||||
if (!sforating)
|
||||
{
|
||||
@ -741,18 +741,18 @@ bool TTextfile::write (
|
||||
int endx = to == NULL ? -1 : (int) to->x;
|
||||
for (long j = starty; j <= endy; j++)
|
||||
{
|
||||
s = line (j);
|
||||
s = line(j);
|
||||
if (j == endy && endx == -1)
|
||||
endx = s.len ();
|
||||
endx = s.len();
|
||||
|
||||
if (j == starty && j == endy)
|
||||
s = s.sub (startx, endx);
|
||||
s = s.sub(startx, endx);
|
||||
else if (j == starty)
|
||||
s = s.mid (startx);
|
||||
s = s.mid(startx);
|
||||
else if (j == endy)
|
||||
s = s.left (endx);
|
||||
s = s.left(endx);
|
||||
|
||||
fprintf (fp, "%s\n", (const char *) s);
|
||||
fprintf(fp, "%s\n", (const char *) s);
|
||||
}
|
||||
fclose (fp);
|
||||
}
|
||||
@ -761,6 +761,37 @@ bool TTextfile::write (
|
||||
return ok;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Scrive il testo da punto a punto (non formattato) su string_array
|
||||
void TTextfile::write(
|
||||
TString_array& arr, // @parm Array in cui scrivere il testo
|
||||
TPoint * from, // @parm Punto da cui iniziare a scrivere il testo
|
||||
TPoint * to) // @parm Punto a cui terminare di scrivere il testo
|
||||
{
|
||||
arr.destroy();
|
||||
TString s(512);
|
||||
long starty = from == NULL ? 0l : from->y;
|
||||
int startx = from == NULL ? 0 : (int) from->x;
|
||||
long endy = to == NULL ? _lines - 1l : to->y;
|
||||
int endx = to == NULL ? -1 : (int) to->x;
|
||||
for (long j = starty; j <= endy; j++)
|
||||
{
|
||||
s = line(j);
|
||||
if (j == endy && endx == -1)
|
||||
endx = s.len();
|
||||
|
||||
if (j == starty && j == endy)
|
||||
s = s.sub(startx, endx);
|
||||
else if (j == starty)
|
||||
s = s.mid(startx);
|
||||
else if (j == endy)
|
||||
s = s.left(endx);
|
||||
|
||||
arr.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
void TTextfile::destroy ()
|
||||
{
|
||||
CHECK (_istemp, "destroy() chiamata su testo permanente!");
|
||||
@ -793,7 +824,7 @@ TTextfile ::TTextfile (const char *file, int pagesize, direction preferred,
|
||||
bool interactive):
|
||||
_page_size (pagesize), _page (pagesize), _filename (file), _lines (0l),
|
||||
_index (NULL), _page_start (0l), _page_end (-1l), _direction (preferred),
|
||||
_dirty (FALSE), _istemp (FALSE), _item (0), _line (512), _cur_line (-1),
|
||||
_dirty (FALSE), _istemp (FALSE), _item (0), _line (256), _cur_line (-1),
|
||||
_hotspots (4), _accept (TRUE), _dirty_lines(pagesize),
|
||||
_interactive(interactive), _rel(NULL)
|
||||
|
||||
|
@ -9,13 +9,12 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#ifndef __RELATION_H
|
||||
#include <relation.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RELATION_H
|
||||
//class TRelation;
|
||||
#include <relation.h>
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#endif
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -175,6 +174,8 @@ public:
|
||||
|
||||
// @cmember Scrive il testo (non formattato) su file
|
||||
bool write(const char* path, TPoint* from = NULL, TPoint* to = NULL);
|
||||
// @cmember Scrive il testo (non formattato) su TString_array
|
||||
void write(TString_array& a, TPoint* from = NULL, TPoint* to = NULL);
|
||||
// @cmember Disfa tutto e svuota il file
|
||||
void destroy();
|
||||
|
||||
|
@ -1,36 +1,46 @@
|
||||
BUTTON DLG_SAVEREC 8 2
|
||||
BUTTON DLG_SAVEREC 10 2
|
||||
BEGIN
|
||||
PROMPT -16 -1 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
PROMPT -16 -1 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
PICTURE 103
|
||||
PICTURE 153
|
||||
END
|
||||
|
||||
BUTTON DLG_NEWREC 8 2
|
||||
BUTTON DLG_NEWREC 10 2
|
||||
BEGIN
|
||||
PROMPT -26 -1 "~Nuovo"
|
||||
MESSAGE EXIT,K_INS
|
||||
PROMPT -26 -1 "~Nuovo"
|
||||
MESSAGE EXIT,K_INS
|
||||
PICTURE 105
|
||||
PICTURE 155
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 8 2
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BEGIN
|
||||
PROMPT -36 -1 "~Elimina"
|
||||
MESSAGE EXIT,K_DEL
|
||||
PROMPT -36 -1 "~Elimina"
|
||||
MESSAGE EXIT,K_DEL
|
||||
PICTURE 104
|
||||
PICTURE 154
|
||||
END
|
||||
|
||||
BUTTON DLG_FINDREC 8 2
|
||||
BUTTON DLG_FINDREC 10 2
|
||||
BEGIN
|
||||
PROMPT -46 -1 "Ri~cerca"
|
||||
MESSAGE EXIT,K_F9
|
||||
PROMPT -46 -1 "Ri~cerca"
|
||||
MESSAGE EXIT,K_F9
|
||||
PICTURE 126
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 8 2
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -56 -1 ""
|
||||
MESSAGE EXIT,K_ESC
|
||||
PROMPT -56 -1 "~Annulla"
|
||||
MESSAGE EXIT,K_ESC
|
||||
PICTURE 102
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 8 2
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -66 -1 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
PROMPT -66 -1 "~Fine"
|
||||
MESSAGE EXIT,K_QUIT
|
||||
PICTURE 114
|
||||
PICTURE 164
|
||||
END
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
|
||||
#define ICO_SEARCH 109
|
||||
#define ICO_CHECK_ON 110
|
||||
#define ICO_CHECK_OFF 111
|
||||
|
||||
#define BMP_OK 101
|
||||
#define BMP_CANCEL 102
|
||||
|
@ -74,8 +74,8 @@ HIDDEN bool _emptycopy_val(TMask_field& f, KEY)
|
||||
// @flag TRUE | Se il valore della Partita IVA assume un valore corretto
|
||||
// @flag FALSE | Se il valore della Partita IVA non puo' essere valido
|
||||
bool pi_check(
|
||||
const char* st, // @parm Stato di assegnazione della Partita IVA
|
||||
const char* paiva) // @parm Codice della Partita IVA da controllare
|
||||
const char* st, // @parm Stato di assegnazione della Partita IVA
|
||||
const char* paiva) // @parm Codice della Partita IVA da controllare
|
||||
{
|
||||
int tot = 0, y;
|
||||
TString16 stato (st);
|
||||
@ -468,7 +468,7 @@ HIDDEN bool _mtcheck_val(TMask_field& f, KEY)
|
||||
d.read();
|
||||
if (d.bad()) return TRUE;
|
||||
if (d.get_char(NDT_FREQVIVA) == 'M') return TRUE;
|
||||
return month == 13 || (month % 3) == 0;
|
||||
return month == 13 || (month % 3) == 0;
|
||||
}
|
||||
|
||||
|
||||
@ -496,6 +496,7 @@ HIDDEN bool _autoexit_val(TMask_field& f, KEY key)
|
||||
if (!m.query_mode() || key == K_ENTER)
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
const int next = m.next_fld();
|
||||
|
||||
if (next != DLG_NULL && next != f.dlg() && m.field(next).in_key(0))
|
||||
@ -506,6 +507,7 @@ HIDDEN bool _autoexit_val(TMask_field& f, KEY key)
|
||||
if (f.in_key(k) && m.field(next).in_key(k))
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
const int nparms = get_val_param_num();
|
||||
bool one_not_empty = FALSE;
|
||||
@ -624,11 +626,12 @@ HIDDEN bool _zerofill_val(TMask_field& f, KEY k)
|
||||
if (f.to_check(k))
|
||||
{
|
||||
const int columns = atoi(get_val_param(0));
|
||||
TString& val = f.get();
|
||||
const TString& val = f.get();
|
||||
if (val.len() < columns && real::is_natural(val))
|
||||
{
|
||||
val.right_just(columns, '0');
|
||||
f.set(val);
|
||||
{
|
||||
TString z(val);
|
||||
z.right_just(columns, '0');
|
||||
f.set(z);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -650,9 +653,11 @@ HIDDEN bool _not_empty_chkfld_val(TMask_field& f, KEY k)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
if (f.to_check(k) && f.get().not_empty())
|
||||
{
|
||||
{
|
||||
/*
|
||||
TBrowse * b = ((TEdit_field&)f).browse();
|
||||
if (b != NULL) ok = b->check(k == K_TAB ? RUNNING_CHECK : FINAL_CHECK);
|
||||
*/
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -835,10 +840,10 @@ HIDDEN VAL_FUNC _global_val_func[MAX_FUNC] =
|
||||
// @flag TRUE | Il campo e' positivo al controllo
|
||||
// @flag FALSE | Il campo non ha i requisiti necessari per passare il controllo
|
||||
bool validate(
|
||||
int fn, // @parm Numero della funzione da effettuare
|
||||
TMask_field& f, // @parm Identificatore del campo da controllare
|
||||
KEY k, // @parm Codice del tasto premuto sul campo
|
||||
const TArray& parms) // @parm Array di paramtri per effettuare il controllo
|
||||
int fn, // @parm Numero della funzione da effettuare
|
||||
TMask_field& f, // @parm Identificatore del campo da controllare
|
||||
KEY k, // @parm Codice del tasto premuto sul campo
|
||||
const TArray& parms) // @parm Array di paramtri per effettuare il controllo
|
||||
{
|
||||
_parms = &parms;
|
||||
return (fn >= 0 && fn < MAX_FUNC) ? _global_val_func[fn](f, k) : TRUE;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: value.h,v 1.3 1995-03-16 13:44:07 alex Exp $
|
||||
// $Id: value.h,v 1.4 1996-05-08 11:08:39 guy Exp $
|
||||
// language types for Simulation and SimulationManager
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include <browfile.h>
|
||||
#include <colors.h>
|
||||
#include <config.h>
|
||||
#include <defmask.h>
|
||||
#include <controls.h>
|
||||
#include <execp.h>
|
||||
#include <mailbox.h>
|
||||
#include <printapp.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <viswin.h>
|
||||
#include <xvtility.h>
|
||||
|
||||
#include <bagn005.h>
|
||||
|
||||
@ -28,13 +26,12 @@ const int PRINT_HEIGHT = 10;
|
||||
#define DLG_PRINT_TITLE "~Stampa"
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define BACKGROUND (_toplevel ? MASK_BACK_COLOR : COLOR_GRAY)
|
||||
#define FOREGROUND (_toplevel ? COLOR_BLACK : COLOR_WHITE)
|
||||
#else
|
||||
#define BACKGROUND COLOR_BLACK
|
||||
#define FOREGROUND COLOR_WHITE
|
||||
#endif
|
||||
|
||||
#define K_CTRL_DOWN (K_CTRL + K_DOWN)
|
||||
#define K_CTRL_UP (K_CTRL + K_UP)
|
||||
@ -45,6 +42,7 @@ const int PRINT_HEIGHT = 10;
|
||||
#define K_ALT_RIGHT (K_CTRL + 'K')
|
||||
#define K_ALT_LEFT (K_CTRL + 'L')
|
||||
#define CTRL_C (K_CTRL + 'C')
|
||||
#define CTRL_G (K_CTRL + 'G')
|
||||
#define CTRL_E (K_CTRL + 'E')
|
||||
#define CTRL_S (K_CTRL + 'S')
|
||||
#define CTRL_R (K_CTRL + 'R')
|
||||
@ -177,7 +175,7 @@ void TViswin::build_index_menu()
|
||||
{
|
||||
BkDef& bkd = (BkDef&)(*_bookmarks)[i];
|
||||
|
||||
tt = format("%d", bkd._id + 1000);
|
||||
tt.format("%d", bkd._id + 1000);
|
||||
tt.add(bkd._txt);
|
||||
|
||||
_BkMenuItem* bkit = new _BkMenuItem((const char*)tt);
|
||||
@ -276,13 +274,13 @@ void TViswin::display_link (long y, long x1, long x2, const char *d)
|
||||
paint_link (y, x1, x2);
|
||||
_link_displayed = TRUE;
|
||||
if (in_update) return;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
|
||||
TString80 dd; dd.strncpy(d, 40);
|
||||
xvt_statbar_set(dd);
|
||||
#endif
|
||||
if (_link_button != -1)
|
||||
|
||||
if (_link_button)
|
||||
{
|
||||
if (_showbuts) xvt_enable_control (_link_button, TRUE);
|
||||
if (_showbuts) _link_button->enable();
|
||||
if (_toplevel) enable_menu_item(M_EDIT_CUT, TRUE);
|
||||
}
|
||||
if (!_toplevel && !_inside_linkexec)
|
||||
@ -312,13 +310,13 @@ void TViswin::erase_link (
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (!in_update)
|
||||
{
|
||||
xvt_statbar_set ("");
|
||||
xvt_statbar_refresh ();
|
||||
xvt_statbar_set("");
|
||||
xvt_statbar_refresh();
|
||||
}
|
||||
#endif
|
||||
if (_link_button != -1)
|
||||
if (_link_button)
|
||||
{
|
||||
if (_showbuts) xvt_enable_control (_link_button, FALSE);
|
||||
if (_showbuts) _link_button->disable();
|
||||
if (_toplevel) enable_menu_item(M_EDIT_CUT, FALSE);
|
||||
}
|
||||
}
|
||||
@ -508,13 +506,17 @@ void TViswin::erase_selection ()
|
||||
if (_sel_displayed)
|
||||
paint_selection ();
|
||||
_sel_displayed = FALSE;
|
||||
if (_toplevel)
|
||||
enable_menu_item(M_EDIT_COPY, FALSE);
|
||||
}
|
||||
|
||||
void TViswin::display_selection ()
|
||||
{
|
||||
if (!_sel_displayed)
|
||||
paint_selection ();
|
||||
_sel_displayed = TRUE;
|
||||
_sel_displayed = TRUE;
|
||||
if (_toplevel)
|
||||
enable_menu_item(M_EDIT_COPY, TRUE);
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -575,73 +577,55 @@ void TViswin::shift_screen(scroll dir)
|
||||
|
||||
// @mfunc Aggiunge un bottone alla finestra
|
||||
//
|
||||
// @rdesc Ritorna l'handle del bottone aggiunto
|
||||
WINDOW TViswin::add_button (
|
||||
// @rdesc Ritorna un puntatore al bottone (TControl) aggiunto
|
||||
TPushbutton_control* TViswin::add_button (
|
||||
short id, // @parm Identificatore del bottone da aggiungere
|
||||
const char *caption) // @parm Testo del bottone da aggiungere
|
||||
const char *caption, // @parm Testo del bottone da aggiungere
|
||||
short bup, // @parm Identificatore della bitmap normale
|
||||
short bdn) // @parm Identificatore della bitmap pramuta
|
||||
|
||||
// @comm Questa funzione aggiunge bottoni nella finestra oltre a quelli standard delle finestre
|
||||
// di visualizazioni anteprima di stampa. Il limite dei bottoni da aggiungere e' dato
|
||||
// dal <p MAXBUT>.
|
||||
// @comm Aggiunge i bottoni nella finestra
|
||||
{
|
||||
const int BUT_HEIGHT =
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
2
|
||||
#else
|
||||
1
|
||||
#endif
|
||||
;
|
||||
WINDOW b = xvt_create_control (WC_PUSHBUTTON, 0, 0, 11,
|
||||
BUT_HEIGHT, caption, win (), 0, 0, id);
|
||||
|
||||
for (int i = 0; i < MAXBUT; i++)
|
||||
if (_button[i] == NULL_WIN)
|
||||
{
|
||||
_button[i] = b;
|
||||
break;
|
||||
}
|
||||
TPushbutton_control* b = new TPushbutton_control(win(), id, -11, -1, 11, 2, "",
|
||||
caption, bup, bdn);
|
||||
_button.add(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
void TViswin::repos_buttons ()
|
||||
{
|
||||
if (!_toplevel) return;
|
||||
for (int buttons = 0; _button[buttons] != NULL_WIN; buttons++)
|
||||
if (buttons == MAXBUT - 1)
|
||||
{
|
||||
buttons++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (buttons == 0)
|
||||
return;
|
||||
|
||||
autoscroll(FALSE);
|
||||
set_mode(M_COPY);
|
||||
set_brush(BACKGROUND);
|
||||
bar(5, rows()-BUTTONROW_SIZE, columns()+1, rows()+1);
|
||||
autoscroll(TRUE);
|
||||
|
||||
RCT wr;
|
||||
xvt_vobj_get_client_rect(win(), &wr);
|
||||
RCT br;
|
||||
xvt_vobj_get_client_rect(_button[0], &br);
|
||||
|
||||
int space = (wr.right - buttons * br.right) / (buttons + 1);
|
||||
if (space < 0)
|
||||
space = 0;
|
||||
|
||||
int x = space;
|
||||
const int y = wr.bottom - br.bottom - 4;
|
||||
for (int b = 0; b < buttons; b++, x += br.right + space)
|
||||
{
|
||||
if (_toplevel)
|
||||
{
|
||||
RCT r;
|
||||
xvt_rect_set (&r, x, y, x + br.right, y + br.bottom);
|
||||
xvt_vobj_move (_button[b], &r);
|
||||
}
|
||||
// autoscroll(FALSE);
|
||||
// set_mode(M_COPY);
|
||||
// set_brush(BACKGROUND);
|
||||
// bar(5, rows()-BUTTONROW_SIZE, columns()+1, rows()+1);
|
||||
// autoscroll(TRUE);
|
||||
|
||||
for (int i = 0; i < _modules.items(); i++)
|
||||
((TImage&)_modules[i]).set_pos(4, 4+int(rows()-BUTTONROW_SIZE)*CHARY);
|
||||
|
||||
for (int i = 0; i < _modules.items(); i++)
|
||||
((TImage&)_modules[i]).set_pos(4, 4+int(rows()-BUTTONROW_SIZE)*CHARY);
|
||||
const int buttons = _button.items();
|
||||
if (buttons > 0)
|
||||
{
|
||||
RCT br; ((TPushbutton_control&)_button[0]).get_rect(br);
|
||||
const short width = br.right - br.left;
|
||||
RCT wr; xvt_vobj_get_client_rect(win(), &wr);
|
||||
int space = ((wr.right - wr.left) - buttons * (br.right-br.left)) / (buttons + 1);
|
||||
if (space < 0)
|
||||
space = 0;
|
||||
|
||||
int x = space;
|
||||
const int y = (wr.bottom - wr.top) - (br.bottom - br.top) - XI_FU_MULTIPLE;
|
||||
for (int b = 0; b < buttons; b++)
|
||||
{
|
||||
const PNT p = { y, x };
|
||||
xvt_rect_set_pos(&br, p);
|
||||
((TPushbutton_control&)_button[b]).set_rect(br);
|
||||
x += space + width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TViswin::open ()
|
||||
@ -1181,7 +1165,15 @@ void TViswin::paint_waitbar (
|
||||
autoscroll (TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TViswin::txt_clear(COLOR color)
|
||||
{
|
||||
autoscroll(FALSE);
|
||||
set_brush(color);
|
||||
set_mode(M_COPY);
|
||||
bar ((X_OFFSET-1), Y_OFFSET -1, columns()+1, rows()-BUTTONROW_SIZE);
|
||||
}
|
||||
|
||||
void TViswin::update ()
|
||||
{
|
||||
if (_scrolling)
|
||||
@ -1194,26 +1186,26 @@ void TViswin::update ()
|
||||
set_mode(M_COPY);
|
||||
if (_showbuts)
|
||||
{
|
||||
set_brush (BACKGROUND);
|
||||
bar ((X_OFFSET-1), rows()-BUTTONROW_SIZE, columns()+1, rows() + 1);
|
||||
// set_brush (BACKGROUND);
|
||||
// bar ((X_OFFSET-1), rows()-BUTTONROW_SIZE, columns()+1, rows() + 1);
|
||||
}
|
||||
if (_need_update)
|
||||
{
|
||||
check_link();
|
||||
if (_isselection)
|
||||
erase_selection ();
|
||||
clear(COLOR_WHITE);
|
||||
set_mode (M_COPY);
|
||||
txt_clear(COLOR_WHITE);
|
||||
// set_mode (M_COPY);
|
||||
set_brush (BACKGROUND);
|
||||
autoscroll (FALSE);
|
||||
// autoscroll (FALSE);
|
||||
|
||||
if (_rulers)
|
||||
{
|
||||
bar (0, 0, columns() + 1, 1);
|
||||
bar (0, 0, 5, rows() + 1);
|
||||
}
|
||||
if (_showbuts)
|
||||
bar ((X_OFFSET -1), rows()-BUTTONROW_SIZE, columns() + 1, rows() + 1);
|
||||
// if (_showbuts)
|
||||
// bar ((X_OFFSET -1), rows()-BUTTONROW_SIZE, columns() + 1, rows() + 1); //**
|
||||
if (_showbuts && _isopen)
|
||||
paint_waitbar (FALSE);
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
@ -1266,8 +1258,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
static bool ignore = FALSE;
|
||||
bool tlnk = FALSE;
|
||||
int kdiff;
|
||||
long new_origin;
|
||||
bool scrollated = FALSE;
|
||||
long new_origin;
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_USER:
|
||||
@ -1289,7 +1280,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
if (_txt.lines () > 1l)
|
||||
_need_update = FALSE;
|
||||
else
|
||||
/*force_*/update ();
|
||||
force_update ();
|
||||
}
|
||||
autoscroll (FALSE);
|
||||
_textrows = TEXTROWS;
|
||||
@ -1310,7 +1301,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
dispatch_e_char(win, K_ESC);
|
||||
break;
|
||||
case M_EDIT_CUT: // collega
|
||||
dispatch_e_char(win, CTRL_C);
|
||||
dispatch_e_char(win, CTRL_G);
|
||||
break;
|
||||
case M_EDIT_PASTE: // esporta
|
||||
dispatch_e_char(win, CTRL_E);
|
||||
@ -1337,8 +1328,8 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
#endif
|
||||
stop_run (K_ENTER);
|
||||
break;
|
||||
case M_EDIT_COPY: // copia
|
||||
// ???
|
||||
case M_EDIT_COPY: // copia nella clipboard
|
||||
dispatch_e_char(win, CTRL_C);
|
||||
break;
|
||||
case M_EDIT_CLEAR: // annulla selezione
|
||||
dispatch_e_char(win,K_ENTER);
|
||||
@ -1515,6 +1506,18 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
break;
|
||||
case E_MOUSE_MOVE:
|
||||
{
|
||||
/*
|
||||
if (!_selecting && !_iscross) // no buttons pressed
|
||||
{
|
||||
p = ep->v.mouse.where;
|
||||
if (in_text (p))
|
||||
{
|
||||
p.x += (origin ().x - 6);
|
||||
p.y += (origin ().y - 1);
|
||||
check_link (&p);
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (_selecting || _iscross)
|
||||
{
|
||||
p = ep->v.mouse.where;
|
||||
@ -1796,8 +1799,8 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
// for failed scrollings
|
||||
if (!_selecting && _need_scroll == none)
|
||||
{
|
||||
check_link(&_point);
|
||||
display_point();
|
||||
check_link (&_point);
|
||||
display_point ();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1807,34 +1810,27 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
if (_need_scroll != none)
|
||||
{
|
||||
_need_update = FALSE;
|
||||
scrollated = TRUE;
|
||||
scroll tmp = _need_scroll;
|
||||
_need_scroll = none;
|
||||
shift_screen (tmp);
|
||||
if (!_selecting)
|
||||
{
|
||||
check_link(&_point);
|
||||
display_point();
|
||||
check_link (&_point);
|
||||
display_point ();
|
||||
}
|
||||
if (_isselection)
|
||||
display_selection();
|
||||
display_selection ();
|
||||
}
|
||||
if (ep->type != E_UPDATE || _need_update)
|
||||
TWindow::handler(win, ep);
|
||||
TWindow ::handler (win, ep);
|
||||
else if (ep->type == E_UPDATE)
|
||||
{
|
||||
if (!scrollated)
|
||||
_need_update = TRUE;
|
||||
update();
|
||||
if (scrollated) display_point();
|
||||
}
|
||||
update ();
|
||||
}
|
||||
|
||||
bool TViswin::on_key (KEY key)
|
||||
{
|
||||
EVENT_TYPE type = E_USER;
|
||||
bool disp = FALSE;
|
||||
|
||||
|
||||
if (_istimer)
|
||||
return TRUE;
|
||||
_timer = xvt_timer_create (win (), 50l);
|
||||
@ -1867,23 +1863,26 @@ bool TViswin::on_key (KEY key)
|
||||
check_link (&_point);
|
||||
}
|
||||
break;
|
||||
case CTRL_C:
|
||||
case CTRL_G:
|
||||
exec_link();
|
||||
break;
|
||||
case CTRL_C:
|
||||
sel_to_clipboard();
|
||||
break;
|
||||
case CTRL_S:
|
||||
if (_isprint)
|
||||
stop_run(CTRL_S);
|
||||
break;
|
||||
case CTRL_R:
|
||||
_need_update = TRUE;
|
||||
check_link();
|
||||
force_update();
|
||||
do_events();
|
||||
check_link(&_point);
|
||||
check_link ();
|
||||
force_update ();
|
||||
do_events ();
|
||||
check_link (&_point);
|
||||
break;
|
||||
case K_ESC:
|
||||
if (_isopen)
|
||||
abort_print();
|
||||
abort_print ();
|
||||
else
|
||||
{
|
||||
|
||||
@ -1911,7 +1910,7 @@ bool TViswin::on_key (KEY key)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_curbut == (_buttons - 1))
|
||||
if (_curbut == (_button.items() - 1))
|
||||
_curbut = 0;
|
||||
else
|
||||
_curbut++;
|
||||
@ -1920,32 +1919,32 @@ bool TViswin::on_key (KEY key)
|
||||
|
||||
case K_BTAB:
|
||||
if (_curbut == 0)
|
||||
_curbut = _buttons - 1;
|
||||
_curbut = _button.items() - 1;
|
||||
else
|
||||
_curbut--;
|
||||
break;
|
||||
case K_SPACE:
|
||||
case K_CTRL_ENTER:
|
||||
if (_linkID != -1)
|
||||
{
|
||||
exec_link();
|
||||
}
|
||||
/*
|
||||
else if (_toplevel)
|
||||
dispatch_e_char (_button[_curbut], K_SPACE);
|
||||
*/
|
||||
break;
|
||||
case K_LHOME:
|
||||
_need_update = TRUE;
|
||||
update_thumb (0, 0);
|
||||
_point.set (0, 0);
|
||||
check_link (&_point);
|
||||
force_update ();
|
||||
force_update();
|
||||
break;
|
||||
case K_LEND:
|
||||
_need_update = TRUE;
|
||||
update_thumb (0, _txt.lines () - _textrows);
|
||||
_point.set (0, _txt.lines () - 1);
|
||||
check_link (&_point);
|
||||
force_update ();
|
||||
force_update();
|
||||
break;
|
||||
case K_RIGHT:
|
||||
case K_LEFT:
|
||||
@ -2005,16 +2004,16 @@ bool TViswin::on_key (KEY key)
|
||||
dispatch_e_scroll (win(), K_TAB);
|
||||
break;
|
||||
case K_CTRL_UP:
|
||||
disp = TRUE; dispatch_e_scroll (win(), K_UP);
|
||||
dispatch_e_scroll (win(), K_UP);
|
||||
break;
|
||||
case K_CTRL_DOWN:
|
||||
disp = TRUE; dispatch_e_scroll (win(), K_DOWN);
|
||||
dispatch_e_scroll (win(), K_DOWN);
|
||||
break;
|
||||
case K_ALT_LEFT:
|
||||
disp = TRUE; dispatch_e_scroll (win(), K_LEFT);
|
||||
dispatch_e_scroll (win(), K_LEFT);
|
||||
break;
|
||||
case K_ALT_RIGHT:
|
||||
disp = TRUE; dispatch_e_scroll (win(), K_RIGHT);
|
||||
dispatch_e_scroll (win(), K_RIGHT);
|
||||
break;
|
||||
case K_UP:
|
||||
case K_SHIFT_UP:
|
||||
@ -2068,7 +2067,7 @@ bool TViswin::on_key (KEY key)
|
||||
{
|
||||
_need_update = FALSE;
|
||||
if (need_paint_sel (FALSE))
|
||||
erase_selection ();
|
||||
erase_selection();
|
||||
update_thumb (--_point.x, origin ().y);
|
||||
_need_scroll = right;
|
||||
}
|
||||
@ -2091,7 +2090,7 @@ bool TViswin::on_key (KEY key)
|
||||
if (key == K_SHIFT_DOWN)
|
||||
{
|
||||
if (need_paint_sel (FALSE))
|
||||
erase_selection ();
|
||||
erase_selection();
|
||||
if (!_selecting)
|
||||
{
|
||||
_sel_start = _point;
|
||||
@ -2149,25 +2148,23 @@ bool TViswin::on_key (KEY key)
|
||||
}
|
||||
}
|
||||
else
|
||||
beep ();
|
||||
beep();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (_need_scroll != none)
|
||||
{
|
||||
disp = TRUE;
|
||||
_need_update = FALSE;
|
||||
scroll tmp = _need_scroll;
|
||||
_need_scroll = none;
|
||||
shift_screen (tmp);
|
||||
shift_screen (tmp);
|
||||
}
|
||||
if (_isselection)
|
||||
display_selection ();
|
||||
check_link (&_point);
|
||||
if (!disp)
|
||||
update();
|
||||
else display_point();
|
||||
if (_need_update) force_update();
|
||||
else update();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -2176,7 +2173,45 @@ default:
|
||||
return TWindow::on_key (key);
|
||||
}
|
||||
|
||||
bool TViswin::call_editor ()
|
||||
void TViswin::sel_to_clipboard()
|
||||
{
|
||||
TPoint p1, p2;
|
||||
if (!_isselection) return;
|
||||
adjust_selection (p1, p2);
|
||||
|
||||
TString_array txt;
|
||||
_txt.write(txt, &p1, &p2);
|
||||
|
||||
long size = 0l; int eol_len = strlen(EOL_SEQ);
|
||||
// open clipboard
|
||||
xvt_cb_open(TRUE);
|
||||
// allocate clipboard
|
||||
for (int i = 0; i < txt.items(); i++)
|
||||
size += txt.row(i).len() + eol_len;
|
||||
char* p = (char*)xvt_cb_alloc_data(size);
|
||||
if (p == NULL)
|
||||
{
|
||||
error_box("Impossibile allocare una clipboard di %ld bytes", size);
|
||||
return;
|
||||
}
|
||||
// put data
|
||||
for (i = 0; i < txt.items(); i++)
|
||||
{
|
||||
TString& s = txt.row(i);
|
||||
for (int j = 0; j < s.len(); j++)
|
||||
*p++ = s[j];
|
||||
for (j = 0; j < eol_len; j++)
|
||||
*p++ = EOL_SEQ[j];
|
||||
}
|
||||
if (!xvt_cb_put_data(CB_TEXT, NULL, size, (PICTURE)NULL))
|
||||
error_box("Errore di copiatura del testo nella clipboard");
|
||||
// free memory
|
||||
xvt_cb_free_data();
|
||||
// close clipboard
|
||||
xvt_cb_close();
|
||||
}
|
||||
|
||||
bool TViswin::call_editor()
|
||||
{
|
||||
TConfig cnf (CONFIG_USER, "Link");
|
||||
const TFilename editor (cnf.get ("txt", NULL, -1, "notepad"));
|
||||
@ -2252,7 +2287,7 @@ void TViswin::close_print ()
|
||||
{
|
||||
xvt_menu_set_item_title(win(), M_EDIT_QUIT, "Chiudi\tESC");
|
||||
enable_menu_item(M_EDIT_CLIPBOARD, FALSE);
|
||||
xvt_enable_control(_print_button, TRUE);
|
||||
_print_button->enable();
|
||||
enable_menu_item(M_EDIT_SEL_ALL, TRUE);
|
||||
// build bookmark menu tree
|
||||
_bookmarks = &(printer().get_bookmarks());
|
||||
@ -2399,17 +2434,17 @@ void TViswin::find_next()
|
||||
|
||||
void TViswin::show_rulers (bool on)
|
||||
{
|
||||
_rulers = on;
|
||||
autoscroll (FALSE);
|
||||
_rulers = on;
|
||||
autoscroll(FALSE);
|
||||
_textrows = TEXTROWS;
|
||||
_textcolumns = TEXTCOLUMNS;
|
||||
autoscroll (TRUE);
|
||||
autoscroll(TRUE);
|
||||
refresh();
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @mfunc Indica se mostrare o no i bottoni della finestra di anteprima
|
||||
// @mfunc Mostra/nasconde i bottoni della finestra di anteprima
|
||||
void TViswin::show_buttons(
|
||||
bool on) // @parm Indica l'operazione da svolgere:
|
||||
//
|
||||
@ -2420,11 +2455,10 @@ void TViswin::show_buttons(
|
||||
autoscroll (FALSE);
|
||||
_textrows = TEXTROWS;
|
||||
_textcolumns = TEXTCOLUMNS;
|
||||
autoscroll (TRUE);
|
||||
autoscroll(TRUE);
|
||||
|
||||
for (int i = 0; i < _buttons; i++)
|
||||
if (_button[i] != NULL_WIN)
|
||||
xvt_vobj_set_visible(_button[i],on);
|
||||
for (int i = 0; i < _button.items(); i++)
|
||||
((TPushbutton_control&)_button[i]).show(on);
|
||||
refresh();
|
||||
}
|
||||
|
||||
@ -2444,11 +2478,11 @@ TViswin::TViswin(const char *fname,
|
||||
_link_displayed (FALSE), _point_displayed (FALSE), _selecting (FALSE),
|
||||
_scrolling (FALSE), _selflag (FALSE), _need_update (TRUE), _need_scroll (none),
|
||||
_multiple (FALSE), _rulers(rulers), _txt_to_find(64),
|
||||
_frozen (FALSE), _brwfld(brwfld), _link_button(-1),
|
||||
_frozen (FALSE), _brwfld(brwfld), _link_button(NULL), _print_button(NULL),
|
||||
_down_dir(TRUE), _showbuts(FALSE), _case_sensitive(FALSE),
|
||||
_menu_present(FALSE)
|
||||
{
|
||||
main_app().begin_wait();
|
||||
begin_wait();
|
||||
|
||||
if (title == NULL)
|
||||
title = (fname ? fname : "Anteprima di stampa");
|
||||
@ -2459,9 +2493,6 @@ TViswin::TViswin(const char *fname,
|
||||
if (_isopen)
|
||||
_filename = _txt.name ();
|
||||
|
||||
for (int i = 0; i < MAXBUT; i++)
|
||||
_button[i] = NULL_WIN;
|
||||
|
||||
if (parent == NULL_WIN)
|
||||
parent = TASK_WIN;
|
||||
|
||||
@ -2490,7 +2521,7 @@ TViswin::TViswin(const char *fname,
|
||||
maxalt = alt;
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
for (i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
_modules.add(new TImage(BMP_MODULE1 + i), i);
|
||||
_modules.add(new TImage(BMP_MODULE), i);
|
||||
#endif
|
||||
@ -2502,16 +2533,20 @@ TViswin::TViswin(const char *fname,
|
||||
}
|
||||
|
||||
WIN_TYPE rt = _toplevel ? W_DOC : W_PLAIN;
|
||||
create (x, y, maxlarg, maxalt, title, flags, rt, parent,
|
||||
create(x, y, maxlarg, maxalt, title, flags, rt, parent,
|
||||
_toplevel ? VISWIN_BAR : 0);
|
||||
|
||||
attach_interface(win(), BACKGROUND);
|
||||
|
||||
set_opaque_text (TRUE);
|
||||
set_font (PRINT_FONT, XVT_FS_NONE, PRINT_HEIGHT);
|
||||
|
||||
if (_toplevel)
|
||||
{
|
||||
enable_menu_item(M_EDIT_COPY, FALSE);
|
||||
enable_menu_item(M_SHOW_RULERS, TRUE);
|
||||
enable_menu_item(M_SHOW_BUTTONS, TRUE);
|
||||
check_menu_item(M_SHOW_RULERS, _rulers);
|
||||
check_menu_item(M_SHOW_RULERS, _rulers);
|
||||
check_menu_item(M_SHOW_BUTTONS, _showbuts);
|
||||
enable_menu_item(M_EDIT_SEL_ALL, FALSE);
|
||||
}
|
||||
@ -2520,32 +2555,24 @@ TViswin::TViswin(const char *fname,
|
||||
set_scroll_max (MAXLEN - 1, _txt.lines () <= _textrows ?
|
||||
_txt.lines () : _txt.lines () - _textrows);
|
||||
|
||||
|
||||
if (_toplevel)
|
||||
{
|
||||
add_button (DLG_QUIT, DLG_QUIT_TITLE);
|
||||
_buttons = 1;
|
||||
add_button (DLG_QUIT, DLG_QUIT_TITLE, BMP_QUIT, BMP_QUITDN);
|
||||
|
||||
if (_isedit)
|
||||
{
|
||||
add_button (DLG_EDIT, DLG_EDIT_TITLE);
|
||||
_buttons++;
|
||||
}
|
||||
add_button (DLG_EDIT, DLG_EDIT_TITLE, BMP_EDIT);
|
||||
if (_islink)
|
||||
{
|
||||
_link_button = add_button (DLG_LINK, DLG_LINK_TITLE);
|
||||
_buttons++;
|
||||
xvt_enable_control(_link_button, FALSE);
|
||||
_link_button = add_button (DLG_LINK, DLG_LINK_TITLE, BMP_LINK);
|
||||
_link_button->disable();
|
||||
}
|
||||
if (_isprint)
|
||||
{
|
||||
_print_button = add_button (DLG_PRINT, DLG_PRINT_TITLE);
|
||||
xvt_enable_control(_print_button, FALSE);
|
||||
_print_button = add_button (DLG_PRINT, DLG_PRINT_TITLE, BMP_PRINT);
|
||||
_print_button->disable();
|
||||
enable_menu_item(M_EDIT_SEL_ALL, FALSE);
|
||||
_buttons++;
|
||||
}
|
||||
}
|
||||
else _buttons = 0;
|
||||
|
||||
_curbut = 0;
|
||||
|
||||
@ -2578,7 +2605,7 @@ TViswin::TViswin(const char *fname,
|
||||
|
||||
_hotspots = &(_txt.hotspots());
|
||||
|
||||
main_app().end_wait();
|
||||
end_wait();
|
||||
}
|
||||
|
||||
TViswin ::~TViswin ()
|
||||
@ -2590,7 +2617,7 @@ TViswin ::~TViswin ()
|
||||
|
||||
// Certified 100%
|
||||
TBrowsefile_field::TBrowsefile_field(TMask* m)
|
||||
: TMask_field(m), _viswin(NULL), _m_link(FALSE), _background(36), _lh(NULL)
|
||||
: TOperable_field(m), _viswin(NULL), _m_link(FALSE), _background(36), _lh(NULL)
|
||||
{}
|
||||
|
||||
// Certified 100%
|
||||
@ -2602,29 +2629,25 @@ word TBrowsefile_field::class_id() const
|
||||
// Certified 100%
|
||||
TBrowsefile_field::~TBrowsefile_field()
|
||||
{
|
||||
CHECK(_viswin, "Can't delete NULL sheet");
|
||||
delete _viswin;
|
||||
}
|
||||
|
||||
void TBrowsefile_field::parse_head(TScanner& scanner)
|
||||
{
|
||||
_width = scanner.integer();
|
||||
_size = scanner.integer();
|
||||
_ctl_data._width = scanner.integer();
|
||||
_ctl_data._size = scanner.integer();
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TBrowsefile_field::create(WINDOW parent)
|
||||
{
|
||||
main_app().begin_wait();
|
||||
|
||||
const TMask& m = mask();
|
||||
_viswin = new TViswin(_prompt, _prompt, FALSE, FALSE, FALSE, _x, _y,
|
||||
_size, _width, _flags.rightjust ? TRUE : FALSE, parent, this);
|
||||
_win = _viswin->win();
|
||||
xvt_vobj_set_enabled(_win, enabled());
|
||||
xvt_vobj_set_visible(_win, shown());
|
||||
|
||||
main_app().end_wait();
|
||||
_viswin = new TViswin(_ctl_data._prompt, _ctl_data._prompt, FALSE, FALSE, FALSE,
|
||||
_ctl_data._x, _ctl_data._y, _ctl_data._size, _ctl_data._width,
|
||||
_flags.rightjust ? TRUE : FALSE, parent, this);
|
||||
WINDOW win = _viswin->win();
|
||||
xvt_vobj_set_enabled(win, enabled());
|
||||
xvt_vobj_set_visible(win, shown());
|
||||
}
|
||||
|
||||
|
||||
@ -2636,7 +2659,7 @@ long TBrowsefile_field::set_text(const char* file, const char* line)
|
||||
if (instr == NULL)
|
||||
fatal_box("File non trovato: %s", file);
|
||||
|
||||
main_app().begin_wait();
|
||||
begin_wait();
|
||||
|
||||
TString256 tmpp;
|
||||
long ret = -1l;
|
||||
@ -2644,14 +2667,15 @@ long TBrowsefile_field::set_text(const char* file, const char* line)
|
||||
|
||||
while (!feof(instr))
|
||||
{
|
||||
if (fgets(__tmp_string, sizeof (__tmp_string), instr) == NULL)
|
||||
break;
|
||||
if (__tmp_string[strlen(__tmp_string)-1] == '\n')
|
||||
__tmp_string[strlen(__tmp_string)-1] = '\0';
|
||||
add_line(__tmp_string);
|
||||
if (fgets((char*)(const char*)tmpp, tmpp.size(), instr) == NULL)
|
||||
break;
|
||||
|
||||
char& last = tmpp[tmpp.len()-1];
|
||||
if (last == '\n') last = '\0';
|
||||
|
||||
add_line(tmpp);
|
||||
if (line != NULL)
|
||||
{
|
||||
tmpp = __tmp_string;
|
||||
if (tmpp.find(line) != -1)
|
||||
ret = lines;
|
||||
}
|
||||
@ -2661,7 +2685,7 @@ long TBrowsefile_field::set_text(const char* file, const char* line)
|
||||
|
||||
_viswin->close_print();
|
||||
|
||||
main_app().end_wait();
|
||||
end_wait();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2756,3 +2780,5 @@ long TBrowsefile_field::lines()
|
||||
{
|
||||
return _viswin->_txt.lines();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
#ifndef __VISWIN_H
|
||||
#define __VISWIN_H
|
||||
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#ifndef __CONTROLS_H
|
||||
class TPushbutton_control;
|
||||
#endif
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TEXTFILE_H
|
||||
@ -30,8 +30,8 @@ class TViswin : public TScroll_window
|
||||
|
||||
// @access:(INTERNAL) Private Member
|
||||
|
||||
// @ccost:(INTERNAL) MAXBUT | 4 | Numero massimo di bottoni disponibili nella pagina
|
||||
enum { MAXBUT = 4,
|
||||
|
||||
enum {
|
||||
// @ccost:(INTERNAL) MAXLEN | 256 | Lunghezza massima del modulo di stampa
|
||||
MAXLEN = 256,
|
||||
// @ccost:(INTERNAL) BUFFERSIZE | 256 | Dimensione del buffer di stampa
|
||||
@ -84,16 +84,14 @@ class TViswin : public TScroll_window
|
||||
// @cmember:(INTERNAL) Flag per il disegno intelligente
|
||||
bool _wasneeded;
|
||||
// @cmember:(INTERNAL) Array di bottoni attivi nella finestra
|
||||
WINDOW _button[MAXBUT];
|
||||
TArray _button;
|
||||
// @cmember:(INTERNAL) Bottone che ha il focus
|
||||
int _curbut;
|
||||
// @cmember:(INTERNAL) Contatore di bottoni
|
||||
int _buttons;
|
||||
|
||||
// @cmember:(INTERNAL) Bottone Collega
|
||||
WINDOW _link_button;
|
||||
TPushbutton_control* _link_button;
|
||||
// @cmember:(INTERNAL) Bottone Stampa
|
||||
WINDOW _print_button;
|
||||
TPushbutton_control* _print_button;
|
||||
|
||||
// @cmember:(INTERNAL) Numero di righe di testo
|
||||
long _textrows;
|
||||
@ -147,7 +145,7 @@ class TViswin : public TScroll_window
|
||||
// link presenti sulla stessa riga anziche' solo il selezionato
|
||||
bool _multiple;
|
||||
// @cmember:(INTERNAL) Testo del link
|
||||
TString80 _linktxt;
|
||||
TString _linktxt;
|
||||
// @cmember:(INTERNAL) Identificatore del link
|
||||
int _linkID;
|
||||
// @cmember:(INTERNAL) Indica tutti i link della riga nel caso di link multiplo
|
||||
@ -169,7 +167,10 @@ class TViswin : public TScroll_window
|
||||
bool _menu_present;
|
||||
|
||||
// @cmember:(INTERNAL) Viene istanziato soltanto se e' usata come controllo
|
||||
TBrowsefile_field* _brwfld;
|
||||
TBrowsefile_field* _brwfld;
|
||||
|
||||
// @cmember: (INTERNAL) Rettangolo finestra madre
|
||||
RCT _wr;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
@ -183,6 +184,9 @@ protected:
|
||||
// @cmember Converte i caratteri in y in pixel
|
||||
int taby(int y) const;
|
||||
|
||||
// @cmember Cancella l'area di testo col colore <p c>
|
||||
void txt_clear(COLOR c);
|
||||
|
||||
// @cmember Sposta lo schermo nella direzione <p dir> di 1
|
||||
void shift_screen(scroll dir);
|
||||
// @cmember Disegna lo schermo sulla porzione corrente di testo
|
||||
@ -208,11 +212,13 @@ protected:
|
||||
// @cmember Chiama l'editor selezionato nel file PRASSI.INI. Ritorna il risultato della
|
||||
// chiamata (TRUE se e' riuscito a chiamarlo)
|
||||
bool call_editor();
|
||||
// @cmember copia l'eventuale selezione nella clipboard
|
||||
void sel_to_clipboard();
|
||||
// @cmember Ritorna se in punto <p p> e' nel testo mostrato
|
||||
bool in_text(const TPoint& p) const;
|
||||
|
||||
// @cmember Aggiunge un bottone alla finestra
|
||||
WINDOW add_button(short id, const char* caption);
|
||||
TPushbutton_control* add_button(short id, const char* caption, short bup = 0, short bdn = 0);
|
||||
// @cmember Riposiziona i bottoni centrandoli a seconda di quanti sono presenti
|
||||
void repos_buttons();
|
||||
// @cmember Assicura che la selezione rimanga nei limiti fisici del testo
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <applicat.h>
|
||||
#include <checks.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <utility.h>
|
||||
|
||||
#define __WINDOW_CPP
|
||||
#include <window.h>
|
||||
@ -151,7 +151,7 @@ void TWindow_manager::destroy()
|
||||
void TWindow_manager::lock_handle()
|
||||
{
|
||||
CHECK(_lowhandle == NULL, "Can't relock low handle");
|
||||
_lowhandle = fopen("bagn001a.msk", "r");
|
||||
_lowhandle = fopen("con", "r");
|
||||
CHECK(_lowhandle != NULL, "Can't lock low handle");
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ void TImage::set_clut(byte n, COLOR c)
|
||||
// Certified 99%
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Setta i colori dell'immagine in modo da renderlo trasparente
|
||||
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
|
||||
void TImage::convert_to_default_colors()
|
||||
|
||||
// @comm Legge nell'immagine i colori CYAN e DARK_CYAN e li setta a seconda del colore
|
||||
@ -485,6 +485,26 @@ void TImage::convert_to_default_colors()
|
||||
}
|
||||
}
|
||||
|
||||
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
|
||||
void TImage::convert_transparent_color()
|
||||
|
||||
// @comm Legge nell'immagine i pixel uguali a quello in alto a sinistra e li setta
|
||||
// uguali allo sfondo delle maschere
|
||||
{
|
||||
const COLOR trans = xvt_image_get_pixel(_image, 0, 0);
|
||||
if (trans != MASK_BACK_COLOR && xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||
{
|
||||
short dx, dy; xvt_image_get_dimensions(_image, &dx, &dy);
|
||||
for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++)
|
||||
{
|
||||
const COLOR c = xvt_image_get_pixel(_image, x, y);
|
||||
if (c == trans)
|
||||
xvt_image_set_pixel(_image, x, y, MASK_BACK_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TWindow
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -498,6 +518,8 @@ TWindow::TWindow()
|
||||
_running(FALSE), _pixmap(FALSE), _lastkey(0)
|
||||
{}
|
||||
|
||||
word TWindow::class_id() const
|
||||
{ return CLASS_WINDOW; }
|
||||
|
||||
long XVT_CALLCONV1 TWindow::window_handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
@ -558,10 +580,11 @@ TWindow::~TWindow()
|
||||
|
||||
void TWindow::open()
|
||||
{
|
||||
CHECK(win() != NULL_WIN, "Can't open a NULL window");
|
||||
xvt_vobj_set_visible(win(), _open = TRUE);
|
||||
xvt_scr_set_focus_vobj(win());
|
||||
xvt_vobj_raise(win());
|
||||
WINDOW w = win();
|
||||
CHECK(w != NULL_WIN, "Can't open a NULL window");
|
||||
xvt_vobj_set_visible(w, _open = TRUE);
|
||||
xvt_scr_set_focus_vobj(w);
|
||||
xvt_vobj_raise(w);
|
||||
}
|
||||
|
||||
|
||||
@ -592,7 +615,7 @@ void TWindow::close_modal()
|
||||
bool TWindow::stop_run(KEY key)
|
||||
{
|
||||
_running = FALSE;
|
||||
_lastkey = key;
|
||||
_lastkey = key;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -619,16 +642,35 @@ KEY TWindow::run()
|
||||
_running = TRUE;
|
||||
|
||||
if (!was_open) open_modal();
|
||||
else open();
|
||||
else open();
|
||||
|
||||
while (_running)
|
||||
do_events();
|
||||
|
||||
if (!was_open) close_modal();
|
||||
do_events();
|
||||
|
||||
return last_key();
|
||||
}
|
||||
|
||||
void TWindow::on_button(short dlg)
|
||||
{
|
||||
switch(dlg)
|
||||
{
|
||||
case DLG_OK:
|
||||
stop_run(K_ENTER);
|
||||
break;
|
||||
case DLG_CANCEL:
|
||||
stop_run(K_ESC);
|
||||
break;
|
||||
case DLG_QUIT:
|
||||
stop_run(K_QUIT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Gestisce l'handler della finestra
|
||||
@ -641,8 +683,11 @@ void TWindow::handler(
|
||||
case E_CLOSE:
|
||||
stop_run(K_ESC);
|
||||
break;
|
||||
case E_CONTROL:
|
||||
if (ep->v.ctl.ci.type == WC_PUSHBUTTON)
|
||||
on_button(ep->v.ctl.id);
|
||||
break;
|
||||
case E_UPDATE:
|
||||
xvt_dwin_clear(win, NORMAL_BACK_COLOR);
|
||||
update();
|
||||
break;
|
||||
case E_CHAR:
|
||||
@ -676,18 +721,19 @@ WINDOW TWindow::parent() const
|
||||
|
||||
|
||||
void TWindow::set_focus()
|
||||
{
|
||||
if (_win)
|
||||
{
|
||||
WINDOW w = win();
|
||||
if (w)
|
||||
{
|
||||
xvt_scr_set_focus_vobj(_win);
|
||||
xvt_vobj_raise(_win);
|
||||
xvt_scr_set_focus_vobj(w);
|
||||
xvt_vobj_raise(w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TWindow::iconize() const
|
||||
{
|
||||
#if XVTWS != WMWS
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
|
||||
ShowWindow(hwnd, SW_MINIMIZE);
|
||||
#endif
|
||||
@ -695,7 +741,7 @@ void TWindow::iconize() const
|
||||
|
||||
void TWindow::maximize() const
|
||||
{
|
||||
#if XVTWS != WMWS
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
|
||||
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
|
||||
#else
|
||||
@ -763,8 +809,9 @@ bool TWindow::restore_ctools()
|
||||
|
||||
void TWindow::set_color(COLOR fore, COLOR back)
|
||||
{
|
||||
xvt_dwin_set_fore_color(win(), fore);
|
||||
xvt_dwin_set_back_color(win(), back);
|
||||
WINDOW w = win();
|
||||
xvt_dwin_set_fore_color(w, fore);
|
||||
xvt_dwin_set_back_color(w, back);
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
@ -9,8 +9,9 @@
|
||||
#include <xvtility.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
class TString_array;
|
||||
|
||||
#endif
|
||||
|
||||
void close_all_dialogs();
|
||||
bool can_close();
|
||||
@ -114,8 +115,14 @@ public:
|
||||
const RCT& rect() const
|
||||
{ return _src; }
|
||||
|
||||
// @cmember Setta i colori dell'immagine in modo da renderlo trasparente
|
||||
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
||||
// usando i colori di default (di Morpurgo)
|
||||
void convert_to_default_colors();
|
||||
|
||||
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
||||
// usando l'angolo in alto a sinistra dell'imagine stessa
|
||||
void convert_transparent_color();
|
||||
|
||||
// @cmember Setta l'<p n>.esime entry della paletta al colore <p c>
|
||||
void set_clut(byte n, COLOR c);
|
||||
|
||||
@ -133,7 +140,7 @@ public:
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TWindow | Classe per la definizione di una finestra generica
|
||||
class TWindow
|
||||
class TWindow : public TObject
|
||||
{
|
||||
// @author:(INTERNAL) Guido
|
||||
|
||||
@ -191,9 +198,6 @@ protected:
|
||||
// @cmember Fa' l'update della finstra
|
||||
virtual void update()
|
||||
{}
|
||||
// @cmember Gestisce la pressione del tasto
|
||||
virtual bool on_key(KEY)
|
||||
{ return TRUE; }
|
||||
|
||||
// @cmember Converte le coordinate logiche (caratteri) in coordinate fisiche (pixel)
|
||||
virtual PNT log2dev(long x, long y) const;
|
||||
@ -206,14 +210,25 @@ public:
|
||||
TWindow();
|
||||
// @cmember Distruttore
|
||||
virtual ~TWindow();
|
||||
|
||||
// @cmember Gestisce l'handeler della finestra
|
||||
|
||||
// @cmember Ritorna l'identificatore della classe finestra
|
||||
virtual word class_id() const;
|
||||
|
||||
// @cmember Gestisce la pressione dei bottoni
|
||||
virtual void on_button(short dlg);
|
||||
|
||||
// @cmember Gestisce gli eventi della finestra
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
|
||||
// @cmember Mette la finestra in primo piano
|
||||
virtual void set_focus();
|
||||
// @cmember Ritorna il descrittore della finestra
|
||||
virtual WINDOW win() const
|
||||
{ return _win; }
|
||||
{ return _win; }
|
||||
|
||||
// @cmember Gestisce la pressione del tasto
|
||||
virtual bool on_key(KEY)
|
||||
{ return TRUE; }
|
||||
|
||||
// @cmember Ritorna TRUE se la finestra e' aperta
|
||||
bool is_open() const
|
||||
@ -270,7 +285,8 @@ public:
|
||||
void close_modal();
|
||||
|
||||
// @cmember Esegue la finestra
|
||||
KEY run();
|
||||
virtual KEY run();
|
||||
|
||||
// @cmember Ritorna l'ultimo tasto
|
||||
KEY last_key() const
|
||||
{ return _lastkey; }
|
||||
|
@ -23,53 +23,13 @@ BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR)
|
||||
#endif
|
||||
}
|
||||
|
||||
HIDDEN XVT_FNTID DEF_FONT = NULL;
|
||||
HIDDEN XVT_FNTID FAT_FONT = NULL;
|
||||
|
||||
#if XVTWS == WMWS
|
||||
|
||||
short CHARX = 8;
|
||||
short CHARY = 8;
|
||||
short BASEY = 8;
|
||||
short ROWY = 8;
|
||||
|
||||
COLOR MASK_BACK_COLOR = COLOR_WHITE;
|
||||
COLOR MASK_LIGHT_COLOR = COLOR_WHITE;
|
||||
COLOR MASK_DARK_COLOR = COLOR_BLUE;
|
||||
COLOR NORMAL_COLOR = COLOR_BLACK;
|
||||
COLOR NORMAL_BACK_COLOR = COLOR_WHITE;
|
||||
COLOR DISABLED_COLOR = COLOR_GRAY;
|
||||
COLOR DISABLED_BACK_COLOR = MASK_BACK_COLOR;
|
||||
COLOR FOCUS_COLOR = COLOR_BLACK;
|
||||
COLOR FOCUS_BACK_COLOR = COLOR_WHITE;
|
||||
|
||||
#else
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#include <ctl3d.h>
|
||||
|
||||
HIDDEN COLORREF COLOR2RGB(COLOR c)
|
||||
{
|
||||
const byte red = byte((c >> 16) & 0xFF);
|
||||
const byte gre = byte((c >> 8) & 0xFF);
|
||||
const byte blu = byte(c & 0xFF);
|
||||
return RGB(red, gre, blu);
|
||||
}
|
||||
|
||||
HIDDEN COLOR RGB2COLOR(COLORREF c)
|
||||
{
|
||||
const byte red = byte(c & 0xFF);
|
||||
const byte gre = byte((c >> 8) & 0xFF);
|
||||
const byte blu = byte((c >> 16) & 0xFF);
|
||||
return XVT_MAKE_COLOR(red, gre, blu);
|
||||
}
|
||||
|
||||
#ifndef XVT_CALLCONV1
|
||||
#define XVT_CALLCONV1
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
WINDOW XVT_CALLCONV1 xvtwi_hwnd_to_window(HWND);
|
||||
WINDOW xvtwi_hwnd_to_window(HWND);
|
||||
#include <statbar.h>
|
||||
}
|
||||
#include <controls.h>
|
||||
@ -79,10 +39,6 @@ short ROWY = GetSystemMetrics(SM_CYSCREEN) / 25;
|
||||
short CHARY = 14;
|
||||
short BASEY = 12;
|
||||
|
||||
HIDDEN HFONT NormalFont = NULL;
|
||||
HIDDEN LOGFONT LogFont;
|
||||
HIDDEN int FontWeight;
|
||||
|
||||
COLOR MASK_BACK_COLOR = COLOR_DKCYAN;
|
||||
COLOR MASK_LIGHT_COLOR = COLOR_CYAN;
|
||||
COLOR MASK_DARK_COLOR = COLOR_GRAY;
|
||||
@ -94,28 +50,18 @@ COLOR DISABLED_BACK_COLOR = MASK_BACK_COLOR;
|
||||
COLOR FOCUS_COLOR = NORMAL_COLOR;
|
||||
COLOR FOCUS_BACK_COLOR = COLOR_CYAN;
|
||||
|
||||
HIDDEN COLORREF MaskColor = COLOR2RGB(MASK_BACK_COLOR);
|
||||
HIDDEN HBRUSH MaskBrush = 0 ;
|
||||
HIDDEN COLORREF NormalForeColor = COLOR2RGB(NORMAL_COLOR);
|
||||
HIDDEN COLORREF NormalBackColor = COLOR2RGB(NORMAL_BACK_COLOR);
|
||||
HIDDEN HBRUSH NormalBrush = 0;
|
||||
HIDDEN COLORREF FocusForeColor = COLOR2RGB(FOCUS_COLOR);
|
||||
HIDDEN COLORREF FocusBackColor = COLOR2RGB(FOCUS_BACK_COLOR);
|
||||
HIDDEN HBRUSH FocusBrush = 0;
|
||||
|
||||
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
|
||||
// By Matt Pietrek
|
||||
bool allow_another_instance()
|
||||
{
|
||||
HINSTANCE hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
|
||||
HMODULE hModuleSel = SELECTOROF( // Convert the HINSTANCE to an HMODULE
|
||||
GlobalLock(GetModuleHandle((const char*)MAKELP(0,hInstance))));
|
||||
|
||||
if ( hModuleSel == 0 ) // Make sure we succeeded.
|
||||
// Convert the HINSTANCE to an HMODULE
|
||||
HINSTANCE hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
LPCSTR sModuleName = (LPCSTR)MAKELP(0, hInstance);
|
||||
HMODULE hModule = GetModuleHandle(sModuleName);
|
||||
void FAR* mem_handle = GlobalLock(hModule);
|
||||
HMODULE hModuleSel = (HMODULE)SELECTOROF(mem_handle);
|
||||
if (hModuleSel == 0) // Make sure we succeeded.
|
||||
return FALSE;
|
||||
|
||||
// Make pointers to the resident names table and the OFSTRUCT
|
||||
@ -157,10 +103,6 @@ bool allow_another_instance()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static BOOLEAN event_hook(HWND hwnd,
|
||||
UINT msg,
|
||||
UINT wparam,
|
||||
@ -169,107 +111,18 @@ static BOOLEAN event_hook(HWND hwnd,
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_SYSCOLORCHANGE:
|
||||
Ctl3dColorChange();
|
||||
break;
|
||||
case WM_CTLCOLOR:
|
||||
{
|
||||
const word type = HIWORD(lparam);
|
||||
if (type == CTLCOLOR_LISTBOX || type == CTLCOLOR_EDIT ||
|
||||
type == CTLCOLOR_MSGBOX)
|
||||
{
|
||||
HWND hwnd = LOWORD(lparam);
|
||||
HDC hdc = wparam;
|
||||
|
||||
if (!IsWindowEnabled(hwnd)) // Campo disabilitato
|
||||
{
|
||||
if (type != CTLCOLOR_MSGBOX)
|
||||
{
|
||||
SetTextColor(hdc, NormalForeColor);
|
||||
SetBkColor(hdc, MaskColor);
|
||||
}
|
||||
*ret = MaskBrush;
|
||||
return FALSE; // Non fare altro
|
||||
}
|
||||
|
||||
bool focus = GetFocus() == hwnd;
|
||||
if (type != CTLCOLOR_MSGBOX)
|
||||
{
|
||||
SetTextColor(hdc, focus ? FocusForeColor : NormalForeColor);
|
||||
SetBkColor(hdc, focus ? FocusBackColor : NormalBackColor);
|
||||
}
|
||||
*ret = focus ? FocusBrush : NormalBrush;
|
||||
return FALSE; // Non fare altro
|
||||
}
|
||||
#ifdef __CTL3D__
|
||||
else
|
||||
{
|
||||
*ret = Ctl3dCtlColorEx(msg, wparam, lparam);
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
const word notify = HIWORD(lparam);
|
||||
if (notify == EN_KILLFOCUS || notify == EN_SETFOCUS)
|
||||
{
|
||||
HWND hwnd = LOWORD(lparam); // Ridisegna BENE il campo
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wparam == VK_PRIOR || wparam == VK_NEXT ||
|
||||
wparam == VK_UP || wparam == VK_DOWN ||
|
||||
wparam == VK_F1 )
|
||||
{
|
||||
KEY key = 0;
|
||||
char name[16];
|
||||
GetClassName(hwnd, name, 5);
|
||||
|
||||
if (stricmp(name, "Edit") == 0) switch(wparam)
|
||||
{
|
||||
case VK_PRIOR:
|
||||
key = K_PREV; break;
|
||||
case VK_NEXT:
|
||||
key = K_NEXT; break;
|
||||
case VK_UP:
|
||||
key = K_UP; break;
|
||||
case VK_DOWN:
|
||||
key = K_DOWN; break;
|
||||
default:
|
||||
key = 0; break;
|
||||
}
|
||||
|
||||
if (wparam == VK_F1)
|
||||
key = K_F1;
|
||||
|
||||
if (key > 0)
|
||||
{
|
||||
WINDOW w = cur_win();
|
||||
if (w != NULL_WIN)
|
||||
{
|
||||
dispatch_e_char(w, key);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_MENUCHAR:
|
||||
{
|
||||
WINDOW w = cur_win();
|
||||
if (w != NULL_WIN)
|
||||
{
|
||||
const KEY key = toupper(wparam)+K_CTRL;
|
||||
dispatch_e_char(w, key);
|
||||
}
|
||||
}
|
||||
if (wparam >= 'A' && wparam <= 'z')
|
||||
{
|
||||
WINDOW w = cur_win();
|
||||
if (w != NULL_WIN)
|
||||
{
|
||||
const KEY key = toupper(wparam)+K_CTRL;
|
||||
dispatch_e_char(w, key);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
if (msg == WM_WAKEUP && wparam == main_app().waiting())
|
||||
main_app().wake_up();
|
||||
break;
|
||||
@ -278,22 +131,6 @@ static BOOLEAN event_hook(HWND hwnd,
|
||||
return TRUE; // Continua col processo normale
|
||||
}
|
||||
|
||||
|
||||
HIDDEN WIN_TYPE _wc_type = W_NONE;
|
||||
HIDDEN long _bandiere = 0L;
|
||||
|
||||
static void createwindow_hook(DWORD* exstyle, LPCSTR* classname, LPCSTR* windowname, DWORD* styl,
|
||||
int* x, int* y, int* width, int* height, HWND* parent, HMENU* menu,
|
||||
HINSTANCE inst, void **)
|
||||
{
|
||||
if (_wc_type == WC_EDIT)
|
||||
{
|
||||
if (_bandiere & CTL_FLAG_MAC_MONACO9)
|
||||
*exstyle |= ES_PASSWORD;
|
||||
}
|
||||
_wc_type = W_NONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -332,7 +169,6 @@ RCT& resize_rect(
|
||||
wt = WC_EDIT;
|
||||
}
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
switch (wt)
|
||||
{
|
||||
case WC_EDIT :
|
||||
@ -356,12 +192,6 @@ RCT& resize_rect(
|
||||
r.bottom = dy*ROWY-1;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
r.left = x * CHARX;
|
||||
r.top = y * CHARY;
|
||||
r.right = dx * CHARX;
|
||||
r.bottom = dy * CHARY;
|
||||
#endif
|
||||
|
||||
if (x < 0 || y < 0 || dx <= 0 || dy <= 0)
|
||||
{
|
||||
@ -369,7 +199,7 @@ RCT& resize_rect(
|
||||
if (parent == NULL_WIN) parent = TASK_WIN;
|
||||
xvt_vobj_get_client_rect(parent, &pc); // Get parent window size
|
||||
const short MAXX = pc.right;
|
||||
const short MAXY = pc.bottom - (parent == TASK_WIN ? 26 : 0);
|
||||
const short MAXY = pc.bottom;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
@ -427,7 +257,7 @@ void beep()
|
||||
|
||||
class TEvent_manager
|
||||
{
|
||||
enum { MAX = 2 };
|
||||
enum { MAX = 16 };
|
||||
WINDOW _w[MAX];
|
||||
EVENT _e[MAX];
|
||||
int _begin, _end;
|
||||
@ -504,6 +334,22 @@ KEY e_char_to_key(
|
||||
return key;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @func Simula un evento
|
||||
|
||||
void dispatch_event(
|
||||
WINDOW win, // @parm Finestra destinataria dell'evento
|
||||
const EVENT& e, // @parm Evento da generare
|
||||
bool post)
|
||||
{
|
||||
if (post)
|
||||
EM.push(win, e);
|
||||
else
|
||||
xvt_win_dispatch_event(win, (EVENT*)&e);
|
||||
}
|
||||
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @func Simula la scelta di una voce di menu
|
||||
@ -513,12 +359,11 @@ void dispatch_e_menu(
|
||||
|
||||
// @xref <f dispatch_e_char> <f dispatch_e_scroll>
|
||||
{
|
||||
EVENT e;
|
||||
|
||||
EVENT e; memset(&e, 0, sizeof(e));
|
||||
e.type = E_COMMAND;
|
||||
e.v.cmd.tag = item;
|
||||
e.v.cmd.shift = e.v.cmd.control = 0;
|
||||
EM.push(win, e);
|
||||
dispatch_event(win, e, TRUE);
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
@ -530,19 +375,19 @@ void dispatch_e_char(
|
||||
|
||||
// @xref <f dispatch_e_menu> <f dispatch_e_scroll>
|
||||
{
|
||||
EVENT e;
|
||||
EVENT e; memset(&e, 0, sizeof(e));
|
||||
|
||||
e.type = E_CHAR;
|
||||
|
||||
if (key > 10000) { e.v.chr.control = TRUE; key -= K_CTRL; }
|
||||
else e.v.chr.control = FALSE;
|
||||
|
||||
if (key > 1000) { e.v.chr.shift = TRUE; key -= K_SHIFT; }
|
||||
else e.v.chr.shift = FALSE;
|
||||
|
||||
if (key > K_CTRL)
|
||||
{ e.v.chr.control = TRUE; key -= K_CTRL; }
|
||||
|
||||
if (key > K_SHIFT)
|
||||
{ e.v.chr.shift = TRUE; key -= K_SHIFT; }
|
||||
|
||||
e.v.chr.ch = short(key);
|
||||
|
||||
EM.push(win, e);
|
||||
dispatch_event(win, e, TRUE);
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
@ -554,7 +399,7 @@ void dispatch_e_scroll(
|
||||
|
||||
// @xref <f dispatch_e_menu> <f dispatch_e_char>
|
||||
{
|
||||
EVENT e;
|
||||
EVENT e; memset(&e, 0, sizeof(e));
|
||||
EVENT_TYPE& t = e.type;
|
||||
SCROLL_CONTROL& w = e.v.scroll.what;
|
||||
short& p = e.v.scroll.pos;
|
||||
@ -609,7 +454,8 @@ void dispatch_e_scroll(
|
||||
break;
|
||||
};
|
||||
|
||||
if (w != SC_NONE) xvt_win_dispatch_event(win, &e);
|
||||
if (w != SC_NONE)
|
||||
dispatch_event(win, e, FALSE);
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -644,128 +490,20 @@ void customize_controls(
|
||||
bool on) // @parm Permette di inizializzare (TRUE) o scaricare (FALSE) i parametri
|
||||
|
||||
{
|
||||
customize_colors();
|
||||
if (on)
|
||||
{
|
||||
#if XVTWS == WMWS
|
||||
// xvt_vobj_set_attr(NULL_WIN,ATTR_CH_SHADOW,XVT_CH_SHADOW_WINDOW|XVT_CH_SHADOW_DIALOG);
|
||||
xvt_vobj_set_attr(NULL_WIN, ATTR_CH_TOGGLE_COMBO, (long)K_F9);
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_CREATEWINDOW_HOOK, (long)createwindow_hook);
|
||||
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_ERRMSG_HANDLER, (long)error_hook);
|
||||
allow_another_instance();
|
||||
|
||||
HINSTANCE _hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
Ctl3dRegister(_hInstance);
|
||||
Ctl3dAutoSubclass(_hInstance);
|
||||
|
||||
MaskColor = COLOR2RGB(MASK_BACK_COLOR);
|
||||
MaskBrush = CreateSolidBrush(MaskColor);
|
||||
|
||||
NormalForeColor = COLOR2RGB(NORMAL_COLOR);
|
||||
NormalBackColor = COLOR2RGB(NORMAL_BACK_COLOR);
|
||||
NormalBrush = CreateSolidBrush(NormalBackColor);
|
||||
|
||||
FocusForeColor = COLOR2RGB(FOCUS_COLOR);
|
||||
FocusBackColor = COLOR2RGB(FOCUS_BACK_COLOR);
|
||||
FocusBrush = CreateSolidBrush(FocusBackColor);
|
||||
#endif
|
||||
customize_colors();
|
||||
init_controls();
|
||||
}
|
||||
else
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
HINSTANCE _hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
Ctl3dUnregister(_hInstance);
|
||||
|
||||
DeleteObject(NormalFont);
|
||||
DeleteObject(MaskBrush);
|
||||
DeleteObject(NormalBrush);
|
||||
DeleteObject(FocusBrush);
|
||||
|
||||
free_controls_bmp();
|
||||
#endif
|
||||
xvt_font_destroy(DEF_FONT);
|
||||
xvt_font_destroy(FAT_FONT);
|
||||
free_controls();
|
||||
}
|
||||
|
||||
if (on) xvt_vobj_set_attr(NULL_WIN,ATTR_ERRMSG_HANDLER, (long)error_hook);
|
||||
}
|
||||
|
||||
XVT_FNTID xvt_default_font()
|
||||
{
|
||||
if (DEF_FONT == NULL)
|
||||
{
|
||||
DEF_FONT = xvt_dwin_get_font(TASK_WIN);
|
||||
FAT_FONT = xvt_dwin_get_font(TASK_WIN);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
NormalFont = GetStockObject(ANSI_FIXED_FONT);
|
||||
GetObject(NormalFont, sizeof(LOGFONT), &LogFont);
|
||||
|
||||
TConfig font(CONFIG_USER, "Font");
|
||||
CHARY = (int)font.get_long("Height");
|
||||
if (CHARY > 0)
|
||||
{
|
||||
LogFont.lfHeight = CHARY;
|
||||
LogFont.lfWeight = FontWeight = font.get_int("Weight");
|
||||
LogFont.lfPitchAndFamily = font.get_int("Pitch");
|
||||
strcpy(LogFont.lfFaceName, font.get("Name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFont.lfHeight = CHARY = 10;
|
||||
FontWeight = 300; // Normal weight
|
||||
}
|
||||
NormalFont = CreateFontIndirect(&LogFont);
|
||||
|
||||
TToken_string desc(128, '/');
|
||||
desc.add("WIN01"); // 0
|
||||
desc.add(LogFont.lfHeight); // 1
|
||||
desc.add(LogFont.lfWidth); // 2
|
||||
desc.add(LogFont.lfEscapement); // 3
|
||||
desc.add(LogFont.lfOrientation); // 4
|
||||
desc.add(LogFont.lfWeight); // 5
|
||||
desc.add(LogFont.lfItalic); // 6
|
||||
desc.add(LogFont.lfUnderline);
|
||||
desc.add(LogFont.lfStrikeOut);
|
||||
desc.add(LogFont.lfCharSet);
|
||||
desc.add(LogFont.lfOutPrecision);
|
||||
desc.add(LogFont.lfClipPrecision);
|
||||
desc.add(LogFont.lfQuality);
|
||||
desc.add(LogFont.lfPitchAndFamily);
|
||||
desc.add(LogFont.lfFaceName);
|
||||
|
||||
xvt_font_set_native_desc(DEF_FONT, (char*)(const char*)desc);
|
||||
CHECK(xvt_font_has_valid_native_desc(DEF_FONT), "Bad font description");
|
||||
xvt_font_map_using_default(DEF_FONT);
|
||||
CHECK(xvt_font_is_mapped(DEF_FONT), "Can't map native font");
|
||||
xvt_dwin_set_font(TASK_WIN, DEF_FONT);
|
||||
|
||||
desc.add(600, 5);
|
||||
xvt_font_set_native_desc(FAT_FONT, (char*)(const char*)desc);
|
||||
CHECK(xvt_font_has_valid_native_desc(FAT_FONT), "Bad font description");
|
||||
xvt_font_map_using_default(FAT_FONT);
|
||||
CHECK(xvt_font_is_mapped(FAT_FONT), "Can't map native font");
|
||||
// Get true text size
|
||||
TEXTMETRIC tm;
|
||||
HDC hdc = (HDC)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_GRAPHIC_CONTEXT);
|
||||
GetTextMetrics(hdc, &tm);
|
||||
|
||||
const int COLX = GetSystemMetrics(SM_CXSCREEN) / 80;
|
||||
CHARX = tm.tmAveCharWidth+1;
|
||||
if (CHARX > COLX) CHARX = COLX;
|
||||
|
||||
CHARY = tm.tmHeight;
|
||||
BASEY = tm.tmAscent;
|
||||
if (CHARY > ROWY-2) CHARY = ROWY-2;
|
||||
#endif
|
||||
}
|
||||
|
||||
return DEF_FONT;
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -779,12 +517,11 @@ void xvt_set_font(
|
||||
{
|
||||
CHECK(win != NULL_WIN, "Can't set the font in a NULL window");
|
||||
|
||||
#if XVT_OS != XVT_OS_SCOUNIX
|
||||
if ((family == NULL || *family == '\0') &&
|
||||
(style == XVT_FS_NONE || style == XVT_FS_BOLD) &&
|
||||
dim == 0)
|
||||
{
|
||||
xvt_dwin_set_font(win, (style == XVT_FS_NONE) ? DEF_FONT : FAT_FONT);
|
||||
xvt_dwin_set_font(win, xvt_default_font(style != XVT_FS_NONE));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -799,9 +536,64 @@ void xvt_set_font(
|
||||
xvt_dwin_set_font(win, font);
|
||||
xvt_font_destroy(font);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void xvt_draw_rect(WINDOW win, const RCT& rect, COLOR lt, COLOR rb, short depth)
|
||||
{
|
||||
RCT r = rect;
|
||||
|
||||
CPEN pen;
|
||||
pen.width = 1;
|
||||
pen.pat = PAT_SOLID;
|
||||
pen.style = P_SOLID;
|
||||
pen.color = lt;
|
||||
|
||||
for (short d = 0; d < depth;)
|
||||
{
|
||||
xvt_dwin_set_cpen(win, &pen);
|
||||
|
||||
PNT p; // Current vertex of the rectangle
|
||||
|
||||
bool drawn = FALSE;
|
||||
if (lt != COLOR_LTGRAY)
|
||||
{
|
||||
p.h = r.left; p.v = r.bottom;
|
||||
xvt_dwin_draw_set_pos(win, p);
|
||||
|
||||
p.v = r.top;
|
||||
xvt_dwin_draw_line(win, p);
|
||||
p.h = r.right;
|
||||
xvt_dwin_draw_line(win, p);
|
||||
drawn = TRUE;
|
||||
}
|
||||
|
||||
if (rb != COLOR_LTGRAY)
|
||||
{
|
||||
if (pen.color != rb)
|
||||
{
|
||||
pen.color = rb;
|
||||
xvt_dwin_set_cpen(win, &pen);
|
||||
}
|
||||
if (!drawn)
|
||||
{
|
||||
p.h = r.right; p.v = r.top;
|
||||
xvt_dwin_draw_set_pos(win, p);
|
||||
}
|
||||
p.v = r.bottom;
|
||||
xvt_dwin_draw_line(win, p);
|
||||
p.h = r.left;
|
||||
xvt_dwin_draw_line(win, p);
|
||||
}
|
||||
|
||||
if (++d < depth)
|
||||
{
|
||||
r.left++; r.top++;
|
||||
r.right--; r.bottom--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @func Permette di creare una finestra
|
||||
@ -867,83 +659,11 @@ WINDOW xvt_create_control(
|
||||
int id) // @parm Indentificatore del controlllo
|
||||
{
|
||||
RCT r = resize_rect(x, y, dx, dy, wt, parent);
|
||||
WINDOW win = NULL_WIN;
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
_wc_type = wt;
|
||||
_bandiere = flags;
|
||||
flags &= ~(CTL_FLAG_MAC_MONACO9 | CTL_FLAG_MAC_GENEVA9);
|
||||
|
||||
if (wt == WC_PUSHBUTTON)
|
||||
win = xvt_create_pushbutton(r.left, r.top, r.right, r.bottom,
|
||||
caption, parent, flags, app_data, id);
|
||||
|
||||
#ifndef __CTL3D__
|
||||
if (wt == WC_CHECKBOX)
|
||||
win = xvt_create_checkbox(r.left, r.top, r.right, r.bottom,
|
||||
caption, parent, flags, app_data, id);
|
||||
|
||||
if (wt == WC_RADIOBUTTON)
|
||||
win = xvt_create_radiobutton(r.left, r.top, r.right, r.bottom,
|
||||
caption, parent, flags, app_data, id);
|
||||
|
||||
if (wt == WC_GROUPBOX)
|
||||
{
|
||||
win = xvt_create_groupbox(r.left, r.top, r.right, r.bottom,
|
||||
caption, parent, flags, app_data, id);
|
||||
}
|
||||
|
||||
if (wt == WC_TEXT)
|
||||
{
|
||||
win = xvt_create_text(r.left, r.top, r.right, r.bottom,
|
||||
caption, parent, flags, app_data, id);
|
||||
}
|
||||
#else
|
||||
if (wt == WC_GROUPBOX)
|
||||
{
|
||||
win = xvt_create_text(r.left, r.top, r.right, r.top+CHARY,
|
||||
caption, parent, 0, app_data, id);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
while (*caption == '@') caption += 2;
|
||||
WINDOW win = xvt_ctl_create(wt, &r, (char*)caption, parent,
|
||||
flags, app_data, id);
|
||||
if (win == NULL_WIN)
|
||||
{
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
if (wt == WC_PUSHBUTTON)
|
||||
{
|
||||
if (dy == 2) r.bottom -= ROWY;
|
||||
if (id == DLG_F9)
|
||||
{ wt = WC_TEXT; r.right = r.left+CHARX; caption = "*"; }
|
||||
else if (*caption == '*') caption = "";
|
||||
}
|
||||
#endif
|
||||
while (*caption == '@') caption += 2;
|
||||
win = xvt_ctl_create(wt, &r, (char*)caption, parent,
|
||||
flags, app_data, id);
|
||||
|
||||
if (win == NULL_WIN)
|
||||
fatal_box("Can't create control %d", id);
|
||||
}
|
||||
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#ifdef __CTL3D__
|
||||
if (wt != WC_PUSHBUTTON)
|
||||
#else
|
||||
if (wt == WC_EDIT || wt == WC_LISTBUTTON)
|
||||
#endif
|
||||
{
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
|
||||
SendMessage(hwnd, WM_SETFONT, NormalFont, FALSE);
|
||||
if (_bandiere & CTL_FLAG_MAC_MONACO9)
|
||||
SendMessage(hwnd, EM_SETPASSWORDCHAR, (WORD)'#', 0);
|
||||
#ifdef __CTL3D__
|
||||
Ctl3dSubclassCtl(hwnd);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
fatal_box("Can't create control %d: '%s'", id, caption);
|
||||
|
||||
return win;
|
||||
}
|
||||
@ -958,13 +678,8 @@ const char* xvt_get_title(
|
||||
|
||||
// @xref <f xvt_set_title>
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
const TControl* c = TControl::WINDOW2TControl(win);
|
||||
return c->caption();
|
||||
#else
|
||||
xvt_vobj_get_title(win, __tmp_string, 80);
|
||||
return __tmp_string;
|
||||
#endif
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -976,12 +691,7 @@ void xvt_set_title(
|
||||
|
||||
// @xref <f xvt_get_title>
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
c->set_caption(cap);
|
||||
#else
|
||||
xvt_vobj_set_title(win, (char*)cap);
|
||||
#endif
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -990,10 +700,6 @@ void xvt_set_title(
|
||||
void xvt_set_front_control(
|
||||
WINDOW win) // @parm Finestra nella quale abilitare il focus
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
c->focus(TRUE);
|
||||
#endif
|
||||
xvt_scr_set_focus_vobj(win);
|
||||
}
|
||||
|
||||
@ -1003,10 +709,6 @@ void xvt_set_front_control(
|
||||
void xvt_kill_focus(
|
||||
WINDOW win) // @parm Finestra nella quale togliere il focus
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
c->focus(FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -1016,12 +718,7 @@ void xvt_enable_control(
|
||||
WINDOW win, // @parm Finestra all'interno della quale abilitare il controllo
|
||||
bool on) // @parm Abilita (TRUE) o disabilita (FALSE) il controllo
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
c->enable(on);
|
||||
#else
|
||||
xvt_vobj_set_enabled(win, on);
|
||||
#endif
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -1031,12 +728,7 @@ void xvt_check_box(
|
||||
WINDOW win, // @parm Finestra all'interno della quale abilitare il check box
|
||||
bool on) // @parm Permette di inizializzare (TRUE) o scaricare (FALSE) i parametri
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
||||
c->check(on);
|
||||
#else
|
||||
xvt_ctl_set_checked(win, on);
|
||||
#endif
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -1050,12 +742,7 @@ void xvt_check_box(
|
||||
bool xvt_get_checked_state(
|
||||
WINDOW win) // @parm Finestra di cui si vuole conoscere lo stato
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
return c->checked();
|
||||
#else
|
||||
return xvt_ctl_is_checked(win) ? TRUE : FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -1066,12 +753,7 @@ void xvt_check_radio_button(
|
||||
const WINDOW* ctls, // @parm Array di stringhe contenenti le scelte del radiobutton
|
||||
int count) // @parm Numero di elementi del radiobutton
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
for (int i = 0; i < count; i++)
|
||||
xvt_check_box(ctls[i], ctls[i] == win);
|
||||
#else
|
||||
xvt_ctl_check_radio_button(win, (WINDOW*)ctls, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -1084,13 +766,6 @@ int xvt_get_checked_radio(
|
||||
int count) // @parm Numero di elemnti del radiobutton
|
||||
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
if (xvt_get_checked_state(ctls[i])) return i;
|
||||
|
||||
#ifdef DBG
|
||||
error_box("Accendi la tua radio per favore!");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1102,10 +777,6 @@ void xvt_set_ctrl_back_color(
|
||||
WINDOW win, // @parm Finestra di cui si vuole cambiare lo sfondo
|
||||
COLOR col) // @parm Colore dello sfondo
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
||||
c->set_back_color(col);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1172,7 +843,7 @@ void xvt_statbar_set(
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @func Permette di aggiornare il titolo alla barra di stato presente
|
||||
// @func Permette di cambiare il titolo alla barra di stato presente
|
||||
void xvt_statbar_refresh()
|
||||
|
||||
// @xref <f xvt_create_statbar> <f xvt_statbar_set>
|
||||
@ -1261,6 +932,38 @@ COLOR trans_color(
|
||||
return col;
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
// @mfunc Cambia il cursore del mouse
|
||||
HIDDEN void set_cursor(
|
||||
bool w) // @parm Indica il tipo di cursore da utilizzare:
|
||||
//
|
||||
// @flag TRUE | Cursore a clessidra per le wait
|
||||
// @flag FALSE | Cursore a frecca normale
|
||||
{
|
||||
static int _count = 0;
|
||||
|
||||
if (w)
|
||||
{
|
||||
if (_count == 0)
|
||||
xvt_win_set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||
_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_count--;
|
||||
CHECK(_count >= 0, "end_wait without matching begin_wait");
|
||||
if (_count == 0)
|
||||
xvt_win_set_cursor(TASK_WIN, CURSOR_ARROW);
|
||||
}
|
||||
}
|
||||
|
||||
void begin_wait()
|
||||
{ set_cursor(TRUE); }
|
||||
|
||||
void end_wait()
|
||||
{ set_cursor(FALSE); }
|
||||
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @func Permette di converitire lo stile del pattern in attributi grafici da
|
||||
|
@ -29,44 +29,26 @@ WINDOW xvt_create_window
|
||||
long app_data
|
||||
);
|
||||
|
||||
WINDOW xvt_create_control
|
||||
(
|
||||
WIN_TYPE wt,
|
||||
short x, short y, short dx, short dy,
|
||||
const char* caption,
|
||||
WINDOW parent,
|
||||
long flags,
|
||||
long app_data,
|
||||
int id
|
||||
);
|
||||
|
||||
WINDOW xvt_create_statbar();
|
||||
void xvt_statbar_set(const char* text, bool def = FALSE);
|
||||
void xvt_statbar_refresh();
|
||||
|
||||
void beep();
|
||||
void do_events();
|
||||
|
||||
void customize_colors();
|
||||
void customize_controls(bool on);
|
||||
|
||||
KEY e_char_to_key(const EVENT* ep);
|
||||
void dispatch_event(WINDOW win, const EVENT& e, bool post);
|
||||
void dispatch_e_menu(WINDOW win, MENU_TAG item);
|
||||
void dispatch_e_char(WINDOW win, KEY key);
|
||||
void dispatch_e_scroll(WINDOW win, KEY key);
|
||||
|
||||
void begin_wait();
|
||||
void end_wait();
|
||||
|
||||
void xvt_set_font(WINDOW win, const char* family, int style, int dim = 0);
|
||||
XVT_FNTID xvt_default_font();
|
||||
|
||||
void xvt_set_front_control(WINDOW win);
|
||||
void xvt_kill_focus(WINDOW win);
|
||||
const char* xvt_get_title(WINDOW win);
|
||||
void xvt_set_title(WINDOW win, const char* title);
|
||||
void xvt_enable_control(WINDOW win, bool on);
|
||||
void xvt_check_box(WINDOW win, bool on);
|
||||
bool xvt_get_checked_state(WINDOW win);
|
||||
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
|
||||
int xvt_get_checked_radio(const WINDOW* ctls, int count);
|
||||
void xvt_set_ctrl_back_color(WINDOW win, COLOR col);
|
||||
void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p);
|
||||
|
||||
bool xvt_test_menu_tag(MENU_TAG tag);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user