Screen now uses the same preference file as R5's one, and it's compatible with it. Now revert works as it should. Some cleanups
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2097 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "ScreenSettings.h"
|
#include "ScreenSettings.h"
|
||||||
|
|
||||||
const char ScreenSettings::fScreenSettingsFile[] = "OBOS_Screen_data";
|
const char ScreenSettings::fScreenSettingsFile[] = "Screen_data";
|
||||||
|
|
||||||
ScreenSettings::ScreenSettings()
|
ScreenSettings::ScreenSettings()
|
||||||
{
|
{
|
||||||
@@ -11,6 +11,10 @@ ScreenSettings::ScreenSettings()
|
|||||||
|
|
||||||
if (!screen.IsValid())
|
if (!screen.IsValid())
|
||||||
; //Debugger() ?
|
; //Debugger() ?
|
||||||
|
|
||||||
|
fWindowFrame.Set( 0, 0, 356, 202 );
|
||||||
|
|
||||||
|
BRect screenFrame = screen.Frame();
|
||||||
|
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK)
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK)
|
||||||
@@ -20,19 +24,17 @@ ScreenSettings::ScreenSettings()
|
|||||||
BFile file(path.Path(), B_READ_ONLY);
|
BFile file(path.Path(), B_READ_ONLY);
|
||||||
if (file.InitCheck() == B_OK)
|
if (file.InitCheck() == B_OK)
|
||||||
{
|
{
|
||||||
file.Read(&fWindowFrame, sizeof(BRect));
|
BPoint point;
|
||||||
|
file.Read(&point, sizeof(BPoint));
|
||||||
|
fWindowFrame.OffsetTo(point);
|
||||||
|
|
||||||
if (screen.Frame().right >= fWindowFrame.right
|
if (screen.Frame().right >= fWindowFrame.right
|
||||||
&& screen.Frame().bottom >= fWindowFrame.bottom)
|
&& screen.Frame().bottom >= fWindowFrame.bottom)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fWindowFrame.OffsetTo((screenFrame.Width() - fWindowFrame.Width()) / 2,
|
||||||
fWindowFrame = screen.Frame();
|
(screenFrame.Height() - fWindowFrame.Height()) /2 );
|
||||||
fWindowFrame.left = (fWindowFrame.right / 2) - 178;
|
|
||||||
fWindowFrame.top = (fWindowFrame.right / 2) - 101;
|
|
||||||
fWindowFrame.right = fWindowFrame.left + 356;
|
|
||||||
fWindowFrame.bottom = fWindowFrame.top + 202;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -45,8 +47,10 @@ ScreenSettings::~ScreenSettings()
|
|||||||
path.Append(fScreenSettingsFile);
|
path.Append(fScreenSettingsFile);
|
||||||
|
|
||||||
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
|
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
|
||||||
if (file.InitCheck() == B_OK)
|
if (file.InitCheck() == B_OK) {
|
||||||
file.Write(&fWindowFrame, sizeof(BRect));
|
BPoint point(fWindowFrame.LeftTop());
|
||||||
|
file.Write(&point, sizeof(BPoint));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
#include "ScreenWindow.h"
|
#include "ScreenWindow.h"
|
||||||
#include "ScreenDrawView.h"
|
#include "ScreenDrawView.h"
|
||||||
@@ -371,8 +372,6 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
PostMessage(Message, fScreenDrawView);
|
PostMessage(Message, fScreenDrawView);
|
||||||
|
|
||||||
if (fResolutionMenu->FindMarked() == fInitialResolution)
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,6 +424,7 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case BUTTON_REVERT_MSG:
|
case BUTTON_REVERT_MSG:
|
||||||
|
case SET_INITIAL_MODE_MSG:
|
||||||
{
|
{
|
||||||
fInitialResolution->SetMarked(true);
|
fInitialResolution->SetMarked(true);
|
||||||
fInitialColors->SetMarked(true);
|
fInitialColors->SetMarked(true);
|
||||||
@@ -452,6 +452,14 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
fRefreshMenu->Superitem()->SetLabel(string.String());
|
fRefreshMenu->Superitem()->SetLabel(string.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message->what == SET_INITIAL_MODE_MSG)
|
||||||
|
{
|
||||||
|
BScreen screen(B_MAIN_SCREEN_ID);
|
||||||
|
if (!screen.IsValid())
|
||||||
|
break;
|
||||||
|
|
||||||
|
screen.SetMode(&fInitialMode);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,38 +557,7 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SET_INITIAL_MODE_MSG:
|
|
||||||
{
|
|
||||||
BMenuItem *Other = fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG);
|
|
||||||
|
|
||||||
if (fInitialRefresh == Other)
|
|
||||||
{
|
|
||||||
Other->SetMarked(true);
|
|
||||||
|
|
||||||
BString String;
|
|
||||||
String << fInitialRefreshN;
|
|
||||||
int32 point = String.FindFirst('.');
|
|
||||||
String.Truncate(point + 2);
|
|
||||||
|
|
||||||
String << " Hz/Other...";
|
|
||||||
|
|
||||||
fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG)->SetLabel(String.String());
|
|
||||||
|
|
||||||
point = String.FindFirst('/');
|
|
||||||
String.Truncate(point);
|
|
||||||
|
|
||||||
fRefreshMenu->Superitem()->SetLabel(String.String());
|
|
||||||
}
|
|
||||||
BScreen screen(B_MAIN_SCREEN_ID);
|
|
||||||
if (!screen.IsValid())
|
|
||||||
break;
|
|
||||||
|
|
||||||
screen.SetMode(&fInitialMode);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SET_CUSTOM_REFRESH_MSG:
|
case SET_CUSTOM_REFRESH_MSG:
|
||||||
{
|
{
|
||||||
message->FindFloat("refresh", &fCustomRefresh);
|
message->FindFloat("refresh", &fCustomRefresh);
|
||||||
@@ -598,8 +575,8 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG)->SetLabel(String.String());
|
fRefreshMenu->FindItem(POP_OTHER_REFRESH_MSG)->SetLabel(String.String());
|
||||||
|
|
||||||
point = String.FindFirst('z');
|
point = String.FindFirst('/');
|
||||||
String.Truncate(point + 1);
|
String.Truncate(point);
|
||||||
|
|
||||||
fRefreshMenu->Superitem()->SetLabel(String.String());
|
fRefreshMenu->Superitem()->SetLabel(String.String());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user