diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-12-09 10:13:55 +0100 |
---|---|---|
committer | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-12-09 10:13:55 +0100 |
commit | 9103c81b03961788743d6248099f6a7f35f735d9 (patch) | |
tree | 693b2ab70bacc925b9dbf01a2ed0db5e0911d7f8 /vcl/aqua/source | |
parent | 38440ad6b24f618923a48d722a861f78c1715be5 (diff) | |
parent | a5509a421f2f3d43aad1ba5d32e6c7bf1c015b3b (diff) |
mib19: rebase to DEV300m95
Diffstat (limited to 'vcl/aqua/source')
-rw-r--r-- | vcl/aqua/source/app/salinst.cxx | 35 | ||||
-rw-r--r-- | vcl/aqua/source/app/salsys.cxx | 101 | ||||
-rwxr-xr-x | vcl/aqua/source/app/vclnsapp.mm | 6 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DataFlavorMapping.cxx | 10 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DragSource.cxx | 14 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/DragSource.hxx | 2 | ||||
-rw-r--r-- | vcl/aqua/source/dtrans/aqua_service.cxx | 22 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/aquaprintaccessoryview.mm | 678 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salgdi.cxx | 26 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salprn.cxx | 2 | ||||
-rw-r--r-- | vcl/aqua/source/window/salframe.cxx | 124 | ||||
-rwxr-xr-x | vcl/aqua/source/window/salframeview.mm | 26 | ||||
-rw-r--r-- | vcl/aqua/source/window/salmenu.cxx | 7 |
13 files changed, 712 insertions, 341 deletions
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index b8a2261ed9db..5d2fc3f00741 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -371,13 +371,13 @@ SalYieldMutex::SalYieldMutex() void SalYieldMutex::acquire() { OMutex::acquire(); - mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier(); + mnThreadId = vos::OThread::getCurrentIdentifier(); mnCount++; } void SalYieldMutex::release() { - if ( mnThreadId == NAMESPACE_VOS(OThread)::getCurrentIdentifier() ) + if ( mnThreadId == vos::OThread::getCurrentIdentifier() ) { if ( mnCount == 1 ) mnThreadId = 0; @@ -390,7 +390,7 @@ sal_Bool SalYieldMutex::tryToAcquire() { if ( OMutex::tryToAcquire() ) { - mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier(); + mnThreadId = vos::OThread::getCurrentIdentifier(); mnCount++; return sal_True; } @@ -449,7 +449,7 @@ SalInstance* CreateSalInstance() ImplGetSVData()->maNWFData.mbCenteredTabs = true; ImplGetSVData()->maNWFData.mbProgressNeedsErase = true; ImplGetSVData()->maNWFData.mbCheckBoxNeedsErase = true; - ImplGetSVData()->maGDIData.mbPrinterPullModel = true; + ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset = 10; ImplGetSVData()->maGDIData.mbNoXORClipping = true; ImplGetSVData()->maWinData.mbNoSaveBackground = true; @@ -536,7 +536,7 @@ ULONG AquaSalInstance::ReleaseYieldMutex() { SalYieldMutex* pYieldMutex = mpSalYieldMutex; if ( pYieldMutex->GetThreadId() == - NAMESPACE_VOS(OThread)::getCurrentIdentifier() ) + vos::OThread::getCurrentIdentifier() ) { ULONG nCount = pYieldMutex->GetAcquireCount(); ULONG n = nCount; @@ -566,6 +566,22 @@ void AquaSalInstance::AcquireYieldMutex( ULONG nCount ) // ----------------------------------------------------------------------- +bool AquaSalInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != + vos::OThread::getCurrentIdentifier() ) + { + bRet = false; + } + + return bRet; +} + +// ----------------------------------------------------------------------- + bool AquaSalInstance::isNSAppThread() const { return vos::OThread::getCurrentIdentifier() == maMainThread; @@ -975,6 +991,9 @@ void AquaSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) XubString AquaSalInstance::GetDefaultPrinter() { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( ! maDefaultPrinter.getLength() ) { NSPrintInfo* pPI = [NSPrintInfo sharedPrintInfo]; @@ -999,6 +1018,9 @@ XubString AquaSalInstance::GetDefaultPrinter() SalInfoPrinter* AquaSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pSetupData ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + SalInfoPrinter* pNewInfoPrinter = NULL; if( pQueueInfo ) { @@ -1014,6 +1036,9 @@ SalInfoPrinter* AquaSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueI void AquaSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + delete pPrinter; } diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx index 3b548099feef..cf5cf00b7fe4 100644 --- a/vcl/aqua/source/app/salsys.cxx +++ b/vcl/aqua/source/app/salsys.cxx @@ -30,9 +30,11 @@ #include "tools/rc.hxx" #include "vcl/svids.hrc" +#include "vcl/button.hxx" #include "salsys.h" #include "saldata.hxx" +#include "salinst.h" #include "rtl/ustrbuf.hxx" using namespace rtl; @@ -114,12 +116,22 @@ rtl::OUString AquaSalSystem::GetScreenName( unsigned int nScreen ) return aRet; } -int AquaSalSystem::ShowNativeDialog( const String& rTitle, - const String& rMessage, - const std::list< String >& rButtons, - int nDefButton ) +static NSString* getStandardString( int nButtonId ) { - return 0; + rtl::OUString aText( Button::GetStandardText( nButtonId ) ); + if( ! aText.getLength() ) // this is for bad cases, we might be missing the vcl resource + { + switch( nButtonId ) + { + case BUTTON_OK: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OK" ) );break; + case BUTTON_ABORT: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) );break; + case BUTTON_CANCEL: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cancel" ) );break; + case BUTTON_RETRY: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Retry" ) );break; + case BUTTON_YES: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Yes" ) );break; + case BUTTON_NO : aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No" ) );break; + } + } + return aText.getLength() ? CreateNSString( aText) : nil; } int AquaSalSystem::ShowNativeMessageBox( const String& rTitle, @@ -127,5 +139,82 @@ int AquaSalSystem::ShowNativeMessageBox( const String& rTitle, int nButtonCombination, int nDefaultButton) { - return 0; + NSString* pTitle = CreateNSString( rTitle ); + NSString* pMessage = CreateNSString( rMessage ); + + struct id_entry + { + int nCombination; + int nDefaultButton; + int nTextIds[3]; + } aButtonIds[] = + { + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, -1, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, BUTTON_CANCEL, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_OK, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT, { BUTTON_ABORT, BUTTON_IGNORE, BUTTON_RETRY } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_IGNORE, BUTTON_ABORT } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE, { BUTTON_IGNORE, BUTTON_IGNORE, BUTTON_ABORT } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, BUTTON_CANCEL } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, BUTTON_CANCEL } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_YES, BUTTON_NO } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_CANCEL, -1 } }, + { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_RETRY, -1 } } + }; + + NSString* pDefText = nil; + NSString* pAltText = nil; + NSString* pOthText = nil; + + unsigned int nC; + for( nC = 0; nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]); nC++ ) + { + if( aButtonIds[nC].nCombination == nButtonCombination ) + { + if( aButtonIds[nC].nDefaultButton == nDefaultButton ) + { + if( aButtonIds[nC].nTextIds[0] != -1 ) + pDefText = getStandardString( aButtonIds[nC].nTextIds[0] ); + if( aButtonIds[nC].nTextIds[1] != -1 ) + pAltText = getStandardString( aButtonIds[nC].nTextIds[1] ); + if( aButtonIds[nC].nTextIds[2] != -1 ) + pOthText = getStandardString( aButtonIds[nC].nTextIds[2] ); + break; + } + } + } + + + int nResult = NSRunAlertPanel( pTitle, pMessage, pDefText, pAltText, pOthText ); + + if( pTitle ) + [pTitle release]; + if( pMessage ) + [pMessage release]; + if( pDefText ) + [pDefText release]; + if( pAltText ) + [pAltText release]; + if( pOthText ) + [pOthText release]; + + int nRet = 0; + if( nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]) && nResult >= 1 && nResult <= 3 ) + { + int nPressed = aButtonIds[nC].nTextIds[nResult-1]; + switch( nPressed ) + { + case BUTTON_NO: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; break; + case BUTTON_YES: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; break; + case BUTTON_OK: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; break; + case BUTTON_CANCEL: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; break; + case BUTTON_ABORT: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; break; + case BUTTON_RETRY: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; break; + case BUTTON_IGNORE: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; break; + } + } + + return nRet; } diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index 4264f8802126..06af0358c52b 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -360,6 +360,8 @@ -(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app { + YIELD_GUARD; + SalData* pSalData = GetSalData(); #if 1 // currently do some really bad hack if( ! pSalData->maFrames.empty() ) @@ -424,6 +426,8 @@ -(void)systemColorsChanged: (NSNotification*) pNotification { + YIELD_GUARD; + const SalData* pSalData = GetSalData(); if( !pSalData->maFrames.empty() ) pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL ); @@ -431,6 +435,8 @@ -(void)screenParametersChanged: (NSNotification*) pNotification { + YIELD_GUARD; + SalData* pSalData = GetSalData(); std::list< AquaSalFrame* >::iterator it; for( it = pSalData->maFrames.begin(); it != pSalData->maFrames.end(); ++it ) diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index e0a95a532bf8..01f989cbc1c1 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -575,11 +575,19 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor, Refe if (isByteSequenceType(data.getValueType())) { + /* + the HTMLFormatDataProvider prepends segment information to HTML + this is useful for exchange with MS Word (which brings this stuff from Windows) + but annoying for other applications. Since this extension is not a standard datatype + on the Mac, let us not provide but provide normal HTML + if ([systemFlavor caseInsensitiveCompare: NSHTMLPboardType] == NSOrderedSame) { dp = DataProviderPtr_t(new HTMLFormatDataProvider(data)); } - else if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) + else + */ + if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) { dp = DataProviderPtr_t(new BMPDataProvider(data, PICTImageFileType)); } diff --git a/vcl/aqua/source/dtrans/DragSource.cxx b/vcl/aqua/source/dtrans/DragSource.cxx index adb247d70711..1a8f950e50d4 100644 --- a/vcl/aqua/source/dtrans/DragSource.cxx +++ b/vcl/aqua/source/dtrans/DragSource.cxx @@ -38,6 +38,7 @@ #include "DragSourceContext.hxx" #include "aqua_clipboard.hxx" #include "DragActionConversion.hxx" +#include "salframe.h" #include <rtl/ustring.h> #include <memory> @@ -158,6 +159,7 @@ Sequence<OUString> dragSource_getSupportedServiceNames() DragSource::DragSource(): WeakComponentImplHelper3<XDragSource, XInitialization, XServiceInfo>(m_aMutex), mView(NULL), + mpFrame(NULL), mLastMouseEventBeforeStartDrag(nil), m_MouseButton(0) { @@ -166,8 +168,9 @@ DragSource::DragSource(): DragSource::~DragSource() { - [(id <MouseEventListener>)mView unregisterMouseEventListener: mDragSourceHelper]; - [mDragSourceHelper release]; + if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) + [(id <MouseEventListener>)mView unregisterMouseEventListener: mDragSourceHelper]; + [mDragSourceHelper release]; } @@ -197,6 +200,13 @@ void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments) throw Exception(OUString(RTL_CONSTASCII_USTRINGPARAM("DragSource::initialize: Provided view doesn't support mouse listener")), static_cast<OWeakObject*>(this)); } + NSWindow* pWin = [mView window]; + if( ! pWin || ![pWin respondsToSelector: @selector(getSalFrame)] ) + { + throw Exception(OUString(RTL_CONSTASCII_USTRINGPARAM("DragSource::initialize: Provided view is not attached to a vcl frame")), + static_cast<OWeakObject*>(this)); + } + mpFrame = (AquaSalFrame*)[pWin performSelector: @selector(getSalFrame)]; mDragSourceHelper = [[DragSourceHelper alloc] initWithDragSource: this]; diff --git a/vcl/aqua/source/dtrans/DragSource.hxx b/vcl/aqua/source/dtrans/DragSource.hxx index 5d02b9874149..f8f55176a308 100644 --- a/vcl/aqua/source/dtrans/DragSource.hxx +++ b/vcl/aqua/source/dtrans/DragSource.hxx @@ -46,6 +46,7 @@ class DragSource; +class AquaSalFrame; /* The functions declared in this protocol are actually declared in vcl/aqua/inc/salframe.h. Because we want @@ -120,6 +121,7 @@ public: com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDragSourceContext > mXCurrentContext; id mView; + AquaSalFrame* mpFrame; NSEvent* mLastMouseEventBeforeStartDrag; DragSourceHelper* mDragSourceHelper; com::sun::star::awt::MouseEvent mMouseEvent; diff --git a/vcl/aqua/source/dtrans/aqua_service.cxx b/vcl/aqua/source/dtrans/aqua_service.cxx index 571bea2e554f..57ef1f11175c 100644 --- a/vcl/aqua/source/dtrans/aqua_service.cxx +++ b/vcl/aqua/source/dtrans/aqua_service.cxx @@ -58,28 +58,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey ) -{ - sal_Bool bRetVal = sal_False; - - if ( pRegistryKey ) - { - try - { - Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) ); - pXNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( AQUA_CLIPBOARD_REGKEY_NAME ) ) ); - bRetVal = sal_True; - } - catch( InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "InvalidRegistryException caught"); - bRetVal = sal_False; - } - } - - return bRetVal; -} - void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey ) { void* pRet = 0; diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index d00fc9a6cd0e..d19290d8320a 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -112,7 +112,7 @@ class ControllerProperties maLocalizedStrings( VclResId( SV_PRINT_NATIVE_STRINGS ) ) { mpState->bNeedRestart = false; - DBG_ASSERT( maLocalizedStrings.Count() >= 4, "resources not found !" ); + DBG_ASSERT( maLocalizedStrings.Count() >= 5, "resources not found !" ); } rtl::OUString getMoreString() @@ -122,6 +122,13 @@ class ControllerProperties : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "More" ) ); } + rtl::OUString getPrintSelectionString() + { + return maLocalizedStrings.Count() >= 5 + ? rtl::OUString( maLocalizedStrings.GetString( 4 ) ) + : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Print selection only" ) ); + } + void updatePrintJob() { // TODO: refresh page count etc from mpController @@ -246,7 +253,11 @@ class ControllerProperties PropertyValue* pVal = mpController->getValue( name_it->second ); if( pVal ) { - pVal->Value <<= i_bValue; + // ugly + if( name_it->second.equalsAscii( "PrintContent" ) ) + pVal->Value <<= i_bValue ? sal_Int32(2) : sal_Int32(0); + else + pVal->Value <<= i_bValue; updatePrintJob(); } } @@ -283,7 +294,7 @@ class ControllerProperties -1; std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( nTag ); - if( name_it != maTagToPropertyName.end() ) + if( name_it != maTagToPropertyName.end() && ! name_it->second.equalsAscii( "PrintContent" ) ) { MacOSBOOL bEnabled = mpController->isUIOptionEnabled( name_it->second ) ? YES : NO; if( pCtrl ) @@ -768,6 +779,319 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) } } +static void addSubgroup( NSView* pCurParent, long& rCurY, const rtl::OUString& rText ) +{ + NSControl* pTextView = createLabel( rText ); + [pCurParent addSubview: [pTextView autorelease]]; + NSRect aTextRect = [pTextView frame]; + // move to nCurY + aTextRect.origin.y = rCurY - aTextRect.size.height; + [pTextView setFrame: aTextRect]; + + NSRect aSepRect = { { aTextRect.size.width + 1, aTextRect.origin.y }, { 100, 6 } }; + NSBox* pBox = [[NSBox alloc] initWithFrame: aSepRect]; + [pBox setBoxType: NSBoxSeparator]; + [pCurParent addSubview: [pBox autorelease]]; + + // update nCurY + rCurY = aTextRect.origin.y - 5; +} + +static void addBool( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset, + const rtl::OUString& rText, sal_Bool bEnabled, + const rtl::OUString& rProperty, sal_Bool bValue, + std::vector<ColumnItem >& rRightColumn, + ControllerProperties* pControllerProperties, + ControlTarget* pCtrlTarget + ) +{ + NSRect aCheckRect = { { rCurX + nAttachOffset, 0 }, { 0, 15 } }; + NSButton* pBtn = [[NSButton alloc] initWithFrame: aCheckRect]; + [pBtn setButtonType: NSSwitchButton]; + [pBtn setState: bValue ? NSOnState : NSOffState]; + if( ! bEnabled ) + [pBtn setEnabled: NO]; + linebreakCell( [pBtn cell], rText ); + [pBtn sizeToFit]; + [pCurParent addSubview: [pBtn autorelease]]; + + rRightColumn.push_back( ColumnItem( pBtn ) ); + + // connect target + [pBtn setTarget: pCtrlTarget]; + [pBtn setAction: @selector(triggered:)]; + int nTag = pControllerProperties->addNameTag( rProperty ); + pControllerProperties->addObservedControl( pBtn ); + [pBtn setTag: nTag]; + + aCheckRect = [pBtn frame]; + + // move to rCurY + aCheckRect.origin.y = rCurY - aCheckRect.size.height; + [pBtn setFrame: aCheckRect]; + + // update rCurY + rCurY = aCheckRect.origin.y - 5; +} + +static void addRadio( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset, + const rtl::OUString& rText, + const rtl::OUString& rProperty, Sequence< rtl::OUString > rChoices, sal_Int32 nSelectValue, + std::vector<ColumnItem >& rLeftColumn, + std::vector<ColumnItem >& rRightColumn, + ControllerProperties* pControllerProperties, + ControlTarget* pCtrlTarget + ) +{ + sal_Int32 nOff = 0; + if( rText.getLength() ) + { + // add a label + NSControl* pTextView = createLabel( rText ); + NSRect aTextRect = [pTextView frame]; + aTextRect.origin.x = rCurX + nAttachOffset; + [pCurParent addSubview: [pTextView autorelease]]; + + rLeftColumn.push_back( ColumnItem( pTextView ) ); + + // move to nCurY + aTextRect.origin.y = rCurY - aTextRect.size.height; + [pTextView setFrame: aTextRect]; + + // update nCurY + rCurY = aTextRect.origin.y - 5; + + // indent the radio group relative to the text + // nOff = 20; + } + + // setup radio matrix + NSButtonCell* pProto = [[NSButtonCell alloc] init]; + + NSRect aRadioRect = { { rCurX + nOff, 0 }, { 280 - rCurX, 5*rChoices.getLength() } }; + [pProto setTitle: @"RadioButtonGroup"]; + [pProto setButtonType: NSRadioButton]; + NSMatrix* pMatrix = [[NSMatrix alloc] initWithFrame: aRadioRect + mode: NSRadioModeMatrix + prototype: (NSCell*)pProto + numberOfRows: rChoices.getLength() + numberOfColumns: 1]; + // set individual titles + NSArray* pCells = [pMatrix cells]; + for( sal_Int32 m = 0; m < rChoices.getLength(); m++ ) + { + NSCell* pCell = [pCells objectAtIndex: m]; + filterAccelerator( rChoices[m] ); + linebreakCell( pCell, rChoices[m] ); + // connect target and action + [pCell setTarget: pCtrlTarget]; + [pCell setAction: @selector(triggered:)]; + int nTag = pControllerProperties->addNameAndValueTag( rProperty, m ); + pControllerProperties->addObservedControl( pCell ); + [pCell setTag: nTag]; + // set current selection + if( nSelectValue == m ) + [pMatrix selectCellAtRow: m column: 0]; + } + [pMatrix sizeToFit]; + aRadioRect = [pMatrix frame]; + + // move it down, so it comes to the correct position + aRadioRect.origin.y = rCurY - aRadioRect.size.height; + [pMatrix setFrame: aRadioRect]; + [pCurParent addSubview: [pMatrix autorelease]]; + + rRightColumn.push_back( ColumnItem( pMatrix ) ); + + // update nCurY + rCurY = aRadioRect.origin.y - 5; + + [pProto release]; +} + +static void addList( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset, + const rtl::OUString& rText, + const rtl::OUString& rProperty, const Sequence< rtl::OUString > rChoices, sal_Int32 nSelectValue, + std::vector<ColumnItem >& rLeftColumn, + std::vector<ColumnItem >& rRightColumn, + ControllerProperties* pControllerProperties, + ControlTarget* pCtrlTarget + ) +{ + // don't indent attached lists, looks bad in the existing cases + NSControl* pTextView = createLabel( rText ); + [pCurParent addSubview: [pTextView autorelease]]; + rLeftColumn.push_back( ColumnItem( pTextView ) ); + NSRect aTextRect = [pTextView frame]; + aTextRect.origin.x = rCurX /* + nAttachOffset*/; + + // don't indent attached lists, looks bad in the existing cases + NSRect aBtnRect = { { rCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0 }, { 0, 15 } }; + NSPopUpButton* pBtn = [[NSPopUpButton alloc] initWithFrame: aBtnRect pullsDown: NO]; + + // iterate options + for( sal_Int32 m = 0; m < rChoices.getLength(); m++ ) + { + NSString* pItemText = CreateNSString( rChoices[m] ); + [pBtn addItemWithTitle: pItemText]; + NSMenuItem* pItem = [pBtn itemWithTitle: pItemText]; + int nTag = pControllerProperties->addNameAndValueTag( rProperty, m ); + [pItem setTag: nTag]; + [pItemText release]; + } + + [pBtn selectItemAtIndex: nSelectValue]; + + // add the button to observed controls for enabled state changes + // also add a tag just for this purpose + pControllerProperties->addObservedControl( pBtn ); + [pBtn setTag: pControllerProperties->addNameTag( rProperty )]; + + [pBtn sizeToFit]; + [pCurParent addSubview: [pBtn autorelease]]; + + rRightColumn.push_back( ColumnItem( pBtn ) ); + + // connect target and action + [pBtn setTarget: pCtrlTarget]; + [pBtn setAction: @selector(triggered:)]; + + // move to nCurY + aBtnRect = [pBtn frame]; + aBtnRect.origin.y = rCurY - aBtnRect.size.height; + [pBtn setFrame: aBtnRect]; + + // align label + aTextRect.origin.y = aBtnRect.origin.y + (aBtnRect.size.height - aTextRect.size.height)/2; + [pTextView setFrame: aTextRect]; + + // update rCurY + rCurY = aBtnRect.origin.y - 5; +} + +static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset, + const rtl::OUString rCtrlType, + const rtl::OUString& rText, + const rtl::OUString& rProperty, const PropertyValue* pValue, + sal_Int64 nMinValue, sal_Int64 nMaxValue, + std::vector<ColumnItem >& rLeftColumn, + std::vector<ColumnItem >& rRightColumn, + ControllerProperties* pControllerProperties, + ControlTarget* pCtrlTarget + ) +{ + sal_Int32 nOff = 0; + if( rText.getLength() ) + { + // add a label + NSControl* pTextView = createLabel( rText ); + [pCurParent addSubview: [pTextView autorelease]]; + + rLeftColumn.push_back( ColumnItem( pTextView ) ); + + // move to nCurY + NSRect aTextRect = [pTextView frame]; + aTextRect.origin.x = rCurX + nAttachOffset; + aTextRect.origin.y = rCurY - aTextRect.size.height; + [pTextView setFrame: aTextRect]; + + // update nCurY + rCurY = aTextRect.origin.y - 5; + + // and set the offset for the real edit field + nOff = aTextRect.size.width + 5; + } + + NSRect aFieldRect = { { rCurX + nOff + nAttachOffset, 0 }, { 100, 25 } }; + NSTextField* pFieldView = [[NSTextField alloc] initWithFrame: aFieldRect]; + [pFieldView setEditable: YES]; + [pFieldView setSelectable: YES]; + [pFieldView setDrawsBackground: YES]; + [pFieldView sizeToFit]; // FIXME: this does nothing + [pCurParent addSubview: [pFieldView autorelease]]; + + rRightColumn.push_back( ColumnItem( pFieldView ) ); + + // add the field to observed controls for enabled state changes + // also add a tag just for this purpose + pControllerProperties->addObservedControl( pFieldView ); + int nTag = pControllerProperties->addNameTag( rProperty ); + [pFieldView setTag: nTag]; + // pControllerProperties->addNamedView( pFieldView, aPropertyName ); + + // move to nCurY + aFieldRect.origin.y = rCurY - aFieldRect.size.height; + [pFieldView setFrame: aFieldRect]; + + if( rCtrlType.equalsAscii( "Range" ) ) + { + // add a stepper control + NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5, + aFieldRect.origin.y }, + { 15, aFieldRect.size.height } }; + NSStepper* pStep = [[NSStepper alloc] initWithFrame: aStepFrame]; + [pStep setIncrement: 1]; + [pStep setValueWraps: NO]; + [pStep setTag: nTag]; + [pCurParent addSubview: [pStep autorelease]]; + + rRightColumn.back().pSubControl = pStep; + + pControllerProperties->addObservedControl( pStep ); + [pStep setTarget: pCtrlTarget]; + [pStep setAction: @selector(triggered:)]; + + // constrain the text field to decimal numbers + NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init]; + [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4]; + [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle]; + [pFormatter setAllowsFloats: NO]; + [pFormatter setMaximumFractionDigits: 0]; + if( nMinValue != nMaxValue ) + { + [pFormatter setMinimum: [[NSNumber numberWithInt: nMinValue] autorelease]]; + [pStep setMinValue: nMinValue]; + [pFormatter setMaximum: [[NSNumber numberWithInt: nMaxValue] autorelease]]; + [pStep setMaxValue: nMaxValue]; + } + [pFieldView setFormatter: pFormatter]; + + sal_Int64 nSelectVal = 0; + if( pValue && pValue->Value.hasValue() ) + pValue->Value >>= nSelectVal; + + [pFieldView setIntValue: nSelectVal]; + [pStep setIntValue: nSelectVal]; + + pControllerProperties->addViewPair( pFieldView, pStep ); + // connect target and action + [pFieldView setTarget: pCtrlTarget]; + [pFieldView setAction: @selector(triggeredNumeric:)]; + [pStep setTarget: pCtrlTarget]; + [pStep setAction: @selector(triggeredNumeric:)]; + } + else + { + // connect target and action + [pFieldView setTarget: pCtrlTarget]; + [pFieldView setAction: @selector(triggered:)]; + + if( pValue && pValue->Value.hasValue() ) + { + rtl::OUString aValue; + pValue->Value >>= aValue; + if( aValue.getLength() ) + { + NSString* pText = CreateNSString( aValue ); + [pFieldView setStringValue: pText]; + [pText release]; + } + } + } + + // update nCurY + rCurY = aFieldRect.origin.y - 5; +} @implementation AquaPrintAccessoryView +(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState; @@ -792,6 +1116,54 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) ControlTarget* pCtrlTarget = [[ControlTarget alloc] initWithControllerMap: pControllerProperties]; std::vector< ColumnItem > aLeftColumn, aRightColumn; + + // ugly: + // prepend a "selection" checkbox if the properties have such a selection in PrintContent + bool bAddSelectionCheckBox = false, bSelectionBoxEnabled = false, bSelectionBoxChecked = false; + for( int i = 0; i < rOptions.getLength(); i++ ) + { + Sequence< beans::PropertyValue > aOptProp; + rOptions[i].Value >>= aOptProp; + + rtl::OUString aCtrlType; + rtl::OUString aPropertyName; + Sequence< rtl::OUString > aChoices; + Sequence< sal_Bool > aChoicesDisabled; + sal_Int32 aSelectionChecked = 0; + for( int n = 0; n < aOptProp.getLength(); n++ ) + { + const beans::PropertyValue& rEntry( aOptProp[ n ] ); + if( rEntry.Name.equalsAscii( "ControlType" ) ) + { + rEntry.Value >>= aCtrlType; + } + else if( rEntry.Name.equalsAscii( "Choices" ) ) + { + rEntry.Value >>= aChoices; + } + else if( rEntry.Name.equalsAscii( "ChoicesDisabled" ) ) + { + rEntry.Value >>= aChoicesDisabled; + } + else if( rEntry.Name.equalsAscii( "Property" ) ) + { + PropertyValue aVal; + rEntry.Value >>= aVal; + aPropertyName = aVal.Name; + if( aPropertyName.equalsAscii( "PrintContent" ) ) + aVal.Value >>= aSelectionChecked; + } + } + if( aCtrlType.equalsAscii( "Radio" ) && + aPropertyName.equalsAscii( "PrintContent" ) && + aChoices.getLength() > 2 ) + { + bAddSelectionCheckBox = true; + bSelectionBoxEnabled = aChoicesDisabled.getLength() < 2 || ! aChoicesDisabled[2]; + bSelectionBoxChecked = (aSelectionChecked==2); + break; + } + } for( int i = 0; i < rOptions.getLength(); i++ ) { @@ -803,6 +1175,7 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) rtl::OUString aCtrlType; rtl::OUString aText; rtl::OUString aPropertyName; + rtl::OUString aGroupHint; Sequence< rtl::OUString > aChoices; sal_Int64 nMinValue = 0, nMaxValue = 0; long nAttachOffset = 0; @@ -852,6 +1225,10 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) { rEntry.Value >>= bIgnore; } + else if( rEntry.Name.equalsAscii( "GroupingHint" ) ) + { + rEntry.Value >>= aGroupHint; + } } if( aCtrlType.equalsAscii( "Group" ) || @@ -894,6 +1271,15 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) // clear columns aLeftColumn.clear(); aRightColumn.clear(); + + if( bAddSelectionCheckBox ) + { + addBool( pCurParent, nCurX, nCurY, 0, + pControllerProperties->getPrintSelectionString(), bSelectionBoxEnabled, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ), bSelectionBoxChecked, + aRightColumn, pControllerProperties, pCtrlTarget ); + bAddSelectionCheckBox = false; + } } if( aCtrlType.equalsAscii( "Subgroup" ) && pCurParent ) @@ -902,302 +1288,56 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) if( bIgnore ) continue; - NSControl* pTextView = createLabel( aText ); - [pCurParent addSubview: [pTextView autorelease]]; - NSRect aTextRect = [pTextView frame]; - // move to nCurY - aTextRect.origin.y = nCurY - aTextRect.size.height; - [pTextView setFrame: aTextRect]; - - NSRect aSepRect = { { aTextRect.size.width + 1, aTextRect.origin.y }, { 100, 6 } }; - NSBox* pBox = [[NSBox alloc] initWithFrame: aSepRect]; - [pBox setBoxType: NSBoxSeparator]; - [pCurParent addSubview: [pBox autorelease]]; - - // update nCurY - nCurY = aTextRect.origin.y - 5; + addSubgroup( pCurParent, nCurY, aText ); } else if( bIgnoreSubgroup || bIgnore ) + { continue; + } else if( aCtrlType.equalsAscii( "Bool" ) && pCurParent ) { - NSRect aCheckRect = { { nCurX + nAttachOffset, 0 }, { 0, 15 } }; - NSButton* pBtn = [[NSButton alloc] initWithFrame: aCheckRect]; - [pBtn setButtonType: NSSwitchButton]; sal_Bool bVal = sal_False; PropertyValue* pVal = pController->getValue( aPropertyName ); if( pVal ) pVal->Value >>= bVal; - [pBtn setState: bVal ? NSOnState : NSOffState]; - linebreakCell( [pBtn cell], aText ); - [pBtn sizeToFit]; - [pCurParent addSubview: [pBtn autorelease]]; - - aRightColumn.push_back( ColumnItem( pBtn ) ); - - // connect target - [pBtn setTarget: pCtrlTarget]; - [pBtn setAction: @selector(triggered:)]; - int nTag = pControllerProperties->addNameTag( aPropertyName ); - pControllerProperties->addObservedControl( pBtn ); - [pBtn setTag: nTag]; - - aCheckRect = [pBtn frame]; - - // move to nCurY - aCheckRect.origin.y = nCurY - aCheckRect.size.height; - [pBtn setFrame: aCheckRect]; - - // update nCurY - nCurY = aCheckRect.origin.y - 5; + addBool( pCurParent, nCurX, nCurY, nAttachOffset, + aText, true, aPropertyName, bVal, + aRightColumn, pControllerProperties, pCtrlTarget ); } else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent ) { - sal_Int32 nOff = 0; - if( aText.getLength() ) - { - // add a label - NSControl* pTextView = createLabel( aText ); - NSRect aTextRect = [pTextView frame]; - aTextRect.origin.x = nCurX + nAttachOffset; - [pCurParent addSubview: [pTextView autorelease]]; - - aLeftColumn.push_back( ColumnItem( pTextView ) ); - - // move to nCurY - aTextRect.origin.y = nCurY - aTextRect.size.height; - [pTextView setFrame: aTextRect]; - - // update nCurY - nCurY = aTextRect.origin.y - 5; - - // indent the radio group relative to the text - // nOff = 20; - } - - // setup radio matrix - NSButtonCell* pProto = [[NSButtonCell alloc] init]; - - NSRect aRadioRect = { { nCurX + nOff, 0 }, { 280 - nCurX, 5*aChoices.getLength() } }; - [pProto setTitle: @"RadioButtonGroup"]; - [pProto setButtonType: NSRadioButton]; - NSMatrix* pMatrix = [[NSMatrix alloc] initWithFrame: aRadioRect - mode: NSRadioModeMatrix - prototype: (NSCell*)pProto - numberOfRows: aChoices.getLength() - numberOfColumns: 1]; // get currently selected value sal_Int32 nSelectVal = 0; PropertyValue* pVal = pController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= nSelectVal; - // set individual titles - NSArray* pCells = [pMatrix cells]; - for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) - { - NSCell* pCell = [pCells objectAtIndex: m]; - filterAccelerator( aChoices[m] ); - linebreakCell( pCell, aChoices[m] ); - //NSString* pTitle = CreateNSString( aChoices[m] ); - //[pCell setTitle: pTitle]; - // connect target and action - [pCell setTarget: pCtrlTarget]; - [pCell setAction: @selector(triggered:)]; - int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m ); - pControllerProperties->addObservedControl( pCell ); - [pCell setTag: nTag]; - //[pTitle release]; - // set current selection - if( nSelectVal == m ) - [pMatrix selectCellAtRow: m column: 0]; - } - [pMatrix sizeToFit]; - aRadioRect = [pMatrix frame]; - // move it down, so it comes to the correct position - aRadioRect.origin.y = nCurY - aRadioRect.size.height; - [pMatrix setFrame: aRadioRect]; - [pCurParent addSubview: [pMatrix autorelease]]; - - aRightColumn.push_back( ColumnItem( pMatrix ) ); - - // update nCurY - nCurY = aRadioRect.origin.y - 5; - - [pProto release]; + addRadio( pCurParent, nCurX, nCurY, nAttachOffset, + aText, aPropertyName, aChoices, nSelectVal, + aLeftColumn, aRightColumn, + pControllerProperties, pCtrlTarget ); } else if( aCtrlType.equalsAscii( "List" ) && pCurParent ) { - // don't indent attached lists, looks bad in the existing cases - NSControl* pTextView = createLabel( aText ); - [pCurParent addSubview: [pTextView autorelease]]; - aLeftColumn.push_back( ColumnItem( pTextView ) ); - NSRect aTextRect = [pTextView frame]; - aTextRect.origin.x = nCurX /* + nAttachOffset*/; - - // don't indent attached lists, looks bad in the existing cases - NSRect aBtnRect = { { nCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0 }, { 0, 15 } }; - NSPopUpButton* pBtn = [[NSPopUpButton alloc] initWithFrame: aBtnRect pullsDown: NO]; - - // iterate options - for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) - { - NSString* pItemText = CreateNSString( aChoices[m] ); - [pBtn addItemWithTitle: pItemText]; - NSMenuItem* pItem = [pBtn itemWithTitle: pItemText]; - int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m ); - [pItem setTag: nTag]; - [pItemText release]; - } - PropertyValue* pVal = pController->getValue( aPropertyName ); sal_Int32 aSelectVal = 0; if( pVal && pVal->Value.hasValue() ) pVal->Value >>= aSelectVal; - [pBtn selectItemAtIndex: aSelectVal]; - - // add the button to observed controls for enabled state changes - // also add a tag just for this purpose - pControllerProperties->addObservedControl( pBtn ); - [pBtn setTag: pControllerProperties->addNameTag( aPropertyName )]; - - [pBtn sizeToFit]; - [pCurParent addSubview: [pBtn autorelease]]; - - aRightColumn.push_back( ColumnItem( pBtn ) ); - - // connect target and action - [pBtn setTarget: pCtrlTarget]; - [pBtn setAction: @selector(triggered:)]; - - // move to nCurY - aBtnRect = [pBtn frame]; - aBtnRect.origin.y = nCurY - aBtnRect.size.height; - [pBtn setFrame: aBtnRect]; - - // align label - aTextRect.origin.y = aBtnRect.origin.y + (aBtnRect.size.height - aTextRect.size.height)/2; - [pTextView setFrame: aTextRect]; - // update nCurY - nCurY = aBtnRect.origin.y - 5; + addList( pCurParent, nCurX, nCurY, nAttachOffset, + aText, aPropertyName, aChoices, aSelectVal, + aLeftColumn, aRightColumn, + pControllerProperties, pCtrlTarget ); } else if( (aCtrlType.equalsAscii( "Edit" ) || aCtrlType.equalsAscii( "Range" )) && pCurParent ) { - sal_Int32 nOff = 0; - if( aText.getLength() ) - { - // add a label - NSControl* pTextView = createLabel( aText ); - [pCurParent addSubview: [pTextView autorelease]]; - - aLeftColumn.push_back( ColumnItem( pTextView ) ); - - // move to nCurY - NSRect aTextRect = [pTextView frame]; - aTextRect.origin.x = nCurX + nAttachOffset; - aTextRect.origin.y = nCurY - aTextRect.size.height; - [pTextView setFrame: aTextRect]; - - // update nCurY - nCurY = aTextRect.origin.y - 5; - - // and set the offset for the real edit field - nOff = aTextRect.size.width + 5; - } - - NSRect aFieldRect = { { nCurX + nOff + nAttachOffset, 0 }, { 100, 25 } }; - NSTextField* pFieldView = [[NSTextField alloc] initWithFrame: aFieldRect]; - [pFieldView setEditable: YES]; - [pFieldView setSelectable: YES]; - [pFieldView setDrawsBackground: YES]; - [pFieldView sizeToFit]; // FIXME: this does nothing - [pCurParent addSubview: [pFieldView autorelease]]; - - aRightColumn.push_back( ColumnItem( pFieldView ) ); - - // add the field to observed controls for enabled state changes - // also add a tag just for this purpose - pControllerProperties->addObservedControl( pFieldView ); - int nTag = pControllerProperties->addNameTag( aPropertyName ); - [pFieldView setTag: nTag]; - // pControllerProperties->addNamedView( pFieldView, aPropertyName ); - - // move to nCurY - aFieldRect.origin.y = nCurY - aFieldRect.size.height; - [pFieldView setFrame: aFieldRect]; - // current value PropertyValue* pVal = pController->getValue( aPropertyName ); - if( aCtrlType.equalsAscii( "Range" ) ) - { - // add a stepper control - NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5, - aFieldRect.origin.y }, - { 15, aFieldRect.size.height } }; - NSStepper* pStep = [[NSStepper alloc] initWithFrame: aStepFrame]; - [pStep setIncrement: 1]; - [pStep setValueWraps: NO]; - [pStep setTag: nTag]; - [pCurParent addSubview: [pStep autorelease]]; - - aRightColumn.back().pSubControl = pStep; - - pControllerProperties->addObservedControl( pStep ); - [pStep setTarget: pCtrlTarget]; - [pStep setAction: @selector(triggered:)]; - - // constrain the text field to decimal numbers - NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init]; - [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4]; - [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle]; - [pFormatter setAllowsFloats: NO]; - [pFormatter setMaximumFractionDigits: 0]; - if( nMinValue != nMaxValue ) - { - [pFormatter setMinimum: [[NSNumber numberWithInt: nMinValue] autorelease]]; - [pStep setMinValue: nMinValue]; - [pFormatter setMaximum: [[NSNumber numberWithInt: nMaxValue] autorelease]]; - [pStep setMaxValue: nMaxValue]; - } - [pFieldView setFormatter: pFormatter]; - - sal_Int64 nSelectVal = 0; - if( pVal && pVal->Value.hasValue() ) - pVal->Value >>= nSelectVal; - - [pFieldView setIntValue: nSelectVal]; - [pStep setIntValue: nSelectVal]; - - pControllerProperties->addViewPair( pFieldView, pStep ); - // connect target and action - [pFieldView setTarget: pCtrlTarget]; - [pFieldView setAction: @selector(triggeredNumeric:)]; - [pStep setTarget: pCtrlTarget]; - [pStep setAction: @selector(triggeredNumeric:)]; - } - else - { - // connect target and action - [pFieldView setTarget: pCtrlTarget]; - [pFieldView setAction: @selector(triggered:)]; - - if( pVal && pVal->Value.hasValue() ) - { - rtl::OUString aValue; - pVal->Value >>= aValue; - if( aValue.getLength() ) - { - NSString* pText = CreateNSString( aValue ); - [pFieldView setStringValue: pText]; - [pText release]; - } - } - } - - // update nCurY - nCurY = aFieldRect.origin.y - 5; - + addEdit( pCurParent, nCurX, nCurY, nAttachOffset, + aCtrlType, aText, aPropertyName, pVal, + nMinValue, nMaxValue, + aLeftColumn, aRightColumn, + pControllerProperties, pCtrlTarget ); } } else @@ -1205,7 +1345,7 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) DBG_ERROR( "Unsupported UI option" ); } } - + pControllerProperties->updateEnableState(); adjustViewAndChildren( pCurParent, aMaxTabSize, aLeftColumn, aRightColumn ); diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index ca3fcc04769a..e1daf649f6da 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -116,17 +116,15 @@ inline FourCharCode GetTag(const char aTagName[5]) static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);} static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);} -ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const +const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const { + // return the cached charmap if( mpCharMap ) - { - // return the cached charmap - mpCharMap->AddReference(); return mpCharMap; - } // set the default charmap mpCharMap = ImplFontCharMap::GetDefaultMap(); + mpCharMap->AddReference(); // get the CMAP byte size ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId ); @@ -149,10 +147,14 @@ ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const // parse the CMAP CmapResult aCmapResult; - if( !ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) ) - return mpCharMap; + if( ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) ) + { + // create the matching charmap + mpCharMap->DeReference(); + mpCharMap = new ImplFontCharMap( aCmapResult ); + mpCharMap->AddReference(); + } - mpCharMap = new ImplFontCharMap( aCmapResult ); return mpCharMap; } @@ -1555,8 +1557,10 @@ void AquaSalGraphics::SetTextColor( SalColor nSalColor ) // ----------------------------------------------------------------------- -void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) +void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel ) { + (void)nFallbackLevel; // glyph-fallback on ATSU is done differently -> no fallback level + // get the ATSU font metrics (in point units) // of the font that has eventually been size-limited @@ -1990,7 +1994,7 @@ USHORT AquaSalGraphics::SetFont( ImplFontSelectData* pReqFont, int nFallbackLeve // ----------------------------------------------------------------------- -ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const { if( !mpMacFontData ) return ImplFontCharMap::GetDefaultMap(); @@ -2365,6 +2369,8 @@ void AquaSalGraphics::GetGlyphWidths( const ImplFontData* pFontData, bool bVerti if( nGlyph > 0 ) rUnicodeEnc[ nUcsChar ] = nGlyph; } + + pMap->DeReference(); // TODO: add and use RAII object instead } ::CloseTTFont( pSftFont ); diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index ff4edcbf83f9..c79add81d791 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -460,6 +460,8 @@ ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USH return getUseNativeDialog() ? 1 : 0; case PRINTER_CAPABILITIES_PDF: return 1; + case PRINTER_CAPABILITIES_USEPULLMODEL: + return 1; default: break; }; return 0; diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index b14354e1b4bd..4530778c5775 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -207,8 +207,6 @@ void AquaSalFrame::initWindowAndView() UpdateFrameGeometry(); - // setContentView causes a display; in multithreaded use this can deadlock - //YieldMutexReleaser aRel; [mpWindow setContentView: mpView]; } @@ -293,6 +291,9 @@ BOOL AquaSalFrame::PostEvent( void *pData ) // ----------------------------------------------------------------------- void AquaSalFrame::SetTitle(const XubString& rTitle) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + NSString* pTitle = CreateNSString( rTitle ); [mpWindow setTitle: pTitle]; @@ -331,6 +332,9 @@ void AquaSalFrame::SetIcon( USHORT ) void AquaSalFrame::SetRepresentedURL( const rtl::OUString& i_rDocURL ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( i_rDocURL.indexOfAsciiL( "file:", 5 ) == 0 ) { rtl::OUString aSysPath; @@ -356,12 +360,12 @@ void AquaSalFrame::initShow() if( mpParent ) // center relative to parent { // center on parent - long nNewX = mpParent->maGeometry.nX + (mpParent->maGeometry.nWidth - maGeometry.nWidth)/2; + long nNewX = mpParent->maGeometry.nX + ((long)mpParent->maGeometry.nWidth - (long)maGeometry.nWidth)/2; if( nNewX < aScreenRect.Left() ) nNewX = aScreenRect.Left(); if( long(nNewX + maGeometry.nWidth) > aScreenRect.Right() ) nNewX = aScreenRect.Right() - maGeometry.nWidth-1; - long nNewY = mpParent->maGeometry.nY + (mpParent->maGeometry.nHeight - maGeometry.nHeight)/2; + long nNewY = mpParent->maGeometry.nY + ((long)mpParent->maGeometry.nHeight - (long)maGeometry.nHeight)/2; if( nNewY < aScreenRect.Top() ) nNewY = aScreenRect.Top(); if( nNewY > aScreenRect.Bottom() ) @@ -401,6 +405,9 @@ void AquaSalFrame::SendPaintEvent( const Rectangle* pRect ) void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + mbShown = bVisible; if(bVisible) { @@ -411,8 +418,6 @@ void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) // trigger filling our backbuffer SendPaintEvent(); - //YieldMutexReleaser aRel; - if( bNoActivate || [mpWindow canBecomeKeyWindow] == NO ) [mpWindow orderFront: NSApp]; else @@ -443,8 +448,6 @@ void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) if( mpMenu && mpMenu->mbMenuBar && AquaSalMenu::pCurrentMenuBar == mpMenu ) AquaSalMenu::setDefaultMenu(); - //YieldMutexReleaser aRel; - // #i90440# #i94443# work around the focus going back to some other window // if a child gets hidden for a parent window if( mpParent && mpParent->mbShown && [mpWindow isKeyWindow] ) @@ -468,6 +471,9 @@ void AquaSalFrame::Enable( BOOL bEnable ) void AquaSalFrame::SetMinClientSize( long nWidth, long nHeight ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + mnMinWidth = nWidth; mnMinHeight = nHeight; @@ -490,6 +496,9 @@ void AquaSalFrame::SetMinClientSize( long nWidth, long nHeight ) void AquaSalFrame::SetMaxClientSize( long nWidth, long nHeight ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + mnMaxWidth = nWidth; mnMaxHeight = nHeight; @@ -516,6 +525,9 @@ void AquaSalFrame::SetMaxClientSize( long nWidth, long nHeight ) void AquaSalFrame::SetClientSize( long nWidth, long nHeight ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( mpWindow ) { NSSize aSize = { nWidth, nHeight }; @@ -548,6 +560,9 @@ void AquaSalFrame::GetClientSize( long& rWidth, long& rHeight ) void AquaSalFrame::SetWindowState( const SalFrameState* pState ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + // set normal state NSRect aStateRect = [mpWindow frame]; aStateRect = [NSWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask]; @@ -563,13 +578,27 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) VCLToCocoa( aStateRect ); aStateRect = [NSWindow frameRectForContentRect: aStateRect styleMask: mnStyleMask]; - // relase and acquire mutex again since this call can block waiting for an internal lock + [mpWindow setFrame: aStateRect display: NO]; + if( pState->mnState == SAL_FRAMESTATE_MINIMIZED ) + [mpWindow miniaturize: NSApp]; + else if( [mpWindow isMiniaturized] ) + [mpWindow deminiaturize: NSApp]; + + + /* ZOOMED is not really maximized (actually it toggles between a user set size and + the program specified one), but comes closest since the default behavior is + "maximized" if the user did not intervene + */ + if( pState->mnState == SAL_FRAMESTATE_MAXIMIZED ) { - //YieldMutexReleaser aRel; - [mpWindow setFrame: aStateRect display: NO]; + if(! [mpWindow isZoomed]) + [mpWindow zoom: NSApp]; + } + else + { + if( [mpWindow isZoomed] ) + [mpWindow zoom: NSApp]; } - - // FIXME: HTH maximized state ? // get new geometry UpdateFrameGeometry(); @@ -596,8 +625,6 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) SendPaintEvent(); // tell the system the views need to be updated - //YieldMutexReleaser aRel; - [mpWindow display]; } } @@ -606,6 +633,9 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + pState->mnMask = SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_Y | SAL_FRAMESTATE_MASK_WIDTH | @@ -626,8 +656,6 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) pState->mnWidth = long(aStateRect.size.width); pState->mnHeight = long(aStateRect.size.height); - // FIXME: HTH maximized state ? - if( [mpWindow isMiniaturized] ) pState->mnState = SAL_FRAMESTATE_MINIMIZED; else if( ! [mpWindow isZoomed] ) @@ -642,6 +670,9 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) void AquaSalFrame::SetScreenNumber(unsigned int nScreen) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + NSArray* pScreens = [NSScreen screens]; Rectangle aRet; NSScreen* pScreen = nil; @@ -673,6 +704,9 @@ void AquaSalFrame::SetScreenNumber(unsigned int nScreen) void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( mbFullScreen == bFullScreen ) return; @@ -731,7 +765,6 @@ void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) maFullScreenRect = [mpWindow frame]; { - //YieldMutexReleaser aRel; [mpWindow setFrame: [NSWindow frameRectForContentRect: aNewContentRect styleMask: mnStyleMask] display: mbShown ? YES : NO]; } @@ -743,7 +776,6 @@ void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) else { { - //YieldMutexReleaser aRel; [mpWindow setFrame: maFullScreenRect display: mbShown ? YES : NO]; } UpdateFrameGeometry(); @@ -782,6 +814,9 @@ public: void AquaSalFrame::StartPresentation( BOOL bStart ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( bStart ) { mpActivityTimer.reset( new PreventSleepTimer() ); @@ -806,6 +841,12 @@ void AquaSalFrame::SetAlwaysOnTop( BOOL bOnTop ) void AquaSalFrame::ToTop(USHORT nFlags) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( ! (nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN) ) { if( ! [mpWindow isVisible] || [mpWindow isMiniaturized] ) @@ -859,6 +900,9 @@ NSCursor* AquaSalFrame::getCurrentCursor() const void AquaSalFrame::SetPointer( PointerStyle ePointerStyle ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( ePointerStyle >= POINTER_COUNT || ePointerStyle == mePointerStyle ) return; mePointerStyle = ePointerStyle; @@ -885,6 +929,10 @@ void AquaSalFrame::Flush( void ) if( !(mbGraphics && mpGraphics && mpView && mbShown) ) return; + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + + [mpView setNeedsDisplay: YES]; // outside of the application's event loop (e.g. IntroWindow) @@ -903,6 +951,9 @@ void AquaSalFrame::Flush( const Rectangle& rRect ) if( !(mbGraphics && mpGraphics && mpView && mbShown) ) return; + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + NSRect aNSRect = { {rRect.Left(), rRect.Top()}, { rRect.GetWidth(), rRect.GetHeight() } }; VCLToCocoa( aNSRect, false ); [mpView setNeedsDisplayInRect: aNSRect]; @@ -922,7 +973,8 @@ void AquaSalFrame::Sync() { if( mbGraphics && mpGraphics && mpView && mbShown ) { - //YieldMutexReleaser aRel; + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); [mpView setNeedsDisplay: YES]; [mpView display]; @@ -1146,6 +1198,9 @@ void AquaSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY ) // doesn't make the anything cleaner for now void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + [mpView lockFocus]; StyleSettings aStyleSettings = rSettings.GetStyleSettings(); @@ -1257,6 +1312,9 @@ void AquaSalFrame::Beep( SoundType eSoundType ) void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHORT nFlags) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + USHORT nEvent = 0; if( [mpWindow isMiniaturized] ) @@ -1321,7 +1379,6 @@ void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHOR // do not display yet, we need to update our backbuffer { - //YieldMutexReleaser aRel; [mpWindow setFrame: [NSWindow frameRectForContentRect: aContentRect styleMask: mnStyleMask] display: NO]; } @@ -1336,13 +1393,15 @@ void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHOR SendPaintEvent(); // now inform the system that the views need to be drawn - //YieldMutexReleaser aRel; [mpWindow display]; } } void AquaSalFrame::GetWorkArea( Rectangle& rRect ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + NSScreen* pScreen = [mpWindow screen]; if( pScreen == nil ) pScreen = [NSScreen mainScreen]; @@ -1356,6 +1415,9 @@ void AquaSalFrame::GetWorkArea( Rectangle& rRect ) SalPointerState AquaSalFrame::GetPointerState() { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + SalPointerState state; state.mnState = 0; @@ -1463,6 +1525,9 @@ void AquaSalFrame::DrawMenuBar() void AquaSalFrame::SetMenu( SalMenu* pSalMenu ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + AquaSalMenu* pMenu = static_cast<AquaSalMenu*>(pSalMenu); DBG_ASSERT( ! pMenu || pMenu->mbMenuBar, "setting non menubar on frame" ); mpMenu = pMenu; @@ -1472,6 +1537,9 @@ void AquaSalFrame::SetMenu( SalMenu* pSalMenu ) void AquaSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( (mnExtStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) != (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) ) [mpWindow setDocumentEdited: (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) ? YES : NO]; mnExtStyle = nStyle; @@ -1576,6 +1644,9 @@ void AquaSalFrame::CaptureMouse( BOOL bCapture ) void AquaSalFrame::ResetClipRegion() { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + // release old path and indicate no clipping CGPathRelease( mrClippingPath ); mrClippingPath = NULL; @@ -1591,6 +1662,9 @@ void AquaSalFrame::ResetClipRegion() void AquaSalFrame::BeginSetClipRegion( ULONG nRects ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + // release old path if( mrClippingPath ) { @@ -1609,6 +1683,9 @@ void AquaSalFrame::BeginSetClipRegion( ULONG nRects ) void AquaSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( nWidth && nHeight ) { NSRect aRect = { { nX, nY }, { nWidth, nHeight } }; @@ -1619,6 +1696,9 @@ void AquaSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight void AquaSalFrame::EndSetClipRegion() { + // #i113170# may not be the main thread if called from UNO API + SalData::ensureThreadAutoreleasePool(); + if( ! maClippingRects.empty() ) { mrClippingPath = CGPathCreateMutable(); diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 2f9959ab43f4..240a915e4e12 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -162,6 +162,20 @@ static AquaSalFrame* getMouseContainerFrame() return mpFrame; } +-(void)displayIfNeeded +{ + if( GetSalData() && GetSalData()->mpFirstInstance ) + { + vos::IMutex* pMutex = GetSalData()->mpFirstInstance->GetYieldMutex(); + if( pMutex ) + { + pMutex->acquire(); + [super displayIfNeeded]; + pMutex->release(); + } + } +} + -(MacOSBOOL)containsMouse { // is this event actually inside that NSWindow ? @@ -573,8 +587,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 @@ -582,7 +599,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 diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index ed3086d8506f..82102f2e7095 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -79,10 +79,14 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL; -(void)showPreferences: (id) sender { + YIELD_GUARD; + [self showDialog: SHOWDIALOG_ID_PREFERENCES]; } -(void)showAbout: (id) sender { + YIELD_GUARD; + [self showDialog: SHOWDIALOG_ID_ABOUT]; } @end @@ -203,11 +207,12 @@ static void initAppMenu() // ======================================================================= -SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar ) +SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar, Menu* pVCLMenu ) { initAppMenu(); AquaSalMenu *pAquaSalMenu = new AquaSalMenu( bMenuBar ); + pAquaSalMenu->mpVCLMenu = pVCLMenu; return pAquaSalMenu; } |