OSDN Git Service

バタ59リリース2向けに更新
[gikonavigoeson/gikonavi.git] / GikoDataModule.pas
index 98df852..4011a7f 100644 (file)
@@ -240,6 +240,9 @@ type
     AddIDtoNGWord0Action: TAction;
     AddIDtoNGWord1Action: TAction;
     ExtractSameIDAction: TAction;
+    ShowTabListAction: TAction;
+    DereferenceResAction: TAction;
+    UpdateGikonaviAction: TAction;
        procedure EditNGActionExecute(Sender: TObject);
        procedure ReloadActionExecute(Sender: TObject);
        procedure GoFowardActionExecute(Sender: TObject);
@@ -450,6 +453,9 @@ type
     procedure AddIDtoNGWord0ActionExecute(Sender: TObject);
     procedure AddIDtoNGWord1ActionExecute(Sender: TObject);
     procedure ExtractSameIDActionExecute(Sender: TObject);
+    procedure ShowTabListActionExecute(Sender: TObject);
+    procedure DereferenceResActionExecute(Sender: TObject);
+    procedure UpdateGikonaviActionExecute(Sender: TObject);
   private
        { Private \90é\8c¾ }
        procedure ClearResFilter;
@@ -482,8 +488,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
@@ -502,7 +510,7 @@ uses
        GikoBayesian, About, ShellAPI,
        RoundName, RoundData, Menus, ListViewUtils,
        ThreadControl, GikoMessage, InputAssist,
-    DefaultFileManager, Forms, NewBoardURL;
+    DefaultFileManager, Forms, NewBoardURL, UpdateCheck;
 
 const
        MSG_ERROR : string = '\83G\83\89\81[';
@@ -524,10 +532,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;
 // *************************************************************************
@@ -2637,7 +2653,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
@@ -3000,9 +3017,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;
 // *************************************************************************
@@ -3200,8 +3218,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;
@@ -4383,7 +4403,7 @@ 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
@@ -4463,6 +4483,118 @@ begin
         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;
+
+    ThreadItem := GikoForm.GetActiveContent;
+    // \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 : TUpdateCheckForm;
+       Msg: string;
+    shutdown: boolean;
+begin
+       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;
 
 end.