CWS-TOOLING: integrate CWS renaissance1

This commit is contained in:
Vladimir Glazunov 2010-08-26 09:15:18 +02:00
commit 1e6865a751
5 changed files with 95 additions and 14 deletions

View file

@ -244,8 +244,8 @@ ColorData Color::HSBtoRGB( USHORT nHue, USHORT nSat, USHORT nBri )
f = dH - n;
UINT8 a = (UINT8) ( nB * ( 100 - nSat ) / 100 );
UINT8 b = (UINT8) ( nB * ( 100 - ( (double)nSat * f + 0.5 ) ) / 100 );
UINT8 c = (UINT8) ( nB * ( 100 - ( (double)nSat * ( 1.0 - f ) + 0.5 ) ) / 100 );
UINT8 b = (UINT8) ( nB * ( 100 - ( (double)nSat * f ) ) / 100 );
UINT8 c = (UINT8) ( nB * ( 100 - ( (double)nSat * ( 1.0 - f ) ) ) / 100 );
switch( n )
{

View file

@ -586,8 +586,11 @@ private:
-(void)mouseEntered: (NSEvent*)pEvent
{
s_pMouseFrame = mpFrame;
[self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSEMOVE];
// #i107215# the only mouse events we get when inactive are enter/exit
// actually we would like to have all of them, but better none than some
if( [NSApp isActive] )
[self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSEMOVE];
}
-(void)mouseExited: (NSEvent*)pEvent
@ -595,7 +598,10 @@ private:
if( s_pMouseFrame == mpFrame )
s_pMouseFrame = NULL;
[self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSELEAVE];
// #i107215# the only mouse events we get when inactive are enter/exit
// actually we would like to have all of them, but better none than some
if( [NSApp isActive] )
[self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSELEAVE];
}
-(void)rightMouseDown: (NSEvent*)pEvent

View file

@ -201,6 +201,18 @@ public:
BOOL bPropGreat = FALSE );
void SetItemSize( USHORT nId, long nNewSize );
long GetItemSize( USHORT nId ) const;
/** Set a range that limits the (variable part of the) size with an
upper and a lower bound (both are valid values themselves.)
@param nId
Id of the item for which the size limits are set.
@param aRange
Values of -1 define missing bounds, thus setting a range (-1,-1)
(the default) removes the size limitiation.
*/
void SetItemSizeRange (USHORT nId, const Range aRange);
/** Return the current size limits for the specified item.
*/
Range GetItemSizeRange (USHORT nId) const;
long GetItemSize( USHORT nId, SplitWindowItemBits nBits ) const;
void SetItemBits( USHORT nId, SplitWindowItemBits nNewBits );
SplitWindowItemBits GetItemBits( USHORT nId ) const;

View file

@ -961,8 +961,8 @@ BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY )
const long nScanlineSize = pWriteAcc->GetScanlineSize();
const long nNewWidth1 = nNewWidth - 1L;
const long nNewHeight1 = nNewHeight - 1L;
const long nWidth1 = pReadAcc->Width() - 1L;
const long nHeight1 = pReadAcc->Height() - 1L;
const long nWidth = pReadAcc->Width();
const long nHeight = pReadAcc->Height();
long* pLutX = new long[ nNewWidth ];
long* pLutY = new long[ nNewHeight ];
long nX, nY, nMapY, nActY = 0L;
@ -970,10 +970,10 @@ BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY )
if( nNewWidth1 && nNewHeight1 )
{
for( nX = 0L; nX < nNewWidth; nX++ )
pLutX[ nX ] = nX * nWidth1 / nNewWidth1;
pLutX[ nX ] = nX * nWidth / nNewWidth;
for( nY = 0L; nY < nNewHeight; nY++ )
pLutY[ nY ] = nY * nHeight1 / nNewHeight1;
pLutY[ nY ] = nY * nHeight / nNewHeight;
while( nActY < nNewHeight )
{

View file

@ -49,7 +49,8 @@
// =======================================================================
// Achtung: Darf keine Objekte enthalten, da mit memmove/memcpy gearbeitet wird
// Attention: Must not contain non-PODs because array is enlarged/copied
// with the use of memmove/memcpy.
struct ImplSplitItem
{
long mnSize;
@ -71,6 +72,10 @@ struct ImplSplitItem
SplitWindowItemBits mnBits;
BOOL mbFixed;
BOOL mbSubSize;
/// Minimal width or height of the item. -1 means no restriction.
long mnMinSize;
/// Maximal width or height of the item. -1 means no restriction.
long mnMaxSize;
};
struct ImplSplitSet
@ -85,6 +90,28 @@ struct ImplSplitSet
BOOL mbCalcPix;
};
/** Check whether the given size is inside the valid range defined by
[rItem.mnMinSize,rItem.mnMaxSize]. When it is not inside it then return
the upper or lower bound, respectively. Otherwise return the given size
unmodified.
Note that either mnMinSize and/or mnMaxSize can be -1 in which case the
size has not lower or upper bound.
*/
namespace {
long ValidateSize (const long nSize, const ImplSplitItem rItem)
{
if (rItem.mnMinSize>=0 && nSize<rItem.mnMinSize)
return rItem.mnMinSize;
else if (rItem.mnMaxSize>0 && nSize>rItem.mnMaxSize)
return rItem.mnMaxSize;
else
return nSize;
}
}
#define SPLITWIN_SPLITSIZE 3
#define SPLITWIN_SPLITSIZEEX 4
#define SPLITWIN_SPLITSIZEEXLN 6
@ -2850,7 +2877,7 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize,
DBG_ASSERT( !ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::InsertItem() - Id already exists" );
#endif
// Size muss min. 1 sein
// Size has to be at least 1.
if ( nSize < 1 )
nSize = 1;
@ -2858,7 +2885,7 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize,
ImplSplitSet* pNewSet;
ImplSplitItem* pItem;
// Platz fuer neues Item schaffen
// Make room for the new item.
if ( nPos > pSet->mnItems )
nPos = pSet->mnItems;
ImplSplitItem* pNewItems = new ImplSplitItem[pSet->mnItems+1];
@ -2871,19 +2898,21 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize,
pSet->mnItems++;
pSet->mbCalcPix = TRUE;
// Item anlegen und erweitern
// Create and initialize item.
pItem = &(pSet->mpItems[nPos]);
memset( pItem, 0, sizeof( ImplSplitItem ) );
pItem->mnSize = nSize;
pItem->mnId = nId;
pItem->mnBits = nBits;
pItem->mnMinSize=-1;
pItem->mnMaxSize=-1;
if ( pWindow )
{
pItem->mpWindow = pWindow;
pItem->mpOrgParent = pWindow->GetParent();
// Window mit SplitWindow verbinden
// Attach window to SplitWindow.
pWindow->Hide();
pWindow->SetParent( this );
}
@ -3251,6 +3280,10 @@ void SplitWindow::SplitItem( USHORT nId, long nNewSize,
nItems = pSet->mnItems;
pItems = pSet->mpItems;
// When there is an explicit minimum or maximum size then move nNewSize
// into that range (when it is not yet already in it.)
nNewSize = ValidateSize(nNewSize, pItems[nPos]);
if ( mbCalc )
{
pItems[nPos].mnSize = nNewSize;
@ -3552,6 +3585,36 @@ long SplitWindow::GetItemSize( USHORT nId, SplitWindowItemBits nBits ) const
return 0;
}
void SplitWindow::SetItemSizeRange (USHORT nId, const Range aRange)
{
USHORT nPos;
ImplSplitSet* pSet = ImplFindItem(mpBaseSet, nId, nPos);
if (pSet != NULL)
{
pSet->mpItems[nPos].mnMinSize = aRange.Min();
pSet->mpItems[nPos].mnMaxSize = aRange.Max();
}
}
Range SplitWindow::GetItemSizeRange (USHORT nId) const
{
USHORT nPos;
ImplSplitSet* pSet = ImplFindItem(mpBaseSet, nId, nPos);
if (pSet != NULL)
return Range (pSet->mpItems[nPos].mnMinSize, pSet->mpItems[nPos].mnMaxSize);
else
return Range(-1,-1);
}
// -----------------------------------------------------------------------
void SplitWindow::SetItemBits( USHORT nId, SplitWindowItemBits nNewBits )