Page 16 of 28

Posted: Fri Mar 13, 2009 12:26 am
by hto
Black_Fox wrote: It may help to track down the issue, that ReactOS Calculator does very similar thing when downloaded from SF.net, but executable built as part of ReactOS itself is fine.
WRC (Wine resource compiler), which is used to build ReactOS, assumes that Slovak files are in CP-1250. Maybe ReactOS Calculator from SF.net was compiled with some other tool.

Re: 1:1 MSPaint clone - not ? but !

Posted: Sat Mar 14, 2009 6:52 pm
by gyROS
dcuny wrote:There's a refresh bug under WinXP. When a bitmap is initially loaded, the canvas remains white until the window receives a mouse click event.
It is not yet implemented. Use the 100% entry from the view->zoom menu to do so. It will also resize the canvas. Use it for the resize function, too.
dcuny wrote:You should check the file header to make sure it's a valid bitmap (or whatever). Loading something like a .exe causes Paint to crash.
Load from file is heavily experimental. There is not much implemented at all.
Black_Fox wrote:You might have noticed that the mouse pointers in MSPaint have a white outline to make them more visible against a dark background.
In Windows Vista they haven't. Nevertheless it's a good idea.

I might have some time to work on it between Tuesday and Friday.

Re: 1:1 MSPaint clone - not ? but !

Posted: Tue Mar 17, 2009 12:27 am
by EmuandCo
I added your Paint source to my local tree. Problems I see right now are that we don't include htmlhelp which makes problems in linking at winproc.c line 274. I commented it out and removed the ^ at the lines " "^N", IDM_IMAGEDELETEIMAGE, SHIFT, VIRTKEY" in all rc files. It dislikes the non ASCII character and does not build. Well. Now it does :-D

Needed RBUILD:

<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="paint" type="win32gui" installbase="system32" installname="paint.exe" allowwarnings="true">
<include base="paint">.</include>
<library>comdlg32</library>
<library>shell32</library>
<library>user32</library>
<library>gdi32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>comctl32</library>
<file>dialogs.c</file>
<file>dib.c</file>
<file>drawing.c</file>
<file>history.c</file>
<file>main.c</file>
<file>mouse.c</file>
<file>palette.c</file>
<file>selection.c</file>
<file>toolsettings.c</file>
<file>winproc.c</file>
<file>rsrc.rc</file>
</module>

Here the Warnings:
http://www.reactos.org/paste/index.php/4524/

Re: 1:1 MSPaint clone - not ? but !

Posted: Tue Mar 17, 2009 4:25 pm
by gyROS
It's nice to hear that it is somehow working. :) The next thing I'm going to do is fixing some of the makeshift implementations used in the load and save functions and monitoring and updating the canvas size in the undo/redo insertReversible etc. functions.

Re: 1:1 MSPaint clone - not ? but !

Posted: Tue Mar 17, 2009 6:24 pm
by lollebol
I have downloaded and tested your paint, gyROS,
and i must say i am impressed what you already have done!

Only one bug is when you have a pencil en you draw on the screen with holding left mouse mouse button for a while,
your program is freezing for a minute and then its working again... known bug?

Tested it on Windows 7 RC1 (build 7057)

Good luck on further development!

- lollebol

Re: 1:1 MSPaint clone - not ? but !

Posted: Tue Mar 17, 2009 7:13 pm
by gyROS
lollebol wrote:Only one bug is when you have a pencil en you draw on the screen with holding left mouse mouse button for a while,
your program is freezing for a minute and then its working again... known bug?
?!
Not at all. Well, if you told me that after a while of painting it is reliably crashing, that would have been a known bug. :roll:
But why doesn't the program crash? What's wrong with the bug? :shock:

Re: 1:1 MSPaint clone - not ? but !

Posted: Tue Mar 17, 2009 7:25 pm
by Speedator
Don't worry. He's talking about Windows 7 RC1.
lollebol: DId you test paint from let's say Windows XP, too?

Re: 1:1 MSPaint clone - not ? but !

Posted: Tue Mar 17, 2009 9:07 pm
by lollebol
yes i have tested it few mintunes ago on windows xp on an older machine and i get the same result,
to recreate:

1. click on the pencil
2. inside the white screen
3. hold the left mouse button
4. go crazy and do what you like but stay inside the white screen
5. go on till you see the pencil doesn't draw lines anymore (around 20-30 sec?)
6. its freezed :(

Re: 1:1 MSPaint clone - not ? but !

Posted: Tue Mar 17, 2009 9:40 pm
by gyROS
I'm creating a new pen for every line a tool draws. But it should be deleted within the same (line-) function, so I don't know what causes the freeze.

Re: 1:1 MSPaint clone - not ? but !

Posted: Wed Mar 18, 2009 4:10 am
by Nintendo Maniac 64
lollebol wrote: 1. click on the pencil
2. inside the white screen
3. hold the left mouse button
4. go crazy and do what you like but stay inside the white screen
5. go on till you see the pencil doesn't draw lines anymore (around 20-30 sec?)
6. its freezed :(
HOLY CRAP. Doing this I end up with not a program freeze, but graphical errors. O_o The program SEEMED to still work, but nothing would happen. I was able to close it out normally and stuff without forcing an end task. Print Screen didn't work during the graphical errors, and if I tried to click a toolbar button, then print screen, I start getting errors and fullscreen graphical glitches.

Re: 1:1 MSPaint clone - not ? but !

Posted: Wed Mar 18, 2009 12:48 pm
by gyROS
Known bug, unknown reason. See above.

Re: 1:1 MSPaint clone - not ? but !

Posted: Wed Mar 18, 2009 5:59 pm
by swight
I haven't tested this yet, but from the last few posts it might be a good idea to check if there is a gdi leak since this could cause a delayed graphical glitch. In case you don't know how to check for this type of leak one method is
1.open up the task manager
2.go to the view menu
3.go to Select Columns...
4.select GDI Objects from the list
5. watch the number in the new column and see how quickly it goes up(hopefully it will pretty much stay put).

Re: 1:1 MSPaint clone - not ? but !

Posted: Wed Mar 18, 2009 7:34 pm
by The123king
yeh, seems like a gdi object leak. I managed to rack up 4k objects after about 10 seconds pen drawing

And it seems to affect all the tools pretty much :|

After making it go up to about 10,000 gdi objects XP starts to throw up gbraphical error everywhere pretty much :?

Re: 1:1 MSPaint clone - not ? but !

Posted: Wed Mar 18, 2009 11:24 pm
by gyROS

Code: Select all

void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness)
{
    HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
    MoveToEx(hdc, x1, y1, NULL);
    LineTo(hdc, x2, y2);
    DeleteObject(SelectObject(hdc, oldPen));
}
It has to be somewhere in here. I just do not see, where... The Pen is created, selected into the DC, thrown out of the DC again and finally deleted. :|

Re: 1:1 MSPaint clone - not ? but !

Posted: Wed Mar 18, 2009 11:32 pm
by jorl17
Hi, I've been following your progress and I must say I admire your work.
It's been a while since I last did native windows programming and this may be totally wrong, still, I thought I should say something.

It seems you are creating a pen and not destroying it. And, if you read MSDN, they recommend you t DeleteObject on it. Maybe that is what you are doing with your last line of code, and maybe oldPen is your new pen, but then why are you calling it oldPen?

Excuse me if saying anything wrong, but I'm just throwing suggestions away.

Anyway, keep up the awesome work.