[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.6, Mon Jan 26 05:49:42 2004 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.nDeblock_Y);
62            REG_SET_N("Deblock_UV", PPSettings.nDeblock_UV);
63            REG_SET_N("Dering", PPSettings.nDering);
64            REG_SET_N("FilmEffect", PPSettings.nFilmEffect);
65            REG_SET_N("ForceColorspace", PPSettings.nForceColorspace);
66            REG_SET_N("FlipVideo", PPSettings.nFlipVideo);
67    
68            RegCloseKey(hKey);
69    }
70    
71    CUnknown * WINAPI CAbout::CreateInstance(LPUNKNOWN punk, HRESULT *phr)
72    {
73        CAbout * pNewObject = new CAbout(punk, phr);
74        if (pNewObject == NULL)
75            {
76            *phr = E_OUTOFMEMORY;
77        }
78        return pNewObject;
79    }
80    
81    
82    CAbout::CAbout(LPUNKNOWN pUnk, HRESULT * phr) :
83            CBasePropertyPage(NAME("CAbout"), pUnk, IDD_ABOUT, IDS_ABOUT)
84    {
85        ASSERT(phr);
86    }
87    
88    
89    CAbout::~CAbout()
90    {
91    }
92    
93    
94    BOOL CAbout::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
95    {
96            HWND hBrightness;
97            switch ( uMsg )
98            {
99            case WM_DESTROY:
100                    int nForceColorspace;
101                    nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0);
102                    if ( PPSettings.nForceColorspace != nForceColorspace )
103                    {
104                            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);
105                    }
106                    PPSettings.nForceColorspace = nForceColorspace;
107                    SaveRegistryInfo();
108                    break;
109    
110            case WM_INITDIALOG:
111    
112                    // Load Force Colorspace Box
113                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force");
114                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12");
115                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2");
116                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24");
117                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32");
118    
119                    // Select Colorspace
120                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0);
121    
122                    hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
123                    SendMessage(hBrightness, TBM_SETRANGE, (WPARAM) (BOOL) TRUE, (LPARAM) MAKELONG(0, 50));
124                    SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness);
125    
126                    // Load Buttons
127                    SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, PPSettings.nDeblock_Y, 0);
128                    SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, PPSettings.nDeblock_UV, 0);
129                    SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, PPSettings.nDering, 0);
130                    SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, PPSettings.nFilmEffect, 0);
131                    SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, PPSettings.nFlipVideo, 0);
132    
133                    // Set Date & Time of Compilation
134                    DPRINTF("(%s %s)", __DATE__, __TIME__);
135                    break;
136    
137            case WM_COMMAND:
138                    switch ( wParam )
139                    {
140                    case IDC_RESET:
141                            ZeroMemory(&PPSettings, sizeof(PostProcessing_Settings));
142                            PPSettings.nBrightness = 25;
143                            hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
144                            SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness);
145                            // Load Buttons
146                            SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, PPSettings.nDeblock_Y, 0);
147                            SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, PPSettings.nDeblock_UV, 0);
148                            SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, PPSettings.nDering, 0);
149                            SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, PPSettings.nFilmEffect, 0);
150                            SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, PPSettings.nFlipVideo, 0);
151                            PPSettings.nForceColorspace = 0;
152                            SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0);
153                            SaveRegistryInfo();
154    
155                            break;
156                    case IDC_DEBLOCK_Y:
157                            PPSettings.nDeblock_Y = !PPSettings.nDeblock_Y;
158                            SaveRegistryInfo();
159                            break;
160                    case IDC_DEBLOCK_UV:
161                            PPSettings.nDeblock_UV = !PPSettings.nDeblock_UV;
162                            SaveRegistryInfo();
163                            break;
164                    case IDC_DERING:
165                            PPSettings.nDering = !PPSettings.nDering;
166                            SaveRegistryInfo();
167                            break;
168                    case IDC_FILMEFFECT:
169                            PPSettings.nFilmEffect = !PPSettings.nFilmEffect;
170                            SaveRegistryInfo();
171                            break;
172                    case IDC_FLIPVIDEO:
173                            PPSettings.nFlipVideo = !PPSettings.nFlipVideo;
174                            SaveRegistryInfo();
175                            break;
176                    }
177                    break;
178            case WM_NOTIFY:
179                    hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
180                    PPSettings.nBrightness = SendMessage(hBrightness, TBM_GETPOS, NULL, NULL);
181                    SaveRegistryInfo();
182                    break;
183            }
184            return CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam);
185    }

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

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