Author Topic: Editorbase revamped! Changes affect RAD plugins.  (Read 9463 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Editorbase revamped! Changes affect RAD plugins.
« on: June 15, 2005, 06:31:15 am »
New methods have been added to the Editorbase class or moved from the cbEditor class:
Code

public:
const wxString& GetFilename(){ return m_Filename; }
/** Sets the editor's filename */
void SetFilename(const wxString& x){ m_Filename = x; }

/** Returns the editor's short name. It is the name displayed on the
 * editor's tab...
 */
const wxString& GetShortName(){ return m_Shortname; }
/** Returns true if editor is modified, false otherwise */
virtual bool GetModified() { return false; }
/** Set the editor's modification state to \c modified. */
virtual void SetModified(bool modified = true) {}

        /** Are there other editors besides this? */
        bool ThereAreOthers();

/** Displays the editor's context menu (usually invoked by the user right-clicking in the editor) */
void DisplayContextMenu(const wxPoint& position,bool noeditor = false);
       
    protected:
        /** Initializes filename data */
        void InitFilename(const wxString& filename);
        /** Creates context submenus. See cbEditor code for details */
        virtual wxMenu* CreateContextSubMenu(int id); // For context menus
       
        /** Creates context menu items, both before and after creating plugins menu items */
        virtual void AddToContextMenu(wxMenu* popup,bool noeditor,bool pluginsdone) {}
        /** Creates unique filename when asking to save the file */
        wxString CreateUniqueFilename();
wxString m_Shortname;

wxString m_Filename;


The new functions CreateContextSubMenu and AddToContextMenu are virtual. These allow your custom class to add items and submenus to the context menu. See cbEditor for some examples.

Additionally, I added the "DLLIMPORT" clause to the Editorbase declaration - i hope this will spare us from some weird crashes when compiling with wxWidgets 2.6...

I haven't worked yet on the Open Files List to include custom editors. But at least this step's done :)