Handle CK_ShowNumbers action in dialog level instead of widget one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-11-05 12:55:29 +03:00
parent 85ad1fe4ce
commit 6038c893e4
4 changed files with 21 additions and 10 deletions

View File

@ -254,6 +254,7 @@ void edit_refresh_cmd (void);
void edit_syntax_onoff_cmd (Dlg_head * h);
void edit_show_tabs_tws_cmd (Dlg_head * h);
void edit_show_margin_cmd (Dlg_head * h);
void edit_show_numbers_cmd (Dlg_head * h);
void edit_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
int eval_marks (WEdit * edit, long *start_mark, long *end_mark);

View File

@ -2176,10 +2176,7 @@ edit_init (WEdit * edit, int y, int x, int lines, int cols, const vfs_path_t * f
gboolean to_free = FALSE;
option_auto_syntax = 1; /* Resetting to auto on every invokation */
if (option_line_state)
option_line_state_width = LINE_STATE_WIDTH;
else
option_line_state_width = 0;
option_line_state_width = option_line_state ? LINE_STATE_WIDTH : 0;
if (edit != NULL)
edit_purge_widget (edit);
@ -3928,12 +3925,6 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
edit_mark_current_line_cmd (edit);
break;
case CK_ShowNumbers:
option_line_state = !option_line_state;
option_line_state_width = option_line_state ? LINE_STATE_WIDTH : 0;
edit->force |= REDRAW_PAGE;
break;
case CK_Bookmark:
book_mark_clear (edit, edit->curs_line, BOOK_MARK_FOUND_COLOR);
if (book_mark_query_color (edit, edit->curs_line, BOOK_MARK_COLOR))

View File

@ -1530,6 +1530,22 @@ edit_show_margin_cmd (Dlg_head * h)
dlg_redraw (h);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Toggle line numbers showing in all editor windows.
*
* @param h root widget for all windows
*/
void
edit_show_numbers_cmd (Dlg_head * h)
{
option_line_state = !option_line_state;
option_line_state_width = option_line_state ? LINE_STATE_WIDTH : 0;
g_list_foreach (h->widgets, edit_redraw_page_cb, NULL);
dlg_redraw (h);
}
/* --------------------------------------------------------------------------------------------- */
void

View File

@ -590,6 +590,9 @@ edit_dialog_command_execute (Dlg_head * h, unsigned long command)
case CK_ShowMargin:
edit_show_margin_cmd (h);
break;
case CK_ShowNumbers:
edit_show_numbers_cmd (h);
break;
case CK_Refresh:
edit_refresh_cmd ();
break;