Some minor improvements to ecode and general minor fixes.

This commit is contained in:
Martín Lucas Golini
2020-08-06 00:50:19 -03:00
parent 93bc53f379
commit 91a9a97dc5
10 changed files with 124 additions and 56 deletions

View File

@@ -11,6 +11,8 @@ class UISearchBar : public UILinearLayout {
UISearchBar() :
UILinearLayout( "searchbar", UIOrientation::Horizontal ),
mKeyBindings( getUISceneNode()->getWindow()->getInput() ) {}
public:
void addCommand( const std::string& name, const CommandCallback& cb ) { mCommands[name] = cb; }
void execute( const std::string& command ) {
auto cmdIt = mCommands.find( command );
@@ -29,10 +31,10 @@ class UISearchBar : public UILinearLayout {
auto cmdIt = mCommands.find( cmd );
if ( cmdIt != mCommands.end() ) {
cmdIt->second();
return 0;
return 1;
}
}
return 1;
return 0;
}
};
@@ -43,6 +45,8 @@ class UILocateBar : public UILinearLayout {
UILocateBar() :
UILinearLayout( "locatebar", UIOrientation::Horizontal ),
mKeyBindings( getUISceneNode()->getWindow()->getInput() ) {}
public:
void addCommand( const std::string& name, const CommandCallback& cb ) { mCommands[name] = cb; }
void execute( const std::string& command ) {
auto cmdIt = mCommands.find( command );
@@ -61,10 +65,10 @@ class UILocateBar : public UILinearLayout {
auto cmdIt = mCommands.find( cmd );
if ( cmdIt != mCommands.end() ) {
cmdIt->second();
return 0;
return 1;
}
}
return 1;
return 0;
}
};
@@ -75,6 +79,8 @@ class UIGlobalSearchBar : public UILinearLayout {
UIGlobalSearchBar() :
UILinearLayout( "globalsearchbar", UIOrientation::Vertical ),
mKeyBindings( getUISceneNode()->getWindow()->getInput() ) {}
public:
void addCommand( const std::string& name, const CommandCallback& cb ) { mCommands[name] = cb; }
void execute( const std::string& command ) {
auto cmdIt = mCommands.find( command );
@@ -93,10 +99,10 @@ class UIGlobalSearchBar : public UILinearLayout {
auto cmdIt = mCommands.find( cmd );
if ( cmdIt != mCommands.end() ) {
cmdIt->second();
return 0;
return 1;
}
}
return 1;
return 0;
}
};
@@ -349,6 +355,10 @@ class App : public UICodeEditorSplitter::Client {
void hideSearchBar();
void hideLocateBar();
bool trySendUnlockedCmd( const KeyEvent& keyEvent );
void goToLine();
};
#endif // EE_TOOLS_CODEEDITOR_HPP