00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DecoratorDefs_h
00009 #define DecoratorDefs_h
00010
00011 #pragma warning( disable : 4786 )
00012
00013 #include "StdAfx.h"
00014 #include "DecoratorLibResource.h"
00015
00016
00017
00018
00019
00020
00021
00022
00023 #define GME_NORTH 0 // Must match PopupPropDlg radiobutton stuff!
00024 #define GME_NORTHEAST 1
00025 #define GME_EAST 2
00026 #define GME_SOUTHEAST 3
00027 #define GME_SOUTH 4
00028 #define GME_SOUTHWEST 5
00029 #define GME_WEST 6
00030 #define GME_NORTHWEST 7
00031 #define GME_CENTER 8
00032
00033 #define GME_DYN_MENU_MINID 0x1001
00034 #define DECORATOR_CTX_MENU_MINID 0x4001
00035 #define DECORATOR_CTX_MENU_MAXID 0x4101
00036
00037 #ifndef IDC_INPLACETEXTEDIT
00038 #define IDC_INPLACETEXTEDIT 201
00039 #endif
00040
00041
00042
00043
00044
00045
00046
00047
00048 namespace DecoratorSDK
00049 {
00050 enum ELocation {
00051 L_NORTH = GME_NORTH,
00052 L_SOUTH = GME_SOUTH,
00053 L_WEST = GME_WEST,
00054 L_EAST = GME_EAST,
00055 L_SOUTHWEST = GME_SOUTHWEST,
00056 L_SOUTHEAST = GME_SOUTHEAST,
00057 L_NORTHWEST = GME_NORTHWEST,
00058 L_NORTHEAST = GME_NORTHEAST,
00059 L_CENTER = GME_CENTER
00060 };
00061
00062 enum EPrefStatus {
00063 PS_HERE = 0,
00064 PS_META = -1,
00065 PS_INHERITED = 1,
00066 PS_UNDEFINED = 2
00067 };
00068
00069 enum ResizeType {
00070 NotInResize = 0,
00071 RightEdgeResize = 1,
00072 BottomEdgeResize = 2,
00073 LeftEdgeResize = 3,
00074 TopEdgeResize = 4,
00075 TopLeftCornerResize = 5,
00076 TopRightCornerResize = 6,
00077 BottomRightCornerResize = 7,
00078 BottomLeftCornerResize = 8,
00079 MoveOperation = 9
00080 };
00081
00082 static const char* PREF_LABELLOCATION = "namePosition";
00083 static const char* PREF_ICON = "icon";
00084 static const char* PREF_PORTICON = "porticon";
00085 static const char* PREF_SUBTYPEICON = "subTypeIcon";
00086 static const char* PREF_INSTANCEICON = "instanceIcon";
00087 static const char* PREF_NULLREFICON = "nullRefIcon";
00088 static const char* PREF_OVERLAYCOLOR = "color";
00089 static const char* PREF_COLOR = "color";
00090 static const char* PREF_LABELCOLOR = "nameColor";
00091 static const char* PREF_TRANSPARENTCOLOR = "transparentColor";
00092 static const char* PREF_GRAYEDOUTCOLOR = "grayedOutColor";
00093 static const char* PREF_PORTLABELCOLOR = "portColor";
00094 static const char* PREF_PORTLABELINSIDE = "portLabelInside";
00095 static const char* PREF_TYPESHOWN = "isTypeShown";
00096 static const char* PREF_TYPEINFOSHOWN = "isTypeInfoShown";
00097 static const char* PREF_PORTLABELLENGTH = "portLabelLength";
00098 static const char* PREF_BORDERCOLOR = "borderColor";
00099 static const char* PREF_FILLCOLOR = "fillColor";
00100 static const char* PREF_GRADIENTCOLOR = "gradientColor";
00101 static const char* PREF_SHADOWCOLOR = "shadowColor";
00102
00103 static const char* PREF_LABELFONT = "labelFont";
00104 static const char* PREF_LABELLENGTH = "labelLength";
00105
00106 static const char* PREF_ICONDEFAULT = "iconDefault";
00107 static const char* PREF_TILESDEFAULT = "tilesDefault";
00108 static const char* PREF_TILESUNDEF = "tilesUndefined";
00109
00110 static const char* PREF_TILES = "tiles";
00111 static const char* PREF_LABEL = "label";
00112
00113 static const char* PREF_LABELWRAP = "nameWrap";
00114 static const char* PREF_LABELENABLED = "isNameEnabled";
00115
00116 static const char* PREF_VIOLATED = "isViolated";
00117
00118 static const char* PREF_ITEMEDITABLE = "itemEditable";
00119 static const char* PREF_ITEMRESIZABLE = "itemResizable";
00120 static const char* PREF_PREFERREDSIZE = "preferredSize";
00121 static const char* PREF_ISMASKEDBITMAP = "isMaskedBitmap";
00122 static const char* PREF_ISMODELEXPANDED = "isModelExpanded";
00123 static const char* PREF_ITEMSHADOWCAST = "itemShadowCast";
00124 static const char* PREF_SHADOWTHICKNESS = "shadowThickness";
00125 static const char* PREF_SHADOWDIRECTION = "shadowDirection";
00126 static const char* PREF_ITEMGRADIENTFILL = "gradientFill";
00127 static const char* PREF_GRADIENTDIRECTION = "gradientDirection";
00128 static const char* PREF_ROUNDCORNERRECT = "roundCornerRect";
00129 static const char* PREF_ROUNDCORNERRADIUS = "roundCornerRadius";
00130
00131 static const char* PREF_DECORATOR_MARGINX = "decoratorMarginX";
00132 static const char* PREF_DECORATOR_MARGINY = "decoratorMarginY";
00133 static const char* PREF_DECORATOR_GAPY = "decoratorGapY";
00134 static const char* PREF_DECORATOR_MINATTRSIZE = "decoratorMinAttrSize";
00135 static const char* PREF_TEXTOVERRIDE = "textOverride";
00136 static const char* PREF_TEXTCOLOROVERRIDE = "textColorOverride";
00137 static const char* PREF_MULTILINEINPLACEEDIT = "multiLineInPlaceEdit";
00138
00139 static const int FONT_LABEL = 0;
00140 static const int FONT_PORT = 1;
00141 static const int FONT_TYPE = 2;
00142 static const int FONT_PORT_OUTSIDE = 3;
00143 static const int FONT_PORTNAME = 4;
00144 static const int FONT_CONNLABEL = 5;
00145 static const int FONT_ABSTRACT = 6;
00146
00147 static const int GAP_LABEL = 2;
00148 static const int GAP_PORT = 3;
00149 static const int GAP_XMODELPORT = 4;
00150 static const int GAP_YMODELPORT = 8;
00151 static const int GAP_PORTLABEL = 20;
00152
00153 static const COLORREF COLOR_BLACK = RGB( 0x00, 0x00, 0x00 );
00154 static const COLORREF COLOR_GRAY = RGB( 0xB0, 0xB0, 0xB0 );
00155 static const COLORREF COLOR_LIGHTGRAY = RGB( 0xF3, 0xF3, 0xF3 );
00156 static const COLORREF COLOR_RED = RGB( 0xFF, 0x00, 0x00 );
00157 static const COLORREF COLOR_BLUE = RGB( 0x00, 0x00, 0xFF );
00158
00159 static const COLORREF COLOR_BKGND = RGB( 0xff, 0xff, 0xff );
00160 static const COLORREF COLOR_BORDER = RGB( 0x00, 0x00, 0x00 );
00161 static const COLORREF COLOR_MODEL = RGB( 0xc0, 0xc0, 0xc0 );
00162 static const COLORREF COLOR_NAME = RGB( 0x00, 0x00, 0x00 );
00163 static const COLORREF COLOR_PORTNAME = RGB( 0x60, 0x60, 0x60 );
00164 static const COLORREF COLOR_CONNECTION = RGB( 0x00, 0x00, 0x00 );
00165 static const COLORREF COLOR_GRID = RGB( 0xd0, 0xd0, 0xd0 );
00166 static const COLORREF COLOR_WHITE = RGB( 0xff, 0xff, 0xff );
00167 static const COLORREF COLOR_GREY = RGB( 0xc0, 0xc0, 0xc0 );
00168 static const COLORREF COLOR_GRAYED_OUT = RGB( 0xde, 0xde, 0xde );
00169 static const COLORREF COLOR_TRANSPARENT = RGB( 0xff, 0xff, 0xff );
00170
00171 static const int MAX_LABEL_LENGTH = 128;
00172 static const int MAX_TYPE_LENGTH = 180;
00173 static const int MAX_PORT_LENGTH = 3;
00174
00175 static const int WIDTH_MODEL = 113;
00176 static const int HEIGHT_MODEL = 71;
00177 static const int WIDTH_PORT = 10;
00178 static const int HEIGHT_PORT = 11;
00179 static const int WIDTH_BORDERVIOLATION = 2;
00180 static const int WIDTH_BORDERMODELBOX = 7;
00181 static const int WIDTH_MODELSIDE = 100;
00182 static const int GME_3D_BORDER_SIZE = 3;
00183 static const double INHERITANCE_RATIO = 0.86602540378443864676372317075294;
00184
00185 static const TCHAR* TILE_ATOMDEFAULT = _T("$TILE$Atom_Default");
00186 static const TCHAR* TILE_MODELDEFAULT = _T("$TILE$Model_Default");
00187 static const TCHAR* TILE_PORTDEFAULT = _T("$TILE$Port_Default");
00188
00189 static const TCHAR* CTX_MENU_STR_RENAME = _T("Rename");
00190 static const TCHAR* CTX_MENU_STR_RESETSIZE = _T("Reset to original size");
00191 static const TCHAR* CTX_MENU_STR_SETSIZE = _T("Set size");
00192 static const TCHAR* CTX_MENU_STR_EXPANDMODEL = _T("Expand model");
00193 static const TCHAR* CTX_MENU_STR_COLLAPSEMODEL = _T("Collapse model");
00194 static const unsigned int CTX_MENU_ID_RENAME = DECORATOR_CTX_MENU_MINID + 0;
00195 static const unsigned int CTX_MENU_ID_RESETSIZE = DECORATOR_CTX_MENU_MINID + 1;
00196 static const unsigned int CTX_MENU_ID_SETSIZE = DECORATOR_CTX_MENU_MINID + 2;
00197 static const unsigned int CTX_MENU_ID_EXPANDMODEL = DECORATOR_CTX_MENU_MINID + 3;
00198 static const unsigned int CTX_MENU_ID_COLLAPSEMODEL = DECORATOR_CTX_MENU_MINID + 4;
00199
00200 static const TCHAR* STEREOTYPE_LEFTA = _T("<<");
00201 static const TCHAR* STEREOTYPE_RIGHTA = _T(">>");
00202 static const wchar_t* STEREOTYPE_LEFTB = L"\u226A ";
00203 static const wchar_t* STEREOTYPE_RIGHTB = L" \u226B";
00204 static const TCHAR* ABSTRACT_ATTR = _T("IsAbstract");
00205 static const TCHAR* ATTRIBUTES_ATTR = _T("Attributes");
00206 static const TCHAR* ATTRIBUTE_SEP = _T(" : ");
00207
00208 static const int DECORATOR_MARGINX = 6;
00209 static const int DECORATOR_MARGINY = 4;
00210 static const int DECORATOR_GAPY = 0;
00211 static const int DECORATOR_MINATTRSIZE = 13;
00212 static const int DECORATOR_MINSENSITIVITYDISTANCE = 2;
00213 static const int DECORATOR_MAXSENSITIVITYDISTANCE = 6;
00214
00215 #define DEC_CONNECTED_PORTS_ONLY_PARAM _T("ConnectedPortsOnly")
00216
00217 struct GdipFont
00218 {
00219 Gdiplus::Font* gdipFont;
00220 int iSize;
00221 CString strName;
00222 bool bBoldness;
00223 bool bItalics;
00224
00225 GdipFont( const CString& _strName, int _iSize, bool _bBoldness, bool _bItalics )
00226 : gdipFont( NULL ), strName( _strName ), iSize( _iSize ), bBoldness( _bBoldness ), bItalics( _bItalics )
00227 {
00228 }
00229 };
00230
00231 struct SRGB
00232 {
00233 int r;
00234 int g;
00235 int b;
00236
00237 SRGB( int _r, int _g, int _b )
00238 : r( _r ), g( _g ), b( _b )
00239 {
00240 }
00241 };
00242
00243 struct SHSB
00244 {
00245 int h;
00246 int s;
00247 int b;
00248
00249 SHSB( int _h, int _s, int _b )
00250 : h( _h ), s( _s ), b( _b )
00251 {
00252 }
00253 };
00254
00255 SRGB CRtoRGB( COLORREF rc );
00256 SHSB CRtoHSB( COLORREF rc );
00257 SRGB HSBtoRGB( SHSB hsb );
00258 COLORREF HSBtoCR( SHSB hsb );
00259 SHSB RGBtoHSB( SRGB rgb );
00260 COLORREF RGBtoCR( SRGB rgb );
00261
00262 CString createResString( int iID );
00263
00264 };
00265
00266 #endif // DecoratorDefs_h