wex  v20.04.0
Public Member Functions | Protected Member Functions | List of all members
wex::report::frame Class Reference

Adds file and project history support to managed_frame. More...

#include <wex/report/frame.h>

Inheritance diagram for wex::report::frame:
Inheritance graph
[legend]

Public Member Functions

 frame (size_t maxFiles=9, size_t maxProjects=0, const window_data &data=window_data().style(wxDEFAULT_FRAME_STYLE))
 Default constructor. More...
 
virtual listviewactivate (wex::listview_data::type_t, const lexer *lexer=nullptr)
 Virtual interface. More...
 
virtual fileget_project ()
 If there is a project somewhere, your implementation should return that one. More...
 
void on_command_item_dialog (wxWindowID dialogid, const wxCommandEvent &event) override
 Overriden methods.
 
void set_recent_file (const path &path) override
 Allows derived class to update file history.
 
std::list< std::string > default_extensions () const
 Other methods. More...
 
bool find_in_files (const std::vector< path > &files, int id, bool show_dialog=true, wex::listview *report=nullptr)
 Finds (or replaces) in specified files. More...
 
int find_in_files_dialog (int id, bool add_in_files=false)
 Shows a modal find (or replace) in files dialog. More...
 
const std::string find_in_files_title (int id) const
 Returns caption for find_in_files_dialog.
 
auto & get_project_history ()
 Returns project history.
 
bool grep (const std::string &line, bool sed=false)
 greps for text. More...
 
bool sed (const std::string &line)
 Sed (replace in files). More...
 
void set_recent_project (const path &path)
 Updates project history.
 
void use_file_history_list (wex::listview *list)
 Uses specified history list, and adds all elements from file history to the list.
 
- Public Member Functions inherited from wex::managed_frame
 managed_frame (size_t maxFiles=9, const window_data &data=window_data().style(wxDEFAULT_FRAME_STYLE))
 Default constructor, registers the aui manager, and creates the bars.
 
virtual ~managed_frame ()
 Destructor, uninits the aui manager.
 
virtual bool allow_close (wxWindowID id, wxWindow *page)
 Virtual interface. More...
 
virtual bool exec_ex_command (ex_command &command)
 Executes a ex command. More...
 
virtual void on_notebook (wxWindowID id, wxWindow *page)
 Called if the notebook changed page. More...
 
virtual void print_ex (ex *ex, const std::string &text)
 Prints text in ex dialog. More...
 
virtual void record (const std::string &command)
 Allows you to perform action for a (vi) command. More...
 
virtual stcrestore_page (const std::string &key)
 Restores a previous saved current page. More...
 
virtual bool save_current_page (const std::string &key)
 Saves the current page, to restore later on.
 
virtual void sync_all ()
 Called after you checked the Sync checkbox on the options toolbar. More...
 
virtual void sync_close_all (wxWindowID id)
 Called after all pages from the notebooks are deleted. More...
 
stcopen_file (const path &filename, const stc_data &data=stc_data()) override
 overriden methods
 
void statusbar_clicked (const std::string &) override
 When (left) clicked, uses the get_stc() for some dialogs.
 
void statusbar_clicked_right (const std::string &) override
 Do something when statusbar is (right) clicked.
 
bool add_panes (const panes_t &panes, const std::string &perspective="managed frame")
 Other methods. More...
 
auto & file_history ()
 Returns file history.
 
auto * get_debug ()
 Debugging interface.
 
auto * get_find_toolbar ()
 Returns the find toolbar.
 
auto * get_options_toolbar ()
 Returns the options toolbar.
 
auto * get_toolbar ()
 Returns the toolbar.
 
void hide_ex_bar (int hide=HIDE_BAR_FOCUS_STC)
 Hides the ex bar. More...
 
auto & manager ()
 Returns the manager.
 
bool show_ex_command (ex *ex, const std::string &label)
 Returns a command line ex command. More...
 
void show_ex_message (const std::string &text)
 Shows text in ex bar.
 
bool show_pane (const std::string &pane, bool show=true)
 Shows or hides the managed pane. More...
 
bool toggle_pane (const std::string &pane)
 Toggles the managed pane: if shown hides it, otherwise shows it. More...
 
const auto & toggled_panes () const
 Returns the toggled panes.
 
- Public Member Functions inherited from wex::frame
 frame (const window_data &data=window_data())
 Default constructor,.
 
virtual ~frame ()
 Destructor.
 
void SetMenuBar (wxMenuBar *bar) override
 Override from base class. More...
 
bool Show (bool show=true) override
 Shows or hides window.
 
virtual gridget_grid ()
 Virtual interface. More...
 
virtual listviewget_listview ()
 Returns a listview.
 
virtual processget_process (const std::string &command)
 Allows you to e.g. More...
 
virtual stcget_stc ()
 Returns an stc.
 
virtual bool is_open (const path &filename)
 Returns true if file is opened in a window.
 
virtual stcopen_file (const path &filename, const vcs_entry &vcs, const stc_data &data=stc_data())
 Allows you to open a filename with info from vcs. More...
 
virtual stcopen_file (const path &filename, const std::string &text, const stc_data &data=stc_data())
 Allows you to open a filename with specified contents. More...
 
void set_find_focus (wxWindow *focus)
 Other methods. More...
 
statusbarsetup_statusbar (const std::vector< statusbar_pane > &panes, long style=wxST_SIZEGRIP, const std::string &name="statusBar")
 Sets up the status bar if you want to use statustext.
 

Protected Member Functions

listviewfile_history_list ()
 Access to file history list, if you use this as a page in a notebook, you might want prevent closing it.
 

Additional Inherited Members

- Public Types inherited from wex::managed_frame
enum  { HIDE_BAR, HIDE_BAR_FOCUS_STC, HIDE_BAR_FORCE, HIDE_BAR_FORCE_FOCUS_STC }
 Enums for hide_ex_bar. More...
 
typedef std::vector< std::pair< wxWindow *, wxAuiPaneInfo > > panes_t
 Panes vector with a pair of panes.
 
typedef std::vector< std::pair< std::pair< std::string, std::string >, int > > toggled_panes_t
 Toggled panes type.
 
- Static Public Member Functions inherited from wex::frame
static std::string get_statustext (const std::string &pane)
 Static interface. More...
 
static bool is_closing ()
 Are we closing?
 
static bool statustext (const std::string &text, const std::string &pane)
 Sets text on specified pane. More...
 
static bool update_statusbar (const wxListView *lv)
 Updates statusbar pane items pane with values from specified listview.
 
static bool update_statusbar (stc *stc, const std::string &pane)
 Updates the specified statusbar pane with values from specified stc.
 

Detailed Description

Adds file and project history support to managed_frame.

It also sets a change indicator in the title of the frame if applicable. Finally it adds find in files and selection dialogs.

Constructor & Destructor Documentation

◆ frame()

wex::report::frame::frame ( size_t  maxFiles = 9,
size_t  maxProjects = 0,
const window_data data = window_data().style(wxDEFAULT_FRAME_STYLE) 
)

Default constructor.

Default it gives file history support to be used from the file menu. So you should call use_file_history_list somewhere to set it up. Default it does not use a recent project file.

Member Function Documentation

◆ activate()

virtual listview* wex::report::frame::activate ( wex::listview_data::type_t  ,
const lexer lexer = nullptr 
)
inlinevirtual

Virtual interface.

This method is called to activate a certain listview. Default it returns nullptr.

◆ default_extensions()

std::list<std::string> wex::report::frame::default_extensions ( ) const

Other methods.

Returns a list with default file extensions.

◆ find_in_files()

bool wex::report::frame::find_in_files ( const std::vector< path > &  files,
int  id,
bool  show_dialog = true,
wex::listview report = nullptr 
)

Finds (or replaces) in specified files.

Returns true if process started.

Parameters
filesthe files
idID_TOOL_REPORT_FIND or ID_TOOL_REPLACE
show_dialogDefault shows a dialog.
reportreport for output

◆ find_in_files_dialog()

int wex::report::frame::find_in_files_dialog ( int  id,
bool  add_in_files = false 
)

Shows a modal find (or replace) in files dialog.

Returns result from ShowModal.

Parameters
idID_TOOL_REPORT_FIND or ID_TOOL_REPLACE
add_in_filesadd file types selection as well

◆ get_project()

virtual file* wex::report::frame::get_project ( )
inlinevirtual

If there is a project somewhere, your implementation should return that one.

Default it returns nullptr.

◆ grep()

bool wex::report::frame::grep ( const std::string &  line,
bool  sed = false 
)

greps for text.

The base directory is the directory for the current stc component, if available. Returns true if process started.

Parameters
linetext [extension] [folder]
sednormally grep does not replace, by setting sed, it can

◆ sed()

bool wex::report::frame::sed ( const std::string &  line)
inline

Sed (replace in files).

The base directory is the directory for the current stc component, if available. Returns true if process started.

Parameters
linetext replacement [extension] [folder]