Automatic whitespace cleanup.
This commit is contained in:
@@ -78,7 +78,7 @@ App::MessageReceived(BMessage* message)
|
|||||||
Quit();
|
Quit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BApplication::MessageReceived(message);
|
BApplication::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ BitmapButton::DrawBackground(BRect& bounds, BRect updateRect)
|
|||||||
uint32 flags = 0;
|
uint32 flags = 0;
|
||||||
if (fMouseDown)
|
if (fMouseDown)
|
||||||
flags |= BControlLook::B_ACTIVATED;
|
flags |= BControlLook::B_ACTIVATED;
|
||||||
|
|
||||||
be_control_look->DrawButtonFrame(this, bounds, updateRect,
|
be_control_look->DrawButtonFrame(this, bounds, updateRect,
|
||||||
color, color, flags);
|
color, color, flags);
|
||||||
be_control_look->DrawButtonBackground(this, bounds, updateRect,
|
be_control_look->DrawButtonBackground(this, bounds, updateRect,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
const BMessage* dragMessage);
|
const BMessage* dragMessage);
|
||||||
virtual void MouseDown(BPoint where);
|
virtual void MouseDown(BPoint where);
|
||||||
virtual void MouseUp(BPoint where);
|
virtual void MouseUp(BPoint where);
|
||||||
|
|
||||||
virtual BSize MinSize();
|
virtual BSize MinSize();
|
||||||
virtual BSize PreferredSize();
|
virtual BSize PreferredSize();
|
||||||
virtual BSize MaxSize();
|
virtual BSize MaxSize();
|
||||||
|
|||||||
@@ -46,26 +46,26 @@ BitmapView::Draw(BRect updateRect)
|
|||||||
{
|
{
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
DrawBackground(bounds, updateRect);
|
DrawBackground(bounds, updateRect);
|
||||||
|
|
||||||
if (fBitmap == NULL)
|
if (fBitmap == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BRect bitmapBounds = fBitmap->Bounds();
|
BRect bitmapBounds = fBitmap->Bounds();
|
||||||
if (bitmapBounds.Width() <= 0.0f || bitmapBounds.Height() <= 0.0f)
|
if (bitmapBounds.Width() <= 0.0f || bitmapBounds.Height() <= 0.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
|
||||||
if (fScaleBitmap) {
|
if (fScaleBitmap) {
|
||||||
float hScale = bounds.Width() / bitmapBounds.Width();
|
float hScale = bounds.Width() / bitmapBounds.Width();
|
||||||
float vScale = bounds.Height() / bitmapBounds.Height();
|
float vScale = bounds.Height() / bitmapBounds.Height();
|
||||||
|
|
||||||
scale = std::min(hScale, vScale);
|
scale = std::min(hScale, vScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
float width = bitmapBounds.Width() * scale;
|
float width = bitmapBounds.Width() * scale;
|
||||||
float height = bitmapBounds.Height() * scale;
|
float height = bitmapBounds.Height() * scale;
|
||||||
|
|
||||||
switch (LayoutAlignment().horizontal) {
|
switch (LayoutAlignment().horizontal) {
|
||||||
case B_ALIGN_LEFT:
|
case B_ALIGN_LEFT:
|
||||||
break;
|
break;
|
||||||
@@ -90,7 +90,7 @@ BitmapView::Draw(BRect updateRect)
|
|||||||
+ (bounds.Height() - height) / 2.0f);
|
+ (bounds.Height() - height) / 2.0f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds.right = ceilf(bounds.left + width);
|
bounds.right = ceilf(bounds.left + width);
|
||||||
bounds.bottom = ceilf(bounds.top + height);
|
bounds.bottom = ceilf(bounds.top + height);
|
||||||
|
|
||||||
@@ -103,13 +103,13 @@ BSize
|
|||||||
BitmapView::MinSize()
|
BitmapView::MinSize()
|
||||||
{
|
{
|
||||||
BSize size(0.0f, 0.0f);
|
BSize size(0.0f, 0.0f);
|
||||||
|
|
||||||
if (fBitmap != NULL) {
|
if (fBitmap != NULL) {
|
||||||
BRect bounds = fBitmap->Bounds();
|
BRect bounds = fBitmap->Bounds();
|
||||||
size.width = bounds.Width();
|
size.width = bounds.Width();
|
||||||
size.height = bounds.Height();
|
size.height = bounds.Height();
|
||||||
}
|
}
|
||||||
|
|
||||||
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
|
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,11 +139,11 @@ BitmapView::SetBitmap(const BBitmap* bitmap)
|
|||||||
BSize size = MinSize();
|
BSize size = MinSize();
|
||||||
|
|
||||||
fBitmap = bitmap;
|
fBitmap = bitmap;
|
||||||
|
|
||||||
BSize newSize = MinSize();
|
BSize newSize = MinSize();
|
||||||
if (size != newSize)
|
if (size != newSize)
|
||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,16 +12,16 @@
|
|||||||
class BitmapView : public BView {
|
class BitmapView : public BView {
|
||||||
public:
|
public:
|
||||||
BitmapView(const char* name);
|
BitmapView(const char* name);
|
||||||
|
|
||||||
virtual ~BitmapView();
|
virtual ~BitmapView();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
|
|
||||||
virtual BSize MinSize();
|
virtual BSize MinSize();
|
||||||
virtual BSize PreferredSize();
|
virtual BSize PreferredSize();
|
||||||
virtual BSize MaxSize();
|
virtual BSize MaxSize();
|
||||||
|
|
||||||
void SetBitmap(const BBitmap* bitmap);
|
void SetBitmap(const BBitmap* bitmap);
|
||||||
void SetScaleBitmap(bool scaleBitmap);
|
void SetScaleBitmap(bool scaleBitmap);
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ FilterView::FilterView(const Model& model)
|
|||||||
B_TRANSLATE("Search terms:"), "", NULL);
|
B_TRANSLATE("Search terms:"), "", NULL);
|
||||||
fSearchTermsText->SetModificationMessage(
|
fSearchTermsText->SetModificationMessage(
|
||||||
new BMessage(MSG_SEARCH_TERMS_MODIFIED));
|
new BMessage(MSG_SEARCH_TERMS_MODIFIED));
|
||||||
|
|
||||||
BSize minSearchSize = fSearchTermsText->MinSize();
|
BSize minSearchSize = fSearchTermsText->MinSize();
|
||||||
float minSearchWidth
|
float minSearchWidth
|
||||||
= be_plain_font->StringWidth(fSearchTermsText->Label())
|
= be_plain_font->StringWidth(fSearchTermsText->Label())
|
||||||
@@ -91,14 +91,14 @@ FilterView::FilterView(const Model& model)
|
|||||||
fSearchTermsText->SetExplicitMinSize(minSearchSize);
|
fSearchTermsText->SetExplicitMinSize(minSearchSize);
|
||||||
float maxSearchWidth = minSearchWidth * 2;
|
float maxSearchWidth = minSearchWidth * 2;
|
||||||
fSearchTermsText->SetExplicitMaxSize(BSize(maxSearchWidth, B_SIZE_UNSET));
|
fSearchTermsText->SetExplicitMaxSize(BSize(maxSearchWidth, B_SIZE_UNSET));
|
||||||
|
|
||||||
// Build layout
|
// Build layout
|
||||||
BLayoutBuilder::Group<>(this)
|
BLayoutBuilder::Group<>(this)
|
||||||
.Add(fShowField, 0.0f)
|
.Add(fShowField, 0.0f)
|
||||||
.Add(fRepositoryField, 0.0f)
|
.Add(fRepositoryField, 0.0f)
|
||||||
.AddGlue(0.5f)
|
.AddGlue(0.5f)
|
||||||
.Add(fSearchTermsText, 1.0f)
|
.Add(fSearchTermsText, 1.0f)
|
||||||
|
|
||||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ FilterView::MessageReceived(BMessage* message)
|
|||||||
Window()->PostMessage(&searchTerms);
|
Window()->PostMessage(&searchTerms);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BGroupView::MessageReceived(message);
|
BGroupView::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public:
|
|||||||
if (fCount > 0)
|
if (fCount > 0)
|
||||||
_Resize(fCount - 1);
|
_Resize(fCount - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Remove(int32 index)
|
inline void Remove(int32 index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= (int32)fCount)
|
if (index < 0 || index >= (int32)fCount)
|
||||||
@@ -163,21 +163,21 @@ public:
|
|||||||
memcpy(fItems + index, fItems + nextIndex,
|
memcpy(fItems + index, fItems + nextIndex,
|
||||||
(fCount - nextIndex) * sizeof(ItemType));
|
(fCount - nextIndex) * sizeof(ItemType));
|
||||||
}
|
}
|
||||||
|
|
||||||
fCount--;
|
fCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Remove(const ItemType& item)
|
inline void Remove(const ItemType& item)
|
||||||
{
|
{
|
||||||
Remove(IndexOf(item));
|
Remove(IndexOf(item));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Replace(int32 index, const ItemType& copyFrom)
|
inline bool Replace(int32 index, const ItemType& copyFrom)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= (int32)fCount)
|
if (index < 0 || index >= (int32)fCount)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ItemType* item = fItems + index;
|
ItemType* item = fItems + index;
|
||||||
// Initialize the new object from the original.
|
// Initialize the new object from the original.
|
||||||
if (!PlainOldData) {
|
if (!PlainOldData) {
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ MainWindow::MainWindow(BRect frame)
|
|||||||
|
|
||||||
BMenuBar* menuBar = new BMenuBar(B_TRANSLATE("Main Menu"));
|
BMenuBar* menuBar = new BMenuBar(B_TRANSLATE("Main Menu"));
|
||||||
_BuildMenu(menuBar);
|
_BuildMenu(menuBar);
|
||||||
|
|
||||||
fFilterView = new FilterView(fModel);
|
fFilterView = new FilterView(fModel);
|
||||||
fPackageListView = new PackageListView(fModel.Lock());
|
fPackageListView = new PackageListView(fModel.Lock());
|
||||||
fPackageInfoView = new PackageInfoView(fModel.Lock(), &fPackageManager);
|
fPackageInfoView = new PackageInfoView(fModel.Lock(), &fPackageManager);
|
||||||
|
|
||||||
fSplitView = new BSplitView(B_VERTICAL, 5.0f);
|
fSplitView = new BSplitView(B_VERTICAL, 5.0f);
|
||||||
|
|
||||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f)
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f)
|
||||||
.Add(menuBar)
|
.Add(menuBar)
|
||||||
.Add(fFilterView)
|
.Add(fFilterView)
|
||||||
@@ -77,7 +77,7 @@ MainWindow::QuitRequested()
|
|||||||
BMessage message(MSG_MAIN_WINDOW_CLOSED);
|
BMessage message(MSG_MAIN_WINDOW_CLOSED);
|
||||||
message.AddRect("window frame", Frame());
|
message.AddRect("window frame", Frame());
|
||||||
be_app->PostMessage(&message);
|
be_app->PostMessage(&message);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MSG_CATEGORY_SELECTED:
|
case MSG_CATEGORY_SELECTED:
|
||||||
{
|
{
|
||||||
BString name;
|
BString name;
|
||||||
@@ -119,7 +119,7 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
_AdoptModel();
|
_AdoptModel();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MSG_DEPOT_SELECTED:
|
case MSG_DEPOT_SELECTED:
|
||||||
{
|
{
|
||||||
BString name;
|
BString name;
|
||||||
@@ -129,7 +129,7 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
_AdoptModel();
|
_AdoptModel();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MSG_SEARCH_TERMS_MODIFIED:
|
case MSG_SEARCH_TERMS_MODIFIED:
|
||||||
{
|
{
|
||||||
// TODO: Do this with a delay!
|
// TODO: Do this with a delay!
|
||||||
@@ -139,7 +139,7 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
fModel.SetSearchTerms(searchTerms);
|
fModel.SetSearchTerms(searchTerms);
|
||||||
_AdoptModel();
|
_AdoptModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -160,7 +160,7 @@ void
|
|||||||
MainWindow::_AdoptModel()
|
MainWindow::_AdoptModel()
|
||||||
{
|
{
|
||||||
fVisiblePackages = fModel.CreatePackageList();
|
fVisiblePackages = fModel.CreatePackageList();
|
||||||
|
|
||||||
fPackageListView->Clear();
|
fPackageListView->Clear();
|
||||||
for (int32 i = 0; i < fVisiblePackages.CountItems(); i++) {
|
for (int32 i = 0; i < fVisiblePackages.CountItems(); i++) {
|
||||||
BAutolock _(fModel.Lock());
|
BAutolock _(fModel.Lock());
|
||||||
@@ -193,7 +193,7 @@ MainWindow::_InitDummyModel()
|
|||||||
// for display, extra information is retrieved like screen-shots, user-
|
// for display, extra information is retrieved like screen-shots, user-
|
||||||
// ratings and so on. This triggers notifications which in turn updates
|
// ratings and so on. This triggers notifications which in turn updates
|
||||||
// the UI.
|
// the UI.
|
||||||
|
|
||||||
DepotInfo depot(B_TRANSLATE("Default"));
|
DepotInfo depot(B_TRANSLATE("Default"));
|
||||||
|
|
||||||
// WonderBrush
|
// WonderBrush
|
||||||
@@ -213,7 +213,7 @@ MainWindow::_InitDummyModel()
|
|||||||
"2.1.2 - Initial Haiku release."), true);
|
"2.1.2 - Initial Haiku release."), true);
|
||||||
wonderbrush->AddCategory(fModel.CategoryGraphics());
|
wonderbrush->AddCategory(fModel.CategoryGraphics());
|
||||||
wonderbrush->AddCategory(fModel.CategoryProductivity());
|
wonderbrush->AddCategory(fModel.CategoryProductivity());
|
||||||
|
|
||||||
depot.AddPackage(wonderbrush);
|
depot.AddPackage(wonderbrush);
|
||||||
|
|
||||||
// Paladin
|
// Paladin
|
||||||
@@ -252,7 +252,7 @@ MainWindow::_InitDummyModel()
|
|||||||
"and play back music from your computer. Sequitur is designed for "
|
"and play back music from your computer. Sequitur is designed for "
|
||||||
"people who like to tinker with their music. It facilitates rapid, "
|
"people who like to tinker with their music. It facilitates rapid, "
|
||||||
"dynamic, and radical processing of your performance.",
|
"dynamic, and radical processing of your performance.",
|
||||||
|
|
||||||
"== Sequitur 2.1 Release Notes ==\n"
|
"== Sequitur 2.1 Release Notes ==\n"
|
||||||
"04 August 2002\n\n"
|
"04 August 2002\n\n"
|
||||||
"Features\n\n"
|
"Features\n\n"
|
||||||
@@ -303,7 +303,7 @@ MainWindow::_InitDummyModel()
|
|||||||
" * ''Note to filter developers:'' The filter API has changed. You "
|
" * ''Note to filter developers:'' The filter API has changed. You "
|
||||||
"will need to recompile your filters."), true);
|
"will need to recompile your filters."), true);
|
||||||
sequitur->AddCategory(fModel.CategoryAudio());
|
sequitur->AddCategory(fModel.CategoryAudio());
|
||||||
|
|
||||||
depot.AddPackage(sequitur);
|
depot.AddPackage(sequitur);
|
||||||
|
|
||||||
// Finish off
|
// Finish off
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void _BuildMenu(BMenuBar* menuBar);
|
void _BuildMenu(BMenuBar* menuBar);
|
||||||
void _AdoptModel();
|
void _AdoptModel();
|
||||||
|
|
||||||
void _AdoptPackage(const PackageInfoRef& package);
|
void _AdoptPackage(const PackageInfoRef& package);
|
||||||
void _ClearPackage();
|
void _ClearPackage();
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
fDepot(depot)
|
fDepot(depot)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
||||||
{
|
{
|
||||||
// TODO: Maybe a PackageInfo ought to know the Depot it came from?
|
// TODO: Maybe a PackageInfo ought to know the Depot it came from?
|
||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DepotInfo fDepot;
|
DepotInfo fDepot;
|
||||||
};
|
};
|
||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
fCategory(category)
|
fCategory(category)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
||||||
{
|
{
|
||||||
if (package.Get() == NULL)
|
if (package.Get() == NULL)
|
||||||
@@ -96,7 +96,7 @@ public:
|
|||||||
fPackageList(packageList)
|
fPackageList(packageList)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
||||||
{
|
{
|
||||||
return fPackageList.Contains(package);
|
return fPackageList.Contains(package);
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
fPackageListB(packageListB)
|
fPackageListB(packageListB)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
||||||
{
|
{
|
||||||
return fPackageListA.Contains(package)
|
return fPackageListA.Contains(package)
|
||||||
@@ -148,7 +148,7 @@ public:
|
|||||||
index = nextSpace + 1;
|
index = nextSpace + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
virtual bool AcceptsPackage(const PackageInfoRef& package) const
|
||||||
{
|
{
|
||||||
if (package.Get() == NULL)
|
if (package.Get() == NULL)
|
||||||
@@ -234,7 +234,7 @@ Model::Model()
|
|||||||
B_TRANSLATE("Uninstalled packages"), "uninstalled"), true));
|
B_TRANSLATE("Uninstalled packages"), "uninstalled"), true));
|
||||||
|
|
||||||
// A category for all packages that the user has installed or uninstalled.
|
// A category for all packages that the user has installed or uninstalled.
|
||||||
// Those packages resemble what makes their system different from a
|
// Those packages resemble what makes their system different from a
|
||||||
// fresh Haiku installation.
|
// fresh Haiku installation.
|
||||||
fUserCategories.Add(CategoryRef(new PackageCategory(
|
fUserCategories.Add(CategoryRef(new PackageCategory(
|
||||||
BitmapRef(),
|
BitmapRef(),
|
||||||
@@ -261,10 +261,10 @@ Model::CreatePackageList() const
|
|||||||
|
|
||||||
for (int32 i = 0; i < fDepots.CountItems(); i++) {
|
for (int32 i = 0; i < fDepots.CountItems(); i++) {
|
||||||
const DepotInfo& depot = fDepots.ItemAtFast(i);
|
const DepotInfo& depot = fDepots.ItemAtFast(i);
|
||||||
|
|
||||||
if (fDepotFilter.Length() > 0 && fDepotFilter != depot.Name())
|
if (fDepotFilter.Length() > 0 && fDepotFilter != depot.Name())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const PackageList& packages = depot.Packages();
|
const PackageList& packages = depot.Packages();
|
||||||
|
|
||||||
for (int32 j = 0; j < packages.CountItems(); j++) {
|
for (int32 j = 0; j < packages.CountItems(); j++) {
|
||||||
@@ -326,7 +326,7 @@ void
|
|||||||
Model::SetCategory(const BString& category)
|
Model::SetCategory(const BString& category)
|
||||||
{
|
{
|
||||||
PackageFilter* filter;
|
PackageFilter* filter;
|
||||||
|
|
||||||
if (category.Length() == 0)
|
if (category.Length() == 0)
|
||||||
filter = new AnyFilter();
|
filter = new AnyFilter();
|
||||||
else if (category == "installed")
|
else if (category == "installed")
|
||||||
@@ -358,7 +358,7 @@ void
|
|||||||
Model::SetSearchTerms(const BString& searchTerms)
|
Model::SetSearchTerms(const BString& searchTerms)
|
||||||
{
|
{
|
||||||
PackageFilter* filter;
|
PackageFilter* filter;
|
||||||
|
|
||||||
if (searchTerms.Length() == 0)
|
if (searchTerms.Length() == 0)
|
||||||
filter = new AnyFilter();
|
filter = new AnyFilter();
|
||||||
else
|
else
|
||||||
@@ -381,17 +381,17 @@ Model::PopulatePackage(const PackageInfoRef& package)
|
|||||||
|
|
||||||
// TODO: Replace with actual backend that retrieves package extra
|
// TODO: Replace with actual backend that retrieves package extra
|
||||||
// information and user-contributed package information.
|
// information and user-contributed package information.
|
||||||
|
|
||||||
// TODO: There should probably also be a way to "unpopulate" the
|
// TODO: There should probably also be a way to "unpopulate" the
|
||||||
// package information. Maybe a cache of populated packages, so that
|
// package information. Maybe a cache of populated packages, so that
|
||||||
// packages loose their extra information after a certain amount of
|
// packages loose their extra information after a certain amount of
|
||||||
// time when they have not been accessed/displayed in the UI. Otherwise
|
// time when they have not been accessed/displayed in the UI. Otherwise
|
||||||
// HaikuDepot will consume more and more resources in the packages.
|
// HaikuDepot will consume more and more resources in the packages.
|
||||||
// Especially screen-shots will be a problem eventually.
|
// Especially screen-shots will be a problem eventually.
|
||||||
|
|
||||||
// TODO: Simulate a delay in retrieving this info, and do that on
|
// TODO: Simulate a delay in retrieving this info, and do that on
|
||||||
// a separate thread.
|
// a separate thread.
|
||||||
|
|
||||||
fPopulatedPackages.Add(package);
|
fPopulatedPackages.Add(package);
|
||||||
|
|
||||||
if (package->Title() == "WonderBrush") {
|
if (package->Title() == "WonderBrush") {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ SharedBitmap::Bitmap(Size which)
|
|||||||
{
|
{
|
||||||
if (fResourceID == -1 && fMimeType.Length() == 0)
|
if (fResourceID == -1 && fMimeType.Length() == 0)
|
||||||
return fBitmap[0];
|
return fBitmap[0];
|
||||||
|
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
int32 size = 16;
|
int32 size = 16;
|
||||||
|
|
||||||
@@ -87,14 +87,14 @@ SharedBitmap::Bitmap(Size which)
|
|||||||
size = 64;
|
size = 64;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fBitmap[index] == NULL) {
|
if (fBitmap[index] == NULL) {
|
||||||
if (fResourceID >= 0)
|
if (fResourceID >= 0)
|
||||||
fBitmap[index] = _CreateBitmapFromResource(size);
|
fBitmap[index] = _CreateBitmapFromResource(size);
|
||||||
else if (fMimeType.Length() > 0)
|
else if (fMimeType.Length() > 0)
|
||||||
fBitmap[index] = _CreateBitmapFromMimeType(size);
|
fBitmap[index] = _CreateBitmapFromMimeType(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fBitmap[index];
|
return fBitmap[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,36 +118,36 @@ SharedBitmap::_CreateBitmapFromResource(int32 size) const
|
|||||||
status = BIconUtils::GetVectorIcon(
|
status = BIconUtils::GetVectorIcon(
|
||||||
reinterpret_cast<const uint8*>(data), dataSize, bitmap);
|
reinterpret_cast<const uint8*>(data), dataSize, bitmap);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
delete bitmap;
|
delete bitmap;
|
||||||
bitmap = NULL;
|
bitmap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = resources.LoadResource(B_MESSAGE_TYPE, fResourceID, &dataSize);
|
data = resources.LoadResource(B_MESSAGE_TYPE, fResourceID, &dataSize);
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
BMemoryIO stream(data, dataSize);
|
BMemoryIO stream(data, dataSize);
|
||||||
|
|
||||||
// Try to read as an archived bitmap.
|
// Try to read as an archived bitmap.
|
||||||
BMessage archive;
|
BMessage archive;
|
||||||
status = archive.Unflatten(&stream);
|
status = archive.Unflatten(&stream);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
BBitmap* bitmap = new BBitmap(&archive);
|
BBitmap* bitmap = new BBitmap(&archive);
|
||||||
|
|
||||||
status = bitmap->InitCheck();
|
status = bitmap->InitCheck();
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
delete bitmap;
|
delete bitmap;
|
||||||
bitmap = NULL;
|
bitmap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ SharedBitmap::_CreateBitmapFromMimeType(int32 size) const
|
|||||||
delete bitmap;
|
delete bitmap;
|
||||||
bitmap = NULL;
|
bitmap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,10 +553,10 @@ PackageInfo::CalculateRatingSummary() const
|
|||||||
int starRatingCount = sizeof(summary.ratingCountByStar) / sizeof(int);
|
int starRatingCount = sizeof(summary.ratingCountByStar) / sizeof(int);
|
||||||
for (int i = 0; i < starRatingCount; i++)
|
for (int i = 0; i < starRatingCount; i++)
|
||||||
summary.ratingCountByStar[i] = 0;
|
summary.ratingCountByStar[i] = 0;
|
||||||
|
|
||||||
if (summary.ratingCount <= 0)
|
if (summary.ratingCount <= 0)
|
||||||
return summary;
|
return summary;
|
||||||
|
|
||||||
float ratingSum = 0.0f;
|
float ratingSum = 0.0f;
|
||||||
|
|
||||||
for (int i = 0; i < summary.ratingCount; i++) {
|
for (int i = 0; i < summary.ratingCount; i++) {
|
||||||
@@ -566,7 +566,7 @@ PackageInfo::CalculateRatingSummary() const
|
|||||||
rating = 0.0f;
|
rating = 0.0f;
|
||||||
else if (rating > 5.0f)
|
else if (rating > 5.0f)
|
||||||
rating = 5.0f;
|
rating = 5.0f;
|
||||||
|
|
||||||
ratingSum += rating;
|
ratingSum += rating;
|
||||||
|
|
||||||
if (rating <= 1.0f)
|
if (rating <= 1.0f)
|
||||||
|
|||||||
@@ -54,20 +54,20 @@ public:
|
|||||||
{
|
{
|
||||||
BRect innerFrame = Bounds();
|
BRect innerFrame = Bounds();
|
||||||
innerFrame.right -= B_V_SCROLL_BAR_WIDTH + 1;
|
innerFrame.right -= B_V_SCROLL_BAR_WIDTH + 1;
|
||||||
|
|
||||||
BView* target = Target();
|
BView* target = Target();
|
||||||
if (target != NULL) {
|
if (target != NULL) {
|
||||||
Target()->MoveTo(innerFrame.left, innerFrame.top);
|
Target()->MoveTo(innerFrame.left, innerFrame.top);
|
||||||
Target()->ResizeTo(innerFrame.Width(), innerFrame.Height());
|
Target()->ResizeTo(innerFrame.Width(), innerFrame.Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
BScrollBar* scrollBar = ScrollBar(B_VERTICAL);
|
BScrollBar* scrollBar = ScrollBar(B_VERTICAL);
|
||||||
if (scrollBar != NULL) {
|
if (scrollBar != NULL) {
|
||||||
BRect rect = innerFrame;
|
BRect rect = innerFrame;
|
||||||
rect.left = rect.right + 1;
|
rect.left = rect.right + 1;
|
||||||
rect.right = rect.left + B_V_SCROLL_BAR_WIDTH;
|
rect.right = rect.left + B_V_SCROLL_BAR_WIDTH;
|
||||||
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
||||||
|
|
||||||
scrollBar->MoveTo(rect.left, rect.top);
|
scrollBar->MoveTo(rect.left, rect.top);
|
||||||
scrollBar->ResizeTo(rect.Width(), rect.Height());
|
scrollBar->ResizeTo(rect.Width(), rect.Height());
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
virtual void DoLayout()
|
virtual void DoLayout()
|
||||||
{
|
{
|
||||||
CustomScrollView::DoLayout();
|
CustomScrollView::DoLayout();
|
||||||
|
|
||||||
BScrollBar* scrollBar = ScrollBar(B_VERTICAL);
|
BScrollBar* scrollBar = ScrollBar(B_VERTICAL);
|
||||||
BView* target = Target();
|
BView* target = Target();
|
||||||
if (target != NULL && scrollBar != NULL) {
|
if (target != NULL && scrollBar != NULL) {
|
||||||
@@ -108,14 +108,14 @@ public:
|
|||||||
TextDocumentView(name)
|
TextDocumentView(name)
|
||||||
{
|
{
|
||||||
CharacterStyle regularStyle;
|
CharacterStyle regularStyle;
|
||||||
|
|
||||||
float fontSize = regularStyle.Font().Size();
|
float fontSize = regularStyle.Font().Size();
|
||||||
|
|
||||||
ParagraphStyle paragraphStyle;
|
ParagraphStyle paragraphStyle;
|
||||||
paragraphStyle.SetJustify(true);
|
paragraphStyle.SetJustify(true);
|
||||||
paragraphStyle.SetSpacingTop(ceilf(fontSize * 0.3f));
|
paragraphStyle.SetSpacingTop(ceilf(fontSize * 0.3f));
|
||||||
paragraphStyle.SetLineSpacing(ceilf(fontSize * 0.2f));
|
paragraphStyle.SetLineSpacing(ceilf(fontSize * 0.2f));
|
||||||
|
|
||||||
fMarkupParser.SetStyles(regularStyle, paragraphStyle);
|
fMarkupParser.SetStyles(regularStyle, paragraphStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ public:
|
|||||||
document->Append(paragraph);
|
document->Append(paragraph);
|
||||||
|
|
||||||
fMarkupParser.AppendMarkup(document, markupText);
|
fMarkupParser.AppendMarkup(document, markupText);
|
||||||
|
|
||||||
SetTextDocument(document);
|
SetTextDocument(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ public:
|
|||||||
fHoverColor((rgb_color){ 1, 141, 211, 255 })
|
fHoverColor((rgb_color){ 1, 141, 211, 255 })
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||||
const BMessage* dragMessage)
|
const BMessage* dragMessage)
|
||||||
{
|
{
|
||||||
@@ -193,7 +193,7 @@ public:
|
|||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~RatingView()
|
virtual ~RatingView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -208,18 +208,18 @@ public:
|
|||||||
virtual void Draw(BRect updateRect)
|
virtual void Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
FillRect(updateRect, B_SOLID_LOW);
|
FillRect(updateRect, B_SOLID_LOW);
|
||||||
|
|
||||||
if (fRating < 0.0f)
|
if (fRating < 0.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const BBitmap* star = fStarBitmap.Bitmap(SharedBitmap::SIZE_16);
|
const BBitmap* star = fStarBitmap.Bitmap(SharedBitmap::SIZE_16);
|
||||||
if (star == NULL) {
|
if (star == NULL) {
|
||||||
fprintf(stderr, "No star icon found in application resources.\n");
|
fprintf(stderr, "No star icon found in application resources.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDrawingMode(B_OP_OVER);
|
SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
float x = 0;
|
float x = 0;
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
DrawBitmap(star, BPoint(x, 0));
|
DrawBitmap(star, BPoint(x, 0));
|
||||||
@@ -230,14 +230,14 @@ public:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SetDrawingMode(B_OP_OVER);
|
SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
BRect rect(Bounds());
|
BRect rect(Bounds());
|
||||||
rect.left = ceilf(rect.left + (fRating / 5.0f) * rect.Width());
|
rect.left = ceilf(rect.left + (fRating / 5.0f) * rect.Width());
|
||||||
|
|
||||||
rgb_color color = LowColor();
|
rgb_color color = LowColor();
|
||||||
color.alpha = 190;
|
color.alpha = 190;
|
||||||
SetHighColor(color);
|
SetHighColor(color);
|
||||||
|
|
||||||
SetDrawingMode(B_OP_ALPHA);
|
SetDrawingMode(B_OP_ALPHA);
|
||||||
FillRect(rect, B_SOLID_HIGH);
|
FillRect(rect, B_SOLID_HIGH);
|
||||||
}
|
}
|
||||||
@@ -280,7 +280,7 @@ public:
|
|||||||
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT));
|
SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~DiagramBarView()
|
virtual ~DiagramBarView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -297,13 +297,13 @@ public:
|
|||||||
virtual void Draw(BRect updateRect)
|
virtual void Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
FillRect(updateRect, B_SOLID_LOW);
|
FillRect(updateRect, B_SOLID_LOW);
|
||||||
|
|
||||||
if (fValue <= 0.0f)
|
if (fValue <= 0.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BRect rect(Bounds());
|
BRect rect(Bounds());
|
||||||
rect.right = ceilf(rect.left + fValue * rect.Width());
|
rect.right = ceilf(rect.left + fValue * rect.Width());
|
||||||
|
|
||||||
FillRect(rect, B_SOLID_HIGH);
|
FillRect(rect, B_SOLID_HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,10 +411,10 @@ public:
|
|||||||
.Add(fVersionInfo)
|
.Add(fVersionInfo)
|
||||||
.AddGlue(3.0f)
|
.AddGlue(3.0f)
|
||||||
;
|
;
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~TitleView()
|
virtual ~TitleView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -427,7 +427,7 @@ public:
|
|||||||
fIconView->SetBitmap(NULL);
|
fIconView->SetBitmap(NULL);
|
||||||
|
|
||||||
fTitleView->SetText(package.Title());
|
fTitleView->SetText(package.Title());
|
||||||
|
|
||||||
BString publisher = B_TRANSLATE("by %Publisher%");
|
BString publisher = B_TRANSLATE("by %Publisher%");
|
||||||
publisher.ReplaceAll("%Publisher%", package.Publisher().Name());
|
publisher.ReplaceAll("%Publisher%", package.Publisher().Name());
|
||||||
fPublisherView->SetText(publisher);
|
fPublisherView->SetText(publisher);
|
||||||
@@ -493,15 +493,15 @@ public:
|
|||||||
fLayout(new BGroupLayout(B_HORIZONTAL))
|
fLayout(new BGroupLayout(B_HORIZONTAL))
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
SetLayout(fLayout);
|
SetLayout(fLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~PackageActionView()
|
virtual ~PackageActionView()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage* message)
|
virtual void MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
@@ -522,7 +522,7 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -534,18 +534,18 @@ public:
|
|||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
fPackageActions = fPackageManager->GetPackageActions(package);
|
fPackageActions = fPackageManager->GetPackageActions(package);
|
||||||
|
|
||||||
// Add Buttons in reverse action order
|
// Add Buttons in reverse action order
|
||||||
for (int32 i = fPackageActions.CountItems() - 1; i >= 0; i--) {
|
for (int32 i = fPackageActions.CountItems() - 1; i >= 0; i--) {
|
||||||
const PackageActionRef& action = fPackageActions.ItemAtFast(i);
|
const PackageActionRef& action = fPackageActions.ItemAtFast(i);
|
||||||
|
|
||||||
BMessage* message = new BMessage(MSG_PACKAGE_ACTION);
|
BMessage* message = new BMessage(MSG_PACKAGE_ACTION);
|
||||||
message->AddInt32("index", i);
|
message->AddInt32("index", i);
|
||||||
|
|
||||||
BButton* button = new BButton(action->Label(), message);
|
BButton* button = new BButton(action->Label(), message);
|
||||||
fLayout->AddView(button);
|
fLayout->AddView(button);
|
||||||
button->SetTarget(this);
|
button->SetTarget(this);
|
||||||
|
|
||||||
fButtons.AddItem(button);
|
fButtons.AddItem(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -562,7 +562,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PackageManager* fPackageManager;
|
PackageManager* fPackageManager;
|
||||||
|
|
||||||
BGroupLayout* fLayout;
|
BGroupLayout* fLayout;
|
||||||
PackageActionList fPackageActions;
|
PackageActionList fPackageActions;
|
||||||
BList fButtons;
|
BList fButtons;
|
||||||
@@ -588,18 +588,18 @@ public:
|
|||||||
{
|
{
|
||||||
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
kContentTint));
|
kContentTint));
|
||||||
|
|
||||||
fDescriptionView = new MarkupTextView("description view");
|
fDescriptionView = new MarkupTextView("description view");
|
||||||
fDescriptionView->SetLowColor(ViewColor());
|
fDescriptionView->SetLowColor(ViewColor());
|
||||||
fDescriptionView->SetInsets(be_plain_font->Size());
|
fDescriptionView->SetInsets(be_plain_font->Size());
|
||||||
|
|
||||||
BScrollView* scrollView = new CustomScrollView(
|
BScrollView* scrollView = new CustomScrollView(
|
||||||
"description scroll view", fDescriptionView);
|
"description scroll view", fDescriptionView);
|
||||||
|
|
||||||
BFont smallFont;
|
BFont smallFont;
|
||||||
GetFont(&smallFont);
|
GetFont(&smallFont);
|
||||||
smallFont.SetSize(std::max(9.0f, ceilf(smallFont.Size() * 0.85f)));
|
smallFont.SetSize(std::max(9.0f, ceilf(smallFont.Size() * 0.85f)));
|
||||||
|
|
||||||
// TODO: Clicking the screen shot view should open ShowImage with the
|
// TODO: Clicking the screen shot view should open ShowImage with the
|
||||||
// the screen shot. This could be done by writing the screen shot to
|
// the screen shot. This could be done by writing the screen shot to
|
||||||
// a temporary folder, launching ShowImage to display it, and writing
|
// a temporary folder, launching ShowImage to display it, and writing
|
||||||
@@ -612,7 +612,7 @@ public:
|
|||||||
BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
|
BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
|
||||||
fScreenshotView->SetExplicitAlignment(
|
fScreenshotView->SetExplicitAlignment(
|
||||||
BAlignment(B_ALIGN_CENTER, B_ALIGN_TOP));
|
BAlignment(B_ALIGN_CENTER, B_ALIGN_TOP));
|
||||||
|
|
||||||
fEmailIconView = new BitmapView("email icon view");
|
fEmailIconView = new BitmapView("email icon view");
|
||||||
fEmailLinkView = new LinkView("email link view", "",
|
fEmailLinkView = new LinkView("email link view", "",
|
||||||
new BMessage(MSG_EMAIL_PUBLISHER), kLightBlack);
|
new BMessage(MSG_EMAIL_PUBLISHER), kLightBlack);
|
||||||
@@ -622,11 +622,11 @@ public:
|
|||||||
fWebsiteLinkView = new LinkView("website link view", "",
|
fWebsiteLinkView = new LinkView("website link view", "",
|
||||||
new BMessage(MSG_VISIT_PUBLISHER_WEBSITE), kLightBlack);
|
new BMessage(MSG_VISIT_PUBLISHER_WEBSITE), kLightBlack);
|
||||||
fWebsiteLinkView->SetFont(&smallFont);
|
fWebsiteLinkView->SetFont(&smallFont);
|
||||||
|
|
||||||
BGroupView* leftGroup = new BGroupView(B_VERTICAL,
|
BGroupView* leftGroup = new BGroupView(B_VERTICAL,
|
||||||
B_USE_DEFAULT_SPACING);
|
B_USE_DEFAULT_SPACING);
|
||||||
leftGroup->SetViewColor(ViewColor());
|
leftGroup->SetViewColor(ViewColor());
|
||||||
|
|
||||||
BLayoutBuilder::Group<>(this, B_HORIZONTAL, 0.0f)
|
BLayoutBuilder::Group<>(this, B_HORIZONTAL, 0.0f)
|
||||||
// .Add(BSpaceLayoutItem::CreateHorizontalStrut(32.0f))
|
// .Add(BSpaceLayoutItem::CreateHorizontalStrut(32.0f))
|
||||||
.AddGroup(leftGroup)
|
.AddGroup(leftGroup)
|
||||||
@@ -648,7 +648,7 @@ public:
|
|||||||
.SetInsets(0.0f, -1.0f, -1.0f, -1.0f)
|
.SetInsets(0.0f, -1.0f, -1.0f, -1.0f)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~AboutView()
|
virtual ~AboutView()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
@@ -719,7 +719,7 @@ public:
|
|||||||
rating.User().Avatar()->Bitmap(SharedBitmap::SIZE_16));
|
rating.User().Avatar()->Bitmap(SharedBitmap::SIZE_16));
|
||||||
}
|
}
|
||||||
fAvatarView->SetExplicitMinSize(BSize(16.0f, 16.0f));
|
fAvatarView->SetExplicitMinSize(BSize(16.0f, 16.0f));
|
||||||
|
|
||||||
fNameView = new BStringView("user name", rating.User().NickName());
|
fNameView = new BStringView("user name", rating.User().NickName());
|
||||||
BFont nameFont(be_bold_font);
|
BFont nameFont(be_bold_font);
|
||||||
nameFont.SetSize(std::max(9.0f, floorf(nameFont.Size() * 0.9f)));
|
nameFont.SetSize(std::max(9.0f, floorf(nameFont.Size() * 0.9f)));
|
||||||
@@ -727,7 +727,7 @@ public:
|
|||||||
fNameView->SetHighColor(kLightBlack);
|
fNameView->SetHighColor(kLightBlack);
|
||||||
fNameView->SetExplicitMaxSize(
|
fNameView->SetExplicitMaxSize(
|
||||||
BSize(nameFont.StringWidth("xxxxxxxxxxxxxxxxxxxxxx"), B_SIZE_UNSET));
|
BSize(nameFont.StringWidth("xxxxxxxxxxxxxxxxxxxxxx"), B_SIZE_UNSET));
|
||||||
|
|
||||||
fRatingView = new RatingView();
|
fRatingView = new RatingView();
|
||||||
fRatingView->SetRating(rating.Rating());
|
fRatingView->SetRating(rating.Rating());
|
||||||
|
|
||||||
@@ -754,7 +754,7 @@ public:
|
|||||||
fUpVoteCountView = new BStringView("up vote count", "");
|
fUpVoteCountView = new BStringView("up vote count", "");
|
||||||
fVoteDownIconView = new BitmapButton("vote down icon", voteDownMessage);
|
fVoteDownIconView = new BitmapButton("vote down icon", voteDownMessage);
|
||||||
fDownVoteCountView = new BStringView("up vote count", "");
|
fDownVoteCountView = new BStringView("up vote count", "");
|
||||||
|
|
||||||
fVoteUpIconView->SetBitmap(
|
fVoteUpIconView->SetBitmap(
|
||||||
voteUpIcon->Bitmap(SharedBitmap::SIZE_16));
|
voteUpIcon->Bitmap(SharedBitmap::SIZE_16));
|
||||||
fVoteDownIconView->SetBitmap(
|
fVoteDownIconView->SetBitmap(
|
||||||
@@ -842,7 +842,7 @@ protected:
|
|||||||
BGroupView::DoLayout();
|
BGroupView::DoLayout();
|
||||||
if (BScrollBar* scrollBar = ScrollBar(B_VERTICAL)) {
|
if (BScrollBar* scrollBar = ScrollBar(B_VERTICAL)) {
|
||||||
BRect layoutArea = GroupLayout()->LayoutArea();
|
BRect layoutArea = GroupLayout()->LayoutArea();
|
||||||
float layoutHeight = layoutArea.Height();
|
float layoutHeight = layoutArea.Height();
|
||||||
// Min size is not reliable with HasHeightForWidth() children,
|
// Min size is not reliable with HasHeightForWidth() children,
|
||||||
// since it does not reflect how thos children are currently
|
// since it does not reflect how thos children are currently
|
||||||
// laid out, but what their theoretical minimum size would be.
|
// laid out, but what their theoretical minimum size would be.
|
||||||
@@ -874,13 +874,13 @@ public:
|
|||||||
{
|
{
|
||||||
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
kContentTint - 0.1));
|
kContentTint - 0.1));
|
||||||
|
|
||||||
BLayoutBuilder::Grid<> layoutBuilder(this);
|
BLayoutBuilder::Grid<> layoutBuilder(this);
|
||||||
|
|
||||||
BFont smallFont;
|
BFont smallFont;
|
||||||
GetFont(&smallFont);
|
GetFont(&smallFont);
|
||||||
smallFont.SetSize(std::max(9.0f, floorf(smallFont.Size() * 0.85f)));
|
smallFont.SetSize(std::max(9.0f, floorf(smallFont.Size() * 0.85f)));
|
||||||
|
|
||||||
for (int32 i = 0; i < 5; i++) {
|
for (int32 i = 0; i < 5; i++) {
|
||||||
BString label;
|
BString label;
|
||||||
label.SetToFormat("%ld", 5 - i);
|
label.SetToFormat("%ld", 5 - i);
|
||||||
@@ -891,14 +891,14 @@ public:
|
|||||||
|
|
||||||
fDiagramBarViews[i] = new DiagramBarView();
|
fDiagramBarViews[i] = new DiagramBarView();
|
||||||
layoutBuilder.Add(fDiagramBarViews[i], 1, i);
|
layoutBuilder.Add(fDiagramBarViews[i], 1, i);
|
||||||
|
|
||||||
fCountViews[i] = new BStringView("", "");
|
fCountViews[i] = new BStringView("", "");
|
||||||
fCountViews[i]->SetFont(&smallFont);
|
fCountViews[i]->SetFont(&smallFont);
|
||||||
fCountViews[i]->SetHighColor(kLightBlack);
|
fCountViews[i]->SetHighColor(kLightBlack);
|
||||||
fCountViews[i]->SetAlignment(B_ALIGN_RIGHT);
|
fCountViews[i]->SetAlignment(B_ALIGN_RIGHT);
|
||||||
layoutBuilder.Add(fCountViews[i], 2, i);
|
layoutBuilder.Add(fCountViews[i], 2, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutBuilder.SetInsets(5);
|
layoutBuilder.SetInsets(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -909,7 +909,7 @@ public:
|
|||||||
BString label;
|
BString label;
|
||||||
label.SetToFormat("%ld", count);
|
label.SetToFormat("%ld", count);
|
||||||
fCountViews[i]->SetText(label);
|
fCountViews[i]->SetText(label);
|
||||||
|
|
||||||
if (summary.ratingCount > 0) {
|
if (summary.ratingCount > 0) {
|
||||||
fDiagramBarViews[i]->SetValue(
|
fDiagramBarViews[i]->SetValue(
|
||||||
(float)count / summary.ratingCount);
|
(float)count / summary.ratingCount);
|
||||||
@@ -942,15 +942,15 @@ public:
|
|||||||
{
|
{
|
||||||
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
kContentTint));
|
kContentTint));
|
||||||
|
|
||||||
fRatingSummaryView = new RatingSummaryView();
|
fRatingSummaryView = new RatingSummaryView();
|
||||||
|
|
||||||
RatingContainerView* ratingsContainerView = new RatingContainerView();
|
RatingContainerView* ratingsContainerView = new RatingContainerView();
|
||||||
fRatingContainerLayout = ratingsContainerView->GroupLayout();
|
fRatingContainerLayout = ratingsContainerView->GroupLayout();
|
||||||
|
|
||||||
BScrollView* scrollView = new RatingsScrollView(
|
BScrollView* scrollView = new RatingsScrollView(
|
||||||
"ratings scroll view", ratingsContainerView);
|
"ratings scroll view", ratingsContainerView);
|
||||||
|
|
||||||
BLayoutBuilder::Group<>(this)
|
BLayoutBuilder::Group<>(this)
|
||||||
.AddGroup(B_VERTICAL)
|
.AddGroup(B_VERTICAL)
|
||||||
.Add(fRatingSummaryView, 0.0f)
|
.Add(fRatingSummaryView, 0.0f)
|
||||||
@@ -961,7 +961,7 @@ public:
|
|||||||
.SetInsets(B_USE_DEFAULT_SPACING, -1.0f, -1.0f, -1.0f)
|
.SetInsets(B_USE_DEFAULT_SPACING, -1.0f, -1.0f, -1.0f)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~UserRatingsView()
|
virtual ~UserRatingsView()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
@@ -975,10 +975,10 @@ public:
|
|||||||
fRatingSummaryView->SetToSummary(package.CalculateRatingSummary());
|
fRatingSummaryView->SetToSummary(package.CalculateRatingSummary());
|
||||||
|
|
||||||
const UserRatingList& userRatings = package.UserRatings();
|
const UserRatingList& userRatings = package.UserRatings();
|
||||||
|
|
||||||
// TODO: Sort by age or usefullness rating
|
// TODO: Sort by age or usefullness rating
|
||||||
// TODO: Optionally hide ratings that are not in the system language
|
// TODO: Optionally hide ratings that are not in the system language
|
||||||
|
|
||||||
for (int i = userRatings.CountItems() - 1; i >= 0; i--) {
|
for (int i = userRatings.CountItems() - 1; i >= 0; i--) {
|
||||||
const UserRating& rating = userRatings.ItemAtFast(i);
|
const UserRating& rating = userRatings.ItemAtFast(i);
|
||||||
RatingItemView* view = new RatingItemView(rating, fThumbsUpIcon,
|
RatingItemView* view = new RatingItemView(rating, fThumbsUpIcon,
|
||||||
@@ -1026,23 +1026,23 @@ public:
|
|||||||
{
|
{
|
||||||
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
kContentTint));
|
kContentTint));
|
||||||
|
|
||||||
SetLayout(fLayout);
|
SetLayout(fLayout);
|
||||||
|
|
||||||
fTextView = new MarkupTextView("changelog view");
|
fTextView = new MarkupTextView("changelog view");
|
||||||
fTextView->SetLowColor(ViewColor());
|
fTextView->SetLowColor(ViewColor());
|
||||||
fTextView->SetInsets(be_plain_font->Size());
|
fTextView->SetInsets(be_plain_font->Size());
|
||||||
|
|
||||||
BScrollView* scrollView = new CustomScrollView(
|
BScrollView* scrollView = new CustomScrollView(
|
||||||
"changelog scroll view", fTextView);
|
"changelog scroll view", fTextView);
|
||||||
|
|
||||||
BLayoutBuilder::Group<>(fLayout)
|
BLayoutBuilder::Group<>(fLayout)
|
||||||
.Add(BSpaceLayoutItem::CreateHorizontalStrut(32.0f))
|
.Add(BSpaceLayoutItem::CreateHorizontalStrut(32.0f))
|
||||||
.Add(scrollView, 1.0f)
|
.Add(scrollView, 1.0f)
|
||||||
.SetInsets(B_USE_DEFAULT_SPACING, -1.0f, -1.0f, -1.0f)
|
.SetInsets(B_USE_DEFAULT_SPACING, -1.0f, -1.0f, -1.0f)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ChangelogView()
|
virtual ~ChangelogView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -1078,7 +1078,7 @@ public:
|
|||||||
fLayout(new BCardLayout())
|
fLayout(new BCardLayout())
|
||||||
{
|
{
|
||||||
SetBorder(B_NO_BORDER);
|
SetBorder(B_NO_BORDER);
|
||||||
|
|
||||||
fAboutView = new AboutView();
|
fAboutView = new AboutView();
|
||||||
fUserRatingsView = new UserRatingsView();
|
fUserRatingsView = new UserRatingsView();
|
||||||
fChangelogView = new ChangelogView();
|
fChangelogView = new ChangelogView();
|
||||||
@@ -1086,14 +1086,14 @@ public:
|
|||||||
AddTab(fAboutView);
|
AddTab(fAboutView);
|
||||||
AddTab(fUserRatingsView);
|
AddTab(fUserRatingsView);
|
||||||
AddTab(fChangelogView);
|
AddTab(fChangelogView);
|
||||||
|
|
||||||
TabAt(0)->SetLabel(B_TRANSLATE("About"));
|
TabAt(0)->SetLabel(B_TRANSLATE("About"));
|
||||||
TabAt(1)->SetLabel(B_TRANSLATE("Ratings"));
|
TabAt(1)->SetLabel(B_TRANSLATE("Ratings"));
|
||||||
TabAt(2)->SetLabel(B_TRANSLATE("Changelog"));
|
TabAt(2)->SetLabel(B_TRANSLATE("Changelog"));
|
||||||
|
|
||||||
Select(0);
|
Select(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~PagesView()
|
virtual ~PagesView()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
@@ -1116,7 +1116,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BCardLayout* fLayout;
|
BCardLayout* fLayout;
|
||||||
|
|
||||||
AboutView* fAboutView;
|
AboutView* fAboutView;
|
||||||
UserRatingsView* fUserRatingsView;
|
UserRatingsView* fUserRatingsView;
|
||||||
ChangelogView* fChangelogView;
|
ChangelogView* fChangelogView;
|
||||||
@@ -1150,11 +1150,11 @@ public:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const PackageInfo& package = *event.Package().Get();
|
const PackageInfo& package = *event.Package().Get();
|
||||||
|
|
||||||
BMessage message(MSG_UPDATE_PACKAGE);
|
BMessage message(MSG_UPDATE_PACKAGE);
|
||||||
message.AddString("title", package.Title());
|
message.AddString("title", package.Title());
|
||||||
message.AddUInt32("changes", event.Changes());
|
message.AddUInt32("changes", event.Changes());
|
||||||
|
|
||||||
messenger.SendMessage(&message);
|
messenger.SendMessage(&message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1246,9 +1246,9 @@ PackageInfoView::MessageReceived(BMessage* message)
|
|||||||
const PackageInfo& package = *fPackageListener->Package().Get();
|
const PackageInfo& package = *fPackageListener->Package().Get();
|
||||||
if (package.Title() != title)
|
if (package.Title() != title)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
BAutolock _(fModelLock);
|
BAutolock _(fModelLock);
|
||||||
|
|
||||||
if ((changes & PKG_CHANGED_DESCRIPTION) != 0
|
if ((changes & PKG_CHANGED_DESCRIPTION) != 0
|
||||||
|| (changes & PKG_CHANGED_SCREENSHOTS) != 0) {
|
|| (changes & PKG_CHANGED_SCREENSHOTS) != 0) {
|
||||||
fTitleView->SetPackage(package);
|
fTitleView->SetPackage(package);
|
||||||
@@ -1271,13 +1271,13 @@ void
|
|||||||
PackageInfoView::SetPackage(const PackageInfoRef& packageRef)
|
PackageInfoView::SetPackage(const PackageInfoRef& packageRef)
|
||||||
{
|
{
|
||||||
BAutolock _(fModelLock);
|
BAutolock _(fModelLock);
|
||||||
|
|
||||||
const PackageInfo& package = *packageRef.Get();
|
const PackageInfo& package = *packageRef.Get();
|
||||||
|
|
||||||
fTitleView->SetPackage(package);
|
fTitleView->SetPackage(package);
|
||||||
fPackageActionView->SetPackage(package);
|
fPackageActionView->SetPackage(package);
|
||||||
fPagesView->SetPackage(package);
|
fPagesView->SetPackage(package);
|
||||||
|
|
||||||
if (fPagesView->IsHidden(fPagesView))
|
if (fPagesView->IsHidden(fPagesView))
|
||||||
fPagesView->Show();
|
fPagesView->Show();
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ private:
|
|||||||
TitleView* fTitleView;
|
TitleView* fTitleView;
|
||||||
PackageActionView* fPackageActionView;
|
PackageActionView* fPackageActionView;
|
||||||
PagesView* fPagesView;
|
PagesView* fPagesView;
|
||||||
|
|
||||||
Listener* fPackageListener;
|
Listener* fPackageListener;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -117,17 +117,17 @@ public:
|
|||||||
{
|
{
|
||||||
if ((event.Changes() & PKG_CHANGED_RATINGS) == 0)
|
if ((event.Changes() & PKG_CHANGED_RATINGS) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BMessenger messenger(fView);
|
BMessenger messenger(fView);
|
||||||
if (!messenger.IsValid())
|
if (!messenger.IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const PackageInfo& package = *event.Package().Get();
|
const PackageInfo& package = *event.Package().Get();
|
||||||
|
|
||||||
BMessage message(MSG_UPDATE_PACKAGE);
|
BMessage message(MSG_UPDATE_PACKAGE);
|
||||||
message.AddString("title", package.Title());
|
message.AddString("title", package.Title());
|
||||||
message.AddUInt32("changes", event.Changes());
|
message.AddUInt32("changes", event.Changes());
|
||||||
|
|
||||||
messenger.SendMessage(&message);
|
messenger.SendMessage(&message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,10 +185,10 @@ RatingField::SetRating(float rating)
|
|||||||
rating = 0.0f;
|
rating = 0.0f;
|
||||||
if (rating > 5.0f)
|
if (rating > 5.0f)
|
||||||
rating = 5.0f;
|
rating = 5.0f;
|
||||||
|
|
||||||
if (rating == fRating)
|
if (rating == fRating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fRating = rating;
|
fRating = rating;
|
||||||
// TODO: cause a redraw?
|
// TODO: cause a redraw?
|
||||||
}
|
}
|
||||||
@@ -292,7 +292,7 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent)
|
|||||||
drawOverlay = false;
|
drawOverlay = false;
|
||||||
stringWidth = parent->StringWidth(string);
|
stringWidth = parent->StringWidth(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Alignment()) {
|
switch (Alignment()) {
|
||||||
default:
|
default:
|
||||||
case B_ALIGN_LEFT:
|
case B_ALIGN_LEFT:
|
||||||
@@ -320,15 +320,15 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent)
|
|||||||
+ fontHeight.ascent;
|
+ fontHeight.ascent;
|
||||||
|
|
||||||
parent->DrawString(string, BPoint(rect.left, y));
|
parent->DrawString(string, BPoint(rect.left, y));
|
||||||
|
|
||||||
if (drawOverlay) {
|
if (drawOverlay) {
|
||||||
rect.left = ceilf(rect.left
|
rect.left = ceilf(rect.left
|
||||||
+ (ratingField->Rating() / 5.0f) * rect.Width());
|
+ (ratingField->Rating() / 5.0f) * rect.Width());
|
||||||
|
|
||||||
rgb_color color = parent->LowColor();
|
rgb_color color = parent->LowColor();
|
||||||
color.alpha = 190;
|
color.alpha = 190;
|
||||||
parent->SetHighColor(color);
|
parent->SetHighColor(color);
|
||||||
|
|
||||||
parent->SetDrawingMode(B_OP_ALPHA);
|
parent->SetDrawingMode(B_OP_ALPHA);
|
||||||
parent->FillRect(rect, B_SOLID_HIGH);
|
parent->FillRect(rect, B_SOLID_HIGH);
|
||||||
|
|
||||||
@@ -429,9 +429,9 @@ PackageRow::PackageRow(const PackageInfoRef& packageRef,
|
|||||||
{
|
{
|
||||||
if (packageRef.Get() == NULL)
|
if (packageRef.Get() == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PackageInfo& package = *packageRef.Get();
|
PackageInfo& package = *packageRef.Get();
|
||||||
|
|
||||||
// Package icon and title
|
// Package icon and title
|
||||||
// NOTE: The icon BBitmap is referenced by the fPackage member.
|
// NOTE: The icon BBitmap is referenced by the fPackage member.
|
||||||
const BBitmap* icon = NULL;
|
const BBitmap* icon = NULL;
|
||||||
@@ -487,13 +487,13 @@ public:
|
|||||||
BFont font(be_plain_font);
|
BFont font(be_plain_font);
|
||||||
font.SetSize(9.0f);
|
font.SetSize(9.0f);
|
||||||
SetFont(&font);
|
SetFont(&font);
|
||||||
|
|
||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
SetHighColor(tint_color(LowColor(), B_DARKEN_4_TINT));
|
SetHighColor(tint_color(LowColor(), B_DARKEN_4_TINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual BSize MinSize()
|
virtual BSize MinSize()
|
||||||
{
|
{
|
||||||
BString label(_GetLabel());
|
BString label(_GetLabel());
|
||||||
@@ -513,15 +513,15 @@ public:
|
|||||||
virtual void Draw(BRect updateRect)
|
virtual void Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
FillRect(updateRect, B_SOLID_LOW);
|
FillRect(updateRect, B_SOLID_LOW);
|
||||||
|
|
||||||
BString label(_GetLabel());
|
BString label(_GetLabel());
|
||||||
|
|
||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
GetFontHeight(&fontHeight);
|
GetFontHeight(&fontHeight);
|
||||||
|
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
float width = StringWidth(label);
|
float width = StringWidth(label);
|
||||||
|
|
||||||
BPoint offset;
|
BPoint offset;
|
||||||
offset.x = bounds.left + (bounds.Width() - width) / 2.0f;
|
offset.x = bounds.left + (bounds.Width() - width) / 2.0f;
|
||||||
offset.y = bounds.top + (bounds.Height()
|
offset.y = bounds.top + (bounds.Height()
|
||||||
@@ -576,7 +576,7 @@ PackageListView::PackageListView(BLocker* modelLock)
|
|||||||
B_TRUNCATE_END), kStatusColumn);
|
B_TRUNCATE_END), kStatusColumn);
|
||||||
|
|
||||||
SetSortingEnabled(true);
|
SetSortingEnabled(true);
|
||||||
|
|
||||||
fItemCountView = new ItemCountView();
|
fItemCountView = new ItemCountView();
|
||||||
AddStatusView(fItemCountView);
|
AddStatusView(fItemCountView);
|
||||||
}
|
}
|
||||||
@@ -617,7 +617,7 @@ PackageListView::MessageReceived(BMessage* message)
|
|||||||
PackageRow* row = _FindRow(title);
|
PackageRow* row = _FindRow(title);
|
||||||
if (row != NULL)
|
if (row != NULL)
|
||||||
row->UpdateRating();
|
row->UpdateRating();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,13 +632,13 @@ void
|
|||||||
PackageListView::SelectionChanged()
|
PackageListView::SelectionChanged()
|
||||||
{
|
{
|
||||||
BColumnListView::SelectionChanged();
|
BColumnListView::SelectionChanged();
|
||||||
|
|
||||||
BMessage message(MSG_PACKAGE_SELECTED);
|
BMessage message(MSG_PACKAGE_SELECTED);
|
||||||
|
|
||||||
PackageRow* selected = dynamic_cast<PackageRow*>(CurrentSelection());
|
PackageRow* selected = dynamic_cast<PackageRow*>(CurrentSelection());
|
||||||
if (selected != NULL)
|
if (selected != NULL)
|
||||||
message.AddString("title", selected->Package()->Title());
|
message.AddString("title", selected->Package()->Title());
|
||||||
|
|
||||||
Window()->PostMessage(&message);
|
Window()->PostMessage(&message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
virtual void SelectionChanged();
|
virtual void SelectionChanged();
|
||||||
|
|
||||||
void AddPackage(const PackageInfoRef& package);
|
void AddPackage(const PackageInfoRef& package);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PackageRow* _FindRow(const PackageInfoRef& package,
|
PackageRow* _FindRow(const PackageInfoRef& package,
|
||||||
PackageRow* parent = NULL);
|
PackageRow* parent = NULL);
|
||||||
@@ -42,7 +42,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
class ItemCountView;
|
class ItemCountView;
|
||||||
|
|
||||||
BLocker* fModelLock;
|
BLocker* fModelLock;
|
||||||
ItemCountView* fItemCountView;
|
ItemCountView* fItemCountView;
|
||||||
PackageListener* fPackageListener;
|
PackageListener* fPackageListener;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
{
|
{
|
||||||
return B_TRANSLATE("Install");
|
return B_TRANSLATE("Install");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual status_t Perform()
|
virtual status_t Perform()
|
||||||
{
|
{
|
||||||
// TODO: Trigger asynchronous installation of the package
|
// TODO: Trigger asynchronous installation of the package
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public:
|
|||||||
virtual ~PackageAction();
|
virtual ~PackageAction();
|
||||||
|
|
||||||
virtual const char* Label() const = 0;
|
virtual const char* Label() const = 0;
|
||||||
|
|
||||||
// TODO: Perform() needs to be passed a progress listener
|
// TODO: Perform() needs to be passed a progress listener
|
||||||
// and it needs a mechanism to report and react to errors. The
|
// and it needs a mechanism to report and react to errors. The
|
||||||
// Package Kit supports this stuff already.
|
// Package Kit supports this stuff already.
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ save_settings(BMessage* message, const char* fileName, const char* folder)
|
|||||||
// passing folder is optional
|
// passing folder is optional
|
||||||
if (folder != NULL)
|
if (folder != NULL)
|
||||||
ret = path.Append(folder);
|
ret = path.Append(folder);
|
||||||
|
|
||||||
if (ret == B_OK)
|
if (ret == B_OK)
|
||||||
ret = create_directory(path.Path(), 0777);
|
ret = create_directory(path.Path(), 0777);
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ make_sure_frame_is_on_screen(BRect& frame, float borderWidth,
|
|||||||
{
|
{
|
||||||
if (!frame.IsValid())
|
if (!frame.IsValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BScreen* screen = window != NULL ? new BScreen(window)
|
BScreen* screen = window != NULL ? new BScreen(window)
|
||||||
: new BScreen(B_MAIN_SCREEN_ID);
|
: new BScreen(B_MAIN_SCREEN_ID);
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ make_sure_frame_is_on_screen(BRect& frame, float borderWidth,
|
|||||||
delete screen;
|
delete screen;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BRect screenFrame = screen->Frame();
|
BRect screenFrame = screen->Frame();
|
||||||
|
|
||||||
// Validate borderWidth and tabHeight
|
// Validate borderWidth and tabHeight
|
||||||
@@ -104,7 +104,7 @@ make_sure_frame_is_on_screen(BRect& frame, float borderWidth,
|
|||||||
tabHeight = 0.0f;
|
tabHeight = 0.0f;
|
||||||
else
|
else
|
||||||
tabHeight = std::min(tabHeight, floorf(screenFrame.Height() / 4.0f));
|
tabHeight = std::min(tabHeight, floorf(screenFrame.Height() / 4.0f));
|
||||||
|
|
||||||
// Account for window border and tab. It doesn't matter much if the
|
// Account for window border and tab. It doesn't matter much if the
|
||||||
// decorator frame is wider, just as long as the user can grab a
|
// decorator frame is wider, just as long as the user can grab a
|
||||||
// border to move the window
|
// border to move the window
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Bullet::operator=(const Bullet& other)
|
|||||||
{
|
{
|
||||||
if (this == &other)
|
if (this == &other)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
fBulletData = other.fBulletData;
|
fBulletData = other.fBulletData;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ CharacterStyle::operator=(const CharacterStyle& other)
|
|||||||
{
|
{
|
||||||
if (this == &other)
|
if (this == &other)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
fStyleData = other.fStyleData;
|
fStyleData = other.fStyleData;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ CharacterStyle::SetBold(bool bold)
|
|||||||
|| (!bold && (face & B_BOLD_FACE) == 0)) {
|
|| (!bold && (face & B_BOLD_FACE) == 0)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 neededFace = face;
|
uint16 neededFace = face;
|
||||||
if (bold) {
|
if (bold) {
|
||||||
if ((face & B_ITALIC_FACE) != 0)
|
if ((face & B_ITALIC_FACE) != 0)
|
||||||
@@ -116,7 +116,7 @@ CharacterStyle::SetItalic(bool italic)
|
|||||||
|| (!italic && (face & B_ITALIC_FACE) == 0)) {
|
|| (!italic && (face & B_ITALIC_FACE) == 0)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 neededFace = face;
|
uint16 neededFace = face;
|
||||||
if (italic) {
|
if (italic) {
|
||||||
if ((face & B_BOLD_FACE) != 0)
|
if ((face & B_BOLD_FACE) != 0)
|
||||||
@@ -345,7 +345,7 @@ BFont
|
|||||||
CharacterStyle::_FindFontForFace(uint16 face) const
|
CharacterStyle::_FindFontForFace(uint16 face) const
|
||||||
{
|
{
|
||||||
BFont font(Font());
|
BFont font(Font());
|
||||||
|
|
||||||
font_family family;
|
font_family family;
|
||||||
font_style style;
|
font_style style;
|
||||||
font.GetFamilyAndStyle(&family, &style);
|
font.GetFamilyAndStyle(&family, &style);
|
||||||
@@ -360,7 +360,7 @@ CharacterStyle::_FindFontForFace(uint16 face) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,19 +88,19 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BFont fFont;
|
BFont fFont;
|
||||||
|
|
||||||
// The following three values override glyph metrics unless -1
|
// The following three values override glyph metrics unless -1
|
||||||
float fAscent;
|
float fAscent;
|
||||||
float fDescent;
|
float fDescent;
|
||||||
float fWidth;
|
float fWidth;
|
||||||
|
|
||||||
float fGlyphSpacing;
|
float fGlyphSpacing;
|
||||||
|
|
||||||
rgb_color fFgColor;
|
rgb_color fFgColor;
|
||||||
rgb_color fBgColor;
|
rgb_color fBgColor;
|
||||||
rgb_color fStrikeOutColor;
|
rgb_color fStrikeOutColor;
|
||||||
rgb_color fUnderlineColor;
|
rgb_color fUnderlineColor;
|
||||||
|
|
||||||
uint8 fStrikeOutStyle;
|
uint8 fStrikeOutStyle;
|
||||||
uint8 fUnderlineStyle;
|
uint8 fUnderlineStyle;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ MarkupParser::CreateDocumentFromMarkup(const BString& text)
|
|||||||
TextDocumentRef document(new(std::nothrow) TextDocument(), true);
|
TextDocumentRef document(new(std::nothrow) TextDocument(), true);
|
||||||
if (document.Get() == NULL)
|
if (document.Get() == NULL)
|
||||||
return document;
|
return document;
|
||||||
|
|
||||||
AppendMarkup(document, text);
|
AppendMarkup(document, text);
|
||||||
|
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,15 +78,15 @@ void
|
|||||||
MarkupParser::AppendMarkup(const TextDocumentRef& document, const BString& text)
|
MarkupParser::AppendMarkup(const TextDocumentRef& document, const BString& text)
|
||||||
{
|
{
|
||||||
fTextDocument.SetTo(document);
|
fTextDocument.SetTo(document);
|
||||||
|
|
||||||
fCurrentCharacterStyle = &fNormalStyle;
|
fCurrentCharacterStyle = &fNormalStyle;
|
||||||
fCurrentParagraphStyle = &fParagraphStyle;
|
fCurrentParagraphStyle = &fParagraphStyle;
|
||||||
|
|
||||||
fCurrentParagraph = Paragraph(*fCurrentParagraphStyle);
|
fCurrentParagraph = Paragraph(*fCurrentParagraphStyle);
|
||||||
fSpanStartOffset = 0;
|
fSpanStartOffset = 0;
|
||||||
|
|
||||||
_ParseText(text);
|
_ParseText(text);
|
||||||
|
|
||||||
fTextDocument.Unset();
|
fTextDocument.Unset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ MarkupParser::_ParseText(const BString& text)
|
|||||||
|
|
||||||
int32 charCount = text.CountChars();
|
int32 charCount = text.CountChars();
|
||||||
const char* c = text.String();
|
const char* c = text.String();
|
||||||
|
|
||||||
while (offset <= charCount) {
|
while (offset <= charCount) {
|
||||||
uint32 nextChar = UTF8ToCharCode(&c);
|
uint32 nextChar = UTF8ToCharCode(&c);
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ MarkupParser::_ParseText(const BString& text)
|
|||||||
_ToggleStyle(fItalicStyle);
|
_ToggleStyle(fItalicStyle);
|
||||||
else if (tickCount == 3)
|
else if (tickCount == 3)
|
||||||
_ToggleStyle(fBoldStyle);
|
_ToggleStyle(fBoldStyle);
|
||||||
|
|
||||||
// Don't include the ticks in the next span.
|
// Don't include the ticks in the next span.
|
||||||
offset += tickCount - 1;
|
offset += tickCount - 1;
|
||||||
start = offset + 1;
|
start = offset + 1;
|
||||||
@@ -186,7 +186,7 @@ MarkupParser::_ParseText(const BString& text)
|
|||||||
|
|
||||||
_CopySpan(text, start, offset - 1);
|
_CopySpan(text, start, offset - 1);
|
||||||
_FinishParagraph();
|
_FinishParagraph();
|
||||||
|
|
||||||
offset += 2;
|
offset += 2;
|
||||||
c += 2;
|
c += 2;
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ MarkupParser::_ParseText(const BString& text)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
offset++;
|
offset++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ Paragraph::Insert(int32 offset, const TextSpan& newSpan)
|
|||||||
return fTextSpans.Add(newSpan, index);
|
return fTextSpans.Add(newSpan, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split the span,
|
// Split the span,
|
||||||
TextSpan spanBefore = span.SubSpan(0, offset);
|
TextSpan spanBefore = span.SubSpan(0, offset);
|
||||||
TextSpan spanAfter = span.SubSpan(offset, span.CharCount() - offset);
|
TextSpan spanAfter = span.SubSpan(offset, span.CharCount() - offset);
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ ParagraphLayout::ParagraphLayout(const ParagraphLayout& other)
|
|||||||
:
|
:
|
||||||
fTextSpans(other.fTextSpans),
|
fTextSpans(other.fTextSpans),
|
||||||
fParagraphStyle(other.fParagraphStyle),
|
fParagraphStyle(other.fParagraphStyle),
|
||||||
|
|
||||||
fWidth(other.fWidth),
|
fWidth(other.fWidth),
|
||||||
fLayoutValid(false),
|
fLayoutValid(false),
|
||||||
|
|
||||||
@@ -251,13 +251,13 @@ void
|
|||||||
ParagraphLayout::Draw(BView* view, const BPoint& offset)
|
ParagraphLayout::Draw(BView* view, const BPoint& offset)
|
||||||
{
|
{
|
||||||
_ValidateLayout();
|
_ValidateLayout();
|
||||||
|
|
||||||
int lineCount = fLineInfos.CountItems();
|
int lineCount = fLineInfos.CountItems();
|
||||||
for (int i = 0; i < lineCount; i++) {
|
for (int i = 0; i < lineCount; i++) {
|
||||||
const LineInfo& line = fLineInfos.ItemAtFast(i);
|
const LineInfo& line = fLineInfos.ItemAtFast(i);
|
||||||
_DrawLine(view, offset, line);
|
_DrawLine(view, offset, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Bullet& bullet = fParagraphStyle.Bullet();
|
const Bullet& bullet = fParagraphStyle.Bullet();
|
||||||
if (bullet.Spacing() > 0.0f && bullet.String().Length() > 0) {
|
if (bullet.Spacing() > 0.0f && bullet.String().Length() > 0) {
|
||||||
// Draw bullet at offset
|
// Draw bullet at offset
|
||||||
@@ -317,7 +317,7 @@ ParagraphLayout::_Layout()
|
|||||||
int glyphCount = fGlyphInfos.CountItems();
|
int glyphCount = fGlyphInfos.CountItems();
|
||||||
for (int i = 0; i < glyphCount; i++) {
|
for (int i = 0; i < glyphCount; i++) {
|
||||||
GlyphInfo glyph = fGlyphInfos.ItemAtFast(i);
|
GlyphInfo glyph = fGlyphInfos.ItemAtFast(i);
|
||||||
|
|
||||||
uint32 charClassification = get_char_classification(glyph.charCode);
|
uint32 charClassification = get_char_classification(glyph.charCode);
|
||||||
|
|
||||||
float advanceX = glyph.width;
|
float advanceX = glyph.width;
|
||||||
@@ -528,7 +528,7 @@ ParagraphLayout::_ApplyAlignment()
|
|||||||
whiteSpace = spaceLeftForSpace / spaceCount;
|
whiteSpace = spaceLeftForSpace / spaceCount;
|
||||||
if (charCount > 0)
|
if (charCount > 0)
|
||||||
charSpace = spaceLeftForChars / charCount;
|
charSpace = spaceLeftForChars / charCount;
|
||||||
|
|
||||||
LineInfo line = fLineInfos.ItemAtFast(lineIndex);
|
LineInfo line = fLineInfos.ItemAtFast(lineIndex);
|
||||||
line.extraGlyphSpacing = charSpace;
|
line.extraGlyphSpacing = charSpace;
|
||||||
line.extraWhiteSpacing = whiteSpace;
|
line.extraWhiteSpacing = whiteSpace;
|
||||||
@@ -583,7 +583,7 @@ ParagraphLayout::_AppendGlyphInfos(const TextSpan& span)
|
|||||||
int charCount = span.CharCount();
|
int charCount = span.CharCount();
|
||||||
if (charCount == 0)
|
if (charCount == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const BString& text = span.Text();
|
const BString& text = span.Text();
|
||||||
const BFont& font = span.Style().Font();
|
const BFont& font = span.Style().Font();
|
||||||
|
|
||||||
@@ -621,7 +621,7 @@ ParagraphLayout::_AppendGlyphInfo(uint32 charCode, float width,
|
|||||||
}
|
}
|
||||||
|
|
||||||
width += style.GlyphSpacing();
|
width += style.GlyphSpacing();
|
||||||
|
|
||||||
return fGlyphInfos.Add(GlyphInfo(charCode, 0.0f, width, 0));
|
return fGlyphInfos.Add(GlyphInfo(charCode, 0.0f, width, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,7 +679,7 @@ ParagraphLayout::_IncludeStyleInLine(LineInfo& line,
|
|||||||
float descent = style.Descent();
|
float descent = style.Descent();
|
||||||
if (descent > line.maxDescent)
|
if (descent > line.maxDescent)
|
||||||
line.maxDescent = descent;
|
line.maxDescent = descent;
|
||||||
|
|
||||||
float height = ascent + descent;
|
float height = ascent + descent;
|
||||||
if (style.Font().Size() > height)
|
if (style.Font().Size() > height)
|
||||||
height = style.Font().Size();
|
height = style.Font().Size();
|
||||||
@@ -713,7 +713,7 @@ ParagraphLayout::_DrawSpan(BView* view, BPoint offset,
|
|||||||
|
|
||||||
const GlyphInfo& glyph = fGlyphInfos.ItemAtFast(textOffset);
|
const GlyphInfo& glyph = fGlyphInfos.ItemAtFast(textOffset);
|
||||||
const LineInfo& line = fLineInfos.ItemAtFast(glyph.lineIndex);
|
const LineInfo& line = fLineInfos.ItemAtFast(glyph.lineIndex);
|
||||||
|
|
||||||
offset.x += glyph.x;
|
offset.x += glyph.x;
|
||||||
offset.y += line.y + line.maxAscent;
|
offset.y += line.y + line.maxAscent;
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
lineIndex(lineIndex)
|
lineIndex(lineIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GlyphInfo(const GlyphInfo& other)
|
GlyphInfo(const GlyphInfo& other)
|
||||||
:
|
:
|
||||||
charCode(other.charCode),
|
charCode(other.charCode),
|
||||||
@@ -94,7 +94,7 @@ public:
|
|||||||
layoutedSpans()
|
layoutedSpans()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LineInfo(int32 textOffset, float y, float height, float maxAscent,
|
LineInfo(int32 textOffset, float y, float height, float maxAscent,
|
||||||
float maxDescent)
|
float maxDescent)
|
||||||
:
|
:
|
||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
layoutedSpans()
|
layoutedSpans()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LineInfo(const LineInfo& other)
|
LineInfo(const LineInfo& other)
|
||||||
:
|
:
|
||||||
textOffset(other.textOffset),
|
textOffset(other.textOffset),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ ParagraphStyle::operator=(const ParagraphStyle& other)
|
|||||||
{
|
{
|
||||||
if (this == &other)
|
if (this == &other)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
fStyleData = other.fStyleData;
|
fStyleData = other.fStyleData;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ TextDocumentLayout::Draw(BView* view, const BPoint& offset,
|
|||||||
const BRect& updateRect)
|
const BRect& updateRect)
|
||||||
{
|
{
|
||||||
_ValidateLayout();
|
_ValidateLayout();
|
||||||
|
|
||||||
int layoutCount = fParagraphLayouts.CountItems();
|
int layoutCount = fParagraphLayouts.CountItems();
|
||||||
for (int i = 0; i < layoutCount; i++) {
|
for (int i = 0; i < layoutCount; i++) {
|
||||||
const ParagraphLayoutInfo& layout = fParagraphLayouts.ItemAtFast(i);
|
const ParagraphLayoutInfo& layout = fParagraphLayouts.ItemAtFast(i);
|
||||||
@@ -151,9 +151,9 @@ TextDocumentLayout::_Layout()
|
|||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
y += style.SpacingTop();
|
y += style.SpacingTop();
|
||||||
|
|
||||||
fParagraphLayouts.Replace(i, ParagraphLayoutInfo(y, info.layout));
|
fParagraphLayouts.Replace(i, ParagraphLayoutInfo(y, info.layout));
|
||||||
|
|
||||||
info.layout->SetWidth(fWidth);
|
info.layout->SetWidth(fWidth);
|
||||||
y += info.layout->Height() + style.SpacingBottom();
|
y += info.layout->Height() + style.SpacingBottom();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ TextDocumentTest::ReadyToRun()
|
|||||||
;
|
;
|
||||||
|
|
||||||
CharacterStyle regularStyle;
|
CharacterStyle regularStyle;
|
||||||
|
|
||||||
float fontSize = regularStyle.Font().Size();
|
float fontSize = regularStyle.Font().Size();
|
||||||
|
|
||||||
ParagraphStyle paragraphStyle;
|
ParagraphStyle paragraphStyle;
|
||||||
paragraphStyle.SetJustify(true);
|
paragraphStyle.SetJustify(true);
|
||||||
paragraphStyle.SetSpacingTop(ceilf(fontSize * 0.6f));
|
paragraphStyle.SetSpacingTop(ceilf(fontSize * 0.6f));
|
||||||
paragraphStyle.SetLineSpacing(ceilf(fontSize * 0.2f));
|
paragraphStyle.SetLineSpacing(ceilf(fontSize * 0.2f));
|
||||||
|
|
||||||
// CharacterStyle boldStyle(regularStyle);
|
// CharacterStyle boldStyle(regularStyle);
|
||||||
// boldStyle.SetBold(true);
|
// boldStyle.SetBold(true);
|
||||||
//
|
//
|
||||||
@@ -57,7 +57,7 @@ TextDocumentTest::ReadyToRun()
|
|||||||
//
|
//
|
||||||
// CharacterStyle italicAndBoldStyle(boldStyle);
|
// CharacterStyle italicAndBoldStyle(boldStyle);
|
||||||
// italicAndBoldStyle.SetItalic(true);
|
// italicAndBoldStyle.SetItalic(true);
|
||||||
//
|
//
|
||||||
// CharacterStyle bigStyle(regularStyle);
|
// CharacterStyle bigStyle(regularStyle);
|
||||||
// bigStyle.SetFontSize(24);
|
// bigStyle.SetFontSize(24);
|
||||||
// bigStyle.SetForegroundColor(255, 50, 50);
|
// bigStyle.SetForegroundColor(255, 50, 50);
|
||||||
@@ -96,7 +96,7 @@ TextDocumentTest::ReadyToRun()
|
|||||||
// paragraph = Paragraph(paragraphStyle);
|
// paragraph = Paragraph(paragraphStyle);
|
||||||
// paragraph.Append(TextSpan("The wrapping in ", regularStyle));
|
// paragraph.Append(TextSpan("The wrapping in ", regularStyle));
|
||||||
// paragraph.Append(TextSpan("this", italicStyle));
|
// paragraph.Append(TextSpan("this", italicStyle));
|
||||||
//
|
//
|
||||||
// paragraph.Append(TextSpan(" bullet item should look visually "
|
// paragraph.Append(TextSpan(" bullet item should look visually "
|
||||||
// "pleasing. And ", regularStyle));
|
// "pleasing. And ", regularStyle));
|
||||||
// paragraph.Append(TextSpan("why", italicAndBoldStyle));
|
// paragraph.Append(TextSpan("why", italicAndBoldStyle));
|
||||||
@@ -104,7 +104,7 @@ TextDocumentTest::ReadyToRun()
|
|||||||
// document->Append(paragraph);
|
// document->Append(paragraph);
|
||||||
|
|
||||||
MarkupParser parser(regularStyle, paragraphStyle);
|
MarkupParser parser(regularStyle, paragraphStyle);
|
||||||
|
|
||||||
TextDocumentRef document = parser.CreateDocumentFromMarkup(
|
TextDocumentRef document = parser.CreateDocumentFromMarkup(
|
||||||
"== Text document test ==\n"
|
"== Text document test ==\n"
|
||||||
"This is a test to see if '''different''' "
|
"This is a test to see if '''different''' "
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ TextSpan::_TruncateRemove(int32& start, int32& count) const
|
|||||||
count = 0;
|
count = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start < 0) {
|
if (start < 0) {
|
||||||
count += start;
|
count += start;
|
||||||
start = 0;
|
start = 0;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ TextView::TextView(const char* name)
|
|||||||
|
|
||||||
::ParagraphStyle style;
|
::ParagraphStyle style;
|
||||||
style.SetLineSpacing(ceilf(font.Size() * 0.2));
|
style.SetLineSpacing(ceilf(font.Size() * 0.2));
|
||||||
|
|
||||||
SetParagraphStyle(style);
|
SetParagraphStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ TextView::SetText(const BString& text)
|
|||||||
fText.Append(TextSpan(text, regularStyle));
|
fText.Append(TextSpan(text, regularStyle));
|
||||||
|
|
||||||
fTextLayout.SetParagraph(fText);
|
fTextLayout.SetParagraph(fText);
|
||||||
|
|
||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user