From 70f7a8ad0f5ae85b18c2ae9ad9b0d45f7f87522c Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 20 Nov 2009 19:47:24 +0000 Subject: [PATCH] Cleanup: removed unused messages constant and classes, merged AppearPrefView with PrefView, moved main from Terminal.cpp to TermApp.cpp. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34163 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/AppearPrefView.cpp | 11 ++-- src/apps/terminal/AppearPrefView.h | 25 ++++++-- src/apps/terminal/Jamfile | 3 - src/apps/terminal/PrefView.cpp | 88 --------------------------- src/apps/terminal/PrefView.h | 90 ---------------------------- src/apps/terminal/PrefWindow.cpp | 2 - src/apps/terminal/TTextControl.cpp | 84 -------------------------- src/apps/terminal/TTextControl.h | 59 ------------------ src/apps/terminal/TermApp.cpp | 10 ++++ 9 files changed, 36 insertions(+), 336 deletions(-) delete mode 100644 src/apps/terminal/PrefView.cpp delete mode 100644 src/apps/terminal/PrefView.h delete mode 100644 src/apps/terminal/TTextControl.cpp delete mode 100644 src/apps/terminal/TTextControl.h diff --git a/src/apps/terminal/AppearPrefView.cpp b/src/apps/terminal/AppearPrefView.cpp index 464a1d740c..98eb8fdc0a 100644 --- a/src/apps/terminal/AppearPrefView.cpp +++ b/src/apps/terminal/AppearPrefView.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -29,10 +30,10 @@ AppearancePrefView::AppearancePrefView(const char *name, const BMessenger &messenger) - : PrefView(name), + : BView(name, B_WILL_DRAW), fTerminalMessenger(messenger) { - const char *color_tbl[] = { + const char *kColorTable[] = { PREF_TEXT_FORE_COLOR, PREF_TEXT_BACK_COLOR, PREF_CURSOR_FORE_COLOR, @@ -72,8 +73,8 @@ AppearancePrefView::AppearancePrefView(const char *name, .Add(fFont = new BMenuField("font", "Font:", fontMenu)) .Add(fFontSize = new BMenuField("size", "Size:", sizeMenu)) .Add(fColorField = new BMenuField("color", "Color:", - MakeMenu(MSG_COLOR_FIELD_CHANGED, color_tbl, - color_tbl[0]))) + MakeMenu(MSG_COLOR_FIELD_CHANGED, kColorTable, + kColorTable[0]))) .Add(fColorControl = new BColorControl(BPoint(10, 10), B_CELLS_32x8, 8.0, "", new BMessage(MSG_COLOR_CHANGED))) .End(); @@ -183,7 +184,7 @@ AppearancePrefView::MessageReceived(BMessage *msg) break; default: - PrefView::MessageReceived(msg); + BView::MessageReceived(msg); return; } diff --git a/src/apps/terminal/AppearPrefView.h b/src/apps/terminal/AppearPrefView.h index 228e5d7ee1..dcdbe1d50b 100644 --- a/src/apps/terminal/AppearPrefView.h +++ b/src/apps/terminal/AppearPrefView.h @@ -8,16 +8,31 @@ #define APPEARANCE_PREF_VIEW_H -#include "PrefView.h" +#include +#include +#include + + +// +// Appearance Message +// +const ulong MSG_HALF_FONT_CHANGED = 'mchf'; +const ulong MSG_HALF_SIZE_CHANGED = 'mchs'; +const ulong MSG_FULL_FONT_CHANGED = 'mcff'; +const ulong MSG_FULL_SIZE_CHANGED = 'mcfs'; +const ulong MSG_COLOR_FIELD_CHANGED = 'mccf'; +const ulong MSG_COLOR_CHANGED = 'mcbc'; + + +const ulong MSG_PREF_MODIFIED = 'mpmo'; + + class BColorControl; class BMenu; class BMenuField; -class TTextControl; - - -class AppearancePrefView : public PrefView { +class AppearancePrefView : public BView { public: AppearancePrefView(const char *name, const BMessenger &messenger); diff --git a/src/apps/terminal/Jamfile b/src/apps/terminal/Jamfile index fe3daa8c63..0ca9a628e0 100644 --- a/src/apps/terminal/Jamfile +++ b/src/apps/terminal/Jamfile @@ -14,9 +14,7 @@ Application Terminal : Globals.cpp HistoryBuffer.cpp MenuUtil.cpp - Terminal.cpp PrefHandler.cpp - PrefView.cpp PrefWindow.cpp Shell.cpp SmartTabView.cpp @@ -27,7 +25,6 @@ Application Terminal : TermScrollView.cpp TermView.cpp TermWindow.cpp - TTextControl.cpp UTF8WidthTbl.c VTKeyTbl.c VTPrsTbl.c diff --git a/src/apps/terminal/PrefView.cpp b/src/apps/terminal/PrefView.cpp deleted file mode 100644 index 63a87d1a0a..0000000000 --- a/src/apps/terminal/PrefView.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2007 Haiku - * Copyright (c) 2003-4 Kian Duffy - * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files or portions - * thereof (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject - * to the following conditions: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice - * in the binary, as well as this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with - * the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#include "PrefView.h" - -#include "PrefHandler.h" -#include "TermConst.h" -#include "TTextControl.h" - -#include -#include -#include - - -PrefView::PrefView(const char *name) - :BView(name, B_WILL_DRAW) -{ - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); -} - - -//////////////////////////////////////////////////////////////////////////// -// ~PrefView () -// Destructor. -//////////////////////////////////////////////////////////////////////////// -PrefView::~PrefView() -{ -} - - - -//////////////////////////////////////////////////////////////////////////// -// CanApply() -// Determines whether view can reply to Apply command or not. -//////////////////////////////////////////////////////////////////////////// -bool -PrefView::CanApply() -{ - return true; -} - - -void -PrefView::MessageReceived(BMessage* msg) -{ - switch (msg->what) { - case MSG_TEXT_MODIFIED: { - TTextControl* textControl; - BControl *control; - if (msg->FindPointer("source", (void**)&control) >= B_OK - && (textControl = dynamic_cast(control))) { - textControl->ModifiedText(true); - } - break; - } - - default: - BView::MessageReceived(msg); - } -} diff --git a/src/apps/terminal/PrefView.h b/src/apps/terminal/PrefView.h deleted file mode 100644 index 0d0e7cc9fb..0000000000 --- a/src/apps/terminal/PrefView.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2003-4 Kian Duffy - * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files or portions - * thereof (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject - * to the following conditions: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice - * in the binary, as well as this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with - * the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#ifndef PREFVIEW_H_INCLUDED -#define PREFVIEW_H_INCLUDED - -#include -#include -#include - -class PrefHandler; -class BRect; -class BBox; -class TTextControl; -class BStringView; -class BRadioButton; -class BButton; -class BCheckBox; -class BMenuField; - -enum { - PREF_APP_VIEW, - PREF_SHELL_VIEW, - PREF_LANG_VIEW -}; - -// -// Appearance Message -// -const ulong MSG_HALF_FONT_CHANGED = 'mchf'; -const ulong MSG_HALF_SIZE_CHANGED = 'mchs'; -const ulong MSG_FULL_FONT_CHANGED = 'mcff'; -const ulong MSG_FULL_SIZE_CHANGED = 'mcfs'; -const ulong MSG_COLOR_FIELD_CHANGED = 'mccf'; -const ulong MSG_COLOR_CHANGED = 'mcbc'; - -// -// ShellMessage -// -const ulong MSG_COLS_CHANGED = 'mccl'; -const ulong MSG_ROWS_CHANGED = 'mcrw'; -const ulong MSG_HISTORY_CHANGED = 'mhst'; - -const ulong MSG_LANG_CHANGED = 'mclg'; -const ulong MSG_INPUT_METHOD_CHANGED = 'mcim'; - -// -// TextControl Modification Message. -// -const ulong MSG_TEXT_MODIFIED = 'tcmm'; -const ulong MSG_PREF_MODIFIED = 'mpmo'; - - -class PrefView : public BView { -public: - PrefView(const char *name); - virtual ~PrefView(); - virtual bool CanApply(); - virtual void MessageReceived(BMessage *msg); - -}; - -#endif //PREFVIEW_H_INCLUDED diff --git a/src/apps/terminal/PrefWindow.cpp b/src/apps/terminal/PrefWindow.cpp index 0479407b67..928a6762f9 100644 --- a/src/apps/terminal/PrefWindow.cpp +++ b/src/apps/terminal/PrefWindow.cpp @@ -9,7 +9,6 @@ #include "AppearPrefView.h" #include "PrefHandler.h" #include "PrefWindow.h" -#include "PrefView.h" #include "TermConst.h" #include @@ -150,7 +149,6 @@ PrefWindow::_Revert() fTerminalMessenger.SendMessage(MSG_HALF_FONT_CHANGED); fTerminalMessenger.SendMessage(MSG_COLOR_CHANGED); - fTerminalMessenger.SendMessage(MSG_INPUT_METHOD_CHANGED); fDirty = false; } diff --git a/src/apps/terminal/TTextControl.cpp b/src/apps/terminal/TTextControl.cpp deleted file mode 100644 index 376deddead..0000000000 --- a/src/apps/terminal/TTextControl.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2003-4 Kian Duffy - * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files or portions - * thereof (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject - * to the following conditions: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice - * in the binary, as well as this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with - * the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#include -#include "TTextControl.h" - -/************************************************************************ - * - * CONSTRUCTOR and DESTRUCTOR - * - ***********************************************************************/ - -//////////////////////////////////////////////////////////////////////////// -// TTextControl () -// Constructor. -//////////////////////////////////////////////////////////////////////////// -TTextControl::TTextControl (BRect r, const char *name, - const char *label, const char *text, - BMessage *msg) - :BTextControl (r, name, label, text, msg) -{ - mModified = false; -} - -//////////////////////////////////////////////////////////////////////////// -// ~TTextControl () -// Destructor. -//////////////////////////////////////////////////////////////////////////// -TTextControl::~TTextControl () -{ -} - -/* - * PUBLIC MEMBER FUNCTIONS. - */ - -//////////////////////////////////////////////////////////////////////////// -// ModifiedText (int) -// Dispatch modification message. -//////////////////////////////////////////////////////////////////////////// -void -TTextControl::ModifiedText (int flag) -{ - mModified = flag; - return; -} - -//////////////////////////////////////////////////////////////////////////// -// IsModified (void) -// Dispatch modification message. -//////////////////////////////////////////////////////////////////////////// -int -TTextControl::IsModified (void) -{ - return mModified; -} - diff --git a/src/apps/terminal/TTextControl.h b/src/apps/terminal/TTextControl.h deleted file mode 100644 index 602f72b9e6..0000000000 --- a/src/apps/terminal/TTextControl.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003-4 Kian Duffy - * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files or portions - * thereof (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject - * to the following conditions: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice - * in the binary, as well as this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with - * the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#ifndef TTEXTCTL_H_INCLUDED -#define TTEXTCTL_H_INCLUDED -#include - -class TTextControl : public BTextControl -{ -public: - // - // Constructor and Desctructor - // - TTextControl (BRect, const char *, const char *, - const char *, BMessage *); - ~TTextControl (); - - // - // public member functions. - // - void ModifiedText (int); - int IsModified (void); - -private: - // - // Data member. - // - int mModified; - -}; - -#endif /* TTEXT_CTL_H_INCLUDED */ diff --git a/src/apps/terminal/TermApp.cpp b/src/apps/terminal/TermApp.cpp index ececce679e..f9e5bf5899 100644 --- a/src/apps/terminal/TermApp.cpp +++ b/src/apps/terminal/TermApp.cpp @@ -40,6 +40,16 @@ const ulong MSG_ACTIVATE_TERM = 'msat'; const ulong MSG_TERM_WINDOW_INFO = 'mtwi'; +int +main() +{ + TermApp app; + app.Run(); + + return 0; +} + + TermApp::TermApp() : BApplication(TERM_SIGNATURE), fStartFullscreen(false),