Last round of functionality changes.

"Add" and "test" now work. Be warned - without the input server addon running (and maybe even with), testing will cause the ScreenSaver to run but not to turn off. The way out of this is to alt-f# to a different workspace and kill "OpenBeOS ScreenSaver".

As far as I know, all functionality now in place and working properly. Needs a good workout.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7257 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Phipps 2004-04-20 02:05:24 +00:00
parent 730036e22e
commit 048f424d11
7 changed files with 276 additions and 209 deletions

View File

@ -33,6 +33,9 @@ const int SHOW ='SHOW';
const int POPULATE ='POPU';
const int UTILIZE ='UTIL';
const int SAVER_SEL ='SSEL';
const int TEST_BTN ='TEST';
const int ADD_BTN ='ADD ';
const int UPDATELIST ='UPDL';
const rgb_color black = {0,0,0,0};
const rgb_color darkGrey = {150,150,150,0};

View File

@ -12,7 +12,7 @@ local sources =
Preference ScreenSaver : $(sources) ;
LinkSharedOSLibs ScreenSaver : libscreensaver.so be stdc++.r4 ;
LinkSharedOSLibs ScreenSaver : tracker libscreensaver.so be stdc++.r4 ;
# Ugly hack: Prepend the dir containing Be's ScreenSaver.h to the list of
# include search dirs. Otherwise it won't be found.

View File

@ -29,6 +29,8 @@ PreviewView::PreviewView(BRect frame, const char *name,ScreenSaverPrefs *prefp)
}
PreviewView::~PreviewView() {
if (threadID)
kill_thread(threadID);
}
void PreviewView::SetScreenSaver(BString name) {
@ -47,8 +49,10 @@ void PreviewView::SetScreenSaver(BString name) {
sst=new ScreenSaverThread(Window(),configView,prefPtr);
saver=sst->LoadAddOn();
threadID=spawn_thread(threadFunc,"ScreenSaverRenderer",0,sst);
resume_thread(threadID);
if (saver) {
threadID=spawn_thread(threadFunc,"ScreenSaverRenderer",0,sst);
resume_thread(threadID);
}
}
void PreviewView::Draw(BRect update) {

View File

@ -1,4 +1,7 @@
#include <Application.h>
#include <unistd.h>
#include <stdio.h>
#include <Path.h>
#include "ScreenSaverPrefsApp.h"
@ -12,6 +15,20 @@ ScreenSaverPrefsApp::ScreenSaverPrefsApp(void) : BApplication(APP_SIG) {
m_MainForm->Show();
}
void ScreenSaverPrefsApp::RefsReceived(BMessage *msg) {
entry_ref ref;
BEntry e;
BPath p;
msg->FindRef("refs", &ref);
e.SetTo(&ref, true);
e.GetPath(&p);
char temp[2*B_PATH_NAME_LENGTH];
sprintf (temp,"cp %s '/boot/home/config/add-ons/Screen Savers/'\n",p.Path());
system(temp);
m_MainForm->PostMessage(new BMessage(UPDATELIST));
}
void ScreenSaverPrefsApp::MessageReceived(BMessage *message) {
switch(message->what) {
case B_READY_TO_RUN:

View File

@ -11,6 +11,7 @@ public:
ScreenSaverPrefsApp(void);
virtual ~ScreenSaverPrefsApp(void);
virtual void MessageReceived(BMessage *);
virtual void RefsReceived(BMessage *);
};

View File

@ -16,18 +16,43 @@
#include <ScreenSaver.h>
#include "MouseAreaView.h"
#include "PreviewView.h"
#include <Roster.h>
#include <stdio.h>
const int32 zero=0;
void drawPositionalMonitor(BView *view,BRect areaToDrawIn,int state);
BView *drawSampleMonitor(BView *view, BRect area);
struct SSListItem {
BString fileName;
BString displayName;
BString fileName;
BString displayName;
};
void ScreenSaverWin::SaverSelected(void) {
if (ListView1->CurrentSelection()>=0) {
SSListItem* listItem;
if (previewDisplay->ScreenSaver())
previewDisplay->ScreenSaver()->StopConfig();
listItem = reinterpret_cast<SSListItem*>(AddonList->ItemAt(ListView1->CurrentSelection()));
BString settingsMsgName(listItem->fileName);
previewDisplay->SetScreenSaver(settingsMsgName);
if (settingsArea) {
ModuleSettingsBox->RemoveChild(settingsArea);
delete settingsArea;
}
BRect bnds=ModuleSettingsBox->Bounds();
bnds.InsetBy(5,10);
settingsArea=new BView(bnds,"settingsArea",B_FOLLOW_NONE,B_WILL_DRAW);
settingsArea->SetViewColor(216,216,216);
ModuleSettingsBox->AddChild(settingsArea);
if (previewDisplay->ScreenSaver())
previewDisplay->ScreenSaver()->StartConfig(settingsArea);
}
}
void ScreenSaverWin::MessageReceived(BMessage *msg) {
SSListItem* listItem;
switch(msg->what) {
case PWBUTTON:
pwMessenger->SendMessage(SHOW);
@ -35,25 +60,18 @@ void ScreenSaverWin::MessageReceived(BMessage *msg) {
case B_QUIT_REQUESTED:
be_app->PostMessage(B_QUIT_REQUESTED);
break;
case SAVER_SEL:
if (previewDisplay->ScreenSaver())
previewDisplay->ScreenSaver()->StopConfig();
listItem = reinterpret_cast<SSListItem*>(AddonList->ItemAt(ListView1->CurrentSelection()));
BString settingsMsgName(listItem->fileName);
previewDisplay->SetScreenSaver(settingsMsgName);
if (settingsArea) {
ModuleSettingsBox->RemoveChild(settingsArea);
delete settingsArea;
}
BRect bnds=ModuleSettingsBox->Bounds();
bnds.InsetBy(5,10);
settingsArea=new BView(bnds,"settingsArea",B_FOLLOW_NONE,B_WILL_DRAW);
settingsArea->SetViewColor(216,216,216);
ModuleSettingsBox->AddChild(settingsArea);
if (previewDisplay->ScreenSaver())
previewDisplay->ScreenSaver()->StartConfig(settingsArea);
break;
case SAVER_SEL:
SaverSelected();
break;
case TEST_BTN:
be_roster->Launch("application/x-vnd.OBOS-ScreenSaverApp",prefs.GetSettings());
break;
case ADD_BTN:
filePanel->Show();
break;
case UPDATELIST:
populateScreenSaverList();
break;
}
updateStatus(); // This could get called sometimes when it doesn't need to. Shouldn't hurt
BWindow::MessageReceived(msg);
@ -98,15 +116,21 @@ void ScreenSaverWin::updateStatus(void) {
if (selection>=0)
prefs.SetModuleName(((BStringItem *)(ListView1->ItemAt(selection)))->Text());
// TODO - Tell the password window to update its stuff
BMessage ssState;
if ((previewDisplay->ScreenSaver()) && (previewDisplay->ScreenSaver()->SaveState(&ssState)==B_OK))
prefs.SetState(&ssState);
prefs.SaveSettings();
};
void ScreenSaverWin::SetupForm(void) {
filePanel=new BFilePanel();
BRect r;
BView *background;
BTab *tab;
r = Bounds();
// Create a background view
background=new BView(r,"background",B_FOLLOW_NONE,0);
background->SetViewColor(216,216,216,0);
@ -120,6 +144,10 @@ void ScreenSaverWin::SetupForm(void) {
r.InsetBy(0,4);
r.bottom -= tabView->TabHeight();
// Time to load the settings into a message and implement them...
prefs.LoadSettings();
prefs.WindowFrame().PrintToStream();
tab = new BTab();
tabView->AddTab(tab2=new BView(r,"Fade",B_FOLLOW_NONE,0), tab);
tab->SetLabel("Fade");
@ -137,9 +165,7 @@ void ScreenSaverWin::SetupForm(void) {
pwWin=new pwWindow;
pwMessenger=new BMessenger (NULL,pwWin);
pwWin->Run();
// Time to load the settings into a message and implement them...
prefs.LoadSettings();
prefs.WindowFrame().PrintToStream();
MoveTo(prefs.WindowFrame().left,prefs.WindowFrame().top);
ResizeTo(prefs.WindowFrame().right-prefs.WindowFrame().left,prefs.WindowFrame().bottom-prefs.WindowFrame().top);
tabView->Select(prefs.WindowTab());
@ -152,10 +178,13 @@ void ScreenSaverWin::SetupForm(void) {
PasswordSlider->SetValue(secondsToSlider(prefs.PasswordTime()));
const BStringItem **ptr = (const BStringItem **)(ListView1->Items());
long count=ListView1->CountItems();
if (prefs.Password() && ptr)
if (prefs.ModuleName() && ptr)
for ( long i = 0; i < count; i++ ) {
if (BString(prefs.Password())==((*ptr++)->Text()))
if (BString(prefs.ModuleName())==((*ptr++)->Text())) {
ListView1->Select(count=i); // Clever bit here - intentional assignment.
SaverSelected();
ListView1->ScrollToSelection();
}
}
updateStatus();
}
@ -188,162 +217,171 @@ void commonLookAndFeel(BView *widget,bool isSlider,bool isControl) {
// Iterate over a directory, adding the directories files to the list
void addScreenSaversToList (directory_which dir, BList *list) {
BPath path;
find_directory(dir,&path);
path.Append("Screen Savers",true);
BPath path;
find_directory(dir,&path);
path.Append("Screen Savers",true);
const char* pathName = path.Path();
const char* pathName = path.Path();
BDirectory ssDir(pathName);
BEntry thisSS;
char thisName[B_FILE_NAME_LENGTH];
BDirectory ssDir(pathName);
BEntry thisSS;
char thisName[B_FILE_NAME_LENGTH];
while (B_OK==ssDir.GetNextEntry(&thisSS,true)) {
thisSS.GetName(thisName);
SSListItem* tempListItem = new SSListItem;
tempListItem->fileName = pathName;
tempListItem->fileName += "/";
tempListItem->fileName += thisName;
tempListItem->displayName = thisName;
while (B_OK==ssDir.GetNextEntry(&thisSS,true)) {
thisSS.GetName(thisName);
SSListItem* tempListItem = new SSListItem;
tempListItem->fileName = pathName;
tempListItem->fileName += "/";
tempListItem->fileName += thisName;
tempListItem->displayName = thisName;
list->AddItem(tempListItem);
}
list->AddItem(tempListItem);
}
}
// sorting function for SSListItems
int compareSSListItems(const void* left, const void* right) {
SSListItem* leftItem = *(SSListItem **)left;
SSListItem* rightItem = *(SSListItem **)right;
SSListItem* leftItem = *(SSListItem **)left;
SSListItem* rightItem = *(SSListItem **)right;
return leftItem->displayName.Compare(rightItem->displayName);
return leftItem->displayName.Compare(rightItem->displayName);
}
// Add the strings in the BList to a BListView
void displayScreenSaversList(BList* list, BListView* view) {
list->SortItems(compareSSListItems);
void ScreenSaverWin::populateScreenSaverList(void) {
if (!AddonList)
AddonList = new BList;
else
for (void *i=AddonList->RemoveItem(zero);i;i=AddonList->RemoveItem(zero))
delete ((SSListItem *)i);
SSListItem* tempListItem = new SSListItem;
tempListItem->fileName = "";
tempListItem->displayName = "Blackness";
AddonList->AddItem(tempListItem);
addScreenSaversToList( B_BEOS_ADDONS_DIRECTORY, AddonList );
addScreenSaversToList( B_USER_ADDONS_DIRECTORY, AddonList );
AddonList->SortItems(compareSSListItems);
int numItems = list->CountItems();
for( int i = 0; i < numItems; ++i ) {
SSListItem* item = (SSListItem*)(list->ItemAt(i));
view->AddItem( new BStringItem(item->displayName.String()) );
}
// Add the strings in the BList to a BListView
ListView1->DeselectAll();
for (void *i=ListView1->RemoveItem(zero);i;i=ListView1->RemoveItem(zero))
delete ((BStringItem *)i);
int numItems = AddonList->CountItems();
for( int i = 0; i < numItems; ++i ) {
SSListItem* item = (SSListItem*)(AddonList->ItemAt(i));
ListView1->AddItem( new BStringItem(item->displayName.String()) );
}
}
// Create the controls for the first tab
void ScreenSaverWin::setupTab1(void) {
int columns[4]={15,150,180,430};
int rows[6]={15,125,135,255,263,276};
int columns[4]={15,150,180,430};
int rows[6]={15,120,135,255,263,280};
{rgb_color clr = {216,216,216,255}; tab1->SetViewColor(clr);}
tab1->AddChild( ModuleSettingsBox = new BBox(BRect(columns[2],rows[0],columns[3],rows[5]),"ModuleSettingsBox",B_FOLLOW_NONE,B_WILL_DRAW));
ModuleSettingsBox->SetLabel("Module settings");
ModuleSettingsBox->SetBorder(B_FANCY_BORDER);
{rgb_color clr = {216,216,216,255}; tab1->SetViewColor(clr);}
tab1->AddChild( ModuleSettingsBox = new BBox(BRect(columns[2],rows[0],columns[3],rows[5]),"ModuleSettingsBox",B_FOLLOW_NONE,B_WILL_DRAW));
ModuleSettingsBox->SetLabel("Module settings");
ModuleSettingsBox->SetBorder(B_FANCY_BORDER);
ListView1 = new BListView(BRect(columns[0],rows[2],columns[1]+3,rows[3]),"ListView1",B_SINGLE_SELECTION_LIST);
tab1->AddChild(new BScrollView("scroll_list",ListView1,B_FOLLOW_NONE,0,false,true));
commonLookAndFeel(ModuleSettingsBox,false,false);
{rgb_color clr = {255,255,255,0}; ListView1->SetViewColor(clr);}
ListView1->SetListType(B_SINGLE_SELECTION_LIST);
ListView1 = new BListView(BRect(columns[0],rows[2],columns[1]+3,rows[3]),"ListView1",B_SINGLE_SELECTION_LIST);
tab1->AddChild(new BScrollView("scroll_list",ListView1,B_FOLLOW_NONE,0,false,true));
commonLookAndFeel(ModuleSettingsBox,false,false);
{rgb_color clr = {255,255,255,0}; ListView1->SetViewColor(clr);}
ListView1->SetListType(B_SINGLE_SELECTION_LIST);
// selection message for screensaver list
ListView1->SetSelectionMessage( new BMessage( SAVER_SEL ) );
// selection message for screensaver list
ListView1->SetSelectionMessage( new BMessage( SAVER_SEL ) );
tab1->AddChild( TestButton = new BButton(BRect(columns[0],rows[4],91,rows[5]),"TestButton","Test", new BMessage (TAB1_CHG)));
commonLookAndFeel(TestButton,false,true);
TestButton->SetLabel("Test");
tab1->AddChild( TestButton = new BButton(BRect(columns[0],rows[4],91,rows[5]),"TestButton","Test", new BMessage (TEST_BTN)));
commonLookAndFeel(TestButton,false,true);
TestButton->SetLabel("Test");
tab1->AddChild( AddButton = new BButton(BRect(97,rows[4],columns[2]-10,rows[5]),"AddButton","Add...", new BMessage (TAB1_CHG)));
commonLookAndFeel(AddButton,false,true);
AddButton->SetLabel("Add...");
tab1->AddChild( AddButton = new BButton(BRect(97,rows[4],columns[2]-10,rows[5]),"AddButton","Add...", new BMessage (ADD_BTN)));
commonLookAndFeel(AddButton,false,true);
AddButton->SetLabel("Add...");
tab1->AddChild(previewDisplay = new PreviewView(BRect(columns[0]+5,rows[0],columns[1],rows[1]),"preview",&prefs));
AddonList = new BList;
addScreenSaversToList( B_BEOS_ADDONS_DIRECTORY, AddonList );
addScreenSaversToList( B_USER_ADDONS_DIRECTORY, AddonList );
displayScreenSaversList( AddonList, ListView1 );
tab1->AddChild(previewDisplay = new PreviewView(BRect(columns[0]+5,rows[0],columns[1],rows[1]),"preview",&prefs));
populateScreenSaverList();
}
// Create the controls for the second tab
void ScreenSaverWin::setupTab2(void) {
font_height stdFontHt;
be_plain_font->GetHeight(&stdFontHt);
int stringHeight=(int)(stdFontHt.ascent+stdFontHt.descent),sliderHeight=30;
int topEdge;
{rgb_color clr = {216,216,216,255}; tab2->SetViewColor(clr);}
tab2->AddChild( EnableScreenSaverBox = new BBox(BRect(11,13,437,280),"EnableScreenSaverBox"));
commonLookAndFeel(EnableScreenSaverBox,false,false);
font_height stdFontHt;
be_plain_font->GetHeight(&stdFontHt);
int stringHeight=(int)(stdFontHt.ascent+stdFontHt.descent),sliderHeight=30;
int topEdge;
{rgb_color clr = {216,216,216,255}; tab2->SetViewColor(clr);}
tab2->AddChild( EnableScreenSaverBox = new BBox(BRect(11,13,437,280),"EnableScreenSaverBox"));
commonLookAndFeel(EnableScreenSaverBox,false,false);
EnableCheckbox = new BCheckBox(BRect(0,0,90,stringHeight),"EnableCheckBox","Enable Screen Saver", new BMessage (TAB2_CHG));
EnableScreenSaverBox->SetLabel(EnableCheckbox);
EnableScreenSaverBox->SetBorder(B_FANCY_BORDER);
EnableCheckbox = new BCheckBox(BRect(0,0,90,stringHeight),"EnableCheckBox","Enable Screen Saver", new BMessage (TAB2_CHG));
EnableScreenSaverBox->SetLabel(EnableCheckbox);
EnableScreenSaverBox->SetBorder(B_FANCY_BORDER);
// Run Module
topEdge=26;
EnableScreenSaverBox->AddChild( StringView1 = new BStringView(BRect(21,topEdge,101,topEdge+stringHeight),"StringView1","Run module"));
commonLookAndFeel(StringView1,false,false);
StringView1->SetText("Run module");
StringView1->SetAlignment(B_ALIGN_LEFT);
// Run Module
topEdge=26;
EnableScreenSaverBox->AddChild( StringView1 = new BStringView(BRect(21,topEdge,101,topEdge+stringHeight),"StringView1","Run module"));
commonLookAndFeel(StringView1,false,false);
StringView1->SetText("Run module");
StringView1->SetAlignment(B_ALIGN_LEFT);
EnableScreenSaverBox->AddChild( RunSlider = new BSlider(BRect(132,topEdge,415,topEdge+sliderHeight),"RunSlider","minutes", new BMessage(TAB2_CHG), 0, 25));
RunSlider->SetModificationMessage(new BMessage(TAB2_CHG));
commonLookAndFeel(RunSlider,true,true);
float w,h;
RunSlider->GetPreferredSize(&w,&h);
sliderHeight=(int)h;
EnableScreenSaverBox->AddChild( RunSlider = new BSlider(BRect(132,topEdge,415,topEdge+sliderHeight),"RunSlider","minutes", new BMessage(TAB2_CHG), 0, 25));
RunSlider->SetModificationMessage(new BMessage(TAB2_CHG));
commonLookAndFeel(RunSlider,true,true);
float w,h;
RunSlider->GetPreferredSize(&w,&h);
sliderHeight=(int)h;
// Turn Off
topEdge+=sliderHeight;
EnableScreenSaverBox->AddChild( TurnOffScreenCheckBox = new BCheckBox(BRect(9,topEdge,107,topEdge+stringHeight),"TurnOffScreenCheckBox","Turn off screen", new BMessage (TAB2_CHG)));
commonLookAndFeel(TurnOffScreenCheckBox,false,true);
TurnOffScreenCheckBox->SetLabel("Turn off screen");
TurnOffScreenCheckBox->SetResizingMode(B_FOLLOW_NONE);
// Turn Off
topEdge+=sliderHeight;
EnableScreenSaverBox->AddChild( TurnOffScreenCheckBox = new BCheckBox(BRect(9,topEdge,107,topEdge+stringHeight),"TurnOffScreenCheckBox","Turn off screen", new BMessage (TAB2_CHG)));
commonLookAndFeel(TurnOffScreenCheckBox,false,true);
TurnOffScreenCheckBox->SetLabel("Turn off screen");
TurnOffScreenCheckBox->SetResizingMode(B_FOLLOW_NONE);
EnableScreenSaverBox->AddChild( TurnOffSlider = new BSlider(BRect(132,topEdge,415,topEdge+sliderHeight),"TurnOffSlider","", new BMessage(TAB2_CHG), 0, 25));
TurnOffSlider->SetModificationMessage(new BMessage(TAB2_CHG));
commonLookAndFeel(TurnOffSlider,true,true);
EnableScreenSaverBox->AddChild( TurnOffSlider = new BSlider(BRect(132,topEdge,415,topEdge+sliderHeight),"TurnOffSlider","", new BMessage(TAB2_CHG), 0, 25));
TurnOffSlider->SetModificationMessage(new BMessage(TAB2_CHG));
commonLookAndFeel(TurnOffSlider,true,true);
// Password
topEdge+=sliderHeight;
EnableScreenSaverBox->AddChild( PasswordCheckbox = new BCheckBox(BRect(9,topEdge,108,topEdge+stringHeight),"PasswordCheckbox","Password lock", new BMessage (TAB2_CHG)));
commonLookAndFeel(PasswordCheckbox,false,true);
PasswordCheckbox->SetLabel("Password lock");
// Password
topEdge+=sliderHeight;
EnableScreenSaverBox->AddChild( PasswordCheckbox = new BCheckBox(BRect(9,topEdge,108,topEdge+stringHeight),"PasswordCheckbox","Password lock", new BMessage (TAB2_CHG)));
commonLookAndFeel(PasswordCheckbox,false,true);
PasswordCheckbox->SetLabel("Password lock");
EnableScreenSaverBox->AddChild( PasswordSlider = new BSlider(BRect(132,topEdge,415,topEdge+sliderHeight),"PasswordSlider","", new BMessage(TAB2_CHG), 0, 25));
PasswordSlider->SetModificationMessage(new BMessage(TAB2_CHG));
commonLookAndFeel(PasswordSlider,true,true);
EnableScreenSaverBox->AddChild( PasswordSlider = new BSlider(BRect(132,topEdge,415,topEdge+sliderHeight),"PasswordSlider","", new BMessage(TAB2_CHG), 0, 25));
PasswordSlider->SetModificationMessage(new BMessage(TAB2_CHG));
commonLookAndFeel(PasswordSlider,true,true);
topEdge+=sliderHeight;
EnableScreenSaverBox->AddChild( PasswordButton = new BButton(BRect(331,topEdge,405,topEdge+25),"PasswordButton","Password...", new BMessage (PWBUTTON)));
commonLookAndFeel(PasswordButton,false,true);
PasswordButton->SetLabel("Password...");
topEdge+=sliderHeight;
EnableScreenSaverBox->AddChild( PasswordButton = new BButton(BRect(331,topEdge,405,topEdge+25),"PasswordButton","Password...", new BMessage (PWBUTTON)));
commonLookAndFeel(PasswordButton,false,true);
PasswordButton->SetLabel("Password...");
// Bottom
EnableScreenSaverBox->AddChild(fadeNow=new MouseAreaView(BRect(20,205,80,260),"fadeNow"));
EnableScreenSaverBox->AddChild(fadeNever=new MouseAreaView(BRect(220,205,280,260),"fadeNever"));
EnableScreenSaverBox->AddChild(fadeNow=new MouseAreaView(BRect(20,205,80,260),"fadeNow"));
EnableScreenSaverBox->AddChild(fadeNever=new MouseAreaView(BRect(220,205,280,260),"fadeNever"));
EnableScreenSaverBox->AddChild( FadeNowString = new BStringView(BRect(85,210,188,222),"FadeNowString","Fade now when"));
commonLookAndFeel(FadeNowString,false,false);
FadeNowString->SetText("Fade now when");
FadeNowString->SetAlignment(B_ALIGN_LEFT);
EnableScreenSaverBox->AddChild( FadeNowString = new BStringView(BRect(85,210,188,222),"FadeNowString","Fade now when"));
commonLookAndFeel(FadeNowString,false,false);
FadeNowString->SetText("Fade now when");
FadeNowString->SetAlignment(B_ALIGN_LEFT);
EnableScreenSaverBox->AddChild( FadeNowString2 = new BStringView(BRect(85,225,188,237),"FadeNowString2","mouse is here"));
commonLookAndFeel(FadeNowString2,false,false);
FadeNowString2->SetText("mouse is here");
FadeNowString2->SetAlignment(B_ALIGN_LEFT);
EnableScreenSaverBox->AddChild( FadeNowString2 = new BStringView(BRect(85,225,188,237),"FadeNowString2","mouse is here"));
commonLookAndFeel(FadeNowString2,false,false);
FadeNowString2->SetText("mouse is here");
FadeNowString2->SetAlignment(B_ALIGN_LEFT);
EnableScreenSaverBox->AddChild( DontFadeString = new BStringView(BRect(285,210,382,222),"DontFadeString","Don't fade when"));
commonLookAndFeel(DontFadeString,false,false);
DontFadeString->SetText("Don't fade when");
DontFadeString->SetAlignment(B_ALIGN_LEFT);
EnableScreenSaverBox->AddChild( DontFadeString = new BStringView(BRect(285,210,382,222),"DontFadeString","Don't fade when"));
commonLookAndFeel(DontFadeString,false,false);
DontFadeString->SetText("Don't fade when");
DontFadeString->SetAlignment(B_ALIGN_LEFT);
EnableScreenSaverBox->AddChild( DontFadeString2 = new BStringView(BRect(285,225,382,237),"DontFadeString2","mouse is here"));
commonLookAndFeel(DontFadeString2,false,false);
DontFadeString2->SetText("mouse is here");
DontFadeString2->SetAlignment(B_ALIGN_LEFT);
EnableScreenSaverBox->AddChild( DontFadeString2 = new BStringView(BRect(285,225,382,237),"DontFadeString2","mouse is here"));
commonLookAndFeel(DontFadeString2,false,false);
DontFadeString2->SetText("mouse is here");
DontFadeString2->SetAlignment(B_ALIGN_LEFT);
}

View File

@ -1,5 +1,6 @@
#ifndef _ScreenSaver_H
#define _ScreenSaver_H
#include <FilePanel.h>
#include <Picture.h>
#include "Constants.h"
#include "passwordWindow.h"
@ -10,80 +11,83 @@ class PreviewView;
class ScreenSaverWin: public BWindow {
public:
ScreenSaverWin(void) : BWindow(BRect(50,50,500,385),"OBOS Screen Saver Preferences",B_TITLED_WINDOW,B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE) ,
ScreenSaverWin(void) : BWindow(BRect(50,50,500,385),"OBOS Screen Saver Preferences",B_TITLED_WINDOW,B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE) ,
fadeState(0),noFadeState(0),
sampleView(NULL),
tab1(NULL),tab2(NULL),
tabView(NULL), ModuleSettingsBox(NULL),
previewDisplay(NULL), ListView1(NULL),
AddonList(NULL), SelectedAddonFileName(NULL),
currentAddon(NULL), TestButton(NULL),
AddButton(NULL), EnableScreenSaverBox(NULL),
PasswordSlider(NULL), TurnOffSlider(NULL),
RunSlider(NULL), StringView1(NULL),
EnableCheckbox(NULL), PasswordCheckbox(NULL),
TurnOffScreenCheckBox(NULL),
TurnOffMinutes(NULL), RunMinutes(NULL),
PasswordMinutes(NULL), PasswordButton(NULL),
FadeNowString(NULL),
FadeNowString2(NULL),
DontFadeString(NULL), DontFadeString2(NULL),
fadeNow(NULL),fadeNever(NULL),
pwWin(NULL),
pwMessenger(NULL),
settingsArea(NULL) {
tabView(NULL), ModuleSettingsBox(NULL),
previewDisplay(NULL), ListView1(NULL),
AddonList(NULL), SelectedAddonFileName(NULL),
currentAddon(NULL), TestButton(NULL),
AddButton(NULL), EnableScreenSaverBox(NULL),
PasswordSlider(NULL), TurnOffSlider(NULL),
RunSlider(NULL), StringView1(NULL),
EnableCheckbox(NULL), PasswordCheckbox(NULL),
TurnOffScreenCheckBox(NULL),
TurnOffMinutes(NULL), RunMinutes(NULL),
PasswordMinutes(NULL), PasswordButton(NULL),
FadeNowString(NULL),
FadeNowString2(NULL),
DontFadeString(NULL), DontFadeString2(NULL),
fadeNow(NULL),fadeNever(NULL),
pwWin(NULL),
pwMessenger(NULL), filePanel(NULL) ,
settingsArea(NULL) {
SetupForm();
}
virtual void MessageReceived(BMessage *message);
virtual bool QuitRequested(void);
void LoadSettings(void);
virtual ~ScreenSaverWin(void) {};
}
virtual void MessageReceived(BMessage *message);
virtual bool QuitRequested(void);
void populateScreenSaverList(void);
void LoadSettings(void);
virtual ~ScreenSaverWin(void) {};
private:
void SetupForm(void);
void setupTab1(void);
void setupTab2(void);
void updateStatus(void);
void SetupForm(void);
void setupTab1(void);
void setupTab2(void);
void updateStatus(void);
void SaverSelected(void);
ScreenSaverPrefs prefs;
int fadeState,noFadeState;
BView *sampleView;
int fadeState,noFadeState;
BView *sampleView;
BView *tab1,*tab2;
BTabView *tabView;
BBox *ModuleSettingsBox;
BView *tab1,*tab2;
BTabView *tabView;
BBox *ModuleSettingsBox;
PreviewView *previewDisplay;
BListView *ListView1;
BList *AddonList;
BString SelectedAddonFileName;
image_id currentAddon;
PreviewView *previewDisplay;
BListView *ListView1;
BList *AddonList;
BString SelectedAddonFileName;
image_id currentAddon;
BButton *TestButton;
BButton *AddButton;
BBox *EnableScreenSaverBox;
BSlider *PasswordSlider;
BSlider *TurnOffSlider;
BSlider *RunSlider;
BStringView *StringView1;
BCheckBox *EnableCheckbox;
BCheckBox *PasswordCheckbox;
BCheckBox *TurnOffScreenCheckBox;
BStringView *TurnOffMinutes;
BStringView *RunMinutes;
BStringView *PasswordMinutes;
BButton *PasswordButton;
BStringView *FadeNowString;
BStringView *FadeNowString2;
BStringView *DontFadeString;
BStringView *DontFadeString2;
BPicture samplePicture;
MouseAreaView *fadeNow,*fadeNever;
pwWindow *pwWin;
BMessenger *pwMessenger;
BButton *TestButton;
BButton *AddButton;
BBox *EnableScreenSaverBox;
BSlider *PasswordSlider;
BSlider *TurnOffSlider;
BSlider *RunSlider;
BStringView *StringView1;
BCheckBox *EnableCheckbox;
BCheckBox *PasswordCheckbox;
BCheckBox *TurnOffScreenCheckBox;
BStringView *TurnOffMinutes;
BStringView *RunMinutes;
BStringView *PasswordMinutes;
BButton *PasswordButton;
BStringView *FadeNowString;
BStringView *FadeNowString2;
BStringView *DontFadeString;
BStringView *DontFadeString2;
BPicture samplePicture;
MouseAreaView *fadeNow,*fadeNever;
pwWindow *pwWin;
BMessenger *pwMessenger;
BMessage settings;
BView *settingsArea;
BMessage settings;
BFilePanel *filePanel;
BView *settingsArea;
};
#endif // _ScreenSaver_H