Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : stack.* Aggiunto metodo destroy strings.* Aggiunti costruttori ed operator= per le TStingNN tree.cpp Aumentata spaziature righe della TTree_window urldefid.h Aggiunto BMP_STOP window.cpp Corretta TScroll_window::dev2log git-svn-id: svn://10.65.10.50/trunk@6854 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
29cfcac9e8
commit
12227a589a
@ -25,6 +25,12 @@ TObject& TStack::peek(int depth) const
|
|||||||
return _data[_sp-depth-1];
|
return _data[_sp-depth-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TStack::destroy()
|
||||||
|
{
|
||||||
|
_data.destroy();
|
||||||
|
_sp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool TStack::destroy_base()
|
bool TStack::destroy_base()
|
||||||
{
|
{
|
||||||
if (_sp > 0) _sp--;
|
if (_sp > 0) _sp--;
|
||||||
|
@ -34,6 +34,8 @@ public:
|
|||||||
TObject& pop();
|
TObject& pop();
|
||||||
// @cmember Ritorna l'oggetto ad una data profondita' nello stack
|
// @cmember Ritorna l'oggetto ad una data profondita' nello stack
|
||||||
TObject& peek(int depth = 0) const;
|
TObject& peek(int depth = 0) const;
|
||||||
|
// @cmember Distrugge l'intero stack
|
||||||
|
void destroy();
|
||||||
// @cmember Distrugge l'oggetto alla base dello stack
|
// @cmember Distrugge l'oggetto alla base dello stack
|
||||||
bool destroy_base();
|
bool destroy_base();
|
||||||
// @cmember Costruttore. Chiama il costruttore di <c TArray>
|
// @cmember Costruttore. Chiama il costruttore di <c TArray>
|
||||||
|
@ -118,7 +118,7 @@ void TString::resize(
|
|||||||
else *s = '\0';
|
else *s = '\0';
|
||||||
|
|
||||||
if (_str)
|
if (_str)
|
||||||
delete [] _str;
|
delete _str;
|
||||||
|
|
||||||
_str = s;
|
_str = s;
|
||||||
_size = size;
|
_size = size;
|
||||||
@ -193,7 +193,7 @@ TString::TString() : _str(NULL), _size(0)
|
|||||||
TString::~TString()
|
TString::~TString()
|
||||||
{
|
{
|
||||||
if (_str)
|
if (_str)
|
||||||
delete [] _str;
|
delete _str;
|
||||||
}
|
}
|
||||||
|
|
||||||
char TString::shift(int n)
|
char TString::shift(int n)
|
||||||
|
@ -317,12 +317,18 @@ public:
|
|||||||
// @cmember Costruttore
|
// @cmember Costruttore
|
||||||
TString16(const TString& s) : TFixed_string(_str16, 17)
|
TString16(const TString& s) : TFixed_string(_str16, 17)
|
||||||
{ set(s); }
|
{ set(s); }
|
||||||
|
// @cmember Costruttore
|
||||||
|
TString16(const TString16& s) : TFixed_string(_str16, 17)
|
||||||
|
{ set(s); }
|
||||||
|
// @cmember Assegna una stringa
|
||||||
|
const TString& operator =(const char* s)
|
||||||
|
{ return set(s); }
|
||||||
// @cmember Assegna una stringa
|
// @cmember Assegna una stringa
|
||||||
const TString& operator =(const TString& s)
|
const TString& operator =(const TString& s)
|
||||||
{ return set((const char*)s); }
|
{ return set((const char*)s); }
|
||||||
// @cmember Assegna una stringa
|
// @cmember Assegna una stringa
|
||||||
const TString& operator =(const char* s)
|
const TString& operator =(const TString16& s)
|
||||||
{ return set(s); }
|
{ return set((const char*)s); }
|
||||||
|
|
||||||
// @comm Sono definite anche le classi <c TString80> e <c TString256> per le
|
// @comm Sono definite anche le classi <c TString80> e <c TString256> per le
|
||||||
// stringhe rispettivamente di 80 e 256 caratteri. I class member sono
|
// stringhe rispettivamente di 80 e 256 caratteri. I class member sono
|
||||||
@ -346,8 +352,10 @@ class TString80 : public TFixed_string
|
|||||||
public:
|
public:
|
||||||
TString80(const char* s = "") : TFixed_string(_str80, 81) { set(s); }
|
TString80(const char* s = "") : TFixed_string(_str80, 81) { set(s); }
|
||||||
TString80(const TString& s) : TFixed_string(_str80, 81) { set(s); }
|
TString80(const TString& s) : TFixed_string(_str80, 81) { set(s); }
|
||||||
|
TString80(const TString80& s) : TFixed_string(_str80, 81) { set(s); }
|
||||||
const TString& operator =(const char* s) { return set(s); }
|
const TString& operator =(const char* s) { return set(s); }
|
||||||
const TString& operator =(const TString& s) { return set((const char*)s); }
|
const TString& operator =(const TString& s) { return set((const char*)s); }
|
||||||
|
const TString& operator =(const TString80& s) { return set((const char*)s); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
@ -367,8 +375,10 @@ class TString256 : public TFixed_string
|
|||||||
public:
|
public:
|
||||||
TString256(const char* s = "") : TFixed_string(_str256, 257) { set(s); }
|
TString256(const char* s = "") : TFixed_string(_str256, 257) { set(s); }
|
||||||
TString256(const TString& s) : TFixed_string(_str256, 257) { set(s); }
|
TString256(const TString& s) : TFixed_string(_str256, 257) { set(s); }
|
||||||
|
TString256(const TString256& s) : TFixed_string(_str256, 257) { set(s); }
|
||||||
const TString& operator =(const char* s) { return set(s); }
|
const TString& operator =(const char* s) { return set(s); }
|
||||||
const TString& operator =(const TString& s) { return set((const char*)s); }
|
const TString& operator =(const TString& s) { return set((const char*)s); }
|
||||||
|
const TString& operator =(const TString256& s) { return set((const char*)s); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
@ -797,10 +797,14 @@ class TTree_window : public TField_window
|
|||||||
TNode_info_array _node_info;
|
TNode_info_array _node_info;
|
||||||
TNode_info _curr_info; // Nodo attualmente selezionato
|
TNode_info _curr_info; // Nodo attualmente selezionato
|
||||||
|
|
||||||
|
static int _row_height;
|
||||||
|
|
||||||
protected: // TWindow
|
protected: // TWindow
|
||||||
virtual void update();
|
virtual void update();
|
||||||
virtual bool on_key(KEY key);
|
virtual bool on_key(KEY key);
|
||||||
virtual void handler(WINDOW win, EVENT* ep);
|
virtual void handler(WINDOW win, EVENT* ep);
|
||||||
|
PNT log2dev(long x, long y) const;
|
||||||
|
TPoint dev2log(const PNT& p) const;
|
||||||
|
|
||||||
protected: // Internal use
|
protected: // Internal use
|
||||||
static bool callback_draw_node(TTree& node, void* jolly, word);
|
static bool callback_draw_node(TTree& node, void* jolly, word);
|
||||||
@ -820,6 +824,10 @@ public:
|
|||||||
virtual ~TTree_window() { }
|
virtual ~TTree_window() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int TTree_window::_row_height = CHARY+2;
|
||||||
|
|
||||||
|
const int TABX = 3;
|
||||||
|
|
||||||
struct TUpdate_info
|
struct TUpdate_info
|
||||||
{
|
{
|
||||||
TTree_window* _win;
|
TTree_window* _win;
|
||||||
@ -831,7 +839,40 @@ struct TUpdate_info
|
|||||||
TNode_info* _curr_info;
|
TNode_info* _curr_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
const int TABX = 3;
|
|
||||||
|
PNT TTree_window::log2dev(long x, long y) const
|
||||||
|
{
|
||||||
|
if (autoscrolling())
|
||||||
|
{
|
||||||
|
if (_pixmap)
|
||||||
|
{
|
||||||
|
x -= origin().x * CHARX;
|
||||||
|
y -= origin().y * _row_height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x -= origin().x;
|
||||||
|
y -= origin().y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PNT pnt; pnt.h = (int)x; pnt.v = (int)y;
|
||||||
|
|
||||||
|
if (!_pixmap)
|
||||||
|
{
|
||||||
|
pnt.h *= CHARX;
|
||||||
|
pnt.v *= _row_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
TPoint TTree_window::dev2log(const PNT& p) const
|
||||||
|
{
|
||||||
|
TPoint pnt(_pixmap ? p.h : p.h/CHARX, _pixmap ? p.v : p.v/_row_height);
|
||||||
|
return pnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TTree_window::callback_draw_node(TTree& node, void* jolly, word when)
|
bool TTree_window::callback_draw_node(TTree& node, void* jolly, word when)
|
||||||
{
|
{
|
||||||
@ -873,16 +914,16 @@ bool TTree_window::callback_draw_node(TTree& node, void* jolly, word when)
|
|||||||
ui->_win->set_pen(DISABLED_COLOR);
|
ui->_win->set_pen(DISABLED_COLOR);
|
||||||
|
|
||||||
PNT q;
|
PNT q;
|
||||||
q.h = p.h; q.v = p.v + CHARY/2;
|
q.h = p.h; q.v = p.v + _row_height/2;
|
||||||
xvt_dwin_draw_set_pos(win, q);
|
xvt_dwin_draw_set_pos(win, q);
|
||||||
q.h -= TABX*CHARX - 3*CHARX/2;
|
q.h -= TABX*CHARX - 3*CHARX/2;
|
||||||
xvt_dwin_draw_line(win, q);
|
xvt_dwin_draw_line(win, q);
|
||||||
q.v = (by+1)*CHARY;
|
q.v = (by+1)*_row_height;
|
||||||
xvt_dwin_draw_line(win, q);
|
xvt_dwin_draw_line(win, q);
|
||||||
|
|
||||||
TImage* bmp = node.image(is_selected);
|
TImage* bmp = node.image(is_selected);
|
||||||
if (bmp)
|
if (bmp)
|
||||||
bmp->draw(win, p.h, p.v + (CHARY - bmp->height()) / 2);
|
bmp->draw(win, p.h, p.v + (_row_height - bmp->height()) / 2);
|
||||||
|
|
||||||
TNode_info& ni = (*ui->_node_info)[ry];
|
TNode_info& ni = (*ui->_node_info)[ry];
|
||||||
node.curr_id(ni._id);
|
node.curr_id(ni._id);
|
||||||
@ -945,7 +986,7 @@ void TTree_window::draw_plus_minus()
|
|||||||
|
|
||||||
WINDOW w = win();
|
WINDOW w = win();
|
||||||
PNT r = log2dev(ni._plusx, firsty + i);
|
PNT r = log2dev(ni._plusx, firsty + i);
|
||||||
r.v += CHARY/2;
|
r.v += _row_height/2;
|
||||||
r.h += CHARX/2;
|
r.h += CHARX/2;
|
||||||
|
|
||||||
RCT rct;
|
RCT rct;
|
||||||
@ -1182,7 +1223,9 @@ void TTree_window::handler(WINDOW win, EVENT* ep)
|
|||||||
if (_tree)
|
if (_tree)
|
||||||
{
|
{
|
||||||
const int c = ep->v.mouse.where.h / CHARX;
|
const int c = ep->v.mouse.where.h / CHARX;
|
||||||
const int r = ep->v.mouse.where.v / CHARY;
|
const int r = ep->v.mouse.where.v / _row_height;
|
||||||
|
dev2log(ep->v.mouse.where);
|
||||||
|
|
||||||
TNode_info ni;
|
TNode_info ni;
|
||||||
bool ok = index2info(r, ni);
|
bool ok = index2info(r, ni);
|
||||||
if (ok && (c == ni._plusx || (c >= ni._startx && c < ni._endx)) &&
|
if (ok && (c == ni._plusx || (c >= ni._startx && c < ni._endx)) &&
|
||||||
@ -1220,8 +1263,10 @@ void TTree_window::handler(WINDOW win, EVENT* ep)
|
|||||||
|
|
||||||
TTree_window::TTree_window(int x, int y, int dx, int dy,
|
TTree_window::TTree_window(int x, int y, int dx, int dy,
|
||||||
WINDOW parent, TTree_field* owner)
|
WINDOW parent, TTree_field* owner)
|
||||||
: TField_window(x, y, dx, dy, parent, owner), _tree(NULL), _hide_leaves(FALSE)
|
: TField_window(x, y, dx, dy, parent, owner), _tree(NULL),
|
||||||
|
_hide_leaves(FALSE)
|
||||||
{
|
{
|
||||||
|
_row_height = CHARY+2;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -81,6 +81,7 @@
|
|||||||
#define BMP_DIR 167
|
#define BMP_DIR 167
|
||||||
#define BMP_DIRDN 168
|
#define BMP_DIRDN 168
|
||||||
#define BMP_FILE 169
|
#define BMP_FILE 169
|
||||||
|
#define BMP_STOP 170
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -744,7 +744,9 @@ TPoint TWindow::size() const
|
|||||||
{
|
{
|
||||||
RCT r;
|
RCT r;
|
||||||
xvt_vobj_get_client_rect(win() ? win() : TASK_WIN, &r);
|
xvt_vobj_get_client_rect(win() ? win() : TASK_WIN, &r);
|
||||||
return TPoint(r.right / CHARX, r.bottom / CHARY);
|
// return TPoint(r.right / CHARX, r.bottom / CHARY);
|
||||||
|
PNT p; p.h = r.right; p.v = r.bottom;
|
||||||
|
return dev2log(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
WINDOW TWindow::parent() const
|
WINDOW TWindow::parent() const
|
||||||
@ -752,7 +754,6 @@ WINDOW TWindow::parent() const
|
|||||||
return xvt_vobj_get_parent(win());
|
return xvt_vobj_get_parent(win());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TWindow::set_focus()
|
void TWindow::set_focus()
|
||||||
{
|
{
|
||||||
WINDOW w = win();
|
WINDOW w = win();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user