From db9e2634b171b265101a8cfb19d8a397268e9479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Fri, 2 Feb 2024 20:26:13 -0300 Subject: [PATCH] Added Gtk blueprint lang. Fix TextInput size in UIMessageBox. Some fixes on path resolve in GitPlugin. --- src/eepp/ui/doc/languages/blueprint.cpp | 75 +++++++++++++++++++++ src/eepp/ui/doc/languages/blueprint.hpp | 10 +++ src/eepp/ui/doc/syntaxdefinitionmanager.cpp | 4 +- src/eepp/ui/uimessagebox.cpp | 4 -- src/tools/ecode/plugins/git/gitplugin.cpp | 40 +++++------ 5 files changed, 108 insertions(+), 25 deletions(-) create mode 100644 src/eepp/ui/doc/languages/blueprint.cpp create mode 100644 src/eepp/ui/doc/languages/blueprint.hpp diff --git a/src/eepp/ui/doc/languages/blueprint.cpp b/src/eepp/ui/doc/languages/blueprint.cpp new file mode 100644 index 000000000..832de1d50 --- /dev/null +++ b/src/eepp/ui/doc/languages/blueprint.cpp @@ -0,0 +1,75 @@ +#include +#include + +namespace EE { namespace UI { namespace Doc { namespace Language { + +void addBlueprint() { + + SyntaxDefinitionManager::instance()->add( + + { "Blueprint", + { "%.blp$" }, + { + { { "//.*" }, "comment" }, + { { "/%*", "%*/" }, "comment" }, + { { "'", "'", "\\" }, "string" }, + { { "\"", "\"", "\\" }, "string" }, + { { "%.?%d+" }, "number" }, + { { "%[.*%]" }, "literal" }, + { { "%$" }, "operator" }, + { { "(=>%s*%$)(.*)(%(%))" }, { "normal", "operator", "function", "normal" } }, + { { "([%w-_]+)(%s*:)" }, { "normal", "keyword", "normal" } }, + { { "([%w_-%.]+%s*)({)" }, { "normal", "keyword2", "normal" } }, + { { "([%w_-%.]+%s*)([%w_-]+%s*{)" }, { "normal", "keyword2", "normal" } }, + { { "[%w-_]+" }, "symbol" }, + { { "%s+" }, "normal" }, + { { "%w+%f[%s]" }, "normal" }, + + }, + { + { "no-sync-create", "keyword" }, + { "section", "keyword" }, + { "bind", "keyword" }, + { "setters", "keyword2" }, + { "default", "keyword" }, + { "suggested", "keyword" }, + { "using", "keyword" }, + { "strings", "keyword2" }, + { "swapped", "keyword" }, + { "accessibility", "keyword2" }, + { "responses", "keyword2" }, + { "mime-types", "keyword2" }, + { "after", "keyword" }, + { "menu", "keyword" }, + { "mark", "keyword2" }, + { "destructive", "keyword" }, + { "submenu", "keyword" }, + { "suffixes", "keyword2" }, + { "patterns", "keyword2" }, + { "item", "keyword2" }, + { "false", "literal" }, + { "condition", "keyword2" }, + { "null", "literal" }, + { "bidirectional", "keyword" }, + { "inverted", "keyword" }, + { "true", "literal" }, + { "bind-property", "keyword" }, + { "marks", "keyword2" }, + { "C_", "operator" }, + { "sync-create", "keyword" }, + { "template", "keyword" }, + { "widgets", "keyword2" }, + { "_", "operator" }, + { "styles", "keyword2" }, + { "items", "keyword2" }, + { "layout", "keyword2" }, + { "disabled", "keyword" }, + + }, + "//", + {} + + } ); +} + +}}}} // namespace EE::UI::Doc::Language diff --git a/src/eepp/ui/doc/languages/blueprint.hpp b/src/eepp/ui/doc/languages/blueprint.hpp new file mode 100644 index 000000000..4369ac0c4 --- /dev/null +++ b/src/eepp/ui/doc/languages/blueprint.hpp @@ -0,0 +1,10 @@ +#ifndef EE_UI_DOC_Blueprint +#define EE_UI_DOC_Blueprint + +namespace EE { namespace UI { namespace Doc { namespace Language { + +extern void addBlueprint(); + +}}}} // namespace EE::UI::Doc::Language + +#endif diff --git a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp index e0780bd69..54fc1bd5a 100644 --- a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp +++ b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -1679,13 +1680,14 @@ SyntaxDefinitionManager::SyntaxDefinitionManager() { if ( ms_singleton == nullptr ) ms_singleton = this; - mDefinitions.reserve( 80 ); + mDefinitions.reserve( 81 ); // Register some languages support. addPlainText(); addAngelScript(); addBash(); addBatchScript(); + addBlueprint(); addC(); addCMake(); addContainerfile(); diff --git a/src/eepp/ui/uimessagebox.cpp b/src/eepp/ui/uimessagebox.cpp index 8738b4d04..e08d22c97 100644 --- a/src/eepp/ui/uimessagebox.cpp +++ b/src/eepp/ui/uimessagebox.cpp @@ -114,10 +114,6 @@ void UIMessageBox::setTheme( UITheme* theme ) { mTextBox->setTheme( theme ); mButtonOK->setTheme( theme ); mButtonCancel->setTheme( theme ); - if ( mTextInput ) - mTextInput->setTheme( theme ); - if ( mTextEdit ) - mTextEdit->setTheme( theme ); if ( getTranslatorString( "@string/msg_box_retry", "Retry" ) != mButtonOK->getText() ) { Drawable* okIcon = getUISceneNode()->findIconDrawable( "ok", PixelDensity::dpToPxI( 16 ) ); diff --git a/src/tools/ecode/plugins/git/gitplugin.cpp b/src/tools/ecode/plugins/git/gitplugin.cpp index bae3a7415..e26cd814f 100644 --- a/src/tools/ecode/plugins/git/gitplugin.cpp +++ b/src/tools/ecode/plugins/git/gitplugin.cpp @@ -531,9 +531,9 @@ void GitPlugin::checkout( Git::Branch branch ) { const auto checkOutFn = [this, branch]( bool createLocal ) { mLoader->setVisible( true ); mThreadPool->run( [this, branch, createLocal] { - auto result = createLocal - ? mGit->checkoutAndCreateLocalBranch( branch.name, repoSelected() ) - : mGit->checkout( branch.name, repoSelected() ); + auto result = + createLocal ? mGit->checkoutAndCreateLocalBranch( branch.name, "", repoSelected() ) + : mGit->checkout( branch.name, repoSelected() ); if ( result.success() ) { { std::string repoSel = repoSelected(); @@ -954,23 +954,23 @@ void GitPlugin::stashPush( const std::vector& files, const std::str rKeepWorkingTree->setText( i18n( "git_stash_keep_working_tree", "Keep Working Tree" ) ); rKeepWorkingTree->toPosition( 3 ); - msgBox->on( Event::OnConfirm, - [this, msgBox, rKeepIndex, rKeepWorkingTree, files, repoPath]( const Event* ) { - bool keepIndex = rKeepIndex->isActive(); - bool keepWorkingTree = rKeepWorkingTree->isActive(); - std::string message = msgBox->getTextInput()->getText().toUtf8(); - String::trimInPlace( message ); - String::trimInPlace( message, '\n' ); - msgBox->closeWindow(); - runAsync( - [this, files, keepIndex, keepWorkingTree, repoPath, message]() { - auto res = mGit->stashPush( files, message, keepIndex, repoPath ); - if ( res.success() && keepWorkingTree ) - mGit->stashApply( "stash@{0}", true, repoPath ); - return res; - }, - true, true ); - } ); + msgBox->on( Event::OnConfirm, [this, msgBox, rKeepIndex, rKeepWorkingTree, files, + repoPath]( const Event* ) { + bool keepIndex = rKeepIndex->isActive(); + bool keepWorkingTree = rKeepWorkingTree->isActive(); + std::string message = msgBox->getTextInput()->getText().toUtf8(); + String::trimInPlace( message ); + String::trimInPlace( message, '\n' ); + msgBox->closeWindow(); + runAsync( + [this, files, keepIndex, keepWorkingTree, repoPath, message]() { + auto res = mGit->stashPush( fixFilePaths( files ), message, keepIndex, repoPath ); + if ( res.success() && keepWorkingTree ) + mGit->stashApply( "stash@{0}", true, repoPath ); + return res; + }, + true, true ); + } ); msgBox->setCloseShortcut( { KEY_ESCAPE, KEYMOD_NONE } ); msgBox->setTitle( i18n( "git_stash_save", "Save Stash" ) );