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:
Lars Gullik Bjønnes 2001-04-04 21:58:35 +00:00
parent 69672dbf0e
commit b9655a2d25
3 changed files with 30 additions and 21 deletions

View File

@ -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>
* Dialogs.C: s/popup/dialog/

View File

@ -128,19 +128,17 @@ void FormTabular::build()
void FormTabular::update()
{
if (!inset_ || !inset_->tabular)
if (!inset_ || !inset_->tabular.get())
return;
LyXTabular * tabular = inset_->tabular;
int
align,
cell;
char
buf[12];
string
pwidth, special;
LyXTabular * tabular = inset_->tabular.get();
int align;
char buf[12];
string pwidth;
string special;
actCell_ = cell = inset_->GetActCell();
int cell = inset_->GetActCell();
actCell_ = cell;
int column = tabular->column_of_cell(cell)+1;
fl_set_object_label(dialog_->text_warning,"");
fl_activate_object(column_options_->input_special_alignment);
@ -346,12 +344,13 @@ void FormTabular::update()
tabular->GetRotateTabular());
}
bool FormTabular::input(FL_OBJECT * ob, long)
{
if (!inset_)
return false;
LyXTabular * tabular = inset_->tabular;
LyXTabular * tabular = inset_->tabular.get();
int s;
LyXTabular::Feature num = LyXTabular::LAST_ACTION;
string special;;
@ -371,7 +370,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
return false;
}
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)) {
fl_set_object_label(dialog_->text_warning,
_("Warning: Invalid Length (valid example: 10mm)"));
@ -383,7 +382,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
return true;
}
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)) {
fl_set_object_label(dialog_->text_warning,
_("Warning: Invalid Length (valid example: 10mm)"));
@ -394,7 +393,7 @@ bool FormTabular::input(FL_OBJECT * ob, long)
update(); // update for alignment
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)) {
fl_set_object_label(
dialog_->text_warning,

View File

@ -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
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;
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
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();
vit != sentence.end(); ++vit) {
string word = *vit;
string word(*vit);
char c = word[0];
if (c == '\n') {
@ -75,7 +77,7 @@ string formatted(string const & sin, int w, int size, int style)
if (!line_plus_word.empty() ) line_plus_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(),
int(line_plus_word.length()));
if (length >= w) {
@ -90,8 +92,8 @@ string formatted(string const & sin, int w, int size, int style)
sout += line;
}
if (sout[sout.length()-1] == '\n')
sout.erase(sout.length()-1);
if (sout[sout.length() - 1] == '\n')
sout.erase(sout.length() - 1);
return sout;
}