Style fixes, update copyright, add myself as author.
No functional change.
This commit is contained in:
@@ -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.
|
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Timothy Wayper <[email protected]>
|
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
|
* John Scipione, [email protected]
|
||||||
|
* Timothy Wayper <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "CalcApplication.h"
|
#include "CalcApplication.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -22,9 +24,11 @@
|
|||||||
|
|
||||||
#include "CalcWindow.h"
|
#include "CalcWindow.h"
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "CalcApplication"
|
#define B_TRANSLATION_CONTEXT "CalcApplication"
|
||||||
|
|
||||||
|
|
||||||
static const char* kSettingsFileName = "DeskCalc_settings";
|
static const char* kSettingsFileName = "DeskCalc_settings";
|
||||||
const char* kAppSig = "application/x-vnd.Haiku-DeskCalc";
|
const char* kAppSig = "application/x-vnd.Haiku-DeskCalc";
|
||||||
|
|
||||||
@@ -154,5 +158,3 @@ CalcApplication::_InitSettingsFile(BFile* file, bool write)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,11 @@
|
|||||||
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
||||||
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Timothy Wayper <[email protected]>
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
#ifndef _CALC_APPLICATION_H
|
#ifndef _CALC_APPLICATION_H
|
||||||
#define _CALC_APPLICATION_H
|
#define _CALC_APPLICATION_H
|
||||||
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Timothy Wayper <[email protected]>
|
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
|
* John Scipione, [email protected]
|
||||||
|
* Timothy Wayper <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "CalcOptions.h"
|
#include "CalcOptions.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.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.
|
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Timothy Wayper <[email protected]>
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CALC_OPTIONS_H
|
#ifndef CALC_OPTIONS_H
|
||||||
#define CALC_OPTIONS_H
|
#define CALC_OPTIONS_H
|
||||||
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
KEYPAD_MODE_COMPACT,
|
KEYPAD_MODE_COMPACT,
|
||||||
KEYPAD_MODE_BASIC,
|
KEYPAD_MODE_BASIC,
|
||||||
|
|||||||
@@ -4,9 +4,10 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Timothy Wayper <[email protected]>
|
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
* Philippe Saint-Pierre, [email protected]
|
* Philippe Saint-Pierre, [email protected]
|
||||||
|
* John Scipione, [email protected]
|
||||||
|
* Timothy Wayper <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,14 @@
|
|||||||
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
||||||
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Timothy Wayper <[email protected]>
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _CALC_VIEW_H
|
#ifndef _CALC_VIEW_H
|
||||||
#define _CALC_VIEW_H
|
#define _CALC_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MSG_OPTIONS_AUTO_NUM_LOCK = 'oanl',
|
MSG_OPTIONS_AUTO_NUM_LOCK = 'oanl',
|
||||||
MSG_OPTIONS_AUDIO_FEEDBACK = 'oafb',
|
MSG_OPTIONS_AUDIO_FEEDBACK = 'oafb',
|
||||||
|
|||||||
@@ -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.
|
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Timothy Wayper <[email protected]>
|
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
|
* John Scipione, [email protected]
|
||||||
|
* Timothy Wayper <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "CalcWindow.h"
|
#include "CalcWindow.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
@@ -2,18 +2,14 @@
|
|||||||
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
||||||
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
* Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Timothy Wayper <[email protected]>
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _CALC_WINDOW_H
|
#ifndef _CALC_WINDOW_H
|
||||||
#define _CALC_WINDOW_H
|
#define _CALC_WINDOW_H
|
||||||
|
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
class CalcView;
|
class CalcView;
|
||||||
|
|
||||||
class CalcWindow : public BWindow {
|
class CalcWindow : public BWindow {
|
||||||
@@ -21,7 +17,7 @@ class CalcWindow : public BWindow {
|
|||||||
CalcWindow(BRect frame, BMessage* settings);
|
CalcWindow(BRect frame, BMessage* settings);
|
||||||
virtual ~CalcWindow();
|
virtual ~CalcWindow();
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void Show();
|
virtual void Show();
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,13 @@
|
|||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "CalcApplication.h"
|
#include "CalcApplication.h"
|
||||||
#include "ExpressionParser.h"
|
#include "ExpressionParser.h"
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ resource app_version {
|
|||||||
internal = 1,
|
internal = 1,
|
||||||
|
|
||||||
short_info = "DeskCalc",
|
short_info = "DeskCalc",
|
||||||
long_info = "DeskCalc ©2006-2011 Haiku, Inc."
|
long_info = "DeskCalc ©2006-2012 Haiku, Inc."
|
||||||
};
|
};
|
||||||
|
|
||||||
resource app_flags B_SINGLE_LAUNCH;
|
resource app_flags B_SINGLE_LAUNCH;
|
||||||
|
|||||||
@@ -4,8 +4,10 @@
|
|||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
|
* John Scipione, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ExpressionTextView.h"
|
#include "ExpressionTextView.h"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
@@ -16,6 +18,7 @@
|
|||||||
|
|
||||||
#include "CalcView.h"
|
#include "CalcView.h"
|
||||||
|
|
||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
|
|
||||||
static const int32 kMaxPreviousExpressions = 20;
|
static const int32 kMaxPreviousExpressions = 20;
|
||||||
@@ -270,9 +273,11 @@ ExpressionTextView::SetValue(BString value)
|
|||||||
for (; offset >= firstDigit; offset--) {
|
for (; offset >= firstDigit; offset--) {
|
||||||
if (value[offset] == '.')
|
if (value[offset] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
digit = (int)(value[offset]) - '0' + 1; // ascii to int + 1
|
digit = (int)(value[offset]) - '0' + 1; // ascii to int + 1
|
||||||
if (digit != 10)
|
if (digit != 10)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
value[offset] = '0';
|
value[offset] = '0';
|
||||||
}
|
}
|
||||||
if (digit == 10) {
|
if (digit == 10) {
|
||||||
@@ -287,6 +292,7 @@ ExpressionTextView::SetValue(BString value)
|
|||||||
offset = value.FindFirst('E');
|
offset = value.FindFirst('E');
|
||||||
if (offset == B_ERROR)
|
if (offset == B_ERROR)
|
||||||
offset = value.CountChars();
|
offset = value.CountChars();
|
||||||
|
|
||||||
value.Truncate(--offset);
|
value.Truncate(--offset);
|
||||||
offset--; // offset now points to the last digit
|
offset--; // offset now points to the last digit
|
||||||
|
|
||||||
@@ -301,6 +307,7 @@ ExpressionTextView::SetValue(BString value)
|
|||||||
offset = value.FindFirst('E');
|
offset = value.FindFirst('E');
|
||||||
if (offset == B_ERROR)
|
if (offset == B_ERROR)
|
||||||
offset = value.CountChars();
|
offset = value.CountChars();
|
||||||
|
|
||||||
offset--;
|
offset--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,4 +451,3 @@ ExpressionTextView::SaveSettings(BMessage* archive) const
|
|||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EXPRESSION_TEXT_VIEW_H
|
#ifndef EXPRESSION_TEXT_VIEW_H
|
||||||
#define EXPRESSION_TEXT_VIEW_H
|
#define EXPRESSION_TEXT_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
#include "InputTextView.h"
|
#include "InputTextView.h"
|
||||||
|
|
||||||
|
|
||||||
class CalcView;
|
class CalcView;
|
||||||
|
|
||||||
class ExpressionTextView : public InputTextView {
|
class ExpressionTextView : public InputTextView {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "InputTextView.h"
|
#include "InputTextView.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
* Copyright 2006 Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef INPUT_TEXT_VIEW_H
|
#ifndef INPUT_TEXT_VIEW_H
|
||||||
#define INPUT_TEXT_VIEW_H
|
#define INPUT_TEXT_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <Invoker.h>
|
#include <Invoker.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
|
|
||||||
class InputTextView : public BTextView, public BInvoker {
|
class InputTextView : public BTextView, public BInvoker {
|
||||||
public:
|
public:
|
||||||
InputTextView(BRect frame,
|
InputTextView(BRect frame,
|
||||||
@@ -35,7 +33,7 @@ class InputTextView : public BTextView, public BInvoker {
|
|||||||
virtual void RevertChanges() = 0;
|
virtual void RevertChanges() = 0;
|
||||||
virtual void ApplyChanges() = 0;
|
virtual void ApplyChanges() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// BTextView
|
// BTextView
|
||||||
virtual void Select(int32 start, int32 finish);
|
virtual void Select(int32 start, int32 finish);
|
||||||
|
|
||||||
@@ -52,5 +50,3 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // INPUT_TEXT_VIEW_H
|
#endif // INPUT_TEXT_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ Application DeskCalc :
|
|||||||
;
|
;
|
||||||
|
|
||||||
DoCatalogs DeskCalc :
|
DoCatalogs DeskCalc :
|
||||||
x-vnd.Haiku-DeskCalc
|
x-vnd.Haiku-DeskCalc
|
||||||
:
|
:
|
||||||
CalcApplication.cpp
|
CalcApplication.cpp
|
||||||
CalcView.cpp
|
CalcView.cpp
|
||||||
CalcWindow.cpp
|
CalcWindow.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user