From b9c0a4439581af52337bd51656d956eb585837da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sun, 14 Jun 2020 05:33:26 -0300 Subject: [PATCH] Minor fixes in syntax definitions. Minor fixes in breeze theme. Allow to set the pixel density in the code editor. --- bin/assets/ui/breeze.css | 6 +++--- src/eepp/ui/doc/syntaxdefinitionmanager.cpp | 11 +++++------ src/tools/codeeditor/codeeditor.cpp | 15 ++++++++------- src/tools/codeeditor/codeeditor.hpp | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/bin/assets/ui/breeze.css b/bin/assets/ui/breeze.css index 65bded2f0..591cb11ae 100644 --- a/bin/assets/ui/breeze.css +++ b/bin/assets/ui/breeze.css @@ -407,7 +407,7 @@ TabWidget { TabWidget::TabBar { background-image: rectangle(solid, var(--tab-line)); - background-size: 100% 1px; + background-size: 100% 1dp; background-position-y: bottom; } @@ -417,7 +417,7 @@ Tab { border-right-color: transparent; border-top-color: transparent; background-image: rectangle(solid, var(--tab-line)); - background-size: 100% 1px; + background-size: 100% 1dp; background-position-y: bottom; height: 24dp; transition: background-color 0.15s; @@ -647,7 +647,7 @@ Menu::Separator { height: 3dp; background-color: var(--button-back); background-image: rectangle(solid, var(--button-border)); - background-size: 100% 1px; + background-size: 100% 1dp; background-position: center; } diff --git a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp index efcc8d30f..d20f67740 100644 --- a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp +++ b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp @@ -120,8 +120,8 @@ SyntaxDefinitionManager::SyntaxDefinitionManager() { { {{"\"", "\"", "\\"}, "string"}, {{"'", "'", "\\"}, "string"}, - {{"%[%{", "%]%]"}, "string"}, - {{"%-%-%[%{", "%]%]"}, "comment"}, + {{"%[%[", "%]%]"}, "string"}, + {{"%-%-%[%[", "%]%]"}, "comment"}, {{"%-%-.-\n"}, "comment"}, {{"-?0x%x+"}, "number"}, {{"-?%d+[%d%.eE]*"}, "number"}, @@ -216,7 +216,7 @@ SyntaxDefinitionManager::SyntaxDefinitionManager() { // sh - bash add( {"Bash", - {"^#!.*bin.*sh\n", "^#!.*bin.*bash\n"}, + {"%.sh$", "%.bash$"}, { {{"#.*\n"}, "comment"}, {{"[[\\.]]"}, "normal"}, @@ -864,7 +864,7 @@ SyntaxDefinitionManager::SyntaxDefinitionManager() { {{"#", "\n"}, "comment"}, {{"\"", "\"", "\\"}, "string"}, {{"'", "'", "\\"}, "string"}, - {{"%{", "%]"}, "keyword2"}, + {{"%[", "%]"}, "keyword2"}, {{"[%a][%w_-]*%s*%f[=]"}, "keyword"}, {{"[=]"}, "operator"}, {{"https?://%S+"}, "function"}, @@ -1537,7 +1537,7 @@ SyntaxDefinitionManager::SyntaxDefinitionManager() { {{"&"}, "operator"}, {{"\\\\"}, "operator"}, {{"%$", "%$"}, "operator"}, - {{"\\%{", "\\]"}, "operator"}, + {{"\\%[", "\\]"}, "operator"}, {{"{", "}"}, "keyword"}, {{"\\%w*"}, "keyword2"}, }, @@ -1622,7 +1622,6 @@ SyntaxDefinitionManager::SyntaxDefinitionManager() { }, "//"} ); - // Batch script std::unordered_map> batchSymTable = { {"keyword", diff --git a/src/tools/codeeditor/codeeditor.cpp b/src/tools/codeeditor/codeeditor.cpp index b75b58fc8..be45f5da5 100644 --- a/src/tools/codeeditor/codeeditor.cpp +++ b/src/tools/codeeditor/codeeditor.cpp @@ -903,10 +903,10 @@ void App::updateEditorState() { updateCurrentFiletype(); } -void App::init( const std::string& file ) { +void App::init( const std::string& file, const Float& pidelDensity ) { DisplayManager* displayManager = Engine::instance()->getDisplayManager(); Display* currentDisplay = displayManager->getDisplayIndex( 0 ); - Float pixelDensity = currentDisplay->getPixelDensity(); + Float pixelDensity = pidelDensity > 0 ? pidelDensity : currentDisplay->getPixelDensity(); displayManager->enableScreenSaver(); displayManager->enableMouseFocusClickThrough(); @@ -947,10 +947,8 @@ void App::init( const std::string& file ) { mTheme = UITheme::load( "uitheme", "uitheme", "", font, resPath + "assets/ui/breeze.css" ); mUISceneNode->setStyleSheet( mTheme->getStyleSheet() ); - mUISceneNode->getUIThemeManager() - ->setDefaultTheme( mTheme ) - ->setDefaultFont( font ) - ->add( mTheme ); + mUISceneNode->getUIThemeManager()->setDefaultTheme( mTheme )->setDefaultFont( font )->add( + mTheme ); auto colorSchemes = SyntaxColorScheme::loadFromFile( resPath + "assets/colorschemes/colorschemes.conf" ); @@ -1057,7 +1055,10 @@ void App::init( const std::string& file ) { EE_MAIN_FUNC int main( int argc, char* argv[] ) { args::ArgumentParser parser( "ecode" ); + args::HelpFlag help( parser, "help", "Display this help menu", {'h', "help"} ); args::Positional file( parser, "file", "The file path" ); + args::ValueFlag pixelDenstiyConf( + parser, "pixel-density", "Set default application pixel density", {'d', "pixel-density"} ); try { parser.ParseCLI( argc, argv ); @@ -1075,7 +1076,7 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) { } appInstance = eeNew( App, () ); - appInstance->init( file.Get() ); + appInstance->init( file.Get(), pixelDenstiyConf ? pixelDenstiyConf.Get() : 0.f ); eeSAFE_DELETE( appInstance ); Engine::destroySingleton(); diff --git a/src/tools/codeeditor/codeeditor.hpp b/src/tools/codeeditor/codeeditor.hpp index 8744d1bb8..b1aa8c32b 100644 --- a/src/tools/codeeditor/codeeditor.hpp +++ b/src/tools/codeeditor/codeeditor.hpp @@ -41,7 +41,7 @@ class App { ~App(); - void init( const std::string& file = "" ); + void init( const std::string& file, const Float& pidelDensity ); bool loadFileFromPath( const std::string& path, UICodeEditor* codeEditor = NULL );