Some more cleanups... finally fixed the multi workspace refresh bug.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3635 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6ef98483f5
commit
359a1af6c0
@ -7,12 +7,12 @@
|
|||||||
#include "Constants.h"
|
#include "Constants.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)
|
||||||
{
|
{
|
||||||
count = 8;
|
count = 8;
|
||||||
|
|
||||||
fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_COLOR_8_BIT);
|
fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_COLOR_8_BIT);
|
||||||
fBitmap->SetBits(BitmapBits, 32 * 32, 0, B_COLOR_8_BIT);
|
fBitmap->SetBits(bitmapBits, 32 * 32, 0, B_COLOR_8_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ public:
|
|||||||
AlertView(BRect frame, char *name);
|
AlertView(BRect frame, char *name);
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
int32 count;
|
uint32 count;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BBitmap *fBitmap;
|
BBitmap *fBitmap;
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
#include <MessageRunner.h>
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Messenger.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <MessageRunner.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include <Beep.h>
|
|
||||||
|
|
||||||
#include "AlertWindow.h"
|
#include "AlertWindow.h"
|
||||||
#include "AlertView.h"
|
#include "AlertView.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
@ -20,31 +16,28 @@ AlertWindow::AlertWindow(BRect frame)
|
|||||||
|
|
||||||
AddChild(fAlertView);
|
AddChild(fAlertView);
|
||||||
|
|
||||||
BRect ButtonRect;
|
BRect buttonRect;
|
||||||
|
buttonRect.Set(215.0, 59.0, 400.0, 190.0);
|
||||||
|
|
||||||
ButtonRect.Set(215.0, 59.0, 400.0, 190.0);
|
fKeepButton = new BButton(buttonRect, "KeepButton", "Keep",
|
||||||
|
new BMessage(BUTTON_KEEP_MSG));
|
||||||
fKeepButton = new BButton(ButtonRect, "KeepButton", "Keep",
|
|
||||||
new BMessage(BUTTON_KEEP_MSG));
|
|
||||||
|
|
||||||
fKeepButton->AttachedToWindow();
|
fKeepButton->AttachedToWindow();
|
||||||
fKeepButton->ResizeToPreferred();
|
fKeepButton->ResizeToPreferred();
|
||||||
|
|
||||||
fAlertView->AddChild(fKeepButton);
|
fAlertView->AddChild(fKeepButton);
|
||||||
|
|
||||||
ButtonRect.Set(130.0, 59.0, 400.0, 190.0);
|
buttonRect.Set(130.0, 59.0, 400.0, 190.0);
|
||||||
|
|
||||||
fRevertButton = new BButton(ButtonRect, "RevertButton", "Revert",
|
fRevertButton = new BButton(buttonRect, "RevertButton", "Revert",
|
||||||
new BMessage(BUTTON_REVERT_MSG));
|
new BMessage(BUTTON_REVERT_MSG));
|
||||||
|
|
||||||
fRevertButton->AttachedToWindow();
|
fRevertButton->AttachedToWindow();
|
||||||
fRevertButton->ResizeToPreferred();
|
fRevertButton->ResizeToPreferred();
|
||||||
|
|
||||||
fAlertView->AddChild(fRevertButton);
|
fAlertView->AddChild(fRevertButton);
|
||||||
|
|
||||||
BMessenger Messenger(this);
|
fRunner = new BMessageRunner(this, new BMessage(DIM_COUNT_MSG), 1000000, 10);
|
||||||
|
|
||||||
fRunner = new BMessageRunner(Messenger, new BMessage(DIM_COUNT_MSG), 1000000, 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -53,9 +46,7 @@ AlertWindow::QuitRequested()
|
|||||||
{
|
{
|
||||||
delete fRunner;
|
delete fRunner;
|
||||||
|
|
||||||
Quit();
|
return BWindow::QuitRequested();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class Bitmap;
|
class Bitmap;
|
||||||
|
|
||||||
const unsigned char BitmapBits [] = {
|
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,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,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,0x00,0xfa,0xfa,0xfa,0x00,0x00,0xff,
|
||||||
|
@ -2,8 +2,8 @@ SubDir OBOS_TOP src prefs screen ;
|
|||||||
|
|
||||||
SubDirC++Flags [ FDefines BEOS_R5_COMPATIBLE ] ;
|
SubDirC++Flags [ FDefines BEOS_R5_COMPATIBLE ] ;
|
||||||
|
|
||||||
AddResources Screen : Screen.rdef ;
|
AddResources Screen : Screen.rsrc ;
|
||||||
|
|
||||||
Preference Screen : AlertView.cpp AlertWindow.cpp RefreshSlider.cpp RefreshView.cpp RefreshWindow.cpp Screen.cpp ScreenDrawView.cpp ScreenSettings.cpp ScreenView.cpp ScreenWindow.cpp Utility.cpp ;
|
Preference Screen : AlertView.cpp AlertWindow.cpp RefreshSlider.cpp RefreshView.cpp RefreshWindow.cpp Screen.cpp ScreenDrawView.cpp ScreenSettings.cpp ScreenWindow.cpp Utility.cpp ;
|
||||||
|
|
||||||
LinkSharedOSLibs Screen : be root ;
|
LinkSharedOSLibs Screen : be root ;
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
#include <StringView.h>
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <Locker.h>
|
|
||||||
#include <Slider.h>
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include "RefreshSlider.h"
|
#include "RefreshSlider.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
|
||||||
RefreshSlider::RefreshSlider(BRect frame)
|
RefreshSlider::RefreshSlider(BRect frame)
|
||||||
: BSlider(frame, "Screen", "Refresh Rate:", new BMessage(SLIDER_INVOKE_MSG), 450, gMaxRefresh * 10),
|
:BSlider(frame, "Screen", "Refresh Rate:", new BMessage(SLIDER_INVOKE_MSG), 450, gMaxRefresh * 10),
|
||||||
fStatus(new char[32])
|
fStatus(new char[32])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,17 @@
|
|||||||
#include <View.h>
|
|
||||||
|
|
||||||
#include "RefreshView.h"
|
#include "RefreshView.h"
|
||||||
|
|
||||||
RefreshView::RefreshView(BRect rect, char *name)
|
RefreshView::RefreshView(BRect rect, char *name)
|
||||||
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
|
: BBox(rect, name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
RefreshView::AttachedToWindow()
|
|
||||||
{
|
|
||||||
rgb_color grey = ui_color(B_PANEL_BACKGROUND_COLOR);
|
|
||||||
SetViewColor(grey);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RefreshView::Draw(BRect updateRect)
|
RefreshView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
rgb_color dark3 = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT);
|
|
||||||
rgb_color white = { 255, 255, 255, 255 };
|
|
||||||
rgb_color black = { 0, 0, 0, 255 };
|
rgb_color black = { 0, 0, 0, 255 };
|
||||||
|
|
||||||
BRect bounds(Bounds());
|
BBox::Draw(updateRect);
|
||||||
SetHighColor(white);
|
|
||||||
|
|
||||||
StrokeLine(BPoint(bounds.left, bounds.top), BPoint(bounds.right, bounds.top));
|
|
||||||
StrokeLine(BPoint(bounds.left, bounds.top), BPoint(bounds.left, bounds.bottom));
|
|
||||||
|
|
||||||
SetHighColor(dark3);
|
|
||||||
|
|
||||||
StrokeLine(BPoint(bounds.left, bounds.bottom), BPoint(bounds.right, bounds.bottom));
|
|
||||||
StrokeLine(BPoint(bounds.right, bounds.bottom), BPoint(bounds.right, bounds.top));
|
|
||||||
|
|
||||||
SetHighColor(black);
|
SetHighColor(black);
|
||||||
SetLowColor(ViewColor());
|
SetLowColor(ViewColor());
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#ifndef __REFRESHVIEW_H
|
#ifndef __REFRESHVIEW_H
|
||||||
#define __REFRESHVIEW_H
|
#define __REFRESHVIEW_H
|
||||||
|
|
||||||
#include <View.h>
|
#include <Box.h>
|
||||||
|
|
||||||
class RefreshView : public BView
|
class RefreshView : public BBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RefreshView(BRect frame, char *name);
|
RefreshView(BRect frame, char *name);
|
||||||
virtual void AttachedToWindow();
|
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#include <Locker.h>
|
|
||||||
#include <Window.h>
|
|
||||||
#include <String.h>
|
|
||||||
#include <Button.h>
|
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
|
#include <Application.h>
|
||||||
|
#include <Button.h>
|
||||||
|
#include <String.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
#include "RefreshWindow.h"
|
#include "RefreshWindow.h"
|
||||||
#include "RefreshView.h"
|
#include "RefreshView.h"
|
||||||
@ -14,18 +13,18 @@ RefreshWindow::RefreshWindow(BRect frame, int32 value)
|
|||||||
: BWindow(frame, "Refresh Rate", B_MODAL_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES)
|
: BWindow(frame, "Refresh Rate", B_MODAL_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES)
|
||||||
{
|
{
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
|
bounds.InsetBy(-1, -1);
|
||||||
|
|
||||||
fRefreshView = new RefreshView(bounds, "RefreshView");
|
fRefreshView = new RefreshView(bounds, "RefreshView");
|
||||||
|
|
||||||
AddChild(fRefreshView);
|
AddChild(fRefreshView);
|
||||||
|
|
||||||
BRect SliderRect;
|
BRect sliderRect;
|
||||||
BString maxRefresh;
|
BString maxRefresh;
|
||||||
maxRefresh << gMaxRefresh;
|
maxRefresh << gMaxRefresh;
|
||||||
|
|
||||||
SliderRect.Set(10.0, 35.0, 299.0, 60.0);
|
sliderRect.Set(10.0, 35.0, 299.0, 60.0);
|
||||||
|
|
||||||
fRefreshSlider = new RefreshSlider(SliderRect);
|
fRefreshSlider = new RefreshSlider(sliderRect);
|
||||||
|
|
||||||
fRefreshSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
fRefreshSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
||||||
fRefreshSlider->SetHashMarkCount(10);
|
fRefreshSlider->SetHashMarkCount(10);
|
||||||
@ -55,8 +54,6 @@ RefreshWindow::RefreshWindow(BRect frame, int32 value)
|
|||||||
fCancelButton->ResizeToPreferred();
|
fCancelButton->ResizeToPreferred();
|
||||||
|
|
||||||
fRefreshView->AddChild(fCancelButton);
|
fRefreshView->AddChild(fCancelButton);
|
||||||
|
|
||||||
PostMessage(SLIDER_INVOKE_MSG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -74,13 +71,12 @@ RefreshWindow::MessageReceived(BMessage* message)
|
|||||||
{
|
{
|
||||||
case BUTTON_DONE_MSG:
|
case BUTTON_DONE_MSG:
|
||||||
{
|
{
|
||||||
BMessenger messenger(kAppSignature);
|
|
||||||
BMessage message(SET_CUSTOM_REFRESH_MSG);
|
BMessage message(SET_CUSTOM_REFRESH_MSG);
|
||||||
|
|
||||||
float value = (float)fRefreshSlider->Value() / 10;
|
float value = (float)fRefreshSlider->Value() / 10;
|
||||||
|
|
||||||
message.AddFloat("refresh", value);
|
message.AddFloat("refresh", value);
|
||||||
messenger.SendMessage(&message);
|
be_app->PostMessage(&message);
|
||||||
|
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ ScreenApplication::ScreenApplication()
|
|||||||
void
|
void
|
||||||
ScreenApplication::AboutRequested()
|
ScreenApplication::AboutRequested()
|
||||||
{
|
{
|
||||||
BAlert *AboutAlert = new BAlert("About", "Screen by Rafael Romo, Stefano Ceccherini\nThe OBOS place to configure your monitor",
|
BAlert *aboutAlert = new BAlert("About", "Screen by Rafael Romo, Stefano Ceccherini\nThe OBOS place to configure your monitor",
|
||||||
"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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,33 +1,9 @@
|
|||||||
|
|
||||||
resource(1, "BEOS:APP_FLAGS") #'APPF' $"00000000";
|
resource(1, "BEOS:APP_FLAGS") #'APPF' $"00000000";
|
||||||
|
|
||||||
resource(1, "BEOS:APP_VERSION") #'APPV' array
|
resource app_version { major = 0, minor = 8 };
|
||||||
{
|
|
||||||
$"000000000900000000000000000000000100000053637265656E20302E390000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"000000000000000000000000000000000000000053637265656E20302E390000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"000000000000000000000000000000000000000080031400FC1057608003FA80"
|
|
||||||
$"EC088C7400000000FC105780800329008005FF808002DD408000600380032900"
|
|
||||||
$"8005FF801B1B1B1BFC1057C0FC105A7C000000018003FA800000000180032900"
|
|
||||||
$"8005FF808002DD4080006003EC02ED808005FF8000000000FC1057D0EC112000"
|
|
||||||
$"EC01BCCC1B1B1B1B00000000FC105A7C000000018003FA800000000180006003"
|
|
||||||
$"000000018001DF1C8001DF2CEC02ED808003AA8000000000FC1058108003FA80"
|
|
||||||
$"EC01BCCCEC02ED80FC105810EC112000EC01BD2800000001FC10582000000000"
|
|
||||||
$"EC02ED84FFFFFFFFEC05B4FCFC1058B88005FF808002DD40FC1058508001926C"
|
|
||||||
$"FC1059B8EC02ED80FC105850EC112000EC01BD2880022F40FC105870EC112000"
|
|
||||||
$"8005FF80FFFFFFFFEC05B4FCFC1059380000000400040459800060038003FA80"
|
|
||||||
$"8005FF8000000000FC105890420C0000EC019AB40000010043300000EC112000"
|
|
||||||
$"8003AA8000000000"
|
|
||||||
};
|
|
||||||
|
|
||||||
resource(101, "BEOS:L:STD_ICON") #'ICON' array
|
resource large_icon
|
||||||
{
|
{
|
||||||
$"FFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
$"FFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||||
$"FFFFFFFFFF001B0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
$"FFFFFFFFFF001B0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||||
@ -63,7 +39,7 @@ resource(101, "BEOS:L:STD_ICON") #'ICON' array
|
|||||||
$"FFFFFFFF0000000E0F0F0F0F0F0F0F0E0F0FFFFFFFFFFF000000FFFFFFFFFFFF"
|
$"FFFFFFFF0000000E0F0F0F0F0F0F0F0E0F0FFFFFFFFFFF000000FFFFFFFFFFFF"
|
||||||
};
|
};
|
||||||
|
|
||||||
resource(101, "BEOS:M:STD_ICON") #'MICN' array
|
resource mini_icon
|
||||||
{
|
{
|
||||||
$"FFFFFF0000FFFFFFFFFFFFFFFFFFFFFF"
|
$"FFFFFF0000FFFFFFFFFFFFFFFFFFFFFF"
|
||||||
$"FFFF001B1B0000FFFFFFFFFFFFFFFFFF"
|
$"FFFF001B1B0000FFFFFFFFFFFFFFFFFF"
|
||||||
@ -83,6 +59,6 @@ resource(101, "BEOS:M:STD_ICON") #'MICN' array
|
|||||||
$"FFFF00000E0F0F0F000000000000FFFF"
|
$"FFFF00000E0F0F0F000000000000FFFF"
|
||||||
};
|
};
|
||||||
|
|
||||||
resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.Be-SCRN";
|
resource app_signature "application/x-vnd.Be-SCRN";
|
||||||
|
|
||||||
resource(1, "BEOS:FILE_TYPES") message;
|
resource(1, "BEOS:FILE_TYPES") message;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#ifndef __SCREENAPPLICATION_H
|
#ifndef __SCREENAPPLICATION_H
|
||||||
#define __SCREENAPPLICATION_H
|
#define __SCREENAPPLICATION_H
|
||||||
|
|
||||||
#include "ScreenWindow.h"
|
class ScreenWindow;
|
||||||
|
|
||||||
class ScreenApplication : public BApplication
|
class ScreenApplication : public BApplication
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <InterfaceDefs.h>
|
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
#include <Picture.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "ScreenDrawView.h"
|
#include "ScreenDrawView.h"
|
||||||
|
|
||||||
ScreenDrawView::ScreenDrawView(BRect rect, char *name)
|
ScreenDrawView::ScreenDrawView(BRect rect, char *name)
|
||||||
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
|
:BBox(rect, name)
|
||||||
{
|
{
|
||||||
BScreen screen(B_MAIN_SCREEN_ID);
|
BScreen screen(B_MAIN_SCREEN_ID);
|
||||||
if (!screen.IsValid())
|
if (!screen.IsValid())
|
||||||
@ -42,14 +42,6 @@ ScreenDrawView::~ScreenDrawView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ScreenDrawView::AttachedToWindow()
|
|
||||||
{
|
|
||||||
rgb_color greyColor = { 216, 216, 216, 255 };
|
|
||||||
SetViewColor(greyColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScreenDrawView::MouseDown(BPoint point)
|
ScreenDrawView::MouseDown(BPoint point)
|
||||||
{
|
{
|
||||||
@ -199,24 +191,32 @@ ScreenDrawView::Draw(BRect updateRect)
|
|||||||
StrokeLine(BPoint(35.0, 53.0), BPoint(36.0, 53.0));
|
StrokeLine(BPoint(35.0, 53.0), BPoint(36.0, 53.0));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
BRect bounds(Bounds());
|
||||||
|
|
||||||
SetHighColor(desktopColor);
|
SetHighColor(desktopColor);
|
||||||
FillRect(Bounds());
|
|
||||||
|
FillRect(bounds);
|
||||||
|
|
||||||
|
|
||||||
|
SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
BRect bitmapBounds(fScreen1->Bounds());
|
BRect bitmapBounds(fScreen1->Bounds());
|
||||||
BRect dest;
|
BRect dest;
|
||||||
dest.left = Bounds().left;
|
dest.left = bounds.left;
|
||||||
dest.top = Bounds().top;
|
dest.top = bounds.top;
|
||||||
dest.right = Bounds().left + (bitmapBounds.Width() * 100) / fWidth;
|
dest.right = bounds.left + (bitmapBounds.Width() * 100) / fWidth;
|
||||||
dest.bottom = Bounds().top + (bitmapBounds.Height() * 100) / fHeight;
|
dest.bottom = bounds.top + (bitmapBounds.Height() * 100) / fHeight;
|
||||||
DrawBitmap(fScreen1, dest);
|
DrawBitmapAsync(fScreen1, dest);
|
||||||
|
|
||||||
BRect bitmapBounds2(fScreen2->Bounds());
|
BRect bitmapBounds2(fScreen2->Bounds());
|
||||||
BRect dest2;
|
BRect dest2;
|
||||||
dest2.top = Bounds().top;
|
dest2.top = bounds.top;
|
||||||
dest2.right = Bounds().right;
|
dest2.right = bounds.right;
|
||||||
dest2.bottom = Bounds().top + (bitmapBounds2.Height() * 100) / fHeight;
|
dest2.bottom = bounds.top + (bitmapBounds2.Height() * 100) / fHeight;
|
||||||
dest2.left = Bounds().right - (bitmapBounds2.Width() * 100) / fWidth;
|
dest2.left = bounds.right - (bitmapBounds2.Width() * 100) / fWidth;
|
||||||
|
|
||||||
DrawBitmap(fScreen2, dest2);
|
DrawBitmapAsync(fScreen2, dest2);
|
||||||
|
Flush();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ ScreenDrawView::MessageReceived(BMessage* message)
|
|||||||
message->FindString("resolution", &resolution);
|
message->FindString("resolution", &resolution);
|
||||||
|
|
||||||
int32 nextWidth = atoi(resolution.String());
|
int32 nextWidth = atoi(resolution.String());
|
||||||
resolution.Truncate(resolution.FindFirst('x') + 1);
|
resolution.Remove(0, resolution.FindFirst('x') + 1);
|
||||||
|
|
||||||
if (fWidth != nextWidth) {
|
if (fWidth != nextWidth) {
|
||||||
fWidth = nextWidth;
|
fWidth = nextWidth;
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
#ifndef __SCREENDRAWVIEW_H
|
#ifndef __SCREENDRAWVIEW_H
|
||||||
#define __SCREENDRAWVIEW_H
|
#define __SCREENDRAWVIEW_H
|
||||||
|
|
||||||
#include <View.h>
|
#include <Box.h>
|
||||||
|
|
||||||
class ScreenDrawView : public BView
|
class ScreenDrawView : public BBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScreenDrawView(BRect frame, char *name);
|
ScreenDrawView(BRect frame, char *name);
|
||||||
~ScreenDrawView();
|
~ScreenDrawView();
|
||||||
virtual void AttachedToWindow();
|
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
virtual void MouseDown(BPoint point);
|
virtual void MouseDown(BPoint point);
|
||||||
@ -17,8 +16,10 @@ private:
|
|||||||
rgb_color desktopColor;
|
rgb_color desktopColor;
|
||||||
int32 fWidth;
|
int32 fWidth;
|
||||||
int32 fHeight;
|
int32 fHeight;
|
||||||
|
#ifdef USE_BITMAPS
|
||||||
BBitmap *fScreen1,
|
BBitmap *fScreen1,
|
||||||
*fScreen2;
|
*fScreen2;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
#include <View.h>
|
|
||||||
|
|
||||||
#include "ScreenView.h"
|
|
||||||
#include "Utility.h"
|
|
||||||
|
|
||||||
ScreenView::ScreenView(BRect rect, char *name)
|
|
||||||
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ScreenView::AttachedToWindow()
|
|
||||||
{
|
|
||||||
rgb_color grey = ui_color(B_PANEL_BACKGROUND_COLOR);
|
|
||||||
SetViewColor(grey);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ScreenView::Draw(BRect updateRect)
|
|
||||||
{
|
|
||||||
rgb_color white = { 255, 255, 255, 255 };
|
|
||||||
rgb_color dark3 = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT);
|
|
||||||
rgb_color black = { 0, 0, 0, 255 };
|
|
||||||
|
|
||||||
BRect bounds(Bounds());
|
|
||||||
|
|
||||||
SetHighColor(white);
|
|
||||||
|
|
||||||
StrokeLine(BPoint(bounds.left, bounds.top), BPoint(bounds.right, bounds.top));
|
|
||||||
StrokeLine(BPoint(bounds.left, bounds.top), BPoint(bounds.left, bounds.bottom));
|
|
||||||
|
|
||||||
SetHighColor(dark3);
|
|
||||||
|
|
||||||
StrokeLine(BPoint(bounds.left, bounds.bottom), BPoint(bounds.right, bounds.bottom));
|
|
||||||
StrokeLine(BPoint(bounds.right, bounds.bottom), BPoint(bounds.right, bounds.top));
|
|
||||||
|
|
||||||
SetHighColor(black);
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
#ifndef __SCREENVIEW_H
|
|
||||||
#define __SCREENVIEW_H
|
|
||||||
|
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
class ScreenView : public BView
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ScreenView(BRect frame, char *name);
|
|
||||||
virtual void AttachedToWindow();
|
|
||||||
virtual void Draw(BRect updateRect);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,22 +1,24 @@
|
|||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
#include <Menu.h>
|
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
#include <MenuField.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
|
#include <PopUpMenu.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include "RefreshWindow.h"
|
||||||
#include "ScreenWindow.h"
|
#include "ScreenWindow.h"
|
||||||
#include "ScreenDrawView.h"
|
#include "ScreenDrawView.h"
|
||||||
#include "ScreenView.h"
|
#include "ScreenSettings.h"
|
||||||
#include "AlertWindow.h"
|
#include "AlertWindow.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "Utility.h"
|
#include "Utility.h"
|
||||||
@ -38,13 +40,26 @@ colorspace_to_string(uint32 colorspace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char*
|
static uint32
|
||||||
mode_to_string(display_mode mode)
|
string_to_colorspace(const char* string)
|
||||||
{
|
{
|
||||||
char string[128];
|
if (!strcmp(string, "8 Bits/Pixel"))
|
||||||
sprintf(string, "%d x %d", mode.virtual_width, mode.virtual_height);
|
return B_CMAP8;
|
||||||
|
else if (!strcmp(string, "15 Bits/Pixel"))
|
||||||
|
return B_RGB15;
|
||||||
|
else if (!strcmp(string, "16 Bits/Pixel"))
|
||||||
|
return B_RGB16;
|
||||||
|
else if (!strcmp(string, "32 Bits/Pixel"))
|
||||||
|
return B_RGB32;
|
||||||
|
|
||||||
return string;
|
return B_CMAP8; //Should return an error?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
mode_to_string(display_mode mode, char dest[])
|
||||||
|
{
|
||||||
|
sprintf(dest, "%d x %d", mode.virtual_width, mode.virtual_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,25 +74,20 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
|
|
||||||
screen.GetModeList(&fSupportedModes, &fTotalModes);
|
screen.GetModeList(&fSupportedModes, &fTotalModes);
|
||||||
|
|
||||||
fScreenView = new ScreenView(frame, "ScreenView");
|
frame.InsetBy(-1, -1);
|
||||||
|
fScreenView = new BBox(frame, "ScreenView");
|
||||||
|
fScreenDrawView = new ScreenDrawView(BRect(20.0, 16.0, 122.0, 93.0), "ScreenDrawView");
|
||||||
|
|
||||||
AddChild(fScreenView);
|
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);
|
||||||
BRect ScreenDrawViewRect(20.0, 16.0, 122.0, 93.0);
|
BBox *screenBox = new BBox(screenBoxRect);
|
||||||
BRect ControlsBoxRect;
|
|
||||||
BRect WorkspaceMenuRect;
|
|
||||||
BRect WorkspaceCountMenuRect;
|
|
||||||
BRect ControlMenuRect;
|
|
||||||
BRect ButtonRect;
|
|
||||||
|
|
||||||
BBox *screenBox = new BBox(ScreenBoxRect);
|
|
||||||
screenBox->SetBorder(B_FANCY_BORDER);
|
screenBox->SetBorder(B_FANCY_BORDER);
|
||||||
|
|
||||||
fScreenDrawView = new ScreenDrawView(ScreenDrawViewRect, "ScreenDrawView");
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
for (int32 count = 1; count <= 32; count++) {
|
for (int32 count = 1; count <= 32; count++) {
|
||||||
BString workspaceCount;
|
BString workspaceCount;
|
||||||
@ -92,10 +102,6 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
BMenuItem *marked = fWorkspaceCountMenu->FindItem(string.String());
|
BMenuItem *marked = fWorkspaceCountMenu->FindItem(string.String());
|
||||||
marked->SetMarked(true);
|
marked->SetMarked(true);
|
||||||
|
|
||||||
WorkspaceCountMenuRect.Set(7.0, 107.0, 135.0, 127.0);
|
|
||||||
|
|
||||||
fWorkspaceCountField = new BMenuField(WorkspaceCountMenuRect, "WorkspaceCountMenu", "Workspace count:", fWorkspaceCountMenu, true);
|
|
||||||
|
|
||||||
fWorkspaceCountField->SetDivider(91.0);
|
fWorkspaceCountField->SetDivider(91.0);
|
||||||
|
|
||||||
screenBox->AddChild(fScreenDrawView);
|
screenBox->AddChild(fScreenDrawView);
|
||||||
@ -109,18 +115,15 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
fCurrentWorkspaceItem->SetMarked(true);
|
fCurrentWorkspaceItem->SetMarked(true);
|
||||||
fWorkspaceMenu->AddItem(fCurrentWorkspaceItem);
|
fWorkspaceMenu->AddItem(fCurrentWorkspaceItem);
|
||||||
|
|
||||||
WorkspaceMenuRect.Set(0.0, 0.0, 132.0, 18.0);
|
BRect workspaceMenuRect(0.0, 0.0, 132.0, 18.0);
|
||||||
|
fWorkspaceField = new BMenuField(workspaceMenuRect, "WorkspaceMenu", NULL, fWorkspaceMenu, true);
|
||||||
|
|
||||||
fWorkspaceField = new BMenuField(WorkspaceMenuRect, "WorkspaceMenu", NULL, fWorkspaceMenu, true);
|
BRect controlsBoxRect(164.0, 7.0, 345.0, 155.0);
|
||||||
|
BBox *controlsBox = new BBox(controlsBoxRect);
|
||||||
ControlsBoxRect.Set(164.0, 7.0, 345.0, 155.0);
|
|
||||||
|
|
||||||
BBox *controlsBox = new BBox(ControlsBoxRect);
|
|
||||||
controlsBox->SetBorder(B_FANCY_BORDER);
|
controlsBox->SetBorder(B_FANCY_BORDER);
|
||||||
controlsBox->SetLabel(fWorkspaceField);
|
controlsBox->SetLabel(fWorkspaceField);
|
||||||
|
|
||||||
ButtonRect.Set(88.0, 114.0, 200.0, 150.0);
|
BRect ButtonRect(88.0, 114.0, 200.0, 150.0);
|
||||||
|
|
||||||
fApplyButton = new BButton(ButtonRect, "ApplyButton", "Apply",
|
fApplyButton = new BButton(ButtonRect, "ApplyButton", "Apply",
|
||||||
new BMessage(BUTTON_APPLY_MSG));
|
new BMessage(BUTTON_APPLY_MSG));
|
||||||
|
|
||||||
@ -135,9 +138,8 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
|
|
||||||
CheckUpdateDisplayModes();
|
CheckUpdateDisplayModes();
|
||||||
|
|
||||||
ControlMenuRect.Set(33.0, 30.0, 171.0, 48.0);
|
BRect controlMenuRect(33.0, 30.0, 171.0, 48.0);
|
||||||
|
fResolutionField = new BMenuField(controlMenuRect, "ResolutionMenu", "Resolution:", fResolutionMenu, true);
|
||||||
fResolutionField = new BMenuField(ControlMenuRect, "ResolutionMenu", "Resolution:", fResolutionMenu, true);
|
|
||||||
|
|
||||||
marked = fResolutionMenu->ItemAt(0);
|
marked = fResolutionMenu->ItemAt(0);
|
||||||
marked->SetMarked(true);
|
marked->SetMarked(true);
|
||||||
@ -146,9 +148,9 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
|
|
||||||
controlsBox->AddChild(fResolutionField);
|
controlsBox->AddChild(fResolutionField);
|
||||||
|
|
||||||
ControlMenuRect.Set(50.0, 58.0, 171.0, 76.0);
|
controlMenuRect.Set(50.0, 58.0, 171.0, 76.0);
|
||||||
|
|
||||||
fColorsField = new BMenuField(ControlMenuRect, "ColorsMenu", "Colors:", fColorsMenu, true);
|
fColorsField = new BMenuField(controlMenuRect, "ColorsMenu", "Colors:", fColorsMenu, true);
|
||||||
|
|
||||||
marked = fColorsMenu->ItemAt(0);
|
marked = fColorsMenu->ItemAt(0);
|
||||||
marked->SetMarked(true);
|
marked->SetMarked(true);
|
||||||
@ -170,9 +172,10 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
|
|
||||||
fRefreshMenu->AddItem(new BMenuItem("Other...", new BMessage(POP_OTHER_REFRESH_MSG)));
|
fRefreshMenu->AddItem(new BMenuItem("Other...", new BMessage(POP_OTHER_REFRESH_MSG)));
|
||||||
|
|
||||||
ControlMenuRect.Set(19.0, 86.0, 171.0, 104.0);
|
|
||||||
|
|
||||||
fRefreshField = new BMenuField(ControlMenuRect, "RefreshMenu", "Refresh Rate:", fRefreshMenu, true);
|
controlMenuRect.Set(19.0, 86.0, 171.0, 104.0);
|
||||||
|
|
||||||
|
fRefreshField = new BMenuField(controlMenuRect, "RefreshMenu", "Refresh Rate:", fRefreshMenu, true);
|
||||||
|
|
||||||
marked = fRefreshMenu->FindItem("60 Hz");
|
marked = fRefreshMenu->FindItem("60 Hz");
|
||||||
marked->SetMarked(true);
|
marked->SetMarked(true);
|
||||||
@ -205,9 +208,7 @@ ScreenWindow::ScreenWindow(ScreenSettings *Settings)
|
|||||||
fScreenView->AddChild(fRevertButton);
|
fScreenView->AddChild(fRevertButton);
|
||||||
|
|
||||||
display_mode mode;
|
display_mode mode;
|
||||||
|
|
||||||
screen.GetMode(&mode);
|
screen.GetMode(&mode);
|
||||||
|
|
||||||
fInitialMode = mode;
|
fInitialMode = mode;
|
||||||
|
|
||||||
string.Truncate(0);
|
string.Truncate(0);
|
||||||
@ -316,9 +317,9 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
case POP_WORKSPACE_CHANGED_MSG:
|
case POP_WORKSPACE_CHANGED_MSG:
|
||||||
{
|
{
|
||||||
BMenuItem *Item = fWorkspaceCountMenu->FindMarked();
|
BMenuItem *item = fWorkspaceCountMenu->FindMarked();
|
||||||
|
|
||||||
set_workspace_count(fWorkspaceCountMenu->IndexOf(Item) + 1);
|
set_workspace_count(fWorkspaceCountMenu->IndexOf(item) + 1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -331,6 +332,7 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
const char *resolution = fResolutionMenu->FindMarked()->Label();
|
const char *resolution = fResolutionMenu->FindMarked()->Label();
|
||||||
|
|
||||||
|
//CheckModesByResolution(resolution);
|
||||||
newMessage.AddString("resolution", resolution);
|
newMessage.AddString("resolution", resolution);
|
||||||
|
|
||||||
PostMessage(&newMessage, fScreenDrawView);
|
PostMessage(&newMessage, fScreenDrawView);
|
||||||
@ -453,24 +455,15 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
refresh = atof(fRefreshMenu->FindMarked()->Label());
|
refresh = atof(fRefreshMenu->FindMarked()->Label());
|
||||||
|
|
||||||
for (uint32 c = 0; c < fTotalModes; c++) {
|
for (uint32 c = 0; c < fTotalModes; c++) {
|
||||||
|
|
||||||
if ((fSupportedModes[c].virtual_width == width)
|
if ((fSupportedModes[c].virtual_width == width)
|
||||||
&& (fSupportedModes[c].virtual_height == height))
|
&& (fSupportedModes[c].virtual_height == height)
|
||||||
|
&& (fSupportedModes[c].space == string_to_colorspace(fColorsMenu->FindMarked()->Label())))
|
||||||
mode = &fSupportedModes[c];
|
mode = &fSupportedModes[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
mode->timing.pixel_clock = (uint32)((mode->timing.h_total * mode->timing.v_total) * refresh / 1000);
|
mode->timing.pixel_clock = (uint32)((mode->timing.h_total * mode->timing.v_total) * refresh / 1000);
|
||||||
|
|
||||||
if (fColorsMenu->FindMarked() == fColorsMenu->FindItem("8 Bits/Pixel"))
|
//mode->space = string_to_colorspace(fColorsMenu->FindMarked()->Label());
|
||||||
mode->space = B_CMAP8;
|
|
||||||
else if (fColorsMenu->FindMarked() == fColorsMenu->FindItem("15 Bits/Pixel"))
|
|
||||||
mode->space = B_RGB15;
|
|
||||||
else if (fColorsMenu->FindMarked() == fColorsMenu->FindItem("16 Bits/Pixel"))
|
|
||||||
mode->space = B_RGB16;
|
|
||||||
else if (fColorsMenu->FindMarked() == fColorsMenu->FindItem("32 Bits/Pixel"))
|
|
||||||
mode->space = B_RGB32;
|
|
||||||
|
|
||||||
mode->h_display_start = 0;
|
mode->h_display_start = 0;
|
||||||
mode->v_display_start = 0;
|
mode->v_display_start = 0;
|
||||||
|
|
||||||
@ -486,19 +479,8 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32 old = current_workspace();
|
|
||||||
int32 totalWorkspaces = count_workspaces();
|
|
||||||
|
|
||||||
for (int32 count = 0; count < totalWorkspaces; count ++) {
|
|
||||||
activate_workspace(count);
|
|
||||||
screen.SetMode(mode, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
activate_workspace(old);
|
|
||||||
}
|
}
|
||||||
else
|
screen.SetMode(mode);
|
||||||
screen.SetMode(mode);
|
|
||||||
|
|
||||||
BRect rect(100.0, 100.0, 400.0, 193.0);
|
BRect rect(100.0, 100.0, 400.0, 193.0);
|
||||||
|
|
||||||
@ -528,7 +510,6 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
string.Truncate(point + 2);
|
string.Truncate(point + 2);
|
||||||
|
|
||||||
string << " Hz/Other...";
|
string << " Hz/Other...";
|
||||||
|
|
||||||
fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG)->SetLabel(string.String());
|
fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG)->SetLabel(string.String());
|
||||||
|
|
||||||
point = string.FindFirst('/');
|
point = string.FindFirst('/');
|
||||||
@ -552,7 +533,22 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
display_mode mode;
|
display_mode mode;
|
||||||
screen.GetMode(&mode);
|
screen.GetMode(&mode);
|
||||||
screen.SetMode(&mode, true);
|
|
||||||
|
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);
|
||||||
|
|
||||||
fInitialRefreshN = fCustomRefresh;
|
fInitialRefreshN = fCustomRefresh;
|
||||||
fInitialResolution = fResolutionMenu->FindMarked();
|
fInitialResolution = fResolutionMenu->FindMarked();
|
||||||
@ -582,6 +578,7 @@ ScreenWindow::CheckApplyEnabled()
|
|||||||
fApplyButton->SetEnabled(false);
|
fApplyButton->SetEnabled(false);
|
||||||
fRevertButton->SetEnabled(false);
|
fRevertButton->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -591,8 +588,9 @@ ScreenWindow::CheckUpdateDisplayModes()
|
|||||||
uint32 c;
|
uint32 c;
|
||||||
|
|
||||||
// Add supported resolutions to the menu
|
// Add supported resolutions to the menu
|
||||||
|
char mode[128];
|
||||||
for (c = 0; c < fTotalModes; c++) {
|
for (c = 0; c < fTotalModes; c++) {
|
||||||
const char *mode = mode_to_string(fSupportedModes[c]);
|
mode_to_string(fSupportedModes[c], mode);
|
||||||
|
|
||||||
if (!fResolutionMenu->FindItem(mode))
|
if (!fResolutionMenu->FindItem(mode))
|
||||||
fResolutionMenu->AddItem(new BMenuItem(mode, new BMessage(POP_RESOLUTION_MSG)));
|
fResolutionMenu->AddItem(new BMenuItem(mode, new BMessage(POP_RESOLUTION_MSG)));
|
||||||
@ -605,14 +603,44 @@ ScreenWindow::CheckUpdateDisplayModes()
|
|||||||
if (!fColorsMenu->FindItem(colorSpace))
|
if (!fColorsMenu->FindItem(colorSpace))
|
||||||
fColorsMenu->AddItem(new BMenuItem(colorSpace, new BMessage(POP_COLORS_MSG)));
|
fColorsMenu->AddItem(new BMenuItem(colorSpace, new BMessage(POP_COLORS_MSG)));
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
XXX: BeOS's BScreen limits the refresh to 85 hz. I hope that OpenBeOS BScreen will remove
|
/*XXX: BeOS's BScreen limits the refresh to 85 hz (or is it the nvidia driver?).
|
||||||
|
I hope that OpenBeOS BScreen will remove
|
||||||
this limitation.
|
this limitation.
|
||||||
|
|
||||||
for (c = 0; c < fTotalModes; c++) {
|
for (c = 0; c < fTotalModes; c++) {
|
||||||
display_mode *mode = &fSupportedModes[c];
|
display_mode *mode = &fSupportedModes[c];
|
||||||
int32 refresh = (mode->timing.pixel_clock * 1000) / (mode->timing.h_total * mode->timing.v_total);
|
int32 refresh = (mode->timing.pixel_clock * 1000) / (mode->timing.h_total * mode->timing.v_total);
|
||||||
printf("%d\n", refresh);
|
printf("width %d, height %d, refresh %d\n", mode->virtual_width, mode->virtual_height, refresh);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
#ifndef __SCREENWINDOW_H
|
#ifndef __SCREENWINDOW_H
|
||||||
#define __SCREENWINDOW_H
|
#define __SCREENWINDOW_H
|
||||||
|
|
||||||
#include <PopUpMenu.h>
|
|
||||||
#include <MenuField.h>
|
|
||||||
#include <Window.h>
|
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <Box.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include "ScreenView.h"
|
|
||||||
#include "ScreenDrawView.h"
|
|
||||||
#include "RefreshWindow.h"
|
|
||||||
#include "ScreenSettings.h"
|
|
||||||
|
|
||||||
|
class BBox;
|
||||||
|
class BPopUpMenu;
|
||||||
|
class BMenuField;
|
||||||
|
class RefreshWindow;
|
||||||
|
class ScreenDrawView;
|
||||||
|
class ScreenSettings;
|
||||||
class ScreenWindow : public BWindow
|
class ScreenWindow : public BWindow
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScreenWindow(ScreenSettings *Settings);
|
ScreenWindow(ScreenSettings *settings);
|
||||||
virtual ~ScreenWindow();
|
virtual ~ScreenWindow();
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
@ -27,10 +25,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
void CheckApplyEnabled();
|
void CheckApplyEnabled();
|
||||||
void CheckUpdateDisplayModes();
|
void CheckUpdateDisplayModes();
|
||||||
|
void CheckModesByResolution(const char*);
|
||||||
|
|
||||||
|
BBox *fScreenView;
|
||||||
ScreenSettings *fSettings;
|
ScreenSettings *fSettings;
|
||||||
ScreenView *fScreenView;
|
|
||||||
ScreenDrawView *fScreenDrawView;
|
ScreenDrawView *fScreenDrawView;
|
||||||
|
|
||||||
BPopUpMenu *fWorkspaceMenu;
|
BPopUpMenu *fWorkspaceMenu;
|
||||||
BMenuField *fWorkspaceField;
|
BMenuField *fWorkspaceField;
|
||||||
BPopUpMenu *fWorkspaceCountMenu;
|
BPopUpMenu *fWorkspaceCountMenu;
|
||||||
@ -46,12 +46,15 @@ private:
|
|||||||
BButton *fDefaultsButton;
|
BButton *fDefaultsButton;
|
||||||
BButton *fApplyButton;
|
BButton *fApplyButton;
|
||||||
BButton *fRevertButton;
|
BButton *fRevertButton;
|
||||||
|
|
||||||
BMenuItem *fInitialResolution;
|
BMenuItem *fInitialResolution;
|
||||||
BMenuItem *fInitialColors;
|
BMenuItem *fInitialColors;
|
||||||
BMenuItem *fInitialRefresh;
|
BMenuItem *fInitialRefresh;
|
||||||
|
|
||||||
display_mode fInitialMode;
|
display_mode fInitialMode;
|
||||||
display_mode *fSupportedModes;
|
display_mode *fSupportedModes;
|
||||||
uint32 fTotalModes;
|
uint32 fTotalModes;
|
||||||
|
|
||||||
float fCustomRefresh;
|
float fCustomRefresh;
|
||||||
float fInitialRefreshN;
|
float fInitialRefreshN;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user