diff options
Diffstat (limited to 'soldep/source')
-rw-r--r-- | soldep/source/connctr.cxx | 275 | ||||
-rw-r--r-- | soldep/source/depapp.cxx | 150 | ||||
-rw-r--r-- | soldep/source/depapp.hxx | 112 | ||||
-rw-r--r-- | soldep/source/depper.cxx | 690 | ||||
-rw-r--r-- | soldep/source/depwin.cxx | 167 | ||||
-rw-r--r-- | soldep/source/graphwin.cxx | 80 | ||||
-rw-r--r-- | soldep/source/hashobj.cxx | 40 | ||||
-rw-r--r-- | soldep/source/makefile.mk | 150 | ||||
-rw-r--r-- | soldep/source/objwin.cxx | 824 | ||||
-rw-r--r-- | soldep/source/sdtresid.cxx | 52 | ||||
-rw-r--r-- | soldep/source/soldep.cxx | 1810 | ||||
-rw-r--r-- | soldep/source/soldep.ico | bin | 0 -> 10134 bytes | |||
-rw-r--r-- | soldep/source/soldlg.cxx | 270 | ||||
-rw-r--r-- | soldep/source/soldlg.src | 377 | ||||
-rw-r--r-- | soldep/source/tbox.cxx | 599 |
15 files changed, 5596 insertions, 0 deletions
diff --git a/soldep/source/connctr.cxx b/soldep/source/connctr.cxx new file mode 100644 index 000000000000..acba58ce48d9 --- /dev/null +++ b/soldep/source/connctr.cxx @@ -0,0 +1,275 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connctr.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifdef _MSC_VER
+#pragma warning(disable:4100)
+#endif
+#include <soldep/connctr.hxx>
+#include <soldep/objwin.hxx>
+#include <soldep/depwin.hxx>
+#include "math.h"
+
+BOOL Connector::msbHideMode = FALSE;
+
+Connector::Connector( DepWin* pParent, WinBits nWinStyle ) :
+mpStartWin( 0L ),
+mpEndWin( 0L ),
+mnStartId( 0 ),
+mnEndId( 0 ),
+bVisible( FALSE ),
+len( 70 )
+{
+ mpParent = pParent;
+ if ( mpParent )
+ mpParent->AddConnector( this );
+}
+
+Connector::~Connector()
+{
+ if ( mpStartWin )
+ mpStartWin->RemoveConnector( this );
+ if ( mpEndWin )
+ mpEndWin->RemoveConnector( this );
+ if ( mpParent )
+ mpParent->RemoveConnector( this );
+ mpParent->Invalidate( Rectangle( mStart, mEnd ));
+ mpParent->Invalidate( Rectangle( mEnd - Point( 3, 3), mEnd + Point( 3, 3)));
+}
+
+void Connector::Initialize( ObjectWin* pStartWin, ObjectWin* pEndWin, BOOL bVis )
+{
+ mpStartWin = pStartWin;
+ mpEndWin = pEndWin;
+ mpStartWin->AddConnector( this );
+ mpEndWin->AddConnector( this );
+ mCenter = GetMiddle();
+ mStart = pStartWin->GetFixPoint( mCenter );
+ mEnd = pEndWin->GetFixPoint( mCenter );
+ mnStartId = pStartWin->GetId();
+ mnEndId = pEndWin->GetId();
+ bVisible = bVis;
+
+// if ( mpParent->IsPaintEnabled())
+ if ( IsVisible() )
+ {
+ mpParent->DrawLine( mEnd, mStart );
+ mpParent->DrawEllipse( Rectangle( mEnd - Point( 2, 2), mEnd + Point( 2, 2)));
+ }
+ UpdateVisibility(); //null_Project
+}
+
+void Connector::UpdateVisibility()
+{
+ bVisible = mpStartWin->IsVisible() && mpEndWin->IsVisible();
+}
+
+
+Point Connector::GetMiddle()
+{
+ Point aStartPoint = mpStartWin->GetPosPixel();
+ Size aStartSize = mpStartWin->GetSizePixel();
+ int nMoveHorz, nMoveVert;
+ aStartPoint.Move( aStartSize.Width() / 2, aStartSize.Height() / 2 );
+
+ Point aEndPoint = mpEndWin->GetPosPixel();
+ Size aEndSize = mpEndWin->GetSizePixel();
+
+ aEndPoint.Move( aEndSize.Width() / 2, aEndSize.Height() / 2 );
+
+ Point aRetPoint = aEndPoint;
+
+ nMoveHorz = aStartPoint.X() - aEndPoint.X();
+ if ( nMoveHorz )
+ nMoveHorz /= 2;
+ nMoveVert = aStartPoint.Y() - aEndPoint.Y();
+ if ( nMoveVert )
+ nMoveVert /= 2;
+ aRetPoint.Move( nMoveHorz, nMoveVert );
+ return aRetPoint;
+
+}
+
+void Connector::Paint( const Rectangle& rRect )
+{
+ //MyApp *pApp = (MyApp*)GetpApp();
+ //SolDep *pSoldep = pApp->GetSolDep();
+ if (msbHideMode)
+ {
+ if (!(mpStartWin->IsNullObject())) //null_project
+ {
+ if ( mpStartWin->GetMarkMode() == 0 || mpStartWin->GetMarkMode() == MARKMODE_DEPENDING )
+ {
+ mpStartWin->SetViewMask(0); //objwin invisible
+ } else
+ {
+ mpStartWin->SetViewMask(1); //objwin visible
+ }
+ }
+ if (!(mpEndWin->IsNullObject()))
+ {
+ if ( mpEndWin->GetMarkMode() == 0 || mpEndWin->GetMarkMode() == MARKMODE_DEPENDING )
+ {
+ mpEndWin->SetViewMask(0); //objwin invisible
+ } else
+ {
+ mpEndWin->SetViewMask(1); //objwin visible
+ }
+ }
+ UpdateVisibility();
+ } else //IsHideMode
+ {
+ //bVisible = TRUE;
+ if (!(mpStartWin->IsNullObject())) //null_project
+ {
+ mpStartWin->SetViewMask(1);
+ }
+ if (!(mpEndWin->IsNullObject())) //null_project
+ {
+ mpEndWin->SetViewMask(1);
+ }
+ UpdateVisibility();
+ }
+ if ( (mpStartWin->GetBodyText() != ByteString("null")) && //null_project
+ (mpEndWin->GetBodyText() != ByteString("null")) && IsVisible()) //null_project
+ {
+ mpParent->DrawLine( mEnd, mStart );
+ mpParent->DrawEllipse( Rectangle( mEnd - Point( 2, 2), mEnd + Point( 2, 2)));
+ }
+}
+
+void Connector::DrawOutput( OutputDevice* pDevice, const Point& rOffset )
+{
+ if ( (mpStartWin->GetBodyText() != ByteString("null")) && //null_project
+ (mpEndWin->GetBodyText() != ByteString("null")) && IsVisible()) //null_project
+ {
+ pDevice->DrawLine( pDevice->PixelToLogic( mEnd ) - rOffset, pDevice->PixelToLogic( mStart ) - rOffset );
+ Rectangle aRect( pDevice->PixelToLogic( Rectangle( mEnd - Point( 2, 2), mEnd + Point( 2, 2) ) ) );
+ aRect.Move( -rOffset.X(), -rOffset.Y() );
+ pDevice->DrawEllipse( aRect );
+ }
+}
+
+void Connector::UpdatePosition( ObjectWin* pWin, BOOL bPaint )
+{
+// more than one call ?
+//
+ Point OldStart, OldEnd;
+ static ULONG nCallCount = 0;
+
+ //MyApp *pApp = (MyApp*)GetpApp();
+ //SolDep *pSoldep = pApp->GetSolDep();
+ if (msbHideMode)
+ bVisible = 1;
+
+ if ( nCallCount ) // only one call
+ nCallCount++;
+ else
+ {
+ nCallCount++;
+ while ( nCallCount )
+ {
+ if ( bPaint )
+ {
+ OldStart = mStart;
+ OldEnd = mEnd;
+ }
+ mCenter = GetMiddle();
+ mStart=mpStartWin->GetFixPoint( mCenter, bPaint );
+ mEnd=mpEndWin->GetFixPoint( mCenter, bPaint );
+ if ( bPaint )
+ {
+ mpParent->Invalidate( Rectangle( OldStart, OldEnd ));
+ mpParent->Invalidate( Rectangle( OldEnd - Point( 2, 2), OldEnd + Point( 2, 2)));
+//Don't paint "null_project" connectors
+ if ( (mpStartWin->GetBodyText() != ByteString("null")) && //null_project
+ (mpEndWin->GetBodyText() != ByteString("null"))) //null_project
+ {
+ Paint ( Rectangle( mEnd - Point( 3, 3), mEnd + Point( 3, 3)));
+ Paint ( Rectangle( mEnd, mStart ));
+ }
+ }
+ nCallCount--;
+ }
+ }
+}
+
+USHORT Connector::Save( SvFileStream& rOutFile )
+{
+ rOutFile << mpStartWin->GetId();
+ rOutFile << mpEndWin->GetId();
+
+ return 0;
+}
+
+USHORT Connector::Load( SvFileStream& rInFile )
+{
+ rInFile >> mnStartId;
+ rInFile >> mnEndId;
+
+ return 0;
+}
+
+ObjectWin* Connector::GetOtherWin( ObjectWin* pWin )
+{
+// get correspondent object ptr
+ if ( mpStartWin == pWin )
+ return mpEndWin;
+ else
+ if ( mpEndWin == pWin )
+ return mpStartWin;
+
+ return NULL;
+}
+
+ULONG Connector::GetOtherId( ULONG nId )
+{
+// get correspondent object id
+ if ( mnStartId == nId )
+ return mnEndId;
+ else
+ if ( mnEndId == nId )
+ return mnStartId;
+
+ return NULL;
+}
+
+ULONG Connector::GetLen()
+{
+ double dx, dy;
+
+ dx = mStart.X() - mEnd.X();
+ dy = mStart.Y() - mEnd.Y();
+
+ return (ULONG) sqrt( dx * dx + dy * dy );
+}
+
+BOOL Connector::IsStart( ObjectWin* pWin )
+{
+ return pWin == mpStartWin;
+}
diff --git a/soldep/source/depapp.cxx b/soldep/source/depapp.cxx new file mode 100644 index 000000000000..6b000cc6fbce --- /dev/null +++ b/soldep/source/depapp.cxx @@ -0,0 +1,150 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: depapp.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// -----------------------------------------------------------------------
+#include "depapp.hxx"
+#include <ucbhelper/contentbroker.hxx>
+#include <ucbhelper/configurationkeys.hxx>
+
+void MyApp::Main()
+{
+#if defined(WNT)
+ pDebugFile = fopen( "fprintf.out", "w" );
+#endif
+
+ pMyApp = GetpApp();
+ MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
+ pAppWindow = &aMainWin;
+ // pToolBarFrame = new FloatingWindow( aMainWin, WB_STDWORK );
+ //pToolBox = new ToolBox(pToolBarFrame,DtSodResId(TID_SOLDEP_MAIN));
+
+ pSolDep = new SolDep( &aMainWin );
+ pSolDep->Init();
+ aMainWin.SetText( String::CreateFromAscii( SOLDEPL_NAME ));
+ pSolDep->Hide();
+ aMainWin.Show();
+ Help aHelp;
+ SetHelp(&aHelp);
+ aHelp.EnableContextHelp();
+ aHelp.EnableQuickHelp();
+ Execute();
+ delete pResMgr;
+ delete pSolDep;
+}
+
+// -----------------------------------------------------------------------
+
+MyWin::MyWin( Window* pParent, WinBits nWinStyle ) :
+ WorkWindow( pParent, nWinStyle )//,aToolBox( this, DtSodResId(TID_SOLDEP_MAIN)),
+ // depper aTaskBarFrame(this, 0)
+{
+//depper aTaskBarFrame.EnableAlwaysOnTop();
+
+//depper aMenuBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Source" ) ) );
+//depper aMenuBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exit" ) ) );
+//depper SetMenuBar( &aMenuBar );
+//depper aToolBox.SetPosSizePixel( Point( 0,0 ), Size( 1100,35 ));
+// aToolBox.Show();
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseMove( const MouseEvent& rMEvt )
+{
+ WorkWindow::MouseMove( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ WorkWindow::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ WorkWindow::MouseButtonUp( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::KeyInput( const KeyEvent& rKEvt )
+{
+ WorkWindow::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::KeyUp( const KeyEvent& rKEvt )
+{
+ WorkWindow::KeyUp( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Paint( const Rectangle& rRect )
+{
+ WorkWindow::Paint( rRect );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Resize()
+{
+ ((MyApp*)GetpApp())->GetSolDep()->Resize();
+ WorkWindow::Resize();
+}
+
+SAL_IMPLEMENT_MAIN()
+{
+ //Reference< XMultiServiceFactory > xMS;
+
+ // for this to work make sure an <appname>.ini file is available, you can just copy soffice.ini
+ Reference< XComponentContext > xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext();
+
+ //xMS = cppu::createRegistryServiceFactory(
+ // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
+
+ Reference< XMultiServiceFactory > xMS( xComponentContext->getServiceManager(), UNO_QUERY);
+
+ InitVCL( xMS );
+ ::comphelper::setProcessServiceFactory(xMS);
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > aArgs(2);
+ aArgs[0] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
+ aArgs[1] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
+
+ ::ucbhelper::ContentBroker::initialize( xMS, aArgs );
+
+ aMyApp.Main();
+ DeInitVCL();
+ return 0;
+}
diff --git a/soldep/source/depapp.hxx b/soldep/source/depapp.hxx new file mode 100644 index 000000000000..e6cb96a63832 --- /dev/null +++ b/soldep/source/depapp.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: depapp.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DEPAPP_HXX +#define _DEPAPP_HXX + + +#define EVENT_RESIZE 0x00000001 + + +#include <svl/solar.hrc> +#include <tools/resmgr.hxx> +#include <bootstrp/sstring.hxx> +#include <vcl/event.hxx> +#include <vcl/svapp.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/help.hxx> +#include <vcl/button.hxx> +#include <vcl/menu.hxx> +#include <soldep/soldep.hxx> +//#include <soldep/soldlg.hrc> +//#include <soldep/tbox.hxx> +// ----------------------------------------------------------------------- +#include <sal/main.h> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/bootstrap.hxx> +#include <cppuhelper/weak.hxx> +#include <soldep/soldep.hxx> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +class MyWin; + +class MyApp : public Application +{ + ResMgr* pResMgr; + SolDep* pSolDep; + Application* pMyApp; + MyWin* pAppWindow; + +public: +// MyApp(); +// ~MyApp() {}; +#if defined(WNT) + FILE* pDebugFile; +#endif + + void Main(); + ResMgr* GetResMgr() const { return pResMgr; } + Application* GetMyApp() { return pMyApp; } + MyWin* GetAppWin() { return pAppWindow; } + SolDep* GetSolDep() { return pSolDep; } +}; + +// ----------------------------------------------------------------------- + +class MyWin : public WorkWindow +{ +protected: + MenuBar aMenuBar; +// SoldepToolBox aToolBox; //->depper.hxx + Wallpaper aWallpaper; +// FloatingWindow aTaskBarFrame; // For ToolBox + +public: + MyWin( Window* pParent, WinBits nWinStyle ); + + void MouseMove( const MouseEvent& rMEvt ); + void MouseButtonDown( const MouseEvent& rMEvt ); + void MouseButtonUp( const MouseEvent& rMEvt ); + void KeyInput( const KeyEvent& rKEvt ); + void KeyUp( const KeyEvent& rKEvt ); + void Paint( const Rectangle& rRect ); + void Resize(); +// FloatingWindow* GetTaskBarFrame() { return &aTaskBarFrame; } +// SoldepToolBox* GetSoldepToolBox() { return &aToolBox; } + +}; +static MyApp aMyApp; + +#endif + diff --git a/soldep/source/depper.cxx b/soldep/source/depper.cxx new file mode 100644 index 000000000000..c6a4b4899d54 --- /dev/null +++ b/soldep/source/depper.cxx @@ -0,0 +1,690 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: depper.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include <stdio.h> +#include <tools/stream.hxx> +#include <tools/debug.hxx> +#include <vcl/msgbox.hxx> +#include <svtools/prgsbar.hxx> + +#include <soldep/depper.hxx> +#include <soldep/objwin.hxx> + +#include "math.h" +#include "time.h" +#include "stdlib.h" +#include "dtsodcmp.hrc" + +#include <vcl/svapp.hxx> + +#define MIN(a,b) (a)<(b)?(a):(b) +#define MAX(a,b) (a)>(b)?(a):(b) + +ByteString sDelimiterLine("#=========================================================================="); + + + + +Depper::Depper( Window* pBaseWindow ): + Window( pBaseWindow ), + mbIsPrjView(FALSE), + maDefPos( 50, 50 ), + maDefSize( 60, 25 ), + mnViewMask( 1 ), + pSubBar( NULL ), + pMainBar( NULL ), + pSubText( NULL ), + pMainText( NULL ), + maArrangeDlg( pBaseWindow ), + mpPrjIdMapper( NULL ), + maToolBox( pBaseWindow, DtSodResId(TID_SOLDEP_MAIN) ), + maTaskBarFrame( pBaseWindow, 0) +{ + maArrangeDlg.Hide(); + + mpProcessWin = pBaseWindow; + mpGraphWin = new GraphWin( mpProcessWin, this ); + mpGraphPrjWin = new GraphWin( mpProcessWin, this ); + //mpBaseWin paints into virtual OutputDevice + mpBaseWin = new DepWin( mpGraphWin->GetBufferWindow(), WB_NOBORDER | WB_SIZEABLE | WB_AUTOSIZE ); + mpBasePrjWin = new DepWin( mpGraphPrjWin->GetBufferWindow(), WB_NOBORDER | WB_SIZEABLE | WB_AUTOSIZE ); + + mpGraphWin->SetBackground( Wallpaper( Color( COL_RED ))); + mpGraphPrjWin->SetBackground( Wallpaper( Color( COL_BLUE ))); + mpGraphPrjWin->Hide(); + mpBaseWin->SetBackground( Wallpaper( Color( COL_WHITE ))); + mpBasePrjWin->SetBackground( Wallpaper( Color( COL_LIGHTGRAY ))); +/* + mpGraphWin->SetZOrder( NULL, WINDOW_ZORDER_FIRST ); + mpGraphPrjWin->SetZOrder( NULL, WINDOW_ZORDER_FIRST ); + mpBaseWin->SetZOrder( NULL, WINDOW_ZORDER_FIRST ); +*/ + mpGraphWin->EnableClipSiblings(); + mpGraphPrjWin->EnableClipSiblings(); + + mpParentProcessWin = mpProcessWin->GetParent(); + mpBaseWin->Show(); + nZoomed = 0; + + mpBaseWin->SetPopupHdl( this ); + mpBasePrjWin->SetPopupHdl( this ); + + mpObjectList = new ObjectList(); //ObjectList unbekannt + mpObjectPrjList = new ObjectList(); +} + +Depper::~Depper() +{ +// delete mpObjectList; + delete mpBaseWin; + delete mpGraphWin; +} + +BOOL Depper::TogglePrjViewStatus() +{ + GetDepWin()->Hide(); //Hide old content window + GetGraphWin()->Hide(); + mbIsPrjView = !mbIsPrjView; //switch now + GetDepWin()->Invalidate(); + GetGraphWin()->Show(); + GetDepWin()->Show(); //Show new content window + return mbIsPrjView; +} + +void Depper::HideObjectsAndConnections( ObjectList* pObjLst ) +{ + for ( ULONG i = 0; i < pObjLst->Count(); i ++ ) { + ObjectWin *pWin = pObjLst->GetObject( i ); + pWin->Hide(); + } + mpGraphWin->Hide(); + mpBaseWin->Hide(); + mpGraphPrjWin->Show(); + mpBasePrjWin->Show(); +} + +void Depper::ShowObjectsAndConnections( ObjectList* pObjLst ) +{ + for ( ULONG i = 0; i < pObjLst->Count(); i ++ ) { + ObjectWin *pWin = pObjLst->GetObject( i ); + pWin->Show(); + } + mpBasePrjWin->Hide(); + mpGraphPrjWin->Hide(); + mpGraphWin->Show(); + mpBaseWin->Show(); +} + + +void Depper::RemoveAllObjects( ObjectList* pObjLst ) +{ + ULONG i; + + for ( i = pObjLst->Count(); i > 0; i-- ) + delete pObjLst->GetObject( i - 1 ); + pObjLst->Clear(); +} + +USHORT Depper::Save( const ByteString& rFileName ) +{ + DBG_ASSERT( FALSE , "you are dead!" ); + SvFileStream aOutFile( String( rFileName, RTL_TEXTENCODING_UTF8 ), STREAM_WRITE ); + depper_head dh; + USHORT i; + ULONG nObjCount = mpObjectList->Count(); + + ConnectorList* pConList = GetDepWin()->GetConnectorList(); + ULONG nCnctrCount = pConList->Count(); + + dh.nID = DEPPER_ID; + dh.nObjectCount = nObjCount; + dh.nCnctrCount = nCnctrCount; + + aOutFile.Write( &dh, sizeof( dh )); + + for ( i=0; i < nObjCount ; i++ ) + { + mpObjectList->GetObject( i )->Save( aOutFile ); + } + + for ( i=0; i < nCnctrCount ; i++ ) + { + pConList->GetObject( i )->Save( aOutFile ); + } + + return 0; +} + + +USHORT Depper::WriteSource() +{ + DBG_ASSERT( FALSE , "overload it!" ); + return 0; +}; + +USHORT Depper::ReadSource( BOOL bUpdater ) +{ + DBG_ASSERT( FALSE , "overload it!" ); + return 0; +}; + +USHORT Depper::OpenSource() +{ + DBG_ASSERT( FALSE , "overload it!" ); + return 0; +}; + +ObjectWin* Depper::ObjIdToPtr( ObjectList* pObjLst, ULONG nId ) +{ + ULONG nObjCount = pObjLst->Count(); + ULONG i = 0; + ObjectWin* pWin; + ULONG nWinId = 0; + + do + { + pWin = pObjLst->GetObject( i ); + nWinId = pWin->GetId(); + i++; + } + while( i < nObjCount && pWin->GetId() != nId ); + if ( pWin->GetId() == nId ) + return pWin; + else + return NULL; +} + +void Depper::SetMainProgressBar( USHORT i) +{ + if ( pMainBar ) { + pMainBar->SetValue( 100 ); + pMainBar->Update(); + } +} + +void Depper::UpdateMainProgressBar(USHORT i, USHORT nScaleVal, USHORT &nStep, BOOL bCountingDown ) +{ + ULONG val = 0; + if ( pMainBar ) { + // val = i * 50 / nScaleVal + 1; + val = bCountingDown ? 50 + ( nScaleVal - i ) * 50 / nScaleVal : i * 50 / nScaleVal; + + pMainBar->SetValue( val ); + pMainBar->Update(); + String sText( String::CreateFromAscii( "Optimize step " )); + sText += String::CreateFromInt32( ++nStep ); + pSubText->SetText( sText ); + } +} + +void Depper::UpdateSubProgrssBar(ULONG i) +{ + if ( pSubBar ) + { + pSubBar->SetValue( i ); + pSubBar->Update(); + GetpApp()->Reschedule(); + } +} + + +USHORT Depper::AutoArrangeDlgStart() +{ + pSubBar = maArrangeDlg.GetSubBar(); + pMainBar = maArrangeDlg.GetMainBar(); + pSubText = maArrangeDlg.GetSubText(); + pMainText = maArrangeDlg.GetMainText(); + pMainText->SetText( String::CreateFromAscii( "Overall status" )); + maArrangeDlg.Show(); + GetDepWin()->Enable( FALSE ); + GetDepWin()->Hide(); + return 0; +} + +USHORT Depper::AutoArrangeDlgStop() +{ + maArrangeDlg.Hide(); + GetDepWin()->Enable( TRUE ); + GetDepWin()->Show(); + pSubBar = NULL; + pMainBar = NULL; + pSubText = NULL; + pMainText = NULL; + return 0; +} + + + +USHORT Depper::Zoom( MapMode& rMapMode ) +{ + ULONG i; + ObjectWin* pWin; + Point aPos; + Size aSize; + ObjectList* pObjList; + pObjList = GetObjectList(); +// aSize = mpBaseWin->GetSizePixel(); +// mpGraphWin->SetTotalSize( aSize ); +// mpGraphWin->EndScroll( 0, 0 ); + + for ( i = pObjList->Count(); i > 0; i-- ) + { + pWin = pObjList->GetObject( i - 1 ); + aPos = pWin->PixelToLogic( pWin->GetPosPixel()); + aSize = pWin->PixelToLogic( pWin->GetSizePixel()); + pWin->SetMapMode( rMapMode ); + aPos = pWin->LogicToPixel( aPos ); + aSize = pWin->LogicToPixel( aSize ); + pWin->SetPosSizePixel( aPos, aSize ); + } + GetDepWin()->Invalidate(); + return 0; +} + +ULONG Depper::AddObjectToList( DepWin* pParentWin, ObjectList* pObjLst, ULONG &LastID, ULONG &WinCount, ByteString& rBodyText, BOOL bInteract ) +{ + Point aPos; + Size aSize = GetDefSize(); + + aPos = GetDepWin()->LogicToPixel( aPos ); + aSize = GetDepWin()->LogicToPixel( aSize ); + return AddObjectToList( pParentWin, pObjLst, LastID, WinCount, rBodyText, aPos, aSize ); +} + +ULONG Depper::AddObjectToList( DepWin* pParentWin, ObjectList* pObjLst, ULONG &LastID, ULONG &WinCount, ByteString& rBodyText, Point& rPos, Size& rSize ) +{ + ObjectWin* pWin = new ObjectWin( pParentWin, WB_BORDER ); + //pWin->mpDepperDontuseme = this; + pWin->SetGlobalViewMask(mnViewMask); // Set ViewMask for all ObjectWin and Connector objects + + Size aNewSize; + aNewSize.Width() = pWin->GetTextWidth( String( rBodyText, RTL_TEXTENCODING_UTF8 )); + aNewSize.Height() = pWin->GetTextHeight(); + if ( aNewSize.Width() > rSize.Width() - 8 ) + { + aNewSize.Width() = aNewSize.Width() + 8; + aNewSize.Height() = rSize.Height(); + } + else + aNewSize = rSize; + pWin->SetPosSizePixel( rPos,aNewSize); + + MapMode aMapMode = mpBaseWin->GetMapMode(); + pWin->SetMapMode( aMapMode ); + + pObjLst->Insert( pWin, LIST_APPEND ); + pWin->SetId( LastID ); + LastID++; + WinCount++; + pWin->SetBodyText( rBodyText ); +// pWin->Show(); + return pWin->GetId(); +} + +/*void Depper::DrawOutput( OutputDevice* pDevice ) +{ + GetDepWin()->DrawOutput( pDevice ); + ObjectList* pObjList = GetObjectList(); + for ( USHORT i = pObjList->Count(); i > 0; i-- ) + { + ObjectWin* pWin = pObjList->GetObject( i - 1 ); + pWin->DrawOutput( pDevice ); + } +}*/ + +ObjectWin* Depper::RemoveObjectFromList( ObjectList* pObjLst, ULONG &WinCount, USHORT nId, BOOL bDelete ) +{ + ObjectWin* pWin = ObjIdToPtr( pObjLst, nId ); + + if ( pWin ) + { + pObjLst->Remove( pWin ); + WinCount--; + if( bDelete ) + delete pWin; + return pWin; + } + else + return NULL; +} +USHORT Depper::AddConnectorToObjects( ObjectList* pObjLst, ULONG nStartId, ULONG nEndId ) +{ + ObjectWin* pStartWin = ObjIdToPtr( pObjLst, nStartId ); + + if ( !pStartWin ) + return DEP_STARTID_NOT_FOUND; + + ObjectWin* pEndWin = ObjIdToPtr( pObjLst, nEndId ); + + if ( !pEndWin ) + return DEP_STARTID_NOT_FOUND; + + return AddConnectorToObjects( pStartWin, pEndWin ); +} + +USHORT Depper::RemoveConnectorFromObjects( ObjectList* pObjLst, ULONG nStartId, ULONG nEndId ) +{ +// DBG_ASSERT( FALSE , "noch nicht" ); + ObjectWin* pStartWin = ObjIdToPtr( pObjLst, nStartId ); + + if ( !pStartWin ) + return DEP_STARTID_NOT_FOUND; + + ObjectWin* pEndWin = ObjIdToPtr( pObjLst, nEndId ); + + if ( !pEndWin ) + return DEP_STARTID_NOT_FOUND; + + return RemoveConnectorFromObjects( pStartWin, pEndWin ); +} + +USHORT Depper::AddConnectorToObjects( ObjectWin* pStartWin, ObjectWin* pEndWin ) +{ + if ( pStartWin->ConnectionExistsInAnyDirection( pEndWin )) + return 0; + + Connector* pCon = new Connector( GetDepWin(), WB_NOBORDER ); +// pCon->Initialize( pStartWin, pEndWin ); + if (pStartWin->IsNullObject()) //null_project + pCon->Initialize( pStartWin, pEndWin, FALSE ); + else + pCon->Initialize( pStartWin, pEndWin, TRUE ); + return 0; +} + +USHORT Depper::RemoveConnectorFromObjects( ObjectWin* pStartWin, ObjectWin* pEndWin ) +{ + Connector* pCon = pStartWin->GetConnector( pStartWin->GetId(), pEndWin->GetId() ); + + if ( !pCon ) + return DEP_CONNECTOR_NOT_FOUND; + else + { + delete pCon; + return DEP_OK; + } +} + +ULONG Depper::HandleNewPrjDialog( ByteString &rBodyText ) +{ + SolNewProjectDlg aNewProjectDlg( GetDepWin(), DtSodResId( RID_SD_DIALOG_NEWPROJECT )); + if ( aNewProjectDlg.Execute() ) + { + rBodyText = ByteString( aNewProjectDlg.maEName.GetText(), RTL_TEXTENCODING_UTF8); +//hashtable auf stand halten + MyHashObject* pHObject; + ULONG nObjectId = AddObjectToList( mpBaseWin, mpObjectList, mnSolLastId, mnSolWinCount, rBodyText, FALSE ); + pHObject = new MyHashObject( nObjectId, ObjIdToPtr( mpObjectList, nObjectId )); + mpSolIdMapper->Insert( rBodyText, pHObject ); + + ByteString sTokenLine( aNewProjectDlg.maEShort.GetText(), RTL_TEXTENCODING_UTF8 ); + sTokenLine += '\t'; + sTokenLine += ByteString( aNewProjectDlg.maEName.GetText(), RTL_TEXTENCODING_UTF8 ); + sTokenLine += "\t:\t"; + + ByteString sDeps = ByteString( aNewProjectDlg.maEDeps.GetText(), RTL_TEXTENCODING_UTF8 ); + + if ( sDeps != "" ) + { + USHORT i; + ByteString sDepName; + USHORT nToken = sDeps.GetTokenCount(' '); + for ( i = 0 ; i < nToken ; i++) + { + sDepName = sDeps.GetToken( i, ' ' ); + sTokenLine += sDepName; + sTokenLine +='\t'; + } + } + sTokenLine +="NULL"; + + mpStarWriter->InsertTokenLine( sTokenLine ); + mpStarWriter->InsertTokenLine( sDelimiterLine ); + + if ( sDeps != "" ) + { + USHORT i; + ByteString sDepName; + ULONG nObjectId_l, nHashedId; + MyHashObject* pHObject_l; + USHORT nToken = sDeps.GetTokenCount(' '); + for ( i = 0 ; i < nToken ; i++) + { + sDepName = sDeps.GetToken( i, ' ' ); + + pHObject_l = mpSolIdMapper->Find( sDepName ); + if ( !pHObject_l ) + { + String sMessage; + sMessage += String::CreateFromAscii("can't find "); + sMessage += String( sDepName, RTL_TEXTENCODING_UTF8 ); + sMessage += String::CreateFromAscii(".\ndependency ignored"); + WarningBox aBox( GetDepWin(), WB_OK, sMessage); + aBox.Execute(); + } + else + { + nHashedId = pHObject_l->GetId(); + pHObject_l = mpSolIdMapper->Find( rBodyText ); + nObjectId_l = pHObject_l->GetId(); + AddConnectorToObjects( mpObjectList, nHashedId, nObjectId_l ); + } + } + } + return nObjectId; + } + return 0; +} + +ULONG Depper::HandleNewDirectoryDialog(ByteString &rBodyText) +{ + SolNewDirectoryDlg aNewDirectoryDlg( GetDepWin(), DtSodResId( RID_SD_DIALOG_NEWDIRECTORY )); +//todo: set defaults + if ( aNewDirectoryDlg.Execute() ) + { + rBodyText = ByteString( aNewDirectoryDlg.maEFlag.GetText(), RTL_TEXTENCODING_UTF8 ); +//hashtable auf stand halten + MyHashObject* pHObject; + ULONG nObjectId = AddObjectToList( GetDepWin(), mpObjectPrjList, mnSolLastId, mnSolWinCount, rBodyText ); + pHObject = new MyHashObject( nObjectId, ObjIdToPtr( mpObjectPrjList, nObjectId )); + mpPrjIdMapper->Insert( rBodyText, pHObject ); // mpPrjIdMapper + + String sTokenLine; + sTokenLine = String( mpPrj->GetPreFix(), RTL_TEXTENCODING_UTF8 ); + sTokenLine += '\t'; + String sNameConvert = aNewDirectoryDlg.maEName.GetText(); + sNameConvert.SearchAndReplaceAll( '/', '\\' ); + if ( sNameConvert.GetToken( 0, 0x5c ) != String( mpPrj->GetProjectName(), RTL_TEXTENCODING_UTF8 )) + { + sTokenLine += String( mpPrj->GetProjectName(), RTL_TEXTENCODING_UTF8 ); + sTokenLine += String("\\", RTL_TEXTENCODING_UTF8 ); + sTokenLine += sNameConvert; + } + else + sTokenLine += sNameConvert; + sTokenLine += '\t'; + sTokenLine += aNewDirectoryDlg.maEAction.GetText(); + sTokenLine += String( "\t-\t", RTL_TEXTENCODING_UTF8 ); + sTokenLine += aNewDirectoryDlg.maEEnv.GetText(); + sTokenLine += '\t'; + sTokenLine += aNewDirectoryDlg.maEFlag.GetText(); + sTokenLine += '\t'; + + sTokenLine += String( "NULL", RTL_TEXTENCODING_UTF8 ); + + ByteString bsTokenLine = ByteString( sTokenLine, RTL_TEXTENCODING_UTF8 ); + mpStarWriter->InsertTokenLine( bsTokenLine ); + + if ( aNewDirectoryDlg.maEDeps.GetText() != String( "", RTL_TEXTENCODING_UTF8 )) + { + USHORT i; + ByteString sDeps = ByteString( aNewDirectoryDlg.maEDeps.GetText(), RTL_TEXTENCODING_UTF8 ); + ByteString sDepName; + ULONG nObjectId_l, nHashedId; + MyHashObject* pHObject_l; + USHORT nToken = sDeps.GetTokenCount(' '); + for ( i = 0 ; i < nToken ; i++) + { + sDepName = sDeps.GetToken( i, ' ' ); + + pHObject_l = mpPrjIdMapper->Find( sDepName ); // mpPrjIdMapper + if ( !pHObject_l ) + { + String sMessage; + sMessage += String::CreateFromAscii("can't find "); + sMessage += String( sDepName, RTL_TEXTENCODING_UTF8 ); + sMessage += String::CreateFromAscii(".\ndependency ignored"); + WarningBox aBox( mpBaseWin, WB_OK, sMessage); + aBox.Execute(); + } + else + { + sTokenLine += String( sDepName, RTL_TEXTENCODING_UTF8 ); + sTokenLine +='\t'; + nHashedId = pHObject_l->GetId(); + pHObject_l = mpPrjIdMapper->Find( rBodyText ); // mpPrjIdMapper + nObjectId_l = pHObject_l->GetId(); + AddConnectorToObjects( mpObjectPrjList, nHashedId, nObjectId_l ); + } + } + } + + if ( mpPrj->Count() > 1 ) + { + CommandData* pData = mpPrj->GetObject( mpPrj->Count() - 1 ); + pData = mpPrj->Replace( pData, mpPrj->Count() - 2 ); + mpPrj->Replace( pData, mpPrj->Count() - 1 ); + } + + return nObjectId; + } + return 0; +} + +// Context-Menue +IMPL_LINK( Depper, PopupSelected, PopupMenu*, mpPopup ) +{ + USHORT nItemId = mpPopup->GetCurItemId(); + + switch( nItemId ) + { + case DEPPOPUP_NEW : + { + ByteString sNewItem = ByteString("new"); + //AddObject( mpObjectList, sNewItem , TRUE ); + } + break; + case DEPPOPUP_AUTOARRANGE : + //AutoArrange( mpObjectList, mpObjectList, GetStart(), 0 ); + break; + case DEPPOPUP_LOAD : + //Load( ByteString("test.dep")); + break; + case DEPPOPUP_SAVE : + Save( ByteString("test.dep")); + break; + case DEPPOPUP_WRITE_SOURCE : + WriteSource(); + break; + case DEPPOPUP_READ_SOURCE : + ReadSource(TRUE); + break; + case DEPPOPUP_OPEN_SOURCE : + OpenSource(); + break; + case DEPPOPUP_ZOOMIN : + { +// DBG_ASSERT( FALSE,"zoomin"); + MapMode aMapMode = GetDepWin()->GetMapMode(); + aMapMode.SetScaleX( aMapMode.GetScaleX() * Fraction( 1.25 )); + aMapMode.SetScaleY( aMapMode.GetScaleY() * Fraction( 1.25 )); + GetDepWin()->SetMapMode( aMapMode ); + + if ( nZoomed < 1 ) + { + Size aZoomInSize( GetDepWin()->GetSizePixel()); + aZoomInSize.Width() *= 1.25; + aZoomInSize.Height() *= 1.25; + GetDepWin()->SetSizePixel( aZoomInSize ); + } + nZoomed--; + + Zoom( aMapMode ); + }; + break; + case DEPPOPUP_ZOOMOUT : + { +// DBG_ASSERT( FALSE,"zoomout"); + MapMode aMapMode = GetDepWin()->GetMapMode(); + if ( aMapMode.GetScaleX() > Fraction( 0.25 )) + { + aMapMode.SetScaleX( aMapMode.GetScaleX() * Fraction( 0.8 )); + aMapMode.SetScaleY( aMapMode.GetScaleY() * Fraction( 0.8 )); + GetDepWin()->SetMapMode( aMapMode ); + + if ( nZoomed < 0 ) + { + Size aZoomOutSize( mpBaseWin->GetSizePixel()); + aZoomOutSize.Width() *= 0.8; + aZoomOutSize.Height() *= 0.8; + GetDepWin()->SetSizePixel( aZoomOutSize ); + } + nZoomed++; + + Zoom( aMapMode ); + } + }; + break; + case DEPPOPUP_CLEAR : +// DBG_ASSERT( FALSE,"clear"); +// RemoveAllObjects( mpObjectList ); + break; + case DEPPOPUP_CLOSE : +// DBG_ASSERT( FALSE,"close"); + CloseWindow(); + break; + case DEPPOPUP_HELP : +// DBG_ASSERT( FALSE,"help"); + ShowHelp(); + break; + case DEPPOPUP_TEST : +// DBG_ASSERT( FALSE,"TEST!"); +// test(); + break; + case DEPPOPUP_SHOW_TOOLBOX: + maToolBox.Show(); + break; + default : + DBG_ASSERT( FALSE, "default" ); + break; + } + return 0; +}
\ No newline at end of file diff --git a/soldep/source/depwin.cxx b/soldep/source/depwin.cxx new file mode 100644 index 000000000000..2f4fe79cf410 --- /dev/null +++ b/soldep/source/depwin.cxx @@ -0,0 +1,167 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: depwin.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/debug.hxx> + +#include <soldep/depwin.hxx> +#include <soldep/depper.hxx> +#include <soldep/connctr.hxx> +#include <soldep/objwin.hxx> + +Bitmap* pWinCopy; + +DepWin::DepWin( Window* pParent, WinBits nWinStyle ) : + Window( pParent, nWinStyle ), + mbStartNewCon( FALSE ), + maNewConStart( 0, 0 ), + maNewConEnd( 0, 0 ) +// mpSelectedProject( NULL ) unbekannt +// mpCapturer( NULL ) +{ + if ( !pParent->IsChildNotify() ) + pParent->EnableChildNotify( TRUE ); +// if ( !pParent->IsAllResizeEnabled()) +// pParent->EnableAllResize( TRUE ); + SetUpdateMode( TRUE ); + SetPosSizePixel( Point(0,0), Size( 2000, 2000 )); //Size of the scrollable Window + mpPopup = new PopupMenu(); +} + +DepWin::~DepWin() +{ + Hide(); + while( ConList.Count() > 0 ) + { + delete ConList.GetObject( 0 ); + } +// if ( mpPopup ) +/// delete mpPopup; +} + +void DepWin::AddConnector( Connector* pNewCon ) +{ + ConList.Insert( pNewCon ); +} + +void DepWin::RemoveConnector( Connector* pOldCon ) +{ + ConList.Remove( pOldCon ); +} + +void DepWin::NewConnector( ObjectWin* pWin ) +{ + if ( !mbStartNewCon ) + { + mpNewConWin = pWin; + mbStartNewCon = TRUE; + maNewConStart = pWin->GetFixPoint(Point(0,0)); + } + else + { + Invalidate( Rectangle( maNewConStart, maNewConEnd )); + if ( pWin != mpNewConWin ) + { +// Connector* pConctr; +// pConctr = new Connector( this, WB_NOBORDER ); +// pConctr->Initialize( mpNewConWin, pWin ); + +// AddConnector has been moved to soldep +// mpDepperDontuseme->AddConnector( mpNewConWin, pWin ); + } + mpNewConWin = 0L; + mbStartNewCon = FALSE; + } + +} + +void DepWin::Paint( const Rectangle& rRect ) +{ + ULONG i = 0; + ULONG nListCount = ConList.Count(); + + for ( i=0 ; i < nListCount ; i++ ) + { + ConList.GetObject( i )->Paint( aEmptyRect ); + } + if ( mbStartNewCon ) + { + DrawLine( maNewConStart, maNewConEnd ); + } +} + +void DepWin::DrawOutput( OutputDevice* pDevice, const Point& rOffset ) +{ + ULONG i = 0; + ULONG nListCount = ConList.Count(); + + for ( i=0 ; i < nListCount ; i++ ) + { + ConList.GetObject( i )->DrawOutput( pDevice, rOffset ); + } + if ( mbStartNewCon ) + { + pDevice->DrawLine( maNewConStart, maNewConEnd ); + } +} + +void DepWin::MouseButtonUp( const MouseEvent& rMEvt ) +{ + if ( rMEvt.IsRight() ) + { + mpPopup->Execute( this, rMEvt.GetPosPixel()); + } +} + +void DepWin::MouseMove( const MouseEvent& rMEvt ) +{ + if ( mbStartNewCon ) + { + Invalidate( Rectangle( maNewConStart, maNewConEnd )); + maNewConEnd = PixelToLogic(rMEvt.GetPosPixel()); + maNewConStart = mpNewConWin->GetFixPoint( maNewConEnd ); + } +} + + +ConnectorList* DepWin::GetConnectorList() +{ + return &ConList; +} + +void DepWin::SetPopupHdl( void* pHdl ) +{ + mpPopup->SetSelectHdl( LINK( pHdl, Depper, PopupSelected )); +} + +void DepWin::Command( const CommandEvent& rEvent) +{ + //mpDepperDontuseme->GetGraphWin()->Command( rEvent ); + GetParent()->Command( rEvent ); +} diff --git a/soldep/source/graphwin.cxx b/soldep/source/graphwin.cxx new file mode 100644 index 000000000000..bc120fae2671 --- /dev/null +++ b/soldep/source/graphwin.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: graphwin.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <soldep/graphwin.hxx> +//#include "depapp.hxx" +#include <soldep/soldep.hxx> + + +GraphWin::GraphWin( Window * pParent, void * pClass ) +: ScrollableWindow( pParent, 0L, SCRWIN_DEFAULT | SCRWIN_VCENTER | SCRWIN_HCENTER ) +, aBufferWindow( this ) +{ + mpClass = pClass; + SetSizePixel( pParent->GetSizePixel()); + SetPosPixel( pParent->GetPosPixel()); + SetTotalSize( Size( 2000,2000 )); + + aBufferWindow.SetBackground( Wallpaper( Color( COL_WHITE ))); + aBufferWindow.SetPosSizePixel( PIXELS( 0, 0, 2000, 2000 ) ); + aBufferWindow.Show(); // Content + Show(); // Window with Scrollbars +} + +void GraphWin::EndScroll( long nDeltaX, long nDeltaY ) +{ + // get the visible area + Rectangle aArea( GetVisibleArea()); + long nX = aArea.Right(); + long nY = aArea.Bottom(); + + // set the new pos and size by using LogicToPixel (this is mandatory) + aBufferWindow.SetPosSizePixel( LogicToPixel( Point( 0, 0 )), + LogicToPixel( Size( nX, nY ))); + aBufferWindow.Invalidate(); +} + +void GraphWin::Resize() +{ + // get the visible area + ScrollableWindow::Resize(); + Rectangle aArea( GetVisibleArea()); + long nX = aArea.Right(); + long nY = aArea.Bottom(); + + // set the new pos and size by using LogicToPixel (this is mandatory) + aBufferWindow.SetPosSizePixel( LogicToPixel( Point( 0, 0 )), + LogicToPixel( Size( nX, nY ))); +} + +void GraphWin::Command( const CommandEvent& rEvent) +{ + ScrollableWindow::Command( rEvent ); +} diff --git a/soldep/source/hashobj.cxx b/soldep/source/hashobj.cxx new file mode 100644 index 000000000000..b9836316ed7b --- /dev/null +++ b/soldep/source/hashobj.cxx @@ -0,0 +1,40 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hashobj.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <soldep/hashobj.hxx> + +class ObjectWin; + + +MyHashObject::MyHashObject( ULONG nId, ObjectWin* pWin ) +{ + mnId = nId; + mpWin = pWin; +}; diff --git a/soldep/source/makefile.mk b/soldep/source/makefile.mk new file mode 100644 index 000000000000..7ababf509010 --- /dev/null +++ b/soldep/source/makefile.mk @@ -0,0 +1,150 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.17 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. + +PRJNAME=soldep +TARGET=soldep + + +# --- Settings ----------------------------------------------------- +#.INCLUDE : $(PRJ)$/util$/perl.mk +.INCLUDE : settings.mk + +# fixme, code is not yet 64 bit clean +.IF "$(OS)$(CPU)"=="LINUXX" || ("$(COM)"=="C52" && "$(CPU)"=="U") +all: + @echo nothing to do +.ENDIF + + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/soldep.obj \ + $(SLO)$/soldlg.obj \ + $(SLO)$/depper.obj \ + $(SLO)$/hashobj.obj \ + $(SLO)$/connctr.obj \ + $(SLO)$/depwin.obj \ + $(SLO)$/graphwin.obj \ + $(SLO)$/tbox.obj \ + $(SLO)$/sdtresid.obj \ + $(SLO)$/objwin.obj + +SHL1TARGET =$(TARGET)$(DLLPOSTFIX) +SHL1IMPLIB =$(TARGET) +SHL1LIBS =$(SLB)$/$(TARGET).lib \ + $(SLB)$/bootstrpdt.lib +SHL1DEF =$(MISC)$/$(SHL1TARGET).def +SHL1DEPN =$(SHL1LIBS) +SHL1STDLIBS = $(SVTOOLLIB) \ + $(CPPUHELPERLIB) \ + $(COMPHELPERLIB) \ + $(VCLLIB) \ + $(UCBHELPERLIB) \ + $(SOTLIB) \ + $(BTSTRPLIB) \ + $(TOOLSLIB) \ + $(VOSLIB) \ + $(SALLIB) \ + $(CPPULIB) \ + $(PERL_LIB) + +#.IF "$(GUI)" == "UNX" +#SHL1STDLIBS+=\ +# $(SALLIB) +#.ENDIF + + +DEF1NAME =$(SHL1TARGET) +DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt +DEFLIB1NAME =$(TARGET) + +SRC1FILES = \ + soldlg.src +RES1TARGET = dep +SRS1NAME=$(TARGET) +SRS1FILES = \ + $(SRS)$/$(TARGET).srs + +RESLIB1NAME = dep +RESLIB1SRSFILES = \ + $(SRS)$/$(TARGET).srs + + +#------------- Application --------------- +APP1TARGET=soldepl + +APP1ICON=soldep.ico + +APP1STDLIBS= \ + $(SVTOOLLIB) \ + $(CPPUHELPERLIB) \ + $(COMPHELPERLIB) \ + $(UCBHELPERLIB) \ + $(VCLLIB) \ + $(SOTLIB) \ + $(BTSTRPLIB) \ + $(TOOLSLIB) \ + $(VOSLIB) \ + $(SALLIB) \ + $(CPPULIB) \ + $(PERL_LIB) + +APP1LIBS=\ + $(SLB)$/bootstrpdt.lib \ + $(SLB)$/soldep.lib + +APP1OBJS= \ + $(SLO)$/depapp.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +ALLTAR : $(BIN)$/applicat.rdb + +$(BIN)$/applicat.rdb : makefile.mk $(UNOUCRRDB) + rm -f $@ + $(GNUCOPY) $(UNOUCRRDB) $@ + cd $(BIN) && \ + $(REGCOMP) -register -r applicat.rdb \ + -c i18nsearch.uno$(DLLPOST) \ + -c i18npool.uno$(DLLPOST) + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo Making: $@ + @echo WEP > $@ + @echo LIBMAIN >> $@ + @echo LibMain >> $@ + @echo __CT >> $@ diff --git a/soldep/source/objwin.cxx b/soldep/source/objwin.cxx new file mode 100644 index 000000000000..baa24d41fce0 --- /dev/null +++ b/soldep/source/objwin.cxx @@ -0,0 +1,824 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: objwin.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <tools/list.hxx>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/help.hxx>
+#include <vcl/wall.hxx>
+
+#include <soldep/objwin.hxx>
+#include <soldep/depwin.hxx>
+//#include "depapp.hxx"
+#include <soldep/depper.hxx>
+//#include "prjdep.hxx"
+#include <soldep/connctr.hxx>
+#include <stdio.h>
+
+static Color aDefaultColor = 0L;
+static Wallpaper* pDefaultWallpaper = 0L;
+
+// Initialize static class member
+BOOL ObjectWin::msbHideMode = FALSE;
+ULONG ObjectWin::msnGlobalViewMask = 0;
+
+
+UINT32 aColorMap[] = {
+ RGB_COLORDATA( 0xFF, 0xFF, 0x80 ), //MARKMODE_DEFAULT 0
+ COL_GREEN, //MARKMODE_DEPENDING 1
+ COL_RED, //MARKMODE_NEEDED 2
+ COL_MAGENTA, //1+2
+ COL_GRAY, //MARKMODE_ACTIVATED 4
+ COL_LIGHTGREEN, //1+4
+ COL_LIGHTRED, //2+4
+ COL_LIGHTMAGENTA, //1+2+4
+ COL_BLUE, //MARKMODE_SELECTED 8
+ COL_LIGHTGRAY, //1+8
+ COL_CYAN, //2+8
+ COL_LIGHTCYAN, //1+2+8
+ COL_LIGHTBLUE, //4+8
+ COL_BROWN, //1+4+8
+ COL_BLACK, //2+4+8
+ COL_BLUE //1+2+4+8
+};
+
+
+//
+// class ObjectWin
+//
+
+/*****************************************************************************/
+ObjectWin::ObjectWin( Window* pParent, WinBits nWinStyle )
+/*****************************************************************************/
+ : Window( pParent, nWinStyle ),
+ msBodyText( "" ),
+ msTipText( "" ),
+ mnObjectId( 0 ),
+ mnMarkMode( 0 ),
+ mnViewMask( 0 ),
+ mbVisible( FALSE ),
+ mbMenuExecute( FALSE ),
+ mbVisited( FALSE ),
+ mnRootDist( 0 ),
+ mnHeadDist( 0 ),
+ mbFixed( FALSE )
+{
+ SetBackground( Wallpaper( aColorMap[0] ));
+
+ aTipTimer.SetTimeout( 500 );
+ aTipTimer.SetTimeoutHdl(
+ LINK( this, ObjectWin, TipHdl ));
+
+ SetFont( Font( GetFont() ) );
+ Font aFont( GetFont() );
+ Size aSize = aFont.GetSize();
+ aFont.SetSize( aSize );
+ SetFont( aFont );
+
+ EnableClipSiblings();
+ SetZOrder( NULL, WINDOW_ZORDER_FIRST );
+ mpPopup = new PopupMenu();
+ mpPopup->InsertItem( OBJWIN_EDIT_TEXT, String::CreateFromAscii( "Details" ));
+ mpPopup->InsertItem( OBJWIN_ADD_CONNECTOR, String::CreateFromAscii( "New connection" ));
+ mpPopup->InsertItem( OBJWIN_REMOVE_WIN, String::CreateFromAscii( "Remove object" ));
+ mpPopup->InsertItem( OBJWIN_VIEW_CONTENT, String::CreateFromAscii( "View content" ));
+// mpPopup->InsertSeparator();
+ mpPopup->SetSelectHdl( LINK( this, ObjectWin, PopupSelected ));
+ mpPopup->SetDeactivateHdl( LINK( this, ObjectWin, PopupDeactivated ));
+ mnPopupStaticItems = mpPopup->GetItemCount();
+
+ if ( ! pDefaultWallpaper )
+ {
+ pDefaultWallpaper = new Wallpaper( GetBackground() );
+ aDefaultColor = GetTextColor();
+ }
+ Hide();
+}
+
+/*****************************************************************************/
+ObjectWin::~ObjectWin()
+/*****************************************************************************/
+{
+ while ( mConnections.Count() > 0 )
+ {
+ delete mConnections.GetObject( 0 );
+ }
+}
+
+void ObjectWin::SetHideMode(BOOL bHide)
+{
+ msbHideMode = bHide;
+ mConnections.GetObject(0)->SetHideMode(msbHideMode);
+}
+
+BOOL ObjectWin::ToggleHideMode()
+{
+ msbHideMode = !msbHideMode;
+ mConnections.GetObject(0)->SetHideMode(msbHideMode);
+ return msbHideMode;
+}
+
+/*****************************************************************************/
+void ObjectWin::SetViewMask( ULONG nMask )
+/*****************************************************************************/
+{
+ mnViewMask = nMask;
+ // Compares
+ if ( mnViewMask & msnGlobalViewMask) {
+ mbVisible = TRUE;
+ Show();
+ }
+ else {
+ Hide();
+ mbVisible = FALSE;
+ }
+ for ( ULONG i = 0; i < mConnections.Count(); i++ )
+ mConnections.GetObject( i )->UpdateVisibility();
+}
+
+/*****************************************************************************/
+void ObjectWin::SetBodyText( const ByteString& rNewString )
+/*****************************************************************************/
+{
+ msBodyText = rNewString;
+}
+
+/*****************************************************************************/
+ByteString& ObjectWin::GetBodyText()
+/*****************************************************************************/
+{
+ return msBodyText;
+}
+
+/*****************************************************************************/
+void ObjectWin::SetTipText( const ByteString& rNewString )
+/*****************************************************************************/
+{
+ msTipText = rNewString;
+}
+
+/*****************************************************************************/
+ByteString& ObjectWin::GetTipText()
+/*****************************************************************************/
+{
+ return msTipText;
+}
+
+/*****************************************************************************/
+Point ObjectWin::GetFixPoint( const Point& rRefPoint, BOOL bUseRealPos )
+/*****************************************************************************/
+{
+ Point aLocalPoint;
+ if ( bUseRealPos )
+ aLocalPoint = GetPosPixel();
+ else
+ aLocalPoint = GetCalcPosPixel();
+
+ Size aLocalSize = GetSizePixel();
+ Point aRetPoint;
+
+ USHORT nRefX = aLocalPoint.X() + aLocalSize.Width() / 2 ;
+ USHORT nRefY = aLocalPoint.Y() + aLocalSize.Height() / 2 ;
+
+ // always false...
+ //if ( nRefX < 0 ) nRefX = 0;
+ //if ( nRefY < 0 ) nRefY = 0;
+
+ if ( rRefPoint.X() > nRefX )
+ {
+ if ( rRefPoint.Y() > nRefY )
+ {
+ if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY ))
+ {
+ aRetPoint.X() = aLocalPoint.X() + aLocalSize.Width();
+ aRetPoint.Y() = nRefY;
+ }
+ else
+ {
+ aRetPoint.X() = nRefX;
+ aRetPoint.Y() = aLocalPoint.Y() + aLocalSize.Height();
+ }
+ }
+ else
+ {
+ if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY ))
+ {
+ aRetPoint.X() = aLocalPoint.X() + aLocalSize.Width();
+ aRetPoint.Y() = nRefY;
+ }
+ else
+ {
+ aRetPoint.X() = nRefX;
+ aRetPoint.Y() = aLocalPoint.Y();
+ }
+ }
+ }
+ else
+ {
+ if ( rRefPoint.Y() > nRefY )
+ {
+ if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY ))
+ {
+ aRetPoint.X() = aLocalPoint.X();
+ aRetPoint.Y() = nRefY;
+ }
+ else
+ {
+ aRetPoint.X() = nRefX;
+ aRetPoint.Y() = aLocalPoint.Y() + aLocalSize.Height();
+ }
+ }
+ else
+ {
+ if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY ))
+ {
+ aRetPoint.X() = aLocalPoint.X();
+ aRetPoint.Y() = nRefY;
+ }
+ else
+ {
+ aRetPoint.X() = nRefX;
+ aRetPoint.Y() = aLocalPoint.Y();
+ }
+ }
+ }
+
+ return PixelToLogic(aRetPoint);
+
+}
+
+/*****************************************************************************/
+void ObjectWin::AddConnector( Connector* pNewCon )
+/*****************************************************************************/
+{
+ mConnections.Insert( pNewCon );
+}
+
+/*****************************************************************************/
+BOOL ObjectWin::ConnectionExistsInAnyDirection( ObjectWin *pWin )
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < mConnections.Count(); i++ )
+ if ( mConnections.GetObject( i )->GetOtherWin( this ) == pWin )
+ return TRUE;
+
+ return FALSE;
+}
+
+/*****************************************************************************/
+void ObjectWin::RemoveConnector( Connector* pOldCon )
+/*****************************************************************************/
+{
+ mConnections.Remove( pOldCon );
+}
+
+/*****************************************************************************/
+Connector* ObjectWin::GetConnector( ULONG nIndex )
+/*****************************************************************************/
+{
+ ULONG nConCount = mConnections.Count();
+
+ if ( nIndex < nConCount )
+ return mConnections.GetObject( nIndex );
+ return NULL;
+}
+
+/*****************************************************************************/
+Connector* ObjectWin::GetConnector( ULONG nStartId, ULONG nEndId )
+/*****************************************************************************/
+{
+ if ( mnObjectId != nStartId )
+ return NULL;
+
+ USHORT i;
+ Connector* pCon;
+ ULONG nConCount = mConnections.Count();
+
+ for ( i = 0; i < nConCount; i++ )
+ {
+ pCon = mConnections.GetObject( i );
+ if ( pCon->GetOtherWin( this )->GetId() == nEndId )
+ return pCon;
+ }
+ return NULL;
+}
+
+void ObjectWin::SetAllConnectorsUnvisible()
+{
+ Connector* pCon;
+ ULONG nConCount = mConnections.Count();
+ for ( ULONG i = 0; i < nConCount; i++ )
+ {
+ pCon = mConnections.GetObject( i );
+ if (pCon) pCon->SetVisibility( FALSE );
+ }
+}
+
+/*****************************************************************************/
+void ObjectWin::SetMarkMode( ULONG nMarkMode )
+/*****************************************************************************/
+{
+ //Wallpaper aWallpaper;
+
+ if ( nMarkMode == MARKMODE_DEFAULT )
+ {
+ if ( pDefaultWallpaper )
+ {
+ maObjWallpaper = GetBackground();
+ maObjWallpaper.SetColor( pDefaultWallpaper->GetColor() );
+ SetBackground( maObjWallpaper );
+ SetTextColor( aDefaultColor );
+ }
+ }
+ else
+ {
+ mnMarkMode |= nMarkMode;
+ maObjWallpaper = GetBackground();
+ maObjWallpaper.SetColor( aColorMap[ mnMarkMode ] );
+ SetBackground( maObjWallpaper );
+ SetTextColor( COL_WHITE );
+ }
+
+ Invalidate();
+}
+
+/*****************************************************************************/
+void ObjectWin::UnsetMarkMode( ULONG nMarkMode )
+/*****************************************************************************/
+{
+ //Wallpaper aWallpaper;
+
+ ULONG nOldMode = mnMarkMode;
+ mnMarkMode &= ( !nMarkMode );
+
+ if ( nOldMode != mnMarkMode ) {
+ if ( mnMarkMode == MARKMODE_DEFAULT )
+ {
+ if ( pDefaultWallpaper )
+ {
+ maObjWallpaper = GetBackground();
+ maObjWallpaper.SetColor( pDefaultWallpaper->GetColor() );
+ SetBackground( maObjWallpaper );
+ SetTextColor( aDefaultColor );
+ }
+ }
+ else
+ {
+ maObjWallpaper = GetBackground();
+ maObjWallpaper.SetColor( aColorMap[ mnMarkMode ] ); //mnMarkMode
+ SetBackground( maObjWallpaper );
+ SetTextColor( COL_WHITE );
+ }
+ Invalidate();
+ }
+}
+
+/*****************************************************************************/
+void ObjectWin::MarkNeeded( BOOL bReset )
+/*****************************************************************************/
+{
+ Connector* pCon;
+ ObjectWin* pWin;
+
+ ULONG nConCount = mConnections.Count();
+ ULONG i;
+
+ for ( i = 0; i < nConCount; i++ )
+ {
+ pCon = mConnections.GetObject( i );
+ if ( pCon && !pCon->IsStart( this))
+ {
+ pWin = pCon->GetOtherWin( this );
+ if ( pWin )
+ {
+ if ( bReset )
+ pWin->UnsetMarkMode( MARKMODE_NEEDED );
+ else
+ pWin->SetMarkMode( MARKMODE_NEEDED );
+ pWin->MarkNeeded( bReset ); // recursive call
+ }
+ }
+ }
+}
+
+/*****************************************************************************/
+void ObjectWin::MarkDepending( BOOL bReset )
+/*****************************************************************************/
+{
+ //if ( !bReset )
+ // return;
+
+ Connector* pCon;
+ ObjectWin* pWin;
+
+ ULONG nConCount = mConnections.Count();
+ ULONG i;
+
+ for ( i = 0; i < nConCount; i++ )
+ {
+ pCon = mConnections.GetObject( i );
+ if ( pCon && pCon->IsStart( this) )
+ {
+ pWin = pCon->GetOtherWin( this );
+ if ( pWin )
+ {
+ if ( bReset )
+ pWin->UnsetMarkMode( MARKMODE_DEPENDING );
+ else
+ pWin->SetMarkMode( MARKMODE_DEPENDING );
+ pWin->MarkDepending( bReset ); // recursive call
+ }
+ }
+ }
+}
+
+/*****************************************************************************/
+void ObjectWin::Paint( const Rectangle& rRect )
+/*****************************************************************************/
+{
+ Size aWinSize = PixelToLogic( GetOutputSizePixel() );
+ Size aTextSize;
+ ByteString sbt = msBodyText; //debug
+ //sbt += " "; //debug
+ //sbt += ByteString::CreateFromInt32(mnMarkMode); //debug
+ aTextSize.Width() = GetTextWidth( String( msBodyText, RTL_TEXTENCODING_UTF8 ));
+ aTextSize.Height() = GetTextHeight();
+ Point aPos( aWinSize.Width() / 2 - aTextSize.Width() / 2,
+ aWinSize.Height() / 2 - aTextSize.Height() / 2 );
+
+ //DrawText( aPos , String( sBodyText, RTL_TEXTENCODING_UTF8 ));
+ if (msBodyText =="null") //don't paint this "window"
+ {
+ Hide();
+ Invalidate();
+ } else
+ DrawText( aPos , String( sbt, RTL_TEXTENCODING_UTF8 )); //debug
+}
+
+void ObjectWin::DrawOutput( OutputDevice* pDevice, const Point& rOffset )
+/*****************************************************************************/
+{
+ Size aWinSize = PixelToLogic( GetSizePixel() );
+ Size aTextSize;
+ ByteString sbt = msBodyText;
+ aTextSize.Width() = GetTextWidth( String( msBodyText, RTL_TEXTENCODING_UTF8 ));
+ aTextSize.Height() = GetTextHeight();
+ Point aPos = GetPosPixel();
+ Point aTextPos( aWinSize.Width() / 2 - aTextSize.Width() / 2,
+ aWinSize.Height() / 2 - aTextSize.Height() / 2 );
+ aTextPos += aPos;
+ aPos = pDevice->PixelToLogic( aPos ) - rOffset;
+ aTextPos = pDevice->PixelToLogic( aTextPos ) - rOffset;
+ if ( msBodyText !="null" )
+ {
+ pDevice->SetFillColor( GetBackground().GetColor() );
+ pDevice->DrawRect( Rectangle( aPos, pDevice->PixelToLogic( GetSizePixel() ) ) );
+ Font aFont( GetFont() );
+ Size aSize = aFont.GetSize();
+ aSize = pDevice->PixelToLogic( aSize );
+ aFont.SetSize( aSize );
+ pDevice->SetFont( aFont );
+ pDevice->SetTextColor( GetTextColor() );
+ pDevice->DrawText( aTextPos, String( sbt, RTL_TEXTENCODING_UTF8 ) );
+ }
+}
+
+/*****************************************************************************/
+void ObjectWin::MouseButtonDown( const MouseEvent& rMEvt )
+/*****************************************************************************/
+{
+ //Notify Soldep to clear ObjectList
+ SetZOrder( NULL, WINDOW_ZORDER_FIRST );
+ GrabFocus();
+
+ // workaround fuer vcl-bug
+// GetWindow( WINDOW_REALPARENT)->Invalidate();
+// MyApp *pApp = (MyApp*)GetpApp();
+// SolDep *pSoldep = pApp->GetSolDep();
+
+ maMouseOffset = rMEvt.GetPosPixel();
+ if ( rMEvt.IsLeft() )
+ {
+
+ if ( rMEvt.IsMod2() ) // alt + mouse click left
+ {
+ CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN_ALT, this );
+ }
+ else {
+ CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN, this );
+ }
+ if( rMEvt.GetClicks() == 2 )
+ CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN_DBLCLICK, this );
+ else if ( !rMEvt.IsShift() && !((DepWin*)GetParent())->IsStartNewCon())
+ {
+ //((DepWin*)GetParent())->SaveSelectedObjWin(&this);
+ CaptureMouse();
+ }
+ }
+}
+
+/*****************************************************************************/
+void ObjectWin::MouseButtonUp( const MouseEvent& rMEvt )
+/*****************************************************************************/
+{
+ fprintf(stdout,"ObjectWin::MouseButtonUp\n");
+ if ( rMEvt.IsLeft() )
+ {
+ if ( rMEvt.IsShift() || ((DepWin*)GetParent())->IsStartNewCon())
+ CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_UP_SHFT, this );
+// ((DepWin*)GetParent())->NewConnector( this );
+ else
+ {
+ CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_UP, this );
+ if ( IsMouseCaptured() ) ReleaseMouse();
+ }
+ }
+ else if ( rMEvt.IsRight() )
+ {
+ USHORT i;
+
+ while ( mnPopupStaticItems < mpPopup->GetItemCount() )
+ {
+ mpPopup->RemoveItem( mnPopupStaticItems );
+ }
+
+ if ( mConnections.Count()) {
+ mpPopup->InsertSeparator();
+
+ for( i = 0; i < mConnections.Count() ; i++ )
+ {
+ mpPopup->InsertItem( mnPopupStaticItems + i + 1, String( ((mConnections.GetObject( i ))->GetOtherWin( this ))->GetBodyText(), RTL_TEXTENCODING_UTF8 ));
+ }
+ }
+ mbMenuExecute = TRUE;
+ mpPopup->Execute( GetParent(), rMEvt.GetPosPixel() + GetPosPixel());
+ }
+}
+
+/*****************************************************************************/
+void ObjectWin::MouseMove( const MouseEvent& rMEvt )
+/*****************************************************************************/
+{
+ if ( IsMouseCaptured() )
+ {
+ USHORT i;
+
+ Point aNewWinPos( GetPosPixel() + rMEvt.GetPosPixel() - maMouseOffset );
+
+ aNewWinPos.X() = Max( 0L, aNewWinPos.X());
+ aNewWinPos.Y() = Max( 0L, aNewWinPos.Y());
+ SetPosPixel( aNewWinPos );
+ //int t = mConnections.Count();
+
+ for ( i=0; i < mConnections.Count();i++)
+ {
+ mConnections.GetObject( i )->UpdatePosition( this );
+ }
+ }
+ else // !IsMouseCaptured()
+ {
+ if ( rMEvt.IsLeaveWindow() )
+ aTipTimer.Stop();
+ else
+ aTipTimer.Start();
+
+ MouseEvent aNewMEvt( rMEvt.GetPosPixel() + GetPosPixel());
+
+ GetParent()->MouseMove( aNewMEvt ); //call to DepWin::MouseMove
+ }
+}
+
+/*****************************************************************************/
+USHORT ObjectWin::Save( SvFileStream& rOutFile )
+/*****************************************************************************/
+{
+ return 0;
+}
+
+/*****************************************************************************/
+USHORT ObjectWin::Load( SvFileStream& rInFile )
+/*****************************************************************************/
+{
+ return 0;
+}
+
+/*****************************************************************************/
+void ObjectWin::SetId( ULONG nId )
+/*****************************************************************************/
+{
+ mnObjectId = nId;
+}
+
+/*****************************************************************************/
+ULONG ObjectWin::GetId()
+/*****************************************************************************/
+{
+ return mnObjectId;
+}
+
+/*****************************************************************************/
+void ObjectWin::UpdateConnectors()
+/*****************************************************************************/
+{
+ USHORT i;
+
+ for ( i = 0; i < mConnections.Count(); i++ )
+ {
+ mConnections.GetObject( i )->UpdatePosition( this );
+ }
+}
+
+IMPL_LINK( ObjectWin, PopupSelected, PopupMenu*, mpPopup_l )
+{
+ USHORT nItemId = mpPopup_l->GetCurItemId();
+
+ switch( nItemId )
+ {
+ case OBJWIN_EDIT_TEXT :
+ DBG_ASSERT( FALSE,"edit");
+ break;
+ case OBJWIN_REMOVE_WIN :
+// DBG_ASSERT( FALSE,"remove");
+// DBG_ASSERT( mpDepperDontuseme,"remove");
+ //mpDepperDontuseme->RemoveObject(mpDepperDontuseme->mpObjectList, ( USHORT ) GetId());
+ break;
+ case OBJWIN_ADD_CONNECTOR :
+// DBG_ASSERT( FALSE,"add con");
+ ((DepWin*)GetParent())->NewConnector( this );
+ break;
+ case OBJWIN_VIEW_CONTENT :
+// DBG_ASSERT( FALSE,"view cnt");
+// mpDepperDontuseme->ViewContent( msBodyText );
+// TBD: CallEventListener
+ break;
+ default :
+// DBG_ASSERT( FALSE, String (nItemId) );
+ Connector* pCon = mConnections.GetObject( nItemId - mnPopupStaticItems - 1);
+ pCon = 0;
+// delete pCon;
+// mpDepperDontuseme->RemoveConnector( pCon->GetStartId(), pCon->GetEndId());
+// TBD: CallEventListener
+
+ break;
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+IMPL_LINK( ObjectWin, TipHdl, void *, EMTY_ARG )
+/*****************************************************************************/
+{
+ aTipTimer.Stop();
+
+ if ( msTipText.Len()) {
+ Point aPos( GetpApp()->GetAppWindow()->GetPointerPosPixel());
+ Help::ShowBalloon( GetpApp()->GetAppWindow(),
+ Point( aPos.X(), aPos.Y()),
+ String( msTipText, RTL_TEXTENCODING_UTF8 ));
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+//void ObjectWin::GetFocus()
+/*****************************************************************************/
+//{
+ //SetMarkMode( MARKMODE_SELECTED );
+//}
+
+/*****************************************************************************/
+void ObjectWin::LoseFocus()
+/*****************************************************************************/
+{
+ if ( !mbMenuExecute && !msbHideMode ) {
+ UnsetMarkMode( MARKMODE_SELECTED );
+ UnsetMarkMode( MARKMODE_ACTIVATED );
+ MarkNeeded( TRUE );
+ MarkDepending( TRUE );
+ }
+ else
+ mbMenuExecute = FALSE;
+}
+
+/*****************************************************************************/
+IMPL_LINK( ObjectWin, PopupDeactivated, PopupMenu*, mpPopup_l )
+/*****************************************************************************/
+{
+ mbMenuExecute = FALSE;
+
+ if ( !HasFocus()) {
+ UnsetMarkMode( MARKMODE_SELECTED );
+ UnsetMarkMode( MARKMODE_ACTIVATED );
+ MarkNeeded( TRUE );
+ MarkDepending( TRUE );
+ }
+
+ return 0;
+}
+
+/*****************************************************************************/
+void ObjectWin::Command( const CommandEvent& rEvent)
+/*****************************************************************************/
+{
+ fprintf(stdout, "ObjectWin::Command");
+// mpDepperDontuseme->GetGraphWin()->Command( rEvent );
+// TBD: CallEventListener
+
+}
+
+/*****************************************************************************/
+/*****************************************************************************/
+
+ObjectList::ObjectList() : ObjWinList()
+{
+}
+
+/*****************************************************************************/
+void ObjectList::ResetSelectedObject()
+/*****************************************************************************/
+{
+// return;
+
+ ULONG nCount_l = Count();
+ ObjectWin* pObjectWin = NULL;
+ for (ULONG i=0; i < nCount_l; i++ )
+ {
+ pObjectWin = GetObject( i );
+ pObjectWin->UnsetMarkMode( MARKMODE_SELECTED );
+ pObjectWin->UnsetMarkMode( MARKMODE_NEEDED );
+ pObjectWin->UnsetMarkMode( MARKMODE_DEPENDING );
+ pObjectWin->SetActualWallpaper(*pDefaultWallpaper);
+ pObjectWin->SetAllConnectorsUnvisible();
+ }
+ return;
+}
+
+/*****************************************************************************/
+ObjectWin* ObjectList::GetPtrByName( const ByteString& rText )
+/*****************************************************************************/
+{
+ ULONG i = 0;
+ ULONG nCount_l = Count();
+ ObjectWin* pObjectWin = NULL;
+ while ( i < nCount_l )
+ {
+ pObjectWin = GetObject( i );
+ ByteString sPrj = pObjectWin->GetBodyText();
+ if (sPrj == rText) return pObjectWin;
+ i++;
+ }
+ return 0;
+}
+
+ObjectList* ObjectList::FindTopLevelModules()
+{
+ ObjectList* pList = new ObjectList;
+ for ( USHORT i=0; i<Count(); i++ )
+ {
+ ObjectWin* pObjectWin = GetObject( i );
+ if ( pObjectWin->IsTop() )
+ pList->Insert( pObjectWin );
+ }
+
+ return pList;
+}
+
+BOOL ObjectWin::IsTop()
+{
+ ULONG nConCount = mConnections.Count();
+ for ( ULONG i = 0; i < nConCount; i++ )
+ {
+ Connector* pCon = mConnections.GetObject( i );
+ if ( pCon && pCon->IsStart( this) )
+ return FALSE;
+ }
+
+ return TRUE;
+}
\ No newline at end of file diff --git a/soldep/source/sdtresid.cxx b/soldep/source/sdtresid.cxx new file mode 100644 index 000000000000..b4f3edb51d66 --- /dev/null +++ b/soldep/source/sdtresid.cxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdtresid.cxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <soldep/sdtresid.hxx> + +SolDevDll::SolDevDll() +{ + *(SolDevDll**)GetAppData( SHL_SCH ) = this; + + ByteString aResMgrName( "dep" ); + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), + Application::GetSettings().GetUILocale() ); +} + +SolDevDll::~SolDevDll() +{ + delete pResMgr; +} + +DtSodResId::DtSodResId( USHORT nId ) : +ResId(nId, *(*(SolDevDll**)GetAppData( SHL_SCH ))->GetResMgr()) +{ +} + diff --git a/soldep/source/soldep.cxx b/soldep/source/soldep.cxx new file mode 100644 index 000000000000..bc4d096f764e --- /dev/null +++ b/soldep/source/soldep.cxx @@ -0,0 +1,1810 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: soldep.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+//TBD: ToolBox handling prjview/back
+
+#include <osl/file.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <bootstrp/sstring.hxx>
+#include <svtools/filedlg.hxx>
+#include <tools/iparser.hxx>
+#include <tools/geninfo.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/bitmap.hxx>
+#include <appdef.hxx>
+#include "time.h"
+#include <soldep/depper.hxx>
+#include <soldep/soldep.hxx>
+#include <soldep/soldlg.hxx>
+#include "dtsodcmp.hrc"
+
+IMPLEMENT_HASHTABLE_OWNER( SolIdMapper, ByteString, ULONG* );
+//IMPLEMENT_HASHTABLE_OWNER( PrjIdMapper, ByteString, ULONG* );
+#define EVENT_RESIZE 0x00000001
+#define MIN(a,b) (a)<(b)?(a):(b)
+#define MAX(a,b) (a)>(b)?(a):(b)
+
+
+//ByteString sDelimiterLine("#==========================================================================");
+
+
+//
+// class SolDep
+//
+
+/*****************************************************************************/
+SolDep::SolDep( Window* pBaseWindow )
+/*****************************************************************************/
+ : Depper( pBaseWindow ),
+ mbBServer(FALSE),
+ mpTravellerList( NULL ),
+ mbIsHide( FALSE )
+{
+ mnSolWinCount = 0;
+ mnSolLastId = 0;
+// mpPrjIdMapper = new SolIdMapper( 63997 );
+ maTaskBarFrame.EnableAlwaysOnTop();
+ maTaskBarFrame.Show();
+ maToolBox.SetPosSizePixel( Point( 0,0 ), Size( 1100,35 ));
+ maToolBox.SetSelectHdl( LINK ( this, SolDep, ToolSelect ));
+ maToolBox.Show();
+
+ mpBaseWin->AddChildEventListener( LINK( this, SolDep, ChildWindowEventListener ));
+
+ // Kontext-Menue (gehrt zu soldep.cxx)
+ InitContextMenueMainWnd();
+ InitContextMenuePrjViewWnd( mpBasePrjWin );
+}
+
+/*****************************************************************************/
+SolDep::~SolDep()
+/*****************************************************************************/
+{
+ mpBaseWin->RemoveChildEventListener( LINK( this, SolDep, ChildWindowEventListener ) );
+ delete mpSolIdMapper;
+ delete mpStarWriter;
+ delete mpStandLst;
+}
+
+/*****************************************************************************/
+void SolDep::Init()
+/*****************************************************************************/
+{
+ InformationParser aParser;
+ String sStandLst( GetDefStandList(), RTL_TEXTENCODING_ASCII_US );
+ mpStandLst = aParser.Execute( sStandLst );
+ ByteString aUpdater( getenv("UPDATER") );
+ if ( mpStandLst && (aUpdater == "YES") ) {
+ if ( GetVersion() )
+ ReadSource( TRUE );
+ } else
+ {
+ ReadSource(); // if stand.lst isn't available
+ }
+}
+
+/*****************************************************************************/
+void SolDep::Init( ByteString &rVersion, GenericInformationList *pVersionList )
+/*****************************************************************************/
+{
+ // Interface for bs
+ mbBServer=TRUE;
+ if ( pVersionList )
+ mpStandLst = new GenericInformationList( *pVersionList );
+ else {
+ InformationParser aParser;
+ String sStandLst( GetDefStandList(), RTL_TEXTENCODING_ASCII_US );
+ mpStandLst = aParser.Execute( sStandLst );
+ }
+ if ( mpStandLst ) {
+ msVersionMajor = ByteString( rVersion );
+ ReadSource(TRUE); //call from build server set UPDATER to TRUE
+ }
+}
+
+/*****************************************************************************/
+IMPL_LINK( SolDep, ChildWindowEventListener, VclSimpleEvent*, pEvent )
+/*****************************************************************************/
+{
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+ {
+ ProcessChildWindowEvent( *static_cast< VclWindowEvent* >( pEvent ) );
+ }
+ return 0;
+}
+
+
+/*****************************************************************************/
+void SolDep::ProcessChildWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+/*****************************************************************************/
+{
+ Window* pChildWin = _rVclWindowEvent.GetWindow();
+// Window* pParentWin = pChildWin->GetParent();
+//Resize();
+ if ( isAlive() )
+ {
+ ULONG id = _rVclWindowEvent.GetId();
+ switch ( id )
+ {
+ case VCLEVENT_USER_MOUSEBUTTON_DOWN:
+ {
+ ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin);
+ if( pObjWin )
+ {
+ // handle mouse click on ObjectWin object
+ ObjectWin* pWin = (ObjectWin*) pChildWin;
+ //GetObjectList()->ResetSelectedObject();
+ if (IsHideMode()) // simple mouse click left
+ {
+ pWin->CaptureMouse();
+ pWin->SetMarkMode( MARKMODE_SELECTED );
+ pWin->MarkNeeded();
+ pWin->MarkDepending();
+ pWin->Invalidate();
+ } else
+ {
+ pWin->LoseFocus();
+ pWin->SetMarkMode( MARKMODE_SELECTED );
+ pWin->UnsetMarkMode( MARKMODE_ACTIVATED );
+ pWin->MarkNeeded( TRUE );
+ pWin->MarkDepending( TRUE );
+ }
+
+ }
+ }
+ break;
+ case VCLEVENT_USER_MOUSEBUTTON_DOWN_ALT:
+ {
+ ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin);
+ if( pObjWin )
+ {
+ ObjectWin* pWin = (ObjectWin*) pChildWin;
+ MarkObjects( pWin );
+ }
+ }
+ break;
+ case VCLEVENT_USER_MOUSEBUTTON_DOWN_DBLCLICK:
+ {
+ ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin);
+ if( pObjWin )
+ {
+ if (IsHideMode()) ToggleHideDependency();
+ ByteString text = ((ObjectWin*) pChildWin)->GetBodyText();
+ ViewContent(text);
+ }
+ }
+ break;
+ case VCLEVENT_USER_MOUSEBUTTON_UP_SHFT:
+ {
+ ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin);
+ if( pObjWin )
+ {
+ ObjectWin* pWin = (ObjectWin*) pChildWin;
+ GetDepWin()->NewConnector( pWin );
+ }
+ }
+ break;
+ case VCLEVENT_USER_MOUSEBUTTON_UP:
+ {
+ ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin);
+ if( pObjWin )
+ {
+ ObjectWin* pWin = (ObjectWin*) pChildWin;
+ pWin->ReleaseMouse();
+ pWin->SetMarkMode(MARKMODE_SELECTED);
+ GetDepWin()->Invalidate();
+ }
+ }
+ break;
+ } // switch
+ } // if isAlive
+ //fprintf(stdout,"BLA::Resize: %d\n",pChildWin);
+}
+
+/*****************************************************************************/
+IMPL_LINK( SolDep, ToolSelect, SoldepToolBox* , pBox)
+/*****************************************************************************/
+{
+ USHORT nItemId = pBox->GetCurItemId();
+ switch ( nItemId )
+ {
+ case TID_SOLDEP_FIND:
+ FindProject();
+ break;
+ case TID_SOLDEP_CREATEMETA :
+ {
+ VirtualDevice aVDev;
+ aVDev.SetMapMode( MAP_100TH_MM );
+ GDIMetaFile aMtf;
+ aVDev.EnableOutput( FALSE );
+ aMtf.Record( &aVDev );
+
+ aVDev.SetLineColor( Color( COL_BLACK ) );
+ aVDev.SetTextAlign( ALIGN_TOP );
+
+ Size aSize( GetDepWin()->GetOutputSizePixel() );
+ long nXMin = aSize.Width();
+ long nXMax = 0;
+ long nYMax = 0;
+ long nYMin = aSize.Height();
+
+ for ( USHORT i=0; i<mpObjectList->Count(); i++ )
+ {
+ Point aPoint = mpObjectList->GetObject(i)->GetPosPixel();
+ Size aSize = mpObjectList->GetObject(i)->GetSizePixel();
+ nXMin = MIN( aPoint.X(), nXMin );
+ nXMax = MAX( aPoint.X() + aSize.Width(), nXMax );
+ nYMin = MIN( aPoint.Y(), nYMin );
+ nYMax = MAX( aPoint.Y() + aSize.Height(), nYMax );
+ }
+
+ Point aOffset( nXMin, nYMin );
+ aOffset = aVDev.PixelToLogic( aOffset );
+
+ GetDepWin()->DrawOutput( &aVDev, aOffset );
+ for ( USHORT i=0; i<mpObjectList->Count(); i++ )
+ if ( mpObjectList->GetObject(i)->IsVisible() )
+ mpObjectList->GetObject(i)->DrawOutput( &aVDev, aOffset );
+
+ aMtf.Stop();
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode( aVDev.GetMapMode() );
+ Size aDevSize( nXMax-nXMin + 10, nYMax-nYMin + 10);
+ aDevSize = aVDev.PixelToLogic( aDevSize );
+ aMtf.SetPrefSize( aDevSize );
+ SvFileStream aStream( String::CreateFromAscii("d:\\out.svm"), STREAM_STD_READWRITE );
+ aMtf.Write( aStream );
+ break;
+ }
+ case TID_SOLDEP_HIDE_INDEPENDEND:
+ {
+ ToggleHideDependency();
+ for ( USHORT i=0; i<mpObjectList->Count(); i++ )
+ mpObjectList->GetObject(i)->SetViewMask(!mbIsHide);
+
+ maToolBox.CheckItem(TID_SOLDEP_HIDE_INDEPENDEND, IsHideMode());
+ GetDepWin()->Invalidate(); //repaint Main-View
+ }
+ break;
+ case TID_SOLDEP_SELECT_WORKSPACE:
+ if (mpStandLst)
+ {
+ if (GetVersion()) // Version dialog box
+ {
+ delete mpSolIdMapper;
+ delete mpStarWriter;
+ mpObjectList->ClearAndDelete();
+ ReadSource(TRUE);
+ }
+ }
+ break;
+ case TID_SOLDEP_BACK:
+ maToolBox.HideItem(TID_SOLDEP_BACK);
+ maToolBox.ShowItem(TID_SOLDEP_SELECT_WORKSPACE); //disabled for prj view (doubleclick ObjWin)
+ maToolBox.ShowItem(TID_SOLDEP_HIDE_INDEPENDEND); //disabled for prj view (doubleclick ObjWin)
+ maToolBox.ShowItem(TID_SOLDEP_FIND); //disabled for prj view (doubleclick ObjWin)
+ maToolBox.Resize();
+ TogglePrjViewStatus();
+ break;
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+void SolDep::ToggleHideDependency()
+/*****************************************************************************/
+{
+ mbIsHide = !mbIsHide;
+ maToolBox.CheckItem(TID_SOLDEP_HIDE_INDEPENDEND, IsHideMode());
+ ObjectWin* pWin = GetObjectList()->GetObject( 0 );
+ pWin->ToggleHideMode();
+};
+
+/*****************************************************************************/
+BOOL SolDep::GetVersion()
+/*****************************************************************************/
+{
+ SolSelectVersionDlg aVersionDlg( GetDepWin(), mpStandLst );
+ if ( aVersionDlg.Execute() == RET_OK ) {
+ msVersionMajor = aVersionDlg.GetVersionMajor();
+ msVersionMinor = aVersionDlg.GetVersionMinor();
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void SolDep::InitContextMenueMainWnd()
+{
+ InitContextMenuePrjViewWnd( mpBaseWin );
+ return; // Disable not actually supported items
+
+ mpBaseWin->mpPopup->InsertItem( DEPPOPUP_AUTOARRANGE, String::CreateFromAscii("Autoarrange")) ;
+ mpBaseWin->mpPopup->InsertSeparator();
+ mpBaseWin->mpPopup->InsertItem( DEPPOPUP_READ_SOURCE, String::CreateFromAscii("Revert all changes") );
+ mpBaseWin->mpPopup->InsertSeparator();
+ mpBaseWin->mpPopup->InsertItem( DEPPOPUP_OPEN_SOURCE, String::CreateFromAscii("Open") );
+ mpBaseWin->mpPopup->InsertItem( DEPPOPUP_WRITE_SOURCE, String::CreateFromAscii("Save") );
+}
+
+void SolDep::InitContextMenuePrjViewWnd(DepWin* pBaseWin )
+{
+ // temp. disabled pBaseWin->mpPopup->InsertItem( DEPPOPUP_NEW, String::CreateFromAscii("New object") );
+ pBaseWin->mpPopup->InsertItem( DEPPOPUP_ZOOMIN, String::CreateFromAscii("Zoom in") );
+ pBaseWin->mpPopup->InsertItem( DEPPOPUP_ZOOMOUT, String::CreateFromAscii("Zoom out") );
+ pBaseWin->mpPopup->InsertSeparator();
+ // temp disabled pBaseWin->mpPopup->InsertItem( DEPPOPUP_CLEAR, String::CreateFromAscii("Clear") );
+ pBaseWin->mpPopup->InsertItem( DEPPOPUP_SHOW_TOOLBOX, String::CreateFromAscii("Show Toolbox") );
+}
+
+/*****************************************************************************/
+ObjectWin *SolDep::RemoveObject( USHORT nId, BOOL bDelete )
+/*****************************************************************************/
+{
+ Prj* pPrj;
+
+//hshtable auf stand halten
+ ObjectWin* pWin = RemoveObjectFromList( mpObjectList, mnSolWinCount, nId, FALSE );
+ if ( pWin )
+ {
+ ByteString aBodyText( pWin->GetBodyText() );
+ if( (pPrj = mpStarWriter->GetPrj( aBodyText )) )
+ {
+ mpStarWriter->Remove( pPrj );
+//cleanup ist teuer...
+ mpStarWriter->CleanUp();
+ delete pPrj;
+ }
+ else
+ DBG_ASSERT( FALSE, "project not found - write" );
+
+ mpSolIdMapper->Delete( aBodyText );
+ if ( bDelete )
+ delete pWin;
+ return pWin;
+ }
+ else
+ return NULL;
+}
+
+/*****************************************************************************/
+ULONG SolDep::AddObject( ByteString& rBodyText, BOOL bInteract )
+/*****************************************************************************/
+{
+ ULONG nObjectId;
+ if ( bInteract )
+ {
+ nObjectId = HandleNewPrjDialog( rBodyText );
+ }
+ else
+ {
+//hashtable auf stand halten
+ MyHashObject* pHObject;
+ nObjectId = AddObjectToList( mpBaseWin, mpObjectList, mnSolLastId, mnSolWinCount, rBodyText, FALSE );
+ pHObject = new MyHashObject( nObjectId, ObjIdToPtr(mpObjectList, nObjectId ));
+ mpSolIdMapper->Insert( rBodyText, pHObject );
+ }
+ return nObjectId;
+}
+
+/*****************************************************************************/
+ULONG SolDep::AddPrjObject( ByteString& rBodyText, BOOL bInteract )
+/*****************************************************************************/
+{
+ ULONG nObjectId;
+ if ( bInteract )
+ {
+ nObjectId = HandleNewDirectoryDialog( rBodyText );
+ }
+ else
+ {
+//hshtable auf stand halten
+ MyHashObject* pHObject;
+ nObjectId = AddObjectToList( mpBasePrjWin, mpObjectPrjList, mnPrjLastId, mnPrjWinCount, rBodyText );
+ pHObject = new MyHashObject( nObjectId, ObjIdToPtr( mpObjectPrjList, nObjectId ));
+ mpPrjIdMapper->Insert( rBodyText, pHObject ); // mpPrjIdMapper
+ }
+ return nObjectId;
+}
+
+/*****************************************************************************/
+USHORT SolDep::AddConnector( ObjectWin* pStartWin, ObjectWin* pEndWin )
+/*****************************************************************************/
+{
+// DBG_ASSERT( FALSE , "not yet" );
+ ByteString sEndName = pEndWin->GetBodyText();
+ ByteString sStartName = pStartWin->GetBodyText();
+
+ Prj* pPrj = mpStarWriter->GetPrj( sEndName );
+ if ( pPrj )
+ {
+ pPrj->AddDependencies( sStartName );
+ return AddConnectorToObjects( pStartWin, pEndWin );
+ }
+ else
+ {
+ DBG_ASSERT( FALSE , "non existing Project" );
+ return 1;
+ }
+}
+
+/*****************************************************************************/
+USHORT SolDep::RemoveConnector( ObjectWin* pStartWin, ObjectWin* pEndWin )
+/*****************************************************************************/
+{
+ SByteStringList* pPrjDeps = NULL;
+ ByteString sEndName = pEndWin->GetBodyText();
+ ByteString sStartName = pStartWin->GetBodyText();
+
+ Prj* pPrj = mpStarWriter->GetPrj( sEndName );
+ pPrjDeps = pPrj->GetDependencies( FALSE );
+ if ( pPrjDeps )
+ {
+ ByteString* pString;
+ ULONG nPrjDepsCount = pPrjDeps->Count();
+ for ( ULONG j = nPrjDepsCount; j > 0; j-- )
+ {
+ pString = pPrjDeps->GetObject( j - 1 );
+ if ( pString->GetToken( 0, '.') == sStartName )
+ pPrjDeps->Remove( pString );
+ }
+ }
+
+ return RemoveConnectorFromObjects( pStartWin, pEndWin );
+}
+
+/*****************************************************************************/
+void SolDep::RemoveAllObjects( ObjectList* pObjLst )
+/*****************************************************************************/
+{
+
+ Depper::RemoveAllObjects( pObjLst );
+
+ if ( mpSolIdMapper )
+ {
+ delete mpSolIdMapper;
+ mpSolIdMapper = NULL;
+ }
+ if ( mpStarWriter )
+ {
+ delete mpStarWriter;
+ mpStarWriter = NULL;
+ }
+}
+
+/*****************************************************************************/
+ULONG SolDep::GetStart(SolIdMapper* pIdMapper, ObjectList* pObjList)
+/*****************************************************************************/
+{
+// DBG_ASSERT( FALSE , "soldep" );
+ MyHashObject* pHObject = pIdMapper->Find( "null" );//null_project
+
+ if ( !pHObject ) {
+ ByteString sNullPrj = "null";//null_project
+ ULONG nObjectId = AddObject( sNullPrj, FALSE );
+ ObjIdToPtr( pObjList, nObjectId )->SetViewMask( 1 );
+ return nObjectId;
+ }
+
+ return pHObject->GetId();
+}
+
+/*****************************************************************************/
+ULONG SolDep::GetStartPrj(SolIdMapper* , ObjectList* )
+/*****************************************************************************/
+{
+// DBG_ASSERT( FALSE , "prjdep" );
+ MyHashObject* pHObject = mpPrjIdMapper->Find( ByteString( "null" ) ); //null_dir
+ if ( !pHObject )
+ {
+ ByteString bsNull("null");
+ ULONG nObjectId = AddPrjObject( bsNull, FALSE); //null_dir
+ return nObjectId;
+ }
+ else
+ return pHObject->GetId();
+}
+
+/*****************************************************************************/
+USHORT SolDep::OpenSource()
+/*****************************************************************************/
+{
+ if ( mpStandLst ) {
+ if ( GetVersion())
+ return ReadSource();
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+USHORT SolDep::ReadSource(BOOL bUpdater)
+/*****************************************************************************/
+{
+ mpBaseWin->EnablePaint( FALSE );
+ mpBaseWin->Hide();
+ ULONG nObjectId, nHashedId;
+ ULONG i;
+ MyHashObject* pHObject;
+ ByteString* pStr;
+ ObjectWin *pStartWin, *pEndWin;
+
+ mpSolIdMapper = new SolIdMapper( 63997 );
+ if (mpStandLst && bUpdater)
+ {
+ mpStarWriter = new StarWriter( mpStandLst, msVersionMajor, msVersionMinor, TRUE );
+ } else
+ {
+ SolarFileList* pSolarFileList;
+ pSolarFileList = GetPrjListFromDir();
+ mpStarWriter = new StarWriter( pSolarFileList, TRUE );
+ }
+ ByteString sTitle( SOLDEPL_NAME );
+ if ( mpStarWriter->GetMode() == STAR_MODE_SINGLE_PARSE ) {
+ sTitle += ByteString( " - mode: single file [" );
+ sTitle += (ByteString) mpStarWriter->GetName();
+ sTitle += ByteString( "]" );
+ }
+ else if ( mpStarWriter->GetMode() == STAR_MODE_MULTIPLE_PARSE ) {
+ sTitle += ByteString( " - mode: multiple files [" );
+ sTitle += ByteString( "]" );
+ }
+ SetTitle( String( sTitle, RTL_TEXTENCODING_UTF8) );
+
+ ULONG nCount = mpStarWriter->Count();
+ for ( i=0; i<nCount; i++ )
+ {
+ Prj *pPrj = mpStarWriter->GetObject(i);
+ ByteString sPrjName = pPrj->GetProjectName();
+ nObjectId = AddObject( sPrjName, FALSE );
+ ObjIdToPtr( mpObjectList, nObjectId )->SetViewMask( 1 );
+ }
+ for ( i=0; i<nCount; i++ )
+ {
+ Prj *pPrj = mpStarWriter->GetObject(i);
+ SByteStringList *pLst = pPrj->GetDependencies( FALSE );
+ if ( pLst )
+ {
+ ULONG nDepCount = pLst->Count();
+ for ( ULONG m=0; m<nDepCount; m++)
+ {
+ pStr = pLst->GetObject(m);
+ pHObject = mpSolIdMapper->Find( *pStr );
+ /*if ( !pHObject )
+ {
+ // create new prj
+ Prj *pNewPrj = new Prj( *pStr );
+ ByteString sPrjName = pNewPrj->GetProjectName();
+ nObjectId = AddObject( sPrjName, FALSE );
+ pHObject = mpSolIdMapper->Find( *pStr );
+ ObjIdToPtr( mpObjectList, nObjectId )->SetViewMask( 2 );
+ }*/
+
+ if ( pHObject )
+ {
+ nHashedId = pHObject->GetId();
+ ByteString sF_Os2 = pPrj->GetProjectName();
+ pStr = &sF_Os2;
+ pHObject = mpSolIdMapper->Find( *pStr );
+ nObjectId = pHObject->GetId();
+ pStartWin = ObjIdToPtr( mpObjectList, nHashedId );
+ pEndWin = ObjIdToPtr( mpObjectList, nObjectId );
+ AddConnectorToObjects( pStartWin, pEndWin );
+ }
+ }
+ }
+ }
+ if (!IsPrjView())
+ {
+ AutoArrange( mpSolIdMapper, mpObjectList, GetStart(mpSolIdMapper,mpObjectList), 0, GetStart(mpSolIdMapper,mpObjectList) );
+ GetDepWin()->EnablePaint( TRUE );
+ }
+ return 0;
+}
+
+SolarFileList* SolDep::GetPrjListFromDir()
+{
+ SolarFileList* pSolarFileList = new SolarFileList();
+ String sPrjDir( String::CreateFromAscii( "prj" ));
+ String sBuildLst( String::CreateFromAscii( "build.lst" ));
+ DirEntry aCurrent( getenv( SOURCEROOT ) );
+
+ aCurrent.ToAbs();
+ Dir aDir( aCurrent, FSYS_KIND_DIR );
+
+ USHORT nEntries = aDir.Count();
+ if( nEntries )
+ {
+ UniStringList aSortDirList;
+ for ( USHORT n = 0; n < nEntries; n++ )
+ {
+ DirEntry& rEntry = aDir[n];
+ UniString aName( rEntry.GetName() );
+ if( aName.Len() && ( aName.GetChar(0) != '.' ) && rEntry.Exists() )
+ {
+ rEntry += DirEntry( sPrjDir );
+ rEntry += DirEntry( sBuildLst );
+ if (rEntry.Exists())
+ {
+ pSolarFileList->Insert( new String( rEntry.GetFull() ), LIST_APPEND );
+ ByteString aName_dbg(rEntry.GetFull(),RTL_TEXTENCODING_UTF8);
+ fprintf(stdout, "bla:%s\n", aName_dbg.GetBuffer());
+ }
+ }
+ }
+ }
+ if ( !pSolarFileList->Count() )
+ {
+ //is empty!! TBD
+ delete pSolarFileList;
+ return NULL;
+ }
+ return pSolarFileList;
+}
+
+/*****************************************************************************/
+USHORT SolDep::WriteSource()
+/*****************************************************************************/
+{
+/* zur Sicherheit deaktiviert
+ USHORT nMode = mpStarWriter->GetMode();
+ if ( nMode == STAR_MODE_SINGLE_PARSE ) {
+ ByteString sFileName = mpStarWriter->GetName();
+ if ( sFileName.Len()) {
+ mpStarWriter->Write( String( sFileName, RTL_TEXTENCODING_UTF8) );
+ mpStarWriter->RemoveProject( ByteString( "null")); //null_project
+ }
+ }
+ else if ( nMode == STAR_MODE_MULTIPLE_PARSE ) {
+ // *OBO*
+ //String sRoot = mpStarWriter->GetSourceRoot();
+ //nicht mehr untersttzt mpStarWriter->GetSourceRoot()
+ ByteString sFileName = mpStarWriter->GetName();
+ DirEntry aEntry( sFileName );
+ aEntry.ToAbs();
+ aEntry = aEntry.GetPath().GetPath().GetPath();
+ String sRoot = aEntry.GetFull();
+
+ if ( sRoot.Len()) {
+ mpStarWriter->RemoveProject( ByteString( "null")); //null_project
+ mpStarWriter->WriteMultiple( sRoot );
+ }
+ }
+*/
+ return 1;
+}
+
+USHORT SolDep::Load( const ByteString& rFileName )
+{
+// moved from depper class
+ DBG_ASSERT( FALSE , "you are dead!" );
+ SvFileStream aInFile( String( rFileName, RTL_TEXTENCODING_UTF8 ), STREAM_READ );
+ depper_head dh;
+ ULONG i;
+ ULONG nLoadOffs = mnSolLastId; //or Prj??
+ ObjectWin* pNewWin;
+ aInFile.Read( &dh, sizeof( dh ));
+
+ ULONG nObjCount = dh.nObjectCount;
+ ULONG nCnctrCount = dh.nCnctrCount;
+
+ for ( i=0; i < nObjCount ; i++ )
+ {
+ ObjectWin* pWin = new ObjectWin( mpBaseWin, WB_BORDER );
+ pWin->Load( aInFile );
+ pNewWin = ObjIdToPtr( mpObjectList, AddObjectToList( mpBaseWin, mpObjectList, mnSolLastId, mnSolWinCount, pWin->GetBodyText(), FALSE ));
+ pNewWin->SetId( nLoadOffs + pWin->GetId());
+ pNewWin->SetPosPixel( pWin->GetPosPixel());
+ pNewWin->SetSizePixel( pWin->GetSizePixel());
+ }
+
+ ULONG nStartId;
+ ULONG nEndId;
+// ueber addconnector fuehren!
+ for ( i=0; i < nCnctrCount ; i++ )
+ {
+ Connector* pCon = new Connector( mpBaseWin, WB_NOBORDER );
+ pCon->Load( aInFile );
+
+ nStartId = nLoadOffs + pCon->GetStartId();
+ nEndId = nLoadOffs + pCon->GetEndId();
+
+ ObjectWin* pStartWin = ObjIdToPtr( mpObjectList, nStartId );
+ ObjectWin* pEndWin = ObjIdToPtr( mpObjectList, nEndId );
+
+ pCon->Initialize( pStartWin, pEndWin );
+ }
+
+
+ return 0;
+}
+
+/*****************************************************************************/
+BOOL SolDep::ViewContent( ByteString& rObjectName )
+/*****************************************************************************/
+{
+ mpFocusWin = NULL;
+ SetPrjViewStatus(TRUE);
+
+ for ( ULONG i = 0; i < mpObjectList->Count() && !mpFocusWin; i++ )
+ if ( mpObjectList->GetObject( i )->HasFocus())
+ mpFocusWin = mpObjectList->GetObject( i );
+ //HideObjectsAndConnections( mpObjectList );
+ mpProcessWin->Resize();
+ GetDepWin()->Show();
+ return InitPrj( rObjectName );
+}
+
+/*****************************************************************************/
+BOOL SolDep::InitPrj( ByteString& rListName )
+/*****************************************************************************/
+{
+ ULONG nObjectId, nHashedId;
+ ULONG i, j;
+ MyHashObject* pHObject;
+ ByteString *pDepName;
+ ByteString *pFlagName;
+ Prj* pPrj;
+ ObjectWin *pStartWin, *pEndWin;
+ maToolBox.HideItem(TID_SOLDEP_SELECT_WORKSPACE);
+ maToolBox.HideItem(TID_SOLDEP_HIDE_INDEPENDEND);
+ maToolBox.HideItem(TID_SOLDEP_FIND);
+ maToolBox.ShowItem(TID_SOLDEP_BACK);
+ maToolBox.Invalidate();
+
+ //clean up
+ mpObjectPrjList->ClearAndDelete();
+ GetDepWin()->ClearConnectorList();
+ if (mpPrjIdMapper) delete mpPrjIdMapper;
+ mpPrjIdMapper = new SolIdMapper( 63997 ); //generate clean mapper
+ mnPrjWinCount = 0;
+ mnPrjLastId = 0;
+
+ ULONG nCount = mpStarWriter->Count();
+ GetDepWin()->EnablePaint( FALSE );
+ Point aPnt = GetGraphWin()->GetPosPixel();
+ Size aSize = GetGraphWin()->GetSizePixel();
+
+ GetGraphWin()->SetPosSizePixel( aPnt, aSize ); // Hier wird das Window gesetzt
+
+ BOOL bReturn = FALSE;
+
+ for ( i=0; i<nCount; i++ )
+ {
+// pPrj->GetProjectName() returns the name of
+// the project e.g. svtools
+ pPrj = mpStarWriter->GetObject(i);
+ ByteString sPrjName = pPrj->GetProjectName();
+ if ( sPrjName == rListName )
+ {
+ bReturn = TRUE;
+
+ mpPrj = mpStarWriter->GetObject(i);
+ ULONG nDirCount = mpPrj->Count();
+ for ( j=0; j<nDirCount; j++ )
+ {
+ CommandData *pData = mpPrj->GetObject(j);
+ fprintf( stdout, "\tProjectDir : %s\n",
+ pData->GetLogFile().GetBuffer());
+// pData->GetLogFile() contains internal project IDs
+// e.g. st_mkout etc.
+ if ( pData->GetLogFile() != "" )
+ {
+ ByteString sItem = pData->GetLogFile();
+ nObjectId = AddPrjObject( sItem, FALSE);
+// there may be faster ways......
+ ObjectWin *pWin = ObjIdToPtr( mpObjectPrjList, nObjectId );
+ pWin->SetViewMask( 0x0001 );
+// pData->GetPath() contains internal project directories
+// e.g. svtools/inc etc.
+ ByteString sPath = pData->GetPath();
+ pWin->SetTipText( sPath );
+ }
+ }
+
+// set connectors for dependencies here
+ for ( j=0; j<nDirCount; j++ )
+ {
+ CommandData *pData = mpPrj->GetObject(j);
+ SByteStringList *pDeps = pData->GetDependencies();
+ if ( pDeps )
+ {
+ ByteString sFlagName = pData->GetLogFile();
+ pFlagName = &sFlagName;
+ //pHObject = mpPrjIdMapper->Find( (*pFlagName).GetToken( 0, '.'));//mpSolIdMapper see ReadSource()
+ pHObject = mpPrjIdMapper->Find( sFlagName.GetToken( 0, '.'));
+ if (pHObject)
+ {
+
+ nObjectId = pHObject->GetId();
+
+ ULONG nDepCount = pDeps->Count();
+ for ( ULONG k=0; k<nDepCount; k++ )
+ {
+ pDepName = pDeps->GetObject(k);
+ pHObject = mpPrjIdMapper->Find( (*pDepName).GetToken( 0, '.'));
+ if (pHObject )
+ {
+ nHashedId = pHObject->GetId();
+ pStartWin = ObjIdToPtr( mpObjectPrjList, nHashedId );
+ pEndWin = ObjIdToPtr( mpObjectPrjList, nObjectId );
+
+ AddConnectorToObjects( pStartWin, pEndWin );
+ }
+ else
+ {
+ String sMessage;
+ sMessage += String::CreateFromAscii("can't find ");
+ sMessage += String( *pDepName, RTL_TEXTENCODING_UTF8 );
+ sMessage += String::CreateFromAscii(".\ndependency ignored");
+ WarningBox aBox( GetDepWin(), WB_OK, sMessage);
+ aBox.Execute();
+ }
+ }
+ }
+ }
+
+ }
+
+ break;
+ }
+ }
+ ByteString sNullDir = "null";
+ nObjectId = AddPrjObject( sNullDir, FALSE);
+ ObjectWin *pWin = ObjIdToPtr( mpObjectPrjList, nObjectId );
+ pWin->SetViewMask( 0x0001 );
+ mpGraphPrjWin->EnablePaint( TRUE );
+ //debug
+// int test_l = GetStartPrj(mpPrjIdMapper, mpObjectPrjList);
+// ObjectWin *pTestWin = ObjIdToPtr( mpObjectPrjList, test_l );
+ AutoArrange( mpPrjIdMapper, mpObjectPrjList, GetStartPrj(mpPrjIdMapper, mpObjectPrjList), 0, GetStartPrj(mpPrjIdMapper, mpObjectPrjList) );
+ mpGraphWin->Hide();
+ mpGraphPrjWin->Show();
+ mpGraphPrjWin->Invalidate();
+
+ return bReturn;
+}
+
+/*****************************************************************************/
+USHORT SolDep::CloseWindow()
+/*****************************************************************************/
+{
+
+ ((SystemWindow*)mpProcessWin)->Close();
+ return 0;
+}
+
+/*****************************************************************************/
+void SolDep::ShowHelp()
+/*****************************************************************************/
+{
+ SvFileStream aHelpFile( String::CreateFromAscii( "g:\\soldep.hlp" ), STREAM_READ );
+ String aHelpText;
+ ByteString aGetStr;
+
+ if ( aHelpFile.IsOpen() )
+ {
+ while ( aHelpFile.ReadLine( aGetStr ) )
+ {
+ aHelpText += String (aGetStr, RTL_TEXTENCODING_UTF8);
+ aHelpText += String::CreateFromAscii("\n");
+ }
+ }
+ else
+ aHelpText = String::CreateFromAscii("No Helpfile found.");
+
+ SolHelpDlg aHelpDlg( mpBaseWin, DtSodResId( RID_SD_DIALOG_HELP ));
+ aHelpDlg.maMLEHelp.SetText( aHelpText );
+ aHelpDlg.maMLEHelp.SetReadOnly();
+ aHelpDlg.maMLEHelp.EnableFocusSelectionHide( TRUE );
+ aHelpDlg.Execute();
+}
+
+/*****************************************************************************/
+BOOL SolDep::FindProject()
+/*****************************************************************************/
+{
+ SolFindProjectDlg aFindProjectDlg( GetDepWin(), GetObjectList() );
+ ObjectWin* pObjectWin = NULL;
+ mpObjectList->ResetSelectedObject();
+ if (IsHideMode())
+ {
+ GetDepWin()->Invalidate();
+ }
+
+ mpFocusWin=NULL;
+
+ if ( aFindProjectDlg.Execute() == RET_OK ) {
+ msProject = aFindProjectDlg.GetProject();
+ //now we have a project string
+
+ pObjectWin = mpObjectList->GetPtrByName( msProject );
+ if (pObjectWin)
+ {
+ mpObjectList->ResetSelectedObject();
+ MarkObjects( pObjectWin );
+ }
+ else
+ {
+ mpObjectList->ResetSelectedObject();
+ for ( USHORT i=0; i<mpObjectList->Count(); i++ )
+ {
+ ObjectWin* pObjectWin = mpObjectList->GetObject( i );
+ if ( !pObjectWin->IsTop() )
+ pObjectWin->SetViewMask(FALSE);
+ }
+ }
+ }
+ return FALSE;
+}
+
+BOOL SolDep::MarkObjects( ObjectWin* pObjectWin )
+{
+ if (pObjectWin)
+ {
+ if (!(pObjectWin->IsNullObject()))
+ {
+ pObjectWin->SetMarkMode( MARKMODE_SELECTED );
+ pObjectWin->MarkNeeded();
+ pObjectWin->MarkDepending();
+ if (IsHideMode())
+ {
+ GetDepWin()->Invalidate();
+ }
+ } else
+ {
+ fprintf(stdout,"null\n");
+ }
+ }
+ return TRUE;
+}
+
+void SolDep::Resize()
+{
+//funzt! mu aber von der applikation aufgerufen werden.
+ Point aOutPos = Point( 0, 0 );
+ Size aOutSize = mpProcessWin->GetOutputSizePixel();
+ // calculate output size
+ ULONG nTaskHeight = maToolBox.CalcWindowSizePixel().Height();
+ ULONG nTaskWidth = maToolBox.CalcWindowSizePixel().Width();
+ Size aSize( aOutSize.Width(), nTaskHeight );
+
+// ULONG nMenuHeight = 0;
+ Point aGraphWinPos = Point(0,0);
+ Size aGraphWinSize = Size(0,0);
+
+//wei nicht wie: nMenuHeight = aMenuBar.GetWindow()->GetSizePixel().Height(); //Hhe des Menues
+
+ //aInRect = pTBManager->Resize( Rectangle( aOutPos, aOutSize );
+ // Set Docking-Rectangle for ToolBar
+ Rectangle aInRect;
+
+ if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_TOP ))
+ {
+ // waagerechte Toolbar oben
+ maToolBox.SetPosSizePixel( aOutPos, Size( aOutSize.Width(), maToolBox.CalcWindowSizePixel().Height()));
+ if( maToolBox.IsVisible())
+ {
+ Point aOutPosTmp;
+ Size aOutSizeTmp;
+ aOutPosTmp = Point( aOutPos.X(), aOutPos.Y() + maToolBox.CalcWindowSizePixel().Height());
+ aOutSizeTmp = Size( aOutSize.Width(), aOutSize.Height() - maToolBox.CalcWindowSizePixel().Height());
+ aInRect = Rectangle( aOutPosTmp, aOutSizeTmp );
+ aGraphWinPos = Point( 0, nTaskHeight );
+ aGraphWinSize = Size( aOutSize.Width(), aOutSize.Height() - nTaskHeight);
+ }
+ }
+ if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_BOTTOM ))
+ {
+ // waagerechte Toolbar unten
+ Point aTbPos = Point( aOutPos.X(), aOutPos.Y() + aOutSize.Height() - maToolBox.CalcWindowSizePixel().Height());
+ Size aTbSize = Size( aOutSize.Width(), maToolBox.CalcWindowSizePixel().Height());
+ maToolBox.SetPosSizePixel( aTbPos, aTbSize );
+ if( maToolBox.IsVisible())
+ {
+ Point aOutPosTmp;
+ Size aOutSizeTmp;
+ aOutPosTmp = Point( aOutPos.X(), aOutPos.Y() + maToolBox.CalcWindowSizePixel().Height());
+ aOutSizeTmp = Size( aOutSize.Width(), aOutSize.Height() - maToolBox.CalcWindowSizePixel().Height());
+ aInRect = Rectangle( aOutPosTmp, aOutSizeTmp );
+ aGraphWinPos = Point( 0, 0 );
+ aGraphWinSize = Size( aOutSize.Width(), aOutSize.Height() - nTaskHeight);
+ }
+ }
+ if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_LEFT ))
+ {
+ // senkrechte ToolBar links
+ maToolBox.SetPosSizePixel( aOutPos, Size( maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height()));
+ if( maToolBox.IsVisible())
+ {
+ Point aOutPosTmp;
+ Size aOutSizeTmp;
+ aOutPosTmp = Point( aOutPos.X() + maToolBox.CalcWindowSizePixel().Width(), aOutPos.Y());
+ aOutSizeTmp = Size( aOutSize.Width()- maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height());
+ aInRect = Rectangle( aOutPosTmp, aOutSizeTmp );
+ aGraphWinPos = Point( nTaskWidth, 0 );
+ aGraphWinSize = Size( aOutSize.Width() - nTaskWidth, aOutSize.Height());
+ }
+ }
+ if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_RIGHT ))
+ {
+ // senkrechte ToolBar rechts
+ Point aTbPos = Point( aOutPos.X() + aOutSize.Width() - maToolBox.CalcWindowSizePixel().Width(), aOutPos.Y());
+ Size aTbSize= Size( maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height());
+ maToolBox.SetPosSizePixel( aTbPos, aTbSize);
+ if( maToolBox.IsVisible())
+ {
+ Point aOutPosTmp;
+ Size aOutSizeTmp;
+ aOutPosTmp = Point( aOutPos.X() + maToolBox.CalcWindowSizePixel().Width(), aOutPos.Y());
+ aOutSizeTmp = Size( aOutSize.Width()- maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height());
+ aInRect = Rectangle( aOutPosTmp, aOutSizeTmp );
+ aGraphWinPos = Point( 0, 0 );
+ aGraphWinSize = Size( aOutSize.Width() - nTaskWidth, aOutSize.Height());
+ }
+ }
+
+ Rectangle rout = Rectangle( Point( 0,0 ), aOutSize ); //OutputToScreenPixel( aOutPos )
+ Rectangle rin = Rectangle( Point( 0,0 ),//OutputToScreenPixel( Point( aOutPos.X() - 20, aInRect.Top())
+ Size( aOutSize.Width(), aOutSize.Height()));
+/*
+ Rectangle rout = mpProcessWin->OutputToScreenPixel( aOutPos );
+ Rectangle rin = Rectangle( Point( 0,0 ),//OutputToScreenPixel( Point( aOutPos.X() - 20, aInRect.Top())
+ Size( aOutSize.Width(), aOutSize.Height()));
+*/
+ maToolBox.SetDockingRects( rout, rin );
+
+ BOOL bFloating = maToolBox.IsFloatingMode();
+
+ if ( bFloating )
+ {
+ GetGraphWin()->SetPosSizePixel(Point(0,0),aOutSize);
+ //if (IsPrjView() && (mpPrjDep)) mpPrjDep->Resize();
+ if (maToolBox.IsVisible()) maToolBox.Show();
+ } else
+ {
+ GetGraphWin()->SetPosSizePixel( aGraphWinPos, aGraphWinSize );
+ }
+ if (maToolBox.IsVisible()) maToolBox.Show();
+}
+
+USHORT SolDep::AddConnectorPrjView( ObjectWin* pStartWin, ObjectWin* pEndWin )
+{
+// DBG_ASSERT( FALSE , "not yet" );
+ ByteString sEndName = pEndWin->GetBodyText();
+ ByteString sStartName = pStartWin->GetBodyText();
+ if ( sStartName != ByteString("null"))
+ {
+ CommandData* pEndData = mpPrj->GetDirectoryData( sEndName );
+ SByteStringList* pDeps = pEndData->GetDependencies();
+ if ( pDeps )
+ pDeps->PutString( &sStartName );
+ else
+ {
+ pDeps = new SByteStringList();
+ pEndData->SetDependencies( pDeps );
+ pDeps->PutString( &sStartName );
+ pEndData->GetDependencies();
+ }
+ }
+ return AddConnectorToObjects( pStartWin, pEndWin );
+}
+
+USHORT SolDep::RemoveConnectorPrjView( ObjectWin* pStartWin, ObjectWin* pEndWin )
+{
+ ByteString sEndName = pEndWin->GetBodyText();
+ ByteString sStartName = pStartWin->GetBodyText();
+ CommandData* pEndData = mpPrj->GetDirectoryData( sEndName );
+ SByteStringList* pDeps = pEndData->GetDependencies();
+ if ( pDeps )
+ {
+ ByteString* pString;
+ ULONG nDepsCount = pDeps->Count();
+ for ( ULONG j = nDepsCount; j > 0; j-- )
+ {
+ pString = pDeps->GetObject( j - 1 );
+ if ( pString->GetToken( 0, '.') == sStartName )
+ pDeps->Remove( pString );
+ }
+ }
+ return RemoveConnectorFromObjects( pStartWin, pEndWin );
+}
+
+USHORT SolDep::AutoArrange( SolIdMapper* pIdMapper, ObjectList* pObjLst, ULONG nTopId, ULONG nBottmId, ULONG aObjID )
+{
+ AutoArrangeDlgStart();
+ OptimizePos(pIdMapper, pObjLst, nTopId, nBottmId, aObjID );
+ AutoArrangeDlgStop();
+ return 0;
+}
+
+Point SolDep::CalcPos( USHORT nSet, USHORT nIndex )
+{
+ int nRowIndex = nIndex / DEPPER_MAX_WIDTH;
+ ULONG nPosX = mnXOffset + nRowIndex % 3 * GetDefSize().Width() / 3 + ( nIndex - ( DEPPER_MAX_WIDTH * nRowIndex )) * (GetDefSize().Width() + OBJWIN_X_SPACING );
+
+ ULONG nPosY = ( nSet + mnLevelOffset + nRowIndex ) * ( GetDefSize().Height() + OBJWIN_Y_SPACING ) + OBJWIN_Y_SPACING;
+ Point aPos( nPosX, nPosY );
+ return aPos;
+}
+
+ULONG SolDep::CalcXOffset( ULONG nObjectsToFit )
+{
+ long nDynXOffs;
+ long nXMiddle;
+ ULONG nTrigger;
+
+ nXMiddle = GetDepWin()->PixelToLogic( GetDepWin()->GetSizePixel()).Width() / 2;
+ if ( nObjectsToFit > DEPPER_MAX_WIDTH )
+ nObjectsToFit = DEPPER_MAX_WIDTH - 1 + DEPPER_MAX_WIDTH % 2;
+ nTrigger = ( nObjectsToFit - 1 ) / 2;
+ nDynXOffs = ( GetDefSize().Width() + OBJWIN_X_SPACING ) * nTrigger;
+ ULONG nXOffs = nXMiddle - nDynXOffs;
+
+ if ( ULONG(nXMiddle - nDynXOffs) < mnMinDynXOffs )
+ mnMinDynXOffs = nXMiddle - nDynXOffs;
+
+ return nXOffs;
+
+}
+
+double SolDep::CalcDistSum( ObjWinList* pObjList, DistType eDistType )
+{
+ ObjectWin* pWin;
+ Connector* pCon;
+ ULONG nObjCount = pObjList->Count();
+ double dRetVal = 0;
+ double dWinVal;
+ USHORT i, j;
+ BOOL bIsStart;
+
+ for ( i = 0; i < nObjCount; i++ )
+ {
+ pWin = pObjList->GetObject( i );
+
+ if ( pWin && pWin->IsVisible())
+ {
+ j = 0;
+ dWinVal = 0;
+ while ( (pCon = pWin->GetConnector( j )) )
+ {
+ if ( pCon->IsVisible()) {
+ bIsStart = pCon->IsStart( pWin );
+ if ( eDistType != BOTH )
+ if ( eDistType == TOPDOWN )
+ {
+ if ( bIsStart )
+ {
+ pCon->UpdatePosition( pWin, FALSE );
+ dWinVal += pCon->GetLen() * pWin->mnHeadDist;
+ }
+ }
+ else
+ {
+ if ( !bIsStart )
+ {
+ pCon->UpdatePosition( pWin, FALSE );
+ dWinVal += pCon->GetLen() * pWin->mnRootDist;
+ }
+
+ }
+ else
+ {
+ pCon->UpdatePosition( pWin, FALSE );
+ if ( !bIsStart )
+ dWinVal += pCon->GetLen() * ( pWin->mnHeadDist + 1 );
+ else
+ dWinVal += pCon->GetLen() * pWin->mnRootDist;
+ }
+ }
+ j++;
+ }
+// if ( j != 0 )
+// dWinVal /= j;
+ dRetVal += dWinVal;
+ }
+ }
+
+ return dRetVal;
+}
+
+USHORT SolDep::Impl_Traveller( ObjectWin* pWin, USHORT nDepth )
+{
+ USHORT i = 0;
+ ObjectWin* pNewWin;
+ Connector* pCon;
+
+ nDepth++;
+
+ USHORT nMaxDepth = nDepth;
+
+ pWin->mbVisited = TRUE;
+ pWin->mnRootDist = Max ( nDepth, pWin-> mnRootDist );
+ if ( nDepth > DEPPER_MAX_DEPTH )
+ {
+ DBG_ASSERT( nDepth != DEPPER_MAX_DEPTH + 1, "Ringabhngigkeit!" );
+ nDepth++;
+ return DEP_ENDLES_RECURSION_FOUND;
+ }
+
+ while ( (pCon = pWin->GetConnector( i )) )
+ {
+ if ( pCon->IsStart( pWin )&& pCon->IsVisible() ) //removed: don't show null_project
+ {
+ pNewWin = pCon->GetOtherWin( pWin );
+ nMaxDepth = Max( Impl_Traveller( pNewWin, nDepth ), nMaxDepth );
+ if( nMaxDepth == DEP_ENDLES_RECURSION_FOUND )
+ {
+ mpTravellerList->Insert( pWin, LIST_APPEND );
+ return DEP_ENDLES_RECURSION_FOUND;
+ }
+ }
+ i++;
+ }
+ pWin->mnHeadDist = MAX( pWin->mnHeadDist, nMaxDepth - nDepth );
+ return nMaxDepth;
+}
+
+
+double SolDep::Impl_PermuteMin( ObjWinList& rObjList, Point* pPosArray, ObjWinList& rResultList, double dMinDist, ULONG nStart, ULONG nSize, DistType eDistType )
+{
+
+ ULONG i, j, l;
+ ULONG nEnd = nStart + nSize;
+ ObjectWin* pSwapWin;
+ ULONG nLevelObjCount = rObjList.Count();
+
+//dont use full recusion for more than 6 objects
+ if ( nLevelObjCount > 6 )
+ {
+ srand(( unsigned ) time( NULL ));
+
+ ULONG nIdx1, nIdx2;
+ for ( i = 0; i < 101; i++ )
+ {
+ UpdateSubProgrssBar(i);
+ for ( j = 0; j < 100; j++ )
+ {
+ nIdx1 = (ULONG) ( double( rand() ) / RAND_MAX * nLevelObjCount );
+ while ( rObjList.GetObject( nIdx1 ) == NULL )
+ nIdx1 = (ULONG) ( double( rand() ) / RAND_MAX * nLevelObjCount );
+ nIdx2 = (ULONG) ( double( rand() ) / RAND_MAX * nLevelObjCount );
+ while ( nIdx1 == nIdx2 || nIdx2 == nLevelObjCount )
+ nIdx2 = (ULONG) ( double( rand() ) / RAND_MAX * nLevelObjCount );
+
+ pSwapWin = rObjList.GetObject( nIdx1 );
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( pPosArray[ nIdx2 ] );
+ pSwapWin = rObjList.Replace( pSwapWin, nIdx2 );
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( pPosArray[ nIdx1 ] );
+ rObjList.Replace( pSwapWin, nIdx1 );
+
+ double dCurDist = CalcDistSum( &rObjList, eDistType );
+
+ if ( dCurDist < dMinDist )
+ {
+ dMinDist = dCurDist;
+ rResultList.Clear();
+ for ( l = 0; l < nLevelObjCount; l++ )
+ {
+ pSwapWin = rObjList.GetObject( l );
+ rResultList.Insert( pSwapWin, LIST_APPEND);
+ }
+ }
+// if ( dCurDist > dMinDist * 1.5 )
+ if ( dCurDist > dMinDist * 15 )
+ {
+ pSwapWin = rObjList.GetObject( nIdx1 );
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( pPosArray[ nIdx2 ] );
+ pSwapWin = rObjList.Replace( pSwapWin, nIdx2 );
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( pPosArray[ nIdx1 ] );
+ rObjList.Replace( pSwapWin, nIdx1 );
+ }
+ }
+ }
+ }
+ else
+ {
+ for ( i = nStart ; i < nEnd; i++)
+ {
+ if ( nSize > 1 )
+ {
+ pSwapWin = rObjList.GetObject( i );
+ pSwapWin = rObjList.Replace( pSwapWin, nStart );
+ rObjList.Replace( pSwapWin, i );
+ double dPermuteDist = Impl_PermuteMin( rObjList, pPosArray, rResultList, dMinDist, nStart + 1, nSize - 1, eDistType );
+ dMinDist = MIN( dMinDist, dPermuteDist);
+ pSwapWin = rObjList.GetObject( i );
+ pSwapWin = rObjList.Replace( pSwapWin, nStart );
+ rObjList.Replace( pSwapWin, i );
+
+ }
+ else
+ {
+ for ( l = 0; l < nLevelObjCount; l++ )
+ {
+ pSwapWin = rObjList.GetObject( l );
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( pPosArray[ l ] );
+ }
+
+ double dCurDist = CalcDistSum( &rObjList, eDistType );
+
+ if ( dCurDist < dMinDist )
+ {
+ dMinDist = dCurDist;
+ rResultList.Clear();
+ for ( l = 0; l < nLevelObjCount; l++ )
+ {
+ pSwapWin = rObjList.GetObject( l );
+ rResultList.Insert( pSwapWin, LIST_APPEND);
+ }
+ }
+
+ }
+ }
+ }
+
+ return dMinDist;
+}
+
+
+USHORT SolDep::OptimizePos(SolIdMapper* pIdMapper, ObjectList* pObjLst, ULONG nTopId, ULONG nBottmId, ULONG aObjID )
+{
+ ObjWinList aWorkList;
+ ObjectWin* pWin;
+ Connector* pCon;
+ USHORT nRootDist = (USHORT) -1;
+ USHORT i, j, k, l, nRetVal;
+ USHORT LevelUse[ DEPPER_MAX_DEPTH ];
+ USHORT LevelSecUse[ DEPPER_MAX_DEPTH ];
+ ObjWinList* LevelList[ DEPPER_MAX_DEPTH ];
+ ObjWinList* LevelSecList[ DEPPER_MAX_DEPTH ];
+ Point aPosArray[ DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH ];
+
+ mnMinDynXOffs = 0xffff;
+
+ for ( i = 0; i < DEPPER_MAX_DEPTH; i++ )
+ {
+ LevelUse[ i ] = 0;
+ LevelList[ i ] = NULL;
+ LevelSecUse[ i ] = 0;
+ LevelSecList[ i ] = NULL;
+ }
+
+ GetDepWin()->EnablePaint( FALSE );
+
+ ULONG nObjCount = pObjLst->Count();
+ for ( i = 0; i < nObjCount; i++ )
+ {
+ pWin = pObjLst->GetObject( i );
+ if ( pWin->IsVisible()) {
+ pWin->mbVisited = FALSE;
+ pWin->mnHeadDist = 0;
+ pWin->mnRootDist = 0;
+
+ // find initial objects which need to be connected with
+ // root object
+ j = 0;
+ USHORT nStartCount = 0;
+ USHORT nEndCount = 0;
+ while ( (pCon = pWin->GetConnector( j )) )
+ {
+ if ( pCon->IsVisible()) { //null_project
+ if( pCon->IsStart( pWin ))
+ nStartCount++;
+ else
+ {
+ nEndCount = 1;
+ break;
+ }
+ }
+ j++;
+ }
+
+ if ( nStartCount > 0 && nEndCount == 0 )
+ if ( nTopId != pWin->GetId())
+ AddConnectorToObjects( pObjLst, nTopId, pWin->GetId());
+
+ }
+ }
+
+ pWin = ObjIdToPtr( pObjLst, nTopId );
+
+ if ( mpTravellerList )
+ {
+ mpTravellerList->Clear();
+ delete mpTravellerList;
+ }
+ mpTravellerList = new ObjWinList();
+ // set root and top distance
+ nRetVal = Impl_Traveller( pWin, nRootDist );
+
+ DBG_ASSERT( nRetVal < DEPPER_MAX_DEPTH , "zu tief" );
+ if ( nRetVal == DEP_ENDLES_RECURSION_FOUND )
+ {
+ WriteToErrorFile();
+ return nRetVal;
+ }
+
+ ULONG nUnvisited = 0;
+ ULONG nUnvisYOffs = 0;
+
+ // seperate mainstream, secondary and unconnected
+ for ( i = 0; i < nObjCount; i++ )
+ {
+ pWin = pObjLst->GetObject( i );
+ if ( pWin->IsVisible()) {
+ if (( pWin->mnHeadDist + pWin->mnRootDist ) == nRetVal )
+ {
+ if ( !LevelList[ pWin->mnHeadDist ] )
+ LevelList[ pWin->mnHeadDist ] = new ObjWinList;
+ LevelList[ pWin->mnHeadDist ]->Insert( pWin );
+ LevelUse[ pWin->mnHeadDist ]++;
+ }
+ else
+ if ( pWin->mbVisited )
+ {
+ if ( !LevelSecList[ nRetVal - pWin->mnRootDist ] )
+ LevelSecList[ nRetVal - pWin->mnRootDist ] = new ObjWinList;
+ LevelSecList[ nRetVal - pWin->mnRootDist ]->Insert( pWin );
+ LevelSecUse[ nRetVal - pWin->mnRootDist ]++;
+ }
+ else
+ {
+ // need to be arranged more intelligent...
+ Point aPos( 5, nUnvisYOffs );
+ pWin->SetCalcPosPixel( aPos );
+
+ Point aTmpPos = pWin->GetCalcPosPixel();
+ pWin->SetPosPixel( mpBaseWin->LogicToPixel( aTmpPos ));
+
+ nUnvisYOffs += pWin->PixelToLogic( pWin->GetSizePixel()).Height();
+ nUnvisited++;
+ }
+ }
+ }
+
+ mnLevelOffset = 0;
+
+ USHORT nScaleVal;
+
+ if ( nRetVal == 0 )
+ nScaleVal = 1;
+ else
+ nScaleVal = nRetVal;
+
+ i = 0;
+
+ USHORT nStep = 0;
+
+ while ( LevelList[ i ] )
+ {
+ UpdateMainProgressBar(i, nScaleVal, nStep);
+ DBG_ASSERT( LevelUse[ i ] == LevelList[ i ]->Count() , "level index im a..." );
+ ObjectWin* pSwapWin;
+ ULONG nLevelObjCount = LevelList[ i ]->Count();
+
+ if ( nLevelObjCount % 2 == 0 )
+ {
+ LevelList[ i ]->Insert( NULL, LIST_APPEND );
+ nLevelObjCount++;
+// LevelUse bleibt orginal...
+// LevelUse[ i ]++;
+ }
+
+// catch too big lists
+ DBG_ASSERT( nLevelObjCount < DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH , "graph zu breit! dat geiht nich gut. breaking" );
+ if ( nLevelObjCount >= DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH )
+ {
+ WarningBox aWBox( mpBaseWin, WB_OK, String::CreateFromAscii("graph zu breit! dat geiht nich gut. breaking"));
+ aWBox.Execute();
+ break;
+ }
+ mnXOffset = CalcXOffset( nLevelObjCount );
+ aWorkList.Clear();
+
+ // initial positioning for mainstream
+ for ( j = 0; j < nLevelObjCount; j++ )
+ {
+ pSwapWin = LevelList[ i ]->GetObject( j );
+ aWorkList.Insert( pSwapWin, LIST_APPEND);
+ Point aPos = CalcPos( i, j );
+ aPosArray[ j ] = aPos;
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( aPosArray[ j ] );
+ }
+
+ double dMinDist = CalcDistSum( LevelList[ i ] );
+
+ // optimize mainstream order and return best matching list in "aWorkList"
+ dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelObjCount ));
+
+ // set optimized positions - may still be wrong from later tries
+ for ( j = 0; j < nLevelObjCount; j++ )
+ {
+ pSwapWin = aWorkList.GetObject( j );
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( aPosArray[ j ] );
+ }
+
+ if ( LevelSecList[ i ] != NULL )
+ {
+ ULONG nLevelSecObjCount = LevelSecList[ i ]->Count();
+ // expand list for better positioning
+ while ( nLevelSecObjCount + LevelUse[ i ] < DEPPER_MAX_WIDTH - 1 )
+ {
+ LevelSecList[ i ]->Insert( NULL, LIST_APPEND );
+ nLevelSecObjCount++;
+ }
+ if ( ( nLevelSecObjCount + LevelUse[ i ])% 2 == 0 )
+ {
+ LevelSecList[ i ]->Insert( NULL, LIST_APPEND );
+ nLevelSecObjCount++;
+ }
+
+ DBG_ASSERT( nLevelSecObjCount < DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH , "graph zu breit! dat geiht nich gut. breaking" );
+ if ( nLevelObjCount >= DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH )
+ {
+ WarningBox aWBox( mpBaseWin, WB_OK, String::CreateFromAscii("graph zu breit! dat geiht nich gut. breaking"));
+ aWBox.Execute();
+ break;
+ }
+ mnXOffset = CalcXOffset( LevelUse[ i ] + nLevelSecObjCount );
+ aWorkList.Clear();
+
+ l = 0;
+ BOOL bUsedPos;
+
+ // find free positions for secondary objects
+ for ( j = 0; j < ( LevelUse[ i ] + nLevelSecObjCount ) ; j++ )
+ {
+ Point aPos = CalcPos( i, j );
+ bUsedPos = FALSE;
+ // is already occupied?
+ for ( k = 0; k < nLevelObjCount; k++ )
+ {
+ if ( LevelList[ i ]->GetObject( k ) )
+ if ( aPos == LevelList[ i ]->GetObject( k )->GetCalcPosPixel() )
+ bUsedPos = TRUE;
+ }
+ // if its free, add to pool
+ if ( !bUsedPos )
+ {
+ aPosArray[ l ] = aPos;
+ l++;
+ }
+ }
+
+ // initial positioning for secodaries
+ for ( j = 0 ; j < nLevelSecObjCount ; j++ )
+ {
+ pSwapWin = LevelSecList[ i ]->GetObject( j );
+ aWorkList.Insert( pSwapWin, LIST_APPEND);
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( aPosArray[ j ] );
+ }
+ dMinDist = CalcDistSum( LevelSecList[ i ] );
+
+ dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelSecList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelSecObjCount ));
+
+ // set optimized positions - may still be wrong from later tries
+ for ( j = 0; j < nLevelSecObjCount; j++ )
+ {
+ pSwapWin = aWorkList.GetObject( j );
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( aPosArray[ j ] );
+ }
+ if ( LevelUse[ i ] + LevelSecUse[ i ] > DEPPER_MAX_WIDTH )
+ mnLevelOffset++;
+ }
+ if ( LevelUse[ i ] + LevelSecUse[ i ] > DEPPER_MAX_WIDTH )
+ mnLevelOffset+= ( LevelUse[ i ] + LevelSecUse[ i ] ) / DEPPER_MAX_WIDTH ;
+ i++;
+ }
+
+ mnMinDynXOffs = 0xffff;
+
+// and back again...
+ // get better results form already preoptimized upper and lower rows
+
+ do
+ {
+ i--;
+ UpdateMainProgressBar(i, nScaleVal, nStep, TRUE); // TRUE ~ counting down
+ if ( LevelUse[ i ] + LevelSecUse[ i ] > DEPPER_MAX_WIDTH )
+ mnLevelOffset-= ( LevelUse[ i ] + LevelSecUse[ i ] ) / DEPPER_MAX_WIDTH ;
+ ObjectWin* pSwapWin;
+ ULONG nLevelObjCount = LevelList[ i ]->Count();
+ mnXOffset = CalcXOffset( nLevelObjCount );
+ aWorkList.Clear();
+
+ for ( j = 0; j < nLevelObjCount; j++ )
+ {
+ pSwapWin = LevelList[ i ]->GetObject( j );
+ aWorkList.Insert( pSwapWin, LIST_APPEND);
+ Point aPos = CalcPos( i, j );
+ aPosArray[ j ] = aPos;
+//no need to do this stuff....... ?????
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( aPosArray[ j ] );
+ }
+
+ double dMinDist = CalcDistSum( LevelList[ i ], BOTH );
+
+ dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelObjCount, BOTH ));
+// wrong position for remaping - keep old positions for comparing
+ for ( j = 0; j < nLevelObjCount; j++ )
+ {
+ pSwapWin = aWorkList.GetObject( j );
+ if ( pSwapWin )
+// pSwapWin->SetCalcPosPixel( mpBaseWin->LogicToPixel( aPosArray[ j ] ));
+ pSwapWin->SetCalcPosPixel( aPosArray[ j ] );
+ }
+
+ if ( LevelSecList[ i ] != NULL )
+ {
+ ULONG nLevelSecObjCount = LevelSecList[ i ]->Count();
+ mnXOffset = CalcXOffset( LevelUse[ i ] + nLevelSecObjCount );
+ aWorkList.Clear();
+
+ l = 0;
+ BOOL bUsedPos;
+
+ for ( j = 0; j < ( LevelUse[ i ] + nLevelSecObjCount ) ; j++ )
+ {
+ Point aPos = CalcPos( i, j );
+ bUsedPos = FALSE;
+// could be faster
+ for ( k = 0; k < nLevelObjCount; k++ )
+ {
+ if ( LevelList[ i ]->GetObject( k ) )
+ if ( aPos == LevelList[ i ]->GetObject( k )->GetCalcPosPixel() )
+ bUsedPos = TRUE;
+ }
+ if ( !bUsedPos )
+ {
+ aPosArray[ l ] = aPos;
+ l++;
+ }
+ }
+
+ for ( j = 0 ; j < nLevelSecObjCount ; j++ )
+ {
+ pSwapWin = LevelSecList[ i ]->GetObject( j );
+ aWorkList.Insert( pSwapWin, LIST_APPEND);
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( aPosArray[ j ] );
+ }
+ dMinDist = CalcDistSum( LevelSecList[ i ], BOTH );
+
+ dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelSecList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelSecObjCount, BOTH ));
+// wrong position for remaping - keep old positions for comparing
+ for ( j = 0; j < nLevelSecObjCount; j++ )
+ {
+ pSwapWin = aWorkList.GetObject( j );
+ if ( pSwapWin )
+ pSwapWin->SetCalcPosPixel( aPosArray[ j ] );
+ }
+ }
+// i--;
+ } while ( i != 0 );
+ SetMainProgressBar( 100 );
+
+ ULONG nNewXSize = ( DEPPER_MAX_WIDTH + 1 ) * ( OBJWIN_X_SPACING + GetDefSize().Width() );
+
+ // ULONG aObjID = GetStart(pIdMapper, pObjLst) //hier mu man switchen GetStart/GetPrjStart oder so
+
+ ObjectWin* pObjWin = ObjIdToPtr( pObjLst, aObjID);
+
+ ULONG nNewYSize = pObjWin->GetCalcPosPixel().Y() + GetDefSize().Height() + 2 * OBJWIN_Y_SPACING;
+ if (( nUnvisYOffs + GetDefSize().Height()) > nNewYSize )
+ nNewYSize = nUnvisYOffs + GetDefSize().Height();
+
+ MapMode aMapMode = GetDepWin()->GetMapMode();
+ Size aTmpSize( (ULONG) (double(nNewXSize) * double( aMapMode.GetScaleX())), (ULONG) (double( nNewYSize) * double( aMapMode.GetScaleY())));
+
+ Size aNowSize( GetGraphWin()->GetSizePixel());
+
+ if ( GetDepWin()->LogicToPixel( aNowSize ).Width() > aTmpSize.Width() )
+ aTmpSize.Width() = GetDepWin()->LogicToPixel( aNowSize ).Width() ;
+
+ if ( GetDepWin()->LogicToPixel( aNowSize ).Height() > aTmpSize.Height() )
+ aTmpSize.Height() = GetDepWin()->LogicToPixel( aNowSize ).Height() ;
+
+// if ( nZoomed <= 0 )
+// {
+// mpBaseWin->SetSizePixel( aTmpSize );
+// mpGraphWin->SetTotalSize( aTmpSize );
+// mpGraphWin->EndScroll( 0, 0 );
+// }
+
+// now remap all objects
+ ULONG nAllObjCount = pObjLst->Count();
+ Point aTmpPos;
+ for ( j = 0; j < nAllObjCount; j++ )
+ {
+ pWin = pObjLst->GetObject( j );
+ if ( pWin->IsVisible()) {
+ aTmpPos = pWin->GetCalcPosPixel();
+ if ( pWin->mbVisited )
+ {
+// reserve space for unconnected
+ aTmpPos.X() -= mnMinDynXOffs;
+ aTmpPos.X() += GetDefSize().Width() + OBJWIN_X_SPACING;
+// center window
+ aTmpPos.X() += GetDefSize().Width() / 2;
+ aTmpPos.X() -= pWin->PixelToLogic( pWin->GetSizePixel()).Width() / 2 ;
+ }
+ pWin->SetPosPixel( GetDepWin()->LogicToPixel( aTmpPos ));
+ }
+ }
+ aWorkList.Clear();
+ GetDepWin()->EnablePaint( TRUE );
+ GetDepWin()->Invalidate();
+//LevelListen loeschen H? Welche Levellisten?
+
+//Update all Connectors
+// --> To be done: Don't call twice Object1-Connector-Object2
+ ObjectWin* pObject1;
+ for ( i = 0 ; i < nObjCount ; i++)
+ {
+ pObject1 = pObjLst->GetObject( i );
+ if ( pObject1->IsVisible())
+ pObject1->UpdateConnectors();
+ };
+ return 0;
+}
+
+void SolDep::WriteToErrorFile()
+{
+//Needs some improvement
+ ObjectWin* pWin;
+ WarningBox aWBox( mpBaseWin, WB_OK, String::CreateFromAscii("graph too deep! dat geiht nich gut.\nlook at depper.err in your Tmp-directory\nfor list of objects"));
+ aWBox.Execute();
+ char *tmpdir = getenv("TMP");
+ char *errfilebasename = "depper.err";
+ char *ErrFileName = (char*) malloc( strlen( tmpdir ) + strlen( errfilebasename) + 3 );
+ *ErrFileName = '\0';
+ strcat( ErrFileName, tmpdir );
+ strcat( ErrFileName, "\\" );
+ strcat( ErrFileName, errfilebasename );
+ FILE* pErrFile = fopen( "depper.err", "w+" );
+ if ( pErrFile )
+ {
+ for ( USHORT i = 0; i < mpTravellerList->Count(); i++ )
+ {
+ pWin = mpTravellerList->GetObject( i );
+ fprintf( pErrFile, " %s -> \n", (pWin->GetBodyText()).GetBuffer());
+ }
+ fclose( pErrFile );
+ }
+}
diff --git a/soldep/source/soldep.ico b/soldep/source/soldep.ico Binary files differnew file mode 100644 index 000000000000..dc0812889368 --- /dev/null +++ b/soldep/source/soldep.ico diff --git a/soldep/source/soldlg.cxx b/soldep/source/soldlg.cxx new file mode 100644 index 000000000000..f49562c2cd27 --- /dev/null +++ b/soldep/source/soldlg.cxx @@ -0,0 +1,270 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: soldlg.cxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/geninfo.hxx> +//#include "depapp.hxx" +#include <soldep/soldep.hxx> +#include <soldep/soldlg.hxx> +#include <soldep/soldlg.hrc> + +#ifndef SOLARIS +#define SIZE( nX, nY) \ + LogicToLogic(Size(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode()) +#define POS(nX, nY) \ + LogicToLogic(Point(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode()) +#else +#define SIZE( nX, nY) \ + LogicToLogic(Size(nX,nY),MapMode(MAP_APPFONT),GetMapMode()) +#define POS(nX, nY) \ + LogicToLogic(Point(nX,nY),MapMode(MAP_APPFONT),GetMapMode()) +#endif + + +// +// class SolNewProjectDlg +// + +/*****************************************************************************/ +SolNewProjectDlg::SolNewProjectDlg( Window* pParent, const ResId& rResId ) +/*****************************************************************************/ + : ModalDialog( pParent, rResId ), + maOkButton( this, DtSodResId( BTN_OK )), + maCancelButton( this, DtSodResId( BTN_CANCEL )), + maFTName( this, DtSodResId( FT_PRJNAME )), + maEName( this, DtSodResId( EDIT_PRJNAME )), + maFTShort( this, DtSodResId( FT_PRJSHORT )), + maEShort( this, DtSodResId( EDIT_PRJSHORT )), + maFTDeps( this, DtSodResId( FT_PRJDEPS )), + maEDeps( this, DtSodResId( EDIT_PRJDEPS )) +{ + FreeResource(); + maOkButton.SetClickHdl( LINK( this, SolNewProjectDlg, OkHdl )); + maCancelButton.SetClickHdl( LINK( this, SolNewProjectDlg, CancelHdl )); +} + +/*****************************************************************************/ +IMPL_LINK( SolNewProjectDlg, OkHdl, Button*, pOkBtn ) +/*****************************************************************************/ +{ + EndDialog( 1 ); + return 0; +} + +/*****************************************************************************/ +IMPL_LINK( SolNewProjectDlg, CancelHdl, Button*, pCancelBtn ) +/*****************************************************************************/ +{ + EndDialog( 0 ); + return 0; +} + +// +// class SolNewDirectoryDlg +// + +/*****************************************************************************/ +SolNewDirectoryDlg::SolNewDirectoryDlg( Window* pParent, const ResId& rResId ) +/*****************************************************************************/ + : ModalDialog( pParent, rResId ), + maOkButton( this, DtSodResId( BTN_OK )), + maCancelButton( this, DtSodResId( BTN_CANCEL )), + maFTName( this, DtSodResId( FT_DIRNAME )), + maEName( this, DtSodResId( EDIT_DIRNAME )), + maFTFlag( this, DtSodResId( FT_DIRFLAG )), + maEFlag( this, DtSodResId( EDIT_DIRFLAG )), + maFTDeps( this, DtSodResId( FT_DIRDEPS )), + maEDeps( this, DtSodResId( EDIT_DIRDEPS )), + maFTAction( this, DtSodResId( FT_DIRACTION )), + maEAction( this, DtSodResId( EDIT_DIRACTION )), + maFTEnv( this, DtSodResId( FT_DIRENV )), + maEEnv( this, DtSodResId( EDIT_DIRENV )) +{ + FreeResource(); + maOkButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, OkHdl )); + maCancelButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, CancelHdl )); +} + +/*****************************************************************************/ +IMPL_LINK( SolNewDirectoryDlg, OkHdl, Button*, pOkBtn ) +/*****************************************************************************/ +{ + EndDialog( 1 ); + return 0; +} + +/*****************************************************************************/ +IMPL_LINK( SolNewDirectoryDlg, CancelHdl, Button*, pCancelBtn ) +/*****************************************************************************/ +{ + EndDialog( 0 ); + return 0; +} + +// +// class SolHelpDlg +// + +/*****************************************************************************/ +SolHelpDlg::SolHelpDlg( Window* pParent, const ResId& rResId ) +/*****************************************************************************/ + : ModalDialog( pParent, rResId ), + maOkButton( this, DtSodResId( BTN_OK )), + maMLEHelp( this, DtSodResId( EDIT_HELP )) +{ + FreeResource(); + maOkButton.SetClickHdl( LINK( this, SolHelpDlg, OkHdl )); +} + +/*****************************************************************************/ +IMPL_LINK( SolHelpDlg, OkHdl, Button*, pOkBtn ) +/*****************************************************************************/ +{ + EndDialog( 1 ); + return 0; +} + +// +// class SolSelectVersionDlg +// + +/*****************************************************************************/ +SolSelectVersionDlg::SolSelectVersionDlg( + Window *pParent, GenericInformationList *pStandLst ) +/*****************************************************************************/ + : ModalDialog( pParent, DtSodResId( DLG_VERSIONSELECT )), + maVersionListBox( this, DtSodResId( DLG_VERSIONSELECT_LISTBOX )), + maVersionGroupBox( this, DtSodResId( DLG_VERSIONSELECT_GROUP )), + maMinorEditBox( this, DtSodResId( DLG_MINORSELECT_EDIT )), + maMinorGroupBox( this, DtSodResId( DLG_MINORSELECT_GROUP )), + maOKButton( this, DtSodResId( DLG_VERSIONSELECT_OK )), + maCancelButton( this, DtSodResId( DLG_VERSIONSELECT_CANCEL )) +{ + FreeResource(); + //Fill the ListBox with MWS versions (e.g. SRC680) from "stand.lst" + for ( ULONG i = 0; i < pStandLst->Count(); i++ ) { + String sVersion( *pStandLst->GetObject( i ), RTL_TEXTENCODING_ASCII_US ); + maVersionListBox.InsertEntry( sVersion ); + } + + if ( pStandLst->Count()) + maVersionListBox.SelectEntryPos( 0 ); + + maVersionListBox.SetDoubleClickHdl( + LINK( this, SolSelectVersionDlg, DoubleClickHdl )); + +} + +/*****************************************************************************/ +ByteString SolSelectVersionDlg::GetVersionMajor() +/*****************************************************************************/ +{ + //Returns the selected version + return ByteString(maVersionListBox.GetSelectEntry(), RTL_TEXTENCODING_ASCII_US ); +} + +/*****************************************************************************/ +ByteString SolSelectVersionDlg::GetVersionMinor() +/*****************************************************************************/ +{ + //Returns the minor + ByteString minor = ByteString(maMinorEditBox.GetText(), RTL_TEXTENCODING_ASCII_US ); + //check for correctness (format: "m1234") + //"m123s8" is unsupported because 'steps' aren't used anymore + minor.EraseLeadingAndTrailingChars(); + int check = minor.SearchChar("m"); + if (check == 0) + { + ByteString check2 = minor.Copy(1,(minor.Len()-1)); + if (check2.IsNumericAscii()) return minor; + } + return ByteString(""); +} + +/*****************************************************************************/ +IMPL_LINK( SolSelectVersionDlg, DoubleClickHdl, ListBox *, pBox ) +/*****************************************************************************/ +{ + EndDialog( RET_OK ); + return 0; +} + +// +// class SolAutoarrangeDlg +// + +/*****************************************************************************/ +SolAutoarrangeDlg::SolAutoarrangeDlg( Window *pParent ) +/*****************************************************************************/ + : ModelessDialog( pParent, DtSodResId( DLG_AUTOARRANGE )), + maGroupBox( this, DtSodResId( DLG_AUTOARRANGE_GROUP )), + maModuleText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_MODULE )), + maOverallText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_OVERALL )), + maModuleBar( this ), + maOverallBar( this ) +{ + FreeResource(); +/* Mac Porting..... taking address of temporary (warning) + maModuleBar.SetPosPixel( POS( 8, 28 )); + maOverallBar.SetPosPixel( POS( 8, 60 )); + maModuleBar.SetSizePixel( SIZE( 208,12 )); + maOverallBar.SetSizePixel( SIZE( 208,12 )); +*/ + maModuleBar.Show(); + maOverallBar.Show(); + + maModuleText.Show(); + maOverallText.Show(); +} + +/**********************************************************************************/ + +SolFindProjectDlg::SolFindProjectDlg( Window *pParent, ObjWinList* pObjList ) + : ModalDialog( pParent, DtSodResId( DLG_FIND_PROJECT )), + maCombobox( this, DtSodResId( DLG_FIND_PROJECT_COMBOBOX )), + maOKButton( this, DtSodResId( DLG_FIND_PROJECT_OK )), + maCancelButton( this, DtSodResId( DLG_FIND_PROJECT_CANCEL )) +{ + FreeResource(); + maCombobox.SetDropDownLineCount(15); +// SolDep* pSolDep = ((MyApp*)GetpApp())->GetSolDep(); +// ObjWinList* pObjList = pSolDep->GetObjectList(); + ULONG n = pObjList->Count(); + //Fill combobox + for (ULONG i=0; i<n; i++) { + ByteString prjname = pObjList->GetObject( i )->GetBodyText(); + if (prjname != ByteString("null")) //null_project + maCombobox.InsertEntry( String(prjname,RTL_TEXTENCODING_UTF8) ); + } +} + +ByteString SolFindProjectDlg::GetProject() +{ + return ByteString(maCombobox.GetText(),RTL_TEXTENCODING_UTF8); +}
\ No newline at end of file diff --git a/soldep/source/soldlg.src b/soldep/source/soldlg.src new file mode 100644 index 000000000000..9d9897971826 --- /dev/null +++ b/soldep/source/soldlg.src @@ -0,0 +1,377 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: soldlg.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <dtsodcmp.hrc>
+#include <soldep/soldlg.hrc>
+
+//========================================================================
+// Dialogs
+ModalDialog RID_SD_DIALOG_NEWPROJECT
+{
+ OutputSize = TRUE;
+ Text = "New Project";
+ PosSize = MAP_SYSFONT(18,18,142,142);
+ SVLook = TRUE;
+ MOVEABLE = TRUE;
+ CLOSEABLE = TRUE;
+ OKButton BTN_OK
+ {
+ PosSize = MAP_SYSFONT(5,123,40,14);
+ TabStop = TRUE;
+ Hide = FALSE;
+ DefButton = TRUE;
+ };
+ CancelButton BTN_CANCEL {
+ PosSize = MAP_SYSFONT(50,123,40,14);
+ TabStop = TRUE;
+ };
+ FixedText FT_PRJNAME {
+ PosSize = MAP_SYSFONT( 5, 10, 100, 10 );
+ Text = "Project Name";
+ };
+ Edit EDIT_PRJNAME {
+ Border = TRUE;
+ PosSize = MAP_SYSFONT(5,20,132,10);
+ };
+ FixedText FT_PRJSHORT {
+ PosSize = MAP_SYSFONT( 5, 30, 100, 10 );
+ Text = "Project Short Name";
+ };
+ Edit EDIT_PRJSHORT {
+ Border = TRUE;
+ PosSize = MAP_SYSFONT(5,40,132,10);
+ };
+ FixedText FT_PRJDEPS {
+ PosSize = MAP_SYSFONT( 5, 50, 100, 10 );
+ Text = "Project Depends on";
+ };
+ Edit EDIT_PRJDEPS {
+ Border = TRUE;
+ PosSize = MAP_SYSFONT(5,60,132,10);
+ };
+};
+
+ModalDialog RID_SD_DIALOG_NEWDIRECTORY
+{
+ OutputSize = TRUE;
+ Text = "New Directory";
+ PosSize = MAP_SYSFONT(18,18,142,142);
+ SVLook = TRUE;
+ MOVEABLE = TRUE;
+ CLOSEABLE = TRUE;
+ OKButton BTN_OK
+ {
+ PosSize = MAP_SYSFONT(5,123,40,14);
+ TabStop = TRUE;
+ Hide = FALSE;
+ DefButton = TRUE;
+ };
+ CancelButton BTN_CANCEL {
+ PosSize = MAP_SYSFONT(50,123,40,14);
+ TabStop = TRUE;
+ };
+ FixedText FT_DIRNAME {
+ PosSize = MAP_SYSFONT( 5, 10, 132, 10 );
+ Text = "Directory Name ( with projectname )";
+ };
+ Edit EDIT_DIRNAME {
+ Border = TRUE;
+ PosSize = MAP_SYSFONT(5,20,132,10);
+ };
+ FixedText FT_DIRFLAG {
+ PosSize = MAP_SYSFONT( 5, 30, 100, 10 );
+ Text = "Directory Flag";
+ };
+ Edit EDIT_DIRFLAG {
+ Border = TRUE;
+ PosSize = MAP_SYSFONT(5,40,132,10);
+ };
+ FixedText FT_DIRDEPS {
+ PosSize = MAP_SYSFONT( 5, 50, 100, 10 );
+ Text = "Directory Depends on";
+ };
+ Edit EDIT_DIRDEPS {
+ Border = TRUE;
+ PosSize = MAP_SYSFONT(5,60,132,10);
+ };
+ FixedText FT_DIRACTION {
+ PosSize = MAP_SYSFONT( 5, 70, 100, 10 );
+ Text = "What To Do";
+ };
+ Edit EDIT_DIRACTION {
+ Border = TRUE;
+ PosSize = MAP_SYSFONT(5,80,132,10);
+ };
+ FixedText FT_DIRENV {
+ PosSize = MAP_SYSFONT( 5, 90, 100, 10 );
+ Text = "Which Environments";
+ };
+ Edit EDIT_DIRENV {
+ Border = TRUE;
+ PosSize = MAP_SYSFONT(5,100,132,10);
+ };
+};
+
+
+ModalDialog RID_SD_DIALOG_HELP
+{
+ OutputSize = TRUE;
+ Text = "Help";
+ PosSize = MAP_SYSFONT(18,18,242,242);
+ SVLook = TRUE;
+ MOVEABLE = TRUE;
+ CLOSEABLE = TRUE;
+ OKButton BTN_OK
+ {
+ PosSize = MAP_SYSFONT(101,223,40,14);
+ TabStop = TRUE;
+ Hide = FALSE;
+ DefButton = TRUE;
+ };
+ MultiLineEdit EDIT_HELP {
+ Border = TRUE;
+ PosSize = MAP_SYSFONT(5,5,232,213);
+ };
+};
+
+ModalDialog DLG_VERSIONSELECT {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT( 92, 40 );
+ Size = MAP_APPFONT( 161, 98 );
+ Text = "Open workspace";
+ Moveable = TRUE;
+ Closeable = TRUE;
+ ListBox DLG_VERSIONSELECT_LISTBOX {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 8, 16 );
+ Size = MAP_APPFONT( 96, 72 );
+ TabStop = TRUE;
+ };
+ GroupBox DLG_VERSIONSELECT_GROUP {
+ Pos = MAP_APPFONT( 4, 4 );
+ Size = MAP_APPFONT( 104, 88 );
+ Text = "Workspaces";
+ };
+ OKButton DLG_VERSIONSELECT_OK {
+ Pos = MAP_APPFONT( 116, 64 );
+ Size = MAP_APPFONT( 40, 12 );
+ DefButton = TRUE;
+ TabStop = TRUE;
+ };
+ CancelButton DLG_VERSIONSELECT_CANCEL {
+ Pos = MAP_APPFONT( 116, 80 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ };
+ GroupBox DLG_MINORSELECT_GROUP {
+ Pos = MAP_APPFONT( 110, 4 );
+ Size = MAP_APPFONT( 47, 30 );
+ Text = "Minor";
+ };
+ Edit DLG_MINORSELECT_EDIT {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 115, 16 );
+ Size = MAP_APPFONT( 36, 12 );
+ TabStop = TRUE;
+ };
+};
+
+ModelessDialog DLG_AUTOARRANGE {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT( 40, 12 );
+ Size = MAP_APPFONT( 225, 82 );
+ Text = "Autoarrange";
+ Moveable = TRUE;
+ GroupBox DLG_AUTOARRANGE_GROUP {
+ Pos = MAP_APPFONT( 4, 4 );
+ Size = MAP_APPFONT( 216, 72 );
+ Text = "Progress";
+ };
+ FixedText DLG_AUTOARRANGE_TEXT_MODULE {
+ Pos = MAP_APPFONT( 8, 16 );
+ Size = MAP_APPFONT( 208, 10 );
+ Text = "";
+ };
+ FixedText DLG_AUTOARRANGE_TEXT_OVERALL {
+ Pos = MAP_APPFONT( 8, 48 );
+ Size = MAP_APPFONT( 208, 10 );
+ Text = "";
+ };
+};
+
+ModalDialog DLG_FIND_PROJECT {
+ OutputSize = TRUE;
+ Pos = MAP_APPFONT( 40, 12 );
+ Size = MAP_APPFONT( 155, 55 );
+ Text = "Find Project";
+ Moveable = TRUE;
+ SVLook = TRUE;
+ ComboBox DLG_FIND_PROJECT_COMBOBOX
+ {
+ Pos = MAP_APPFONT ( 5 , 18 ) ;
+ Size = MAP_APPFONT ( 100 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ VScroll = TRUE ;
+ Sort = TRUE ;
+ };
+ OKButton DLG_FIND_PROJECT_OK {
+ Pos = MAP_APPFONT( 110, 10 );
+ Size = MAP_APPFONT( 40, 12 );
+ DefButton = TRUE;
+ TabStop = TRUE;
+ };
+ CancelButton DLG_FIND_PROJECT_CANCEL {
+ Pos = MAP_APPFONT( 110, 26 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ };
+};
+
+ToolBox TID_SOLDEP_MAIN
+{
+ ButtonType = BUTTON_SYMBOL;
+ Align = BOXALIGN_TOP;
+ LineCount = 1;
+ SVLook = TRUE;
+ Border = TRUE;
+ Sizeable = TRUE;
+ Dockable = TRUE;
+ Scroll = TRUE;
+ Moveable = TRUE;
+ Closeable = TRUE;
+ Zoomable = TRUE;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TID_SOLDEP_OPEN;
+ Type = TOOLBOXITEM_BUTTON;
+ Text = "Load";
+ HelpId = TID_SOLDEP_OPEN;
+ HelpText = "Load";
+ Checkable = TRUE;
+ ItemBitmap = Bitmap
+ {
+ File = "sx03190.png";
+ };
+ };
+ ToolBoxItem
+ {
+ Identifier = TID_SOLDEP_SAVE;
+ Type = TOOLBOXITEM_BUTTON;
+ Text = "Save";
+ HelpId = TID_SOLDEP_SAVE;
+ HelpText = "Save";
+ Checkable = TRUE;
+ ItemBitmap = Bitmap
+ {
+ File = "sc05505.png";
+ };
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR;
+ };
+ ToolBoxItem
+ {
+ Identifier = TID_SOLDEP_SELECT_WORKSPACE;
+ Type = TOOLBOXITEM_BUTTON;
+ Text = "Select Workspace";
+ HelpId = TID_SOLDEP_HIDE_INDEPENDEND;
+ HelpText = "Select Workspace";
+ Checkable = TRUE;
+ ItemBitmap = Bitmap
+ {
+ File = "selectupd_16.png";
+ };
+ };
+ ToolBoxItem
+ {
+ Identifier = TID_SOLDEP_FIND;
+ Type = TOOLBOXITEM_BUTTON;
+ Text = "Find Module";
+ HelpId = TID_SOLDEP_FIND;
+ HelpText = "Find Module";
+ Checkable = TRUE;
+ ItemBitmap = Bitmap
+ {
+ File = "sc05961.png";
+ };
+ };
+ ToolBoxItem
+ {
+ Identifier = TID_SOLDEP_BACK;
+ Type = TOOLBOXITEM_BUTTON;
+ Text = "Back to Overview";
+ HelpId = TID_SOLDEP_BACK;
+ HelpText = "Back to Overview";
+ Checkable = TRUE;
+ ItemBitmap = Bitmap
+ {
+ File = "arrowup_16.png";
+ };
+ };
+ ToolBoxItem
+ {
+ Identifier = TID_SOLDEP_HIDE_INDEPENDEND;
+ Type = TOOLBOXITEM_BUTTON;
+ Text = "Hide Independend Modules";
+ HelpId = TID_SOLDEP_HIDE_INDEPENDEND;
+ HelpText = "Hide Independend Modules";
+ Checkable = TRUE;
+ ItemBitmap = Bitmap
+ {
+ File = "hidedependency_16.png";
+ };
+ };
+ ToolBoxItem
+ {
+ Identifier = TID_SOLDEP_CREATEMETA;
+ Type = TOOLBOXITEM_BUTTON;
+ Text = "Create MetaFile";
+ Checkable = TRUE;
+ };
+ };
+};
+
+/*****************************************************************************/
+Bitmap TID_SMALL_PIN_PINED
+/*****************************************************************************/
+{
+ File = "ballgreen_7.png";
+};
+
+/*****************************************************************************/
+Bitmap TID_SMALL_PIN_UNPINED
+/*****************************************************************************/
+{
+ File = "ballred_7.png";
+};
diff --git a/soldep/source/tbox.cxx b/soldep/source/tbox.cxx new file mode 100644 index 000000000000..fe693e4a7fd0 --- /dev/null +++ b/soldep/source/tbox.cxx @@ -0,0 +1,599 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tbox.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define private public + +#include <tools/ref.hxx> +#include <vcl/msgbox.hxx> +#include <soldep/soldep.hxx> +#include <soldep/tbox.hxx> +#include <soldep/soldlg.hrc> + + + +SoldepToolBox::SoldepToolBox( Window* pParent, const ResId& aId, BOOL bDAble ) : + ToolBox( pParent, aId ), + bDockable( bDAble ), + bCloseMode( FALSE ), + bBoxIsVisible( TRUE ), + bPinable( TRUE ), + aPinedBitmap( DtSodResId( TID_SMALL_PIN_PINED )), // BMP_SMALL_PIN_PINED + aUnpinedBitmap( DtSodResId( TID_SMALL_PIN_UNPINED )) // BMP_SMALL_PIN_UNPINED +{ + bPinable = TRUE; + + SetAlign( WINDOWALIGN_TOP ); + HideItem(TID_SOLDEP_BACK); //Inital hide this item, activated in project view. + HideItem(TID_SOLDEP_SAVE); // Hide this item now, not used yet + HideItem(TID_SOLDEP_OPEN); // Hide this item now, not used yet + + //SetMouseDownHdl(LINK(this,SoldepToolBox,MouseDownHdl)); + //SetFloatingLines( nFloatingLines ); + //SetFloatingMode( bFloatingMode ); + BOOL bFloatingMode = FALSE; + if ( bFloatingMode ) + { + //Point aPos( sToolBoxInfo.GetToken( 4, ',' ).ToInt64(), sToolBoxInfo.GetToken( 5, ',' ).ToInt64()); + //SetPosPixel( aPos ); + } + + if ( bDockable ) InsertSeparator( 0 ); // Freiraum fr Abreiddel schaffen + // (ein Separator an 1er Pos wird + // nicht gezeichnet, + // schafft aber Platz.) + bBoxIsVisible = FALSE; +// if ( sToolBoxInfo.GetToken( 3, ',' ) == "Visible" ) { + for ( USHORT i = 0; i < GetItemCount() && !bBoxIsVisible; i++ ) + { +// USHORT nItemId = GetItemId( i ); + + switch ( GetItemType( i )) + { + case TOOLBOXITEM_SPACE: + break; + case TOOLBOXITEM_SEPARATOR : + break; + default: + bBoxIsVisible = TRUE; + break; + } + } +// } + + if ( bBoxIsVisible ) { + if (!bDockable) + Show(); + else + Hide(); + } + else + Hide(); + + bOldFloatMode = IsFloatingMode(); +} + +/************************************************************************* +|* SoldepToolBox::~SoldepToolBox() +|************************************************************************/ + +SoldepToolBox::~SoldepToolBox() +{ +} + +/************************************************************************* +|* SoldepToolBox::Paint() +|************************************************************************/ + +void SoldepToolBox::Paint( const Rectangle& rRect ) +{ + SetOutStyle( TOOLBOX_STYLE_FLAT ); + + // Wenn wir eine Dockable ToolBox haben, ... + + if ( bDockable ) + { + USHORT nItemId = GetItemId( 0 ); + + // ... zeichnen wir den wunderbaren Abreiddel ber das erste Item (Seperator) + + if ( !IsFloatingMode() && ( mnCurLine == 1 )) { + BOOL bIsCloseable = (( mnWinStyle & WB_CLOSEABLE ) != 0 ); + + ShowItem( nItemId ); + Rectangle aRect = GetItemRect( nItemId ); + + ToolBox::Paint( rRect ); + + if ( bIsCloseable ) + { + // Paint small cross button left/top of toolbar + SetLineColor( Color( COL_WHITE )); + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left()+6, aRect.Top())); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Top()+6)); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Top()+6), Point( aRect.Left()+6, aRect.Top()+6)); + DrawLine( Point( aRect.Left()+6, aRect.Top()), Point( aRect.Left()+6, aRect.Top()+6)); + + SetLineColor( Color( COL_BLACK )); + + DrawLine( Point( aRect.Left()+2, aRect.Top()+2), Point( aRect.Left()+4, aRect.Top()+4)); + DrawLine( Point( aRect.Left()+2, aRect.Top()+4), Point( aRect.Left()+4, aRect.Top()+2)); + } + else if ( bPinable ) + { + if ( GetPin()) + DrawBitmap( Point( aRect.Left(), aRect.Top()), aPinedBitmap ); + else + DrawBitmap( Point( aRect.Left(), aRect.Top()), aUnpinedBitmap ); + } + + SetLineColor( Color( COL_WHITE )); + + if ( IsHorizontal()) + { + if ( bIsCloseable || bPinable ) aRect = Rectangle( Point( aRect.Left(), aRect.Top()+8), Point( aRect.Right(), aRect.Bottom())); + + DrawLine( Point(aRect.Left(), aRect.Top()), Point(aRect.Left(), aRect.Bottom())); + DrawLine( Point(aRect.Left(), aRect.Top()), Point(aRect.Left()+2, aRect.Top())); + + SetLineColor( Color( COL_WHITE )); + + DrawLine( Point(aRect.Left()+4, aRect.Top()), Point(aRect.Left()+4, aRect.Bottom())); + DrawLine( Point(aRect.Left()+4, aRect.Top()), Point(aRect.Left()+6, aRect.Top())); + + SetLineColor( Color( COL_GRAY ));//GRAY + + DrawLine( Point(aRect.Left()+2, aRect.Top()), Point(aRect.Left()+2, aRect.Bottom())); + DrawLine( Point(aRect.Left(), aRect.Bottom()), Point(aRect.Left()+2, aRect.Bottom())); + + SetLineColor( Color( COL_BLACK )); + + DrawLine( Point(aRect.Left()+6, aRect.Top()), Point(aRect.Left()+6, aRect.Bottom())); + DrawLine( Point(aRect.Left()+4, aRect.Bottom()), Point(aRect.Left()+6, aRect.Bottom())); + + } + else + { + if ( bIsCloseable || bPinable ) aRect = Rectangle( Point( aRect.Left()+8, aRect.Top()), Point( aRect.Right(), aRect.Bottom())); + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Top()+2)); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); + + DrawLine( Point( aRect.Left(), aRect.Top()+4), Point( aRect.Left(), aRect.Top()+6)); + DrawLine( Point( aRect.Left(), aRect.Top()+4), Point( aRect.Right(), aRect.Top()+4)); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Top()+2), Point( aRect.Right(),aRect.Top()+2)); + DrawLine( Point( aRect.Right(), aRect.Top()), Point( aRect.Right(), aRect.Top()+2)); + + DrawLine( Point( aRect.Left(), aRect.Top()+6), Point( aRect.Right(),aRect.Top()+6)); + DrawLine( Point( aRect.Right(), aRect.Top()+4), Point( aRect.Right(), aRect.Top()+6)); + + } + } + else + { + // Sind wir im FloatingMode, dann wollen wir keinen Abreiddel haben + // und hiden somit das erste Item. + + //Hiden lscht leider das erste Object der nchsten Zeile, daher nicht + //lschen + HideItem( nItemId ); + ToolBox::Paint( rRect ); + } + } + else + { + ToolBox::Paint( rRect ); + } +} + +/************************************************************************* +|* SoldepToolBox::MouseButtonDown() +|************************************************************************/ + +void SoldepToolBox::MouseButtonDown(const MouseEvent& rEvent) +{ + // Sind wir im DockingMode, ... + + if ( !IsFloatingMode() && ((( mnWinStyle & WB_CLOSEABLE ) != 0 ) || bPinable )) + { + // ... dann testen wir, ob am Abreiddel der Close-Button gedrckt wurde ... + + Rectangle aRect = GetItemRect( GetItemId( 0 )); + aRect = Rectangle( aRect.TopLeft(), Point( aRect.Left()+6, aRect.Top()+6 )); + if ( rEvent.IsLeft() && aRect.IsInside( rEvent.GetPosPixel())) + { + if ( bPinable ) { + TogglePin(); + Invalidate(); + } + else { + bCloseMode = TRUE; + + // ... und zeichnen ggf. den Button gedrckt. + + SetLineColor( Color( COL_WHITE )); + + DrawLine( Point( aRect.Left(), aRect.Bottom()), Point( aRect.Right(), aRect.Bottom())); + DrawLine( Point( aRect.Right(), aRect.Bottom()), Point( aRect.Right(), aRect.Top())); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Bottom())); + } + } + else + { + ToolBox::MouseButtonDown( rEvent ); + } + } + else + { + ToolBox::MouseButtonDown( rEvent ); + } + + aMouseDownHdl.Call(this); +} + +/************************************************************************* +|* SoldepToolBox::MouseButtonUp() +|************************************************************************/ + +void SoldepToolBox::MouseButtonUp(const MouseEvent& rEvent) +{ + // Wenn der Close-Button am Abreiddel zuvor gedrckt wurde, ... + + if ( bCloseMode ) + { + bCloseMode = FALSE; + + // ... so zeichen wir diesen wieder normal ... + + Rectangle aRect = GetItemRect( GetItemId( 0 )); + aRect = Rectangle( aRect.TopLeft(), Point( aRect.Left()+6, aRect.Top()+6 )); + + SetLineColor( Color( COL_WHITE )); + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Bottom())); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Bottom()), Point( aRect.Right(), aRect.Bottom())); + DrawLine( Point( aRect.Right(), aRect.Bottom()), Point( aRect.Right(), aRect.Top())); + + if ( rEvent.IsLeft() && aRect.IsInside( rEvent.GetPosPixel())) + { + // ... und schlieen die Box durch Aufruf der virtuellen Methode + // CloseDockingMode(). + + CloseDockingMode(); + } + else + { + ToolBox::MouseButtonUp( rEvent ); + } + } + else + { + ToolBox::MouseButtonUp( rEvent ); + } +} + +/************************************************************************* +|* SoldepToolBox::MouseMove() +|************************************************************************/ + +void SoldepToolBox::MouseMove(const MouseEvent& rEvent) +{ + // Wenn der Close-Button am Abreiddel zuvor gedrckt wurde, ... + + if ( bCloseMode ) + { + Rectangle aRect = GetItemRect( GetItemId( 0 )); + aRect = Rectangle( aRect.TopLeft(), Point( aRect.Left()+6, aRect.Top()+6 )); + + // ... der Mouse-Zeiger jedoch den Close-Button verlt, ... + + if ( !aRect.IsInside( rEvent.GetPosPixel())) + { + SetLineColor( Color( COL_WHITE )); + + // ... zeichnen wir diesen halt wieder normal. + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Bottom())); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Bottom()), Point( aRect.Right(), aRect.Bottom())); + DrawLine( Point( aRect.Right(), aRect.Bottom()), Point( aRect.Right(), aRect.Top())); + + bCloseMode = FALSE; + } + else + { + ToolBox::MouseMove( rEvent ); + } + } + else + { + ToolBox::MouseMove( rEvent ); + } +} + +/*****************************************************************************/ +void SoldepToolBox::ToggleFloatingMode() +/*****************************************************************************/ +{ + ToolBox::ToggleFloatingMode(); + CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); +} + +/*****************************************************************************/ +void SoldepToolBox::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) +/*****************************************************************************/ +{ + ToolBox::EndDocking( rRect, bFloatMode ); + if ( aResizeHdl.IsSet()) + CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); + else + { + GetParent()->Resize(); + } +}; + +/*****************************************************************************/ +BOOL SoldepToolBox::Close() +/*****************************************************************************/ +{ + if (!ToolBox::Close()) return FALSE; + + return TRUE; +} + +/*****************************************************************************/ +void SoldepToolBox::Move() +/*****************************************************************************/ +{ +} + +/************************************************************************* +|* SoldepToolBox::CloseDockingMode() +|* +|* virtuelle Methode zur Reaktion auf den Close-Button im DockinMode +|************************************************************************/ + +void SoldepToolBox::CloseDockingMode() +{ + Hide(); + bBoxIsVisible = FALSE; + CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); +} + +/************************************************************************* +|* SoldepToolBox::Command() +|************************************************************************/ + +void SoldepToolBox::Command( const CommandEvent& rCEvt) +{ + if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) + { + if( !IsFloatingMode() && bDockable + && ( GetItemRect(GetItemId( 0 )).IsInside(rCEvt.GetMousePosPixel()))) + { + // Hier das Context-Menue fuer Abreiddel dynamisch erzeugen... + + PopupMenu aPopupMenu; + + String sText( String::CreateFromAscii( "Floating mode" )); + aPopupMenu.InsertItem( 5, sText ); + aPopupMenu.InsertSeparator(); + + sText = String::CreateFromAscii( "Top" ); + aPopupMenu.InsertItem( 1, sText ); + sText = String::CreateFromAscii( "Bottom" ); + aPopupMenu.InsertItem( 2, sText ); + sText = String::CreateFromAscii( "Left" ); + aPopupMenu.InsertItem( 3, sText ); + sText = String::CreateFromAscii( "Right" ); + aPopupMenu.InsertItem( 4, sText ); + + switch( GetAlign()) + { + case WINDOWALIGN_TOP : aPopupMenu.EnableItem( 1, FALSE ); break; + case WINDOWALIGN_BOTTOM : aPopupMenu.EnableItem( 2, FALSE ); break; + case WINDOWALIGN_LEFT : aPopupMenu.EnableItem( 3, FALSE ); break; + case WINDOWALIGN_RIGHT : aPopupMenu.EnableItem( 4, FALSE ); break; + } + + if (( mnWinStyle & WB_CLOSEABLE ) != 0 ) + { + aPopupMenu.InsertSeparator(); + sText = String::CreateFromAscii( "Hide" ); + aPopupMenu.InsertItem( 6, sText ); + } + else if ( bPinable ) { + aPopupMenu.InsertSeparator(); + sText = String::CreateFromAscii( "Pin" ); + aPopupMenu.InsertItem( 6, sText ); + aPopupMenu.CheckItem( 6, GetPin()); + } + + // ... und rufen. + + aPopupMenu.SetSelectHdl ( LINK ( this, SoldepToolBox, MenuSelectHdl )); + aPopupMenu.Execute( this, rCEvt.GetMousePosPixel()); + } + else if ( !GetItemId(rCEvt.GetMousePosPixel())) + { + CallContextMenu( this, rCEvt.GetMousePosPixel()); + } + } + else ToolBox::Command( rCEvt ); +} + +/************************************************************************* +|* SoldepToolBox::GetContextMenu() +|************************************************************************/ + +PopupMenu *SoldepToolBox::GetContextMenu() +{ + InitContextMenu(); + return &aMenu; +} + +/************************************************************************* +|* SoldepToolBox::InitContextMenu() +|************************************************************************/ + +void SoldepToolBox::InitContextMenu() +{ + USHORT nStart = 0; + if ( bDockable ) + nStart = 1; + + aMenu.Clear(); + + for ( USHORT i = nStart; i < GetItemCount(); i++ ) + { + USHORT nItemId = GetItemId( i ); + + switch ( GetItemType( i )) + { + case TOOLBOXITEM_SPACE: + break; + case TOOLBOXITEM_SEPARATOR : + if (!(( i < GetItemCount() - 1 ) && ( GetItemType( i + 1 ) == TOOLBOXITEM_DONTKNOW ))) + aMenu.InsertSeparator(); + break; + default: + aMenu.InsertItem( nItemId, GetItemText( nItemId ), GetItemImage( nItemId )); + if (IsItemChecked( nItemId )) aMenu.CheckItem( nItemId, TRUE ); + if (!IsItemEnabled( nItemId )) aMenu.EnableItem( nItemId, FALSE ); + if (!IsItemVisible( nItemId )) aMenu.HideItem(nItemId); + break; + } + } +} + +/************************************************************************* +|* SoldepToolBox::CallContextMenu() +|************************************************************************/ + +void SoldepToolBox::CallContextMenu( Window *pWin, Point aPos ) +{ + if ( aMenu.IsInExecute()) + return; + + InitContextMenu(); + + // ... und rufen. + + aMenu.SetSelectHdl ( LINK ( this, SoldepToolBox, MenuSelectHdl )); + aMenu.Execute( pWin, aPos ); +} + +void SoldepToolBox::SetPosSizePixel( const Point& rNewPos, + const Size& rNewSize ) +{ +// if(rNewPos != GetPosPixel() || rNewSize != GetSizePixel()) +// { + ToolBox::SetPosSizePixel(rNewPos,rNewSize); +// Resize(); +// } +} + +void SoldepToolBox::SetDockingRects( const Rectangle& rOutRect, + const Rectangle& rInRect ) +{ + if(rOutRect != aOutRect || rInRect != aInRect) + { + ToolBox::SetDockingRects(rOutRect,rInRect); + Invalidate(); + + aOutRect = rOutRect; + aInRect = rInRect; + } +} + +/*****************************************************************************/ +void SoldepToolBox::StartDocking() +/*****************************************************************************/ +{ + ToolBox::StartDocking(); + CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); +}; + +BOOL SoldepToolBox::GetPin() + +{ + return bPin; +} + +void SoldepToolBox::TogglePin() +{ + bPin = !bPin; +} + +void SoldepToolBox::SetPin( BOOL bP ) +{ + bPin = bP; +} + +/************************************************************************* +|* SoldepToolBox::MenuSelectHdl() +|* +|* Handler, der beim Execute der Context-Mens gerufen wird +|************************************************************************/ + +IMPL_LINK ( SoldepToolBox, MenuSelectHdl, Menu*, pMenu ) +{ + // Wenn die CurItemId <= 6 ist, dann wurde das Abreiddel-Context-Men ausgefhrt ... + ULONG itemid; + itemid = pMenu->GetCurItemId(); + + if ( pMenu == &aMenu ) + { + // ... Andernfalls wurde das Default-Context-Men ausgefhrt ... + USHORT nTmpId = mnCurItemId; + mnCurItemId = pMenu->GetCurItemId(); + + // ... und der gesetzte Handler (in soldep.cxx) wird gerufen. + maSelectHdl.Call( this ); + mnCurItemId = nTmpId; + } + return 0; +}
\ No newline at end of file |