Mercurial > hg > octave-nkf
changeset 16688:c19cc8c158b3
Allow setting background/forground terminal colors in Unix (bug #39016)
* libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp
(QUnixTerminalImpl::setBackgroundColor): Provided function body.
(QUnixTerminalImpl::setForegroundColor): Provided function body.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sat, 18 May 2013 23:00:19 -0400 |
parents | f4d18d3f7fd7 |
children | e9d0b8252a0a |
files | libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp |
diffstat | 1 files changed, 31 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp +++ b/libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp @@ -137,8 +137,37 @@ // FIXME -- not sure how to make these work properly given the way the // Unix terminal handles colors. -void QUnixTerminalImpl::setBackgroundColor (const QColor& color) { } -void QUnixTerminalImpl::setForegroundColor (const QColor& color) { } +void QUnixTerminalImpl::setBackgroundColor (const QColor& color) + { + ColorEntry cols[TABLE_COLORS]; + + const ColorEntry * curr_cols = m_terminalView->colorTable(); + for(int i=0;i<TABLE_COLORS;i++) + { + cols[i] = curr_cols[i]; + } + + cols[DEFAULT_BACK_COLOR].color = color; + + m_terminalView->setColorTable(cols); + + } +void QUnixTerminalImpl::setForegroundColor (const QColor& color) +{ + ColorEntry cols[TABLE_COLORS]; + + const ColorEntry * curr_cols = m_terminalView->colorTable(); + for(int i=0;i<TABLE_COLORS;i++) + { + cols[i] = curr_cols[i]; + } + + cols[DEFAULT_FORE_COLOR].color = color; + + m_terminalView->setColorTable(cols); + + +} void QUnixTerminalImpl::setSelectionColor (const QColor& color) { } void QUnixTerminalImpl::setCursorColor (bool useForegroundColor,