void AUCarbonViewControl::ControlToParameter() { #if !__LP64__ if (mInControlInitialization) return; switch (mType) { case kTypeContinuous: { double controlValue = GetValueFract(); Float32 paramValue = AUParameterValueFromLinear(controlValue, &mParam); mParam.SetValue(mListener, this, paramValue); } break; case kTypeDiscrete: { long value = GetValue(); // special case [1] -- Menus if (mParam.HasNamedParams()) { // if we're dealing with menus they behave differently! // becaue setting min and max doesn't work correctly for the control value // first menu item always reports a control value of 1 ControlKind ctrlKind; if (GetControlKind(mControl, &ctrlKind) == noErr) { if ((ctrlKind.kind == kControlKindPopupArrow) || (ctrlKind.kind == kControlKindPopupButton)) { value = value + long(mParam.ParamInfo().minValue) - 1; } } } // special case [2] -- Write-only boolean parameters AudioUnitParameterInfo AUPI = mParam.ParamInfo(); bool isWriteOnlyBoolParameter = ( (AUPI.unit == kAudioUnitParameterUnit_Boolean) && (AUPI.flags & kAudioUnitParameterFlag_IsWritable) && !(AUPI.flags & kAudioUnitParameterFlag_IsReadable) ); if (isWriteOnlyBoolParameter) { value = 1; } mParam.SetValue (mListener, this, value); } break; case kTypeText: { Float32 val = mParam.GetValueFromString (GetTextValue()); mParam.SetValue(mListener, this, (mParam.IsIndexedParam() ? (int)val : val)); if (mParam.ValuesHaveStrings()) ParameterToControl(val); //make sure we display the correct text (from the AU) } break; } #endif }
bool wxMaskController::IsInputEmpty() { if(m_listData.GetCount() == 0) { wxString csInputData; csInputData = GetTextValue(); return csInputData.IsEmpty(); } wxFieldMaskData* pobjData=NULL; for(unsigned long pos = 0;pos < m_listData.GetCount();pos++) { pobjData = (wxFieldMaskData *) (m_listData.Item(pos))->GetData(); if (pobjData->IsInputData() && pobjData->m_chValue!=m_chPromptSymbol) return FALSE; } return TRUE; }
void EIconTextButtonProperty::OnPropActivate( EPropWnd* pParent ) { ASSERT( m_bSelected == false ); ASSERT( m_pButton == NULL ); ASSERT( m_pEdit == NULL ); m_sInitialValueText = GetTextValue(); int nBeg; int nEnd; pParent->GetIDRange( nBeg , nEnd ); if( HasEdit() && IsEnabled() ) { m_pEdit = new EPropWndEdit(); DWORD nStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL; if( m_nTextAlignment==1 ) nStyle |= ES_CENTER; if( m_nTextAlignment==2 ) nStyle |= ES_RIGHT; m_pEdit->Create( nStyle , m_TextRect , pParent , nBeg + 0 ); m_pEdit->SetFont( pParent->GetFont() , TRUE ); m_pEdit->SetWindowText( m_sInitialValueText ); m_pEdit->SetMargins( 0 , 0 ); m_pEdit->SetFocus(); } if( HasButton() && IsEnabled() ) { m_pButton = new CButton(); m_pButton->Create( "..." , WS_CHILD | WS_VISIBLE , m_ButtRect , pParent , nBeg + 1 ); // m_pButton->ModifyStyleEx( 0 , WS_EX_CLIENTEDGE ); m_pButton->SetFont( pParent->GetFont() ); if( m_pEdit == NULL ) { m_pButton->SetFocus(); } } m_bSelected = true; }
int EIconTextButtonProperty::GetHeight( CDC* pDC ) { CRect TextRect(0,0,0,0); CString s = GetTextValue(); if( s.GetLength()==0 ) { s = "Q"; //this is some default text to ensure there is actually height... } pDC->DrawText( s , &TextRect , DT_CALCRECT ); int w = TextRect.Width(); int h = TextRect.Height(); return 3 + h + 3; // return 19; }
wxString wxMaskController::GetInputData() { wxString csInputData; if(m_listData.GetCount() == 0) { csInputData = GetTextValue(); return csInputData; } wxFieldMaskData* pobjData=NULL; for(unsigned long pos = 0;pos < m_listData.GetCount();pos++) { pobjData= (wxFieldMaskData *) (m_listData.Item(pos))->GetData(); // Ignore everything that is not data. if(pobjData->IsInputData()) csInputData += pobjData->m_chValue; } return csInputData; }
int EIconTextButtonProperty::GetPreferedWidth( CDC* pDC ) { int nWidth = 0; if( GetIconWidth() > 0 ) { nWidth += s_nMargin; nWidth += GetIconWidth(); } nWidth += s_nMargin; CString s = GetTextValue(); CSize ext = pDC->GetTextExtent(s); nWidth += ext.cx; //s.GetLength() * 10; //inaccurate nWidth += s_nMargin; //a little extra... was removed if( HasButton() ) { nWidth += m_nButtonWidth; nWidth += s_nMargin; } return nWidth; }
// ----------------------------------------------------------------------------- // CWPPushMessage::ParseContentType // ----------------------------------------------------------------------------- // void CWPPushMessage::ParseContentType( TLex8& aPointer ) { // Go through the whole content type header. while( !aPointer.Eos() ) { // Each parameter might be well-known (integer) or unknown (text) if( IsIntegerValue( aPointer ) ) { // For well-known parameters, the token is an integer value TUint paramToken( I64LOW( GetIntegerValue( aPointer ) ) ); // These are filled with results from parsing. TInt resultInteger( 0 ); TPtrC8 resultString; // Make sure paramToken fits into KParameterTypes table if( paramToken < sizeof(KParameterTypes)/sizeof(TParameterCodingType)) { // Get the coding and use it to determine how we should decode // the next parameter value. We actually ignore all results // except short integer (SEC) and text-value (MAC), but the // rest of the parameters have to be parsed anyway. TParameterCodingType coding( KParameterTypes[paramToken] ); switch( coding ) { case EQValue: GetQValue( aPointer ); break; case EWellKnownCharset: GetWellKnownCharset( aPointer ); break; case EVersionValue: GetVersionValue( aPointer ); break; case EIntegerValue: GetIntegerValue( aPointer ); break; case ETextString: GetTextString( aPointer ); break; case EFieldName: GetFieldName( aPointer ); break; case EShortInteger: resultInteger = GetShortInteger( aPointer ); break; case EConstrainedEncoding: GetConstrainedEncoding( aPointer ); break; case EDeltaSecondsValue: GetDeltaSecondsValue( aPointer ); break; case ENoValue: GetNoValue( aPointer ); break; case ETextValue: resultString.Set( GetTextValue( aPointer ) ); break; case EDateValue: GetDateValue( aPointer ); break; default: break; } // We have a result. We're actually only interested in // SEC and MAC parameters, so we save them here. switch( paramToken ) { case KWSPHeaderSEC: iSEC = resultInteger; break; case KWSPHeaderMAC: iMAC.Set( resultString ); break; default: break; } } } else { // Unknown parameter. Its name is in text, and the value // might be an integer or text. GetTokenText( aPointer ); if( IsIntegerValue( aPointer ) ) { GetIntegerValue( aPointer ); } else { GetTextValue( aPointer ); } } } }
CString EIconTextButtonProperty::GetSortValueString() { return GetTextValue(); }
void EIconTextButtonProperty::Draw( CDC* pDC , EPropWnd* pParent ) { // m_Rect = r; m_nIconWidth = GetIconWidth(); // // 0 1 2 3 4 5 6 // +---+------+---+--------------------------+---+--------+ // | | | | | | | // | | ICON | | TEXT | | BUTTON | // | | | | | | | // +---+------+---+--------------------------+---+--------+ // // int x0 = m_Rect.left; //panel begin int x1 = x0 + s_nMargin; //icon begin int x2 = x1; //icon end (default for no icon) int x3 = x1; //text begin (default for no icon) if( m_nIconWidth != 0 ) //if there's an icon.. { x2 = x1 + m_nIconWidth; //icon end x3 = x2 + s_nMargin; //text begin } int x5 = m_Rect.right; //button begin int x6 = m_Rect.right; //button end if( HasButton() && m_bSelected ) { CRect cr; pParent->GetClientRect(&cr); x6 = cr.right /*+ pCtrl->GetScrollPos(SB_HORZ)*/ ; if( x6 > m_Rect.right ) { x6 = m_Rect.right; } x5 = x6 - m_nButtonWidth; } int x4 = x5 - s_nMargin; // // // int nFontHeight = pParent->GetFontHeight(); int nPropHeight = m_Rect.Height(); // int = m_Rect.top; // int y1 = y0 + 3; //(nPropHeight - nFontHeight)/2; // int y2 = y0 + nPropHeight - 3; // int y3 = y0 + nPropHeight; // // // m_IconRect.SetRect( x1 , m_Rect.top + 3 , x2 , m_Rect.top + 3 + m_nIconWidth ); //icon is square in upperleft corner m_TextRect.SetRect( x3 , m_Rect.top + 3 , x4 , m_Rect.top + nPropHeight - 3 ); m_ButtRect.SetRect( x5 , m_Rect.top , x6 , m_Rect.top + nPropHeight ); // // background // if( IsEnabled() ) { if( m_bSelected ) { pDC->FillSolidRect( &m_Rect , pParent->GetColorPaneValActive() ); } else { pDC->FillSolidRect( &m_Rect , pParent->GetColorPaneVal() ); } } else { pDC->FillSolidRect( &m_Rect , pParent->GetColorPaneKey() ); } // // icon // if( GetIconWidth() > 0 ) { DrawIcon( pDC , pParent, m_IconRect ); } // // text // CPoint vpo = pDC->GetViewportOrg(); // vpo.x = 0;//not set ..!! // vpo.y = 0; if( HasEdit() && m_bSelected && IsEnabled() ) { ASSERT(m_pEdit!=NULL); m_pEdit->SetWindowPos( NULL , x3 + vpo.x , m_TextRect.top + vpo.y , m_TextRect.Width()+1 , m_TextRect.Height() , SWP_NOZORDER ); m_pEdit->SetWindowText( GetTextValue() ); m_pEdit->SetSel(0,-1); } else { ASSERT(m_pEdit==NULL); if( IsEnabled()==false ) { pDC->SetTextColor( pParent->GetColorPaneKeyActive() - 0x404040 ); } CRect tr = m_TextRect; if( tr.Width() > 0 ) { CString s1 = GetTextValue(); if( s1.GetLength() > 0 ) { CString s2 = EPropWnd::s_FitStringToWidth(s1,tr.Width(),pDC); UINT nFormat = DT_TOP | DT_NOCLIP; if( m_nTextAlignment == 1 ) { nFormat |= DT_CENTER; } if( m_nTextAlignment == 2 ) { nFormat |= DT_RIGHT; /*tr.right-=1;*/ } if( s1.GetLength()>s2.GetLength() ) { nFormat &= ~DT_RIGHT; //clear right flag!! } pDC->DrawText( s2 , tr , nFormat ); } } if( IsEnabled()==false ) { pDC->SetTextColor( 0x000000 ); } } // // button // if( HasButton() && m_bSelected && IsEnabled() && m_pButton != NULL ) { int w = m_ButtRect.Width(); int h = m_ButtRect.Height(); int x = m_ButtRect.left; int y = m_ButtRect.top; m_pButton->SetWindowPos( NULL , x + vpo.x , y + vpo.y , w , h , SWP_NOZORDER ); } if( m_bSelected == false ) { ASSERT( m_pButton == NULL ); ASSERT( m_pEdit == NULL ); } }
void ZProcess::ParseXML_Document( ) { // For each node we store data // If it's a Process Node, and the Root node if ( IsRoot( ) && IsTag( "<PROCESS>" ) ) { // Handle Attributes if ( IsValidAttribute( "name" ) ) SetProcessName( GetAttributeValue( ) ); } // If it's the WriteLog Node in a Process node if ( IsTag( "<WRITELOG>" ) && IsChildOf( "<PROCESS>" ) ) { // Set the WriteLog File Name SetWriteLogValue( GetTextValue( ) ); // Handle Attributes if ( IsValidAttribute( "name" ) ) this->SetWriteLogName( GetAttributeValue( ) ); } // If it's the KillApp Node in a Process node if ( IsTag("<SHUTDOWN>") && IsChildOf( "<PROCESS>") ) { // Set the KillApp command name SetKillAppValue( GetTextValue( ) ); // Handle Attributes if ( IsValidAttribute( "delay" ) ) { int delay; sscanf( GetAttributeValue( ) , "%d" , &delay ); SetKillAppDelay( delay ); } } // If it's the Startup Node in a Process node if ( IsTag("<STARTUP>") && IsChildOf( "<PROCESS>") ) { // Set the Startup command name SetStartupValue( GetTextValue( ) ); // Handle Attributes if ( IsValidAttribute( "delay" ) ) { int delay; sscanf( GetAttributeValue( ) , "%d" , &delay ); SetStartupDelay( delay ); } } // If it's the NOTE node in a PROCESS node if ( IsTag("<NOTE>") && IsChildOf( "<PROCESS>") ) { // do nothing ... just checking } // If it's the CDATA section on NOTE node if ( IsChildOf( "<NOTE>" ) && IsCDataSection( ) ) { // Set the Note value CString val; val = GetTextValue( ); SetNote( val ); } }