Ewl_Widget * ewl_io_manager_plugin_uri_read(const char *uri) { Ewl_Widget *ret = NULL; FILE *file; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(uri, NULL); if (!key1) setup_hash(); file = fopen(uri, "r"); if (file) { struct stat buf; char *str; ret = ewl_text_new(); ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace"); stat(uri, &buf); str = malloc(sizeof(char) * (buf.st_size + 1)); fread(str, buf.st_size, 1, file); str[buf.st_size] = '\0'; fclose(file); text_set(EWL_TEXT(ret), str); FREE(str); } DRETURN_PTR(ret, DLEVEL_STABLE); }
IPTR GTText__OM_SET(Class *cl, Object *o, struct opSet *msg) { IPTR retval; retval = DoSuperMethodA(cl, o, (Msg)msg); retval += text_set(cl, o, msg); /* If we have been subclassed, OM_UPDATE should not cause a GM_RENDER * because it would circumvent the subclass from fully overriding it. * The check of cl == OCLASS(o) should fail if we have been * subclassed, and we have gotten here via DoSuperMethodA(). */ if ( retval && ( msg->MethodID == OM_UPDATE ) && ( cl == OCLASS(o) ) ) { struct GadgetInfo *gi = msg->ops_GInfo; if (gi) { struct RastPort *rp = ObtainGIRPort(gi); if (rp) { DoMethod(o, GM_RENDER, (IPTR) gi, (IPTR) rp, GREDRAW_REDRAW); ReleaseGIRPort(rp); } /* if */ } /* if */ } /* if */ return retval; }
void mustache_load_text(pmustache m, char *data) { m->text_get_char = text_get_char; m->text_get_char_pos = text_get_char_pos; text_set(m, data); text_set_size(m); }
int sbl_text_add(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret = last_text + 1; int koord; glstav_multitext_units -= rezerva; if (text_set_num(last_text)) { // cislo textury t = p_text->textury[0]; p_txt = p_mat->p_text[t]; if (p_mat->textfile[t][0] && p_mat->p_text[t]) { text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_ADD); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } else { ret = last_text; } } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); }
Text *Node::text_create(Font *font, Scene &scene) { Assets &assets = scene.assets_get(); std::unique_ptr<Text> text(new Text()); Text *text_ptr = text.get(); text_ptr->font_set(font); text_set(text_ptr); if (!mesh_get()) mesh_create(scene); assets.text_add(std::move(text)); return text_ptr; }
Ewl_Widget * ewl_io_manager_plugin_string_read(const char *string) { Ewl_Widget *ret = NULL; char *txt; DENTER_FUNCTION(DLEVEL_STABLE); if (!key1) setup_hash(); ret = ewl_text_new(); ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace"); txt = strdup(string); text_set(EWL_TEXT(ret), txt); free(txt); DRETURN_PTR(ret, DLEVEL_STABLE); }
static void on_search_click (void) { char buf[256]; //msgbox ("Seaching..."); Edit_GetText (GetDlgItem(hMainWindow, IDC_TXT), buf, sizeof(buf)); ListView_DeleteAllItems (hResult); text_set (""); Edit_SetText (GetDlgItem(hMainWindow, IDC_LFIND), ""); Button_Enable (GetDlgItem (hMainWindow, IDC_SAVELF), 0); Button_Enable (GetDlgItem (hMainWindow, IDC_SAVECRLF), 0); recent_current_reset (); get_options (); if (strlen(buf) > 0) { recent_add (buf); recent_fill_combo (IDC_RECENT); search_in_path (buf, CurrentPath, FileMask); } else { status_bar (1, "Empty search string!"); } }
IPTR GTText__OM_NEW(Class * cl, Object * o, struct opSet *msg) { EnterFunc(bug("Text::New()\n")); o = (Object *) DoSuperMethodA(cl, o, (Msg)msg); if (o) { struct TextData *data = INST_DATA(cl, o); struct TextAttr *tattr, def_tattr; /* Set some defaults */ data->format = "%ld"; data->flags = 0; data->frontpen = TEXTPEN; data->backpen = BACKGROUNDPEN; data->toprint = (IPTR) NULL; data->font = NULL; data->maxnumberlength = 0; /* This means "no limit" */ data->dispfunc = (APTR)GetTagData(GTA_Text_DispFunc, (IPTR) NULL, msg->ops_AttrList); data->labelplace = GetTagData(GA_LabelPlace, GV_LabelPlace_Left, msg->ops_AttrList); /* Open font to use for gadget */ /* We will *ALWAYS* have a valid DrawInfo struct */ data->dri = (struct DrawInfo *)GetTagData(GA_DrawInfo, (IPTR) NULL, msg->ops_AttrList); def_tattr.ta_Name = data->dri->dri_Font->tf_Message.mn_Node.ln_Name; def_tattr.ta_YSize = data->dri->dri_Font->tf_YSize; def_tattr.ta_Style = 0; def_tattr.ta_Flags = 0; tattr = (struct TextAttr *)GetTagData(GA_TextAttr, (IPTR)&def_tattr, msg->ops_AttrList); data->font = OpenFont(tattr); if (!data->font) goto error; if (GetTagData(GTTX_CopyText, (IPTR)FALSE, msg->ops_AttrList)) { STRPTR text; D(bug("Got GTTX_CopyText\n")); text = (STRPTR)GetTagData(GTTX_Text, (IPTR)"Text MUST be passed with OM_NEW", msg->ops_AttrList); if (text) { D(bug("Text: %s\n", text)); /* Allocate copy buffer for the text */ data->toprint = (IPTR)AllocVec(strlen(text) + 1, MEMF_ANY); if (data->toprint) { data->flags |= TEXTF_COPYTEXT; D(bug("Copying text\n")); strcpy((STRPTR)data->toprint, text); } else { goto error; } } else { /* If text==NULL we have nothing to copy */ data->toprint = 0; } } else { STRPTR text; if ((text = (STRPTR)GetTagData(GTTX_Text, (IPTR) NULL, msg->ops_AttrList))) { data->toprint = (IPTR)text; } } D(bug("calling text_set\n")); text_set(cl, o, msg); if (data->flags & TEXTF_BORDER) { struct TagItem frame_tags[] = { {IA_Width , GetTagData(GA_Width, 0, msg->ops_AttrList) }, {IA_Height , GetTagData(GA_Height, 0, msg->ops_AttrList) }, {IA_Resolution , (data->dri->dri_Resolution.X << 16) + data->dri->dri_Resolution.Y }, {IA_FrameType , FRAME_BUTTON }, {IA_Recessed , TRUE }, {TAG_DONE , 0UL } }; data->frame = NewObjectA(NULL, FRAMEICLASS, frame_tags); } } ReturnPtr ("Text::New", IPTR, (IPTR)o); error: CoerceMethod(cl, o, OM_DISPOSE); ReturnPtr ("Text::New", IPTR, (IPTR) NULL); }
int sbl_text_dot3_bump_env(EDIT_MATERIAL * p_mat, EDIT_STATE_TEXT_BLOK * p_stage, MATERIAL_TEXT_OLD * p_text, int last_text, int rezerva) { EDIT_TEXT *p_txt; int t, ret; int koord; /* Test efektu - je to podporovane videokartou? */ glstav_multitext_units -= rezerva; if (gl_ext::extlist_text_env_dot3 && last_text + p_stage->textur <= glstav_multitext_units) { t = p_text->textury[DOT3_ENV]; // Text 2 - Lightmapa p_txt = p_mat->p_text[t]; if (p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, p_text->text_funkce[DOT3_ENV]); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; t = p_text->textury[DOT3_BUMP]; // Text 0 - DOT3 Color-Mapa p_txt = p_mat->p_text[t]; if (p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, BLOK_DOT3_BUMP); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; } if (last_text < glstav_multitext_units) { t = p_text->textury[DOT3_TEXT]; // Text 1 - Color-mapa p_txt = p_mat->p_text[t]; if (p_mat->p_text[t]) { text_set_num(last_text); text_on(p_txt->typ); text_set(p_txt->text, p_txt->typ); text_set_blok(last_text, p_text->text_funkce[DOT3_TEXT]); koord = p_text->text_koord[t]; if (p_mat->flag2 & glstav_posun_flagy2[koord]) { set_matrix_texture(last_text, p_mat->ttext + koord); } else { ret_matrix_texture(last_text); } if (p_mat->flag & glstav_texgen_sphere_flagy[koord]) { texgen_env_on(last_text); glstav_text_map_indicie[last_text] = K_CHYBA; } else if (p_mat->flag & glstav_texgen_eye_lin_flagy[koord]) { texgen_linear_eye_2d_on(last_text, p_mat->texgen_koord_s[koord], p_mat->texgen_koord_t[koord]); glstav_text_map_indicie[last_text] = K_CHYBA; } else { texgen_off(last_text); glstav_text_map_indicie[last_text] = koord; } } last_text++; ret = last_text; } else { ret = K_CHYBA; } glstav_multitext_units += rezerva; return (ret); }