Menu settings are now handled by the app_server. As a result, changing them does something, although they aren't saved to disk yet. 'click_to_open' is not checked anymore, because it was useless anyway, I'll remove it from the Menu preflet too.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17174 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
77214f9012
commit
b03deb09db
@ -785,26 +785,6 @@ shift_color(rgb_color color, float shift)
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
load_menu_settings(menu_info &into)
|
||||
{
|
||||
// TODO: Load settings from the settings file,
|
||||
// and only if it fails, fallback to the defaults
|
||||
|
||||
// TODO: shouldn't the server handle the details? It could broadcast
|
||||
// change messages to the applications, which could also relayout
|
||||
// there menus and menu bars then (as soon as we have a layout management)
|
||||
into.font_size = be_plain_font->Size();
|
||||
be_plain_font->GetFamilyAndStyle(&into.f_family, &into.f_style);
|
||||
into.background_color = ui_color(B_MENU_BACKGROUND_COLOR);
|
||||
into.separator = 0;
|
||||
into.click_to_open = true;
|
||||
into.triggers_always_shown = false;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
extern "C" status_t
|
||||
_init_interface_kit_()
|
||||
{
|
||||
@ -818,7 +798,7 @@ _init_interface_kit_()
|
||||
_init_global_fonts_();
|
||||
|
||||
_menu_info_ptr_ = &BMenu::sMenuInfo;
|
||||
status_t status = load_menu_settings(BMenu::sMenuInfo);
|
||||
status_t status = get_menu_info(&BMenu::sMenuInfo);
|
||||
|
||||
general_info.background_color = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
general_info.mark_color.set_to(0, 0, 0);
|
||||
|
@ -20,9 +20,11 @@
|
||||
#include <Screen.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <AppServerLink.h>
|
||||
#include <BMCPrivate.h>
|
||||
#include <MenuPrivate.h>
|
||||
#include <MenuWindow.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
|
||||
class _ExtraMenuData_ {
|
||||
@ -973,8 +975,7 @@ BMenu::Track(bool sticky, BRect *clickToOpenRect)
|
||||
}
|
||||
|
||||
// If sticky is false, pass 0 to the tracking function
|
||||
// so the menu will stay in nonsticky mode, regardless
|
||||
// of the "IsStickyPrefOn()" value
|
||||
// so the menu will stay in nonsticky mode
|
||||
const bigtime_t trackTime = sticky ? system_time() : 0;
|
||||
int action;
|
||||
BMenuItem *menuItem = _track(&action, trackTime);
|
||||
@ -1215,8 +1216,8 @@ BMenu::_track(int *action, bigtime_t trackTime, long start)
|
||||
localAction = MENU_ACT_CLOSE;
|
||||
break;
|
||||
} else if (buttons == 0 && !IsStickyMode()) {
|
||||
if (IsStickyPrefOn() && (system_time() < trackTime + 1000000
|
||||
|| (fExtraRect != NULL && fExtraRect->Contains(location))))
|
||||
if (system_time() < trackTime + 1000000
|
||||
|| (fExtraRect != NULL && fExtraRect->Contains(location)))
|
||||
SetStickyMode(true);
|
||||
else {
|
||||
localAction = MENU_ACT_CLOSE;
|
||||
@ -1896,7 +1897,7 @@ BMenu::UpdateWindowViewSize(bool upWind)
|
||||
bool
|
||||
BMenu::IsStickyPrefOn()
|
||||
{
|
||||
return sMenuInfo.click_to_open;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1991,29 +1992,24 @@ BMenu::DoCreateMsg(BMenuItem *ti, BMenu *tm, BMessage *m,
|
||||
}
|
||||
|
||||
|
||||
// TODO: Maybe the following two methods would fit better into InterfaceDefs.cpp
|
||||
// In R5, they do all the work client side, we let the app_server handle the details.
|
||||
status_t
|
||||
set_menu_info(menu_info *info)
|
||||
{
|
||||
if (!info)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
BPath path;
|
||||
|
||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
|
||||
return B_OK;
|
||||
|
||||
path.Append("menu_settings");
|
||||
|
||||
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
|
||||
|
||||
if (file.InitCheck() != B_OK)
|
||||
return B_OK;
|
||||
|
||||
file.Write(info, sizeof(menu_info));
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_SET_MENU_INFO);
|
||||
link.Attach<menu_info>(*info);
|
||||
|
||||
BMenu::sMenuInfo = *info;
|
||||
status_t status = B_ERROR;
|
||||
if (link.FlushWithReply(status) == B_OK && status == B_OK)
|
||||
BMenu::sMenuInfo = *info;
|
||||
// Update also the local copy, in case anyone relies on it
|
||||
|
||||
return B_OK;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@ -2023,7 +2019,12 @@ get_menu_info(menu_info *info)
|
||||
if (!info)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
*info = BMenu::sMenuInfo;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_GET_MENU_INFO);
|
||||
|
||||
return B_OK;
|
||||
status_t status = B_ERROR;
|
||||
if (link.FlushWithReply(status) == B_OK && status == B_OK)
|
||||
link.Read<menu_info>(info);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -7,8 +7,6 @@
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
*/
|
||||
|
||||
// TODO: Finish this class
|
||||
|
||||
#include <Application.h>
|
||||
#include <Autolock.h>
|
||||
#include <MenuBar.h>
|
||||
@ -443,10 +441,8 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
|
||||
if (fSelected != NULL && fSelected->Submenu() == NULL) {
|
||||
resultItem = fSelected;
|
||||
break;
|
||||
} else if (IsStickyPrefOn())
|
||||
} else
|
||||
SetStickyMode(true);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (snoozeAmount > 0)
|
||||
|
@ -29,7 +29,8 @@ BStringView::BStringView(BRect frame, const char* name, const char* text,
|
||||
|
||||
|
||||
BStringView::BStringView(BMessage* data)
|
||||
: BView(data)
|
||||
: BView(data),
|
||||
fText(NULL)
|
||||
{
|
||||
int32 align;
|
||||
if (data->FindInt32("_align", &align) == B_OK)
|
||||
|
@ -52,14 +52,16 @@ DesktopSettings::Private::_SetDefaults()
|
||||
fScrollBarInfo.min_knob_size = 15;
|
||||
|
||||
// init menu info
|
||||
fMenuInfo.font_size = 12.0;
|
||||
// TODO: ...
|
||||
// fMenuInfo.f_family;
|
||||
// fMenuInfo.f_style;
|
||||
// fMenuInfo.background_color = gColorSet->menu_background;
|
||||
// look of the separator (R5: (0, 1, 2), default ?)
|
||||
strlcpy(fMenuInfo.f_family, fPlainFont.Family(), B_FONT_FAMILY_LENGTH);
|
||||
strlcpy(fMenuInfo.f_style, fPlainFont.Style(), B_FONT_STYLE_LENGTH);
|
||||
fMenuInfo.font_size = fPlainFont.Size();
|
||||
// TODO:
|
||||
fMenuInfo.background_color.set_to(216, 216, 216); //gColorSet->menu_background;
|
||||
|
||||
// look of the separator (R5: (0, 1, 2), default 0)
|
||||
// TODO: we could just choose a nice one and remove the others
|
||||
fMenuInfo.separator = 0;
|
||||
fMenuInfo.click_to_open = true;
|
||||
fMenuInfo.click_to_open = true; // always true
|
||||
fMenuInfo.triggers_always_shown = false;
|
||||
|
||||
fWorkspacesCount = 4;
|
||||
|
Loading…
Reference in New Issue
Block a user