Author: janderwald
Date: Sat Apr  9 10:36:25 2011
New Revision: 51292

URL: http://svn.reactos.org/svn/reactos?rev=51292&view=rev
Log:
[SNDVOL32]
- Fix more subtle bugs:
- Check with long line name if the current connection is activated when adding 
lines to dialog or when adding lines to the preferences dialog
- Use the temporary preferences context when writing the line settings
- Don't destroy the mixer when the preferences dialog is closed. the new mixer 
will be used for the application when the preferences are changed
- Pass the current selected line to the preferences dialog





Modified:
    trunk/reactos/base/applications/sndvol32/dialog.c
    trunk/reactos/base/applications/sndvol32/sndvol32.c
    trunk/reactos/base/applications/sndvol32/sndvol32.h

Modified: trunk/reactos/base/applications/sndvol32/dialog.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sndvol32/dialog.c?rev=51292&r1=51291&r2=51292&view=diff
==============================================================================
--- trunk/reactos/base/applications/sndvol32/dialog.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/sndvol32/dialog.c [iso-8859-1] Sat Apr  9 
10:36:25 2011
@@ -340,7 +340,7 @@
     if (Line->cControls != 0)
     {
       /* get line name */
-      if (SndMixerGetLineName(PrefContext->MixerWindow->Mixer, 
PrefContext->SelectedLine, LineName, MIXER_LONG_NAME_CHARS, FALSE) == -1)
+      if (SndMixerGetLineName(PrefContext->MixerWindow->Mixer, 
PrefContext->SelectedLine, LineName, MIXER_LONG_NAME_CHARS, TRUE) == -1)
       {
           /* failed to get line name */
           LineName[0] = L'\0';

Modified: trunk/reactos/base/applications/sndvol32/sndvol32.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sndvol32/sndvol32.c?rev=51292&r1=51291&r2=51292&view=diff
==============================================================================
--- trunk/reactos/base/applications/sndvol32/sndvol32.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/sndvol32/sndvol32.c [iso-8859-1] Sat Apr  9 
10:36:25 2011
@@ -199,7 +199,7 @@
                                     PrefContext->SelectedLine,
                                     LineName,
                                     MIXER_LONG_NAME_CHARS,
-                                    FALSE) == -1)
+                                    TRUE) == -1)
             {
                 LineName[0] = TEXT('\0');
             }
@@ -340,7 +340,7 @@
 
 static 
 VOID
-WriteLineSettings(PREFERENCES_CONTEXT Context, HWND hwndDlg)
+WriteLineSettings(PPREFERENCES_CONTEXT Context, HWND hwndDlg)
 {
     HWND hwndControls;
     INT Count, Index;
@@ -358,7 +358,7 @@
     /* sanity check */
     assert(Count);
 
-    if (SndMixerGetLineName(Preferences.MixerWindow->Mixer, 
Preferences.SelectedLine, DestinationName, MIXER_LONG_NAME_CHARS, TRUE) == -1)
+    if (SndMixerGetLineName(Context->Mixer, Context->SelectedLine, 
DestinationName, MIXER_LONG_NAME_CHARS, TRUE) == -1)
     {
         /* failed to get destination line name */
         return;
@@ -395,7 +395,7 @@
     }
 
     /* now write the line config */
-    WriteLineConfig(Preferences.DeviceName, DestinationName, LineStates, 
sizeof(SNDVOL_REG_LINESTATE) * Count);
+    WriteLineConfig(Context->DeviceName, DestinationName, LineStates, 
sizeof(SNDVOL_REG_LINESTATE) * Count);
 
     /* free line states */
     HeapFree(GetProcessHeap(), 0, LineStates);
@@ -509,7 +509,7 @@
                 case IDOK:
                 {
                     /* write line settings */
-                    WriteLineSettings(Preferences, hwndDlg);
+                    WriteLineSettings(Context, hwndDlg);
 
                     /* fall through */
                 }
@@ -564,19 +564,8 @@
 
             /* update all controls */
             UpdatePrefDlgControls(Context,
-                                  (DWORD)-1);
+                                  (DWORD)Context->SelectedLine);
             return TRUE;
-        }
-
-        case WM_DESTROY:
-        {
-            Context = GetDialogData(hwndDlg,
-                                    PREFERENCES_CONTEXT);
-            if (Context->Mixer != NULL)
-            {
-                SndMixerDestroy(Context->Mixer);
-            }
-            break;
         }
 
         case WM_CLOSE:
@@ -789,16 +778,17 @@
             {
                 case IDC_PROPERTIES:
                 {
-                    PREFERENCES_CONTEXT Preferences;
-
-                    Preferences.MixerWindow = MixerWindow;
-                    Preferences.Mixer = NULL;
+                    PREFERENCES_CONTEXT Pref;
+
+                    Pref.MixerWindow = MixerWindow;
+                    Pref.Mixer = NULL;
+                    Pref.SelectedLine = Preferences.SelectedLine;
 
                     if (DialogBoxParam(hAppInstance,
                                        MAKEINTRESOURCE(IDD_PREFERENCES),
                                        hwnd,
                                        DlgPreferencesProc,
-                                       (LPARAM)&Preferences) == IDOK)
+                                       (LPARAM)&Pref) == IDOK)
                     {
                         /* update window */
                         TCHAR szProduct[MAXPNAMELEN];
@@ -820,11 +810,17 @@
                         /* destroy old status bar */
                         DestroyWindow(MixerWindow->hStatusBar);
 
+                        /* update details */
+                        Preferences.SelectedLine = Pref.SelectedLine;
+
+                        /* destroy old mixer */
+                        SndMixerDestroy(Preferences.MixerWindow->Mixer);
+
+                        /* use new selected mixer */
+                        Preferences.MixerWindow->Mixer = Pref.Mixer;
+
                         /* rebuild dialog controls */
-                        if (RebuildMixerWindowControls(&Preferences))
-                        {
-                            DPRINT("Rebuilding mixer window controls 
failed!\n");
-                        }
+                        RebuildMixerWindowControls(&Preferences);
 
                         /* create status window */
                         MixerWindow->hStatusBar = 
CreateStatusWindow(WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS,

Modified: trunk/reactos/base/applications/sndvol32/sndvol32.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sndvol32/sndvol32.h?rev=51292&r1=51291&r2=51292&view=diff
==============================================================================
--- trunk/reactos/base/applications/sndvol32/sndvol32.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/sndvol32/sndvol32.h [iso-8859-1] Sat Apr  9 
10:36:25 2011
@@ -31,8 +31,7 @@
 #define SZ_APP_CLASS TEXT("Volume Control")
 
 ULONG DbgPrint(PCH , ...);
-#define DPRINT 
-//DbgPrint("SNDVOL32: %s:%i: ", __FILE__, __LINE__); DbgPrint
+#define DPRINT DbgPrint("SNDVOL32: %s:%i: ", __FILE__, __LINE__); DbgPrint
 
 
 /*


Reply via email to