Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


6 Pages«<23456>
Options
Go to last post Go to first unread
Offline Davide Carpi  
#61 Posted : 03 February 2016 19:25:05(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: Alex.M Go to Quoted Post
Davide, do you think there is a conceptual way to change the name of the imbedded image during copy / paste? I cannot think of one.


Hello Alex,

the simplest thing that I can think is to use a random temporary directory for each region or a random file name for each region; in both the cases the name can be randomly generated the first time you need to edit the file, and kept until the SMath session ends. In both the cases copy/paste and clone are not involved since the values can be generated on the fly at the first use in the class.

Code:
if (String.IsNullOrEmpty(tempPath))
{
   tempPath = ...;
}
// launch the image editor for the image stored in the tempPath


Using a random filename you can keep in memory only the extension of the file; using a random directory you can keep the original filename.


Originally Posted by: Alex.M Go to Quoted Post
Will try :-) update / resize functions are used throughout the code and it will take some effort to seprate the two (i.e. resize without re-rendering of svg, unless certain condition). It should be possible, the question is whether I will be succesful at it.

Use RequestEvaluation() only if you need to get data from the canvas or push data into the canvas; to update the drawings in your methods you can use PrePainter() and Invalidate() (prepainter if change in the sizes is involved). When the resize marks are used, you can deal with Resize().

Edited by user 03 February 2016 20:12:36(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline vldmrrr  
#62 Posted : 03 February 2016 20:48:09(UTC)
vldmrrr

Rank: Newbie

Groups: Registered
Joined: 03/02/2016(UTC)
Posts: 2

Originally Posted by: Alex.M Go to Quoted Post
Also I am getting close to the point where I wanted to be for the Image Region development (once I take care of the above, if it proves to be possible / necessary). Do you guys have any major griefs with it, or suggestions? Otherwise I wil wrap it up and publish to the extensions manager.


I am not sure if this counts as major grief, but here is screenshot where displayed stroke style is different from what was intended in inksape.

Capture.PNG
Offline Jean Giraud  
#63 Posted : 04 February 2016 06:54:57(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: vldmrrr Go to Quoted Post
I am not sure if this counts as major grief, but here is screenshot where displayed stroke style is different from what was intended in inksape.
.

____________________ certainly very annoying:

... missing closure in Inkscape ? ... problem saving from Inkscape ?
... Smath not reading correct ? [doubtful]

Read more: once the object is imported in the image region,
"Reset to original size" ... stretch the right handle to create space.
At this point, if you want to zomm ± : move the bottom handle up/down,
that procedure will respect the "Aspect ratio". I have checked the Smath
image zoom with IrfanView: for photos they are ~ equal quality.

The last brick in the wall about editable region(s) is the "Formatted Label".
Possibly useful for collecting functions of same family, vg: PDF, CDF ...

Jean

Formatted Label Styles.bmp
Offline Alex M.  
#64 Posted : 04 February 2016 10:43:33(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
This release addresses all the issues below.
Not resolved:
1. Rendering of inkscape arrows. Even though I am using new SVG renderer, the arrow is still off - now it is reversed. On a plus side - arrow on the left end of line points correctly - use that one.
2. image border on init - proved to be much trouble for the amount of benefit.


Otherwise it is smooth sailing so far. All that is left from what I would like to implement is two new formats: .psd (work with layers) and .dxf (hugely beneficial from engineering perspective).

Cheers all!

ImageRegion.007.zip (189kb) downloaded 41 time(s).

Originally Posted by: Alex.M Go to Quoted Post
Hi All, I probably wont get to work on the image region till weekend, however it is a good idea to think of a roadmap. Martin, to discuss your comments:

<Let the context menu entries just select the default format and create the empty image of appropriate format on the fly when the user double-clicks the region.>

I have done this - found no file found error annoying as well after some use (new .dll is not included yet).

<1. Insert Image
2. try to switch off the image border in the context menu.
this does not work for me, the border is still displayed.>

Unless I am wrong, this is how original image region behaved (I just redownloaded it), do we want to change that?

<If I open the image in the attached sm file, then some objects are invisible in inkscape.>

I am at the stand still here. The plugin only zooms SVG files if no height/width is present inside the file, or if it is set to % (as I did for blank svg). For either of those cases, when inkscape re-opens the svg, the "3D Box" objects were minimized to the bottom left corner (you still can scale them up if desired). If someone can come up with .svg file that both scales in SMath, and is saved/opened correctly by inkscpe I can use it as a blank document in the plugin. It is not a big deal for me though - how often will you sketch those 3D boxes in SMath?

<What is the intent of the different behaviour between cloning and copy/paste?>

This one is tricky. While there is no intent, per say, I am not sure how to change it either. You see, I can define Clone () though the code, while copy/paste just takes the region and creates the exact duplicate (just like Davide mentioned). And while you can edit the formula you copy/pasted, you cannot redefine the filename of the image in the region from SMath. Davide, do you think there is a conceptual way to change the name of the imbedded image during copy / paste? I cannot think of one..

<Try to disable/suppress region update during resizing>

Will try :-) update / resize functions are used throughout the code and it will take some effort to seprate the two (i.e. resize without re-rendering of svg, unless certain condition). It should be possible, the question is whether I will be succesful at it.



Offline mkraska  
#65 Posted : 04 February 2016 12:40:31(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: Alex.M Go to Quoted Post
This release addresses all the issues below.
Not resolved:
1. Rendering of inkscape arrows. Even though I am using new SVG renderer, the arrow is still off - now it is reversed. On a plus side - arrow on the left end of line points correctly - use that one.
2. image border on init - proved to be much trouble for the amount of benefit.


Otherwise it is smooth sailing so far. All that is left from what I would like to implement is two new formats: .psd (work with layers) and .dxf (hugely beneficial from engineering perspective).

Cheers all!



Great work, Alex. Even the 3D-shape problem has been resolved.

I've got a question related to SVG page size and image size.

In order to keep line thickness, arrow sizes, symbols and the like consistent in a document, I would like to be able to reset the zoom level of an svg image to that one which is used upon init of a new region.

For png, this is done by "reset to original size", for svg this does not work.
So far, the only option to keep the scale consistent, is to always use new image regions (not copies or clones) for new images and to never resize them.

I guess that the svg images somehow maintain a record of their page size, otherwise it would not be known to inkscape. Could that be used to resize the image region to the original scale?

How do you handle this issue?


Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Alex M.  
#66 Posted : 04 February 2016 18:12:49(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: mkraska Go to Quoted Post
Originally Posted by: Alex.M Go to Quoted Post
This release addresses all the issues below.
Not resolved:
1. Rendering of inkscape arrows. Even though I am using new SVG renderer, the arrow is still off - now it is reversed. On a plus side - arrow on the left end of line points correctly - use that one.
2. image border on init - proved to be much trouble for the amount of benefit.


Otherwise it is smooth sailing so far. All that is left from what I would like to implement is two new formats: .psd (work with layers) and .dxf (hugely beneficial from engineering perspective).

Cheers all!




I guess that the svg images somehow maintain a record of their page size, otherwise it would not be known to inkscape. Could that be used to resize the image region to the original scale?





This was fixed in the attached. Keep in mind that re-rendering of SVG only on click or evaluation is not a bug - it speeds up resizing


Davide, thank you for the pointers - really helped. Few more questions for you:

1. In SMath release manager, how do I build / publish a project that was not created by me?

2. I have added another dependency to the project (better SVG render engine), how do I add it in the SVN repo, which file do I modify?

3. Adding better svg rendering engine required me to build for .NET 3.5; how to I change it by hand in the SVN repo?

Also no go on DXF - no engine that can render that in .NET; a pity. So I will add .psd support and publish the plugin. I need .psd to simplify stetching on top of existing blueprints / drawings - one layer - existing drawing, another - my freehand stuff.


ImageRegion.008.zip (189kb) downloaded 44 time(s).

Edited by user 04 February 2016 18:20:05(UTC)  | Reason: Not specified

thanks 1 user thanked Alex M. for this useful post.
on 04/02/2016(UTC)
Offline mkraska  
#67 Posted : 04 February 2016 18:33:39(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: Alex.M Go to Quoted Post
Originally Posted by: mkraska Go to Quoted Post



I guess that the svg images somehow maintain a record of their page size, otherwise it would not be known to inkscape. Could that be used to resize the image region to the original scale?





This was fixed in the attached. Keep in mind that re-rendering of SVG only on click or evaluation is not a bug - it speeds up resizing



Thanks again for the update. Now it is possible to restore the region size of svg images after changing it in SMath.

But if the paper size is changed in Inkscape, the region doesn't recognize this. At least you can't reset it to a size reflecting the changed values.

Maybe, it is an option, to change the paper size in inkscape to the actual region size whenever inkscape is called? Don't know what side effects this might have but changing the papersize in inkscape seems to be cumbersome and the proposed procedure would be very easy to handle. You would always see in inkscape, what the original size of your region would be.

Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Davide Carpi  
#68 Posted : 04 February 2016 19:09:14(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: Alex.M Go to Quoted Post
Davide, thank you for the pointers - really helped.

You're welcome Good

Originally Posted by: Alex.M Go to Quoted Post
Few more questions for you:

1. In SMath release manager, how do I build / publish a project that was not created by me?

If has the same GUID, you have to ask Andrey; the GUID is linked to the first publisher.

Originally Posted by: Alex.M Go to Quoted Post
2. I have added another dependency to the project (better SVG render engine), how do I add it in the SVN repo, which file do I modify?
I've seen. Good job, this fork of the "SVG Rendering Library" is active, thus bugs in that library may be fixed.
3. Adding better svg rendering engine required me to build for .NET 3.5; how to I change it by hand in the SVN repo?

It's all in the ImageRegion.csproj file; you have to edit it following this scheme.

Originally Posted by: Alex.M Go to Quoted Post
Also no go on DXF - no engine that can render that in .NET; a pity

netDxf (the one embedded in the modeller region) doesn't works? (not tested, but seems it is possible)

Originally Posted by: Alex.M Go to Quoted Post
I need .psd to simplify stetching on top of existing blueprints / drawings - one layer - existing drawing, another - my freehand stuff.

Not sure if this is easier but I think a good approach may be to replicate what is possible to do with the image editor of greenshot. Any sketch may be treated as an object of the region (like a layer) drawn over the background. Part of the code may be taken from the modeller region. Just an idea.

2016-02-04 17_06_41-Greenshot image editor.png

EDIT

Originally Posted by: Alex.M Go to Quoted Post
Keep in mind that re-rendering of SVG only on click or evaluation is not a bug - it speeds up resizing

You can define a private bool Resizing -> OnMouseDown: set it true if you are over the resize markers -> OnMouseUp: if is true trigger the re-rendering and set it to false;

Edited by user 04 February 2016 19:55:26(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Jean Giraud  
#69 Posted : 04 February 2016 19:54:29(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
IMHO, I don't understand why sticking with Inkscape that is just a gadget.
Doing something with CorelDraw, AutoCad ... would make more sense to me.
Most [if not all] Inkscape is doing, is done in Mathcad "Creating Amazing Images"
This Handbook is huge, 10MB. My point here is an "SmathDraw" version as another
product ... in competition with Industry established standard.

PTC, "ProEngineer, Winchill" is great stuff.

Smath does not manage large size matrix, consequently the image region,
Proof: The first Inkscape that Martin posted, the image region does
replot in parts only, not entirely. That's why I posted a scaled down
version that reproduces completely. And, Martin orignal Inkscape is
a peanut size graphic for whoever would want doing some project.

Assume all the Inkscape dedication is successful, fine. But Smath does
not have a 3D graphic to render. It does not plot/rotate 3D matrix,
it only renders as image of limited size.

I understand [I think] what you are after from the Edu. point of view.
But, like Charlie Brown said: "Lola, please get out of your childhood".

Earth is flat on Inkscape.

I'm not negative, just objective in my Cartesian mind wrt Smath.

Jean





Offline Alex M.  
#70 Posted : 04 February 2016 20:29:48(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
IMHO, I don't understand why sticking with Inkscape that is just a gadget.
Doing something with CorelDraw, AutoCad ... would make more sense to me.


Suggest "real" file format that:
1. does not require paid editing software
2. Is good for sketching (The closer to CAD the better)
3. Can be rendered to image in C# for free (we would like to display this stuff somehow, wont we?)

I would be very interested in what you find

Offline Alex M.  
#71 Posted : 04 February 2016 22:14:22(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: Davide Carpi Go to Quoted Post


Originally Posted by: Alex.M Go to Quoted Post
Also no go on DXF - no engine that can render that in .NET; a pity

netDxf (the one embedded in the modeller region) doesn't works? (not tested, but seems it is possible)



After some digging around
"The library only has read and write functionality. If you want to display the dxf geometry on a canvas, you will have to code it yourself using your preferred graphics engine. "

So no render function unfortunately
Offline Jean Giraud  
#72 Posted : 05 February 2016 10:01:58(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Alex.M Go to Quoted Post
Suggest "real" file format that:
1. does not require paid editing software
2. Is good for sketching (The closer to CAD the better)
3. Can be rendered to image in C# for free (we would like to display this stuff somehow, wont we?)

I would be very interested in what you find

__________________________

I understand $ 0,00 but like they say "There is no free lunch".
There is no way the small Inkscape team can compete with well
established Autodesk, Adobe ... Can you give an example of what you
want to do: Mechanical Drawing, Industrial Process, College level
Geometry, Advanced Maths [Astronomy ...]

As it looks: save your Inkscape creation *.png => read in Smath.
If Smath does not read, Inkscape *.png => problem is with Inkscape,
no need to alter Smath. Alternately to this case: capture your
Inkscape creation, transit and save to be readable by Smath.
Print Screen => Paint => IrfanView keeps 24 bpp required by Smath "READ".
On large images, I prefer transiting via WinGrab.

Jean

Offline Jean Giraud  
#73 Posted : 06 February 2016 07:47:14(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
... In my own discipline I need graphic in Smath work sheet.
Easy to figure, done in Paint. Even LabView specialised in
Modeling in my discipline won't do, Why ? Because like any
graphic package, it is limited to the graphic competence, in
otherwords: depends upon the mental capability of putting
the mind into graphic package.
Paint has no competence but reads my mind.

The *.BMP is 780 KB Disk size in my PC
The *.gif is 32 KB Disk size in my PC.

For my own curiosity, I attach these two to check the
load in the Forum attachment. The *.gif is 4 BPP,
Smath imports from my file folder plots as nice as
the *.BMP 24 BPP. The gain in size is immense, by
wisely graphing and wisely saving, job done ...
No need for Inksacpe, CorelDraw, ... else invention.

Jean

RegulGIF.gif
RegulBMP.bmp (678kb) downloaded 36 time(s).
Offline Jean Giraud  
#74 Posted : 06 February 2016 07:57:26(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
... more than interesting: can download the *.BMP or
copy from forum, paste in Smath work sheet.
*.BMP [678 KB] ... during the transit *.GIF [~ 7 KB]

Thanks to: Microsoft, IrfanView, Smath & Smath Forum.

Jean
Offline Alex M.  
#75 Posted : 08 February 2016 04:23:19(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Hi all,

Work on image region is complete, as far as I am concerned.

All reported bugs were fixed. File types supported: png, svg, psd, pdf, dxf (partial), dwg (partial).

Known issues:

- it is not possible to set .psd file size. In the code, the blank file types psd, dxf and dwg are inserted as a static base64 string, that is written to a file.
- Pdf support requires large ghostscript .dll files (read further)

Known features:

- Dwg and Dxf support features a clever workaround. Since there is no open source library that will render dwg / dxf, in order to display the CAD drawing you have to export/print it to pdf or png with same filename as original dxf / dwg file. Prints must be placed to either parent folder of .sm workbook, or temporary folder that contains dxf / dwg files "AppData\Roaming\SMath\extensions\plugins\63ddaef8-9a56-4ff6-938e-d590b638bf99" which is default folder when you export from DraftSight.


Lets hunt some bugs before I publish the plugin to extension manager.

On that note, the plugin published to extension manager will feature only .png, .svg, and .psd file types, since .pdf support requires large ghost script library, and dwg/dxf support is marginal and potentially unstable. I will, however, create a new thread which will serve as a repository for complete release of image region plugin.

On a side note, Martin, when you get to release new portable version of SMath plus Maxima, please include full ImageRegion plugin (5 file types) and my excel_io plugin (many thanks).

Note the large archive size due to PDF rendering support.
ImageRegion008.zip.001 (3,072kb) downloaded 42 time(s).
ImageRegion008.zip.002 (3,072kb) downloaded 35 time(s).
ImageRegion008.zip.003 (3,072kb) downloaded 35 time(s).
ImageRegion008.zip.004 (3,072kb) downloaded 37 time(s).
ImageRegion008.zip.005 (3,072kb) downloaded 36 time(s).
ImageRegion008.zip.006 (1,301kb) downloaded 34 time(s).

Also download updated ImageRegion.dll ver. 008.5; 008 version contains a bug. (You will still need all other .dll files, except imageregion.dll, from 008 archives above)

ImageRegion.008.5.zip (76kb) downloaded 37 time(s).

Edited by user 08 February 2016 17:58:35(UTC)  | Reason: Not specified

Offline Alex M.  
#76 Posted : 08 February 2016 04:36:43(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Davide, could you help me out with a piece of code?

I am trying to place a checkmark in from of a context menu item for the region. This code does not work:

Code:

MenuButton FileType = new MenuButton("File Type");

            int chckd = 0;
            string[] extension = new string[] { "*.png", "*.svg", "*.psd", "*.pdf", "*.dxf", "*.dwg" };

                FileType.AppendChild(extension[0], delegate(MenuButtonArgs args)
                {
                    ((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext = extension[0];
                    chckd = 0;
                });
                FileType.AppendChild(extension[1], delegate(MenuButtonArgs args)
                {
                    ((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext = extension[1];
                    chckd = 1;
                });
                FileType.AppendChild(extension[2], delegate(MenuButtonArgs args)
                {
                    ((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext = extension[2];
                    chckd = 2;
                });
                FileType.AppendChild(extension[3], delegate(MenuButtonArgs args)
                {
                    ((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext = extension[3];
                    chckd = 3;
                });
                FileType.AppendChild(extension[4], delegate(MenuButtonArgs args)
                {
                    ((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext = extension[4];
                     chckd = 4;
                });
                FileType.AppendChild(extension[5], delegate(MenuButtonArgs args)
                {
                    ((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext = extension[5];
                     chckd = 5;
                });

                FileType.Children[chckd].Checked = true; 
  

Edited by user 08 February 2016 10:25:58(UTC)  | Reason: Not specified

Offline Davide Carpi  
#77 Posted : 08 February 2016 19:12:03(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
Hello Alex! What's the purpose of those buttons?

Edited by user 08 February 2016 19:15:05(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Alex M.  
#78 Posted : 08 February 2016 19:24:43(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: Davide Carpi Go to Quoted Post
Hello Alex! What's the purpose of those buttons?


Davide, the purpose is to set variable "select_ext" to one of the five values in the string [] "extension". Depending on the current value of "select_ext", a check mark should be displayed next to a button.

I tried to follow your code in writer region but failed.
Offline Davide Carpi  
#79 Posted : 08 February 2016 19:33:13(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: Alex.M Go to Quoted Post
Davide, the purpose is to set variable "select_ext" to one of the five values in the string [] "extension". Depending on the current value of "select_ext", a check mark should be displayed next to a button.


lol, I imagined that Good

I mean from user side... If I have a dxf and I click on png what should happens?


BTW, I found this that may be interesting: "open with" file dialog


EDIT not tested, but should works:
Code:
           MenuButton FileType = new MenuButton("File Type");

           string[] extension = new string[] { "*.png", "*.svg", "*.psd", "*.pdf", "*.dxf", "*.dwg" };

           for (int i = 0; i < extension.Length; i++)
           {
               FileType.AppendChild(extension[0], delegate(MenuButtonArgs args)
                                    {
                                        ((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext = extension[i];
                                    });

               if (((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext == extension[i])
                   FileType.Children[i].Checked = true;
           }

Edited by user 08 February 2016 20:38:50(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Alex M.  
#80 Posted : 09 February 2016 03:41:09(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: Davide Carpi Go to Quoted Post
Originally Posted by: Alex.M Go to Quoted Post
Davide, the purpose is to set variable "select_ext" to one of the five values in the string [] "extension". Depending on the current value of "select_ext", a check mark should be displayed next to a button.


lol, I imagined that Good

I mean from user side... If I have a dxf and I click on png what should happens?


BTW, I found this that may be interesting: "open with" file dialog


EDIT not tested, but should works:
Code:
           MenuButton FileType = new MenuButton("File Type");

           string[] extension = new string[] { "*.png", "*.svg", "*.psd", "*.pdf", "*.dxf", "*.dwg" };

           for (int i = 0; i < extension.Length; i++)
           {
               FileType.AppendChild(extension[0], delegate(MenuButtonArgs args)
                                    {
                                        ((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext = extension[i];
                                    });

               if (((ImageEdit.ImageRegion)args.CurrentRegion).GetCanvas().select_ext == extension[i])
                   FileType.Children[i].Checked = true;
           }

Hi, Davide, sorry for not replying – I was at work. The workflow for image type selection is:

1. Select the extension (.png is preselected)
2. Double click empty region
3. Blank file will be created on the fly (if no file exists already)

It might make more sense to rename the button to Blank File Type.

Also do you think that "open with" on double click is better than open? Sounds like extra step..

Edited by user 09 February 2016 04:06:19(UTC)  | Reason: Not specified

Users browsing this topic
Guest
Similar Topics
Editable Image Region - Plugin Update (Extensions)
by Alex M. 14/02/2016 09:46:23(UTC)
6 Pages«<23456>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.