Exemplo n.º 1
0
bool ProjectViewModel::GetAttr( const wxDataViewItem& item, unsigned int column, wxDataViewItemAttr& attr ) const
{
    if ( !item.IsOk() )
    {
        return false;
    }

    ProjectViewModelNode *node = static_cast< ProjectViewModelNode* >( item.GetID() );
    HELIUM_ASSERT( node );

    // bold the entry if the node is active
    attr.SetBold( node->m_IsActive );

    // italicize the entry if it is modified
    attr.SetItalic( ( node->GetDocument() && node->GetDocument()->HasChanged() ) );

    Path nodePath = node->GetPath().GetAbsolutePath( m_Project->a_Path.Get() );
    if ( !nodePath.Exists() )
    {
        attr.SetColour( *wxRED );
    }
    else
    {
        attr.SetColour( *wxBLACK );
    }

    return true;
}
Exemplo n.º 2
0
bool ProjectViewModel::GetAttr( const wxDataViewItem& item, unsigned int column, wxDataViewItemAttr& attr ) const
{
	if ( !item.IsOk() )
	{
		return false;
	}

	Asset *node = static_cast< Asset* >( item.GetID() );
	HELIUM_ASSERT( node );

	// bold the entry if the node is active
	attr.SetBold( node->IsPackage() );

	
	if ( node->GetAllFlagsSet( Asset::FLAG_EDITOR_FORCIBLY_LOADED ) )
	{
		attr.SetColour( *wxBLACK );
	}
	else
	{
		attr.SetColour( *wxLIGHT_GREY );
	}
	

	// italicize the entry if it is modified
	attr.SetItalic( node->GetAllFlagsSet( Asset::FLAG_CHANGED_SINCE_LOADED ) );

	if ( node->GetAllFlagsSet( Asset::FLAG_CHANGED_SINCE_LOADED ) )
	{
		attr.SetColour( *wxRED );
	}

	return true;
}
Exemplo n.º 3
0
bool BOM_TABLE_GROUP::GetAttr( unsigned int aFieldId, wxDataViewItemAttr& aAttr ) const
{
    if( GetFieldValue( aFieldId ).Cmp( ROW_MULT_ITEMS ) == 0 )
    {
        aAttr.SetItalic( true );
        aAttr.SetColour( ROW_COLOUR_MULTIPLE_ITEMS );
        return true;
    }

    return BOM_TABLE_ROW::GetAttr( aFieldId, aAttr );
}
Exemplo n.º 4
0
/**
 * Update cell attributes based on parameters of the cell
 * Default implementation highlights cells that have been altered
 */
bool BOM_TABLE_ROW::GetAttr( unsigned int aFieldId, wxDataViewItemAttr& aAttr ) const
{
    auto field = m_columnList->GetColumnById( aFieldId );

    if( HasValueChanged( field ) )
    {
        aAttr.SetBold( true );
        aAttr.SetItalic( true );
        aAttr.SetColour( ROW_COLOUR_ITEM_CHANGED );
        return true;
    }

    return false;
}
Exemplo n.º 5
0
    virtual bool GetAttrByRow( unsigned int row, unsigned int col,
                               wxDataViewItemAttr &attr ) const
	{
		wxColour colors[]={*wxWHITE,wxColor(230,230,230)};
		attr.SetBackgroundColour(colors[(row)%(sizeof(colors)/sizeof(colors[0]))]);
		return true;
	}
Exemplo n.º 6
0
 virtual bool GetAttr(const wxDataViewItem& item, unsigned int col, wxDataViewItemAttr& attr) const
 {
     CompilerPtr compiler = m_dlg->GetCompiler(item);
     if(compiler && m_dlg->IsDefaultCompiler(compiler)) {
         attr.SetBold(true);
         return true;
     }
     return false;
 }
	bool GetAttrByRow(unsigned int row, unsigned int col,
		wxDataViewItemAttr &attr) const
	{
		const WADArchiveEntry& entry = m_archive->GetFilteredEntry(row);
		if (entry.GetStatus() != WADArchiveEntry::Entry_Original)
			attr.SetBold(true);

		return true;
	}
    virtual bool GetAttr(const wxDataViewItem &item,
                         unsigned int col,
                         wxDataViewItemAttr & attr) const {
        if ( col == 1 ) {
            clFunctionImplDetails *cd = dynamic_cast<clFunctionImplDetails*>( GetClientObject(item));
            if ( !cd->IsSelected() ) {
                attr.SetColour( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT ) );
                attr.SetBold(false);

            } else {
                attr.SetBold(true);

            }
            return true;
        } else {
            return false;
        }
    }
bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCol,
        wxDataViewItemAttr& aAttr ) const
{
    if( IsFrozen() )
        return false;

    // change attributes only for the name field
    if( aCol != 0 )
        return false;

    auto node = ToNode( aItem );
    wxCHECK( node, false );

    switch( node->Type )
    {
        case CMP_TREE_NODE::LIB:
            // mark modified libs with bold font
            aAttr.SetBold( m_libMgr->IsLibraryModified( node->Name ) );

#ifdef __WXGTK__
            // The native wxGTK+ impl ignores background colour, so set the text colour instead.
            // This works reasonably well in dark themes, and quite poorly in light ones....
            if( node->Name == m_libMgr->GetCurrentLib() )
                aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#else
            // mark the current library with background color
            if( node->Name == m_libMgr->GetCurrentLib() )
                aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#endif
            break;

        case CMP_TREE_NODE::LIBID:
            // mark modified part with bold font
            aAttr.SetBold( m_libMgr->IsPartModified( node->Name, node->Parent->Name ) );

            // mark aliases with italic font
            aAttr.SetItalic( !node->IsRoot );

#ifdef __WXGTK__
            // The native wxGTK+ impl ignores background colour, so set the text colour instead.
            // This works reasonably well in dark themes, and quite poorly in light ones....
            if( node->LibId == m_libMgr->GetCurrentLibId() )
                aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#else
            // mark the current part with background color
            if( node->LibId == m_libMgr->GetCurrentLibId() )
                aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
#endif
            break;

        default:
            return false;
    }

    return true;
}
Exemplo n.º 10
0
    virtual bool GetAttr(const wxDataViewItem &item,
                         unsigned int col,
                         wxDataViewItemAttr & attr) const {

        if ( col == 1 ) {
            wxVariant v;
            GetValue(v, item, 0);
            if ( !v.GetBool() ) {
                attr.SetColour( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT ) );
                attr.SetBold(false);

            } else {
                attr.SetBold(true);

            }
            return true;

        } else {
            return false;
        }
    }
Exemplo n.º 11
0
bool MyListModel::GetAttrByRow( unsigned int row, unsigned int col,
                                wxDataViewItemAttr &attr ) const
{
    switch ( col )
    {
        case Col_EditableText:
        case Col_Date:
            return false;

        case Col_IconText:
            if ( !(row % 2) )
                return false;
            attr.SetColour(*wxYELLOW);
            attr.SetBackgroundColour(*wxLIGHT_GREY);
            break;

        case Col_TextWithAttr:
        case Col_Custom:
            // do what the labels defined in GetValueByRow() hint at
            switch ( row % 5 )
            {
                case 0:
                    attr.SetColour(*wxBLUE);
                    break;

                case 1:
                    attr.SetColour(*wxGREEN);
                    break;

                case 2:
                    attr.SetColour(*wxRED);
                    break;

                case 3:
                    attr.SetColour(*wxCYAN);
                    attr.SetBold(true);
                    break;

                case 4:
                    return false;
            }
            break;

        case Col_Max:
            wxFAIL_MSG( "invalid column" );
    }

    return true;
}
Exemplo n.º 12
0
bool PMBUSCMDListModel::GetAttrByRow(unsigned int row, unsigned int col,
	wxDataViewItemAttr &attr) const
{
	switch (col)
	{
	case Col_Toggle:
		return false;
		break;
	case Col_RegisterIconText:
		//if (!(row % 2))
			//return false;
		attr.SetColour(*wxBLUE);

		break;

	case Col_QueryText:
		if (this->m_pmBusCommand[row].m_cmdStatus.m_support == cmd_unsupport){
			attr.SetColour(*wxRED);
		}
		else{
			
			switch (this->m_pmBusCommand[row].m_dataFormat.m_formatType){

			case cmd_data_format_LinearData_Format:

				attr.SetColour(wxColour( 0, 0, 255));

				break;

			case cmd_data_format_DirectData_Format:

				attr.SetColour(wxColour(255, 0, 255));

				break;

			case cmd_data_format_16bit_Signed_Number:
			case cmd_data_format_8bit_Unsigned_Number:
			case cmd_data_format_VID_Mode:
			case cmd_data_format_Manufacturer_Specific:
			case cmd_data_format_Reserved:
			case cmd_data_format_Don_t_Return_Numeric_Data:

				attr.SetColour(wxColour(68, 160, 119));

				break;

			default:
				PSU_DEBUG_PRINT(MSG_ERROR, "Something Error Occurs");
				break;
			}
			
		}

		break;

	case Col_NameText:
	case Col_AccessText:
	case Col_CoefficientsText:
	case Col_CookText:
	case Col_RawText: 
		return false;
		break;

	case Col_Date:
		return false;

	case Col_TextWithAttr:
	case Col_Custom:
		// do what the labels defined in GetValueByRow() hint at
		switch (row % 5)
		{
		case 0:
			attr.SetColour(*wxBLUE);
			break;

		case 1:
			attr.SetColour(*wxGREEN);
			break;

		case 2:
			attr.SetColour(*wxRED);
			break;

		case 3:
			attr.SetColour(*wxCYAN);
			attr.SetBold(true);
			break;

		case 4:
			return false;
		}
		break;

	case Col_Max:
		wxFAIL_MSG("invalid column");
	}

	return true;
}