2010-05-07 04:47:10 -05:00
|
|
|
/*
|
2021-07-14 13:17:00 -05:00
|
|
|
* Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
|
|
|
|
* All rights reserved. Distributed under the terms of the MIT license.
|
2010-05-07 04:47:10 -05:00
|
|
|
*/
|
|
|
|
|
2021-06-07 13:34:20 -05:00
|
|
|
#include "RunView.h"
|
|
|
|
|
2021-07-14 20:08:14 -05:00
|
|
|
#include <Cursor.h>
|
2021-07-14 22:10:23 -05:00
|
|
|
#include <Locale.h>
|
|
|
|
#include <MenuItem.h>
|
|
|
|
#include <PopUpMenu.h>
|
2021-07-15 13:01:21 -05:00
|
|
|
#include <TextView.h>
|
2021-07-14 20:08:14 -05:00
|
|
|
#include <Window.h>
|
|
|
|
|
2021-06-07 13:34:20 -05:00
|
|
|
|
2021-07-14 22:10:23 -05:00
|
|
|
const uint32 kSearchDdg = 'RVse';
|
|
|
|
const uint32 kSearchDict = 'RVdc';
|
|
|
|
|
|
|
|
|
2021-07-14 13:17:00 -05:00
|
|
|
RunView::RunView(const char* name)
|
2012-10-18 16:04:45 -05:00
|
|
|
:
|
2021-08-01 06:56:07 -05:00
|
|
|
UrlTextView(name),
|
|
|
|
fLastStyled(false)
|
2010-05-07 04:47:10 -05:00
|
|
|
{
|
2021-07-14 13:17:00 -05:00
|
|
|
text_run run = { 0, BFont(), ui_color(B_PANEL_TEXT_COLOR) };
|
|
|
|
fDefaultRun = { 1, {run} };
|
2021-07-14 20:08:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-14 22:10:23 -05:00
|
|
|
void
|
2021-07-25 11:37:17 -05:00
|
|
|
RunView::Append(const char* text, rgb_color color, BFont font)
|
2021-07-14 22:10:23 -05:00
|
|
|
{
|
|
|
|
text_run run = { 0, font, color };
|
|
|
|
text_run_array array = { 1, {run} };
|
|
|
|
|
|
|
|
Insert(text, &array);
|
|
|
|
fLastStyled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-25 11:37:17 -05:00
|
|
|
void
|
|
|
|
RunView::Append(const char* text, rgb_color color, uint16 fontFace)
|
|
|
|
{
|
|
|
|
BFont font;
|
|
|
|
font.SetFace(fontFace);
|
|
|
|
Append(text, color, font);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
RunView::Append(const char* text, rgb_color color)
|
|
|
|
{
|
|
|
|
Append(text, color, BFont());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-14 22:10:23 -05:00
|
|
|
void
|
|
|
|
RunView::Append(const char* text)
|
|
|
|
{
|
|
|
|
if (fLastStyled == false)
|
|
|
|
Insert(text);
|
|
|
|
else
|
|
|
|
Insert(text, &fDefaultRun);
|
|
|
|
fLastStyled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-07-14 20:08:14 -05:00
|
|
|
void
|
|
|
|
RunView::ScrollToBottom()
|
|
|
|
{
|
|
|
|
ScrollToOffset(TextLength());
|
|
|
|
}
|