- Made some settings persistent: Slide Show Delay, Scale Bilinear, Shrink/Zoom to Window, Show Caption in Full Screen Mode and PrintOptions persistent.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5415 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer
2003-11-19 10:41:51 +00:00
parent 5196460539
commit d3046f7d46
12 changed files with 532 additions and 167 deletions
+33 -2
View File
@@ -49,6 +49,7 @@
#include <PopUpMenu.h>
#include "ShowImageApp.h"
#include "ShowImageConstants.h"
#include "ShowImageView.h"
#include "ShowImageWindow.h"
@@ -151,8 +152,10 @@ ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode,
uint32 flags)
: BView(rect, name, resizingMode, flags)
{
InitPatterns();
ShowImageSettings* settings;
settings = my_app->Settings();
InitPatterns();
fBitmap = NULL;
fSelBitmap = NULL;
fDocumentIndex = 1;
@@ -165,12 +168,20 @@ ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode,
fHAlignment = B_ALIGN_LEFT;
fVAlignment = B_ALIGN_TOP;
fSlideShow = false;
SetSlideShowDelay(3); // 3 seconds
fSlideShowDelay = 3 * 10; // 3 seconds
fShowCaption = false;
fZoom = 1.0;
fMovesImage = false;
fScaleBilinear = false;
fScaler = NULL;
if (settings->Lock()) {
fShrinkToBounds = settings->GetBool("ShrinkToBounds", fShrinkToBounds);
fZoomToBounds = settings->GetBool("ZoomToBounds", fZoomToBounds);
fSlideShowDelay = settings->GetInt32("SlideShowDelay", fSlideShowDelay);
fScaleBilinear = settings->GetBool("ScaleBilinear", fScaleBilinear);
settings->Unlock();
}
SetViewColor(B_TRANSPARENT_COLOR);
SetHighColor(kborderColor);
@@ -322,6 +333,7 @@ void
ShowImageView::SetShrinkToBounds(bool enable)
{
if (fShrinkToBounds != enable) {
SettingsSetBool("ShrinkToBounds", enable);
fShrinkToBounds = enable;
FixupScrollBars();
Invalidate();
@@ -332,6 +344,7 @@ void
ShowImageView::SetZoomToBounds(bool enable)
{
if (fZoomToBounds != enable) {
SettingsSetBool("ZoomToBounds", enable);
fZoomToBounds = enable;
FixupScrollBars();
Invalidate();
@@ -406,6 +419,7 @@ void
ShowImageView::SetScaleBilinear(bool s)
{
if (fScaleBilinear != s) {
SettingsSetBool("ScaleBilinear", s);
fScaleBilinear = s; Invalidate();
}
}
@@ -1247,6 +1261,17 @@ ShowImageView::ShowPopUpMenu(BPoint screen)
menu->Go(screen, true, false, true);
}
void
ShowImageView::SettingsSetBool(const char* name, bool value)
{
ShowImageSettings* settings;
settings = my_app->Settings();
if (settings->Lock()) {
settings->SetBool(name, value);
settings->Unlock();
}
}
void
ShowImageView::MessageReceived(BMessage *pmsg)
{
@@ -1595,7 +1620,13 @@ ShowImageView::ZoomOut()
void
ShowImageView::SetSlideShowDelay(float seconds)
{
ShowImageSettings* settings;
fSlideShowDelay = (int)(seconds * 10.0);
settings = my_app->Settings();
if (settings->Lock()) {
settings->SetInt32("SlideShowDelay", fSlideShowDelay);
settings->Unlock();
}
}
void