// 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; }
void IGraphicsWin::PromptUserInput(IControl* pControl, IParam* pParam) { if (!pControl || !pParam || mParamEditWnd) { return; } IRECT* pR = pControl->GetRECT(); int cX = int(pR->MW()), cY = int(pR->MH()); char currentText[MAX_PARAM_LEN]; pParam->GetDisplayForHost(currentText); int n = pParam->GetNDisplayTexts(); if (n && (pParam->Type() == IParam::kTypeEnum || pParam->Type() == IParam::kTypeBool)) { int i, currentIdx = -1; int w = PARAM_LIST_MIN_W, h = PARAM_EDIT_H_PER_ENUM * (n + 1); for (i = 0; i < n; ++i) { const char* str = pParam->GetDisplayText(i); w = MAX(w, PARAM_LIST_MIN_W + strlen(str) * PARAM_LIST_W_PER_CHAR); if (!strcmp(str, currentText)) { currentIdx = i; } } mParamEditWnd = CreateWindow("COMBOBOX", "", WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, cX - w/2, cY, w, h, mPlugWnd, (HMENU) PARAM_EDIT_ID, mHInstance, 0); for (i = 0; i < n; ++i) { const char* str = pParam->GetDisplayText(i); SendMessage(mParamEditWnd, CB_ADDSTRING, 0, (LPARAM) str); } SendMessage(mParamEditWnd, CB_SETCURSEL, (WPARAM) currentIdx, 0); } else { int w = PARAM_EDIT_W, h = PARAM_EDIT_H; mParamEditWnd = CreateWindow("EDIT", currentText, WS_CHILD | WS_VISIBLE | ES_CENTER | ES_MULTILINE, cX - w/2, cY - h/2, w, 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); IText txt; HFONT font = CreateFont(txt.mSize, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, txt.mFont); SendMessage(mParamEditWnd, WM_SETFONT, (WPARAM) font, 0); //DeleteObject(font); mEdControl = pControl; mEdParam = pParam; }
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; } } }
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); }