Remove unused NotifyingTextView class

This commit is contained in:
Jaidyn Ann 2021-07-29 22:47:30 -05:00
parent 420340b6b4
commit ebc9d4041f
7 changed files with 6 additions and 147 deletions

View File

@ -24,8 +24,6 @@
#include <StringView.h> #include <StringView.h>
#include <TextControl.h> #include <TextControl.h>
#include <libinterface/NotifyingTextView.h>
#include "ChatProtocol.h" #include "ChatProtocol.h"
#include "ChatProtocolAddOn.h" #include "ChatProtocolAddOn.h"
#include "Utils.h" #include "Utils.h"
@ -219,8 +217,7 @@ ProtocolTemplate::Load(BView* parent, BMessage* settings)
B_WILL_DRAW); B_WILL_DRAW);
layout.Add(label); layout.Add(label);
NotifyingTextView* textView BTextView* textView = new BTextView(name);
= new NotifyingTextView(name);
control = new BScrollView("NA", textView, 0, false, true); control = new BScrollView("NA", textView, 0, false, true);
textView->SetText(value); textView->SetText(value);
} }
@ -314,8 +311,7 @@ ProtocolTemplate::Save(BView* parent, BMessage* settings, BString* errorText)
if (checkBox) if (checkBox)
settings->AddBool(name, (checkBox->Value() == B_CONTROL_ON)); settings->AddBool(name, (checkBox->Value() == B_CONTROL_ON));
NotifyingTextView* textView BTextView* textView = dynamic_cast<BTextView*>(view);
= dynamic_cast<NotifyingTextView*>(view);
if (textView) if (textView)
settings->AddString(name, textView->Text()); settings->AddString(name, textView->Text());
} }

View File

@ -135,8 +135,6 @@ AccountDialog::MessageReceived(BMessage* msg)
case kCancel: case kCancel:
Close(); Close();
break; break;
case kChanged:
break;
default: default:
BWindow::MessageReceived(msg); BWindow::MessageReceived(msg);
} }

View File

@ -20,8 +20,6 @@
#include <TextControl.h> #include <TextControl.h>
#include <Window.h> #include <Window.h>
#include <libinterface/NotifyingTextView.h>
TemplateView::TemplateView(const char* name) TemplateView::TemplateView(const char* name)
: BView(name, B_WILL_DRAW) : BView(name, B_WILL_DRAW)
@ -42,8 +40,7 @@ TemplateView::AttachedToWindow()
= dynamic_cast<BMenuField*>(child); = dynamic_cast<BMenuField*>(child);
BTextControl* textControl BTextControl* textControl
= dynamic_cast<BTextControl*>(child); = dynamic_cast<BTextControl*>(child);
NotifyingTextView* textView BTextView* textView = dynamic_cast<BTextView*>(child);
= dynamic_cast<NotifyingTextView*>(child);
BCheckBox* checkBox = dynamic_cast<BCheckBox*>(child); BCheckBox* checkBox = dynamic_cast<BCheckBox*>(child);
if (menuField) if (menuField)
@ -52,34 +49,19 @@ TemplateView::AttachedToWindow()
if (menu) { if (menu) {
if (i == 0) if (i == 0)
menu->MakeFocus(true); menu->MakeFocus(true);
for (int32 j = 0; j < menu->CountItems(); j++) {
BMenuItem* item = menu->ItemAt(j);
item->SetMessage(new BMessage(kChanged));
item->SetTarget(Window());
}
menu->SetTargetForItems(Window()); menu->SetTargetForItems(Window());
} }
if (textControl) { if (textControl)
if (i == 0) if (i == 0)
textControl->MakeFocus(true); textControl->MakeFocus(true);
textControl->SetMessage(new BMessage(kChanged));
textControl->SetTarget(Window());
}
if (checkBox) { if (checkBox)
if (i == 0) if (i == 0)
checkBox->MakeFocus(true); checkBox->MakeFocus(true);
checkBox->SetMessage(new BMessage(kChanged));
checkBox->SetTarget(Window());
}
if (textView) { if (textView)
if (i == 0) if (i == 0)
textView->MakeFocus(true); textView->MakeFocus(true);
textView->SetMessage(new BMessage(kChanged));
textView->SetTarget(Window());
}
} }
} }

View File

@ -8,9 +8,6 @@
#include <View.h> #include <View.h>
const uint32 kChanged = 'CHGD';
class TemplateView : public BView { class TemplateView : public BView {
public: public:
TemplateView(const char* name); TemplateView(const char* name);

View File

@ -38,7 +38,6 @@ SRCS = \
libs/libinterface/Divider.cpp \ libs/libinterface/Divider.cpp \
libs/libinterface/EnterTextView.cpp \ libs/libinterface/EnterTextView.cpp \
libs/libinterface/MenuButton.cpp \ libs/libinterface/MenuButton.cpp \
libs/libinterface/NotifyingTextView.cpp \
libs/libinterface/PictureView.cpp libs/libinterface/PictureView.cpp
# Specify the resource definition files to use. Full or relative paths can be # Specify the resource definition files to use. Full or relative paths can be

View File

@ -1,77 +0,0 @@
/*
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
* Copyright 2009, Michael Davidson. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Michael Davidson, slaad@bong.com.au
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
*/
#include <Messenger.h>
#include "NotifyingTextView.h"
NotifyingTextView::NotifyingTextView(const char* name, uint32 flags)
: BTextView(name, flags),
fMessenger(NULL)
{
}
NotifyingTextView::~NotifyingTextView()
{
if (fMessenger != NULL)
delete fMessenger;
}
void
NotifyingTextView::SetTarget(const BHandler* handler)
{
if (fMessenger != NULL)
delete fMessenger;
fMessenger = new BMessenger(handler);
}
BMessage*
NotifyingTextView::Message() const
{
return fMessage;
}
void
NotifyingTextView::SetMessage(BMessage* msg)
{
fMessage = msg;
}
void
NotifyingTextView::InsertText(const char* text, int32 length,
int32 offset, const text_run_array* runs)
{
if ((fMessenger != NULL) && fMessenger->IsValid()) {
BMessage msg(*fMessage);
msg.AddPointer("source", this);
fMessenger->SendMessage(&msg);
}
BTextView::InsertText(text, length, offset, runs);
}
void
NotifyingTextView::DeleteText(int32 start, int32 finish)
{
if ((fMessenger != NULL) && fMessenger->IsValid()) {
BMessage msg(*fMessage);
msg.AddPointer("source", this);
fMessenger->SendMessage(&msg);
}
BTextView::DeleteText(start, finish);
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
* Copyright 2009, Michael Davidson. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NOTIFYING_TEXT_VIEW_H
#define _NOTIFYING_TEXT_VIEW_H
#include <Handler.h>
#include <Message.h>
#include <TextView.h>
class BMessenger;
class NotifyingTextView : public BTextView {
public:
NotifyingTextView(const char* name, uint32 flags
= B_WILL_DRAW | B_PULSE_NEEDED);
~NotifyingTextView();
void SetTarget(const BHandler* handler);
BMessage* Message() const;
void SetMessage(BMessage* msg);
protected:
virtual void InsertText(const char* text, int32 length,
int32 offset, const text_run_array* runs = NULL);
virtual void DeleteText(int32 start, int32 finish);
private:
BMessenger* fMessenger;
BMessage* fMessage;
};
#endif // _NOTIFYING_TEXT_VIEW_H