HaikuDepot: Use a TextDocumentView for the Changelog.
* This allows simple media wiki markup in the changelog.
This commit is contained in:
parent
2a059affa4
commit
0e61e1ef80
@ -24,7 +24,9 @@
|
|||||||
|
|
||||||
#include "BitmapButton.h"
|
#include "BitmapButton.h"
|
||||||
#include "BitmapView.h"
|
#include "BitmapView.h"
|
||||||
|
#include "MarkupParser.h"
|
||||||
#include "PackageManager.h"
|
#include "PackageManager.h"
|
||||||
|
#include "TextDocumentView.h"
|
||||||
#include "TextView.h"
|
#include "TextView.h"
|
||||||
|
|
||||||
|
|
||||||
@ -943,11 +945,20 @@ public:
|
|||||||
|
|
||||||
SetLayout(fLayout);
|
SetLayout(fLayout);
|
||||||
|
|
||||||
fTextView = new BTextView("changelog view");
|
CharacterStyle regularStyle;
|
||||||
fTextView->SetViewColor(ViewColor());
|
|
||||||
fTextView->MakeEditable(false);
|
float fontSize = regularStyle.Font().Size();
|
||||||
const float textInset = be_plain_font->Size();
|
|
||||||
fTextView->SetInsets(textInset, textInset, textInset, 0.0f);
|
ParagraphStyle paragraphStyle;
|
||||||
|
paragraphStyle.SetJustify(true);
|
||||||
|
paragraphStyle.SetSpacingTop(ceilf(fontSize * 0.3f));
|
||||||
|
paragraphStyle.SetLineSpacing(ceilf(fontSize * 0.2f));
|
||||||
|
|
||||||
|
fMarkupParser.SetStyles(regularStyle, paragraphStyle);
|
||||||
|
|
||||||
|
fTextView = new TextDocumentView("changelog view");
|
||||||
|
fTextView->SetLowColor(ViewColor());
|
||||||
|
fTextView->SetInsets(be_plain_font->Size());
|
||||||
|
|
||||||
BScrollView* scrollView = new CustomScrollView(
|
BScrollView* scrollView = new CustomScrollView(
|
||||||
"changelog scroll view", fTextView);
|
"changelog scroll view", fTextView);
|
||||||
@ -961,7 +972,6 @@ public:
|
|||||||
|
|
||||||
virtual ~ChangelogView()
|
virtual ~ChangelogView()
|
||||||
{
|
{
|
||||||
Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Draw(BRect updateRect)
|
virtual void Draw(BRect updateRect)
|
||||||
@ -970,17 +980,19 @@ public:
|
|||||||
|
|
||||||
void SetPackage(const PackageInfo& package)
|
void SetPackage(const PackageInfo& package)
|
||||||
{
|
{
|
||||||
fTextView->SetText(package.Changelog());
|
fTextView->SetTextDocument(fMarkupParser.CreateDocumentFromMarkup(
|
||||||
|
package.Changelog()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
fTextView->SetText("");
|
fTextView->SetTextDocument(fMarkupParser.CreateDocumentFromMarkup(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BGroupLayout* fLayout;
|
BGroupLayout* fLayout;
|
||||||
BTextView* fTextView;
|
TextDocumentView* fTextView;
|
||||||
|
MarkupParser fMarkupParser;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user