Made scanning of all font folders a compile-time option

Moved the scanning of individual font folders to FontServer
Implemented server-side code for update_font_families
Removed ClientFontList from the build


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13938 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2005-08-12 14:55:46 +00:00
parent 4b9ec73e99
commit d863d4bf1d
5 changed files with 45 additions and 26 deletions

View File

@ -39,6 +39,7 @@ public:
int32 CountFamilies(void);
int32 CountStyles(const char *family);
void RemoveFamily(const char *family);
void ScanSystemFolders(void);
status_t ScanDirectory(const char *path);
void SaveList(void);

View File

@ -34,7 +34,6 @@ MergeObject <libbe>interface_kit.o :
ChannelControl.cpp
ChannelSlider.cpp
CheckBox.cpp
ClientFontList.cpp
ColorUtils.cc
ColorControl.cpp
Control.cpp

View File

@ -100,14 +100,7 @@ AppServer::AppServer()
// Create the font server and scan the proper directories.
gFontServer = new FontServer;
gFontServer->Lock();
// Used for testing purposes
// TODO: Re-enable scanning of all font directories when server is actually put to use
gFontServer->ScanDirectory("/boot/beos/etc/fonts/ttfonts/");
// gFontServer->ScanDirectory("/boot/beos/etc/fonts/PS-Type1/");
// gFontServer->ScanDirectory("/boot/home/config/fonts/ttfonts/");
// gFontServer->ScanDirectory("/boot/home/config/fonts/psfonts/");
gFontServer->ScanSystemFolders();
gFontServer->SaveList();
if (!gFontServer->SetSystemPlain(DEFAULT_PLAIN_FONT_FAMILY,
@ -327,14 +320,6 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
break;
}
case AS_UPDATED_CLIENT_FONTLIST:
// received when the client-side global font list has been
// refreshed
gFontServer->Lock();
gFontServer->FontsUpdated();
gFontServer->Unlock();
break;
case AS_QUERY_FONTS_CHANGED:
{
// Client application is asking if the font list has changed since

View File

@ -181,6 +181,19 @@ FontServer::GetFamily(const char* name) const
return NULL;
}
//! Scans the four default system font folders
void
FontServer::ScanSystemFolders(void)
{
ScanDirectory("/boot/beos/etc/fonts/ttfonts/");
// We don't scan these in test mode to help shave off some startup time
#if !TEST_MODE
ScanDirectory("/boot/beos/etc/fonts/PS-Type1/");
ScanDirectory("/boot/home/config/fonts/ttfonts/");
ScanDirectory("/boot/home/config/fonts/psfonts/");
#endif
}
/*!
\brief Scan a folder for all valid fonts

View File

@ -1200,17 +1200,38 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
}
case AS_QUERY_FONTS_CHANGED:
{
FTRACE(("ServerApp %s: AS_QUERY_FONTS_CHANGED unimplemented\n",
Signature()));
FTRACE(("ServerApp %s: AS_QUERY_FONTS_CHANGED\n",Signature()));
// Attached Data:
// 1) bool check flag
// if just checking, just give an answer,
// if not and needs updated,
// sync the font list and return true else return false
// TODO: actually do the above...
fLink.StartMessage(SERVER_FALSE);
fLink.Flush();
bool checkonly;
link.Read<bool>(&checkonly);
gFontServer->Lock();
bool needsUpdate = gFontServer->FontsNeedUpdated();
gFontServer->Unlock();
if(checkonly)
{
fLink.StartMessage(needsUpdate ? SERVER_TRUE : SERVER_FALSE);
fLink.Flush();
}
else
{
if(needsUpdate)
{
gFontServer->Lock();
gFontServer->ScanSystemFolders();
gFontServer->Unlock();
fLink.StartMessage(SERVER_TRUE);
fLink.Flush();
}
else
{
fLink.StartMessage(SERVER_FALSE);
fLink.Flush();
}
}
break;
}
case AS_GET_FAMILY_NAME: