gtk-css-engine r120 - in trunk: . libccd/ccd themes/Gilouche-CSS/gtk-2.0 themes/gtk-css-test/gtk-2.0
- From: robsta svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk-css-engine r120 - in trunk: . libccd/ccd themes/Gilouche-CSS/gtk-2.0 themes/gtk-css-test/gtk-2.0
- Date: Mon, 22 Sep 2008 15:53:14 +0000 (UTC)
Author: robsta
Date: Mon Sep 22 15:53:14 2008
New Revision: 120
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=120&view=rev
Log:
* libccd/ccd/ccd-background.c:
* libccd/ccd/ccd-position.c:
* libccd/ccd/ccd-position.h:
Fix `background-position' issues.
* themes/Gilouche-CSS/gtk-2.0/styles.css:
Fix theme now that we mostly adhere to CSS background image defaults.
Modified:
trunk/ (props changed)
trunk/ChangeLog
trunk/libccd/ccd/ccd-background.c
trunk/libccd/ccd/ccd-position.c
trunk/libccd/ccd/ccd-position.h
trunk/themes/Gilouche-CSS/gtk-2.0/styles.css
trunk/themes/gtk-css-test/gtk-2.0/styles.css
Modified: trunk/libccd/ccd/ccd-background.c
==============================================================================
--- trunk/libccd/ccd/ccd-background.c (original)
+++ trunk/libccd/ccd/ccd-background.c Mon Sep 22 15:53:14 2008
@@ -461,21 +461,19 @@
double xoff;
double yoff;
- tile_width = ccd_position_get_horizontal (&bg_size->width,
- width, height,
- bg_image->image.width,
- bg_image->image.height);
- tile_height = ccd_position_get_vertical (&bg_size->height,
- width, height,
- bg_image->image.width,
- bg_image->image.height);
-
- xoff = ccd_position_get_horizontal (&bg_position->hpos,
- width, height,
- tile_width, tile_height);
- yoff = ccd_position_get_vertical (&bg_position->vpos,
- width, height,
- tile_width, tile_height);
+ tile_width = ccd_position_get_hsize (&bg_size->width,
+ width, height,
+ bg_image->image.width,
+ bg_image->image.height);
+ tile_height = ccd_position_get_vsize (&bg_size->height,
+ width, height,
+ bg_image->image.width,
+ bg_image->image.height);
+
+ xoff = ccd_position_get_pos (&bg_position->hpos,
+ width, tile_width);
+ yoff = ccd_position_get_pos (&bg_position->vpos,
+ height, tile_height);
dx = tile_width / bg_image->image.width;
dy = tile_height / bg_image->image.height;
Modified: trunk/libccd/ccd/ccd-position.c
==============================================================================
--- trunk/libccd/ccd/ccd-position.c (original)
+++ trunk/libccd/ccd/ccd-position.c Mon Sep 22 15:53:14 2008
@@ -55,11 +55,11 @@
if (_position_map[i].percentage > -1) {
self->type = CCD_POSITION_PERCENTAGE;
self->value = _position_map[i].percentage;
- *values = (*values)->next;
} else {
self->type = _position_map[i].type;
self->value = -1;
}
+ *values = (*values)->next;
return true;
}
}
@@ -90,6 +90,28 @@
return false;
}
+double
+ccd_position_get_pos (ccd_position_t const *self,
+ double extent,
+ double size)
+{
+ switch (self->type) {
+ case CCD_POSITION_LENGTH:
+ return self->value;
+ case CCD_POSITION_PERCENTAGE:
+ return self->value / 100. * (extent - size);
+ case CCD_POSITION_CONTAIN:
+ case CCD_POSITION_COVER:
+ case CCD_POSITION_AUTO:
+ default:
+ g_assert_not_reached ();
+ /* Need some code here when building w/o assertions. */
+ return 0;
+ }
+
+ return 0;
+}
+
static void
contain (double extent_x,
double extent_y,
@@ -131,11 +153,11 @@
}
double
-ccd_position_get_horizontal (ccd_position_t const *self,
- double extent_x,
- double extent_y,
- double width,
- double height)
+ccd_position_get_hsize (ccd_position_t const *self,
+ double extent_x,
+ double extent_y,
+ double width,
+ double height)
{
double x;
double y;
@@ -144,7 +166,7 @@
case CCD_POSITION_LENGTH:
return self->value;
case CCD_POSITION_PERCENTAGE:
- return (self->value * extent_x / 100.) - (width / 2.);
+ return self->value * extent_x / 100.;
case CCD_POSITION_CONTAIN:
contain (extent_x, extent_y, width, height, &x, &y);
return x;
@@ -163,11 +185,11 @@
}
double
-ccd_position_get_vertical (ccd_position_t const *self,
- double extent_x,
- double extent_y,
- double width,
- double height)
+ccd_position_get_vsize (ccd_position_t const *self,
+ double extent_x,
+ double extent_y,
+ double width,
+ double height)
{
double x;
double y;
@@ -176,7 +198,7 @@
case CCD_POSITION_LENGTH:
return self->value;
case CCD_POSITION_PERCENTAGE:
- return (self->value * extent_y / 100.) - (height / 2.);
+ return self->value * extent_y / 100.;
case CCD_POSITION_CONTAIN:
contain (extent_x, extent_y, width, height, &x, &y);
return y;
Modified: trunk/libccd/ccd/ccd-position.h
==============================================================================
--- trunk/libccd/ccd/ccd-position.h (original)
+++ trunk/libccd/ccd/ccd-position.h Mon Sep 22 15:53:14 2008
@@ -67,13 +67,20 @@
bool ccd_position_parse (ccd_position_t *self, uint32_t flags,
CRTerm const **value);
-double ccd_position_get_horizontal (ccd_position_t const *self,
- double extent_x, double extent_y,
- double width, double height);
-
-double ccd_position_get_vertical (ccd_position_t const *self,
- double extent_x, double extent_y,
- double width, double height);
+double ccd_position_get_pos (ccd_position_t const *self,
+ double extent, double size);
+
+double ccd_position_get_vpos (ccd_position_t const *self,
+ double extent_x, double extent_y,
+ double width, double height);
+
+double ccd_position_get_hsize (ccd_position_t const *self,
+ double extent_x, double extent_y,
+ double width, double height);
+
+double ccd_position_get_vsize (ccd_position_t const *self,
+ double extent_x, double extent_y,
+ double width, double height);
#ifdef CCD_DEBUG
void ccd_position_dump (ccd_position_t const *self);
Modified: trunk/themes/Gilouche-CSS/gtk-2.0/styles.css
==============================================================================
--- trunk/themes/Gilouche-CSS/gtk-2.0/styles.css (original)
+++ trunk/themes/Gilouche-CSS/gtk-2.0/styles.css Mon Sep 22 15:53:14 2008
@@ -1,6 +1,6 @@
/* The whole shebang inside the window */
* {
-background-color: #fbf8f1;
+ background-color: #fbf8f1;
}
/* buttons */
@@ -9,20 +9,23 @@
box.button, box.optionmenu {
border: 1px solid #a99975;
background-image: url(button-back.png);
+ background-size: 100% 100%;
}
/* Checkboxes */
check {
-background-image: url(check.png);
+ background-image: url(check.png);
+ background-position: center;
+ background-repeat: no-repeat;
}
check:insensitive {
-background-image: url(check-inactive.png);
+ background-image: url(check-inactive.png);
}
check[shadow=in] {
-background-image: url(check-selected.png);
+ background-image: url(check-selected.png);
}
check:insensitive[shadow=in] {
@@ -31,22 +34,30 @@
/* radiobuttons */
option {
-background-image: url(radiobutton.png);
+ background-image: url(radiobutton.png);
+ background-position: center;
+ background-repeat: no-repeat;
}
option:insensitive {
-background-image: url(radiobutton-inactive.png);
+ background-image: url(radiobutton-inactive.png);
}
option[shadow=in] {
-background-image: url(radiobutton-selected.png);
+ background-image: url(radiobutton-selected.png);
}
option:insensitive[shadow=in] {
-background-image: url(radiobutton-inactive-selected.png);
+ background-image: url(radiobutton-inactive-selected.png);
}
/* arrows */
+arrow {
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: 100% 100%;
+}
+
arrow[orientation=up] {
background-image: url(arrow-up.svg);
}
@@ -77,6 +88,9 @@
GtkProgressBar box.bar {
background: #587ba1 url(progressbar.png);
+ /* TODO Rob: need extended property comparison to implement
+ * special-casing of horizontal/vertical progree bars, see TODO. */
+ /* background-size: 100% 100%; */
border: 1px solid #000;
}
@@ -100,11 +114,15 @@
/*the background of the slider*/
GtkHScale box.trough {
-background-image: url(scale-background.png);
+ background-image: url(scale-background.png);
+ background-position: center;
+ background-repeat: repeat-x;
}
GtkVScale box.trough {
-background-image: url(scale-background-vertical.png);
+ background-image: url(scale-background-vertical.png);
+ background-position: center;
+ background-repeat: repeat-y;
}
@@ -121,21 +139,29 @@
extension[gap=bottom]:normal {
border: 1px solid #a28f62;
background-image: url(tab-back.png);
+ background-position: left top;
+ background-repeat: repeat-x;
}
extension[gap=left]:normal {
border: 1px solid #a28f62;
background-image: url(tab-back-right.png);
+ background-position: right top;
+ background-repeat: repeat-y;
}
extension[gap=top]:normal {
border: 1px solid #a28f62;
background-image: url(tab-back-down.png);
+ background-position: left bottom;
+ background-repeat: repeat-x;
}
extension[gap=right]:normal {
border: 1px solid #a28f62;
background-image: url(tab-back-left.png);
+ background-position: left top;
+ background-repeat: repeat-y;
}
/* frame around scrolled window*/
@@ -151,18 +177,24 @@
/* window slider sliders...uh*/
slider[orientation=vertical] {
-background-image: url(slider-background.png);
-border: 1px solid #587ba1;
+ background-image: url(slider-background.png);
+ background-repeat: repeat-y;
+ background-size: 100% auto;
+ border: 1px solid #587ba1;
}
slider[orientation=horizontal] {
-background-image: url(slider-background-horizontal.png);
+ background-image: url(slider-background-horizontal.png);
+ background-repeat: repeat-x;
+ background-size: 100% auto;
+ border: 1px solid #587ba1;
}
/* the buttons on the scrolled window sliders */
box.hscrollbar, box.vscrollbar {
-background-image: url(button-back.png);
-border: 1px solid #a19373;
+ background-image: url(button-back.png);
+ background-size: 100% 100%;
+ border: 1px solid #a19373;
}
/* spinbuttons */
@@ -172,6 +204,8 @@
resizegrip.statusbar {
background-image: url(resizegrip.png);
+ background-position: right bottom;
+ background-repeat: no-repeat;
}
GtkEntry {
Modified: trunk/themes/gtk-css-test/gtk-2.0/styles.css
==============================================================================
--- trunk/themes/gtk-css-test/gtk-2.0/styles.css (original)
+++ trunk/themes/gtk-css-test/gtk-2.0/styles.css Mon Sep 22 15:53:14 2008
@@ -119,18 +119,25 @@
border-radius: 60;
}
-box[gap=top] {/*
+extension[gap=left]:normal {
+ border: 1px solid #a28f62;
+ background-image: url(tab-back-right.png);
+ background-repeat: repeat-y;
+ background-position: right top;
+}
+
+box[gap=top] {
background-image: url(foo.png);
- background-repeat: repeat;
- background-size: 16 16;
-*/}
+ background-position: right top;
+ background-repeat: no-repeat;
+}
-box[gap=bottom] {
+box[gap=bottom] {/*
background-image: url(foo.png);
- background-repeat: repeat-x;
+ background-repeat: no-repeat;
background-position: center;
- background-size: cover;
-}
+ background-size: contain;
+*/}
box[gap=left] {/*
background-image: url(foo.png);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]