1 /*
2 * Copyright 2002-2011, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT license.
4 *
5 * Authors:
6 * Michael Wilber
7 * Axel Dörfler, axeld@pinc-software.de
8 */
9
10 /*! A view with information about the STXTTranslator. */
11
12
13 #include "STXTView.h"
14 #include "STXTTranslator.h"
15
16 #include <Catalog.h>
17 #include <LayoutBuilder.h>
18 #include <StringView.h>
19
20 #include <stdio.h>
21
22
23 #undef B_TRANSLATION_CONTEXT
24 #define B_TRANSLATION_CONTEXT "STXTView"
25
26
STXTView(const BRect & frame,const char * name,uint32 resizeMode,uint32 flags,TranslatorSettings * settings)27 STXTView::STXTView(const BRect &frame, const char *name, uint32 resizeMode,
28 uint32 flags, TranslatorSettings *settings)
29 : BView(frame, name, resizeMode, flags)
30 {
31 fSettings = settings;
32 SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
33
34 BStringView *titleView = new BStringView("title",
35 B_TRANSLATE("StyledEdit file translator"));
36 titleView->SetFont(be_bold_font);
37
38 char version[256];
39 snprintf(version, sizeof(version), "Version %d.%d.%d, %s",
40 int(B_TRANSLATION_MAJOR_VERSION(STXT_TRANSLATOR_VERSION)),
41 int(B_TRANSLATION_MINOR_VERSION(STXT_TRANSLATOR_VERSION)),
42 int(B_TRANSLATION_REVISION_VERSION(STXT_TRANSLATOR_VERSION)),
43 __DATE__);
44 BStringView *versionView = new BStringView("version", version);
45 BStringView *copyrightView = new BStringView("Copyright",
46 B_UTF8_COPYRIGHT "2002-2006 Haiku Inc.");
47
48 BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
49 .SetInsets(B_USE_DEFAULT_SPACING)
50 .Add(titleView)
51 .Add(versionView)
52 .Add(copyrightView)
53 .AddGlue();
54 }
55
56
~STXTView()57 STXTView::~STXTView()
58 {
59 fSettings->Release();
60 }
61