OSDN Git Service

IME 確定前スレ絞込みの導入中。
authoryoffy <yoffy>
Wed, 27 Oct 2004 00:53:44 +0000 (00:53 +0000)
committeryoffy <yoffy>
Wed, 27 Oct 2004 00:53:44 +0000 (00:53 +0000)
Giko.pas

index b3f1bae..b868cdb 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -990,6 +990,7 @@ type
                FResRangeMenuSelect     : Longint;                      ///< ResRangeButton \82Å\91I\91ð\82³\82ê\82Ä\82¢\82é\8d\80\96Ú (\83t\83H\81[\83}\83b\83g\82Í ResRange \8cÝ\8a·)
                FStartUp : Boolean;
                FIsHandledWheel : Boolean;                      ///< \8aù\82É\8eó\82¯\8eæ\82Á\82½ WM_MOUSEWHEEL \82©\82Ç\82¤\82©
+               FDefSelectComboBoxProc : TWndMethod;    //!< SelectComboBox \83f\83t\83H\83\8b\83g\83n\83\93\83h\83\89
                procedure SetBoardTreeNode( inBBS : TBBS );
                function SetCategoryListItem(ABBS2ch: TBBS): Integer;
                function SetBoardListItem(Category: TCategory): Integer;
@@ -1098,6 +1099,10 @@ type
                procedure OnGestureMove(Sender: TObject);
                //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8fI\97¹
                procedure OnGestureEnd(Sender: TObject);
+               //! SelectComboBox \83n\83\93\83h\83\89
+               procedure SelectComboBoxWndProc(var Message: TMessage);
+               //! \8di\82è\8d\9e\82Ý\95\8e\9a\97ñ\90Ý\92è
+               procedure SetSelectWord( const text : string );
        protected
                procedure CreateParams(var Params: TCreateParams); override;
                procedure WndProc(var Message: TMessage); override;
@@ -1205,7 +1210,7 @@ var
 implementation
 
 uses
-       About, Option, Round, Splash, Sort, ListSelect,
+       About, Option, Round, Splash, Sort, ListSelect, Imm,
        NewBoard, MojuUtils, Clipbrd, GikoBayesian;
 
 const
@@ -1591,6 +1596,10 @@ begin
        ReadToolBarSetting(ActionList, StdToolBar);
        ReadToolBarSetting(ActionList, ListToolBar);
        try
+               // SelectComboBox \83f\83t\83H\83\8b\83g\83n\83\93\83h\83\89\91Þ\94ð
+               FDefSelectComboBoxProc := SelectComboBox.WindowProc;
+               // \83n\83\93\83h\83\89\82ð\83t\83b\83N
+               SelectComboBox.WindowProc := SelectComboBoxWndProc;
                for i := ListToolBar.ControlCount - 1 downto 0 do
                begin
                        if ListToolBar.Controls[ i ].Action = SelectItemAction then
@@ -9013,10 +9022,10 @@ begin
        end;
 end;
 
-
-procedure TGikoForm.SelectComboBoxChange(Sender: TObject);
+procedure TGikoForm.SetSelectWord( const text : string );
 begin
-       if Length( SelectComboBox.Text ) = 0 then
+
+       if Length( text ) = 0 then
        begin
                AllItemAction.Checked := True;
                LogItemAction.Checked := False;
@@ -9024,17 +9033,25 @@ begin
        end else begin
                // \83`\83\89\82Â\82­\82Æ\8c\99\82¾\82©\82ç\81A\88ê\89\9e\89\9f\82µ\82Ä\82 \82é\82Æ\82«\82¾\82¯\8f\88\97\9d\82·\82é
                if AllItemAction.Checked then
-                                               AllItemAction.Checked := False;
+                       AllItemAction.Checked := False;
                if LogItemAction.Checked then
-                                               LogItemAction.Checked := False;
+                       LogItemAction.Checked := False;
                if NewItemAction.Checked then
-                                               NewItemaction.Checked := False;
+                       NewItemaction.Checked := False;
        end;
 
-       if Length( SelectComboBox.Text ) = 0 then
+       if Length( text ) = 0 then
                SetListViewType( gvtAll )
        else
-               SetListViewType( gvtUser, SelectComboBox.Text, false);
+               SetListViewType( gvtUser, text, false );
+
+end;
+
+procedure TGikoForm.SelectComboBoxChange(Sender: TObject);
+begin
+
+       SetSelectWord( SelectComboBox.Text );
+
 end;
 
 procedure TGikoForm.SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
@@ -11902,6 +11919,59 @@ begin
 
 end;
 
+procedure TGikoForm.SelectComboBoxWndProc(var Message: TMessage);
+var
+  IMC: HIMC;
+  Len: integer;
+  Str: string;
+  W: Word;
+  CH, CL : Char;
+  tmp: string;
+begin
+
+       //Message.LParam and $FF0000 <> 0\82Í\83L\81[\83{\81[\83h\93ü\97Í\82É\8cÀ\92è\82·\82é\82½\82ß
+       if (Message.Msg = WM_CHAR) and (Message.LParam and $FF0000 <> 0) then begin
+               W := TWMKey(Message).CharCode;
+               //if W > 31 then begin
+                       if W > 255 then begin
+                               CL := Chr(Lo(W));
+                               CH := Chr(Hi(W));
+                               Str := CH + CL;
+                       end else
+                               Str := Chr(Lo(W));
+
+                       SetSelectWord( Str );
+               //end;
+               Message.Result := 0;
+       end else if (Message.Msg = WM_IME_COMPOSITION) and ((Message.LParam and GCS_RESULTREADSTR) <> 0) then begin
+               IMC := ImmGetContext(SelectComboBox.Handle); //\83R\83\93\83e\83L\83X\83g\8eæ\93¾
+               Len := ImmGetCompositionString(IMC, GCS_RESULTREADSTR, nil, 0); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
+               SetLength(Str, Len + 1); //Buffer\82Ì\83\81\83\82\83\8a\82ð\90Ý\92è
+               ImmGetCompositionString(IMC, GCS_RESULTREADSTR, PChar(Str), Len + 1); //Buffer\82É\83R\83s\81[
+               ImmReleaseContext(SelectComboBox.Handle, IMC);  //\83R\83\93\83e\83L\83X\83g\89ð\95ú
+               SetLength(Str, Len);
+
+               SetSelectWord( Str );
+       end else if (Message.Msg = WM_IME_COMPOSITION) and ((Message.LParam and GCS_COMPSTR) <> 0) then begin
+               IMC := ImmGetContext(SelectComboBox.Handle); //\83R\83\93\83e\83L\83X\83g\8eæ\93¾
+               Len := ImmGetCompositionString(IMC, GCS_COMPSTR, nil, 0); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
+               SetLength(Str, Len + 1); //Buffer\82Ì\83\81\83\82\83\8a\82ð\90Ý\92è
+               ImmGetCompositionString(IMC, GCS_COMPSTR, PChar(Str), Len + 1); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
+               ImmReleaseContext(SelectComboBox.Handle, IMC);  //\83R\83\93\83e\83L\83X\83g\89ð\95ú
+               SetLength(Str, Len);
+               if SelectComboBox.SelLength > 0 then begin //\91I\91ð\92\86\82Ì\95\8e\9a\97ñ\82ª\82 \82é\82©
+                       tmp := Copy(SelectComboBox.Text, 1, SelectComboBox.SelStart);
+                       Str := tmp + Str + Copy(SelectComboBox.Text, SelectComboBox.SelStart + SelectComboBox.SelLength + 1, Length(SelectComboBox.Text));
+               end else
+                       Str := SelectComboBox.Text + Str;
+
+               SetSelectWord(Str);
+       end;
+
+       FDefSelectComboBoxProc(Message);
+       
+end;
+
 initialization
                                OleInitialize(nil);
 finalization