Commit f1c207c3 authored by Dave Camp's avatar Dave Camp Committed by Dave Camp

Added toolbar items.

2000-12-02  Dave Camp  <dave@helixcode.com>

	* scintilla-control/scintilla-ui.xml: Added toolbar items.

	* scintilla-control/scintilla-editor-buffer.c (impl_get_chars):
	Renamed from impl_read().
	(impl_insert): Changed to reflect idl changes.
	(init_editor_buffer_corba_class): s/read/get_chars/.

	* scintilla-control/scintilla-control.c (scintilla_factory): Added
	selection_start and selection_end properties.
	(scintilla_activate_cb): Rearrange the freezing.
	(get_prop): Implement the selection_start and selection_end props.

	* idl/editor-buffer.idl: Replaced read() with get_chars().
	Take a null-terminated string for insert().

	* gdl/Makefile.am (libgdlinclude_HEADERS): Install
	CORBA_GENERATED_HEADER_FILES
parent aa8ed5fb
2000-12-02 Dave Camp <dave@helixcode.com>
* scintilla-control/scintilla-ui.xml: Added toolbar items.
* scintilla-control/scintilla-editor-buffer.c (impl_get_chars):
Renamed from impl_read().
(impl_insert): Changed to reflect idl changes.
(init_editor_buffer_corba_class): s/read/get_chars/.
* scintilla-control/scintilla-control.c (scintilla_factory): Added
selection_start and selection_end properties.
(scintilla_activate_cb): Rearrange the freezing.
(get_prop): Implement the selection_start and selection_end props.
* idl/editor-buffer.idl: Replaced read() with get_chars().
Take a null-terminated string for insert().
* gdl/Makefile.am (libgdlinclude_HEADERS): Install
CORBA_GENERATED_HEADER_FILES
2000-11-11 JP Rosevear <jpr@helixcode.com>
* NEWS: Remove borrowed cruft
SUBDIRS = gdl scintilla-control po intl
SUBDIRS = idl gdl scintilla-control po intl
confexecdir = $(libdir)
confexec_DATA = gdlConf.sh
......
......@@ -31,6 +31,7 @@ libgdl_la_LIBADD = \
libgdlincludedir = $(includedir)/gdl
libgdlinclude_HEADERS = \
$(CORBA_GENERATED_HEADER_FILES) \
gdl.h \
gdl-server-manager.h \
gdl-tools.h
\ No newline at end of file
......@@ -26,6 +26,7 @@
#define __GDL_TOOLS_H__
#include <glib.h>
#include <gnome.h>
BEGIN_GNOME_DECLS
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This file is part of the GNOME Devtools Libraries
......@@ -32,6 +31,7 @@
#endif
#include <Bonobo.idl>
#include <ORBitservices/CosEventChannel.idl>
#include "editor-buffer.idl"
......
......@@ -25,8 +25,8 @@ module Development {
typedef sequence<octet> iobuf;
long get_length ();
void read (in long offset, in long count, out iobuf buffer);
void insert (in long offset, in iobuf buffer);
void get_chars (in long offset, in long count, out iobuf buffer);
void insert (in long offset, in string str);
void delete (in long offset, in long count);
};
};
......@@ -35,7 +35,9 @@
#include <gdl/gdl-server-manager.h>
enum {
PROP_POSITION = 0
PROP_POSITION,
PROP_SELECTION_START,
PROP_SELECTION_END
};
static void init_scintilla_control_factory (void);
......@@ -102,6 +104,18 @@ scintilla_factory (BonoboGenericFactory *fact, void *closure)
BONOBO_ARG_LONG, NULL,
"Position in the buffer",
BONOBO_PROPERTY_UNSTORED);
bonobo_property_bag_add (pb, "selection_start", PROP_SELECTION_START,
BONOBO_ARG_LONG, NULL,
"Beginning of the selection",
BONOBO_PROPERTY_UNSTORED);
bonobo_property_bag_add (pb, "selection_end", PROP_SELECTION_END,
BONOBO_ARG_LONG, NULL,
"End of the selection",
BONOBO_PROPERTY_UNSTORED);
bonobo_control_set_properties (control, pb);
/* Add other interfaces */
file_impl = scintilla_persist_file_new (sci);
......@@ -122,21 +136,26 @@ scintilla_activate_cb (BonoboControl *control,
{
BonoboUIComponent *ui_component;
ui_component = bonobo_control_get_ui_component (control);
if (activate) {
Bonobo_UIContainer remote_uic;
/* Hook up the user interface */
bonobo_ui_component_add_verb_list_with_data (ui_component, verbs, sci);
remote_uic = bonobo_control_get_remote_ui_container (control);
bonobo_ui_component_set_container (ui_component, remote_uic);
bonobo_ui_component_freeze (ui_component, NULL);
/* Hook up the user interface */
bonobo_ui_component_add_verb_list_with_data (ui_component, verbs, sci);
bonobo_object_release_unref (remote_uic, NULL);
bonobo_ui_component_freeze (ui_component, NULL);
bonobo_ui_util_set_ui (ui_component, GDL_DATADIR,
"scintilla-ui.xml", "scintilla-control");
bonobo_ui_component_thaw (ui_component, NULL);
bonobo_ui_component_thaw (ui_component, NULL);
} else {
#if 0
bonobo_ui_component_rm (ui_component, "/", NULL);
#endif
bonobo_ui_component_unset_container (ui_component);
}
}
......@@ -159,7 +178,19 @@ set_prop (BonoboPropertyBag *bag,
long pos = BONOBO_ARG_GET_LONG (arg);
scintilla_send_message (sci, SCI_GOTOPOS, pos, 0);
break;
}
}
case PROP_SELECTION_START :
{
long pos = BONOBO_ARG_GET_LONG (arg);
scintilla_send_message (sci, SCI_SETSELECTIONSTART, pos, 0);
break;
}
case PROP_SELECTION_END :
{
long pos = BONOBO_ARG_GET_LONG (arg);
scintilla_send_message (sci, SCI_SETSELECTIONEND, pos, 0);
break;
}
}
}
......@@ -178,6 +209,18 @@ get_prop (BonoboPropertyBag *bag,
BONOBO_ARG_SET_LONG (arg, pos);
break;
}
case PROP_SELECTION_START :
{
long pos = scintilla_send_message (sci, SCI_GETSELECTIONSTART, 0, 0);
BONOBO_ARG_SET_LONG (arg, pos);
break;
}
case PROP_SELECTION_END :
{
long pos = scintilla_send_message (sci, SCI_GETSELECTIONEND, 0, 0);
BONOBO_ARG_SET_LONG (arg, pos);
break;
}
}
}
......
......@@ -135,11 +135,11 @@ impl_get_length (PortableServer_Servant servant,
}
static void
impl_read (PortableServer_Servant servant,
CORBA_long offset,
CORBA_long count,
Development_EditorBuffer_iobuf **buffer,
CORBA_Environment *ev)
impl_get_chars (PortableServer_Servant servant,
CORBA_long offset,
CORBA_long count,
Development_EditorBuffer_iobuf **buffer,
CORBA_Environment *ev)
{
ScintillaEditorBuffer *eb = editor_buffer_from_servant (servant);
TextRange tr;
......@@ -165,16 +165,11 @@ impl_read (PortableServer_Servant servant,
static void
impl_insert (PortableServer_Servant servant,
CORBA_long offset,
const Development_EditorBuffer_iobuf *buffer,
const CORBA_char *str,
CORBA_Environment *ev)
{
ScintillaEditorBuffer *eb = editor_buffer_from_servant (servant);
char *string = g_malloc (buffer->_length + 1);
memcpy (string, buffer->_buffer, buffer->_length);
string[buffer->_length] = '\0';
scintilla_send_message (eb->sci, SCI_INSERTTEXT, offset, (long)string);
g_free (string);
scintilla_send_message (eb->sci, SCI_INSERTTEXT, offset, (long)str);
}
static void
......@@ -199,7 +194,7 @@ init_editor_buffer_corba_class (void)
{
/* EPV */
editor_buffer_epv.get_length = impl_get_length;
editor_buffer_epv.read = impl_read;
editor_buffer_epv.get_chars = impl_get_chars;
editor_buffer_epv.insert = impl_insert;
editor_buffer_epv.delete = impl_delete;
......
......@@ -20,4 +20,11 @@
</placeholder>
</submenu>
</menu>
<dockitem name="StandardToolbar">
<placeholder name="EditorClipboard">
<menuitem name="EditCut" verb="" _label="C_ut"/>
<menuitem name="EditCopy" verb="" _label="_Copy"/>
<menuitem name="EditPaste" verb="" _label="_Paste"/>
</placeholder>
</dockitem>
</Root>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment