This repository was archived by the owner on Jan 23, 2026. It is now read-only.
forked from Chronial/foo_chronflow
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEngineWindow.h
More file actions
153 lines (137 loc) · 4.45 KB
/
Copy pathEngineWindow.h
File metadata and controls
153 lines (137 loc) · 4.45 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#pragma once
// clang-format off
#include "ContainerWindow.fwd.h"
#include "DbAlbumInfo.h"
#include "EngineThread.fwd.h"
// clang-format on
#include "configdata.h"
#include "myactions.h"
#include "style_manager.h"
#include "utils.h"
namespace engine {
enum {
ID_ENTER = 1,
ID_DOUBLECLICK,
ID_MIDDLECLICK,
ID_OPENEXTERNALVIEWER,
ID_PREFERENCES,
ID_COVER_UI_SETTINGS_LABEL,
ID_COVER_FOLLOWS_PLAY_NOW,
ID_COVER_SETS_SELECTION,
ID_LIBRARY_COVER_FOLLOWS_SELECTION,
ID_PLAYLIST_SET_PL_SELECTION,
ID_PLAYLIST_FOLLOWS_PL_SELECTION,
ID_PLAYLIST_CURRENT_AS_SOURCE,
ID_PLAYLIST_SOURCE_SET,
ID_PLAYLIST_ACTIVE_AS_SOURCE,
ID_PLAYLIST_GROUPED,
ID_PLAYLIST_HILIGHT,
ID_LIBRARY_FILTER_SELECTOR_AS_SOURCE,
ID_LIBRARY_FILTER_SELECTOR_LOCK,
ID_SUBMENU_SELECTOR,
ID_SUBMENU_PLAYLIST,
ID_DISPLAY_0,
ID_DISPLAY_1,
ID_DISPLAY_2,
ID_DISPLAY_3,
ID_DISPLAY_4,
ID_DISPLAY_5,
ID_DISPLAY_6,
ID_DISPLAY_7,
ID_DISPLAY_8,
ID_DISPLAY_9,
ID_SUBMENU_DISPLAY,
ID_SUBMENU_LIBRARY_SELECTIONS,
ID_CONTEXT_FIRST_DISPLAY,
ID_CONTEXT_LAST_DISPLAY = ID_CONTEXT_FIRST_DISPLAY + 1000,
};
class GLFWContext {
public:
GLFWContext();
NO_MOVE_NO_COPY(GLFWContext);
~GLFWContext();
private:
static int count;
};
class external_selection_callback
: public ui_selection_callback_impl_base_ex<
playlist_callback::flag_on_items_selection_change |
playlist_callback::flag_on_playlist_activate> {
public:
external_selection_callback(EngineWindow& ew) : engineWindow(ew){};
void on_selection_changed(metadb_handle_list_cref p_selection);
void reregister(unsigned int flags) {
auto api = ui_selection_manager_v2::get();
api->unregister_callback(this);
api->register_callback(this, flags);
}
private:
EngineWindow& engineWindow;
};
using ::db::AlbumInfo;
class EngineWindow {
public:
EngineWindow(ContainerWindow& container, render::StyleManager& styleManager,
ui_element_instance_callback_ptr defaultUiCallback)
: defaultUiCallback(defaultUiCallback), container(container),
externalSelectionCallback(*this) {
TRACK_CALL_TEXT("EngineWindow::EngineWindow");
createWindow();
engineThread.emplace(*this, styleManager);
glfwShowWindow(glfwWindow.get());
// externalSelectionCallback.ui_selection_callback_activate(true);
}
// bool query_capability(const GUID& cap) override{}
void setWindowSize(int width, int height);
void makeContextCurrent();
void swapBuffers();
void onDamage();
void setSelection(metadb_handle_list selection, bool owner);
const metadb_handle_list_ref getSelection(bool fromLibrary) {
return fromLibrary? library_selection : playlist_selection;
}
LRESULT on_message(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { /*int kk = 0*/; }
void cmdTogglePlaylistGrouped();
void cmdTogglePlaylistHiLight();
void cmdToggleActivePlaylistSource();
void cmdTogglePlaylistSource();
void cmdAssignPlaylistSource();
void cmdPlaylistSourcePlay(const AlbumInfo& album);
void cmdHighlightPlaylistContent();
bool cmdActivateVisualization(LPARAM lpActVis, LPARAM hwnd);
void cmdToggleLibraryFilterSelectorSource(bool lock);
void cmdToggleLibraryCoverFollowsSelection();
void cmdShowAlbumOnExternalViewer(AlbumInfo album);
private:
void createWindow();
LRESULT messageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam);
bool onChar(WPARAM wParam);
void onMouseClick(UINT uMsg, WPARAM wParam, LPARAM lParam);
void doDragStart(const AlbumInfo& album);
void onClickOnAlbum(const AlbumInfo& album, UINT uMsg);
bool onKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam);
void onWindowSize(int width, int height);
void onScroll(double xoffset, double yoffset);
void onContextMenu(int x, int y);
void setInnerSelection(metadb_handle_list selection, GUID selection_type,
bool fromLibrary);
public:
ContainerWindow& container;
private:
double scrollAggregator = 0;
const ui_element_instance_callback_ptr defaultUiCallback;
metadb_handle_list library_selection;
GUID library_selection_type;
metadb_handle_list playlist_selection;
GUID playlist_selection_type;
ui_selection_holder::ptr selectionHolder;
external_selection_callback externalSelectionCallback;
GLFWContext glfwContext;
unique_ptr<GLFWwindow,
std::integral_constant<decltype(&glfwDestroyWindow), glfwDestroyWindow>>
glfwWindow;
public:
HWND hWnd = nullptr;
std::optional<EngineThread> engineThread;
};
} // namespace engine