mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
adjust for scoped_ptr, constify
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1895 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
69672dbf0e
commit
b9655a2d25
@ -1,3 +1,11 @@
|
|||||||
|
2001-04-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
|
* xforms_helpers.C (formatted): constify length
|
||||||
|
|
||||||
|
* FormTabular.C (update): small restructure, adjust for scoped_ptr
|
||||||
|
(input): adjust for scoped_ptr
|
||||||
|
(input): constify str
|
||||||
|
|
||||||
2001-04-03 John Levon <moz@compsoc.man.ac.uk>
|
2001-04-03 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* Dialogs.C: s/popup/dialog/
|
* Dialogs.C: s/popup/dialog/
|
||||||
|
@ -128,19 +128,17 @@ void FormTabular::build()
|
|||||||
|
|
||||||
void FormTabular::update()
|
void FormTabular::update()
|
||||||
{
|
{
|
||||||
if (!inset_ || !inset_->tabular)
|
if (!inset_ || !inset_->tabular.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LyXTabular * tabular = inset_->tabular;
|
LyXTabular * tabular = inset_->tabular.get();
|
||||||
int
|
int align;
|
||||||
align,
|
char buf[12];
|
||||||
cell;
|
string pwidth;
|
||||||
char
|
string special;
|
||||||
buf[12];
|
|
||||||
string
|
|
||||||
pwidth, special;
|
|
||||||
|
|
||||||
actCell_ = cell = inset_->GetActCell();
|
int cell = inset_->GetActCell();
|
||||||
|
actCell_ = cell;
|
||||||
int column = tabular->column_of_cell(cell)+1;
|
int column = tabular->column_of_cell(cell)+1;
|
||||||
fl_set_object_label(dialog_->text_warning,"");
|
fl_set_object_label(dialog_->text_warning,"");
|
||||||
fl_activate_object(column_options_->input_special_alignment);
|
fl_activate_object(column_options_->input_special_alignment);
|
||||||
@ -346,12 +344,13 @@ void FormTabular::update()
|
|||||||
tabular->GetRotateTabular());
|
tabular->GetRotateTabular());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FormTabular::input(FL_OBJECT * ob, long)
|
bool FormTabular::input(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
if (!inset_)
|
if (!inset_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LyXTabular * tabular = inset_->tabular;
|
LyXTabular * tabular = inset_->tabular.get();
|
||||||
int s;
|
int s;
|
||||||
LyXTabular::Feature num = LyXTabular::LAST_ACTION;
|
LyXTabular::Feature num = LyXTabular::LAST_ACTION;
|
||||||
string special;;
|
string special;;
|
||||||
@ -371,7 +370,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ob == column_options_->input_column_width) {
|
if (ob == column_options_->input_column_width) {
|
||||||
string str = fl_get_input(ob);
|
string const str = fl_get_input(ob);
|
||||||
if (!str.empty() && !isValidLength(str)) {
|
if (!str.empty() && !isValidLength(str)) {
|
||||||
fl_set_object_label(dialog_->text_warning,
|
fl_set_object_label(dialog_->text_warning,
|
||||||
_("Warning: Invalid Length (valid example: 10mm)"));
|
_("Warning: Invalid Length (valid example: 10mm)"));
|
||||||
@ -383,7 +382,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (ob == cell_options_->input_mcolumn_width) {
|
if (ob == cell_options_->input_mcolumn_width) {
|
||||||
string str = fl_get_input(ob);
|
string const str = fl_get_input(ob);
|
||||||
if (!str.empty() && !isValidLength(str)) {
|
if (!str.empty() && !isValidLength(str)) {
|
||||||
fl_set_object_label(dialog_->text_warning,
|
fl_set_object_label(dialog_->text_warning,
|
||||||
_("Warning: Invalid Length (valid example: 10mm)"));
|
_("Warning: Invalid Length (valid example: 10mm)"));
|
||||||
@ -394,7 +393,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
|
|||||||
update(); // update for alignment
|
update(); // update for alignment
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
string str = fl_get_input(column_options_->input_column_width);
|
string const str = fl_get_input(column_options_->input_column_width);
|
||||||
if (!str.empty() && !isValidLength(str)) {
|
if (!str.empty() && !isValidLength(str)) {
|
||||||
fl_set_object_label(
|
fl_set_object_label(
|
||||||
dialog_->text_warning,
|
dialog_->text_warning,
|
||||||
|
@ -38,6 +38,7 @@ void setEnabled(FL_OBJECT * ob, bool enable)
|
|||||||
// Take a string and add breaks so that it fits into a desired label width, w
|
// Take a string and add breaks so that it fits into a desired label width, w
|
||||||
string formatted(string const & sin, int w, int size, int style)
|
string formatted(string const & sin, int w, int size, int style)
|
||||||
{
|
{
|
||||||
|
#warning Why cant this be done by a one pass algo? (Lgb)
|
||||||
string sout;
|
string sout;
|
||||||
if (sin.empty()) return sout;
|
if (sin.empty()) return sout;
|
||||||
|
|
||||||
@ -59,10 +60,11 @@ string formatted(string const & sin, int w, int size, int style)
|
|||||||
// Flush remaining contents of word
|
// Flush remaining contents of word
|
||||||
if (!word.empty() ) sentence.push_back(word);
|
if (!word.empty() ) sentence.push_back(word);
|
||||||
|
|
||||||
string line, line_plus_word;
|
string line;
|
||||||
|
string line_plus_word;
|
||||||
for (vector<string>::const_iterator vit = sentence.begin();
|
for (vector<string>::const_iterator vit = sentence.begin();
|
||||||
vit != sentence.end(); ++vit) {
|
vit != sentence.end(); ++vit) {
|
||||||
string word = *vit;
|
string word(*vit);
|
||||||
|
|
||||||
char c = word[0];
|
char c = word[0];
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
@ -75,9 +77,9 @@ string formatted(string const & sin, int w, int size, int style)
|
|||||||
if (!line_plus_word.empty() ) line_plus_word += ' ';
|
if (!line_plus_word.empty() ) line_plus_word += ' ';
|
||||||
line_plus_word += word;
|
line_plus_word += word;
|
||||||
|
|
||||||
int length = fl_get_string_width(style, size,
|
int const length = fl_get_string_width(style, size,
|
||||||
line_plus_word.c_str(),
|
line_plus_word.c_str(),
|
||||||
int(line_plus_word.length()));
|
int(line_plus_word.length()));
|
||||||
if (length >= w) {
|
if (length >= w) {
|
||||||
sout += line + '\n';
|
sout += line + '\n';
|
||||||
line_plus_word = word;
|
line_plus_word = word;
|
||||||
@ -90,8 +92,8 @@ string formatted(string const & sin, int w, int size, int style)
|
|||||||
sout += line;
|
sout += line;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sout[sout.length()-1] == '\n')
|
if (sout[sout.length() - 1] == '\n')
|
||||||
sout.erase(sout.length()-1);
|
sout.erase(sout.length() - 1);
|
||||||
|
|
||||||
return sout;
|
return sout;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user