mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Added ALT keyboard modifier handling for alternative GUI actions
This commit is contained in:
@@ -220,12 +220,13 @@ bool UserInterface::Init()
|
||||
void UserInterface::handleKeyboard()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
alt_modifier_active = io.KeyAlt;
|
||||
auto ctrl = io.ConfigMacOSXBehaviors ? io.KeySuper : io.KeyCtrl;
|
||||
|
||||
// Application "CTRL +"" Shortcuts
|
||||
if ( ctrl ) {
|
||||
|
||||
keyboard_modifier_active = true;
|
||||
ctrl_modifier_active = true;
|
||||
|
||||
if (ImGui::IsKeyPressed( GLFW_KEY_Q )) {
|
||||
// Quit
|
||||
@@ -233,7 +234,7 @@ void UserInterface::handleKeyboard()
|
||||
}
|
||||
else if (ImGui::IsKeyPressed( GLFW_KEY_O )) {
|
||||
// SHIFT + CTRL + O : reopen current session
|
||||
if (keyboard_modifier_active && !Mixer::manager().session()->filename().empty())
|
||||
if (ctrl_modifier_active && !Mixer::manager().session()->filename().empty())
|
||||
Mixer::manager().load( Mixer::manager().session()->filename() );
|
||||
// CTRL + O : Open session
|
||||
else
|
||||
@@ -287,7 +288,7 @@ void UserInterface::handleKeyboard()
|
||||
}
|
||||
// No CTRL modifier
|
||||
else {
|
||||
keyboard_modifier_active = false;
|
||||
ctrl_modifier_active = false;
|
||||
|
||||
// Application F-Keys
|
||||
if (ImGui::IsKeyPressed( GLFW_KEY_F1 ))
|
||||
@@ -424,7 +425,7 @@ void UserInterface::handleMouse()
|
||||
Source *s = Mixer::manager().findSource(picked.first);
|
||||
if (s != nullptr) {
|
||||
// CTRL + clic = multiple selection
|
||||
if (keyboard_modifier_active) {
|
||||
if (ctrl_modifier_active) {
|
||||
if ( !Mixer::selection().contains(s) )
|
||||
Mixer::selection().add( s );
|
||||
else {
|
||||
|
||||
@@ -104,7 +104,8 @@ class UserInterface
|
||||
ToolBox toolbox;
|
||||
MediaController mediacontrol;
|
||||
|
||||
bool keyboard_modifier_active;
|
||||
bool ctrl_modifier_active;
|
||||
bool alt_modifier_active;
|
||||
bool show_vimix_config;
|
||||
bool show_imgui_about;
|
||||
bool show_gst_about;
|
||||
@@ -145,7 +146,8 @@ public:
|
||||
void Terminate();
|
||||
|
||||
// status querries
|
||||
inline bool keyboardModifier() { return keyboard_modifier_active; }
|
||||
inline bool ctrlModifier() const { return ctrl_modifier_active; }
|
||||
inline bool altModifier() const { return alt_modifier_active; }
|
||||
|
||||
void StartScreenshot();
|
||||
void showPannel(int id = 0);
|
||||
|
||||
10
View.cpp
10
View.cpp
@@ -752,7 +752,7 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
if (pick.first) {
|
||||
// picking on the resizing handles in the corners
|
||||
if ( pick.first == s->handle_[Handles::RESIZE] ) {
|
||||
if (UserInterface::manager().keyboardModifier())
|
||||
if (UserInterface::manager().altModifier())
|
||||
S_resize.y = S_resize.x;
|
||||
sourceNode->scale_ = s->stored_status_->scale_ * S_resize;
|
||||
|
||||
@@ -774,7 +774,7 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
// picking on the resizing handles left or right
|
||||
else if ( pick.first == s->handle_[Handles::RESIZE_H] ) {
|
||||
sourceNode->scale_ = s->stored_status_->scale_ * glm::vec3(S_resize.x, 1.f, 1.f);
|
||||
if (UserInterface::manager().keyboardModifier())
|
||||
if (UserInterface::manager().altModifier())
|
||||
sourceNode->scale_.x = float( int( sourceNode->scale_.x * 10.f ) ) / 10.f;
|
||||
|
||||
ret.type = Cursor_ResizeEW;
|
||||
@@ -784,7 +784,7 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
// picking on the resizing handles top or bottom
|
||||
else if ( pick.first == s->handle_[Handles::RESIZE_V] ) {
|
||||
sourceNode->scale_ = s->stored_status_->scale_ * glm::vec3(1.f, S_resize.y, 1.f);
|
||||
if (UserInterface::manager().keyboardModifier())
|
||||
if (UserInterface::manager().altModifier())
|
||||
sourceNode->scale_.y = float( int( sourceNode->scale_.y * 10.f ) ) / 10.f;
|
||||
|
||||
ret.type = Cursor_ResizeNS;
|
||||
@@ -803,7 +803,7 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
sourceNode->rotation_ = s->stored_status_->rotation_ + glm::vec3(0.f, 0.f, angle);
|
||||
|
||||
int degrees = int( glm::degrees(sourceNode->rotation_.z) );
|
||||
if (UserInterface::manager().keyboardModifier()) {
|
||||
if (UserInterface::manager().altModifier()) {
|
||||
degrees = (degrees / 10) * 10;
|
||||
sourceNode->rotation_.z = glm::radians( float(degrees) );
|
||||
}
|
||||
@@ -815,7 +815,7 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
else {
|
||||
sourceNode->translation_ = s->stored_status_->translation_ + gl_Position_to - gl_Position_from;
|
||||
|
||||
if (UserInterface::manager().keyboardModifier()) {
|
||||
if (UserInterface::manager().altModifier()) {
|
||||
sourceNode->translation_.x = float( int( sourceNode->translation_.x * 10.f ) ) / 10.f;
|
||||
sourceNode->translation_.y = float( int( sourceNode->translation_.y * 10.f ) ) / 10.f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user