File: Navigator.h

package info (click to toggle)
vimix 0.9.0%2Bgit20260228%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 90,700 kB
  • sloc: cpp: 98,044; ansic: 34,427; makefile: 373; xml: 98; objc: 97; sh: 49; python: 20
file content (122 lines) | stat: -rw-r--r-- 2,863 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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;
    int  custom_type;
    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,
        SOURCE_BUNDLE
    } 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_ */