From c6b0a589df98b29405084ccb4a1d67dddd693648 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Tue, 21 Jan 2014 20:11:22 -0500 Subject: [PATCH] Pairs: Style fixes and update copyright headers. Update long description in rdef --- src/apps/pairs/Pairs.cpp | 18 ++++++++++++++++-- src/apps/pairs/Pairs.h | 23 ++++++++++++++++------- src/apps/pairs/Pairs.rdef | 3 +-- src/apps/pairs/PairsGlobal.h | 9 +++++++-- src/apps/pairs/PairsTopButton.cpp | 8 ++++++-- src/apps/pairs/PairsTopButton.h | 7 ++++++- src/apps/pairs/PairsView.cpp | 8 +++++++- src/apps/pairs/PairsView.h | 7 ++++++- src/apps/pairs/PairsWindow.cpp | 28 +++++++++++++++++----------- src/apps/pairs/PairsWindow.h | 10 ++++++++-- 10 files changed, 90 insertions(+), 31 deletions(-) diff --git a/src/apps/pairs/Pairs.cpp b/src/apps/pairs/Pairs.cpp index 0857716530..561f0fd178 100644 --- a/src/apps/pairs/Pairs.cpp +++ b/src/apps/pairs/Pairs.cpp @@ -1,19 +1,30 @@ /* * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. - * All rights reserved. Distributed under the terms of the MIT License. + * Copyright 2014 Haiku, Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com */ + +#include "Pairs.h" + #include #include #include -#include "Pairs.h" #include "PairsWindow.h" + const char* kSignature = "application/x-vnd.Haiku-Pairs"; +// #pragma mark - Pairs + + Pairs::Pairs() : BApplication(kSignature), @@ -49,6 +60,9 @@ Pairs::MessageReceived(BMessage* message) } +// #pragma mark - main + + int main(void) { diff --git a/src/apps/pairs/Pairs.h b/src/apps/pairs/Pairs.h index 0b58ec0c98..58d8309791 100644 --- a/src/apps/pairs/Pairs.h +++ b/src/apps/pairs/Pairs.h @@ -1,29 +1,38 @@ /* * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. - * All rights reserved. Distributed under the terms of the MIT License. + * Copyright 2014 Haiku, Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com */ #ifndef PAIRS_H #define PAIRS_H + #include #include + extern const char* kSignature; + class BMessage; class PairsWindow; class Pairs : public BApplication { public: - Pairs(); - virtual ~Pairs(); + Pairs(); + virtual ~Pairs(); - virtual void ReadyToRun(); - virtual void RefsReceived(BMessage* message); - virtual void MessageReceived(BMessage* message); + virtual void ReadyToRun(); + virtual void RefsReceived(BMessage* message); + virtual void MessageReceived(BMessage* message); private: - PairsWindow* fWindow; + PairsWindow* fWindow; }; + #endif // PAIRS_H diff --git a/src/apps/pairs/Pairs.rdef b/src/apps/pairs/Pairs.rdef index e61a448762..29f7ba2e53 100644 --- a/src/apps/pairs/Pairs.rdef +++ b/src/apps/pairs/Pairs.rdef @@ -18,7 +18,7 @@ resource app_version { internal = 1, short_info = "Pairs", - long_info = "Pairs, ©2008-2009 Haiku Inc." + long_info = "Pairs, ©2008 Ralf Schülke, ©2010 Adam Smith, ©2014 Haiku, Inc." }; @@ -41,4 +41,3 @@ resource vector_icon { $"070108000A060107000A0001041815FF01178400040A00010418001501178600" $"040A040104000A0301090815FF" }; - diff --git a/src/apps/pairs/PairsGlobal.h b/src/apps/pairs/PairsGlobal.h index cce15aea62..af97f6ca3e 100644 --- a/src/apps/pairs/PairsGlobal.h +++ b/src/apps/pairs/PairsGlobal.h @@ -1,11 +1,16 @@ /* * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. - * All rights reserved. Distributed under the terms of the MIT License. + * Copyright 2014 Haiku, Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com */ - #ifndef PAIRS_GLOBAL_H #define PAIRS_GLOBAL_H + #include diff --git a/src/apps/pairs/PairsTopButton.cpp b/src/apps/pairs/PairsTopButton.cpp index 37ecb6002b..f066c0cfca 100644 --- a/src/apps/pairs/PairsTopButton.cpp +++ b/src/apps/pairs/PairsTopButton.cpp @@ -1,7 +1,11 @@ /* - * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. - * All rights reserved. + * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. + * Copyright 2014 Haiku, Inc. All rights reserved. + * * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com */ #include diff --git a/src/apps/pairs/PairsTopButton.h b/src/apps/pairs/PairsTopButton.h index dea5003aa6..32632d1d4c 100644 --- a/src/apps/pairs/PairsTopButton.h +++ b/src/apps/pairs/PairsTopButton.h @@ -1,6 +1,11 @@ /* * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. - * All rights reserved. Distributed under the terms of the MIT License. + * Copyright 2014 Haiku, Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com */ #ifndef PAIRS_TOP_BUTTON_H #define PAIRS_TOP_BUTTON_H diff --git a/src/apps/pairs/PairsView.cpp b/src/apps/pairs/PairsView.cpp index 64074be72c..2e1ba0e51b 100644 --- a/src/apps/pairs/PairsView.cpp +++ b/src/apps/pairs/PairsView.cpp @@ -1,9 +1,15 @@ /* * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. * Copyright 2010 Adam Smith - * All rights reserved. Distributed under the terms of the MIT License. + * Copyright 2014 Haiku, Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com */ + #include "PairsView.h" #include diff --git a/src/apps/pairs/PairsView.h b/src/apps/pairs/PairsView.h index 624ae229e5..cbcef74719 100644 --- a/src/apps/pairs/PairsView.h +++ b/src/apps/pairs/PairsView.h @@ -1,7 +1,12 @@ /* * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. * Copyright 2010 Adam Smith - * All rights reserved. Distributed under the terms of the MIT License. + * Copyright 2014 Haiku, Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com */ #ifndef PAIRS_VIEW_H #define PAIRS_VIEW_H diff --git a/src/apps/pairs/PairsWindow.cpp b/src/apps/pairs/PairsWindow.cpp index 5679b7150c..2a11514487 100644 --- a/src/apps/pairs/PairsWindow.cpp +++ b/src/apps/pairs/PairsWindow.cpp @@ -1,9 +1,15 @@ /* * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. * Copyright 2010 Adam Smith - * All rights reserved. Distributed under the terms of the MIT License. + * Copyright 2014 Haiku, Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com */ + #include "PairsWindow.h" #include @@ -25,17 +31,18 @@ #include "PairsTopButton.h" -// #pragma mark - PairsWindow - - #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "PairsWindow" + const uint32 MENU_NEW = 'MGnw'; const uint32 MENU_SIZE = 'MGsz'; const uint32 MENU_QUIT = 'MGqu'; +// #pragma mark - PairsWindow + + PairsWindow::PairsWindow() : BWindow(BRect(100, 100, 405, 423), B_TRANSLATE_SYSTEM_NAME("Pairs"), @@ -152,6 +159,7 @@ PairsWindow::MessageReceived(BMessage* message) case MENU_NEW: NewGame(); break; + case MENU_SIZE: { int32 width; @@ -162,9 +170,11 @@ PairsWindow::MessageReceived(BMessage* message) } break; } + case MENU_QUIT: be_app->PostMessage(B_QUIT_REQUESTED); break; + case kMsgCardButton: if (fIsPairsActive) { fButtonClicks++; @@ -225,7 +235,7 @@ PairsWindow::MessageReceived(BMessage* message) "\tCopyright 2008-2010, Haiku Inc.\n" "\n" "You completed the game in %num% clicks.\n"); - + strAbout.ReplaceFirst("%app%", B_TRANSLATE_SYSTEM_NAME("Pairs")); strAbout.ReplaceFirst("%num%", score); @@ -248,18 +258,14 @@ PairsWindow::MessageReceived(BMessage* message) view->ResizeToPreferred(); alert->SetShortcut(0, B_ESCAPE); - if (alert->Go() == 0) { - // New game + if (alert->Go() == 0) NewGame(); - } else { - // Quit game + else be_app->PostMessage(B_QUIT_REQUESTED); - } } break; default: BWindow::MessageReceived(message); - break; } } diff --git a/src/apps/pairs/PairsWindow.h b/src/apps/pairs/PairsWindow.h index ed7cb5f7b6..633e0dcd3b 100644 --- a/src/apps/pairs/PairsWindow.h +++ b/src/apps/pairs/PairsWindow.h @@ -1,14 +1,20 @@ /* * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com. * Copyright 2010 Adam Smith - * All rights reserved. Distributed under the terms of the MIT License. + * Copyright 2014 Haiku, Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com */ - #ifndef PAIRS_WINDOW_H #define PAIRS_WINDOW_H + #include + class PairsView; class BMessageRunner;