Zachary Hall
9899794b81
Some checks failed
Build / build-gentoo (push) Failing after 1m11s
Build / download-system-deps (push) Successful in 3m44s
Build / get-source-code (push) Successful in 13m23s
Build / build-deb (push) Successful in 11m40s
Build / build-appimage (push) Successful in 4m53s
Build / build-android (push) Failing after 3m19s
Build / build-windows (push) Failing after 8m9s
96 lines
2.5 KiB
C++
96 lines
2.5 KiB
C++
#pragma once
|
|
#include <Window.h>
|
|
#include <Application.h>
|
|
#include <GroupLayout.h>
|
|
#include <Slider.h>
|
|
#include <StringView.h>
|
|
#include <playback.h>
|
|
#include <thread>
|
|
#include <FilePanel.h>
|
|
#include <Bitmap.h>
|
|
#include <Menu.h>
|
|
#include <MenuItem.h>
|
|
#include <vector>
|
|
#include "aboutwindow.h"
|
|
#include "slider.h"
|
|
#include "prefs.h"
|
|
#include <atomic>
|
|
#include <util.hpp>
|
|
#define CMD_UPDATE_LABEL_SETTING 0x1000
|
|
extern bool show_labels;
|
|
extern bool show_icons;
|
|
extern bool quitting;
|
|
class Subwindow {
|
|
public:
|
|
BWindow *window;
|
|
static std::vector<Subwindow*> windows;
|
|
std::atomic_bool Showing = false;
|
|
std::atomic_bool ShownEver = false;
|
|
private:
|
|
inline Subwindow(BWindow *window)
|
|
: window(window)
|
|
{ }
|
|
public:
|
|
inline static Subwindow *Add(BWindow *window) {
|
|
auto output = new Subwindow(window);
|
|
windows.push_back(output);
|
|
return output;
|
|
}
|
|
inline void Show() {
|
|
Showing.store(true);
|
|
}
|
|
};
|
|
class HaikuLooperRefHandler;
|
|
class HaikuLooperWindow : public BWindow {
|
|
BSlider *slider;
|
|
BStringView *position_label;
|
|
BBitmap *pause_bitmap;
|
|
BBitmap *resume_bitmap;
|
|
BBitmap *refresh_bitmap;
|
|
BBitmap *stop_bitmap;
|
|
BMenu *file_menu;
|
|
BMenuItem *open_item;
|
|
BMenuItem *prefs_item;
|
|
BMenuItem *quit_item;
|
|
BMenu *help_menu;
|
|
BMenuItem *about_item;
|
|
BGroupLayout *layout;
|
|
Playback *playback;
|
|
BButton *restart_btn;
|
|
BButton *stop_btn;
|
|
BButton *pause_resume_btn;
|
|
BView *spacer;
|
|
void UpdateCat(BBitmap *cat);
|
|
bool volume_clicked = false;
|
|
bool speed_clicked = false;
|
|
bool pitch_clicked = false;
|
|
bool tempo_clicked = false;
|
|
bool seek_clicked = false;
|
|
void UpdateViewFlags(BView *view);
|
|
void UpdateViewFlags(BLayout *layout);
|
|
HaikuLooperSlider *volume_slider;
|
|
HaikuLooperSlider *speed_slider;
|
|
BFilePanel *file_panel;
|
|
HaikuLooperSlider *pitch_slider;
|
|
HaikuLooperSlider *tempo_slider;
|
|
HaikuLooperRefHandler *ref_handler;
|
|
std::thread *update_thread = nullptr;
|
|
bool done = false;
|
|
void Pulse();
|
|
void ThreadFunc();
|
|
const char *file_to_play = nullptr;
|
|
public:
|
|
Subwindow *about_subwindow;
|
|
Subwindow *prefs_subwindow;
|
|
void FrameResized(float newWidth, float newHeight) override;
|
|
void MessageReceived(BMessage *msg) override;
|
|
HaikuLooperWindow(Playback *playback);
|
|
~HaikuLooperWindow();
|
|
};
|
|
class HaikuLooperRefHandler : public BHandler {
|
|
HaikuLooperWindow *win;
|
|
BHandler *next_handler;
|
|
public:
|
|
void MessageReceived(BMessage *msg) override;
|
|
HaikuLooperRefHandler(HaikuLooperWindow *win);
|
|
};
|