// static pascal void IGraphicsCarbon::TimerHandler(EventLoopTimerRef pTimer, void* pGraphicsCarbon) { IGraphicsCarbon* _this = (IGraphicsCarbon*) pGraphicsCarbon; IRECT r; if (_this->mGraphicsMac->IsDirty(&r)) { if (_this->mIsComposited) { CGRect tmp = CGRectMake(r.L, r.T, r.W(), r.H()); HIViewSetNeedsDisplayInRect(_this->mView, &tmp , true); // invalidate everything that is set dirty #if USE_MTLE if (_this->mTextEntryView) // validate the text entry rect, otherwise, flicker { tmp = CGRectMake(_this->mTextEntryRect.L, _this->mTextEntryRect.T, _this->mTextEntryRect.W() + 1, _this->mTextEntryRect.H() + 1); HIViewSetNeedsDisplayInRect(_this->mView, &tmp , false); } #endif } else { // int h = _this->mGraphicsMac->Height(); // SetRectRgn(_this->mRgn, r.L, h - r.B, r.R, h - r.T); // UpdateControls(_this->mWindow, _this->mRgn); UpdateControls(_this->mWindow, 0); } } }
void IGraphicsWin::PromptUserInput(IEditableTextControl* pControl) { if (!pControl || mParamEditWnd) return; IRECT* pR = pControl->GetRECT(); const IText* txt = pControl->GetIText(); DWORD editStyle; switch (txt->mAlign) { case IText::kAlignNear: editStyle = ES_LEFT; break; case IText::kAlignFar: editStyle = ES_RIGHT; break; case IText::kAlignCenter: default: editStyle = ES_CENTER; break; } if (!pControl->IsEditable()) editStyle |= ES_READONLY; if (pControl->IsSecure()) editStyle |= ES_PASSWORD; else editStyle |= ES_MULTILINE; mParamEditWnd = CreateWindow("EDIT", pControl->GetText(), WS_CHILD | WS_VISIBLE | editStyle, pR->L, pR->T, pR->W(), pR->H(), mPlugWnd, (HMENU) PARAM_EDIT_ID, mHInstance, 0); SendMessage(mParamEditWnd, EM_SETSEL, 0, -1); SetFocus(mParamEditWnd); mDefEditProc = (WNDPROC) SetWindowLongPtr(mParamEditWnd, GWLP_WNDPROC, (LONG_PTR) ParamEditProc); SetWindowLong(mParamEditWnd, GWLP_USERDATA, (LPARAM) this); HFONT font = CreateFont(txt->mSize, 0, 0, 0, txt->mStyle == IText::kStyleBold ? FW_BOLD : 0, txt->mStyle == IText::kStyleItalic ? TRUE : 0, 0, 0, 0, 0, 0, 0, 0, txt->mFont); SendMessage(mParamEditWnd, WM_SETFONT, (WPARAM) font, 0); //DeleteObject(font); mEdControl = pControl; mEdParam = 0; }
bool IGraphics::DrawBitmap(IBitmap* pIBitmap, IRECT* pDest, int srcX, int srcY, const IChannelBlend* pBlend) { LICE_IBitmap* pLB = (LICE_IBitmap*) pIBitmap->mData; IRECT r = pDest->Intersect(&mDrawRECT); srcX += r.L - pDest->L; srcY += r.T - pDest->T; _LICE::LICE_Blit(mDrawBitmap, pLB, r.L, r.T, srcX, srcY, r.W(), r.H(), LiceWeight(pBlend), LiceBlendMode(pBlend)); return true; }
IKnobLineControl::IKnobLineControl(IPlugBase* pPlug, IRECT pR, int paramIdx, const IColor* pColor, double innerRadius, double outerRadius, double minAngle, double maxAngle, EDirection direction, double gearing) : IKnobControl(pPlug, pR, paramIdx, direction, gearing), mColor(*pColor) { mMinAngle = (float) minAngle; mMaxAngle = (float) maxAngle; mInnerRadius = (float) innerRadius; mOuterRadius = (float) outerRadius; if (mOuterRadius == 0.0f) { mOuterRadius = 0.5f * (float) pR.W(); } mBlend = IChannelBlend(IChannelBlend::kBlendClobber); }
IRadioButtonsControl::IRadioButtonsControl(IPlugBase* pPlug, IRECT pR, int paramIdx, int nButtons, IBitmap* pBitmap, EDirection direction) : IControl(pPlug, pR, paramIdx), mBitmap(*pBitmap) { mRECTs.Resize(nButtons); int x = mRECT.L, y = mRECT.T, h = int((double) pBitmap->H / (double) pBitmap->N); if (direction == kHorizontal) { int dX = int((double) (pR.W() - nButtons * pBitmap->W) / (double) (nButtons - 1)); for (int i = 0; i < nButtons; ++i) { mRECTs.Get()[i] = IRECT(x, y, x + pBitmap->W, y + h); x += pBitmap->W + dX; } } else { int dY = int((double) (pR.H() - nButtons * h) / (double) (nButtons - 1)); for (int i = 0; i < nButtons; ++i) { mRECTs.Get()[i] = IRECT(x, y, x + pBitmap->W, y + h); y += h + dY; } } }