[cvs] / xvidcore / dshow / src / CAbout.cpp Repository:
ViewVC logotype

Diff of /xvidcore/dshow/src/CAbout.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Sat Feb 22 08:22:03 2003 UTC revision 1.1.2.3, Fri Dec 12 15:09:01 2003 UTC
# Line 0  Line 1 
1    /*****************************************************************************
2     *
3     *  XVID MPEG-4 VIDEO CODEC - DShow Front End
4     *  - About Window -
5     *
6     *  Copyright(C) 2002-2003 Peter Ross <pross@xvid.org>
7     *
8     *  This program is free software ; you can redistribute it and/or modify
9     *  it under the terms of the GNU General Public License as published by
10     *  the Free Software Foundation ; either version 2 of the License, or
11     *  (at your option) any later version.
12     *
13     *  This program is distributed in the hope that it will be useful,
14     *  but WITHOUT ANY WARRANTY ; without even the implied warranty of
15     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     *  GNU General Public License for more details.
17     *
18     *  You should have received a copy of the GNU General Public License
19     *  along with this program ; if not, write to the Free Software
20     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21     *
22     * $Id$
23     *
24     ****************************************************************************/
25    
26    /****************************************************************************
27     *
28     * 2003/12/11 - added some additional options, mainly to make the deblocking
29     *              code from xvidcore available. Most of the new code is taken
30     *              from Nic's dshow filter, (C) Nic, http://nic.dnsalias.com
31     *
32     ****************************************************************************/
33    
34    #include "CAbout.h"
35    #include "resource.h"
36    #include <commdlg.h>
37    #include <commctrl.h>
38    #include "CXvidDecoder.h"
39    
40    void SaveRegistryInfo()
41    {
42            HKEY hKey;
43            DWORD dispo;
44    
45            if (RegCreateKeyEx(
46                            XVID_REG_KEY,
47                            XVID_REG_SUBKEY,
48                            0,
49                            XVID_REG_CLASS,
50                            REG_OPTION_NON_VOLATILE,
51                            KEY_WRITE,
52                            0,
53                            &hKey,
54                            &dispo) != ERROR_SUCCESS)
55            {
56                    OutputDebugString("Couldn't create XVID_REG_SUBKEY");
57                    return;
58            }
59    
60            REG_SET_N("Brightness", PPSettings.nBrightness);
61            REG_SET_N("Deblock_Y",  PPSettings.bDeblock_Y);
62            REG_SET_N("Deblock_UV", PPSettings.bDeblock_UV);
63            REG_SET_N("ForceColorspace", PPSettings.nForceColorspace);
64    
65            RegCloseKey(hKey);
66    }
67    
68    CUnknown * WINAPI CAbout::CreateInstance(LPUNKNOWN punk, HRESULT *phr)
69    {
70        CAbout * pNewObject = new CAbout(punk, phr);
71        if (pNewObject == NULL)
72            {
73            *phr = E_OUTOFMEMORY;
74        }
75        return pNewObject;
76    }
77    
78    
79    CAbout::CAbout(LPUNKNOWN pUnk, HRESULT * phr) :
80            CBasePropertyPage(NAME("CAbout"), pUnk, IDD_ABOUT, IDS_ABOUT)
81    {
82        ASSERT(phr);
83    }
84    
85    
86    CAbout::~CAbout()
87    {
88    }
89    
90    
91    BOOL CAbout::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
92    {
93            HWND hBrightness;
94            switch ( uMsg )
95            {
96            case WM_DESTROY:
97                    int nForceColorspace;
98                    nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0);
99                    if ( PPSettings.nForceColorspace != nForceColorspace )
100                    {
101                            MessageBox(0, "You have changed the output colorspace.\r\nClose the movie and open it for the new colorspace to take effect.", "XviD DShow", 0);
102                    }
103                    PPSettings.nForceColorspace = nForceColorspace;
104                    SaveRegistryInfo();
105                    break;
106    
107            case WM_INITDIALOG:
108    
109                    // Load Force Colorspace Box
110                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force");
111                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12");
112                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2");
113                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24");
114                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32");
115    
116                    // Select Colorspace
117                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0);
118    
119                    hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
120                    SendMessage(hBrightness, TBM_SETRANGE, (WPARAM) (BOOL) TRUE, (LPARAM) MAKELONG(0, 50));
121                    SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness);
122    
123                    // Load Buttons
124                    SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, (BOOL)PPSettings.bDeblock_Y, 0);
125                    SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, (BOOL)PPSettings.bDeblock_UV, 0);
126                    SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, (BOOL)PPSettings.bFlipVideo, 0);
127    
128                    // Set Date & Time of Compilation
129                    DPRINTF("(%s %s)", __DATE__, __TIME__);
130                    break;
131    
132            case WM_COMMAND:
133                    switch ( wParam )
134                    {
135                    case IDC_RESET:
136                            ZeroMemory(&PPSettings, sizeof(PostProcessing_Settings));
137                            PPSettings.nBrightness = 25;
138                            hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
139                            SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness);
140                            // Load Buttons
141                            SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, (BOOL)PPSettings.bDeblock_Y, 0);
142                            SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, (BOOL)PPSettings.bDeblock_UV, 0);
143                            SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, (BOOL)PPSettings.bFlipVideo, 0);
144                            PPSettings.nForceColorspace = 0;
145                            SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0);
146                            SaveRegistryInfo();
147    
148                            break;
149                    case IDC_DEBLOCK_Y:
150                            PPSettings.bDeblock_Y = !PPSettings.bDeblock_Y;
151                            SaveRegistryInfo();
152                            break;
153                    case IDC_DEBLOCK_UV:
154                            PPSettings.bDeblock_UV = !PPSettings.bDeblock_UV;
155                            SaveRegistryInfo();
156                            break;
157                    case IDC_FLIPVIDEO:
158                            PPSettings.bFlipVideo = !PPSettings.bFlipVideo;
159                            SaveRegistryInfo();
160                            break;
161                    }
162                    break;
163            case WM_NOTIFY:
164                    hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
165                    PPSettings.nBrightness = SendMessage(hBrightness, TBM_GETPOS, NULL, NULL);
166                    SaveRegistryInfo();
167                    break;
168            }
169            return CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam);
170    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.3

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4