<commit_before>/*
  Copyright (c) 1999 - 2002 <NAME> <<EMAIL>>
  Copyright (c) 2002 <NAME> <<EMAIL>>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library 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
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include "plugin.h"

#define STRING_TRUNC	40

extern HINSTANCE myInstance;
extern Config config;
extern FileTypes filetypes;

GuiCtrlTooltip tooltip;

void GuiDlgConfig::open(HWND parent)
{
	config.get(&next);

	DialogBoxParam(myInstance,MAKEINTRESOURCE(IDD_CONFIG),parent,(DLGPROC)DlgProc_Wrapper,(LPARAM)this);

	if (!cancelled)
		config.set(&next);
}

BOOL APIENTRY GuiDlgConfig::DlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
#ifdef _DEBUG
	//printf("GuiDlgConfig::DlgProc(): Message 0x%08X received.\n",message);
#endif
	TCITEM tci;

	switch (message)
	{
	    case WM_INITDIALOG:

			tab_hwnd = NULL;

			// enable tooltip trigger
			tooltip.trigger(GetDlgItem(hwndDlg,IDC_TOOLTIPS));

			// init tab control
			tci.mask = TCIF_TEXT;

			tci.pszText = "Output";
			SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_INSERTITEM,0,(LPARAM)&tci);
		
			tci.pszText = "Playback";
			SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_INSERTITEM,1,(LPARAM)&tci);
		
			tci.pszText = "Formats";
			SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_INSERTITEM,2,(LPARAM)&tci);

			// set default tab index
			SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_SETCURSEL,0,0);


		case WM_UPDATE:

			// delete old tab window
			if (tab_hwnd)
			{
				DestroyWindow(tab_hwnd);

				tab_hwnd = NULL;
			}

			// display new tab window
			tab_index = (int)SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_GETCURSEL,0,0);

			if (tab_index == 0)
				tab_hwnd = CreateDialogParam(myInstance,MAKEINTRESOURCE(IDD_CFG_OUTPUT),GetDlgItem(hwndDlg,IDC_CTABS),(DLGPROC)TabDlgProc_Wrapper,(LPARAM)this);
			if (tab_index == 1)
				tab_hwnd = CreateDialogParam(myInstance,MAKEINTRESOURCE(IDD_CFG_PLAYBACK),GetDlgItem(hwndDlg,IDC_CTABS),(DLGPROC)TabDlgProc_Wrapper,(LPARAM)this);
			if (tab_index == 2)
				tab_hwnd = CreateDialogParam(myInstance,MAKEINTRESOURCE(IDD_CFG_FORMATS),GetDlgItem(hwndDlg,IDC_CTABS),(DLGPROC)TabDlgProc_Wrapper,(LPARAM)this);

			return FALSE;


		case WM_NOTIFY:
			switch (((NMHDR *)lParam)->code)
			{
				case TCN_SELCHANGE:
					PostMessage(hwndDlg,WM_UPDATE,0,0);
					return FALSE;
			}


		case WM_COMMAND:
			switch (LOWORD(wParam))
			{
				case IDOK:
					cancelled = false;
					EndDialog(hwndDlg,wParam);
					return 0;

				case IDCANCEL:
					cancelled = true;
					EndDialog(hwndDlg,wParam);
					return 0;
			}
	}

	return FALSE;
}

BOOL APIENTRY GuiDlgConfig::OutputTabDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
#ifdef _DEBUG
	//printf("GuiDlgConfig::OutputTabDlgProc(): Message 0x%08X received.\n",message);
#endif
	char bufstr[5];
	unsigned long bufint;<commit_msg>bugfix: config dialog didn't open on winamp 5<commit_after>/*
  Copyright (c) 1999 - 2002 <NAME> <<EMAIL>>
  Copyright (c) 2002 <NAME> <<EMAIL>>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library 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
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include "plugin.h"

#define STRING_TRUNC	40

extern HINSTANCE myInstance;
extern Config config;
extern FileTypes filetypes;

GuiCtrlTooltip tooltip;

void GuiDlgConfig::open(HWND parent)
{
	config.get(&next);

	DialogBoxParam(myInstance,MAKEINTRESOURCE(IDD_CONFIG),parent,(DLGPROC)DlgProc_Wrapper,(LPARAM)this);

	if (!cancelled)
		config.set(&next);
}

BOOL APIENTRY GuiDlgConfig::DlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
#ifdef _DEBUG
		//printf("GuiDlgConfig::DlgProc(): Message 0x%08X received. wParam = 0x%08X, lParam = 0x%08X\n", message, wParam, lParam);
#endif
	TCITEM tci;

	switch (message)
	{
	    case WM_INITDIALOG:

			tab_hwnd = NULL;

			// enable tooltip trigger
			tooltip.trigger(GetDlgItem(hwndDlg,IDC_TOOLTIPS));

			// init tab control
			tci.mask = TCIF_TEXT;

			tci.pszText = "Output";
			SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_INSERTITEM,0,(LPARAM)&tci);
		
			tci.pszText = "Playback";
			SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_INSERTITEM,1,(LPARAM)&tci);
		
			tci.pszText = "Formats";
			SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_INSERTITEM,2,(LPARAM)&tci);

			// set default tab index
			SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_SETCURSEL,0,0);

		case WM_UPDATE:

			// delete old tab window
			if (tab_hwnd)
			{
				DestroyWindow(tab_hwnd);

				tab_hwnd = NULL;
			}

			// display new tab window
			tab_index = (int)SendDlgItemMessage(hwndDlg,IDC_CTABS,TCM_GETCURSEL,0,0);

			if (tab_index == 0)
				tab_hwnd = CreateDialogParam(myInstance,MAKEINTRESOURCE(IDD_CFG_OUTPUT),GetDlgItem(hwndDlg,IDC_CTABS),(DLGPROC)TabDlgProc_Wrapper,(LPARAM)this);
			if (tab_index == 1)
				tab_hwnd = CreateDialogParam(myInstance,MAKEINTRESOURCE(IDD_CFG_PLAYBACK),GetDlgItem(hwndDlg,IDC_CTABS),(DLGPROC)TabDlgProc_Wrapper,(LPARAM)this);
			if (tab_index == 2)
				tab_hwnd = CreateDialogParam(myInstance,MAKEINTRESOURCE(IDD_CFG_FORMATS),GetDlgItem(hwndDlg,IDC_CTABS),(DLGPROC)TabDlgProc_Wrapper,(LPARAM)this);

			return FALSE;


		case WM_NOTIFY:
			switch (((NMHDR *)lParam)->code)
			{
				case TCN_SELCHANGE:
					PostMessage(hwndDlg,WM_UPDATE,0,0);
					return FALSE;
			}

			return FALSE;


		case WM_COMMAND:
			switch (LOWORD(wParam))
			{
				case IDOK:
					cancelled = false;
					EndDialog(hwndDlg,wParam);
					return FALSE;

				case IDCANCEL:
					cancelled = true;
					EndDialog(hwndDlg,wParam);
					return FALSE;
			}
	}

	return FALSE;
}

BOOL APIENTRY GuiDlgConfig::OutputTabDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
#ifdef _DEBUG
	//printf("GuiDlgConfig::OutputTabDlgProc(): Message 0x%08X received.\n",message);
#endif
	char bufstr[5];
	unsigned long bufint;
{'fraction_non_alphanumeric': 0.10244604316546763, 'fraction_numerical': 0.01539568345323741, 'mean_word_length': 4.619240097008892, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5351856', 'n_tokens_mistral': 2802, 'n_tokens_neox': 2546, 'n_words': 587}