示例#1
0
文件: myre.c 项目: vobiscum/myre
int assemble_views() {
    /* button2 */
    make_button2();

    /*status*/
    make_status();

    /*scroll*/
    make_scroll();

    /*textview*/
    make_textview();

    /* tags */
    make_tags();

    gtk_container_add((GtkContainer *)hbox1, button2);
    gtk_box_set_child_packing(GTK_BOX(hbox1), button2,
                              0, 0, 1, GTK_PACK_START);
    gtk_container_add((GtkContainer *)hboxmain, textview1);
    gtk_container_add((GtkContainer *)scroll, textview2);
    gtk_container_add((GtkContainer *)hboxmain, scroll);
    gtk_container_add((GtkContainer *)vbox1, GTK_WIDGET(status));

    gtk_box_set_child_packing(GTK_BOX(hboxmain), textview1,
                              0, 1, 2, GTK_PACK_START);
    gtk_box_set_child_packing(GTK_BOX(hboxmain), scroll,
                              1, 1, 2, GTK_PACK_END);
    gtk_box_set_child_packing(GTK_BOX(vbox1), GTK_WIDGET(status),
                              0, 1, 0, GTK_PACK_START);

    gtk_widget_show(scroll);

    viewsAssembled = TRUE;

    debug("Assemble views");

    return 0;
}
    UnitMapperView() {
        fPts[0].set(0, 0);
        fPts[1].set(SK_Scalar1 / 3, SK_Scalar1 / 3);
        fPts[2].set(SK_Scalar1 * 2 / 3, SK_Scalar1 * 2 / 3);
        fPts[3].set(SK_Scalar1, SK_Scalar1);

        fMatrix.setScale(SK_Scalar1 * 200, -SK_Scalar1 * 200);
        fMatrix.postTranslate(SkIntToScalar(100), SkIntToScalar(300));

        SkRect r = {
            SkIntToScalar(350), SkIntToScalar(100),
            SkIntToScalar(500), SkIntToScalar(130)
        };
        SkPaint paint;
        paint.setAntiAlias(true);
        paint.setTextSize(SkIntToScalar(25));
        for (int i = 0; i < 4; i++) {
            fViews[i] = make_textview(this, r, paint);
            r.offset(0, r.height());
        }
        this->setViews();
    }
示例#3
0
文件: myre.c 项目: vobiscum/myre
int
make_tags() {
    if(!textview2)
        make_textview();

    if(!title)
        title     = gtk_text_buffer_create_tag(
                        text2,
                        "title",
                        "foreground", "darkturquoise",
                        "family"    , FONT_TITLE,
                        "weight"    , "PANGO_WEIGHT_BOLD",
                        "family"    , FONT_TITLE,
                        "weight"    , "PANGO_WEIGHT_BOLD",
                        "scale"     , SCALE_TITLE,
                        NULL);

    if(!occurance)
        occurance = gtk_text_buffer_create_tag(
                        text2,
                        "occurance" ,
                        "weight"    , "PANGO_WEIGHT_BOLD",
                        "foreground", "deepskyblue",
                        NULL);

    if(!invisible)
        invisible = gtk_text_buffer_create_tag(
                        text2,
                        "vanish",
                        "invisible" , TRUE,
                        NULL);

    if(!keyword)
        keyword   = gtk_text_buffer_create_tag(
                        text2,
                        "section",
                        "weight"    , "PANGO_WEIGHT_BOLD",
                        "foreground", "royalblue",
                        "family"    , FONT_TITLE,
                        "scale"     , SCALE_KEYWORD,
                        NULL);

    if(!highlight)
        highlight = gtk_text_buffer_create_tag(
                        text2,
                        "searched",
                        "background", "yellow",
                        NULL);

    if(!normal)
        normal    = gtk_text_buffer_create_tag(
                        text2,
                        "others",
                        "background", NULL,
                        NULL);

    debug("make tags");

#ifdef MinGW
    /*set default font for textviews*/
    default_font = gtk_text_buffer_create_tag(
                       text2,
                       "default",
                       "family" , FONT_DEFAULT,
                       NULL);
#endif /* MinGW */
    return 0;
}