00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #ifndef INC_SGFONTS
00101 #define INC_SGFONTS
00102
00103 #ifndef EXCLUDE_GALS
00104
00105
00106
00107 #include "sglib.h"
00108 #include "dragbmp.h"
00109 #include "sgdrag.h"
00110 #include "fontbase.h"
00111
00112
00113 #include "sglbase.h"
00114
00115 class Document;
00116 class SuperGallery;
00117 class String_64;
00118 class String_256;
00119 class KernelBitmap;
00120 class SGDisplayNode;
00121 class DocCoord;
00122 class Msg;
00123 class SGDisplayGroup;
00124 class PathName;
00125 class NodeRenderableInk;
00126 class List;
00127 class OpDescriptor;
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 class CCAPI SGFontsGroup : public SGDisplayGroup
00142 {
00143 CC_DECLARE_DYNAMIC(SGFontsGroup);
00144
00145 public:
00146 SGFontsGroup(SuperGallery *ParentGal,
00147 Document *ParentDoc = NULL, Library *ParentLib = NULL,
00148 String_64 *TText = NULL);
00149
00150 virtual void ReadGroupTitle(void);
00151
00152 virtual BOOL HandleEvent(SGEventType EventType, void *EventInfo, SGMiscInfo *MiscInfo);
00153
00154 virtual BOOL GetBubbleHelp(DocCoord *MousePos, String_256 *Result);
00155
00156 virtual BOOL GetStatusLineHelp(DocCoord *MousePos, String_256 *Result);
00157
00158 virtual BOOL CanVirtualise(void);
00159 };
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175 class CCAPI SGDisplayPreviewFonts : public SGDisplayItem
00176 {
00177 CC_DECLARE_DYNAMIC(SGDisplayPreviewFonts);
00178
00179 public:
00180 SGDisplayPreviewFonts();
00181 ~SGDisplayPreviewFonts();
00182
00183 virtual BOOL HandleEvent(SGEventType EventType, void *EventInfo,
00184 SGMiscInfo *MiscInfo);
00185
00186 void DragWasReallyAClick(SGMouseInfo *Mouse, SGMiscInfo *MiscInfo);
00187
00188 protected:
00189
00190
00191 virtual void CalculateMyRect(SGFormatInfo *FormatInfo, SGMiscInfo *MiscInfo);
00192
00193
00194 virtual void HandleRedraw(SGRedrawInfo *RedrawInfo, SGMiscInfo *MiscInfo);
00195
00196
00197 virtual BOOL DrawThumb(RenderRegion *Renderer, SGRedrawInfo *RedrawInfo,
00198 SGMiscInfo *MiscInfo, DocRect *Rectangle, BOOL Background = FALSE);
00199
00200
00201 virtual void DrawItemText(RenderRegion *Renderer, SGRedrawInfo *RedrawInfo,
00202 SGMiscInfo *MiscInfo, DocRect *Rectangle, DocRect *BmpRect, BOOL Selected);
00203
00204 void MoveAfter(SGDisplayNode *NodeToMove);
00205
00206 void MoveBefore(SGDisplayNode *NodeToMove);
00207
00208 BOOL GetBubbleHelp(DocCoord *MousePos, String_256 *Result);
00209
00210 BOOL GetStatusLineHelp(DocCoord *MousePos, String_256 *Result);
00211
00212 public:
00213
00214
00215 static LibDisplayType GetDisplayType(SGMiscInfo *MiscInfo);
00216
00217 virtual void GetNameText(String_256 *Result);
00218 virtual void GetFullInfoText(String_256 *Result);
00219 virtual INT32 CompareTo(SGDisplayNode *Other, INT32 SortKey);
00220
00221 virtual BOOL CreateThumbnail(KernelBitmap **Bitmap);
00222
00223 KernelBitmap *GetDisplayedKernelBitmap(SGMiscInfo *MiscInfo, BOOL Background);
00224
00225 inline String_64 *GetDisplayedTextDescription(void);
00226
00227
00228 static BOOL GetThumbnailDetails(INT32 Mode, UINT32 *X, UINT32 *Y, String_256 *Text);
00229
00230
00231 virtual void GetKeyWords(String_256 *Result);
00232
00233
00234 static void DrawTypeIcon(SGRedrawInfo *RedrawInfo, SGMiscInfo *MiscInfo, DocRect *TypeRect, FontClass Type);
00235
00236
00237 BOOL IsFontBeingUsed(void);
00238
00239 public:
00240
00241
00242 KernelBitmap *FontBitmap;
00243 String_64 FontDescription;
00244
00245
00246
00247
00248 UINT32 ID;
00249
00250
00251 static INT32 DMode;
00252
00253
00254 FontClass Type;
00255
00256
00257 LOGFONT *CachedLogFont;
00258 INT32 IntLeading;
00259
00260
00261 BOOL Invalid;
00262 };
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276 class SGTTFItem : public SGDisplayPreviewFonts
00277 {
00278 CC_DECLARE_DYNAMIC(SGTTFItem);
00279
00280 public:
00281 SGTTFItem();
00282 ~SGTTFItem();
00283
00284 SGTTFItem(KernelBitmap *PreviewFontsToDisplay, String_64 *Name,
00285 INT32 IL = 0, PLOGFONT lpelf = NULL, UINT32 TheID = 0);
00286
00287 virtual void GetFullInfoText(String_256 *Result);
00288 virtual BOOL CreateThumbnail(KernelBitmap **Bitmap);
00289 };
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303 class SGATMItem : public SGDisplayPreviewFonts
00304 {
00305 CC_DECLARE_DYNAMIC(SGATMItem);
00306
00307 public:
00308 SGATMItem();
00309 ~SGATMItem();
00310
00311 SGATMItem(KernelBitmap *PreviewFontsToDisplay, String_64 *Name,
00312 INT32 IL = 0, PLOGFONT lpelf = NULL, UINT32 TheID = 0);
00313
00314 virtual void GetFullInfoText(String_256 *Result);
00315 virtual BOOL CreateThumbnail(KernelBitmap **Bitmap);
00316 };
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331 String_64 *SGDisplayPreviewFonts::GetDisplayedTextDescription(void)
00332 {
00333 return(&FontDescription);
00334 }
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353 class FontsSGallery : public LibraryGallery
00354 {
00355 CC_DECLARE_DYNCREATE(FontsSGallery)
00356
00357 public:
00358 FontsSGallery();
00359 ~FontsSGallery();
00360
00361
00362 virtual BOOL IsLibraryGalleryWithNonLibraryGroups(void) {return FALSE;};
00363
00364 public:
00365
00366
00367 virtual MsgResult Message(Msg* Message);
00368
00369
00370 BOOL InstallFonts(BOOL Copy);
00371 BOOL DeinstallFonts(BOOL Delete);
00372
00373
00374 BOOL InstallFont(PathName *FontFile, String_256 *Description, BOOL Temp);
00375 BOOL DeinstallFont(String_256 *FontDesc, BOOL Delete, LOGFONT *LogFnt = NULL);
00376
00377
00378 BOOL InstallTTFFont(PathName *FontFile, String_256 *Description, BOOL Temp);
00379 BOOL DeinstallTTFFont(String_256 *FontDesc, BOOL Delete);
00380
00381 static BOOL GetWindowsFontDirectory(String_256 *Result);
00382
00383 static UINT32 CALLBACK FileHook(HWND hDlg, UINT32 iMsg, UINT32 wParam, INT32 lParam);
00384
00385
00386 static INT32 GetDragFontOffset(KernelBitmap *Bmp);
00387
00388 public:
00389
00390
00391
00392 virtual BOOL CanCreateIndexes(void);
00393
00394
00395 virtual BOOL GetDefaults(String_256 *DefaultIndex, String_256 *IndexDesc, SGLibType *Type);
00396
00397
00398 virtual BOOL GetLibraryDirectoryName(String_256 *LibDirName);
00399
00400
00401 virtual BOOL CheckForIndexMatch(StringBase *Txt);
00402
00403
00404 virtual void WorkOutSectionName(String_256 *Section);
00405
00406
00407 virtual BOOL GetQuietStatus(void);
00408
00409
00410 virtual void SetQuietStatus(BOOL Status);
00411
00412
00413 virtual BOOL ScanForLocation(SGLibType Type, StringBase *Result);
00414
00415
00416 virtual SGLibType GetGalleryType() { return SGLib_Font;}
00417
00418 virtual String_256* GetDefaultLibraryPath() {return &DefaultLibraryPath;}
00419
00420 void SelectionHasChanged(void);
00421
00422 private:
00423
00424
00425 void DoShadeGallery(BOOL ShadeIt);
00426 BOOL InstalledFontsSelected(void);
00427 INT32 LibraryFontsSelected(void);
00428
00429
00430 static INT32 CALLBACK EnumInstalledFamily(ENUMLOGFONT FAR*lpelf, NEWTEXTMETRIC FAR* lpntm, INT32 FontType, LPARAM handle);
00431
00432
00433 static INT32 CALLBACK EnumInstalledFonts(ENUMLOGFONT FAR*lpelf, NEWTEXTMETRIC FAR* lpntm, INT32 FontType, LPARAM handle);
00434
00435
00436 virtual BOOL CanSearchKeywords(void);
00437
00438
00439 void SortInstalledFonts(void);
00440
00441 protected:
00442
00443
00444 virtual BOOL PreCreate(void);
00445
00446
00447 virtual BOOL ApplyAction(SGActionType Action);
00448
00449
00450 virtual SGDisplayItem *AddLibraryItem(SGDisplayGroup *LibraryGroup, Library *ParentLib,
00451 LibraryIndex ItemIndex, BOOL bNew = FALSE);
00452
00453
00454 BOOL GetFOTNameFromRegistry(String_256 *Desc, PathName *FOTFile);
00455
00456
00457 BOOL SetFOTNameInRegistry(String_256 *Desc, PathName *FOTFile);
00458
00459
00460 BOOL GetFontsKey(String_256 *Key);
00461
00462 void HandleDragStart(DragMessage *DragMsg);
00463
00464
00465 virtual SGDisplayGroup *AddLibraryGroup(Library *LibraryToDisplay, INT32 NumItems);
00466
00467
00468 SGDisplayItem *CopyDisplayItem(SGDisplayItem *SourceItem,
00469 SGDisplayGroup *DestGroup, SGDisplayItem *TargetPosition);
00470
00471
00472 virtual void AllItemsCopied(SGDisplayGroup *DestGroup);
00473
00474 virtual void ApplySortNow(BOOL ApplyToEntireList);
00475
00476 static BOOL UseWin95FontInstallMethod();
00477
00478 protected:
00479
00480
00481 void CreateNewSubtreeForInstalledFonts(SGFontsGroup *ExistingGroup = NULL);
00482
00483
00484 BOOL CreateNewSubtreeForLibraryFonts(PathName *LibPath, BOOL WipeOld = TRUE);
00485
00486
00487 public:
00488 virtual BOOL InitMenuCommands(void);
00489
00490
00491
00492 virtual BOOL BuildCommandMenu(GalleryContextMenu *TheMenu, SGMenuID MenuID);
00493
00494
00495 virtual OpState GetCommandState(StringBase *CommandID, String_256 *ShadeReason);
00496
00497
00498 virtual void DoCommand(StringBase *CommandID);
00499
00500
00501
00502 public:
00503
00504 static BOOL ApplyFont(BOOL Dropping, SGDisplayNode *TheNode, NodeRenderableInk* pObjectHit = NULL);
00505
00506
00507 static BOOL InstallDraggedLibFont(FontsSGallery *TheGallery, SGLibDisplayItem *FontItem, String_64 *Desc);
00508
00509
00510 static BOOL IsFontAlreadyInstalled(String_256 *FontDesc, FontClass Class = FC_UNDEFINED);
00511
00512
00513 static BOOL FindLogFont(String_256 *FontDesc, LOGFONT **lplplf, FontClass Class = FC_UNDEFINED);
00514
00515
00516 static void DoFontChange(void);
00517
00518
00519 static void MakeBoldItalicReadable(String_256 *Desc);
00520
00521 protected:
00522
00523
00524 void SortGallery(void);
00525
00526
00527 BOOL BrowseClicked(void);
00528
00529 public:
00530
00531
00532 static SGFontsGroup *InsGroup;
00533
00534 protected:
00535
00536
00537 UINT32 IDCount;
00538
00539
00540 static BOOL AddedFonts;
00541
00542
00543 static FontClass EnumFontClass;
00544
00545 public:
00546
00547 SGThumbs *InsCache;
00548
00549
00550 static FontsSGallery *ThisGallery;
00551
00552
00553 static String_256 DefaultLibraryPath;
00554
00555
00556 static BOOL DontUpdate;
00557
00558
00559 static INT32 DefaultDisplayMode;
00560
00561
00562 static UINT32 DefaultSortKeys;
00563
00564
00565 static BOOL DeleteTTFandFOTfiles;
00566
00567
00568 static String_256 LargeDisplayString;
00569
00570
00571 static BOOL QuietStatus;
00572
00573
00574 static BOOL WarnAboutSectionDragging;
00575
00576
00577 static BOOL WarnAboutMultipleATMDragging;
00578
00579 };
00580
00581
00582
00583
00584 #define OPTOKEN_DISPLAYFONTSGALLERY _T("DisplayFontsGallery")
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597 class CCAPI OpDisplayFontsGallery: public Operation
00598 {
00599 CC_DECLARE_DYNCREATE( OpDisplayFontsGallery );
00600
00601 public:
00602 static BOOL Init();
00603 static OpState GetState(String_256*, OpDescriptor*);
00604 void Do(OpDescriptor*);
00605 };
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619 class SGLibFontItem: public SGLibDisplayItem
00620 {
00621 CC_DECLARE_DYNAMIC( SGLibFontItem );
00622
00623 public:
00624
00625 SGLibFontItem();
00626 ~SGLibFontItem();
00627
00628 SGLibFontItem(LibraryIndex LibraryIndexToDisplay, BOOL bNew = FALSE);
00629
00630 LibDisplayType GetDisplayType(SGMiscInfo *MiscInfo);
00631
00632 INT32 GetTextWidth(SGFormatInfo *FormatInfo, SGMiscInfo *MiscInfo);
00633
00634 void GetNameText(String_256 *Result);
00635 void GetFullInfoText(String_256 *Result);
00636
00637 UINT32 GetFontID(void);
00638
00639 virtual BOOL HandleEvent(SGEventType EventType, void *EventInfo,
00640 SGMiscInfo *MiscInfo);
00641
00642 virtual BOOL GetNameTextPtr(TCHAR **Result);
00643
00644
00645 virtual void CalculateMyRect(SGFormatInfo *FormatInfo, SGMiscInfo *MiscInfo);
00646
00647
00648 virtual void HandleRedraw(SGRedrawInfo *RedrawInfo, SGMiscInfo *MiscInfo);
00649
00650
00651 FontClass GetType(void);
00652
00653
00654 virtual INT32 CompareTo(SGDisplayNode *Other, INT32 SortKey);
00655
00656 virtual BOOL GetThumbFileName(String_256* path);
00657
00658
00659 protected:
00660
00661 void MoveAfter(SGDisplayNode *NodeToMove);
00662
00663 void MoveBefore(SGDisplayNode *NodeToMove);
00664
00665 BOOL GetBubbleHelp(DocCoord *MousePos, String_256 *Result);
00666
00667 BOOL GetStatusLineHelp(DocCoord *MousePos, String_256 *Result);
00668 };
00669
00670 #endif
00671 #endif
00672