1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dbggui.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
34 #include <sal/config.h>
43 #include <vcl/svdata.hxx>
49 #include <tools/debug.hxx>
50 #include <vcl/svdata.hxx>
51 #include <vcl/svapp.hxx>
52 #include <vcl/event.hxx>
53 #include <vcl/lstbox.hxx>
54 #include <vcl/button.hxx>
55 #include <vcl/edit.hxx>
56 #include <vcl/fixed.hxx>
57 #include <vcl/group.hxx>
58 #include <vcl/field.hxx>
59 #include <vcl/msgbox.hxx>
60 #include <vcl/wrkwin.hxx>
61 #include <vcl/sound.hxx>
62 #include <vcl/threadex.hxx>
63 #include <vcl/dbggui.hxx>
64 #include <com/sun/star/i18n/XCharacterClassification.hpp>
66 #include <vcl/unohelp.hxx>
67 #include <vcl/unohelp2.hxx>
68 #include <vos/mutex.hxx>
73 using namespace ::com::sun::star
;
75 // =======================================================================
77 static const sal_Char
* pDbgHelpText
[] =
80 "------------------------------------------\n",
83 "DBG_NAME( aName )\n",
84 "Defines the administration data for a class. This macro may only be used "
85 " in a source file with the same name.\n",
87 "DBG_NAMEEX( aName )\n",
88 "Like DBG_NAME, only for other source files.\n",
90 "DBG_CTOR( aName, fTest )\n",
91 "Must be used in all constructors of a class (also in the CopyCtor). "
92 "The first parameter must be the registered name (best would be the "
93 "class name) and the second parameter the test function or 0.\n",
95 "DBG_DTOR( aName, fTest )\n",
96 "Must be used in the destructor of the class. The first parameter is "
97 "the registered name and the second parameter is the test function or "
100 "DBG_CHKTHIS( aName, fTest )\n",
101 "Can be used in methods of the class when constructors and the "
102 "desctructor of the class are equiped with the corresponding macros. "
103 "The first parameter is the registered name, the second parameter is "
104 "the test function or 0.\n",
106 "DBG_CHKOBJ( pObj, aName, fTest )\n",
107 "Can be used on instances of a class where the constructors and the "
108 "destructor of the class are equiped with the corresponding macros. "
109 "The first parameter is the registered name, the second parameter is "
110 "the test function or 0.\n",
112 "To make the macros work DBG_UTIL must be defined.\n",
116 "The This pointer is validated. This way all objects that are equiped "
117 "with it can be tested to make sure one is working with existing objects. "
118 "This way it's easier to find bugs in case of multiple inheritence, "
119 "alignment or compiler errors. Since almost all standard classes of SV "
120 "(String, List, Pen, Brush, Polygon, ...) are equiped with DBG_CHKTHIS() "
121 "a lot of errors are found, although this test will impact performance "
125 "When a function is passed with macros, it will be called.\n",
128 "This- and Func-Test will also run when exiting the function.\n",
131 "At the end of the program the number of generated objects is produced "
132 "as output. Because all important SV classes have at least DBG_CTOR() / "
133 "DBG_DTOR() it can checked so called resource leaks (system objects which "
134 " are not freed) exist. These include OutputDevice, Window, VirtualDevice, "
135 " Printer and Menu. Note: Dtor calls of static objects are not taken into "
136 " account. Therefor each SV program leaves 2 strings and a bitmap behind.\n",
139 "Creation, destruction and usage of objects which are equiped with "
140 "DBG_XTOR is logged.\n",
144 "------------------------------------------\n",
148 "Run the specified memory tests.\n",
150 "DBG_MEMTEST_PTR( p )\n",
151 "Runs the specified memory tests and validates the pointer that was "
152 "passed if the pointer test is enabled.\n",
156 "Allocated memory is initialized with 0x77 and free or freed memory "
157 "is initialized with 0x33. This option has almost no impact on performance "
158 "and should thus always be enabled during development. This will also "
159 "make crashes more often reproducable.\n",
162 "This test check whether writes occur before or after the blocks. Before "
163 "and after the block memory is initialized with 0x55. This option costs "
164 "performance, but should be enabled once in a while to test for common "
165 "memory overwrites (+-1 errors). This option should also be enabled if the "
166 "program crashes in a new or delete operator.\n",
169 "This checks whether writes occur in free memory. This option costs lots "
170 " of performance and should thus only be used to test memory overwrites. "
171 " This option should perhaps also be enabled when the program crashes "
172 " in the new or delete operator.\n",
175 "The pointer is tested with delete and DBG_MEMTEST_PTR() to see if it was "
176 "created by new or SvMemAlloc(). When this option is enabled errors such as "
177 "double deletes, deletes on stack objects or invalid pointers will be found. "
178 "This option has an impact on performance and should therefor not be enabled "
179 "all the time. However, testing should be done with this option enabled once "
180 "in a while, because the memory manager does not always crash with delete and "
181 "invalid pointers. This option should also be enabled if the program crashes "
182 "in new or delete operators.\n",
185 "At the end of the program a small statistic and memory that was not freed are "
186 "output. Note: memory that is freed by global objects is also included in "
190 "Allocating and freeing memory is logged.\n",
193 "Produces under WNT at the end of the program a list of memory leaks with "
194 "stack trace. Only blocks which were created inside Application::Execute() "
195 "are included. When this option and Overwrite are both enabled a memory "
196 "overwrite results in an attempt to output the stack where the block was "
197 "created. The output is included in the log file after the error message.\n"
200 "Memory tests are performed on the entire memory with every new/delet. "
201 "Warning: this option makes programs very slow and should only be enabled "
202 "to track memory overwrites. Otherwise it is sufficient to enable "
203 "seperate options because (if no leak is present) every detectable "
204 "memory overwrite during run time should be found.\n",
207 "Memory test are performed on the entire memory with every object test. "
208 "Warning: this option makes programs very slow and should only be enabled "
209 "to track memory overwrite. Otherwise it is sufficient to enable "
210 "seperate options because (if no leak is present) every detectable "
211 "memory overwrite during run time should be found.\n",
213 "Windows 16-bit and debug tests\n",
214 "Warning: when memory test are enabled (except for Initialize) memory with "
215 "offset 0 is never (even not in case of >= 64KB) returned. If necessary the "
216 "tests can be performed with 32-bit versions of the programs. To a certain "
217 "extend it is sufficient to create 64KB - 64 bytes instead of 64KB because "
218 "it will never come to a segment overflow.\n",
219 "Memory and object test should only be enabled when only one SV application "
220 "is running at one time. Otherwise uncontrolled errors may occur. In this "
221 "case only the use of 32-bit programs can help."
224 "\nOther tests and macros\n",
225 "------------------------------------------\n",
228 "DBG_PROFSTART() / DBG_PROFSTOP() / DBG_PROFCONTINUE() / DBG_PROFPAUSE() "
229 "are evaluated and at the end of the program the number of run throughs "
230 "and the time this took (including calls to children) in milliseconds is "
231 "output. These macros can be used to check the same function runs over the "
232 "entire development period, for example the startup speed. The registered name "
233 "which was registered with DBG_NAME() must be passed to the macros.\n",
236 "In case of resource errors an error dialog is produced before the "
237 "exception handler is called.\n",
240 "FixedTexts, CheckBoxes, TriStateBoxes and RadioButtons are equiped with "
241 "a different background color to determine the size of the controls. This "
242 "test also shows whether controls overlap, whether the tab order is correct "
243 "and whether the mnemonic characters are correctly assigned. With dialogs "
244 "it is indicated when no default button or no OK/CancelButton is present. "
245 "These tests are not 100% correct (e.g. too many warnings are given) and "
246 "do not form any guarantee that all problematic cases are covered. For "
247 "example only initial and only visible controls are tested. No errors are "
248 "found which will occur during the use of a dialog.\n",
251 "The application font is set to bold to see if the position of texts is "
252 "sufficient for other systems or other system settings. With very narrow "
253 "fonts the dialogs are made wider because they otherwise appear too narrow.\n",
256 "DBG_TRACE() can be use to produce TRACE output. DBG_TRACEFILE() also outputs "
257 "the file and line number where the macro is located. DBG_TRACE1() to "
258 "DBG_TRACE5() can be used to produce formatted output (printf format string) "
259 "Trace output is enabled when the corresponding option is selected in the "
263 "DBG_WARNING() can be used to output warnings. DBG_WARNINGFILE() also outputs "
264 "the file and the line number where the macro is located. DBG_WARNING1() to "
265 "DBG_WARNING5() can be used to produce formatted output (printf format string). "
266 "In case you want to have conditional warnings DBG_ASSERTWARNING() can be "
267 "used. The warning will be produced if the condition was not met. The first "
268 "parameter is the condition and the second parameter is the message to be "
269 "produced. Warnings are enabled if the corresponding option is selected in the "
270 "dropdown box. When none are selected the condition with DBG_ASSERTWARNING() "
271 "is not evaluated.\n",
274 "DBG_ERROR() can be used to produce error messages. DBG_ERRORFILE() also "
275 "produces the file and the line number where the macro is located. "
276 "DBG_ERROR1() bis DBG_ERROR5() can be used to produce formatted output "
277 "(print format string). "
278 "In case you want to have conditional warnings DBG_ASSERT() can be "
279 "used. The warning will be produced if the condition was not met. The first "
280 "parameter is the condition and the second parameter is the message to be "
281 "produced. Warnings are enabled if the corresponding option is selected in the "
282 "dropdown box. When none are selected the condition with DBG_ASSERT() "
283 "is not evaluated.\n",
287 "------------------------------------------\n",
289 "Overwrite - CheckBox\n",
290 "With every new program start the log file is overwritten if output has been "
293 "Include ObjectTest filters\n",
294 "Only classes which contain one of the indicated filters are evaluated with "
295 "the object test. Filters are seperated by ';' and are case sensitive. "
296 "Wildcards are not supported. If no text is indicated the filters are not "
299 "Exclude ObjectTest filters\n",
300 "Only classes which do not contain one of the indicated filters are evaluated "
301 "with the object test. Filters are seperated by ';' and are case sensitive. "
302 "Wildcards are not supported. If no text is indicated the filters are not "
306 "Only those texts which include the indicated filters are output. "
307 "Filters are seperated by ';' and are case sensitive. "
308 "Wildcards are not supported. The filter is used for all output (except for "
309 "errors). If no text is indicated the filters are not active.\n",
312 "Only those texts which do not include the indicated filters are output. "
313 "Filters are seperated by ';' and are case sensitive. "
314 "Wildcards are not supported. The filter is used for all output (except for "
315 "errors). If no text is indicated the filters are not active.\n",
317 "Furthermore you can indicate where the data will be output:\n",
320 "Output is surpressed.\n",
323 "Outputi n debug file. Filename can be entered in the Editfield.\n",
326 "Output to a small debug window. The window size is stored if the debug "
327 "dialog is closed with OK and if the window is visible. Each assertion text can "
328 "be copied to the clipboard via the context menu of the respective entry.\n",
331 "Output to a debug system (Windows debug window) when available or under "
332 "Unix in the shell window. Otherwise the same as Window.\n",
335 "Output to a MessageBox. In this case you can select whether the program "
336 "must be continued, terminated (Application::Abort) or interrupted with "
337 "CoreDump. Additionally on some systems you get a \"Copy\" button pressing which "
338 "copies the text of the MessageBox to the clipboard. Because a MessageBox allows "
339 "further event processing other errors caused by Paint, Activate/Deactivate, "
340 "GetFocus/LoseFocus can cause more errors or incorrect errors and messages. "
341 "Therefor the message should also be directed to a file/debugger in case of "
342 "problems in order to produce the (right) error messages.\n",
345 "When the TestTool runs messages will be redirected inside the TestTool.\n",
348 "Attempt to activate the debugger and produce the message there, in order to "
349 "always obtain the corresponding stack trace in the debugger.\n",
355 "Reroute osl messages - Checkbox\n",
356 "OSL_ASSERT and similar messages can be intercepted by the general DBG GUI\n",
357 "or handled system specific as per normal handling in the sal library.\n",
358 "default is to reroute osl assertions\n",
362 "------------------------------------------\n",
364 "Where by default the INI and LOG file is read and written the following "
367 "WIN/WNT (WIN.INI, Group SV, Default: dbgsv.ini and dbgsv.log):\n",
371 "OS2 (OS2.INI, Application SV, Default: dbgsv.ini and dbgsv.log):\n",
375 "UNIX (Environment variable, Default: .dbgsv.init and dbgsv.log):\n",
379 "MAC (Default: dbgsv.ini and dbgsv.log):\n",
380 "INI: not possible\n",
381 "LOG: only debug dialog settings\n",
383 "The path and file name must always be specified. The name of the log "
384 "file that was entered in the debug dialog has always priority.\n",
388 "------------------------------------------\n",
390 "DBG_NAME( String );\n",
393 "const sal_Char* DbgCheckString( const void* pString )\n",
395 " String* p = (String*)pString;\n",
397 " if ( p->mpData->maStr[p->mpData->mnLen] != 0 )\n",
398 " return \"String damaged: aStr[nLen] != 0\";\n",
404 "String::String()\n",
406 " DBG_CTOR( String, DbgCheckString );\n",
410 "String::~String()\n",
412 " DBG_DTOR( String, DbgCheckString );\n",
416 "char& String::operator [] ( USHORT nIndex )\n",
418 " DBG_CHKTHIS( String, DbgCheckString );\n",
419 " DBG_ASSERT( nIndex <= pData->nLen, \"String::[] : nIndex > Len\" );\n",
424 "USHORT String::Search( const String& rStr, USHORT nIndex ) const\n",
426 " DBG_CHKTHIS( String, DbgCheckString );\n",
427 " DBG_CHKOBJ( &rStr, String, DbgCheckString );\n",
435 // =======================================================================
439 // -------------------------------------------------------------------
440 typedef ::std::map
< XubString
, DbgChannelId
> UserDefinedChannels
;
441 UserDefinedChannels
& ImplDbgGetUserDefinedChannels()
443 static UserDefinedChannels s_aChannels
;
447 // -------------------------------------------------------------------
448 void ImplAppendUserDefinedChannels( ListBox
& rList
)
450 const UserDefinedChannels
& rChannels
= ImplDbgGetUserDefinedChannels();
451 for ( UserDefinedChannels::const_iterator channel
= rChannels
.begin();
452 channel
!= rChannels
.end();
456 USHORT nEntryPos
= rList
.InsertEntry( channel
->first
);
457 rList
.SetEntryData( nEntryPos
, reinterpret_cast< void* >( channel
->second
) );
461 // -------------------------------------------------------------------
462 void ImplSelectChannel( ListBox
& rList
, ULONG nChannelToSelect
, USHORT nPositionOffset
)
464 if ( nChannelToSelect
< DBG_OUT_USER_CHANNEL_0
)
465 rList
.SelectEntryPos( (USHORT
)( nChannelToSelect
- nPositionOffset
) );
468 for ( USHORT pos
= 0; pos
< rList
.GetEntryCount(); ++pos
)
470 DbgChannelId nChannelId
= static_cast< DbgChannelId
>( reinterpret_cast<sal_IntPtr
>(rList
.GetEntryData( pos
)) );
471 if ( nChannelId
== nChannelToSelect
)
473 rList
.SelectEntryPos( pos
);
479 // -------------------------------------------------------------------
480 DbgChannelId
ImplGetChannelId( const ListBox
& rList
, USHORT nPositionOffset
)
482 USHORT nSelectedChannelPos
= rList
.GetSelectEntryPos();
483 DbgChannelId nSelectedChannel
= static_cast< DbgChannelId
>( reinterpret_cast<sal_IntPtr
>(rList
.GetEntryData( nSelectedChannelPos
)) );
484 if ( nSelectedChannel
== 0)
485 return (DbgChannelId
)( nSelectedChannelPos
+ nPositionOffset
);
486 return nSelectedChannel
;
490 // =======================================================================
496 #define DBGWIN_MAXLINES 100
498 class DbgWindow
: public WorkWindow
506 virtual BOOL
Close();
507 virtual void Resize();
508 virtual long PreNotify( NotifyEvent
& rNEvt
);
509 void InsertLine( const XubString
& rLine
);
510 void Update() { WorkWindow::Update(); maLstBox
.Update(); }
513 void GetAssertionEntryRange( USHORT nInbetweenEntry
, USHORT
& nFirst
, USHORT
& nLast
);
520 class DbgInfoDialog
: public ModalDialog
528 DbgInfoDialog( Window
* pParent
, BOOL bHelpText
= FALSE
);
530 void SetInfoText( const XubString
& rStr
);
537 class DbgDialog
: public ModalDialog
543 CheckBox maXtorReport
;
544 CheckBox maXtorTrace
;
548 CheckBox maMemOverwrite
;
549 CheckBox maMemOverwriteFree
;
551 CheckBox maMemReport
;
553 CheckBox maMemLeakReport
;
554 CheckBox maMemNewDel
;
561 CheckBox maBoldAppFont
;
565 CheckBox maOverwrite
;
566 FixedText maInclClassText
;
567 Edit maInclClassFilter
;
568 FixedText maExclClassText
;
569 Edit maExclClassFilter
;
570 FixedText maInclText
;
572 FixedText maExclText
;
574 FixedText maTraceText
;
576 FixedText maWarningText
;
577 ListBox maWarningBox
;
578 FixedText maErrorText
;
580 CheckBox maHookOSLBox
;
584 CancelButton maCancelButton
;
585 PushButton maInfoButton
;
586 HelpButton maHelpButton
;
592 DECL_LINK( ClickHdl
, Button
* );
593 void RequestHelp( const HelpEvent
& rHEvt
);
596 // =======================================================================
598 static sal_Char aDbgInfoBuf
[12288];
599 static sal_Char aDbgOutBuf
[DBG_BUF_MAXLEN
];
601 // =======================================================================
603 DbgWindow::DbgWindow() :
604 WorkWindow( NULL
, WB_STDWORK
),
605 maLstBox( this, WB_AUTOHSCROLL
)
607 DbgData
* pData
= DbgGetData();
610 maLstBox
.SetPosPixel( Point( 0, 0 ) );
612 SetOutputSizePixel( Size( 600, 480 ) );
613 if ( pData
->aDbgWinState
)
615 ByteString
aState( pData
->aDbgWinState
);
616 SetWindowState( aState
);
619 SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "StarView Debug Window" ) ) );
624 // -----------------------------------------------------------------------
626 BOOL
DbgWindow::Close()
628 // remember window position
629 ByteString
aState( GetWindowState() );
630 DbgData
* pData
= DbgGetData();
631 strncpy( pData
->aDbgWinState
,
633 std::min( sizeof( pData
->aDbgWinState
),
634 size_t(aState
.Len() + 1U )) );
635 pData
->aDbgWinState
[ sizeof( pData
->aDbgWinState
) - 1 ] = 0;
636 // and save for next session
637 DbgSaveData( *pData
);
640 ImplGetSVData()->maWinData
.mpDbgWin
= NULL
;
644 // -----------------------------------------------------------------------
646 void DbgWindow::Resize()
648 maLstBox
.SetSizePixel( GetOutputSizePixel() );
651 // -----------------------------------------------------------------------
653 void DbgWindow::GetAssertionEntryRange( USHORT nInbetweenEntry
, USHORT
& nFirst
, USHORT
& nLast
)
655 nFirst
= nInbetweenEntry
;
658 if ( maLstBox
.GetEntryData( nFirst
) != NULL
)
662 USHORT nEntryCount
= maLstBox
.GetEntryCount();
663 nLast
= nInbetweenEntry
+ 1;
664 while ( nLast
< nEntryCount
)
666 if ( maLstBox
.GetEntryData( nLast
) != NULL
)
672 // -----------------------------------------------------------------------
674 long DbgWindow::PreNotify( NotifyEvent
& rNEvt
)
676 if ( rNEvt
.GetType() == EVENT_COMMAND
)
678 if ( maLstBox
.IsWindowOrChild( rNEvt
.GetWindow() ) )
680 const CommandEvent
& rCommand
= *rNEvt
.GetCommandEvent();
681 if ( rCommand
.GetCommand() == COMMAND_CONTEXTMENU
)
684 aMenu
.InsertItem( 1, String::CreateFromAscii( "copy to clipboard" ) );
687 if ( rCommand
.IsMouseEvent() )
688 aPos
= rCommand
.GetMousePosPixel();
691 Rectangle
aEntryRect( maLstBox
.GetBoundingRectangle( maLstBox
.GetSelectEntryPos() ) );
692 aPos
= aEntryRect
.Center();
694 USHORT nSelected
= aMenu
.Execute( rNEvt
.GetWindow(), aPos
);
695 if ( nSelected
== 1 )
697 // search all entries which belong to this assertion
698 USHORT nAssertionFirst
= 0;
699 USHORT nAssertionLast
= 0;
700 GetAssertionEntryRange( maLstBox
.GetSelectEntryPos(), nAssertionFirst
, nAssertionLast
);
702 // build the string to copy to the clipboard
704 String sLineFeed
= String::CreateFromAscii( "\n" );
705 sLineFeed
.ConvertLineEnd( GetSystemLineEnd() );
706 while ( nAssertionFirst
< nAssertionLast
)
708 sAssertion
+= maLstBox
.GetEntry( nAssertionFirst
++ );
709 sAssertion
+= sLineFeed
;
712 ::vcl::unohelper::TextDataObject::CopyStringTo( sAssertion
, GetClipboard() );
718 return WorkWindow::PreNotify( rNEvt
);
721 // -----------------------------------------------------------------------
723 void DbgWindow::InsertLine( const XubString
& rLine
)
725 XubString aStr
= rLine
;
726 aStr
.ConvertLineEnd( LINEEND_LF
);
727 xub_StrLen nPos
= aStr
.Search( _LF
);
728 BOOL bFirstEntry
= TRUE
;
729 while ( nPos
!= STRING_NOTFOUND
)
731 if ( maLstBox
.GetEntryCount() >= DBGWIN_MAXLINES
)
732 maLstBox
.RemoveEntry( 0 );
734 USHORT nInsertionPos
= maLstBox
.InsertEntry( aStr
.Copy( 0, nPos
) );
736 maLstBox
.SetEntryData( nInsertionPos
, reinterpret_cast< void* >( 0x00000001 ) );
739 aStr
.Erase( 0, nPos
+1 );
740 nPos
= aStr
.Search( _LF
);
742 if ( maLstBox
.GetEntryCount() >= DBGWIN_MAXLINES
)
743 maLstBox
.RemoveEntry( 0 );
744 USHORT nInsertionPos
= maLstBox
.InsertEntry( aStr
);
746 maLstBox
.SetEntryData( nInsertionPos
, reinterpret_cast< void* >( 0x00000001 ) );
747 maLstBox
.SetTopEntry( DBGWIN_MAXLINES
-1 );
751 // =======================================================================
753 DbgDialog::DbgDialog() :
754 ModalDialog( NULL
, WB_STDMODAL
| WB_SYSTEMWINDOW
),
758 maXtorReport( this ),
762 maMemOverwrite( this ),
763 maMemOverwriteFree( this ),
767 maMemLeakReport( this ),
774 maBoldAppFont( this ),
778 maInclClassText( this ),
779 maInclClassFilter( this ),
780 maExclClassText( this ),
781 maExclClassFilter( this ),
783 maInclFilter( this ),
785 maExclFilter( this ),
787 maTraceBox( this, WB_DROPDOWN
),
788 maWarningText( this ),
789 maWarningBox( this, WB_DROPDOWN
),
791 maErrorBox( this, WB_DROPDOWN
),
792 maHookOSLBox( this ),
794 maOKButton( this, WB_DEFBUTTON
),
795 maCancelButton( this ),
796 maInfoButton( this ),
799 DbgData
* pData
= DbgGetData();
800 MapMode
aAppMap( MAP_APPFONT
);
801 Size aButtonSize
= LogicToPixel( Size( 60, 12 ), aAppMap
);
805 maXtorThis
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "T~his" ) ) );
806 if ( pData
->nTestFlags
& DBG_TEST_XTOR_THIS
)
807 maXtorThis
.Check( TRUE
);
808 maXtorThis
.SetPosSizePixel( LogicToPixel( Point( 10, 15 ), aAppMap
),
814 maXtorFunc
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Function" ) ) );
815 if ( pData
->nTestFlags
& DBG_TEST_XTOR_FUNC
)
816 maXtorFunc
.Check( TRUE
);
817 maXtorFunc
.SetPosSizePixel( LogicToPixel( Point( 75, 15 ), aAppMap
),
823 maXtorExit
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "E~xit" ) ) );
824 if ( pData
->nTestFlags
& DBG_TEST_XTOR_EXIT
)
825 maXtorExit
.Check( TRUE
);
826 maXtorExit
.SetPosSizePixel( LogicToPixel( Point( 140, 15 ), aAppMap
),
832 maXtorReport
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Report" ) ) );
833 if ( pData
->nTestFlags
& DBG_TEST_XTOR_REPORT
)
834 maXtorReport
.Check( TRUE
);
835 maXtorReport
.SetPosSizePixel( LogicToPixel( Point( 205, 15 ), aAppMap
),
841 maXtorTrace
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) );
842 if ( pData
->nTestFlags
& DBG_TEST_XTOR_TRACE
)
843 maXtorTrace
.Check( TRUE
);
844 maXtorTrace
.SetPosSizePixel( LogicToPixel( Point( 270, 15 ), aAppMap
),
850 maBox1
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Object Tests" ) ) );
851 maBox1
.SetPosSizePixel( LogicToPixel( Point( 5, 5 ), aAppMap
),
852 LogicToPixel( Size( 330, 30 ), aAppMap
) );
857 maMemInit
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Initialize" ) ) );
858 if ( pData
->nTestFlags
& DBG_TEST_MEM_INIT
)
859 maMemInit
.Check( TRUE
);
860 maMemInit
.SetPosSizePixel( LogicToPixel( Point( 10, 50 ), aAppMap
),
865 maMemOverwrite
.Show();
866 maMemOverwrite
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Overwrite" )) );
867 if ( pData
->nTestFlags
& DBG_TEST_MEM_OVERWRITE
)
868 maMemOverwrite
.Check( TRUE
);
869 maMemOverwrite
.SetPosSizePixel( LogicToPixel( Point( 75, 50 ), aAppMap
),
874 maMemOverwriteFree
.Show();
875 maMemOverwriteFree
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Free" ) ) );
876 if ( pData
->nTestFlags
& DBG_TEST_MEM_OVERWRITEFREE
)
877 maMemOverwriteFree
.Check( TRUE
);
878 maMemOverwriteFree
.SetPosSizePixel( LogicToPixel( Point( 140, 50 ), aAppMap
),
884 maMemPtr
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Pointer" ) ) );
885 if ( pData
->nTestFlags
& DBG_TEST_MEM_POINTER
)
886 maMemPtr
.Check( TRUE
);
887 maMemPtr
.SetPosSizePixel( LogicToPixel( Point( 205, 50 ), aAppMap
),
893 maMemReport
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Report" ) ) );
894 if ( pData
->nTestFlags
& DBG_TEST_MEM_REPORT
)
895 maMemReport
.Check( TRUE
);
896 maMemReport
.SetPosSizePixel( LogicToPixel( Point( 270, 50 ), aAppMap
),
902 maMemTrace
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) );
903 if ( pData
->nTestFlags
& DBG_TEST_MEM_TRACE
)
904 maMemTrace
.Check( TRUE
);
905 maMemTrace
.SetPosSizePixel( LogicToPixel( Point( 10, 65 ), aAppMap
),
910 maMemLeakReport
.Show();
911 maMemLeakReport
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Leak-Report" ) ) );
912 if ( pData
->nTestFlags
& DBG_TEST_MEM_LEAKREPORT
)
913 maMemLeakReport
.Check( TRUE
);
914 maMemLeakReport
.SetPosSizePixel( LogicToPixel( Point( 75, 65 ), aAppMap
),
920 maMemNewDel
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~New/Delete" ) ) );
921 if ( pData
->nTestFlags
& DBG_TEST_MEM_NEWDEL
)
922 maMemNewDel
.Check( TRUE
);
923 maMemNewDel
.SetPosSizePixel( LogicToPixel( Point( 140, 65 ), aAppMap
),
929 maMemXtor
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Ob~ject Test" ) ) );
930 if ( pData
->nTestFlags
& DBG_TEST_MEM_XTOR
)
931 maMemXtor
.Check( TRUE
);
932 maMemXtor
.SetPosSizePixel( LogicToPixel( Point( 205, 65 ), aAppMap
),
938 maBox2
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Memory Tests" ) ) );
939 maBox2
.SetPosSizePixel( LogicToPixel( Point( 5, 40 ), aAppMap
),
940 LogicToPixel( Size( 330, 40 ), aAppMap
) );
945 maProf
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Profiling" ) ) );
946 if ( pData
->nTestFlags
& DBG_TEST_PROFILING
)
947 maProf
.Check( TRUE
);
948 maProf
.SetPosSizePixel( LogicToPixel( Point( 10, 95 ), aAppMap
),
954 maRes
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Resourcen" ) ) );
955 if ( pData
->nTestFlags
& DBG_TEST_RESOURCE
)
957 maRes
.SetPosSizePixel( LogicToPixel( Point( 75, 95 ), aAppMap
),
963 maDialog
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Dialog" ) ) );
964 if ( pData
->nTestFlags
& DBG_TEST_DIALOG
)
965 maDialog
.Check( TRUE
);
966 maDialog
.SetPosSizePixel( LogicToPixel( Point( 140, 95 ), aAppMap
),
971 maBoldAppFont
.Show();
972 maBoldAppFont
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Bold AppFont" ) ) );
973 if ( pData
->nTestFlags
& DBG_TEST_BOLDAPPFONT
)
974 maBoldAppFont
.Check( TRUE
);
975 maBoldAppFont
.SetPosSizePixel( LogicToPixel( Point( 205, 95 ), aAppMap
),
977 maBoldAppFont
.SaveValue();
982 maBox3
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Test Options" ) ) );
983 maBox3
.SetPosSizePixel( LogicToPixel( Point( 5, 85 ), aAppMap
),
984 LogicToPixel( Size( 330, 30 ), aAppMap
) );
989 maDebugName
.SetText( XubString( pData
->aDebugName
, RTL_TEXTENCODING_UTF8
) );
990 maDebugName
.SetMaxTextLen( sizeof( pData
->aDebugName
) );
991 maDebugName
.SetPosSizePixel( LogicToPixel( Point( 10, 130 ), aAppMap
),
992 LogicToPixel( Size( 185, 14 ), aAppMap
) );
997 maOverwrite
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Overwrite ~File" ) ) );
998 if ( pData
->bOverwrite
)
999 maOverwrite
.Check( TRUE
);
1000 maOverwrite
.SetPosSizePixel( LogicToPixel( Point( 205, 130 ), aAppMap
),
1005 maHookOSLBox
.Show();
1006 maHookOSLBox
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Reroute osl debug ~messages" ) ) );
1007 if ( pData
->bHookOSLAssert
)
1008 maHookOSLBox
.Check( TRUE
);
1009 maHookOSLBox
.SetPosSizePixel( LogicToPixel( Point( 10, 240 ), aAppMap
),
1010 LogicToPixel( Size( 100, 12 ), aAppMap
) );
1014 maInclClassText
.Show();
1015 maInclClassText
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Include-ObjectTest-Filter" ) ) );
1016 maInclClassText
.SetPosSizePixel( LogicToPixel( Point( 10, 150 ), aAppMap
),
1017 LogicToPixel( Size( 95, 9 ), aAppMap
) );
1021 maInclClassFilter
.Show();
1022 maInclClassFilter
.SetText( XubString( pData
->aInclClassFilter
, RTL_TEXTENCODING_UTF8
) );
1023 maInclClassFilter
.SetMaxTextLen( sizeof( pData
->aInclClassFilter
) );
1024 maInclClassFilter
.SetPosSizePixel( LogicToPixel( Point( 10, 160 ), aAppMap
),
1025 LogicToPixel( Size( 95, 14 ), aAppMap
) );
1029 maExclClassText
.Show();
1030 maExclClassText
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exclude-ObjectTest-Filter" ) ) );
1031 maExclClassText
.SetPosSizePixel( LogicToPixel( Point( 115, 150 ), aAppMap
),
1032 LogicToPixel( Size( 95, 9 ), aAppMap
) );
1036 maExclClassFilter
.Show();
1037 maExclClassFilter
.SetText( XubString( pData
->aExclClassFilter
, RTL_TEXTENCODING_UTF8
) );
1038 maExclClassFilter
.SetMaxTextLen( sizeof( pData
->aExclClassFilter
) );
1039 maExclClassFilter
.SetPosSizePixel( LogicToPixel( Point( 115, 160 ), aAppMap
),
1040 LogicToPixel( Size( 95, 14 ), aAppMap
) );
1045 maInclText
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Include-Filter" ) ) );
1046 maInclText
.SetPosSizePixel( LogicToPixel( Point( 10, 180 ), aAppMap
),
1047 LogicToPixel( Size( 95, 9 ), aAppMap
) );
1051 maInclFilter
.Show();
1052 maInclFilter
.SetText( XubString( pData
->aInclFilter
, RTL_TEXTENCODING_UTF8
) );
1053 maInclFilter
.SetMaxTextLen( sizeof( pData
->aInclFilter
) );
1054 maInclFilter
.SetPosSizePixel( LogicToPixel( Point( 10, 190 ), aAppMap
),
1055 LogicToPixel( Size( 95, 14 ), aAppMap
) );
1060 maExclText
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exclude-Filter" ) ) );
1061 maExclText
.SetPosSizePixel( LogicToPixel( Point( 115, 180 ), aAppMap
),
1062 LogicToPixel( Size( 95, 9 ), aAppMap
) );
1066 maExclFilter
.Show();
1067 maExclFilter
.SetText( XubString( pData
->aExclFilter
, RTL_TEXTENCODING_UTF8
) );
1068 maExclFilter
.SetMaxTextLen( sizeof( pData
->aExclFilter
) );
1069 maExclFilter
.SetPosSizePixel( LogicToPixel( Point( 115, 190 ), aAppMap
),
1070 LogicToPixel( Size( 95, 14 ), aAppMap
) );
1075 maTraceText
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) );
1076 maTraceText
.SetPosSizePixel( LogicToPixel( Point( 10, 210 ), aAppMap
),
1077 LogicToPixel( Size( 95, 9 ), aAppMap
) );
1081 maTraceBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
1082 maTraceBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) );
1083 maTraceBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Window" ) ) );
1084 maTraceBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Shell" ) ) );
1085 maTraceBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
1086 maTraceBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
1087 maTraceBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
1088 maTraceBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
1089 ImplAppendUserDefinedChannels( maTraceBox
);
1090 ImplSelectChannel( maTraceBox
, pData
->nTraceOut
, 0 );
1092 maTraceBox
.SetPosSizePixel( LogicToPixel( Point( 10, 220 ), aAppMap
),
1093 LogicToPixel( Size( 95, 80 ), aAppMap
) );
1097 maWarningText
.Show();
1098 maWarningText
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Warning" ) ) );
1099 maWarningText
.SetPosSizePixel( LogicToPixel( Point( 115, 210 ), aAppMap
),
1100 LogicToPixel( Size( 95, 9 ), aAppMap
) );
1104 maWarningBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
1105 maWarningBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) );
1106 maWarningBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Window" ) ) );
1107 maWarningBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Shell" ) ) );
1108 maWarningBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
1109 maWarningBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
1110 maWarningBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
1111 maWarningBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
1112 ImplAppendUserDefinedChannels( maWarningBox
);
1113 ImplSelectChannel( maWarningBox
, pData
->nWarningOut
, 0 );
1114 maWarningBox
.Show();
1115 maWarningBox
.SetPosSizePixel( LogicToPixel( Point( 115, 220 ), aAppMap
),
1116 LogicToPixel( Size( 95, 80 ), aAppMap
) );
1121 maErrorText
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Error" ) ) );
1122 maErrorText
.SetPosSizePixel( LogicToPixel( Point( 220, 210 ), aAppMap
),
1123 LogicToPixel( Size( 95, 9 ), aAppMap
) );
1127 if ( DbgIsAllErrorOut() )
1129 maErrorBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
1130 maErrorBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) );
1131 maErrorBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Window" ) ) );
1132 maErrorBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Shell" ) ) );
1137 maErrorBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
1138 maErrorBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
1139 maErrorBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
1140 maErrorBox
.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
1141 ImplAppendUserDefinedChannels( maErrorBox
);
1142 ImplSelectChannel( maErrorBox
, pData
->nErrorOut
, mnErrorOff
);
1144 maErrorBox
.SetPosSizePixel( LogicToPixel( Point( 220, 220 ), aAppMap
),
1145 LogicToPixel( Size( 95, 80 ), aAppMap
) );
1150 maBox4
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Output" ) ) );
1151 maBox4
.SetPosSizePixel( LogicToPixel( Point( 5, 120 ), aAppMap
),
1152 LogicToPixel( Size( 330, 135 ), aAppMap
) );
1157 maOKButton
.SetClickHdl( LINK( this, DbgDialog
, ClickHdl
) );
1158 maOKButton
.SetPosSizePixel( LogicToPixel( Point( 10, 260 ), aAppMap
),
1159 LogicToPixel( Size( 50, 15 ), aAppMap
) );
1162 maCancelButton
.Show();
1163 maCancelButton
.SetPosSizePixel( LogicToPixel( Point( 70, 260 ), aAppMap
),
1164 LogicToPixel( Size( 50, 15 ), aAppMap
) );
1167 maInfoButton
.Show();
1168 maInfoButton
.SetClickHdl( LINK( this, DbgDialog
, ClickHdl
) );
1169 maInfoButton
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Info..." ) ) );
1170 maInfoButton
.SetPosSizePixel( LogicToPixel( Point( 130, 260 ), aAppMap
),
1171 LogicToPixel( Size( 50, 15 ), aAppMap
) );
1174 maHelpButton
.Show();
1175 maHelpButton
.SetPosSizePixel( LogicToPixel( Point( 190, 260 ), aAppMap
),
1176 LogicToPixel( Size( 50, 15 ), aAppMap
) );
1180 SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL Debug Options" ) ) );
1181 SetOutputSizePixel( LogicToPixel( Size( 340, 280 ), aAppMap
) );
1185 // -----------------------------------------------------------------------
1187 IMPL_LINK( DbgDialog
, ClickHdl
, Button
*, pButton
)
1189 if ( pButton
== &maOKButton
)
1193 memcpy( &aData
, DbgGetData(), sizeof( DbgData
) );
1194 aData
.nTestFlags
= 0;
1196 aData
.nTraceOut
= ImplGetChannelId( maTraceBox
, 0 );
1197 aData
.nWarningOut
= ImplGetChannelId( maWarningBox
, 0 );
1198 aData
.nErrorOut
= ImplGetChannelId( maErrorBox
, mnErrorOff
);
1200 strncpy( aData
.aDebugName
, ByteString( maDebugName
.GetText(), RTL_TEXTENCODING_UTF8
).GetBuffer(), sizeof( aData
.aDebugName
) );
1201 strncpy( aData
.aInclClassFilter
, ByteString( maInclClassFilter
.GetText(), RTL_TEXTENCODING_UTF8
).GetBuffer(), sizeof( aData
.aInclClassFilter
) );
1202 strncpy( aData
.aExclClassFilter
, ByteString( maExclClassFilter
.GetText(), RTL_TEXTENCODING_UTF8
).GetBuffer(), sizeof( aData
.aExclClassFilter
) );
1203 strncpy( aData
.aInclFilter
, ByteString( maInclFilter
.GetText(), RTL_TEXTENCODING_UTF8
).GetBuffer(), sizeof( aData
.aInclFilter
) );
1204 strncpy( aData
.aExclFilter
, ByteString( maExclFilter
.GetText(), RTL_TEXTENCODING_UTF8
).GetBuffer(), sizeof( aData
.aExclFilter
) );
1205 aData
.aDebugName
[sizeof( aData
.aDebugName
)-1] = '\0';
1206 aData
.aInclClassFilter
[sizeof( aData
.aInclClassFilter
)-1] = '\0';
1207 aData
.aExclClassFilter
[sizeof( aData
.aExclClassFilter
)-1] = '\0';
1208 aData
.aInclFilter
[sizeof( aData
.aInclFilter
)-1] = '\0';
1209 aData
.aExclFilter
[sizeof( aData
.aExclFilter
)-1] = '\0';
1211 aData
.bOverwrite
= maOverwrite
.IsChecked() ? TRUE
: FALSE
;
1212 aData
.bHookOSLAssert
= maHookOSLBox
.IsChecked() ? TRUE
: FALSE
;
1214 if ( maXtorThis
.IsChecked() )
1215 aData
.nTestFlags
|= DBG_TEST_XTOR_THIS
;
1217 if ( maXtorFunc
.IsChecked() )
1218 aData
.nTestFlags
|= DBG_TEST_XTOR_FUNC
;
1220 if ( maXtorExit
.IsChecked() )
1221 aData
.nTestFlags
|= DBG_TEST_XTOR_EXIT
;
1223 if ( maXtorReport
.IsChecked() )
1224 aData
.nTestFlags
|= DBG_TEST_XTOR_REPORT
;
1226 if ( maXtorTrace
.IsChecked() )
1227 aData
.nTestFlags
|= DBG_TEST_XTOR_TRACE
;
1229 if ( maMemInit
.IsChecked() )
1230 aData
.nTestFlags
|= DBG_TEST_MEM_INIT
;
1232 if ( maMemOverwrite
.IsChecked() )
1233 aData
.nTestFlags
|= DBG_TEST_MEM_OVERWRITE
;
1235 if ( maMemOverwriteFree
.IsChecked() )
1236 aData
.nTestFlags
|= DBG_TEST_MEM_OVERWRITEFREE
;
1238 if ( maMemPtr
.IsChecked() )
1239 aData
.nTestFlags
|= DBG_TEST_MEM_POINTER
;
1241 if ( maMemReport
.IsChecked() )
1242 aData
.nTestFlags
|= DBG_TEST_MEM_REPORT
;
1244 if ( maMemTrace
.IsChecked() )
1245 aData
.nTestFlags
|= DBG_TEST_MEM_TRACE
;
1247 if ( maMemLeakReport
.IsChecked() )
1248 aData
.nTestFlags
|= DBG_TEST_MEM_LEAKREPORT
;
1250 if ( maMemNewDel
.IsChecked() )
1251 aData
.nTestFlags
|= DBG_TEST_MEM_NEWDEL
;
1253 if ( maMemXtor
.IsChecked() )
1254 aData
.nTestFlags
|= DBG_TEST_MEM_XTOR
;
1256 if ( maProf
.IsChecked() )
1257 aData
.nTestFlags
|= DBG_TEST_PROFILING
;
1259 if ( maRes
.IsChecked() )
1260 aData
.nTestFlags
|= DBG_TEST_RESOURCE
;
1262 if ( maDialog
.IsChecked() )
1263 aData
.nTestFlags
|= DBG_TEST_DIALOG
;
1265 if ( maBoldAppFont
.IsChecked() )
1266 aData
.nTestFlags
|= DBG_TEST_BOLDAPPFONT
;
1269 DbgSaveData( aData
);
1271 // Umschalten der Laufzeitwerte
1272 DBG_INSTOUTTRACE( aData
.nTraceOut
);
1273 DBG_INSTOUTWARNING( aData
.nWarningOut
);
1274 DBG_INSTOUTERROR( aData
.nErrorOut
);
1275 DbgUpdateOslHook( &aData
);
1277 DbgData
* pData
= DbgGetData();
1278 #define IMMEDIATE_FLAGS (DBG_TEST_MEM_INIT | DBG_TEST_RESOURCE | DBG_TEST_DIALOG | DBG_TEST_BOLDAPPFONT)
1279 pData
->nTestFlags
&= ~IMMEDIATE_FLAGS
;
1280 pData
->nTestFlags
|= aData
.nTestFlags
& IMMEDIATE_FLAGS
;
1281 strncpy( pData
->aInclClassFilter
, aData
.aInclClassFilter
, sizeof( pData
->aInclClassFilter
) );
1282 strncpy( pData
->aExclClassFilter
, aData
.aExclClassFilter
, sizeof( pData
->aExclClassFilter
) );
1283 strncpy( pData
->aInclFilter
, aData
.aInclFilter
, sizeof( pData
->aInclFilter
) );
1284 strncpy( pData
->aExclFilter
, aData
.aExclFilter
, sizeof( pData
->aExclFilter
) );
1285 if ( maBoldAppFont
.GetSavedValue() != maBoldAppFont
.IsChecked() )
1287 AllSettings aSettings
= Application::GetSettings();
1288 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
1289 Font aFont
= aStyleSettings
.GetAppFont();
1290 if ( maBoldAppFont
.IsChecked() )
1291 aFont
.SetWeight( WEIGHT_BOLD
);
1293 aFont
.SetWeight( WEIGHT_NORMAL
);
1294 aStyleSettings
.SetAppFont( aFont
);
1295 aSettings
.SetStyleSettings( aStyleSettings
);
1296 Application::SetSettings( aSettings
);
1298 if( (aData
.nTestFlags
& ~IMMEDIATE_FLAGS
) != (pData
->nTestFlags
& ~IMMEDIATE_FLAGS
) )
1300 InfoBox
aBox( this, String( RTL_CONSTASCII_USTRINGPARAM(
1301 "Some of the changed settings will only be active after "
1302 "restarting the process"
1308 else if ( pButton
== &maInfoButton
)
1310 DbgInfoDialog
aInfoDialog( this );
1311 aDbgInfoBuf
[0] = '\0';
1312 DbgMemInfo( aDbgInfoBuf
);
1313 DbgXtorInfo( aDbgInfoBuf
);
1314 XubString
aInfoText( aDbgInfoBuf
, RTL_TEXTENCODING_UTF8
);
1315 aInfoDialog
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debug InfoReport" ) ) );
1316 aInfoDialog
.SetInfoText( aInfoText
);
1317 aInfoDialog
.Execute();
1323 // -----------------------------------------------------------------------
1325 void DbgDialog::RequestHelp( const HelpEvent
& rHEvt
)
1327 if ( rHEvt
.GetMode() & HELPMODE_CONTEXT
)
1329 DbgInfoDialog
aInfoDialog( this, TRUE
);
1330 XubString aHelpText
;
1331 const sal_Char
** pHelpStrs
= pDbgHelpText
;
1332 while ( *pHelpStrs
)
1334 aHelpText
.AppendAscii( *pHelpStrs
);
1337 aInfoDialog
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debug Hilfe" ) ) );
1338 aInfoDialog
.SetInfoText( aHelpText
);
1339 aInfoDialog
.Execute();
1343 // =======================================================================
1345 DbgInfoDialog::DbgInfoDialog( Window
* pParent
, BOOL bHelpText
) :
1346 ModalDialog( pParent
, WB_STDMODAL
),
1347 maListBox( this, WB_BORDER
| WB_AUTOHSCROLL
),
1348 maOKButton( this, WB_DEFBUTTON
)
1350 mbHelpText
= bHelpText
;
1354 Font aFont
= GetDefaultFont( DEFAULTFONT_FIXED
, LANGUAGE_ENGLISH_US
, 0 );
1355 aFont
.SetHeight( 8 );
1356 aFont
.SetPitch( PITCH_FIXED
);
1357 maListBox
.SetControlFont( aFont
);
1359 maListBox
.SetPosSizePixel( Point( 5, 5 ), Size( 630, 380 ) );
1362 maOKButton
.SetPosSizePixel( Point( 290, 390 ), Size( 60, 25 ) );
1365 SetOutputSizePixel( Size( 640, 420 ) );
1368 // -----------------------------------------------------------------------
1370 void DbgInfoDialog::SetInfoText( const XubString
& rStr
)
1372 maListBox
.SetUpdateMode( FALSE
);
1374 XubString aStr
= rStr
;
1375 aStr
.ConvertLineEnd( LINEEND_LF
);
1376 USHORT nStrIndex
= 0;
1380 nFoundIndex
= aStr
.Search( _LF
, nStrIndex
);
1381 XubString aTextParagraph
= aStr
.Copy( nStrIndex
, nFoundIndex
-nStrIndex
);
1384 long nMaxWidth
= maListBox
.GetOutputSizePixel().Width()-30;
1385 USHORT nLastIndex
= 0;
1386 USHORT nIndex
= aTextParagraph
.Search( ' ' );
1387 while ( nIndex
!= STRING_NOTFOUND
)
1389 if ( maListBox
.GetTextWidth( aTextParagraph
, 0, nIndex
) > nMaxWidth
)
1392 nLastIndex
= nIndex
+1;
1393 XubString aTempStr
= aTextParagraph
.Copy( 0, nLastIndex
);
1394 aTextParagraph
.Erase( 0, nLastIndex
);
1395 maListBox
.InsertEntry( aTempStr
);
1399 nLastIndex
= nIndex
+1;
1400 nIndex
= aTextParagraph
.Search( ' ', nLastIndex
);
1403 if ( maListBox
.GetTextWidth( aTextParagraph
, 0, nIndex
) > nMaxWidth
)
1406 nLastIndex
= nIndex
+1;
1407 XubString aTempStr
= aTextParagraph
.Copy( 0, nLastIndex
);
1408 aTextParagraph
.Erase( 0, nLastIndex
);
1409 maListBox
.InsertEntry( aTempStr
);
1412 maListBox
.InsertEntry( aTextParagraph
);
1413 nStrIndex
= nFoundIndex
+1;
1415 while ( nFoundIndex
!= STRING_NOTFOUND
);
1416 maListBox
.SetUpdateMode( TRUE
);
1419 // =======================================================================
1421 void DbgDialogTest( Window
* pWindow
)
1423 BOOL aAccelBuf
[65536];
1424 USHORT nChildCount
= pWindow
->GetChildCount();
1425 Window
* pGetChild
= pWindow
->GetWindow( WINDOW_FIRSTCHILD
);
1432 Rectangle
* pRectAry
= (Rectangle
*)new long[(sizeof(Rectangle
)*nChildCount
)/sizeof(long)];
1433 memset( aAccelBuf
, 0, sizeof( aAccelBuf
) );
1434 memset( pRectAry
, 0, sizeof(Rectangle
)*nChildCount
);
1436 if ( pWindow
->IsDialog() )
1438 BOOL bOKCancelButton
= FALSE
;
1439 BOOL bDefPushButton
= FALSE
;
1440 BOOL bButton
= FALSE
;
1441 pGetChild
= pWindow
->GetWindow( WINDOW_FIRSTCHILD
);
1444 pChild
= pGetChild
->ImplGetWindow();
1446 if ( pChild
->ImplIsPushButton() )
1449 if ( (pChild
->GetType() == WINDOW_OKBUTTON
) || (pChild
->GetType() == WINDOW_CANCELBUTTON
) )
1450 bOKCancelButton
= TRUE
;
1451 if ( pChild
->GetStyle() & WB_DEFBUTTON
)
1452 bDefPushButton
= TRUE
;
1455 pGetChild
= pGetChild
->GetWindow( WINDOW_NEXT
);
1460 if ( !bOKCancelButton
)
1461 DbgError( "Dialogs should have a OK- or CancelButton" );
1462 if ( !bDefPushButton
)
1463 DbgError( "Dialogs should have a Button with WB_DEFBUTTON" );
1468 pGetChild
= pWindow
->GetWindow( WINDOW_FIRSTCHILD
);
1471 pChild
= pGetChild
->ImplGetWindow();
1473 if ( (pChild
->GetType() != WINDOW_TABCONTROL
) &&
1474 (pChild
->GetType() != WINDOW_TABPAGE
) &&
1475 (pChild
->GetType() != WINDOW_GROUPBOX
) )
1477 XubString aText
= pChild
->GetText();
1478 XubString aErrorText
= aText
;
1479 USHORT nAccelPos
= STRING_NOTFOUND
;
1480 xub_Unicode cAccel
= 0;
1481 if ( aErrorText
.Len() > 128 )
1483 aErrorText
.Erase( 128 );
1484 aErrorText
.AppendAscii( "..." );
1486 if ( aText
.Len() && (aText
.Len() < 1024) )
1488 nAccelPos
= aText
.Search( '~' );
1489 if ( nAccelPos
!= STRING_NOTFOUND
)
1491 const ::com::sun::star::lang::Locale
& rLocale
= Application::GetSettings().GetLocale();
1492 uno::Reference
< i18n::XCharacterClassification
> xCharClass
= vcl::unohelper::CreateCharacterClassification();
1493 XubString aUpperText
= xCharClass
->toUpper( aText
, 0, aText
.Len(), rLocale
);
1494 cAccel
= aUpperText
.GetChar( nAccelPos
+1 );
1495 if ( pChild
->IsVisible() )
1497 if ( aAccelBuf
[cAccel
] )
1498 DbgOutTypef( DBG_OUT_ERROR
, "Double mnemonic char: %c", cAccel
);
1500 aAccelBuf
[cAccel
] = TRUE
;
1505 if ( (pChild
->GetType() == WINDOW_RADIOBUTTON
) ||
1506 (pChild
->GetType() == WINDOW_IMAGERADIOBUTTON
) ||
1507 (pChild
->GetType() == WINDOW_CHECKBOX
) ||
1508 (pChild
->GetType() == WINDOW_TRISTATEBOX
) ||
1509 (pChild
->GetType() == WINDOW_PUSHBUTTON
) )
1511 if ( aText
.Len() && !aText
.EqualsAscii( "..." ) )
1514 if ( pChild
->GetType() == WINDOW_RADIOBUTTON
)
1515 pClass
= "RadioButton";
1516 else if ( pChild
->GetType() == WINDOW_IMAGERADIOBUTTON
)
1517 pClass
= "ImageRadioButton";
1518 else if ( pChild
->GetType() == WINDOW_CHECKBOX
)
1519 pClass
= "CheckBox";
1520 else if ( pChild
->GetType() == WINDOW_TRISTATEBOX
)
1521 pClass
= "TriStateBox";
1522 else if ( pChild
->GetType() == WINDOW_PUSHBUTTON
)
1523 pClass
= "PushButton";
1525 pClass
= "Dontknow";
1527 DbgOutTypef( DBG_OUT_ERROR
,
1528 "%s should have a mnemonic char (~): %s",
1530 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1534 switch( pChild
->GetType() )
1536 case WINDOW_RADIOBUTTON
:
1537 case WINDOW_IMAGERADIOBUTTON
:
1538 aWidth
= ((RadioButton
*)pChild
)->CalcMinimumSize(0).Width();
1540 case WINDOW_CHECKBOX
:
1541 case WINDOW_TRISTATEBOX
:
1542 aWidth
= ((CheckBox
*)pChild
)->CalcMinimumSize(0).Width();
1544 case WINDOW_PUSHBUTTON
:
1545 aWidth
= ((PushButton
*)pChild
)->CalcMinimumSize(0).Width();
1549 if( pChild
->IsVisible() && pChild
->GetSizePixel().Width() < aWidth
)
1550 DbgOutTypef( DBG_OUT_ERROR
,
1551 "%s exceeds window width: %s",
1553 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1557 if ( pChild
->GetType() == WINDOW_FIXEDLINE
)
1559 if ( pChild
->GetSizePixel().Width() < pChild
->GetTextWidth( aText
) )
1560 DbgOutTypef( DBG_OUT_ERROR
,
1561 "FixedLine exceeds window width: %s",
1562 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1565 if ( pChild
->GetType() == WINDOW_FIXEDTEXT
)
1567 if ( (pChild
->GetSizePixel().Height() >= pChild
->GetTextHeight()*2) &&
1568 !(pChild
->GetStyle() & WB_WORDBREAK
) )
1570 DbgOutTypef( DBG_OUT_ERROR
,
1571 "FixedText greater than one line, but WordBreak is not set: %s",
1572 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1575 if ( pChild
->IsVisible() )
1578 if( nAccelPos
!= STRING_NOTFOUND
)
1580 aWidth
= pChild
->GetTextWidth( aText
, 0, nAccelPos
) +
1581 pChild
->GetTextWidth( aText
, nAccelPos
+1, aText
.Len() - nAccelPos
- 1);
1584 aWidth
= pChild
->GetTextWidth( aText
);
1586 if ( pChild
->GetSizePixel().Width() < aWidth
&& !(pChild
->GetStyle() & WB_WORDBREAK
) )
1588 DbgOutTypef( DBG_OUT_ERROR
,
1589 "FixedText exceeds window width: %s",
1590 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1594 if ( (i
+1 < nChildCount
) && aText
.Len() )
1596 Window
* pTempChild
= pGetChild
->GetWindow( WINDOW_NEXT
)->ImplGetWindow();
1597 if ( (pTempChild
->GetType() == WINDOW_EDIT
) ||
1598 (pTempChild
->GetType() == WINDOW_MULTILINEEDIT
) ||
1599 (pTempChild
->GetType() == WINDOW_SPINFIELD
) ||
1600 (pTempChild
->GetType() == WINDOW_PATTERNFIELD
) ||
1601 (pTempChild
->GetType() == WINDOW_NUMERICFIELD
) ||
1602 (pTempChild
->GetType() == WINDOW_METRICFIELD
) ||
1603 (pTempChild
->GetType() == WINDOW_CURRENCYFIELD
) ||
1604 (pTempChild
->GetType() == WINDOW_DATEFIELD
) ||
1605 (pTempChild
->GetType() == WINDOW_TIMEFIELD
) ||
1606 (pTempChild
->GetType() == WINDOW_LISTBOX
) ||
1607 (pTempChild
->GetType() == WINDOW_MULTILISTBOX
) ||
1608 (pTempChild
->GetType() == WINDOW_COMBOBOX
) ||
1609 (pTempChild
->GetType() == WINDOW_PATTERNBOX
) ||
1610 (pTempChild
->GetType() == WINDOW_NUMERICBOX
) ||
1611 (pTempChild
->GetType() == WINDOW_METRICBOX
) ||
1612 (pTempChild
->GetType() == WINDOW_CURRENCYBOX
) ||
1613 (pTempChild
->GetType() == WINDOW_DATEBOX
) ||
1614 (pTempChild
->GetType() == WINDOW_TIMEBOX
) )
1618 DbgOutTypef( DBG_OUT_ERROR
,
1619 "Labels befor Fields (Edit,ListBox,...) should have a mnemonic char (~): %s",
1620 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1622 if ( !pTempChild
->IsEnabled() && pChild
->IsEnabled() )
1624 DbgOutTypef( DBG_OUT_ERROR
,
1625 "Labels befor Fields (Edit,ListBox,...) should be disabled, when the field is disabled: %s",
1626 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1632 if ( pChild
->GetType() == WINDOW_MULTILINEEDIT
)
1634 if ( ( 0 == ( pChild
->GetStyle() & WB_IGNORETAB
) )
1635 && ( 0 == ( pChild
->GetStyle() & WB_READONLY
) )
1638 DbgError( "editable MultiLineEdits in Dialogs should have the Style WB_IGNORETAB" );
1642 if ( (pChild
->GetType() == WINDOW_RADIOBUTTON
) ||
1643 (pChild
->GetType() == WINDOW_IMAGERADIOBUTTON
) ||
1644 (pChild
->GetType() == WINDOW_CHECKBOX
) ||
1645 (pChild
->GetType() == WINDOW_TRISTATEBOX
) ||
1646 (pChild
->GetType() == WINDOW_FIXEDTEXT
) )
1648 pChild
->SetBackground( Wallpaper( Color( COL_LIGHTGREEN
) ) );
1651 if ( pChild
->IsVisible() )
1653 BOOL bMaxWarning
= FALSE
;
1654 if ( pChild
->GetType() == WINDOW_NUMERICFIELD
)
1656 NumericField
* pField
= (NumericField
*)pChild
;
1657 if ( pField
->GetMax() == LONG_MAX
)
1660 else if ( pChild
->GetType() == WINDOW_METRICFIELD
)
1662 MetricField
* pField
= (MetricField
*)pChild
;
1663 if ( pField
->GetMax() == LONG_MAX
)
1666 else if ( pChild
->GetType() == WINDOW_CURRENCYFIELD
)
1668 CurrencyField
* pField
= (CurrencyField
*)pChild
;
1669 if ( pField
->GetMax() == LONG_MAX
)
1672 else if ( pChild
->GetType() == WINDOW_TIMEFIELD
)
1674 TimeField
* pField
= (TimeField
*)pChild
;
1675 if ( pField
->GetMax() == Time( 23, 59, 59, 99 ) )
1678 else if ( pChild
->GetType() == WINDOW_DATEFIELD
)
1680 DateField
* pField
= (DateField
*)pChild
;
1681 if ( pField
->GetMax() == Date( 31, 12, 9999 ) )
1684 else if ( pChild
->GetType() == WINDOW_NUMERICBOX
)
1686 NumericBox
* pBox
= (NumericBox
*)pChild
;
1687 if ( pBox
->GetMax() == LONG_MAX
)
1690 else if ( pChild
->GetType() == WINDOW_METRICBOX
)
1692 MetricBox
* pBox
= (MetricBox
*)pChild
;
1693 if ( pBox
->GetMax() == LONG_MAX
)
1696 else if ( pChild
->GetType() == WINDOW_CURRENCYBOX
)
1698 CurrencyBox
* pBox
= (CurrencyBox
*)pChild
;
1699 if ( pBox
->GetMax() == LONG_MAX
)
1702 else if ( pChild
->GetType() == WINDOW_TIMEBOX
)
1704 TimeBox
* pBox
= (TimeBox
*)pChild
;
1705 if ( pBox
->GetMax() == Time( 23, 59, 59, 99 ) )
1708 else if ( pChild
->GetType() == WINDOW_DATEBOX
)
1710 DateBox
* pBox
= (DateBox
*)pChild
;
1711 if ( pBox
->GetMax() == Date( 31, 12, 9999 ) )
1716 DbgOutTypef( DBG_OUT_ERROR
,
1717 "No Max-Value is set: %s",
1718 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1721 if ( (pChild
->GetType() == WINDOW_RADIOBUTTON
) ||
1722 (pChild
->GetType() == WINDOW_IMAGERADIOBUTTON
) ||
1723 (pChild
->GetType() == WINDOW_CHECKBOX
) ||
1724 (pChild
->GetType() == WINDOW_TRISTATEBOX
) ||
1725 (pChild
->GetType() == WINDOW_PUSHBUTTON
) ||
1726 (pChild
->GetType() == WINDOW_OKBUTTON
) ||
1727 (pChild
->GetType() == WINDOW_CANCELBUTTON
) ||
1728 (pChild
->GetType() == WINDOW_HELPBUTTON
) ||
1729 (pChild
->GetType() == WINDOW_IMAGEBUTTON
) ||
1730 (pChild
->GetType() == WINDOW_FIXEDTEXT
) ||
1731 (pChild
->GetType() == WINDOW_EDIT
) ||
1732 (pChild
->GetType() == WINDOW_MULTILINEEDIT
) ||
1733 (pChild
->GetType() == WINDOW_SPINFIELD
) ||
1734 (pChild
->GetType() == WINDOW_PATTERNFIELD
) ||
1735 (pChild
->GetType() == WINDOW_NUMERICFIELD
) ||
1736 (pChild
->GetType() == WINDOW_METRICFIELD
) ||
1737 (pChild
->GetType() == WINDOW_CURRENCYFIELD
) ||
1738 (pChild
->GetType() == WINDOW_DATEFIELD
) ||
1739 (pChild
->GetType() == WINDOW_TIMEFIELD
) ||
1740 (pChild
->GetType() == WINDOW_LISTBOX
) ||
1741 (pChild
->GetType() == WINDOW_MULTILISTBOX
) ||
1742 (pChild
->GetType() == WINDOW_COMBOBOX
) ||
1743 (pChild
->GetType() == WINDOW_PATTERNBOX
) ||
1744 (pChild
->GetType() == WINDOW_NUMERICBOX
) ||
1745 (pChild
->GetType() == WINDOW_METRICBOX
) ||
1746 (pChild
->GetType() == WINDOW_CURRENCYBOX
) ||
1747 (pChild
->GetType() == WINDOW_DATEBOX
) ||
1748 (pChild
->GetType() == WINDOW_TIMEBOX
) )
1750 Point aNewPos
= pChild
->GetPosPixel();
1751 Rectangle
aChildRect( aNewPos
, pChild
->GetSizePixel() );
1753 if ( cAccel
|| (pChild
->GetStyle() & WB_TABSTOP
) ||
1754 (pChild
->GetType() == WINDOW_RADIOBUTTON
) ||
1755 (pChild
->GetType() == WINDOW_IMAGERADIOBUTTON
) )
1757 if ( (aNewPos
.X() <= aTabPos
.X()) && (aNewPos
.Y() <= aTabPos
.Y()) )
1759 DbgOutTypef( DBG_OUT_ERROR
,
1760 "Possible wrong childorder for dialogcontrol: %s",
1761 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1766 for ( USHORT j
= 0; j
< i
; j
++ )
1768 if ( ((pRectAry
[j
].Right() != 0) || (pRectAry
[j
].Bottom() != 0)) &&
1769 aChildRect
.IsOver( pRectAry
[j
] ) )
1771 DbgOutTypef( DBG_OUT_ERROR
,
1772 "Window overlaps with sibling window: %s",
1773 ByteString( aErrorText
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
1776 pRectAry
[i
] = aChildRect
;
1781 pGetChild
= pGetChild
->GetWindow( WINDOW_NEXT
);
1788 // =======================================================================
1789 void DbgPrintShell( const char* pLine
);
1792 #define USE_VCL_MSGBOX
1793 #define COPY_BUTTON_ID 25
1795 class DbgMessageBox
: public ErrorBox
1799 DbgMessageBox( const String
& rMessage
) :
1800 ErrorBox( NULL
, WB_YES_NO_CANCEL
| WB_DEF_NO
, rMessage
),
1801 m_aMessage( rMessage
)
1803 SetText( String( RTL_CONSTASCII_USTRINGPARAM("Debug Output") ) );
1804 AddButton( String( RTL_CONSTASCII_USTRINGPARAM( "Copy" ) ), COPY_BUTTON_ID
, 0 );
1807 virtual void Click()
1809 if( GetCurButtonId() == COPY_BUTTON_ID
)
1810 vcl::unohelper::TextDataObject::CopyStringTo( m_aMessage
, GetClipboard() );
1818 class SolarMessageBoxExecutor
: public ::vcl::SolarThreadExecutor
1821 String m_sDebugMessage
;
1824 SolarMessageBoxExecutor( const String
& _rDebugMessage
)
1825 :m_sDebugMessage( _rDebugMessage
)
1830 virtual long doIt();
1833 long SolarMessageBoxExecutor::doIt()
1835 long nResult
= RET_NO
;
1837 // Tracking beenden und Mouse freigeben, damit die Boxen nicht haengen
1838 ImplSVData
* pSVData
= ImplGetSVData();
1839 if ( pSVData
->maWinData
.mpTrackWin
)
1840 pSVData
->maWinData
.mpTrackWin
->EndTracking( ENDTRACK_CANCEL
);
1841 if ( pSVData
->maWinData
.mpCaptureWin
)
1842 pSVData
->maWinData
.mpCaptureWin
->ReleaseMouse();
1844 #if ! defined USE_VCL_MSGBOX
1846 BOOL bOldCallTimer
= pSVData
->mbNoCallTimer
;
1847 pSVData
->mbNoCallTimer
= TRUE
;
1848 MessageBeep( MB_ICONHAND
);
1849 nResult
= MessageBoxW( 0, (LPWSTR
)m_sDebugMessage
.GetBuffer(), L
"Debug Output",
1850 MB_TASKMODAL
| MB_YESNOCANCEL
| MB_DEFBUTTON2
| MB_ICONSTOP
);
1851 pSVData
->mbNoCallTimer
= bOldCallTimer
;
1861 nResult
= RET_CANCEL
;
1866 USHORT nOldMode
= Application::GetSystemWindowMode();
1867 Application::SetSystemWindowMode( nOldMode
& ~SYSTEMWINDOW_MODE_NOAUTOMODE
);
1868 DbgMessageBox
aBox( m_sDebugMessage
);
1869 Application::SetSystemWindowMode( nOldMode
);
1870 nResult
= aBox
.Execute();
1876 void DbgPrintMsgBox( const char* pLine
)
1878 // are modal message boxes prohibited at the moment?
1879 if ( Application::IsDialogCancelEnabled() )
1882 // TODO: Shouldn't this be a IsDebuggerPresent()?
1883 if ( GetSystemMetrics( SM_DEBUG
) )
1885 MessageBeep( MB_ICONHAND
);
1886 strcpy( aDbgOutBuf
, pLine
);
1887 strcat( aDbgOutBuf
, "\r\n" );
1888 OutputDebugString( aDbgOutBuf
);
1893 Sound::Beep( SOUND_ERROR
);
1895 fprintf( stderr
, "%s\n", pLine
);
1898 DbgPrintFile( pLine
);
1903 strcpy( aDbgOutBuf
, pLine
);
1904 strcat( aDbgOutBuf
, "\nAbort ? (Yes=abort / No=ignore / Cancel=core dump)" );
1906 SolarMessageBoxExecutor
aMessageBox( String( aDbgOutBuf
, RTL_TEXTENCODING_UTF8
) );
1907 TimeValue aTimeout
; aTimeout
.Seconds
= 2; aTimeout
.Nanosec
= 0;
1908 long nResult
= aMessageBox
.execute( aTimeout
);
1910 if ( aMessageBox
.didTimeout() )
1911 DbgPrintShell( pLine
);
1912 else if ( nResult
== RET_YES
)
1913 GetpApp()->Abort( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debug-Utilities-Error" ) ) );
1914 else if ( nResult
== RET_CANCEL
)
1918 // -----------------------------------------------------------------------
1920 class SolarWindowPrinter
: public ::vcl::SolarThreadExecutor
1923 String m_sDebugMessage
;
1926 SolarWindowPrinter( const String
& _rDebugMessage
)
1927 :m_sDebugMessage( _rDebugMessage
)
1932 virtual long doIt();
1935 long SolarWindowPrinter::doIt()
1937 DbgWindow
* pDbgWindow
= ImplGetSVData()->maWinData
.mpDbgWin
;
1940 pDbgWindow
= new DbgWindow
;
1941 ImplGetSVData()->maWinData
.mpDbgWin
= pDbgWindow
;
1943 pDbgWindow
->InsertLine( m_sDebugMessage
);
1948 // -----------------------------------------------------------------------
1950 void DbgPrintWindow( const char* pLine
)
1952 static BOOL bIn
= FALSE
;
1954 // keine rekursiven Traces
1959 SolarWindowPrinter
aPrinter( String( pLine
, RTL_TEXTENCODING_UTF8
) );
1960 TimeValue aTimeout
; aTimeout
.Seconds
= 2; aTimeout
.Nanosec
= 0;
1961 aPrinter
.execute( aTimeout
);
1963 if ( aPrinter
.didTimeout() )
1964 DbgPrintShell( pLine
);
1969 // -----------------------------------------------------------------------
1971 void DbgPrintShell( const char* pLine
)
1974 // TODO: Shouldn't this be a IsDebuggerPresent()?
1975 if ( GetSystemMetrics( SM_DEBUG
) )
1977 strcpy( aDbgOutBuf
, pLine
);
1978 strcat( aDbgOutBuf
, "\r\n" );
1979 OutputDebugString( aDbgOutBuf
);
1983 DbgPrintWindow( pLine
);
1986 fprintf( stderr
, "%s\n", pLine
);
1990 // =======================================================================
1993 void ImplDbgTestSolarMutex();
1996 // =======================================================================
2000 DbgSetPrintMsgBox( DbgPrintMsgBox
);
2001 DbgSetPrintWindow( DbgPrintWindow
);
2002 DbgSetPrintShell( DbgPrintShell
);
2004 DbgSetTestSolarMutex( ImplDbgTestSolarMutex
);
2008 // -----------------------------------------------------------------------
2012 DbgSetPrintMsgBox( NULL
);
2013 DbgSetPrintWindow( NULL
);
2014 DbgSetPrintShell( NULL
);
2016 DbgSetTestSolarMutex( NULL
);
2019 DbgWindow
* pDbgWindow
= ImplGetSVData()->maWinData
.mpDbgWin
;
2024 // -----------------------------------------------------------------------
2028 DbgData
* pData
= DbgGetData();
2032 DbgDialog
* pDialog
= new DbgDialog
;
2033 // Fuer den Debug-Dialog schalten wir Dialogtests aus
2034 ULONG nOldFlags
= pData
->nTestFlags
;
2035 pData
->nTestFlags
&= ~DBG_TEST_DIALOG
;
2036 if ( !pDialog
->Execute() )
2037 pData
->nTestFlags
|= (nOldFlags
& DBG_TEST_DIALOG
);
2043 XubString( RTL_CONSTASCII_USTRINGPARAM( "TOOLS Library has no Debug-Routines" ) ) ).Execute();
2047 // -----------------------------------------------------------------------
2049 USHORT
DbgRegisterNamedUserChannel( const XubString
& _rChannelUIName
, DbgPrintLine pProc
)
2051 DbgChannelId nChannelId
= DbgRegisterUserChannel( pProc
);
2052 UserDefinedChannels
& rChannels
= ImplDbgGetUserDefinedChannels();
2053 rChannels
[ _rChannelUIName
] = nChannelId
;