Mono / .net related stuff - Monodevelop.sfs

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#21 Post by MU »

I added some basic "Winforms to Glade" support to csharp2vala.

It supports buttons and textboxes.
The generated vala project contains the code to load the generated gladefile, and the eventhandlers work.

This has just started, so it will not be usable yet in practice, but the concept works now.
The rest is "just" adding more elements and eventhandlers.

This seems better doable than converting code itself (overloaded classes, polymorphism and other nasty stuff), so for my project in the end of the course, I might focus on the Winforms converter classes.

The screenshot shows the original (C#) on the left, and Vala on the right.
On the right, you see two small application windows.
The left is, what you see right after conversion. The right one was quickly "re-layouted" by hand in Glade afterwards, as layout containers are not converted.

The program now automatically detects, if it runs in Windows or Linux.

Mark
Attachments
testprojects.tar.gz
extract in /root/ or c:\
(66.32 KiB) Downloaded 595 times
csharp2vala05.tar.gz
Open and run in Monodevelop or Visual Studio.
(66.67 KiB) Downloaded 620 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

MUguest
Posts: 73
Joined: Sat 09 Dec 2006, 16:40

#22 Post by MUguest »

New csharp2vala06c:

- cleaned up interface for the converter.

- choice, if original code is added as comments or not.

- inlayed vala code.


You can include converterdirectives like
//PCB start
...
//PCB end


means: Preferred Code Block
If this is found, this code is used.

Like this you also can "ignore code":
//ICB start
...
//ICB end


Code surrounded by this directive, will not be converted.

For one-liners, use:
//PC ... yourcode ...

If this directive is found, yourcode will be used instead of the following line.

The screenshot shows Visual Studio with such directives, and ValaIDE with the resulting Vala program.

Mark
Attachments
testprojects.zip
(76.11 KiB) Downloaded 569 times
csharp2vala06c.zip
(72.72 KiB) Downloaded 586 times

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#23 Post by MU »

today only a minor update.
You now have a fileselection dialog, to select another project than the one in /root/testprojects.

This is not well tested yet, but seems to work in Visual Studio (Win) and Monodevelop (Linux).
I had to rewrite several variables, they now are public in the class Form1, not in Convertproject. There was a design error before, that made it not possible to modify them afterwards.

The location of the last project is not "remembered" yet, although it already creates a configfile in ~/.csharp2vala.

Mark
Attachments
csharp2vala07.tar.gz
(79.74 KiB) Downloaded 590 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

MUguest
Posts: 73
Joined: Sat 09 Dec 2006, 16:40

#24 Post by MUguest »

09, restructured, each glade element now has an own class.
Added some more elements, and a selected projectfolder now is stored.

Mark
Attachments
csharp2vala09.jpg
(53.79 KiB) Downloaded 1980 times
WindowsFormsTest.zip
(58.47 KiB) Downloaded 666 times
csharp2vala09.zip
(95.49 KiB) Downloaded 678 times

MUguest
Posts: 73
Joined: Sat 09 Dec 2006, 16:40

#25 Post by MUguest »

v10
notes:
notebook pages (Win: tabcontrol) are invisible, if they contain nothing.
So you must put elements in the pages using Glade.

Text boxes need a textbuffer so that you can "do" something with the text.
Same with treeviews, they need a listmodel.
I'd like to add such requirements later automatically generated.

Next week I first will add some more elements, and try to layout them (place the tabcontrol contents inside the notebook pages, and maybe use a "fixed" panel to arrange elements).

Mark
Attachments
WindowsFormsTest.zip
(68.35 KiB) Downloaded 672 times
csharp2vala10b.zip
(105.5 KiB) Downloaded 708 times
csharp2vala10.jpg
(89.33 KiB) Downloaded 767 times

MUguest
Posts: 73
Joined: Sat 09 Dec 2006, 16:40

#26 Post by MUguest »

added more elements:
-menubar (currently empty)
-statusbar
-progressbar
-hbox (flowlayout)
-vbox (flowlayout)
-picturebox
- calendar
-spinbutton
- notebook tabs now use assigned text

Mark
Attachments
csharp2vala11.zip
(126.18 KiB) Downloaded 673 times
WindowsFormsTest.zip
(93.41 KiB) Downloaded 648 times

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#27 Post by MU »

here is version 12.
It has no "visible" advantages, so no need to download it.
I just upload it in order to document, how the project evolves.

I started to add a logic to layout the elements of a winform (but it does not save anything yet!).
The code now gets somewhat complex :roll:

The XML representation of each widget is added to an own arraylist.
These arraylists are managed by two other arraylists.
So they can be "resorted" lateron.


Then a "layout()" method begins to sort out (using the xml lists and the original winforms file), what widget is a child of another widget.
In this step, also positioning informations are added.
This part is not finished yet, as visible on the screenshot.

Once the whole "chains" of inheritance are created, the previously generated xml lists can be re-combined on base of this structure.

A special case are elements, that are placed directly on the "rootwindow".
They may be placed absolutely (like on a GtkFixed), or using a table layout like in the Java Swing BorderLayout.
Each tablecell itself can be separated again, so you can put a menubar and a toolbar on top of the window, and they scale to the wiindowsize.
I included a "rootwindow.glade", that simulates this with hboxes/vboxes.
I later must integrate such a layout for the rootwindow.

Another issue:
a SplitContainer has 2 panels in Winforms.
In Gtk, it has none, these must e defined in addition.
So I had to hack in somewhere the generation of these panels.
It is solved a bit ugly, but well...
I will continue on monday.

Mark
Attachments
csharp2vala12.jpg
(92.96 KiB) Downloaded 1713 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

mymas
Posts: 3
Joined: Sun 29 Mar 2009, 14:07
Location: japan

#28 Post by mymas »

hi, I try to use csharp2vala.

http://live.gnome.org/Vala/GladeSample

I look at this glade sample code. and then add --pkg option
but, receive fellowing error...

C:\testprojects\WindowsFormsTest\valaout>valac main.vala Form1.vala Class1.vala
--pkg gtk+-2.0 --pkg libglade-2.0 --pkg gmodule-2.0
main.vala:14.17-14.36: warning: local variable `form1' declared but never used
var form1 = new Form1 ();
^^^^^^^^^^^^^^^^^^^^
Form1.c: In function `windows_forms_test_form1_construct':
Form1.c:31: error: `GladeXML' undeclared (first use in this function)
Form1.c:31: error: (Each undeclared identifier is reported only once
Form1.c:31: error: for each function it appears in.)
Form1.c:31: error: `xml' undeclared (first use in this function)
error: cc exited with status 1
Compilation failed: 1 error(s), 1 warning(s)

my develop environment:

Windows XP Home sp3
vala 0.61 http://code.google.com/p/valide/downloads/list

download glade source
glade sourve http://ftp.gnome.org/pub/GNOME/sources/ ... 2.2.tar.gz

copy to
C:\vala-0.6.1\include\glade

My --pkg option is wrong? I don't know correct --pkg option.
thanks. regard.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#29 Post by MU »

download glade source
glade sourve http://ftp.gnome.org/pub/GNOME/sources/ ... 2.2.tar.gz

copy to
C:\vala-0.6.1\include\glade
No, this is not sufficient.
You need the libglade dlls.

http://dotpups.de/puppy4/dotpups/Progra ... alog32.zip

Extract it to C:\vala-0.6.1\
It includes libglade compiled for Windows.

I uploaded the vala packages I use in Windows here:
http://dotpups.de/puppy4/dotpups/Progra ... r-Windows/
The readme.txt explains how I use them.

If it does not work, I can test it again in a fresh setup.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

mymas
Posts: 3
Joined: Sun 29 Mar 2009, 14:07
Location: japan

#30 Post by mymas »

Mu, Thanks very much. It's works.
No problem =)

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#31 Post by MU »

8)

Next week I have 3 days left to fix the bugs I added by rewriting code to get the automatic layouting to work.

E.g. splitpanels mess up project.glade, so that glade refuses to load it.

The screenshot shows a small testprogram running in Visual Studio (C#, Winforms, Windows XP) and right after conversion in Vala-IDE (Vala/Gtk2, Newyearspup).
I did not edit the converted project in Glade - it started out of the box like this after compilation in the Vala-IDE.

A download follows friday in 1 week after the presentation.
Mark
Attachments
csharp2vala15.jpg
(169.85 KiB) Downloaded 753 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

MUguest
Posts: 73
Joined: Sat 09 Dec 2006, 16:40

#32 Post by MUguest »

:D

I did NOT alter the resulting Window in Glade :!:
It is directly compiled and run after conversion :P

You just had to resize some elements for a "perfect" result, that takes 1 minute.

Tomorrow I will have a look, if I can convert menus.

Mark
Attachments
csharp2vala16e.zip
(161 KiB) Downloaded 705 times
csharp2vala16d-mini.jpg
(29.03 KiB) Downloaded 2173 times
csharp2vala16d.jpg
(100.98 KiB) Downloaded 805 times

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#33 Post by MU »

This is almost the "final" state, as I have just 1 day left to finish the project.

I added support for menus, even nested submenus work.
The menu and the statusbar will be not placed in the "fixed" widget, but in a vbox, so they expand with the window.

All other elements now are sized.
In most cases this gives better results than before.
Just flowlayouts look strange then, and must be adjusted by hand in Glade (see the bottom left corner, where the button is expanded).

Tomorrow I plan:
- add a scrolled-window to surround textboxes,
- remove unneeded properties (they throw warnings when the program runs - not critical, but it would look more professional to avoid them).
- if a menubar is available, move all elements on the "fixed" sligtly up.
I cannot gurantee, that I'll have success with every point.

I plan to announce the program in a Mono Mailinglist or so, so that it can be continued by other people.
Even if they are not interested in Vla - the Winforms to Glade feature is great for C#, too (Monodelop, Glade#).

Myself I will concentrate on Genie programming, and do not plan to extend it further on my own.
You still could add "thousands" of enhancements (more widgets, convert more than one form, ...), and it would take several weeks or even months, to implement all of this.

Mark
Attachments
csharp2vala17-mini.jpg
(42.06 KiB) Downloaded 1923 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#34 Post by MU »

Here is the final release.

I improved the import of multiline text, added scrolledwindows to textboxes, shadows to the treeviews.

If a menu is used, the elements are moved up to get the original aspect ratios.

Mark
Attachments
csharp2vala18mini.jpg
(36.98 KiB) Downloaded 1936 times
csharp2vala18.jpg
(134.87 KiB) Downloaded 720 times
WindowsFormsTest.zip
(105.52 KiB) Downloaded 574 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#35 Post by MU »

here are the final files I used for the presentation.
Still need to set up a webpage and translate fies to english...

http://dotpups.de/csharp2vala/

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
DanYHKim
Posts: 103
Joined: Mon 15 Sep 2008, 01:51

Puppy Monodevelop .iso - VMware Guest under WinXP Host

#36 Post by DanYHKim »

Nice work on the Monodevelop in Puppy. It works out of the box for me.
I have it running as a VMware guest on my WinXP host.

While running, I noticed that the mouse cursor can "break out" of the VMware window to my XP desktop. This is a behavior I normally see when a VMware guest has the VMware Tools installed. Otherwise, I must use CTRL-Alt to make the VMware guest let go of the mouse.

How does this happen? Is it a function of the Newyearspup base distro for Puppy Monodevelop, or is it something else?

I'd love to know, because VMware Tools doesn't really buy me any compelling advantages in a Puppy guest virtual machine except for the mouse breakout.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#37 Post by MU »

no, it does not have the vmware tools installed.
I have no idea, what causes that behaviour.
Maybe it has to do with the newer Xorg it uses (7.4, compared to 7.3 in Puppy 4.x).
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

ALC
Posts: 3
Joined: Mon 02 Nov 2009, 06:28

#38 Post by ALC »

i tried to install the iso that you have uploaded
X fails to start when i try to run it with Xorg server and when i try to choose Xvesa i seems to work during 1 or 2 sec and my screen becomes blank right after...what's happening?

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#39 Post by Lobster »

Try using vesa again at a lower res than normal
I had to use vesa rather than xorg . . .
I uploaded an Iso (190 MB)
I downloaded it.

Being very impressed with MONO
(first looked at it when I was using Knoppix
- very immature at the time)

Now it is something rather simple and good
I tried to work out the Eclipse IDE
Too hard.

I may have access to some
interesting C# code so . . .
MONO with your Vala editions . . . Hooray!

Some questions you might know about
You can embed the mono or jit or some such in
a C# program - I hear they can be quite small
but not Puppy small . . . ?

Anyway I hope to look further into the possibilities and
really pleased this Puppy Mono environment exists ;)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

snayak
Posts: 422
Joined: Wed 14 Sep 2011, 05:49

#40 Post by snayak »

Many thanks Mark. Monodevelop iso works nice for learning .Net.

Did you got a chance to brought up .Net Core 1.0.4 on any puppy?
[Precise 571 on AMD Athlon XP 2000+ with 512MB RAM]
[Fatdog 720 on Intel Pentium B960 with 4GB RAM]

[url]http://srinivas-nayak.blogspot.com/[/url]

Post Reply