SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

SD2-1173

Last post 10-15-2007 7:40 PM by siegi44. 15 replies.
Page 1 of 2 (16 items) 1 2 Next >
Sort Posts: Previous Next
  • 04-20-2007 6:32 PM

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 184
    • Team Members

    SD2-1173

    Hi

    1 month ago I started development on a hex editor for SD (My parents will sign the JCA in the summerholidays on my birthday (21st july), but only if I pass all exams properly). I would like to present you the first alpha version of it. Many things are not implemented currently, for ex.: selection managment or clipboard handling AND there are MANY MANY bugs too, but I think I'll fix them all ...

    If you like, have a look at the source (sorry only few comments)

    UPDATE: 2007-04-21 bug fixing, display/scrolling improvements ... 

    I've used MeasureStringWidth and GetFontHeight from ICSharpCode.TextEditor.TextView for calculating.

    But can anyone tell me how to make a DisplayBinding-AddIn (like the XML Editor) for SD ... I can't figure out how and there are no tutorials on this topic ...
     

    thanks in advance

    regards

    Siegfried
     

    Siegfried Pammer
  • 04-20-2007 7:47 PM In reply to

    Re: SD2-1173

    I have added a comment to SD2-1173 linking to your post.

    For AddIn writing documentation, see http://wiki.sharpdevelop.net/AddinWritingHelp.ashx

    There's a sample of porting a VS2005 AddIn to SharpDevelop (that has a display binding), and an Image Viewer display binding. The SharpDevelop/samples directory also contains sample display bindings.

    For SharpDevelop 3.0, the interfaces IDisplayBinding and IViewContent changed quite a bit to support multiple views editing the same file, I'll document that later when the 3.0 codebase is more stable.

    Daniel Grunwald
  • 04-20-2007 8:46 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 184
    • Team Members

    Re: SD2-1173

    Hi

    sorry, I didn't read the wiki quite well ... thank you ...

    I will update the source files from time to time ...

    regards

    Siegfried 

    Siegfried Pammer
  • 10-11-2007 8:55 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 184
    • Team Members

    Re: SD2-1173

    Hi there,

    ok until now I could finish the editor and its stable, there are some minor bugs here and there, but you can work with it already ... one feature missing is the ability to save files, which I will implement soon, but now I will start to write the display binding.

    I read through the Line Counter AddIn article, and it is said there, that there are two types of views: primary and secondary ... which type should I use for my Add-In? Which would be the best to fulfill the needs of SD?

    regards

    Siegfried
     

    Siegfried Pammer
  • 10-12-2007 9:23 AM In reply to

    Re: SD2-1173

    A primary display binding.

    If you want to write a view content for SharpDevelop 3.0, you should read "IViewContent refactoring explained"
     

    Daniel Grunwald
  • 10-12-2007 12:19 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 184
    • Team Members

    Re: SD2-1173

    I think I will build the add-in for SD 2.x and then when SD 3.0 is finished I will make a major refactoring of my editor too, because my design is not so good.
    Siegfried Pammer
  • 10-12-2007 2:13 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 184
    • Team Members

    Re: SD2-1173

    Ok, there's a problem with the integration in SD. My Add-In file has this entry:

        <Path name = "/SharpDevelop/Workbench/DisplayBindings">
            <DisplayBinding id = "HexEdit"
                            insertbefore = "Text"
                            supportedformats = "Binaries"
                            class = "HexEdit.HexEditDisplayBinding"/>
        </Path>

    How can I catch only the files that are not handled by other displaybindings?
     

     

    Siegfried Pammer
  • 10-12-2007 3:00 PM In reply to

    Re: SD2-1173

    The display bindings are tried in the order in which they are defined (the order is determined using the "insertbefore" and "insertafter" attributes).

    The problem is that currently the text editor will handle all files (as most unknown file types are text files), so what is really necessary is a heuristic that tries to guess whether the file is a text file, binary file, etc. (this is SD2-1174). This would have to be implemented in SharpDevelop and cannot be done by an AddIn.

    What you can do for now is placing your display binding before "Text" and guess whether the file is binary inside the IDisplayBinding.CanCreateContentForFile method.

    Daniel Grunwald
  • 10-13-2007 5:09 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 184
    • Team Members

    Re: SD2-1173

    thanks Daniel,

    here is my next question: Do I need to implement IClipboardHandler to access the clipboard and undo functions on the workbench? 

    Siegfried Pammer
  • 10-13-2007 7:37 PM In reply to

    Re: SD2-1173

    Yes, the class implementing IViewContent needs to implement IClipboardHandler and IUndoHandler to support copy/paste/undo/redo.

    Daniel Grunwald
  • 10-13-2007 7:43 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 184
    • Team Members

    Re: SD2-1173

    thanks Daniel,

    but just one problem left, how can I support the Save button on the workbench?
     

    Siegfried Pammer
  • 10-13-2007 7:56 PM In reply to

    Re: SD2-1173

    Unless your view content sets its IsViewOnly property to true, the Save button is enabled.

    Just override the Save(string fileName) method to handle both "Save" and "Save As".

    Daniel Grunwald
  • 10-14-2007 5:27 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 184
    • Team Members

    Re: SD2-1173

    I have overridden the Save(string fileName) method, but that didn't change anything ...

    I've also checked that the IsViewOnly property is false.

    Could you help me please? 

    Siegfried Pammer
  • 10-14-2007 5:34 PM In reply to

    Re: SD2-1173

    In SharpDevelop 2.2, the Save command is enabled if ((viewContent.IsUntitled || viewContent.IsDirty) && !viewContent.IsViewOnly); and the Save As command is enabled if (!viewContent.IsViewOnly).

    Whenever something is changed in the hex editor, you must set IsDirty to true to mark the file as changed and allow saving.

    Daniel Grunwald
  • 10-14-2007 5:43 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 184
    • Team Members

    Re: SD2-1173

    yes I know, now I checked with a solution open, it works but with only the single file open the Save buttons are disabled, independent there was a change in the file or not (the ViewContent didn't set the "*" in the title too).

     EDIT: Now everything works, great!!

    Siegfried Pammer
Page 1 of 2 (16 items) 1 2 Next >
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.