/* * HelpSettingsDialog.cpp * * Copyright (C) 1999 Stephen F. White/2002 J. "MUFTI" Scheurich * * 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 (see the file "COPYING" for details); if * not, write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. */ #include "stdafx.h" #include "HelpSettingsDialog.h" #include "DuneApp.h" #include "resource.h" #include HelpSettingsDialog::HelpSettingsDialog(SWND parent) : Dialog(parent, IDD_HELP_SETTINGS) { LoadData(); } void HelpSettingsDialog::OnCommand(int id) { switch(id) { case IDC_BROWSE_HELP_COMMAND: OnBrowseHelpCommand(); break; case IDC_BROWSE_DOC_DIRECTORY: OnBrowseDocDirectory(); break; case IDC_BROWSE_VRML_HTML: OnBrowseVrmlDirectory(); break; default: Dialog::OnCommand(id); break; } } static MyString GetText(SWND item) { char buf[1024]; swGetText(item, buf, 1024); return buf; } void HelpSettingsDialog::LoadData() { const char *helpCommand; const char *helpRemoteCommand; const char *helpUrl; const char *vrmlUrl; const char *application; const char *topic; swHelpBrowserGetSettings(TheApp->GetHelpBrowser(), &helpCommand, &helpRemoteCommand, &helpUrl, &vrmlUrl, &application, &topic); swSetText(swGetDialogItem(_dlg, IDC_HELP_COMMAND), helpCommand); swSetText(swGetDialogItem(_dlg, IDC_HELP_REMOTE_COMMAND), helpRemoteCommand); swSetText(swGetDialogItem(_dlg, IDC_DOC_DIRECTORY), helpUrl); swSetText(swGetDialogItem(_dlg, IDC_VRML_HTML), vrmlUrl); swSetText(swGetDialogItem(_dlg, IDC_APPLICATION), application); swSetText(swGetDialogItem(_dlg, IDC_TOPIC), topic); } void HelpSettingsDialog::SaveData() { MyString helpCommand; MyString helpRemoteCommand; MyString helpUrl; MyString vrmlUrl; MyString application; MyString topic; helpCommand = GetText(swGetDialogItem(_dlg, IDC_HELP_COMMAND)); helpRemoteCommand = GetText(swGetDialogItem(_dlg, IDC_HELP_REMOTE_COMMAND)); helpUrl = GetText(swGetDialogItem(_dlg, IDC_DOC_DIRECTORY)); vrmlUrl = GetText(swGetDialogItem(_dlg, IDC_VRML_HTML)); application = GetText(swGetDialogItem(_dlg, IDC_APPLICATION)); topic = GetText(swGetDialogItem(_dlg, IDC_TOPIC)); swHelpBrowserSetSettings(TheApp->GetHelpBrowser(), helpCommand, helpRemoteCommand, helpUrl, vrmlUrl, application, topic); } void HelpSettingsDialog::OnBrowseHelpCommand() { char buf[1024] = ""; if (swOpenFileDialog(_dlg, "Select", #ifdef WIN32 "executable (*.exe)\0*.exe\0\0", #else "executable (*)\0*\0\0", #endif buf, 1024)) { swSetText(swGetDialogItem(_dlg, IDC_HELP_COMMAND), buf); } } void HelpSettingsDialog::OnBrowseDocDirectory() { char buf[1024] = ""; #ifdef _WIN32 if (swOpenDirDialog(_dlg, "Select", "Directory of index.html(*.html)\0*.html\0\0", buf, 1024)) { #else if (swOpenDirDialog(_dlg, "Select", "Directory or index.html(*)\0*\0\0", buf, 1024)) { #endif swSetText(swGetDialogItem(_dlg, IDC_DOC_DIRECTORY), buf); } } void HelpSettingsDialog::OnBrowseVrmlDirectory() { char buf[1024] = ""; if (swOpenFileDialog(_dlg, "Select", "nodesRef.html(*.html)\0*.html\0\0", buf, 1024)) { swSetText(swGetDialogItem(_dlg, IDC_VRML_HTML), buf); } }