Separate on_margin_click(), on_update_ui(), on_char_added()
Scintilla notifications. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1425 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
6daf4d84be
commit
62bcccd1ba
@ -9,6 +9,9 @@
|
||||
* src/sci_cb.c, src/symbols.c, src/symbols.h:
|
||||
Load HTML-entities when the PHP lexer is first needed, instead of
|
||||
when typing outside of PHP styles.
|
||||
* src/sci_cb.c:
|
||||
Separate on_margin_click(), on_update_ui(), on_char_added()
|
||||
Scintilla notifications.
|
||||
|
||||
|
||||
2007-03-25 Enrico Tröger <enrico.troeger@uvena.de>
|
||||
|
||||
105
src/sci_cb.c
105
src/sci_cb.c
@ -99,37 +99,9 @@ on_editor_button_press_event (GtkWidget *widget,
|
||||
}
|
||||
|
||||
|
||||
// callback func called by all editors when a signal arises
|
||||
void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer user_data)
|
||||
{
|
||||
struct SCNotification *nt;
|
||||
ScintillaObject *sci;
|
||||
gint idx;
|
||||
typedef struct SCNotification SCNotification;
|
||||
|
||||
idx = GPOINTER_TO_INT(user_data);
|
||||
sci = doc_list[idx].sci;
|
||||
|
||||
nt = lscn;
|
||||
switch (nt->nmhdr.code)
|
||||
{
|
||||
case SCN_SAVEPOINTLEFT:
|
||||
{
|
||||
doc_list[idx].changed = TRUE;
|
||||
document_set_text_changed(idx);
|
||||
break;
|
||||
}
|
||||
case SCN_SAVEPOINTREACHED:
|
||||
{
|
||||
doc_list[idx].changed = FALSE;
|
||||
document_set_text_changed(idx);
|
||||
break;
|
||||
}
|
||||
case SCN_MODIFYATTEMPTRO:
|
||||
{
|
||||
utils_beep();
|
||||
break;
|
||||
}
|
||||
case SCN_MARGINCLICK:
|
||||
static void on_margin_click(ScintillaObject *sci, SCNotification *nt)
|
||||
{
|
||||
// left click to marker margin marks the line
|
||||
if (nt->margin == 1)
|
||||
@ -161,10 +133,12 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCN_UPDATEUI:
|
||||
|
||||
|
||||
static void on_update_ui(gint idx, G_GNUC_UNUSED SCNotification *nt)
|
||||
{
|
||||
ScintillaObject *sci = doc_list[idx].sci;
|
||||
gint pos = sci_get_current_position(sci);
|
||||
|
||||
// undo / redo menu update
|
||||
@ -198,19 +172,12 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer
|
||||
sci_get_style_at(sci, pos);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case SCN_MODIFIED:
|
||||
{
|
||||
if (nt->modificationType & SC_STARTACTION && ! app->ignore_callback)
|
||||
{
|
||||
// get notified about undo changes
|
||||
document_undo_add(idx, UNDO_SCINTILLA, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCN_CHARADDED:
|
||||
|
||||
|
||||
static void on_char_added(gint idx, SCNotification *nt)
|
||||
{
|
||||
ScintillaObject *sci = doc_list[idx].sci;
|
||||
gint pos = sci_get_current_position(sci);
|
||||
|
||||
switch (nt->ch)
|
||||
@ -273,8 +240,60 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer
|
||||
}
|
||||
default: sci_cb_start_auto_complete(idx, pos, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// callback func called by all editors when a signal arises
|
||||
void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer user_data)
|
||||
{
|
||||
SCNotification *nt;
|
||||
ScintillaObject *sci;
|
||||
gint idx;
|
||||
|
||||
idx = GPOINTER_TO_INT(user_data);
|
||||
sci = doc_list[idx].sci;
|
||||
|
||||
nt = lscn;
|
||||
switch (nt->nmhdr.code)
|
||||
{
|
||||
case SCN_SAVEPOINTLEFT:
|
||||
{
|
||||
doc_list[idx].changed = TRUE;
|
||||
document_set_text_changed(idx);
|
||||
break;
|
||||
}
|
||||
case SCN_SAVEPOINTREACHED:
|
||||
{
|
||||
doc_list[idx].changed = FALSE;
|
||||
document_set_text_changed(idx);
|
||||
break;
|
||||
}
|
||||
case SCN_MODIFYATTEMPTRO:
|
||||
{
|
||||
utils_beep();
|
||||
break;
|
||||
}
|
||||
case SCN_MARGINCLICK:
|
||||
on_margin_click(sci, nt);
|
||||
break;
|
||||
|
||||
case SCN_UPDATEUI:
|
||||
on_update_ui(idx, nt);
|
||||
break;
|
||||
|
||||
case SCN_MODIFIED:
|
||||
{
|
||||
if (nt->modificationType & SC_STARTACTION && ! app->ignore_callback)
|
||||
{
|
||||
// get notified about undo changes
|
||||
document_undo_add(idx, UNDO_SCINTILLA, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCN_CHARADDED:
|
||||
on_char_added(idx, nt);
|
||||
break;
|
||||
|
||||
case SCN_USERLISTSELECTION:
|
||||
{
|
||||
if (nt->listType == 1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user