<commit_before>/*
 * Copyright 2002-2012, Haiku, Inc. All Rights Reserved.
 * Distributed under the terms of the MIT License.
 *
 * Authors:
 *		<NAME>
 *		<NAME>
 *
 * Copied from Haiku commit a609673ce8c942d91e14f24d1d8832951ab27964.
 * Modifications:
 * Copyright 2018 <NAME> <<EMAIL>>
 * Distributed under the terms of the MIT License.
 */


#include "StatusView.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <Catalog.h>
#include <ControlLook.h>
#include <DirMenu.h>
#include <MenuItem.h>
#include <Message.h>
#include <Messenger.h>
#include <PopUpMenu.h>
#include <ScrollView.h>
#include <StringView.h>
#include <Window.h>

#include "EditorWindow.h"


const float kHorzSpacing = 5.f;

using namespace BPrivate;


#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "StatusView"


StatusView::StatusView(BScrollView* scrollView)
			:
			BView(BRect(), "statusview",
				B_FOLLOW_BOTTOM | B_FOLLOW_LEFT, B_WILL_DRAW),
			fScrollView(scrollView),
			fPreferredSize(0., 0.),
			fReadOnly(false),
			fNavigationPressed(false),
			fNavigationButtonWidth(B_H_SCROLL_BAR_HEIGHT)
{
	memset(fCellWidth, 0, sizeof(fCellWidth));
}


StatusView::~StatusView()
{
}


void
StatusView::AttachedToWindow()
{
	SetFont(be_plain_font);
	SetFontSize(10.);

	BMessage message(UPDATE_STATUS);
	message.AddInt32("line", 1);
	message.AddInt32("column", 1);
	message.AddString("type", "");
	SetStatus(&message);

	BScrollBar* scrollBar = fScrollView->ScrollBar(B_HORIZONTAL);
	MoveTo(0., scrollBar->Frame().top);

	rgb_color color = B_TRANSPARENT_COLOR;
	BView* parent = Parent();
	if (parent != NULL)
		color = parent->ViewColor();

	if (color == B_TRANSPARENT_COLOR)
		color = ui_color(B_PANEL_BACKGROUND_COLOR);

	SetViewColor(color);

	ResizeToPreferred();
}


void
StatusView::GetPreferredSize(float* _width, float* _height)
{
	_ValidatePreferredSize();

	if (_width)
		*_width = fPreferredSize.width;

	if (_height)
		*_height = fPreferredSize.height;
}<commit_msg>Fix automatic color updates for status bar<commit_after>/*
 * Copyright 2002-2012, Haiku, Inc. All Rights Reserved.
 * Distributed under the terms of the MIT License.
 *
 * Authors:
 *		<NAME>
 *		<NAME>
 *
 * Copied from Haiku commit a609673ce8c942d91e14f24d1d8832951ab27964.
 * Modifications:
 * Copyright 2018 <NAME> <<EMAIL>>
 * Distributed under the terms of the MIT License.
 */


#include "StatusView.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <Catalog.h>
#include <ControlLook.h>
#include <DirMenu.h>
#include <MenuItem.h>
#include <Message.h>
#include <Messenger.h>
#include <PopUpMenu.h>
#include <ScrollView.h>
#include <StringView.h>
#include <Window.h>

#include "EditorWindow.h"


const float kHorzSpacing = 5.f;

using namespace BPrivate;


#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "StatusView"


StatusView::StatusView(BScrollView* scrollView)
			:
			BView(BRect(), "statusview",
				B_FOLLOW_BOTTOM | B_FOLLOW_LEFT, B_WILL_DRAW),
			fScrollView(scrollView),
			fPreferredSize(0., 0.),
			fReadOnly(false),
			fNavigationPressed(false),
			fNavigationButtonWidth(B_H_SCROLL_BAR_HEIGHT)
{
	memset(fCellWidth, 0, sizeof(fCellWidth));
}


StatusView::~StatusView()
{
}


void
StatusView::AttachedToWindow()
{
	SetFont(be_plain_font);
	SetFontSize(10.);

	BMessage message(UPDATE_STATUS);
	message.AddInt32("line", 1);
	message.AddInt32("column", 1);
	message.AddString("type", "");
	SetStatus(&message);

	BScrollBar* scrollBar = fScrollView->ScrollBar(B_HORIZONTAL);
	MoveTo(0., scrollBar->Frame().top);

	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

	ResizeToPreferred();
}


void
StatusView::GetPreferredSize(float* _width, float* _height)
{
	_ValidatePreferredSize();

	if (_width)
		*_width = fPreferredSize.width;

	if (_height)
		*_height = fPreferredSize.height;
}
{'fraction_non_alphanumeric': 0.13548218029350104, 'fraction_numerical': 0.02830188679245283, 'mean_word_length': 5.513651877133106, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1654973', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1415, 'n_words': 280}