Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Bug Fix For Virtualdub 1.4.10, Cosmetic bug fix for position info panel
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
Spire
Posted: Sep 5 2002, 01:06 AM


Unregistered









Hi everybody! Long-time VirtualDub user here.

For my first post, I'd like to submit a fix for a relatively minor cosmetic bug affecting VirtualDub 1.4.10 as well as previous versions. It affects the very small percentage of users who have calibrated their displays to use a non-standard DPI setting (i.e., not 96DPI or 120DPI).

When the display is set to a custom DPI, the information panel text in the position control appears in the wrong font size. On my system, which is calibrated to 135DPI, the text in the information panel is unreadably small.

Fortunately, the fix is easy and simple. In the source file PositionControl.cpp, delete line 276:
CODE
pcd->hFont = CreateFont(8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "MS Sans Serif");

...and replace it with the following code:
CODE
if (!(pcd->hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT))) {
       NONCLIENTMETRICS ncm = { sizeof(ncm) };
       SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
       pcd->hFont = CreateFontIndirect(&ncm.lfMessageFont);
}

I also noticed a minor resource leak bug related to this one that can be fixed if desired. In the same source file, search for the following two lines (they're line 337 and 338 in the original unedited file):
CODE
case WM_DESTROY:
       delete pcd;

In between these two lines, insert the following line:
CODE
       if (pcd->hFont) (DeleteObject(pcd->hFont);

Then recompile and add water.

That's it! I'm sure there are lots of tiny resource leaks like this one scattered throughout the VirtualDub source code, but they are pretty much inconsequential and nothing to worry about. It's mainly the cosmetic problem that I wanted to fix.
 
  Top
SillKotscha
Posted: Sep 5 2002, 01:11 AM


smart Moderator


Group: Moderators
Posts: 146
Member No.: 6
Joined: 7-July 02



although I haven't any idea about 'how to (re)compile' your input is highly appreciated...

kind regards - Sill

--------------------
"Have you ever noticed that whenever Microsoft calls something 'Smart', it's definitely a feature you want to disable!"
 
     Top
Spire
Posted: Sep 5 2002, 01:37 AM


Unregistered









Hi Sill,

To compile VirtualDub, you need Microsoft Visual C++, and of course the VirtualDub source code. Instructions are included with the source code.

It would be nice if Avery simply folded this fix into the next release of VirtualDub so that everyone can benefit.

I have other UI fixes that I've done on my own personal build of VirtualDub, and I'll try to post them if there is any interest.
 
  Top
Ciler
Posted: Sep 5 2002, 06:06 AM


Unregistered









QUOTE (Spire @ Sep 4 2002, 07:37 PM)
Hi Sill,

To compile VirtualDub, you need Microsoft Visual C++, and of course the VirtualDub source code. Instructions are included with the source code.

It would be nice if Avery simply folded this fix into the next release of VirtualDub so that everyone can benefit.

I have other UI fixes that I've done on my own personal build of VirtualDub, and I'll try to post them if there is any interest.

ohmy.gif Please do, this is a really valuable input IMO
 
  Top
ChristianHJW
Posted: Sep 5 2002, 12:19 PM


Advanced Member


Group: Moderators
Posts: 1768
Member No.: 2
Joined: 7-July 02



In fact i will talk to everwicked about the creation of a new sector for this .... i never thought the board could be used for such a valuable purpose also !!

--------------------
Visit the unofficial Virtualdub support forum on http://forums.virtualdub.org - help to reduce the big number of emails Avery Lee is getting every day !!
Support matroska as container and Gstreamer as the only truely open, x-platform multimedia platform ....
 
       Top
phaeron
Posted: Sep 15 2002, 10:39 PM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



Thanks for the fix, but a couple of comments. First, everyone in the system is pretty much screwed if GetStockObject(DEFAULT_GUI_FONT) fails; odds are slim to none that CreateFontIndirect() will work. In that case, it's better simply to not set the font and have the controls use their own default. Second, the font is still selected into the child controls when WM_DESTROY arrives, so the DeleteObject() is too early -- I'll probably move the delete to WM_NCDESTROY, as that is called after all child windows are destroyed.
 
    Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
5 replies since Sep 5 2002, 01:06 AM Track this topic | Email this topic | Print this topic

<< Back to VirtualDub Development Forum