}
void
+ApplyFont (Option *opt, char *font)
+{
+ GtkWidget *w = NULL;
+ if(!font && opt->font) font = *opt->font;
+ if(!font) return;
+ switch(opt->type) {
+ case ListBox:
+ case Label: w = opt->handle; break;
+ case Button: if(opt->handle) w = gtk_bin_get_child(GTK_BIN(opt->handle)); break;
+ case TextBox: w = (GtkWidget *) opt->textValue; if(!w) w = opt->handle; break;
+ default: ;
+ }
+ if(w && font) SetWidgetFont(w, &font);
+}
+
+void
SetListBoxItem (GtkListStore *store, int n, char *msg)
{
GtkTreeIter iter;
static GtkTextIter end;
static GtkTextTag *fgTags[8], *bgTags[8], *font, *bold, *normal, *attr = NULL;
+ if(!s) {
+ font = NULL;
+ return;
+ }
+
if(!font) {
font = gtk_text_buffer_create_tag(opt->handle, NULL, "font", appData.icsFont, NULL);
gtk_widget_modify_base(GTK_WIDGET(opt->textValue), GTK_STATE_NORMAL, &backgroundColor);
#endif
static void
+ExposeDraw (Option *graph, GdkEventExpose *eevent)
+{
+ int w = eevent->area.width;
+ cairo_t *cr;
+ if(eevent->area.x + w > graph->max) w--; // cut off fudge pixel
+ cr = gdk_cairo_create(((GtkWidget *) (graph->handle))->window);
+ cairo_set_source_surface(cr, (cairo_surface_t *) graph->choice, 0, 0);
+//cairo_set_source_rgb(cr, 1, 0, 0);
+ cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
+ cairo_rectangle(cr, eevent->area.x, eevent->area.y, w, eevent->area.height);
+ cairo_fill(cr);
+ cairo_destroy(cr);
+}
+
+static void
GraphEventProc(GtkWidget *widget, GdkEvent *event, gpointer gdata)
{ // handle expose and mouse events on Graph widget
int w, h;
GdkEventMotion *mevent = (GdkEventMotion *) event;
GdkEventScroll *sevent = (GdkEventScroll *) event;
GtkAllocation a;
- cairo_t *cr;
// if (!XtIsRealized(widget)) return;
// to give drawing routines opportunity to use it before first expose event
// (which are only processed when main gets to the event loop, so after all init!)
// so only change when size is no longer good
- cairo_t *cr;
- if(graph->choice) cairo_surface_destroy((cairo_surface_t *) graph->choice);
- graph->choice = (char**) cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h);
- // paint white, to prevent weirdness when people maximize window and drag pieces over space next to board
- cr = cairo_create ((cairo_surface_t *) graph->choice);
- cairo_rectangle (cr, 0, 0, w, h);
- cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 1.0);
- cairo_fill(cr);
- cairo_destroy (cr);
+// NewCanvas(graph);
+ graph->min |= REPLACE; // defer making new canvas
break;
}
- w = eevent->area.width;
- if(eevent->area.x + w > graph->max) w--; // cut off fudge pixel
- cr = gdk_cairo_create(((GtkWidget *) (graph->handle))->window);
- cairo_set_source_surface(cr, (cairo_surface_t *) graph->choice, 0, 0);
-//cairo_set_source_rgb(cr, 1, 0, 0);
- cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
- cairo_rectangle(cr, eevent->area.x, eevent->area.y, w, eevent->area.height);
- cairo_fill(cr);
- cairo_destroy(cr);
+ ExposeDraw(graph, eevent);
default:
return;
case GDK_SCROLL:
GdkEventExpose e;
if(!opt->handle) return;
e.area.x = x; e.area.y = y; e.area.width = w; e.area.height = h; e.count = -1; e.type = GDK_EXPOSE; // count = -1: kludge to suppress sizing
- GraphEventProc(opt->handle, (GdkEvent *) &e, (gpointer) opt); // fake expose event
+ ExposeDraw(opt, &e); // fake expose event
}
void GenericCallback(GtkWidget *widget, gpointer gdata)
label = frame;
}
gtk_widget_set_size_request(label, option[i].max ? option[i].max : -1, -1);
- if(option[i].target || dlgNr != ErrorDlg && option[i].name && !strchr(option[i].name, '\n')) { // allow user to specify event handler for button presses
+ if(option[i].target || dlgNr != ErrorDlg && option[i].name) { // allow user to specify event handler for button presses
button = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(button), label);
label = button;