780
781
void MyFrame::OnAnimationTick(wxTimerEvent & event) {
782
bool changeIcons[ImagesList->GetCount()];
783
fill_n(changeIcons, ImagesList->GetCount(), false);
784
for (unsigned int i = 0; i < ImagesList->GetCount(); i++) {
785
simImage *img = (*ImagesList)[i];
786
if (img->animationStatus == STATUS_NONE) {
789
if (img != hoveringIcon && img->animationStatus == STATUS_INCREASING) {
790
img->animationStatus = STATUS_DECREASING;
792
if (img->animationStatus == STATUS_DECREASING) {
793
if (img->animationCounter < 30) {
794
img->animationCounter += 5;
795
RefreshSizes(img, img->animationCounter);
797
changeIcons[i] = true;
799
img->animationStatus = STATUS_NONE;
801
} else if (img->animationStatus == STATUS_INCREASING && img->animationCounter > 0) {
802
img->animationCounter -= 5;
803
RefreshSizes(img, img->animationCounter);
805
changeIcons[i] = true;
782
cout << "animationTick \n";
783
if (approachFutures()) {
809
784
animation->Stop();
812
fill_n(changeIcons, ImagesList->GetCount(), true);
814
PositionIcons (GetClientSize (), settings, ImagesList, changeIcons);
823
* Changes simImage y (Not X) position and Width, Height according to the
824
* mouse distance. Return TRUE if size was changed, false otherwise
789
// set icons width and position to the value they shall have in the future, after the animation
827
MyFrame::RefreshSizes (simImage * img, int distance)
829
int newW = settings.ICONW;
830
int newH = settings.ICONH;
834
newW = settings.MAXSIZE;
835
newH = settings.MAXSIZE;
839
if (distance < settings.RANGE)
843
* int diff = distance * ICONW / RANGE; //(RANGE - MINIMUM);
844
* newW = MAXSIZE - diff;
846
newW = (int) zoom (settings.RANGE, distance, settings.MAXSIZE);
848
if (newW < settings.ICONW)
849
newW = settings.ICONW;
856
img->y = GetClientSize ().GetHeight () - newH - settings.BOTTOM_BORDER;
791
MyFrame::setFutures() {
793
unsigned int imgCount = ImagesList->GetCount();
794
int availableSpace = settings.LEFT_BORDER +
795
imgCount * (settings.ICONW + settings.SPACER) +
796
settings.RIGHT_BORDER - settings.SPACER;
798
for (unsigned int i = 0; i < imgCount; i++) {
799
simImage *img = (*ImagesList)[i];
800
if (img == hoveringIcon) {
801
img->future_w = zoom(settings.RANGE, 0, settings.MAXSIZE);
803
img->future_w = settings.ICONW;
805
img->future_h = img->future_w;
806
neededSpace += img->future_w + settings.SPACER;
808
neededSpace -= settings.SPACER;
809
double borderRatio = (double)settings.LEFT_BORDER / (settings.LEFT_BORDER + settings.RIGHT_BORDER);
810
int positionX = (availableSpace - neededSpace) * borderRatio;
812
for (unsigned int i = 0; i < imgCount; i++) {
813
simImage *img = (*ImagesList)[i];
814
img->future_x = positionX;
815
positionX += img->future_w + settings.SPACER;
820
// set icons width and position closer to their future position
821
// return true if everything was changed
823
MyFrame::approachFutures() {
824
unsigned int imgCount = ImagesList->GetCount();
827
for (unsigned int i = 0; i < imgCount; i++) {
828
simImage *img = (*ImagesList)[i];
829
if (img->w > img->future_w) {
830
img->w -= zoomChange;
832
if (img->h > img->future_h) {
833
img->y += zoomChange;
836
} else if (img->w < img->future_w) {
837
img->w += zoomChange;
839
if (img->h < img->future_h) {
840
img->y -= zoomChange;
844
if (img->x > img->future_x) {
845
img->x -= zoomChange;
847
} else if (img->x < img->future_x) {
848
img->x += zoomChange;