This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  601f42c64141cd58cd1f5987fa9464ebb4f68313 (commit)
      from  fc5a262f939cbac80e0f3a38bbe8936450e6c90a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/601f42c64141cd58cd1f5987fa9464ebb4f68313

commit 601f42c64141cd58cd1f5987fa9464ebb4f68313
Author: David Maciejak <[email protected]>
Date:   Sun Sep 7 10:47:21 2014 +0800

    WPrefs: set default to 1st color in gradient texture
    
    This patch is updating the gradient texture user experience
    by auto selecting the first color in the list when possible
    and fixing the autoselection after a delete action.
    
    In fact what that is called gradient colors is just a list of colors
    with hue/saturation/brightness value.
    That patch is loading the first one from the list (color, hue,
    saturation, brightness) and setting the 3 sliders according to that
    value instead of using some default hardcoded values.
    The default color value on the top-right is never modified.

diff --git a/WPrefs.app/TexturePanel.c b/WPrefs.app/TexturePanel.c
index 58e9eccc..f12f6e98 100644
--- a/WPrefs.app/TexturePanel.c
+++ b/WPrefs.app/TexturePanel.c
@@ -357,10 +357,9 @@ static void sliderChangeCallback(WMWidget * w, void *data)
 {
        TexturePanel *panel = (TexturePanel *) data;
        RHSVColor hsv;
-       int row, rows;
+       int i, row, rows;
        WMListItem *item;
        RColor **colors;
-       int i;
        RImage *image;
        WMScreen *scr = WMWidgetScreen(w);
 
@@ -368,7 +367,20 @@ static void sliderChangeCallback(WMWidget * w, void *data)
        hsv.saturation = WMGetSliderValue(panel->gsatS);
        hsv.value = WMGetSliderValue(panel->gvalS);
 
+       rows = WMGetListNumberOfRows(panel->gcolL);
        row = WMGetListSelectedItemRow(panel->gcolL);
+
+       if (row < 0 && rows > 0) {
+               row = 0;
+               WMSelectListItem(panel->gcolL, row);
+               item = WMGetListItem(panel->gcolL, row);
+               RRGBtoHSV((RColor *) item->clientData, &hsv);
+
+               WMSetSliderValue(panel->ghueS, hsv.hue);
+               WMSetSliderValue(panel->gsatS, hsv.saturation);
+               WMSetSliderValue(panel->gvalS, hsv.value);
+       }
+
        if (row >= 0) {
                RColor *rgb;
 
@@ -382,6 +394,7 @@ static void sliderChangeCallback(WMWidget * w, void *data)
        }
 
        if (w == panel->ghueS) {
+               updateHueSlider(panel->ghueS, panel->listFont, &hsv);
                updateSVSlider(panel->gsatS, True, panel->listFont, &hsv);
                updateSVSlider(panel->gvalS, False, panel->listFont, &hsv);
        } else if (w == panel->gsatS) {
@@ -392,7 +405,6 @@ static void sliderChangeCallback(WMWidget * w, void *data)
                updateSVSlider(panel->gsatS, True, panel->listFont, &hsv);
        }
 
-       rows = WMGetListNumberOfRows(panel->gcolL);
        if (rows == 0)
                return;
 
@@ -503,7 +515,7 @@ static void gradDeleteCallback(WMWidget * w, void *data)
 {
        TexturePanel *panel = (TexturePanel *) data;
        WMListItem *item;
-       int row;
+       int row, rows;
 
        /* Parameter not used, but tell the compiler that it is ok */
        (void) w;
@@ -516,9 +528,14 @@ static void gradDeleteCallback(WMWidget * w, void *data)
        wfree(item->clientData);
 
        WMRemoveListItem(panel->gcolL, row);
+       if (row > 0)
+               WMSelectListItem(panel->gcolL, row - 1);
+       else {
+               rows = WMGetListNumberOfRows(panel->gcolL);
+               if (rows > 0)
+                       WMSelectListItem(panel->gcolL, 0);
 
-       WMSelectListItem(panel->gcolL, row - 1);
-
+       }
        updateGradButtons(panel);
 
        gradClickCallback(panel->gcolL, panel);

-----------------------------------------------------------------------

Summary of changes:
 WPrefs.app/TexturePanel.c |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)


repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


-- 
To unsubscribe, send mail to [email protected].

Reply via email to