* Update opengl preflet to fix regression from r38512
* Refactor code, especially layout-related, there were way too many views being created * Remove empty hook methods * Fix a bug which caused the convolution capabilities to be misrepresented as 0x0 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38514 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,230 +1,137 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Copyright 2009-2010 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#include "CapabilitiesView.h"
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <Message.h>
|
||||
#include <String.h>
|
||||
#include <StringView.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "Capabilities"
|
||||
|
||||
|
||||
void
|
||||
AddStringView(BView* view, const char* viewName, const char* name,
|
||||
const char* value, bool spacer)
|
||||
{
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
BRect dummyRect(0, 0, 0, 0);
|
||||
const float kSpacer = 5;
|
||||
|
||||
BString tempViewName(viewName);
|
||||
BStringView *nameView = new BStringView(dummyRect, tempViewName.String(),
|
||||
name, B_FOLLOW_NONE);
|
||||
tempViewName.Append("Value");
|
||||
BStringView *valueView = new BStringView(dummyRect, tempViewName.String(),
|
||||
value, B_FOLLOW_NONE);
|
||||
|
||||
if (spacer) {
|
||||
view->AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(nameView)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(valueView)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
);
|
||||
} else {
|
||||
view->AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(nameView)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(valueView)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const BAlignment kNameAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
|
||||
const BAlignment kValueAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET);
|
||||
|
||||
|
||||
CapabilitiesView::CapabilitiesView()
|
||||
: BView(B_TRANSLATE("Capabilities"), 0, NULL)
|
||||
:
|
||||
BGridView(B_TRANSLATE("Capabilities"))
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
_AddCapability(GL_AUX_BUFFERS, B_TRANSLATE("Auxiliary buffer(s):"));
|
||||
|
||||
const float kInset = 10;
|
||||
_AddCapability(GL_MAX_MODELVIEW_STACK_DEPTH,
|
||||
B_TRANSLATE("Model stack size:"));
|
||||
|
||||
int lights = 0;
|
||||
int clippingPlanes = 0;
|
||||
int modelStack = 0;
|
||||
int projectionStack = 0;
|
||||
int textureStack = 0;
|
||||
int maxTex3d = 0;
|
||||
int maxTex2d = 0;
|
||||
int nameStack = 0;
|
||||
int listStack = 0;
|
||||
int maxPoly = 0;
|
||||
int attribStack = 0;
|
||||
int buffers = 0;
|
||||
int convolutionWidth = 0;
|
||||
int convolutionHeight = 0;
|
||||
int maxIndex = 0;
|
||||
int maxVertex = 0;
|
||||
int textureUnits = 0;
|
||||
_AddCapability(GL_MAX_PROJECTION_STACK_DEPTH,
|
||||
B_TRANSLATE("Projection stack size:"));
|
||||
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &lights);
|
||||
glGetIntegerv(GL_MAX_CLIP_PLANES, &clippingPlanes);
|
||||
glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &modelStack);
|
||||
glGetIntegerv(GL_MAX_PROJECTION_STACK_DEPTH, &projectionStack);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_STACK_DEPTH, &textureStack);
|
||||
glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &maxTex3d);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTex2d);
|
||||
glGetIntegerv(GL_MAX_NAME_STACK_DEPTH, &nameStack);
|
||||
glGetIntegerv(GL_MAX_LIST_NESTING, &listStack);
|
||||
glGetIntegerv(GL_MAX_EVAL_ORDER, &maxPoly);
|
||||
glGetIntegerv(GL_MAX_ATTRIB_STACK_DEPTH, &attribStack);
|
||||
glGetIntegerv(GL_AUX_BUFFERS, &buffers);
|
||||
glGetIntegerv(GL_MAX_CONVOLUTION_WIDTH, &convolutionWidth);
|
||||
glGetIntegerv(GL_MAX_CONVOLUTION_HEIGHT, &convolutionHeight);
|
||||
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &maxIndex);
|
||||
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &maxVertex);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &textureUnits);
|
||||
_AddCapability(GL_MAX_TEXTURE_STACK_DEPTH,
|
||||
B_TRANSLATE("Texture stack size:"));
|
||||
|
||||
BString tempString;
|
||||
BView *rootView = new BView("root view", 0, NULL);
|
||||
rootView->SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
_AddCapability(GL_MAX_NAME_STACK_DEPTH, B_TRANSLATE("Name stack size:"));
|
||||
|
||||
tempString << (int32) buffers;
|
||||
AddStringView(rootView, "Buffers", B_TRANSLATE("Auxiliary buffer(s):"),
|
||||
tempString.String(), true);
|
||||
_AddCapability(GL_MAX_LIST_NESTING, B_TRANSLATE("List stack size:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) modelStack;
|
||||
AddStringView(rootView, "ModelStack", B_TRANSLATE("Model stack size:"),
|
||||
tempString.String(), true);
|
||||
_AddCapability(GL_MAX_ATTRIB_STACK_DEPTH,
|
||||
B_TRANSLATE("Attributes stack size:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) projectionStack;
|
||||
AddStringView(rootView, "ProjectionStack",
|
||||
B_TRANSLATE("Projection stack size:"), tempString.String(), true);
|
||||
_AddCapability(GL_MAX_TEXTURE_SIZE, B_TRANSLATE("Max. 2D texture size:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) textureStack;
|
||||
AddStringView(rootView, "TextureStack", B_TRANSLATE("Texture stack size:"),
|
||||
tempString.String(), true);
|
||||
_AddCapability(GL_MAX_3D_TEXTURE_SIZE,
|
||||
B_TRANSLATE("Max. 3D texture size:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) nameStack;
|
||||
AddStringView(rootView, "NameStack", B_TRANSLATE("Name stack size:"),
|
||||
tempString.String(), true);
|
||||
_AddCapability(GL_MAX_TEXTURE_UNITS_ARB,
|
||||
B_TRANSLATE("Max. texture units:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) listStack;
|
||||
AddStringView(rootView, "ListStack", B_TRANSLATE("List stack size:"),
|
||||
tempString.String(), true);
|
||||
_AddCapability(GL_MAX_LIGHTS, B_TRANSLATE("Max. lights:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) attribStack;
|
||||
AddStringView(rootView, "AttribStack", B_TRANSLATE("Attributes stack size:"),
|
||||
tempString.String(), true);
|
||||
_AddCapability(GL_MAX_CLIP_PLANES, B_TRANSLATE("Max. clipping planes:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxTex3d;
|
||||
AddStringView(rootView, "MaxTex3D", B_TRANSLATE("Max. 3D texture size:"),
|
||||
tempString.String(), true);
|
||||
_AddCapability(GL_MAX_EVAL_ORDER,
|
||||
B_TRANSLATE("Max. evaluators equation order:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxTex2d;
|
||||
AddStringView(rootView, "MaxTex2D", B_TRANSLATE("Max. 2D texture size:"),
|
||||
tempString.String(), true);
|
||||
_AddConvolutionCapability();
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) textureUnits;
|
||||
AddStringView(rootView, "MaxTexUnits", B_TRANSLATE("Max. texture units:"),
|
||||
tempString.String(), true);
|
||||
_AddCapability(GL_MAX_ELEMENTS_INDICES,
|
||||
B_TRANSLATE("Max. recommended index elements:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) lights;
|
||||
AddStringView(rootView, "MaxLights", B_TRANSLATE("Max. lights:"),
|
||||
tempString.String(), true);
|
||||
_AddCapability(GL_MAX_ELEMENTS_VERTICES,
|
||||
B_TRANSLATE("Max. recommended vertex elements:"));
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) clippingPlanes;
|
||||
AddStringView(rootView, "MaxClippingPlanes",
|
||||
B_TRANSLATE("Max. clipping planes:"), tempString.String(), true);
|
||||
BGridLayout* layout = GridLayout();
|
||||
layout->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxPoly;
|
||||
AddStringView(rootView, "MaxPoly",
|
||||
B_TRANSLATE("Max. evaluators equation order:"),
|
||||
tempString.String(), true);
|
||||
layout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, layout->CountRows(),
|
||||
layout->CountColumns(), 1);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) convolutionWidth << "x" << convolutionHeight;
|
||||
AddStringView(rootView, "MaxConvultion", B_TRANSLATE("Max. convolution:"),
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxIndex;
|
||||
AddStringView(rootView, "MaxIndex",
|
||||
B_TRANSLATE("Max. recommended index elements:"),
|
||||
tempString.String(), true);
|
||||
|
||||
tempString.SetTo("");
|
||||
tempString << (int32) maxVertex;
|
||||
AddStringView(rootView, "MaxVertex",
|
||||
B_TRANSLATE("Max. recommended vertex elements:"),
|
||||
tempString.String(), true);
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(rootView)
|
||||
.SetInsets(kInset, kInset, kInset, kInset)
|
||||
);
|
||||
float spacing = be_control_look->DefaultItemSpacing();
|
||||
layout->SetHorizontalSpacing(spacing / 2.0f);
|
||||
// divide by two to compensate for empty column 1
|
||||
}
|
||||
|
||||
|
||||
CapabilitiesView::~CapabilitiesView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CapabilitiesView::MessageReceived(BMessage* message)
|
||||
CapabilitiesView::_AddCapability(GLenum capability, const char* name)
|
||||
{
|
||||
switch (message->what) {
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
int value = 0;
|
||||
glGetIntegerv(capability, &value);
|
||||
_AddCapabilityView(name, BString() << (int32)value);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CapabilitiesView::AttachedToWindow()
|
||||
CapabilitiesView::_AddCapabilityView(const char* name, const char* value)
|
||||
{
|
||||
BStringView *nameView = new BStringView(NULL, name);
|
||||
nameView->SetExplicitAlignment(kNameAlignment);
|
||||
|
||||
BStringView *valueView = new BStringView(NULL, value);
|
||||
valueView->SetExplicitAlignment(kValueAlignment);
|
||||
|
||||
// Add the items at the bottom of our grid with a column inbetween
|
||||
int32 row = GridLayout()->CountRows();
|
||||
BLayoutBuilder::Grid<>(this)
|
||||
.Add(nameView, 0, row)
|
||||
.Add(valueView, 2, row);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CapabilitiesView::DetachedFromWindow()
|
||||
CapabilitiesView::_AddConvolutionCapability()
|
||||
{
|
||||
int width = 0;
|
||||
glGetConvolutionParameteriv(GL_CONVOLUTION_2D,
|
||||
GL_MAX_CONVOLUTION_WIDTH, &width);
|
||||
|
||||
int height = 0;
|
||||
glGetConvolutionParameteriv(GL_CONVOLUTION_2D,
|
||||
GL_MAX_CONVOLUTION_HEIGHT, &height);
|
||||
|
||||
BString convolution;
|
||||
convolution << (int32) width << 'x' << (int32) height;
|
||||
_AddCapabilityView(B_TRANSLATE("Max. convolution:"), convolution);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Copyright 2009-2010 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#ifndef CAPABILITIES_VIEW_H
|
||||
#define CAPABILITIES_VIEW_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
#include <GridView.h>
|
||||
|
||||
class CapabilitiesView : public BView {
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
||||
class CapabilitiesView : public BGridView {
|
||||
public:
|
||||
CapabilitiesView();
|
||||
virtual ~CapabilitiesView();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
private:
|
||||
void _AddCapability(GLenum capability, const char* name);
|
||||
void _AddCapabilityView(const char* name, const char* value);
|
||||
void _AddConvolutionCapability();
|
||||
};
|
||||
|
||||
#endif /* CAPABILITIES_VIEW_H */
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Copyright 2009-2010 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
#include "ExtensionsView.h"
|
||||
@@ -24,56 +25,27 @@
|
||||
|
||||
|
||||
ExtensionsView::ExtensionsView()
|
||||
: BView(B_TRANSLATE("Extensions"), 0, NULL)
|
||||
:
|
||||
BGroupView(B_TRANSLATE("Extensions"), B_VERTICAL)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
const float kInset = 10;
|
||||
|
||||
ExtensionsList *extList = new ExtensionsList();
|
||||
|
||||
_AddExtensionsList(extList, (char*) glGetString(GL_EXTENSIONS));
|
||||
_AddExtensionsList(extList, (char*) gluGetString(GLU_EXTENSIONS));
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(extList)
|
||||
.SetInsets(kInset, kInset, kInset, kInset)
|
||||
);
|
||||
AddChild(extList);
|
||||
GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
|
||||
}
|
||||
|
||||
|
||||
ExtensionsView::~ExtensionsView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExtensionsView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExtensionsView::AttachedToWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExtensionsView::DetachedFromWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// #pragma mark
|
||||
|
||||
|
||||
void
|
||||
ExtensionsView::_AddExtensionsList(ExtensionsList *extList, char* stringList)
|
||||
{
|
||||
|
||||
@@ -9,19 +9,15 @@
|
||||
#ifndef EXTENSIONS_VIEW_H
|
||||
#define EXTENSIONS_VIEW_H
|
||||
|
||||
#include <View.h>
|
||||
#include <GroupView.h>
|
||||
|
||||
class ExtensionsList;
|
||||
|
||||
class ExtensionsView : public BView {
|
||||
class ExtensionsView : public BGroupView {
|
||||
public:
|
||||
ExtensionsView();
|
||||
virtual ~ExtensionsView();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
|
||||
private:
|
||||
void _AddExtensionsList(ExtensionsList *extList, char* stringList);
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Copyright 2009-2010 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#include "InfoView.h"
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <Message.h>
|
||||
#include <String.h>
|
||||
#include <StringView.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glut.h>
|
||||
@@ -25,73 +25,35 @@
|
||||
#define B_TRANSLATE_CONTEXT "InfoView"
|
||||
|
||||
|
||||
const BAlignment kLabelAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
|
||||
const BAlignment kValueAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET);
|
||||
|
||||
|
||||
InfoView::InfoView()
|
||||
: BView(B_TRANSLATE("Information"), 0, NULL)
|
||||
:
|
||||
BGridView(B_TRANSLATE("Information"))
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
_AddString(B_TRANSLATE("OpenGL version:"),
|
||||
(const char*)glGetString(GL_VERSION));
|
||||
_AddString(B_TRANSLATE("Vendor name:"),
|
||||
(const char*)glGetString(GL_VENDOR));
|
||||
_AddString(B_TRANSLATE("Renderer name:"),
|
||||
(const char*)glGetString(GL_RENDERER));
|
||||
_AddString(B_TRANSLATE("GLU version:"),
|
||||
(const char*)gluGetString(GLU_VERSION));
|
||||
_AddString(B_TRANSLATE("GLUT API version:"),
|
||||
BString() << (int32)GLUT_API_VERSION);
|
||||
|
||||
BRect dummyRect(0, 0, 0, 0);
|
||||
BGridLayout* layout = GridLayout();
|
||||
layout->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
|
||||
|
||||
BStringView *version = new BStringView(dummyRect, "Version",
|
||||
B_TRANSLATE("OpenGL version:"), B_FOLLOW_NONE);
|
||||
BStringView *versionValue = new BStringView(dummyRect, "VersionVal",
|
||||
(const char*)glGetString(GL_VERSION), B_FOLLOW_NONE);
|
||||
BStringView *vendor = new BStringView(dummyRect, "Vendor",
|
||||
B_TRANSLATE("Vendor name:"), B_FOLLOW_NONE);
|
||||
BStringView *vendorValue = new BStringView(dummyRect, "VendorVal",
|
||||
(const char*)glGetString(GL_VENDOR), B_FOLLOW_NONE);
|
||||
BStringView *renderer = new BStringView(dummyRect, "Renderer",
|
||||
B_TRANSLATE("Renderer name:"), B_FOLLOW_NONE);
|
||||
BStringView *rendererValue = new BStringView(dummyRect, "RendererVal",
|
||||
(const char*)glGetString(GL_RENDERER), B_FOLLOW_NONE);
|
||||
BStringView *gluVersion = new BStringView(dummyRect, "GLUVersion",
|
||||
B_TRANSLATE("GLU version:"), B_FOLLOW_NONE);
|
||||
BStringView *gluVersionValue = new BStringView(dummyRect, "GLUVersionVal",
|
||||
(const char*)gluGetString(GLU_VERSION), B_FOLLOW_NONE);
|
||||
BStringView *glutVersion = new BStringView(dummyRect, "GLUTVersion",
|
||||
B_TRANSLATE("GLUT API version:"), B_FOLLOW_NONE);
|
||||
BString glutApiVer;
|
||||
glutApiVer << (int32)GLUT_API_VERSION;
|
||||
BStringView *glutVersionValue = new BStringView(dummyRect, "GLUTVersionVal",
|
||||
glutApiVer.String(), B_FOLLOW_NONE);
|
||||
layout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, layout->CountRows(),
|
||||
layout->CountColumns(), 1);
|
||||
|
||||
const float kInset = 10;
|
||||
const float kSpacer = 5;
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(version)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(versionValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(vendor)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(vendorValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(renderer)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(rendererValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(gluVersion)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(gluVersionValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(kSpacer))
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(glutVersion)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.Add(glutVersionValue)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.SetInsets(kInset, kInset, kInset, kInset)
|
||||
);
|
||||
float spacing = be_control_look->DefaultItemSpacing();
|
||||
layout->SetHorizontalSpacing(spacing / 2.0f);
|
||||
// divide by two to compensate for empty column 1
|
||||
}
|
||||
|
||||
|
||||
@@ -102,24 +64,16 @@ InfoView::~InfoView()
|
||||
|
||||
|
||||
void
|
||||
InfoView::MessageReceived(BMessage* message)
|
||||
InfoView::_AddString(const char* label, const char* value)
|
||||
{
|
||||
switch (message->what) {
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoView::AttachedToWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoView::DetachedFromWindow()
|
||||
{
|
||||
|
||||
BView* labelView = new BStringView(NULL, label);
|
||||
labelView->SetExplicitAlignment(kLabelAlignment);
|
||||
|
||||
BView* valueView = new BStringView(NULL, value);
|
||||
valueView->SetExplicitAlignment(kValueAlignment);
|
||||
|
||||
int32 rows = GridLayout()->CountRows();
|
||||
BLayoutBuilder::Grid<>(this)
|
||||
.Add(labelView, 0, rows)
|
||||
.Add(valueView, 2, rows);
|
||||
}
|
||||
|
||||
@@ -10,16 +10,15 @@
|
||||
#define INFO_VIEW_H
|
||||
|
||||
|
||||
#include <View.h>
|
||||
#include <GridView.h>
|
||||
|
||||
class InfoView : public BView {
|
||||
class InfoView : public BGridView {
|
||||
public:
|
||||
InfoView();
|
||||
virtual ~InfoView();
|
||||
InfoView();
|
||||
virtual ~InfoView();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
private:
|
||||
void _AddString(const char* label, const char* value);
|
||||
};
|
||||
|
||||
#endif /* INFO_VIEW_H */
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
#include <TranslatorFormats.h>
|
||||
|
||||
|
||||
LogoView::LogoView(const BRect& frame)
|
||||
: BView(frame, "LogoView", B_FOLLOW_ALL, B_WILL_DRAW
|
||||
| B_FULL_UPDATE_ON_RESIZE),
|
||||
LogoView::LogoView()
|
||||
:
|
||||
BView("LogoView", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE, NULL),
|
||||
fLogo(NULL)
|
||||
{
|
||||
SetViewColor(255, 255, 255);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
class LogoView : public BView {
|
||||
public:
|
||||
LogoView(const BRect& frame);
|
||||
LogoView();
|
||||
virtual ~LogoView();
|
||||
|
||||
virtual void Draw(BRect update);
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Copyright 2009-2010 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
#include "OpenGLView.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <TabView.h>
|
||||
|
||||
#include <GLView.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <TabView.h>
|
||||
|
||||
#include "CapabilitiesView.h"
|
||||
#include "ExtensionsView.h"
|
||||
#include "InfoView.h"
|
||||
@@ -21,43 +23,34 @@
|
||||
|
||||
|
||||
OpenGLView::OpenGLView()
|
||||
: BView("OpenGLView", 0, NULL)
|
||||
:
|
||||
BGroupView("OpenGLView", B_VERTICAL)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
const float kInset = 10;
|
||||
BRect dummy(0, 0, 2, 2);
|
||||
|
||||
fGLView = new BGLView(dummy, "gl info", B_FOLLOW_NONE, 0,
|
||||
BGLView* glView = new BGLView(BRect(0, 0, 1, 1), "gl info", B_FOLLOW_NONE, 0,
|
||||
BGL_RGB | BGL_DOUBLE);
|
||||
fGLView->Hide();
|
||||
AddChild(fGLView);
|
||||
glView->Hide();
|
||||
AddChild(glView);
|
||||
|
||||
fGLView->LockGL();
|
||||
glView->LockGL();
|
||||
|
||||
LogoView *logoView = new LogoView(dummy);
|
||||
LogoView *logoView = new LogoView();
|
||||
|
||||
BTabView *tabView = new BTabView("tab view", B_WIDTH_FROM_LABEL);
|
||||
tabView->AddTab(new InfoView());
|
||||
tabView->AddTab(new CapabilitiesView());
|
||||
tabView->AddTab(new ExtensionsView());
|
||||
|
||||
InfoView *infoView = new InfoView();
|
||||
tabView->AddTab(infoView);
|
||||
glView->UnlockGL();
|
||||
|
||||
CapabilitiesView *capabilitiesView = new CapabilitiesView();
|
||||
tabView->AddTab(capabilitiesView);
|
||||
|
||||
ExtensionsView *extensionsView = new ExtensionsView();
|
||||
tabView->AddTab(extensionsView);
|
||||
|
||||
fGLView->UnlockGL();
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
GroupLayout()->SetSpacing(0);
|
||||
BLayoutBuilder::Group<>(this)
|
||||
.SetInsets(0, 0, 0, 0)
|
||||
.Add(logoView)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(tabView)
|
||||
.SetInsets(kInset, kInset, kInset, kInset)
|
||||
)
|
||||
);
|
||||
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,26 +58,3 @@ OpenGLView::~OpenGLView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OpenGLView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OpenGLView::AttachedToWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OpenGLView::DetachedFromWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
* Copyright 2009 Haiku Inc. All rights reserved.
|
||||
* Copyright 2009-2010 Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Alex Wilson <[email protected]>
|
||||
* Artur Wyszynski <[email protected]>
|
||||
*/
|
||||
|
||||
@@ -10,20 +11,12 @@
|
||||
#define OPENGL_VIEW_H
|
||||
|
||||
|
||||
#include <GLView.h>
|
||||
#include <View.h>
|
||||
#include <GroupView.h>
|
||||
|
||||
class OpenGLView : public BView {
|
||||
class OpenGLView : public BGroupView {
|
||||
public:
|
||||
OpenGLView();
|
||||
virtual ~OpenGLView();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
|
||||
private:
|
||||
BGLView* fGLView;
|
||||
};
|
||||
|
||||
#endif /* OPENGL_VIEW_H */
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "OpenGLWindow.h"
|
||||
|
||||
#include <Application.h>
|
||||
#include <GroupLayout.h>
|
||||
#include "OpenGLView.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user