Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-05-13 20:11:28 +0400
committerTon Roosendaal <ton@blender.org>2005-05-13 20:11:28 +0400
commit2d6481c41c446ba3cc3f635944990d1b1927974f (patch)
tree68e4dba9c8868323a48073a78ebda5752e0c138b /source/blender/src/header_text.c
parentec2cbb268906faf81c4808ede188d9ecf9bf4129 (diff)
TextEditor: syntax color support.
Patch provided by Ricki Myers. Works quite obvious, see Theme editor too! Notes about the provided code; - The default syntax colors were screaming! Toned it down to match the default dark on lightgrey background better. - Added: initializing colors in saved themes (usiblender.c) - The implementation of the button for this option was quite clumsy... Blender UI options services this a lot easier. (Same fixed for 'line numbers' option) - Bracket matching now uses as color a mix of backdrop and the selected-text color. Noticed my texteditor did it too... -> I really miss comments in code describing a little bit the thought process behind the code. Like a short introduction on this feature in the top of the drawtext.c, little remarks on new functions. ALso in patch tracker or the mailinglist no docs was mentioned? -> drawtext.c now gets messy quickly... lack of overview, structure, and confusing mix of personal coding styles. For not-active supported code dangerous...
Diffstat (limited to 'source/blender/src/header_text.c')
-rw-r--r--source/blender/src/header_text.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/source/blender/src/header_text.c b/source/blender/src/header_text.c
index 4ecc1afec5b..c770f942256 100644
--- a/source/blender/src/header_text.c
+++ b/source/blender/src/header_text.c
@@ -126,7 +126,7 @@ void do_text_buttons(unsigned short event)
st->top= 0;
pop_space_text(st);
-
+ if (st->showsyntax) get_format_string();
allqueue(REDRAWTEXT, 0);
allqueue(REDRAWHEADERS, 0);
}
@@ -154,11 +154,6 @@ void do_text_buttons(unsigned short event)
break;
*/
case B_TEXTLINENUM:
- if(st->showlinenrs)
- st->showlinenrs = 0;
- else
- st->showlinenrs = 1;
-
allqueue(REDRAWTEXT, 0);
allqueue(REDRAWHEADERS, 0);
break;
@@ -177,6 +172,14 @@ void do_text_buttons(unsigned short event)
break;
case B_TAB_NUMBERS:
+ if (st->showsyntax) get_format_string();
+ allqueue(REDRAWTEXT, 0);
+ allqueue(REDRAWHEADERS, 0);
+ break;
+ case B_SYNTAX:
+ if (st->showsyntax) {
+ get_format_string();
+ }
allqueue(REDRAWTEXT, 0);
allqueue(REDRAWHEADERS, 0);
break;
@@ -208,6 +211,7 @@ static void do_text_filemenu(void *arg, int event)
if (!reopen_text(text)) {
error("Could not reopen file");
}
+ if (st->showsyntax) get_format_string();
}
break;
case 5:
@@ -252,6 +256,7 @@ static void do_text_editmenu(void *arg, int event)
break;
case 5:
txt_paste(text);
+ if (st->showsyntax) get_format_string();
break;
case 6:
txt_print_cutbuffer();
@@ -611,11 +616,9 @@ void text_buttons(void)
if(curarea->full) uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)");
else uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)");
- if(st->showlinenrs)
- uiDefIconBut(block, BUT, B_TEXTLINENUM, ICON_SHORTDISPLAY, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Hides line numbers");
- else
- uiDefIconBut(block, BUT, B_TEXTLINENUM, ICON_LONGDISPLAY, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Displays line numbers");
+ uiDefIconButI(block, ICONTOG, B_TEXTLINENUM, ICON_LONGDISPLAY, xco+=XIC,0,XIC,YIC, &st->showlinenrs, 0, 0, 0, 0, "Displays line numbers");
+ uiDefIconButI(block, ICONTOG, B_SYNTAX, ICON_SYNTAX, xco+=XIC,0,XIC,YIC, &st->showsyntax, 0, 0, 0, 0, "Enables Syntax Highlighting");
/* STD TEXT BUTTONS */
xco+= 2*XIC;