Exemplo n.º 1
0
void
ConsoleBatch::setupFixOrientation(std::set<PageId> allPages)
{
	IntrusivePtr<fix_orientation::Filter> fix_orientation = m_ptrStages->fixOrientationFilter(); 
	CommandLine const& cli = CommandLine::get();

	for (std::set<PageId>::iterator i=allPages.begin(); i!=allPages.end(); i++) {
		PageId page = *i;

		OrthogonalRotation rotation;
		// FIX ORIENTATION FILTER
		if (cli.hasOrientation()) {
			switch(cli.getOrientation()) {
				case CommandLine::LEFT:
					rotation.prevClockwiseDirection();
					break;
				case CommandLine::RIGHT:
					rotation.nextClockwiseDirection();
					break;
				case CommandLine::UPSIDEDOWN:
					rotation.nextClockwiseDirection();
					rotation.nextClockwiseDirection();
					break;
				default:
					break;
			}
			fix_orientation->getSettings()->applyRotation(page.imageId(), rotation);
		}
	}
}
bool
OrderBySplitTypeProvider::precedes(
	PageId const& lhs_page, bool const lhs_incomplete,
	PageId const& rhs_page, bool const rhs_incomplete) const
{
	if (lhs_incomplete != rhs_incomplete) {
		// Pages with question mark go to the bottom.
		return rhs_incomplete;
	} else if (lhs_incomplete) {
		assert(rhs_incomplete);
		// Two pages with question marks are ordered naturally.
		return lhs_page < rhs_page;
	}

	assert(lhs_incomplete == false);
	assert(rhs_incomplete == false);

	Settings::Record const lhs_record(m_ptrSettings->getPageRecord(lhs_page.imageId()));
	Settings::Record const rhs_record(m_ptrSettings->getPageRecord(rhs_page.imageId()));

	Params const* lhs_params = lhs_record.params();
	Params const* rhs_params = rhs_record.params();

	int lhs_layout_type = lhs_record.combinedLayoutType();
	if (lhs_params) {
		lhs_layout_type = lhs_params->pageLayout().toLayoutType();
	}
	if (lhs_layout_type == AUTO_LAYOUT_TYPE) {
		lhs_layout_type = 100; // To force it below pages with known layout.
	}

	int rhs_layout_type = rhs_record.combinedLayoutType();
	if (rhs_params) {
		rhs_layout_type = rhs_params->pageLayout().toLayoutType();
	}
	if (rhs_layout_type == AUTO_LAYOUT_TYPE) {
		rhs_layout_type = 100; // To force it below pages with known layout.
	}

	if (lhs_layout_type == rhs_layout_type) {
		return lhs_page < rhs_page;
	} else {
		return lhs_layout_type < rhs_layout_type;
	}
}
Exemplo n.º 3
0
void
Filter::preUpdateUI(FilterUiInterface* ui, PageId const& page_id)
{
	if (m_ptrOptionsWidget.get()) {
		OrthogonalRotation const rotation(
			m_ptrSettings->getRotationFor(page_id.imageId())
		);
		m_ptrOptionsWidget->preUpdateUI(page_id, rotation);
		ui->setOptionsWidget(m_ptrOptionsWidget.get(), ui->KEEP_OWNERSHIP);
	}
}
Exemplo n.º 4
0
IntrusivePtr<Task>
Filter::createTask(
	PageId const& page_id,
	IntrusivePtr<page_split::Task> const& next_task,
	bool const batch_processing)
{
	return IntrusivePtr<Task>(
		new Task(
			page_id.imageId(), IntrusivePtr<Filter>(this),
			m_ptrSettings, next_task, batch_processing
		)
	);
}