00001
00002
00003
00004
00005
00006
00007
00008 #include "drawRectangleEntity.h"
00009 #include "GetProperty.h"
00010 #include "Xcall1.h"
00011 #include "clipping.h"
00012 #include "drawMarks.h"
00013 #include "periScreen.h"
00014
00015
00016 int drawRectangleEntity( sciPointObj * pObj )
00017 {
00018 sciRectangle * ppRect = pRECTANGLE_FEATURE( pObj ) ;
00019 sciPointObj * parentSubWin = sciGetParentSubwin(pObj) ;
00020
00021 double ulPoint[3] = { ppRect->x, ppRect->y, ppRect->z } ;
00022 double rectSize[2] = { ppRect->width, ppRect->height } ;
00023 int rectEdgesX[4] ;
00024 int rectEdgesY[4] ;
00025 int lineWidth = sciGetLineWidth(pObj) ;
00026 int lineStyle = sciGetLineStyle(pObj) ;
00027 int v = 0 ;
00028 double dv = 0.0 ;
00029 int DPI[2] ;
00030
00031 if (!sciGetVisibility(pObj)) { return 0 ; }
00032
00033 GetDPIFromDriver(DPI) ;
00034
00035 #ifdef _MSC_VER
00036 flag_DO = MaybeSetWinhdc ();
00037 #endif
00038
00039 C2F (dr) ("xset", "thickness", &lineWidth, PI0, PI0, PI0, PI0, PI0, PD0,
00040 PD0, PD0, PD0, 0L, 0L);
00041 C2F (dr) ("xset", "line style", &lineStyle, PI0, PI0, PI0, PI0, PI0, PD0,
00042 PD0, PD0, PD0, 0L, 0L);
00043
00044 #ifdef _MSC_VER
00045 if ( flag_DO == 1) { ReleaseWinHdc () ; }
00046 #endif
00047
00048
00049 rectangleDouble2Pixel( parentSubWin,
00050 ulPoint ,
00051 rectSize ,
00052 rectEdgesX ,
00053 rectEdgesY ) ;
00054
00056 if ( !sciGetIs3d(parentSubWin) )
00057 {
00058 int rectPixPosX ;
00059 int rectPixPosY ;
00060 int rectPixWidth ;
00061 int rectPixHeight ;
00062
00063
00064 rectPixPosX = rectEdgesX[0] ;
00065 rectPixPosY = rectEdgesY[0] ;
00066 rectPixWidth = rectEdgesX[2] - rectEdgesX[0] ;
00067 rectPixHeight = rectEdgesY[2] - rectEdgesY[0] ;
00068
00069 if ( ppRect->strwidth == 0 )
00070 {
00071 ppRect->strwidth = rectPixWidth ;
00072 ppRect->strheight = rectPixHeight ;
00073
00074 }
00075
00076
00077 #ifdef _MSC_VER
00078 flag_DO = MaybeSetWinhdc ();
00079 #endif
00080 sciClip(pObj);
00081
00082 if( sciGetIsFilled(pObj) )
00083 {
00084
00085 int background = sciGetBackground(pObj) ;
00086 C2F (dr) ("xset", "dashes", &background, &background, &v, &v, &v, &v,
00087 &dv, &dv, &dv, &dv, 5L, 6L);
00088 C2F (dr) ("xset", "foreground", &background, &background, &v, &v, &v,&v,
00089 &dv, &dv, &dv, &dv, 5L, 10L );
00090 C2F(dr)("xfrect","xv",&rectPixPosX,&rectPixPosY,&rectPixWidth,&rectPixHeight,PI0,PI0,PD0,PD0,PD0,PD0,6L,2L);
00091 }
00092
00093 if( sciGetIsMark(pObj) )
00094 {
00095 int markForeground = sciGetMarkForeground(pObj) ;
00096 int markStyle = sciGetMarkStyle(pObj) ;
00097 int markSize = sciGetMarkSize(pObj) ;
00098 int xtmp[4] ;
00099 int ytmp[4] ;
00100 int nbMarks = 4 ;
00101
00102 C2F (dr) ("xset", "dashes", &markForeground, &markForeground, &v, &v, &v, &v, &dv,
00103 &dv, &dv, &dv, 5L, 4096);
00104 C2F (dr) ("xset", "foreground", &markForeground, &markForeground, &v, &v, &v, &v,
00105 &dv, &dv, &dv, &dv, 5L, 4096);
00106
00107 C2F (dr) ("xset", "mark", &markStyle, &markSize, PI0, PI0, PI0, PI0, PD0, PD0,
00108 PD0, PD0, 0L, 0L);
00109
00110 xtmp[0] = rectPixPosX ;
00111 xtmp[1] = rectPixPosX + rectPixWidth ;
00112 xtmp[2] = rectPixPosX + rectPixWidth ;
00113 xtmp[3] = rectPixPosX ;
00114 ytmp[0] = rectPixPosY ;
00115 ytmp[1] = rectPixPosY ;
00116 ytmp[2] = rectPixPosY + rectPixHeight ;
00117 ytmp[3] = rectPixPosY + rectPixHeight ;
00118
00119 DrawNewMarks(pObj,nbMarks,xtmp,ytmp,DPI);
00120 }
00121
00122 if ( sciGetIsLine(pObj) )
00123 {
00124 int foreground = sciGetForeground(pObj) ;
00125
00126 C2F (dr) ("xset", "dashes", &foreground, &foreground, &v, &v, &v, &v, &dv,
00127 &dv, &dv, &dv, 5L, 4096);
00128 C2F (dr) ("xset", "foreground", &foreground, &foreground, &v, &v, &v, &v,
00129 &dv, &dv, &dv, &dv, 5L, 4096);
00130 C2F (dr) ("xset", "thickness", &lineWidth, PI0, PI0, PI0, PI0, PI0, PD0,
00131 PD0, PD0, PD0, 0L, 0L);
00132 C2F (dr) ("xset", "line style", &lineStyle, PI0, PI0, PI0, PI0, PI0, PD0,
00133 PD0, PD0, PD0, 0L, 0L);
00134
00135
00136 if (ppRect->str == 1)
00137 {
00138 rectPixPosY -= ppRect->strheight;
00139 C2F(dr)("xrect","xv",&rectPixPosX,&rectPixPosY,&(ppRect->strwidth),&(ppRect->strheight),PI0,PI0,PD0,PD0,PD0,PD0,5L,2L);
00140 }
00141 else
00142 {
00143 C2F(dr)("xrect","xv",&rectPixPosX,&rectPixPosY,&rectPixWidth,&rectPixHeight,PI0,PI0,PD0,PD0,PD0,PD0,5L,2L);
00144 }
00145 }
00146
00147 sciUnClip(pObj);
00148 #ifdef _MSC_VER
00149 if ( flag_DO == 1) { ReleaseWinHdc() ; }
00150 #endif
00151 }
00152 else
00153 {
00154 int close = 1 ;
00155 int nbVertices = 4 ;
00156
00157 #ifdef _MSC_VER
00158 flag_DO = MaybeSetWinhdc ();
00159 #endif
00160 sciClip(pObj);
00161
00162
00163 if( sciGetIsFilled(pObj) )
00164 {
00165 int background = sciGetBackground(pObj) ;
00166 C2F (dr) ("xset", "dashes", &background, &background, &v, &v, &v, &v,
00167 &dv, &dv, &dv, &dv, 5L, 6L);
00168 C2F (dr) ("xset", "foreground", &background, &background, &v, &v, &v,&v,
00169 &dv, &dv, &dv, &dv, 5L, 10L );
00170 C2F (dr) ("xarea", "xv", &nbVertices, rectEdgesX, rectEdgesY, &close, PI0, PI0, PD0, PD0, PD0, PD0, 5L,2L);
00171 }
00172
00173 if ( sciGetIsMark(pObj) )
00174 {
00175 int markForeground = sciGetMarkForeground(pObj) ;
00176 int markStyle = sciGetMarkStyle(pObj) ;
00177 int markSize = sciGetMarkSize(pObj) ;
00178
00179 C2F (dr) ("xset", "dashes", &markForeground, &markForeground, &v, &v, &v, &v, &dv,
00180 &dv, &dv, &dv, 5L, 4096);
00181 C2F (dr) ("xset", "foreground", &markForeground, &markForeground, &v, &v, &v, &v,
00182 &dv, &dv, &dv, &dv, 5L, 4096);
00183
00184 C2F (dr) ("xset", "mark", &markStyle, &markSize, PI0, PI0, PI0, PI0, PD0, PD0,
00185 PD0, PD0, 0L, 0L);
00186
00187
00188 DrawNewMarks(pObj,nbVertices,rectEdgesX,rectEdgesY,DPI);
00189 }
00190
00191 if ( sciGetIsLine(pObj) )
00192 {
00193 int foreground = sciGetForeground(pObj) ;
00194 C2F (dr) ("xset", "dashes", &foreground, &foreground, &v, &v, &v, &v, &dv,
00195 &dv, &dv, &dv, 5L, 4096);
00196 C2F (dr) ("xset", "foreground", &foreground, &foreground, &v, &v, &v, &v,
00197 &dv, &dv, &dv, &dv, 5L, 4096);
00198 C2F (dr) ("xset", "thickness", &lineWidth, PI0, PI0, PI0, PI0, PI0, PD0,
00199 PD0, PD0, PD0, 0L, 0L);
00200 C2F (dr) ("xset", "line style", &lineStyle, PI0, PI0, PI0, PI0, PI0, PD0,
00201 PD0, PD0, PD0, 0L, 0L);
00202
00203 C2F (dr) ("xlines", "xv", &nbVertices, rectEdgesX, rectEdgesY, &close, PI0, PI0, PD0, PD0, PD0, PD0,6L,2L);
00204 }
00205
00206 sciUnClip(pObj);
00207 #ifdef _MSC_VER
00208 if ( flag_DO == 1) { ReleaseWinHdc () ; }
00209 #endif
00210 }
00211
00212 return 0 ;
00213 }
00214