void CWBProcess::OnMouseLButtonUp( MouseFlag flag, PtPos& point ) { if (m_bLeftDown && GetInterfacePtr()) { switch (m_CurIdent) { case ID_WB_POS: GetInterfacePtr()->EdtDrawArea(m_MouseIni, point); break; case ID_WB_PTR: _DrawIndicator(point); break; case ID_WB_IMG: _DrawImage(m_CtrlAttr.ctImage.idName, point, point); // Para selecionar o controle POS apos desenhar a imagem GetInterfacePtr()->ToolBoxItemSel(ID_WB_POS); break; case ID_WB_TXT: m_CtrlAttr.Clear(); m_CtrlAttr.ctName = WB_TXT; m_bCtrlTxt = true; GetInterfacePtr()->CtlEditTxt(m_MouseIni, point, m_CurFont, m_CurColor); break; case ID_WB_LIN: _DrawLine(m_MouseIni, point, m_CurLine, m_CurColor); break; case ID_WB_SQR: _DrawRect(m_MouseIni, point, m_CurLine, m_CurColor, false); break; case ID_WB_SQF: _DrawRect(m_MouseIni, point, m_CurLine, m_CurColor, true); break; case ID_WB_CRC: _DrawEllipse(m_MouseIni, point, m_CurLine, m_CurColor, false); break; case ID_WB_CRF: _DrawEllipse(m_MouseIni, point, m_CurLine, m_CurColor, true); break; case ID_WB_DEL: _DrawPoint(NULL, m_CurLine, m_DelColor, false); break; case ID_WB_PEN: _DrawPoint(NULL, m_CurLine, m_CurColor, false); break; case ID_WB_MRK: _DrawPoint(NULL, m_CurLine, m_MrkColor, true); break; } m_MousePos.SetAttr(point.X, point.Y); } m_bLeftDown = false; }
/** * @brief Callback function of the image frame * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbImageWindow(WM_MESSAGE * pMsg) { WM_HWIN hItem; GUI_RECT r; int Id; const GUI_PID_STATE * pState; switch (pMsg->MsgId) { case WM_TOUCH: pState = (const GUI_PID_STATE *)pMsg->Data.p; if(pImageList->ptr > 0) { if (pState) { if (pState->Pressed == 1) { IMAGE_Enlarge ^= 1; if (IMAGE_Enlarge) { WM_AttachWindowAt(pMsg->hWin, WM_HBKWIN, 0, 0); WM_SetSize(pMsg->hWin, LCD_GetXSize(), LCD_GetYSize()); } else { WM_AttachWindowAt(pMsg->hWin, IMAGE_hWin, 6, 6); WM_SetSize(pMsg->hWin, 220, 134); } WM_InvalidateWindow(pMsg->hWin); } } } break; case WM_PAINT: WM_GetInsideRect(&r); GUI_ClearRectEx(&r); if (pImageList->ptr > 0) { if(_DrawImage(&Image_File, IMAGE_Enlarge, IMAGE_Type) > 0) { f_close(&Image_File); GUI_ClearRectEx(&r); GUI_DispStringAt("Error : Image cannot be displayed", 20, 80); if(hTimerTime != 0) { slideshow_state = OFF; hItem = WM_GetDialogItem(IMAGE_hWin, ID_SLIDE_BUTTON); WM_InvalidateWindow(hItem); WM_Update(hItem); WM_DeleteTimer(hTimerTime); hTimerTime = 0; } } } break; case WM_TIMER: Id = WM_GetTimerId(pMsg->Data.v); if(Id == ID_SLIDER_TIMER) { if(pImageList->ptr > 1) { if (file_pos < (pImageList->ptr - 1)) { file_pos++; } else if (file_pos == (pImageList->ptr - 1)) { file_pos=0; } if((strstr((char *)pImageList->file[file_pos].name, ".bmp")) || (strstr((char *)pImageList->file[file_pos].name, ".BMP"))) { IMAGE_Type = IMAGE_TYPE_BMP; } else if((strstr((char *)pImageList->file[file_pos].name, ".jpg")) || (strstr((char *)pImageList->file[file_pos].name, ".JPG"))) { IMAGE_Type = IMAGE_TYPE_JPG; } f_close(&Image_File); f_open(&Image_File, (char const *)pImageList->file[file_pos].name, FA_OPEN_EXISTING | FA_READ); WM_InvalidateWindow(imFrame); hItem = WM_GetDialogItem(IMAGE_hWin, ID_IMAGE_LIST); LISTBOX_SetSel(hItem, file_pos); } WM_RestartTimer(pMsg->Data.v, (ImSettings.b.ss_timer * 1000)); } else if (Id == ID_PLAYLIST_TIMER) { playlist_select = 0; } break; case WM_DELETE: if(hTimerTime != 0) { WM_DeleteTimer(hTimerTime); hTimerTime = 0; } break; default: WM_DefaultProc(pMsg); } }
void _DrawImage(IMAGEINFO *pDest, IMAGEINFO *pSrc, int xdest, int ydest, float alpha) { float oldAlpha = _GetGlobalAlpha(); _SetGlobalAlpha(alpha); _DrawImage(pDest, pSrc, xdest, ydest); _SetGlobalAlpha(oldAlpha); }
void _DrawImageCentered(IMAGEINFO *pDest, IMAGEINFO *pSrc, int xoffset, int yoffset) { _DrawImage(pDest, pSrc, (pDest->_nWidth/2)-(pSrc->_nWidth/2)+xoffset, (pDest->_nHeight/2)-(pSrc->_nHeight/2)+yoffset); }