1
1

Handle CK_SyntaxOnOff action in dialog level instead of widget one.

Этот коммит содержится в:
Andrew Borodin 2011-10-08 20:03:32 +04:00
родитель ee2a204631
Коммит 385fdc7f2b
4 изменённых файлов: 42 добавлений и 7 удалений

Просмотреть файл

@ -251,6 +251,7 @@ gboolean edit_load_back_cmd (WEdit * edit);
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_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
int eval_marks (WEdit * edit, long *start_mark, long *end_mark);

Просмотреть файл

@ -4056,13 +4056,6 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
edit_syntax_dialog (edit);
break;
case CK_SyntaxOnOff:
option_syntax_highlighting ^= 1;
if (option_syntax_highlighting == 1)
edit_load_syntax (edit, NULL, edit->syntax_type);
edit->force |= REDRAW_PAGE;
break;
case CK_ShowTabTws:
enable_show_tabs_tws ^= 1;
edit->force |= REDRAW_PAGE;

Просмотреть файл

@ -1431,6 +1431,29 @@ edit_delete_macro (WEdit * edit, int hotkey)
return TRUE;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Callback for the iteration of objects in the 'editors' array.
* Toggle syntax highlighting in editor object.
*
* @param data probably WEdit object
* @param user_data unused
*/
static void
edit_syntax_onoff_cb (void *data, void *user_data)
{
(void) user_data;
if (edit_widget_is_editor ((const Widget *) data))
{
WEdit *edit = (WEdit *) data;
if (option_syntax_highlighting)
edit_load_syntax (edit, NULL, edit->syntax_type);
edit->force |= REDRAW_PAGE;
}
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
@ -1444,6 +1467,21 @@ edit_refresh_cmd (void)
tty_keypad (TRUE);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Toggle syntax highlighting in all editor windows.
*
* @param h root widget for all windows
*/
void
edit_syntax_onoff_cmd (Dlg_head * h)
{
option_syntax_highlighting = !option_syntax_highlighting;
g_list_foreach (h->widgets, edit_syntax_onoff_cb, NULL);
dlg_redraw (h);
}
/* --------------------------------------------------------------------------------------------- */
void

Просмотреть файл

@ -581,6 +581,9 @@ edit_dialog_command_execute (Dlg_head * h, unsigned long command)
case CK_About:
edit_about ();
break;
case CK_SyntaxOnOff:
edit_syntax_onoff_cmd (h);
break;
case CK_Refresh:
edit_refresh_cmd ();
break;