185
185
m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION);
187
OnMouseDown.connect(sigc::mem_fun(this, &Launcher::RecvMouseDown));
188
OnMouseUp.connect(sigc::mem_fun(this, &Launcher::RecvMouseUp));
189
OnMouseDrag.connect(sigc::mem_fun(this, &Launcher::RecvMouseDrag));
190
OnMouseEnter.connect(sigc::mem_fun(this, &Launcher::RecvMouseEnter));
191
OnMouseLeave.connect(sigc::mem_fun(this, &Launcher::RecvMouseLeave));
192
OnMouseMove.connect(sigc::mem_fun(this, &Launcher::RecvMouseMove));
193
OnMouseWheel.connect(sigc::mem_fun(this, &Launcher::RecvMouseWheel));
187
OnMouseDown.connect (sigc::mem_fun (this, &Launcher::RecvMouseDown));
188
OnMouseUp.connect (sigc::mem_fun (this, &Launcher::RecvMouseUp));
189
OnMouseDrag.connect (sigc::mem_fun (this, &Launcher::RecvMouseDrag));
190
OnMouseEnter.connect (sigc::mem_fun (this, &Launcher::RecvMouseEnter));
191
OnMouseLeave.connect (sigc::mem_fun (this, &Launcher::RecvMouseLeave));
192
OnMouseMove.connect (sigc::mem_fun (this, &Launcher::RecvMouseMove));
193
OnMouseWheel.connect (sigc::mem_fun (this, &Launcher::RecvMouseWheel));
195
195
QuicklistManager::Default ()->quicklist_opened.connect (sigc::mem_fun(this, &Launcher::RecvQuicklistOpened));
196
196
QuicklistManager::Default ()->quicklist_closed.connect (sigc::mem_fun(this, &Launcher::RecvQuicklistClosed));
198
PluginAdapter::Default ()->window_maximized.connect (sigc::mem_fun (this, &Launcher::OnWindowMaybeIntellihide));
199
PluginAdapter::Default ()->window_restored.connect (sigc::mem_fun (this, &Launcher::OnWindowMaybeIntellihide));
200
PluginAdapter::Default ()->window_unminimized.connect (sigc::mem_fun (this, &Launcher::OnWindowMaybeIntellihide));
201
PluginAdapter::Default ()->window_mapped.connect (sigc::mem_fun (this, &Launcher::OnWindowMaybeIntellihide));
202
PluginAdapter::Default ()->window_unmapped.connect (sigc::mem_fun (this, &Launcher::OnWindowMaybeIntellihide));
203
PluginAdapter::Default ()->window_shown.connect (sigc::mem_fun (this, &Launcher::OnWindowMaybeIntellihide));
204
PluginAdapter::Default ()->window_hidden.connect (sigc::mem_fun (this, &Launcher::OnWindowMaybeIntellihide));
205
PluginAdapter::Default ()->window_resized.connect (sigc::mem_fun (this, &Launcher::OnWindowMaybeIntellihide));
206
PluginAdapter::Default ()->window_moved.connect (sigc::mem_fun (this, &Launcher::OnWindowMaybeIntellihide));
198
208
m_ActiveTooltipIcon = NULL;
199
209
m_ActiveMenuIcon = NULL;
1365
1411
GfxContext.GetRenderStates ().SetColorMask (true, true, true, true);
1367
1414
RenderIcon (GfxContext,
1369
arg.icon->TextureForSize (_icon_image_size),
1416
arg.icon->TextureForSize (_icon_image_size)->GetDeviceTexture (),
1370
1417
nux::Color::White,
1372
arg.icon->_xform_coords["Image"],
1419
arg.icon->_xform_coords["Image"]);
1421
/* draw overlay shine */
1375
1422
if (arg.backlight_intensity > 0.0f)
1377
1424
RenderIcon(GfxContext,
1379
_icon_shine_texture,
1426
_icon_shine_texture->GetDeviceTexture (),
1380
1427
nux::Color::White,
1381
1428
arg.backlight_intensity,
1382
arg.icon->_xform_coords["Tile"],
1388
switch (arg.window_indicators)
1391
RenderIcon(GfxContext,
1396
arg.icon->_xform_coords["Tile"],
1400
RenderIcon(GfxContext,
1405
arg.icon->_xform_coords["Tile"],
1409
RenderIcon(GfxContext,
1414
arg.icon->_xform_coords["Tile"],
1429
arg.icon->_xform_coords["Tile"]);
1420
1433
if (arg.glow_intensity > 0.0f)
1422
1435
RenderIcon(GfxContext,
1437
_icon_glow_texture->GetDeviceTexture (),
1425
1438
arg.icon->GlowColor (),
1426
1439
arg.glow_intensity,
1427
arg.icon->_xform_coords["Glow"],
1440
arg.icon->_xform_coords["Glow"]);
1431
1444
if (arg.shimmer_progress > 0.0f && arg.shimmer_progress < 1.0f)
1433
1446
nux::Geometry base = GetGeometry ();
2079
2120
float AspectRatio = (float)ViewportWidth/(float)ViewportHeight;
2080
2121
float CameraToScreenDistance = -1.0f;
2081
float y_cs = -CameraToScreenDistance*tanf(0.5f*Fovy/* *3.1415926/180.0f*/);
2122
float y_cs = -CameraToScreenDistance*tanf(0.5f*Fovy/* *M_PI/180.0f*/);
2082
2123
float x_cs = y_cs*AspectRatio;
2083
//float CameraToScreenDistance = -y_cs*1.0f/(tanf(0.5f*Fovy/* *3.1415926/180.0f*/));
2085
2125
ViewMatrix = nux::Matrix4::TRANSLATE(-x_cs, y_cs, CameraToScreenDistance) *
2086
2126
nux::Matrix4::SCALE(2.0f*x_cs/ViewportWidth, -2.0f*y_cs/ViewportHeight, -2.0f * 3 * y_cs/ViewportHeight /* or -2.0f * x_cs/ViewportWidth*/ );
2088
2128
PerspectiveMatrix.Perspective(Fovy, AspectRatio, NearClipPlane, FarClipPlane);
2090
// // Example usage with the matrices above:
2094
// float X = (ViewportWidth - W)/2.0;
2095
// float Y = (ViewportHeight - H)/2.0;
2100
// // Local Transformation of the object
2101
// glTranslatef(0.0f, 0.0f, ObjectDistanceToCamera);
2102
// glTranslatef(X + W/2.0f, Y + H/2.0f, 0.0f);
2103
// glRotatef(cameraAngleY, 1, 0, 0);
2104
// glRotatef(cameraAngleX, 0, 1, 0);
2105
// glTranslatef(-X - W/2.0f, -Y - H/2.0f, 0.0f);
2107
// glBegin(GL_QUADS);
2109
// glNormal3f(0.0f, 0.0f, 1.0f);
2111
// glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
2112
// glVertex4f(X, Y, Z, 1.0f);
2114
// glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
2115
// glVertex4f(X, Y+H, Z, 1.0f);
2117
// glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
2118
// glVertex4f(X+W, Y+H, Z, 1.0f);
2120
// glColor4f(0.0f, 1.0f, 1.0f, 1.0f);
2121
// glVertex4f(X+W, Y, Z, 1.0f);
2126
void Launcher::SetOffscreenRenderTarget ()
2128
int width = _offscreen_rt_texture->GetWidth ();
2129
int height = _offscreen_rt_texture->GetHeight ();
2132
Launcher::RenderIconToTexture (nux::GraphicsEngine& GfxContext, LauncherIcon *icon, nux::IntrusiveSP<nux::IOpenGLBaseTexture> texture)
2135
struct timespec current;
2136
clock_gettime (CLOCK_MONOTONIC, ¤t);
2138
SetupRenderArg (icon, current, arg);
2139
arg.render_center = nux::Point3 (_icon_size / 2.0f, _icon_size / 2.0f, 0.0f);
2140
arg.logical_center = arg.render_center;
2141
arg.x_rotation = 0.0f;
2142
arg.running_arrow = false;
2143
arg.active_arrow = false;
2145
arg.window_indicators = 0;
2148
std::list<Launcher::RenderArg> drag_args;
2149
drag_args.push_front (arg);
2150
UpdateIconXForm (drag_args);
2152
SetOffscreenRenderTarget (texture);
2153
DrawRenderArg (nux::GetGraphicsEngine (), arg, nux::Geometry (0, 0, _icon_size, _icon_size));
2154
RestoreSystemRenderTarget ();
2158
Launcher::RenderProgressToTexture (nux::GraphicsEngine& GfxContext, nux::IntrusiveSP<nux::IOpenGLBaseTexture> texture, float progress_fill, float bias)
2160
int width = texture->GetWidth ();
2161
int height = texture->GetHeight ();
2163
int progress_width = _progress_bar_trough->GetWidth ();
2164
int progress_height = _progress_bar_trough->GetHeight ();
2166
int fill_width = _progress_bar_fill->GetWidth ();
2167
int fill_height = _progress_bar_fill->GetHeight ();
2169
int fill_offset = (progress_width - fill_width) / 2;
2171
/* We need to perform a barn doors effect to acheive the slide in and out */
2173
int left_edge = width / 2 - progress_width / 2;
2174
int right_edge = width / 2 + progress_width / 2;
2178
// pulls the right edge in
2179
right_edge -= (int) (-bias * (float) progress_width);
2181
else if (bias > 0.0f)
2183
// pulls the left edge in
2184
left_edge += (int) (bias * progress_width);
2187
int fill_y = (height - fill_height) / 2;
2188
int progress_y = (height - progress_height) / 2;
2189
int half_size = (right_edge - left_edge) / 2;
2191
SetOffscreenRenderTarget (texture);
2194
glClear (GL_COLOR_BUFFER_BIT);
2195
nux::TexCoordXForm texxform;
2197
fill_width *= progress_fill;
2200
GfxContext.PushClippingRectangle(nux::Geometry (left_edge, 0, half_size, height));
2202
GfxContext.QRP_GLSL_1Tex (left_edge, progress_y, progress_width, progress_height,
2203
_progress_bar_trough->GetDeviceTexture (), texxform, nux::Color::White);
2205
GfxContext.QRP_GLSL_1Tex (left_edge + fill_offset, fill_y, fill_width, fill_height,
2206
_progress_bar_fill->GetDeviceTexture (), texxform, nux::Color::White);
2208
GfxContext.PopClippingRectangle ();
2212
GfxContext.PushClippingRectangle(nux::Geometry (left_edge + half_size, 0, half_size, height));
2214
GfxContext.QRP_GLSL_1Tex (right_edge - progress_width, progress_y, progress_width, progress_height,
2215
_progress_bar_trough->GetDeviceTexture (), texxform, nux::Color::White);
2217
GfxContext.QRP_GLSL_1Tex (right_edge - progress_width + fill_offset, fill_y, fill_width, fill_height,
2218
_progress_bar_fill->GetDeviceTexture (), texxform, nux::Color::White);
2220
GfxContext.PopClippingRectangle ();
2223
RestoreSystemRenderTarget ();
2227
Launcher::SetOffscreenRenderTarget (nux::IntrusiveSP<nux::IOpenGLBaseTexture> texture)
2229
int width = texture->GetWidth ();
2230
int height = texture->GetHeight ();
2131
2232
nux::GetThreadGLDeviceFactory ()->FormatFrameBufferObject (width, height, nux::BITFMT_R8G8B8A8);
2132
nux::GetThreadGLDeviceFactory ()->SetColorRenderTargetSurface (0, _offscreen_rt_texture->GetSurfaceLevel (0));
2233
nux::GetThreadGLDeviceFactory ()->SetColorRenderTargetSurface (0, texture->GetSurfaceLevel (0));
2133
2234
nux::GetThreadGLDeviceFactory ()->ActivateFrameBuffer ();
2135
2236
nux::GetThreadGraphicsContext ()->SetContext (0, 0, width, height);