Layout Editor Edit->SelectAll

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

User avatar
tgraupmann
Quite a regular
Quite a regular
Posts: 78
Joined: Thu Aug 18, 2005 00:47
Contact:

Layout Editor Edit->SelectAll

Postby tgraupmann » Sat Apr 28, 2007 00:11

Feature Request:

The layout editor needs a feature to "Select All" windows in the layout.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Sat Apr 28, 2007 09:52


User avatar
tgraupmann
Quite a regular
Quite a regular
Posts: 78
Joined: Thu Aug 18, 2005 00:47
Contact:

Postby tgraupmann » Sat Apr 28, 2007 23:00

For the impatient.

First Step.

Edit EditorFrame.cpp and add:

Code: Select all

   // Select all items
   mEditMenu->AppendSeparator();
   mEditMenu->Append(wxID_SELECTALL, wxT("Select &All \tCtrl+A"), wxT("Select all windows in the layout."));

User avatar
tgraupmann
Quite a regular
Quite a regular
Posts: 78
Joined: Thu Aug 18, 2005 00:47
Contact:

Postby tgraupmann » Sun Apr 29, 2007 00:52

Ok this works.

EditorFrame.h

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//  For project details and authors, refer to "CELayoutEditor.cpp".
//
//  This file is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This file is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
//  To view the licence online, go to: http://www.gnu.org/copyleft/gpl.html
////////////////////////////////////////////////////////////////////////////////

#ifndef _EDITOR_FRAME_H_
#define _EDITOR_FRAME_H_

// Forwarding
class EditorDocument;
class EditorCanvas;
class DialogMain;
class EditorFrame : public wxDocParentFrame
{
   DECLARE_CLASS(EditorFrame)
public:
   /** Constructor. Attaches an OpenGL compatible canvas.*/
   EditorFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);

   /** Destructor.*/
   ~EditorFrame();

   /** Seperate method so we can call it after the entire frame has been initialized,
   * because for the canvas it must be visible, which doesn't look that nice when
   * creating the frame.*/
   EditorCanvas *AttachCanvas(wxView *view);

   EditorCanvas* getCanvas()
   {
      return m_renderCanvas;
   }

   /** Receives the document from the attached view for accessing by the menu-events.*/
   void SetDocument(EditorDocument* document);

   /** Overloaded. We manually refresh the canvas when this is requested.*/
   virtual void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);

  /** we can get the DialoMain, becouse we need to get the currently selected window */
  DialogMain *GetDialogMain(){return m_dialogMain;};

private:
   /** Defines the menu items. The doc-view items (open, save, exit) are provided
   * by wxWidgets and therefore not found here.*/
   enum {
      ID_EDIT_UNDO=1,
      ID_EDIT_CUT,
      ID_EDIT_COPY,
      ID_EDIT_PASTE,
      ID_EDIT_CLEAR,
      ID_ALIGN,        // Sub-menu ID does nothing itself.
      ID_ALIGN_LEFT,
      ID_ALIGN_RIGHT,
      ID_ALIGN_TOP,
      ID_ALIGN_BOTTOM,
      ID_ALIGN_WIDTH,
      ID_ALIGN_HEIGHT,
      // View stuff
      ID_VIEW_640x480,
      ID_VIEW_800x600,
      ID_VIEW_1024x786,
      ID_VIEW_FULLSCREEN,   // This setting is not saved to INI since it's mostly used temporarily
      ID_VIEW_SET_BACKGROUND,
      ID_VIEW_SHOW_BACKGROUND,
      ID_VIEW_SET_GRID,
      ID_VIEW_SET_FONT,
      ID_SELECT_ALL
   };

   /** Pointer to cegui singleton.*/
   CEGUI::System*         m_GUISystem;

   /** Pointer to cegui renderer.*/
   CEGUI::OpenGLRenderer*   m_GUIRenderer;

   /** The dialog which provides access to all properties of a current selection
   * in the document. It is created once, and reset when a new document is opened.
   */
   DialogMain*            m_dialogMain;

   /** OpenGL rendering canvas.*/
   EditorCanvas*         m_renderCanvas;
   EditorDocument*         m_document;

   /** We store the edit menu, to pass to the CommandProcessor.*/
   wxMenu*               mEditMenu;

    /** Stores whether our

   /** Attaches a menubar to the frame.*/
   void AttachMenubar();

   /** Attaches a toolbar to the frame.*/
   void AttachToolbar();

   /** Applies size from ini file.*/
   void RestoreIniSize();

   /** Handled wxSizeEvent. Propagate the new resolution to the gui renderer.
   */
   void OnResize(wxSizeEvent& event);

   /** Initializes the CEGUI core + renderer, loads available "looks" and
   * sets a default font to use. We don't cleanup the frame when new view is spawned,
   * so this is a good place to put the CEGUI functionality.*/
   void InitializeCEGUI();

   /** Loads available .scheme and .font files from cegui's datafiles directory.
   */
   void LoadData();

   /** We listen to the Edit events (including the Align part) of the menubar.*/
   DECLARE_EVENT_TABLE();

   void OnUpdate640x480(wxUpdateUIEvent& event);
   void On640x480(wxCommandEvent& event);
   //
   void OnUpdate800x600(wxUpdateUIEvent& event);
   void On800x600(wxCommandEvent& event);
   //
   void OnUpdate1024x768(wxUpdateUIEvent& event);
   void On1024x768(wxCommandEvent& event);
   void OnFullScreen(wxCommandEvent& event);
   //
   void OnUpdateEditClear(wxUpdateUIEvent& event);
   void OnEditClear(wxCommandEvent& event);
   //
   void OnUpdateEditCopy(wxUpdateUIEvent& event);
   void OnEditCopy(wxCommandEvent& event);
   //
   void OnUpdateEditCut(wxUpdateUIEvent& event);
   void OnEditCut(wxCommandEvent& event);
   //
   void OnUpdateEditPaste(wxUpdateUIEvent& event);
   void OnEditPaste(wxCommandEvent& event);
   //
   void OnUpdateSetBackground(wxUpdateUIEvent& event);
   void OnSetBackground(wxCommandEvent& event);

   void OnUpdateShowBackground(wxUpdateUIEvent& event);
   void OnShowBackground(wxCommandEvent& event);
   void OnSetGrid(wxCommandEvent& event);
   void OnSetFont(wxCommandEvent& event);

   // The Align item is a "root". So we don't need seperate enable/disables per sub-item
   void OnUpdateAlign(wxUpdateUIEvent& event);
   void OnAlignLeft(wxCommandEvent& event);
   void OnAlignRight(wxCommandEvent& event);
   void OnAlignTop(wxCommandEvent& event);
   void OnAlignBottom(wxCommandEvent& event);
   void OnAlignWidth(wxCommandEvent& event);
   void OnAlignHeight(wxCommandEvent& event);

   void OnSelectAll(wxCommandEvent& event);
};

#endif // _EDITOR_FRAME_H_


EditorDocument.h

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//  For project details and authors, refer to "CELayoutEditor.cpp".
//
//  This file is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This file is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
//  To view the licence online, go to: http://www.gnu.org/copyleft/gpl.html
////////////////////////////////////////////////////////////////////////////////

#ifndef _EDITOR_DOCUMENT_H_
#define _EDITOR_DOCUMENT_H_

// Maybe someday replace by wxWidgets containers(?)
#include <map>
#include <vector>
#include <set>
#include "IDocumentObserver.h"
#include "Selection.h"
#include "CopiedSelection.h"

/** The application's Document implementation.
 *
 * This class is used as interface between the application and the CEGUI system. It is important to know that this
 * class is like a "thin client". It does not cach anything (except for a few pointers). Each call is made directly
 * on CEGUI, so no seperate administrations have to be maintained, which makes this class remarkeable easy to understand
 * I think.
 *
 */

class EditorDocument : public wxDocument
{
  DECLARE_DYNAMIC_CLASS(EditorDocument)

// Attributes
public:
  /** Constructor.
  */
   EditorDocument();
 
  /** Opens the given layout file as editable.
    */
  bool OnOpenDocument(const wxString& filename);

  /** Starts a new layout.
    */
  bool OnNewDocument() ;

  /** Saves the current layout to its filepath.
    */
  bool OnSaveDocument(const wxString& filename);

  /** The current layout has been closed. The system has prompted the user to save changes, if any.
    */
  bool OnCloseDocument();

  /** Sets the document to being 'dirty' and updates the attached views.
    */
  void Modify (bool modify);

  /** Sets the dimensions of the current view settings. This depends on the resolution. This values
  * are used to normalize the X and Y coordinates.
  * @param iWidth the width of the render window
  * @param iHeight the height of the render window*/
  void SetDimensions (int aWidth, int aHeight)
   {
    m_width = aWidth;
    m_height = aHeight ;
  }

  /** Returns the current width of the render window.*/
  int GetWidth()
   {
    return m_width ;
  }

  /** Returns the current height of the render window.*/
  int GetHeight()
   {
    return m_height ;
  }

  /** Resets the document for editing eg. after a resolution-change which re-starts Ogre.*/
  void Reset();

  /** Adds the given observer.
    * @param observer.*/
  void AddObserver (IDocumentObserver* pObserver) ;

  /** Adds a window of the given type, with the given name, to the given parent.
    *
    * @param pParentWindow the parent of the new window.
    * @param strType the window type e.g. "Checkbox"
    * @param strName the window name e.g. "Female".
   * @return the newly created window, or NULL if failed.
    */
  CEGUI::Window* AddWindow (CEGUI::Window* pParentWindow, CEGUI::String strType, CEGUI::String strName);

  /** Removes the given window from the document.
    *
      * @param aWindow the window to remove.
    * @param notifyListeners can be used as a performance gain to only notify on the last in a loop.
      * @return whether the window could be removed. For example the 'root' cannot be removed.
    */
  bool RemoveWindow (CEGUI::Window* aWindow, bool notifyListeners = true) ;

   /** Sets the given 'root' as the active layout.
    *
    * @param  pRoot
    */
  void SetActiveLayout (CEGUI::Window* aRoot) ;

  /** Delegate for mouse-moving events.
   * @param mouseX current mouse position.
   * @param mouseY current mouse position.*/
  void HandleMouseMoved (int aMouseX, int aMouseY) ;

  /** Delegate for mouse-pressing events. Returns wheter changes have been made.
   * @param mouseX current mouse position.
   * @param mouseY current mouse position.
   * @param whether shift is pressed.*/
  void HandleMousePressed (int aMouseX, int aMouseY, bool shiftPressed) ;

  /** Invoked when the mouse has been released.*/
  void HandleMouseReleased () ;

  /** Selects the given window, and optionally resets the current selection first.
  * @todo needs to be moved to the VIEW*/
  void SelectWindow (CEGUI::Window* aWindow, bool resetSelection = true) ;

  // Relevant Parameters
  typedef std::set<CEGUI::String>           RelevantProperties;
  typedef std::set<CEGUI::String>::iterator RelevantPropertiesIterator;

  /** Fills a list with a collection (in the formal sence of the meaning) of relevant parameters.
    * @param pParams the administration to append to.*/
  void GetRelevantProperties(RelevantProperties* properties) ;

  /** Sets the given property to the given value.
    * @param aName, eg. \"Alpha\".
    * @param newValue, eg. \"0.5\".*/
  bool SetProperty (const CEGUI::String& aName, const CEGUI::String& newValue) ;

  /** Return the value of the given parameter.
    * @param strParamName eg. \"caption\".*/
  CEGUI::String GetProperty (CEGUI::String aName) ;

  /** @Returns container with selected GUI windows.*/
  Selection* GetSelection()
   {
    return &m_selection;
  }

  /** @Returns container with deep copied GUI windows.*/
  CopiedSelection* GetCopiedSelection()
   {
    return &m_copiedSelection;
  }

  /** @Returns the currently active (loaded) layout.*/
  CEGUI::Window* GetActiveLayout()
   {
    return m_activeLayout;
  }

  /** Cuts the currently selected windows from the GUI system.*/
  void CutSelection();

  /** Copies the currently selected windows from the GUI system.*/
  void CopySelection();

  /** Pastes the currently selected windows from the GUI system onto
    * the first window of the current selection. TODO: After that, the pasted
    * elements become the new selection. (Powerpoint style).
    */
  void PasteCopiedSelection();

  /** Deletes the currently selected windows from the GUI system.*/
  void DeleteSelection();

    /** Returns whether we have a valid background widget loaded.*/
    bool IsBackgroundAvailable();

    /** Applies the given filename as a background image.
   * @todo needs to be moved to the VIEW*/
    void SetBackgroundImage(const wxString& filepath);

    /** Toggles background visibility.
   * @todo needs to be moved to the VIEW*/
    void SetBackgroundVisibility(bool visible);

    /** Saves the window tree, starting at "aWindow" to the given file.*/
    void saveFromWindow(CEGUI::Window* aWindow, const wxString& fileName );

   /* Selects all windows in the layout */
   void SelectAll();

private:
    /** Delegate the creation and adding of windows to this method, so we can do some initialization
     * based on the type. For example a Menubar root item required a Popupmenu immediately.*/
    CEGUI::Window* AddNewWindow (CEGUI::Window* aParentWindow, CEGUI::String aType, CEGUI::String aName);
   
    /** Convenience method: pre-populated the given tabcontrol.*/
    void InitTabControl (CEGUI::Window* aTabControl);

    /** Convenience method: pre-populated the given menu bar.*/
    void InitMenubar (CEGUI::Window* aMenuBar);

    /** Very minimal locking behaviour; when the user selects a window, we check whether it may be resized.
    * We use it to block resizing of auto-calculated children, such as menu items and tab buttons.*/
    bool RequiresLock (CEGUI::Window* aWindow);

    /** Finds the first occurence within any scheme for the given widget type. This avoids dependencies
     * on certain schemes.
     * @returns the full type including scheme name.*/
    CEGUI::String FindFirstMapping(const CEGUI::String& aType);

    /** Creates a background (StaticImage) as the root of our upcoming layouts. If not possible,
    * it warns the user and creates a DefaultWindow as a stub.
    * @returns whether it succeeded with a real StaticImage.
   * @todo needs to be moved to the VIEW*/
    bool InitBackground();

    /** Unactivates the current layout. Undoes selection and such.*/
    void DeactivateCurrentLayout();

    /** Updates the status bar.
   * @todo needs to be moved to the VIEW*/
    void UpdateStatusBar(wxChar *format, ...);

    /** Sets the cursor according to the hovered resize point.
   * @todo needs to be moved to the VIEW*/
    void UpdateCursor();

    /** Checks if m_hoveredWindow is a TabButton, which is a special case. If so, the m_hoveredWindow,
    * will be updated to point to the actual ContentPane. */
    bool PressedTabButton();

    /** Checks if m_hoveredWindow is a MenuItem, which is a special case. If so, the menu item's
    * PopupMenu will get toggled. */
    bool PressedMenuItem();

   /** Checks if the user want to change the colours of selected widget.
   * @todo testing!!*/
   void HandleColoursUpdate(bool shiftPressed);

    /** Called before saving, so we can make some just-in-time modifications if we want.
    */
    void OnPreSave();

    /** Currently active layout.*/
    CEGUI::Window*  m_activeLayout;

    /** Background, if set.*/
    CEGUI::Window*  m_background;

    /** Stores observers.*/
    std::vector<IDocumentObserver*>   observers;

    /** Resize point above which the mouse cursor is. */
    int m_hoveredResizePoint;
    int m_previousHoveredResizePoint;

    /** Is the mouse currently pressed? */
    bool  m_mousePressed ;

    /** Current render window width.*/
    int   m_width ;

    /** Current render window height.*/
    int   m_height ;

    /** Current mouseX position. Integer because it's as accurate as it gets.*/
    int   m_mouseX ;

    /** Current mouseX position. Integer because it's as accurate as it gets.*/
    int   m_mouseY ;

    /** Previous mouseX position, to see differences. Integer because it's as accurate as it gets.*/
    int   m_previousMouseX ;

    /** Previous mouseY position, to see differences. Integer because it's as accurate as it gets.*/
    int   m_previousMouseY ;

    /** Window above which the mouse cursor is. */
    CEGUI::Window* m_hoveredWindow;

    /** This object manages the selections. Selects elements and also allows copy / paste / delete operations.
    * It is public to avoid forwarding of its methods.*/
    Selection m_selection ;

    /** This object contains the result of a copy or cut.*/
    CopiedSelection m_copiedSelection ;
};

#endif // _EDITOR_DOCUMENT_H_
Last edited by tgraupmann on Sun Apr 29, 2007 00:56, edited 1 time in total.

User avatar
tgraupmann
Quite a regular
Quite a regular
Posts: 78
Joined: Thu Aug 18, 2005 00:47
Contact:

Postby tgraupmann » Sun Apr 29, 2007 00:54

And the implementation:

EditorFrame.cpp

Code: Select all

...
//-----------------------------------------------------------------------
BEGIN_EVENT_TABLE(EditorFrame, wxDocParentFrame)

   EVT_SIZE(EditorFrame::OnResize)

   EVT_UPDATE_UI(ID_VIEW_640x480, EditorFrame::OnUpdate640x480)
   EVT_MENU(ID_VIEW_640x480, EditorFrame::On640x480)
   //
   EVT_UPDATE_UI(ID_VIEW_800x600, EditorFrame::OnUpdate800x600)
   EVT_MENU(ID_VIEW_800x600, EditorFrame::On800x600)
   //
   EVT_UPDATE_UI(ID_VIEW_1024x786, EditorFrame::OnUpdate1024x768)
   EVT_MENU(ID_VIEW_1024x786, EditorFrame::On1024x768)
   EVT_MENU(ID_VIEW_FULLSCREEN, EditorFrame::OnFullScreen)
   //
   EVT_UPDATE_UI(ID_EDIT_CLEAR, EditorFrame::OnUpdateEditClear)
   EVT_MENU(ID_EDIT_CLEAR, EditorFrame::OnEditClear)
   //
   EVT_UPDATE_UI(ID_EDIT_COPY, EditorFrame::OnUpdateEditCopy)
   EVT_MENU(ID_EDIT_COPY, EditorFrame::OnEditCopy)
   //
   EVT_UPDATE_UI(ID_EDIT_CUT, EditorFrame::OnUpdateEditCut)
   EVT_MENU(ID_EDIT_CUT, EditorFrame::OnEditCut)
   //
   EVT_UPDATE_UI(ID_EDIT_PASTE, EditorFrame::OnUpdateEditPaste)
   EVT_MENU(ID_EDIT_PASTE, EditorFrame::OnEditPaste)
   //
    EVT_UPDATE_UI(ID_VIEW_SET_BACKGROUND, EditorFrame::OnUpdateSetBackground)
   EVT_MENU(ID_VIEW_SET_BACKGROUND, EditorFrame::OnSetBackground)
   //
   EVT_UPDATE_UI(ID_VIEW_SHOW_BACKGROUND, EditorFrame::OnUpdateShowBackground)
   EVT_MENU(ID_VIEW_SHOW_BACKGROUND, EditorFrame::OnShowBackground)
   EVT_MENU(ID_VIEW_SET_GRID, EditorFrame::OnSetGrid)
   EVT_MENU(ID_VIEW_SET_FONT, EditorFrame::OnSetFont)
   //
   EVT_UPDATE_UI(ID_ALIGN, EditorFrame::OnUpdateAlign)
   EVT_MENU(ID_ALIGN_LEFT, EditorFrame::OnAlignLeft)
   EVT_MENU(ID_ALIGN_RIGHT, EditorFrame::OnAlignRight)
   EVT_MENU(ID_ALIGN_TOP, EditorFrame::OnAlignTop)
   EVT_MENU(ID_ALIGN_BOTTOM, EditorFrame::OnAlignBottom)
   EVT_MENU(ID_ALIGN_WIDTH, EditorFrame::OnAlignWidth)
   EVT_MENU(ID_ALIGN_HEIGHT, EditorFrame::OnAlignHeight)

   EVT_MENU(ID_SELECT_ALL, EditorFrame::OnSelectAll)

END_EVENT_TABLE()

//-----------------------------------------------------------------------
...
//-----------------------------------------------------------------------
void EditorFrame::AttachMenubar()
{
   // Make a menubar (note that the Edit menu is a member!)
   wxMenu *fileMenu = new wxMenu;
   mEditMenu = new wxMenu;
   wxMenu *alignSubmenu = new wxMenu;
   wxMenu *viewMenu = new wxMenu;
   wxMenu *helpMenu = new wxMenu;
   wxMenuBar *menubar = new wxMenuBar;

   // File items

   // Many of these ID's (the ones which start with "wxID") are already mapped
   // internally, so you won't see them in the EVENT_TABLE.
   fileMenu->Append(wxID_NEW, wxT("&New...\tCtrl+N"), wxT("Create a new document."));
   fileMenu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O"), wxT("Open an existing document."));
   fileMenu->Append(wxID_CLOSE, wxT("&Close"), wxT("Close the active document."));
   fileMenu->Append(wxID_SAVE, wxT("&Save\tCtrl+S"), wxT("Save the active document."));
   fileMenu->Append(wxID_SAVEAS, wxT("Save &As..."), wxT("Save the active document with a new name."));
   fileMenu->AppendSeparator();
   fileMenu->Append(wxID_EXIT, wxT("E&xit\tCtrl+Q"), wxT("Quit the application; prompts to save document."));

   // Edit items
   mEditMenu->Append(wxID_UNDO, wxT("&Undo\tCtrl+Z"), wxT("Undo the last action."));
   mEditMenu->Append(wxID_REDO, wxT("&Redo\tCtrl+Y"), wxT("Redo the previously undone action."));
   mEditMenu->AppendSeparator();
   mEditMenu->Append(ID_EDIT_CUT, wxT("&Cut\tCtrl+X"), wxT("Cut the current selection."));
   mEditMenu->Append(ID_EDIT_COPY, wxT("&Copy\tCtrl+C"), wxT("Copy the current selection."));
   mEditMenu->Append(ID_EDIT_PASTE, wxT("&Paste\tCtrl+V"), wxT("Paste the latest cut or copied selection."));
   mEditMenu->Append(ID_EDIT_CLEAR, wxT("&Delete\tDel"), wxT("Delete the current selection."));

   // Align items
   alignSubmenu->Append(ID_ALIGN_LEFT, wxT("&Left"), wxT("Give entire selection the same X1 value."));
   alignSubmenu->Append(ID_ALIGN_RIGHT, wxT("&Right"), wxT("Give entire selection the same X2 value."));
   alignSubmenu->Append(ID_ALIGN_TOP, wxT("&Top"), wxT("Give entire selection the same Y1 value."));
   alignSubmenu->Append(ID_ALIGN_BOTTOM, wxT("&Bottom"), wxT("Give entire selection the same Y2 value."));
   alignSubmenu->AppendSeparator();
   alignSubmenu->Append(ID_ALIGN_WIDTH, wxT("&Width"), wxT("Give entire selection the same width."));
   alignSubmenu->Append(ID_ALIGN_HEIGHT, wxT("&Height"), wxT("Give entire selection the same height."));
   mEditMenu->Append(ID_ALIGN, wxT("Align"), alignSubmenu);

   // Select all items
   mEditMenu->AppendSeparator();
   mEditMenu->Append(ID_SELECT_ALL, wxT("Select &All \tCtrl+A"), wxT("Select all windows in the layout."));

   // View items
   viewMenu->Append(ID_VIEW_640x480, wxT("Make exactly 640 x 480"), wxT("Convenience resizer for 640 x 480."));
   viewMenu->Append(ID_VIEW_800x600, wxT("Make exactly 800 x 600"), wxT("Convenience resizer for 800 x 600."));
   viewMenu->Append(ID_VIEW_1024x786, wxT("Make exactly 1024 x 768"), wxT("Convenience resizer for 1024 x 768."));
   viewMenu->Append(ID_VIEW_FULLSCREEN, wxT("Make fullscreen"), wxT("Convenience resizer to fullscreen."));
   viewMenu->AppendSeparator();
   viewMenu->Append(ID_VIEW_SET_BACKGROUND, wxT("Set background..."));
   viewMenu->AppendCheckItem(ID_VIEW_SHOW_BACKGROUND, wxT("Show background..."));
   viewMenu->AppendSeparator();
   viewMenu->Append(ID_VIEW_SET_GRID, wxT("Set &grid...\tCtrl+G"), wxT("Set grid size and visibility."));
   viewMenu->Append(ID_VIEW_SET_FONT, wxT("Set default &font...\tCtrl+F"), wxT("Set default font from now on."));

   // Help items
   helpMenu->Append(wxID_ABOUT, wxT("&About"), wxT("Display program information, version number and copyright."));

   // Fill the menubar*/
   menubar->Append(fileMenu, wxT("&File"));
   menubar->Append(mEditMenu, wxT("&Edit"));
   menubar->Append(viewMenu, wxT("&View"));
   menubar->Append(helpMenu, wxT("&Help"));

   // Associate the menu bar with the frame
   SetMenuBar(menubar);
}

//-----------------------------------------------------------------------
...
//-----------------------------------------------------------------------
void EditorFrame::OnSelectAll(wxCommandEvent& event)
{
   wxASSERT_MSG(m_document != NULL, ASSERT_DOCUMENT_MSG);
   m_document->SelectAll();
}



EditorDocument.cpp

Code: Select all

...
//-----------------------------------------------------------------------
void EditorDocument::SelectAll()
{
    CEGUI::WindowManager::WindowIterator windowIt = WindowManager::getSingleton().getIterator();
   while (!windowIt.isAtEnd())
   {
      try
      {
         CEGUI::Window* window = windowIt.getCurrentValue();
         SelectWindow(window, false);
         ++windowIt;
      }
      catch (...)
      {
      }
   }
   Modify(true);
}

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Sat Jun 23, 2007 11:42

Hi,

i have applied this patch a little while ago, but noticed that it doesn't work on my end. The 'OnSelectAll' event does not get hit and nothing happens. Odd because it just looks like any other event. I'm sure it works on your site, right?

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: Layout Editor Edit->SelectAll

Postby scriptkid » Tue Jun 09, 2009 19:44

Check out my released snake game using Cegui!


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 11 guests