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 469 of file Theme.cpp.

470 : mxCacheWidth{ width }
471{
472 SetNewGroup(1);
473}
void SetNewGroup(int iGroupSize)
Definition: Theme.cpp:475
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 496 of file Theme.cpp.

497{
498 xSize += 2*mBorderWidth;
499 ySize += 2*mBorderWidth;
500 // if the height has increased, then we are on a NEW group.
501 if(( ySize > myHeight )||(((mFlags ^ mOldFlags )& ~resFlagSkip)!=0))
502 {
503 SetNewGroup( ((mFlags & resFlagPaired)!=0) ? 2 : 1 );
504 myHeight = ySize;
505// mFlags &= ~resFlagNewLine;
506// mOldFlags = mFlags;
507 }
508
511 {
514 }
515
516 if(mxPos > (mxCacheWidth - xSize ))
517 {
520 myHeight = ySize;
521 }
523
524 mComponentWidth = xSize;
525 mComponentHeight = ySize;
526}
@ 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 528 of file Theme.cpp.

529{
530 return wxRect( mxPos, myPos, mComponentWidth, mComponentHeight);
531}

References mComponentHeight, mComponentWidth, mxPos, and myPos.

Referenced by RectInner().

Here is the caller graph for this function:

◆ RectInner()

wxRect FlowPacker::RectInner ( )

Definition at line 533 of file Theme.cpp.

534{
535 return Rect().Deflate( mBorderWidth, mBorderWidth );
536}
wxRect Rect()
Definition: Theme.cpp:528

References mBorderWidth, and Rect().

Here is the call graph for this function:

◆ RectMid()

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

Definition at line 538 of file Theme.cpp.

539{
540 x = mxPos + mComponentWidth/2;
541 y = myPos + mComponentHeight/2;
542}

References mComponentHeight, mComponentWidth, mxPos, and myPos.

◆ SetColourGroup()

void FlowPacker::SetColourGroup ( )

Definition at line 485 of file Theme.cpp.

486{
487 myPosBase = 750;
488 mxPos =0;
490 iImageGroupSize = 1;
491 iImageGroupIndex = -1;
493 myHeight = 11;
494}

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

◆ SetNewGroup()

void FlowPacker::SetNewGroup ( int  iGroupSize)

Definition at line 475 of file Theme.cpp.

476{
478 mxPos =0;
480 iImageGroupSize = iGroupSize;
481 iImageGroupIndex = -1;
483}

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: