2002-11-24 00:26:55 +00:00
|
|
|
#include <Alert.h>
|
2002-07-09 12:24:59 +00:00
|
|
|
#include <Application.h>
|
2003-06-24 10:01:58 +00:00
|
|
|
#include <Box.h>
|
2002-07-09 12:24:59 +00:00
|
|
|
#include <Button.h>
|
2002-11-24 00:26:55 +00:00
|
|
|
#include <InterfaceDefs.h>
|
|
|
|
|
#include <MenuItem.h>
|
2003-06-24 10:01:58 +00:00
|
|
|
#include <MenuField.h>
|
2002-11-24 00:26:55 +00:00
|
|
|
#include <Messenger.h>
|
2003-06-24 10:01:58 +00:00
|
|
|
#include <PopUpMenu.h>
|
2002-07-09 12:24:59 +00:00
|
|
|
#include <String.h>
|
|
|
|
|
#include <Screen.h>
|
2002-11-24 00:26:55 +00:00
|
|
|
#include <Window.h>
|
|
|
|
|
|
2002-07-09 12:24:59 +00:00
|
|
|
#include <cstring>
|
|
|
|
|
#include <cstdlib>
|
2002-11-27 15:45:32 +00:00
|
|
|
#include <cstdio>
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
#include "RefreshWindow.h"
|
2002-07-09 12:24:59 +00:00
|
|
|
#include "ScreenWindow.h"
|
|
|
|
|
#include "ScreenDrawView.h"
|
2003-06-24 10:01:58 +00:00
|
|
|
#include "ScreenSettings.h"
|
2002-07-09 12:24:59 +00:00
|
|
|
#include "AlertWindow.h"
|
|
|
|
|
#include "Constants.h"
|
2002-11-24 00:26:55 +00:00
|
|
|
#include "Utility.h"
|
2003-06-09 09:34:12 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
static uint32
|
|
|
|
|
colorspace_to_bpp(uint32 colorspace)
|
2003-06-09 09:34:12 +00:00
|
|
|
{
|
|
|
|
|
switch (colorspace) {
|
2004-01-02 05:17:50 +00:00
|
|
|
case B_RGB32: return 32;
|
|
|
|
|
case B_RGB24: return 24;
|
|
|
|
|
case B_RGB16: return 16;
|
|
|
|
|
case B_RGB15: return 15;
|
|
|
|
|
case B_CMAP8: return 8;
|
|
|
|
|
default: return 0;
|
2003-06-09 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
static void
|
|
|
|
|
colorspace_to_string(uint32 colorspace, char dest[])
|
|
|
|
|
{
|
|
|
|
|
sprintf(dest,"%lu Bits/Pixel",colorspace_to_bpp(colorspace));
|
|
|
|
|
}
|
2003-06-09 09:34:12 +00:00
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
static uint32
|
|
|
|
|
string_to_colorspace(const char* string)
|
2003-06-09 09:34:12 +00:00
|
|
|
{
|
2004-01-02 05:17:50 +00:00
|
|
|
uint32 bits = 0;
|
|
|
|
|
sscanf(string,"%ld",&bits);
|
|
|
|
|
switch (bits) {
|
|
|
|
|
case 8: return B_CMAP8;
|
|
|
|
|
case 15: return B_RGB15;
|
|
|
|
|
case 16: return B_RGB16;
|
|
|
|
|
case 24: return B_RGB24;
|
|
|
|
|
case 32: return B_RGB32;
|
|
|
|
|
default: return B_CMAP8; // Should return an error?
|
|
|
|
|
}
|
2003-06-24 10:01:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
mode_to_string(display_mode mode, char dest[])
|
|
|
|
|
{
|
2004-01-02 05:17:50 +00:00
|
|
|
sprintf(dest, "%hu x %hu", mode.virtual_width, mode.virtual_height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
string_to_mode(const char * source, display_mode * mode)
|
|
|
|
|
{
|
|
|
|
|
sscanf(source,"%hu x %hu", &(mode->virtual_width), &(mode->virtual_height));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
refresh_rate_to_string(float refresh_rate, char dest[])
|
|
|
|
|
{
|
|
|
|
|
sprintf(dest, "%.1f Hz",refresh_rate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
static float
|
|
|
|
|
string_to_refresh_rate(const char * source)
|
|
|
|
|
{
|
|
|
|
|
float refresh_rate = 0;
|
|
|
|
|
sscanf(source,"%f Hz", &refresh_rate);
|
|
|
|
|
return refresh_rate;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static float
|
|
|
|
|
get_refresh_rate(display_mode mode)
|
|
|
|
|
{
|
|
|
|
|
return (mode.timing.pixel_clock * 1000.0) / (mode.timing.h_total * mode.timing.v_total);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_pixel_clock(display_mode * mode, float refresh_rate)
|
|
|
|
|
{
|
|
|
|
|
mode->timing.pixel_clock
|
|
|
|
|
= (uint32)((mode->timing.h_total * mode->timing.v_total * refresh_rate) / 1000);
|
2003-06-09 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
|
2002-07-09 12:24:59 +00:00
|
|
|
ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|
|
|
|
: BWindow(Settings->WindowFrame(), "Screen", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES)
|
|
|
|
|
{
|
2002-11-24 00:26:55 +00:00
|
|
|
BRect frame(Bounds());
|
|
|
|
|
BScreen screen(B_MAIN_SCREEN_ID);
|
|
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
if (!screen.IsValid())
|
|
|
|
|
;//debugger() ?
|
|
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
screen.GetModeList(&fSupportedModes, &fTotalModes);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
frame.InsetBy(-1, -1);
|
|
|
|
|
fScreenView = new BBox(frame, "ScreenView");
|
|
|
|
|
fScreenDrawView = new ScreenDrawView(BRect(20.0, 16.0, 122.0, 93.0), "ScreenDrawView");
|
|
|
|
|
|
2002-07-09 12:24:59 +00:00
|
|
|
AddChild(fScreenView);
|
|
|
|
|
|
|
|
|
|
fSettings = Settings;
|
|
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
BRect screenBoxRect(11.0, 18.0, 153.0, 155.0);
|
|
|
|
|
BBox *screenBox = new BBox(screenBoxRect);
|
2003-06-09 09:34:12 +00:00
|
|
|
screenBox->SetBorder(B_FANCY_BORDER);
|
2002-11-24 00:26:55 +00:00
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
fWorkspaceCountMenu = new BPopUpMenu("", true, true);
|
|
|
|
|
fWorkspaceCountField = new BMenuField(BRect(7.0, 107.0, 135.0, 127.0), "WorkspaceCountMenu", "Workspace count:", fWorkspaceCountMenu, true);
|
|
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
for (int32 count = 1; count <= 32; count++) {
|
2003-06-09 09:34:12 +00:00
|
|
|
BString workspaceCount;
|
|
|
|
|
workspaceCount << count;
|
|
|
|
|
fWorkspaceCountMenu->AddItem(new BMenuItem(workspaceCount.String(),
|
|
|
|
|
new BMessage(POP_WORKSPACE_CHANGED_MSG)));
|
2002-07-09 12:24:59 +00:00
|
|
|
}
|
2003-06-09 09:34:12 +00:00
|
|
|
|
|
|
|
|
BString string;
|
2003-06-06 08:48:56 +00:00
|
|
|
string << count_workspaces();
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
BMenuItem *marked = fWorkspaceCountMenu->FindItem(string.String());
|
|
|
|
|
marked->SetMarked(true);
|
2003-06-24 10:01:58 +00:00
|
|
|
|
2002-07-09 12:24:59 +00:00
|
|
|
fWorkspaceCountField->SetDivider(91.0);
|
|
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
screenBox->AddChild(fScreenDrawView);
|
|
|
|
|
screenBox->AddChild(fWorkspaceCountField);
|
|
|
|
|
fScreenView->AddChild(screenBox);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
|
fWorkspaceMenu = new BPopUpMenu("Current Workspace", true, true);
|
|
|
|
|
fAllWorkspacesItem = new BMenuItem("All Workspaces", new BMessage(WORKSPACE_CHECK_MSG));
|
|
|
|
|
fWorkspaceMenu->AddItem(fAllWorkspacesItem);
|
|
|
|
|
fCurrentWorkspaceItem = new BMenuItem("Current Workspace", new BMessage(WORKSPACE_CHECK_MSG));
|
|
|
|
|
fCurrentWorkspaceItem->SetMarked(true);
|
|
|
|
|
fWorkspaceMenu->AddItem(fCurrentWorkspaceItem);
|
|
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
BRect workspaceMenuRect(0.0, 0.0, 132.0, 18.0);
|
|
|
|
|
fWorkspaceField = new BMenuField(workspaceMenuRect, "WorkspaceMenu", NULL, fWorkspaceMenu, true);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
BRect controlsBoxRect(164.0, 7.0, 345.0, 155.0);
|
|
|
|
|
BBox *controlsBox = new BBox(controlsBoxRect);
|
2003-06-09 09:34:12 +00:00
|
|
|
controlsBox->SetBorder(B_FANCY_BORDER);
|
|
|
|
|
controlsBox->SetLabel(fWorkspaceField);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
BRect ButtonRect(88.0, 114.0, 200.0, 150.0);
|
2002-07-09 12:24:59 +00:00
|
|
|
fApplyButton = new BButton(ButtonRect, "ApplyButton", "Apply",
|
2003-06-06 08:48:56 +00:00
|
|
|
new BMessage(BUTTON_APPLY_MSG));
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
|
fApplyButton->AttachedToWindow();
|
|
|
|
|
fApplyButton->ResizeToPreferred();
|
|
|
|
|
fApplyButton->SetEnabled(false);
|
|
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
controlsBox->AddChild(fApplyButton);
|
|
|
|
|
|
|
|
|
|
fResolutionMenu = new BPopUpMenu("", true, true);
|
|
|
|
|
fColorsMenu = new BPopUpMenu("", true, true);
|
|
|
|
|
|
|
|
|
|
CheckUpdateDisplayModes();
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-09-16 01:13:15 +00:00
|
|
|
const char * resolutionLabel = "Resolution: ";
|
|
|
|
|
float resolutionWidth = controlsBox->StringWidth(resolutionLabel);
|
|
|
|
|
BRect controlMenuRect(88.0-resolutionWidth, 30.0, 171.0, 48.0);
|
|
|
|
|
fResolutionField = new BMenuField(controlMenuRect, "ResolutionMenu", resolutionLabel, fResolutionMenu, true);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
marked = fResolutionMenu->ItemAt(0);
|
|
|
|
|
marked->SetMarked(true);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-09-16 01:13:15 +00:00
|
|
|
fResolutionField->SetDivider(resolutionWidth);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
controlsBox->AddChild(fResolutionField);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-09-16 01:13:15 +00:00
|
|
|
const char * colorsLabel = "Colors: ";
|
|
|
|
|
float colorsWidth = controlsBox->StringWidth(colorsLabel);
|
|
|
|
|
controlMenuRect.Set(88.0-colorsWidth, 58.0, 171.0, 76.0);
|
|
|
|
|
fColorsField = new BMenuField(controlMenuRect, "ColorsMenu", colorsLabel, fColorsMenu, true);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
marked = fColorsMenu->ItemAt(0);
|
|
|
|
|
marked->SetMarked(true);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-09-16 01:13:15 +00:00
|
|
|
fColorsField->SetDivider(colorsWidth);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
controlsBox->AddChild(fColorsField);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
// XXX: When we'll start to use OpenBeOS BScreen, we will be able to dynamically
|
|
|
|
|
// build this menu using the available refresh rates, without limiting ourself
|
|
|
|
|
// to 85 hz.
|
2003-06-06 08:48:56 +00:00
|
|
|
fRefreshMenu = new BPopUpMenu("", true, true);
|
2004-01-02 05:17:50 +00:00
|
|
|
char str[256];
|
|
|
|
|
refresh_rate_to_string(56,str);
|
|
|
|
|
fRefreshMenu->AddItem(new BMenuItem(str, new BMessage(POP_REFRESH_MSG)));
|
|
|
|
|
refresh_rate_to_string(60,str);
|
|
|
|
|
fRefreshMenu->AddItem(new BMenuItem(str, new BMessage(POP_REFRESH_MSG)));
|
|
|
|
|
refresh_rate_to_string(70,str);
|
|
|
|
|
fRefreshMenu->AddItem(new BMenuItem(str, new BMessage(POP_REFRESH_MSG)));
|
|
|
|
|
refresh_rate_to_string(75,str);
|
|
|
|
|
fRefreshMenu->AddItem(new BMenuItem(str, new BMessage(POP_REFRESH_MSG)));
|
|
|
|
|
refresh_rate_to_string(85,str);
|
|
|
|
|
fRefreshMenu->AddItem(new BMenuItem(str, new BMessage(POP_REFRESH_MSG)));
|
|
|
|
|
refresh_rate_to_string(100,str);
|
|
|
|
|
fRefreshMenu->AddItem(new BMenuItem(str, new BMessage(POP_REFRESH_MSG)));
|
|
|
|
|
|
|
|
|
|
fOtherRefresh = new BMenuItem("Other...", new BMessage(POP_OTHER_REFRESH_MSG));
|
|
|
|
|
fRefreshMenu->AddItem(fOtherRefresh);
|
2003-06-24 10:01:58 +00:00
|
|
|
|
2002-12-04 14:26:01 +00:00
|
|
|
|
2003-09-16 01:13:15 +00:00
|
|
|
const char * refreshLabel = "Refresh Rate: ";
|
|
|
|
|
float refreshWidth = controlsBox->StringWidth(refreshLabel);
|
|
|
|
|
controlMenuRect.Set(88.0-refreshWidth, 86.0, 171.0, 104.0);
|
|
|
|
|
fRefreshField = new BMenuField(controlMenuRect, "RefreshMenu", refreshLabel, fRefreshMenu, true);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-09-16 01:13:15 +00:00
|
|
|
fRefreshField->SetDivider(refreshWidth);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
controlsBox->AddChild(fRefreshField);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
fScreenView->AddChild(controlsBox);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
|
ButtonRect.Set(10.0, 167, 100.0, 200.0);
|
|
|
|
|
|
|
|
|
|
fDefaultsButton = new BButton(ButtonRect, "DefaultsButton", "Defaults",
|
2002-11-24 00:26:55 +00:00
|
|
|
new BMessage(BUTTON_DEFAULTS_MSG));
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
|
fDefaultsButton->AttachedToWindow();
|
|
|
|
|
fDefaultsButton->ResizeToPreferred();
|
|
|
|
|
|
|
|
|
|
fScreenView->AddChild(fDefaultsButton);
|
|
|
|
|
|
|
|
|
|
ButtonRect.Set(95.0, 167, 160.0, 200.0);
|
|
|
|
|
|
|
|
|
|
fRevertButton = new BButton(ButtonRect, "RevertButton", "Revert",
|
2002-11-24 00:26:55 +00:00
|
|
|
new BMessage(BUTTON_REVERT_MSG));
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
|
fRevertButton->AttachedToWindow();
|
|
|
|
|
fRevertButton->ResizeToPreferred();
|
|
|
|
|
fRevertButton->SetEnabled(false);
|
|
|
|
|
|
|
|
|
|
fScreenView->AddChild(fRevertButton);
|
|
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
SetStateByMode();
|
|
|
|
|
|
|
|
|
|
fCustomRefresh = fInitialRefreshN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ScreenWindow::SetStateByMode()
|
|
|
|
|
{
|
|
|
|
|
BString string;
|
|
|
|
|
BMenuItem *marked;
|
|
|
|
|
display_mode mode;
|
|
|
|
|
BScreen screen(B_MAIN_SCREEN_ID);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
if (!screen.IsValid()) {
|
|
|
|
|
//debugger() ?
|
|
|
|
|
return;
|
|
|
|
|
}
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
screen.GetMode(&mode);
|
|
|
|
|
fInitialMode = mode;
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
char str[256];
|
|
|
|
|
mode_to_string(mode,str);
|
|
|
|
|
marked = fResolutionMenu->FindItem(str);
|
|
|
|
|
marked->SetMarked(true);
|
2003-06-06 08:48:56 +00:00
|
|
|
fInitialResolution = marked;
|
2002-11-24 00:26:55 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
colorspace_to_string(mode.space,str);
|
|
|
|
|
marked = fColorsMenu->FindItem(str);
|
2003-06-06 08:48:56 +00:00
|
|
|
marked->SetMarked(true);
|
|
|
|
|
fInitialColors = marked;
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
fInitialRefreshN = get_refresh_rate(mode);
|
|
|
|
|
refresh_rate_to_string(fInitialRefreshN,str);
|
|
|
|
|
marked = fRefreshMenu->FindItem(str);
|
2002-12-04 14:26:01 +00:00
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
if (marked != NULL) {
|
2003-06-06 08:48:56 +00:00
|
|
|
marked->SetMarked(true);
|
2003-06-09 09:34:12 +00:00
|
|
|
fInitialRefresh = marked;
|
2004-01-02 05:17:50 +00:00
|
|
|
} else {
|
|
|
|
|
BString string(str);
|
|
|
|
|
string << "/Other...";
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
fOtherRefresh->SetLabel(string.String());
|
|
|
|
|
fOtherRefresh->SetMarked(true);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
fRefreshMenu->Superitem()->SetLabel(str);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
fInitialRefresh = fOtherRefresh;
|
|
|
|
|
fCustomRefresh = fInitialRefreshN;
|
2002-07-09 12:24:59 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
|
2002-07-09 12:24:59 +00:00
|
|
|
ScreenWindow::~ScreenWindow()
|
|
|
|
|
{
|
|
|
|
|
delete fSettings;
|
2002-11-24 00:26:55 +00:00
|
|
|
delete[] fSupportedModes;
|
2002-07-09 12:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
ScreenWindow::QuitRequested()
|
2002-07-09 12:24:59 +00:00
|
|
|
{
|
|
|
|
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
|
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
return BWindow::QuitRequested();
|
2002-07-09 12:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ScreenWindow::FrameMoved(BPoint position)
|
2002-07-09 12:24:59 +00:00
|
|
|
{
|
|
|
|
|
fSettings->SetWindowFrame(Frame());
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ScreenWindow::ScreenChanged(BRect frame, color_space mode)
|
2002-07-09 12:24:59 +00:00
|
|
|
{
|
|
|
|
|
if (frame.right <= Frame().right
|
|
|
|
|
&& frame.bottom <= Frame().bottom)
|
|
|
|
|
MoveTo(((frame.right / 2) - 178), ((frame.right / 2) - 101));
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ScreenWindow::WorkspaceActivated(int32 ws, bool state)
|
2002-07-09 12:24:59 +00:00
|
|
|
{
|
|
|
|
|
PostMessage(new BMessage(UPDATE_DESKTOP_COLOR_MSG), fScreenDrawView);
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ScreenWindow::MessageReceived(BMessage* message)
|
2002-07-09 12:24:59 +00:00
|
|
|
{
|
|
|
|
|
switch(message->what)
|
|
|
|
|
{
|
|
|
|
|
case WORKSPACE_CHECK_MSG:
|
|
|
|
|
{
|
|
|
|
|
fApplyButton->SetEnabled(true);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case POP_WORKSPACE_CHANGED_MSG:
|
|
|
|
|
{
|
2003-06-24 10:01:58 +00:00
|
|
|
BMenuItem *item = fWorkspaceCountMenu->FindMarked();
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
set_workspace_count(fWorkspaceCountMenu->IndexOf(item) + 1);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case POP_RESOLUTION_MSG:
|
|
|
|
|
{
|
|
|
|
|
CheckApplyEnabled();
|
2003-06-24 10:01:58 +00:00
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
BMessage newMessage(UPDATE_DESKTOP_MSG);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
const char *resolution = fResolutionMenu->FindMarked()->Label();
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-24 10:01:58 +00:00
|
|
|
//CheckModesByResolution(resolution);
|
2003-06-09 09:34:12 +00:00
|
|
|
newMessage.AddString("resolution", resolution);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
PostMessage(&newMessage, fScreenDrawView);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case POP_COLORS_MSG:
|
|
|
|
|
{
|
2003-06-09 09:34:12 +00:00
|
|
|
CheckApplyEnabled();
|
2002-07-09 12:24:59 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case POP_REFRESH_MSG:
|
|
|
|
|
{
|
2003-06-06 08:48:56 +00:00
|
|
|
CheckApplyEnabled();
|
2002-07-09 12:24:59 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case POP_OTHER_REFRESH_MSG:
|
|
|
|
|
{
|
2003-06-06 08:48:56 +00:00
|
|
|
BRect frame(Frame());
|
|
|
|
|
|
2002-07-09 12:24:59 +00:00
|
|
|
CheckApplyEnabled();
|
2002-11-24 00:26:55 +00:00
|
|
|
int32 value = (int32)(fCustomRefresh * 10);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
RefreshWindow *fRefreshWindow = new RefreshWindow(BRect((frame.left + 201.0),
|
|
|
|
|
(frame.top + 34.0), (frame.left + 509.0),
|
|
|
|
|
(frame.top + 169.0)), value);
|
|
|
|
|
fRefreshWindow->Show();
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
BMenuItem *other = fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
BString string;
|
|
|
|
|
|
|
|
|
|
string << other->Label();
|
|
|
|
|
|
|
|
|
|
int32 point = string.FindFirst('z');
|
|
|
|
|
string.Truncate(point + 1);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
fRefreshMenu->Superitem()->SetLabel(string.String());
|
2002-07-09 12:24:59 +00:00
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BUTTON_DEFAULTS_MSG:
|
|
|
|
|
{
|
2002-11-27 14:41:16 +00:00
|
|
|
fResolutionMenu->ItemAt(0)->SetMarked(true);
|
2002-07-09 12:24:59 +00:00
|
|
|
fColorsMenu->FindItem("8 Bits/Pixel")->SetMarked(true);
|
|
|
|
|
fRefreshMenu->FindItem("60 Hz")->SetMarked(true);
|
|
|
|
|
|
|
|
|
|
CheckApplyEnabled();
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BUTTON_REVERT_MSG:
|
2002-11-27 15:45:32 +00:00
|
|
|
case SET_INITIAL_MODE_MSG:
|
2002-07-09 12:24:59 +00:00
|
|
|
{
|
|
|
|
|
fInitialResolution->SetMarked(true);
|
|
|
|
|
fInitialColors->SetMarked(true);
|
|
|
|
|
fInitialRefresh->SetMarked(true);
|
|
|
|
|
|
|
|
|
|
CheckApplyEnabled();
|
|
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
BMenuItem *other = fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
if (fInitialRefresh == other) {
|
2002-11-26 06:21:36 +00:00
|
|
|
BString string;
|
2002-11-24 00:26:55 +00:00
|
|
|
string << fInitialRefreshN;
|
2002-11-26 06:21:36 +00:00
|
|
|
|
|
|
|
|
int32 point = string.FindFirst('.');
|
|
|
|
|
string.Truncate(point + 2);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
string << " Hz/Other...";
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG)->SetLabel(string.String());
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2002-11-26 06:21:36 +00:00
|
|
|
point = string.FindFirst('/');
|
|
|
|
|
string.Truncate(point);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2002-11-24 00:26:55 +00:00
|
|
|
fRefreshMenu->Superitem()->SetLabel(string.String());
|
2002-07-09 12:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
if (message->what == SET_INITIAL_MODE_MSG) {
|
|
|
|
|
|
2002-11-27 15:45:32 +00:00
|
|
|
BScreen screen(B_MAIN_SCREEN_ID);
|
|
|
|
|
if (!screen.IsValid())
|
|
|
|
|
break;
|
2003-06-24 10:01:58 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
screen.SetMode(&fInitialMode, true);
|
2002-11-27 15:45:32 +00:00
|
|
|
}
|
2002-07-09 12:24:59 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BUTTON_APPLY_MSG:
|
|
|
|
|
{
|
2004-01-02 05:17:50 +00:00
|
|
|
ApplyMode();
|
2002-07-09 12:24:59 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case SET_CUSTOM_REFRESH_MSG:
|
|
|
|
|
{
|
|
|
|
|
message->FindFloat("refresh", &fCustomRefresh);
|
|
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
BMenuItem *other = fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
other->SetMarked(true);
|
2003-06-24 10:01:58 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
BString string;
|
|
|
|
|
string << fCustomRefresh;
|
|
|
|
|
int32 point = string.FindFirst('.');
|
|
|
|
|
string.Truncate(point + 2);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
string << " Hz/Other...";
|
|
|
|
|
fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG)->SetLabel(string.String());
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
point = string.FindFirst('/');
|
|
|
|
|
string.Truncate(point);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
fRefreshMenu->Superitem()->SetLabel(string.String());
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2003-06-06 08:48:56 +00:00
|
|
|
if (fCustomRefresh != fInitialRefreshN) {
|
2002-07-09 12:24:59 +00:00
|
|
|
fApplyButton->SetEnabled(true);
|
|
|
|
|
fRevertButton->SetEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case MAKE_INITIAL_MSG:
|
|
|
|
|
{
|
2002-11-27 14:41:16 +00:00
|
|
|
BScreen screen(B_MAIN_SCREEN_ID);
|
|
|
|
|
if (!screen.IsValid())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
display_mode mode;
|
2002-11-24 00:26:55 +00:00
|
|
|
screen.GetMode(&mode);
|
2003-06-24 10:01:58 +00:00
|
|
|
|
|
|
|
|
if (fWorkspaceMenu->FindMarked() == fWorkspaceMenu->FindItem("All Workspaces")) {
|
|
|
|
|
|
|
|
|
|
int32 old = current_workspace();
|
|
|
|
|
int32 totalWorkspaces = count_workspaces();
|
|
|
|
|
fRevertButton->SetEnabled(false);
|
|
|
|
|
|
|
|
|
|
for (int32 count = 1; count <= totalWorkspaces; count++) {
|
|
|
|
|
activate_workspace(count);
|
|
|
|
|
screen.SetMode(&mode, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
activate_workspace(old);
|
|
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
screen.SetMode(&mode, true);
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2004-01-02 05:17:50 +00:00
|
|
|
SetStateByMode();
|
2002-07-09 12:24:59 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
2002-11-24 00:26:55 +00:00
|
|
|
BWindow::MessageReceived(message);
|
2002-07-09 12:24:59 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-06-09 09:34:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ScreenWindow::CheckApplyEnabled()
|
|
|
|
|
{
|
|
|
|
|
if ((fResolutionMenu->FindMarked() != fInitialResolution)
|
|
|
|
|
|| (fColorsMenu->FindMarked() != fInitialColors)
|
|
|
|
|
|| (fRefreshMenu->FindMarked() != fInitialRefresh)) {
|
|
|
|
|
fApplyButton->SetEnabled(true);
|
|
|
|
|
fRevertButton->SetEnabled(true);
|
|
|
|
|
} else {
|
|
|
|
|
fApplyButton->SetEnabled(false);
|
|
|
|
|
fRevertButton->SetEnabled(false);
|
2003-06-24 10:01:58 +00:00
|
|
|
}
|
|
|
|
|
|
2003-06-09 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ScreenWindow::CheckUpdateDisplayModes()
|
|
|
|
|
{
|
|
|
|
|
uint32 c;
|
|
|
|
|
|
|
|
|
|
// Add supported resolutions to the menu
|
2003-06-24 10:01:58 +00:00
|
|
|
char mode[128];
|
2003-06-09 09:34:12 +00:00
|
|
|
for (c = 0; c < fTotalModes; c++) {
|
2003-06-24 10:01:58 +00:00
|
|
|
mode_to_string(fSupportedModes[c], mode);
|
2003-06-09 09:34:12 +00:00
|
|
|
|
|
|
|
|
if (!fResolutionMenu->FindItem(mode))
|
|
|
|
|
fResolutionMenu->AddItem(new BMenuItem(mode, new BMessage(POP_RESOLUTION_MSG)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add supported colorspaces to the menu
|
2004-01-02 05:17:50 +00:00
|
|
|
char colorSpace[128];
|
2003-06-09 09:34:12 +00:00
|
|
|
for (c = 0; c < fTotalModes; c++) {
|
2004-01-02 05:17:50 +00:00
|
|
|
colorspace_to_string(fSupportedModes[c].space, colorSpace);
|
2003-06-09 09:34:12 +00:00
|
|
|
if (!fColorsMenu->FindItem(colorSpace))
|
|
|
|
|
fColorsMenu->AddItem(new BMenuItem(colorSpace, new BMessage(POP_COLORS_MSG)));
|
|
|
|
|
}
|
2003-06-24 10:01:58 +00:00
|
|
|
|
|
|
|
|
/*XXX: BeOS's BScreen limits the refresh to 85 hz (or is it the nvidia driver?).
|
|
|
|
|
I hope that OpenBeOS BScreen will remove
|
2003-06-09 09:34:12 +00:00
|
|
|
this limitation.
|
|
|
|
|
|
|
|
|
|
for (c = 0; c < fTotalModes; c++) {
|
|
|
|
|
display_mode *mode = &fSupportedModes[c];
|
|
|
|
|
int32 refresh = (mode->timing.pixel_clock * 1000) / (mode->timing.h_total * mode->timing.v_total);
|
2003-06-24 10:01:58 +00:00
|
|
|
printf("width %d, height %d, refresh %d\n", mode->virtual_width, mode->virtual_height, refresh);
|
2003-06-09 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|
2003-06-24 10:01:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ScreenWindow::CheckModesByResolution(const char *res)
|
|
|
|
|
{
|
|
|
|
|
BString resolution(res);
|
|
|
|
|
|
|
|
|
|
bool found = false;
|
|
|
|
|
uint32 c;
|
|
|
|
|
int32 width = atoi(resolution.String());
|
|
|
|
|
resolution.Remove(0, resolution.FindFirst('x') + 1);
|
|
|
|
|
int32 height = atoi(resolution.String());
|
|
|
|
|
|
|
|
|
|
for (c = 0; c < fTotalModes; c++) {
|
|
|
|
|
if ((fSupportedModes[c].virtual_width == width)
|
|
|
|
|
&& (fSupportedModes[c].virtual_height == height)) {
|
|
|
|
|
if (string_to_colorspace(fColorsMenu->FindMarked()->Label())
|
|
|
|
|
== fSupportedModes[c].space) {
|
|
|
|
|
found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!found) {
|
|
|
|
|
fColorsMenu->ItemAt(fColorsMenu->IndexOf(fColorsMenu->FindMarked()) - 1)->SetMarked(true);
|
|
|
|
|
printf("not found\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-01-02 05:17:50 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ScreenWindow::ApplyMode()
|
|
|
|
|
{
|
|
|
|
|
BScreen screen(B_MAIN_SCREEN_ID);
|
|
|
|
|
|
|
|
|
|
if (!screen.IsValid())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
display_mode requested_mode;
|
|
|
|
|
|
|
|
|
|
BString menuLabel = fResolutionMenu->FindMarked()->Label();
|
|
|
|
|
string_to_mode(menuLabel.String(),&requested_mode);
|
|
|
|
|
requested_mode.space = string_to_colorspace(fColorsMenu->FindMarked()->Label());
|
|
|
|
|
requested_mode.h_display_start = 0;
|
|
|
|
|
requested_mode.v_display_start = 0;
|
|
|
|
|
|
|
|
|
|
display_mode * supported_mode = 0;
|
|
|
|
|
display_mode * mismatch_mode = 0;
|
|
|
|
|
for (uint32 c = 0; c < fTotalModes; c++) {
|
|
|
|
|
if ((fSupportedModes[c].virtual_width == requested_mode.virtual_width)
|
|
|
|
|
&& (fSupportedModes[c].virtual_height == requested_mode.virtual_height)) {
|
|
|
|
|
if (!mismatch_mode || (colorspace_to_bpp(mismatch_mode->space)
|
|
|
|
|
< colorspace_to_bpp(fSupportedModes[c].space))) {
|
|
|
|
|
mismatch_mode = &fSupportedModes[c];
|
|
|
|
|
}
|
|
|
|
|
if (fSupportedModes[c].space == requested_mode.space) {
|
|
|
|
|
supported_mode = &fSupportedModes[c];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (supported_mode) {
|
|
|
|
|
requested_mode = *supported_mode;
|
|
|
|
|
} else {
|
|
|
|
|
display_mode proposed_mode = requested_mode;
|
|
|
|
|
// if (screen.ProposeMode(&proposed_mode,&proposed_mode,&proposed_mode) == B_ERROR) {
|
|
|
|
|
if (!mismatch_mode) {
|
|
|
|
|
BAlert * UnsupportedModeAlert =
|
|
|
|
|
new BAlert("UnsupportedModeAlert", "This mode is not supported.",
|
|
|
|
|
"Okay", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
|
|
|
|
UnsupportedModeAlert->Go();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
proposed_mode = *mismatch_mode;
|
|
|
|
|
BString string;
|
|
|
|
|
char str[256];
|
|
|
|
|
colorspace_to_string(requested_mode.space,str);
|
|
|
|
|
string << str;
|
|
|
|
|
mode_to_string(requested_mode,str);
|
|
|
|
|
string << " is not supported at " << str << ". ";
|
|
|
|
|
string << "Use ";
|
|
|
|
|
colorspace_to_string(proposed_mode.space,str);
|
|
|
|
|
string << str;
|
|
|
|
|
mode_to_string(proposed_mode,str);
|
|
|
|
|
string << " at " << str << " instead?";
|
|
|
|
|
BAlert * BadColorsAlert =
|
|
|
|
|
new BAlert("BadColorsAlert", string.String(),
|
|
|
|
|
"Okay", "Cancel", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
|
|
|
|
int32 button = BadColorsAlert->Go();
|
|
|
|
|
if (button == 1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
requested_mode = proposed_mode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float refresh;
|
|
|
|
|
if (fRefreshMenu->FindMarked() == fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG))
|
|
|
|
|
refresh = fCustomRefresh;
|
|
|
|
|
else
|
|
|
|
|
refresh = atof(fRefreshMenu->FindMarked()->Label());
|
|
|
|
|
set_pixel_clock(&requested_mode,refresh);
|
|
|
|
|
|
|
|
|
|
uint32 low_clock = 0, high_clock = 0;
|
|
|
|
|
screen.GetPixelClockLimits(&requested_mode,&low_clock,&high_clock);
|
|
|
|
|
if (requested_mode.timing.pixel_clock < low_clock) {
|
|
|
|
|
display_mode low_mode = requested_mode;
|
|
|
|
|
low_mode.timing.pixel_clock = low_clock;
|
|
|
|
|
BString string;
|
|
|
|
|
string << refresh << " Hz is too low. ";
|
|
|
|
|
string << "Use " << get_refresh_rate(low_mode) << " Hz instead?";
|
|
|
|
|
BAlert * TooLowAlert =
|
|
|
|
|
new BAlert("TooLowAlert", string.String(),
|
|
|
|
|
"Okay", "Cancel", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
|
|
|
|
int32 button = TooLowAlert->Go();
|
|
|
|
|
if (button == 1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
requested_mode.timing.pixel_clock = low_clock;
|
|
|
|
|
}
|
|
|
|
|
if (requested_mode.timing.pixel_clock > high_clock) {
|
|
|
|
|
display_mode high_mode = requested_mode;
|
|
|
|
|
high_mode.timing.pixel_clock = high_clock;
|
|
|
|
|
BString string;
|
|
|
|
|
string << refresh << " Hz is too high.";
|
|
|
|
|
string << "Use " << get_refresh_rate(high_mode) << " Hz instead?";
|
|
|
|
|
BAlert * TooHighAlert =
|
|
|
|
|
new BAlert("TooHighAlert", string.String(),
|
|
|
|
|
"Okay", "Cancel", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
|
|
|
|
int32 button = TooHighAlert->Go();
|
|
|
|
|
if (button == 1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
requested_mode.timing.pixel_clock = high_clock;
|
|
|
|
|
}
|
|
|
|
|
if (fWorkspaceMenu->FindMarked() == fWorkspaceMenu->FindItem("All Workspaces")) {
|
|
|
|
|
BAlert *WorkspacesAlert =
|
|
|
|
|
new BAlert("WorkspacesAlert", "Change all workspaces?\nThis action cannot be reverted",
|
|
|
|
|
"Okay", "Cancel", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
|
|
|
|
|
|
|
|
|
int32 button = WorkspacesAlert->Go();
|
|
|
|
|
|
|
|
|
|
if (button == 1) {
|
|
|
|
|
PostMessage(new BMessage(BUTTON_REVERT_MSG));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
screen.SetMode(&requested_mode);
|
|
|
|
|
|
|
|
|
|
BRect rect(100.0, 100.0, 400.0, 193.0);
|
|
|
|
|
|
|
|
|
|
rect.left = (screen.Frame().right / 2) - 150;
|
|
|
|
|
rect.top = (screen.Frame().bottom / 2) - 42;
|
|
|
|
|
rect.right = rect.left + 300.0;
|
|
|
|
|
rect.bottom = rect.top + 93.0;
|
|
|
|
|
|
|
|
|
|
(new AlertWindow(rect))->Show();
|
|
|
|
|
|
|
|
|
|
fApplyButton->SetEnabled(false);
|
|
|
|
|
}
|