/**
* \file FormForks.C
- * Copyright 2001 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * \author Angus Leeming, a.leeming@ic.ac.uk
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
* \date 2001-10-22
*/
#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "xformsBC.h"
#include "FormForks.h"
#include "ControlForks.h"
-#include "form_forks.h"
+#include "forms/form_forks.h"
+
#include "Tooltips.h"
-#include "helper_funcs.h"
#include "xforms_helpers.h"
-#include "gettext.h"
+#include "xformsBC.h"
+
+#include "controllers/ButtonController.h"
+
#include "support/lstrings.h"
+#include "support/tostr.h"
+
+#include "lyx_forms.h"
+
+using lyx::support::split;
+using lyx::support::strToInt;
-using std::vector;
using std::find;
using std::find_if;
+using std::string;
+using std::vector;
-typedef FormCB<ControlForks, FormDB<FD_form_forks> > base_class;
-FormForks::FormForks(ControlForks & c)
- : base_class(c, _("Child processes"))
+typedef FormCB<ControlForks, FormDB<FD_forks> > base_class;
+
+FormForks::FormForks()
+ : base_class(_("Child Processes"))
{}
void FormForks::build() {
- dialog_.reset(build_forks());
+ dialog_.reset(build_forks(this));
// It appears that the browsers aren't initialised properly.
// This fudge fixes tings.
fl_clear_browser(dialog_->browser_kill);
// Manage the ok, apply, restore and cancel/close buttons
- bc().setOK(dialog_->button_ok);
- bc().setApply(dialog_->button_apply);
- bc().setCancel(dialog_->button_close);
- bc().invalid();
+ bcview().setOK(dialog_->button_ok);
+ bcview().setApply(dialog_->button_apply);
+ bcview().setCancel(dialog_->button_close);
+ bc().valid(false);
// Set up the tooltip mechanism
- string str = N_("All currently running child processes forked by LyX.");
+ string str = _("All currently running child processes forked by LyX.");
tooltips().init(dialog_->browser_children, str);
+#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL == 0)
+ // Work-around xforms' bug; enable tooltips for browser widgets.
+ setPrehandler(dialog_->browser_children);
+#endif
- str = N_("A list of all child processes to kill.");
+ str = _("A list of all child processes to kill.");
tooltips().init(dialog_->browser_kill, str);
+#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL == 0)
+ // Work-around xforms' bug; enable tooltips for browser widgets.
+ setPrehandler(dialog_->browser_kill);
+#endif
- str = N_("Add all processes to the list of processes to kill.");
+ str = _("Add all processes to the list of processes to kill.");
tooltips().init(dialog_->button_all, str);
- str = N_("Add the currently selected child process to the list of processes to kill.");
+ str = _("Add the currently selected child process to the list of processes to kill.");
tooltips().init(dialog_->button_add, str);
- str = N_("Remove the currently selected item from the list of processes to kill.");
+ str = _("Remove the currently selected item from the list of processes to kill.");
tooltips().init(dialog_->button_remove, str);
}
return;
string const current_pid_str =
- getSelectedStringFromBrowser(dialog_->browser_kill);
+ getString(dialog_->browser_kill);
pid_t const current_pid = strToInt(current_pid_str);
vector<pid_t> pids = controller().getPIDs();
for (int i = 1; i <= fl_get_browser_maxline(dialog_->browser_kill);
++i) {
string const pid_str =
- getStringFromBrowser(dialog_->browser_kill, i);
+ getString(dialog_->browser_kill, i);
pid_t const pid = strToInt(pid_str);
vector<pid_t>::const_iterator it =
find(pids.begin(), pids.end(), pid);
{
// Get the list of all processes to kill.
vector<string> const kill_vec =
- getVectorFromBrowser(dialog_->browser_kill);
+ getVector(dialog_->browser_kill);
if (kill_vec.empty())
return;
for (int i = 1; i <= fl_get_browser_maxline(dialog_->browser_children);
++i) {
string const selection =
- getStringFromBrowser(dialog_->browser_children, i);
+ getString(dialog_->browser_children, i);
string pid_str;
split(selection, pid_str, '\t');
// be added to this list if so desired.
string const selection =
- getSelectedStringFromBrowser(dialog_->browser_children);
+ getString(dialog_->browser_children);
string pid_str;
split(selection, pid_str, '\t');
vector<string> const kill_vec =
- getVectorFromBrowser(dialog_->browser_kill);
+ getVector(dialog_->browser_kill);
vector<string>::const_iterator it =
find(kill_vec.begin(), kill_vec.end(), pid_str);
// 3. Disable the add button.
string const pid_str =
- getSelectedStringFromBrowser(dialog_->browser_kill);
+ getString(dialog_->browser_kill);
// Find this string in the list of all child processes
vector<string> const child_vec =
- getVectorFromBrowser(dialog_->browser_children);
+ getVector(dialog_->browser_children);
vector<string>::const_iterator it =
find_if(child_vec.begin(), child_vec.end(), FindPID(pid_str));
vector<string> const getPIDvector(FL_OBJECT * ob)
{
- vector<string> vec = getVectorFromBrowser(ob);
+ vector<string> vec = getVector(ob);
if (vec.empty())
return vec;
// 3. Deactivate the "add" button.
- string const selection =
- getSelectedStringFromBrowser(dialog_->browser_children);
+ string const selection = getString(dialog_->browser_children);
string pid_str;
split(selection, pid_str, '\t');
vector<string> const kill_vec =
- getVectorFromBrowser(dialog_->browser_kill);
+ getVector(dialog_->browser_kill);
vector<string>::const_iterator it =
find(kill_vec.begin(), kill_vec.end(), pid_str);