* Style fixes. Encountered ambiguous cases, please see my following questions

in the commit ml.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33923 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner
2009-11-06 17:32:07 +00:00
parent f7ace4e827
commit accec9a7ae
11 changed files with 93 additions and 94 deletions
+7 -4
View File
@@ -30,7 +30,8 @@ static const float kDefaultWindowHeight = 140.0;
CalcApplication::CalcApplication()
: BApplication(kAppSig),
:
BApplication(kAppSig),
fCalcWindow(NULL)
{
}
@@ -128,6 +129,7 @@ CalcApplication::_SaveSettings()
}
}
status_t
CalcApplication::_InitSettingsFile(BFile* file, bool write)
{
@@ -141,9 +143,10 @@ CalcApplication::_InitSettingsFile(BFile* file, bool write)
if (ret < B_OK)
return ret;
if (write)
ret = file->SetTo(prefsPath.Path(), B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
else
if (write) {
ret = file->SetTo(prefsPath.Path(),
B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
} else
ret = file->SetTo(prefsPath.Path(), B_READ_ONLY);
return ret;
+2 -1
View File
@@ -17,7 +17,8 @@
CalcOptions::CalcOptions()
: auto_num_lock(false),
:
auto_num_lock(false),
audio_feedback(false),
show_keypad(true)
{
+14 -19
View File
@@ -80,7 +80,8 @@ struct CalcView::CalcKey {
};
CalcView *CalcView::Instantiate(BMessage *archive)
CalcView*
CalcView::Instantiate(BMessage* archive)
{
if (!validate_instantiation(archive, "CalcView"))
return NULL;
@@ -545,8 +546,8 @@ CalcView::MouseDown(BPoint point)
int gridRow = (int)floorf((point.y - sizeDisp) / sizeRow);
// check limits
if ((gridCol >= 0) && (gridCol < fColums) &&
(gridRow >= 0) && (gridRow < fRows)) {
if ((gridCol >= 0) && (gridCol < fColums)
&& (gridRow >= 0) && (gridRow < fRows)) {
// process key press
int key = gridRow * fColums + gridCol;
@@ -735,10 +736,8 @@ CalcView::Copy()
clipper->what = B_MIME_DATA;
// TODO: should check return for errors!
BString expression = fExpressionTextView->Text();
clipper->AddData("text/plain",
B_MIME_TYPE,
expression.String(),
expression.Length());
clipper->AddData("text/plain", B_MIME_TYPE,
expression.String(), expression.Length());
//clipper->PrintToStream();
be_clipboard->Commit();
be_clipboard->Unlock();
@@ -753,10 +752,8 @@ CalcView::Paste(BMessage *message)
// read incoming color
const rgb_color* dropColor = NULL;
ssize_t dataSize;
if (message->FindData("RGBColor",
B_RGB_COLOR_TYPE,
(const void**)&dropColor,
&dataSize) == B_OK
if (message->FindData("RGBColor", B_RGB_COLOR_TYPE,
(const void**)&dropColor, &dataSize) == B_OK
&& dataSize == sizeof(rgb_color)) {
// calculate view relative drop point
@@ -778,10 +775,8 @@ CalcView::Paste(BMessage *message)
// look for text/plain MIME data
const char* text;
ssize_t numBytes;
if (message->FindData("text/plain",
B_MIME_TYPE,
(const void**)&text,
&numBytes) == B_OK) {
if (message->FindData("text/plain", B_MIME_TYPE,
(const void**)&text, &numBytes) == B_OK) {
BString temp;
temp.Append(text, numBytes);
fExpressionTextView->Insert(temp.String());
@@ -1090,8 +1085,8 @@ CalcView::_Colorize()
fButtonTextColor = (rgb_color){ 255, 255, 255, 255 };
// expression text color
lightness = (fExpressionBGColor.red +
fExpressionBGColor.green + fExpressionBGColor.blue) / 3;
lightness = (fExpressionBGColor.red
+ fExpressionBGColor.green + fExpressionBGColor.blue) / 3;
if (lightness > 200)
fExpressionTextColor = (rgb_color){ 0, 0, 0, 255 };
else
@@ -1164,8 +1159,8 @@ CalcView::_ShowKeypad(bool show)
if (fShowKeypadItem && fShowKeypadItem->IsMarked() ^ fShowKeypad)
fShowKeypadItem->SetMarked(fShowKeypad);
float height = fShowKeypad ? fHeight / kDisplayScaleY
: fHeight * kDisplayScaleY;
float height
= fShowKeypad ? fHeight / kDisplayScaleY : fHeight * kDisplayScaleY;
BWindow* window = Window();
if (window) {
+17 -16
View File
@@ -13,23 +13,22 @@
#include <String.h>
// constructor
InputTextView::InputTextView(BRect frame, const char* name,
BRect textRect,
uint32 resizingMode,
uint32 flags)
: BTextView(frame, name, textRect, resizingMode, flags),
InputTextView::InputTextView(BRect frame, const char* name, BRect textRect,
uint32 resizingMode, uint32 flags)
:
BTextView(frame, name, textRect, resizingMode, flags),
fWasFocus(false)
{
SetWordWrap(false);
}
// destructor
InputTextView::~InputTextView()
{
}
// MouseDown
void
InputTextView::MouseDown(BPoint where)
{
@@ -47,7 +46,7 @@ InputTextView::MouseDown(BPoint where)
}
}
// MouseUp
void
InputTextView::MouseUp(BPoint where)
{
@@ -58,7 +57,7 @@ InputTextView::MouseUp(BPoint where)
BTextView::MouseUp(where);
}
// KeyDown
void
InputTextView::KeyDown(const char* bytes, int32 numBytes)
{
@@ -85,7 +84,7 @@ InputTextView::KeyDown(const char* bytes, int32 numBytes)
BTextView::KeyDown(bytes, numBytes);
}
// MakeFocus
void
InputTextView::MakeFocus(bool focus)
{
@@ -98,7 +97,7 @@ InputTextView::MakeFocus(bool focus)
}
}
// Invoke
status_t
InputTextView::Invoke(BMessage* message)
{
@@ -114,9 +113,10 @@ InputTextView::Invoke(BMessage* message)
return B_BAD_VALUE;
}
// #pragma mark -
// Select
void
InputTextView::Select(int32 start, int32 finish)
{
@@ -125,7 +125,7 @@ InputTextView::Select(int32 start, int32 finish)
_CheckTextRect();
}
// InsertText
void
InputTextView::InsertText(const char* inText, int32 inLength, int32 inOffset,
const text_run_array* inRuns)
@@ -135,7 +135,7 @@ InputTextView::InsertText(const char* inText, int32 inLength, int32 inOffset,
_CheckTextRect();
}
// DeleteText
void
InputTextView::DeleteText(int32 fromOffset, int32 toOffset)
{
@@ -144,9 +144,10 @@ InputTextView::DeleteText(int32 fromOffset, int32 toOffset)
_CheckTextRect();
}
// #pragma mark -
// _CheckTextRect
void
InputTextView::_CheckTextRect()
{
+1 -2
View File
@@ -12,8 +12,7 @@
#include <Invoker.h>
#include <TextView.h>
class InputTextView : public BTextView,
public BInvoker {
class InputTextView : public BTextView, public BInvoker {
public:
InputTextView(BRect frame,
const char* name,