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

Chris Wolf cwolf at xiph.org
Sat Jan 5 10:55:29 PST 2002



cwolf       02/01/05 10:55:29

  Modified:    oggdrop  Script.rc encthread.c main.c oggdrop.opt resource.h
  Log:
  Add current file name to file progress bar.  Add show-nominal-bitrate option
  for quality mode.  Add optional nominal birate display.

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

Index: Script.rc
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/Script.rc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Script.rc	2002/01/04 03:42:55	1.11
+++ Script.rc	2002/01/05 18:55:27	1.12
@@ -75,10 +75,8 @@
     POPUP "Menu"
     BEGIN
         MENUITEM "&Encode Parameters",          IDM_SAVEQUALITY
-        POPUP "&Options"
-        BEGIN
-            MENUITEM "&Errors to log file",         IDM_LOGERR
-        END
+        MENUITEM "&Errors to log file",         IDM_LOGERR
+        MENUITEM "&Show Nominal Bitrate",       IDM_SHOWNBR
         MENUITEM "Always on &Top",              IDM_ONTOP
         MENUITEM SEPARATOR
         MENUITEM "E&xit\tAlt+F4",               IDM_QUIT

1.9       +2 -0      win32-tools/oggdrop/encthread.c

Index: encthread.c
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/encthread.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- encthread.c	2002/01/03 09:12:13	1.8
+++ encthread.c	2002/01/05 18:55:27	1.9
@@ -48,6 +48,7 @@
         }
 }
 
+extern char* fileName;
 void encthread_addfile(char *file)
 {
         char *filename;
@@ -196,6 +197,7 @@
                                 strncpy(out_fn, start, end-start);
                                 out_fn[end-start] = 0;
                                 strcat(out_fn, ".ogg");
+        fileName = out_fn;
                         }
 
                         /* Now, we need to select an input audio format */

1.10      +66 -5     win32-tools/oggdrop/main.c

Index: main.c
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/main.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- main.c	2002/01/04 03:42:55	1.9
+++ main.c	2002/01/05 18:55:27	1.10
@@ -15,9 +15,13 @@
 
 #define VORBIS_DEFAULT_QUALITY 75
 
+#define CREATEFONT(sz) \
+  CreateFont((sz), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+              VARIABLE_PITCH | FF_SWISS, "")
+   
 HANDLE event = NULL;
 int width = 120, height = 120;
-RECT bar1, bar2;
+RECT bar1, bar2, vbrBR;
 int prog1 = 0, prog2 = 0;
 int moving = 0;
 POINT pt;
@@ -31,8 +35,13 @@
 int numfiles;
 HWND g_hwnd;
 HWND qcwnd;
+HFONT font2;
 int qcValue;
 int bitRate;
+char *fileName;
+OE_MODE oe_mode;
+int nominalBitrate;
+int showNBR;
 
 
 static const char *bitRateCaption[] =
@@ -118,6 +127,13 @@
         write_setting("logerr", v);
 }
 
+void set_showNBR(HWND hwnd, int v)
+{
+  CheckMenuItem(menu, IDM_SHOWNBR, v ? MF_CHECKED : MF_UNCHECKED);
+  write_setting("shownbr", v);
+  showNBR = v;
+}
+
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
 {
     static char szAppName[] = "oggdropWin";
@@ -155,12 +171,15 @@
         ShowWindow(hwnd, iCmdShow);
         UpdateWindow(hwnd);
 
+  font2 = CREATEFONT(10);
+
         SetTimer(hwnd, 1, 80, NULL);
 
   qcValue = read_setting("quality", VORBIS_DEFAULT_QUALITY);
   set_quality_coefficient(qcValue);
         set_always_on_top(hwnd, read_setting("always_on_top", 1));
         set_logerr(hwnd, read_setting("logerr", 0));
+  set_showNBR(hwnd, read_setting("shownbr", 1));
         
         for (frame = 0; frame < 12; frame++)
                 hbm[frame] = LoadImage(hinst, MAKEINTRESOURCE(IDB_TF01 + frame), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
@@ -215,6 +234,8 @@
         HDC desktop;
         HBITMAP hbitmap;
         HANDLE hdrop;
+  HFONT dfltFont;
+  int dfltBGMode;
         double percomp;
 
         switch (message) {
@@ -251,13 +272,47 @@
                 DeleteDC(hmem);
                 
                 percomp = ((double)(totalfiles - numfiles) + 1 - (1 - file_complete)) / (double)totalfiles;
+
+    //SetRect(&vbrBR, 0, height - (height-14), width, height - (height-26));
+    SetRect(&vbrBR, 0, height - 29, width, height - 19);
+
+    dfltBGMode = SetBkMode(offscreen, TRANSPARENT);
+    dfltFont = SelectObject(offscreen, font2);
+
+    if (oe_mode == OE_MODE_QUALITY && showNBR)
+    {
+      char nbrCaption[80];
+
+      (void) sprintf(nbrCaption, "%d NBR", nominalBitrate);
+
+      DrawText(offscreen, nbrCaption, -1, 
+             &vbrBR, DT_SINGLELINE | DT_CENTER);
+    }
+
+
+		SetRect(&bar1, 0, height - 19, (int)(file_complete * width), height - 9);
+		SetRect(&bar2, 0, height - 8, (int)(percomp * width), height - 2);
+
+		FillRect(offscreen, &bar1, (HBRUSH)GetStockObject(LTGRAY_BRUSH));
+		FillRect(offscreen, &bar2, (HBRUSH)GetStockObject(GRAY_BRUSH));
+
+    if (fileName)
+    {
+      char* sep;
+      char  fileCaption[80];
+
+      if ((sep = strrchr(fileName, '\\')) != 0)
+        fileName = sep+1;
 
-		SetRect(&bar1, 0, height - 23, (int)(file_complete * width), height - 13);
-		SetRect(&bar2, 0, height - 12, (int)(percomp * width), height - 2);
+      (void) strcpy(fileCaption, "   ");
+      (void) strcat(fileCaption, fileName);
 
-		FillRect(offscreen, &bar1, (HBRUSH)GetStockObject(BLACK_BRUSH));
-		FillRect(offscreen, &bar2, (HBRUSH)GetStockObject(BLACK_BRUSH));
+      DrawText(offscreen, fileCaption, -1, &bar1, DT_SINGLELINE | DT_LEFT);
+    }
 
+    SelectObject(offscreen, dfltFont);
+    SetBkMode(offscreen, dfltBGMode);
+
                 BitBlt(hdc, 0, 0, width, height, offscreen, 0, 0, SRCCOPY);
 
                 EndPaint(hwnd, &ps);
@@ -338,6 +393,9 @@
                 case IDM_LOGERR:
                         set_logerr(hwnd, ~GetMenuState(menu, LOWORD(wParam), MF_BYCOMMAND) & MF_CHECKED);
                         break;
+    case IDM_SHOWNBR:
+      set_showNBR(hwnd, ~GetMenuState(menu, LOWORD(wParam), MF_BYCOMMAND) & MF_CHECKED);
+      break;
 
     case IDM_SAVEQUALITY:
       {
@@ -476,11 +534,13 @@
           if (IsDlgButtonChecked(hwndDlg, IDC_USEQUALITY) == BST_CHECKED)
           {
             write_setting("mode", IDC_USEQUALITY);
+            oe_mode = OE_MODE_QUALITY;
             EndDialog(hwndDlg, qcValue);
           }
           else
           {
             write_setting("mode", IDC_USEBITRATE);
+            oe_mode = OE_MODE_BITRATE;
             EndDialog(hwndDlg, -2); // use bitrate
           }
           return TRUE;
@@ -581,3 +641,4 @@
   return FALSE; 
 } 
  
+        
\ No newline at end of file

1.8       +65 -22    win32-tools/oggdrop/oggdrop.opt

Index: oggdrop.opt
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/oggdrop.opt,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
Binary files /tmp/cvs6Tx9kf and /tmp/cvsAX4sUq differ

1.8       +3 -2      win32-tools/oggdrop/resource.h

Index: resource.h
===================================================================
RCS file: /usr/local/cvsroot/win32-tools/oggdrop/resource.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- resource.h	2002/01/03 07:44:59	1.7
+++ resource.h	2002/01/05 18:55:28	1.8
@@ -35,14 +35,15 @@
 #define IDM_BITRATE96                   40014
 #define IDM_LOGERR                      40015
 #define IDM_SAVEQUALITY                 40016
+#define IDM_SHOWNBR                     40017
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NO_MFC                     1
-#define _APS_NEXT_RESOURCE_VALUE        133
-#define _APS_NEXT_COMMAND_VALUE         40017
+#define _APS_NEXT_RESOURCE_VALUE        134
+#define _APS_NEXT_COMMAND_VALUE         40018
 #define _APS_NEXT_CONTROL_VALUE         1021
 #define _APS_NEXT_SYMED_VALUE           101
 #endif

--- >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