Refactor UserInterfaceManager and Scene

- Moved SourcePreview and Navigator classes from UserInterfaceManager.h to Navigator.h
- Moved Grid and UpdateCallback to Scene folder
This commit is contained in:
brunoherbelin
2025-11-29 10:24:35 +01:00
parent 6de65e1de2
commit 07c9f79852
11 changed files with 3765 additions and 3699 deletions

View File

@@ -21,7 +21,6 @@ set(VMIX_SRCS
ControlManager.cpp
FrameBuffer.cpp
FrameGrabber.cpp
Grid.cpp
Interpolator.cpp
Loopback.cpp
MediaPlayer.cpp
@@ -30,6 +29,7 @@ set(VMIX_SRCS
MixingGroup.cpp
MousePointer.cpp
MultiFileRecorder.cpp
Navigator.cpp
Overlay.cpp
Playlist.cpp
Recorder.cpp
@@ -50,7 +50,6 @@ set(VMIX_SRCS
TabletInput.cpp
Timeline.cpp
Transcoder.cpp
UpdateCallback.cpp
UserInterfaceManager.cpp
VideoBroadcast.cpp
@@ -61,9 +60,11 @@ set(VMIX_SRCS
# Scene/ folder
Scene/Decorations.cpp
Scene/Grid.cpp
Scene/Mesh.cpp
Scene/Primitives.cpp
Scene/Scene.cpp
Scene/UpdateCallback.cpp
# Source/ folder
Source/CloneSource.cpp

View File

@@ -23,7 +23,7 @@
#include "defines.h"
#include "Source/Source.h"
#include "ImageProcessingShader.h"
#include "UpdateCallback.h"
#include "Scene/UpdateCallback.h"
#include "Interpolator.h"

3637
src/Navigator.cpp Normal file

File diff suppressed because it is too large Load Diff

122
src/Navigator.h Normal file
View File

@@ -0,0 +1,122 @@
#ifndef __NAVIGATOR_H_
#define __NAVIGATOR_H_
#include <string>
#include <list>
#include <vector>
#include <utility>
#include "Source/Source.h"
struct ImVec2;
class SourcePreview
{
Source *source_;
std::string label_;
bool reset_;
public:
SourcePreview();
void setSource(Source *s = nullptr, const std::string &label = "");
Source *getSource();
void Render(float width);
bool ready() const;
inline bool filled() const { return source_ != nullptr; }
};
class Thumbnail
{
float aspect_ratio_;
uint texture_;
public:
Thumbnail();
~Thumbnail();
void reset();
void fill (const FrameBufferImage *image);
bool filled();
void Render(float width);
};
class Navigator
{
// geometry left bar & pannel
float width_;
float height_;
float pannel_width_;
float padding_width_;
// behavior pannel
bool pannel_visible_;
int pannel_main_mode_;
float pannel_alpha_;
bool view_pannel_visible;
bool selected_button[68]; // NAV_COUNT
int selected_index;
int pattern_type;
int generated_type;
bool custom_connected;
bool custom_screencapture;
void clearButtonSelection();
void clearNewPannel();
void applyButtonSelection(int index);
// side pannels
void RenderSourcePannel(Source *s, const ImVec2 &iconsize, bool reset = false);
void RenderMainPannel(const ImVec2 &iconsize);
void RenderMainPannelSession();
void RenderMainPannelPlaylist();
void RenderMainPannelSettings();
void RenderTransitionPannel(const ImVec2 &iconsize);
void RenderNewPannel(const ImVec2 &iconsize);
void RenderViewOptions(uint *timeout, const ImVec2 &pos, const ImVec2 &size);
bool RenderMousePointerSelector(const ImVec2 &size);
public:
typedef enum {
SOURCE_FILE = 0,
SOURCE_SEQUENCE,
SOURCE_CONNECTED,
SOURCE_GENERATED
} NewSourceType;
Navigator();
void Render();
bool pannelVisible();
void discardPannel();
void showPannelSource(int index);
int selectedPannelSource();
void togglePannelMenu();
void togglePannelNew();
void showConfig();
void togglePannelAutoHide();
typedef enum {
MEDIA_RECENT = 0,
MEDIA_RECORDING,
MEDIA_FOLDER
} MediaCreateMode;
void setNewMedia(MediaCreateMode mode, std::string path = std::string());
private:
// for new source panel
SourcePreview new_source_preview_;
std::list<std::string> sourceSequenceFiles;
std::list<std::string> sourceMediaFiles;
std::string sourceMediaFileCurrent;
MediaCreateMode new_media_mode;
bool new_media_mode_changed;
Source *source_to_replace;
static std::vector< std::pair<int, int> > icons_ordering_files;
static std::vector< std::string > tooltips_ordering_files;
};
#endif /* __NAVIGATOR_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -17,106 +17,12 @@
#include "Window/InputMappingWindow.h"
#include "Window/ShaderEditWindow.h"
#include "Playlist.h"
#include "Navigator.h"
struct ImVec2;
void DrawInspector(uint texture, ImVec2 texturesize, ImVec2 cropsize, ImVec2 origin);
class SourcePreview
{
Source *source_;
std::string label_;
bool reset_;
public:
SourcePreview();
void setSource(Source *s = nullptr, const std::string &label = "");
Source *getSource();
void Render(float width);
bool ready() const;
inline bool filled() const { return source_ != nullptr; }
};
class Navigator
{
// geometry left bar & pannel
float width_;
float height_;
float pannel_width_;
float padding_width_;
// behavior pannel
bool pannel_visible_;
int pannel_main_mode_;
float pannel_alpha_;
bool view_pannel_visible;
bool selected_button[NAV_COUNT];
int selected_index;
int pattern_type;
int generated_type;
bool custom_connected;
bool custom_screencapture;
void clearButtonSelection();
void clearNewPannel();
void applyButtonSelection(int index);
// side pannels
void RenderSourcePannel(Source *s, const ImVec2 &iconsize, bool reset = false);
void RenderMainPannel(const ImVec2 &iconsize);
void RenderMainPannelSession();
void RenderMainPannelPlaylist();
void RenderMainPannelSettings();
void RenderTransitionPannel(const ImVec2 &iconsize);
void RenderNewPannel(const ImVec2 &iconsize);
void RenderViewOptions(uint *timeout, const ImVec2 &pos, const ImVec2 &size);
bool RenderMousePointerSelector(const ImVec2 &size);
public:
typedef enum {
SOURCE_FILE = 0,
SOURCE_SEQUENCE,
SOURCE_CONNECTED,
SOURCE_GENERATED
} NewSourceType;
Navigator();
void Render();
bool pannelVisible();
void discardPannel();
void showPannelSource(int index);
int selectedPannelSource();
void togglePannelMenu();
void togglePannelNew();
void showConfig();
void togglePannelAutoHide();
typedef enum {
MEDIA_RECENT = 0,
MEDIA_RECORDING,
MEDIA_FOLDER
} MediaCreateMode;
void setNewMedia(MediaCreateMode mode, std::string path = std::string());
private:
// for new source panel
SourcePreview new_source_preview_;
std::list<std::string> sourceSequenceFiles;
std::list<std::string> sourceMediaFiles;
std::string sourceMediaFileCurrent;
MediaCreateMode new_media_mode;
bool new_media_mode_changed;
Source *source_to_replace;
static std::vector< std::pair<int, int> > icons_ordering_files;
static std::vector< std::string > tooltips_ordering_files;
};
class ToolBox
{
bool show_demo_window;

View File

@@ -6,7 +6,7 @@
#include <glm/glm.hpp>
#include "Scene/Scene.h"
#include "Grid.h"
#include "Scene/Grid.h"
class Session;
class SessionFileSource;