[xiph-cvs] cvs commit: win32-tools/oggdrop Script.rc main.c oggdrop.opt

Chris Wolf cwolf at xiph.org
Thu Jan 3 19:42:56 PST 2002



cwolf       02/01/03 19:42:56

  Modified:    oggdrop  Script.rc main.c oggdrop.opt
  Log:
  Fix slider/text field stability problem, enable linefeed to activate default button.

Revision  Changes    Path
1.11      +2 -2      win32-tools/oggdrop/Script.rc

Index: Script.rc
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/Script.rc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Script.rc	2002/01/03 08:04:37	1.10
+++ Script.rc	2002/01/04 03:42:55	1.11
@@ -108,8 +108,8 @@
 BEGIN
     CONTROL         "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | 
                     TBS_BOTH | WS_TABSTOP,45,39,115,24
-    PUSHBUTTON      "Accept",IDC_BUTTON1,99,81,30,14
-    EDITTEXT        IDC_EDIT1,13,44,25,14,ES_WANTRETURN
+    DEFPUSHBUTTON   "Accept",IDC_BUTTON1,99,81,30,14
+    EDITTEXT        IDC_EDIT1,13,44,25,14,ES_MULTILINE
     GROUPBOX        "Quality",IDC_STATIC,7,31,161,40
     CONTROL         "Quality Setting",IDC_USEQUALITY,"Button",
                     BS_AUTORADIOBUTTON,15,17,61,10

1.9       +42 -11    win32-tools/oggdrop/main.c

Index: main.c
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/main.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- main.c	2002/01/03 07:44:59	1.8
+++ main.c	2002/01/04 03:42:55	1.9
@@ -372,6 +372,8 @@
         return DefWindowProc(hwnd, message, wParam, lParam);
 }
 
+int sliding=FALSE;
+
  /**
   *  Encode parameters dialog procedures.
   */
@@ -386,6 +388,8 @@
   { 
   case WM_INITDIALOG: 
  
+    sliding = FALSE;
+
     SendDlgItemMessage(hwndDlg, IDC_SLIDER1, TBM_SETRANGE, 
         (WPARAM) TRUE,                   // redraw flag 
         (LPARAM) MAKELONG(0, 100));  // min. & max. positions 
@@ -410,8 +414,10 @@
     SendDlgItemMessage(hwndDlg, IDC_EDIT1, WM_SETTEXT,
         (WPARAM)0, (LPARAM)editBuf);
 
+    SetFocus(GetDlgItem(hwndDlg, IDC_EDIT1));
+
     SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_SETSEL,
-        (WPARAM)0, (LPARAM)-1);
+                  (WPARAM)0, (LPARAM)-1);
 
     (void) CheckRadioButton(hwndDlg, IDC_USEQUALITY,
                                      IDC_USEBITRATE,
@@ -443,6 +449,8 @@
 
    case WM_HSCROLL:
 
+    sliding = TRUE;
+
     qcValue = (LONG)SendDlgItemMessage(hwndDlg, IDC_SLIDER1, 
                         TBM_GETPOS, (WPARAM)0, (LPARAM)0 );
 
@@ -454,7 +462,7 @@
     (void) CheckRadioButton(hwndDlg, IDC_USEQUALITY,
                                      IDC_USEBITRATE,
                                      IDC_USEQUALITY);
-
+    
     break;
 
     case WM_CLOSE:
@@ -500,38 +508,61 @@
           {
            
           case EN_UPDATE:
-            (void) memset(&buf2, 0, sizeof(buf2));
+          {
+
             buf2.buflen = sizeof(buf2.buf);
+
             len = SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_GETLINE,
               (WPARAM) 0, (LPARAM) buf2.buf);
 
+            buf2.buf[len] = '\0';
+
             for (i=0; i<len; i++)
+            {
               if ( ! isdigit(buf2.buf[i]) && buf2.buf[i] != '.')
               {
                 buf2.buf[i] = '\0';
                 SendDlgItemMessage(hwndDlg, IDC_EDIT1, WM_SETTEXT,
                   (WPARAM) 0, (LPARAM) buf2.buf);
               }
+            }
+            
+            if ( atof(buf2.buf) > 10.0f )
+            {
+              SendDlgItemMessage(hwndDlg, IDC_EDIT1, WM_SETTEXT,
+                  (WPARAM) 0, (LPARAM) "10.0");
 
+              SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_SETSEL,
+                  (WPARAM)0, (LPARAM)-1);
+            }
+
+          }
             
             break;
 
           case EN_CHANGE:
+            if ( ! sliding )
             {
               float v=0.0;
 
-            (void) memset(&buf2, 0, sizeof(buf2));
-            buf2.buflen = sizeof(buf2.buf);
-            len = SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_GETLINE,
+              buf2.buflen = sizeof(buf2.buf);
+              len = SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_GETLINE,
               (WPARAM) 0, (LPARAM) buf2.buf);
-            //MessageBox(g_hwnd, buf2.buf, "Second", 0);
+
+              buf2.buf[len] = '\0';
+            
+              v = (float)atof(buf2.buf);
+
+              qcValue = (int)(v*10.0f);
 
-            (void)sscanf(buf2.buf, "%f", &v); 
+              //MessageBox(g_hwnd, buf2.buf, "Second", 0);
 
-            SendDlgItemMessage(hwndDlg, IDC_SLIDER1, TBM_SETPOS, 
-              (WPARAM) TRUE,                   // redraw flag 
-              (LPARAM)(int)(v*10.0f));
+              SendDlgItemMessage(hwndDlg, IDC_SLIDER1, TBM_SETPOS, 
+                (WPARAM) TRUE,                   // redraw flag 
+                (LPARAM)(int)(v*10.0f));
             }
+            else
+              sliding = FALSE;
 
             
           default:

1.7       +16 -15    win32-tools/oggdrop/oggdrop.opt

Index: oggdrop.opt
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/oggdrop.opt,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
Binary files /tmp/cvsPRDfOh and /tmp/cvs0dCS2t differ

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list