Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented GUI edit control's text selection. #562

Merged
merged 6 commits into from
Mar 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions data/vcpkg/ports/rendergraph/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH
REPO DragonJoker/RenderGraph
REF 5a3b6af572f5dcc21b619bff68495b9e9962e309
REF 448f1b7f8b7f50ee247e84220c6643a412b458f8
HEAD_REF master
SHA512 ebe83bd6d7b864601083dcaa6d8b76045ecf4cc1f3e3ea8fe64fe780a97b2990db558c0da0f68e3e2f2c5b5b7ded2a1463605e4d85e0c8cc5edd49178203ce87
SHA512 73302f9c439e367ca4fe285a353ec6dbbfd67e9ec891b10c7e6fd81cc4dd8de0e3b94db881ebc43c04a3782de4cc2e306ea0c70c95000240d169381645eafe3c
)

vcpkg_from_github(OUT_SOURCE_PATH CMAKE_SOURCE_PATH
Expand Down
4 changes: 2 additions & 2 deletions data/vcpkg/ports/shaderwriter/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}

vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH
REPO DragonJoker/ShaderWriter
REF d5a4b5061ddca244005f2aba269411c402494ae8
REF d040c89bb543b2e1d646714e36a190816b8e06ef
HEAD_REF development
SHA512 c6256c9d57254127f2d0cfe8f4df94ed2ff0ed01c9e04d9fecf3dfbbb1f3a0b77a49ac2239afcc7fdb42327444bfeb17faf4dd5759ceb9342f06f4d2778508cd
SHA512 9f95604f866f2cdc3b392c135ae34b93075a004f60319b00f5fbd2251361c68d7ca68ae00709adc435e387b3cf1b6659e643b7d200c0e6c734aa29f66491e947
)

vcpkg_from_github(OUT_SOURCE_PATH CMAKE_SOURCE_PATH
Expand Down
3 changes: 2 additions & 1 deletion demos/CastorDvpTD/RenderPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,8 @@ namespace castortd

auto inputListener = wxGetApp().getCastor()->getUserInputListener();

if ( !inputListener || !inputListener->fireMouseWheel( castor::Position( 0, wheelRotation ) ) )
if ( !inputListener || !inputListener->fireMouseWheel( castor::Position( 0, wheelRotation )
, event.ControlDown(), event.AltDown(), event.ShiftDown() ) )
{
if ( wheelRotation < 0 )
{
Expand Down
2 changes: 1 addition & 1 deletion doc/Castor3D/Castor3D Scene.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion external/RenderGraph
Submodule RenderGraph updated 1 files
+10 −2 CMakeLists.txt
11 changes: 10 additions & 1 deletion include/Core/Castor3D/Engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,22 @@ namespace castor3d
*\~english
*\~brief Fires a mouse move event.
*\param[in] position The mouse position.
*\param[in] ctrl Tells if the Ctrl key is down.
*\param[in] alt Tells if the Alt key is down.
*\param[in] shift Tells if the Shift key is down.
*\return \p true if the event is processed by a handler.
*\~french
*\~brief Lance un évènement de déplacement de souris.
*\param[in] position La position de la souris.
*\param[in] ctrl Dit si la touche Ctrl est enfoncée.
*\param[in] alt Dit si la touche Alt est enfoncée.
*\param[in] shift Dit si la touche Shift est enfoncée.
*\return \p true si l'évènement est traité par un gestionnaire.
*/
C3D_API bool fireMouseMove( castor::Position const & position );
C3D_API bool fireMouseMove( castor::Position const & position
, bool ctrl
, bool alt
, bool shift );
/**
*\~english
*\brief Updates the engine, CPU wise.
Expand Down
156 changes: 79 additions & 77 deletions include/Core/Castor3D/Event/UserInput/EventHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ namespace castor3d
*/
virtual ~EventHandler()
{
doSwapQueue();
m_mutex.lock();
m_queue = {};
m_mutex.unlock();
}
/**
*\~english
Expand All @@ -109,28 +111,55 @@ namespace castor3d
eventPair.second();
}
}
/**
*\~english
*\return \p false if the control is disabled.
*/
bool isEnabled()const
{
return m_enabled;
}
/**
*\~english
*\~brief Sets if the control is enabled.
*/
void enable()
{
m_enabled = true;
onEnable( m_enabled );
}
/**
*\~english
*\~brief Sets if the control is disabled.
*/
void disable()
{
m_enabled = false;
onEnable( m_enabled );
}
OnEnable onEnable;

//@}
/**@name Mouse events */
//@{

/**
*\~english
*\~brief adds a mouse event to the events queue.
*\~brief Adds a mouse event to the events queue.
*\param[in] event The mouse event.
*\~french
*\~brief Ajoute un évènement de souris à la file.
*\param[in] event L'évènement.
*/
void pushEvent( MouseEvent const & event )
{
auto mouseEvent = std::make_shared< MouseEvent >( event );
auto myEvent = std::make_shared< MouseEvent >( event );
using LockType = std::unique_lock< std::mutex >;
LockType lock{ castor::makeUniqueLock( m_mutex ) };
m_queue.emplace_back( mouseEvent
, [this, mouseEvent]()
m_queue.emplace_back( myEvent
, [this, myEvent]()
{
processMouseEvent( mouseEvent );
processMouseEvent( myEvent );
} );
}
/**
Expand All @@ -148,28 +177,47 @@ namespace castor3d
{
m_mouseSlotsConnections[size_t( event )].push_back( m_mouseSlots[size_t( event )].connect( function ) );
}
/**
*\~english
*\~brief Tells if the control catches mouse events.
*\remarks A control catches mouse events when it is enabled, and when it explicitly catches it (enabled by default, except for static controls).
*\return false if the mouse events don't affect the control.
*/
bool catchesMouseEvents()const
{
return m_enabled && m_catchMouseEvents && doCatchesMouseEvents();
}
/**
*\~english
*\~brief Sets if the control can catch mouse events.
*\param[in] value The new value.
*/
void setCatchesMouseEvents( bool value )
{
m_catchMouseEvents = value;
}

//@}
/**@name Keyboard events */
//@{

/**
*\~english
*\~brief adds a keyboard event to the events queue.
*\~brief Adds a keyboard event to the events queue.
*\param[in] event The mouse event.
*\~french
*\~brief Ajoute un évènement de clavier à la file.
*\param[in] event L'évènement.
*/
void pushEvent( KeyboardEvent const & event )
{
auto mouseEvent = std::make_shared< KeyboardEvent >( event );
auto myEvent = std::make_shared< KeyboardEvent >( event );
using LockType = std::unique_lock< std::mutex >;
LockType lock{ castor::makeUniqueLock( m_mutex ) };
m_queue.emplace_back( mouseEvent
, [this, mouseEvent]()
m_queue.emplace_back( myEvent
, [this, myEvent]()
{
processKeyboardEvent( mouseEvent );
processKeyboardEvent( myEvent );
} );
}
/**
Expand All @@ -189,72 +237,46 @@ namespace castor3d
}
/**
*\~english
*\~brief Tells if the control catches mouse events.
*\remarks A control catches mouse events when it is enabled, and when it explicitly catches it (enabled by default, except for static controls).
*\return false if the mouse events don't affect the control.
*/
bool catchesMouseEvents()const
{
return m_enabled && m_catchMouseEvents && doCatchesMouseEvents();
}
/**
*\~english
*\~brief Sets if the control can catch mouse events.
*\param[in] value The new value.
*/
void setCatchesMouseEvents( bool value )
{
m_catchMouseEvents = value;
}
/**
*\~english
*\return \p false if the control is disabled.
*/
bool isEnabled()const
{
return m_enabled;
}
/**
*\~english
*\~brief Sets if the control is enabled.
*\~brief Tells if the control catches 'tab' key.
*\remarks A control catches 'tab' key when it is enabled, and when it explicitly catches it (disabled by default).
*\return false if the 'tab' key doesn't affect the control.
*/
void enable()
bool catchesTabKey()const
{
m_enabled = true;
onEnable( m_enabled );
return m_enabled && m_catchTabKey && doCatchesTabKey();
}
/**
*\~english
*\~brief Sets if the control is disabled.
*\~brief Tells if the control catches 'return' key.
*\remarks A control catches 'return' key when it is enabled, and when it explicitly catches it (disabled by default).
*\return false if the 'return' key doesn't affect the control.
*/
void disable()
bool catchesReturnKey()const
{
m_enabled = false;
onEnable( m_enabled );
return m_enabled && m_catchReturnKey && doCatchesReturnKey();
}
OnEnable onEnable;

//@}
/**@name Keyboard events */
/**@name Handler events */
//@{

/**
*\~english
*\~brief adds a handler event to the events queue.
*\~brief Adds a handler event to the events queue.
*\param[in] event The mouse event.
*\~french
*\~brief Ajoute un évènement de gestionnaire à la file.
*\param[in] event L'évènement.
*/
void pushEvent( HandlerEvent const & event )
{
auto handlerEvent = std::make_shared< HandlerEvent >( event );
auto myEvent = std::make_shared< HandlerEvent >( event );
using LockType = std::unique_lock< std::mutex >;
LockType lock{ castor::makeUniqueLock( m_mutex ) };
m_queue.emplace_back( handlerEvent
, [this, handlerEvent]()
m_queue.emplace_back( myEvent
, [this, myEvent]()
{
processHandlerEvent( handlerEvent );
processHandlerEvent( myEvent );
} );
}
/**
Expand All @@ -271,26 +293,6 @@ namespace castor3d
{
m_handlerSlotsConnections[size_t( event )].push_back( m_handlerSlots[size_t( event )].connect( function ) );
}
/**
*\~english
*\~brief Tells if the control catches 'tab' key.
*\remarks A control catches 'tab' key when it is enabled, and when it explicitly catches it (disabled by default).
*\return false if the 'tab' key doesn't affect the control.
*/
bool catchesTabKey()const
{
return m_enabled && m_catchTabKey && doCatchesTabKey();
}
/**
*\~english
*\~brief Tells if the control catches 'return' key.
*\remarks A control catches 'return' key when it is enabled, and when it explicitly catches it (disabled by default).
*\return false if the 'return' key doesn't affect the control.
*/
bool catchesReturnKey()const
{
return m_enabled && m_catchReturnKey && doCatchesReturnKey();
}

//@}

Expand Down Expand Up @@ -411,11 +413,11 @@ namespace castor3d
//!\~english The keyboard events slots.
//!\~french Les slots d'évènements clavier.
std::array< OnClientKeyboardEvent, size_t( KeyboardEventType::eCount ) > m_keyboardSlots;
//!\~english The handler events slots connections.
//!\~french Les connexions aux slots d'évènements de gestionnaire.
//!\~english The keyboard events slots connections.
//!\~french Les connexions aux slots d'évènements de clavier.
std::array< std::vector< OnClientKeyboardEventConnection >, size_t( KeyboardEventType::eCount ) > m_keyboardSlotsConnections;
//!\~english The keyboard events slots.
//!\~french Les slots d'évènements clavier.
//!\~english The handler events slots.
//!\~french Les slots d'évènements de gestionnaire.
std::array< OnClientHandlerEvent, size_t( HandlerEventType::eCount ) > m_handlerSlots;
//!\~english The handler events slots connections.
//!\~french Les connexions aux slots d'évènements de gestionnaire.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,15 @@ namespace castor3d
eReturn = 0x0D,
eEscape = 0x1B,
eSpace = 0x20,
eAsciiBegin = eSpace,

// values from 0x21 to 0x7E are reserved for the standard ASCII characters

eDelete = 0x7F,

// values from 0x80 to 0xFF are reserved for ASCII extended characters

eAsciiEnd = 0xFF,
eStart = 0x100,
eLButton,
eRButton,
Expand Down
Loading