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,
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;
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);
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:
&& 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);
#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"
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);
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());
}
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);
}
}