xref: /haiku/src/add-ons/translators/ico/ConfigView.cpp (revision 1c09002cbee8e797a0f8bbfc5678dfadd39ee1a7)
1 /*
2  * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "ConfigView.h"
8 #include "ICOTranslator.h"
9 
10 #include <Catalog.h>
11 #include <CheckBox.h>
12 #include <ControlLook.h>
13 #include <SpaceLayoutItem.h>
14 #include <StringView.h>
15 
16 #include <stdio.h>
17 #include <string.h>
18 
19 #undef B_TRANSLATE_CONTEXT
20 #define B_TRANSLATE_CONTEXT "ConfigView"
21 
22 
23 ConfigView::ConfigView()
24 	:
25 	BGroupView(B_TRANSLATE("ICOTranslator Settings"), B_VERTICAL, 0)
26 {
27 	BAlignment leftAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
28 
29 	BStringView* stringView = new BStringView("title",
30 		B_TRANSLATE("Windows icon images"));
31 	stringView->SetFont(be_bold_font);
32 	stringView->SetExplicitAlignment(leftAlignment);
33 	AddChild(stringView);
34 
35 	float spacing = be_control_look->DefaultItemSpacing();
36 	AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
37 
38 	char version[256];
39 	sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
40 		int(B_TRANSLATION_MAJOR_VERSION(ICO_TRANSLATOR_VERSION)),
41 		int(B_TRANSLATION_MINOR_VERSION(ICO_TRANSLATOR_VERSION)),
42 		int(B_TRANSLATION_REVISION_VERSION(ICO_TRANSLATOR_VERSION)),
43 		__DATE__);
44 	stringView = new BStringView("version", version);
45 	stringView->SetExplicitAlignment(leftAlignment);
46 	AddChild(stringView);
47 
48 	stringView = new BStringView("copyright",
49 		B_UTF8_COPYRIGHT "2005-2006 Haiku Inc.");
50 	stringView->SetExplicitAlignment(leftAlignment);
51 	AddChild(stringView);
52 
53 	AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
54 
55 	BCheckBox *checkBox = new BCheckBox("color",
56 		B_TRANSLATE("Write 32 bit images on true color input"), NULL);
57 	checkBox->SetExplicitAlignment(leftAlignment);
58 	AddChild(checkBox);
59 
60 	checkBox = new BCheckBox("size", B_TRANSLATE("Enforce valid icon sizes"),
61 		NULL);
62 	checkBox->SetValue(1);
63 	checkBox->SetExplicitAlignment(leftAlignment);
64 	AddChild(checkBox);
65 
66 	AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
67 
68 	stringView = new BStringView("valid1",
69 		B_TRANSLATE("Valid icon sizes are 16, 32, or 48"));
70 	stringView->SetExplicitAlignment(leftAlignment);
71 	AddChild(stringView);
72 
73 	stringView = new BStringView("valid2",
74 		B_TRANSLATE("pixels in either direction."));
75 	stringView->SetExplicitAlignment(leftAlignment);
76 	AddChild(stringView);
77 
78 	AddChild(BSpaceLayoutItem::CreateGlue());
79 	GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
80 		B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
81 
82 	SetExplicitPreferredSize(GroupLayout()->MinSize());
83 }
84 
85 
86 ConfigView::~ConfigView()
87 {
88 }
89 
90