OSDN Git Service

1.60.2.794
[gikonavigoeson/gikonavi.git] / GikoDataModule.pas
index 5bf4dae..30456e9 100644 (file)
@@ -12,7 +12,7 @@ uses
        MSHTML_TLB,
 {$IFEND}
   ComCtrls, BrowserRecord, Graphics, Messages, Setting, Dialogs,
-  ActiveX, MoveHistoryItem, HistoryList;
+  ActiveX, GikoSystem, MoveHistoryItem, HistoryList;
 
 const
        CAPTION_NAME: string = '\83M\83R\83i\83r';
@@ -42,13 +42,14 @@ const
        //! 2\82¿\82á\82ñ\82Ë\82é\82ÌURL
        URL_2ch: string = 'www.2ch.net/';
        //! \83M\83R\83i\83rWiki\82ÌURL
-       URL_Wiki: string = 'gikowiki.dyndns.info/index.php?FAQ';
+       URL_Wiki: string = 'sourceforge.jp/projects/gikonavi/wiki/FAQ';
 
        SELECTCOMBOBOX_NAME: string = ''; // '\83X\83\8c\83b\83h\8di\8d\9e\8c\9f\8dõ';
        SELECTCOMBOBOX_COLOR: TColor = clWindow;
 
 
 type
+
   TGikoDM = class(TDataModule)
        GikoFormActionList: TActionList;
        OnlyAHundredResAction: TAction;
@@ -232,6 +233,18 @@ type
     SetForcusForAddresBarAction: TAction;
     NewBoardSearchAction: TAction;
     NGWordEditFormAction: TAction;
+    ScrollPageDownAction: TAction;
+    ScrollPageUpAction: TAction;
+    AllLinkToClipboardAction: TAction;
+    NewLinkToClipboardAction: TAction;
+    AddIDtoNGWord0Action: TAction;
+    AddIDtoNGWord1Action: TAction;
+    ExtractSameIDAction: TAction;
+    ShowTabListAction: TAction;
+    DereferenceResAction: TAction;
+    UpdateGikonaviAction: TAction;
+    konoURLPATHAction: TAction;
+    konoURLQueryAction: TAction;
        procedure EditNGActionExecute(Sender: TObject);
        procedure ReloadActionExecute(Sender: TObject);
        procedure GoFowardActionExecute(Sender: TObject);
@@ -435,7 +448,19 @@ type
     procedure AllImageLinkToClipbordActionExecute(Sender: TObject);
     procedure SetForcusForAddresBarActionExecute(Sender: TObject);
     procedure NewBoardSearchActionExecute(Sender: TObject);
-    procedure NGWordEditFormActionExecute(Sender: TObject);
+    procedure ScrollPageDownActionExecute(Sender: TObject);
+    procedure ScrollPageUpActionExecute(Sender: TObject);
+    procedure AllLinkToClipboardActionExecute(Sender: TObject);
+    procedure NewLinkToClipboardActionExecute(Sender: TObject);
+    procedure AddIDtoNGWord0ActionExecute(Sender: TObject);
+    procedure AddIDtoNGWord1ActionExecute(Sender: TObject);
+    procedure ExtractSameIDActionExecute(Sender: TObject);
+    procedure ShowTabListActionExecute(Sender: TObject);
+    procedure DereferenceResActionExecute(Sender: TObject);
+    procedure UpdateGikonaviActionExecute(Sender: TObject);
+    procedure konoURLPATHActionExecute(Sender: TObject);
+    procedure konoURLQueryActionExecute(Sender: TObject);
+    procedure konoURLQueryActionUpdate(Sender: TObject);
   private
        { Private \90é\8c¾ }
        procedure ClearResFilter;
@@ -451,11 +476,11 @@ type
        procedure ClearSelectComboBox;
     procedure ClearMailAllEditor();
     procedure ClearNameTextAllEditor();
-    procedure MoveURLWithHistory(URL : String);
+    procedure MoveURLWithHistory(URL : String; KeyMask: Boolean = False);
     procedure BackToHistory(item: TMoveHistoryItem);
     function GetActiveThreadLinks : IHTMLElementCollection;
-    procedure GetImageLinkURLs(links : IHTMLElementCollection;
-        URLs : TStringList; const Start: Integer);
+    procedure GetLinkURLs(links : IHTMLElementCollection;
+        URLs : TStringList; const Start: Integer; Exts : TStringList);
   public
        { Public \90é\8c¾ }
        procedure RepaintStatusBar;
@@ -468,8 +493,10 @@ type
        procedure DependActiveCntentActionUpdate(Sender: TObject);
        //! TAction\82ÅGetActiveContent\82ªnil\88È\8aO\82©\82Â\83\8d\83O\82ð\8e\9d\82Á\82Ä\82¢\82é\82Æ\97L\8cø\82É\82È\82é
        procedure DependActiveCntentLogActionUpdate(Sender: TObject);
-       //! TAction\82ÅActiveList\82ªTBoard\82Å\97L\8cø\82É\82È\82é
+       //! TAction\82ÅActiveList\82ªTBoard(\94ñ\93Á\8eê\94Â)\82Å\97L\8cø\82É\82È\82é
        procedure DependActiveListTBoardActionUpdate(Sender: TObject);
+       //! TAction\82ÅActiveList\82ªTBoard\82Å\97L\8cø\82É\82È\82é
+       procedure DependActiveListTBoardWithSpeciapActionUpdate(Sender: TObject);
   end;
 
 var
@@ -480,7 +507,7 @@ implementation
 
 uses
        Windows, Math, Clipbrd,
-       Giko, GikoSystem, GikoUtil, BoardGroup,
+       Giko, GikoUtil, BoardGroup,
        FavoriteArrange, Favorite, MojuUtils,
        Editor, ListSelect, Search, Option, Round,
        KeySetting, Gesture, Kotehan, ToolBarSetting,
@@ -488,7 +515,7 @@ uses
        GikoBayesian, About, ShellAPI,
        RoundName, RoundData, Menus, ListViewUtils,
        ThreadControl, GikoMessage, InputAssist,
-    DefaultFileManager, Forms, NewBoardURL, NGWordEdit;
+    DefaultFileManager, Forms, NewBoardURL, UpdateCheck;
 
 const
        MSG_ERROR : string = '\83G\83\89\81[';
@@ -510,10 +537,18 @@ begin
                                                                        and (GikoForm.GetActiveContent.IsLogFile);
 end;
 // *************************************************************************
-//! TAction\82ÅActiveList\82ªTBoard\82Å\97L\8cø\82É\82È\82é
+//! TAction\82ÅActiveList\82ªTBoard(\94ñ\93Á\8eê\94Â)\82Å\97L\8cø\82É\82È\82é
 // *************************************************************************
 procedure TGikoDM.DependActiveListTBoardActionUpdate(Sender: TObject);
 begin
+       TAction(Sender).Enabled := (GikoForm.GetActiveList is TBoard) and
+        (GikoForm.GetActiveList <> BoardGroup.SpecialBoard);
+end;
+// *************************************************************************
+//! TAction\82ÅActiveList\82ªTBoard\82Å\97L\8cø\82É\82È\82é
+// *************************************************************************
+procedure TGikoDM.DependActiveListTBoardWithSpeciapActionUpdate(Sender: TObject);
+begin
        TAction(Sender).Enabled := (GikoForm.GetActiveList is TBoard);
 end;
 // *************************************************************************
@@ -896,8 +931,8 @@ begin
 
        GikoForm.ResRangeMenuSelect     := 100;
        OnlyAHundredResAction.Checked   := True;
-       //\81@\95\\8e¦\94Í\88Í\82ð\90Ý\92è\82·\82é
-       SetResRange(100);
+       //\81@\95\\8e¦\94Í\88Í\82ð\90Ý\92è\82·\82é\81B\90Ý\92è\92l\82©\82ç\82Æ\82Á\82Ä\82­\82é\81B
+    SetResRange(GikoSys.Setting.ResRangeExCount);
 end;
 // *************************************************************************
 //! \96¢\93Ç\83\8c\83X\82Ì\82Ý\95\\8e¦
@@ -2032,9 +2067,8 @@ begin
                        GikoForm.DeleteHistory(ThreadItem);
                        GikoForm.DeleteTab(ThreadItem);
                        ThreadItem.DeleteLogFile;
-
-                       GikoForm.TreeView.Refresh;      // UnRead \82Ì\95\\8e¦\82ð\8dX\90V
                end;
+        GikoForm.TreeView.Refresh;     // UnRead \82Ì\95\\8e¦\82ð\8dX\90V
                GikoForm.ListView.Refresh;
        finally
                List.Free;
@@ -2247,15 +2281,17 @@ begin
         try
             bound    := AStringList.Count - 1;
             if bound > -1 then begin
-                GikoSys.Setting.BrowserTabAppend := gtpLast;
+                GikoSys.Setting.BrowserTabAppend := gtaLast;
                 for i := 0 to bound do begin
                     item := BBSsFindThreadFromURL( AStringList[ i ] );
                     if item <> nil then
                         GikoForm.InsertBrowserTab( item, false );
                 end;
-                //\8dÅ\8f\89\82Ì\82P\96\87\82É\90Ý\92è \83A\83h\83\8c\83X\82Ì\90Ý\92è\82Ì\82½\82ß\82Ì\83J\83\89\8cÄ\82Ñ
-                if GikoForm.BrowserTab.Tabs.Count > 0 then begin
-                    GikoForm.BrowserTab.OnChange(nil);
+                //\8dÅ\8f\89\82Ì\82P\96\87\82É\90Ý\92è
+                if (GikoSys.Setting.URLDisplay) and
+                    (GikoForm.BrowserTab.Tabs.Count > 0) then begin
+                                       GikoForm.AddressComboBox.Text :=
+                        TBrowserRecord(GikoForm.BrowserTab.Tabs.Objects[0]).Thread.URL;
                 end;
             end;
         finally
@@ -2275,7 +2311,7 @@ var
 begin
     URLs := TStringList.Create();
        try
-               fileName := ExtractFilePath(Application.ExeName) + TABFILE;
+               fileName := GikoSys.GetAppDir + TABFILE;
                if FileExists(fileName) then begin
                    try
                                URLs.LoadFromFile(fileName);
@@ -2327,12 +2363,13 @@ var
        ThreadItem: TThreadItem;
 begin
        No := GikoForm.KokoPopupMenu.Tag;
-       if No = 0 then Exit;
-       ThreadItem := GikoForm.GetActiveContent;
-       if ThreadItem = nil then Exit;
+       if No = 0
+        then Exit;
+       ThreadItem := GikoForm.KokoPopupThreadItem;
+       if not Assigned(ThreadItem) then
+        Exit;
        ThreadItem.Kokomade := No;
-       GikoForm.ActiveContent.Thread.ScrollTop :=
-               OleVariant(IHTMLDocument2(GikoForm.ActiveContent.Browser.Document)).Body.ScrollTop;
+       GikoForm.ActiveContent.Thread.ScrollTop := GikoForm.ActiveContent.Browser.OleObject.Document.Body.ScrollTop;
        GikoForm.ActiveContent.Repaint := true;
        GikoForm.InsertBrowserTab(GikoForm.ActiveContent.Thread, true);
        //INFO 2005/11/19 \88ê\92U\89B\95Á\81A\95K\97v\82È\82çGikoForm\82Ì\95û\82É\83\81\83\\83b\83h\82ð\92Ç\89Á\82·\82é
@@ -2345,11 +2382,10 @@ procedure TGikoDM.ZenbuActionExecute(Sender: TObject);
 var
        ThreadItem: TThreadItem;
 begin
-       ThreadItem := GikoForm.GetActiveContent;
+       ThreadItem := GikoForm.GetActiveContent(True);
        if ThreadItem = nil then Exit;
        ThreadItem.Kokomade := -1;
-       GikoForm.ActiveContent.Thread.ScrollTop :=
-               OleVariant(IHTMLDocument2(GikoForm.ActiveContent.Browser.Document)).Body.ScrollTop;
+       GikoForm.ActiveContent.Thread.ScrollTop := GikoForm.ActiveContent.Browser.OleObject.Document.Body.ScrollTop;
        GikoForm.ActiveContent.Repaint := true;
        GikoForm.InsertBrowserTab(GikoForm.ActiveContent.Thread, true);
        //INFO 2005/11/19 \88ê\92U\89B\95Á\81A\95K\97v\82È\82çGikoForm\82Ì\95û\82É\83\81\83\\83b\83h\82ð\92Ç\89Á\82·\82é
@@ -2366,7 +2402,7 @@ var
 begin
        Number := GikoForm.KokoPopupMenu.Tag;
        if Number = 0 then Exit;
-       Item := GikoForm.GetActiveContent;
+       Item := GikoForm.KokoPopupThreadItem;
        if Item = nil then Exit;
 
        Editor := TEditorForm.Create(GikoForm);
@@ -2386,27 +2422,22 @@ end;
 //! \91I\91ð\82µ\82½\83\8c\83X\82ð\83R\83s\81[\82·\82é
 // *************************************************************************
 procedure TGikoDM.SameIDResAnchorActionExecute(Sender: TObject);
+const
+    LIMIT = 20;
 var
        ThreadItem : TThreadItem;
-       No, count, rc : Integer;
-       body : string;
-       limited: boolean;
+       No : Integer;
+       AID: string;
 begin
        No := GikoForm.KokoPopupMenu.Tag;
        if No = 0 then Exit;
-       ThreadItem := GikoForm.GetActiveContent;
+       ThreadItem := GikoForm.KokoPopupThreadItem;
        if ThreadItem = nil then Exit;
-       count := GikoSys.GetSameIDResCount(No, GikoForm.ActiveContent.Thread);
-       limited := false;
-       if count > 20 then begin
-               rc := GikoUtil.MsgBox(GikoForm.Handle,
-                               '20\8cÂ\88È\8fã\82 \82è\82Ü\82·\82ª\81A\82·\82×\82Ä\95\\8e¦\82µ\82Ü\82·\82©\81H',
-                               'ID\83|\83b\83v\83A\83b\83v\8cx\8d\90',
-                               MB_YESNO or MB_ICONQUESTION);
-               limited := rc <> ID_YES;
-       end;
-       body := GikoSys.GetSameIDResAnchor(No, ThreadItem, limited);
-       GikoForm.ActiveContent.IDAnchorPopup(body);
+
+    AID := GikoSys.GetResID(No, ThreadItem);
+    if not IsNoValidID(AID) then begin
+        GikoForm.ShowSameIDAncher(AID);
+    end;
 end;
 // *************************************************************************
 //! \82±\82Ì\83\8c\83X\82 \82Ú\81`\82ñ\81@\81i\92Ê\8fí\81j
@@ -2435,9 +2466,8 @@ var
 begin
        IndividualForm := TIndividualAbonForm.Create(GikoForm);
        try
-               ThreadItem := GikoForm.GetActiveContent;
-               ThreadItem.ScrollTop :=
-                       OleVariant(IHTMLDocument2(GikoForm.ActiveContent.Browser.Document)).Body.ScrollTop;
+               ThreadItem := GikoForm.GetActiveContent(True);
+               ThreadItem.ScrollTop := GikoForm.ActiveContent.Browser.OleObject.Document.Body.ScrollTop;
                if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
                        if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
                                ReadList                := TStringList.Create;
@@ -2483,9 +2513,8 @@ var
 begin
        IndividualForm := TIndividualAbonForm.Create(GikoForm);
        try
-               ThreadItem := GikoForm.GetActiveContent;
-               ThreadItem.ScrollTop :=
-                       OleVariant(IHTMLDocument2(GikoForm.ActiveContent.Browser.Document)).Body.ScrollTop;
+               ThreadItem := GikoForm.GetActiveContent(True);
+               ThreadItem.ScrollTop := GikoForm.ActiveContent.Browser.OleObject.Document.Body.ScrollTop;
                if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
                        if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
                                if (IndividualForm.ShowModal = mrOK) then begin
@@ -2629,7 +2658,8 @@ end;
 // *************************************************************************
 procedure TGikoDM.UpFolderActionUpdate(Sender: TObject);
 begin
-       UpFolderAction.Enabled := not (GikoForm.GetActiveList is TBBS);
+       UpFolderAction.Enabled := not (GikoForm.GetActiveList is TBBS) and
+        (GikoForm.GetActiveList <> BoardGroup.SpecialBoard);
 end;
 // *************************************************************************
 //! \95\\8e¦\81@\95\\8e¦\83\8a\83X\83g\82Ì\83\82\81[\83h\95Ï\8dX
@@ -2902,7 +2932,9 @@ begin
        try
                GikoForm.SelectListItem(List);
                for i := 0 to List.Count - 1 do begin
-                       if TObject(List[i]) is TBoard then
+            if TObject(List[i]) is TCategory then
+                s := s + TCategory(List[i]).Title + #13#10
+                       else if TObject(List[i]) is TBoard then
                                s := s + TBoard(List[i]).Title + #13#10
                        else if TObject(List[i]) is TThreadItem then
                                s := s + TThreadItem(List[i]).Title + #13#10;
@@ -2918,7 +2950,8 @@ end;
 // *************************************************************************
 procedure TGikoDM.SelectItemNameCopyActionUpdate(Sender: TObject);
 begin
-       if ((GikoForm.GetActiveList is TBoard) or
+       if ((GikoForm.GetActiveList is TBBS) or
+        (GikoForm.GetActiveList is TBoard) or
                (GikoForm.GetActiveList is TCategory))and (GikoForm.ListView.SelCount > 0) then
                TAction(Sender).Enabled := True
        else
@@ -2989,9 +3022,10 @@ procedure TGikoDM.SelectListReloadActionUpdate(Sender: TObject);
 begin
        if (GikoForm.GetActiveList is TCategory) and (GikoForm.ListView.SelCount > 0) then
                TAction(Sender).Enabled := True
-       else if GikoForm.GetActiveList is TBoard then
-               TAction(Sender).Enabled := True
-       else
+       else if GikoForm.GetActiveList is TBoard then begin
+               TAction(Sender).Enabled :=
+            (GikoForm.GetActiveList <> BoardGroup.SpecialBoard);
+       end else
                TAction(Sender).Enabled := False;
 end;
 // *************************************************************************
@@ -3189,8 +3223,10 @@ end;
 // *************************************************************************
 procedure TGikoDM.LogFolderOpenActionUpdate(Sender: TObject);
 begin
-       if ((GikoForm.GetActiveList is TBoard) or (GikoForm.GetActiveList is TCategory))
-               and (GikoForm.ListView.SelCount > 0) then
+       if (((GikoForm.GetActiveList is TBoard) and
+        (GikoForm.GetActiveList <> BoardGroup.SpecialBoard))
+        or (GikoForm.GetActiveList is TCategory))
+               and (GikoForm.ListView.SelCount > 0) then
                TAction(Sender).Enabled := True
        else
                TAction(Sender).Enabled := False;
@@ -4092,7 +4128,7 @@ end;
 procedure TGikoDM.BackToHistory(item: TMoveHistoryItem);
 var
     browser : TWebBrowser;
-    doc : OleVariant;
+    doc : IHTMLDocument2;
 begin
     if ( item <> nil ) then begin
         if ( GikoForm.GetActiveContent = item.ThreadItem ) then begin
@@ -4100,24 +4136,24 @@ begin
                 .Objects[GikoForm.BrowserTab.TabIndex]).Browser;
             if (browser <> nil) then begin
                 try
-                    doc := Idispatch( olevariant(browser.ControlInterface).Document) as IHTMLDocument2;
-                    doc.Body.ScrollTop := item.ScrollTop;
+                    doc := browser.ControlInterface.Document as IHTMLDocument2;
+                    (doc.body as IHTMLElement2).ScrollTop := item.ScrollTop;
                 except
                 end;
             end;
         end else begin
             //URL\82É\88Ú\93®
-            MoveURLWithHistory(item.ThreadItem.URL);
+            MoveURLWithHistory(item.ThreadItem.URL, True);
         end;
     end;
 end;
 //! \97\9a\97ð\8f\88\97\9d\82Â\82«URL\88Ú\93®
-procedure TGikoDM.MoveURLWithHistory(URL : String);
+procedure TGikoDM.MoveURLWithHistory(URL : String; KeyMask: Boolean = False);
 var
     idx : Integer;
 begin
     //URL\82É\88Ú\93®
-    GikoForm.MoveToURL(URL);
+    GikoForm.MoveToURL(URL, KeyMask);
     //\88È\89º\81A\97\9a\97ð\82Ì\8f\88\97\9d
     idx := GikoForm.AddressComboBox.Items.IndexOf(URL);
     if idx = -1 then begin
@@ -4151,6 +4187,7 @@ procedure TGikoDM.ClickActiveElementActionExecute(Sender: TObject);
 var
     browser : TWebBrowser;
     elem : IHTMLElement;
+    doc : IHTMLDocument2;
 begin
     if (GikoForm.GetActiveContent <> nil) then begin
         if (GikoForm.BrowserTab.Tabs.Count > 0) and
@@ -4159,8 +4196,13 @@ begin
                 .Objects[GikoForm.BrowserTab.TabIndex]).Browser;
             if (browser <> nil) then begin
                 try
-                    elem := IHTMLDocument2(browser.Document).activeElement;
-                    elem.click;
+                    doc := browser.ControlInterface.Document as IHTMLDocument2;
+                    if Assigned(doc) then begin
+                        elem := doc.activeElement;
+                        if Assigned(elem) then begin
+                            elem.click;
+                        end;
+                    end;
                 except
                 end;
             end;
@@ -4206,15 +4248,21 @@ end;
 procedure TGikoDM.AllImageLinkToClipbordActionExecute(Sender: TObject);
 var
     links : IHTMLElementCollection;
-    urls : TStringList;
+    urls, exts : TStringList;
 begin
     links := GetActiveThreadLinks;
     if (links <> nil) then begin
         urls := TStringList.Create;
+        exts := TStringList.Create;
         try
-            GetImageLinkURLs(links, urls, 0);
+            exts.CaseSensitive := False;
+            exts.Sorted := True;
+            exts.Delimiter := ';';
+            exts.DelimitedText := '.gif;.jpg;.jpeg;.png';
+            GetLinkURLs(links, urls, 0, exts);
             Clipboard.SetTextBuf(urls.GetText);
         finally
+            exts.Free;
             urls.Free;
         end;
     end;
@@ -4227,29 +4275,95 @@ end;
 procedure TGikoDM.NewImageLinkToClipBoardActionExecute(Sender: TObject);
 var
     links : IHTMLElementCollection;
-    urls : TStringList;
+    urls, exts : TStringList;
     ThreadItem : TThreadItem;
 begin
     ThreadItem := GikoForm.GetActiveContent;
     links := GetActiveThreadLinks;
     if (ThreadItem <> nil) and (links <> nil) then begin
         urls := TStringList.Create;
+        exts := TStringList.Create;
         try
-            GetImageLinkURLs(links, urls,
-                (ThreadItem.Count - ThreadItem.NewResCount + 1) );
+            exts.CaseSensitive := False;
+            exts.Sorted := True;
+            exts.Delimiter := ';';
+            exts.DelimitedText := '.gif;.jpg;.jpeg;.png';
+
+            GetLinkURLs(links, urls,
+                (ThreadItem.Count - ThreadItem.NewResCount + 1), exts );
             Clipboard.SetTextBuf(urls.GetText);
         finally
+            exts.Free;
             urls.Free;
         end;
     end;
 end;
 {
+\breif  \83\8a\83\93\83NURL\8eæ\93¾
+\91Î\8fÛ\8ag\92£\8eq\82Í\81A\8fÚ\8d×\90Ý\92è\82Å\90Ý\92è\82³\82ê\82Ä\82¢\82é
+}
+procedure TGikoDM.AllLinkToClipboardActionExecute(Sender: TObject);
+var
+    links : IHTMLElementCollection;
+    urls, exts : TStringList;
+begin
+    links := GetActiveThreadLinks;
+    if (links <> nil) then begin
+        urls := TStringList.Create;
+        exts := TStringList.Create;
+        try
+            exts.CaseSensitive := False;
+            exts.Sorted := True;
+            exts.Delimiter := ';';
+            exts.DelimitedText :=
+                MojuUtils.CustomStringReplace(GikoSys.Setting.ExtList, '*', '');
+            GetLinkURLs(links, urls, 0, exts);
+            Clipboard.SetTextBuf(urls.GetText);
+        finally
+            exts.Free;
+            urls.Free;
+        end;
+    end;
+end;
+{
+\breif  \90V\92\85\83\8c\83X\83\8a\83\93\83NURL\8eæ\93¾
+\91Î\8fÛ\8ag\92£\8eq\82Í\81A\8fÚ\8d×\90Ý\92è\82Å\90Ý\92è\82³\82ê\82Ä\82¢\82é
+}
+procedure TGikoDM.NewLinkToClipboardActionExecute(Sender: TObject);
+var
+    links : IHTMLElementCollection;
+    urls, exts : TStringList;
+    ThreadItem : TThreadItem;
+begin
+    ThreadItem := GikoForm.GetActiveContent;
+    links := GetActiveThreadLinks;
+    if (ThreadItem <> nil) and (links <> nil) then begin
+        urls := TStringList.Create;
+        exts := TStringList.Create;
+        try
+            exts.CaseSensitive := False;
+            exts.Sorted := True;
+            exts.Delimiter := ';';
+            exts.DelimitedText :=
+                MojuUtils.CustomStringReplace(GikoSys.Setting.ExtList, '*', '');
+            GetLinkURLs(links, urls,
+                (ThreadItem.Count - ThreadItem.NewResCount + 1), exts );
+            Clipboard.SetTextBuf(urls.GetText);
+        finally
+            exts.Free;
+            urls.Free;
+        end;
+    end;
+end;
+
+{
 \brief  \8c»\8dÝ\95\\8e¦\82µ\82Ä\82¢\82é\83X\83\8c\83b\83h\82Ì\82·\82×\82Ä\82Ì\83\8a\83\93\83N\82ð\8eæ\93¾\82·\82é\81B
 \return IHTMLElementCollection  \83\8a\83\93\83N\82Ì\83R\83\8c\83N\83V\83\87\83\93
 }
 function TGikoDM.GetActiveThreadLinks : IHTMLElementCollection;
 var
     browser : TWebBrowser;
+    doc : IHTMLDocument2;
 begin
     Result := nil;
     if (GikoForm.GetActiveContent <> nil) then begin
@@ -4259,7 +4373,10 @@ begin
                 .Objects[GikoForm.BrowserTab.TabIndex]).Browser;
             if (browser <> nil) then begin
                 try
-                    Result := IHTMLDocument2(browser.Document).links;
+                    doc := browser.ControlInterface.Document as IHTMLDocument2;
+                    if Assigned(doc) then begin
+                        Result := doc.links;
+                    end;
                 except
                     Result := nil;
                 end;
@@ -4269,15 +4386,16 @@ begin
     end;
 end;
 {
-\brief  \83C\83\81\81[\83W\82Ö\82Ì\83\8a\83\93\83N\82ÌURL\82ð\8eæ\93¾\82·\82é
+\brief  \83\8a\83\93\83N\82ÌURL\82ð\8eæ\93¾\82·\82é
 \param  links   \8eæ\93¾\82·\82é\83\8a\83\93\83N\82Ì\91S\91Ì\82Ì\83R\83\8c\83N\83V\83\87\83\93
 \param  URLs    \8eæ\93¾\82µ\82½URL\82Ì\95Û\91\90æ
 \param  Start   \90Ý\92è\82µ\82½\83\8c\83X\94Ô\8d\86\88È\8d~\82ð\8eæ\93¾( > 0)
+\param  Exts    \8eæ\93¾\82·\82é\83\8a\83\93\83N\82Ì\8ag\92£\8eq
 }
-procedure TGikoDM.GetImageLinkURLs(links : IHTMLElementCollection;
-        URLs : TStringList; const Start: Integer);
+procedure TGikoDM.GetLinkURLs(links : IHTMLElementCollection;
+        URLs : TStringList; const Start: Integer; Exts : TStringList);
 var
-    index ,i : Integer;
+    index ,i, j : Integer;
     item : IHTMLElement;
     url, ext : string;
 begin
@@ -4290,15 +4408,14 @@ begin
                 // \83\8c\83X\82Ì\94Ô\8d\86\82ð\8dX\90V
                 if (Pos('menu:', url) > 0) then begin
                     index := StrToInt64Def(
-                        Copy(url, 5, Length(url)), index + 1
+                        Copy(url, 6, Length(url)), index + 1
                     );
                 end else begin
                     // \8aJ\8en\83\8c\83X\94Ô\8d\86\88È\8d~\82©\83`\83F\83b\83N
                     if (index >= Start) then begin
                         ext := ExtractFileExt( AnsiLowerCase(url) );
-                        // jpg,jpeg,gif,png\82ð\83`\83F\83b\83N
-                        if (ext = '.jpg') or (ext = '.jpeg') or
-                            (ext = '.gif') or (ext = '.png') then begin
+                        // \8ag\92£\8eq\82ð\83`\83F\83b\83N
+                        if Exts.Find(ext, j) then begin
                             urls.Add(url)
                         end;
                     end;
@@ -4337,17 +4454,221 @@ begin
         form.Release;
     end;
 end;
+//! \83u\83\89\83E\83U\82ð1\83y\81[\83W\95ª\83X\83N\83\8d\81[\83\8b\82³\82¹\82é
+procedure TGikoDM.ScrollPageDownActionExecute(Sender: TObject);
+begin
+    GikoForm.BrowserMovement(GikoForm.BrowserPanel.Height);
+end;
+//! \83u\83\89\83E\83U\82ð1\83y\81[\83W\95ª\83X\83N\83\8d\81[\83\8b\82³\82¹\82é
+procedure TGikoDM.ScrollPageUpActionExecute(Sender: TObject);
+begin
+    GikoForm.BrowserMovement(-GikoForm.BrowserPanel.Height);
+end;
+
+
+//! \82±\82Ì\83\8c\83X\82ÌID\82ðNG\83\8f\81[\83h\82É\92Ç\89Á\82·\82é\81i\93§\96¾)
+procedure TGikoDM.AddIDtoNGWord0ActionExecute(Sender: TObject);
+begin
+    GikoForm.AddIDtoNGWord(true);
+end;
+//! \82±\82Ì\83\8c\83X\82ÌID\82ðNG\83\8f\81[\83h\82É\92Ç\89Á\82·\82é
+procedure TGikoDM.AddIDtoNGWord1ActionExecute(Sender: TObject);
+begin
+    GikoForm.AddIDtoNGWord(false);
+end;
+//! \83N\83\8a\83b\83v\83{\81[\83h\82Ì\95\8e\9a\97ñ\82ðID\82Æ\82µ\82Ä\93¯\88êID\83\8c\83X\83A\83\93\83J\81[\95\\8e¦
+procedure TGikoDM.ExtractSameIDActionExecute(Sender: TObject);
+var
+    ID: String;
+begin
+    ID := Trim(Clipboard.AsText);
+    if (Length(ID) > 0) then begin
+        if not IsNoValidID(ID) then begin
+            GikoForm.ShowSameIDAncher(ID);
+        end;
+    end;
+end;
+//! \83^\83u\82Ì\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82·\82é
+procedure TGikoDM.ShowTabListActionExecute(Sender: TObject);
+var
+    i : Integer;
+begin
+    GikoForm.ListView.Items.BeginUpdate;
+    GikoForm.ListView.Items.Clear;
+    BoardGroup.SpecialBoard.Clear;
+       for i := GikoForm.BrowserTab.Tabs.Count - 1 downto 0 do begin
+        BoardGroup.SpecialBoard.Add(
+               TBrowserRecord(GikoForm.BrowserTab.Tabs.Objects[i]).Thread);
+       end;
+    GikoForm.ListView.Items.EndUpdate;
+    GikoForm.SetActiveList(BoardGroup.SpecialBoard);
+end;
+//! \8bt\8eQ\8fÆ\82µ\82Ä\82¢\82é\83\8c\83X\82ð\92Ç\89Á\82·\82é
+procedure TGikoDM.DereferenceResActionExecute(Sender: TObject);
+var
+       i, currentNo, No : Integer;
+    links : IHTMLElementCollection;
+    threadItem : TThreadItem;
+    item : IHTMLElement;
+    url, url2 : string;
+    resNo : TStringList;
+    alreadyExist : Boolean;
+       PathRec: TPathRec;
+begin
+       No := GikoForm.KokoPopupMenu.Tag;
+       if No = 0 then Exit;
 
-procedure TGikoDM.NGWordEditFormActionExecute(Sender: TObject);
+    ThreadItem := GikoForm.KokoPopupThreadItem;
+    // \83A\83N\83e\83B\83u\83^\83u\82©\82ç\91S\82Ä\82Ì\83\8a\83\93\83N\82ð\8eæ\93¾\82·\82é
+    links := GetActiveThreadLinks;
+    if (ThreadItem <> nil) and (links <> nil) then begin
+        resNo := TStringList.Create;
+        try
+            currentNo := 0;
+            alreadyExist := False;
+            // \83\8a\83\93\83N\82ð\91S\82Ä\91\96\8d¸\82·\82é
+            for i := 0 to links.length - 1 do begin
+                item := links.item(i, 0) as IHTMLElement;
+                if (item <> nil) then begin
+                    url := item.getAttribute('href', 0);
+                    // \83\8c\83X\82Ì\94Ô\8d\86\82ð\8dX\90V
+                    if (Pos('menu:', url) > 0) then begin
+                        currentNo := StrToInt64Def(
+                            Copy(url, 6, Length(url)), currentNo + 1
+                        );
+                        alreadyExist := False;
+                    end else if (currentNo <> -1) and (not alreadyExist) then begin
+                        // IE7\91Î\89\9e
+                        if Pos('about:..', url) = 1 then begin
+                            url := 'about:blank..' + Copy( url, Length('about:..')+1, Length(url) )
+                        end;
+                        // \8e©\95ª\82Ö\82Ì\83\8a\83\93\83N\82©\82ç\83\8c\83X\83|\83b\83v\97p\82Ì\94Ô\8d\86\8eæ\93¾
+                        if Pos('about:blank..', url) = 1 then begin
+                            // No \94Ô\82Ö\82Ì\83\8a\83\93\83N\82ª\82 \82ê\82Î\8eQ\8fÆ\82 \82è
+                            url2 := THTMLCreate.GetRespopupURL(url, ThreadItem.URL);
+                                       PathRec := Gikosys.Parse2chURL2(url2);
+                            if (not PathRec.FNoParam) then begin
+                                Gikosys.GetPopupResNumber(url2,PathRec.FSt,PathRec.FTo);
+                                       end;
+                            // \91Î\8fÛ\83\8c\83X\82à\82µ\82­\82Í\82»\82ê\82ð\8aÜ\82Þ\82È\82ç\8eQ\8fÆ\82 \82è\82Æ\82·\82é
+                            if (PathRec.FSt = No) or
+                                ((PathRec.FSt <= No) and (PathRec.FTo >= No))  then begin
+                                alreadyExist := True;
+                                resNo.Add(IntToStr(currentNo));
+                            end;
+                        end;
+                    end;
+                end;
+            end;
+            // \96³\90§\8cÀ\82È\82Ì\82Å-1\8cÅ\92è
+            GikoForm.ActiveContent.IDAnchorPopup(
+                GikoSys.CreateResAnchor(resNo, ThreadItem, -1));
+        finally
+            resNo.Clear;
+            resNo.Free;
+        end;
+    end;
+end;
+
+procedure TGikoDM.UpdateGikonaviActionExecute(Sender: TObject);
 var
-    form: TNGWordEditForm;
+    form : TUpdateCheckForm;
+       Msg: string;
+    shutdown: boolean;
 begin
-    form := TNGWordEditForm.Create(Self);
+       if (EditorFormExists) then begin
+               Msg := '\83\8c\83X\83G\83f\83B\83^\82ð\91S\82Ä\95Â\82\82Ä\82­\82¾\82³\82¢';
+               MsgBox(GikoForm.Handle, Msg, MSG_ERROR, MB_OK or MB_ICONSTOP);
+               Exit;
+       end;
+    GikoForm.UpdateExePath := '';
+    GikoForm.UpdateExeArgs := '';
+    form := TUpdateCheckForm.Create(Self);
     try
         form.ShowModal;
+        shutdown := form.Allowshutdown;
+        if shutdown then begin
+            GikoForm.UpdateExePath := form.ExecPath;
+            GikoForm.UpdateExeArgs := form.ExecArgs;
+        end;
     finally
         form.Release;
     end;
+    if shutdown then begin
+        // \83M\83R\83i\83r\8fI\97¹
+        GikoForm.Close;
+    end;
+
+end;
+//! \82±\82Ì\83\8c\83X\82ÌURL\83R\83s\81[\81iPATH_INFO)
+procedure TGikoDM.konoURLPATHActionExecute(Sender: TObject);
+var
+    No : Integer;
+    ThreadItem : TThreadItem;
+    URL, Protocol, Host, Path, Document, Port, Bookmark : String;
+begin
+       No := GikoForm.KokoPopupMenu.Tag;
+       if No = 0 then Exit;
+
+    ThreadItem := GikoForm.KokoPopupThreadItem;
+    if (ThreadItem.ParentBoard.Is2ch) or not (Pos('?', ThreadItem.URL) > 0) then begin
+        GikoSys.ParseURI(ThreadItem.URL,Protocol, Host, Path, Document, Port, Bookmark);
+        URL := Protocol + '://' + Host + Path + IntToStr(No);
+    end else begin
+        if Pos('?', ThreadItem.URL) > 0 then begin
+            URL := Copy(ThreadItem.URL, 1, Pos('?', ThreadItem.URL)-1);
+            // \82Ü\82¿BBS\97p\8f\88\92u
+            URL := MojuUtils.CustomStringReplace(URL, 'read.pl', 'read.cgi');
+            URL := URL + '/' + ThreadItem.ParentBoard.BBSID + '/' + ChangeFileExt(ThreadItem.FileName, '')  + '/' + IntToStr(No);
+        end;
+    end;
+    Clipboard.SetTextBuf( PChar(URL) );
+end;
+//! \82±\82Ì\83\8c\83X\82ÌURL\83R\83s\81[\81iQuery_STRING)
+procedure TGikoDM.konoURLQueryActionExecute(Sender: TObject);
+var
+    No : Integer;
+    ThreadItem : TThreadItem;
+    URL, Protocol, Host, Path, Document, Port, Bookmark : String;
+begin
+       No := GikoForm.KokoPopupMenu.Tag;
+       if No = 0 then Exit;
+
+    ThreadItem := GikoForm.KokoPopupThreadItem;
+    // 2ch\82Æ\82µ\82½\82ç\82Î\82Í\81A\83\8c\83X\94Ô\8d\86\82ð\82¤\82Ü\82­\8f\88\97\9d\82µ\82Ä\82­\82ê\82È\82¢\82Ì\82Å\97\98\97p\95s\89Â
+    if ThreadItem.ParentBoard.Is2ch or not (Pos('?', ThreadItem.URL) > 0) then begin
+        GikoSys.ParseURI(ThreadItem.URL, Protocol, Host, Path, Document, Port, Bookmark);
+        URL := Protocol + '://' + Host + '/test/read.cgi?bbs=' + ThreadItem.ParentBoard.BBSID
+            + '&key=' + ChangeFileExt(ThreadItem.FileName, '') + '&st=' + IntToStr(No) + '&to=' + IntToStr(No);
+    end else begin
+        URL := ThreadItem.URL;
+        // \82Ü\82¿BBS
+        if Pos('&LAST=', URL) > 0 then begin
+            URL := Copy(URL, 1, Pos('&LAST=', URL) - 1);
+            URL := URL + '&START=' + IntToStr(No) + '&END=' + IntToStr(No);
+        end;
+        // \82»\82Ì\91¼\8aO\95\94\94Â
+        if Pos('&ls=', URL) > 0 then begin
+            URL := Copy(URL, 1, Pos('&ls=', URL) - 1);
+            URL := URL + '&st=' + IntToStr(No) + '&to=' + IntToStr(No);
+        end;
+
+    end;
+    Clipboard.SetTextBuf( PChar(URL) );
+end;
+//! \82±\82Ì\83\8c\83X\82ÌURL\83R\83s\81[\81iQuery_STRING\81j\82Ì\97\98\97p\83`\83F\83b\83N
+procedure TGikoDM.konoURLQueryActionUpdate(Sender: TObject);
+const
+       LIVEDOOR_URL = 'http://jbbs.livedoor.jp/';
+begin
+    // 2ch\82Æ\82µ\82½\82ç\82Î\82Í\97\98\97p\82Å\82«\82È\82¢\82æ\82¤\82É\82·\82é\81i\82¤\82Ü\82­\83\8c\83X\8ew\92è\82Å\82«\82È\82¢\82Ì\82Å\81j
+    konoURLQueryAction.Enabled := false;
+    if (GikoForm.KokoPopupThreadItem <> nil) then begin
+        konoURLQueryAction.Enabled := not GikoForm.KokoPopupThreadItem.ParentBoard.Is2ch;
+        if konoURLQueryAction.Enabled then begin
+            konoURLQueryAction.Enabled := not (Pos(LIVEDOOR_URL, GikoForm.KokoPopupThreadItem.URL) = 1);
+        end;
+    end;
 end;
 
 end.