예제 #1
0
void
ActivityView::_LoadBackgroundInfo(bool watch)
{
	fCachedOutline = false;
	fCachedWorkspace = -1;
	BPath path;
	if (find_directory(B_DESKTOP_DIRECTORY, &path) == B_OK) {
		BNode desktopNode = BNode(path.Path());

		attr_info info;
		if (desktopNode.GetAttrInfo(kDesktopAttrName, &info) != B_OK)
			return;

		char* buffer = new char[info.size];
		if (desktopNode.ReadAttr(kDesktopAttrName, B_MESSAGE_TYPE, 0,
			buffer, (size_t)info.size) == info.size) {
				BMessage message;
				if (message.Unflatten(buffer) == B_OK)
					fBackgroundInfo = message;
		}
		delete[] buffer;

		if (watch) {
			node_ref nref;
			desktopNode.GetNodeRef(&nref);
			watch_node(&nref, B_WATCH_ATTR, this);
		}
	}
}
예제 #2
0
파일: Node.cpp 프로젝트: mmanley/Antares
/*!	Tests whether this and the supplied BNode object are equal.
	Two BNode objects are said to be equal if they're set to the same node,
	or if they're both \c B_NO_INIT.
	\param node the BNode to be compared with
	\return \c true, if the BNode objects are equal, \c false otherwise
*/
bool
BNode::operator==(const BNode &node) const
{
	if (fCStatus == B_NO_INIT && node.InitCheck() == B_NO_INIT)
		return true;		
	if (fCStatus == B_OK && node.InitCheck() == B_OK) {
		// compare the node_refs
		node_ref ref1, ref2;
		if (GetNodeRef(&ref1) != B_OK)
			return false;
		if (node.GetNodeRef(&ref2) != B_OK)
			return false;
		return (ref1 == ref2);
	}	
	return false;	
}
void PanelView::RescanForNewEntries()
////////////////////////////////////////////////////////////////////////
{
	BDirectory dir(m_Path.String());
	BNode node;
	node_ref noderef;

	if (dir.InitCheck()==B_OK)
	{
		BEntry entry;
		
		if (dir.GetEntry(&entry)==B_OK)
		{
			while (dir.GetNextEntry(&entry)==B_OK)
			{
				node.SetTo(&entry);	
				node.GetNodeRef(&noderef);				
				if (m_CustomListView->FindItemByNodeRef(noderef)==NULL)
					AddDirectoryEntry(&entry);
			}
		}
	}
}
예제 #4
0
// ---------------------------------------------------------------------------- RHTML_Options - RHTMLOptions -
RHTMLOptions::RHTMLOptions()
{
 fOptions=this;
 
 Name= new BString("Globe");
 Ver = new BString("0.4.0");
 Date= new BString("2004.10.21");
 DefaultFont= new BFont(be_plain_font);

 SettingsDir = "/boot/home/config/settings/Globe/";
// - Locale - English (Default)
 LocaleDb=0;
 CurrentLocale=0;
 Locale= (locale**) calloc(LocaleDb,sizeof(locale));
 AddLocale("English","RoGer","*****@*****.**");
/*
 BString dir = SettingsDir;
 dir << "languages/languages.rdat";

 dir << "languages/languages.rdat";
 FILE *f;
 if( (f = fopen(dir.String(),"rt")) == NULL); else
 {
  int i=0;
  char tmp[100];
  while (feof(f)==false) 
  {
   tmp[0]=0;
   char ch=0;
   i=0;
   while ((ch!='\n')&&(!feof(f)))
   {
    fscanf(f,"%c",&ch);
    tmp[i]=ch;
    i++;
    tmp[i]=0;
   }
   tmp[i-1]=0;
   if (tmp!="")
   {
    LoadLocale(tmp);
   }
  }
 }*/

 BString path = SettingsDir;
 path << "languages";
	BDirectory dir(path.String());
	BNode node;
	node_ref noderef;

	if (dir.InitCheck()==B_OK)
	{
		BEntry entry;
		
		if (dir.GetEntry(&entry)==B_OK)
		{
			while (dir.GetNextEntry(&entry)==B_OK)
			{
				node.SetTo(&entry);	
				node.GetNodeRef(&noderef);				
				char *buffer = new char[255];
				entry.GetName(buffer);
				entry.GetName(buffer);
				LoadLocale(buffer);
					
//					AddDirectoryEntry(&entry);
			}
		}
	}


 

// - FileTypes
 FileTypesDb=3;
 FileTypes = (filetype**) calloc(FileTypesDb,sizeof(filetype));

// - FileTypes - SIMPLE TEXT
 FileTypes[0] = new filetype;
 FileTypes[0]->Name= new BString("TEXT");
 FileTypes[0]->KitDb=0;
 FileTypes[0]->Kit = (BString**) calloc(FileTypes[0]->KitDb,sizeof(BString));
 FileTypes[0]->FontColorDb=1;
 FileTypes[0]->FCName = (BString**) calloc(FileTypes[0]->FontColorDb,sizeof(BString));
 FileTypes[0]->Font = (rfont**) calloc(FileTypes[0]->FontColorDb,sizeof(rfont));
 FileTypes[0]->Color = (rgb_color**) calloc(FileTypes[0]->FontColorDb,sizeof(rgb_color));
 FileTypes[0]->FCName[0]= new BString("Text");
 font_family family;
 font_style style;
 float size;
 be_plain_font->GetFamilyAndStyle(&family,&style);
 size=be_plain_font->Size();
 FileTypes[0]->Font[0]= new rfont;
 FileTypes[0]->Font[0]->Family.SetTo("Default font");
 FileTypes[0]->Font[0]->Style.SetTo("Default style");
 FileTypes[0]->Font[0]->Size=-1;

 FileTypes[0]->Color[0]= new rgb_color;
 FileTypes[0]->Color[0]->red=0;
 FileTypes[0]->Color[0]->green=0;
 FileTypes[0]->Color[0]->blue=0;

// - FileTypes - HTML
 FileTypes[1] = new filetype;
 FileTypes[1]->Name= new BString("HTML");
 FileTypes[1]->KitDb=2;
 FileTypes[1]->Kit = (BString**) calloc(FileTypes[1]->KitDb,sizeof(BString));
 FileTypes[1]->Kit[0]= new BString("html");
 FileTypes[1]->Kit[1]= new BString("htm");
 FileTypes[1]->FontColorDb=5;
 FileTypes[1]->FCName = (BString**) calloc(FileTypes[1]->FontColorDb,sizeof(BString));
 FileTypes[1]->Font = (rfont**) calloc(FileTypes[1]->FontColorDb,sizeof(rfont));
 FileTypes[1]->Color = (rgb_color**) calloc(FileTypes[1]->FontColorDb,sizeof(rgb_color));
 FileTypes[1]->FCName[0]= new BString("Text");
 FileTypes[1]->FCName[1]= new BString("Comment");
 FileTypes[1]->FCName[2]= new BString("Parameter");
 FileTypes[1]->FCName[3]= new BString("Tag");
 FileTypes[1]->FCName[4]= new BString("Value");
 be_plain_font->GetFamilyAndStyle(&family,&style);
 size=be_plain_font->Size();
 FileTypes[1]->Font[0]= new rfont;
 FileTypes[1]->Font[1]= new rfont;
 FileTypes[1]->Font[2]= new rfont;
 FileTypes[1]->Font[3]= new rfont;
 FileTypes[1]->Font[4]= new rfont;
 FileTypes[1]->Font[0]->Family.SetTo("Default font");
 FileTypes[1]->Font[1]->Family.SetTo("Default font");
 FileTypes[1]->Font[2]->Family.SetTo("Default font");
 FileTypes[1]->Font[3]->Family.SetTo("Default font");
 FileTypes[1]->Font[4]->Family.SetTo("Default font");
 FileTypes[1]->Font[0]->Style.SetTo("Default style");
 FileTypes[1]->Font[1]->Style.SetTo("Default style");
 FileTypes[1]->Font[2]->Style.SetTo("Default style");
 FileTypes[1]->Font[3]->Style.SetTo("Default style");
 FileTypes[1]->Font[4]->Style.SetTo("Default style");
 FileTypes[1]->Font[0]->Size=-1;
 FileTypes[1]->Font[1]->Size=-1;
 FileTypes[1]->Font[2]->Size=-1;
 FileTypes[1]->Font[3]->Size=-1;
 FileTypes[1]->Font[4]->Size=-1;

 FileTypes[1]->Color[0]= new rgb_color;
 FileTypes[1]->Color[1]= new rgb_color;
 FileTypes[1]->Color[2]= new rgb_color;
 FileTypes[1]->Color[3]= new rgb_color;
 FileTypes[1]->Color[4]= new rgb_color;
 FileTypes[1]->Color[0]->red=0;
 FileTypes[1]->Color[0]->green=0;
 FileTypes[1]->Color[0]->blue=0;
 FileTypes[1]->Color[1]->red=255;
 FileTypes[1]->Color[1]->green=0;
 FileTypes[1]->Color[1]->blue=0;
 FileTypes[1]->Color[2]->red=0;
 FileTypes[1]->Color[2]->green=0;
 FileTypes[1]->Color[2]->blue=255;
 FileTypes[1]->Color[3]->red=0;
 FileTypes[1]->Color[3]->green=128;
 FileTypes[1]->Color[3]->blue=0;
 FileTypes[1]->Color[4]->red=128;
 FileTypes[1]->Color[4]->green=128;
 FileTypes[1]->Color[4]->blue=128;

// - DEVELOPMENT
 FileTypes[2] = new filetype;
 FileTypes[2]->Name= new BString("PHP (Dev.)");
 FileTypes[2]->KitDb=2;
 FileTypes[2]->Kit = (BString**) calloc(FileTypes[2]->KitDb,sizeof(BString));
 FileTypes[2]->Kit[0]= new BString("php");
 FileTypes[2]->Kit[1]= new BString("php3");
 FileTypes[2]->FontColorDb=6;
 FileTypes[2]->FCName = (BString**) calloc(FileTypes[2]->FontColorDb,sizeof(BString));
 FileTypes[2]->Font = (rfont**) calloc(FileTypes[2]->FontColorDb,sizeof(rfont));
 FileTypes[2]->Color = (rgb_color**) calloc(FileTypes[2]->FontColorDb,sizeof(rgb_color));
 FileTypes[2]->FCName[0]= new BString("Text");
 FileTypes[2]->FCName[1]= new BString("Comment");
 FileTypes[2]->FCName[2]= new BString("Parameter");
 FileTypes[2]->FCName[3]= new BString("Tag");
 FileTypes[2]->FCName[4]= new BString("Value");
 FileTypes[2]->FCName[5]= new BString("PHP");
 FileTypes[2]->Font[0]= new rfont;
 FileTypes[2]->Font[1]= new rfont;
 FileTypes[2]->Font[2]= new rfont;
 FileTypes[2]->Font[3]= new rfont;
 FileTypes[2]->Font[4]= new rfont;
 FileTypes[2]->Font[5]= new rfont;
 FileTypes[2]->Font[0]->Family.SetTo((const char*) family);
 FileTypes[2]->Font[1]->Family.SetTo((const char*) family);
 FileTypes[2]->Font[2]->Family.SetTo((const char*) family);
 FileTypes[2]->Font[3]->Family.SetTo((const char*) family);
 FileTypes[2]->Font[4]->Family.SetTo((const char*) family);
 FileTypes[2]->Font[5]->Family.SetTo((const char*) family);
 FileTypes[2]->Font[0]->Style.SetTo((const char*) style);
 FileTypes[2]->Font[1]->Style.SetTo((const char*) style);
 FileTypes[2]->Font[2]->Style.SetTo((const char*) style);
 FileTypes[2]->Font[3]->Style.SetTo((const char*) style);
 FileTypes[2]->Font[4]->Style.SetTo((const char*) style);
 FileTypes[2]->Font[5]->Style.SetTo((const char*) style);
 FileTypes[2]->Font[0]->Size=size;
 FileTypes[2]->Font[1]->Size=size;
 FileTypes[2]->Font[2]->Size=size;
 FileTypes[2]->Font[3]->Size=size;
 FileTypes[2]->Font[4]->Size=size;
 FileTypes[2]->Font[5]->Size=size;
 FileTypes[2]->Color[0]= new rgb_color;
 FileTypes[2]->Color[1]= new rgb_color;
 FileTypes[2]->Color[2]= new rgb_color;
 FileTypes[2]->Color[3]= new rgb_color;
 FileTypes[2]->Color[4]= new rgb_color;
 FileTypes[2]->Color[5]= new rgb_color;
 FileTypes[2]->Color[0]->red=0;
 FileTypes[2]->Color[0]->green=0;
 FileTypes[2]->Color[0]->blue=0;
 FileTypes[2]->Color[1]->red=255;
 FileTypes[2]->Color[1]->green=0;
 FileTypes[2]->Color[1]->blue=0;
 FileTypes[2]->Color[2]->red=0;
 FileTypes[2]->Color[2]->green=0;
 FileTypes[2]->Color[2]->blue=255;
 FileTypes[2]->Color[3]->red=0;
 FileTypes[2]->Color[3]->green=128;
 FileTypes[2]->Color[3]->blue=0;
 FileTypes[2]->Color[4]->red=128;
 FileTypes[2]->Color[4]->green=128;
 FileTypes[2]->Color[4]->blue=128;
 FileTypes[2]->Color[5]->red=255;
 FileTypes[2]->Color[5]->green=128;
 FileTypes[2]->Color[5]->blue=0;
// - END DEVELOPMENT

// - CR_LF
 CRLF_LF=true;
 LF_CRLF=false;

// - Encoding
 Encoding=B_UTF8_CONVERSION;

// - Views
 LeftView=false;
 TopView=true;
 NumView=true;
 WordWrap=true;
 LeftViewOrient=B_LEFT;
 TopViewOrient=B_TOP;
 BottomViewOrient=B_BOTTOM;
 LeftViewWidth=150;
 TopViewIndex=0;
 BottomViewIndex=0;
// - Search
 IgnoreCase=true;
// - Default Folder
 DefaultFolder.SetTo("/boot/home");
 DFOnlyStart=true;
// - Reakcio
 ReakcioIdo = 300;
 ReakcioIdoTM = 1000;
// - Window Frame
 WinFrameLeft = 40;
 WinFrameTop = 60;
 WinFrameRight = 780;
 WinFrameBottom = 580;
// - Load
 Load();
}