void DataView::UpdateScroller() { float width, height; GetPreferredSize(&width, &height); SetExplicitMinSize(BSize(250, 200)); SetExplicitMaxSize(BSize(B_SIZE_UNSET, height)); SetExplicitPreferredSize(BSize(width, height)); BScrollBar *bar; if ((bar = ScrollBar(B_HORIZONTAL)) != NULL) { float delta = width - Bounds().Width(); if (delta < 0) delta = 0; bar->SetRange(0, delta); bar->SetSteps(fCharWidth, Bounds().Width()); bar->SetProportion(Bounds().Width() / width); } if ((bar = ScrollBar(B_VERTICAL)) != NULL) { float delta = height - Bounds().Height(); if (delta < 0) delta = 0; bar->SetRange(0, delta); bar->SetSteps(fFontHeight, Bounds().Height()); bar->SetProportion(Bounds().Height() / height); } }
GearsView::GearsView() : BView("GearsView", B_WILL_DRAW), fGears(NULL) { SetExplicitMinSize(BSize(64.0 + 10.0, B_SIZE_UNSET)); SetExplicitPreferredSize(BSize(64.0 + 10.0, B_SIZE_UNLIMITED)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR); _InitGearsBitmap(); }
HVIFView::HVIFView(const char* name, uint32 flags, TranslatorSettings *settings) : BView(name, flags, new BGroupLayout(B_VERTICAL)), fSettings(settings) { BAlignment labelAlignment(B_ALIGN_LEFT, B_ALIGN_NO_VERTICAL); BStringView* title= new BStringView("title", B_TRANSLATE("Native Haiku icon format translator")); title->SetFont(be_bold_font); title->SetExplicitAlignment(labelAlignment); char versionString[256]; snprintf(versionString, sizeof(versionString), B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(HVIF_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(HVIF_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(HVIF_TRANSLATOR_VERSION)), __DATE__); BStringView* version = new BStringView("version", versionString); version->SetExplicitAlignment(labelAlignment); BStringView* copyright = new BStringView("copyright", B_UTF8_COPYRIGHT"2009 Haiku Inc."); copyright->SetExplicitAlignment(labelAlignment); int32 renderSize = fSettings->SetGetInt32(HVIF_SETTING_RENDER_SIZE); BString label = B_TRANSLATE("Render size:"); label << " " << renderSize; fRenderSize = new BSlider("renderSize", label.String(), NULL, 1, 32, B_HORIZONTAL); fRenderSize->SetValue(renderSize / 8); fRenderSize->SetHashMarks(B_HASH_MARKS_BOTTOM); fRenderSize->SetHashMarkCount(16); fRenderSize->SetModificationMessage( new BMessage(HVIF_SETTING_RENDER_SIZE_CHANGED)); fRenderSize->SetExplicitAlignment(labelAlignment); float padding = 5.0f; BLayoutBuilder::Group<>(this, B_VERTICAL, padding) .SetInsets(padding) .Add(title) .Add(version) .Add(copyright) .Add(fRenderSize) .AddGlue(); BFont font; GetFont(&font); SetExplicitPreferredSize( BSize((font.Size() * 270) / 12, (font.Size() * 100) / 12)); }
TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings) : BView(name, flags), fSettings(settings) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ViewColor()); fTitle = new BStringView("title", B_TRANSLATE("TGA Image Translator")); fTitle->SetFont(be_bold_font); char detail[100]; sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"), static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TGA_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_MINOR_VERSION(TGA_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_REVISION_VERSION( TGA_TRANSLATOR_VERSION)), __DATE__); fDetail = new BStringView("detail", detail); fWrittenBy = new BStringView("writtenby", B_TRANSLATE("Written by the Haiku Translation Kit Team")); fpchkIgnoreAlpha = new BCheckBox(B_TRANSLATE("Ignore TGA alpha channel"), new BMessage(CHANGE_IGNORE_ALPHA)); int32 val = (fSettings->SetGetBool(TGA_SETTING_IGNORE_ALPHA)) ? 1 : 0; fpchkIgnoreAlpha->SetValue(val); fpchkIgnoreAlpha->SetViewColor(ViewColor()); fpchkRLE = new BCheckBox(B_TRANSLATE("Save with RLE Compression"), new BMessage(CHANGE_RLE)); val = (fSettings->SetGetBool(TGA_SETTING_RLE)) ? 1 : 0; fpchkRLE->SetValue(val); fpchkRLE->SetViewColor(ViewColor()); // Build the layout SetLayout(new BGroupLayout(B_HORIZONTAL)); AddChild(BGroupLayoutBuilder(B_VERTICAL, 7) .Add(fTitle) .Add(fDetail) .AddGlue() .Add(fpchkIgnoreAlpha) .Add(fpchkRLE) .AddGlue() .Add(fWrittenBy) .AddGlue() .SetInsets(5, 5, 5, 5) ); BFont font; GetFont(&font); SetExplicitPreferredSize(BSize((font.Size() * 333)/12, (font.Size() * 200)/12)); }
ConfigView::ConfigView(TranslatorSettings *settings) : BGroupView("ICNSTranslator Settings", B_VERTICAL, 0) { fSettings = settings; BStringView *titleView = new BStringView("title", B_TRANSLATE("Apple icon translator")); titleView->SetFont(be_bold_font); char version[256]; sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(ICNS_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(ICNS_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(ICNS_TRANSLATOR_VERSION)), __DATE__); BStringView *versionView = new BStringView("version", version); BStringView *copyrightView = new BStringView("copyright", B_UTF8_COPYRIGHT "2005-2006 Haiku Inc."); BStringView *copyright2View = new BStringView("my_copyright", B_UTF8_COPYRIGHT "2012 Gerasim Troeglazov <*****@*****.**>."); BStringView *infoView = new BStringView("support_sizes", B_TRANSLATE("Valid sizes: 16, 32, 48, 128, 256, 512, 1024")); BStringView *info2View = new BStringView("support_colors", B_TRANSLATE("Valid colors: RGB32, RGBA32")); BStringView *copyright3View = new BStringView("copyright3", "libicns v0.8.1\n"); BStringView *copyright4View = new BStringView("copyright4", "2001-2012 Mathew Eis <*****@*****.**>"); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(B_USE_DEFAULT_SPACING) .Add(titleView) .Add(versionView) .Add(copyrightView) .Add(copyright2View) .AddGlue() .Add(infoView) .Add(info2View) .AddGlue() .Add(copyright3View) .Add(copyright4View); SetExplicitPreferredSize(GroupLayout()->MinSize()); }
ConfigView::ConfigView(uint32 flags) : BView("EXRTranslator Settings", flags) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BStringView *fTitle = new BStringView("title", B_TRANSLATE("EXR image translator")); fTitle->SetFont(be_bold_font); char version[256]; sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(EXR_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(EXR_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(EXR_TRANSLATOR_VERSION)), __DATE__); BStringView *fVersion = new BStringView("version", version); BStringView *fCopyright = new BStringView("copyright", B_UTF8_COPYRIGHT "2008 Haiku Inc."); BStringView *fCopyright2 = new BStringView("copyright2", B_TRANSLATE("Based on OpenEXR (http://www.openexr.com)")); BStringView *fCopyright3 = new BStringView("copyright3", B_UTF8_COPYRIGHT "2006, Industrial Light & Magic,"); BStringView *fCopyright4 = new BStringView("copyright4", B_TRANSLATE("a division of Lucasfilm Entertainment Company Ltd")); // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL, 7) .SetInsets(5) .Add(fTitle) .Add(fVersion) .AddGlue() .Add(fCopyright) .Add(fCopyright2) .AddGlue() .Add(fCopyright3) .Add(fCopyright4) .AddGlue(); BFont font; GetFont(&font); SetExplicitPreferredSize(BSize(font.Size() * 400 / 12, font.Size() * 200 / 12)); }
ConfigView::ConfigView(uint32 flags) : BView(kShortName2, flags) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BStringView *fTitle = new BStringView("title", B_TRANSLATE("RAW image translator")); fTitle->SetFont(be_bold_font); char version[256]; sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(RAW_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(RAW_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(RAW_TRANSLATOR_VERSION)), __DATE__); BStringView *fVersion = new BStringView("version", version); BStringView *fCopyright = new BStringView("copyright", B_UTF8_COPYRIGHT "2007-2009 Haiku Inc."); BStringView *fCopyright2 = new BStringView("copyright2", B_TRANSLATE("Based on Dave Coffin's dcraw 8.63")); BStringView *fCopyright3 = new BStringView("copyright3", B_UTF8_COPYRIGHT "1997-2007 Dave Coffin"); // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(B_USE_DEFAULT_SPACING) .Add(fTitle) .Add(fVersion) .Add(fCopyright) .AddGlue() .Add(fCopyright2) .Add(fCopyright3); BFont font; GetFont(&font); SetExplicitPreferredSize(BSize((font.Size() * 233)/12, (font.Size() * 200)/12)); }
SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings) : BView(name, flags, new BGroupLayout(B_VERTICAL)), fSettings(settings) { BPopUpMenu* menu = new BPopUpMenu("pick compression"); uint32 currentCompression = fSettings->SetGetInt32(SGI_SETTING_COMPRESSION); // create the menu items with the various compression methods add_menu_item(menu, SGI_COMP_NONE, B_TRANSLATE("None"), currentCompression); //menu->AddSeparatorItem(); add_menu_item(menu, SGI_COMP_RLE, B_TRANSLATE("RLE"), currentCompression); // DON'T turn this on, it's so slow that I didn't wait long enough // the one time I tested this. So I don't know if the code even works. // Supposedly, this would look for an already written scanline, and // modify the scanline tables so that the current row is not written // at all... //add_menu_item(menu, SGI_COMP_ARLE, "Agressive RLE", currentCompression); fCompressionMF = new BMenuField("compression", B_TRANSLATE("Use compression:"), menu); BAlignment labelAlignment(B_ALIGN_LEFT, B_ALIGN_NO_VERTICAL); BStringView* titleView = new BStringView("title", B_TRANSLATE("SGI image translator")); titleView->SetFont(be_bold_font); titleView->SetExplicitAlignment(labelAlignment); char detail[100]; sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"), static_cast<int>(B_TRANSLATION_MAJOR_VERSION(SGI_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_MINOR_VERSION(SGI_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_REVISION_VERSION( SGI_TRANSLATOR_VERSION)), __DATE__); BStringView* detailView = new BStringView("details", detail); detailView->SetExplicitAlignment(labelAlignment); BTextView* infoView = new BTextView("info"); infoView->SetText(BString(B_TRANSLATE("written by:\n")) .Append(author) .Append(B_TRANSLATE("\n\nbased on GIMP SGI plugin v1.5:\n")) .Append(kSGICopyright).String()); infoView->SetExplicitAlignment(labelAlignment); infoView->SetWordWrap(false); infoView->MakeEditable(false); infoView->MakeResizable(true); infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); float padding = 5.0f; BLayoutBuilder::Group<>(this, B_VERTICAL, padding) .SetInsets(padding) .Add(titleView) .Add(detailView) .AddGroup(B_HORIZONTAL) .Add(fCompressionMF) .AddGlue() .End() .Add(infoView) .AddGlue(); BFont font; GetFont(&font); SetExplicitPreferredSize(BSize((font.Size() * 390) / 12, (font.Size() * 180) / 12)); // TODO: remove this workaround for ticket #4217 infoView->SetExplicitPreferredSize( BSize(infoView->LineWidth(4), infoView->TextHeight(0, 80))); infoView->SetExplicitMaxSize(infoView->ExplicitPreferredSize()); infoView->SetExplicitMinSize(infoView->ExplicitPreferredSize()); }
// --------------------------------------------------------------- // Constructor // // Sets up the view settings // // Preconditions: // // Parameters: // // Postconditions: // // Returns: // --------------------------------------------------------------- TIFFView::TIFFView(const char *name, uint32 flags, TranslatorSettings *settings) : BView(name, flags) { fSettings = settings; SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ViewColor()); fTitle = new BStringView("title", "TIFF Image Translator"); fTitle->SetFont(be_bold_font); char detail[100]; sprintf(detail, "Version %d.%d.%d %s", static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TIFF_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_MINOR_VERSION(TIFF_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_REVISION_VERSION(TIFF_TRANSLATOR_VERSION)), __DATE__); fDetail = new BStringView("detail", detail); int16 i = 1; fLibTIFF[0] = new BStringView(NULL, "TIFF Library:"); char libtiff[] = TIFFLIB_VERSION_STR; char *tok = strtok(libtiff, "\n"); while (i < 5 && tok) { fLibTIFF[i] = new BStringView(NULL, tok); tok = strtok(NULL, "\n"); i++; } BPopUpMenu* menu = new BPopUpMenu("pick compression"); uint32 currentCompression = fSettings->SetGetInt32(TIFF_SETTING_COMPRESSION); // create the menu items with the various compression methods add_menu_item(menu, COMPRESSION_NONE, "None", currentCompression); menu->AddSeparatorItem(); add_menu_item(menu, COMPRESSION_PACKBITS, "RLE (Packbits)", currentCompression); add_menu_item(menu, COMPRESSION_DEFLATE, "ZIP (Deflate)", currentCompression); add_menu_item(menu, COMPRESSION_LZW, "LZW", currentCompression); // TODO: the disabled compression modes are not configured in libTIFF // menu->AddSeparatorItem(); // add_menu_item(menu, COMPRESSION_JPEG, "JPEG", currentCompression); // TODO ? - strip encoding is not implemented in libTIFF for this compression // add_menu_item(menu, COMPRESSION_JP2000, "JPEG2000", currentCompression); fCompressionMF = new BMenuField("Use Compression:", menu, NULL); // Build the layout SetLayout(new BGroupLayout(B_VERTICAL)); i = 0; AddChild(BGroupLayoutBuilder(B_VERTICAL, 7) .Add(fTitle) .Add(fDetail) .AddGlue() .Add(fCompressionMF) .AddGlue() .Add(fLibTIFF[0]) .Add(fLibTIFF[1]) .Add(fLibTIFF[2]) .Add(fLibTIFF[3]) // Theses 4 adding above work because we know there are 4 strings // but it's fragile: one string less in the library version and the application breaks .AddGlue() .SetInsets(5, 5, 5, 5) ); BFont font; GetFont(&font); SetExplicitPreferredSize(BSize((font.Size() * 350)/12, (font.Size() * 200)/12)); }
ConfigView::ConfigView(TranslatorSettings* settings) : BGroupView(B_TRANSLATE("WebPTranslator Settings"), B_VERTICAL), fSettings(settings) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BStringView* title = new BStringView("title", B_TRANSLATE("WebP image translator")); title->SetFont(be_bold_font); char versionString[256]; sprintf(versionString, "v%d.%d.%d, %s", static_cast<int>(B_TRANSLATION_MAJOR_VERSION(WEBP_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_MINOR_VERSION(WEBP_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_REVISION_VERSION( WEBP_TRANSLATOR_VERSION)), __DATE__); BStringView* version = new BStringView("version", versionString); BString copyrightsText; BStringView *copyrightView = new BStringView("Copyright", B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Haiku Inc.")); BStringView *copyright2View = new BStringView("Copyright2", B_TRANSLATE("Based on libwebp v0.1,")); BStringView *copyright3View = new BStringView("Copyright3", B_TRANSLATE(B_UTF8_COPYRIGHT "2010-2011 Google Inc.")); // output parameters fPresetsMenu = new BPopUpMenu(B_TRANSLATE("Preset")); const struct preset_name* preset = kPresetNames; while (preset->name != NULL) { BMessage* msg = new BMessage(kMsgPreset); msg->AddInt32("value", preset->id); BMenuItem* item = new BMenuItem(preset->name, msg); if (fSettings->SetGetInt32(WEBP_SETTING_PRESET) == preset->id) item->SetMarked(true); fPresetsMenu->AddItem(item); preset++; } BMenuField* presetsField = new BMenuField(B_TRANSLATE("Output preset:"), fPresetsMenu); fQualitySlider = new BSlider("quality", B_TRANSLATE("Output quality:"), new BMessage(kMsgQuality), 0, 100, B_HORIZONTAL, B_BLOCK_THUMB); fQualitySlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fQualitySlider->SetHashMarkCount(10); fQualitySlider->SetLimitLabels(B_TRANSLATE("Low"), B_TRANSLATE("High")); fQualitySlider->SetValue(fSettings->SetGetInt32(WEBP_SETTING_QUALITY)); fMethodSlider = new BSlider("method", B_TRANSLATE("Compression method:"), new BMessage(kMsgMethod), 0, 6, B_HORIZONTAL, B_BLOCK_THUMB); fMethodSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fMethodSlider->SetHashMarkCount(7); fMethodSlider->SetLimitLabels(B_TRANSLATE("Fast"), B_TRANSLATE("Slower but better")); fMethodSlider->SetValue(fSettings->SetGetInt32(WEBP_SETTING_METHOD)); fPreprocessingCheckBox = new BCheckBox("preprocessing", B_TRANSLATE("Preprocessing filter"), new BMessage(kMsgPreprocessing)); if (fSettings->SetGetBool(WEBP_SETTING_PREPROCESSING)) fPreprocessingCheckBox->SetValue(B_CONTROL_ON); // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(B_USE_DEFAULT_SPACING) .Add(title) .Add(version) .Add(copyrightView) .AddGlue() .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING) .Add(presetsField->CreateLabelLayoutItem(), 0, 0) .AddGroup(B_HORIZONTAL, 0.0f, 1, 0) .Add(presetsField->CreateMenuBarLayoutItem(), 0.0f) .AddGlue() .End() .End() .Add(fQualitySlider) .Add(fMethodSlider) .Add(fPreprocessingCheckBox) .AddGlue() .Add(copyright2View) .Add(copyright3View); BFont font; GetFont(&font); SetExplicitPreferredSize(BSize((font.Size() * 250) / 12, (font.Size() * 350) / 12)); }
ConfigView::ConfigView(TranslatorSettings *settings) : BGroupView(B_TRANSLATE("PSDTranslator Settings"), B_VERTICAL, 0) { fSettings = settings; BPopUpMenu* compressionPopupMenu = new BPopUpMenu("popup_compression"); uint32 currentCompression = fSettings->SetGetInt32(PSD_SETTING_COMPRESSION); _AddItemToMenu(compressionPopupMenu, B_TRANSLATE("Uncompressed"), MSG_COMPRESSION_CHANGED, PSD_COMPRESSED_RAW, currentCompression); _AddItemToMenu(compressionPopupMenu, B_TRANSLATE("RLE"), MSG_COMPRESSION_CHANGED, PSD_COMPRESSED_RLE, currentCompression); fCompressionField = new BMenuField("compression", B_TRANSLATE("Compression: "), compressionPopupMenu); fCompressionField->SetAlignment(B_ALIGN_RIGHT); BPopUpMenu* versionPopupMenu = new BPopUpMenu("popup_version"); uint32 currentVersion = fSettings->SetGetInt32(PSD_SETTING_VERSION); _AddItemToMenu(versionPopupMenu, B_TRANSLATE("Photoshop Document (PSD file)"), MSG_VERSION_CHANGED, PSD_FILE, currentVersion); _AddItemToMenu(versionPopupMenu, B_TRANSLATE("Photoshop Big Document (PSB file)"), MSG_VERSION_CHANGED, PSB_FILE, currentVersion); fVersionField = new BMenuField("version", B_TRANSLATE("Format: "), versionPopupMenu); fVersionField->SetAlignment(B_ALIGN_RIGHT); BStringView *titleView = new BStringView("title", B_TRANSLATE("Photoshop image translator")); titleView->SetFont(be_bold_font); char version[256]; sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(PSD_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(PSD_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(PSD_TRANSLATOR_VERSION)), __DATE__); BStringView *versionView = new BStringView("version", version); BStringView *copyrightView = new BStringView("copyright", B_UTF8_COPYRIGHT "2005-2013 Haiku Inc."); BStringView *copyright2View = new BStringView("my_copyright", B_UTF8_COPYRIGHT "2012-2013 Gerasim Troeglazov <*****@*****.**>"); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(B_USE_DEFAULT_SPACING) .Add(titleView) .Add(versionView) .Add(copyrightView) .AddGlue() .AddGrid(10.0f, 5.0f) .Add(fVersionField->CreateLabelLayoutItem(), 0, 0) .Add(fVersionField->CreateMenuBarLayoutItem(), 1, 0) .Add(fCompressionField->CreateLabelLayoutItem(), 0, 1) .Add(fCompressionField->CreateMenuBarLayoutItem(), 1, 1) .End() .AddGlue() .Add(copyright2View); SetExplicitPreferredSize(GroupLayout()->MinSize()); }
ConfigView::ConfigView(TranslatorSettings *settings) : BGroupView("ICNSTranslator Settings", B_VERTICAL, 0) { fSettings = settings; BAlignment leftAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET); BStringView *stringView = new BStringView("title", "OptiPNG Translator"); stringView->SetFont(be_bold_font); stringView->SetExplicitAlignment(leftAlignment); AddChild(stringView); float spacing = be_control_look->DefaultItemSpacing(); AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing)); char version[256]; sprintf(version, "Version %d.%d.%d, %s", int(B_TRANSLATION_MAJOR_VERSION(OPTIPNG_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(OPTIPNG_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(OPTIPNG_TRANSLATOR_VERSION)), __DATE__); stringView = new BStringView("version", version); stringView->SetExplicitAlignment(leftAlignment); AddChild(stringView); stringView = new BStringView("my_copyright", B_UTF8_COPYRIGHT "2013 Luke <*****@*****.**>."); stringView->SetExplicitAlignment(leftAlignment); AddChild(stringView); AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing)); fOptimizationLevel = new BSlider( "optimization", "Optimization level:", new BMessage(kMsgOptim), 0, 7, B_HORIZONTAL, B_BLOCK_THUMB); fOptimizationLevel->SetHashMarks(B_HASH_MARKS_BOTTOM); fOptimizationLevel->SetHashMarkCount(8); fOptimizationLevel->SetLimitLabels("Low", "High"); fOptimizationLevel->SetValue( fSettings->SetGetInt32(OPTIPNG_SETTING_OPTIMIZATION_LEVEL)); AddChild(fOptimizationLevel); fBitDepthCheckBox = new BCheckBox((char*)OPTIPNG_SETTING_BIT_DEPTH_REDUCTION, "Reduce bit depth:", new BMessage(kMsgBitDepth)); if (fSettings->SetGetBool(OPTIPNG_SETTING_BIT_DEPTH_REDUCTION)) fBitDepthCheckBox->SetValue(B_CONTROL_ON); AddChild(fBitDepthCheckBox); fColorTypeCheckBox = new BCheckBox((char*)OPTIPNG_SETTING_COLOR_TYPE_REDUCTION, "Reduce color type:", new BMessage(kMsgColorType)); if (fSettings->SetGetBool(OPTIPNG_SETTING_COLOR_TYPE_REDUCTION)) fColorTypeCheckBox->SetValue(B_CONTROL_ON); AddChild(fColorTypeCheckBox); fPaletteCheckBox = new BCheckBox((char*)OPTIPNG_SETTING_PALETTE_REDUCTION, "Reduce palette size:", new BMessage(kMsgPaletteReduc)); if (fSettings->SetGetBool(OPTIPNG_SETTING_PALETTE_REDUCTION)) fPaletteCheckBox->SetValue(B_CONTROL_ON); AddChild(fPaletteCheckBox); AddChild(BSpaceLayoutItem::CreateGlue()); GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING); SetExplicitPreferredSize(GroupLayout()->MinSize()); }