Handle CK_ShowTabTws and CK_ShowMargin actions in dialog level instead of widget one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-10-09 20:06:54 +04:00
parent 385fdc7f2b
commit 85ad1fe4ce
4 changed files with 56 additions and 10 deletions

View File

@ -252,6 +252,8 @@ gboolean edit_load_forward_cmd (WEdit * edit);
void edit_block_process_cmd (WEdit * edit, int macro_number);
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_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
int eval_marks (WEdit * edit, long *start_mark, long *end_mark);

View File

@ -3934,11 +3934,6 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
edit->force |= REDRAW_PAGE;
break;
case CK_ShowMargin:
show_right_margin = !show_right_margin;
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))
@ -4056,11 +4051,6 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
edit_syntax_dialog (edit);
break;
case CK_ShowTabTws:
enable_show_tabs_tws ^= 1;
edit->force |= REDRAW_PAGE;
break;
case CK_Search:
edit_search_cmd (edit, FALSE);
break;

View File

@ -1455,6 +1455,24 @@ edit_syntax_onoff_cb (void *data, void *user_data)
}
}
/* --------------------------------------------------------------------------------------------- */
/**
* Callback for the iteration of objects in the 'editors' array.
* Redraw editor object.
*
* @param data probably WEdit object
* @param user_data unused
*/
static void
edit_redraw_page_cb (void *data, void *user_data)
{
(void) user_data;
if (edit_widget_is_editor ((const Widget *) data))
((WEdit *) data)->force |= REDRAW_PAGE;
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
@ -1482,6 +1500,36 @@ edit_syntax_onoff_cmd (Dlg_head * h)
dlg_redraw (h);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Toggle tabs showing in all editor windows.
*
* @param h root widget for all windows
*/
void
edit_show_tabs_tws_cmd (Dlg_head * h)
{
enable_show_tabs_tws = !enable_show_tabs_tws;
g_list_foreach (h->widgets, edit_redraw_page_cb, NULL);
dlg_redraw (h);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Toggle right margin showing in all editor windows.
*
* @param h root widget for all windows
*/
void
edit_show_margin_cmd (Dlg_head * h)
{
show_right_margin = !show_right_margin;
g_list_foreach (h->widgets, edit_redraw_page_cb, NULL);
dlg_redraw (h);
}
/* --------------------------------------------------------------------------------------------- */
void

View File

@ -584,6 +584,12 @@ edit_dialog_command_execute (Dlg_head * h, unsigned long command)
case CK_SyntaxOnOff:
edit_syntax_onoff_cmd (h);
break;
case CK_ShowTabTws:
edit_show_tabs_tws_cmd (h);
break;
case CK_ShowMargin:
edit_show_margin_cmd (h);
break;
case CK_Refresh:
edit_refresh_cmd ();
break;