Added a button to allow plug-ins to be enabled/disabled for each text space. It was confusing using the syntax button for both.

This commit is contained in:
Ian Thompson
2008-08-12 22:12:24 +00:00
parent 65d0ef3e74
commit 5ade004592
5 changed files with 12 additions and 6 deletions

View File

@@ -378,6 +378,7 @@
#define B_TAB_NUMBERS 508
#define B_SYNTAX 509
#define B_WORDWRAP 510
#define B_TEXTPLUGINS 511
/* SCRIPT: 525 */
#define B_SCRIPTBROWSE 526

View File

@@ -290,7 +290,7 @@ typedef struct SpaceText {
struct rcti txtscroll, txtbar;
int wordwrap, pad1;
int wordwrap, doplugins;
} SpaceText;

View File

@@ -2250,7 +2250,7 @@ static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short
if (!texttool_text_is_active(st->text)) return 0;
if (!st->text || st->text->id.lib) return 0;
if (st->showsyntax && texttool_text_is_active(st->text)) {
if (st->doplugins && texttool_text_is_active(st->text)) {
if (texttool_suggest_first()) tools |= TOOL_SUGG_LIST;
if (texttool_docs_get()) tools |= TOOL_DOCUMENT;
}
@@ -2646,7 +2646,7 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
return;
}
if (st->showsyntax && do_texttools(st, ascii, event, val)) return;
if (st->doplugins && do_texttools(st, ascii, event, val)) return;
if (do_markers(st, ascii, event, val)) return;
if (event==UI_BUT_EVENT) {
@@ -3170,8 +3170,8 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
}
/* Run text plugin scripts if in syntax mode */
if (st->showsyntax && event && val) {
/* Run text plugin scripts if enabled */
if (st->doplugins && event && val) {
if (BPY_menu_do_shortcut(PYMENU_TEXTPLUGIN, event, G.qual)) {
do_draw= 1;
}

View File

@@ -204,6 +204,9 @@ void do_text_buttons(unsigned short event)
allqueue(REDRAWTEXT, 0);
allqueue(REDRAWHEADERS, 0);
break;
case B_TEXTPLUGINS:
allqueue(REDRAWHEADERS, 0);
break;
case B_WORDWRAP:
st->left= 0;
allqueue(REDRAWTEXT, 0);
@@ -841,8 +844,9 @@ void text_buttons(void)
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)");
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");
uiDefIconButI(block, ICONTOG, B_WORDWRAP, ICON_WORDWRAP, xco+=XIC,0,XIC,YIC, &st->wordwrap, 0, 0, 0, 0, "Enables word wrap");
uiDefIconButI(block, ICONTOG, B_SYNTAX, ICON_SYNTAX, xco+=XIC,0,XIC,YIC, &st->showsyntax, 0, 0, 0, 0, "Enables Syntax Highlighting");
uiDefIconButI(block, ICONTOG, B_TEXTPLUGINS, ICON_CLIPUV_DEHLT, xco+=XIC,0,XIC,YIC, &st->doplugins, 0, 0, 0, 0, "Enables text plugins");
uiBlockEndAlign(block);
/* STD TEXT BUTTONS */

View File

@@ -6054,6 +6054,7 @@ static void init_textspace(ScrArea *sa)
st->showlinenrs= 0;
st->tabnumber = 4;
st->showsyntax= 0;
st->doplugins= 1;
st->overwrite= 0;
st->wordwrap= 0;
st->currtab_set = 0;