pass a color pair when displaying an information window
This commit is contained in:
parent
b58f614f40
commit
1822b81d58
|
@ -407,6 +407,7 @@ there are some builtins color aliases:
|
||||||
* +LineNumbers+: colors used by the number_lines highlighter
|
* +LineNumbers+: colors used by the number_lines highlighter
|
||||||
* +MenuForeground+: colors for the selected element in menus
|
* +MenuForeground+: colors for the selected element in menus
|
||||||
* +MenuBackground+: colors for the not selected elements in menus
|
* +MenuBackground+: colors for the not selected elements in menus
|
||||||
|
* +Information+: colors the informations windows
|
||||||
|
|
||||||
Shell expansion
|
Shell expansion
|
||||||
---------------
|
---------------
|
||||||
|
|
|
@ -48,6 +48,7 @@ ColorRegistry::ColorRegistry()
|
||||||
{ "LineNumbers", { Color::Black, Color::White } },
|
{ "LineNumbers", { Color::Black, Color::White } },
|
||||||
{ "MenuForeground", { Color::Blue, Color::Cyan } },
|
{ "MenuForeground", { Color::Blue, Color::Cyan } },
|
||||||
{ "MenuBackground", { Color::Cyan, Color::Blue } },
|
{ "MenuBackground", { Color::Cyan, Color::Blue } },
|
||||||
|
{ "Information", { Color::Black, Color::Yellow } },
|
||||||
}
|
}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -684,7 +684,8 @@ void info(const CommandParameters& params, Context& context)
|
||||||
pos = context.window().display_position(it);
|
pos = context.window().display_position(it);
|
||||||
}
|
}
|
||||||
const String& message = parser.has_option("assist") ? assist(parser[0], dimensions.column) : parser[0];
|
const String& message = parser.has_option("assist") ? assist(parser[0], dimensions.column) : parser[0];
|
||||||
context.ui().info_show(message, pos, style);
|
ColorPair colors = ColorRegistry::instance()["Information"];
|
||||||
|
context.ui().info_show(message, pos, colors, style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,7 +811,7 @@ public:
|
||||||
void menu_select(int) override {}
|
void menu_select(int) override {}
|
||||||
void menu_hide() override {}
|
void menu_hide() override {}
|
||||||
|
|
||||||
void info_show(const String&, const DisplayCoord&, MenuStyle) override {}
|
void info_show(const String&, DisplayCoord, ColorPair, MenuStyle) override {}
|
||||||
void info_hide() override {}
|
void info_hide() override {}
|
||||||
|
|
||||||
DisplayCoord dimensions() override { return { 0, 0 }; }
|
DisplayCoord dimensions() override { return { 0, 0 }; }
|
||||||
|
|
|
@ -485,7 +485,8 @@ static DisplayCoord compute_pos(const DisplayCoord& anchor,
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NCursesUI::info_show(const String& content, const DisplayCoord& anchor, MenuStyle style)
|
void NCursesUI::info_show(const String& content, DisplayCoord anchor,
|
||||||
|
ColorPair colors, MenuStyle style)
|
||||||
{
|
{
|
||||||
assert(m_info_win == nullptr);
|
assert(m_info_win == nullptr);
|
||||||
|
|
||||||
|
@ -498,7 +499,7 @@ void NCursesUI::info_show(const String& content, const DisplayCoord& anchor, Men
|
||||||
m_info_win = newwin((int)size.line, (int)size.column,
|
m_info_win = newwin((int)size.line, (int)size.column,
|
||||||
(int)pos.line, (int)pos.column);
|
(int)pos.line, (int)pos.column);
|
||||||
|
|
||||||
wbkgd(m_info_win, COLOR_PAIR(get_color_pair({ Color::Black, Color::Yellow })));
|
wbkgd(m_info_win, COLOR_PAIR(get_color_pair(colors)));
|
||||||
wmove(m_info_win, 0, 0);
|
wmove(m_info_win, 0, 0);
|
||||||
addutf8str(m_info_win, Utf8Iterator(content.begin()),
|
addutf8str(m_info_win, Utf8Iterator(content.begin()),
|
||||||
Utf8Iterator(content.end()));
|
Utf8Iterator(content.end()));
|
||||||
|
|
|
@ -32,8 +32,8 @@ public:
|
||||||
void menu_select(int selected) override;
|
void menu_select(int selected) override;
|
||||||
void menu_hide() override;
|
void menu_hide() override;
|
||||||
|
|
||||||
void info_show(const String& content,
|
void info_show(const String& content, DisplayCoord anchor,
|
||||||
const DisplayCoord& anchor, MenuStyle style) override;
|
ColorPair colors, MenuStyle style) override;
|
||||||
void info_hide() override;
|
void info_hide() override;
|
||||||
|
|
||||||
void set_input_callback(InputCallback callback) override;
|
void set_input_callback(InputCallback callback) override;
|
||||||
|
|
|
@ -194,8 +194,8 @@ public:
|
||||||
void menu_select(int selected) override;
|
void menu_select(int selected) override;
|
||||||
void menu_hide() override;
|
void menu_hide() override;
|
||||||
|
|
||||||
void info_show(const String& content,
|
void info_show(const String& content, DisplayCoord anchor,
|
||||||
const DisplayCoord& anchor, MenuStyle style) override;
|
ColorPair colors, MenuStyle style) override;
|
||||||
void info_hide() override;
|
void info_hide() override;
|
||||||
|
|
||||||
void draw(const DisplayBuffer& display_buffer,
|
void draw(const DisplayBuffer& display_buffer,
|
||||||
|
@ -260,13 +260,14 @@ void RemoteUI::menu_hide()
|
||||||
msg.write(RemoteUIMsg::MenuHide);
|
msg.write(RemoteUIMsg::MenuHide);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteUI::info_show(const String& content,
|
void RemoteUI::info_show(const String& content, DisplayCoord anchor,
|
||||||
const DisplayCoord& anchor, MenuStyle style)
|
ColorPair colors, MenuStyle style)
|
||||||
{
|
{
|
||||||
Message msg(m_socket_watcher.fd());
|
Message msg(m_socket_watcher.fd());
|
||||||
msg.write(RemoteUIMsg::InfoShow);
|
msg.write(RemoteUIMsg::InfoShow);
|
||||||
msg.write(content);
|
msg.write(content);
|
||||||
msg.write(anchor);
|
msg.write(anchor);
|
||||||
|
msg.write(colors);
|
||||||
msg.write(style);
|
msg.write(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,8 +370,9 @@ void RemoteClient::process_next_message()
|
||||||
{
|
{
|
||||||
auto choices = read<String>(socket);
|
auto choices = read<String>(socket);
|
||||||
auto anchor = read<DisplayCoord>(socket);
|
auto anchor = read<DisplayCoord>(socket);
|
||||||
|
auto colors = read<ColorPair>(socket);
|
||||||
auto style = read<MenuStyle>(socket);
|
auto style = read<MenuStyle>(socket);
|
||||||
m_ui->info_show(choices, anchor, style);
|
m_ui->info_show(choices, anchor, colors, style);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RemoteUIMsg::InfoHide:
|
case RemoteUIMsg::InfoHide:
|
||||||
|
|
|
@ -34,8 +34,8 @@ public:
|
||||||
virtual void menu_select(int selected) = 0;
|
virtual void menu_select(int selected) = 0;
|
||||||
virtual void menu_hide() = 0;
|
virtual void menu_hide() = 0;
|
||||||
|
|
||||||
virtual void info_show(const String& content,
|
virtual void info_show(const String& content, DisplayCoord anchor,
|
||||||
const DisplayCoord& anchor, MenuStyle style) = 0;
|
ColorPair colors, MenuStyle style) = 0;
|
||||||
virtual void info_hide() = 0;
|
virtual void info_hide() = 0;
|
||||||
|
|
||||||
virtual void draw(const DisplayBuffer& display_buffer,
|
virtual void draw(const DisplayBuffer& display_buffer,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user