浏览代码

Clipping Issues Revisited

Fixed a number of additional clipping issues that we were seeing while developing the Gui Editor.
Peter Robinson 4 年之前
父节点
当前提交
f5b4440af6

+ 2 - 23
engine/source/gui/containers/guiScrollCtrl.cc

@@ -114,28 +114,6 @@ bool GuiScrollCtrl::onWake()
    if (! Parent::onWake())
    if (! Parent::onWake())
       return false;
       return false;
 
 
-	if(mProfile->mBitmapName != NULL && mProfile->constructBitmapArray() >= 39)
-	{
-	   mTextureHandle = mProfile->mTextureHandle;
-	   mTextureHandle.setFilter(GL_NEAREST);
-
-	   bool result;
-	   result = mProfile->constructBitmapArray() >= BmpStates * BmpCount;
-
-	   //AssertFatal(result, "Failed to create the bitmap array");
-	   if (!result)
-		   Con::warnf("Failed to create the bitmap array for %s", mProfile->mBitmapName);
-
-	   mBitmapBounds = mProfile->mBitmapArrayRects.address();
-
-	   //init
-	   mBaseThumbSize = mBitmapBounds[BmpStates * BmpVThumbTopCap].extent.y +
-						mBitmapBounds[BmpStates * BmpVThumbBottomCap].extent.y;
-
-	   mScrollBarThickness      = mBitmapBounds[BmpStates * BmpVPage].extent.x;
-	   computeSizes();
-   }
-
 	if (mThumbProfile != NULL)
 	if (mThumbProfile != NULL)
 		mThumbProfile->incRefCount();
 		mThumbProfile->incRefCount();
 
 
@@ -151,7 +129,6 @@ bool GuiScrollCtrl::onWake()
 void GuiScrollCtrl::onSleep()
 void GuiScrollCtrl::onSleep()
 {
 {
    Parent::onSleep();
    Parent::onSleep();
-   mTextureHandle = NULL;
 
 
    if (mThumbProfile != NULL)
    if (mThumbProfile != NULL)
 	   mThumbProfile->decRefCount();
 	   mThumbProfile->decRefCount();
@@ -1015,9 +992,11 @@ void GuiScrollCtrl::renderChildControls(Point2I offset, RectI content, const Rec
 
 
 				if (childClip.intersect(clipRect))
 				if (childClip.intersect(clipRect))
 				{
 				{
+					RectI old = dglGetClipRect();
 					dglSetClipRect(clipRect);
 					dglSetClipRect(clipRect);
 					glDisable(GL_CULL_FACE);
 					glDisable(GL_CULL_FACE);
 					ctrl->onRender(childPosition, RectI(childPosition, ctrl->getExtent()));
 					ctrl->onRender(childPosition, RectI(childPosition, ctrl->getExtent()));
+					dglSetClipRect(old);
 				}
 				}
 			}
 			}
 			size_cpy = objectList.size(); //	CHRIS: i know its wierd but the size of the list changes sometimes during execution of this loop
 			size_cpy = objectList.size(); //	CHRIS: i know its wierd but the size of the list changes sometimes during execution of this loop

+ 4 - 37
engine/source/gui/containers/guiScrollCtrl.h

@@ -34,38 +34,6 @@ private:
 
 
 protected:
 protected:
 
 
-   // the scroll control can use a bitmap array to draw all its
-   // graphics... these are the bitmaps it needs:
-   enum BitmapIndices
-   {
-      BmpUp,
-      BmpDown,
-      BmpVThumbTopCap,
-      BmpVThumb,
-      BmpVThumbBottomCap,
-      BmpVPage,
-      BmpLeft,
-      BmpRight,
-      BmpHThumbLeftCap,
-      BmpHThumb,
-      BmpHThumbRightCap,
-      BmpHPage,
-      BmpResize,
-
-      BmpCount
-   };
-
-   enum BitmapStates
-   {
-      BmpDefault = 0,
-      BmpHilite,
-      BmpDisabled,
-
-      BmpStates
-   };
-   RectI *mBitmapBounds;  //bmp is [3*n], bmpHL is [3*n + 1], bmpNA is [3*n + 2]
-   TextureHandle mTextureHandle;
-
    // note - it is implicit in the scroll view that the buttons all have the same
    // note - it is implicit in the scroll view that the buttons all have the same
    // arrow length and that horizontal and vertical scroll bars have the
    // arrow length and that horizontal and vertical scroll bars have the
    // same thickness
    // same thickness
@@ -104,9 +72,8 @@ protected:
    RectI mRightArrowRect;
    RectI mRightArrowRect;
    RectI mHTrackRect;
    RectI mHTrackRect;
    RectI mVTrackRect;
    RectI mVTrackRect;
-   //--------------------------------------
-   // for determing hit area
-public:      //called by the ComboPopUp class
+ 
+public:      
    enum Region
    enum Region
    {
    {
       UpArrow,
       UpArrow,
@@ -195,8 +162,8 @@ public:
 
 
    void onPreRender();
    void onPreRender();
    void onRender(Point2I offset, const RectI &updateRect);
    void onRender(Point2I offset, const RectI &updateRect);
-   RectI GuiScrollCtrl::applyScrollBarSpacing(Point2I offset, Point2I extent);
-   GuiControlState GuiScrollCtrl::getRegionCurrentState(GuiScrollCtrl::Region region);
+   RectI applyScrollBarSpacing(Point2I offset, Point2I extent);
+   GuiControlState getRegionCurrentState(GuiScrollCtrl::Region region);
    void renderBorderedRectWithArrow(RectI& bounds, GuiControlProfile* profile, GuiControlState state, GuiDirection direction);
    void renderBorderedRectWithArrow(RectI& bounds, GuiControlProfile* profile, GuiControlState state, GuiDirection direction);
    void renderVScrollBar(const Point2I& offset);
    void renderVScrollBar(const Point2I& offset);
    void renderHScrollBar(const Point2I& offset);
    void renderHScrollBar(const Point2I& offset);

+ 7 - 3
engine/source/gui/guiControl.cc

@@ -1678,9 +1678,13 @@ void GuiControl::renderText(Point2I offset, Point2I extent, const char *text, Gu
 	}
 	}
 
 
 	RectI old = dglGetClipRect();
 	RectI old = dglGetClipRect();
-	dglSetClipRect(RectI(offset, extent));
-	dglDrawText( font, start + offset + profile->mTextOffset, text, profile->mFontColors, 9, rotation );
-	dglSetClipRect(old);
+	RectI clipRect = RectI(offset, extent);
+	if(clipRect.intersect(old))
+	{
+		dglSetClipRect(clipRect);
+		dglDrawText( font, start + offset + profile->mTextOffset, text, profile->mFontColors, 9, rotation );
+		dglSetClipRect(old);
+	}
 }
 }
 
 
 void GuiControl::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent)
 void GuiControl::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent)

+ 0 - 7
engine/source/gui/guiListBoxCtrl.cc

@@ -700,14 +700,9 @@ void GuiListBoxCtrl::parentResized(const Point2I &oldParentExtent, const Point2I
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void GuiListBoxCtrl::onRender( Point2I offset, const RectI &updateRect )
 void GuiListBoxCtrl::onRender( Point2I offset, const RectI &updateRect )
 {
 {
-   RectI clipRect(updateRect.point, updateRect.extent);
-
    if( !mProfile )
    if( !mProfile )
       return;
       return;
 
 
-   // Save our original clip rect
-   RectI oldClipRect = clipRect;
-
    for ( S32 i = 0; i < mItems.size(); i++)
    for ( S32 i = 0; i < mItems.size(); i++)
    {
    {
       S32 colorBoxSize = 0;
       S32 colorBoxSize = 0;
@@ -736,8 +731,6 @@ void GuiListBoxCtrl::onRender( Point2I offset, const RectI &updateRect )
       // Render our item
       // Render our item
       onRenderItem( itemRect, mItems[i] );
       onRenderItem( itemRect, mItems[i] );
    }
    }
-
-   dglSetClipRect( oldClipRect );
 }
 }
 
 
 void GuiListBoxCtrl::onRenderItem( RectI itemRect, LBItem *item )
 void GuiListBoxCtrl::onRenderItem( RectI itemRect, LBItem *item )

+ 172 - 168
engine/source/gui/guiTextEditCtrl.cc

@@ -1237,199 +1237,203 @@ void GuiTextEditCtrl::onPreRender()
 
 
 void GuiTextEditCtrl::drawText( const RectI &drawRect, GuiControlState currentState )
 void GuiTextEditCtrl::drawText( const RectI &drawRect, GuiControlState currentState )
 {
 {
-   StringBuffer textBuffer;
-   Point2I drawPoint = drawRect.point;
-
    RectI old = dglGetClipRect();
    RectI old = dglGetClipRect();
-   dglSetClipRect(drawRect);
-
-   // Just a little sanity.
-   if(mCursorPos > (S32)mTextBuffer.length()) 
-      mCursorPos = (S32)mTextBuffer.length();
-   if(mCursorPos < 0)
-       mCursorPos = 0;
-
-   // Apply password masking (make the masking char optional perhaps?)
-   if(mPasswordText)
+   RectI clipRect = RectI(drawRect.point, drawRect.extent);
+   if (clipRect.intersect(old))
    {
    {
-      for(U32 i = 0; i<mTextBuffer.length(); i++)
-         textBuffer.append(mPasswordMask);
-   }
-   else
-   {
-      // Or else just copy it over.
-      textBuffer.set(&mTextBuffer);
-   }
-
-   // Center vertically:
-   drawPoint.y += ( ( drawRect.extent.y - mFont->getHeight() ) / 2 );
+	   dglSetClipRect(clipRect);
 
 
-   // Align horizontally:
-   
-   S32 textWidth = mFont->getStrNWidth(textBuffer.getPtr(), textBuffer.length());
+	   // Just a little sanity.
+	   if(mCursorPos > (S32)mTextBuffer.length()) 
+		  mCursorPos = (S32)mTextBuffer.length();
+	   if(mCursorPos < 0)
+		   mCursorPos = 0;
 
 
-   if ( drawRect.extent.x > textWidth )
-   {
-      switch( mProfile->mAlignment )
-      {
-      case GuiControlProfile::RightAlign:
-         drawPoint.x += ( drawRect.extent.x - textWidth );
-         break;
-      case GuiControlProfile::CenterAlign:
-         drawPoint.x += ( ( drawRect.extent.x - textWidth ) / 2 );
-         break;
-      }
-   }
+	   StringBuffer textBuffer;
+	   Point2I drawPoint = drawRect.point;
 
 
-   ColorI fontColor = mActive ? mProfile->mFontColor : mProfile->mFontColorNA;
-
-   // now draw the text
-   Point2I cursorStart, cursorEnd;
-   mTextOffset = drawPoint;
-   if ( mTextOffsetReset )
-   {
-      mTextOffset.x = drawPoint.x;
-      mTextOffsetReset = false;
-   }
+	   // Apply password masking (make the masking char optional perhaps?)
+	   if(mPasswordText)
+	   {
+		  for(U32 i = 0; i<mTextBuffer.length(); i++)
+			 textBuffer.append(mPasswordMask);
+	   }
+	   else
+	   {
+		  // Or else just copy it over.
+		  textBuffer.set(&mTextBuffer);
+	   }
 
 
-   if ( drawRect.extent.x > textWidth )
-      mTextOffset.x = drawPoint.x;
-   else
-   {
-      // Alignment affects large text
-      if ( mProfile->mAlignment == GuiControlProfile::RightAlign
-         || mProfile->mAlignment == GuiControlProfile::CenterAlign )
-      {
-         if ( mTextOffset.x + textWidth < (drawRect.point.x + drawRect.extent.x))
-            mTextOffset.x = (drawRect.point.x + drawRect.extent.x) - textWidth;
-      }
-   }
+	   // Center vertically:
+	   drawPoint.y += ( ( drawRect.extent.y - mFont->getHeight() ) / 2 );
 
 
-   // calculate the cursor
-   if ( currentState == SelectedState )
-   {
-      // Where in the string are we?
-      S32 cursorOffset=0, charWidth=0;
-      UTF16 tempChar = mTextBuffer.getChar(mCursorPos);
+	   // Align horizontally:
+   
+	   S32 textWidth = mFont->getStrNWidth(textBuffer.getPtr(), textBuffer.length());
 
 
-      // Alright, we want to terminate things momentarily.
-      if(mCursorPos > 0)
-      {
-         cursorOffset = mFont->getStrNWidth(textBuffer.getPtr(), mCursorPos);
-      }
-      else
-         cursorOffset = 0;
+	   if ( drawRect.extent.x > textWidth )
+	   {
+		  switch( mProfile->mAlignment )
+		  {
+		  case GuiControlProfile::RightAlign:
+			 drawPoint.x += ( drawRect.extent.x - textWidth );
+			 break;
+		  case GuiControlProfile::CenterAlign:
+			 drawPoint.x += ( ( drawRect.extent.x - textWidth ) / 2 );
+			 break;
+		  }
+	   }
 
 
-      if ( tempChar )
-         charWidth = mFont->getCharWidth( tempChar );
-      else
-         charWidth = 0;
+	   ColorI fontColor = mActive ? mProfile->mFontColor : mProfile->mFontColorNA;
 
 
-      if( mTextOffset.x + cursorOffset + charWidth >= (drawRect.point.x + drawRect.extent.x))
-      {
-         // Cursor somewhere beyond the textcontrol,
-         // skip forward roughly 25% of the total width (if possible)
-         S32 skipForward = drawRect.extent.x / 4;
+	   // now draw the text
+	   Point2I cursorStart, cursorEnd;
+	   mTextOffset = drawPoint;
+	   if ( mTextOffsetReset )
+	   {
+		  mTextOffset.x = drawPoint.x;
+		  mTextOffsetReset = false;
+	   }
 
 
-         if ( cursorOffset + skipForward > textWidth )
-            mTextOffset.x = (drawRect.point.x + drawRect.extent.x) - textWidth;
-         else
-            mTextOffset.x -= skipForward;
-      }
-      else if( mTextOffset.x + cursorOffset < drawRect.point.x)
-      {
-         // Cursor somewhere before the textcontrol
-         // skip backward roughly 25% of the total width (if possible)
-         S32 skipBackward = drawRect.extent.x / 4;
+	   if ( drawRect.extent.x > textWidth )
+		  mTextOffset.x = drawPoint.x;
+	   else
+	   {
+		  // Alignment affects large text
+		  if ( mProfile->mAlignment == GuiControlProfile::RightAlign
+			 || mProfile->mAlignment == GuiControlProfile::CenterAlign )
+		  {
+			 if ( mTextOffset.x + textWidth < (drawRect.point.x + drawRect.extent.x))
+				mTextOffset.x = (drawRect.point.x + drawRect.extent.x) - textWidth;
+		  }
+	   }
 
 
-         if ( cursorOffset - skipBackward < 0 )
-            mTextOffset.x = drawRect.point.x;
-         else
-            mTextOffset.x += skipBackward;
-      }
-      cursorStart.x = mTextOffset.x + cursorOffset;
-      cursorEnd.x = cursorStart.x;
+	   // calculate the cursor
+	   if ( currentState == SelectedState )
+	   {
+		  // Where in the string are we?
+		  S32 cursorOffset=0, charWidth=0;
+		  UTF16 tempChar = mTextBuffer.getChar(mCursorPos);
+
+		  // Alright, we want to terminate things momentarily.
+		  if(mCursorPos > 0)
+		  {
+			 cursorOffset = mFont->getStrNWidth(textBuffer.getPtr(), mCursorPos);
+		  }
+		  else
+			 cursorOffset = 0;
+
+		  if ( tempChar )
+			 charWidth = mFont->getCharWidth( tempChar );
+		  else
+			 charWidth = 0;
+
+		  if( mTextOffset.x + cursorOffset + charWidth >= (drawRect.point.x + drawRect.extent.x))
+		  {
+			 // Cursor somewhere beyond the textcontrol,
+			 // skip forward roughly 25% of the total width (if possible)
+			 S32 skipForward = drawRect.extent.x / 4;
+
+			 if ( cursorOffset + skipForward > textWidth )
+				mTextOffset.x = (drawRect.point.x + drawRect.extent.x) - textWidth;
+			 else
+				mTextOffset.x -= skipForward;
+		  }
+		  else if( mTextOffset.x + cursorOffset < drawRect.point.x)
+		  {
+			 // Cursor somewhere before the textcontrol
+			 // skip backward roughly 25% of the total width (if possible)
+			 S32 skipBackward = drawRect.extent.x / 4;
+
+			 if ( cursorOffset - skipBackward < 0 )
+				mTextOffset.x = drawRect.point.x;
+			 else
+				mTextOffset.x += skipBackward;
+		  }
+		  cursorStart.x = mTextOffset.x + cursorOffset;
+		  cursorEnd.x = cursorStart.x;
+
+		  S32 cursorHeight = mFont->getHeight();
+		  if ( cursorHeight < drawRect.extent.y )
+		  {
+			 cursorStart.y = drawPoint.y;
+			 cursorEnd.y = cursorStart.y + cursorHeight;
+		  }
+		  else
+		  {
+			 cursorStart.y = drawRect.point.y;
+			 cursorEnd.y = cursorStart.y + drawRect.extent.y;
+		  }
+	   }
 
 
-      S32 cursorHeight = mFont->getHeight();
-      if ( cursorHeight < drawRect.extent.y )
-      {
-         cursorStart.y = drawPoint.y;
-         cursorEnd.y = cursorStart.y + cursorHeight;
-      }
-      else
-      {
-         cursorStart.y = drawRect.point.y;
-         cursorEnd.y = cursorStart.y + drawRect.extent.y;
-      }
-   }
+	   //draw the text
+	   if ( currentState != SelectedState )
+		  mBlockStart = mBlockEnd = 0;
 
 
-   //draw the text
-   if ( currentState != SelectedState )
-      mBlockStart = mBlockEnd = 0;
+	   //also verify the block start/end
+	   if ((mBlockStart > (S32)textBuffer.length() || (mBlockEnd > (S32)textBuffer.length()) || (mBlockStart > mBlockEnd)))
+		  mBlockStart = mBlockEnd = 0;
 
 
-   //also verify the block start/end
-   if ((mBlockStart > (S32)textBuffer.length() || (mBlockEnd > (S32)textBuffer.length()) || (mBlockStart > mBlockEnd)))
-      mBlockStart = mBlockEnd = 0;
+	   Point2I tempOffset = mTextOffset;
 
 
-   Point2I tempOffset = mTextOffset;
+	   //draw the portion before the highlight
+	   if ( mBlockStart > 0 )
+	   {
+		  dglSetBitmapModulation( fontColor );
 
 
-   //draw the portion before the highlight
-   if ( mBlockStart > 0 )
-   {
-      dglSetBitmapModulation( fontColor );
+		  const UTF16* preString2 = textBuffer.getPtr();
+		  dglDrawTextN( mFont, tempOffset, preString2, mBlockStart, mProfile->mFontColors);
+		  tempOffset.x += mFont->getStrNWidth(preString2, mBlockStart);
+	   }
 
 
-      const UTF16* preString2 = textBuffer.getPtr();
-      dglDrawTextN( mFont, tempOffset, preString2, mBlockStart, mProfile->mFontColors);
-      tempOffset.x += mFont->getStrNWidth(preString2, mBlockStart);
-   }
+	   //draw the hilighted portion
+	   if ( mBlockEnd > 0 )
+	   {
+		  const UTF16* highlightBuff = textBuffer.getPtr() + mBlockStart;
+		  U32 highlightBuffLen = mBlockEnd-mBlockStart;
 
 
-   //draw the hilighted portion
-   if ( mBlockEnd > 0 )
-   {
-      const UTF16* highlightBuff = textBuffer.getPtr() + mBlockStart;
-      U32 highlightBuffLen = mBlockEnd-mBlockStart;
+		  S32 highlightWidth = mFont->getStrNWidth(highlightBuff, highlightBuffLen);
 
 
-      S32 highlightWidth = mFont->getStrNWidth(highlightBuff, highlightBuffLen);
+		  dglDrawRectFill( Point2I( tempOffset.x, drawRect.point.y + 1 ),
+			 Point2I( tempOffset.x + highlightWidth, drawRect.point.y + drawRect.extent.y - 1),
+			 mProfile->mFillColorHL );
 
 
-      dglDrawRectFill( Point2I( tempOffset.x, drawRect.point.y + 1 ),
-         Point2I( tempOffset.x + highlightWidth, drawRect.point.y + drawRect.extent.y - 1),
-         mProfile->mFillColorHL );
+		  dglSetBitmapModulation( mProfile->mFontColorHL );
+		  dglDrawTextN( mFont, tempOffset, highlightBuff, highlightBuffLen, mProfile->mFontColors );
+		  tempOffset.x += highlightWidth;
+	   }
 
 
-      dglSetBitmapModulation( mProfile->mFontColorHL );
-      dglDrawTextN( mFont, tempOffset, highlightBuff, highlightBuffLen, mProfile->mFontColors );
-      tempOffset.x += highlightWidth;
-   }
+	   //draw the portion after the highlite
+	   if(mBlockEnd < (S32)mTextBuffer.length())
+	   {
+		   // Special handling if we are truncating when the ctrl is unfocused
+		   if (currentState != SelectedState && mTruncateWhenUnfocused)
+		   {
+			  StringBuffer terminationString = "...";
+			  S32 width = mBounds.extent.x;
+			  StringBuffer truncatedBuffer = truncate(textBuffer, terminationString, width);
+			  const UTF16* truncatedBufferPtr = truncatedBuffer.getPtr();
+			  U32 finalBuffLen = truncatedBuffer.length();
+
+			  dglSetBitmapModulation( fontColor );
+			  dglDrawTextN( mFont, tempOffset, truncatedBufferPtr, finalBuffLen, mProfile->mFontColors );
+		   }
+		   else
+		   {
+			  const UTF16* finalBuff = textBuffer.getPtr() + mBlockEnd;
+			  U32 finalBuffLen = mTextBuffer.length() - mBlockEnd;
 
 
-   //draw the portion after the highlite
-   if(mBlockEnd < (S32)mTextBuffer.length())
-   {
-       // Special handling if we are truncating when the ctrl is unfocused
-       if (currentState != SelectedState && mTruncateWhenUnfocused)
-       {
-          StringBuffer terminationString = "...";
-          S32 width = mBounds.extent.x;
-          StringBuffer truncatedBuffer = truncate(textBuffer, terminationString, width);
-          const UTF16* truncatedBufferPtr = truncatedBuffer.getPtr();
-          U32 finalBuffLen = truncatedBuffer.length();
-
-          dglSetBitmapModulation( fontColor );
-          dglDrawTextN( mFont, tempOffset, truncatedBufferPtr, finalBuffLen, mProfile->mFontColors );
-       }
-       else
-       {
-          const UTF16* finalBuff = textBuffer.getPtr() + mBlockEnd;
-          U32 finalBuffLen = mTextBuffer.length() - mBlockEnd;
-
-          dglSetBitmapModulation( fontColor );
-          dglDrawTextN( mFont, tempOffset, finalBuff, finalBuffLen, mProfile->mFontColors );
-       }
-   }
+			  dglSetBitmapModulation( fontColor );
+			  dglDrawTextN( mFont, tempOffset, finalBuff, finalBuffLen, mProfile->mFontColors );
+		   }
+	   }
 
 
-   //draw the cursor
-   if (currentState == SelectedState && mCursorOn )
-      dglDrawLine( cursorStart, cursorEnd, mProfile->mCursorColor );
+	   //draw the cursor
+	   if (currentState == SelectedState && mCursorOn )
+		  dglDrawLine( cursorStart, cursorEnd, mProfile->mCursorColor );
 
 
-   dglSetClipRect(old);
+	   dglSetClipRect(old);
+	}
 }
 }
 
 
 bool GuiTextEditCtrl::hasText()
 bool GuiTextEditCtrl::hasText()

+ 49 - 12
toybox/Sandbox/1/gui/guiProfiles.cs

@@ -38,6 +38,7 @@ $color[2] = "81 92 102 255";
 $color[3] = "224 224 224 255";
 $color[3] = "224 224 224 255";
 $color[4] = "54 135 196 255";
 $color[4] = "54 135 196 255";
 $color[5] = "245 210 50 255";
 $color[5] = "245 210 50 255";
+$color[6] = "196 54 71 255";
 
 
 function AdjustColorValue(%color, %percent)
 function AdjustColorValue(%color, %percent)
 {
 {
@@ -144,10 +145,10 @@ if (!isObject(GuiDefaultBorderProfile)) new GuiBorderProfile (GuiDefaultBorderPr
 	borderSL = 0;
 	borderSL = 0;
 	borderNA = 0;
 	borderNA = 0;
 	//Default border color
 	//Default border color
-	borderColor   = "100 100 100 255";
-	borderColorHL = "128 128 128";
-	borderColorSL = "255 255 255 50";
-	borderColorNA = "64 64 64";
+	borderColor   = $color1;
+    borderColorHL = AdjustColorValue($color1, 10);
+    borderColorSL = AdjustColorValue($color1, 10);
+    borderColorNA = SetColorAlpha($color1, 100);
 	//Default Padding
 	//Default Padding
 	padding = 0;
 	padding = 0;
 	paddingHL = 0;
 	paddingHL = 0;
@@ -207,16 +208,53 @@ if(!isObject(GuiListBoxProfile)) new GuiControlProfile (GuiListBoxProfile : GuiD
 
 
 if(!isObject(GuiWindowProfile)) new GuiControlProfile (GuiWindowProfile : GuiDefaultProfile)
 if(!isObject(GuiWindowProfile)) new GuiControlProfile (GuiWindowProfile : GuiDefaultProfile)
 {
 {
-   opaque = true;
-   modal = true;
-   justify = "center";
-   textOffset = "10 4";
-   bitmap = "./images/window";
-   fillColor = "37 36 35 255";
-   fontColor = "white";
+   fillColor = $color1;
+   fillColorHL = AdjustColorValue($color1, 10);
+   fillColorSL = $color4;
+   fillColorNA = $color1;
    category = "defaultWindow";
    category = "defaultWindow";
+
+   fontColorSL = $color5;
+};
+
+if(!isObject(GuiWindowContentBorderProfile)) new GuiBorderProfile (GuiWindowContentBorderProfile : GuiDefaultBorderProfile)
+{
+	borderColor = AdjustColorValue($color1, -10);
+	borderColorHL = AdjustColorValue($color1, -10);
+	borderColorSL = AdjustColorValue($color4, -10);
+	borderColorNA = $color5;
+
+	border = 1;
+	borderHL = 1;
+	borderSL = 1;
+	borderNA = 1;
+};
+
+if(!isObject(GuiWindowContentProfile)) new GuiControlProfile (GuiWindowContentProfile : GuiDefaultProfile)
+{
+	fillColor = $color2;
+	fillColorHL = $color2;
+	fillColorSL = $color2;
+	fillColorNA = $color2;
+
+	borderDefault = GuiWindowContentBorderProfile;
+};
+
+if(!isObject(GuiWindowCloseButtonProfile)) new GuiControlProfile (GuiWindowCloseButtonProfile : GuiDefaultProfile)
+{
+   fillColor = $color1;
+   fillColorHL = $color6;
+   fillColorHL = AdjustColorValue($color6, 10);
+   fillColorNA = $color1;
 };
 };
 
 
+if(!isObject(GuiWindowMinButtonProfile)) new GuiControlProfile (GuiWindowMinButtonProfile : GuiWindowCloseButtonProfile)
+{
+   fillColorHL = $color4;
+   fillColorHL = AdjustColorValue($color4, 10);
+};
+
+if(!isObject(GuiWindowMaxButtonProfile)) new GuiControlProfile (GuiWindowMaxButtonProfile : GuiWindowMinButtonProfile);
 if(!isObject(GuiTransparentProfile)) new GuiControlProfile (GuiTransparentProfile : GuiDefaultProfile);
 if(!isObject(GuiTransparentProfile)) new GuiControlProfile (GuiTransparentProfile : GuiDefaultProfile);
 if(!isObject(GuiGridProfile)) new GuiControlProfile (GuiGridProfile : GuiDefaultProfile);
 if(!isObject(GuiGridProfile)) new GuiControlProfile (GuiGridProfile : GuiDefaultProfile);
 if(!isObject(GuiChainProfile)) new GuiControlProfile (GuiChainProfile : GuiDefaultProfile);
 if(!isObject(GuiChainProfile)) new GuiControlProfile (GuiChainProfile : GuiDefaultProfile);
@@ -360,7 +398,6 @@ if(!isObject(GuiTextArrayProfile)) new GuiControlProfile (GuiTextArrayProfile :
 
 
 if (!isObject(GuiTextRightProfile)) new GuiControlProfile (GuiTextRightProfile : GuiTextProfile)
 if (!isObject(GuiTextRightProfile)) new GuiControlProfile (GuiTextRightProfile : GuiTextProfile)
 {
 {
-
     align = "right";
     align = "right";
 };
 };