Updated efsw.

ecode: Don't load inexistent project files.
Minor clean up.
This commit is contained in:
Martín Lucas Golini
2022-08-04 01:36:42 -03:00
parent 0ea4636bfc
commit 5a619349b2
3 changed files with 29 additions and 32 deletions

View File

@@ -428,24 +428,19 @@ static bool isNth( int a, int b, int count ) {
}
void StyleSheetSpecification::registerDefaultNodeSelectors() {
mNodeSelectors["empty"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
mNodeSelectors["empty"] = []( const UIWidget* node, int, int, const FunctionString& ) -> bool {
return node->getFirstChild() == NULL;
};
mNodeSelectors["first-child"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
mNodeSelectors["first-child"] = []( const UIWidget* node, int, int,
const FunctionString& ) -> bool {
return NULL != node->getParent() && node->getParent()->getFirstChild() == node;
};
mNodeSelectors["enabled"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
return node->isEnabled();
};
mNodeSelectors["disabled"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
return !node->isEnabled();
};
mNodeSelectors["first-of-type"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
mNodeSelectors["enabled"] = []( const UIWidget* node, int, int,
const FunctionString& ) -> bool { return node->isEnabled(); };
mNodeSelectors["disabled"] = []( const UIWidget* node, int, int,
const FunctionString& ) -> bool { return !node->isEnabled(); };
mNodeSelectors["first-of-type"] = []( const UIWidget* node, int, int,
const FunctionString& ) -> bool {
Node* child = NULL != node->getParent() ? node->getParent()->getFirstChild() : NULL;
Uint32 type = node->getType();
while ( NULL != child ) {
@@ -456,12 +451,12 @@ void StyleSheetSpecification::registerDefaultNodeSelectors() {
};
return false;
};
mNodeSelectors["last-child"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
mNodeSelectors["last-child"] = []( const UIWidget* node, int, int,
const FunctionString& ) -> bool {
return NULL != node->getParent() && node->getParent()->getLastChild() == node;
};
mNodeSelectors["last-of-type"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
mNodeSelectors["last-of-type"] = []( const UIWidget* node, int, int,
const FunctionString& ) -> bool {
Node* child = NULL != node->getParent() ? node->getParent()->getLastChild() : NULL;
Uint32 type = node->getType();
while ( NULL != child ) {
@@ -472,12 +467,12 @@ void StyleSheetSpecification::registerDefaultNodeSelectors() {
};
return false;
};
mNodeSelectors["only-child"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
mNodeSelectors["only-child"] = []( const UIWidget* node, int, int,
const FunctionString& ) -> bool {
return NULL != node->getParent() && node->getParent()->getChildCount() == 1;
};
mNodeSelectors["only-of-type"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
mNodeSelectors["only-of-type"] = []( const UIWidget* node, int, int,
const FunctionString& ) -> bool {
Node* child = NULL != node->getParent() ? node->getParent()->getFirstChild() : NULL;
Uint32 type = node->getType();
Uint32 typeCount = 0;
@@ -492,30 +487,30 @@ void StyleSheetSpecification::registerDefaultNodeSelectors() {
return typeCount == 1;
};
mNodeSelectors["nth-child"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
const FunctionString& ) -> bool {
return isNth( a, b, node->getNodeIndex() + 1 );
};
mNodeSelectors["nth-last-child"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
const FunctionString& ) -> bool {
return isNth( a, b, node->getChildCount() - node->getNodeIndex() );
};
mNodeSelectors["nth-of-type"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
const FunctionString& ) -> bool {
return isNth( a, b, node->getNodeOfTypeIndex() + 1 );
};
mNodeSelectors["nth-last-of-type"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
const FunctionString& ) -> bool {
return node->getParent() != NULL
? isNth( a, b,
node->getParent()->getChildOfTypeCount( node->getType() ) -
node->getNodeOfTypeIndex() )
: false;
};
mNodeSelectors["checked"] = []( const UIWidget* node, int a, int b,
const FunctionString& data ) -> bool {
mNodeSelectors["checked"] = []( const UIWidget* node, int, int,
const FunctionString& ) -> bool {
return 0 != ( node->getFlags() & UI_CHECKED );
};
mNodeSelectors["not"] = []( const UIWidget* node, int a, int b,
mNodeSelectors["not"] = []( const UIWidget* node, int, int,
const FunctionString& data ) -> bool {
if ( !data.isEmpty() && !data.getParameters().empty() && data.getName() == "not" ) {
for ( const auto& param : data.getParameters() ) {
@@ -641,8 +636,8 @@ static int getIndexEndingWith( const std::vector<std::string>& vec, const std::s
}
void StyleSheetSpecification::registerDefaultShorthandParsers() {
mShorthandParsers["empty"] = []( const ShorthandDefinition* shorthand,
std::string value ) -> std::vector<StyleSheetProperty> {
mShorthandParsers["empty"] = []( const ShorthandDefinition*,
std::string ) -> std::vector<StyleSheetProperty> {
return {};
};

View File

@@ -318,6 +318,8 @@ static void loadDocuments( UICodeEditorSplitter* editorSplitter, std::shared_ptr
for ( const auto& file : j["files"] ) {
if ( !file.contains( "type" ) || file["type"] == "editor" ) {
std::string path( file["path"] );
if ( !FileSystem::fileExists( path ) )
return;
TextRange selection( TextRange::fromString( file["selection"] ) );
editorSplitter->loadAsyncFileFromPathInNewTab(
path, pool,