Re: [Mono-list] Understanding a bit how things work

2012-03-03 Thread Carlos Alberto Cortez
Probably the Deployment page is a good starting point:

http://www.mono-project.com/Guidelines:Application_Deployment

2012/3/3 Charles Krinke charles.kri...@gmail.com

 I have worked with mono before but it has been a little while and I
 now have a Windows project including a solution file and I can open
 and partially compile that project in mono-develop. I can also invoke
 gmcs from a command line and see there is a /usr/bin/mono/ directory.
 So far so good.

 I am searching for a few clues on how packages are installed and
 searched with mono as I need to understand how to use (or wean)
 WinForms, DirectX and slimDX in this new project.

 Perhaps this is all written down in wiki's somewhere and I have been
 googling a bit, so some search terms (other then mono or go to
 http://mono-project.com which I have already done) are a helpful
 answer.

 I think part of the answer is going to be how does gac work? as I
 think that is part of what allows one to bring in various packages.

 In any case, I am searching for a few ends in the big ball of string
 that I can follow and increase my understanding as I embark on a mono
 project that contains WinForms and DirectX.

 --
 Charles Krinke
 ___
 Mono-list maillist  -  Mono-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-list

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Understanding a bit how things work

2012-03-03 Thread Carlos Alberto Cortez
Hey,


2012/3/3 Charles Krinke charles.kri...@gmail.com

 Thank you Carlos, I will get another cup of coffee and go through
 Guidelines:Application_Deployment.

 In the meantime, let me ask two more focused questions.

 1. Given a VS2008 studio project with a .SLN and .CPROG file which
 loads in monodevelop and at least partially compiles to the first
 using error, how can I compile the same project from a bash command
 line with gmcs in mono, or can I ?


You need to use 'xbuild'. You can try with something like 'xbuild
myproj.csproj'


 2. The compilation in monodevelop fails at the first using SlimDX.
 Is there a package in mono that supports SlimDX in Linux or is the
 source going to have to be re-worked to change this dependency to
 something else and if so, what might the something else be?

 Charles Krinke


What's the complete error message? There can be a lot of things happening
there.



 On Sat, Mar 3, 2012 at 9:54 AM, Carlos Alberto Cortez
 calberto.cor...@gmail.com wrote:
  Probably the Deployment page is a good starting point:
 
  http://www.mono-project.com/Guidelines:Application_Deployment
 
  2012/3/3 Charles Krinke charles.kri...@gmail.com
 
  I have worked with mono before but it has been a little while and I
  now have a Windows project including a solution file and I can open
  and partially compile that project in mono-develop. I can also invoke
  gmcs from a command line and see there is a /usr/bin/mono/ directory.
  So far so good.
 
  I am searching for a few clues on how packages are installed and
  searched with mono as I need to understand how to use (or wean)
  WinForms, DirectX and slimDX in this new project.
 
  Perhaps this is all written down in wiki's somewhere and I have been
  googling a bit, so some search terms (other then mono or go to
  http://mono-project.com which I have already done) are a helpful
  answer.
 
  I think part of the answer is going to be how does gac work? as I
  think that is part of what allows one to bring in various packages.
 
  In any case, I am searching for a few ends in the big ball of string
  that I can follow and increase my understanding as I embark on a mono
  project that contains WinForms and DirectX.
 
  --
  Charles Krinke
  ___
  Mono-list maillist  -  Mono-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-list
 
 



 --
 Charles Krinke

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-dev] Mono Winforms on Mac

2010-10-30 Thread Carlos Alberto Cortez
Hello,

I will step up, since I have more experience on the code, but based on its
size, I may be giving feedback piece by piece.

Carlos.

2010/10/30 Miguel de Icaza mig...@novell.com

 Hello Ralph,

 Does the Mono Project have it's own format utility? It would be nice
 to make all the code consistent no matter what that format is.


 We do not.   And I do agree with you that some of the practices on
 Windows.Forms were less than ideal, reading your patch made me realize that
 the Windows.Forms team created their own rules that did not really match the
 Mono guidelines and that this needs to be fixed.

 I am willing to change the formatting on the Windows.Forms codebase in
 about half the cases that your code did, but this is secondary to getting
 your patches reviewed and merged.

 In general, in open source, there is an unspoken rule that you always adapt
 your code to the upstream coding style.   This means that reviewing patches
 can focus on the actual substance of the problem instead of having to chase
 down the changes line-by-line.   The patch that I posted to the mailing list
 contains the cleaned up version of your patch after I removed all
 the superfluous changes that were still on it.

 But we are left with a jumbo patch with large changes and no explanation of
 what the change does, why it does it.   Ideally, you could resubmit the
 patches on a feature-by-feature basis, this would accelerate the review.
 As you noticed by the lack of participation on the thread, nobody really has
 stepped up to review the jumbo patch after I cleaned it up.   The changes
 are just too big as they are now.

 If nobody steps up, I will add it to my own list of tasks to do, but right
 now I am tied up for the next two weeks.

 Miguel


 On 10/30/10, Miguel de Icaza mig...@novell.com wrote:
  Hello Ralph,
 
  Have you given any consideration to providing a roadmap to your
 changes
  so that they can be individually reviewed?
 
  Since you reformatted the source code, it is not possible to apply
 the
  patches directly, we still have to apply every change by hand and it
 would
  be useful to have the different patches and changes reviewed
 independently.
 
  Miguel
 
  On Sat, Oct 30, 2010 at 10:34 AM, Ralph Leckett rleck...@gmail.com
 wrote:
 
  Attached is another set of updates for Mac Mono Winforms. My .net
  applications now work quite nicely with my changes to Mono.
 
  NativeWindow has been simplified to using Hwnd to provide the
  Handle-Window lookup. I have found that storing handles in Hashtable
  sometimes results in the handle being lost with the result being
  zombie windows. Replacing Hashtable with a linked list solved the
  problem. Placing the most recently used link at the head of the linked
  list maintains efficiency.
 
  MS Windows places paint events at the lowest priority with all other
  events preempting WM_PAINT. A separate queue (linked list in my case)
  for paint events is required for Mono to duplicate this effect.
 
  I find the exposure of method variables to outside objects without
  using properties to be one of the poorer coding practices used in
  Mono. Apart from that, I found Mono to be quite well written and a
  pleasure to work on.
 
  Ralph
 
  On 10/20/10, Ralph Leckett rleck...@gmail.com wrote:
   The namespaces in the code caused compile errors in one of my test
   environments so I had to remove them.
  
   Attached is an update to my updates to fix this problem:
   https://bugzilla.novell.com/show_bug.cgi?id=438281
  
   Ralph
  
   On 10/19/10, Miguel de Icaza mig...@novell.com wrote:
   Hello,
  
   I have created a diff file from the formatted sources that
 removes
   some of the other automatic changes that probably came out of some
   refactoring tool.   The patch itself can not be used directly
 against
   Mono's source code since it is still a diff from formatted to
   formatted,
   not from Mono to formatted.This means that we are going to have
 to
   apply every patch by hand.
  
   I personally like the changes that were made by the tool, like
   dropping the gratuitous overuse of namespaces in the
 Managed.Winforms
   code, and would love to plug those changes back in the future.
  
   In terms of how to get the changes merged, ideally, Ralph could
   review the attached file and provide a roadmap of what each of the
   changes do.   There are some that I suspect wont be controversial,
 for
   example:
  
* There is a refactoring of the Clipboard code, this seems
  straightforward, but it still needs a review.
  
* Some look like simple bug fixes, but it would be good to
  know what were they fixing (for example the ListView.cs
  changes).
  
   There are other pieces that look like they went through a lot of
   work, and a more detailed explanation of the changes would be
 useful,
   in
   this group, I would include:
  
* Hwnd.cs
  
* XplatUICarbon.cs
  
   There are 

Re: [Mono-dev] SerialPort and OnDataReceived event

2010-07-30 Thread Carlos Alberto Cortez
Hey,

This event is indeed not implemented. I began to implement it some time ago,
but due to some technical reasons I don't remember now -it was something
related to poll/select functions, likely), I didn't commit it (and now I
can't seem to find that patch).

And yes, we would accept patches in such case :-)

Carlos.

2010/7/30 Marcus Obst marcus.o...@etit.tu-chemnitz.de

 Hi!

 I was trying to run a .NET assembly generated by Microsoft tools under
 Mono (Linux).

 The application accesses the serial port and installs an event handler
 for the DataReceived event.  Unfortunately, this handler is never
 called!

 Digging into the sources of Mono/MCS (from svn) showed that this event
 is never raised in SerialPort.cs.

 As far as I can see, this is addressed by the bug report  323892
 (SerialDataReceived events/callbacks are not implemented) from 2007.

 (Even moma does not report this incompatibility since the event handler
 is implemented but the event itself is never raised)

 My question is now: is there any (technical) reason why this
 functionality is not implemented in Mono?

 Are you interested in a patch which might fix this?

  Best regards from Chemnitz/Germany!
  Marcus
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] Odd StatusStrip.PreferredSize behavior

2010-05-17 Thread Carlos Alberto Cortez
Hello,

This seems to be a bug in our implementation. If you provide a test case (a
small one ideally) we can try to figure out what's happening.

Carlos.

2010/5/17 Mike Fried michaelbfr...@gmail.com

 I'm writing a program under Windows in Visual Studio (2008, switching to
 2010 soon) that will target Linux using Windows Forms and .NET Framework/CLR
 2, but I started testing under Mono and making changes to work around issues
 in Mono and in Mono under Linux only recently (using Ubuntu 10.4 and SUSE).

 I discovered a bunch of bugs that don't reproduce on Windows, many of which
 I could simply work around by switching off the System.Environment variable
 or working around in trivial ways, but I'm looking for a better solution in
 particular for one bug. The current bug that's biting me is that in a custom
 editor that I have written, I perform manual layout of the scrollbars and
 status bar, but when I go to get the PreferredSize from the StatusStrip in
 Mono (Windows and Linux), it returns (22, Height) and in .NET it returns
 (Width, 22).

 I took a peek at the source code to the Mono 2.6.4 branch of 
 StatusStriphttp://anonsvn.mono-project.com/viewvc/branches/mono-2-6-4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusStrip.cs?revision=155916sortby=fileand
 ToolStriphttp://anonsvn.mono-project.com/viewvc/branches/mono-2-6-4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs?revision=155916sortby=file
  to
 try and understand what's going on, and I tried a number of things without
 making some kind of test against the width or height to work around the
 preferred size being wrong, but I couldn't get the desired behavior. I've
 searched the web without finding anything else about this.

 Is this a known issue? Does anyone have any alternative APIs that they
 suggest I use instead? I'd like to fix this code and move on so that
 regardless of what kind of Fix mono takes later, it won't break my code in
 the future.

 Thanks,
 Mike Fried


 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] TreeView.TreeViewNodeSorter seem to have no effect

2010-04-17 Thread Carlos Alberto Cortez
Hey!

This should be fixed in rev 155655 (svn).

Thanks,
Carlos.

2010/3/24 Latif Khalifa lati...@radegastclient.org

 I finally managed to figure out under what circumstances the bug
 shows. I have a single root node, creatively labeled root. In that
 case TreeView ignores the sorter and sorts alphabetically. Here is my
 simple Compare() that is supposed to sort nodes in reverse
 alphabetical order:

public class SorterClass : System.Collections.IComparer
{
public int Compare(object a, object b)
{
int res = string.Compare(((TreeNode)a).Text,
 ((TreeNode)b).Text);
res *= -1;
return res;
}
}

 And here is a short example that creates TreeView:

invTree = new TreeView();
invTree.Dock = DockStyle.Fill;
invTree.TreeViewNodeSorter = new SorterClass();
Controls.Add(invTree);

TreeNode root = new TreeNode(My root);
invTree.Nodes.Add(root);

for (char c = 'A'; c = 'Z'; c++)
{
TreeNode n = new TreeNode();
n.Text = c.ToString();
n.Name = c.ToString();
for (int i=0; i20; i++)
{
TreeNode inside = new TreeNode(i.ToString());
n.Nodes.Add(inside);
}
root.Nodes.Add(n);
}

invTree.Sort();

 Two observed behaviors differ from .net

 1) Bug, Setting TreeViewNodeSorter has no effect if there is only one
 top level node. (actually it does have an effect of turning on
 sorting, just that the Compare() is never called and sorting is done
 by a default system function).
 2) Different behavior. On Windows under .NET one does not need to
 explicitly call Sort(). Nodes are sorted as they are inserted.

 Latif

 On Tue, Mar 23, 2010 at 7:03 PM, Carlos Alberto Cortez
 calberto.cor...@gmail.com wrote:
  Hey!
  I tested this on those same versions, and I cannot get the error. Could
 you
  cook a small test case?
  Carlos.
 
  2010/3/23 Latif Khalifa lati...@radegastclient.org
 
  Hello,
 
  I have had this problem with both 2.4.2.3 and 2.6.3. Identical code
  works on .net side, in mono's TreeView sorting is always alphabetic
  and my Compare() never gets called.
 
  Latif
 
 
  On Tue, Mar 23, 2010 at 4:00 PM, Carlos Alberto Cortez
  calberto.cor...@gmail.com wrote:
   Hey,
   This should be working. Maybe you hit a bug, but it seems, based on
 the
   other information, that you are using an old version. Take a look at
   that
   and let us know.
   Carlos.
  
   2010/3/23 Latif Khalifa lati...@radegastclient.org
  
   Hi,
  
   I'm trying to cure a few last quirks an an application I'm porting
   from windows. The problem I'm having is that setting
   TreeView.TreeViewNodeSorter seem to have no effect. The nodes gets
   sorted alphabetically and Compare() in my IComparer class never gets
   called. Any ideas?
  
   Also TreeView seem to be missing [+] and [-] images next to the nodes
   that can be expanded and collapsed.
  
   Latif
   ___
   Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
   http://lists.ximian.com/mailman/listinfo/mono-winforms-list
  
  
 
 

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] [PATCH] Bug 494234: XplatUIX11.WorkingArea can segfault if the WM does not support _NET_WORKAREA

2010-04-08 Thread Carlos Alberto Cortez
Hey,

The change seems fine, but we need to test it. Will do that this weekend.

Thanks,
Carlos.

2010/4/3 Brian Pellin bpel...@gmail.com

 Is there anything I can do to encourage applying the patch in Bug
 494234? [1]  I get a segfault every time I run KeePass[2] in the
 xmonad[3] window manager, because it does not support _NET_WORKAREA.
 This patch fixes it for me.

 Thanks,
 Brian

 [1] https://bugzilla.novell.com/show_bug.cgi?id=494234
 [2] http://downloads.sourceforge.net/keepass/KeePass-2.10.zip
 [3] http://xmonad.org/
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] Transparency Problem

2010-04-06 Thread Carlos Alberto Cortez
Hey,

On my machine (openSuse 11.1) using 2.4/2.6 series it works fine. Basically
our code tries to detect a property in the window manager to detect whether
there's transparency support or not. So it should work *at least* in Linux.

Could you elaborate more so we can try to figure out what's happening?

Carlos.

2010/4/3 Natalia Portillo clau...@claunia.com

 I had the same problem.

 Tried in Mac OS X (both Carbon and X11), no success. Of course both Carbon
 and X11 do support transparency, overlays and OpenGL (AGL and XGL
 respectively).
 Tried in Linux, no success. KDE4 transparencies and effects are working.
 The X.Org configuration file contains the values indicated by Mono
 documentation.

 I found no solution at all.

 El 03/04/2010, a las 14:13, Tommi Laukkanen escribió:

 Hi

 I think X-window also has some options which affect the transparency
 support. You might need to enable transparency supporting window manager /
 theme to be able to use transparencies.

 -tommi

 On Sat, Apr 3, 2010 at 3:39 PM, Stefano Del Furia de...@edudotnet.itwrote:

  HI,
 i have found that the Opacity works if the graphic card support 3d
 acceleration, but i haven'r find any way of getting TransparencyKey to
 works.
 Is this feature has been implemented in Winforms or not ??
 Thanks in advance
 Stefano


 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list



 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] TreeView.TreeViewNodeSorter seem to have no effect

2010-03-23 Thread Carlos Alberto Cortez
Hey,

This should be working. Maybe you hit a bug, but it seems, based on the
other information, that you are using an old version. Take a look at that
and let us know.

Carlos.

2010/3/23 Latif Khalifa lati...@radegastclient.org

 Hi,

 I'm trying to cure a few last quirks an an application I'm porting
 from windows. The problem I'm having is that setting
 TreeView.TreeViewNodeSorter seem to have no effect. The nodes gets
 sorted alphabetically and Compare() in my IComparer class never gets
 called. Any ideas?

 Also TreeView seem to be missing [+] and [-] images next to the nodes
 that can be expanded and collapsed.

 Latif
 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] TreeView.TreeViewNodeSorter seem to have no effect

2010-03-23 Thread Carlos Alberto Cortez
Hey!

I tested this on those same versions, and I cannot get the error. Could you
cook a small test case?

Carlos.

2010/3/23 Latif Khalifa lati...@radegastclient.org

 Hello,

 I have had this problem with both 2.4.2.3 and 2.6.3. Identical code
 works on .net side, in mono's TreeView sorting is always alphabetic
 and my Compare() never gets called.

 Latif


 On Tue, Mar 23, 2010 at 4:00 PM, Carlos Alberto Cortez
 calberto.cor...@gmail.com wrote:
  Hey,
  This should be working. Maybe you hit a bug, but it seems, based on the
  other information, that you are using an old version. Take a look at that
  and let us know.
  Carlos.
 
  2010/3/23 Latif Khalifa lati...@radegastclient.org
 
  Hi,
 
  I'm trying to cure a few last quirks an an application I'm porting
  from windows. The problem I'm having is that setting
  TreeView.TreeViewNodeSorter seem to have no effect. The nodes gets
  sorted alphabetically and Compare() in my IComparer class never gets
  called. Any ideas?
 
  Also TreeView seem to be missing [+] and [-] images next to the nodes
  that can be expanded and collapsed.
 
  Latif
  ___
  Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-winforms-list
 
 

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Wrong icons on OpenSuse, right on Ubuntu

2010-03-01 Thread Carlos Alberto Cortez
Hey Pablo,

What version of OpenSuse are you using? I'm trying 11.1 and it's working
fine. Also, any chance to attach a screenshot?

Carlos.

2010/3/1 pablosantosl...@terra.es pablosantosl...@terra.es

 Hi there,

 We're experiencing some graphical issues with Plastic on OpenSuse
 (latest) while they work well on Ubuntu (latest).

 Message boxes (and dialogs) without icon (we don't set them) show up
 without icon on Ubuntu (as they do on Windows) but display a weird
 default one on OpenSuse.

 Any idea why?

 Thanks,

 pablo
 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] TextBox bugs

2010-02-26 Thread Carlos Alberto Cortez
Hey Dick!

I will take a look at them this weekend.

Carlos.

2010/2/26 Dick Porter dpor...@codicesoftware.com

 Hi all

 I recently submitted a couple of bugs to do with keyboard handling in
 TextBox:

 https://bugzilla.novell.com/show_bug.cgi?id=582691 - Return key works
 intermittently in TextBox

 https://bugzilla.novell.com/show_bug.cgi?id=582703 - Pressing Command
 key in TextBox activates context menu but does not show it

 The second one is especially irritating when it happens, as it can
 delete the entire contents of the TextBox.

 Is anyone looking at these?  If not, can anyone give me some pointers as
 to where I might start trying to fix them myself?  I've figured out what
 I think are the causes, but I'm now at a dead-end in the depths of the
 MWF code.

 Thanks,

 - Dick


 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Graphics.FromHwnd(IntPtr.Zero) not working

2010-02-09 Thread Carlos Alberto Cortez
Hello,

This method is defined basically to retrieve available information in the
Graphics instance, not to do actual draw work on the screen (this could be
accomplished by a different way, but it would be system specific, as nothing
like that appears in the winforms api).

Carlos.

2010/2/7 Stefano Del Furia de...@edudotnet.it

  Hi,
 i'm using Graphics.FromHwnd(IntPtr.Zero) for drawing directly on screen but
 under Ubuntu 9.04 it don't work.
 The method don't return a null value but when i try to draw some object
 like a a line nothing happened like in this way:

   Graphics g = Graphics.FromHwnd(IntPtr.Zero);
 Point pMousePos = new Point(e.X, e.Y);
 g.DrawLine(p, pMousePos, lastPoint);

 What am i wrong ??
 Thanks in advance.
 Stefano

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] [Bug 575813] FileStream doesn't handle errors on Close (disk full, generic error, etc.)

2010-02-08 Thread Carlos Alberto Cortez
Hey!

I was taking a look and the issue is not reproducible in trunk, since
r145271 seems to fix it indirectly, by calling MonoIO.Write until *all* the
bytes have been written.

At least it fixes the very specific scenario described in the bug report,
and since that revision is expected to be backported, we should at least do
it.

Carlos.

2010/2/6 Miguel de Icaza mig...@novell.com

   I've filed a somewhat nasty bug a few days back (you may lose your data
   if you trigger it): https://bugzilla.novell.com/show_bug.cgi?id=575813
  
   I'd really appreciate if someone could take a look at this.
 
  BUMP!  Doesn't anyone think it's a critical bug?

 The fix is trivial, the side effects are far reaching and any fix will
 require a careful review of those side effects.

 I would not expect a resolution any time soon.

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [Bug 575813] FileStream doesn't handle errors on Close (disk full, generic error, etc.)

2010-02-05 Thread Carlos Alberto Cortez
I will take a look at it in the next days.

Carlos.

2010/2/5 Alex Shulgin alexander.shul...@yessoftware.com

 Alex Shulgin wrote:
  Hi,
 
  I've filed a somewhat nasty bug a few days back (you may lose your data
  if you trigger it): https://bugzilla.novell.com/show_bug.cgi?id=575813
 
  I'd really appreciate if someone could take a look at this.

 BUMP!  Doesn't anyone think it's a critical bug?

 --
 Alex

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono 2.6.x

2010-02-02 Thread Carlos Alberto Cortez
#569535 has been already backported, so it should appear in the next
release.

Carlos.

2010/2/2 Kris Ray k...@landmarkdigital.com


 I would like to vote for backports of the following bugs, which are already
 fixed in trunk:

 https://bugzilla.novell.com/show_bug.cgi?id=565149
 https://bugzilla.novell.com/show_bug.cgi?id=569535

 Both of these bug fixes are critical for our needs.

 thanks,
 Kris



 On Tue, 2010-02-02 at 11:57 -0600, Andrew Jorgensen wrote:


 Hello Happy Coders,


 We are planning to make a new release from the 2.6 branch in the near
 future (probably before the end of the month?).  If there are bugs that
 you know ought to be backported (customer issues, regressions, and
 embarrassments especially) please do so in the next week or so.

 As you backport please keep in mind that we are trying to stabilize the
 2.6 branch.  Be conscientious and thorough and use your own best
 judgment in your area of expertise and consult your colleagues where you
 have doubts.  Also don't neglect other platforms like Mac, Windows, and
 Linux s390x.  2.6.x will eventually be used as a Novell-supported
 release for the Mono Extension for SLE and other products.

 We will be doing some testing of the 2.6 branch during this time.  If QA
 approaches you regarding a bug please remember that we will also need
 time to verify the fix after you check it in.  In other words: please
 give us any priority you can.  And don't forget to close bugs as you fix
 them and file them as you find them.

 Hmm, I should get someone to fix the booc crasher on x86_64...  Oh and
 thanks so much to those who pitched in to get our Xen x86_64 crasher
 fixed!


 Best Regards,

 Andrew Jorgensen
 Release / Packaging Guy
 Novell, Inc.

 __
 _
 Mono-devel-list mailing 
 listmono-devel-l...@lists.ximian.comhttp://lists.ximian.com/mailman/listinfo/mono-devel-list



 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] Runtime error accessing Icons in Resources

2010-01-26 Thread Carlos Alberto Cortez
This seems to be a resources issue. Would it be possible to get the code
producing this error, so we could test what's happening?

Carlos.

2010/1/18 georgec giorgos.constanti...@gmail.com


 The following code is running fine on .NET but produces a runtime error
 with
 Mono:

1:   relationsTreeView.ImageList = new ImageList();
2:   relationsTreeView.ImageList.Images.Add(Resources.nodeIcon);

 This error exists in all the cases that I reference images and icons from
 the Resources as specified in VS 2008.
 Is there something that I am missing?
 (also MoMA did not find any problems with my code compatibility on mono)

 The following error is reported:

 Unhandled Exception: System.Reflection.TargetInvocationException: Exception
 has
 been thrown by the target of an invocation. ---
 System.ComponentModel.Win32Exce
 ption: No valid icon entry were found.
  at System.Drawing.Icon.InitFromStreamWithSize (System.IO.Stream stream,
 Int32
 width, Int32 height) [0x0056e] in
 C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2
 .3\mcs\class\System.Drawing\System.Drawing\Icon.cs:807
  at System.Drawing.Icon..ctor
 (System.Runtime.Serialization.SerializationInfo i
 nfo, StreamingContext context) [0x000b2] in
 C:\cygwin\tmp\monobuild\build\BUILD\
 mono-2.4.2.3\mcs\class\System.Drawing\System.Drawing\Icon.cs:229
  at (wrapper managed-to-native)
 System.Reflection.MonoCMethod:InternalInvoke (o
 bject,object[],System.Exception)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags
 invok
 eAttr, System.Reflection.Binder binder, System.Object[] parameters,
 System.Globa
 lization.CultureInfo culture) [0x000a6] in
 C:\cygwin\tmp\monobuild\build\BUILD\m
 ono-2.4.2.3\mcs\class\corlib\System.Reflection\MonoMethod.cs:444
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags
 invok
 eAttr, System.Reflection.Binder binder, System.Object[] parameters,
 System.Globa
 lization.CultureInfo culture) [0x000b8] in
 C:\cygwin\tmp\monobuild\build\BUILD\m
 ono-2.4.2.3\mcs\class\corlib\System.Reflection\MonoMethod.cs:450
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[]
 par
 ameters) [0x0] in
 C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class
 \corlib\System.Reflection\MethodBase.cs:111
  at System.Runtime.Serialization.ObjectRecord.LoadData
 (System.Runtime.Serializ
 ation.ObjectManager manager, ISurrogateSelector selector, StreamingContext
 conte
 xt) [0x000d7] in
 C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corl
 ib\System.Runtime.Serialization\ObjectManager.cs:578
  at System.Runtime.Serialization.ObjectManager.DoFixups () [0x00066] in
 C:\cygw

 in\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\System.Runtime.Serial
 ization\ObjectManager.cs:84
  at
 System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject
 (System.IO.BinaryReader reader) [0xf] in
 C:\cygwin\tmp\monobuild\build\BUILD

 \mono-2.4.2.3\mcs\class\corlib\System.Runtime.Serialization.Formatters.Binary\Ob
 jectReader.cs:115
  at
 System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph
  (System.IO.BinaryReader reader, Boolean readHeaders, System.Object
 result,
 Sys
 tem.Runtime.Remoting.Messaging.Header[] headers) [0x00041] in
 C:\cygwin\tmp\mon
 obuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\
 System.Runtime.Serialization.Fo
 rmatters.Binary\ObjectReader.cs:99
  at
 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeser
 ialize (System.IO.Stream serializationStream,
 System.Runtime.Remoting.Messaging.
 HeaderHandler handler) [0x00076] in
 C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4

 .2.3\mcs\class\corlib\System.Runtime.Serialization.Formatters.Binary\BinaryForma
 tter.cs:177
  at
 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
 (System.IO.Stream serializationStream) [0x0] in
 C:\cygwin\tmp\monobuild\buil
 d\BUILD\mono-2.4.2.3\mcs\class\corlib\
 System.Runtime.Serialization.Formatters.Bi
 nary\BinaryFormatter.cs:134
  at System.Resources.ResourceReader.ReadNonPredefinedValue (System.Type
 exp_typ
 e) [0x0] in
 C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corli
 b\System.Resources\ResourceReader.cs:397
  at System.Resources.ResourceReader.ReadValueVer2 (Int32 type_index)
 [0x001f3]
 in

 C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\System.Reso
 urces\ResourceReader.cs:355
  at System.Resources.ResourceReader.LoadResourceValues
 (.ResourceCacheItem[] st
 ore) [0x00076] in
 C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\cor
 lib\System.Resources\ResourceReader.cs:433
  at System.Resources.ResourceReader+ResourceEnumerator.FillCache ()
 [0x00049] i
 n

 C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4.2.3\mcs\class\corlib\System.Resou
 rces\ResourceReader.cs:686
  at System.Resources.ResourceReader+ResourceEnumerator..ctor
 (System.Resources.
 ResourceReader 

Re: [Mono-dev] Fwd: Could you please review/comment or approve?

2010-01-22 Thread Carlos Alberto Cortez
Hey!

Sorry for the late review, but these patches got lost among a bunch of other
patches to review. Anyway, the patches are fine.

Thanks for taking a look at that,
Carlos.


2010/1/22 Leszek Ciesielski skol...@gmail.com

 Both patches (Thad's and mine) commited.

 On Thu, Jan 21, 2010 at 6:32 PM, Miguel de Icaza mig...@novell.com
 wrote:
  Hello,
 
Let us get it in, ad if Carlos disapproves, he can comment/fix later.
 
  I'm pushing this patch for review once again... Or may I treat the
  silence as permission to commit? ;-)
 
 
  -- Forwarded message --
  From: Miguel de Icaza mig...@novell.com
  Date: Sun, Nov 22, 2009 at 10:46 PM
  Subject: Could you please review/comment or approve?
  To: Carlos Alberto Cortez calberto.cor...@gmail.com
  Cc: skol...@gmail.com
 
 
  Hello Carlos,
 
 Could you please review this patch that has been sitting on
  mono-devel-list?
 
 
 
 
  -- Forwarded message --
  From: Leszek Ciesielski skol...@gmail.com
  To: mono-devel-list mono-devel-l...@ximian.com
  Date: Mon, 12 Oct 2009 08:55:44 +0200
  Subject: [Mono-dev] Fwd: SerialPortStream patch
  I am mailing the patches again, because I got no response before (it
  was just before Mono 2.6 branching).
 
 
  -- Forwarded message --
  From: Leszek Ciesielski skol...@gmail.com
  Date: 2009/9/23
  Subject: Re: [Mono-dev] SerialPortStream patch
  To: mono-devel-list@lists.ximian.com
 
 
  Hi,
 
  here's another short patch for serial port, there were other native
  calls not checking for error conditions. May I commit?
 
  Regards,
 
  skolima
 
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] Native Menu Bars in Winforms on OSX

2010-01-21 Thread Carlos Alberto Cortez
The support for this hasn't been implemented in winforms, and we don't have
plans to implement it in a near future. Patches are accepted, however ;-)

Carlos.

2010/1/20 Daniel Rosenstark dr.public.dev...@confusionists.com

 I think I may have asked this before: it is totally absurd that Winforms
 apps should run on OSX without being able to have normal menu bars like
 every other application. Even in Java I've managed to do this


 http://stackoverflow.com/questions/2061194/swing-on-osx-how-to-trap-command-q

 and I know that GTK# apps do it.

 How can I do this on Winforms?

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] gnome white font color and mono WinForm issue..

2010-01-07 Thread Carlos Alberto Cortez
We had an issue but it was only happening for ToolStrip menus. Is that the
case, or is it happening with other controls as well? I remember testing
extensively with dark themes and the only issue was related to ToolStrip
(which has been fixed in 2.4/2.6/trunk, but didn't make it in the version
you have).

As Stifu mentioned, you can force the controls using the ForeColor property
(that applies as well for ToolStrip). Otherwise, there's no way to force our
theme engine to *not* detect the system colors unfortunately (given a gnome
session running).

Carlos.

2010/1/7 buhochile...@gmail.com buhochil...@gmail.com

 Hi guys,

 I have strage behaviour of mono Winform in a gnome theme that put most of
 the font colour used by the system in white.

 The gnome theme is mostly black, so all of the fonts in the desktop are
 white (gnome bar, menus and so on...), the problem is when I run a mono
 winform app, since the mono winform windows don't take the gnome theme (it
 don't get blackish it keeps the regular winform colors), but the winform
 fonts it do take the white colour of the gnome theme and of course white on
 a gray winfor window is hard to see/read...

 So, I know that mono winform currently don't apply the gnome theme, that's
 ok, but I want that the winform don't take the font color neither to keep
 the regular black font color in the gray winform window.

 any way to chage/force that?, or I forced to use a black font theme...?

 I currently using mono and libgdiplus at version 2.4.2-3 on a fedora 12
 machine...

 Thanks.

 Mauricio


 P.S: Please don't tell me to update to mono 2.6 to see if is fixed :-)

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] gnome white font color and mono WinForm issue..

2010-01-07 Thread Carlos Alberto Cortez
Not in the last release sadly, as it was committed after the release. So I
take for granted is only happening with ToolStrip?

One possible workaround is to set DESKTOP_SESSION to any string starting
with 'KDE' - this way our theme engine will try to detect the KDE settings
(will print a warning if it couldn't find the libs). This way the winforms
app will not be loading the gnome settings, and it should work 'fine'
(remember to set this env var only in the terminal where you execute your
winforms app ;-) ) Try something like:

env DESKTOP_SESSION=KDE mono MyApp.exe

Carlos.

2010/1/7 buhochile...@gmail.com buhochil...@gmail.com

  On 01/07/2010 11:05 AM, Carlos Alberto Cortez wrote:

 We had an issue but it was only happening for ToolStrip menus. Is that the
 case, or is it happening with other controls as well?

 yeap, all kind of winform controls like texboxes, menus, labels, etc...

 I remember testing extensively with dark themes and the only issue was
 related to ToolStrip (which has been fixed in 2.4/2.6/trunk, but didn't make
 it in the version you have).

 As Stifu mentioned, you can force the controls using the ForeColor property
 (that applies as well for ToolStrip). Otherwise, there's no way to force our
 theme engine to *not* detect the system colors unfortunately (given a gnome
 session running).

 sadly is a complex and large app to change the code to force a forecolor,
 and is not ideal to change the code just for that since the current code
 works ok on windows with .net and themes, so it going to need compiler
 conditions, etc..

 So, this supose to be fixed in mono 2.6 then?

 thanks

 Mauricio



 Carlos.

 2010/1/7 buhochile...@gmail.com buhochil...@gmail.com

 Hi guys,

 I have strage behaviour of mono Winform in a gnome theme that put most of
 the font colour used by the system in white.

 The gnome theme is mostly black, so all of the fonts in the desktop are
 white (gnome bar, menus and so on...), the problem is when I run a mono
 winform app, since the mono winform windows don't take the gnome theme (it
 don't get blackish it keeps the regular winform colors), but the winform
 fonts it do take the white colour of the gnome theme and of course white on
 a gray winfor window is hard to see/read...

 So, I know that mono winform currently don't apply the gnome theme, that's
 ok, but I want that the winform don't take the font color neither to keep
 the regular black font color in the gray winform window.

 any way to chage/force that?, or I forced to use a black font theme...?

 I currently using mono and libgdiplus at version 2.4.2-3 on a fedora 12
 machine...

 Thanks.

 Mauricio


 P.S: Please don't tell me to update to mono 2.6 to see if is fixed :-)

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list




 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] gnome white font color and mono WinForm issue..

2010-01-07 Thread Carlos Alberto Cortez
Ah! I missed that info.

Buho: would you mind supplying the dark theme you are using? I already tried
several dark themes from art.gnome.org and the only control having issues
was ToolStrip.

Carlos.

2010/1/7 Stifu st...@free.fr


 Mauricio: you could just add a runtime condition.
 Like: if (Type.GetType(System.MonoType, false) != null) { Form1.ForeColor
 = Color.Black; }

 Carlos: not just the ToolStrip, from what he says, but all controls.


 Carlos Alberto wrote:
 
  Not in the last release sadly, as it was committed after the release. So
 I
  take for granted is only happening with ToolStrip?
 
  One possible workaround is to set DESKTOP_SESSION to any string starting
  with 'KDE' - this way our theme engine will try to detect the KDE
 settings
  (will print a warning if it couldn't find the libs). This way the
 winforms
  app will not be loading the gnome settings, and it should work 'fine'
  (remember to set this env var only in the terminal where you execute your
  winforms app ;-) ) Try something like:
 
  env DESKTOP_SESSION=KDE mono MyApp.exe
 
  Carlos.
 
  2010/1/7 buhochile...@gmail.com buhochil...@gmail.com
 
   On 01/07/2010 11:05 AM, Carlos Alberto Cortez wrote:
 
  We had an issue but it was only happening for ToolStrip menus. Is that
  the
  case, or is it happening with other controls as well?
 
  yeap, all kind of winform controls like texboxes, menus, labels, etc...
 
  I remember testing extensively with dark themes and the only issue was
  related to ToolStrip (which has been fixed in 2.4/2.6/trunk, but didn't
  make
  it in the version you have).
 
  As Stifu mentioned, you can force the controls using the ForeColor
  property
  (that applies as well for ToolStrip). Otherwise, there's no way to force
  our
  theme engine to *not* detect the system colors unfortunately (given a
  gnome
  session running).
 
  sadly is a complex and large app to change the code to force a
 forecolor,
  and is not ideal to change the code just for that since the current code
  works ok on windows with .net and themes, so it going to need compiler
  conditions, etc..
 
  So, this supose to be fixed in mono 2.6 then?
 
  thanks
 
  Mauricio
 
 
 
  Carlos.
 
  2010/1/7 buhochile...@gmail.com buhochil...@gmail.com
 
  Hi guys,
 
  I have strage behaviour of mono Winform in a gnome theme that put most
  of
  the font colour used by the system in white.
 
  The gnome theme is mostly black, so all of the fonts in the desktop are
  white (gnome bar, menus and so on...), the problem is when I run a mono
  winform app, since the mono winform windows don't take the gnome theme
  (it
  don't get blackish it keeps the regular winform colors), but the
 winform
  fonts it do take the white colour of the gnome theme and of course
 white
  on
  a gray winfor window is hard to see/read...
 
  So, I know that mono winform currently don't apply the gnome theme,
  that's
  ok, but I want that the winform don't take the font color neither to
  keep
  the regular black font color in the gray winform window.
 
  any way to chage/force that?, or I forced to use a black font theme...?
 
  I currently using mono and libgdiplus at version 2.4.2-3 on a fedora 12
  machine...
 
  Thanks.
 
  Mauricio
 
 
  P.S: Please don't tell me to update to mono 2.6 to see if is fixed :-)
 
  ___
  Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-winforms-list
 
 
 
 
  ___
  Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-winforms-list
 
 
 
  ___
  Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-winforms-list
 
 

 --
 View this message in context:
 http://old.nabble.com/gnome-white-font-color-and-mono-WinForm-issue..-tp27060097p27060992.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


[Mono-dev] [Patch] Support for exponents in Int32.Parse

2009-12-21 Thread Carlos Alberto Cortez
Hey!

I was going to commit the attached patch, in order to support exponent
notation in our Int32.Parse method (as declared in
NumberStyles.AllowExponent). But then I thought it would be a good idea to
throw the patch to the public, in case somebody is interested - specially in
the overflow handling.

Carlos.
Index: Int32.cs
===
--- Int32.cs	(revisión: 148618)
+++ Int32.cs	(copia de trabajo)
@@ -274,21 +274,52 @@
 			} 
 		}
 
-		internal static bool FindExponent (ref int pos, string s)
+		internal static bool FindExponent (ref int pos, string s, ref int exponent, bool tryParse, ref Exception exc)
 		{
+exponent = 0;
+long exp = 0; // temp long value
+
 int i = s.IndexOfAny(new char [] {'e', 'E'}, pos);
-if (i  0)
-		return false;
-if (++i == s.Length)
-		return false;
-if (s [i] == '+' || s [i] == '-')
-		if (++i == s.Length)
-return false;
-if (!Char.IsDigit (s [i]))
-		return false;
-for (; i  s.Length; ++i)
-		if (!Char.IsDigit (s [i])) 
-break;
+if (i  0) {
+	exc = null;
+	return false;
+}
+
+if (++i == s.Length) {
+	exc = tryParse ? null : GetFormatException ();
+	return true;
+}
+
+// negative exponent not valid for Int32
+if (s [i] == '-') {
+	exc = tryParse ? null : new OverflowException (Value too large or too small.);
+	return true;
+}
+
+if (s [i] == '+'  ++i == s.Length) {
+	exc = tryParse ? null : GetFormatException ();
+	return true;
+}
+
+for (; i  s.Length; i++) {
+	if (!Char.IsDigit (s [i]))  {
+		exc = tryParse ? null : GetFormatException ();
+		return true;
+	}
+
+	// Reduce the risk of throwing an overflow exc
+	exp = checked (exp * 10 - (int) (s [i] - '0'));
+	if (exp  Int32.MinValue || exp  Int32.MaxValue) {
+		exc = tryParse ? null : new OverflowException (Value too large or too small.);
+		return true;
+	}
+}
+
+// exp value saved as negative
+exp = -exp;
+
+exc = null;
+exponent = (int)exp;
 pos = i;
 return true;
 		}
@@ -430,6 +461,7 @@
 			bool decimalPointFound = false;
 			int digitValue;
 			char hexDigit;
+			int exponent = 0;
 
 			// Number stuff
 			do {
@@ -504,8 +536,9 @@
 return false;
 			}
 
-			if (AllowExponent) 
-	FindExponent(ref pos, s);
+			if (AllowExponent)
+if (FindExponent (ref pos, s, ref exponent, tryParse, ref exc)  exc != null)
+	return false;
 
 			if (AllowTrailingSign  !foundSign) {
 // Sign + Currency
@@ -561,6 +594,19 @@
 } else
 	number = checked (-number);
 			}
+
+			// result *= 10^exponent
+			if (exponent  0) {
+// Reduce the risk of throwing an overflow exc
+double res = checked (Math.Pow (10, exponent) * number);
+if (res  Int32.MinValue || res  Int32.MaxValue) {
+	if (!tryParse)
+		exc = new OverflowException (Value too large or too small.);
+	return false;
+}
+
+number = (int)res;
+			}
 			
 			result = number;
 
Index: Int32Test.cs
===
--- Int32Test.cs	(revisión: 148618)
+++ Int32Test.cs	(copia de trabajo)
@@ -235,6 +235,59 @@
 		Int32.Parse (123, new DateTimeFormatInfo ());
 	}
 
+	[Test]
+	public void TestParseExponent ()
+	{
+		Assert.AreEqual (2, Int32.Parse (2E0, NumberStyles.AllowExponent), A#1);
+		Assert.AreEqual (20, Int32.Parse (2E1, NumberStyles.AllowExponent), A#2);
+		Assert.AreEqual (200, Int32.Parse (2E2, NumberStyles.AllowExponent), A#3);
+		Assert.AreEqual (200, Int32.Parse (2E6, NumberStyles.AllowExponent), A#4);
+		Assert.AreEqual (200, Int32.Parse (2E+2, NumberStyles.AllowExponent), A#5);
+
+		try {
+			Int32.Parse (2E);
+			Assert.Fail (B#1);
+		} catch (FormatException) {
+		}
+
+		try {
+			Int32.Parse (2E3.0, NumberStyles.AllowExponent); // decimal notation for the exponent
+			Assert.Fail (B#2);
+		} catch (FormatException) {
+		}
+
+		try {
+			Int32.Parse (2E 2, NumberStyles.AllowExponent);
+			Assert.Fail (B#3);
+		} catch (FormatException) {
+		}
+
+		try {
+			Int32.Parse (2E2 , NumberStyles.AllowExponent);
+			Assert.Fail (B#4);
+		} catch (FormatException) {
+		}
+
+		try {
+			Int32.Parse (2E66, NumberStyles.AllowExponent); // final result overflow
+			Assert.Fail (B#5);
+		} catch (OverflowException) {
+		}
+
+		try {
+			long exponent = (long)Int32.MaxValue + 10;
+			Int32.Parse (2E + exponent.ToString (), NumberStyles.AllowExponent);
+			Assert.Fail (B#6);
+		} catch (OverflowException) {
+		}
+
+		try {
+			Int32.Parse (2E-1, NumberStyles.AllowExponent); // negative exponent
+			Assert.Fail (B#7);
+		} catch (OverflowException) {
+		}
+	}
+
 #if NET_2_0	
 	[Test]
 	public void TestTryParse()
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] menustrip

2009-12-14 Thread Carlos Alberto Cortez
With Mono  2.4/2.6/trunk it's working fine. Please update.

Carlos.

2009/12/14 andi ari twentyfirsta...@gmail.com

 Hi All,
 My name is Andi. Im a newbie
 it tried to run some lines of c# code using monodevelp on Ubuntu 8.10. Here
 are the codes

 using System;
 using System.Drawing;
 using System.Windows.Forms;

 class MForm : Form {

 public MForm() {
 Text = Submenu;

 MenuStrip ms = new MenuStrip();
 ms.Parent = this;

 ToolStripMenuItem file = new ToolStripMenuItem(File);

 ToolStripMenuItem exit = new ToolStripMenuItem(Exit, null,
 new EventHandler(OnExit));

 ToolStripMenuItem import = new ToolStripMenuItem();
 import.Text = Import;

 file.DropDownItems.Add(import);

 ToolStripMenuItem temp = new ToolStripMenuItem();
 temp.Text = Import newsfeed list...;
 import.DropDownItems.Add(temp);

 temp = new ToolStripMenuItem();

 temp.Text = Import bookmarks...;
 import.DropDownItems.Add(temp);

 temp = new ToolStripMenuItem();
 temp.Text = Import mail...;
 import.DropDownItems.Add(temp);

 file.DropDownItems.Add(exit);

 ms.Items.Add(file);
 MainMenuStrip = ms;
 Size = new Size(380, 200);

 CenterToScreen();
 }

 void OnExit(object sender, EventArgs e) {

Close();
 }
 }

 class MApplication {
 public static void Main() {
 Application.Run(new MForm());
 }
 }


 The result should appear like this:
 [image:
 ?ui=2view=attth=1258c0e8656b53f6attid=0.1disp=attdrealattid=ii_1258c0e8656b53f6zw]
 but in my machine the result didn't appear as it should be. here is the
 result of the code in my machine :
 [image:
 ?ui=2view=attth=1258c10c352b0e0cattid=0.1disp=attdrealattid=ii_1258c10c352b0e0czw]
 it seems that there is trouble with the font. how do I solve this problem?







 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Screenshot-Submenu.pngsubmenu.png___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] Announcing the release of Mono 2.4.3

2009-12-09 Thread Carlos Alberto Cortez
It was  indeed fixed. Sorry, I forgot to close that one.

Carlos.

2009/12/9 Oskar Berggren oskar.bergg...@gmail.com

 The release notes lists the following issue as fixed:
 467418 (https://bugzilla.novell.com/show_bug.cgi?id=467418) - ListView
 in VirtualMode uses too much memory and is slow

 But the bug report is still marked as NEW and there is no comment
 indicating that a fix has been checked in. What is the interpretation
 of this?

 /Oskar



 2009/12/9 Andrew Jorgensen ajorgen...@novell.com:
  Yesterday we released Mono 2.4.3.  This release contains a large number
  of bug fixes, including fixes for security bugs.
 
  The release notes are here:
 http://go-mono.com/archive/2.4.3
 
  and downloads are available here:
 http://go-mono.com/mono-downloads/
 
  We have not released LiveCD or Appliance images because we are working
  toward a 2.6 release in the near future.
 
  Thanks to all those who contributed to this release!
 
 
 
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-list] DataGridView databind

2009-11-30 Thread Carlos Alberto Cortez
Do you have a test case for this issue? This seems to be a bug, so we need a
test case to know what's happening there.

Carlos.

2009/11/30 Rıdvan Tülünay ridvantulu...@gmail.com

 I cannot bind DataGridView in MONO,
 throw this exceptions.

 System.ArgumentOutOfRangeException: Argument is out of range.
 Parameter name: Column index is out of range.
   at System.Windows.Forms.DataGridView.InvalidateCell (Int32 columnIndex,
 Int32 rowIndex) [0x00055] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:2858

   at System.Windows.Forms.DataGridView.InvalidateCell
 (System.Windows.Forms.DataGridViewCell dataGridViewCell) [0x00028] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:2845

   at (wrapper remoting-invoke-with-check)
 System.Windows.Forms.DataGridView:InvalidateCell
 (System.Windows.Forms.DataGridViewCell)
   at System.Windows.Forms.DataGridViewCell.SetValue (Int32 rowIndex,
 System.Object value) [0x00096] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs:1314

   at System.Windows.Forms.DataGridViewCell.set_Value (System.Object value)
 [0x0] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs:385

   at System.Windows.Forms.DataGridView.AddBoundRow (System.Object element)
 [0x00077] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:5859

   at System.Windows.Forms.DataGridView.DoBinding () [0x001d8] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:5953

   at System.Windows.Forms.DataGridView.ReBind () [0x00018] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:6110

   at System.Windows.Forms.DataGridView.set_DataMember (System.String value)
 [0x00023] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:715

   at (wrapper remoting-invoke-with-check)
 System.Windows.Forms.DataGridView:set_DataMember (string)
   at Ehil.DevForm.LoadControlProp (System.Windows.Forms.Control
 CurrentControl) [0x00069] in /home/ridvan/Projects/Ehil/Ehil/DevForm.cs:699
   at Ehil.DevForm.FrmDevNewDialog_Click (System.Object sender,
 System.EventArgs e) [0x00185] in
 /home/ridvan/Projects/Ehil/Ehil/DevForm.cs:311
   at System.Windows.Forms.ToolStripItem.OnClick (System.EventArgs e)
 [0x0001c] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs:999

   at System.Windows.Forms.ToolStripMenuItem.OnClick (System.EventArgs e)
 [0x000a5] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuItem.cs:262

   at System.Windows.Forms.ToolStripMenuItem.HandleClick (System.EventArgs
 e) [0x0] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuItem.cs:492

   at System.Windows.Forms.ToolStripItem.FireEvent (System.EventArgs e,
 ToolStripItemEventType met) [0x00042] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs:1776

   at (wrapper remoting-invoke-with-check)
 System.Windows.Forms.ToolStripItem:FireEvent
 (System.EventArgs,System.Windows.Forms.ToolStripItemEventType)
   at System.Windows.Forms.ToolStrip.OnMouseUp
 (System.Windows.Forms.MouseEventArgs mea) [0x00047] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs:959

   at System.Windows.Forms.ToolStripDropDown.OnMouseUp
 (System.Windows.Forms.MouseEventArgs mea) [0x0] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDown.cs:622

   at System.Windows.Forms.Control.WmLButtonUp
 (System.Windows.Forms.Message m) [0x00081] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5595

   at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message m)
 [0x0017c] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5332

   at System.Windows.Forms.ScrollableControl.WndProc
 (System.Windows.Forms.Message m) [0x0] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs:807

   at System.Windows.Forms.ToolStrip.WndProc (System.Windows.Forms.Message
 m) [0x0] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs:1211

   at System.Windows.Forms.ToolStripDropDown.WndProc
 (System.Windows.Forms.Message m) [0x0001c] in
 /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDown.cs:714

   at 

Re: [Mono-dev] [Patch] Report an error if src and dest are the same in Copy

2009-11-27 Thread Carlos Alberto Cortez
Yes - sorry, I forgot to send it with the previous patch ;-)

Carlos.

2009/11/27 Rodrigo Kumpera kump...@gmail.com

 Do you have a test case for that?


 On Fri, Nov 27, 2009 at 12:09 AM, Carlos Alberto Cortez 
 calberto.cor...@gmail.com wrote:

 Hey,

 The attached patch on CopyFile on our io-layer -which is used by
 System.IO.File.Copy- check if the source and the destination are the same,
 and in that case, report that the file is currently in use, and proceed to
 throw an exception. I tried to add this check directly in our C# side, but
 then moved the check to our io-layer side so we could take advantage of our
 IOMAP capability.

 Could anybody with experience in the io-layer review?

 Thanks!


 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list



Index: FileTest.cs
===
--- FileTest.cs	(revisión: 147032)
+++ FileTest.cs	(copia de trabajo)
@@ -343,6 +343,27 @@
 		}
 
 		[Test]
+		public void Copy_SourceFileName_DestFileName_Same ()
+		{
+			string source = TempFolder + Path.DirectorySeparatorChar + SameFile.txt;
+			DeleteFile (source);
+			try {
+// new empty file
+File.Create (source).Close ();
+try {
+	File.Copy (source, source, true);
+	Assert.Fail (#1);
+} catch (IOException ex) {
+	// process cannot access file ... because it is being used by another process
+	Assert.IsNull (ex.InnerException, #2);
+	Assert.IsTrue (ex.Message.IndexOf (source) != -1, #3);
+}
+			} finally {
+DeleteFile (source);
+			}
+		}
+
+		[Test]
 		public void Copy ()
 		{
 			string path1 = TempFolder + Path.DirectorySeparatorChar + bar;
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [Patch] Report an error if src and dest are the same in Copy

2009-11-26 Thread Carlos Alberto Cortez
Hey,

The attached patch on CopyFile on our io-layer -which is used by
System.IO.File.Copy- check if the source and the destination are the same,
and in that case, report that the file is currently in use, and proceed to
throw an exception. I tried to add this check directly in our C# side, but
then moved the check to our io-layer side so we could take advantage of our
IOMAP capability.

Could anybody with experience in the io-layer review?

Thanks!
Index: io-layer/io.c
===
--- io-layer/io.c	(revisión: 146913)
+++ io-layer/io.c	(copia de trabajo)
@@ -1954,7 +1954,7 @@
 {
 	gchar *utf8_src, *utf8_dest;
 	int src_fd, dest_fd;
-	struct stat st;
+	struct stat st, dest_st;
 	gboolean ret = TRUE;
 	
 	if(name==NULL) {
@@ -2020,6 +2020,20 @@
 		
 		return(FALSE);
 	}
+
+	/* Before trying to open/create the dest, we need to report a 'file busy'
+	 * error if src and dest are actually the same file. We do the check here to take
+	 * advantage of the IOMAP capability */
+	if (!_wapi_stat (utf8_dest, dest_st)  st.st_dev == dest_st.st_dev  
+			st.st_ino == dest_st.st_ino) {
+
+		g_free (utf8_src);
+		g_free (utf8_dest);
+		close (src_fd);
+
+		SetLastError (ERROR_SHARING_VIOLATION);
+		return (FALSE);
+	}
 	
 	if (fail_if_exists) {
 		dest_fd = _wapi_open (utf8_dest, O_WRONLY | O_CREAT | O_EXCL, st.st_mode);
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] Some Winforms Questions

2009-11-24 Thread Carlos Alberto Cortez
Hey!

I'm not our OSX expert, so I will leave those questions unanswered.


 3) The RichTextEditor in Winforms on Mono is mostly useless. Does GTK#
 provide something better? Or can anyone recommend any libraries for
 Winforms? I actually don't need richtext, but I do need undo, hyperlinks,
 indenting and bullets


What are the issues you were/are getting with RichTextBox? I fixed some
stuff there some months ago, so it should be working better now. Anyway, it
you find any error, please report it so we can fix it.

5) What is the present/future of Winforms on Mono for IPhone? Android?



No plans on the mobile segment for now.
___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Using Windows Forms over Linux

2009-11-18 Thread Carlos Alberto Cortez
Hey,

There are some limitations on our implementation of Windows.Forms, just as
any other re-implementation can have. We provide it however, to let
developers to bring their applications from .net to linux with Mono.

Now: if you are going to create a new app, then you can go with Gtk#, and
that's a different story, with its own advantages/disadvantages.

Carlos.

2009/11/18 StApostol stapos...@gmail.com

 Frankly, the best way to create a cross-platform GUI is to use GTK# from
 the beginning. With WinForms, you'll encounter several issues that will make
 things rather difficult down the road: flaky databinding, slow rendering
 (especially for grid views), inconsistent rendering between versions,
 inconsistent ordering of events (quite, eh, fun to debug), lack of theming.

 By far the best solution is to abstract the GUI away from the main
 application and use different technologies for different platforms (e.g. WPF
 on Windows, GTK# on Linux and Mac OS X). However, this takes a lot of
 resources and planning to implement correctly.

 The second best option is to use GTK# all the way. You'll trade some of the
 native look and feel for easier development (see e.g. MonoDevelop on
 Windows).

 The third option is to use WinForms everywhere, keeping in mind the caveats
 I mentioned. WinForms is not meant for cross-platform development - it has
 no native look and feel (unless you create custom widgets for everything,
 which is certainly an option) and it is painful even on Windows (try using
 native Vista fonts, for example or creating a DPI-independent GUI - that's
 right, you can't really do that). Finally, it's a pretty much dead
 technology that hasn't been updated in the last 5 years. (Yes, there are
 still good reasons for using it, as long as you keep the drawbacks in mind).

 Finally, it might be worth checking out Silverlight/Moonlight. These have a
 pretty nice development environment and can be used both online and offline
 (with a little work).

 My 2cc :)

 2009/11/18 Petit Eric surfz...@gmail.com

 2009/11/18 Dimitris Karantonis dkaranto...@soft4real.com:
  Hi,
 
  This is an interesting solution, but does it actually works? And what
 about
  maintenance through the application's lifecycle? Meaning, how do you
 handle
  situations when you want to add a new event?
 It work, i don't really practice it for professional, most for hobbies.
 I often hack by the hand the .Designer.cs file, rather restart a VM.

 
  Does Mono opens Visual Studio solutions and furthermore, does it compile
  Window Forms properties like anchoring, docking, etc...
 Compile is most good
 
  What about installing Win Forms Designer kit on your MonoProject IDE?
 Have
  you ever thought of this?
 I would like a winforms designer in MonoDevelop, Ivanz started working
 on it but 
 http://www.mono-project.com/WinForms_Designer
 http://www.mono-project.com/WinForms
 http://www.mono-project.com/Guide:_Porting_Winforms_Applications
 http://www.mono-project.com/Category:WinForms
 
  Regards,
  Dimitris
 
 
  -Original Message-
  From: Petit Eric [mailto:surfz...@gmail.com]
  Sent: Τετάρτη, 18 Νοεμβρίου 2009 12:28
  To: Dimitris Karantonis
  Cc: Mono-winforms-list@lists.ximian.com
  Subject: Re: [Mono-winforms-list] Using Windows Forms over Linux
 
  To write MonoOSC, i used VS C# express to design my winforms and
 generate
  needed event (through an VBox machine) and then i wrote all code/class
 with
  MonoDevelop under Linux :-)
 
  2009/11/18 Dimitris Karantonis dkaranto...@soft4real.com:
  Hi to all,
 
 
 
  I am new to .net development over Linux platforms (I have always used
  MS Visual Studio platform) and I would like to ask what is the best
  way of implementing a Window Forms application in order to be able to
  deploy it on both Windows and Linux OS.
 
 
 
  1)  Should i use MS visual Studio 2008 on my Windows Machine to
  develop the application and then use some tool in order to migrate
  the application to the Mono format?
 
  2)  Should i use a Mono plug-in for the MS Visual Studio platform
  and develop the application?
 
  3)  Should I use MonoDevelop on my Linux machine and install the
  Win Forms Designer toolkit?
 
 
 
  Could you give me some advices concerning what is the best way to
  follow and some instructions of how to implement it (meaning,
  instructions of how to install and use the Visual Studio - Mono
  migration tool, the Mono plug-in for VS Studio and the Win Forms
 Designer
  toolkit on MonoDevelop.
 
 
 
  Best regards,
 
  Dimitris
 
  ___
  Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-winforms-list
 
 
 
 
 
  --
   Cordially.
 
   Small Eric Quotations of the days:
 
  ---
   I have no special talents. I am only passionately curious
 
 
 



 --
  Cordially.

  Small Eric Quotations of 

Re: [Mono-winforms-list] [PATCH] For MouseClick Event in SWF

2009-10-27 Thread Carlos Alberto Cortez
Hey,


I will review the patch later, but there's no need to send the patch to the
mono develop list, since the change is related to windows.forms. Also, the
mono-patches list is used to receive/catch the changes in svn. Next time
send the patch to the winforms list, please.

Carlos.

2009/10/27 Petit Eric surfz...@gmail.com

 Hi
 Mouse Click Event was missing in SWF implementation, here it is a patch to
 fix that [?]
 it is released under MIT/X11 or what ever you want.
 Carlos, if you apply the patch, could you think about my coding for fun
 and add my nickname in the log ?[?]
 --
 Cordially.

 Small Eric Quotations of the days:
 ---

 I have no special talents. I am only passionately curious

329.png330.gif___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] Gtk depends on Winforms ¿?

2009-09-07 Thread Carlos Alberto Cortez
Hey,




 But since Mono's System.Windows.Forms is Open Source [1], why was it
 again that no one has found out what DoEvents does? ;-)

 Andreas

 [1]
 http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs?view=markup



We do know what Application.DoEvents do: process pending messages. What we
don't know is *how* is that affecting Gtk and the visual styles, and our
implementation of Windows.Forms has then nothing to see in that part.

Carlos.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] WinForms Control.Invoke Issue

2009-08-07 Thread Carlos Alberto Cortez
Hey!

I had been reviewing some patches we have in bugzilla - but I missed this
one. It's now reviewed - see bugzilla ;-)

Thanks!
Carlos.

2009/8/7 Tom Spink tsp...@gmail.com

 Hi Guys,

 I filed a bug a while ago about an issue with Control.Invoke in
 WinForms.  A guy said he'd take a look at a patch, if I posted one,
 which I did... but nothing has come of it.  I tried e-mailing the
 WinForms list, but haven't heard anything back.

 I was wondering if someone here could take a look at my proposed patch?

 Here's the BugZilla entry:
 https://bugzilla.novell.com/show_bug.cgi?id=497175

 Thanks!
 --
 Tom Spink
 Pablo Picasso  - Computers are useless. They can only give you answers.
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-list] Keyboard bug in Mono

2009-07-28 Thread Carlos Alberto Cortez
Hey,

This is working with 2.4

Carlos.

2009/7/28 LKeene lionel.ke...@gmail.com


 Hello all.

 I'm testing on Mono 2.0 because our local Linux guy won't install 2.4. The
 following works fine on XP + Microsoft .NET, but generates no response on
 Red Hat + Mono 2.0. Has anyone else seen this bug? Has it been fixed in the
 latest release?:


 namespace KetTest
 {
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
bool ButtonHandled = false;

// Check which key was pressed and alert user:
switch (keyData)
{
case Keys.Left:
this.Text = Left key pressed;
ButtonHandled = true;
break;

case Keys.Up:
this.Text = Up key pressed;
ButtonHandled = true;
break;

case Keys.Right:
this.Text = Right key pressed;
ButtonHandled = true;
break;

case Keys.Down:
this.Text = Down key pressed;
ButtonHandled = true;
break;
}

return ButtonHandled;
}
}
 }
 --
 View this message in context:
 http://www.nabble.com/Keyboard-bug-in-Mono-tp24689175p24689175.html
 Sent from the Mono - General mailing list archive at Nabble.com.

 ___
 Mono-list maillist  -  Mono-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-list

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-dev] current serialport status..

2009-07-13 Thread Carlos Alberto Cortez
As Atsushi said, nobody is working in the serial ports these days, but you
can still fill a bug report, and at some point we will try to fix it.

Carlos.

2009/7/13 Atsushi Eno atsushi...@veritas-vos-liberabit.com

 My understanding is that no one is working on serial port stack now.

 I haven't faced to any serial port issue on linux, but it won't
 work on OSX or windows for some cases (bugs filed and/or patch posted).
 A problem is that it very often needs the actual hardware to reproduce
 issues which is mostly impossible.

 Atsushi Eno


 buhochil...@gmail.com wrote:
  Hi,
 
  I wonder what is the serialport current status?, we at monoBOTICS
  (http://www.monobotics.ic.uach.cl) use intensely that component in our
  project without much problems till now. Now we have a 1mps speed and the
  incoming data events and we start to have some issues with it, so I
  wonder what is the actual current state of the serialport class on
  mono/linux...
 
  I think that some time ago I read a post from one of the Unity guys
  mention something about that they complete that class and they was going
  to bright those changes/updates back to the mono sources, but it seems
  that nothing about it happend?
 
  Cheers,
 
  Mauricio
 
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 
 

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] PrintPreviewControl

2009-06-08 Thread Carlos Alberto Cortez
As I said before, you need to print here the entire message error you are
getting, so we can get an idea ;-)

2009/6/9 Jyoti Seth jyotiseth2...@gmail.com

  Hi All,



 I am trying to use PrintPreviewControl on Mono 2.4 on Suse linux. It is
 throwing GDI32.dll error. Libgdiplus package is already installed on the
  sytem. If anyone has idea about this problem please let me know.



 Thanks,

 Jyoti

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-list] PrintPreviewControl

2009-06-08 Thread Carlos Alberto Cortez
You are missing the libgdiplus package. You need to install it in your
system.

Carlos.

2009/6/8 Jyoti Seth jyotiseth2...@gmail.com

  Hi,



 I tried using the PrintPreviewControl  on mono but it gives gdi32.dll
 error.



 Thanks,

 Jyoti



 *From:* Doug Blank [mailto:doug.bl...@gmail.com]
 *Sent:* Friday, June 05, 2009 6:42 PM
 *To:* Jyoti Seth
 *Cc:* mono-list@lists.ximian.com
 *Subject:* Re: [Mono-list] PrintPreviewControl



 On Fri, Jun 5, 2009 at 8:07 AM, Jyoti Seth jyotiseth2...@gmail.com
 wrote:

 Hi All,

 Does PrintPreviewControl  work on mono?


 It works for me on Linux in most recent 2.4 trunk (and doesn't look like it
 has changed for a long time). Although clicking on the Print icon inside the
 PrintPreviewDialog prints out do print here and I haven't figured out how
 that was intended to be used.

 -Doug

  Thanks,

 Jyoti



 ___
 Mono-list maillist  -  Mono-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-winforms-list] C# 2008 - Buttons not showing up on RHEL 5

2009-06-05 Thread Carlos Alberto Cortez
Hey!

Well, it sounds like a bug, but it sounds like an old version, too. Would
you mind running mono --version?

Carlos.

2009/6/4 Aatif_Chaudhry gaa...@gmail.com


 I have a simple form application made in C# (MS VS 2008), it has two
 buttons,
 but when I run it on RH Linux 5 through mono, the buttons are not visible
 on
 the form. What I see is two black lines which on click, initiate the
 respective button's event.
 --
 View this message in context:
 http://www.nabble.com/C--2008---Buttons-not-showing-up-on-RHEL-5-tp23864848p23864848.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] MessageDialog.Show() Wont close

2009-06-05 Thread Carlos Alberto Cortez
I extracted this from your file:

using System;
using System.Windows.Forms;

public class Test
{
static void Main ()
{
string outputText = Succesfully STARTED MySQL CHECKER;
MessageBox.Show(outputText, SUCCES,
MessageBoxButtons.OK,
MessageBoxIcon.Information);

}
}

 And it seems to work fine in trunk/2.4.

Would you mind testing this sample? Also, can you tell us what version are
you using?

Carlos.

2009/6/3 mickvdv mick...@teux.net


 Hi all

 I got a problem. I wrote an console app that checks if there is a new entry
 in a mysql tabel. It uses a popup, MessageDialog. But if i push the OK
 button the dialog wont close! When i put

 Form form1 = new Form();
 form1.Show();
 form1.Hide();

 After it the popup does close when pushing OK. But that is a littlebit
 ugly%-|

 The code:
 Without the form option
 http://pastebin.com/f59a267b8

 Using the form option
 http://pastebin.com/f2416633a

 Is this a bug or am I just being stupid (or both:P)?

 Mickvdv

 --
 View this message in context:
 http://www.nabble.com/MessageDialog.Show%28%29-Wont-close-tp23857718p23857718.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Clipboard.SetDataObject() doing nothing

2009-05-24 Thread Carlos Alberto Cortez
This issue has nothing to see with that Changelog entry.

Basically we have never supported copying/pasting other than text/rtf text.
So feel free to open a bug report for it :-)

Thanks!
Carlos.


2009/5/24 Christoph Teuber christoph.teu...@gmx.li

 Hello,

 thanks for your fast answer.

 You were right, there were several changes, but nothing seems to be
 connected with my SetDataObject() problem. But I found this statement:

 2007-03-18 Jackson Harper jack...@ximian.com

 * TextBoxBase.cs: Remove image pasting code for now. There is no
 way to get an image on the clipboard right now anyways.

 This ist from 2007, so it may be out of date, but does it mean, that
 copying images to the clipboard doesn't work at all? I wonder, because

 Clipboard.SetImage( im );

 or

 Clipboard.SetObjectData( im );

 doesn't do anything either. (im is an image loaded as posted before). In
 contrary,

 Clipboard.SetObjectData(this is a test);

 does work.

 Greetings
 cht



 Stifu wrote:
  I know there've been clipboard fixes after 2.4, so you could check out
 SVN
  (or bugzilla).
 
 
  cht wrote:
 
  Hello,
 
  I'm trying to do some clipboard stuff under Mono right now, and I have
 the
  problem, that Windows.Forms.Clipboard.SetDataObject() doesn't seem to do
  anything if a DataObject will be passed.
 
  I do have the following two pieces of code, which both run under .NET
 2.0,
  but running under mono (2.0.1, Ubuntu 9.04) leaves the clipboard
  completely unchanged.
 
  private void testButton_Click(object sender, EventArgs e)
  {
  Image im = (Image)Bitmap.FromFile(test.jpg);
  DataObject dataObj = new DataObject();
  dataObj.SetData(im.GetType().ToString(), im);
  Clipboard.SetDataObject(dataObj, true);
 
  }
 
  private void testTextButton_Click(object sender, EventArgs e)
  {
  DataObject dataObj = new DataObject();
  string format = System.String;
  dataObj.SetData(format, this is a test);
  Clipboard.SetDataObject(dataObj, false);
  }
 
 
  I compile using VS 2008.
  As Clipboard.cs seems to bee unchanged since 2.0.1, I didn't try
  installing Mono 2.4. But I would like to stay compatible to 2.0.1
 anyway,
  so I hope I'm doing something wrong.
 
  Anybody any idea, why this is the case?
 
  Thanks in advance
  cht
 
 
 
 
 

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Clipboard.SetDataObject() doing nothing

2009-05-24 Thread Carlos Alberto Cortez
I already did some refactoring code to handle formats other than text, we
only need to copy the information just as other x11 applications do that :-)

But anyway, feel free to send (me) those notes as well :-)

Carlos.

2009/5/24 Ivan N. Zlatev cont...@i-nz.net

 Hey,

 There is already a bug for this:
 https://bugzilla.novell.com/show_bug.cgi?id=357642

 Basically we don't support IDataObject and custom data (clipboard)
 formats and just hand-check for text and handle that in a magical way.
 The best way (imho) to fix this is to have a IDataObject centric
 clipboard implementation. I have some notes if someone is interested.


 On Sun, May 24, 2009 at 4:33 PM, Carlos Alberto Cortez
 calberto.cor...@gmail.com wrote:
  This issue has nothing to see with that Changelog entry.
 
  Basically we have never supported copying/pasting other than text/rtf
 text.
  So feel free to open a bug report for it :-)
 
  Thanks!
  Carlos.
 
 
  2009/5/24 Christoph Teuber christoph.teu...@gmx.li
 
  Hello,
 
  thanks for your fast answer.
 
  You were right, there were several changes, but nothing seems to be
  connected with my SetDataObject() problem. But I found this statement:
 
  2007-03-18 Jackson Harper jack...@ximian.com
 
  * TextBoxBase.cs: Remove image pasting code for now. There is no
  way to get an image on the clipboard right now anyways.
 
  This ist from 2007, so it may be out of date, but does it mean, that
  copying images to the clipboard doesn't work at all? I wonder, because
 
  Clipboard.SetImage( im );
 
  or
 
  Clipboard.SetObjectData( im );
 
  doesn't do anything either. (im is an image loaded as posted before). In
  contrary,
 
  Clipboard.SetObjectData(this is a test);
 
  does work.
 
  Greetings
  cht
 
 
 
  Stifu wrote:
   I know there've been clipboard fixes after 2.4, so you could check out
   SVN
   (or bugzilla).
  
  
   cht wrote:
  
   Hello,
  
   I'm trying to do some clipboard stuff under Mono right now, and I
 have
   the
   problem, that Windows.Forms.Clipboard.SetDataObject() doesn't seem to
   do
   anything if a DataObject will be passed.
  
   I do have the following two pieces of code, which both run under .NET
   2.0,
   but running under mono (2.0.1, Ubuntu 9.04) leaves the clipboard
   completely unchanged.
  
   private void testButton_Click(object sender, EventArgs e)
   {
   Image im = (Image)Bitmap.FromFile(test.jpg);
   DataObject dataObj = new DataObject();
   dataObj.SetData(im.GetType().ToString(), im);
   Clipboard.SetDataObject(dataObj, true);
  
   }
  
   private void testTextButton_Click(object sender, EventArgs e)
   {
   DataObject dataObj = new DataObject();
   string format = System.String;
   dataObj.SetData(format, this is a test);
   Clipboard.SetDataObject(dataObj, false);
   }
  
  
   I compile using VS 2008.
   As Clipboard.cs seems to bee unchanged since 2.0.1, I didn't try
   installing Mono 2.4. But I would like to stay compatible to 2.0.1
   anyway,
   so I hope I'm doing something wrong.
  
   Anybody any idea, why this is the case?
  
   Thanks in advance
   cht
  
  
  
  
  
 
  ___
  Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-winforms-list
 
 
  ___
  Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-winforms-list
 
 



 --
 Kind Regards,
 Ivan N. Zlatev

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] [PATCH] System.Windows.Forms.Form ControlBox bug

2009-05-22 Thread Carlos Alberto Cortez
Hey!

Would it be possible to fill a bug report with the attached patch, so we
don't forget about it?

Thanks!
Carlos.

2009/5/22 Lachlan Keown lachlanke...@gmail.com

 Hi, I've been working on getting my Windows Forms app to work under Mono
 and finding a few bugs along the way...
 This one relates to the ControlBox property of the Form class. When
 ControlBox is set to false, the form should have a title bar only if the
 Text property is not empty. So whenever the Text or Controlbox properties
 change this needs to be tested for and the Window size adjusted accordingly.
 See the attached patch, which is probably overkill. I haven't written or run
 any tests for this sorry as I'm still getting familiar with the Mono
 environment.

 Lachlan Keown



 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Problems WinForms in Linux

2009-04-28 Thread Carlos Alberto Cortez
I filled a new bug report regarding your application's issue:
https://bugzilla.novell.com/show_bug.cgi?id=498963

Thanks!
Carlos.

2009/4/27 v567 viv...@yandex.ru


 MSI MegaBook M510A (CPU Intel Pentium-M 1.7 Gb, Memory 2 Ggb, ATI Mobility
 Radeon 9700 64 Mb)
 test.exe:
 1. XP SP2 .NET FrameWork 2.0 - 4.3 sek
 2. XP SP2 mono 2.4 - 7.7 sek
 3. OpenSUSE 11.1 (Gnome) Mono 2.4 - 494.2 sek

 Why?:confused:

 Code: http://www.nabble.com/file/p23262446/Test.zip Test.zip
 Source: http://www.nabble.com/file/p23262446/Test_source.zipTest_source.zip
 --
 View this message in context:
 http://www.nabble.com/Problems-WinForms-in-Linux-tp23262446p23262446.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Strange exception related to TableLayoutPanel?

2009-04-22 Thread Carlos Alberto Cortez
It seems like a bug. Would you mind filling a bug with an attached test
case?

Thanks!

2009/4/22 noda www@free.fr


 Hello,

 I have the strange exception below that is raised when I try to create a
 new
 instance of my MainForm class (a classic windows Form):


 --
 Exception has been thrown by the target of an invocation.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
 invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
 System.Globalization.CultureInfo culture) [0x0]
  at System.Reflection.MonoProperty.SetValue (System.Object obj,
 System.Object value, BindingFlags invokeAttr, System.Reflection.Binder
 binder, System.Object[] index, System.Globalization.CultureInfo culture)
 [0x0]
  at System.Reflection.PropertyInfo.SetValue (System.Object obj,
 System.Object value, System.Object[] index) [0x0]
  at System.ComponentModel.ComponentResourceManager.ApplyResources
 (System.Object value, System.String objectName,
 System.Globalization.CultureInfo culture) [0x0]
  at System.ComponentModel.ComponentResourceManager.ApplyResources
 (System.Object value, System.String objectName) [0x0]
  at MAEVA.GUI.MainForm.InitializeComponent () [0x0]
  at MAEVA.GUI.MainForm..ctor () [0x0]
  at (wrapper remoting-invoke-with-check) MAEVA.GUI.MainForm:.ctor ()
  at MAEVA.Editor.NeedReload () [0x0]

 --


 It contains an inner exception suggesting a problem related to the
 TableLayoutPanel:

 --
 LayoutSettings value cannot be set directly.
  at System.Windows.Forms.TableLayoutPanel.set_LayoutSettings
 (System.Windows.Forms.TableLayoutSettings value) [0x0]
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
 (object,object[],System.Exception)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
 invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
 System.Globalization.CultureInfo culture) [0x0]

 --

 I'm running Mono 2.4 on windows when this exception occurs. It does not
 occur when using the MS .Net framework.

 The binary is compiled with MSVC# 2008, and the form has nothing special
 and
 was designed using the form designer of visual studio.

 Do you have any idea on how to resolve this problem? Or maybe it is a bug
 with Mono?

 Thanks a lot!

 Yohan


 --
 View this message in context:
 http://www.nabble.com/Strange-exception-related-to-TableLayoutPanel--tp23172152p23172152.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Very slow performance in WinForms ListView

2009-04-21 Thread Carlos Alberto Cortez
I commited some changes some weeks ago (not available in 2.4, but they will
be ready for 2.6) that improve the rendering, with less flicker changing
columns width/position. But anyway, would you mind filling a bug report with
a test case? There are different things that can affect the performance of
the ListView, and unfortunately we don't have an universally way to make
fast the ListView (such ListView.SuperFast = true).

If we have a specific usage scenario, we can try to improve the performance
- specially when other users have notified of the bad performance and we
have tuned the performance in the past.

Carlos.

2009/4/21 jyoti_C# jyoti.b.ko...@intel.com


 Using BeginUpdate() and EndUpdate() worked well for adding items. But, I
 still see very slow listview refresh when a column is resized. Do I need to
 capture these events and add above function calls in the event handler?
 Basically, the problem is that refresh of listview is very slow. Is there
 any solution that will fix the list view performance universally(column
 reszing, scrolling, coming out of screensaver etc.) and not just when I add
 items.

 Thanks.
 --
 View this message in context:
 http://www.nabble.com/Very-slow-performance-in-WinForms-ListView-tp20725159p23162133.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] [Patch] CausesValidation handling

2009-03-25 Thread Carlos Alberto Cortez
On IRC Andreia pointed out the case when a Control is part of the pending
validation chain, and then this Control is removed. So the attached codes
adds the check to look for any control (or children) that could be int the
pending validation chain, and thus need to be removed (this is what .Net
does).

Comments?
Carlos.


2009/2/16 Carlos Alberto Cortez calberto.cor...@gmail.com

 Hey,

 The attached patch basically adds support for Control.CausesValidation,
 which means that in some scenarios the validation is postponed (when
 CausesValidation if false, basically).

 I'm concerned -specially- about the code readibility (it also includes the
 description of the algorithm in the patch). I mention this because I spent
 some time trying to understand this little documented algorithm (AFAIK) and
 want the code to be easily understandable.

 As test I used the very complete ones in
 https://bugzilla.novell.com/show_bug.cgi?id=457170 . One test is still
 failing, but that's due to the controls receiving focus/validation when
 closing (which needs to be fixed too, but it's a little different issue).

 Carlos.

Index: ContainerControl.cs
===
--- ContainerControl.cs	(revisión: 129872)
+++ ContainerControl.cs	(copia de trabajo)
@@ -39,6 +39,7 @@
 	public class ContainerControl : ScrollableControl, IContainerControl {
 		private Control		active_control;
 		private Control		unvalidated_control;
+		private ArrayList	pending_validation_chain;
 
 		// This is an internal hack that allows some container controls
 		// to not auto select their child when they are activated
@@ -139,15 +140,33 @@
 	walk = walk.Parent;
 }
 
-validation_failed = false;
-for (int i = 0; i  validation_chain.Count; i ++) {
-	if (!ValidateControl ((Control)validation_chain[i])) {
-		active_control = value = (Control)validation_chain[i];
-		fire_enter = true;
-		validation_failed = true;
+// Validation can be postponed due to all the controls
+// in the enter chain not causing validation. If we don't have any
+// enter chain, it means that the selected control is a child and then
+// we need to validate the controls anyway
+bool postpone_validation;
+Control topmost_under_root = null; // topmost under root, in the *enter* chain
+if (value == root)
+	postpone_validation = false;
+else {
+	postpone_validation = true;
+	walk = value;
+	while (walk != root  walk != null) {
+		if (walk.CausesValidation)
+			postpone_validation = false;
+
+		topmost_under_root = walk;
+		walk = walk.Parent;
 	}
 }
 
+Control failed_validation_control = PerformValidation (form == null ? this : form, postpone_validation, 
+		validation_chain, topmost_under_root);
+if (failed_validation_control != null) {
+	active_control = value = failed_validation_control;
+	fire_enter = true;
+}
+
 if (fire_enter) {
 	walk = value;
 	while (walk != root  walk != null) {
@@ -196,6 +215,72 @@
 			}
 		}
 
+		// Return the control where validation failed, and null otherwise
+		// @topmost_under_root is the control under the root in the enter chain, if any
+		//
+		// The process of validation happens as described:
+		//
+		// 	1. Iterate over the nodes in the enter chain (walk down), looking for any node
+		// 	causing validation. If we can't find any, don't validate the current validation chain, but postpone it,
+		// 	saving it in the top_container.pending_validation_chain field, since we need to keep track of it later.
+		// 	If we have a previous pending_validation_chain, add the new nodes, making sure they are not repeated
+		// 	(this is computed in ActiveControl and we receive if as the postpone_validation parameter).
+		//
+		// 	2. If we found at least one node causing validation in the enter chain, try to validate the elements
+		// 	in pending_validation_chain, if any. Then continue with the ones receives as parameters.
+		//
+		// 	3. Return null if all the validation performed successfully, and return the control where the validation
+		// 	failed otherwise.
+		//
+		private Control PerformValidation (ContainerControl top_container, bool postpone_validation, ArrayList validation_chain, 
+Control topmost_under_root)
+		{
+			validation_failed = false;
+
+			if (postpone_validation) {
+AddValidationChain (top_container, validation_chain);
+return null;
+			}
+
+			// if not null, pending chain has always one element or more
+			if (top_container.pending_validation_chain != null) {
+// if the topmost node in the enter chain is exactly the topmost
+// int the validation chain, remove it, as .net does
+int last_idx = top_container.pending_validation_chain.Count - 1;
+if (topmost_under_root == top_container.pending_validation_chain [last_idx])
+	top_container.pending_validation_chain.RemoveAt (last_idx);
+
+AddValidationChain (top_container

[Mono-winforms-list] [PATCH] Synchronized Activation of windows

2009-03-25 Thread Carlos Alberto Cortez
Hey

While trying to fix #413898, I found that we are not activating the related
form when setting Form.Visible to true, as opposed to .net (we actually do
that in Application.RunLoop, however, which is used by both
Application.Run() and Form.ShowDialog()).

An additional problem is the fact that trying to activate the form when made
visible (Form.SetVisibleCore in this case) is not a guarantee of receiving
the WM_ACTIVATE message in time before the form gets closed (not a problem
in both Application.Run and Form.ShowDialog), specially because we have to
send a message to the window manager, then wait for a X message, then
internally process in our own winforms queue.

So after trying several approachs, I came up with the simple attached patch,
that basically adds a synchronized version of the XplatUI.Activate method,
which in X11 sends the appropriate message to the window manager and then
sits to wait till we have processed it. Even if simple, and could run all
the test suite, I'm not very sure, because a synchronized call sounds
dangerous, and because I thought that maybe somebody could know why we
hadn't something like this before ;-).

Thoughts?
Carlos.
Index: XplatUI.cs
===
--- XplatUI.cs	(revisión: 129872)
+++ XplatUI.cs	(copia de trabajo)
@@ -464,6 +464,11 @@
 			driver.Activate(handle);
 		}
 
+		internal static void ActivateSynchronously (IntPtr handle)
+		{
+			driver.ActivateSynchronously (handle);
+		}
+
 		internal static void AudibleAlert() {
 			#if DriverDebug
 Console.WriteLine(AudibleAlert(): Called);
Index: XplatUIDriver.cs
===
--- XplatUIDriver.cs	(revisión: 129872)
+++ XplatUIDriver.cs	(copia de trabajo)
@@ -325,6 +325,7 @@
 		internal abstract void SetWindowPos(IntPtr handle, int x, int y, int width, int height);
 		internal abstract void GetWindowPos(IntPtr handle, bool is_toplevel, out int x, out int y, out int width, out int height, out int client_width, out int client_height);
 		internal abstract void Activate(IntPtr handle);
+		internal abstract void ActivateSynchronously (IntPtr handle);
 		internal abstract void EnableWindow(IntPtr handle, bool Enable);
 		internal abstract void SetModal(IntPtr handle, bool Modal);
 		internal abstract void Invalidate(IntPtr handle, Rectangle rc, bool clear);
Index: XplatUIX11.cs
===
--- XplatUIX11.cs	(revisión: 129872)
+++ XplatUIX11.cs	(copia de trabajo)
@@ -2522,6 +2522,15 @@
 			}
 		}
 
+		internal override void ActivateSynchronously (IntPtr handle) {
+			Activate (handle);
+
+			// Don't wait for any activation handling, since it's not done by x11 for popup windows
+			CreateParams cp = Control.FromHandle (handle).GetCreateParams ();
+			if (!StyleSet (cp.Style, WindowStyles.WS_POPUP))
+WaitForHwndMessage (Hwnd.ObjectFromHandle (handle), Msg.WM_ACTIVATE, true);
+		}
+
 		internal override void AudibleAlert() {
 			XBell(DisplayHandle, 0);
 			return;
Index: XplatUIWin32.cs
===
--- XplatUIWin32.cs	(revisión: 129872)
+++ XplatUIWin32.cs	(copia de trabajo)
@@ -1899,6 +1899,10 @@
 			}
 		}
 
+		internal override void ActivateSynchronously(IntPtr handle) {
+			Activate (handle);
+		}
+
 		internal override void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
 			RECT rect;
 
Index: Form.cs
===
--- Form.cs	(revisión: 129872)
+++ Form.cs	(copia de trabajo)
@@ -2501,6 +2501,10 @@
 	SendControlFocus (ActiveControl);
 else
 	this.Focus ();
+
+// Activate synchronously only if this form can *truly* be activated
+if (!IsActive  Parent == null  !IsMdiContainer  Visible)
+	XplatUI.ActivateSynchronously (window.Handle);
 			}
 		}
 
Index: XplatUICarbon.cs
===
--- XplatUICarbon.cs	(revisión: 129872)
+++ XplatUICarbon.cs	(copia de trabajo)
@@ -789,6 +789,10 @@
 			ActiveWindow = handle;
 		}
 
+		internal override void ActivateSynchronously (IntPtr handle) {
+			Activate (handle);
+		}
+
 		internal override void AudibleAlert() {
 			throw new NotImplementedException();
 		}
___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


[Mono-winforms-list] AO Carlos Alberto Cortez, 2009-03-25

2009-03-25 Thread Carlos Alberto Cortez
Hey,

Sorry for the late report, but my laptop died last week. See Bonus ;-)

Accomplishments:

* Bug fixing [Partially done] - Spent some time trying to figure out how to
solve #413898 without breaking several tests. Also, work on other bugs.
* Activation stuff [Partially done] - Applied suggestions by Andreia to some
activation patch, basically.

Objectives:

* Keep up with old stuff.
* Get a new laptop ;-)

Bonus:

* Basically on the last wednesday my laptop completely stopped working, and
had to take it to some technician (guarantee is over), and managed to get a
borrowed laptop here and install all the needed stuff. I was waiting till
Monday in night for the lap report, so I could probably recover some of my
patches and ongoing work -and commit it-, but it seems the hard drive of is
broken too, so even if the things I was working on are not hard to remember,
I still need to re-code them.

Carlos.
___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


[Mono-winforms-list] [Patch] CausesValidation handling

2009-02-16 Thread Carlos Alberto Cortez
Hey,

The attached patch basically adds support for Control.CausesValidation,
which means that in some scenarios the validation is postponed (when
CausesValidation if false, basically).

I'm concerned -specially- about the code readibility (it also includes the
description of the algorithm in the patch). I mention this because I spent
some time trying to understand this little documented algorithm (AFAIK) and
want the code to be easily understandable.

As test I used the very complete ones in
https://bugzilla.novell.com/show_bug.cgi?id=457170 . One test is still
failing, but that's due to the controls receiving focus/validation when
closing (which needs to be fixed too, but it's a little different issue).

Carlos.


container-validation.patch
Description: Binary data
___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Question about Linux compatibality

2009-02-08 Thread Carlos Alberto Cortez
Yeah, VB.Net is cross platform and the .exe you get should work in Mono
without problems. The difference between using VB.Net and C# is mostly the
fact, as far as I know, that the first uses some additional libraries (that
btw have been implemented in Mono already).

If your application doesn't work, just let us know and fix a bug.

Carlos.


2009/2/8 Anthony Papillion papill...@gmail.com

 I'm interested in Mono.  I love the promise that I can really write my
 application once and have it be fairly cross-platform. But I have a question
 that I've not really found the final answer to:

 I write most of my code on Windows. I don't use the API and I usually use
 mostly the built-in controls (with the exception of a calendar control that
 I really like).  While I like C#, I'm writing most of my code in VB and that
 is where my question comes in.

 How cross platform is VB.NET code if I'm using most stock stuff without
 any Win32 API calls?  Will it usually compile and run or should I write all
 of my stuff in C#?

 Thanks!
 Anthony

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Can I execute the exe file of visual studio project on linux+MONO ?

2009-02-03 Thread Carlos Alberto Cortez
Yes, you can run winforms apps in linux.

Basically you take the .exe produced by Visual Studio (usually under
MyProjectName/MyProjectName/bin/Release) and then you have to run it (from
the console):

mono MyProjectName.exe

Carlos.

2009/2/3 mohammed_aid mohammed_...@yahoo.com


 hello everybody,

 this is the second day for me in this forum and really I am very happy with
 you all.

 today I have small problem which is I can't run the executable file which
 released by visual studio on Linux Fedora with MONO 2.

 is it possible to do that ?

 if not please suggest any solution to help me because my project was
 developed by visual studio and I have used winforms inside it that is way I
 could not modify it on MonoDevelop and I do not want to convert it to GTK#
 forms.

 thank you in advance.

 best regards.
 --
 View this message in context:
 http://www.nabble.com/Can-I-execute-the-exe-file-of-visual-studio-project-on-linux%2BMONO---tp21823667p21823667.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Treeview select bug

2009-02-01 Thread Carlos Alberto Cortez
This sounds like a bug. Please fill a bug report. Thanks!

Carlos.

2009/2/2 qed naoti...@gmail.com


 The Treeview control wants to select its first item when it gains focus for
 the first time (after the application starts running) via a mouse-click
 whether the user clicked on the first item or a different item. If the user
 did not select the first item, then the control incorrectly generates two
 select events, one for the first item, and another one for the actual
 item
 that the user clicked on.

 The .NET Treeview control does not exhibit this behavior.

 Version: Mono Winforms 2.2
 OS: Win XP (haven't tested this on other platforms, but they possibly have
 this bug too)
 --
 View this message in context:
 http://www.nabble.com/Treeview-%22select%22-bug-tp21784923p21784923.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] works!

2008-12-09 Thread Carlos Alberto Cortez
You should always include the error message ;-)

I suspect you are not telling the compiler to reference
System.Windows.Forms:

gmcs hello-winforms.cs -r:System.Windows.Forms

Carlos.

2008/12/9 pepe_eloy [EMAIL PROTECTED]



 Thanks Andy for your help.

 I ran the program as you tell me and works! This means the libraries are
 installed, but why the program didn't compile?

 I show the code I'm, using

 //Code for hello-winforms.cs
 //this file is in /home/proyectos-mono

 using System;
 using System.Windows.Forms;

 public class HelloWorld : Form
 {
static public void Main ()
{
Application.Run (new HelloWorld ());
}

public HelloWorld ()
{
Text = Hello Mono World;
}
 }

 Need I to specify the path of libraries?

 Thanks for the help

 José Eloy

 --
 View this message in context:
 http://www.nabble.com/I-get-error-compiling-in-ubuntu-tp20786571p20921951.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Usercontrol inheritance not working with mono 1.2.6

2008-11-27 Thread Carlos Alberto Cortez
Besides what Rafael mentioned, it's important to send the code, so we can
test it.

Carlos.

2008/11/27 Rafael Teixeira [EMAIL PROTECTED]

 1.2.6 is too old, specially for WinForms. Please upgrade to 2.x.


 On Wed, Nov 26, 2008 at 1:14 PM, RobWeatherford 
 [EMAIL PROTECTED] wrote:


 Hi, I was wondering if there is a solution to my problem.

 Basically I have a windows form that contains a user control, and this
 user
 control that inherits from another abstract user control. The abstract
 user
 control includes a few base / standard controls that I would like to see
 on
 all the controls I develop.

 When I run the form on linux using mono the base user controls do not
 display (i.e. they are not visible), e.g. buttons, labels etc. Only the
 controls on the subclass usercontrol, or the derived usercontrol are
 visible.

 This works normally on .net windows, but I am having problems with my
 version of mono. Has anyone seen anything like this. I am using mono 1.2.6

 Much thanks,
 Rob
 --
 View this message in context:
 http://www.nabble.com/Usercontrol-inheritance-not-working-with-mono-1.2.6-tp20702666p20702666.html
 Sent from the Mono - WinForms mailing list archive at Nabble.com.

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list




 --
 Rafael Monoman Teixeira
 ---
 I myself am made entirely of flaws, stitched together with good
 intentions.
 Augusten Burroughs

 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] Bug In Mono FTP System.Net.FtpWebRequest

2008-09-04 Thread Carlos Alberto Cortez
This is mostly an eror. Please fill a bug for it. See 
http://mono-project.com/Bugs

Carlos.

El mié, 03-09-2008 a las 05:23 -0700, Dieuzorro escribió:
 With my code I was able to download a file on the server
 ftp://ftp-developpez.com/konflor/Latex/formation/FormationLatex.pdf;
 anonymously. But on my local server when I want to download a file with a
 loggin and a password, my stream ResponceStream is empty and there is no
 error. On Windows everything works.
 
   Have you got an exemple on mono which connect on an private ftp
 server? But my code works on windows and ftp server!
 
 Thanks
 
 
 
 Dieuzorro wrote:
  
  
  
  The code below operates under windwos but not Linux file is created,
  but it is empty.
  
  I think that the bug is in 'Credentials' because I can download files
  on server without authentication(Login/Password). 
  
  Sorry for my English I am french 
  
  
  
  
  Sub dl(ByVal remoteFile As String, ByVal localFile As String, ByVal
  username As String, ByVal password As String)
  
  
  
  '1. Create a request: must be in ftp://hostname format, 
  
  '   not just ftp.myhost.com
  
  Dim URI As String = remoteFile
  
  Dim ftp As System.Net.FtpWebRequest = 
  CType(FtpWebRequest.Create(URI), FtpWebRequest)
  
  
  
  
  '3. Settings and action
  
  ftp.KeepAlive = False
  
  'we want a binary transfer, not textual data
  
  ftp.UseBinary = True
  
  'Define the action required (in this case, download a file)
  
  ftp.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
  
  
  '2. Set credentials
  if not (username =  andalso password = ) then
  
  ftp.Credentials = New NetworkCredential( username, password)
  end if
  
  
  '4. If we were using a method that uploads data e.g. UploadFile
  
  '   we would open the ftp.GetRequestStream here an send the data
  
  
  
  '5. Get the response to the Ftp request and the associated stream
  
  Using response As System.Net.FtpWebResponse =
  CType(ftp.GetResponse, System.Net.FtpWebResponse)
  
  Using responseStream As IO.Stream = response.GetResponseStream
  
  'loop to read  write to file
  
  Using fs As New IO.FileStream(localFile,
  IO.FileMode.Create)
  
  Dim buffer(2047) As Byte
  
  Dim read As Integer = 0
  
  Do
  
  read = responseStream.Read(buffer, 0,
  buffer.Length)
  
  fs.Write(buffer, 0, read)
  
  Loop Until read = 0 'see Note(1)
  
  responseStream.Close()
  
  fs.Flush()
  
  fs.Close()
  
  End Using
  
  
  
  End Sub End Using
  
  responseStream.Close()
  
  End Using
  
  response.Close()
  
  End Using
  
  
  
  End Sub
  
  
 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono 2.0 Preview 1 is out!!

2008-08-20 Thread Carlos Alberto Cortez

Hello,

 
 3) You asked post bug reports. OK. I looked in tracker - there are 171 
 bugs only in SWF (some of them are mine). Some bugs assigned to 
 developers. But most of them not assigned. What do you plan to do with 
 such bugs? Will you ignore them and make 2.0 release?
 

Developing the implementation of Windows.Forms has proven to be a tricky
thing - sometimes there are some undocumented behaviours and bits hidden
somewhere, that appear until a user follows a specific path.

Now, we try to prioritise the bugs we have, and fix them based on that.
We assign them as soon as somebody is done with some bugs and goes for
the next ones. What do we try with those bugs? Fix them, of course. We
can't ignore them, but it's not logical no stop the entire release for
only a part of the class library. We have an agenda, an we try to fix as
much bugs as possible, with the small team we have.

But this is free software after all, and sure you can help us if you
think it's a bad thing to have so many bugs opened.

And, btw, in general we feel we mwf is stable in general, but not
perfect (yet ;-D ).

Carlos.


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] Scrolling performance isues

2008-08-11 Thread Carlos Alberto Cortez

El dom, 10-08-2008 a las 18:55 -0700, Chris Toshok escribió:
 Nice. That look pretty good, with the only issue being performance  
 over an X connection with high latency - it'll block all UI until the  
 redraws complete.


I thought that was exactly we wanted to do ;-)

 
 That said, it's definitely better than what we have now :)

Ok to commit for now? Specially for 2.0 :-)

Carlos.

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] DataGrid

2008-08-11 Thread Carlos Alberto Cortez
Probably it's a regression. Would you mind filling a bug report? This
way we can track the error with the details.

Carlos.


El lun, 11-08-2008 a las 03:41 -0700, mbertoli escribió:
 Do anyone of you use a DataGrid in your applications? Does it work?
 I tried various applications on various systems and it never works.
 I always get the IndexOutOfRangeException when I try to add a new row.
 
 Only in the ReportBuilder compiled application founded in the vmware image
 downloaded from this site I've seen it works.
 But if I compile the source, it doesn't work.
 
 Can anyone help me, please?

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


[Mono-winforms-list] [PATCH] Avoid sending MouseEnter messages when clicking

2008-08-11 Thread Carlos Alberto Cortez
Hey Ivanz,

The attached patch reverts a check in XplatUIX11.GetMessage method,
specifically handling the X11 EnterNotify message generated when
clicking a control (rev 101225).

Basically when a control is clicked, EnterNotify events are generated
for the container form and the control being clicked. Usually when we
get this event we generate a WM_MOUSE_ENTER message, but in this case we
don't need it, since it's not real pointer motion.

That's why, when the EnterNotify event tell us that it's a not a real
motion event, we have to ignore it, no matter the value of the
window/hwnd (right now, when clicking any control, MouseEnter/MouseMove
events are generated for the containing form, which is obviously wrong).

Hopefully that was clear ;-D

Carlos.


Index: XplatUIX11.cs
===
--- XplatUIX11.cs	(revisión: 110030)
+++ XplatUIX11.cs	(copia de trabajo)
@@ -4009,7 +4009,7 @@
 	if (!hwnd.Enabled) {
 		goto ProcessNextMessage;
 	}
-	if (xevent.CrossingEvent.mode != NotifyMode.NotifyNormal  xevent.CrossingEvent.window != hwnd.client_window) {
+	if (xevent.CrossingEvent.mode != NotifyMode.NotifyNormal) {
 		goto ProcessNextMessage;
 	}
 	msg.message = Msg.WM_MOUSE_ENTER;
___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] [DataGrid] System.IndexOutOfRangeException: list position

2008-08-10 Thread Carlos Alberto Cortez
Hey,

If it works on .net, and not in mono, please fill a bug report at
http://mono-project.com/Bugs in the System.Windows.Forms section, so we
can fix it.

Thanks,
Carlos.


El dom, 10-08-2008 a las 00:08 -0700, mbertoli escribió:
 Hi,
 
 I have a simple DataGrid in which I load data from a DataSet.
 Data loading works fine but when I try to add a row I get a MessageBox that
 tells me to correct the value.
 Then I get this error: System.IndexOutOfRangeException: list position. 
 
 Can anyone help me?
 
 Thanks, Michele
 
 Mono 1.9.1 / Suse 10.3

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] Scrolling performance isues

2008-08-07 Thread Carlos Alberto Cortez

Hey Chris

Comments below.

 
 I'm also not sure flushing the paint queue before doing the XCopyArea
 (suggestion 1 above) will be enough either.  It's very easy to imagine
 a scenario where you're scrolling and we do another ScrollWindow
 before all the GraphicsExpose events have been received.  We really do
 need to block things somehow.  And it'll be more than just blocking
 the message queue - we'll need to actually stop the thread if there's
 a call to ScrollWindow (or anything else that ends up copying) until
 the GraphicsExposes have been handled.

I went and began to review our code and wondering how to do it the
proper way - then went to Gtk+ scrolling code once more, and then could
see that the gtk textbox was handling the scroll itself (it seems the
algorithm is what's called 'smooth scrolling', not sure). 

The idea is that after each request to scroll, they call XIfEvent to
wait for GraphicsExpose/NoExpose events on the scrolled window, blocking
the thread until they get one of them (so you can invalidate or exit the
loop), and adding a expose operation on the window.

I implemented this today for our implementation and it seems to work
just fine, and it seems it follows your idea ;-)

Take a look and tell what you think.
Carlos.

PD - The patch is a test, so needs to be beautified still ;-) But should
work.
Index: XplatUIX11.cs
===
--- XplatUIX11.cs	(revisión: 109846)
+++ XplatUIX11.cs	(copia de trabajo)
@@ -4860,6 +4860,33 @@
 			y = dest_y_return;
 		}
 
+		bool GraphicsExposePredicate (IntPtr display, ref XEvent xevent, IntPtr arg)
+		{
+			return (xevent.type == XEventName.GraphicsExpose || xevent.type == XEventName.NoExpose) 
+arg == xevent.GraphicsExposeEvent.drawable;
+		}
+
+		delegate bool EventPredicate (IntPtr display, ref XEvent xevent, IntPtr arg);
+
+		void ProcessGraphicsExpose (Hwnd hwnd)
+		{
+			XEvent xevent = new XEvent ();
+			IntPtr handle = Hwnd.HandleFromObject (hwnd);
+			EventPredicate predicate = GraphicsExposePredicate;
+
+			for (;;) {
+XIfEvent (Display, ref xevent, predicate, handle);
+if (xevent.type != XEventName.GraphicsExpose)
+	break;
+
+AddExpose (hwnd, xevent.ExposeEvent.window == hwnd.ClientWindow, xevent.GraphicsExposeEvent.x, xevent.GraphicsExposeEvent.y,
+		xevent.GraphicsExposeEvent.width, xevent.GraphicsExposeEvent.height);
+
+if (xevent.GraphicsExposeEvent.count == 0)
+	break;
+			}
+		}
+
 		internal override void ScrollWindow(IntPtr handle, Rectangle area, int XAmount, int YAmount, bool with_children) {
 			Hwnd		hwnd;
 			IntPtr		gc;
@@ -4913,6 +4940,8 @@
 			Rectangle dirty_area = GetDirtyArea (area, dest_rect, XAmount, YAmount);
 			AddExpose (hwnd, true, dirty_area.X, dirty_area.Y, dirty_area.Width, dirty_area.Height);
 
+			ProcessGraphicsExpose (hwnd);
+
 			XFreeGC(DisplayHandle, gc);
 		}
 
@@ -4966,94 +4995,10 @@
 visible_area.Intersect (r);
 			}
 
-			// If region is null, the entire area is visible.
-			// Get the area not obscured otherwise.
-			Region visible_region = GetVisibleRegion (c, visible_area);
-			if (visible_region != null) {
-RectangleF rectf = visible_region.GetBounds (Hwnd.GraphicsContext);
-visible_area = new Rectangle ((int) rectf.X, (int) rectf.Y,
-		(int) rectf.Width, (int) rectf.Height);
-
-visible_region.Dispose ();
-			}
-
 			visible_area.Location = c.PointToClient (visible_area.Location);
 			return visible_area;
 		}
 
-		// Obscured area by other toplevel windows
-		Region GetVisibleRegion (Control c, Rectangle visible_area)
-		{
-			Region visible_region = null;
-			IntPtr Root;
-			IntPtr Parent;
-			IntPtr Children;
-			int ChildCount;
-
-			Control form = c.FindForm ();
-			if (form == null || !form.IsHandleCreated)
-return null;
-
-			Hwnd hwnd = Hwnd.GetObjectFromWindow (form.Handle);
-			IntPtr form_handle = hwnd.whole_window;
-
-			lock (XlibLock) {
-XQueryTree (DisplayHandle, RootWindow, out Root, out Parent, out Children, out ChildCount);
-			}
-
-			int intptr_size = IntPtr.Size;
-			bool above = false;
-
-			for (int i = 0; i  ChildCount; i++) {
-IntPtr window = Marshal.ReadIntPtr (Children, i * intptr_size);
-
-XWindowAttributes win_attrs = new XWindowAttributes ();
-lock (XlibLock) {
-	XGetWindowAttributes (DisplayHandle, window, ref win_attrs);
-}
-
-Rectangle win_area = new Rectangle (win_attrs.x, win_attrs.y, 
-		win_attrs.width, win_attrs.height);
-
-if (win_attrs.map_state != MapState.IsViewable || !win_area.IntersectsWith (visible_area))
-	continue;
-
-IntPtr SubChildren;
-int SubChildCount;
-
-if (above) {
-	if (visible_region == null)
-		visible_region = new Region (visible_area);
-
-	visible_region.Exclude (win_area);
-	continue;
-}
-
-lock (XlibLock) {
-	XQueryTree (DisplayHandle, window, out Root, out Parent, out SubChildren, out SubChildCount);
-}
-
-if (SubChildren != 

[Mono-winforms-list] Scrolling performance isues

2008-07-25 Thread Carlos Alberto Cortez
Hey,

The new code that detects not visibles areas of the window to scroll
(obscured by other mwf windows or x11 top level ones), although working
fine, is somewhat slow, as some people have noticed.

After some research, I found that getting all the child windows for the root
window (using XQueryTree on RootWindow, this is, top level windows) is the
hot spot, and was causing the slow down.

And after some more research in other graphics tool kits, found that:

* Most of them make use of GraphicsExpose event, handling it by directly
generating expose events or invalidating the area pointed by GraphicsExpose
(Gtk+ as far as I know, and also Ivan told me other frameworks do that).

And also, regarding our code:

* When using composite (Xgl or similar) it's not necessary to do this
detection, since the window manager (*it seems*) is doing something that
somehow already knows which areas need to get an expose event (in other
words: only mwf overlapping detection is needed, not for x top level
windows).
* The new code, at least in my laptop, without using composite, seems to
work fine (no performance lost), and don't know if it's because XQueryTree
on RootTree returns a minor number of windows (61 with no composite, instead
of 89 with composite, using 5 terminals and a gtk+ application, for
example).

So, it seems that we should actually handle GraphicsExpose (which all it
involves) *or maybe* try to detect if we are using composite - if we are,
simply don't use this new code, but just do simple calculations, and if we
are not using it, do the detection, since it won't harm the performance.

But I woould like people to tell me how this code (2.0 branch or trunk)
behaves for them, in both cases (since I remember that Ivan was having
performance problems with the new code even without using composite).

Hope it's clear ;-)
Carlos.
___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


[Mono-dev] [Patch] DateTimePicker changes

2008-07-20 Thread Carlos Alberto Cortez
Hey,

While working on #, I found some small bits not matching .net. So
basically the attached patch:

* Doesn't change the DateTimePicker.Value property immediately when
editing -this means, when a user types a single digit-, but when the max
number of digits is reached *or* the selection moves to a different date
time section, or the checked state changes, or focus moves out of the
control, like .net does.

* Don't set at all the date entered by the user if is invalid. Just
ignore it and fallback to the current value.

* When painting, print the current editing text *if* we are actually
editing at the moment, or print the related Value otherwise.

* Use an enum to identify different date time parts (hour, minutes,
etc). This was done to avoid adding a new switch block when trying to
set the Value from a different part than KeyPress handler.

* Finally, infer the year when the user enters a two digit number, like
'99' or '34'. The behaviour I implemented is the one I observed in .Net,
but could not find something related to it in the docs.

Carlos.
Index: DateTimePicker.cs
===
--- DateTimePicker.cs	(revisión: 107947)
+++ DateTimePicker.cs	(copia de trabajo)
@@ -97,6 +97,9 @@
 
 		// variables for determining how to format the string
 		internal PartData[]	part_data;
+		internal int		editing_part_index = -1;
+		internal int 		editing_number = -1;
+		internal string		editing_text;
 
 		bool drop_down_button_entered;
 		#endregion	// Local variables
@@ -312,7 +315,7 @@
 	// invalidate the value inside this control
 	if (ShowCheckBox) {
 		for (int i = 0; i  part_data.Length; i++)
-			part_data [i].is_selected = false;
+			part_data [i].Selected = false;
 		Invalidate (date_area_rect);
 	}
 }
@@ -1145,7 +1148,7 @@
 	case 'g': // Spec says nothing about g, but it seems to be treated like spaces.
 		if (!(lastch == ch || lastch == 0)  literal.Length != 0)
 		{
-			formats.Add (new PartData(literal.ToString (), false));
+			formats.Add (new PartData(literal.ToString (), false, this));
 			literal.Length = 0;
 		}
 		literal.Append (ch);
@@ -1160,24 +1163,24 @@
 			is_literal = !is_literal;
 			break;
 		}
-		formats.Add (new PartData (literal.ToString (), is_literal));
+		formats.Add (new PartData (literal.ToString (), is_literal, this));
 		literal.Length = 0;
 		is_literal = !is_literal;
 		break;
 	default:
 		if (literal.Length != 0)
 		{
-			formats.Add (new PartData(literal.ToString (), false));
+			formats.Add (new PartData(literal.ToString (), false, this));
 			literal.Length = 0;
 		}
-		formats.Add (new PartData (ch.ToString(), true));
+		formats.Add (new PartData (ch.ToString(), true, this));
 		break;
 
 }
 lastch = ch;
 			}
 			if (literal.Length = 0)
-formats.Add (new PartData (literal.ToString (), is_literal));
+formats.Add (new PartData (literal.ToString (), is_literal, this));
 
 			part_data = new PartData [formats.Count];
 			formats.CopyTo (part_data);
@@ -1220,6 +1223,7 @@
 		// drop the calendar down
 		internal void DropDownMonthCalendar ()
 		{
+			EndDateEdit (true);
 			// ensure the right date is set for the month_calendar
 			month_calendar.SetDate (this.date_value);
 			// get a rectangle that has the dimensions of the text area,
@@ -1259,7 +1263,7 @@
 		{
 			for (int i = 0; i  part_data.Length; i++)
 			{
-if (part_data[i].is_selected  !part_data[i].is_literal)
+if (part_data[i].Selected  !part_data[i].is_literal)
 	return i;
 			}
 			return -1;
@@ -1273,55 +1277,42 @@
 return;
 			}
 			
-			switch (part_data[selected_index].value)
+			DateTimePart dt_part = part_data [selected_index].date_time_part;
+			switch (dt_part)
 			{
-case d:
-case dd: // number day formats
+case DateTimePart.Day:
 	if (delta  0) {
 		if (Value.Day == 1)
-			SetPart(DateTime.DaysInMonth(Value.Year, Value.Month), 'd');
+			SetPart(DateTime.DaysInMonth(Value.Year, Value.Month), dt_part);
 		else
-			SetPart(Value.Day + delta, 'd');
+			SetPart(Value.Day + delta, dt_part);
 	} else {
 		if (Value.Day == DateTime.DaysInMonth(Value.Year, Value.Month))
-			SetPart(1, 'd');
+			SetPart(1, dt_part);
 		else
-			SetPart(Value.Day + delta, 'd') ;
+			SetPart(Value.Day + delta, dt_part) ;
 	}
 	break;
-case ddd:
-case : // text day formats
+case DateTimePart.DayName:
 	Value = Value.AddDays(delta);
 	break;
-case h:
-case hh:
-case H:
-case HH: // hour formats
-	SetPart(Value.Hour + delta, 'h');
+case DateTimePart.Hour:
+	SetPart(Value.Hour + delta, dt_part);
 	break;
-case m:
-case mm: // minute formats
-	SetPart(Value.Minute + delta, 'm');
+case DateTimePart.Minutes:
+	SetPart(Value.Minute + delta, dt_part);
 	

[Mono-winforms-list] [Patch] Navigation for auto complete in TextBox

2008-07-13 Thread Carlos Alberto Cortez
Hey,

The attached patch adds support for navigation in TextBox.

It also tries to show the auto complete window when a new char has been
typed, instead of trying to do so when the Text changes. The reason is
that the auto complete window should only appear when the user types,
but not when Text is changed from code, or pasted in the TextBox;
finally, because the auto complete code can set the Text property a lot
of times.

Carlos.
Index: TextBox.cs
===
--- TextBox.cs	(revisión: 107820)
+++ TextBox.cs	(copia de trabajo)
@@ -59,6 +59,7 @@
 		private AutoCompleteMode auto_complete_mode = AutoCompleteMode.None;
 		private AutoCompleteSource auto_complete_source = AutoCompleteSource.None;
 		private AutoCompleteListBox auto_complete_listbox;
+		private string auto_complete_original_text;
 		private ComboBox auto_complete_cb_source;
 #endif
 		#endregion	// Variables
@@ -71,7 +72,7 @@
 			this.LostFocus +=new EventHandler(TextBox_LostFocus);
 			this.RightToLeftChanged += new EventHandler (TextBox_RightToLeftChanged);
 #if NET_2_0
-			TextChanged += new EventHandler (TextBox_TextChanged);
+			MouseWheel += new MouseEventHandler (TextBox_MouseWheel);
 #endif
 
 			BackColor = SystemColors.Window;
@@ -121,12 +122,27 @@
 		}
 
 #if NET_2_0
-		void TextBox_TextChanged (object o, EventArgs args)
+		private void TextBox_MouseWheel (object o, MouseEventArgs args)
 		{
+			if (auto_complete_listbox == null || !auto_complete_listbox.Visible)
+return;
+
+			int lines = args.Delta / 120;
+			auto_complete_listbox.Scroll (-lines);
+		}
+
+		private void ShowAutoCompleteListBox ()
+		{
 			if (auto_complete_mode == AutoCompleteMode.None || auto_complete_source == AutoCompleteSource.None)
 return;
 
-			// We only support CustomSource by now
+			// 
+			// We only support CustomSource *and* Suggest mode by now
+			//
+
+			if (auto_complete_mode != AutoCompleteMode.Suggest)
+return;
+
 			IList source;
 			if (auto_complete_cb_source == null)
 source = auto_complete_custom_source;
@@ -146,12 +162,6 @@
 			if (auto_complete_listbox == null)
 auto_complete_listbox = new AutoCompleteListBox (this);
 
-			// If the text was just set by the auto complete listbox, ignore it
-			if (auto_complete_listbox.WasTextSet) {
-auto_complete_listbox.WasTextSet = false;
-return;
-			}
-
 			string text = Text;
 			auto_complete_listbox.Items.Clear ();
 
@@ -184,6 +194,53 @@
 auto_complete_cb_source = value;
 			}
 		}
+
+		void NavigateAutoCompleteList (Keys key)
+		{
+			int index = auto_complete_listbox.HighlightedIndex;
+			if (index == -1)
+auto_complete_original_text = Text;
+
+			switch (key) {
+case Keys.Up:
+	index -= 1;
+	if (index  -1)
+		index = auto_complete_listbox.Items.Count - 1;
+	break;
+case Keys.Down:
+	index += 1;
+	if (index = auto_complete_listbox.Items.Count)
+		index = -1;
+	break;
+case Keys.PageUp:
+	if (index == -1)
+		index = auto_complete_listbox.Items.Count - 1;
+	else if (index == 0)
+		index = -1;
+	else {
+		index -= auto_complete_listbox.page_size - 1;
+		if (index  0)
+			index = 0;
+	}
+	break;
+case Keys.PageDown:
+	if (index == -1)
+		index = 0;
+	else if (index == auto_complete_listbox.Items.Count - 1)
+		index = -1;
+	else {
+		index += auto_complete_listbox.page_size - 1;
+		if (index = auto_complete_listbox.Items.Count)
+			index = auto_complete_listbox.Items.Count - 1;
+	}
+	break;
+default:
+	break;
+			}
+
+			auto_complete_listbox.HighlightedIndex = index;
+			Text = index == -1 ? auto_complete_original_text : auto_complete_listbox.Items [index];
+		}
 #endif
 
 		private void UpdateAlignment ()
@@ -512,6 +569,29 @@
 		protected override void WndProc (ref Message m)
 		{
 			switch ((Msg)m.Msg) {
+case Msg.WM_KEYDOWN:
+	if (auto_complete_listbox == null || !auto_complete_listbox.Visible)
+		break;
+
+	Keys key_data = (Keys)m.WParam.ToInt32 ();
+	switch (key_data) {
+		case Keys.Down:
+		case Keys.Up:
+		case Keys.PageDown:
+		case Keys.PageUp:
+			NavigateAutoCompleteList (key_data);
+			m.Result = IntPtr.Zero;
+			return;
+		default:
+			break;
+	}
+	break;
+case Msg.WM_CHAR:
+	// Need to call base.WndProc before to have access to
+	// the updated Text property value
+	base.WndProc (ref m);
+	ShowAutoCompleteListBox ();
+	return;
 case Msg.WM_LBUTTONDOWN:
 	// When the textbox gets focus by LBUTTON (but not by middle or right)
 	// it does not do the select all / scroll thing.
@@ -636,12 +716,11 @@
 			Liststring items;
 			int top_item;
 			int last_item;
-			int page_size;
+			internal int page_size;
 			int item_height;
 			int highlighted_index = -1;
 			bool user_defined_size;
 			bool resizing;
-			bool was_text_set;
 			Rectangle resizer_bounds;
 
 			const 

[Mono-dev] [Patch] Implement basic AutoComplete support for ComboBox

2008-07-01 Thread Carlos Alberto Cortez
Hey!

Attached is a patch that implements support for ComboBox.

The idea is to use the available support in TextBox, so the TextBox has
direct access to our items. Since this is not the clearest approach,
it's the better in terms of performance, since otherwise we should
create a IList of item's text, and modifying or updating it as items are
modified in ComboBox.Items collection.

Observe that this patch only makes use of the basic properties of Auto
complete in TextBox. As soon as I check in the keyboard navigation in
TextBox for automplete, I will come with a second patch for ComboBox ;-)

Carlos.
Index: ComboBox.cs
===
--- ComboBox.cs	(revisión: 106985)
+++ ComboBox.cs	(copia de trabajo)
@@ -246,6 +246,8 @@
 
 if(auto_complete_custom_source != null)
 	auto_complete_custom_source.CollectionChanged += new CollectionChangeEventHandler (OnAutoCompleteCustomSourceChanged);
+
+SetTextBoxAutoCompleteData ();
 			}
 		}
 
@@ -263,6 +265,7 @@
 	throw new InvalidEnumArgumentException (Locale.GetText (Enum argument value '{0}' is not valid for AutoCompleteMode, value));
 
 auto_complete_mode = value;
+SetTextBoxAutoCompleteData ();
 			}
 		}
 
@@ -280,8 +283,27 @@
 	throw new InvalidEnumArgumentException (Locale.GetText (Enum argument value '{0}' is not valid for AutoCompleteSource, value));
 
 auto_complete_source = value;
+SetTextBoxAutoCompleteData ();
 			}
 		}
+
+		void SetTextBoxAutoCompleteData ()
+		{
+			if (textbox_ctrl == null)
+return;
+
+			textbox_ctrl.AutoCompleteMode = auto_complete_mode;
+
+			if (auto_complete_source == AutoCompleteSource.ListItems) {
+textbox_ctrl.AutoCompleteSource = AutoCompleteSource.CustomSource;
+textbox_ctrl.AutoCompleteCustomSource = null;
+textbox_ctrl.AutoCompleteInternalSource = this;
+			} else {
+textbox_ctrl.AutoCompleteSource = auto_complete_source;
+textbox_ctrl.AutoCompleteCustomSource = auto_complete_custom_source;
+textbox_ctrl.AutoCompleteInternalSource = null;
+			}
+		}
 #endif
 		public override Color BackColor {
 			get { return base.BackColor; }
@@ -433,6 +455,9 @@
 
 	if (IsHandleCreated == true)
 		Controls.AddImplicit (textbox_ctrl);
+#if NET_2_0
+	SetTextBoxAutoCompleteData ();
+#endif
 }
 
 ResumeLayout ();
Index: TextBox.cs
===
--- TextBox.cs	(revisión: 106985)
+++ TextBox.cs	(copia de trabajo)
@@ -27,6 +27,7 @@
 // NOT COMPLETE
 
 using System;
+using System.Collections;
 using System.ComponentModel;
 using System.ComponentModel.Design;
 using System.Drawing;
@@ -58,6 +59,7 @@
 		private AutoCompleteMode auto_complete_mode = AutoCompleteMode.None;
 		private AutoCompleteSource auto_complete_source = AutoCompleteSource.None;
 		private AutoCompleteListBox auto_complete_listbox;
+		private ComboBox auto_complete_cb_source;
 #endif
 		#endregion	// Variables
 
@@ -121,8 +123,14 @@
 return;
 
 			// We only support CustomSource by now
+			IList source;
+			if (auto_complete_cb_source == null)
+source = auto_complete_custom_source;
+			else
+source = auto_complete_cb_source.Items;
+
 			if (auto_complete_source != AutoCompleteSource.CustomSource ||
-auto_complete_custom_source == null || auto_complete_custom_source.Count == 0)
+source == null || source.Count == 0)
 return;
 
 			if (Text.Length == 0) {
@@ -142,10 +150,14 @@
 
 			string text = Text;
 			auto_complete_listbox.Items.Clear ();
-			foreach (string str in auto_complete_custom_source)
-if (str.StartsWith (text, StringComparison.CurrentCultureIgnoreCase))
-	auto_complete_listbox.Items.Add (str);
 
+			for (int i = 0; i  source.Count; i++) {
+string item_text = auto_complete_cb_source == null ? auto_complete_custom_source [i] :
+	auto_complete_cb_source.GetItemText (auto_complete_cb_source.Items [i]);
+if (item_text.StartsWith (text, StringComparison.CurrentCultureIgnoreCase))
+	auto_complete_listbox.Items.Add (item_text);
+			}
+
 			IListstring matches = auto_complete_listbox.Items;
 			if ((matches.Count == 0) ||
 (matches.Count == 1  matches [0].Equals (text, StringComparison.CurrentCultureIgnoreCase))) { // Exact single match
@@ -159,6 +171,15 @@
 			auto_complete_listbox.Location = PointToScreen (new Point (0, Height));
 			auto_complete_listbox.ShowListBox ();
 		}
+
+		internal ComboBox AutoCompleteInternalSource {
+			get {
+return auto_complete_cb_source;
+			}
+			set {
+auto_complete_cb_source = value;
+			}
+		}
 #endif
 
 		private void UpdateAlignment ()
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] X11 Scrolling Regressions

2008-06-04 Thread Carlos Alberto Cortez
This is likely caused by my last scrolling patch.

I'm taking a look now,
Carlos.

2008/6/4 Ivan N. Zlatev [EMAIL PROTECTED]:

 On Wed, Jun 4, 2008 at 7:04 PM, Ernesto [EMAIL PROTECTED] wrote:
  Ivan N. Zlatev escribió:
  On Wed, Jun 4, 2008 at 6:01 PM, Ernesto [EMAIL PROTECTED] wrote:
 
  Ivan N. Zlatev escribió:
 
  We have two scrolling regressions on X11:
 
  1) Carlos, your X11 changes cause the first. Check the attached test
  case grab: the scrollbar and scroll up/down fast. You will notice that
  we seem not to redraw properly. I can reproduce this with any
  scrollable control.
 
  2) Scrolling with the scrollbar's scroll buttons makes it flicker like
  mad during scrolling. It doesn't happen if I scroll by dragging the
  bar.
 
  Cheers,
  Ivan
 
 
  Maybe this stack trace helps. I'm getting dozens of this when running a
  winforms app:
 
  X11 Error encountered:
  Error: BadWindow (invalid Window parameter)
  Request: 3 (0)
  Resource ID: 0x0
  Serial:  399
  Hwnd:null
  Control: null   at System.Environment.get_StackTrace() in
  ...
 
 
  I do not get such errors here. What's your system? 32bit opensuse 10.3
 here.
 
  64-bit Fedora 9. I started to see those errors after I pulled svn
  yesterday.
  They seem to be related to scroll, that's why I brought this up. The app
  runs anyway (just very slow, because of the dumps I guess).
 

 This is something 64bit specific then. File a bug clearly marked as
 64bit one and with a test case and the stacktrace so that it can get
 looked into at some point.

 Cheers,
 Ivan
 ___
 Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-winforms-list

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-30 Thread Carlos Alberto Cortez
Would you mind filling a bug with the precise information?

Thanks,
Carlos.


El jue, 29-05-2008 a las 02:24 -0700, Bs360 escribió:
 
 
 Alan_Chun wrote:
  
  HI, currently I am porting a windows app to linux using Mono. I have some
  difficulties to get the serial port work. here is the code(based on mono
  website):
  
  
  I have also tried BytesToRead, Read, ReadByte, all of them are working
  fine under windows using .net2.0 framwork. But once I use the mono
  runtime, the nightmare begins.
  
  Any help will be really apprecaited!
  
  Thanks  
  
 
 I'm actually having the same problem. I'm using ubuntu 8.04.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] ListBox.cs ownder draw variable size

2008-05-30 Thread Carlos Alberto Cortez
Hey, 

Two things for your next patch:

* Use the coding guidelines:
http://www.mono-project.com/Coding_Guidelines
* Send your patch as an attached file, not in the body of the message.

Committed your patch,
thanks for the correction!

Carlos.


El mié, 28-05-2008 a las 06:42 +0200, jkeymer escribió:
 Handles calculation if the listbox scroll area of variable high, owner
 draw boxes,
 
 Index: Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
 ===
 --- Managed.Windows.Forms/System.Windows.Forms/ListBox.cs(Revision
 103872)
 +++ Managed.Windows.Forms/System.Windows.Forms/ListBox.cs(Arbeitskopie)
 @@ -2145,9 +2145,20 @@
  last_visible_index = LastVisibleItem ();
 
  int diff = top_item - top_index;
 -
 +int delta = ItemHeight * diff;
 +if (DrawMode == DrawMode.OwnerDrawVariable) {
 +delta = 0;
 +if ( top_index  top_item ) {
 +for ( int i = top_index; i  top_item; i++ )
 +delta += GetItemHeight(i);
 +}
 +else {
 +for ( int i = top_item; i  top_index; i++ )
 +delta -= GetItemHeight(i);
 +}
 +}
  if (IsHandleCreated)
 -XplatUI.ScrollWindow (Handle, items_area, 0, ItemHeight
 * diff, false);
 +XplatUI.ScrollWindow (Handle, items_area, 0, delta, false);
  }
 
  #endregion Private Methods
 
 
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-21 Thread Carlos Alberto Cortez
Hello,


 
 The issue with our code is that we call the Mono posix libraries, this
 is not cross platform.


Our implementation uses the Win32 api in windows and posix calls with a C 
helper layer in Unix platforms. 

Observe that we never tested it with Mac.

Since you are using the Mono.Posix library in Mac, it's likely possible
to use the same functionality using our C helper layer (it resides in
mono/support/serial.c). Probably we need to apply a pair of corrections
there, however.

Carlos.


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-15 Thread Carlos Alberto Cortez
That's likely because 'mono test.exe' actually uses mono, and
'test.exe' runs .net instead.

This appears to be a bug.

Please fill a bug report with the attached repro.

Thanks!
Carlos


El jue, 15-05-2008 a las 12:01 -0700, Alan_Chun escribió:
 
 
 Panoramix wrote:
  
  In Linux to use a device the user who requires access should have the
  permission to use it. 
  So you must verify that the user starts the application is registered in
  the group owner of ttysN. 
  To find out the group owner of the device by a shell run the command
  below:
   
  ls-al / dev / ttyS *
  
  
 
 I haven't tried it under linux yet. What I meant is when I ran the
 exeutable, if I use mono test.exe through windows xp's command line, it
 will generate this error. However, if ran this exe directly (use test.exe
 only on the command line without mono), it worked fine.
 
 Any ideas?
 
 Thanks 
 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Installing policy file in the GAC?

2008-03-05 Thread Carlos Alberto Cortez


 
 gacutil won't install a policy file in the GAC because the policy file isn't
 an assembly. So, obviously, I have to copy it there from the install script.
 But how can the install script find out where Mono is installed? Is there
 any command I can use to get at the Mono installation directory?
 

You don't copy the file directly - but use the assembly linker (al.exe)
to create an assembly based on the configuration file:


al /link:policy-file.config /out:policy.1.0.YourAssembly.dll 
/keyfile:YourAssemblyKey.snk

then you can just gacutil on the generated assembly:

gacutil -i policy.1.0.YourAssembly.dll

See http://msdn2.microsoft.com/en-us/library/dz32563a(vs.71).aspx

Carlos.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] Cache errno for serial port

2008-02-19 Thread Carlos Alberto Cortez
Hey Miguel,

Somehow I had this wrong idea that GetLastError would retrieve
windows-specific codes (not the ones errno gets).

Thanks,
Carlos.


El lun, 18-02-2008 a las 20:19 -0500, Miguel de Icaza escribió:
 Hello Carlos,
 
  The attached patch adds a 'serial_errno' variable in
  mono/support/serial.c, to cache the last error related to serial port
  functions.
  
  At first I tried to just create a function directly retrieving errno,
  but it was getting a different value from the original (probably some
  code modified it after the pinvoke call?).
  
  This is needed to a simple but better error reporting in the
  System.IO.Ports.SerialPort class.
 
 I think you can use DllImport's built-in SetLastError/GetLastError
 framework for this.
 
 Just add this to the DllImport definitions:
 
   [DllImport (something, SetLastError=true)]
 
 And then in the calling code, call:
 
   Marshal.GetLastWin32Error ()
 
 This will contain the errno value.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [PATCH] Cache errno for serial port

2008-02-17 Thread Carlos Alberto Cortez
Hey,

The attached patch adds a 'serial_errno' variable in
mono/support/serial.c, to cache the last error related to serial port
functions.

At first I tried to just create a function directly retrieving errno,
but it was getting a different value from the original (probably some
code modified it after the pinvoke call?).

This is needed to a simple but better error reporting in the
System.IO.Ports.SerialPort class.
 1. 
Carlos.
Index: serial.c
===
--- serial.c	(revisión: 96026)
+++ serial.c	(copia de trabajo)
@@ -60,15 +60,16 @@
 	Rts = 16  /* Request to send */
 } MonoSerialSignal;
 
+/* Last error related to serial port */
+static int serial_errno;
+
 int
 open_serial (char* devfile)
 {
 	int fd;
 	fd = open (devfile, O_RDWR | O_NOCTTY | O_NONBLOCK);
+	serial_errno = errno;
 
-	if (fd == -1)
-		return -1;
-
 	return fd;
 }
 
@@ -79,11 +80,18 @@
 }
 
 guint32
-read_serial (int fd, guchar *buffer, int offset, int count)
+read_serial (int fd, guchar *buffer, int offset, int count, int timeout)
 {
 	guint32 n;
+	struct pollfd ufd;
+	ufd.events = POLLHUP | POLLIN | POLLERR;
+
+	poll (ufd, 1, timeout);
+	if ((ufd.revents  POLLIN) != POLLIN)
+		return -1;
  
 	n = read (fd, buffer + offset, count);
+	serial_errno = errno;
 
 	return (guint32) n;
 }
@@ -114,6 +122,7 @@
 		}		
 
  		t = write(fd, buffer + offset, count);
+		serial_errno = errno;
 		
 		if (timeout  0)
 		{
@@ -142,6 +151,7 @@
 	gint32 retval;
 
 	if (ioctl (fd, input ? FIONREAD : TIOCOUTQ, retval) == -1) {
+		serial_errno = errno;
 		return -1;
 	}
 
@@ -310,6 +320,7 @@
 	if (cfsetospeed (newtio, baud_rate)  0 || cfsetispeed (newtio, baud_rate)  0 ||
 	tcsetattr (fd, TCSANOW, newtio)  0)
 	{
+		serial_errno = errno;
 		return FALSE;
 	}
 	else
@@ -368,6 +379,7 @@
 	*error = 0;
 	
 	if (ioctl (fd, TIOCMGET, signals) == -1) {
+		serial_errno = errno;
 		*error = -1;
 		return NoneSignal;
 	}
@@ -393,8 +405,10 @@
 	else
 		signals = ~expected;
 	
-	if (ioctl (fd, TIOCMSET, signals) == -1)
+	if (ioctl (fd, TIOCMSET, signals) == -1) {
+		serial_errno = errno;
 		return -1;
+	}
 	
 	return 1;
 }
@@ -419,6 +433,7 @@
 	while (poll (pinfo, 1, timeout) == -1  errno == EINTR) {
 		/* EINTR is an OK condition, we should not throw in the upper layer an IOException */
 		if (errno != EINTR){
+			serial_errno = errno;
 			*error = -1;
 			return FALSE;
 		}
@@ -427,6 +442,12 @@
 	return (pinfo.revents  POLLIN) != 0 ? 1 : 0;
 }
 
+gint32
+get_last_serial_error ()
+{
+	return serial_errno;
+}
+
 /*
  * mono internals should not be used here.
  * this serial stuff needs to be implemented with icalls.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-winforms-list] [Patch] Invalidate non visible areas in scrolling

2008-01-21 Thread Carlos Alberto Cortez
Hey Chris,

Attached is an updated patch that basically incorporates all the things
you mentioned in your last mail:

* Determines the visible rectangle, and intersects it with the required
area (this is, we copy only the visible area).
- First by determining the visible area based on its size and its
parents.
- Second, by looking for toplevel windows that intersect the window,
and excluding that area.

* Then compute the destination rectangle, by applying the
XAmount/YAmount values and intersecting it with the area passed to
ScrollWindow (thus we clip it as needed). This is the way Gdk does it.

* Finally, exclude the destination rectangle from the total requested
area, and pass it to AddExpose method.

With this patch everyting is working as expected, but I have some
issues:

* Region needs a Graphics instance to return its Bounds, which *could*
be expensive.
* After taking a look at the way scrolling is done in Gdk, it *seems*
that the Region implementation lack some of the functionality we need
(like, returning in a simple operation the Rectangles describing the
region).

Comments?

Carlos.
Index: XplatUIX11.cs
===
--- XplatUIX11.cs	(revisión: 93328)
+++ XplatUIX11.cs	(copia de trabajo)
@@ -4791,48 +4791,21 @@
 
 			gc = XCreateGC(DisplayHandle, hwnd.client_window, IntPtr.Zero, ref gc_values);
 
-			int src_x, src_y;
-			int dest_x, dest_y;
-			int width, height;
+			Rectangle visible_rect = GetTotalVisibleArea (hwnd.client_window);
+			visible_rect.Intersect (area);
 
-			if (YAmount  0) {
-src_y = area.Y;
-height = area.Height - YAmount;
-dest_y = area.Y + YAmount;
-			}
-			else {
-src_y = area.Y - YAmount;
-height = area.Height + YAmount;
-dest_y = area.Y;
-			}
+			Rectangle dest_rect = visible_rect;
+			dest_rect.Y += YAmount;
+			dest_rect.X += XAmount;
+			dest_rect.Intersect (area);
 
-			if (XAmount  0) {
-src_x = area.X;
-width = area.Width - XAmount;
-dest_x = area.X + XAmount;
-			}
-			else {
-src_x = area.X - XAmount;
-width = area.Width + XAmount;
-dest_x = area.X;
-			}
+			Point src = new Point (dest_rect.X - XAmount, dest_rect.Y - YAmount);
+			XCopyArea (DisplayHandle, hwnd.client_window, hwnd.client_window, gc, src.X, src.Y, 
+	dest_rect.Width, dest_rect.Height, dest_rect.X, dest_rect.Y);
 
-			XCopyArea(DisplayHandle, hwnd.client_window, hwnd.client_window, gc, src_x, src_y, width, height, dest_x, dest_y);
+			Rectangle dirty_area = GetDirtyArea (area, dest_rect, XAmount, YAmount);
+			AddExpose (hwnd, true, dirty_area.X, dirty_area.Y, dirty_area.Width, dirty_area.Height);
 
-			// Generate an expose for the area exposed by the horizontal scroll
-			// We don't use AddExpose since we're 
-			if (XAmount  0) {
-AddExpose(hwnd, true, area.X, area.Y, XAmount, area.Height);
-			} else if (XAmount  0) {
-AddExpose(hwnd, true, XAmount + area.X + area.Width, area.Y, -XAmount, area.Height);
-			}
-
-			// Generate an expose for the area exposed by the vertical scroll
-			if (YAmount  0) {
-AddExpose(hwnd, true, area.X, area.Y, area.Width, YAmount);
-			} else if (YAmount  0) {
-AddExpose(hwnd, true, area.X, YAmount + area.Y + area.Height, area.Width, -YAmount);
-			}
 			XFreeGC(DisplayHandle, gc);
 		}
 
@@ -4848,6 +4821,127 @@
 			ScrollWindow(handle, rect, XAmount, YAmount, with_children);
 		}
 
+		Rectangle GetDirtyArea (Rectangle total_area, Rectangle valid_area, int XAmount, int YAmount)
+		{
+			Rectangle dirty_area = total_area;
+
+			if (YAmount  0)
+dirty_area.Height = total_area.Height - valid_area.Height;
+			else if (YAmount  0) {
+dirty_area.Height = total_area.Height - valid_area.Height;
+dirty_area.Y = total_area.Y + valid_area.Height;
+			}
+
+			if (XAmount  0)
+dirty_area.Width -= valid_area.Width;
+			else if (XAmount  0) {
+dirty_area.Width -= valid_area.Width;
+dirty_area.X += valid_area.Width;
+			}
+
+			return dirty_area;
+		}
+
+		Rectangle GetTotalVisibleArea (IntPtr handle)
+		{
+			Control c = Control.FromHandle (handle);
+
+			Rectangle visible_area = c.ClientRectangle;
+			visible_area.Location = c.PointToScreen (Point.Empty);
+
+			for (Control parent = c.Parent; parent != null; parent = parent.Parent) {
+Rectangle r = parent.ClientRectangle;
+r.Location = parent.PointToScreen (Point.Empty);
+
+visible_area.Intersect (r);
+			}
+
+			// If region is null, the entire area is visible.
+			// Get the area not obscured otherwise.
+			Region visible_region = GetVisibleRegion (c, visible_area);
+			if (visible_region != null) {
+Graphics g = c.CreateGraphics ();
+RectangleF rectf = visible_region.GetBounds (g);
+visible_area = new Rectangle ((int) rectf.X, (int) rectf.Y,
+		(int) rectf.Width, (int) rectf.Height);
+
+visible_region.Dispose ();
+g.Dispose ();
+			}
+
+			visible_area.Location = c.PointToClient (visible_area.Location);
+			return 

Re: [Mono-winforms-list] [Patch] Invalidate non visible areas in scrolling

2008-01-21 Thread Carlos Alberto Cortez
Ah!, perfect!

We wll be using that one, instead.

Carlos.


El lun, 21-01-2008 a las 19:25 -0600, Jonathan Pobst escribió:
 I just added a public property called Hwnd.GraphicsContext that is a 
 cached Graphics we keep around for measuring and such.  If you don't 
 need a specific Graphics, you can just use this one.
 
 Jon
 
 
 Carlos Alberto Cortez wrote:
  Hey Chris,
  
  Attached is an updated patch that basically incorporates all the things
  you mentioned in your last mail:
  
  * Determines the visible rectangle, and intersects it with the required
  area (this is, we copy only the visible area).
  - First by determining the visible area based on its size and its
  parents.
  - Second, by looking for toplevel windows that intersect the window,
  and excluding that area.
  
  * Then compute the destination rectangle, by applying the
  XAmount/YAmount values and intersecting it with the area passed to
  ScrollWindow (thus we clip it as needed). This is the way Gdk does it.
  
  * Finally, exclude the destination rectangle from the total requested
  area, and pass it to AddExpose method.
  
  With this patch everyting is working as expected, but I have some
  issues:
  
  * Region needs a Graphics instance to return its Bounds, which *could*
  be expensive.
  * After taking a look at the way scrolling is done in Gdk, it *seems*
  that the Region implementation lack some of the functionality we need
  (like, returning in a simple operation the Rectangles describing the
  region).
  
  Comments?
  
  Carlos.
  
  
  
  
  ___
  Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-winforms-list
 

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] [PATCH] Invalidate non visible areas when scrolling

2007-11-06 Thread Carlos Alberto Cortez
Hey Chris,

Sorry for the late answer (spent some time fixing some other winforms
bugs).

Commnts below.

El lun, 01-10-2007 a las 22:03 -0700, Chris Toshok escribió:
 It does, but I don't think we need to add tracking of invalid areas
 which are offscreen - the whole point of the invalid area tracking is to
 track things that need to be repainted *because* they're visible.  If
 it's offscreen, we shouldn't need to do anything that complicates it. 
 
 It seems like a better solution to just figure in the clipping by parent
 forms into the pseudo clipping we already do.  The scroll code takes
 into account that a child's view can be larger than the child (the
 AddExpose calls).  It shouldn't be too hard to figure out the *actual*
 visible rectangle of that child, if it's not already done someplace, and
 make the AddExpose calls take that into account, without the additional
 calculation (and invalidation, which will just be ignored anyway).
 

As I can understand it, the AddExpose calls (in ScrollWindow method) are
not there to take into account the possibility of child can be larger
than its parents, but to invalidate the area not being copied when doing
the scroll. 

For example, to try this thing, I put a listview in a form, with the
listview being smaller than the form, and I still see the AddExpose
calls (from console messages indicating so).

And not, it's not being done already somewhere else. 

Taking a look at the sample at 324513  could help.

Probably I'm still missing something?

Hope this helps,
Carlos.


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] New to the list

2007-09-07 Thread Carlos Alberto Cortez
Hello


 
 Heh... yes, I have that feeling too. I just didn't want to made 
 design-level changes (and even if I did want, I didn't dare since this 
 is my first day with the winforms source code).
 However, I can explain how I see the problem so you guys decide if 
 deeper changes are necesary.
 
 The ListView problem:
 
 1) When a new SubItem is added, the ListViewSubItem constructor sets the 
 SubItem text.
 2) Text.set in the SubItem Text property calls Invalidate(Bounds).
 3) Bounds.get calls GetBounds() and this calls GetItemLocation().
 4) GetItemLocation() uses the items_location[] array.
 
 Now, items_location[] is set to an initial lenght of [16] by the 
 ListView constructor, and extended by AdjustItemsPositionArray if needed.
 AdjustItemsPositionArray is only called by CalculateListView, which is 
 called only before a redraw.
 
 So, if you add a 17th item before a redraw, you get an index out of 
 bounds at ListView.GetItemLocation().
 
 I think the problem here is that Invalidate() ends up usign 
 items_location[], which is only calculated when redrawing. That doesn't 
 seem to make sense sometimes, since Invalidate() happens _before_ the 
 redraw.

Actually the sequence is: Redraw () - Invalidate () - Update (Paint)

The thing is is that Redraw (and thus AdjustItemsPositionArray) is
_always_ called before Invalidate or Update (or Paint, which actually
requests Items count info and more). So this should be a problem
_apparently_.

The problem anyway seems to be an out of synch state between them. The
problem is: I can't reproduce it.

Do you have a sample case? 

Carlos.


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] SerialPort - patch waiting to apply

2007-07-01 Thread Carlos Alberto Cortez
El jue, 28-06-2007 a las 17:44 +0200, Leszek Ciesielski escribió:
 http://bugzilla.ximian.com/show_bug.cgi?id=78911
 
 There's a patch and Miguel's positive comment - can someone apply this, 
 please?

Sorry, I thought I had applied it already. This is now in SVN.

Thanks for the remainder.


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-winforms-list] [PATCH] ToolTip patch

2007-05-15 Thread Carlos Alberto Cortez
Hey,

The small attached patch changes a pair of bits of the ToolTip class.

The first change is that calling SetToolTip for a control that already
shown its associated tooltip should make it visible _again_ if the mouse
pointer is inside its bounds.

The second one is that we were not updating fine the tooltip text when
SetToolTip was called for a control showing the tooltip at the moment;
it also should reset its internal timer (based on the MS behaviour).

Comments?

Carlos.
Index: ToolTip.cs
===
--- ToolTip.cs	(revisión: 77422)
+++ ToolTip.cs	(copia de trabajo)
@@ -121,6 +121,12 @@
 base.OnPaint(pevent);
 			}
 
+			protected override void OnTextChanged (EventArgs args)
+			{
+Invalidate ();
+base.OnTextChanged (args); 
+			}
+
 			protected override void Dispose(bool disposing) {
 if (disposing) {
 	this.string_format.Dispose();
@@ -377,13 +383,17 @@
 			}
 			
 			// if SetToolTip is called from a control and the mouse is currently over that control,
-			// make sure that tooltip_window.Text gets updated
-			if (caption != null  last_control == control) {
+			// make sure that tooltip_window.Text gets updated if it's being shown,
+			// or show the tooltip for it if is not
+			if (active_control == control  caption != null  state == TipState.Show) {
 Size size = ThemeEngine.Current.ToolTipSize(tooltip_window, caption);
 tooltip_window.Width = size.Width;
 tooltip_window.Height = size.Height;
 tooltip_window.Text = caption;
-			}
+timer.Stop ();
+timer.Start ();
+			} else if (MouseInControl (control))
+ShowTooltip (control);
 		}
 
 		public override string ToString() {
@@ -452,10 +462,8 @@
 			timer.Stop();
 			state = TipState.Initial;
 
-			// if we're in the same control as before (how'd that happen?) or if we're not active, leave
-			if (!is_active || (active_control == control)) {
+			if (!is_active)
 return;
-			}
 
 			if (!show_always) {
 IContainerControl cc = last_control.GetContainerControl ();
___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] Bugzilla bugs needing attention

2007-03-05 Thread Carlos Alberto Cortez

  The others I'll verify the patches content and commit if no
 one objects in the next few hours. That if my networking troubles with
 access to Mono's SVN repository, doesn't forbid me. In that case I'll
 report in this thread.

It would be a good idea to also have some tests for those patches before
committing.

Carlos.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-winforms-list] Again problems with ListView

2007-02-15 Thread Carlos Alberto Cortez
El jue, 15-02-2007 a las 15:15 +0100, pablosantosluac escribió:
 Hi all,
 
 I've just detected the following problem in our GUI client (a WinForms app 
 running on Mono/Linux).
 
 In a listView the AfterLabelEdit event doesn't seem to be working correctly. 
 It should receive a
 System.Windows.Form.LabelEditEventArgs argument with some information like 
 the label name, item index and so on. It arrives uninitialized.
 
 Is it a known problem? or I'm doing something wrong?
 
 It is one of the three (hopefuly) remaining blockers we have at the moment.


Could you fill a bug in bugzilla with the sample?

Carlos.

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] ListView fails to update ListViewItem display on submember updates

2007-01-29 Thread Carlos Alberto Cortez
El dom, 28-01-2007 a las 15:05 -0600, Brian Wolfe escribió:
 I wrote an application in VisualStudio that uses a ListView. On windows,
 when I call myListView.Update() it repaints all of the changed items
 jsut fine. When I compile it under Mono it fails to update the rows.
 

It should behave exactly as .Net. Could you please fill a bug report? 

Carlos.


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] [Mono-list] serial port problem

2007-01-18 Thread Carlos Alberto Cortez
Hey,

Could you cook a test case? That way we can try to take a look at the
issue.

Carlos.

 
 First, I can succesfully read a text string, when I loopback a
 serial cable, connecting pins 2 and 3 I send the string and can
 read it immediatly, it worked fine for me in Linux (running mono as
 root, my mono version is 1.2.2). The code I used is the same found in
 http://www.mono-project.com/HowToSystemIOPorts
 
 But I cannot succeed in another mono application, where I try to
 communicate to an external device using modbus (binary protocol). The
 device correctly understands my query, and I know it responds (because
 a TX led blinks in the device), but mono can't get any data from the
 port. Depending on mono version, and whether I'm root or not, I can
 get two types of error... sometimes a timeout exception is raised,
 and sometimes i get a byte with a 255 value.
 
 I tryed other (non-mono) applications to communicate to the same
 external device, and they work ok in Linux, and also in Windows.
 
 I'm still debugging, but maybe there is something with DTR signals,
 etc., or maybe a bug with binary communications.
 
 i'll keep trying and will post if I find a solution
 
 if anyone got binary communications working OK, please inform what was
 the os distributon/ monon version used...eventually i could change my
 system set-up, if that fixed the problem
 
 thanks, Victor
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [Patch] TreeView, TreeNode, TreeNodeCollection

2007-01-09 Thread Carlos Alberto Cortez

 
  +   public virtual void RemoveByKey(string key)
  +   {
  +   int index = -1;
  +   for (int i = 0; i  nodes.Count; i++)
  +   {
  +   if (!string.Equals(nodes[i].Name,key, 
  StringComparison.CurrentCultureIgnoreCase))
  +   continue;
  +
  +   index = i;
  +   break;
  +   }
 
 Ditto. Additionally, what happens on MS.NET if you remove the
 String.Empty key? What happens if the collection has duplicate keys?
 Will be the keys deleted all together or just the first/last/random
 occurrence?

As far as I can tell, RemoveByKey behaves just like the other
Key-related methods, so when passing a null or empty string it should do
nothing.

Also, when having duplicate keys, the method should remove the first
occurrence (at least that happens with ListView related collections, for
example).

Anyway, the best thing do do, as Robert said, is to write tests.

Carlos.




___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] Generate Consts.vb from Consts.cs (new patch)

2006-08-24 Thread Carlos Alberto Cortez

 I might be wrong but I am wondering if it is consistent to use Perl for 
 this kind of things, inside the mono project. It would be more logical 
 to use Mono itself, and then not having another external dependency 
 (Mono depending on Perl??), right?

Just for the record: we already have perl scripts in the build system,
as well in gtk-sharp, for example.

Carlos.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] Use the correct type for S.D.Printing.PrintDocument.PrintController

2006-08-04 Thread Carlos Alberto Cortez
Hey,

I tried your sample with .Net 2.0, and got:

controller = System.Windows.Forms.PrintControllerWithStatusDialog

Probably in .Net 1.1 it's handled different (if you are using that
version, of course).

Carlos.

El mié, 02-08-2006 a las 07:45 -0400, Chris Toshok escribió:
 this doesn't work unless System.Windows.Forms is being used, it appears.
 
 The following test:
 
 using System;
 using System.Drawing;
 using System.Drawing.Printing;
 
 public class Foo {
   public static void Main (string[] args) {
 PrintDocument doc = new PrintDocument ();
 
 Console.WriteLine (controller = {0},
 doc.PrintController.GetType());
   }
 }
 
 outputs:
 
   controller = System.Drawing.Printing.StandardPrintController
 
 Chris
 
 On Wed, 2006-08-02 at 04:30 -0500, Carlos Alberto Cortez wrote:
  Hey,
  
  S.D.Printing.PrintDocument.PrintController has as default a new instance
  of S.W.F.PrintControllerWithStatusDialog, which is in SWF assembly. 
  
  The current code assigns a new instance of S.D.P.StandardPrintController
  to PrintDocument.PrintController, which isn't the right behaviour.
  
  The problem is that it's not a good idea to add System.Windows.Forms as
  a reference to the System.Drawing assembly IMHO. So, the approach is to
  load the SWD assembly using reflection and then cache the type .ctor.
  
  
  Also, PrintDocument.PrintController should be never null, and should get
  a new PrintControllerWithStatusDialog instance, just like .Net does.
  
  Carlos. 
 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [PATCH] Use the correct type for S.D.Printing.PrintDocument.PrintController

2006-08-02 Thread Carlos Alberto Cortez
Hey,

S.D.Printing.PrintDocument.PrintController has as default a new instance
of S.W.F.PrintControllerWithStatusDialog, which is in SWF assembly. 

The current code assigns a new instance of S.D.P.StandardPrintController
to PrintDocument.PrintController, which isn't the right behaviour.

The problem is that it's not a good idea to add System.Windows.Forms as
a reference to the System.Drawing assembly IMHO. So, the approach is to
load the SWD assembly using reflection and then cache the type .ctor.


Also, PrintDocument.PrintController should be never null, and should get
a new PrintControllerWithStatusDialog instance, just like .Net does.

Carlos. 
Index: PrintDocument.cs
===
--- PrintDocument.cs	(revisión: 63154)
+++ PrintDocument.cs	(copia de trabajo)
@@ -34,6 +34,7 @@
 
 using System;
 using System.ComponentModel;
+using System.Reflection;
 
 namespace System.Drawing.Printing
 {
@@ -45,6 +46,8 @@
 		private PrinterSettings printersettings;
 		private PrintController printcontroller;
 		private string documentname;
+
+		static ConstructorInfo pcontroller_with_status_ctor;
 #if !(NET_1_0)
 		private bool originAtMargins = false; // .NET V1.1 Beta
 #endif
@@ -53,8 +56,20 @@
 			documentname = document; //offical default.
 			defaultpagesettings = new PageSettings(); // use default values of default printer
 			printersettings = new PrinterSettings(); // use default values
-			printcontroller = new StandardPrintController();
+			printcontroller = CreatePrintControllerWithStatusDialog (new StandardPrintController ());
 		}
+
+		PrintController CreatePrintControllerWithStatusDialog (PrintController underlying_pc)
+		{
+			if (pcontroller_with_status_ctor == null) {
+Assembly wf_assembly = Assembly.Load (System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089);
+Type pcontroller_with_status_type = wf_assembly.GetType (System.Windows.Forms.PrintControllerWithStatusDialog);
+pcontroller_with_status_ctor = pcontroller_with_status_type.GetConstructor (new Type [] {typeof (PrintController)});
+			}
+
+			PrintController retval = (PrintController) pcontroller_with_status_ctor.Invoke (new object [] {underlying_pc});
+			return retval;
+		}
 		
 		// properties
 		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
@@ -89,7 +104,8 @@
 return printcontroller;
 			}
 			set{
-printcontroller = value;
+printcontroller = value == null ? 
+	CreatePrintControllerWithStatusDialog (new StandardPrintController ()) : value;
 			}
 		}
 
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] Use the correct type for S.D.Printing.PrintDocument.PrintController

2006-08-02 Thread Carlos Alberto Cortez
Oh, that's perfect (I wasn't aware of that constant). 

Carlos.

El mié, 02-08-2006 a las 14:00 +0200, Robert Jordan escribió:
 Hey,
 
 Carlos Alberto Cortez wrote:
  +   Assembly wf_assembly = Assembly.Load 
  (System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, 
  PublicKeyToken=b77a5c561934e089);
 
 The version of the assembly is wrong.
 
 Please use the constant `Consts.AssemblySystem_Windows_Forms' instead
 of the hard coded assembly name.
 
 
 Robert
 
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-winforms-list] [PATCH] Correct behavior for PrintDialog.PrinterSettings/Document

2006-07-28 Thread Carlos Alberto Cortez
Hey,



The attached patch fixes the behaviour in

PrintDialog.PrinterSettings/Document, to be consistent with .Net.



I also included some simple nunit tests that ran fine with .Net too.



Carlos.







  





Index: PrintDialog.cs
===
--- PrintDialog.cs	(revisión: 63089)
+++ PrintDialog.cs	(copia de trabajo)
@@ -40,7 +40,6 @@
 	[DefaultProperty(Document)]
 	public sealed class PrintDialog : CommonDialog {
 		PrintDocument document;
-		PrinterSettings printer_settings;
 		bool allow_current_page;
 		bool allow_print_to_file;
 		bool allow_selection;
@@ -83,7 +82,7 @@
 
 		public override void Reset ()
 		{
-			current_settings = null;
+			current_settings = new PrinterSettings ();
 			AllowPrintToFile = true;
 			AllowSelection = false;
 			AllowSomePages = false;
@@ -157,12 +156,8 @@
 			}
 
 			set {
-if (value == null)
-	return;
-
 document = value;
-current_settings = value.PrinterSettings;
-printer_settings  = null;
+current_settings = value == null ? new PrinterSettings () : value.PrinterSettings;
 			}
 		}
 
@@ -171,11 +166,14 @@
 		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
 		public PrinterSettings PrinterSettings {
 			get {
-return printer_settings;
+return current_settings;
 			}
 
 			set {
-current_settings = printer_settings = value;
+if (value != null  value == current_settings)
+	return;
+
+current_settings = value == null ? new PrinterSettings () : value;
 document = null;
 			}
 		}
//
// PrintDialogTest.cs: Tests for PrintDialog class.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// Software), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
//	Carlos Alberto Cortez [EMAIL PROTECTED]
//

using System;
using System.Collections;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
using NUnit.Framework;

namespace MonoTests.System.Windows.Forms
{
	[TestFixture]
	public class PrintDialogTest
	{
		[Test]
		public void DefaultValues ()
		{
			PrintDialog pd = new PrintDialog ();

			Assert.IsTrue (pd.AllowPrintToFile, #1);
			Assert.IsFalse (pd.AllowSelection, #2);
			Assert.IsFalse (pd.AllowSomePages, #3);
			Assert.IsNull (pd.Document, #4);
			Assert.IsNotNull (pd.PrinterSettings, #5);
			Assert.IsFalse (pd.PrintToFile, #6);
			Assert.IsFalse (pd.ShowHelp, #7);
			Assert.IsTrue (pd.ShowNetwork, #8);
		}

		[Test]
		public void DocumentTest ()
		{
			PrintDialog pd = new PrintDialog ();

			PrintDocument pdoc1 = new PrintDocument ();
			PrinterSettings ps1 = new PrinterSettings ();
			pdoc1.PrinterSettings = ps1;
			pd.Document = pdoc1;
			Assert.AreEqual (pdoc1, pd.Document, #1);
			Assert.AreEqual (ps1, pd.PrinterSettings, #2);

			PrinterSettings ps2 = new PrinterSettings ();
			pdoc1.PrinterSettings = ps2;
			pd.Document = pdoc1;
			Assert.AreEqual (pdoc1, pd.Document, #3);
			Assert.AreEqual (ps2, pd.PrinterSettings, #4);

			pd.Document = null;
			Assert.IsNull (pd.Document, #5);
			Assert.IsNotNull (pd.PrinterSettings, #6);
			if (pd.PrinterSettings == ps1)
Assert.Fail (#7);
		}

		[Test]
		public void PrinterSettingsTest ()
		{
			PrintDialog pd = new PrintDialog ();

			PrinterSettings ps1 = new PrinterSettings ();
			pd.PrinterSettings = ps1;
			Assert.AreEqual (ps1, pd.PrinterSettings, #1);
			Assert.IsNull (pd.Document, #2);

			pd.PrinterSettings = null;
			Assert.IsNotNull (pd.PrinterSettings, #3);
			Assert.IsNull (pd.Document, #4);
			if (pd.PrinterSettings == ps1)
Assert.Fail (#5);
		}
	}
}

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-winforms-list] [PATCH] Correct behavior for PrintDialog.PrinterSettings/Document

2006-07-28 Thread Carlos Alberto Cortez

I removed the printer_settings field, since it wasn't necessary. Maybe
we could just change current_settings to printer_settings, like a
cosmetic change.

Carlos.

El vie, 28-07-2006 a las 16:24 -0400, Chris Toshok escribió:
 These look fine, particularly if the unit tests pass.  Is there any way
 we can either 1) clear up the names (current_settings and
 printer_settings are confusing), or 2) get rid of one of them and only
 have one PrinterSettings object?
 
 Chris
 
 On Fri, 2006-07-28 at 14:53 -0500, Carlos Alberto Cortez wrote:
  Hey,
  
  The attached patch fixes the behaviour in
  PrintDialog.PrinterSettings/Document, to be consistent with .Net.
  
  I also included some simple nunit tests that ran fine with .Net too.
  
  Carlos.
  
  
  
  ___
  Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-winforms-list
 

___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


[Mono-winforms-list] SWF test applications

2006-06-01 Thread Carlos Alberto Cortez
Hey,

We are putting some small SWF applications in
mono-cvs.ximian.com/extras/trunk/wf-apps (from sites such CodeProject
and SourceForge, and free applications in general).

Some of they expose small problems (bugs or performance issues). I'm
taking note of some problems and trying to cook small test cases for
them, but it would be a good idea to take a look at them (specially for
the guys working in this area).

Carlos.


___
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Re: [Mono-dev] SerialPort and Ring Indicator signal

2006-05-23 Thread Carlos Alberto Cortez
Hey,

The functionality for serial port inside kernel32.dll allows to access
the RING signal (the wrapper class makes public the access to it), but
it's only available on Windows (kernel32.dll is a core windows library).
Of course you could try to wrap some functionality in Unix systems
-using termios and ioctl interfaces- in a new class.

But from the System.IO.Ports.SerialPort is not possible to access that
pin signal -because of the api compatibility-.

For monitoring the RING signal -only checking its state-, take a look at
SerialPort.SerialPinChange event (observe that RING signal is not yet
monitored, although doing it is a matter of adding some constants in a
pair of places). I will take a look at it on the weekend.

Carlos.

El mar, 23-05-2006 a las 09:53 +0200, jfm escribió:
 Thank you Carlos for your answer
 I'm not sure I've well undestound but here are some information about
 the app I'm porting.
 As serial port are not supported in .Net 1, the app was using the
 Rs232.vb class that is wide spread accros the internet... This class
 is some kind of wrapper upon the kernel32.dll... I'm not sure these
 informations are of any help...
 In you mail you said that RI can be monotored with events ?? please
 could you give mon hints about this ??? this could be a solution for
 me !
 Thank you.
 
 Jean-François
 
 PS : please forget my English ;)
 
 Carlos Alberto Cortez wrote: 
  Well, RING indicator can't be directly used (as opossed to Cts, Dsr, CD,
  Rts and Dtr). The public API in .Net does not expose this indicator
  directly (you can only monitor it based on the events).
  
  Of course we could add it to the get_signal_code () function and
  retrieve it. But the real problem is that we can't add it - we must keep
  compatibility with .Net API.
  
  Probably this is achieved in some way - since you mentioned that you are
  porting a .Net app-. But in that case, we must have additional info -and
  some code-.
  
  Carlos.
  
  El lun, 22-05-2006 a las 18:58 +0200, jfm escribió:

   Hi,
   I'm porting a program running on microsoft .net to mono. This program 
   uses modem information like Dsr and Cts but it also uses RI (ring 
   indicator).
   My problem is that RI doesn't seem to be supported (see enum 
   MonoSerialSignal in the get_signal_code function in serial.c), am I right 
   ?
   If yes, I could make the modification, I think it is only few lines 
   (adding a new entry to the enum and a if with TIOCM_RI (defined in 
   ioctl-type.h) in the function but it might involve recompiling a lots of 
   thing and I don't know how to do.
   
   Best regards
   
   Jean-François
   ___
   Mono-devel-list mailing list
   Mono-devel-list@lists.ximian.com
   http://lists.ximian.com/mailman/listinfo/mono-devel-list
   
  
  

 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] SerialPort and Ring Indicator signal

2006-05-22 Thread Carlos Alberto Cortez
Well, RING indicator can't be directly used (as opossed to Cts, Dsr, CD,
Rts and Dtr). The public API in .Net does not expose this indicator
directly (you can only monitor it based on the events).

Of course we could add it to the get_signal_code () function and
retrieve it. But the real problem is that we can't add it - we must keep
compatibility with .Net API.

Probably this is achieved in some way - since you mentioned that you are
porting a .Net app-. But in that case, we must have additional info -and
some code-.

Carlos.

El lun, 22-05-2006 a las 18:58 +0200, jfm escribió:
 Hi,
 I'm porting a program running on microsoft .net to mono. This program 
 uses modem information like Dsr and Cts but it also uses RI (ring 
 indicator).
 My problem is that RI doesn't seem to be supported (see enum 
 MonoSerialSignal in the get_signal_code function in serial.c), am I right ?
 If yes, I could make the modification, I think it is only few lines 
 (adding a new entry to the enum and a if with TIOCM_RI (defined in 
 ioctl-type.h) in the function but it might involve recompiling a lots of 
 thing and I don't know how to do.
 
 Best regards
 
 Jean-François
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [Patch] mono/support/serial.c

2006-04-07 Thread Carlos Alberto Cortez
Hello,

The attached patch has some changed that I need to apply some others in
the C# side in the class library.

Is it ok to commit?

Carlos.
Index: serial.c
===
--- serial.c	(revisión: 59128)
+++ serial.c	(copia de trabajo)
@@ -41,11 +41,12 @@
 
 /* This is a copy of System.IO.Ports.SerialSignal */
 typedef enum {
-	Cd = 0, /* Carrier detect */
-	Cts = 1, /* Clear to send */
-	Dsr = 2, /* Data set ready */
-	Dtr = 3, /* Data terminal ready */
-	Rts = 4  /* Request to send */
+	NoneSignal,
+	Cd = 1, /* Carrier detect */
+	Cts = 2, /* Clear to send */
+	Dsr = 4, /* Data set ready */
+	Dtr = 8, /* Data terminal ready */
+	Rts = 16  /* Request to send */
 } MonoSerialSignal;
 
 int
@@ -67,8 +68,6 @@
 	tcflush(fd, TCIOFLUSH);
 	tcsetattr(fd,TCSANOW,newtio);
 
-	fcntl (fd, F_SETFL, O_NONBLOCK);
-
 	return fd;
 }
 
@@ -79,19 +78,9 @@
 }
 
 guint32
-read_serial (int fd, guchar *buffer, int offset, int count, int timeout)
+read_serial (int fd, guchar *buffer, int offset, int count)
 {
 	guint32 n;
-	struct pollfd ufd;
-
-	ufd.fd = fd;
-	ufd.events = POLLHUP | POLLIN | POLLERR;
-
-	poll (ufd, 1, timeout);
-
-	if ((ufd.revents  POLLIN) != POLLIN) {
-		return -1;
-	}
  
 	n = read (fd, buffer + offset, count);
 
@@ -123,6 +112,20 @@
 	tcflush(fd, input ? TCIFLUSH : TCOFLUSH);
 }
 
+gint32
+get_bytes_in_buffer (int fd, gboolean input, gint32 *error)
+{
+	gint32 retval;
+
+	*error = 0;
+	if (ioctl (fd, input ? TIOCINQ : TIOCOUTQ, retval) == -1) {
+		*error = -1;
+		return -1;
+	}
+
+	return retval;
+}
+
 gboolean
 set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStopBits stopBits, MonoHandshake handshake)
 {
@@ -249,22 +252,42 @@
 			return TIOCM_DTR;
 		case Rts:
 			return TIOCM_RTS;
+		default:
+			return 0;
 	}
 
 	/* Not reached */
 	return 0;
 }
 
+static MonoSerialSignal
+get_mono_signal_codes (int signals)
+{
+	MonoSerialSignal retval = NoneSignal;
+
+	if ((signals  TIOCM_CAR) != 0)
+		retval |= Cd;
+	if ((signals  TIOCM_CTS) != 0)
+		retval |= Cts;
+	if ((signals  TIOCM_DSR) != 0)
+		retval |= Dsr;
+	if ((signals  TIOCM_DTR) != 0)
+		retval |= Dtr;
+	if ((signals  TIOCM_RTS) != 0)
+		retval |= Rts;
+
+	return retval;
+}
+
 gint32
-get_signal (int fd, MonoSerialSignal signal)
+get_signals (int fd)
 {
-	int signals, expected;
+	int signals;
 
-	expected = get_signal_code (signal);
 	if (ioctl (fd, TIOCMGET, signals) == -1)
 		return -1;
 	
-	return (expected  signals) != 0;
+	return get_mono_signal_codes (signals);
 }
 
 gint32
@@ -291,6 +314,21 @@
 	return 1;
 }
 
+gint32
+poll_serial (int fd)
+{
+	struct pollfd pinfo;
+	
+	pinfo.fd = fd;
+	pinfo.events = POLLIN;
+	pinfo.revents = 0;
+
+	if (poll (pinfo, 1, 0) == -1)
+		return -1;
+
+	return (pinfo.revents  POLLIN) != 0 ? 1 : 0;
+}
+
 /*
  * mono internals should not be used here.
  * this serial stuff needs to be implemented with icalls.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Re: Profiling output

2006-03-24 Thread Carlos Alberto Cortez
Hello,

A pair of years ago I wrote a small patch for saving the profile output
to a xml file. It's almost sure that you won't be able to apply this
patch to the current sources, but it could help you to write a custom
profiler or just 'catch' the info.

Carlos.

El vie, 24-03-2006 a las 07:44 +0100, Jacob Ilsø Christensen escribió:
 Hi.
 
 On 3/23/06, Robert Jordan [EMAIL PROTECTED] wrote:
  Hey,
 
  Jacob Ilsø Christensen wrote:
   Hi.
  
   I have been experimenting a bit with monos profiling option. I run
   mono like this:
  
   mono --profile=default:time A.exe
  
   This results in the profiling information being printed to stdout. Is
   there a way to redirect this information to e.g. a file to prevent it
   from being mixed with the output from the program (A.exe) itself?
 
  It depends on your shell. With sh/bash you can redirect both
  output streams to different files:
 
  mono --profile=default:time A.exe  2 errors  1 output
 
 That's not exactly what I meant. What I want is a way to prevent the
 output from the profiler from being mingled with the output from the
 application being profiled.
 
 Any ideas?
 
 /Jacob
 
 
  Robert
 
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list
? xml_profile.diff
Index: profiler.c
===
RCS file: /cvs/public/mono/mono/metadata/profiler.c,v
retrieving revision 1.20
diff -u -r1.20 profiler.c
--- profiler.c	22 Mar 2004 17:48:46 -	1.20
+++ profiler.c	24 Mar 2004 02:45:20 -
@@ -7,6 +7,8 @@
 #include gmodule.h
 
 static MonoProfiler * current_profiler = NULL;
+static const char *profiler_xml_file = NULL;
+static FILE *xml_file = NULL;
 
 static MonoProfileAppDomainFunc   domain_start_load;
 static MonoProfileAppDomainResult domain_end_load;
@@ -682,6 +684,61 @@
 	printf (Total number of calls: %lld\n, total_calls);
 }
 
+static guint64
+total_number_calls (GList *funcs)
+{
+	GList *tmp;
+	MethodProfile *mp;
+	guint64 total_calls = 0;
+
+	for (tmp = funcs; tmp; tmp = tmp-next) {
+		mp = tmp-data;
+		total_calls += mp-count;
+	}
+
+	return total_calls;
+}
+
+static gboolean output_callers_xml (MethodProfile *p);
+
+static gboolean
+output_profile_xml (GList *funcs)
+{
+	char *m;
+	GList *tmp;
+	guint64 total_calls;
+	int length;
+	MethodProfile *p;
+
+	total_calls = total_number_calls (funcs);
+	length = fprintf (xml_file, \ttime calls=\%lld\\n, total_calls);
+	if (length  0)
+		return FALSE;
+
+	for (tmp = funcs; tmp; tmp = tmp-next) {
+		p = tmp-data;
+
+		if (!(gint)(p-total*1000))
+			continue;
+
+		m = method_get_name (p-method);
+		length = fprintf (xml_file, \t\tmethod count=\%llu\ name=\%s\ time=\%f\ total=\%f\\n,
+p-count, m, (double) (p-total * 1000)/(double) p-count, (double) p-total * 1000);
+		
+		if (length  0 || !output_callers_xml (p))
+			return FALSE;
+
+		length = fprintf (xml_file, \t\t/method\n);
+		g_free (m);
+
+		if (length  0)
+			return FALSE;
+	}
+	length = fprintf (xml_file, \t/time\n);
+	
+	return (length  0)?TRUE:FALSE;
+}
+
 typedef struct {
 	MethodProfile *mp;
 	guint count;
@@ -766,6 +823,106 @@
 	}
 }
 
+static gboolean
+output_callers_xml (MethodProfile *p) {
+	char *m;
+	guint total_callers, percent;
+	int length;
+	CallerInfo *cinfo;
+	GSList *sorted, *tmps;
+
+	total_callers = 0;
+	for (cinfo = p-caller_info; cinfo; cinfo = cinfo-next)
+		total_callers += cinfo-count;
+	sorted = sort_caller_list (p-caller_info);
+	for (tmps = sorted; tmps; tmps = tmps-next) {
+		cinfo = tmps-data;
+		percent = (cinfo-count * 100)/total_callers;
+		if (percent  1)
+			continue;
+		m = method_get_name (cinfo-caller);
+		length = fprintf (xml_file, \t\t\tcaller count=\%d\ name=\%s\ percent=\%d\/\n,
+cinfo-count, m, percent);
+		g_free (m);
+		if (length  0)
+			return FALSE;
+	}
+
+	return TRUE;
+}
+
+static guint
+total_allocated_mem (GList *proflist)
+{
+	GList *tmp;
+	NewobjProfile *p;
+	guint total = 0;
+
+	for (tmp = proflist; tmp; tmp = tmp-next) {
+		p = tmp-data;
+		total += p-count;
+	}
+
+	return total;
+}
+
+static gboolean
+output_newobj_profile_xml (GList *proflist)
+{
+	AllocInfo *ainfo;
+	GList *tmp;
+	GSList *sorted, *tmps;
+	MethodProfile *mp;
+	MonoClass *klass;
+	NewobjProfile *p;
+	const char *isarray;
+	char *m;
+	char buf [256];
+	guint total;
+	int length;
+
+	total = total_allocated_mem (proflist);
+	length = fprintf (xml_file, \tallocation mem=\%d\\n, total / 1024);
+	if (length  0)
+		return FALSE;
+	for (tmp = proflist; tmp; tmp = tmp-next) {
+		p = tmp-data;
+		if (p-count  5)
+			continue;
+		mp = p-mp;
+		m = method_get_name (mp-method);
+		length = fprintf (xml_file, \t\tmethod size=\%d\ name=\%s\\n, p-count / 1024, m);
+		g_free (m);
+		if 

Re: [Mono-dev] Embedded Mono/errors in domain-internals.h

2006-03-16 Thread Carlos Alberto Cortez

 
 The other question that I've been wondering is should I update Mono
 source files from svn when I update mcs? Because most of the changes
 that I'm interested in are to mcs and so Mono would stay rather stable
 in my environment. 

Yes, you need to update both (mono and mcs modules from svn), since some
functionality in mcs is found in mono (calls to unmanaged code is an
example) and they need to be synchronised.

Carlos.

 
 Help would be very much appreciated...
 
 Cheers, Janne
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [Patch] Signals access in mono/support/serial

2006-03-14 Thread Carlos Alberto Cortez
Hello,

The attached patch adds a pair of small functions to access signals
information for the serial port. 

Carlos.
Index: serial.c
===
--- serial.c	(revisión: 57943)
+++ serial.c	(copia de trabajo)
@@ -10,6 +10,7 @@
 #include fcntl.h
 #include string.h
 #include sys/poll.h
+#include sys/ioctl.h
 
 #include glib.h
 
@@ -202,6 +203,62 @@
 	return TRUE;
 }
 
+static gint32
+get_signal_code (MonoSerialSignal signal)
+{
+	switch (signal) {
+		case Cd:
+			return TIOCM_CAR;
+		case Cts:
+			return TIOCM_CTS;
+		case Dsr:
+			return TIOCM_DSR;
+		case Dtr:
+			return TIOCM_DTR;
+		case Rts:
+			return TIOCM_RTS;
+	}
+
+	/* Not reached */
+	return 0;
+}
+
+gint32
+get_signal (int fd, MonoSerialSignal signal)
+{
+	int signals, expected;
+
+	expected = get_signal_code (signal);
+	if (ioctl (fd, TIOCMGET, signals) == -1)
+		return -1;
+	
+	return (expected  signals) != 0;
+}
+
+gint32
+set_signal (int fd, MonoSerialSignal signal, gboolean value)
+{
+	int signals, expected, activated;
+
+	expected = get_signal_code (signal);
+	if (ioctl (fd, TIOCMGET, signals) == -1)
+		return -1;
+	
+	activated = (signals  expected) != 0;
+	if (activated == value) /* Already set */
+		return 1;
+	
+	if (value)
+		signals |= expected;
+	else
+		signals = ~expected;
+	
+	if (ioctl (fd, TIOCMSET, signals) == -1)
+		return -1;
+	
+	return 1;
+}
+
 /*
  * mono internals should not be used here.
  * this serial stuff needs to be implemented with icalls.
Index: serial.h
===
--- serial.h	(revisión: 57943)
+++ serial.h	(copia de trabajo)
@@ -27,5 +27,14 @@
 	OnePointFive = 3
 } MonoStopBits;
 
+/* This is a copy of System.IO.Ports.SerialSignal */
+typedef enum {
+	Cd = 0, /* Carrier detect */
+	Cts = 1, /* Clear to send */
+	Dsr = 2, /* Data set ready */
+	Dtr = 3, /* Data terminal ready */
+	Rts = 4  /* Request to send */
+} MonoSerialSignal;
+
 #endif
 
Index: ChangeLog
===
--- ChangeLog	(revisión: 57943)
+++ ChangeLog	(copia de trabajo)
@@ -1,3 +1,7 @@
+2006-03-14  Carlos Alberto Cortez [EMAIL PROTECTED]
+
+	* serial.c: Add functions to handle signals access.
+
 2006-03-09  Carlos Alberto Cortez [EMAIL PROTECTED]
 
 	* serial.c: Fix a pair of wrong or incomplete assignations
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [Patch] Stream 2.0 updates

2006-02-28 Thread Carlos Alberto Cortez
Hey,

This patch adds some of the new 2.0 members to System.IO.Stream. No
problems appeared when building, and only got some warnings (they can be
removed adding 'override' to the child streams).

Carlos.
Index: Stream.cs
===
--- Stream.cs	(revisión: 57384)
+++ Stream.cs	(copia de trabajo)
@@ -63,6 +63,14 @@
 			get;
 		}
 
+#if NET_2_0
+		public virtual bool CanTimeout {
+			get {
+return false;
+			}
+		}
+#endif
+
 		public abstract long Length
 		{
 			get;
@@ -94,6 +102,24 @@
 		{
 			Close ();
 		}
+
+		public virtual int ReadTimeout {
+			get {
+throw new InvalidOperationException (Timeouts are not supported on this stream.);
+			}
+			set {
+throw new InvalidOperationException (Timeouts are not supported on this stream.);
+			}
+		}
+
+		public virtual int WriteTimeout {
+			get {
+throw new InvalidOperationException (Timeouts are not supported on this stream.);
+			}
+			set {
+throw new InvalidOperationException (Timeouts are not supported on this stream.);
+			}
+		}
 #endif
 
 		protected virtual WaitHandle CreateWaitHandle()
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [Patch] Constant changes in mono/support/serial.c

2006-02-22 Thread Carlos Alberto Cortez
Hello,

The attached patch updates some comparisons in mono/support/serial.c
(some values inside System.IO.Ports changed and need to be taken in
count).

May I proceed?

Carlos.
Index: serial.c
===
--- serial.c	(revisión: 56687)
+++ serial.c	(copia de trabajo)
@@ -121,21 +121,21 @@
 	}
 
 	switch (parity) {
-	case 0: /* Even */
-		newtio.c_iflag = ~IGNPAR;
-		newtio.c_cflag |= PARENB;
-		break;
-	case 1: /* Mark */
-		/* XXX unhandled */
-		break;
-	case 2: /* None */
+	case 0: /* None */
 		newtio.c_iflag |= IGNPAR;
 		newtio.c_cflag = ~(PARENB | PARODD);
 		break;
-	case 3: /* Odd */
+	case 1: /* Odd */
 		newtio.c_iflag = ~IGNPAR;
 		newtio.c_cflag |= PARENB | PARODD;
 		break;
+	case 2: /* Even */
+		newtio.c_iflag = ~IGNPAR;
+		newtio.c_cflag |= PARENB;
+		break;
+	case 3: /* Mark */
+		/* XXX unhandled */
+		break;
 	case 4: /* Space */
 		/* XXX unhandled */
 		break;
@@ -154,10 +154,10 @@
 
 	newtio.c_cflag = ~CSTOPB;
 	switch (stopBits) {
-	case 0: /* One */
+	case 1: /* One */
 		/* do nothing, the default is one stop bit */
 		break;
-	case 1: /* OnePointFive */
+	case 3: /* OnePointFive */
 		/* XXX unhandled */
 		break;
 	case 2: /* Two */
@@ -174,27 +174,26 @@
 	case 0: /* None */
 		/* do nothing */
 		break;
-	case 1: /* RequestToSend (RTS) */
+	case 2: /* RequestToSend (RTS) */
 #ifdef CRTSCTS
 		newtio.c_cflag |= CRTSCTS;
 #endif /* def CRTSCTS */
 		break;
-	case 2: /* RequestToSendXOnXOff (RTS + XON/XOFF) */
+	case 3: /* RequestToSendXOnXOff (RTS + XON/XOFF) */
 #ifdef CRTSCTS
 		newtio.c_cflag |= CRTSCTS;
 #endif /* def CRTSCTS */
 		/* fall through */
-	case 3: /* XOnXOff */
+	case 1: /* XOnXOff */
 		newtio.c_iflag |= IXOFF;
 		//		newtio.c_oflag |= IXON;
 		break;
 	}
 	
-	cfsetospeed (newtio, baud_rate);
-	cfsetispeed (newtio, baud_rate);
+	if (cfsetospeed (newtio, baud_rate)  0 || cfsetispeed (newtio, baud_rate)  0 ||
+			tcsetattr (fd, TCSADRAIN, newtio)  0)
+		return FALSE;
 
-	tcsetattr(fd,TCSADRAIN,newtio);
-
 	return TRUE;
 }
 
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Assembly Mono.Cecil not found while compiling

2006-02-21 Thread Carlos Alberto Cortez
Yes, tha's the way it works: you install the assembly in the GAC, and
_optionally_ set pkg info for the assembly. So, yes, you need to have
the assembly in GAC even when using the pkg option.

El dom, 19-02-2006 a las 17:33 +0530, vijaya raghava mutharaju escribió:
 
Hi,
 
  Thank you Robert and Carlos. I compiled with the -pkg option
 and did it successfully. But when I remove the Mono.Cecil.dll assembly
 from the GAC, it is still giving complaints. I have to do both. Use
 -pkg option as well as keep it in GAC. Thanks once again.
 
 
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


  1   2   >