Pavel Sanda <[EMAIL PROTECTED]> writes:

| > Looks good. A few comments below.
| 
| updated patch attached.

I have not looked at parent, but wonder a bit about the use case
anyway. But...

| diff --git a/src/frontends/qt4/GuiToolbar.cpp 
b/src/frontends/qt4/GuiToolbar.cpp
| index 9b727be..5889509 100644
| --- a/src/frontends/qt4/GuiToolbar.cpp
| +++ b/src/frontends/qt4/GuiToolbar.cpp
| @@ -271,6 +272,28 @@ void GuiLayoutBox::set(docstring const & layout)
|  }
|  
|  
| +void GuiLayoutBox::addItemSort(QString const & item, bool sorted)
| +{
| +     int end = count();
| +     int i = 1;      //Let the default one be at the beginning

No EOL comments please. Put comment before the line instead. And put a
space after "//" for non-code comments.

| +
| +     if (!sorted || end<2 || !(item[0].category() == 
QChar::Letter_Uppercase)) {

'!=' does not work?

| +             addItem(item);
| +             return;
| +     }
| +
| +     for (setCurrentIndex(i); currentText() < item; ) {
| +             if (! (currentText()[0].category() == QChar::Letter_Uppercase))
| +                     break;  //e.g. --Separator--

Double ditto. (comment and '!=')

| +             if (++i == end)
| +                     break;
| +             setCurrentIndex(i);
| +     }
| +
| +     insertItem(i, item);
| +}
| +
| +
|  void GuiLayoutBox::updateContents()
|  {
|       TextClass const & tc = textClass(owner_);
| @@ -282,9 +305,12 @@ void GuiLayoutBox::updateContents()
|       TextClass::const_iterator const end = tc.end();
|       for (; it != end; ++it) {
|               // ignore obsolete entries
| -             addItem(toqstr(translateIfPossible((*it)->name())));
| +             addItemSort(toqstr(translateIfPossible((*it)->name())), 
lyxrc.sort_layouts);
|       }
|  
| +     //set default
| +     setCurrentIndex(0);
| +

Space after '//', but the comment in-itself looks strange? Do we have
misnamed function? setDefaultIndex? then we could ditch comment as
well.

| diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
| index 703fb2c..edf9c3f 100644
| --- a/src/frontends/qt4/GuiView.cpp
| +++ b/src/frontends/qt4/GuiView.cpp
| @@ -896,7 +896,7 @@ void GuiViewBase::updateLayoutChoice()
|       }
|  
|       // Update the layout display
| -     if 
(d.toolbars_->updateLayoutList(buffer()->params().getTextClassPtr())) {
| +     if 
(d.toolbars_->updateLayoutList(buffer()->params().getTextClassPtr(),force)) {

Remember space after comma.

-- 
        Lgb

Reply via email to