Download bars (patch linked)

Archived discussion about features (predating the use of Bugzilla as a bug and feature tracker)

Moderator: Moderators

Locked
dannyCage
Posts: 2
Joined: 2003-10-30 07:35

Download bars (patch linked)

Post by dannyCage » 2003-10-30 08:12

a small graphical improvment making the dowload bars abit more clear where 100% is etc etc,

just copy & past to the correct line...

<a target='out' href='http://www.offtex.com/tmp/mainform-chan ... ges.txt</a>

//c

TheParanoidOne
Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2003-10-30 08:51

compile.txt wrote:Submitting patches

If you think you've done something that more people could use, you can always submit a patch for inclusion in the
original distribution. I will then consider whether I like the patch or not based on things that might seem to be
completely random, which just might be the case. Popular reasons for rejecting a patch include, but are not limited to,
ugly code, abusable features, feature that I don't like that bloat the applications and incompatibility with other
modifications I've already done.
To increase the chances of your patch being accepted, mail them to me ([email protected]) as diffs against the latest
code you can find (for the moment, it should be the cvs repository on sourceforge, but sometimes I forget to
update it, so check the source code distribution of the latest release as well...). You can find a lot of
information about diff and patch by googling for it.
By submitting a patch, you agree to that I get copyright of it. This to avoid stupid situations later on where
the copyright is split out over a million people, each of which could stop further distribution of DC++. If you don't
like this, start your own distribtution, if you're lucky it might become more popular than the original =).
The world is coming to an end. Please log off.

DC++ Guide | Words

Twink
Posts: 436
Joined: 2003-03-31 23:31
Location: New Zealand

Post by Twink » 2003-10-30 19:16

got a screenshot?, not always easy imagining what it looks like just by staring at the code

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-10-30 21:17

And actually, I'm just getting a timeout to that webserver at the moment.

Atomic Jo
Posts: 62
Joined: 2003-01-04 03:50
Location: Québec, Canada
Contact:

Post by Atomic Jo » 2003-10-31 05:24

GargoyleMT wrote:And actually, I'm just getting a timeout to that webserver at the moment.

Code: Select all

				
MainFrm.cpp - Line 1218
				
				// draw something nice...	
				char buf[256];
				COLORREF barPal[3] = { RGB(160,160,130), RGB(210,210,180), RGB(230,230,200) };
				COLORREF bgPal[2] = { RGB(200,200,200), RGB(230,230,230) };

				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;
				
				// draw background
				HGDIOBJ oldpen = ::SelectObject(cd->nmcd.hdc, CreatePen(PS_SOLID,1,bgPal[0]));
				HGDIOBJ oldbr = ::SelectObject(cd->nmcd.hdc, CreateSolidBrush(bgPal[1]));
				::Rectangle(cd->nmcd.hdc, rc.left, rc.top, rc.right, rc.bottom);			
				rc.DeflateRect(1, 1, 1, 1);

				// draw progressbar
				if(ii->size == 0)
					ii->size = 1;
				rc.right = rc.left + (int) (((int64_t)rc.Width()) * ii->pos / ii->size);
				DeleteObject(SelectObject(cd->nmcd.hdc, CreateSolidBrush(barPal[1])));//GetSysColorBrush(COLOR_HIGHLIGHT));
				DeleteObject(SelectObject(cd->nmcd.hdc, CreatePen(PS_SOLID,1,barPal[0])));
				
				::Rectangle(cd->nmcd.hdc, rc.left, rc.top, rc.right, rc.bottom);
				

				// draw progressbar highlight
				if(rc.Width()>2) {
					DeleteObject(SelectObject(cd->nmcd.hdc, CreatePen(PS_SOLID,1,barPal[2])));

					rc.top += (int)rc.Height()*0.33;
					::MoveToEx(cd->nmcd.hdc,rc.left+1,rc.top,(LPPOINT)NULL);
					::LineTo(cd->nmcd.hdc,rc.right-2,rc.top);
				};
				
				// draw status text
				DeleteObject(::SelectObject(cd->nmcd.hdc, oldpen));
				DeleteObject(::SelectObject(cd->nmcd.hdc, oldbr));

				::DrawText(cd->nmcd.hdc, buf, strlen(buf), rc2, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);

				return CDRF_SKIPDEFAULT;
From the website :)

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-11-03 20:44

Code: Select all

diff -ru DCPlusPlus-0.301-src.orig/windows/TransferView.cpp DCPlusPlus-0.301-src/windows/TransferView.cpp
--- DCPlusPlus-0.301-src.orig/windows/TransferView.cpp	Tue Oct 21 10:36:12 2003
+++ DCPlusPlus-0.301-src/windows/TransferView.cpp	Sun Nov  2 17:03:00 2003
@@ -287,28 +287,45 @@
 				ctrlTransfers.GetItemText((int)cd->nmcd.dwItemSpec, COLUMN_STATUS, buf, 255);
 				buf[255] = 0;
 
+				COLORREF barPal[3] = { RGB(160,160,130), RGB(210,210,180), RGB(230,230,200) };
+				COLORREF bgPal[2] = { RGB(200,200,200), RGB(230,230,230) };
+
+
 				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);
+
+				// draw background
+				HGDIOBJ oldpen = ::SelectObject(cd->nmcd.hdc, CreatePen(PS_SOLID,1,bgPal[0]));
+				HGDIOBJ oldbr = ::SelectObject(cd->nmcd.hdc, CreateSolidBrush(bgPal[1]));
+				::Rectangle(cd->nmcd.hdc, rc.left, rc.top, rc.right, rc.bottom);         
+				rc.DeflateRect(1, 1, 1, 1);
+
+				// draw progressbar
 				if(ii->size == 0)
 					ii->size = 1;
 				rc.right = rc.left + (int) (((int64_t)rc.Width()) * ii->pos / ii->size);
-				bool altColor = (ctrlTransfers.m_hWnd == ::GetFocus()) && (ctrlTransfers.GetItemState((int)cd->nmcd.dwItemSpec, LVIS_SELECTED) & LVIS_SELECTED);
-				int color =  altColor ? COLOR_BTNFACE : COLOR_HIGHLIGHT;
-				HGDIOBJ old = ::SelectObject(cd->nmcd.hdc, GetSysColorBrush(color));
-				::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);
-				color = altColor ? COLOR_BTNTEXT : COLOR_HIGHLIGHTTEXT;
-				::SetTextColor(cd->nmcd.hdc, GetSysColor(color));
-				rc2.right = rc.right;
+				DeleteObject(SelectObject(cd->nmcd.hdc, CreateSolidBrush(barPal[1])));//GetSysColorBrush(COLOR_HIGHLIGHT));
+				DeleteObject(SelectObject(cd->nmcd.hdc, CreatePen(PS_SOLID,1,barPal[0])));
+
+				::Rectangle(cd->nmcd.hdc, rc.left, rc.top, rc.right, rc.bottom);
+
+
+				// draw progressbar highlight
+				if(rc.Width()>2) {
+					DeleteObject(SelectObject(cd->nmcd.hdc, CreatePen(PS_SOLID,1,barPal[2])));
+
+					rc.top += (int)rc.Height()*0.33;
+					::MoveToEx(cd->nmcd.hdc,rc.left+1,rc.top,(LPPOINT)NULL);
+					::LineTo(cd->nmcd.hdc,rc.right-2,rc.top);
+				};
+
+				// draw status text
+				DeleteObject(::SelectObject(cd->nmcd.hdc, oldpen));
+				DeleteObject(::SelectObject(cd->nmcd.hdc, oldbr));
+
 				::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);
+
 				return CDRF_SKIPDEFAULT;
 			}
 		}
Notes:
This looks very nice. The colors might be nice to be configurable (there's not much room around the Settings, but perhaps it's time to reorganize). There also seems to be a one-off (or is it a highlight?) best seen in this double size picture (made on XP with cleartype enabled):

Image

Looks nice. I'll be keeping this instead of the normal bar in my mod at least. ;)
Last edited by GargoyleMT on 2004-03-13 14:04, edited 1 time in total.

Twink
Posts: 436
Joined: 2003-03-31 23:31
Location: New Zealand

Post by Twink » 2003-11-04 02:58

yeah I like it, I added to my mod too (already had coloured bars, not not background), Also made it customizable as I already had a dropdown box in settings with the progress bar colours in it, and the tab colours.

Locked