Mail: Use BToolBar and vector icons.

Fixes #9519. Partially using the patch there, but most of this
is my own work.
This commit is contained in:
Augustin Cavalier
2015-07-22 17:38:00 -04:00
parent 58ee42e9df
commit 990a73c29a
21 changed files with 318 additions and 2326 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-382
View File
@@ -1,382 +0,0 @@
/*
Open Tracker License
Terms and Conditions
Copyright (c) 1991-2001, Be Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice applies to all licensees
and shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated.
BeMail(TM), Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#include "BmapButton.h"
#include <Application.h>
#include <Autolock.h>
#include <Bitmap.h>
#include <ColorTools.h>
#include <Resources.h>
#include <stdlib.h>
BList BmapButton::fBitmapCache;
BLocker BmapButton::fBmCacheLock;
struct BitmapItem {
BBitmap* bm;
int32 id;
int32 openCount;
};
BmapButton::BmapButton(BRect frame,
const char* name,
const char* label,
int32 enabledID,
int32 disabledID,
int32 rollID,
int32 pressedID,
bool showLabel,
BMessage* message,
uint32 resizeMask,
uint32 flags) :
BControl(frame, name, label, message, resizeMask, flags),
fPressing(false),
fIsInBounds(false),
fShowLabel(showLabel),
fActive(true),
fIButtons(0)
{
fEnabledBM = RetrieveBitmap(enabledID);
fDisabledBM = RetrieveBitmap(disabledID);
fRollBM = RetrieveBitmap(rollID);
fPressedBM = RetrieveBitmap(pressedID);
}
BmapButton::~BmapButton(void)
{
ReleaseBitmap(fEnabledBM);
ReleaseBitmap(fDisabledBM);
ReleaseBitmap(fRollBM);
ReleaseBitmap(fPressedBM);
}
const BBitmap*
BmapButton::RetrieveBitmap(int32 id)
{
// Lock access to the list
BAutolock lock(fBmCacheLock);
if (!lock.IsLocked())
return NULL;
// Check for the bitmap in the cache first
BitmapItem* item;
for (int32 i=0; (item=(BitmapItem*)fBitmapCache.ItemAt(i)) != NULL; i++) {
if (item->id == id) {
item->openCount++;
return item->bm;
}
}
// If it's not in the cache, try to load it
BResources* res = BApplication::AppResources();
if (!res) return NULL;
size_t size = 0;
const void* data = res->LoadResource('BMAP', id, &size);
if (!data) return NULL;
BMemoryIO mio(data, size);
BMessage arch;
if (arch.Unflatten(&mio) != B_OK) return NULL;
BArchivable* obj = instantiate_object(&arch);
BBitmap* bm = dynamic_cast<BBitmap*>(obj);
if (!bm) {
delete obj;
return NULL;
}
item = (BitmapItem*)malloc(sizeof(BitmapItem));
item->bm = bm;
item->id = id;
item->openCount = 1;
fBitmapCache.AddItem(item);
return bm;
}
status_t
BmapButton::ReleaseBitmap(const BBitmap* bm)
{
BAutolock lock(fBmCacheLock);
if (!lock.IsLocked())
return B_ERROR;
BitmapItem* item;
for (int32 i = 0;; i++)
{
item = static_cast<BitmapItem*>(fBitmapCache.ItemAt(i));
if (item == NULL)
break;
if (item->bm == bm) {
if (--item->openCount <= 0) {
fBitmapCache.RemoveItem(i);
delete item->bm;
free(item);
}
return B_OK;
}
}
return B_ERROR;
}
#define F_SHOW_GEOMETRY 0
void
BmapButton::Draw(BRect updateRect)
{
BRect bounds(Bounds());
float labelHeight, labelWidth;
#if F_SHOW_GEOMETRY
StrokeRect(bounds);
#endif
// Draw Label
if (fShowLabel) {
font_height fheight;
BFont renderFont;
renderFont = *be_plain_font;
renderFont.GetHeight(&fheight);
SetFont(&renderFont);
labelHeight = fheight.leading + fheight.ascent + fheight.descent + 1;
labelWidth = renderFont.StringWidth(Label());
BRect textRect;
textRect.left = (bounds.right - bounds.left - labelWidth + 1) / 2;
textRect.right = textRect.left + labelWidth;
textRect.bottom = bounds.bottom;
textRect.top = textRect.bottom - fheight.descent - fheight.ascent - 1;
// Only draw if it's within the update rect
if (updateRect.Intersects(textRect)) {
float baseLine = textRect.bottom - fheight.descent;
if (IsFocus() && fActive)
SetHighColor(0, 0, 255);
else
SetHighColor(ViewColor());
StrokeLine(BPoint(textRect.left, baseLine),
BPoint(textRect.right, baseLine));
if (IsEnabled())
SetHighColor(0, 0, 0);
else {
const rgb_color black = {0, 0, 0, 255};
SetHighColor(disable_color(black, ViewColor()));
}
MovePenTo(textRect.left, baseLine);
DrawString(Label());
#if F_SHOW_GEOMETRY
FrameRect(textRect);
#endif
}
} else {
labelHeight = 0;
labelWidth = 0;
}
// Draw Bitmap
// Select the bitmap to use
const BBitmap* bm;
if (!IsEnabled())
bm = fDisabledBM;
else if (fPressing) {
if (fIsInBounds)
bm = fPressedBM;
else
bm = fRollBM;
} else {
if (fIsInBounds)
bm = fRollBM;
else
bm = fEnabledBM;
}
// Draw the bitmap
if (bm) {
fBitmapRect = bm->Bounds();
fBitmapRect.OffsetTo(0, 0);
fBitmapRect.OffsetBy((bounds.right - bounds.left - fBitmapRect.right
- fBitmapRect.left) / 2,
(bounds.bottom - bounds.top - labelHeight - fBitmapRect.bottom
- fBitmapRect.top) / 2);
// Update if within update rect
SetDrawingMode(B_OP_OVER);
if (updateRect.Intersects(fBitmapRect)) {
DrawBitmap(bm, fBitmapRect);
#if F_SHOW_GEOMETRY
StrokeRect(fBitmapRect);
#endif
}
SetDrawingMode(B_OP_COPY);
}
}
void
BmapButton::GetPreferredSize(float* width, float* height)
{
BRect prefBounds;
if (fEnabledBM) {
if (fShowLabel) {
float labelHeight, labelWidth;
font_height fheight;
BRect bmBounds(fEnabledBM->Bounds());
BFont renderFont;
renderFont = *be_plain_font;
renderFont.GetHeight(&fheight);
SetFont(&renderFont);
labelHeight = fheight.leading + fheight.ascent + fheight.descent + 1;
labelWidth = renderFont.StringWidth(Label());
prefBounds.left = 0;
prefBounds.top = 0;
prefBounds.right = labelWidth > (bmBounds.right - bmBounds.left)
? labelWidth : (bmBounds.right - bmBounds.left);
prefBounds.bottom = labelHeight + (bmBounds.bottom - bmBounds.top);
} else
prefBounds = fEnabledBM->Bounds();
} else
prefBounds = Bounds();
*width = prefBounds.IntegerWidth();
*height = prefBounds.IntegerHeight();
}
void
BmapButton::MouseMoved(BPoint where, uint32 code, const BMessage* msg)
{
// eliminate unused parameter warnings
(void)where;
(void)msg;
if (IsEnabled() && fActive) {
switch(code) {
case B_ENTERED_VIEW:
fIsInBounds = true;
Invalidate(fBitmapRect);
break;
case B_EXITED_VIEW:
fIsInBounds = false;
Invalidate(fBitmapRect);
break;
}
}
}
void
BmapButton::MouseDown(BPoint point)
{
if (!IsEnabled())
return;
// Save Mouse State
GetMouse(&point, &fButtons);
fWhere = point;
if (fButtons & fIButtons) {
BMessage copy(*Message());
copy.AddPoint("where", ConvertToScreen(fWhere));
copy.AddInt32("buttons", fButtons);
Invoke(&copy);
return;
}
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS | B_SUSPEND_VIEW_FOCUS | B_NO_POINTER_HISTORY);
fPressing = true;
Invalidate(fBitmapRect);
}
void
BmapButton::MouseUp(BPoint where)
{
if (atomic_and(&fPressing, 0)) {
SetMouseEventMask(0, 0);
if (Bounds().Contains(where) && IsEnabled()) {
BMessage copy(*Message());
copy.AddPoint("where", ConvertToScreen(fWhere));
copy.AddInt32("buttons", fButtons);
Invoke(&copy);
}
Invalidate(fBitmapRect);
}
}
void
BmapButton::ShowLabel(bool show)
{
fShowLabel = show;
}
void
BmapButton::WindowActivated(bool active)
{
fActive = active;
if (IsFocus() || fIsInBounds) {
fIsInBounds = false;
Invalidate();
}
BControl::WindowActivated(active);
}
void
BmapButton::InvokeOnButton(uint32 button)
{
fIButtons = button;
}
-94
View File
@@ -1,94 +0,0 @@
/*
Open Tracker License
Terms and Conditions
Copyright (c) 1991-2001, Be Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice applies to all licensees
and shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated.
BeMail(TM), Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#ifndef _BMAP_BUTTON_H
#define _BMAP_BUTTON_H
#include <Control.h>
#include <List.h>
#include <Locker.h>
#include <View.h>
class BBitmap;
class BResources;
class BmapButton : public BControl {
public:
BmapButton(BRect frame, const char* name,
const char* label, int32 enabledID,
int32 disabledID, int32 rollID, int32 pressedID,
bool showLabel, BMessage* message,
uint32 resizeMask,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
virtual ~BmapButton(void);
// Hooks
virtual void Draw(BRect updateRect);
virtual void GetPreferredSize(float* width, float* height);
virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* msg);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint where);
virtual void WindowActivated(bool active);
void InvokeOnButton(uint32 button);
void ShowLabel(bool show);
protected:
const BBitmap* RetrieveBitmap(int32 id);
status_t ReleaseBitmap(const BBitmap* bm);
const BBitmap* fEnabledBM;
const BBitmap* fDisabledBM;
const BBitmap* fRollBM;
const BBitmap* fPressedBM;
int32 fPressing;
int32 fIsInBounds;
uint32 fButtons;
bool fShowLabel;
bool fActive;
BRect fBitmapRect;
BPoint fWhere;
uint32 fIButtons;
private:
static BList fBitmapCache;
static BLocker fBmCacheLock;
};
#endif // #ifndef _BMAP_BUTTON_H
-237
View File
@@ -1,237 +0,0 @@
/*
Open Tracker License
Terms and Conditions
Copyright (c) 1991-2001, Be Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice applies to all licensees
and shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated.
BeMail(TM), Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#include "ButtonBar.h"
#include <stdlib.h>
#include <math.h>
#include <ControlLook.h>
struct BBDivider {
float where;
float vmargin;
BmapButton* button;
};
static const int32 kDividerBlockSize = 8;
ButtonBar::ButtonBar(BRect frame, const char* name, uint8 enabledOffset,
uint8 disabledOffset, uint8 rollOffset, uint8 pressedOffset,
float Hmargin, float Vmargin, uint32 resizeMask, int32 flags)
: BView(frame, name, resizeMask, flags),
fMaxHeight(0),
fMaxWidth(0),
fNextXOffset(Hmargin),
fHMargin(Hmargin),
fVMargin(Vmargin),
fEnabledOffset(enabledOffset),
fDisabledOffset(disabledOffset),
fRollOffset(rollOffset),
fPressedOffset(pressedOffset),
fDividerArray(NULL),
fDividers(0),
fShowLabels(true)
{
}
ButtonBar::~ButtonBar()
{
free(fDividerArray);
}
BmapButton*
ButtonBar::AddButton(const char *label, int32 baseID, BMessage *msg,
int32 position)
{
BmapButton* button = new BmapButton(BRect(0, 0, 31, 31), label, label,
baseID + fEnabledOffset, baseID + fDisabledOffset, baseID + fRollOffset,
baseID + fPressedOffset, fShowLabels, msg,
B_FOLLOW_LEFT | B_FOLLOW_TOP);
if (position > 0)
fButtonList.AddItem(button, position);
else
fButtonList.AddItem(button);
AddChild(button);
return button;
}
bool
ButtonBar::RemoveButton(BmapButton *button)
{
if (fButtonList.RemoveItem(button)) {
RemoveChild(button);
delete button;
return true;
}
return false;
}
int32
ButtonBar::IndexOf(BmapButton *button)
{
return fButtonList.IndexOf(button);
}
void
ButtonBar::Arrange(bool fixedWidth)
{
// Reset Positioning Info
fNextXOffset = fHMargin;
fMaxHeight = 0;
fMaxWidth = 0;
int32 i;
float width, height;
BmapButton *button;
// Determine Largest button dimensions
for (i = 0; (button = (BmapButton*)fButtonList.ItemAt(i)) != NULL; i++) {
button->GetPreferredSize(&width, &height);
if (height > fMaxHeight)
fMaxHeight = height;
if (width > fMaxWidth)
fMaxWidth = width;
}
// Arrange buttons
for (i = 0; (button = (BmapButton *)fButtonList.ItemAt(i)) != NULL; i++) {
button->MoveTo(fNextXOffset, fVMargin);
if (fixedWidth) {
button->ResizeTo(fMaxWidth, fMaxHeight);
fNextXOffset += fMaxWidth + fHMargin;
} else {
button->GetPreferredSize(&width, &height);
button->ResizeTo(width, fMaxHeight);
fNextXOffset += width + fHMargin;
}
}
// Move dividers to match
for (i = 0; i < fDividers; i++) {
if (fDividerArray[i].button) {
fDividerArray[i].where = fDividerArray[i].button->Frame().right
+ floor(fHMargin/2);
} else
fDividerArray[i].where = floor(fHMargin / 2);
}
}
void
ButtonBar::GetPreferredSize(float* width, float* height)
{
*width = fNextXOffset + fHMargin;
*height = fMaxHeight + (2 * fVMargin) + 3;
}
void
ButtonBar::AttachedToWindow()
{
if (Parent())
SetViewColor(Parent()->ViewColor());
}
void
ButtonBar::Draw(BRect updateRect)
{
rgb_color high = tint_color(ViewColor(), 1.1);
rgb_color low = tint_color(ViewColor(), 0.8);
BRect bounds = Bounds();
BeginLineArray(fDividers * 2);
for (int32 i = 0; i < fDividers; i++) {
float where = fDividerArray[i].where;
float vmargin = fDividerArray[i].vmargin;
AddLine(BPoint(where, fVMargin + vmargin),
BPoint(where, bounds.bottom - fVMargin - vmargin), high);
AddLine(BPoint(where + 1, fVMargin + vmargin),
BPoint(where + 1, bounds.bottom - fVMargin - vmargin), low);
}
EndLineArray();
be_control_look->DrawBorder(this, bounds, updateRect, ViewColor(),
B_FANCY_BORDER, 0, BControlLook::B_BOTTOM_BORDER);
}
void
ButtonBar::AddDivider(float vmargin)
{
// Do we need to allocate memory?
if (fDividers == 0) {
fDividerArray = (BBDivider*)malloc(sizeof(BBDivider)
* kDividerBlockSize);
}
if ((fDividers % kDividerBlockSize) == 0) {
fDividerArray = (BBDivider*)realloc(fDividerArray,
sizeof(BBDivider) * kDividerBlockSize
* ((fDividers/kDividerBlockSize) + 1));
}
// Cache the location and the button which proceeds it
// The button is stored because we may later wish to change the layout
fDividerArray[fDividers].vmargin = vmargin;
fDividerArray[fDividers].where = fNextXOffset + floorf(fHMargin / 2);
fDividerArray[fDividers].button = (BmapButton*)fButtonList.ItemAt(
fButtonList.CountItems() - 1);
fDividers++;
}
void
ButtonBar::ShowLabels(bool show)
{
BmapButton* button;
// Set show label flags on buttons
for (int32 i = 0; (button = (BmapButton*)fButtonList.ItemAt(i)) != NULL;
i++) {
button->ShowLabel(show);
}
fShowLabels = show;
}
-83
View File
@@ -1,83 +0,0 @@
/*
Open Tracker License
Terms and Conditions
Copyright (c) 1991-2001, Be Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice applies to all licensees
and shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated.
BeMail(TM), Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#ifndef _BUTTON_BAR_H
#define _BUTTON_BAR_H
#include <Box.h>
#include "BmapButton.h"
struct BBDivider;
class ButtonBar : public BView {
public:
ButtonBar(BRect frame, const char *name, uint8 enabledOffset,
uint8 disabledOffset, uint8 rollOffset, uint8 pressedOffset,
float Hmargin, float Vmargin,
uint32 resizeMask = B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
int32 flags = B_NAVIGABLE_JUMP | B_FRAME_EVENTS | B_WILL_DRAW);
virtual ~ButtonBar( void );
// Hooks
virtual void GetPreferredSize(float *width, float *height);
virtual void AttachedToWindow(void);
virtual void Draw(BRect updateRect);
void ShowLabels(bool show);
void Arrange(bool fixedWidth = true);
BmapButton *AddButton(const char *label, int32 baseID, BMessage *msg,
int32 position = -1);
bool RemoveButton(BmapButton *button);
int32 IndexOf(BmapButton *button);
void AddDivider(float vmargin);
protected:
float fMaxHeight;
float fMaxWidth;
float fNextXOffset;
float fHMargin;
float fVMargin;
uint8 fEnabledOffset;
uint8 fDisabledOffset;
uint8 fRollOffset;
uint8 fPressedOffset;
BList fButtonList;
BBDivider *fDividerArray;
int32 fDividers;
bool fShowLabels;
};
#endif // #ifndef _BUTTON_BAR_H
+2 -5
View File
@@ -13,8 +13,6 @@ UsePrivateHeaders storage ;
AddResources Mail : pictures.rdef ; AddResources Mail : pictures.rdef ;
Application Mail : Application Mail :
BmapButton.cpp
ButtonBar.cpp
ComboBox.cpp ComboBox.cpp
Content.cpp Content.cpp
Enclosures.cpp Enclosures.cpp
@@ -33,8 +31,8 @@ Application Mail :
WIndex.cpp WIndex.cpp
Words.cpp Words.cpp
KUndoBuffer.cpp KUndoBuffer.cpp
: be tracker [ TargetLibstdc++ ] [ TargetLibsupc++ ] localestub : libshared.a be tracker [ TargetLibstdc++ ] [ TargetLibsupc++ ]
libmail.so libtextencoding.so localestub libmail.so libtextencoding.so
: Mail.rdef : Mail.rdef
; ;
@@ -52,4 +50,3 @@ DoCatalogs Mail :
Prefs.cpp Prefs.cpp
Signature.cpp Signature.cpp
; ;
+9 -10
View File
@@ -71,7 +71,6 @@ of their respective holders. All rights reserved.
using namespace BPrivate ; using namespace BPrivate ;
#include "ButtonBar.h"
#include "Content.h" #include "Content.h"
#include "Enclosures.h" #include "Enclosures.h"
#include "FieldMsg.h" #include "FieldMsg.h"
@@ -112,7 +111,7 @@ TMailApp::TMailApp()
fWrapMode(true), fWrapMode(true),
fAttachAttributes(true), fAttachAttributes(true),
fColoredQuotes(true), fColoredQuotes(true),
fShowButtonBar(true), fShowToolBar(true),
fWarnAboutUnencodableCharacters(true), fWarnAboutUnencodableCharacters(true),
fStartWithSpellCheckOn(false), fStartWithSpellCheckOn(false),
fShowSpamGUI(true), fShowSpamGUI(true),
@@ -331,7 +330,7 @@ TMailApp::MessageReceived(BMessage *msg)
&fReplyPreamble, &fSignature, &fMailCharacterSet, &fReplyPreamble, &fSignature, &fMailCharacterSet,
&fWarnAboutUnencodableCharacters, &fWarnAboutUnencodableCharacters,
&fStartWithSpellCheckOn, &fAutoMarkRead, &fStartWithSpellCheckOn, &fAutoMarkRead,
&fShowButtonBar); &fShowToolBar);
fPrefsWindow->Show(); fPrefsWindow->Show();
} }
break; break;
@@ -537,7 +536,7 @@ TMailApp::ReadyToRun()
indexPath.Append(leafName.String()); indexPath.Append(leafName.String());
gExactWords[gDictCount] = new Words(dataPath.Path(), indexPath.Path(), false); gExactWords[gDictCount] = new Words(dataPath.Path(), indexPath.Path(), false);
gDictCount++; gDictCount++;
} }
// Create user dictionary if it does not exist // Create user dictionary if it does not exist
dataPath = userDictionaryDir; dataPath = userDictionaryDir;
@@ -860,8 +859,8 @@ TMailApp::LoadOldSettings()
FindWindow::SetFindString(findString); FindWindow::SetFindString(findString);
free(findString); free(findString);
} }
if (file.Read(&fShowButtonBar, sizeof(uint8)) < (ssize_t)sizeof(uint8)) if (file.Read(&fShowToolBar, sizeof(uint8)) < (ssize_t)sizeof(uint8))
fShowButtonBar = true; fShowToolBar = true;
if (file.Read(&fUseAccountFrom, sizeof(int32)) < (ssize_t)sizeof(int32) if (file.Read(&fUseAccountFrom, sizeof(int32)) < (ssize_t)sizeof(int32)
|| fUseAccountFrom < ACCOUNT_USE_DEFAULT || fUseAccountFrom < ACCOUNT_USE_DEFAULT
|| fUseAccountFrom > ACCOUNT_FROM_MAIL) || fUseAccountFrom > ACCOUNT_FROM_MAIL)
@@ -927,7 +926,7 @@ TMailApp::SaveSettings()
settings.AddString("SignatureText", fSignature); settings.AddString("SignatureText", fSignature);
settings.AddInt32("CharacterSet", fMailCharacterSet); settings.AddInt32("CharacterSet", fMailCharacterSet);
settings.AddString("FindString", FindWindow::GetFindString()); settings.AddString("FindString", FindWindow::GetFindString());
settings.AddInt8("ShowButtonBar", fShowButtonBar); settings.AddInt8("ShowButtonBar", fShowToolBar);
settings.AddInt32("UseAccountFrom", fUseAccountFrom); settings.AddInt32("UseAccountFrom", fUseAccountFrom);
settings.AddBool("ColoredQuotes", fColoredQuotes); settings.AddBool("ColoredQuotes", fColoredQuotes);
settings.AddString("ReplyPreamble", fReplyPreamble); settings.AddString("ReplyPreamble", fReplyPreamble);
@@ -1033,7 +1032,7 @@ TMailApp::LoadSettings()
int8 int8Value; int8 int8Value;
if (settings.FindInt8("ShowButtonBar", &int8Value) == B_OK) if (settings.FindInt8("ShowButtonBar", &int8Value) == B_OK)
fShowButtonBar = int8Value; fShowToolBar = int8Value;
if (settings.FindInt32("UseAccountFrom", &int32Value) == B_OK) if (settings.FindInt32("UseAccountFrom", &int32Value) == B_OK)
fUseAccountFrom = int32Value; fUseAccountFrom = int32Value;
@@ -1199,10 +1198,10 @@ TMailApp::ColoredQuotes()
uint8 uint8
TMailApp::ShowButtonBar() TMailApp::ShowToolBar()
{ {
BAutolock _(this); BAutolock _(this);
return fShowButtonBar; return fShowToolBar;
} }
+3 -3
View File
@@ -79,7 +79,7 @@ class TMailApp : public BApplication {
bool WrapMode(); bool WrapMode();
bool AttachAttributes(); bool AttachAttributes();
bool ColoredQuotes(); bool ColoredQuotes();
uint8 ShowButtonBar(); uint8 ShowToolBar();
bool WarnAboutUnencodableCharacters(); bool WarnAboutUnencodableCharacters();
bool StartWithSpellCheckOn(); bool StartWithSpellCheckOn();
void SetDefaultAccount(int32 account); void SetDefaultAccount(int32 account);
@@ -103,7 +103,7 @@ class TMailApp : public BApplication {
int32 fWindowCount; int32 fWindowCount;
TPrefsWindow* fPrefsWindow; TPrefsWindow* fPrefsWindow;
TSignatureWindow* fSigWindow; TSignatureWindow* fSigWindow;
BRect fMailWindowFrame; BRect fMailWindowFrame;
BRect fLastMailWindowFrame; BRect fLastMailWindowFrame;
BRect fSignatureWindowFrame; BRect fSignatureWindowFrame;
@@ -120,7 +120,7 @@ class TMailApp : public BApplication {
bool fWrapMode; bool fWrapMode;
bool fAttachAttributes; bool fAttachAttributes;
bool fColoredQuotes; bool fColoredQuotes;
uint8 fShowButtonBar; uint8 fShowToolBar;
bool fWarnAboutUnencodableCharacters; bool fWarnAboutUnencodableCharacters;
bool fStartWithSpellCheckOn; bool fStartWithSpellCheckOn;
bool fShowSpamGUI; bool fShowSpamGUI;
+133 -114
View File
@@ -48,6 +48,7 @@ of their respective holders. All rights reserved.
#include <Debug.h> #include <Debug.h>
#include <E-mail.h> #include <E-mail.h>
#include <File.h> #include <File.h>
#include <IconUtils.h>
#include <InterfaceKit.h> #include <InterfaceKit.h>
#include <Locale.h> #include <Locale.h>
#include <Node.h> #include <Node.h>
@@ -69,7 +70,6 @@ of their respective holders. All rights reserved.
#include <CharacterSetRoster.h> #include <CharacterSetRoster.h>
#include "ButtonBar.h"
#include "Content.h" #include "Content.h"
#include "Enclosures.h" #include "Enclosures.h"
#include "FieldMsg.h" #include "FieldMsg.h"
@@ -158,10 +158,6 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
fFieldState(0), fFieldState(0),
fPanel(NULL), fPanel(NULL),
fLeaveStatusMenu(NULL), fLeaveStatusMenu(NULL),
fSendButton(NULL),
fSaveButton(NULL),
fPrintButton(NULL),
fSigButton(NULL),
fZoom(rect), fZoom(rect),
fEnclosuresView(NULL), fEnclosuresView(NULL),
fPrevTrackerPositionSaved(false), fPrevTrackerPositionSaved(false),
@@ -173,8 +169,6 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
fDraft(false), fDraft(false),
fChanged(false), fChanged(false),
fOriginatingWindow(NULL), fOriginatingWindow(NULL),
fReadButton(NULL),
fNextButton(NULL),
fDownloading(false) fDownloading(false)
{ {
@@ -473,19 +467,17 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
// Button Bar // Button Bar
BuildButtonBar(); BuildToolBar();
float bbwidth = 0, bbheight = 0; float bbheight = 0;
bool showButtonBar = fApp->ShowButtonBar(); bool showToolBar = fApp->ShowToolBar();
if (showButtonBar) { if (showToolBar) {
fButtonBar->ShowLabels(showButtonBar); bbheight = fToolBar->MinSize().height;
fButtonBar->Arrange(true); fToolBar->ResizeTo(Bounds().right, bbheight);
fButtonBar->GetPreferredSize(&bbwidth, &bbheight); fToolBar->MoveTo(0, height);
fButtonBar->ResizeTo(Bounds().right, bbheight); fToolBar->Show();
fButtonBar->MoveTo(0, height);
fButtonBar->Show();
} }
r.top = r.bottom = height + bbheight + 1; r.top = r.bottom = height + bbheight + 1;
@@ -562,91 +554,131 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
} }
void BObjectList<TMailWindow::BitmapItem> TMailWindow::fBitmapCache;
TMailWindow::BuildButtonBar() BLocker TMailWindow::fBitmapCacheLock;
{
ButtonBar *bbar;
bbar = new ButtonBar(BRect(0, 0, 100, 100), "ButtonBar", 2, 3, 0, 1, 10, BBitmap*
2); TMailWindow::_RetrieveVectorIcon(int32 id)
bbar->AddButton(B_TRANSLATE("New"), 28, new BMessage(M_NEW)); {
bbar->AddDivider(5); // Lock access to the list
fButtonBar = bbar; BAutolock lock(fBitmapCacheLock);
if (!lock.IsLocked())
return NULL;
// Check for the bitmap in the cache first
BitmapItem* item;
for (int32 i = 0; (item = fBitmapCache.ItemAt(i)) != NULL; i++) {
if (item->id == id)
return item->bm;
}
// If it's not in the cache, try to load it
BResources* res = BApplication::AppResources();
if (res == NULL)
return NULL;
size_t size;
const void* data = res->LoadResource(B_VECTOR_ICON_TYPE, id, &size);
if (!data)
return NULL;
BBitmap* bitmap = new BBitmap(BRect(0, 0, 21, 21), B_RGBA32);
status_t status = BIconUtils::GetVectorIcon((uint8*)data, size, bitmap);
if (status == B_OK) {
item = (BitmapItem*)malloc(sizeof(BitmapItem));
item->bm = bitmap;
item->id = id;
fBitmapCache.AddItem(item);
return bitmap;
}
return NULL;
}
void
TMailWindow::BuildToolBar()
{
fToolBar = new BToolBar(BRect(0, 0, 100, 50));
fToolBar->AddAction(M_NEW, this, _RetrieveVectorIcon(11), NULL,
B_TRANSLATE("New"));
fToolBar->AddSeparator();
if (fResending) { if (fResending) {
fSendButton = bbar->AddButton(B_TRANSLATE("Send"), 8, fToolBar->AddAction(M_SEND_NOW, this, _RetrieveVectorIcon(1), NULL,
new BMessage(M_SEND_NOW)); B_TRANSLATE("Send"));
bbar->AddDivider(5);
} else if (!fIncoming) { } else if (!fIncoming) {
fSendButton = bbar->AddButton(B_TRANSLATE("Send"), 8, fToolBar->AddAction(M_SEND_NOW, this, _RetrieveVectorIcon(1), NULL,
new BMessage(M_SEND_NOW)); B_TRANSLATE("Send"));
fSendButton->SetEnabled(false); fToolBar->SetActionEnabled(M_SEND_NOW, false);
fSigButton = bbar->AddButton(B_TRANSLATE("Signature"), 4, fToolBar->AddAction(M_SIG_MENU, this, _RetrieveVectorIcon(2), NULL,
new BMessage(M_SIG_MENU)); B_TRANSLATE("Signature"));
fSigButton->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON); fToolBar->AddAction(M_SAVE_AS_DRAFT, this, _RetrieveVectorIcon(3), NULL,
fSaveButton = bbar->AddButton(B_TRANSLATE("Save"), 44, B_TRANSLATE("Save"));
new BMessage(M_SAVE_AS_DRAFT)); fToolBar->SetActionEnabled(M_SAVE_AS_DRAFT, false);
fSaveButton->SetEnabled(false); fToolBar->AddAction(M_PRINT, this, _RetrieveVectorIcon(5), NULL,
fPrintButton = bbar->AddButton(B_TRANSLATE("Print"), 16, B_TRANSLATE("Print"));
new BMessage(M_PRINT)); fToolBar->SetActionEnabled(M_PRINT, false);
fPrintButton->SetEnabled(false); fToolBar->AddAction(M_DELETE, this, _RetrieveVectorIcon(4), NULL,
bbar->AddButton(B_TRANSLATE("Trash"), 0, new BMessage(M_DELETE)); B_TRANSLATE("Trash"));
bbar->AddDivider(5);
} else { } else {
BmapButton *button = bbar->AddButton(B_TRANSLATE("Reply"), 12, fToolBar->AddAction(M_REPLY, this, _RetrieveVectorIcon(8), NULL,
new BMessage(M_REPLY)); B_TRANSLATE("Reply"));
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON); fToolBar->AddAction(M_FORWARD, this, _RetrieveVectorIcon(9), NULL,
button = bbar->AddButton(B_TRANSLATE("Forward"), 40, B_TRANSLATE("Forward"));
new BMessage(M_FORWARD)); fToolBar->AddAction(M_PRINT, this, _RetrieveVectorIcon(5), NULL,
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON); B_TRANSLATE("Print"));
fPrintButton = bbar->AddButton(B_TRANSLATE("Print"), 16, fToolBar->AddAction(M_DELETE_NEXT, this, _RetrieveVectorIcon(4), NULL,
new BMessage(M_PRINT)); B_TRANSLATE("Trash"));
bbar->AddButton(B_TRANSLATE("Trash"), 0, new BMessage(M_DELETE_NEXT)); if (fApp->ShowSpamGUI())
if (fApp->ShowSpamGUI()) { fToolBar->AddAction(M_SPAM_BUTTON, this, _RetrieveVectorIcon(10), NULL,
button = bbar->AddButton("Spam", 48, new BMessage(M_SPAM_BUTTON)); B_TRANSLATE("Spam"));
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON); fToolBar->AddSeparator();
} fToolBar->AddAction(M_NEXTMSG, this, _RetrieveVectorIcon(6), NULL,
bbar->AddDivider(5); B_TRANSLATE("Next"));
fNextButton = bbar->AddButton(B_TRANSLATE("Next"), 24, fToolBar->AddAction(M_UNREAD, this, _RetrieveVectorIcon(12), NULL,
new BMessage(M_NEXTMSG)); B_TRANSLATE("Unread"));
bbar->AddButton(B_TRANSLATE("Previous"), 20, new BMessage(M_PREVMSG)); fToolBar->SetActionVisible(M_UNREAD, false);
fToolBar->AddAction(M_READ, this, _RetrieveVectorIcon(13), NULL,
B_TRANSLATE(" Read "));
fToolBar->SetActionVisible(M_READ, false);
fToolBar->AddAction(M_PREVMSG, this, _RetrieveVectorIcon(7), NULL,
B_TRANSLATE("Previous"));
if (!fAutoMarkRead) if (!fAutoMarkRead)
_AddReadButton(); _AddReadButton();
} }
fToolBar->AddGlue();
bbar->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fToolBar->Hide();
bbar->Hide(); AddChild(fToolBar);
AddChild(bbar);
} }
void void
TMailWindow::UpdateViews() TMailWindow::UpdateViews()
{ {
float bbwidth = 0, bbheight = 0; float bbheight = 0;
float nextY = fMenuBar->Frame().bottom + 1; float nextY = fMenuBar->Frame().bottom + 1;
uint8 showButtonBar = fApp->ShowButtonBar(); uint8 showToolBar = fApp->ShowToolBar();
// Show/Hide Button Bar // Show/Hide Button Bar
if (showButtonBar) { if (showToolBar) {
// Create the Button Bar if needed // Create the Button Bar if needed
if (!fButtonBar) if (!fToolBar)
BuildButtonBar(); BuildToolBar();
fButtonBar->ShowLabels(showButtonBar == 1); bbheight = fToolBar->MinSize().height;
fButtonBar->Arrange(true); fToolBar->ResizeTo(Bounds().right, bbheight);
// True for all buttons same size, false to just fit fToolBar->MoveTo(0, nextY);
fButtonBar->GetPreferredSize(&bbwidth, &bbheight);
fButtonBar->ResizeTo(Bounds().right, bbheight);
fButtonBar->MoveTo(0, nextY);
nextY += bbheight + 1; nextY += bbheight + 1;
if (fButtonBar->IsHidden()) if (fToolBar->IsHidden())
fButtonBar->Show(); fToolBar->Show();
else else
fButtonBar->Invalidate(); fToolBar->Invalidate();
} else if (fButtonBar && !fButtonBar->IsHidden()) } else if (fToolBar && !fToolBar->IsHidden())
fButtonBar->Hide(); fToolBar->Hide();
// Arange other views to match // Arange other views to match
fHeaderView->MoveTo(0, nextY); fHeaderView->MoveTo(0, nextY);
@@ -999,13 +1031,10 @@ TMailWindow::MessageReceived(BMessage *msg)
// Has anything changed? // Has anything changed?
if (prevState != fFieldState || !fChanged) { if (prevState != fFieldState || !fChanged) {
// Change Buttons to reflect this // Change Buttons to reflect this
if (fSaveButton) fToolBar->SetActionEnabled(M_SAVE_AS_DRAFT, fFieldState);
fSaveButton->SetEnabled(fFieldState); fToolBar->SetActionEnabled(M_PRINT, fFieldState);
if (fPrintButton) fToolBar->SetActionEnabled(M_SEND_NOW, (fFieldState & FIELD_TO)
fPrintButton->SetEnabled(fFieldState); || (fFieldState & FIELD_BCC));
if (fSendButton)
fSendButton->SetEnabled((fFieldState & FIELD_TO)
|| (fFieldState & FIELD_BCC));
} }
fChanged = true; fChanged = true;
@@ -1442,20 +1471,15 @@ TMailWindow::MessageReceived(BMessage *msg)
menu = new TMenu("Add Signature", INDEX_SIGNATURE, M_SIGNATURE, menu = new TMenu("Add Signature", INDEX_SIGNATURE, M_SIGNATURE,
true); true);
BPoint where; BPoint where;
bool open_anyway = true;
if (msg->FindPoint("where", &where) != B_OK) { if (msg->FindPoint("where", &where) != B_OK) {
BRect bounds; BRect bounds = fToolBar->Bounds();
bounds = fSigButton->Bounds(); where = fToolBar->ConvertToScreen(BPoint(
where = fSigButton->ConvertToScreen(BPoint(
(bounds.right - bounds.left) / 2, (bounds.right - bounds.left) / 2,
(bounds.bottom - bounds.top) / 2)); (bounds.bottom - bounds.top) / 2));
} else if (msg->FindInt32("buttons") == B_SECONDARY_MOUSE_BUTTON) {
open_anyway = false;
} }
if ((item = menu->Go(where, false, open_anyway)) != NULL) { if ((item = menu->Go(where, false, true)) != NULL) {
item->SetTarget(this); item->SetTarget(this);
(dynamic_cast<BInvoker *>(item))->Invoke(); (dynamic_cast<BInvoker *>(item))->Invoke();
} }
@@ -1571,13 +1595,10 @@ TMailWindow::MessageReceived(BMessage *msg)
if (fContentView->fTextView->TextLength()) if (fContentView->fTextView->TextLength())
fFieldState |= FIELD_BODY; fFieldState |= FIELD_BODY;
if (fSaveButton) fToolBar->SetActionEnabled(M_SAVE_AS_DRAFT, false);
fSaveButton->SetEnabled(false); fToolBar->SetActionEnabled(M_PRINT, fFieldState);
if (fPrintButton) fToolBar->SetActionEnabled(M_SEND_NOW, (fFieldState & FIELD_TO)
fPrintButton->SetEnabled(fFieldState); || (fFieldState & FIELD_BCC));
if (fSendButton)
fSendButton->SetEnabled((fFieldState & FIELD_TO)
|| (fFieldState & FIELD_BCC));
break; break;
case M_CHECK_SPELLING: case M_CHECK_SPELLING:
@@ -2660,7 +2681,7 @@ TMailWindow::SaveAsDraft()
fDraft = true; fDraft = true;
fChanged = false; fChanged = false;
fSaveButton->SetEnabled(false); fToolBar->SetActionEnabled(M_SAVE_AS_DRAFT, false);
return B_OK; return B_OK;
} }
@@ -2970,7 +2991,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding)
fContentView->fTextView->LoadMessage(fMail, false, NULL); fContentView->fTextView->LoadMessage(fMail, false, NULL);
if (fApp->ShowButtonBar()) if (fApp->ShowToolBar())
_UpdateReadButton(); _UpdateReadButton();
} }
@@ -3036,8 +3057,9 @@ TMailWindow::_UpdateSizeLimits()
minHeight = height; minHeight = height;
if (fButtonBar) { if (fToolBar != NULL) {
fButtonBar->GetPreferredSize(&minWidth, &height); minWidth = fToolBar->MinSize().width;
height = fToolBar->MinSize().height;
minHeight += height; minHeight += height;
} else { } else {
minWidth = WIND_WIDTH; minWidth = WIND_WIDTH;
@@ -3227,13 +3249,12 @@ TMailWindow::_AddReadButton()
read_flags flag = B_UNREAD; read_flags flag = B_UNREAD;
read_read_attr(node, flag); read_read_attr(node, flag);
int32 buttonIndex = fButtonBar->IndexOf(fNextButton);
if (flag == B_READ) { if (flag == B_READ) {
fReadButton = fButtonBar->AddButton(B_TRANSLATE("Unread"), 28, fToolBar->SetActionVisible(M_UNREAD, true);
new BMessage(M_UNREAD), buttonIndex); fToolBar->SetActionVisible(M_READ, false);
} else { } else {
fReadButton = fButtonBar->AddButton(B_TRANSLATE(" Read "), 24, fToolBar->SetActionVisible(M_UNREAD, false);
new BMessage(M_READ), buttonIndex); fToolBar->SetActionVisible(M_READ, true);
} }
} }
@@ -3241,9 +3262,7 @@ TMailWindow::_AddReadButton()
void void
TMailWindow::_UpdateReadButton() TMailWindow::_UpdateReadButton()
{ {
if (fApp->ShowButtonBar()) { if (fApp->ShowToolBar()) {
fButtonBar->RemoveButton(fReadButton);
fReadButton = NULL;
if (!fAutoMarkRead && fIncoming) if (!fAutoMarkRead && fIncoming)
_AddReadButton(); _AddReadButton();
} }
+20 -19
View File
@@ -37,11 +37,13 @@ All rights reserved.
#include <Entry.h> #include <Entry.h>
#include <Font.h> #include <Font.h>
#include <List.h>
#include <Locker.h> #include <Locker.h>
#include <Messenger.h> #include <Messenger.h>
#include <ObjectList.h>
#include <Window.h> #include <Window.h>
#include <ToolBar.h>
#include <E-mail.h> #include <E-mail.h>
#include <mail_encoding.h> #include <mail_encoding.h>
@@ -61,8 +63,6 @@ class BMailMessage;
class BMenu; class BMenu;
class BMenuBar; class BMenuBar;
class BMenuItem; class BMenuItem;
class BmapButton;
class ButtonBar;
class Words; class Words;
class TMailWindow : public BWindow { class TMailWindow : public BWindow {
@@ -119,7 +119,7 @@ class TMailWindow : public BWindow {
protected: protected:
void SetTitleForMessage(); void SetTitleForMessage();
void AddEnclosure(BMessage* msg); void AddEnclosure(BMessage* msg);
void BuildButtonBar(); void BuildToolBar();
status_t TrainMessageAs(const char* commandWord); status_t TrainMessageAs(const char* commandWord);
private: private:
@@ -128,7 +128,7 @@ class TMailWindow : public BWindow {
status_t _GetQueryPath(BPath* path) const; status_t _GetQueryPath(BPath* path) const;
void _RebuildQueryMenu(bool firstTime = false); void _RebuildQueryMenu(bool firstTime = false);
char* _BuildQueryString(BEntry* entry) const; char* _BuildQueryString(BEntry* entry) const;
void _AddReadButton(); void _AddReadButton();
void _UpdateReadButton(); void _UpdateReadButton();
@@ -165,13 +165,17 @@ class TMailWindow : public BWindow {
BMenu* fQueryMenu; BMenu* fQueryMenu;
BMenu* fLeaveStatusMenu; BMenu* fLeaveStatusMenu;
ButtonBar* fButtonBar; static BBitmap* _RetrieveVectorIcon(int32 id);
BmapButton* fSendButton; struct BitmapItem {
BmapButton* fSaveButton; BBitmap* bm;
BmapButton* fPrintButton; int32 id;
BmapButton* fSigButton; };
static BObjectList<BitmapItem> fBitmapCache;
static BLocker fBitmapCacheLock;
BToolBar* fToolBar;
BRect fZoom; BRect fZoom;
TContentView* fContentView; TContentView* fContentView;
THeaderView* fHeaderView; THeaderView* fHeaderView;
@@ -181,7 +185,7 @@ class TMailWindow : public BWindow {
BMessenger fTrackerMessenger; BMessenger fTrackerMessenger;
// Talks to tracker window that this was launched from. // Talks to tracker window that this was launched from.
BMessenger fMessengerToSpamServer; BMessenger fMessengerToSpamServer;
entry_ref fPrevRef; entry_ref fPrevRef;
entry_ref fNextRef; entry_ref fNextRef;
bool fPrevTrackerPositionSaved : 1; bool fPrevTrackerPositionSaved : 1;
@@ -196,17 +200,14 @@ class TMailWindow : public BWindow {
bool fSent : 1; bool fSent : 1;
bool fDraft : 1; bool fDraft : 1;
bool fChanged : 1; bool fChanged : 1;
static BList sWindowList; static BList sWindowList;
static BLocker sWindowListLock; static BLocker sWindowListLock;
entry_ref fRepliedMail; entry_ref fRepliedMail;
BMessenger* fOriginatingWindow; BMessenger* fOriginatingWindow;
bool fAutoMarkRead : 1;
BmapButton* fReadButton;
BmapButton* fNextButton;
bool fAutoMarkRead : 1;
bool fKeepStatusOnQuit; bool fKeepStatusOnQuit;
bool fDownloading; bool fDownloading;
+151 -1379
View File
File diff suppressed because it is too large Load Diff