summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-08-13 13:21:58 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-08-13 13:45:48 +0200
commit178788f19acb56d3baa0a81b051fc5e269334da5 (patch)
tree581b04abaa96c951f50909b2232831bb5c602b72 /Applications
parentca9592d56ffa3f8b01603df020fb8327756eac2b (diff)
downloadserenity-178788f19acb56d3baa0a81b051fc5e269334da5.zip
Terminal: Rename Terminal => TerminalWidget
This makes it a bit less confusing which is what between TerminalWidget and VT::Terminal.
Diffstat (limited to 'Applications')
-rw-r--r--Applications/Terminal/Makefile2
-rw-r--r--Applications/Terminal/TerminalWidget.cpp (renamed from Applications/Terminal/Terminal.cpp)54
-rw-r--r--Applications/Terminal/TerminalWidget.h (renamed from Applications/Terminal/Terminal.h)9
-rw-r--r--Applications/Terminal/main.cpp6
4 files changed, 35 insertions, 36 deletions
diff --git a/Applications/Terminal/Makefile b/Applications/Terminal/Makefile
index baa5eb2148..6d6981a83f 100644
--- a/Applications/Terminal/Makefile
+++ b/Applications/Terminal/Makefile
@@ -1,7 +1,7 @@
include ../../Makefile.common
OBJS = \
- Terminal.o \
+ TerminalWidget.o \
main.o
APP = Terminal
diff --git a/Applications/Terminal/Terminal.cpp b/Applications/Terminal/TerminalWidget.cpp
index 924ba3f748..3b444eb820 100644
--- a/Applications/Terminal/Terminal.cpp
+++ b/Applications/Terminal/TerminalWidget.cpp
@@ -1,4 +1,4 @@
-#include "Terminal.h"
+#include "TerminalWidget.h"
#include "XtermColors.h"
#include <AK/AKString.h>
#include <AK/StdLibExtras.h>
@@ -18,7 +18,7 @@
//#define TERMINAL_DEBUG
-Terminal::Terminal(int ptm_fd, RefPtr<CConfigFile> config)
+TerminalWidget::TerminalWidget(int ptm_fd, RefPtr<CConfigFile> config)
: m_terminal(*this)
, m_ptm_fd(ptm_fd)
, m_notifier(ptm_fd, CNotifier::Read)
@@ -67,7 +67,7 @@ Terminal::Terminal(int ptm_fd, RefPtr<CConfigFile> config)
m_terminal.set_size(m_config->read_num_entry("Window", "Width", 80), m_config->read_num_entry("Window", "Height", 25));
}
-Terminal::~Terminal()
+TerminalWidget::~TerminalWidget()
{
}
@@ -76,14 +76,14 @@ static inline Color lookup_color(unsigned color)
return Color::from_rgb(xterm_colors[color]);
}
-Rect Terminal::glyph_rect(u16 row, u16 column)
+Rect TerminalWidget::glyph_rect(u16 row, u16 column)
{
int y = row * m_line_height;
int x = column * font().glyph_width('x');
return { x + frame_thickness() + m_inset, y + frame_thickness() + m_inset, font().glyph_width('x'), font().glyph_height() };
}
-Rect Terminal::row_rect(u16 row)
+Rect TerminalWidget::row_rect(u16 row)
{
int y = row * m_line_height;
Rect rect = { frame_thickness() + m_inset, y + frame_thickness() + m_inset, font().glyph_width('x') * m_terminal.columns(), font().glyph_height() };
@@ -91,7 +91,7 @@ Rect Terminal::row_rect(u16 row)
return rect;
}
-void Terminal::event(CEvent& event)
+void TerminalWidget::event(CEvent& event)
{
if (event.type() == GEvent::WindowBecameActive || event.type() == GEvent::WindowBecameInactive) {
m_in_active_window = event.type() == GEvent::WindowBecameActive;
@@ -107,7 +107,7 @@ void Terminal::event(CEvent& event)
return GWidget::event(event);
}
-void Terminal::keydown_event(GKeyEvent& event)
+void TerminalWidget::keydown_event(GKeyEvent& event)
{
// Reset timer so cursor doesn't blink while typing.
m_cursor_blink_timer.stop();
@@ -169,7 +169,7 @@ void Terminal::keydown_event(GKeyEvent& event)
}
}
-void Terminal::paint_event(GPaintEvent& event)
+void TerminalWidget::paint_event(GPaintEvent& event)
{
GFrame::paint_event(event);
@@ -214,7 +214,7 @@ void Terminal::paint_event(GPaintEvent& event)
}
}
-void Terminal::set_window_title(const StringView& title)
+void TerminalWidget::set_window_title(const StringView& title)
{
auto* w = window();
if (!w)
@@ -222,12 +222,12 @@ void Terminal::set_window_title(const StringView& title)
w->set_title(title);
}
-void Terminal::invalidate_cursor()
+void TerminalWidget::invalidate_cursor()
{
m_terminal.invalidate_cursor();
}
-void Terminal::flush_dirty_lines()
+void TerminalWidget::flush_dirty_lines()
{
if (m_terminal.m_need_full_flush) {
update();
@@ -242,7 +242,7 @@ void Terminal::flush_dirty_lines()
update(rect);
}
-void Terminal::force_repaint()
+void TerminalWidget::force_repaint()
{
m_needs_background_fill = true;
for (int i = 0; i < m_terminal.rows(); ++i)
@@ -250,26 +250,26 @@ void Terminal::force_repaint()
update();
}
-void Terminal::resize_event(GResizeEvent& event)
+void TerminalWidget::resize_event(GResizeEvent& event)
{
int new_columns = (event.size().width() - frame_thickness() * 2 - m_inset * 2) / font().glyph_width('x');
int new_rows = (event.size().height() - frame_thickness() * 2 - m_inset * 2) / m_line_height;
m_terminal.set_size(new_columns, new_rows);
}
-void Terminal::apply_size_increments_to_window(GWindow& window)
+void TerminalWidget::apply_size_increments_to_window(GWindow& window)
{
window.set_size_increment({ font().glyph_width('x'), m_line_height });
window.set_base_size({ frame_thickness() * 2 + m_inset * 2, frame_thickness() * 2 + m_inset * 2 });
}
-void Terminal::update_cursor()
+void TerminalWidget::update_cursor()
{
invalidate_cursor();
flush_dirty_lines();
}
-void Terminal::set_opacity(u8 new_opacity)
+void TerminalWidget::set_opacity(u8 new_opacity)
{
if (m_opacity == new_opacity)
return;
@@ -279,26 +279,26 @@ void Terminal::set_opacity(u8 new_opacity)
force_repaint();
}
-VT::Position Terminal::normalized_selection_start() const
+VT::Position TerminalWidget::normalized_selection_start() const
{
if (m_selection_start < m_selection_end)
return m_selection_start;
return m_selection_end;
}
-VT::Position Terminal::normalized_selection_end() const
+VT::Position TerminalWidget::normalized_selection_end() const
{
if (m_selection_start < m_selection_end)
return m_selection_end;
return m_selection_start;
}
-bool Terminal::has_selection() const
+bool TerminalWidget::has_selection() const
{
return m_selection_start.is_valid() && m_selection_end.is_valid();
}
-bool Terminal::selection_contains(const VT::Position& position) const
+bool TerminalWidget::selection_contains(const VT::Position& position) const
{
if (!has_selection())
return false;
@@ -306,7 +306,7 @@ bool Terminal::selection_contains(const VT::Position& position) const
return position >= normalized_selection_start() && position <= normalized_selection_end();
}
-VT::Position Terminal::buffer_position_at(const Point& position) const
+VT::Position TerminalWidget::buffer_position_at(const Point& position) const
{
auto adjusted_position = position.translated(-(frame_thickness() + m_inset), -(frame_thickness() + m_inset));
int row = adjusted_position.y() / m_line_height;
@@ -322,7 +322,7 @@ VT::Position Terminal::buffer_position_at(const Point& position) const
return { row, column };
}
-void Terminal::mousedown_event(GMouseEvent& event)
+void TerminalWidget::mousedown_event(GMouseEvent& event)
{
if (event.button() == GMouseButton::Left) {
m_selection_start = buffer_position_at(event.position());
@@ -340,7 +340,7 @@ void Terminal::mousedown_event(GMouseEvent& event)
}
}
-void Terminal::mousemove_event(GMouseEvent& event)
+void TerminalWidget::mousemove_event(GMouseEvent& event)
{
if (!(event.buttons() & GMouseButton::Left))
return;
@@ -351,7 +351,7 @@ void Terminal::mousemove_event(GMouseEvent& event)
update();
}
-void Terminal::mouseup_event(GMouseEvent& event)
+void TerminalWidget::mouseup_event(GMouseEvent& event)
{
if (event.button() != GMouseButton::Left)
return;
@@ -360,7 +360,7 @@ void Terminal::mouseup_event(GMouseEvent& event)
GClipboard::the().set_data(selected_text());
}
-String Terminal::selected_text() const
+String TerminalWidget::selected_text() const
{
StringBuilder builder;
auto start = normalized_selection_start();
@@ -385,7 +385,7 @@ String Terminal::selected_text() const
return builder.to_string();
}
-void Terminal::terminal_did_resize(u16 columns, u16 rows)
+void TerminalWidget::terminal_did_resize(u16 columns, u16 rows)
{
m_pixel_width = (frame_thickness() * 2) + (m_inset * 2) + (columns * font().glyph_width('x'));
m_pixel_height = (frame_thickness() * 2) + (m_inset * 2) + (rows * (font().glyph_height() + m_line_spacing)) - m_line_spacing;
@@ -403,7 +403,7 @@ void Terminal::terminal_did_resize(u16 columns, u16 rows)
ASSERT(rc == 0);
}
-void Terminal::beep()
+void TerminalWidget::beep()
{
if (m_should_beep) {
sysbeep();
diff --git a/Applications/Terminal/Terminal.h b/Applications/Terminal/TerminalWidget.h
index 4bcdbf3c79..2865a2a7d2 100644
--- a/Applications/Terminal/Terminal.h
+++ b/Applications/Terminal/TerminalWidget.h
@@ -9,12 +9,12 @@
#include <LibGUI/GFrame.h>
#include <LibVT/Terminal.h>
-class Terminal final : public GFrame
+class TerminalWidget final : public GFrame
, public VT::TerminalClient {
- C_OBJECT(Terminal)
+ C_OBJECT(TerminalWidget)
public:
- explicit Terminal(int ptm_fd, RefPtr<CConfigFile> config);
- virtual ~Terminal() override;
+ explicit TerminalWidget(int ptm_fd, RefPtr<CConfigFile> config);
+ virtual ~TerminalWidget() override;
void create_window();
@@ -52,7 +52,6 @@ private:
virtual void set_window_title(const StringView&) override;
virtual void terminal_did_resize(u16 columns, u16 rows) override;
-
Rect glyph_rect(u16 row, u16 column);
Rect row_rect(u16 row);
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp
index 37e19c0eaf..689dfb5c30 100644
--- a/Applications/Terminal/main.cpp
+++ b/Applications/Terminal/main.cpp
@@ -1,4 +1,4 @@
-#include "Terminal.h"
+#include "TerminalWidget.h"
#include <Kernel/KeyCode.h>
#include <LibCore/CUserInfo.h>
#include <LibDraw/PNGLoader.h>
@@ -82,7 +82,7 @@ static void make_shell(int ptm_fd)
}
}
-GWindow* create_settings_window(Terminal& terminal, RefPtr<CConfigFile> config)
+GWindow* create_settings_window(TerminalWidget& terminal, RefPtr<CConfigFile> config)
{
auto* window = new GWindow;
window->set_title("Terminal Settings");
@@ -150,7 +150,7 @@ int main(int argc, char** argv)
window->set_double_buffering_enabled(false);
RefPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal");
- auto* terminal = new Terminal(ptm_fd, config);
+ auto* terminal = new TerminalWidget(ptm_fd, config);
window->set_has_alpha_channel(true);
window->set_main_widget(terminal);
window->move_to(300, 300);