The JPEG translator config view was using its own layouting code,

and its own version of a BTabView. This worked correctly on beos, but since it
hardcoded some things, didn't look correct on haiku (due to the new look).
I just removed the layouting code, and adapted the rest to fit well.
This fixed the weird white line which was
showing up. Note that the jpeg2000 translator needs to be fixed in the same way.
 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31871 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2009-07-28 21:51:02 +00:00
parent 0a5bfde225
commit b20d13f4a6
2 changed files with 85 additions and 241 deletions
+72 -207
View File
@@ -469,55 +469,19 @@ translate_8(uint8* in, uint8* out, int32 inRowBytes, int32 xStep)
// #pragma mark - SView // #pragma mark - SView
SView::SView(const char *name, float x, float y) SView::SView(BRect frame, const char *name)
: BView(BRect(x, y, x, y), name, B_FOLLOW_NONE, B_WILL_DRAW) : BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW)
{ {
fPreferredWidth = 0;
fPreferredHeight = 0;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowColor(ViewColor()); SetLowColor(ViewColor());
SetFont(be_plain_font);
} }
void void
SView::GetPreferredSize(float* _width, float* _height) SView::AttachedToWindow()
{ {
if (_width) BView::AttachedToWindow();
*_width = fPreferredWidth; ResizeTo(Parent()->Bounds().Width(), Parent()->Bounds().Height());
if (_height)
*_height = fPreferredHeight;
}
void
SView::ResizeToPreferred()
{
ResizeTo(fPreferredWidth, fPreferredHeight);
}
void
SView::ResizePreferredBy(float width, float height)
{
fPreferredWidth += width;
fPreferredHeight += height;
}
void
SView::AddChild(BView *child, BView *before)
{
BView::AddChild(child, before);
child->ResizeToPreferred();
BRect frame = child->Frame();
if (frame.right > fPreferredWidth)
fPreferredWidth = frame.right;
if (frame.bottom > fPreferredHeight)
fPreferredHeight = frame.bottom;
} }
@@ -536,7 +500,7 @@ SSlider::SSlider(BRect frame, const char *name, const char *label,
//! Update status string - show actual value //! Update status string - show actual value
char* const char*
SSlider::UpdateText() const SSlider::UpdateText() const
{ {
snprintf(fStatusLabel, sizeof(fStatusLabel), "%ld", Value()); snprintf(fStatusLabel, sizeof(fStatusLabel), "%ld", Value());
@@ -561,31 +525,33 @@ SSlider::ResizeToPreferred()
// #pragma mark - // #pragma mark -
TranslatorReadView::TranslatorReadView(const char *name, jpeg_settings *settings, TranslatorReadView::TranslatorReadView(BRect frame, const char *name,
float x, float y) jpeg_settings *settings)
: SView(name, x, y), : SView(frame, name),
fSettings(settings) fSettings(settings)
{ {
fAlwaysRGB32 = new BCheckBox(BRect(10, GetPreferredHeight(), 10, BRect rect(5, 5, 30, 30);
GetPreferredHeight()), "alwaysrgb32", VIEW_LABEL_ALWAYSRGB32, fAlwaysRGB32 = new BCheckBox(rect, "alwaysrgb32", VIEW_LABEL_ALWAYSRGB32,
new BMessage(VIEW_MSG_SET_ALWAYSRGB32)); new BMessage(VIEW_MSG_SET_ALWAYSRGB32));
fAlwaysRGB32->SetFont(be_plain_font); fAlwaysRGB32->SetFont(be_plain_font);
if (fSettings->Always_B_RGB32) if (fSettings->Always_B_RGB32)
fAlwaysRGB32->SetValue(1); fAlwaysRGB32->SetValue(1);
AddChild(fAlwaysRGB32); AddChild(fAlwaysRGB32);
fAlwaysRGB32->ResizeToPreferred();
fPhotoshopCMYK = new BCheckBox(BRect(10, GetPreferredHeight(), 10, rect.OffsetBy(0, fAlwaysRGB32->Bounds().Height() + 5);
GetPreferredHeight()), "photoshopCMYK", VIEW_LABEL_PHOTOSHOPCMYK,
fPhotoshopCMYK = new BCheckBox(rect, "photoshopCMYK", VIEW_LABEL_PHOTOSHOPCMYK,
new BMessage(VIEW_MSG_SET_PHOTOSHOPCMYK)); new BMessage(VIEW_MSG_SET_PHOTOSHOPCMYK));
fPhotoshopCMYK->SetFont(be_plain_font); fPhotoshopCMYK->SetFont(be_plain_font);
if (fSettings->PhotoshopCMYK) if (fSettings->PhotoshopCMYK)
fPhotoshopCMYK->SetValue(1); fPhotoshopCMYK->SetValue(1);
AddChild(fPhotoshopCMYK); AddChild(fPhotoshopCMYK);
fPhotoshopCMYK->ResizeToPreferred();
fShowErrorBox = new BCheckBox(BRect(10, GetPreferredHeight(), 10, rect.OffsetBy(0, fPhotoshopCMYK->Bounds().Height() + 5);
GetPreferredHeight()), "error", VIEW_LABEL_SHOWREADERRORBOX,
fShowErrorBox = new BCheckBox(rect, "error", VIEW_LABEL_SHOWREADERRORBOX,
new BMessage(VIEW_MSG_SET_SHOWREADERRORBOX)); new BMessage(VIEW_MSG_SET_SHOWREADERRORBOX));
fShowErrorBox->SetFont(be_plain_font); fShowErrorBox->SetFont(be_plain_font);
if (fSettings->ShowReadWarningBox) if (fSettings->ShowReadWarningBox)
@@ -593,13 +559,15 @@ TranslatorReadView::TranslatorReadView(const char *name, jpeg_settings *settings
AddChild(fShowErrorBox); AddChild(fShowErrorBox);
ResizeToPreferred(); fShowErrorBox->ResizeToPreferred();
} }
void void
TranslatorReadView::AttachedToWindow() TranslatorReadView::AttachedToWindow()
{ {
SView::AttachedToWindow();
fAlwaysRGB32->SetTarget(this); fAlwaysRGB32->SetTarget(this);
fPhotoshopCMYK->SetTarget(this); fPhotoshopCMYK->SetTarget(this);
fShowErrorBox->SetTarget(this); fShowErrorBox->SetTarget(this);
@@ -647,13 +615,13 @@ TranslatorReadView::MessageReceived(BMessage* message)
// #pragma mark - TranslatorWriteView // #pragma mark - TranslatorWriteView
TranslatorWriteView::TranslatorWriteView(const char *name, jpeg_settings *settings, TranslatorWriteView::TranslatorWriteView(BRect frame, const char *name,
float x, float y) jpeg_settings *settings)
: SView(name, x, y), : SView(frame, name),
fSettings(settings) fSettings(settings)
{ {
fQualitySlider = new SSlider(BRect(10, GetPreferredHeight(), 10, BRect rect(10, 10, 20, 30);
GetPreferredHeight()), "quality", VIEW_LABEL_QUALITY, fQualitySlider = new SSlider(rect, "quality", VIEW_LABEL_QUALITY,
new BMessage(VIEW_MSG_SET_QUALITY), 0, 100); new BMessage(VIEW_MSG_SET_QUALITY), 0, 100);
fQualitySlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fQualitySlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fQualitySlider->SetHashMarkCount(10); fQualitySlider->SetHashMarkCount(10);
@@ -661,9 +629,11 @@ TranslatorWriteView::TranslatorWriteView(const char *name, jpeg_settings *settin
fQualitySlider->SetFont(be_plain_font); fQualitySlider->SetFont(be_plain_font);
fQualitySlider->SetValue(fSettings->Quality); fQualitySlider->SetValue(fSettings->Quality);
AddChild(fQualitySlider); AddChild(fQualitySlider);
fQualitySlider->ResizeToPreferred();
fSmoothingSlider = new SSlider(BRect(10, GetPreferredHeight()+10, 10, rect.OffsetBy(0, fQualitySlider->Bounds().Height() + 5);
GetPreferredHeight()), "smoothing", VIEW_LABEL_SMOOTHING,
fSmoothingSlider = new SSlider(rect, "smoothing", VIEW_LABEL_SMOOTHING,
new BMessage(VIEW_MSG_SET_SMOOTHING), 0, 100); new BMessage(VIEW_MSG_SET_SMOOTHING), 0, 100);
fSmoothingSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fSmoothingSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fSmoothingSlider->SetHashMarkCount(10); fSmoothingSlider->SetHashMarkCount(10);
@@ -671,27 +641,32 @@ TranslatorWriteView::TranslatorWriteView(const char *name, jpeg_settings *settin
fSmoothingSlider->SetFont(be_plain_font); fSmoothingSlider->SetFont(be_plain_font);
fSmoothingSlider->SetValue(fSettings->Smoothing); fSmoothingSlider->SetValue(fSettings->Smoothing);
AddChild(fSmoothingSlider); AddChild(fSmoothingSlider);
fSmoothingSlider->ResizeToPreferred();
fProgress = new BCheckBox(BRect(10, GetPreferredHeight()+10, 10, rect.OffsetBy(0, fSmoothingSlider->Bounds().Height() + 5);
GetPreferredHeight()), "progress", VIEW_LABEL_PROGRESSIVE,
fProgress = new BCheckBox(rect, "progress", VIEW_LABEL_PROGRESSIVE,
new BMessage(VIEW_MSG_SET_PROGRESSIVE)); new BMessage(VIEW_MSG_SET_PROGRESSIVE));
fProgress->SetFont(be_plain_font); fProgress->SetFont(be_plain_font);
if (fSettings->Progressive) if (fSettings->Progressive)
fProgress->SetValue(1); fProgress->SetValue(1);
AddChild(fProgress); AddChild(fProgress);
fProgress->ResizeToPreferred();
fOptimizeColors = new BCheckBox(BRect(10, GetPreferredHeight()+5, 10,
GetPreferredHeight() + 5), "optimizecolors", VIEW_LABEL_OPTIMIZECOLORS, rect.OffsetBy(0, fProgress->Bounds().Height() + 5);
fOptimizeColors = new BCheckBox(rect, "optimizecolors", VIEW_LABEL_OPTIMIZECOLORS,
new BMessage(VIEW_MSG_SET_OPTIMIZECOLORS)); new BMessage(VIEW_MSG_SET_OPTIMIZECOLORS));
fOptimizeColors->SetFont(be_plain_font); fOptimizeColors->SetFont(be_plain_font);
if (fSettings->OptimizeColors) if (fSettings->OptimizeColors)
fOptimizeColors->SetValue(1); fOptimizeColors->SetValue(1);
AddChild(fOptimizeColors); AddChild(fOptimizeColors);
fOptimizeColors->ResizeToPreferred();
fSmallerFile = new BCheckBox(BRect(25, GetPreferredHeight()+5, 25, rect.OffsetBy(0, fOptimizeColors->Bounds().Height() + 5);
GetPreferredHeight() + 5), "smallerfile", VIEW_LABEL_SMALLERFILE,
fSmallerFile = new BCheckBox(rect, "smallerfile", VIEW_LABEL_SMALLERFILE,
new BMessage(VIEW_MSG_SET_SMALLERFILE)); new BMessage(VIEW_MSG_SET_SMALLERFILE));
fSmallerFile->SetFont(be_plain_font); fSmallerFile->SetFont(be_plain_font);
if (fSettings->SmallerFile) if (fSettings->SmallerFile)
@@ -700,9 +675,10 @@ TranslatorWriteView::TranslatorWriteView(const char *name, jpeg_settings *settin
fSmallerFile->SetEnabled(false); fSmallerFile->SetEnabled(false);
AddChild(fSmallerFile); AddChild(fSmallerFile);
fSmallerFile->ResizeToPreferred();
fGrayAsRGB24 = new BCheckBox(BRect(10, GetPreferredHeight()+5, 25, rect.OffsetBy(0, fSmallerFile->Bounds().Height() + 5);
GetPreferredHeight()+5), "gray1asrgb24", VIEW_LABEL_GRAY1ASRGB24,
fGrayAsRGB24 = new BCheckBox(rect, "gray1asrgb24", VIEW_LABEL_GRAY1ASRGB24,
new BMessage(VIEW_MSG_SET_GRAY1ASRGB24)); new BMessage(VIEW_MSG_SET_GRAY1ASRGB24));
fGrayAsRGB24->SetFont(be_plain_font); fGrayAsRGB24->SetFont(be_plain_font);
if (fSettings->B_GRAY1_as_B_RGB24) if (fSettings->B_GRAY1_as_B_RGB24)
@@ -710,13 +686,15 @@ TranslatorWriteView::TranslatorWriteView(const char *name, jpeg_settings *settin
AddChild(fGrayAsRGB24); AddChild(fGrayAsRGB24);
ResizeToPreferred(); fGrayAsRGB24->ResizeToPreferred();
} }
void void
TranslatorWriteView::AttachedToWindow() TranslatorWriteView::AttachedToWindow()
{ {
SView::AttachedToWindow();
fQualitySlider->SetTarget(this); fQualitySlider->SetTarget(this);
fSmoothingSlider->SetTarget(this); fSmoothingSlider->SetTarget(this);
fProgress->SetTarget(this); fProgress->SetTarget(this);
@@ -795,14 +773,15 @@ TranslatorWriteView::MessageReceived(BMessage *message)
// #pragma mark - // #pragma mark -
TranslatorAboutView::TranslatorAboutView(const char *name, float x, float y) TranslatorAboutView::TranslatorAboutView(BRect frame, const char *name)
: SView(name, x, y) : SView(frame, name)
{ {
BStringView *title = new BStringView(BRect(10, 0, 10, 0), "Title", BStringView *title = new BStringView(BRect(10, 0, 10, 0), "Title",
translatorName); translatorName);
title->SetFont(be_bold_font); title->SetFont(be_bold_font);
AddChild(title); AddChild(title);
title->ResizeToPreferred();
BRect rect = title->Bounds(); BRect rect = title->Bounds();
float space = title->StringWidth(" "); float space = title->StringWidth(" ");
@@ -811,7 +790,7 @@ TranslatorAboutView::TranslatorAboutView(const char *name, float x, float y)
sprintf(versionString, "v%d.%d.%d", (int)(translatorVersion >> 8), sprintf(versionString, "v%d.%d.%d", (int)(translatorVersion >> 8),
(int)((translatorVersion >> 4) & 0xf), (int)(translatorVersion & 0xf)); (int)((translatorVersion >> 4) & 0xf), (int)(translatorVersion & 0xf));
BStringView *version = new BStringView(BRect(rect.right+space, rect.top, BStringView *version = new BStringView(BRect(rect.right + space, rect.top,
rect.right+space, rect.top), "Version", versionString); rect.right+space, rect.top), "Version", versionString);
version->SetFont(be_plain_font); version->SetFont(be_plain_font);
version->SetFontSize(9); version->SetFontSize(9);
@@ -824,6 +803,7 @@ TranslatorAboutView::TranslatorAboutView(const char *name, float x, float y)
// Now for each line in translatorInfo add a BStringView // Now for each line in translatorInfo add a BStringView
char* current = translatorInfo; char* current = translatorInfo;
int32 index = 1; int32 index = 1;
BRect stringFrame = title->Frame();
while (current != NULL && current[0]) { while (current != NULL && current[0]) {
char text[128]; char text[128];
char* newLine = strchr(current, '\n'); char* newLine = strchr(current, '\n');
@@ -834,12 +814,12 @@ TranslatorAboutView::TranslatorAboutView(const char *name, float x, float y)
strlcpy(text, current, min_c((int32)sizeof(text), newLine + 1 - current)); strlcpy(text, current, min_c((int32)sizeof(text), newLine + 1 - current));
current = newLine + 1; current = newLine + 1;
} }
stringFrame.OffsetBy(0, stringFrame.Height() + 2);
BStringView* string = new BStringView(BRect(10, GetPreferredHeight(), BStringView* string = new BStringView(stringFrame, "copyright", text);
10, GetPreferredHeight()), "copyright", text);
if (index > 3) if (index > 3)
string->SetFontSize(9); string->SetFontSize(9);
AddChild(string); AddChild(string);
string->ResizeToPreferred();
index++; index++;
} }
@@ -851,10 +831,8 @@ TranslatorAboutView::TranslatorAboutView(const char *name, float x, float y)
// #pragma mark - // #pragma mark -
TranslatorView::TranslatorView(const char *name) TranslatorView::TranslatorView(BRect frame, const char *name)
: SView(name), : BTabView(frame, name)
fTabWidth(30),
fActiveChild(0)
{ {
// Set global var to true // Set global var to true
gAreSettingsRunning = true; gAreSettingsRunning = true;
@@ -862,39 +840,13 @@ TranslatorView::TranslatorView(const char *name)
// Load settings to global settings struct // Load settings to global settings struct
LoadSettings(&fSettings); LoadSettings(&fSettings);
font_height fontHeight; BRect contentSize = ContainerView()->Bounds();
GetFontHeight(&fontHeight); SView *view = new TranslatorWriteView(contentSize, "Write", &fSettings);
fTabHeight = (int32)ceilf(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 7; AddTab(view);
// Add left and top margins view = new TranslatorReadView(contentSize, "Read", &fSettings);
float top = fTabHeight + 20; AddTab(view);
float left = 0; view = new TranslatorAboutView(contentSize, "About");
AddTab(view);
// This will remember longest string width
int32 nameWidth = 0;
SView *view = new TranslatorWriteView("Write", &fSettings, left, top);
AddChild(view);
nameWidth = (int32)StringWidth(view->Name());
fTabs.AddItem(new BTab(view));
view = new TranslatorReadView("Read", &fSettings, left, top);
AddChild(view);
if (nameWidth < StringWidth(view->Name()))
nameWidth = (int32)StringWidth(view->Name());
fTabs.AddItem(new BTab(view));
view = new TranslatorAboutView("About", left, top);
AddChild(view);
if (nameWidth < StringWidth(view->Name()))
nameWidth = (int32)StringWidth(view->Name());
fTabs.AddItem(new BTab(view));
fTabWidth += nameWidth;
if (fTabWidth * CountChildren() > GetPreferredWidth())
ResizePreferredBy((fTabWidth * CountChildren()) - GetPreferredWidth(), 0);
// Add right and bottom margins
ResizePreferredBy(10, 15);
ResizeToPreferred(); ResizeToPreferred();
@@ -906,11 +858,6 @@ TranslatorView::TranslatorView(const char *name)
TranslatorView::~TranslatorView() TranslatorView::~TranslatorView()
{ {
gAreSettingsRunning = false; gAreSettingsRunning = false;
BTab* tab;
while ((tab = (BTab*)fTabs.RemoveItem((int32)0)) != NULL) {
delete tab;
}
} }
@@ -918,96 +865,14 @@ TranslatorView::~TranslatorView()
void void
TranslatorView::AttachedToWindow() TranslatorView::AttachedToWindow()
{ {
// Hide all children except first one BTabView::AttachedToWindow();
BView *child;
int32 index = 1;
while ((child = ChildAt(index++)) != NULL)
child->Hide();
}
BRect
TranslatorView::_TabFrame(int32 index) const
{
return BRect(index * fTabWidth, 10, (index + 1) * fTabWidth, 10 + fTabHeight);
} }
void void
TranslatorView::Draw(BRect updateRect) TranslatorView::Select(int32 index)
{ {
// This is needed because DataTranslations app hides children BTabView::Select(index);
// after user changes translator
if (ChildAt(fActiveChild)->IsHidden())
ChildAt(fActiveChild)->Show();
// Clear
SetHighColor(ViewColor());
BRect frame = _TabFrame(0);
FillRect(BRect(frame.left, frame.top, Bounds().right, frame.bottom - 1));
int32 index = 0;
BTab* tab;
while ((tab = (BTab*)fTabs.ItemAt(index)) != NULL) {
tab_position position;
if (fActiveChild == index)
position = B_TAB_FRONT;
else if (index == 0)
position = B_TAB_FIRST;
else
position = B_TAB_ANY;
tab->DrawTab(this, _TabFrame(index), position, index + 1 != fActiveChild);
index++;
}
// Draw bottom edge
SetHighColor(tint_color(ViewColor(), B_LIGHTEN_MAX_TINT));
BRect selectedFrame = _TabFrame(fActiveChild);
float offset = ceilf(frame.Height() / 2.0);
if (selectedFrame.left > frame.left) {
StrokeLine(BPoint(frame.left, frame.bottom),
BPoint(selectedFrame.left, frame.bottom));
}
if (selectedFrame.right + offset < Bounds().right) {
StrokeLine(BPoint(selectedFrame.right + offset, frame.bottom),
BPoint(Bounds().right, frame.bottom));
}
}
//! MouseDown, check if on tab, if so change tab if needed
void
TranslatorView::MouseDown(BPoint where)
{
BRect frame = _TabFrame(fTabs.CountItems() - 1);
frame.left = 0;
if (!frame.Contains(where))
return;
for (int32 index = fTabs.CountItems(); index-- > 0;) {
if (!_TabFrame(index).Contains(where))
continue;
if (fActiveChild != index) {
// Hide current visible child
ChildAt(fActiveChild)->Hide();
// This loop is needed because it looks like in DataTranslations
// view gets hidden more than one time when user changes translator
while (ChildAt(index)->IsHidden()) {
ChildAt(index)->Show();
}
// Remember which one is currently visible
fActiveChild = index;
Invalidate(frame);
break;
}
}
} }
@@ -1039,7 +904,7 @@ TranslatorWindow::TranslatorWindow(bool quitOnClose)
status_t status_t
MakeConfig(BMessage *ioExtension, BView **outView, BRect *outExtent) MakeConfig(BMessage *ioExtension, BView **outView, BRect *outExtent)
{ {
*outView = new TranslatorView("TranslatorView"); *outView = new TranslatorView(BRect(0, 0, 320, 300), "TranslatorView");
*outExtent = (*outView)->Frame(); *outExtent = (*outView)->Frame();
return B_OK; return B_OK;
} }
+13 -34
View File
@@ -39,6 +39,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <Path.h> #include <Path.h>
#include <Slider.h> #include <Slider.h>
#include <StringView.h> #include <StringView.h>
#include <TabView.h>
#include <TranslationKit.h> #include <TranslationKit.h>
#include <TranslatorAddOn.h> #include <TranslatorAddOn.h>
@@ -104,39 +105,24 @@ class SSlider : public BSlider {
thumb_style thumbType = B_BLOCK_THUMB, thumb_style thumbType = B_BLOCK_THUMB,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_NAVIGABLE | B_WILL_DRAW | B_FRAME_EVENTS); uint32 flags = B_NAVIGABLE | B_WILL_DRAW | B_FRAME_EVENTS);
char* UpdateText() const; virtual const char* UpdateText() const;
void ResizeToPreferred(); void ResizeToPreferred();
private: private:
mutable char fStatusLabel[12]; mutable char fStatusLabel[12];
}; };
//! Basic view class with resizing to needed size
class SView : public BView { class SView : public BView {
public: public:
SView(const char* name, float x = 0, float y = 0); SView(BRect frame, const char *name);
virtual void AttachedToWindow();
virtual void GetPreferredSize(float* _width, float* _height);
virtual void ResizeToPreferred();
void AddChild(BView* child, BView* before = NULL);
float GetPreferredWidth()
{ return fPreferredWidth; }
float GetPreferredHeight()
{ return fPreferredHeight; }
void ResizePreferredBy(float width, float height);
private:
float fPreferredWidth;
float fPreferredHeight;
}; };
//! Configuration view for reading settings //! Configuration view for reading settings
class TranslatorReadView : public SView { class TranslatorReadView : public SView {
public: public:
TranslatorReadView(const char* name, jpeg_settings* settings, TranslatorReadView(BRect frame, const char* name, jpeg_settings* settings);
float x = 0, float y = 0);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
@@ -148,11 +134,11 @@ class TranslatorReadView : public SView {
BCheckBox* fShowErrorBox; BCheckBox* fShowErrorBox;
}; };
//! Configuration view for writing settings //! Configuration view for writing settings
class TranslatorWriteView : public SView { class TranslatorWriteView : public SView {
public: public:
TranslatorWriteView(const char* name, jpeg_settings* settings, TranslatorWriteView(BRect frame, const char* name, jpeg_settings* settings);
float x = 0, float y = 0);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
@@ -169,27 +155,20 @@ class TranslatorWriteView : public SView {
class TranslatorAboutView : public SView { class TranslatorAboutView : public SView {
public: public:
TranslatorAboutView(const char* name, float x = 0, float y = 0); TranslatorAboutView(BRect frame, const char* name);
}; };
//! Configuration view //! Configuration view
class TranslatorView : public SView { class TranslatorView : public BTabView {
public: public:
TranslatorView(const char *name); TranslatorView(BRect frame, const char *name);
virtual ~TranslatorView(); virtual ~TranslatorView();
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void Draw(BRect updateRect); virtual void Select(int32 index);
virtual void MouseDown(BPoint where);
private: private:
BRect _TabFrame(int32 index) const;
jpeg_settings fSettings; jpeg_settings fSettings;
BList fTabs;
int32 fTabWidth;
int32 fTabHeight;
int32 fActiveChild;
}; };
//! Window used for configuration //! Window used for configuration