[haiku-commits] haiku: hrev44461 - src/apps/deskcalc

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 3 Aug 2012 10:34:09 +0200 (CEST)

hrev44461 adds 1 changeset to branch 'master'
old head: e19488b2ccb0bfaf518e2c77180905996111a628
new head: 9f5d4ecd972134f48a330f95d8a9a9ea49dbc3a1

----------------------------------------------------------------------------

9f5d4ec: Style fixes, update copyright, add myself as author.
  
  No functional change.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44461
Commit:      9f5d4ecd972134f48a330f95d8a9a9ea49dbc3a1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9f5d4ec
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Wed Aug  1 07:09:22 2012 UTC

----------------------------------------------------------------------------

15 files changed, 53 insertions(+), 56 deletions(-)
src/apps/deskcalc/CalcApplication.cpp    |   12 +++++++-----
src/apps/deskcalc/CalcApplication.h      |    5 +----
src/apps/deskcalc/CalcOptions.cpp        |    6 ++++--
src/apps/deskcalc/CalcOptions.h          |    9 +++------
src/apps/deskcalc/CalcView.cpp           |    3 ++-
src/apps/deskcalc/CalcView.h             |    7 ++-----
src/apps/deskcalc/CalcWindow.cpp         |    6 ++++--
src/apps/deskcalc/CalcWindow.h           |   10 +++-------
src/apps/deskcalc/DeskCalc.cpp           |    4 +++-
src/apps/deskcalc/DeskCalc.rdef          |    2 +-
src/apps/deskcalc/ExpressionTextView.cpp |   22 ++++++++++++++--------
src/apps/deskcalc/ExpressionTextView.h   |    8 +++-----
src/apps/deskcalc/InputTextView.cpp      |    1 +
src/apps/deskcalc/InputTextView.h        |   10 +++-------
src/apps/deskcalc/Jamfile                |    4 ++--

----------------------------------------------------------------------------

diff --git a/src/apps/deskcalc/CalcApplication.cpp 
b/src/apps/deskcalc/CalcApplication.cpp
index 3af4579..9617650 100644
--- a/src/apps/deskcalc/CalcApplication.cpp
+++ b/src/apps/deskcalc/CalcApplication.cpp
@@ -1,20 +1,22 @@
 /*
- * Copyright 2006-2011 Haiku, Inc. All Rights Reserved.
+ * Copyright 2006-2012 Haiku, Inc. All Rights Reserved.
  * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
- *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
  *             Stephan Aßmus <superstippi@xxxxxx>
+ *             John Scipione, jscipione@xxxxxxxxx
+ *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
  */
 
+
 #include "CalcApplication.h"
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
-#include <Catalog.h> 
+#include <Catalog.h>
 #include <Directory.h>
 #include <File.h>
 #include <FindDirectory.h>
@@ -22,9 +24,11 @@
 
 #include "CalcWindow.h"
 
+
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "CalcApplication"
 
+
 static const char* kSettingsFileName   = "DeskCalc_settings";
 const char* kAppSig                            = 
"application/x-vnd.Haiku-DeskCalc";
 
@@ -154,5 +158,3 @@ CalcApplication::_InitSettingsFile(BFile* file, bool write)
 
        return ret;
 }
-
-
diff --git a/src/apps/deskcalc/CalcApplication.h 
b/src/apps/deskcalc/CalcApplication.h
index aef4f7f..4076622 100644
--- a/src/apps/deskcalc/CalcApplication.h
+++ b/src/apps/deskcalc/CalcApplication.h
@@ -2,14 +2,11 @@
  * Copyright 2006 Haiku, Inc. All Rights Reserved.
  * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
  * Distributed under the terms of the MIT License.
- *
- * Authors:
- *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
- *             Stephan Aßmus <superstippi@xxxxxx>
  */
 #ifndef _CALC_APPLICATION_H
 #define _CALC_APPLICATION_H
 
+
 #include <Application.h>
 
 
diff --git a/src/apps/deskcalc/CalcOptions.cpp 
b/src/apps/deskcalc/CalcOptions.cpp
index 3b35379..674ae50 100644
--- a/src/apps/deskcalc/CalcOptions.cpp
+++ b/src/apps/deskcalc/CalcOptions.cpp
@@ -1,13 +1,15 @@
 /*
- * Copyright 2006-2009 Haiku, Inc. All Rights Reserved.
+ * Copyright 2006-2012 Haiku, Inc. All Rights Reserved.
  * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
- *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
  *             Stephan Aßmus <superstippi@xxxxxx>
+ *             John Scipione, jscipione@xxxxxxxxx
+ *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
  */
 
+
 #include "CalcOptions.h"
 
 #include <stdlib.h>
diff --git a/src/apps/deskcalc/CalcOptions.h b/src/apps/deskcalc/CalcOptions.h
index 2fb45a0..c90042e 100644
--- a/src/apps/deskcalc/CalcOptions.h
+++ b/src/apps/deskcalc/CalcOptions.h
@@ -1,18 +1,15 @@
 /*
- * Copyright 2006-2009 Haiku, Inc. All Rights Reserved.
+ * Copyright 2006-2012 Haiku, Inc. All Rights Reserved.
  * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
  * Distributed under the terms of the MIT License.
- *
- * Authors:
- *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
- *             Stephan Aßmus <superstippi@xxxxxx>
  */
-
 #ifndef CALC_OPTIONS_H
 #define CALC_OPTIONS_H
 
+
 #include <SupportDefs.h>
 
+
 enum {
        KEYPAD_MODE_COMPACT,
        KEYPAD_MODE_BASIC,
diff --git a/src/apps/deskcalc/CalcView.cpp b/src/apps/deskcalc/CalcView.cpp
index eba0c41..9aefc6f 100644
--- a/src/apps/deskcalc/CalcView.cpp
+++ b/src/apps/deskcalc/CalcView.cpp
@@ -4,9 +4,10 @@
  * Distributed under the terms of the MIT License.
  *
  * Authors:
- *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
  *             Stephan Aßmus <superstippi@xxxxxx>
  *             Philippe Saint-Pierre, stpere@xxxxxxxxx
+ *             John Scipione, jscipione@xxxxxxxxx
+ *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
  */
 
 
diff --git a/src/apps/deskcalc/CalcView.h b/src/apps/deskcalc/CalcView.h
index f5ffa06..8dfdadc 100644
--- a/src/apps/deskcalc/CalcView.h
+++ b/src/apps/deskcalc/CalcView.h
@@ -2,17 +2,14 @@
  * Copyright 2006 Haiku, Inc. All Rights Reserved.
  * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
  * Distributed under the terms of the MIT License.
- *
- * Authors:
- *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
- *             Stephan Aßmus <superstippi@xxxxxx>
  */
-
 #ifndef _CALC_VIEW_H
 #define _CALC_VIEW_H
 
+
 #include <View.h>
 
+
 enum {
        MSG_OPTIONS_AUTO_NUM_LOCK                               = 'oanl',
        MSG_OPTIONS_AUDIO_FEEDBACK                              = 'oafb',
diff --git a/src/apps/deskcalc/CalcWindow.cpp b/src/apps/deskcalc/CalcWindow.cpp
index d8abc59..84f5f30 100644
--- a/src/apps/deskcalc/CalcWindow.cpp
+++ b/src/apps/deskcalc/CalcWindow.cpp
@@ -1,13 +1,15 @@
 /*
- * Copyright 2006-2011 Haiku, Inc. All Rights Reserved.
+ * Copyright 2006-2012 Haiku, Inc. All Rights Reserved.
  * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
- *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
  *             Stephan Aßmus <superstippi@xxxxxx>
+ *             John Scipione, jscipione@xxxxxxxxx
+ *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
  */
 
+
 #include "CalcWindow.h"
 
 #include <stdlib.h>
diff --git a/src/apps/deskcalc/CalcWindow.h b/src/apps/deskcalc/CalcWindow.h
index e44abaa..680c44b 100644
--- a/src/apps/deskcalc/CalcWindow.h
+++ b/src/apps/deskcalc/CalcWindow.h
@@ -2,18 +2,14 @@
  * Copyright 2006 Haiku, Inc. All Rights Reserved.
  * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
  * Distributed under the terms of the MIT License.
- *
- * Authors:
- *             Timothy Wayper <timmy@xxxxxxxxxxxxxx>
- *             Stephan Aßmus <superstippi@xxxxxx>
  */
-
-
 #ifndef _CALC_WINDOW_H
 #define _CALC_WINDOW_H
 
+
 #include <Window.h>
 
+
 class CalcView;
 
 class CalcWindow : public BWindow {
@@ -21,7 +17,7 @@ class CalcWindow : public BWindow {
                                                                
CalcWindow(BRect frame, BMessage* settings);
        virtual                                         ~CalcWindow();
 
-       virtual void                            MessageReceived(BMessage* 
message);
+       virtual void                            MessageReceived(BMessage* 
message);
        virtual void                            Show();
        virtual bool                            QuitRequested();
 
diff --git a/src/apps/deskcalc/DeskCalc.cpp b/src/apps/deskcalc/DeskCalc.cpp
index eda0500..7b97aa8 100644
--- a/src/apps/deskcalc/DeskCalc.cpp
+++ b/src/apps/deskcalc/DeskCalc.cpp
@@ -8,18 +8,20 @@
  *             Stephan Aßmus <superstippi@xxxxxx>
  */
 
+
 #include <stdio.h>
 
 #include "CalcApplication.h"
 #include "ExpressionParser.h"
 
+
 int
 main(int argc, char* argv[])
 {
        if (argc == 1) {
                // run GUI
                CalcApplication* app = new CalcApplication();
-               
+
                app->Run();
                delete app;
        } else {
diff --git a/src/apps/deskcalc/DeskCalc.rdef b/src/apps/deskcalc/DeskCalc.rdef
index f4299f5..eb159ec 100644
--- a/src/apps/deskcalc/DeskCalc.rdef
+++ b/src/apps/deskcalc/DeskCalc.rdef
@@ -12,7 +12,7 @@ resource app_version {
        internal = 1,
 
        short_info = "DeskCalc",
-       long_info = "DeskCalc ©2006-2011 Haiku, Inc."
+       long_info = "DeskCalc ©2006-2012 Haiku, Inc."
 };
 
 resource app_flags B_SINGLE_LAUNCH;
diff --git a/src/apps/deskcalc/ExpressionTextView.cpp 
b/src/apps/deskcalc/ExpressionTextView.cpp
index fa12cb5..40ca3dc 100644
--- a/src/apps/deskcalc/ExpressionTextView.cpp
+++ b/src/apps/deskcalc/ExpressionTextView.cpp
@@ -4,8 +4,10 @@
  *
  * Authors:
  *             Stephan Aßmus <superstippi@xxxxxx>
+ *             John Scipione, jscipione@xxxxxxxxx
  */
 
+
 #include "ExpressionTextView.h"
 
 #include <new>
@@ -16,6 +18,7 @@
 
 #include "CalcView.h"
 
+
 using std::nothrow;
 
 static const int32 kMaxPreviousExpressions = 20;
@@ -93,7 +96,7 @@ ExpressionTextView::KeyDown(const char* bytes, int32 numBytes)
        // history.
        if (current != Text())
                fHistoryPos = fPreviousExpressions.CountItems();
-               
+
        // If changes where not applied the value has become a new expression
        // note that even if only the left or right arrow keys are pressed the
        // fCurrentValue string will be cleared.
@@ -131,7 +134,7 @@ void
 ExpressionTextView::SetTextRect(BRect rect)
 {
        InputTextView::SetTextRect(rect);
-       
+
        int32 count = fPreviousExpressions.CountItems();
        if (fHistoryPos == count && fCurrentValue.CountChars() > 0)
                SetValue(fCurrentValue.String());
@@ -207,7 +210,7 @@ ExpressionTextView::SetValue(BString value)
                        if (offset == firstDigit + 1) {
                                // if the value is 0.01 or larger then 
scientific notation
                                // won't shorten the string
-                               if (value[firstDigit] != '0' || 
value[firstDigit + 2] != '0' 
+                               if (value[firstDigit] != '0' || 
value[firstDigit + 2] != '0'
                                        || value[firstDigit + 3] != '0') {
                                        exponent = 0;
                                } else {
@@ -236,7 +239,7 @@ ExpressionTextView::SetValue(BString value)
                                        // move the period
                                        value.Remove(offset, 1);
                                        value.Insert('.', 1, firstDigit + 1);
-                                       
+
                                        exponent = offset - (firstDigit + 1);
                                }
                        }
@@ -252,7 +255,7 @@ ExpressionTextView::SetValue(BString value)
                stringWidth = font.StringWidth(value);
                char lastRemovedDigit = '0';
                while (offset > firstDigit && stringWidth > viewWidth) {
-                       if (value[offset] != '.')       
+                       if (value[offset] != '.')
                                lastRemovedDigit = value[offset];
                        value.Remove(offset--, 1);
                        stringWidth = font.StringWidth(value);
@@ -270,9 +273,11 @@ ExpressionTextView::SetValue(BString value)
                        for (; offset >= firstDigit; offset--) {
                                if (value[offset] == '.')
                                        continue;
+
                                digit = (int)(value[offset]) - '0' + 1; // 
ascii to int + 1
                                if (digit != 10)
                                        break;
+
                                value[offset] = '0';
                        }
                        if (digit == 10) {
@@ -285,8 +290,9 @@ ExpressionTextView::SetValue(BString value)
 
                                // remove the exponent value and the last digit
                                offset = value.FindFirst('E');
-                               if (offset == B_ERROR) 
+                               if (offset == B_ERROR)
                                        offset = value.CountChars();
+
                                value.Truncate(--offset);
                                offset--; // offset now points to the last digit
 
@@ -301,6 +307,7 @@ ExpressionTextView::SetValue(BString value)
                                offset = value.FindFirst('E');
                                if (offset == B_ERROR)
                                        offset = value.CountChars();
+
                                offset--;
                        }
                }
@@ -317,7 +324,7 @@ ExpressionTextView::SetValue(BString value)
                }
        }
 
-       // set the new value    
+       // set the new value
        SetExpression(value);
 }
 
@@ -444,4 +451,3 @@ ExpressionTextView::SaveSettings(BMessage* archive) const
        }
        return B_OK;
 }
-
diff --git a/src/apps/deskcalc/ExpressionTextView.h 
b/src/apps/deskcalc/ExpressionTextView.h
index 6e69d3e..cc8d7ee 100644
--- a/src/apps/deskcalc/ExpressionTextView.h
+++ b/src/apps/deskcalc/ExpressionTextView.h
@@ -1,19 +1,17 @@
 /*
  * Copyright 2006 Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
- *
- * Authors:
- *             Stephan Aßmus <superstippi@xxxxxx>
  */
-
 #ifndef EXPRESSION_TEXT_VIEW_H
 #define EXPRESSION_TEXT_VIEW_H
 
+
 #include <List.h>
 #include <String.h>
 
 #include "InputTextView.h"
 
+
 class CalcView;
 
 class ExpressionTextView : public InputTextView {
@@ -62,7 +60,7 @@ class ExpressionTextView : public InputTextView {
                        int32                           fHistoryPos;
                        BString                         fCurrentExpression;
                        BString                         fCurrentValue;
-                       
+
                        bool                            fChangesApplied;
 };
 
diff --git a/src/apps/deskcalc/InputTextView.cpp 
b/src/apps/deskcalc/InputTextView.cpp
index f04100e..92be1e4 100644
--- a/src/apps/deskcalc/InputTextView.cpp
+++ b/src/apps/deskcalc/InputTextView.cpp
@@ -6,6 +6,7 @@
  *             Stephan Aßmus <superstippi@xxxxxx>
  */
 
+
 #include "InputTextView.h"
 
 #include <stdio.h>
diff --git a/src/apps/deskcalc/InputTextView.h 
b/src/apps/deskcalc/InputTextView.h
index a02083f..c46106d 100644
--- a/src/apps/deskcalc/InputTextView.h
+++ b/src/apps/deskcalc/InputTextView.h
@@ -1,17 +1,15 @@
 /*
  * Copyright 2006 Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
- *
- * Authors:
- *             Stephan Aßmus <superstippi@xxxxxx>
  */
-
 #ifndef INPUT_TEXT_VIEW_H
 #define INPUT_TEXT_VIEW_H
 
+
 #include <Invoker.h>
 #include <TextView.h>
 
+
 class InputTextView : public BTextView, public BInvoker {
  public:
                                                                
InputTextView(BRect frame,
@@ -35,7 +33,7 @@ class InputTextView : public BTextView, public BInvoker {
        virtual void                            RevertChanges() = 0;
        virtual void                            ApplyChanges() = 0;
 
-protected:
+ protected:
                                                                // BTextView
        virtual void                            Select(int32 start, int32 
finish);
 
@@ -52,5 +50,3 @@ protected:
 };
 
 #endif // INPUT_TEXT_VIEW_H
-
-
diff --git a/src/apps/deskcalc/Jamfile b/src/apps/deskcalc/Jamfile
index 62b0e64..007f899 100644
--- a/src/apps/deskcalc/Jamfile
+++ b/src/apps/deskcalc/Jamfile
@@ -18,8 +18,8 @@ Application DeskCalc :
 ;
 
 DoCatalogs DeskCalc :
-    x-vnd.Haiku-DeskCalc
-    :
+       x-vnd.Haiku-DeskCalc
+       :
        CalcApplication.cpp
        CalcView.cpp
        CalcWindow.cpp


Other related posts: