Home » U++ Library support » FileSel&FileList, Path » FileSel bug when displaying Han characters
|
|
|
Re: FileSel bug when displaying Han characters [message #14972 is a reply to message #14969] |
Sun, 23 March 2008 14:18 |
|
mirek
Messages: 14038 Registered: November 2005
|
Ultimate Member |
|
|
cbpporter wrote on Sun, 23 March 2008 07:06 | Here is the same dialog after the face lift:
I think it looks now almost 100% native, even though the same U++ code runs in the background. No more strange looks on peoples faces when they click open! The best part is, it even has better functionality then the native one thanks to search box, column list column resizing and name/extension sorting.
|
Yeah, that is where I wish to be heading. I only do not like Open/Cancel buttons eating the space on right.
Quote: |
2. The images are embedded into the exe and I think it should be better to rip them directly from shell32.dll. I have no idea how to do this yet, or if the indexes of a given icon in the dll are constant across OS versions.
|
AFAIK, they are fixed. You can use
Image Win32DllIcon(const char *dll, int ii, bool large);
to retrieve them.
Mirek
|
|
|
|
Re: FileSel bug when displaying Han characters [message #14987 is a reply to message #14985] |
Mon, 24 March 2008 14:07 |
cbpporter
Messages: 1406 Registered: September 2007
|
Ultimate Contributor |
|
|
Quote: | AFAIK, they are fixed. You can use
Image Win32DllIcon(const char *dll, int ii, bool large);
to retrieve them.
|
Thanks. Works well. I'll implement the functionality too, but I think I'll have to refactor a little the FileSel code. You don't mind, do you?
Quote: | Can you send me the file zipped? (you can delete the content, I just have problems creating CJK filenames
|
I tried attaching a file with that name, but no luck. Also, zip does not allow those characters and in rar they where replaced by underscores. Talk about good Unicode support . But you should be able to rename any file on your system by copy-pasting the name from here. The text was: 皆の日本語.
mr_ped wrote on Mon, 24 March 2008 14:17 | I feel like the Open/Cancel in facelifted version is smaller (I'm too lazy to measure it, that's why I just "feel").
Any good idea how make them bigger (more important)?
|
I think they are the same size. What kind of idea do you need to make them bigger?
Quote: | The original version had IMO more appeal in it, and I think GTK has even more emphasize on such important buttons?
|
I'm not sure I understand what you mean...
|
|
|
|
|
Re: FileSel bug when displaying Han characters [message #15014 is a reply to message #14988] |
Tue, 25 March 2008 23:22 |
cbpporter
Messages: 1406 Registered: September 2007
|
Ultimate Contributor |
|
|
[quote title=luzr wrote on Mon, 24 March 2008 15:29]cbpporter wrote on Mon, 24 March 2008 09:07 |
Depends what you expect U++ is BSD license, means you can do whatever you want. Accepting patch into the "main tree" is completely different issue
|
Well I don't expect anything, but it would be nice if it were included, since I consider it a nice improvement and I really want my apps to look native (I guess you already figured that out by the number of visual bugs I commented upon). So following that idea, I kept any unnecessary modification which I would have done out, and practically only added some extra buttons, modified a function or two and an extra layout.
It works fine, but it does have some limitations. For example, .lnk files are not read and displayed as explorer would, Desktop link does not display all items on you desktop, only those which are physically present in you directory (explorer would pull those links from multiple dirs), and most importantly, network browsing doesn't work.
I'll reinstall Linux and emulate Gtk look next.
|
|
|
Re: FileSel bug when displaying Han characters [message #15022 is a reply to message #15014] |
Wed, 26 March 2008 10:23 |
|
mirek
Messages: 14038 Registered: November 2005
|
Ultimate Member |
|
|
[quote title=cbpporter wrote on Tue, 25 March 2008 18:22]luzr wrote on Mon, 24 March 2008 15:29 |
cbpporter wrote on Mon, 24 March 2008 09:07 |
Depends what you expect U++ is BSD license, means you can do whatever you want. Accepting patch into the "main tree" is completely different issue
|
Well I don't expect anything, but it would be nice if it were included, since I consider it a nice improvement and I really want my apps to look native (I guess you already figured that out by the number of visual bugs I commented upon). So following that idea, I kept any unnecessary modification which I would have done out, and practically only added some extra buttons, modified a function or two and an extra layout.
It works fine, but it does have some limitations. For example, .lnk files are not read and displayed as explorer would, Desktop link does not display all items on you desktop, only those which are physically present in you directory (explorer would pull those links from multiple dirs), and most importantly, network browsing doesn't work.
I'll reinstall Linux and emulate Gtk look next.
|
Are you aware than in Vista, it looks different again?
What I want to say, yes, let us make it as familiar as possible, fix all issues and perhaps add something to make it better. But I would like to find some middle ground, having single layout for all XP/Vista/Gtk.
And yes, network browsing is a major problem. I have even started solving this (in Win32), but abandoned for the lack of time&energy. Anyway, preliminary support is already in Core.
The main problem with current FileSel code and network browing is that network browsing abandons the concept of "path" - you are just going through some nodes. This makes it a little bit difficult to e.g. serialize the current position of FileSel...
So basically, I ended at this. Anyway, further thinking was that perhaps we could emulate the path there, just introduce some arbitrary format to express network nodes. Something like
"::Network places::The Whole Network::Microsoft Windows::My Group::Server". The only problem is that entering Server you get "regular path" again like: \\server\share_c and the question is what is to happen if you press "Dir up" button here....
Mirek
Mirek
|
|
|
Re: FileSel bug when displaying Han characters [message #15023 is a reply to message #15022] |
Wed, 26 March 2008 11:55 |
|
mirek
Messages: 14038 Registered: November 2005
|
Ultimate Member |
|
|
Oh, great. Looks like GetTextSize does not work with CJK:
void MyApp::Paint(Draw& w)
{
w.DrawRect(GetSize(), SWhite);
String txt = "皆の日本語";
Size sz = GetTextSize(txt, Arial(30));
w.DrawRect(100, 100, sz.cx, sz.cy, LtGray());
w.DrawText(100, 100, txt, Arial(30));
}
GUI_APP_MAIN
{
SetDefaultCharset(CHARSET_UTF8);
MyApp().Run();
}
I was going down and it finally turned out that "GetCharWidthABC" does not return correct sizes for whatever reason. Just great...
(in void FontInfo::Data::GetMetrics(int page, CharMetrics *t))
Mirek
|
|
|
|
Re: FileSel bug when displaying Han characters [message #15025 is a reply to message #15024] |
Wed, 26 March 2008 12:27 |
cbpporter
Messages: 1406 Registered: September 2007
|
Ultimate Contributor |
|
|
Quote: | Are you aware than in Vista, it looks different again?
What I want to say, yes, let us make it as familiar as possible, fix all issues and perhaps add something to make it better. But I would like to find some middle ground, having single layout for all XP/Vista/Gtk.
|
Yes, I'm aware and I have no intention to emulate that look and would strongly advice against it, simply because Vista FileSel dialogs have very poor functionality and ergonomics. They are poorly suited for anything except If you want to open a file from you documents folder. I don't know who designed them, but certainly did a poor job.
As for a middle ground, I would propose basically the same layout that you had, only with a nav bar on the right. As you can see in the first two images, the dialogs are almost identical, but with a few items moved around, a navbar and OS icons, it looks familiar. Also, I looked over GTK one, and just remembered that it also has not the best ergonomics: it is without a path input field and has few locations in it's quick bar. The good part is that you can add extra ones and also has a nice folder navigation toolbar on top.
|
|
|
Re: FileSel bug when displaying Han characters [message #15026 is a reply to message #15023] |
Wed, 26 March 2008 13:05 |
|
mirek
Messages: 14038 Registered: November 2005
|
Ultimate Member |
|
|
OK, further investigation:
void MyApp::Paint(Draw& w)
{
w.DrawRect(GetSize(), SWhite);
WString txt = "皆の日本語";
Size sz = GetTextSize(txt, StdFont(30));
w.DrawRect(100, 100, sz.cx, sz.cy, LtGray());
w.DrawText(100, 100, txt, StdFont(30));
sz = GetTextSize(txt, Arial(30));
w.DrawRect(100, 200, sz.cx, sz.cy, LtGray());
w.DrawText(100, 200, txt, Arial(30));
}
...it looks like Win32 always paints it using some standard font other than Arial. Standard GUI font returns correct metrics for this font; Arial returns wrong metrics.
Now tell me what to do with this... I certainly could take metrics from different font, but that sounds a little bit weird... (and I am not sure it would always work).
Mirek
|
|
|
Re: FileSel bug when displaying Han characters [message #15028 is a reply to message #15026] |
Wed, 26 March 2008 13:19 |
|
mirek
Messages: 14038 Registered: November 2005
|
Ultimate Member |
|
|
Nope, I was wrong:
void MyApp::Paint(Draw& w)
{
w.DrawRect(GetSize(), SWhite);
WString txt = "皆の日本語";
Font fnt[4] = { StdFont(30), Arial(30), Roman(30), Courier(30) };
for(int i = 0; i < 4; i++) {
Size sz = GetTextSize(txt, fnt[i]);
w.DrawRect(10, 100 + 50 * i, sz.cx, sz.cy, LtGray());
w.DrawText(10, 100 + 50 * i, txt, fnt[i]);
}
}
So it seems to return correct values for StdFont (which in fact is Tahoma) and Courier, wrong values for Arial, Times New Roman...
Damn it...
Mirek
|
|
|
Re: FileSel bug when displaying Han characters [message #15029 is a reply to message #15028] |
Wed, 26 March 2008 13:31 |
|
mirek
Messages: 14038 Registered: November 2005
|
Ultimate Member |
|
|
Just a bit improved testcase, to show it should work (with non-ASCII roman chars):
void MyApp::Paint(Draw& w)
{
w.DrawRect(GetSize(), SWhite);
WString txt = "?????";
for(int q = 0; q < 2; q++) {
Font fnt[4] = { StdFont(30), Arial(30), Roman(30), Courier(30) };
for(int i = 0; i < 4; i++) {
Size sz = GetTextSize(txt, fnt[i]);
w.DrawRect(10 + q * 250, 100 + 50 * i, sz.cx, sz.cy, LtGray());
w.DrawText(10 + q * 250, 100 + 50 * i, txt, fnt[i]);
}
txt = "ÈŠÌŠÈìšèìšè";
}
}
Mirek
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 08:14:27 CEST 2024
Total time taken to generate the page: 0.03788 seconds
|