undoStudio
The IDE of the undoRT ecosystem
Loading...
Searching...
No Matches
undoApp::Terminal::TerminalView Class Reference

The view of one session. More...

#include <TerminalView.hpp>

Collaboration diagram for undoApp::Terminal::TerminalView:
Collaboration graph

Public Member Functions

void draw (TerminalSession &session, ImFont *font, float &fontSize, bool focused)
 Draw the session inside the current ImGui window.
 
void handleInput (TerminalSession &session, bool focused, float &fontSize, float defaultSize)
 Turn this frame's key presses into what the session should be sent.
 
void copySelection (TerminalSession &session)
 Copy the selection to the clipboard.
 
void paste (TerminalSession &session)
 Paste the clipboard into the session.
 
bool hasSelection () const
 Whether there is a selection to copy.
 

Private Member Functions

void clampSelection ()
 
void zoom (float &fontSize, float notches) const
 
int rowAt (float y) const
 
int colAt (float x) const
 

Private Attributes

Selection m_selection
 Where the drag is, or was.
 
bool m_selecting = false
 A drag is in progress.
 
bool m_hasSelection = false
 A finished selection is still there.
 
bool m_dragging = false
 
int m_viewTop = 0
 First viewport row under the cursor.
 
int m_viewLeft = 0
 First viewport column under the cursor.
 
float m_cellWidth = 0.0f
 
float m_cellHeight = 0.0f
 
float m_fontSize = 0.0f
 Size the glyphs are actually drawn at.
 

Detailed Description

The view of one session.

Member Function Documentation

◆ clampSelection()

void undoApp::Terminal::TerminalView::clampSelection ( )
private

◆ colAt()

int undoApp::Terminal::TerminalView::colAt ( float  x) const
private

◆ copySelection()

void undoApp::Terminal::TerminalView::copySelection ( TerminalSession &  session)

Copy the selection to the clipboard.

Parameters
sessionSession to copy from

◆ draw()

void undoApp::Terminal::TerminalView::draw ( TerminalSession &  session,
ImFont *  font,
float &  fontSize,
bool  focused 
)

Draw the session inside the current ImGui window.

Parameters
sessionSession to draw
fontMonospace font to draw with
fontSizeSize to draw it at, adjusted by Ctrl and the wheel
focusedWhether this pane holds the keyboard

The pane sizes the session to the space it was given, so a resize here is a real terminal resize as far as the shell is concerned. A larger font makes the cells larger and the session smaller: the grid cannot overlap, because every glyph is drawn inside a cell measured from that same font and size.

◆ handleInput()

void undoApp::Terminal::TerminalView::handleInput ( TerminalSession &  session,
bool  focused,
float &  fontSize,
float  defaultSize 
)

Turn this frame's key presses into what the session should be sent.

Parameters
sessionSession to send to
focusedWhether this pane holds the keyboard
fontSizeSize of the terminal, changed by the size keys
defaultSizeSize the reset key returns to

The size keys are answered here rather than in the panel, because the ones that matter arrive as characters and not as keys: on a layout where '+' is its own key, or typed as Shift and '=', the only thing ImGui reports is the character, so a check against a key code never sees it.

◆ hasSelection()

bool undoApp::Terminal::TerminalView::hasSelection ( ) const
inline

Whether there is a selection to copy.

◆ paste()

void undoApp::Terminal::TerminalView::paste ( TerminalSession &  session)

Paste the clipboard into the session.

Parameters
sessionSession to paste into

◆ rowAt()

int undoApp::Terminal::TerminalView::rowAt ( float  y) const
private

◆ zoom()

void undoApp::Terminal::TerminalView::zoom ( float &  fontSize,
float  notches 
) const
private

Member Data Documentation

◆ m_cellHeight

float undoApp::Terminal::TerminalView::m_cellHeight = 0.0f
private

◆ m_cellWidth

float undoApp::Terminal::TerminalView::m_cellWidth = 0.0f
private

◆ m_dragging

bool undoApp::Terminal::TerminalView::m_dragging = false
private

◆ m_fontSize

float undoApp::Terminal::TerminalView::m_fontSize = 0.0f
private

Size the glyphs are actually drawn at.

◆ m_hasSelection

bool undoApp::Terminal::TerminalView::m_hasSelection = false
private

A finished selection is still there.

◆ m_selecting

bool undoApp::Terminal::TerminalView::m_selecting = false
private

A drag is in progress.

◆ m_selection

Selection undoApp::Terminal::TerminalView::m_selection
private

Where the drag is, or was.

◆ m_viewLeft

int undoApp::Terminal::TerminalView::m_viewLeft = 0
private

First viewport column under the cursor.

◆ m_viewTop

int undoApp::Terminal::TerminalView::m_viewTop = 0
private

First viewport row under the cursor.


The documentation for this class was generated from the following file: