+ end;
+ end else begin
+ ShowMessage('\90\94\92l\82ð\93ü\97Í\82µ\82Ä\82\82¾\82³\82¢');
+ UpdateSambaActionExecute(Sender);
+ end;
+ end;
+end;
+
+procedure TEditorForm.UpdateSambaStatus;
+begin
+ if (FSambaTimer.Enabled) then begin
+ StatusBar.Panels[2].Text
+ := 'Samba24\8bK\92è\92l' + IntToStr(FSambaTimer.SambaInterval);
+ end;
+end;
+
+procedure TEditorForm.InputAssistActionExecute(Sender: TObject);
+var
+ count, i : Integer;
+ item : TMenuItem;
+ point: TPoint;
+ Bitmap : TBitmap;
+ TextWidth, ItemWidth, tmpWidth: Integer;
+begin
+ if FInputAssistKey = '' then Exit;
+
+ InputAssistPopupMenu.Items.Clear;
+
+ if (FResistWords = nil) then begin
+ FResistWords := TStringList.Create;
+ end else begin
+ FResistWords.Clear;
+ end;
+
+ if (GetKeyState( VK_SHIFT ) < 0) then begin
+ // \83V\83t\83g\82ª\89\9f\82³\82ê\82Ä\82¢\82ê\82Î\81A\83L\81[\82Å\8en\82Ü\82é\83J\83e\83S\83\8a
+ count :=
+ InputAssistDM.GetStartWithCategoryResistWords(
+ FInputAssistKey, FResistWords);
+ end else begin
+ // \83V\83t\83g\82ª\96³\82¢\82Ì\82Å\81A\83L\81[\82Å\8en\82Ü\82é\83L\81[
+ count :=
+ InputAssistDM.GetStartWithKeyResistWords(
+ FInputAssistKey, FResistWords);
+ end;
+ Bitmap := TBitmap.Create;
+ try
+ Bitmap.Canvas.Font.Assign(BodyEdit.Font);
+ // \83}\81[\83W\83\935px
+ TextWidth := Bitmap.Canvas.TextWidth(FInputAssistKey) + 5;
+ ItemWidth := 0;
+ for i := 0 to count - 1 do begin
+ item := TMenuItem.Create(nil);
+ item.Break := mbNone;
+ item.Caption := FResistWords[i];
+ item.Tag := i;
+ item.OnClick := InputAssistMenuClick;
+ InputAssistPopupMenu.Items.Add(item);
+
+ tmpWidth := Bitmap.Canvas.TextWidth(Item.Caption);
+ if (tmpWidth > ItemWidth) then begin
+ ItemWidth := tmpWidth;
+ end;
+ end;
+ finally
+ Bitmap.Free;
+ end;
+
+ if (count > 0) then begin
+ GetCaretpos(point);
+ point.X := point.X + Self.Left + (Self.Width - BodyEdit.Width) div 2;
+ point.Y := point.Y + Self.Top + (Self.Height - Self.ClientHeight);
+
+ if Screen.DesktopWidth >
+ (point.X + TextWidth + ItemWidth) then begin
+ InputAssistPopupMenu.Popup(
+ point.X + TextWidth,
+ point.Y + EditorPage.Top + EditorPage.TabHeight + BodyEdit.Top);
+ end else begin
+ InputAssistPopupMenu.Popup(
+ point.X - TextWidth - ItemWidth,
+ point.Y + EditorPage.Top + EditorPage.TabHeight + BodyEdit.Top);
+ end;
+ end;
+end;
+
+procedure TEditorForm.InputAssistMenuClick(Sender: TObject);
+var
+ text : String;
+ IMC: HIMC;
+begin
+ if not (Sender is TMenuItem) then Exit;
+
+ if (FResistWords <> nil) then begin
+ try
+ text :=
+ TResistWord(FResistWords.Objects[TMenuItem(Sender).Tag]).GetText;
+ except
+ text := '';
+ end;
+ IMC := ImmGetContext(BodyEdit.Handle); //\83R\83\93\83e\83L\83X\83g\8eæ\93¾
+ try
+ ImmNotifyIME(IMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
+ finally
+ ImmReleaseContext(BodyEdit.Handle, IMC); //\83R\83\93\83e\83L\83X\83g\89ð\95ú
+ end;
+
+ FResistWords.Clear;
+ FInputAssistKey := '';
+ end;
+ InsertText(BodyEdit, text);
+end;
+
+//! TMemo\82Ì\83J\81[\83\\83\8b\88Ê\92u\82É\95¶\8e\9a\97ñ\91}\93ü
+procedure TEditorForm.InsertText(Memo: TMemo; Text: String);
+var
+ line, sel, pos: Integer;
+ left, right : String;
+begin
+ Memo.Lines.BeginUpdate;
+ line := SendMessage(Memo.Handle,EM_LINEFROMCHAR,-1,0); //\8ds
+ sel := Memo.SelStart;
+ pos := sel - SendMessage(Memo.Handle, EM_LINEINDEX, -1, 0); //\8c\85
+ if (pos > 0) then begin
+ left := Copy(Memo.Lines[line], 0, pos);
+ end else begin
+ left := '';
+ end;
+ right := Copy(Memo.Lines[line], pos + 1, Length(Memo.Lines[line]));
+ Memo.Lines.Strings[line] := left + Text + right;
+ Memo.Lines.EndUpdate;
+ //\81@\83L\83\83\83\8c\83b\83g\82Ì\88Ê\92u\82ð\8dX\90V\82·\82é
+ Memo.SelStart := sel + Length(text);
+ // \83L\83\83\83\8c\83b\83g\82Ì\88Ê\92u\82Ü\82Å\83X\83N\83\8d\81[\83\8b
+ Memo.Perform(EM_SCROLLCARET, 0, 0);
+
+end;
+
+procedure TEditorForm.ApplicationEvents1Message(var Msg: tagMSG;
+ var Handled: Boolean);
+var
+ wmMsg: TWMKey;
+ IMC: HIMC;
+ Len: integer;
+ Str: string;
+begin
+ if (Self.Active) then begin
+ case Msg.message of
+ //\83L\81[\89\9f\89º\82Ì\82Ý\8eó\82¯\8eæ\82é
+ WM_KEYDOWN:
+ begin
+ // \83^\83u\82ª\81h\95Ò\8fW\81h\82ÅCtrl\83L\81[\82ª\89\9f\82³\82ê\82Ä\82¢\82é\82Ì\82ð\8am\94F\82·\82é
+ if (EditorPage.ActivePageIndex = 0)
+ and (GetKeyState( VK_CONTROL ) < 0) then begin
+ wmMsg.Msg := Msg.message;
+ wmMsg.CharCode := Word(Msg.wParam);
+ wmMsg.KeyData := Msg.lParam;
+ if (wmMsg.CharCode = 229) and (wmMsg.KeyData = 3735553) then begin
+ IMC := ImmGetContext(BodyEdit.Handle); //\83R\83\93\83e\83L\83X\83g\8eæ\93¾
+ Len := ImmGetCompositionString(IMC, GCS_COMPSTR, nil, 0); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
+ if (Len > 0) then begin
+ 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¾
+ SetLength(Str, Len);
+ FInputAssistKey := Str;
+ InputAssistActionExecute(nil);
+ Handled := True;
+ end;
+ ImmReleaseContext(BodyEdit.Handle, IMC); //\83R\83\93\83e\83L\83X\83g\89ð\95ú
+ end;
+ end;
+ end;
+ end;
+
+ end;
+end;
+
+procedure TEditorForm.ShowInputAssistFormExecute(Sender: TObject);
+var
+ form : TInputAssistForm;
+begin
+ form := TInputAssistForm.Create(nil);
+ try
+ if TopAction.Checked then begin // \83X\83e\83C\8fó\91Ô\82É\90Ý\92è
+ SetWindowPos(form.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);