| 1694 | } |
| 1695 | |
| 1696 | ScintillaEdit *ShaderViewer::MakeEditor(const QString &name, const QString &text, int lang) |
| 1697 | { |
| 1698 | ScintillaEdit *ret = new ScintillaEdit(this); |
| 1699 | |
| 1700 | ret->setMarginLeft(4.0); |
| 1701 | ret->setMarginWidthN(1, 20.0); |
| 1702 | ret->setMarginWidthN(2, 16.0); |
| 1703 | ret->setObjectName(name); |
| 1704 | |
| 1705 | ret->styleSetFont(STYLE_DEFAULT, Formatter::FixedFont().family().toUtf8().data()); |
| 1706 | ret->styleSetSize(STYLE_DEFAULT, Formatter::FixedFont().pointSize()); |
| 1707 | |
| 1708 | // C# DarkGreen |
| 1709 | ret->indicSetFore(INDICATOR_REGHIGHLIGHT, SCINTILLA_COLOUR(0, 100, 0)); |
| 1710 | ret->indicSetStyle(INDICATOR_REGHIGHLIGHT, INDIC_ROUNDBOX); |
| 1711 | |
| 1712 | // set up find result highlight style |
| 1713 | ret->indicSetFore(INDICATOR_FINDRESULT, SCINTILLA_COLOUR(200, 200, 64)); |
| 1714 | ret->indicSetStyle(INDICATOR_FINDRESULT, INDIC_FULLBOX); |
| 1715 | ret->indicSetAlpha(INDICATOR_FINDRESULT, 50); |
| 1716 | ret->indicSetOutlineAlpha(INDICATOR_FINDRESULT, 80); |
| 1717 | |
| 1718 | QColor highlightColor = palette().color(QPalette::Highlight).toRgb(); |
| 1719 | |
| 1720 | ret->indicSetFore( |
| 1721 | INDICATOR_FINDALLHIGHLIGHT, |
| 1722 | SCINTILLA_COLOUR(highlightColor.red(), highlightColor.green(), highlightColor.blue())); |
| 1723 | ret->indicSetStyle(INDICATOR_FINDALLHIGHLIGHT, INDIC_FULLBOX); |
| 1724 | ret->indicSetAlpha(INDICATOR_FINDALLHIGHLIGHT, 120); |
| 1725 | ret->indicSetOutlineAlpha(INDICATOR_FINDALLHIGHLIGHT, 180); |
| 1726 | |
| 1727 | // C# Highlight for bookmarks |
| 1728 | ret->markerSetBack(BOOKMARK_MARKER, SCINTILLA_COLOUR(51, 153, 255)); |
| 1729 | ret->markerDefine(BOOKMARK_MARKER, SC_MARK_BOOKMARK); |
| 1730 | |
| 1731 | ConfigureSyntax(ret, lang); |
| 1732 | |
| 1733 | ret->setTabWidth(4); |
| 1734 | |
| 1735 | ret->setScrollWidth(1); |
| 1736 | ret->setScrollWidthTracking(true); |
| 1737 | |
| 1738 | ret->colourise(0, -1); |
| 1739 | |
| 1740 | SetTextAndUpdateMargin0(ret, text); |
| 1741 | |
| 1742 | ret->emptyUndoBuffer(); |
| 1743 | |
| 1744 | return ret; |
| 1745 | } |
| 1746 | |
| 1747 | void ShaderViewer::SetTextAndUpdateMargin0(ScintillaEdit *sc, const QString &text) |
| 1748 | { |
nothing calls this directly
no test coverage detected