rpms/scim-sinhala/devel scim-sinhala-preedit-217065.patch, NONE, 1.1 scim-sinhala.spec, 1.6, 1.7
Pravin Satpute (pravins)
fedora-extras-commits at redhat.com
Fri Dec 14 11:05:24 UTC 2007
- Previous message (by thread): rpms/sos/F-8 rhsupport.pub, 1.1, 1.2 sos.spec, 1.3, 1.4 sources, 1.4, 1.5
- Next message (by thread): rpms/python-elixir/F-8 python-elixir.spec,1.2,1.3 sources,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: pravins
Update of /cvs/pkgs/rpms/scim-sinhala/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12944
Modified Files:
scim-sinhala.spec
Added Files:
scim-sinhala-preedit-217065.patch
Log Message:
* Fri Dec 14 2007 Pravin Satpute <psatpute at redhat.com> - 0.2.0-4.fc9
- implemented preedit in scim sinhala(#217065)
scim-sinhala-preedit-217065.patch:
--- NEW FILE scim-sinhala-preedit-217065.patch ---
diff -rup scim-sinhala-trans-0.2.0-20060825/src/scim_sinhala_imengine.cpp scim-sinhala-trans-0.2.0-20060825-modified/src/scim_sinhala_imengine.cpp
--- scim-sinhala-trans-0.2.0-20060825/src/scim_sinhala_imengine.cpp 2007-11-30 10:17:57.000000000 +0530
+++ scim-sinhala-trans-0.2.0-20060825-modified/src/scim_sinhala_imengine.cpp 2007-12-13 18:30:42.000000000 +0530
@@ -28,6 +28,7 @@
#define Uses_SCIM_LOOKUP_TABLE
#define Uses_SCIM_CONFIG_BASE
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -42,6 +43,9 @@
#include "scim_sinhala_imengine.h"
#include "intl.h"
+
+using namespace scim;
+
/*
* A BIG NOTE: Instead of working with three byte UTF-8 encoded
* characters, we will be using the 8 least significant bits of each
@@ -208,11 +212,13 @@ SinhalaInstance::reset ()
{
SCIM_DEBUG_IMENGINE(2) << "reset.\n";
- m_lookup_table.clear ();
+ m_preedit_string = WideString ();
+ update_preedit_string (m_preedit_string);
update_preedit_caret (0);
- update_preedit_string (utf8_mbstowcs (""));
+ m_lookup_table.clear ();
hide_lookup_table ();
hide_preedit_string ();
+
}
void
@@ -377,6 +383,31 @@ SinhalaInstance::sinhala_transliterated_
if (event.code == 0) return false;
+ //reset key
+ if (event.code == SCIM_KEY_Escape && event.mask == 0) {
+ reset ();
+ return true;
+ }
+
+ //delete key
+ if (event.code == SCIM_KEY_BackSpace && event.mask == 0 &&
+ m_preedit_string.size () != 0) {
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+ return true;
+ }
+
+
+ // commit key
+ if (event.code == SCIM_KEY_space && event.mask == 0 && m_preedit_string.length ()) {
+ commit_string (m_preedit_string);
+ reset ();
+ return true;
+ }
+
+
+
if (event.is_key_release()) {
if (event.code == SCIM_KEY_Shift_L) shift_l = 0;
if (event.code == SCIM_KEY_Shift_R) shift_r = 0;
@@ -440,82 +471,112 @@ bool
SinhalaInstance::handle_consonant_pressed(const KeyEvent &event, int c)
{
int c1, l1;
- unsigned char *u = NULL;
-
+
+ if (m_preedit_string.length () == 0) {
+ show_preedit_string ();
+ m_preedit_string.push_back (lsb_to_unicode(consonents[c].character));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+ return true;
+ }
+
/* do modifiers first. */
- c1 = get_known_lsb_character(last_key);
+ c1 = get_known_lsb_character((int)m_preedit_string[0]);
l1 = find_consonent(c1);
/* do modifiers only if there is a valid character before */
if (l1 >= 0) {
if (event.code == SCIM_KEY_w) {
- u = create_unicode_character_from_lsb(0xca);
- commit_string(utf8_mbstowcs((const char*)u));
- free(u);
+ commit_string(m_preedit_string);
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
+ m_preedit_string.push_back (0x0dca);
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
last_key = 0xdca;
return true;
}
if (event.code == SCIM_KEY_W) {
/* bandi hal kireema */
- unsigned char u[7];
- u[0] = 0xe0; u[1] = 0xb7; u[2] = 0x8a;
- u[3] = 0xe2; u[4] = 0x80; u[5] = 0x8d;
- u[6] = 0;
+ m_preedit_string.push_back (0x0dca);
+ commit_string(m_preedit_string);
+ m_preedit_string.erase (m_preedit_string.length () - 2, 2);
- commit_string(utf8_mbstowcs((const char*)u));
+
+ m_preedit_string.push_back (0x200d);
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
last_key = 0x200d;
return true;
}
if ((event.code == SCIM_KEY_H) && (consonents[l1].mahaprana)) {
- backspace();
- u = create_unicode_character_from_lsb(consonents[l1].mahaprana);
- commit_string(utf8_mbstowcs((const char*)u));
- free(u);
+
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
+
+ m_preedit_string.push_back (lsb_to_unicode(consonents[l1].mahaprana));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+
last_key = lsb_to_unicode(consonents[l1].mahaprana);
return true;
}
if ((event.code == SCIM_KEY_G) && (consonents[l1].sagngnaka)) {
- backspace();
- u = create_unicode_character_from_lsb(consonents[l1].sagngnaka);
- commit_string(utf8_mbstowcs((const char*)u));
- free(u);
+
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
+ m_preedit_string.push_back (lsb_to_unicode(consonents[l1].sagngnaka));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+
last_key = lsb_to_unicode(consonents[l1].sagngnaka);
return true;
}
if (event.code == SCIM_KEY_R) {
- /* rakaraanshaya */
- unsigned char u[10];
- u[0] = 0xe0; u[1] = 0xb7; u[2] = 0x8a;
- u[3] = 0xe2; u[4] = 0x80; u[5] = 0x8d;
- u[6] = 0xe0; u[7] = 0xb6; u[8] = 0xbb;
- u[9] = 0;
- commit_string(utf8_mbstowcs((const char*)u));
+ m_preedit_string.push_back (0x0dca);
+ m_preedit_string.push_back (0x200d);
+ commit_string(m_preedit_string);
+ m_preedit_string.erase (m_preedit_string.length () - 3, 3);
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+
+
+
+
+ m_preedit_string.push_back (0x0dbb);
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
last_key = 0x0dbb;
return true;
}
if (event.code == SCIM_KEY_Y) {
- /* yansaya */
- unsigned char u[10];
- u[0] = 0xe0; u[1] = 0xb7; u[2] = 0x8a;
- u[3] = 0xe2; u[4] = 0x80; u[5] = 0x8d;
- u[6] = 0xe0; u[7] = 0xb6; u[8] = 0xba;
- u[9] = 0;
- commit_string(utf8_mbstowcs((const char*)u));
+ m_preedit_string.push_back (0x0dca);
+ m_preedit_string.push_back (0x200d);
+
+ commit_string(m_preedit_string);
+ m_preedit_string.erase (m_preedit_string.length () - 3, 3);
+
+ /* yansaya */
+ m_preedit_string.push_back (0x0dba);
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
last_key = 0x0dba;
return true;
}
+
}
- u = create_unicode_character_from_lsb(consonents[c].character);
- commit_string(utf8_mbstowcs((const char*)u));
- free(u);
+ commit_string(m_preedit_string);
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
+ m_preedit_string.push_back (lsb_to_unicode(consonents[c].character));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+
+
last_key = lsb_to_unicode(consonents[c].character);
return true;
@@ -525,34 +586,62 @@ bool
SinhalaInstance::handle_vowel_pressed(const KeyEvent &event, int c)
{
int c1;
- unsigned char *u = NULL;
- /* look for a previous character first. */
- u = NULL;
- c1 = get_known_lsb_character(last_key);
- if (is_consonent(c1)) {
- u = create_unicode_character_from_lsb(vowels[c].single1);
- last_key = lsb_to_unicode(vowels[c].single1);
- }
- else if (c1 == vowels[c].single0) {
- backspace();
- u = create_unicode_character_from_lsb(vowels[c].double0);
- last_key = lsb_to_unicode(vowels[c].double0);
- }
- else if (c1 == vowels[c].single1) {
- backspace();
- u = create_unicode_character_from_lsb(vowels[c].double1);
- last_key = lsb_to_unicode(vowels[c].double1);
- }
- else {
- u = create_unicode_character_from_lsb(vowels[c].single0);
+ if (m_preedit_string.length () == 0) {
+ show_preedit_string ();
+ m_preedit_string.push_back (lsb_to_unicode(vowels[c].single0));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+ return true;
+ }
+
+ else {
+
+ /* look for a previous character first. */
+ c1 = get_known_lsb_character((int)m_preedit_string[0]);
+
+
+ if (is_consonent(c1)) {
+ commit_string(m_preedit_string);
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
+
+ m_preedit_string.push_back(lsb_to_unicode(vowels[c].single1));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+ last_key = lsb_to_unicode(vowels[c].single1);
+ }
+ else if (c1 == vowels[c].single0) {
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
+ m_preedit_string.push_back(lsb_to_unicode(vowels[c].double0));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+
+
+ last_key = lsb_to_unicode(vowels[c].double0);
+ }
+ else if (c1 == vowels[c].single1) {
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
+ m_preedit_string.push_back(lsb_to_unicode(vowels[c].double1));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+
+ last_key = lsb_to_unicode(vowels[c].double1);
+ }
+ else {
+ commit_string(m_preedit_string);
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
+
+
+ m_preedit_string.push_back(lsb_to_unicode(vowels[c].single0));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+
last_key = lsb_to_unicode(vowels[c].single0);
}
- commit_string(utf8_mbstowcs((const char*)u));
- free(u);
return true;
+ }
}
/*
--- scim-sinhala-trans-0.2.0-20060825/src/scim_sinhala_imengine.h 2006-01-31 11:06:54.000000000 +0530
+++ scim-sinhala-trans-0.2.0-20060825-modified/src/scim_sinhala_imengine.h 2007-12-07 12:32:57.000000000 +0530
@@ -28,6 +28,7 @@
#include <scim.h>
+
using namespace scim;
class SinhalaInstance : public IMEngineInstanceBase
@@ -41,6 +42,8 @@
/* for candidates window */
CommonLookupTable m_lookup_table;
+ std::vector<WideString> m_lookup_table_labels;
+ WideString m_preedit_string;
/* for toolbar */
PropertyList m_properties;
Index: scim-sinhala.spec
===================================================================
RCS file: /cvs/pkgs/rpms/scim-sinhala/devel/scim-sinhala.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- scim-sinhala.spec 22 Aug 2007 03:13:00 -0000 1.6
+++ scim-sinhala.spec 14 Dec 2007 11:04:47 -0000 1.7
@@ -1,29 +1,25 @@
%define snapdate 20060825
%define snapshot 0%{?snapdate:1}
-%define with_libstdc_preview 0
-
Name: scim-sinhala
Version: 0.2.0
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Sri Lankan input method for SCIM
Group: System Environment/Libraries
License: GPLv2
-Url: http://sinhala.sourceforge.net/
+URL: http://sinhala.sourceforge.net/
Source: http://sinhala.cvs.sourceforge.net/sinhala/sinhala/scim/trans/%{name}-trans-%{version}%{?snapdate:-%{snapdate}}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if %{snapshot}
Buildrequires: autoconf, automake, libtool
%endif
BuildRequires: scim-devel
-%if %{with_libstdc_preview}
-Buildrequires: libstdc++so7-devel
-%endif
Requires: scim
Patch1: scim-sinhala-trans-autogen-automake.patch
Patch2: scim-sinhala-remove-timeout-206253.patch
Patch3: scim-sinhala-help-text-206114.patch
+Patch4: scim-sinhala-preedit-217065.patch
%description
This package provides a Sinhala Trans input method for SCIM.
@@ -34,28 +30,19 @@
%patch1 -p1 -b .1-automake17
%patch2 -p1 -b .2-timeout
%patch3 -p1 -b .3-help
+%patch4 -p1 -b .4-preedit
%if %{snapshot}
./autogen.sh
%endif
%build
-%if %{with_libstdc_preview}
-export CXX=%{_bindir}/g++-libstdc++-so_7
-%endif
%configure --disable-static
-%if %{with_libstdc_preview}
-# tweak libtool for libstdc++-so7
-sed -i -e "s/4.1.0 /4.2.0-`grep datestamp= %{_bindir}/g++-libstdc++-so_7 | sed -e "s/datestamp=//"` /" libtool
-%endif
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
-%if %{with_libstdc_preview}
-export CXX=%{_bindir}/g++-libstdc++-so_7
-%endif
make install DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT%{_libdir}/scim-1.0/*/*/*.la
@@ -73,6 +60,9 @@
%changelog
+* Fri Dec 14 2007 Pravin Satpute <psatpute at redhat.com> - 0.2.0-4.fc9
+- implemented preedit in scim sinhala(#217065)
+
* Wed Aug 22 2007 Parag Nemade <pnemade at redhat.com> - 0.2.0-3
- rebuild against new rpm package
- update license tag
- Previous message (by thread): rpms/sos/F-8 rhsupport.pub, 1.1, 1.2 sos.spec, 1.3, 1.4 sources, 1.4, 1.5
- Next message (by thread): rpms/python-elixir/F-8 python-elixir.spec,1.2,1.3 sources,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list