| 1 | /* BoCA - BonkEnc Component Architecture |
| 2 | * Copyright (C) 2007-2019 Robert Kausch <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation, either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 10 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 11 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ |
| 12 | |
| 13 | #include "config.h" |
| 14 | #include "dllinterface.h" |
| 15 | |
| 16 | BoCA::ConfigureWinamp::ConfigureWinamp() |
| 17 | { |
| 18 | I18n *i18n = I18n::Get(); |
| 19 | |
| 20 | i18n->SetContext("Extensions::Winamp Adapter"); |
| 21 | |
| 22 | list_input = new ListBox(Point(7, 7), Size(425, 170)); |
| 23 | list_input->onSelectEntry.Connect(&ConfigureWinamp::SelectInputPlugin, this); |
| 24 | |
| 25 | for (Int k = 0; k < winamp_in_modules.Length(); k++) |
| 26 | { |
| 27 | if (winamp_in_modules.GetNth(k)->version == IN_VER_OLD) list_input->AddEntry(winamp_in_modules.GetNth(k)->description); |
| 28 | else list_input->AddEntry((wchar_t *) winamp_in_modules.GetNth(k)->description); |
| 29 | } |
| 30 | |
| 31 | button_input = new Button(i18n->TranslateString("Configure"), Point(440, 7), Size()); |
| 32 | button_input->onAction.Connect(&ConfigureWinamp::ConfigureInputPlugin, this); |
| 33 | button_input->Deactivate(); |
| 34 | |
| 35 | button_input_about = new Button(i18n->TranslateString("About"), Point(440, 37), Size()); |
| 36 | button_input_about->onAction.Connect(&ConfigureWinamp::AboutInputPlugin, this); |
| 37 | button_input_about->Deactivate(); |
| 38 | |
| 39 | Add(list_input); |
| 40 | Add(button_input); |
| 41 | Add(button_input_about); |
| 42 | |
| 43 | SetSize(Size(527, 184)); |
| 44 | } |
| 45 | |
| 46 | BoCA::ConfigureWinamp::~ConfigureWinamp() |
| 47 | { |
| 48 | DeleteObject(list_input); |
| 49 | DeleteObject(button_input); |
| 50 | DeleteObject(button_input_about); |
| 51 | } |
| 52 | |
| 53 | Int BoCA::ConfigureWinamp::SaveSettings() |
| 54 | { |
| 55 | return Success(); |
| 56 | } |
| 57 | |
| 58 | Void BoCA::ConfigureWinamp::SelectInputPlugin() |
| 59 | { |
| 60 | button_input->Activate(); |
| 61 | button_input_about->Activate(); |
| 62 | } |
| 63 | |
| 64 | Void BoCA::ConfigureWinamp::ConfigureInputPlugin() |
| 65 | { |
| 66 | if (list_input->GetSelectedEntry() == NIL) return; |
| 67 | |
| 68 | winamp_in_modules.GetNth(list_input->GetSelectedEntryNumber())->Config((HWND) GetContainerWindow()->GetSystemWindow()); |
| 69 | } |
| 70 | |
| 71 | Void BoCA::ConfigureWinamp::AboutInputPlugin() |
| 72 | { |
| 73 | if (list_input->GetSelectedEntry() == NIL) return; |
| 74 | |
| 75 | winamp_in_modules.GetNth(list_input->GetSelectedEntryNumber())->About((HWND) GetContainerWindow()->GetSystemWindow()); |
| 76 | } |