static void synopsis_toc_selected(char *pos) { long long position = 0; TSynopsisItem::PositionToLong(pos, &position); cpos = position; PBSynopsisItem *cur = SynTOC.GetCurrent(); if (cur != NULL && cur->GetType() == SYNOPSIS_PEN) { PBSynopsisPen *pen = (PBSynopsisPen *)cur; ChangeSettings(SynTOC.GetSettings()->GetFB2Settings(pen->GetSettingsId())); } int p = position_to_page(cpos); if (is_footnote_mode()) { ((FBReader *)mainApplication)->showBookTextView(); } // if (is_footnote_mode() || p >= npages) { if (p >= npages) { set_position(cpos); // mainApplication->doAction(ActionCode::PAGE_SCROLL_FORWARD); mainApplication->refreshWindow(); } else { cpos = page_to_position(p); set_position(cpos); mainApplication->refreshWindow(); } calc_position_changed = 1; SetEventHandler(PBMainFrame::main_handler); repaint_all(0); FlushMarker(cur); }
void PrepareActiveContent(int opentoc) { if (m_TOC.GetHeader() == NULL) { bookinfo *bi; bi = GetBookInfo(FileName); if (bi != NULL) { m_TOC.SetHeaderName((char *)bi->title); if (strrchr(FileName, '/') != NULL) { m_TOC.SetFileName(strrchr(FileName, '/') + 1); } else { m_TOC.SetFileName(FileName); } // m_TOC.SetFileName((char *)bi->filename); m_TOC.SetFilePath((char *)FileName); #ifdef SYNOPSISV2 m_TOC.SetVersion(2); #endif m_TOC.SetReaderName("P"); m_TOC.LoadTOC(); } } if (m_TOC.GetHeader() == NULL) { int i; if (toclen == 0) { if (opentoc == 1) Message(ICON_INFORMATION, "PDF Viewer", "@No_contents", 2000); } for (i=0; i<toclen; i++) { Content = new SynopsisContent(TOC[i].level, (long long)position_to_page(TOC[i].position) << 40, TOC[i].text); m_TOC.AddTOCItem(Content); } } }
// Pen int SynopsisPen::GetPage() { return calc_in_progress ? -1 : position_to_page(this->GetLongPosition()); }