Ejemplo n.º 1
0
static void language_css_setup_lexer(Language_Provider *lgcss)
{
    g_return_if_fail(lgcss);
    Language_CSSDetails *lgcssdet = LANGUAGE_CSS_GET_PRIVATE(lgcss);

    gtk_scintilla_clear_document_style (lgcssdet->sci);
    gtk_scintilla_set_lexer(lgcssdet->sci, SCLEX_CSS);
    gtk_scintilla_set_style_bits(lgcssdet->sci, 5);

    gtk_scintilla_set_keywords(lgcssdet->sci, 0, "aqua auto background background-attachment background-color background-image background-position background-repeat baseline black blink block blue bold bolder border border-bottom border-bottom-width border-color border-left border-left-width border-right border-right-width border-style border-top border-top-width border-width both bottom capitalize center circle clear color dashed decimal disc display dotted double fixed float font font-family font-size font-style font-variant font-weight fuchsia gray green groove height inline inset inside italic justify large larger left letter-spacing lighter lime line-height line-through list-item list-style list-style-image list-style-position list-style-type lower-alpha lower-roman lowercase margin margin-bottom margin-left margin-right margin-top maroon medium medium middle navy no-repeat no-wrap none normal oblique olive outset outside overline padding padding-bottom padding-left padding-right padding-top pre purple red repeat repeat-x repeat-y ridge right scroll silver small small-caps smaller solid square sub super teal text-align text-bottom text-decoration text-indent text-top text-transform thick thin top transparent underline upper-alpha upper-roman uppercase vertical-align white white-space width word-spacing x-large x-small xx-large xx-small yellow");
    gtk_scintilla_set_keywords(lgcssdet->sci, 1, "active after before first first-child first-letter first-line focus hover lang left link right visited");
    gtk_scintilla_set_keywords(lgcssdet->sci, 2, "ActiveBorder ActiveCaption AppWorkspace Background ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightText InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLightShadow ThreeDShadow Window WindowFrame WindowText above absolute always armenian ascent avoid azimuth baseline bbox behind below bidi-override border-bottom-color border-bottom-style border-collapse border-color border-left-color border-left-style border-right-color border-right-style border-spacing border-style border-top-color border-top-style bottom cap-height caption caption-side center-left center-right centerline child cjk-ideographic clip close-quote code collapse compact condensed content continous counter-increment counter-reset crop cross crosshair cue cue-after cue-before cursor decimal-leading-zero default definition-src descent digits direction e-resize elevation embed empty-cells expanded extra-condensed extra-expanded far-left far-right fast faster female fixed font-size-adjust font-stretch georgian hebrew help hidden hide high higher hiragana hiragana-iroha icon inherit inline-table katakana katakana-iroha landscape left left-side leftwards level loud low lower lower-greek lower-latin ltr male marker marker-offset marks mathline max-height max-width medium medium menu message-box min-height min-width mix move n-resize narrower ne-resize no-close-quote no-open-quote nw-resize once open-quote orphans outline outline-color outline-style outline-width overflow page page-break-after page-break-before page-break-inside panose-1 pause pause-after pause-before pitch pitch-range play-during pointer portrait position quotes relative richness right right-side rightwards rtl run-in s-resize scroll se-resize semi-condensed semi-expanded separate show silent size slope slow slower small-caption soft speak speak-header speak-numeral speak-punctuation speech-rate spell-out src static status-bar stemh stemv stress sw-resize table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-layout table-row table-row-group text text-shadow top topline ultra-condensed ultra-expanded unicode-bidi unicode-range units-per-em upper-latin visibility visible voice-family volume w-resize wait wider widows widths x-fast x-height x-high x-loud x-low x-slow x-soft z-index");
    gtk_scintilla_set_keywords(lgcssdet->sci, 4, "@charset @font-face @import @media @page");

    gchar *font;
    guint size;
    g_object_get(lgcssdet->prefmg, "style_font_name", &font,"font_size", &size, NULL);

    gchar *style_name;
    g_object_get(lgcssdet->prefmg, "style_name", &style_name, NULL);

    GtkSourceStyleScheme	*scheme = gtk_source_style_scheme_manager_get_scheme (main_window.stylemg, style_name);
    /* COBOL LEXER STYLE */
    set_scintilla_lexer_default_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_DEFAULT, font, size);
    set_scintilla_lexer_keyword_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_TAG, font, size);
    set_scintilla_lexer_variable_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_CLASS, font, size);
    set_scintilla_lexer_preprocessor_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_PSEUDOCLASS, font, size);
    set_scintilla_lexer_xml_element_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_UNKNOWN_PSEUDOCLASS, font, size);
    set_scintilla_lexer_operator_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_OPERATOR, font, size);
    set_scintilla_lexer_keyword_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_IDENTIFIER, font, size);
    set_scintilla_lexer_xml_element_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_UNKNOWN_IDENTIFIER, font, size);
    set_scintilla_lexer_string_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_C_STRING, font, size);
    set_scintilla_lexer_simple_string_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_ID, font, size);
    set_scintilla_lexer_number_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_VALUE, font, size);
    set_scintilla_lexer_comment_style (GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_COMMENT, font, size);
    set_scintilla_lexer_special_constant_style (GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_IMPORTANT, font, size);
    set_scintilla_lexer_special_constant_style (GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_MEDIA, font, size);
    set_scintilla_lexer_xml_instruction_style(GTK_WIDGET(lgcssdet->sci), scheme, SCE_CSS_DIRECTIVE, font, size);

    g_free(font);
    g_free(style_name);

    gtk_scintilla_colourise(lgcssdet->sci, 0, -1);

    gtk_scintilla_set_property(lgcssdet->sci, "fold.comment", "1");
    gtk_scintilla_set_property(lgcssdet->sci, "fold.css", "1");
    gtk_scintilla_set_property(lgcssdet->sci, "fold", "1");

    gtk_scintilla_autoc_set_fill_ups(lgcssdet->sci, ":");
    gtk_scintilla_set_word_chars(lgcssdet->sci, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-");
}
Ejemplo n.º 2
0
static void language_cobol_setup_lexer(Language_Provider *lgcobol)
{
  g_return_if_fail(lgcobol);
  Language_COBOLDetails *lgcoboldet = LANGUAGE_COBOL_GET_PRIVATE(lgcobol);

  gtk_scintilla_clear_document_style (lgcoboldet->sci);
  gtk_scintilla_set_lexer(lgcoboldet->sci, SCLEX_COBOL);
  gtk_scintilla_set_style_bits(lgcoboldet->sci, 7);

  gtk_scintilla_set_keywords(lgcoboldet->sci, 0, "configuration data declaratives division environment environment-division file file-control function i-o i-o-control identification input input-output linkage local-storage output procedure program program-id receive-control section special-names working-storage");
  gtk_scintilla_set_keywords(lgcoboldet->sci, 1, "accept add alter apply assign call chain close compute continue control convert copy count delete display divide draw drop eject else enable end-accept end-add end-call end-chain end-compute end-delete end-display end-divide end-evaluate end-if end-invoke end-multiply end-perform end-read end-receive end-return end-rewrite end-search end-start end-string end-subtract end-unstring end-write erase evaluate examine exec execute exit go goback generate if ignore initialize initiate insert inspect invoke leave merge move multiply open otherwise perform print read receive release reload replace report reread rerun reserve reset return rewind rewrite rollback run search seek select send set sort start stop store string subtract sum suppress terminate then transform unlock unstring update use wait when wrap write");
  gtk_scintilla_set_keywords(lgcoboldet->sci, 2, "a access acquire actual address advancing after all allowing alphabet alphabetic alphabetic-lower alphabetic-upper alphanumeric alphanumeric-edited also alternate and any are area areas as ascending at attribute author auto auto-hyphen-skip auto-skip automatic autoterminate background-color background-colour backward basis beep before beginning bell binary blank blink blinking block bold bottom box boxed by c01 c02 c03 c04 c05 c06 c07 c08 c09 c10 c11 c12 cancel cbl cd centered cf ch chaining changed character characters chart class clock-units cobol code code-set col collating color colour column com-reg comma command-line commit commitment common communication comp comp-0 comp-1 comp-2 comp-3 comp-4 comp-5 comp-6 comp-x compression computational computational-1 computational-2 computational-3 computational-4 computational-5 computational-6 computational-x computational console contains content control-area controls conversion converting core-index corr corresponding crt crt-under csp currency current-date cursor cycle cyl-index cyl-overflow date date-compiled date-written day day-of-week dbcs de debug debug-contents debug-item debug-line debug-name debug-sub-1 debug-sub-2 debug-sub-3 debugging decimal-point default delimited delimiter depending descending destination detail disable disk disp display-1 display-st down duplicates dynamic echo egcs egi emi empty-check encryption end end-of-page ending enter entry eol eop eos equal equals error escape esi every exceeds exception excess-3 exclusive exhibit extend extended-search external externally-described-key factory false fd fh--fcd fh--keydef file-id file-limit file-limits file-prefix filler final first fixed footing for foreground-color foreground-colour footing format from full giving global greater grid group heading high high-value high-values highlight id in index indexed indic indicate indicator indicators inheriting initial installation into invalid invoked is japanese just justified kanji kept key keyboard label last leading left left-justify leftline length length-check less limit limits lin linage linage-counter line line-counter lines lock lock-holding locking low low-value low-values lower lowlight manual mass-update master-index memory message method mode modified modules more-labels multiple name named national national-edited native nchar negative next no no-echo nominal not note nstd-reels null nulls number numeric numeric-edited numeric-fill o-fill object object-computer object-storage occurs of off omitted on oostackptr optional or order organization other others overflow overline packed-decimal padding page page-counter packed-decimal paragraph password pf ph pic picture plus pointer pop-up pos position positioning positive previous print-control print-switch printer printer-1 printing prior private procedure-pointer procedures proceed process processing prompt protected public purge queue quote quotes random range rd readers ready record record-overflow recording records redefines reel reference references relative remainder remarks removal renames reorg-criteria repeated replacing reporting reports required resident return-code returning reverse reverse-video reversed rf rh right right-justify rolling rounded s01 s02 s03 s04 s05 same screen scroll sd secure security segment segment-limit selective self selfclass sentence separate sequence sequential service setshadow shift-in shift-out sign size skip1 skip2 skip3 sort-control sort-core-size sort-file-size sort-merge sort-message sort-mode-size sort-option sort-return source source-computer space spaces space-fill spaces standard standard-1 standard-2 starting status sub-queue-1 sub-queue-2 sub-queue-3 subfile super symbolic sync synchronized sysin sysipt syslst sysout syspch syspunch system-info tab tallying tape terminal terminal-info test text than through thru time time-of-day time-out timeout times title to top totaled totaling trace track-area track-limit tracks trailing trailing-sign transaction true type typedef underline underlined unequal unit until up updaters upon upper upsi-0 upsi-1 upsi-2 upsi-3 upsi-4 upsi-5 upsi-6 upsi-7 usage user using value values variable varying when-compiled window with words write-only write-verify writerszero x zero zero-fill zeros zeroes");

  gchar *font;
  guint size;
  g_object_get(lgcoboldet->prefmg, "style_font_name", &font,"font_size", &size, NULL);

  gchar *style_name;
  g_object_get(lgcoboldet->prefmg, "style_name", &style_name, NULL);

  GtkSourceStyleScheme	*scheme = gtk_source_style_scheme_manager_get_scheme (main_window.stylemg, style_name);
  /* COBOL LEXER STYLE */
  set_scintilla_lexer_default_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_DEFAULT, font, size);
  set_scintilla_lexer_variable_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_WORD, font, size);
  set_scintilla_lexer_variable_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_WORD2, font, size);
  set_scintilla_lexer_string_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_STRING, font, size);
  set_scintilla_lexer_simple_string_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_CHARACTER, font, size);
  set_scintilla_lexer_operator_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_OPERATOR, font, size);
  set_scintilla_lexer_number_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_NUMBER, font, size);
  set_scintilla_lexer_comment_style (GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_COMMENT, font, size);
  set_scintilla_lexer_comment_style (GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_COMMENTLINE, font, size);
  set_scintilla_lexer_doc_comment_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_COMMENTDOC, font, size);
  set_scintilla_lexer_type_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_IDENTIFIER, font, size);
  set_scintilla_lexer_preprocessor_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_PREPROCESSOR, font, size);
  set_scintilla_lexer_xml_element_style(GTK_WIDGET(lgcoboldet->sci), scheme, SCE_C_UUID, font, size);

  g_free(font);
  g_free(style_name);

  gtk_scintilla_set_property(lgcoboldet->sci, "fold.compact", "1");
  gtk_scintilla_set_property(lgcoboldet->sci, "fold", "1");
  gtk_scintilla_colourise(lgcoboldet->sci, 0, -1);

  gtk_scintilla_set_word_chars(GTK_SCINTILLA(lgcoboldet->sci), "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-");  
}
Ejemplo n.º 3
0
void tab_sql_set_lexer(Document *document)
{
  Preferences_Manager *prefmg = preferences_manager_new ();
  GtkScintilla *scintilla = document_get_scintilla(document);
  gtk_scintilla_clear_document_style (scintilla);
  gtk_scintilla_set_lexer(scintilla, SCLEX_SQL);
  gtk_scintilla_set_style_bits(scintilla, 5);

  gchar *font =NULL;
  gint size, fore, back;
  gboolean italic, bold;

  get_preferences_manager_style_settings(prefmg, "c_default", &font , &size, &fore, &back, &italic, &bold);

  gtk_scintilla_style_set_font (scintilla,  SCE_C_DEFAULT, font);
  gtk_scintilla_style_set_fore (scintilla,  SCE_C_DEFAULT, fore);
  gtk_scintilla_style_set_back (scintilla,  SCE_C_DEFAULT, back);
  gtk_scintilla_style_set_size (scintilla,  SCE_C_DEFAULT, size);
  gtk_scintilla_style_set_italic (scintilla,  SCE_C_DEFAULT, italic);
  gtk_scintilla_style_set_bold (scintilla,  SCE_C_DEFAULT, bold);

  get_preferences_manager_style_settings(prefmg, "php_default", &font , &size, &fore, &back, &italic, &bold);

  gtk_scintilla_style_set_font (scintilla,  STYLE_BRACELIGHT, font);
  gtk_scintilla_style_set_fore (scintilla,  STYLE_BRACELIGHT, 16711680);// Matching bracket
  if(get_preferences_manager_higthlight_caret_line (prefmg))
    gtk_scintilla_style_set_back (scintilla,  STYLE_BRACELIGHT, get_preferences_manager_higthlight_caret_line_color(prefmg));
  else
    gtk_scintilla_style_set_back (scintilla,  STYLE_BRACELIGHT, back);
  gtk_scintilla_style_set_size (scintilla,  STYLE_BRACELIGHT, size);
  gtk_scintilla_style_set_italic (scintilla,  STYLE_BRACELIGHT, italic);
  gtk_scintilla_style_set_bold (scintilla,  STYLE_BRACELIGHT, TRUE);
  gtk_scintilla_style_set_font (scintilla,  STYLE_BRACEBAD, font);
  gtk_scintilla_style_set_fore (scintilla,  STYLE_BRACEBAD, 255);
  if(get_preferences_manager_higthlight_caret_line (prefmg))
    gtk_scintilla_style_set_back (scintilla,  STYLE_BRACEBAD, get_preferences_manager_higthlight_caret_line_color(prefmg));
  else
    gtk_scintilla_style_set_back (scintilla,  STYLE_BRACEBAD, back);
  gtk_scintilla_style_set_size (scintilla,  STYLE_BRACEBAD, size);
  gtk_scintilla_style_set_italic (scintilla,  STYLE_BRACEBAD, italic);
  gtk_scintilla_style_set_bold (scintilla,  STYLE_BRACEBAD, TRUE);

  gtk_scintilla_set_keywords(scintilla, 0, "ADD ALL ALTER ANALYZE AND AS ASC ASENSITIVE AUTO_INCREMENT BDB BEFORE BERKELEYDB BETWEEN BIGINT BINARY BLOB BOTH BTREE BY CALL CASCADE CASE CHANGE CHAR CHARACTER CHECK COLLATE COLUMN COLUMNS CONNECTION CONSTRAINT CREATE CROSS CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURSOR DATABASE DATABASES DAY_HOUR DAY_MINUTE DAY_SECOND DEC DECIMAL DECLARE DEFAULT DELAYED DELETE DESC DESCRIBE DISTINCT DISTINCTROW DIV DOUBLE DROP ELSE ELSEIF ENCLOSED ERRORS ESCAPED EXISTS EXPLAIN FALSE FIELDS FLOAT FOR FORCE FOREIGN FROM FULLTEXT GRANT GROUP HASH HAVING HIGH_PRIORITY HOUR_MINUTE HOUR_SECOND IF IGNORE IN INDEX INFILE INNER INNODB INOUT INSENSITIVE INSERT INT INTEGER INTERVAL INTO IS ITERATE JOIN KEY KEYS KILL LEADING LEAVE LEFT LIKE LIMIT LINES LOAD LOCALTIME LOCALTIMESTAMP LOCK LONG LONGBLOB LONGTEXT LOOP LOW_PRIORITY MASTER_SERVER_ID MATCH MEDIUMBLOB MEDIUMINT MEDIUMTEXT MIDDLEINT MINUTE_SECOND MOD MRG_MYISAM NATURAL NOT NULL NUMERIC ON OPTIMIZE OPTION OPTIONALLY OR ORDER OUT OUTER OUTFILE PRECISION PRIMARY PRIVILEGES PROCEDURE PURGE READ REAL REFERENCES REGEXP RENAME REPEAT REPLACE REQUIRE RESTRICT RETURN RETURNS REVOKE RIGHT RLIKE RTREE SELECT SENSITIVE SEPARATOR SET SHOW SMALLINT SOME SONAME SPATIAL SPECIFIC SQL_BIG_RESULT SQL_CALC_FOUND_ROWS SQL_SMALL_RESULT SSL STARTING STRAIGHT_JOIN STRIPED TABLE TABLES TERMINATED THEN TINYBLOB TINYINT TINYTEXT TO TRAILING TRUE TYPES UNION UNIQUE UNLOCK UNSIGNED UNTIL UPDATE USAGE USE USER_RESOURCES USING VALUES VARBINARY VARCHAR VARCHARACTER VARYING WARNINGS WHEN WHERE WHILE WITH WRITE XOR YEAR_MONTH ZEROFILL");

  get_preferences_manager_style_settings(prefmg, "sql_word", &font , &size, &fore, &back, &italic, &bold);

  gtk_scintilla_style_set_back (scintilla, SCE_C_WORD, back);
  gtk_scintilla_style_set_font (scintilla, SCE_C_WORD, font);
  gtk_scintilla_style_set_fore (scintilla, SCE_C_WORD, fore);
  gtk_scintilla_style_set_size (scintilla, SCE_C_WORD, size);
  gtk_scintilla_style_set_italic (scintilla, SCE_C_WORD, italic);
  gtk_scintilla_style_set_bold (scintilla, SCE_C_WORD, bold);

  get_preferences_manager_style_settings(prefmg, "sql_string", &font , &size, &fore, &back, &italic, &bold);

  gtk_scintilla_style_set_fore (scintilla, SCE_C_STRING, fore);
  gtk_scintilla_style_set_font (scintilla, SCE_C_STRING, font);
  gtk_scintilla_style_set_back (scintilla, SCE_C_STRING, back);
  gtk_scintilla_style_set_size (scintilla, SCE_C_STRING, size);
  gtk_scintilla_style_set_italic (scintilla, SCE_C_STRING, italic);
  gtk_scintilla_style_set_bold (scintilla, SCE_C_STRING, bold);

  get_preferences_manager_style_settings(prefmg, "sql_operator", &font , &size, &fore, &back, &italic, &bold);

  gtk_scintilla_style_set_fore (scintilla, SCE_C_OPERATOR, fore);
  gtk_scintilla_style_set_font (scintilla, SCE_C_OPERATOR, font);
  gtk_scintilla_style_set_back (scintilla, SCE_C_OPERATOR, back);
  gtk_scintilla_style_set_size (scintilla, SCE_C_OPERATOR, size);
  gtk_scintilla_style_set_italic (scintilla, SCE_C_OPERATOR, italic);
  gtk_scintilla_style_set_bold (scintilla, SCE_C_OPERATOR, bold);

  get_preferences_manager_style_settings(prefmg, "sql_comment", &font , &size, &fore, &back, &italic, &bold);

  gtk_scintilla_style_set_fore (scintilla, SCE_C_COMMENT, fore);
  gtk_scintilla_style_set_font (scintilla, SCE_C_COMMENT, font);
  gtk_scintilla_style_set_back (scintilla, SCE_C_COMMENT, back);
  gtk_scintilla_style_set_size (scintilla, SCE_C_COMMENT, size);
  gtk_scintilla_style_set_italic (scintilla, SCE_C_COMMENT, italic);
  gtk_scintilla_style_set_bold (scintilla, SCE_C_COMMENT, bold);

  gtk_scintilla_style_set_fore (scintilla, SCE_C_COMMENTLINE, fore);
  gtk_scintilla_style_set_font (scintilla, SCE_C_COMMENTLINE, font);
  gtk_scintilla_style_set_back (scintilla, SCE_C_COMMENTLINE, back);
  gtk_scintilla_style_set_size (scintilla, SCE_C_COMMENTLINE, size);
  gtk_scintilla_style_set_italic (scintilla, SCE_C_COMMENTLINE, italic);
  gtk_scintilla_style_set_bold (scintilla, SCE_C_COMMENTLINE, bold);

  get_preferences_manager_style_settings(prefmg, "sql_number", &font , &size, &fore, &back, &italic, &bold);

  gtk_scintilla_style_set_fore (scintilla, SCE_C_NUMBER, fore);
  gtk_scintilla_style_set_font (scintilla, SCE_C_NUMBER, font);
  gtk_scintilla_style_set_back (scintilla, SCE_C_NUMBER, back);
  gtk_scintilla_style_set_size (scintilla, SCE_C_NUMBER, size);
  gtk_scintilla_style_set_italic (scintilla, SCE_C_NUMBER, italic);
  gtk_scintilla_style_set_bold (scintilla, SCE_C_NUMBER, bold);

  get_preferences_manager_style_settings(prefmg, "sql_identifier", &font , &size, &fore, &back, &italic, &bold);

  gtk_scintilla_style_set_fore (scintilla, SCE_C_IDENTIFIER, fore);
  gtk_scintilla_style_set_font (scintilla, SCE_C_IDENTIFIER, font);
  gtk_scintilla_style_set_back (scintilla, SCE_C_IDENTIFIER, back);
  gtk_scintilla_style_set_size (scintilla, SCE_C_IDENTIFIER, size);
  gtk_scintilla_style_set_italic (scintilla, SCE_C_IDENTIFIER, italic);
  gtk_scintilla_style_set_bold (scintilla, SCE_C_IDENTIFIER, bold);

  gtk_scintilla_colourise(scintilla, 0, -1);
  g_object_unref(prefmg);
}
Ejemplo n.º 4
0
void scintilla_python_set_lexer(GtkScintilla *scintilla, Preferences prefs)
{
	gtk_scintilla_clear_document_style (scintilla);
	// Don't know why - but it doesn't highlight if the next line is SCLEX_PYTHON
	gtk_scintilla_set_lexer(scintilla, SCLEX_PERL);
	gtk_scintilla_set_style_bits(scintilla, 5);

	/* Example style setting up code! */
    gtk_scintilla_autoc_set_choose_single (scintilla, TRUE);
    gtk_scintilla_set_use_tabs (scintilla, 1);
    gtk_scintilla_set_tab_indents (scintilla, 1);
    gtk_scintilla_set_backspace_unindents (scintilla, 1);
	gtk_scintilla_set_tab_width (scintilla, prefs.indentation_size);
    gtk_scintilla_set_indent (scintilla, prefs.tab_size);

    gtk_scintilla_style_set_font (scintilla, STYLE_DEFAULT, prefs.default_font);
    gtk_scintilla_style_set_size (scintilla, STYLE_DEFAULT, prefs.default_size);
    gtk_scintilla_style_set_italic (scintilla, STYLE_DEFAULT, prefs.default_italic);
    gtk_scintilla_style_set_bold (scintilla, STYLE_DEFAULT, prefs.default_bold);
    gtk_scintilla_style_set_fore (scintilla, STYLE_DEFAULT, prefs.default_fore);
    gtk_scintilla_style_set_back (scintilla, STYLE_DEFAULT, prefs.default_back);

    gtk_scintilla_style_set_font (scintilla, SCE_P_DEFAULT, prefs.php_default_font);
    gtk_scintilla_style_set_fore (scintilla, SCE_P_DEFAULT, prefs.php_default_fore);
    gtk_scintilla_style_set_back (scintilla, SCE_P_DEFAULT, prefs.php_default_back);
    gtk_scintilla_style_set_size (scintilla, SCE_P_DEFAULT, prefs.php_default_size);
    gtk_scintilla_style_set_italic (scintilla, SCE_P_DEFAULT, prefs.php_default_italic);
    gtk_scintilla_style_set_bold (scintilla, SCE_P_DEFAULT, prefs.php_default_bold);

	//gtk_scintilla_set_sel_back (GTK_SCINTILLA(editor->scintilla), TRUE, prefs.set_sel_back);
    //gtk_scintilla_marker_set_back (GTK_SCINTILLA(editor->scintilla), TRUE, prefs.marker_back);

    gtk_scintilla_set_caret_fore (scintilla, 0);
    gtk_scintilla_set_caret_width (scintilla, 2);
    gtk_scintilla_set_caret_period (scintilla, 250);

    gtk_scintilla_style_set_font (scintilla, STYLE_BRACELIGHT, prefs.php_default_font);
    gtk_scintilla_style_set_fore (scintilla, STYLE_BRACELIGHT, 16711680);// Matching bracket
    gtk_scintilla_style_set_back (scintilla, STYLE_BRACELIGHT, prefs.php_default_back);
    gtk_scintilla_style_set_size (scintilla, STYLE_BRACELIGHT, prefs.php_default_size);
    gtk_scintilla_style_set_italic (scintilla, STYLE_BRACELIGHT, prefs.php_default_italic);
    gtk_scintilla_style_set_bold (scintilla, STYLE_BRACELIGHT, TRUE);
    gtk_scintilla_style_set_font (scintilla, STYLE_BRACEBAD, prefs.php_default_font);
    gtk_scintilla_style_set_fore (scintilla, STYLE_BRACEBAD, 255);
    gtk_scintilla_style_set_back (scintilla, STYLE_BRACEBAD, prefs.php_default_back);
    gtk_scintilla_style_set_size (scintilla, STYLE_BRACEBAD, prefs.php_default_size);
    gtk_scintilla_style_set_italic (scintilla, STYLE_BRACEBAD, prefs.php_default_italic);
    gtk_scintilla_style_set_bold (scintilla, STYLE_BRACEBAD, TRUE);
	
    gtk_scintilla_set_indentation_guides (scintilla, prefs.show_indentation_guides);
    gtk_scintilla_set_edge_mode (scintilla, prefs.edge_mode);
    gtk_scintilla_set_edge_column (scintilla, prefs.edge_column);
    gtk_scintilla_set_edge_colour (scintilla, prefs.edge_colour);
	// Python keywords
	gtk_scintilla_set_keywords(scintilla, 0, "and assert break class continue def del elif else except exec finally for from global if import in is lambda None not or pass print raise return try while yield");
	
    gtk_scintilla_style_set_fore (scintilla, SCE_P_TRIPLEDOUBLE, prefs.php_hstring_fore);
    gtk_scintilla_style_set_font (scintilla, SCE_P_TRIPLEDOUBLE, prefs.php_hstring_font);
    gtk_scintilla_style_set_back (scintilla, SCE_P_TRIPLEDOUBLE, prefs.php_hstring_back);
    gtk_scintilla_style_set_size (scintilla, SCE_P_TRIPLEDOUBLE, prefs.php_hstring_size);
    gtk_scintilla_style_set_italic (scintilla, SCE_P_TRIPLEDOUBLE, prefs.php_hstring_italic);
    gtk_scintilla_style_set_bold (scintilla, SCE_P_TRIPLEDOUBLE, prefs.php_hstring_bold);
    gtk_scintilla_style_set_fore (scintilla, SCE_P_TRIPLE, prefs.php_hstring_fore);
    gtk_scintilla_style_set_font (scintilla, SCE_P_TRIPLE, prefs.php_hstring_font);
    gtk_scintilla_style_set_back (scintilla, SCE_P_TRIPLE, prefs.php_hstring_back);
    gtk_scintilla_style_set_size (scintilla, SCE_P_TRIPLE, prefs.php_hstring_size);
    gtk_scintilla_style_set_italic (scintilla, SCE_P_TRIPLE, prefs.php_hstring_italic);
    gtk_scintilla_style_set_bold (scintilla, SCE_P_TRIPLE, prefs.php_hstring_bold);
    
	gtk_scintilla_style_set_fore (scintilla, SCE_P_STRING, prefs.php_simplestring_fore);
    gtk_scintilla_style_set_font (scintilla, SCE_P_STRING, prefs.php_simplestring_font);
    gtk_scintilla_style_set_back (scintilla, SCE_P_STRING, prefs.php_simplestring_back);
    gtk_scintilla_style_set_size (scintilla, SCE_P_STRING, prefs.php_simplestring_size);
    gtk_scintilla_style_set_italic (scintilla, SCE_P_STRING, prefs.php_simplestring_italic);
    gtk_scintilla_style_set_bold (scintilla, SCE_P_STRING, prefs.php_simplestring_bold);
	gtk_scintilla_style_set_fore (scintilla, SCE_P_CHARACTER, prefs.php_simplestring_fore);
    gtk_scintilla_style_set_font (scintilla, SCE_P_CHARACTER, prefs.php_simplestring_font);
    gtk_scintilla_style_set_back (scintilla, SCE_P_CHARACTER, prefs.php_simplestring_back);
    gtk_scintilla_style_set_size (scintilla, SCE_P_CHARACTER, prefs.php_simplestring_size);
    gtk_scintilla_style_set_italic (scintilla, SCE_P_CHARACTER, prefs.php_simplestring_italic);
    gtk_scintilla_style_set_bold (scintilla, SCE_P_CHARACTER, prefs.php_simplestring_bold);
	
    gtk_scintilla_style_set_font (scintilla, SCE_P_WORD, prefs.php_word_font);
	gtk_scintilla_style_set_fore (scintilla, SCE_P_WORD, prefs.php_word_fore);
    gtk_scintilla_style_set_back (scintilla, SCE_P_WORD, prefs.php_word_back);
    gtk_scintilla_style_set_size (scintilla, SCE_P_WORD, prefs.php_word_size);
    gtk_scintilla_style_set_italic (scintilla, SCE_P_WORD, prefs.php_word_italic);
    gtk_scintilla_style_set_bold (scintilla, SCE_P_WORD, prefs.php_word_bold);

    gtk_scintilla_style_set_fore (scintilla, SCE_P_NUMBER, prefs.php_number_fore);
    gtk_scintilla_style_set_font (scintilla, SCE_P_NUMBER, prefs.php_number_font);
    gtk_scintilla_style_set_back (scintilla, SCE_P_NUMBER, prefs.php_number_back);
    gtk_scintilla_style_set_size (scintilla, SCE_P_NUMBER, prefs.php_number_size);
    gtk_scintilla_style_set_italic (scintilla, SCE_P_NUMBER, prefs.php_number_italic);
    gtk_scintilla_style_set_bold (scintilla, SCE_P_NUMBER, prefs.php_number_bold);

    gtk_scintilla_style_set_fore (scintilla, SCE_P_IDENTIFIER, prefs.php_default_fore);
    gtk_scintilla_style_set_font (scintilla, SCE_P_IDENTIFIER, prefs.php_default_font);
    gtk_scintilla_style_set_back (scintilla, SCE_P_IDENTIFIER, prefs.php_default_back);
    gtk_scintilla_style_set_size (scintilla, SCE_P_IDENTIFIER, prefs.php_default_size);
    gtk_scintilla_style_set_italic (scintilla, SCE_P_IDENTIFIER, prefs.php_default_italic);
    gtk_scintilla_style_set_bold (scintilla, SCE_P_IDENTIFIER, prefs.php_default_bold);

    gtk_scintilla_style_set_fore (scintilla, SCE_P_COMMENTLINE, prefs.php_comment_line_fore);
    gtk_scintilla_style_set_font (scintilla, SCE_P_COMMENTLINE, prefs.php_comment_line_font);
    gtk_scintilla_style_set_back (scintilla, SCE_P_COMMENTLINE, prefs.php_comment_line_back);
    gtk_scintilla_style_set_size (scintilla, SCE_P_COMMENTLINE, prefs.php_comment_line_size);
    gtk_scintilla_style_set_italic (scintilla, SCE_P_COMMENTLINE, prefs.php_comment_line_italic);
    gtk_scintilla_style_set_bold (scintilla, SCE_P_COMMENTLINE, prefs.php_comment_line_bold);

	gtk_scintilla_set_property(scintilla, "fold", "1");
	gtk_scintilla_colourise(scintilla, 0, -1);
}