anjuta r3766 - in branches/anjuta-2-4: . plugins/language-support-cpp-java plugins/sourceview plugins/subversion



Author: jhs
Date: Tue Mar 11 14:05:05 2008
New Revision: 3766
URL: http://svn.gnome.org/viewvc/anjuta?rev=3766&view=rev

Log:
2008-03-11  Johannes Schmid  <jhs gnome org>

	* plugins/language-support-cpp-java/plugin.c
	(get_line_indentation_base):
	* plugins/sourceview/anjuta-view.c (anjuta_view_key_press_event),
	(anjuta_view_button_press_event):
	* plugins/sourceview/sourceview.c (on_insert_text),
	(sourceview_adjustment_changed), (sourceview_new):
	* plugins/subversion/plugin.c (activate_plugin):
	
	#520761 â Weirz behavior with popup
	#520415 â [PATCH] Problems in auto indentatation code

Modified:
   branches/anjuta-2-4/ChangeLog
   branches/anjuta-2-4/plugins/language-support-cpp-java/plugin.c
   branches/anjuta-2-4/plugins/sourceview/anjuta-view.c
   branches/anjuta-2-4/plugins/sourceview/sourceview.c
   branches/anjuta-2-4/plugins/subversion/plugin.c

Modified: branches/anjuta-2-4/plugins/language-support-cpp-java/plugin.c
==============================================================================
--- branches/anjuta-2-4/plugins/language-support-cpp-java/plugin.c	(original)
+++ branches/anjuta-2-4/plugins/language-support-cpp-java/plugin.c	Tue Mar 11 14:05:05 2008
@@ -871,25 +871,26 @@
 												 NULL);
 
 		/* DEBUG_PRINT("point_ch = %c", point_ch); */
-		/* Check if we are inside a comment */
+		
+		/* Check for line comment comment */
 		if (!line_checked_for_comment && !isspace(point_ch))
 		{
 			gboolean comment = FALSE;
-			gboolean comment_end = FALSE;
 			IAnjutaIterable* new_iter = ianjuta_iterable_clone (iter, NULL);
 			do
 			{
 				gchar c;
 				c = ianjuta_editor_cell_get_char (IANJUTA_EDITOR_CELL (new_iter), 0,
 												  NULL);
-				if (!comment_end && iter_is_newline (new_iter, c))
+				if (iter_is_newline (new_iter, c))
 				{
 					line_checked_for_comment = TRUE;
 					break;
 				}
 				if (c == '/')
 				{
-					ianjuta_iterable_previous (new_iter, NULL);
+					if (!ianjuta_iterable_previous (new_iter, NULL))
+						break;
 					c = ianjuta_editor_cell_get_char (IANJUTA_EDITOR_CELL (new_iter), 0,
 													  NULL);
 					if (c == '/')
@@ -899,6 +900,31 @@
 						break;
 					}
 				}
+			} while (ianjuta_iterable_previous (new_iter, NULL));
+			if (comment)
+			{
+				ianjuta_iterable_set_position (iter,
+											   ianjuta_iterable_get_position (new_iter, NULL) - 1, 
+											   NULL);
+				g_object_unref (new_iter);
+				continue;
+			}
+			g_object_unref (new_iter);
+		}
+		/* Check if we are inside a comment */
+		if (point_ch == '/' || point_ch == '*')
+		{
+			gboolean comment = FALSE;
+			gboolean comment_end = FALSE;
+			IAnjutaIterable* new_iter = ianjuta_iterable_clone (iter, NULL);
+			do
+			{
+				gchar c = ianjuta_editor_cell_get_char (IANJUTA_EDITOR_CELL(new_iter),
+												  0, NULL);
+				if (!comment_end && iter_is_newline (new_iter, c))
+				{
+					break;
+				}
 				if (c == '*')
 				{
 					IAnjutaIterable* prev = ianjuta_iterable_clone (new_iter, NULL);
@@ -910,20 +936,31 @@
 					gchar next_c = ianjuta_editor_cell_get_char (IANJUTA_EDITOR_CELL (next), 0,
 													  NULL);					
 					if (prev_c == '/')
-					{
+					{		 
 						/* starts comment */
 						comment = TRUE;
-						DEBUG_PRINT ("Starts comment");
 						if (!comment_end)
+						{
 							extra_indent++;
+							/* In the middle of a comment we can't know
+						     * if the statement is incomplete
+							 */
+							*incomplete_statement = -1;
+							/* ":" have to be ignored inside comments */
+							if (*colon_indent)
+							{
+								*colon_indent = FALSE;
+								extra_indent -= INDENT_SIZE;
+							}
+						}
 						g_object_unref (prev);
 						g_object_unref (next);
 						break;
+						
 					}
 					else if (next_c == '/')
 					{
-						/* ends comment */
-						DEBUG_PRINT ("Ends comment");
+						/* ends comment: */
 						comment_end = TRUE;
 						g_object_unref (prev);
 						g_object_unref (next);
@@ -1113,8 +1150,11 @@
 				*incomplete_statement = 1;
 		}
 	}
-	if (ianjuta_iterable_first (iter, NULL))
+	if (!line_indent && extra_indent)
+	{
+		DEBUG_PRINT ("Adding special indent");
 		line_indent += extra_indent;
+	}
 	g_object_unref (iter);
 	
 	return line_indent;

Modified: branches/anjuta-2-4/plugins/sourceview/anjuta-view.c
==============================================================================
--- branches/anjuta-2-4/plugins/sourceview/anjuta-view.c	(original)
+++ branches/anjuta-2-4/plugins/sourceview/anjuta-view.c	Tue Mar 11 14:05:05 2008
@@ -752,7 +752,7 @@
       case GDK_Down:
       case GDK_Page_Up:
       case GDK_Page_Down:
-        gtk_widget_destroy (GTK_WIDGET(view->priv->sv->priv->assist_tip));
+        gtk_widget_destroy (GTK_WIDGET(assist_tip));
         break;
 		}
 	}
@@ -764,6 +764,18 @@
 {
 	AnjutaView* view = ANJUTA_VIEW(widget);
 	
+  /* If we have a calltip shown - hide it */
+  AssistTip* assist_tip = view->priv->sv->priv->assist_tip;
+  AssistWindow* assist_win = view->priv->sv->priv->assist_win;
+  if (assist_win)
+  {
+    gtk_widget_destroy (GTK_WIDGET (assist_win));
+  }
+	if (assist_tip)
+	{
+    gtk_widget_destroy (GTK_WIDGET (assist_tip));
+  }
+  
 	switch(event->button)
 	{
 		case 3: /* Right Button */

Modified: branches/anjuta-2-4/plugins/sourceview/sourceview.c
==============================================================================
--- branches/anjuta-2-4/plugins/sourceview/sourceview.c	(original)
+++ branches/anjuta-2-4/plugins/sourceview/sourceview.c	Tue Mar 11 14:05:05 2008
@@ -125,7 +125,7 @@
 							Sourceview* sv)
 {
 	/* We only want ascii characters */
-	if (len > 1)
+	if (len > 1 || strlen(text) > 1)
 		return;
 	else
 	{
@@ -423,6 +423,17 @@
 }
 
 static void 
+sourceview_adjustment_changed(GtkAdjustment* ad, Sourceview* sv)
+{
+	/* Hide assistance windows when scrolling vertically */
+	
+	if (sv->priv->assist_win)
+		gtk_widget_destroy (GTK_WIDGET (sv->priv->assist_win));
+	if (sv->priv->assist_tip)
+		gtk_widget_destroy (GTK_WIDGET (sv->priv->assist_tip));
+}
+
+static void 
 sourceview_instance_init(Sourceview* sv)
 {
 	sv->priv = g_slice_new0 (SourceviewPrivate);
@@ -580,6 +591,7 @@
 sourceview_new(const gchar* uri, const gchar* filename, AnjutaPlugin* plugin)
 {
 	AnjutaShell* shell;
+	GtkAdjustment* v_adj;
 	
 	Sourceview *sv = ANJUTA_SOURCEVIEW(g_object_new(ANJUTA_TYPE_SOURCEVIEW, NULL));
 	
@@ -628,6 +640,8 @@
 				      GTK_POLICY_AUTOMATIC);
 	gtk_container_add(GTK_CONTAINER(sv), GTK_WIDGET(sv->priv->view));
 	gtk_widget_show_all(GTK_WIDGET(sv));
+	v_adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sv));
+	g_signal_connect (v_adj, "value-changed", G_CALLBACK (sourceview_adjustment_changed), sv);
 	
 	if (uri != NULL && strlen(uri) > 0)
 	{

Modified: branches/anjuta-2-4/plugins/subversion/plugin.c
==============================================================================
--- branches/anjuta-2-4/plugins/subversion/plugin.c	(original)
+++ branches/anjuta-2-4/plugins/subversion/plugin.c	Tue Mar 11 14:05:05 2008
@@ -427,6 +427,7 @@
 	Subversion *subversion;
 	GtkAction *commit_action;
 	GtkAction *revert_action;
+	GtkAction *resolve_action;
 	
 	DEBUG_PRINT ("Subversion: Activating Subversion plugin ...");
 	subversion = ANJUTA_PLUGIN_SUBVERSION (plugin);
@@ -485,11 +486,16 @@
 															   NULL),
 										  "ActionGroupSubversion",
 										  "ActionSubversionRevert");
+	resolve_action = anjuta_ui_get_action (anjuta_shell_get_ui (plugin->shell,
+															   NULL),
+										  "ActionGroupSubversion",
+										  "ActionSubversionResolve");
 
 	if (!subversion->project_root_dir)
 	{
 		gtk_action_set_sensitive (commit_action, FALSE);
 		gtk_action_set_sensitive (revert_action, FALSE);
+		gtk_action_set_sensitive (resolve_action, FALSE);
 	}
 							 
 	return TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]