Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

BETA - Image Editor plugin

(1/20) > >>

seb_seb0:
Hello guys,

 I have started to program a new Code::Blocks plugin.
 Its purpose: open and edit all images / icons directly inside CodeBlocks. It will simplify the creation / update of all kind of small images (useful for toolbars, for example).
 
  It is of course a SIMPLE editor: nothing fancy, it is more a clone of MS Paint than a clone of Photoshop.
  I have attached the source code (a cbplugin) - the archive also contains a compiled version (windows Vista - Codeblocks SVN 6181
 - MingW TDM 4.4.1)

   The current status is : ALPHA
   What is done:
      - basic editor class for images
      - mime handler done - viewing images works
      - a color picker class is done & tested
      - a wxToggleBitmapButton has been done (not available in wxWidgets 2.8.10. It is a copy of the one from wxWidgets 2.9.0)
      - Undo / Redo mechanism implemented & tested
      - Paste implemented & tested
    
    What remains to be done:
      - Copy & Cut (done, but needs testing...)
      - Save & Save As (done, but needs testing...)
      - implement all the tools (draw line, draw rectangle, ... the bulk of what is remaining)
      - better integration with CodeBlocks (title of the tab in wxAUI does not show a "*" when modified)
      - interface with wxSmith (cryogen made a patch for that : the DialogBox for choosing an image should have a new option. see thread http://forums.codeblocks.org/index.php/topic,372.165.html )
      - testing on Linux

    BUGS :
      - reopening the same bmp makes code::blocks quit without warning

    LIST OF CLASSES:
      xpm_color_picker : a color picker class - display a few different colors. Double-click on 1 color allows complete customization
      xpm_editor : the plugin itself (a MIME plugin)
      xpm_editor_base : the Image Editor. Use internally a xpm_editor_panel, which actually does the bulk of the work
      xpm_editor_panel : the GUI interface for the editor (wxSmith item)
      xpm_undo : a class to manage the UNDO & REDO buffers, and performs the REDO / UNDO action
      xpm_imageeditorarray : to keep track of the opened Image Editors in CodeBlocks. I suspect this class is provoking the BUG
      xpm_toggle_bmp_button : a bitmap toggle button (not available in wxWidgets 2.8.10)

Let me know what you think !

Seb

[attachment deleted by admin]

seb_seb0:
Here is a screenshot



[attachment deleted by admin]

rcoll:
Excellant! I've had this on my TO-DO list for some time, so I am very glad to see this one.  I'll give it a try, and let you know how it works for me.

Ringo

JGM:
whoa this is so cool!  :shock:

danselmi:
Nice work! thank you.

To show the correct title on the tab:
in XpmEditorBase (derived from EditorBase) add a method:

--- Code: ---void XpmEditorBase::UpdateModified()
{
    if ( GetModified() )
        SetTitle( _T("*") + GetShortName() );
    else
        SetTitle( GetShortName() );
}
--- End code ---
and call it whenever the content changed (Do / Undo / Save / SaveAs ...).

Additionally overwrite EditorBases' virtual void SetFilename(const wxString& filename); with the following implementation:

--- Code: ---void XpmEditorBase::SetFilename(const wxString& filename)
{
    m_Filename = filename;
    wxFileName fname;
    fname.Assign(m_Filename);
    m_Shortname = fname.GetFullName();
}
--- End code ---

Take a look at HexEditor or NassiShneidermanPlugin (see my sig) how it's done. But these steps should do.

Navigation

[0] Message Index

[#] Next page

Go to full version