From 30290e86f560192d19a3d4f9fd963b18efa37486 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 17 Jan 2017 09:09:38 -0500 Subject: [PATCH] allow BufferPane to turn off its status bar --- src/gui/BufferPane.cc | 13 +++++++++++-- src/gui/BufferPane.h | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gui/BufferPane.cc b/src/gui/BufferPane.cc index 5e18b77..377922a 100644 --- a/src/gui/BufferPane.cc +++ b/src/gui/BufferPane.cc @@ -8,13 +8,19 @@ BufferPane::BufferPane(Window * window, std::shared_ptr buffer) m_iterator = buffer->add_cursor(); m_target_column = 0; m_cursor_virtual_column = 0; + m_show_status_bar = true; } void BufferPane::resize(int width, int height) { Pane::resize(width, height); m_columns = std::max(1, m_width / m_window->font()->get_advance()); - m_rows = std::max(1, (m_height - m_window->font()->get_line_height() - 1) / m_window->font()->get_line_height()); + int height_subtract = 0; + if (m_show_status_bar) + { + height_subtract = m_window->font()->get_line_height() + 1; + } + m_rows = std::max(1, (m_height - height_subtract) / m_window->font()->get_line_height()); } void BufferPane::walk_line(const Buffer::Iterator & start_of_line, std::function callback) @@ -288,7 +294,10 @@ void BufferPane::draw() { draw_cursor(col_x(0), row_y(0)); } - draw_status_bar(); + if (m_show_status_bar) + { + draw_status_bar(); + } } int BufferPane::draw_buffer_line(int screen_row, const Buffer::Iterator & start_of_line) diff --git a/src/gui/BufferPane.h b/src/gui/BufferPane.h index afddfc1..b59e6ea 100644 --- a/src/gui/BufferPane.h +++ b/src/gui/BufferPane.h @@ -25,6 +25,10 @@ public: void scroll_window_down(Window::ScrollMode scroll_mode); void undo(); void redo(); + void set_show_status_bar(bool show_status_bar) + { + m_show_status_bar = show_status_bar; + } protected: int effective_scroll_offset() @@ -72,6 +76,7 @@ protected: std::shared_ptr m_iterator; std::list> m_screen_lines; int m_target_column; + bool m_show_status_bar; }; #endif