本文整理汇总了C++中BDirectory::FindEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ BDirectory::FindEntry方法的具体用法?C++ BDirectory::FindEntry怎么用?C++ BDirectory::FindEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BDirectory
的用法示例。
在下文中一共展示了BDirectory::FindEntry方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TaskToFile
status_t TaskFS::TaskToFile(Task *theTask, bool overwrite)
{
BFile taskFile;
BEntry entry;
status_t err;
TaskList *tskLst = theTask->GetTaskList();
BDirectory dir = BDirectory();
bool completed = theTask->IsCompleted();
uint32 priority = theTask->Priority();
time_t due = theTask->DueTime();
//first find directory.. then create files in this directory
if (tskLst!=NULL)
dir.SetTo(&tasksDir,tskLst->Name());
else
dir.SetTo(&tasksDir,".");
//first check if the File already exists..
//if not and overwrite is on check the ids..
// and search for the correspondending file...
if (dir.FindEntry(theTask->Title(),&entry) == B_OK) {
taskFile.SetTo((const BEntry*)&entry,B_READ_WRITE);
err = B_OK;
}
else {
entry_ref *ref= FileForId(theTask);
if (ref==NULL){
dir.CreateFile(theTask->Title(),&taskFile,overwrite);
dir.FindEntry(theTask->Title(),&entry);
}
else {
entry.SetTo(ref);
taskFile.SetTo((const BEntry*)ref,B_READ_WRITE);
}
}
if (taskFile.InitCheck() == B_OK){
taskFile.WriteAttr("META:completed",B_BOOL_TYPE, 0, &completed, sizeof(completed));
entry.Rename(theTask->Title());
taskFile.WriteAttrString("META:tasks",new BString(theTask->GetTaskList()->ID()));
taskFile.WriteAttrString("META:notes",new BString(theTask->Notes()));
taskFile.WriteAttr("META:priority", B_UINT32_TYPE, 0, &priority, sizeof(priority));
taskFile.WriteAttr("META:due", B_TIME_TYPE, 0, &due, sizeof(due));
taskFile.WriteAttrString("META:task_id", new BString(theTask->ID()));
taskFile.WriteAttrString("META:task_url",new BString(theTask->URL()));
}
else
err=B_ERROR;
return err;
}
示例2: OpenWorksheet
PDoc* PApp::OpenWorksheet()
{
try
{
if (!gPrefsDir.Contains("Worksheet", B_FILE_NODE | B_SYMLINK_NODE))
{
BFile file;
gPrefsDir.CreateFile("Worksheet", &file);
}
BEntry w;
entry_ref wr;
FailOSErr(gPrefsDir.FindEntry("Worksheet", &w, true));
FailOSErr(w.GetRef(&wr));
OpenWindow(wr);
PDoc *d = dynamic_cast<PDoc*>(CDoc::FindDoc(wr));
if (d)
d->MakeWorksheet();
return d;
}
catch (HErr& e)
{
e.DoError();
}
return NULL;
} /* PApp::OpenWorksheet */
示例3: target
void
PersonWindow::SaveAs()
{
char name[B_FILE_NAME_LENGTH];
_GetDefaultFileName(name);
if (fPanel == NULL) {
BMessenger target(this);
fPanel = new BFilePanel(B_SAVE_PANEL, &target);
BPath path;
find_directory(B_USER_DIRECTORY, &path, true);
BDirectory dir;
dir.SetTo(path.Path());
BEntry entry;
if (dir.FindEntry("people", &entry) == B_OK
|| (dir.CreateDirectory("people", &dir) == B_OK
&& dir.GetEntry(&entry) == B_OK)) {
fPanel->SetPanelDirectory(&entry);
}
}
if (fPanel->Window()->Lock()) {
fPanel->SetSaveText(name);
if (fPanel->Window()->IsHidden())
fPanel->Window()->Show();
else
fPanel->Window()->Activate();
fPanel->Window()->Unlock();
}
}
示例4: themepath
status_t
ThemeManager::LoadThemes()
{
FENTRY;
int dirwhich;
BPath path;
BDirectory dir;
entry_ref ref;
status_t err;
for (dirwhich = 0; dirwhich < 2; dirwhich++) {
if (!dirwhich) /* find system settings dir */
err = find_directory(B_BEOS_ETC_DIRECTORY, &path);
else /* find user settings dir */
err = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
if (err) return err;
err = dir.SetTo(path.Path());
if (err) return err;
BEntry ent;
if (dir.FindEntry(Z_THEMES_FOLDER_NAME, &ent) < B_OK) {
dir.CreateDirectory(Z_THEMES_FOLDER_NAME, NULL);
}
path.Append(Z_THEMES_FOLDER_NAME);
err = dir.SetTo(path.Path());
if (err) return err;
err = dir.Rewind();
if (err) return err;
while ((err = dir.GetNextRef(&ref)) == B_OK) {
BPath themepath(&ref);
BDirectory tdir(themepath.Path());
err = tdir.InitCheck();
if (err) /* not a dir */
continue;
err = LoadTheme(themepath.Path());
}
}
return B_OK;
}
示例5: target
void
PersonWindow::SaveAs(int32 format)
{
if (format == 0)
format = B_PERSON_FORMAT;
char name[B_FILE_NAME_LENGTH];
_GetDefaultFileName(name);
if (fPanel == NULL) {
BPath path;
BMessenger target(this);
BMessage msg(B_SAVE_REQUESTED);
msg.AddInt32("format", format);
fPanel = new BFilePanel(B_SAVE_PANEL, &target, NULL, 0, true, &msg);
find_directory(B_USER_DIRECTORY, &path, true);
BDirectory dir;
dir.SetTo(path.Path());
BEntry entry;
if (dir.FindEntry("people", &entry) == B_OK
|| (dir.CreateDirectory("people", &dir) == B_OK
&& dir.GetEntry(&entry) == B_OK)) {
fPanel->SetPanelDirectory(&entry);
}
}
if (fPanel->Window()->Lock()) {
fPanel->SetSaveText(name);
if (fPanel->Window()->IsHidden())
fPanel->Window()->Show();
else
fPanel->Window()->Activate();
fPanel->Window()->Unlock();
}
}
示例6: MessageReceived
/*! \brief Main function of the class.
* \param[in] in BMessage to respond to.
*/
void EventEditorMainWindow::MessageReceived( BMessage *in )
{
BView* view;
BEntry entry;
BFile file;
BString tempString;
BDirectory directory;
BMessage saveMessage( kSaveRequested );
entry_ref ref;
switch( in->what )
{
case B_SELECT_ALL:
case B_COPY:
case B_CUT:
case B_PASTE:
case B_UNDO:
view = CurrentFocus();
if ( view )
view->MessageReceived( in );
break;
case kFileOpen:
fOpenFile->Show();
break;
case kFileSaveAs:
fSaveFile->Show();
break;
case kFileRevert: // Intentional fall-through
case kFileOpenConfirmed:
if ( in->what == kFileRevert ) {
if ( fData.GetRef() != NULL )
{
// ...Prepare it for usage
ref = *( fData.GetRef() );
} else {
// Ask the user what to do
fOpenFile->Show();
break;
}
} else {
if ( B_OK != in->FindRef( "refs", &ref ) ||
B_OK != entry.SetTo( &ref, true ) ||
B_OK != entry.GetRef( &ref ) )
{
entry.Unset();
break;
}
}
fData.InitFromFile( ref );
if ( Looper()->Lock() ) {
// fData.Revert();
MainView->RemoveSelf();
delete MainView;
InitUI();
Looper()->Unlock();
}
entry.Unset();
break;
case kFileSave: // Intentional fall-through
case kFileSaveConfirmed:
// Save user's changes
if ( genView ) genView->MessageReceived( &saveMessage );
if ( remView ) remView->MessageReceived( &saveMessage );
if ( actView ) actView->SaveData();
if ( noteView ) noteView->SaveText();
fData.SetEventActivityFired( false );
fData.SetReminderActivityFired( false );
// If we have the reference to file...
if ( in->what == kFileSave ) {
if ( fData.GetRef() != NULL )
{
// ...Prepare it for usage
ref = *( fData.GetRef() );
} else {
// Ask the user what to do
fSaveFile->Show();
break;
}
} else {
if ( B_OK != in->FindRef( "directory", &ref ) ||
B_OK != in->FindString( "name", &tempString ) ||
B_OK != directory.SetTo( &ref ) ||
B_OK != directory.CreateFile( tempString.String(), NULL, false ) ||
B_OK != directory.FindEntry( tempString.String(), &entry, true ) ||
B_OK != entry.GetRef( &ref ) )
{
break;
}
//.........这里部分代码省略.........
示例7: close
void
TStatusWindow::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case STATUS:
break;
case OK:
{
if (!_Exists(fStatus->Text())) {
int32 index = 0;
uint32 loop;
status_t result;
BDirectory dir;
BEntry entry;
BFile file;
BNodeInfo* node;
BPath path;
find_directory(B_USER_SETTINGS_DIRECTORY, &path, true);
dir.SetTo(path.Path());
if (dir.FindEntry("Mail", &entry) == B_NO_ERROR)
dir.SetTo(&entry);
else
dir.CreateDirectory("Mail", &dir);
if (dir.InitCheck() != B_NO_ERROR)
goto err_exit;
if (dir.FindEntry("status", &entry) == B_NO_ERROR)
dir.SetTo(&entry);
else
dir.CreateDirectory("status", &dir);
if (dir.InitCheck() == B_NO_ERROR) {
char name[B_FILE_NAME_LENGTH];
char newName[B_FILE_NAME_LENGTH];
sprintf(name, "%s", fStatus->Text());
if (strlen(name) > B_FILE_NAME_LENGTH - 10)
name[B_FILE_NAME_LENGTH - 10] = 0;
for (loop = 0; loop < strlen(name); loop++) {
if (name[loop] == '/')
name[loop] = '\\';
}
strcpy(newName, name);
while (1) {
if ((result = dir.CreateFile(newName, &file, true)) == B_NO_ERROR)
break;
if (result != EEXIST)
goto err_exit;
sprintf(newName, "%s_%" B_PRId32, name, index++);
}
dir.FindEntry(newName, &entry);
node = new BNodeInfo(&file);
node->SetType("text/plain");
delete node;
file.Write(fStatus->Text(), strlen(fStatus->Text()) + 1);
file.SetSize(file.Position());
file.WriteAttr(INDEX_STATUS, B_STRING_TYPE, 0, fStatus->Text(),
strlen(fStatus->Text()) + 1);
}
}
err_exit:
{
BMessage close(M_CLOSE_CUSTOM);
close.AddString("status", fStatus->Text());
fTarget.SendMessage(&close);
// will fall through
}
}
case CANCEL:
Quit();
break;
}
}
示例8: BFile
void
TSignatureWindow::Save()
{
char name[B_FILE_NAME_LENGTH];
int32 index = 0;
status_t result;
BDirectory dir;
BEntry entry;
BNodeInfo *node;
BPath path;
if (!fFile) {
find_directory(B_USER_SETTINGS_DIRECTORY, &path, true);
dir.SetTo(path.Path());
if (dir.FindEntry("bemail", &entry) == B_NO_ERROR)
dir.SetTo(&entry);
else
dir.CreateDirectory("bemail", &dir);
if (dir.InitCheck() != B_NO_ERROR)
goto err_exit;
if (dir.FindEntry("signatures", &entry) == B_NO_ERROR)
dir.SetTo(&entry);
else
dir.CreateDirectory("signatures", &dir);
if (dir.InitCheck() != B_NO_ERROR)
goto err_exit;
fFile = new BFile();
while(true) {
sprintf(name, "signature_%ld", index++);
if ((result = dir.CreateFile(name, fFile, true)) == B_NO_ERROR)
break;
if (result != EEXIST)
goto err_exit;
}
dir.FindEntry(name, &fEntry);
node = new BNodeInfo(fFile);
node->SetType("text/plain");
delete node;
}
fSigView->fTextView->fDirty = false;
fFile->Seek(0, 0);
fFile->Write(fSigView->fTextView->Text(),
fSigView->fTextView->TextLength());
fFile->SetSize(fFile->Position());
fFile->WriteAttr(INDEX_SIGNATURE, B_STRING_TYPE, 0, fSigView->fName->Text(),
strlen(fSigView->fName->Text()) + 1);
return;
err_exit:
beep();
(new BAlert("", MDR_DIALECT_CHOICE (
"An error occurred trying to save this signature.",
"署名を保存しようとした時にエラーが発生しました。"),
MDR_DIALECT_CHOICE ("Sorry","了解")))->Go();
}
示例9: volume
void
PersonWindow::MessageReceived(BMessage* msg)
{
msg->PrintToStream();
char str[256];
BDirectory directory;
BEntry entry;
BFile file;
// BNodeInfo *node;
switch (msg->what) {
case M_SAVE:
if (!fRef) {
SaveAs();
break;
}
// supposed to fall through
case M_REVERT:
case M_SELECT:
fView->MessageReceived(msg);
break;
case M_SAVE_AS:
int32 format;
if (msg->FindInt32("format", &format) == B_OK)
SaveAs(format);
break;
case M_ADD_FIELD:
case M_SHOW_LOCATIONS:
case M_SHOW_GROUPS:
fView->MessageReceived(msg);
break;
case B_UNDO: // fall through
case B_CUT:
case B_COPY:
case B_PASTE:
{
BView* view = CurrentFocus();
if (view != NULL)
view->MessageReceived(msg);
break;
}
case B_SAVE_REQUESTED:
{
entry_ref dir;
if (msg->FindRef("directory", &dir) == B_OK) {
const char* name = NULL;
msg->FindString("name", &name);
directory.SetTo(&dir);
if (directory.InitCheck() == B_NO_ERROR) {
directory.CreateFile(name, &file);
if (file.InitCheck() == B_NO_ERROR) {
int32 format;
if (msg->FindInt32("format", &format) == B_OK) {
directory.FindEntry(name, &entry);
entry.GetRef(&dir);
_SetToRef(new entry_ref(dir));
SetTitle(fRef->name);
fView->CreateFile(fRef, format);
}
}
else {
sprintf(str, B_TRANSLATE("Could not create %s."), name);
(new BAlert("", str, B_TRANSLATE("Sorry")))->Go();
}
}
}
break;
}
case B_CONTACT_REMOVED:
// We lost our file. Close the window.
PostMessage(B_QUIT_REQUESTED);
break;
case B_CONTACT_MOVED:
{
// We may have renamed our entry. Obtain relevant data
// from message.
BString name;
msg->FindString("name", &name);
int64 directory;
msg->FindInt64("to directory", &directory);
int32 device;
msg->FindInt32("device", &device);
// Update our file
fRef = new entry_ref(device,
directory, name.String());
fWatcher->SetRef(fRef);
fView->Reload(fRef);
// And our window title.
SetTitle(name);
// If moved to Trash, close window.
//.........这里部分代码省略.........
示例10: MessageReceived
//.........这里部分代码省略.........
else
try
{
Window()->Lock();
theProxy->Import(curAcc, &entry);
Window()->Unlock();
}
catch (invalid_argument)
{
BAlert* alert = new BAlert("Import Warning",
"File Could not be Imported", "OK");
alert->Go();
}
delete[] type;
}
break;
case ExportMSG:
{
BDirectory directory;
BFile file;
BEntry entry;
entry_ref dir;
const char* name;
if (message->FindRef("directory", &dir) != B_OK)
break;
if (message->FindString("name", &name) != B_OK)
break;
directory.SetTo(&dir);
if (directory.InitCheck() == B_NO_ERROR)
{
directory.CreateFile(name, &file);
if (file.InitCheck() == B_NO_ERROR)
{
directory.FindEntry(name, &entry);
theProxy->Export(curAcc, &entry);
}
}
}
break;
case AccSetMSG:
case SettingsMSG:
{
AccSettingsWindow* asw = new AccSettingsWindow(curAcc, this, theProxy->GetPrefs());
asw->Show();
}
break;
case ManPyeMSG:
{
if (!pmw)
pmw = new PyeManagerWindow(this, theProxy);
pmw->Show();
}
break;
case ManCatMSG:
{
if (!cmw)
cmw = new CatManagerWindow(this, theProxy);
cmw->Show();
}
break;
case PyeManagerWindowExitMSG:
pmw = 0;
break;
case CatManagerWindowExitMSG:
cmw = 0;
break;
示例11: volume
void
PersonWindow::MessageReceived(BMessage* msg)
{
char str[256];
BDirectory directory;
BEntry entry;
BFile file;
BNodeInfo *node;
switch (msg->what) {
case M_SAVE:
if (!fRef) {
SaveAs();
break;
}
// supposed to fall through
case M_REVERT:
case M_SELECT:
fView->MessageReceived(msg);
break;
case M_SAVE_AS:
SaveAs();
break;
case B_UNDO: // fall through
case B_CUT:
case B_COPY:
case B_PASTE:
{
BView* view = CurrentFocus();
if (view != NULL)
view->MessageReceived(msg);
break;
}
case B_SAVE_REQUESTED:
{
entry_ref dir;
if (msg->FindRef("directory", &dir) == B_OK) {
const char* name = NULL;
msg->FindString("name", &name);
directory.SetTo(&dir);
if (directory.InitCheck() == B_NO_ERROR) {
directory.CreateFile(name, &file);
if (file.InitCheck() == B_NO_ERROR) {
node = new BNodeInfo(&file);
node->SetType("application/x-person");
delete node;
directory.FindEntry(name, &entry);
entry.GetRef(&dir);
_SetToRef(new entry_ref(dir));
SetTitle(fRef->name);
fView->CreateFile(fRef);
}
else {
sprintf(str, B_TRANSLATE("Could not create %s."), name);
BAlert* alert = new BAlert("", str, B_TRANSLATE("Sorry"));
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
}
}
}
break;
}
case B_NODE_MONITOR:
{
int32 opcode;
if (msg->FindInt32("opcode", &opcode) == B_OK) {
switch (opcode) {
case B_ENTRY_REMOVED:
// We lost our file. Close the window.
PostMessage(B_QUIT_REQUESTED);
break;
case B_ENTRY_MOVED:
{
// We may have renamed our entry. Obtain relevant data
// from message.
BString name;
msg->FindString("name", &name);
int64 directory;
msg->FindInt64("to directory", &directory);
int32 device;
msg->FindInt32("device", &device);
// Update our ref.
delete fRef;
fRef = new entry_ref(device, directory, name.String());
// And our window title.
SetTitle(name);
// If moved to Trash, close window.
BVolume volume(device);
BPath trash;
//.........这里部分代码省略.........
示例12: strerror
const char *DoInclude(MTextAddOn& ao, const char *incl, const char *start, const char *end)
{
status_t err = B_NO_ERROR;
do
{
BEntry e;
entry_ref ref;
if (ao.GetRef(ref) == B_OK)
{
BDirectory d;
if ((err = BEntry(&ref).GetParent(&d)) != B_OK) break;
if ((err = d.FindEntry(incl, &e, true)) != B_OK) break;
}
else
{
if ((err = get_ref_for_path(incl, &ref)) != B_OK) break;
if ((err = e.SetTo(&ref)) != B_OK) break;
}
int tStart, tEnd;
tStart = start - ao.Text();
tEnd = tStart + (end - start);
ao.Select(tStart, tEnd);
ao.Delete();
string str;
BFile file;
if ((err = file.SetTo(&e, B_READ_ONLY)) != B_OK) break;
size_t size = file.Seek(0, SEEK_END);
file.Seek(0, SEEK_SET);
char *t = (char *)malloc(size + 3);
if (t == NULL)
{
err = B_ERROR;
break;
}
file.Read(t + 1, size);
t[0] = '\n';
if (t[size] == '\n')
t[size + 1] = 0;
else
{
t[size + 1] = '\n';
t[size + 2] = 0;
}
const char *txtp = start, *txt = ao.Text();
char lws[256], *lw = lws;
while (--txtp >= txt && *txtp != '\n')
;
while (isspace(*++txtp))
*lw++ = *txtp;
*lw = 0;
str = t;
BPath p;
if ((err = e.GetPath(&p)) != B_OK) break;
ReplaceGlossary(str, p.Path(), lws);
ao.Insert(str.c_str());
end = ao.Text() + tStart + str.length();
}
while (false);
if (err)
{
char s[PATH_MAX];
sprintf(s, "Error including %s: %s", incl, strerror(err));
beep();
MWarningAlert(s).Go();
}
return end;
} /* DoInclude */
示例13: FindAndOpen
void PApp::FindAndOpen(const char *file, const char* fromSource)
{
char *bi = NULL;
bool found = false;
try
{
BEntry e;
entry_ref doc;
BDirectory d;
if (!found && fromSource)
{
BPath path;
entry_ref eref;
if (get_ref_for_path(fromSource, &eref) == B_OK) {
vector<BString> inclPathVect;
if (!ProjectRoster->GetIncludePathsForFile(&eref, inclPathVect))
ProjectRoster->GetAllIncludePaths(inclPathVect);
for(uint32 i=0; !found && i<inclPathVect.size(); ++i)
{
if (path.SetTo(inclPathVect[i].String(), file) != B_OK)
continue;
if (e.SetTo(path.Path(), true) != B_OK)
continue;
if (e.Exists() && e.IsFile()) {
FailOSErr(e.GetRef(&doc));
found = true;
}
}
}
}
if (!found && gPrefs->GetPrefInt(prf_I_BeIncludes))
{
bi = strdup(getenv("BEINCLUDES"));
char *ip = bi;
char *p = ip;
while (p && !found)
{
char *pe = strchr(p, ';');
if (pe) *pe = 0;
FailOSErr(d.SetTo(p));
if (d.Contains(file, B_FILE_NODE | B_SYMLINK_NODE))
{
FailOSErr(d.FindEntry(file, &e, true));
if (!e.IsFile()) THROW((0));
FailOSErr(e.GetRef(&doc));
found = true;
}
p = (pe && pe[1]) ? pe + 1 : NULL;
}
}
if (!found)
{
const char *p;
int i = 0;
while ((p = gPrefs->GetIxPrefString(prf_X_IncludePath, i++))!= NULL && !found)
{
if (e.SetTo(p) != B_OK || !e.Exists())
continue;
FailOSErr(d.SetTo(p));
if (d.Contains(file, B_FILE_NODE | B_SYMLINK_NODE))
{
FailOSErr(d.FindEntry(file, &e, true));
if (!e.IsFile()) THROW((0));
FailOSErr(e.GetRef(&doc));
found = true;
}
}
}
if (found)
OpenWindow(doc);
else
beep();
}
catch (HErr& e)
{
beep();
}
if (bi)
free(bi);
} // PApp::FindAndOpen
示例14: entry
PApp::PApp()
: BApplication("application/x-vnd.dw-PalEdit")
{
try
{
try
{
BPath settings;
FailOSErr(find_directory(B_USER_SETTINGS_DIRECTORY, &settings, true));
BDirectory e;
FailOSErrMsg(e.SetTo(settings.Path()), "~/config/settings directory not found ?!?!?");
if (!e.Contains("PalEdit", B_DIRECTORY_NODE))
FailOSErr(e.CreateDirectory("PalEdit", &gPrefsDir));
else
{
BEntry d;
FailOSErr(e.FindEntry("PalEdit", &d, B_DIRECTORY_NODE));
FailOSErr(gPrefsDir.SetTo(&d));
}
}
catch (HErr& e)
{
e.DoError();
}
gPrefs = new HPreferences("PalEdit/settings");
gPrefs->ReadPrefFile();
app_info ai;
GetAppInfo(&ai);
BEntry entry(&ai.ref);
FailOSErr(gAppFile.SetTo(&entry, B_READ_ONLY));
BPath appName;
FailOSErr(entry.GetPath(&appName));
BPath dir;
FailOSErr(appName.GetParent(&dir));
FailOSErr(gAppDir.SetTo(dir.Path()));
fOpenPanel = new BFilePanel();
FailNil(fOpenPanel);
entry_ref cwd_ref;
fOpenPanel->GetPanelDirectory(&cwd_ref);
FailOSErr(gCWD.SetTo(&cwd_ref));
PDoc::LoadAddOns();
InitUTFTables();
SetColor(kColorLow, prf_C_Low, 0xff, 0xff, 0xff);
SetColor(kColorText, prf_C_Text, 0x00, 0x00, 0x00);
SetColor(kColorSelection, prf_C_Selection, 0xd1, 0xd1, 0xff);
SetColor(kColorMark, prf_C_Mark, 0x00, 0x00, 0xff);
SetColor(kColorKeyword1, prf_C_Keyword1, 0x00, 0x00, 0xff);
SetColor(kColorKeyword2, prf_C_Keyword2, 0x00, 0x00, 0xff);
SetColor(kColorComment1, prf_C_Comment1, 0x1e, 0x93, 0x1e);
SetColor(kColorComment2, prf_C_Comment2, 0x1e, 0x93, 0x1e);
SetColor(kColorString1, prf_C_String1, 0x7e, 0x7e, 0x7e);
SetColor(kColorString2, prf_C_String2, 0x7e, 0x7e, 0x7e);
SetColor(kColorNumber1, prf_C_Number1, 0x85, 0x0a, 0x48);
SetColor(kColorNumber2, prf_C_Number2, 0x85, 0x0a, 0x48);
SetColor(kColorOperator1, prf_C_Operator1, 0x00, 0x00, 0x00);
SetColor(kColorOperator2, prf_C_Operator2, 0x00, 0x00, 0x00);
SetColor(kColorSeparator1, prf_C_Separator1, 0x00, 0x00, 0x00);
SetColor(kColorSeparator2, prf_C_Separator2, 0x00, 0x00, 0x00);
SetColor(kColorPreprocessor1, prf_C_Preprocessor1, 0x00, 0x00, 0xff);
SetColor(kColorPreprocessor2, prf_C_Preprocessor2, 0x00, 0x00, 0xff);
SetColor(kColorError1, prf_C_Error1, 0xff, 0x00, 0x00);
SetColor(kColorError2, prf_C_Error2, 0xff, 0x00, 0x00);
SetColor(kColorIdentifierSystem,prf_C_IdentifierSystem, 0x39, 0x79, 0x79);
SetColor(kColorCharConst, prf_C_CharConst, 0x7e, 0x7e, 0x7e);
SetColor(kColorIdentifierUser, prf_C_IdentifierUser, 0x00, 0x00, 0x00);
SetColor(kColorTag, prf_C_Tag, 0x88, 0x88, 0x88);
SetColor(kColorAttribute, prf_C_Attribute, 0xff, 0x00, 0x00);
SetColor(kColorUserSet1, prf_C_UserSet1, 0x00, 0x00, 0x00);
SetColor(kColorUserSet2, prf_C_UserSet2, 0x00, 0x00, 0x00);
SetColor(kColorUserSet3, prf_C_UserSet3, 0x00, 0x00, 0x00);
SetColor(kColorUserSet4, prf_C_UserSet4, 0x00, 0x00, 0x00);
SetColor(kColorInvisibles, prf_C_Invisibles, 0xC8, 0x64, 0x64);
DefineInvColors(gColor[kColorSelection]);
gAutoIndent = gPrefs->GetPrefInt(prf_I_AutoIndent, 1);
gSyntaxColoring = gPrefs->GetPrefInt(prf_I_SyntaxColoring, 1);
gSpacesPerTab = gPrefs->GetPrefInt(prf_I_SpacesPerTab, 4);
gBalance = gPrefs->GetPrefInt(prf_I_BalanceWhileTyping, 1);
gBlockCursor = gPrefs->GetPrefInt(prf_I_BlockCursor, 0);
gFlashCursor = gPrefs->GetPrefInt(prf_I_FlashCursor, 1);
gSmartBrace = gPrefs->GetPrefInt(prf_I_SmartBraces, 1);
gPopupIncludes = gPrefs->GetPrefInt(prf_I_ShowIncludes, 1);
gPopupProtos = gPrefs->GetPrefInt(prf_I_ShowPrototypes, 1);
gPopupFuncs = gPrefs->GetPrefInt(prf_I_ShowTypes, 1);
gPopupSorted = gPrefs->GetPrefInt(prf_I_SortPopup, 0);
gRedirectStdErr = gPrefs->GetPrefInt(prf_I_RedirectStdErr, 1);
gUseWorksheet = gPrefs->GetPrefInt(prf_I_Worksheet, 0);
//.........这里部分代码省略.........