applied patches from the Scintilla ML
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@266 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
40bfefcee9
commit
2a3fb3c9d5
@ -1967,6 +1967,31 @@ static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
/* Change the active color to the selected color so the listbox uses the color
|
||||
scheme that it would use if it had the focus. */
|
||||
static void StyleSet(GtkWidget *w, GtkStyle*, void*) {
|
||||
GtkStyle* style;
|
||||
|
||||
g_return_if_fail(w != NULL);
|
||||
|
||||
/* Copy the selected color to active. Note that the modify calls will cause
|
||||
recursive calls to this function after the value is updated and w->style to
|
||||
be set to a new object */
|
||||
style = gtk_widget_get_style(w);
|
||||
if (style == NULL)
|
||||
return;
|
||||
if (!gdk_color_equal(&style->base[GTK_STATE_SELECTED], &style->base[GTK_STATE_ACTIVE]))
|
||||
gtk_widget_modify_base(w, GTK_STATE_ACTIVE, &style->base[GTK_STATE_SELECTED]);
|
||||
|
||||
style = gtk_widget_get_style(w);
|
||||
if (style == NULL)
|
||||
return;
|
||||
if (!gdk_color_equal(&style->text[GTK_STATE_SELECTED], &style->text[GTK_STATE_ACTIVE]))
|
||||
gtk_widget_modify_text(w, GTK_STATE_ACTIVE, &style->text[GTK_STATE_SELECTED]);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ListBoxX::Create(Window &, int, Point, int, bool) {
|
||||
id = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
|
||||
@ -2002,6 +2027,8 @@ void ListBoxX::Create(Window &, int, Point, int, bool) {
|
||||
gtk_list_store_new(N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
||||
|
||||
list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
|
||||
g_signal_connect(G_OBJECT(list), "style-set", G_CALLBACK(StyleSet), NULL);
|
||||
|
||||
GtkTreeSelection *selection =
|
||||
gtk_tree_view_get_selection(GTK_TREE_VIEW(list));
|
||||
gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
|
||||
@ -2010,7 +2037,7 @@ void ListBoxX::Create(Window &, int, Point, int, bool) {
|
||||
|
||||
/* Columns */
|
||||
GtkTreeViewColumn *column = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
||||
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_title(column, "Autocomplete");
|
||||
|
||||
GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
|
||||
@ -2019,11 +2046,14 @@ void ListBoxX::Create(Window &, int, Point, int, bool) {
|
||||
"pixbuf", PIXBUF_COLUMN);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(renderer), 1);
|
||||
gtk_tree_view_column_pack_start(column, renderer, TRUE);
|
||||
gtk_tree_view_column_add_attribute(column, renderer,
|
||||
"text", TEXT_COLUMN);
|
||||
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
|
||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(list), "fixed-height-mode"))
|
||||
g_object_set(G_OBJECT(list), "fixed-height-mode", TRUE, NULL);
|
||||
gtk_container_add(GTK_CONTAINER(PWidget(scroller)), PWidget(list));
|
||||
gtk_widget_show(PWidget(list));
|
||||
|
||||
@ -2046,7 +2076,7 @@ void ListBoxX::SetFont(Font &scint_font) {
|
||||
}
|
||||
#else
|
||||
// Only do for Pango font as there have been crashes for GDK fonts
|
||||
if (PFont(scint_font)->pfd) {
|
||||
if (Created() && PFont(scint_font)->pfd) {
|
||||
// Current font is Pango font
|
||||
gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd);
|
||||
}
|
||||
|
@ -527,6 +527,7 @@ void ScintillaGTK::Map(GtkWidget *widget) {
|
||||
void ScintillaGTK::UnMapThis() {
|
||||
//Platform::DebugPrintf("ScintillaGTK::unmap this\n");
|
||||
GTK_WIDGET_UNSET_FLAGS(PWidget(wMain), GTK_MAPPED);
|
||||
DropGraphics();
|
||||
gdk_window_hide(PWidget(wMain)->window);
|
||||
gtk_widget_unmap(PWidget(wText));
|
||||
gtk_widget_unmap(PWidget(scrollbarh));
|
||||
@ -1187,24 +1188,16 @@ const char *ScintillaGTK::CharacterSetID() const {
|
||||
((x) >= 0 && (x) <= 128)
|
||||
|
||||
#define IS_ACC_OR_CHAR(x) \
|
||||
(IS_CHAR(x)) || (IS_ACC(x))
|
||||
|
||||
#define IS_ACC(x) \
|
||||
((x) >= 65103 && (x) <= 65111)
|
||||
#define IS_CHAR(x) \
|
||||
((x) >= 0 && (x) <= 128)
|
||||
|
||||
#define IS_ACC_OR_CHAR(x) \
|
||||
(IS_CHAR(x)) || (IS_ACC(x))
|
||||
(IS_CHAR(x) || IS_ACC(x))
|
||||
|
||||
static int MakeAccent(int key, int acc) {
|
||||
const char *conv[] = {
|
||||
"aeiounc AEIOUNC",
|
||||
"ãeiõuñc~ÃEIÕUÑC",
|
||||
"áéíóúnç'ÁÉÍÓÚNÇ",
|
||||
"àèìòùnc`ÀÈÌÒÙNC",
|
||||
"âêîôûnc^ÂÊÎÔÛNC",
|
||||
"äëïöünc¨ÄËÏÖÜNC"
|
||||
"ãeiõuñc~ÃEIÕUÑC",
|
||||
"áéíóúnç'ÁÉÍÓÚNÇ",
|
||||
"àèìòùnc`ÀÈÌÒÙNC",
|
||||
"âêîôûnc^ÂÊÎÔÛNC",
|
||||
"äëïöüncšÄËÏÖÜNC"
|
||||
};
|
||||
int idx;
|
||||
for (idx = 0; idx < 15; ++idx) {
|
||||
@ -1399,7 +1392,7 @@ bool ScintillaGTK::OwnPrimarySelection() {
|
||||
void ScintillaGTK::ClaimSelection() {
|
||||
// X Windows has a 'primary selection' as well as the clipboard.
|
||||
// Whenever the user selects some text, we become the primary selection
|
||||
if (currentPos != anchor) {
|
||||
if (currentPos != anchor && GTK_WIDGET_REALIZED(GTK_WIDGET(PWidget(wMain)))) {
|
||||
primarySelection = true;
|
||||
gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)),
|
||||
GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
|
||||
@ -1491,6 +1484,7 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) {
|
||||
SetEmptySelection(currentPos + selText.len);
|
||||
}
|
||||
pdoc->EndUndoAction();
|
||||
EnsureCaretVisible();
|
||||
}
|
||||
}
|
||||
// else fprintf(stderr, "Target non string %d %d\n", (int)(selection_data->type),
|
||||
@ -1506,9 +1500,12 @@ void ScintillaGTK::ReceivedDrop(GtkSelectionData *selection_data) {
|
||||
GetGtkSelectionText(selection_data, selText);
|
||||
DropAt(posDrop, selText.s, false, selText.rectangular);
|
||||
}
|
||||
} else {
|
||||
char *ptr = reinterpret_cast<char *>(selection_data->data);
|
||||
} else if (selection_data->length > 0) {
|
||||
char *ptr = new char[selection_data->length + 1];
|
||||
ptr[selection_data->length] = '\0';
|
||||
memcpy(ptr, selection_data->data, selection_data->length);
|
||||
NotifyURIDropped(ptr);
|
||||
delete []ptr;
|
||||
}
|
||||
Redraw();
|
||||
}
|
||||
@ -2193,7 +2190,7 @@ gint ScintillaGTK::ExposeTextThis(GtkWidget * /*widget*/, GdkEventExpose *ose) {
|
||||
paintState = notPainting;
|
||||
|
||||
if (rgnUpdate) {
|
||||
g_free(rgnUpdate);
|
||||
gdk_region_destroy(rgnUpdate);
|
||||
}
|
||||
rgnUpdate = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user