1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
/************************************************************************/
/* */
/* The 'Font Tool': */
/* */
/* Most of the ont tool calls directly go to the AppFontTool. */
/* the document. */
/* */
/************************************************************************/
# include "tedConfig.h"
# include <stdlib.h>
# include <stdio.h>
# include <stddef.h>
# include <limits.h>
# include "tedApp.h"
# include "tedFormatTool.h"
# include <appDebugon.h>
/************************************************************************/
/* */
/* Intermediary routine to refresh the text font tool. */
/* */
/************************************************************************/
void tedRefreshFontTool( AppFontChooser * afc,
int * pEnabled,
int * pPref,
InspectorSubject * is,
const DocumentSelection * ds,
const SelectionDescription * sd,
EditDocument * ed )
{
const TedDocument * td= (TedDocument *)ed->edPrivateData;
BufferDocument * bd= td->tdDocument;
const DocumentProperties * dp= &(bd->bdProperties);
const DocumentFontList * dfl= &(dp->dpFontList);
PropertyMask updMask;
TextAttribute ta;
if ( sd->sdIsListBullet )
{ *pEnabled= 0; return; }
*pPref= 6;
PROPmaskCLEAR( &updMask );
utilInitTextAttribute( &ta );
if ( sd->sdIsIBarSelection )
{
ta= td->tdCurrentTextAttribute;
PROPmaskFILL( &updMask, TAprop_COUNT );
}
else{
docGetSelectionAttributes( bd, ds, &updMask, &ta );
}
if ( appFontExpandCurrentFont( afc, &updMask, &ta,
ed->edDocumentId,
dfl, dp->dpColors, dp->dpColorCount ) )
{ LDEB(1); }
*pEnabled= 1;
return;
}
/************************************************************************/
/* */
/* Intermediary routine to refresh the list font tool. */
/* */
/************************************************************************/
void tedRefreshListFontTool( AppFontChooser * afc,
int * pEnabled,
int * pPref,
InspectorSubject * is,
const DocumentSelection * ds,
const SelectionDescription * sd,
BufferDocument * bd )
{
const DocumentProperties * dp= &(bd->bdProperties);
const DocumentFontList * dfl= &(dp->dpFontList);
ListOverride * lo;
DocumentList * dl;
ListNumberTreeNode * root;
int startPath[DLmaxLEVELS+1];
int formatPath[DLmaxLEVELS+1];
const DocumentListLevel * dll= (const DocumentListLevel *)0;
if ( ! sd->sdHasLists ||
sd->sdListOverride < 1 ||
sd->sdMultiList ||
sd->sdMultiLevel )
{ *pEnabled= 0; return; }
if ( docGetListOfParagraph( &lo, &root, &dl, sd->sdListOverride, bd ) )
{ *pEnabled= 0; return; }
docListGetFormatPath( startPath, formatPath, &dll,
sd->sdListLevel, dl, lo );
if ( appFontExpandCurrentFont( afc, &(dll->dllTextAttributeMask),
&(dll->dllTextAttribute),
sd->sdDocumentId, dfl,
dp->dpColors, dp->dpColorCount ) )
{ LDEB(1); }
*pPref= 7;
*pEnabled= 1;
*pEnabled= 0;
return;
}
void tedFormatShowFontPage( EditApplication * ea )
{
TedAppResources * tar= (TedAppResources *)ea->eaResourceData;
if ( ! tar->tarInspector )
{ XDEB(tar->tarInspector); return; }
appEnableInspectorSubject( tar->tarInspector, TEDtsiFONT, 1 );
appInspectorSelectSubject( tar->tarInspector, TEDtsiFONT );
return;
}
/************************************************************************/
/* */
/* Resources. */
/* */
/************************************************************************/
static AppConfigurableResource TED_FontToolSubjectResourceTable[]=
{
APP_RESOURCE( "fontToolFont",
offsetof(InspectorSubjectResources,isrSubjectName),
"Font" ),
APP_RESOURCE( "fontToolSet",
offsetof(InspectorSubjectResources,isrApplyToSubject),
"Set" ),
APP_RESOURCE( "fontToolRevert",
offsetof(InspectorSubjectResources,isrRevert),
"Revert" ),
};
void tedFontToolGetResourceTable( EditApplication * ea,
AppFontToolResources * aftr,
InspectorSubjectResources * isr )
{
appFontToolGetResourceTable( ea, aftr );
appGuiGetResourceValues( ea, (void *)isr,
TED_FontToolSubjectResourceTable,
sizeof(TED_FontToolSubjectResourceTable)/
sizeof(AppConfigurableResource) );
return;
}
static AppConfigurableResource TED_ListFontToolSubjectResourceTable[]=
{
APP_RESOURCE( "fontToolListFont",
offsetof(InspectorSubjectResources,isrSubjectName),
"List Font" ),
APP_RESOURCE( "fontToolSetListFont",
offsetof(InspectorSubjectResources,isrApplyToSubject),
"Set" ),
APP_RESOURCE( "fontToolRevertListFont",
offsetof(InspectorSubjectResources,isrRevert),
"Revert" ),
};
void tedListFontToolGetResourceTable( EditApplication * ea,
InspectorSubjectResources * isr )
{
appGuiGetResourceValues( ea, (void *)isr,
TED_ListFontToolSubjectResourceTable,
sizeof(TED_ListFontToolSubjectResourceTable)/
sizeof(AppConfigurableResource) );
return;
}
|