Fix #4185 by making the border and title settings in the context menu positive

settings ("Show x"). This required changing various logic, some of which I
think was also wrong in the negative settings case. Now if you turn off the
border when the title is on, the title will come back when the border is turned
back on. But any changes in the title setting force the border back on. When
loading the settings the border setting takes precedence.

+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32656 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood 2009-08-24 17:38:10 +00:00
parent e15498973c
commit 9aad8c7d4b

View File

@ -521,13 +521,14 @@ WorkspacesView::MouseDown(BPoint where)
BMenuItem* item; BMenuItem* item;
menu->AddSeparatorItem(); menu->AddSeparatorItem();
menu->AddItem(item = new BMenuItem("No Window Title", menu->AddItem(item = new BMenuItem("Show Window Title",
new BMessage(kMsgToggleTitle))); new BMessage(kMsgToggleTitle)));
if (window->Look() == B_MODAL_WINDOW_LOOK) if (window->Look() == B_TITLED_WINDOW_LOOK)
item->SetMarked(true); item->SetMarked(true);
menu->AddItem(item = new BMenuItem("No Window Border", menu->AddItem(item = new BMenuItem("Show Window Border",
new BMessage(kMsgToggleBorder))); new BMessage(kMsgToggleBorder)));
if (window->Look() == B_NO_BORDER_WINDOW_LOOK) if (window->Look() == B_TITLED_WINDOW_LOOK
|| window->Look() == B_MODAL_WINDOW_LOOK)
item->SetMarked(true); item->SetMarked(true);
menu->AddSeparatorItem(); menu->AddSeparatorItem();
@ -565,10 +566,10 @@ WorkspacesWindow::WorkspacesWindow(WorkspacesSettings *settings)
{ {
AddChild(new WorkspacesView(Bounds())); AddChild(new WorkspacesView(Bounds()));
if (!fSettings->HasTitle()) if (!fSettings->HasBorder())
SetLook(B_MODAL_WINDOW_LOOK);
else if (!fSettings->HasBorder())
SetLook(B_NO_BORDER_WINDOW_LOOK); SetLook(B_NO_BORDER_WINDOW_LOOK);
else if (!fSettings->HasTitle())
SetLook(B_MODAL_WINDOW_LOOK);
if (fSettings->AlwaysOnTop()) if (fSettings->AlwaysOnTop())
SetFeel(B_FLOATING_ALL_WINDOW_FEEL); SetFeel(B_FLOATING_ALL_WINDOW_FEEL);
@ -641,11 +642,12 @@ WorkspacesWindow::MessageReceived(BMessage *message)
enable = true; enable = true;
if (enable) if (enable)
SetLook(B_TITLED_WINDOW_LOOK); if (fSettings->HasTitle())
else { SetLook(B_TITLED_WINDOW_LOOK);
else
SetLook(B_MODAL_WINDOW_LOOK);
else
SetLook(B_NO_BORDER_WINDOW_LOOK); SetLook(B_NO_BORDER_WINDOW_LOOK);
fSettings->SetHasTitle(true);
}
fSettings->SetHasBorder(enable); fSettings->SetHasBorder(enable);
break; break;
@ -654,16 +656,17 @@ WorkspacesWindow::MessageReceived(BMessage *message)
case kMsgToggleTitle: case kMsgToggleTitle:
{ {
bool enable = false; bool enable = false;
if (Look() == B_MODAL_WINDOW_LOOK) if (Look() == B_MODAL_WINDOW_LOOK
|| Look() == B_NO_BORDER_WINDOW_LOOK)
enable = true; enable = true;
if (enable) if (enable)
SetLook(B_TITLED_WINDOW_LOOK); SetLook(B_TITLED_WINDOW_LOOK);
else { else
SetLook(B_MODAL_WINDOW_LOOK); SetLook(B_MODAL_WINDOW_LOOK);
fSettings->SetHasBorder(true);
}
// No matter what the setting for title, we must force the border on
fSettings->SetHasBorder(true);
fSettings->SetHasTitle(enable); fSettings->SetHasTitle(enable);
break; break;
} }