int clip_GTK_EXTEXTSETLINEPIXMAPFROMXPM(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint line = _clip_parni(cm, 2); ClipVar *cxpmd = _clip_par(cm, 3); GdkBitmap *mask; GdkPixmap *pixmap; GdkWindow *win = NULL; GdkColormap *colormap = NULL; char * * xpm_data = NULL; unsigned short i; CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_t); CHECKOPT(3, ARRAY_t); if (_clip_parinfo(cm, 2) != NUMERIC_t) line = GTK_EXTEXT(extext->widget)->line_number; else line --; //printf("\nextext %d\n extext->widget %d\n extext->widget->window %d\n" , (extext->parent ), (extext->parent->widget), (extext->parent->widget->window)); //if (extext && extext->widget && extext->widget->window) //{ win = extext->widget->window; colormap = gtk_widget_get_colormap(extext->widget); // printf("\n win & colormap\n"); //} //else // colormap = gdk_colormap_get_system(); if (cxpmd->a.count > 0) { ClipVar *item; xpm_data = (char * *)calloc(sizeof(char*),cxpmd->a.count); for (i = 0; i < cxpmd->a.count; i++) { item = cxpmd->a.items + i; if (item->t.type == CHARACTER_t) { xpm_data[i] = (char*)calloc(1,item->s.str.len+1); strcpy(xpm_data[i], item->s.str.buf); //printf("xpm_data[i]=%s\n", xpm_data[i]); } } } pixmap = gdk_pixmap_colormap_create_from_xpm_d(win, colormap, &mask, NULL, xpm_data); gtk_extext_set_line_pixmap(GTK_EXTEXT(extext->widget), line, pixmap, mask); return 0; err: return 1; }
int clip_GTK_EXTEXTSTYLEINSERT(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gchar *stylename = _clip_parc(cm, 2); C_object *cfont = _fetch_cobject(cm, _clip_spar(cm, 3)); ClipVar *mfg = _clip_spar(cm, 4); ClipVar *mbg = _clip_spar(cm, 5); guint16 flags = _clip_parni(cm, 6); ClipVar *exstyle = RETPTR(cm); GtkExTextStyle *style; GdkColor fgcolor; GdkColor bgcolor; CHECKCWID(extext, GTK_IS_EXTEXT); CHECKARG(2, CHARACTER_t); CHECKCOBJ(cfont, GDK_IS_FONT(cfont)); CHECKARG(4, MAP_t); CHECKARG(5, MAP_t); CHECKOPT(6, NUMERIC_t); _map_colors_to_gdk(cm, mfg, &fgcolor); _map_colors_to_gdk(cm, mbg, &bgcolor); memset(exstyle,0,sizeof(*exstyle)); _clip_map(cm,exstyle); style = gtk_extext_style_insert(GTK_EXTEXT(extext->widget), stylename, GDK_FONT(cfont->object), &fgcolor, &bgcolor, flags); _extext_style_to_map(cm, style, exstyle); return 0; err: return 1; }
int clip_GTK_EXTEXTSETADJUSTMENTS(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); C_widget *chadj = _fetch_cwidget(cm, _clip_spar(cm, 2)); C_widget *cvadj = _fetch_cwidget(cm, _clip_spar(cm, 3)); GtkAdjustment *hadj, *vadj; CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCWIDOPT(chadj, GTK_IS_ADJUSTMENT); CHECKOPT2(3, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCWIDOPT(cvadj, GTK_IS_ADJUSTMENT); hadj = chadj ? GTK_ADJUSTMENT(chadj->widget) : NULL; vadj = cvadj ? GTK_ADJUSTMENT(cvadj->widget) : NULL; gtk_extext_set_adjustments(GTK_EXTEXT(extext->widget), hadj, vadj); return 0; err: return 1; }
int clip_GTK_EXTEXTINSERTWITHSTYLE(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gchar *chars = _clip_parc(cm, 2); gchar *stylekey = _clip_parc(cm, 3); ClipVar *userdata = _clip_spar(cm, 4); gint len; C_var c; CHECKCWID(extext, GTK_IS_EXTEXT); CHECKARG(2, CHARACTER_type_of_ClipVarType); CHECKARG(3, CHARACTER_type_of_ClipVarType); CHECKARG2(4, CCODE_type_of_ClipVarType, PCODE_type_of_ClipVarType); c.cm = cm; c.cfunc = userdata; c.cw = extext; len = strlen(chars); gtk_extext_insert_with_style(GTK_EXTEXT(extext->widget), chars, len, stylekey, &c); return 0; err: return 1; }
int clip_GTK_EXTEXTGETFIRSTVISIBLELINE(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); ClipVar *mlineData = RETPTR(cm); GtkExTextLineData *lineData; CHECKCWID(extext, GTK_IS_EXTEXT); memset(mlineData,0,sizeof(*mlineData)); _clip_map(cm,mlineData); lineData = gtk_extext_get_first_visible_line(GTK_EXTEXT(extext->widget)); _extext_linedata_to_map(cm, GTK_EXTEXT(extext->widget), lineData, mlineData); return 0; err: return 1; }
int clip_GTK_EXTEXTGETNEXTTABSTOP(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint pos = _clip_parni(cm, 2); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_t); if (_clip_parinfo(cm, 2) != NUMERIC_t) pos = GTK_EXTEXT(extext->widget)->line_number; _clip_retni(cm, gtk_extext_get_next_tab_stop(GTK_EXTEXT(extext->widget), pos)); return 0; err: return 1; }
int clip_GTK_EXTEXTGETABSCOLUMN(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint pos = _clip_parni(cm, 2); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_type_of_ClipVarType); if (_clip_parinfo(cm, 2) != NUMERIC_type_of_ClipVarType) pos = GTK_EXTEXT(extext->widget)->line_number; _clip_retni(cm, gtk_extext_get_abs_column(GTK_EXTEXT(extext->widget), pos)); return 0; err: return 1; }
int clip_GTK_EXTEXTSETLINE(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint pos = _clip_parni(cm, 2); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_t); if (_clip_parinfo(cm, 2) != NUMERIC_t) pos = GTK_EXTEXT(extext->widget)->line_number; pos --; _clip_retni(cm, gtk_extext_set_line(GTK_EXTEXT(extext->widget), pos)); return 0; err: return 1; }
int clip_GTK_EXTEXTGETCHARATPOS(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint pos = _clip_parni(cm, 2); guchar str; CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_t); if (_clip_parinfo(cm, 2) != NUMERIC_t) pos = GTK_EXTEXT(extext->widget)->line_number; str = gtk_extext_get_char_at_pos(GTK_EXTEXT(extext->widget), pos); _clip_retc(cm, &str); return 0; err: return 1; }
int clip_GTK_EXTEXTSETCOLUMN(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint col = _clip_parni(cm, 2); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_t); if (_clip_parinfo(cm, 2) != NUMERIC_t) col = GTK_EXTEXT(extext->widget)->column_number; col --; _clip_retni(cm, gtk_extext_set_column(GTK_EXTEXT(extext->widget), col)); return 0; err: return 1; }
void set_properties(GtkWidget *widget, GdsFile *temp) { gboolean highlight; highlight = GDS_EDITOR(temp->text)->highlight; if(temp->props.over_ride) { if(highlight != temp->props.syntax) gds_editor_set_highlight(GDS_EDITOR(temp->text), temp->props.syntax); GTK_EXTEXT(temp->text)->default_tab_width = temp->props.spaces; gtk_widget_queue_draw(temp->text); } else { if(highlight != general_preferences.syntax) gds_editor_set_highlight(GDS_EDITOR(temp->text), general_preferences.syntax); GTK_EXTEXT(temp->text)->default_tab_width = general_preferences.spaces; gtk_widget_queue_draw(temp->text); } }
int clip_GTK_EXTEXTUNDOGETMAX(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); CHECKCWID(extext, GTK_IS_EXTEXT); _clip_retni(cm, gtk_extext_undo_get_max(GTK_EXTEXT(extext->widget))); return 0; err: return 1; }
int clip_GTK_EXTEXTREDO(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); CHECKCWID(extext, GTK_IS_EXTEXT); _clip_retl(cm, gtk_extext_redo(GTK_EXTEXT(extext->widget))); return 0; err: return 1; }
int clip_GTK_EXTEXTSELECTREGION(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint start = _clip_parni(cm, 2); gint end = _clip_parni(cm, 3); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_t); CHECKOPT(3, NUMERIC_t); if (_clip_parinfo(cm, 2) != NUMERIC_t) start = 0; if (_clip_parinfo(cm, 3) != NUMERIC_t) end = GTK_EXTEXT(extext->widget)->length; if (GTK_EXTEXT(extext->widget)->length) gtk_extext_select_region(GTK_EXTEXT(extext->widget), start, end); return 0; err: return 1; }
int clip_GTK_EXTEXTGETCHARS(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint start = _clip_parni(cm, 2); gint end = _clip_parni(cm, 3); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_t); CHECKOPT(3, NUMERIC_t); if (_clip_parinfo(cm, 2) != NUMERIC_t) start = 0; if (_clip_parinfo(cm, 3) != NUMERIC_t) end = GTK_EXTEXT(extext->widget)->length; _clip_retc(cm, (char *)gtk_extext_get_chars(GTK_EXTEXT(extext->widget), start, end)); return 0; err: return 1; }
int clip_GTK_EXTEXTUNDOCLEARALL(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); CHECKCWID(extext, GTK_IS_EXTEXT); gtk_extext_undo_clear_all(GTK_EXTEXT(extext->widget)); return 0; err: return 1; }
int clip_GTK_EXTEXTUNDOISEMPTY(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); CHECKCWID(extext, GTK_IS_EXTEXT); _clip_retl(cm, gtk_extext_undo_is_empty(GTK_EXTEXT(extext->widget))); return 0; err: return 1; }
int clip_GTK_EXTEXTGETLENGTH(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); CHECKCWID(extext, GTK_IS_EXTEXT); _clip_retni(cm, GTK_EXTEXT(extext->widget)->length); return 0; err: return 1; }
int clip_GTK_EXTEXTGETLINE(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint pos; CHECKCWID(extext, GTK_IS_EXTEXT); pos = gtk_extext_get_line(GTK_EXTEXT(extext->widget)); pos ++; _clip_retni(cm, pos); return 0; err: return 1; }
int clip_GTK_EXTEXTGETCOLUMN(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint col; CHECKCWID(extext, GTK_IS_EXTEXT); col = gtk_extext_get_column(GTK_EXTEXT(extext->widget)); col ++; _clip_retni(cm, col); return 0; err: return 1; }
int clip_GTK_EXTEXTUNDOSETMAX(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint max = _clip_parni(cm, 2); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_t); _clip_retl(cm, gtk_extext_undo_set_max(GTK_EXTEXT(extext->widget), max)); return 0; err: return 1; }
int clip_GTK_EXTEXTSTYLEREMOVE(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gchar *stylename = _clip_parc(cm, 2); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKARG(2, CHARACTER_t); gtk_extext_style_remove(GTK_EXTEXT(extext->widget), stylename); return 0; err: return 1; }
int clip_GTK_EXTEXTDELETETEXT(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gint start = _clip_parni(cm, 2); gint end = _clip_parni(cm, 3); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT(2, NUMERIC_type_of_ClipVarType); CHECKOPT(3, NUMERIC_type_of_ClipVarType); if (_clip_parinfo(cm, 2) != NUMERIC_type_of_ClipVarType) start = 0; if (_clip_parinfo(cm, 3) != NUMERIC_type_of_ClipVarType) end = GTK_EXTEXT(extext->widget)->length; if (GTK_EXTEXT(extext->widget)->length) gtk_extext_delete_text(GTK_EXTEXT(extext->widget), start, end); return 0; err: return 1; }
int clip_GTK_EXTEXTSETPOPUPMENU(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); C_widget *widget = _fetch_cwidget(cm, _clip_spar(cm, 2)); C_widget *marginmenu = _fetch_cwidget(cm, _clip_spar(cm, 3)); CHECKCWID(extext, GTK_IS_EXTEXT); CHECKOPT2(2, MAP_t, NUMERIC_t); CHECKCWID(widget, GTK_IS_WIDGET); CHECKOPT2(3, MAP_t, NUMERIC_t); CHECKCWID(marginmenu, GTK_IS_WIDGET); gtk_extext_set_popup_menu(GTK_EXTEXT(extext->widget), GTK_WIDGET(widget->widget), GTK_WIDGET(marginmenu->widget)); return 0; err: return 1; }
int clip_GTK_EXTEXTINSERT(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gchar *chars = _clip_parc(cm, 2); gint len ; CHECKCWID(extext, GTK_IS_EXTEXT); CHECKARG(2, CHARACTER_t); len = strlen(chars); gtk_extext_insert(GTK_EXTEXT(extext->widget), chars, len); return 0; err: return 1; }
int clip_GTK_EXTEXTINSERTTEXT(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); const gchar *new_text = _clip_parc(cm, 2); gint new_text_len = _clip_parni(cm, 3); gint position; CHECKCWID(extext, GTK_IS_EXTEXT); CHECKARG(2, CHARACTER_t); CHECKOPT(3, NUMERIC_t); gtk_extext_insert_text(GTK_EXTEXT(extext->widget), new_text, new_text_len, &position); _clip_retni(cm, position); return 0; err: return 1; }
int clip_GTK_EXTEXTSTYLEGET(ClipMachine * cm) { C_widget *extext = _fetch_cw_arg(cm); gchar *stylename = _clip_parc(cm, 2); ClipVar *exstyle = RETPTR(cm); GtkExTextStyle *style; CHECKCWID(extext, GTK_IS_EXTEXT); CHECKARG(2, CHARACTER_t); memset(exstyle,0,sizeof(*exstyle)); _clip_map(cm,exstyle); style = gtk_extext_style_get(GTK_EXTEXT(extext->widget), stylename); _extext_style_to_map(cm, style, exstyle); return 0; err: return 1; }