hrev53846 adds 1 changeset to branch 'master'
old head: 4c8c060bc41547b6e2e48094a42a9a0e9533b9e7
new head: 445de1d3485c2023a1286563784db8dd6d45ae42
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=445de1d3485c+%5E4c8c060bc415
----------------------------------------------------------------------------
445de1d3485c: Use Input preferences
And remove Mouse, Keyboard and Touchpad.
Userguide and localizations will need to be updated.
Change-Id: I4543b2b63367cd13562c542610bad34b5934b103
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2210
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
[ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev53846
Commit: 445de1d3485c2023a1286563784db8dd6d45ae42
URL: https://git.haiku-os.org/haiku/commit/?id=445de1d3485c
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Wed Feb 5 15:21:44 2020 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sat Feb 8 17:03:19 2020 UTC
----------------------------------------------------------------------------
33 files changed, 3 insertions(+), 3619 deletions(-)
build/jam/images/definitions/minimum | 6 +-
src/preferences/Jamfile | 3 -
src/preferences/keyboard/Jamfile | 25 --
src/preferences/keyboard/Keyboard.cpp | 71 ---
src/preferences/keyboard/Keyboard.h | 26 --
src/preferences/keyboard/Keyboard.rdef | 38 --
src/preferences/keyboard/KeyboardMessages.h | 24 -
src/preferences/keyboard/KeyboardSettings.cpp | 127 ------
src/preferences/keyboard/KeyboardSettings.h | 43 --
src/preferences/keyboard/KeyboardView.cpp | 93 ----
src/preferences/keyboard/KeyboardView.h | 35 --
src/preferences/keyboard/KeyboardWindow.cpp | 188 --------
src/preferences/keyboard/KeyboardWindow.h | 34 --
src/preferences/mouse/Jamfile | 21 -
src/preferences/mouse/Mouse.cpp | 54 ---
src/preferences/mouse/Mouse.h | 26 --
src/preferences/mouse/Mouse.rdef | 40 --
src/preferences/mouse/MouseConstants.h | 33 --
src/preferences/mouse/MouseSettings.cpp | 373 ----------------
src/preferences/mouse/MouseSettings.h | 79 ----
src/preferences/mouse/MouseView.cpp | 390 -----------------
src/preferences/mouse/MouseView.h | 60 ---
src/preferences/mouse/MouseWindow.cpp | 252 -----------
src/preferences/mouse/MouseWindow.h | 39 --
src/preferences/mouse/SettingsView.cpp | 291 ------------
src/preferences/mouse/SettingsView.h | 55 ---
src/preferences/touchpad/Jamfile | 18 -
src/preferences/touchpad/Touchpad.rdef | 246 -----------
src/preferences/touchpad/TouchpadPref.cpp | 186 --------
src/preferences/touchpad/TouchpadPref.h | 60 ---
src/preferences/touchpad/TouchpadPrefView.cpp | 511 ----------------------
src/preferences/touchpad/TouchpadPrefView.h | 112 -----
src/preferences/touchpad/main.cpp | 63 ---
----------------------------------------------------------------------------
diff --git a/build/jam/images/definitions/minimum
b/build/jam/images/definitions/minimum
index 3cd4b385dc..4dba390410 100644
--- a/build/jam/images/definitions/minimum
+++ b/build/jam/images/definitions/minimum
@@ -66,12 +66,12 @@ SYSTEM_PREFERENCES = [ FFilterByBuildFeatures
Backgrounds
<preference>Deskbar
FileTypes
- Keyboard Keymap
+ Input
+ Keymap
Locale
- Mouse
Network Notifications
Screen Shortcuts
- Time Touchpad <preference>Tracker
+ Time <preference>Tracker
VirtualMemory
] ;
diff --git a/src/preferences/Jamfile b/src/preferences/Jamfile
index caf06fac1a..b913663c89 100644
--- a/src/preferences/Jamfile
+++ b/src/preferences/Jamfile
@@ -8,12 +8,10 @@ SubInclude HAIKU_TOP src preferences deskbar ;
SubInclude HAIKU_TOP src preferences filetypes ;
SubInclude HAIKU_TOP src preferences input ;
SubInclude HAIKU_TOP src preferences joysticks ;
-SubInclude HAIKU_TOP src preferences keyboard ;
SubInclude HAIKU_TOP src preferences keymap ;
SubInclude HAIKU_TOP src preferences locale ;
SubInclude HAIKU_TOP src preferences mail ;
SubInclude HAIKU_TOP src preferences media ;
-SubInclude HAIKU_TOP src preferences mouse ;
SubInclude HAIKU_TOP src preferences network ;
SubInclude HAIKU_TOP src preferences notifications ;
SubInclude HAIKU_TOP src preferences printers ;
@@ -23,6 +21,5 @@ SubInclude HAIKU_TOP src preferences screensaver ;
SubInclude HAIKU_TOP src preferences shortcuts ;
SubInclude HAIKU_TOP src preferences sounds ;
SubInclude HAIKU_TOP src preferences time ;
-SubInclude HAIKU_TOP src preferences touchpad ;
SubInclude HAIKU_TOP src preferences tracker ;
SubInclude HAIKU_TOP src preferences virtualmemory ;
diff --git a/src/preferences/keyboard/Jamfile b/src/preferences/keyboard/Jamfile
deleted file mode 100644
index 0f0baec506..0000000000
--- a/src/preferences/keyboard/Jamfile
+++ /dev/null
@@ -1,25 +0,0 @@
-SubDir HAIKU_TOP src preferences keyboard ;
-
-if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
- SubDirC++Flags -DCOMPILE_FOR_R5 ;
-# SubDirC++Flags -fmultiple-symbol-spaces ;
-}
-
-UsePrivateHeaders input ;
-
-Preference Keyboard :
- Keyboard.cpp
- KeyboardSettings.cpp
- KeyboardView.cpp
- KeyboardWindow.cpp
- : translation be [ TargetLibsupc++ ] localestub
- : Keyboard.rdef
- ;
-
-DoCatalogs Keyboard :
- x-vnd.Haiku-Keyboard
- :
- Keyboard.cpp
- KeyboardWindow.cpp
- KeyboardView.cpp
-;
diff --git a/src/preferences/keyboard/Keyboard.cpp
b/src/preferences/keyboard/Keyboard.cpp
deleted file mode 100644
index cbe1d6aa25..0000000000
--- a/src/preferences/keyboard/Keyboard.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2004-2006, Haiku. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors in chronological order:
- * Andrew McCall, mccall@xxxxxxxxxxxxxxxxxxxxx
- * Jérôme Duval
- * Marcus Overhagen
- */
-
-
-#include "Keyboard.h"
-#include "KeyboardWindow.h"
-#include "KeyboardMessages.h"
-
-#include <Alert.h>
-
-#undef B_TRANSLATION_CONTEXT
-#define B_TRANSLATION_CONTEXT "KeyboardApplication"
-
-KeyboardApplication::KeyboardApplication()
- : BApplication("application/x-vnd.Haiku-Keyboard")
-{
- new KeyboardWindow();
-}
-
-
-void
-KeyboardApplication::MessageReceived(BMessage* message)
-{
- switch (message->what) {
- case ERROR_DETECTED:
- {
- BAlert* errorAlert = new BAlert("Error",
- B_TRANSLATE("Something has gone wrong!"),
- B_TRANSLATE("OK"), NULL, NULL,
- B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
B_WARNING_ALERT);
- errorAlert->SetFlags(errorAlert->Flags() |
B_CLOSE_ON_ESCAPE);
- errorAlert->Go();
- be_app->PostMessage(B_QUIT_REQUESTED);
- break;
- }
- default:
- BApplication::MessageReceived(message);
- break;
- }
-}
-
-
-void
-KeyboardApplication::AboutRequested()
-{
- BAlert* alert = new BAlert("about",
- B_TRANSLATE("Written by Andrew Edward McCall"),
B_TRANSLATE("OK"));
- alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
- alert->Go();
-}
-
-
-// #pragma mark -
-
-
-int
-main(int, char**)
-{
- KeyboardApplication app;
- app.Run();
-
- return 0;
-}
-
diff --git a/src/preferences/keyboard/Keyboard.h
b/src/preferences/keyboard/Keyboard.h
deleted file mode 100644
index 7e1d77cfb9..0000000000
--- a/src/preferences/keyboard/Keyboard.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2004-2006, the Haiku project. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors in chronological order:
- * mccall@xxxxxxxxxxxxxxxxxxxxx
- * Jérôme Duval
- * Marcus Overhagen
-*/
-#ifndef KEYBOARD_H
-#define KEYBOARD_H
-
-#include <Application.h>
-#include <Catalog.h>
-#include <Locale.h>
-
-class KeyboardApplication : public BApplication
-{
-public:
- KeyboardApplication();
-
- void MessageReceived(BMessage* message);
- void AboutRequested(void);
-};
-
-#endif
diff --git a/src/preferences/keyboard/Keyboard.rdef
b/src/preferences/keyboard/Keyboard.rdef
deleted file mode 100644
index 5af19f8282..0000000000
--- a/src/preferences/keyboard/Keyboard.rdef
+++ /dev/null
@@ -1,38 +0,0 @@
-
-resource app_signature "application/x-vnd.Haiku-Keyboard";
-
-resource app_name_catalog_entry "x-vnd.Haiku-Keyboard:System name:Keyboard";
-
-resource app_flags B_SINGLE_LAUNCH;
-
-resource app_version {
- major = 1,
- middle = 0,
- minor = 0,
-
- /* 0 = development 1 = alpha 2 = beta
- 3 = gamma 4 = golden master 5 = final */
- variety = 2,
-
- internal = 0,
-
- short_info = "Keyboard",
- long_info = "Keyboard ©2004-2009 Haiku"
-};
-
-resource vector_icon {
- $"6E63696605020016023910813A2974BB43733A501C4A60D94AC7F400E9FFB902"
- $"001602B8513BB55C0A38B9DABBC2B74A98024B8D270066FF9002011603BC39E2"
- $"364286B516B5BB0AE64ACEF94A7E0500FF56E5FFC1050004006D0A0202372D34"
- $"2B3A2F3C2A3F2C39280802392C3B2F0805493046344A334A364F3308032C3C32"
- $"39303E08022F3B313C00043E443E443D4542454146434440423F434141444345"
- $"4243440A04425C4CCA1B56C61F4E490A0432523647424C425A0A04425A424C4C"
- $"434E4E0A043647424C4C43403E160A030309080730180801178322040A000107"
- $"2018080A0101082018080A0201092018080A030200011001178100040A040106"
- $"2028100A030309080730281001178322040A0001072028100A0101082028100A"
- $"0201092028100A0301021001178122040A030309080730101801178422040A00"
- $"01072010180A0101082010180A0201092010180A030203041001178100040A04"
- $"0106000A03030908071001178322040A000107000A010108000A020109000A03"
- $"0105100117810004"
-};
-
diff --git a/src/preferences/keyboard/KeyboardMessages.h
b/src/preferences/keyboard/KeyboardMessages.h
deleted file mode 100644
index 04d81e18bb..0000000000
--- a/src/preferences/keyboard/KeyboardMessages.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2004-2007, Haiku. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Andrew McCall, mccall@xxxxxxxxxxxxxxxxxxxxx
- * Jérôme Duval
- * Marcus Overhagen
- */
-#ifndef KEYBOARD_MESSAGES_H
-#define KEYBOARD_MESSAGES_H
-
-
-#include <SupportDefs.h>
-
-
-const uint32 BUTTON_DEFAULTS = 'BTde';
-const uint32 BUTTON_REVERT = 'BTre';
-const uint32 SLIDER_REPEAT_RATE = 'SLrr';
-const uint32 SLIDER_DELAY_RATE = 'SLdr';
-
-const uint32 ERROR_DETECTED = 'ERor';
-
-#endif // KEYBOARD_MESSAGES_H
diff --git a/src/preferences/keyboard/KeyboardSettings.cpp
b/src/preferences/keyboard/KeyboardSettings.cpp
deleted file mode 100644
index e47104c92c..0000000000
--- a/src/preferences/keyboard/KeyboardSettings.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2004-2006, the Haiku project. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors in chronological order:
- * mccall@xxxxxxxxxxxxxxxxxxxxx
- * Jérôme Duval
- * Marcus Overhagen
-*/
-#include <FindDirectory.h>
-#include <File.h>
-#include <Path.h>
-#include <stdio.h>
-#include "KeyboardSettings.h"
-
-// Keyboard setting file layout is like this:
-// struct {
-// struct kb_settings; // managed by input server
-// BPoint corner; // used by pref app
-// }
-
-KeyboardSettings::KeyboardSettings()
-{
- if (get_key_repeat_rate(&fSettings.key_repeat_rate) != B_OK)
- fSettings.key_repeat_rate = kb_default_key_repeat_rate;
-
- if (get_key_repeat_delay(&fSettings.key_repeat_delay) != B_OK)
- fSettings.key_repeat_delay = kb_default_key_repeat_delay;
-
- fOriginalSettings = fSettings;
-
- BPath path;
- BFile file;
-
- fCorner.x = 150;
- fCorner.y = 100;
-
- status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
- if (status == B_OK) {
- status = path.Append(kb_settings_file);
- if (status == B_OK) {
- status = file.SetTo(path.Path(), B_READ_ONLY);
- if (status == B_OK) {
- if (file.ReadAt(sizeof(kb_settings), &fCorner,
sizeof(fCorner)) != sizeof(fCorner)) {
- fCorner.x = 150;
- fCorner.y = 100;
- }
- }
- }
- }
-}
-
-
-KeyboardSettings::~KeyboardSettings()
-{
- BPath path;
- BFile file;
-
- if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) < B_OK)
- return;
-
- if (path.Append(kb_settings_file) < B_OK)
- return;
-
- // be careful: don't create the file if it doesn't already exist
- if (file.SetTo(path.Path(), B_WRITE_ONLY) < B_OK)
- return;
-
- file.WriteAt(sizeof(kb_settings), &fCorner, sizeof(fCorner));
-}
-
-
-void
-KeyboardSettings::SetWindowCorner(BPoint corner)
-{
- fCorner = corner;
-}
-
-
-void
-KeyboardSettings::SetKeyboardRepeatRate(int32 rate)
-{
- if (set_key_repeat_rate(rate) != B_OK)
- fprintf(stderr, "error while set_key_repeat_rate!\n");
- fSettings.key_repeat_rate = rate;
-}
-
-
-void
-KeyboardSettings::SetKeyboardRepeatDelay(bigtime_t delay)
-{
- if (set_key_repeat_delay(delay) != B_OK)
- fprintf(stderr, "error while set_key_repeat_delay!\n");
- fSettings.key_repeat_delay = delay;
-}
-
-
-void
-KeyboardSettings::Dump()
-{
- printf("repeat rate: %" B_PRId32 "\n", fSettings.key_repeat_rate);
- printf("repeat delay: %" B_PRId64 "\n", fSettings.key_repeat_delay);
-}
-
-
-void
-KeyboardSettings::Revert()
-{
- SetKeyboardRepeatDelay(fOriginalSettings.key_repeat_delay);
- SetKeyboardRepeatRate(fOriginalSettings.key_repeat_rate);
-}
-
-
-void
-KeyboardSettings::Defaults()
-{
- SetKeyboardRepeatDelay(kb_default_key_repeat_delay);
- SetKeyboardRepeatRate(kb_default_key_repeat_rate);
-}
-
-
-bool
-KeyboardSettings::IsDefaultable()
-{
- return fSettings.key_repeat_delay != kb_default_key_repeat_delay
- || fSettings.key_repeat_rate != kb_default_key_repeat_rate;
-}
diff --git a/src/preferences/keyboard/KeyboardSettings.h
b/src/preferences/keyboard/KeyboardSettings.h
deleted file mode 100644
index 3879965901..0000000000
--- a/src/preferences/keyboard/KeyboardSettings.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2004-2006, the Haiku project. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors in chronological order:
- * mccall@xxxxxxxxxxxxxxxxxxxxx
- * Jérôme Duval
- * Marcus Overhagen
-*/
-#ifndef KEYBOARD_SETTINGS_H_
-#define KEYBOARD_SETTINGS_H_
-
-#include <SupportDefs.h>
-#include "kb_mouse_settings.h"
-
-class KeyboardSettings{
-public :
- KeyboardSettings();
- ~KeyboardSettings();
-
- void Dump();
- void Revert();
- void Defaults();
- bool IsDefaultable();
-
- BPoint WindowCorner() const { return fCorner; }
- void SetWindowCorner(BPoint corner);
-
- int32 KeyboardRepeatRate() const
- { return fSettings.key_repeat_rate; }
- void SetKeyboardRepeatRate(int32 rate);
-
- bigtime_t KeyboardRepeatDelay() const
- { return fSettings.key_repeat_delay; }
- void SetKeyboardRepeatDelay(bigtime_t delay);
-
-private:
- BPoint fCorner;
- kb_settings fSettings;
- kb_settings fOriginalSettings;
-};
-
-#endif
diff --git a/src/preferences/keyboard/KeyboardView.cpp
b/src/preferences/keyboard/KeyboardView.cpp
deleted file mode 100644
index 9ff48b5254..0000000000
--- a/src/preferences/keyboard/KeyboardView.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2004-2006, the Haiku project. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors in chronological order:
- * mccall@xxxxxxxxxxxxxxxxxxxxx
- * Jérôme Duval
- * Marcus Overhagen
-*/
-#include <InterfaceDefs.h>
-#include <TranslationUtils.h>
-#include <Bitmap.h>
-#include <Button.h>
-#include <Catalog.h>
-#include <LayoutBuilder.h>
-#include <Locale.h>
-#include <Slider.h>
-#include <TextControl.h>
-#include <Window.h>
-
-#include "KeyboardView.h"
-#include "KeyboardMessages.h"
-#include "KeyboardSettings.h"
-
-#undef B_TRANSLATION_CONTEXT
-#define B_TRANSLATION_CONTEXT "KeyboardView"
-
-KeyboardView::KeyboardView()
- : BGroupView()
-{
- fIconBitmap = BTranslationUtils::GetBitmap("key_bmap");
- fClockBitmap = BTranslationUtils::GetBitmap("clock_bmap");
-
- // Create the "Key repeat rate" slider...
- fRepeatSlider = new BSlider("key_repeat_rate",
- B_TRANSLATE("Key repeat rate"),
- new
BMessage(SLIDER_REPEAT_RATE),
- 20, 300, B_HORIZONTAL);
- fRepeatSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
- fRepeatSlider->SetHashMarkCount(5);
- fRepeatSlider->SetLimitLabels(B_TRANSLATE("Slow"),B_TRANSLATE("Fast"));
- fRepeatSlider->SetExplicitMinSize(BSize(200, B_SIZE_UNSET));
-
-
- // Create the "Delay until key repeat" slider...
- fDelaySlider = new BSlider("delay_until_key_repeat",
- B_TRANSLATE("Delay until key
repeat"),
- new BMessage(SLIDER_DELAY_RATE),
- 250000, 1000000, B_HORIZONTAL);
- fDelaySlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
- fDelaySlider->SetHashMarkCount(4);
- fDelaySlider->SetLimitLabels(B_TRANSLATE("Short"),B_TRANSLATE("Long"));
-
- // Create the "Typing test area" text box...
- BTextControl* textcontrol = new BTextControl(NULL,
-
B_TRANSLATE("Typing test area"),
- new
BMessage('TTEA'));
- textcontrol->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
- textcontrol->SetExplicitMinSize(BSize(
- textcontrol->StringWidth(B_TRANSLATE("Typing test area")),
B_SIZE_UNSET));
-
- // Build the layout
- BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
- .Add(fRepeatSlider)
- .Add(fDelaySlider)
- .Add(textcontrol);
-}
-
-
-KeyboardView::~KeyboardView()
-{
-
-}
-
-
-void
-KeyboardView::Draw(BRect updateFrame)
-{
- BPoint pt;
- pt.x = fRepeatSlider->Frame().right + 10;
-
- if (fIconBitmap != NULL) {
- pt.y = fRepeatSlider->Frame().bottom - 35
- - fIconBitmap->Bounds().Height() / 3;
- DrawBitmap(fIconBitmap, pt);
- }
-
- if (fClockBitmap != NULL) {
- pt.y = fDelaySlider->Frame().bottom - 35
- - fClockBitmap->Bounds().Height() / 3;
- DrawBitmap(fClockBitmap, pt);
- }
-}
diff --git a/src/preferences/keyboard/KeyboardView.h
b/src/preferences/keyboard/KeyboardView.h
deleted file mode 100644
index 767815661f..0000000000
--- a/src/preferences/keyboard/KeyboardView.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2004-2006, the Haiku project. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors in chronological order:
- * mccall@xxxxxxxxxxxxxxxxxxxxx
- * Jérôme Duval
- * Marcus Overhagen
-*/
-#ifndef KEYBOARD_VIEW_H
-#define KEYBOARD_VIEW_H
-
-
-#include <GroupView.h>
-#include <Slider.h>
-#include <SupportDefs.h>
-#include <InterfaceDefs.h>
-#include <Application.h>
-
-
-class KeyboardView : public BGroupView
-{
-public:
- KeyboardView();
- virtual ~KeyboardView();
- void Draw(BRect frame);
-
-private:
- BBitmap *fIconBitmap;
- BBitmap *fClockBitmap;
- BSlider *fDelaySlider;
- BSlider *fRepeatSlider;
-};
-
-#endif
diff --git a/src/preferences/keyboard/KeyboardWindow.cpp
b/src/preferences/keyboard/KeyboardWindow.cpp
deleted file mode 100644
index 836c843e6b..0000000000
--- a/src/preferences/keyboard/KeyboardWindow.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright 2004-2007, Haiku. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Andrew McCall, mccall@xxxxxxxxxxxxxxxxxxxxx
- * Jérôme Duval
- * Marcus Overhagen
- */
-
-
-#include "KeyboardMessages.h"
-#include "KeyboardView.h"
-#include "KeyboardWindow.h"
-
-#include <Box.h>
-#include <Button.h>
-#include <Catalog.h>
-#include <LayoutBuilder.h>
-#include <Locale.h>
-#include <Message.h>
-#include <Screen.h>
-#include <SeparatorView.h>
-#include <Slider.h>
-#include <TextControl.h>
-
-#undef B_TRANSLATION_CONTEXT
-#define B_TRANSLATION_CONTEXT "KeyboardWindow"
-
-KeyboardWindow::KeyboardWindow()
- :
- BWindow(BRect(0, 0, 200, 200), B_TRANSLATE_SYSTEM_NAME("Keyboard"),
- B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
- | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
-{
- MoveTo(fSettings.WindowCorner());
-
- // Add the main settings view
- fSettingsView = new KeyboardView();
-
- // Add the "Default" button..
- fDefaultsButton = new BButton(B_TRANSLATE("Defaults"), new
BMessage(BUTTON_DEFAULTS));
-
- // Add the "Revert" button...
- fRevertButton = new BButton(B_TRANSLATE("Revert"), new
BMessage(BUTTON_REVERT));
- fRevertButton->SetEnabled(false);
-
- // Build the layout
- BLayoutBuilder::Group<>(this, B_VERTICAL)
- .AddGroup(B_HORIZONTAL)
- .SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
- B_USE_WINDOW_SPACING, 0)
- .Add(fSettingsView)
- .End()
- .Add(new BSeparatorView(B_HORIZONTAL))
- .AddGroup(B_HORIZONTAL)
- .SetInsets(B_USE_WINDOW_SPACING, 0,
B_USE_WINDOW_SPACING,
- B_USE_WINDOW_SPACING)
- .Add(fDefaultsButton)
- .Add(fRevertButton)
- .End();
-
- BSlider* slider = (BSlider* )FindView("key_repeat_rate");
- if (slider !=NULL)
- slider->SetValue(fSettings.KeyboardRepeatRate());
-
- slider = (BSlider* )FindView("delay_until_key_repeat");
- if (slider !=NULL)
- slider->SetValue(fSettings.KeyboardRepeatDelay());
-
- fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
- // center window if it would be off-screen
- BScreen screen;
- if (screen.Frame().right < Frame().right
- || screen.Frame().bottom < Frame().bottom) {
- CenterOnScreen();
- }
-
-#ifdef DEBUG
- fSettings.Dump();
-#endif
-
- Show();
-}
-
-
-bool
-KeyboardWindow::QuitRequested()
-{
- fSettings.SetWindowCorner(Frame().LeftTop());
-
-#ifdef DEBUG
- fSettings.Dump();
-#endif
-
- be_app->PostMessage(B_QUIT_REQUESTED);
- return true;
-}
-
-
-void
-KeyboardWindow::MessageReceived(BMessage* message)
-{
- BSlider* slider = NULL;
-
- switch (message->what) {
- case BUTTON_DEFAULTS:
- {
- fSettings.Defaults();
-
- slider = (BSlider* )FindView("key_repeat_rate");
- if (slider !=NULL)
-
slider->SetValue(fSettings.KeyboardRepeatRate());
-
- slider = (BSlider* )FindView("delay_until_key_repeat");
- if (slider !=NULL)
-
slider->SetValue(fSettings.KeyboardRepeatDelay());
-
- fDefaultsButton->SetEnabled(false);
-
- fRevertButton->SetEnabled(true);
- break;
- }
- case BUTTON_REVERT:
- {
- fSettings.Revert();
-
- slider = (BSlider* )FindView("key_repeat_rate");
- if (slider !=NULL)
-
slider->SetValue(fSettings.KeyboardRepeatRate());
-
- slider = (BSlider* )FindView("delay_until_key_repeat");
- if (slider !=NULL)
-
slider->SetValue(fSettings.KeyboardRepeatDelay());
-
- fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
- fRevertButton->SetEnabled(false);
- break;
- }
- case SLIDER_REPEAT_RATE:
- {
- int32 rate;
- if (message->FindInt32("be:value", &rate) != B_OK)
- break;
- fSettings.SetKeyboardRepeatRate(rate);
-
- fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
- fRevertButton->SetEnabled(true);
- break;
- }
- case SLIDER_DELAY_RATE:
- {
- int32 delay;
- if (message->FindInt32("be:value", &delay) != B_OK)
- break;
-
- // We need to look at the value from the slider and
make it "jump"
- // to the next notch along. Setting the min and max
values of the
- // slider to 1 and 4 doesn't work like the real
Keyboard app.
- if (delay < 375000)
- delay = 250000;
- if (delay >= 375000 && delay < 625000)
- delay = 500000;
- if (delay >= 625000 && delay < 875000)
- delay = 750000;
- if (delay >= 875000)
- delay = 1000000;
-
- fSettings.SetKeyboardRepeatDelay(delay);
-
- slider = (BSlider* )FindView("delay_until_key_repeat");
- if (slider != NULL)
- slider->SetValue(delay);
-
- fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
- fRevertButton->SetEnabled(true);
- break;
- }
-
- default:
- BWindow::MessageReceived(message);
- break;
- }
-}
diff --git a/src/preferences/keyboard/KeyboardWindow.h
b/src/preferences/keyboard/KeyboardWindow.h
deleted file mode 100644
index f61cf1055a..0000000000
--- a/src/preferences/keyboard/KeyboardWindow.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2004-2006, the Haiku project. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors in chronological order:
- * mccall@xxxxxxxxxxxxxxxxxxxxx
- * Jérôme Duval
- * Marcus Overhagen
-*/
-#ifndef KEYBOARD_WINDOW_H
-#define KEYBOARD_WINDOW_H
-
-#include <Button.h>
-#include <Window.h>
-
-#include "KeyboardSettings.h"
-#include "KeyboardView.h"
-
-class KeyboardWindow : public BWindow
-{
-public:
- KeyboardWindow();
-
- bool QuitRequested();
- void MessageReceived(BMessage* message);
-
-private:
- KeyboardView *fSettingsView;
- KeyboardSettings fSettings;
- BButton *fDefaultsButton;
- BButton *fRevertButton;
-};
-
-#endif
diff --git a/src/preferences/mouse/Jamfile b/src/preferences/mouse/Jamfile
deleted file mode 100644
index 4fd30cca2a..0000000000
--- a/src/preferences/mouse/Jamfile
+++ /dev/null
@@ -1,21 +0,0 @@
-SubDir HAIKU_TOP src preferences mouse ;
-
-UsePrivateHeaders input ;
-
-Preference Mouse :
- Mouse.cpp
- MouseSettings.cpp
- MouseWindow.cpp
- MouseView.cpp
- SettingsView.cpp
- : translation be [ TargetLibsupc++ ] localestub
- : Mouse.rdef
- ;
-
-DoCatalogs Mouse :
- x-vnd.Haiku-Mouse
- :
- Mouse.cpp
- MouseWindow.cpp
- SettingsView.cpp
-;
diff --git a/src/preferences/mouse/Mouse.cpp b/src/preferences/mouse/Mouse.cpp
deleted file mode 100644
index 17f796b3b7..0000000000
--- a/src/preferences/mouse/Mouse.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2003-2009 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- */
-
-
-#include "Mouse.h"
-#include "MouseWindow.h"
-
-#include <Alert.h>
-#include <Screen.h>
-
-#undef B_TRANSLATION_CONTEXT
-#define B_TRANSLATION_CONTEXT "MouseApplication"
-
-const char* kSignature = "application/x-vnd.Haiku-Mouse";
-
-
-MouseApplication::MouseApplication()
- :
- BApplication(kSignature)
-{
- BRect rect(0, 0, 397, 293);
- MouseWindow *window = new MouseWindow(rect);
- window->Show();
-}
-
-
-void
-MouseApplication::AboutRequested()
-{
- BAlert* alert = new BAlert("about",
- B_TRANSLATE("...by Andrew Edward McCall"), B_TRANSLATE("Dig
Deal"));
- alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
- alert->Go();
-}
-
-
-// #pragma mark -
-
-
-int
-main(int /*argc*/, char ** /*argv*/)
-{
- MouseApplication app;
- app.Run();
-
- return 0;
-}
diff --git a/src/preferences/mouse/Mouse.h b/src/preferences/mouse/Mouse.h
deleted file mode 100644
index 84db0dc492..0000000000
--- a/src/preferences/mouse/Mouse.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2003-2009 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- */
-#ifndef MOUSE_H
-#define MOUSE_H
-
-
-#include <Application.h>
-#include <Catalog.h>
-#include <Locale.h>
-
-
-class MouseApplication : public BApplication {
-public:
- MouseApplication();
-
- virtual void AboutRequested();
-};
-
-#endif /* MOUSE_H */
diff --git a/src/preferences/mouse/Mouse.rdef b/src/preferences/mouse/Mouse.rdef
deleted file mode 100644
index a2e07884fd..0000000000
--- a/src/preferences/mouse/Mouse.rdef
+++ /dev/null
@@ -1,40 +0,0 @@
-
-resource app_signature "application/x-vnd.Haiku-Mouse";
-
-resource app_name_catalog_entry "x-vnd.Haiku-Mouse:System name:Mouse";
-
-resource app_flags B_SINGLE_LAUNCH;
-
-resource app_version {
- major = 1,
- middle = 0,
- minor = 0,
-
- /* 0 = development 1 = alpha 2 = beta
- 3 = gamma 4 = golden master 5 = final */
- variety = 2,
-
- internal = 0,
-
- short_info = "Mouse",
- long_info = "Mouse ©2002-2009 Haiku"
-};
-
-resource vector_icon {
- $"6E636966080301000002000202AC6DA33A810CBCBF0CAEA9C248C4E546BB2A00"
- $"01000000FF010000FF020016023D2328BA287D3B40A23E5D334837CE48FA2500"
- $"69FF01020116023E40000000000000003E400048000048000000FBFFC0020106"
- $"02B832FBBACA8D3ACA8DB832FB48D3BB493902FFBEBEBE0001000005BE05FC01"
- $"0100007D0604033E2C3C2436263E222E2E282E342E2802082C4CB5EDC39ABA27"
- $"C5B7BFBFC883BD60C754C19AC9715052C4C9C842C722C5E9544EC6B5C656C90E"
- $"C3FDC7B7C08BC992C179C558BF5C4038C21FBDBFBDE5BBA232BD5BBB83BC04B9"
- $"2ABE5DB6FB42B7FDBF8AB5A4C1E30208475443544B54C6EB50C660C6ABC777C5"
- $"9456C487C803C508C9DBC33056405842543E42334E3536312C3A3036283EB628"
- $"C223B628C2232A4A344AB80EC27CBE0FC50F0604EE2E383838323638383B3635"
- $"333B332F3304032F3049304930433A36BA1DBE14413141330606FE0B4659C487"
- $"59C36B59C5605954C8E9C6D7C95AC91CC837CBD7C4FBCB67C614CC30C41DCAE7"
- $"C289CBC8C2FAC983C1D75443080A070105000A0101001001178400040A000302"
- $"01031001178422040A020101000A030102000A0001041001178100040A060104"
- $"123FE3AA0000000000003FDFFC41DB9540107701178100040A04010300"
-};
-
diff --git a/src/preferences/mouse/MouseConstants.h
b/src/preferences/mouse/MouseConstants.h
deleted file mode 100644
index c9175f5dd9..0000000000
--- a/src/preferences/mouse/MouseConstants.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2003-2009 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- * Brecht Machiels (brecht@xxxxxxxxxxx)
- */
-#ifndef MOUSE_CONSTANTS_H
-#define MOUSE_CONSTANTS_H
-
-
-// interface messages
-const uint32 kMsgDefaults = 'BTde';
-const uint32 kMsgRevert = 'BTre';
-
-const uint32 kMsgMouseType = 'PUmt';
-const uint32 kMsgMouseFocusMode = 'PUmf';
-const uint32 kMsgFollowsMouseMode = 'PUff';
-const uint32 kMsgAcceptFirstClick = 'PUaf';
-const uint32 kMsgMouseMap = 'PUmm';
-
-const uint32 kMsgDoubleClickSpeed = 'SLdc';
-const uint32 kMsgMouseSpeed = 'SLms';
-const uint32 kMsgAccelerationFactor = 'SLma';
-
-// user interface
-const uint32 kBorderSpace = 10;
-const uint32 kItemSpace = 7;
-
-#endif /* MOUSE_CONSTANTS_H */
diff --git a/src/preferences/mouse/MouseSettings.cpp
b/src/preferences/mouse/MouseSettings.cpp
deleted file mode 100644
index 2cbebb106d..0000000000
--- a/src/preferences/mouse/MouseSettings.cpp
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * Copyright 2003-2009 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- * Brecht Machiels (brecht@xxxxxxxxxxx)
- */
-
-#include <FindDirectory.h>
-#include <File.h>
-#include <Path.h>
-#include <View.h>
-
-#include <stdio.h>
-
-#include "MouseSettings.h"
-
-// The R5 settings file differs from that of OpenBeOS;
-// the latter maps 16 different mouse buttons
-#define R5_COMPATIBLE 1
-
-static const bigtime_t kDefaultClickSpeed = 500000;
-static const int32 kDefaultMouseSpeed = 65536;
-static const int32 kDefaultMouseType = 3; // 3 button mouse
-static const int32 kDefaultAccelerationFactor = 65536;
-static const bool kDefaultAcceptFirstClick = false;
-
-
-MouseSettings::MouseSettings()
- :
- fWindowPosition(-1, -1)
-{
- _RetrieveSettings();
-
- fOriginalSettings = fSettings;
- fOriginalMode = fMode;
- fOriginalFocusFollowsMouseMode = fFocusFollowsMouseMode;
- fOriginalAcceptFirstClick = fAcceptFirstClick;
-}
-
-
-MouseSettings::~MouseSettings()
-{
- _SaveSettings();
-}
-
-
-status_t
-MouseSettings::_GetSettingsPath(BPath &path)
-{
- status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
- if (status < B_OK)
- return status;
-
- path.Append(mouse_settings_file);
- return B_OK;
-}
-
-
-void
-MouseSettings::_RetrieveSettings()
-{
- // retrieve current values
-
- if (get_mouse_map(&fSettings.map) != B_OK)
- fprintf(stderr, "error when get_mouse_map\n");
- if (get_click_speed(&fSettings.click_speed) != B_OK)
- fprintf(stderr, "error when get_click_speed\n");
- if (get_mouse_speed(&fSettings.accel.speed) != B_OK)
- fprintf(stderr, "error when get_mouse_speed\n");
- if (get_mouse_acceleration(&fSettings.accel.accel_factor) != B_OK)
- fprintf(stderr, "error when get_mouse_acceleration\n");
- if (get_mouse_type(&fSettings.type) != B_OK)
- fprintf(stderr, "error when get_mouse_type\n");
-
- fMode = mouse_mode();
- fFocusFollowsMouseMode = focus_follows_mouse_mode();
- fAcceptFirstClick = accept_first_click();
-
- // also try to load the window position from disk
-
- BPath path;
- if (_GetSettingsPath(path) < B_OK)
- return;
-
- BFile file(path.Path(), B_READ_ONLY);
- if (file.InitCheck() < B_OK)
- return;
-
-#if R5_COMPATIBLE
- const off_t kOffset = sizeof(mouse_settings) - sizeof(mouse_map)
- + sizeof(int32) * 3;
- // we have to do this because mouse_map counts 16 buttons in
OBOS
-#else
- const off_t kOffset = sizeof(mouse_settings);
-#endif
-
- if (file.ReadAt(kOffset, &fWindowPosition, sizeof(BPoint))
- != sizeof(BPoint)) {
- // set default window position (invalid positions will be
- // corrected by the application; the window will be centered
- // in this case)
- fWindowPosition.x = -1;
- fWindowPosition.y = -1;
- }
-
-#ifdef DEBUG
- Dump();
-#endif
-}
-
-
-status_t
-MouseSettings::_SaveSettings()
-{
- BPath path;
- status_t status = _GetSettingsPath(path);
- if (status < B_OK)
- return status;
-
- BFile file(path.Path(), B_READ_WRITE | B_CREATE_FILE);
- status = file.InitCheck();
- if (status < B_OK)
- return status;
-
-#if R5_COMPATIBLE
- const off_t kOffset = sizeof(mouse_settings) - sizeof(mouse_map)
- + sizeof(int32) * 3;
- // we have to do this because mouse_map counts 16 buttons in OBOS
-#else
- const off_t kOffset = sizeof(mouse_settings);
-#endif
-
- file.WriteAt(kOffset, &fWindowPosition, sizeof(BPoint));
-
- return B_OK;
-}
-
-
-#ifdef DEBUG
-void
-MouseSettings::Dump()
-{
- printf("type:\t\t%" B_PRId32 " button mouse\n", fSettings.type);
- printf("map:\t\tleft = %" B_PRIu32 " : middle = %" B_PRIu32 " : right =
%"
- B_PRIu32 "\n", fSettings.map.button[0], fSettings.map.button[2],
- fSettings.map.button[1]);
- printf("click speed:\t%" B_PRId64 "\n", fSettings.click_speed);
- printf("accel:\t\t%s\n", fSettings.accel.enabled ? "enabled" :
"disabled");
- printf("accel factor:\t%" B_PRId32 "\n", fSettings.accel.accel_factor);
- printf("speed:\t\t%" B_PRId32 "\n", fSettings.accel.speed);
-
- const char *mode = "unknown";
- switch (fMode) {
- case B_NORMAL_MOUSE:
- mode = "click to focus and raise";
- break;
- case B_CLICK_TO_FOCUS_MOUSE:
- mode = "click to focus";
- break;
- case B_FOCUS_FOLLOWS_MOUSE:
- mode = "focus follows mouse";
- break;
- }
- printf("mouse mode:\t%s\n", mode);
-
- const char *focus_follows_mouse_mode = "unknown";
- switch (fFocusFollowsMouseMode) {
- case B_NORMAL_FOCUS_FOLLOWS_MOUSE:
- focus_follows_mouse_mode = "normal";
- break;
- case B_WARP_FOCUS_FOLLOWS_MOUSE:
- focus_follows_mouse_mode = "warp";
- break;
- case B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE:
- focus_follows_mouse_mode = "instant warp";
- break;
- }
- printf("focus follows mouse mode:\t%s\n", focus_follows_mouse_mode);
- printf("accept first click:\t%s\n",
- fAcceptFirstClick ? "enabled" : "disabled");
-}
-#endif
-
-
-// Resets the settings to the system defaults
-void
-MouseSettings::Defaults()
-{
- SetClickSpeed(kDefaultClickSpeed);
- SetMouseSpeed(kDefaultMouseSpeed);
- SetMouseType(kDefaultMouseType);
- SetAccelerationFactor(kDefaultAccelerationFactor);
- SetMouseMode(B_NORMAL_MOUSE);
- SetFocusFollowsMouseMode(B_NORMAL_FOCUS_FOLLOWS_MOUSE);
- SetAcceptFirstClick(kDefaultAcceptFirstClick);
-
- mouse_map map;
- if (get_mouse_map(&map) == B_OK) {
- map.button[0] = B_PRIMARY_MOUSE_BUTTON;
- map.button[1] = B_SECONDARY_MOUSE_BUTTON;
- map.button[2] = B_TERTIARY_MOUSE_BUTTON;
- SetMapping(map);
- }
-}
-
-
-// Checks if the settings are different then the system defaults
-bool
-MouseSettings::IsDefaultable()
-{
- return fSettings.click_speed != kDefaultClickSpeed
- || fSettings.accel.speed != kDefaultMouseSpeed
- || fSettings.type != kDefaultMouseType
- || fSettings.accel.accel_factor != kDefaultAccelerationFactor
- || fMode != B_NORMAL_MOUSE
- || fFocusFollowsMouseMode != B_NORMAL_FOCUS_FOLLOWS_MOUSE
- || fAcceptFirstClick != kDefaultAcceptFirstClick
- || fSettings.map.button[0] != B_PRIMARY_MOUSE_BUTTON
- || fSettings.map.button[1] != B_SECONDARY_MOUSE_BUTTON
- || fSettings.map.button[2] != B_TERTIARY_MOUSE_BUTTON;
-}
-
-
-// Reverts to the active settings at program startup
-void
-MouseSettings::Revert()
-{
- SetClickSpeed(fOriginalSettings.click_speed);
- SetMouseSpeed(fOriginalSettings.accel.speed);
- SetMouseType(fOriginalSettings.type);
- SetAccelerationFactor(fOriginalSettings.accel.accel_factor);
- SetMouseMode(fOriginalMode);
- SetFocusFollowsMouseMode(fOriginalFocusFollowsMouseMode);
- SetAcceptFirstClick(fOriginalAcceptFirstClick);
-
- SetMapping(fOriginalSettings.map);
-}
-
-
-// Checks if the settings are different then the original settings
-bool
-MouseSettings::IsRevertable()
-{
- return fSettings.click_speed != fOriginalSettings.click_speed
- || fSettings.accel.speed != fOriginalSettings.accel.speed
- || fSettings.type != fOriginalSettings.type
- || fSettings.accel.accel_factor !=
fOriginalSettings.accel.accel_factor
- || fMode != fOriginalMode
- || fFocusFollowsMouseMode != fOriginalFocusFollowsMouseMode
- || fAcceptFirstClick != fOriginalAcceptFirstClick
- || fSettings.map.button[0] != fOriginalSettings.map.button[0]
- || fSettings.map.button[1] != fOriginalSettings.map.button[1]
- || fSettings.map.button[2] != fOriginalSettings.map.button[2];
-}
-
-
-void
-MouseSettings::SetWindowPosition(BPoint corner)
-{
- fWindowPosition = corner;
-}
-
-
-void
-MouseSettings::SetMouseType(int32 type)
-{
- if (set_mouse_type(type) == B_OK)
- fSettings.type = type;
- else
- fprintf(stderr, "error when set_mouse_type\n");
-}
-
-
-bigtime_t
-MouseSettings::ClickSpeed() const
-{
- return 1000000LL - fSettings.click_speed;
- // to correct the Sliders 0-100000 scale
-}
-
-
-void
-MouseSettings::SetClickSpeed(bigtime_t clickSpeed)
-{
- clickSpeed = 1000000LL - clickSpeed;
-
- if (set_click_speed(clickSpeed) == B_OK)
- fSettings.click_speed = clickSpeed;
- else
- fprintf(stderr, "error when set_click_speed\n");
-}
-
-
-void
-MouseSettings::SetMouseSpeed(int32 speed)
-{
- if (set_mouse_speed(speed) == B_OK)
- fSettings.accel.speed = speed;
- else
- fprintf(stderr, "error when set_mouse_speed\n");
-}
-
-
-void
-MouseSettings::SetAccelerationFactor(int32 factor)
-{
- if (set_mouse_acceleration(factor) == B_OK)
- fSettings.accel.accel_factor = factor;
- else
- fprintf(stderr, "error when set_mouse_acceleration\n");
-}
-
-
-uint32
-MouseSettings::Mapping(int32 index) const
-{
- return fSettings.map.button[index];
-}
-
-
-void
-MouseSettings::Mapping(mouse_map &map) const
-{
- map = fSettings.map;
-}
-
-
-void
-MouseSettings::SetMapping(int32 index, uint32 button)
-{
- fSettings.map.button[index] = button;
- if (set_mouse_map(&fSettings.map) != B_OK)
- fprintf(stderr, "error when set_mouse_map\n");
-}
-
-
-void
-MouseSettings::SetMapping(mouse_map &map)
-{
- if (set_mouse_map(&map) == B_OK)
- fSettings.map = map;
- else
- fprintf(stderr, "error when set_mouse_map\n");
-}
-
-
-void
-MouseSettings::SetMouseMode(mode_mouse mode)
-{
- set_mouse_mode(mode);
- fMode = mode;
-}
-
-
-void
-MouseSettings::SetFocusFollowsMouseMode(mode_focus_follows_mouse mode)
-{
- set_focus_follows_mouse_mode(mode);
- fFocusFollowsMouseMode = mode;
-}
-
-
-void
-MouseSettings::SetAcceptFirstClick(bool accept_first_click)
-{
- set_accept_first_click(accept_first_click);
- fAcceptFirstClick = accept_first_click;
-}
-
diff --git a/src/preferences/mouse/MouseSettings.h
b/src/preferences/mouse/MouseSettings.h
deleted file mode 100644
index d5d1c805f2..0000000000
--- a/src/preferences/mouse/MouseSettings.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2003-2009 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- * Brecht Machiels (brecht@xxxxxxxxxxx)
- */
-#ifndef MOUSE_SETTINGS_H
-#define MOUSE_SETTINGS_H
-
-
-#include <InterfaceDefs.h>
-#include <Point.h>
-#include <SupportDefs.h>
-
-#include "kb_mouse_settings.h"
-
-
-class BPath;
-
-class MouseSettings {
-public:
- MouseSettings();
- ~MouseSettings();
-
- void Revert();
- bool IsRevertable();
- void Defaults();
- bool IsDefaultable();
- void Dump();
-
- BPoint WindowPosition() const { return fWindowPosition; }
- void SetWindowPosition(BPoint corner);
-
- int32 MouseType() const { return fSettings.type; }
- void SetMouseType(int32 type);
-
- bigtime_t ClickSpeed() const;
- void SetClickSpeed(bigtime_t click_speed);
-
- int32 MouseSpeed() const { return fSettings.accel.speed; }
- void SetMouseSpeed(int32 speed);
-
- int32 AccelerationFactor() const { return
fSettings.accel.accel_factor; }
- void SetAccelerationFactor(int32 factor);
-
- uint32 Mapping(int32 index) const;
- void Mapping(mouse_map &map) const;
- void SetMapping(int32 index, uint32 button);
- void SetMapping(mouse_map &map);
-
- mode_mouse MouseMode() const { return fMode; }
- void SetMouseMode(mode_mouse mode);
-
- mode_focus_follows_mouse FocusFollowsMouseMode() const {
- return fFocusFollowsMouseMode;
- }
- void SetFocusFollowsMouseMode(mode_focus_follows_mouse mode);
-
- bool AcceptFirstClick() const { return fAcceptFirstClick; }
- void SetAcceptFirstClick(bool accept_first_click);
-
-private:
- static status_t _GetSettingsPath(BPath &path);
- void _RetrieveSettings();
- status_t _SaveSettings();
-
- mouse_settings fSettings, fOriginalSettings;
- mode_mouse fMode, fOriginalMode;
- mode_focus_follows_mouse fFocusFollowsMouseMode;
- mode_focus_follows_mouse fOriginalFocusFollowsMouseMode;
- bool fAcceptFirstClick,
fOriginalAcceptFirstClick;
- BPoint fWindowPosition;
-};
-
-#endif // MOUSE_SETTINGS_H
diff --git a/src/preferences/mouse/MouseView.cpp
b/src/preferences/mouse/MouseView.cpp
deleted file mode 100644
index 4a28bf5c20..0000000000
--- a/src/preferences/mouse/MouseView.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright 2003-2015 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- * Philippe Saint-Pierre stpere@xxxxxxxxx
- */
-
-
-#include "MouseView.h"
-
-#include <algorithm>
-
-#include <Box.h>
-#include <Button.h>
-#include <Debug.h>
-#include <GradientLinear.h>
-#include <GradientRadial.h>
-#include <MenuField.h>
-#include <MenuItem.h>
-#include <PopUpMenu.h>
-#include <Region.h>
-#include <Shape.h>
-#include <Slider.h>
-#include <TextControl.h>
-#include <TranslationUtils.h>
-#include <TranslatorFormats.h>
-#include <Window.h>
-
-#include "MouseConstants.h"
-#include "MouseSettings.h"
-#include "MouseWindow.h"
-
-
-static const int32 kButtonTop = 3;
-static const int32 kMouseDownWidth = 72;
-static const int32 kMouseDownHeight = 35;
-
-static const int32 kOneButtonOffsets[4]
- = { 0, kMouseDownWidth };
-static const int32 kTwoButtonOffsets[4]
- = { 0, kMouseDownWidth / 2, kMouseDownWidth };
-static const int32 kThreeButtonOffsets[4]
- = { 0, kMouseDownWidth / 3 + 1, kMouseDownWidth / 3 * 2,
kMouseDownWidth };
-
-static const rgb_color kButtonTextColor = { 0, 0, 0, 255 };
-static const rgb_color kMouseShadowColor = { 100, 100, 100, 128 };
-static const rgb_color kMouseBodyTopColor = { 0xed, 0xed, 0xed, 255 };
-static const rgb_color kMouseBodyBottomColor = { 0x85, 0x85, 0x85, 255 };
-static const rgb_color kMouseOutlineColor = { 0x51, 0x51, 0x51, 255 };
-static const rgb_color kMouseButtonOutlineColor = { 0xa0, 0xa0, 0xa0, 255 };
-static const rgb_color kButtonPressedColor = { 110, 110, 110, 110 };
-
-
-static const int32*
-getButtonOffsets(int32 type)
-{
- switch (type) {
- case 1:
- return kOneButtonOffsets;
- case 2:
- return kTwoButtonOffsets;
- case 3:
- default:
- return kThreeButtonOffsets;
- }
-}
-
-
-static uint32
-getMappingNumber(int32 mapping)
-{
- switch (mapping) {
- case B_PRIMARY_MOUSE_BUTTON:
- return 0;
- case B_SECONDARY_MOUSE_BUTTON:
- return 1;
- case B_TERTIARY_MOUSE_BUTTON:
- return 2;
- }
- return 0;
-}
-
-
-// #pragma mark -
-
-
-MouseView::MouseView(const MouseSettings &settings)
- :
- BView("mouse_view", B_PULSE_NEEDED | B_WILL_DRAW),
- fSettings(settings),
- fType(-1),
- fButtons(0),
- fOldButtons(0)
-{
- SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
- fScaling = std::max(1.0f, be_plain_font->Size() / 12.0f);
-}
-
-
-MouseView::~MouseView()
-{
-}
-
-
-void
-MouseView::SetMouseType(int32 type)
-{
- fType = type;
- Invalidate();
-}
-
-
-void
-MouseView::MouseMapUpdated()
-{
- Invalidate();
-}
-
-
-void
-MouseView::UpdateFromSettings()
-{
- SetMouseType(fSettings.MouseType());
-}
-
-
-void
-MouseView::GetPreferredSize(float* _width, float* _height)
-{
- if (_width != NULL)
- *_width = fScaling * (kMouseDownWidth + 2);
- if (_height != NULL)
- *_height = fScaling * 104;
-}
-
-
-void
-MouseView::AttachedToWindow()
-{
- AdoptParentColors();
-
- UpdateFromSettings();
- _CreateButtonsPicture();
-
- font_height fontHeight;
- GetFontHeight(&fontHeight);
- fDigitHeight = int32(ceilf(fontHeight.ascent) +
ceilf(fontHeight.descent));
- fDigitBaseline = int32(ceilf(fontHeight.ascent));
-}
-
-
-void
-MouseView::MouseUp(BPoint)
-{
- fButtons = 0;
- Invalidate(_ButtonsRect());
- fOldButtons = fButtons;
-}
-
-
-void
-MouseView::MouseDown(BPoint where)
-{
- BMessage *mouseMsg = Window()->CurrentMessage();
- fButtons = mouseMsg->FindInt32("buttons");
- int32 modifiers = mouseMsg->FindInt32("modifiers");
- if (modifiers & B_CONTROL_KEY) {
- if (modifiers & B_COMMAND_KEY)
- fButtons = B_TERTIARY_MOUSE_BUTTON;
- else
- fButtons = B_SECONDARY_MOUSE_BUTTON;
- }
-
- // Get the current clipping region before requesting any updates.
- // Otherwise those parts would be excluded from the region.
- BRegion clipping;
- GetClippingRegion(&clipping);
-
- if (fOldButtons != fButtons) {
- Invalidate(_ButtonsRect());
- fOldButtons = fButtons;
- }
-
- const int32* offset = getButtonOffsets(fType);
- int32 button = -1;
- for (int32 i = 0; i <= fType; i++) {
- if (_ButtonRect(offset, i).Contains(where)) {
- button = i;
- break;
- }
- }
- if (button < 0)
- return;
-
- // We are setup to receive all mouse events, even if our window
- // is not active, so make sure that we don't display the menu when
- // the user clicked inside our view, but another window is on top.
- if (clipping.Contains(where)) {
- button = _ConvertFromVisualOrder(button);
-
- BPopUpMenu menu("Mouse Map Menu");
- BMessage message(kMsgMouseMap);
- message.AddInt32("button", button);
-
- menu.AddItem(new BMenuItem("1", new BMessage(message)));
- menu.AddItem(new BMenuItem("2", new BMessage(message)));
- menu.AddItem(new BMenuItem("3", new BMessage(message)));
-
- menu.ItemAt(getMappingNumber(fSettings.Mapping(button)))
- ->SetMarked(true);
- menu.SetTargetForItems(Window());
-
- ConvertToScreen(&where);
- menu.Go(where, true);
- }
-}
-
-
-void
-MouseView::Draw(BRect updateFrame)
-{
- SetDrawingMode(B_OP_ALPHA);
- SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
- SetScale(fScaling * 1.8);
-
- BShape mouseShape;
- mouseShape.MoveTo(BPoint(16, 12));
- // left
- BPoint control[3] = { BPoint(12, 16), BPoint(8, 64), BPoint(32, 64) };
- mouseShape.BezierTo(control);
- // right
- BPoint control2[3] = { BPoint(56, 64), BPoint(52, 16), BPoint(48, 12) };
- mouseShape.BezierTo(control2);
- // top
- BPoint control3[3] = { BPoint(44, 8), BPoint(20, 8), BPoint(16, 12) };
- mouseShape.BezierTo(control3);
- mouseShape.Close();
-
- // Draw the shadow
- SetOrigin(-17 * fScaling, -11 * fScaling);
- SetHighColor(kMouseShadowColor);
- FillShape(&mouseShape, B_SOLID_HIGH);
-
- // Draw the body
- SetOrigin(-21 * fScaling, -14 * fScaling);
- BGradientRadial bodyGradient(28, 24, 128);
- bodyGradient.AddColor(kMouseBodyTopColor, 0);
- bodyGradient.AddColor(kMouseBodyBottomColor, 255);
-
- FillShape(&mouseShape, bodyGradient);
-
- // Draw the outline
- SetPenSize(1 / 1.8 / fScaling);
- SetDrawingMode(B_OP_OVER);
- SetHighColor(kMouseOutlineColor);
-
- StrokeShape(&mouseShape, B_SOLID_HIGH);
-
- // bottom button border
- BShape buttonsOutline;
- buttonsOutline.MoveTo(BPoint(13, 27));
- BPoint control4[] = { BPoint(18, 30), BPoint(46, 30), BPoint(51, 27) };
- buttonsOutline.BezierTo(control4);
-
- SetHighColor(kMouseButtonOutlineColor);
- StrokeShape(&buttonsOutline, B_SOLID_HIGH);
-
- SetScale(1);
- SetOrigin(0, 0);
-
- // Separator between the buttons
- const int32* offset = getButtonOffsets(fType);
- for (int32 i = 1; i < fType; i++) {
- BRect buttonRect = _ButtonRect(offset, i);
- StrokeLine(buttonRect.LeftTop(), buttonRect.LeftBottom());
- }
-
- mouse_map map;
- fSettings.Mapping(map);
-
- SetDrawingMode(B_OP_OVER);
-
- if (fButtons != 0)
- ClipToPicture(&fButtonsPicture, B_ORIGIN, false);
-
- for (int32 i = 0; i < fType; i++) {
- // draw mapping number centered over the button
-
- bool pressed = (fButtons &
map.button[_ConvertFromVisualOrder(i)]) != 0;
- // is button currently pressed?
- if (pressed) {
- SetDrawingMode(B_OP_ALPHA);
- SetHighColor(kButtonPressedColor);
- FillRect(_ButtonRect(offset, i));
- }
-
- BRect border(fScaling * (offset[i] + 1), fScaling * (kButtonTop
+ 5),
- fScaling * offset[i + 1] - 1,
- fScaling * (kButtonTop + kMouseDownHeight - 4));
- if (i == 0)
- border.left += fScaling * 5;
- if (i == fType - 1)
- border.right -= fScaling * 4;
-
- char number[2] = {0};
- number[0] =
getMappingNumber(map.button[_ConvertFromVisualOrder(i)])
- + '1';
-
- SetDrawingMode(B_OP_OVER);
- SetHighColor(kButtonTextColor);
- DrawString(number, BPoint(
- border.left + (border.Width() - StringWidth(number)) /
2,
- border.top + fDigitBaseline
- + (border.IntegerHeight() - fDigitHeight) / 2));
- }
-
- if (fButtons != 0)
- ClipToPicture(NULL);
-}
-
-
-BRect
-MouseView::_ButtonsRect() const
-{
- return BRect(0, fScaling * kButtonTop, fScaling * kMouseDownWidth,
- fScaling * (kButtonTop + kMouseDownHeight));
-}
-
-
-BRect
-MouseView::_ButtonRect(const int32* offsets, int index) const
-{
- return BRect(fScaling * offsets[index], fScaling * kButtonTop,
- fScaling * offsets[index + 1] - 1,
- fScaling * (kButtonTop + kMouseDownHeight));
-}
-
-
-int32
-MouseView::_ConvertFromVisualOrder(int32 i)
-{
- if (fType < 3)
- return i;
-
- switch (i) {
- case 0:
- default:
- return 0;
- case 1:
- return 2;
- case 2:
- return 1;
- }
-}
-
-
-void
-MouseView::_CreateButtonsPicture()
-{
- BeginPicture(&fButtonsPicture);
- SetScale(1.8 * fScaling);
- SetOrigin(-21 * fScaling, -14 * fScaling);
-
- BShape mouseShape;
- mouseShape.MoveTo(BPoint(48, 12));
- // top
- BPoint control3[3] = { BPoint(44, 8), BPoint(20, 8), BPoint(16, 12) };
- mouseShape.BezierTo(control3);
- // left
- BPoint control[3] = { BPoint(12, 16), BPoint(13, 27), BPoint(13, 27) };
- mouseShape.BezierTo(control);
- // bottom
- BPoint control4[] = { BPoint(18, 30), BPoint(46, 30), BPoint(51, 27) };
- mouseShape.BezierTo(control4);
- // right
- BPoint control2[3] = { BPoint(51, 27), BPoint(50, 14), BPoint(48, 12) };
- mouseShape.BezierTo(control2);
-
- mouseShape.Close();
-
- SetHighColor(255, 0, 0, 255);
- FillShape(&mouseShape, B_SOLID_HIGH);
-
- EndPicture();
- SetScale(1);
-}
diff --git a/src/preferences/mouse/MouseView.h
b/src/preferences/mouse/MouseView.h
deleted file mode 100644
index fd5097bab3..0000000000
--- a/src/preferences/mouse/MouseView.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2003-2015 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- */
-#ifndef MOUSE_VIEW_H
-#define MOUSE_VIEW_H
-
-
-#include <Bitmap.h>
-#include <Picture.h>
-#include <PopUpMenu.h>
-#include <View.h>
-
-
-class MouseSettings;
-
-class MouseView : public BView {
-public:
- MouseView(const
MouseSettings& settings);
- virtual ~MouseView();
-
- void SetMouseType(int32
type);
- void MouseMapUpdated();
- void UpdateFromSettings();
-
- virtual void GetPreferredSize(float* _width,
float* _height);
- virtual void AttachedToWindow();
- virtual void MouseUp(BPoint where);
- virtual void MouseDown(BPoint where);
- virtual void Draw(BRect frame);
-
-private:
- BRect _ButtonsRect() const;
- BRect _ButtonRect(const
int32* offsets,
- int
index) const;
- int32
_ConvertFromVisualOrder(int32 button);
- void _CreateButtonsPicture();
-
-private:
- typedef BView inherited;
-
- const MouseSettings& fSettings;
-
- BPicture fButtonsPicture;
- int32 fDigitBaseline;
- int32 fDigitHeight;
- float fScaling;
-
- int32 fType;
- uint32 fButtons;
- uint32 fOldButtons;
-};
-
-
-#endif /* MOUSE_VIEW_H */
diff --git a/src/preferences/mouse/MouseWindow.cpp
b/src/preferences/mouse/MouseWindow.cpp
deleted file mode 100644
index 4ce29a8776..0000000000
--- a/src/preferences/mouse/MouseWindow.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright 2003-2014 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- * Brecht Machiels (brecht@xxxxxxxxxxx)
- */
-
-#include <Alert.h>
-#include <Application.h>
-#include <Button.h>
-#include <Catalog.h>
-#include <CheckBox.h>
-#include <Debug.h>
-#include <LayoutBuilder.h>
-#include <Locale.h>
-#include <Menu.h>
-#include <MenuField.h>
-#include <MenuItem.h>
-#include <Message.h>
-#include <Screen.h>
-#include <SeparatorView.h>
-#include <Slider.h>
-
-#include "MouseWindow.h"
-#include "MouseConstants.h"
-#include "SettingsView.h"
-
-#undef B_TRANSLATION_CONTEXT
-#define B_TRANSLATION_CONTEXT "MouseWindow"
-
-MouseWindow::MouseWindow(BRect _rect)
- :
- BWindow(_rect, B_TRANSLATE_SYSTEM_NAME("Mouse"), B_TITLED_WINDOW,
- B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
- | B_AUTO_UPDATE_SIZE_LIMITS)
-{
- // Add the main settings view
- fSettingsView = new SettingsView(fSettings);
-
- // Add the "Default" button
- fDefaultsButton = new BButton(B_TRANSLATE("Defaults"),
- new BMessage(kMsgDefaults));
- fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
- // Add the "Revert" button
- fRevertButton = new BButton(B_TRANSLATE("Revert"),
- new BMessage(kMsgRevert));
- fRevertButton->SetEnabled(false);
-
- SetPulseRate(100000);
- // we are using the pulse rate to scan pressed mouse
- // buttons and draw the selected imagery
-
- // Build the layout
- BLayoutBuilder::Group<>(this, B_VERTICAL)
- .AddGroup(B_HORIZONTAL)
- .SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
- B_USE_WINDOW_SPACING, 0)
- .Add(fSettingsView)
- .End()
- .Add(new BSeparatorView(B_HORIZONTAL))
- .AddGroup(B_HORIZONTAL)
- .SetInsets(B_USE_WINDOW_SPACING, 0,
B_USE_WINDOW_SPACING,
- B_USE_WINDOW_SPACING)
- .Add(fDefaultsButton)
- .Add(fRevertButton)
- .AddGlue()
- .End();
-
- // check if the window is on screen
- BRect rect = BScreen().Frame();
- rect.InsetBySelf(20, 20);
-
- BPoint position = fSettings.WindowPosition();
- BRect windowFrame = Frame().OffsetToSelf(position);
- if (!rect.Contains(windowFrame)) {
- // center window on screen as it doesn't fit on the saved
position
- position.x = (rect.Width() - windowFrame.Width()) / 2;
- position.y = (rect.Height() - windowFrame.Height()) / 2;
- if (position.x < 0)
- position.x = 0;
- if (position.y < 0)
- position.y = 15;
- }
- MoveTo(position);
-}
-
-
-bool
-MouseWindow::QuitRequested()
-{
- fSettings.SetWindowPosition(Frame().LeftTop());
- be_app->PostMessage(B_QUIT_REQUESTED);
-
- return true;
-}
-
-
-void
-MouseWindow::MessageReceived(BMessage* message)
-{
- switch (message->what) {
- case kMsgDefaults: {
- // reverts to default settings
- fSettings.Defaults();
- fSettingsView->UpdateFromSettings();
-
- fDefaultsButton->SetEnabled(false);
- fRevertButton->SetEnabled(fSettings.IsRevertable());
- break;
- }
-
- case kMsgRevert: {
- // revert to last settings
- fSettings.Revert();
- fSettingsView->UpdateFromSettings();
-
- fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
- fRevertButton->SetEnabled(false);
- break;
- }
-
- case kMsgMouseType:
- {
- int32 type;
- if (message->FindInt32("index", &type) == B_OK) {
- fSettings.SetMouseType(++type);
- fSettingsView->SetMouseType(type);
-
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
fRevertButton->SetEnabled(fSettings.IsRevertable());
- }
- break;
- }
-
- case kMsgMouseFocusMode:
- {
- int32 mode;
- if (message->FindInt32("mode", &mode) == B_OK) {
- fSettings.SetMouseMode((mode_mouse)mode);
-
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
fRevertButton->SetEnabled(fSettings.IsRevertable());
-
fSettingsView->fFocusFollowsMouseMenu->SetEnabled(
- mode == B_FOCUS_FOLLOWS_MOUSE);
- fSettingsView->fAcceptFirstClickBox->SetEnabled(
- mode != B_FOCUS_FOLLOWS_MOUSE);
- }
- break;
- }
-
- case kMsgFollowsMouseMode:
- {
- int32 mode;
- if (message->FindInt32("mode_focus_follows_mouse",
&mode)
- == B_OK) {
- fSettings.SetFocusFollowsMouseMode(
- (mode_focus_follows_mouse)mode);
-
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
fRevertButton->SetEnabled(fSettings.IsRevertable());
- }
- break;
- }
-
- case kMsgAcceptFirstClick:
- {
- BHandler *handler;
- if (message->FindPointer("source",
- reinterpret_cast<void**>(&handler)) == B_OK) {
- bool acceptFirstClick = false;
- BCheckBox *acceptFirstClickBox =
- dynamic_cast<BCheckBox*>(handler);
- if (acceptFirstClickBox)
- acceptFirstClick =
acceptFirstClickBox->Value()
- == B_CONTROL_ON;
- fSettings.SetAcceptFirstClick(acceptFirstClick);
-
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
fRevertButton->SetEnabled(fSettings.IsRevertable());
- }
- break;
- }
-
- case kMsgDoubleClickSpeed:
- {
- int32 value;
- if (message->FindInt32("be:value", &value) == B_OK) {
- // slow = 1000000, fast = 0
- fSettings.SetClickSpeed(value * 1000);
-
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
fRevertButton->SetEnabled(fSettings.IsRevertable());
- }
- break;
- }
-
- case kMsgMouseSpeed:
- {
- int32 value;
- if (message->FindInt32("be:value", &value) == B_OK) {
- // slow = 8192, fast = 524287
- fSettings.SetMouseSpeed((int32)pow(2,
- value * 6.0 / 1000) * 8192);
-
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
fRevertButton->SetEnabled(fSettings.IsRevertable());
- }
- break;
- }
-
- case kMsgAccelerationFactor:
- {
- int32 value;
- if (message->FindInt32("be:value", &value) == B_OK) {
- // slow = 0, fast = 262144
- fSettings.SetAccelerationFactor((int32)pow(
- value * 4.0 / 1000, 2) * 16384);
-
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
fRevertButton->SetEnabled(fSettings.IsRevertable());
- }
- break;
- }
-
- case kMsgMouseMap:
- {
- int32 index;
- int32 button;
- if (message->FindInt32("index", &index) == B_OK
- && message->FindInt32("button", &button) ==
B_OK) {
- int32 mapping = B_PRIMARY_MOUSE_BUTTON;
- switch (index) {
- case 1:
- mapping =
B_SECONDARY_MOUSE_BUTTON;
- break;
- case 2:
- mapping =
B_TERTIARY_MOUSE_BUTTON;
- break;
- }
-
- fSettings.SetMapping(button, mapping);
-
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
-
fRevertButton->SetEnabled(fSettings.IsRevertable());
- fSettingsView->MouseMapUpdated();
- }
- break;
- }
-
- default:
- BWindow::MessageReceived(message);
- break;
- }
-}
-
diff --git a/src/preferences/mouse/MouseWindow.h
b/src/preferences/mouse/MouseWindow.h
deleted file mode 100644
index c1d271a2db..0000000000
--- a/src/preferences/mouse/MouseWindow.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2003-2009 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- * Brecht Machiels (brecht@xxxxxxxxxxx)
- */
-#ifndef MOUSE_WINDOW_H
-#define MOUSE_WINDOW_H
-
-
-#include <Box.h>
-#include <Button.h>
-#include <Window.h>
-
-#include "MouseSettings.h"
-
-
-class SettingsView;
-
-class MouseWindow : public BWindow {
-public:
- MouseWindow(BRect rect);
-
- virtual bool QuitRequested();
- virtual void MessageReceived(BMessage *message);
-
-private:
- MouseSettings fSettings;
- BButton *fDefaultsButton;
- BButton *fRevertButton;
- SettingsView *fSettingsView;
- BBox *fSettingsBox;
-};
-
-#endif /* MOUSE_WINDOW_H */
diff --git a/src/preferences/mouse/SettingsView.cpp
b/src/preferences/mouse/SettingsView.cpp
deleted file mode 100644
index fdb9b27c1d..0000000000
--- a/src/preferences/mouse/SettingsView.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright 2003-2014 Haiku Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval,
- * Axel Dörfler (axeld@xxxxxxxxxxxxxxxx)
- * Andrew McCall (mccall@xxxxxxxxxxxxxxxxxxxxx)
- * Brecht Machiels (brecht@xxxxxxxxxxx)
- */
-
-
-#include "SettingsView.h"
-
-#include <Bitmap.h>
-#include <Box.h>
-#include <Button.h>
-#include <Catalog.h>
-#include <Debug.h>
-#include <InterfaceDefs.h>
-#include <LayoutBuilder.h>
-#include <Locale.h>
-#include <MenuField.h>
-#include <MenuItem.h>
-#include <PopUpMenu.h>
-#include <SeparatorView.h>
-#include <Slider.h>
-#include <TextControl.h>
-#include <TranslationUtils.h>
-#include <Window.h>
-
-#include "MouseConstants.h"
-#include "MouseSettings.h"
-#include "MouseView.h"
-
-
-static int32
-mouse_mode_to_index(mode_mouse mode)
-{
- switch (mode) {
- case B_NORMAL_MOUSE:
- default:
- return 0;
- case B_CLICK_TO_FOCUS_MOUSE:
- return 1;
- case B_FOCUS_FOLLOWS_MOUSE:
- return 2;
- }
-}
-
-
-static int32
-focus_follows_mouse_mode_to_index(mode_focus_follows_mouse mode)
-{
- switch (mode) {
- case B_NORMAL_FOCUS_FOLLOWS_MOUSE:
- default:
- return 0;
- case B_WARP_FOCUS_FOLLOWS_MOUSE:
- return 1;
- case B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE:
- return 2;
- }
-}
-
-
-// #pragma mark -
-
-#undef B_TRANSLATION_CONTEXT
-#define B_TRANSLATION_CONTEXT "SettingsView"
-
-SettingsView::SettingsView(MouseSettings& settings)
- : BBox("main_view"),
- fSettings(settings)
-{
- // Add the "Mouse Type" pop up menu
- fTypeMenu = new BPopUpMenu("unknown");
- fTypeMenu->AddItem(new BMenuItem(B_TRANSLATE("1-Button"),
- new BMessage(kMsgMouseType)));
- fTypeMenu->AddItem(new BMenuItem(B_TRANSLATE("2-Button"),
- new BMessage(kMsgMouseType)));
- fTypeMenu->AddItem(new BMenuItem(B_TRANSLATE("3-Button"),
- new BMessage(kMsgMouseType)));
-
- BMenuField* typeField = new BMenuField(B_TRANSLATE("Mouse type:"),
- fTypeMenu);
- typeField->SetAlignment(B_ALIGN_LEFT);
-
- // Create the "Double-click speed slider...
- fClickSpeedSlider = new BSlider("double_click_speed",
- B_TRANSLATE("Double-click speed"), new
BMessage(kMsgDoubleClickSpeed),
- 0, 1000, B_HORIZONTAL);
- fClickSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
- fClickSpeedSlider->SetHashMarkCount(7);
-
- // Create the "Mouse Speed" slider...
- fMouseSpeedSlider = new BSlider("mouse_speed", B_TRANSLATE("Mouse
speed"),
- new BMessage(kMsgMouseSpeed), 0, 1000, B_HORIZONTAL);
- fMouseSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
- fMouseSpeedSlider->SetHashMarkCount(7);
-
- // Create the "Mouse Acceleration" slider...
- fAccelerationSlider = new BSlider("mouse_acceleration",
- B_TRANSLATE("Mouse acceleration"),
- new BMessage(kMsgAccelerationFactor), 0, 1000, B_HORIZONTAL);
- fAccelerationSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
- fAccelerationSlider->SetHashMarkCount(7);
-
- // Mouse image...
- fMouseView = new MouseView(fSettings);
-
- // Create the "Double-click test area" text box...
- const char* label = B_TRANSLATE("Double-click test area");
- BTextControl* doubleClickTextControl = new BTextControl(NULL,
- label, NULL);
- doubleClickTextControl->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
- doubleClickTextControl->SetExplicitMinSize(
- BSize(StringWidth(label), B_SIZE_UNSET));
-
- // Add the "Mouse focus mode" pop up menu
- fFocusMenu = new BPopUpMenu(B_TRANSLATE("Click to focus and raise"));
-
- const char *focusLabels[] = {B_TRANSLATE_MARK("Click to focus and
raise"),
- B_TRANSLATE_MARK("Click to focus"),
- B_TRANSLATE_MARK("Focus follows mouse")};
- const mode_mouse focusModes[] = {B_NORMAL_MOUSE, B_CLICK_TO_FOCUS_MOUSE,
-
B_FOCUS_FOLLOWS_MOUSE};
-
- for (int i = 0; i < 3; i++) {
- BMessage* message = new BMessage(kMsgMouseFocusMode);
- message->AddInt32("mode", focusModes[i]);
-
- fFocusMenu->AddItem(new
BMenuItem(B_TRANSLATE_NOCOLLECT(focusLabels[i]),
- message));
- }
-
- BMenuField* focusField = new BMenuField(B_TRANSLATE("Focus mode:"),
- fFocusMenu);
- focusField->SetAlignment(B_ALIGN_LEFT);
-
- // Add the "Focus follows mouse mode" pop up menu
- fFocusFollowsMouseMenu = new BPopUpMenu(B_TRANSLATE("Normal"));
-
- const char *focusFollowsMouseLabels[] = {B_TRANSLATE_MARK("Normal"),
- B_TRANSLATE_MARK("Warp"), B_TRANSLATE_MARK("Instant warp")};
- const mode_focus_follows_mouse focusFollowsMouseModes[]
- = {B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE,
- B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE};
-
- for (int i = 0; i < 3; i++) {
- BMessage* message = new BMessage(kMsgFollowsMouseMode);
- message->AddInt32("mode_focus_follows_mouse",
- focusFollowsMouseModes[i]);
-
- fFocusFollowsMouseMenu->AddItem(new BMenuItem(
- B_TRANSLATE_NOCOLLECT(focusFollowsMouseLabels[i]),
message));
- }
-
- BMenuField* focusFollowsMouseField = new BMenuField(
- "Focus follows mouse mode:", fFocusFollowsMouseMenu);
- focusFollowsMouseField->SetAlignment(B_ALIGN_RIGHT);
-
- // Add the "Click-through" check box
- fAcceptFirstClickBox = new BCheckBox(B_TRANSLATE("Accept first click"),
- new BMessage(kMsgAcceptFirstClick));
-
- // Build the layout
-
- // Layout is :
- // A | B
- // -----
- // C
-
- BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
- // Horizontal : A|B
- .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
-
- // Vertical block A: mouse type/view/test
- .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
- .AddGroup(B_HORIZONTAL, 0)
- .AddGlue()
- .Add(typeField)
- .AddGlue()
- .End()
- .AddGlue()
- .AddGroup(B_HORIZONTAL, 0)
- .AddGlue()
- .Add(fMouseView)
- .AddGlue()
- .End()
- .AddGlue()
- .Add(doubleClickTextControl)
- .End()
- .Add(new BSeparatorView(B_VERTICAL))
-
- // Vertical block B: speed settings
- .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING, 3)
- .AddGroup(B_HORIZONTAL, 0)
- .Add(fClickSpeedSlider)
- .End()
- .AddGroup(B_HORIZONTAL, 0)
- .Add(fMouseSpeedSlider)
- .End()
- .AddGroup(B_HORIZONTAL, 0)
- .Add(fAccelerationSlider)
- .End()
- .End()
- .End()
- .AddStrut(B_USE_DEFAULT_SPACING)
-
- // Horizontal Block C: focus mode
- .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
- .Add(focusField)
- .AddGlue()
- .AddGroup(B_VERTICAL, 0)
- .Add(fAcceptFirstClickBox)
- .End()
- .End();
-
- SetBorder(B_NO_BORDER);
-}
-
-
-SettingsView::~SettingsView()
-{
-
-}
-
-
-void
-SettingsView::AttachedToWindow()
-{
- UpdateFromSettings();
-
-
-}
-
-
-void
-SettingsView::SetMouseType(int32 type)
-{
- fMouseView->SetMouseType(type);
-}
-
-
-void
-SettingsView::MouseMapUpdated()
[ *** diff truncated: 1343 lines dropped *** ]