Skip to content

Commit

Permalink
remove console scrollbar setting
Browse files Browse the repository at this point in the history
  • Loading branch information
chmodsayshello committed Sep 4, 2024
1 parent 73695ee commit a78eba2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
4 changes: 0 additions & 4 deletions builtin/settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -759,10 +759,6 @@ clickable_chat_weblinks (Chat weblinks) bool true
# Optional override for chat weblink color.
chat_weblink_color (Weblink color) string #8888FF

# Whether or not to display a scrollbar in the chatwindow.
# Recommended for mobile players.
chat_scrollbar (Show chat scrollbar) bool false

# Font size of the recent chat text and chat prompt in point (pt).
# Value 0 will use the default font size.
chat_font_size (Chat font size) int 0 0 72
Expand Down
1 change: 0 additions & 1 deletion src/defaultsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ void set_default_settings()
settings->setDefault("occlusion_culler", "bfs");
settings->setDefault("enable_raytraced_culling", "true");
settings->setDefault("chat_weblink_color", "#8888FF");
settings->setDefault("chat_scrollbar", "true");

// Keymap
settings->setDefault("remote_port", "30000");
Expand Down
14 changes: 4 additions & 10 deletions src/gui/guiChatConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ GUIChatConsole::GUIChatConsole(
m_is_ctrl_down = false;
m_cache_clickable_chat_weblinks = g_settings->getBool("clickable_chat_weblinks");

m_scrollbar_enabled = g_settings->getBool("chat_scrollbar");
m_scrollbar = new GUIScrollBar(env, this, -1, core::rect<s32>(0, 0, 30, m_height), false, true, tsrc);
m_scrollbar->setSubElement(true);
m_scrollbar->setLargeStep(1);
Expand Down Expand Up @@ -235,9 +234,7 @@ void GUIChatConsole::reformatConsole()
if (cols <= 0 || rows <= 0)
cols = rows = 0;

if (m_scrollbar_enabled) {
m_scrollbar->setRelativePosition(core::rect<s32> (m_screensize.X - 32, 0, m_screensize.X, m_height));
}
m_scrollbar->setRelativePosition(core::rect<s32> (m_screensize.X - 32, 0, m_screensize.X, m_height));

recalculateConsolePosition();
m_chat_backend->reformat(cols, rows);
Expand Down Expand Up @@ -350,7 +347,7 @@ void GUIChatConsole::drawText()


core::recti rect;
if (m_scrollbar_enabled && m_scrollbar->isVisible())
if (m_scrollbar->isVisible())
// leave 4 pixels of space between scrollbar and text
rect = core::rect<s32> (0, 0, m_screensize.X - 32 - 4, m_height);
else
Expand Down Expand Up @@ -743,7 +740,7 @@ void GUIChatConsole::setVisible(bool visible)
m_height = 0;
recalculateConsolePosition();
}
m_scrollbar->setVisible(visible && m_scrollbar_enabled);
m_scrollbar->setVisible(visible);
}

bool GUIChatConsole::weblinkClick(s32 col, s32 row)
Expand Down Expand Up @@ -818,12 +815,9 @@ void GUIChatConsole::updatePrimarySelection()

void GUIChatConsole::updateScrollbar()
{
if (!m_scrollbar_enabled)
return;

m_scrollbar->setMin(m_chat_backend->getConsoleBuffer().getTopScrollPos());
m_scrollbar->setMax(m_chat_backend->getConsoleBuffer().getBottomScrollPos());
m_scrollbar->setPos(m_chat_backend->getConsoleBuffer().getScrollPosition());
m_scrollbar->setVisible(m_scrollbar_enabled && m_scrollbar->getMin() != m_scrollbar->getMax());
m_scrollbar->setVisible(m_scrollbar->getMin() != m_scrollbar->getMax());
m_scrollbar->setPageSize(m_fontsize.Y * m_chat_backend->getConsoleBuffer().getLineCount());
}
2 changes: 0 additions & 2 deletions src/gui/guiChatConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,4 @@ class GUIChatConsole : public gui::IGUIElement
bool m_cache_clickable_chat_weblinks;
// Track if a ctrl key is currently held down
bool m_is_ctrl_down;
// Render a scrollbar (mainly for Android)
bool m_scrollbar_enabled;
};

0 comments on commit a78eba2

Please sign in to comment.