Synced with edelib changes

This commit is contained in:
Sanel Zukan
2007-08-21 12:17:35 +00:00
parent d6162aa666
commit e46547e8ef
2 changed files with 26 additions and 16 deletions

View File

@@ -74,19 +74,26 @@ void ControlWin::load_icons(void) {
return; return;
} }
vector<String> spl; list<String> spl;
list<String>::iterator it, it_end;
stringtok(spl, buff, ","); stringtok(spl, buff, ",");
char* sect;
if(spl.empty())
return;
const char* sect;
ControlIcon cicon; ControlIcon cicon;
for(unsigned int i = 0; i < spl.size(); i++) { it = spl.begin();
sect = (char*)spl[i].c_str(); it_end = spl.end();
str_trim(sect);
for(; it != it_end; ++it) {
sect = (*it).c_str();
str_trim((char*)sect);
if(c.get(sect, "Name", buff, sizeof(buff))) if(c.get(sect, "Name", buff, sizeof(buff)))
cicon.name = buff; cicon.name = buff;
else { else {
EWARNING("No %s, skipping...\n", spl[i].c_str()); EWARNING("No %s, skipping...\n", sect);
continue; continue;
} }
@@ -96,12 +103,12 @@ void ControlWin::load_icons(void) {
cicon.exec = buff; cicon.exec = buff;
if(c.get(sect, "Icon", buff, sizeof(buff))) { if(c.get(sect, "Icon", buff, sizeof(buff))) {
cicon.icon = buff; cicon.icon = buff;
EDEBUG("setting icon (%s): %s\n", spl[i].c_str(), cicon.icon.c_str()); EDEBUG("setting icon (%s): %s\n", sect, cicon.icon.c_str());
} }
c.get(spl[i].c_str(), "IconPathAbsolute", cicon.abspath, false); c.get(sect, "IconPathAbsolute", cicon.abspath, false);
c.get(spl[i].c_str(), "Position", cicon.abspath, -1); c.get(sect, "Position", cicon.abspath, -1);
iconlist.push_back(cicon); iconlist.push_back(cicon);
} }
} }
@@ -130,11 +137,14 @@ void ControlWin::init(void) {
tipbox->box(FL_FLAT_BOX); tipbox->box(FL_FLAT_BOX);
tipbox->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); tipbox->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
for(unsigned int i = 0; i < iconlist.size(); i++) { list<ControlIcon>::iterator it, it_end;
ControlButton* b = new ControlButton(tipbox, iconlist[i].tip, 0, 0, 80, 100); it = iconlist.begin();
//String iconpath = IconTheme::get(iconlist[i].icon.c_str(), ICON_SIZE_MEDIUM); it_end = iconlist.end();
String iconpath = IconTheme::get(iconlist[i].icon.c_str(), ICON_SIZE_LARGE);
b->label(iconlist[i].name.c_str()); for(; it != it_end; ++it) {
ControlButton* b = new ControlButton(tipbox, (*it).tip, 0, 0, 80, 100);
String iconpath = IconTheme::get((*it).icon.c_str(), ICON_SIZE_LARGE);
b->label((*it).name.c_str());
if(!iconpath.empty()) if(!iconpath.empty())
b->image(Fl_Shared_Image::get(iconpath.c_str())); b->image(Fl_Shared_Image::get(iconpath.c_str()));

View File

@@ -38,7 +38,7 @@ class ControlWin : public Fl_Window {
Fl_Box* rbox; Fl_Box* rbox;
Fl_Box* tipbox; Fl_Box* tipbox;
edelib::vector<ControlIcon> iconlist; edelib::list<ControlIcon> iconlist;
void init(void); void init(void);
void load_icons(void); void load_icons(void);