Audacity 3.2.0
Public Member Functions | Public Attributes | Private Attributes | List of all members
FlowPacker Class Reference

A cursor for iterating the theme bitmap. More...

#include <Theme.h>

Public Member Functions

 FlowPacker (int width)
 
 ~FlowPacker ()
 
void GetNextPosition (int xSize, int ySize)
 
void SetNewGroup (int iGroupSize)
 
void SetColourGroup ()
 
wxRect Rect ()
 
wxRect RectInner ()
 
void RectMid (int &x, int &y)
 

Public Attributes

int mFlags = resFlagPaired
 
int mxPos = 0
 
int myPos = 0
 
int myHeight = 0
 
int mBorderWidth = 1
 

Private Attributes

int iImageGroupSize = 1
 
int iImageGroupIndex = -1
 
int mOldFlags = resFlagPaired
 
int myPosBase = 0
 
int mxCacheWidth = 0
 
int mComponentWidth = 0
 
int mComponentHeight = 0
 

Detailed Description

A cursor for iterating the theme bitmap.

Packs rectangular boxes into a rectangle, using simple first fit.

This class is currently used by Theme to pack its images into the image cache. Perhaps someday we will improve FlowPacker and make it more flexible, and use it for toolbar and window layouts too.

Definition at line 69 of file Theme.h.

Constructor & Destructor Documentation

◆ FlowPacker()

FlowPacker::FlowPacker ( int  width)
explicit

Definition at line 411 of file Theme.cpp.

412 : mxCacheWidth{ width }
413{
414 SetNewGroup(1);
415}
void SetNewGroup(int iGroupSize)
Definition: Theme.cpp:417
int mxCacheWidth
Definition: Theme.h:93

References SetNewGroup().

Here is the call graph for this function:

◆ ~FlowPacker()

FlowPacker::~FlowPacker ( )
inline

Definition at line 73 of file Theme.h.

73{}

Member Function Documentation

◆ GetNextPosition()

void FlowPacker::GetNextPosition ( int  xSize,
int  ySize 
)

Definition at line 438 of file Theme.cpp.

439{
440 xSize += 2*mBorderWidth;
441 ySize += 2*mBorderWidth;
442 // if the height has increased, then we are on a NEW group.
443 if(( ySize > myHeight )||(((mFlags ^ mOldFlags )& ~resFlagSkip)!=0))
444 {
445 SetNewGroup( ((mFlags & resFlagPaired)!=0) ? 2 : 1 );
446 myHeight = ySize;
447// mFlags &= ~resFlagNewLine;
448// mOldFlags = mFlags;
449 }
450
453 {
456 }
457
458 if(mxPos > (mxCacheWidth - xSize ))
459 {
462 myHeight = ySize;
463 }
465
466 mComponentWidth = xSize;
467 mComponentHeight = ySize;
468}
@ resFlagSkip
Definition: Theme.h:65
@ resFlagPaired
Definition: Theme.h:61
int myHeight
Definition: Theme.h:85
int myPosBase
Definition: Theme.h:92
int iImageGroupIndex
Definition: Theme.h:90
int mComponentHeight
Definition: Theme.h:96
int mFlags
Definition: Theme.h:82
int mBorderWidth
Definition: Theme.h:86
int iImageGroupSize
Definition: Theme.h:89
int mComponentWidth
Definition: Theme.h:95
int mxPos
Definition: Theme.h:83
int mOldFlags
Definition: Theme.h:91
int myPos
Definition: Theme.h:84

References iImageGroupIndex, iImageGroupSize, mBorderWidth, mComponentHeight, mComponentWidth, mFlags, mOldFlags, mxCacheWidth, mxPos, myHeight, myPos, myPosBase, resFlagPaired, resFlagSkip, and SetNewGroup().

Here is the call graph for this function:

◆ Rect()

wxRect FlowPacker::Rect ( )

Definition at line 470 of file Theme.cpp.

471{
472 return wxRect( mxPos, myPos, mComponentWidth, mComponentHeight);
473}

References mComponentHeight, mComponentWidth, mxPos, and myPos.

Referenced by RectInner().

Here is the caller graph for this function:

◆ RectInner()

wxRect FlowPacker::RectInner ( )

Definition at line 475 of file Theme.cpp.

476{
477 return Rect().Deflate( mBorderWidth, mBorderWidth );
478}
wxRect Rect()
Definition: Theme.cpp:470

References mBorderWidth, and Rect().

Here is the call graph for this function:

◆ RectMid()

void FlowPacker::RectMid ( int &  x,
int &  y 
)

Definition at line 480 of file Theme.cpp.

481{
482 x = mxPos + mComponentWidth/2;
483 y = myPos + mComponentHeight/2;
484}

References mComponentHeight, mComponentWidth, mxPos, and myPos.

◆ SetColourGroup()

void FlowPacker::SetColourGroup ( )

Definition at line 427 of file Theme.cpp.

428{
429 myPosBase = 750;
430 mxPos =0;
432 iImageGroupSize = 1;
433 iImageGroupIndex = -1;
435 myHeight = 11;
436}

References iImageGroupIndex, iImageGroupSize, mComponentWidth, mFlags, mOldFlags, mxPos, myHeight, and myPosBase.

◆ SetNewGroup()

void FlowPacker::SetNewGroup ( int  iGroupSize)

Definition at line 417 of file Theme.cpp.

418{
420 mxPos =0;
422 iImageGroupSize = iGroupSize;
423 iImageGroupIndex = -1;
425}

References iImageGroupIndex, iImageGroupSize, mComponentWidth, mFlags, mOldFlags, mxPos, myHeight, and myPosBase.

Referenced by FlowPacker(), and GetNextPosition().

Here is the caller graph for this function:

Member Data Documentation

◆ iImageGroupIndex

int FlowPacker::iImageGroupIndex = -1
private

Definition at line 90 of file Theme.h.

Referenced by GetNextPosition(), SetColourGroup(), and SetNewGroup().

◆ iImageGroupSize

int FlowPacker::iImageGroupSize = 1
private

Definition at line 89 of file Theme.h.

Referenced by GetNextPosition(), SetColourGroup(), and SetNewGroup().

◆ mBorderWidth

int FlowPacker::mBorderWidth = 1

Definition at line 86 of file Theme.h.

Referenced by GetNextPosition(), and RectInner().

◆ mComponentHeight

int FlowPacker::mComponentHeight = 0
private

Definition at line 96 of file Theme.h.

Referenced by GetNextPosition(), Rect(), and RectMid().

◆ mComponentWidth

int FlowPacker::mComponentWidth = 0
private

Definition at line 95 of file Theme.h.

Referenced by GetNextPosition(), Rect(), RectMid(), SetColourGroup(), and SetNewGroup().

◆ mFlags

int FlowPacker::mFlags = resFlagPaired

Definition at line 82 of file Theme.h.

Referenced by GetNextPosition(), SetColourGroup(), and SetNewGroup().

◆ mOldFlags

int FlowPacker::mOldFlags = resFlagPaired
private

Definition at line 91 of file Theme.h.

Referenced by GetNextPosition(), SetColourGroup(), and SetNewGroup().

◆ mxCacheWidth

int FlowPacker::mxCacheWidth = 0
private

Definition at line 93 of file Theme.h.

Referenced by GetNextPosition().

◆ mxPos

int FlowPacker::mxPos = 0

Definition at line 83 of file Theme.h.

Referenced by GetNextPosition(), Rect(), RectMid(), SetColourGroup(), and SetNewGroup().

◆ myHeight

int FlowPacker::myHeight = 0

Definition at line 85 of file Theme.h.

Referenced by GetNextPosition(), SetColourGroup(), and SetNewGroup().

◆ myPos

int FlowPacker::myPos = 0

Definition at line 84 of file Theme.h.

Referenced by GetNextPosition(), Rect(), and RectMid().

◆ myPosBase

int FlowPacker::myPosBase = 0
private

Definition at line 92 of file Theme.h.

Referenced by GetNextPosition(), SetColourGroup(), and SetNewGroup().


The documentation for this class was generated from the following files: