Am 09.03.2012 um 01:31 schrieb Jerry:
> 
> On Mar 7, 2012, at 3:53 AM, Tommaso Cucinotta wrote:

...

> 
> Another problem with the colored buttons. A black dot in the red button 
> indicates that a document has been edited but not saved to disk. Here are the 
> two versions for a focused and unfocused window:
> 
> <PastedGraphic-14.pdf><PastedGraphic-15.pdf>
> 
> and after saving:
> 
> <PastedGraphic-16.pdf><PastedGraphic-17.pdf>
> 
> LyX does not do this--the main document button are always
> 
> <PastedGraphic-20.pdf>

Attached is a patch to solve that problem.

Stephan

Index: src/frontends/qt4/GuiView.cpp
===================================================================
--- src/frontends/qt4/GuiView.cpp       (Revision 40904)
+++ src/frontends/qt4/GuiView.cpp       (Arbeitskopie)
@@ -303,17 +303,17 @@
                bg_widget_->setFocus();
        }
 
-       int tabWorkAreaCount()
+       int tabWorkAreaCount() const
        {
                return splitter_->count();
        }
 
-       TabWorkArea * tabWorkArea(int i)
+       TabWorkArea * tabWorkArea(int i) const
        {
                return dynamic_cast<TabWorkArea *>(splitter_->widget(i));
        }
 
-       TabWorkArea * currentTabWorkArea()
+       TabWorkArea * currentTabWorkArea() const
        {
                int areas = tabWorkAreaCount();
                if (areas == 1)
@@ -342,6 +342,16 @@
        }
 #endif
 
+       bool isClean() const
+       {
+               QVector<GuiWorkArea*> areas = guiWorkAreas();
+               bool result = true;
+               for (int i = 0; i < areas.size(); ++i) {
+                       result &= areas[i]->bufferView().buffer().isClean();
+               }
+               return result;
+       }
+       
 public:
        GuiView * gv_;
        GuiWorkArea * current_work_area_;
@@ -408,7 +418,7 @@
                                   Buffer::ExportStatus 
(Buffer::*syncFunc)(string const &, bool) const,
                                   Buffer::ExportStatus 
(Buffer::*previewFunc)(string const &) const);
 
-       QVector<GuiWorkArea*> guiWorkAreas();
+       QVector<GuiWorkArea*> guiWorkAreas() const;
 };
 
 QSet<Buffer const *> GuiView::GuiViewPrivate::busyBuffers;
@@ -523,7 +533,7 @@
 }
 
 
-QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas()
+QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas() const
 {
        QVector<GuiWorkArea*> areas;
        for (int i = 0; i < tabWorkAreaCount(); i++) {
@@ -1017,6 +1037,7 @@
                return;
        setWindowTitle(qt_("LyX: ") + wa->windowTitle());
        setWindowIconText(wa->windowIconText());
+       setWindowModified(!d.isClean());
 }
 
 

Reply via email to