Merge branch 'stcxpm' of https://github.com/NewPagodi/wxWidgets
Improve XPM images handling in wxStyledTextCtrl. See https://github.com/wxWidgets/wxWidgets/pull/1215
This commit is contained in:
@@ -3090,7 +3090,7 @@ public:
|
|||||||
int MarkerPrevious(int lineStart, int markerMask);
|
int MarkerPrevious(int lineStart, int markerMask);
|
||||||
|
|
||||||
// Define a marker from a bitmap
|
// Define a marker from a bitmap
|
||||||
void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
|
void MarkerDefinePixmap(int markerNumber, const char* const* xpmData);
|
||||||
|
|
||||||
// Add a set of markers to a line.
|
// Add a set of markers to a line.
|
||||||
void MarkerAddSet(int line, int markerSet);
|
void MarkerAddSet(int line, int markerSet);
|
||||||
@@ -3441,7 +3441,7 @@ public:
|
|||||||
bool AutoCompGetDropRestOfWord() const;
|
bool AutoCompGetDropRestOfWord() const;
|
||||||
|
|
||||||
// Register an image for use in autocompletion lists.
|
// Register an image for use in autocompletion lists.
|
||||||
void RegisterImage(int type, const wxBitmap& bmp);
|
void RegisterImage(int type, const char* const* xpmData);
|
||||||
|
|
||||||
// Clear all the registered images.
|
// Clear all the registered images.
|
||||||
void ClearRegisteredImages();
|
void ClearRegisteredImages();
|
||||||
@@ -3883,19 +3883,19 @@ public:
|
|||||||
// Set the display mode of visual flags for wrapped lines.
|
// Set the display mode of visual flags for wrapped lines.
|
||||||
void SetWrapVisualFlags(int wrapVisualFlags);
|
void SetWrapVisualFlags(int wrapVisualFlags);
|
||||||
|
|
||||||
// Retrive the display mode of visual flags for wrapped lines.
|
// Retrieve the display mode of visual flags for wrapped lines.
|
||||||
int GetWrapVisualFlags() const;
|
int GetWrapVisualFlags() const;
|
||||||
|
|
||||||
// Set the location of visual flags for wrapped lines.
|
// Set the location of visual flags for wrapped lines.
|
||||||
void SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation);
|
void SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation);
|
||||||
|
|
||||||
// Retrive the location of visual flags for wrapped lines.
|
// Retrieve the location of visual flags for wrapped lines.
|
||||||
int GetWrapVisualFlagsLocation() const;
|
int GetWrapVisualFlagsLocation() const;
|
||||||
|
|
||||||
// Set the start indent for wrapped lines.
|
// Set the start indent for wrapped lines.
|
||||||
void SetWrapStartIndent(int indent);
|
void SetWrapStartIndent(int indent);
|
||||||
|
|
||||||
// Retrive the start indent for wrapped lines.
|
// Retrieve the start indent for wrapped lines.
|
||||||
int GetWrapStartIndent() const;
|
int GetWrapStartIndent() const;
|
||||||
|
|
||||||
// Sets how wrapped sublines are placed. Default is wxSTC_WRAPINDENT_FIXED.
|
// Sets how wrapped sublines are placed. Default is wxSTC_WRAPINDENT_FIXED.
|
||||||
@@ -5181,6 +5181,12 @@ public:
|
|||||||
// Clear annotations from the given line.
|
// Clear annotations from the given line.
|
||||||
void AnnotationClearLine(int line);
|
void AnnotationClearLine(int line);
|
||||||
|
|
||||||
|
// Define a marker from a bitmap.
|
||||||
|
void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
|
||||||
|
|
||||||
|
// Register an image for use in autocompletion lists.
|
||||||
|
void RegisterImage(int type, const wxBitmap& bmp);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// The following methods are nearly equivalent to their similarly named
|
// The following methods are nearly equivalent to their similarly named
|
||||||
|
@@ -5360,6 +5360,8 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@member_group_name{Markers, Markers}
|
@member_group_name{Markers, Markers}
|
||||||
|
|
||||||
|
@see MarkerDefineBitmap
|
||||||
*/
|
*/
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
@@ -5437,8 +5439,10 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Define a marker from a bitmap
|
Define a marker from a bitmap
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
*/
|
*/
|
||||||
void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
|
void MarkerDefinePixmap(int markerNumber, const char* const* xpmData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add a set of markers to a line.
|
Add a set of markers to a line.
|
||||||
@@ -5644,6 +5648,8 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@member_group_name{Autocompletion, Autocompletion}
|
@member_group_name{Autocompletion, Autocompletion}
|
||||||
|
|
||||||
|
@see RegisterImage(int, const wxBitmap&)
|
||||||
*/
|
*/
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
@@ -5756,8 +5762,10 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Register an image for use in autocompletion lists.
|
Register an image for use in autocompletion lists.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
*/
|
*/
|
||||||
void RegisterImage(int type, const wxBitmap& bmp);
|
void RegisterImage(int type, const char* const* xpmData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clear all the registered images.
|
Clear all the registered images.
|
||||||
@@ -7405,6 +7413,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
void AnnotationClearLine(int line);
|
void AnnotationClearLine(int line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Define a marker with a wxBitmap.
|
||||||
|
*/
|
||||||
|
void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Register an image for use in autocompletion lists.
|
||||||
|
*/
|
||||||
|
void RegisterImage(int type, const wxBitmap& bmp);
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -27,10 +27,11 @@
|
|||||||
#include "wx/encconv.h"
|
#include "wx/encconv.h"
|
||||||
#include "wx/listctrl.h"
|
#include "wx/listctrl.h"
|
||||||
#include "wx/mstream.h"
|
#include "wx/mstream.h"
|
||||||
|
#include "wx/xpmdecod.h"
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "wx/imaglist.h"
|
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
#include "wx/dynlib.h"
|
#include "wx/dynlib.h"
|
||||||
|
#include "wx/scopedarray.h"
|
||||||
|
|
||||||
#ifdef wxHAS_RAW_BITMAP
|
#ifdef wxHAS_RAW_BITMAP
|
||||||
#include "wx/rawbmp.h"
|
#include "wx/rawbmp.h"
|
||||||
@@ -508,17 +509,36 @@ wxBitmap BitmapFromRGBAImage(int width, int height, const unsigned char *pixelsI
|
|||||||
}
|
}
|
||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wxBitmap BitmapFromRGBAImage(int width, int height, const unsigned char *pixelsImage)
|
||||||
|
{
|
||||||
|
const int totalPixels = width * height;
|
||||||
|
wxScopedArray<unsigned char> data(3*totalPixels);
|
||||||
|
wxScopedArray<unsigned char> alpha(totalPixels);
|
||||||
|
int curDataLocation = 0, curAlphaLocation = 0, curPixelsImageLocation = 0;
|
||||||
|
|
||||||
|
for ( int i = 0; i < totalPixels; ++i )
|
||||||
|
{
|
||||||
|
data[curDataLocation++] = pixelsImage[curPixelsImageLocation++];
|
||||||
|
data[curDataLocation++] = pixelsImage[curPixelsImageLocation++];
|
||||||
|
data[curDataLocation++] = pixelsImage[curPixelsImageLocation++];
|
||||||
|
alpha[curAlphaLocation++] = pixelsImage[curPixelsImageLocation++];
|
||||||
|
}
|
||||||
|
|
||||||
|
wxImage img(width, height, data.get(), alpha.get(), true);
|
||||||
|
wxBitmap bmp(img);
|
||||||
|
|
||||||
|
return bmp;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height,
|
void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height,
|
||||||
const unsigned char *pixelsImage)
|
const unsigned char *pixelsImage)
|
||||||
{
|
{
|
||||||
#ifdef wxHAS_RAW_BITMAP
|
|
||||||
wxRect r = wxRectFromPRectangle(rc);
|
wxRect r = wxRectFromPRectangle(rc);
|
||||||
wxBitmap bmp = BitmapFromRGBAImage(width, height, pixelsImage);
|
wxBitmap bmp = BitmapFromRGBAImage(width, height, pixelsImage);
|
||||||
hdc->DrawBitmap(bmp, r.x, r.y, true);
|
hdc->DrawBitmap(bmp, r.x, r.y, true);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2318,46 +2338,6 @@ inline wxListView* GETLB(WindowID win) {
|
|||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
class ListBoxImpl : public ListBox {
|
|
||||||
private:
|
|
||||||
int lineHeight;
|
|
||||||
bool unicodeMode;
|
|
||||||
int desiredVisibleRows;
|
|
||||||
int aveCharWidth;
|
|
||||||
size_t maxStrWidth;
|
|
||||||
Point location; // Caret location at which the list is opened
|
|
||||||
wxImageList* imgList;
|
|
||||||
wxArrayInt* imgTypeMap;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ListBoxImpl();
|
|
||||||
~ListBoxImpl();
|
|
||||||
static ListBox *Allocate();
|
|
||||||
|
|
||||||
virtual void SetFont(Font &font) wxOVERRIDE;
|
|
||||||
virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_) wxOVERRIDE;
|
|
||||||
virtual void SetAverageCharWidth(int width) wxOVERRIDE;
|
|
||||||
virtual void SetVisibleRows(int rows) wxOVERRIDE;
|
|
||||||
virtual int GetVisibleRows() const wxOVERRIDE;
|
|
||||||
virtual PRectangle GetDesiredRect() wxOVERRIDE;
|
|
||||||
virtual int CaretFromEdge() wxOVERRIDE;
|
|
||||||
virtual void Clear() wxOVERRIDE;
|
|
||||||
virtual void Append(char *s, int type = -1) wxOVERRIDE;
|
|
||||||
void Append(const wxString& text, int type);
|
|
||||||
virtual int Length() wxOVERRIDE;
|
|
||||||
virtual void Select(int n) wxOVERRIDE;
|
|
||||||
virtual int GetSelection() wxOVERRIDE;
|
|
||||||
virtual int Find(const char *prefix) wxOVERRIDE;
|
|
||||||
virtual void GetValue(int n, char *value, int len) wxOVERRIDE;
|
|
||||||
virtual void RegisterImage(int type, const char *xpm_data) wxOVERRIDE;
|
|
||||||
void RegisterImageHelper(int type, wxBitmap& bmp);
|
|
||||||
virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) wxOVERRIDE;
|
|
||||||
virtual void ClearRegisteredImages() wxOVERRIDE;
|
|
||||||
virtual void SetDoubleClickAction(CallBackAction, void *) wxOVERRIDE;
|
|
||||||
virtual void SetList(const char* list, char separator, char typesep) wxOVERRIDE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ListBoxImpl::ListBoxImpl()
|
ListBoxImpl::ListBoxImpl()
|
||||||
: lineHeight(10), unicodeMode(false),
|
: lineHeight(10), unicodeMode(false),
|
||||||
desiredVisibleRows(5), aveCharWidth(8), maxStrWidth(0),
|
desiredVisibleRows(5), aveCharWidth(8), maxStrWidth(0),
|
||||||
@@ -2521,7 +2501,7 @@ void ListBoxImpl::GetValue(int n, char *value, int len) {
|
|||||||
value[len-1] = '\0';
|
value[len-1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListBoxImpl::RegisterImageHelper(int type, wxBitmap& bmp)
|
void ListBoxImpl::RegisterImageHelper(int type, const wxBitmap& bmp)
|
||||||
{
|
{
|
||||||
if (! imgList) {
|
if (! imgList) {
|
||||||
// assumes all images are the same size
|
// assumes all images are the same size
|
||||||
@@ -2541,8 +2521,21 @@ void ListBoxImpl::RegisterImageHelper(int type, wxBitmap& bmp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ListBoxImpl::RegisterImage(int type, const char *xpm_data) {
|
void ListBoxImpl::RegisterImage(int type, const char *xpm_data) {
|
||||||
wxMemoryInputStream stream(xpm_data, strlen(xpm_data)+1);
|
wxXPMDecoder dec;
|
||||||
wxImage img(stream, wxBITMAP_TYPE_XPM);
|
wxImage img;
|
||||||
|
|
||||||
|
// This check is borrowed from src/stc/scintilla/src/XPM.cpp.
|
||||||
|
// Test done is two parts to avoid possibility of overstepping the memory
|
||||||
|
// if memcmp implemented strangely. Must be 4 bytes at least at destination.
|
||||||
|
if ( (0 == memcmp(xpm_data, "/* X", 4)) &&
|
||||||
|
(0 == memcmp(xpm_data, "/* XPM */", 9)) )
|
||||||
|
{
|
||||||
|
wxMemoryInputStream stream(xpm_data, strlen(xpm_data)+1);
|
||||||
|
img = dec.ReadFile(stream);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
img = dec.ReadData(reinterpret_cast<const char* const*>(xpm_data));
|
||||||
|
|
||||||
wxBitmap bmp(img);
|
wxBitmap bmp(img);
|
||||||
RegisterImageHelper(type, bmp);
|
RegisterImageHelper(type, bmp);
|
||||||
}
|
}
|
||||||
@@ -2551,10 +2544,8 @@ void ListBoxImpl::RegisterImage(int type, const char *xpm_data) {
|
|||||||
void ListBoxImpl::RegisterRGBAImage(int type, int width, int height,
|
void ListBoxImpl::RegisterRGBAImage(int type, int width, int height,
|
||||||
const unsigned char *pixelsImage)
|
const unsigned char *pixelsImage)
|
||||||
{
|
{
|
||||||
#ifdef wxHAS_RAW_BITMAP
|
|
||||||
wxBitmap bmp = BitmapFromRGBAImage(width, height, pixelsImage);
|
wxBitmap bmp = BitmapFromRGBAImage(width, height, pixelsImage);
|
||||||
RegisterImageHelper(type, bmp);
|
RegisterImageHelper(type, bmp);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
|
#ifndef _SRC_STC_PLATWX_H_
|
||||||
|
#define _SRC_STC_PLATWX_H_
|
||||||
|
|
||||||
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
#if wxUSE_STC
|
||||||
|
|
||||||
|
#include "wx/imaglist.h"
|
||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -6,6 +15,45 @@ wxRect wxRectFromPRectangle(PRectangle prc);
|
|||||||
PRectangle PRectangleFromwxRect(wxRect rc);
|
PRectangle PRectangleFromwxRect(wxRect rc);
|
||||||
wxColour wxColourFromCD(const ColourDesired& ca);
|
wxColour wxColourFromCD(const ColourDesired& ca);
|
||||||
|
|
||||||
|
class ListBoxImpl : public ListBox {
|
||||||
|
private:
|
||||||
|
int lineHeight;
|
||||||
|
bool unicodeMode;
|
||||||
|
int desiredVisibleRows;
|
||||||
|
int aveCharWidth;
|
||||||
|
size_t maxStrWidth;
|
||||||
|
Point location; // Caret location at which the list is opened
|
||||||
|
wxImageList* imgList;
|
||||||
|
wxArrayInt* imgTypeMap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ListBoxImpl();
|
||||||
|
~ListBoxImpl();
|
||||||
|
static ListBox *Allocate();
|
||||||
|
|
||||||
|
virtual void SetFont(Font &font) wxOVERRIDE;
|
||||||
|
virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_) wxOVERRIDE;
|
||||||
|
virtual void SetAverageCharWidth(int width) wxOVERRIDE;
|
||||||
|
virtual void SetVisibleRows(int rows) wxOVERRIDE;
|
||||||
|
virtual int GetVisibleRows() const wxOVERRIDE;
|
||||||
|
virtual PRectangle GetDesiredRect() wxOVERRIDE;
|
||||||
|
virtual int CaretFromEdge() wxOVERRIDE;
|
||||||
|
virtual void Clear() wxOVERRIDE;
|
||||||
|
virtual void Append(char *s, int type = -1) wxOVERRIDE;
|
||||||
|
void Append(const wxString& text, int type);
|
||||||
|
virtual int Length() wxOVERRIDE;
|
||||||
|
virtual void Select(int n) wxOVERRIDE;
|
||||||
|
virtual int GetSelection() wxOVERRIDE;
|
||||||
|
virtual int Find(const char *prefix) wxOVERRIDE;
|
||||||
|
virtual void GetValue(int n, char *value, int len) wxOVERRIDE;
|
||||||
|
virtual void RegisterImage(int type, const char *xpm_data) wxOVERRIDE;
|
||||||
|
void RegisterImageHelper(int type, const wxBitmap& bmp);
|
||||||
|
virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) wxOVERRIDE;
|
||||||
|
virtual void ClearRegisteredImages() wxOVERRIDE;
|
||||||
|
virtual void SetDoubleClickAction(CallBackAction, void *) wxOVERRIDE;
|
||||||
|
virtual void SetList(const char* list, char separator, char typesep) wxOVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
class SurfaceData
|
class SurfaceData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -72,3 +120,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_GRAPHICS_DIRECT2D
|
#endif // wxUSE_GRAPHICS_DIRECT2D
|
||||||
|
|
||||||
|
#endif // wxUSE_STC
|
||||||
|
|
||||||
|
#endif // _SRC_STC_PLATWX_H_
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
#include "wx/dataobj.h"
|
#include "wx/dataobj.h"
|
||||||
#include "wx/clipbrd.h"
|
#include "wx/clipbrd.h"
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
|
#include "wx/image.h"
|
||||||
|
#include "wx/scopedarray.h"
|
||||||
|
|
||||||
#if !wxUSE_STD_CONTAINERS && !wxUSE_STD_IOSTREAM && !wxUSE_STD_STRING
|
#if !wxUSE_STD_CONTAINERS && !wxUSE_STD_IOSTREAM && !wxUSE_STD_STRING
|
||||||
#include "wx/beforestd.h"
|
#include "wx/beforestd.h"
|
||||||
@@ -1336,6 +1338,37 @@ bool ScintillaWX::GetUseAntiAliasing() {
|
|||||||
return vs.extraFontFlag != 0;
|
return vs.extraFontFlag != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScintillaWX::DoMarkerDefineBitmap(int markerNumber, const wxBitmap& bmp) {
|
||||||
|
if ( 0 <= markerNumber && markerNumber <= MARKER_MAX) {
|
||||||
|
// Build an RGBA buffer from bmp.
|
||||||
|
const int totalPixels = bmp.GetWidth() * bmp.GetHeight();
|
||||||
|
wxScopedArray<unsigned char> rgba(4*bmp.GetWidth()*bmp.GetHeight());
|
||||||
|
wxImage img = bmp.ConvertToImage();
|
||||||
|
int curRGBALoc = 0, curDataLoc = 0, curAlphaLoc = 0;
|
||||||
|
|
||||||
|
for ( int i = 0; i < totalPixels; ++i ) {
|
||||||
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] =
|
||||||
|
img.HasAlpha() ? img.GetAlpha()[curAlphaLoc++] : wxALPHA_OPAQUE ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now follow the same procedure used for handling the
|
||||||
|
// SCI_MARKERDEFINERGBAIMAGE message, except use the bitmap's width and
|
||||||
|
// height instead of the values stored in sizeRGBAImage.
|
||||||
|
Point bitmapSize = Point::FromInts(bmp.GetWidth(), bmp.GetHeight());
|
||||||
|
vs.markers[markerNumber].SetRGBAImage(bitmapSize, 1.0f, rgba.get());
|
||||||
|
vs.CalcLargestMarkerHeight();
|
||||||
|
}
|
||||||
|
InvalidateStyleData();
|
||||||
|
RedrawSelMargin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScintillaWX::DoRegisterImage(int type, const wxBitmap& bmp) {
|
||||||
|
static_cast<ListBoxImpl*>(ac.lb)->RegisterImageHelper(type, bmp);
|
||||||
|
}
|
||||||
|
|
||||||
sptr_t ScintillaWX::DirectFunction(
|
sptr_t ScintillaWX::DirectFunction(
|
||||||
ScintillaWX* swx, unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
ScintillaWX* swx, unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||||
return swx->WndProc(iMessage, wParam, lParam);
|
return swx->WndProc(iMessage, wParam, lParam);
|
||||||
|
@@ -199,6 +199,8 @@ public:
|
|||||||
bool GetUseAntiAliasing();
|
bool GetUseAntiAliasing();
|
||||||
SurfaceData* GetSurfaceData() const {return m_surfaceData;}
|
SurfaceData* GetSurfaceData() const {return m_surfaceData;}
|
||||||
void SetPaintAbandoned(){paintState = paintAbandoned;}
|
void SetPaintAbandoned(){paintState = paintAbandoned;}
|
||||||
|
void DoMarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
|
||||||
|
void DoRegisterImage(int type, const wxBitmap& bmp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool capturedMouse;
|
bool capturedMouse;
|
||||||
|
@@ -40,9 +40,11 @@ categoriesList = [
|
|||||||
('OtherSettings' ,'Other settings', 0),
|
('OtherSettings' ,'Other settings', 0),
|
||||||
('BraceHighlighting' ,'Brace highlighting', 0),
|
('BraceHighlighting' ,'Brace highlighting', 0),
|
||||||
('TabsAndIndentationGuides' ,'Tabs and Indentation Guides', 0),
|
('TabsAndIndentationGuides' ,'Tabs and Indentation Guides', 0),
|
||||||
('Markers' ,'Markers', 0),
|
('Markers' ,'Markers',
|
||||||
|
('@see MarkerDefineBitmap',)),
|
||||||
('Indicators' ,'Indicators', 0),
|
('Indicators' ,'Indicators', 0),
|
||||||
('Autocompletion' ,'Autocompletion', 0),
|
('Autocompletion' ,'Autocompletion',
|
||||||
|
('@see RegisterImage(int, const wxBitmap&)',)),
|
||||||
('UserLists' ,'User lists', 0),
|
('UserLists' ,'User lists', 0),
|
||||||
('CallTips' ,'Call tips', 0),
|
('CallTips' ,'Call tips', 0),
|
||||||
('KeyboardCommands' ,'Keyboard commands', 0),
|
('KeyboardCommands' ,'Keyboard commands', 0),
|
||||||
@@ -844,7 +846,13 @@ docSubstitutions = {
|
|||||||
'SC_SEL_RECTANGLE':'wxSTC_SEL_RECTANGLE','SC_SEL_THIN':'wxSTC_SEL_THIN',
|
'SC_SEL_RECTANGLE':'wxSTC_SEL_RECTANGLE','SC_SEL_THIN':'wxSTC_SEL_THIN',
|
||||||
'SC_SEL_LINES':'wxSTC_SEL_LINES'},
|
'SC_SEL_LINES':'wxSTC_SEL_LINES'},
|
||||||
|
|
||||||
'SetFontQuality':{' from the FontQuality enumeration':''}
|
'SetFontQuality':{' from the FontQuality enumeration':''},
|
||||||
|
|
||||||
|
'GetWrapVisualFlags':{'Retrive':'Retrieve'},
|
||||||
|
|
||||||
|
'GetWrapVisualFlagsLocation':{'Retrive':'Retrieve'},
|
||||||
|
|
||||||
|
'GetWrapStartIndent':{'Retrive':'Retrieve'}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1400,7 +1408,10 @@ sinceAnnotations= {
|
|||||||
'SetMouseWheelCaptures':'3.1.1',
|
'SetMouseWheelCaptures':'3.1.1',
|
||||||
'SetTabDrawMode':'3.1.1',
|
'SetTabDrawMode':'3.1.1',
|
||||||
'TargetWholeDocument':'3.1.1',
|
'TargetWholeDocument':'3.1.1',
|
||||||
'ToggleFoldShowText':'3.1.1'
|
'ToggleFoldShowText':'3.1.1',
|
||||||
|
|
||||||
|
'MarkerDefinePixmap':'3.1.3',
|
||||||
|
'RegisterImage':'3.1.3'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -213,22 +213,11 @@ methodOverrideMap = {
|
|||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
'MarkerDefinePixmap' :
|
'MarkerDefinePixmap' :
|
||||||
('MarkerDefineBitmap',
|
(0,
|
||||||
'''void %s(int markerNumber, const wxBitmap& bmp);''',
|
'''void %s(int markerNumber, const char* const* xpmData);''',
|
||||||
'''void %s(int markerNumber, const wxBitmap& bmp) {
|
'''void %s(int markerNumber, const char* const* xpmData) {
|
||||||
// convert bmp to a xpm in a string
|
SendMsg(%s, markerNumber, (sptr_t)xpmData);'''
|
||||||
wxMemoryOutputStream strm;
|
|
||||||
wxImage img = bmp.ConvertToImage();
|
|
||||||
if (img.HasAlpha())
|
|
||||||
img.ConvertAlphaToMask();
|
|
||||||
img.SaveFile(strm, wxBITMAP_TYPE_XPM);
|
|
||||||
size_t len = strm.GetSize();
|
|
||||||
char* buff = new char[len+1];
|
|
||||||
strm.CopyTo(buff, len);
|
|
||||||
buff[len] = 0;
|
|
||||||
SendMsg(%s, markerNumber, (sptr_t)buff);
|
|
||||||
delete [] buff;'''
|
|
||||||
),
|
),
|
||||||
|
|
||||||
'GetMargins' : ('GetMarginCount', 0, 0),
|
'GetMargins' : ('GetMarginCount', 0, 0),
|
||||||
@@ -538,20 +527,9 @@ methodOverrideMap = {
|
|||||||
|
|
||||||
'RegisterImage' :
|
'RegisterImage' :
|
||||||
(0,
|
(0,
|
||||||
'''void %s(int type, const wxBitmap& bmp);''',
|
'''void %s(int type, const char* const* xpmData);''',
|
||||||
'''void %s(int type, const wxBitmap& bmp) {
|
'''void %s(int type, const char* const* xpmData) {
|
||||||
// convert bmp to a xpm in a string
|
SendMsg(%s, type, (sptr_t)xpmData);'''
|
||||||
wxMemoryOutputStream strm;
|
|
||||||
wxImage img = bmp.ConvertToImage();
|
|
||||||
if (img.HasAlpha())
|
|
||||||
img.ConvertAlphaToMask();
|
|
||||||
img.SaveFile(strm, wxBITMAP_TYPE_XPM);
|
|
||||||
size_t len = strm.GetSize();
|
|
||||||
char* buff = new char[len+1];
|
|
||||||
strm.CopyTo(buff, len);
|
|
||||||
buff[len] = 0;
|
|
||||||
SendMsg(%s, type, (sptr_t)buff);
|
|
||||||
delete [] buff;'''
|
|
||||||
),
|
),
|
||||||
|
|
||||||
'SetHScrollBar' : ('SetUseHorizontalScrollBar', 0, 0),
|
'SetHScrollBar' : ('SetUseHorizontalScrollBar', 0, 0),
|
||||||
|
@@ -662,19 +662,8 @@ int wxStyledTextCtrl::MarkerPrevious(int lineStart, int markerMask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define a marker from a bitmap
|
// Define a marker from a bitmap
|
||||||
void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp) {
|
void wxStyledTextCtrl::MarkerDefinePixmap(int markerNumber, const char* const* xpmData) {
|
||||||
// convert bmp to a xpm in a string
|
SendMsg(SCI_MARKERDEFINEPIXMAP, markerNumber, (sptr_t)xpmData);
|
||||||
wxMemoryOutputStream strm;
|
|
||||||
wxImage img = bmp.ConvertToImage();
|
|
||||||
if (img.HasAlpha())
|
|
||||||
img.ConvertAlphaToMask();
|
|
||||||
img.SaveFile(strm, wxBITMAP_TYPE_XPM);
|
|
||||||
size_t len = strm.GetSize();
|
|
||||||
char* buff = new char[len+1];
|
|
||||||
strm.CopyTo(buff, len);
|
|
||||||
buff[len] = 0;
|
|
||||||
SendMsg(SCI_MARKERDEFINEPIXMAP, markerNumber, (sptr_t)buff);
|
|
||||||
delete [] buff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a set of markers to a line.
|
// Add a set of markers to a line.
|
||||||
@@ -1464,19 +1453,8 @@ bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Register an image for use in autocompletion lists.
|
// Register an image for use in autocompletion lists.
|
||||||
void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) {
|
void wxStyledTextCtrl::RegisterImage(int type, const char* const* xpmData) {
|
||||||
// convert bmp to a xpm in a string
|
SendMsg(SCI_REGISTERIMAGE, type, (sptr_t)xpmData);
|
||||||
wxMemoryOutputStream strm;
|
|
||||||
wxImage img = bmp.ConvertToImage();
|
|
||||||
if (img.HasAlpha())
|
|
||||||
img.ConvertAlphaToMask();
|
|
||||||
img.SaveFile(strm, wxBITMAP_TYPE_XPM);
|
|
||||||
size_t len = strm.GetSize();
|
|
||||||
char* buff = new char[len+1];
|
|
||||||
strm.CopyTo(buff, len);
|
|
||||||
buff[len] = 0;
|
|
||||||
SendMsg(SCI_REGISTERIMAGE, type, (sptr_t)buff);
|
|
||||||
delete [] buff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear all the registered images.
|
// Clear all the registered images.
|
||||||
@@ -2384,7 +2362,7 @@ void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags)
|
|||||||
SendMsg(SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, 0);
|
SendMsg(SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrive the display mode of visual flags for wrapped lines.
|
// Retrieve the display mode of visual flags for wrapped lines.
|
||||||
int wxStyledTextCtrl::GetWrapVisualFlags() const
|
int wxStyledTextCtrl::GetWrapVisualFlags() const
|
||||||
{
|
{
|
||||||
return SendMsg(SCI_GETWRAPVISUALFLAGS, 0, 0);
|
return SendMsg(SCI_GETWRAPVISUALFLAGS, 0, 0);
|
||||||
@@ -2396,7 +2374,7 @@ void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation)
|
|||||||
SendMsg(SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, 0);
|
SendMsg(SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrive the location of visual flags for wrapped lines.
|
// Retrieve the location of visual flags for wrapped lines.
|
||||||
int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
|
int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
|
||||||
{
|
{
|
||||||
return SendMsg(SCI_GETWRAPVISUALFLAGSLOCATION, 0, 0);
|
return SendMsg(SCI_GETWRAPVISUALFLAGSLOCATION, 0, 0);
|
||||||
@@ -2408,7 +2386,7 @@ void wxStyledTextCtrl::SetWrapStartIndent(int indent)
|
|||||||
SendMsg(SCI_SETWRAPSTARTINDENT, indent, 0);
|
SendMsg(SCI_SETWRAPSTARTINDENT, indent, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrive the start indent for wrapped lines.
|
// Retrieve the start indent for wrapped lines.
|
||||||
int wxStyledTextCtrl::GetWrapStartIndent() const
|
int wxStyledTextCtrl::GetWrapStartIndent() const
|
||||||
{
|
{
|
||||||
return SendMsg(SCI_GETWRAPSTARTINDENT, 0, 0);
|
return SendMsg(SCI_GETWRAPSTARTINDENT, 0, 0);
|
||||||
@@ -5058,6 +5036,16 @@ void wxStyledTextCtrl::AnnotationClearLine(int line) {
|
|||||||
SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)NULL);
|
SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber,
|
||||||
|
const wxBitmap& bmp) {
|
||||||
|
m_swx->DoMarkerDefineBitmap(markerNumber, bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp)
|
||||||
|
{
|
||||||
|
m_swx->DoRegisterImage(type, bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -563,6 +563,16 @@ void wxStyledTextCtrl::AnnotationClearLine(int line) {
|
|||||||
SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)NULL);
|
SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber,
|
||||||
|
const wxBitmap& bmp) {
|
||||||
|
m_swx->DoMarkerDefineBitmap(markerNumber, bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp)
|
||||||
|
{
|
||||||
|
m_swx->DoRegisterImage(type, bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -298,6 +298,12 @@ public:
|
|||||||
// Clear annotations from the given line.
|
// Clear annotations from the given line.
|
||||||
void AnnotationClearLine(int line);
|
void AnnotationClearLine(int line);
|
||||||
|
|
||||||
|
// Define a marker from a bitmap.
|
||||||
|
void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
|
||||||
|
|
||||||
|
// Register an image for use in autocompletion lists.
|
||||||
|
void RegisterImage(int type, const wxBitmap& bmp);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// The following methods are nearly equivalent to their similarly named
|
// The following methods are nearly equivalent to their similarly named
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
IMPORTANT: This file is generated by src/stc/gen_iface.py from
|
IMPORTANT: This file is generated by src/stc/gen_iface.py from
|
||||||
src/stc/stc.interface.h.in. Do not edit the file in
|
src/stc/stc.interface.h.in. Do not edit the file in
|
||||||
interface/wx/stc or your changes will be lost.
|
interface/wx/stc or your changes will be lost.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Extract style settings from a spec-string which is composed of one or
|
Extract style settings from a spec-string which is composed of one or
|
||||||
more of the following comma separated elements:
|
more of the following comma separated elements:
|
||||||
|
|
||||||
bold turns on bold
|
bold turns on bold
|
||||||
italic turns on italics
|
italic turns on italics
|
||||||
fore:[name or \#RRGGBB] sets the foreground colour
|
fore:[name or \#RRGGBB] sets the foreground colour
|
||||||
@@ -353,6 +353,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
void AnnotationClearLine(int line);
|
void AnnotationClearLine(int line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Define a marker with a wxBitmap.
|
||||||
|
*/
|
||||||
|
void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Register an image for use in autocompletion lists.
|
||||||
|
*/
|
||||||
|
void RegisterImage(int type, const wxBitmap& bmp);
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user