mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
fix to default units from Juergen S.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3295 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b4a4c97efb
commit
77aa584347
@ -1,3 +1,9 @@
|
||||
2002-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* FormDocument.C: Recognize the default paper settings too
|
||||
when setting the default length values (cm or inch).
|
||||
* FormParagraph.C: do the same.
|
||||
|
||||
2001-12-11 Michael A. Koziarski <michael@koziarski.org>
|
||||
|
||||
* FormFloat.C: changes to prevent here definitely being used
|
||||
|
@ -451,8 +451,10 @@ bool FormDocument::input( FL_OBJECT * ob, long data )
|
||||
setEnabled(class_->choice_default_skip_units,
|
||||
skip_used && length_input);
|
||||
// Default unit choice is cm if metric, inches if US paper.
|
||||
// If papersize is default, check the lyxrc-settings
|
||||
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
||||
bool const metric = paperchoice < 3 || paperchoice > 5;
|
||||
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
|
||||
|| paperchoice == 2 || paperchoice > 5;
|
||||
int const default_unit = metric ? 8 : 9;
|
||||
if (strip(fl_get_input(class_->input_doc_skip)).empty())
|
||||
fl_set_choice(class_->choice_default_skip_units,
|
||||
@ -487,6 +489,7 @@ bool FormDocument::input( FL_OBJECT * ob, long data )
|
||||
|
||||
if (ob == paper_->choice_papersize) {
|
||||
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
||||
bool const defsize = paperchoice == 1;
|
||||
bool const custom = paperchoice == 2;
|
||||
bool const a3size = paperchoice == 6;
|
||||
bool const b3size = paperchoice == 9;
|
||||
@ -524,11 +527,13 @@ bool FormDocument::input( FL_OBJECT * ob, long data )
|
||||
setEnabled(paper_->radio_landscape, !custom);
|
||||
|
||||
// Default unit choice is cm if metric, inches if US paper.
|
||||
bool const metric = paperchoice < 3 || paperchoice > 5;
|
||||
// If papersize is default, use the lyxrc-settings
|
||||
bool const metric = (defsize && lyxrc.default_papersize > 3)
|
||||
|| paperchoice == 2 || paperchoice > 5;
|
||||
int const default_unit = metric ? 8 : 9;
|
||||
if (strip(fl_get_input(paper_->input_custom_width)).empty())
|
||||
fl_set_choice(paper_->choice_custom_width_units,
|
||||
default_unit);
|
||||
fl_set_choice(paper_->choice_custom_width_units,
|
||||
default_unit);
|
||||
if (strip(fl_get_input(paper_->input_custom_height)).empty())
|
||||
fl_set_choice(paper_->choice_custom_height_units,
|
||||
default_unit);
|
||||
@ -988,13 +993,14 @@ void FormDocument::class_update(BufferParams const & params)
|
||||
break;
|
||||
case VSpace::LENGTH:
|
||||
{
|
||||
int const paperchoice = params.papersize2 + 1;
|
||||
bool const metric = paperchoice < 3 || paperchoice > 5;
|
||||
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
||||
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
|
||||
|| paperchoice == 2 || paperchoice > 5;
|
||||
string const default_unit = metric ? "cm" : "in";
|
||||
string const length = params.getDefSkip().asLyXCommand();
|
||||
updateWidgetsFromLengthString(class_->input_doc_skip,
|
||||
class_->choice_default_skip_units,
|
||||
length, default_unit);
|
||||
class_->choice_default_skip_units,
|
||||
length, default_unit);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1119,11 +1125,12 @@ void FormDocument::paper_update(BufferParams const & params)
|
||||
&& fl_get_button(paper_->radio_portrait));
|
||||
|
||||
// Default unit choice is cm if metric, inches if US paper.
|
||||
bool const metric = paperchoice < 3 || paperchoice > 5;
|
||||
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
|
||||
|| paperchoice == 2 || paperchoice > 5;
|
||||
string const default_unit = metric ? "cm" : "in";
|
||||
updateWidgetsFromLengthString(paper_->input_custom_width,
|
||||
paper_->choice_custom_width_units,
|
||||
params.paperwidth, default_unit);
|
||||
paper_->choice_custom_width_units,
|
||||
params.paperwidth, default_unit);
|
||||
setEnabled(paper_->input_custom_width, useCustom);
|
||||
setEnabled(paper_->choice_custom_width_units, useCustom);
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "buffer.h"
|
||||
#include "lyxtext.h"
|
||||
#include "xforms_helpers.h"
|
||||
#include "lyxrc.h" // to set the deafult length values
|
||||
#include "BufferView.h"
|
||||
#include "lyxtextclasslist.h"
|
||||
#include "Spacing.h"
|
||||
@ -401,20 +402,21 @@ void FormParagraph::update()
|
||||
break;
|
||||
case VSpace::LENGTH:
|
||||
{
|
||||
fl_set_choice (dialog_->choice_space_above, 7);
|
||||
setEnabled(dialog_->input_space_above, true);
|
||||
setEnabled(dialog_->choice_value_space_above, true);
|
||||
string const default_unit = "cm";
|
||||
string const length = par_->params().spaceTop().length().asString();
|
||||
updateWidgetsFromLengthString(dialog_->input_space_above,
|
||||
dialog_->choice_value_space_above,
|
||||
length, default_unit);
|
||||
fl_set_choice (dialog_->choice_space_above, 7);
|
||||
setEnabled(dialog_->input_space_above, true);
|
||||
setEnabled(dialog_->choice_value_space_above, true);
|
||||
bool const metric = lyxrc.default_papersize > 3;
|
||||
string const default_unit = metric ? "cm" : "in";
|
||||
string const length = par_->params().spaceTop().length().asString();
|
||||
updateWidgetsFromLengthString(dialog_->input_space_above,
|
||||
dialog_->choice_value_space_above,
|
||||
length, default_unit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fl_set_button (dialog_->check_space_above,
|
||||
par_->params().spaceTop().keep());
|
||||
par_->params().spaceTop().keep());
|
||||
fl_set_input (dialog_->input_space_below, "");
|
||||
|
||||
setEnabled(dialog_->input_space_below, false);
|
||||
@ -440,21 +442,22 @@ void FormParagraph::update()
|
||||
break;
|
||||
case VSpace::LENGTH:
|
||||
{
|
||||
fl_set_choice (dialog_->choice_space_below, 7);
|
||||
setEnabled(dialog_->input_space_below, true);
|
||||
setEnabled(dialog_->choice_value_space_below, true);
|
||||
string const default_unit = "cm";
|
||||
string const length =
|
||||
par_->params().spaceBottom().length().asString();
|
||||
updateWidgetsFromLengthString(dialog_->input_space_below,
|
||||
dialog_->choice_value_space_below,
|
||||
length, default_unit);
|
||||
fl_set_choice (dialog_->choice_space_below, 7);
|
||||
setEnabled(dialog_->input_space_below, true);
|
||||
setEnabled(dialog_->choice_value_space_below, true);
|
||||
bool const metric = lyxrc.default_papersize > 3;
|
||||
string const default_unit = metric ? "cm" : "in";
|
||||
string const length =
|
||||
par_->params().spaceBottom().length().asString();
|
||||
updateWidgetsFromLengthString(dialog_->input_space_below,
|
||||
dialog_->choice_value_space_below,
|
||||
length, default_unit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fl_set_button(dialog_->check_space_below,
|
||||
par_->params().spaceBottom().keep());
|
||||
par_->params().spaceBottom().keep());
|
||||
fl_set_button(dialog_->check_noindent,
|
||||
par_->params().noindent());
|
||||
}
|
||||
@ -476,28 +479,30 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
|
||||
if (fl_get_choice (dialog_->choice_space_above) != 7) {
|
||||
fl_set_input (dialog_->input_space_above, "");
|
||||
setEnabled (dialog_->input_space_above, false);
|
||||
setEnabled (dialog_->choice_value_space_above, false);
|
||||
setEnabled (dialog_->choice_value_space_above, false);
|
||||
} else {
|
||||
setEnabled (dialog_->input_space_above, !lv_->buffer()->isReadonly());
|
||||
setEnabled (dialog_->choice_value_space_above, !lv_->buffer()->isReadonly());
|
||||
int const default_unit = 8;
|
||||
if (strip(fl_get_input(dialog_->input_space_above)).empty())
|
||||
fl_set_choice(dialog_->choice_value_space_above,
|
||||
default_unit);
|
||||
setEnabled (dialog_->choice_value_space_above, !lv_->buffer()->isReadonly());
|
||||
bool const metric = lyxrc.default_papersize > 3;
|
||||
int const default_unit = metric ? 8 : 9;
|
||||
if (strip(fl_get_input(dialog_->input_space_above)).empty())
|
||||
fl_set_choice(dialog_->choice_value_space_above,
|
||||
default_unit);
|
||||
}
|
||||
}
|
||||
if (ob == dialog_->choice_space_below) {
|
||||
if (fl_get_choice (dialog_->choice_space_below) != 7) {
|
||||
fl_set_input (dialog_->input_space_below, "");
|
||||
setEnabled (dialog_->input_space_below, false);
|
||||
setEnabled (dialog_->choice_value_space_below, false);
|
||||
setEnabled (dialog_->choice_value_space_below, false);
|
||||
} else {
|
||||
setEnabled (dialog_->input_space_below, !lv_->buffer()->isReadonly());
|
||||
setEnabled (dialog_->choice_value_space_below, !lv_->buffer()->isReadonly());
|
||||
int const default_unit = 8;
|
||||
if (strip(fl_get_input(dialog_->input_space_below)).empty())
|
||||
fl_set_choice(dialog_->choice_value_space_below,
|
||||
default_unit);
|
||||
setEnabled (dialog_->choice_value_space_below, !lv_->buffer()->isReadonly());
|
||||
bool const metric = lyxrc.default_papersize > 3;
|
||||
int const default_unit = metric ? 8 : 9;
|
||||
if (strip(fl_get_input(dialog_->input_space_below)).empty())
|
||||
fl_set_choice(dialog_->choice_value_space_below,
|
||||
default_unit);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user