763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
|
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
|
-
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
|
nbg++;
if (attr & TATTR_ACTCURS) {
nfg = NCOLOURS-2;
nbg = NCOLOURS-1;
}
gdk_gc_set_foreground(gc, &inst->cols[nbg]);
gdk_draw_rectangle(inst->pixmap, gc, 1, x*9, y*15, len*9, 15);
gdk_draw_rectangle(inst->pixmap, gc, 1,
x*inst->font_width, y*inst->font_height,
len*inst->font_width, inst->font_height);
gdk_gc_set_foreground(gc, &inst->cols[nfg]);
gdk_draw_text(inst->pixmap, inst->fonts[0], gc,
x*9, y*15 + inst->fonts[0]->ascent, text, len);
gdk_draw_text(inst->pixmap, inst->fonts[0], gc, x*inst->font_width,
y*inst->font_height + inst->fonts[0]->ascent, text, len);
if (attr & ATTR_UNDER) {
int uheight = inst->fonts[0]->ascent + 1;
if (uheight >= 15)
uheight = 14;
gdk_draw_line(inst->pixmap, gc, x*9, y*15 + uheight,
(x+len)*9-1, y*15+uheight);
if (uheight >= inst->font_height)
uheight = inst->font_height - 1;
gdk_draw_line(inst->pixmap, gc, x*inst->font_width,
y*inst->font_height + uheight,
(x+len)*inst->font_width-1, y*inst->font_height+uheight);
}
gdk_draw_pixmap(inst->area->window, gc, inst->pixmap,
x*9, y*15, x*9, y*15, len*9, 15);
x*inst->font_width, y*inst->font_height,
x*inst->font_width, y*inst->font_height,
len*inst->font_width, inst->font_height);
}
void do_cursor(Context ctx, int x, int y, char *text, int len,
unsigned long attr, int lattr)
{
int passive;
GdkGC *gc = (GdkGC *)ctx;
/*
* NYI: cursor shapes other than block
*/
if (attr & TATTR_PASCURS) {
attr &= ~TATTR_PASCURS;
passive = 1;
} else
passive = 0;
do_text(ctx, x, y, text, len, attr, lattr);
if (passive) {
gdk_gc_set_foreground(gc, &inst->cols[NCOLOURS-1]);
gdk_draw_rectangle(inst->pixmap, gc, 0, x*9, y*15, len*9-1, 15-1);
gdk_draw_rectangle(inst->pixmap, gc, 0,
x*inst->font_width, y*inst->font_height,
len*inst->font_width-1, inst->font_height-1);
gdk_draw_pixmap(inst->area->window, gc, inst->pixmap,
x*9, y*15, x*9, y*15, len*9, 15);
x*inst->font_width, y*inst->font_height,
x*inst->font_width, y*inst->font_height,
len*inst->font_width, inst->font_height);
}
}
void modalfatalbox(char *p, ...)
{
va_list ap;
fprintf(stderr, "FATAL ERROR: ");
|
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
|
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
|
+
+
+
+
+
-
+
+
|
GtkWidget *window;
extern int pty_master_fd; /* declared in pty.c */
gtk_init(&argc, &argv);
do_defaults(NULL, &cfg);
inst->fonts[0] = gdk_font_load(cfg.font);
inst->fonts[1] = NULL; /* FIXME: what about bold font? */
inst->font_width = gdk_char_width(inst->fonts[0], ' ');
inst->font_height = inst->fonts[0]->ascent + inst->fonts[0]->descent;
init_ucs();
back = &pty_backend;
back->init(NULL, 0, NULL, 0);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
inst->area = gtk_drawing_area_new();
gtk_drawing_area_size(GTK_DRAWING_AREA(inst->area),
9*80, 15*24);/* FIXME: proper resizing stuff */
inst->font_width * cfg.width,
inst->font_height * cfg.height);
gtk_container_add(GTK_CONTAINER(window), inst->area);
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), inst);
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(delete_window), inst);
|