Reported some changes I did a while ago and forgot to commit.
There were more but that will come later (Thomas' RadeonScreen changes). Vastly improved AlertView/AlertWindow to a cleaner design, the question mark bitmap is no longer hardcoded, but retrieved in the same way BAlert does it. Added license headers to the files updated. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13195 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,27 +1,61 @@
|
|||||||
#include <Bitmap.h>
|
/*
|
||||||
#include <String.h>
|
* Copyright 2001-2005, Haiku.
|
||||||
#include <View.h>
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Rafael Romo
|
||||||
|
* Stefano Ceccherini ([email protected])
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "AlertView.h"
|
#include "AlertView.h"
|
||||||
#include "Bitmaps.h"
|
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
|
||||||
|
#include <Window.h>
|
||||||
|
#include <Bitmap.h>
|
||||||
|
#include <Button.h>
|
||||||
|
#include <StringView.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
#include <FindDirectory.h>
|
||||||
|
#include <Resources.h>
|
||||||
|
#include <File.h>
|
||||||
|
#include <Path.h>
|
||||||
|
|
||||||
|
|
||||||
AlertView::AlertView(BRect frame, char *name)
|
AlertView::AlertView(BRect frame, char *name)
|
||||||
:BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW)
|
: BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED),
|
||||||
|
// we will wait 8 seconds until we send a message
|
||||||
|
fSeconds(8)
|
||||||
{
|
{
|
||||||
count = 8;
|
fBitmap = InitIcon();
|
||||||
|
|
||||||
fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_COLOR_8_BIT);
|
BStringView *stringView = new BStringView(BRect(60, 20, 400, 36), NULL,
|
||||||
fBitmap->SetBits(bitmapBits, 32 * 32, 0, B_COLOR_8_BIT);
|
"Do you wish to keep these settings?");
|
||||||
|
stringView->SetFont(be_bold_font);
|
||||||
|
stringView->ResizeToPreferred();
|
||||||
|
AddChild(stringView);
|
||||||
|
|
||||||
|
fCountdownView = new BStringView(BRect(60, 37, 400, 50), "countdown", B_EMPTY_STRING);
|
||||||
|
UpdateCountdownView();
|
||||||
|
fCountdownView->ResizeToPreferred();
|
||||||
|
AddChild(fCountdownView);
|
||||||
|
|
||||||
|
BButton *button = new BButton(BRect(215, 59, 400, 190), "KeepButton", "Keep", new BMessage(BUTTON_KEEP_MSG));
|
||||||
|
button->ResizeToPreferred();
|
||||||
|
AddChild(button);
|
||||||
|
|
||||||
|
button = new BButton(BRect(130, 59, 400, 199), "RevertButton", "Revert", new BMessage(BUTTON_REVERT_MSG));
|
||||||
|
button->ResizeToPreferred();
|
||||||
|
AddChild(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AlertView::AttachedToWindow()
|
AlertView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
rgb_color grey = ui_color(B_PANEL_BACKGROUND_COLOR);
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
SetViewColor(grey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -29,22 +63,59 @@ void
|
|||||||
AlertView::Draw(BRect updateRect)
|
AlertView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT);
|
rgb_color dark = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT);
|
||||||
rgb_color black = { 0, 0, 0, 255 };
|
|
||||||
|
|
||||||
SetHighColor(dark);
|
SetHighColor(dark);
|
||||||
|
|
||||||
FillRect(BRect(0.0, 0.0, 30.0, 100.0));
|
FillRect(BRect(0.0, 0.0, 30.0, 100.0));
|
||||||
|
|
||||||
SetDrawingMode(B_OP_ALPHA);
|
if (fBitmap != NULL) {
|
||||||
DrawBitmap(fBitmap, BPoint(18.0, 6.0));
|
SetDrawingMode(B_OP_ALPHA);
|
||||||
|
DrawBitmap(fBitmap, BPoint(18.0, 6.0));
|
||||||
SetDrawingMode(B_OP_OVER);
|
}
|
||||||
SetHighColor(black);
|
|
||||||
SetFont(be_bold_font);
|
|
||||||
|
|
||||||
DrawString("Do you wish to keep these settings?", BPoint(60.0, 20.0));
|
|
||||||
|
|
||||||
fString.Truncate(0);
|
|
||||||
fString << "Settings will revert in " << count << " seconds.";
|
|
||||||
|
|
||||||
DrawString(fString.String(), BPoint(60, 37));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AlertView::Pulse()
|
||||||
|
{
|
||||||
|
if (--fSeconds == 0)
|
||||||
|
Window()->PostMessage(BUTTON_REVERT_MSG);
|
||||||
|
else
|
||||||
|
UpdateCountdownView();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AlertView::UpdateCountdownView()
|
||||||
|
{
|
||||||
|
BString string;
|
||||||
|
string << "Settings will revert in " << fSeconds << " seconds.";
|
||||||
|
fCountdownView->SetText(string.String());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BBitmap*
|
||||||
|
AlertView::InitIcon()
|
||||||
|
{
|
||||||
|
// This is how BAlert gets to its icon
|
||||||
|
BBitmap* icon = NULL;
|
||||||
|
BPath path;
|
||||||
|
if (find_directory(B_BEOS_SERVERS_DIRECTORY, &path) == B_OK) {
|
||||||
|
path.Append("app_server");
|
||||||
|
BResources resources;
|
||||||
|
BFile file;
|
||||||
|
if (file.SetTo(path.Path(), B_READ_ONLY) == B_OK
|
||||||
|
&& resources.SetTo(&file) == B_OK) {
|
||||||
|
// Load the raw icon data
|
||||||
|
size_t size;
|
||||||
|
const void* data = resources.LoadResource('ICON', "warn", &size);
|
||||||
|
if (data) {
|
||||||
|
// Now build the bitmap
|
||||||
|
icon = new BBitmap(BRect(0, 0, 31, 31), 0, B_CMAP8);
|
||||||
|
icon->SetBits(data, size, 0, B_CMAP8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,38 @@
|
|||||||
#ifndef __ALERTVIEW_H
|
/*
|
||||||
#define __ALERTVIEW_H
|
* Copyright 2001-2005, Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Rafael Romo
|
||||||
|
* Stefano Ceccherini ([email protected])
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
|
*/
|
||||||
|
#ifndef ALERT_VIEW_H
|
||||||
|
#define ALERT_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
class AlertView : public BView
|
class BBitmap;
|
||||||
{
|
class BStringView;
|
||||||
public:
|
|
||||||
AlertView(BRect frame, char *name);
|
|
||||||
virtual void AttachedToWindow();
|
class AlertView : public BView {
|
||||||
virtual void Draw(BRect updateRect);
|
public:
|
||||||
uint32 count;
|
AlertView(BRect frame, char *name);
|
||||||
|
|
||||||
private:
|
virtual void AttachedToWindow();
|
||||||
BBitmap *fBitmap;
|
virtual void Draw(BRect updateRect);
|
||||||
BString fString;
|
virtual void Pulse();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void UpdateCountdownView();
|
||||||
|
BBitmap *InitIcon();
|
||||||
|
|
||||||
|
BStringView *fCountdownView;
|
||||||
|
BBitmap *fBitmap;
|
||||||
|
int32 fSeconds;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* ALERT_VIEW_H */
|
||||||
|
|||||||
@@ -1,93 +1,49 @@
|
|||||||
#include <Application.h>
|
/*
|
||||||
#include <Button.h>
|
* Copyright 2001-2005, Haiku.
|
||||||
#include <MessageRunner.h>
|
* Distributed under the terms of the MIT License.
|
||||||
#include <Window.h>
|
*
|
||||||
|
* Authors:
|
||||||
|
* Rafael Romo
|
||||||
|
* Stefano Ceccherini ([email protected])
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
#include "AlertWindow.h"
|
#include "AlertWindow.h"
|
||||||
#include "AlertView.h"
|
#include "AlertView.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
|
||||||
AlertWindow::AlertWindow(BRect frame)
|
#include <Window.h>
|
||||||
: BWindow(frame, "Revert", B_MODAL_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES)
|
|
||||||
|
|
||||||
|
AlertWindow::AlertWindow(BRect frame, BMessenger target)
|
||||||
|
: BWindow(frame, "Revert", B_MODAL_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
|
||||||
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES),
|
||||||
|
fTarget(target)
|
||||||
{
|
{
|
||||||
frame = Bounds();
|
fAlertView = new AlertView(Bounds(), "AlertView");
|
||||||
|
|
||||||
fAlertView = new AlertView(frame, "ScreenView");
|
|
||||||
|
|
||||||
AddChild(fAlertView);
|
AddChild(fAlertView);
|
||||||
|
|
||||||
BRect buttonRect;
|
|
||||||
buttonRect.Set(215.0, 59.0, 400.0, 190.0);
|
|
||||||
|
|
||||||
fKeepButton = new BButton(buttonRect, "KeepButton", "Keep",
|
|
||||||
new BMessage(BUTTON_KEEP_MSG));
|
|
||||||
|
|
||||||
fKeepButton->AttachedToWindow();
|
|
||||||
fKeepButton->ResizeToPreferred();
|
|
||||||
|
|
||||||
fAlertView->AddChild(fKeepButton);
|
|
||||||
|
|
||||||
buttonRect.Set(130.0, 59.0, 400.0, 190.0);
|
|
||||||
|
|
||||||
fRevertButton = new BButton(buttonRect, "RevertButton", "Revert",
|
|
||||||
new BMessage(BUTTON_REVERT_MSG));
|
|
||||||
|
|
||||||
fRevertButton->AttachedToWindow();
|
|
||||||
fRevertButton->ResizeToPreferred();
|
|
||||||
|
|
||||||
fAlertView->AddChild(fRevertButton);
|
|
||||||
|
|
||||||
fRunner = new BMessageRunner(this, new BMessage(DIM_COUNT_MSG), 1000000, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// the view displays a decrementing counter (until the user must take action)
|
||||||
bool
|
SetPulseRate(1000000); // every second
|
||||||
AlertWindow::QuitRequested()
|
|
||||||
{
|
|
||||||
delete fRunner;
|
|
||||||
|
|
||||||
return BWindow::QuitRequested();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AlertWindow::MessageReceived(BMessage *message)
|
AlertWindow::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
switch (message->what)
|
switch (message->what) {
|
||||||
{
|
|
||||||
case BUTTON_KEEP_MSG:
|
case BUTTON_KEEP_MSG:
|
||||||
{
|
fTarget.SendMessage(MAKE_INITIAL_MSG);
|
||||||
be_app->PostMessage(MAKE_INITIAL_MSG);
|
|
||||||
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case BUTTON_REVERT_MSG:
|
case BUTTON_REVERT_MSG:
|
||||||
{
|
fTarget.SendMessage(SET_INITIAL_MODE_MSG);
|
||||||
be_app->PostMessage(SET_INITIAL_MODE_MSG);
|
|
||||||
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case DIM_COUNT_MSG:
|
|
||||||
{
|
|
||||||
fAlertView->count -= 1;
|
|
||||||
|
|
||||||
fAlertView->Invalidate(BRect(180.0, 20.0, 260.0, 50.0));
|
|
||||||
|
|
||||||
if (fAlertView->count == 0)
|
|
||||||
PostMessage(BUTTON_REVERT_MSG);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,34 @@
|
|||||||
#ifndef __ALERTWINDOW_H
|
/*
|
||||||
#define __ALERTWINDOW_H
|
* Copyright 2001-2005, Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Rafael Romo
|
||||||
|
* Stefano Ceccherini ([email protected])
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
|
*/
|
||||||
|
#ifndef ALERT_WINDOW_H
|
||||||
|
#define ALERT_WINDOW_H
|
||||||
|
|
||||||
#include "AlertView.h"
|
|
||||||
|
|
||||||
class AlertWindow : public BWindow
|
#include <Window.h>
|
||||||
{
|
#include <Messenger.h>
|
||||||
public:
|
|
||||||
AlertWindow(BRect frame);
|
|
||||||
virtual bool QuitRequested();
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
|
||||||
|
|
||||||
private:
|
|
||||||
AlertView *fAlertView;
|
class BMessageRunner;
|
||||||
BMessageRunner *fRunner;
|
class BButton;
|
||||||
BButton *fRevertButton;
|
class AlertView;
|
||||||
BButton *fKeepButton;
|
|
||||||
|
|
||||||
|
class AlertWindow : public BWindow {
|
||||||
|
public:
|
||||||
|
AlertWindow(BRect frame, BMessenger target);
|
||||||
|
|
||||||
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BMessenger fTarget;
|
||||||
|
AlertView* fAlertView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* ALERT_WINDOW_H */
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
#ifndef BITMAPS_H
|
|
||||||
#define BITMAPS_H
|
|
||||||
|
|
||||||
#include <Bitmap.h>
|
|
||||||
|
|
||||||
class Bitmap;
|
|
||||||
|
|
||||||
const unsigned char bitmapBits [] = {
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xfa,0xfa,0xfa,0x00,0x00,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0x00,
|
|
||||||
0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,
|
|
||||||
0xfa,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,
|
|
||||||
0xfa,0xfa,0xfa,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x3f,0x3f,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,
|
|
||||||
0xfa,0xfa,0x3f,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0x3f,0x3f,0xfa,0xfa,0xfa,0xfa,0xfa,
|
|
||||||
0xfa,0x3f,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0x3f,0x3f,0xfa,0xfa,0xfa,
|
|
||||||
0x3f,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x3f,0x3f,0x3f,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xa5,0x00,0x00,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xa5,0xa5,0xa5,0xa5,0x00,0x00,0xf9,0xf9,0x5d,
|
|
||||||
0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xa5,0xa5,0xa5,0xa5,0x00,0x00,0x00,
|
|
||||||
0xa5,0xa5,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0x00,0x00,0xa5,0xa5,0xa5,0xa5,0xa5,
|
|
||||||
0xa5,0x00,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0x00,0x00,0xa5,0xa5,0xa5,
|
|
||||||
0x00,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x00,0x00,0x00,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0x0e,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0x0e,0x0e,0x0e,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x5d,0x00,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x5d,0x00,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xf9,0xf9,0xf9,0xf9,0x5d,
|
|
||||||
0x5d,0x00,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xf9,0xf9,0x5d,
|
|
||||||
0x00,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
|
||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,
|
|
||||||
0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,7 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2001-2005, Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Rafael Romo
|
||||||
|
* Stefano Ceccherini ([email protected])
|
||||||
|
*/
|
||||||
#ifndef CONSTANTS_H
|
#ifndef CONSTANTS_H
|
||||||
#define CONSTANTS_H
|
#define CONSTANTS_H
|
||||||
|
|
||||||
//Messages
|
// Messages
|
||||||
static const uint32 WORKSPACE_CHECK_MSG = 'wchk';
|
static const uint32 WORKSPACE_CHECK_MSG = 'wchk';
|
||||||
static const uint32 BUTTON_DEFAULTS_MSG = 'bdef';
|
static const uint32 BUTTON_DEFAULTS_MSG = 'bdef';
|
||||||
static const uint32 BUTTON_REVERT_MSG = 'brev';
|
static const uint32 BUTTON_REVERT_MSG = 'brev';
|
||||||
@@ -23,9 +31,9 @@ static const uint32 SET_CUSTOM_REFRESH_MSG = 'scrf';
|
|||||||
static const uint32 DIM_COUNT_MSG = 'scrf';
|
static const uint32 DIM_COUNT_MSG = 'scrf';
|
||||||
static const uint32 MAKE_INITIAL_MSG = 'mkin';
|
static const uint32 MAKE_INITIAL_MSG = 'mkin';
|
||||||
|
|
||||||
//Constants
|
// Constants
|
||||||
static const char kAppSignature[] = "application/x-vnd.Be-SCRN";
|
static const char kAppSignature[] = "application/x-vnd.Be-SCRN";
|
||||||
static const int32 gMinRefresh = 45; //This is the minimum selectable refresh
|
static const int32 gMinRefresh = 45; // This is the minimum selectable refresh
|
||||||
static const int32 gMaxRefresh = 140; //This is the maximum selectable refresh
|
static const int32 gMaxRefresh = 140; // This is the maximum selectable refresh
|
||||||
|
|
||||||
#endif //CONSTANTS_H
|
#endif /* CONSTANTS_H */
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
// Original author: Rafael Romo
|
/*
|
||||||
// Additional code by Stefano Ceccherini, Andrew Bachmann, Sergei Panteleev
|
* Copyright 2001-2005, Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Rafael Romo
|
||||||
|
* Stefano Ceccherini ([email protected])
|
||||||
|
* Andrew Bachmann
|
||||||
|
* Sergei Panteleev
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
@@ -24,7 +33,7 @@ ScreenApplication::ScreenApplication()
|
|||||||
void
|
void
|
||||||
ScreenApplication::AboutRequested()
|
ScreenApplication::AboutRequested()
|
||||||
{
|
{
|
||||||
BAlert *aboutAlert = new BAlert("About", "Screen by the OpenBeOS team",
|
BAlert *aboutAlert = new BAlert("About", "Screen preferences by the Haiku team",
|
||||||
"Ok", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT);
|
"Ok", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT);
|
||||||
aboutAlert->SetShortcut(0, B_OK);
|
aboutAlert->SetShortcut(0, B_OK);
|
||||||
aboutAlert->Go();
|
aboutAlert->Go();
|
||||||
@@ -34,15 +43,13 @@ ScreenApplication::AboutRequested()
|
|||||||
void
|
void
|
||||||
ScreenApplication::MessageReceived(BMessage* message)
|
ScreenApplication::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch(message->what)
|
switch (message->what) {
|
||||||
{
|
|
||||||
case SET_INITIAL_MODE_MSG:
|
case SET_INITIAL_MODE_MSG:
|
||||||
case SET_CUSTOM_REFRESH_MSG:
|
case SET_CUSTOM_REFRESH_MSG:
|
||||||
case MAKE_INITIAL_MSG:
|
case MAKE_INITIAL_MSG:
|
||||||
{
|
|
||||||
fScreenWindow->PostMessage(message);
|
fScreenWindow->PostMessage(message);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
BApplication::MessageReceived(message);
|
BApplication::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -50,12 +57,14 @@ ScreenApplication::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
ScreenApplication app;
|
ScreenApplication app;
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2001-2005, Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Rafael Romo
|
||||||
|
* Stefano Ceccherini ([email protected])
|
||||||
|
* Andrew Bachmann
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
@@ -23,16 +34,17 @@
|
|||||||
#include "ScreenWindow.h"
|
#include "ScreenWindow.h"
|
||||||
#include "Utility.h"
|
#include "Utility.h"
|
||||||
|
|
||||||
|
|
||||||
static uint32
|
static uint32
|
||||||
colorspace_to_bpp(uint32 colorspace)
|
colorspace_to_bpp(uint32 colorspace)
|
||||||
{
|
{
|
||||||
switch (colorspace) {
|
switch (colorspace) {
|
||||||
case B_RGB32: return 32;
|
case B_RGB32: return 32;
|
||||||
case B_RGB24: return 24;
|
case B_RGB24: return 24;
|
||||||
case B_RGB16: return 16;
|
case B_RGB16: return 16;
|
||||||
case B_RGB15: return 15;
|
case B_RGB15: return 15;
|
||||||
case B_CMAP8: return 8;
|
case B_CMAP8: return 8;
|
||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,12 +62,12 @@ string_to_colorspace(const char* string)
|
|||||||
uint32 bits = 0;
|
uint32 bits = 0;
|
||||||
sscanf(string,"%ld",&bits);
|
sscanf(string,"%ld",&bits);
|
||||||
switch (bits) {
|
switch (bits) {
|
||||||
case 8: return B_CMAP8;
|
case 8: return B_CMAP8;
|
||||||
case 15: return B_RGB15;
|
case 15: return B_RGB15;
|
||||||
case 16: return B_RGB16;
|
case 16: return B_RGB16;
|
||||||
case 24: return B_RGB24;
|
case 24: return B_RGB24;
|
||||||
case 32: return B_RGB32;
|
case 32: return B_RGB32;
|
||||||
default: return B_CMAP8; // Should return an error?
|
default: return B_CMAP8; // Should return an error?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,30 +122,29 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
: BWindow(Settings->WindowFrame(), "Screen", B_TITLED_WINDOW,
|
: BWindow(Settings->WindowFrame(), "Screen", B_TITLED_WINDOW,
|
||||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES)
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES)
|
||||||
{
|
{
|
||||||
|
BScreen screen(this);
|
||||||
BRect frame(Bounds());
|
BRect frame(Bounds());
|
||||||
BScreen screen(B_MAIN_SCREEN_ID);
|
|
||||||
|
|
||||||
if (!screen.IsValid())
|
|
||||||
;//debugger() ?
|
|
||||||
|
|
||||||
fSupportedModes = NULL;
|
fSupportedModes = NULL;
|
||||||
fTotalModes = 0;
|
fTotalModes = 0;
|
||||||
screen.GetModeList(&fSupportedModes, &fTotalModes);
|
screen.GetModeList(&fSupportedModes, &fTotalModes);
|
||||||
|
|
||||||
frame.InsetBy(-1, -1);
|
BView *view = new BView(frame, "ScreenView", B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
fScreenView = new BBox(frame, "ScreenView");
|
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
fScreenDrawView = new ScreenDrawView(BRect(20.0, 16.0, 122.0, 93.0), "ScreenDrawView");
|
AddChild(view);
|
||||||
|
|
||||||
AddChild(fScreenView);
|
|
||||||
|
|
||||||
fSettings = Settings;
|
fSettings = Settings;
|
||||||
|
|
||||||
BRect screenBoxRect(11.0, 18.0, 153.0, 155.0);
|
BRect screenBoxRect(11.0, 18.0, 153.0, 155.0);
|
||||||
BBox *screenBox = new BBox(screenBoxRect);
|
BBox *screenBox = new BBox(screenBoxRect);
|
||||||
screenBox->SetBorder(B_FANCY_BORDER);
|
screenBox->SetBorder(B_FANCY_BORDER);
|
||||||
|
|
||||||
|
fScreenDrawView = new ScreenDrawView(BRect(20.0, 16.0, 122.0, 93.0), "ScreenDrawView");
|
||||||
|
screenBox->AddChild(fScreenDrawView);
|
||||||
|
|
||||||
fWorkspaceCountMenu = new BPopUpMenu("", true, true);
|
fWorkspaceCountMenu = new BPopUpMenu("", true, true);
|
||||||
fWorkspaceCountField = new BMenuField(BRect(7.0, 107.0, 135.0, 127.0), "WorkspaceCountMenu", "Workspace count:", fWorkspaceCountMenu, true);
|
fWorkspaceCountField = new BMenuField(BRect(7.0, 107.0, 135.0, 127.0), "WorkspaceCountMenu", "Workspace count:", fWorkspaceCountMenu, true);
|
||||||
|
screenBox->AddChild(fWorkspaceCountField);
|
||||||
|
|
||||||
for (int32 count = 1; count <= 32; count++) {
|
for (int32 count = 1; count <= 32; count++) {
|
||||||
BString workspaceCount;
|
BString workspaceCount;
|
||||||
@@ -151,9 +162,7 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
|
|
||||||
fWorkspaceCountField->SetDivider(91.0);
|
fWorkspaceCountField->SetDivider(91.0);
|
||||||
|
|
||||||
screenBox->AddChild(fScreenDrawView);
|
view->AddChild(screenBox);
|
||||||
screenBox->AddChild(fWorkspaceCountField);
|
|
||||||
fScreenView->AddChild(screenBox);
|
|
||||||
|
|
||||||
fWorkspaceMenu = new BPopUpMenu("Current Workspace", true, true);
|
fWorkspaceMenu = new BPopUpMenu("Current Workspace", true, true);
|
||||||
fAllWorkspacesItem = new BMenuItem("All Workspaces", new BMessage(WORKSPACE_CHECK_MSG));
|
fAllWorkspacesItem = new BMenuItem("All Workspaces", new BMessage(WORKSPACE_CHECK_MSG));
|
||||||
@@ -224,7 +233,7 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
|
|
||||||
controlsBox->AddChild(fRefreshField);
|
controlsBox->AddChild(fRefreshField);
|
||||||
|
|
||||||
fScreenView->AddChild(controlsBox);
|
view->AddChild(controlsBox);
|
||||||
|
|
||||||
ButtonRect.Set(10.0, 167, 100.0, 200.0);
|
ButtonRect.Set(10.0, 167, 100.0, 200.0);
|
||||||
|
|
||||||
@@ -234,7 +243,7 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
fDefaultsButton->AttachedToWindow();
|
fDefaultsButton->AttachedToWindow();
|
||||||
fDefaultsButton->ResizeToPreferred();
|
fDefaultsButton->ResizeToPreferred();
|
||||||
|
|
||||||
fScreenView->AddChild(fDefaultsButton);
|
view->AddChild(fDefaultsButton);
|
||||||
|
|
||||||
ButtonRect.Set(95.0, 167, 160.0, 200.0);
|
ButtonRect.Set(95.0, 167, 160.0, 200.0);
|
||||||
|
|
||||||
@@ -245,13 +254,14 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
fRevertButton->ResizeToPreferred();
|
fRevertButton->ResizeToPreferred();
|
||||||
fRevertButton->SetEnabled(false);
|
fRevertButton->SetEnabled(false);
|
||||||
|
|
||||||
fScreenView->AddChild(fRevertButton);
|
view->AddChild(fRevertButton);
|
||||||
|
|
||||||
SetStateByMode();
|
SetStateByMode();
|
||||||
|
|
||||||
fCustomRefresh = fInitialRefreshN;
|
fCustomRefresh = fInitialRefreshN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScreenWindow::SetStateByMode()
|
ScreenWindow::SetStateByMode()
|
||||||
{
|
{
|
||||||
@@ -259,11 +269,6 @@ ScreenWindow::SetStateByMode()
|
|||||||
BMenuItem *marked;
|
BMenuItem *marked;
|
||||||
display_mode mode;
|
display_mode mode;
|
||||||
BScreen screen(B_MAIN_SCREEN_ID);
|
BScreen screen(B_MAIN_SCREEN_ID);
|
||||||
|
|
||||||
if (!screen.IsValid()) {
|
|
||||||
//debugger() ?
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
screen.GetMode(&mode);
|
screen.GetMode(&mode);
|
||||||
fInitialMode = mode;
|
fInitialMode = mode;
|
||||||
@@ -271,16 +276,16 @@ ScreenWindow::SetStateByMode()
|
|||||||
char str[256];
|
char str[256];
|
||||||
mode_to_string(mode,str);
|
mode_to_string(mode,str);
|
||||||
marked = fResolutionMenu->FindItem(str);
|
marked = fResolutionMenu->FindItem(str);
|
||||||
if (marked) {
|
if (marked)
|
||||||
marked->SetMarked(true);
|
marked->SetMarked(true);
|
||||||
}
|
|
||||||
fInitialResolution = marked;
|
fInitialResolution = marked;
|
||||||
|
|
||||||
colorspace_to_string(mode.space,str);
|
colorspace_to_string(mode.space,str);
|
||||||
marked = fColorsMenu->FindItem(str);
|
marked = fColorsMenu->FindItem(str);
|
||||||
if (marked) {
|
if (marked)
|
||||||
marked->SetMarked(true);
|
marked->SetMarked(true);
|
||||||
}
|
|
||||||
fInitialColors = marked;
|
fInitialColors = marked;
|
||||||
|
|
||||||
fInitialRefreshN = get_refresh_rate(mode);
|
fInitialRefreshN = get_refresh_rate(mode);
|
||||||
@@ -650,17 +655,17 @@ ScreenWindow::CheckModesByResolution(const char *res)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScreenWindow::ApplyMode()
|
ScreenWindow::ApplyMode()
|
||||||
{
|
{
|
||||||
BScreen screen(B_MAIN_SCREEN_ID);
|
BScreen screen(B_MAIN_SCREEN_ID);
|
||||||
|
|
||||||
if (!screen.IsValid())
|
if (!screen.IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
display_mode requested_mode;
|
display_mode requested_mode;
|
||||||
screen.GetMode(&requested_mode); // start with current mode timings
|
screen.GetMode(&requested_mode); // start with current mode timings
|
||||||
|
|
||||||
BString menuLabel = fResolutionMenu->FindMarked()->Label();
|
BString menuLabel = fResolutionMenu->FindMarked()->Label();
|
||||||
string_to_mode(menuLabel.String(),&requested_mode);
|
string_to_mode(menuLabel.String(),&requested_mode);
|
||||||
requested_mode.space = string_to_colorspace(fColorsMenu->FindMarked()->Label());
|
requested_mode.space = string_to_colorspace(fColorsMenu->FindMarked()->Label());
|
||||||
@@ -696,13 +701,13 @@ ScreenWindow::ApplyMode()
|
|||||||
string << str;
|
string << str;
|
||||||
mode_to_string(proposed_mode,str);
|
mode_to_string(proposed_mode,str);
|
||||||
string << " at " << str << " instead?";
|
string << " at " << str << " instead?";
|
||||||
BAlert * BadColorsAlert =
|
BAlert *badColorsAlert =
|
||||||
new BAlert("BadColorsAlert", string.String(),
|
new BAlert("BadColorsAlert", string.String(),
|
||||||
"Okay", "Cancel", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
"Okay", "Cancel", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
||||||
int32 button = BadColorsAlert->Go();
|
int32 button = badColorsAlert->Go();
|
||||||
if (button == 1) {
|
if (button == 1)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
requested_mode = proposed_mode;
|
requested_mode = proposed_mode;
|
||||||
} else {
|
} else {
|
||||||
display_mode proposed_mode = requested_mode;
|
display_mode proposed_mode = requested_mode;
|
||||||
@@ -724,13 +729,13 @@ ScreenWindow::ApplyMode()
|
|||||||
string << str;
|
string << str;
|
||||||
mode_to_string(proposed_mode,str);
|
mode_to_string(proposed_mode,str);
|
||||||
string << " at " << str << " instead?";
|
string << " at " << str << " instead?";
|
||||||
BAlert * BadModeAlert =
|
BAlert *badModeAlert =
|
||||||
new BAlert("BadModeAlert", string.String(),
|
new BAlert("BadModeAlert", string.String(),
|
||||||
"Okay", "Cancel", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
"Okay", "Cancel", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
||||||
int32 button = BadModeAlert->Go();
|
int32 button = badModeAlert->Go();
|
||||||
if (button == 1) {
|
if (button == 1)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
requested_mode = proposed_mode;
|
requested_mode = proposed_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -793,8 +798,8 @@ ScreenWindow::ApplyMode()
|
|||||||
rect.top = (screen.Frame().bottom / 2) - 42;
|
rect.top = (screen.Frame().bottom / 2) - 42;
|
||||||
rect.right = rect.left + 300.0;
|
rect.right = rect.left + 300.0;
|
||||||
rect.bottom = rect.top + 93.0;
|
rect.bottom = rect.top + 93.0;
|
||||||
|
|
||||||
(new AlertWindow(rect))->Show();
|
(new AlertWindow(rect, this))->Show();
|
||||||
|
|
||||||
fApplyButton->SetEnabled(false);
|
fApplyButton->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
#ifndef __SCREENWINDOW_H
|
/*
|
||||||
#define __SCREENWINDOW_H
|
* Copyright 2001-2005, Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Rafael Romo
|
||||||
|
* Stefano Ceccherini ([email protected])
|
||||||
|
*/
|
||||||
|
#ifndef SCREEN_WINDOW_H
|
||||||
|
#define SCREEN_WINDOW_H
|
||||||
|
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
@@ -10,58 +18,58 @@ class BMenuField;
|
|||||||
class RefreshWindow;
|
class RefreshWindow;
|
||||||
class ScreenDrawView;
|
class ScreenDrawView;
|
||||||
class ScreenSettings;
|
class ScreenSettings;
|
||||||
class ScreenWindow : public BWindow
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
ScreenWindow(ScreenSettings *settings);
|
|
||||||
virtual ~ScreenWindow();
|
|
||||||
virtual bool QuitRequested();
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
|
||||||
virtual void WorkspaceActivated(int32 ws, bool state);
|
|
||||||
virtual void FrameMoved(BPoint position);
|
|
||||||
virtual void ScreenChanged(BRect frame, color_space mode);
|
|
||||||
|
|
||||||
private:
|
class ScreenWindow : public BWindow {
|
||||||
void SetStateByMode();
|
public:
|
||||||
void CheckApplyEnabled();
|
ScreenWindow(ScreenSettings *settings);
|
||||||
void CheckUpdateDisplayModes();
|
virtual ~ScreenWindow();
|
||||||
void CheckModesByResolution(const char*);
|
|
||||||
void ApplyMode();
|
virtual bool QuitRequested();
|
||||||
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
virtual void WorkspaceActivated(int32 ws, bool state);
|
||||||
|
virtual void FrameMoved(BPoint position);
|
||||||
|
virtual void ScreenChanged(BRect frame, color_space mode);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetStateByMode();
|
||||||
|
void CheckApplyEnabled();
|
||||||
|
void CheckUpdateDisplayModes();
|
||||||
|
void CheckModesByResolution(const char*);
|
||||||
|
void ApplyMode();
|
||||||
|
|
||||||
BBox *fScreenView;
|
ScreenSettings *fSettings;
|
||||||
ScreenSettings *fSettings;
|
|
||||||
ScreenDrawView *fScreenDrawView;
|
ScreenDrawView *fScreenDrawView;
|
||||||
|
BPopUpMenu *fWorkspaceMenu;
|
||||||
BPopUpMenu *fWorkspaceMenu;
|
BMenuField *fWorkspaceField;
|
||||||
BMenuField *fWorkspaceField;
|
BPopUpMenu *fWorkspaceCountMenu;
|
||||||
BPopUpMenu *fWorkspaceCountMenu;
|
BMenuField *fWorkspaceCountField;
|
||||||
BMenuField *fWorkspaceCountField;
|
BPopUpMenu *fResolutionMenu;
|
||||||
BPopUpMenu *fResolutionMenu;
|
BMenuField *fResolutionField;
|
||||||
BMenuField *fResolutionField;
|
BPopUpMenu *fColorsMenu;
|
||||||
BPopUpMenu *fColorsMenu;
|
BMenuField *fColorsField;
|
||||||
BMenuField *fColorsField;
|
BPopUpMenu *fRefreshMenu;
|
||||||
BPopUpMenu *fRefreshMenu;
|
BMenuField *fRefreshField;
|
||||||
BMenuField *fRefreshField;
|
BMenuItem *fCurrentWorkspaceItem;
|
||||||
BMenuItem *fCurrentWorkspaceItem;
|
BMenuItem *fAllWorkspacesItem;
|
||||||
BMenuItem *fAllWorkspacesItem;
|
BButton *fDefaultsButton;
|
||||||
BButton *fDefaultsButton;
|
BButton *fApplyButton;
|
||||||
BButton *fApplyButton;
|
BButton *fRevertButton;
|
||||||
BButton *fRevertButton;
|
|
||||||
|
BMenuItem *fInitialResolution;
|
||||||
BMenuItem *fInitialResolution;
|
BMenuItem *fInitialColors;
|
||||||
BMenuItem *fInitialColors;
|
BMenuItem *fInitialRefresh;
|
||||||
BMenuItem *fInitialRefresh;
|
BMenuItem *fOtherRefresh;
|
||||||
BMenuItem *fOtherRefresh;
|
|
||||||
|
display_mode fInitialMode;
|
||||||
display_mode fInitialMode;
|
display_mode *fSupportedModes;
|
||||||
display_mode *fSupportedModes;
|
uint32 fTotalModes;
|
||||||
uint32 fTotalModes;
|
|
||||||
|
float fMinRefresh;
|
||||||
float fMinRefresh;
|
float fMaxRefresh;
|
||||||
float fMaxRefresh;
|
float fCustomRefresh;
|
||||||
float fCustomRefresh;
|
float fInitialRefreshN;
|
||||||
float fInitialRefreshN;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* SCREEN_WINDOW_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user