Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/GikoDataModule.pas

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

revision 1.1 by h677, Tue Nov 15 16:40:06 2005 UTC revision 1.2 by h677, Wed Nov 16 15:02:05 2005 UTC
# Line 3  unit GikoDataModule; Line 3  unit GikoDataModule;
3  interface  interface
4    
5  uses  uses
6    SysUtils, Classes, ExtActns, StdActns, ActnList, ImgList, Controls;    SysUtils, Classes, ExtActns, StdActns, ActnList, ImgList, Controls,
7      ComCtrls;
8    
9  type  type
10    TGikoDM = class(TDataModule)    TGikoDM = class(TDataModule)
# Line 179  type Line 180  type
180      procedure FavoriteAddActionExecute(Sender: TObject);      procedure FavoriteAddActionExecute(Sender: TObject);
181      procedure FavoriteArrangeActionExecute(Sender: TObject);      procedure FavoriteArrangeActionExecute(Sender: TObject);
182      procedure FavoriteTreeViewCollapseActionExecute(Sender: TObject);      procedure FavoriteTreeViewCollapseActionExecute(Sender: TObject);
183        procedure FavoriteTreeViewRenameActionExecute(Sender: TObject);
184        procedure FavoriteTreeViewNewFolderActionExecute(Sender: TObject);
185        procedure FavoriteTreeViewDeleteActionExecute(Sender: TObject);
186        procedure FavoriteTreeViewBrowseFolderActionExecute(Sender: TObject);
187        procedure FavoriteTreeViewReloadActionExecute(Sender: TObject);
188        procedure FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
189        procedure FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
190        procedure FavoriteTreeViewNameURLCopyActionExecute(Sender: TObject);
191        procedure FavoriteTreeViewLogDeleteActionExecute(Sender: TObject);
192        procedure FavoriteTreeViewBrowseThreadActionExecute(Sender: TObject);
193    private    private
194          { Private 宣言 }          { Private 宣言 }
195    public    public
196          { Public 宣言 }          { Public 宣言 }
197    published    published
198          { Published 宣言 }          { Published 宣言 }
199            //TActionでGetActiveContentがnil以外で有効になる
200          procedure DependActiveCntentActionUpdate(Sender: TObject);          procedure DependActiveCntentActionUpdate(Sender: TObject);
201            //TActionでGetActiveContentがnil以外かつログを持っていると有効になる
202            procedure DependActiveCntentLogActionUpdate(Sender: TObject);
203            //TActionでActiveListがTBoardで有効になる
204            procedure DependActiveListTBoardActionUpdate(Sender: TObject);
205    end;    end;
206    
207  var  var
# Line 194  var Line 210  var
210  implementation  implementation
211    
212  uses  uses
213          Windows, Math, Messages,          Windows, Math, Messages, Dialogs, Clipbrd,
214          Giko, GikoSystem, GikoUtil,          Giko, GikoSystem, GikoUtil, BoardGroup,
215          FavoriteArrange;          FavoriteArrange, Favorite;
216    
217    
218  const  const
# Line 204  const Line 220  const
220                    
221  {$R *.dfm}  {$R *.dfm}
222  // *************************************************************************  // *************************************************************************
223    // TActionでGetActiveContentがnil以外で有効になる
224    // *************************************************************************
225    procedure TGikoDM.DependActiveCntentActionUpdate(Sender: TObject);
226    begin
227            TAction(Sender).Enabled := (GikoForm.GetActiveContent <> nil);
228    end;
229    // *************************************************************************
230    // TActionでGetActiveContentがnil以外かつログを持っている
231    // *************************************************************************
232    procedure TGikoDM.DependActiveCntentLogActionUpdate(Sender: TObject);
233    begin
234            TAction(Sender).Enabled := (GikoForm.GetActiveContent <> nil)
235                                                                            and (GikoForm.GetActiveContent.IsLogFile);
236    end;
237    // *************************************************************************
238    // TActionでActiveListがTBoardで有効になる
239    // *************************************************************************
240    procedure TGikoDM.DependActiveListTBoardActionUpdate(Sender: TObject);
241    begin
242            TAction(Sender).Enabled := (GikoForm.GetActiveList is TBoard);
243    end;
244    // *************************************************************************
245  // NGワード編集  // NGワード編集
246  // *************************************************************************  // *************************************************************************
247  procedure TGikoDM.EditNGActionExecute(Sender: TObject);  procedure TGikoDM.EditNGActionExecute(Sender: TObject);
# Line 290  begin Line 328  begin
328          end;          end;
329  end;  end;
330  // *************************************************************************  // *************************************************************************
 // TActionでGetActiveContentがnil以外で有効になる  
 // *************************************************************************  
 procedure TGikoDM.DependActiveCntentActionUpdate(Sender: TObject);  
 begin  
         TAction(Sender).Enabled := (GikoForm.GetActiveContent <> nil);  
 end;  
 // *************************************************************************  
331  // お気に入りの追加ダイアログを開く  // お気に入りの追加ダイアログを開く
332  // *************************************************************************  // *************************************************************************
333  procedure TGikoDM.FavoriteAddActionExecute(Sender: TObject);  procedure TGikoDM.FavoriteAddActionExecute(Sender: TObject);
# Line 337  begin Line 368  begin
368          except          except
369          end;          end;
370  end;  end;
371    // *************************************************************************
372    // お気に入りの名前を編集する
373    // *************************************************************************
374    procedure TGikoDM.FavoriteTreeViewRenameActionExecute(Sender: TObject);
375    var
376            node : TTreeNode;
377    begin
378    
379            if GikoForm.ClickNode = nil then
380                    Exit;
381            if GikoForm.ClickNode.IsFirstNode then
382                    Exit;
383            if GikoForm.ClickNode.Text = Favorite.FAVORITE_LINK_NAME then
384                    Exit;
385            GikoForm.FavoriteTreeView.ReadOnly := False;
386            if (GikoForm.TreeType = gttFavorite) and (GikoForm.CabinetPanel.Visible) then begin
387                    node := GikoForm.ClickNode.Parent;
388                    while node <> nil do begin
389                            node.Expanded   := True;
390                            node                                    := node.Parent;
391                    end;
392                    GikoForm.ClickNode.EditText;
393            end else begin
394                    GikoForm.ClickNode.Text := InputBox( '名前の変更', 'お気に入りの新しい名前を入力してください', GikoForm.ClickNode.Text );
395            end;
396    
397            GikoForm.SetLinkBar;
398    end;
399    // *************************************************************************
400    // 新しくお気に入りにフォルダを作成する
401    // *************************************************************************
402    procedure TGikoDM.FavoriteTreeViewNewFolderActionExecute(Sender: TObject);
403    var
404            NewFavFolder: TFavoriteFolder;
405            Node: TTreeNode;
406    begin
407    
408            if GikoForm.ClickNode = nil then
409                    Exit;
410    
411            try
412                    if not (TObject(GikoForm.ClickNode.Data) is TFavoriteFolder) then begin
413                            GikoForm.FavoriteTreeView.Selected := GikoForm.ClickNode.Parent;
414                            GikoForm.ClickNode := GikoForm.ClickNode.Parent;
415                    end;
416    
417                    NewFavFolder := TFavoriteFolder.Create;
418                    Node := GikoForm.FavoriteTreeView.Items.AddChildObject(GikoForm.ClickNode, '新しいフォルダ', NewFavFolder);
419                    Node.ImageIndex := 14;
420                    Node.SelectedIndex := 14;
421            //                      FClickNode.Selected.Expanded := True;
422                    GikoForm.FavoriteTreeView.Selected := Node;
423                    GikoForm.ClickNode := Node;
424                    FavoriteTreeViewRenameAction.Execute;
425            finally
426            end;
427    
428    end;
429    // *************************************************************************
430    // このお気に入りを削除する
431    // *************************************************************************
432    procedure TGikoDM.FavoriteTreeViewDeleteActionExecute(Sender: TObject);
433    const
434            DEL_LINK_MSG = '“リンク”はリンクバー用フォルダです。削除してよろしいですか?';
435            DEL_MSG = '“^0”を削除します。よろしいですか?';
436            DEL_TITLE = '削除確認';
437    begin
438    
439            if GikoForm.ClickNode = nil then
440                    Exit;
441            if GikoForm.ClickNode.IsFirstNode then
442                    Exit;
443            if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
444                    if GikoForm.ClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
445                            if MsgBox(GikoForm.Handle, DEL_LINK_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
446                                    Exit;
447                    end else begin
448                            if MsgBox(GikoForm.Handle, StringReplace( DEL_MSG, '^0', GikoForm.ClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
449                                    Exit;
450                    end;
451            end;
452    
453            GikoForm.ClickNode.Delete;
454    
455            GikoForm.SetLinkBar;
456    
457    end;
458    // *************************************************************************
459    // このフォルダに入っているお気に入りを全て開く
460    // *************************************************************************
461    procedure TGikoDM.FavoriteTreeViewBrowseFolderActionExecute(
462      Sender: TObject);
463    begin
464            GikoForm.FavoriteBrowseFolder( GikoForm.ClickNode );
465    end;
466    // *************************************************************************
467    // 選択されているお気に入りをダウンロードする
468    // *************************************************************************
469    procedure TGikoDM.FavoriteTreeViewReloadActionExecute(Sender: TObject);
470    var
471            ThreadItem: TThreadItem;
472            FavThread: TFavoriteThreadItem;
473            Board: TBoard;
474            FavBoard: TFavoriteBoardItem;
475            shiftDown: Boolean;
476    begin
477    
478            if GikoForm.ClickNode = nil then Exit;
479    
480            shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
481    
482            if TObject( GikoForm.ClickNode.Data ) is TFavoriteThreadItem then begin
483                    FavThread := TFavoriteThreadItem( GikoForm.ClickNode.Data );
484                    ThreadItem := FavThread.Item;
485                    if ThreadItem <> nil then
486                            GikoForm.DownloadContent(ThreadItem, shiftDown);
487            end else if TObject( GikoForm.ClickNode.Data ) is TFavoriteBoardItem then begin
488                    FavBoard := TFavoriteBoardItem( GikoForm.ClickNode.Data );
489                    Board := FavBoard.Item;
490                    GikoForm.DownloadList(Board, shiftDown);
491            end;
492    
493    end;
494    // *************************************************************************
495    // 選択されているスレッドのURLをコピーする
496    // *************************************************************************
497    procedure TGikoDM.FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
498    var
499            FavThread       : TFavoriteThreadItem;
500            FavBoard        : TFavoriteBoardItem;
501            s                                       : string;
502    begin
503    
504            if GikoForm.ClickNode = nil then Exit;
505    
506            if (TObject(GikoForm.ClickNode.Data) is TFavoriteThreadItem) then begin
507    
508                    FavThread := TFavoriteThreadItem( GikoForm.ClickNode.Data );
509                    s := FavThread.URL + #13#10;
510                    if s <> '' then
511                            Clipboard.AsText := s;
512    
513            end else if (TObject(GikoForm.ClickNode.Data) is TFavoriteBoardItem) then begin
514    
515                    FavBoard := TFavoriteBoardItem( GikoForm.ClickNode.Data );
516                    s := FavBoard.URL + #13#10;
517                    if s <> '' then
518                            Clipboard.AsText := s;
519    
520            end;
521    end;
522    // *************************************************************************
523    // 選択されている板の名前をコピーする
524    // *************************************************************************
525    procedure TGikoDM.FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
526    var
527            ThreadItem: TThreadItem;
528            FavThread: TFavoriteThreadItem;
529            Board: TBoard;
530            FavBoard: TFavoriteBoardItem;
531            s: string;
532    begin
533    
534            if GikoForm.ClickNode = nil then Exit;
535    
536            if (TObject(GikoForm.ClickNode.Data) is TFavoriteThreadItem) then begin
537    
538                    FavThread := TFavoriteThreadItem( GikoForm.ClickNode.Data );
539                    ThreadItem := FavThread.Item;
540    
541                    try
542                            s := ThreadItem.Title + #13#10;
543                            if s <> '' then
544                                    Clipboard.AsText := s;
545                    finally
546                    end;
547    
548            end else if (TObject(GikoForm.ClickNode.Data) is TFavoriteBoardItem) then begin
549    
550                    FavBoard := TFavoriteBoardItem( GikoForm.ClickNode.Data );
551                    Board := FavBoard.Item;
552                    if Board <> nil then
553                            if not Board.IsThreadDatRead then
554                                    GikoSys.ReadSubjectFile(Board);
555    
556                    try
557                            s := Board.Title + #13#10;
558                            if s <> '' then
559                                    Clipboard.AsText := s;
560                    finally
561                    end;
562    
563            end;
564    
565    end;
566    // *************************************************************************
567    // 選択されているスレッドの名前とURLをコピーする
568    // *************************************************************************
569    procedure TGikoDM.FavoriteTreeViewNameURLCopyActionExecute(
570      Sender: TObject);
571    var
572            ThreadItem: TThreadItem;
573            FavThread: TFavoriteThreadItem;
574            Board: TBoard;
575            FavBoard: TFavoriteBoardItem;
576            s: string;
577    begin
578    
579            if GikoForm.ClickNode = nil then Exit;
580    
581            if (TObject(GikoForm.ClickNode.Data) is TFavoriteThreadItem) then begin
582    
583                    FavThread := TFavoriteThreadItem( GikoForm.ClickNode.Data );
584                    ThreadItem := FavThread.Item;
585    
586                    try
587                            s := ThreadItem.Title + #13#10 + ThreadItem.URL + #13#10;
588                            if s <> '' then
589                                    Clipboard.AsText := s;
590                    finally
591                    end;
592    
593            end else if (TObject(GikoForm.ClickNode.Data) is TFavoriteBoardItem) then begin
594    
595                    FavBoard := TFavoriteBoardItem( GikoForm.ClickNode.Data );
596                    Board := FavBoard.Item;
597                    if Board <> nil then
598                            if not Board.IsThreadDatRead then
599                                    GikoSys.ReadSubjectFile(Board);
600    
601                    try
602                            s := Board.Title + #13#10 + Board.URL + #13#10;
603                            if s <> '' then
604                                    Clipboard.AsText := s;
605                    finally
606                    end;
607    
608            end;
609    
610    end;
611    // *************************************************************************
612    // 選択されているスレッドを削除する
613    // *************************************************************************
614    procedure TGikoDM.FavoriteTreeViewLogDeleteActionExecute(Sender: TObject);
615    const
616            DEL_MSG = '“^0”のログを削除します。よろしいですか?';
617            DEL_TITLE = '削除確認';
618    var
619            ThreadItem: TThreadItem;
620            FavThread: TFavoriteThreadItem;
621    begin
622    
623            if GikoForm.ClickNode = nil then Exit;
624            if not (TObject(GikoForm.ClickNode.Data) is TFavoriteThreadItem) then Exit;
625    
626            FavThread := TFavoriteThreadItem( GikoForm.ClickNode.Data );
627            ThreadItem := FavThread.Item;
628    
629            try
630                    if GikoSys.Setting.DeleteMsg then begin
631                            if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
632                                    if MsgBox(GikoForm.Handle, StringReplace( DEL_MSG, '^0', GikoForm.ClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
633                                            Exit;
634                    end;
635    
636                    GikoForm.DeleteHistory(ThreadItem);
637                    GikoForm.DeleteTab(ThreadItem);
638                    ThreadItem.DeleteLogFile;
639    
640                    GikoForm.ListView.Refresh;
641            finally
642            end;
643    
644    end;
645    // *************************************************************************
646    // 現在表示しているスレッドをブラウザで表示する
647    // *************************************************************************
648    procedure TGikoDM.FavoriteTreeViewBrowseThreadActionExecute(
649      Sender: TObject);
650    var
651            threadItem      : TThreadItem;
652    begin
653    
654            if GikoForm.ClickNode = nil then Exit;
655    
656            if (TObject(GikoForm.ClickNode.Data) is TFavoriteThreadItem) then begin
657    
658                    threadItem := TFavoriteThreadItem( GikoForm.ClickNode.Data ).Item;
659                    if threadItem = nil then
660                            Exit;
661                    GikoSys.OpenBrowser( threadItem.URL, gbtAuto );
662    
663            end;
664    end;
665    
666  end.  end.
667    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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