OSDN Git Service

スレ一覧の絞込みでCTRL+DELで個別に削除できるように修正
[gikonavigoeson/gikonavi.git] / Giko.pas
index 416e3e9..dcb1a01 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -417,6 +417,8 @@ type
     IDNG1: TMenuItem;
     IDNG2: TMenuItem;
     ResPopupClearTimer: TTimer;
+    TaskTrayPopupMenu: TPopupMenu;
+    Exit1: TMenuItem;
                                procedure FormCreate(Sender: TObject);
                procedure FormDestroy(Sender: TObject);
                procedure BrowserStatusTextChange(Sender: TObject;
@@ -815,6 +817,8 @@ type
         procedure TaskTrayIconMessage(var Msg : TMsg); message WM_USER + 2010;
         //! \83^\83X\83N\83g\83\8c\83C\82É\83A\83C\83R\83\93\93o\98^\81\95\83t\83H\81[\83\80\89B\82µ
         procedure StoredTaskTray;
+        //! \93¯ID\83\8c\83X\83A\83\93\83J\81[\95\\8e¦
+        procedure ShowSameIDAncher(const AID: String);
        published
                property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
        end;
@@ -1545,8 +1549,13 @@ var
        i                               : Integer;
        wp                      : TWindowPlacement;
        tmpBool : Boolean;
-    doc:IHTMLDocument2;
+    WindowPlacement: TWindowPlacement;
 begin
+    // \83^\83X\83N\83g\83\8c\83C\82Ì\83A\83C\83R\83\93\8dí\8f\9c
+    if (FIconData.uID <> 0) then begin
+        Shell_NotifyIcon(NIM_DELETE, @FIconData);
+    end;
+
        // \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8aJ\95ú
        try
         if GikoSys.Setting.GestureEnabled then begin
@@ -1564,6 +1573,9 @@ begin
        except
        end;
        try
+        WindowPlacement.length := SizeOf(TWindowPlacement);
+        GetWindowPlacement(Self.Handle, @WindowPlacement);
+
                //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91
                wp.length := sizeof(wp);
                GetWindowPlacement(Handle, @wp);
@@ -1571,8 +1583,8 @@ begin
                GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;
                GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
                GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
-               GikoSys.Setting.WindowMax := WindowState = wsMaximized;
-
+               GikoSys.Setting.WindowMax := (WindowState = wsMaximized) or
+                                        (WindowPlacement.flags = WPF_RESTORETOMAXIMIZED);
                GikoSys.Setting.ListStyle := ListView.ViewStyle;
                GikoSys.Setting.CabinetVisible := GikoDM.CabinetVisibleAction.Checked;
                GikoSys.Setting.CabinetWidth := CabinetPanel.Width;
@@ -4953,6 +4965,14 @@ begin
        if PreviewTimer.Enabled then
                PreviewTimer.Enabled := False;
 
+    //Window\8aO\82É\88Ú\93®\82µ\82½\82Æ\82«\82Í\8fÁ\82¦\82é\82æ\82¤\82É\82·\82é\82½\82ß\95\9c\8a\88
+    if (FResPopupBrowser <> nil) and (IsWindowVisible(FResPopupBrowser.Handle)) then begin
+        // \89E\83N\83\8a\83b\83N\82Ì\8e\9e\82Í\8fÁ\82³\82È\82¢\82æ\82¤\82É\8fð\8c\8f\92Ç\89Á
+        if (Message.MouseMsg <> WM_RBUTTONUP) then begin
+            FResPopupBrowser.Clear;
+        end;
+    end;
+
        if (FPreviewBrowser <> nil)
                and (IsWindowVisible(FPreviewBrowser.Handle)) then begin
         //\82±\82±\82Å\8fÁ\82³\82ê\82é\82Ì\82ª\96â\91è
@@ -5707,7 +5727,7 @@ procedure TGikoForm.SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
 var
   IMC: HIMC;
-  Len: integer;
+  Len, idx: integer;
   Str: string;
   tmp: string;
 begin
@@ -5733,6 +5753,20 @@ begin
                                SetSelectWord(Str);
                        end;
                end;
+    end else if (Key = Windows.VK_DELETE) and (ssCtrl in Shift) then begin
+        // Ctrl + DEL \82Å\8dí\8f\9c\82·\82é
+        Str := SelectComboBox.Text;
+        idx := GikoSys.Setting.SelectTextList.IndexOf( Str );
+        if idx <> -1 then begin
+            GikoSys.Setting.SelectTextList.Delete( idx );
+        end;
+        idx := SelectComboBox.Items.IndexOf( Str );
+               if idx <> -1 then begin
+            SelectComboBox.Items.Delete( idx );
+        end;
+        SelectComboBox.Text := '';
+        // \8di\8d\9e\82Ý\82ð\89ð\8f\9c\82·\82é\82½\82ß\82É\95Ï\8dX\83C\83x\83\93\83g\82ð\8cÄ\82Ñ\8fo\82·
+        SelectComboBox.OnChange(Sender);
        end else if Length( SelectComboBox.Text ) = 0 then
        begin
                {* SelectComboBox.Text\82ª\8bó\82Å\82à\81A\93ü\97Í\93r\92\86\82ÅEsc\82µ\82½\82Æ\82©
@@ -6749,8 +6783,6 @@ end;
 //! \83X\83\8c\83b\83h\83u\83\89\83E\83U\83N\83\8a\83b\83N\83C\83x\83\93\83g
 // *************************************************************************
 function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;
-const
-    LIMIT = 20;
 var
        e: IHTMLElement;
     doc : IHTMLDocument2;
@@ -6758,9 +6790,7 @@ var
        p : TPoint;
        AID: string;
        stlist : TStringList;
-       i, count: Integer;
-       body : String;
-    limited : Integer;
+    i : Integer;
 begin
        result := true;
     if not Assigned(FActiveContent) then
@@ -6772,18 +6802,18 @@ begin
                FOleInPlaceActiveObject := FActiveContent.Browser.ControlInterface as IOleInPlaceActiveObject;
                FOleInPlaceActiveObject.OnFrameWindowActivate(True);
                GetCursorPos(p);
-               
+
                p.x := p.x - FActiveContent.Browser.ClientOrigin.x;
                p.y := p.y - FActiveContent.Browser.ClientOrigin.y;
-               
+
                doc := FActiveContent.Browser.ControlInterface.Document as IHTMLDocument2;
                if not Assigned(doc) then
                        Exit;
 
                e := doc.elementFromPoint(p.x, p.y);
-               if not Assigned(e) then 
+               if not Assigned(e) then
                        Exit;
-               
+
                if (e.className = 'date') or (e.id = 'date') then begin
                        AID := e.innerText;
                        if AnsiPos('id', AnsiLowerCase(AID)) > 0 then begin
@@ -6808,27 +6838,39 @@ begin
                                        stList.Free;
                                end;
                        end;
-                       
-                       count := GikoSys.GetSameIDResCount(AID, FActiveContent.Thread);
-                       limited := LIMIT;
-                       if not (GikoSys.Setting.LimitResCountMessage) then begin
-                               limited := -1;
-                       end else if (count > LIMIT) then begin
-                               if (GikoUtil.MsgBox(Handle,
-                                               IntToStr(LIMIT) + '\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) = ID_YES) then begin
-                                       limited := -1;
-                               end
-                       end;
-
-                       body := GikoSys.GetSameIDResAnchor(AID, FActiveContent.Thread, limited);
-                       FActiveContent.IDAnchorPopup(body);
+            ShowSameIDAncher(AID);
                end;
        except
        end;
 end;
+procedure TGikoForm.ShowSameIDAncher(const AID: String);
+const
+    LIMIT = 20;
+var
+       numbers : TStringList;
+    limited : Integer;
+begin
+    numbers := TStringList.Create;
+    try
 
+        GikoSys.GetSameIDRes(AID, FActiveContent.Thread, numbers);
+        limited := LIMIT;
+        if not (GikoSys.Setting.LimitResCountMessage) then begin
+            limited := -1;
+        end else if (numbers.Count > LIMIT) then begin
+            if (GikoUtil.MsgBox(Handle,
+                    IntToStr(LIMIT) + '\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) = ID_YES) then begin
+                limited := -1;
+            end
+        end;
+        FActiveContent.IDAnchorPopup(
+            GikoSys.CreateSameIDResAnchor(numbers, FActiveContent.Thread, limited));
+    finally
+        numbers.Free;
+    end;
+end;
 //\83X\83\8c\83b\83h\88ê\97\97\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é
 procedure TGikoForm.SelectTimerTimer(Sender: TObject);
 begin
@@ -7745,10 +7787,17 @@ begin
 end;
 
 procedure TGikoForm.TaskTrayIconMessage(var Msg: TMsg);
+var
+    p: TPoint;
 begin
     //  \8d\83N\83\8a\83b\83N\82È\82ç\95\9c\8c³\82·\82é
     if  (Msg.wParam = WM_LBUTTONUP) then  begin
         UnStoredTaskTray;
+    end else if (Msg.wParam=WM_RBUTTONUP) then begin
+        // \89E\83N\83\8a\83b\83N\82È\82ç\8fI\97¹\82·\82é
+        GetCursorPos ( p );
+        SetForegroundWindow ( Self.Handle );
+        TaskTrayPopupMenu.Popup ( p.X, p.Y );
     end;
 end;
 //! \83^\83X\83N\83g\83\8c\83C\82É\83A\83C\83R\83\93\93o\98^\81\95\83t\83H\81[\83\80\89B\82µ