diff --git a/src/add-ons/decorators/BeDecorator/BeDecorator.cpp b/src/add-ons/decorators/BeDecorator/BeDecorator.cpp index 792c23df37..405543233c 100644 --- a/src/add-ons/decorators/BeDecorator/BeDecorator.cpp +++ b/src/add-ons/decorators/BeDecorator/BeDecorator.cpp @@ -21,7 +21,7 @@ // // File Name: BeDecorator.cpp // Author: DarkWyrm -// Description: Decorator in the style of BeOS R5 +// Description: Fallback decorator for the app_server // //------------------------------------------------------------------------------ #include @@ -30,10 +30,10 @@ #include "LayerData.h" #include "ColorUtils.h" #include "BeDecorator.h" +#include "PatternHandler.h" #include "RGBColor.h" - -//#define DEBUG_DECORATOR - +#include "RectUtils.h" +#include #define USE_VIEW_FILL_HACK @@ -44,28 +44,23 @@ BeDecorator::BeDecorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags) : Decorator(rect,wlook,wfeel,wflags) { + taboffset=0; titlepixelwidth=0; + framecolors=new RGBColor[5]; + framecolors[0].SetColor(255,255,255); + framecolors[1].SetColor(216,216,216); + framecolors[2].SetColor(152,152,152); + framecolors[3].SetColor(136,136,136); + framecolors[4].SetColor(96,96,96); + _SetFocus(); - // These hard-coded assignments will go bye-bye when the system _colors - // API is implemented - frame_highercol.SetColor(216,216,216); - frame_lowercol.SetColor(110,110,110); - - textcol.SetColor(0,0,0); - - frame_highcol=frame_lowercol.MakeBlendColor(frame_highercol,0.75); - frame_midcol=frame_lowercol.MakeBlendColor(frame_highercol,0.5); - frame_lowcol=frame_lowercol.MakeBlendColor(frame_highercol,0.25); - _DoLayout(); // This flag is used to determine whether or not we're moving the tab slidetab=false; - solidhigh=0xFFFFFFFFFFFFFFFFLL; - solidlow=0; // tab_highcol=_colors->window_tab; // tab_lowcol=_colors->window_tab; @@ -81,6 +76,7 @@ BeDecorator::~BeDecorator(void) #ifdef DEBUG_DECORATOR printf("BeDecorator: ~BeDecorator()\n"); #endif + delete [] framecolors; } click_type BeDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers) @@ -184,14 +180,48 @@ printf("BeDecorator: Do Layout\n"); _borderrect=_frame; _closerect=_frame; + + switch(GetLook()) + { + case B_FLOATING_WINDOW_LOOK: + case B_MODAL_WINDOW_LOOK: + + // We're going to make the frame 5 pixels wide, no matter what. R5's decorator frame + // requires the skills of a gaming master to click on the tiny frame if resizing is necessary, + // and there *are* apps which do this +// borderwidth=3; +// break; + case B_BORDERED_WINDOW_LOOK: + case B_TITLED_WINDOW_LOOK: + case B_DOCUMENT_WINDOW_LOOK: + borderwidth=5; + break; + default: + borderwidth=0; + } + textoffset=(_look==B_FLOATING_WINDOW_LOOK)?5:7; _closerect.left+=(_look==B_FLOATING_WINDOW_LOOK)?2:4; _closerect.top+=(_look==B_FLOATING_WINDOW_LOOK)?6:4; _closerect.right=_closerect.left+10; _closerect.bottom=_closerect.top+10; - + + _borderrect.top+=19; + + if(borderwidth) + { + // Set up the border rectangles to handle the window's frame + rightborder=leftborder=topborder=bottomborder=_borderrect; + + // We want the rectangles to intersect because of the beveled intersections, so all + // that is necessary is to set the short dimension of each side + leftborder.right=leftborder.left+borderwidth; + rightborder.left=rightborder.right-borderwidth; + topborder.bottom=topborder.top+borderwidth; + bottomborder.top=bottomborder.bottom-borderwidth; + } _resizerect.top=_resizerect.bottom-18; _resizerect.left=_resizerect.right-18; @@ -307,9 +337,10 @@ printf("BeDecorator: Draw(%.1f,%.1f,%.1f,%.1f)\n",update.left,update.top,update. _layerdata.highcolor=_colors->document_background; if(_borderrect.Intersects(update)) - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_borderrect & update,&_layerdata,pat_solidhigh); _DrawFrame(update); + } void BeDecorator::Draw(void) @@ -318,13 +349,13 @@ void BeDecorator::Draw(void) // things // Draw the top view's client area - just a hack :) - _layerdata.highcolor=_colors->document_background; +// _layerdata.highcolor=_colors->document_background; + +// _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); DrawFrame(); DrawTab(); - } void BeDecorator::_DrawZoom(BRect r) @@ -353,9 +384,9 @@ void BeDecorator::_DrawTab(BRect r) return; _layerdata.highcolor=(GetFocus())?_colors->window_tab:_colors->inactive_window_tab; - _driver->FillRect(_tabrect,&_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_lowcol; - _driver->StrokeLine(_tabrect.LeftBottom(),_tabrect.RightBottom(),&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_tabrect,&_layerdata,pat_solidhigh); + _layerdata.highcolor=framecolors[3]; + _driver->StrokeLine(_tabrect.LeftBottom(),_tabrect.RightBottom(),&_layerdata,pat_solidhigh); _DrawTitle(_tabrect); @@ -409,7 +440,7 @@ void BeDecorator::DrawBlendedRect(BRect r, bool down) uint8(startcol.blue-(i*bstep))); _layerdata.highcolor=tmpcol; _driver->StrokeLine(BPoint(r.left,r.top+i), - BPoint(r.left+i,r.top),&_layerdata,(int8*)&solidhigh); + BPoint(r.left+i,r.top),&_layerdata,pat_solidhigh); SetRGBColor(&tmpcol, uint8(halfcol.red-(i*rstep)), uint8(halfcol.green-(i*gstep)), @@ -417,99 +448,350 @@ void BeDecorator::DrawBlendedRect(BRect r, bool down) _layerdata.highcolor=tmpcol; _driver->StrokeLine(BPoint(r.left+steps,r.top+i), - BPoint(r.left+i,r.top+steps),&_layerdata,(int8*)&solidhigh); + BPoint(r.left+i,r.top+steps),&_layerdata,pat_solidhigh); } // _layerdata.highcolor=startcol; -// _driver->FillRect(r,&_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_lowcol; - _driver->StrokeRect(r,&_layerdata,(int8*)&solidhigh); +// _driver->FillRect(r,&_layerdata,pat_solidhigh); + _layerdata.highcolor=framecolors[3]; + _driver->StrokeRect(r,&_layerdata,pat_solidhigh); } -void BeDecorator::_DrawFrame(BRect rect) +void BeDecorator::_DrawFrame(BRect invalid) { - // Duh, draws the window frame, I think. ;) -#ifdef USE_VIEW_FILL_HACK -_driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); -#endif + // We need to test each side to determine whether or not it needs drawn. Additionally, + // we must clip the lines drawn by this function to the invalid rectangle we are given + + #ifdef USE_VIEW_FILL_HACK + _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); + #endif - if(_look==B_NO_BORDER_WINDOW_LOOK) + if(!borderwidth) return; - BRect r=_borderrect; + // Data specifically for the StrokeLineArray call. + int32 numlines=0, maxlines=20; - _layerdata.highcolor=frame_midcol; - _driver->StrokeLine(BPoint(r.left,r.top),BPoint(r.right-1,r.top), - &_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_lowcol; - _driver->StrokeLine(BPoint(r.left,r.top),BPoint(r.left,r.bottom), - &_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_lowercol; - _driver->StrokeLine(BPoint(r.right,r.bottom),BPoint(r.right,r.top), - &_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_lowercol; - _driver->StrokeLine(BPoint(r.right,r.bottom),BPoint(r.left,r.bottom), - &_layerdata,(int8*)&solidhigh); - - r.InsetBy(1,1); - _layerdata.highcolor=frame_highercol; - _driver->StrokeLine(BPoint(r.left,r.top),BPoint(r.right-1,r.top), - &_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_highercol; - _driver->StrokeLine(BPoint(r.left,r.top),BPoint(r.left,r.bottom), - &_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_midcol; - _driver->StrokeLine(BPoint(r.right,r.bottom),BPoint(r.right,r.top), - &_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_midcol; - _driver->StrokeLine(BPoint(r.right,r.bottom),BPoint(r.left,r.bottom), - &_layerdata,(int8*)&solidhigh); + BPoint points[maxlines*2]; + RGBColor colors[maxlines]; - r.InsetBy(1,1); - _layerdata.highcolor=frame_highcol; - _driver->StrokeRect(r,&_layerdata,(int8*)&solidhigh); + // For quick calculation of gradients for each side. Top is same as left, right is same as + // bottom +// int8 rightindices[borderwidth],leftindices[borderwidth]; + int8 *rightindices=new int8[borderwidth], + *leftindices=new int8[borderwidth]; + + if(borderwidth==5) + { + leftindices[0]=2; + leftindices[1]=0; + leftindices[2]=1; + leftindices[3]=3; + leftindices[4]=2; - r.InsetBy(1,1); - _layerdata.highcolor=frame_lowercol; - _driver->StrokeLine(BPoint(r.left,r.top),BPoint(r.right-1,r.top), - &_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_lowercol; - _driver->StrokeLine(BPoint(r.left,r.top),BPoint(r.left,r.bottom), - &_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_highercol; - _driver->StrokeLine(BPoint(r.right,r.bottom),BPoint(r.right,r.top), - &_layerdata,(int8*)&solidhigh); - _layerdata.highcolor=frame_highercol; - _driver->StrokeLine(BPoint(r.right,r.bottom),BPoint(r.left,r.bottom), - &_layerdata,(int8*)&solidhigh); - _driver->StrokeRect(_borderrect,&_layerdata,(int8*)&solidhigh); + rightindices[0]=2; + rightindices[1]=0; + rightindices[2]=1; + rightindices[3]=3; + rightindices[4]=4; + } + else + { + // TODO: figure out border colors for floating window look + leftindices[0]=2; + leftindices[1]=2; + leftindices[2]=1; + leftindices[3]=1; + leftindices[4]=4; + rightindices[0]=2; + rightindices[1]=2; + rightindices[2]=1; + rightindices[3]=1; + rightindices[4]=4; + } + + // Variables used in each calculation + int32 startx,endx,starty,endy,i; + bool topcorner,bottomcorner,leftcorner,rightcorner; + int8 step,colorindex; + BRect r; + BPoint start, end; + + // Right side + if(TestRectIntersection(rightborder,invalid)) + { + + // We may not have to redraw the entire width of the frame itself. Rare case, but + // it must be accounted for. + startx=(int32) MAX(invalid.left,rightborder.left); + endx=(int32) MIN(invalid.right,rightborder.right); + + // We'll need these flags to see if we must include the corners in final line + // calculations + r=(rightborder); + r.bottom=r.top+borderwidth; + topcorner=TestRectIntersection(invalid,r); + + r=rightborder; + r.top=r.bottom-borderwidth; + bottomcorner=TestRectIntersection(invalid,r); + step=(borderwidth==5)?1:2; + colorindex=0; + + // Generate the lines for this side + for(i=startx+1; i<=endx; i++) + { + start.x=end.x=i; + + if(topcorner) + { + start.y=rightborder.top+(borderwidth-(i-rightborder.left)); + start.y=MAX(start.y,invalid.top); + } + else + start.y=MAX(start.y+borderwidth,invalid.top); + + if(bottomcorner) + { + end.y=rightborder.bottom-(borderwidth-(i-rightborder.left)); + end.y=MIN(end.y,invalid.bottom); + } + else + end.y=MIN(end.y-borderwidth,invalid.bottom); + + // Make the appropriate + points[numlines*2]=start; + points[(numlines*2)+1]=end; + colors[numlines]=framecolors[rightindices[colorindex]]; + colorindex+=step; + numlines++; + } + } + + // Left side + if(TestRectIntersection(leftborder,invalid)) + { + + // We may not have to redraw the entire width of the frame itself. Rare case, but + // it must be accounted for. + startx=(int32) MAX(invalid.left,leftborder.left); + endx=(int32) MIN(invalid.right,leftborder.right); + + // We'll need these flags to see if we must include the corners in final line + // calculations + r=leftborder; + r.bottom=r.top+borderwidth; + topcorner=TestRectIntersection(invalid,r); + + r=leftborder; + r.top=r.bottom-borderwidth; + bottomcorner=TestRectIntersection(invalid,r); + step=(borderwidth==5)?1:2; + colorindex=0; + + // Generate the lines for this side + for(i=startx; iStrokeLineArray(points,numlines,colors,&_layerdata); + + delete rightindices; + delete leftindices; + // Draw the resize thumb if we're supposed to if(!(_flags & B_NOT_RESIZABLE)) { r=_resizerect; - int32 w=r.IntegerWidth(), h=r.IntegerHeight(); +// int32 w=r.IntegerWidth(), h=r.IntegerHeight(); // This code is strictly for B_DOCUMENT_WINDOW looks if(_look==B_DOCUMENT_WINDOW_LOOK) { + r.right-=4; + r.bottom-=4; + _layerdata.highcolor=framecolors[2]; + + _driver->StrokeLine(r.LeftTop(),r.RightTop(),&_layerdata,pat_solidhigh); + _driver->StrokeLine(r.LeftTop(),r.LeftBottom(),&_layerdata,pat_solidhigh); + + r.OffsetBy(1,1); + _layerdata.highcolor=framecolors[0]; + _driver->StrokeLine(r.LeftTop(),r.RightTop(),&_layerdata,pat_solidhigh); + _driver->StrokeLine(r.LeftTop(),r.LeftBottom(),&_layerdata,pat_solidhigh); + + r.OffsetBy(1,1); + _layerdata.highcolor=framecolors[1]; + _driver->FillRect(r,&_layerdata,pat_solidhigh); + +/* r.left+=2; + r.top+=2; + r.right-=3; + r.bottom-=3; +*/ + r.right-=2; + r.bottom-=2; + int32 w=r.IntegerWidth(), h=r.IntegerHeight(); + rgb_color halfcol, startcol, endcol; float rstep,gstep,bstep,i; int steps=(wLock(); for(i=0;i<=steps; i++) { _layerdata.highcolor.SetColor(uint8(startcol.red-(i*rstep)), @@ -517,24 +799,25 @@ _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); uint8(startcol.blue-(i*bstep))); _driver->StrokeLine(BPoint(r.left,r.top+i), - BPoint(r.left+i,r.top),&_layerdata,(int8*)&solidhigh); + BPoint(r.left+i,r.top),&_layerdata,pat_solidhigh); _layerdata.highcolor.SetColor(uint8(halfcol.red-(i*rstep)), uint8(halfcol.green-(i*gstep)), uint8(halfcol.blue-(i*bstep))); _driver->StrokeLine(BPoint(r.left+steps,r.top+i), - BPoint(r.left+i,r.top+steps),&_layerdata,(int8*)&solidhigh); + BPoint(r.left+i,r.top+steps),&_layerdata,pat_solidhigh); } - _layerdata.highcolor=frame_lowercol; - _driver->StrokeRect(r,&_layerdata,(int8*)&solidhigh); + _driver->Unlock(); +// _layerdata.highcolor=framecolors[4]; +// _driver->StrokeRect(r,&_layerdata,pat_solidhigh); } else { - _layerdata.highcolor=frame_lowercol; + _layerdata.highcolor=framecolors[4]; _driver->StrokeLine(BPoint(r.right,r.top),BPoint(r.right-3,r.top), - &_layerdata,(int8*)&solidhigh); + &_layerdata,pat_solidhigh); _driver->StrokeLine(BPoint(r.left,r.bottom),BPoint(r.left,r.bottom-3), - &_layerdata,(int8*)&solidhigh); + &_layerdata,pat_solidhigh); } } } diff --git a/src/add-ons/decorators/BeDecorator/BeDecorator.h b/src/add-ons/decorators/BeDecorator/BeDecorator.h index 02479c43bc..44526ec09e 100644 --- a/src/add-ons/decorators/BeDecorator/BeDecorator.h +++ b/src/add-ons/decorators/BeDecorator/BeDecorator.h @@ -19,13 +19,13 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // -// File Name: BeDecorator.cpp +// File Name: BeDecorator.h // Author: DarkWyrm -// Description: Decorator in the style of BeOS R5 +// Description: Fallback decorator for the app_server // //------------------------------------------------------------------------------ -#ifndef _BE_DECORATOR_H_ -#define _BE_DECORATOR_H_ +#ifndef _DEFAULT_DECORATOR_H_ +#define _DEFAULT_DECORATOR_H_ #include "Decorator.h" #include @@ -59,7 +59,14 @@ protected: RGBColor frame_highcol, frame_midcol, frame_lowcol, frame_highercol, frame_lowercol; RGBColor textcol; + + RGBColor *framecolors; + + // Individual rects for handling window frame rendering the proper way + BRect rightborder,leftborder,topborder,bottomborder; uint64 solidhigh, solidlow; + + int32 borderwidth; bool slidetab; int textoffset; diff --git a/src/add-ons/decorators/MacDecorator/MacDecorator.cpp b/src/add-ons/decorators/MacDecorator/MacDecorator.cpp index a1fd94c692..e77ed421db 100644 --- a/src/add-ons/decorators/MacDecorator/MacDecorator.cpp +++ b/src/add-ons/decorators/MacDecorator/MacDecorator.cpp @@ -4,6 +4,7 @@ #include "ColorUtils.h" #include "MacDecorator.h" #include "RGBColor.h" +#include "PatternHandler.h" //#define DEBUG_DECOR @@ -33,8 +34,6 @@ printf("MacDecorator()\n"); _DoLayout(); textoffset=5; - solidhigh=0xFFFFFFFFFFFFFFFFLL; - solidlow=0; } MacDecorator::~MacDecorator(void) @@ -183,10 +182,10 @@ printf("MacDecorator::Draw(): "); update.PrintToStream(); #endif // Draw the top view's client area - just a hack :) _layerdata.highcolor=_colors->document_background; - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); if(_borderrect.Intersects(update)) - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); _DrawFrame(update); _DrawTab(update); @@ -203,9 +202,9 @@ printf("MacDecorator::Draw()\n"); // _layerdata.highcolor=blue; _layerdata.highcolor=_colors->document_background; - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); DrawFrame(); DrawTab(); @@ -222,25 +221,25 @@ void MacDecorator::_DrawZoom(BRect r) pt2.x--; _layerdata.highcolor.SetColor(136,136,136); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt2=r.LeftBottom(); pt2.y--; - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt=r.RightBottom(); pt2=r.RightTop(); pt2.y++; _layerdata.highcolor.SetColor(255,255,255); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt2=r.LeftBottom(); pt2.x++; - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); rect.InsetBy(1,1); _layerdata.highcolor.SetColor(0,0,0); - _driver->StrokeRect(rect,&_layerdata,(int8*)&solidhigh); + _driver->StrokeRect(rect,&_layerdata,pat_solidhigh); rect.InsetBy(1,1); DrawBlendedRect(rect,down); @@ -252,7 +251,7 @@ void MacDecorator::_DrawZoom(BRect r) rect.right++; _layerdata.highcolor.SetColor(0,0,0); - _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,pat_solidhigh); } void MacDecorator::_DrawClose(BRect r) @@ -266,25 +265,25 @@ void MacDecorator::_DrawClose(BRect r) pt2.x--; _layerdata.highcolor.SetColor(136,136,136); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt2=r.LeftBottom(); pt2.y--; - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt=r.RightBottom(); pt2=r.RightTop(); pt2.y++; _layerdata.highcolor.SetColor(255,255,255); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt2=r.LeftBottom(); pt2.x++; - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); rect.InsetBy(1,1); _layerdata.highcolor.SetColor(0,0,0); - _driver->StrokeRect(rect,&_layerdata,(int8*)&solidhigh); + _driver->StrokeRect(rect,&_layerdata,pat_solidhigh); rect.InsetBy(1,1); DrawBlendedRect(rect,down); @@ -296,7 +295,7 @@ void MacDecorator::_DrawClose(BRect r) // rect.right--; // _layerdata.highcolor.SetColor(0,0,0); -// _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,(int8*)&solidhigh); +// _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,pat_solidhigh); } void MacDecorator::_DrawMinimize(BRect r) @@ -310,25 +309,25 @@ void MacDecorator::_DrawMinimize(BRect r) pt2.x--; _layerdata.highcolor.SetColor(136,136,136); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt2=r.LeftBottom(); pt2.y--; - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt=r.RightBottom(); pt2=r.RightTop(); pt2.y++; _layerdata.highcolor.SetColor(255,255,255); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt2=r.LeftBottom(); pt2.x++; - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); rect.InsetBy(1,1); _layerdata.highcolor.SetColor(0,0,0); - _driver->StrokeRect(rect,&_layerdata,(int8*)&solidhigh); + _driver->StrokeRect(rect,&_layerdata,pat_solidhigh); rect.InsetBy(1,1); DrawBlendedRect(rect,down); @@ -340,7 +339,7 @@ void MacDecorator::_DrawMinimize(BRect r) rect.InsetBy(-2,0); _layerdata.highcolor.SetColor(0,0,0); - _driver->StrokeRect(rect,&_layerdata,(int8*)&solidhigh); + _driver->StrokeRect(rect,&_layerdata,pat_solidhigh); } void MacDecorator::_DrawTab(BRect r) @@ -351,29 +350,29 @@ void MacDecorator::_DrawTab(BRect r) return; // _layerdata.highcolor=frame_lowcol; -// _driver->StrokeRect(_tabrect,&_layerdata,(int8*)&solidhigh); +// _driver->StrokeRect(_tabrect,&_layerdata,pat_solidhigh); // UpdateTitle(layer->name->String()); BRect rect(_tabrect); _layerdata.highcolor.SetColor(frame_midcol); - _driver->FillRect(rect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(rect,&_layerdata,pat_solidhigh); if(GetFocus()) { _layerdata.highcolor.SetColor(frame_lowercol); - _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,(int8*)&solidhigh); - _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),&_layerdata,(int8*)&solidhigh); - _driver->StrokeLine(rect.RightBottom(),rect.RightTop(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,pat_solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),&_layerdata,pat_solidhigh); + _driver->StrokeLine(rect.RightBottom(),rect.RightTop(),&_layerdata,pat_solidhigh); rect.InsetBy(1,1); rect.bottom++; _layerdata.highcolor.SetColor(frame_highcol); - _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,(int8*)&solidhigh); - _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,pat_solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),&_layerdata,pat_solidhigh); _layerdata.highcolor.SetColor(frame_lowcol); - _driver->StrokeLine(rect.RightBottom(),rect.RightTop(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.RightBottom(),rect.RightTop(),&_layerdata,pat_solidhigh); // Draw the neat little lines on either side of the title if there's room if((_tabrect.left+textoffset)>(_closerect.right+5)) @@ -385,7 +384,7 @@ void MacDecorator::_DrawTab(BRect r) _layerdata.highcolor.SetColor(frame_highcol); for(int32 i=0;i<6;i++) { - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.y+=2; pt2.y+=2; } @@ -395,7 +394,7 @@ void MacDecorator::_DrawTab(BRect r) _layerdata.highcolor.SetColor(frame_lowcol); for(int32 i=0;i<6;i++) { - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.y+=2; pt2.y+=2; } @@ -409,7 +408,7 @@ void MacDecorator::_DrawTab(BRect r) _layerdata.highcolor.SetColor(frame_highcol); for(int32 i=0;i<6;i++) { - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.y+=2; pt2.y+=2; } @@ -418,7 +417,7 @@ void MacDecorator::_DrawTab(BRect r) _layerdata.highcolor.SetColor(frame_lowcol); for(int32 i=0;i<6;i++) { - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.y+=2; pt2.y+=2; } @@ -474,7 +473,7 @@ void MacDecorator::DrawBlendedRect(BRect r, bool down) uint8(startcol.blue-(i*bstep))); _layerdata.highcolor=tmpcol; _driver->StrokeLine(BPoint(rect.left,rect.top+i), - BPoint(rect.left+i,rect.top),&_layerdata,(int8*)&solidhigh); + BPoint(rect.left+i,rect.top),&_layerdata,pat_solidhigh); SetRGBColor(&tmpcol, uint8(halfcol.red-(i*rstep)), uint8(halfcol.green-(i*gstep)), @@ -482,17 +481,17 @@ void MacDecorator::DrawBlendedRect(BRect r, bool down) _layerdata.highcolor=tmpcol; _driver->StrokeLine(BPoint(rect.left+steps,rect.top+i), - BPoint(rect.left+i,rect.top+steps),&_layerdata,(int8*)&solidhigh); + BPoint(rect.left+i,rect.top+steps),&_layerdata,pat_solidhigh); } } - +/* void MacDecorator::_SetColors(void) { _SetFocus(); } - +*/ void MacDecorator::_DrawFrame(BRect rect) { if(_look==B_NO_BORDER_WINDOW_LOOK) @@ -506,28 +505,28 @@ void MacDecorator::_DrawFrame(BRect rect) // Draw the left side of the frame _layerdata.highcolor.SetColor(frame_lowercol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x++; pt2.x++; pt2.y--; _layerdata.highcolor.SetColor(frame_highcol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x++; pt2.x++; pt2.y--; _layerdata.highcolor.SetColor(frame_midcol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x++; pt2.x++; - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x++; pt2.x++; pt2.y--; _layerdata.highcolor.SetColor(frame_lowcol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x++; pt.y+=2; topleftpt=pt; @@ -535,7 +534,7 @@ void MacDecorator::_DrawFrame(BRect rect) pt2.y--; _layerdata.highcolor.SetColor(frame_lowercol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt=r.RightTop(); @@ -543,42 +542,42 @@ void MacDecorator::_DrawFrame(BRect rect) // Draw the right side of the frame _layerdata.highcolor.SetColor(frame_lowercol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x--; pt2.x--; _layerdata.highcolor.SetColor(frame_lowcol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x--; pt2.x--; _layerdata.highcolor.SetColor(frame_midcol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x--; pt2.x--; - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x--; pt2.x--; _layerdata.highcolor.SetColor(frame_highcol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x--; pt.y+=2; toprightpt=pt; pt2.x--; _layerdata.highcolor.SetColor(frame_lowercol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); // Draw the top side of the frame that is not in the tab _layerdata.highcolor.SetColor(frame_lowercol); - _driver->StrokeLine(topleftpt,toprightpt,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(topleftpt,toprightpt,&_layerdata,pat_solidhigh); topleftpt.y--; toprightpt.x++; toprightpt.y--; _layerdata.highcolor.SetColor(frame_lowcol); - _driver->StrokeLine(topleftpt,toprightpt,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(topleftpt,toprightpt,&_layerdata,pat_solidhigh); pt=r.RightTop(); pt2=r.RightBottom(); @@ -589,41 +588,41 @@ void MacDecorator::_DrawFrame(BRect rect) // Draw the bottom side of the frame _layerdata.highcolor.SetColor(frame_lowercol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x++; pt.y--; pt2.x--; pt2.y--; _layerdata.highcolor.SetColor(frame_lowcol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x++; pt.y--; pt2.x--; pt2.y--; _layerdata.highcolor.SetColor(frame_midcol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x++; pt.y--; pt2.x--; pt2.y--; - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x++; pt.y--; pt2.x--; pt2.y--; _layerdata.highcolor.SetColor(frame_highcol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.x+=2; pt.y--; pt2.x--; pt2.y--; _layerdata.highcolor.SetColor(frame_lowercol); - _driver->StrokeLine(pt,pt2,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,pt2,&_layerdata,pat_solidhigh); pt.y--; pt2.x--; pt2.y--; @@ -636,5 +635,5 @@ extern "C" float get_decorator_version(void) extern "C" Decorator *instantiate_decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags) { - return new MacDecorator(rect,wlook,wfeel,wflags); -} \ No newline at end of file + return (new MacDecorator(rect,wlook,wfeel,wflags)); +} diff --git a/src/add-ons/decorators/MacDecorator/MacDecorator.h b/src/add-ons/decorators/MacDecorator/MacDecorator.h index 5c4d915f15..ffe5823a1e 100644 --- a/src/add-ons/decorators/MacDecorator/MacDecorator.h +++ b/src/add-ons/decorators/MacDecorator/MacDecorator.h @@ -26,7 +26,7 @@ protected: void _DrawZoom(BRect r); void _DrawMinimize(BRect r); void _DoLayout(void); - void _SetColors(void); +// void _SetColors(void); void DrawBlendedRect(BRect r, bool down); uint32 taboffset; diff --git a/src/add-ons/decorators/WinDecorator/WinDecorator.cpp b/src/add-ons/decorators/WinDecorator/WinDecorator.cpp index 9429c57881..733b20b20a 100644 --- a/src/add-ons/decorators/WinDecorator/WinDecorator.cpp +++ b/src/add-ons/decorators/WinDecorator/WinDecorator.cpp @@ -4,6 +4,7 @@ #include "ColorUtils.h" #include "WinDecorator.h" #include "RGBColor.h" +#include "PatternHandler.h" //#define DEBUG_DECOR @@ -27,8 +28,6 @@ printf("WinDecorator()\n"); _DoLayout(); textoffset=5; - solidhigh=0xFFFFFFFFFFFFFFFFLL; - solidlow=0; } WinDecorator::~WinDecorator(void) @@ -188,10 +187,10 @@ printf("WinDecorator::Draw(): "); update.PrintToStream(); // _layerdata.highcolor=blue; _layerdata.highcolor=_colors->document_background; - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); if(_borderrect.Intersects(update)) - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); _DrawFrame(update); _DrawTab(update); @@ -208,9 +207,9 @@ printf("WinDecorator::Draw()\n"); // _layerdata.highcolor=blue; _layerdata.highcolor=_colors->document_background; - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); - _driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_borderrect,&_layerdata,pat_solidhigh); DrawFrame(); DrawTab(); @@ -232,9 +231,9 @@ void WinDecorator::_DrawZoom(BRect r) rect.OffsetBy(1,1); _layerdata.highcolor.SetColor(0,0,0); - _driver->StrokeRect(rect,&_layerdata,(int8*)&solidhigh); + _driver->StrokeRect(rect,&_layerdata,pat_solidhigh); rect.InsetBy(1,1); - _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,pat_solidhigh); } @@ -254,11 +253,11 @@ void WinDecorator::_DrawClose(BRect r) rect.OffsetBy(1,1); _layerdata.highcolor.SetColor(0,0,0); - _driver->StrokeLine(rect.LeftTop(),rect.RightBottom(),&_layerdata,(int8*)&solidhigh); - _driver->StrokeLine(rect.RightTop(),rect.LeftBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.RightBottom(),&_layerdata,pat_solidhigh); + _driver->StrokeLine(rect.RightTop(),rect.LeftBottom(),&_layerdata,pat_solidhigh); rect.OffsetBy(1,0); - _driver->StrokeLine(rect.LeftTop(),rect.RightBottom(),&_layerdata,(int8*)&solidhigh); - _driver->StrokeLine(rect.RightTop(),rect.LeftBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.RightBottom(),&_layerdata,pat_solidhigh); + _driver->StrokeLine(rect.RightTop(),rect.LeftBottom(),&_layerdata,pat_solidhigh); } void WinDecorator::_DrawMinimize(BRect r) @@ -272,7 +271,7 @@ void WinDecorator::_DrawMinimize(BRect r) rect.OffsetBy(1,1); _layerdata.highcolor.SetColor(0,0,0); - _driver->StrokeRect(rect,&_layerdata,(int8*)&solidhigh); + _driver->StrokeRect(rect,&_layerdata,pat_solidhigh); } void WinDecorator::_DrawTab(BRect r) @@ -283,12 +282,12 @@ void WinDecorator::_DrawTab(BRect r) return; // _layerdata.highcolor=frame_lowcol; -// _driver->StrokeRect(_tabrect,&_layerdata,(int8*)&solidhigh); +// _driver->StrokeRect(_tabrect,&_layerdata,pat_solidhigh); // UpdateTitle(layer->name->String()); _layerdata.highcolor=tab_highcol; - _driver->FillRect(_tabrect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(_tabrect,&_layerdata,pat_solidhigh); // Draw the buttons if we're supposed to if(!(_flags & B_NOT_CLOSABLE)) @@ -323,47 +322,47 @@ void WinDecorator::DrawBeveledRect(BRect r, bool down) // Top highlight _layerdata.highcolor=higher; - _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,pat_solidhigh); // Left highlight - _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),&_layerdata,pat_solidhigh); // Right shading _layerdata.highcolor=lower; pt=rect.RightTop(); pt.y++; - _driver->StrokeLine(pt,rect.RightBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,rect.RightBottom(),&_layerdata,pat_solidhigh); // Bottom shading pt=rect.LeftBottom(); pt.x++; - _driver->StrokeLine(pt,rect.RightBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,rect.RightBottom(),&_layerdata,pat_solidhigh); rect.InsetBy(1,1); // Top inside highlight _layerdata.highcolor=higher; - _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),&_layerdata,pat_solidhigh); // Left inside highlight - _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),&_layerdata,pat_solidhigh); // Right inside shading _layerdata.highcolor=lower; pt=rect.RightTop(); pt.y++; - _driver->StrokeLine(pt,rect.RightBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,rect.RightBottom(),&_layerdata,pat_solidhigh); // Bottom inside shading pt=rect.LeftBottom(); pt.x++; - _driver->StrokeLine(pt,rect.RightBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(pt,rect.RightBottom(),&_layerdata,pat_solidhigh); rect.InsetBy(1,1); _layerdata.highcolor=mid; - _driver->FillRect(rect,&_layerdata,(int8*)&solidhigh); + _driver->FillRect(rect,&_layerdata,pat_solidhigh); } void WinDecorator::_SetColors(void) @@ -379,40 +378,40 @@ void WinDecorator::_DrawFrame(BRect rect) BRect r=_borderrect; _layerdata.highcolor.SetColor(255,0,0); - _driver->StrokeRect(r,&_layerdata,(int8*)&solidhigh); + _driver->StrokeRect(r,&_layerdata,pat_solidhigh); BPoint pt; _layerdata.highcolor=frame_midcol; pt=r.RightTop(); pt.x--; - _driver->StrokeLine(r.LeftTop(),pt,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(r.LeftTop(),pt,&_layerdata,pat_solidhigh); pt=r.LeftBottom(); pt.y--; - _driver->StrokeLine(r.LeftTop(),pt,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(r.LeftTop(),pt,&_layerdata,pat_solidhigh); _layerdata.highcolor=frame_lowercol; - _driver->StrokeLine(r.RightTop(),r.RightBottom(),&_layerdata,(int8*)&solidhigh); - _driver->StrokeLine(r.LeftBottom(),r.RightBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(r.RightTop(),r.RightBottom(),&_layerdata,pat_solidhigh); + _driver->StrokeLine(r.LeftBottom(),r.RightBottom(),&_layerdata,pat_solidhigh); r.InsetBy(1,1); _layerdata.highcolor=frame_highcol; pt=r.RightTop(); pt.x--; - _driver->StrokeLine(r.LeftTop(),pt,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(r.LeftTop(),pt,&_layerdata,pat_solidhigh); pt=r.LeftBottom(); pt.y--; - _driver->StrokeLine(r.LeftTop(),pt,&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(r.LeftTop(),pt,&_layerdata,pat_solidhigh); _layerdata.highcolor=frame_lowcol; - _driver->StrokeLine(r.RightTop(),r.RightBottom(),&_layerdata,(int8*)&solidhigh); - _driver->StrokeLine(r.LeftBottom(),r.RightBottom(),&_layerdata,(int8*)&solidhigh); + _driver->StrokeLine(r.RightTop(),r.RightBottom(),&_layerdata,pat_solidhigh); + _driver->StrokeLine(r.LeftBottom(),r.RightBottom(),&_layerdata,pat_solidhigh); r.InsetBy(1,1); _layerdata.highcolor=frame_midcol; - _driver->StrokeRect(r,&_layerdata,(int8*)&solidhigh); + _driver->StrokeRect(r,&_layerdata,pat_solidhigh); r.InsetBy(1,1); - _driver->StrokeRect(r,&_layerdata,(int8*)&solidhigh); + _driver->StrokeRect(r,&_layerdata,pat_solidhigh); } extern "C" float get_decorator_version(void)