~ubuntu-branches/ubuntu/natty/vlc/natty

« back to all changes in this revision

Viewing changes to modules/gui/skins2/win32/win32_factory.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-06-25 01:09:16 UTC
  • mfrom: (1.1.30 upstream)
  • Revision ID: james.westby@ubuntu.com-20100625010916-asxhep2mutg6g6pd
Tags: 1.1.0-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - build and install the libx264 plugin
  - add Xb-Npp header to vlc package
  - Add apport hook to include more vlc dependencies in bug reports
* Drop xulrunner patches.
* Drop 502_xulrunner_191.diff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * win32_factory.cpp
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2003 the VideoLAN team
5
 
 * $Id: 47d4556c90c21e65b974f02dfdafa542f7ef98f1 $
 
5
 * $Id: 7e0b5f96e989ad8387ea9828c370dc5fafdab636 $
6
6
 *
7
7
 * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8
8
 *          Olivier Teulière <ipkiss@via.ecp.fr>
33
33
#include "win32_loop.hpp"
34
34
#include "../src/theme.hpp"
35
35
#include "../src/window_manager.hpp"
 
36
#include "../src/generic_window.hpp"
36
37
#include "../commands/cmd_dialogs.hpp"
37
38
#include "../commands/cmd_minimize.hpp"
38
39
 
52
53
        return DefWindowProc( hwnd, uMsg, wParam, lParam );
53
54
    }
54
55
 
55
 
    // Here we know we are getting a message for the parent window, since it is
56
 
    // the only one to store p_intf...
57
 
    // Yes, it is a kludge :)
 
56
    Win32Factory *pFactory = (Win32Factory*)Win32Factory::instance( p_intf );
58
57
 
59
 
//Win32Factory *pFactory = (Win32Factory*)Win32Factory::instance( p_intf );
60
 
//msg_Err( p_intf, "Parent window %p %p %u %i\n", pFactory->m_hParentWindow, hwnd, uMsg, wParam );
61
 
    // If Window is parent window
62
 
    // XXX: this test isn't needed, see the kludge above...
63
 
//    if( hwnd == pFactory->m_hParentWindow )
 
58
    if( hwnd == pFactory->getParentWindow() )
64
59
    {
65
60
        if( uMsg == WM_SYSCOMMAND )
66
61
        {
67
62
            // If closing parent window
68
63
            if( wParam == SC_CLOSE )
69
64
            {
70
 
                Win32Loop *pLoop = (Win32Loop*)Win32Loop::instance( p_intf );
71
 
                pLoop->exit();
 
65
                libvlc_Quit( p_intf->p_libvlc );
 
66
                return 0;
 
67
            }
 
68
            else if( wParam == SC_MINIMIZE )
 
69
            {
 
70
                pFactory->minimize();
 
71
                return 0;
 
72
            }
 
73
            else if( wParam == SC_RESTORE )
 
74
            {
 
75
                pFactory->restore();
72
76
                return 0;
73
77
            }
74
78
            else
82
86
            if( (UINT)lParam == WM_LBUTTONDOWN )
83
87
            {
84
88
                p_intf->p_sys->p_theme->getWindowManager().raiseAll();
 
89
                CmdDlgHidePopupMenu aCmdPopup( p_intf );
 
90
                aCmdPopup.execute();
85
91
            }
86
92
            else if( (UINT)lParam == WM_RBUTTONDOWN )
87
93
            {
121
127
 
122
128
    // Create window class
123
129
    WNDCLASS skinWindowClass;
124
 
    skinWindowClass.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
 
130
    skinWindowClass.style = CS_DBLCLKS;
125
131
    skinWindowClass.lpfnWndProc = (WNDPROC) Win32Proc;
126
132
    skinWindowClass.lpszClassName = _T("SkinWindowClass");
127
133
    skinWindowClass.lpszMenuName = NULL;
128
134
    skinWindowClass.cbClsExtra = 0;
129
135
    skinWindowClass.cbWndExtra = 0;
130
136
    skinWindowClass.hbrBackground = NULL;
131
 
    skinWindowClass.hCursor = LoadCursor( NULL , IDC_ARROW );
 
137
    skinWindowClass.hCursor = LoadCursor( NULL, IDC_ARROW );
132
138
    skinWindowClass.hIcon = LoadIcon( m_hInst, _T("VLC_ICON") );
133
139
    skinWindowClass.hInstance = m_hInst;
134
140
 
148
154
 
149
155
    // Create Window
150
156
    m_hParentWindow = CreateWindowEx( WS_EX_TOOLWINDOW, _T("SkinWindowClass"),
151
 
        _T("VLC media player"), WS_SYSMENU|WS_POPUP,
 
157
        _T("VLC media player"), WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX,
152
158
        -200, -200, 0, 0, 0, 0, m_hInst, 0 );
153
159
    if( m_hParentWindow == NULL )
154
160
    {
162
168
    // We do it this way otherwise CreateWindowEx will fail
163
169
    // if WS_EX_LAYERED is not supported
164
170
    SetWindowLongPtr( m_hParentWindow, GWL_EXSTYLE,
165
 
                      GetWindowLong( m_hParentWindow, GWL_EXSTYLE ) |
 
171
                      GetWindowLongPtr( m_hParentWindow, GWL_EXSTYLE ) |
166
172
                      WS_EX_LAYERED );
167
173
 
168
174
    ShowWindow( m_hParentWindow, SW_SHOW );
177
183
    strcpy( m_trayIcon.szTip, "VLC media player" );
178
184
 
179
185
    // Show the systray icon if needed
180
 
    if( config_GetInt( getIntf(), "skins2-systray" ) )
 
186
    if( var_InheritBool( getIntf(), "skins2-systray" ) )
181
187
    {
182
188
        addInTray();
183
189
    }
184
190
 
185
191
    // Show the task in the task bar if needed
186
 
    if( config_GetInt( getIntf(), "skins2-taskbar" ) )
 
192
    if( var_InheritBool( getIntf(), "skins2-taskbar" ) )
187
193
    {
188
194
        addInTaskBar();
189
195
    }
225
231
    }
226
232
 
227
233
    // Initialize the resource path
228
 
    char *datadir = config_GetUserDataDir();
229
 
    m_resourcePath.push_back( (string)datadir + "\\skins" );
230
 
    free( datadir );
231
 
    m_resourcePath.push_back( (string)config_GetDataDir() +
232
 
                              "\\skins" );
233
 
    m_resourcePath.push_back( (string)config_GetDataDir() +
234
 
                              "\\skins2" );
235
 
    m_resourcePath.push_back( (string)config_GetDataDir() +
236
 
                              "\\share\\skins" );
237
 
    m_resourcePath.push_back( (string)config_GetDataDir() +
238
 
                              "\\share\\skins2" );
 
234
    char *datadir = config_GetUserDir( VLC_DATA_DIR );
 
235
    m_resourcePath.push_back( (string)datadir + "\\skins" );
 
236
    free( datadir );
 
237
    datadir = config_GetDataDir( getIntf() );
 
238
    m_resourcePath.push_back( (string)datadir + "\\skins" );
 
239
    m_resourcePath.push_back( (string)datadir + "\\skins2" );
 
240
    m_resourcePath.push_back( (string)datadir + "\\share\\skins" );
 
241
    m_resourcePath.push_back( (string)datadir + "\\share\\skins2" );
 
242
    free( datadir );
239
243
 
240
244
    // All went well
241
245
    return true;
323
327
 
324
328
 
325
329
OSWindow *Win32Factory::createOSWindow( GenericWindow &rWindow, bool dragDrop,
326
 
                                        bool playOnDrop, OSWindow *pParent )
 
330
                                        bool playOnDrop, OSWindow *pParent,
 
331
                                        GenericWindow::WindowType_t type )
327
332
{
328
333
    return new Win32Window( getIntf(), rWindow, m_hInst, m_hParentWindow,
329
 
                            dragDrop, playOnDrop, (Win32Window*)pParent );
 
334
                            dragDrop, playOnDrop, (Win32Window*)pParent, type );
330
335
}
331
336
 
332
337
 
389
394
    LPCTSTR id;
390
395
    switch( type )
391
396
    {
392
 
        case kDefaultArrow:
393
 
            id = IDC_ARROW;
394
 
            break;
395
 
        case kResizeNWSE:
396
 
            id = IDC_SIZENWSE;
397
 
            break;
398
 
        case kResizeNS:
399
 
            id = IDC_SIZENS;
400
 
            break;
401
 
        case kResizeWE:
402
 
            id = IDC_SIZEWE;
403
 
            break;
404
 
        case kResizeNESW:
405
 
            id = IDC_SIZENESW;
406
 
            break;
407
 
        default:
408
 
            id = IDC_ARROW;
409
 
            break;
 
397
    default:
 
398
    case kDefaultArrow: id = IDC_ARROW;    break;
 
399
    case kResizeNWSE:   id = IDC_SIZENWSE; break;
 
400
    case kResizeNS:     id = IDC_SIZENS;   break;
 
401
    case kResizeWE:     id = IDC_SIZEWE;   break;
 
402
    case kResizeNESW:   id = IDC_SIZENESW; break;
410
403
    }
411
404
 
412
405
    HCURSOR hCurs = LoadCursor( NULL, id );