Esempio n. 1
0
//////////////////////////////////////////////////////////////////////////////
//  Sets the frequency and individual digit values
//////////////////////////////////////////////////////////////////////////////
void CFreqCtrl::SetFrequency(qint64 freq)
{
int i;
qint64 acc = 0;
qint64 rem;
int val;
    if( freq == m_Oldfreq)
        return;
    if( freq < m_MinFreq)
        freq = m_MinFreq;
    if( freq > m_MaxFreq)
        freq = m_MaxFreq;
    m_freq = freq - freq%m_MinStep;
    rem = m_freq;
    m_LeadZeroPos = m_NumDigits;
    for(i=m_NumDigits-1; i>=m_DigStart; i--)
    {
        val = (int)(rem/m_DigitInfo[i].weight);
        if(m_DigitInfo[i].val != val)
        {
            m_DigitInfo[i].val = val;
            m_DigitInfo[i].modified = TRUE;
        }
        rem = rem - val*m_DigitInfo[i].weight;
        acc += val;
        if( (acc==0) && ( i>m_DecPos) )
            m_LeadZeroPos = i;
    }
    // signal the new frequency to world
    m_Oldfreq = m_freq;
    emit NewFrequency( m_freq );
    UpdateCtrl(m_LastLeadZeroPos != m_LeadZeroPos);
    m_LastLeadZeroPos = m_LeadZeroPos;
}
Esempio n. 2
0
void KGMemDateList::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	static UINT scCode = nSBCode;
	if (
		scCode != nSBCode &&
		static_cast<CWnd*>(pScrollBar) != static_cast<CWnd*>(&m_spinCtrl)
		)
	{
		if (nSBCode == 5)
			UpdateCtrl(false);
		if (nSBCode == 8)
			UpdateCtrl(true);
	}
	scCode = nSBCode;
	return KGListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
}
Esempio n. 3
0
void CElementFramePage::OnBnClickedChkDrawShadow()
{
	// TODO: 在此添加控件通知处理程序代码
	UpdateData();
	UpdateCtrl();
	SetModified();
}
Esempio n. 4
0
/////////////////////////////////////////////////////////////////////
//  Mouse Event overrides
/////////////////////////////////////////////////////////////////////
void CFreqCtrl::mouseMoveEvent(QMouseEvent * event)
{
QPoint pt = event->pos();
    //find which digit is to be edited
    if( isActiveWindow() )
    {
        if(!hasFocus())
            setFocus(Qt::MouseFocusReason);
        for(int i=m_DigStart; i<m_NumDigits; i++)
        {
            if( InRect( m_DigitInfo[i].dQRect, pt) )
            {
                if( !m_DigitInfo[i].editmode )
                {
                    m_DigitInfo[i].editmode = TRUE;
                    m_ActiveEditDigit = i;
                }
            }
            else
            {       //un-highlight the previous digit if moved off it
                if( m_DigitInfo[i].editmode )
                {
                    m_DigitInfo[i].editmode = FALSE;
                    m_DigitInfo[i].modified = TRUE;
                }
            }
        }
        UpdateCtrl(FALSE);
    }
}
Esempio n. 5
0
//////////////////////////////////////////////////////////////////////////////
//  Sets the Background color
//////////////////////////////////////////////////////////////////////////////
void CFreqCtrl::SetBkColor(QColor cr)
{
    m_UpdateAll = TRUE;
    m_BkColor = cr;
    for(int i=m_DigStart; i<m_NumDigits; i++)
        m_DigitInfo[i].modified = TRUE;
    UpdateCtrl(TRUE);
}
Esempio n. 6
0
void CElementFramePage::SetCtrls()
{
	if(!m_pElement)
		return;

	//border
	m_bDrawBorder = m_pElement->GetDrawBorder();
	m_PreviewBorderBtn.SetSymbol(m_BorderSymbol.get());
	m_pBorder->GetGap(m_fBorderGapX, m_fBorderGapY);
	CSpinButtonCtrl	* pSpinBorderX = NULL;
	pSpinBorderX = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_BORDER_X);
	if (pSpinBorderX)
		pSpinBorderX->SetRange(-1000, 1000);

	CSpinButtonCtrl	* pSpinBorderY = NULL;
	pSpinBorderY = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_BORDER_Y);
	if (pSpinBorderY)
		pSpinBorderY->SetRange(-1000, 1000);

	//background
	m_bDrawBg= m_pElement->GetDrawBackground();
	m_PreviewBgBtn.SetSymbol(m_BgSymbol.get());
	m_pBg->GetGap(m_fBgGapX, m_fBgGapY);

	CSpinButtonCtrl	* pSpinBgX = NULL;
	pSpinBgX = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_BG_X);
	if (pSpinBgX)
		pSpinBgX->SetRange(-1000, 1000);

	CSpinButtonCtrl	* pSpinBgY = NULL;
	pSpinBgY = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_BG_Y);
	if (pSpinBgY)
		pSpinBgY->SetRange(-1000, 1000);

	//shadow
	m_bDrawShadow = m_pElement->GetDrawShadow();
	m_PreviewShadowBtn.SetSymbol(m_ShadowSymbol.get());
	m_pShadow->GetGap(m_fShadowGapX, m_fShadowGapY);

	CSpinButtonCtrl	* pSpinShadowX = NULL;
	pSpinShadowX = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_SHADOW_X);
	if (pSpinShadowX)
		pSpinShadowX->SetRange(-1000, 1000);

	CSpinButtonCtrl	* pSpinShadowY = NULL;
	pSpinShadowY = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_SHADOW_Y);
	if (pSpinShadowY)
		pSpinShadowY->SetRange(-1000, 1000);

	//draft mode
	if(m_pElement->GetDrawMode() == Element::EDM_NORMAL)
		m_bDrawDraftMode = FALSE;
	else if(m_pElement->GetDrawMode() == Element::EDM_DRAFT)
		m_bDrawDraftMode = TRUE;

	UpdateData(FALSE);
	UpdateCtrl();
}
	void CAnalysisWherePage::OnSelectChange()
	{
		if (!m_locationCtrl.IsInit())
		{
			FillLocation();
			m_locationCtrl.SetSelection(m_pAnalysis->GetWindow().m_locations);
		}

		UpdateCtrl();
	}
	void CAnalysisWhatPage::SetAnalysisToInterface(const CAnalysis& analysis)
	{
		bool bSelection = analysis.GetWindow().m_bSelectParametersVariations;
		m_selectCtrl.SetCheck(bSelection);

		if (!m_parametersetCtrl.IsInit())
		{
			FillParametersVariations();
			m_parametersetCtrl.SetSelection(analysis.GetWindow().m_parametersVariations);
		}

		UpdateCtrl();
	}
Esempio n. 9
0
void CFreqCtrl::leaveEvent( QEvent *  )
{   //called when mouse cursor leaves this control so deactivate any highlights
    if(m_ActiveEditDigit>=0)
    {
        if( m_DigitInfo[m_ActiveEditDigit].editmode )
        {
            m_DigitInfo[m_ActiveEditDigit].editmode = FALSE;
            m_DigitInfo[m_ActiveEditDigit].modified = TRUE;
            m_ActiveEditDigit = -1;
            UpdateCtrl(FALSE);
        }
    }
}
Esempio n. 10
0
/***************************************************
OnUpdate
	notification handler is called as the result of the EN_UPDATE notification
	message.  This notificatoin is sent when an edit control is about to redraw
	itself after it has formatted the text, but before it displays the text. 
	This makes it possible to resize the edit control window
Params:
	<none>
Returns:
	<none>
*****************************************************/
void CUGEdit::OnUpdate() 
{
	CalcEditRect();

	if (UGXPThemes::IsThemed())
	    UpdateCtrl();
	/*CString str;
	this->GetWindowText(str);
	AfxMessageBox(str,0,0);*/
	//在这里可以获取到用户输入的字符 邵盛松 注释


}
	void CAnalysisWherePage::SetAnalysisToInterface(const CAnalysis& analysis)
	{
		bool bSelection = analysis.GetWindow().m_bSelectLocation;

		m_selectCtrl.SetCheck(bSelection);
		if (bSelection && !m_locationCtrl.IsInit())
		{
			FillLocation();
			m_locationCtrl.SetSelection(analysis.GetWindow().m_locations);
		}

		UpdateCtrl();
	}
	void CAnalysisWhichPage::SetAnalysisToInterface(const CAnalysis& analysis)
	{
		bool bSelection = analysis.GetWindow().m_bSelectVariable;

		m_selectCtrl.SetCheck(bSelection);

		if (!m_variableCtrl.IsInit())
		{
			FillVariable();
			m_variableCtrl.SetSelection(analysis.GetWindow().m_variables);
		}

		UpdateCtrl();
	}
Esempio n. 13
0
BOOL CSettingDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化
	// TODO: Add extra initialization here
	CCOCDlg* pMain  = (CCOCDlg*)AfxGetApp()->m_pMainWnd; 
	CMainDoc* pDoc	 = pMain->m_pMainDoc;
	CINI* pINI		 = pDoc->m_pINI;

	if (pINI->GetValid() == TRUE)
		pDoc->ReadINIInfo(); 

	UpdateCtrl();
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
	void CAnalysisWhenPage::SetAnalysisToInterface(const CAnalysis& analysis)
	{
		InitialiseCtrl();

		const CAnalysisWindow& window = analysis.GetWindow();

		m_selectPeriodCtrl.SetCheck(window.m_bSelectPeriod);
		m_beginCtrl.SetTemporalReference(window.m_period.Begin());
		m_endCtrl.SetTemporalReference(window.m_period.End());

		short ID = IDC_CONTINUOUS + window.m_period.GetType();
		CheckRadioButton(IDC_CONTINUOUS, IDC_YEAR_BY_YEAR, ID);

		m_useCurrentDataCtrl1.SetCheck(window.m_bUseCurrentDate1);
		m_shiftCtrl1.SetWindowText(ToString(window.m_shift1));

		m_useCurrentDataCtrl2.SetCheck(window.m_bUseCurrentDate2);
		m_shiftCtrl2.SetWindowText(ToString(window.m_shift2));

		UpdateCtrl();
	}
Esempio n. 15
0
//////////////////////////////////////////////////////////////////////////////
//  Sets the Digit units
//////////////////////////////////////////////////////////////////////////////
void CFreqCtrl::SetUnits(FUNITS units)
{
    switch(units)
    {
        case UNITS_HZ:
            m_DecPos = 0;
            m_UnitString = "Hz ";
            break;
        case UNITS_KHZ:
            m_DecPos = 3;
            m_UnitString = "KHz";
            break;
        case UNITS_MHZ:
            m_DecPos = 6;
            m_UnitString = "MHz";
            break;
        case UNITS_GHZ:
            m_DecPos = 9;
            m_UnitString = "GHz";
            break;
        case UNITS_SEC:
            m_DecPos = 6;
            m_UnitString = "Sec";
            break;
        case UNITS_MSEC:
            m_DecPos = 3;
            m_UnitString = "mS ";
            break;
        case UNITS_USEC:
            m_DecPos = 0;
            m_UnitString = "uS ";
            break;
        case UNITS_NSEC:
            m_DecPos = 0;
            m_UnitString = "nS ";
            break;
    }
    m_UpdateAll = TRUE;
    UpdateCtrl(TRUE);
}
	void CAnalysisHowPage::SetAnalysisToInterface(const CAnalysis& analysis)
	{
		const CAnalysisComputation& computation = analysis.GetComputation();
		m_selectCtrl.SetCheck(computation.m_bSelectTimeTransformation);

		if (!m_info.m_period.IsInit())
			m_pParent->GetParentInfo(WBSF::GetFM(), m_info, TIME_REF);


		//WBSF::StringVector nameArray;
		//m_pParent->GetDimensionList(*m_pFileManager, DIMENSION::TIME_REF, nameArray);
		//ASSERT( nameArray.size() == 2);

		//m_sourceTM = p.GetTM();
		m_sourceTM = m_info.m_period.GetTM();
		//SetTM(m_sourceTM);
		m_CTTypeCtrl.SetCurSel((int)m_sourceTM.Type());
		m_CTModeCtrl.SetCurSel((int)m_sourceTM.Mode());

		FillType();
		FillMode((int)computation.m_TM.Type());
		SetTM(computation.m_TM);



		SetComputationKind(computation.m_kind);
		//if( computation.m_kind == CAnalysisComputation::STATISTIC)
		m_previousStatisticCtrl.SetCurSel(computation.m_previousStatisticType + 1);
		m_statisticTypeCtrl.SetCurSel(computation.m_statisticType2 + 1);
		//m_statisticTypeCtrl.SetCurSel(computation.m_statisticType);
		m_eventTypeCtrl.SetCurSel(computation.m_eventType);
		m_KCtrl.SetWindowText(ToString(computation.m_K));
		m_bDropYearCtrl.SetCheck(computation.m_bDropYear);

		m_meanOverReplicationCtrl.SetCheck(computation.m_bMeanOverReplication);
		m_meanOverParameterSetCtrl.SetCheck(computation.m_bMeanOverParameterSet);
		m_meanOverLocationCtrl.SetCheck(computation.m_bMeanOverLocation);

		UpdateCtrl();
	}
Esempio n. 17
0
void CPalTool::OnDeltaposSpin(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
	// TODO: Add your control notification handler code here

	int nAdd = pNMUpDown->iDelta;//(~pNMUpDown->iDelta) + 1;;


	if(nAdd + nCurrPage <= nPageAmt && nAdd + nCurrPage >= 1)
	{
		nCurrPage += nAdd;
		
		UpdateCtrl();
		
		OnPalSelChange(rgPalRedir[nCurrPage - 1], FALSE);
		SendPalMsg(nNotifyCtrlIndex, CUSTOM_SS);

		
	}

	

	*pResult = 0;
}
Esempio n. 18
0
boolean Arpege::ChangeValue(int cpt, int value, byte Encoder)
{  
  int newValue;
  int pos;
  int ret=false;

  // cpt compte de 1 Ã  ...
  if (cpt >=16) cpt-=6;
  cpt++;


  switch(Mode)
  {
  case MODE_PATT :


    switch(cpt)
    {
/*      
    case 1:
      newValue = encnewmap(value, 0, NB_ARP_TRACK-1, CurArp, Encoder);
      if (newValue != CurArp )
      {
        if ( IsOn ) EventOff();
        ret = true;
        CurArp = newValue;
        DessinPage();
        UpdatePattern();
      }
      break;      
*/
    case 2:
      newValue = encnewmap(value, 0, 5, Tracks[CurArp].Direction, Encoder);
      if (newValue != Tracks[CurArp].Direction )
      {
        Tracks[CurArp].Direction = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;
    case 3:
      newValue = encnewmap(value, 1, 6, Tracks[CurArp].Octave , Encoder );
      if (newValue != Tracks[CurArp].Octave )
      {
        Tracks[CurArp].Octave = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;
    case 4:
      newValue = encnewmap(value, 0, 6, Tracks[CurArp].Note , Encoder );
      if (newValue != Tracks[CurArp].Note )
      {
        Tracks[CurArp].Note = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;
    case 5:
      newValue = encnewmap(value, 1, 40, Tracks[CurArp].Duree , Encoder );
      if (newValue != Tracks[CurArp].Duree )
      {
        Tracks[CurArp].Duree = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;
    case 6:
      newValue = encnewmap(value, 0, 1,  Tracks[CurArp].Velomod , Encoder );
      if (newValue != Tracks[CurArp].Velomod )
      {
        Tracks[CurArp].Velomod = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;
    case 7:
      newValue = encnewmap(value, 0, 127, Tracks[CurArp].Veloci , Encoder );
      if (newValue != Tracks[CurArp].Veloci )
      {
        Tracks[CurArp].Veloci = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;
    case 8:
      newValue = encnewmap(value, 0, 2, Tracks[CurArp].Motif , Encoder );
      if (newValue != Tracks[CurArp].Motif )
      {
        Tracks[CurArp].Motif = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;
    case 9:
      newValue = encnewmap(value, 1, NB_EU_STEP_MAX, Tracks[CurArp].Lg , Encoder );
      if (newValue != Tracks[CurArp].Lg )
      {
        Tracks[CurArp].Lg = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;

    case 10:
      newValue = encnewmap(value, 1, NB_EU_STEP_MAX, Tracks[CurArp].Div , Encoder );
      if (newValue != Tracks[CurArp].Div )
      {
        Tracks[CurArp].Div = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;

    case 11:
      newValue = encnewmap(value, 0, 1, Tracks[CurArp].FillAuto , Encoder );
      if (newValue != Tracks[CurArp].FillAuto )
      {
        Tracks[CurArp].FillAuto = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;

    case 12:
      newValue = encnewmap(value, 12, 96, Tracks[CurArp].Tonale , Encoder );
      if (newValue != Tracks[CurArp].Tonale )
      {
        Tracks[CurArp].Tonale = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;

    case 13:
      newValue = encnewmap(value, 0, 32, Tracks[CurArp].Accord , Encoder );
      if (newValue != Tracks[CurArp].Accord )
      {
        Tracks[CurArp].Accord = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdatePattern();
      };
      break;

      /*
  case 11:
       newValue = newmap(value, 0, 127 );
       if (newValue != Tracks[CurArp].NMin )
       {
       Tracks[CurArp].NMin = newValue;
       ret = true;
       UpdateCtrl(cpt);
       UpdatePattern();
       };
       break;
       
       case 12:
       newValue = newmap(value, 0, 127 );
       if (newValue != Tracks[CurArp].NMax )
       {
       Tracks[CurArp].NMax = newValue;
       ret = true;
       UpdateCtrl(cpt);
       UpdatePattern();
       };
       break;
       
       case 13:
       break;
       */
    case 14:
      newValue = encnewmap(value, 0, 2, Tracks[CurArp].Maintien , Encoder );
      if (newValue != Tracks[CurArp].Maintien )
      {
        Tracks[CurArp].Maintien = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 15:
      newValue = encnewmap(value, 0, 1, Tracks[CurArp].Transpose , Encoder );
      if (newValue != Tracks[CurArp].Transpose )
      {
        Tracks[CurArp].Transpose = newValue;
        if ( newValue == 1) {
            switch( ParamGlo.ArpSrc )
            {
              case 0:  ParamGlo.LastNote = reelBuf[0].Note; break;
              case 1:  ParamGlo.LastUpperNote = reelBuf[0].Note; break;
              case 2:  ParamGlo.LastLowerNote = reelBuf[0].Note; break;
              case 3:  LastOffset = 0; break;
            }
        }
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 16:
      newValue = encnewmap(value, 0, 4, Tracks[CurArp].Modul , Encoder );
      if (newValue != Tracks[CurArp].Modul )
      {
        Tracks[CurArp].Modul = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;      

    case 17:
      newValue = encnewmap(value, -99, 99, Tracks[CurArp].Ampli , Encoder );
      if (newValue != Tracks[CurArp].Ampli )
      {
        Tracks[CurArp].Ampli = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 18:
      newValue = encnewmap(value, 0, NB_OUTS, Tracks[CurArp].Dest1 , Encoder );
      if (newValue != Tracks[CurArp].Dest1 )
      {
        if ( IsOn ) EventOff();
        SPOut.AutoOff( Tracks[CurArp].Dest1 );
        Tracks[CurArp].Dest1 = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 19:
      newValue = encnewmap(value, 0, NB_OUTS, Tracks[CurArp].Dest2 , Encoder );
      if (newValue != Tracks[CurArp].Dest2 )
      {
        if ( IsOn ) EventOff();
        SPOut.AutoOff( Tracks[CurArp].Dest2 );
        Tracks[CurArp].Dest2 = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 20:
      newValue = encnewmap(value, 1, 16, Tracks[CurArp].Chanel , Encoder );
      if (newValue != Tracks[CurArp].Chanel )
      {
        if ( IsOn ) EventOff();
        SPOut.AutoOff( Tracks[CurArp].Dest1 );
        SPOut.AutoOff( Tracks[CurArp].Dest2 );
        Tracks[CurArp].Chanel = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;       
    }
    break;

  case MODE_SONG :
    switch(cpt)
    {

    case 1:
    case 2:
    case 3:
    case 4:
    case 5:
      pos=CurTrSong+cpt-1;
      newValue = encnewmap(value, 1, NB_ARP_TRACK, Songs[pos].Track , Encoder );
      if (newValue != Songs[pos].Track )
      {
        Songs[pos].Track = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;  

    case 6:
    case 7:
    case 8:
    case 9:
    case 10:
      pos=CurTrSong+cpt-6;
      newValue = encnewmap(value, 1, 16, Songs[pos].Repeat , Encoder );
      if (newValue != Songs[pos].Repeat )
      {
        Songs[pos].Repeat = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;  

    case 11:
    case 12:
    case 13:
    case 14:
    case 15:
      pos=CurTrSong+cpt-11;
      newValue = encnewmap(value, -12, +12, Songs[pos].Transpose , Encoder );
      if (newValue != Songs[pos].Transpose )
      {
        Songs[pos].Transpose = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;  

    case 16:
    case 17:
    case 18:
    case 19:
    case 20:
      pos=CurTrSong+cpt-16;
      newValue = encnewmap(value, 0, NB_TR_SONG, Songs[pos].Next , Encoder );
      if (newValue != Songs[pos].Next )
      {
        Songs[pos].Next = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;  
    }
    break;
  }

  return ret;

}
	void CAnalysisWhenPage::OnUpdateCtrl(NMHDR *pNMHDR, LRESULT *pResult)
	{
		UpdateCtrl();
		*pResult = 0;
	}
Esempio n. 20
0
//////////////////////////////////////////////////////////////////////////////
//  Sets the Mouse edit selection text background color
//////////////////////////////////////////////////////////////////////////////
void CFreqCtrl::SetHighlightColor(QColor cr)
{
    m_UpdateAll = TRUE;
    m_HighlightColor = cr;
    UpdateCtrl(TRUE);
}
Esempio n. 21
0
//////////////////////////////////////////////////////////////////////////////
//  Sets the Units text color
//////////////////////////////////////////////////////////////////////////////
void CFreqCtrl::SetUnitsColor(QColor cr)
{
    m_UpdateAll = TRUE;
    m_UnitsColor = cr;
    UpdateCtrl(TRUE);
}
	void CAnalysisHowPage::OnTTypeChange()
	{
		FillMode(m_TTTypeCtrl.GetCurItemData());
		UpdateCtrl();
	}
Esempio n. 23
0
void CTCEdit::OnKillfocus() 
{
    UpdateCtrl();
}
Esempio n. 24
0
boolean Global::ChangeValue(int cpt, int value, byte Encoder)
{  
  boolean ret = false;
  int newValue;
  int pos;
  int offset;
  
  // cpt compte de 1 Ã  ...
  if (cpt >=16) cpt-=6;
  cpt++;

  switch (CurPage)
  {
  case 0 :
    switch(cpt)
    {
    case 2:
      newValue = encnewmap(value, 0, 2, ParamGlo.Active[MODE_SEQEUCLID] ,Encoder);
      if (newValue != ParamGlo.Active[MODE_SEQEUCLID] )
      {
        ParamGlo.Active[MODE_SEQEUCLID] = newValue;
        if (  ParamGlo.Active[MODE_SEQEUCLID] && is_played && !SeqEu.is_played ) SeqEu.ExStart(false);
        if (  !ParamGlo.Active[MODE_SEQEUCLID] && is_played && SeqEu.is_played ) SeqEu.ExStop();
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 3:
      newValue = encnewmap(value, 0, 2, ParamGlo.Active[MODE_SEQSTEP],Encoder);
      if (newValue != ParamGlo.Active[MODE_SEQSTEP] )
      {
        ParamGlo.Active[MODE_SEQSTEP] = newValue;
        if (  ParamGlo.Active[MODE_SEQSTEP] && is_played && !SeqSt.is_played ) SeqSt.ExStart(false);
        if (  !ParamGlo.Active[MODE_SEQSTEP] && is_played && SeqSt.is_played ) SeqSt.ExStop();
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 4:
      newValue = encnewmap(value, 0, 2, ParamGlo.Active[MODE_SEQTR]  ,Encoder);
      if (newValue != ParamGlo.Active[MODE_SEQTR] )
      {
        ParamGlo.Active[MODE_SEQTR] = newValue;
        if (  ParamGlo.Active[MODE_SEQTR] && is_played && !SeqTr.is_played ) SeqTr.ExStart(false);
        if (  !ParamGlo.Active[MODE_SEQTR] && is_played && SeqTr.is_played ) SeqTr.ExStop();
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 5:
      newValue = encnewmap(value, 0, 2, ParamGlo.Active[MODE_ARPEGE],Encoder);
      if (newValue != ParamGlo.Active[MODE_ARPEGE] )
      {
        ParamGlo.Active[MODE_ARPEGE] = newValue;
        if (  ParamGlo.Active[MODE_ARPEGE] && is_played && !Arp.is_played ) Arp.ExStart(false);
        if (  !ParamGlo.Active[MODE_ARPEGE] && is_played && Arp.is_played ) Arp.ExStop();
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 7:
      newValue = encnewmap(value, 0, 3, ParamGlo.EuSrc,Encoder);
      if (newValue != ParamGlo.EuSrc )
      {
        switch( ParamGlo.EuSrc )
        {
          case 0: LastOffset = ParamGlo.LastNote;break;
          case 1: LastOffset = ParamGlo.LastUpperNote;break;
          case 2: LastOffset = ParamGlo.LastLowerNote;break;
        }
        ParamGlo.EuSrc = newValue;
        switch( ParamGlo.EuSrc )
        {
          case 0: ParamGlo.LastNote = LastOffset; break;
          case 1: ParamGlo.LastUpperNote = LastOffset; break;
          case 2: ParamGlo.LastLowerNote = LastOffset; break;
        }
        ret = true;
        UpdateCtrl(cpt);
        UpdateSplit();
      };
      break;

    case 8:
      newValue = encnewmap(value, 0, 3, ParamGlo.StSrc,Encoder);
      if (newValue != ParamGlo.StSrc )
      {
        switch( ParamGlo.StSrc )
        {
          case 0: LastOffset = ParamGlo.LastNote;break;
          case 1: LastOffset = ParamGlo.LastUpperNote;break;
          case 2: LastOffset = ParamGlo.LastLowerNote;break;
        }
        ParamGlo.StSrc = newValue;
        switch( ParamGlo.StSrc )
        {
          case 0: ParamGlo.LastNote = LastOffset; break;
          case 1: ParamGlo.LastUpperNote = LastOffset; break;
          case 2: ParamGlo.LastLowerNote = LastOffset; break;
        }
        ret = true;
        UpdateCtrl(cpt);
        UpdateSplit();
      };
      break;


    case 9:
      newValue = encnewmap(value, 0, 3, ParamGlo.TrSrc,Encoder);
      if (newValue != ParamGlo.TrSrc )
      {
        switch( ParamGlo.TrSrc )
        {
          case 0: LastOffset = ParamGlo.LastNote;break;
          case 1: LastOffset = ParamGlo.LastUpperNote;break;
          case 2: LastOffset = ParamGlo.LastLowerNote;break;
        }
        ParamGlo.TrSrc = newValue;
        switch( ParamGlo.TrSrc )
        {
          case 0: ParamGlo.LastNote = LastOffset; break;
          case 1: ParamGlo.LastUpperNote = LastOffset; break;
          case 2: ParamGlo.LastLowerNote = LastOffset; break;
        }
        ret = true;
        UpdateCtrl(cpt);
        UpdateSplit();
      };
      break;

    case 10:
      newValue = encnewmap(value, 0, 3, ParamGlo.ArpSrc,Encoder);
      if (newValue != ParamGlo.ArpSrc )
      {
        switch( ParamGlo.ArpSrc )
        {
          case 0: LastOffset = ParamGlo.LastNote;break;
          case 1: LastOffset = ParamGlo.LastUpperNote;break;
          case 2: LastOffset = ParamGlo.LastLowerNote;break;
        }
        ParamGlo.ArpSrc = newValue;
        switch( ParamGlo.ArpSrc )
        {
          case 0: ParamGlo.LastNote = LastOffset; break;
          case 1: ParamGlo.LastUpperNote = LastOffset; break;
          case 2: ParamGlo.LastLowerNote = LastOffset; break;
        }
        ret = true;
        UpdateCtrl(cpt);
        UpdateSplit();
      };
      break;

    case 11:
      newValue = encnewmap(value, 0, 4, ParamGlo.keyInput,Encoder);
      if (newValue != ParamGlo.keyInput )
      {
        ParamGlo.keyInput = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdateSplit();
      };
      break;

    case 12:
      newValue = encnewmap(value, 0, 1, ParamGlo.Split,Encoder);
      if (newValue !=ParamGlo.Split )
      {
        SPOut.AutoOff( ParamGlo.UpperDest );
        SPOut.AutoOff( ParamGlo.LowerDest );
        ParamGlo.Split = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdateSplit();
      };
      break;

    case 13:
      newValue = encnewmap(value, 0, NB_OUTS , ParamGlo.UpperDest,Encoder);
      if (newValue != ParamGlo.UpperDest )
      {
        SPOut.AutoOff( ParamGlo.UpperDest );
        ParamGlo.UpperDest = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 14:
      newValue = encnewmap(value, 0, NB_OUTS, ParamGlo.LowerDest,Encoder );
      if (newValue != ParamGlo.LowerDest )
      {
        SPOut.AutoOff( ParamGlo.LowerDest );
        ParamGlo.LowerDest = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 15:
      newValue = encnewmap(value, 0, 6 , ParamGlo.CVTrig,Encoder);
      if (newValue != ParamGlo.CVTrig )
      {
        ParamGlo.CVTrig = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 16:
      newValue = encnewmap(value, 0, 20 , ParamGlo.canInput,Encoder);
      if (newValue != ParamGlo.canInput )
      {
        ParamGlo.canInput = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 17:
      newValue = encnewmap(value, 12, 72 , ParamGlo.NoteSplit,Encoder);
      if (newValue != ParamGlo.NoteSplit )
      {
        SPOut.AutoOff( ParamGlo.UpperDest );
        SPOut.AutoOff( ParamGlo.LowerDest );
        ParamGlo.NoteSplit = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdateSplit();
      };
      break;


    case 18:
      newValue = encnewmap(value, -3, 3 , ParamGlo.UpperTrans,Encoder);
      if (newValue != ParamGlo.UpperTrans )
      {
        SPOut.AutoOff( ParamGlo.UpperDest );
        ParamGlo.UpperTrans = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdateSplit();
      };
      break;


    case 19:
      newValue = encnewmap(value, -3, 3 , ParamGlo.LowerTrans,Encoder);
      if (newValue != ParamGlo.LowerTrans )
      {
        SPOut.AutoOff( ParamGlo.LowerDest );
        ParamGlo.LowerTrans = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdateSplit();
      };
      break;

    case 20:
      newValue = encnewmap(value, 1, 16, ParamGlo.LowerChan,Encoder );
      if (newValue != ParamGlo.LowerChan )
      {
        SPOut.AutoOff( ParamGlo.LowerDest );
        ParamGlo.LowerChan = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;
    }
    break;
  case 1 :
    switch(cpt)
    {
    case 2:
      newValue = encnewmap(value, 0, 6, ParamGlo.ClockSrc,Encoder);
      if (newValue != ParamGlo.ClockSrc )
      {
        ParamGlo.ClockSrc = newValue;
        SClock.SetModeClock(ParamGlo.ClockSrc, ParamGlo.ClockDiv);
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 3:
      newValue = encnewmap(value, 1, 8, ParamGlo.ClockDiv,Encoder);
      if (newValue != ParamGlo.ClockDiv )
      {
        ParamGlo.ClockDiv = newValue;
        SClock.SetModeClock(ParamGlo.ClockSrc, ParamGlo.ClockDiv);
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 4:
      newValue = encnewmap(value, 1, 2, ParamGlo.TrigInDir,Encoder);
      if (newValue != ParamGlo.TrigInDir )
      {
        ParamGlo.TrigInDir = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 5:
      newValue = encnewmap(value, 1, 12, ParamGlo.Bend,Encoder);
      if (newValue != ParamGlo.Bend )
      {
        ParamGlo.Bend = newValue;
        ret = true;
        UpdateCtrl(cpt);
      };
      break;

    case 12:
    case 13:
    case 14:
    case 15:
    case 17:
    case 18:
    case 19:
    case 20:
      pos=(cpt > 15)?cpt-13:cpt-12;
      newValue = encnewmap(value, -100, +100 , ParamGlo.FINE_CV[pos],Encoder);
      if (newValue != ParamGlo.FINE_CV[pos] )
      {
        ParamGlo.FINE_CV[pos] = newValue;
        ret = true;
        UpdateCtrl(cpt);
      }
      break;

    }
    break;

  case 2:
    offset = CurPage-2;
    switch(cpt)
    {
    case 2:
    case 3:
    case 4:
    case 5:
    case 7:
    case 8:
    case 9:
    case 10:
      pos=(cpt > 6)?cpt-3:cpt-2;
      newValue = encnewmap(value, 0, 1 , CV_Type[pos],Encoder);
      if (newValue != CV_Type[pos] )
      {
        CV_Type[pos] = newValue;
        ret = true;
        UpdateCtrl(cpt);
      }
      break;

    case 12:
    case 13:
    case 14:
    case 15:
    case 17:
    case 18:
    case 19:
    case 20:
      pos=(cpt > 15)?cpt-13:cpt-12;
      newValue = encnewmap(value, 0, 1 , TRIG_Type[pos],Encoder);
      if (newValue != TRIG_Type[pos] )
      {
        TRIG_Type[pos] = newValue;
        ret = true;
        UpdateCtrl(cpt);
        SPOut.AutoOff(NOUT_CVALL+pos);
      }
      break;
    }
    break;
    
  default:
    offset = CurPage-3;
    switch(cpt)
    {

    case 1:
    case 2:
    case 3:
    case 4:
    case 5:
      pos=cpt-1;
      newValue = encnewmap(value, 0, 2 , Routes[pos + offset].Perim,Encoder);
      if (newValue != Routes[pos + offset].Perim )
      {
        Routes[pos + offset].Perim = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdateRoute( Routes[pos + offset].Route);
      }
      break;  

    case 6:
    case 7:
    case 8:
    case 9:
    case 10:
      pos=cpt-6;
      newValue = encnewmap(value, 0, ( Routes[pos + offset].Type == RT_MIDI ) ? 4 : 2 , Routes[pos + offset].Source, Encoder);
      if (newValue != Routes[pos + offset].Source )
      {
        Routes[pos + offset].Source = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdateRoute( Routes[pos + offset].Route);
      }
      break;  

    case 11:
    case 12:
    case 13:
    case 14:
    case 15:
      pos=cpt-11;
      newValue = encnewmap(value, 0, 23, Routes[pos + offset].Chanel, Encoder );
      if (newValue != Routes[pos + offset].Chanel)
      {
        Routes[pos + offset].Chanel = newValue;
        ret = true;
        UpdateCtrl(cpt);
        UpdateRoute( Routes[pos + offset].Route);
      }
      break;  

    case 16:
    case 17:
    case 18:
    case 19:
    case 20:
      pos=cpt-16;
      if ( Routes[pos + offset].Type != RT_MIDI )
      {
        newValue = encnewmap(value, 0, 127 + 2, Routes[pos + offset].MidiType , Encoder  );
        if (newValue != Routes[pos + offset].MidiType)
        {
          Routes[pos + offset].MidiType = newValue;
          ret = true;
          UpdateCtrl(cpt);
          UpdateRoute( Routes[pos + offset].Route);
        }
      }
      break;  
    }
    break;
  }
  return ret;

}
Esempio n. 25
0
int main()
{
// This must be more dynamic in the future, but right now this IOREF is only used for the analog switches in the 10-pin connector
//  (UART pins are handled by SIORefGen, and that voltage has to be lower than this IORef voltage)
//#define DYN_IOREF
#ifdef DYN_IOREF
    // ~1.0V to 4.1V vref
    IOVoltGen_Start();
    IOVoltGen_SetValue(0x80);
    IOVoltBuffer_Start();
#else
    // Results in 5V vref
    VDDIO2ref_SetDriveMode(VDDIO2ref_DM_STRONG);
    VDDIO2ref_Write(1);
#endif
    NV_Init();
    
    SIORefGen_Start();
    SIORefGen_SetValue(62); // 1V
    GPIO_SetTXDrive(0);
    debuguart1_init();
    
    CyGlobalIntEnable; /* Uncomment this line to enable global interrupts. */
    
    CyPins_ClearPin(LED_Status_0);
    CyPins_SetPin(FanEna_0);
  
    if(NVREAD->USBserial[0] != 0 && NVREAD->USBserial[0] != 0xff) {
		for(uint8_t loopah=0; loopah<8; loopah++) {
			mySerial[2 + (loopah<<1)] = NVREAD->USBserial[loopah]; // Update USB descriptor Unicode values with our ASCII
		}
        USBFS_1_SerialNumString(mySerial);
	}

    USB_Init();
    CyDelay(500);
    CyPins_ClearPin(FanEna_0);
    targetuart_init();
#ifdef SPECIAL_EDITION
    // Note that VtargetRef is in the 5V quadrant so that pin will always
    // output 5V when set high, no matter what the IOREF is set to!
    GPIO_SetPinState( TREF_PIN7, PIN_OUT_HIGH ); // Output on Vref
    GPIO_SetPinState( DFMS_PIN8, PIN_UART_TX ); // Send on DFMS pin, recv on DTMS!
    GPIO_SetPinState( DTMS_PIN9, PIN_UART_RX );
#else
    GPIO_SetPinState( DTMS_PIN9, PIN_UART_TX ); // Send on DTMS pin, recv on DFMS!
    GPIO_SetPinState( DFMS_PIN8, PIN_UART_RX );
#endif
    printf("\n\nWJ CDB Assist v3 controller init\n");
    
    FB_init();
    FB_clear();
    disp_str("CDB ASSIST V3",13,(64-39),0,FONT6X6 | INVERT);
    disp_str("Sony Mobile",11,(64-33),64-12,FONT6X6);
#ifdef SPECIAL_EDITION
    disp_str("Calibration Edition",19,(64-57),64-6,FONT6X6);
#else
    disp_str("Open Devices",12,(64-36),64-6,FONT6X6);
#endif
    FB_update();
    
    GPIO_Init();
    DummyLoad_Init();
    USBMux_Init();
    I2C_Init();
    PWM_Init();
    ADC_Init();
    
    uint16_t ctr=0;
    
    for(;;)
    {
        char buffah[22];
        uint8_t num;
        float vbatvolt,vbatcur,vbusvolt,vbuscur;
        
        I2C_Work();
        vbatvolt=(float)I2C_Get_VBAT_VoltAvg() * 0.001f;
        vbatcur=I2C_Get_VBAT_CurAvg();

        PWM_Work(I2C_Get_VBAT_Volt(),I2C_Get_VBAT_CurRaw());
        DummyLoad_Work(I2C_Get_VBAT_Volt());
        
        ADC_Work();
        uint8_t vrefok = ADC_VtargetValid();
        static uint8_t oldvrefok = 2;
        
        if( vrefok != oldvrefok ) {
            if( vrefok ) {
                CyPins_ClearPin(LED_Vref_0);
                GPIO_SetTXDrive( 1 );
            } else {
                CyPins_SetPin(LED_Vref_0);
                GPIO_SetTXDrive( 0 );
                SIORefGen_SetValue(62); // Default 1V ref
            }
            oldvrefok = vrefok;
        }

        if(ctr == 0) {
            vbusvolt=(float)I2C_Get_VBUS_Volt() * 0.001f;
            vbuscur=I2C_Get_VBUS_Cur();
            USBMux_UpdateMeasurements(vbusvolt,vbuscur);
            
            num = snprintf(buffah, sizeof(buffah), "VBAT %5.2fV %6.1fmA", vbatvolt,vbatcur);
            disp_str(buffah, num, 0, 8, FONT6X6);

            num = snprintf(buffah, sizeof(buffah), "VBUS %5.2fV %6.1fmA", vbusvolt,vbuscur);
            disp_str(buffah, num, 0, 8+6, FONT6X6);

            DummyLoad_ADCWork();
            float loadcur = DummyLoad_GetCur();
            float loadtemp = DummyLoad_GetTemp();
            num = snprintf(buffah, sizeof(buffah), "Load %5.1f` %6.1fmA", loadtemp,loadcur);
            disp_str(buffah, num, 0, 8+12, FONT6X6);

            float tmp = ADC_GetVoltage(VBATSENSE);
            num = snprintf(buffah, sizeof(buffah), "VBAT %5.2fV", tmp);
            disp_str(buffah, num, 0, 8+18, FONT6X6);

            tmp = ADC_GetVoltage(USB2SENSE);
            num = snprintf(buffah, sizeof(buffah), "USB2 %5.2fV", tmp);
            disp_str(buffah, num, 0, 8+24, FONT6X6);

            tmp = ADC_GetVoltage(USB3SENSE);
            num = snprintf(buffah, sizeof(buffah), "USB3 %5.2fV", tmp);
            disp_str(buffah, num, 0, 8+30, FONT6X6);

            tmp = ADC_GetVoltage(VTARGETSENSE);
            if( tmp > 4.5f ) { // Assume 5V, disable regulated output
                CY_SET_REG8(DTMS__SIO_CFG, (CY_GET_REG8(DTMS__SIO_CFG) & 0xcf) | 0x20);
                CY_SET_REG8(DTMS__SIO_DIFF, (CY_GET_REG8(DTMS__SIO_DIFF) & 0xcf) | 0x00);
                CY_SET_REG8(DTMS__SIO_HYST_EN, (CY_GET_REG8(DTMS__SIO_HYST_EN) & 0xcf) | 0x00);
            } else if( tmp > 0.89f ) {
                float val = tmp * 255.0f / 4.096f;
                if(val > 255.0f) val = 255.0f;
                SIORefGen_SetValue((uint8_t)val);
                CY_SET_REG8(DTMS__SIO_CFG, (CY_GET_REG8(DTMS__SIO_CFG) & 0xcf) | 0x30); // Regulated output buffer
                CY_SET_REG8(DTMS__SIO_DIFF, (CY_GET_REG8(DTMS__SIO_DIFF) & 0xcf) | 0x20);
                CY_SET_REG8(DTMS__SIO_HYST_EN, (CY_GET_REG8(DTMS__SIO_HYST_EN) & 0xcf) | 0x20);
            }
            num = snprintf(buffah, sizeof(buffah), "VTGT %5.2fV", tmp);
            disp_str(buffah, num, 0, 8+36, FONT6X6);

            FB_update();
            UpdateCtrl();
            ctr=256;
        } else {
            ctr--;
        }

        USB_Work();
    }
}
Esempio n. 26
0
void CTCEdit::OnUpdate() 
{
    UpdateCtrl();
}
Esempio n. 27
0
void CTCEdit::OnLButtonDown(UINT nFlags, CPoint point) 
{
    UpdateCtrl();

    CEdit::OnLButtonDown(nFlags, point);
}