Automatic whitespace cleanup. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39420 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2,11 +2,11 @@ SubDir HAIKU_TOP src preferences mouse ;
|
|||||||
|
|
||||||
UsePrivateHeaders input ;
|
UsePrivateHeaders input ;
|
||||||
|
|
||||||
Preference Mouse :
|
Preference Mouse :
|
||||||
Mouse.cpp
|
Mouse.cpp
|
||||||
MouseSettings.cpp
|
MouseSettings.cpp
|
||||||
MouseWindow.cpp
|
MouseWindow.cpp
|
||||||
MouseView.cpp
|
MouseView.cpp
|
||||||
SettingsView.cpp
|
SettingsView.cpp
|
||||||
: translation be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
|
: translation be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
|
||||||
: Mouse.rdef
|
: Mouse.rdef
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ MouseSettings::~MouseSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
MouseSettings::_GetSettingsPath(BPath &path)
|
MouseSettings::_GetSettingsPath(BPath &path)
|
||||||
{
|
{
|
||||||
status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
|
status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
|
||||||
@@ -60,7 +60,7 @@ MouseSettings::_GetSettingsPath(BPath &path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MouseSettings::_RetrieveSettings()
|
MouseSettings::_RetrieveSettings()
|
||||||
{
|
{
|
||||||
// retrieve current values
|
// retrieve current values
|
||||||
@@ -91,14 +91,14 @@ MouseSettings::_RetrieveSettings()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#if R5_COMPATIBLE
|
#if R5_COMPATIBLE
|
||||||
const off_t kOffset = sizeof(mouse_settings) - sizeof(mouse_map)
|
const off_t kOffset = sizeof(mouse_settings) - sizeof(mouse_map)
|
||||||
+ sizeof(int32) * 3;
|
+ sizeof(int32) * 3;
|
||||||
// we have to do this because mouse_map counts 16 buttons in OBOS
|
// we have to do this because mouse_map counts 16 buttons in OBOS
|
||||||
#else
|
#else
|
||||||
const off_t kOffset = sizeof(mouse_settings);
|
const off_t kOffset = sizeof(mouse_settings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (file.ReadAt(kOffset, &fWindowPosition, sizeof(BPoint))
|
if (file.ReadAt(kOffset, &fWindowPosition, sizeof(BPoint))
|
||||||
!= sizeof(BPoint)) {
|
!= sizeof(BPoint)) {
|
||||||
// set default window position (invalid positions will be
|
// set default window position (invalid positions will be
|
||||||
// corrected by the application; the window will be centered
|
// corrected by the application; the window will be centered
|
||||||
@@ -106,14 +106,14 @@ MouseSettings::_RetrieveSettings()
|
|||||||
fWindowPosition.x = -1;
|
fWindowPosition.x = -1;
|
||||||
fWindowPosition.y = -1;
|
fWindowPosition.y = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Dump();
|
Dump();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
MouseSettings::_SaveSettings()
|
MouseSettings::_SaveSettings()
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
@@ -126,7 +126,7 @@ MouseSettings::_SaveSettings()
|
|||||||
return status;
|
return status;
|
||||||
|
|
||||||
#if R5_COMPATIBLE
|
#if R5_COMPATIBLE
|
||||||
const off_t kOffset = sizeof(mouse_settings) - sizeof(mouse_map)
|
const off_t kOffset = sizeof(mouse_settings) - sizeof(mouse_map)
|
||||||
+ sizeof(int32) * 3;
|
+ sizeof(int32) * 3;
|
||||||
// we have to do this because mouse_map counts 16 buttons in OBOS
|
// we have to do this because mouse_map counts 16 buttons in OBOS
|
||||||
#else
|
#else
|
||||||
@@ -144,8 +144,8 @@ void
|
|||||||
MouseSettings::Dump()
|
MouseSettings::Dump()
|
||||||
{
|
{
|
||||||
printf("type:\t\t%ld button mouse\n", fSettings.type);
|
printf("type:\t\t%ld button mouse\n", fSettings.type);
|
||||||
printf("map:\t\tleft = %lu : middle = %lu : right = %lu\n",
|
printf("map:\t\tleft = %lu : middle = %lu : right = %lu\n",
|
||||||
fSettings.map.button[0], fSettings.map.button[2],
|
fSettings.map.button[0], fSettings.map.button[2],
|
||||||
fSettings.map.button[1]);
|
fSettings.map.button[1]);
|
||||||
printf("click speed:\t%Ld\n", fSettings.click_speed);
|
printf("click speed:\t%Ld\n", fSettings.click_speed);
|
||||||
printf("accel:\t\t%s\n", fSettings.accel.enabled ? "enabled" : "disabled");
|
printf("accel:\t\t%s\n", fSettings.accel.enabled ? "enabled" : "disabled");
|
||||||
@@ -179,7 +179,7 @@ MouseSettings::Dump()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("focus follows mouse mode:\t%s\n", focus_follows_mouse_mode);
|
printf("focus follows mouse mode:\t%s\n", focus_follows_mouse_mode);
|
||||||
printf("accept first click:\t%s\n",
|
printf("accept first click:\t%s\n",
|
||||||
fAcceptFirstClick ? "enabled" : "disabled");
|
fAcceptFirstClick ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -225,7 +225,7 @@ MouseSettings::IsDefaultable()
|
|||||||
|
|
||||||
|
|
||||||
// Reverts to the active settings at program startup
|
// Reverts to the active settings at program startup
|
||||||
void
|
void
|
||||||
MouseSettings::Revert()
|
MouseSettings::Revert()
|
||||||
{
|
{
|
||||||
SetClickSpeed(fOriginalSettings.click_speed);
|
SetClickSpeed(fOriginalSettings.click_speed);
|
||||||
@@ -235,7 +235,7 @@ MouseSettings::Revert()
|
|||||||
SetMouseMode(fOriginalMode);
|
SetMouseMode(fOriginalMode);
|
||||||
SetFocusFollowsMouseMode(fOriginalFocusFollowsMouseMode);
|
SetFocusFollowsMouseMode(fOriginalFocusFollowsMouseMode);
|
||||||
SetAcceptFirstClick(fOriginalAcceptFirstClick);
|
SetAcceptFirstClick(fOriginalAcceptFirstClick);
|
||||||
|
|
||||||
SetMapping(fOriginalSettings.map);
|
SetMapping(fOriginalSettings.map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ MouseSettings::SetMouseType(int32 type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
bigtime_t
|
||||||
MouseSettings::ClickSpeed() const
|
MouseSettings::ClickSpeed() const
|
||||||
{
|
{
|
||||||
return 1000000LL - fSettings.click_speed;
|
return 1000000LL - fSettings.click_speed;
|
||||||
@@ -304,14 +304,14 @@ MouseSettings::Mapping(int32 index) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MouseSettings::Mapping(mouse_map &map) const
|
MouseSettings::Mapping(mouse_map &map) const
|
||||||
{
|
{
|
||||||
map = fSettings.map;
|
map = fSettings.map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MouseSettings::SetMapping(int32 index, uint32 button)
|
MouseSettings::SetMapping(int32 index, uint32 button)
|
||||||
{
|
{
|
||||||
fSettings.map.button[index] = button;
|
fSettings.map.button[index] = button;
|
||||||
@@ -330,7 +330,7 @@ MouseSettings::SetMapping(mouse_map &map)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MouseSettings::SetMouseMode(mode_mouse mode)
|
MouseSettings::SetMouseMode(mode_mouse mode)
|
||||||
{
|
{
|
||||||
set_mouse_mode(mode);
|
set_mouse_mode(mode);
|
||||||
@@ -342,14 +342,14 @@ void
|
|||||||
MouseSettings::SetFocusFollowsMouseMode(mode_focus_follows_mouse mode)
|
MouseSettings::SetFocusFollowsMouseMode(mode_focus_follows_mouse mode)
|
||||||
{
|
{
|
||||||
set_focus_follows_mouse_mode(mode);
|
set_focus_follows_mouse_mode(mode);
|
||||||
fFocusFollowsMouseMode = mode;
|
fFocusFollowsMouseMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MouseSettings::SetAcceptFirstClick(bool accept_first_click)
|
MouseSettings::SetAcceptFirstClick(bool accept_first_click)
|
||||||
{
|
{
|
||||||
set_accept_first_click(accept_first_click);
|
set_accept_first_click(accept_first_click);
|
||||||
fAcceptFirstClick = accept_first_click;
|
fAcceptFirstClick = accept_first_click;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ MouseView::~MouseView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MouseView::GetPreferredSize(float* _width, float* _height)
|
MouseView::GetPreferredSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
if (_width)
|
if (_width)
|
||||||
@@ -164,19 +164,19 @@ MouseView::MouseDown(BPoint where)
|
|||||||
// the user clicked inside our view, but another window is on top.
|
// the user clicked inside our view, but another window is on top.
|
||||||
if (clipping.Contains(where)) {
|
if (clipping.Contains(where)) {
|
||||||
button = _ConvertFromVisualOrder(button);
|
button = _ConvertFromVisualOrder(button);
|
||||||
|
|
||||||
BPopUpMenu menu("Mouse Map Menu");
|
BPopUpMenu menu("Mouse Map Menu");
|
||||||
BMessage message(kMsgMouseMap);
|
BMessage message(kMsgMouseMap);
|
||||||
message.AddInt32("button", button);
|
message.AddInt32("button", button);
|
||||||
|
|
||||||
menu.AddItem(new BMenuItem("1", new BMessage(message)));
|
menu.AddItem(new BMenuItem("1", new BMessage(message)));
|
||||||
menu.AddItem(new BMenuItem("2", new BMessage(message)));
|
menu.AddItem(new BMenuItem("2", new BMessage(message)));
|
||||||
menu.AddItem(new BMenuItem("3", new BMessage(message)));
|
menu.AddItem(new BMenuItem("3", new BMessage(message)));
|
||||||
|
|
||||||
menu.ItemAt(getMappingNumber(fSettings.Mapping(button)))
|
menu.ItemAt(getMappingNumber(fSettings.Mapping(button)))
|
||||||
->SetMarked(true);
|
->SetMarked(true);
|
||||||
menu.SetTargetForItems(Window());
|
menu.SetTargetForItems(Window());
|
||||||
|
|
||||||
ConvertToScreen(&where);
|
ConvertToScreen(&where);
|
||||||
menu.Go(where, true);
|
menu.Go(where, true);
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ MouseView::AttachedToWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MouseView::Draw(BRect updateFrame)
|
MouseView::Draw(BRect updateFrame)
|
||||||
{
|
{
|
||||||
BRect mouseBody(Bounds());
|
BRect mouseBody(Bounds());
|
||||||
@@ -240,7 +240,7 @@ MouseView::Draw(BRect updateFrame)
|
|||||||
|
|
||||||
if (i > 0 && fType > i) {
|
if (i > 0 && fType > i) {
|
||||||
// left border
|
// left border
|
||||||
SetHighColor(pressed ?
|
SetHighColor(pressed ?
|
||||||
kButtonPressedColor : kButtonReleasedLeftColor);
|
kButtonPressedColor : kButtonReleasedLeftColor);
|
||||||
StrokeLine(BPoint(border.LeftTop()), BPoint(border.LeftBottom()));
|
StrokeLine(BPoint(border.LeftTop()), BPoint(border.LeftBottom()));
|
||||||
|
|
||||||
@@ -252,15 +252,15 @@ MouseView::Draw(BRect updateFrame)
|
|||||||
|
|
||||||
SetHighColor(middlePressed ?
|
SetHighColor(middlePressed ?
|
||||||
kButtonPressedSeparatorColor : kButtonReleasedSeparatorColor);
|
kButtonPressedSeparatorColor : kButtonReleasedSeparatorColor);
|
||||||
StrokeLine(BPoint(separator.LeftTop()),
|
StrokeLine(BPoint(separator.LeftTop()),
|
||||||
BPoint(separator.LeftBottom()));
|
BPoint(separator.LeftBottom()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fType > 1 && i + 1 < fType) {
|
if (fType > 1 && i + 1 < fType) {
|
||||||
// right border
|
// right border
|
||||||
SetHighColor(pressed ?
|
SetHighColor(pressed ?
|
||||||
kButtonPressedColor : kButtonReleasedRightColor);
|
kButtonPressedColor : kButtonReleasedRightColor);
|
||||||
StrokeLine(BPoint(border.RightTop()),
|
StrokeLine(BPoint(border.RightTop()),
|
||||||
BPoint(border.RightBottom()));
|
BPoint(border.RightBottom()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,10 +269,10 @@ MouseView::Draw(BRect updateFrame)
|
|||||||
SetHighColor(kButtonTextColor);
|
SetHighColor(kButtonTextColor);
|
||||||
|
|
||||||
char number[2] = {0};
|
char number[2] = {0};
|
||||||
number[0] = getMappingNumber(map.button[_ConvertFromVisualOrder(i)])
|
number[0] = getMappingNumber(map.button[_ConvertFromVisualOrder(i)])
|
||||||
+ '1';
|
+ '1';
|
||||||
|
|
||||||
DrawString(number, BPoint(border.left +
|
DrawString(number, BPoint(border.left +
|
||||||
(border.Width() - StringWidth(number)) / 2, kButtonTop + 18));
|
(border.Width() - StringWidth(number)) / 2, kButtonTop + 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,7 @@ MouseView::_ConvertFromVisualOrder(int32 i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MouseView::SetMouseType(int32 type)
|
MouseView::SetMouseType(int32 type)
|
||||||
{
|
{
|
||||||
fType = type;
|
fType = type;
|
||||||
@@ -311,7 +311,7 @@ MouseView::MouseMapUpdated()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MouseView::UpdateFromSettings()
|
MouseView::UpdateFromSettings()
|
||||||
{
|
{
|
||||||
SetMouseType(fSettings.MouseType());
|
SetMouseType(fSettings.MouseType());
|
||||||
|
|||||||
Reference in New Issue
Block a user