Mono / .net related stuff - Monodevelop.sfs
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
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 598 times
-
- csharp2vala05.tar.gz
- Open and run in Monodevelop or Visual Studio.
- (66.67 KiB) Downloaded 622 times
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
- 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 573 times
-
- csharp2vala06c.zip
- (72.72 KiB) Downloaded 589 times
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
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 592 times
09, restructured, each glade element now has an own class.
Added some more elements, and a selected projectfolder now is stored.
Mark
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 670 times
-
- csharp2vala09.zip
- (95.49 KiB) Downloaded 682 times
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
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 675 times
-
- csharp2vala10b.zip
- (105.5 KiB) Downloaded 710 times
-
- csharp2vala10.jpg
- (89.33 KiB) Downloaded 767 times
added more elements:
-menubar (currently empty)
-statusbar
-progressbar
-hbox (flowlayout)
-vbox (flowlayout)
-picturebox
- calendar
-spinbutton
- notebook tabs now use assigned text
Mark
-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 682 times
-
- WindowsFormsTest.zip
- (93.41 KiB) Downloaded 650 times
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
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
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
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
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.
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.
No, this is not sufficient.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
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
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
I did NOT alter the resulting Window in Glade
It is directly compiled and run after conversion
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 708 times
-
- csharp2vala16d-mini.jpg
- (29.03 KiB) Downloaded 2173 times
-
- csharp2vala16d.jpg
- (100.98 KiB) Downloaded 805 times
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
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
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
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 578 times
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
Still need to set up a webpage and translate fies to english...
http://dotpups.de/csharp2vala/
Mark
Puppy Monodevelop .iso - VMware Guest under WinXP Host
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.
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.
- Lobster
- Official Crustacean
- Posts: 15522
- Joined: Wed 04 May 2005, 06:06
- Location: Paradox Realm
- Contact:
Try using vesa again at a lower res than normal
I had to use vesa rather than xorg . . .
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
I had to use vesa rather than xorg . . .
I downloaded it.I uploaded an Iso (190 MB)
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