2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
ImageRoll.h
|
|
|
|
|
|
|
|
Dominic Mazzoni
|
|
|
|
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_IMAGE_ROLL__
|
|
|
|
#define __AUDACITY_IMAGE_ROLL__
|
|
|
|
|
2018-02-02 18:24:53 +00:00
|
|
|
#include <vector>
|
2019-04-04 14:53:56 +00:00
|
|
|
// #include <wx/dc.h> // for enum wxRasterOperationMode
|
2010-01-23 19:44:49 +00:00
|
|
|
#include <wx/defs.h>
|
2019-03-30 19:06:57 +00:00
|
|
|
#include "wxPanelWrapper.h" // to inherit
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2014-10-06 08:10:50 +00:00
|
|
|
#if !wxCHECK_VERSION(3,0,0)
|
|
|
|
#define wxRasterOperationMode int
|
|
|
|
#endif
|
|
|
|
|
2018-02-02 18:24:53 +00:00
|
|
|
// wxImage copies cheaply with reference counting
|
|
|
|
using ImageArray = std::vector<wxImage>;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2020-09-28 12:50:18 +00:00
|
|
|
class AUDACITY_DLL_API ImageRoll
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum RollType {
|
|
|
|
Uninitialized,
|
|
|
|
FixedImage,
|
|
|
|
HorizontalRoll,
|
|
|
|
VerticalRoll,
|
|
|
|
Frame
|
|
|
|
};
|
|
|
|
|
|
|
|
ImageRoll();
|
|
|
|
ImageRoll(const wxImage &src);
|
|
|
|
ImageRoll(RollType type, const wxImage &src, wxColour magicColor);
|
2020-09-29 12:54:22 +00:00
|
|
|
ImageRoll(const ImageRoll&);
|
|
|
|
ImageRoll &operator =(const ImageRoll&);
|
|
|
|
~ImageRoll();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
bool Ok() const;
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
wxSize GetMinSize() const { return mMinSize; }
|
|
|
|
wxSize GetMaxSize() const { return mMaxSize; }
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
void Draw(wxDC &dc, wxRect rect,
|
2019-04-04 14:53:56 +00:00
|
|
|
int /* wxRasterOperationMode */ logicalFunc);
|
|
|
|
void Draw(wxDC &dc, wxRect rect); // default logicalFunc to wxCOPY
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
static ImageArray SplitH(const wxImage &src, wxColour magicColor);
|
|
|
|
static ImageArray SplitV(const wxImage &src, wxColour magicColor);
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
void DrawBitmap(wxDC &dc, wxBitmap &bitmap,
|
2019-04-04 14:53:56 +00:00
|
|
|
int x, int y,
|
|
|
|
int /* wxRasterOperationMode */ logicalFunc);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
void Init(RollType type, const wxImage &src, wxColour magicColor);
|
|
|
|
|
|
|
|
RollType mType;
|
2018-02-02 18:24:53 +00:00
|
|
|
// wxBitmap copies cheaply with reference counting
|
|
|
|
std::vector<wxBitmap> mPieces;
|
2010-01-23 19:44:49 +00:00
|
|
|
wxSize mMinSize;
|
|
|
|
wxSize mMaxSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
// A very simple class that just display an ImageRoll that doesn't
|
|
|
|
// do anything
|
2016-06-25 18:18:23 +00:00
|
|
|
class ImageRollPanel final : public wxPanelWrapper
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-09-18 14:26:29 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(ImageRollPanel)
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
ImageRollPanel(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
2017-04-02 22:07:13 +00:00
|
|
|
//ImageRoll &imgRoll,
|
2010-01-23 19:44:49 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxTAB_TRAVERSAL);
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2019-04-04 14:53:56 +00:00
|
|
|
void SetLogicalFunction(int /*wxRasterOperationMode*/ func);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
void OnPaint(wxPaintEvent &evt);
|
|
|
|
void OnSize(wxSizeEvent &evt);
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
protected:
|
2017-04-02 22:07:13 +00:00
|
|
|
//ImageRoll mImageRoll;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2019-04-04 14:53:56 +00:00
|
|
|
int /*wxRasterOperationMode*/ mLogicalFunction;
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2016-09-18 14:26:29 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AUDACITY_IMAGE_ROLL__
|