1 /************************************************************************/
2 /*									*/
3 /*  Ted: Interface to the generic symbol picker.			*/
4 /*									*/
5 /************************************************************************/
6 
7 #   include	"tedConfig.h"
8 
9 #   include	<stddef.h>
10 #   include	<stdio.h>
11 #   include	<ctype.h>
12 
13 #   include	"tedSymbolPicker.h"
14 #   include	"tedApp.h"
15 #   include	"tedEdit.h"
16 #   include	"tedDocument.h"
17 #   include	"tedAppResources.h"
18 #   include	<appSymbolPicker.h>
19 #   include	<docEditCommand.h>
20 
21 #   include	<appDebugon.h>
22 
23 /************************************************************************/
24 /*									*/
25 /*  Adapt fonts tool to the current document.				*/
26 /*									*/
27 /************************************************************************/
28 
tedRefreshSymbolPicker(SymbolPicker * sp,int * pEnabled,int * pPref,InspectorSubject * is,const DocumentSelection * ds,const SelectionDescription * sd,const BufferDocument * bd,int documentId,const unsigned char * cmdEnabled)29 void tedRefreshSymbolPicker(	SymbolPicker *			sp,
30 				int *				pEnabled,
31 				int *				pPref,
32 				InspectorSubject *		is,
33 				const DocumentSelection *	ds,
34 				const SelectionDescription *	sd,
35 				const BufferDocument *		bd,
36 				int				documentId,
37 				const unsigned char *		cmdEnabled )
38     {
39     const DocumentProperties *	dp= &(bd->bdProperties);
40     const DocumentFontList *	dfl= dp->dpFontList;
41 
42     if  ( sd->sdIsListBullet )
43 	{ *pEnabled= 0; return;	}
44 
45     if  ( appAdaptSymbolPickerToFontFamily( sp, documentId, dfl,
46 			&(sd->sdTextAttributeMask), &(sd->sdTextAttribute) ) )
47 	{ LDEB(1);	}
48 
49     appEnableSymbolPicker( sp, cmdEnabled[EDITcmdREPLACE] );
50 
51     *pEnabled= 1;
52     return;
53     }
54 
55 /************************************************************************/
56 /*									*/
57 /*  Insert callback for the symbol picker.				*/
58 /*									*/
59 /************************************************************************/
60 
tedSymbolPickerInsert(void * voidea,const char * bytes,int size,const TextAttribute * taSet,const PropertyMask * taSetMask)61 void tedSymbolPickerInsert(	void *			voidea,
62 				const char *		bytes,
63 				int			size,
64 				const TextAttribute *	taSet,
65 				const PropertyMask *	taSetMask )
66     {
67     EditApplication *		ea= (EditApplication *)voidea;
68     EditDocument *		ed= ea->eaCurrentDocument;
69 
70     if  ( ! ed )
71 	{ XDEB(ed); return;	}
72 
73     tedDocInsertStringWithAttribute( ed, bytes, size, taSet, taSetMask, ((TedDocument *)ed->edPrivateData)->tdTraced );
74 
75     return;
76     }
77 
78