⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.c

📁 读取音乐光盘磁道为磁盘文件的DLL源码
💻 C
字号:
/*
 * config.c - Copyright (C) 1999,2000 Jay A. Key
 *
 * Creates and displays the configuration property sheet.
 *
 **********************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */
#include <windows.h>
#include <commctrl.h>
#include "resources.h"
#include "globals.h"
#include "gauge.h"
#include "statusbar.h"

#if (__IBMC__)                         /* BWT (20000127)                   */
WINCOMMCTRLAPI void WINAPI InitCommonControls(void);   /* BWT (20000127)   */
#endif                                 /* BWT (20000127)                   */

void GetSetOutputDlgCurrentVals( BOOL bGet );
void GetSetCDDlgCurrentVals( BOOL bGet );
void GetSetMP3DlgCurrentVals( BOOL bGet );
void GetSetCDDBDlgCurrentVals( BOOL bGet );

void centerDialog( HWND hWnd );
BOOL CALLBACK GenericDlgProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                             LPARAM lParam );
BOOL CALLBACK CDDlgProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                             LPARAM lParam );
BOOL CALLBACK OutputDlgProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                             LPARAM lParam );
BOOL CALLBACK MP3DlgProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                             LPARAM lParam );
BOOL CALLBACK CDDBDlgProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                           LPARAM lParam );


void centerDialog( HWND hWnd )
{
  RECT r, rs;
  LONG x, y, w, h;

  if ( !hWnd )
    return;

  GetWindowRect( hWnd, &r );
  GetWindowRect( GetDesktopWindow(), &rs );
  w = r.right - r.left;
  h = r.bottom - r.top;
  x = ( rs.left + rs.right ) / 2 - ( w / 2 );
  y = ( rs.top + rs.bottom ) / 2 - ( h / 2 );
  MoveWindow( hWnd, x, y, w, h, TRUE );
}


BOOL CALLBACK GenericDlgProc( HWND hWnd, UINT uMsg, WPARAM wParam,
                             LPARAM lParam )
{
  //char buf[81];
  NMHDR *l = (NMHDR *)lParam;
  WORD wID;

  switch( uMsg )
    {
    case WM_COMMAND:
      wID = LOWORD( wParam );
      break;

    case WM_CREATE:
      break;

    case WM_NOTIFY:
      switch( l->code )
        {
        case PSN_SETACTIVE:  // sent before page is shown
          break;

        case PSN_KILLACTIVE:  //losing focus
          SetWindowLong( hWnd, DWL_MSGRESULT, FALSE );
          break;

        case PSN_QUERYCANCEL:
          break;

        case PSN_APPLY:
          break;

        case PSN_HELP:
          break;

        case PSN_RESET:
          break;

        default:
          break;
        }
      break;
    }

  return FALSE;
}


int DoConfig( HWND hParent, HINSTANCE hInst, UINT uiStartPage )
{
  HPROPSHEETPAGE hPg[4];
  PROPSHEETPAGE p;
  PROPSHEETHEADER ph;
  //char buf[81];
  int retVal;

  InitCommonControls();

  memset( &p, 0, sizeof(p) );
  p.dwSize      = sizeof(p);
  p.dwFlags     = PSP_DEFAULT;
  p.hInstance   = hInst;
#ifdef __GNUC__
  p.u.pszTemplate = "CDControlDialog";
#else
  p.pszTemplate = "CDControlDialog";
#endif
  p.pfnDlgProc  = (DLGPROC)CDDlgProc;

  hPg[0] = CreatePropertySheetPage( &p );

  memset( &p, 0, sizeof(p) );
  p.dwSize      = sizeof(p);
  p.dwFlags     = PSP_DEFAULT;
  p.hInstance   = hInst;
#ifdef __GNUC__
  p.u.pszTemplate = "DirectoryDialog";
#else
  p.pszTemplate = "DirectoryDialog";
#endif
  p.pfnDlgProc  = (DLGPROC)OutputDlgProc;

  hPg[1] = CreatePropertySheetPage( &p );

  memset( &p, 0, sizeof(p) );
  p.dwSize      = sizeof(p);
  p.dwFlags     = PSP_DEFAULT;
  p.hInstance   = hInst;
#ifdef __GNUC__
  p.u.pszTemplate = "MP3OptionsDialog";
#else
  p.pszTemplate = "MP3OptionsDialog";
#endif
  p.pfnDlgProc  = (DLGPROC)MP3DlgProc;

  hPg[2] = CreatePropertySheetPage( &p );

  memset( &p, 0, sizeof(p) );
  p.dwSize      = sizeof(p);
  p.dwFlags     = PSP_DEFAULT;
  p.hInstance   = hInst;
#ifdef __GNUC__
  p.u.pszTemplate = "CDDBOptionsDialog";
#else
  p.pszTemplate = "CDDBOptionsDialog";
#endif
  p.pfnDlgProc  = (DLGPROC)CDDBDlgProc;

  hPg[3] = CreatePropertySheetPage( &p );

  memset( &ph, 0, sizeof(ph) );
  ph.dwSize      = sizeof(ph);
  ph.dwFlags     = PSH_DEFAULT;
  ph.hwndParent  = hParent;
  ph.hInstance   = hInst;
#ifdef __GNUC__
  ph.u.pszIcon  = "GUIRIPLG";
  ph.u2.nStartPage = uiStartPage;
  ph.u3.phpage   = hPg;
#else
  ph.pszIcon  = "GUIRIPLG";
  ph.nStartPage = uiStartPage;
  ph.phpage   = hPg;
#endif
  ph.pszCaption  = "CD-DA X-Tractor Options";
  ph.nPages      = 4;

  GetSetCDDlgCurrentVals( TRUE );  // read current values
  GetSetOutputDlgCurrentVals( TRUE );  // read current values
  GetSetMP3DlgCurrentVals( TRUE );
  GetSetCDDBDlgCurrentVals( TRUE );

  retVal = PropertySheet( &ph );

  // cancel == 0; OK == 1; 
  if ( retVal <= 0 )
    return 0;  

  // save the info
  GetSetCDDlgCurrentVals( FALSE );  // set current values
  GetSetOutputDlgCurrentVals( FALSE );  // set current values
  GetSetCDDBDlgCurrentVals( FALSE );

  UpdateStatusBar();

  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -