示例#1
0
static void getXmlParseTree(StringBuffer & s, IMatchWalker * walker, unsigned indent)
{
    IAtom * name = walker->queryName();
    if (name != separatorTagAtom)
    {
        unsigned max = walker->numChildren();
        if (!name)
        {
            if (hasChildren(walker))
            {
                for (unsigned i=0; i<max; i++)
                {
                    Owned<IMatchWalker> child = walker->getChild(i);
                    getXmlParseTree(s, child, indent);
                }
            }
            else
                getElementText(s, walker);
        }
        else
        {
            StringBuffer lname;
            lname.append(name);
            lname.toLowerCase();
            s.pad(indent).append('<').append(lname).append('>');
            if (hasChildren(walker))
            {
                s.newline();
                for (unsigned i=0; i<max; i++)
                {
                    Owned<IMatchWalker> child = walker->getChild(i);
                    getXmlParseTree(s, child, indent+1);
                }
                s.pad(indent);
            }
            else
                getElementText(s, walker);
            s.append("</").append(lname).append('>').newline();
        }
    }
}
示例#2
0
void Theme::setThemeElementTextwithSub(std::string filename,std::string element,std::string subelement,std::string SUBsubelement){
	debug_out("void setThemeElementTextwithSub(std::string "+filename+",std::string "+element+",std::string "+subelement+",std::string "+SUBsubelement+")");
	if(!load(filename,false)){return;}
	std::string temp=getElementText(element,subelement,SUBsubelement);
	if(temp.compare("")==0){
		errorOUT("Did NOT get Button from "+filename);
		return;
	}
	if(!load())debug_out("LOADING base document FAILED");
	if(!setElementText(element,subelement,SUBsubelement,temp)){errorOUT("FAILED setting "+element+" with "+temp+" in the main DOC");}
	else{saveNoRestart();}
}
示例#3
0
std::string Theme::getButton(std::string element,std::string themefile){
	debug_out("std::string getButton(std::string "+element+")");
	if(!load(themefile,false)){return "";}
	std::string filename=getElementText(element);
	if(linuxcommon::test_file(filename)){
		debug_out(filename+" is a file");
		return filename;
	}
	debug_out(filename+" is NOT a file still going to try to make it happen...");
	if(!load(themefile,false)){return "";}
	std::vector<std::string> icon_paths=IconPaths();
	return linuxcommon::test_file_in_vector_path(filename,icon_paths);
}
示例#4
0
const char* ConfigXml::getVersion()
{
    return getElementText(getElement("version"));
}
示例#5
0
static void expandElementText(StringBuffer & s, IMatchWalker * walker)
{
    getElementText(s.append('"'), walker).append('"');
}
示例#6
0
void Theme::updateTheme( Fl_Browser *o,
					Fl_Box * button,
					Fl_Box * button_icon,
					Fl_Box *tray,
					Fl_Box *activeW,
					Fl_Box *activeW2,
					Fl_Box *activeW_text,
					Fl_Box *inactiveW,
					Fl_Box *inactiveW2,
					Fl_Box *inactiveW_text,
					Fl_Box *active_min_button,
					Fl_Box *active_max_button,
					Fl_Box *active_close_button,
					Fl_Box *inactive_min_button,
					Fl_Box *inactive_max_button,
					Fl_Box *inactive_close_button,
					std::string filename,
					bool user){
	debug_out("void updateTheme(..."+filename+"...)");
	if(linuxcommon::test_dir(filename)){
		o->clear();
		populateANYThemes(o,filename,true);
		return;
	}
	const char* notNULL=o->text(o->value());
	if(notNULL!=NULL){
		std::string tempitem=notNULL;
		if(tempitem.compare("..")==0){
			//
			o->clear();
			if(user){populateUserThemes(o);}
			else{populateThemes(o);}
		}
	}
	/** Window buttons */
    std::string maxButton = getButton("ButtonMax",filename);
    std::string minButton = getButton("ButtonMin",filename);
    std::string closeButton = getButton("ButtonClose",filename);
	std::string WindowStyle="WindowStyle";
	std::string TrayStyle="TrayStyle";
	//debug_out("*************************************************\nMin="+minButton+"\nMax="+maxButton+"\nClose="+closeButton+"\n*************************************************\n");
    /**These should never be empty, unless it is NOT a file, or the tags do not exist*/
    if(minButton.compare("")!=0){
        if(!load(filename,false)){return;}
        makeWidgetIcon(minButton,active_min_button,25);
        active_min_button->redraw();
        if(!load(filename,false)){return;}
        makeWidgetIcon(minButton,inactive_min_button,25);
        inactive_min_button->redraw();
    }
    if(maxButton.compare("")!=0){
		if(!load(filename,false)){return;}
        makeWidgetIcon(maxButton,active_max_button,25);
        active_max_button->redraw();
        if(!load(filename,false)){return;}
        makeWidgetIcon(maxButton,inactive_max_button,25);
        inactive_max_button->redraw();
    }
    if(closeButton.compare("")!=0){
		if(!load(filename,false)){return;}
        makeWidgetIcon(closeButton,active_close_button,25);
        active_close_button->redraw();
        if(!load(filename,false)){return;}
        makeWidgetIcon(closeButton,inactive_close_button,25);
        inactive_close_button->redraw();
    }
/** Window styles */
    unsigned int active_color2=0;
    unsigned int activeWindowColorText = 0;
    unsigned int activeWindowColor = 0;
    std::string activeWC;
	std::string activeWCT;
	if(!load(filename,false)){return;}
    activeWC = getElementText(WindowStyle,"Active","Background");
    if(activeWC.compare("")==0){
		if(!load(filename,false)){return;}
		activeWC = getElementText(WindowStyle,"Active","Title");
	}
    if(!load(filename,false)){return;}
	activeWCT = getElementText(WindowStyle,"Active","Foreground");
	if(activeWCT.compare("")==0){
		if(!load(filename,false)){return;}
		activeWCT = getElementText(WindowStyle,"Active","Text");
	}
    /** modify the UI if needed */
    if(activeWC.compare("")!=0){
		activeWindowColor = flCOLOR(activeWC,active_color2);
		activeW->color(activeWindowColor);
		activeW2->color(active_color2);
		activeW->redraw();
		activeW2->redraw();
	}
	if(activeWCT.compare("")!=0){
		activeWindowColorText=flCOLOR(activeWCT);
		activeW_text->labelcolor(activeWindowColorText);
		activeW_text->redraw();
	}
    unsigned int inactive_color2=0;
    unsigned int windowColor = 0;
    unsigned int windowColorText = 0;
    if(!load(filename,false)){return;}
    std::string WC=getElementText(WindowStyle,"Background");
    if(WC.compare("")==0){
		if(!load(filename,false)){return;}
		WC=getElementText(WindowStyle,"Title");
	}
    if(!load(filename,false)){return;}
    std::string WCT=getElementText(WindowStyle,"Foreground");
    if(WCT.compare("")==0){
		if(!load(filename,false)){return;}
		WCT=getElementText(WindowStyle,"Text");
	}
    /** modify the UI if needed */
    if(WC.compare("")!=0){
		windowColor=flCOLOR(WC,inactive_color2);
		inactiveW->color(windowColor);
		inactiveW2->color(inactive_color2);
		inactiveW->redraw();
		inactiveW2->redraw();
	}
	if(WCT.compare("")!=0){
		windowColorText = flCOLOR(WCT);
		inactiveW_text->labelcolor(windowColorText);
		inactiveW_text->redraw();
	}
/** Panel */
	if(!load(filename,false)){return;}
    std::string label =getElementAttribute("Tray","TrayButton","label");
    unsigned int panelColor = 0;
    if(!load(filename,false)){return;}
    std::string PC = getElementText(TrayStyle,"Background");
    /** modify the UI if needed */
    if(PC.compare("")!=0){
		panelColor = flCOLOR(PC);
		tray->color(panelColor);
	}
    unsigned int panelColorText = 0;
    if(!load(filename,false)){return;}
    std::string PCT = getElementText(TrayStyle,"Foreground");
    if(PCT.compare("")!=0){
		panelColorText = flCOLOR(PCT);
		tray->labelcolor(panelColorText);
	}
    debug_out("LABEL: "+label+"\npanelColor: "+PC+"\npanelColorText: "+PCT);
	tray->redraw();
    //panel Button */
    unsigned int panelButtonColorText=panelColorText;
    unsigned int panelButtonColor=panelColor;
    
    /** New version */
    if(themeNewStyle(filename)<1){
		if(!load(filename,false)){return;}
		std::string tmp=getElementText("TrayButtonStyle","Background");
		if(tmp.compare("")!=0)
			panelButtonColor = flCOLOR(tmp);
		if(!load(filename,false)){return;}
		tmp = getElementText("TrayButtonStyle","Foreground");
		if(tmp.compare("")!=0)
			panelButtonColorText = flCOLOR(tmp);
    }/**END Dont do this IF new version*/
    else{
        panelButtonColor=panelColor;
        panelButtonColorText = panelColorText;
    }
    if(label.compare("")!=0)
		button->copy_label(label.c_str());
	
    button->color(panelButtonColor);
    button->labelcolor(panelButtonColorText);
    button_icon->color(panelButtonColor);
    if(!load(filename,false)){return;}
    std::string icon_file = getPanelButtonIcon();
    makeWidgetIcon(icon_file,button_icon,30);
    button->redraw();
    button_icon->redraw();
}