void COption::Init(CSearchToolBar& toolbar, CMainListView& listview) { m_pToolBar = &toolbar; m_pListView = &listview; LoadIni(); // Read Susie Plugin if (m_option.bSusieUse) { CSusie susie; susie.LoadSpi(m_option.SusieDir); } }
void CWinMain::SetQuickMenuItem(int id) { COption option_dialog; SOption& options = option_dialog.GetOpt(); struct QuickSet { LPBOOL option; int id; } quick_set[] = { {&options.bHighSearchOgg, IDM_QUICKSET_STD_SEARCHOGG}, {&options.bCreateFolder, IDM_QUICKSET_EXTRACT_CREATEFOLDER}, {&options.bFixOgg, IDM_QUICKSET_EXTRACT_FIXOGG}, {&options.bEasyDecrypt, IDM_QUICKSET_EXTRACT_EASYDECRYPT}, {&options.bDstPNG, IDM_QUICKSET_EXTRACT_DSTPNG}, {&options.bAlphaBlend, IDM_QUICKSET_EXTRACT_ALPHABLEND}, {&options.bSusieUse, IDM_QUICKSET_SUSIE_USE}, {&options.bSusieFirst, IDM_QUICKSET_SUSIE_FIRST} }; for (auto& entry : quick_set) { if (entry.id == id) *entry.option ^= 1; } if (id == IDM_QUICKSET_EXTRACT_DSTPNG) { // Extract images as PNG or BMP depending on setting options.bDstBMP ^= 1; } else if (id == IDM_QUICKSET_SUSIE_USE && options.bSusieUse == TRUE) { // Load Susie Plug-ins CSusie susie; susie.LoadSpi(options.SusieDir); } option_dialog.SaveIni(); }
void CWinMain::SetQuickMenuItem(int nID) { COption clOption; SOption& stOption = clOption.GetOpt(); struct SQuickSet { LPBOOL pbOption; int nID; } stQuickSet[] = { {&stOption.bHighSearchOgg, IDM_QUICKSET_STD_SEARCHOGG}, {&stOption.bCreateFolder, IDM_QUICKSET_EXTRACT_CREATEFOLDER}, {&stOption.bFixOgg, IDM_QUICKSET_EXTRACT_FIXOGG}, {&stOption.bEasyDecrypt, IDM_QUICKSET_EXTRACT_EASYDECRYPT}, {&stOption.bDstPNG, IDM_QUICKSET_EXTRACT_DSTPNG}, {&stOption.bAlphaBlend, IDM_QUICKSET_EXTRACT_ALPHABLEND}, {&stOption.bSusieUse, IDM_QUICKSET_SUSIE_USE}, {&stOption.bSusieFirst, IDM_QUICKSET_SUSIE_FIRST} }; for (int i = 0; i < ARRAYSIZE(stQuickSet); i++) { if (stQuickSet[i].nID == nID) *stQuickSet[i].pbOption ^= 1; } if (nID == IDM_QUICKSET_EXTRACT_DSTPNG) { // Extract images as PNG or BMP depending on setting stOption.bDstBMP ^= 1; } else if (nID == IDM_QUICKSET_SUSIE_USE && stOption.bSusieUse == TRUE) { // Load Susie Plug-ins CSusie clSusie; clSusie.LoadSpi(stOption.SusieDir); } clOption.SaveIni(); }
LRESULT COption::SusieProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { static CFolderDialog FolderDlg; static SOption* pOption = &m_option_tmp; static CCheckBox SusieCheckUse, SusieCheckFirst; static CLabel SusieLabelDir; static CEditBox SusieEditDir; static CButton SusieBtnDir, SusieBtnUpdate; static std::array<CButton, 2> SusieBtn; static CSusieListView SusieListView; static CSusie susie; switch (msg) { case WM_INITDIALOG: { UINT ID = 10000; const int x = 10; const int xx = 15; int y = 0; SusieCheckUse.Create(hWnd, _T("Use Susie Plugins"), ID++, x + 15, y += 20, 200, 20); SusieCheckUse.SetCheck(pOption->bSusieUse); SusieLabelDir.Create(hWnd, _T("Susie Folder"), ID++, x + xx, y += 24, 75, 20); SusieEditDir.Create(hWnd, pOption->SusieDir, ID++, x + xx + 75, y - 4, 200, 22); SusieEditDir.Enable(pOption->bSusieUse); SusieBtnDir.Create(hWnd, _T("Browse"), ID++, x + xx + 280, y - 3, 50, 20); SusieBtnDir.Enable(pOption->bSusieUse); SusieCheckFirst.Create(hWnd, _T("Give Susie plugins priority when decoding"), ID++, x + xx, y += 20, 250, 20); SusieCheckFirst.SetCheck(pOption->bSusieFirst); SusieCheckFirst.Enable(pOption->bSusieUse); SusieListView.Create(hWnd, *pOption, x + xx, y += 30, 500, 190); SusieListView.Close(); SusieListView.Enable(pOption->bSusieUse); SusieListView.Show(); SusieBtnUpdate.Create(hWnd, _T("Update"), ID++, x + 290, y += 200, 50, 20); SusieBtnUpdate.Enable(pOption->bSusieUse); SusieBtn[0].Create(hWnd, _T("All ON"), ID++, x + 350, y, 80, 20); SusieBtn[0].Enable(pOption->bSusieUse); SusieBtn[1].Create(hWnd, _T("All OFF"), ID++, x + 430, y, 80, 20); SusieBtn[1].Enable(pOption->bSusieUse); break; } case WM_COMMAND: // Use Susie plugins if (LOWORD(wp) == SusieCheckUse.GetID()) { const BOOL flag = SusieCheckUse.GetCheck(); SusieEditDir.Enable(flag); SusieBtnDir.Enable(flag); SusieCheckFirst.Enable(flag); SusieListView.Enable(flag); SusieBtnUpdate.Enable(flag); SusieBtn[0].Enable(flag); SusieBtn[1].Enable(flag); PropSheet_Changed(::GetParent(hWnd), hWnd); // Click here to show / hide the list of checkboxes, de-selected state pOption->bSusieUse = flag; SusieListView.SetItemSelAll(0); break; } // Susie Folder Browse if (LOWORD(wp) == SusieBtnDir.GetID()) { TCHAR szSusieDir[_MAX_DIR]; SusieEditDir.GetText(szSusieDir, sizeof(szSusieDir)); if (FolderDlg.DoModal(hWnd, _T("Select the Susie folder"), szSusieDir)) SusieEditDir.SetText(szSusieDir); } // Give Susie plugins priority on decoding if (LOWORD(wp) == SusieCheckFirst.GetID()) { PropSheet_Changed(::GetParent(hWnd), hWnd); break; } // Update if (LOWORD(wp) == SusieBtnUpdate.GetID()) { susie.LoadSpi(pOption->SusieDir); susie.Init(); SusieListView.Show(); SusieListView.Update(); break; } // All ON if (LOWORD(wp) == SusieBtn[0].GetID()) { SusieListView.SetCheckAll(true); PropSheet_Changed(::GetParent(hWnd), hWnd); break; } // All OFF if (LOWORD(wp) == SusieBtn[1].GetID()) { SusieListView.SetCheckAll(false); PropSheet_Changed(::GetParent(hWnd), hWnd); break; } // Settings if (LOWORD(wp) == IDM_SUSIE_SET) { const SSusieInfo* const susie_info = SusieListView.GetFocusSusieInfo(); // Get ConfigurationDlg() const auto ConfigurationDlg = reinterpret_cast<ConfigurationDlgProc>(susie_info->plugin.GetProcAddress(_T("ConfigurationDlg"))); if (ConfigurationDlg == nullptr) break; // Call settings ConfigurationDlg(hWnd, 1); break; } // Contents of the editbox have changed if (HIWORD(wp) == EN_CHANGE) { PropSheet_Changed(::GetParent(hWnd), hWnd); break; } break; case WM_NOTIFY: { const auto* const hdr = reinterpret_cast<LPNMHDR>(lp); switch (hdr->code) { // OK/Apply, Tabbing case PSN_APPLY: case PSN_KILLACTIVE: pOption->bSusieUse = SusieCheckUse.GetCheck(); pOption->bSusieFirst = SusieCheckFirst.GetCheck(); SusieEditDir.GetText(pOption->SusieDir); SusieListView.SaveIni(); // OK/Apply if (hdr->code == PSN_APPLY) { const bool update = m_option.SusieDir == pOption->SusieDir; Apply(); // Re-acquire plugin folder only when Susie has been changed if (pOption->bSusieUse && update) { susie.LoadSpi(pOption->SusieDir); susie.Init(); SusieListView.Show(); SusieListView.Update(); } } return TRUE; // Check processing case NM_CLICK: case NM_DBLCLK: if (hdr->idFrom == idsSusieList) { if (SusieListView.SetCheck()) PropSheet_Changed(::GetParent(hWnd), hWnd); break; } } // List view if (wp == idsSusieList) { const auto* const plv = reinterpret_cast<LPNMLISTVIEW>(lp); switch (plv->hdr.code) { // Custom draw case NM_CUSTOMDRAW: return SusieListView.CustomDraw(reinterpret_cast<LPNMLVCUSTOMDRAW>(lp)); // Show tool tip case LVN_GETINFOTIP: SusieListView.ShowTip(reinterpret_cast<LPNMLVGETINFOTIP>(lp)); break; // View case LVN_GETDISPINFO: SusieListView.Show(reinterpret_cast<NMLVDISPINFO*>(lp)); break; } } break; } case WM_MOUSEWHEEL: { POINT pos; GetCursorPos(&pos); HWND pWnd = WindowFromPoint(pos); if (pWnd == SusieListView.GetHandle()) SendMessage(pWnd, WM_MOUSEWHEEL, wp, lp); break; } // Right-click menu (Context menu) case WM_CONTEXTMENU: { if (wp == reinterpret_cast<WPARAM>(SusieListView.GetHandle())) SusieListView.CreateMenu(lp); break; } } return FALSE; }