r16809 by jghali - #10152 related : correctly select style of current paragraph when clicking story editor sidebar
scribus-commit
scribus-commit at lists.scribus.net
Sat Aug 27 21:51:18 UTC 2011
Author: jghali
Date: Sat Aug 27 21:51:18 2011
New Revision: 16809
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16809
Log:
#10152 related : correctly select style of current paragraph when clicking story editor sidebar
Modified:
trunk/Scribus/scribus/ui/storyeditor.cpp
Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16809&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Sat Aug 27 21:51:18 2011
@@ -126,26 +126,24 @@
QPoint viewPos = editor->viewport()->mapFromGlobal(globalPos);
int p = editor->cursorForPosition(QPoint(2, viewPos.y())).position();
CurrentPar = editor->StyledText.nrOfParagraph(p);
- int pos = editor->StyledText.startOfParagraph(p);
-
+ int pos = editor->StyledText.startOfParagraph( editor->StyledText.nrOfParagraph(p) );
+
+ QString styleName = "";
ParaStyleComboBox* paraStyleCombo = new ParaStyleComboBox(this);
paraStyleCombo->setDoc(editor->doc);
if ((CurrentPar < static_cast<int>(editor->StyledText.nrOfParagraphs())) && (editor->StyledText.length() != 0))
{
int len = editor->StyledText.endOfParagraph(CurrentPar) - editor->StyledText.startOfParagraph(CurrentPar);
if (len > 0)
- paraStyleCombo->setFormat(editor->StyledText.paragraphStyle(pos).displayName());
- else
- paraStyleCombo->setFormat("");
- }
- else
- paraStyleCombo->setFormat("");
+ styleName = editor->StyledText.paragraphStyle(pos).parent(); //FIXME ParaStyleComboBox and use localized style name
+ }
+ paraStyleCombo->setFormat(styleName);
connect(paraStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setPStyle(const QString&)));
pmen->clear();
paraStyleAct = new QWidgetAction(this);
paraStyleAct->setDefaultWidget(paraStyleCombo);
pmen->addAction(paraStyleAct);
-// pmen->addAction( tr("Edit Styles..."), this, SLOT(editStyles()));
+ //pmen->addAction( tr("Edit Styles..."), this, SLOT(editStyles()));
pmen->exec(QCursor::pos());
}
@@ -2470,7 +2468,7 @@
}
int parStart = Editor->StyledText.startOfParagraph(p);
const ParagraphStyle& parStyle(Editor->StyledText.paragraphStyle(parStart));
- Editor->currentParaStyle = parStyle.parent();
+ Editor->currentParaStyle = parStyle.parent(); //FIXME ParaStyleComboBox and use localized style name
if (Editor->StyledText.endOfParagraph(p) <= parStart)
{
Editor->prevFont = Editor->CurrFont;
More information about the scribus-commit
mailing list