diff options
author | Thomas Benisch <tbe@openoffice.org> | 2001-06-20 08:27:37 +0000 |
---|---|---|
committer | Thomas Benisch <tbe@openoffice.org> | 2001-06-20 08:27:37 +0000 |
commit | 1fb92af0dd7c9782405318837077c33d383e199d (patch) | |
tree | 32f07c741f78b0bccd44ccf3c810d54e231514c0 | |
parent | 7ace516c8517942f217e36bb3f14ac64a0af374a (diff) |
added sorting for dialogs
-rw-r--r-- | basctl/source/basicide/basides1.cxx | 13 | ||||
-rw-r--r-- | basctl/source/basicide/basides2.cxx | 5 | ||||
-rw-r--r-- | basctl/source/basicide/basides3.cxx | 5 | ||||
-rw-r--r-- | basctl/source/basicide/basidesh.cxx | 7 | ||||
-rw-r--r-- | basctl/source/basicide/basobj3.cxx | 11 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 61 |
6 files changed, 88 insertions, 14 deletions
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 1413de2f0581..c97def43e126 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basides1.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: tbe $ $Date: 2001-06-15 08:45:17 $ + * last change: $Author: tbe $ $Date: 2001-06-20 09:27:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -459,6 +459,8 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) { ModulWindow* pEditWin = (ModulWindow*)pWin; pEditWin->RenameModule( rModName.GetValue() ); + pTabBar->Sort(); + pTabBar->MakeVisible( pTabBar->GetCurPageId() ); } else { @@ -469,7 +471,9 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) USHORT nId = (USHORT)aIDEWindowTable.GetKey( pWin ); DBG_ASSERT( nId, "No entry in Tabbar!" ); if ( nId ) + { pTabBar->SetPageText( nId, pViewWin->GetDialogName() ); + } } } BasicIDE::MarkDocShellModified( pWin->GetBasic() ); @@ -616,7 +620,11 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) USHORT nId = (USHORT)aIDEWindowTable.GetKey( pWin ); DBG_ASSERT( nId, "Kein Eintrag in der Tabbar!" ); if ( nId ) + { pTabBar->SetPageText( nId, pSbxObject->GetName() ); + pTabBar->Sort(); + pTabBar->MakeVisible( pTabBar->GetCurPageId() ); + } } } else if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG ) @@ -726,6 +734,7 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) } DBG_ASSERT( pWin, "Fenster wurde nicht erzeugt!" ); SetCurWindow( pWin, TRUE ); + pTabBar->MakeVisible( pTabBar->GetCurPageId() ); } break; } diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index 0a6d2bd24e03..47d405804aac 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basides2.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: hr $ $Date: 2000-12-07 16:15:26 $ + * last change: $Author: tbe $ $Date: 2001-06-20 09:27:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -250,6 +250,7 @@ ModulWindow* BasicIDEShell::CreateBasWin( StarBASIC* pBasic, String aModName ) DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" ); } pTabBar->InsertPage( (USHORT)nKey, pModule->GetName() ); + pTabBar->Sort(); pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar ); if ( !pCurWin ) SetCurWindow( pWin, FALSE, FALSE ); diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx index f11d6330f846..8d452f17aa07 100644 --- a/basctl/source/basicide/basides3.cxx +++ b/basctl/source/basicide/basides3.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basides3.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tbe $ $Date: 2001-06-15 08:45:17 $ + * last change: $Author: tbe $ $Date: 2001-06-20 09:27:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -162,6 +162,7 @@ DialogWindow* BasicIDEShell::CreateDlgWin( StarBASIC* pBasic, String aDlgName ) pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar ); pTabBar->InsertPage( (USHORT)nKey, aDlgName ); + pTabBar->Sort(); if ( !pCurWin ) SetCurWindow( pWin, FALSE, FALSE ); diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index bd82396caa56..14bc70b23186 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basidesh.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: tbe $ $Date: 2001-06-15 08:45:17 $ + * last change: $Author: tbe $ $Date: 2001-06-20 09:27:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -216,10 +216,11 @@ void BasicIDEShell::Init() // Nicht 0, wird sonst beim naechsten Request nicht auf das entspr. Basic gesetzt. SetCurBasic( SFX_APP()->GetBasicManager()->GetStdLib(), FALSE ); - UpdateWindows(); IDE_DLL()->pShell = this; IDE_DLL()->GetExtraData()->ShellInCriticalSection() = FALSE; + + UpdateWindows(); } __EXPORT BasicIDEShell::~BasicIDEShell() diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 4da17c5d1800..d1e30c650de1 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basobj3.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tbe $ $Date: 2001-06-15 08:45:17 $ + * last change: $Author: tbe $ $Date: 2001-06-20 09:27:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -366,7 +366,12 @@ void BasicIDE::RenameDialog( SfxObjectShell* pShell, const String& rLibName, con USHORT nId = (USHORT)(pIDEShell->GetIDEWindowTable()).GetKey( pWin ); DBG_ASSERT( nId, "No entry in Tabbar!" ); if ( nId ) - (pIDEShell->GetTabBar())->SetPageText( nId, rNewName ); + { + BasicIDETabBar* pTabBar = (BasicIDETabBar*)pIDEShell->GetTabBar(); + pTabBar->SetPageText( nId, rNewName ); + pTabBar->Sort(); + pTabBar->MakeVisible( pTabBar->GetCurPageId() ); + } } } } diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index d36c4b7c29f9..d5a5b5409bd9 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bastypes.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: tbe $ $Date: 2001-06-15 08:45:17 $ + * last change: $Author: tbe $ $Date: 2001-06-20 09:27:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -60,6 +60,9 @@ ************************************************************************/ +#include <vector> +#include <algorithm> + #include <ide_pch.hxx> #pragma hdrstop @@ -71,11 +74,13 @@ #include <bastypes.hxx> #include <bastype2.hxx> #include <baside2.hxx> // Leider brauche ich teilweise pModulWindow... +#include <baside3.hxx> #include <baside2.hrc> #include <svtools/textview.hxx> #include <svtools/texteng.hxx> #include <basobj.hxx> #include <sbxitem.hxx> +#include <iderdll.hxx> #ifndef _SV_DRAG_HXX //autogen #include <vcl/drag.hxx> @@ -730,6 +735,58 @@ void __EXPORT BasicIDETabBar::EndRenaming() } +void BasicIDETabBar::Sort() +{ + BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); + if ( pIDEShell ) + { + IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); + TabBarSortHelper aTabBarSortHelper; + ::std::vector<TabBarSortHelper> aModuleList; + ::std::vector<TabBarSortHelper> aDialogList; + USHORT nPageCount = GetPageCount(); + + // create module and dialog lists for sorting + for (USHORT i = 0; i < nPageCount; i++) + { + USHORT nId = GetPageId( i ); + aTabBarSortHelper.nPageId = nId; + aTabBarSortHelper.aPageText = GetPageText( nId ); + IDEBaseWindow* pWin = aIDEWindowTable.Get( nId ); + + if ( pWin->IsA( TYPE( ModulWindow ) ) ) + { + aModuleList.push_back( aTabBarSortHelper ); + } + else if ( pWin->IsA( TYPE( DialogWindow ) ) ) + { + aDialogList.push_back( aTabBarSortHelper ); + } + } + + // sort module and dialog lists by page text + ::std::sort( aModuleList.begin() , aModuleList.end() ); + ::std::sort( aDialogList.begin() , aDialogList.end() ); + + + USHORT nModules = aModuleList.size(); + USHORT nDialogs = aDialogList.size(); + + // move module pages to new positions + for (i = 0; i < nModules; i++) + { + MovePage( aModuleList[i].nPageId , i ); + } + + // move dialog pages to new positions + for (i = 0; i < nDialogs; i++) + { + MovePage( aDialogList[i].nPageId , nModules + i ); + } + } +} + + BasicEntry::~BasicEntry() { } |