From ebc9d4041f5eeacbecfae80209e8841e1822748f Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Thu, 29 Jul 2021 22:47:30 -0500 Subject: [PATCH] Remove unused NotifyingTextView class --- application/ProtocolTemplate.cpp | 8 +-- application/preferences/AccountDialog.cpp | 2 - application/views/TemplateView.cpp | 26 ++------ application/views/TemplateView.h | 3 - libs/libinterface/Makefile | 1 - libs/libinterface/NotifyingTextView.cpp | 77 ----------------------- libs/libinterface/NotifyingTextView.h | 36 ----------- 7 files changed, 6 insertions(+), 147 deletions(-) delete mode 100644 libs/libinterface/NotifyingTextView.cpp delete mode 100644 libs/libinterface/NotifyingTextView.h diff --git a/application/ProtocolTemplate.cpp b/application/ProtocolTemplate.cpp index 2a7c8fb..0588b68 100644 --- a/application/ProtocolTemplate.cpp +++ b/application/ProtocolTemplate.cpp @@ -24,8 +24,6 @@ #include #include -#include - #include "ChatProtocol.h" #include "ChatProtocolAddOn.h" #include "Utils.h" @@ -219,8 +217,7 @@ ProtocolTemplate::Load(BView* parent, BMessage* settings) B_WILL_DRAW); layout.Add(label); - NotifyingTextView* textView - = new NotifyingTextView(name); + BTextView* textView = new BTextView(name); control = new BScrollView("NA", textView, 0, false, true); textView->SetText(value); } @@ -314,8 +311,7 @@ ProtocolTemplate::Save(BView* parent, BMessage* settings, BString* errorText) if (checkBox) settings->AddBool(name, (checkBox->Value() == B_CONTROL_ON)); - NotifyingTextView* textView - = dynamic_cast(view); + BTextView* textView = dynamic_cast(view); if (textView) settings->AddString(name, textView->Text()); } diff --git a/application/preferences/AccountDialog.cpp b/application/preferences/AccountDialog.cpp index 4e1d0e2..251063f 100644 --- a/application/preferences/AccountDialog.cpp +++ b/application/preferences/AccountDialog.cpp @@ -135,8 +135,6 @@ AccountDialog::MessageReceived(BMessage* msg) case kCancel: Close(); break; - case kChanged: - break; default: BWindow::MessageReceived(msg); } diff --git a/application/views/TemplateView.cpp b/application/views/TemplateView.cpp index 1707627..952a0eb 100644 --- a/application/views/TemplateView.cpp +++ b/application/views/TemplateView.cpp @@ -20,8 +20,6 @@ #include #include -#include - TemplateView::TemplateView(const char* name) : BView(name, B_WILL_DRAW) @@ -42,8 +40,7 @@ TemplateView::AttachedToWindow() = dynamic_cast(child); BTextControl* textControl = dynamic_cast(child); - NotifyingTextView* textView - = dynamic_cast(child); + BTextView* textView = dynamic_cast(child); BCheckBox* checkBox = dynamic_cast(child); if (menuField) @@ -52,34 +49,19 @@ TemplateView::AttachedToWindow() if (menu) { if (i == 0) 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()); } - if (textControl) { + if (textControl) if (i == 0) textControl->MakeFocus(true); - textControl->SetMessage(new BMessage(kChanged)); - textControl->SetTarget(Window()); - } - if (checkBox) { + if (checkBox) if (i == 0) checkBox->MakeFocus(true); - checkBox->SetMessage(new BMessage(kChanged)); - checkBox->SetTarget(Window()); - } - if (textView) { + if (textView) if (i == 0) textView->MakeFocus(true); - textView->SetMessage(new BMessage(kChanged)); - textView->SetTarget(Window()); - } } } diff --git a/application/views/TemplateView.h b/application/views/TemplateView.h index a232b6a..587d05e 100644 --- a/application/views/TemplateView.h +++ b/application/views/TemplateView.h @@ -8,9 +8,6 @@ #include -const uint32 kChanged = 'CHGD'; - - class TemplateView : public BView { public: TemplateView(const char* name); diff --git a/libs/libinterface/Makefile b/libs/libinterface/Makefile index da0cf93..6041a29 100644 --- a/libs/libinterface/Makefile +++ b/libs/libinterface/Makefile @@ -38,7 +38,6 @@ SRCS = \ libs/libinterface/Divider.cpp \ libs/libinterface/EnterTextView.cpp \ libs/libinterface/MenuButton.cpp \ - libs/libinterface/NotifyingTextView.cpp \ libs/libinterface/PictureView.cpp # Specify the resource definition files to use. Full or relative paths can be diff --git a/libs/libinterface/NotifyingTextView.cpp b/libs/libinterface/NotifyingTextView.cpp deleted file mode 100644 index b61d8d5..0000000 --- a/libs/libinterface/NotifyingTextView.cpp +++ /dev/null @@ -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 - -#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); -} diff --git a/libs/libinterface/NotifyingTextView.h b/libs/libinterface/NotifyingTextView.h deleted file mode 100644 index 792779b..0000000 --- a/libs/libinterface/NotifyingTextView.h +++ /dev/null @@ -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 -#include -#include - -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