Minor terminology clarification (in Source and View)

This commit is contained in:
brunoherbelin
2020-06-19 18:00:59 +02:00
parent 21b28174e9
commit b8d394954c
5 changed files with 30 additions and 34 deletions

View File

@@ -155,7 +155,7 @@ Mixer::Mixer() : session_(nullptr), back_session_(nullptr), current_view_(nullpt
clear();
// this initializes with the current view
setCurrentView( (View::Mode) Settings::application.current_view );
setView( (View::Mode) Settings::application.current_view );
}
void Mixer::update()
@@ -310,7 +310,7 @@ void Mixer::insertSource(Source *s, bool makecurrent)
setCurrentSource( sit );
// switch to Mixing view to show source created
setCurrentView(View::MIXING);
setView(View::MIXING);
current_view_->update(0);
current_view_->centerSource(s);
}
@@ -450,7 +450,7 @@ void Mixer::unsetCurrentSource()
// remove from selection
// selection().remove( *current_source_ );
// show status as normal
(*current_source_)->setMode(Source::ACTIVE);
(*current_source_)->setMode(Source::SELECTED);
}
}
@@ -484,7 +484,7 @@ Source *Mixer::currentSource()
}
// management of view
void Mixer::setCurrentView(View::Mode m)
void Mixer::setView(View::Mode m)
{
switch (m) {
case View::GEOMETRY:
@@ -512,13 +512,8 @@ View *Mixer::view(View::Mode m)
case View::MIXING:
return &mixing_;
default:
return nullptr;
}
}
View *Mixer::currentView()
{
return current_view_;
}
}
void Mixer::save()

View File

@@ -56,6 +56,7 @@ public:
void setCurrentSource (Source *s);
void setCurrentNext ();
void unsetCurrentSource ();
void cloneCurrentSource ();
void deleteCurrentSource ();
int indexCurrentSource ();
@@ -64,9 +65,9 @@ public:
Source * findSource (Node *node);
// management of view
View *view (View::Mode m);
void setCurrentView (View::Mode m);
View *currentView ();
View *view (View::Mode m = View::INVALID);
void setView (View::Mode m);
// View *currentView ();
// manipulate, load and save sessions
inline Session *session () const { return session_; }

View File

@@ -11,7 +11,7 @@ Selection::Selection()
void Selection::add(Source *s)
{
selection_.push_back(s);
s->setMode(Source::ACTIVE);
s->setMode(Source::SELECTED);
}
void Selection::remove(Source *s)
@@ -35,7 +35,7 @@ void Selection::set(Source *s)
{
clear();
selection_.push_back(s);
s->setMode(Source::ACTIVE);
s->setMode(Source::SELECTED);
}
@@ -44,7 +44,7 @@ void Selection::set(SourceList l)
clear();
for(auto it = l.begin(); it != l.end(); it++)
(*it)->setMode(Source::ACTIVE);
(*it)->setMode(Source::SELECTED);
l.sort();
l.unique();
@@ -54,7 +54,7 @@ void Selection::set(SourceList l)
void Selection::add(SourceList l)
{
for(auto it = l.begin(); it != l.end(); it++)
(*it)->setMode(Source::ACTIVE);
(*it)->setMode(Source::SELECTED);
// generate new set as union of current selection and give list
SourceList result;

View File

@@ -47,7 +47,7 @@ public:
typedef enum {
HIDDEN = 0,
NORMAL = 1,
ACTIVE = 2,
SELECTED = 2,
CURRENT = 3
} Mode;
Mode mode() const;

View File

@@ -261,11 +261,11 @@ void UserInterface::handleKeyboard()
// Application F-Keys
if (ImGui::IsKeyPressed( GLFW_KEY_F1 ))
Mixer::manager().setCurrentView(View::MIXING);
Mixer::manager().setView(View::MIXING);
else if (ImGui::IsKeyPressed( GLFW_KEY_F2 ))
Mixer::manager().setCurrentView(View::GEOMETRY);
Mixer::manager().setView(View::GEOMETRY);
else if (ImGui::IsKeyPressed( GLFW_KEY_F3 ))
Mixer::manager().setCurrentView(View::LAYER);
Mixer::manager().setView(View::LAYER);
else if (ImGui::IsKeyPressed( GLFW_KEY_F11 ))
Rendering::manager().mainWindow().toggleFullscreen();
else if (ImGui::IsKeyPressed( GLFW_KEY_F12 ))
@@ -349,7 +349,7 @@ void UserInterface::handleMouse()
//
if ( io.MouseWheel != 0) {
// scroll => zoom current view
Mixer::manager().currentView()->zoom( io.MouseWheel );
Mixer::manager().view()->zoom( io.MouseWheel );
}
// TODO : zoom with center on source if over current
@@ -360,7 +360,7 @@ void UserInterface::handleMouse()
if ( ImGui::IsMouseDragging(ImGuiMouseButton_Right, 10.0f) )
{
// right mouse drag => drag current view
View::Cursor c = Mixer::manager().currentView()->drag( mouseclic[ImGuiMouseButton_Right], mousepos);
View::Cursor c = Mixer::manager().view()->drag( mouseclic[ImGuiMouseButton_Right], mousepos);
setMouseCursor(c);
}
else if ( ImGui::IsMouseDown(ImGuiMouseButton_Right)) {
@@ -373,7 +373,7 @@ void UserInterface::handleMouse()
}
if ( ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Right) )
{
Mixer::manager().currentView()->restoreSettings();
Mixer::manager().view()->restoreSettings();
}
//
@@ -390,7 +390,7 @@ void UserInterface::handleMouse()
// grab selected sources (current is also selected by default)
View::Cursor c = View::Cursor_Arrow;
for (auto it = Mixer::selection().begin(); it != Mixer::selection().end(); it++)
c = Mixer::manager().currentView()->grab(*it, mouseclic[ImGuiMouseButton_Left], mousepos, picked);
c = Mixer::manager().view()->grab(*it, mouseclic[ImGuiMouseButton_Left], mousepos, picked);
setMouseCursor(c);
}
else {
@@ -401,14 +401,14 @@ void UserInterface::handleMouse()
ImGui::GetColorU32(ImGuiCol_ResizeGripHovered, 0.3f));
// Bounding box multiple sources selection
Mixer::manager().currentView()->select(mouseclic[ImGuiMouseButton_Left], mousepos);
Mixer::manager().view()->select(mouseclic[ImGuiMouseButton_Left], mousepos);
}
}
else if ( ImGui::IsMouseClicked(ImGuiMouseButton_Left) ) {
// ask the view what was picked
picked = Mixer::manager().currentView()->pick(mousepos);
picked = Mixer::manager().view()->pick(mousepos);
// if nothing picked,
if ( picked.first == nullptr ) {
@@ -436,7 +436,7 @@ void UserInterface::handleMouse()
}
// indicate to view that an action can be initiated (e.g. grab)
Mixer::manager().currentView()->initiate();
Mixer::manager().view()->initiate();
}
}
@@ -1116,16 +1116,16 @@ void Navigator::Render()
selected_view[ Settings::application.current_view ] = true;
if (ImGui::Selectable( ICON_FA_BULLSEYE, &selected_view[1], 0, iconsize))
{
Mixer::manager().setCurrentView(View::MIXING);
Mixer::manager().setView(View::MIXING);
}
if (ImGui::Selectable( ICON_FA_OBJECT_UNGROUP , &selected_view[2], 0, iconsize))
{
Mixer::manager().setCurrentView(View::GEOMETRY);
Mixer::manager().setView(View::GEOMETRY);
}
if (ImGui::Selectable( ICON_FA_IMAGES, &selected_view[3], 0, iconsize))
// if (ImGui::Selectable( ICON_FA_LAYER_GROUP, &selected_view[3], 0, iconsize))
{
Mixer::manager().setCurrentView(View::LAYER);
Mixer::manager().setView(View::LAYER);
}
}