Audacity  3.0.3
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 66 of file Theme.h.

Constructor & Destructor Documentation

◆ FlowPacker()

FlowPacker::FlowPacker ( int  width)
explicit

Definition at line 442 of file Theme.cpp.

443  : mxCacheWidth{ width }
444 {
445  SetNewGroup(1);
446 }

◆ ~FlowPacker()

FlowPacker::~FlowPacker ( )
inline

Definition at line 70 of file Theme.h.

70 {}

Member Function Documentation

◆ GetNextPosition()

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

Definition at line 469 of file Theme.cpp.

470 {
471  xSize += 2*mBorderWidth;
472  ySize += 2*mBorderWidth;
473  // if the height has increased, then we are on a NEW group.
474  if(( ySize > myHeight )||(((mFlags ^ mOldFlags )& ~resFlagSkip)!=0))
475  {
476  SetNewGroup( ((mFlags & resFlagPaired)!=0) ? 2 : 1 );
477  myHeight = ySize;
478 // mFlags &= ~resFlagNewLine;
479 // mOldFlags = mFlags;
480  }
481 
484  {
485  iImageGroupIndex = 0;
487  }
488 
489  if(mxPos > (mxCacheWidth - xSize ))
490  {
493  myHeight = ySize;
494  }
496 
497  mComponentWidth = xSize;
498  mComponentHeight = ySize;
499 }

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

502 {
503  return wxRect( mxPos, myPos, mComponentWidth, mComponentHeight);
504 }

References mComponentHeight, mComponentWidth, mxPos, and myPos.

Referenced by RectInner().

Here is the caller graph for this function:

◆ RectInner()

wxRect FlowPacker::RectInner ( )

Definition at line 506 of file Theme.cpp.

507 {
508  return Rect().Deflate( mBorderWidth, mBorderWidth );
509 }

References mBorderWidth, and Rect().

Here is the call graph for this function:

◆ RectMid()

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

Definition at line 511 of file Theme.cpp.

512 {
513  x = mxPos + mComponentWidth/2;
514  y = myPos + mComponentHeight/2;
515 }

References mComponentHeight, mComponentWidth, mxPos, and myPos.

◆ SetColourGroup()

void FlowPacker::SetColourGroup ( )

Definition at line 458 of file Theme.cpp.

459 {
460  myPosBase = 750;
461  mxPos =0;
462  mOldFlags = mFlags;
463  iImageGroupSize = 1;
464  iImageGroupIndex = -1;
465  mComponentWidth=0;
466  myHeight = 11;
467 }

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

◆ SetNewGroup()

void FlowPacker::SetNewGroup ( int  iGroupSize)

Definition at line 448 of file Theme.cpp.

449 {
451  mxPos =0;
452  mOldFlags = mFlags;
453  iImageGroupSize = iGroupSize;
454  iImageGroupIndex = -1;
455  mComponentWidth=0;
456 }

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

Referenced by GetNextPosition().

Here is the caller graph for this function:

Member Data Documentation

◆ iImageGroupIndex

int FlowPacker::iImageGroupIndex = -1
private

Definition at line 87 of file Theme.h.

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

◆ iImageGroupSize

int FlowPacker::iImageGroupSize = 1
private

Definition at line 86 of file Theme.h.

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

◆ mBorderWidth

int FlowPacker::mBorderWidth = 1

Definition at line 83 of file Theme.h.

Referenced by GetNextPosition(), and RectInner().

◆ mComponentHeight

int FlowPacker::mComponentHeight = 0
private

Definition at line 93 of file Theme.h.

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

◆ mComponentWidth

int FlowPacker::mComponentWidth = 0
private

Definition at line 92 of file Theme.h.

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

◆ mFlags

int FlowPacker::mFlags = resFlagPaired

Definition at line 79 of file Theme.h.

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

◆ mOldFlags

int FlowPacker::mOldFlags = resFlagPaired
private

Definition at line 88 of file Theme.h.

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

◆ mxCacheWidth

int FlowPacker::mxCacheWidth = 0
private

Definition at line 90 of file Theme.h.

Referenced by GetNextPosition().

◆ mxPos

int FlowPacker::mxPos = 0

Definition at line 80 of file Theme.h.

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

◆ myHeight

int FlowPacker::myHeight = 0

Definition at line 82 of file Theme.h.

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

◆ myPos

int FlowPacker::myPos = 0

Definition at line 81 of file Theme.h.

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

◆ myPosBase

int FlowPacker::myPosBase = 0
private

Definition at line 89 of file Theme.h.

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


The documentation for this class was generated from the following files:
FlowPacker::mxCacheWidth
int mxCacheWidth
Definition: Theme.h:90
FlowPacker::mxPos
int mxPos
Definition: Theme.h:80
FlowPacker::iImageGroupIndex
int iImageGroupIndex
Definition: Theme.h:87
FlowPacker::mComponentWidth
int mComponentWidth
Definition: Theme.h:92
resFlagPaired
@ resFlagPaired
Definition: Theme.h:58
resFlagSkip
@ resFlagSkip
Definition: Theme.h:62
FlowPacker::mBorderWidth
int mBorderWidth
Definition: Theme.h:83
FlowPacker::iImageGroupSize
int iImageGroupSize
Definition: Theme.h:86
FlowPacker::mFlags
int mFlags
Definition: Theme.h:79
FlowPacker::mOldFlags
int mOldFlags
Definition: Theme.h:88
FlowPacker::myHeight
int myHeight
Definition: Theme.h:82
FlowPacker::myPosBase
int myPosBase
Definition: Theme.h:89
FlowPacker::myPos
int myPos
Definition: Theme.h:81
FlowPacker::mComponentHeight
int mComponentHeight
Definition: Theme.h:93
FlowPacker::SetNewGroup
void SetNewGroup(int iGroupSize)
Definition: Theme.cpp:448
FlowPacker::Rect
wxRect Rect()
Definition: Theme.cpp:501