damiensellier/CtrlrX

Method editor: space between methods and methods fonts

Opened this issue · 0 comments

Space between methods
CtrlrX - UIComponents - CtrlrValueTreeEditor.h
Change line 13
virtual const int getItemHeight(const ValueTree &item) const { return (32); }
Changed from 32 (5.6.30) to 24 to come closer to 5.3.201 density

Fonts used to display the methods in the tree
CtrlrX - UIComponents - CtrlrLua - MethodEditor - CtrlrLuaMethodEditor.cpp at about line 703

5.3.201: Method= Font(12.0f, Font::plain) size= Font(10.0f, Font::italic) Group= Font(14.0f, Font::plain) Group children= Font(10.0f, Font::italic)
5.6.30: Method= fNormal, size=fSmall Group=fNormal

const AttributedString CtrlrLuaMethodEditor::getDisplayString(const ValueTree &item)	const
{
	AttributedString str;

//	5.6.30 original
// 	Font fNormal = owner.getOwner().getFontManager().getDefaultNormalFont();
//	Font fSmall = owner.getOwner().getFontManager().getDefaultSmallFont();

//	Back to 5.3.201...
	Font fNormal = Font(12.0f, Font::plain);
	Font fMedium = Font(14.0f, Font::plain);
	Font fSmall = Font(10.0f, Font::plain);
	Font fSmallItalic = Font(10.0f, Font::italic);

	if (item.getType () == Ids::luaMethod)
	{
		Colour text;

		if ((bool)item.getProperty(Ids::luaMethodValid) == false)
			text = Colours::red;
		else
			text = Colours::black;

		str.append (item.getProperty(Ids::luaMethodName).toString()+"\n", fNormal, text);

		if ((int)item.getProperty(Ids::luaMethodSource) == CtrlrLuaMethod::codeInFile)
		{
//			str.append(File::descriptionOfSizeInBytes(owner.getLuaMethodSourceFile(&item).getSize()), fSmall, text.brighter(0.2f));
			str.append(File::descriptionOfSizeInBytes(owner.getLuaMethodSourceFile(&item).getSize()), fSmallItalic, text.brighter(0.2f));
		}
		else
		{
			str.append (File::descriptionOfSizeInBytes (item.getProperty(Ids::luaMethodCode).toString().length()), fSmall, text.brighter(0.2f));
		}

		str.setJustification (Justification::left);
	}

	if (item.getType() == Ids::luaMethodGroup)
	{
//		str.append(item.getProperty(Ids::name), fNormal, Colours::black);
		str.append(item.getProperty(Ids::name), fMedium, Colours::black);
		str.append (" ["+String(item.getNumChildren())+"]", fSmall, Colours::darkgrey);

		str.setJustification (Justification::left);
	}

	if (item.getType() == Ids::luaManagerMethods)
	{
		str.append ("LUA", fMedium.boldened(), Colours::black);

		str.setJustification (Justification::left);
	}

	return (str);
}