* Fixed lots of style violations, many of them introduced with r33732.

* Brecht, is it possible your line break column is one character too short? At
  least you broke some lines without need.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33766 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-10-25 21:26:54 +00:00
parent c9f0f9b9d2
commit 4223d92e7d
+28 -29
View File
@@ -8,8 +8,10 @@
* Axel Dörfler, [email protected] * Axel Dörfler, [email protected]
*/ */
/*! Global functions and variables for the Interface Kit */ /*! Global functions and variables for the Interface Kit */
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <stdio.h> #include <stdio.h>
@@ -94,8 +96,8 @@ const rgb_color* BPrivate::kDefaultColors = &_kDefaultColors[0];
namespace BPrivate { namespace BPrivate {
/*!
Fills the \a width, \a height, and \a colorSpace parameters according /*! Fills the \a width, \a height, and \a colorSpace parameters according
to the window screen's mode. to the window screen's mode.
Returns \c true if the mode is known. Returns \c true if the mode is known.
*/ */
@@ -654,14 +656,13 @@ _get_key_map(key_map **map, char **key_buffer, ssize_t *key_buffer_size)
_control_input_server_(&command, &reply); _control_input_server_(&command, &reply);
if (reply.FindData("keymap", B_ANY_TYPE, &map_array, &map_count) if (reply.FindData("keymap", B_ANY_TYPE, &map_array, &map_count) != B_OK) {
!= B_OK) {
*map = 0; *key_buffer = 0; *map = 0; *key_buffer = 0;
return; return;
} }
if (reply.FindData("key_buffer", B_ANY_TYPE, &key_array, key_buffer_size) if (reply.FindData("key_buffer", B_ANY_TYPE, &key_array, key_buffer_size)
!= B_OK) { != B_OK) {
*map = 0; *key_buffer = 0; *map = 0; *key_buffer = 0;
return; return;
} }
@@ -947,6 +948,7 @@ accept_first_click()
return acceptFirstClick; return acceptFirstClick;
} }
rgb_color rgb_color
ui_color(color_which which) ui_color(color_which which)
{ {
@@ -1074,8 +1076,7 @@ _fini_interface_kit_()
// #pragma mark - // #pragma mark -
/*! /*! \brief private function used by Deskbar to set window decor
\brief private function used by Deskbar to set window decor
Note, we don't have to be compatible here, and could just change Note, we don't have to be compatible here, and could just change
the Deskbar not to use this anymore the Deskbar not to use this anymore
\param theme The theme to choose \param theme The theme to choose
@@ -1097,8 +1098,8 @@ __set_window_decor(int32 theme)
namespace BPrivate { namespace BPrivate {
/*!
\brief queries the server for the number of available decorators /*! \brief queries the server for the number of available decorators
\return the number of available decorators \return the number of available decorators
*/ */
int32 int32
@@ -1115,8 +1116,8 @@ count_decorators(void)
return count; return count;
} }
/*!
\brief queries the server for the index of the current decorators /*! \brief queries the server for the index of the current decorators
\return the current decorator's index \return the current decorator's index
If for some bizarre reason this function fails, it returns -1 If for some bizarre reason this function fails, it returns -1
@@ -1136,9 +1137,7 @@ get_decorator(void)
} }
/*! /*! \brief queries the server for the name of the decorator with a certain index
\brief queries the server for the name of the decorator with a certain
index
\param index The index of the decorator to get the name for \param index The index of the decorator to get the name for
\param name BString to receive the name of the decorator \param name BString to receive the name of the decorator
\return B_OK if successful, B_ERROR if not \return B_OK if successful, B_ERROR if not
@@ -1163,8 +1162,8 @@ get_decorator_name(const int32 &index, BString &name)
return B_ERROR; return B_ERROR;
} }
/*!
\brief asks the server to draw a decorator preview into a BBitmap /*! \brief asks the server to draw a decorator preview into a BBitmap
\param index The index of the decorator to get the name for \param index The index of the decorator to get the name for
\param bitmap BBitmap to receive the preview \param bitmap BBitmap to receive the preview
\return B_OK if successful, B_ERROR if not. \return B_OK if successful, B_ERROR if not.
@@ -1179,8 +1178,7 @@ get_decorator_preview(const int32 &index, BBitmap *bitmap)
} }
/*! /*! \brief Private function which sets the window decorator for the system.
\brief Private function which sets the window decorator for the system.
\param index Index of the decorator to set \param index Index of the decorator to set
If the index is invalid, this function and the server do nothing If the index is invalid, this function and the server do nothing
@@ -1382,8 +1380,9 @@ truncate_end(const char* source, char* dest, uint32 numChars,
const float* escapementArray, float width, float ellipsisWidth, float size) const float* escapementArray, float width, float ellipsisWidth, float size)
{ {
float currentWidth = 0.0; float currentWidth = 0.0;
ellipsisWidth /= size; // test if this is as accurate ellipsisWidth /= size;
width /= size; // as escapementArray * size // test if this is as accurate as escapementArray * size
width /= size;
uint32 lastFit = 0, c; uint32 lastFit = 0, c;
for (c = 0; c < numChars; c++) { for (c = 0; c < numChars; c++) {
@@ -1472,8 +1471,9 @@ truncate_middle(const char* source, char* dest, uint32 numChars,
uint32 left = 0; uint32 left = 0;
float leftWidth = 0.0; float leftWidth = 0.0;
while (left < numChars && (leftWidth + (escapementArray[left] * size)) while (left < numChars && (leftWidth + (escapementArray[left] * size))
< mid) < mid) {
leftWidth += (escapementArray[left++] * size); leftWidth += (escapementArray[left++] * size);
}
if (left == numChars) if (left == numChars)
return false; return false;
@@ -1481,8 +1481,9 @@ truncate_middle(const char* source, char* dest, uint32 numChars,
float rightWidth = 0.0; float rightWidth = 0.0;
uint32 right = numChars; uint32 right = numChars;
while (right > left && (rightWidth + (escapementArray[right - 1] * size)) while (right > left && (rightWidth + (escapementArray[right - 1] * size))
< mid) < mid) {
rightWidth += (escapementArray[--right] * size); rightWidth += (escapementArray[--right] * size);
}
if (left >= right) if (left >= right)
return false; return false;
@@ -1505,18 +1506,16 @@ truncate_middle(const char* source, char* dest, uint32 numChars,
float gap = width - (leftWidth + ellipsisWidth + rightWidth); float gap = width - (leftWidth + ellipsisWidth + rightWidth);
if (left > numChars - right) { if (left > numChars - right) {
// try right letter first // try right letter first
if (optional_char_fits(escapementArray[right - 1], size, gap)) { if (optional_char_fits(escapementArray[right - 1], size, gap))
right--; right--;
} else if (optional_char_fits(escapementArray[left], size, gap)) { else if (optional_char_fits(escapementArray[left], size, gap))
left++; left++;
}
} else { } else {
// try left letter first // try left letter first
if (optional_char_fits(escapementArray[left], size, gap)) { if (optional_char_fits(escapementArray[left], size, gap))
left++; left++;
} else if (optional_char_fits(escapementArray[right - 1], size, gap)) { else if (optional_char_fits(escapementArray[right - 1], size, gap))
right--; right--;
}
} }
// copy characters // copy characters
@@ -1553,7 +1552,7 @@ truncate_string(const char* string, uint32 mode, float width,
float ellipsisWidth, int32 length, int32 numChars) float ellipsisWidth, int32 length, int32 numChars)
{ {
// TODO: that's actually not correct: the string could be smaller than // TODO: that's actually not correct: the string could be smaller than
// ellipsisWidth // ellipsisWidth
if (string == NULL /*|| width < ellipsisWidth*/) { if (string == NULL /*|| width < ellipsisWidth*/) {
// we don't have room for a single glyph // we don't have room for a single glyph
strcpy(result, ""); strcpy(result, "");