BOOL CPearlImageApp::InitInstance() { INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); __super::InitInstance(); EnableTaskbarInteraction(FALSE); // Change the registry key under which our settings are stored. SetRegistryKey(_T("JGMData")); LoadStdProfileSettings(16); // Load standard INI file options (including MRU) CSingleDocTemplate *pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CPearlImageDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CPearlImageView)); AddDocTemplate(pDocTemplate); CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); if(!ProcessShellCommand(cmdInfo)) { return FALSE; } TCHAR **argv = __targv; argv++; if(*argv) { getMainFrame()->loadFile(*argv); } m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; }
void CHexViewView::OnDropFiles(HDROP hDropInfo) { if(!getMainFrame()->checkSave()) { return; } TCHAR fname[256]; DragQueryFile(hDropInfo, 0, fname, ARRAYSIZE(fname)); getMainFrame()->newFile(fname, true); theApp.addToRecentFileList(fname); CView::OnDropFiles(hDropInfo); }
void CHexViewView::OnInitialUpdate() { DragAcceptFiles(); CHexViewDoc *doc = GetDocument(); CMainFrame *mainFrame = getMainFrame(); mainFrame->ajourMenuItems(); CView::OnInitialUpdate(); }
void CTTToeView::OnLButtonDown(UINT nFlags, CPoint point) { Action act = menu->lButtonPressed(point); if(!aiThinking){ if(act.status & Menu::POINT_INSIDE){ if(act.valueReturned){ processMenuAction(act.value); } } Point pt = field->lButtonPressed(point); // Queueing the ai move if(pt.getIsValid()){ lastMove = pt; field->makeMove(lastMove, BaseCell::MODE_PLAYER, true); getMainFrame()->setMoveNum(field->getMovesMade()); moveQueued = true; } } CView::OnLButtonDown(nFlags, point); }
void ReaderListener::handleNotification(Dispatcher<std::vector<DatabaseColumn *> *> *oSource, std::vector<DatabaseColumn *> *oColumns) { UNUSED(oSource); std::vector<DatabaseColumn *> ql; if(oColumns == NULL) oColumns = &ql; getMainFrame()->setSourceColumns(*oColumns); }
void CHexViewView::OnDraw(CDC* pDC) { CFont *oldFont = m_workDC.SelectObject(&m_font); m_workDC.FillSolidRect(0, 0, m_workRect.Width(), m_workRect.Height(), m_settings->getDataBackColor()); draw(&m_workDC); pDC->BitBlt(0, 0, m_workRect.Width(), m_workRect.Height(), &m_workDC, 0, 0, SRCCOPY); m_workDC.SelectObject(oldFont); CMainFrame *mainFrame = getMainFrame(); mainFrame->updateTitle(); mainFrame->ajourMenuItems(); }
void TextFrame::UpdateBookmarkPanel() { MainFrame* frame = getMainFrame(); if(frame) { BookmarkPanel* panel = frame->getBookmarkPanel(); if(panel) { panel->update(); } } }
void CTTToeView::OnDraw(CDC* pDC) { if(Graphics::cdc == nullptr){ Graphics::cdc = new CClientDC(this); } CRect CWRect; GetClientRect(CWRect); if(!isViewInitialized){ (AfxGetMainWnd( ))->SetWindowText(L"TTToe 3"); SetTimer(TMR_MENU_ID, TMR_MENU_FREQUENCY, NULL); SetTimer(TMR_FIELD_ID, TMR_FIELD_FREQUENCY, NULL); SetTimer(TMR_MAIN_ID, TMR_MAIN_FREQUENCY, NULL); SetTimer(TMR_WINNING_COMB_ID, TMR_WINNING_COMB_FREQUENCY, NULL); SetTimer(TMR_STATUS_BAR_ID, TMR_STATUS_BAR_FREQUENCY, NULL); initializeMenu(CWRect); prevRect = CWRect; getMainFrame()->setStPlayersMove(); getMainFrame()->resetAIPerc(); getMainFrame()->setPlayerScr(0); getMainFrame()->setDrawScr(0); getMainFrame()->setAIScr(0); getMainFrame()->setMoveNum(0); isViewInitialized = true; } else{ if(CWRect != prevRect){ prevRect = CWRect; menu->setOpenedUpperLeft(Point(CWRect.right - GlobalSettings::menuWidth, 0)); menu->setClosedUpperLeft(Point(CWRect.right - 20, 0)); menu->setHeight(CWRect.Height()); menu->recalculate(); } } Graphics::createMemDc(&CWRect); CPen *background = new CPen(0,1,GlobalSettings::backgroundClr.getRGB()); CBrush *backgroundBr = new CBrush(GlobalSettings::backgroundClr.getRGB()); Graphics::drawRectangle(nullptr, CWRect.left, CWRect.top, CWRect.right, CWRect.bottom, backgroundBr, background, true, true, true); menu->display(); //Graphics::deleteMemDc(); //Graphics::createMemDc(&CWRect); fitFieldInClientArea(); applySettingsAndRerender(settings); //field->display(false, false, true, true); Graphics::deleteMemDc(); delete background; delete backgroundBr; }
void AutoscrollController::autoscrollTimerFired(Timer<AutoscrollController>&) { if (!m_autoscrollRenderer) { stopAutoscrollTimer(); return; } Frame& frame = m_autoscrollRenderer->frame(); switch (m_autoscrollType) { case AutoscrollForDragAndDrop: if (WTF::currentTime() - m_dragAndDropAutoscrollStartTime > autoscrollDelay) m_autoscrollRenderer->autoscroll(m_dragAndDropAutoscrollReferencePosition); break; case AutoscrollForSelection: { if (!frame.eventHandler().mousePressed()) { stopAutoscrollTimer(); return; } #if ENABLE(DRAG_SUPPORT) frame.eventHandler().updateSelectionForMouseDrag(); #endif m_autoscrollRenderer->autoscroll(frame.eventHandler().lastKnownMousePosition()); break; } case NoAutoscroll: break; #if ENABLE(PAN_SCROLLING) case AutoscrollForPanCanStop: case AutoscrollForPan: // we verify that the main frame hasn't received the order to stop the panScroll if (Frame* mainFrame = getMainFrame(&frame)) { if (!mainFrame->eventHandler().panScrollInProgress()) { stopAutoscrollTimer(); return; } } if (FrameView* view = frame.view()) updatePanScrollState(view, frame.eventHandler().lastKnownMousePosition()); m_autoscrollRenderer->panScroll(m_panScrollStartPos); break; #endif } }
void CShowGrafView::lbuttonUpMarkInterval(UINT nFlags, const CPoint &point) { CClientDC(GetDlgItem(IDC_SYSTEMPANEL)).DrawDragRect(&m_dragRect, CSize(1,1), NULL, CSize(1,1)); m_dragging = false; ClipCursor(NULL); getMainFrame()->PostMessage(ID_MSG_SEARCHINTERVAL, m_dragRect.left,m_dragRect.right); }
void CTTToeView::OnTimer(UINT nFlags) { if(nFlags == TMR_FIELD_ID){ field->updateCells(); } else if (nFlags == TMR_MENU_ID){ menu->timerTicked(); menu->displayUpdated(); } else if(nFlags == TMR_MAIN_ID){ if(gameStatus != -2){ if(moveQueued){ moveMade = false; aiThinking = true; aiThread = AfxBeginThread(makeAIMove, &vicCombStartEnd); moveQueued = false; } if(moveMade){ getMainFrame()->setStPlayersMove(); getMainFrame()->resetAIPerc(); getMainFrame()->setMoveNum(field->getMovesMade()); moveMade = false; aiThinking = false; if(gameStatus != -1){ if(aiMove.getIsValid()){ field->aIPlayed(aiMove); } vicAnimFirstTime = true; OnMouseMove(0,CPoint(0,0)); bool prevValue = settings.showtrack; settings.showtrack = true; if(gameStatus == RateField::ST_AI_WON){ gameStatus = -2; getMainFrame()->setAIScr(++aiVictoryNumber); MessageBox(L"Sorry, you have lost..."); } else if(gameStatus == RateField::ST_PLAYER_WON){ gameStatus = -2; getMainFrame()->setPlayerScr(++playerVicNumber); MessageBox(L"Congratulations, you have won!"); } else{ gameStatus = -1; getMainFrame()->setDrawScr(++drawNumber); MessageBox(L"Draw!"); } settings.showtrack = prevValue; gameStatus = -1; field->resetCellModes(); getMainFrame()->setMoveNum(field->getMovesMade()); field->display(false,false,false,false); } else{ lastMove = aiMove; field->aIPlayed(lastMove); } } } } else if(nFlags == TMR_MENU_ACT_SEQ_ID){ processMenuActions(); KillTimer(TMR_MENU_ACT_SEQ_ID); } else if(nFlags == TMR_WINNING_COMB_ID){ if(gameStatus == -2){ animateWinningCombination(); } } else if(nFlags == TMR_STATUS_BAR_ID){ if(aiThinking){ getMainFrame()->updateStAIThinking(); getMainFrame()->setAIPerc(field->getAIPercent()); } } else if(nFlags == TMR_TEST_ID){ if(cnt == 0){ } else{ testProperty = false; char* a = new char[20]; _itoa(cnt, a, 10); cnt = 0; CString str(a); MessageBox(str); } } CView::OnTimer(nFlags); }