From a33833212f040272fc6c97047c8cb335b6f5405a Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Tue, 24 Jul 2012 06:41:19 +0000 Subject: SimpleAR, SimpleStatusMsg, SmileyAdd, SpellChecker: changed folder structure git-svn-id: http://svn.miranda-ng.org/main/trunk@1149 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SmileyAdd/anim.cpp | 184 --------------------------------------------- 1 file changed, 184 deletions(-) delete mode 100644 plugins/SmileyAdd/anim.cpp (limited to 'plugins/SmileyAdd/anim.cpp') diff --git a/plugins/SmileyAdd/anim.cpp b/plugins/SmileyAdd/anim.cpp deleted file mode 100644 index 5352383821..0000000000 --- a/plugins/SmileyAdd/anim.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* -Miranda SmileyAdd Plugin -Copyright (C) 2006 - 2011 Boris Krasnovskiy All Rights Reserved - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "general.h" -#include "anim.h" - -#include - -Animate::Animate(SmileyType *sml, RECT& rect, HDC hdcMem, HBRUSH hbr, bool clip) - : m_sml(sml), m_img(NULL), - m_nFramePosition(0), m_sel(false), m_clip(clip), - m_offset(0), m_running(false), - m_hdcMem(hdcMem), m_hbr(hbr) -{ - m_cliprect = rect; -} - - -Animate::~Animate() -{ - if (m_img) m_img->Release(); -} - - -void Animate::StartAnimation(void) -{ - m_img = m_sml->CreateCachedImage(); - - if (m_img && m_img->IsAnimated()) - { - m_img->SelectFrame(m_nFramePosition); - long frtm = m_img->GetFrameDelay(); - m_counter = frtm / 10 + ((frtm % 10) >= 5); - } -} - - -void Animate::ProcessTimerTick(HWND hwnd) -{ - if (m_running && m_img->IsAnimated() && --m_counter <= 0) - { - m_nFramePosition = m_img->SelectNextFrame(m_nFramePosition); - - long frtm = m_img->GetFrameDelay(); - m_counter = frtm / 10 + ((frtm % 10) >= 5); - - HDC hdc = GetDC(hwnd); - DrawFrame(hdc); - ReleaseDC(hwnd, hdc); - } -} - - -void Animate::DrawFrame(HDC hdc) -{ - long width = m_cliprect.right - m_cliprect.left; - long height = m_cliprect.bottom - m_cliprect.top; - - RECT frc = { 0, 0, width, height }; - FillRect(m_hdcMem, &frc, m_hbr); - - m_img->Draw(m_hdcMem, frc, m_clip); - - BitBlt(hdc, m_cliprect.left, m_cliprect.top, width, height, m_hdcMem, 0, 0, SRCCOPY); - - if (m_sel) - DrawFocusRect(hdc, &m_cliprect); -} - - -void Animate::Draw(HDC hdc) -{ - if (m_running) - { - m_img->Draw(hdc, m_cliprect, m_clip); - - if (m_sel) - DrawFocusRect(hdc, &m_cliprect); - } -} - - -void Animate::SetOffset(int off, int wsize) -{ - const int dy = m_offset - off; - - m_cliprect.top += dy; - m_cliprect.bottom += dy; - - m_offset = off; - - m_running = m_cliprect.top >= 0 && m_cliprect.top < wsize; - if (m_running) - { - if (m_img == NULL) - { - StartAnimation(); - if (m_img == NULL) m_running = false; - } - } - else - { - if (m_img) m_img->Release(); - m_img = NULL; - } -} - - -void Animate::SetSel(int x, int y) -{ - m_sel = x >= m_cliprect.left && x < m_cliprect.right && - y >= m_cliprect.top && y < m_cliprect.bottom; -} - - -AnimatedPack::AnimatedPack(HWND hwnd, int wsize, SIZE& sel, COLORREF bkg) - : m_AniList(40), m_hwnd(hwnd), m_wsize(wsize) -{ - HDC hdc = GetDC(hwnd); - - m_hBmp = CreateCompatibleBitmap(hdc, sel.cx, sel.cy); - m_hdcMem = CreateCompatibleDC(hdc); - m_hOld = (HBITMAP)SelectObject(m_hdcMem, m_hBmp); - m_hbr = CreateSolidBrush(bkg); - - ReleaseDC(hwnd, hdc); -} - - -AnimatedPack::~AnimatedPack() -{ - DeleteObject(m_hbr); - SelectObject(m_hdcMem, m_hOld); - DeleteObject(m_hBmp); - DeleteDC(m_hdcMem); -} - - -void AnimatedPack::Add(SmileyType *sml, RECT rect, bool clip) -{ - m_AniList.insert(new Animate(sml, rect, m_hdcMem, m_hbr, clip)); -} - - -void AnimatedPack::Draw(HDC hdc) -{ - for (int i=0; i