PageItem_LatexFrame::PageItem_LatexFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline) : PageItem_ImageFrame(pa, x, y, w, h, w2, fill, outline) { setUPixmap(Um::ILatexFrame); AnName = tr("Render") + QString::number(m_Doc->TotalItems); setUName(AnName); imgValid = false; m_usePreamble = true; err = 0; internalEditor = 0; killed = false; config = 0; if (PrefsManager::instance()->latexConfigs().count() > 0) setConfigFile(PrefsManager::instance()->latexConfigs()[0]); latex = new QProcess(); connect(latex, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateImage(int, QProcess::ExitStatus))); connect(latex, SIGNAL(error(QProcess::ProcessError)), this, SLOT(latexError(QProcess::ProcessError))); latex->setProcessChannelMode(QProcess::MergedChannels); QTemporaryFile *tempfile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_render_XXXXXX"); tempfile->open(); tempFileBase = getLongPathName(tempfile->fileName()); tempfile->setAutoRemove(false); tempfile->close(); delete tempfile; Q_ASSERT(!tempFileBase.isEmpty()); m_dpi = 0; }
void ScrPainter::drawBitmap(const libwpg::WPGBitmap& bitmap, double hres, double vres) { QImage image = QImage(bitmap.width(), bitmap.height(), QImage::Format_RGB32); for(int x = 0; x < bitmap.width(); x++) { for(int y = 0; y < bitmap.height(); y++) { libwpg::WPGColor color = bitmap.pixel(x, y); image.setPixel(x, y, qRgb(color.red, color.green, color.blue)); } } double w = (bitmap.rect.x2 - bitmap.rect.x1) * 72.0; double h = (bitmap.rect.y2 - bitmap.rect.y1) * 72.0; int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, bitmap.rect.x1 * 72 + baseX, bitmap.rect.y1 * 72 + baseY, w, h, 1, m_Doc->itemToolPrefs().imageFillColor, CommonStrings::None, true); PageItem *ite = m_Doc->Items->at(z); ite->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_wpg_XXXXXX.png"); ite->tempImageFile->open(); QString fileName = getLongPathName(ite->tempImageFile->fileName()); ite->tempImageFile->close(); ite->isInlineImage = true; image.setDotsPerMeterX ((int) (hres / 0.0254)); image.setDotsPerMeterY ((int) (vres / 0.0254)); image.save(fileName, "PNG"); m_Doc->LoadPict(fileName, z); ite->setImageScalingMode(false, false); ite->moveBy(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset()); finishItem(ite); // qDebug() << "drawBitmap"; }
// makes sure that capitalization of directories is canonical. // This mimics the logic in QDeclarative_isFileCaseCorrect QTCREATOR_UTILS_EXPORT QString normalizePathName(const QString &name) { QString canonicalName = getShortPathName(name); if (canonicalName.isEmpty()) return name; canonicalName = getLongPathName(canonicalName); if (canonicalName.isEmpty()) return name; // Upper case drive letter if (canonicalName.size() > 2 && canonicalName.at(1) == QLatin1Char(':')) canonicalName[0] = canonicalName.at(0).toUpper(); return canonicalName; }
void PageItem_OSGFrame::setImage(QImage &image) { isInlineImage = true; if (PictureIsAvailable) { image.save(Pfile, "PNG"); m_Doc->loadPict(Pfile, this, true); } else { tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_osg_XXXXXX.png"); tempImageFile->open(); QString imgName = getLongPathName(tempImageFile->fileName()); tempImageFile->close(); image.save(imgName, "PNG"); m_Doc->loadPict(imgName, this); } setImageScalingMode(false, true); }
void vmsCommandLine::fromString(LPCTSTR ptsz, bool bConvertToLongPath) { Clear (); if (ptsz == NULL || *ptsz == 0) return; TCHAR tszTmp [MAX_PATH] = _T (""); if (_tcschr (ptsz, '%')) { ExpandEnvironmentStrings (ptsz, tszTmp, MAX_PATH); ptsz = tszTmp; } if (*ptsz == '"') { ptsz++; while (*ptsz && *ptsz != '"') m_tstrExe += *ptsz++; if (*ptsz == 0) { m_tstrExe = _T (""); return; } ptsz++; } else { while (*ptsz == ' ') ptsz++; do { while (*ptsz && *ptsz != ' ') m_tstrExe += *ptsz++; if (m_tstrExe.length () > 1 && m_tstrExe [1] != ':') { if (SearchPath (m_tstrExe.c_str (), _T (".exe"), &m_tstrExe)) { bConvertToLongPath = false; break; } } if (*ptsz) { DWORD dw = GetFileAttributes (m_tstrExe.c_str ()); if (dw != DWORD (-1) && (dw & FILE_ATTRIBUTE_DIRECTORY) == 0) break; tstring tstr = m_tstrExe; tstr += _T (".exe"); dw = GetFileAttributes (tstr.c_str ()); if (dw != DWORD (-1) && (dw & FILE_ATTRIBUTE_DIRECTORY) == 0) break; if (m_tstrExe.length () > 4 && _tcsicmp (m_tstrExe.c_str ()+m_tstrExe.length ()-4, _T (".exe")) == 0) break; while (*ptsz == ' ') m_tstrExe += *ptsz++; } } while (*ptsz); } if (bConvertToLongPath) m_tstrExe = getLongPathName (m_tstrExe.c_str ()); while (*ptsz == ' ') ptsz++; m_tstrArgs = ptsz ? ptsz : _T (""); RemoveTrailingSpaces (); }