New upstream version 24.0.1+dfsg1
This commit is contained in:
parent
b14f9eae6d
commit
5a730d6ec3
842 changed files with 42245 additions and 33385 deletions
|
|
@ -3,72 +3,84 @@
|
|||
#include <obs.hpp>
|
||||
#include <graphics/vec2.h>
|
||||
#include <graphics/matrix4.h>
|
||||
#include <util/threading.h>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
#include "qt-display.hpp"
|
||||
#include "obs-app.hpp"
|
||||
|
||||
class OBSBasic;
|
||||
class QMouseEvent;
|
||||
|
||||
#define ITEM_LEFT (1<<0)
|
||||
#define ITEM_RIGHT (1<<1)
|
||||
#define ITEM_TOP (1<<2)
|
||||
#define ITEM_BOTTOM (1<<3)
|
||||
#define ITEM_LEFT (1 << 0)
|
||||
#define ITEM_RIGHT (1 << 1)
|
||||
#define ITEM_TOP (1 << 2)
|
||||
#define ITEM_BOTTOM (1 << 3)
|
||||
|
||||
#define ZOOM_SENSITIVITY 1.125f
|
||||
|
||||
enum class ItemHandle : uint32_t {
|
||||
None = 0,
|
||||
TopLeft = ITEM_TOP | ITEM_LEFT,
|
||||
TopCenter = ITEM_TOP,
|
||||
TopRight = ITEM_TOP | ITEM_RIGHT,
|
||||
CenterLeft = ITEM_LEFT,
|
||||
CenterRight = ITEM_RIGHT,
|
||||
BottomLeft = ITEM_BOTTOM | ITEM_LEFT,
|
||||
None = 0,
|
||||
TopLeft = ITEM_TOP | ITEM_LEFT,
|
||||
TopCenter = ITEM_TOP,
|
||||
TopRight = ITEM_TOP | ITEM_RIGHT,
|
||||
CenterLeft = ITEM_LEFT,
|
||||
CenterRight = ITEM_RIGHT,
|
||||
BottomLeft = ITEM_BOTTOM | ITEM_LEFT,
|
||||
BottomCenter = ITEM_BOTTOM,
|
||||
BottomRight = ITEM_BOTTOM | ITEM_RIGHT
|
||||
BottomRight = ITEM_BOTTOM | ITEM_RIGHT,
|
||||
};
|
||||
|
||||
class OBSBasicPreview : public OBSQTDisplay {
|
||||
Q_OBJECT
|
||||
|
||||
friend class SourceTree;
|
||||
friend class SourceTreeItem;
|
||||
|
||||
private:
|
||||
obs_sceneitem_crop startCrop;
|
||||
vec2 startItemPos;
|
||||
vec2 cropSize;
|
||||
vec2 startItemPos;
|
||||
vec2 cropSize;
|
||||
OBSSceneItem stretchGroup;
|
||||
OBSSceneItem stretchItem;
|
||||
ItemHandle stretchHandle = ItemHandle::None;
|
||||
vec2 stretchItemSize;
|
||||
matrix4 screenToItem;
|
||||
matrix4 itemToScreen;
|
||||
matrix4 invGroupTransform;
|
||||
ItemHandle stretchHandle = ItemHandle::None;
|
||||
vec2 stretchItemSize;
|
||||
matrix4 screenToItem;
|
||||
matrix4 itemToScreen;
|
||||
matrix4 invGroupTransform;
|
||||
|
||||
gs_texture_t *overflow = nullptr;
|
||||
gs_vertbuffer_t *rectFill = nullptr;
|
||||
|
||||
vec2 startPos;
|
||||
vec2 lastMoveOffset;
|
||||
vec2 scrollingFrom;
|
||||
vec2 scrollingOffset;
|
||||
bool mouseDown = false;
|
||||
bool mouseMoved = false;
|
||||
bool mouseOverItems = false;
|
||||
bool cropping = false;
|
||||
bool locked = false;
|
||||
bool scrollMode = false;
|
||||
bool fixedScaling = false;
|
||||
int32_t scalingLevel = 0;
|
||||
float scalingAmount = 1.0f;
|
||||
vec2 startPos;
|
||||
vec2 mousePos;
|
||||
vec2 lastMoveOffset;
|
||||
vec2 scrollingFrom;
|
||||
vec2 scrollingOffset;
|
||||
bool mouseDown = false;
|
||||
bool mouseMoved = false;
|
||||
bool mouseOverItems = false;
|
||||
bool cropping = false;
|
||||
bool locked = false;
|
||||
bool scrollMode = false;
|
||||
bool fixedScaling = false;
|
||||
bool selectionBox = false;
|
||||
int32_t scalingLevel = 0;
|
||||
float scalingAmount = 1.0f;
|
||||
|
||||
obs_sceneitem_t *hoveredPreviewItem = nullptr;
|
||||
obs_sceneitem_t *hoveredListItem = nullptr;
|
||||
std::vector<obs_sceneitem_t *> hoveredPreviewItems;
|
||||
std::vector<obs_sceneitem_t *> selectedItems;
|
||||
std::mutex selectMutex;
|
||||
|
||||
static vec2 GetMouseEventPos(QMouseEvent *event);
|
||||
static bool FindSelected(obs_scene_t *scene, obs_sceneitem_t *item,
|
||||
void *param);
|
||||
static bool DrawSelectedOverflow(obs_scene_t *scene,
|
||||
obs_sceneitem_t *item, void *param);
|
||||
obs_sceneitem_t *item, void *param);
|
||||
static bool DrawSelectedItem(obs_scene_t *scene, obs_sceneitem_t *item,
|
||||
void *param);
|
||||
void *param);
|
||||
static bool DrawSelectionBox(float x1, float y1, float x2, float y2,
|
||||
gs_vertbuffer_t *box);
|
||||
|
||||
static OBSSceneItem GetItemAtPos(const vec2 &pos, bool selectBelow);
|
||||
static bool SelectedAtPos(const vec2 &pos);
|
||||
|
|
@ -88,6 +100,7 @@ private:
|
|||
|
||||
static void SnapItemMovement(vec2 &offset);
|
||||
void MoveItems(const vec2 &pos);
|
||||
void BoxItems(const vec2 &startPos, const vec2 &pos);
|
||||
|
||||
void ProcessClick(const vec2 &pos);
|
||||
|
||||
|
|
@ -110,11 +123,14 @@ public:
|
|||
void DrawOverflow();
|
||||
void DrawSceneEditing();
|
||||
|
||||
inline void SetLocked(bool newLockedVal) {locked = newLockedVal;}
|
||||
inline void ToggleLocked() {locked = !locked;}
|
||||
inline bool Locked() const {return locked;}
|
||||
inline void SetLocked(bool newLockedVal) { locked = newLockedVal; }
|
||||
inline void ToggleLocked() { locked = !locked; }
|
||||
inline bool Locked() const { return locked; }
|
||||
|
||||
inline void SetFixedScaling(bool newFixedScalingVal) { fixedScaling = newFixedScalingVal; }
|
||||
inline void SetFixedScaling(bool newFixedScalingVal)
|
||||
{
|
||||
fixedScaling = newFixedScalingVal;
|
||||
}
|
||||
inline bool IsFixedScaling() const { return fixedScaling; }
|
||||
|
||||
void SetScalingLevel(int32_t newScalingLevelVal);
|
||||
|
|
@ -123,14 +139,17 @@ public:
|
|||
inline float GetScalingAmount() const { return scalingAmount; }
|
||||
|
||||
void ResetScrollingOffset();
|
||||
inline void SetScrollingOffset(float x, float y) {vec2_set(&scrollingOffset, x, y);}
|
||||
inline float GetScrollX() const {return scrollingOffset.x;}
|
||||
inline float GetScrollY() const {return scrollingOffset.y;}
|
||||
inline void SetScrollingOffset(float x, float y)
|
||||
{
|
||||
vec2_set(&scrollingOffset, x, y);
|
||||
}
|
||||
inline float GetScrollX() const { return scrollingOffset.x; }
|
||||
inline float GetScrollY() const { return scrollingOffset.y; }
|
||||
|
||||
/* use libobs allocator for alignment because the matrices itemToScreen
|
||||
* and screenToItem may contain SSE data, which will cause SSE
|
||||
* instructions to crash if the data is not aligned to at least a 16
|
||||
* byte boundary. */
|
||||
static inline void* operator new(size_t size) {return bmalloc(size);}
|
||||
static inline void operator delete(void* ptr) {bfree(ptr);}
|
||||
static inline void *operator new(size_t size) { return bmalloc(size); }
|
||||
static inline void operator delete(void *ptr) { bfree(ptr); }
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue