diff --git a/bin/assets/layouts/test_widgets.xml b/bin/assets/layouts/test_widgets.xml
index 0a227a0ee..b880290ab 100644
--- a/bin/assets/layouts/test_widgets.xml
+++ b/bin/assets/layouts/test_widgets.xml
@@ -65,9 +65,13 @@
+
+
+
+
diff --git a/bin/assets/ui/breeze.css b/bin/assets/ui/breeze.css
index 9b8fecece..5d534a550 100644
--- a/bin/assets/ui/breeze.css
+++ b/bin/assets/ui/breeze.css
@@ -36,9 +36,35 @@
--win-icon: #dbdbdd;
}
-* {
+CheckBox,
+ComboBox,
+ComboBox::DropDownList::ListBox::item,
+DropDownList,
+DropDownList::ListBox::item,
+ListBox::item,
+Menu::item,
+Menu::SubMenu,
+PushButton,
+RadioButton,
+SelectButton,
+SpinBox::input,
+Tab,
+TextEdit,
+TextInput,
+TextInputPassword,
+TextView,
+Tooltip,
+MenuBar::button {
color: var(--font);
font-size: 11dp;
+}
+
+TextView,
+TextEdit,
+TextInput,
+TextInputPassword,
+ComboBox::DropDownList,
+SpinBox::input, {
selection-back-color: var(--primary);
}
diff --git a/docs/articles/cssspecification.md b/docs/articles/cssspecification.md
index 48ceddacc..22a7d9741 100644
--- a/docs/articles/cssspecification.md
+++ b/docs/articles/cssspecification.md
@@ -916,6 +916,16 @@ or one of the special constants.
---
+### locked
+
+Enable or disable editing on code editor elements.
+
+* Applicable to: EE::UI::UICodeEditor (TextEdit)
+* Data Type: [boolean](#boolean-data-type)
+* Default value: `false`
+
+---
+
### margin-bottom
Read [margin-bottom](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom) documentation.
diff --git a/include/eepp/system/color.hpp b/include/eepp/system/color.hpp
index a0b194c3e..f06619cb8 100644
--- a/include/eepp/system/color.hpp
+++ b/include/eepp/system/color.hpp
@@ -160,6 +160,8 @@ class EE_API Color : public tColor {
std::string toHexString( const bool& prependHash = true ) const;
+ Color& blendAlpha( const Uint8& alpha );
+
static Color fromHsl( const Colorf& hsl );
/** Blend a source color to destination color */
diff --git a/include/eepp/ui/css/propertydefinition.hpp b/include/eepp/ui/css/propertydefinition.hpp
index 6a4c9bd7f..d2f1d7138 100644
--- a/include/eepp/ui/css/propertydefinition.hpp
+++ b/include/eepp/ui/css/propertydefinition.hpp
@@ -131,6 +131,7 @@ enum class PropertyId : Uint32 {
HalfSlider = String::hash( "half-slider" ),
Owns = String::hash( "owns" ),
AllowEditing = String::hash( "allow-editing" ),
+ Locked = String::hash( "locked" ),
MaxLength = String::hash( "max-length" ),
FreeEditing = String::hash( "free-editing" ),
Numeric = String::hash( "numeric" ),
diff --git a/include/eepp/ui/uicodeeditor.hpp b/include/eepp/ui/uicodeeditor.hpp
index b0de7bf97..0a0ec6162 100644
--- a/include/eepp/ui/uicodeeditor.hpp
+++ b/include/eepp/ui/uicodeeditor.hpp
@@ -55,16 +55,40 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client {
UICodeEditor* setFontSize( Float dpSize );
+ const Float& getFontSize() const;
+
UICodeEditor* setFontColor( const Color& color );
+ const Color& getFontColor() const;
+
UICodeEditor* setFontSelectedColor( const Color& color );
+ const Color& getFontSelectedColor();
+
UICodeEditor* setFontSelectionBackColor( const Color& color );
+ const Color& getFontSelectionBackColor() const;
+
+ UICodeEditor* setFontShadowColor( const Color& color );
+
+ const Color& getFontShadowColor() const;
+
+ UICodeEditor* setFontStyle( const Uint32& fontStyle );
+
const Uint32& getTabWidth() const;
UICodeEditor* setTabWidth( const Uint32& tabWidth );
+ const Uint32& getFontStyle() const;
+
+ const Float& getOutlineThickness() const;
+
+ UICodeEditor* setOutlineThickness( const Float& outlineThickness );
+
+ const Color& getOutlineColor() const;
+
+ UICodeEditor* setOutlineColor( const Color& outlineColor );
+
const Float& getMouseWheelScroll() const;
void setMouseWheelScroll( const Float& mouseWheelScroll );
@@ -125,6 +149,10 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client {
void setLineNumberActiveFontColor( const Color& lineNumberActiveFontColor );
+ bool isTextSelectionEnabled() const;
+
+ void setTextSelection( const bool& active );
+
KeyBindings& getKeyBindings();
void setKeyBindings( const KeyBindings& keyBindings );
@@ -158,7 +186,11 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client {
void addUnlockedCommand( const std::string& command );
- protected:
+ virtual bool applyProperty( const StyleSheetProperty& attribute );
+
+ virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
+ const Uint32& propertyIndex = 0 );
+ protected:
struct LastXOffset {
TextPosition position;
Float offset;
diff --git a/include/eepp/ui/uifontstyleconfig.hpp b/include/eepp/ui/uifontstyleconfig.hpp
index 185c9a14f..28e68b0a0 100644
--- a/include/eepp/ui/uifontstyleconfig.hpp
+++ b/include/eepp/ui/uifontstyleconfig.hpp
@@ -15,7 +15,7 @@ class UIFontStyleConfig : public FontStyleConfig {
public:
const Color& getFontSelectedColor() const { return FontSelectedColor; }
- Color getFontSelectionBackColor() const { return FontSelectionBackColor; }
+ const Color& getFontSelectionBackColor() const { return FontSelectionBackColor; }
void setFontSelectedColor( const Color& color ) { FontSelectedColor = color; }
diff --git a/src/eepp/system/color.cpp b/src/eepp/system/color.cpp
index ab4fbe192..96f19a416 100644
--- a/src/eepp/system/color.cpp
+++ b/src/eepp/system/color.cpp
@@ -232,6 +232,11 @@ std::string Color::toHexString( const bool& prependHashtag ) const {
return stream.str();
}
+Color& Color::blendAlpha( const Uint8& alpha ) {
+ this->a = static_cast( ( alpha * this->a ) / 255.f );
+ return *this;
+}
+
static Float hue2rgb( Float p, Float q, Float t ) {
if ( t < 0.f )
t += 1.f;
diff --git a/src/eepp/ui/css/stylesheetspecification.cpp b/src/eepp/ui/css/stylesheetspecification.cpp
index 9aad607cd..e1359b38d 100644
--- a/src/eepp/ui/css/stylesheetspecification.cpp
+++ b/src/eepp/ui/css/stylesheetspecification.cpp
@@ -274,6 +274,7 @@ void StyleSheetSpecification::registerDefaultProperties() {
registerProperty( "half-slider", "" ).setType( PropertyType::Bool );
registerProperty( "owns", "" ).setType( PropertyType::String );
registerProperty( "allow-editing", "" ).setType( PropertyType::Bool );
+ registerProperty( "locked", "" ).setType( PropertyType::Bool );
registerProperty( "max-length", "" ).setType( PropertyType::NumberInt );
registerProperty( "free-editing", "" ).setType( PropertyType::Bool );
registerProperty( "numeric", "" ).setType( PropertyType::Bool );
diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp
index f636a1738..0ddc79b94 100644
--- a/src/eepp/ui/uicodeeditor.cpp
+++ b/src/eepp/ui/uicodeeditor.cpp
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -36,6 +37,7 @@ UICodeEditor::UICodeEditor() :
mHighlighter( &mDoc ),
mKeyBindings( getUISceneNode()->getWindow()->getInput() ) {
mFlags |= UI_TAB_STOP;
+ setTextSelection( true );
setColorScheme( SyntaxColorScheme::getDefault() );
mVScrollBar = UIScrollBar::NewVertical();
mVScrollBar->setParent( this );
@@ -49,6 +51,8 @@ UICodeEditor::UICodeEditor() :
eePRINTL( "A monospace font must be loaded to be able to use the code editor.\nTry loading "
"a font with the name \"monospace\"" );
+ setFontSize( getUISceneNode()->getUIThemeManager()->getDefaultFontSize() );
+
clipEnable();
mDoc.registerClient( *this );
subscribeScheduledUpdate();
@@ -84,19 +88,22 @@ void UICodeEditor::draw() {
updateEditor();
}
+ Color col;
std::pair lineRange = getVisibleLineRange();
Float charSize = PixelDensity::pxToDp( getCharacterSize() );
Float lineHeight = getLineHeight();
int lineNumberDigits = getLineNumberDigits();
Float lineNumberWidth = mShowLineNumber ? getLineNumberWidth() : 0.f;
- Vector2f screenStart( mScreenPos.x + mRealPadding.Left, mScreenPos.y + mRealPadding.Top );
+ Vector2f screenStart( eefloor( mScreenPos.x + mRealPadding.Left ),
+ eefloor( mScreenPos.y + mRealPadding.Top ) );
Vector2f start( screenStart.x + lineNumberWidth, screenStart.y );
Vector2f startScroll( start - mScroll );
Primitives primitives;
TextPosition cursor( mDoc.getSelection().start() );
if ( !mLocked && mHighlightCurrentLine ) {
- primitives.setColor( mCurrentLineBackgroundColor );
+
+ primitives.setColor( Color( mCurrentLineBackgroundColor ).blendAlpha( mAlpha ) );
primitives.drawRectangle( Rectf(
Vector2f( startScroll.x + mScroll.x, startScroll.y + cursor.line() * lineHeight ),
Sizef( mSize.getWidth(), lineHeight ) ) );
@@ -104,7 +111,7 @@ void UICodeEditor::draw() {
if ( mLineBreakingColumn ) {
Float lineBreakingOffset = start.x + getGlyphWidth() * mLineBreakingColumn;
- primitives.setColor( mLineBreakColumnColor );
+ primitives.setColor( Color( mLineBreakColumnColor ).blendAlpha( mAlpha ) );
primitives.drawLine(
{{lineBreakingOffset, start.y}, {lineBreakingOffset, start.y + mSize.getHeight()}} );
}
@@ -122,11 +129,11 @@ void UICodeEditor::draw() {
drawLineText( i, {startScroll.x, startScroll.y + lineHeight * i}, charSize );
}
- if ( mCursorVisible && !mLocked ) {
+ if ( mCursorVisible && !mLocked && isTextSelectionEnabled() ) {
Vector2f cursorPos( startScroll.x + getXOffsetCol( cursor ),
startScroll.y + cursor.line() * lineHeight );
- primitives.setColor( mCaretColor );
+ primitives.setColor( Color( mCaretColor ).blendAlpha( mAlpha ) );
primitives.drawRectangle(
Rectf( cursorPos, Sizef( PixelDensity::dpToPx( 2 ), lineHeight ) ) );
}
@@ -205,6 +212,10 @@ UICodeEditor* UICodeEditor::setFontSize( Float dpSize ) {
return this;
}
+const Float& UICodeEditor::getFontSize() const {
+ return mFontStyleConfig.getFontCharacterSize();
+}
+
UICodeEditor* UICodeEditor::setFontColor( const Color& color ) {
if ( mFontStyleConfig.getFontColor() != color ) {
mFontStyleConfig.FontColor = color;
@@ -213,6 +224,14 @@ UICodeEditor* UICodeEditor::setFontColor( const Color& color ) {
return this;
}
+const Color& UICodeEditor::getFontColor() const {
+ return mFontStyleConfig.getFontColor();
+}
+
+const Color& UICodeEditor::getFontSelectedColor() {
+ return mFontStyleConfig.getFontSelectedColor();
+}
+
UICodeEditor* UICodeEditor::setFontSelectedColor( const Color& color ) {
if ( mFontStyleConfig.getFontSelectedColor() != color ) {
mFontStyleConfig.FontSelectedColor = color;
@@ -229,6 +248,10 @@ UICodeEditor* UICodeEditor::setFontSelectionBackColor( const Color& color ) {
return this;
}
+const Color& UICodeEditor::getFontSelectionBackColor() const {
+ return mFontStyleConfig.getFontSelectionBackColor();
+}
+
const Uint32& UICodeEditor::getTabWidth() const {
return mTabWidth;
}
@@ -281,8 +304,8 @@ size_t UICodeEditor::getLineNumberDigits() const {
}
Float UICodeEditor::getLineNumberWidth() const {
- return getLineNumberDigits() * getGlyphWidth() + getLineNumberPaddingLeft() +
- getLineNumberPaddingRight();
+ return eeceil( getLineNumberDigits() * getGlyphWidth() + getLineNumberPaddingLeft() +
+ getLineNumberPaddingRight() );
}
const bool& UICodeEditor::getShowLineNumber() const {
@@ -447,8 +470,8 @@ Sizef UICodeEditor::getMaxScroll() const {
}
Uint32 UICodeEditor::onMouseDown( const Vector2i& position, const Uint32& flags ) {
- if ( !getUISceneNode()->getEventDispatcher()->isNodeDragging() && NULL != mFont &&
- !mMouseDown && ( flags & EE_BUTTON_LMASK ) ) {
+ if ( isTextSelectionEnabled() && !getUISceneNode()->getEventDispatcher()->isNodeDragging() &&
+ NULL != mFont && !mMouseDown && ( flags & EE_BUTTON_LMASK ) ) {
mMouseDown = true;
Input* input = getUISceneNode()->getWindow()->getInput();
input->captureMouse( true );
@@ -462,8 +485,8 @@ Uint32 UICodeEditor::onMouseDown( const Vector2i& position, const Uint32& flags
}
Uint32 UICodeEditor::onMouseMove( const Vector2i& position, const Uint32& flags ) {
- if ( !getUISceneNode()->getEventDispatcher()->isNodeDragging() && NULL != mFont && mMouseDown &&
- ( flags & EE_BUTTON_LMASK ) ) {
+ if ( isTextSelectionEnabled() && !getUISceneNode()->getEventDispatcher()->isNodeDragging() &&
+ NULL != mFont && mMouseDown && ( flags & EE_BUTTON_LMASK ) ) {
TextRange selection = mDoc.getSelection();
selection.setStart( resolveScreenPosition( position.asFloat() ) );
mDoc.setSelection( selection );
@@ -476,8 +499,10 @@ Uint32 UICodeEditor::onMouseUp( const Vector2i& position, const Uint32& flags )
return UIWidget::onMouseUp( position, flags );
if ( flags & EE_BUTTON_LMASK ) {
- mMouseDown = false;
- getUISceneNode()->getWindow()->getInput()->captureMouse( false );
+ if ( mMouseDown ) {
+ mMouseDown = false;
+ getUISceneNode()->getWindow()->getInput()->captureMouse( false );
+ }
} else if ( flags & EE_BUTTON_WDMASK ) {
if ( getUISceneNode()->getWindow()->getInput()->isControlPressed() ) {
mFontStyleConfig.CharacterSize = eemax( 4, mFontStyleConfig.CharacterSize - 1 );
@@ -536,7 +561,7 @@ void UICodeEditor::onPaddingChange() {
}
void UICodeEditor::updateScrollBar() {
- mVScrollBar->setPixelsSize( 0, mSize.getHeight() );
+ mVScrollBar->setPixelsSize( mVScrollBar->getPixelsSize().getWidth(), mSize.getHeight() );
mVScrollBar->setPixelsPosition( mSize.getWidth() - mVScrollBar->getPixelsSize().getWidth(), 0 );
int notVisibleLineCount = (int)mDoc.linesCount() - (int)getViewPortLineCount().y;
mVScrollBar->setPageStep( getViewPortLineCount().y / (float)mDoc.linesCount() );
@@ -592,17 +617,16 @@ int UICodeEditor::getVisibleLinesCount() {
void UICodeEditor::scrollToMakeVisible( const TextPosition& position ) {
auto lineRange = getVisibleLineRange();
- if ( position.line() >= lineRange.first && position.line() <= lineRange.second )
- return;
-
- // Vertical Scroll
- Float lineHeight = getLineHeight();
- Float min = eefloor( lineHeight * ( eemax( 0, position.line() - 1 ) ) );
- Float max = eefloor( lineHeight * ( position.line() + 2 ) - mSize.getHeight() );
- if ( min < mScroll.y )
- setScrollY( min );
- else if ( max > mScroll.y )
- setScrollY( max );
+ if ( position.line() < lineRange.first || position.line() > lineRange.second ) {
+ // Vertical Scroll
+ Float lineHeight = getLineHeight();
+ Float min = eefloor( lineHeight * ( eemax( 0, position.line() - 1 ) ) );
+ Float max = eefloor( lineHeight * ( position.line() + 2 ) - mSize.getHeight() );
+ if ( min < mScroll.y )
+ setScrollY( min );
+ else if ( max > mScroll.y )
+ setScrollY( max );
+ }
// Horizontal Scroll
Float offsetX = getXOffsetCol( position );
@@ -773,6 +797,153 @@ void UICodeEditor::addUnlockedCommand( const std::string& command ) {
mUnlockedCmd.insert( command );
}
+UICodeEditor* UICodeEditor::setFontShadowColor( const Color& color ) {
+ if ( mFontStyleConfig.ShadowColor != color ) {
+ mFontStyleConfig.ShadowColor = color;
+ invalidateDraw();
+ }
+
+ return this;
+}
+
+UICodeEditor* UICodeEditor::setFontStyle( const Uint32& fontStyle ) {
+ if ( mFontStyleConfig.Style != fontStyle ) {
+ mFontStyleConfig.Style = fontStyle;
+ invalidateDraw();
+ }
+
+ return this;
+}
+
+const Color& UICodeEditor::getFontShadowColor() const {
+ return mFontStyleConfig.getFontShadowColor();
+}
+
+const Uint32& UICodeEditor::getFontStyle() const {
+ return mFontStyleConfig.getFontStyle();
+}
+
+const Float& UICodeEditor::getOutlineThickness() const {
+ return mFontStyleConfig.OutlineThickness;
+}
+
+UICodeEditor* UICodeEditor::setOutlineThickness( const Float& outlineThickness ) {
+ if ( mFontStyleConfig.OutlineThickness != outlineThickness ) {
+ mFontStyleConfig.OutlineThickness = outlineThickness;
+ invalidateDraw();
+ }
+
+ return this;
+}
+
+const Color& UICodeEditor::getOutlineColor() const {
+ return mFontStyleConfig.OutlineColor;
+}
+
+UICodeEditor* UICodeEditor::setOutlineColor( const Color& outlineColor ) {
+ if ( mFontStyleConfig.OutlineColor != outlineColor ) {
+ mFontStyleConfig.OutlineColor = outlineColor;
+ invalidateDraw();
+ }
+
+ return this;
+}
+
+bool UICodeEditor::isTextSelectionEnabled() const {
+ return 0 != ( mFlags & UI_TEXT_SELECTION_ENABLED );
+}
+
+void UICodeEditor::setTextSelection( const bool& active ) {
+ if ( active ) {
+ mFlags |= UI_TEXT_SELECTION_ENABLED;
+ } else {
+ mFlags &= ~UI_TEXT_SELECTION_ENABLED;
+ }
+}
+
+bool UICodeEditor::applyProperty( const StyleSheetProperty& attribute ) {
+ if ( !checkPropertyDefinition( attribute ) )
+ return false;
+
+ switch ( attribute.getPropertyDefinition()->getPropertyId() ) {
+ case PropertyId::Locked:
+ setLocked( attribute.asBool() );
+ break;
+ case PropertyId::Color:
+ setFontColor( attribute.asColor() );
+ break;
+ case PropertyId::ShadowColor:
+ setFontShadowColor( attribute.asColor() );
+ break;
+ case PropertyId::SelectionColor:
+ setFontSelectedColor( attribute.asColor() );
+ break;
+ case PropertyId::SelectionBackColor:
+ setFontSelectionBackColor( attribute.asColor() );
+ break;
+ case PropertyId::FontFamily: {
+ Font* font = FontManager::instance()->getByName( attribute.asString() );
+ if ( NULL != font && font->loaded() ) {
+ setFont( font );
+ }
+ break;
+ }
+ case PropertyId::FontSize:
+ setFontSize( lengthFromValueAsDp( attribute ) );
+ break;
+ case PropertyId::FontStyle: {
+ setFontStyle( attribute.asFontStyle() );
+ break;
+ }
+ case PropertyId::TextStrokeWidth:
+ setOutlineThickness( lengthFromValue( attribute ) );
+ break;
+ case PropertyId::TextStrokeColor:
+ setOutlineColor( attribute.asColor() );
+ break;
+ case PropertyId::TextSelection:
+ setTextSelection( attribute.asBool() );
+ break;
+ default:
+ return UIWidget::applyProperty( attribute );
+ }
+
+ return true;
+}
+
+std::string UICodeEditor::getPropertyString( const PropertyDefinition* propertyDef,
+ const Uint32& propertyIndex ) {
+ if ( NULL == propertyDef )
+ return "";
+
+ switch ( propertyDef->getPropertyId() ) {
+ case PropertyId::Locked:
+ return isLocked() ? "true" : "false";
+ case PropertyId::Color:
+ return getFontColor().toHexString();
+ case PropertyId::ShadowColor:
+ return getFontShadowColor().toHexString();
+ case PropertyId::SelectionColor:
+ return getFontSelectedColor().toHexString();
+ case PropertyId::SelectionBackColor:
+ return getFontSelectionBackColor().toHexString();
+ case PropertyId::FontFamily:
+ return NULL != getFont() ? getFont()->getName() : "";
+ case PropertyId::FontSize:
+ return String::format( "%.2fdp", getFontSize() );
+ case PropertyId::FontStyle:
+ return Text::styleFlagToString( getFontStyle() );
+ case PropertyId::TextStrokeWidth:
+ return String::toStr( PixelDensity::dpToPx( getOutlineThickness() ) );
+ case PropertyId::TextStrokeColor:
+ return getOutlineColor().toHexString();
+ case PropertyId::TextSelection:
+ return isTextSelectionEnabled() ? "true" : "false";
+ default:
+ return UIWidget::getPropertyString( propertyDef, propertyIndex );
+ }
+}
+
Int64 UICodeEditor::getColFromXOffset( Int64 lineNumber, const Float& x ) const {
if ( x <= 0 )
return 0;
@@ -902,9 +1073,10 @@ void UICodeEditor::drawLineText( const Int64& index, Vector2f position, const Fl
if ( position.x + textWidth >= mScreenPos.x &&
position.x <= mScreenPos.x + mSize.getWidth() ) {
Text line( "", mFont, fontSize );
+ Color color( mColorScheme.getSyntaxColor( token.type ), mAlpha );
line.setStyleConfig( mFontStyleConfig );
line.setString( token.text );
- line.setColor( mColorScheme.getSyntaxColor( token.type ) );
+ line.setColor( color );
line.draw( position.x, position.y );
} else if ( position.x > mScreenPos.x + mSize.getWidth() ) {
break;
@@ -917,7 +1089,8 @@ void UICodeEditor::drawSelection( const std::pair& lineRange, const Ve
const Float& lineHeight ) {
Primitives primitives;
primitives.setForceDraw( false );
- primitives.setColor( mFontStyleConfig.getFontSelectionBackColor() );
+ primitives.setColor(
+ Color( mFontStyleConfig.getFontSelectionBackColor() ).blendAlpha( mAlpha ) );
TextRange selection = mDoc.getSelection( true );
@@ -956,7 +1129,7 @@ void UICodeEditor::drawLineNumbers( const std::pair& lineRange,
const Float& lineHeight, const Float& lineNumberWidth,
const int& lineNumberDigits, const Float& fontSize ) {
Primitives primitives;
- primitives.setColor( mLineNumberBackgroundColor );
+ primitives.setColor( Color( mLineNumberBackgroundColor ).blendAlpha( mAlpha ) );
primitives.drawRectangle( Rectf( screenStart, Sizef( lineNumberWidth, mSize.getHeight() ) ) );
TextRange selection = mDoc.getSelection( true );
for ( int i = lineRange.first; i <= lineRange.second; i++ ) {
@@ -974,7 +1147,7 @@ void UICodeEditor::drawIndentationGuide( const std::pair& lineRange,
const Vector2f& startScroll, const Float& lineHeight ) {
Primitives primitives;
primitives.setForceDraw( false );
- primitives.setColor( mIndentationGuideColor );
+ primitives.setColor( Color( mIndentationGuideColor ).blendAlpha( mAlpha ) );
primitives.setLineWidth( 1 );
for ( int i = lineRange.first; i <= lineRange.second; i++ ) {
Float charWidth = getGlyphWidth();
diff --git a/src/eepp/ui/uicombobox.cpp b/src/eepp/ui/uicombobox.cpp
index 229264ef7..2d0077401 100644
--- a/src/eepp/ui/uicombobox.cpp
+++ b/src/eepp/ui/uicombobox.cpp
@@ -18,14 +18,13 @@ UIComboBox::UIComboBox() : UIWidget( "combobox" ), mDropDownList( NULL ), mButto
mDropDownList->setTextSelection( true );
mDropDownList->addEventListener( Event::OnPaddingChange,
[this]( const Event* ) { onPaddingChange(); } );
- mDropDownList->addEventListener( Event::OnSizeChange,
- [&]( const Event* event ) { onSizeChange(); } );
+ mDropDownList->addEventListener( Event::OnSizeChange, [&]( const Event* ) { onSizeChange(); } );
mButton = UIWidget::NewWithTag( "combobox::button" );
mButton->setParent( this );
mButton->setVisible( true );
mButton->setEnabled( true );
- mButton->addEventListener( Event::OnSizeChange, [&]( const Event* event ) { onSizeChange(); } );
+ mButton->addEventListener( Event::OnSizeChange, [&]( const Event* ) { onSizeChange(); } );
applyDefaultTheme();
}
diff --git a/src/eepp/ui/uispinbox.cpp b/src/eepp/ui/uispinbox.cpp
index 2336ba735..ff4f5b9ee 100644
--- a/src/eepp/ui/uispinbox.cpp
+++ b/src/eepp/ui/uispinbox.cpp
@@ -21,9 +21,7 @@ UISpinBox::UISpinBox() :
mInput->setEnabled( true );
mInput->setParent( this );
- auto cb = [&]( const Event* event ) {
- adjustChilds();
- };
+ auto cb = [&]( const Event* ) { adjustChilds(); };
mPushUp = UIWidget::NewWithTag( "spinbox::btnup" );
mPushUp->setVisible( true );
@@ -223,7 +221,7 @@ const Float& UISpinBox::getMaxValue() const {
return mMaxValue;
}
-void UISpinBox::onBufferChange( const Event* event ) {
+void UISpinBox::onBufferChange( const Event* ) {
if ( !mInput->getText().size() ) {
setValue( 0 );
} else {
diff --git a/src/tests/test_all/test.cpp b/src/tests/test_all/test.cpp
index 3aaac2b07..69cbc51f6 100644
--- a/src/tests/test_all/test.cpp
+++ b/src/tests/test_all/test.cpp
@@ -248,21 +248,21 @@ void EETest::loadFonts() {
mFTE.restart();
FontTrueType::New( "NotoSans-Regular", MyPath + "fonts/NotoSans-Regular.ttf" );
- FontTrueType::New( "DejaVuSansMono", MyPath + "fonts/DejaVuSansMono.ttf" );
+ FontTrueType::New( "monospace", MyPath + "fonts/DejaVuSansMono.ttf" );
onFontLoaded();
}
void EETest::onFontLoaded() {
TTF = FontManager::instance()->getByName( "NotoSans-Regular" );
- Font* DBSM = FontManager::instance()->getByName( "DejaVuSansMono" );
+ Font* monospace = FontManager::instance()->getByName( "monospace" );
eePRINTL( "Fonts loading time: %4.3f ms.", mFTE.getElapsed().asMilliseconds() );
eeASSERT( TTF != NULL );
- eeASSERT( DBSM != NULL );
+ eeASSERT( monospace != NULL );
- Con.create( DBSM, true );
+ Con.create( monospace, true );
Con.ignoreCharOnPrompt( 186 ); // 'ยบ'
mBuda = String::fromUtf8(
@@ -282,7 +282,7 @@ void EETest::onFontLoaded() {
mFBOText.setOutlineThickness( 1 );
mFBOText.setOutlineColor( Color( 0, 0, 0, 255 ) );
- mInfoText.create( DBSM, "", Color( 100, 100, 100, 255 ) );
+ mInfoText.create( monospace, "", Color( 100, 100, 100, 255 ) );
mInfoText.setOutlineThickness( 1 );
}
@@ -1160,8 +1160,12 @@ void EETest::createDecoratedWindow() {
UI_TEXT_SELECTION_ENABLED );
txtBox->setParent( TabWidget );
txtBox->setText( mBuda );
-
TabWidget->add( "TextBox", txtBox );
+
+ UICodeEditor* codeEditor = UICodeEditor::New();
+ codeEditor->setParent( TabWidget );
+ codeEditor->getDocument().textInput( mBuda );
+ TabWidget->add( "CodeEditor", codeEditor );
}
void EETest::onCloseClick( const Event* ) {
diff --git a/src/tools/uieditor/uieditor.cpp b/src/tools/uieditor/uieditor.cpp
index c42030b87..4b11baf64 100644
--- a/src/tools/uieditor/uieditor.cpp
+++ b/src/tools/uieditor/uieditor.cpp
@@ -999,7 +999,7 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) {
FontTrueType* font =
FontTrueType::New( "NotoSans-Regular", resPath + "assets/fonts/NotoSans-Regular.ttf" );
FontTrueType* fontMono =
- FontTrueType::New( "DejaVuSansMono", resPath + "assets/fonts/DejaVuSansMono.ttf" );
+ FontTrueType::New( "monospace", resPath + "assets/fonts/DejaVuSansMono.ttf" );
console = eeNew( Console, ( fontMono, true, true, 1024 * 1000, 0, window ) );