From 94c15c0ed7ed8dadcabae6d9aa27a4683d5375a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Fri, 29 Jun 2001 06:30:53 +0000 Subject: [PATCH] lowercase.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2155 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 7 +++---- src/Spacing.C | 2 +- src/insets/ChangeLog | 8 ++++++++ src/insets/insettext.C | 2 +- src/insets/insettoc.C | 8 ++++---- src/insets/insettoc.h | 10 +++++----- src/insets/inseturl.C | 10 +++++----- src/insets/inseturl.h | 14 +++++++------- src/lyxfunc.C | 33 +++++++++++++++++++++++++-------- src/mathed/formulabase.C | 17 +++++++++++------ 10 files changed, 70 insertions(+), 41 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 0cb38a8c54..2d115a0151 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -398,17 +398,16 @@ void BufferView::Pimpl::updateScrollbar() current_scrollbar_value = tmp_scrollbar_value; long const height_diff = text_height - work_height; - + if (height_diff <= 0) { workarea_.setScrollbar(0, 1.0); return; } - workarea_.setScrollbarBounds(0, height_diff); double const lineh = bv_->text->defaultHeight(); workarea_.setScrollbarIncrements(lineh); - double const slider_size = 1.0 / double(height_diff) ; + double const slider_size = 1.0 / (double(height_diff) + work_height); workarea_.setScrollbar(current_scrollbar_value, slider_size); } @@ -2599,7 +2598,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) cur_value = par->params().spacing().getValue(); } - istringstream istr(argument.c_str()); + istringstream istr(argument); string tmp; istr >> tmp; diff --git a/src/Spacing.C b/src/Spacing.C index 103eb91fdc..61cf42bbce 100644 --- a/src/Spacing.C +++ b/src/Spacing.C @@ -59,7 +59,7 @@ void Spacing::set(Spacing::Space sp, float val) void Spacing::set(Spacing::Space sp, string const & val) { float fval; - istringstream istr(val.c_str()); + istringstream istr(val); istr >> fval; set(sp, fval); } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 34fef6c4ca..406c3d1822 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,11 @@ +2001-06-29 John Levon + + * insettoc.h: + * insettoc.C: + * inseturl.h: + * inseturl.C: fix method names in these to begin + with small char too, so they inherit + 2001-06-28 Lars Gullik Bjønnes * Change a lot of method names to begin with a small char. diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 82f7eeba19..18b49617ed 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -1056,7 +1056,7 @@ InsetText::localDispatch(BufferView * bv, cur_value = par->params().spacing().getValue(); } - std::istringstream istr(arg.c_str()); + std::istringstream istr(arg); string tmp; istr >> tmp; Spacing::Space new_spacing = cur_spacing; diff --git a/src/insets/insettoc.C b/src/insets/insettoc.C index 0e9685fb5b..48652ba3d5 100644 --- a/src/insets/insettoc.C +++ b/src/insets/insettoc.C @@ -24,7 +24,7 @@ string const InsetTOC::getScreenLabel() const } -Inset::Code InsetTOC::LyxCode() const +Inset::Code InsetTOC::lyxCode() const { string const cmdname(getCmdName()); if (cmdname == "tableofcontents") @@ -33,13 +33,13 @@ Inset::Code InsetTOC::LyxCode() const } -void InsetTOC::Edit(BufferView * bv, int, int, unsigned int) +void InsetTOC::edit(BufferView * bv, int, int, unsigned int) { bv->owner()->getDialogs()->showTOC(this); } -int InsetTOC::Ascii(Buffer const * buffer, std::ostream & os, int) const +int InsetTOC::ascii(Buffer const * buffer, std::ostream & os, int) const { os << getScreenLabel() << "\n\n"; @@ -63,7 +63,7 @@ int InsetTOC::Ascii(Buffer const * buffer, std::ostream & os, int) const } -int InsetTOC::Linuxdoc(Buffer const *, std::ostream & os) const +int InsetTOC::linuxdoc(Buffer const *, std::ostream & os) const { if (getCmdName() == "tableofcontents") os << ""; diff --git a/src/insets/insettoc.h b/src/insets/insettoc.h index 4be7d1ade6..9be3b6bdd8 100644 --- a/src/insets/insettoc.h +++ b/src/insets/insettoc.h @@ -31,17 +31,17 @@ public: /// string const getScreenLabel() const; /// - void Edit(BufferView * bv, int, int, unsigned int); + void edit(BufferView * bv, int, int, unsigned int); /// - EDITABLE Editable() const { return IS_EDITABLE; } + EDITABLE editable() const { return IS_EDITABLE; } /// bool display() const { return true; } /// - Inset::Code LyxCode() const; + Inset::Code lyxCode() const; /// - int Ascii(Buffer const *, std::ostream &, int linelen) const; + int ascii(Buffer const *, std::ostream &, int linelen) const; /// - int Linuxdoc(Buffer const *, std::ostream &) const; + int linuxdoc(Buffer const *, std::ostream &) const; /// int DocBook(Buffer const *, std::ostream &) const; }; diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index cb3fe5f22e..0f51583463 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -20,7 +20,7 @@ InsetUrl::InsetUrl(InsetCommandParams const & p) {} -void InsetUrl::Edit(BufferView * bv, int, int, unsigned int) +void InsetUrl::edit(BufferView * bv, int, int, unsigned int) { bv->owner()->getDialogs()->showUrl( this ); } @@ -43,7 +43,7 @@ string const InsetUrl::getScreenLabel() const } -int InsetUrl::Latex(Buffer const *, ostream & os, +int InsetUrl::latex(Buffer const *, ostream & os, bool fragile, bool /*free_spc*/) const { if (!getOptions().empty()) @@ -55,7 +55,7 @@ int InsetUrl::Latex(Buffer const *, ostream & os, } -int InsetUrl::Ascii(Buffer const *, ostream & os, int) const +int InsetUrl::ascii(Buffer const *, ostream & os, int) const { if (getOptions().empty()) os << "[" << getContents() << "]"; @@ -65,7 +65,7 @@ int InsetUrl::Ascii(Buffer const *, ostream & os, int) const } -int InsetUrl::Linuxdoc(Buffer const *, ostream & os) const +int InsetUrl::linuxdoc(Buffer const *, ostream & os) const { os << "<" << getCmdName() << " url=\"" << getContents() << "\"" @@ -83,7 +83,7 @@ int InsetUrl::DocBook(Buffer const *, ostream & os) const } -void InsetUrl::Validate(LaTeXFeatures & features) const +void InsetUrl::validate(LaTeXFeatures & features) const { features.url = true; } diff --git a/src/insets/inseturl.h b/src/insets/inseturl.h index 5d3f07f592..a93367b5dc 100644 --- a/src/insets/inseturl.h +++ b/src/insets/inseturl.h @@ -31,24 +31,24 @@ public: return new InsetUrl(params()); } /// - Inset::Code LyxCode() const { return Inset::URL_CODE; } + Inset::Code lyxCode() const { return Inset::URL_CODE; } /// - void Validate(LaTeXFeatures &) const; + void validate(LaTeXFeatures &) const; /// string const getScreenLabel() const; /// - EDITABLE Editable() const { return IS_EDITABLE; } + EDITABLE editable() const { return IS_EDITABLE; } /// - void Edit(BufferView *, int, int, unsigned int); + void edit(BufferView *, int, int, unsigned int); /// bool display() const { return false; } /// - int Latex(Buffer const *, std::ostream &, + int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &, int linelen) const; + int ascii(Buffer const *, std::ostream &, int linelen) const; /// - int Linuxdoc(Buffer const *, std::ostream &) const; + int linuxdoc(Buffer const *, std::ostream &) const; /// int DocBook(Buffer const *, std::ostream &) const; }; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index f123166106..311ad0edbd 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -656,7 +656,14 @@ string const LyXFunc::Dispatch(int ac, if (!do_not_use_this_arg.empty()) argument = do_not_use_this_arg; // except here } - + +#ifdef NEW_DISPATCHER + // We try do call the most specific dispatcher first: + // 1. the lockinginset's dispatch + // 2. the bufferview's dispatch + // 3. the lyxview's dispatch +#endif + selection_possible = false; if (owner->view()->available()) @@ -1250,19 +1257,26 @@ string const LyXFunc::Dispatch(int ac, case LFUN_GOTOFILEROW: { +#if 0 char file_name[100]; int row; ::sscanf(argument.c_str(), " %s %d", file_name, &row); - +#else + string file_name; + int row; + istringstream istr(argument); + istr >> filename >> row; +#endif // Must replace extension of the file to be .lyx and get full path - string s = ChangeExtension(string(file_name), ".lyx"); + string const s(ChangeExtension(file_name, ".lyx")); // Either change buffer or load the file - if (bufferlist.exists(s)) + if (bufferlist.exists(s)) { owner->view()->buffer(bufferlist.getBuffer(s)); - else + } else { owner->view()->buffer(bufferlist.loadLyXFile(s)); - + } + // Set the cursor owner->view()->setCursorFromRow(row); @@ -1273,13 +1287,16 @@ string const LyXFunc::Dispatch(int ac, case LFUN_GOTO_PARAGRAPH: { - istringstream istr(argument.c_str()); + istringstream istr(argument); int id; istr >> id; Paragraph * par = TEXT()->getParFromID(id); - if (par == 0) + if (par == 0) { + lyxerr[Debug::INFO] << "No matching paragraph found! [" + << id << "]" << std::endl; break; + } // Set the cursor TEXT()->setCursor(owner->view(), par, 0); diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 08c49402b6..ae6c3f1c92 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -549,8 +549,11 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, case LFUN_SETXY: { lyxerr << "LFUN_SETXY broken!\n"; - int x, y, x1, y1; - istringstream is(arg.c_str()); + int x; + int y; + int x1; + int y1; + istringstream is(arg); is >> x >> y; lyxerr << "LFUN_SETXY: x: " << x << " y: " << y << "\n"; par_->GetXY(x1, y1); @@ -662,8 +665,9 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, bv->lockedInsetStoreUndo(Undo::INSERT); int m = 1; int n = 1; - string v_align, h_align; - istringstream is(arg.c_str()); + string v_align; + string h_align; + istringstream is(arg); is >> m >> n >> v_align >> h_align; MathArrayInset * p = new MathArrayInset(m, n); p->valign(v_align[0]); @@ -684,8 +688,9 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, if (arg.empty()) break; - istringstream is(arg.c_str()); - string lt, rt; + istringstream is(arg); + string lt; + string rt; is >> lt >> rt; lyxerr << "formulabase::LFUN_MATH_DELIM, lt: '" << lt << "'\n"; lyxerr << "formulabase::LFUN_MATH_DELIM, rt: '" << rt << "'\n"; -- 2.39.2