//
#ifndef __ACM_H
#define __ACM_H
//
//  (C) Copyright 1993-2008 by Autodesk, Inc.  All rights reserved.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted, 
// provided that the above copyright notice appears in all copies and 
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting 
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC. 
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to 
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//

#include "AdAChar.h"

#ifndef PI
const double PI  = 3.14159265358979323846;
#endif // PI

#ifndef PI_2
#define PI_2 PI/2.0
#endif // PI_2

#ifndef PI_4
#define PI_4 PI/4.0
#endif // PI_$

#ifndef TWOPI
#define TWOPI PI * 2.0
#endif // TWOPI

#ifdef ACM_BUILD_DLL
 #define DllImpExp __declspec(dllexport)
#else
  #if _MSC_VER >= 1300 // VC7
    #define DllImpExp
  #else
    #define DllImpExp __declspec(dllimport)
  #endif
#endif

#ifdef AMDT_STDIMP_BUILD
 #define STDIMP_DLLSHARE __declspec(dllexport)
#else
  #if _MSC_VER >= 1300 // VC7
    #define STDIMP_DLLSHARE
  #else
    #define STDIMP_DLLSHARE __declspec(dllimport)
  #endif
#endif

#ifndef ACM_BUILD_DLL
  #ifndef ACM_WITHOUT_API
    #ifndef AMDT_STDIMP_BUILD
	  #undef  DBREF_DECLARE
      #define DBREF_DECLARE(AcDbType)
    #endif
  #endif
#endif

const int NUM_TAPER_SYM_SUBTYPE = 11;

struct Acm {
    enum ErrorStatus {
        eOk = 0,                    // generic goodness (== Acad::eOk)
        eBad = 1000,                // generic badness
        eNotImplementedYet,
        eNotSupported,
        eTransactionNotOpen,
        eBadName,
        eDependentsExist,
        eCyclicGraph,
        eNodeAlreadyInGraph,
        eInvalidInput,
        eObjectNotInDatabase,
        eObjectNotInMap,
        eDuplicateEntry,
        eConnectionsExist,
        eDefunCommandCancelled,
        eGeometryIsUnbounded,
        eNullContext,
        eInvalidContext,
        eInconsistentGraph,
        eXPickNotSupported,
        eGrefCreationFailed,
        eMultiplePlanesFound,
        eSubentityNotSupported,
        eUGrReplicateNodeError,
        eDGrReplicateNodeError,
        eCancel,
        eZombieObject,
        eReferredObjectDeleted,
        eReferredObjectEdited,
        eInvalidGeomRef,
        eMultipleSurfacesFound,
        eBadInput,
        eBackingImpossible,
        eAssociationImpossible,
        eStaggerImpossible,
        eSpacerImpossible,
        eInvalidWeldType,
        eStandardIsNotLoaded,
        eIntendToDeleteBaseStandard,
        eStandardIsReferenced,
        eAcMeFail,
        eKeyAlreadyExist,
        eDefinedByStandard,
        eUpdateRequest,
        eEraseRequest,
        eMoveRequest,
        eMultipleGeometryAttached,
        eGeometryAlreadyAttached,
        eNoGeometryReference,
        eOtherView,
        eIsEmpty,
        eMultipleArrowheads,
        eSinglePartView,
        eItemIsInUse,
        eCannotDeleteItem,
        eGeometrySuppresed
    };

    enum SymbolStyleState
    {
        kCurrent = 0,
        kEdited
    };

    enum SubSymbolType
    {
        kNoneSymbol = 0,
        kSurfText,
        kDatum,
        kFCF,
        kDatumId,
        kFeatureId,

        kFilletWeld,
        kSecondaryFillet,
        kPlugWeld,
        kSlotWeld,
        kStudWeld,
        kSpotWeld,
        kSpotOnRefLineWeld,
        kSeamWeld,
        kSeamOnRefLineWeld,
        kBackWeld,
        kSurfacingWeld,
        kFlangeEdgeWeld,
        kFlangeCornerWeld,
        kSqureGrooveWeld,
        kScarfGrooveWeld,
        kVGrooveWeld,
        kBevelGrooveWeld,
        kUGrooveWeld,
        kJGrooveWeld,
        kFlareVGrooveWeld,
        kFlareBevelGrooveWeld,
        kEdgeWeld,
        kFoldJointWeld,
        kInclinedJointWeld,
        kSurfaceJointWeld,
        kSteepFlankedVWeld,
        kSteepFlankedBevelWeld,
        kSingleVBroadRootFace,
        kSingleBevelBroadRootFace,
        kPermanentBackingStripWeld,
        kRemovableBackingStripWeld,
        kMeltThrough,
        kConsInsert,
        kFlushContour,
        kConvexContour,
        kConcaveContour,
        kSmoothContour,
        kFlushFinishedContour,
        kWeldingTail,
        kWeldAllAround,
        kFieldWeld,
        kSpecialStaggerWeld,
        kBevelGrooveShapeWeld,
        kWeldAllAroundSquare,
        kFieldWeldEmpty,
        kExamination,
        kBackLendingWeld,
        kRoundedWeld,
        kHalfRoundedWeld,
        kHalfWWeld,
        kWWeld,
        kWeldMullded,
        kWeldGroovedRoot,                
        kWWeld2,
        kUVWeld,
        kConcaveSmoothContour,
        kGostWeld,
        kCutEnforceWeld,
        kSmoothWeld,
        kOpenContourWeld,
        kIntermittentWeld,
        kZigzagWeld,  
        kUserSymbolType = 1000
    };

    enum GdtSymbolType 
    {
        kStraightness = 1,
        kFlatness,
        kCircularity,
        kCylindricity,
        kProfileLine,
        kProfileSurface,
        kAngularity,
        kPerpendicularity,
        kParallelism,
        kPosition,
        kConcentricity,
        kSymmetry,
        kRunoutCircular,
        kRunoutTotal,
        kLeastMaterialCondition,
        kMaximumMaterialCondition,
        kProjectedToleranceZone,
        kTangentPlane,
        kFreeState,
        kEnvelope,
        kRegardlessOfFeatureSize,
        kStatisticalTolerance,
        kDiameter,
        kBetween,
        kReciprocityCondition,
        kSquare,
        kProfileSection,
        kAxiality,
        kRunoutCircularFilled,
        kRunoutTotalFilled,
        kangularity=kAngularity,
        kUserSymbolGDT = 1000
    };

    enum LeaderDirClass {
        kAbovePrimRefLine,
        kAlongPrimRefLine,
        kBelowPrimRefLine
    };

    enum WeldLocation
    {
        kArrowSide = 0,
        kOtherSide,
        kOnlyOnRefLine,
        kOnlyOnArrowSide,
        kOnlyOnOtherSide,
        kOnBothSides
    };
    enum WeldAssociation
    {
        kNoAssociation = 0,
        kAssociationSpacer,
        kAssociationMoveStagger,
        kAssociationMirrorStagger,
        kAssociationSpecialStagger,
        kAssociationBacking
    };
    enum StaggerType
    {
        kNoEnableStagger = 0,
        kEnableMoveStagger,
        kEnableMirrorStagger,
        kEnableSpecialStagger,
        kMoveStagger,
        kMirrorStagger,
        kSpecialStagger
    };

    enum IdentLineType
    {
        kNoIdentLine = 0,
        kIdentLineOtherSide,
        kIdentLineArrowSide
    };

    enum WeldGroup
    {
        kWeld = 0,
        kContour,
        kBacking,
        kAreaDesc,
        kSizeSymbol,
        kSecondarySymbol
    };

    enum WeldLocationFilter
    {
        kForBothSides = 0,
        kForOtherSide,
        kForArrowSide,
    };

    enum SymbolAttachmentPoint {
      kTopLeft  = 1,
      kTopCenter  = 2,
      kTopRight = 3,
      kMiddleLeft = 4,
      kMiddleCenter = 5,
      kMiddleRight  = 6,
      kBottomLeft = 7,
      kBottomCenter = 8,
      kBottomRight  = 9
    };

    enum Visibility
    {
      kHidden = 0,
      kDisabled = 1,
      kShaded = 1,
      kSelectOnly,
      kVisible
    };

    enum CheckStatus
    {
      kOk = 0,
      kErrorType,
      kErrorRange,
      kError,
      kNotApplicable
    };

    enum Orientation
    {
      kLeftSide = 0,
      kRightSide,
      kBelow,
      kAbove
    };

    enum SortDirection {
      kNotSorted = 0,
      kAscending,
      kDescending
    };

    enum PointType
    {
      kAtStartRefLine = 0,
      kAtMiddleRefLine,
      kAtEndRefLine
    };

    enum SurfTextType
    {   
      kBasic                        = 0,
      kRemovalOfMaterialRequired,
      kRemovalOfMaterialProhibited,
      kRemovalAllowanceSpecified
    };

    enum DirectionLayType
    {   
      kNotSpecified                      = 0,
      kParallelToPlaneOfProjection,
      kPerpendicularToPlaneOfProjection,
      kCrossedIn2SlantDirections,
      kMultiDirection,
      kCircularRelativeToCenter,
      kRadialRelativeToCenter,
      kParticulateNonDirectional,
      kUserDirectionLayType = 1000
    };

    enum TaperType
    {
      kTaperAtEndRefLn = 0,
      kSlopeAtEndRefLn,
      kSlopeAtEndRefLn2,
      kTaperThruRefLn,
      kSlopeOnRefLn,
      kSlopeOnRefLn2,
      kSlopeAboveRefLn,
      kSlopeAboveRefLn2,
      kTaperAboveRefLn,
      kSlopeOpenAboveRefLn,
      kSlopeOpenAboveRefLn2
    };

    enum DataType
    {
      kGeneralText = 0,
      kInteger,
      kDouble
    };

    enum TargetType {        
        kNoTarget = 0,
        kBalloon,
        kPoint,        
        kLine,
        kCircular,
        kRectangular,
        kAttach
    };

    enum ArrowType {
        kNoArrow = 0,
        kArrowOpen,
        kArrowOpen15,
        kArrowOpen30,
        kArrowOpen60,
        kArrowOpen90,
        kArrowEmpty,
        kArrowEmpty15,
        kArrowEmpty30,
        kArrowEmpty60,
        kArrowEmpty90,
        kArrowClosed,
        kArrowClosed15,
        kArrowClosed30,
        kArrowClosed60,
        kArrowClosed90,
        kArrowFilled,
        kArrowFilled15,
        kArrowFilled30,
        kArrowFilled60,
        kArrowFilled90,
        kArrowBoxBlank,
        kArrowBoxFilled,
        kArrowDatumBlank45,
        kArrowDatumFilled45,
        kArrowDatumBlank60,
        kArrowDatumFilled60,
        kArrowDot,
        kArrowDotBlank,
        kArrowOblique,
        kArrowOrigin,
        kByStandard,
        kArrowDatumThickLine,
        kArrowDotSmall,
        kArrowDotBlankSmall,
        kArrowFilledHalf,
        kArrowEmptyHalf,
        kArrowAcadArchTick,
        kArrowAcadBoxBlank,
        kArrowAcadBoxFilled,
        kArrowAcadClosed,
        kArrowAcadClosedBlank,
        kArrowAcadClosedFilled,
        kArrowAcadDatumBlank,
        kArrowAcadDatumFilled,
        kArrowAcadDot,
        kArrowAcadDotBlank,
        kArrowAcadDotSmall,
        kArrowAcadIntegral,
        kArrowAcadNone,
        kArrowAcadOblique,
        kArrowAcadOpen,
        kArrowAcadOpen30,
        kArrowAcadOpen90,
        kArrowAcadOrigin,
        kArrowAcadOrigin2,
        kArrowAcadSmall,
        kUserArrowDialog,
        kVaries,
        kArrowFilled20,
        kUserArrowType = 1000
    };
    
    enum ArrowGroup {
        kAcadArrow = 0,
        kStandardArrow,
        kAcadDimStyleArrow,
        kUserArrow
    };

    enum AlignmentType {
      kLeft = 0,
      kCenter,
      kRight
    };              

    enum ColType {
      kPartID = 0,
      kItem,
      kQuantity,
      kPLName,
      kPLPath,
      kDescription,
      kDescription2,
      kStandard,
      kStandard2,
      kMaterial,
      kMaterial2,
      kUserID,
      kMass,
      kPrice,
      kDimension,
      kUser1,
      kUser2,
      kUser3,
      kUser4,
      kUser5,
      kUser6,
      kUser7,
      kUser8,
      kFilter,
      kNote,
      kVendor,
      kAssembly,
      kDmID,
      kName,      
      kUnknown,
      kUnitOfMeasure,
      kCategory,
      kFormat,
      kZone,
      kComments,
      kPartNumber,
      kTotalMass
    };

    enum BalloonType {
      kByStdBalloon=0,
      kNoBalloon,
      kCircBallon,
      kCirc2Ballon,
      kLinearBallon,
      kEmptyBallon,
      kNAngeBallon,
	  kZigZagBallon, //Bal-Peck
      kUserBalloon = 1000
   };

    enum PartListDirection {
      kTopDown = 0,
      kBottonUp
    };
    
    enum PartListMultipleRow {
      kSingleRow = 1,
      kDoubleRow,
      kTripleRow
    };
  
    enum HeadingPlacement {
      kUp = 0,
      kDown,
      kNone
    };

    enum DataEntType {
    };

    enum Direction {
      kToLeft = 0,
      kToRight,
      kToTop,
      kToBottom
    };
    
    enum BalloonCollectionType {
      kHorizontal = 0,
      kVertical
    };

    enum BalloonAttachType {
      kToCenter = 0,
      kToExtents,
      kToOrigin
    };

    enum LineTypes {
      none = 0,
      hairLine,
      smallLine,
      middleLine,
      bigLine,
      dblSmallLine,
      dblBigLine
    };

    enum EdgeUndefinedDirection{
      kAtTop = 0,
      kAtSide
    };

    enum Variable {
      //Surface texture
      SurfTextRaMax = 0,
      SurfTextRaMin,
      SurfTextProduction,
      SurfTextProduction2,
      SurfTextAllowance,
      SurfTextDirLay,
      SurfTextSampLeanght,
      SurfTextCutoff,
      SurfTextOtherValue,
      SurfTextOtherMin,
      SurfTextMaxRspac,
      SurfTextReference,
      SurfTextWavines,
      SurfTextComment,
      //FCF
      FCFSymbol,
      FCFSymbol2,
      FCFTolerance,
      FCFTolerance2,
      FCFToleranceB,
      FCFToleranceB2,
      FCFDatumPrimary,
      FCFDatumPrimary2,
      FCFDatumSecondary,
      FCFDatumSecondary2,
      FCFDatumTertiary,
      FCFDatumTertiary2,
      FCFProjectedZone,
      FCFDatumId,
      FCFTopNote,
      FCFBottomNote,
      //Datum Id
      DatumIdText,
      //Weld
      WeldSize,
      WeldThickness,
      WeldLength,
      WeldNumber,
      WeldSpacing,
      WeldAngle,
      WeldDepth,
      WeldPitch,
      WeldGap,
      WeldClearance,
      WeldBacking,
      WeldBrazing,
      WeldFinishing,
      WeldContour,
      WeldNotes,
      //Datum target
      DatumTargetSize,
      DatumTargetText,
      //Note
      NoteExpression,
      NoteEvalText,
      // Edge
      EdgeMax,
      EdgeMin,
      EdgeSign,
      //Detail Sym
      DetailSymLabelPattern,
      DetailSymLabelName,
      DetailSymScale,
      DetailSymShowBorder,
      DetailSymShowLeader,
      DetailSymShowAnnotLeader,
      //Section Sym
      SectionSymLabelPattern,
      SectionSymLabelName,
      //Taper and Slope
      TaperSubType,
      TaperOrient,
      TaperInspect,
      TaperDisplayStr,
      // Surface Texture Symbol (R12)
      SurfTextFirstReq,
      SurfTextSecondReq,
      SurfTextThirdReq,
      //Annotation View
      AVSymLabelPattern,
      AVSymLabelText,
      // Surface Texture Symbol
      SurfTextFourthReq,
      // Feature Control
      FCFSymbol3,
      FCFTolerance3,
      FCFDatumPrimary3,
      FCFDatumSecondary3,
      FCFDatumTertiary3,
      // Weld
      WeldIndex,
      WeldIndexTotal,
      WeldStandard,
      WeldDesignation,
      WeldSpecification,
      WeldControlCategory,
      WeldTechnicalReq,
      WeldSize2,
      WeldSizeSymbol,
      WeldSecondarySymbol,
      // Marking and Stamping
      MarkStampContents,
      MarkStampMethod,
      MarkStampTechReq,
      //Joint symbol
      JointAnnotation,
      JointSecAnnotation,

      kUserVariable = 1000
    };

    enum RowType {
      kSingle=0,
      kExpandable,
      kIsExpanded
    };

    enum MergePickArray {
      kAppend=0,
      kRemove,
      kRemoveNotContaining,
      kRemoveNotContainingMainBom,
      kRemoveNotContainingBlockBom,
      kMergeWithBom,
      kMergeWithMainBom,
      kMergeWithBlockBom
    };

    enum ProjectionType {
      kFirstAngle = 0,
      kThirdAngle
    };

    enum ListInsertionPoint {
      kInsTopLeft = 0,
      kInsBottomLeft,
      kInsBottomRight,
      kInsTopRight
    };

    enum StdVariable {
      kUnits = 0,
      kListAttach,
      kTextHeight,
      kTextStyle,
      kArrowType,
      kProjectionType,
      kScale,
      kTextColor,
      kArrowSize,
      kArrowColor
    };
    
    enum DimStyleMode {
      kLeadersOnly = 0,
      kLeadersAndDimensions
    };

    enum SectionSymLineSegmentType {
      kLineSegment = 0,
      kArcSegmentSecond,
      kArcSegmentCenter
    };

    enum UOMType {
      Each=0, sqm, sqcm, sqft, sqin, gal, qt, lqd_oz, l, ml, yd, ft, in, m, cm, mm, lb, oz, g, mg, bx
    };

    enum BOMType {
      kExpanded=0, kStructural  
    };

    enum AnnotLabelPositionType
    {
      kAnnotLabelBelow  = 1,
      kAnnotLabelAbove  = 2,
    };

    enum FilterType
    {
      kFilterBasic = 0,
      kFilterBallooned,
      kFilterCustom,
      kFilterParts,
      kFilterStdParts,
      kFilterSheet,
      kFilterView,
      kFilterRange
    };

    enum MarkStampType
    {
      kMarking = 0,
      kStamping
    };

    enum TaperDimensionType{
      kRatio = 0,
      kPercentage
    };

    enum TaperRatioFormat{
      kFraction = 0, 
      kNoFraction, 
      kNumber
    };

    enum JointType
    {
      kSoldering = 0,
      kGluing,
      kStitching,
      kOverlapping,
      kCorner
    };

    enum JointLocation
    {
      kOnArrowSide = 0,
      kOnOtherSide,
    };
      
    enum TaperSlopeSymType
    {
      kTaper1 = 0,
      kTaper2,
      kSlope1,
      kSlope2
    };

    //BomOverride type: It is used in BOM related dialogs and part reference edit dialogs.
    enum BomOverrideType{
      kNoOverride = 0,
      kQtyOverride,
      kFormulaOverride,
      kImportOverride
    };
};


#define MESSAGE(x) acadErrorStatusText(x)

#define INTERNAL_STATUS_ERROR(x) \
  acrx_abort(ACRX_T(/*MSG0*/"!%s@%d: %s"), ACRX_T(__FILE__), __LINE__, MESSAGE(x))

#define AOK(what) { Acad::ErrorStatus stat = what; \
      if (stat != Acad::eOk) INTERNAL_STATUS_ERROR(stat); }

#endif //__ACM_H
