Use enum instead of int in TextMetrics::getAlign

This is just a code cleanup, no (intented) effect.
This commit is contained in:
Jean-Marc Lasgouttes 2014-07-29 11:05:14 +02:00
parent f29e78039d
commit 37fd7b24ba
2 changed files with 10 additions and 3 deletions

View File

@ -506,11 +506,11 @@ bool TextMetrics::redoParagraph(pit_type const pit)
} }
int TextMetrics::getAlign(Paragraph const & par, pos_type const pos) const LyXAlignment TextMetrics::getAlign(Paragraph const & par, pos_type const pos) const
{ {
Layout const & layout = par.layout(); Layout const & layout = par.layout();
int align; LyXAlignment align;
if (par.params().align() == LYX_ALIGN_LAYOUT) if (par.params().align() == LYX_ALIGN_LAYOUT)
align = layout.align; align = layout.align;
else else
@ -630,6 +630,12 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
row.dimension().wid = width - int(w / 2); row.dimension().wid = width - int(w / 2);
row.x += w / 2; row.x += w / 2;
break; break;
case LYX_ALIGN_LEFT:
case LYX_ALIGN_NONE:
case LYX_ALIGN_LAYOUT:
case LYX_ALIGN_SPECIAL:
case LYX_ALIGN_DECIMAL:
break;
} }
} }

View File

@ -16,6 +16,7 @@
#include "Font.h" #include "Font.h"
#include "InsetList.h" #include "InsetList.h"
#include "LayoutEnums.h"
#include "ParagraphMetrics.h" #include "ParagraphMetrics.h"
#include "support/types.h" #include "support/types.h"
@ -136,7 +137,7 @@ private:
void breakRow(Row & row, int right_margin, pit_type const pit) const; void breakRow(Row & row, int right_margin, pit_type const pit) const;
// Expand the alignment of paragraph \param par at position \param pos // Expand the alignment of paragraph \param par at position \param pos
int getAlign(Paragraph const & par, pos_type pos) const; LyXAlignment getAlign(Paragraph const & par, pos_type pos) const;
/** this calculates the specified parameters. needed when setting /** this calculates the specified parameters. needed when setting
* the cursor and when creating a visible row */ * the cursor and when creating a visible row */
void computeRowMetrics(pit_type pit, Row & row, int width) const; void computeRowMetrics(pit_type pit, Row & row, int width) const;