+
+//! \83T\83\93\83o\8dX\90V\82Ì\83A\83N\83V\83\87\83\93\82ÌUpdate\83C\83x\83\93\83g\81@\8aÈ\92P\82Ì\82½\82ß\83^\83C\83}\81[\82Æ\93¯\82¶\82É\82µ\82Ä\82¨\82
+procedure TEditorForm.UpdateSambaActionUpdate(Sender: TObject);
+begin
+ UpdateSambaAction.Enabled := FSambaTimer.Enabled;
+end;
+
+//! \83T\83\93\83o\8dX\90V\83A\83N\83V\83\87\83\93
+procedure TEditorForm.UpdateSambaActionExecute(Sender: TObject);
+var
+ input : String;
+ i : Integer;
+begin
+ if InputQuery('Samba24\90Ý\92è\92l\8dX\90V', '\90V\82µ\82¢\90Ý\92è\92l\82ð\93ü\97Í\82µ\82Ä\82\82¾\82³\82¢', input) then begin
+ input := ZenToHan(input);
+ if GikoSys.IsNumeric(input) then begin
+ FSambaTimer.UpdateSambaSetting(StrToInt(input));
+ UpdateSambaStatus;
+ //\91S\82Ä\82Ì\83t\83H\81[\83\80\82©\82ç\81ASamba\83^\83C\83}\81[\82ð\8dX\90V\82·\82é
+ for i := 0 to Screen.FormCount - 1 do begin
+ if Screen.Forms[i] is TEditorForm then begin
+ TEditorForm(Screen.Forms[i]).FSambaTimer.Update;
+ TEditorForm(Screen.Forms[i]).UpdateSambaStatus;
+ end;
+ 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);
+ end;
+ form.SetUpFromEditor;
+ if (form.ShowModal = mrOk) then begin
+ InsertText(BodyEdit, form.GetInsertText);
+ end;
+ finally
+ form.Release;
+ end;
+end;
+//! Cookie\8fî\95ñ\8dí\8f\9c
+procedure TEditorForm.ReleaseCookieActionExecute(Sender: TObject);
+var
+ Board : TBoard;
+begin
+ // \83X\83\8c\83b\83h\82ª\96³\82¢\81@\83X\83\8c\97§\82Ä\82Ì\82Æ\82«\82ÍFBoard\82ð\92¼\90Ú\8eg\82¤
+ Board := GetBoard;
+
+ // \83N\83b\83L\81[\82Ì\8fî\95ñ\82ð\8eÌ\82Ä\82é
+ Board.Cookie := '';
+ Board.SPID := '';
+ Board.PON := '';
+ // 0\82É\8aª\82«\96ß\82·
+ Board.Expires := 0;
+end;
+//! \94Â\8fî\95ñ\8eæ\93¾Update\83C\83x\83\93\83g
+procedure TEditorForm.GetSETTINGTXTActionUpdate(Sender: TObject);
+begin
+ // \8eÀ\8ds\92\86\82Í\8eÀ\8ds\95s\89Â
+ GetSETTINGTXTAction.Enabled := not FWork;
+end;
+//! \83\8d\81[\83J\83\8b\83\8b\81[\83\8b\8eæ\93¾Update\83C\83x\83\93\83g
+procedure TEditorForm.GetHeadTXTActionUpdate(Sender: TObject);
+begin
+ // \8eÀ\8ds\92\86\82Í\8eÀ\8ds\95s\89Â
+ GetSETTINGTXTAction.Enabled := not FWork;
+end;
+
+//! Samba\83^\83C\83}\81[\83C\83x\83\93\83g
+procedure TEditorForm.SambaTimer(Sender: TObject);
+begin
+
+ if FSambaTimer.WriteDeta = ZERO_DATE then
+ StatusBar.Panels[1].Text := '\8f\89\8f\91'
+ else begin
+ FNow := IncMilliSecond(FNow, 500);
+ StatusBar.Panels[1].Text :=
+ Format('%8.0f\95b\8co\89ß', [SecondSpan(FNow, FSambaTimer.WriteDeta)]);
+ end;
+end;
+{
+\brief \83E\83B\83\93\83h\83E\82Ì\88Ê\92u\82Æ\83T\83C\83Y\82Ì\90Ý\92è
+}
+procedure TEditorForm.SetWindowRect;
+var
+ wp: TWindowPlacement;
+begin
+ //\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\90Ý\92è
+ wp.length := sizeof(wp);
+ wp.rcNormalPosition.Top := GikoSys.Setting.EditWindowTop;
+ wp.rcNormalPosition.Left := GikoSys.Setting.EditWindowLeft;
+
+ wp.rcNormalPosition.Bottom := GikoSys.Setting.EditWindowTop + GikoSys.Setting.EditWindowHeight;
+ wp.rcNormalPosition.Right := GikoSys.Setting.EditWindowLeft + GikoSys.Setting.EditWindowWidth;
+ wp.showCmd := SW_HIDE;
+ SetWindowPlacement(Handle, @wp);
+
+ if GikoSys.Setting.EditWindowMax then begin
+ WindowState := wsMaximized;
+ end;
+
+ //\83E\83B\83\93\83h\83E\82ª\89æ\96Ê\8aO\82È\82ç\89æ\96Ê\93à\82É\88Ú\93®\82·\82é
+ if (Left + Width) > Screen.Width then begin
+ Left := 0;
+ end;
+ if (Top + Height) > Screen.Height then begin
+ Top := 0;
+ end;
+ if Left < 0 then begin
+ Left := 0;
+ end;
+ if Top < 0 then begin
+ Top := 0;
+ end;
+
+ //\8c»\8dÝ\82Ì\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\82ð\95Û\91¶
+ GikoSys.Setting.EditWindowTop := Top + WINDOWMOVE_V; // \8e\9f\82É\8aJ\82\83E\83B\83\93\83h\83E\82Í
+ GikoSys.Setting.EditWindowLeft := Left + WINDOWMOVE_H; // \81@\81@\81@\89E\8eÎ\82ß\89º\82É\82¸\82ç\82·
+ //\83E\83B\83\93\83h\83E\82Ì\95\9d\82Æ\8d\82\82³\82ª\8f¬\82³\82·\82¬\82¢\82ê\82Î\8c³\82É\96ß\82·
+ if GikoSys.Setting.EditWindowHeight < 144 then begin
+ Height := 400;
+ end;
+ if GikoSys.Setting.EditWindowWidth < 144 then begin
+ Width := 640;
+ end;
+end;
+{
+\brief \8ag\92£\83^\83u\90Ý\92è
+}
+procedure TEditorForm.SetExtraTab;
+const
+ SECTION = 'EditorForm';
+var
+ ini: TMemIniFile;
+begin
+ ini := TMemIniFile.Create(GikoSys.Setting.GetFileName);
+ try
+ BoardtopTab.TabVisible := ini.Readbool(SECTION, 'BoardTopTab', False);
+ BoardTop.Checked := BoardtopTab.TabVisible;
+ RocalRuleTab.TabVisible := ini.ReadBool(SECTION, 'LocalRuleTab', False);
+ LocalRule.Checked := RocalRuleTab.TabVisible;
+ finally
+ ini.Free;
+ end;
+end;
+{
+\brief \94Â\8eæ\93¾
+\return \83\8c\83X\83G\83f\83B\83^\82ª\93\8a\8de\82µ\82æ\82¤\82Æ\82µ\82Ä\82¢\82é\94Â
+}
+function TEditorForm.GetBoard : TBoard;
+begin
+ // \83X\83\8c\83b\83h\83A\83C\83e\83\80\82ªnull\82Ì\8e\9e\82ÍFBoard
+ if FThreadItem = nil then begin
+ Result := FBoard;
+ end else begin
+ Result := FThreadItem.ParentBoard;
+ end;
+end;
+{
+\brief GikoForm\82É\83\81\83b\83Z\81[\83W\82ð\92Ç\89Á\82·\82é
+\param icon \83\81\83b\83Z\81[\83W\82É\82Â\82\83A\83C\83R\83\93
+}
+procedure TEditorForm.AddFormMessageNew(icon: TGikoMessageIcon);
+begin
+ if FThreadItem = nil then begin
+ GikoForm.AddMessageList(FBoard.Title + ' ' + GikoSys.GetGikoMessage(gmNewSure), nil, icon)
+ end else begin
+ GikoForm.AddMessageList(FThreadItem.Title + ' ' + GikoSys.GetGikoMessage(gmNewRes), nil, icon);
+ end;
+
+end;
+{
+\brief \83\8d\81[\83J\83\8bfusiana\83g\83\89\83b\83v
+\return true:\91\97\90M\92\86\8e~ false:\91\97\90M
+}
+function TEditorForm.isLocalFusianaTrap: Boolean;
+var
+ Namae : string;
+begin
+ Result := False;
+ if GikoSys.Setting.LocalTrapAtt then begin
+ Namae := THTMLCreate.RepHtml(NameComboBox.Text);
+ if (LFusianaGet(Namae)) or (Namae = '\8eR\8dè\8fÂ') then begin
+ if FusianaMsgBox = IDNO then begin
+ Result := True;
+ end;
+ end;
+ end;
+end;
+{
+\brief \83\8a\83\82\81[\83gfusiana\83g\83\89\83b\83v
+\return true:\91\97\90M\92\86\8e~ false:\91\97\90M
+}
+function TEditorForm.isRemoteFusianaTrap: Boolean;
+var
+ Namae : string;
+ Board : TBoard;
+ Remote: string;
+ body : TStringList;
+begin
+ Result := False;
+ Namae := THTMLCreate.RepHtml(NameComboBox.Text);
+ if (GikoSys.Setting.RemoteTrapAtt) and (Length(Namae) = 0) then begin
+ Board := GetBoard;
+
+ if Board = nil then Exit;
+
+ if not FileExists(Board.GetSETTINGTXTFileName) then begin
+ //Setting.txt\82ª\82È\82©\82Á\82½\82ç\8eæ\93¾
+ //\8eI\82É\95\89\89×\82ª\82©\82©\82è\82»\82¤...
+ try
+ GetSETTINGTXTAction.Execute;
+ except
+ end;
+ end;
+
+ Remote := '';
+ if FileExists(Board.GetSETTINGTXTFileName) then begin
+ body := TStringList.Create;
+ try
+ body.LoadFromFile(Board.GetSETTINGTXTFileName);
+ Remote := GetFusianaName(body, Board);
+ finally
+ body.Free;
+ end;
+ end;
+
+ if LFusianaGet(Remote) then begin
+ if FusianaMsgBox = IDNO then begin
+ Result := True;
+ end;
+ end;
+ end;
+end;
+{
+\brief Header\95¶\8e\9a\97ñ\8eæ\93¾
+\param ACOOKIE Cookie
+\param SPID SPID
+\param PON PON
+\param Board \94Â
+\return Header\95¶\8e\9a\97ñ
+}
+function TEditorForm.getHeaderStr(const ACOOKIE: string; const SPID : string;
+ const PON : string; Board : TBoard) : string;
+begin
+ Result := ACOOKIE;
+ if SPID <> '' then
+ Result := Result + 'SPID=' + SPID + '; ';
+ if PON <> '' then
+ Result := Result + 'PON=' + PON + '; ';
+
+ //\83z\83X\83g\82ª2ch\82Å\81ABe\82ÉLogin\82µ\82Ä\82¢\82ê\82ÎBE\82Ì\83f\81[\83^\82ð\91\97\82é
+ //GikoSys.ParseURI( URL, Protocol,Host, Path, Document, Port, Bookmark );
+ //if GikoSys.Is2chHost(Host) and GikoSys.Setting.BeLogin then
+ if (Board.Is2ch) then begin
+ // \8cÅ\92è\82Ì\83N\83b\83L\81[\82ª\82 \82ê\82Î\90H\82í\82¹\82é
+ if Length(GikoSys.Setting.FixedCookie) > 0 then begin
+ // \83z\83X\83g\82ª2ch\82Ì\8fê\8d\87\81C\8cÅ\92è\82Ì\83N\83b\83L\81[\82ð\90H\82í\82¹\82é
+ Result := Result + GikoSys.Setting.FixedCookie + '; ';
+ end;
+ if (GikoSys.Setting.BeLogin) then begin
+ Result := Result + 'MDMD=' + GikoSys.Setting.BeCode + '; '
+ + 'DMDM=' + GikoSys.Setting.BeUserID + '; ';
+ end;
+
+ end;
+
+ Result := 'Cookie: ' + Result + 'NAME=' + NameComboBox.Text + '; MAIL=' + MailComboBox.Text;
+
+end;
+{
+\brief fusiana\8cx\8d\90\83_\83C\83A\83\8d\83O
+\return IDYES \8f\91\82«\8d\9e\82Þ IDNO \92\86\8e~
+}
+function TEditorForm.FusianaMsgBox: Integer;
+const
+ MSG_FUSIANA : string = '\83\8a\83\82\81[\83g\83z\83X\83g\82ð\95\\8e¦\82·\82é\8b@\94\\82ª\8eg\82í\82ê\82Ä\82¢\82Ü\82·'#13#10 +
+ '\82à\82µ\82à\8aÔ\88á\82Á\82Ä\82±\82Ì\95û\96@\82Å\83z\83X\83g\82ª\95\\8e¦\82³\82ê\82½\82Æ\82µ\82Ä\82à\81A\8e©\8cÈ\90Ó\94C\82È\82Ì\82Å\8dí\8f\9c\88Ë\97\8a\82É\82Í\89\9e\82¶\82Ü\82¹\82ñ\81B' +
+ #13#10#13#10'\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H';
+begin
+ Result := MsgBox(Handle, MSG_FUSIANA, '\8fî\95ñ',
+ MB_YESNO or MB_ICONQUESTION);
+end;
+