diff --git a/ba/ba0100.cpp b/ba/ba0100.cpp index 7ddac15b7..d360b7551 100755 --- a/ba/ba0100.cpp +++ b/ba/ba0100.cpp @@ -248,7 +248,6 @@ bool TPicture_mask::on_key(KEY k) return TMask::on_key(k); } - void TPicture_mask::on_firm_change() { force_update(); @@ -277,17 +276,6 @@ TPicture_mask::TPicture_mask(const char* name, int dx, int dy, TImage logo(logoname); if(logo.ok()) { -/* RCT rct; xvt_vobj_get_client_rect(win(), &rct); - const bool is_tree = dx == 0 && dy == 0; - double screen_width = 50*CHARX; - - const double ratio = screen_width / logo.width(); - const int maxx = int(ratio * logo.width()); - const int maxy = int(ratio * logo.height()); - - if (can_be_transparent(logo)) - logo.convert_transparent_color(MASK_BACK_COLOR); - _logo = new TImage(logo, maxx, maxy);*/ if (can_be_transparent(logo)) logo.convert_transparent_color(MASK_BACK_COLOR); _logo = new TImage(logo); @@ -308,22 +296,78 @@ TPicture_mask::~TPicture_mask() class TExplorer_mask : public TMask { TMenu_tree _tree; - + protected: virtual bool stop_run(KEY k); virtual bool on_key(KEY k); virtual void on_idle(); - static bool explore_handler(TMask_field& f, KEY k); public: TExplorer_mask(TMenu& menu); + ~TExplorer_mask(); }; + bool TExplorer_mask::stop_run(KEY k) { if (k == K_CTRL+'R') return TWindow::stop_run(k); + + if (k == K_QUIT) + { + if (ADVANCED_GRAPHICS) + { + WINDOW window[3]; + XVT_IMAGE image[3]; + int i; + for (i = 0; i < 3; i++) + { + WINDOW w = NULL_WIN; + switch (i) + { + case 1: w = ((TWindowed_field&)field(DLG_TREE)).win().win(); break; + case 2: w = ((TWindowed_field&)field(DLG_LIST)).win().win(); break; + default: w = win(); break; + } + RCT rct; xvt_vobj_get_client_rect(w, &rct); + RCT irct = rct; irct.right /= 4; irct.bottom /= 4; + XVT_IMAGE cap = xvt_image_capture(w, &rct); + XVT_IMAGE img = xvt_image_create(XVT_IMAGE_RGB, irct.right, irct.bottom, 0); + xvt_image_transfer(img, cap, &irct, &rct); + xvt_image_destroy(cap); + + for (int y = 0; y < irct.bottom; y++) + { + for (int x = 0; x < irct.right; x++) + { + COLOR rgb = xvt_image_get_pixel(img, x, y); + const unsigned int r = XVT_COLOR_GET_RED(rgb) / 2; + const unsigned int g = XVT_COLOR_GET_GREEN(rgb) / 2; + const unsigned int b = XVT_COLOR_GET_BLUE(rgb) / 2; + xvt_image_set_pixel(img, x, y, MAKE_COLOR(r, g, b)); + } + } + window[i] = w; + image[i] = img; + } + for (i = 2; i >= 0; i--) + { + RCT rct; xvt_vobj_get_client_rect(window[i], &rct); + RCT irct = rct; irct.right /= 4; irct.bottom /= 4; + xvt_dwin_draw_image(window[i], image[i], &rct, &irct); + xvt_image_destroy(image[i]); + } + + if (!yesno_box(TR("Si desidera uscire?"))) + { + for (i = 0; i < 3; i++) + xvt_dwin_invalidate_rect(window[i], NULL); + return false; + } + } + } + return TMask::stop_run(k); } @@ -366,7 +410,7 @@ bool TExplorer_mask::explore_handler(TMask_field& f, KEY k) TExplorer_mask::TExplorer_mask(TMenu& menu) : TMask ("", 1, 0, 0, 0, 0), _tree(menu) { - const int margin = (columns()-80) / 2; + const int margin = (columns()-80) / 2; const int tree_width = margin+21; // Usa la metà di sinistra TTree_field& tree_fld = add_tree(DLG_TREE, 0, 0, 0, tree_width, -5); @@ -390,6 +434,10 @@ TExplorer_mask::TExplorer_mask(TMenu& menu) first_focus(DLG_LIST); } +TExplorer_mask::~TExplorer_mask() +{ +} + /////////////////////////////////////////////////////////// // Color Mask /////////////////////////////////////////////////////////// @@ -813,10 +861,15 @@ bool TMenu_application::check_user() #else TMask m("ba0100a"); -#ifdef DBG - m.set_handler(F_USER, pwd_handler); - m.set_handler(F_PASSWORD, pwd_handler); -#endif + + char hostname[256]; xvt_sys_get_host_name(hostname, sizeof(hostname)); + if (strcmp(hostname, "BATMOBILE") == 0 || strcmp(hostname, "ETABETA") == 0 || + strcmp(hostname, "KIRK") == 0 || strcmp(hostname, "SPOCK") == 0 || + strcmp(hostname, "UHURA") == 0) + { + m.set_handler(F_USER, pwd_handler); + m.set_handler(F_PASSWORD, pwd_handler); + } TEdit_field& e = m.efield(F_USER); e.browse()->set_filter("ISGROUP!=\"X\""); diff --git a/ba/ba0102.cpp b/ba/ba0102.cpp index 9153d0717..a3762d3ba 100755 --- a/ba/ba0102.cpp +++ b/ba/ba0102.cpp @@ -344,7 +344,6 @@ void TMenulist_images::set_owner_info(WINDOW win, int max_side) _max_side = max_side; } - TObject* TMenulist_images::key2obj(const char* key) { TImage* img = NULL; diff --git a/ba/ba8.cpp b/ba/ba8.cpp index 3d0d68c09..efacf44ac 100755 --- a/ba/ba8.cpp +++ b/ba/ba8.cpp @@ -10,6 +10,7 @@ int main(int argc, char** argv) case 2: ba8300(argc, argv); break; // Report Generator case 3: ba8400(argc, argv); break; // Form Converter case 4: ba8500(argc, argv); break; // Report Printer + case 5: ba8600(argc, argv); break; // Tables Report Printer default: ba8100(argc, argv); break; // Record Selector } return 0; diff --git a/ba/ba8.h b/ba/ba8.h index e5d825c60..624addfcd 100755 --- a/ba/ba8.h +++ b/ba/ba8.h @@ -3,5 +3,6 @@ int ba8200(int argc, char* argv[]); int ba8300(int argc, char* argv[]); int ba8400(int argc, char* argv[]); int ba8500(int argc, char* argv[]); +int ba8600(int argc, char* argv[]); diff --git a/ba/ba8200.cpp b/ba/ba8200.cpp index 4c51bd87c..9f3fde0fe 100755 --- a/ba/ba8200.cpp +++ b/ba/ba8200.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -1336,6 +1337,9 @@ public: bool TSQL_recordset_app::create() { + if (!has_module(RSAUT)) + return error_box(TR("Modulo non autorizzato")); + _msk = new TQuery_mask; xvt_sys_sleep(500); // Lasciamo il tempo di leggere il titolo return TSkeleton_application::create(); diff --git a/ba/ba8300.cpp b/ba/ba8300.cpp index c8bf0bd5a..f3de3c634 100755 --- a/ba/ba8300.cpp +++ b/ba/ba8300.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -1333,6 +1334,9 @@ void TReporter_app::print() bool TReporter_app::create() { + if (!has_module(RSAUT)) + return error_box(TR("Modulo non autorizzato")); + _msk = new TReport_mask; xvt_sys_sleep(500); return TSkeleton_application::create(); diff --git a/ba/ba8400.cpp b/ba/ba8400.cpp index b0566e306..ba0fff43a 100755 --- a/ba/ba8400.cpp +++ b/ba/ba8400.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -547,9 +548,18 @@ TFormer_mask::TFormer_mask() class TFormer_app : public TSkeleton_application { protected: + virtual bool create(); virtual void main_loop(); }; +bool TFormer_app::create() +{ + if (!has_module(RSAUT)) + return error_box(TR("Modulo non autorizzato")); + + return TSkeleton_application::create(); +} + void TFormer_app::main_loop() { TFormer_mask m; diff --git a/ba/ba8500.cpp b/ba/ba8500.cpp index 4ae585a48..10684bfc7 100755 --- a/ba/ba8500.cpp +++ b/ba/ba8500.cpp @@ -164,45 +164,48 @@ protected: virtual void main_loop(); }; - void TKlarkKent_app::main_loop() { - TFilename report_name; - if (argc() > 2) - { - report_name = argv(2); + TString_array arr; + for (int i = 2; i < argc(); i++) + arr.add(argv(i)); + if (arr.items() == 0) + arr.add(EMPTY_STRING); + + TReport_book book; + FOR_EACH_ARRAY_ROW(arr, r, row) + { + TFilename report_name = *row; report_name.ext("rep"); - } - - if (report_name.empty() || !report_name.custom_path()) - { - TKlarkKent_mask m; - m.set(F_REPORT, report_name); - if (m.run() == K_ENTER) + if (report_name.empty() || !report_name.custom_path()) { - report_name = m.get(F_REPORT); - report_name.custom_path(); + TKlarkKent_mask m; + m.set(F_REPORT, report_name); + if (m.run() == K_ENTER) + { + report_name = m.get(F_REPORT); + report_name.custom_path(); + } + } + + TString appname, desc; + rep2app(report_name, appname, desc); + if (appname.not_empty()) + { + appname << ' ' << report_name; + TExternal_app app(appname); + app.run(true); + } + else + { + TReport rep; + if (rep.load(report_name)) + book.add(rep); } } - TString appname, desc; - rep2app(report_name, appname, desc); - if (appname.not_empty()) - { - appname << ' ' << report_name; - TExternal_app app(appname); - app.run(true); - } - else - { - TReport rep; - if (rep.load(report_name)) - { - TReport_book book; - book.add(rep); - book.print_or_preview(); - } - } + if (book.pages() > 0) + book.print_or_preview(); } int ba8500(int argc, char* argv[]) diff --git a/ba/ba8600.cpp b/ba/ba8600.cpp new file mode 100755 index 000000000..3d82ff225 --- /dev/null +++ b/ba/ba8600.cpp @@ -0,0 +1,107 @@ +//Programma per stampa report tabelle + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////// +// TTable_report +/////////////////////////////////////////////////////////// + +class TTable_report : public TReport +{ +protected: + virtual bool execute_prescript(); +}; + +bool TTable_report::execute_prescript() +{ + TFilename msk = filename().name(); + msk.ext(""); msk.lower(); + TMask m(msk); + + const bool ok = m.run() == K_ENTER; + if (ok) + { + TRectype rec_fr(LF_TAB), rec_to(LF_TAB); + for (int i = 0; i < m.fields(); i++) + { + const TMask_field& fld = m.fld(i); + const TFieldref* fr = fld.field(); + if (fr != NULL) + { + if (fld.in_group(1)) + fr->write(fld.get(), rec_fr); + if (fld.in_group(2)) + fr->write(fld.get(), rec_to); + } + } + + TString use = recordset()->query_text(); + + const TString& cod_fr = rec_fr.get("CODTAB"); + if (cod_fr.not_empty()) + use << "\nFROM CODTAB='" << cod_fr << '\''; + + const TString& cod_to = rec_to.get("CODTAB"); + if (cod_to.not_empty()) + use << "\nTO CODTAB='" << cod_to << '\''; + + set_recordset(use); + } + + return ok; +} + +/////////////////////////////////////////////////////////// +// TTable_reporter +/////////////////////////////////////////////////////////// + +class TTable_reporter : public TSkeleton_application +{ +protected: + virtual void main_loop(); + +public: + bool get_rpt_name(TFilename& rptname) const; +}; + + +bool TTable_reporter::get_rpt_name(TFilename& rptname) const +{ + TTable tab(argv(2)); + rptname = tab.module(); + rptname << "st" << tab.get("COD"); + rptname.ext("rep"); + rptname.lower(); + + return rptname.custom_path(); +} + +void TTable_reporter::main_loop() +{ + TFilename rptname; + if (get_rpt_name(rptname)) + { + while (true) + { + TTable_report rep; rep.load(rptname); + TReport_book book; + if (book.add(rep)) + book.print_or_preview(); + else + break; + } + } + else + error_box(FR("Manca il file %s"), (const char *)rptname); +} + + +int ba8600(int argc, char* argv[]) +{ + TTable_reporter app; + app.run(argc, argv, TR("Stampa Report Tabelle")); + return 0; +} \ No newline at end of file