Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/ResPopupBrowser.pas

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

revision 1.1.2.10 by h677, Tue May 15 16:38:20 2007 UTC revision 1.1.2.11 by h677, Fri May 18 22:43:35 2007 UTC
# Line 45  type Line 45  type
45          procedure Write(ADocument: String; OnlyTitle: Boolean = False);          procedure Write(ADocument: String; OnlyTitle: Boolean = False);
46          procedure Clear;          procedure Clear;
47          procedure ChildClear;          procedure ChildClear;
48          procedure NavigateBlank;          procedure NavigateBlank(Forced: Boolean);
49          property PopupType: TGikoPopupType read FPopupType write FPopupType;          property PopupType: TGikoPopupType read FPopupType write FPopupType;
50          procedure TitlePopup;          procedure TitlePopup;
51          procedure Popup;          procedure Popup;
52            procedure Blur;
53          end;          end;
54    
55  implementation  implementation
# Line 103  begin Line 104  begin
104          end else begin          end else begin
105              FChild := TResPopupBrowser.Create(Self);              FChild := TResPopupBrowser.Create(Self);
106              FChild.ParentBrowser := Self;              FChild.ParentBrowser := Self;
107              FChild.NavigateBlank;              FChild.NavigateBlank(False);
108                FChild.OnEnter := GikoForm.BrowserEnter;
109              FChild.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;              FChild.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;
110              FChild.OnStatusTextChange := GikoForm.BrowserStatusTextChange;              FChild.OnStatusTextChange := GikoForm.BrowserStatusTextChange;
111              FChild.OnNewWindow2 := GikoForm.BrowserNewWindow2;              FChild.OnNewWindow2 := GikoForm.BrowserNewWindow2;
112              SetWindowPos(FChild.Handle, HWND_BOTTOM,              SetWindowPos(FChild.Handle, HWND_BOTTOM,
113                  0, 0, 0 , 0,                  0, 0, 0 , 0,
114    //                SWP_NOZORDER or
115                  SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);                  SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);
116              Result := FChild;              Result := FChild;
117          end;          end;
118      end else begin      end else begin
119          FParentBrowser := nil;          FParentBrowser := nil;
120          Self.NavigateBlank;          Self.NavigateBlank(False);
121            Self.OnEnter := GikoForm.BrowserEnter;
122          Self.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;          Self.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;
123          Self.OnStatusTextChange := GikoForm.BrowserStatusTextChange;          Self.OnStatusTextChange := GikoForm.BrowserStatusTextChange;
124          Self.OnNewWindow2 := GikoForm.BrowserNewWindow2;          Self.OnNewWindow2 := GikoForm.BrowserNewWindow2;
125          SetWindowPos(Self.Handle, HWND_BOTTOM,          SetWindowPos(Self.Handle, HWND_BOTTOM,
126              0, 0, 0 , 0,              0, 0, 0 , 0,
127    //            SWP_NOZORDER or
128              SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);              SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);
129          Result := Self;          Result := Self;
130      end;      end;
# Line 130  begin Line 135  begin
135      if (Result.ParentBrowser <> nil) then      if (Result.ParentBrowser <> nil) then
136          Result := Result.ParentBrowser;          Result := Result.ParentBrowser;
137  end;  end;
138  procedure TResPopupBrowser.NavigateBlank;  procedure TResPopupBrowser.NavigateBlank(Forced: Boolean);
139  begin  begin
140      if (not Assigned(Self.Document)) then begin      if (not Assigned(Self.Document)) or (Forced) then begin
141          Self.Navigate('about:blank');          Self.Navigate('about:blank');
142      end;      end;
143      while (Self.ReadyState <> READYSTATE_COMPLETE) and      while (Self.ReadyState <> READYSTATE_COMPLETE) and
144              (Self.ReadyState <> READYSTATE_INTERACTIVE) do begin              (Self.ReadyState <> READYSTATE_INTERACTIVE) do begin
145            Sleep(1);
146          Forms.Application.ProcessMessages;          Forms.Application.ProcessMessages;
147      end;      end;
148  end;  end;
# Line 152  procedure TResPopupBrowser.Write(ADocume Line 158  procedure TResPopupBrowser.Write(ADocume
158  var  var
159          p: TPoint;          p: TPoint;
160      doc: Variant;      doc: Variant;
161          ARect: TRect;          ARect, rect: TRect;
162      FDispHtmlDocument: DispHTMLDocument;      FDispHtmlDocument: DispHTMLDocument;
     mainActive: Boolean;  
163  begin  begin
164      try      try
         mainActive := GikoForm.Active;  
   
165          // タスクバーから消す          // タスクバーから消す
166          SetWindowLongA(Self.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);          SetWindowLongA(Self.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
167          GetCursorpos(p);          GetCursorpos(p);
# Line 170  begin Line 173  begin
173          doc.open;          doc.open;
174          doc.charset := 'Shift_JIS';          doc.charset := 'Shift_JIS';
175          doc.Write('<html><head>'#13#10 +          doc.Write('<html><head>'#13#10 +
176                  '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10                  '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10 +
177                    '<meta http-equiv="Pragma" content="no-cache">'#13#10 +
178                    '<meta http-equiv="Cache-Control" content="no-cache">'#13#10
179                  + GetBodyStyle(OnlyTitle) + '</head><body>'                  + GetBodyStyle(OnlyTitle) + '</head><body>'
180                  + GetTitle(OnlyTitle)                  + GetTitle(OnlyTitle)
181                  + ADocument + '<a name="bottom"></a></body></html>');                  + ADocument + '<a name="bottom"></a></body></html>');
182    
183          doc.Close;          doc.Close;
184    
   
185          ARect := CalcRect(Screen.WorkAreaHeight, Screen.WorkAreaWidth,          ARect := CalcRect(Screen.WorkAreaHeight, Screen.WorkAreaWidth,
186               not OnlyTitle);               not OnlyTitle);
187    
# Line 191  begin Line 195  begin
195              (ARect.Right - ARect.Left) ,              (ARect.Right - ARect.Left) ,
196              (ARect.Bottom - ARect.Top),              (ARect.Bottom - ARect.Top),
197              SWP_NOACTIVATE or SWP_HIDEWINDOW);              SWP_NOACTIVATE or SWP_HIDEWINDOW);
   
198          ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);          ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);
         if mainActive <> GikoForm.Active then begin  
             GikoForm.SetFocus;  
         end;  
199      except      except
200      end;      end;
201  end;  end;
# Line 237  begin Line 237  begin
237  end;  end;
238    
239  procedure TResPopupBrowser.Clear;  procedure TResPopupBrowser.Clear;
240    var
241        rect: TRect;
242  begin  begin
243      ChildClear;      ChildClear;
244      if (Self.Visible) then begin      if (Self.Visible) then begin
245          Self.Title := '';          Self.Title := '';
246          Self.RawDocument := '';          Self.RawDocument := '';
247          Self.FThread := nil;          Self.FThread := nil;
248          FEvent.Free;          Self.FEvent.Free;
249          FEvent := nil;          Self.FEvent := nil;
250          NavigateBlank;          Self.Blur;
251          ShowWindow(Self.Handle, SW_HIDE);          ShowWindow(Self.Handle, SW_HIDE);
252          Self.Visible := False;          Self.Visible := False;
253      end;      end;
# Line 296  begin Line 298  begin
298      if (Result.Bottom > MaxHeight) then begin      if (Result.Bottom > MaxHeight) then begin
299          OffsetRect(Result, 0, - (Result.Bottom - MaxHeight));          OffsetRect(Result, 0, - (Result.Bottom - MaxHeight));
300      end;      end;
301        
302      // ここで再度左と上を確認して飛び出してたら、画面サイズを小さくする      // ここで再度左と上を確認して飛び出してたら、画面サイズを小さくする
303      if (Result.Left < 0) then begin      if (Result.Left < 0) then begin
304          Result := Rect(0, Result.Top,          Result := Rect(0, Result.Top,
# Line 335  begin Line 337  begin
337  end;  end;
338  function TResPopupBrowser.ResPopupBrowserClick(Sender: TObject): WordBool;  function TResPopupBrowser.ResPopupBrowserClick(Sender: TObject): WordBool;
339  begin  begin
340      if (not GikoSys.Setting.UnActivePopup) then begin      // ギコナビのフォーカスを奪ってるのでフォームに無理やり返す
341          // ギコナビのフォーカスを奪ってるのでフォームに無理やり返す      Blur;
         GikoForm.SetFocus;  
     end;  
342      Result := True;      Result := True;
343  end;  end;
344  function TResPopupBrowser.GetThread: TThreadItem;  function TResPopupBrowser.GetThread: TThreadItem;
# Line 356  begin Line 356  begin
356          end;          end;
357      end;      end;
358  end;  end;
359    procedure TResPopupBrowser.Blur;
360    var
361        rect: TRect;
362    begin
363        if ((Self.Document as IHTMLDocument2).activeElement <> nil) then begin
364            // フォーカス外し
365            Windows.GetClientRect(Self.Handle, rect);
366            if (Self.ParentBrowser <> nil) then begin
367                (Self.Application as IOleObject).DoVerb(OLEIVERB_DISCARDUNDOSTATE, (* iVerb *)
368                                               nil,                 (* lpMsg *)
369                                               Self,             (* pActiveSite *)
370                                               0,                   (* lindex - reserved *)
371                                               Self.ParentBrowser.Handle,      (* hwndParent *)
372                                               rect);               (* display rectangle *)
373                Self.ParentBrowser.Blur;
374            end else begin
375                (Self.Application as IOleObject).DoVerb(OLEIVERB_DISCARDUNDOSTATE, (* iVerb *)
376                                               nil,                 (* lpMsg *)
377                                               Self,             (* pActiveSite *)
378                                               0,                   (* lindex - reserved *)
379                                               GikoForm.ActiveContent.Browser.Handle,      (* hwndParent *)
380                                               rect);               (* display rectangle *)
381            end;
382        end;
383    end;
384    
385    initialization
386        OleInitialize(nil);
387    
388    finalization
389        OleUninitialize;
390    
391  end.  end.

Legend:
Removed from v.1.1.2.10  
changed lines
  Added in v.1.1.2.11

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