29#ifndef ANIMATIONCELL_H
30#define ANIMATIONCELL_H
34#include "ImgCellBase.h"
40#include <wx/mstream.h>
41#include <wx/wfstream.h>
60 const wxString &wxmxFile,
double framerate = -1);
71 int GetPPI()
const override {
if(IsOk())
return m_images.at(m_displayed)->GetPPI();
else return 0;}
72 size_t GetOriginalWidth()
const override {
73 if(IsOk())
return m_images.at(m_displayed)->GetOriginalWidth();
else return 0;}
74 size_t GetOriginalHeight()
const override {
75 if(IsOk())
return m_images.at(m_displayed)->GetOriginalHeight();
else return 0;}
79 for (
const auto &image : m_images) {
81 switch (image->GetLoadFailureKind()) {
89 {
if (IsOk())
return m_images.at(m_displayed)->GetExtension();
else return wxEmptyString; }
93 int Length()
const {
return m_images.size();}
94 void LoadImages(wxMemoryBuffer imageData);
95 void LoadImages(wxString imageFile);
97 void SetPPI(
int ppi)
override;
102 bool CanExportSVG()
const override {
return (m_images.at(m_displayed) != NULL) && m_images.at(m_displayed)->CanExportSVG();}
113 wxCharBuffer m_databuf;
118 const wxString
GetToolTip(wxPoint point)
const override;
127 void LoadImages(wxArrayString images,
bool deleteRead);
129 int GetDisplayedIndex()
const {
return m_displayed; }
131 wxImage GetBitmap(
int n)
const
132 {
return m_images.at(n)->GetUnscaledBitmap().ConvertToImage(); }
134 void SetDisplayedIndex(
int ind);
140 wxSize
ToGif(wxString file);
173 bool AnimationRunning()
const {
return m_animationRunning; }
174 void AnimationRunning(
bool run);
175 void ToggleAnimationRunning(){AnimationRunning(!AnimationRunning());}
177 {
return m_images.at(m_displayed) && (m_images.at(m_displayed)->HasGnuplotSource()); }
179 void GnuplotSource(
int image, wxString gnuplotFilename, wxString dataFilename,
180 const wxString &wxmxFile)
181 { m_images.at(image)->GnuplotSource(std::move(gnuplotFilename),
182 std::move(dataFilename), wxmxFile); }
183 void CompressedGnuplotSource(
int image, wxString gnuplotFilename, wxString dataFilename,
184 const wxString &wxmxFile)
185 { m_images.at(image)->CompressedGnuplotSource(std::move(gnuplotFilename),
186 std::move(dataFilename),
191 if (!m_images.at(m_displayed))
192 return wxEmptyString;
194 return m_images.at(m_displayed)->GnuplotSource();
199 std::unique_ptr<wxTimer> m_timer;
200 std::vector<std::shared_ptr<Image>> m_images;
208 double m_framerate = -1;
210 int m_imageBorderWidth = 0;
214 bool m_animationRunning : 1 =
true;
215 bool m_drawBoundingBox : 1 =
false;
218 int GetImageBorderWidth()
const override {
return m_imageBorderWidth; }
220 void Recalculate(
const AFontSize fontsize)
const override;
223 void SetCurrentPoint(wxPoint point)
const override;
224 void Draw(wxDC *dc, wxDC *antialiassingDC)
override;
226 wxString ToMatlab()
const override;
227 wxString ToMathML()
const override;
228 wxString ToRTF()
const override;
229 wxString ToString()
const override;
230 wxString ToTeX()
const override;
231 wxString ToXML()
const override;
233 wxCoord GetMaxWidth()
const override;
234 wxCoord GetHeightList()
const override {
return m_height; }
235 void SetMaxWidth(wxCoord width)
override;
236 void SetMaxHeight(wxCoord height)
override;
238 void DrawBoundingBox(wxDC &WXUNUSED(dc),
bool WXUNUSED(all) =
false)
override
239 { m_drawBoundingBox =
true; }
The definition of the base class of all cells the worksheet consists of.
This file declares the class Image.
A Type-Safe Fixed-Point Font Size.
Definition: FontAttribs.h:99
A Gif object for the clipboard.
Definition: AnimationCell.h:106
Definition: AnimationCell.h:46
wxString GetExtension() const override
Returns the file name extension that matches the image type.
Definition: AnimationCell.h:88
bool CopyToClipboard() const override
Copies the cell to the system's clipboard.
Definition: AnimationCell.cpp:539
void ClearCache() override
Remove all cached scaled images from memory.
Definition: AnimationCell.cpp:527
AnimationCell(GroupCell *group, Configuration *config, const wxMemoryBuffer &image, const wxString &type)
A constructor that loads the compressed file from a wxMemoryBuffer.
bool CanPopOut() const override
Can this cell be popped out interactively in gnuplot?
Definition: AnimationCell.h:176
double SetFrameRate(double Freq)
Set the frame rate of this AnimationCell [in Hz].
Definition: AnimationCell.cpp:156
wxSize ToGif(wxString file)
Exports the whole animation as animated gif.
Definition: AnimationCell.cpp:489
void SetPPI(int ppi) override
Set the animation's resolution.
Definition: AnimationCell.cpp:405
wxSize ToImageFile(wxString file) override
Exports the image the animation currently displays.
Definition: AnimationCell.cpp:411
wxString GnuplotSource() const override
The name of the file with gnuplot commands that created this file.
Definition: AnimationCell.h:189
void StopTimer()
Stops the timer.
Definition: AnimationCell.cpp:141
std::unique_ptr< Cell > Copy(GroupCell *group) const override
Create a copy of this cell.
void ReloadTimer()
Reload the animation timer starting and instantiating and registering it if necessary.
Definition: AnimationCell.cpp:130
bool CopyAnimationToClipboard()
Put the animation on the clipboard.
Definition: AnimationCell.cpp:565
double GetFrameRate() const
Get the frame rate of this AnimationCell [in Hz].
Definition: AnimationCell.cpp:112
const CellTypeInfo & GetInfo() override
Returns the information about this cell's type.
void SetConfiguration(Configuration *config) override
Tell this cell to use the configuration object config.
Definition: AnimationCell.cpp:98
void TallyImageLoadFailures(int &dataUnavailable, int &decodeFailed) const override
Unlike GetOriginalWidth()/Height(), this tallies EVERY frame, not just the one currently displayed.
Definition: AnimationCell.h:78
const wxString GetToolTip(wxPoint point) const override
Returns the ToolTip this cell provides at a given point.
Definition: AnimationCell.cpp:478
static wxDataFormat m_gifFormat
A class that publishes wxm data to the clipboard.
Definition: AnimationCell.h:99
bool CanExportSVG() const override
Can the current image be exported in SVG format?
Definition: AnimationCell.h:102
A class that carries information about the type of a cell.
Definition: Cell.h:93
CachedInteger< wxCoord > m_height
The height of this cell.
Definition: Cell.h:1151
virtual void SetCurrentPoint(wxPoint point) const
Pass 2: Arrangement.
Definition: Cell.cpp:514
ViewCellPointers * GetViewCellPointers() const
The transient view-state half of the cell-pointer registry this cell uses.
Definition: Cell.cpp:75
The configuration storage for the current worksheet.
Definition: Configuration.h:98
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88
@ DecodeFailed
Data was read fine and a decoder exists for the format (or it's an SVG, parsed by our own vendored co...
@ DataUnavailable
Raw data could never be obtained at all (file not found, empty wxmx entry, ...). Always a real failur...
Definition: ImgCellBase.h:42
The view/interaction half of the cell-pointer registry.
Definition: CellPointers.h:187