Patch level : 10.0

Files correlati     : relapp
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@16949 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-07-25 15:13:17 +00:00
parent e42671d911
commit 7ad78a68a2
2 changed files with 78 additions and 68 deletions

View File

@ -6,6 +6,7 @@
#include <sheet.h>
#include <recarray.h>
#include <relapp.h>
#include <statbar.h>
#include <urldefid.h>
#include <utility.h>
@ -127,57 +128,64 @@ void TRelation_application::set_limits(
void TRelation_application::set_find_button()
{
int pos = _mask->id2pos(DLG_FINDREC);
if (pos >= 0 && _mask->id2pos(DLG_FIRSTREC) >= 0) //se e' un bottone pentapartito...
{
TButton_field& f_find = (TButton_field &)_mask->fld(pos);
RCT rct_base; f_find.get_rect(rct_base);
const int bwidth = (rct_base.right - rct_base.left);
const int bheight = (rct_base.bottom - rct_base.top);
if (bwidth > 3*bheight/2) // Controllo se ho gia' ridimensionato i bottoni in precedenza
{
int bx = bwidth / 3;
int by = bheight / 2;
RCT r = rct_base;
r.left += bx; r.right -= bx;
if (!NATIVE_CONTROLS)
// Ricalcola posizioni bootoni di navigazione con la vecchia toolbar
if (_mask->toolbar() == NULL_WIN) // Non c'e' la nuova relapbar
{
int pos = _mask->id2pos(DLG_FINDREC);
if (pos >= 0 && _mask->id2pos(DLG_FIRSTREC) >= 0) //se e' un bottone pentapartito...
{
TButton_field& f_find = (TButton_field &)_mask->fld(pos);
RCT rct_base; f_find.get_rect(rct_base);
const int bwidth = (rct_base.right - rct_base.left);
const int bheight = (rct_base.bottom - rct_base.top);
if (bwidth > 3*bheight/2) // Controllo se ho gia' ridimensionato i bottoni in precedenza
{
r.left -= 2; r.right += 2;
}
f_find.set_rect(r); // Ridimensiona il bottone centrale di ricerca
if (!NATIVE_CONTROLS)
{
bx += 5; by += 3; // Aggiusta dimensioni bottoni sussidiari
}
int bx = bwidth / 3;
int by = bheight / 2;
RCT r = rct_base;
r.left += bx; r.right -= bx;
if (!NATIVE_CONTROLS)
{
r.left -= 2; r.right += 2;
}
f_find.set_rect(r); // Ridimensiona il bottone centrale di ricerca
if (!NATIVE_CONTROLS)
{
bx += 5; by += 3; // Aggiusta dimensioni bottoni sussidiari
}
pos = _mask->id2pos(DLG_FIRSTREC);
if (pos >= 0)
{
r = rct_base; r.top = r.bottom - by; r.right = r.left + bx;
_mask->fld(pos).set_rect(r);
}
pos = _mask->id2pos(DLG_PREVREC);
if (pos >= 0)
{
r = rct_base; r.bottom = r.top + by; r.right = r.left + bx;
_mask->fld(pos).set_rect(r);
}
pos = _mask->id2pos(DLG_NEXTREC);
if (pos >= 0)
{
r = rct_base; r.bottom = r.top + by; r.left = r.right - bx;
_mask->fld(pos).set_rect(r);
}
pos = _mask->id2pos(DLG_LASTREC);
if (pos >= 0)
{
r = rct_base; r.top = r.bottom - by; r.left = r.right - bx;
_mask->fld(pos).set_rect(r);
}
}
}
}
else
xvt_toolbar_realize(_mask->toolbar());
pos = _mask->id2pos(DLG_FIRSTREC);
if (pos >= 0)
{
r = rct_base; r.top = r.bottom - by; r.right = r.left + bx;
_mask->fld(pos).set_rect(r);
}
pos = _mask->id2pos(DLG_PREVREC);
if (pos >= 0)
{
r = rct_base; r.bottom = r.top + by; r.right = r.left + bx;
_mask->fld(pos).set_rect(r);
}
pos = _mask->id2pos(DLG_NEXTREC);
if (pos >= 0)
{
r = rct_base; r.bottom = r.top + by; r.left = r.right - bx;
_mask->fld(pos).set_rect(r);
}
pos = _mask->id2pos(DLG_LASTREC);
if (pos >= 0)
{
r = rct_base; r.top = r.bottom - by; r.left = r.right - bx;
_mask->fld(pos).set_rect(r);
}
}
}
}
bool TRelation_application::create()
@ -279,19 +287,20 @@ void TRelation_application::set_toolbar()
const long recno = get_relation()->lfile().recno();
const bool enable_next_prev = _mask->edit_mode();
const bool can_nav = _lnflag == 0 && _curr_transaction != TRANSACTION_LINK;
pos = _mask->id2pos(DLG_FIRSTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && (enable_next_prev ? _first != recno : _first > 0));
_mask->fld(pos).enable(can_nav && (enable_next_prev ? _first != recno : _first > 0));
pos = _mask->id2pos(DLG_PREVREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && enable_next_prev && _first > 0 && _first != recno);
_mask->fld(pos).enable(can_nav && enable_next_prev && _first > 0 && _first != recno);
pos = _mask->id2pos(DLG_NEXTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && enable_next_prev && _last > 0 && _last != recno);
_mask->fld(pos).enable(can_nav && enable_next_prev && _last > 0 && _last != recno);
pos = _mask->id2pos(DLG_LASTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && (enable_next_prev ? _last != recno : _last > 0));
_mask->fld(pos).enable(can_nav && (enable_next_prev ? _last != recno : _last > 0));
}
pos = _mask->id2pos(DLG_NEWREC);
@ -315,7 +324,7 @@ void TRelation_application::update_navigation_bar()
}
bool TRelation_application::save_and_new() const
{ return FALSE; }
{ return false; }
int TRelation_application::set_mode(int mode)
{

View File

@ -519,22 +519,23 @@ WINDOW xvtil_create_statbar()
{
CHECK(_statbar == NULL_WIN, "Onli uan statbar, plis");
const int prop_count = 4;
char* prop_list[prop_count+1] =
if (TASK_WIN != NULL_WIN) // Puo' succedere in chiusura menu
{
"Status bar",
"HEIGHT=24",
"TASK_WIN",
"FIELD_OFFSET=24",
NULL
};
_statbar = statbar_create(0, 0, 600, 1024, 800, prop_count, prop_list,
TASK_WIN, 0, 0, "");
CHECK(_statbar, "Can't create the status bar");
statbar_set_fontid(_statbar, xvt_default_font());
const int prop_count = 4;
char* prop_list[prop_count+1] =
{
"Status bar",
"HEIGHT=24",
"TASK_WIN",
"FIELD_OFFSET=24",
NULL
};
_statbar = statbar_create(0, 0, 600, 1024, 800, prop_count, prop_list,
TASK_WIN, 0, 0, "");
CHECK(_statbar, "Can't create the status bar");
statbar_set_fontid(_statbar, xvt_default_font());
}
return _statbar;
}