]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormForks.C
fix crash with "save as"
[lyx.git] / src / frontends / xforms / FormForks.C
index 38224aec27986924644b08f50380a49e2a67bab8..b6494c332b63fec25952c9b7095b5f8ef2dcd278 100644 (file)
@@ -1,9 +1,11 @@
 /**
  * \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 "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 "support/lstrings.h"
+#include FORMS_H_LOCATION
 
 using std::vector;
 using std::find;
 using std::find_if;
 
-typedef FormCB<ControlForks, FormDB<FD_form_forks> > base_class;
+typedef FormCB<ControlForks, FormDB<FD_forks> > base_class;
 
-FormForks::FormForks(ControlForks & c)
-       : base_class(c, _("Child processes"))
+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.
@@ -53,9 +56,13 @@ void FormForks::build() {
        // Set up the tooltip mechanism
        string str = _("All currently running child processes forked by LyX.");
        tooltips().init(dialog_->browser_children, str);
+       // Work-around xforms' bug; enable tooltips for browser widgets.
+       setPrehandler(dialog_->browser_children);
 
        str = _("A list of all child processes to kill.");
        tooltips().init(dialog_->browser_kill, str);
+       // Work-around xforms' bug; enable tooltips for browser widgets.
+       setPrehandler(dialog_->browser_kill);
 
        str = _("Add all processes to the list of processes to kill.");
        tooltips().init(dialog_->button_all, str);
@@ -74,7 +81,7 @@ void FormForks::update()
                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();
@@ -100,7 +107,7 @@ void FormForks::update()
        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);
@@ -135,7 +142,7 @@ void FormForks::apply()
 {
        // 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;
@@ -144,7 +151,7 @@ void FormForks::apply()
        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');
 
@@ -208,12 +215,12 @@ ButtonPolicy::SMInput FormForks::input_browser_children()
        //    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);
@@ -267,11 +274,11 @@ ButtonPolicy::SMInput FormForks::input_browser_kill()
        // 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));
@@ -294,7 +301,7 @@ namespace {
 
 vector<string> const getPIDvector(FL_OBJECT * ob)
 {
-       vector<string> vec = getVectorFromBrowser(ob);
+       vector<string> vec = getVector(ob);
        if (vec.empty())
                return vec;
 
@@ -365,13 +372,12 @@ ButtonPolicy::SMInput FormForks::input_button_add()
 
        // 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);