[svn] / trunk / xvidcore / dshow / src / CXvidDecoder.cpp Repository:
ViewVC logotype

Diff of /trunk/xvidcore/dshow/src/CXvidDecoder.cpp

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

revision 1899, Sun Oct 17 18:36:12 2010 UTC revision 1901, Fri Oct 29 14:33:39 2010 UTC
# Line 20  Line 20 
20   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
21   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22   *   *
23   * $Id: CXvidDecoder.cpp,v 1.21 2010-10-17 18:36:12 Isibaar Exp $   * $Id: CXvidDecoder.cpp,v 1.22 2010-10-29 14:33:39 Isibaar Exp $
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 170  Line 170 
170  extern HINSTANCE g_xvid_hInst;  extern HINSTANCE g_xvid_hInst;
171    
172  static int GUI_Page = 0;  static int GUI_Page = 0;
173    static int Tray_Icon = 0;
174  extern "C" void CALLBACK Configure(HWND hWndParent, HINSTANCE hInstParent, LPSTR lpCmdLine, int nCmdShow );  extern "C" void CALLBACK Configure(HWND hWndParent, HINSTANCE hInstParent, LPSTR lpCmdLine, int nCmdShow );
175    
176  LRESULT CALLBACK msg_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)  LRESULT CALLBACK msg_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
# Line 191  Line 192 
192                  };                  };
193                  break;                  break;
194    
195            case WM_DESTROY:
196                    NOTIFYICONDATA nid;
197                    ZeroMemory(&nid,sizeof(NOTIFYICONDATA));
198    
199                    nid.cbSize = NOTIFYICONDATA_V1_SIZE;
200                    nid.hWnd = hwnd;
201                    nid.uID = 1456;
202    
203                    Shell_NotifyIcon(NIM_DELETE, &nid);
204                    Tray_Icon = 0;
205          default:          default:
206                  return DefWindowProc(hwnd, uMsg, wParam, lParam);                  return DefWindowProc(hwnd, uMsg, wParam, lParam);
207          }          }
# Line 301  Line 312 
312      xvid_decore_func = NULL; // Hmm, some strange errors appearing if I try to initialize...      xvid_decore_func = NULL; // Hmm, some strange errors appearing if I try to initialize...
313      xvid_global_func = NULL; // ...this in constructor's init-list. So, they assigned here.      xvid_global_func = NULL; // ...this in constructor's init-list. So, they assigned here.
314    
 #ifdef XVID_USE_TRAYICON  
         MSG_hwnd = NULL;  
 #endif  
   
315  #if defined(XVID_USE_MFT)  #if defined(XVID_USE_MFT)
316          InitializeCriticalSection(&m_mft_lock);          InitializeCriticalSection(&m_mft_lock);
317          m_pInputType = NULL;          m_pInputType = NULL;
# Line 456  Line 463 
463  CXvidDecoder::~CXvidDecoder()  CXvidDecoder::~CXvidDecoder()
464  {  {
465      DPRINTF("Destructor");      DPRINTF("Destructor");
         CloseLib();  
466    
467  #ifdef XVID_USE_TRAYICON  #ifdef XVID_USE_TRAYICON
468          if (MSG_hwnd != NULL) {          if (Tray_Icon) { /* Destroy tray icon */
469                  NOTIFYICONDATA nid;                  NOTIFYICONDATA nid;
470                  nid.cbSize = sizeof(NOTIFYICONDATA);                  ZeroMemory(&nid,sizeof(NOTIFYICONDATA));
471    
472                    nid.cbSize = NOTIFYICONDATA_V1_SIZE;
473                  nid.hWnd = MSG_hwnd;                  nid.hWnd = MSG_hwnd;
474                  nid.uID = 100;                  nid.uID = 1456;
475    
476                  Shell_NotifyIcon(NIM_DELETE, &nid);                  Shell_NotifyIcon(NIM_DELETE, &nid);
477                    Tray_Icon = 0;
                 DestroyWindow(MSG_hwnd);  
                 MSG_hwnd = NULL;  
478          }          }
479  #endif  #endif
480    
481            /* Close xvidcore library */
482            CloseLib();
483    
484  #if defined(XVID_USE_MFT)  #if defined(XVID_USE_MFT)
485          DeleteCriticalSection(&m_mft_lock);          DeleteCriticalSection(&m_mft_lock);
486  #endif  #endif
# Line 874  Line 883 
883          DPRINTF("CompleteConnect");          DPRINTF("CompleteConnect");
884    
885  #ifdef XVID_USE_TRAYICON  #ifdef XVID_USE_TRAYICON
886          if ((direction == PINDIR_OUTPUT) && (MSG_hwnd == NULL))          if ((direction == PINDIR_OUTPUT) && (Tray_Icon == 0))
887          {          {
888                  WNDCLASSEX wc;                  WNDCLASSEX wc;
889    
# Line 897  Line 906 
906    
907                  /* display the tray icon */                  /* display the tray icon */
908                  NOTIFYICONDATA nid;                  NOTIFYICONDATA nid;
909                    ZeroMemory(&nid,sizeof(NOTIFYICONDATA));
910    
911                  nid.cbSize = sizeof(NOTIFYICONDATA);                  nid.cbSize = NOTIFYICONDATA_V1_SIZE;
912                  nid.hWnd = MSG_hwnd;                  nid.hWnd = MSG_hwnd;
913                  nid.uID = 100;                  nid.uID = 1456;
                 nid.uVersion = NOTIFYICON_VERSION;  
914                  nid.uCallbackMessage = WM_ICONMESSAGE;                  nid.uCallbackMessage = WM_ICONMESSAGE;
915                  nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON));                  nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON));
916                  strcpy_s(nid.szTip, 19, "Xvid Video Decoder");                  strcpy_s(nid.szTip, 19, "Xvid Video Decoder");
917                  nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;                  nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
918    
919                  Shell_NotifyIcon(NIM_ADD, &nid);                  Shell_NotifyIcon(NIM_ADD, &nid);
920    
921                    DestroyIcon(nid.hIcon);
922                    Tray_Icon = 1;
923          }          }
924  #endif  #endif
925    
# Line 919  Line 931 
931  {  {
932          DPRINTF("BreakConnect");          DPRINTF("BreakConnect");
933    
 #ifdef XVID_USE_TRAYICON  
         if ((direction == PINDIR_OUTPUT) && (MSG_hwnd != NULL)) {  
                 NOTIFYICONDATA nid;  
   
                 nid.cbSize = sizeof(NOTIFYICONDATA);  
                 nid.hWnd = MSG_hwnd;  
                 nid.uID = 100;  
                 nid.uVersion = NOTIFYICON_VERSION;  
   
                 if(Shell_NotifyIcon(NIM_DELETE, &nid) == TRUE) {  
                         DestroyWindow(MSG_hwnd);  
                         MSG_hwnd = NULL;  
                 }  
         }  
 #endif  
   
934          return S_OK;          return S_OK;
935  }  }
936    
# Line 1584  Line 1580 
1580          }          }
1581    
1582  #ifdef XVID_USE_TRAYICON  #ifdef XVID_USE_TRAYICON
1583          if (SUCCEEDED(hr) && MSG_hwnd == NULL) /* Create message passing window */          if (SUCCEEDED(hr) && Tray_Icon == 0) /* Create message passing window */
1584          {          {
1585                  WNDCLASSEX wc;                  WNDCLASSEX wc;
1586    
# Line 1607  Line 1603 
1603    
1604                  /* display the tray icon */                  /* display the tray icon */
1605                  NOTIFYICONDATA nid;                  NOTIFYICONDATA nid;
1606                    ZeroMemory(&nid,sizeof(NOTIFYICONDATA));
1607    
1608                  nid.cbSize = sizeof(NOTIFYICONDATA);                  nid.cbSize = NOTIFYICONDATA_V1_SIZE;
1609                  nid.hWnd = MSG_hwnd;                  nid.hWnd = MSG_hwnd;
1610                  nid.uID = 100;                  nid.uID = 1456;
                 nid.uVersion = NOTIFYICON_VERSION;  
1611                  nid.uCallbackMessage = WM_ICONMESSAGE;                  nid.uCallbackMessage = WM_ICONMESSAGE;
1612                  nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON));                  nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON));
1613                  strcpy_s(nid.szTip, 19, "Xvid Video Decoder");                  strcpy_s(nid.szTip, 19, "Xvid Video Decoder");
1614                  nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;                  nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
1615    
1616                  Shell_NotifyIcon(NIM_ADD, &nid);                  Shell_NotifyIcon(NIM_ADD, &nid);
1617    
1618                    DestroyIcon(nid.hIcon);
1619                    Tray_Icon = 1;
1620          }          }
1621  #endif  #endif
1622    

Legend:
Removed from v.1899  
changed lines
  Added in v.1901

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