Improve drawing of active cell border
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 30 Nov 2008 02:27:30 +0000 (11:27 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 30 Nov 2008 02:27:30 +0000 (11:27 +0900)
lib/gtksheet/gtksheet.c

index b908693e0ad949f83416c3fa0750e36286753ee3..194bf25e9dcbf8307d0bca047927d747305b73e3 100644 (file)
@@ -1709,7 +1709,7 @@ gtk_sheet_style_set (GtkWidget *widget,
 
 }
 
-#define BORDER_WIDTH 4
+#define BORDER_WIDTH 2
 
 static void
 gtk_sheet_realize (GtkWidget *widget)
@@ -2951,10 +2951,10 @@ gtk_sheet_draw_border (GtkSheet *sheet, GtkSheetRange new_range)
   gdk_draw_rectangle (sheet->sheet_window,
                      sheet->xor_gc,
                      FALSE,
-                     area.x - BORDER_WIDTH / 2,
-                     area.y - BORDER_WIDTH / 2,
-                     area.width + BORDER_WIDTH,
-                     area.height + BORDER_WIDTH);
+                     area.x,
+                     area.y,
+                     area.width + 1,
+                     area.height + 1);
 }
 
 
@@ -4537,6 +4537,12 @@ gtk_sheet_size_allocate_entry (GtkSheet *sheet)
   rectangle_from_cell (sheet, sheet->active_cell.row,
                       sheet->active_cell.col, &entry_alloc);
 
+  entry_alloc.width -= BORDER_WIDTH;
+  entry_alloc.height -= BORDER_WIDTH;
+  entry_alloc.x += BORDER_WIDTH / 2;
+  entry_alloc.y += BORDER_WIDTH / 2;
+
+
   gtk_widget_set_size_request (sheet->entry_widget, entry_alloc.width,
                               entry_alloc.height);
   gtk_widget_size_allocate (sheet->entry_widget, &entry_alloc);
@@ -4556,6 +4562,13 @@ create_sheet_entry (GtkSheet *sheet)
 
   gtk_widget_size_request (sheet->entry_widget, NULL);
 
+  if ( GTK_IS_ENTRY (sheet->entry_widget))
+    {
+      g_object_set (sheet->entry_widget,
+                   "has-frame", FALSE,
+                   NULL);
+    }
+
   if (GTK_WIDGET_REALIZED (sheet))
     {
       gtk_widget_set_parent_window (sheet->entry_widget, sheet->sheet_window);