diff --git a/ci/calend01.jpg b/ci/calend01.jpg new file mode 100755 index 000000000..15b92e1b3 Binary files /dev/null and b/ci/calend01.jpg differ diff --git a/ci/calend02.jpg b/ci/calend02.jpg new file mode 100755 index 000000000..acd27b95c Binary files /dev/null and b/ci/calend02.jpg differ diff --git a/ci/calend03.jpg b/ci/calend03.jpg new file mode 100755 index 000000000..50652a890 Binary files /dev/null and b/ci/calend03.jpg differ diff --git a/ci/calend04.jpg b/ci/calend04.jpg new file mode 100755 index 000000000..a12a2949b Binary files /dev/null and b/ci/calend04.jpg differ diff --git a/ci/calend05.jpg b/ci/calend05.jpg new file mode 100755 index 000000000..7af3e9659 Binary files /dev/null and b/ci/calend05.jpg differ diff --git a/ci/calend06.jpg b/ci/calend06.jpg new file mode 100755 index 000000000..ca7941c9c Binary files /dev/null and b/ci/calend06.jpg differ diff --git a/ci/calend07.jpg b/ci/calend07.jpg new file mode 100755 index 000000000..45a84c903 Binary files /dev/null and b/ci/calend07.jpg differ diff --git a/ci/calend08.jpg b/ci/calend08.jpg new file mode 100755 index 000000000..513de7bc9 Binary files /dev/null and b/ci/calend08.jpg differ diff --git a/ci/calend09.jpg b/ci/calend09.jpg new file mode 100755 index 000000000..437881ba5 Binary files /dev/null and b/ci/calend09.jpg differ diff --git a/ci/calend10.jpg b/ci/calend10.jpg new file mode 100755 index 000000000..b4465f5a9 Binary files /dev/null and b/ci/calend10.jpg differ diff --git a/ci/calend11.jpg b/ci/calend11.jpg new file mode 100755 index 000000000..5e816ad36 Binary files /dev/null and b/ci/calend11.jpg differ diff --git a/ci/calend12.jpg b/ci/calend12.jpg new file mode 100755 index 000000000..7d0624ee5 Binary files /dev/null and b/ci/calend12.jpg differ diff --git a/ci/ci0400.cpp b/ci/ci0400.cpp index 0f00de1a8..e6498c7d0 100755 --- a/ci/ci0400.cpp +++ b/ci/ci0400.cpp @@ -38,8 +38,8 @@ void TImmissioneDocumenti_app::init_tabs() m.activate_almanac(F_AL01 + items, items, TDate(TODAY)); items++; } - m.set_caption(pagenames); m.disable_page(items); + m.set_caption(pagenames); } void TImmissioneDocumenti_app::init_flags() diff --git a/ci/ci0400a.uml b/ci/ci0400a.uml index 3436071f9..00b9b7ea7 100755 --- a/ci/ci0400a.uml +++ b/ci/ci0400a.uml @@ -47,7 +47,7 @@ PAGE "Pagina 1" -1 -1 80 20 ALMANAC F_AL01 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -56,7 +56,7 @@ PAGE "Pagina 2" -1 -1 80 20 ALMANAC F_AL02 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -65,7 +65,7 @@ PAGE "Pagina 3" -1 -1 80 20 ALMANAC F_AL03 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -74,7 +74,7 @@ PAGE "Pagina 4" -1 -1 80 20 ALMANAC F_AL04 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -83,7 +83,7 @@ PAGE "Pagina 5" -1 -1 80 20 ALMANAC F_AL05 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -92,7 +92,7 @@ PAGE "Pagina 6" -1 -1 80 20 ALMANAC F_AL06 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -101,7 +101,7 @@ PAGE "Pagina 7" -1 -1 80 20 ALMANAC F_AL07 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -110,7 +110,7 @@ PAGE "Pagina 8" -1 -1 80 20 ALMANAC F_AL08 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -119,7 +119,7 @@ PAGE "Pagina 9" -1 -1 80 20 ALMANAC F_AL09 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -128,7 +128,7 @@ PAGE "Pagina 10" -1 -1 80 20 ALMANAC F_AL10 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -137,7 +137,7 @@ PAGE "Pagina 11" -1 -1 80 20 ALMANAC F_AL11 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -146,7 +146,7 @@ PAGE "Pagina 12" -1 -1 80 20 ALMANAC F_AL12 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -155,7 +155,7 @@ PAGE "Pagina 13" -1 -1 80 20 ALMANAC F_AL13 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -164,7 +164,7 @@ PAGE "Pagina 14" -1 -1 80 20 ALMANAC F_AL14 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -173,7 +173,7 @@ PAGE "Pagina 15" -1 -1 80 20 ALMANAC F_AL15 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE @@ -182,7 +182,7 @@ PAGE "Pagina 16" -1 -1 80 20 ALMANAC F_AL16 76 16 BEGIN - PROMPT 1 1 "" + PROMPT -3 1 "" END ENDPAGE diff --git a/ci/cilib.cpp b/ci/cilib.cpp index 0ebaca491..de85be272 100755 --- a/ci/cilib.cpp +++ b/ci/cilib.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -10,7 +11,6 @@ #include "cilib.h" #include "cimsk.h" - /////////////////////////////////////////////////////////// // TAlmanac_mask /////////////////////////////////////////////////////////// @@ -99,17 +99,17 @@ void TAlmanac_mask::set_year(int newyear) for(byte p = 0; p <= _lastpage; p++) almanac(p).set_selected_year(newyear); change_year(newyear); - } +} - void TAlmanac_mask::change_year(int newyear) - { - return; - } +void TAlmanac_mask::change_year(int newyear) +{ + return; +} - bool TAlmanac_mask::is_date_void(int currpage, TDate& cdate) - { - return TRUE; - } +bool TAlmanac_mask::is_date_void(int currpage, TDate& cdate) +{ + return TRUE; +} TAlmanac_mask::TAlmanac_mask(const char * name) : TAutomask(), _lastpage(0) @@ -125,7 +125,20 @@ void TAlmanac_mask::set_year(int newyear) TField_window* TAlmanac_field::create_window(int x, int y, int dx, int dy, WINDOW parent) { - return new TAlmanac_window(x, y, dx, dy, parent, this); + TAlmanac_window * obj = new TAlmanac_window(x, y, dx, dy, parent, this); + RCT rct; xvt_vobj_get_outer_rect(obj->win(), &rct); + const int pad = 6; + + if (rct.left > pad * 4) + { + _image = new TImage_window(-1, y, -1, dy, parent, this); + RCT img_rect; xvt_vobj_get_outer_rect(_image->win(), &img_rect); + img_rect.right = rct.left - pad ; + img_rect.left = pad; + xvt_vobj_move(_image->win(), (RCT*)&img_rect); + } + + return obj; } bool TAlmanac_field::is_date_void(int currpage, TDate& cdate) @@ -133,6 +146,12 @@ bool TAlmanac_field::is_date_void(int currpage, TDate& cdate) return ((TAlmanac_mask &)mask()).is_date_void(currpage, cdate); } +void TAlmanac_field::force_update(bool update_image) +{ + win().force_update(); + if (update_image && _image != NULL) + _image->force_update(); +} void TAlmanac_field::set_selected_day(int nday) { if(nday>=1 && nday<=TDate::last_day(_selecteddate.month(),_selecteddate.year())) @@ -140,14 +159,15 @@ void TAlmanac_field::set_selected_day(int nday) TAlmanac_mask& m = (TAlmanac_mask&)mask(); _selecteddate.set_day(nday); - win().force_update(); + force_update(); } } void TAlmanac_field::move_selected_day(int ddays) { + const int old_month = _selecteddate.month(); _selecteddate+=ddays; - win().force_update(); + force_update(old_month != _selecteddate.month()); } void TAlmanac_field::set_selected_month(int nmonth) @@ -155,20 +175,20 @@ void TAlmanac_field::set_selected_month(int nmonth) if(nmonth >= 1 && nmonth <= 12) { _selecteddate.set_month(nmonth); - win().force_update(); + force_update(true); } } void TAlmanac_field::move_selected_month(int dmonths) { _selecteddate.addmonth(dmonths); - win().force_update(); + force_update(true); } void TAlmanac_field::set_selected_year(int nyear) { _selecteddate.set_year(nyear); - win().force_update(); + force_update(true); } /////////////////////////////////////////////////////////// @@ -177,7 +197,6 @@ void TAlmanac_field::set_selected_year(int nyear) void TAlmanac_window::update() { - TDate cdate; COLOR col_f, col_b; RCT rct; xvt_vobj_get_client_rect(win(), &rct); RCT rcttd; @@ -191,8 +210,9 @@ void TAlmanac_window::update() TAlmanac_field & o = (TAlmanac_field&)owner(); TField_window::update(); - cdate = o.selected_date(); + TDate cdate = o.selected_date(); cdate.set_day(1); + cpage = o.mask().curr_page(); rct_w = ((rct.right - rct.left) / 9); @@ -345,9 +365,56 @@ void TAlmanac_window::handler(WINDOW win, EVENT* ep) } TAlmanac_window::TAlmanac_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field *owner) - : TField_window(x, y, dx, dy, parent, owner) +: TField_window(x, y, dx, dy, parent, owner) { xvt_sbar_set_range(win(), HSCROLL, 0, 0); xvt_sbar_set_range(win(), VSCROLL, 0, 0); } +/////////////////////////////////////////////////////////// +// TImage_window +/////////////////////////////////////////////////////////// + +void TImage_window::update() +{ + RCT rct; xvt_vobj_get_client_rect(win(), &rct); + TAlmanac_field & f = (TAlmanac_field&) owner(); + const int month = f.selected_date().month(); + + _curr_month = month; + clear(MASK_BACK_COLOR); + + TFilename month_img; month_img.format("calend%02d.jpg", _curr_month); + + if (month_img.custom_path()) + { + TImage bmp(month_img); + const double ratiox = (double) (rct.right) / (double) bmp.width(); + const double ratioy = (double) (rct.bottom) / (double) bmp.height(); + + if (ratiox < ratioy) + { + int h = int(bmp.height() * ratiox); + + rct.top = (rct.bottom - h) / 2; + rct.bottom = rct.top + h; + } + else + { + int w = int(bmp.width() * ratioy); + + rct.left = (rct.right - w) / 2; + rct.right = rct.left + w; + } + + bmp.draw(win(), rct); + } +} + +TImage_window::TImage_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field *owner) + : TField_window(x, y, dx, dy, parent, owner), _curr_month(0) + +{ + xvt_sbar_set_range(win(), HSCROLL, 0, 0); + xvt_sbar_set_range(win(), VSCROLL, 0, 0); +} \ No newline at end of file diff --git a/ci/cilib.h b/ci/cilib.h index adf34da3c..d79424ff5 100755 --- a/ci/cilib.h +++ b/ci/cilib.h @@ -9,6 +9,33 @@ #include "../db/dblib.h" #endif +/////////////////////////////////////////////////////////// +// TImage_window +/////////////////////////////////////////////////////////// + +// @doc EXTERNAL + +// @class TAlmanac_window | Finestra associata ad un TAlmanac_field +// +// @base public | TField_window +class TImage_window : public TField_window +{ + // @author:(INTERNAL) Brugno + int _curr_month; + + // @access Protected Member +protected: + // override da TField_window + virtual void update(); + + // @access Public Member +public: + // @cmember Costruttore + TImage_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field *owner); + // @cmember Distruttore + virtual ~TImage_window() {} +}; + /////////////////////////////////////////////////////////// // TAlmanac_field /////////////////////////////////////////////////////////// @@ -32,11 +59,13 @@ class TAlmanac_field : public TWindowed_field // @cmember:(INTERNAL) Variabile interna: Data correntemente selezionato nel calendario TDate _selecteddate; TDate _dateinsert; + TImage_window * _image; // @access Protected Member protected: // override da TWindowed_field virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent); + void force_update(bool update_image = false); // @access Public Member public: @@ -85,7 +114,7 @@ public: // @access Public Member public: // @cmember Costruttore - TAlmanac_field(TMask* m) : TWindowed_field(m),_showmonthname(true), _selecteddate(TODAY), _dateinsert(botime), _padding(2) { } + TAlmanac_field(TMask* m) : TWindowed_field(m),_showmonthname(true), _selecteddate(TODAY), _dateinsert(botime), _padding(2), _image(NULL) {} // @cmember Distruttore virtual ~TAlmanac_field() { } }; @@ -120,7 +149,7 @@ public: // @cmember Costruttore TAlmanac_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field *owner); // @cmember Distruttore - virtual ~TAlmanac_window() { set_scroll_max(0,0); _pixmap=0; } + virtual ~TAlmanac_window() {} }; /////////////////////////////////////////////////////////// @@ -145,7 +174,7 @@ class TAlmanac_mask : public TAutomask protected: // override da TAutomask virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); - + // @access Public Member public: // shortcut per l'accesso all'almanacco della pagina corrente