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

View File

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

View File

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

View File

@@ -45,10 +45,10 @@ public:
// Display mode // Display mode
typedef enum { typedef enum {
HIDDEN = 0, HIDDEN = 0,
NORMAL = 1, NORMAL = 1,
ACTIVE = 2, SELECTED = 2,
CURRENT = 3 CURRENT = 3
} Mode; } Mode;
Mode mode() const; Mode mode() const;
void setMode(Mode m); void setMode(Mode m);

View File

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