Patch level :10.0 patch 24

Files correlati     : tutta la base ed anche l'ipotenusa
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@16462 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-04-04 16:03:36 +00:00
parent 064cc45035
commit fab5abc300
40 changed files with 1090 additions and 856 deletions

View File

@ -261,10 +261,10 @@ TPicture_mask::TPicture_mask(const char* name, int dx, int dy,
{
set_current(submenu);
TFilename logoname;
const char* const ext[] = { "jpg", "png", "gif", "bmp", NULL };
const char* const ext[] = { "jpg", "png", "gif", "bmp", "jpeg", NULL };
for (int i = 0; ext[i]; i++)
{
logoname = "logo."; logoname << ext[i];
logoname = "logo"; logoname.ext(ext[i]);
if (logoname.custom_path())
break;
}
@ -368,6 +368,10 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
}
}
break;
case DLG_EDIT:
if (e == fe_button)
dispatch_e_menu(TASK_WIN, MENU_ITEM(2));
break;
default:
if (id >= 101 && id <= 113 && e == fe_button)
{
@ -1146,19 +1150,11 @@ bool TMenu_application::test_programs()
bool TMenu_application::user_create()
{
disable_menu_item(M_FILE_PRINT); // Questa voce di menu non serve per ora
if (dongle().type() == _no_dongle)
{
TMask w(TR("ATTENZIONE"), 1, 68, 10);
w.add_static(DLG_NULL, 0 , PR("@bATTENZIONE") , 30 , 1);
w.add_static(DLG_NULL, 0 , TR("Questo programma è in versione dimostrativa.") , 1 , 3);
w.add_static(DLG_NULL, 0 , TR("Il programma funziona circa per due ore ogni giorno.") , 1 , 5);
w.add_static(DLG_NULL, 0 , TR("Il numero di registrazioni è stato limitato ad un migliaio.") , 1 , 7);
w.add_button(DLG_OK, 0, "", -11, -1, 10, 2);
w.run();
}
warning_box(TR("ATTENZIONE\nQuesto programma è in versione dimostrativa.\n"
"Esso funzionera' per circa due ore al giorno con un numero limitato di registrazioni."));
if (!check_user())
return false;

View File

@ -1,13 +1,17 @@
#include <controls.h>
#include <diction.h>
#include <mask.h>
#include <prefix.h>
#include <statbar.h>
#include <toolfld.h>
#include <urldefid.h>
#include <utility.h>
#include "ba0102.h"
#define F_OPTIONS 201
#define F_STAR 204
#define F_ADDSTAR 205
///////////////////////////////////////////////////////////
// TMenu_tree
///////////////////////////////////////////////////////////
@ -462,11 +466,10 @@ protected:
virtual void update();
virtual void handler(WINDOW win, EVENT* ep);
virtual bool on_key(KEY k);
virtual void on_idle();
void synchronize_buddy_tree() const;
void draw_item(int i);
void draw_menu_caption(COLOR rgb);
void draw_menu_caption();
void click_on(int index);
void select(int s, int direction);
@ -549,7 +552,7 @@ void TMenulist_window::draw_item(int i)
}
//scrive la voce di menu corrente a video
void TMenulist_window::draw_menu_caption(COLOR rgb)
void TMenulist_window::draw_menu_caption()
{
const char* caption = "";
if (_sorted.items() > 1)
@ -563,26 +566,7 @@ void TMenulist_window::draw_menu_caption(COLOR rgb)
const TMenuitem& mi = (const TMenuitem&)_sorted[0];
caption = mi.caption();
}
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
const int x = rct.left+2;
int y = rct.bottom-CHARY;
if (ADVANCED_GRAPHICS)
{
const TImage* logo = _images.image("logo");
if (logo != NULL)
y -= logo->height() + ROWY; //+ROWY per staccare scritta dal logo
}
XVT_FNTID font_menu = xvt_font_create();
xvt_font_copy(font_menu, xvt_default_font(true), XVT_FA_ALL);
const int size = xvt_font_get_size(font_menu);
xvt_font_set_size(font_menu, 130 * size / 100); //altezza font il 30% maggiore di quello di menu
xvt_dwin_set_font(win(), font_menu);
set_color(rgb, NORMAL_BACK_COLOR);
xvt_dwin_draw_text(win(), x, y, caption, -1);
xvt_font_destroy(font_menu);
xvt_pane_set_title(win(), caption);
statbar_set_title(TASK_WIN, caption);
}
@ -592,7 +576,7 @@ void TMenulist_window::update()
if (_tree == NULL)
return; // Nothing to draw
const bool db = _tree != NULL && ADVANCED_GRAPHICS;
const bool db = ADVANCED_GRAPHICS;
TImage* img = db ? _images.image(_image_name) : NULL; // Delay time before clearing
if (img != NULL)
@ -615,29 +599,7 @@ void TMenulist_window::update()
FOR_EACH_ARRAY_ITEM(_sorted, i, obj)
draw_item(i);
if (ADVANCED_GRAPHICS)
_last_update = clock();
else
draw_menu_caption(NORMAL_COLOR);
}
void TMenulist_window::on_idle()
{
if (ADVANCED_GRAPHICS)
{
#ifdef LINUX
const clock_t max_clock = (3*CLOCKS_PER_SEC) / 10;
#else
const clock_t max_clock = 3*CLOCKS_PER_SEC;
#endif
const clock_t elapsed = clock() - _last_update;
if (elapsed <= max_clock)
{
const double perc = double(elapsed) / double(max_clock);
const COLOR rgb = blend_colors(NORMAL_COLOR, NORMAL_BACK_COLOR, perc);
draw_menu_caption(rgb);
}
}
draw_menu_caption();
}
void TMenulist_window::click_on(int index)
@ -945,7 +907,7 @@ void draw_spider(WINDOW w, int mode, const PNT& mouse)
if (_spider < 0)
_spider = ADVANCED_GRAPHICS && is_power_station(); // Attiva eventuale ragno
if (_spider && w != NULL_WIN)
if (_spider && xvt_vobj_is_focusable(w))
{
RCT client; xvt_vobj_get_client_rect(w, &client);
@ -1088,7 +1050,7 @@ bool TSpidey_mask::stop_run(KEY k)
}
}
// Butto via le immagini dopo averle disegnate tutte
for (i = 2; i >= 0; i--)
for (i = 3; i >= 0; i--)
xvt_image_destroy(image[i]);
if (installing()) //se e' stata lanciata la installazione moduli...
@ -1099,7 +1061,7 @@ bool TSpidey_mask::stop_run(KEY k)
{
if (!yesno_box(TR("Si desidera uscire?"))) //..altrimenti chiede educatamente se si desidera uscire
{
for (i = 0; i < 3; i++)
for (i = 3; i >= 0; i--)
xvt_dwin_invalidate_rect(window[i], NULL);
return false;
}
@ -1118,7 +1080,7 @@ bool TSpidey_mask::on_key(KEY k)
return TMask::on_key(k);
}
TSpidey_mask::TSpidey_mask() : TAutomask ("", 1, 0, 0, 0, 0)
TSpidey_mask::TSpidey_mask() : TAutomask ("Menu", 1, 0, 0, 0, 0)
{ }
///////////////////////////////////////////////////////////
@ -1153,16 +1115,6 @@ void TExplorer_mask::handler(WINDOW win, EVENT* ep)
TSpidey_mask::handler(win, ep);
}
void TExplorer_mask::on_idle()
{
if (ADVANCED_GRAPHICS)
{
TWindowed_field& lf = (TWindowed_field&)field(DLG_LIST);
lf.win().on_idle();
}
}
void TExplorer_mask::select_tree_current()
{
TTree_field& tf = tfield(DLG_TREE);
@ -1199,21 +1151,28 @@ bool TExplorer_mask::on_field_event(TOperable_field& o, TField_event e, long jol
mt.goto_root();
select_tree_current();
}
case DLG_USER:
if (e == fe_modify && !o.empty())
break;
case DLG_FINDREC:
if (e == fe_button)
{
const TString& v = o.get();
TTree_field& tf = tfield(DLG_TREE);
TMenu_tree& mt = *(TMenu_tree*)tf.tree();
if (mt.find_string(v))
TString80 str = _last_search_string;
const char* s = xvt_dm_post_string_prompt(TR("Testo"), str.get_buffer(), str.size());
if (s && *s)
{
select_tree_current();
_last_search_string = v;
_last_search_string = s;
send_key(K_F3, 0);
}
else
beep();
}
break;
case TOOL_CONFIG:
dispatch_e_menu(TASK_WIN, MENU_ITEM(2));
break;
case TOOL_PREF:
dispatch_e_menu(TASK_WIN, MENU_ITEM(6));
break;
case TOOL_ADDPREF:
dispatch_e_menu(TASK_WIN, MENU_ITEM(5));
break;
default:
break;
}
@ -1224,7 +1183,12 @@ bool TExplorer_mask::on_key(KEY k)
{
if (k == K_F3 || k == K_F8)
{
set(DLG_USER, _last_search_string, true);
TTree_field& tf = tfield(DLG_TREE);
TMenu_tree& mt = *(TMenu_tree*)tf.tree();
if (_last_search_string.full() && mt.find_string(_last_search_string))
select_tree_current();
else
beep();
return true;
}
return TSpidey_mask::on_key(k);
@ -1232,12 +1196,16 @@ bool TExplorer_mask::on_key(KEY k)
TExplorer_mask::TExplorer_mask(TMenu& menu) : _tree(menu)
{
// Bottom Toolbar
insert_page("4", -1); // Crea toolbar di "4" righe
add_button(DLG_QUIT, -1, "", -12, -2, 18, 2);
add_button(DLG_SHRINK, -1, PR("Menu Principale"), -22, -2, 18, 2);
add_string(DLG_USER, -1, PR("Cerca "), 11, -4, 50);
add_button_tool(DLG_SHRINK, TR("Menu Principale"), TOOL_FIRSTREC);
add_button_tool(DLG_FINDREC, TR("Ricerca"), TOOL_LENTE);
add_button_tool(TOOL_CONFIG, TR("Opzioni"), TOOL_CONFIG);
add_button_tool(TOOL_PREF, TR("Preferiti"), TOOL_PREF);
add_button_tool(TOOL_ADDPREF,TR("Aggiungi ai Preferiti"), TOOL_ADDPREF);
add_button_tool(DLG_INFO, TR("Info"), TOOL_INFO);
add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP);
add_button_tool(DLG_QUIT, TR("Fine"), TOOL_QUIT);
WINDOW panel = page_win(0);
// Tree view
TTree_field& trifola = add_tree(DLG_TREE, 0, 0, 0, 32, 0);
@ -1246,13 +1214,12 @@ TExplorer_mask::TExplorer_mask(TMenu& menu) : _tree(menu)
// List view
TMenulist_field* mf = new TMenulist_field(this);
mf->create(DLG_LIST, 21, 0, 0, 0, win());
mf->create(DLG_LIST, 48, 0, 0, 0, panel);
mf->set_menu(*(TMenu_tree*)trifola.tree());
add_field(mf);
xvt_win_add_pane(win(), dlg2win(DLG_LIST), "Main", 0, 0); // Main pane
xvt_win_add_pane(win(), dlg2win(DLG_TREE), "Menu", 1, 0); // Left pane
first_focus(DLG_LIST);
xvt_pane_add(panel, dlg2win(DLG_LIST), "Main", 0, 0); // Right pane
xvt_pane_change_flags(dlg2win(DLG_LIST), 1<<10,0);
xvt_pane_add(panel, dlg2win(DLG_TREE), "Menu", 1, 0); // Left pane
set_handlers();
}

View File

@ -107,7 +107,6 @@ class TExplorer_mask : public TSpidey_mask
protected: // TMask
virtual void update();
virtual void handler(WINDOW win, EVENT* ep);
virtual void on_idle();
virtual bool on_key(KEY k);
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);

View File

@ -3,92 +3,281 @@
#include <defmask.h>
#include <xvtility.h>
enum { DLG_TREE = 101, DLG_LOOK = 102, DLG_MAIN = 103 };
///////////////////////////////////////////////////////////
// TCampo_window
// TApp_window & TBook_window declarations
///////////////////////////////////////////////////////////
class TCampo_window : public TField_window
class TBook_window;
class TApp_window : public TWindow
{
TBook_window* _owner;
protected:
virtual void handler(WINDOW win, EVENT* ep);
public:
TApp_window(TBook_window* owner);
};
class TBook_window : public TControl_host_window
{
TImage _logo;
protected:
virtual void update();
virtual void handler(WINDOW win, EVENT* ep);
short pages() const;
void force_page(short page);
void erode_antipa();
public:
TCampo_window(int x, int y, int dx, int dy,
WINDOW parent, TWindowed_field* owner);
~TCampo_window();
WINDOW notebook() const { return _ctrl; }
short add_page(const TString& caption);
void set_page_caption(short page, const TString& caption);
bool remove_page(WINDOW page);
TBook_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner);
~TBook_window();
};
void TCampo_window::update()
///////////////////////////////////////////////////////////
// TApp_window
///////////////////////////////////////////////////////////
void TApp_window::handler(WINDOW win, EVENT* ep)
{
TField_window::update();
RCT rctw; xvt_vobj_get_client_rect(win(), &rctw);
if (rctw.right >= 32)
switch (ep->type)
{
if (_logo.ok())
case E_TIMER:
if (xvt_vobj_is_focusable(win))
{
RCT rcti = _logo.rect();
if (rcti.right > rctw.right)
// Leggo il titolo della finestra corrente
TString256 title;
xvt_vobj_get_title(win, title.get_buffer(), title.size());
// Se la finestra ospita gia' un'applicazione non si chiama piu' "__CAMPO_MENU__"
if (title != __MAGIC_CAPTION__)
{
const double ratio = double(rctw.right) / double(rcti.right);
rcti.right = int(rcti.right * ratio);
rcti.bottom = int(rcti.bottom * ratio);
if (xvt_win_get_children_count(win) == 0) // Se l'applicazione e' morta ...
{
xvt_timer_destroy(ep->v.timer.id); // Ammazzo il timer ...
_owner->remove_page(win); // ... e pure la pagina ospitante
}
}
xvt_rect_offset(&rcti, rctw.right - rcti.right, rctw.bottom - rcti.bottom);
_logo.draw(win(), rcti);
}
break;
case E_DESTROY:
xvt_sys_close_children(win);
break;
default:
break;
}
TWindow::handler(win, ep);
}
PNT pnt = { 0, 0 };
draw_spider(win(), 0x3, pnt);
TApp_window::TApp_window(TBook_window* owner) : _owner(owner)
{
WINDOW w = create(0, 0, -1, -1, __MAGIC_CAPTION__, WSF_NONE, W_PLAIN, owner->notebook());
xvt_timer_create(w, 1500); // Ogni tanto controllo se l'applicazione e' ancora viva
}
///////////////////////////////////////////////////////////
// TBook_window
///////////////////////////////////////////////////////////
void TBook_window::update()
{
// Disegno lo sfondo solo se non esiste nessun notebook che occupa tutto lo spazio!
if (_ctrl == NULL_WIN)
{
clear(COLOR_WHITE);
RCT rctw; xvt_vobj_get_client_rect(win(), &rctw);
if (rctw.right >= 32)
{
if (_logo.ok())
{
RCT rcti = _logo.rect();
if (rcti.right > rctw.right)
{
const double ratio = double(rctw.right) / double(rcti.right);
rcti.right = int(rcti.right * ratio);
rcti.bottom = int(rcti.bottom * ratio);
}
xvt_rect_offset(&rcti, rctw.right - rcti.right, rctw.bottom - rcti.bottom);
_logo.draw(win(), rcti);
}
const PNT pnt = { 0, 0 };
draw_spider(win(), 0x3, pnt);
}
}
}
void TCampo_window::handler(WINDOW win, EVENT* ep)
short TBook_window::pages() const
{
if (ep->type == E_MOUSE_MOVE)
draw_spider(win, 0x3, ep->v.mouse.where);
TField_window::handler(win, ep);
return _ctrl == NULL_WIN ? 0 : xvt_notebk_get_num_tabs(_ctrl);
}
TCampo_window::TCampo_window(int x, int y, int dx, int dy,
WINDOW parent, TWindowed_field* owner)
: TField_window(x, y, dx, dy, parent, owner), _logo("logo.gif")
{
set_caption("__CAMPO_MENU__");
set_scroll_max(0, 0); // Get rid of that useless scrollbars
void TBook_window::force_page(short page)
{
// Per le applicazioni figlie pare necessaria questa forzatura della visibilta'
for (int p = pages()-1; p >= 0; p--)
{
WINDOW pw = xvt_notebk_get_page(_ctrl, p);
const bool show = p == page;
if (show)
xvt_notebk_set_front_page(_ctrl, page);
xvt_vobj_set_visible(pw, show);
}
}
void TBook_window::handler(WINDOW win, EVENT* ep)
{
switch (ep->type)
{
case E_MOUSE_MOVE:
if (_ctrl == NULL_WIN)
draw_spider(win, 0x3, ep->v.mouse.where);
break;
case E_CONTROL:
if (ep->v.ctl.ci.win == _ctrl)
{
force_page(ep->v.ctl.ci.v.notebk.tab_no);
return;
}
break;
default:
break;
}
TControl_host_window::handler(win, ep);
}
short TBook_window::add_page(const TString& caption)
{
if (_ctrl == NULL_WIN)
{
WIN_DEF wd; memset(&wd, 0, sizeof(wd));
wd.wtype = WC_NOTEBK;
wd.v.ctl.ctrl_id = DLG_MAIN;
wd.v.ctl.flags = CTL_FLAG_RIGHT_JUST;
xvt_vobj_get_client_rect(win(), &wd.rct);
_ctrl = xvt_ctl_create_def(&wd, win(), 0L);
}
TString256 cap;
for (short pg = pages()-1; pg >= 0; pg--)
{
xvt_notebk_get_tab_title(_ctrl, pg, cap.get_buffer(), cap.size());
if (cap.compare(caption, -1, true) == 0)
{
force_page(pg);
return -1; // Don't perform menu!
}
}
TApp_window* w = new TApp_window(this);
const short pg = xvt_notebk_add_page(_ctrl, w->win(), caption, NULL, -1);
if (pg >= 0)
force_page(pg);
else
delete w;
return pg;
}
void TBook_window::set_page_caption(short page, const TString& caption)
{
xvt_notebk_set_tab_title(_ctrl, page, caption); // Titolo dell'orecchio
xvt_notebk_set_page_title(_ctrl, page, caption); // Titolo della finestra
}
bool TBook_window::remove_page(WINDOW page)
{
bool bFound = false;
for (int p = pages()-1; p >= 0; p--)
{
WINDOW win = xvt_notebk_get_page(_ctrl, p);
if (win == page)
{
xvt_notebk_rem_page(_ctrl, p);
bFound = true;
break;
}
}
if (bFound)
{
if (pages() == 0)
{
erode_antipa();
force_update();
}
else
force_page(0);
}
return bFound;
}
void TBook_window::erode_antipa()
{
if (_ctrl != NULL_WIN)
{
// Ammazza anche tutti ... coloro che son sospesi
for (int p = pages()-1; p >= 0; p--)
xvt_notebk_rem_page(_ctrl, p);
xvt_vobj_destroy(_ctrl);
_ctrl = NULL_WIN;
}
}
TBook_window::TBook_window(int x, int y, int dx, int dy,
WINDOW parent, TWindowed_field* owner)
: TControl_host_window(x, y, dx, dy, parent, owner), _logo("logo.gif")
{
set_scroll_max(0, 0); // Get rid of that useless scrollbars
if (_logo.ok() && can_be_transparent(_logo))
_logo.convert_transparent_color(NORMAL_BACK_COLOR);
}
TCampo_window::~TCampo_window()
{
xvt_sys_close_children(win());
}
TBook_window::~TBook_window()
{ erode_antipa(); }
///////////////////////////////////////////////////////////
// TCampo_field
// TBook_field
///////////////////////////////////////////////////////////
class TCampo_field : public TWindowed_field
class TBook_field : public TWindowed_field
{
protected:
virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent);
public:
void create(short dlg, int x, int y, int dx, int dy, WINDOW parent);
TCampo_field(TMask* m) : TWindowed_field(m) {}
virtual void create(short dlg, int x, int y, int dx, int dy, WINDOW parent);
short add_page(const TString& caption);
void set_page_caption(short page, const TString& caption);
TBook_field(TMask* m) : TWindowed_field(m) {}
};
TField_window* TCampo_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
short TBook_field::add_page(const TString& caption)
{
return new TCampo_window(x, y, dx, dy, parent, this);
TBook_window& bw = (TBook_window&)win();
return bw.add_page(caption);
}
void TCampo_field::create(short dlg, int x, int y, int dx, int dy, WINDOW parent)
void TBook_field::set_page_caption(short page, const TString& caption)
{
TBook_window& bw = (TBook_window&)win();
bw.set_page_caption(page, caption);
}
TField_window* TBook_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{
return new TBook_window(x, y, dx, dy, parent, this);
}
void TBook_field::create(short dlg, int x, int y, int dx, int dy, WINDOW parent)
{
_dlg = dlg;
_win = create_window(x, y, dx, dy, parent);
@ -98,6 +287,18 @@ void TCampo_field::create(short dlg, int x, int y, int dx, int dy, WINDOW parent
// TOutlook_mask
///////////////////////////////////////////////////////////
short TOutlook_mask::add_page(const TString& caption)
{
TBook_field& bf = (TBook_field&)field(DLG_MAIN);
return bf.add_page(caption);
}
void TOutlook_mask::set_page_caption(short page, const TString& caption)
{
TBook_field& bf = (TBook_field&)field(DLG_MAIN);
bf.set_page_caption(page, caption);
}
bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
@ -115,9 +316,22 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
}
else
{
mi.perform();
if (installing())
stop_run(K_FORCE_CLOSE);
if (mi.action() != "ba1 -5")
{
const short pg = add_page(mi.caption());
if (pg >= 0)
{
mi.perform();
xvt_sys_sleep(1000);
set_page_caption(pg, mi.caption());
}
}
else
{
mi.perform();
if (installing()) // Always true
stop_run(K_FORCE_CLOSE);
}
}
}
}
@ -141,21 +355,24 @@ TOutlook_mask::TOutlook_mask(TMenu& menu) : _tree(menu)
{
xvtil_statbar_destroy(); // Ammazza status bar inutile
RCT rct; xvt_vobj_get_client_rect(TASK_WIN, &rct);
xvt_vobj_move(win(), &rct); // Resiza la maschera in modo da occupare lo spazio liberato
WINDOW panel = page_win(0);
xvt_vobj_move(panel, &rct); // Resiza la maschera in modo da occupare lo spazio liberato
menu.set_mask_mode(3); // Outlook mode
TTree_field& trifola = add_tree(DLG_TREE, 0, 0, 0, 28, 0);
const int w = 28;
const int h = rows() / 2;
TTree_field& trifola = add_tree(DLG_TREE, 0, 0, 0, w, h);
trifola.set_tree(&_tree);
const int w = trifola.win().columns();
const int h = trifola.win().rows() / 2;
TOutlook_field* of = new TOutlook_field(this);
of->create(DLG_LOOK, 0, h, w, h, win());
of->create(DLG_LOOK, 0, h, w, h, panel);
add_field(of);
TCampo_field* cf = new TCampo_field(this);
cf->create(DLG_MAIN, w, 0, 0, 0, win());
TBook_field* cf = new TBook_field(this);
cf->create(DLG_MAIN, w, 0, 0, 0, panel);
add_field(cf);
TString caption;
@ -167,9 +384,9 @@ TOutlook_mask::TOutlook_mask(TMenu& menu) : _tree(menu)
of->add_item(ico, caption, 0);
}
xvt_win_add_pane(win(), dlg2win(DLG_TREE), "Menu", 1, 0); // Left upper pane
xvt_win_add_pane(win(), dlg2win(DLG_LOOK), "Bar", 1, 0); // Left lower pane
xvt_win_add_pane(win(), dlg2win(DLG_MAIN), "Main", 0, 0); // Main pane
xvt_pane_add(panel, dlg2win(DLG_TREE), "Menu", 1, 0); // Left upper pane
xvt_pane_add(panel, dlg2win(DLG_LOOK), "Bar", 1, 0); // Left lower pane
xvt_pane_add(panel, dlg2win(DLG_MAIN), "Main", 0, 0); // Main pane
set_handlers();
}

View File

@ -19,7 +19,8 @@ class TOutlook_mask : public TSpidey_mask
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
enum { DLG_TREE = 101, DLG_LOOK = 102, DLG_MAIN = 103 };
short add_page(const TString& caption);
void set_page_caption(short page, const TString& caption);
public:
TOutlook_mask(TMenu& menu);

View File

@ -121,17 +121,18 @@ BEGIN
PROMPT 36 17 "Grafica avanzata"
END
BUTTON DLG_USER 12 2
BUTTON DLG_OK 12 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_EDIT 12 2
BEGIN
PROMPT -23 -1 "Font"
PICTURE 116
END
BUTTON DLG_CANCEL 12 2
BEGIN
PROMPT -13 -1 "Annulla"
END
BUTTON DLG_OK 12 2
BEGIN
PROMPT -33 -1 ""
END

View File

@ -7,6 +7,7 @@
#include <printer.h>
#include <progind.h>
#include <utility.h>
#include <urldefid.h>
#include <user.h>
@ -264,51 +265,42 @@ void TManutenzione_app::print()
p.footerlen(4);
if (_rec == NULL)
{
TDir d;
d.get(LF_DIR);
TDir d; d.get(LF_DIR);
int items = (int)d.eod();
TProgind *pi;
pi = new TProgind(items, TR("Stampa tracciati record archivi"), true, true);
pi->setstatus(2);
int i;
for (i = LF_USER ; !pi->iscancelled() && i <= items; i++)
if (items > 0)
{
d.get(i);
if (d.len() > 0)
TProgind pi(items, TR("Stampa tracciati record archivi"), true, true);
for (int i = LF_USER; pi.setstatus(i) && i <= items; i++)
{
TRec_sheet r(i, "");
pi->addstatus(1);
do_print(p, r);
d.get(i);
if (d.len() > 0)
{
TRec_sheet r(i, "");
do_print(p, r);
}
}
}
delete pi;
TString_array list;
items = list_files("recdesc/d???.des", list);
pi = new TProgind(items,TR("Stampa descrizione tabelle"), true, true);
TString16 tab;
for (i = 0; !pi->iscancelled() && i < items; i++)
if (items > 0)
{
tab = list.row(i).right(7);
tab.cut(3);
if (isalpha(tab[0]))
{
TRec_sheet r(4, tab);
do_print(p, r);
}
pi->addstatus(1);
TProgind pi(items, TR("Stampa descrizione tabelle"), true, true);
TString16 tab;
for (int i = 0; pi.setstatus(i) && i < items; i++)
{
tab = list.row(i).right(7);
tab.cut(3);
if (isalpha(tab[0]))
{
TRec_sheet r(4, tab);
do_print(p, r);
}
}
}
delete pi;
}
else do_print(p, *_rec);
else
do_print(p, *_rec);
p.close();
}
@ -317,7 +309,8 @@ bool TManutenzione_app::create() // initvar e arrmask
_firm = get_firm();
TString sw(argc()>2 ? argv(2) : "");
// Posso fare le operazione avanzate solo se sono ammistratore
// e NON mi trovo su di una installazione di tipo client
_superprassi = user() == ::dongle().administrator();
if (_superprassi)
{
@ -368,16 +361,15 @@ bool TManutenzione_app::create() // initvar e arrmask
#endif
load_des();
_mask = new TMask ("ba1100a");
_browse = new TDir_sheet (TR("Manutenzione file di sistema"), _superprassi ? 0xC : 0x8);
_mask = new TMask("ba1100a");
_browse = new TDir_sheet(TR("Manutenzione file di sistema"), _superprassi ? 0xC : 0x8);
if (_superprassi)
{
_browse->add_button(DLG_CONVERT, BR("~Converti", 9), K_F7);
_browse->add_button(DLG_OTHERFILE, TR("File Esterni"), K_F5, 113);
_browse->add_button(DLG_CONVERT, TR("Conversione"), K_F7, 156);
if (is_power_station())
_browse->add_button(DLG_ADDFILE, BR("~Aggiungi", 9), K_F8);
TButton_field& butt = ((TMask*)_browse)->add_button(DLG_OTHERFILE, 0, BR("A~ltri", 9), 0, -1, 9, 2, "", 0, 0);
butt.set_exit_key(K_F5);
_mask->enable(-1); // Abilita campi privilegiati
_browse->add_button(DLG_ADDFILE, TR("Nuovo file"), K_F8, BMP_NEWREC);
_mask->enable(-1); // Abilita campi privilegiati del gruppo 1
}
}
enable_menu_item(M_FILE_PRINT);
@ -392,7 +384,6 @@ bool TManutenzione_app::destroy() // releasev e arrmask
return TApplication::destroy() ;
}
void TManutenzione_app::open_log()
{
TFilename log;
@ -594,7 +585,7 @@ void TManutenzione_app::edit_riga (const TString& name)
case K_F4:
{
TEdit_file ef;
ef.browse(f,n);
ef.browse_file(f, n);
break;
}
case K_F6:
@ -650,9 +641,9 @@ void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga)
if (logicnum > 1)
{
const TFilename filename(_mask->get(FLD_NOME));
const TString16 tabella(_mask->get(F_TAB));
const TString& tabella = _mask->get(F_TAB);
TEdit_file ef;
ef.browse(logicnum, filename, tabella);
ef.browse_file(logicnum, filename, tabella);
}
break;
case K_F5:
@ -1556,29 +1547,36 @@ void TManutenzione_app::main_loop()
switch (key)
{
case K_F1:
dispatch_e_menu(M_HELP_CONTENTS);
break;
case K_F2:
dispatch_e_menu(M_FILE_ABOUT);
break;
case K_F3:
dispatch_e_menu(M_FILE_PRINT);
break;
case K_F6:
riga_selezionata = _browse->selected();
riga = _browse->row();
insert_riga (riga_selezionata, riga);
break;
break;
case K_ENTER:
riga_selezionata = _browse->selected();
riga = _browse->row();
edit_riga (riga_selezionata, riga);
break;
case K_DEL:
riga_selezionata = _browse->selected();
delete_riga(riga_selezionata);
break;
case K_QUIT:
case K_ESC: done = true; close_history(); break;
case K_ESC:
done = true; close_history();
break;
case K_F7:
update(); break;
update();
break;
case K_F8:
_browse->add();
riga_selezionata = _browse->items() - 1;
@ -1593,8 +1591,8 @@ void TManutenzione_app::main_loop()
edit_riga(other.get(101));
}
break;
default: break;
default:
break;
}
enable_menu_item(M_FILE_NEW);
}

View File

@ -81,11 +81,12 @@ public:
class TEdit_file : public TObject
{
protected:
KEY edit_record(TRectype& rec, bool readonly = FALSE);
bool _browse(TCursor& cur, const TFilename& name);
void edit_record(TRectype& rec);
bool browse_cursor(TCursor& cur, const TFilename& name);
public:
bool browse(int logicnum, const TFilename& name, const TString& tab);
bool browse(TExternisamfile* file, const TFilename& name);
bool browse_file(int logicnum, const TFilename& name, const TString& tab);
bool browse_file(TExternisamfile* file, const TFilename& name);
TEdit_file() {}
virtual ~TEdit_file() {}
};

View File

@ -1,6 +1,3 @@
#include <defmask.h>
#include <tokens.h>
#include "ba1100a.h"
PAGE "Modifica Archivio" -1 -1 70 15
@ -85,54 +82,62 @@ BEGIN
GROUP 1
END
ENDPAGE
TOOLBAR "" 0 0 0 2
BUTTON DLG_OK 9 2
BEGIN
PROMPT -14 -3 ""
END
BUTTON DLG_CANCEL 9 2
BEGIN
PROMPT -24 -3 ""
PROMPT 1 0 "Conferma"
END
BUTTON DLG_PACK 9 2
BEGIN
PROMPT -34 -3 "Compatta"
PROMPT 2 0 "Compatta"
MESSAGE EXIT,K_F5
FLAGS "D"
GROUP 1
END
BUTTON DLG_RECORD 9 2
BEGIN
PROMPT -44 -3 "Record"
MESSAGE EXIT,K_F6
FLAGS "D"
PICTURE 156
GROUP 1
END
BUTTON DLG_DUMP 9 2
BEGIN
PROMPT -14 -1 "Scarica"
PROMPT 3 0 "Scarica"
MESSAGE EXIT,K_F7
PICTURE 151
GROUP 1
END
BUTTON DLG_LOAD 9 2
BEGIN
PROMPT -24 -1 "Carica"
PROMPT 4 0 "Carica"
MESSAGE EXIT,K_F8
FLAGS "D"
PICTURE 150
GROUP 1
END
BUTTON DLG_RECORD 9 2
BEGIN
PROMPT 5 0 "Record"
MESSAGE EXIT,K_F6
FLAGS "D"
PICTURE 111
GROUP 1
END
BUTTON DLG_EDIT 9 2
BEGIN
PROMPT -34 -1 "~Edit"
PROMPT 6 0 "~Edit"
PICTURE BMP_EDIT
MESSAGE EXIT,K_F4
END
BUTTON DLG_CANCEL 9 2
BEGIN
PROMPT 7 0 "Annulla"
END
ENDPAGE
ENDMASK

View File

@ -1,25 +1,12 @@
#include "ba1100a.h"
TOOLBAR "" 0 20 0 2
TOOLBAR "" 0 0 0 2
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -15 -1 ""
PROMPT -15 -1 "Conferma"
MESSAGE EXIT,K_SAVE
PICTURE 103
PICTURE 153
GROUP 1
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -25 -1 ""
END
BUTTON DLG_EXPORT 10 2
BEGIN
PROMPT -35 -1 "~Esporta"
MESSAGE EXIT,K_F6
PICTURE BMP_OK
GROUP 1
END
@ -27,9 +14,23 @@ BUTTON DLG_IMPORT 10 2
BEGIN
PROMPT -45 -1 "~Importa"
MESSAGE EXIT,K_F7
PICTURE 150
GROUP 1
END
BUTTON DLG_EXPORT 10 2
BEGIN
PROMPT -35 -1 "~Esporta"
MESSAGE EXIT,K_F6
PICTURE 151
GROUP 1
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -25 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -55 -1 ""
@ -41,19 +42,19 @@ PAGE "Tracciato Record" -1 -1 77 20
NUMBER F_NUM 4
BEGIN
PROMPT 1 1 "Archivio n. "
PROMPT 1 0 "Archivio n. "
FLAGS "D"
END
STRING F_DES 50
BEGIN
PROMPT 20 1 ""
PROMPT 20 0 ""
FLAGS "D"
END
SPREADSHEET F_FIELDS 0 13
SPREADSHEET F_FIELDS 0 14
BEGIN
PROMPT 0 2 "Fields"
PROMPT 0 1 "Fields"
ITEM "Nome@10"
ITEM "Tipo"
ITEM "Lunghezza"

View File

@ -3,6 +3,7 @@
#include <isam.h>
#include <msksheet.h>
#include <progind.h>
#include <urldefid.h>
#include <utility.h>
#include "ba1100.h"
@ -28,9 +29,11 @@ void TDir_sheet::add ()
TDir_sheet::TDir_sheet(const char* title, byte buttons, const char* colonne)
: TSheet(0, 0, 0, 0, title, colonne, buttons)
{
add_button(DLG_PRINT, TR("Stampa Tracciati"), K_F3, BMP_PRINT);
add_button(DLG_INFO, TR("Informazioni"), K_F2, BMP_INFO);
add_button(DLG_HELP, TR("Help"), K_F1, BMP_HELP);
_dir = new TDir;
_rec = new TTrec;
rebuild();
}

View File

@ -1,14 +1,63 @@
#include <defmask.h>
#include <diction.h>
#include <dongle.h>
#include <prefix.h>
#include <progind.h>
#include <relation.h>
#include <sheet.h>
#include <toolfld.h>
#include <urldefid.h>
#include "ba1100.h"
bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
// Utilities
// Ordina per importanza i campi di un tracciato record
static int sort_fields(const TObject** r1, const TObject** r2)
{
TToken_string& s1 = (TToken_string&)**r1;
TToken_string& s2 = (TToken_string&)**r2;
int k1 = s1.get_char(2) == '1';
int k2 = s2.get_char(2) == '1';
int cmp = k2 - k1;
if (cmp == 0)
{
k1 = s1.get_int(1);
k2 = s2.get_int(1);
cmp = k1 - k2;
}
return cmp;
}
// Riempie la lista dei campi del file corrente
static int fill_fields(int logicnum, TString_array& flds, bool keys_only = false)
{
const RecDes& rd = prefix().get_recdes(logicnum);
for (int i = 0; i < rd.NFields; i++)
{
TToken_string row;
const RecFieldDes& fd = rd.Fd[i];
row = fd.Name; // Nome
row.add(i); // Indice
TString16 keys;
for (int k = 0; k < rd.NKeys; k++)
{
const KeyDes& kd = rd.Ky[k];
for (int j = 0; j < kd.NkFields; j++)
{
const int n = kd.FieldSeq[j] % MaxFields;
if (n == i)
keys << (k+1) << ' '; // Chiavi di appartenenza
}
}
row.add(keys);
if (!keys_only || keys.full())
flds.add(row);
}
flds.TArray::sort(sort_fields);
return flds.items();
}
bool TEdit_file::browse_cursor(TCursor& cursor, const TFilename& name)
{
TRectype& curr = cursor.curr();
TRectype svrec(cursor.curr());
@ -16,12 +65,15 @@ bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
TToken_string head(256);
TToken_string trac(256);
const char* n;
trac.add("");
head.add("@1");
for(int i = 0; (n = curr.fieldname(i)) != NULL; i++)
TString_array flds;
fill_fields(curr.num(), flds);
FOR_EACH_ARRAY_ROW(flds, i, row)
{
const TString16 n = row->get(0);
trac.add(n);
TString16 name(n); name.lower(); name[0] = toupper(name[0]);
@ -42,9 +94,8 @@ bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
const bool superprassi = user() == ::dongle().administrator();
KEY ch;
TCursor_sheet sheet(&cursor, trac, name, head, superprassi ? 6 : 0);
KEY ch;
while ((ch = sheet.run()) != K_ESC)
{
if (!superprassi)
@ -55,39 +106,25 @@ bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
if (ch == K_DEL && sheet.one_checked())
{
TProgind* pind = NULL;
cursor.freeze(TRUE);
// bool go = FALSE; inutili verificare
// bool first = FALSE;
long j;
const long items = sheet.items();
const long checked = sheet.checked();
if (checked && yesno_box(FR("Si desidera cancellare i %ld record indicati?"), checked))
if (yesno_box(FR("Si desidera cancellare i %ld record indicati?"), checked))
{
TWait_cursor hourglass;
for (j = 0, cursor = 0; j < items; j++)
const long items = sheet.items();
cursor.freeze(TRUE);
TProgind pi(items, TR("Attendere..."), true, true);
for (TRecnotype j = 0; j < items; j++)
{
if (!pi.setstatus(j))
break;
if (sheet.checked(j))
{
if (!pind)
{
pind = new TProgind(sheet.checked(),TR("Attendere..."), TRUE, TRUE);
pind->addstatus(1);
}
else
{
if (pind->iscancelled()) break;
pind->addstatus(1);
}
cursor = j;
cursor.file().remove();
sheet.uncheck(j);
}
}
cursor.freeze(FALSE);
}
if (pind) delete pind;
cursor.freeze(FALSE);
// Forza update del cursore
cursor.set_filterfunction(NULL, TRUE);
@ -104,19 +141,7 @@ bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
switch(ch)
{
case K_ENTER: // edit fields
svrec = curr;
if (edit_record(curr, FALSE) == K_ENTER)
{
const TString s(svrec.key(1));
if (s != curr.key(1))
{
const int err = curr.write(cursor.file());
if (err == NOERR)
svrec.remove(cursor.file());
}
else
curr.rewrite(cursor.file());
}
edit_record(curr);
break;
case K_DEL: // delete record
if (yesno_box(TR("Confermare la cancellazione del record")))
@ -124,8 +149,7 @@ bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
break;
case K_INS: // insert new record
curr.zero();
if (edit_record(curr,FALSE) == K_ENTER)
cursor.file().write();
edit_record(curr);
break;
default:
break;
@ -135,7 +159,7 @@ bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
return ch != K_ESC;
}
bool TEdit_file::browse(int logicnum, const TFilename& name, const TString& tab)
bool TEdit_file::browse_file(int logicnum, const TFilename& name, const TString& tab)
{
if (logicnum > 2)
{
@ -146,7 +170,6 @@ bool TEdit_file::browse(int logicnum, const TFilename& name, const TString& tab)
test.close();
}
TRelation relation(logicnum);
TCursor cursor(&relation);
if (logicnum == LF_TAB || logicnum == LF_TABCOM || logicnum == LF_TABGEN)
@ -158,98 +181,138 @@ bool TEdit_file::browse(int logicnum, const TFilename& name, const TString& tab)
cursor.setregion(filter, filter);
}
}
return _browse(cursor,name);
return browse_cursor(cursor, name);
}
bool TEdit_file::browse(TExternisamfile* file, const TFilename& name)
bool TEdit_file::browse_file(TExternisamfile* file, const TFilename& name)
{
TRelation relation(file);
TCursor cursor(&relation);
return _browse(cursor,name);
return browse_cursor(cursor, name);
}
KEY TEdit_file::edit_record(TRectype& rec, bool readonly)
class TEdit_mask : public TMask
{
int recs;
public:
TEdit_mask(int pages);
};
TEdit_mask::TEdit_mask(int pages)
: TMask(TR("Modifica record"), pages, 0, 0, 0, 0)
{
add_button_tool(DLG_OK, TR("Registra"), BMP_SAVEREC).set_exit_key(K_ENTER);
add_button_tool(DLG_DELREC, TR("Elimina"), BMP_DELREC).set_exit_key(K_DEL);
add_button_tool(DLG_CANCEL, TR("Annulla"), BMP_CANCEL).set_exit_key(K_ESC);
if (pages > 1)
set_default_tab_buttons();
}
void TEdit_file::edit_record(TRectype& rec)
{
TString_array flds;
const int recs = fill_fields(rec.num(), flds);
const int fpp = 18; // Fields per page
const int pages = (recs+fpp-1)/fpp;
for(recs = 0; rec.fieldname(recs) != NULL; recs++);
TEdit_mask m(pages);
m.enable(DLG_DELREC, !rec.empty());
const int fpp = 16; // Fields per page
const int rows = recs > fpp ? 20 : recs+4;
const int pages = recs/fpp + (recs % fpp ? 1 : 0);
TMask m(TR("Modifica record"), pages, 78, rows);
if (pages > 1) m.add_default_tag_buttons();
int curpage = 0, currow = 1;
short nid = 100;
bool grouped = false;
int curpage = 0, currow = 1, nid = 100;
const char* cp;
// inutile verificare int mcnt =0;
const char* flags = readonly ? "D" : "";
int i;
for(i = 0; (cp = rec.fieldname(i)) != NULL; i++)
FOR_EACH_ARRAY_ROW(flds, i, row)
{
// add fields ONE by ONE
TString16 s(cp); s.left_just(16);
const TString16 cp = row->get(0);
TString s = cp; s.left_just(16);
if (!grouped)
{
const bool primary = row->get_char(2) == '1';
if (primary)
s.insert("@b");
else
{
m.add_groupbox(-1, curpage, PR("@bChiave primaria"), 2, 0, 70, ++currow);
grouped = true;
}
}
const int len = rec.length(cp);
switch (rec.type(cp))
{
case _alfafld:
{
TString16 f; f << flags << '_';
m.add_string(nid++,curpage, s, 3, currow, len, f, len > 50 ? 50 : len);
}
m.add_string(nid++,curpage, s, 3, currow, len, "_", len > 50 ? 50 : len);
break;
case _intfld:
case _longfld:
case _wordfld:
case _realfld:
m.add_number(nid++, curpage, s, 3, currow, len, flags, rec.ndec(cp));
m.add_number(nid++, curpage, s, 3, currow, len, "", rec.ndec(cp));
break;
case _datefld:
m.add_date(nid++, curpage, s, 3, currow, flags);
m.add_date(nid++, curpage, s, 3, currow, "");
break;
case _charfld:
m.add_string(nid++, curpage, s, 3, currow, 1, flags);
m.add_string(nid++, curpage, s, 3, currow, 1, "");
break;
case _boolfld:
m.add_boolean(nid++, curpage, s, 3, currow, flags);
m.add_boolean(nid++, curpage, s, 3, currow, "");
break;
case _intzerofld:
case _longzerofld:
{
TString16 f; f << flags << 'Z';
m.add_number(nid++, curpage, s, 3, currow, len, f, 0);
}
m.add_number(nid++, curpage, s, 3, currow, len, "Z", 0);
break;
case _memofld:
m.add_zoom( nid++, curpage, s, 3, currow, 50, flags, 50 );
m.add_zoom( nid++, curpage, s, 3, currow, 50, "", 50 );
break;
default:
break;
}
m.field(nid-1).set(rec.get(cp));
if (((i+1) % fpp) == 0 || i == recs-1)
{
m.add_button(DLG_OK, curpage, "", -12, -1, 9, 2);
m.add_button(DLG_CANCEL, curpage, "", -22, -1, 9, 2);
curpage++; currow = 1;
{
curpage++;
currow = 1;
}
else currow++;
else
currow++;
}
const KEY k = m.run();
if (k == K_ENTER && !readonly)
if (k != K_ESC && k != K_QUIT)
{
nid = 100;
for(i = 0; (cp = rec.fieldname(i)) != NULL; i++)
rec.put(cp, m.get(nid++));
TLocalisamfile file(rec.num());
switch (k)
{
case K_ENTER:
{
const TRectype svrec(rec); // Salva record originale
const TString svkey = svrec.key(1);
FOR_EACH_ARRAY_ROW(flds, i, row)
{
const char* cp = row->get(0);
rec.put(cp, m.get(100+i));
}
if (svkey != rec.key(1))
{
const int err = rec.write(file);
if (err == NOERR && !svrec.empty())
svrec.remove(file);
}
else
rec.rewrite(file);
}
break;
case K_DEL:
if (!rec.empty() && yesno_box(TR("Confermare la cancellazione del record")))
rec.remove(file);
break;
default:
break;
}
}
return k;
}

View File

@ -14,7 +14,6 @@
#include <user.h>
///////////////////////////////////////////////////////////
// Menu item
///////////////////////////////////////////////////////////
@ -825,15 +824,16 @@ void TSet_user_passwd::init_modify_mode(TMask& m)
int ba1400(int argc, char** argv)
{
const char* const title = TR("Configurazione utenti");
if (user() == ::dongle().administrator())
{
TSet_users a;
a.run(argc, argv, TR("Configurazione utenti"));
a.run(argc, argv, title);
}
else
{
TSet_user_passwd a;
a.run(argc, argv, TR("Configurazione utenti"));
a.run(argc, argv, title);
}
return 0;
}

View File

@ -1,7 +1,7 @@
#include "ba0100a.h"
TOOLBAR "" 0 -2 0 2
#include <toolbar.h>
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
PAGE "Gestione utenti" -1 -1 35 7
@ -11,7 +11,7 @@ BEGIN
PROMPT 1 0 "@bDati"
END
RADIO F_GROUP 1 23
RADIO F_GROUP 1 18
BEGIN
PROMPT 2 0 ""
ITEM " |Utente"
@ -203,6 +203,10 @@ BEGIN
CHECKTYPE REQUIRED
END
ENDPAGE
TOOLBAR "" 0 0 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""

View File

@ -54,10 +54,10 @@ const char* TInformazione_moduli::get_description_by_name(const char* code) cons
{
FOR_EACH_ARRAY_ROW_BACK(_infos, i, info)
{
if (stricmp(info->get(1), code) == 0)
if (xvt_str_compare_ignoring_case(info->get(1), code) == 0)
return info->get(0);
}
return "{MODULO SCONOSCIUTO}";
return TR("{MODULO SCONOSCIUTO}");
}
const char* TInformazione_moduli::get_name_by_order(int index)
@ -89,7 +89,7 @@ int TInformazione_moduli::get_index_by_name(const char* code) const
{
FOR_EACH_ARRAY_ROW_BACK(_infos, i, info)
{
if (stricmp(info->get(1), code) == 0)
if (xvt_str_compare_ignoring_case(info->get(1), code) == 0)
break;
}
return i >= 0 ? get_index(i) : i;

View File

@ -1,9 +1,7 @@
#include "ba3500.h"
TOOLBAR "" 0 20 0 2
#include <toolbar.h>
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
PAGE "Tabella libro unico 1/2" -1 -1 78 18

View File

@ -1,9 +1,7 @@
#include "ba3700.h"
TOOLBAR "" 0 20 0 2
#include <toolbar.h>
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
PAGE "Tabella condizioni di pagamento" -1 -1 78 15

View File

@ -1,7 +1,7 @@
#include "ba4100.h"
TOOLBAR "" 0 -2 0 2
#include <toolbar.h>
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
PAGE "Pag. 1" -1 -1 77 18

View File

@ -1,35 +1,36 @@
#include "ba4200.h"
TOOLBAR "" 0 -4 0 4
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
TOOLBAR "" 0 -2 0 2
BUTTON DLG_CHGTIP 23 2
BEGIN
PROMPT -13 -3 "Persone ~Giuridiche"
PROMPT -13 0 "Persone ~Giuridiche"
MESSAGE K_F10
END
BUTTON DLG_DITTE 10 2
BEGIN
PROMPT -36 -3 "~Ditte"
PROMPT -36 0 "~Ditte"
MESSAGE K_F5
END
BUTTON DLG_EMAIL 10 2
BEGIN
PROMPT -56 -3 "~Posta"
PROMPT -56 0 "~Posta"
PICTURE BMP_EMAIL
END
GOLEM DLG_OGGETTI 10 2
BEGIN
PROMPT -66 -3 "~Oggetti"
PROMPT -66 0 "~Oggetti"
FIELD OGGETTI
FLAG "M"
END
#include <toolbar.h>
ENDPAGE
PAGE "Pag.1" -1 -1 77 19

View File

@ -1,33 +1,36 @@
#include "ba4200.h"
TOOLBAR "" 0 -4 0 4
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
TOOLBAR "" 0 -2 0 2
BUTTON DLG_CHGTIP 23 2
BEGIN
PROMPT -13 -3 "Persone F~isiche"
MESSAGE K_F10
PROMPT -13 0 "Persone ~Fisiche"
MESSAGE K_F10
END
BUTTON DLG_DITTE 10 2
BEGIN
PROMPT -36 -3 "~Ditte"
MESSAGE K_F5
PROMPT -36 0 "~Ditte"
MESSAGE K_F5
END
BUTTON DLG_EMAIL 10 2
BEGIN
PROMPT -56 -3 "~Posta"
PROMPT -56 0 "~Posta"
PICTURE BMP_EMAIL
END
GOLEM DLG_OGGETTI 10 2
BEGIN
PROMPT -66 -3 "~Oggetti"
PROMPT -66 0 "~Oggetti"
FIELD OGGETTI
FLAG "M"
END
#include <toolbar.h>
ENDPAGE
PAGE "Pag.1" -1 -1 77 19

View File

@ -1,38 +1,41 @@
#include "ba4300.h"
TOOLBAR "" 0 -4 0 4
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
TOOLBAR "" 0 -2 0 2
BUTTON DLG_ATT 10 2
BEGIN
PROMPT -16 -3 "~Attivita'"
PROMPT -16 -11 "~Attivita'"
MESSAGE K_F6
END
BUTTON DLG_ULC 10 2
BEGIN
PROMPT -26 -3 "U.~Locali"
PROMPT -26 -11 "U.~Locali"
MESSAGE K_F5
END
BUTTON DLG_SOC 10 2
BEGIN
PROMPT -36 -3 "~Soci"
PROMPT -36 -11 "~Soci"
MESSAGE K_F7
END
BUTTON DLG_REG 10 2
BEGIN
PROMPT -46 -3 "Re~gistri"
PROMPT -46 -11 "Re~gistri"
MESSAGE K_F8
END
BUTTON DLG_EMAIL 10 2
BEGIN
PROMPT -66 -3 "~Posta"
PROMPT -66 -11 "~Posta"
PICTURE BMP_EMAIL
END
#include <toolbar.h>
ENDPAGE
PAGE "Pag. 1" -1 -1 77 19

View File

@ -1,7 +1,7 @@
#include "ba4400.h"
TOOLBAR "" 0 -2 0 2
#include <toolbar.h>
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
PAGE "Pag. 1" -1 -1 77 18

View File

@ -1,7 +1,7 @@
#include "ba4500.h"
TOOLBAR "" 0 -2 0 2
#include <toolbar.h>
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
PAGE "Pag. 1" -1 -1 77 20

View File

@ -1,7 +1,7 @@
#include "ba4600.h"
TOOLBAR "" 0 -2 0 2
#include <toolbar.h>
TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
PAGE "Pag.1" -1 -1 77 20

View File

@ -7,10 +7,9 @@ int main(int argc,char** argv)
switch (r)
{
case 1:
ba6200(argc,argv); break;
default:
ba6100(argc,argv); break;
case 1 : ba6200(argc,argv); break;
case 2 : ba6300(argc,argv); break;
default: ba6100(argc,argv); break;
}
return 0;
}

View File

@ -1,15 +1,9 @@
#ifndef __BA6_H
#define __BA6_H
#ifdef MAIN
#define extern
#endif
#ifdef MAIN
#undef extern
#endif
int ba6100(int argc, char* argv[]);
int ba6200(int argc, char* argv[]);
int ba6300(int argc, char* argv[]);
#endif // __BA6_H
int ba6100(int argc, char* argv[]);
int ba6200(int argc, char* argv[]);

View File

@ -1,5 +1,5 @@
#include "ba6100a.h"
#include <lffiles.h>
PAGE "Definizione Stampe" -1 -1 70 17
RADIOBUTTON RDB_BA6_TYPE 25

View File

@ -1,23 +1,23 @@
#include "ba6300a.h"
TOOLBAR "" 0 -3 0 3
TOOLBAR "" 0 0 0 2
BUTTON DLG_NEWREC 10 2
BEGIN
PROMPT -14 -11 ""
PROMPT -14 -11 "Nuovo"
PICTURE BMP_NEWREC
PICTURE BMP_NEWRECDN
END
BUTTON DLG_EDIT 10 2
BEGIN
PROMPT -24 -11 ""
PROMPT -24 -11 "Modifica"
PICTURE BMP_EDIT
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -34 -11 ""
PROMPT -34 -11 "Stampa"
END
BUTTON DLG_QUIT 10 2
@ -233,7 +233,5 @@ BEGIN
PROMPT 2 19 "Report personalizzato"
END
ENDPAGE
ENDMASK

View File

@ -51,7 +51,7 @@ TSelector_sheet::TSelector_sheet(TCursor& cur, const char* fields, const char* c
TToken_string cap = c.prompt();
if (cap.empty())
cap = caption;
add_tag_buttons(cap);
set_tab_buttons(cap);
TString16 flags;
if (c.roman()) flags << 'M';

View File

@ -1381,7 +1381,7 @@ void TQuery_mask::handler(WINDOW wnd, EVENT* ep)
switch (ep->type)
{
case E_MOUSE_DOWN:
if (ep->v.mouse.button == 0 && wnd == win(0))
if (ep->v.mouse.button == 0 && wnd == page_win(0))
{
const TSheet_field& sf = sfield(F_FIELDS);
RCT rct; sf.get_rect(rct);

View File

@ -1,6 +1,6 @@
#include "ba8200.h"
TOOLBAR "" 0 -2 0 2
TOOLBAR "" 0 0 0 2
BUTTON DLG_SAVEREC 10 2
BEGIN

View File

@ -17,12 +17,6 @@
#include "ba8301.h"
#include <bagn003.h>
///////////////////////////////////////////////////////////
// Utility
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// TReport_sheet
///////////////////////////////////////////////////////////
@ -45,8 +39,7 @@ void TReport_sheet::get_row(long r, TToken_string& row)
{
const TReport_field& rf = (const TReport_field&)_section[r];
const TRectangle& rect = rf.get_rect();
row.cut(0);
row.add(checked(r) ? "X" : " ");
row = checked(r) ? "X" : " ";
row.add(rf.type_name());
row.add(rf.id());
row.add(num2str(rect.top()));
@ -106,10 +99,10 @@ KEY TReport_sheet::run()
}
TReport_sheet::TReport_sheet(TReport_section& sec)
: TSheet(-1, -1, -2, -4, "Campi", "@1|Tipo@10|ID@4R|Riga@R|Col.@R|Larg.@R|Alt.@R|Testo@50", 0xE),
: TSheet(-1, -1, -2, -4, TR("Campi"),
HR("@1|Tipo@10|ID@4R|Riga@R|Col.@R|Larg.@R|Alt.@R|Testo@50"), 0xE),
_section(sec)
{
}
{ }
///////////////////////////////////////////////////////////
// TSection_properties_mask
@ -136,14 +129,14 @@ void TSection_properties_mask::update()
for (int i = 0; i < 2; i++)
{
TMask_field& fld = field(i == 0 ? F_FGCOLOR : F_BGCOLOR);
if (fld.active() && fld.parent() == win())
if (fld.active() && fld.parent() == curr_win())
{
RCT rctfld; fld.get_rect(rctfld);
const int x = rctfld.right / CHARX + 1;
const int y = rctfld.top / ROWY + 1;
RCT& rct = resize_rect(x, y, -3, 1, W_PLAIN, win());
RCT& rct = resize_rect(x, y, -3, 1, W_PLAIN, fld.parent());
rct.top = rctfld.top; rct.bottom = rctfld.bottom;
xi_draw_3d_rect((XinWindow)win(), (XinRect*)&rct, TRUE, 2, MASK_LIGHT_COLOR,
xi_draw_3d_rect((XinWindow)fld.parent(), (XinRect*)&rct, TRUE, 2, MASK_LIGHT_COLOR,
i == 0 ? _fgcolor : _bgcolor, MASK_DARK_COLOR);
}
}
@ -226,10 +219,6 @@ void TSection_properties_mask::set_section(const TReport_section& rs)
set_num(F_DY, rs.height());
set(F_CONDITION, rs.condition());
set(F_GROUP_BY, rs.grouped_by());
if (rs.recordset() != NULL)
set(F_SQL, rs.recordset()->query_text());
else
reset(F_SQL);
set(F_HIDE_IF_NEEDED, rs.hidden_if_needed());
set(F_HIDDEN, rs.hidden());
@ -366,76 +355,20 @@ void TReport_properties_mask::get_report(TReport& r) const
}
///////////////////////////////////////////////////////////
// TReport_mask
// TReport_query_mask
///////////////////////////////////////////////////////////
class TReport_mask : public TAutomask
class TReport_query_mask : public TAutomask
{
TReport _report;
TReport_section* _curr_section;
TReport_tree _tree;
TFilename _curr_report;
bool _is_dirty;
protected:
virtual TMask_field* parse_field(TScanner& scanner);
virtual void notify_focus_field(short id);
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
protected:
bool select_query();
bool select_report();
void select_section();
void update_report() const;
TReport_section& curr_section();
void add_field();
void edit_field(TReport_field& rf);
void fields_properties();
bool add_section();
void section_properties();
void report_properties();
bool enumerate_bodies(int level, TToken_string& code, TToken_string& desc) const;
bool get_rep_path(TFilename& path) const;
void set_num_attr(TXmlItem& item, const char* attr, short num, short def = 0) const;
void set_col_attr(TXmlItem& item, const char* attr, COLOR col, COLOR def) const;
public:
void on_print();
bool save_report();
bool save_if_needed();
void global_reset();
bool delete_report();
bool load_report();
TReport_tree& sections() { return _tree; }
TReport_mask();
TReport_query_mask();
};
TMask_field* TReport_mask::parse_field(TScanner& scanner)
{
if (scanner.token().starts_with("RE"))
return new TReport_drawer(this);
return TAutomask::parse_field(scanner);
}
/*
bool TReport_mask::select_report()
{
TFilename path;
const bool ok = select_custom_file(path, "rep");
if (ok)
{
path = path.name(); path.ext("");
set(F_CODICE, path);
}
return ok;
}
*/
bool TReport_mask::select_query()
bool TReport_query_mask::select_query()
{
TFilename path;
bool ok = select_custom_file(path, "qry");
@ -455,6 +388,119 @@ bool TReport_mask::select_query()
return ok;
}
bool TReport_query_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_SQL:
if (e == fe_init || e == fe_modify)
enable(F_SHOW_QRY, !o.empty());
break;
case F_NEW_QRY:
if (e == fe_button)
{
TExternal_app q("ba8 -1");
q.run();
}
break;
case F_IMPORT_QRY:
if (e == fe_button)
select_query();
break;
case F_SHOW_QRY:
if (e == fe_button)
{
const TString& sql = get(F_SQL);
TRecordset* rex = create_recordset(sql);
if (rex != NULL)
{
if (rex->items() > 0)
{
TRecordset_sheet sht(*rex);
sht.run();
}
else
{
if (sql.find("SELECT ") >= 0)
warning_box(TR("Nessuna riga risultato"));
}
delete rex;
}
}
break;
default:
break;
}
return true;
}
TReport_query_mask::TReport_query_mask() : TAutomask("ba8300f")
{
}
///////////////////////////////////////////////////////////
// TReport_mask
///////////////////////////////////////////////////////////
class TReport_mask : public TAutomask
{
TReport _report;
TReport_section* _curr_section;
TReport_tree _tree;
TFilename _curr_report;
bool _is_dirty;
protected:
virtual TMask_field* parse_field(TScanner& scanner);
virtual void notify_focus_field(short id);
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
virtual void handler(WINDOW win, EVENT* ep);
protected:
bool select_report();
void select_section();
void update_report() const;
TReport_section& curr_section();
void add_field();
void edit_field(TReport_field& rf);
void fields_properties();
bool add_section();
void section_properties();
void report_properties();
void report_query();
bool enumerate_bodies(int level, TToken_string& code, TToken_string& desc) const;
bool get_rep_path(TFilename& path) const;
void set_num_attr(TXmlItem& item, const char* attr, short num, short def = 0) const;
void set_col_attr(TXmlItem& item, const char* attr, COLOR col, COLOR def) const;
WINDOW dlg2win(short id) const;
void add_pane(short id, const char* title, int hook);
void update_toolbar(); // Aggiorna dis/abilitazioni dei bottoni
public:
void on_print();
bool save_report();
bool save_if_needed();
void global_reset();
bool delete_report();
bool load_report();
TReport_tree& sections() { return _tree; }
TReport_mask();
};
TMask_field* TReport_mask::parse_field(TScanner& scanner)
{
const TString& tok = scanner.token();
if (tok.starts_with("RE"))
return new TReport_drawer(this);
if (tok.starts_with("OU"))
return new TOutlook_field(this);
return TAutomask::parse_field(scanner);
}
bool TReport_mask::get_rep_path(TFilename& path) const
{
const TString& name = get(F_CODICE);
@ -486,7 +532,6 @@ bool TReport_mask::save_report()
if (!ok)
return field(F_CODICE).on_key(K_ENTER); // Segnala errore
_report.set_description(get(F_DESCR));
_report.set_recordset(get(F_SQL));
if (is_power_station())
{
FILE_SPEC fsp;
@ -518,6 +563,7 @@ void TReport_mask::global_reset()
_report.destroy();
reset();
update_report();
update_toolbar();
}
bool TReport_mask::load_report()
@ -534,11 +580,7 @@ bool TReport_mask::load_report()
path = path.name(); path.ext("");
set(F_CODICE, path);
const TRecordset* rs = _report.recordset();
if (rs != NULL)
set(F_SQL, rs->query_text(), true);
set(F_DESCR, _report.description());
field(F_SQL).set_dirty(false);
_is_dirty = false;
TTree_field& sections = tfield(F_SECTIONS);
@ -566,7 +608,7 @@ bool TReport_mask::delete_report()
void TReport_mask::on_print()
{
const TString& app = _report.command_line();
if (app.not_empty() && yesno_box(FR("Si desidera stampare utilizzando '%s'"), (const char*)app))
if (app.full() && yesno_box(FR("Si desidera stampare utilizzando '%s'"), (const char*)app))
{
TExternal_app a(app);
a.run();
@ -835,10 +877,11 @@ bool TReport_mask::add_section()
if (level > 0)
{
_curr_section = &_report.section(type, level);
_tree.shrink_all();
_tree.goto_node(type, level);
_tree.expand_all();
TTree_field& tf = tfield(F_SECTIONS);
tf.win().force_update();
tf.select_current();
section_properties();
}
else
@ -886,6 +929,19 @@ void TReport_mask::report_properties()
}
}
void TReport_mask::report_query()
{
TReport_query_mask qm;
if (_report.recordset() != NULL)
qm.set(F_SQL, _report.recordset()->query_text());
if (qm.run() == K_ENTER)
{
_report.set_recordset(qm.get(F_SQL));
_is_dirty = true;
enable(DLG_PRINT, _report.recordset() != NULL);
}
}
void TReport_mask::notify_focus_field(short id)
{
TAutomask::notify_focus_field(id);
@ -896,87 +952,55 @@ void TReport_mask::notify_focus_field(short id)
}
}
void TReport_mask::update_toolbar()
{
const bool full = !efield(F_CODICE).empty();
enable(DLG_SAVEREC, full);
enable(DLG_DELREC, full);
enable(DLG_PRINT, full && _report.recordset() != NULL);
}
bool TReport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_CODICE:
if (e == fe_init)
if (e == fe_init || e == fe_modify)
{
if (main_app().argc() >= 3)
if (e == fe_init)
{
set(F_CODICE, main_app().argv(2));
if (main_app().argc() >= 3)
{
set(F_CODICE, main_app().argv(2));
load_report();
}
} else
if (e == fe_modify)
{
save_if_needed();
load_report();
}
}
if (e == fe_modify)
{
save_if_needed();
load_report();
update_toolbar();
}
break;
case F_SECTIONS:
if (e == fe_init || e == fe_modify)
{
select_section();
break;
case F_TOOLS:
if (e == fe_modify)
{
const TReport_section& rs = _tree.curr_section();
const bool ok = strchr("HBF", rs.type()) != NULL;
enable(-1, ok);
}
break;
case F_FLD_ADD:
if (e == fe_button && o.active())
add_field();
break;
case F_FLD_PROPERTIES:
if (e == fe_button && o.active())
fields_properties();
break;
case F_SEC_ADD:
if (e == fe_button && o.active())
add_section();
break;
case F_SEC_PROPERTIES:
if (e == fe_button && o.active())
section_properties();
break;
case F_REP_PROPERTIES:
if (e == fe_button)
report_properties();
break;
case F_SQL:
if (e == fe_init || e == fe_modify)
enable(F_SHOW_QRY, !o.empty());
break;
case F_NEW_QRY:
if (e == fe_button)
{
TExternal_app q("ba8 -1");
q.run();
}
break;
case F_IMPORT_QRY:
if (e == fe_button)
select_query();
break;
case F_SHOW_QRY:
if (e == fe_button)
{
const TString& sql = get(F_SQL);
TRecordset* rex = create_recordset(sql);
if (rex != NULL)
const bool on = strchr("HBF", rs.type()) != NULL;
switch (atoi(o.get()))
{
if (rex->items() > 0)
{
TRecordset_sheet sht(*rex);
sht.run();
}
else
{
if (sql.find("SELECT ") >= 0)
warning_box(TR("Nessuna riga risultato"));
}
delete rex;
case 0: if (on) add_field(); break;
case 1: if (on) fields_properties(); break;
case 2: add_section(); break;
case 3: if (on) section_properties(); break;
case 4: report_properties(); break;
case 5: report_query(); break;
default: break;
}
}
break;
@ -997,6 +1021,7 @@ bool TReport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
case DLG_FINDREC:
if (e == fe_button)
send_key(K_F9, F_CODICE);
break;
case DLG_SAVEREC:
if (e == fe_button)
{
@ -1020,14 +1045,55 @@ bool TReport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
return true;
}
void TReport_mask::handler(WINDOW win, EVENT* ep)
{
if (ep->type == E_COMMAND)
{
switch (ep->v.cmd.tag)
{
case POPUP_NEWFIELD : add_field(); break;
case POPUP_PROPERTIES: fields_properties(); break;
case POPUP_SECTION : section_properties(); break;
default: break;
}
}
return TAutomask::handler(win, ep);
}
WINDOW TReport_mask::dlg2win(short id) const
{
WINDOW w = NULL_WIN;
const int pos = id2pos(id);
if (pos >= 0)
{
TMask_field& f = fld(pos);
CHECKD(f.is_kind_of(CLASS_WINDOWED_FIELD), "Not a windowed field ", id);
w = ((TWindowed_field&)f).win().win();
}
return w;
}
void TReport_mask::add_pane(short id, const char* title, int hook)
{
WINDOW parent = page_win(0);
WINDOW child = dlg2win(id);
xvt_pane_add(parent, child, title, hook, 0);
}
TReport_mask::TReport_mask() : _tree(_report), _is_dirty(false)
{
read_mask("ba8300a", 0, -1);
set_handlers();
TOutlook_field& of = (TOutlook_field&)field(F_TOOLS);
of.add_item(10210, PR("Nuovo Campo"), 0);
of.add_item(10210, PR("Proprieta' Campo"), 0);
of.add_item(10202, PR("Nuova Sezione"), 0);
of.add_item(10202, PR("Proprieta' Sezione"), 0);
of.add_item(10217, PR("Proprieta' Report"), 0);
of.add_item(10214, PR("Query Principale"), 0);
TTree_field& albero = tfield(F_SECTIONS);
RCT rct_sec; albero.get_rect(rct_sec);
const short sec[2] = { F_REPORT, F_REPORTH };
for (int s = 0; s < 2; s++)
{
@ -1037,7 +1103,6 @@ TReport_mask::TReport_mask() : _tree(_report), _is_dirty(false)
rct_rep.right -= ROWY;
rct_rep.bottom -= ROWY;
rd.set_rect(rct_rep);
switch (s)
{
case 1 :
@ -1053,12 +1118,18 @@ TReport_mask::TReport_mask() : _tree(_report), _is_dirty(false)
_tree.goto_node('B', 1);
const int ih = _tree.image_height();
if (ih > CHARY)
albero.set_row_height(ih);
albero.set_tree(&_tree);
albero.set_row_height(ih); // Imposta le dimensioni delle immagini
_tree.goto_root();
_tree.expand_all();
albero.set_tree(&_tree);
add_pane(F_SECTIONS, TR("Struttura"), 1); // Left upper pane
add_pane(F_TOOLS, TR("Strumenti"), 1); // Left lower pane
add_pane(F_REPORTH, TR("Testa"), 52); // Center top pane
add_pane(F_REPORT, TR("Corpo"), 54); // Center bottom pane
set_handlers();
}
///////////////////////////////////////////////////////////

View File

@ -2,15 +2,14 @@
#define F_DESCR 102
#define F_SECTIONS 103
#define F_REPORTH_TITLE 104
#define F_REPORTH 105
#define F_REPORT_TITLE 106
#define F_REPORT 107
#define F_FLD_ADD 110
#define F_FLD_PROPERTIES 111
#define F_SEC_ADD 112
#define F_SEC_PROPERTIES 113
#define F_REP_PROPERTIES 114
#define F_TOOLS 115
#define F_TYPE 120
#define F_ID 121
@ -58,7 +57,6 @@
#define F_COMMAND 171
#define F_PAGE_SPLIT 172
#define F_PAGE_MERGE 173
#define F_SQL 201
#define F_IMPORT_QRY 202

View File

@ -1,51 +1,10 @@
#include "ba8300.h"
TOOLBAR "" 0 -2 0 2
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -16 -11 ""
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
END
BUTTON DLG_NEWREC 10 2
BEGIN
PROMPT -26 -11 "~Nuovo"
PICTURE BMP_NEWREC
PICTURE BMP_NEWRECDN
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -36 -11 ""
PICTURE BMP_DELREC
PICTURE BMP_DELRECDN
END
BUTTON DLG_FINDREC 10 2
BEGIN
PROMPT -46 -11 "Ri~cerca"
PICTURE BMP_FINDREC
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -56 -11 "~Stampa"
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -66 -11 ""
END
ENDPAGE
PAGE "@bReport" -1 -1 78 23
TOOLBAR "" 0 -1 0 1
STRING F_CODICE 128 24
BEGIN
PROMPT 1 0 ""
PROMPT 1 -11 ""
RSELECT ""
WARNING "E' necessario specificare il codice"
CHECKTYPE REQUIRED
@ -53,86 +12,70 @@ END
STRING F_DESCR 50 46
BEGIN
PROMPT 30 0 ""
PROMPT 30 -11 ""
END
TREE F_SECTIONS 30 12
ENDPAGE
TOOLBAR "" 0 0 0 2
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT 0 1 ""
PROMPT -16 -1 "Salva"
PICTURE BMP_SAVEREC
END
TEXT F_REPORTH_TITLE
BUTTON DLG_NEWREC 10 2
BEGIN
PROMPT 41 1 "Testata di livello 0"
PROMPT -26 -1 "Nuovo"
PICTURE BMP_NEWREC
END
REPORT F_REPORTH -3 4
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT 21 2 ""
PROMPT -36 -1 "Elimina"
PICTURE BMP_DELREC
END
TEXT F_REPORT_TITLE
BUTTON DLG_FINDREC 10 2
BEGIN
PROMPT 41 7 "Corpo di livello 0"
PROMPT -46 -1 "Ricerca"
PICTURE 166
END
REPORT F_REPORT -3 -3
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT 21 8 ""
PROMPT -56 -1 "Stampa"
PICTURE BMP_PRINT
END
BUTTON F_FLD_ADD 10 2
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -16 -1 "Campo +"
GROUP 1
END
BUTTON F_FLD_PROPERTIES 10 2
BEGIN
PROMPT -26 -1 "Proprieta'"
GROUP 1
END
BUTTON F_SEC_ADD 10 2
BEGIN
PROMPT -36 -1 "Sezione +"
GROUP 1
END
BUTTON F_SEC_PROPERTIES 10 2
BEGIN
PROMPT -46 -1 "Sezione"
GROUP 1
END
BUTTON F_REP_PROPERTIES 10 2
BEGIN
PROMPT -66 -1 "Report"
PROMPT -66 -1 ""
END
ENDPAGE
PAGE "Sql" -1 -1 78 23
PAGE "Report" -1 -1 78 23
MEMO F_SQL 76 -2
TREE F_SECTIONS 22 12
BEGIN
PROMPT 2 1 "Query SQL origine dei dati"
PROMPT 0 1 "Struttura"
END
BUTTON F_NEW_QRY 20 2
OUTLOOK F_TOOLS 22 8
BEGIN
PROMPT -25 -1 "Nuova query"
PROMPT 0 12 "Strumenti"
END
BUTTON F_IMPORT_QRY 20 2
REPORT F_REPORTH -3 4
BEGIN
PROMPT -35 -1 "Importa query"
PROMPT 21 2 "Testa"
END
BUTTON F_SHOW_QRY 20 2
REPORT F_REPORT -3 -3
BEGIN
PROMPT -45 -1 "~Edit"
PICTURE BMP_EDIT
PROMPT 21 8 "Corpo"
END
ENDPAGE

View File

@ -1,6 +1,6 @@
#include "ba8300.h"
PAGE "Campo" -1 -1 74 17
PAGE "Campo" -1 -1 74 18
LIST F_TYPE 1 16
BEGIN
@ -94,9 +94,9 @@ BEGIN
PROMPT 1 5 "@bTesto"
END
MEMO F_SOURCE 68 4
MEMO F_SOURCE 68 5
BEGIN
PROMPT 1 10 "@bSorgente"
PROMPT 1 9 "@bSorgente"
END
ZOOM F_SOURCE2 80 46
@ -104,27 +104,6 @@ BEGIN
PROMPT 1 14 "@bSorgente alternativa "
END
BUTTON DLG_FINDREC 10 2
BEGIN
PROMPT -33, 9 ""
PICTURE BMP_FINDREC
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
PAGE "Aspetto" -1 -1 74 16
@ -204,17 +183,6 @@ BEGIN
PROMPT 2 10 "~Font"
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
PAGE "Avanzate" -1 -1 74 16
@ -229,16 +197,6 @@ BEGIN
PROMPT 1 7 "Script finale"
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
PAGE "Lista" -1 -1 72 16
@ -252,17 +210,32 @@ BEGIN
FLAGS "H|"
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -13 -1 ""
END
ENDPAGE
TOOLBAR "Toolbar" 0 0 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -33 -1 ""
PROMPT -14 -1 ""
END
ENDPAGE
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -24 -1 ""
END
BUTTON DLG_FINDREC 10 2
BEGIN
PROMPT -34, 9 ""
PICTURE 166
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -44 -1 ""
END
END
ENDMASK
@ -283,7 +256,7 @@ BEGIN
PROMPT 1 1 "Script"
END
BUTTON DLG_CANCEL 10 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
@ -293,7 +266,7 @@ BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_OK 10 2
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END

View File

@ -97,21 +97,6 @@ BEGIN
FLAGS "H"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
PAGE "Query" -1 -1 60 16
@ -129,16 +114,6 @@ BEGIN
CHECKTYPE REQUIRED
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
PAGE "Aspetto" -1 -1 72 16
@ -195,16 +170,6 @@ BEGIN
PROMPT 2 10 "~Font"
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
PAGE "Avanzate" -1 -1 50 16
@ -219,12 +184,21 @@ BEGIN
PROMPT 1 7 "Script finale"
END
BUTTON DLG_CANCEL 10 2
ENDPAGE
TOOLBAR "" 0 0 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_OK 10 2
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END

View File

@ -2,7 +2,7 @@
PAGE "Report" -1 -1 60 16
RADIO F_ORIENTATION 1 58
RADIO F_ORIENTATION 1 24
BEGIN
PROMPT 1 0 "@bOrientamento della carta"
ITEM "0|Impostazioni Stampante"
@ -10,16 +10,26 @@ BEGIN
ITEM "2|Paesaggio (Orizzontale)"
END
BOOLEAN F_PAGE_SPLIT
BEGIN
PROMPT 26 1 "Suddividi una pagina su piu' fogli"
END
BOOLEAN F_PAGE_MERGE
BEGIN
PROMPT 26 2 "Raggruppa piu' pagine in un foglio"
END
BOOLEAN F_FONT_AUTO
BEGIN
PROMPT 1 5 "Seleziona font in base alle impostazioni della stampante"
PROMPT 26 3 "Seleziona font corrente della stampante"
MESSAGE FALSE ENABLE,F_FONT_SELECT|ENABLE,F_DY|ENABLE,F_DX
MESSAGE TRUE DISABLE,F_FONT_SELECT|DISABLE,F_DY|DISABLE,F_DX
END
NUMBER F_DX 2
BEGIN
PROMPT 31 6 "Caratteri per pollice "
PROMPT 1 5 "Caratteri per pollice "
FLAGS "U"
CHECKTYPE NORMAL
END
@ -34,26 +44,16 @@ BEGIN
PROMPT 26 2 "Raggruppa piu' pagine in un foglio"
END
BOOLEAN F_PAGE_SPLIT
BEGIN
PROMPT 26 1 "Suddividi una pagina su piu' fogli"
END
BOOLEAN F_PAGE_MERGE
BEGIN
PROMPT 26 2 "Raggruppa piu' pagine in un foglio"
END
NUMBER F_DY 2
BEGIN
PROMPT 26 3 "Linee per pollice "
PROMPT 28 5 "Linee per pollice "
FLAGS "U"
CHECKTYPE REQUIRED
END
BUTTON F_FONT_SELECT 12 2
BEGIN
PROMPT 26 4 "~Font"
PROMPT 1 6 "~Font"
END
MEMO F_INCLUDE 57 3
@ -71,37 +71,17 @@ BEGIN
PROMPT 1 12 "Riga di comando "
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
PAGE "Parametri" -1 -1 60 16
SPREADSHEET F_PARAMS 0 -3
BEGIN
PROMPT 1 6 ""
PROMPT 1 1 ""
ITEM "Parametro@16"
ITEM "Valore@50"
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
PAGE "Avanzate" -1 -1 60 16
@ -116,16 +96,6 @@ BEGIN
PROMPT 1 10 "Script finale"
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
PAGE "Allegati" -1 -1 60 16
@ -136,14 +106,18 @@ BEGIN
ITEM "Allegato@50"
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -12 -1 ""
END
ENDPAGE
TOOLBAR "" 0 0 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -22 -1 ""
PROMPT -13 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
@ -162,6 +136,10 @@ BEGIN
PROMPT 1 2 "Valore "
END
ENDPAGE
TOOLBAR "" 0 0 0 2
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -13 -1 ""
@ -189,7 +167,11 @@ BEGIN
FSELECT ""
END
BUTTON DLG_CANCEL 10 2
ENDPAGE
TOOLBAR "" 0 0 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
@ -199,7 +181,7 @@ BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_OK 10 2
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END

44
ba/ba8300f.uml Executable file
View File

@ -0,0 +1,44 @@
#include "ba8300.h"
TOOLBAR "" 0 0 0 2
BUTTON DLG_OK 15 2
BEGIN
PROMPT -15 -11 "Conferma"
END
BUTTON F_NEW_QRY 15 2
BEGIN
PROMPT -25 -11 "Nuovo"
PICTURE BMP_NEWREC
END
BUTTON F_IMPORT_QRY 15 2
BEGIN
PROMPT -35 -11 "Importa"
PICTURE 166
END
BUTTON F_SHOW_QRY 15 2
BEGIN
PROMPT -45 -11 "~Edit"
PICTURE BMP_EDIT
END
BUTTON DLG_CANCEL 15 2
BEGIN
PROMPT -55 -11 ""
END
ENDPAGE
PAGE "Query" -1 -1 78 23
MEMO F_SQL
BEGIN
PROMPT 0 0 ""
END
ENDPAGE
ENDMASK

View File

@ -15,7 +15,6 @@
void describe_section(char type, int level, TString& str)
{
str = " ";
if (level <= 0)
{
switch (type)
@ -37,15 +36,16 @@ void describe_section(char type, int level, TString& str)
case 'F': str << TR("Coda"); break;
default : break;
}
str << ' ';
if (level < 10 && (type == 'H' || type == 'F'))
{
if (level <= 1)
str << TR("Report");
str << TR("Report");
else
str << TR("Gruppo") << ' ' << (level-1);
}
else
str << ' ' << level;
str << level;
}
}
@ -243,10 +243,12 @@ bool TReport_tree::has_root() const
bool TReport_tree::has_father() const
{
/*
if (curr_level() > 10) // Subsection
return true;
return !has_son();
*/
return _curr[0] != 'P' && _curr[0] != 'R';
}
bool TReport_tree::goto_father()
@ -377,8 +379,7 @@ TImage* TReport_tree::image(bool selected) const
}
else
{
if (has_son())
id = selected ? 178 : 177;
id = selected ? 177 : 178; // Cartelle aperte/chiuse a caso
}
return id > 0 ? get_res_image(id) : TTree::image(selected);
}
@ -396,14 +397,14 @@ int TReport_tree::image_height() const
void TReport_base_mask::update()
{
const TMask_field& fld = field(F_FONT_SELECT);
if (fld.active() && win() == fld.parent())
if (fld.active() && curr_win() == fld.parent())
{
RCT rctfld; fld.get_rect(rctfld);
const int x = rctfld.right / CHARX + 1;
const int y = rctfld.top / ROWY + 1;
RCT& rct = resize_rect(x, y, -3, 2, W_PLAIN, win());
RCT& rct = resize_rect(x, y, -3, 2, W_PLAIN, fld.parent());
rct.top = rctfld.top; rct.bottom = rctfld.bottom;
xi_draw_3d_rect((XinWindow)win(), (XinRect*)&rct, TRUE, 2, MASK_LIGHT_COLOR,
xi_draw_3d_rect((XinWindow)fld.parent(), (XinRect*)&rct, TRUE, 2, MASK_LIGHT_COLOR,
_bgcolor, MASK_DARK_COLOR);
rct.left += 2; rct.right -= 2;
@ -412,7 +413,7 @@ void TReport_base_mask::update()
XVT_FNTID fontid = _font.get_xvt_font(*this);
xvt_font_set_size(fontid, _font.size());
xvt_dwin_set_font(win(), fontid);
xvt_dwin_set_font(fld.parent(), fontid);
set_color(_fgcolor, _bgcolor);
advanced_draw_text_line(*this, _font.name(), rct, _halign, _valign);
}
@ -525,14 +526,14 @@ void TReport_field_mask::update()
for (int i = 0; i < 2; i++)
{
TMask_field& fld = field(i == 0 ? F_FGCOLOR : F_BGCOLOR);
if (fld.active() && fld.parent() == win())
if (fld.active() && fld.parent() == curr_win())
{
RCT rctfld; fld.get_rect(rctfld);
const int x = rctfld.right / CHARX + 1;
const int y = rctfld.top / ROWY + 1;
RCT& rct = resize_rect(x, y, -3, 1, W_PLAIN, win());
RCT& rct = resize_rect(x, y, -3, 1, W_PLAIN, fld.parent());
rct.top = rctfld.top; rct.bottom = rctfld.bottom;
xi_draw_3d_rect((XinWindow)win(), (XinRect*)&rct, TRUE, 2, MASK_LIGHT_COLOR,
xi_draw_3d_rect((XinWindow)fld.parent(), (XinRect*)&rct, TRUE, 2, MASK_LIGHT_COLOR,
i == 0 ? _fgcolor : _bgcolor, MASK_DARK_COLOR);
}
}
@ -761,9 +762,7 @@ void TReport_field_mask::get_field(TReport_field& rf) const
TReport_field_mask::TReport_field_mask(TReport_field& rf)
: TReport_base_mask("ba8300b", rf.section().report()), _rf(rf)
{
set_field(rf);
}
{ set_field(rf); }
///////////////////////////////////////////////////////////
// Utility
@ -874,6 +873,9 @@ void TReport_window::set_report_section(TReport_section& rs)
_report = &rs.report();
_type = rs.type();
_level = rs.level();
TString str; describe_section(rs.type(), rs.level(), str);
xvt_pane_set_title(win(), str);
}
bool TReport_window::pick(const TPoint& ptlog) const
@ -1010,20 +1012,6 @@ void TReport_window::snap(TRectangle& rct, bool shift) const
rct.set(p0, p1);
}
#define POPUP_CUT 20883
#define POPUP_COPY 20884
#define POPUP_PASTE 20885
#define POPUP_DUP 20886
#define POPUP_CLEAR 20887
#define POPUP_ZOOMIN 20888
#define POPUP_ZOOMOUT 20889
#define POPUP_BACKGROUND 20890
#define POPUP_SELALL 20891
#define POPUP_UNSELALL 20892
#define POPUP_PROPERTIES 20893
#define POPUP_NEWFIELD 20894
bool TReport_window::on_key(KEY k)
{
switch (k)
@ -1070,8 +1058,8 @@ bool TReport_window::on_key(KEY k)
dispatch_e_menu(win(), POPUP_ZOOMOUT);
return true;
case K_ENTER:
owner().mask().send_key(K_SPACE, F_FLD_PROPERTIES);
break;
dispatch_e_menu(win(), POPUP_PROPERTIES);
return true;
case K_ESC:
{
TReport_section& rs = curr_section();
@ -1402,7 +1390,7 @@ void TReport_window::handler(WINDOW win, EVENT* ep)
}
break;
case E_MOUSE_DBL:
owner().mask().send_key(K_SPACE, F_FLD_PROPERTIES);
dispatch_e_menu(win, POPUP_PROPERTIES);
break;
case E_COMMAND:
switch(ep->v.cmd.tag)
@ -1457,14 +1445,11 @@ void TReport_window::handler(WINDOW win, EVENT* ep)
{
clear_selection();
const bool full = pick(_pt_drag_start);
if (full)
owner().mask().send_key(K_SPACE, F_FLD_PROPERTIES);
else
owner().mask().send_key(K_SPACE, F_SEC_PROPERTIES);
dispatch_e_menu(parent(), full ? POPUP_PROPERTIES : POPUP_SECTION);
}
break;
case POPUP_NEWFIELD:
owner().mask().send_key(K_SPACE, F_FLD_ADD);
dispatch_e_menu(parent(), POPUP_NEWFIELD);
break;
default:
break;
@ -1845,11 +1830,6 @@ void TReport_drawer::set_report_section(TReport_section& rs)
{
TReport_window* w = (TReport_window*)_win;
w->set_report_section(rs);
const int pos = mask().id2pos(dlg()) - 1; // Caption field position
TString str; describe_section(rs.type(), rs.level(), str);
str.insert("@b");
mask().fld(pos).set_prompt(str);
}
TReport_section& TReport_drawer::curr_section()

View File

@ -1,3 +1,6 @@
#ifndef __BA8301_H
#define __BA8301_H
#ifndef __AUTOMASK_H
#include <automask.h>
#endif
@ -114,3 +117,19 @@ public:
const TString& num2str(int num);
short str2num(const TString& str);
#define POPUP_CUT 20883
#define POPUP_COPY 20884
#define POPUP_PASTE 20885
#define POPUP_DUP 20886
#define POPUP_CLEAR 20887
#define POPUP_ZOOMIN 20888
#define POPUP_ZOOMOUT 20889
#define POPUP_BACKGROUND 20890
#define POPUP_SELALL 20891
#define POPUP_UNSELALL 20892
#define POPUP_PROPERTIES 20893
#define POPUP_NEWFIELD 20894
#define POPUP_SECTION 20895
#endif