static int iScintillaSetMarkerDeleteAllAttrib(Ihandle* ih, const char* value) { int markerNumber; iupStrToInt(value, &markerNumber); IupScintillaSendMessage(ih, SCI_MARKERDELETEALL, markerNumber, 0); return 0; }
static int iScintillaSetWSSizeAttrib(Ihandle *ih, const char *value) { int size; if (!iupStrToInt(value, &size)) return 0; IupScintillaSendMessage(ih, SCI_SETWHITESPACESIZE, size, 0); return 0; }
static int iScintillaSetPrependTextAttrib(Ihandle* ih, const char* value) { ih->data->ignore_change = 1; if (ih->data->append_newline) iScintillAppendNewLine(ih, 0); /* after the prepended text (between prepended and current text) */ IupScintillaSendMessage(ih, SCI_INSERTTEXT, 0, (sptr_t)value); /* at the begin */ ih->data->ignore_change = 0; return 0; }
static char* iScintillaGetFontSizeStyleAttrib(Ihandle* ih, int style) { int size; if(style == IUP_INVALID_ID) style = 0; /* Lexer style default */ size = (int)IupScintillaSendMessage(ih, SCI_STYLEGETSIZE, style, 0); return iupStrReturnInt(size); }
static int iScintillaSetWSExtraDescentAttrib(Ihandle *ih, const char *value) { int desc; if (!iupStrToInt(value, &desc)) return 0; IupScintillaSendMessage(ih, SCI_SETEXTRADESCENT, desc, 0); return 0; }
static int iScintillaSetMarkerAddAttribId(Ihandle* ih, int line, const char* value) { int markerNumber, markerID; iupStrToInt(value, &markerNumber); markerID = IupScintillaSendMessage(ih, SCI_MARKERADD, line, markerNumber); iupAttribSetInt(ih, "LASTMARKERADDHANDLE", markerID); return 0; }
static int iScintillaSetDeleteRangeAttrib(Ihandle* ih, const char* value) { int pos, len; iupStrToIntInt(value, &pos, &len, ','); ih->data->ignore_change = 1; IupScintillaSendMessage(ih, SCI_DELETERANGE, pos, len); ih->data->ignore_change = 0; return 0; }
static int iScintillaSetMarkerPreviousAttribId(Ihandle* ih, int lineStart, const char* value) { int markerMask, last_marker_found; iupStrToInt(value, &markerMask); last_marker_found = IupScintillaSendMessage(ih, SCI_MARKERPREVIOUS, lineStart, markerMask); iupAttribSetInt(ih, "LASTMARKERFOUND", last_marker_found); return 0; }
static char* iScintillaGetFontSizeFracStyleAttrib(Ihandle* ih, int style) { int size; if(style == IUP_INVALID_ID) style = 0; /* Lexer style default */ size = (int)IupScintillaSendMessage(ih, SCI_STYLESETSIZEFRACTIONAL, style, 0); return iupStrReturnDouble((double)size / (double)SC_FONT_SIZE_MULTIPLIER); }
static int iScintillaSetPropertyAttrib(Ihandle* ih, const char* value) { char strKey[50]; char strVal[50]; iupStrToStrStr(value, strKey, strVal, '='); IupScintillaSendMessage(ih, SCI_SETPROPERTY, (uptr_t)strKey, (sptr_t)strVal); return 0; }
static int iScintillaSetMarkerBgColorSelectedAttribId(Ihandle* ih, int markerNumber, const char* value) { unsigned char r, g, b; if (!iupStrToRGB(value, &r, &g, &b)) return 0; IupScintillaSendMessage(ih, SCI_MARKERSETBACKSELECTED, markerNumber, iupScintillaEncodeColor(r, g, b)); return 0; }
static char* iScintillaGetFontStyleAttrib(Ihandle* ih, int style) { char* str = iupStrGetMemory(15); if(style == IUP_INVALID_ID) style = 0; /* Lexer style default */ IupScintillaSendMessage(ih, SCI_STYLEGETFONT, style, (sptr_t)str); return str; }
static char* iScintillaGetWordWrapAttrib(Ihandle *ih) { int type = IupScintillaSendMessage(ih, SCI_GETWRAPMODE, 0, 0); if(type == SC_WRAP_WORD) return "WORD"; else if(type == SC_WRAP_CHAR) return "CHAR"; else return "NONE"; }
static int iScintillaSetSearchInTargetAttrib(Ihandle* ih, const char* value) { int len = strlen(value); if (!value) return 0; IupScintillaSendMessage(ih, SCI_SEARCHINTARGET, len, (sptr_t)value); return 0; }
static int iScintillaSetRGBAImageSetScale(Ihandle* ih, const char* value) { int scale; iupStrToInt(value, &scale); if(scale <= 0) scale = 1; IupScintillaSendMessage(ih, SCI_RGBAIMAGESETSCALE, scale, 0); return 0; }
static int iScintillaSetMarkerAlphaAttribId(Ihandle* ih, int markerNumber, const char* value) { int alpha; iupStrToInt(value, &alpha); if (alpha < 0 || alpha > 255) return 0; IupScintillaSendMessage(ih, SCI_MARKERSETALPHA, markerNumber, alpha); return 0; }
static char* iScintillaGetBgColorStyleAttrib(Ihandle* ih, int style) { long color; unsigned char r, g, b; if(style == IUP_INVALID_ID) style = 0; /* Lexer style default */ color = (int)IupScintillaSendMessage(ih, SCI_STYLEGETBACK, style, 0); iupScintillaDecodeColor(color, &r, &g, &b); return iupStrReturnRGB(r, g, b); }
static int iScintillaSetAppendTextAttrib(Ihandle* ih, const char* value) { int len = (int)strlen(value); ih->data->ignore_change = 1; if(ih->data->append_newline) iScintillAppendNewLine(ih, 1); /* before the appended text (between current and appended text) */ IupScintillaSendMessage(ih, SCI_APPENDTEXT, len, (sptr_t)value); /* at the end */ ih->data->ignore_change = 0; return 0; }
static int iScintillaSetScrollWidthAttrib(Ihandle* ih, const char* value) { int pixelWidth; iupStrToInt(value, &pixelWidth); if(pixelWidth < 1) pixelWidth = 2000; IupScintillaSendMessage(ih, SCI_SETSCROLLWIDTH, pixelWidth, 0); return 0; }
static char* iScintillaGetWordWrapVisualFlagsAttrib(Ihandle *ih) { int type = IupScintillaSendMessage(ih, SCI_GETWRAPVISUALFLAGS, 0, 0); if(type == SC_WRAPVISUALFLAG_MARGIN) return "MARGIN"; else if(type == SC_WRAPVISUALFLAG_START) return "START"; else if(type == SC_WRAPVISUALFLAG_END) return "END"; else return "NONE"; }
static int iScintillaSetMarkerDefineRGBAImageId(Ihandle* ih, int markerNumber, const char* value) { Ihandle* ih_image = IupGetHandle(value); if (ih_image) { int bpp = IupGetInt(ih_image, "BPP"); if (bpp == 32) { unsigned char* imgdata = (unsigned char*)IupGetAttribute(ih, "WID"); if (imgdata) { int w = IupGetInt(ih, "WIDTH"); int h = IupGetInt(ih, "HEIGHT"); IupScintillaSendMessage(ih, SCI_RGBAIMAGESETWIDTH, w, 0); IupScintillaSendMessage(ih, SCI_RGBAIMAGESETHEIGHT, h, 0); IupScintillaSendMessage(ih, SCI_MARKERDEFINERGBAIMAGE, markerNumber, (sptr_t)imgdata); } } } return 0; }
static int iScintillaSetFontSizeStyleAttrib(Ihandle* ih, int style, const char* value) { int size; if(style == IUP_INVALID_ID) style = 0; /* Lexer style default */ iupStrToInt(value, &size); IupScintillaSendMessage(ih, SCI_STYLESETSIZE, style, size); return 0; }
static int iScintillaSetFontSizeFracStyleAttrib(Ihandle* ih, int style, const char* value) { double size; if(style == IUP_INVALID_ID) style = 0; /* Lexer style default */ iupStrToDouble(value, &size); IupScintillaSendMessage(ih, SCI_STYLESETSIZEFRACTIONAL, style, (int)(size*SC_FONT_SIZE_MULTIPLIER)); return 0; }
static int iScintillaSetBgColorStyleAttrib(Ihandle* ih, int style, const char* value) { unsigned char r, g, b; if (!iupStrToRGB(value, &r, &g, &b)) return 0; if(style == IUP_INVALID_ID) style = 0; /* Lexer style default */ IupScintillaSendMessage(ih, SCI_STYLESETBACK, style, iupScintillaEncodeColor(r, g, b)); return 0; }
static int iScintillaSetTargetStartAttrib(Ihandle* ih, const char* value) { int start; if (!value) return 0; iupStrToInt(value, &start); if (start < 1) start = 1; IupScintillaSendMessage(ih, SCI_SETTARGETSTART, start, 0); return 0; }
static int iScintillaSetAutoCMaxHeightAttrib(Ihandle* ih, const char* value) { int rowCount = 1; if (!value) return 0; iupStrToInt(value, &rowCount); if (rowCount < 1) rowCount = 1; IupScintillaSendMessage(ih, SCI_AUTOCSETMAXHEIGHT, rowCount, 0); return 0; }
static int iScintillaSetAutoCMaxWidthAttrib(Ihandle* ih, const char* value) { int charCount = 0; if (!value) return 0; iupStrToInt(value, &charCount); if (charCount < 0) charCount = 0; IupScintillaSendMessage(ih, SCI_AUTOCSETMAXWIDTH, charCount, 0); return 0; }
static char* iScintillaGetCaseStyleAttrib(Ihandle* ih, int style) { int caseSty; if(style == IUP_INVALID_ID) style = 0; /* Lexer style default */ caseSty = (int)IupScintillaSendMessage(ih, SCI_STYLEGETCASE, style, 0); if(caseSty == SC_CASE_UPPER) return "UPPERCASE"; else if(caseSty == SC_CASE_LOWER) return "LOWERCASE"; else return "SC_CASE_MIXED"; }
static int iScintillaSetBgColorAttrib(Ihandle *ih, const char *value) { unsigned char r, g, b; long fgcolor; int i; if (!iupStrToRGB(value, &r, &g, &b)) return 0; fgcolor = iupScintillaEncodeColor(r, g, b); for (i = 0; i < 256; i++) IupScintillaSendMessage(ih, SCI_STYLESETBACK, i, fgcolor); return 1; }
static char* iScintillaGetCharSetStyleAttrib(Ihandle* ih, int style) { int charset; if(style == IUP_INVALID_ID) style = 0; /* Lexer style default */ charset = (int)IupScintillaSendMessage(ih, SCI_STYLEGETCHARACTERSET, style, 0); if(charset == SC_CHARSET_EASTEUROPE) return "EASTEUROPE"; else if(charset == SC_CHARSET_RUSSIAN) return "RUSSIAN"; else if(charset == SC_CHARSET_GB2312) return "GB2312"; else if(charset == SC_CHARSET_HANGUL) return "HANGUL"; else if(charset == SC_CHARSET_SHIFTJIS) return "SHIFTJIS"; else return "ANSI"; }