OSDN Git Service

FormDestoryでのCoolBarの保存の前にFormのWindowStateをNormalに
authorh677 <h677>
Wed, 3 Nov 2004 03:24:27 +0000 (03:24 +0000)
committerh677 <h677>
Wed, 3 Nov 2004 03:24:27 +0000 (03:24 +0000)
するようにしてみた。

Giko.pas

index 31b3e06..abfd2ec 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -1299,6 +1299,7 @@ begin
        Writeln('============================================================');
 {$ENDIF}
        FStartUp := true;
+       LockWindowUpdate(Self.Handle);
        //Application.OnDeactivate := AppFormDeactivate;
        Self.OnDeactivate := AppFormDeactivate;
        Application.HookMainWindow(Hook);
@@ -1745,15 +1746,16 @@ begin
        if GikoSys.Setting.GestureEnabled then
                MouseGesture.SetHook( Handle );
 
-        //2ch\8c¾\8cê\93Ç\82Ý\8fo\82µ
-               if GikoSys.Setting.GengoSupport then begin
-                       if GikoSys.Setting.Gengo = nil then
-                               GikoSys.Setting.Gengo := TStringList.Create;
-                       if FileExists(GikoSys.GetConfigDir + 'language.ini') then
-                               GikoSys.Setting.Gengo.LoadFromFile(GikoSys.GetConfigDir + 'language.ini')
-                       else
-                               GikoSys.Setting.GengoSupport := false;
-               end;
+       //2ch\8c¾\8cê\93Ç\82Ý\8fo\82µ
+       if GikoSys.Setting.GengoSupport then begin
+               if GikoSys.Setting.Gengo = nil then
+                       GikoSys.Setting.Gengo := TStringList.Create;
+               if FileExists(GikoSys.GetConfigDir + 'language.ini') then
+                       GikoSys.Setting.Gengo.LoadFromFile(GikoSys.GetConfigDir + 'language.ini')
+               else
+                       GikoSys.Setting.GengoSupport := false;
+       end;
+       LockWindowUpdate(0);
 end;
 
 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
@@ -2012,20 +2014,21 @@ begin
                        GikoSys.Setting.ResRange := FResRangeMenuSelect;
        except
        end;
-
+       if WindowState <> wsNormal then
+               WindowState := wsNormal;
+       SaveCoolBarSettings;
+       try
+               GikoSys.Setting.WriteWindowSettingFile;
+               GikoSys.Setting.WriteNameMailSettingFile;
+       except
+       end;
        // \83\8a\83A\83\8b\83^\83C\83\80\82É\95Û\91\82³\82ê\82é\82Ì\82Å\81A\82Ü\82½\81A\83E\83B\83\93\83h\83E\83T\83C\83Y\82ª CoolBar \82æ\82è
        // \8f¬\82³\82­\82È\82Á\82Ä\82¢\82é\82Æ\82«\82É\95Û\91\82·\82é\82Æ\92l\82ª\8fã\8f\91\82«\82³\82ê\82Ä\82µ\82Ü\82¤\82Ì\82Å\82±\82±\82Å\82Í\95Û\91\82µ\82È\82¢
 
                // \81ªFormDestroy\92\86\82É\88Ú\93®\82µ\82½\82Ì\82Å\81A\82±\82±\82Å\95Û\91\82µ\82È\82¢\82Æ\82¢\82¯\82È\82¢\82Æ\8ev\82¤\81B\81i\82à\82\82ã\81@2004/04/09\81j
        // CoolBar \95Û\91
        //if (GikoForm.WindowState <> wsMinimized) and (GikoForm.WindowState <> wsMaximized) then
-               SaveCoolBarSettings;
-    
-       try
-               GikoSys.Setting.WriteWindowSettingFile;
-               GikoSys.Setting.WriteNameMailSettingFile;
-       except
-       end;
+
 
        //\82¨\8bC\82É\93ü\82è\95Û\91
        try
@@ -2034,17 +2037,16 @@ begin
                FavoriteDM.Clear;
        except
        end;
-
+       LockWindowUpdate(Self.Handle);
        try
                //\83^\83u\83N\83\8d\81[\83Y
                tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
                GikoSys.Setting.ShowDialogForAllTabClose := false;
                AllTabCloseAction.Execute;
-        GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
+               GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
        except
        end;
        try
-               LockWindowUpdate(Self.Handle);
                for i := FBrowsers.Count - 1 downto 0 do begin
                        TWebBrowser(FBrowsers[i]).Free;
                end;
@@ -2062,7 +2064,7 @@ begin
                end;
        except
        end;
-       LockWindowUpdate(0);
+
        try
                TreeView.Items.BeginUpdate;
                TreeView.Items.GetFirstNode.Free;
@@ -2154,7 +2156,7 @@ begin
                end;
        except
        end;
-
+    LockWindowUpdate(0);
 end;
 
 //\83L\83\83\83r\83l\83b\83g\81~\83{\83^\83\93\83N\83\8a\83b\83N
@@ -2567,13 +2569,15 @@ begin
 
                ListView.StateImages := nil;
 
-               if BBS = nil then Exit;
-               if BBS.Count <= 0 then Exit;
-               if Item = nil then Exit;
-               if Item.Index >= BBS.Count then Exit;
-               if ListView.Items.Count = 0 then Exit;
+               if (BBS = nil) or (BBS.Count <= 0) or (Item = nil)
+                       or (Item.Index >= BBS.Count) or (ListView.Items.Count = 0)
+                       or (not (BBS.Items[Item.index] is TCategory)) then Exit;
+               //if BBS.Count <= 0 then Exit;
+               //if Item = nil then Exit;
+               //if Item.Index >= BBS.Count then Exit;
+               //if ListView.Items.Count = 0 then Exit;
 
-               if not (BBS.Items[Item.index] is TCategory) then Exit;
+               //if not (BBS.Items[Item.index] is TCategory) then Exit;
                Category := TCategory(BBS.Items[Item.index]);
 
                if Category = nil then Exit;
@@ -2593,13 +2597,15 @@ begin
 
                ListView.StateImages := nil;
 
-               if Category = nil then Exit;
-               if Category.Count <= 0 then Exit;
-               if Item = nil then Exit;
-               if Item.Index >= Category.Count then Exit;
-               if ListView.Items.Count = 0 then Exit;
+               if (Category = nil) or (Category.Count <= 0) or (Item = nil)
+                       or (Item.Index >= Category.Count) or (ListView.Items.Count = 0)
+                       or (not (Category.Items[Item.Index] is TBoard))  then Exit;
+               //if Category.Count <= 0 then Exit;
+               //if Item = nil then Exit;
+               //if Item.Index >= Category.Count then Exit;
+               //if ListView.Items.Count = 0 then Exit;
 
-               if not (Category.Items[Item.Index] is TBoard) then Exit;
+               //if not (Category.Items[Item.Index] is TBoard) then Exit;
                Board := TBoard(Category.Items[Item.Index]);
 
                if Board = nil then Exit;
@@ -2611,6 +2617,7 @@ begin
 
                if Item.SubItems.Count <> ListView.Columns.Count then begin
                        Item.SubItems.Clear;
+                       Item.SubItems.Capacity := GikoSys.Setting.CategoryColumnOrder.Count;
                        for i := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 1 do
                                Item.SubItems.Add('');
                end;
@@ -2663,10 +2670,11 @@ begin
                end;
 
 //             if Board = nil then Exit;
-               if BoardCnt <= 0 then Exit;
-               if Item = nil then Exit;
-               if Item.Index > BoardCnt then Exit;
-               if ListView.Items.Count = 0 then Exit;
+               if (BoardCnt <= 0) or (Item = nil) or (Item.Index > BoardCnt)
+                       or (ListView.Items.Count = 0) or (not (Board.Items[Item.Index] is TThreadItem)) then Exit;
+               //if Item = nil then Exit;
+               //if Item.Index > BoardCnt then Exit;
+               //if ListView.Items.Count = 0 then Exit;
 
 //             if not (Board.Items[Item.Index] is TThreadItem) then Exit;
 
@@ -2693,6 +2701,7 @@ begin
 
                if Item.SubItems.Count <> ListView.Columns.Count then begin
                        Item.SubItems.Clear;
+                       Item.SubItems.Capacity := GikoSys.Setting.BoardColumnOrder.Count;
                        for i := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 1 do
                                Item.SubItems.Add('');
                end;
@@ -3322,8 +3331,6 @@ begin
        if FHint <> nil then begin
                FHint.ReleaseHandle;
                FHint.ClearAllRes;
-//             FHint.Free;
-//             FHint := nil;
        end;
        if FPreviewBrowser <> nil then
                ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
@@ -3668,16 +3675,6 @@ begin
        end;
 end;
 
-{procedure TGikoForm.BrowserTabChange(Sender: TObject);
-var
-       index: Integer;
-       ThreadItem: TThreadItem;
-begin
-       ThreadItem := GetActiveContent;
-       if ThreadItem <> nil then begin
-               SetContent(ThreadItem);
-       end;
-end;}
 
 function TGikoForm.InsertBrowserTab(
        ThreadItem      : TThreadItem;
@@ -4775,6 +4772,7 @@ begin
 
        while (BrowserRecord.Browser.ReadyState <> READYSTATE_COMPLETE) and
                                (BrowserRecord.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
+        Sleep(1);
                Application.ProcessMessages;
        end;
 
@@ -6377,35 +6375,6 @@ begin
                end;
        end;
 
-{      ShiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
-       CtrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
-
-       if ShiftDown then
-               Memo1.Lines.Add('ShiftDown');
-       if CtrlDown then
-               Memo1.Lines.Add('CtrlDown');
-
-       if      (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then        begin
-               Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
-               Url := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
-
-
-
-               URL := GetHRefText(URL);
-
-               ParseURI(URL, Protocol, Host, path, Document, Port, Bookmark);
-
-               b := Parse2chURL(path, document, bbs, num);
-               memo1.Lines.Add('bbs: ' + bbs);
-               memo1.Lines.Add('key: ' + num);
-               if b then
-                       Memo1.Lines.Add('Parse2chURL: True')
-               else
-                       Memo1.Lines.Add('Parse2chURL: False');
-
-//     AppPath := 'C:\Borland\Projects\Test\TestBrowser\TestBrowser.exe';
-
-       end;}
 end;
 
 procedure TGikoForm.ListSplitterMoved(Sender: TObject);
@@ -8985,29 +8954,7 @@ begin
                        else
                                Handled := False;
 
-{
-//                     if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
-                               // TWebBrowser \82Ì Handle \82Æ\94ä\8ar\82µ\82Ä\82à\88ê\92v\82µ\82È\82¢\82Ì\82Å\8dÀ\95W\82Å TWebBrowser \82©\82Ç\82¤\82©\94»\92è
-                               browserPos.X := 0;
-                               browserPos.Y := 0;
-                               Windows.ClientToScreen( Browser.Handle, browserPos );
-                               if (Longword(Mouse.CursorPos.X - browserPos.X) >= Browser.Width)
-                               or (Longword(Mouse.CursorPos.Y - browserPos.Y) >= Browser.Height)
-                               or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0)
-                               or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0) then begin
-//                             or not FActiveContent.Browser.Focused then
-                                       // TWebBrowser \82Í\96³\8cÀ\83\8b\81[\83v\82·\82é\82Ì\82Å\82»\82ê\88È\8aO\82È\82ç\83R\83\93\83g\83\8d\81[\83\8b\82É\91\97\90M
-                                       if (Wnd <> BrowserToolBar.Handle) and (Wnd <> BrowserNameToolBar.Handle) then
-                                               SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
-                                       else
-                                               Handled := False;
-                               end else begin
-                                       Handled := False;
-                               end;
-//                     end else begin
-//                             SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (MousePos.X shl 16) or MousePos.Y );
-//                     end;
-}              end;
+               end;
        end;
 end;