From ec3f0632501769bee4a14e97cfdcb1e2dc84ac33 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Fri, 25 Oct 2002 09:16:22 +0000 Subject: [PATCH] (Rob Lahaye): updates to the xforms print, spellchecker, texinfo and wrap dialogs. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5511 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/PrinterParams.h | 2 +- src/frontends/ChangeLog | 8 + src/frontends/Liason.C | 157 -------------- src/frontends/Liason.h | 58 ------ src/frontends/Makefile.am | 2 - src/frontends/controllers/ChangeLog | 7 + src/frontends/controllers/ControlPrint.C | 162 +++++++++++++-- .../controllers/ControlSpellchecker.C | 4 +- .../controllers/ControlSpellchecker.h | 16 +- src/frontends/xforms/ChangeLog | 15 ++ src/frontends/xforms/FormPrint.C | 154 +++++++------- src/frontends/xforms/FormPrint.h | 5 +- src/frontends/xforms/FormSpellchecker.C | 194 ++++++++++-------- src/frontends/xforms/FormSpellchecker.h | 8 +- src/frontends/xforms/FormTexinfo.C | 96 +++++---- src/frontends/xforms/FormWrap.C | 101 ++++----- src/frontends/xforms/FormWrap.h | 6 +- src/frontends/xforms/forms/form_print.fd | 16 +- .../xforms/forms/form_spellchecker.fd | 79 ++++--- src/frontends/xforms/forms/form_texinfo.fd | 36 +--- src/frontends/xforms/forms/form_wrap.fd | 115 ++++------- 21 files changed, 583 insertions(+), 658 deletions(-) delete mode 100644 src/frontends/Liason.C delete mode 100644 src/frontends/Liason.h diff --git a/src/PrinterParams.h b/src/PrinterParams.h index ff4c9dfc79..06dd555d15 100644 --- a/src/PrinterParams.h +++ b/src/PrinterParams.h @@ -105,7 +105,7 @@ struct PrinterParams { string const & fname = string(), bool const all = true, unsigned int const & from = 1, - unsigned int const & to = 1, + unsigned int const & to = 0, bool const odd = true, bool const even = true, unsigned int const & copies = 1, diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 3e2cad4bc4..bb6a66177d 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,11 @@ +2002-10-24 Rob Lahaye + + * PrinterParams.h (to): default value changed to 0 (from 1). + + * Liason.[Ch]: removed. Code moved into ControlPrint.[Ch]. + + * makefile.am: remove Liason.[Ch]. + 2002-10-21 Angus Leeming * LyXKeySym.h (operator==): compilation fix. The two args should have diff --git a/src/frontends/Liason.C b/src/frontends/Liason.C deleted file mode 100644 index eeddabae8f..0000000000 --- a/src/frontends/Liason.C +++ /dev/null @@ -1,157 +0,0 @@ -/** - * \file Liason.C - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Allan Rae - * - * Full author contact details are available in file CREDITS - */ - -#include - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "Liason.h" -#include "lyxrc.h" -#include "PrinterParams.h" - -#include "frontends/LyXView.h" -#include "BufferView.h" -#include "buffer.h" -#include "exporter.h" -#include "converter.h" - -#include "support/LAssert.h" -#include "support/lstrings.h" -#include "support/filetools.h" -#include "support/path.h" -#include "support/systemcall.h" - -#include "debug.h" // for lyxerr - -using std::endl; - -namespace Liason { - -PrinterParams getPrinterParams(Buffer * buffer) -{ - return PrinterParams(PrinterParams::PRINTER, - lyxrc.printer, - ChangeExtension(buffer->fileName(), - lyxrc.print_file_extension)); -} - - -bool printBuffer(Buffer * buffer, PrinterParams const & pp) -{ - string command(lyxrc.print_command + ' '); - - if (pp.target == PrinterParams::PRINTER - && lyxrc.print_adapt_output // dvips wants a printer name - && !pp.printer_name.empty()) {// printer name given - command += lyxrc.print_to_printer - + pp.printer_name - + ' '; - } - - if (!pp.all_pages && pp.from_page) { - command += lyxrc.print_pagerange_flag + ' '; - command += tostr(pp.from_page); - if (pp.to_page) { - // we have a range "from-to" - command += '-'; - command += tostr(pp.to_page); - } - command += ' '; - } - - // If both are, or both are not selected, then skip the odd/even printing - if (pp.odd_pages != pp.even_pages) { - if (pp.odd_pages) { - command += lyxrc.print_oddpage_flag + ' '; - } else if (pp.even_pages) { - command += lyxrc.print_evenpage_flag + ' '; - } - } - - if (pp.count_copies > 1) { - if (pp.sorted_copies) { - command += lyxrc.print_collcopies_flag; - } else { - command += lyxrc.print_copies_flag; - } - command += ' '; - command += tostr(pp.count_copies); - command += ' '; - } - - if (pp.reverse_order) { - command += lyxrc.print_reverse_flag + ' '; - } - - if (!lyxrc.print_extra_options.empty()) { - command += lyxrc.print_extra_options + ' '; - } - - command += converters.dvips_options(buffer) + ' '; - - if (!Exporter::Export(buffer, "dvi", true)) - return false; - - // Push directory path. - string path = buffer->filePath(); - if (lyxrc.use_tempdir || !IsDirWriteable(path)) { - path = buffer->tmppath; - } - Path p(path); - - // there are three cases here: - // 1. we print to a file - // 2. we print direct to a printer - // 3. we print using a spool command (print to file first) - Systemcall one; - int res = 0; - string dviname = ChangeExtension(buffer->getLatexName(true), "dvi"); - switch (pp.target) { - case PrinterParams::PRINTER: - if (!lyxrc.print_spool_command.empty()) { - // case 3 - string psname = ChangeExtension(dviname, ".ps"); - command += lyxrc.print_to_file - + QuoteName(psname) + ' '; - command += QuoteName(dviname); - string command2 = lyxrc.print_spool_command + ' '; - if (!pp.printer_name.empty()) - command2 += lyxrc.print_spool_printerprefix - + pp.printer_name + ' '; - command2 += QuoteName(psname); - // First run dvips. - // If successful, then spool command - res = one.startscript(Systemcall::Wait, command); - if (res == 0) - res = one.startscript(Systemcall::DontWait, - command2); - } else - // case 2 - res = one.startscript(Systemcall::DontWait, - command + QuoteName(dviname)); - break; - - case PrinterParams::FILE: - // case 1 - command += lyxrc.print_to_file - + QuoteName(MakeAbsPath(pp.file_name, path)); - command += ' ' + QuoteName(dviname); - res = one.startscript(Systemcall::DontWait, command); - break; - } - - lyxerr[Debug::LATEX] << "printBuffer: \"" << command << "\"\n"; - - return res == 0; -} - -} // namespace Liason diff --git a/src/frontends/Liason.h b/src/frontends/Liason.h deleted file mode 100644 index bfab7fc22e..0000000000 --- a/src/frontends/Liason.h +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- -/** Liason.h - * Temporary namespace to hold the various frontend functions until XTL and - * the compilers of the world are ready for something more elaborate. - * This is basically the Communicator class from the lyx cvs module all - * over again. - * - * FuncRequestually, we will switch back to the XTL+LyXFunc combination that - * worked so nicely on a very small number of compilers and systems (when - * most systems can support those required features). - * - * Author: Allan Rae - * This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * - * This file Copyright 2000 - * Allan Rae - * ====================================================== - */ - -#ifndef LIASON_H -#define LIASON_H - -#ifdef __GNUG__ -#pragma interface -#endif - -#include "LString.h" - -class PrinterParams; -class Buffer; -class LyXView; -class BufferParams; - -/** Temporary namespace to hold the various frontend functions - until XTL and the compilers of the world are ready for something more - elaborate. This is basically the Communicator class from the lyx cvs module - all over again. - - FuncRequestually, we will switch back to the XTL+LyXFunc combination that - worked so nicely on a very small number of compilers and systems. - See the "dialogbase" branch of lyx-devel cvs module for xtl implementation. -*/ -namespace Liason { - /**@name Global support functions */ - //@{ - /// get global printer parameters - PrinterParams getPrinterParams(Buffer *); - /// print the current buffer - bool printBuffer(Buffer *, PrinterParams const &); - //@} - -} // namespace Liason -#endif diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index fd2b7f932a..1bf400490f 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -21,8 +21,6 @@ libfrontends_la_SOURCES = \ Dialogs.C \ Dialogs.h \ FileDialog.h \ - Liason.C \ - Liason.h \ LyXKeySym.h \ LyXKeySymFactory.h \ LyXScreenFactory.h \ diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 0c75999144..490bde08af 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,10 @@ +2002-10-24 Rob Lahaye + + * ControlPrint.[Ch]: move code here from Liason.[Ch]. + + * ControlSpellchecker.h (getCount): new method. + * ControlSpellchecker.[Ch]: constify some accessor methods. + 2002-10-22 Angus Leeming * Makefile.am (libcontrollers_la_SOURCES): arrange list into diff --git a/src/frontends/controllers/ControlPrint.C b/src/frontends/controllers/ControlPrint.C index cd4339cb98..6d40b454d3 100644 --- a/src/frontends/controllers/ControlPrint.C +++ b/src/frontends/controllers/ControlPrint.C @@ -23,14 +23,17 @@ #include "gettext.h" #include "helper_funcs.h" #include "PrinterParams.h" +#include "exporter.h" +#include "converter.h" #include "frontends/Alert.h" -#include "frontends/Liason.h" #include "support/LAssert.h" +#include "support/filetools.h" +#include "support/path.h" +#include "support/systemcall.h" -using Liason::printBuffer; -using Liason::getPrinterParams; +#include "debug.h" // for lyxerr ControlPrint::ControlPrint(LyXView & lv, Dialogs & d) @@ -39,21 +42,6 @@ ControlPrint::ControlPrint(LyXView & lv, Dialogs & d) {} -void ControlPrint::apply() -{ - if (!bufferIsAvailable()) - return; - - view().apply(); - - if (!printBuffer(buffer(), params())) { - Alert::alert(_("Error:"), - _("Unable to print"), - _("Check that your parameters are correct")); - } -} - - PrinterParams & ControlPrint::params() const { lyx::Assert(params_); @@ -64,7 +52,12 @@ PrinterParams & ControlPrint::params() const void ControlPrint::setParams() { if (params_) delete params_; - params_ = new PrinterParams(getPrinterParams(buffer())); + + /// get global printer parameters + string const name = ChangeExtension(buffer()->fileName(), + lyxrc.print_file_extension); + params_ = new PrinterParams (PrinterParams::PRINTER, + lyxrc.printer, name); bc().valid(); // so that the user can press Ok } @@ -88,3 +81,134 @@ string const ControlPrint::Browse(string const & in_name) return browseRelFile(&lv_, in_name, buffer()->filePath(), title, pattern); } + + +/// print the current buffer +void ControlPrint::apply() +{ + if (!bufferIsAvailable()) + return; + + view().apply(); + + PrinterParams const pp = params(); + string command(lyxrc.print_command + ' '); + + if (pp.target == PrinterParams::PRINTER + && lyxrc.print_adapt_output // dvips wants a printer name + && !pp.printer_name.empty()) {// printer name given + command += lyxrc.print_to_printer + + pp.printer_name + + ' '; + } + + if (!pp.all_pages && pp.from_page) { + command += lyxrc.print_pagerange_flag + ' '; + command += tostr(pp.from_page); + if (pp.to_page) { + // we have a range "from-to" + command += '-' + + tostr(pp.to_page); + } + command += ' '; + } + + // If both are, or both are not selected, then skip the odd/even printing + if (pp.odd_pages != pp.even_pages) { + if (pp.odd_pages) { + command += lyxrc.print_oddpage_flag + ' '; + } else if (pp.even_pages) { + command += lyxrc.print_evenpage_flag + ' '; + } + } + + if (pp.count_copies > 1) { + if (pp.sorted_copies) { + command += lyxrc.print_collcopies_flag; + } else { + command += lyxrc.print_copies_flag; + } + command += ' ' + + tostr(pp.count_copies) + + ' '; + } + + if (pp.reverse_order) { + command += lyxrc.print_reverse_flag + ' '; + } + + if (!lyxrc.print_extra_options.empty()) { + command += lyxrc.print_extra_options + ' '; + } + + command += converters.dvips_options(buffer()) + ' '; + + if (!Exporter::Export(buffer(), "dvi", true)) { + Alert::alert(_("Error:"), + _("Unable to print"), + _("Check that your parameters are correct")); + return; + } + + // Push directory path. + string path = buffer()->filePath(); + if (lyxrc.use_tempdir || !IsDirWriteable(path)) { + path = buffer()->tmppath; + } + Path p(path); + + // there are three cases here: + // 1. we print to a file + // 2. we print directly to a printer + // 3. we print using a spool command (print to file first) + Systemcall one; + int res = 0; + string const dviname = ChangeExtension(buffer()->getLatexName(true), "dvi"); + switch (pp.target) { + case PrinterParams::PRINTER: + if (!lyxrc.print_spool_command.empty()) { + // case 3: print using a spool + string const psname = ChangeExtension(dviname, ".ps"); + command += lyxrc.print_to_file + + QuoteName(psname) + + ' ' + + QuoteName(dviname); + + string command2 = lyxrc.print_spool_command + ' '; + if (!pp.printer_name.empty()) { + command2 += lyxrc.print_spool_printerprefix + + pp.printer_name + + ' '; + } + command2 += QuoteName(psname); + // First run dvips. + // If successful, then spool command + res = one.startscript(Systemcall::Wait, command); + if (res == 0) + res = one.startscript(Systemcall::DontWait, + command2); + } else { + // case 2: print directly to a printer + res = one.startscript(Systemcall::DontWait, + command + QuoteName(dviname)); + } + break; + + case PrinterParams::FILE: + // case 1: print to a file + command += lyxrc.print_to_file + + QuoteName(MakeAbsPath(pp.file_name, path)) + + ' ' + + QuoteName(dviname); + res = one.startscript(Systemcall::DontWait, command); + break; + } + + lyxerr[Debug::LATEX] << "ControlPrint::apply(): print command = \"" << command << "\"" << endl; + + if (res != 0) { + Alert::alert(_("Error:"), + _("Unable to print"), + _("Check that your parameters are correct")); + } +} diff --git a/src/frontends/controllers/ControlSpellchecker.C b/src/frontends/controllers/ControlSpellchecker.C index 49f8c6b877..a0e9e62aee 100644 --- a/src/frontends/controllers/ControlSpellchecker.C +++ b/src/frontends/controllers/ControlSpellchecker.C @@ -148,7 +148,7 @@ void ControlSpellchecker::insert() } -string ControlSpellchecker::getSuggestion() +string const ControlSpellchecker::getSuggestion() const { string miss(speller_->nextMiss()); @@ -159,7 +159,7 @@ string ControlSpellchecker::getSuggestion() } -string ControlSpellchecker::getWord() +string const ControlSpellchecker::getWord() const { string tmp = word_.word(); if (rtl_) diff --git a/src/frontends/controllers/ControlSpellchecker.h b/src/frontends/controllers/ControlSpellchecker.h index c1444e14f9..aa359865cd 100644 --- a/src/frontends/controllers/ControlSpellchecker.h +++ b/src/frontends/controllers/ControlSpellchecker.h @@ -48,20 +48,20 @@ public: void check(); /// get suggestion - string getSuggestion(); + string const getSuggestion() const; /// get word - string getWord(); + string const getWord() const; /// returns progress value - int getProgress() { - return oldval_; - } + int getProgress() const { return oldval_; } /// returns exit message - string getMessage() { - return message_; - } + string const getMessage() const { return message_; } + + /// returns word count + int getCount() const { return count_; } + private: /// set the params before show or update void setParams(); diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 637f38575b..31867bb9f7 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,8 +1,23 @@ 2002-10-24 Rob Lahaye + * forms/form_print.fd: + * FormPrint.[Ch]: clean-up, reflecting discussion on the list. + + * forms/form_spellchecker.fd: + * FormSpellchecker.[Ch]: add tooltips; general clean-up. + add word count to dialog and improve progress status; + implement single Start/Stop button; + * FormTabular.C (build): rearrange lines tab by tab. Use getString not fl_get_inout. + * FormTexinfo.C: replace View-button by catching double click in + browser; allow viewing of files, irrespective of full path. + + * forms/form_wrap.fd: resized. Remove text_warning widget. Fix gravity. + * FormWrap.[Ch]: simplification through the use of RadioButtonGroup + and CheckedGlueLength. Add tooltips. + 2002-10-24 Angus Leeming * FormRef.C (updateBrowser): invoke updateHighlight diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index 05422954b6..ec0bb37440 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -29,7 +29,6 @@ #include "support/lstrings.h" #include FORMS_H_LOCATION -using std::make_pair; typedef FormCB > base_class; @@ -47,7 +46,12 @@ void FormPrint::build() bc().setApply(dialog_->button_apply); bc().setCancel(dialog_->button_close); - // allow controlling of input and ok/apply (de)activation + // trigger an input event for cut&paste with middle mouse button. + setPrehandler(dialog_->input_printer); + setPrehandler(dialog_->input_file); + setPrehandler(dialog_->input_from_page); + setPrehandler(dialog_->input_to_page); + fl_set_input_return(dialog_->input_printer, FL_RETURN_CHANGED); fl_set_input_return(dialog_->input_file, FL_RETURN_CHANGED); fl_set_input_return(dialog_->input_from_page, FL_RETURN_CHANGED); @@ -63,17 +67,12 @@ void FormPrint::build() fl_set_input_maxchars(dialog_->input_from_page, 4); // 9999 fl_set_input_maxchars(dialog_->input_to_page, 4); // 9999 - bc().addReadOnly(dialog_->button_browse); - bc().addReadOnly(dialog_->check_odd_pages); - bc().addReadOnly(dialog_->check_even_pages); - bc().addReadOnly(dialog_->check_sorted_copies); - bc().addReadOnly(dialog_->check_reverse_order); - target_.init(dialog_->radio_printer, PrinterParams::PRINTER); target_.init(dialog_->radio_file, PrinterParams::FILE); - which_pages_.init(dialog_->radio_all_pages, true); - which_pages_.init(dialog_->radio_from_to, false); - + + all_pages_.init(dialog_->radio_all_pages, true); + all_pages_.init(dialog_->radio_from_to, false); + // set up the tooltips for Destination string str = _("Select for printer output."); tooltips().init(dialog_->radio_printer, str); @@ -116,16 +115,16 @@ void FormPrint::apply() PrinterParams pp; pp.target = static_cast(target_.get()); - pp.printer_name = fl_get_input(dialog_->input_printer); - pp.file_name = fl_get_input(dialog_->input_file); + pp.printer_name = getString(dialog_->input_printer); + pp.file_name = getString(dialog_->input_file); + + pp.all_pages = static_cast(all_pages_.get()); - pp.all_pages = which_pages_.get(); - pp.from_page = 0; - pp.to_page = 0; - if (strlen(fl_get_input(dialog_->input_from_page)) > 0) { + pp.from_page = pp.to_page = 0; + if (!getString(dialog_->input_from_page).empty()) { // we have at least one page requested pp.from_page = strToInt(fl_get_input(dialog_->input_from_page)); - if (strlen(fl_get_input(dialog_->input_to_page)) > 0) { + if (!getString(dialog_->input_to_page).empty()) { // okay we have a range pp.to_page = strToInt(fl_get_input(dialog_->input_to_page)); } // else we only print one page. @@ -153,10 +152,10 @@ void FormPrint::update() // hmmm... maybe a bit weird but maybe not // we might just be remembering the last time this was printed. - which_pages_.set(pp.all_pages); + all_pages_.set(pp.all_pages); - string const from = ( pp.from_page ? tostr(pp.from_page) : ""); - string const to = ( pp.to_page ? tostr(pp.to_page) : ""); + string const from = ( pp.from_page ? tostr(pp.from_page) : string() ); + string const to = ( pp.to_page ? tostr(pp.to_page) : string() ); fl_set_input(dialog_->input_from_page, from.c_str()); fl_set_input(dialog_->input_to_page, to.c_str()); @@ -173,87 +172,82 @@ void FormPrint::update() // sorting only used when printing more than one copy setEnabled(dialog_->check_sorted_copies, enable_counter && pp.count_copies > 1); + + // reset input fields to valid input + input(0, 0); } -// It would be nice if we checked for cases like: -// Print only-odd-pages and from_page == an even number -// ButtonPolicy::SMInput FormPrint::input(FL_OBJECT * ob, long) { - ButtonPolicy::SMInput activate = ButtonPolicy::SMI_VALID; - - // using a fl_input_filter that only permits numbers no '-' or '+' - // and the user cannot enter a negative number even if they try. - if (strlen(fl_get_input(dialog_->input_from_page))) { - // using a page range so activate the "to" field - fl_activate_object(dialog_->input_to_page); - if (strlen(fl_get_input(dialog_->input_to_page)) - && (strToInt(fl_get_input(dialog_->input_from_page)) - > strToInt(fl_get_input(dialog_->input_to_page)))) { - // both from and to have values but from > to - // We could have code to silently swap these - // values but I'll disable the ok/apply until - // the user fixes it since they may be editting - // one of the fields. - activate = ButtonPolicy::SMI_INVALID; - // set both backgrounds to red? - } - } else if (strlen(fl_get_input(dialog_->input_to_page))) { - // from is empty but to exists, so probably editting from - // therefore deactivate ok and apply until form is valid again - activate = ButtonPolicy::SMI_INVALID; - } else { - // both from and to are empty. This is valid so activate - // ok and apply but deactivate to - fl_deactivate_object(dialog_->input_to_page); - } - - // number of copies only used when output goes to printer - bool const enable_counter = static_cast(fl_get_button(dialog_->radio_printer)); - setEnabled(dialog_->counter_copies, enable_counter); - - // sorting only used when printing more than one copy - bool const enable_sorted = enable_counter - && static_cast(fl_get_counter_value(dialog_->counter_copies)) > 1; - setEnabled(dialog_->check_sorted_copies, enable_sorted); - - // disable OK/Apply buttons when file output is selected, but no file name entered. - if (fl_get_button(dialog_->radio_file) && !strlen(fl_get_input(dialog_->input_file))) { - activate = ButtonPolicy::SMI_INVALID; - } - if (ob == dialog_->button_browse) { // Get the filename from the dialog - string const in_name = fl_get_input(dialog_->input_file); + string const in_name = getString(dialog_->input_file); string const out_name = controller().Browse(in_name); // Save the filename to the dialog if (out_name != in_name && !out_name.empty()) { fl_set_input(dialog_->input_file, out_name.c_str()); - input(0, 0); } // select the file radio if (!out_name.empty()) { - fl_set_button(dialog_->radio_file, 1); - fl_set_button(dialog_->radio_printer, 0); + target_.set(dialog_->radio_file); } - } // if we type input string for file or printer, select that as a target - if (ob == dialog_->input_file && !fl_get_button(dialog_->radio_file)) { - fl_set_button(dialog_->radio_printer, 0); - fl_set_button(dialog_->radio_file, 1); + } else if (ob == dialog_->input_file && !fl_get_button(dialog_->radio_file)) { + target_.set(dialog_->radio_file); + } else if (ob == dialog_->input_printer && !fl_get_button(dialog_->radio_printer)) { - fl_set_button(dialog_->radio_printer, 1); - fl_set_button(dialog_->radio_file, 0); - // if we type intput string for from/to, select from/to radio button - } else if ( (ob == dialog_->input_from_page || ob == dialog_->input_to_page) && + target_.set(dialog_->radio_printer); + + // if we type into 'from/to' fields, then select 'from/to' radio button + } else if ((ob == dialog_->input_from_page || ob == dialog_->input_to_page) && !fl_get_button(dialog_->radio_from_to)) { - fl_set_button(dialog_->radio_from_to, 1); - fl_set_button(dialog_->radio_all_pages, 0); + all_pages_.set(dialog_->radio_from_to); } + ButtonPolicy::SMInput activate = ButtonPolicy::SMI_VALID; + + // disable OK/Apply buttons when file output is selected, but no file name entered + if (fl_get_button(dialog_->radio_file) && getString(dialog_->input_file).empty()) { + activate = ButtonPolicy::SMI_INVALID; + } + + // check 'from' and 'to' fields only when 'from/to' radio button is selected + if (fl_get_button(dialog_->radio_from_to)) { + char const * from = fl_get_input(dialog_->input_from_page); + char const * to = fl_get_input(dialog_->input_to_page); + bool const from_input = static_cast(*from); + bool const to_input = static_cast(*to); + + setEnabled(dialog_->input_to_page, from_input); + if (!from_input || (to_input && strToInt(from) > strToInt(to))) { + // Invalid input. Either 'from' is empty, or 'from' > 'to'. + // Probably editting these fields, so deactivate OK/Apply until input is valid again. + activate = ButtonPolicy::SMI_INVALID; + } else if (!to_input || strToInt(from) == strToInt(to)) { + // Valid input. Either there's only 'from' input, or 'from' == 'to'. + // Deactivate OK/Apply if odd/even selection implies no pages. + bool const odd_pages = static_cast(fl_get_button(dialog_->check_odd_pages)); + bool const even_pages = static_cast(fl_get_button(dialog_->check_even_pages)); + bool const odd_only = odd_pages && !even_pages; + bool const even_only = even_pages && !odd_pages; + bool const from_is_odd = static_cast(strToInt(from) % 2); + if ( (from_is_odd && even_only) || (!from_is_odd && odd_only) ) { + activate = ButtonPolicy::SMI_INVALID; + } + } + } + + // number of copies only used when output goes to printer + bool const enable_counter = static_cast(fl_get_button(dialog_->radio_printer)); + setEnabled(dialog_->counter_copies, enable_counter); + + // sorting only used when printing more than one copy + bool const enable_sorted = enable_counter && fl_get_counter_value(dialog_->counter_copies) > 1; + setEnabled(dialog_->check_sorted_copies, enable_sorted); + return activate; } diff --git a/src/frontends/xforms/FormPrint.h b/src/frontends/xforms/FormPrint.h index 9016a91f47..2bc487ab67 100644 --- a/src/frontends/xforms/FormPrint.h +++ b/src/frontends/xforms/FormPrint.h @@ -39,13 +39,14 @@ private: virtual void build(); /// Update the dialog. virtual void update(); + /// Filter the inputs on callback from xforms virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); /// print target RadioButtonGroup target_; - /// which pages - RadioButtonGroup which_pages_; + /// all pages or from/to + RadioButtonGroup all_pages_; }; #endif // FORMPRINT_H diff --git a/src/frontends/xforms/FormSpellchecker.C b/src/frontends/xforms/FormSpellchecker.C index ff70ad6bcc..48464e88b5 100644 --- a/src/frontends/xforms/FormSpellchecker.C +++ b/src/frontends/xforms/FormSpellchecker.C @@ -20,10 +20,13 @@ #include "ControlSpellchecker.h" #include "FormSpellchecker.h" #include "forms/form_spellchecker.h" +#include "support/lstrings.h" + #include FORMS_H_LOCATION typedef FormCB > base_class; + FormSpellchecker::FormSpellchecker() : base_class(_("Spellchecker")) {} @@ -33,27 +36,30 @@ void FormSpellchecker::build() { dialog_.reset(build_spellchecker(this)); - fl_set_browser_dblclick_callback(dialog_->browser, - C_FormBaseInputCB, 2); - - fl_set_input_return(dialog_->input, FL_RETURN_CHANGED); - setPrehandler(dialog_->input); - // Manage the buttons bc().setCancel(dialog_->button_close); + + // disable for read-only documents bc().addReadOnly(dialog_->button_replace); - bc().addReadOnly(dialog_->button_accept); - bc().addReadOnly(dialog_->button_add); - bc().addReadOnly(dialog_->button_ignore); - bc().addReadOnly(dialog_->button_start); - bc().addReadOnly(dialog_->browser); + + // trigger an input event for cut&paste with middle mouse button. + setPrehandler(dialog_->input_replacement); + + fl_set_input_return(dialog_->input_replacement, FL_RETURN_CHANGED); + + // callback for double click in browser + fl_set_browser_dblclick_callback(dialog_->browser_suggestions, + C_FormBaseInputCB, 2); + + // do not allow setting of slider by the mouse + fl_deactivate_object(dialog_->slider_progress); // set up the tooltips string str = _("Type replacement for unknown word " " or select from suggestions."); - tooltips().init(dialog_->input, str); + tooltips().init(dialog_->input_replacement, str); str = _("List of replacement suggestions from dictionary."); - tooltips().init(dialog_->browser, str); + tooltips().init(dialog_->browser_suggestions, str); str = _("Start the spellingchecker."); tooltips().init(dialog_->button_start, str); str = _("Replace unknown word."); @@ -64,120 +70,134 @@ void FormSpellchecker::build() tooltips().init(dialog_->button_accept, str); str = _("Add unknown word to personal dictionary."); tooltips().init(dialog_->button_add, str); + str = _("Shows word count and progress on spell check."); + tooltips().init(dialog_->slider_progress, str); } + void FormSpellchecker::update() { - fl_set_input(dialog_->input, ""); - fl_set_object_label(dialog_->text, ""); - fl_clear_browser(dialog_->browser); - fl_set_slider_value(dialog_->slider, 0); - start(true); + // clear input fields + fl_set_input(dialog_->input_replacement, ""); + fl_set_object_label(dialog_->text_unknown, ""); + fl_clear_browser(dialog_->browser_suggestions); + + // reset dialog and buttons into start condition + input(0, 0); + + // reset slider to zero count + fl_set_slider_value(dialog_->slider_progress, 0.0); + fl_set_object_label(dialog_->slider_progress, "0 %"); } -ButtonPolicy::SMInput FormSpellchecker::input(FL_OBJECT * obj, long val) + +ButtonPolicy::SMInput FormSpellchecker::input(FL_OBJECT * ob, long ob_value) { - if (obj == dialog_->button_replace) { - string const tmp = getString(dialog_->input); - controller().replace(tmp); + if (!ob || ob == dialog_->button_start) { + static bool running = false; + + // update running status of spellingchecker + running = !running && ob == dialog_->button_start; + + // modify text of Start/Stop button according to running status + string const labeltext = running ? _("Stop") : _("Start"); + fl_set_object_label(dialog_->button_start, labeltext.c_str()); + fl_set_button_shortcut(dialog_->button_start, "#S", 1); + fl_show_object(dialog_->button_start); + + // adjust tooltips to modified Start/Stop button + string const str = (running ? _("Stop the spellingchecker.") : + _("Start the spellingchecker.")); + tooltips().init(dialog_->button_start, str); + + // enable buttons according to running status + setEnabled(dialog_->button_replace, running); + setEnabled(dialog_->button_ignore, running); + setEnabled(dialog_->button_accept, running); + setEnabled(dialog_->button_add, running); + setEnabled(dialog_->browser_suggestions, running); + setEnabled(dialog_->input_replacement, running); + + // call controller if Start/Stop button is pressed + if (ob) { + if (running) + controller().check(); + else + controller().stop(); + } - } else if (obj == dialog_->button_start) { - if (start()) - controller().check(); - else - controller().stop(); + } else if (ob == dialog_->button_replace) { + string const tmp = getString(dialog_->input_replacement); + controller().replace(tmp); - } else if (obj == dialog_->button_ignore) { + } else if (ob == dialog_->button_ignore) { controller().check(); - } else if (obj == dialog_->button_accept) { + } else if (ob == dialog_->button_accept) { controller().ignoreAll(); - } else if (obj == dialog_->button_add) { + } else if (ob == dialog_->button_add) { controller().insert(); - } else if (obj == dialog_->browser) { - int const line = fl_get_browser(dialog_->browser); - string const tmp = - getString(dialog_->browser, line); + } else if (ob == dialog_->browser_suggestions) { + string const tmp = getString(dialog_->browser_suggestions); if (tmp.empty()) return ButtonPolicy::SMI_NOOP; - if (val != 2) { + if (ob_value != 2) { // single-click // place the chosen string in the input as feedback - fl_set_input(dialog_->input, tmp.c_str()); + fl_set_input(dialog_->input_replacement, tmp.c_str()); } else { // double-click controller().replace(tmp); // reset the browser so that the following // single-click callback doesn't do anything - fl_deselect_browser_line(dialog_->browser, line); + fl_deselect_browser(dialog_->browser_suggestions); } } + // update slider with word count and progress + double const wordcount = controller().getCount(); + if (wordcount > 0.0) { + int const progress = controller().getProgress(); + double const total = 100.0 * wordcount / progress; + + fl_set_slider_bounds(dialog_->slider_progress, 0.0, total); + fl_set_slider_value(dialog_->slider_progress, wordcount); + fl_set_object_label(dialog_->slider_progress, + (tostr(progress) + " %").c_str()); + } + return ButtonPolicy::SMI_VALID; } + void FormSpellchecker::partialUpdate(int id) { switch (id) { - case 0: - // set progress bar - fl_set_slider_value(dialog_->slider, - controller().getProgress()); - break; - case 1: - { - // set suggestions + case 1: // set suggestions + { string w = controller().getWord(); - fl_set_input(dialog_->input, w.c_str()); - fl_set_object_label(dialog_->text, w.c_str()); - fl_clear_browser(dialog_->browser); + fl_set_input(dialog_->input_replacement, w.c_str()); + fl_set_object_label(dialog_->text_unknown, w.c_str()); + fl_clear_browser(dialog_->browser_suggestions); while (!(w = controller().getSuggestion()).empty()) { - fl_add_browser_line(dialog_->browser, w.c_str()); + fl_add_browser_line(dialog_->browser_suggestions, w.c_str()); } - } - break; - case 2: - // show exit message - fl_show_messages(controller().getMessage().c_str()); - hide(); - } -} - + } + break; + case 2: // end of spell checking -void FormSpellchecker::showMessage(const char * msg) -{ - fl_show_message(msg, "", ""); -} + // reset dialog and buttons into start condition + input(0, 0); -bool FormSpellchecker::start(bool init) -{ - static bool running = false; + // set slider 'finished' status + fl_set_slider_bounds(dialog_->slider_progress, 0.0, controller().getCount()); + fl_set_slider_value(dialog_->slider_progress, controller().getCount()); + fl_set_object_label(dialog_->slider_progress, "100 %"); - if (init) { - running = false; - } else { - running = !running; + break; } - - fl_set_object_label(dialog_->button_start, - (running ? _("Stop") : _("Start"))); - fl_set_button_shortcut(dialog_->button_start, "#S", 1); - fl_show_object(dialog_->button_start); - - string const str = (running ? _("Stop the spellingchecker.") : - _("Start the spellingchecker.")); - tooltips().init(dialog_->button_start, str); - - setEnabled(dialog_->button_replace, running); - setEnabled(dialog_->button_ignore, running); - setEnabled(dialog_->button_accept, running); - setEnabled(dialog_->button_add, running); - setEnabled(dialog_->browser, running); - setEnabled(dialog_->input, running); - - return running; } diff --git a/src/frontends/xforms/FormSpellchecker.h b/src/frontends/xforms/FormSpellchecker.h index a05e27a676..476cfa00f4 100644 --- a/src/frontends/xforms/FormSpellchecker.h +++ b/src/frontends/xforms/FormSpellchecker.h @@ -35,15 +35,9 @@ private: /// void update(); - /// enable/disable widgets when start/stop; return running status - bool start(bool init = false); - - /// update progress bar, set suggestions, exit message + /// set suggestions and exit message void partialUpdate(int); - /// show an error message - void showMessage(const char * msg); - /// Filter the inputs virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); }; diff --git a/src/frontends/xforms/FormTexinfo.C b/src/frontends/xforms/FormTexinfo.C index 6c01058afb..22938fd65f 100644 --- a/src/frontends/xforms/FormTexinfo.C +++ b/src/frontends/xforms/FormTexinfo.C @@ -21,9 +21,10 @@ #include "forms/form_texinfo.h" #include "Tooltips.h" #include "gettext.h" -#include "debug.h" #include "xforms_helpers.h" #include "support/LAssert.h" +#include "support/lstrings.h" + #include FORMS_H_LOCATION @@ -37,74 +38,99 @@ FormTexinfo::FormTexinfo() void FormTexinfo::build() { dialog_.reset(build_texinfo(this)); - updateStyles(ControlTexinfo::cls); + // callback for double click in browser to view the selected file + fl_set_browser_dblclick_callback(dialog_->browser, C_FormBaseInputCB, 2); string const classes_List = _("LaTeX classes|LaTeX styles|BibTeX styles"); fl_addto_choice(dialog_->choice_classes, classes_List.c_str()); + updateStyles(activeStyle); + // set up the tooltips - string str = _("Shows the installed classses and styles for LaTeX/BibTeX. These classes are only available in LyX if a corresponding LyX layout file exists."); + string str = _("Shows the installed classses and styles for LaTeX/BibTeX; " + "available only if the corresponding LyX layout file exists."); tooltips().init(dialog_->choice_classes, str); - str = _("View full path or only file name."); + str = _("Show full path or only file name."); tooltips().init(dialog_->check_fullpath, str); str = _("Runs the script \"TexFiles.sh\" to build new file lists."); tooltips().init(dialog_->button_rescan, str); - str = _("Shows the contents of the marked file. Only possible in full path mode."); - tooltips().init(dialog_->button_view, str); + str = _("Double click to view contents of file."); + tooltips().init(dialog_->browser, str); - str = _("Runs the script \"texhash\" which builds a new LaTeX tree. Needed if you install a new TeX class or style. You need write permissions for the TeX-dirs, often /var/lib/texmf and others."); + str = _("Runs the script \"texhash\" which builds a new LaTeX tree. " + "Needed if you install a new TeX class or style. You need write " + "permissions for the TeX-dirs, often /var/lib/texmf and others."); tooltips().init(dialog_->button_texhash, str); } -ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long) { +ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long ob_value) { - if (ob == dialog_->choice_classes) { - switch (fl_get_choice(dialog_->choice_classes)) { - case 1: - updateStyles(ControlTexinfo::cls); - break; - case 2: - updateStyles(ControlTexinfo::sty); - break; - case 3: - default: - updateStyles(ControlTexinfo::bst); + if (ob == dialog_->button_texhash) { + // makes only sense if the rights are set well for + // users (/var/lib/texmf/ls-R) + controller().runTexhash(); + // texhash requires a rescan and an update of the styles + controller().rescanStyles(); + updateStyles(activeStyle); + + + } else if (ob == dialog_->browser && ob_value == 2) { + // double click in browser: view selected file + string selection = string(); + if (fl_get_button(dialog_->check_fullpath)) { + // contents in browser has full path + selection = getString(dialog_->browser); + } else { + // contents in browser has filenames without path + // reconstruct path from controller getContents + string const files = controller().getContents(activeStyle, true); + vector const vec = getVectorFromString(files, "\n"); + + // find line in files vector + vector::const_iterator it = vec.begin(); + int const line = fl_get_browser(dialog_->browser); + for (int i = line; it != vec.end() && i > 0; ++it, --i) { + if (i == 1) selection = *it; + } } + if (!selection.empty()) { + controller().viewFile(selection); + } + + // reset the browser so that the following single-click callback doesn't do anything + fl_deselect_browser(dialog_->browser); + } else if (ob == dialog_->button_rescan) { // build new *Files.lst controller().rescanStyles(); updateStyles(activeStyle); } else if (ob == dialog_->check_fullpath) { - setEnabled(dialog_->button_view, - fl_get_button(dialog_->check_fullpath)); updateStyles(activeStyle); - } else if (ob == dialog_->button_texhash) { - // makes only sense if the rights are set well for - // users (/var/lib/texmf/ls-R) - controller().runTexhash(); - // update files in fact of texhash - controller().rescanStyles(); - - } else if (ob == dialog_->button_view) { - unsigned int selection = fl_get_browser(dialog_->browser); - // a valid entry? - if (selection > 0) { - controller().viewFile( - fl_get_browser_line(dialog_->browser, - selection)); + } else if (ob == dialog_->choice_classes) { + switch (fl_get_choice(dialog_->choice_classes)) { + case 3: + updateStyles(ControlTexinfo::bst); + break; + case 2: + updateStyles(ControlTexinfo::sty); + break; + case 1: + default: + updateStyles(ControlTexinfo::cls); } } return ButtonPolicy::SMI_VALID; } + void FormTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle) { fl_clear_browser(dialog_->browser); diff --git a/src/frontends/xforms/FormWrap.C b/src/frontends/xforms/FormWrap.C index 2612f3bd42..7374014c75 100644 --- a/src/frontends/xforms/FormWrap.C +++ b/src/frontends/xforms/FormWrap.C @@ -18,10 +18,13 @@ #include "ControlWrap.h" #include "FormWrap.h" #include "forms/form_wrap.h" +#include "Tooltips.h" + #include "support/lstrings.h" #include "helper_funcs.h" -#include "debug.h" #include "xforms_helpers.h" +#include "checkedwidgets.h" + #include FORMS_H_LOCATION typedef FormCB > base_class; @@ -35,27 +38,46 @@ void FormWrap::build() { dialog_.reset(build_wrap(this)); - // Allow the base class to control messages - setMessageWidget(dialog_->text_warning); - - fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED); - setPrehandler(dialog_->input_width); - - string const choice = getStringFromVector(getLatexUnits(), "|"); - fl_addto_choice(dialog_->choice_width_units, subst(choice, "%", "%%").c_str()); - // Manage the ok, apply and cancel/close buttons bc().setOK(dialog_->button_ok); bc().setApply(dialog_->button_apply); bc().setCancel(dialog_->button_close); bc().setRestore(dialog_->button_restore); + // disable for read-only documents bc().addReadOnly(dialog_->input_width); bc().addReadOnly(dialog_->choice_width_units); - bc().addReadOnly(dialog_->radio_left); - bc().addReadOnly(dialog_->radio_right); - bc().addReadOnly(dialog_->radio_outer); - bc().addReadOnly(dialog_->radio_default); + + // check validity of "length + unit" input + addCheckedGlueLength(bc(), dialog_->input_width); + + // trigger an input event for cut&paste with middle mouse button. + setPrehandler(dialog_->input_width); + + fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED); + + string const choice = getStringFromVector(getLatexUnits(), "|"); + fl_addto_choice(dialog_->choice_width_units, + subst(choice, "%", "%%").c_str()); + + placement_.init(dialog_->radio_default, 0); // default + placement_.init(dialog_->radio_outer, 'p'); + placement_.init(dialog_->radio_left, 'l'); + placement_.init(dialog_->radio_right, 'r'); + + // set up the tooltips + string str = _("Enter width for the float."); + tooltips().init(dialog_->input_width, str); + str = _("Forces float to the right in a paragraph if the page number " + "is odd, and to the left if page number is even."); + tooltips().init(dialog_->radio_default, str); + str = _("Forces float to the left in a paragraph if the pagenumber " + "is odd, and to the right if page number is even."); + tooltips().init(dialog_->radio_outer, str); + str = _("Forces float to the left in the paragraph."); + tooltips().init(dialog_->radio_left, str); + str = _("Forces float to the right in the paragraph."); + tooltips().init(dialog_->radio_right, str); } @@ -65,14 +87,11 @@ void FormWrap::apply() LyXLength(getLengthFromWidgets(dialog_->input_width, dialog_->choice_width_units)); - if (fl_get_button(dialog_->radio_left)) - controller().params().placement = "l"; - else if (fl_get_button(dialog_->radio_right)) - controller().params().placement = "r"; - else if (fl_get_button(dialog_->radio_outer)) - controller().params().placement = "p"; + char const c = static_cast(placement_.get()); + if (c) + controller().params().placement = c; else - controller().params().placement.erase(); + controller().params().placement.erase(); // default } @@ -82,42 +101,8 @@ void FormWrap::update() fl_set_input(dialog_->input_width, tostr(len.value()).c_str()); fl_set_choice(dialog_->choice_width_units, len.unit() + 1); - if (controller().params().placement == "l") - fl_set_button(dialog_->radio_left, 1); - else if (controller().params().placement == "r") - fl_set_button(dialog_->radio_right, 1); - else if (controller().params().placement == "p") - fl_set_button(dialog_->radio_outer, 1); + if (controller().params().placement.empty()) + placement_.set(dialog_->radio_default); // default else - fl_set_button(dialog_->radio_default, 1); -} - - -ButtonPolicy::SMInput FormWrap::input(FL_OBJECT * ob, long) -{ - clearMessage(); - - ButtonPolicy::SMInput action = ButtonPolicy::SMI_NOOP; - - if (ob == dialog_->radio_left || - ob == dialog_->radio_right || - ob == dialog_->radio_outer || - ob == dialog_->radio_default || - ob == dialog_->choice_width_units) - return ButtonPolicy::SMI_VALID; - - // disallow senseless data - // warnings if input is senseless - if (ob == dialog_->input_width) { - string const input = getString(dialog_->input_width); - bool const invalid = !isValidLength(input) && !isStrDbl(input); - if (invalid) { - postWarning(_("Invalid Length!")); - action = ButtonPolicy::SMI_INVALID; - } else { - action = ButtonPolicy::SMI_VALID; - } - } - - return action; + placement_.set(controller().params().placement.c_str()[0]); } diff --git a/src/frontends/xforms/FormWrap.h b/src/frontends/xforms/FormWrap.h index 14fb960c33..97467ab366 100644 --- a/src/frontends/xforms/FormWrap.h +++ b/src/frontends/xforms/FormWrap.h @@ -17,6 +17,7 @@ #endif #include "FormBase.h" +#include "RadioButtonGroup.h" class ControlWrap; struct FD_wrap; @@ -36,8 +37,9 @@ private: virtual void build(); /// Update dialog before/whilst showing it. virtual void update(); - /// Filter the inputs on callback from xforms - virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); + + /// placement + RadioButtonGroup placement_; }; #endif // FORMWRAP_H diff --git a/src/frontends/xforms/forms/form_print.fd b/src/frontends/xforms/forms/form_print.fd index 1430e90b41..7886431d2b 100644 --- a/src/frontends/xforms/forms/form_print.fd +++ b/src/frontends/xforms/forms/form_print.fd @@ -160,7 +160,7 @@ argument: 0 -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON -box: 175 315 100 25 +box: 170 315 100 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -214,7 +214,7 @@ argument: 0 -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON -box: 10 260 270 25 +box: 10 260 200 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -231,8 +231,8 @@ argument: 0 -------------------- class: FL_COUNTER -type: NORMAL_COUNTER -box: 80 315 90 25 +type: SIMPLE_COUNTER +box: 90 315 70 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_BLUE alignment: FL_ALIGN_LEFT @@ -291,7 +291,7 @@ argument: 0 -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON -box: 10 210 270 25 +box: 10 210 200 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -309,7 +309,7 @@ argument: 0 -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON -box: 10 235 270 25 +box: 10 235 200 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -417,7 +417,7 @@ argument: -------------------- class: FL_ROUND3DBUTTON type: RADIO_BUTTON -box: 10 140 270 25 +box: 10 140 85 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -435,7 +435,7 @@ argument: 0 -------------------- class: FL_ROUND3DBUTTON type: RADIO_BUTTON -box: 10 170 100 25 +box: 10 170 85 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER diff --git a/src/frontends/xforms/forms/form_spellchecker.fd b/src/frontends/xforms/forms/form_spellchecker.fd index 5c9deaf092..7493211482 100644 --- a/src/frontends/xforms/forms/form_spellchecker.fd +++ b/src/frontends/xforms/forms/form_spellchecker.fd @@ -9,14 +9,14 @@ SnapGrid: 5 =============== FORM =============== Name: form_spellchecker -Width: 215 -Height: 310 -Number of Objects: 12 +Width: 320 +Height: 245 +Number of Objects: 13 -------------------- class: FL_BOX type: FLAT_BOX -box: 0 0 215 310 +box: 0 0 320 245 boxtype: FL_FLAT_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -31,6 +31,24 @@ name: callback: argument: +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 5 198 205 25 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Word count +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthWest FL_SouthWest +name: +callback: +argument: + -------------------- class: FL_TEXT type: NORMAL_TEXT @@ -63,7 +81,7 @@ label: shortcut: resize: FL_RESIZE_X gravity: FL_NorthWest FL_NorthEast -name: text +name: text_unknown callback: C_FormBaseInputCB argument: 0 @@ -81,14 +99,14 @@ label: Replacement:|#R shortcut: resize: FL_RESIZE_X gravity: FL_NorthWest FL_NorthEast -name: input +name: input_replacement callback: C_FormBaseInputCB argument: 0 -------------------- class: FL_BROWSER type: SELECT_BROWSER -box: 5 185 205 75 +box: 5 125 205 70 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_TOP_LEFT @@ -99,14 +117,14 @@ label: Suggestions:|#g shortcut: resize: FL_RESIZE_ALL gravity: FL_NorthWest FL_SouthEast -name: browser +name: browser_suggestions callback: C_FormBaseInputCB argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 5 280 90 25 +box: 215 10 100 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -116,7 +134,7 @@ lcol: FL_BLACK label: Start|#S shortcut: resize: FL_RESIZE_NONE -gravity: FL_SouthWest FL_SouthWest +gravity: FL_NorthEast FL_NorthEast name: button_start callback: C_FormBaseInputCB argument: 0 @@ -124,7 +142,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 110 135 100 25 +box: 215 130 100 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -133,8 +151,8 @@ size: FL_NORMAL_SIZE lcol: FL_BLACK label: Add|#d shortcut: -resize: FL_RESIZE_X -gravity: FL_North FL_NorthEast +resize: FL_RESIZE_NONE +gravity: FL_NorthEast FL_NorthEast name: button_add callback: C_FormBaseInputCB argument: 0 @@ -142,7 +160,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 110 105 100 25 +box: 215 40 100 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -152,7 +170,7 @@ lcol: FL_BLACK label: Ignore|#I shortcut: resize: FL_RESIZE_X -gravity: FL_North FL_NorthEast +gravity: FL_NorthEast FL_NorthEast name: button_ignore callback: C_FormBaseInputCB argument: 0 @@ -160,7 +178,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 5 135 100 25 +box: 215 100 100 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -170,7 +188,7 @@ lcol: FL_BLACK label: Accept|#A shortcut: resize: FL_RESIZE_X -gravity: FL_NorthWest FL_North +gravity: FL_NorthEast FL_NorthEast name: button_accept callback: C_FormBaseInputCB argument: 0 @@ -178,7 +196,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 120 280 90 25 +box: 225 215 90 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -196,7 +214,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 5 105 100 25 +box: 215 70 100 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -205,32 +223,33 @@ size: FL_NORMAL_SIZE lcol: FL_BLACK label: Replace|#R shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_North +resize: FL_RESIZE_NONE +gravity: FL_NorthEast FL_NorthEast name: button_replace callback: C_FormBaseInputCB argument: 0 -------------------- -class: FL_SLIDER +class: FL_VALSLIDER type: HOR_FILL_SLIDER -box: 5 265 205 10 -boxtype: FL_DOWN_BOX -colors: FL_BLUE FL_COL1 -alignment: FL_ALIGN_LEFT +box: 5 220 205 20 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER style: FL_NORMAL_STYLE -size: 0 +size: FL_NORMAL_SIZE lcol: FL_BLACK -label: +label: 0 % shortcut: resize: FL_RESIZE_X gravity: FL_SouthWest FL_SouthEast -name: slider +name: slider_progress callback: argument: bounds: 0 100 + precision: 0 value: 0 - step: 1 + slsize: 0.00 ============================== create_the_forms diff --git a/src/frontends/xforms/forms/form_texinfo.fd b/src/frontends/xforms/forms/form_texinfo.fd index 5bf1e9489c..d682d83dee 100644 --- a/src/frontends/xforms/forms/form_texinfo.fd +++ b/src/frontends/xforms/forms/form_texinfo.fd @@ -9,14 +9,14 @@ SnapGrid: 5 =============== FORM =============== Name: form_texinfo -Width: 250 +Width: 245 Height: 215 -Number of Objects: 8 +Number of Objects: 7 -------------------- class: FL_BOX type: FLAT_BOX -box: 0 0 250 215 +box: 0 0 245 215 boxtype: FL_FLAT_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -34,7 +34,7 @@ argument: -------------------- class: FL_BROWSER type: HOLD_BROWSER -box: 5 35 240 110 +box: 5 35 235 110 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_TOP @@ -52,7 +52,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 5 150 110 25 +box: 5 150 115 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -67,28 +67,10 @@ name: button_rescan callback: C_FormBaseInputCB argument: 2 --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 135 150 110 25 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: View|#V -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_SouthEast FL_SouthEast -name: button_view -callback: C_FormBaseInputCB -argument: 2 - -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON -box: 140 5 105 25 +box: 135 5 105 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -106,7 +88,7 @@ argument: 2 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 160 185 85 25 +box: 150 185 90 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -124,7 +106,7 @@ argument: 0 -------------------- class: FL_CHOICE type: NORMAL_CHOICE -box: 5 5 130 25 +box: 5 5 125 25 boxtype: FL_FRAME_BOX colors: FL_COL1 FL_BLACK alignment: FL_ALIGN_LEFT @@ -142,7 +124,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 5 185 110 25 +box: 125 150 115 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER diff --git a/src/frontends/xforms/forms/form_wrap.fd b/src/frontends/xforms/forms/form_wrap.fd index b6c353cdef..689be37f78 100644 --- a/src/frontends/xforms/forms/form_wrap.fd +++ b/src/frontends/xforms/forms/form_wrap.fd @@ -5,17 +5,18 @@ Internal Form Definition File Number of forms: 1 Unit of measure: FL_COORD_PIXEL +SnapGrid: 5 =============== FORM =============== Name: form_wrap -Width: 430 -Height: 200 -Number of Objects: 16 +Width: 395 +Height: 115 +Number of Objects: 14 -------------------- class: FL_BOX type: FLAT_BOX -box: 0 0 430 200 +box: 0 0 395 115 boxtype: FL_FLAT_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -33,35 +34,17 @@ argument: -------------------- class: FL_LABELFRAME type: ENGRAVED_FRAME -box: 20 20 200 60 +box: 175 10 215 65 boxtype: FL_NO_BOX colors: FL_BLACK FL_COL1 alignment: FL_ALIGN_TOP_LEFT -style: FL_BOLD_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Width -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_LABELFRAME -type: ENGRAVED_FRAME -box: 240 20 180 130 -boxtype: FL_NO_BOX -colors: FL_BLACK FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_BOLD_STYLE +style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK label: Placement shortcut: resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity +gravity: FL_NoGravity FL_SouthEast name: callback: argument: @@ -69,17 +52,17 @@ argument: -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 30 30 110 30 +box: 5 30 85 25 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT +alignment: FL_ALIGN_TOP_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: +label: Width:|#W shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_X +gravity: FL_West FL_NoGravity name: input_width callback: C_FormBaseInputCB argument: 0 @@ -87,7 +70,7 @@ argument: 0 -------------------- class: FL_CHOICE type: NORMAL_CHOICE -box: 150 30 60 30 +box: 90 30 75 25 boxtype: FL_FRAME_BOX colors: FL_COL1 FL_BLACK alignment: FL_ALIGN_LEFT @@ -96,7 +79,7 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_width_units callback: C_FormBaseInputCB @@ -105,7 +88,7 @@ argument: 0 -------------------- class: FL_BEGIN_GROUP type: 0 -box: 0 0 0 0 +box: 0 10 10 0 boxtype: FL_NO_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_CENTER @@ -123,16 +106,16 @@ argument: -------------------- class: FL_ROUND3DBUTTON type: RADIO_BUTTON -box: 249 30 152 30 +box: 260 45 25 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_CENTER +alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK label: Left|#L shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_left callback: C_FormBaseInputCB @@ -141,16 +124,16 @@ argument: 0 -------------------- class: FL_ROUND3DBUTTON type: RADIO_BUTTON -box: 249 60 152 30 +box: 285 45 95 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Right|#R +label: Right|#i shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_right callback: C_FormBaseInputCB @@ -159,7 +142,7 @@ argument: 0 -------------------- class: FL_ROUND3DBUTTON type: RADIO_BUTTON -box: 249 90 152 30 +box: 285 20 95 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -168,7 +151,7 @@ size: FL_NORMAL_SIZE lcol: FL_BLACK label: Outer|#O shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_outer callback: C_FormBaseInputCB @@ -177,16 +160,16 @@ argument: 0 -------------------- class: FL_ROUND3DBUTTON type: RADIO_BUTTON -box: 250 120 152 30 +box: 260 20 25 25 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_CENTER +alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Default (outer)|#D +label: Default|#D shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_default callback: C_FormBaseInputCB @@ -213,7 +196,7 @@ argument: -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 330 160 90 30 +box: 300 85 90 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -222,8 +205,8 @@ size: FL_NORMAL_SIZE lcol: FL_BLACK label: Cancel|^[ shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast name: button_close callback: C_FormBaseCancelCB argument: 0 @@ -231,7 +214,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 230 160 90 30 +box: 205 85 90 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -240,8 +223,8 @@ size: FL_NORMAL_SIZE lcol: FL_BLACK label: Apply|#A shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast name: button_apply callback: C_FormBaseApplyCB argument: 0 @@ -249,7 +232,7 @@ argument: 0 -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 130 160 90 30 +box: 110 85 90 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -258,8 +241,8 @@ size: FL_NORMAL_SIZE lcol: FL_BLACK label: OK shortcut: ^M -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast name: button_ok callback: C_FormBaseOKCB argument: 0 @@ -267,7 +250,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 10 160 90 30 +box: 5 85 90 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -276,29 +259,11 @@ size: FL_NORMAL_SIZE lcol: FL_BLACK label: Restore|#R shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_NONE +gravity: FL_SouthWest FL_SouthWest name: button_restore callback: C_FormBaseRestoreCB argument: 0 --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 20 90 210 30 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: text_warning -callback: -argument: - ============================== create_the_forms -- 2.39.5