From 673ebc8bca1b8bcb61400b3aca1c02f565e7cede Mon Sep 17 00:00:00 2001 From: Ianos Gnatiuc Date: Thu, 28 Sep 2006 18:08:30 +0000 Subject: [PATCH] Cashed last opened thread, that greatly increase tree opening speed, especially useful for READGotoThNextUnread. --- docs/notework.rus | 2 ++ docs/notework.txt | 3 ++ golded3/gemlst.cpp | 74 ++++++++++++++++++++++++++++++---------------- golded3/geread.cpp | 6 ++++ 4 files changed, 59 insertions(+), 26 deletions(-) diff --git a/docs/notework.rus b/docs/notework.rus index 2634aa8..f4ef1bb 100644 --- a/docs/notework.rus +++ b/docs/notework.rus @@ -10,6 +10,8 @@ _____________________________________________________________________________ Заметки для GoldED+ 1.1.5, /snapshot/ _____________________________________________________________________________ ++ Теперь кзшируется последний открытый трэд, что сильно повысило скорость + повторного его открытия. Особенно это заметно на READGotoThNextUnread. + Когда сообщение перемещается из корзины, то выбирается по умолчанию ария из клуджа AREA. - uudecoder: теперь будет игнорировано все после строки что начинается diff --git a/docs/notework.txt b/docs/notework.txt index 7784100..6c59dfe 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,9 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ ++ Cashed last opened thread, that greatly increase tree opening speed, + especially useful for READGotoThNextUnread. + + When moving from recyclebin, area from AREA: kludge is selected by default. - uudecoder: now are skipped all lines which follows line that starts diff --git a/golded3/gemlst.cpp b/golded3/gemlst.cpp index 4042104..1d0ff3c 100644 --- a/golded3/gemlst.cpp +++ b/golded3/gemlst.cpp @@ -732,6 +732,10 @@ private: std::vector list; std::vector tree; + dword m_OldMsgno; + uint m_OldTags; + std::string m_OldEchoId; + void BuildThreadIndex(dword msgno); void recursive_build(uint32_t msgn, uint32_t rn, uint32_t level, uint32_t index); void GenTree(int idx); @@ -1073,20 +1077,16 @@ void GThreadlist::BuildThreadIndex(dword msgn) { w_info(LNG->Wait); - index = maximum_index = position = maximum_position = 0; - - list.clear(); - tree.clear(); - AA->LoadHdr(&msg, msgn); uint32_t msgno = msg.link.to(); uint32_t prevmsgno = msgn; // Search backwards - while(AA->Msgn.ToReln(msgno)) { - - if(not AA->LoadHdr(&msg, msgno)) { + while(AA->Msgn.ToReln(msgno)) + { + if (not AA->LoadHdr(&msg, msgno)) + { msg.link.to_set(0); msgno = prevmsgno; AA->LoadHdr(&msg, msgno); @@ -1097,21 +1097,33 @@ void GThreadlist::BuildThreadIndex(dword msgn) msgno = msg.link.to(); } - recursive_build(msg.msgno, 0, 0, 0); + if ((m_OldMsgno != prevmsgno) || (m_OldTags != AA->Msgn.Tags()) || (m_OldEchoId != AA->echoid())) + { + m_OldMsgno = prevmsgno; + m_OldTags = AA->Msgn.Tags(); + m_OldEchoId = AA->echoid(); + + index = maximum_index = position = maximum_position = 0; + list.clear(); + tree.clear(); + + recursive_build(msg.msgno, 0, 0, 0); + + minimum_index = 0; + maximum_index = list.size() - 1; + maximum_position = MinV((uint) list.size() - 1, (uint) ylen - 1); + index = 0; + h_offset = 0; + new_hoffset = 0; + + for (uint i = 0; i < list.size(); i++) + { + if (list[i].msgno == msgn) + index = i; + } + } w_info(NULL); - - minimum_index = 0; - maximum_index = list.size() - 1; - maximum_position = MinV((uint) list.size() - 1, (uint) ylen - 1); - index = 0; - h_offset = 0; - new_hoffset = 0; - - for(uint i = 0; iset_lastread(AA->Msgn.ToReln(list[index].msgno)); + + ResetMsg(&msg); } @@ -1355,18 +1369,24 @@ bool GThreadlist::GoNextUnread(bool reader) } } + ResetMsg(&msg); return found; } // ------------------------------------------------------------------ -void MsgThreadlist() { +GThreadlist *g_ThreadList = 0; - GThreadlist p; - p.Run(); +// ------------------------------------------------------------------ +void MsgThreadlist() +{ + if (!g_ThreadList) + g_ThreadList = new GThreadlist; + + g_ThreadList->Run(); } @@ -1374,11 +1394,13 @@ void MsgThreadlist() { void GotoThNextUnread() { + if (!g_ThreadList) + g_ThreadList = new GThreadlist; + w_info(LNG->Wait); reader_direction = DIR_NEXT; - GThreadlist p; - if (!p.GoNextUnread(true)) + if (!g_ThreadList->GoNextUnread(true)) { SayBibi(); reader_keyok = true; diff --git a/golded3/geread.cpp b/golded3/geread.cpp index 151d2f8..8681a61 100644 --- a/golded3/geread.cpp +++ b/golded3/geread.cpp @@ -33,6 +33,9 @@ extern bool cmdlinenoscan; extern bool cmdlineexportsoup; +class GThreadlist; +extern GThreadlist *g_ThreadList; + GMsg* reader_msg; bool reader_gen_confirm = false; int reader_finished; @@ -1030,6 +1033,9 @@ void Reader() { } while(not reader_finished and not gkbd.quitall); + delete g_ThreadList; + g_ThreadList = 0; + HeaderView->Destroy(); BodyView->Destroy(); }