Color of processbar
Moderator: Moderators
Color of processbar
I would like to be able to specify colors for upload processindicator and download indicator aswell (like green for download and red for upload)
Web-Programmer - Application Developer
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
I changed these colours before oDC released that version. My way is pratcially the same as his.
in mainfrm.cpp at about 1236:
if(cd->iSubItem == COLUMN_STATUS) {
ItemInfo* ii = (ItemInfo*)cd->nmcd.lItemlParam;
if(ii->status == ItemInfo::STATUS_RUNNING) {
// draw something nice...
char buf[256];
ctrlTransfers.GetItemText((int)cd->nmcd.dwItemSpec, COLUMN_STATUS, buf, 255);
buf[255] = 0;
ctrlTransfers.GetSubItemRect((int)cd->nmcd.dwItemSpec, COLUMN_STATUS, LVIR_BOUNDS, rc);
CRect rc2 = rc;
rc2.left += 6;
//::Rectangle(cd->nmcd.hdc, rc.left, rc.top, rc.right, rc.bottom);
//rc.DeflateRect(1, 1, 1, 1);
if(ii->size == 0)
ii->size = 1;
rc.right = rc.left + (int) (((int64_t)rc.Width()) * ii->pos / ii->size);
//ADDED {
HBRUSH hbrush = SETTING(PROGRESS_CUSTOM) ?
CreateSolidBrush((ii->type == ItemInfo::TYPE_UPLOAD) ?
SETTING(PROGRESS_COLOUR_UP) : SETTING(PROGRESS_COLOUR_DOWN)) : GetSysColorBrush(COLOR_HIGHLIGHT);
HGDIOBJ old = ::SelectObject(cd->nmcd.hdc, hbrush);
//ADDED }
::Rectangle(cd->nmcd.hdc, rc.left, rc.top,
rc.right, rc.bottom);
::SelectObject(cd->nmcd.hdc, old);
COLORREF oldcol = ::SetTextColor(cd->nmcd.hdc, cd->clrText);
::DrawText(cd->nmcd.hdc, buf, strlen(buf), rc2, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
::SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
rc2.right = rc.right;
::DrawText(cd->nmcd.hdc, buf, strlen(buf), rc2, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
::SelectObject(cd->nmcd.hdc, old);
::SetTextColor(cd->nmcd.hdc, oldcol);
//ADDED {
DeleteObject(hbrush);
//ADDED }
Then all you need to do is to make sure that you define PROGRESS_COLOUR_UP/DOWN in settingsmanager and put some control to change them.
I did it quickly with a / command, its pretty inefficient at the moment, but I don't really care. in hubframe.cpp :
} else if(Util::stricmp(s.c_str(), "upcolour") == 0) {
if (param.empty())
addClientLine("Error: usage /upcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
int red = 0;
int i = 0;
int j = 0;
while (param >= '0' && param <='9' && i < j + 3)
red = (red * 10) + (param[i++] - '0');
if (((red > 255) || (red < 0)) || param[i++] != ',')
addClientLine("Error: usage /upcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
j = i;
int green = 0;
while (param >= '0' && param <='9' && i < j + 3)
green = (green * 10) + (param[i++] - '0');
if (((green > 255) || (green < 0)) || param[i++] != ',')
addClientLine("Error: usage /upcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
j = i;
int blue = 0;
while (param >= '0' && param <='9' && i < j + 3)
blue = (blue * 10) + (param[i++] - '0');
if (((blue > 255) || (blue < 0)))
addClientLine("Error: usage /upcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
progressUpColour = RGB(red, green, blue);
SettingsManager::getInstance()->set(SettingsManager::PROGRESS_COLOUR_UP, (int)progressUpColour);
addClientLine("Upload progress bar colour changed");
}
}
}
}
} else if(Util::stricmp(s.c_str(), "downcolour") == 0) {
if (param.empty())
addClientLine("Error: usage /downcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
int red = 0;
int i = 0;
int j = 0;
while (param >= '0' && param <='9' && i < j + 3)
red = (red * 10) + (param[i++] - '0');
if (((red > 255) || (red < 0)) || param[i++] != ',')
addClientLine("Error: usage /downcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
j = i;
int green = 0;
while (param >= '0' && param <='9' && i < j + 3)
green = (green * 10) + (param[i++] - '0');
if (((green > 255) || (green < 0)) || param[i++] != ',')
addClientLine("Error: usage /downcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
j = i;
int blue = 0;
while (param[i] >= '0' && param[i] <='9' && i < j + 3)
blue = (blue * 10) + (param[i++] - '0');
if (((blue > 255) || (blue < 0)))
addClientLine("Error: usage /downcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
progressDownColour = RGB(red, green, blue);
SettingsManager::getInstance()->set(SettingsManager::PROGRESS_COLOUR_DOWN, (int)progressDownColour);
addClientLine("Download progress bar colour changed");
}
}
}
}
in mainfrm.cpp at about 1236:
if(cd->iSubItem == COLUMN_STATUS) {
ItemInfo* ii = (ItemInfo*)cd->nmcd.lItemlParam;
if(ii->status == ItemInfo::STATUS_RUNNING) {
// draw something nice...
char buf[256];
ctrlTransfers.GetItemText((int)cd->nmcd.dwItemSpec, COLUMN_STATUS, buf, 255);
buf[255] = 0;
ctrlTransfers.GetSubItemRect((int)cd->nmcd.dwItemSpec, COLUMN_STATUS, LVIR_BOUNDS, rc);
CRect rc2 = rc;
rc2.left += 6;
//::Rectangle(cd->nmcd.hdc, rc.left, rc.top, rc.right, rc.bottom);
//rc.DeflateRect(1, 1, 1, 1);
if(ii->size == 0)
ii->size = 1;
rc.right = rc.left + (int) (((int64_t)rc.Width()) * ii->pos / ii->size);
//ADDED {
HBRUSH hbrush = SETTING(PROGRESS_CUSTOM) ?
CreateSolidBrush((ii->type == ItemInfo::TYPE_UPLOAD) ?
SETTING(PROGRESS_COLOUR_UP) : SETTING(PROGRESS_COLOUR_DOWN)) : GetSysColorBrush(COLOR_HIGHLIGHT);
HGDIOBJ old = ::SelectObject(cd->nmcd.hdc, hbrush);
//ADDED }
::Rectangle(cd->nmcd.hdc, rc.left, rc.top,
rc.right, rc.bottom);
::SelectObject(cd->nmcd.hdc, old);
COLORREF oldcol = ::SetTextColor(cd->nmcd.hdc, cd->clrText);
::DrawText(cd->nmcd.hdc, buf, strlen(buf), rc2, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
::SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
rc2.right = rc.right;
::DrawText(cd->nmcd.hdc, buf, strlen(buf), rc2, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
::SelectObject(cd->nmcd.hdc, old);
::SetTextColor(cd->nmcd.hdc, oldcol);
//ADDED {
DeleteObject(hbrush);
//ADDED }
Then all you need to do is to make sure that you define PROGRESS_COLOUR_UP/DOWN in settingsmanager and put some control to change them.
I did it quickly with a / command, its pretty inefficient at the moment, but I don't really care. in hubframe.cpp :
} else if(Util::stricmp(s.c_str(), "upcolour") == 0) {
if (param.empty())
addClientLine("Error: usage /upcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
int red = 0;
int i = 0;
int j = 0;
while (param >= '0' && param <='9' && i < j + 3)
red = (red * 10) + (param[i++] - '0');
if (((red > 255) || (red < 0)) || param[i++] != ',')
addClientLine("Error: usage /upcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
j = i;
int green = 0;
while (param >= '0' && param <='9' && i < j + 3)
green = (green * 10) + (param[i++] - '0');
if (((green > 255) || (green < 0)) || param[i++] != ',')
addClientLine("Error: usage /upcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
j = i;
int blue = 0;
while (param >= '0' && param <='9' && i < j + 3)
blue = (blue * 10) + (param[i++] - '0');
if (((blue > 255) || (blue < 0)))
addClientLine("Error: usage /upcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
progressUpColour = RGB(red, green, blue);
SettingsManager::getInstance()->set(SettingsManager::PROGRESS_COLOUR_UP, (int)progressUpColour);
addClientLine("Upload progress bar colour changed");
}
}
}
}
} else if(Util::stricmp(s.c_str(), "downcolour") == 0) {
if (param.empty())
addClientLine("Error: usage /downcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
int red = 0;
int i = 0;
int j = 0;
while (param >= '0' && param <='9' && i < j + 3)
red = (red * 10) + (param[i++] - '0');
if (((red > 255) || (red < 0)) || param[i++] != ',')
addClientLine("Error: usage /downcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
j = i;
int green = 0;
while (param >= '0' && param <='9' && i < j + 3)
green = (green * 10) + (param[i++] - '0');
if (((green > 255) || (green < 0)) || param[i++] != ',')
addClientLine("Error: usage /downcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
j = i;
int blue = 0;
while (param[i] >= '0' && param[i] <='9' && i < j + 3)
blue = (blue * 10) + (param[i++] - '0');
if (((blue > 255) || (blue < 0)))
addClientLine("Error: usage /downcolour xxx,xxx,xxx where xxx,xxx,xxx = Red,Green,Blue 0-255");
else {
progressDownColour = RGB(red, green, blue);
SettingsManager::getInstance()->set(SettingsManager::PROGRESS_COLOUR_DOWN, (int)progressDownColour);
addClientLine("Download progress bar colour changed");
}
}
}
}
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Locutus, you are welcome to tell me what you don't like about my fork.
Phantom, or you can use oDC which has these settings in the Settings dialog...
Opera
Phantom, or you can use oDC which has these settings in the Settings dialog...
Opera
Creator of the dc++ fork, oDC found at:
http://gempond.com/odc
http://gempond.com/odc
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
It's really... cake. Just use the resource editor to add some edit boxes, change the ID on them, then add them to the list that PropPage uses to pull/save SettingManager settings with. If you really have a hard time with it, just look at the source to mods that have added their own page... Arne seems to have laid a nice good foundation here, quite easy to add on to.Phantom wrote:I'm not so good with GUI stuff, so I make everything command line style. Thats until I make enough features worthy of a GUI settings page.
No I don't know about that, but this is not the right forum to talk about that =)Phantom wrote:Opera, yeah your client is nice. Only thing is the /me bug, which i'm sure you are aware of. I'm not so good with GUI stuff, so I make everything command line style. Thats until I make enough features worthy of a GUI settings page.
Btw, I don't think my features are That small, even though it's absurd comparing me to arne (yet atleast;), since in my "mod" he still owns 90% of the code..
So, without arne, no dc++, no oDC. without me, dc++, but no oDC... that's kinda it =)
I would never complain about his efforts, ever.
Opera
Creator of the dc++ fork, oDC found at:
http://gempond.com/odc
http://gempond.com/odc
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Are you sure it wasn't the same behavior that was in 0.231 or 0.232? Arne did change the directory downloading method, then switched it back after unpopularity. Opera should only be blamed for bugs in her (his?) client...Locutus wrote:I tried your client, Opera, that sucky sucky way of downloading whole directories is in your client... so I changed back to DC++