xref: /haiku/src/add-ons/translators/bmp/BMPView.cpp (revision 445d4fd926c569e7b9ae28017da86280aaecbae2)
1 /*
2  * Copyright 2002-2009, 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 BMPTranslator. */
11 
12 
13 #include "BMPView.h"
14 #include "BMPTranslator.h"
15 
16 #include <Catalog.h>
17 #include <LayoutBuilder.h>
18 #include <StringView.h>
19 
20 #include <stdio.h>
21 
22 #undef B_TRANSLATION_CONTEXT
23 #define B_TRANSLATION_CONTEXT "BMPView"
24 
25 
26 BMPView::BMPView(const BRect &frame, const char *name, uint32 resizeMode,
27 		uint32 flags, TranslatorSettings *settings)
28 	: BView(frame, name, resizeMode, flags)
29 {
30 	fSettings = settings;
31 	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
32 
33 	BStringView *titleView = new BStringView("title",
34 		B_TRANSLATE("BMP image translator"));
35 	titleView->SetFont(be_bold_font);
36 
37 	char version[256];
38 	snprintf(version, sizeof(version), B_TRANSLATE("Version %d.%d.%d, %s"),
39 		int(B_TRANSLATION_MAJOR_VERSION(BMP_TRANSLATOR_VERSION)),
40 		int(B_TRANSLATION_MINOR_VERSION(BMP_TRANSLATOR_VERSION)),
41 		int(B_TRANSLATION_REVISION_VERSION(BMP_TRANSLATOR_VERSION)),
42 		__DATE__);
43 	BStringView *versionView = new BStringView("version", version);
44 	BStringView *copyrightView = new BStringView("Copyright", B_UTF8_COPYRIGHT "2002-2010 Haiku Inc.");
45 
46 	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
47 		.SetInsets(B_USE_DEFAULT_SPACING)
48 		.Add(titleView)
49 		.Add(versionView)
50 		.Add(copyrightView)
51 		.AddGlue();
52 }
53 
54 
55 BMPView::~BMPView()
56 {
57 	fSettings->Release();
58 }
59 
60