fix drawing of hfill characters, some small cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3029 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-11-15 00:39:11 +00:00
parent 48fa20dfe9
commit cb86c2c1d0
3 changed files with 98 additions and 90 deletions

View File

@ -1,24 +1,21 @@
src/buffer.C
src/bufferlist.C
src/BufferView2.C
src/bufferview_funcs.C
src/BufferView_pimpl.C
src/Chktex.C
src/ColorHandler.C
src/CutAndPaste.C
src/FontLoader.C
src/LColor.C
src/LaTeX.C
src/LyXAction.C
src/LyXSendto.C
src/LyXView.C
src/MenuBackend.C
src/buffer.C
src/bufferlist.C
src/bufferview_funcs.C
src/converter.C
src/CutAndPaste.C
src/debug.C
src/exporter.C
src/figureForm.C
src/ext_l10n.h
src/figure_form.C
src/figureForm.C
src/FontLoader.C
src/frontends/controllers/biblio.C
src/frontends/controllers/ButtonController.h
src/frontends/controllers/character.C
src/frontends/controllers/ControlAboutlyx.C
src/frontends/controllers/ControlBibtex.C
src/frontends/controllers/ControlCharacter.C
@ -32,8 +29,6 @@ src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/ControlTexinfo.C
src/frontends/controllers/ControlThesaurus.C
src/frontends/controllers/ControlVCLog.C
src/frontends/controllers/biblio.C
src/frontends/controllers/character.C
src/frontends/controllers/helper_funcs.C
src/frontends/gnome/FormCitation.C
src/frontends/gnome/FormIndex.C
@ -42,6 +37,7 @@ src/frontends/gnome/FormRef.C
src/frontends/gnome/FormToc.C
src/frontends/gnome/Menubar_pimpl.C
src/frontends/qt2/FileDialog.C
src/frontends/qt2/lengthcombo.C
src/frontends/qt2/QAbout.C
src/frontends/qt2/QBibitem.C
src/frontends/qt2/QBibtex.C
@ -50,8 +46,8 @@ src/frontends/qt2/QCharacter.C
src/frontends/qt2/QCitation.C
src/frontends/qt2/QCitationDialog.C
src/frontends/qt2/QDocument.C
src/frontends/qt2/QERT.C
src/frontends/qt2/QError.C
src/frontends/qt2/QERT.C
src/frontends/qt2/QExternal.C
src/frontends/qt2/QExternalDialog.C
src/frontends/qt2/QGraphics.C
@ -73,87 +69,86 @@ src/frontends/qt2/QThesaurus.C
src/frontends/qt2/QToc.C
src/frontends/qt2/QURL.C
src/frontends/qt2/QVCLog.C
src/frontends/qt2/lengthcombo.C
src/frontends/xforms/combox.C
src/frontends/xforms/FileDialog.C
src/frontends/xforms/form_aboutlyx.C
src/frontends/xforms/FormAboutlyx.C
src/frontends/xforms/form_bibitem.C
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/form_bibtex.C
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/form_browser.C
src/frontends/xforms/form_character.C
src/frontends/xforms/FormCharacter.C
src/frontends/xforms/form_citation.C
src/frontends/xforms/FormCitation.C
src/frontends/xforms/form_document.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormERT.C
src/frontends/xforms/form_error.C
src/frontends/xforms/FormError.C
src/frontends/xforms/form_ert.C
src/frontends/xforms/FormERT.C
src/frontends/xforms/form_external.C
src/frontends/xforms/FormExternal.C
src/frontends/xforms/form_filedialog.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/form_float.C
src/frontends/xforms/FormFloat.C
src/frontends/xforms/form_graphics.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/form_include.C
src/frontends/xforms/FormInclude.C
src/frontends/xforms/form_index.C
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormLog.C
src/frontends/xforms/FormMathsBitmap.C
src/frontends/xforms/form_maths_deco.C
src/frontends/xforms/FormMathsDeco.C
src/frontends/xforms/form_maths_delim.C
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/form_maths_matrix.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/form_maths_panel.C
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/form_maths_space.C
src/frontends/xforms/FormMathsSpace.C
src/frontends/xforms/form_minipage.C
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/form_paragraph.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/form_preamble.C
src/frontends/xforms/FormPreamble.C
src/frontends/xforms/form_preferences.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/form_print.C
src/frontends/xforms/FormPrint.C
src/frontends/xforms/form_ref.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/form_search.C
src/frontends/xforms/FormSearch.C
src/frontends/xforms/form_spellchecker.C
src/frontends/xforms/FormSpellchecker.C
src/frontends/xforms/form_tabular.C
src/frontends/xforms/FormTabular.C
src/frontends/xforms/form_tabular_create.C
src/frontends/xforms/FormTabularCreate.C
src/frontends/xforms/form_texinfo.C
src/frontends/xforms/FormTexinfo.C
src/frontends/xforms/form_thesaurus.C
src/frontends/xforms/FormThesaurus.C
src/frontends/xforms/form_toc.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/form_url.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormVCLog.C
src/frontends/xforms/Menubar_pimpl.C
src/frontends/xforms/combox.C
src/frontends/xforms/form_aboutlyx.C
src/frontends/xforms/form_bibitem.C
src/frontends/xforms/form_bibtex.C
src/frontends/xforms/form_browser.C
src/frontends/xforms/form_character.C
src/frontends/xforms/form_citation.C
src/frontends/xforms/form_document.C
src/frontends/xforms/form_error.C
src/frontends/xforms/form_ert.C
src/frontends/xforms/form_external.C
src/frontends/xforms/form_filedialog.C
src/frontends/xforms/form_float.C
src/frontends/xforms/form_graphics.C
src/frontends/xforms/form_include.C
src/frontends/xforms/form_index.C
src/frontends/xforms/form_maths_deco.C
src/frontends/xforms/form_maths_delim.C
src/frontends/xforms/form_maths_matrix.C
src/frontends/xforms/form_maths_panel.C
src/frontends/xforms/form_maths_space.C
src/frontends/xforms/form_minipage.C
src/frontends/xforms/form_paragraph.C
src/frontends/xforms/form_preamble.C
src/frontends/xforms/form_preferences.C
src/frontends/xforms/form_print.C
src/frontends/xforms/form_ref.C
src/frontends/xforms/form_search.C
src/frontends/xforms/form_spellchecker.C
src/frontends/xforms/form_tabular.C
src/frontends/xforms/form_tabular_create.C
src/frontends/xforms/form_texinfo.C
src/frontends/xforms/form_thesaurus.C
src/frontends/xforms/form_toc.C
src/frontends/xforms/form_url.C
src/frontends/xforms/input_validators.C
src/frontends/xforms/Menubar_pimpl.C
src/frontends/xforms/xforms_helpers.C
src/gettext.h
src/importer.C
src/insets/figinset.C
src/insets/inset.C
src/insets/insetbib.C
src/insets/inset.C
src/insets/insetcaption.C
src/insets/inseterror.C
src/insets/insetert.C
@ -178,19 +173,25 @@ src/insets/insettoc.C
src/insets/inseturl.C
src/kbsequence.C
src/language.C
src/LaTeX.C
src/layout.C
src/LColor.C
src/LyXAction.C
src/lyx_cb.C
src/lyx_gui_misc.C
src/lyx_main.C
src/lyxfind.C
src/lyxfont.C
src/lyxfunc.C
src/lyx_gui_misc.C
src/lyx_main.C
src/lyxrc.C
src/LyXSendto.C
src/lyxvc.C
src/mathed/formula.C
src/LyXView.C
src/mathed/formulabase.C
src/mathed/formula.C
src/mathed/formulamacro.C
src/mathed/math_cursor.C
src/MenuBackend.C
src/minibuffer.C
src/paragraph.C
src/print_form.C
@ -199,6 +200,6 @@ src/support/getUserName.C
src/support/path.C
src/support/path.h
src/tabular.C
src/text.C
src/text2.C
src/text.C
src/ext_l10n.h

View File

@ -1,3 +1,12 @@
2001-11-15 Lars Gullik Bjønnes <larsbj@birdstep.com>
* text.C: change the order of the includes.
(workWidth): initialize it at once.
(workWidth): make maxw unsigned
(setHeightOfRow): remove unused variable (inset)
(selectSelectedWord): remove unused variable (inset)
(paintRowText): fix drawing of hfill characters, and clean up a bit.
2001-11-14 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lyxserver.C (emergencyCleanup): do not try to close pipes if

View File

@ -9,18 +9,10 @@
* ====================================================== */
#include <config.h>
//#include <cstdlib> //these two do not seem useful anymore (JMarc)
//#include <cctype>
#include <algorithm>
#include "lyxtext.h"
#include "layout.h"
#include "paragraph.h"
#include "support/textutils.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
#include "insets/insetbib.h"
#include "insets/insettext.h"
#include "lyx_gui_misc.h"
#include "gettext.h"
#include "bufferparams.h"
@ -40,6 +32,15 @@
#include "undo_funcs.h"
#include "font.h"
#include "insets/insetbib.h"
#include "insets/insettext.h"
#include "support/textutils.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
#include <algorithm>
using std::max;
using std::min;
using std::endl;
@ -65,14 +66,12 @@ int LyXText::workWidth(BufferView * bview) const
int LyXText::workWidth(BufferView * bview, Inset * inset) const
{
Buffer::inset_iterator it;
Paragraph * par = 0;
Paragraph::size_type pos = 0;
for(it=bview->buffer()->inset_iterator_begin();
it != bview->buffer()->inset_iterator_end();
++it)
{
Buffer::inset_iterator it = bview->buffer()->inset_iterator_begin();
for (; it != bview->buffer()->inset_iterator_end(); ++it) {
if (*it == inset) {
par = it.getPar();
pos = it.getPos();
@ -101,7 +100,7 @@ int LyXText::workWidth(BufferView * bview, Inset * inset) const
Row * frow = row;
while(frow->previous() && frow->par() == frow->previous()->par())
frow = frow->previous();
int maxw = 0;
unsigned int maxw = 0;
while(frow->next() && frow->par() == frow->next()->par()) {
if ((frow != row) && (maxw < frow->width()))
maxw = frow->width();
@ -511,7 +510,7 @@ void LyXText::draw(BufferView * bview, Row const * row,
return;
}
/* usual characters, no insets */
// usual characters, no insets
// Collect character that we can draw in one command
@ -1125,7 +1124,7 @@ int LyXText::numberOfHfills(Buffer const * buf, Row const * row) const
first = max(first, beginningOfMainBody(buf, row->par()));
int n = 0;
for (Paragraph::size_type p = first; p <= last; ++p) {
// last, because the end is ignored!
// last, because the end is ignored!
if (row->par()->isHfill(p)) {
++n;
}
@ -1204,7 +1203,7 @@ LColor::color LyXText::backgroundColor()
void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
{
/* get the maximum ascent and the maximum descent */
/* get the maximum ascent and the maximum descent */
int asc = 0;
int desc = 0;
float layoutasc = 0;
@ -2362,8 +2361,6 @@ string const LyXText::selectNextWordToSpellcheck(BufferView * bview,
// Start the selection from here
selection.cursor = cursor;
Inset * inset;
// and find the end of the word (insets like optional hyphens
// and ligature break are part of a word)
while (cursor.pos() < cursor.par()->size()
@ -2395,7 +2392,6 @@ void LyXText::selectSelectedWord(BufferView * bview)
// set the sel cursor
selection.cursor = cursor;
Inset * inset;
// now find the end of the word
while (cursor.pos() < cursor.par()->size()
@ -2597,15 +2593,16 @@ void LyXText::Delete(BufferView * bview)
//work better?
if ((cursor.par()->previous() ? cursor.par()->previous()->id() : 0)
== old_cur_par_prev_id
&& cursor.par()->id() != old_cur_par_id)
{
return; // delete-empty-paragraph-mechanism has done it
&& cursor.par()->id() != old_cur_par_id) {
// delete-empty-paragraph-mechanism has done it
return;
}
// if you had success make a backspace
if (old_cursor.par() != cursor.par() || old_cursor.pos() != cursor.pos()) {
LyXCursor tmpcursor = cursor;
cursor = old_cursor; // to make sure undo gets the right cursor position
// to make sure undo gets the right cursor position
cursor = old_cursor;
setUndo(bview, Undo::DELETE,
cursor.par(), cursor.par()->next());
cursor = tmpcursor;
@ -3488,14 +3485,15 @@ void LyXText::paintRowText(DrawRowParams & p)
if (par->isHfill(pos)) {
p.x += 1;
int const y1 = p.yo + p.row->baseline() - defaultHeight() / 2;
p.pain->line(int(p.x), y1, int(p.x), p.yo + p.row->baseline(),
LColor::vfillline);
int const y0 = p.yo + p.row->baseline();
int const y1 = y0 - defaultHeight() / 2;
p.pain->line(int(p.x), y1, int(p.x), y0,
LColor::vfillline);
int const y2 = y1 / 2;
if (hfillExpansion(buffer, p.row, pos)) {
int const y2 = (y0 + y1) / 2;
if (pos >= main_body) {
p.pain->line(int(p.x), y2,
int(p.x + p.hfill), y2,
@ -3510,8 +3508,8 @@ void LyXText::paintRowText(DrawRowParams & p)
p.x += p.label_hfill;
}
p.pain->line(int(p.x), y1,
int(p.x), p.yo + p.row->baseline(),
LColor::vfillline);
int(p.x), y0,
LColor::vfillline);
}
p.x += 2;
++vpos;