Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/GikoDataModule.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.59.2.1 by h677, Sun Jul 29 03:13:13 2007 UTC revision 1.80 by h677, Sun Nov 20 10:18:23 2011 UTC
# Line 42  const Line 42  const
42          //! 2ちゃんねるのURL          //! 2ちゃんねるのURL
43          URL_2ch: string = 'www.2ch.net/';          URL_2ch: string = 'www.2ch.net/';
44          //! ギコナビWikiのURL          //! ギコナビWikiのURL
45          URL_Wiki: string = 'gikowiki.dyndns.info/index.php?FAQ';          URL_Wiki: string = 'sourceforge.jp/projects/gikonavi/wiki/FAQ';
46    
47          SELECTCOMBOBOX_NAME: string = ''; // 'スレッド絞込検索';          SELECTCOMBOBOX_NAME: string = ''; // 'スレッド絞込検索';
48          SELECTCOMBOBOX_COLOR: TColor = clWindow;          SELECTCOMBOBOX_COLOR: TColor = clWindow;
# Line 237  type Line 237  type
237      ScrollPageUpAction: TAction;      ScrollPageUpAction: TAction;
238      AllLinkToClipboardAction: TAction;      AllLinkToClipboardAction: TAction;
239      NewLinkToClipboardAction: TAction;      NewLinkToClipboardAction: TAction;
240        AddIDtoNGWord0Action: TAction;
241        AddIDtoNGWord1Action: TAction;
242        ExtractSameIDAction: TAction;
243        ShowTabListAction: TAction;
244        DereferenceResAction: TAction;
245        UpdateGikonaviAction: TAction;
246        konoURLPATHAction: TAction;
247        konoURLQueryAction: TAction;
248        PopupMenuSettingAction: TAction;
249          procedure EditNGActionExecute(Sender: TObject);          procedure EditNGActionExecute(Sender: TObject);
250          procedure ReloadActionExecute(Sender: TObject);          procedure ReloadActionExecute(Sender: TObject);
251          procedure GoFowardActionExecute(Sender: TObject);          procedure GoFowardActionExecute(Sender: TObject);
# Line 325  type Line 334  type
334          procedure TabsSaveActionExecute(Sender: TObject);          procedure TabsSaveActionExecute(Sender: TObject);
335          procedure TabsOpenActionExecute(Sender: TObject);          procedure TabsOpenActionExecute(Sender: TObject);
336          procedure BeLogInOutActionExecute(Sender: TObject);          procedure BeLogInOutActionExecute(Sender: TObject);
         procedure BeLogInOutActionUpdate(Sender: TObject);  
337          procedure KokomadeActionExecute(Sender: TObject);          procedure KokomadeActionExecute(Sender: TObject);
338          procedure ZenbuActionExecute(Sender: TObject);          procedure ZenbuActionExecute(Sender: TObject);
339          procedure KokoResActionExecute(Sender: TObject);          procedure KokoResActionExecute(Sender: TObject);
# Line 444  type Line 452  type
452      procedure ScrollPageUpActionExecute(Sender: TObject);      procedure ScrollPageUpActionExecute(Sender: TObject);
453      procedure AllLinkToClipboardActionExecute(Sender: TObject);      procedure AllLinkToClipboardActionExecute(Sender: TObject);
454      procedure NewLinkToClipboardActionExecute(Sender: TObject);      procedure NewLinkToClipboardActionExecute(Sender: TObject);
455        procedure AddIDtoNGWord0ActionExecute(Sender: TObject);
456        procedure AddIDtoNGWord1ActionExecute(Sender: TObject);
457        procedure ExtractSameIDActionExecute(Sender: TObject);
458        procedure ShowTabListActionExecute(Sender: TObject);
459        procedure DereferenceResActionExecute(Sender: TObject);
460        procedure UpdateGikonaviActionExecute(Sender: TObject);
461        procedure konoURLPATHActionExecute(Sender: TObject);
462        procedure konoURLQueryActionExecute(Sender: TObject);
463        procedure konoURLQueryActionUpdate(Sender: TObject);
464        procedure PopupMenuSettingActionExecute(Sender: TObject);
465    private    private
466          { Private 宣言 }          { Private 宣言 }
467          procedure ClearResFilter;          procedure ClearResFilter;
# Line 459  type Line 477  type
477          procedure ClearSelectComboBox;          procedure ClearSelectComboBox;
478      procedure ClearMailAllEditor();      procedure ClearMailAllEditor();
479      procedure ClearNameTextAllEditor();      procedure ClearNameTextAllEditor();
480      procedure MoveURLWithHistory(URL : String);      procedure MoveURLWithHistory(URL : String; KeyMask: Boolean = False);
481      procedure BackToHistory(item: TMoveHistoryItem);      procedure BackToHistory(item: TMoveHistoryItem);
482      function GetActiveThreadLinks : IHTMLElementCollection;      function GetActiveThreadLinks : IHTMLElementCollection;
483      procedure GetLinkURLs(links : IHTMLElementCollection;      procedure GetLinkURLs(links : IHTMLElementCollection;
# Line 476  type Line 494  type
494          procedure DependActiveCntentActionUpdate(Sender: TObject);          procedure DependActiveCntentActionUpdate(Sender: TObject);
495          //! TActionでGetActiveContentがnil以外かつログを持っていると有効になる          //! TActionでGetActiveContentがnil以外かつログを持っていると有効になる
496          procedure DependActiveCntentLogActionUpdate(Sender: TObject);          procedure DependActiveCntentLogActionUpdate(Sender: TObject);
497          //! TActionでActiveListがTBoardで有効になる          //! TActionでActiveListがTBoard(非特殊板)で有効になる
498          procedure DependActiveListTBoardActionUpdate(Sender: TObject);          procedure DependActiveListTBoardActionUpdate(Sender: TObject);
499            //! TActionでActiveListがTBoardで有効になる
500            procedure DependActiveListTBoardWithSpeciapActionUpdate(Sender: TObject);
501    end;    end;
502    
503  var  var
# Line 496  uses Line 516  uses
516          GikoBayesian, About, ShellAPI,          GikoBayesian, About, ShellAPI,
517          RoundName, RoundData, Menus, ListViewUtils,          RoundName, RoundData, Menus, ListViewUtils,
518          ThreadControl, GikoMessage, InputAssist,          ThreadControl, GikoMessage, InputAssist,
519      DefaultFileManager, Forms, NewBoardURL;      DefaultFileManager, Forms, NewBoardURL, UpdateCheck,
520        PopupMenuSetting;
521    
522  const  const
523          MSG_ERROR : string = 'エラー';          MSG_ERROR : string = 'エラー';
# Line 518  begin Line 539  begin
539                                                                          and (GikoForm.GetActiveContent.IsLogFile);                                                                          and (GikoForm.GetActiveContent.IsLogFile);
540  end;  end;
541  // *************************************************************************  // *************************************************************************
542  //! TActionでActiveListがTBoardで有効になる  //! TActionでActiveListがTBoard(非特殊板)で有効になる
543  // *************************************************************************  // *************************************************************************
544  procedure TGikoDM.DependActiveListTBoardActionUpdate(Sender: TObject);  procedure TGikoDM.DependActiveListTBoardActionUpdate(Sender: TObject);
545  begin  begin
546            TAction(Sender).Enabled := (GikoForm.GetActiveList is TBoard) and
547            (GikoForm.GetActiveList <> BoardGroup.SpecialBoard);
548    end;
549    // *************************************************************************
550    //! TActionでActiveListがTBoardで有効になる
551    // *************************************************************************
552    procedure TGikoDM.DependActiveListTBoardWithSpeciapActionUpdate(Sender: TObject);
553    begin
554          TAction(Sender).Enabled := (GikoForm.GetActiveList is TBoard);          TAction(Sender).Enabled := (GikoForm.GetActiveList is TBoard);
555  end;  end;
556  // *************************************************************************  // *************************************************************************
# Line 904  begin Line 933  begin
933    
934          GikoForm.ResRangeMenuSelect     := 100;          GikoForm.ResRangeMenuSelect     := 100;
935          OnlyAHundredResAction.Checked   := True;          OnlyAHundredResAction.Checked   := True;
936          // 表示範囲を設定する          // 表示範囲を設定する。設定値からとってくる。
937          SetResRange(100);      SetResRange(GikoSys.Setting.ResRangeExCount);
938  end;  end;
939  // *************************************************************************  // *************************************************************************
940  //! 未読レスのみ表示  //! 未読レスのみ表示
# Line 2040  begin Line 2069  begin
2069                          GikoForm.DeleteHistory(ThreadItem);                          GikoForm.DeleteHistory(ThreadItem);
2070                          GikoForm.DeleteTab(ThreadItem);                          GikoForm.DeleteTab(ThreadItem);
2071                          ThreadItem.DeleteLogFile;                          ThreadItem.DeleteLogFile;
   
                         GikoForm.TreeView.Refresh;      // UnRead の表示を更新  
2072                  end;                  end;
2073            GikoForm.TreeView.Refresh;      // UnRead の表示を更新
2074                  GikoForm.ListView.Refresh;                  GikoForm.ListView.Refresh;
2075          finally          finally
2076                  List.Free;                  List.Free;
# Line 2312  end; Line 2340  end;
2340  //! Be2chにログイン/ログアウトする  //! Be2chにログイン/ログアウトする
2341  // *************************************************************************  // *************************************************************************
2342  procedure TGikoDM.BeLogInOutActionExecute(Sender: TObject);  procedure TGikoDM.BeLogInOutActionExecute(Sender: TObject);
2343    var
2344            TmpCursor: TCursor;
2345            msg : String;
2346  begin  begin
2347          GikoSys.Setting.BeLogin := not GikoSys.Setting.BeLogin;          if GikoSys.Belib.Connected then begin
2348  end;                  //ログアウト
2349  // *************************************************************************                  GikoSys.Belib.Disconnect;
2350  //! Be2chにログイン/ログアウトするのUpdateイベント                  BeLogInOutAction.Checked := False;
2351  // *************************************************************************                  GikoForm.AddMessageList(GikoSys.GetGikoMessage(gmBeLogout), nil, gmiOK);
2352  procedure TGikoDM.BeLogInOutActionUpdate(Sender: TObject);          end else begin
2353  begin                  TmpCursor := GikoForm.ScreenCursor;
2354          if (GikoSys.Setting.BeUserID <> '') and (GikoSys.Setting.BeCode <> '') then begin                  GikoForm.ScreenCursor := crHourGlass;
2355                  if (GikoSys.Setting.BeLogin) then BeLogInOutAction.Checked := true                  try
2356                  else BeLogInOutAction.Checked := false;                          GikoSys.Belib.ClientUA := 'gikoNavi/1.00';
2357                  BeLogInOutAction.Enabled := true                          GikoSys.Belib.UserName := GikoSys.Setting.BeUserID;
2358          end else                          GikoSys.Belib.Password := GikoSys.Setting.BePassword;
2359                  BeLogInOutAction.Enabled := false;              if GikoSys.Setting.ReadProxy then begin
2360                                    GikoSys.Belib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
2361                                    GikoSys.Belib.ProxyPort := GikoSys.Setting.ReadProxyPort;
2362                            end else begin
2363                    GikoSys.Belib.ProxyAddress := '';
2364                                    GikoSys.Belib.ProxyPort := 0;
2365                end;
2366                if GikoSys.Belib.Connect then begin
2367                    GikoForm.AddMessageList(GikoSys.GetGikoMessage(gmBeLogin) + GikoSys.Setting.BeUserID, nil, gmiOK);
2368                    BeLogInOutAction.Checked := True;
2369                end else begin
2370                    GikoForm.AddMessageList(GikoSys.Belib.ErrorMsg, nil, gmiNG);
2371                    GikoForm.PlaySound('Error');
2372                    BeLogInOutAction.Checked := False;
2373                            end;
2374                    finally
2375                            GikoForm.ScreenCursor := TmpCursor;
2376                    end;
2377            end;
2378  end;  end;
2379  ////////////////////////////////ファイルまでおしまい/////////////////////  ////////////////////////////////ファイルまでおしまい/////////////////////
2380  // *************************************************************************  // *************************************************************************
# Line 2337  var Line 2386  var
2386          ThreadItem: TThreadItem;          ThreadItem: TThreadItem;
2387  begin  begin
2388          No := GikoForm.KokoPopupMenu.Tag;          No := GikoForm.KokoPopupMenu.Tag;
2389          if No = 0 then Exit;          if No = 0
2390          ThreadItem := GikoForm.GetActiveContent(True);          then Exit;
2391          if ThreadItem = nil then Exit;          ThreadItem := GikoForm.KokoPopupThreadItem;
2392            if not Assigned(ThreadItem) then
2393            Exit;
2394          ThreadItem.Kokomade := No;          ThreadItem.Kokomade := No;
2395          GikoForm.ActiveContent.Thread.ScrollTop :=          GikoForm.ActiveContent.Thread.ScrollTop := GikoForm.ActiveContent.Browser.OleObject.Document.Body.ScrollTop;
                 OleVariant(IHTMLDocument2(GikoForm.ActiveContent.Browser.Document)).Body.ScrollTop;  
2396          GikoForm.ActiveContent.Repaint := true;          GikoForm.ActiveContent.Repaint := true;
2397          GikoForm.InsertBrowserTab(GikoForm.ActiveContent.Thread, true);          GikoForm.InsertBrowserTab(GikoForm.ActiveContent.Thread, true);
2398          //INFO 2005/11/19 一旦隠蔽、必要ならGikoFormの方にメソッドを追加する          //INFO 2005/11/19 一旦隠蔽、必要ならGikoFormの方にメソッドを追加する
# Line 2358  begin Line 2408  begin
2408          ThreadItem := GikoForm.GetActiveContent(True);          ThreadItem := GikoForm.GetActiveContent(True);
2409          if ThreadItem = nil then Exit;          if ThreadItem = nil then Exit;
2410          ThreadItem.Kokomade := -1;          ThreadItem.Kokomade := -1;
2411          GikoForm.ActiveContent.Thread.ScrollTop :=          GikoForm.ActiveContent.Thread.ScrollTop := GikoForm.ActiveContent.Browser.OleObject.Document.Body.ScrollTop;
                 OleVariant(IHTMLDocument2(GikoForm.ActiveContent.Browser.Document)).Body.ScrollTop;  
2412          GikoForm.ActiveContent.Repaint := true;          GikoForm.ActiveContent.Repaint := true;
2413          GikoForm.InsertBrowserTab(GikoForm.ActiveContent.Thread, true);          GikoForm.InsertBrowserTab(GikoForm.ActiveContent.Thread, true);
2414          //INFO 2005/11/19 一旦隠蔽、必要ならGikoFormの方にメソッドを追加する          //INFO 2005/11/19 一旦隠蔽、必要ならGikoFormの方にメソッドを追加する
# Line 2376  var Line 2425  var
2425  begin  begin
2426          Number := GikoForm.KokoPopupMenu.Tag;          Number := GikoForm.KokoPopupMenu.Tag;
2427          if Number = 0 then Exit;          if Number = 0 then Exit;
2428          Item := GikoForm.GetActiveContent(True);          Item := GikoForm.KokoPopupThreadItem;
2429          if Item = nil then Exit;          if Item = nil then Exit;
2430    
2431          Editor := TEditorForm.Create(GikoForm);          Editor := TEditorForm.Create(GikoForm);
# Line 2400  const Line 2449  const
2449      LIMIT = 20;      LIMIT = 20;
2450  var  var
2451          ThreadItem : TThreadItem;          ThreadItem : TThreadItem;
2452          No, count: Integer;          No : Integer;
2453          body : string;          AID: string;
         limited: Integer;  
2454  begin  begin
2455          No := GikoForm.KokoPopupMenu.Tag;          No := GikoForm.KokoPopupMenu.Tag;
2456          if No = 0 then Exit;          if No = 0 then Exit;
2457          ThreadItem := GikoForm.GetActiveContent(True);          ThreadItem := GikoForm.KokoPopupThreadItem;
2458          if ThreadItem = nil then Exit;          if ThreadItem = nil then Exit;
2459          count := GikoSys.GetSameIDResCount(No, GikoForm.ActiveContent.Thread);  
2460          limited := LIMIT;      AID := GikoSys.GetResID(No, ThreadItem);
2461          if count > LIMIT then begin      if not IsNoValidID(AID) then begin
2462                  if ( GikoUtil.MsgBox(GikoForm.Handle,          GikoForm.ShowSameIDAncher(AID);
2463                                  IntToStr(LIMIT) + '個以上ありますが、すべて表示しますか?',      end;
                                 'IDポップアップ警告',  
                                 MB_YESNO or MB_ICONQUESTION) = ID_YES ) then begin  
             limited := -1;  
         end;  
         end;  
         body := GikoSys.GetSameIDResAnchor(No, ThreadItem, limited);  
         GikoForm.ActiveContent.IDAnchorPopup(body);  
2464  end;  end;
2465  // *************************************************************************  // *************************************************************************
2466  //! このレスあぼ〜ん (通常)  //! このレスあぼ〜ん (通常)
# Line 2449  begin Line 2490  begin
2490          IndividualForm := TIndividualAbonForm.Create(GikoForm);          IndividualForm := TIndividualAbonForm.Create(GikoForm);
2491          try          try
2492                  ThreadItem := GikoForm.GetActiveContent(True);                  ThreadItem := GikoForm.GetActiveContent(True);
2493                  ThreadItem.ScrollTop :=                  ThreadItem.ScrollTop := GikoForm.ActiveContent.Browser.OleObject.Document.Body.ScrollTop;
                         OleVariant(IHTMLDocument2(GikoForm.ActiveContent.Browser.Document)).Body.ScrollTop;  
2494                  if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin                  if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
2495                          if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin                          if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
2496                                  ReadList                := TStringList.Create;                                  ReadList                := TStringList.Create;
# Line 2497  begin Line 2537  begin
2537          IndividualForm := TIndividualAbonForm.Create(GikoForm);          IndividualForm := TIndividualAbonForm.Create(GikoForm);
2538          try          try
2539                  ThreadItem := GikoForm.GetActiveContent(True);                  ThreadItem := GikoForm.GetActiveContent(True);
2540                  ThreadItem.ScrollTop :=                  ThreadItem.ScrollTop := GikoForm.ActiveContent.Browser.OleObject.Document.Body.ScrollTop;
                         OleVariant(IHTMLDocument2(GikoForm.ActiveContent.Browser.Document)).Body.ScrollTop;  
2541                  if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin                  if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
2542                          if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin                          if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
2543                                  if (IndividualForm.ShowModal = mrOK) then begin                                  if (IndividualForm.ShowModal = mrOK) then begin
# Line 2642  end; Line 2681  end;
2681  // *************************************************************************  // *************************************************************************
2682  procedure TGikoDM.UpFolderActionUpdate(Sender: TObject);  procedure TGikoDM.UpFolderActionUpdate(Sender: TObject);
2683  begin  begin
2684          UpFolderAction.Enabled := not (GikoForm.GetActiveList is TBBS);          UpFolderAction.Enabled := not (GikoForm.GetActiveList is TBBS) and
2685            (GikoForm.GetActiveList <> BoardGroup.SpecialBoard);
2686  end;  end;
2687  // *************************************************************************  // *************************************************************************
2688  //! 表示 表示リストのモード変更  //! 表示 表示リストのモード変更
# Line 3005  procedure TGikoDM.SelectListReloadAction Line 3045  procedure TGikoDM.SelectListReloadAction
3045  begin  begin
3046          if (GikoForm.GetActiveList is TCategory) and (GikoForm.ListView.SelCount > 0) then          if (GikoForm.GetActiveList is TCategory) and (GikoForm.ListView.SelCount > 0) then
3047                  TAction(Sender).Enabled := True                  TAction(Sender).Enabled := True
3048          else if GikoForm.GetActiveList is TBoard then          else if GikoForm.GetActiveList is TBoard then begin
3049                  TAction(Sender).Enabled := True                  TAction(Sender).Enabled :=
3050          else              (GikoForm.GetActiveList <> BoardGroup.SpecialBoard);
3051            end else
3052                  TAction(Sender).Enabled := False;                  TAction(Sender).Enabled := False;
3053  end;  end;
3054  // *************************************************************************  // *************************************************************************
# Line 3205  end; Line 3246  end;
3246  // *************************************************************************  // *************************************************************************
3247  procedure TGikoDM.LogFolderOpenActionUpdate(Sender: TObject);  procedure TGikoDM.LogFolderOpenActionUpdate(Sender: TObject);
3248  begin  begin
3249          if ((GikoForm.GetActiveList is TBoard) or (GikoForm.GetActiveList is TCategory))          if (((GikoForm.GetActiveList is TBoard) and
3250                  and (GikoForm.ListView.SelCount > 0) then          (GikoForm.GetActiveList <> BoardGroup.SpecialBoard))
3251            or (GikoForm.GetActiveList is TCategory))
3252                    and (GikoForm.ListView.SelCount > 0) then
3253                  TAction(Sender).Enabled := True                  TAction(Sender).Enabled := True
3254          else          else
3255                  TAction(Sender).Enabled := False;                  TAction(Sender).Enabled := False;
# Line 4108  end; Line 4151  end;
4151  procedure TGikoDM.BackToHistory(item: TMoveHistoryItem);  procedure TGikoDM.BackToHistory(item: TMoveHistoryItem);
4152  var  var
4153      browser : TWebBrowser;      browser : TWebBrowser;
4154      doc : OleVariant;      doc : IHTMLDocument2;
4155  begin  begin
4156      if ( item <> nil ) then begin      if ( item <> nil ) then begin
4157          if ( GikoForm.GetActiveContent = item.ThreadItem ) then begin          if ( GikoForm.GetActiveContent = item.ThreadItem ) then begin
# Line 4116  begin Line 4159  begin
4159                  .Objects[GikoForm.BrowserTab.TabIndex]).Browser;                  .Objects[GikoForm.BrowserTab.TabIndex]).Browser;
4160              if (browser <> nil) then begin              if (browser <> nil) then begin
4161                  try                  try
4162                      doc := Idispatch( olevariant(browser.ControlInterface).Document) as IHTMLDocument2;                      doc := browser.ControlInterface.Document as IHTMLDocument2;
4163                      doc.Body.ScrollTop := item.ScrollTop;                      (doc.body as IHTMLElement2).ScrollTop := item.ScrollTop;
4164                  except                  except
4165                  end;                  end;
4166              end;              end;
4167          end else begin          end else begin
4168              //URLに移動              //URLに移動
4169              MoveURLWithHistory(item.ThreadItem.URL);              MoveURLWithHistory(item.ThreadItem.URL, True);
4170          end;          end;
4171      end;      end;
4172  end;  end;
4173  //! 履歴処理つきURL移動  //! 履歴処理つきURL移動
4174  procedure TGikoDM.MoveURLWithHistory(URL : String);  procedure TGikoDM.MoveURLWithHistory(URL : String; KeyMask: Boolean = False);
4175  var  var
4176      idx : Integer;      idx : Integer;
4177  begin  begin
4178      //URLに移動      //URLに移動
4179      GikoForm.MoveToURL(URL);      GikoForm.MoveToURL(URL, KeyMask);
4180      //以下、履歴の処理      //以下、履歴の処理
4181      idx := GikoForm.AddressComboBox.Items.IndexOf(URL);      idx := GikoForm.AddressComboBox.Items.IndexOf(URL);
4182      if idx = -1 then begin      if idx = -1 then begin
# Line 4167  procedure TGikoDM.ClickActiveElementActi Line 4210  procedure TGikoDM.ClickActiveElementActi
4210  var  var
4211      browser : TWebBrowser;      browser : TWebBrowser;
4212      elem : IHTMLElement;      elem : IHTMLElement;
4213        doc : IHTMLDocument2;
4214  begin  begin
4215      if (GikoForm.GetActiveContent <> nil) then begin      if (GikoForm.GetActiveContent <> nil) then begin
4216          if (GikoForm.BrowserTab.Tabs.Count > 0) and          if (GikoForm.BrowserTab.Tabs.Count > 0) and
# Line 4175  begin Line 4219  begin
4219                  .Objects[GikoForm.BrowserTab.TabIndex]).Browser;                  .Objects[GikoForm.BrowserTab.TabIndex]).Browser;
4220              if (browser <> nil) then begin              if (browser <> nil) then begin
4221                  try                  try
4222                      elem := IHTMLDocument2(browser.Document).activeElement;                      doc := browser.ControlInterface.Document as IHTMLDocument2;
4223                      elem.click;                      if Assigned(doc) then begin
4224                            elem := doc.activeElement;
4225                            if Assigned(elem) then begin
4226                                elem.click;
4227                            end;
4228                        end;
4229                  except                  except
4230                  end;                  end;
4231              end;              end;
# Line 4337  end; Line 4386  end;
4386  function TGikoDM.GetActiveThreadLinks : IHTMLElementCollection;  function TGikoDM.GetActiveThreadLinks : IHTMLElementCollection;
4387  var  var
4388      browser : TWebBrowser;      browser : TWebBrowser;
4389        doc : IHTMLDocument2;
4390  begin  begin
4391      Result := nil;      Result := nil;
4392      if (GikoForm.GetActiveContent <> nil) then begin      if (GikoForm.GetActiveContent <> nil) then begin
# Line 4346  begin Line 4396  begin
4396                  .Objects[GikoForm.BrowserTab.TabIndex]).Browser;                  .Objects[GikoForm.BrowserTab.TabIndex]).Browser;
4397              if (browser <> nil) then begin              if (browser <> nil) then begin
4398                  try                  try
4399                      Result := IHTMLDocument2(browser.Document).links;                      doc := browser.ControlInterface.Document as IHTMLDocument2;
4400                        if Assigned(doc) then begin
4401                            Result := doc.links;
4402                        end;
4403                  except                  except
4404                      Result := nil;                      Result := nil;
4405                  end;                  end;
# Line 4378  begin Line 4431  begin
4431                  // レスの番号を更新                  // レスの番号を更新
4432                  if (Pos('menu:', url) > 0) then begin                  if (Pos('menu:', url) > 0) then begin
4433                      index := StrToInt64Def(                      index := StrToInt64Def(
4434                          Copy(url, 5, Length(url)), index + 1                          Copy(url, 6, Length(url)), index + 1
4435                      );                      );
4436                  end else begin                  end else begin
4437                      // 開始レス番号以降かチェック                      // 開始レス番号以降かチェック
# Line 4436  begin Line 4489  begin
4489  end;  end;
4490    
4491    
4492    //! このレスのIDをNGワードに追加する(透明)
4493    procedure TGikoDM.AddIDtoNGWord0ActionExecute(Sender: TObject);
4494    begin
4495        GikoForm.AddIDtoNGWord(true);
4496    end;
4497    //! このレスのIDをNGワードに追加する
4498    procedure TGikoDM.AddIDtoNGWord1ActionExecute(Sender: TObject);
4499    begin
4500        GikoForm.AddIDtoNGWord(false);
4501    end;
4502    //! クリップボードの文字列をIDとして同一IDレスアンカー表示
4503    procedure TGikoDM.ExtractSameIDActionExecute(Sender: TObject);
4504    var
4505        ID: String;
4506    begin
4507        ID := Trim(Clipboard.AsText);
4508        if (Length(ID) > 0) then begin
4509            if not IsNoValidID(ID) then begin
4510                GikoForm.ShowSameIDAncher(ID);
4511            end;
4512        end;
4513    end;
4514    //! タブのスレッド一覧を表示する
4515    procedure TGikoDM.ShowTabListActionExecute(Sender: TObject);
4516    var
4517        i : Integer;
4518    begin
4519        GikoForm.ListView.Items.BeginUpdate;
4520        GikoForm.ListView.Items.Clear;
4521        BoardGroup.SpecialBoard.Clear;
4522            for i := GikoForm.BrowserTab.Tabs.Count - 1 downto 0 do begin
4523            BoardGroup.SpecialBoard.Add(
4524                    TBrowserRecord(GikoForm.BrowserTab.Tabs.Objects[i]).Thread);
4525            end;
4526        GikoForm.ListView.Items.EndUpdate;
4527        GikoForm.SetActiveList(BoardGroup.SpecialBoard);
4528    end;
4529    //! 逆参照しているレスを追加する
4530    procedure TGikoDM.DereferenceResActionExecute(Sender: TObject);
4531    var
4532            i, currentNo, No : Integer;
4533        links : IHTMLElementCollection;
4534        threadItem : TThreadItem;
4535        item : IHTMLElement;
4536        url, url2 : string;
4537        resNo : TStringList;
4538        alreadyExist : Boolean;
4539            PathRec: TPathRec;
4540    begin
4541            No := GikoForm.KokoPopupMenu.Tag;
4542            if No = 0 then Exit;
4543    
4544        ThreadItem := GikoForm.KokoPopupThreadItem;
4545        // アクティブタブから全てのリンクを取得する
4546        links := GetActiveThreadLinks;
4547        if (ThreadItem <> nil) and (links <> nil) then begin
4548            resNo := TStringList.Create;
4549            try
4550                currentNo := 0;
4551                alreadyExist := False;
4552                // リンクを全て走査する
4553                for i := 0 to links.length - 1 do begin
4554                    item := links.item(i, 0) as IHTMLElement;
4555                    if (item <> nil) then begin
4556                        url := item.getAttribute('href', 0);
4557                        // レスの番号を更新
4558                        if (Pos('menu:', url) > 0) then begin
4559                            currentNo := StrToInt64Def(
4560                                Copy(url, 6, Length(url)), currentNo + 1
4561                            );
4562                            alreadyExist := False;
4563                        end else if (currentNo <> -1) and (not alreadyExist) then begin
4564                            // IE7対応
4565                            if Pos('about:..', url) = 1 then begin
4566                                url := 'about:blank..' + Copy( url, Length('about:..')+1, Length(url) )
4567                            end;
4568                            // 自分へのリンクからレスポップ用の番号取得
4569                            if Pos('about:blank..', url) = 1 then begin
4570                                // No 番へのリンクがあれば参照あり
4571                                url2 := THTMLCreate.GetRespopupURL(url, ThreadItem.URL);
4572                                            PathRec := Gikosys.Parse2chURL2(url2);
4573                                if (not PathRec.FNoParam) then begin
4574                                    Gikosys.GetPopupResNumber(url2,PathRec.FSt,PathRec.FTo);
4575                                            end;
4576                                // 対象レスもしくはそれを含むなら参照ありとする
4577                                if (PathRec.FSt = No) or
4578                                    ((PathRec.FSt <= No) and (PathRec.FTo >= No))  then begin
4579                                    alreadyExist := True;
4580                                    resNo.Add(IntToStr(currentNo));
4581                                end;
4582                            end;
4583                        end;
4584                    end;
4585                end;
4586                // 無制限なので-1固定
4587                GikoForm.ActiveContent.IDAnchorPopup(
4588                    GikoSys.CreateResAnchor(resNo, ThreadItem, -1));
4589            finally
4590                resNo.Clear;
4591                resNo.Free;
4592            end;
4593        end;
4594    end;
4595    
4596    procedure TGikoDM.UpdateGikonaviActionExecute(Sender: TObject);
4597    var
4598        form : TUpdateCheckForm;
4599            Msg: string;
4600        shutdown: boolean;
4601    begin
4602            if (EditorFormExists) then begin
4603                    Msg := 'レスエディタを全て閉じてください';
4604                    MsgBox(GikoForm.Handle, Msg, MSG_ERROR, MB_OK or MB_ICONSTOP);
4605                    Exit;
4606            end;
4607        GikoForm.UpdateExePath := '';
4608        GikoForm.UpdateExeArgs := '';
4609        form := TUpdateCheckForm.Create(GikoForm);
4610        try
4611            form.ShowModal;
4612            shutdown := form.Allowshutdown;
4613            if shutdown then begin
4614                GikoForm.UpdateExePath := form.ExecPath;
4615                GikoForm.UpdateExeArgs := form.ExecArgs;
4616            end;
4617        finally
4618            form.Release;
4619        end;
4620        if shutdown then begin
4621            // ギコナビ終了
4622            GikoForm.Close;
4623        end;
4624    
4625    end;
4626    //! このレスのURLコピー(PATH_INFO)
4627    procedure TGikoDM.konoURLPATHActionExecute(Sender: TObject);
4628    var
4629        No : Integer;
4630        ThreadItem : TThreadItem;
4631        URL, Protocol, Host, Path, Document, Port, Bookmark : String;
4632    begin
4633            No := GikoForm.KokoPopupMenu.Tag;
4634            if No = 0 then Exit;
4635    
4636        ThreadItem := GikoForm.KokoPopupThreadItem;
4637        if (ThreadItem.ParentBoard.Is2ch) or not (Pos('?', ThreadItem.URL) > 0) then begin
4638            GikoSys.ParseURI(ThreadItem.URL,Protocol, Host, Path, Document, Port, Bookmark);
4639            URL := Protocol + '://' + Host + Path + IntToStr(No);
4640        end else begin
4641            if Pos('?', ThreadItem.URL) > 0 then begin
4642                URL := Copy(ThreadItem.URL, 1, Pos('?', ThreadItem.URL)-1);
4643                // まちBBS用処置
4644                URL := MojuUtils.CustomStringReplace(URL, 'read.pl', 'read.cgi');
4645                URL := URL + '/' + ThreadItem.ParentBoard.BBSID + '/' + ChangeFileExt(ThreadItem.FileName, '')  + '/' + IntToStr(No);
4646            end;
4647        end;
4648        Clipboard.SetTextBuf( PChar(URL) );
4649    end;
4650    //! このレスのURLコピー(Query_STRING)
4651    procedure TGikoDM.konoURLQueryActionExecute(Sender: TObject);
4652    var
4653        No : Integer;
4654        ThreadItem : TThreadItem;
4655        URL, Protocol, Host, Path, Document, Port, Bookmark : String;
4656    begin
4657            No := GikoForm.KokoPopupMenu.Tag;
4658            if No = 0 then Exit;
4659    
4660        ThreadItem := GikoForm.KokoPopupThreadItem;
4661        // 2chとしたらばは、レス番号をうまく処理してくれないので利用不可
4662        if ThreadItem.ParentBoard.Is2ch or not (Pos('?', ThreadItem.URL) > 0) then begin
4663            GikoSys.ParseURI(ThreadItem.URL, Protocol, Host, Path, Document, Port, Bookmark);
4664            URL := Protocol + '://' + Host + '/test/read.cgi?bbs=' + ThreadItem.ParentBoard.BBSID
4665                + '&key=' + ChangeFileExt(ThreadItem.FileName, '') + '&st=' + IntToStr(No) + '&to=' + IntToStr(No);
4666        end else begin
4667            URL := ThreadItem.URL;
4668            // まちBBS
4669            if Pos('&LAST=', URL) > 0 then begin
4670                URL := Copy(URL, 1, Pos('&LAST=', URL) - 1);
4671                URL := URL + '&START=' + IntToStr(No) + '&END=' + IntToStr(No);
4672            end;
4673            // その他外部板
4674            if Pos('&ls=', URL) > 0 then begin
4675                URL := Copy(URL, 1, Pos('&ls=', URL) - 1);
4676                URL := URL + '&st=' + IntToStr(No) + '&to=' + IntToStr(No);
4677            end;
4678    
4679        end;
4680        Clipboard.SetTextBuf( PChar(URL) );
4681    end;
4682    //! このレスのURLコピー(Query_STRING)の利用チェック
4683    procedure TGikoDM.konoURLQueryActionUpdate(Sender: TObject);
4684    const
4685            LIVEDOOR_URL = 'http://jbbs.livedoor.jp/';
4686    begin
4687        // 2chとしたらばは利用できないようにする(うまくレス指定できないので)
4688        konoURLQueryAction.Enabled := false;
4689        if (GikoForm.KokoPopupThreadItem <> nil) then begin
4690            konoURLQueryAction.Enabled := not GikoForm.KokoPopupThreadItem.ParentBoard.Is2ch;
4691            if konoURLQueryAction.Enabled then begin
4692                konoURLQueryAction.Enabled := not (Pos(LIVEDOOR_URL, GikoForm.KokoPopupThreadItem.URL) = 1);
4693            end;
4694        end;
4695    end;
4696    //! ポップアップメニュー設定ダイアログを開く
4697    procedure TGikoDM.PopupMenuSettingActionExecute(Sender: TObject);
4698    var
4699            Dlg: TPopupMenuSettingDialog;
4700    begin
4701            Dlg := TPopupMenuSettingDialog.Create(GikoForm, GikoFormActionList);
4702            try
4703                    Dlg.ShowModal;
4704            finally
4705                    Dlg.Release;
4706            end;
4707    end;
4708    
4709  end.  end.
4710    

Legend:
Removed from v.1.59.2.1  
changed lines
  Added in v.1.80

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26