--- /dev/null
+// enums.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 09/08/2010 Created this file. :-)
+//
+
+#include "enums.h"
+
+
+/**
+ * Wrapper for Qt (ick)
+ */
+/*static*/ Qt::PenStyle RS2::rsToQtLineType(RS2::LineType t)
+{
+ switch (t)
+ {
+ case NoPen:
+ return Qt::NoPen;
+ break;
+ case SolidLine:
+ return Qt::SolidLine;
+ break;
+ case DotLine:
+ case DotLine2:
+ case DotLineX2:
+ return Qt::DotLine;
+ break;
+ case DashLine:
+ case DashLine2:
+ case DashLineX2:
+ return Qt::DashLine;
+ break;
+ case DashDotLine:
+ case DashDotLine2:
+ case DashDotLineX2:
+ return Qt::DashDotLine;
+ break;
+ case DivideLine:
+ case DivideLine2:
+ case DivideLineX2:
+ return Qt::DashDotDotLine;
+ break;
+ case CenterLine:
+ case CenterLine2:
+ case CenterLineX2:
+ return Qt::DashDotLine;
+ break;
+ case BorderLine:
+ case BorderLine2:
+ case BorderLineX2:
+ return Qt::DashDotLine;
+ break;
+ case LineByLayer:
+ case LineByBlock:
+ default:
+ return Qt::SolidLine;
+ break;
+ }
+ return Qt::SolidLine;
+}
+
+/**
+ * Wrapper for Qt. (ick)
+ */
+/*static*/ RS2::LineType RS2::qtToRsPenStyle(Qt::PenStyle s)
+{
+ switch (s)
+ {
+ case Qt::NoPen:
+ return NoPen;
+ case Qt::SolidLine:
+ return SolidLine;
+ break;
+ case Qt::DashLine:
+ return DashLine;
+ break;
+ case Qt::DotLine:
+ return DotLine;
+ break;
+ case Qt::DashDotLine:
+ return DashDotLine;
+ break;
+ case Qt::DashDotDotLine:
+ return DivideLine;
+ break;
+ default:
+ return SolidLine;
+ break;
+ }
+
+ return SolidLine;
+}
+
+/**
+ * Wrapper for Qt (ick)
+ */
+/*static*/ RS2::LineWidth RS2::intToLineWidth(int w)
+{
+ if (w == -3)
+ {
+ return WidthDefault;
+ }
+ else if (w == -2)
+ {
+ return WidthByBlock;
+ }
+ else if (w == -1)
+ {
+ return WidthByLayer;
+ }
+ else if (w < 3)
+ {
+ return Width00;
+ }
+ else if (w < 8)
+ {
+ return Width01;
+ }
+ else if (w < 12)
+ {
+ return Width02;
+ }
+ else if (w < 14)
+ {
+ return Width03;
+ }
+ else if (w < 17)
+ {
+ return Width04;
+ }
+ else if (w < 19)
+ {
+ return Width05;
+ }
+ else if (w < 23)
+ {
+ return Width06;
+ }
+ else if (w < 28)
+ {
+ return Width07;
+ }
+ else if (w < 33)
+ {
+ return Width08;
+ }
+ else if (w < 38)
+ {
+ return Width09;
+ }
+ else if (w < 46)
+ {
+ return Width10;
+ }
+ else if (w < 52)
+ {
+ return Width11;
+ }
+ else if (w < 57)
+ {
+ return Width12;
+ }
+ else if (w < 66)
+ {
+ return Width13;
+ }
+ else if (w < 76)
+ {
+ return Width14;
+ }
+ else if (w < 86)
+ {
+ return Width15;
+ }
+ else if (w < 96)
+ {
+ return Width16;
+ }
+ else if (w < 104)
+ {
+ return Width17;
+ }
+ else if (w < 114)
+ {
+ return Width18;
+ }
+ else if (w < 131)
+ {
+ return Width19;
+ }
+ else if (w < 150)
+ {
+ return Width20;
+ }
+ else if (w < 180)
+ {
+ return Width21;
+ }
+ else if (w < 206)
+ {
+ return Width22;
+ }
+ else
+ {
+ return Width23;
+ }
+}
+
+/**
+ * Wrapper for Qt. (ick)
+ */
+/*static*/ Qt::CursorShape RS2::rsToQtCursorType(RS2::CursorType t)
+{
+ switch (t)
+ {
+ case ArrowCursor:
+ return Qt::ArrowCursor;
+ break;
+ case UpArrowCursor:
+ return Qt::UpArrowCursor;
+ break;
+ case CrossCursor:
+ return Qt::CrossCursor;
+ break;
+ case WaitCursor:
+ return Qt::WaitCursor;
+ break;
+ case IbeamCursor:
+ return Qt::IBeamCursor;
+ break;
+ case SizeVerCursor:
+ return Qt::SizeVerCursor;
+ break;
+ case SizeHorCursor:
+ return Qt::SizeHorCursor;
+ break;
+ case SizeBDiagCursor:
+ return Qt::SizeBDiagCursor;
+ break;
+ case SizeFDiagCursor:
+ return Qt::SizeFDiagCursor;
+ break;
+ case SizeAllCursor:
+ return Qt::SizeAllCursor;
+ break;
+ case BlankCursor:
+ return Qt::BlankCursor;
+ break;
+ case SplitVCursor:
+ return Qt::SplitVCursor;
+ break;
+ case SplitHCursor:
+ return Qt::SplitHCursor;
+ break;
+ case PointingHandCursor:
+ return Qt::PointingHandCursor;
+ break;
+ case ForbiddenCursor:
+ return Qt::ForbiddenCursor;
+ break;
+ case WhatsThisCursor:
+ return Qt::WhatsThisCursor;
+ break;
+ default:
+ return Qt::ArrowCursor;
+ break;
+ }
+
+ return Qt::ArrowCursor;
+}
+
+/**
+ * Wrapper for Qt. (ick)
+ */
+/*static*/ QPrinter::PageSize RS2::rsToQtPaperFormat(RS2::PaperFormat f)
+{
+ QPrinter::PageSize ret;
+
+ switch (f)
+ {
+ case Custom:
+ ret = QPrinter::Custom;
+ break;
+ case Letter:
+ ret = QPrinter::Letter;
+ break;
+ case Legal:
+ ret = QPrinter::Legal;
+ break;
+ case Executive:
+ ret = QPrinter::Executive;
+ break;
+ case A0:
+ ret = QPrinter::A0;
+ break;
+ case A1:
+ ret = QPrinter::A1;
+ break;
+ case A2:
+ ret = QPrinter::A2;
+ break;
+ case A3:
+ ret = QPrinter::A3;
+ break;
+ default:
+ case A4:
+ ret = QPrinter::A4;
+ break;
+ case A5:
+ ret = QPrinter::A5;
+ break;
+ case A6:
+ ret = QPrinter::A6;
+ break;
+ case A7:
+ ret = QPrinter::A7;
+ break;
+ case A8:
+ ret = QPrinter::A8;
+ break;
+ case A9:
+ ret = QPrinter::A9;
+ break;
+ case B0:
+ ret = QPrinter::B0;
+ break;
+ case B1:
+ ret = QPrinter::B1;
+ break;
+ case B2:
+ ret = QPrinter::B2;
+ break;
+ case B3:
+ ret = QPrinter::B3;
+ break;
+ case B4:
+ ret = QPrinter::B4;
+ break;
+ case B5:
+ ret = QPrinter::B5;
+ break;
+ case B6:
+ ret = QPrinter::B6;
+ break;
+ case B7:
+ ret = QPrinter::B7;
+ break;
+ case B8:
+ ret = QPrinter::B8;
+ break;
+ case B9:
+ ret = QPrinter::B9;
+ break;
+ case B10:
+ ret = QPrinter::B10;
+ break;
+ case C5E:
+ ret = QPrinter::C5E;
+ break;
+ case Comm10E:
+ ret = QPrinter::Comm10E;
+ break;
+ case DLE:
+ ret = QPrinter::DLE;
+ break;
+ case Folio:
+ ret = QPrinter::Folio;
+ break;
+ //case Ledger:
+ // ret = QPrinter::Ledger;
+ // break;
+ case Tabloid:
+ ret = QPrinter::Tabloid;
+ break;
+ case NPageSize:
+ ret = QPrinter::NPageSize;
+ break;
+ }
+
+ return ret;
+}