コード例 #1
0
ファイル: chatlog.cpp プロジェクト: BiTOk/qTox
void ChatLog::checkVisibility()
{
    if (lines.empty())
        return;

    // find first visible line
    auto lowerBound = std::lower_bound(lines.cbegin(), lines.cend(), getVisibleRect().top(), ChatLine::lessThanBSRectBottom);

    // find last visible line
    auto upperBound = std::lower_bound(lowerBound, lines.cend(), getVisibleRect().bottom(), ChatLine::lessThanBSRectTop);

    // set visibilty
    QList<ChatLine::Ptr> newVisibleLines;
    for (auto itr = lowerBound; itr != upperBound; ++itr)
    {
        newVisibleLines.append(*itr);

        if (!visibleLines.contains(*itr))
            (*itr)->visibilityChanged(true);

        visibleLines.removeOne(*itr);
    }

    // these lines are no longer visible
    for (ChatLine::Ptr line : visibleLines)
        line->visibilityChanged(false);

    visibleLines = newVisibleLines;

    // enforce order
    std::sort(visibleLines.begin(), visibleLines.end(), ChatLine::lessThanRowIndex);

    //if (!visibleLines.empty())
    //  qDebug() << "visible from " << visibleLines.first()->getRow() << "to " << visibleLines.last()->getRow() << " total " << visibleLines.size();
}
コード例 #2
0
ファイル: AppDelegate.cpp プロジェクト: wl3780/Cocos
bool AppDelegate::applicationDidFinishLaunching() {
	// initialize director
	auto director = Director::getInstance();
	auto glview = director->getOpenGLView();
	if (!glview) {
		glview = GLViewImpl::createWithRect("CocosWeb", Rect(0, 0, 6400, 9600));
		director->setOpenGLView(glview);
	}
#if ISTEST 
	director->getOpenGLView()->setFrameSize(320, 480);
#else
	director->getOpenGLView()->setFrameSize(glview->getVisibleRect().size.width, glview->getVisibleRect().size.height);
#endif
	director->getOpenGLView()->setDesignResolutionSize(640, 960, ResolutionPolicy::SHOW_ALL);

	// turn on display FPS
	director->setDisplayStats(true);

	// set FPS. the default value is 1.0/60 if you don't call this
	director->setAnimationInterval(1.0 / 30);


	LuaEngine* pEngine = LuaEngine::getInstance();
	ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
	lua_State* L = pEngine->getLuaStack()->getLuaState();
	lua_module_register(L);
#if ISTEST
	AllocConsole();
	HWND _hwndConsole = GetConsoleWindow();
	if (_hwndConsole != NULL)
	{
		ShowWindow(_hwndConsole, SW_SHOW);
		BringWindowToTop(_hwndConsole);
		freopen("CONOUT$", "wt", stdout);
		freopen("CONOUT$", "wt", stderr);

		HMENU hmenu = GetSystemMenu(_hwndConsole, FALSE);
		if (hmenu != NULL)
		{
			DeleteMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
		}
	}
	pEngine->executeString("print=release_print");
	FileUtils::getInstance()->addSearchPath("../../Resources/res");
#else
	FileUtils::getInstance()->addSearchPath("res");
	FileUtils::getInstance()->addSearchPath("LuaScript");
	pEngine->getInstance()->addLuaLoader(decode_lua_loader);
#endif
	pEngine->executeScriptFile("main.lua");

	new GameInitiali();

	SceneManager::instance()->showScene("mainScene");
	return true;
}
コード例 #3
0
ファイル: chatlog.cpp プロジェクト: BiTOk/qTox
void ChatLog::updateBusyNotification()
{
    if (busyNotification.get())
    {
        //repoisition the busy notification (centered)
        busyNotification->layout(useableWidth(), getVisibleRect().topLeft() + QPointF(0, getVisibleRect().height()/2.0));
    }
}
コード例 #4
0
ファイル: XournalView.cpp プロジェクト: xournalpp/xournalpp
/**
 * Return the rectangle which is visible on screen, in document cooordinates
 *
 * Or NULL if the page is not visible
 */
Rectangle* XournalView::getVisibleRect(size_t page)
{
	XOJ_CHECK_TYPE(XournalView);

	if (page == size_t_npos || page >= this->viewPagesLen)
	{
		return NULL;
	}
	XojPageView* p = this->viewPages[page];

	return getVisibleRect(p);
}
コード例 #5
0
ファイル: XournalView.cpp プロジェクト: xournalpp/xournalpp
void XournalView::getPasteTarget(double& x, double& y)
{
	XOJ_CHECK_TYPE(XournalView);

	size_t pageNo = getCurrentPage();
	if (pageNo == size_t_npos)
	{
		return;
	}

	Rectangle* rect = getVisibleRect(pageNo);

	if (rect)
	{
		x = rect->x + rect->width / 2;
		y = rect->y + rect->height / 2;
		delete rect;
	}
}
コード例 #6
0
ファイル: XournalView.cpp プロジェクト: xournalpp/xournalpp
bool XournalView::isPageVisible(size_t page, int* visibleHeight)
{
	XOJ_CHECK_TYPE(XournalView);

	Rectangle* rect = getVisibleRect(page);
	if (rect)
	{
		if (visibleHeight)
		{
			*visibleHeight = rect->height;
		}

		delete rect;
		return true;
	}
	if (visibleHeight)
	{
		*visibleHeight = 0;
	}

	return false;
}
コード例 #7
0
ファイル: GroupBox.cpp プロジェクト: dicalexon/lic-ui
		void CGroupBox::NotifyOnPaint(APP_RECT clip)
		{
			clip *= getVisibleRect();
			if (!clip.IsEmpty())
			{
				APP_RECT rect = ClientToForm(getRect()), rect_caption = CalculateCaptionRect();
				APP_POINT size = getFont()->getStringSize(m_sCaption);
				math::RECTANGLE<size_t> radius{ m_iBorderRadius, m_iBorderRadius, m_iBorderRadius, m_iBorderRadius };
				if (m_sBackgroundColor.getAlpha() > 0)
					m_pForm->getPresenter()->FillRect(m_sBackgroundColor, clip, rect, rect, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, graphics::bplInside, nullptr, nullptr, true);
				if (m_iBorderOuterWidth > 0 && m_sBorderOuterColor.getAlpha() > 0)
				{
					math::RECTANGLE<size_t> border{ m_iBorderOuterWidth, m_iBorderOuterWidth, m_iBorderOuterWidth, m_iBorderOuterWidth };
					APP_RECT block = rect;
					block.Top += size.Y / 2 - (int)m_iBorderOuterWidth;
					if (rect_caption.IsEmpty())
					{
						m_pForm->getPresenter()->RenderBorder(graphics::bplTop, m_sBorderOuterColor, clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
					}
					else
					{
						APP_RECT new_clip = clip;
						new_clip.Right = std::max(new_clip.Left, rect_caption.Left);
						m_pForm->getPresenter()->RenderBorder(graphics::bplTop, m_sBorderOuterColor, new_clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
						new_clip = clip;
						new_clip.Left = std::min(new_clip.Right, rect_caption.Right);
						m_pForm->getPresenter()->RenderBorder(graphics::bplTop, m_sBorderOuterColor, new_clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
					}
					m_pForm->getPresenter()->RenderBorder(graphics::bplLeft, m_sBorderOuterColor, clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
					m_pForm->getPresenter()->RenderBorder(graphics::bplRight, m_sBorderOuterColor, clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
					m_pForm->getPresenter()->RenderBorder(graphics::bplBottom, m_sBorderOuterColor, clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
				}
				if (m_iBorderInnerWidth > 0 && m_sBorderInnerColor.getAlpha() > 0)
				{
					math::RECTANGLE<size_t> border{ m_iBorderInnerWidth, m_iBorderInnerWidth, m_iBorderInnerWidth, m_iBorderInnerWidth };
					APP_RECT block = rect;
					block.Top += size.Y / 2;
					block.Left += m_iBorderOuterWidth;
					block.Right -= (int)m_iBorderOuterWidth;
					block.Bottom -= (int)m_iBorderOuterWidth;
					if (rect_caption.IsEmpty())
					{
						m_pForm->getPresenter()->RenderBorder(graphics::bplTop, m_sBorderInnerColor, clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
					}
					else
					{
						APP_RECT new_clip = clip;
						new_clip.Right = std::max(new_clip.Left, rect_caption.Left);
						m_pForm->getPresenter()->RenderBorder(graphics::bplTop, m_sBorderInnerColor, new_clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
						new_clip = clip;
						new_clip.Left = std::min(new_clip.Right, rect_caption.Right);
						m_pForm->getPresenter()->RenderBorder(graphics::bplTop, m_sBorderInnerColor, new_clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
					}
					m_pForm->getPresenter()->RenderBorder(graphics::bplLeft, m_sBorderInnerColor, clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
					m_pForm->getPresenter()->RenderBorder(graphics::bplRight, m_sBorderInnerColor, clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
					m_pForm->getPresenter()->RenderBorder(graphics::bplBottom, m_sBorderInnerColor, clip, block, border, radius, m_iBorderAntiAliazing, nullptr, nullptr, true);
				}
				if (!m_sCaption.empty())
				{
					APP_COLOR text{ m_bEnabled ? getFont()->getColor() : m_sDisabledTextColor };
					APP_COLOR shadow{ m_bEnabled ? getFont()->getShadowColor() : m_sDisabledShadowColor };
					m_pForm->getPresenter()->RenderString(m_sCaption, getFont(), rect_caption.Left, rect_caption.Top, 0, 1, 1, clip, 0, rect_caption, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0,
						graphics::bplInside, true, true, text, shadow, nullptr, nullptr, true);
				}
			}
		}