Naming conventions.

This commit is contained in:
Jeff Young 2021-03-19 21:38:53 +00:00
parent 2e129d9b47
commit 812d38736e
9 changed files with 1118 additions and 1110 deletions

View File

@ -59,7 +59,7 @@ void BASIC_GAL::doDrawPolyline( const std::vector<wxPoint>& aLocalPointList )
{
if( m_DC )
{
if( isFillEnabled )
if( m_isFillEnabled )
{
GRPoly( m_isClipped ? &m_clipBox : NULL, m_DC, aLocalPointList.size(),
&aLocalPointList[0], 0, GetLineWidth(), m_Color, m_Color );
@ -130,7 +130,7 @@ void BASIC_GAL::DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint
if( m_DC )
{
if( isFillEnabled )
if( m_isFillEnabled )
{
GRLine( m_isClipped ? &m_clipBox : NULL, m_DC, startVector.x, startVector.y,
endVector.x, endVector.y, GetLineWidth(), m_Color );

File diff suppressed because it is too large Load Diff

View File

@ -136,10 +136,10 @@ CAIRO_PRINT_GAL::CAIRO_PRINT_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptio
CAIRO_GAL_BASE( aDisplayOptions )
{
m_printCtx = std::move( aContext );
context = currentContext = m_printCtx->GetContext();
surface = m_printCtx->GetSurface();
cairo_reference( context );
cairo_surface_reference( surface );
m_context = m_currentContext = m_printCtx->GetContext();
m_surface = m_printCtx->GetSurface();
cairo_reference( m_context );
cairo_surface_reference( m_surface );
m_clearColor = COLOR4D( 1.0, 1.0, 1.0, 1.0 );
m_hasNativeLandscapeRotation = false;
resetContext();
@ -150,10 +150,10 @@ CAIRO_PRINT_GAL::CAIRO_PRINT_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptio
void CAIRO_PRINT_GAL::ComputeWorldScreenMatrix()
{
worldScale = screenDPI * worldUnitLength * zoomFactor;
const auto paperSizeIU = VECTOR2D( m_nativePaperSize.y, m_nativePaperSize.x ) /* inches */
/ worldUnitLength; /* 1 inch in IU */
const auto paperSizeIUTransposed = VECTOR2D( paperSizeIU.y, paperSizeIU.x );
m_worldScale = m_screenDPI * m_worldUnitLength * m_zoomFactor;
const VECTOR2D paperSizeIU = VECTOR2D( m_nativePaperSize.y, m_nativePaperSize.x ) /* inches */
/ m_worldUnitLength; /* 1" in IU */
const VECTOR2D paperSizeIUTransposed( paperSizeIU.y, paperSizeIU.x );
MATRIX3x3D scale, translation, flip, rotate, lookat;
@ -165,27 +165,27 @@ void CAIRO_PRINT_GAL::ComputeWorldScreenMatrix()
if( m_hasNativeLandscapeRotation )
{
translation.SetTranslation( 0.5 / zoomFactor * paperSizeIUTransposed );
translation.SetTranslation( 0.5 / m_zoomFactor * paperSizeIUTransposed );
}
else
{
if( isLandscape() )
{
translation.SetTranslation( 0.5 / zoomFactor * paperSizeIU );
translation.SetTranslation( 0.5 / m_zoomFactor * paperSizeIU );
rotate.SetRotation( 90.0 * M_PI / 180.0 );
}
else
{
translation.SetTranslation( 0.5 / zoomFactor * paperSizeIUTransposed );
translation.SetTranslation( 0.5 / m_zoomFactor * paperSizeIUTransposed );
}
}
scale.SetScale( VECTOR2D( worldScale, worldScale ) );
flip.SetScale( VECTOR2D( globalFlipX ? -1.0 : 1.0, globalFlipY ? -1.0 : 1.0 ) );
lookat.SetTranslation( -lookAtPoint );
scale.SetScale( VECTOR2D( m_worldScale, m_worldScale ) );
flip.SetScale( VECTOR2D( m_globalFlipX ? -1.0 : 1.0, m_globalFlipY ? -1.0 : 1.0 ) );
lookat.SetTranslation( -m_lookAtPoint );
worldScreenMatrix = scale * translation * flip * rotate * lookat;
screenWorldMatrix = worldScreenMatrix.Inverse();
m_worldScreenMatrix = scale * translation * flip * rotate * lookat;
m_screenWorldMatrix = m_worldScreenMatrix.Inverse();
}
@ -199,8 +199,8 @@ void CAIRO_PRINT_GAL::SetNativePaperSize( const VECTOR2D& aSize, bool aHasNative
void CAIRO_PRINT_GAL::SetSheetSize( const VECTOR2D& aSize )
{
// Convert aSize (inches) to pixels
SetScreenSize( VECTOR2I( std::ceil( aSize.x * screenDPI ) * 2,
std::ceil( aSize.y * screenDPI ) * 2 ) );
SetScreenSize( VECTOR2I( std::ceil( aSize.x * m_screenDPI ) * 2,
std::ceil( aSize.y * m_screenDPI ) * 2 ) );
}

View File

@ -37,8 +37,8 @@ using namespace KIGFX;
GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
options( aDisplayOptions ),
strokeFont( this )
m_options( aDisplayOptions ),
m_strokeFont( this )
{
// Set the default values for the internal variables
SetIsFill( false );
@ -64,23 +64,23 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
// Set grid defaults
SetGridVisibility( true );
SetCoarseGrid( 10 );
gridLineWidth = 0.5f;
gridStyle = GRID_STYLE::LINES;
gridMinSpacing = 10;
m_gridLineWidth = 0.5f;
m_gridStyle = GRID_STYLE::LINES;
m_gridMinSpacing = 10;
// Initialize the cursor shape
SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
fullscreenCursor = false;
forceDisplayCursor = false;
m_fullscreenCursor = false;
m_forceDisplayCursor = false;
SetCursorEnabled( false );
// Initialize text properties
ResetTextAttributes();
strokeFont.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize );
m_strokeFont.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize );
// subscribe for settings updates
observerLink = options.Subscribe( this );
m_observerLink = m_options.Subscribe( this );
}
@ -102,39 +102,39 @@ bool GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
{
bool refresh = false;
if( options.m_gridStyle != gridStyle )
if( m_options.m_gridStyle != m_gridStyle )
{
gridStyle = options.m_gridStyle ;
m_gridStyle = m_options.m_gridStyle ;
refresh = true;
}
if( options.m_gridLineWidth != gridLineWidth )
if( m_options.m_gridLineWidth != m_gridLineWidth )
{
gridLineWidth = std::floor( options.m_gridLineWidth + 0.5 );
m_gridLineWidth = std::floor( m_options.m_gridLineWidth + 0.5 );
refresh = true;
}
if( options.m_gridMinSpacing != gridMinSpacing )
if( m_options.m_gridMinSpacing != m_gridMinSpacing )
{
gridMinSpacing = options.m_gridMinSpacing;
m_gridMinSpacing = m_options.m_gridMinSpacing;
refresh = true;
}
if( options.m_axesEnabled != axesEnabled )
if( m_options.m_axesEnabled != m_axesEnabled )
{
axesEnabled = options.m_axesEnabled;
m_axesEnabled = m_options.m_axesEnabled;
refresh = true;
}
if( options.m_forceDisplayCursor != forceDisplayCursor )
if( m_options.m_forceDisplayCursor != m_forceDisplayCursor )
{
forceDisplayCursor = options.m_forceDisplayCursor;
m_forceDisplayCursor = m_options.m_forceDisplayCursor;
refresh = true;
}
if( options.m_fullscreenCursor != fullscreenCursor )
if( m_options.m_fullscreenCursor != m_fullscreenCursor )
{
fullscreenCursor = options.m_fullscreenCursor;
m_fullscreenCursor = m_options.m_fullscreenCursor;
refresh = true;
}
@ -176,7 +176,7 @@ VECTOR2D GAL::GetTextLineSize( const UTF8& aText ) const
// Compute the X and Y size of a given text.
// Because computeTextLineSize expects a one line text,
// aText is expected to be only one line text.
return strokeFont.computeTextLineSize( aText );
return m_strokeFont.computeTextLineSize( aText );
}
@ -186,26 +186,26 @@ void GAL::ComputeWorldScreenMatrix()
MATRIX3x3D translation;
translation.SetIdentity();
translation.SetTranslation( 0.5 * VECTOR2D( screenSize ) );
translation.SetTranslation( 0.5 * VECTOR2D( m_screenSize ) );
MATRIX3x3D rotate;
rotate.SetIdentity();
rotate.SetRotation( rotation );
rotate.SetRotation( m_rotation );
MATRIX3x3D scale;
scale.SetIdentity();
scale.SetScale( VECTOR2D( worldScale, worldScale ) );
scale.SetScale( VECTOR2D( m_worldScale, m_worldScale ) );
MATRIX3x3D flip;
flip.SetIdentity();
flip.SetScale( VECTOR2D( globalFlipX ? -1.0 : 1.0, globalFlipY ? -1.0 : 1.0 ) );
flip.SetScale( VECTOR2D( m_globalFlipX ? -1.0 : 1.0, m_globalFlipY ? -1.0 : 1.0 ) );
MATRIX3x3D lookat;
lookat.SetIdentity();
lookat.SetTranslation( -lookAtPoint );
lookat.SetTranslation( -m_lookAtPoint );
worldScreenMatrix = translation * rotate * flip * scale * lookat;
screenWorldMatrix = worldScreenMatrix.Inverse();
m_worldScreenMatrix = translation * rotate * flip * scale * lookat;
m_screenWorldMatrix = m_worldScreenMatrix.Inverse();
}
@ -213,7 +213,7 @@ double GAL::computeMinGridSpacing() const
{
// just return the current value. This could be cleverer and take
// into account other settings in future
return gridMinSpacing;
return m_gridMinSpacing;
}
@ -221,14 +221,14 @@ VECTOR2D GAL::GetGridPoint( const VECTOR2D& aPoint ) const
{
#if 0
// This old code expects a non zero grid size, which can be wrong here.
return VECTOR2D( KiROUND( ( aPoint.x - gridOffset.x ) / gridSize.x ) * gridSize.x + gridOffset.x,
KiROUND( ( aPoint.y - gridOffset.y ) / gridSize.y ) * gridSize.y + gridOffset.y );
return VECTOR2D( KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) * m_gridSize.x + m_gridOffset.x,
KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) * m_gridSize.y + m_gridOffset.y );
#else
// if grid size == 0.0 there is no grid, so use aPoint as grid reference position
double cx = gridSize.x > 0.0 ? KiROUND( ( aPoint.x - gridOffset.x ) / gridSize.x ) * gridSize.x + gridOffset.x
: aPoint.x;
double cy = gridSize.y > 0.0 ? KiROUND( ( aPoint.y - gridOffset.y ) / gridSize.y ) * gridSize.y + gridOffset.y
: aPoint.y;
double cx = m_gridSize.x > 0.0 ? KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) * m_gridSize.x + m_gridOffset.x
: aPoint.x;
double cy = m_gridSize.y > 0.0 ? KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) * m_gridSize.y + m_gridOffset.y
: aPoint.y;
return VECTOR2D( cx, cy );
#endif
@ -241,14 +241,12 @@ const int GAL::GRID_DEPTH = MAX_DEPTH - 1;
COLOR4D GAL::getCursorColor() const
{
auto color = cursorColor;
COLOR4D color = m_cursorColor;
// dim the cursor if it's only on because it was forced
// (this helps to provide a hint for active tools)
if( !isCursorEnabled )
{
if( !m_isCursorEnabled )
color.a = color.a * 0.5;
}
return color;
}

File diff suppressed because it is too large Load Diff

View File

@ -218,13 +218,13 @@ public:
protected:
// Geometric transforms according to the currentWorld2Screen transform matrix:
// Geometric transforms according to the m_currentWorld2Screen transform matrix:
const double xform( double x ); // scale
const VECTOR2D xform( double x, double y ); // rotation, scale and offset
const VECTOR2D xform( const VECTOR2D& aP ); // rotation, scale and offset
/**
* Transform according to the rotation from currentWorld2Screen transform matrix.
* Transform according to the rotation from m_currentWorld2Screen transform matrix.
*
* @param aAngle is the angle in radians to transform.
* @return the modified angle.
@ -232,7 +232,7 @@ protected:
const double angle_xform( const double aAngle );
/**
* Transform according to the rotation from currentWorld2Screen transform matrix
* Transform according to the rotation from m_currentWorld2Screen transform matrix
* for the start angle and the end angle of an arc.
*
* @param aStartAngle is the arc starting point in radians to transform
@ -312,38 +312,38 @@ protected:
/// Type definition for an graphics group element
typedef struct
{
GRAPHICS_COMMAND command; ///< Command to execute
GRAPHICS_COMMAND m_Command; ///< Command to execute
union {
double dblArg[MAX_CAIRO_ARGUMENTS]; ///< Arguments for Cairo commands
bool boolArg; ///< A bool argument
int intArg; ///< An int argument
} argument;
cairo_path_t* cairoPath; ///< Pointer to a Cairo path
double DblArg[MAX_CAIRO_ARGUMENTS]; ///< Arguments for Cairo commands
bool BoolArg; ///< A bool argument
int IntArg; ///< An int argument
} m_Argument;
cairo_path_t* m_CairoPath; ///< Pointer to a Cairo path
} GROUP_ELEMENT;
// Variables for the grouping function
bool isGrouping; ///< Is grouping enabled ?
bool isElementAdded; ///< Was an graphic element added ?
typedef std::deque<GROUP_ELEMENT> GROUP; ///< A graphic group type definition
std::map<int, GROUP> groups; ///< List of graphic groups
unsigned int groupCounter; ///< Counter used for generating keys for groups
GROUP* currentGroup; ///< Currently used group
double linePixelWidth;
double lineWidthInPixels;
bool lineWidthIsOdd;
// Variables for the grouping function
bool m_isGrouping; ///< Is grouping enabled ?
bool m_isElementAdded; ///< Was an graphic element added ?
std::map<int, GROUP> m_groups; ///< List of graphic groups
unsigned int m_groupCounter; ///< Counter used for generating group keys
GROUP* m_currentGroup; ///< Currently used group
cairo_matrix_t cairoWorldScreenMatrix; ///< Cairo world to screen transformation matrix
cairo_matrix_t currentXform;
cairo_matrix_t currentWorld2Screen;
cairo_t* currentContext; ///< Currently used Cairo context for drawing
cairo_t* context; ///< Cairo image
cairo_surface_t* surface; ///< Cairo surface
double m_lineWidthInPixels;
bool m_lineWidthIsOdd;
cairo_matrix_t m_cairoWorldScreenMatrix; ///< Cairo world to screen transform matrix
cairo_matrix_t m_currentXform;
cairo_matrix_t m_currentWorld2Screen;
cairo_t* m_currentContext; ///< Currently used Cairo context for drawing
cairo_t* m_context; ///< Cairo image
cairo_surface_t* m_surface; ///< Cairo surface
/// List of surfaces that were created by painting images, to be cleaned up later
std::vector<cairo_surface_t*> imageSurfaces;
std::vector<cairo_surface_t*> m_imageSurfaces;
std::vector<cairo_matrix_t> xformStack;
std::vector<cairo_matrix_t> m_xformStack;
/// Format used to store pixels
static constexpr cairo_format_t GAL_FORMAT = CAIRO_FORMAT_ARGB32;
};
@ -399,12 +399,12 @@ public:
void SetMouseListener( wxEvtHandler* aMouseListener )
{
mouseListener = aMouseListener;
m_mouseListener = aMouseListener;
}
void SetPaintListener( wxEvtHandler* aPaintListener )
{
paintListener = aPaintListener;
m_paintListener = aPaintListener;
}
/// @copydoc GAL::BeginDrawing()
@ -448,25 +448,25 @@ public:
protected:
// Compositor related variables
std::shared_ptr<CAIRO_COMPOSITOR> compositor; ///< Object for layers compositing
unsigned int mainBuffer; ///< Handle to the main buffer
unsigned int overlayBuffer; ///< Handle to the overlay buffer
RENDER_TARGET currentTarget; ///< Current rendering target
bool validCompositor; ///< Compositor initialization flag
std::shared_ptr<CAIRO_COMPOSITOR> m_compositor; ///< Object for layers compositing
unsigned int m_mainBuffer; ///< Handle to the main buffer
unsigned int m_overlayBuffer; ///< Handle to the overlay buffer
RENDER_TARGET m_currentTarget; ///< Current rendering target
bool m_validCompositor; ///< Compositor initialization flag
// Variables related to wxWidgets
wxWindow* parentWindow; ///< Parent window
wxEvtHandler* mouseListener; ///< Mouse listener
wxEvtHandler* paintListener; ///< Paint listener
unsigned int bufferSize; ///< Size of buffers cairoOutput, bitmapBuffers
unsigned char* wxOutput; ///< wxImage compatible buffer
wxWindow* m_parentWindow; ///< Parent window
wxEvtHandler* m_mouseListener; ///< Mouse listener
wxEvtHandler* m_paintListener; ///< Paint listener
unsigned int m_bufferSize; ///< Size of buffers cairoOutput, bitmapBuffers
unsigned char* m_wxOutput; ///< wxImage compatible buffer
// Variables related to Cairo <-> wxWidgets
unsigned char* bitmapBuffer; ///< Storage of the Cairo image
int stride; ///< Stride value for Cairo
int wxBufferWidth;
bool isInitialized; ///< Are Cairo image & surface ready to use
COLOR4D backgroundColor; ///< Background color
unsigned char* m_bitmapBuffer; ///< Storage of the Cairo image
int m_stride; ///< Stride value for Cairo
int m_wxBufferWidth;
bool m_isInitialized; ///< Are Cairo image & surface ready to use
COLOR4D m_backgroundColor; ///< Background color
};
} // namespace KIGFX

View File

@ -207,7 +207,7 @@ public:
/// Return GAL canvas size in pixels
const VECTOR2I& GetScreenPixelSize() const
{
return screenSize;
return m_screenSize;
}
/// Force all remaining objects to be drawn.
@ -241,7 +241,7 @@ public:
*/
virtual void SetIsFill( bool aIsFillEnabled )
{
isFillEnabled = aIsFillEnabled;
m_isFillEnabled = aIsFillEnabled;
}
/**
@ -251,7 +251,7 @@ public:
*/
virtual void SetIsStroke( bool aIsStrokeEnabled )
{
isStrokeEnabled = aIsStrokeEnabled;
m_isStrokeEnabled = aIsStrokeEnabled;
}
/**
@ -261,7 +261,7 @@ public:
*/
virtual void SetFillColor( const COLOR4D& aColor )
{
fillColor = aColor;
m_fillColor = aColor;
}
/**
@ -271,7 +271,7 @@ public:
*/
inline const COLOR4D& GetFillColor() const
{
return fillColor;
return m_fillColor;
}
/**
@ -281,7 +281,7 @@ public:
*/
virtual void SetStrokeColor( const COLOR4D& aColor )
{
strokeColor = aColor;
m_strokeColor = aColor;
}
/**
@ -291,7 +291,7 @@ public:
*/
inline const COLOR4D& GetStrokeColor() const
{
return strokeColor;
return m_strokeColor;
}
/**
@ -301,7 +301,7 @@ public:
*/
virtual void SetLineWidth( float aLineWidth )
{
lineWidth = aLineWidth;
m_lineWidth = aLineWidth;
}
/**
@ -311,7 +311,7 @@ public:
*/
inline float GetLineWidth() const
{
return lineWidth;
return m_lineWidth;
}
/**
@ -321,10 +321,10 @@ public:
*/
virtual void SetLayerDepth( double aLayerDepth )
{
assert( aLayerDepth <= depthRange.y );
assert( aLayerDepth >= depthRange.x );
assert( aLayerDepth <= m_depthRange.y );
assert( aLayerDepth >= m_depthRange.x );
layerDepth = aLayerDepth;
m_layerDepth = aLayerDepth;
}
// ----
@ -333,7 +333,7 @@ public:
const STROKE_FONT& GetStrokeFont() const
{
return strokeFont;
return m_strokeFont;
}
/**
@ -346,7 +346,7 @@ public:
virtual void StrokeText( const wxString& aText, const VECTOR2D& aPosition,
double aRotationAngle )
{
strokeFont.Draw( aText, aPosition, aRotationAngle );
m_strokeFont.Draw( aText, aPosition, aRotationAngle );
}
/**
@ -363,23 +363,23 @@ public:
// Fallback: use stroke font
// Handle flipped view
if( globalFlipX )
if( m_globalFlipX )
textProperties.m_mirrored = !textProperties.m_mirrored;
// Bitmap font is slightly smaller and slightly heavier than the stroke font so we
// compensate a bit before stroking
float saveLineWidth = lineWidth;
float saveLineWidth = m_lineWidth;
VECTOR2D saveGlyphSize = textProperties.m_glyphSize;
{
lineWidth *= 1.2f;
m_lineWidth *= 1.2f;
textProperties.m_glyphSize = textProperties.m_glyphSize * 0.8;
StrokeText( aText, aPosition, aRotationAngle );
}
lineWidth = saveLineWidth;
m_lineWidth = saveLineWidth;
textProperties.m_glyphSize = saveGlyphSize;
if( globalFlipX )
if( m_globalFlipX )
textProperties.m_mirrored = !textProperties.m_mirrored;
}
@ -582,7 +582,7 @@ public:
*/
const MATRIX3x3D& GetWorldScreenMatrix() const
{
return worldScreenMatrix;
return m_worldScreenMatrix;
}
/**
@ -592,7 +592,7 @@ public:
*/
const MATRIX3x3D& GetScreenWorldMatrix() const
{
return screenWorldMatrix;
return m_screenWorldMatrix;
}
/**
@ -602,7 +602,7 @@ public:
*/
inline void SetWorldScreenMatrix( const MATRIX3x3D& aMatrix )
{
worldScreenMatrix = aMatrix;
m_worldScreenMatrix = aMatrix;
}
/**
@ -616,12 +616,12 @@ public:
*/
inline void SetWorldUnitLength( double aWorldUnitLength )
{
worldUnitLength = aWorldUnitLength;
m_worldUnitLength = aWorldUnitLength;
}
inline void SetScreenSize( const VECTOR2I& aSize )
{
screenSize = aSize;
m_screenSize = aSize;
}
/**
@ -634,7 +634,7 @@ public:
*/
inline void SetScreenDPI( double aScreenDPI )
{
screenDPI = aScreenDPI;
m_screenDPI = aScreenDPI;
}
/**
@ -646,7 +646,7 @@ public:
*/
inline void SetLookAtPoint( const VECTOR2D& aPoint )
{
lookAtPoint = aPoint;
m_lookAtPoint = aPoint;
}
/**
@ -656,7 +656,7 @@ public:
*/
inline const VECTOR2D& GetLookAtPoint() const
{
return lookAtPoint;
return m_lookAtPoint;
}
/**
@ -666,7 +666,7 @@ public:
*/
inline void SetZoomFactor( double aZoomFactor )
{
zoomFactor = aZoomFactor;
m_zoomFactor = aZoomFactor;
}
/**
@ -676,7 +676,7 @@ public:
*/
inline double GetZoomFactor() const
{
return zoomFactor;
return m_zoomFactor;
}
/**
@ -686,7 +686,7 @@ public:
*/
void SetRotation( double aRotation )
{
rotation = aRotation;
m_rotation = aRotation;
}
/**
@ -696,7 +696,7 @@ public:
*/
double GetRotation() const
{
return rotation;
return m_rotation;
}
/**
@ -709,7 +709,7 @@ public:
*/
inline void SetDepthRange( const VECTOR2D& aDepthRange )
{
depthRange = aDepthRange;
m_depthRange = aDepthRange;
}
/**
@ -717,7 +717,7 @@ public:
*/
inline double GetMinDepth() const
{
return depthRange.x;
return m_depthRange.x;
}
/**
@ -725,7 +725,7 @@ public:
*/
inline double GetMaxDepth() const
{
return depthRange.y;
return m_depthRange.y;
}
/**
@ -735,7 +735,7 @@ public:
*/
inline double GetWorldScale() const
{
return worldScale;
return m_worldScale;
}
/**
@ -746,8 +746,8 @@ public:
*/
inline void SetFlip( bool xAxis, bool yAxis )
{
globalFlipX = xAxis;
globalFlipY = yAxis;
m_globalFlipX = xAxis;
m_globalFlipY = yAxis;
}
/**
@ -755,7 +755,7 @@ public:
*/
bool IsFlippedX() const
{
return globalFlipX;
return m_globalFlipX;
}
/**
@ -763,7 +763,7 @@ public:
*/
bool IsFlippedY() const
{
return globalFlipY;
return m_globalFlipY;
}
// ---------------------------
@ -823,14 +823,14 @@ public:
*
* @param aVisibility is the new visibility setting of the grid.
*/
void SetGridVisibility( bool aVisibility ) { gridVisibility = aVisibility; }
void SetGridVisibility( bool aVisibility ) { m_gridVisibility = aVisibility; }
bool GetGridVisibility() const { return gridVisibility; }
bool GetGridVisibility() const { return m_gridVisibility; }
bool GetGridSnapping() const
{
return ( options.m_gridSnapping == KIGFX::GRID_SNAPPING::ALWAYS ||
( gridVisibility && options.m_gridSnapping == KIGFX::GRID_SNAPPING::WITH_GRID ) );
return m_options.m_gridSnapping == KIGFX::GRID_SNAPPING::ALWAYS ||
( m_gridVisibility && m_options.m_gridSnapping == KIGFX::GRID_SNAPPING::WITH_GRID );
}
/**
* Set the origin point for the grid.
@ -839,18 +839,22 @@ public:
*/
inline void SetGridOrigin( const VECTOR2D& aGridOrigin )
{
gridOrigin = aGridOrigin;
m_gridOrigin = aGridOrigin;
if( gridSize.x == 0.0 || gridSize.y == 0.0 )
gridOffset = VECTOR2D(0.0, 0.0);
if( m_gridSize.x == 0.0 || m_gridSize.y == 0.0 )
{
m_gridOffset = VECTOR2D( 0.0, 0.0);
}
else
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
(long) gridOrigin.y % (long) gridSize.y );
{
m_gridOffset = VECTOR2D( (long) m_gridOrigin.x % (long) m_gridSize.x,
(long) m_gridOrigin.y % (long) m_gridSize.y );
}
}
inline const VECTOR2D& GetGridOrigin() const
{
return gridOrigin;
return m_gridOrigin;
}
/**
@ -860,14 +864,14 @@ public:
*/
inline void SetGridSize( const VECTOR2D& aGridSize )
{
gridSize = aGridSize;
m_gridSize = aGridSize;
// Avoid stupid grid size values: a grid size should be >= 1 in internal units
gridSize.x = std::max( 1.0, gridSize.x );
gridSize.y = std::max( 1.0, gridSize.y );
m_gridSize.x = std::max( 1.0, m_gridSize.x );
m_gridSize.y = std::max( 1.0, m_gridSize.y );
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
(long) gridOrigin.y % (long) gridSize.y );
m_gridOffset = VECTOR2D( (long) m_gridOrigin.x % (long) m_gridSize.x,
(long) m_gridOrigin.y % (long) m_gridSize.y );
}
/**
@ -877,7 +881,7 @@ public:
*/
inline const VECTOR2D& GetGridSize() const
{
return gridSize;
return m_gridSize;
}
/**
@ -887,7 +891,7 @@ public:
*/
inline void SetGridColor( const COLOR4D& aGridColor )
{
gridColor = aGridColor;
m_gridColor = aGridColor;
}
/**
@ -897,7 +901,7 @@ public:
*/
inline void SetAxesColor( const COLOR4D& aAxesColor )
{
axesColor = aAxesColor;
m_axesColor = aAxesColor;
}
/**
@ -905,7 +909,7 @@ public:
*/
inline void SetAxesEnabled( bool aAxesEnabled )
{
axesEnabled = aAxesEnabled;
m_axesEnabled = aAxesEnabled;
}
/**
@ -915,7 +919,7 @@ public:
*/
inline void SetCoarseGrid( int aInterval )
{
gridTick = aInterval;
m_gridTick = aInterval;
}
/**
@ -925,7 +929,7 @@ public:
*/
inline float GetGridLineWidth() const
{
return gridLineWidth;
return m_gridLineWidth;
}
///< Draw the grid
@ -947,7 +951,7 @@ public:
*/
inline VECTOR2D ToWorld( const VECTOR2D& aPoint ) const
{
return VECTOR2D( screenWorldMatrix * aPoint );
return VECTOR2D( m_screenWorldMatrix * aPoint );
}
/**
@ -958,7 +962,7 @@ public:
*/
inline VECTOR2D ToScreen( const VECTOR2D& aPoint ) const
{
return VECTOR2D( worldScreenMatrix * aPoint );
return VECTOR2D( m_worldScreenMatrix * aPoint );
}
/**
@ -968,7 +972,7 @@ public:
*/
inline void SetCursorEnabled( bool aCursorEnabled )
{
isCursorEnabled = aCursorEnabled;
m_isCursorEnabled = aCursorEnabled;
}
/**
@ -978,7 +982,7 @@ public:
*/
bool IsCursorEnabled() const
{
return isCursorEnabled || forceDisplayCursor;
return m_isCursorEnabled || m_forceDisplayCursor;
}
/**
@ -988,7 +992,7 @@ public:
*/
inline void SetCursorColor( const COLOR4D& aCursorColor )
{
cursorColor = aCursorColor;
m_cursorColor = aCursorColor;
}
/**
@ -1004,7 +1008,7 @@ public:
*/
inline void AdvanceDepth()
{
layerDepth -= 0.05;
m_layerDepth -= 0.05;
}
/**
@ -1012,7 +1016,7 @@ public:
*/
inline void PushDepth()
{
depthStack.push( layerDepth );
m_depthStack.push( m_layerDepth );
}
/**
@ -1020,8 +1024,8 @@ public:
*/
inline void PopDepth()
{
layerDepth = depthStack.top();
depthStack.pop();
m_layerDepth = m_depthStack.top();
m_depthStack.pop();
}
virtual void EnableDepthTest( bool aEnabled = false ) {};
@ -1059,7 +1063,7 @@ protected:
/// Compute the scaling factor for the world->screen matrix
inline void computeWorldScale()
{
worldScale = screenDPI * worldUnitLength * zoomFactor;
m_worldScale = m_screenDPI * m_worldUnitLength * m_zoomFactor;
}
/**
@ -1099,60 +1103,60 @@ protected:
*/
virtual bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions );
GAL_DISPLAY_OPTIONS& options;
UTIL::LINK observerLink;
GAL_DISPLAY_OPTIONS& m_options;
UTIL::LINK m_observerLink;
std::stack<double> depthStack; ///< Stored depth values
VECTOR2I screenSize; ///< Screen size in screen coordinates
std::stack<double> m_depthStack; ///< Stored depth values
VECTOR2I m_screenSize; ///< Screen size in screen coordinates
double worldUnitLength; ///< The unit length of the world coordinates [inch]
double screenDPI; ///< The dots per inch of the screen
VECTOR2D lookAtPoint; ///< Point to be looked at in world space
double m_worldUnitLength; ///< The unit length of the world coordinates [inch]
double m_screenDPI; ///< The dots per inch of the screen
VECTOR2D m_lookAtPoint; ///< Point to be looked at in world space
double zoomFactor; ///< The zoom factor
double rotation; ///< Rotation transformation (radians)
MATRIX3x3D worldScreenMatrix; ///< World transformation
MATRIX3x3D screenWorldMatrix; ///< Screen transformation
double worldScale; ///< The scale factor world->screen
double m_zoomFactor; ///< The zoom factor
double m_rotation; ///< Rotation transformation (radians)
MATRIX3x3D m_worldScreenMatrix; ///< World transformation
MATRIX3x3D m_screenWorldMatrix; ///< Screen transformation
double m_worldScale; ///< The scale factor world->screen
bool globalFlipX; ///< Flag for X axis flipping
bool globalFlipY; ///< Flag for Y axis flipping
bool m_globalFlipX; ///< Flag for X axis flipping
bool m_globalFlipY; ///< Flag for Y axis flipping
float lineWidth; ///< The line width
float m_lineWidth; ///< The line width
bool isFillEnabled; ///< Is filling of graphic objects enabled ?
bool isStrokeEnabled; ///< Are the outlines stroked ?
bool m_isFillEnabled; ///< Is filling of graphic objects enabled ?
bool m_isStrokeEnabled; ///< Are the outlines stroked ?
COLOR4D fillColor; ///< The fill color
COLOR4D strokeColor; ///< The color of the outlines
COLOR4D m_clearColor;
COLOR4D m_fillColor; ///< The fill color
COLOR4D m_strokeColor; ///< The color of the outlines
COLOR4D m_clearColor;
double layerDepth; ///< The actual layer depth
VECTOR2D depthRange; ///< Range of the depth
double m_layerDepth; ///< The actual layer depth
VECTOR2D m_depthRange; ///< Range of the depth
// Grid settings
bool gridVisibility; ///< Should the grid be shown
GRID_STYLE gridStyle; ///< Grid display style
VECTOR2D gridSize; ///< The grid size
VECTOR2D gridOrigin; ///< The grid origin
VECTOR2D gridOffset; ///< The grid offset to compensate cursor position
COLOR4D gridColor; ///< Color of the grid
COLOR4D axesColor; ///< Color of the axes
bool axesEnabled; ///< Should the axes be drawn
int gridTick; ///< Every tick line gets the double width
float gridLineWidth; ///< Line width of the grid
int gridMinSpacing; ///< Minimum screen size of the grid (pixels)
bool m_gridVisibility; ///< Should the grid be shown
GRID_STYLE m_gridStyle; ///< Grid display style
VECTOR2D m_gridSize; ///< The grid size
VECTOR2D m_gridOrigin; ///< The grid origin
VECTOR2D m_gridOffset; ///< The grid offset to compensate cursor position
COLOR4D m_gridColor; ///< Color of the grid
COLOR4D m_axesColor; ///< Color of the axes
bool m_axesEnabled; ///< Should the axes be drawn
int m_gridTick; ///< Every tick line gets the double width
float m_gridLineWidth; ///< Line width of the grid
int m_gridMinSpacing; ///< Minimum screen size of the grid (pixels)
///< below which the grid is not drawn
// Cursor settings
bool isCursorEnabled; ///< Is the cursor enabled?
bool forceDisplayCursor; ///< Always show cursor
COLOR4D cursorColor; ///< Cursor color
bool fullscreenCursor; ///< Shape of the cursor (fullscreen or small cross)
VECTOR2D cursorPosition; ///< Current cursor position (world coordinates)
bool m_isCursorEnabled; ///< Is the cursor enabled?
bool m_forceDisplayCursor; ///< Always show cursor
COLOR4D m_cursorColor; ///< Cursor color
bool m_fullscreenCursor; ///< Shape of the cursor (fullscreen or small cross)
VECTOR2D m_cursorPosition; ///< Current cursor position (world coordinates)
/// Instance of object that stores information about how to draw texts
STROKE_FONT strokeFont;
STROKE_FONT m_strokeFont; ///< Instance of object that stores information
///< about how to draw texts
private:
struct TEXT_PROPERTIES

View File

@ -259,12 +259,12 @@ public:
void SetMouseListener( wxEvtHandler* aMouseListener )
{
mouseListener = aMouseListener;
m_mouseListener = aMouseListener;
}
void SetPaintListener( wxEvtHandler* aPaintListener )
{
paintListener = aPaintListener;
m_paintListener = aPaintListener;
}
void EnableDepthTest( bool aEnabled = false ) override;
@ -291,48 +291,53 @@ private:
static const int CIRCLE_POINTS = 64; ///< The number of points for circle approximation
static const int CURVE_POINTS = 32; ///< The number of points for curve approximation
static wxGLContext* glMainContext; ///< Parent OpenGL context
wxGLContext* glPrivContext; ///< Canvas-specific OpenGL context
static int instanceCounter; ///< GL GAL instance counter
wxEvtHandler* mouseListener;
wxEvtHandler* paintListener;
static wxGLContext* m_glMainContext; ///< Parent OpenGL context
wxGLContext* m_glPrivContext; ///< Canvas-specific OpenGL context
static int m_instanceCounter; ///< GL GAL instance counter
wxEvtHandler* m_mouseListener;
wxEvtHandler* m_paintListener;
static GLuint fontTexture; ///< Bitmap font texture handle (shared)
static GLuint g_fontTexture; ///< Bitmap font texture handle (shared)
// Vertex buffer objects related fields
typedef std::unordered_map< unsigned int, std::shared_ptr<VERTEX_ITEM> > GROUPS_MAP;
GROUPS_MAP groups; ///< Stores information about VBO objects (groups)
unsigned int groupCounter; ///< Counter used for generating keys for groups
VERTEX_MANAGER* currentManager; ///< Currently used VERTEX_MANAGER (for storing
GROUPS_MAP m_groups; ///< Stores information about VBO objects (groups)
unsigned int m_groupCounter; ///< Counter used for generating keys for groups
VERTEX_MANAGER* m_currentManager; ///< Currently used VERTEX_MANAGER (for storing
///< VERTEX_ITEMs).
VERTEX_MANAGER* cachedManager; ///< Container for storing cached VERTEX_ITEMs
VERTEX_MANAGER* nonCachedManager; ///< Container for storing non-cached VERTEX_ITEMs
VERTEX_MANAGER* overlayManager; ///< Container for storing overlaid VERTEX_ITEMs
VERTEX_MANAGER* m_cachedManager; ///< Container for storing cached VERTEX_ITEMs
VERTEX_MANAGER* m_nonCachedManager; ///< Container for storing non-cached VERTEX_ITEMs
VERTEX_MANAGER* m_overlayManager; ///< Container for storing overlaid VERTEX_ITEMs
// Framebuffer & compositing
OPENGL_COMPOSITOR* compositor; ///< Handles multiple rendering targets
unsigned int mainBuffer; ///< Main rendering target
unsigned int overlayBuffer; ///< Auxiliary rendering target (for menus etc.)
RENDER_TARGET currentTarget; ///< Current rendering target
OPENGL_COMPOSITOR* m_compositor; ///< Handles multiple rendering targets
unsigned int m_mainBuffer; ///< Main rendering target
unsigned int m_overlayBuffer; ///< Auxiliary rendering target (for menus etc.)
RENDER_TARGET m_currentTarget; ///< Current rendering target
// Shader
SHADER* shader; ///< There is only one shader used for different
SHADER* m_shader; ///< There is only one shader used for different
///< objects.
// Internal flags
bool isFramebufferInitialized; ///< Are the framebuffers initialized?
static bool isBitmapFontLoaded; ///< Is the bitmap font texture loaded?
bool isBitmapFontInitialized; ///< Is the shader set to use bitmap fonts?
bool isInitialized; ///< Basic initialization flag, has to be done
///< when the window is visible
bool isGrouping; ///< Was a group started?
bool m_isContextLocked; ///< Used for assertion checking
int lockClientCookie;
bool m_isFramebufferInitialized; ///< Are the framebuffers initialized?
static bool m_isBitmapFontLoaded; ///< Is the bitmap font texture loaded?
bool m_isBitmapFontInitialized; ///< Is the shader set to use bitmap fonts?
bool m_isInitialized; ///< Basic initialization flag, has to be
///< done when the window is visible
bool m_isGrouping; ///< Was a group started?
bool m_isContextLocked; ///< Used for assertion checking
int m_lockClientCookie;
GLint ufm_worldPixelSize;
GLint ufm_screenPixelSize;
GLint ufm_pixelSizeMultiplier;
std::unique_ptr<GL_BITMAP_CACHE> bitmapCache;
std::unique_ptr<GL_BITMAP_CACHE> m_bitmapCache;
// Polygon tesselation
GLUtesselator* m_tesselator;
std::deque< boost::shared_array<GLdouble> > m_tessIntersects;
void lockContext( int aClientCookie ) override;
@ -353,12 +358,6 @@ private:
///< Update handler for OpenGL settings
bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions ) override;
// Polygon tesselation
/// The tessellator
GLUtesselator* tesselator;
/// Storage for intersecting points
std::deque< boost::shared_array<GLdouble> > tessIntersects;
/**
* @brief Draw a quad for the line.
*
@ -370,7 +369,7 @@ private:
/**
* Draw a semicircle.
*
* Depending on settings (isStrokeEnabled & isFilledEnabled) it runs the proper function
* Depending on settings (m_isStrokeEnabled & isFilledEnabled) it runs the proper function
* (drawStrokedSemiCircle or drawFilledSemiCircle).
*
* @param aCenterPoint is the center point.

View File

@ -24,16 +24,16 @@ void screenSpaceLine( KIGFX::GAL* gal, const VECTOR2D& p0, const VECTOR2D& p1, d
#if 0
//shader->Deactivate();
currentManager->Reserve( 6 );
currentManager->Shader( SHADER_NONE );
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
m_currentManager->Reserve( 6 );
m_currentManager->Shader( SHADER_NONE );
m_currentManager->Color( m_strokeColor.r, m_strokeColor.g, m_strokeColor.b, m_strokeColor.a );
currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pa.x, pa.y, layerDepth );
currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pb.x, pb.y, layerDepth );
currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pc.x, pc.y, layerDepth );
currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pa.x, pa.y, layerDepth );
currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pc.x, pc.y, layerDepth );
currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pd.x, pd.y, layerDepth );
m_currentManager->Shader( SHADER_NONE ); m_currentManager->Vertex( pa.x, pa.y, m_layerDepth );
m_currentManager->Shader( SHADER_NONE ); m_currentManager->Vertex( pb.x, pb.y, m_layerDepth );
m_currentManager->Shader( SHADER_NONE ); m_currentManager->Vertex( pc.x, pc.y, m_layerDepth );
m_currentManager->Shader( SHADER_NONE ); m_currentManager->Vertex( pa.x, pa.y, m_layerDepth );
m_currentManager->Shader( SHADER_NONE ); m_currentManager->Vertex( pc.x, pc.y, m_layerDepth );
m_currentManager->Shader( SHADER_NONE ); m_currentManager->Vertex( pd.x, pd.y, m_layerDepth );
shader->Use();
#endif