Added on-demand image loading option to wxRTC.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76110 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2014-03-10 11:08:42 +00:00
parent 3772880ce6
commit cd3fc53163
7 changed files with 420 additions and 21 deletions

View File

@@ -55,6 +55,8 @@
#define wxRICHTEXT_DEFAULT_DELAYED_LAYOUT_THRESHOLD 20000
// Milliseconds before layout occurs after resize
#define wxRICHTEXT_DEFAULT_LAYOUT_INTERVAL 50
// Milliseconds before delayed image processing occurs
#define wxRICHTEXT_DEFAULT_DELAYED_IMAGE_PROCESSING_INTERVAL 200
/* Identifiers
*/
@@ -2044,6 +2046,38 @@ public:
bool GetImagesEnabled() const;
/**
Enable or disable delayed image loading
*/
void EnableDelayedImageLoading(bool b) { m_enableDelayedImageLoading = b; }
/**
Returns @true if delayed image loading is enabled.
*/
bool GetDelayedImageLoading() const { return m_enableDelayedImageLoading; }
/**
Gets the flag indicating that delayed image processing is required.
*/
bool GetDelayedImageProcessingRequired() const { return m_delayedImageProcessingRequired; }
/**
Sets the flag indicating that delayed image processing is required.
*/
void SetDelayedImageProcessingRequired(bool b) { m_delayedImageProcessingRequired = b; }
/**
Returns the last time delayed image processing was performed.
*/
wxLongLong GetDelayedImageProcessingTime() const { return m_delayedImageProcessingTime; }
/**
Sets the last time delayed image processing was performed.
*/
void SetDelayedImageProcessingTime(wxLongLong t) { m_delayedImageProcessingTime = t; }
/**
Returns the caret position since the default formatting was changed. As
soon as this position changes, we no longer reflect the default style
@@ -2137,6 +2171,22 @@ public:
// implement wxTextEntry methods
virtual wxString DoGetValue() const;
/**
Do delayed image loading and garbage-collect other images
*/
bool ProcessDelayedImageLoading(bool refresh);
bool ProcessDelayedImageLoading(const wxRect& screenRect, wxRichTextParagraphLayoutBox* box, int& loadCount);
/**
Request delayed image processing.
*/
void RequestDelayedImageProcessing();
/**
Respond to timer events.
*/
void OnTimer(wxTimerEvent& event);
protected:
// implement the wxTextEntry pure virtual method
virtual wxWindow *GetEditableWindow();
@@ -2220,6 +2270,23 @@ protected:
/// The object that currently has the editing focus
wxRichTextParagraphLayoutBox* m_focusObject;
/// An overall scale factor
double m_scale;
/// Variables for scrollbar hysteresis detection
wxSize m_lastWindowSize;
int m_setupScrollbarsCount;
int m_setupScrollbarsCountInOnSize;
/// Whether images are enabled for this control
bool m_enableImages;
/// Whether delayed image loading is enabled for this control
bool m_enableDelayedImageLoading;
bool m_delayedImageProcessingRequired;
wxLongLong m_delayedImageProcessingTime;
wxTimer m_delayedImageProcessingTimer;
};
/**