Message-ID: <3AB56183.8090303@operamail.com> From: Sahab Yazdani Organization: PheonixSoft Interactive User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; 0.8.1) Gecko/20010316 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: the follies of new... References: <3AB2BCD3 DOT 4020002 AT operamail DOT com> <4331-Sat17Mar2001095541+0200-eliz AT is DOT elta DOT co DOT il> <3AB38F31 DOT 7090208 AT operamail DOT com> <2110-Sat17Mar2001190224+0200-eliz AT is DOT elta DOT co DOT il> Content-Type: multipart/mixed; boundary="------------050706040407010806050402" Lines: 129 Date: Sun, 18 Mar 2001 20:31:47 -0500 NNTP-Posting-Host: 149.99.116.160 X-Complaints-To: abuse AT sprint DOT ca X-Trace: newscontent-01.sprint.ca 984966007 149.99.116.160 (Sun, 18 Mar 2001 20:40:07 EST) NNTP-Posting-Date: Sun, 18 Mar 2001 20:40:07 EST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. --------------050706040407010806050402 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit here is the source code for the offending module (as symify sees it) the Class GLinearBitmap works fine, as I have debugged it to death. -- *********************************************************** * Sahab Yazdani * "Wizard's Third Rule: Passion rules * * Thornhill S.S * Reason" - Kolo's Journal * *********************************************************** * http://pheonixsoft.virtualave.net/ * *********************************************************** --------------050706040407010806050402 Content-Type: text/plain; name="perslide.cc" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="perslide.cc" // Homebase Version 1.0 // Graphical Percentage Bar Widget // By: Sahab Yazdani #include #include #include "e:/djgpp/contrib/grfx2/h/linbitmp.h" #include "perslide.h" static int PercentageOf( int per, int max ) { double temp; int num; temp = ((double)(per))/100; temp = temp * ((double)(max)); // Get Percentage of... num = ((int)(temp)); return num; } static int Percentage( int num, int max ) { double temp; temp = ((double)(num))/(double)((max)); temp = temp * 100; return ((int)(temp)); } PercentageSlider::PercentageSlider() { draw=NULL; backdrop=NULL; range = GPoint( 0, 0 ); curPercent=0; region = GRect( 0, 0, 0, 0 ); colourA = GRGB( 0, 0, 0 ); colourB = GRGB( 0, 0, 0 ); } PercentageSlider::PercentageSlider( GRect region, GLinearBitmap *target, GRGB colourA, GRGB colourB, GPoint range ) { PercentageSlider::region = region; backdrop = new GLinearBitmap( region.length, region.width, target->GetBitDepth() ); backdrop->Clip( GPoint( region.x, region.y ), target ); draw = new GLinearBitmap( region.length, region.width, target->GetBitDepth() ); fprintf( stderr, "draw[oninit]: 0x%x\n", draw ); curPercent=0; PercentageSlider::colourA = colourA; PercentageSlider::colourB = colourB; PercentageSlider::range = range; } PercentageSlider::~PercentageSlider() { fprintf( stderr, "draw[ondestruct]: 0x%x\n", draw ); fprintf( stderr, "draw->virtualPtr: 0x%x\n", draw->GetVirtualPointer() ); if ( draw!=NULL ) delete draw; if ( backdrop!=NULL ) delete backdrop; } GRGB PercentageSlider::CalcStep( int curPer, int totalStep ) { long RDelta; long GDelta; long BDelta; RDelta = colourB.red - colourA.red; RDelta = (RDelta * curPer) / totalStep; GDelta = colourB.green - colourA.green; GDelta = (GDelta * curPer) / totalStep; BDelta = colourB.blue - colourA.blue; BDelta = (BDelta * curPer) / totalStep; return GRGB( ( colourA.red + (unsigned char) RDelta ) , ( colourA.green + (unsigned char) GDelta ), ( colourA.blue + (unsigned char) BDelta ) ); } void PercentageSlider::UpdateBasedonMouse( GPoint location ) { int relative; relative = location.x - region.x; // Relative to box SetPercentage( Percentage( relative, region.length ) ); } void PercentageSlider::ChangeBackdrop( GLinearBitmap *target ) { backdrop->Clip( GPoint( region.x, region.y ), target ); } void PercentageSlider::Draw( GLinearBitmap *target ) { backdrop->Draw( GPoint( 0, 0 ), draw ); for( int c=0;cLine( GPoint( c, 0 ), GPoint( c, region.width-1 ), CalcStep( c, region.length ) ); draw->Draw( GPoint( region.x, region.y ), target ); } --------------050706040407010806050402--