Convert colors to GdkRGBA
This commit is contained in:
committed by
Stéphane Lesimple
parent
6c88a55600
commit
d66ee15738
106
src/closure.c
106
src/closure.c
@@ -100,12 +100,12 @@ int isWithinAppBundle(const char *filePath) {
|
||||
* Update color string for the <span color="#f00baa">...</span> string
|
||||
*/
|
||||
|
||||
void GuiUpdateMarkup(char **string, GdkColor *color)
|
||||
void GuiUpdateMarkup(char **string, GdkRGBA *color)
|
||||
{ int hexval;
|
||||
|
||||
hexval = (color->red << 8) & 0xff0000;
|
||||
hexval |= color->green & 0xff00;
|
||||
hexval |= (color->blue >> 8) & 0xff;
|
||||
hexval = (int)(color->red * 255.0 + 0.5) << 16;
|
||||
hexval |= (int)(color->green * 255.0 + 0.5) << 8;
|
||||
hexval |= (int)(color->blue * 255.0 + 0.5);
|
||||
|
||||
if(*string) g_free(*string);
|
||||
*string = g_strdup_printf("color=\"#%06x\"", hexval);
|
||||
@@ -117,55 +117,23 @@ void GuiUpdateMarkup(char **string, GdkColor *color)
|
||||
|
||||
void GuiDefaultColors()
|
||||
{
|
||||
Closure->redText->red = 0xffff;
|
||||
Closure->redText->green = 0;
|
||||
Closure->redText->blue = 0;
|
||||
|
||||
Closure->greenText->red = 0;
|
||||
Closure->greenText->green = 0x8000;
|
||||
Closure->greenText->blue = 0;
|
||||
|
||||
Closure->barColor->red = 0xffff;
|
||||
Closure->barColor->green = 0;
|
||||
Closure->barColor->blue = 0;
|
||||
|
||||
Closure->logColor->red = 0xffff;
|
||||
Closure->logColor->green = 0;
|
||||
Closure->logColor->blue = 0xffff;
|
||||
|
||||
Closure->curveColor->red = 0;
|
||||
Closure->curveColor->green = 0;
|
||||
Closure->curveColor->blue = 0xffff;
|
||||
|
||||
Closure->redSector->red = 0xffff;
|
||||
Closure->redSector->green = 0;
|
||||
Closure->redSector->blue = 0;
|
||||
|
||||
Closure->yellowSector->red = 0xffff;
|
||||
Closure->yellowSector->green = 0xc000;
|
||||
Closure->yellowSector->blue = 0;
|
||||
|
||||
Closure->greenSector->red = 0;
|
||||
Closure->greenSector->green = 0xdb00;
|
||||
Closure->greenSector->blue = 0;
|
||||
|
||||
Closure->darkSector->red = 0;
|
||||
Closure->darkSector->green = 0x8000;
|
||||
Closure->darkSector->blue = 0;
|
||||
|
||||
Closure->blueSector->red = 0;
|
||||
Closure->blueSector->green = 0;
|
||||
Closure->blueSector->blue = 0xffff;
|
||||
|
||||
Closure->whiteSector->red = 0xffff;
|
||||
Closure->whiteSector->green = 0xffff;
|
||||
Closure->whiteSector->blue = 0xffff;
|
||||
*Closure->redText = (GdkRGBA){1.0, 0.0, 0.0, 1.0};
|
||||
*Closure->greenText = (GdkRGBA){0.0, 0.5, 0.0, 1.0};
|
||||
*Closure->barColor = (GdkRGBA){1.0, 0.0, 0.0, 1.0};
|
||||
*Closure->logColor = (GdkRGBA){1.0, 0.0, 1.0, 1.0};
|
||||
*Closure->curveColor = (GdkRGBA){0.0, 0.0, 1.0, 1.0};
|
||||
*Closure->redSector = (GdkRGBA){1.0, 0.0, 0.0, 1.0};
|
||||
*Closure->yellowSector = (GdkRGBA){1.0, 0.75, 0.0, 1.0};
|
||||
*Closure->greenSector = (GdkRGBA){0.0, 0.86, 0.0, 1.0};
|
||||
*Closure->darkSector = (GdkRGBA){0.0, 0.5, 0.0, 1.0};
|
||||
*Closure->curveColor = (GdkRGBA){0.0, 0.0, 1.0, 1.0};
|
||||
*Closure->whiteSector = (GdkRGBA){1.0, 1.0, 1.0, 1.0};
|
||||
|
||||
GuiUpdateMarkup(&Closure->redMarkup, Closure->redText);
|
||||
GuiUpdateMarkup(&Closure->greenMarkup, Closure->greenText);
|
||||
}
|
||||
|
||||
static void save_colors(FILE *dotfile, char *symbol, GdkColor *color)
|
||||
static void save_colors(FILE *dotfile, char *symbol, GdkRGBA *color)
|
||||
{ char *blanks=" ";
|
||||
char *pad;
|
||||
int len=strlen(symbol);
|
||||
@@ -174,15 +142,17 @@ static void save_colors(FILE *dotfile, char *symbol, GdkColor *color)
|
||||
else pad=blanks+len;
|
||||
|
||||
fprintf(dotfile, "%s:%s%02x%02x%02x\n", symbol, pad,
|
||||
color->red>>8, color->green>>8, color->blue>>8);
|
||||
(int)(color->red * 255.0 + 0.5),
|
||||
(int)(color->green * 255.0 + 0.5),
|
||||
(int)(color->blue * 255.0 + 0.5));
|
||||
}
|
||||
|
||||
static void get_color(GdkColor *color, char *value)
|
||||
static void get_color(GdkRGBA *color, char *value)
|
||||
{ unsigned int hex = strtol(value, NULL, 16);
|
||||
|
||||
color->red = (hex>>8)&0xff00;
|
||||
color->green = hex&0xff00;
|
||||
color->blue = (hex<<8)&0xff00;
|
||||
color->red = (double)(hex >> 16) / 255.0;
|
||||
color->green = (double)((hex >> 8) & 0xff) / 255.0;
|
||||
color->blue = (double)(hex & 0xff) / 255.0;
|
||||
color->alpha = 1.0;
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -612,21 +582,21 @@ void InitClosure()
|
||||
g_mutex_init(Closure->logLock);
|
||||
|
||||
#ifdef WITH_GUI_YES
|
||||
Closure->background = g_malloc0(sizeof(GdkColor));
|
||||
Closure->foreground = g_malloc0(sizeof(GdkColor));
|
||||
Closure->grid = g_malloc0(sizeof(GdkColor));
|
||||
Closure->background = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->foreground = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->grid = g_malloc0(sizeof(GdkRGBA));
|
||||
|
||||
Closure->redText = g_malloc0(sizeof(GdkColor));
|
||||
Closure->greenText = g_malloc0(sizeof(GdkColor));
|
||||
Closure->barColor = g_malloc0(sizeof(GdkColor));
|
||||
Closure->logColor = g_malloc0(sizeof(GdkColor));
|
||||
Closure->curveColor = g_malloc0(sizeof(GdkColor));
|
||||
Closure->redSector = g_malloc0(sizeof(GdkColor));
|
||||
Closure->yellowSector= g_malloc0(sizeof(GdkColor));
|
||||
Closure->greenSector = g_malloc0(sizeof(GdkColor));
|
||||
Closure->blueSector = g_malloc0(sizeof(GdkColor));
|
||||
Closure->whiteSector = g_malloc0(sizeof(GdkColor));
|
||||
Closure->darkSector = g_malloc0(sizeof(GdkColor));
|
||||
Closure->redText = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->greenText = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->barColor = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->logColor = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->curveColor = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->redSector = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->yellowSector= g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->greenSector = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->blueSector = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->whiteSector = g_malloc0(sizeof(GdkRGBA));
|
||||
Closure->darkSector = g_malloc0(sizeof(GdkRGBA));
|
||||
|
||||
GuiDefaultColors();
|
||||
#endif /* WITH_GUI_YES */
|
||||
|
||||
40
src/curve.c
40
src/curve.c
@@ -184,7 +184,7 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
{ int val;
|
||||
char buf[16];
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->logColor);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->logColor);
|
||||
GuiSetText(curve->layout, curve->leftLogLabel, &w, &h);
|
||||
|
||||
x = curve->leftX - w/2;
|
||||
@@ -197,21 +197,21 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
{ y = GuiCurveLogY(curve, val);
|
||||
sprintf(buf,"%d",val);
|
||||
GuiSetText(curve->layout, buf, &w, &h);
|
||||
gdk_cairo_set_source_color(cr, Closure->logColor);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->logColor);
|
||||
cairo_move_to(cr, curve->leftX-9-w, y-h/2);
|
||||
pango_cairo_show_layout(cr, curve->layout);
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
cairo_move_to(cr, curve->leftX-6 + 0.5, y + 0.5);
|
||||
cairo_line_to(cr, curve->leftX + 0.5, y + 0.5);
|
||||
cairo_stroke(cr);
|
||||
gdk_cairo_set_source_color(cr, Closure->grid);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->grid);
|
||||
cairo_move_to(cr, curve->leftX + 0.5, y + 0.5);
|
||||
cairo_line_to(cr, curve->rightX + 0.5, y + 0.5);
|
||||
cairo_stroke(cr);
|
||||
|
||||
val /=2;
|
||||
y = GuiCurveLogY(curve, val);
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
cairo_move_to(cr, curve->leftX-3 + 0.5, y + 0.5);
|
||||
cairo_line_to(cr, curve->leftX + 0.5, y + 0.5);
|
||||
cairo_stroke(cr);
|
||||
@@ -219,7 +219,7 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
if(curve->bottomLY-curve->topLY > 8*h)
|
||||
{ sprintf(buf,"%d",val);
|
||||
GuiSetText(curve->layout, buf, &w, &h);
|
||||
gdk_cairo_set_source_color(cr, Closure->logColor);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->logColor);
|
||||
cairo_move_to(cr, curve->leftX-9-w, y-h/2);
|
||||
pango_cairo_show_layout(cr, curve->layout);
|
||||
}
|
||||
@@ -240,20 +240,20 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
GuiSetText(curve->layout, buf, &w, &h);
|
||||
|
||||
y = yg = GuiCurveY(curve, i);
|
||||
gdk_cairo_set_source_color(cr, Closure->curveColor);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->curveColor);
|
||||
cairo_move_to(cr, curve->leftX-9-w, y-h/2);
|
||||
pango_cairo_show_layout(cr, curve->layout);
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
cairo_move_to(cr, curve->leftX-6 + 0.5, y + 0.5);
|
||||
cairo_line_to(cr, curve->leftX + 0.5, y + 0.5);
|
||||
cairo_stroke(cr);
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->grid);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->grid);
|
||||
cairo_move_to(cr, curve->leftX + 0.5, y + 0.5);
|
||||
cairo_line_to(cr, curve->rightX + 0.5, y + 0.5);
|
||||
cairo_stroke(cr);
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
y = GuiCurveY(curve, i+step/2);
|
||||
if(y >= curve->topY) {
|
||||
cairo_move_to(cr, curve->leftX-3 + 0.5, y + 0.5);
|
||||
@@ -264,7 +264,7 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
|
||||
|
||||
/* Draw and label the left coordinate axis */
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
|
||||
cairo_move_to(cr, curve->leftX + 0.5, curve->topY + 0.5);
|
||||
cairo_line_to(cr, curve->leftX + 0.5, curve->bottomY + 0.5);
|
||||
@@ -276,7 +276,7 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
cairo_stroke(cr);
|
||||
}
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->curveColor);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->curveColor);
|
||||
GuiSetText(curve->layout, curve->leftLabel, &w, &h);
|
||||
x = curve->leftX - w/2;
|
||||
if(x < 5) x = 5;
|
||||
@@ -285,7 +285,7 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
|
||||
/* Draw the right coordinate axis */
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
|
||||
cairo_move_to(cr, curve->rightX + 0.5, curve->topY + 0.5);
|
||||
cairo_line_to(cr, curve->rightX + 0.5, curve->bottomY + 0.5);
|
||||
@@ -299,7 +299,7 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
|
||||
/* Draw and label the bottom coordinate axis */
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
|
||||
cairo_move_to(cr, curve->leftX + 0.5, curve->bottomY + 0.5);
|
||||
cairo_line_to(cr, curve->rightX + 0.5, curve->bottomY + 0.5);
|
||||
@@ -344,7 +344,7 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
pango_cairo_show_layout(cr, curve->layout);
|
||||
|
||||
if(i && x < curve->rightX)
|
||||
{ gdk_cairo_set_source_color(cr, Closure->grid);
|
||||
{ gdk_cairo_set_source_rgba(cr, Closure->grid);
|
||||
cairo_move_to(cr, x + 0.5, curve->bottomY-1 + 0.5);
|
||||
cairo_line_to(cr, x + 0.5, yg + 0.5);
|
||||
cairo_stroke(cr);
|
||||
@@ -356,7 +356,7 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
}
|
||||
}
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
x = GuiCurveLX(curve,i+step/2)-1;
|
||||
if(x < curve->rightX) {
|
||||
cairo_move_to(cr, x + 0.5, bottom_y+3 + 0.5);
|
||||
@@ -373,13 +373,13 @@ void GuiRedrawAxes(cairo_t *cr, Curve *curve)
|
||||
void GuiRedrawCurve(cairo_t *cr, Curve *curve, int last)
|
||||
{ int i,x0,x1,fy0;
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->curveColor);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->curveColor);
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
|
||||
/* Draw integer bar curve */
|
||||
|
||||
if(curve->enable & DRAW_ICURVE)
|
||||
{ gdk_cairo_set_source_color(cr, Closure->barColor);
|
||||
{ gdk_cairo_set_source_rgba(cr, Closure->barColor);
|
||||
x0 = GuiCurveX(curve, 0);
|
||||
for(i=1; i<=last; i++)
|
||||
{ x1 = GuiCurveX(curve, i);
|
||||
@@ -397,7 +397,7 @@ void GuiRedrawCurve(cairo_t *cr, Curve *curve, int last)
|
||||
if(curve->enable & DRAW_LCURVE)
|
||||
{ x0 = GuiCurveX(curve, 0);
|
||||
for(i=1; i<=last; i++)
|
||||
{ gdk_cairo_set_source_color(cr, Closure->logColor);
|
||||
{ gdk_cairo_set_source_rgba(cr, Closure->logColor);
|
||||
x1 = GuiCurveX(curve, i);
|
||||
int iy = GuiCurveLogY(curve, curve->lvalue[i]);
|
||||
|
||||
@@ -414,7 +414,7 @@ void GuiRedrawCurve(cairo_t *cr, Curve *curve, int last)
|
||||
if(curve->enable & DRAW_FCURVE)
|
||||
{ x0 = GuiCurveX(curve, 0);
|
||||
fy0 = GuiCurveY(curve, curve->fvalue[0]);
|
||||
gdk_cairo_set_source_color(cr, Closure->curveColor);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->curveColor);
|
||||
cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
|
||||
cairo_move_to(cr, x0, fy0);
|
||||
for(i=1; i<=last; i++)
|
||||
|
||||
@@ -91,7 +91,7 @@ typedef void GtkTooltip;
|
||||
typedef void GtkWidget;
|
||||
typedef void GtkWindow;
|
||||
|
||||
typedef void GdkColor;
|
||||
typedef void GdkRGBA;
|
||||
typedef void GdkDrawable;
|
||||
typedef void GdkGC;
|
||||
typedef void GdkPixbuf;
|
||||
@@ -394,20 +394,20 @@ typedef struct _GlobalClosure
|
||||
/*** Common stuff for drawing curves and spirals */
|
||||
|
||||
gboolean colors_initialized;
|
||||
GdkColor *background,*foreground,*grid;
|
||||
GdkColor *redText;
|
||||
GdkRGBA *background,*foreground,*grid;
|
||||
GdkRGBA *redText;
|
||||
char *redMarkup;
|
||||
GdkColor *greenText;
|
||||
GdkRGBA *greenText;
|
||||
char *greenMarkup;
|
||||
GdkColor *barColor;
|
||||
GdkColor *logColor;
|
||||
GdkColor *curveColor;
|
||||
GdkColor *redSector;
|
||||
GdkColor *yellowSector;
|
||||
GdkColor *greenSector;
|
||||
GdkColor *blueSector;
|
||||
GdkColor *whiteSector;
|
||||
GdkColor *darkSector;
|
||||
GdkRGBA *barColor;
|
||||
GdkRGBA *logColor;
|
||||
GdkRGBA *curveColor;
|
||||
GdkRGBA *redSector;
|
||||
GdkRGBA *yellowSector;
|
||||
GdkRGBA *greenSector;
|
||||
GdkRGBA *blueSector;
|
||||
GdkRGBA *whiteSector;
|
||||
GdkRGBA *darkSector;
|
||||
char *invisibleDash;
|
||||
|
||||
/*** Widgets for the linear reading/scanning action */
|
||||
@@ -575,7 +575,7 @@ int VerifySignature(void);
|
||||
#ifdef WITH_GUI_YES
|
||||
void GuiDefaultColors(void);
|
||||
void GuiReadDotfile(void);
|
||||
void GuiUpdateMarkup(char**, GdkColor*);
|
||||
void GuiUpdateMarkup(char**, GdkRGBA*);
|
||||
#endif
|
||||
|
||||
/***
|
||||
@@ -1338,11 +1338,11 @@ void ReadMediumAdaptive(gpointer);
|
||||
|
||||
#ifdef WITH_GUI_YES
|
||||
void GuiClipReadAdaptiveSpiral(int);
|
||||
void GuiChangeSegmentColor(GdkColor*, int);
|
||||
void GuiChangeSegmentColor(GdkRGBA*, int);
|
||||
void GuiRemoveFillMarkers();
|
||||
|
||||
void GuiSetAdaptiveReadSubtitle(char*);
|
||||
void GuiSetAdaptiveReadFootline(char*, GdkColor*);
|
||||
void GuiSetAdaptiveReadFootline(char*, GdkRGBA*);
|
||||
void GuiSetAdaptiveReadMinimumPercentage(int);
|
||||
void GuiUpdateAdaptiveResults(gint64, gint64, gint64, int);
|
||||
|
||||
@@ -1528,8 +1528,8 @@ typedef struct _Spiral
|
||||
int segmentSize;
|
||||
int segmentCount;
|
||||
double *segmentPos;
|
||||
GdkColor **segmentColor;
|
||||
GdkColor **segmentOutline;
|
||||
GdkRGBA **segmentColor;
|
||||
GdkRGBA **segmentOutline;
|
||||
int diameter;
|
||||
int segmentClipping;
|
||||
int cursorPos;
|
||||
@@ -1537,16 +1537,16 @@ typedef struct _Spiral
|
||||
} Spiral;
|
||||
|
||||
#ifdef WITH_GUI_YES
|
||||
Spiral* GuiCreateSpiral(GdkColor*, GdkColor*, int, int, int);
|
||||
Spiral* GuiCreateSpiral(GdkRGBA*, GdkRGBA*, int, int, int);
|
||||
void GuiSetSpiralWidget(Spiral*, GtkWidget*);
|
||||
void GuiFreeSpiral(Spiral*);
|
||||
|
||||
void GuiFillSpiral(Spiral*, GdkColor*);
|
||||
void GuiFillSpiral(Spiral*, GdkRGBA*);
|
||||
void GuiDrawSpiral(cairo_t *cr, Spiral*);
|
||||
void GuiDrawSpiralLabel(cairo_t *cr, Spiral*, PangoLayout*, char*, GdkColor*, int, int);
|
||||
void GuiDrawSpiralLabel(cairo_t *cr, Spiral*, PangoLayout*, char*, GdkRGBA*, int, int);
|
||||
void GuiChangeSpiralCursor(Spiral*, int);
|
||||
void GuiMoveSpiralCursor(Spiral*, int);
|
||||
void GuiSetSpiralSegmentColor(Spiral*, GdkColor*, GdkColor*, int);
|
||||
void GuiSetSpiralSegmentColor(Spiral*, GdkRGBA*, GdkRGBA*, int);
|
||||
#else
|
||||
#define GuiChangeSpiralCursor(a, b)
|
||||
#define GuiFreeSpiral(s)
|
||||
|
||||
@@ -664,43 +664,43 @@ static void read_range_cb(GtkWidget *widget, gpointer data)
|
||||
static void update_color_buttons()
|
||||
{ prefs_context *pc = (prefs_context*)Closure->prefsContext;
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->redA), Closure->redSector);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->redB), Closure->redSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->redA), Closure->redSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->redB), Closure->redSector);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->yellowA), Closure->yellowSector);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->yellowB), Closure->yellowSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->yellowA), Closure->yellowSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->yellowB), Closure->yellowSector);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->greenA), Closure->greenSector);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->greenB), Closure->greenSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->greenA), Closure->greenSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->greenB), Closure->greenSector);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->blueA), Closure->blueSector);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->blueB), Closure->blueSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->blueA), Closure->blueSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->blueB), Closure->blueSector);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->whiteA), Closure->whiteSector);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->whiteB), Closure->whiteSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->whiteA), Closure->whiteSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->whiteB), Closure->whiteSector);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->darkA), Closure->darkSector);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->darkB), Closure->darkSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->darkA), Closure->darkSector);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->darkB), Closure->darkSector);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->redTextA), Closure->redText);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->redTextB), Closure->redText);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->redTextA), Closure->redText);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->redTextB), Closure->redText);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->greenTextA), Closure->greenText);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->greenTextB), Closure->greenText);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->greenTextA), Closure->greenText);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->greenTextB), Closure->greenText);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->barColorA), Closure->barColor);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->barColorB), Closure->barColor);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->barColorA), Closure->barColor);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->barColorB), Closure->barColor);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->logColorA), Closure->logColor);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->logColorB), Closure->logColor);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->logColorA), Closure->logColor);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->logColorB), Closure->logColor);
|
||||
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->curveColorA), Closure->curveColor);
|
||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(pc->curveColorB), Closure->curveColor);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->curveColorA), Closure->curveColor);
|
||||
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pc->curveColorB), Closure->curveColor);
|
||||
}
|
||||
|
||||
static void color_set_cb(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), data);
|
||||
gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), data);
|
||||
update_color_buttons();
|
||||
}
|
||||
|
||||
@@ -2510,7 +2510,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->greenSector);
|
||||
button = gtk_color_button_new_with_rgba(Closure->greenSector);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->greenSector);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2540,7 +2540,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->yellowSector);
|
||||
button = gtk_color_button_new_with_rgba(Closure->yellowSector);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->yellowSector);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2570,7 +2570,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->redSector);
|
||||
button = gtk_color_button_new_with_rgba(Closure->redSector);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->redSector);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2600,7 +2600,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->darkSector);
|
||||
button = gtk_color_button_new_with_rgba(Closure->darkSector);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->darkSector);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2630,7 +2630,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->blueSector);
|
||||
button = gtk_color_button_new_with_rgba(Closure->blueSector);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->blueSector);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2661,7 +2661,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->whiteSector);
|
||||
button = gtk_color_button_new_with_rgba(Closure->whiteSector);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->whiteSector);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2702,7 +2702,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->greenText);
|
||||
button = gtk_color_button_new_with_rgba(Closure->greenText);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->greenText);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2732,7 +2732,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->redText);
|
||||
button = gtk_color_button_new_with_rgba(Closure->redText);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->redText);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2771,7 +2771,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->curveColor);
|
||||
button = gtk_color_button_new_with_rgba(Closure->curveColor);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->curveColor);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2802,7 +2802,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->logColor);
|
||||
button = gtk_color_button_new_with_rgba(Closure->logColor);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->logColor);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -2834,7 +2834,7 @@ void GuiCreatePreferencesWindow(void)
|
||||
for(i=0; i<2; i++)
|
||||
{ GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
|
||||
|
||||
button = gtk_color_button_new_with_color(Closure->barColor);
|
||||
button = gtk_color_button_new_with_rgba(Closure->barColor);
|
||||
g_signal_connect(G_OBJECT(button), "color-set", G_CALLBACK(color_set_cb), Closure->barColor);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
@@ -548,7 +548,7 @@ static void render_sector(cairo_t *cr, raw_editor_context *rec)
|
||||
|
||||
if(!d) return;
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->background);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->background);
|
||||
cairo_rectangle(cr, 0, 0, rec->daWidth, rec->daHeight);
|
||||
cairo_fill(cr);
|
||||
|
||||
@@ -558,29 +558,29 @@ static void render_sector(cairo_t *cr, raw_editor_context *rec)
|
||||
{ char byte[3];
|
||||
|
||||
if(rec->tags[idx])
|
||||
{ gdk_cairo_set_source_color(cr, Closure->curveColor);
|
||||
{ gdk_cairo_set_source_rgba(cr, Closure->curveColor);
|
||||
cairo_rectangle(cr, x, y, rec->charWidth, rec->charHeight);
|
||||
cairo_fill(cr);
|
||||
}
|
||||
else if(rec->rb->byteState[idx])
|
||||
{ if(rec->rb->byteState[idx] & (P1_CPOS | Q1_CPOS))
|
||||
{ gdk_cairo_set_source_color(cr, Closure->yellowSector);
|
||||
{ gdk_cairo_set_source_rgba(cr, Closure->yellowSector);
|
||||
cairo_rectangle(cr, x, y, rec->charWidth, rec->charHeight);
|
||||
cairo_fill(cr);
|
||||
}
|
||||
else if(rec->rb->byteState[idx] & (P1_ERROR | Q1_ERROR))
|
||||
{ gdk_cairo_set_source_color(cr, Closure->greenText);
|
||||
{ gdk_cairo_set_source_rgba(cr, Closure->greenText);
|
||||
cairo_rectangle(cr, x, y, rec->charWidth, rec->charHeight);
|
||||
cairo_fill(cr);
|
||||
}
|
||||
else
|
||||
{ gdk_cairo_set_source_color(cr, Closure->redText);
|
||||
{ gdk_cairo_set_source_rgba(cr, Closure->redText);
|
||||
cairo_rectangle(cr, x, y, rec->charWidth, rec->charHeight);
|
||||
cairo_fill(cr);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
|
||||
sprintf(byte, "%c", canprint(buf[idx]) ? buf[idx] : '.');
|
||||
idx++;
|
||||
|
||||
@@ -32,14 +32,14 @@
|
||||
|
||||
static long long int readable, correctable, missing;
|
||||
static int percent,min_required;
|
||||
static GdkColor *footer_color;
|
||||
static GdkRGBA *footer_color;
|
||||
|
||||
#define REDRAW_TITLE 1<<0
|
||||
#define REDRAW_SUBTITLE 1<<1
|
||||
#define REDRAW_PROGRESS 1<<2
|
||||
#define REDRAW_ERRORMSG 1<<3
|
||||
|
||||
static int draw_text(cairo_t *cr, PangoLayout *l, char *text, int x, int y, GdkColor *color, int redraw)
|
||||
static int draw_text(cairo_t *cr, PangoLayout *l, char *text, int x, int y, GdkRGBA *color, int redraw)
|
||||
{ int w,h,pw;
|
||||
int erase_to;
|
||||
|
||||
@@ -49,11 +49,11 @@ static int draw_text(cairo_t *cr, PangoLayout *l, char *text, int x, int y, GdkC
|
||||
{ erase_to = Closure->readAdaptiveSpiral->mx - Closure->readAdaptiveSpiral->diameter/2;
|
||||
pw = erase_to-x;
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->background);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->background);
|
||||
cairo_rectangle(cr, x, y, pw, h);
|
||||
cairo_fill(cr);
|
||||
|
||||
gdk_cairo_set_source_color(cr, color);
|
||||
gdk_cairo_set_source_rgba(cr, color);
|
||||
cairo_move_to(cr, x, y);
|
||||
pango_cairo_show_layout(cr, l);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ static void redraw_labels(cairo_t *cr, GtkWidget *widget, int erase_mask)
|
||||
/* Draw the labels */
|
||||
|
||||
x = 10;
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
|
||||
y = Closure->readAdaptiveSpiral->my - Closure->readAdaptiveSpiral->diameter/2;
|
||||
h = draw_text(cr, Closure->readLinearCurve->layout,
|
||||
@@ -138,7 +138,7 @@ static void redraw_labels(cairo_t *cr, GtkWidget *widget, int erase_mask)
|
||||
|
||||
|
||||
if(Closure->readAdaptiveErrorMsg && erase_mask & REDRAW_ERRORMSG)
|
||||
{ gdk_cairo_set_source_color(cr, footer_color);
|
||||
{ gdk_cairo_set_source_rgba(cr, footer_color);
|
||||
|
||||
GuiSetText(Closure->readLinearCurve->layout, Closure->readAdaptiveErrorMsg, &w, &h);
|
||||
y = Closure->readAdaptiveSpiral->my + Closure->readAdaptiveSpiral->diameter/2 - h;
|
||||
@@ -216,7 +216,7 @@ static gboolean segment_idle_func(gpointer data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void GuiChangeSegmentColor(GdkColor *color, int segment)
|
||||
void GuiChangeSegmentColor(GdkRGBA *color, int segment)
|
||||
{
|
||||
Closure->readAdaptiveSpiral->segmentColor[segment] = color;
|
||||
g_idle_add(segment_idle_func, 0);
|
||||
@@ -266,7 +266,7 @@ void GuiSetAdaptiveReadSubtitle(char *title)
|
||||
g_idle_add(label_redraw_idle_func, GINT_TO_POINTER(REDRAW_SUBTITLE));
|
||||
}
|
||||
|
||||
void GuiSetAdaptiveReadFootline(char *msg, GdkColor *color)
|
||||
void GuiSetAdaptiveReadFootline(char *msg, GdkRGBA *color)
|
||||
{
|
||||
if(!Closure->guiMode)
|
||||
return;
|
||||
|
||||
@@ -560,7 +560,7 @@ static void clear_progress(read_closure *rc)
|
||||
#ifdef WITH_GUI_NO
|
||||
#define mark_sector(r, s, c)
|
||||
#else
|
||||
static void mark_sector(read_closure *rc, gint64 sector, GdkColor *color)
|
||||
static void mark_sector(read_closure *rc, gint64 sector, GdkRGBA *color)
|
||||
{ int segment;
|
||||
int changed = FALSE;
|
||||
|
||||
@@ -569,8 +569,8 @@ static void mark_sector(read_closure *rc, gint64 sector, GdkColor *color)
|
||||
segment = sector / rc->sectorsPerSegment;
|
||||
|
||||
if(color)
|
||||
{ GdkColor *old = Closure->readAdaptiveSpiral->segmentColor[segment];
|
||||
GdkColor *new = old;
|
||||
{ GdkRGBA *old = Closure->readAdaptiveSpiral->segmentColor[segment];
|
||||
GdkRGBA *new = old;
|
||||
|
||||
if(color == Closure->redSector && old != Closure->redSector)
|
||||
new = color;
|
||||
|
||||
@@ -259,7 +259,7 @@ static void redraw_spiral_labels(cairo_t *cr)
|
||||
|
||||
x = 10;
|
||||
GuiSetText(Closure->readLinearCurve->layout, _("Medium state"), &w, &h);
|
||||
gdk_cairo_set_source_color(cr, Closure->curveColor);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->curveColor);
|
||||
cairo_move_to(cr, x, Closure->readLinearCurve->topY - h - 5);
|
||||
pango_cairo_show_layout(cr, Closure->readLinearCurve->layout);
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ void ResetRS01VerifyWindow(Method *self)
|
||||
|
||||
typedef struct _spiral_idle_info
|
||||
{ Spiral *cmpSpiral;
|
||||
GdkColor *segColor;
|
||||
GdkRGBA *segColor;
|
||||
int from, to;
|
||||
} spiral_idle_info;
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ static void redraw_curve(cairo_t *cr, RS01Widgets *wl)
|
||||
|
||||
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->greenSector);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->greenSector);
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_move_to(cr, wl->fixCurve->leftX-5.5, y+0.5);
|
||||
cairo_line_to(cr, wl->fixCurve->rightX+5.5, y+0.5);
|
||||
|
||||
@@ -73,7 +73,7 @@ void ResetRS02VerifyWindow(Method *self)
|
||||
|
||||
typedef struct _spiral_idle_info
|
||||
{ Spiral *cmpSpiral;
|
||||
GdkColor *segColor;
|
||||
GdkRGBA *segColor;
|
||||
int from, to;
|
||||
} spiral_idle_info;
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ static void redraw_curve(cairo_t *cr, RS02Widgets *wl)
|
||||
|
||||
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->greenSector);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->greenSector);
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_move_to(cr, wl->fixCurve->leftX-5.5, y+0.5);
|
||||
cairo_line_to(cr, wl->fixCurve->rightX+5.5, y+0.5);
|
||||
|
||||
@@ -83,7 +83,7 @@ void ResetRS03VerifyWindow(Method *self)
|
||||
|
||||
typedef struct _spiral_idle_info
|
||||
{ Spiral *cmpSpiral;
|
||||
GdkColor *segColor;
|
||||
GdkRGBA *segColor;
|
||||
int from, to;
|
||||
} spiral_idle_info;
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ static void redraw_curve(cairo_t *cr, RS03Widgets *wl)
|
||||
|
||||
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
|
||||
|
||||
gdk_cairo_set_source_color(cr, Closure->greenSector);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->greenSector);
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_move_to(cr, wl->fixCurve->leftX-5.5, y+0.5);
|
||||
cairo_line_to(cr, wl->fixCurve->rightX+5.5, y+0.5);
|
||||
|
||||
24
src/spiral.c
24
src/spiral.c
@@ -34,7 +34,7 @@
|
||||
* Allocate and fill in the spiral data structure
|
||||
*/
|
||||
|
||||
Spiral* GuiCreateSpiral(GdkColor *outline, GdkColor *fill,
|
||||
Spiral* GuiCreateSpiral(GdkRGBA *outline, GdkRGBA *fill,
|
||||
int start_radius, int segment_size, int n_segments)
|
||||
{ Spiral *spiral;
|
||||
double a = 0.0;
|
||||
@@ -50,8 +50,8 @@ Spiral* GuiCreateSpiral(GdkColor *outline, GdkColor *fill,
|
||||
spiral->segmentSize = segment_size;
|
||||
spiral->segmentCount = spiral->segmentClipping = n_segments;
|
||||
spiral->segmentPos = g_malloc(n_segments * sizeof(double));
|
||||
spiral->segmentColor = g_malloc(n_segments * sizeof(GdkColor*));
|
||||
spiral->segmentOutline = g_malloc(n_segments * sizeof(GdkColor*));
|
||||
spiral->segmentColor = g_malloc(n_segments * sizeof(GdkRGBA*));
|
||||
spiral->segmentOutline = g_malloc(n_segments * sizeof(GdkRGBA*));
|
||||
spiral->cursorPos = -1;
|
||||
spiral->lastRenderedCursorPos = -1;
|
||||
|
||||
@@ -96,7 +96,7 @@ void GuiFreeSpiral(Spiral *spiral)
|
||||
* Also resets the cursor (this function serves to reset the spiral)
|
||||
*/
|
||||
|
||||
void GuiFillSpiral(Spiral *spiral, GdkColor *color)
|
||||
void GuiFillSpiral(Spiral *spiral, GdkRGBA *color)
|
||||
{ int i;
|
||||
|
||||
if(spiral)
|
||||
@@ -140,16 +140,16 @@ void GuiDrawSpiral(cairo_t *cr, Spiral *spiral)
|
||||
yo1 = spiral->my + scale_o*sin(a);
|
||||
|
||||
|
||||
GdkColor *outline = spiral->segmentOutline[i] ? spiral->segmentOutline[i] : Closure->grid;
|
||||
GdkRGBA *outline = spiral->segmentOutline[i] ? spiral->segmentOutline[i] : Closure->grid;
|
||||
|
||||
cairo_move_to(cr, xi0, yi0);
|
||||
cairo_line_to(cr, xo0, yo0);
|
||||
cairo_line_to(cr, xo1, yo1);
|
||||
cairo_line_to(cr, xi1, yi1);
|
||||
cairo_close_path(cr);
|
||||
gdk_cairo_set_source_color(cr, spiral->segmentColor[i]);
|
||||
gdk_cairo_set_source_rgba(cr, spiral->segmentColor[i]);
|
||||
cairo_fill_preserve(cr);
|
||||
gdk_cairo_set_source_color(cr, outline);
|
||||
gdk_cairo_set_source_rgba(cr, outline);
|
||||
cairo_stroke(cr);
|
||||
|
||||
xi0 = xi1; yi0 = yi1;
|
||||
@@ -161,7 +161,7 @@ void GuiDrawSpiral(cairo_t *cr, Spiral *spiral)
|
||||
* Draw just one segment of the spiral
|
||||
*/
|
||||
|
||||
void GuiSetSpiralSegmentColor(Spiral *spiral, GdkColor *color, GdkColor *outline, int segment)
|
||||
void GuiSetSpiralSegmentColor(Spiral *spiral, GdkRGBA *color, GdkRGBA *outline, int segment)
|
||||
{
|
||||
if(segment<0 || segment>=spiral->segmentClipping)
|
||||
return;
|
||||
@@ -178,21 +178,21 @@ void GuiSetSpiralSegmentColor(Spiral *spiral, GdkColor *color, GdkColor *outline
|
||||
*/
|
||||
|
||||
void GuiDrawSpiralLabel(cairo_t *cr, Spiral *spiral, PangoLayout *layout,
|
||||
char *text, GdkColor *color, int x, int line)
|
||||
char *text, GdkRGBA *color, int x, int line)
|
||||
{ int w,h,y;
|
||||
|
||||
GuiSetText(layout, text, &w, &h);
|
||||
if(line > 0) y = spiral->my + spiral->diameter / 2 + 20 + (line-1) * (10 + h);
|
||||
else y = spiral->my - spiral->diameter / 2 - 20 - h + (line+1) * (10 + h);
|
||||
cairo_rectangle(cr, x + 0.5, y+(h-6)/2 + 0.5, 6, 6);
|
||||
gdk_cairo_set_source_color(cr, color);
|
||||
gdk_cairo_set_source_rgba(cr, color);
|
||||
cairo_fill_preserve(cr);
|
||||
gdk_cairo_set_source_color(cr, Closure->grid);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->grid);
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_stroke(cr);
|
||||
|
||||
cairo_move_to(cr, x+10, y);
|
||||
gdk_cairo_set_source_color(cr, Closure->foreground);
|
||||
gdk_cairo_set_source_rgba(cr, Closure->foreground);
|
||||
pango_cairo_show_layout(cr, layout);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,32 +44,13 @@ static gboolean draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data)
|
||||
{ GtkWidget *box = (GtkWidget*)data;
|
||||
|
||||
if(!Closure->colors_initialized)
|
||||
{ GdkColor *bg = >k_widget_get_style(widget)->bg[0];
|
||||
GdkVisual *cmap = gdk_visual_get_system();
|
||||
|
||||
memcpy(Closure->background, bg, sizeof(GdkColor));
|
||||
|
||||
gdk_colormap_alloc_color(cmap, Closure->foreground, FALSE, TRUE);
|
||||
|
||||
Closure->grid->red = bg->red-bg->red/8;
|
||||
Closure->grid->green = bg->green-bg->green/8;
|
||||
Closure->grid->blue = bg->blue-bg->blue/8;
|
||||
gdk_colormap_alloc_color(cmap, Closure->grid, FALSE, TRUE);
|
||||
|
||||
/* This can't be done at closure.c */
|
||||
|
||||
gdk_colormap_alloc_color(cmap, Closure->redText, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->greenText, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->barColor, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->logColor, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->curveColor, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->redSector, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->yellowSector, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->greenSector, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->blueSector, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->whiteSector, FALSE, TRUE);
|
||||
gdk_colormap_alloc_color(cmap, Closure->darkSector, FALSE, TRUE);
|
||||
|
||||
{
|
||||
GdkRGBA fg = {0};
|
||||
GtkStyleContext *context = gtk_widget_get_style_context(widget);
|
||||
gtk_style_context_get_color(context, GTK_STATE_FLAG_NORMAL, &fg);
|
||||
*Closure->foreground = fg;
|
||||
*Closure->grid = fg;
|
||||
Closure->grid->alpha = 0.25;
|
||||
Closure->colors_initialized = TRUE;
|
||||
|
||||
/* Dirty trick for indenting the list:
|
||||
@@ -79,7 +60,7 @@ static gboolean draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data)
|
||||
{ GtkWidget *button;
|
||||
|
||||
Closure->invisibleDash = g_strdup_printf("<span color=\"#%02x%02x%02x\">-</span>",
|
||||
bg->red>>8, bg->green>>8, bg->blue>>8);
|
||||
0xff, 0xff, 0xff); // FIXME
|
||||
|
||||
GuiAboutTextWithLink(box, _("This is <b>v0.79.10-pl3</b>. The [patchlevel series] are enhanced from the last upstream release.\n"
|
||||
"We add support for BD-R TL/QL, Windows and MacOS builds, an option to produce bigger BD-R RS03,\n"
|
||||
|
||||
Reference in New Issue
Block a user