Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

units.cpp File Reference

#include <QString>
#include <QObject>
#include "units.h"

Include dependency graph for units.cpp:

Go to the source code of this file.

Functions

double unitGetRatioFromIndex (const int index)
 Returns the ratio to points for the selected unit of measure. Ratios are for: PT, MM, IN, P, CM, C. DEG and PCT return 1.0 as they will never convert.
int SCRIBUS_API unitGetBaseFromIndex (const int index)
double unitValueFromString (const QString &value)
 Strip the text from a value and return the double value for the unit.
scUnit unitIndexFromString (const QString &value)
 Strip the text from a value and return the Unit index for the value.
const QString unitGetSuffixFromIndex (const int index)
 Returns the suffix used in GUI widgets.
const QString unitGetStrFromIndex (const int index)
 Returns a general suffix for each of the units.
const QString unitGetUntranslatedStrFromIndex (const int index)
 Returns a general untranslated suffix for each of the units.
int unitGetDecimalsFromIndex (const int index)
 Returns the decimals for the units.
int unitGetPrecisionFromIndex (const int index)
 Returns the precision for the units.
const QStringList unitGetTextUnitList ()
 Returns a QStringList of the units for use in QComboBoxes etc.
int unitGetMaxIndex ()
 Returns the maximum index of the units we have now.
double mm2pts (double mm)
 Returns the pts value from the mm value supplied.
double in2pts (double in)
 Returns the pts value from the in value supplied.
double p2pts (double p)
 Returns the pts value from the pica value supplied.
double cm2pts (double cm)
 Returns the pts value from the cm value supplied.
double c2pts (double c)
 Returns the pts value from the cm value supplied.
double pts2mm (double pts)
 Returns the mm value from the pt value supplied.
double pts2in (double pts)
 Returns the in value from the pt value supplied.
double pts2p (double pts)
 Returns the pica value from the pt value supplied.
double pts2cm (double pts)
 Returns the cm value from the pt value supplied.
double pts2c (double pts)
 Returns the c value from the pt value supplied.
double pts2value (double unitValue, int unit)
 Returns the value from the pt value supplied based on unit index.
double value2pts (double unitValue, int unit)
 Returns the pt value from the value supplied based on unit index.
double value2value (double unitValue, int primaryUnit, int secondaryUnit)
 Returns the secondary unit value from the value supplied based on primary unit.
double unitRulerGetIter1FromIndex (const int index)
 Sets up iteration value 1 for vruler, hruler and tabruler.
double unitRulerGetIter2FromIndex (const int index)
 Sets up iteration value 2 for vruler, hruler and tabruler.
bool unitValidForDocUnit (const int index)


Function Documentation

double c2pts ( double  c  ) 

Returns the pts value from the cm value supplied.

Definition at line 262 of file units.cpp.

References SC_C, and unitGetRatioFromIndex().

double cm2pts ( double  cm  ) 

Returns the pts value from the cm value supplied.

Definition at line 254 of file units.cpp.

References SC_CM, and unitGetRatioFromIndex().

Referenced by StencilReader::parseUnit().

double in2pts ( double  in  ) 

Returns the pts value from the in value supplied.

Definition at line 238 of file units.cpp.

References SC_IN, and unitGetRatioFromIndex().

Referenced by PageSize::generateSizeList(), and StencilReader::parseUnit().

double mm2pts ( double  mm  ) 

Returns the pts value from the mm value supplied.

Definition at line 230 of file units.cpp.

References SC_MM, and unitGetRatioFromIndex().

Referenced by PageSize::generateSizeList(), and StencilReader::parseUnit().

double p2pts ( double  p  ) 

Returns the pts value from the pica value supplied.

Definition at line 246 of file units.cpp.

References SC_P, and unitGetRatioFromIndex().

double pts2c ( double  pts  ) 

Returns the c value from the pt value supplied.

Definition at line 302 of file units.cpp.

References SC_C, and unitGetRatioFromIndex().

double pts2cm ( double  pts  ) 

Returns the cm value from the pt value supplied.

Definition at line 294 of file units.cpp.

References SC_CM, and unitGetRatioFromIndex().

double pts2in ( double  pts  ) 

Returns the in value from the pt value supplied.

Definition at line 278 of file units.cpp.

References SC_IN, and unitGetRatioFromIndex().

double pts2mm ( double  pts  ) 

Returns the mm value from the pt value supplied.

Definition at line 270 of file units.cpp.

References SC_MM, and unitGetRatioFromIndex().

double pts2p ( double  pts  ) 

Returns the pica value from the pt value supplied.

Definition at line 286 of file units.cpp.

References SC_P, and unitGetRatioFromIndex().

double pts2value ( double  unitValue,
int  unit 
)

Returns the value from the pt value supplied based on unit index.

Definition at line 310 of file units.cpp.

References unitGetRatioFromIndex().

Referenced by GuidesModel::data(), PointToValue(), and GuideManager::setupGui().

int SCRIBUS_API unitGetBaseFromIndex ( const int  index  ) 

Definition at line 42 of file units.cpp.

References SC_P.

Referenced by ScrSpinBox::valueFromText().

int unitGetDecimalsFromIndex ( const int  index  ) 

Returns the decimals for the units.

Definition at line 180 of file units.cpp.

References UNITMAX.

Referenced by ReformDoc::ReformDoc(), MSpinBox::setNewUnit(), ScribusMainWindow::setStatusBarMousePosition(), and Measurements::setValues().

int unitGetMaxIndex (  ) 

Returns the maximum index of the units we have now.

Definition at line 222 of file units.cpp.

References UNITMAX.

Referenced by initscribus(), ScribusView::ScribusView(), ScrSpinBox::setParameters(), and MSpinBox::setParameters().

int unitGetPrecisionFromIndex ( const int  index  ) 

double unitGetRatioFromIndex ( const int  index  ) 

Returns the ratio to points for the selected unit of measure. Ratios are for: PT, MM, IN, P, CM, C. DEG and PCT return 1.0 as they will never convert.

Definition at line 29 of file units.cpp.

References UNITMAX.

Referenced by CreateMode::activate(), c2pts(), cm2pts(), NodePalette::doEnlarge(), NodePalette::doReduce(), AlignDistributePalette::enableGuideButtons(), ScrSpinBox::getValue(), Imposition::Imposition(), in2pts(), gtMeasure::init(), initscribus(), ScribusMainWindow::keyPressEvent(), MarginWidget::MarginWidget(), mm2pts(), LegacyMode::mouseReleaseEvent(), FreehandMode::mouseReleaseEvent(), CreateMode::mouseReleaseEvent(), NewDoc::NewDoc(), OneClick::OneClick(), PageSize::originalHeight(), PageSize::originalWidth(), p2pts(), StencilReader::parseUnit(), Preferences::Preferences(), PrintDialog::PrintDialog(), PageSize::printSizeList(), pts2c(), pts2cm(), pts2in(), pts2mm(), pts2p(), pts2value(), TabTools::restoreDefaults(), TabPrinter::restoreDefaults(), TabGuides::restoreDefaults(), TabDocument::restoreDefaults(), TabDisplay::restoreDefaults(), MarginWidget::setMarginsToPrinterMargins(), ScrSpinBox::setNewUnit(), MarginWidget::setNewUnit(), Tabruler::setTabs(), NewDoc::setUnit(), ScribusDoc::setUnitIndex(), Measurements::setValues(), SMPStyleWidget::show(), SMPStyleWidget::showDropCap(), SMPStyleWidget::showTabs(), TabDocument::TabDocument(), TabGuides::TabGuides(), TabManager::TabManager(), Tabruler::Tabruler(), TabDocument::unitChange(), ReformDoc::unitChange(), Preferences::unitChange(), AlignDistributePalette::unitChange(), Preferences::updatePreferences(), value2pts(), and value2value().

const QString unitGetStrFromIndex ( const int  index  ) 

const QString unitGetSuffixFromIndex ( const int  index  ) 

const QStringList unitGetTextUnitList (  ) 

Returns a QStringList of the units for use in QComboBoxes etc.

Definition at line 204 of file units.cpp.

References tr().

Referenced by NewDoc::createNewDocPage(), TabDisplay::restoreDefaults(), and TabDocument::TabDocument().

const QString unitGetUntranslatedStrFromIndex ( const int  index  ) 

Returns a general untranslated suffix for each of the units.

Definition at line 170 of file units.cpp.

References UNITMAX.

Referenced by MSpinBox::mapTextToValue(), StencilReader::parseUnit(), and ScrSpinBox::valueFromText().

scUnit unitIndexFromString ( const QString &  value  ) 

Strip the text from a value and return the Unit index for the value.

Definition at line 94 of file units.cpp.

References SC_C, SC_CM, SC_DEGREES, SC_IN, SC_MM, SC_P, SC_PERCENT, and SC_PT.

Referenced by initscribus(), MSpinBox::mapTextToValue(), gtMeasure::parse(), and ScrSpinBox::valueFromText().

double unitRulerGetIter1FromIndex ( const int  index  ) 

Sets up iteration value 1 for vruler, hruler and tabruler.

Definition at line 367 of file units.cpp.

References unitValidForDocUnit().

Referenced by TabDisplay::drawRuler(), RulerT::RulerT(), RulerT::setTabs(), Vruler::unitChange(), and Hruler::unitChange().

double unitRulerGetIter2FromIndex ( const int  index  ) 

Sets up iteration value 2 for vruler, hruler and tabruler.

Definition at line 379 of file units.cpp.

References unitValidForDocUnit().

Referenced by TabDisplay::drawRuler(), RulerT::RulerT(), RulerT::setTabs(), Vruler::unitChange(), and Hruler::unitChange().

bool unitValidForDocUnit ( const int  index  ) 

Definition at line 388 of file units.cpp.

References UNITMAX.

Referenced by unitRulerGetIter1FromIndex(), and unitRulerGetIter2FromIndex().

double unitValueFromString ( const QString &  value  ) 

Strip the text from a value and return the double value for the unit.

Definition at line 52 of file units.cpp.

Referenced by gtMeasure::parse().

double value2pts ( double  unitValue,
int  unit 
)

double value2value ( double  unitValue,
int  primaryUnit,
int  secondaryUnit 
)

Returns the secondary unit value from the value supplied based on primary unit.

Definition at line 352 of file units.cpp.

References unitGetRatioFromIndex().

Referenced by MSpinBox::mapTextToValue(), and ScrSpinBox::valueFromText().

Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.