Code

Additional state indicators.
authorjoncruz <joncruz@users.sourceforge.net>
Mon, 23 Mar 2009 03:09:37 +0000 (03:09 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Mon, 23 Mar 2009 03:09:37 +0000 (03:09 +0000)
src/widgets/eek-preview.cpp
src/widgets/eek-preview.h

index 1c1adf54331641f66445df4954dea02b34ef061c..2d9c064e029e56a978f03fd9074b3557ecc18e0e 100644 (file)
@@ -247,6 +247,26 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event )
                             insetX, insetY,
                             widget->allocation.width - (insetX * 2), widget->allocation.height - (insetY * 2) );
 
+        if ( preview->_previewPixbuf ) {
+            GtkDrawingArea* da = &(preview->drawing);
+            GdkDrawable* drawable = (GdkDrawable*) (((GtkWidget*)da)->window);
+            gint w = 0;
+            gint h = 0;
+            gdk_drawable_get_size(drawable, &w, &h);
+            if ((w != preview->_scaledW) || (h != preview->_scaledH)) {
+                if (preview->_scaled) {
+                    g_object_unref(preview->_scaled);
+                }
+                preview->_scaled = gdk_pixbuf_scale_simple(preview->_previewPixbuf, w, h, GDK_INTERP_BILINEAR);
+                preview->_scaledW = w;
+                preview->_scaledH = h;
+            }
+
+            GdkPixbuf* pix = (preview->_scaled) ? preview->_scaled : preview->_previewPixbuf;
+            gdk_draw_pixbuf( drawable, 0, pix, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0 );
+        }
+
+
         if ( preview->_linked ) {
             /* Draw arrow */
             GdkRectangle possible = {insetX, insetY, (widget->allocation.width - (insetX * 2)), (widget->allocation.height - (insetY * 2)) };
@@ -293,7 +313,7 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event )
                                  NULL, /* clip area.  &area, */
                                  widget, /* may be NULL */
                                  NULL, /* detail */
-                                 GTK_ARROW_UP,
+                                 GTK_ARROW_DOWN,
                                  FALSE,
                                  otherArea.x, otherArea.y,
                                  otherArea.width, otherArea.height
@@ -319,25 +339,43 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event )
                                  otherArea.width, otherArea.height
                                  );
             }
-        }
 
-        if ( preview->_previewPixbuf ) {
-            GtkDrawingArea* da = &(preview->drawing);
-            GdkDrawable* drawable = (GdkDrawable*) (((GtkWidget*)da)->window);
-            gint w = 0;
-            gint h = 0;
-            gdk_drawable_get_size(drawable, &w, &h);
-            if ((w != preview->_scaledW) || (h != preview->_scaledH)) {
-                if (preview->_scaled) {
-                    g_object_unref(preview->_scaled);
+
+            if ( preview->_linked & PREVIEW_FILL ) {
+                GdkRectangle otherArea = {possible.x + ((possible.width / 4) - (area.width / 2)),
+                                          area.y,
+                                          area.width, area.height};
+                if ( otherArea.height < possible.height ) {
+                    otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
                 }
-                preview->_scaled = gdk_pixbuf_scale_simple(preview->_previewPixbuf, w, h, GDK_INTERP_BILINEAR);
-                preview->_scaledW = w;
-                preview->_scaledH = h;
+                gtk_paint_check( style,
+                                 widget->window,
+                                 GTK_STATE_SELECTED/* (GtkStateType)widget->state*/,
+                                 GTK_SHADOW_ETCHED_OUT,
+                                 NULL,
+                                 widget,
+                                 NULL,
+                                 otherArea.x, otherArea.y,
+                                 otherArea.width, otherArea.height );
             }
 
-            GdkPixbuf* pix = (preview->_scaled) ? preview->_scaled : preview->_previewPixbuf;
-            gdk_draw_pixbuf( drawable, 0, pix, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0 );
+            if ( preview->_linked & PREVIEW_STROKE ) {
+                GdkRectangle otherArea = {possible.x + (((possible.width * 3) / 4) - (area.width / 2)),
+                                          area.y,
+                                          area.width, area.height};
+                if ( otherArea.height < possible.height ) {
+                    otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
+                }
+                gtk_paint_diamond( style,
+                                   widget->window,
+                                   GTK_STATE_SELECTED/* (GtkStateType)widget->state*/,
+                                   GTK_SHADOW_ETCHED_OUT,
+                                   NULL,
+                                   widget,
+                                   NULL,
+                                   otherArea.x, otherArea.y,
+                                   otherArea.width, otherArea.height );
+            }
         }
 
 
index 6eb5c8930cd8e4fe8906eec408ffe8815c1876b6..86481e5481b08d3e1b9d097ba6e8b9202afba903 100644 (file)
@@ -83,7 +83,9 @@ typedef enum {
   PREVIEW_LINK_IN = 1,
   PREVIEW_LINK_OUT = 2,
   PREVIEW_LINK_OTHER = 4,
-  PREVIEW_LINK_ALL = 7
+  PREVIEW_FILL = 8,
+  PREVIEW_STROKE = 16,
+  PREVIEW_LINK_ALL = 31
 } LinkType;
 
 typedef struct _EekPreview       EekPreview;