[KBear-cvs] kbear/kbear/lib/qextmdi kmdidefines.h,1.1,1.2 kmdimainfrm.cpp,1.1,1.2 kmdimainfrm.h,1.1,
Brought to you by:
kbjorn
|
From: <fri...@us...> - 2003-10-08 21:13:56
|
Update of /cvsroot/kbear/kbear/kbear/lib/qextmdi
In directory sc8-pr-cvs1:/tmp/cvs-serv30347/kbear/lib/qextmdi
Modified Files:
kmdidefines.h kmdimainfrm.cpp kmdimainfrm.h
Log Message:
KMdi is official part of KDE 3.2
This commit makes the KBear version, for those who don't use KDE 3.2,
compatible to the KDE 3.2 version. Note: Just the things relevant to KBear
are changed, so this KMdi version won't probably be fully compatible.
Index: kmdidefines.h
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/lib/qextmdi/kmdidefines.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** kmdidefines.h 20 May 2003 23:15:22 -0000 1.1
--- kmdidefines.h 8 Oct 2003 21:13:52 -0000 1.2
***************
*** 79,83 ****
Detach = 8,
ToolWindow = 16,
! UseQextMDISizeHint = 32
};
--- 79,83 ----
Detach = 8,
ToolWindow = 16,
! UseKMdiSizeHint = 32
};
Index: kmdimainfrm.cpp
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/lib/qextmdi/kmdimainfrm.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** kmdimainfrm.cpp 20 May 2003 23:15:22 -0000 1.1
--- kmdimainfrm.cpp 8 Oct 2003 21:13:52 -0000 1.2
***************
*** 101,105 ****
,m_pMdi(0L)
,m_pTaskBar(0L)
! ,m_pWinList(0L)
,m_pCurrentWindow(0L)
,m_pWindowPopup(0L)
--- 101,105 ----
,m_pMdi(0L)
,m_pTaskBar(0L)
! ,m_pDocumentViews(0L)
,m_pCurrentWindow(0L)
,m_pWindowPopup(0L)
***************
*** 131,136 ****
{
// Create the local list of windows
! m_pWinList = new QPtrList<KMdiChildView>;
! m_pWinList->setAutoDelete(FALSE);
// This seems to be needed (re-check it after Qt2.0 comed out)
setFocusPolicy(ClickFocus);
--- 131,136 ----
{
// Create the local list of windows
! m_pDocumentViews = new QPtrList<KMdiChildView>;
! m_pDocumentViews->setAutoDelete(FALSE);
// This seems to be needed (re-check it after Qt2.0 comed out)
setFocusPolicy(ClickFocus);
***************
*** 181,187 ****
// safely close the windows so properties are saved...
KMdiChildView *pWnd = 0L;
! while((pWnd = m_pWinList->first()))closeWindow(pWnd, FALSE); // without re-layout taskbar!
emit lastChildViewClosed();
! delete m_pWinList;
delete m_pDragEndTimer;
--- 181,187 ----
// safely close the windows so properties are saved...
KMdiChildView *pWnd = 0L;
! while((pWnd = m_pDocumentViews->first()))closeWindow(pWnd, FALSE); // without re-layout taskbar!
emit lastChildViewClosed();
! delete m_pDocumentViews;
delete m_pDragEndTimer;
***************
*** 203,207 ****
void KMdiMainFrm::applyOptions()
{
! for(KMdiChildView *w = m_pWinList->first();w;w= m_pWinList->next()){
QWidget *wdgt = w;
if(w->mdiParent())wdgt =w->mdiParent();
--- 203,207 ----
void KMdiMainFrm::applyOptions()
{
! for(KMdiChildView *w = m_pDocumentViews->first();w;w= m_pDocumentViews->next()){
QWidget *wdgt = w;
if(w->mdiParent())wdgt =w->mdiParent();
***************
*** 314,318 ****
QObject::connect( pWnd, SIGNAL(detachWindow(KMdiChildView*,bool)), this, SLOT(detachWindow(KMdiChildView*,bool)) );
QObject::connect( pWnd, SIGNAL(clickedInDockMenu(int)), this, SLOT(dockMenuItemActivated(int)) );
! m_pWinList->append(pWnd);
if (m_pTaskBar) {
KMdiTaskBarButton* but = m_pTaskBar->addWinButton(pWnd);
--- 314,318 ----
QObject::connect( pWnd, SIGNAL(detachWindow(KMdiChildView*,bool)), this, SLOT(detachWindow(KMdiChildView*,bool)) );
QObject::connect( pWnd, SIGNAL(clickedInDockMenu(int)), this, SLOT(dockMenuItemActivated(int)) );
! m_pDocumentViews->append(pWnd);
if (m_pTaskBar) {
KMdiTaskBarButton* but = m_pTaskBar->addWinButton(pWnd);
***************
*** 347,351 ****
}
pWnd->setFocus();
! if (m_pWinList->count() == 1) {
m_pClose->show(); // show the close button in case it isn't already
}
--- 347,351 ----
}
pWnd->setFocus();
! if (m_pDocumentViews->count() == 1) {
m_pClose->show(); // show the close button in case it isn't already
}
***************
*** 356,360 ****
emit childViewIsDetachedNow(pWnd); // fake it because detach won't call it in this case of addWindow-to-MDI
} else {
! attachWindow( pWnd, !(flags & KMdi::Hide), flags & KMdi::UseQextMDISizeHint);
}
--- 356,360 ----
emit childViewIsDetachedNow(pWnd); // fake it because detach won't call it in this case of addWindow-to-MDI
} else {
! attachWindow( pWnd, !(flags & KMdi::Hide), flags & KMdi::UseKMdiSizeHint);
}
***************
*** 431,435 ****
QObject::connect( pToolView, SIGNAL(childWindowCloseRequest(KMdiChildView*)), this, SLOT(childWindowCloseRequest(KMdiChildView*)) );
QObject::connect( pToolView, SIGNAL(focusInEventOccurs(KMdiChildView*)), this, SLOT(activateView(KMdiChildView*)) );
! m_pWinList->append(pToolView);
pToolView->m_bToolView = TRUE;
pToolView->setGeometry(r);
--- 431,435 ----
QObject::connect( pToolView, SIGNAL(childWindowCloseRequest(KMdiChildView*)), this, SLOT(childWindowCloseRequest(KMdiChildView*)) );
QObject::connect( pToolView, SIGNAL(focusInEventOccurs(KMdiChildView*)), this, SLOT(activateView(KMdiChildView*)) );
! m_pDocumentViews->append(pToolView);
pToolView->m_bToolView = TRUE;
pToolView->setGeometry(r);
***************
*** 549,556 ****
if (pWnd->size().isEmpty() || (pWnd->size() == QSize(1,1))) {
if (m_pCurrentWindow) {
! pWnd->setGeometry( QRect( m_pMdi->getCascadePoint(m_pWinList->count()-1), m_pCurrentWindow->size()));
}
else {
! pWnd->setGeometry( QRect( m_pMdi->getCascadePoint(m_pWinList->count()-1), defaultChildFrmSize()));
}
}
--- 549,556 ----
if (pWnd->size().isEmpty() || (pWnd->size() == QSize(1,1))) {
if (m_pCurrentWindow) {
! pWnd->setGeometry( QRect( m_pMdi->getCascadePoint(m_pDocumentViews->count()-1), m_pCurrentWindow->size()));
}
else {
! pWnd->setGeometry( QRect( m_pMdi->getCascadePoint(m_pDocumentViews->count()-1), defaultChildFrmSize()));
}
}
***************
*** 581,587 ****
{
//Closes a child window. sends no close event : simply deletes it
! if (!(m_pWinList->removeRef(pWnd)))
return;
! if (m_pWinList->count() == 0)
m_pCurrentWindow = 0L;
--- 581,587 ----
{
//Closes a child window. sends no close event : simply deletes it
! if (!(m_pDocumentViews->removeRef(pWnd)))
return;
! if (m_pDocumentViews->count() == 0)
m_pCurrentWindow = 0L;
***************
*** 602,606 ****
if (m_mdiMode == KMdi::TabPageMode) {
! if (m_pWinList->count() == 0) {
if (!m_pDockbaseAreaOfDocumentViews) {
m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", QPixmap(), 0L, "mdi_area_cover");
--- 602,606 ----
if (m_mdiMode == KMdi::TabPageMode) {
! if (m_pDocumentViews->count() == 0) {
if (!m_pDockbaseAreaOfDocumentViews) {
m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", QPixmap(), 0L, "mdi_area_cover");
***************
*** 627,632 ****
}
delete pDockW;
! if (m_pWinList->count() == 1) {
! m_pWinList->last()->activate(); // all other views are activated by tab switch
}
}
--- 627,632 ----
}
delete pDockW;
! if (m_pDocumentViews->count() == 1) {
! m_pDocumentViews->last()->activate(); // all other views are activated by tab switch
}
}
***************
*** 645,651 ****
}
}
! else if (m_pWinList->count() > 0) {
! //crash? m_pWinList->last()->activate();
! //crash? m_pWinList->last()->setFocus();
}
}
--- 645,651 ----
}
}
! else if (m_pDocumentViews->count() > 0) {
! //crash? m_pDocumentViews->last()->activate();
! //crash? m_pDocumentViews->last()->setFocus();
}
}
***************
*** 662,667 ****
{
//Closes a child window. sends no close event : simply deletes it
! m_pWinList->removeRef(pWnd);
! if (m_pWinList->count() == 0)
m_pCurrentWindow = 0L;
--- 662,667 ----
{
//Closes a child window. sends no close event : simply deletes it
! m_pDocumentViews->removeRef(pWnd);
! if (m_pDocumentViews->count() == 0)
m_pCurrentWindow = 0L;
***************
*** 671,675 ****
if (m_mdiMode == KMdi::TabPageMode) {
! if (m_pWinList->count() == 0) {
if (!m_pDockbaseAreaOfDocumentViews) {
m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", QPixmap(), 0L, "mdi_area_cover");
--- 671,675 ----
if (m_mdiMode == KMdi::TabPageMode) {
! if (m_pDocumentViews->count() == 0) {
if (!m_pDockbaseAreaOfDocumentViews) {
m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", QPixmap(), 0L, "mdi_area_cover");
***************
*** 696,701 ****
}
delete pDockW;
! if (m_pWinList->count() == 1) {
! m_pWinList->last()->activate(); // all other views are activated by tab switch
}
}
--- 696,701 ----
}
delete pDockW;
! if (m_pDocumentViews->count() == 1) {
! m_pDocumentViews->last()->activate(); // all other views are activated by tab switch
}
}
***************
*** 714,720 ****
}
}
! else if (m_pWinList->count() > 0) {
! m_pWinList->last()->activate();
! m_pWinList->last()->setFocus();
}
}
--- 714,720 ----
}
}
! else if (m_pDocumentViews->count() > 0) {
! m_pDocumentViews->last()->activate();
! m_pDocumentViews->last()->setFocus();
}
}
***************
*** 727,731 ****
KMdiChildView * KMdiMainFrm::findWindow(const QString& caption)
{
! for(KMdiChildView *w=m_pWinList->first();w;w=m_pWinList->next()){
if(QString(w->caption()) == QString(caption))return w; //F.B.
}
--- 727,731 ----
KMdiChildView * KMdiMainFrm::findWindow(const QString& caption)
{
! for(KMdiChildView *w=m_pDocumentViews->first();w;w=m_pDocumentViews->next()){
if(QString(w->caption()) == QString(caption))return w; //F.B.
}
***************
*** 742,746 ****
bool KMdiMainFrm::windowExists(KMdiChildView *pWnd)
{
! for(KMdiChildView *w=m_pWinList->first();w;w=m_pWinList->next()){
if(w == pWnd)return TRUE;
}
--- 742,746 ----
bool KMdiMainFrm::windowExists(KMdiChildView *pWnd)
{
! for(KMdiChildView *w=m_pDocumentViews->first();w;w=m_pDocumentViews->next()){
if(w == pWnd)return TRUE;
}
***************
*** 868,872 ****
// this is the first move -> send the drag begin to all concerned views
KMdiChildView* pView;
! for (m_pWinList->first(); (pView = m_pWinList->current()) != 0L; m_pWinList->next()) {
KMdiChildFrmDragBeginEvent dragBeginEvent(0L);
QApplication::sendEvent(pView, &dragBeginEvent);
--- 868,872 ----
// this is the first move -> send the drag begin to all concerned views
KMdiChildView* pView;
! for (m_pDocumentViews->first(); (pView = m_pDocumentViews->current()) != 0L; m_pDocumentViews->next()) {
KMdiChildFrmDragBeginEvent dragBeginEvent(0L);
QApplication::sendEvent(pView, &dragBeginEvent);
***************
*** 944,948 ****
void KMdiMainFrm::closeAllViews()
{
! for(KMdiChildView *w = m_pWinList->first();w;w= m_pWinList->next()){
w->close();
}
--- 944,948 ----
void KMdiMainFrm::closeAllViews()
{
! for(KMdiChildView *w = m_pDocumentViews->first();w;w= m_pDocumentViews->next()){
w->close();
}
***************
*** 954,958 ****
void KMdiMainFrm::iconifyAllViews()
{
! for(KMdiChildView *w = m_pWinList->first();w;w= m_pWinList->next()){
if(!w->isToolView())
w->minimize();
--- 954,958 ----
void KMdiMainFrm::iconifyAllViews()
{
! for(KMdiChildView *w = m_pDocumentViews->first();w;w= m_pDocumentViews->next()){
if(!w->isToolView())
w->minimize();
***************
*** 1083,1087 ****
m_oldMainFrmMaxHeight = maximumHeight();
m_oldMainFrmHeight = height();
! if( m_pWinList->count())
setFixedHeight( height() - m_pDockbaseAreaOfDocumentViews->height());
else { // consider space for the taskbar
--- 1083,1087 ----
m_oldMainFrmMaxHeight = maximumHeight();
m_oldMainFrmHeight = height();
! if( m_pDocumentViews->count())
setFixedHeight( height() - m_pDockbaseAreaOfDocumentViews->height());
else { // consider space for the taskbar
***************
*** 1092,1096 ****
// 5. show the child views again
! QPtrListIterator<KMdiChildView> it( *m_pWinList);
for( it.toFirst(); it.current(); ++it) {
KMdiChildView* pView = it.current();
--- 1092,1096 ----
// 5. show the child views again
! QPtrListIterator<KMdiChildView> it( *m_pDocumentViews);
for( it.toFirst(); it.current(); ++it) {
KMdiChildView* pView = it.current();
***************
*** 1180,1184 ****
m_mdiMode = KMdi::ChildframeMode;
! QPtrListIterator<KMdiChildView> it( *m_pWinList);
for( ; it.current(); ++it) {
KMdiChildView* pView = it.current();
--- 1180,1184 ----
m_mdiMode = KMdi::ChildframeMode;
! QPtrListIterator<KMdiChildView> it( *m_pDocumentViews);
for( ; it.current(); ++it) {
KMdiChildView* pView = it.current();
***************
*** 1212,1216 ****
// detach all non-tool-views to toplevel
! QPtrListIterator<KMdiChildView> it( *m_pWinList);
for( ; it.current(); ++it) {
KMdiChildView* pView = it.current();
--- 1212,1216 ----
// detach all non-tool-views to toplevel
! QPtrListIterator<KMdiChildView> it( *m_pDocumentViews);
for( ; it.current(); ++it) {
KMdiChildView* pView = it.current();
***************
*** 1268,1272 ****
// tabify all MDI views covered by a KDockWidget
KDockWidget* pCover = 0L;
! QPtrListIterator<KMdiChildView> it4( *m_pWinList);
for( ; it4.current(); ++it4) {
KMdiChildView* pView = it4.current();
--- 1268,1272 ----
// tabify all MDI views covered by a KDockWidget
KDockWidget* pCover = 0L;
! QPtrListIterator<KMdiChildView> it4( *m_pDocumentViews);
for( ; it4.current(); ++it4) {
KMdiChildView* pView = it4.current();
***************
*** 1300,1304 ****
}
if (pCover) {
! if (m_pWinList->count() > 1) { // note: with only 1 page we haven't already tabbed widgets
// set the first page as active page
QTabWidget* pTab = (QTabWidget*) pCover->parentWidget()->parentWidget();
--- 1300,1304 ----
}
if (pCover) {
! if (m_pDocumentViews->count() > 1) { // note: with only 1 page we haven't already tabbed widgets
// set the first page as active page
QTabWidget* pTab = (QTabWidget*) pCover->parentWidget()->parentWidget();
***************
*** 1312,1316 ****
QObject::connect( m_pClose, SIGNAL(clicked()), this, SLOT(closeViewButtonPressed()) );
! if (m_pWinList->count() > 0) {
m_pClose->show();
}
--- 1312,1316 ----
QObject::connect( m_pClose, SIGNAL(clicked()), this, SLOT(closeViewButtonPressed()) );
! if (m_pDocumentViews->count() > 0) {
m_pClose->show();
}
***************
*** 1325,1329 ****
QObject::disconnect( m_pClose, SIGNAL(clicked()), this, SLOT(closeViewButtonPressed()) );
! QPtrListIterator<KMdiChildView> it( *m_pWinList);
for( ; it.current(); ++it) {
KMdiChildView* pView = it.current();
--- 1325,1329 ----
QObject::disconnect( m_pClose, SIGNAL(clicked()), this, SLOT(closeViewButtonPressed()) );
! QPtrListIterator<KMdiChildView> it( *m_pDocumentViews);
for( ; it.current(); ++it) {
KMdiChildView* pView = it.current();
***************
*** 1557,1563 ****
void KMdiMainFrm::activateView(int index)
{
! KMdiChildView* pView = m_pWinList->first();
for (int i = 0; pView && (i < index); i++) {
! pView = m_pWinList->next();
}
if (pView) {
--- 1557,1563 ----
void KMdiMainFrm::activateView(int index)
{
! KMdiChildView* pView = m_pDocumentViews->first();
for (int i = 0; pView && (i < index); i++) {
! pView = m_pDocumentViews->next();
}
if (pView) {
***************
*** 1700,1704 ****
bool bNoViewOpened = FALSE;
! if (m_pWinList->isEmpty()) {
bNoViewOpened = TRUE;
}
--- 1700,1704 ----
bool bNoViewOpened = FALSE;
! if (m_pDocumentViews->isEmpty()) {
bNoViewOpened = TRUE;
}
***************
*** 1766,1770 ****
int i=100;
KMdiChildView* pView = 0L;
! QPtrListIterator<KMdiChildView> it(*m_pWinList);
QValueList<QDateTime> timeStamps;
for (; it.current(); ++it) {
--- 1766,1770 ----
int i=100;
KMdiChildView* pView = 0L;
! QPtrListIterator<KMdiChildView> it(*m_pDocumentViews);
QValueList<QDateTime> timeStamps;
for (; it.current(); ++it) {
***************
*** 1840,1844 ****
if (id < 100) return;
id -= 100;
! KMdiChildView *pView = m_pWinList->at( id);
if (!pView) return;
if (pView->isMinimized()) pView->minimize();
--- 1840,1844 ----
if (id < 100) return;
id -= 100;
! KMdiChildView *pView = m_pDocumentViews->at( id);
if (!pView) return;
if (pView->isMinimized()) pView->minimize();
***************
*** 1860,1864 ****
if( id < 100) return;
id -= 100;
! KMdiChildView *pView = m_pWinList->at( id);
if( !pView) return;
if( pView->isMinimized()) pView->minimize();
--- 1860,1864 ----
if( id < 100) return;
id -= 100;
! KMdiChildView *pView = m_pDocumentViews->at( id);
if( !pView) return;
if( pView->isMinimized()) pView->minimize();
***************
*** 1885,1889 ****
// send drag end to all concerned views.
KMdiChildView* pView;
! for (m_pWinList->first(); (pView = m_pWinList->current()) != 0L; m_pWinList->next()) {
KMdiChildFrmDragEndEvent dragEndEvent(0L);
QApplication::sendEvent(pView, &dragEndEvent);
--- 1885,1889 ----
// send drag end to all concerned views.
KMdiChildView* pView;
! for (m_pDocumentViews->first(); (pView = m_pDocumentViews->current()) != 0L; m_pDocumentViews->next()) {
KMdiChildFrmDragEndEvent dragEndEvent(0L);
QApplication::sendEvent(pView, &dragEndEvent);
***************
*** 1913,1917 ****
}
setMenuForSDIModeSysButtons( m_pMainMenuBar);
! QPtrListIterator<KMdiChildView> it( *m_pWinList);
for( ; it.current(); ++it) {
KMdiChildView* pView = it.current();
--- 1913,1917 ----
}
setMenuForSDIModeSysButtons( m_pMainMenuBar);
! QPtrListIterator<KMdiChildView> it( *m_pDocumentViews);
for( ; it.current(); ++it) {
KMdiChildView* pView = it.current();
Index: kmdimainfrm.h
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/lib/qextmdi/kmdimainfrm.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** kmdimainfrm.h 20 May 2003 23:15:22 -0000 1.1
--- kmdimainfrm.h 8 Oct 2003 21:13:52 -0000 1.2
***************
*** 212,216 ****
KMdiChildArea *m_pMdi;
KMdiTaskBar *m_pTaskBar;
! QPtrList<KMdiChildView> *m_pWinList;
KMdiChildView *m_pCurrentWindow;
QPopupMenu *m_pWindowPopup;
--- 212,216 ----
KMdiChildArea *m_pMdi;
KMdiTaskBar *m_pTaskBar;
! QPtrList<KMdiChildView> *m_pDocumentViews;
KMdiChildView *m_pCurrentWindow;
QPopupMenu *m_pWindowPopup;
***************
*** 331,338 ****
*/
KMdiIterator<KMdiChildView*>* createIterator() {
! if ( m_pWinList == 0L) {
return new KMdiNullIterator<KMdiChildView*>();
} else {
! return new KMdiListIterator<KMdiChildView>( *m_pWinList);
}
}
--- 331,338 ----
*/
KMdiIterator<KMdiChildView*>* createIterator() {
! if ( m_pDocumentViews == 0L) {
return new KMdiNullIterator<KMdiChildView*>();
} else {
! return new KMdiListIterator<KMdiChildView>( *m_pDocumentViews);
}
}
|