Exemplo n.º 1
0
void
OptionsWidget::preUpdateUI(
	PageId const& page_id, Margins const& margins_mm, Alignment const& alignment)
{
	m_pageId = page_id;
	m_marginsMM = margins_mm;
	m_alignment = alignment;
	
	typedef AlignmentByButton::value_type KeyVal;
	BOOST_FOREACH (KeyVal const& kv, m_alignmentByButton) {
		if (kv.second == m_alignment) {
			kv.first->setChecked(true);
		}
	}
	
	updateMarginsDisplay();
	
	alignWithOthersCB->blockSignals(true);
	alignWithOthersCB->setChecked(!alignment.isNull());
	alignWithOthersCB->blockSignals(false);
	
	enableDisableAlignmentButtons();
	
	m_leftRightLinked = m_leftRightLinked && (margins_mm.left() == margins_mm.right());
	m_topBottomLinked = m_topBottomLinked && (margins_mm.top() == margins_mm.bottom());
	updateLinkDisplay(topBottomLink, m_topBottomLinked);
	updateLinkDisplay(leftRightLink, m_leftRightLinked);
	
	marginsGroup->setEnabled(false);
	alignmentGroup->setEnabled(false);
}
Exemplo n.º 2
0
QSizeF
Settings::Impl::getAggregateHardSizeMM(
	PageId const& page_id, QSizeF const& hard_size_mm,
	Alignment const& alignment) const
{
	if (alignment.isNull()) {
		return getAggregateHardSizeMM();
	}
	
	QMutexLocker const locker(&m_mutex);
	
	if (m_items.empty()) {
		return QSizeF(0.0, 0.0);
	}
	
	double width = 0.0;
	
	{
		DescWidthOrder::iterator it(m_descWidthOrder.begin());
		if (it->pageId != page_id) {
			width = it->influenceHardWidthMM();
		} else {
			++it;
			if (it == m_descWidthOrder.end()) {
				width = hard_size_mm.width();
			} else {
				width = std::max(
					hard_size_mm.width(), it->influenceHardWidthMM()
				);
			}
		}
	}
	
	double height = 0.0;
	
	{
		DescHeightOrder::iterator it(m_descHeightOrder.begin());
		if (it->pageId != page_id) {
			height = it->influenceHardHeightMM();
		} else {
			++it;
			if (it == m_descHeightOrder.end()) {
				height = hard_size_mm.height();
			} else {
				height = std::max(
					hard_size_mm.height(), it->influenceHardHeightMM()
				);
			}
		}
	}
	
	return QSizeF(width, height);
}
Exemplo n.º 3
0
	bool alignedWithOthers() const { return !alignment.isNull(); }