~ubuntu-branches/ubuntu/wily/scribus/wily-proposed

« back to all changes in this revision

Viewing changes to scribus/observable.h

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-09 21:50:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120209215056-2wrx1ara0jbm7fi5
Tags: 1.4.0.dfsg+r17287-1
* New upstream stable release upload into Debian (Closes: #654703).
* Applied the Ubuntu armel patch.
* Removed non-free color swatches from resources.
* debian/control:
  - Moved icc-profiles from Recommends to Suggests (Closes: #655885).
  - Updated Standards-Version to 3.9.2.
  - Updated extended description per lintian warning.
* debian/rules:
  - Update mailcap (Closes: #630751). A request for mime.types update has
    been sent to the mime-support maintainer.
  - Added build-arch and build-indep targets per lintian warning.
* debian/patches:
  - top_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't install the non-free "doc" dir.
  - profiles_cmakelists.patch - don't install non-free sRGB profile.
* debian/copyright: 
  - Converted to the DEP5 machine readable foramt.
  - Added licenses for free color swatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
template<class OBSERVED>
72
72
struct Private_Memento : public UpdateMemento
73
73
{
74
 
        Private_Memento(OBSERVED data) : m_data(data) {};
 
74
        Private_Memento(OBSERVED data) : m_data(data), m_layout(false) {};
 
75
        Private_Memento(OBSERVED data, bool layout) : m_data(data), m_layout(layout) {};
75
76
        
76
77
        OBSERVED m_data;
 
78
        bool     m_layout;
77
79
};
78
80
 
79
81
 
84
86
template<class OBSERVED>
85
87
class SCRIBUS_API Observer {
86
88
public:
87
 
        virtual void changed(OBSERVED) = 0;
 
89
        virtual void changed(OBSERVED, bool doLayout) = 0;
88
90
        virtual ~Observer() {}
89
91
};
90
92
 
124
126
            will take care of that.
125
127
         */
126
128
        virtual void update(OBSERVED what);
 
129
 
 
130
        /**
 
131
                Same as update, except layout will be update immediately
 
132
         */
 
133
        virtual void updateLayout(OBSERVED what);
127
134
        
128
135
        void connectObserver(Observer<OBSERVED>* o);
129
136
        void disconnectObserver(Observer<OBSERVED>* o);
170
177
        { 
171
178
                m_massObservable->update(dynamic_cast<OBSERVED*>(this)); 
172
179
        }
 
180
 
 
181
        virtual void updateLayout() 
 
182
        { 
 
183
                m_massObservable->updateLayout(dynamic_cast<OBSERVED*>(this)); 
 
184
        }
173
185
        
174
186
private:
175
187
        MassObservable<OBSERVED*>* m_massObservable;
239
251
        }
240
252
}
241
253
 
 
254
template<class OBSERVED>
 
255
inline void MassObservable<OBSERVED>::updateLayout(OBSERVED what)
 
256
{
 
257
        Private_Memento<OBSERVED>* memento = new Private_Memento<OBSERVED>(what, true);
 
258
        if (m_um == NULL || m_um->requestUpdate(this, memento))
 
259
        {
 
260
                updateNow(memento);
 
261
        }
 
262
}
242
263
 
243
264
template<class OBSERVED>
244
265
inline void MassObservable<OBSERVED>::updateNow(UpdateMemento* what)
246
267
        Private_Memento<OBSERVED>* memento = dynamic_cast<Private_Memento<OBSERVED>*>(what);
247
268
        foreach (Observer<OBSERVED>* obs, m_observers)
248
269
        {
249
 
                obs->changed(memento->m_data);
 
270
                obs->changed(memento->m_data, memento->m_layout);
250
271
        }
251
272
        changedSignal->emitSignal(QVariant::fromValue(memento->m_data));
252
273
        delete memento;