EbookController::EbookController(EbookControls *ctrls, ControllerCallback *cb) : Controller(cb), ctrls(ctrls), pages(nullptr), incomingPages(nullptr), currPageNo(0), pageSize(0, 0), formattingThread(nullptr), formattingThreadNo(-1), currPageReparseIdx(0), handleMsgs(true), pageAnchorIds(nullptr), pageAnchorIdxs(nullptr), navHistoryIx(0) { EventMgr *em = ctrls->mainWnd->evtMgr; // TODO: do I need lambada here, can I just pass EbookController::ClickedNext directly? em->EventsForName("next")->Clicked = [=](Control *c, int x, int y) { this->ClickedNext(c, x, y); }; em->EventsForName("prev")->Clicked = [=](Control *c, int x, int y) { this->ClickedPrev(c, x, y); }; em->EventsForControl(ctrls->progress)->Clicked = [=](Control *c, int x, int y) { this->ClickedProgress(c, x, y); }; PageControl *page1 = ctrls->pagesLayout->GetPage1(); PageControl *page2 = ctrls->pagesLayout->GetPage2(); em->EventsForControl(page1)->SizeChanged = [=](Control *c, int dx, int dy) { this->SizeChangedPage(c, dx, dy); }; em->EventsForControl(page2)->SizeChanged = [=](Control *c, int dx, int dy) { this->SizeChangedPage(c, dx, dy); }; em->EventsForControl(page1)->Clicked = [=](Control *c, int x, int y) { this->ClickedPage1(c, x, y); }; em->EventsForControl(page2)->Clicked = [=](Control *c, int x, int y) { this->ClickedPage2(c, x, y); }; }
EbookController::EbookController(EbookControls *ctrls) : ctrls(ctrls), fileBeingLoaded(NULL), pagesFromBeginning(NULL), pagesFromPage(NULL), currPageNo(0), pageShown(NULL), deletePageShown(false), pageSize(0, 0), formattingThread(NULL), formattingThreadNo(-1), startReparseIdx(-1) { EventMgr *em = ctrls->mainWnd->evtMgr; em->EventsForName("next")->Clicked.connect(this, &EbookController::ClickedNext); em->EventsForName("prev")->Clicked.connect(this, &EbookController::ClickedPrev); em->EventsForControl(ctrls->progress)->Clicked.connect(this, &EbookController::ClickedProgress); em->EventsForControl(ctrls->page)->SizeChanged.connect(this, &EbookController::SizeChangedPage); UpdateStatus(); }
EbookController::EbookController(EbookControls *ctrls) : ctrls(ctrls), fileBeingLoaded(NULL), pagesFromBeginning(NULL), pagesFromPage(NULL), currPageNo(0), pageShown(NULL), deletePageShown(false), pageSize(0, 0), formattingThread(NULL), formattingThreadNo(-1), startReparseIdx(-1) { EventMgr *em = ctrls->mainWnd->evtMgr; em->EventsForName("next")->Clicked.connect(this, &EbookController::ClickedNext); em->EventsForName("prev")->Clicked.connect(this, &EbookController::ClickedPrev); em->EventsForControl(ctrls->progress)->Clicked.connect(this, &EbookController::ClickedProgress); PageControl *page1 = ctrls->pagesLayout->GetPage1(); em->EventsForControl(page1)->SizeChanged.connect(this, &EbookController::SizeChangedPage); PageControl *page2 = ctrls->pagesLayout->GetPage2(); em->EventsForControl(page2)->SizeChanged.connect(this, &EbookController::SizeChangedPage); SetSinglePage(); // TODO: for now we force single page mode UpdateStatus(); }