Created
April 11, 2010 05:13
-
-
Save mnogu/362516 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * qt4/immodule/candidatewindow.cpp | |
| - (CandidateWindow::setPage): Uncomment. | |
| - (CandidateListView::sizeHint): Adjust size. | |
| * scm/Makefile.am | |
| - (SCM_FILES): Add eb.scm. | |
| * scm/eb.scm | |
| - New file. | |
| * scm/im.scm | |
| - (create-context, release-context, get-candidate): Use eb. | |
| --- | |
| qt4/immodule/candidatewindow.cpp | 11 ++++--- | |
| scm/Makefile.am | 3 +- | |
| scm/eb.scm | 53 ++++++++++++++++++++++++++++++++++++++ | |
| scm/im.scm | 14 +++++++--- | |
| 4 files changed, 71 insertions(+), 10 deletions(-) | |
| create mode 100644 scm/eb.scm | |
| diff --git a/qt4/immodule/candidatewindow.cpp b/qt4/immodule/candidatewindow.cpp | |
| index c958e73..3d9389c 100644 | |
| --- a/qt4/immodule/candidatewindow.cpp | |
| +++ b/qt4/immodule/candidatewindow.cpp | |
| @@ -294,10 +294,10 @@ void CandidateWindow::setPage( int page ) | |
| QString candString | |
| = QString::fromUtf8( uim_candidate_get_cand_str( cand ) ); | |
| QString annotationString; | |
| - // if ( hasAnnotation ) { | |
| - // annotationString | |
| - // = QString::fromUtf8( uim_candidate_get_annotation_str( cand ) ); | |
| - // } | |
| + if ( hasAnnotation ) { | |
| + annotationString | |
| + = QString::fromUtf8( uim_candidate_get_annotation_str( cand ) ); | |
| + } | |
| // insert new item to the candidate list | |
| QTableWidgetItem *headItem = new QTableWidgetItem; | |
| @@ -619,7 +619,8 @@ QSize CandidateListView::sizeHint() const | |
| int width = frame; | |
| // the size of the dummy column should be 0. | |
| for ( int i = 0; i < columnCount() - 1; i++ ) | |
| - width += columnWidth( i ); | |
| + width += ( i != ANNOTATION_COLUMN ) ? | |
| + columnWidth( i ) : qMin( columnWidth( i ), MIN_CAND_WIDTH ); | |
| return QSize( width, rowHeight( 0 ) * rowNum + frame ); | |
| } | |
| diff --git a/scm/Makefile.am b/scm/Makefile.am | |
| index 48b2a80..c5e128f 100644 | |
| --- a/scm/Makefile.am | |
| +++ b/scm/Makefile.am | |
| @@ -52,7 +52,8 @@ SCM_FILES = plugin.scm im.scm im-custom.scm lazy-load.scm init.scm \ | |
| lolevel.scm \ | |
| input-parse.scm match.scm pregexp.scm \ | |
| http-client.scm http-server.scm \ | |
| - sxml-tools.scm sxpathlib.scm | |
| + sxml-tools.scm sxpathlib.scm \ | |
| + eb.scm | |
| ETAGS_ARGS=$(SCM_FILES) $(GENERATED_SCM_FILES) | |
| diff --git a/scm/eb.scm b/scm/eb.scm | |
| new file mode 100644 | |
| index 0000000..9d57eeb | |
| --- /dev/null | |
| +++ b/scm/eb.scm | |
| @@ -0,0 +1,53 @@ | |
| +;;; eb.scm: EB Library functions for uim | |
| +;;; | |
| +;;; Copyright (c) 2010 uim Project http://code.google.com/p/uim/ | |
| +;;; | |
| +;;; All rights reserved. | |
| +;;; | |
| +;;; Redistribution and use in source and binary forms, with or without | |
| +;;; modification, are permitted provided that the following conditions | |
| +;;; are met: | |
| +;;; 1. Redistributions of source code must retain the above copyright | |
| +;;; notice, this list of conditions and the following disclaimer. | |
| +;;; 2. Redistributions in binary form must reproduce the above copyright | |
| +;;; notice, this list of conditions and the following disclaimer in the | |
| +;;; documentation and/or other materials provided with the distribution. | |
| +;;; 3. Neither the name of authors nor the names of its contributors | |
| +;;; may be used to endorse or promote products derived from this software | |
| +;;; without specific prior written permission. | |
| +;;; | |
| +;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | |
| +;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| +;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE | |
| +;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| +;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| +;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| +;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| +;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| +;;; SUCH DAMAGE. | |
| +;;;; | |
| +(and (not (provided? "eb")) | |
| + (guard (err (else #f)) | |
| + (module-load "eb")) | |
| + (provide "eb")) | |
| + | |
| +(define eb-ptr #f) | |
| + | |
| +(define eb-init | |
| + (lambda () | |
| + (and (provided? "eb") | |
| + eb-enable-for-annotation? | |
| + (set! eb-ptr (eb-new eb-dic-path))))) | |
| + | |
| +(define eb-search | |
| + (lambda (text) | |
| + (if (and eb-ptr eb-enable-for-annotation?) | |
| + (eb-search-text eb-ptr text) | |
| + ""))) | |
| + | |
| +(define eb-release | |
| + (lambda () | |
| + (and eb-ptr | |
| + (eb-destroy eb-ptr)))) | |
| diff --git a/scm/im.scm b/scm/im.scm | |
| index 15413a0..fa83902 100644 | |
| --- a/scm/im.scm | |
| +++ b/scm/im.scm | |
| @@ -36,6 +36,7 @@ | |
| (require "util.scm") | |
| (require "i18n.scm") | |
| (require "load-action.scm") | |
| +(require "eb.scm") | |
| ;; config | |
| (define default-im-name #f) | |
| @@ -353,11 +354,12 @@ | |
| (define create-context | |
| (lambda (uc lang name) | |
| (let* ((im (find-im name lang)) | |
| - (arg (and im (im-init-arg im)))) | |
| + (arg (and im (im-init-arg im)))) | |
| (im-set-encoding uc (im-encoding im)) | |
| (let* ((handler (im-init-handler im)) | |
| - (c (handler uc im arg))) | |
| - (register-context c) | |
| + (c (handler uc im arg))) | |
| + (eb-init) | |
| + (register-context c) | |
| ;; im-* procedures that require uc->sc must not called here since it | |
| ;; is not filled yet. Place such procedures to setup-context. | |
| c)))) | |
| @@ -371,6 +373,7 @@ | |
| (define release-context | |
| (lambda (uc) | |
| + (eb-release) | |
| (invoke-handler im-release-handler uc) | |
| (remove-context (im-retrieve-context uc)) | |
| #f)) | |
| @@ -514,7 +517,10 @@ | |
| (define get-candidate | |
| (lambda (uc idx accel-enum-hint) | |
| - (invoke-handler im-get-candidate-handler uc idx accel-enum-hint))) | |
| + (let ((c (invoke-handler im-get-candidate-handler uc idx accel-enum-hint))) | |
| + (if (string=? (last c) "") | |
| + (set-cdr! (cdr c) (list (eb-search (car c))))) | |
| + c))) | |
| (define set-candidate-index | |
| (lambda (uc idx) | |
| -- | |
| 1.6.4.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment