summaryrefslogtreecommitdiffstats
path: root/kolourpaint/kpviewmanager.cpp
blob: 71b58a2c59f1f96e8b6492ef10eca9b3132b3403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766

/*
   Copyright (c) 2003,2004,2005 Clarence Dang <dang@kde.org>
   All rights reserved.

   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:

   1. Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
   2. Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.

   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


#define DEBUG_KP_VIEW_MANAGER 0


#include <kpviewmanager.h>

#include <tqapplication.h>
#include <tqtimer.h>

#include <kdebug.h>

#include <kpdefs.h>
#include <kpdocument.h>
#include <kpmainwindow.h>
#include <kpselection.h>
#include <kptemppixmap.h>
#include <kptool.h>
#include <kpview.h>


kpViewManager::kpViewManager (kpMainWindow *mainWindow)
    : m_textCursorBlinkTimer (0),
      m_textCursorRow (-1),
      m_textCursorCol (-1),
      m_textCursorBlinkState (true),
      m_mainWindow (mainWindow),
      m_tempPixmap (0),
      m_viewUnderCursor (0),
      m_selectionBorderVisible (false),
      m_selectionBorderFinished (false)
{
    m_queueUpdatesCounter = m_fastUpdatesCounter = 0;
}

// private
kpDocument *kpViewManager::document () const
{
    return m_mainWindow ? m_mainWindow->document () : 0;
}

kpViewManager::~kpViewManager ()
{
    unregisterAllViews ();

    delete m_tempPixmap; m_tempPixmap = 0;
}


void kpViewManager::registerView (kpView *view)
{
#if DEBUG_KP_VIEW_MANAGER && 1
    kdDebug () << "kpViewManager::registerView (" << view << ")" << endl;
#endif
    if (view && m_views.findRef (view) < 0)
    {
    #if DEBUG_KP_VIEW_MANAGER && 1
        kdDebug () << "\tadded view" << endl;
    #endif
        view->setCursor (m_cursor);
        m_views.append (view);
    }
    else
    {
    #if DEBUG_KP_VIEW_MANAGER && 1
        kdDebug () << "\tignored register view attempt" << endl;
    #endif
    }
}

void kpViewManager::unregisterView (kpView *view)
{
    if (view)
    {
        if (view == m_viewUnderCursor)
            m_viewUnderCursor = 0;

        view->unsetCursor ();
        m_views.removeRef (view);
    }
}

void kpViewManager::unregisterAllViews ()
{
    // no autoDelete
    m_views.clear ();
}


// public
const kpTempPixmap *kpViewManager::tempPixmap () const
{
    return m_tempPixmap;
}

// public
void kpViewManager::setTempPixmap (const kpTempPixmap &tempPixmap)
{
#if DEBUG_KP_VIEW_MANAGER
    kdDebug () << "kpViewManager::setTempPixmap(isBrush="
               << tempPixmap.isBrush ()
               << ",topLeft=" << tempPixmap.topLeft ()
               << ",pixmap.rect=" << tempPixmap.pixmap ().rect ()
               << ")" << endl;
#endif

    TQRect oldRect;

    if (m_tempPixmap)
    {
        oldRect = m_tempPixmap->rect ();
        delete m_tempPixmap;
        m_tempPixmap = 0;
    }

    m_tempPixmap = new kpTempPixmap (tempPixmap);


    setQueueUpdates ();

    if (oldRect.isValid ())
        updateViews (oldRect);
    updateViews (m_tempPixmap->rect ());

    restoreQueueUpdates ();
}

// public
void kpViewManager::invalidateTempPixmap ()
{
    if (!m_tempPixmap)
        return;

    TQRect oldRect = m_tempPixmap->rect ();

    delete m_tempPixmap;
    m_tempPixmap = 0;

    updateViews (oldRect);
}


// public
bool kpViewManager::selectionBorderVisible () const
{
    return m_selectionBorderVisible;
}

// public
void kpViewManager::setSelectionBorderVisible (bool yes)
{
    if (m_selectionBorderVisible == yes)
        return;

    m_selectionBorderVisible = yes;

    if (document () && document ()->selection ())
        updateViews (document ()->selection ()->boundingRect ());
}


// public
bool kpViewManager::selectionBorderFinished () const
{
    return m_selectionBorderFinished;
}

// public
void kpViewManager::setSelectionBorderFinished (bool yes)
{
    if (m_selectionBorderFinished == yes)
        return;

    m_selectionBorderFinished = yes;

    if (document () && document ()->selection ())
        updateViews (document ()->selection ()->boundingRect ());
}


bool kpViewManager::textCursorEnabled () const
{
    return (bool) m_textCursorBlinkTimer;
}

void kpViewManager::setTextCursorEnabled (bool yes)
{
#if DEBUG_KP_VIEW_MANAGER && 1
    kdDebug () << "kpViewManager::setTextCursorEnabled(" << yes << ")" << endl;
#endif

    if (yes == textCursorEnabled ())
        return;

    delete m_textCursorBlinkTimer;
    m_textCursorBlinkTimer = 0;

    setFastUpdates ();
    setQueueUpdates ();

    m_textCursorBlinkState = true;

    if (yes)
    {
        m_textCursorBlinkTimer = new TQTimer (this);
        connect (m_textCursorBlinkTimer, TQT_SIGNAL (timeout ()),
                 this, TQT_SLOT (slotTextCursorBlink ()));
        slotTextCursorBlink ();
    }
    // TODO: What if !yes - shouldn't it clear the cursor?

    restoreQueueUpdates ();
    restoreFastUpdates ();
}


int kpViewManager::textCursorRow () const
{
    bool handledErrors = false;
    if (m_mainWindow)
    {
        kpDocument *doc = m_mainWindow->document ();
        if (doc)
        {
            kpSelection *sel = doc->selection ();
            if (sel && sel->isText ())
            {
                if (m_textCursorRow >= (int) sel->textLines ().size ())
                {
                #if DEBUG_KP_VIEW_MANAGER && 1
                    kdDebug () << "kpViewManager::textCursorRow() row="
                               << m_textCursorRow
                               << endl;
                #endif
                    (const_cast <kpViewManager *> (this))->m_textCursorRow =
                        sel->textLines ().size () - 1;
                }

                handledErrors = true;
            }
        }
    }

    if (!handledErrors)
    {
    #if DEBUG_KP_VIEW_MANAGER && 1
        kdDebug () << "kpViewManager::textCursorRow() no mw, doc or text sel" << endl;
    #endif
        (const_cast <kpViewManager *> (this))->m_textCursorRow = -1;
    }

    return m_textCursorRow;
}

int kpViewManager::textCursorCol () const
{
    int row = textCursorRow ();
    if (row < 0)
        return -1;

    bool handledErrors = false;
    if (m_mainWindow)
    {
        kpDocument *doc = m_mainWindow->document ();
        if (doc)
        {
            kpSelection *sel = doc->selection ();
            if (sel && sel->isText ())
            {
                if (m_textCursorCol > (int) sel->textLines () [row].length ())
                {
                #if DEBUG_KP_VIEW_MANAGER && 1
                    kdDebug () << "kpViewManager::textCursorRow() col="
                               << m_textCursorCol
                               << endl;
                #endif
                    (const_cast <kpViewManager *> (this))->m_textCursorCol =
                        sel->textLines () [row].length ();
                }

                handledErrors = true;
            }
        }
    }

    if (!handledErrors)
    {
    #if DEBUG_KP_VIEW_MANAGER && 1
        kdDebug () << "kpViewManager::textCursorCol() no mw, doc or text sel" << endl;
    #endif
        (const_cast <kpViewManager *> (this))->m_textCursorCol = -1;
    }

    return m_textCursorCol;
}

void kpViewManager::setTextCursorPosition (int row, int col, bool isUpdateMicroFocusHint)
{
    if (row == m_textCursorRow && col == m_textCursorCol)
        return;

    setFastUpdates ();
    setQueueUpdates ();

    m_textCursorBlinkState = false;
    updateTextCursor ();

    m_textCursorRow = row;
    m_textCursorCol = col;

    m_textCursorBlinkState = true;
    updateTextCursor ();

    restoreQueueUpdates ();
    restoreFastUpdates ();

    if (isUpdateMicroFocusHint)
    {
        kpDocument *doc = m_mainWindow->document ();
        if (!doc)
            return;
        
        kpSelection *sel = doc->selection ();
        if (!sel || !sel->isText ())
            return;

        if (m_viewUnderCursor)
        {
            // TODO: Fix code duplication: kpViewManager::{setTextCursorPosition,updateTextCursor}() & kpView::paintEventDrawSelection()
            TQPoint topLeft = sel->pointForTextRowCol (m_textCursorRow, m_textCursorCol);
            if (topLeft != KP_INVALID_POINT)
            {
                // TODO: I think you need to consider zooming e.g. try editing
                //       text at 800% or with focus set to the thumbnail.
                //       kpSelection/kpDocument works fully in unzoomed 
                //       coordinates unlike the view (which is zoomed and can
                //       change size).
                //
                //       To fix it here, I think you should call
                //       m_viewUnderCursor->transformDocToView(TQRect).  However,
                //       the rest of the InputMethod support still needs to
                //       audited for this.
                //
                //       [Bug #27]
                m_viewUnderCursor->updateMicroFocusHint(TQRect (topLeft.x (), topLeft.y (), 1, sel->textStyle ().fontMetrics ().height ())); 
            }
        }
    }
}


bool kpViewManager::textCursorBlinkState () const
{
    return m_textCursorBlinkState;
}

void kpViewManager::setTextCursorBlinkState (bool on)
{
    if (on == m_textCursorBlinkState)
        return;

    m_textCursorBlinkState = on;

    updateTextCursor ();
}


// protected
void kpViewManager::updateTextCursor ()
{
#if DEBUG_KP_VIEW_MANAGER && 0
    kdDebug () << "kpViewManager::updateTextCursor()" << endl;
#endif

    if (!m_mainWindow)
        return;

    kpDocument *doc = m_mainWindow->document ();
    if (!doc)
        return;

    kpSelection *sel = doc->selection ();
    if (!sel || !sel->isText ())
        return;

    // TODO: Fix code duplication: kpViewManager::{setTextCursorPosition,updateTextCursor}() & kpView::paintEventDrawSelection()
    TQPoint topLeft = sel->pointForTextRowCol (m_textCursorRow, m_textCursorCol);
    if (topLeft != KP_INVALID_POINT)
    {
        setFastUpdates ();
        updateViews (TQRect (topLeft.x (), topLeft.y (), 1, sel->textStyle ().fontMetrics ().height ()));
        restoreFastUpdates ();
    }
}

// protected slot
void kpViewManager::slotTextCursorBlink ()
{
#if DEBUG_KP_VIEW_MANAGER && 0
    kdDebug () << "kpViewManager::slotTextCursorBlink() cursorBlinkState="
               << m_textCursorBlinkState << endl;
#endif

    if (m_textCursorBlinkTimer)
    {
        m_textCursorBlinkTimer->start (TQApplication::cursorFlashTime () / 2,
                                       true/*single shot*/);
    }

    updateTextCursor ();
    m_textCursorBlinkState = !m_textCursorBlinkState;
}


void kpViewManager::setCursor (const TQCursor &cursor)
{
    for (TQPtrList <kpView>::const_iterator it = m_views.begin ();
         it != m_views.end ();
         it++)
    {
        (*it)->setCursor (cursor);
    }

    m_cursor = cursor;
}

void kpViewManager::unsetCursor ()
{
    for (TQPtrList <kpView>::const_iterator it = m_views.begin ();
         it != m_views.end ();
         it++)
    {
        (*it)->unsetCursor ();
    }

    m_cursor = TQCursor ();
}


kpView *kpViewManager::viewUnderCursor (bool usingTQt) const
{
    if (!usingTQt)
    {
        kpViewManager *nonConstThis = const_cast <kpViewManager *> (this);

        if (m_viewUnderCursor && nonConstThis->m_views.findRef (m_viewUnderCursor) < 0)
        {
            kdError () << "kpViewManager::viewUnderCursor(): invalid view" << endl;
            nonConstThis->m_viewUnderCursor = 0;
        }


        return m_viewUnderCursor;
    }
    else
    {
        for (TQPtrList <kpView>::const_iterator it = m_views.begin ();
             it != m_views.end ();
             it++)
        {
            if ((*it)->hasMouse ())
                return (*it);
        }

        return 0;
    }
}

void kpViewManager::setViewUnderCursor (kpView *view)
{
#if DEBUG_KP_VIEW_MANAGER && 1
    kdDebug () << "kpViewManager::setViewUnderCursor ("
               << (view ? view->name () : "(none)") << ")"
               << "  old=" << (m_viewUnderCursor ? m_viewUnderCursor->name () : "(none)")
               << endl;
#endif
    if (view == m_viewUnderCursor)
        return;

    m_viewUnderCursor = view;

    if (!m_viewUnderCursor)
    {
        // Hide the brush if the mouse cursor just left the view
        if (m_tempPixmap && m_tempPixmap->isBrush ())
        {
        #if DEBUG_KP_VIEW_MANAGER && 1
            kdDebug () << "\thiding brush pixmap since cursor left view" << endl;
        #endif
            updateViews (m_tempPixmap->rect ());
        }
    }
    else
    {
        if (m_mainWindow && m_mainWindow->tool ())
        {
        #if DEBUG_KP_VIEW_MANAGER && 1
            kdDebug () << "\tnotify tool that something changed below cursor" << endl;
        #endif
            m_mainWindow->tool ()->somethingBelowTheCursorChanged ();
        }
    }
}


// public
kpView *kpViewManager::activeView () const
{
    for (TQPtrList <kpView>::const_iterator it = m_views.begin ();
         it != m_views.end ();
         it++)
    {
        if ((*it)->isActiveWindow ())
            return (*it);
    }

    return 0;
}


// public
bool kpViewManager::queueUpdates () const
{
    return (m_queueUpdatesCounter > 0);
}

// public
void kpViewManager::setQueueUpdates ()
{
    m_queueUpdatesCounter++;
#if DEBUG_KP_VIEW_MANAGER && 1
    kdDebug () << "kpViewManager::setQueueUpdates() counter="
               << m_queueUpdatesCounter << endl;
#endif
}

// public
void kpViewManager::restoreQueueUpdates ()
{
    m_queueUpdatesCounter--;
#if DEBUG_KP_VIEW_MANAGER && 1
    kdDebug () << "kpViewManager::restoreQueueUpdates() counter="
               << m_queueUpdatesCounter << endl;
#endif
    if (m_queueUpdatesCounter < 0)
    {
        kdError () << "kpViewManager::restoreQueueUpdates() counter="
                   << m_queueUpdatesCounter;
    }

    if (m_queueUpdatesCounter <= 0)
    {
        for (TQPtrList <kpView>::const_iterator it = m_views.begin ();
             it != m_views.end ();
             it++)
        {
            (*it)->updateQueuedArea ();
        }
    }
}


// public
bool kpViewManager::fastUpdates () const
{
    return (m_fastUpdatesCounter > 0);
}

// public
void kpViewManager::setFastUpdates ()
{
    m_fastUpdatesCounter++;
#if DEBUG_KP_VIEW_MANAGER && 0
    kdDebug () << "kpViewManager::setFastUpdates() counter="
               << m_fastUpdatesCounter << endl;
#endif
}

// public
void kpViewManager::restoreFastUpdates ()
{
    m_fastUpdatesCounter--;
#if DEBUG_KP_VIEW_MANAGER && 0
    kdDebug () << "kpViewManager::restoreFastUpdates() counter="
               << m_fastUpdatesCounter << endl;
#endif
    if (m_fastUpdatesCounter < 0)
    {
        kdError () << "kpViewManager::restoreFastUpdates() counter="
                   << m_fastUpdatesCounter;
    }
}


void kpViewManager::updateView (kpView *v)
{
    updateView (v, TQRect (0, 0, v->width (), v->height ()));
}

void kpViewManager::updateView (kpView *v, const TQRect &viewRect)
{
    if (!queueUpdates ())
    {
        if (fastUpdates ())
            v->repaint (viewRect, false/*no erase*/);
        else
            v->update (viewRect);
    }
    else
        v->addToQueuedArea (viewRect);
}

void kpViewManager::updateView (kpView *v, int x, int y, int w, int h)
{
    updateView (v, TQRect (x, y, w, h));
}

void kpViewManager::updateView (kpView *v, const TQRegion &viewRegion)
{
    if (!queueUpdates ())
    {
        if (fastUpdates ())
            v->repaint (viewRegion, false/*no erase*/);
        else
            v->update (viewRegion.boundingRect ());
    }
    else
        v->addToQueuedArea (viewRegion);
}

void kpViewManager::updateViewRectangleEdges (kpView *v, const TQRect &viewRect)
{
    if (viewRect.height () <= 0 || viewRect.width () <= 0)
        return;

    // Top line
    updateView (v, TQRect (viewRect.x (), viewRect.y (),
                          viewRect.width (), 1));

    if (viewRect.height () >= 2)
    {
        // Bottom line
        updateView (v, TQRect (viewRect.x (), viewRect.bottom (),
                              viewRect.width (), 1));

        if (viewRect.height () > 2)
        {
            // Left line
            updateView (v, TQRect (viewRect.x (), viewRect.y () + 1,
                                  1, viewRect.height () - 2));

            if (viewRect.width () >= 2)
            {
                // Right line
                updateView (v, TQRect (viewRect.right (), viewRect.y () + 1,
                                      1, viewRect.height () - 2));
            }
        }
    }
}


void kpViewManager::updateViews ()
{
    kpDocument *doc = document ();
    if (doc)
        updateViews (TQRect (0, 0, doc->width (), doc->height ()));
}

void kpViewManager::updateViews (const TQRect &docRect)
{
#if DEBUG_KP_VIEW_MANAGER && 0
    kdDebug () << "kpViewManager::updateViews (" << docRect << ")" << endl;
#endif

    for (TQPtrList <kpView>::const_iterator it = m_views.begin ();
         it != m_views.end ();
         it++)
    {
        kpView *view = *it;

    #if DEBUG_KP_VIEW_MANAGER && 0
        kdDebug () << "\tupdating view " << view->name () << endl;
    #endif
        if (view->zoomLevelX () % 100 == 0 && view->zoomLevelY () % 100 == 0)
        {
        #if DEBUG_KP_VIEW_MANAGER && 0
            kdDebug () << "\t\tviewRect=" << view->transformDocToView (docRect) << endl;
        #endif
            updateView (view, view->transformDocToView (docRect));
        }
        else
        {
            TQRect viewRect = view->transformDocToView (docRect);

            int diff = tqRound (double (TQMAX (view->zoomLevelX (), view->zoomLevelY ())) / 100.0) + 1;

            TQRect newRect = TQRect (viewRect.x () - diff,
                                   viewRect.y () - diff,
                                   viewRect.width () + 2 * diff,
                                   viewRect.height () + 2 * diff)
                                .intersect (TQRect (0, 0, view->width (), view->height ()));

        #if DEBUG_KP_VIEW_MANAGER && 0
            kdDebug () << "\t\tviewRect (+compensate)=" << newRect << endl;
        #endif
            updateView (view, newRect);
        }
    }
}

void kpViewManager::updateViews (int x, int y, int w, int h)
{
    updateViews (TQRect (x, y, w, h));
}


void kpViewManager::adjustViewsToEnvironment ()
{
#if DEBUG_KP_VIEW_MANAGER && 1
    kdDebug () << "kpViewManager::adjustViewsToEnvironment()"
               << " numViews=" << m_views.count ()
               << endl;
#endif
    for (TQPtrList <kpView>::const_iterator it = m_views.begin ();
         it != m_views.end ();
         it++)
    {
        kpView *view = *it;

    #if DEBUG_KP_VIEW_MANAGER && 1
        kdDebug () << "\tview: " << view->name ()
                   << endl;
    #endif
        view->adjustToEnvironment ();
    }
}

#include <kpviewmanager.moc>