wex v24.04.0
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
wex::del::frame Class Reference

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

#include <wex/del/frame.h>

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

Public Member Functions

 frame (size_t maxFiles=9, size_t maxProjects=0, const data::window &data=data::window().style(wxDEFAULT_FRAME_STYLE))
 Default constructor.
 
virtual listviewactivate (wex::data::listview::type_t, const lexer *lexer=nullptr)
 This method is called to activate a certain listview.
 
virtual fileget_project ()
 If there is a project somewhere, your implementation should return that one.
 
config::strings_t default_extensions () const
 Returns a list with default file extensions.
 
bool find_in_files (const std::vector< path > &files, const tool &tool, bool show_dialog=true, listview *report=nullptr)
 Finds (or replaces) in specified files.
 
int find_in_files_dialog (const tool &tool, bool add_in_files=false)
 Shows a modal find (or replace) in files dialog.
 
const std::string find_in_files_title (wex::window_id id) const
 Returns caption for find_in_files_dialog.
 
auto * get_debug ()
 Debugging interface.
 
auto & get_project_history ()
 Returns project history.
 
bool grep (const std::string &line, bool sed=false)
 greps for text.
 
bool sed (const std::string &line)
 Sed (replace in files).
 
void set_recent_project (const path &path)
 Updates project history.
 
void statustext_vcs (factory::stc *stc)
 Shows vcs info on statusbar.
 
void sync (bool start=true)
 Starts or stops syncing.
 
void use_file_history_list (listview *list)
 Uses specified history list, and adds all elements from file history to the list.
 
bool vcs_blame_show (vcs_entry *vcs, syntax::stc *)
 Shows blame info for vcs in the text margin.
 
void vcs_destroy_dialog ()
 If vcs dialog was open, destroy it;.
 
void append_vcs (menu *, const menu_item *i) const override
 Appends vcs menu.
 
void bind_accelerators (wxWindow *parent, const std::vector< wxAcceleratorEntry > &v, bool debug=false) override
 Binds accelerators.
 
void debug_add_menu (menu &m, bool b) override
 Adds debug menu.
 
void debug_exe (int id, syntax::stc *stc) override
 Runs debug action.
 
void debug_exe (const std::string &exe, syntax::stc *stc) override
 Runs debug command.
 
wxEvtHandler * debug_handler () override
 Sets a debug handler.
 
bool debug_is_active () const override
 Runs true if we are debugging.
 
bool debug_print (const std::string &text) override
 Prints a debug variable.
 
bool debug_toggle_breakpoint (int line, syntax::stc *stc) override
 Toggles a breakpoint on line.
 
bool is_address (syntax::stc *stc, const std::string &text) override
 Allows you to override is_address, it is overridden in del frame, returning true if text specifies a one or two address based ex address (including command).
 
void on_command_item_dialog (wxWindowID dialogid, const wxCommandEvent &event) override
 Called when an item dialog command event is triggered.
 
void on_notebook (wxWindowID id, wxWindow *page) override
 Called if the notebook changed page.
 
bool process_async_system (const process_data &data) override
 Runs async process.
 
void set_recent_file (const path &path) override
 Allows derived class to update file history.
 
void show_ex_bar (int action=HIDE_BAR_FOCUS_STC, syntax::stc *stc=nullptr) override
 Shows or hides the ex bar.
 
void show_ex_message (const std::string &text) override
 Shows text in ex bar.
 
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.
 
int show_stc_entry_dialog (bool modal=false) override
 Shows or updates stc entry dialog.
 
syntax::stcstc_entry_dialog_component () override
 Returns stc component for stc entry dialog.
 
std::string stc_entry_dialog_title () const override
 Returns stc entry dialog title.
 
void stc_entry_dialog_title (const std::string &title) override
 Sets stc entry dialog title.
 
void stc_entry_dialog_validator (const std::string &regex) override
 Sets stc entry dialog validator.
 
void vcs_add_path (factory::link *) override
 Adds vcs path.
 
bool vcs_annotate_commit (syntax::stc *, int line, const std::string &commit_id) override
 Annotates commit.
 
bool vcs_blame (syntax::stc *) override
 Blames the specified stc.
 
bool vcs_blame_revision (syntax::stc *, const std::string &renamed, const std::string &offset) override
 Blames revision.
 
bool vcs_dir_exists (const path &p) const override
 Returns true if dir exists.
 
bool vcs_execute (int event_id, const std::vector< wex::path > &paths, const data::window &arg=data::window()) override
 Executes vcs.
 
- Public Member Functions inherited from wex::frame
 frame (size_t maxFiles=9, const data::window &data=data::window().style(wxDEFAULT_FRAME_STYLE))
 Default constructor, registers the aui manager, and creates the bars.
 
 ~frame () override
 Destructor, uninits the aui manager.
 
virtual bool allow_close (wxWindowID id, wxWindow *page)
 Returns true if the page can be closed.
 
virtual void debug_exe (const path &p)
 Invoked when a debug exe path is opened.
 
virtual bool exec_ex_command (ex_command &command)
 Executes a ex command.
 
virtual bool next_page ()
 Moves to next page. If none or only one page present, returns false.
 
virtual void open_file_same_page (const wex::path &p)
 Called on browse forward, backward.
 
virtual bool print_ex (syntax::stc *stc, const std::string &text)
 Allows you to override print ex.
 
virtual void record (const std::string &command)
 Allows you to perform action for a (vi) command.
 
virtual syntax::stcrestore_page (const std::string &key)
 Restores a previous saved current page.
 
virtual bool save_current_page (const std::string &key)
 Saves the current page, to restore later on.
 
virtual void shift_double_click ()
 Act on a double shift click.
 
virtual void sync_all ()
 Called after you checked the Sync checkbox on the options toolbar.
 
virtual void sync_close_all (wxWindowID id)
 Called after all pages from the notebooks are deleted.
 
bool allow_browse_backward () const
 Can we browse backward?
 
bool allow_browse_forward () const
 Can we browse forward?
 
bool browse (const wxCommandEvent &event)
 Handles forward and backward click.
 
const auto * debug_entry () const
 Returns current debugger.
 
auto & file_history ()
 Returns file history.
 
auto * get_find_toolbar ()
 Returns the find toolbar.
 
auto * get_options_toolbar ()
 Returns the options toolbar.
 
auto * get_statusbar ()
 Returns statusbar.
 
auto * get_toolbar ()
 Returns the toolbar.
 
const std::string pane_add (wxWindow *pane)
 Adds a window as a pane, generating a unique name.
 
bool pane_add (const panes_t &panes, const std::string &perspective="managed frame")
 Add panes to the manager.
 
wxWindow * pane_get (const std::string &pane)
 Returns window related to window, or nullptr if pane is not present.
 
bool pane_is_maximized (const std::string &pane)
 Returns true if the managed pane is maximized.
 
bool pane_is_shown (const std::string &pane)
 Returns true if pane is shown.
 
bool pane_maximize (const std::string &pane)
 Maximizes the managed pane.
 
bool pane_restore (const std::string &pane)
 Restores the managed pane.
 
bool pane_set (const std::string &pane, const wxAuiPaneInfo &info)
 Updates pane info for managed pane.
 
bool pane_show (const std::string &pane, bool show=true)
 Shows or hides the managed pane.
 
bool pane_toggle (const std::string &pane)
 Toggles the managed pane: if shown hides it, otherwise shows it.
 
size_t panes () const
 Returns number of panes.
 
void set_debug_entry (wex::debug_entry *de)
 Sets debug entry.
 
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.
 
bool show_ex_command (syntax::stc *stc, const std::string &label)
 Returns a command line ex command.
 
bool show_ex_input (syntax::stc *stc, char command)
 Shows ex bar, and enters input mode.
 
void show_process (bool show)
 Shows or hide process pane.
 
const auto & toggled_panes () const
 Returns the toggled panes.
 
std::string get_statustext (const std::string &pane) const override
 overridden methods
 
factory::stcopen_file (const path &filename, const data::stc &data=data::stc()) override
 Default opens the file using get_stc.
 
bool output (const std::string &text) const override
 Allows you to handle output text, .e.g. from a process.
 
void set_recent_file (const path &path) override
 Allows derived class to update file history.
 
void statusbar_clicked_right (const std::string &) override
 Do something when statusbar is (right) clicked.
 
bool statustext (const std::string &text, const std::string &pane) const override
 Sets text on specified pane.
 
- Public Member Functions inherited from wex::factory::frame
 frame ()
 Default constructor.
 
 frame (wxWindow *parent, wxWindowID winid, const std::string &title)
 Constructor for wxFrame.
 
virtual factory::gridget_grid ()
 Returns a grid.
 
virtual factory::listviewget_listview ()
 Returns a listview.
 
virtual factory::processget_process (const std::string &command)
 Allows you to e.g.
 
virtual factory::stcget_stc ()
 Returns an stc.
 
virtual bool is_open (const path &filename)
 Returns true if file is opened in a window.
 
virtual factory::stcopen_file (const path &filename, const std::string &text, const data::stc &data)
 Allows you to open a filename with specified contents.
 
virtual factory::stcopen_file_vcs (const path &filename, vcs_entry &vcs, const data::stc &data)
 Allows you to open a filename with info from vcs.
 
wxWindow * get_find_focus ()
 Returns the find focus.
 
bool is_closing () const
 Are we closing?
 
void set_find_focus (wxWindow *focus)
 Sets the find focus to specified window.
 
bool update_statusbar (const wxListView *lv)
 Updates statusbar pane items pane with values from specified listview.
 
bool update_statusbar (factory::stc *stc, const std::string &pane)
 Updates the specified statusbar pane with values from specified stc.
 
void SetMenuBar (wxMenuBar *bar) override
 Override from base class.
 

Static Public Attributes

static const int id_find_in_files = ID_FREE_LOWEST
 Overridden methods.
 

Protected Member Functions

auto * file_history_list ()
 Access to file history list, if you use this as a page in a notebook, you might want prevent closing it.
 
void open_from_event (const wxCommandEvent &event, const std::string &move_ext)
 Opens from event with a possible extension to move.
 

Additional Inherited Members

- Public Types inherited from wex::frame
enum  {
  HIDE_BAR , HIDE_BAR_FOCUS_STC , HIDE_BAR_FORCE , HIDE_BAR_FORCE_FOCUS_STC ,
  SHOW_BAR , SHOW_BAR_SYNC_CLOSE_ALL
}
 Enums for show_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.
 

Detailed Description

Adds file and project history support to 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::del::frame::frame ( size_t maxFiles = 9,
size_t maxProjects = 0,
const data::window & data = data::window().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::del::frame::activate ( wex::data::listview::type_t ,
const lexer * lexer = nullptr )
inlinevirtual

This method is called to activate a certain listview.

Default it returns nullptr.

◆ find_in_files()

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

Finds (or replaces) in specified files.

Returns true if process started.

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

◆ find_in_files_dialog()

int wex::del::frame::find_in_files_dialog ( const tool & tool,
bool add_in_files = false )

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

Returns result from ShowModal.

Parameters
toolID_TOOL_REPORT_FIND or ID_TOOL_REPLACE
add_in_filesadd file types selection as well

◆ get_project()

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

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

Default it returns nullptr.

◆ grep()

bool wex::del::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

◆ is_address()

bool wex::del::frame::is_address ( syntax::stc * stc,
const std::string & text )
overridevirtual

Allows you to override is_address, it is overridden in del frame, returning true if text specifies a one or two address based ex address (including command).

e.g. 1,5y, y, etc.

Reimplemented from wex::frame.

◆ sed()

bool wex::del::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]

◆ show_ex_bar()

void wex::del::frame::show_ex_bar ( int action = HIDE_BAR_FOCUS_STC,
syntax::stc * stc = nullptr )
overridevirtual

Shows or hides the ex bar.

Default it hides the ex bar and sets focus back to stc component associated with current ex. If current ex has ex mode enabled, the ex bar is always shown.

Parameters
actionaction
stcstc component to use for showing ex bar (for SHOW_ actions)

Reimplemented from wex::frame.

◆ sync()

void wex::del::frame::sync ( bool start = true)
inline

Starts or stops syncing.

Default syncing is started during construction.

◆ vcs_blame_show()

bool wex::del::frame::vcs_blame_show ( vcs_entry * vcs,
syntax::stc *  )

Shows blame info for vcs in the text margin.

Returns true if info was added.

◆ vcs_execute()

bool wex::del::frame::vcs_execute ( int event_id,
const std::vector< wex::path > & paths,
const data::window & arg = data::window() )
overridevirtual

Executes vcs.

Parameters
event_idthe vcs id
pathsthe paths
argwindow data

Reimplemented from wex::frame.