Commit 08ade335 authored by Johannes Schmid's avatar Johannes Schmid Committed by Johannes Schmid

Updated

2009-04-08  Johannes Schmid  <jhs@gnome.org>

	* POTFILES.in:
	* POTFILES.skip:
	Updated

svn path=/trunk/; revision=4932
parent caa4e9b0
2009-04-08 Johannes Schmid <jhs@gnome.org>
* configure.in:
* plugins/Makefile.am:
Moved scintilla plugin to anjuta-extras
2009-04-07 Johannes Schmid <jhs@gnome.org>
* plugins/sourceview/plugin.c (ipreferences_merge):
......@@ -77,22 +77,14 @@ AC_PROG_CC
AC_PROG_CPP
AC_LANG_C
#Check for C++ Compiler
AC_PROG_CXX
AC_LANG_CPLUSPLUS
GNOME_COMPILE_WARNINGS(maximum)
GNOME_CXX_WARNINGS(yes)
AM_CFLAGS="$AM_CFLAGS $WARN_CFLAGS"
AM_CXXFLAGS="$AM_CXXFLAGS $WARN_CXXFLAGS"
dnl Enable debugging mode
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Enable debug messages]),
AM_CFLAGS="$AM_CFLAGS -DDEBUG"
AM_CXXFLAGS="$AM_CXXFLAGS -DDEBUG")
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CXXFLAGS)
ANJUTA_LDFLAGS="-no-undefined"
ANJUTA_PLUGIN_LDFLAGS="-module -avoid-version -no-undefined"
......@@ -273,26 +265,6 @@ fi
AM_CONDITIONAL(HAVE_PLUGIN_SOURCEVIEW, [test x$sourceview = xyes])
dnl Scintilla Editor
dnl -------------------------------------------------------------
AC_ARG_ENABLE(plugin-scintilla,
AC_HELP_STRING([--disable-plugin-scintilla],[ Scintilla based editor in Anjuta]),
[ if test "$enableval" = "no"; then
user_disabled_scintilla=1
fi ],
[ user_disabled_scintilla=0 ])
AC_MSG_CHECKING(if scintilla plugin is enabled)
if test "$user_disabled_scintilla" = 1; then
AC_MSG_RESULT(no)
scintilla="no"
else
AC_MSG_RESULT(yes)
scintilla="yes"
fi
AM_CONDITIONAL(HAVE_PLUGIN_SCINTILLA, [test x$scintilla = xyes])
PKG_CHECK_MODULES(PLUGIN_SYMBOL_DB,
[libgda-4.0 >= $GDA_REQUIRED])
......@@ -768,10 +740,6 @@ plugins/gtodo/Makefile
plugins/class-gen/Makefile
plugins/class-gen/templates/Makefile
plugins/patch/Makefile
plugins/scintilla/Makefile
plugins/scintilla/scintilla/Makefile
plugins/scintilla/scintilla/include/Makefile
plugins/scintilla/properties/Makefile
plugins/document-manager/Makefile
plugins/document-manager/images/Makefile
plugins/search/Makefile
......@@ -903,13 +871,6 @@ if [ test x$sourceview = xyes ]; then
else
echo "Building GtkSourceView based editor: ...................NO"
fi
if [ test x$scintilla = xyes ]; then
echo "Building Scintilla based editor: .......................YES"
else
echo "Building Scintilla based editor: .......................NO"
fi
echo "-------------------------------------------------------------------"
#echo "AM_CFLAGS = $AM_CFLAGS"
#echo "AM_CXXFLAGS = $AM_CXXFLAGS"
......@@ -3,7 +3,6 @@
SUBDIRS = . \
gtodo \
message-view \
scintilla \
gdb \
debug-manager \
file-manager \
......
if HAVE_PLUGIN_SCINTILLA
SUBDIRS = scintilla properties
# Plugin glade file
editor_gladedir = $(anjuta_glade_dir)
editor_glade_DATA = anjuta-editor-scintilla.glade
# Plugin Icon file
editor_pixmapsdir = $(anjuta_image_dir)
editor_pixmaps_DATA = \
anjuta-editor-scintilla-plugin.svg \
anjuta-editor-scintilla-plugin-48.png
plugin_in_files = anjuta-editor.plugin.in
%.plugin: %.plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
editor_plugindir = $(anjuta_plugin_dir)
editor_plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
plugindir = $(anjuta_plugin_dir)
plugin_LTLIBRARIES = libanjuta-editor.la
AM_CPPFLAGS = \
$(GIO_CFLAGS) \
$(LIBANJUTA_CFLAGS) \
$(GTK_CFLAGS) \
$(GNOME_CFLAGS) \
-I$(srcdir)/scintilla/include
-DG_LOG_DOMAIN=\"libanjuta-editor\"
libanjuta_editor_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
libanjuta_editor_la_LIBADD = \
$(GIO_LIBS) \
$(LIBANJUTA_LIBS) \
$(GTK_LIBS) \
$(GNOME_LIBS) \
$(GLADE_LIBS) \
scintilla/libanjuta-scintilla.la
libanjuta_editor_la_SOURCES= \
properties.cxx \
properties.h \
properties_cxx.h \
aneditor.h \
aneditor-priv.h \
aneditor.cxx \
aneditor-autocomplete.cxx \
aneditor-calltip.cxx \
aneditor-indent.cxx \
text_editor_prefs.c \
text_editor_prefs.h \
text_editor.c \
text_editor.h \
text_editor_cbs.c \
text_editor_cbs.h \
text-editor-iterable.c \
text-editor-iterable.h \
lexer.h \
plugin.c \
plugin.h \
style-editor.c \
style-editor.h \
print.c \
print.h \
anjuta-bookmark-16.xpm \
anjuta-breakpoint-disabled-16.xpm \
anjuta-breakpoint-enabled-16.xpm \
anjuta-pcmark-16.xpm \
anjuta-linemark-16.xpm
prefs_glade_files = anjuta-editor-scintilla.glade
include $(top_srcdir)/scripts/build-schemas.mk
endif
EXTRA_DIST = \
$(editor_pixmaps_DATA) \
$(plugin_in_files) \
$(editor_plugin_DATA) \
$(editor_ui_DATA) \
$(editor_glade_DATA)
This diff is collapsed.
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
aneditor-calltip.cxx
Copyright (C) 2004 Naba Kumar
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libanjuta/anjuta-debug.h>
#include "aneditor-priv.h"
bool AnEditor::StartCallTip_new() {
#if 0
TMTagAttrType attrs[] =
{
tm_tag_attr_name_t, tm_tag_attr_type_t, tm_tag_attr_none_t
};
SString linebuf;
GetLine(linebuf);
int current = GetCaretInLine();
call_tip_node.start_pos = SendEditor(SCI_GETCURRENTPOS);
call_tip_node.call_tip_start_pos = current;
int braces;
do {
braces = 0;
while (current > 0 && (braces || linebuf[current - 1] != '(')) {
if (linebuf[current - 1] == '(')
braces--;
else if (linebuf[current - 1] == ')')
braces++;
current--;
call_tip_node.start_pos--;
}
if (current > 0) {
current--;
call_tip_node.start_pos--;
} else
break;
while (current > 0 && isspace(linebuf[current - 1])) {
current--;
call_tip_node.start_pos--;
}
} while (current > 0 &&
!calltipWordCharacters.contains(linebuf[current - 1]));
if (current <= 0)
return true;
call_tip_node.startCalltipWord = current -1;
while (call_tip_node.startCalltipWord > 0 &&
calltipWordCharacters.contains(linebuf[call_tip_node.startCalltipWord - 1]))
call_tip_node.startCalltipWord--;
linebuf.change(current, '\0');
call_tip_node.rootlen = current - call_tip_node.startCalltipWord;
call_tip_node.max_def = 0;
call_tip_node.def_index = 0;
const GPtrArray *tags = tm_workspace_find(linebuf.c_str() +
call_tip_node.startCalltipWord,
tm_tag_prototype_t |
tm_tag_function_t |
tm_tag_macro_with_arg_t,
attrs, FALSE, TRUE);
if (tags && (tags->len > 0))
{
call_tip_node.max_def = (tags->len < 20)? tags->len:20;
printf ("Number of calltips found %d\n", tags->len);
for (unsigned int i = 0; (i < tags->len) && (i < 20); i++) {
TMTag *tag = (TMTag *) tags->pdata[0];
GString* tmp = g_string_new(NVL(tag->atts.entry.type_ref[1], ""));
for (unsigned int j = 0; j < tag->atts.entry.pointerOrder; j++)
g_string_append(tmp, "*");
g_string_append_printf(tmp, " %s%s", tag->name,
NVL(tag->atts.entry.arglist, ""));
call_tip_node.functionDefinition[i] = tmp->str;
g_string_free(tmp, TRUE);
}
char *real_tip;
if (call_tip_node.max_def > 1)
real_tip = g_strconcat ("\002",
call_tip_node.functionDefinition[0].c_str(),
NULL);
else
real_tip = g_strdup (call_tip_node.functionDefinition[0].c_str());
SendEditorString(SCI_CALLTIPSHOW, call_tip_node.start_pos -
call_tip_node.rootlen + 1, real_tip);
g_free (real_tip);
ContinueCallTip_new();
}
#endif
return true;
}
static bool IsCallTipSeparator(char ch) {
return (ch == ',') || (ch == ';');
}
void AnEditor::ContinueCallTip_new() {
SString linebuf;
GetLine(linebuf);
unsigned current = GetCaretInLine();
int commas = 0;
for (unsigned i = call_tip_node.call_tip_start_pos; i < current; i++) {
unsigned char ch = linebuf[i];
// check whether the are some other functions nested.
// if found we'll skip them to evitate commas problems
if ( ch == '(' ) {
int braces = 1;
for (unsigned k = i+1; k < linebuf.length(); k++ ) {
if ( linebuf[k] == '(' ) {
braces++;
}
else
if ( linebuf[k] == ')' ) {
braces--;
}
if ( braces == 0 ) {
i = k;
break;
}
}
}
if (IsCallTipSeparator(ch))
commas++;
}
// lets start from 0
int startHighlight = 0;
while (call_tip_node.functionDefinition[call_tip_node.def_index][startHighlight] &&
call_tip_node.functionDefinition[call_tip_node.def_index][startHighlight] != '(')
startHighlight++;
if (call_tip_node.functionDefinition[call_tip_node.def_index][startHighlight] == '(') {
startHighlight++;
}
// printf(const char*, ...
// -------^
while (call_tip_node.functionDefinition[call_tip_node.def_index][startHighlight] &&
commas > 0) {
if (IsCallTipSeparator(call_tip_node.functionDefinition[call_tip_node.def_index][startHighlight] ) ||
call_tip_node.functionDefinition[call_tip_node.def_index][startHighlight] == ')')
commas--;
startHighlight++;
}
if (IsCallTipSeparator(call_tip_node.functionDefinition[call_tip_node.def_index][startHighlight]) ||
call_tip_node.functionDefinition[call_tip_node.def_index][startHighlight] == ')')
startHighlight++;
int endHighlight = startHighlight;
if (call_tip_node.functionDefinition[call_tip_node.def_index][endHighlight])
endHighlight++;
while (call_tip_node.functionDefinition[call_tip_node.def_index][endHighlight] &&
!IsCallTipSeparator(call_tip_node.functionDefinition[call_tip_node.def_index][endHighlight])
&& call_tip_node.functionDefinition[call_tip_node.def_index][endHighlight] != ')')
endHighlight++;
SendEditor(SCI_CALLTIPSETHLT, startHighlight, endHighlight);
}
//------------------------------------------------------------------------------
// we're going to save the current status of call_tip_node in call_tip_node_list
// to let another *new* call_tip to show up
//
void AnEditor::SaveCallTip() {
CallTipNode *ctn = new CallTipNode;
// g_message( "***saving calltip..." );
ctn->startCalltipWord = call_tip_node.startCalltipWord;
ctn->def_index = call_tip_node.def_index;
ctn->max_def = call_tip_node.max_def;
for (int i = 0; i < ctn->max_def; i++) {
ctn->functionDefinition[i] = call_tip_node.functionDefinition[i];
}
ctn->start_pos = call_tip_node.start_pos;
ctn->rootlen = call_tip_node.rootlen;
ctn->call_tip_start_pos = call_tip_node.call_tip_start_pos;
// push it
g_queue_push_tail( call_tip_node_queue, ctn );
SetCallTipDefaults();
}
void AnEditor::ResumeCallTip(bool pop_from_stack) {
if (pop_from_stack) {
if (g_queue_is_empty (call_tip_node_queue)) {
ShutDownCallTip();
return;
}
CallTipNode_ptr tmp_node;
// set up next CallTipNode parameters in AnEditor::call_tip_node
tmp_node = (CallTipNode_ptr)g_queue_pop_tail( call_tip_node_queue );
g_return_if_fail( tmp_node != NULL );
call_tip_node.startCalltipWord = tmp_node->startCalltipWord;
call_tip_node.def_index = tmp_node->def_index;
call_tip_node.max_def = tmp_node->max_def;
for (int i = 0; i < call_tip_node.max_def; i++)
call_tip_node.functionDefinition[i] =
tmp_node->functionDefinition[i];
call_tip_node.start_pos = tmp_node->start_pos;
call_tip_node.rootlen = tmp_node->rootlen;
call_tip_node.call_tip_start_pos = tmp_node->call_tip_start_pos;
// in response to g_malloc on SaveCallTip
delete tmp_node;
}
if (call_tip_node.max_def > 1 &&
call_tip_node.def_index == 0) {
char *real_tip;
real_tip = g_strconcat ("\002",
call_tip_node.functionDefinition[call_tip_node.def_index].c_str(),
NULL);
SendEditorString(SCI_CALLTIPSHOW, call_tip_node.start_pos -
call_tip_node.rootlen + 1, real_tip);
g_free (real_tip);
} else if (call_tip_node.max_def > 1 &&
call_tip_node.def_index == (call_tip_node.max_def - 1)) {
char *real_tip;
real_tip = g_strconcat ("\001",
call_tip_node.functionDefinition[call_tip_node.def_index].c_str(),
NULL);
SendEditorString(SCI_CALLTIPSHOW, call_tip_node.start_pos -
call_tip_node.rootlen + 1, real_tip);
g_free (real_tip);
} else if (call_tip_node.max_def > 1) {
char *real_tip;
real_tip = g_strconcat ("\001\002",
call_tip_node.functionDefinition[call_tip_node.def_index].c_str(),
NULL);
SendEditorString(SCI_CALLTIPSHOW, call_tip_node.start_pos -
call_tip_node.rootlen + 1, real_tip);
g_free (real_tip);
} else {
SendEditorString(SCI_CALLTIPSHOW, call_tip_node.start_pos -
call_tip_node.rootlen + 1,
call_tip_node.functionDefinition[call_tip_node.def_index].c_str());
}
}
//------------------------------------------------------------------------------
//
void AnEditor::ShutDownCallTip() {
// g_message( "***shutdowncalltip: length %d", g_queue_get_length( call_tip_node_queue ));
while ( g_queue_is_empty( call_tip_node_queue ) != TRUE ) {
CallTipNode_ptr tmp_node;
tmp_node = (CallTipNode_ptr)g_queue_pop_tail( call_tip_node_queue );
// in response to g_malloc on SaveCallTip
delete tmp_node;
}
// reset
SetCallTipDefaults();
}
//------------------------------------------------------------------------------
//
void AnEditor::SetCallTipDefaults( ) {
// we're going to set the default values to this.call_tip_node struct
call_tip_node.def_index = 0;
call_tip_node.max_def = 0;
call_tip_node.start_pos = 0;
call_tip_node.rootlen = 0;
call_tip_node.startCalltipWord = 0;
call_tip_node.call_tip_start_pos = 0;
}
//------------------------------------------------------------------------------
// gives a list of calltips which match the word on the current caret and display
// them
void AnEditor::CompleteCallTip() {
#if 0
char expr[256];
TMTagAttrType attrs[] = {tm_tag_attr_name_t, tm_tag_attr_type_t, tm_tag_attr_none_t};
int caret_position = SendEditor(SCI_GETCURRENTPOS);
if (SendEditor(SCI_CALLTIPACTIVE))
return;
// get the current word
GetWordAtPosition(expr, sizeof(expr), caret_position);
DEBUG_PRINT("completecalltip: on word %s and caret_position %d", expr, caret_position);
const GPtrArray *tags = tm_workspace_find(expr,
tm_tag_prototype_t |
tm_tag_function_t |
tm_tag_macro_with_arg_t,
attrs, FALSE, TRUE);
// we'll provide a function calltip
if (tags && (tags->len > 0))
{
TMTag *tag = (TMTag *) tags->pdata[0];
SString definition;
char *tmp;
tmp = g_strdup_printf("%s %s%s", NVL(tag->atts.entry.type_ref[1], ""),
tag->name, NVL(tag->atts.entry.arglist, ""));
definition = tmp;
g_free(tmp);
char *real_tip;
real_tip = g_strdup (definition.c_str());
SendEditorString(SCI_CALLTIPSHOW, caret_position, real_tip);
g_free (real_tip);
}
#endif
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
aneditor-indent.cxx
Copyright (C) 2004 Naba Kumar
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "aneditor-priv.h"
void AnEditor::IndentationIncrease(){
CharacterRange crange = GetSelection();
if (crange.cpMin != crange.cpMax)
{
SendEditor (SCI_TAB);
return;
}
int line =SendEditor(SCI_LINEFROMPOSITION, SendEditor (SCI_GETCURRENTPOS));
int indent =GetLineIndentation(line);
indent +=SendEditor(SCI_GETINDENT);
SetLineIndentation(line, indent);
}
void AnEditor::IndentationDecrease(){
CharacterRange crange = GetSelection();
if (crange.cpMin != crange.cpMax)
{
SendEditor (SCI_BACKTAB);
return;
}
int line =SendEditor(SCI_LINEFROMPOSITION, SendEditor (SCI_GETCURRENTPOS));
int indent = GetLineIndentation(line);
indent -=SendEditor(SCI_GETINDENT);
if (indent < 0) indent = 0;
SetLineIndentation(line, indent);
}
void AnEditor::SetLineIndentation(int line, int indent) {
if (indent < 0)
return;
CharacterRange crange = GetSelection();
int posBefore = GetLineIndentPosition(line);
SendEditor(SCI_SETLINEINDENTATION, line, indent);
int posAfter = GetLineIndentPosition(line);
int posDifference = posAfter - posBefore;
if (posAfter > posBefore) {
// Move selection on
if (crange.cpMin >= posBefore) {
crange.cpMin += posDifference;
}
if (crange.cpMax >= posBefore) {
crange.cpMax += posDifference;
}
} else if (posAfter < posBefore) {
// Move selection back
if (crange.cpMin >= posAfter) {
if (crange.cpMin >= posBefore)
crange.cpMin += posDifference;
else
crange.cpMin = posAfter;
}
if (crange.cpMax >= posAfter) {
if (crange.cpMax >= posBefore)
crange.cpMax += posDifference;
else
crange.cpMax = posAfter;
}
}
SetSelection(crange.cpMin, crange.cpMax);
}
int AnEditor::GetLineIndentation(int line) {
return SendEditor(SCI_GETLINEINDENTATION, line);
}
int AnEditor::GetLineIndentPosition(int line) {
return SendEditor(SCI_GETLINEINDENTPOSITION, line);
}
bool AnEditor::RangeIsAllWhitespace(int start, int end) {
WindowAccessor acc(wEditor.GetID(), *props);
for (int i = start;i < end;i++) {
if ((acc[i] != ' ') && (acc[i] != '\t'))
return false;
}
return true;
}
#if 0
unsigned int AnEditor::GetLinePartsInStyle(int line, int style1, int style2,
SString sv[], int len) {
for (int i = 0; i < len; i++)
sv[i] = "";
WindowAccessor acc(wEditor.GetID(), *props);
SString s;
int part = 0;
int thisLineStart = SendEditor(SCI_POSITIONFROMLINE, line);
int nextLineStart = SendEditor(SCI_POSITIONFROMLINE, line + 1);
for (int pos = thisLineStart; pos < nextLineStart; pos++) {
if ((acc.StyleAt(pos) == style1) || (acc.StyleAt(pos) == style2)) {
char c[2];
c[0] = acc[pos];
c[1] = '\0';
s += c;
} else if (s.length() > 0) {
if (part < len) {
sv[part++] = s;
}
s = "";
}
}
if ((s.length() > 0) && (part < len)) {
sv[part++] = s;
}
return part;
}