コード例 #1
0
ファイル: InputRichEdit.cpp プロジェクト: fffonion/V8
void CInputRichEdit::SetFontInfo(core::MessageFont& FontInfo ) 
{
	SetFontName( FontInfo.font_type ) ;
	SetFontSize( FontInfo.font_size ) ;
	SetFontColor( FontInfo.font_color ) ;

	if ( FontInfo.font_style&core::FONTSTYLETYPE_BOLD )
	{
		SetFontBold( true ) ;
	}
	else
	{
		SetFontBold( false ) ;
	}
	if ( FontInfo.font_style&core::FONTSTYLETYPE_UNDERLINE )
	{
		SetFontItalic( true ) ;
	}
	else
	{
		SetFontItalic( false ) ;
	}
	if ( FontInfo.font_style&core::FONTSTYLETYPE_ITALICS )
	{
		SetFontUnderLine( true ) ;
	}
	else
	{
		SetFontUnderLine( false ) ;
	}

}
コード例 #2
0
void
CBShellEditor::InsertText
	(
	const JString& text
	)
{
	JIndex index;
	const JBoolean hadCaret = GetCaretLocation(&index);

	SetCaretLocation(itsInsertIndex);
	SetCurrentFont(itsInsertFont);
	const JSize count = PasteUNIXTerminalOutput(text);
	SetCurrentFont(GetDefaultFont());
	ClearUndo();

	itsInsertIndex += count;
	if (hadCaret)
		{
		index += count;
		SetCaretLocation(index);
		}

	const JIndex i = itsInsertIndex-1;
	if (GetFontStyle(i).bold)
		{
		SetFontBold(i, i, kJFalse, kJTrue);
		}
}
コード例 #3
0
void
AnnotationObject::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("AnnotationObject");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("objectName")) != 0)
        SetObjectName(node->AsString());
    if((node = searchNode->GetNode("objectType")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 8)
                SetObjectType(AnnotationType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            AnnotationType value;
            if(AnnotationType_FromString(node->AsString(), value))
                SetObjectType(value);
        }
    }
    if((node = searchNode->GetNode("visible")) != 0)
        SetVisible(node->AsBool());
    if((node = searchNode->GetNode("active")) != 0)
        SetActive(node->AsBool());
    if((node = searchNode->GetNode("position")) != 0)
    {
        if(node->GetNodeType() == FLOAT_ARRAY_NODE)
        {
            const float *fn = node->AsFloatArray();
            double dp[3] = {fn[0], fn[1], fn[2]};
            SetPosition(dp);
        }
        else
            SetPosition(node->AsDoubleArray());
    }
    if((node = searchNode->GetNode("position2")) != 0)
    {
        if(node->GetNodeType() == FLOAT_ARRAY_NODE)
        {
            const float *fn = node->AsFloatArray();
            double dp[3] = {fn[0], fn[1], fn[2]};
            SetPosition2(dp);
        }
        else
            SetPosition2(node->AsDoubleArray());
    }
    if((node = searchNode->GetNode("textColor")) != 0)
        textColor.SetFromNode(node);
    if((node = searchNode->GetNode("useForegroundForTextColor")) != 0)
        SetUseForegroundForTextColor(node->AsBool());
    if((node = searchNode->GetNode("color1")) != 0)
        color1.SetFromNode(node);
    if((node = searchNode->GetNode("color2")) != 0)
        color2.SetFromNode(node);
    if((node = searchNode->GetNode("text")) != 0)
        SetText(node->AsStringVector());
    if((node = searchNode->GetNode("fontFamily")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 3)
                SetFontFamily(FontFamily(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            FontFamily value;
            if(FontFamily_FromString(node->AsString(), value))
                SetFontFamily(value);
        }
    }
    if((node = searchNode->GetNode("fontBold")) != 0)
        SetFontBold(node->AsBool());
    if((node = searchNode->GetNode("fontItalic")) != 0)
        SetFontItalic(node->AsBool());
    if((node = searchNode->GetNode("fontShadow")) != 0)
        SetFontShadow(node->AsBool());
    if((node = searchNode->GetNode("floatAttribute1")) != 0)
        SetDoubleAttribute1(node->AsDouble());
    if((node = searchNode->GetNode("doubleAttribute1")) != 0)
        SetDoubleAttribute1(node->AsDouble());
    if((node = searchNode->GetNode("intAttribute1")) != 0)
        SetIntAttribute1(node->AsInt());
    if((node = searchNode->GetNode("intAttribute2")) != 0)
        SetIntAttribute2(node->AsInt());
    if((node = searchNode->GetNode("intAttribute3")) != 0)
        SetIntAttribute3(node->AsInt());
    if((node = searchNode->GetNode("doubleVector1")) != 0)
        SetDoubleVector1(node->AsDoubleVector());
    if((node = searchNode->GetNode("stringVector1")) != 0)
        SetStringVector1(node->AsStringVector());
    if((node = searchNode->GetNode("stringVector2")) != 0)
        SetStringVector2(node->AsStringVector());
}