diff --git a/ba/ba8300.cpp b/ba/ba8300.cpp index 944513f02..1290515e9 100755 --- a/ba/ba8300.cpp +++ b/ba/ba8300.cpp @@ -48,13 +48,14 @@ short str2num(const TString& str) } /////////////////////////////////////////////////////////// -// TFont_button_mask +// TReport_base_mask /////////////////////////////////////////////////////////// -class TFont_button_mask : public TAutomask +class TReport_base_mask : public TAutomask { TReport_font _font; bool _font_changed; + TReport& _report; protected: char _halign, _valign; @@ -67,10 +68,10 @@ public: void set_font_info(const TReport_font& font); bool get_font_info(TReport_font& font) const; - TFont_button_mask(const char* name); + TReport_base_mask(const char* name, TReport& rep); }; -void TFont_button_mask::update() +void TReport_base_mask::update() { const TMask_field& fld = field(F_FONT_SELECT); if (fld.active() && win() == fld.parent()) @@ -95,7 +96,7 @@ void TFont_button_mask::update() } } -bool TFont_button_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) +bool TReport_base_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) { switch (o.dlg()) { @@ -128,18 +129,27 @@ bool TFont_button_mask::on_field_event(TOperable_field& o, TField_event e, long force_update(); } break; + case F_PRESCRIPT: + case F_POSTSCRIPT: + if (e == fe_close) + { + TReport_script s; + s.set(o.get()); + s.compile(_report); + } + break; default: break; } return true; } -void TFont_button_mask::set_font_info(const TReport_font& font) +void TReport_base_mask::set_font_info(const TReport_font& font) { _font = font; } -bool TFont_button_mask::get_font_info(TReport_font& font) const +bool TReport_base_mask::get_font_info(TReport_font& font) const { const bool ok = _font_changed; if (ok) @@ -147,8 +157,9 @@ bool TFont_button_mask::get_font_info(TReport_font& font) const return ok; } -TFont_button_mask::TFont_button_mask(const char* name) - : TAutomask(name), _font_changed(false), +TReport_base_mask::TReport_base_mask(const char* name, TReport& rep) + : TAutomask(name), _report(rep), + _font_changed(false), _halign('C'), _valign('C'), _fgcolor(COLOR_BLACK), _bgcolor(COLOR_WHITE) { @@ -158,7 +169,7 @@ TFont_button_mask::TFont_button_mask(const char* name) // TReport_field_mask /////////////////////////////////////////////////////////// -class TReport_field_mask : public TFont_button_mask +class TReport_field_mask : public TReport_base_mask { protected: @@ -173,7 +184,7 @@ public: void set_field(const TReport_field& rf); void get_field(TReport_field& rf) const; - TReport_field_mask() :TFont_button_mask("ba8300b") { } + TReport_field_mask(TReport_field& rf); }; void TReport_field_mask::set_num(short id, long num) @@ -202,7 +213,7 @@ void TReport_field_mask::update() i == 0 ? _fgcolor : _bgcolor, MASK_DARK_COLOR); } } - TFont_button_mask::update(); + TReport_base_mask::update(); } void TReport_field_mask::vedo_non_vedo() @@ -287,7 +298,7 @@ bool TReport_field_mask::on_field_event(TOperable_field& o, TField_event e, long default: break; } - return TFont_button_mask::on_field_event(o, e, jolly); + return TReport_base_mask::on_field_event(o, e, jolly); } void TReport_field_mask::set_field(const TReport_field& rf) @@ -361,6 +372,12 @@ 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()) +{ + set_field(rf); +} + /////////////////////////////////////////////////////////// // TReport_sheet /////////////////////////////////////////////////////////// @@ -453,7 +470,7 @@ TReport_sheet::TReport_sheet(TReport_section& sec) // TSection_properties_mask /////////////////////////////////////////////////////////// -class TSection_properties_mask : public TFont_button_mask +class TSection_properties_mask : public TReport_base_mask { protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); @@ -461,12 +478,11 @@ protected: short get_num(short id) const; void vedo_non_vedo(); + void set_section(const TReport_section& rs); public: - void set_section(const TReport_section& rs); void get_section(TReport_section& rs) const; - - TSection_properties_mask(); + TSection_properties_mask(TReport_section& rs); }; void TSection_properties_mask::set_num(short id, long num) @@ -511,7 +527,7 @@ bool TSection_properties_mask::on_field_event(TOperable_field& o, TField_event e default: break; } - return TFont_button_mask::on_field_event(o, e, jolly); + return TReport_base_mask::on_field_event(o, e, jolly); } void TSection_properties_mask::set_section(const TReport_section& rs) @@ -568,28 +584,30 @@ void TSection_properties_mask::get_section(TReport_section& rs) const rs.set_postscript(get(F_POSTSCRIPT)); } -TSection_properties_mask::TSection_properties_mask() - : TFont_button_mask("ba8300c") -{ } +TSection_properties_mask::TSection_properties_mask(TReport_section& rs) + : TReport_base_mask("ba8300c", rs.report()) +{ + set_section(rs); +} /////////////////////////////////////////////////////////// // TReport_properties_mask /////////////////////////////////////////////////////////// -class TReport_properties_mask : public TFont_button_mask +class TReport_properties_mask : public TReport_base_mask { protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + void set_report(const TReport& r); public: - void set_report(const TReport& r); void get_report(TReport& r) const; - TReport_properties_mask() : TFont_button_mask("ba8300d") { } + TReport_properties_mask(TReport& rep) : TReport_base_mask("ba8300d", rep) { set_report(rep); } }; bool TReport_properties_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) { - return TFont_button_mask::on_field_event(o, e, jolly); + return TReport_base_mask::on_field_event(o, e, jolly); } void TReport_properties_mask::set_report(const TReport& r) @@ -807,9 +825,8 @@ void TReport_mask::update_report() const void TReport_mask::add_field() { TReport_section& rs = curr_section(); - TReport_field_mask m; TReport_field* rf = new TReport_field(&rs); - m.set_field(*rf); + TReport_field_mask m(*rf); m.disable(DLG_DELREC); if (m.run() == K_ENTER) { @@ -824,8 +841,7 @@ void TReport_mask::add_field() void TReport_mask::edit_field(TReport_field& rf) { TReport_section& rs = rf.section(); - TReport_field_mask m; - m.set_field(rf); + TReport_field_mask m(rf); const KEY key = m.run(); switch(key) { @@ -938,8 +954,7 @@ void TReport_mask::add_section() void TReport_mask::section_properties() { TReport_section& rs = curr_section(); - TSection_properties_mask m; - m.set_section(rs); + TSection_properties_mask m(rs); switch (m.run()) { case K_ENTER: @@ -966,8 +981,7 @@ void TReport_mask::section_properties() void TReport_mask::report_properties() { - TReport_properties_mask m; - m.set_report(_report); + TReport_properties_mask m(_report); if (m.run() == K_ENTER) { m.get_report(_report); diff --git a/ba/ba8302.cpp b/ba/ba8302.cpp index 6327a4c9c..89843c92d 100755 --- a/ba/ba8302.cpp +++ b/ba/ba8302.cpp @@ -427,9 +427,9 @@ const TString& TReport_section::prescript() const void TReport_section::set_prescript(const char* src) { + _prescript.set(src); TString desc; desc << type() << level() << " PRESCRIPT"; _prescript.set_description(desc); - _prescript.set(src); } const TString& TReport_section::postscript() const @@ -437,9 +437,9 @@ const TString& TReport_section::postscript() const void TReport_section::set_postscript(const char* src) { + _postscript.set(src); TString desc; desc << type() << level() << " POSTSCRIPT"; _postscript.set_description(desc); - _postscript.set(src); } void TReport_section::unmap_font() @@ -766,20 +766,28 @@ void TReport_script::copy(const TReport_script& rs) set(rs.get()); } +bool TReport_script::compile(TReport& rep) +{ + if (_bc == NULL) + _bc = new TBytecode; + + bool good = true; + if (_src.starts_with("MESSAGE ")) + good = rep.compile(translate_message(), *_bc); + else + good = rep.compile(_src, *_bc); + _bc->set_name(_desc); + + return good; +} + bool TReport_script::execute(TReport& rep, TString& output) { bool good = true; if (ok()) { if (_bc == NULL) - { - _bc = new TBytecode; - if (_src.starts_with("MESSAGE ")) - good = rep.compile(translate_message(), *_bc); - else - good = rep.compile(_src, *_bc); - _bc->set_name(_desc); - } + good = compile(rep); if (good) good = rep.execute(*_bc, output); } diff --git a/ba/ba8302.h b/ba/ba8302.h index 7e6d48aff..e0e4fb9af 100755 --- a/ba/ba8302.h +++ b/ba/ba8302.h @@ -120,6 +120,7 @@ public: const TString& get() const { return _src; } void set_description(const char* d) { _desc = d; } + bool compile(TReport& report); bool execute(TReport& report, TString& output); bool execute(TReport_field& rf); diff --git a/ba/ba8303.cpp b/ba/ba8303.cpp index db0d88084..aa4ed9377 100755 --- a/ba/ba8303.cpp +++ b/ba/ba8303.cpp @@ -8,6 +8,8 @@ #include "ba8201.h" #include "ba8303.h" +static bool _print_aborted = false; + /////////////////////////////////////////////////////////// // TPrint_preview_window /////////////////////////////////////////////////////////// @@ -146,7 +148,10 @@ void TPrint_preview_window::handler(WINDOW win, EVENT* ep) default:processed = false; break; } if (processed) + { + _print_aborted = false; force_update(); + } } break; default: @@ -324,8 +329,6 @@ TPreview_mask::TPreview_mask(TPage_printer* printer) // TPage_printer /////////////////////////////////////////////////////////// -static bool _print_aborted = false; - const char* TPage_printer::form_name() const { return printer().get_form_name(); @@ -400,7 +403,8 @@ bool TPage_printer::main_loop() _page = 0; ok = print_loop(); } - + _print_aborted = false; + xvt_vobj_destroy(prwin); set_win(NULL_WIN); diff --git a/ba/ba8304.cpp b/ba/ba8304.cpp index 55c89ec0f..4f2bbf145 100755 --- a/ba/ba8304.cpp +++ b/ba/ba8304.cpp @@ -535,6 +535,18 @@ bool TAVM::compile(istream& instr, TBytecode& bytecode) if (str == ";") { return true; + } else + if (str == "(") + { + TString256 str; + instr.getline(str.get_buffer(), str.size(), ')'); + op = new TAVM_op(avm_nop); + } else + if (str == "\\") + { + TString256 str; + instr.getline(str.get_buffer(), str.size()); + op = new TAVM_op(avm_nop); } else {