void EbookController::SetDoc(Doc newDoc, int startReparseIdxArg)
{
    CrashIf(!newDoc.IsEbook());
    startReparseIdx = startReparseIdxArg;
    if ((size_t)startReparseIdx >= newDoc.GetHtmlDataSize())
        startReparseIdx = -1;
    CloseCurrentDocument();
    doc = newDoc;
    TriggerBookFormatting();
}
EbookController::~EbookController()
{
    StopFormattingThread();
    EventMgr *evtMgr = ctrls->mainWnd->evtMgr;
    evtMgr->RemoveEventsForControl(ctrls->next);
    evtMgr->RemoveEventsForControl(ctrls->prev);
    evtMgr->RemoveEventsForControl(ctrls->progress);
    evtMgr->RemoveEventsForControl(ctrls->page);
    CloseCurrentDocument();
}
Exemplo n.º 3
0
EbookController::~EbookController()
{
    StopFormattingThread();
    EventMgr *evtMgr = ctrls->mainWnd->evtMgr;
    // we must manually disconnect all events becuase evtMgr is
    // destroyed after EbookController, and EbookController destructor
    // will disconnect slots without deleting them, causing leaks
    // TODO: this seems fragile
    evtMgr->DisconnectEvents(this);
    CloseCurrentDocument();
}
Exemplo n.º 4
0
EbookController::~EbookController()
{
    StopFormattingThread();
    EventMgr *evtMgr = ctrls->mainWnd->evtMgr;
    // we must manually disconnect all events becuase evtMgr is
    // destroyed after EbookController, and EbookController destructor
    // will disconnect slots without deleting them, causing leaks
    // TODO: this seems fragile
    EnableMessageHandling(false);
    CloseCurrentDocument();
    DestroyEbookControls(ctrls);
    delete pageAnchorIds;
    delete pageAnchorIdxs;
}
Exemplo n.º 5
0
void EbookController::SetDoc(Doc newDoc, int startReparseIdxArg, DisplayMode displayMode)
{
    CrashIf(!newDoc.IsDocLoaded());
    currPageReparseIdx = startReparseIdxArg;
    if ((size_t)currPageReparseIdx >= newDoc.GetHtmlDataSize())
        currPageReparseIdx = 0;
    CloseCurrentDocument();

    doc = newDoc;
    // displayMode could be any value if alternate UI was used, we have to limit it to
    // either DM_SINGLE_PAGE or DM_FACING
    if (DM_AUTOMATIC == displayMode)
        displayMode = gGlobalPrefs->defaultDisplayModeEnum;
    SetDisplayMode(displayMode);
    TriggerLayout();
    UpdateStatus();
}