示例#1
0
LRESULT CColorCombo::OnFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	if (m_bFocus != (uMsg == WM_SETFOCUS))
	{
		m_bFocus = !m_bFocus;

		// This following code helps us deal with the situation below:
		//   When user changes a color combo many times (in OnComboCommand) in order to fine tune a color,
		//		it's current color is maintained, but nothing is added to the combo
		//   When the color combo loses focus, it's current color is saved
		//   When a new color combo receives focus, the saved color is checked against
		//		the custom colors in the combo (in SelectColor) to see if needs to be added

		if (m_bFocus) // Taking focus
		{
			if (m_SavedColor != m_Color)
				SelectColor(m_SavedColor, true/*bCustomColorsOnly*/, false/*bSetCurSel*/);
		}
		else // Losing focus
			m_SavedColor = m_Color;
	}

	bHandled = false;
	return S_OK;
}
示例#2
0
void CGroup1::Draw9(CDC* pDC, CSize& ScreenSize,
					int CameraX, int CameraY, // position on camera
					long x, long y, // position on screen
					long lFactorX, long lFactorY, long CameraFactor,
					COLORREF Pix, COLORREF PrevPix, DWORD)
{
	long Diff = Pix - PrevPix;
	long R = GetRValue(Diff);
	long G = GetGValue(Diff);
	long B = GetBValue(Diff);
	COLORREF CurrColor = SelectColor(R, G, B);
	
	long lastX = min(x+lFactorX, ScreenSize.cx);
	long lastY = min(y+lFactorY, ScreenSize.cy);
	
	CRect r(x, y, lastX, lastY);
	CBrush b(RGB(0,0,0));
	CPen pen;
	pen.CreatePen(PS_SOLID, 1, CurrColor);
	CPen* pOld = pDC->SelectObject(&pen);
	CBrush* pOldB = pDC->SelectObject(&b);
	
	pDC->MoveTo(R*3,G);
	pDC->LineTo(CameraX*3, B*3);
	
	b.DeleteObject();
	pen.DeleteObject();
	pDC->SelectObject(pOld);
	pDC->SelectObject(pOldB);
}
示例#3
0
文件: ColorBox.cpp 项目: ror13/diplom
//When allow change is on, the color may be changed when the user 
//click on the button.
BOOL CColorBox::OnClickedEx() 
{
	if(m_allowChange)
	{
		SelectColor();
	}

	//Return FALSE. The parent will get the OnClick message.
	return FALSE;
}
void PalettePanel::OnColorRightDown(wxMouseEvent& event)
{
    int i;

    for (i = 0; i < 16; i++)
    {
        if (m_apPanelColor[i]->GetId() == event.GetId())
        {
            SelectColor(i, true);
            break;
        }
    }
}
示例#5
0
void CGroup1::LinesTop14(CDC* pDC, CSize& ScreenSize,
						 int CameraX, int CameraY, // position on camera
						 long x, long y, // position on screen
						 long lFactorX, long lFactorY, long CameraFactor,
						 COLORREF Pix, COLORREF PrevPix, DWORD)
{
	long Diff = Pix - PrevPix;
	long R = GetRValue(Diff);
	long G = GetGValue(Diff);
	long B = GetBValue(Diff);
	COLORREF CurrColor = SelectColor(R, G, B);
	
	long rgb=(R+G+B)/3;
	long lastX = min(x+lFactorX, ScreenSize.cx);
	long lastY = min(y+lFactorY, ScreenSize.cy);
	
	CRect r(x, y, lastX, lastY);
	CBrush b(RGB(0,0,0));
	CPen pen;
	pen.CreatePen(PS_SOLID, 1, CurrColor);
	CPen* pOld = pDC->SelectObject(&pen);
	CBrush* pOldB = pDC->SelectObject(&b);
	
	if (x<ScreenSize.cx/2 && y<ScreenSize.cy/2 )
	{
		pDC->MoveTo (0,0);
		pDC->LineTo(x,y);
	}
	else if (x>ScreenSize.cx/2 && y<ScreenSize.cy/2 )
	{
		pDC->MoveTo (ScreenSize.cx,0);
		pDC->LineTo(x,y);
	}
	else if (x<ScreenSize.cx/2 && y>ScreenSize.cy/2 )
	{
		pDC->MoveTo (0,ScreenSize.cy);
		pDC->LineTo(x,y);
	}
	else if (x>ScreenSize.cx/2 && y>ScreenSize.cy/2 )
	{
		pDC->MoveTo (ScreenSize.cx,ScreenSize.cy);
		pDC->LineTo(x,y);
	}
	
	b.DeleteObject();	
	pen.DeleteObject();
	pDC->SelectObject(pOld);
	pDC->SelectObject(pOldB);
}
//------------------------------------------------------------------------------------------------------------
void loop() {
  //Turn on white Bar Top LEDs
  analogWrite(white_1, 255);
  analogWrite(white_2, 255);
  
  //Sample Audio Signal on Pin A0
  audioAmplitudePast = audioAmplitude;
  audioAmplitude = analogRead(audioIn);
  
  //Sample Mode Control Pushbutton
  prevButtonState = currButtonState; //Update previous button state
  currButtonState = digitalRead(cyc_pushbutton); //Sample pushbutton state
  if((prevButtonState != currButtonState) && (currButtonState == HIGH)){
    colorMode = (colorMode + 1) % NUM_SCHEMES; //increase color mode
  }

  //Select Scheme and Update Lights
  switch(colorMode){
    case 0:
      if((cyclePeriod % 2) == 0 ){
        counterColor++;
        if(counterColor == ALLON){
          cyclePeriod++; //increment cylce period
        }    
      }
      else{
        counterColor--;
        if((cyclePeriod == 5) && (counterColor == ALLOFF)){
          cyclePeriod = 0;
        }
        else if(counterColor == ALLOFF){
          cyclePeriod++;
        }
      }
  
      SelectBrightness();  
      UpdateLEDs_Scheme_1();
      delayMicroseconds(25000); // pause for 25 milliseconds
    case 1:
      SelectColor();
      UpdateLEDs_Scheme_2();
      delayMicroseconds(25000); // pause for 25 milliseconds
//    case 2:
//      UpdateLEDs_Scheme_3();
//      delay(25); // pause for 25 milliseconds
    default:
      break;
  }
}
示例#7
0
void CGroup1::LotsOrder11(CDC* pDC, CSize& ScreenSize,
						  int CameraX, int CameraY, // position on camera
						  long x, long y, // position on screen
						  long lFactorX, long lFactorY, long CameraFactor,
						  COLORREF Pix, COLORREF PrevPix, DWORD)
{
	long Diff = Pix - PrevPix;
	long R = GetRValue(Diff);
	long G = GetGValue(Diff);
	long B = GetBValue(Diff);
	COLORREF CurrColor = SelectColor(R, G,B);
	
	for (int f=0; f<4; f++)
	{
		for (int g=0; g<5; g++)\
		{			
			pDC->SetPixel(CameraX+f*200,CameraY+g*200, CurrColor);
		}
	}
}
示例#8
0
LRESULT CColorCombo::OnComboCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	// When we send a notification to our parent about the combo changes (below),
	// that notification it is actually reflected back to us.
	// Be sure to bail un-handled in that case
	if (wNotifyCode & COMBO_NOTIFCATION_FLAG)
	{ 
		bHandled = false;
		return S_OK;
	}

	bool bAfterCloseUp = (m_wLastNotifyCode == CBN_CLOSEUP);
	m_wLastNotifyCode = wNotifyCode;

	if (wNotifyCode != CBN_SELCHANGE)
		return S_OK;

	int nItem = GetCurSel();
	if (nItem < 0) nItem = 0;
	COLORREF Color = (COLORREF)GetItemData(nItem);
	if (Color == CLR_NONE) // The "Custom" color item launches the color picker
	{
		if (!bAfterCloseUp)
			return S_OK;

		bool bOK = PopupColorPicker(m_Color);
		SelectColor(m_Color, false/*bCustomColorsOnly*/);
		if (!bOK) // if the user canceled, get out since the color didn't change
			return S_OK;
	}
	else
		m_Color = Color;

	m_bAfterCloseUp = bAfterCloseUp;
	::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), COMBO_NOTIFCATION_FLAG|wNotifyCode), (LPARAM)m_hWnd);

	return S_OK;
}
示例#9
0
HRESULT COptionDlg::OnSelect64(IHTMLElement* /*pElement*/){ SelectColor(64); return S_FALSE; }