Skip to content

Commit d85e29e

Browse files
authored
Merge pull request #122 from NuiCpp/feat/emplace_element
Standalone Elements And Range Performance Rework
2 parents 7034674 + 8ceaabe commit d85e29e

37 files changed

+3765
-635
lines changed

cmake/dependencies/interval_tree.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
option(NUI_FETCH_INTERVAL_TREE "Fetch interval tree" ON)
22
set(NUI_INTERVAL_TREE_GIT_REPOSITORY "https://github.com/5cript/interval-tree.git" CACHE STRING "interval tree git repository")
3-
set(NUI_INTERVAL_TREE_GIT_TAG "309b9c725191d4bb1d134f28a8a32ad2f68a8ffa" CACHE STRING "interval tree git tag")
3+
set(NUI_INTERVAL_TREE_GIT_TAG "v2.2.4" CACHE STRING "interval tree git tag")
44

55
if(NUI_FETCH_INTERVAL_TREE)
66
include(FetchContent)
77
FetchContent_Declare(
88
interval-tree
99
GIT_REPOSITORY ${NUI_INTERVAL_TREE_GIT_REPOSITORY}
10-
GIT_TAG ${NUI_INTERVAL_TREE_GIT_TAG}
10+
GIT_TAG ${NUI_INTERVAL_TREE_GIT_TAG}
1111
)
1212

1313
FetchContent_MakeAvailable(interval-tree)

nui/include/nui/backend/filesystem/special_paths.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ namespace Nui
1313
* %appdata% Linux: home. Windows: CSIDL_APPDATA
1414
* %localappdata% Linux: home. Windows: CSIDL_APPDATA_LOCAL
1515
* %temp% Linux: /tmp. Windows: ${USER}\AppData\Local\Temp
16+
* %config_home% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_APPDATA
17+
* %config_home2% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_MYDOCUMENTS
18+
* %config_home3% Linux: $XDG_CONFIG_HOME. Windows: home
19+
* %state_home% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_APPDATA
20+
* %state_home2% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_MYDOCUMENTS
21+
* %state_home3% Linux: $XDG_CONFIG_HOME. Windows: home
22+
* %data_home% Linux: $XDG_DATA_HOME. Windows: CSIDL_APPDATA
23+
* %data_home2% Linux: $XDG_DATA_HOME. Windows: CSIDL_MYDOCUMENTS
24+
* %data_home3% Linux: $XDG_DATA_HOME. Windows: home
1625
*
1726
*
1827
* @param path

nui/include/nui/event_system/event_context.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include <nui/frontend/event_system/event_registry.hpp>
3+
#include <nui/event_system/event_registry.hpp>
44

55
#include <memory>
66

@@ -38,6 +38,7 @@ namespace Nui
3838
{
3939
public:
4040
using EventIdType = EventRegistry::EventIdType;
41+
constexpr static auto invalidEventId = EventRegistry::invalidEventId;
4142

4243
EventContext()
4344
: impl_{std::make_shared<DefaultEventEngine>()}
@@ -56,6 +57,10 @@ namespace Nui
5657
{
5758
return impl_->eventRegistry().activateEvent(id);
5859
}
60+
auto activateAfterEffect(EventIdType id)
61+
{
62+
return impl_->eventRegistry().activateAfterEffect(id);
63+
}
5964
void executeActiveEventsImmediately()
6065
{
6166
impl_->eventRegistry().executeActiveEvents();
@@ -72,6 +77,10 @@ namespace Nui
7277
{
7378
impl_->eventRegistry().cleanInvalidEvents();
7479
}
80+
void removeAfterEffect(EventIdType id)
81+
{
82+
impl_->eventRegistry().removeAfterEffect(id);
83+
}
7584
void reset()
7685
{
7786
impl_->eventRegistry().clear();

nui/include/nui/event_system/event_registry.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ namespace Nui
4242
return registry_.select(id);
4343
}
4444

45+
/**
46+
* @brief Activate an after effect.
47+
*
48+
* @param id
49+
* @return RegistryType::SelectionResult
50+
*/
51+
RegistryType::SelectionResult activateAfterEffect(EventIdType id)
52+
{
53+
return afterEffects_.select(id);
54+
}
55+
56+
/**
57+
* @brief After effects are used to cause something to happen after all other events have been processed.
58+
* After effects are executed in indeterminate order.
59+
*
60+
* @param event
61+
* @return EventIdType
62+
*/
4563
EventIdType registerAfterEffect(Event event)
4664
{
4765
return afterEffects_.append(std::move(event));
@@ -85,6 +103,11 @@ namespace Nui
85103
registry_.erase(id);
86104
}
87105

106+
void removeAfterEffect(EventIdType id)
107+
{
108+
afterEffects_.erase(id);
109+
}
110+
88111
void clear()
89112
{
90113
registry_.clear();

0 commit comments

Comments
 (0)