(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
This commit is contained in:
Angus Leeming 2002-10-25 09:16:22 +00:00
parent 3b0188912a
commit ec3f063250
21 changed files with 591 additions and 666 deletions

View File

@ -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,

View File

@ -1,3 +1,11 @@
2002-10-24 Rob Lahaye <lahaye@snu.ac.kr>
* 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 <aleem@pneumon.bg.ic.ac.uk>
* LyXKeySym.h (operator==): compilation fix. The two args should have

View File

@ -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 <config.h>
#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

View File

@ -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 <rae@lyx.org>
* 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

View File

@ -21,8 +21,6 @@ libfrontends_la_SOURCES = \
Dialogs.C \
Dialogs.h \
FileDialog.h \
Liason.C \
Liason.h \
LyXKeySym.h \
LyXKeySymFactory.h \
LyXScreenFactory.h \

View File

@ -1,3 +1,10 @@
2002-10-24 Rob Lahaye <lahaye@snu.ac.kr>
* ControlPrint.[Ch]: move code here from Liason.[Ch].
* ControlSpellchecker.h (getCount): new method.
* ControlSpellchecker.[Ch]: constify some accessor methods.
2002-10-22 Angus Leeming <leeming@lyx.org>
* Makefile.am (libcontrollers_la_SOURCES): arrange list into

View File

@ -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"));
}
}

View File

@ -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_)

View File

@ -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();

View File

@ -1,8 +1,23 @@
2002-10-24 Rob Lahaye <lahaye@snu.ac.kr>
* 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 <leeming@lyx.org>
* FormRef.C (updateBrowser): invoke updateHighlight

View File

@ -29,7 +29,6 @@
#include "support/lstrings.h"
#include FORMS_H_LOCATION
using std::make_pair;
typedef FormCB<ControlPrint, FormDB<FD_print> > 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<PrinterParams::Target>(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 = which_pages_.get();
pp.from_page = 0;
pp.to_page = 0;
if (strlen(fl_get_input(dialog_->input_from_page)) > 0) {
pp.all_pages = static_cast<bool>(all_pages_.get());
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,40 +172,73 @@ 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)
{
if (ob == dialog_->button_browse) {
// Get the filename from the dialog
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());
}
// select the file radio
if (!out_name.empty()) {
target_.set(dialog_->radio_file);
}
// if we type input string for file or printer, select that as a target
} 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)) {
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)) {
all_pages_.set(dialog_->radio_from_to);
}
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.
// 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;
// set both backgrounds to red?
}
// 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<bool>(*from);
bool const to_input = static_cast<bool>(*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<bool>(fl_get_button(dialog_->check_odd_pages));
bool const even_pages = static_cast<bool>(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<bool>(strToInt(from) % 2);
if ( (from_is_odd && even_only) || (!from_is_odd && odd_only) ) {
activate = ButtonPolicy::SMI_INVALID;
}
}
} 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
@ -214,46 +246,8 @@ ButtonPolicy::SMInput FormPrint::input(FL_OBJECT * ob, long)
setEnabled(dialog_->counter_copies, enable_counter);
// sorting only used when printing more than one copy
bool const enable_sorted = enable_counter
&& static_cast<unsigned int>(fl_get_counter_value(dialog_->counter_copies)) > 1;
bool const enable_sorted = enable_counter && 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 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);
}
}
// 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_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) &&
!fl_get_button(dialog_->radio_from_to)) {
fl_set_button(dialog_->radio_from_to, 1);
fl_set_button(dialog_->radio_all_pages, 0);
}
return activate;
}

View File

@ -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

View File

@ -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<ControlSpellchecker, FormDB<FD_spellchecker> > 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);
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 (ob == dialog_->button_replace) {
string const tmp = getString(dialog_->input_replacement);
controller().replace(tmp);
} else if (obj == dialog_->button_start) {
if (start())
controller().check();
else
controller().stop();
} 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
// reset dialog and buttons into start condition
input(0, 0);
// 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 %");
break;
}
}
void FormSpellchecker::showMessage(const char * msg)
{
fl_show_message(msg, "", "");
}
bool FormSpellchecker::start(bool init)
{
static bool running = false;
if (init) {
running = false;
} else {
running = !running;
}
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;
}

View File

@ -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);
};

View File

@ -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<string> const vec = getVectorFromString(files, "\n");
// find line in files vector
vector<string>::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);

View File

@ -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<ControlWrap, FormDB<FD_wrap> > 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<char>(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]);
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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