Skip to content

Commit

Permalink
Added Gtk blueprint lang. Fix TextInput size in UIMessageBox. Some fi…
Browse files Browse the repository at this point in the history
…xes on path resolve in GitPlugin.
  • Loading branch information
SpartanJ committed Feb 2, 2024
1 parent 7da6093 commit db9e263
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 25 deletions.
75 changes: 75 additions & 0 deletions src/eepp/ui/doc/languages/blueprint.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include <eepp/ui/doc/languages/blueprint.hpp>
#include <eepp/ui/doc/syntaxdefinitionmanager.hpp>

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
10 changes: 10 additions & 0 deletions src/eepp/ui/doc/languages/blueprint.hpp
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion src/eepp/ui/doc/syntaxdefinitionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <eepp/system/packmanager.hpp>
#include <eepp/ui/doc/languages/angelscript.hpp>
#include <eepp/ui/doc/languages/batchscript.hpp>
#include <eepp/ui/doc/languages/blueprint.hpp>
#include <eepp/ui/doc/languages/crystal.hpp>
#include <eepp/ui/doc/languages/css.hpp>
#include <eepp/ui/doc/languages/d.hpp>
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 0 additions & 4 deletions src/eepp/ui/uimessagebox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down
40 changes: 20 additions & 20 deletions src/tools/ecode/plugins/git/gitplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -954,23 +954,23 @@ void GitPlugin::stashPush( const std::vector<std::string>& 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" ) );
Expand Down

0 comments on commit db9e263

Please sign in to comment.