From 552a628ca359ac44af9ddd61a3e68ff3125d65ae Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 4 Nov 2009 12:04:45 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : ba0 ba7 Ricompilazione Demo : [ ] Commento : 0001493: Gestione programmi aperti Descrizione Se ho aperto 2 o + programmi non riesco poiu a passare da uno all'atro cliccando in basso mi fa stare solo sull'ultimo e non posso entrare neglia altri aperti finche non chiudo quelli successivi git-svn-id: svn://10.65.10.50/trunk@19568 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0103.cpp | 28 +++++++++++++++++++++------- ba/ba7100.cpp | 30 ++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/ba/ba0103.cpp b/ba/ba0103.cpp index cd0043ed1..6d92f3625 100755 --- a/ba/ba0103.cpp +++ b/ba/ba0103.cpp @@ -29,6 +29,7 @@ protected: public: const TString& app_name() const { return _appname; } + TApp_window(TBook_window* owner, const char* appname); ~TApp_window(); }; @@ -47,6 +48,7 @@ protected: public: WINDOW notebook() const { return _ctrl; } short pages() const; + short curr_page() const; WINDOW page_win(short pg); short add_page(const TMenuitem& mi); void set_page_caption(short page, const TString& caption, int icon); @@ -94,7 +96,7 @@ long TApp_window::handler(WINDOW win, EVENT* ep) TApp_window::TApp_window(TBook_window* owner, const char* appname) : _owner(owner), _appname(appname) { WINDOW w = create(0, 0, -1, -1, __MAGIC_CAPTION__, WSF_NONE, W_PLAIN, owner->notebook()); - xvt_timer_create(w, 1000); // Ogni tanto controllo se l'applicazione e' ancora viva + xvt_timer_create(w, 1000); // Ogni tanto controllo che l'applicazione sia ancora viva } TApp_window::~TApp_window() @@ -128,6 +130,11 @@ short TBook_window::pages() const return _ctrl == NULL_WIN ? 0 : xvt_notebk_get_num_tabs(_ctrl); } +short TBook_window::curr_page() const +{ + return _ctrl == NULL_WIN ? 0 : xvt_notebk_get_front_page(_ctrl); +} + static BOOLEAN hell_riser(WINDOW child, long data) { if (data > 0) @@ -138,10 +145,12 @@ static BOOLEAN hell_riser(WINDOW child, long data) void TBook_window::force_page(short page) { - xvt_notebk_set_front_page(_ctrl, page); - - WINDOW w = xvt_notebk_get_page(_ctrl, page); - xvt_win_enum_wins(w, hell_riser, 0, 0); + if (page < pages()) // Implies _ctrl != NULL_WIN too + { + xvt_notebk_set_front_page(_ctrl, page); + WINDOW w = xvt_notebk_get_page(_ctrl, page); + xvt_win_enum_wins(w, hell_riser, 0, 0); + } } long TBook_window::handler(WINDOW win, EVENT* ep) @@ -153,9 +162,10 @@ long TBook_window::handler(WINDOW win, EVENT* ep) draw_spider(win, 0x3, ep->v.mouse.where); break; case E_CONTROL: - if (ep->type == WC_NOTEBK && ep->v.ctl.ci.win == _ctrl) + if (ep->v.ctl.ci.type == WC_NOTEBK && ep->v.ctl.ci.win == _ctrl) { - force_page(ep->v.ctl.ci.v.notebk.page_new); + if (ep->v.ctl.ci.v.notebk.page != NULL_WIN) // != NULL_WIN means page CHANGED, non changing! + force_page(ep->v.ctl.ci.v.notebk.page_new); return 0L; } break; @@ -173,7 +183,11 @@ WINDOW TBook_window::page_win(short pg) { WINDOW win = NULL_WIN; if (_ctrl != NULL_WIN) + { + if (pg < 0) + pg = xvt_notebk_get_front_page(_ctrl); win = xvt_notebk_get_page(_ctrl, pg); + } return win; } diff --git a/ba/ba7100.cpp b/ba/ba7100.cpp index 2f338ae03..2b1c9b228 100755 --- a/ba/ba7100.cpp +++ b/ba/ba7100.cpp @@ -1018,12 +1018,38 @@ bool TMailer_mask::save_sheet_line(int& err, int nrow) } TString subj = m.get(F_SUBJECT); + TIsam_handle logic = LF_TAB; if (isalpha(subj[0])) // Controlla se la tabella in realtà è comune ed aggiunge il simbolino % { TString8 para; para << '[' << LF_TABCOM << ']'; if (msg.find(para) > 0) subj.insert("%"); + } + else + { + logic = atoi(subj); + if (logic == LF_TAB || logic == LF_TABCOM) + { + TString8 para; para << '[' << logic << ']'; + int pos = msg.find(para); + if (pos > 0) + { + pos = msg.find("\nCOD", pos+3); + if (pos > 0) + { + TToken_string line(msg.mid(pos, 10), '='); + line.strip_spaces(); + if (line.items() == 2) + { + subj = line.get(1); + if (logic == LF_TABCOM) + subj.insert("%"); + } + } + } + } } + TFilename appname; if (!file2app(subj, appname)) // It hasn't a valid application { @@ -1116,8 +1142,8 @@ bool TMailer_mask::build_key1(int lf, const TString& body, TToken_string& key, T } const int act = body.find("\nAction"); - const int ugu = body.find('=', act); - const int nwl = body.find('\n', ugu); + const int ugu = act > 0 ? body.find('=', act) : -1; + const int nwl = ugu > 0 ? body.find('\n', ugu) : -1; if (act > 0 && ugu > act && ugu < nwl) { action = body.sub(ugu+1,nwl);