Revision: 686
Author: ntrel
Date: 2006-08-09 04:14:02 -0700 (Wed, 09 Aug 2006)
ViewCVS: http://svn.sourceforge.net/geany/?rev=686&view=rev
Log Message:
-----------
Use native tab DnD reordering on GTK+ 2.10; closes #1519650
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/notebook.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-08-09 11:06:51 UTC (rev 685)
+++ trunk/ChangeLog 2006-08-09 11:14:02 UTC (rev 686)
@@ -1,6 +1,8 @@
2006-08-09 Nick Treleaven <nick.treleaven(a)btinternet.com>
* src/main.c: Add startup debug message showing GTK+ runtime version.
+ * src/notebook.c: Use native tab DnD reordering on GTK+ 2.10; closes
+ #1519650.
2006-08-08 Nick Treleaven <nick.treleaven(a)btinternet.com>
Modified: trunk/src/notebook.c
===================================================================
--- trunk/src/notebook.c 2006-08-09 11:06:51 UTC (rev 685)
+++ trunk/src/notebook.c 2006-08-09 11:14:02 UTC (rev 686)
@@ -38,6 +38,10 @@
notebook_drag_motion_cb(GtkWidget *widget, GdkDragContext *dc,
gint x, gint y, guint time, gpointer user_data);
+static void
+notebook_page_reordered_cb(GtkNotebook *notebook, GtkWidget *child, guint page_num,
+ gpointer user_data);
+
#if ! GTK_CHECK_VERSION(2, 8, 0)
static gboolean
notebook_motion_notify_event_cb(GtkWidget *widget, GdkEventMotion *event,
@@ -50,32 +54,50 @@
static void
notebook_tab_close_clicked_cb(GtkButton *button, gpointer user_data);
+static void setup_tab_dnd();
-/* There is a bug with drag reordering notebook tabs.
- * Clicking (not dragging) on a notebook tab, then making a selection in the
- * Scintilla widget will cause a strange selection bug.
- * It seems there is a conflict; the drag cursor is shown,
- * and the selection is blocked; however, when releasing the
- * mouse button, the selection continues.
- * Bug present with gtk+2.6.8, not gtk+2.8.? - ntrel */
+
void notebook_init()
{
+ setup_tab_dnd();
+}
+
+
+static void setup_tab_dnd()
+{
GtkWidget *notebook = app->notebook;
- // don't allow focusing tab labels, focus sci instead
- // This disables the notebook arrows!
- //g_object_set(G_OBJECT(notebook), "can-focus", FALSE, NULL);
+ /* Due to a segfault with manual tab DnD setup on GTK 2.10, we must
+ * use the built in gtk_notebook_set_tab_reorderable from GTK 2.10.
+ * This means a binary compiled against < 2.10 but run on >= 2.10
+ * will not have tab DnD support, but this is necessary until
+ * there is a fix for the older tab DnD code or GTK 2.10. */
+ if (gtk_check_version(2, 10, 0) == NULL) // null means version ok
+ {
+#if GTK_CHECK_VERSION(2, 10, 0)
+ g_signal_connect(G_OBJECT(notebook), "page-reordered",
+ G_CALLBACK(notebook_page_reordered_cb), NULL);
+#endif
+ return;
+ }
// Set up drag movement callback
g_signal_connect(G_OBJECT(notebook), "drag-motion",
G_CALLBACK(notebook_drag_motion_cb), NULL);
+ /* There is a bug on GTK 2.6 with drag reordering of notebook tabs.
+ * Clicking (not dragging) on a notebook tab, then making a selection in the
+ * Scintilla widget will cause a strange selection bug.
+ * It seems there is a conflict; the drag cursor is shown,
+ * and the selection is blocked; however, when releasing the
+ * mouse button, the selection continues.
+ * Bug is present with gtk+2.6.8, not gtk+2.8.x - ntrel */
#if ! GTK_CHECK_VERSION(2, 8, 0)
// handle higher gtk+ runtime than build environment
- if (gtk_check_version(2, 8, 0) != NULL) //null means version ok
+ if (gtk_check_version(2, 8, 0) != NULL) // null means version ok
{
// workaround GTK+2.6 drag start bug when over sci widget:
- gtk_widget_add_events(app->notebook, GDK_POINTER_MOTION_MASK);
+ gtk_widget_add_events(notebook, GDK_POINTER_MOTION_MASK);
g_signal_connect(G_OBJECT(notebook), "motion-notify-event",
G_CALLBACK(notebook_motion_notify_event_cb), NULL);
}
@@ -91,35 +113,44 @@
#if ! GTK_CHECK_VERSION(2, 8, 0)
-/* N.B. With GTK+2.6, we don't get notebook motion-notify-event for tab child
- * widgets. */
+/* This is used to disable tab DnD when the cursor is over the
+ * Scintilla widget, and re-enable tab DnD when over the notebook tabs
+ */
static gboolean
notebook_motion_notify_event_cb(GtkWidget *widget, GdkEventMotion *event,
gpointer user_data)
{
- static gboolean drag_enabled = TRUE; //stores current state
+ static gboolean drag_enabled = TRUE; // stores current state
GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(app->notebook),
gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook)));
if (page == NULL || event->x < 0 || event->y < 0) return FALSE;
- if (event->window == page->window) //cursor over sci widget
+ if (event->window == page->window) // cursor over sci widget
{
- if (drag_enabled) gtk_drag_source_unset(widget); //disable
+ if (drag_enabled) gtk_drag_source_unset(widget); // disable
drag_enabled = FALSE;
}
- else //assume cursor over notebook tab
+ else // assume cursor over notebook tab
{
if (! drag_enabled)
gtk_drag_source_set(widget, GDK_BUTTON1_MASK,
drag_targets, G_N_ELEMENTS(drag_targets), GDK_ACTION_MOVE);
drag_enabled = TRUE;
}
- return FALSE; //propagate event
+ return FALSE; // propagate event
}
#endif
+static void
+notebook_page_reordered_cb(GtkNotebook *notebook, GtkWidget *child, guint page_num,
+ gpointer user_data)
+{
+ treeviews_openfiles_update_all();
+}
+
+
static gboolean
notebook_drag_motion_cb(GtkWidget *widget, GdkDragContext *dc,
gint x, gint y, guint time, gpointer user_data)
@@ -151,7 +182,7 @@
{
gtk_notebook_reorder_child(notebook,
gtk_notebook_get_nth_page(notebook, ncurr), ndest);
- treeviews_openfiles_update_all();
+ notebook_page_reordered_cb(NULL, NULL, ndest, NULL);
}
}
@@ -176,7 +207,7 @@
switch(gtk_notebook_get_n_pages(notebook))
{case 0: return -1; case 1: return 0;}
- tab_pos = gtk_notebook_get_tab_pos(notebook); //which edge
+ tab_pos = gtk_notebook_get_tab_pos(notebook); // which edge
while ((page = gtk_notebook_get_nth_page(notebook, page_num)))
{
@@ -250,6 +281,14 @@
// signal for clicking the tab-close button
g_signal_connect(G_OBJECT(but), "clicked",
G_CALLBACK(notebook_tab_close_clicked_cb), page);
+
+ // This is where tab DnD is enabled for GTK 2.10 and higher
+#if GTK_CHECK_VERSION(2, 10, 0)
+ if (gtk_check_version(2, 10, 0) == NULL) // null means version ok
+ {
+ gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(app->notebook), page, TRUE);
+ }
+#endif
return tabnum;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 682
Author: ntrel
Date: 2006-08-08 03:39:18 -0700 (Tue, 08 Aug 2006)
ViewCVS: http://svn.sourceforge.net/geany/?rev=682&view=rev
Log Message:
-----------
Fixed GTK 2.6 workaround for DnD tab reordering so it works on the first attempt
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/notebook.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-08-07 15:05:21 UTC (rev 681)
+++ trunk/ChangeLog 2006-08-08 10:39:18 UTC (rev 682)
@@ -1,3 +1,9 @@
+2006-08-08 Nick Treleaven <nick.treleaven(a)btinternet.com>
+
+ * src/notebook.c: Fixed GTK 2.6 workaround for DnD tab reordering so
+ it works on the first attempt.
+
+
2006-08-07 Enrico Tröger <enrico.troeger(a)uvena.de>
* src/callbacks.c: Applied patch from Củ Văn Chuối to re-enable
Modified: trunk/src/notebook.c
===================================================================
--- trunk/src/notebook.c 2006-08-07 15:05:21 UTC (rev 681)
+++ trunk/src/notebook.c 2006-08-08 10:39:18 UTC (rev 682)
@@ -250,9 +250,14 @@
g_signal_connect(G_OBJECT(but), "clicked",
G_CALLBACK(notebook_tab_close_clicked_cb), page);
// motion notify for GTK+2.6 (workaround child widgets don't pass on signal)
- // doesn't seem to work
- //g_signal_connect(G_OBJECT(this->tab_label), "motion-notify-event",
- //G_CALLBACK(notebook_motion_notify_event_cb), NULL);
+#if ! GTK_CHECK_VERSION(2, 8, 0)
+ if (gtk_check_version(2, 8, 0) != NULL) //null means version ok
+ {
+ gtk_widget_add_events(app->notebook, GDK_POINTER_MOTION_MASK);
+ g_signal_connect(G_OBJECT(app->notebook), "motion-notify-event",
+ G_CALLBACK(notebook_motion_notify_event_cb), NULL);
+ }
+#endif
return tabnum;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 679
Author: ntrel
Date: 2006-08-07 04:11:05 -0700 (Mon, 07 Aug 2006)
ViewCVS: http://svn.sourceforge.net/geany/?rev=679&view=rev
Log Message:
-----------
Place the cursor in "" for insert blank include
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/callbacks.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-08-07 10:02:11 UTC (rev 678)
+++ trunk/ChangeLog 2006-08-07 11:11:05 UTC (rev 679)
@@ -1,6 +1,7 @@
2006-08-07 Nick Treleaven <nick.treleaven(a)btinternet.com>
* src/callbacks.c: Allow Find even when the replace text is the same.
+ Place the cursor in "" for insert blank include.
2006-08-06 Nick Treleaven <nick.treleaven(a)btinternet.com>
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2006-08-07 10:02:11 UTC (rev 678)
+++ trunk/src/callbacks.c 2006-08-07 11:11:05 UTC (rev 679)
@@ -2430,12 +2430,13 @@
on_insert_include_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- gint idx = document_get_cur_idx();
+ gint idx = document_get_cur_idx(), pos = -1;
gchar *text;
if (utils_strcmp(user_data, "blank"))
{
text = g_strdup("#include \"\"\n");
+ pos = clickpos + 10;
}
else
{
@@ -2444,6 +2445,7 @@
sci_insert_text(doc_list[idx].sci, clickpos, text);
g_free(text);
+ if (pos > 0) sci_goto_pos(doc_list[idx].sci, pos, FALSE);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 678
Author: ntrel
Date: 2006-08-07 03:02:11 -0700 (Mon, 07 Aug 2006)
ViewCVS: http://svn.sourceforge.net/geany/?rev=678&view=rev
Log Message:
-----------
Allow Find even when the replace text is the same
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/callbacks.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-08-06 21:49:16 UTC (rev 677)
+++ trunk/ChangeLog 2006-08-07 10:02:11 UTC (rev 678)
@@ -1,3 +1,8 @@
+2006-08-07 Nick Treleaven <nick.treleaven(a)btinternet.com>
+
+ * src/callbacks.c: Allow Find even when the replace text is the same.
+
+
2006-08-06 Nick Treleaven <nick.treleaven(a)btinternet.com>
* doc/geany.docbook:
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2006-08-06 21:49:16 UTC (rev 677)
+++ trunk/src/callbacks.c 2006-08-07 10:02:11 UTC (rev 678)
@@ -1957,7 +1957,7 @@
find = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry_find)))));
replace = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry_replace)))));
- if ((! fl1) && (strcasecmp(find, replace) == 0))
+ if ((response != GEANY_RESPONSE_FIND) && (! fl1) && (strcasecmp(find, replace) == 0))
{
utils_beep();
gtk_widget_grab_focus(GTK_WIDGET(GTK_BIN(lookup_widget(app->replace_dialog, "entry_find"))->child));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 677
Author: ntrel
Date: 2006-08-06 14:49:16 -0700 (Sun, 06 Aug 2006)
ViewCVS: http://svn.sourceforge.net/geany/?rev=677&view=rev
Log Message:
-----------
Added Filetype extensions section; Grouped configuration file sections into a chapter
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/geany.docbook
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-08-06 20:46:24 UTC (rev 676)
+++ trunk/ChangeLog 2006-08-06 21:49:16 UTC (rev 677)
@@ -2,6 +2,8 @@
* doc/geany.docbook:
Improved search section; added all find and go to commands.
+ Added Filetype extensions section.
+ Grouped configuration file sections into a chapter.
2006-08-05 Nick Treleaven <nick.treleaven(a)btinternet.com>
Modified: trunk/doc/geany.docbook
===================================================================
--- trunk/doc/geany.docbook 2006-08-06 20:46:24 UTC (rev 676)
+++ trunk/doc/geany.docbook 2006-08-06 21:49:16 UTC (rev 677)
@@ -117,7 +117,7 @@
recommended.
</para>
</section>
- <section id="sourcecompilation">
+ <section id="source_compilation">
<title>Source compilation</title>
<para>
Compiling <application>&app;</application> is quite easy. The following should do it:
@@ -147,7 +147,7 @@
otherwise contact the author at <email>&author_mail;</email>.
</para>
</section>
- <section id="binarypackages">
+ <section id="binary_packages">
<title>Binary packages</title>
<section>
<title>Fedora</title>
@@ -188,7 +188,7 @@
<chapter id="usage">
<title>Usage</title>
- <section id="gettingstarted">
+ <section id="getting_started">
<title>Getting started</title>
<para>
You can start <application>&app;</application> in the following ways:
@@ -414,7 +414,7 @@
</para>
</section>
-->
- <section id="searchreplace">
+ <section id="search_replace">
<title>Search, replace and go to</title>
<para>
This section describes search-related commands from the Search menu and
@@ -773,7 +773,7 @@
</para>
</section>
</section>
- <section id="buildsystem">
+ <section id="build_system">
<title>Build system</title>
<para>
<application>&app;</application> has an integrated build system.
@@ -1220,6 +1220,10 @@
</table>
</para>
</section>
+ </chapter>
+
+ <chapter id="config_files">
+ <title>Configuration files</title>
<section id="filetypes">
<title>Filetype definition files</title>
<para>
@@ -1528,6 +1532,40 @@
</para>
</section>
</section>
+ <section id="filetype_extensions">
+ <title>Filetype extensions</title>
+ <para>
+ You can override the default extensions that <application>&app;</application> uses
+ for each filetype using the <filename>filetype_extensions.conf</filename> file.
+ </para>
+ <para>
+ To override the system-wide configuration file,
+ copy it from <filename>$prefix/share/geany</filename> to your
+ configuration directory, usually <filename>~/.geany/</filename>.
+ $prefix is the path where
+ <application>&app;</application> is installed (commonly
+ <filename>/usr/local</filename>).
+ </para>
+ <para>
+ For example:
+ <screen><prompt>%</prompt> <userinput><command>cp /usr/local/share/geany/filetype_extensions.conf /home/username/.geany/</command></userinput></screen>
+ </para>
+ <para>
+ Then edit it and remove all the lines for filetype extensions that you
+ do not want to override. The remaining lines can be edited after the
+ <literal>=</literal> sign, using a semi-colon separated list of patterns
+ which should be matched for that filetype.
+ </para>
+ <para>
+ For example, to set the filetype extensions for Make, the
+ <filename>/home/username/.geany/filetype_extensions.conf</filename>
+ file should look like:
+ <literallayout><literal>
+ [Extensions]
+ Make=Makefile*;*.mk;Buildfile;
+ </literal></literallayout>
+ </para>
+ </section>
<section>
<title>Templates</title>
<para>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.